Chromium Code Reviews| Index: Source/core/rendering/RenderObject.cpp |
| diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp |
| index 782312b9418c1da972ab8a24ac548853430995b7..9389475de1b503495d0258087043ed9e164518a8 100644 |
| --- a/Source/core/rendering/RenderObject.cpp |
| +++ b/Source/core/rendering/RenderObject.cpp |
| @@ -1218,10 +1218,13 @@ void RenderObject::drawSolidBoxSide(GraphicsContext* graphicsContext, int x1, in |
| void RenderObject::paintFocusRing(PaintInfo& paintInfo, const LayoutPoint& paintOffset, RenderStyle* style) |
| { |
| - Vector<IntRect> focusRingRects; |
| + Vector<LayoutRect> focusRingRects; |
| addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer()); |
| ASSERT(style->outlineStyleIsAuto()); |
| - paintInfo.context->drawFocusRing(focusRingRects, style->outlineWidth(), style->outlineOffset(), resolveColor(style, CSSPropertyOutlineColor)); |
| + Vector<IntRect> focusRingIntRects; |
| + for (size_t i = 0; i < focusRingRects.size(); ++i) |
| + focusRingIntRects.append(pixelSnappedIntRect(focusRingRects[i])); |
|
leviw_travelin_and_unemployed
2014/09/05 20:17:18
It's unfortunate we're making an extra data struct
|
| + paintInfo.context->drawFocusRing(focusRingIntRects, style->outlineWidth(), style->outlineOffset(), resolveColor(style, CSSPropertyOutlineColor)); |
| } |
| void RenderObject::paintOutline(PaintInfo& paintInfo, const LayoutRect& paintRect) |
| @@ -1292,7 +1295,7 @@ void RenderObject::paintOutline(PaintInfo& paintInfo, const LayoutRect& paintRec |
| graphicsContext->endLayer(); |
| } |
| -void RenderObject::addChildFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer) const |
| +void RenderObject::addChildFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer) const |
| { |
| for (RenderObject* current = slowFirstChild(); current; current = current->nextSibling()) { |
| if (current->isText() || current->isListMarker()) |
| @@ -1301,21 +1304,16 @@ void RenderObject::addChildFocusRingRects(Vector<IntRect>& rects, const LayoutPo |
| if (current->isBox()) { |
| RenderBox* box = toRenderBox(current); |
| if (box->hasLayer()) { |
| - Vector<IntRect> layerFocusRingRects; |
| + Vector<LayoutRect> layerFocusRingRects; |
| box->addFocusRingRects(layerFocusRingRects, LayoutPoint(), box); |
| for (size_t i = 0; i < layerFocusRingRects.size(); ++i) { |
| - FloatQuad quadInBox = box->localToContainerQuad(FloatRect(layerFocusRingRects[i]), paintContainer); |
| - FloatRect rect = quadInBox.boundingBox(); |
| - // Floor the location instead of using pixelSnappedIntRect to match the !hasLayer() path. |
| - // FIXME: roundedIntSize matches pixelSnappedIntRect in other places of addFocusRingRects |
| - // because we always floor the offset. |
| - // This assumption is fragile and should be replaced by better solution. |
| - rects.append(IntRect(flooredIntPoint(rect.location()), roundedIntSize(rect.size()))); |
| + FloatQuad quadInBox = box->localToContainerQuad(FloatQuad(layerFocusRingRects[i]), paintContainer); |
| + LayoutRect rect = LayoutRect(quadInBox.boundingBox()); |
| + if (!rect.isEmpty()) |
| + rects.append(rect); |
| } |
| } else { |
| - FloatPoint pos(additionalOffset); |
| - pos.move(box->locationOffset()); |
| - box->addFocusRingRects(rects, flooredIntPoint(pos), paintContainer); |
| + box->addFocusRingRects(rects, additionalOffset + box->locationOffset(), paintContainer); |
| } |
| } else { |
| current->addFocusRingRects(rects, additionalOffset, paintContainer); |
| @@ -1366,7 +1364,7 @@ IntRect RenderObject::absoluteBoundingBoxRectIgnoringTransforms() const |
| void RenderObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads) |
| { |
| - Vector<IntRect> rects; |
| + Vector<LayoutRect> rects; |
| const RenderLayerModelObject* container = containerForPaintInvalidation(); |
| addFocusRingRects(rects, LayoutPoint(localToContainerPoint(FloatPoint(), container)), container); |
| size_t count = rects.size(); |