Commit f43cbdba authored by lweintraub's avatar lweintraub

LayoutTests:

        Reviewed by justin

        * editing/execCommand/format-block-with-trailing-br-expected.checksum: Added.
        * editing/execCommand/format-block-with-trailing-br-expected.png: Added.
        * editing/execCommand/format-block-with-trailing-br-expected.txt: Added.
        * editing/execCommand/format-block-with-trailing-br.html: Added.

WebCore:

        Reviewed by justin

        * editing/VisiblePosition.cpp: Removed is[Not]EqualIgnoringAffinity and made operator== use the logic that ignores affinity.
        * editing/VisiblePosition.h: Ditto.
        (WebCore::operator==):
        * editing/visible_units.cpp:
        (WebCore::isStartOfParagraph): Changed to compare VisiblePositions using ==.
        (WebCore::isEndOfParagraph): Ditto.
        (WebCore::isStartOfBlock): Ditto.
        (WebCore::isEndOfBlock): Ditto.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15117 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b81e613e
2006-06-30 Levi Weintraub <lweintraub@apple.com>
Reviewed by justin
* editing/execCommand/format-block-with-trailing-br-expected.checksum: Added.
* editing/execCommand/format-block-with-trailing-br-expected.png: Added.
* editing/execCommand/format-block-with-trailing-br-expected.txt: Added.
* editing/execCommand/format-block-with-trailing-br.html: Added.
2006-06-30 Justin Garcia <justin.garcia@apple.com>
Reviewed by levi
4152064e9e88f5f08799c3d9958a7651
\ No newline at end of file
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of PRE > DIV > BODY > HTML > #document to 0 of PRE > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderBlock {DIV} at (0,0) size 784x43 [border: (1px solid #000000)]
RenderBlock {PRE} at (1,14) size 782x15
RenderText {#text} at (0,0) size 24x15
text run at (0,0) width 24: "Foo"
caret: position 0 of child 0 {#text} of child 1 {PRE} of child 0 {DIV} of child 0 {BODY} of child 0 {HTML} of document
<div style="border:1px solid black" contenteditable="true">
<div id="item1">Foo<br></div>
</div>
<script>
var s = window.getSelection();
var p1 = document.getElementById("item1");
s.setPosition(p1, 0);
document.execCommand("FormatBlock", false, "pre");
</script>
\ No newline at end of file
2006-06-30 Levi Weintraub <lweintraub@apple.com>
Reviewed by justin
* editing/VisiblePosition.cpp: Removed is[Not]EqualIgnoringAffinity and made operator== use the logic that ignores affinity.
* editing/VisiblePosition.h: Ditto.
(WebCore::operator==):
* editing/visible_units.cpp:
(WebCore::isStartOfParagraph): Changed to compare VisiblePositions using ==.
(WebCore::isEndOfParagraph): Ditto.
(WebCore::isStartOfBlock): Ditto.
(WebCore::isEndOfBlock): Ditto.
=== Safari-521.14 ===
2006-06-30 Justin Garcia <justin.garcia@apple.com>
......
......@@ -256,26 +256,6 @@ UChar VisiblePosition::characterAfter() const
return textNode->data()[offset];
}
bool isEqualIgnoringAffinity(const VisiblePosition &a, const VisiblePosition &b)
{
bool result = a.deepEquivalent() == b.deepEquivalent() ||
// FIXME (8622): This is a slow but temporary workaround.
a.deepEquivalent().downstream() == b.deepEquivalent().downstream();
if (result) {
// We want to catch cases where positions are equal, but affinities are not, since
// this is very likely a bug, given the places where this call is used. The difference
// is very likely due to code that set the affinity on a VisiblePosition "by hand" and
// did so incorrectly.
ASSERT(a.affinity() == b.affinity());
}
return result;
}
bool isNotEqualIgnoringAffinity(const VisiblePosition &a, const VisiblePosition &b)
{
return !isEqualIgnoringAffinity(a, b);
}
void VisiblePosition::debugPosition(const char *msg) const
{
if (isNull())
......
......@@ -93,7 +93,9 @@ private:
inline bool operator==(const VisiblePosition &a, const VisiblePosition &b)
{
return a.deepEquivalent() == b.deepEquivalent() && a.affinity() == b.affinity();
return a.deepEquivalent() == b.deepEquivalent() ||
// FIXME (8622): This is a slow but temporary workaround.
a.deepEquivalent().downstream() == b.deepEquivalent().downstream();
}
inline bool operator!=(const VisiblePosition &a, const VisiblePosition &b)
......@@ -101,9 +103,6 @@ inline bool operator!=(const VisiblePosition &a, const VisiblePosition &b)
return !(a == b);
}
bool isEqualIgnoringAffinity(const VisiblePosition&, const VisiblePosition&);
bool isNotEqualIgnoringAffinity(const VisiblePosition&, const VisiblePosition&);
PassRefPtr<Range> makeRange(const VisiblePosition &, const VisiblePosition &);
bool setStart(Range*, const VisiblePosition&);
bool setEnd(Range*, const VisiblePosition&);
......
......@@ -655,12 +655,12 @@ bool inSameParagraph(const VisiblePosition &a, const VisiblePosition &b)
bool isStartOfParagraph(const VisiblePosition &pos)
{
return pos.isNotNull() && isEqualIgnoringAffinity(pos, startOfParagraph(pos));
return pos.isNotNull() && pos == startOfParagraph(pos);
}
bool isEndOfParagraph(const VisiblePosition &pos)
{
return pos.isNotNull() && isEqualIgnoringAffinity(pos, endOfParagraph(pos));
return pos.isNotNull() && pos == endOfParagraph(pos);
}
VisiblePosition previousParagraphPosition(const VisiblePosition &p, int x)
......@@ -718,12 +718,12 @@ bool inSameBlock(const VisiblePosition &a, const VisiblePosition &b)
bool isStartOfBlock(const VisiblePosition &pos)
{
return pos.isNotNull() && isEqualIgnoringAffinity(pos, startOfBlock(pos));
return pos.isNotNull() && pos == startOfBlock(pos);
}
bool isEndOfBlock(const VisiblePosition &pos)
{
return pos.isNotNull() && isEqualIgnoringAffinity(pos, endOfBlock(pos));
return pos.isNotNull() && pos == endOfBlock(pos);
}
// ---------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment