-
leviw@chromium.org authored
https://bugs.webkit.org/show_bug.cgi?id=88000 Reviewed by Ryosuke Niwa. Source/WebCore: Fixes for selection painting in both inline line heights and block gaps. We were unintentionally flooring inline and block offsets in RenderBlock, but actually need to intentionally floor the logical left and right values in logical(Left|Right)SelectionGap to properly align our block selection gaps. This is to properly mirror the behavior in pixelSnappedLogicalRightOffsetForLine. We were also unintentionally upcasting LayoutUnits to floats in InlineTextBox's selection painting routine. Now we're properly rounding. Test: fast/sub-pixel/selection/selection-gaps-at-fractional-offsets.html * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paintSelection): Move paint values to integers and do proper rounding. * rendering/RenderBlock.cpp: (WebCore::blockDirectionOffset): Fix incorrect flooring in return value. (WebCore::inlineDirectionOffset): Ditto. (WebCore): Removing previous attempt to properly mirror inline box selection pixel alignment. This implementation rounded the final x value instead of properly rounding our block offset then flooring the offset that corresponds to the behavior in InlineTextBox. It also didn't properly pixel snap the y offset and height. (WebCore::RenderBlock::blockSelectionGap): Properly pixel snapping the gap rect before painting. (WebCore::RenderBlock::logicalLeftSelectionGap): Correctly match InlineTextBox's selection pixel alignment by flooring the logicalLeft and pixel snapping the subsequent rect. We do this in order to maintain proper render tree pixel snapping while simultaneously mirroring the flooring in the inline direction that occurs in InlineTextBox.cpp's alignSelectionRectToDevicePixels method. (WebCore::RenderBlock::logicalRightSelectionGap): Ditto with the right. LayoutTests: One new selection test and updated snowleopard expectations for a handful that improved. Note: a couple of the RTL results appear worse, but sadly are only returning to our old pre-sub-pixel results. * fast/sub-pixel/selection: Added. * fast/sub-pixel/selection/selection-gaps-at-fractional-offsets-expected.txt: Added. * fast/sub-pixel/selection/selection-gaps-at-fractional-offsets.html: Added. * platform/chromium-mac-snowleopard/editing/selection/3690703-2-expected.png: * platform/chromium-mac-snowleopard/editing/selection/3690703-expected.png: * platform/chromium-mac-snowleopard/editing/selection/3690719-expected.png: * platform/chromium-mac-snowleopard/editing/selection/selection-button-text-expected.png: * platform/chromium-mac-snowleopard/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png: * platform/chromium-mac-snowleopard/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png: * platform/chromium-mac-snowleopard/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png: * platform/chromium-mac-snowleopard/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png: * platform/chromium-mac-snowleopard/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png: * platform/chromium-mac-snowleopard/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png: * platform/chromium-mac-snowleopard/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png: * platform/chromium-mac-snowleopard/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png: * platform/chromium-mac-snowleopard/editing/selection/vertical-rl-rtl-extend-line-backward-br-expected.png: * platform/chromium-mac-snowleopard/editing/selection/vertical-rl-rtl-extend-line-backward-p-expected.png: * platform/chromium-mac-snowleopard/editing/selection/vertical-rl-rtl-extend-line-forward-br-expected.png: * platform/chromium-mac-snowleopard/editing/selection/vertical-rl-rtl-extend-line-forward-p-expected.png: * platform/chromium-mac-snowleopard/fast/sub-pixel: Added. * platform/chromium-mac-snowleopard/fast/sub-pixel/selection: Added. * platform/chromium-mac-snowleopard/fast/sub-pixel/selection/selection-gaps-at-fractional-offsets-expected.png: Added. * platform/chromium-mac/fast/repaint/japanese-rl-selection-repaint-expected.png: * platform/chromium-mac/fast/repaint/japanese-rl-selection-repaint-in-regions-expected.png: * platform/chromium/TestExpectations: * platform/efl/Skipped: * platform/gtk-wk2/Skipped: * platform/mac-lion/Skipped: * platform/mac-snowleopard/Skipped: * platform/mac-wk2/Skipped: * platform/mac/Skipped: * platform/qt-4.8/Skipped: * platform/qt/Skipped: * platform/win-wk2/Skipped: * platform/win-xp/Skipped: * platform/win/Skipped: * platform/wincairo/Skipped: * platform/wk2/Skipped: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@119528 268f45cc-cd09-0410-ab3c-d52691b4dbfc
6deea0ee