Inline repainting can be off-by-one with sub-pixel enabled
authorleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Sep 2012 19:17:03 +0000 (19:17 +0000)
committerleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Sep 2012 19:17:03 +0000 (19:17 +0000)
commit1847b4c5e0b16b9e1c6fe3a9564364ae0e15ca43
treeb5ccfcb43f9c13b2dd04c8dfae7ff0cba439e0cc
parent3541490857732648e01414c9b1b74fcfbd8ff9d8
Inline repainting can be off-by-one with sub-pixel enabled
https://bugs.webkit.org/show_bug.cgi?id=95882

Reviewed by Eric Seidel.

Source/WebCore:

With sub-pixel layout enabled, context accumulated from containing renderers is used to properly
pixel snap. Selection repaint rects are stored outside the affected renderers, and are handed to
the embedder without the context to correctly determine the snapped values. This can result in
repaint areas smaller than what's needed.

This could be fixed three ways:
- by changing selection repaint rects to an IntRect and pixel snapping the values before storing
  them outside the render tree. This is the narrowest solution.
- by adapting layout to store pixel snapping hints along with the size/location of the renderer.
  This is the best possible solution, as it would help solve a lot of pixel snapping issues and
  reduce complexity of handling. I eventually intend on implementing this.
- by reverting repaintUsingContainer to IntRects and using pixel snapping when possible, and
  enclosingIntRect where we lack context.

This implements the last solution, as it's the least invasive, but can potentially fix numerous
sub-pixel repaint issues.

Test: fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html

* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::layoutRunsAndFloats):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPositions):
(WebCore::RenderLayer::scrollTo):
(WebCore::RenderLayer::repaintIncludingNonCompositingDescendants):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::repaintUsingContainer):
(WebCore::RenderObject::repaint):
(WebCore::RenderObject::repaintRectangle):
(WebCore::RenderObject::repaintAfterLayoutIfNeeded):
* rendering/RenderObject.h:
(RenderObject):
* rendering/RenderSelectionInfo.h:
(WebCore::RenderSelectionInfo::repaint):
(WebCore::RenderBlockSelectionInfo::repaint):

LayoutTests:

Test that we properly repaint selection gaps inside tables with sub-pixel offsets.

* fast/sub-pixel/selection/selection-rect-in-sub-pixel-table-expected.txt: Added.
* fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html: Added.
* platform/chromium-mac/fast/sub-pixel/selection/selection-rect-in-sub-pixel-table-expected.png: Added.
* platform/chromium/TestExpectations:
* 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: https://svn.webkit.org/repository/webkit/trunk@128346 268f45cc-cd09-0410-ab3c-d52691b4dbfc
22 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/sub-pixel/selection/selection-rect-in-sub-pixel-table-expected.txt [new file with mode: 0644]
LayoutTests/fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html [new file with mode: 0644]
LayoutTests/platform/chromium-mac/fast/sub-pixel/selection/selection-rect-in-sub-pixel-table-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/mac-lion/Skipped
LayoutTests/platform/mac-snowleopard/Skipped
LayoutTests/platform/mac-wk2/Skipped
LayoutTests/platform/mac/Skipped
LayoutTests/platform/qt-4.8/Skipped
LayoutTests/platform/qt/Skipped
LayoutTests/platform/win-wk2/Skipped
LayoutTests/platform/win-xp/Skipped
LayoutTests/platform/win/Skipped
LayoutTests/platform/wincairo/Skipped
LayoutTests/platform/wk2/Skipped
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlockLineLayout.cpp
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderObject.cpp
Source/WebCore/rendering/RenderObject.h
Source/WebCore/rendering/RenderSelectionInfo.h