Title: [98191] trunk/Source/WebCore
Revision
98191
Author
m...@apple.com
Date
2011-10-21 22:52:52 -0700 (Fri, 21 Oct 2011)

Log Message

Caret is drawn in the wrong place in multi-column blocks
https://bugs.webkit.org/show_bug.cgi?id=70662

Reviewed by Gavin Barraclough.

* manual-tests/caret-in-columns.html: Added.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paintCaret): Removed the call to offsetForContents(). That function takes
a point in local coordinates, whereas this function was applying it to a point in painting root
coordinates. The desired effect was only to undo the scroll adjustment done by the caller,
paintObject().
(WebCore::RenderBlock::paintObject): Pass the original, rather than scroll-adjusted, paint offset
to paintCaret().

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (98190 => 98191)


--- trunk/Source/WebCore/ChangeLog	2011-10-22 05:32:12 UTC (rev 98190)
+++ trunk/Source/WebCore/ChangeLog	2011-10-22 05:52:52 UTC (rev 98191)
@@ -1,3 +1,19 @@
+2011-10-21  Dan Bernstein  <m...@apple.com>
+
+        Caret is drawn in the wrong place in multi-column blocks
+        https://bugs.webkit.org/show_bug.cgi?id=70662
+
+        Reviewed by Gavin Barraclough.
+
+        * manual-tests/caret-in-columns.html: Added.
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::paintCaret): Removed the call to offsetForContents(). That function takes
+        a point in local coordinates, whereas this function was applying it to a point in painting root
+        coordinates. The desired effect was only to undo the scroll adjustment done by the caller,
+        paintObject().
+        (WebCore::RenderBlock::paintObject): Pass the original, rather than scroll-adjusted, paint offset
+        to paintCaret().
+
 2011-10-21  Nat Duca  <nd...@chromium.org>
 
         [chromium] Make setVisibility extension- and thread-correct

Added: trunk/Source/WebCore/manual-tests/caret-in-columns.html (0 => 98191)


--- trunk/Source/WebCore/manual-tests/caret-in-columns.html	                        (rev 0)
+++ trunk/Source/WebCore/manual-tests/caret-in-columns.html	2011-10-22 05:52:52 UTC (rev 98191)
@@ -0,0 +1,21 @@
+<div id="target" style="
+    margin: 100px;
+    -webkit-columns: 3;
+    width: 300px;
+    height: 100px;
+    -webkit-user-modify: read-write;
+    outline: none;
+">
+    <br>
+    <br>
+    <br>
+    <br>
+    <br>
+    <br>
+    The blinking insertion point should be here &rarr;
+</div>
+<script>
+    var target = document.getElementById("target");
+    target.focus();
+    getSelection().modify("move", "forward", "documentboundary");
+</script>

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (98190 => 98191)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-10-22 05:32:12 UTC (rev 98190)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-10-22 05:52:52 UTC (rev 98191)
@@ -2549,15 +2549,10 @@
     }
 
     if (caretPainter == this && (isContentEditable || caretBrowsing)) {
-        // Convert the painting offset into the local coordinate system of this renderer,
-        // to match the localCaretRect computed by the FrameSelection
-        LayoutPoint adjustedPaintOffset = paintOffset;
-        offsetForContents(adjustedPaintOffset);
-
         if (type == CursorCaret)
-            frame()->selection()->paintCaret(paintInfo.context, adjustedPaintOffset, paintInfo.rect);
+            frame()->selection()->paintCaret(paintInfo.context, paintOffset, paintInfo.rect);
         else
-            frame()->page()->dragCaretController()->paintDragCaret(frame(), paintInfo.context, adjustedPaintOffset, paintInfo.rect);
+            frame()->page()->dragCaretController()->paintDragCaret(frame(), paintInfo.context, paintOffset, paintInfo.rect);
     }
 }
 
@@ -2640,8 +2635,8 @@
     // If the caret's node's render object's containing block is this block, and the paint action is PaintPhaseForeground,
     // then paint the caret.
     if (paintPhase == PaintPhaseForeground) {        
-        paintCaret(paintInfo, scrolledOffset, CursorCaret);
-        paintCaret(paintInfo, scrolledOffset, DragCaret);
+        paintCaret(paintInfo, paintOffset, CursorCaret);
+        paintCaret(paintInfo, paintOffset, DragCaret);
     }
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to