OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2014 Google, Inc. | 4 * Copyright (C) 2014 Google, Inc. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 SVGElement* farthest = 0; | 166 SVGElement* farthest = 0; |
167 for (Element* current = ParentOrShadowHostElement(); current; | 167 for (Element* current = ParentOrShadowHostElement(); current; |
168 current = current->ParentOrShadowHostElement()) { | 168 current = current->ParentOrShadowHostElement()) { |
169 if (IsViewportElement(*current)) | 169 if (IsViewportElement(*current)) |
170 farthest = ToSVGElement(current); | 170 farthest = ToSVGElement(current); |
171 } | 171 } |
172 return farthest; | 172 return farthest; |
173 } | 173 } |
174 | 174 |
175 FloatRect SVGGraphicsElement::GetBBox() { | 175 FloatRect SVGGraphicsElement::GetBBox() { |
176 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); | 176 DCHECK(GetLayoutObject()); |
177 | |
178 // FIXME: Eventually we should support getBBox for detached elements. | |
179 if (!GetLayoutObject()) | |
180 return FloatRect(); | |
181 | |
182 return GetLayoutObject()->ObjectBoundingBox(); | 177 return GetLayoutObject()->ObjectBoundingBox(); |
183 } | 178 } |
184 | 179 |
185 SVGRectTearOff* SVGGraphicsElement::getBBoxFromJavascript() { | 180 SVGRectTearOff* SVGGraphicsElement::getBBoxFromJavascript() { |
186 return SVGRectTearOff::Create(SVGRect::Create(GetBBox()), 0, | 181 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); |
| 182 |
| 183 // FIXME: Eventually we should support getBBox for detached elements. |
| 184 FloatRect boundingBox; |
| 185 if (GetLayoutObject()) |
| 186 boundingBox = GetBBox(); |
| 187 return SVGRectTearOff::Create(SVGRect::Create(boundingBox), 0, |
187 kPropertyIsNotAnimVal); | 188 kPropertyIsNotAnimVal); |
188 } | 189 } |
189 | 190 |
190 } // namespace blink | 191 } // namespace blink |
OLD | NEW |