| 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 61151db94f3a35cfa29ca5a83bcc15397100f908..a15a0015f8be1014e4177743bc800f3a8887ba67 100644
|
| --- a/third_party/WebKit/Source/core/dom/Element.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/Element.cpp
|
| @@ -1013,13 +1013,33 @@ bool Element::hasNonEmptyLayoutSize() const
|
| return false;
|
| }
|
|
|
| -IntRect Element::boundsInViewport()
|
| +bool Element::getBoundingQuads(Vector<FloatQuad>& quads)
|
| +{
|
| + assert(quads.isEmpty());
|
| + if (isSVGElement() && layoutObject()) {
|
| + // Get the bounding rectangle from the SVG model.
|
| + if (toSVGElement(this)->isSVGGraphicsElement())
|
| + quads.append(layoutObject()->localToAbsoluteQuad(layoutObject()->objectBoundingBox()));
|
| + } else {
|
| + // Get the bounding rectangle from the box model.
|
| + if (layoutBoxModelObject())
|
| + layoutBoxModelObject()->absoluteQuads(quads);
|
| + }
|
| + return !quads.isEmpty();
|
| +}
|
| +
|
| +IntRect Element::boundsInViewportInt()
|
| +{
|
| + return enclosingIntRect(boundsInViewportFloat());
|
| +}
|
| +
|
| +FloatRect Element::boundsInViewportFloat()
|
| {
|
| document().updateLayoutIgnorePendingStylesheets();
|
|
|
| FrameView* view = document().view();
|
| if (!view)
|
| - return IntRect();
|
| + return FloatRect();
|
|
|
| Vector<FloatQuad> quads;
|
| if (isSVGElement() && layoutObject()) {
|
| @@ -1031,13 +1051,12 @@ IntRect Element::boundsInViewport()
|
| if (layoutBoxModelObject())
|
| layoutBoxModelObject()->absoluteQuads(quads);
|
| }
|
| -
|
| if (quads.isEmpty())
|
| - return IntRect();
|
| + return FloatRect();
|
|
|
| - IntRect result = quads[0].enclosingBoundingBox();
|
| + FloatRect result = quads[0].boundingBox();
|
| for (size_t i = 1; i < quads.size(); ++i)
|
| - result.unite(quads[i].enclosingBoundingBox());
|
| + result.unite(quads[i].boundingBox());
|
|
|
| return view->contentsToViewport(result);
|
| }
|
|
|