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 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 | 1006 |
1007 bool Element::hasNonEmptyLayoutSize() const | 1007 bool Element::hasNonEmptyLayoutSize() const |
1008 { | 1008 { |
1009 document().updateLayoutIgnorePendingStylesheets(); | 1009 document().updateLayoutIgnorePendingStylesheets(); |
1010 | 1010 |
1011 if (LayoutBoxModelObject* box = layoutBoxModelObject()) | 1011 if (LayoutBoxModelObject* box = layoutBoxModelObject()) |
1012 return box->hasNonEmptyLayoutSize(); | 1012 return box->hasNonEmptyLayoutSize(); |
1013 return false; | 1013 return false; |
1014 } | 1014 } |
1015 | 1015 |
1016 IntRect Element::boundsInViewport() | 1016 bool Element::getBoundingQuads(Vector<FloatQuad>& quads) |
| 1017 { |
| 1018 assert(quads.isEmpty()); |
| 1019 if (isSVGElement() && layoutObject()) { |
| 1020 // Get the bounding rectangle from the SVG model. |
| 1021 if (toSVGElement(this)->isSVGGraphicsElement()) |
| 1022 quads.append(layoutObject()->localToAbsoluteQuad(layoutObject()->obj
ectBoundingBox())); |
| 1023 } else { |
| 1024 // Get the bounding rectangle from the box model. |
| 1025 if (layoutBoxModelObject()) |
| 1026 layoutBoxModelObject()->absoluteQuads(quads); |
| 1027 } |
| 1028 return !quads.isEmpty(); |
| 1029 } |
| 1030 |
| 1031 IntRect Element::boundsInViewportInt() |
| 1032 { |
| 1033 return enclosingIntRect(boundsInViewportFloat()); |
| 1034 } |
| 1035 |
| 1036 FloatRect Element::boundsInViewportFloat() |
1017 { | 1037 { |
1018 document().updateLayoutIgnorePendingStylesheets(); | 1038 document().updateLayoutIgnorePendingStylesheets(); |
1019 | 1039 |
1020 FrameView* view = document().view(); | 1040 FrameView* view = document().view(); |
1021 if (!view) | 1041 if (!view) |
1022 return IntRect(); | 1042 return FloatRect(); |
1023 | 1043 |
1024 Vector<FloatQuad> quads; | 1044 Vector<FloatQuad> quads; |
1025 if (isSVGElement() && layoutObject()) { | 1045 if (isSVGElement() && layoutObject()) { |
1026 // Get the bounding rectangle from the SVG model. | 1046 // Get the bounding rectangle from the SVG model. |
1027 if (toSVGElement(this)->isSVGGraphicsElement()) | 1047 if (toSVGElement(this)->isSVGGraphicsElement()) |
1028 quads.append(layoutObject()->localToAbsoluteQuad(layoutObject()->obj
ectBoundingBox())); | 1048 quads.append(layoutObject()->localToAbsoluteQuad(layoutObject()->obj
ectBoundingBox())); |
1029 } else { | 1049 } else { |
1030 // Get the bounding rectangle from the box model. | 1050 // Get the bounding rectangle from the box model. |
1031 if (layoutBoxModelObject()) | 1051 if (layoutBoxModelObject()) |
1032 layoutBoxModelObject()->absoluteQuads(quads); | 1052 layoutBoxModelObject()->absoluteQuads(quads); |
1033 } | 1053 } |
| 1054 if (quads.isEmpty()) |
| 1055 return FloatRect(); |
1034 | 1056 |
1035 if (quads.isEmpty()) | 1057 FloatRect result = quads[0].boundingBox(); |
1036 return IntRect(); | |
1037 | |
1038 IntRect result = quads[0].enclosingBoundingBox(); | |
1039 for (size_t i = 1; i < quads.size(); ++i) | 1058 for (size_t i = 1; i < quads.size(); ++i) |
1040 result.unite(quads[i].enclosingBoundingBox()); | 1059 result.unite(quads[i].boundingBox()); |
1041 | 1060 |
1042 return view->contentsToViewport(result); | 1061 return view->contentsToViewport(result); |
1043 } | 1062 } |
1044 | 1063 |
1045 ClientRectList* Element::getClientRects() | 1064 ClientRectList* Element::getClientRects() |
1046 { | 1065 { |
1047 document().updateLayoutIgnorePendingStylesheets(); | 1066 document().updateLayoutIgnorePendingStylesheets(); |
1048 | 1067 |
1049 LayoutObject* elementLayoutObject = layoutObject(); | 1068 LayoutObject* elementLayoutObject = layoutObject(); |
1050 if (!elementLayoutObject || (!elementLayoutObject->isBoxModelObject() && !el
ementLayoutObject->isBR())) | 1069 if (!elementLayoutObject || (!elementLayoutObject->isBoxModelObject() && !el
ementLayoutObject->isBR())) |
(...skipping 2580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3631 { | 3650 { |
3632 #if ENABLE(OILPAN) | 3651 #if ENABLE(OILPAN) |
3633 if (hasRareData()) | 3652 if (hasRareData()) |
3634 visitor->trace(elementRareData()); | 3653 visitor->trace(elementRareData()); |
3635 visitor->trace(m_elementData); | 3654 visitor->trace(m_elementData); |
3636 #endif | 3655 #endif |
3637 ContainerNode::trace(visitor); | 3656 ContainerNode::trace(visitor); |
3638 } | 3657 } |
3639 | 3658 |
3640 } // namespace blink | 3659 } // namespace blink |
OLD | NEW |