summaryrefslogtreecommitdiffstats
path: root/WebCore/svg
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-09-29 17:32:26 +0100
committerSteve Block <steveblock@google.com>2010-09-29 17:35:08 +0100
commit68513a70bcd92384395513322f1b801e7bf9c729 (patch)
tree161b50f75a5921d61731bb25e730005994fcec85 /WebCore/svg
parentfd5c6425ce58eb75211be7718d5dee960842a37e (diff)
downloadexternal_webkit-68513a70bcd92384395513322f1b801e7bf9c729.zip
external_webkit-68513a70bcd92384395513322f1b801e7bf9c729.tar.gz
external_webkit-68513a70bcd92384395513322f1b801e7bf9c729.tar.bz2
Merge WebKit at r67908: Initial merge by Git
Change-Id: I43a553e7b3299b28cb6ee8aa035ed70fe342b972
Diffstat (limited to 'WebCore/svg')
-rw-r--r--WebCore/svg/SVGAElement.cpp69
-rw-r--r--WebCore/svg/SVGFEBlendElement.cpp7
-rw-r--r--WebCore/svg/SVGFEColorMatrixElement.cpp4
-rw-r--r--WebCore/svg/SVGFEComponentTransferElement.cpp4
-rw-r--r--WebCore/svg/SVGFECompositeElement.cpp11
-rw-r--r--WebCore/svg/SVGFEConvolveMatrixElement.cpp10
-rw-r--r--WebCore/svg/SVGFEDiffuseLightingElement.cpp6
-rw-r--r--WebCore/svg/SVGFEDisplacementMapElement.cpp12
-rw-r--r--WebCore/svg/SVGFEGaussianBlurElement.cpp4
-rw-r--r--WebCore/svg/SVGFEMergeElement.cpp5
-rw-r--r--WebCore/svg/SVGFEMorphologyElement.cpp4
-rw-r--r--WebCore/svg/SVGFEOffsetElement.cpp4
-rw-r--r--WebCore/svg/SVGFESpecularLightingElement.cpp8
-rw-r--r--WebCore/svg/SVGFETileElement.cpp4
-rw-r--r--WebCore/svg/SVGFETurbulenceElement.cpp14
-rw-r--r--WebCore/svg/SVGFETurbulenceElement.h1
-rw-r--r--WebCore/svg/SVGGElement.cpp5
-rw-r--r--WebCore/svg/SVGGElement.h2
-rw-r--r--WebCore/svg/SVGImageLoader.cpp2
-rw-r--r--WebCore/svg/SVGSVGElement.cpp8
-rw-r--r--WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp20
-rw-r--r--WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h6
-rw-r--r--WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp10
-rw-r--r--WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h4
-rw-r--r--WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp31
-rw-r--r--WebCore/svg/graphics/filters/SVGFEDisplacementMap.h9
-rw-r--r--WebCore/svg/graphics/filters/SVGFEFlood.cpp2
-rw-r--r--WebCore/svg/graphics/filters/SVGFEImage.cpp2
-rw-r--r--WebCore/svg/graphics/filters/SVGFELighting.cpp12
-rw-r--r--WebCore/svg/graphics/filters/SVGFELighting.h5
-rw-r--r--WebCore/svg/graphics/filters/SVGFEMerge.cpp57
-rw-r--r--WebCore/svg/graphics/filters/SVGFEMerge.h10
-rw-r--r--WebCore/svg/graphics/filters/SVGFEMorphology.cpp24
-rw-r--r--WebCore/svg/graphics/filters/SVGFEMorphology.h6
-rw-r--r--WebCore/svg/graphics/filters/SVGFEOffset.cpp26
-rw-r--r--WebCore/svg/graphics/filters/SVGFEOffset.h6
-rw-r--r--WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp10
-rw-r--r--WebCore/svg/graphics/filters/SVGFESpecularLighting.h5
-rw-r--r--WebCore/svg/graphics/filters/SVGFETile.cpp35
-rw-r--r--WebCore/svg/graphics/filters/SVGFETile.h9
-rw-r--r--WebCore/svg/graphics/filters/SVGFilter.cpp40
-rw-r--r--WebCore/svg/graphics/filters/SVGFilter.h9
42 files changed, 262 insertions, 260 deletions
diff --git a/WebCore/svg/SVGAElement.cpp b/WebCore/svg/SVGAElement.cpp
index b0ffc74..d711a52 100644
--- a/WebCore/svg/SVGAElement.cpp
+++ b/WebCore/svg/SVGAElement.cpp
@@ -2,6 +2,7 @@
* Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
* Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org>
* Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -33,6 +34,7 @@
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameLoaderTypes.h"
+#include "HTMLAnchorElement.h"
#include "KeyboardEvent.h"
#include "MouseEvent.h"
#include "PlatformMouseEvent.h"
@@ -125,60 +127,47 @@ RenderObject* SVGAElement::createRenderer(RenderArena* arena, RenderStyle*)
return new (arena) RenderSVGTransformableContainer(this);
}
-void SVGAElement::defaultEventHandler(Event* evt)
+void SVGAElement::defaultEventHandler(Event* event)
{
- if (isLink() && (evt->type() == eventNames().clickEvent || (evt->type() == eventNames().keydownEvent && focused()))) {
- MouseEvent* e = 0;
- if (evt->type() == eventNames().clickEvent && evt->isMouseEvent())
- e = static_cast<MouseEvent*>(evt);
-
- KeyboardEvent* k = 0;
- if (evt->type() == eventNames().keydownEvent && evt->isKeyboardEvent())
- k = static_cast<KeyboardEvent*>(evt);
-
- if (e && e->button() == RightButton) {
- SVGStyledTransformableElement::defaultEventHandler(evt);
+ if (isLink()) {
+ if (focused() && isEnterKeyKeydownEvent(event)) {
+ event->setDefaultHandled();
+ dispatchSimulatedClick(event);
return;
}
-
- if (k) {
- if (k->keyIdentifier() != "Enter") {
- SVGStyledTransformableElement::defaultEventHandler(evt);
- return;
- }
- evt->setDefaultHandled();
- dispatchSimulatedClick(evt);
- return;
- }
-
- String target = this->target();
- if (e && e->button() == MiddleButton)
- target = "_blank";
- else if (target.isEmpty()) // if target is empty, default to "_self" or use xlink:target if set
- target = (getAttribute(XLinkNames::showAttr) == "new") ? "_blank" : "_self";
-
- if (!evt->defaultPrevented()) {
+
+ if (isLinkClick(event)) {
String url = deprecatedParseURL(href());
+
#if ENABLE(SVG_ANIMATION)
- if (url.startsWith("#")) {
+ if (url[0] == '#') {
Element* targetElement = document()->getElementById(url.substring(1));
if (SVGSMILElement::isSMILElement(targetElement)) {
- SVGSMILElement* timed = static_cast<SVGSMILElement*>(targetElement);
- timed->beginByLinkActivation();
- evt->setDefaultHandled();
- SVGStyledTransformableElement::defaultEventHandler(evt);
+ static_cast<SVGSMILElement*>(targetElement)->beginByLinkActivation();
+ event->setDefaultHandled();
return;
}
}
#endif
- if (document()->frame())
- document()->frame()->loader()->urlSelected(document()->completeURL(url), target, evt, false, false, true, SendReferrer);
- }
- evt->setDefaultHandled();
+ // FIXME: Why does the SVG anchor element have this special logic
+ // for middle click that the HTML anchor element does not have?
+ // Making a middle click open a link in a new window or tab is
+ // properly handled at the client level, not inside WebKit; this
+ // code should be deleted.
+ String target = isMiddleMouseButtonEvent(event) ? "_blank" : this->target();
+
+ // FIXME: It's not clear why setting target to "_self" is ever
+ // helpful.
+ if (target.isEmpty())
+ target = (getAttribute(XLinkNames::showAttr) == "new") ? "_blank" : "_self";
+
+ handleLinkClick(event, document(), url, target);
+ return;
+ }
}
- SVGStyledTransformableElement::defaultEventHandler(evt);
+ SVGStyledTransformableElement::defaultEventHandler(event);
}
bool SVGAElement::supportsFocus() const
diff --git a/WebCore/svg/SVGFEBlendElement.cpp b/WebCore/svg/SVGFEBlendElement.cpp
index 451b7d1..c4d816b 100644
--- a/WebCore/svg/SVGFEBlendElement.cpp
+++ b/WebCore/svg/SVGFEBlendElement.cpp
@@ -87,7 +87,12 @@ PassRefPtr<FilterEffect> SVGFEBlendElement::build(SVGFilterBuilder* filterBuilde
if (!input1 || !input2)
return 0;
- return FEBlend::create(input1, input2, static_cast<BlendModeType>(mode()));
+ RefPtr<FilterEffect> effect = FEBlend::create(static_cast<BlendModeType>(mode()));
+ FilterEffectVector& inputEffects = effect->inputEffects();
+ inputEffects.reserveCapacity(2);
+ inputEffects.append(input1);
+ inputEffects.append(input2);
+ return effect.release();
}
}
diff --git a/WebCore/svg/SVGFEColorMatrixElement.cpp b/WebCore/svg/SVGFEColorMatrixElement.cpp
index 7f496bc..f14b4e7 100644
--- a/WebCore/svg/SVGFEColorMatrixElement.cpp
+++ b/WebCore/svg/SVGFEColorMatrixElement.cpp
@@ -123,7 +123,9 @@ PassRefPtr<FilterEffect> SVGFEColorMatrixElement::build(SVGFilterBuilder* filter
return 0;
}
- return FEColorMatrix::create(input1, filterType, filterValues);
+ RefPtr<FilterEffect> effect = FEColorMatrix::create(filterType, filterValues);
+ effect->inputEffects().append(input1);
+ return effect.release();
}
} //namespace WebCore
diff --git a/WebCore/svg/SVGFEComponentTransferElement.cpp b/WebCore/svg/SVGFEComponentTransferElement.cpp
index a99e74c..f6b26f5 100644
--- a/WebCore/svg/SVGFEComponentTransferElement.cpp
+++ b/WebCore/svg/SVGFEComponentTransferElement.cpp
@@ -83,7 +83,9 @@ PassRefPtr<FilterEffect> SVGFEComponentTransferElement::build(SVGFilterBuilder*
alpha = static_cast<SVGFEFuncAElement*>(n)->transferFunction();
}
- return FEComponentTransfer::create(input1, red, green, blue, alpha);
+ RefPtr<FilterEffect> effect = FEComponentTransfer::create(red, green, blue, alpha);
+ effect->inputEffects().append(input1);
+ return effect.release();
}
}
diff --git a/WebCore/svg/SVGFECompositeElement.cpp b/WebCore/svg/SVGFECompositeElement.cpp
index f658632..b6f1002 100644
--- a/WebCore/svg/SVGFECompositeElement.cpp
+++ b/WebCore/svg/SVGFECompositeElement.cpp
@@ -109,9 +109,14 @@ PassRefPtr<FilterEffect> SVGFECompositeElement::build(SVGFilterBuilder* filterBu
if (!input1 || !input2)
return 0;
-
- return FEComposite::create(input1, input2, static_cast<CompositeOperationType>(_operator()),
- k1(), k2(), k3(), k4());
+
+ RefPtr<FilterEffect> effect = FEComposite::create(static_cast<CompositeOperationType>(_operator()),
+ k1(), k2(), k3(), k4());
+ FilterEffectVector& inputEffects = effect->inputEffects();
+ inputEffects.reserveCapacity(2);
+ inputEffects.append(input1);
+ inputEffects.append(input2);
+ return effect.release();
}
}
diff --git a/WebCore/svg/SVGFEConvolveMatrixElement.cpp b/WebCore/svg/SVGFEConvolveMatrixElement.cpp
index 9432a00..db2fad5 100644
--- a/WebCore/svg/SVGFEConvolveMatrixElement.cpp
+++ b/WebCore/svg/SVGFEConvolveMatrixElement.cpp
@@ -151,10 +151,12 @@ PassRefPtr<FilterEffect> SVGFEConvolveMatrixElement::build(SVGFilterBuilder* fil
divisorValue = 1;
}
- return FEConvolveMatrix::create(
- input1, IntSize(orderXValue, orderYValue), divisorValue,
- bias(), IntPoint(targetXValue, targetYValue), static_cast<EdgeModeType>(edgeMode()),
- FloatPoint(kernelUnitLengthX(), kernelUnitLengthX()), preserveAlpha(), kernelMatrixValues);
+ RefPtr<FilterEffect> effect = FEConvolveMatrix::create(
+ IntSize(orderXValue, orderYValue), divisorValue,
+ bias(), IntPoint(targetXValue, targetYValue), static_cast<EdgeModeType>(edgeMode()),
+ FloatPoint(kernelUnitLengthX(), kernelUnitLengthX()), preserveAlpha(), kernelMatrixValues);
+ effect->inputEffects().append(input1);
+ return effect.release();
}
} // namespace WebCore
diff --git a/WebCore/svg/SVGFEDiffuseLightingElement.cpp b/WebCore/svg/SVGFEDiffuseLightingElement.cpp
index 4349f27..4bc1bdb 100644
--- a/WebCore/svg/SVGFEDiffuseLightingElement.cpp
+++ b/WebCore/svg/SVGFEDiffuseLightingElement.cpp
@@ -113,8 +113,10 @@ PassRefPtr<FilterEffect> SVGFEDiffuseLightingElement::build(SVGFilterBuilder* fi
RefPtr<RenderStyle> filterStyle = styleForRenderer();
Color color = filterStyle->svgStyle()->lightingColor();
- return FEDiffuseLighting::create(input1, color, surfaceScale(), diffuseConstant(),
- kernelUnitLengthX(), kernelUnitLengthY(), findLights());
+ RefPtr<FilterEffect> effect = FEDiffuseLighting::create(color, surfaceScale(), diffuseConstant(),
+ kernelUnitLengthX(), kernelUnitLengthY(), findLights());
+ effect->inputEffects().append(input1);
+ return effect.release();
}
PassRefPtr<LightSource> SVGFEDiffuseLightingElement::findLights() const
diff --git a/WebCore/svg/SVGFEDisplacementMapElement.cpp b/WebCore/svg/SVGFEDisplacementMapElement.cpp
index 013eca5..ea8a7b8 100644
--- a/WebCore/svg/SVGFEDisplacementMapElement.cpp
+++ b/WebCore/svg/SVGFEDisplacementMapElement.cpp
@@ -101,10 +101,14 @@ PassRefPtr<FilterEffect> SVGFEDisplacementMapElement::build(SVGFilterBuilder* fi
if (!input1 || !input2)
return 0;
-
-
- return FEDisplacementMap::create(input1, input2, static_cast<ChannelSelectorType>(xChannelSelector()),
- static_cast<ChannelSelectorType>(yChannelSelector()), scale());
+
+ RefPtr<FilterEffect> effect = FEDisplacementMap::create(static_cast<ChannelSelectorType>(xChannelSelector()),
+ static_cast<ChannelSelectorType>(yChannelSelector()), scale());
+ FilterEffectVector& inputEffects = effect->inputEffects();
+ inputEffects.reserveCapacity(2);
+ inputEffects.append(input1);
+ inputEffects.append(input2);
+ return effect.release();
}
}
diff --git a/WebCore/svg/SVGFEGaussianBlurElement.cpp b/WebCore/svg/SVGFEGaussianBlurElement.cpp
index f66fa90..3dfd51c 100644
--- a/WebCore/svg/SVGFEGaussianBlurElement.cpp
+++ b/WebCore/svg/SVGFEGaussianBlurElement.cpp
@@ -87,7 +87,9 @@ PassRefPtr<FilterEffect> SVGFEGaussianBlurElement::build(SVGFilterBuilder* filte
if (!input1)
return 0;
- return FEGaussianBlur::create(input1, stdDeviationX(), stdDeviationY());
+ RefPtr<FilterEffect> effect = FEGaussianBlur::create(stdDeviationX(), stdDeviationY());
+ effect->inputEffects().append(input1);
+ return effect.release();
}
}
diff --git a/WebCore/svg/SVGFEMergeElement.cpp b/WebCore/svg/SVGFEMergeElement.cpp
index 6254b24..49a052e 100644
--- a/WebCore/svg/SVGFEMergeElement.cpp
+++ b/WebCore/svg/SVGFEMergeElement.cpp
@@ -39,7 +39,8 @@ PassRefPtr<SVGFEMergeElement> SVGFEMergeElement::create(const QualifiedName& tag
PassRefPtr<FilterEffect> SVGFEMergeElement::build(SVGFilterBuilder* filterBuilder)
{
- Vector<RefPtr<FilterEffect> > mergeInputs;
+ RefPtr<FilterEffect> effect = FEMerge::create();
+ FilterEffectVector& mergeInputs = effect->inputEffects();
for (Node* n = firstChild(); n != 0; n = n->nextSibling()) {
if (n->hasTagName(SVGNames::feMergeNodeTag)) {
FilterEffect* mergeEffect = filterBuilder->getEffectById(static_cast<SVGFEMergeNodeElement*>(n)->in1());
@@ -52,7 +53,7 @@ PassRefPtr<FilterEffect> SVGFEMergeElement::build(SVGFilterBuilder* filterBuilde
if (mergeInputs.isEmpty())
return 0;
- return FEMerge::create(mergeInputs);
+ return effect.release();
}
}
diff --git a/WebCore/svg/SVGFEMorphologyElement.cpp b/WebCore/svg/SVGFEMorphologyElement.cpp
index c3db844..b45c6f9 100644
--- a/WebCore/svg/SVGFEMorphologyElement.cpp
+++ b/WebCore/svg/SVGFEMorphologyElement.cpp
@@ -101,7 +101,9 @@ PassRefPtr<FilterEffect> SVGFEMorphologyElement::build(SVGFilterBuilder* filterB
if (xRadius < 0 || yRadius < 0)
return 0;
- return FEMorphology::create(input1, static_cast<MorphologyOperatorType>(_operator()), xRadius, yRadius);
+ RefPtr<FilterEffect> effect = FEMorphology::create(static_cast<MorphologyOperatorType>(_operator()), xRadius, yRadius);
+ effect->inputEffects().append(input1);
+ return effect.release();
}
} //namespace WebCore
diff --git a/WebCore/svg/SVGFEOffsetElement.cpp b/WebCore/svg/SVGFEOffsetElement.cpp
index 58b4a6a..65523a5 100644
--- a/WebCore/svg/SVGFEOffsetElement.cpp
+++ b/WebCore/svg/SVGFEOffsetElement.cpp
@@ -86,7 +86,9 @@ PassRefPtr<FilterEffect> SVGFEOffsetElement::build(SVGFilterBuilder* filterBuild
if (!input1)
return 0;
- return FEOffset::create(input1, dx(), dy());
+ RefPtr<FilterEffect> effect = FEOffset::create(dx(), dy());
+ effect->inputEffects().append(input1);
+ return effect.release();
}
}
diff --git a/WebCore/svg/SVGFESpecularLightingElement.cpp b/WebCore/svg/SVGFESpecularLightingElement.cpp
index d07c6ce..1647525 100644
--- a/WebCore/svg/SVGFESpecularLightingElement.cpp
+++ b/WebCore/svg/SVGFESpecularLightingElement.cpp
@@ -118,9 +118,11 @@ PassRefPtr<FilterEffect> SVGFESpecularLightingElement::build(SVGFilterBuilder* f
RefPtr<RenderStyle> filterStyle = styleForRenderer();
Color color = filterStyle->svgStyle()->lightingColor();
-
- return FESpecularLighting::create(input1, color, surfaceScale(), specularConstant(),
- specularExponent(), kernelUnitLengthX(), kernelUnitLengthY(), findLights());
+
+ RefPtr<FilterEffect> effect = FESpecularLighting::create(color, surfaceScale(), specularConstant(),
+ specularExponent(), kernelUnitLengthX(), kernelUnitLengthY(), findLights());
+ effect->inputEffects().append(input1);
+ return effect.release();
}
}
diff --git a/WebCore/svg/SVGFETileElement.cpp b/WebCore/svg/SVGFETileElement.cpp
index 4379b96..9664490 100644
--- a/WebCore/svg/SVGFETileElement.cpp
+++ b/WebCore/svg/SVGFETileElement.cpp
@@ -62,7 +62,9 @@ PassRefPtr<FilterEffect> SVGFETileElement::build(SVGFilterBuilder* filterBuilder
if (!input1)
return 0;
- return FETile::create(input1);
+ RefPtr<FilterEffect> effect = FETile::create();
+ effect->inputEffects().append(input1);
+ return effect.release();
}
}
diff --git a/WebCore/svg/SVGFETurbulenceElement.cpp b/WebCore/svg/SVGFETurbulenceElement.cpp
index 5c1d32f..5339e02 100644
--- a/WebCore/svg/SVGFETurbulenceElement.cpp
+++ b/WebCore/svg/SVGFETurbulenceElement.cpp
@@ -55,7 +55,7 @@ void SVGFETurbulenceElement::parseMappedAttribute(Attribute* attr)
} else if (attr->name() == SVGNames::stitchTilesAttr) {
if (value == "stitch")
setStitchTilesBaseValue(SVG_STITCHTYPE_STITCH);
- else if (value == "nostitch")
+ else if (value == "noStitch")
setStitchTilesBaseValue(SVG_STITCHTYPE_NOSTITCH);
} else if (attr->name() == SVGNames::baseFrequencyAttr) {
float x, y;
@@ -71,6 +71,18 @@ void SVGFETurbulenceElement::parseMappedAttribute(Attribute* attr)
SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
}
+void SVGFETurbulenceElement::svgAttributeChanged(const QualifiedName& attrName)
+{
+ SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
+
+ if (attrName == SVGNames::baseFrequencyAttr
+ || attrName == SVGNames::numOctavesAttr
+ || attrName == SVGNames::seedAttr
+ || attrName == SVGNames::stitchTilesAttr
+ || attrName == SVGNames::typeAttr)
+ invalidate();
+}
+
void SVGFETurbulenceElement::synchronizeProperty(const QualifiedName& attrName)
{
SVGFilterPrimitiveStandardAttributes::synchronizeProperty(attrName);
diff --git a/WebCore/svg/SVGFETurbulenceElement.h b/WebCore/svg/SVGFETurbulenceElement.h
index 78d47f9..887aacf 100644
--- a/WebCore/svg/SVGFETurbulenceElement.h
+++ b/WebCore/svg/SVGFETurbulenceElement.h
@@ -44,6 +44,7 @@ private:
SVGFETurbulenceElement(const QualifiedName&, Document*);
virtual void parseMappedAttribute(Attribute*);
+ virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*);
diff --git a/WebCore/svg/SVGGElement.cpp b/WebCore/svg/SVGGElement.cpp
index 8174eac..a455cd5 100644
--- a/WebCore/svg/SVGGElement.cpp
+++ b/WebCore/svg/SVGGElement.cpp
@@ -91,6 +91,11 @@ RenderObject* SVGGElement::createRenderer(RenderArena* arena, RenderStyle* style
return new (arena) RenderSVGTransformableContainer(this);
}
+bool SVGGElement::rendererIsNeeded(RenderStyle*)
+{
+ return parentNode() && parentNode()->isSVGElement();
+}
+
}
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGGElement.h b/WebCore/svg/SVGGElement.h
index a149351..b47eaba 100644
--- a/WebCore/svg/SVGGElement.h
+++ b/WebCore/svg/SVGGElement.h
@@ -50,7 +50,7 @@ namespace WebCore {
virtual void svgAttributeChanged(const QualifiedName&);
virtual void synchronizeProperty(const QualifiedName&);
- virtual bool rendererIsNeeded(RenderStyle*) { return true; }
+ virtual bool rendererIsNeeded(RenderStyle*);
// SVGExternalResourcesRequired
DECLARE_ANIMATED_PROPERTY(SVGGElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired)
diff --git a/WebCore/svg/SVGImageLoader.cpp b/WebCore/svg/SVGImageLoader.cpp
index 5ba9c81..2079f74 100644
--- a/WebCore/svg/SVGImageLoader.cpp
+++ b/WebCore/svg/SVGImageLoader.cpp
@@ -48,7 +48,7 @@ void SVGImageLoader::dispatchLoadEvent()
String SVGImageLoader::sourceURI(const AtomicString& attr) const
{
- return deprecatedParseURL(KURL(element()->baseURI(), attr).string());
+ return KURL(element()->baseURI(), deprecatedParseURL(attr)).string();
}
}
diff --git a/WebCore/svg/SVGSVGElement.cpp b/WebCore/svg/SVGSVGElement.cpp
index bc669a3..a461ec4 100644
--- a/WebCore/svg/SVGSVGElement.cpp
+++ b/WebCore/svg/SVGSVGElement.cpp
@@ -193,18 +193,18 @@ SVGViewSpec* SVGSVGElement::currentView() const
float SVGSVGElement::currentScale() const
{
// Only the page zoom factor is relevant for SVG
- if (FrameView* view = document()->view())
- return view->pageZoomFactor();
+ if (Frame* frame = document()->frame())
+ return frame->pageZoomFactor();
return m_scale;
}
void SVGSVGElement::setCurrentScale(float scale)
{
- if (FrameView* view = document()->view()) {
+ if (Frame* frame = document()->frame()) {
// Calling setCurrentScale() on the outermost <svg> element in a standalone SVG document
// is allowed to change the page zoom factor, influencing the document size, scrollbars etc.
if (parentNode() == document())
- view->setZoomFactor(scale, ZoomPage);
+ frame->setPageZoomFactor(scale);
return;
}
diff --git a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp b/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp
index c1a1166..2dbc7ab 100644
--- a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp
@@ -33,11 +33,10 @@
namespace WebCore {
-FEConvolveMatrix::FEConvolveMatrix(FilterEffect* in, const IntSize& kernelSize,
+FEConvolveMatrix::FEConvolveMatrix(const IntSize& kernelSize,
float divisor, float bias, const IntPoint& targetOffset, EdgeModeType edgeMode,
const FloatPoint& kernelUnitLength, bool preserveAlpha, const Vector<float>& kernelMatrix)
: FilterEffect()
- , m_in(in)
, m_kernelSize(kernelSize)
, m_divisor(divisor)
, m_bias(bias)
@@ -49,11 +48,11 @@ FEConvolveMatrix::FEConvolveMatrix(FilterEffect* in, const IntSize& kernelSize,
{
}
-PassRefPtr<FEConvolveMatrix> FEConvolveMatrix::create(FilterEffect* in, const IntSize& kernelSize,
+PassRefPtr<FEConvolveMatrix> FEConvolveMatrix::create(const IntSize& kernelSize,
float divisor, float bias, const IntPoint& targetOffset, EdgeModeType edgeMode,
const FloatPoint& kernelUnitLength, bool preserveAlpha, const Vector<float>& kernelMatrix)
{
- return adoptRef(new FEConvolveMatrix(in, kernelSize, divisor, bias, targetOffset, edgeMode, kernelUnitLength,
+ return adoptRef(new FEConvolveMatrix(kernelSize, divisor, bias, targetOffset, edgeMode, kernelUnitLength,
preserveAlpha, kernelMatrix));
}
@@ -374,21 +373,22 @@ ALWAYS_INLINE void FEConvolveMatrix::setOuterPixels(PaintingData& paintingData,
void FEConvolveMatrix::apply(Filter* filter)
{
- m_in->apply(filter);
- if (!m_in->resultImage())
+ FilterEffect* in = inputEffect(0);
+ in->apply(filter);
+ if (!in->resultImage())
return;
if (!getEffectContext())
return;
IntRect imageRect(IntPoint(), resultImage()->size());
- IntRect effectDrawingRect = calculateDrawingIntRect(m_in->subRegion());
+ IntRect effectDrawingRect = calculateDrawingIntRect(in->filterPrimitiveSubregion());
RefPtr<CanvasPixelArray> srcPixelArray;
if (m_preserveAlpha)
- srcPixelArray = m_in->resultImage()->getUnmultipliedImageData(effectDrawingRect)->data();
+ srcPixelArray = in->resultImage()->getUnmultipliedImageData(effectDrawingRect)->data();
else
- srcPixelArray = m_in->resultImage()->getPremultipliedImageData(effectDrawingRect)->data();
+ srcPixelArray = in->resultImage()->getPremultipliedImageData(effectDrawingRect)->data();
RefPtr<ImageData> imageData = ImageData::create(imageRect.width(), imageRect.height());
@@ -463,7 +463,7 @@ TextStream& FEConvolveMatrix::externalRepresentation(TextStream& ts, int indent)
<< "edgeMode=\"" << m_edgeMode << "\" "
<< "kernelUnitLength=\"" << m_kernelUnitLength << "\" "
<< "preserveAlpha=\"" << m_preserveAlpha << "\"]\n";
- m_in->externalRepresentation(ts, indent + 1);
+ inputEffect(0)->externalRepresentation(ts, indent + 1);
return ts;
}
diff --git a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h b/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h
index 662d097..736933c 100644
--- a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h
+++ b/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h
@@ -44,7 +44,7 @@ class CanvasPixelArray;
class FEConvolveMatrix : public FilterEffect {
public:
- static PassRefPtr<FEConvolveMatrix> create(FilterEffect*, const IntSize&,
+ static PassRefPtr<FEConvolveMatrix> create(const IntSize&,
float, float, const IntPoint&, EdgeModeType, const FloatPoint&,
bool, const Vector<float>&);
@@ -72,13 +72,12 @@ public:
bool preserveAlpha() const;
void setPreserveAlpha(bool);
- virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get()); }
void apply(Filter*);
void dump();
TextStream& externalRepresentation(TextStream&, int indent) const;
private:
- FEConvolveMatrix(FilterEffect*, const IntSize&, float, float,
+ FEConvolveMatrix(const IntSize&, float, float,
const IntPoint&, EdgeModeType, const FloatPoint&, bool, const Vector<float>&);
struct PaintingData {
@@ -101,7 +100,6 @@ private:
ALWAYS_INLINE void setInteriorPixels(PaintingData& paintingData, int clipRight, int clipBottom);
ALWAYS_INLINE void setOuterPixels(PaintingData& paintingData, int x1, int y1, int x2, int y2);
- RefPtr<FilterEffect> m_in;
IntSize m_kernelSize;
float m_divisor;
float m_bias;
diff --git a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp b/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp
index 3a008fa..b439c46 100644
--- a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp
@@ -29,17 +29,17 @@
namespace WebCore {
-FEDiffuseLighting::FEDiffuseLighting(FilterEffect* in, const Color& lightingColor, float surfaceScale,
+FEDiffuseLighting::FEDiffuseLighting(const Color& lightingColor, float surfaceScale,
float diffuseConstant, float kernelUnitLengthX, float kernelUnitLengthY, PassRefPtr<LightSource> lightSource)
- : FELighting(DiffuseLighting, in, lightingColor, surfaceScale, diffuseConstant, 0.0f, 0.0f, kernelUnitLengthX, kernelUnitLengthY, lightSource)
+ : FELighting(DiffuseLighting, lightingColor, surfaceScale, diffuseConstant, 0, 0, kernelUnitLengthX, kernelUnitLengthY, lightSource)
{
}
-PassRefPtr<FEDiffuseLighting> FEDiffuseLighting::create(FilterEffect* in , const Color& lightingColor,
+PassRefPtr<FEDiffuseLighting> FEDiffuseLighting::create(const Color& lightingColor,
float surfaceScale, float diffuseConstant, float kernelUnitLengthX,
float kernelUnitLengthY, PassRefPtr<LightSource> lightSource)
{
- return adoptRef(new FEDiffuseLighting(in, lightingColor, surfaceScale, diffuseConstant, kernelUnitLengthX, kernelUnitLengthY, lightSource));
+ return adoptRef(new FEDiffuseLighting(lightingColor, surfaceScale, diffuseConstant, kernelUnitLengthX, kernelUnitLengthY, lightSource));
}
FEDiffuseLighting::~FEDiffuseLighting()
@@ -118,7 +118,7 @@ TextStream& FEDiffuseLighting::externalRepresentation(TextStream& ts, int indent
ts << " surfaceScale=\"" << m_surfaceScale << "\" "
<< "diffuseConstant=\"" << m_diffuseConstant << "\" "
<< "kernelUnitLength=\"" << m_kernelUnitLengthX << ", " << m_kernelUnitLengthY << "\"]\n";
- m_in->externalRepresentation(ts, indent + 1);
+ inputEffect(0)->externalRepresentation(ts, indent + 1);
return ts;
}
diff --git a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h b/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h
index ee4d5b1..0cdeae3 100644
--- a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h
+++ b/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h
@@ -31,7 +31,7 @@ class LightSource;
class FEDiffuseLighting : public FELighting {
public:
- static PassRefPtr<FEDiffuseLighting> create(FilterEffect*, const Color&, float, float,
+ static PassRefPtr<FEDiffuseLighting> create(const Color&, float, float,
float, float, PassRefPtr<LightSource>);
virtual ~FEDiffuseLighting();
@@ -57,7 +57,7 @@ public:
TextStream& externalRepresentation(TextStream&, int indent) const;
private:
- FEDiffuseLighting(FilterEffect*, const Color&, float, float,
+ FEDiffuseLighting(const Color&, float, float,
float, float, PassRefPtr<LightSource>);
};
diff --git a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp b/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp
index 3305f27..9d9857e 100644
--- a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp
@@ -33,21 +33,18 @@
namespace WebCore {
-FEDisplacementMap::FEDisplacementMap(FilterEffect* in, FilterEffect* in2, ChannelSelectorType xChannelSelector,
- ChannelSelectorType yChannelSelector, const float& scale)
+FEDisplacementMap::FEDisplacementMap(ChannelSelectorType xChannelSelector, ChannelSelectorType yChannelSelector, float scale)
: FilterEffect()
- , m_in(in)
- , m_in2(in2)
, m_xChannelSelector(xChannelSelector)
, m_yChannelSelector(yChannelSelector)
, m_scale(scale)
{
}
-PassRefPtr<FEDisplacementMap> FEDisplacementMap::create(FilterEffect* in, FilterEffect* in2,
- ChannelSelectorType xChannelSelector, ChannelSelectorType yChannelSelector, const float& scale)
+PassRefPtr<FEDisplacementMap> FEDisplacementMap::create(ChannelSelectorType xChannelSelector,
+ ChannelSelectorType yChannelSelector, float scale)
{
- return adoptRef(new FEDisplacementMap(in, in2, xChannelSelector, yChannelSelector, scale));
+ return adoptRef(new FEDisplacementMap(xChannelSelector, yChannelSelector, scale));
}
ChannelSelectorType FEDisplacementMap::xChannelSelector() const
@@ -82,9 +79,11 @@ void FEDisplacementMap::setScale(float scale)
void FEDisplacementMap::apply(Filter* filter)
{
- m_in->apply(filter);
- m_in2->apply(filter);
- if (!m_in->resultImage() || !m_in2->resultImage())
+ FilterEffect* in = inputEffect(0);
+ FilterEffect* in2 = inputEffect(1);
+ in->apply(filter);
+ in2->apply(filter);
+ if (!in->resultImage() || !in2->resultImage())
return;
if (m_xChannelSelector == CHANNEL_UNKNOWN || m_yChannelSelector == CHANNEL_UNKNOWN)
@@ -93,11 +92,11 @@ void FEDisplacementMap::apply(Filter* filter)
if (!getEffectContext())
return;
- IntRect effectADrawingRect = calculateDrawingIntRect(m_in->scaledSubRegion());
- RefPtr<CanvasPixelArray> srcPixelArrayA(m_in->resultImage()->getPremultipliedImageData(effectADrawingRect)->data());
+ IntRect effectADrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());
+ RefPtr<CanvasPixelArray> srcPixelArrayA(in->resultImage()->getPremultipliedImageData(effectADrawingRect)->data());
- IntRect effectBDrawingRect = calculateDrawingIntRect(m_in2->scaledSubRegion());
- RefPtr<CanvasPixelArray> srcPixelArrayB(m_in2->resultImage()->getUnmultipliedImageData(effectBDrawingRect)->data());
+ IntRect effectBDrawingRect = calculateDrawingIntRect(in2->repaintRectInLocalCoordinates());
+ RefPtr<CanvasPixelArray> srcPixelArrayB(in2->resultImage()->getUnmultipliedImageData(effectBDrawingRect)->data());
IntRect imageRect(IntPoint(), resultImage()->size());
RefPtr<ImageData> imageData = ImageData::create(imageRect.width(), imageRect.height());
@@ -163,8 +162,8 @@ TextStream& FEDisplacementMap::externalRepresentation(TextStream& ts, int indent
ts << " scale=\"" << m_scale << "\" "
<< "xChannelSelector=\"" << m_xChannelSelector << "\" "
<< "yChannelSelector=\"" << m_yChannelSelector << "\"]\n";
- m_in->externalRepresentation(ts, indent + 1);
- m_in2->externalRepresentation(ts, indent + 1);
+ inputEffect(0)->externalRepresentation(ts, indent + 1);
+ inputEffect(1)->externalRepresentation(ts, indent + 1);
return ts;
}
diff --git a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h b/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h
index 7bb9d19..9e17da4 100644
--- a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h
+++ b/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h
@@ -39,8 +39,7 @@ namespace WebCore {
class FEDisplacementMap : public FilterEffect {
public:
- static PassRefPtr<FEDisplacementMap> create(FilterEffect*, FilterEffect*, ChannelSelectorType,
- ChannelSelectorType, const float&);
+ static PassRefPtr<FEDisplacementMap> create(ChannelSelectorType, ChannelSelectorType, float);
ChannelSelectorType xChannelSelector() const;
void setXChannelSelector(const ChannelSelectorType);
@@ -51,17 +50,13 @@ namespace WebCore {
float scale() const;
void setScale(float scale);
- virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get(), m_in2.get()); }
void apply(Filter*);
void dump();
TextStream& externalRepresentation(TextStream&, int indent) const;
private:
- FEDisplacementMap(FilterEffect*, FilterEffect*, ChannelSelectorType,
- ChannelSelectorType, const float&);
+ FEDisplacementMap(ChannelSelectorType, ChannelSelectorType, float);
- RefPtr<FilterEffect> m_in;
- RefPtr<FilterEffect> m_in2;
ChannelSelectorType m_xChannelSelector;
ChannelSelectorType m_yChannelSelector;
float m_scale;
diff --git a/WebCore/svg/graphics/filters/SVGFEFlood.cpp b/WebCore/svg/graphics/filters/SVGFEFlood.cpp
index 5286d80..a2b2cd2 100644
--- a/WebCore/svg/graphics/filters/SVGFEFlood.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEFlood.cpp
@@ -70,7 +70,7 @@ void FEFlood::apply(Filter*)
return;
Color color = colorWithOverrideAlpha(floodColor().rgb(), floodOpacity());
- filterContext->fillRect(FloatRect(FloatPoint(), scaledSubRegion().size()), color, DeviceColorSpace);
+ filterContext->fillRect(FloatRect(FloatPoint(), repaintRectInLocalCoordinates().size()), color, DeviceColorSpace);
}
void FEFlood::dump()
diff --git a/WebCore/svg/graphics/filters/SVGFEImage.cpp b/WebCore/svg/graphics/filters/SVGFEImage.cpp
index b21ceae..a3ac882 100644
--- a/WebCore/svg/graphics/filters/SVGFEImage.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEImage.cpp
@@ -55,7 +55,7 @@ void FEImage::apply(Filter*)
return;
FloatRect srcRect(FloatPoint(), m_image->size());
- FloatRect destRect(FloatPoint(), subRegion().size());
+ FloatRect destRect(FloatPoint(), filterPrimitiveSubregion().size());
m_preserveAspectRatio.transformRect(destRect, srcRect);
diff --git a/WebCore/svg/graphics/filters/SVGFELighting.cpp b/WebCore/svg/graphics/filters/SVGFELighting.cpp
index 7c3c81c..dc82840 100644
--- a/WebCore/svg/graphics/filters/SVGFELighting.cpp
+++ b/WebCore/svg/graphics/filters/SVGFELighting.cpp
@@ -35,12 +35,11 @@
namespace WebCore {
-FELighting::FELighting(LightingType lightingType, FilterEffect* in, const Color& lightingColor, float surfaceScale,
+FELighting::FELighting(LightingType lightingType, const Color& lightingColor, float surfaceScale,
float diffuseConstant, float specularConstant, float specularExponent,
float kernelUnitLengthX, float kernelUnitLengthY, PassRefPtr<LightSource> lightSource)
: FilterEffect()
, m_lightingType(lightingType)
- , m_in(in)
, m_lightSource(lightSource)
, m_lightingColor(lightingColor)
, m_surfaceScale(surfaceScale)
@@ -243,8 +242,9 @@ bool FELighting::drawLighting(CanvasPixelArray* pixels, int width, int height)
void FELighting::apply(Filter* filter)
{
- m_in->apply(filter);
- if (!m_in->resultImage())
+ FilterEffect* in = inputEffect(0);
+ in->apply(filter);
+ if (!in->resultImage())
return;
if (!getEffectContext())
@@ -252,8 +252,8 @@ void FELighting::apply(Filter* filter)
setIsAlphaImage(false);
- IntRect effectDrawingRect = calculateDrawingIntRect(m_in->scaledSubRegion());
- RefPtr<ImageData> srcImageData(m_in->resultImage()->getUnmultipliedImageData(effectDrawingRect));
+ IntRect effectDrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());
+ RefPtr<ImageData> srcImageData(in->resultImage()->getUnmultipliedImageData(effectDrawingRect));
CanvasPixelArray* srcPixelArray(srcImageData->data());
// FIXME: support kernelUnitLengths other than (1,1). The issue here is that the W3
diff --git a/WebCore/svg/graphics/filters/SVGFELighting.h b/WebCore/svg/graphics/filters/SVGFELighting.h
index 7db50e0..55802ca 100644
--- a/WebCore/svg/graphics/filters/SVGFELighting.h
+++ b/WebCore/svg/graphics/filters/SVGFELighting.h
@@ -42,7 +42,6 @@ class CanvasPixelArray;
class FELighting : public FilterEffect {
public:
- virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get()); }
void apply(Filter*);
protected:
@@ -72,15 +71,13 @@ protected:
ALWAYS_INLINE int downRightPixelValue();
};
- FELighting(LightingType, FilterEffect*, const Color&, float, float, float,
- float, float, float, PassRefPtr<LightSource>);
+ FELighting(LightingType, const Color&, float, float, float, float, float, float, PassRefPtr<LightSource>);
bool drawLighting(CanvasPixelArray*, int, int);
ALWAYS_INLINE void setPixel(LightingData&, LightSource::PaintingData&,
int lightX, int lightY, float factorX, int normalX, float factorY, int normalY);
LightingType m_lightingType;
- RefPtr<FilterEffect> m_in;
RefPtr<LightSource> m_lightSource;
Color m_lightingColor;
diff --git a/WebCore/svg/graphics/filters/SVGFEMerge.cpp b/WebCore/svg/graphics/filters/SVGFEMerge.cpp
index 11c7407..e92ce4c 100644
--- a/WebCore/svg/graphics/filters/SVGFEMerge.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEMerge.cpp
@@ -30,46 +30,24 @@
namespace WebCore {
-FEMerge::FEMerge(const Vector<RefPtr<FilterEffect> >& mergeInputs)
+FEMerge::FEMerge()
: FilterEffect()
- , m_mergeInputs(mergeInputs)
{
}
-PassRefPtr<FEMerge> FEMerge::create(const Vector<RefPtr<FilterEffect> >& mergeInputs)
+PassRefPtr<FEMerge> FEMerge::create()
{
- return adoptRef(new FEMerge(mergeInputs));
-}
-
-const Vector<RefPtr<FilterEffect> >& FEMerge::mergeInputs() const
-{
- return m_mergeInputs;
-}
-
-void FEMerge::setMergeInputs(const Vector<RefPtr<FilterEffect> >& mergeInputs)
-{
- m_mergeInputs = mergeInputs;
-}
-
-FloatRect FEMerge::uniteChildEffectSubregions(Filter* filter)
-{
- ASSERT(!m_mergeInputs.isEmpty());
-
- FloatRect uniteEffectRect = m_mergeInputs[0]->calculateEffectRect(filter);
-
- for (unsigned i = 1; i < m_mergeInputs.size(); i++)
- uniteEffectRect.unite(m_mergeInputs[i]->calculateEffectRect(filter));
-
- return uniteEffectRect;
+ return adoptRef(new FEMerge);
}
void FEMerge::apply(Filter* filter)
{
- ASSERT(!m_mergeInputs.isEmpty());
-
- for (unsigned i = 0; i < m_mergeInputs.size(); i++) {
- m_mergeInputs[i]->apply(filter);
- if (!m_mergeInputs[i]->resultImage())
+ unsigned size = numberOfEffectInputs();
+ ASSERT(size > 0);
+ for (unsigned i = 0; i < size; ++i) {
+ FilterEffect* in = inputEffect(i);
+ in->apply(filter);
+ if (!in->resultImage())
return;
}
@@ -77,9 +55,9 @@ void FEMerge::apply(Filter* filter)
if (!filterContext)
return;
- for (unsigned i = 0; i < m_mergeInputs.size(); i++) {
- FloatRect destRect = calculateDrawingRect(m_mergeInputs[i]->scaledSubRegion());
- filterContext->drawImageBuffer(m_mergeInputs[i]->resultImage(), DeviceColorSpace, destRect);
+ for (unsigned i = 0; i < size; ++i) {
+ FilterEffect* in = inputEffect(i);
+ filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates()));
}
}
@@ -92,12 +70,11 @@ TextStream& FEMerge::externalRepresentation(TextStream& ts, int indent) const
writeIndent(ts, indent);
ts << "[feMerge";
FilterEffect::externalRepresentation(ts);
- ts << " mergeNodes=\"" << m_mergeInputs.size() << "\"]\n";
- if (!m_mergeInputs.isEmpty()) {
- const Vector<RefPtr<FilterEffect> >::const_iterator end = m_mergeInputs.end();
- for (Vector<RefPtr<FilterEffect> >::const_iterator it = m_mergeInputs.begin(); it != end; ++it)
- (*it)->externalRepresentation(ts, indent + 1);
- }
+ unsigned size = numberOfEffectInputs();
+ ASSERT(size > 0);
+ ts << " mergeNodes=\"" << size << "\"]\n";
+ for (unsigned i = 0; i < size; ++i)
+ inputEffect(i)->externalRepresentation(ts, indent + 1);
return ts;
}
diff --git a/WebCore/svg/graphics/filters/SVGFEMerge.h b/WebCore/svg/graphics/filters/SVGFEMerge.h
index 66decfc..439d789 100644
--- a/WebCore/svg/graphics/filters/SVGFEMerge.h
+++ b/WebCore/svg/graphics/filters/SVGFEMerge.h
@@ -31,20 +31,14 @@ namespace WebCore {
class FEMerge : public FilterEffect {
public:
- static PassRefPtr<FEMerge> create(const Vector<RefPtr<FilterEffect> >&);
+ static PassRefPtr<FEMerge> create();
- const Vector<RefPtr<FilterEffect> >& mergeInputs() const;
- void setMergeInputs(const Vector<RefPtr<FilterEffect> >& mergeInputs);
-
- virtual FloatRect uniteChildEffectSubregions(Filter*);
void apply(Filter*);
void dump();
TextStream& externalRepresentation(TextStream&, int indent) const;
private:
- FEMerge(const Vector<RefPtr<FilterEffect> >&);
-
- Vector<RefPtr<FilterEffect> > m_mergeInputs;
+ FEMerge();
};
} // namespace WebCore
diff --git a/WebCore/svg/graphics/filters/SVGFEMorphology.cpp b/WebCore/svg/graphics/filters/SVGFEMorphology.cpp
index 3fdf369..6645259 100644
--- a/WebCore/svg/graphics/filters/SVGFEMorphology.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEMorphology.cpp
@@ -37,18 +37,17 @@ using std::max;
namespace WebCore {
-FEMorphology::FEMorphology(FilterEffect* in, MorphologyOperatorType type, float radiusX, float radiusY)
+FEMorphology::FEMorphology(MorphologyOperatorType type, float radiusX, float radiusY)
: FilterEffect()
- , m_in(in)
, m_type(type)
, m_radiusX(radiusX)
, m_radiusY(radiusY)
{
}
-PassRefPtr<FEMorphology> FEMorphology::create(FilterEffect* in, MorphologyOperatorType type, float radiusX, float radiusY)
+PassRefPtr<FEMorphology> FEMorphology::create(MorphologyOperatorType type, float radiusX, float radiusY)
{
- return adoptRef(new FEMorphology(in, type, radiusX, radiusY));
+ return adoptRef(new FEMorphology(type, radiusX, radiusY));
}
MorphologyOperatorType FEMorphology::morphologyOperator() const
@@ -83,14 +82,15 @@ void FEMorphology::setRadiusY(float radiusY)
void FEMorphology::apply(Filter* filter)
{
- m_in->apply(filter);
- if (!m_in->resultImage())
+ FilterEffect* in = inputEffect(0);
+ in->apply(filter);
+ if (!in->resultImage())
return;
-
+
if (!getEffectContext())
return;
- setIsAlphaImage(m_in->isAlphaImage());
+ setIsAlphaImage(in->isAlphaImage());
int radiusX = static_cast<int>(m_radiusX * filter->filterResolution().width());
int radiusY = static_cast<int>(m_radiusY * filter->filterResolution().height());
@@ -98,8 +98,8 @@ void FEMorphology::apply(Filter* filter)
return;
IntRect imageRect(IntPoint(), resultImage()->size());
- IntRect effectDrawingRect = calculateDrawingIntRect(m_in->scaledSubRegion());
- RefPtr<CanvasPixelArray> srcPixelArray(m_in->resultImage()->getPremultipliedImageData(effectDrawingRect)->data());
+ IntRect effectDrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());
+ RefPtr<CanvasPixelArray> srcPixelArray(in->resultImage()->getPremultipliedImageData(effectDrawingRect)->data());
RefPtr<ImageData> imageData = ImageData::create(imageRect.width(), imageRect.height());
int effectWidth = effectDrawingRect.width() * 4;
@@ -179,8 +179,8 @@ TextStream& FEMorphology::externalRepresentation(TextStream& ts, int indent) con
ts << "[feMorphology";
FilterEffect::externalRepresentation(ts);
ts << " operator=\"" << morphologyOperator() << "\" "
- << "radius=\"" << radiusX() << ", " << radiusY() << "\"]\n";
- m_in->externalRepresentation(ts, indent + 1);
+ << "radius=\"" << radiusX() << ", " << radiusY() << "\"]\n";
+ inputEffect(0)->externalRepresentation(ts, indent + 1);
return ts;
}
diff --git a/WebCore/svg/graphics/filters/SVGFEMorphology.h b/WebCore/svg/graphics/filters/SVGFEMorphology.h
index 79f292d..9743d2b 100644
--- a/WebCore/svg/graphics/filters/SVGFEMorphology.h
+++ b/WebCore/svg/graphics/filters/SVGFEMorphology.h
@@ -36,7 +36,7 @@ namespace WebCore {
class FEMorphology : public FilterEffect {
public:
- static PassRefPtr<FEMorphology> create(FilterEffect*, MorphologyOperatorType, float radiusX, float radiusY);
+ static PassRefPtr<FEMorphology> create(MorphologyOperatorType, float radiusX, float radiusY);
MorphologyOperatorType morphologyOperator() const;
void setMorphologyOperator(MorphologyOperatorType);
@@ -46,15 +46,13 @@ namespace WebCore {
float radiusY() const;
void setRadiusY(float);
- virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get()); }
void apply(Filter*);
void dump();
TextStream& externalRepresentation(TextStream&, int indent) const;
private:
- FEMorphology(FilterEffect*, MorphologyOperatorType, float radiusX, float radiusY);
+ FEMorphology(MorphologyOperatorType, float radiusX, float radiusY);
- RefPtr<FilterEffect> m_in;
MorphologyOperatorType m_type;
float m_radiusX;
float m_radiusY;
diff --git a/WebCore/svg/graphics/filters/SVGFEOffset.cpp b/WebCore/svg/graphics/filters/SVGFEOffset.cpp
index e12b8e0..685bd7b 100644
--- a/WebCore/svg/graphics/filters/SVGFEOffset.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEOffset.cpp
@@ -31,17 +31,16 @@
namespace WebCore {
-FEOffset::FEOffset(FilterEffect* in, const float& dx, const float& dy)
+FEOffset::FEOffset(float dx, float dy)
: FilterEffect()
- , m_in(in)
, m_dx(dx)
, m_dy(dy)
{
}
-PassRefPtr<FEOffset> FEOffset::create(FilterEffect* in, const float& dx, const float& dy)
+PassRefPtr<FEOffset> FEOffset::create(float dx, float dy)
{
- return adoptRef(new FEOffset(in, dx, dy));
+ return adoptRef(new FEOffset(dx, dy));
}
float FEOffset::dx() const
@@ -66,15 +65,16 @@ void FEOffset::setDy(float dy)
void FEOffset::apply(Filter* filter)
{
- m_in->apply(filter);
- if (!m_in->resultImage())
+ FilterEffect* in = inputEffect(0);
+ in->apply(filter);
+ if (!in->resultImage())
return;
GraphicsContext* filterContext = getEffectContext();
if (!filterContext)
return;
- setIsAlphaImage(m_in->isAlphaImage());
+ setIsAlphaImage(in->isAlphaImage());
FloatRect sourceImageRect = filter->sourceImageRect();
sourceImageRect.scale(filter->filterResolution().width(), filter->filterResolution().height());
@@ -86,12 +86,12 @@ void FEOffset::apply(Filter* filter)
m_dx *= filter->filterResolution().width();
m_dy *= filter->filterResolution().height();
- FloatRect dstRect = FloatRect(m_dx + m_in->scaledSubRegion().x() - scaledSubRegion().x(),
- m_dy + m_in->scaledSubRegion().y() - scaledSubRegion().y(),
- m_in->scaledSubRegion().width(),
- m_in->scaledSubRegion().height());
+ FloatRect dstRect = FloatRect(m_dx + in->repaintRectInLocalCoordinates().x() - repaintRectInLocalCoordinates().x(),
+ m_dy + in->repaintRectInLocalCoordinates().y() - repaintRectInLocalCoordinates().y(),
+ in->repaintRectInLocalCoordinates().width(),
+ in->repaintRectInLocalCoordinates().height());
- filterContext->drawImageBuffer(m_in->resultImage(), DeviceColorSpace, dstRect);
+ filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, dstRect);
}
void FEOffset::dump()
@@ -104,7 +104,7 @@ TextStream& FEOffset::externalRepresentation(TextStream& ts, int indent) const
ts << "[feOffset";
FilterEffect::externalRepresentation(ts);
ts << " dx=\"" << dx() << "\" dy=\"" << dy() << "\"]\n";
- m_in->externalRepresentation(ts, indent + 1);
+ inputEffect(0)->externalRepresentation(ts, indent + 1);
return ts;
}
diff --git a/WebCore/svg/graphics/filters/SVGFEOffset.h b/WebCore/svg/graphics/filters/SVGFEOffset.h
index ad071d6..34ed97b 100644
--- a/WebCore/svg/graphics/filters/SVGFEOffset.h
+++ b/WebCore/svg/graphics/filters/SVGFEOffset.h
@@ -30,7 +30,7 @@ namespace WebCore {
class FEOffset : public FilterEffect {
public:
- static PassRefPtr<FEOffset> create(FilterEffect*, const float&, const float&);
+ static PassRefPtr<FEOffset> create(float, float);
float dx() const;
void setDx(float);
@@ -38,15 +38,13 @@ namespace WebCore {
float dy() const;
void setDy(float);
- virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get()); }
void apply(Filter*);
void dump();
TextStream& externalRepresentation(TextStream&, int indent) const;
private:
- FEOffset(FilterEffect*, const float&, const float&);
+ FEOffset(float, float);
- RefPtr<FilterEffect> m_in;
float m_dx;
float m_dy;
};
diff --git a/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp b/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp
index 5c6dc2a..33f7b6c 100644
--- a/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp
+++ b/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp
@@ -29,18 +29,18 @@
namespace WebCore {
-FESpecularLighting::FESpecularLighting(FilterEffect* in, const Color& lightingColor, float surfaceScale,
+FESpecularLighting::FESpecularLighting(const Color& lightingColor, float surfaceScale,
float specularConstant, float specularExponent, float kernelUnitLengthX,
float kernelUnitLengthY, PassRefPtr<LightSource> lightSource)
- : FELighting(SpecularLighting, in, lightingColor, surfaceScale, 0.0f, specularConstant, specularExponent, kernelUnitLengthX, kernelUnitLengthY, lightSource)
+ : FELighting(SpecularLighting, lightingColor, surfaceScale, 0, specularConstant, specularExponent, kernelUnitLengthX, kernelUnitLengthY, lightSource)
{
}
-PassRefPtr<FESpecularLighting> FESpecularLighting::create(FilterEffect* in, const Color& lightingColor,
+PassRefPtr<FESpecularLighting> FESpecularLighting::create(const Color& lightingColor,
float surfaceScale, float specularConstant, float specularExponent,
float kernelUnitLengthX, float kernelUnitLengthY, PassRefPtr<LightSource> lightSource)
{
- return adoptRef(new FESpecularLighting(in, lightingColor, surfaceScale, specularConstant, specularExponent,
+ return adoptRef(new FESpecularLighting(lightingColor, surfaceScale, specularConstant, specularExponent,
kernelUnitLengthX, kernelUnitLengthY, lightSource));
}
@@ -130,7 +130,7 @@ TextStream& FESpecularLighting::externalRepresentation(TextStream& ts, int inden
ts << " surfaceScale=\"" << m_surfaceScale << "\" "
<< "specualConstant=\"" << m_specularConstant << "\" "
<< "specularExponent=\"" << m_specularExponent << "\"]\n";
- m_in->externalRepresentation(ts, indent + 1);
+ inputEffect(0)->externalRepresentation(ts, indent + 1);
return ts;
}
diff --git a/WebCore/svg/graphics/filters/SVGFESpecularLighting.h b/WebCore/svg/graphics/filters/SVGFESpecularLighting.h
index 3a49c1e..6067a76 100644
--- a/WebCore/svg/graphics/filters/SVGFESpecularLighting.h
+++ b/WebCore/svg/graphics/filters/SVGFESpecularLighting.h
@@ -29,7 +29,7 @@ namespace WebCore {
class FESpecularLighting : public FELighting {
public:
- static PassRefPtr<FESpecularLighting> create(FilterEffect*, const Color&, float, float,
+ static PassRefPtr<FESpecularLighting> create(const Color&, float, float,
float, float, float, PassRefPtr<LightSource>);
virtual ~FESpecularLighting();
@@ -58,8 +58,7 @@ public:
TextStream& externalRepresentation(TextStream&, int indent) const;
private:
- FESpecularLighting(FilterEffect*, const Color&, float, float, float,
- float, float, PassRefPtr<LightSource>);
+ FESpecularLighting(const Color&, float, float, float, float, float, PassRefPtr<LightSource>);
};
} // namespace WebCore
diff --git a/WebCore/svg/graphics/filters/SVGFETile.cpp b/WebCore/svg/graphics/filters/SVGFETile.cpp
index 56cbc1e..80eb9b3 100644
--- a/WebCore/svg/graphics/filters/SVGFETile.cpp
+++ b/WebCore/svg/graphics/filters/SVGFETile.cpp
@@ -31,40 +31,42 @@
namespace WebCore {
-FETile::FETile(FilterEffect* in)
+FETile::FETile()
: FilterEffect()
- , m_in(in)
{
}
-PassRefPtr<FETile> FETile::create(FilterEffect* in)
+PassRefPtr<FETile> FETile::create()
{
- return adoptRef(new FETile(in));
+ return adoptRef(new FETile);
}
-FloatRect FETile::uniteChildEffectSubregions(Filter* filter)
+FloatRect FETile::determineFilterPrimitiveSubregion(Filter* filter)
{
- m_in->calculateEffectRect(filter);
- return filter->filterRegion();
+ inputEffect(0)->determineFilterPrimitiveSubregion(filter);
+
+ filter->determineFilterPrimitiveSubregion(this, filter->filterRegion());
+ return filterPrimitiveSubregion();
}
void FETile::apply(Filter* filter)
{
- m_in->apply(filter);
- if (!m_in->resultImage())
+ FilterEffect* in = inputEffect(0);
+ in->apply(filter);
+ if (!in->resultImage())
return;
GraphicsContext* filterContext = getEffectContext();
if (!filterContext)
return;
- setIsAlphaImage(m_in->isAlphaImage());
+ setIsAlphaImage(in->isAlphaImage());
- IntRect tileRect = enclosingIntRect(m_in->scaledSubRegion());
+ IntRect tileRect = enclosingIntRect(in->repaintRectInLocalCoordinates());
// Source input needs more attention. It has the size of the filterRegion but gives the
// size of the cutted sourceImage back. This is part of the specification and optimization.
- if (m_in->isSourceInput()) {
+ if (in->isSourceInput()) {
FloatRect filterRegion = filter->filterRegion();
filterRegion.scale(filter->filterResolution().width(), filter->filterResolution().height());
tileRect = enclosingIntRect(filterRegion);
@@ -72,15 +74,16 @@ void FETile::apply(Filter* filter)
OwnPtr<ImageBuffer> tileImage = ImageBuffer::create(tileRect.size());
GraphicsContext* tileImageContext = tileImage->context();
- tileImageContext->drawImageBuffer(m_in->resultImage(), DeviceColorSpace, IntPoint());
+ tileImageContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, IntPoint());
RefPtr<Pattern> pattern = Pattern::create(tileImage->copyImage(), true, true);
AffineTransform matrix;
- matrix.translate(m_in->scaledSubRegion().x() - scaledSubRegion().x(), m_in->scaledSubRegion().y() - scaledSubRegion().y());
+ matrix.translate(in->repaintRectInLocalCoordinates().x() - repaintRectInLocalCoordinates().x(),
+ in->repaintRectInLocalCoordinates().y() - repaintRectInLocalCoordinates().y());
pattern.get()->setPatternSpaceTransform(matrix);
filterContext->setFillPattern(pattern);
- filterContext->fillRect(FloatRect(FloatPoint(), scaledSubRegion().size()));
+ filterContext->fillRect(FloatRect(FloatPoint(), repaintRectInLocalCoordinates().size()));
}
void FETile::dump()
@@ -93,7 +96,7 @@ TextStream& FETile::externalRepresentation(TextStream& ts, int indent) const
ts << "[feTile";
FilterEffect::externalRepresentation(ts);
ts << "]\n";
- m_in->externalRepresentation(ts, indent + 1);
+ inputEffect(0)->externalRepresentation(ts, indent + 1);
return ts;
}
diff --git a/WebCore/svg/graphics/filters/SVGFETile.h b/WebCore/svg/graphics/filters/SVGFETile.h
index 7af9c13..128c9cb 100644
--- a/WebCore/svg/graphics/filters/SVGFETile.h
+++ b/WebCore/svg/graphics/filters/SVGFETile.h
@@ -30,17 +30,16 @@ namespace WebCore {
class FETile : public FilterEffect {
public:
- static PassRefPtr<FETile> create(FilterEffect*);
+ static PassRefPtr<FETile> create();
- virtual FloatRect uniteChildEffectSubregions(Filter*);
void apply(Filter*);
void dump();
TextStream& externalRepresentation(TextStream&, int indent) const;
+
+ virtual FloatRect determineFilterPrimitiveSubregion(Filter*);
private:
- FETile(FilterEffect*);
-
- RefPtr<FilterEffect> m_in;
+ FETile();
};
} // namespace WebCore
diff --git a/WebCore/svg/graphics/filters/SVGFilter.cpp b/WebCore/svg/graphics/filters/SVGFilter.cpp
index 947dbed..d72dc3d 100644
--- a/WebCore/svg/graphics/filters/SVGFilter.cpp
+++ b/WebCore/svg/graphics/filters/SVGFilter.cpp
@@ -24,60 +24,64 @@
namespace WebCore {
-SVGFilter::SVGFilter(const FloatRect& itemBox, const FloatRect& filterRect, bool effectBBoxMode)
+SVGFilter::SVGFilter(const FloatRect& targetBoundingBox, const FloatRect& filterRect, bool effectBBoxMode)
: Filter()
- , m_itemBox(itemBox)
+ , m_targetBoundingBox(targetBoundingBox)
, m_filterRect(filterRect)
, m_effectBBoxMode(effectBBoxMode)
{
}
-void SVGFilter::calculateEffectSubRegion(FilterEffect* effect)
+void SVGFilter::determineFilterPrimitiveSubregion(FilterEffect* effect, const FloatRect& unionOfPreviousPrimitiveSubregions)
{
FloatRect subRegionBBox = effect->effectBoundaries();
- FloatRect useBBox = effect->unionOfChildEffectSubregions();
FloatRect newSubRegion = subRegionBBox;
if (m_effectBBoxMode) {
- newSubRegion = useBBox;
+ newSubRegion = unionOfPreviousPrimitiveSubregions;
if (effect->hasX())
- newSubRegion.setX(m_itemBox.x() + subRegionBBox.x() * m_itemBox.width());
+ newSubRegion.setX(m_targetBoundingBox.x() + subRegionBBox.x() * m_targetBoundingBox.width());
- if (effect->hasY())
- newSubRegion.setY(m_itemBox.y() + subRegionBBox.y() * m_itemBox.height());
+ if (effect->hasY())
+ newSubRegion.setY(m_targetBoundingBox.y() + subRegionBBox.y() * m_targetBoundingBox.height());
if (effect->hasWidth())
- newSubRegion.setWidth(subRegionBBox.width() * m_itemBox.width());
+ newSubRegion.setWidth(subRegionBBox.width() * m_targetBoundingBox.width());
if (effect->hasHeight())
- newSubRegion.setHeight(subRegionBBox.height() * m_itemBox.height());
+ newSubRegion.setHeight(subRegionBBox.height() * m_targetBoundingBox.height());
} else {
if (!effect->hasX())
- newSubRegion.setX(useBBox.x());
+ newSubRegion.setX(unionOfPreviousPrimitiveSubregions.x());
if (!effect->hasY())
- newSubRegion.setY(useBBox.y());
+ newSubRegion.setY(unionOfPreviousPrimitiveSubregions.y());
if (!effect->hasWidth())
- newSubRegion.setWidth(useBBox.width());
+ newSubRegion.setWidth(unionOfPreviousPrimitiveSubregions.width());
if (!effect->hasHeight())
- newSubRegion.setHeight(useBBox.height());
+ newSubRegion.setHeight(unionOfPreviousPrimitiveSubregions.height());
}
// clip every filter effect to the filter region
newSubRegion.intersect(m_filterRect);
- effect->setSubRegion(newSubRegion);
+ effect->setFilterPrimitiveSubregion(newSubRegion);
+
+ // TODO: Everything above should be moved to a first phase of layout in RenderSVGResourceFilterPrimitive.
+ // The scaling of the subregion to the repaint rect should be merged with a more intelligent repaint logic
+ // and moved to the second phase of layout in RenderSVGResourceFilterPrimitive.
+ // See bug https://bugs.webkit.org/show_bug.cgi?id=45614.
newSubRegion.scale(filterResolution().width(), filterResolution().height());
- effect->setScaledSubRegion(newSubRegion);
+ effect->setRepaintRectInLocalCoordinates(newSubRegion);
m_maxImageSize = m_maxImageSize.expandedTo(newSubRegion.size());
}
-PassRefPtr<SVGFilter> SVGFilter::create(const FloatRect& itemBox, const FloatRect& filterRect, bool effectBBoxMode)
+PassRefPtr<SVGFilter> SVGFilter::create(const FloatRect& targetBoundingBox, const FloatRect& filterRect, bool effectBBoxMode)
{
- return adoptRef(new SVGFilter(itemBox, filterRect, effectBBoxMode));
+ return adoptRef(new SVGFilter(targetBoundingBox, filterRect, effectBBoxMode));
}
} // namespace WebCore
diff --git a/WebCore/svg/graphics/filters/SVGFilter.h b/WebCore/svg/graphics/filters/SVGFilter.h
index 1ee5e8a..631f1ee 100644
--- a/WebCore/svg/graphics/filters/SVGFilter.h
+++ b/WebCore/svg/graphics/filters/SVGFilter.h
@@ -39,16 +39,17 @@ namespace WebCore {
virtual bool effectBoundingBoxMode() const { return m_effectBBoxMode; }
virtual FloatRect filterRegion() const { return m_filterRect; }
- virtual FloatRect sourceImageRect() const { return m_itemBox; }
+
+ virtual FloatRect sourceImageRect() const { return m_targetBoundingBox; }
virtual FloatSize maxImageSize() const { return m_maxImageSize; }
- virtual void calculateEffectSubRegion(FilterEffect*);
+ virtual void determineFilterPrimitiveSubregion(FilterEffect*, const FloatRect&);
private:
- SVGFilter(const FloatRect& itemBox, const FloatRect& filterRect, bool effectBBoxMode);
+ SVGFilter(const FloatRect& targetBoundingBox, const FloatRect& filterRect, bool effectBBoxMode);
FloatSize m_maxImageSize;
- FloatRect m_itemBox;
+ FloatRect m_targetBoundingBox;
FloatRect m_filterRect;
bool m_effectBBoxMode;
};