diff options
author | Steve Block <steveblock@google.com> | 2011-06-10 16:52:27 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-06-14 01:14:02 +0100 |
commit | 54cdeeebc7adcbcd900e8b6a141a8cae27d9a631 (patch) | |
tree | 845b0d338b204a48560eca3b51b34cf92ed96840 /Source/WebCore/rendering/svg | |
parent | d2c5226a647dc21d0c15267e09a3d19cf3e0d593 (diff) | |
download | external_webkit-54cdeeebc7adcbcd900e8b6a141a8cae27d9a631.zip external_webkit-54cdeeebc7adcbcd900e8b6a141a8cae27d9a631.tar.gz external_webkit-54cdeeebc7adcbcd900e8b6a141a8cae27d9a631.tar.bz2 |
Merge WebKit at branches/chromium/742 r88085: Initial merge by git.
Change-Id: I0501b484b9528e31b0026e5ad64416dd6541cdde
Diffstat (limited to 'Source/WebCore/rendering/svg')
8 files changed, 54 insertions, 35 deletions
diff --git a/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp b/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp index c8539c6..5760bed 100644 --- a/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp @@ -70,6 +70,14 @@ RenderSVGInlineText::RenderSVGInlineText(Node* n, PassRefPtr<StringImpl> string) { } +void RenderSVGInlineText::destroy() +{ + if (RenderSVGText* textRenderer = RenderSVGText::locateRenderSVGTextAncestor(this)) + textRenderer->setNeedsPositioningValuesUpdate(); + + RenderText::destroy(); +} + void RenderSVGInlineText::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) { RenderText::styleDidChange(diff, oldStyle); diff --git a/Source/WebCore/rendering/svg/RenderSVGInlineText.h b/Source/WebCore/rendering/svg/RenderSVGInlineText.h index 9eed8cd..5d1cd54 100644 --- a/Source/WebCore/rendering/svg/RenderSVGInlineText.h +++ b/Source/WebCore/rendering/svg/RenderSVGInlineText.h @@ -48,6 +48,7 @@ public: private: virtual const char* renderName() const { return "RenderSVGInlineText"; } + virtual void destroy(); virtual void styleDidChange(StyleDifference, const RenderStyle*); // FIXME: We need objectBoundingBox for DRT results and filters at the moment. diff --git a/Source/WebCore/rendering/svg/RenderSVGResource.cpp b/Source/WebCore/rendering/svg/RenderSVGResource.cpp index 12ed53a..c0b16c5 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResource.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGResource.cpp @@ -51,36 +51,33 @@ static inline RenderSVGResource* requestPaintingResource(RenderSVGResourceMode m return 0; } - bool applyToFill = mode == ApplyToFillMode; - SVGPaint::SVGPaintType paintType = applyToFill ? svgStyle->fillPaintType() : svgStyle->strokePaintType(); + SVGPaint* paint = mode == ApplyToFillMode ? svgStyle->fillPaint() : svgStyle->strokePaint(); + ASSERT(paint); + + SVGPaint::SVGPaintType paintType = paint->paintType(); if (paintType == SVGPaint::SVG_PAINTTYPE_NONE) return 0; Color color; - switch (paintType) { - case SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR: - case SVGPaint::SVG_PAINTTYPE_RGBCOLOR: - case SVGPaint::SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: - case SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR: - case SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR: - case SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: - color = applyToFill ? svgStyle->fillPaintColor() : svgStyle->strokePaintColor(); - default: - break; - } + if (paintType == SVGPaint::SVG_PAINTTYPE_RGBCOLOR + || paintType == SVGPaint::SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR + || paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR + || paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR) + color = paint->color(); + else if (paintType == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR || paintType == SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR) + color = style->visitedDependentColor(CSSPropertyColor); if (style->insideLink() == InsideVisitedLink) { RenderStyle* visitedStyle = style->getCachedPseudoStyle(VISITED_LINK); ASSERT(visitedStyle); - const SVGRenderStyle* svgVisitedStyle = visitedStyle->svgStyle(); - SVGPaint::SVGPaintType visitedPaintType = applyToFill ? svgVisitedStyle->fillPaintType() : svgVisitedStyle->strokePaintType(); - - // For SVG_PAINTTYPE_CURRENTCOLOR, 'color' already contains the 'visitedColor'. - if (visitedPaintType < SVGPaint::SVG_PAINTTYPE_URI_NONE && visitedPaintType != SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR) { - const Color& visitedColor = applyToFill ? svgVisitedStyle->fillPaintColor() : svgVisitedStyle->strokePaintColor(); - if (visitedColor.isValid()) - color = Color(visitedColor.red(), visitedColor.green(), visitedColor.blue(), color.alpha()); + if (SVGPaint* visitedPaint = mode == ApplyToFillMode ? visitedStyle->svgStyle()->fillPaint() : visitedStyle->svgStyle()->strokePaint()) { + // For SVG_PAINTTYPE_CURRENTCOLOR, 'color' already contains the 'visitedColor'. + if (visitedPaint->paintType() < SVGPaint::SVG_PAINTTYPE_URI_NONE && visitedPaint->paintType() != SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR) { + const Color& visitedColor = visitedPaint->color(); + if (visitedColor.isValid()) + color = Color(visitedColor.red(), visitedColor.green(), visitedColor.blue(), color.alpha()); + } } } diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp b/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp index 245a859..c57f8b0 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp @@ -254,8 +254,8 @@ bool RenderSVGResourceClipper::drawContentIntoMaskImage(ClipperData* clipperData RefPtr<RenderStyle> oldRenderStyle = renderer->style(); RefPtr<RenderStyle> newRenderStyle = RenderStyle::clone(oldRenderStyle.get()); SVGRenderStyle* svgStyle = newRenderStyle.get()->accessSVGStyle(); - svgStyle->setFillPaint(SVGRenderStyle::initialFillPaintType(), SVGRenderStyle::initialFillPaintColor(), SVGRenderStyle::initialFillPaintUri()); - svgStyle->setStrokePaint(SVGRenderStyle::initialStrokePaintType(), SVGRenderStyle::initialStrokePaintColor(), SVGRenderStyle::initialStrokePaintUri()); + svgStyle->setFillPaint(SVGPaint::defaultFill()); + svgStyle->setStrokePaint(SVGPaint::defaultStroke()); svgStyle->setFillRule(newClipRule); newRenderStyle.get()->setOpacity(1.0f); svgStyle->setFillOpacity(1.0f); diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp b/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp index 09195f5..d6776cf 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp @@ -27,6 +27,7 @@ #include "RenderSVGResourceFilter.h" #include "AffineTransform.h" +#include "FilterEffect.h" #include "FloatPoint.h" #include "FloatRect.h" #include "GraphicsContext.h" @@ -48,8 +49,6 @@ #include <wtf/UnusedParam.h> #include <wtf/Vector.h> -static const float kMaxFilterSize = 5000.0f; - using namespace std; namespace WebCore { @@ -84,8 +83,12 @@ void RenderSVGResourceFilter::removeClientFromCache(RenderObject* client, bool m { ASSERT(client); - if (m_filter.contains(client)) - delete m_filter.take(client); + if (FilterData* filterData = m_filter.get(client)) { + if (filterData->savedContext) + filterData->markedForRemoval = true; + else + delete m_filter.take(client); + } markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidation : ParentOnlyInvalidation); } @@ -266,10 +269,15 @@ void RenderSVGResourceFilter::postApplyResource(RenderObject* object, GraphicsCo UNUSED_PARAM(resourceMode); #endif - if (!m_filter.contains(object)) + FilterData* filterData = m_filter.get(object); + if (!filterData) return; - FilterData* filterData = m_filter.get(object); + if (filterData->markedForRemoval) { + delete m_filter.take(object); + return; + } + if (!filterData->builded) { if (!filterData->savedContext) { removeClientFromCache(object); diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h b/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h index c809f23..45aff5c 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h +++ b/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h @@ -43,6 +43,7 @@ struct FilterData { FilterData() : savedContext(0) , builded(false) + , markedForRemoval(false) { } @@ -53,7 +54,8 @@ struct FilterData { AffineTransform shearFreeAbsoluteTransform; FloatRect boundaries; FloatSize scale; - bool builded; + bool builded : 1; + bool markedForRemoval : 1; }; class GraphicsContext; diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceFilterPrimitive.cpp b/Source/WebCore/rendering/svg/RenderSVGResourceFilterPrimitive.cpp index f077bfd..b74122e 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourceFilterPrimitive.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGResourceFilterPrimitive.cpp @@ -128,7 +128,7 @@ FloatRect RenderSVGResourceFilterPrimitive::determineFilterPrimitiveSubregion(Fi absoluteScaledFilterRegion.scale(filterResolution.width(), filterResolution.height()); absoluteSubregion.intersect(absoluteScaledFilterRegion); - effect->setMaxEffectRect(enclosingIntRect(absoluteSubregion)); + effect->setMaxEffectRect(absoluteSubregion); return subregion; } diff --git a/Source/WebCore/rendering/svg/SVGResources.cpp b/Source/WebCore/rendering/svg/SVGResources.cpp index d3cd184..9a2c999 100644 --- a/Source/WebCore/rendering/svg/SVGResources.cpp +++ b/Source/WebCore/rendering/svg/SVGResources.cpp @@ -152,12 +152,15 @@ static inline String targetReferenceFromResource(SVGElement* element) return SVGURIReference::getTarget(target); } -static inline RenderSVGResourceContainer* paintingResourceFromSVGPaint(Document* document, const SVGPaint::SVGPaintType& paintType, const String& paintUri, AtomicString& id, bool& hasPendingResource) +static inline RenderSVGResourceContainer* paintingResourceFromSVGPaint(Document* document, SVGPaint* paint, AtomicString& id, bool& hasPendingResource) { + ASSERT(paint); + + SVGPaint::SVGPaintType paintType = paint->paintType(); if (paintType != SVGPaint::SVG_PAINTTYPE_URI && paintType != SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR) return 0; - id = SVGURIReference::getTarget(paintUri); + id = SVGURIReference::getTarget(paint->uri()); RenderSVGResourceContainer* container = getRenderSVGResourceContainerById(document, id); if (!container) { hasPendingResource = true; @@ -256,7 +259,7 @@ bool SVGResources::buildCachedResources(const RenderObject* object, const SVGRen if (style->hasFill()) { bool hasPendingResource = false; AtomicString id; - if (setFill(paintingResourceFromSVGPaint(document, style->fillPaintType(), style->fillPaintUri(), id, hasPendingResource))) + if (setFill(paintingResourceFromSVGPaint(document, style->fillPaint(), id, hasPendingResource))) foundResources = true; else if (hasPendingResource) registerPendingResource(extensions, id, element); @@ -265,7 +268,7 @@ bool SVGResources::buildCachedResources(const RenderObject* object, const SVGRen if (style->hasStroke()) { bool hasPendingResource = false; AtomicString id; - if (setStroke(paintingResourceFromSVGPaint(document, style->strokePaintType(), style->strokePaintUri(), id, hasPendingResource))) + if (setStroke(paintingResourceFromSVGPaint(document, style->strokePaint(), id, hasPendingResource))) foundResources = true; else if (hasPendingResource) registerPendingResource(extensions, id, element); |