LayoutTests:
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Jun 2006 21:22:50 +0000 (21:22 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Jun 2006 21:22:50 +0000 (21:22 +0000)
        Reviewed by levi

        <rdar://problem/4590366>
        REGRESSION: Selection incorrectly paints gaps on TOT

        Added:
        * editing/selection/line-wrap-1-expected.checksum: Added.
        * editing/selection/line-wrap-1-expected.png: Added.
        * editing/selection/line-wrap-1-expected.txt: Added.
        * editing/selection/line-wrap-1.html: Added.
        * editing/selection/line-wrap-2-expected.checksum: Added.
        * editing/selection/line-wrap-2-expected.png: Added.
        * editing/selection/line-wrap-2-expected.txt: Added.
        * editing/selection/line-wrap-2.html: Added.
        Fixes:
        * editing/execCommand/findString-expected.checksum:
        * editing/execCommand/findString-expected.png:
        * editing/execCommand/findString-expected.txt:
        * editing/inserting/editing-empty-divs-expected.checksum:
        * editing/inserting/editing-empty-divs-expected.png:
        * editing/inserting/editing-empty-divs-expected.txt:
        * editing/inserting/insert-3659587-fix-expected.txt:
        * editing/inserting/insert-tab-002-expected.txt:
        * editing/inserting/insert-text-with-newlines-expected.txt:
        * editing/inserting/typing-001-expected.txt:
        * editing/inserting/typing-003-expected.txt:
        * editing/inserting/typing-around-br-001-expected.txt:
        * editing/style/remove-underline-across-paragraph-expected.txt:
        * editing/style/remove-underline-across-paragraph-in-bold-expected.txt:
        * editing/style/remove-underline-after-paragraph-expected.txt:
        * editing/style/remove-underline-after-paragraph-in-bold-expected.txt:
        * editing/style/remove-underline-expected.txt:
        * editing/style/remove-underline-from-stylesheet-expected.txt:
        * editing/style/remove-underline-in-bold-expected.txt:
        * editing/style/typing-style-002-expected.txt:
        * editing/style/typing-style-003-expected.txt:
        * editing/style/unbold-in-bold-expected.txt:
        * editing/style/underline-expected.txt:
        Disabled (9337):
        * editing/input/attributed-substring-from-range-lines.html

WebCore:

        Reviewed by levi

        <rdar://problem/4590366>
        REGRESSION: Selection incorrectly paints gaps on TOT

        * dom/Document.cpp:
        (WebCore::Document::updateSelection): Use the leftmost candidate for the end of the
        selection and the rightmost candidate for the start of the selection.
        * dom/Position.cpp:
        (WebCore::Position::upstream): Cross line wraps so that we can use upstream/downstream
        to get to candidates before/after linewraps.
        (WebCore::Position::downstream):
        (WebCore::Position::inRenderedContent):
        * editing/DeleteSelectionCommand.cpp:
        (WebCore::DeleteSelectionCommand::handleGeneralDelete):
        (WebCore::DeleteSelectionCommand::mergeParagraphs):
        * editing/InsertParagraphSeparatorCommand.cpp:
        (WebCore::InsertParagraphSeparatorCommand::doApply):
        Ensure that the leftmost candidate is used.  We should sample the style from that one.
        When the block to insert is after a br, a br should be inserted even in strict mode.
        * editing/InsertTextCommand.cpp:
        (WebCore::InsertTextCommand::input):
        Insert at the leftmost candidate, get rid of a use of trailingWhitespacePosition.
        Don't apply a style if its unnecessary.
        * editing/ReplaceSelectionCommand.cpp:
        (WebCore::ReplaceSelectionCommand::doApply): "pos" can be invalidated, don't use it.
        * editing/VisiblePosition.cpp:
        Renamed initDeepPosition and made it return the canonical position.
        (WebCore::VisiblePosition::init):
        (WebCore::VisiblePosition::canonicalPosition):
        * editing/VisiblePosition.h:
        (WebCore::VisiblePosition::characterBefore): Added.
        * editing/visible_units.cpp:
        (WebCore::startOfParagraph):
        * rendering/InlineTextBox.cpp:
        (WebCore::InlineTextBox::selectionState): When a selection ends at a line wrap, it shouldn't extend
        onto the next line.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@14952 268f45cc-cd09-0410-ab3c-d52691b4dbfc

46 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/execCommand/findString-expected.checksum
LayoutTests/editing/execCommand/findString-expected.png
LayoutTests/editing/execCommand/findString-expected.txt
LayoutTests/editing/input/attributed-substring-from-range-lines-expected.txt
LayoutTests/editing/input/attributed-substring-from-range-lines.html-disabled [moved from LayoutTests/editing/input/attributed-substring-from-range-lines.html with 100% similarity]
LayoutTests/editing/inserting/editing-empty-divs-expected.checksum
LayoutTests/editing/inserting/editing-empty-divs-expected.png
LayoutTests/editing/inserting/editing-empty-divs-expected.txt
LayoutTests/editing/inserting/insert-3659587-fix-expected.txt
LayoutTests/editing/inserting/insert-tab-002-expected.txt
LayoutTests/editing/inserting/insert-text-with-newlines-expected.txt
LayoutTests/editing/inserting/typing-001-expected.txt
LayoutTests/editing/inserting/typing-003-expected.txt
LayoutTests/editing/inserting/typing-around-br-001-expected.txt
LayoutTests/editing/selection/line-wrap-1-expected.checksum [new file with mode: 0644]
LayoutTests/editing/selection/line-wrap-1-expected.png [new file with mode: 0644]
LayoutTests/editing/selection/line-wrap-1-expected.txt [new file with mode: 0644]
LayoutTests/editing/selection/line-wrap-1.html [new file with mode: 0644]
LayoutTests/editing/selection/line-wrap-2-expected.checksum [new file with mode: 0644]
LayoutTests/editing/selection/line-wrap-2-expected.png [new file with mode: 0644]
LayoutTests/editing/selection/line-wrap-2-expected.txt [new file with mode: 0644]
LayoutTests/editing/selection/line-wrap-2.html [new file with mode: 0644]
LayoutTests/editing/style/remove-underline-across-paragraph-expected.txt
LayoutTests/editing/style/remove-underline-across-paragraph-in-bold-expected.txt
LayoutTests/editing/style/remove-underline-after-paragraph-expected.txt
LayoutTests/editing/style/remove-underline-after-paragraph-in-bold-expected.txt
LayoutTests/editing/style/remove-underline-expected.txt
LayoutTests/editing/style/remove-underline-from-stylesheet-expected.txt
LayoutTests/editing/style/remove-underline-in-bold-expected.txt
LayoutTests/editing/style/typing-style-002-expected.txt
LayoutTests/editing/style/typing-style-003-expected.txt
LayoutTests/editing/style/unbold-in-bold-expected.txt
LayoutTests/editing/style/underline-expected.txt
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/dom/Document.cpp
WebCore/dom/Position.cpp
WebCore/editing/DeleteSelectionCommand.cpp
WebCore/editing/InsertParagraphSeparatorCommand.cpp
WebCore/editing/InsertTextCommand.cpp
WebCore/editing/ReplaceSelectionCommand.cpp
WebCore/editing/VisiblePosition.cpp
WebCore/editing/VisiblePosition.h
WebCore/editing/visible_units.cpp
WebCore/rendering/InlineTextBox.cpp

index 7d39dc8..aa2c031 100644 (file)
@@ -1,3 +1,46 @@
+2006-06-21  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by levi
+        
+        <rdar://problem/4590366>
+        REGRESSION: Selection incorrectly paints gaps on TOT
+        
+        Added:
+        * editing/selection/line-wrap-1-expected.checksum: Added.
+        * editing/selection/line-wrap-1-expected.png: Added.
+        * editing/selection/line-wrap-1-expected.txt: Added.
+        * editing/selection/line-wrap-1.html: Added.
+        * editing/selection/line-wrap-2-expected.checksum: Added.
+        * editing/selection/line-wrap-2-expected.png: Added.
+        * editing/selection/line-wrap-2-expected.txt: Added.
+        * editing/selection/line-wrap-2.html: Added.
+        Fixes:
+        * editing/execCommand/findString-expected.checksum:
+        * editing/execCommand/findString-expected.png:
+        * editing/execCommand/findString-expected.txt:
+        * editing/inserting/editing-empty-divs-expected.checksum:
+        * editing/inserting/editing-empty-divs-expected.png:
+        * editing/inserting/editing-empty-divs-expected.txt:
+        * editing/inserting/insert-3659587-fix-expected.txt:
+        * editing/inserting/insert-tab-002-expected.txt:
+        * editing/inserting/insert-text-with-newlines-expected.txt:
+        * editing/inserting/typing-001-expected.txt:
+        * editing/inserting/typing-003-expected.txt:
+        * editing/inserting/typing-around-br-001-expected.txt:
+        * editing/style/remove-underline-across-paragraph-expected.txt:
+        * editing/style/remove-underline-across-paragraph-in-bold-expected.txt:
+        * editing/style/remove-underline-after-paragraph-expected.txt:
+        * editing/style/remove-underline-after-paragraph-in-bold-expected.txt:
+        * editing/style/remove-underline-expected.txt:
+        * editing/style/remove-underline-from-stylesheet-expected.txt:
+        * editing/style/remove-underline-in-bold-expected.txt:
+        * editing/style/typing-style-002-expected.txt:
+        * editing/style/typing-style-003-expected.txt:
+        * editing/style/unbold-in-bold-expected.txt:
+        * editing/style/underline-expected.txt:
+        Disabled (9337):
+        * editing/input/attributed-substring-from-range-lines.html
+
 2006-06-21  Anders Carlsson  <acarlsson@apple.com>
 
         Reviewed by Geoff.
index 1cf96c1..3b192ff 100644 (file)
@@ -1 +1 @@
-19392fc36136b2b5b4e1bb8053dee2b6
\ No newline at end of file
+0c9c4fc138e1ea2e03494807e6df2c46
\ No newline at end of file
index 8895b8c..19b4f5f 100644 (file)
Binary files a/LayoutTests/editing/execCommand/findString-expected.png and b/LayoutTests/editing/execCommand/findString-expected.png differ
index c7264cd..388010e 100644 (file)
@@ -17,5 +17,5 @@ layer at (0,0) size 800x600
             text run at (1,19) width 20: "bar"
         RenderText {#text} at (21,19) size 26x18
           text run at (21,19) width 26: " baz"
-selection start: position 0 of child 1 {SPAN} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
+selection start: position 0 of child 0 {#text} of child 1 {SPAN} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
 selection end:   position 1 of child 2 {#text} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
index bfeda65..f73c981 100644 (file)
@@ -108,22 +108,22 @@ Actual HTML:
 (0, 3) length: 3
 (0, 6): 12{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Roman 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }3{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Bold 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }456{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-BoldItalic 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }
 (0, 6) length: 6
-(0, 7): 12{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Roman 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }3{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Bold 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }456{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-BoldItalic 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; } { NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Roman 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; } {}
-(0, 7) length: 8
-(0, 31): 12{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Roman 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }3{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Bold 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }456{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-BoldItalic 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; } { NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Roman 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; } {}
-(0, 31) length: 8
-(0, 100): 12{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Roman 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }3{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Bold 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }456{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-BoldItalic 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; } { NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Roman 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; } {}
-(0, 100) length: 8
-(1, 100): 2{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Roman 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }3{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Bold 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }456{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-BoldItalic 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; } { NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Roman 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; } {}
-(1, 100) length: 7
+(0, 7): 12{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Roman 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }3{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Bold 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }
+(0, 7) length: 3
+(0, 31): 12{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Roman 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }3{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Bold 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }456{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-BoldItalic 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; } {}
+(0, 31) length: 7
+(0, 100): 12{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Roman 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }3{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Bold 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }456{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-BoldItalic 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; } {}
+(0, 100) length: 7
+(1, 100): 2{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Roman 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }3{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Bold 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }456{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-BoldItalic 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; } {}
+(1, 100) length: 6
 (2, 3): 3{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Bold 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }45{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-BoldItalic 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }
 (2, 3) length: 3
 (5, 1): 6{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-BoldItalic 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }
 (5, 1) length: 1
-(5, 2): 6{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-BoldItalic 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; } { NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Roman 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; } {}
-(5, 2) length: 3
-(5, 5): 6{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-BoldItalic 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; } { NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Roman 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; } {}lin{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Roman 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }
-(5, 5) length: 6
+(5, 2): 6{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-BoldItalic 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }
+(5, 2) length: 1
+(5, 5): 6{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-BoldItalic 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; } {}lin{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Roman 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }
+(5, 5) length: 5
 (15, 14): line two{ NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Roman 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; } {}and { NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Roman 16.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=4.00"; }three   { NSColor = NSCalibratedWhiteColorSpace 0 1; NSFont = "Times-Roman 48.00 pt. S [] (0xXXXXXXXX) fobj=0xXXXXXXXX, spc=12.00"; }
 (15, 14) length: 22
 (100, 0): undefined
index 6e23839..1eb061b 100644 (file)
@@ -1 +1 @@
-05d17cb8475c8016ac9b13f06ef69786
\ No newline at end of file
+c5d7c2806f51cf3fc3d9ed71bf909a85
\ No newline at end of file
index 0e0e648..6195a37 100644 (file)
Binary files a/LayoutTests/editing/inserting/editing-empty-divs-expected.png and b/LayoutTests/editing/inserting/editing-empty-divs-expected.png differ
index 99fb94a..f9487d3 100644 (file)
@@ -1,8 +1,7 @@
 EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 1 of DIV > BODY > HTML > #document
 EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > BODY > HTML > #document to 2 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 EDITING DELEGATE: shouldEndEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 1 of DIV > BODY > HTML > #document
 EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification
@@ -50,8 +49,8 @@ layer at (0,0) size 800x600
         RenderText {#text} at (0,0) size 176x18
           text run at (0,0) width 176: "This div contains some text."
       RenderBlock {DIV} at (0,86) size 707x22 [border: (1px dotted #0000FF)]
-        RenderText {#text} at (1,1) size 42x18
-          text run at (1,1) width 42: " chello"
+        RenderText {#text} at (1,1) size 38x18
+          text run at (1,1) width 38: "chello"
       RenderBlock {P} at (0,124) size 784x18
         RenderText {#text} at (0,0) size 186x18
           text run at (0,0) width 186: "This div is completely empty."
index 579b17a..d9b8587 100644 (file)
@@ -51,5 +51,4 @@ layer at (0,0) size 800x600
             RenderText {#text} at (14,42) size 36x28
               text run at (14,42) width 36: "xxx"
             RenderBR {BR} at (50,64) size 0x0
-        RenderText {#text} at (0,0) size 0x0
 caret: position 3 of child 2 {#text} of child 0 {B} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
index 1fc7752..18aa027 100644 (file)
@@ -19,5 +19,4 @@ layer at (0,0) size 800x600
           RenderInline {SPAN} at (0,0) size 16x28
             RenderText {#text} at (46,14) size 16x28
               text run at (46,14) width 16: "\x{9}"
-        RenderText {#text} at (0,0) size 0x0
 caret: position 1 of child 0 {#text} of child 1 {SPAN} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
index 5d43293..37996bf 100644 (file)
@@ -66,5 +66,4 @@ layer at (0,0) size 800x600
           RenderBR {BR} at (14,70) size 0x28
           RenderText {#text} at (14,98) size 70x28
             text run at (14,98) width 70: "bazxxx"
-        RenderText {#text} at (0,0) size 0x0
 caret: position 6 of child 6 {#text} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
index f3a6935..00bda69 100644 (file)
@@ -41,5 +41,4 @@ layer at (0,0) size 800x600
         RenderInline {SPAN} at (0,0) size 176x28
           RenderText {#text} at (14,14) size 176x28
             text run at (14,14) width 176: "xxxXXxxxXXxxx"
-        RenderText {#text} at (0,0) size 0x0
 caret: position 13 of child 0 {#text} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
index 11d2065..569af6b 100644 (file)
@@ -712,5 +712,4 @@ layer at (0,0) size 800x600
           text run at (14,70) width 720: "xxx xx xxxx xxx xxx xx xxxxxx xxxxx xxxxxx xxx xx xxxx xxx xxx xx x "
           text run at (14,98) width 360: "xxxxx xxxxxxxxxxxx xxxxxxxx xxx "
         RenderInline {SPAN} at (0,0) size 0x28
-        RenderText {#text} at (0,0) size 0x0
 caret: position 233 of child 0 {#text} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
index eff7e89..22ec816 100644 (file)
@@ -118,5 +118,4 @@ layer at (0,0) size 800x600
           RenderBR {BR} at (50,204) size 0x0
           RenderText {#text} at (14,210) size 70x28
             text run at (14,210) width 70: "XXxxx"
-        RenderText {#text} at (0,0) size 0x0
 caret: position 5 of child 14 {#text} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/selection/line-wrap-1-expected.checksum b/LayoutTests/editing/selection/line-wrap-1-expected.checksum
new file mode 100644 (file)
index 0000000..10189a6
--- /dev/null
@@ -0,0 +1 @@
+b72ebfc8cc4d50c6caa0952f54a3d391
\ No newline at end of file
diff --git a/LayoutTests/editing/selection/line-wrap-1-expected.png b/LayoutTests/editing/selection/line-wrap-1-expected.png
new file mode 100644 (file)
index 0000000..ebefe35
Binary files /dev/null and b/LayoutTests/editing/selection/line-wrap-1-expected.png differ
diff --git a/LayoutTests/editing/selection/line-wrap-1-expected.txt b/LayoutTests/editing/selection/line-wrap-1-expected.txt
new file mode 100644 (file)
index 0000000..3da7c2b
--- /dev/null
@@ -0,0 +1,15 @@
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+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 {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 185x18
+          text run at (0,0) width 185: "Only 'bar' should be selected."
+      RenderBlock {DIV} at (0,34) size 52x38 [border: (1px solid #000000)]
+        RenderText {#text} at (1,1) size 47x36
+          text run at (1,1) width 45: "foo bar"
+          text run at (1,19) width 47: "baz foo"
+selection start: position 4 of child 0 {#text} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
+selection end:   position 7 of child 0 {#text} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/selection/line-wrap-1.html b/LayoutTests/editing/selection/line-wrap-1.html
new file mode 100644 (file)
index 0000000..30cffce
--- /dev/null
@@ -0,0 +1,10 @@
+<p>Only 'bar' should be selected.</p>
+
+<div id="test" style="width: 50px; border: 1px solid black;">foo bar baz foo</div>
+
+<script>
+var s = window.getSelection();
+var e = document.getElementById("test");
+
+s.setBaseAndExtent(e.firstChild, 4, e.firstChild, 7);
+</script>
\ No newline at end of file
diff --git a/LayoutTests/editing/selection/line-wrap-2-expected.checksum b/LayoutTests/editing/selection/line-wrap-2-expected.checksum
new file mode 100644 (file)
index 0000000..b763e81
--- /dev/null
@@ -0,0 +1 @@
+bbdbaa75eb66c8a68426f0fbb6d6c956
\ No newline at end of file
diff --git a/LayoutTests/editing/selection/line-wrap-2-expected.png b/LayoutTests/editing/selection/line-wrap-2-expected.png
new file mode 100644 (file)
index 0000000..9b7ff9a
Binary files /dev/null and b/LayoutTests/editing/selection/line-wrap-2-expected.png differ
diff --git a/LayoutTests/editing/selection/line-wrap-2-expected.txt b/LayoutTests/editing/selection/line-wrap-2-expected.txt
new file mode 100644 (file)
index 0000000..1a423bc
--- /dev/null
@@ -0,0 +1,17 @@
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+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 {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 230x18
+          text run at (0,0) width 230: "Only 'baz' should be selected below."
+      RenderBlock {DIV} at (50,34) size 52x38 [border: (1px solid #000000)]
+        RenderText {#text} at (1,1) size 45x18
+          text run at (1,1) width 45: "foo bar"
+        RenderInline {A} at (0,0) size 22x18 [color=#0000EE]
+          RenderText {#text} at (1,19) size 22x18
+            text run at (1,19) width 22: "baz"
+selection start: position 0 of child 0 {#text} of child 1 {A} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
+selection end:   position 3 of child 0 {#text} of child 1 {A} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/selection/line-wrap-2.html b/LayoutTests/editing/selection/line-wrap-2.html
new file mode 100644 (file)
index 0000000..c93442d
--- /dev/null
@@ -0,0 +1,10 @@
+<p>Only 'baz' should be selected below.</p>
+
+<div id="test" style="width: 50px; margin-left: 50px; border: 1px solid black;">foo bar <a id="selectme" href="foo">baz</a></div>
+
+<script>
+var s = window.getSelection();
+var e = document.getElementById("selectme");
+
+s.setBaseAndExtent(e, 0, e, 1);
+</script>
\ No newline at end of file
index c010018..fbd3902 100644 (file)
@@ -106,7 +106,6 @@ layer at (0,0) size 800x600
           RenderText {#text} at (78,0) size 72x28
             text run at (78,0) width 72: "xxxxxx"
           RenderInline {SPAN} at (0,0) size 0x28
-          RenderText {#text} at (0,0) size 0x0
         RenderBlock {DIV} at (14,42) size 756x28
           RenderText {#text} at (0,0) size 78x28
             text run at (0,0) width 78: " xxxxxx"
@@ -114,4 +113,4 @@ layer at (0,0) size 800x600
             RenderText {#text} at (78,0) size 78x28
               text run at (78,0) width 78: " xxxxxx"
 selection start: position 0 of child 1 {#text} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
-selection end:   position 7 of child 0 {#text} of child 5 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+selection end:   position 7 of child 0 {#text} of child 4 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
index d3ca21f..fe2d475 100644 (file)
@@ -90,7 +90,7 @@ EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotificatio
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 7 of #text > B > SPAN > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > B > SPAN > DIV > BODY > HTML > #document to 7 of #text > B > SPAN > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of SPAN > DIV > BODY > HTML > #document to 7 of #text > B > SPAN > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > B > SPAN > DIV > BODY > HTML > #document to 7 of #text > B > SPAN > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 layer at (0,0) size 800x600
@@ -108,7 +108,6 @@ layer at (0,0) size 800x600
               RenderText {#text} at (78,0) size 72x28
                 text run at (78,0) width 72: "xxxxxx"
           RenderInline {SPAN} at (0,0) size 0x28
-          RenderText {#text} at (0,0) size 0x0
         RenderBlock {DIV} at (14,42) size 756x28
           RenderInline {SPAN} at (0,0) size 156x28
             RenderInline {B} at (0,0) size 78x28
@@ -118,4 +117,4 @@ layer at (0,0) size 800x600
               RenderText {#text} at (78,0) size 78x28
                 text run at (78,0) width 78: " xxxxxx"
 selection start: position 0 of child 0 {#text} of child 1 {B} of child 0 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
-selection end:   position 7 of child 0 {#text} of child 0 {B} of child 0 {SPAN} of child 4 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+selection end:   position 7 of child 0 {#text} of child 0 {B} of child 0 {SPAN} of child 3 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
index f7e8e34..0b11434 100644 (file)
@@ -96,8 +96,7 @@ layer at (0,0) size 800x600
             RenderText {#text} at (0,0) size 150x28
               text run at (0,0) width 150: "xxxxxx xxxxxx"
           RenderInline {SPAN} at (0,0) size 0x28
-          RenderText {#text} at (0,0) size 0x0
         RenderBlock {DIV} at (14,42) size 756x28
           RenderText {#text} at (0,0) size 156x28
             text run at (0,0) width 156: " xxxxxx xxxxxx"
-caret: position 14 of child 0 {#text} of child 4 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+caret: position 14 of child 0 {#text} of child 3 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
index b470d08..5e04fdd 100644 (file)
@@ -97,9 +97,8 @@ layer at (0,0) size 800x600
               RenderText {#text} at (0,0) size 150x28
                 text run at (0,0) width 150: "xxxxxx xxxxxx"
           RenderInline {SPAN} at (0,0) size 0x28
-          RenderText {#text} at (0,0) size 0x0
         RenderBlock {DIV} at (14,42) size 756x28
           RenderInline {B} at (0,0) size 156x28
             RenderText {#text} at (0,0) size 156x28
               text run at (0,0) width 156: " xxxxxx xxxxxx"
-caret: position 14 of child 0 {#text} of child 0 {B} of child 4 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+caret: position 14 of child 0 {#text} of child 0 {B} of child 3 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
index 262c263..55a814b 100644 (file)
@@ -64,7 +64,7 @@ EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 7 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 6 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 7 of #text > SPAN > DIV > BODY > HTML > #document to 0 of SPAN > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 6 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 layer at (0,0) size 800x600
@@ -82,6 +82,5 @@ layer at (0,0) size 800x600
           RenderText {#text} at (164,14) size 78x28
             text run at (164,14) width 78: " xxxxxx"
         RenderInline {SPAN} at (0,0) size 0x28
-        RenderText {#text} at (0,0) size 0x0
 selection start: position 0 of child 1 {#text} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
 selection end:   position 6 of child 1 {#text} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
index b34603e..863d934 100644 (file)
@@ -83,6 +83,5 @@ layer at (0,0) size 800x600
             text run at (164,14) width 78: " xxxxxx"
           RenderText {#text} at (0,0) size 0x0
           RenderInline {SPAN} at (0,0) size 0x0
-          RenderText {#text} at (0,0) size 0x0
 selection start: position 0 of child 1 {#text} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
 selection end:   position 6 of child 1 {#text} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
index 56dad72..7a8186e 100644 (file)
@@ -64,7 +64,7 @@ EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 7 of #text > B > SPAN > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > B > SPAN > DIV > BODY > HTML > #document to 6 of #text > B > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 7 of #text > B > SPAN > DIV > BODY > HTML > #document to 0 of SPAN > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > B > SPAN > DIV > BODY > HTML > #document to 6 of #text > B > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 layer at (0,0) size 800x600
@@ -84,6 +84,5 @@ layer at (0,0) size 800x600
             RenderText {#text} at (164,14) size 78x28
               text run at (164,14) width 78: " xxxxxx"
         RenderInline {SPAN} at (0,0) size 0x28
-        RenderText {#text} at (0,0) size 0x0
 selection start: position 0 of child 0 {#text} of child 1 {B} of child 0 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
 selection end:   position 6 of child 0 {#text} of child 1 {B} of child 0 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
index 430e0fb..ddd7d7f 100644 (file)
@@ -22,9 +22,6 @@ EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > I > SPAN > DIV > BODY > HTML > #document to 1 of #text > I > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > I > SPAN > DIV > BODY > HTML > #document to 1 of #text > I > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 1 of #text > I > SPAN > DIV > BODY > HTML > #document to 1 of #text > I > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > I > SPAN > DIV > BODY > HTML > #document to 1 of #text > I > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > I > SPAN > DIV > BODY > HTML > #document to 2 of #text > I > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
@@ -34,6 +31,9 @@ EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of #text > I > SPAN > DIV > BODY > HTML > #document to 3 of #text > I > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > I > SPAN > DIV > BODY > HTML > #document to 4 of #text > I > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 4 of #text > I > SPAN > DIV > BODY > HTML > #document to 4 of #text > I > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > I > SPAN > DIV > BODY > HTML > #document to 5 of #text > I > SPAN > 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
@@ -43,13 +43,10 @@ layer at (0,0) size 800x600
         RenderInline {SPAN} at (0,0) size 166x28
           RenderText {#text} at (14,14) size 70x28
             text run at (14,14) width 70: "here is "
-          RenderInline {I} at (0,0) size 9x28
-            RenderText {#text} at (84,14) size 9x28
-              text run at (84,14) width 9: "s"
-          RenderInline {I} at (0,0) size 44x28
-            RenderText {#text} at (93,14) size 44x28
-              text run at (93,14) width 44: "xxxx"
+          RenderInline {I} at (0,0) size 53x28
+            RenderText {#text} at (84,14) size 53x28
+              text run at (84,14) width 53: "sxxxx"
           RenderText {#text} at (137,14) size 43x28
             text run at (137,14) width 43: " text"
         RenderText {#text} at (0,0) size 0x0
-caret: position 4 of child 0 {#text} of child 2 {I} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+caret: position 5 of child 0 {#text} of child 1 {I} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
index 257786d..d6f364f 100644 (file)
@@ -67,7 +67,5 @@ layer at (0,0) size 800x600
                 RenderInline {SPAN} at (0,0) size 36x28
                   RenderText {#text} at (155,14) size 36x28
                     text run at (155,14) width 36: "xxx"
-          RenderText {#text} at (0,0) size 0x0
-          RenderInline {SPAN} at (0,0) size 0x0
-          RenderText {#text} at (0,0) size 0x0
+          RenderInline {SPAN} at (0,0) size 0x28
 caret: position 3 of child 0 {#text} of child 1 {SPAN} of child 1 {SPAN} of child 1 {I} of child 1 {B} of child 0 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
index f40a358..098cc71 100644 (file)
@@ -64,7 +64,7 @@ EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 7 of #text > B > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 6 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 7 of #text > B > DIV > BODY > HTML > #document to 0 of SPAN > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 6 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 layer at (0,0) size 800x600
@@ -82,6 +82,5 @@ layer at (0,0) size 800x600
           RenderText {#text} at (164,14) size 78x28
             text run at (164,14) width 78: " xxxxxx"
         RenderInline {SPAN} at (0,0) size 0x28
-        RenderText {#text} at (0,0) size 0x0
 selection start: position 0 of child 1 {#text} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
 selection end:   position 6 of child 1 {#text} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
index dde929f..fd735fc 100644 (file)
@@ -71,5 +71,4 @@ layer at (0,0) size 800x600
           RenderText {#text} at (14,14) size 228x28
             text run at (14,14) width 228: "xxxxxx xxxxxx xxxxxx"
         RenderInline {SPAN} at (0,0) size 0x28
-        RenderText {#text} at (0,0) size 0x0
 caret: position 20 of child 0 {#text} of child 0 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
index 37821f8..bbc6c82 100644 (file)
@@ -1,3 +1,43 @@
+2006-06-21  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by levi
+        
+        <rdar://problem/4590366>
+        REGRESSION: Selection incorrectly paints gaps on TOT
+
+        * dom/Document.cpp:
+        (WebCore::Document::updateSelection): Use the leftmost candidate for the end of the
+        selection and the rightmost candidate for the start of the selection.
+        * dom/Position.cpp:
+        (WebCore::Position::upstream): Cross line wraps so that we can use upstream/downstream
+        to get to candidates before/after linewraps.
+        (WebCore::Position::downstream):
+        (WebCore::Position::inRenderedContent):
+        * editing/DeleteSelectionCommand.cpp:
+        (WebCore::DeleteSelectionCommand::handleGeneralDelete):
+        (WebCore::DeleteSelectionCommand::mergeParagraphs):
+        * editing/InsertParagraphSeparatorCommand.cpp:
+        (WebCore::InsertParagraphSeparatorCommand::doApply): 
+        Ensure that the leftmost candidate is used.  We should sample the style from that one.
+        When the block to insert is after a br, a br should be inserted even in strict mode.
+        * editing/InsertTextCommand.cpp:
+        (WebCore::InsertTextCommand::input): 
+        Insert at the leftmost candidate, get rid of a use of trailingWhitespacePosition.
+        Don't apply a style if its unnecessary.
+        * editing/ReplaceSelectionCommand.cpp:
+        (WebCore::ReplaceSelectionCommand::doApply): "pos" can be invalidated, don't use it.
+        * editing/VisiblePosition.cpp:
+        Renamed initDeepPosition and made it return the canonical position.
+        (WebCore::VisiblePosition::init):
+        (WebCore::VisiblePosition::canonicalPosition):
+        * editing/VisiblePosition.h: 
+        (WebCore::VisiblePosition::characterBefore): Added.
+        * editing/visible_units.cpp:
+        (WebCore::startOfParagraph):
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::selectionState): When a selection ends at a line wrap, it shouldn't extend
+        onto the next line.
+
 2006-06-21  David Hyatt  <hyatt@apple.com>
 
         Reviewed and committed by Beth.
index fc9785c..eeb523c 100644 (file)
                FAE04190097596C9000540BE /* SVGImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = FAE0418E097596C9000540BE /* SVGImageLoader.h */; };
 /* End PBXBuildFile section */
 
+/* Begin PBXBuildStyle section */
+               D05CF79C0A49D6EA00C5AF38 /* Development */ = {
+                       isa = PBXBuildStyle;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                       };
+                       name = Development;
+               };
+               D05CF79D0A49D6EA00C5AF38 /* Deployment */ = {
+                       isa = PBXBuildStyle;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                       };
+                       name = Deployment;
+               };
+/* End PBXBuildStyle section */
+
 /* Begin PBXContainerItemProxy section */
                DD041FF009D9E3250010AF2A /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
+                       buildSettings = {
+                       };
+                       buildStyles = (
+                               D05CF79C0A49D6EA00C5AF38 /* Development */,
+                               D05CF79D0A49D6EA00C5AF38 /* Deployment */,
+                       );
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
index fe3daa6..d6a0c4f 100644 (file)
@@ -1050,12 +1050,23 @@ void Document::updateSelection()
     
     RenderView *canvas = static_cast<RenderView*>(renderer());
     SelectionController s = frame()->selection();
-    if (!s.isRange()) {
+    if (s.isNone())
+        return;
+        
+    if (!s.isRange())
         canvas->clearSelection();
-    }
     else {
-        Position startPos = VisiblePosition(s.start(), s.affinity()).deepEquivalent();
-        Position endPos = VisiblePosition(s.end(), s.affinity()).deepEquivalent();
+        // Use the rightmost candidate for the start of the selection, and the leftmost candidate for the end of the selection.
+        // Example: foo <a>bar</a>.  Imagine that a line wrap occurs after 'foo', and that 'bar' is selected.   If we pass [foo, 3]
+        // as the start of the selection, the selection painting code will think that content on the line containing 'foo' is selected
+        // and will fill the gap before 'bar'.
+        Position startPos = s.selection().visibleStart().deepEquivalent();
+        if (startPos.downstream().inRenderedContent())
+            startPos = startPos.downstream();
+        Position endPos = s.selection().visibleEnd().deepEquivalent();
+        if (endPos.upstream().inRenderedContent())
+            endPos = endPos.upstream();
+            
         if (startPos.isNotNull() && endPos.isNotNull()) {
             RenderObject *startRenderer = startPos.node()->renderer();
             RenderObject *endRenderer = endPos.node()->renderer();
index 6d949ac..568d072 100644 (file)
@@ -287,7 +287,6 @@ Position Position::upstream() const
     Node *block = startNode->enclosingBlockFlowOrTableElement();
     Position lastVisible = *this;
     Position currentPos = start;
-    RootInlineBox *lastRoot = 0;
     for (; !currentPos.atStart(); currentPos = currentPos.previous(UsingComposedCharacters)) {
         Node *currentNode = currentPos.node();
         int currentOffset = currentPos.offset();
@@ -301,19 +300,7 @@ Position Position::upstream() const
         RenderObject *renderer = currentNode->renderer();
         if (!renderer || renderer->style()->visibility() != VISIBLE)
             continue;
-
-        // Don't move to a position that's on a different line.
-        InlineBox *box = renderer->inlineBox(currentPos.offset(), DOWNSTREAM);
-        RootInlineBox *currentRoot = box ? box->root() : 0;
-        // We consider [br, 1] to be a position that exists visually on the line after the one
-        // on which the <br> appears, so treat it specially.
-        if (currentRoot && currentNode->hasTagName(brTag) && currentOffset == 1)
-            currentRoot = currentRoot->nextRootBox();
-        if (lastRoot == 0)
-            lastRoot = currentRoot;
-        else if (currentRoot && currentRoot != lastRoot)
-            return lastVisible;
-        
+                 
         // track last visible streamer position
         if (isStreamer(currentPos))
             lastVisible = currentPos;
@@ -374,7 +361,6 @@ Position Position::downstream() const
     Node *block = startNode->enclosingBlockFlowOrTableElement();
     Position lastVisible = *this;
     Position currentPos = start;
-    RootInlineBox *lastRoot = 0;
     for (; !currentPos.atEnd(); currentPos = currentPos.next(UsingComposedCharacters)) {   
         Node *currentNode = currentPos.node();
         int currentOffset = currentPos.offset();
@@ -392,19 +378,7 @@ Position Position::downstream() const
         RenderObject *renderer = currentNode->renderer();
         if (!renderer || renderer->style()->visibility() != VISIBLE)
             continue;
-
-        // Don't move to a position that's on a different line.
-        InlineBox *box = renderer->inlineBox(currentPos.offset(), DOWNSTREAM);
-        RootInlineBox *currentRoot = box ? box->root() : 0;
-        // We consider [br, 1] to be a position that exists visually on the line after the one
-        // on which the <br> appears, so treat it specially.
-        if (currentRoot && currentNode->hasTagName(brTag) && currentOffset == 1)
-            currentRoot = currentRoot->nextRootBox();
-        if (lastRoot == 0)
-            lastRoot = currentRoot;
-        else if (currentRoot && currentRoot != lastRoot)
-            return lastVisible;
-        
+            
         // track last visible streamer position
         if (isStreamer(currentPos))
             lastVisible = currentPos;
index 2808580..1c4ea88 100644 (file)
@@ -253,7 +253,7 @@ void DeleteSelectionCommand::handleGeneralDelete()
 {
     int startOffset = m_upstreamStart.offset();
     Node* startNode = m_upstreamStart.node();
-    
+
     // Never remove the start block.
     if (startNode == m_startBlock && startOffset == 0) {
         startOffset = 0;
@@ -325,11 +325,10 @@ void DeleteSelectionCommand::handleGeneralDelete()
             } else {
                 Node* n = node->lastDescendant();
                 if (m_downstreamEnd.node() == n && m_downstreamEnd.offset() >= n->caretMaxOffset()) {
-                    removeNode(node); 
+                    removeNode(node);
                     node = 0;
-                } else {
+                } else
                     node = node->traverseNextNode();
-                }
             }
         }
         
@@ -405,7 +404,7 @@ void DeleteSelectionCommand::mergeParagraphs()
         return;
         
     // Don't move content between parts of a table or between table and non-table content.
-    // FIXME: This isn't right.  A table with two rows and a single column appears as two paragraphs.
+    // FIXME: This isn't right.  A borderless table with two rows and a single column would appear as two paragraphs.
     if (isTableStructureNode(m_downstreamEnd.node()->enclosingBlockFlowElement()) || isTableStructureNode(m_upstreamStart.node()->enclosingBlockFlowElement()))
         return;
         
index 65a7393..4fa2341 100644 (file)
@@ -123,20 +123,25 @@ static Node* enclosingEmptyListItem(const VisiblePosition& visiblePos)
 void InsertParagraphSeparatorCommand::doApply()
 {
     bool splitText = false;
-    Selection selection = endingSelection();
-    if (selection.isNone())
+    if (endingSelection().isNone())
         return;
     
-    Position pos = selection.start();
-    EAffinity affinity = selection.affinity();
+    Position pos = endingSelection().start();
+        
+    EAffinity affinity = endingSelection().affinity();
         
     // Delete the current selection.
-    if (selection.isRange()) {
+    if (endingSelection().isRange()) {
         calculateStyleBeforeInsertion(pos);
         deleteSelection(false, true);
         pos = endingSelection().start();
         affinity = endingSelection().affinity();
     }
+    
+    // Use the leftmost candidate.
+    pos = pos.upstream();
+    if (!pos.inRenderedContent())
+        pos = pos.downstream();
 
     // Adjust the insertion position after the delete
     pos = positionAvoidingSpecialElementBoundary(pos);
@@ -233,12 +238,11 @@ void InsertParagraphSeparatorCommand::doApply()
     //---------------------------------------------------------------------
     // Handle the (more complicated) general case,
 
-    // If pos.node() is a <br> and the document is in quirks mode, this <br>
-    // will collapse away when we add a block after it. Add an extra <br>.
-    if (!document()->inStrictMode()) {
-        Position upstreamPos = pos.upstream();
-        if (upstreamPos.node()->hasTagName(brTag))
-            insertNodeAfter(createBreakElement(document()).get(), upstreamPos.node());
+    Position upstreamPos = pos.upstream();
+    if (upstreamPos.node()->hasTagName(brTag)) {
+        RefPtr<Element> br = createBreakElement(document());
+        insertNodeAfter(br.get(), upstreamPos.node());
+        pos = positionAfterNode(br.get());
     }
     
     // Move downstream. Typing style code will take care of carrying along the 
index a397c2e..6612bcd 100644 (file)
@@ -27,6 +27,7 @@
 #include "InsertTextCommand.h"
 
 #include "CSSMutableStyleDeclaration.h"
+#include "CSSComputedStyleDeclaration.h"
 #include "Document.h"
 #include "Element.h"
 #include "EditingText.h"
@@ -85,33 +86,23 @@ void InsertTextCommand::input(const String &text, bool selectInsertedText)
 {
     assert(text.find('\n') == -1);
 
-    Selection selection = endingSelection();
     if (endingSelection().isNone())
         return;
     
-    // FIXME: I don't see how "start of line" could possibly be the right check here.
-    // It depends on line breaks which depends on the way things are current laid out,
-    // window width, etc. This needs to be rethought.
-    bool adjustDownstream = isStartOfLine(VisiblePosition(selection.start().downstream(), DOWNSTREAM));
-
-    // Delete the current selection, or collapse whitespace, as needed
-    if (selection.isRange())
+    // Delete the current selection.
+    if (endingSelection().isRange())
         deleteSelection();
     
-    // Delete any insignificant text that could get in the way of whitespace turning
-    // out correctly after the insertion.
-    selection = endingSelection();
-    deleteInsignificantTextDownstream(selection.end().trailingWhitespacePosition(selection.affinity()));
-
-    // Figure out the startPosition
-    Position startPosition = selection.start();
-    Position endPosition;
-    if (adjustDownstream)
+    // Insert the character at the leftmost candidate.
+    Position startPosition = endingSelection().start().upstream();
+    deleteInsignificantText(startPosition.upstream(), startPosition.downstream());
+    if (!startPosition.inRenderedContent())
         startPosition = startPosition.downstream();
-    else
-        startPosition = startPosition.upstream();
+        
     startPosition = positionAvoidingSpecialElementBoundary(startPosition);
     
+    Position endPosition;
+    
     if (text == "\t") {
         endPosition = insertTab(startPosition);
         startPosition = endPosition.previous();
@@ -142,6 +133,8 @@ void InsertTextCommand::input(const String &text, bool selectInsertedText)
     // FIXME: Improve typing style.
     // See this bug: <rdar://problem/3769899> Implementation of typing style needs improvement
     CSSMutableStyleDeclaration* typingStyle = document()->frame()->typingStyle();
+    RefPtr<CSSComputedStyleDeclaration> endingStyle = endPosition.computedStyle();
+    endingStyle->diff(typingStyle);
     if (typingStyle && typingStyle->length() > 0)
         applyStyle(typingStyle);
 
index 9cd86b9..f9499eb 100644 (file)
@@ -731,10 +731,9 @@ void ReplaceSelectionCommand::doApply()
         if (endWasEndOfParagraph || !isEndOfParagraph(pos) || next.isNull() || next.rootEditableElement() != currentRoot) {
             setEndingSelection(insertionPos, DOWNSTREAM);
             insertParagraphSeparator();
-            next = pos.next();
 
             // Select up to the paragraph separator that was added.
-            lastPositionToSelect = next.deepEquivalent().downstream();
+            lastPositionToSelect = endingSelection().visibleStart().deepEquivalent();
             updateNodesInserted(lastPositionToSelect.node());
         } else {
             // Select up to the beginning of the next paragraph.
index c5f9ab9..2b066c0 100644 (file)
@@ -53,7 +53,7 @@ void VisiblePosition::init(const Position& position, EAffinity affinity)
 {
     m_affinity = affinity;
     
-    initDeepPosition(position, affinity);
+    m_deepPosition = canonicalPosition(position);
     
     // When not at a line wrap, make sure to end up with DOWNSTREAM affinity.
     if (m_affinity == UPSTREAM && (isNull() || inSameLine(VisiblePosition(position, DOWNSTREAM), *this)))
@@ -136,34 +136,28 @@ Position VisiblePosition::nextVisiblePosition(const Position& pos)
     return Position();
 }
 
-void VisiblePosition::initDeepPosition(const Position& position, EAffinity affinity)
+Position VisiblePosition::canonicalPosition(const Position& position)
 {
-    // FIXME: No need for affinity parameter.
-    // FIXME: Would read nicer if this was a function that returned a Position.
-
+    // FIXME (9535):  Canonicalizing to the leftmost candidate means that if we're at a line wrap, we will 
+    // ask renderers to paint downstream carets for other renderers.
+    // To fix this, we need to either a) add code to all paintCarets to pass the responsibility off to
+    // the appropriate renderer for VisiblePosition's like these, or b) canonicalize to the rightmost candidate
+    // unless the affinity is upstream.
     Node* node = position.node();
-    if (!node) {
-        m_deepPosition = Position();
-        return;
-    }
+    if (!node)
+        return Position();
 
     node->document()->updateLayoutIgnorePendingStylesheets();
 
-    // If two visually equivalent positions are both candidates for being made the m_deepPosition,
-    // (this can happen when two rendered positions have only collapsed whitespace between them),
-    // we always choose the one that occurs first in the DOM to canonicalize VisiblePositions.
-    m_deepPosition = position.upstream();
-    if (m_deepPosition.inRenderedContent())
-        return;
-    m_deepPosition = position;
-    if (m_deepPosition.inRenderedContent())
-        return;
-    m_deepPosition = position.downstream();
-    if (m_deepPosition.inRenderedContent())
-        return;
-
-    // When neither upstream or downstream gets us to a visible position,
-    // look at the next and previous visible position.
+    Position candidate = position.upstream();
+    if (candidate.inRenderedContent())
+        return candidate;
+    candidate = position.downstream();
+    if (candidate.inRenderedContent())
+        return candidate;
+
+    // When neither upstream or downstream gets us to a candidate (upstream/downstream won't leave 
+    // blocks or enter new ones), we search forward and backward until we find one.
     Position next = nextVisiblePosition(position);
     Position prev = previousVisiblePosition(position);
     Node* nextNode = next.node();
@@ -174,33 +168,28 @@ void VisiblePosition::initDeepPosition(const Position& position, EAffinity affin
     // If the html element is editable, descending into its body will look like a descent 
     // from non-editable to editable content since rootEditableElement stops at the body 
     // even if the html element is editable.
-    if (editingRoot && editingRoot->hasTagName(htmlTag)) {
-        m_deepPosition = next.isNotNull() ? next : prev;
-        return;
-    }
+    if (editingRoot && editingRoot->hasTagName(htmlTag))
+        return next.isNotNull() ? next : prev;
+        
     bool prevIsInSameEditableElement = prevNode && prevNode->rootEditableElement() == editingRoot;
     bool nextIsInSameEditableElement = nextNode && nextNode->rootEditableElement() == editingRoot;
-    if (prevIsInSameEditableElement && !nextIsInSameEditableElement) {
-        m_deepPosition = prev;
-        return;
-    }
-    if (nextIsInSameEditableElement && !prevIsInSameEditableElement) {
-        m_deepPosition = next;
-        return;
-    }
-    if (!nextIsInSameEditableElement && !prevIsInSameEditableElement) {
-        m_deepPosition = Position();
-        return;
-    }
+    if (prevIsInSameEditableElement && !nextIsInSameEditableElement)
+        return prev;
+        
+    if (nextIsInSameEditableElement && !prevIsInSameEditableElement)
+        return next;
+        
+    if (!nextIsInSameEditableElement && !prevIsInSameEditableElement)
+        return Position();
 
     // The new position should be in the same block flow element. Favor that.
     Node *originalBlock = node->enclosingBlockFlowElement();
     bool nextIsOutsideOriginalBlock = !nextNode->isAncestor(originalBlock) && nextNode != originalBlock;
     bool prevIsOutsideOriginalBlock = !prevNode->isAncestor(originalBlock) && prevNode != originalBlock;
     if (nextIsOutsideOriginalBlock && !prevIsOutsideOriginalBlock)
-        m_deepPosition = prev;
-    else
-        m_deepPosition = next;
+        return prev;
+        
+    return next;
 }
 
 int VisiblePosition::maxOffset(const Node *node)
index 487b5c0..70efcaa 100644 (file)
@@ -67,6 +67,7 @@ public:
     bool isLastInBlock() const;
 
     UChar characterAfter() const;
+    UChar characterBefore() const { return previous().characterAfter(); }
     
     void debugPosition(const char* msg = "") const;
     
@@ -79,7 +80,7 @@ public:
     
 private:
     void init(const Position&, EAffinity);
-    void initDeepPosition(const Position&, EAffinity affinity);
+    Position canonicalPosition(const Position&);
 
     static int maxOffset(const Node*);
     
index 1094277..669ea0b 100644 (file)
@@ -565,6 +565,7 @@ VisiblePosition startOfParagraph(const VisiblePosition &c)
         // FIXME: isBlockFlow should not exclude non-inline tables
         if (r->isBR() || r->isBlockFlow() || (r->isTable() && !r->isInline()))
             break;
+            
         if (r->isText()) {
             if (style->preserveNewline()) {
                 const UChar* text = static_cast<RenderText*>(r)->text();
index 9192f27..535fef7 100644 (file)
@@ -86,11 +86,6 @@ RenderObject::SelectionState InlineTextBox::selectionState()
     if (state == RenderObject::SelectionStart || state == RenderObject::SelectionEnd || state == RenderObject::SelectionBoth) {
         int startPos, endPos;
         object()->selectionStartEnd(startPos, endPos);
-        
-        // If we're at a line wrap, then the selection is going to extend onto the next line (and thus needs to be thought of as
-        // extending beyond our box.
-        if (textObject()->atLineWrap(this, endPos))
-            endPos++;
 
         bool start = (state != RenderObject::SelectionEnd && startPos >= m_start && startPos < m_start + m_len);
         bool end = (state != RenderObject::SelectionStart && endPos > m_start && endPos <= m_start + m_len);