Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/Element.cpp |
| diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp |
| index 62ff6eceed9ca21bfc1cc038ebfdfc2e01a53d53..8c1b3a73be810067d25a3aad01d740bace80de4f 100644 |
| --- a/third_party/WebKit/Source/core/dom/Element.cpp |
| +++ b/third_party/WebKit/Source/core/dom/Element.cpp |
| @@ -1031,39 +1031,42 @@ IntRect Element::visibleBoundsInVisualViewport() const |
| return rect; |
| } |
| -ClientRectList* Element::getClientRects() |
| +void Element::clientQuads(Vector<FloatQuad>& quads) |
| { |
| document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); |
| LayoutObject* elementLayoutObject = layoutObject(); |
| - if (!elementLayoutObject || (!elementLayoutObject->isBoxModelObject() && !elementLayoutObject->isBR())) |
| + if (!elementLayoutObject) |
| + return; |
| + |
| + if (isSVGElement() && !elementLayoutObject->isSVGRoot()) { |
| + // Get the bounding rectangle from the SVG model. |
| + if (toSVGElement(this)->isSVGGraphicsElement()) |
| + quads.append(elementLayoutObject->localToAbsoluteQuad(elementLayoutObject->objectBoundingBox())); |
| + } else if (elementLayoutObject->isBoxModelObject() || elementLayoutObject->isBR()) { |
| + elementLayoutObject->absoluteQuads(quads); |
| + } |
| +} |
| + |
| +ClientRectList* Element::getClientRects() |
| +{ |
| + Vector<FloatQuad> quads; |
| + clientQuads(quads); |
| + if (quads.isEmpty()) |
| return ClientRectList::create(); |
| - // FIXME: Handle SVG elements. |
| // FIXME: Handle table/inline-table with a caption. |
|
rwlbuis
2016/09/19 17:24:59
Don't we want to keep these FIXMEs?
Shanmuga Pandi
2016/09/20 05:43:10
I kept the FIXME for table/inline-table... And rem
|
| - Vector<FloatQuad> quads; |
| - elementLayoutObject->absoluteQuads(quads); |
| + LayoutObject* elementLayoutObject = layoutObject(); |
| + DCHECK(elementLayoutObject); |
| document().adjustFloatQuadsForScrollAndAbsoluteZoom(quads, *elementLayoutObject); |
| return ClientRectList::create(quads); |
| } |
| ClientRect* Element::getBoundingClientRect() |
| { |
| - document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); |
| - |
| Vector<FloatQuad> quads; |
| - LayoutObject* elementLayoutObject = layoutObject(); |
| - if (elementLayoutObject) { |
| - if (isSVGElement() && !elementLayoutObject->isSVGRoot()) { |
| - // Get the bounding rectangle from the SVG model. |
| - if (toSVGElement(this)->isSVGGraphicsElement()) |
| - quads.append(elementLayoutObject->localToAbsoluteQuad(elementLayoutObject->objectBoundingBox())); |
| - } else if (elementLayoutObject->isBoxModelObject() || elementLayoutObject->isBR()) { |
| - elementLayoutObject->absoluteQuads(quads); |
| - } |
| - } |
| - |
| + clientQuads(quads); |
| if (quads.isEmpty()) |
| return ClientRect::create(); |
| @@ -1071,6 +1074,7 @@ ClientRect* Element::getBoundingClientRect() |
| for (size_t i = 1; i < quads.size(); ++i) |
| result.unite(quads[i].boundingBox()); |
| + LayoutObject* elementLayoutObject = layoutObject(); |
| DCHECK(elementLayoutObject); |
| document().adjustFloatRectForScrollAndAbsoluteZoom(result, *elementLayoutObject); |
| return ClientRect::create(result); |