| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
| 5 * Copyright (C) 2009 Google, Inc. | 5 * Copyright (C) 2009 Google, Inc. |
| 6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); | 181 SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); |
| 182 ASSERT(svg); | 182 ASSERT(svg); |
| 183 | 183 |
| 184 // When we're embedded through SVGImage (border-image/background-image/<html
:img>/...) we're forced to resize to a specific size. | 184 // When we're embedded through SVGImage (border-image/background-image/<html
:img>/...) we're forced to resize to a specific size. |
| 185 if (!m_containerSize.isEmpty()) | 185 if (!m_containerSize.isEmpty()) |
| 186 return m_containerSize.height(); | 186 return m_containerSize.height(); |
| 187 | 187 |
| 188 if (hasReplacedLogicalHeight()) | 188 if (hasReplacedLogicalHeight()) |
| 189 return RenderReplaced::computeReplacedLogicalHeight(); | 189 return RenderReplaced::computeReplacedLogicalHeight(); |
| 190 | 190 |
| 191 if (svg->heightAttributeEstablishesViewport()) | 191 if (svg->heightAttributeEstablishesViewport()) { |
| 192 return resolveLengthAttributeForSVG(svg->intrinsicHeight(SVGSVGElement::
IgnoreCSSProperties), style()->effectiveZoom(), containingBlock()->availableLogi
calHeight()); | 192 Length height = svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties)
; |
| 193 if (height.isPercent()) { |
| 194 RenderBlock* cb = containingBlock(); |
| 195 ASSERT(cb); |
| 196 while (cb->isAnonymous()) { |
| 197 cb = cb->containingBlock(); |
| 198 cb->addPercentHeightDescendant(const_cast<RenderSVGRoot*>(this))
; |
| 199 } |
| 200 } else |
| 201 RenderBlock::removePercentHeightDescendant(const_cast<RenderSVGRoot*
>(this)); |
| 202 |
| 203 return resolveLengthAttributeForSVG(height, style()->effectiveZoom(), co
ntainingBlock()->availableLogicalHeight()); |
| 204 } |
| 193 | 205 |
| 194 // Only SVGs embedded in <object> reach this point. | 206 // Only SVGs embedded in <object> reach this point. |
| 195 ASSERT(isEmbeddedThroughFrameContainingSVGDocument()); | 207 ASSERT(isEmbeddedThroughFrameContainingSVGDocument()); |
| 196 return document()->frame()->ownerRenderer()->availableLogicalHeight(); | 208 return document()->frame()->ownerRenderer()->availableLogicalHeight(); |
| 197 } | 209 } |
| 198 | 210 |
| 199 void RenderSVGRoot::layout() | 211 void RenderSVGRoot::layout() |
| 200 { | 212 { |
| 201 ASSERT(needsLayout()); | 213 ASSERT(needsLayout()); |
| 202 | 214 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 RenderBox::paint(childPaintInfo, LayoutPoint()); | 276 RenderBox::paint(childPaintInfo, LayoutPoint()); |
| 265 | 277 |
| 266 if (childPaintInfo.phase == PaintPhaseForeground) | 278 if (childPaintInfo.phase == PaintPhaseForeground) |
| 267 SVGRenderSupport::finishRenderSVGContent(this, childPaintInfo, paintInfo
.context); | 279 SVGRenderSupport::finishRenderSVGContent(this, childPaintInfo, paintInfo
.context); |
| 268 | 280 |
| 269 childPaintInfo.context->restore(); | 281 childPaintInfo.context->restore(); |
| 270 } | 282 } |
| 271 | 283 |
| 272 void RenderSVGRoot::willBeDestroyed() | 284 void RenderSVGRoot::willBeDestroyed() |
| 273 { | 285 { |
| 286 RenderBlock::removePercentHeightDescendant(const_cast<RenderSVGRoot*>(this))
; |
| 287 |
| 274 SVGResourcesCache::clientDestroyed(this); | 288 SVGResourcesCache::clientDestroyed(this); |
| 275 RenderReplaced::willBeDestroyed(); | 289 RenderReplaced::willBeDestroyed(); |
| 276 } | 290 } |
| 277 | 291 |
| 278 void RenderSVGRoot::styleWillChange(StyleDifference diff, const RenderStyle* new
Style) | 292 void RenderSVGRoot::styleWillChange(StyleDifference diff, const RenderStyle* new
Style) |
| 279 { | 293 { |
| 280 if (diff == StyleDifferenceLayout) | 294 if (diff == StyleDifferenceLayout) |
| 281 setNeedsBoundariesUpdate(); | 295 setNeedsBoundariesUpdate(); |
| 282 RenderReplaced::styleWillChange(diff, newStyle); | 296 RenderReplaced::styleWillChange(diff, newStyle); |
| 283 } | 297 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 // hit testing would stop immediately. For SVG only trees this doesn't m
atter. Though when we have a <foreignObject> subtree we need | 404 // hit testing would stop immediately. For SVG only trees this doesn't m
atter. Though when we have a <foreignObject> subtree we need |
| 391 // to be able to detect hits on the background of a <div> element. If we
'd return true here in the 'Foreground' phase, we are not able | 405 // to be able to detect hits on the background of a <div> element. If we
'd return true here in the 'Foreground' phase, we are not able |
| 392 // to detect these hits anymore. | 406 // to detect these hits anymore. |
| 393 updateHitTestResult(result, roundedLayoutPoint(localPoint)); | 407 updateHitTestResult(result, roundedLayoutPoint(localPoint)); |
| 394 return true; | 408 return true; |
| 395 } | 409 } |
| 396 | 410 |
| 397 return false; | 411 return false; |
| 398 } | 412 } |
| 399 | 413 |
| 414 bool RenderSVGRoot::hasRelativeDimensions() const |
| 415 { |
| 416 SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); |
| 417 ASSERT(svg); |
| 418 |
| 419 return svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties).isPercent()
|| svg->intrinsicWidth(SVGSVGElement::IgnoreCSSProperties).isPercent(); |
| 420 } |
| 421 |
| 400 } | 422 } |
| 401 | 423 |
| 402 #endif // ENABLE(SVG) | 424 #endif // ENABLE(SVG) |
| OLD | NEW |