Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1733)

Unified Diff: Source/core/rendering/RenderObject.cpp

Issue 288013005: Handle transformed descendants when drawing focus rings (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Exclude the new flaky test. The other new test covers the change. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderObject.cpp
diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp
index edcb1c94870370845552b44c62254c97e361c6cd..6442e04919a37dcdfc8d8c5bf20cecd7c69c92ac 100644
--- a/Source/core/rendering/RenderObject.cpp
+++ b/Source/core/rendering/RenderObject.cpp
@@ -1248,6 +1248,32 @@ void RenderObject::paintOutline(PaintInfo& paintInfo, const LayoutRect& paintRec
graphicsContext->endLayer();
}
+void RenderObject::addChildFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer)
+{
+ for (RenderObject* current = slowFirstChild(); current; current = current->nextSibling()) {
+ if (current->isText() || current->isListMarker())
+ continue;
+
+ if (current->isBox()) {
+ RenderBox* box = toRenderBox(current);
+ if (box->hasLayer()) {
+ Vector<IntRect> layerFocusRingRects;
+ box->addFocusRingRects(layerFocusRingRects, LayoutPoint(), box);
+ for (size_t i = 0; i < layerFocusRingRects.size(); ++i) {
+ FloatQuad quadInBox = box->localToContainerQuad(FloatRect(layerFocusRingRects[i]), paintContainer);
+ rects.append(pixelSnappedIntRect(LayoutRect(quadInBox.boundingBox())));
+ }
+ } else {
+ FloatPoint pos(additionalOffset);
+ pos.move(box->locationOffset()); // FIXME: Snap offsets? crbug.com/350474
+ box->addFocusRingRects(rects, flooredIntPoint(pos), paintContainer);
+ }
+ } else {
+ current->addFocusRingRects(rects, additionalOffset, paintContainer);
+ }
+ }
+}
+
// FIXME: In repaint-after-layout, we should be able to change the logic to remove the need for this function. See crbug.com/368416.
LayoutPoint RenderObject::positionFromRepaintContainer(const RenderLayerModelObject* repaintContainer) const
{
@@ -1295,18 +1321,11 @@ IntRect RenderObject::absoluteBoundingBoxRectIgnoringTransforms() const
void RenderObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads)
{
Vector<IntRect> rects;
- // FIXME: addFocusRingRects() needs to be passed this transform-unaware
- // localToAbsolute() offset here because RenderInline::addFocusRingRects()
- // implicitly assumes that. This doesn't work correctly with transformed
- // descendants.
- FloatPoint absolutePoint = localToAbsolute();
- addFocusRingRects(rects, flooredLayoutPoint(absolutePoint));
+ const RenderLayerModelObject* container = containerForRepaint();
+ addFocusRingRects(rects, LayoutPoint(localToContainerPoint(FloatPoint(), container)), container);
size_t count = rects.size();
- for (size_t i = 0; i < count; ++i) {
- IntRect rect = rects[i];
- rect.move(-absolutePoint.x(), -absolutePoint.y());
- quads.append(localToAbsoluteQuad(FloatQuad(rect)));
- }
+ for (size_t i = 0; i < count; ++i)
+ quads.append(container->localToAbsoluteQuad(FloatQuad(rects[i])));
}
FloatRect RenderObject::absoluteBoundingBoxRectForRange(const Range* range)
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698