| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 ASSERT(svg); | 140 ASSERT(svg); |
| 141 | 141 |
| 142 // When we're embedded through SVGImage (border-image/background-image/<html
:img>/...) we're forced to resize to a specific size. | 142 // When we're embedded through SVGImage (border-image/background-image/<html
:img>/...) we're forced to resize to a specific size. |
| 143 if (!m_containerSize.isEmpty()) | 143 if (!m_containerSize.isEmpty()) |
| 144 return m_containerSize.width(); | 144 return m_containerSize.width(); |
| 145 | 145 |
| 146 if (style()->logicalWidth().isSpecified() || style()->logicalMaxWidth().isSp
ecified()) | 146 if (style()->logicalWidth().isSpecified() || style()->logicalMaxWidth().isSp
ecified()) |
| 147 return RenderReplaced::computeReplacedLogicalWidth(shouldComputePreferre
d); | 147 return RenderReplaced::computeReplacedLogicalWidth(shouldComputePreferre
d); |
| 148 | 148 |
| 149 if (svg->widthAttributeEstablishesViewport()) | 149 if (svg->widthAttributeEstablishesViewport()) |
| 150 return resolveLengthAttributeForSVG(svg->intrinsicWidth(SVGSVGElement::I
gnoreCSSProperties), style()->effectiveZoom(), containingBlock()->availableLogic
alWidth()); | 150 return resolveLengthAttributeForSVG(svg->intrinsicWidth(SVGSVGElement::I
gnoreCSSProperties), style()->effectiveZoom(), containingBlock()->availableLogic
alWidth().toFloat()); |
| 151 | 151 |
| 152 // SVG embedded through object/embed/iframe. | 152 // SVG embedded through object/embed/iframe. |
| 153 if (isEmbeddedThroughFrameContainingSVGDocument()) | 153 if (isEmbeddedThroughFrameContainingSVGDocument()) |
| 154 return document().frame()->ownerRenderer()->availableLogicalWidth(); | 154 return document().frame()->ownerRenderer()->availableLogicalWidth(); |
| 155 | 155 |
| 156 // SVG embedded via SVGImage (background-image/border-image/etc) / Inline SV
G. | 156 // SVG embedded via SVGImage (background-image/border-image/etc) / Inline SV
G. |
| 157 return RenderReplaced::computeReplacedLogicalWidth(shouldComputePreferred); | 157 return RenderReplaced::computeReplacedLogicalWidth(shouldComputePreferred); |
| 158 } | 158 } |
| 159 | 159 |
| 160 LayoutUnit RenderSVGRoot::computeReplacedLogicalHeight() const | 160 LayoutUnit RenderSVGRoot::computeReplacedLogicalHeight() const |
| (...skipping 13 matching lines...) Expand all Loading... |
| 174 if (height.isPercent()) { | 174 if (height.isPercent()) { |
| 175 RenderBlock* cb = containingBlock(); | 175 RenderBlock* cb = containingBlock(); |
| 176 ASSERT(cb); | 176 ASSERT(cb); |
| 177 while (cb->isAnonymous()) { | 177 while (cb->isAnonymous()) { |
| 178 cb = cb->containingBlock(); | 178 cb = cb->containingBlock(); |
| 179 cb->addPercentHeightDescendant(const_cast<RenderSVGRoot*>(this))
; | 179 cb->addPercentHeightDescendant(const_cast<RenderSVGRoot*>(this))
; |
| 180 } | 180 } |
| 181 } else | 181 } else |
| 182 RenderBlock::removePercentHeightDescendant(const_cast<RenderSVGRoot*
>(this)); | 182 RenderBlock::removePercentHeightDescendant(const_cast<RenderSVGRoot*
>(this)); |
| 183 | 183 |
| 184 return resolveLengthAttributeForSVG(height, style()->effectiveZoom(), co
ntainingBlock()->availableLogicalHeight(IncludeMarginBorderPadding)); | 184 return resolveLengthAttributeForSVG(height, style()->effectiveZoom(), co
ntainingBlock()->availableLogicalHeight(IncludeMarginBorderPadding).toFloat()); |
| 185 } | 185 } |
| 186 | 186 |
| 187 // SVG embedded through object/embed/iframe. | 187 // SVG embedded through object/embed/iframe. |
| 188 if (isEmbeddedThroughFrameContainingSVGDocument()) | 188 if (isEmbeddedThroughFrameContainingSVGDocument()) |
| 189 return document().frame()->ownerRenderer()->availableLogicalHeight(Inclu
deMarginBorderPadding); | 189 return document().frame()->ownerRenderer()->availableLogicalHeight(Inclu
deMarginBorderPadding); |
| 190 | 190 |
| 191 // SVG embedded via SVGImage (background-image/border-image/etc) / Inline SV
G. | 191 // SVG embedded via SVGImage (background-image/border-image/etc) / Inline SV
G. |
| 192 return RenderReplaced::computeReplacedLogicalHeight(); | 192 return RenderReplaced::computeReplacedLogicalHeight(); |
| 193 } | 193 } |
| 194 | 194 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 | 387 |
| 388 const RenderObject* RenderSVGRoot::pushMappingToContainer(const RenderLayerModel
Object* ancestorToStopAt, RenderGeometryMap& geometryMap) const | 388 const RenderObject* RenderSVGRoot::pushMappingToContainer(const RenderLayerModel
Object* ancestorToStopAt, RenderGeometryMap& geometryMap) const |
| 389 { | 389 { |
| 390 return RenderReplaced::pushMappingToContainer(ancestorToStopAt, geometryMap)
; | 390 return RenderReplaced::pushMappingToContainer(ancestorToStopAt, geometryMap)
; |
| 391 } | 391 } |
| 392 | 392 |
| 393 void RenderSVGRoot::updateCachedBoundaries() | 393 void RenderSVGRoot::updateCachedBoundaries() |
| 394 { | 394 { |
| 395 SVGRenderSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m
_objectBoundingBoxValid, m_strokeBoundingBox, m_repaintBoundingBox); | 395 SVGRenderSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m
_objectBoundingBoxValid, m_strokeBoundingBox, m_repaintBoundingBox); |
| 396 SVGRenderSupport::intersectRepaintRectWithResources(this, m_repaintBoundingB
ox); | 396 SVGRenderSupport::intersectRepaintRectWithResources(this, m_repaintBoundingB
ox); |
| 397 m_repaintBoundingBox.inflate(borderAndPaddingWidth()); | 397 m_repaintBoundingBox.inflate(borderAndPaddingWidth().toFloat()); |
| 398 } | 398 } |
| 399 | 399 |
| 400 bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& re
sult, const HitTestLocation& locationInContainer, const LayoutPoint& accumulated
Offset, HitTestAction hitTestAction) | 400 bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& re
sult, const HitTestLocation& locationInContainer, const LayoutPoint& accumulated
Offset, HitTestAction hitTestAction) |
| 401 { | 401 { |
| 402 LayoutPoint pointInParent = locationInContainer.point() - toLayoutSize(accum
ulatedOffset); | 402 LayoutPoint pointInParent = locationInContainer.point() - toLayoutSize(accum
ulatedOffset); |
| 403 LayoutPoint pointInBorderBox = pointInParent - toLayoutSize(location()); | 403 LayoutPoint pointInBorderBox = pointInParent - toLayoutSize(location()); |
| 404 | 404 |
| 405 // Only test SVG content if the point is in our content box. | 405 // Only test SVG content if the point is in our content box. |
| 406 // FIXME: This should be an intersection when rect-based hit tests are suppo
rted by nodeAtFloatPoint. | 406 // FIXME: This should be an intersection when rect-based hit tests are suppo
rted by nodeAtFloatPoint. |
| 407 if (contentBoxRect().contains(pointInBorderBox)) { | 407 if (contentBoxRect().contains(pointInBorderBox)) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 | 443 |
| 444 bool RenderSVGRoot::hasRelativeLogicalHeight() const | 444 bool RenderSVGRoot::hasRelativeLogicalHeight() const |
| 445 { | 445 { |
| 446 SVGSVGElement* svg = toSVGSVGElement(node()); | 446 SVGSVGElement* svg = toSVGSVGElement(node()); |
| 447 ASSERT(svg); | 447 ASSERT(svg); |
| 448 | 448 |
| 449 return svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties).isPercent(); | 449 return svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties).isPercent(); |
| 450 } | 450 } |
| 451 | 451 |
| 452 } | 452 } |
| OLD | NEW |