Focus ring for a child layer is incorrectly offset by ancestor composited layer's...
authorwangxianzhu@chromium.org <wangxianzhu@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Feb 2013 20:38:23 +0000 (20:38 +0000)
committerwangxianzhu@chromium.org <wangxianzhu@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Feb 2013 20:38:23 +0000 (20:38 +0000)
commit65028bef2778da2dcc29a88f1f36aaf558ecce74
treeefff603eb724dd10c98891fd253030ad436351c0
parentdc4a7207686f36a7088b9cbedaaa42e250e3d6b0
Focus ring for a child layer is incorrectly offset by ancestor composited layer's position
https://bugs.webkit.org/show_bug.cgi?id=110895

Reviewed by Simon Fraser.

Source/WebCore:

Test: compositing/sub-layer-focus-ring.html

The problem occurs in RenderBlock::addFocusRingRects() where the absolute position of a sub-layer is used to calculate the focus ring rect of the layer.
Should use the relative position to the current paintContainer instead.

To fix the issue:
- RenderLayer passes LayerPaintingInfo.rootLayer to PaintInfo.paintContainer
- Let RenderObject::paintFocusRing() and RenderObject::paintOutline() take PaintInfo instead of GraphicsContext* so that the paintContainer can be passed
- RenderBlock::addFocusRingRects() uses localToContainerPoint(FloatPoint(), paintContainer) instead of localToAbsolute() to calculate the focus ring rect of a sublayer.

* rendering/PaintInfo.h:
(WebCore):
(WebCore::PaintInfo::PaintInfo): Add a field paintContainer (the RenderLayerModelObject which originates the current painting)
(PaintInfo):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paintObject):
(WebCore::RenderBlock::paintContinuationOutlines):
(WebCore::RenderBlock::addFocusRingRects): Use the added paintContainer parameter to calculate the relative offset of the child layer.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintBackgroundForFragments): Pass LayerPaintingInfo.rootLayer to PaintInfo.paintContainer.
(WebCore::RenderLayer::paintForegroundForFragmentsWithPhase): Ditto.
(WebCore::RenderLayer::paintOutlineForFragments): Ditto.
(WebCore::RenderLayer::paintMaskForFragments): Ditto.
* rendering/RenderLayer.cpp:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::paintFocusRing): Now takes PaintInfo instead of GraphicsContext*. Pass paintInfo.paintContainer to addFocusRingRects().
(WebCore::RenderObject::paintOutline): Now takes PaintInfo instead of GraphicsContext*.
(WebCore::RenderObject::absoluteFocusRingQuads):
* rendering/RenderObject.h:
(WebCore::RenderObject::addFocusRingRects): Add paintContainer parameter.

LayoutTests:

New ref test for the bug.

* compositing/sub-layer-focus-ring-expected.html: Added.
* compositing/sub-layer-focus-ring.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@144350 268f45cc-cd09-0410-ab3c-d52691b4dbfc
30 files changed:
LayoutTests/ChangeLog
LayoutTests/compositing/sub-layer-focus-ring-expected.html [new file with mode: 0644]
LayoutTests/compositing/sub-layer-focus-ring.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/PaintInfo.h
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBox.h
Source/WebCore/rendering/RenderInline.cpp
Source/WebCore/rendering/RenderInline.h
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLineBoxList.cpp
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderListBox.h
Source/WebCore/rendering/RenderObject.cpp
Source/WebCore/rendering/RenderObject.h
Source/WebCore/rendering/RenderReplaced.cpp
Source/WebCore/rendering/RenderTable.cpp
Source/WebCore/rendering/RenderTableRow.cpp
Source/WebCore/rendering/RenderTableSection.cpp
Source/WebCore/rendering/RenderTextControl.cpp
Source/WebCore/rendering/RenderTextControl.h
Source/WebCore/rendering/RenderWidget.cpp
Source/WebCore/rendering/svg/RenderSVGContainer.cpp
Source/WebCore/rendering/svg/RenderSVGContainer.h
Source/WebCore/rendering/svg/RenderSVGImage.cpp
Source/WebCore/rendering/svg/RenderSVGImage.h
Source/WebCore/rendering/svg/RenderSVGShape.cpp
Source/WebCore/rendering/svg/RenderSVGShape.h