REGRESSION (r168095): 1-pixel gap between adjacent selection inlines
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 May 2014 14:20:49 +0000 (14:20 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 May 2014 14:20:49 +0000 (14:20 +0000)
commit4ed9dfecbbf21f4fbfe77c49d52c019ac2d85a38
treeb044db4660e184020f1f1a074a0bf7b07c8814f1
parent38966886968a5e200ef69e029c295e1bd76b91a8
REGRESSION (r168095): 1-pixel gap between adjacent selection inlines
https://bugs.webkit.org/show_bug.cgi?id=132474
<rdar://problem/16797394>

Reviewed by David Hyatt.

This patch changes text selection rectangle calculation from integral to device
pixel snapping. It ensures that selection rect painting matches box boundaries for inline elements.
Directional rounding (horizontal only atm) is moved out from Font class and now accessible
to all the painting code. RTL snapping strategy is changed from floor to round to match ltr behavior.
However this patch does not address all the integral snapping across inline elements. There are
a few places where we still calculate enclosing rects where snapping is sufficient.

Source/WebCore:
Test: fast/inline/hidpi-pixel-gap-between-adjacent-selection-inlines.html

* platform/LayoutUnit.h:
(WebCore::roundToDevicePixel): added fudge factor to change rounding direction as directed.
* platform/graphics/Font.cpp:
(WebCore::Font::adjustSelectionRectForText):
(WebCore::Font::selectionRectForText): Deleted.
* platform/graphics/Font.h:
* platform/graphics/FontFastPath.cpp:
(WebCore::Font::adjustSelectionRectForSimpleText): removed directional rounding.
(WebCore::Font::selectionRectForSimpleText): Deleted.
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawHighlightForText): Deleted.
* platform/graphics/GraphicsContext.h:
* platform/graphics/LayoutPoint.h:
(WebCore::roundedForPainting):
* platform/graphics/LayoutRect.h:
(WebCore::directionalPixelSnappedForPainting): Snap top right corner for rtl direction.
* platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
(WebCore::Font::adjustSelectionRectForComplexText):
(WebCore::Font::selectionRectForComplexText): Deleted.
* platform/graphics/mac/FontComplexTextMac.cpp:
(WebCore::Font::adjustSelectionRectForComplexText): removed directional rounding.
(WebCore::Font::selectionRectForComplexText): Deleted.
* platform/graphics/win/FontWin.cpp:
(WebCore::Font::adjustSelectionRectForComplexText):
(WebCore::Font::selectionRectForComplexText): Deleted.
* rendering/EllipsisBox.cpp:
(WebCore::EllipsisBox::selectionRect):
(WebCore::EllipsisBox::paintSelection):
* rendering/InlineTextBox.cpp:
(WebCore::integralEnclosingRectForSelection): helper to address enclosing empty rect problem.
(WebCore::InlineTextBox::localSelectionRect):
(WebCore::InlineTextBox::paintSelection):
(WebCore::InlineTextBox::paintCompositionBackground):
(WebCore::InlineTextBox::paintDocumentMarker):
(WebCore::InlineTextBox::paintTextMatchMarker):
(WebCore::InlineTextBox::computeRectForReplacementMarker):
(WebCore::InlineTextBox::positionForOffset):
* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::selectionRectForTextFragment):

LayoutTests:
* fast/inline/hidpi-pixel-gap-between-adjacent-selection-inlines-expected.html: Added.
* fast/inline/hidpi-pixel-gap-between-adjacent-selection-inlines.html: Added.
* platform/mac/editing/selection/mixed-editability-10-expected.txt: progression.
* platform/mac/fast/forms/cursor-at-editable-content-boundary-expected.txt: progression.
* platform/mac/platform/mac/editing/input/caret-primary-bidi-expected.txt: Added. change in rounding strategy.
* platform/mac/svg/text/caret-in-svg-text-expected.txt: Added. progression + change in rounding strategy.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@168528 268f45cc-cd09-0410-ab3c-d52691b4dbfc
22 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/inline/hidpi-pixel-gap-between-adjacent-selection-inlines-expected.html [new file with mode: 0644]
LayoutTests/fast/inline/hidpi-pixel-gap-between-adjacent-selection-inlines.html [new file with mode: 0644]
LayoutTests/platform/mac/editing/selection/mixed-editability-10-expected.txt
LayoutTests/platform/mac/fast/forms/cursor-at-editable-content-boundary-expected.txt
LayoutTests/platform/mac/platform/mac/editing/input/caret-primary-bidi-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/svg/text/caret-in-svg-text-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/LayoutUnit.h
Source/WebCore/platform/graphics/Font.cpp
Source/WebCore/platform/graphics/Font.h
Source/WebCore/platform/graphics/FontFastPath.cpp
Source/WebCore/platform/graphics/GraphicsContext.cpp
Source/WebCore/platform/graphics/GraphicsContext.h
Source/WebCore/platform/graphics/LayoutPoint.h
Source/WebCore/platform/graphics/LayoutRect.h
Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp
Source/WebCore/platform/graphics/mac/FontComplexTextMac.cpp
Source/WebCore/platform/graphics/win/FontWin.cpp
Source/WebCore/rendering/EllipsisBox.cpp
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebCore/rendering/svg/SVGInlineTextBox.cpp