From: mitz@apple.com Date: Sat, 22 Oct 2011 05:52:52 +0000 (+0000) Subject: Caret is drawn in the wrong place in multi-column blocks X-Git-Url: https://git.webkit.org/?p=WebKit-https.git;a=commitdiff_plain;h=7627f6fdcc86870098a1453c369e534ec6dbbe1d 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(). git-svn-id: https://svn.webkit.org/repository/webkit/trunk@98191 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index ac2525ce25a7..84d25e57f26b 100755 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,19 @@ +2011-10-21 Dan Bernstein + + 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 [chromium] Make setVisibility extension- and thread-correct diff --git a/Source/WebCore/manual-tests/caret-in-columns.html b/Source/WebCore/manual-tests/caret-in-columns.html new file mode 100644 index 000000000000..3941508281fb --- /dev/null +++ b/Source/WebCore/manual-tests/caret-in-columns.html @@ -0,0 +1,21 @@ +
+
+
+
+
+
+
+ The blinking insertion point should be here → +
+ diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp index 0262b396d523..50ddc2321347 100644 --- a/Source/WebCore/rendering/RenderBlock.cpp +++ b/Source/WebCore/rendering/RenderBlock.cpp @@ -2549,15 +2549,10 @@ void RenderBlock::paintCaret(PaintInfo& paintInfo, const LayoutPoint& paintOffse } 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 @@ void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs // 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); } }