Chromium Code Reviews| Index: Source/core/rendering/RenderObject.cpp |
| diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp |
| index cb6890fc7fbb2181ff07bf906bad36f7c4adef6c..a757a63d4503595a0988d8222a9d19d1f3644a25 100644 |
| --- a/Source/core/rendering/RenderObject.cpp |
| +++ b/Source/core/rendering/RenderObject.cpp |
| @@ -1217,12 +1217,16 @@ 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()); |
| - if (style->outlineStyleIsAuto()) |
| - paintInfo.context->drawFocusRing(focusRingRects, style->outlineWidth(), style->outlineOffset(), resolveColor(style, CSSPropertyOutlineColor)); |
| - else |
| - addPDFURLRect(paintInfo.context, unionRect(focusRingRects)); |
| + if (style->outlineStyleIsAuto()) { |
| + Vector<IntRect> focusRingIntRects; |
| + for (size_t i = 0; i < focusRingRects.size(); ++i) |
| + focusRingIntRects.append(pixelSnappedIntRect(focusRingRects[i])); |
|
Julien - ping for review
2014/08/20 22:12:31
We talked about this O(N) loop and while it should
Xianzhu
2014/09/04 00:29:12
Previously the computation of the loop was distrib
|
| + paintInfo.context->drawFocusRing(focusRingIntRects, style->outlineWidth(), style->outlineOffset(), resolveColor(style, CSSPropertyOutlineColor)); |
| + return; |
| + } |
| + addPDFURLRect(paintInfo.context, unionRect(focusRingRects)); |
| } |
| void RenderObject::addPDFURLRect(GraphicsContext* context, const LayoutRect& rect) |
| @@ -1314,7 +1318,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()) |
| @@ -1323,16 +1327,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); |
| - rects.append(pixelSnappedIntRect(LayoutRect(quadInBox.boundingBox()))); |
| + 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()); // FIXME: Snap offsets? crbug.com/350474 |
| - box->addFocusRingRects(rects, flooredIntPoint(pos), paintContainer); |
| + box->addFocusRingRects(rects, additionalOffset + box->locationOffset(), paintContainer); |
| } |
| } else { |
| current->addFocusRingRects(rects, additionalOffset, paintContainer); |
| @@ -1383,7 +1387,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(); |