Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
| 5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 6 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. |
| 8 * (C) 2007 Eric Seidel (eric@webkit.org) | 8 * (C) 2007 Eric Seidel (eric@webkit.org) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 990 | 990 |
| 991 IntRect Element::boundsInViewportSpace() | 991 IntRect Element::boundsInViewportSpace() |
| 992 { | 992 { |
| 993 document().updateLayoutIgnorePendingStylesheets(); | 993 document().updateLayoutIgnorePendingStylesheets(); |
| 994 | 994 |
| 995 FrameView* view = document().view(); | 995 FrameView* view = document().view(); |
| 996 if (!view) | 996 if (!view) |
| 997 return IntRect(); | 997 return IntRect(); |
| 998 | 998 |
| 999 Vector<FloatQuad> quads; | 999 Vector<FloatQuad> quads; |
| 1000 if (isSVGElement() && layoutObject()) { | 1000 if (isSVGElement() && layoutObject()) { |
|
fs
2015/09/08 15:33:53
This looks like a potential bug for outermost <svg
| |
| 1001 // Get the bounding rectangle from the SVG model. | 1001 // Get the bounding rectangle from the SVG model. |
| 1002 SVGElement* svgElement = toSVGElement(this); | 1002 if (toSVGElement(this)->isSVGGraphicsElement()) |
| 1003 FloatRect localRect; | 1003 quads.append(layoutObject()->localToAbsoluteQuad(layoutObject()->obj ectBoundingBox())); |
| 1004 if (svgElement->getBoundingBox(localRect)) | |
| 1005 quads.append(layoutObject()->localToAbsoluteQuad(localRect)); | |
| 1006 } else { | 1004 } else { |
| 1007 // Get the bounding rectangle from the box model. | 1005 // Get the bounding rectangle from the box model. |
| 1008 if (layoutBoxModelObject()) | 1006 if (layoutBoxModelObject()) |
| 1009 layoutBoxModelObject()->absoluteQuads(quads); | 1007 layoutBoxModelObject()->absoluteQuads(quads); |
| 1010 } | 1008 } |
| 1011 | 1009 |
| 1012 if (quads.isEmpty()) | 1010 if (quads.isEmpty()) |
| 1013 return IntRect(); | 1011 return IntRect(); |
| 1014 | 1012 |
| 1015 IntRect result = quads[0].enclosingBoundingBox(); | 1013 IntRect result = quads[0].enclosingBoundingBox(); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 1038 | 1036 |
| 1039 ClientRect* Element::getBoundingClientRect() | 1037 ClientRect* Element::getBoundingClientRect() |
| 1040 { | 1038 { |
| 1041 document().updateLayoutIgnorePendingStylesheets(); | 1039 document().updateLayoutIgnorePendingStylesheets(); |
| 1042 | 1040 |
| 1043 Vector<FloatQuad> quads; | 1041 Vector<FloatQuad> quads; |
| 1044 LayoutObject* elementLayoutObject = layoutObject(); | 1042 LayoutObject* elementLayoutObject = layoutObject(); |
| 1045 if (elementLayoutObject) { | 1043 if (elementLayoutObject) { |
| 1046 if (isSVGElement() && !elementLayoutObject->isSVGRoot()) { | 1044 if (isSVGElement() && !elementLayoutObject->isSVGRoot()) { |
| 1047 // Get the bounding rectangle from the SVG model. | 1045 // Get the bounding rectangle from the SVG model. |
| 1048 SVGElement* svgElement = toSVGElement(this); | 1046 if (toSVGElement(this)->isSVGGraphicsElement()) |
| 1049 FloatRect localRect; | 1047 quads.append(elementLayoutObject->localToAbsoluteQuad(elementLay outObject->objectBoundingBox())); |
|
fs
2015/09/08 15:33:53
I pondered for a while why this couldn't just use
pdr.
2015/09/09 06:45:52
Please do update us when you find out.
| |
| 1050 if (svgElement->getBoundingBox(localRect)) | |
| 1051 quads.append(elementLayoutObject->localToAbsoluteQuad(localRect) ); | |
| 1052 } else if (elementLayoutObject->isBoxModelObject() || elementLayoutObjec t->isBR()) { | 1048 } else if (elementLayoutObject->isBoxModelObject() || elementLayoutObjec t->isBR()) { |
| 1053 elementLayoutObject->absoluteQuads(quads); | 1049 elementLayoutObject->absoluteQuads(quads); |
| 1054 } | 1050 } |
| 1055 } | 1051 } |
| 1056 | 1052 |
| 1057 if (quads.isEmpty()) | 1053 if (quads.isEmpty()) |
| 1058 return ClientRect::create(); | 1054 return ClientRect::create(); |
| 1059 | 1055 |
| 1060 FloatRect result = quads[0].boundingBox(); | 1056 FloatRect result = quads[0].boundingBox(); |
| 1061 for (size_t i = 1; i < quads.size(); ++i) | 1057 for (size_t i = 1; i < quads.size(); ++i) |
| (...skipping 2506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3568 { | 3564 { |
| 3569 #if ENABLE(OILPAN) | 3565 #if ENABLE(OILPAN) |
| 3570 if (hasRareData()) | 3566 if (hasRareData()) |
| 3571 visitor->trace(elementRareData()); | 3567 visitor->trace(elementRareData()); |
| 3572 visitor->trace(m_elementData); | 3568 visitor->trace(m_elementData); |
| 3573 #endif | 3569 #endif |
| 3574 ContainerNode::trace(visitor); | 3570 ContainerNode::trace(visitor); |
| 3575 } | 3571 } |
| 3576 | 3572 |
| 3577 } // namespace blink | 3573 } // namespace blink |
| OLD | NEW |