diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:05:15 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:05:15 -0800 |
commit | 1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353 (patch) | |
tree | 4457a7306ea5acb43fe05bfe0973b1f7faf97ba2 /WebCore/rendering/RenderSVGRoot.cpp | |
parent | 9364f22aed35e1a1e9d07c121510f80be3ab0502 (diff) | |
download | external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.zip external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.gz external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.bz2 |
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'WebCore/rendering/RenderSVGRoot.cpp')
-rw-r--r-- | WebCore/rendering/RenderSVGRoot.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/WebCore/rendering/RenderSVGRoot.cpp b/WebCore/rendering/RenderSVGRoot.cpp index 0684b08..1c59450 100644 --- a/WebCore/rendering/RenderSVGRoot.cpp +++ b/WebCore/rendering/RenderSVGRoot.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> - 2004, 2005, 2007 Rob Buis <buis@kde.org> + 2004, 2005, 2007, 2008 Rob Buis <buis@kde.org> 2007 Eric Seidel <eric@webkit.org> This file is part of the KDE project @@ -39,6 +39,8 @@ #include "SVGStyledElement.h" #include "SVGURIReference.h" +using namespace std; + namespace WebCore { RenderSVGRoot::RenderSVGRoot(SVGStyledElement* node) @@ -51,12 +53,12 @@ RenderSVGRoot::~RenderSVGRoot() { } -short RenderSVGRoot::lineHeight(bool b, bool isRootLineBox) const +int RenderSVGRoot::lineHeight(bool b, bool isRootLineBox) const { return height() + marginTop() + marginBottom(); } -short RenderSVGRoot::baselinePosition(bool b, bool isRootLineBox) const +int RenderSVGRoot::baselinePosition(bool b, bool isRootLineBox) const { return height() + marginTop() + marginBottom(); } @@ -65,7 +67,12 @@ void RenderSVGRoot::calcPrefWidths() { ASSERT(prefWidthsDirty()); - int width = calcReplacedWidth() + paddingLeft() + paddingRight() + borderLeft() + borderRight(); + int paddingAndBorders = paddingLeft() + paddingRight() + borderLeft() + borderRight(); + int width = calcReplacedWidth(false) + paddingAndBorders; + + if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) + width = min(width, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? paddingAndBorders : 0)); + if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent())) { m_minPrefWidth = 0; m_maxPrefWidth = width; @@ -164,8 +171,7 @@ void RenderSVGRoot::paint(PaintInfo& paintInfo, int parentX, int parentY) #if ENABLE(SVG_FILTERS) // Spec: groups w/o children still may render filter content. const SVGRenderStyle* svgStyle = style()->svgStyle(); - AtomicString filterId(SVGURIReference::getTarget(svgStyle->filter())); - SVGResourceFilter* filter = getFilterById(document(), filterId); + SVGResourceFilter* filter = getFilterById(document(), svgStyle->filter()); if (!filter) #endif return; @@ -213,13 +219,13 @@ void RenderSVGRoot::calcViewport() if (width.unitType() == LengthTypePercentage && svg->hasSetContainerSize()) w = svg->relativeWidthValue(); else - w = width.value(); + w = width.value(svg); SVGLength height = svg->height(); if (height.unitType() == LengthTypePercentage && svg->hasSetContainerSize()) h = svg->relativeHeightValue(); else - h = height.value(); + h = height.value(svg); m_viewport = FloatRect(0, 0, w, h); } @@ -234,7 +240,7 @@ IntRect RenderSVGRoot::absoluteClippedOverflowRect() #if ENABLE(SVG_FILTERS) // Filters can expand the bounding box - SVGResourceFilter* filter = getFilterById(document(), SVGURIReference::getTarget(style()->svgStyle()->filter())); + SVGResourceFilter* filter = getFilterById(document(), style()->svgStyle()->filter()); if (filter) repaintRect.unite(enclosingIntRect(filter->filterBBoxForItemBBox(repaintRect))); #endif |