https://bugs.webkit.org/show_bug.cgi?id=72443
url() references can be internal, in which case the DOM nodes are
retrieved directly from the current document, or external, in which
case a CachedSVGDocument request is made, and the filter node build is
deferred until the document is loaded. WebKitSVGDocumentValue
holds the CachedSVGDocument (if any) and the URL as a CSSValue,
and is stored in the CSSValue chain as the argument to the reference
filter.
One notable difference between internal and external references is
that internal references will automatically update on an SVG filter node
attribute change, while external references will not, since they live
in a separate document. This is consistent with the Mozilla
implementation. In order to make this work, the RenderLayer is made a
client of the RenderSVGResourceContainer, and calls
filterNeedsRepaint() when the SVG nodes are invalidated.
Some plumbing: The CSS StyleResolver was refactored to load all
all external resources (images, shaders and (now) SVG filters) in a
single function, loadPendingResources(). The PlatformLayer typedef
was moved out into its own file, in order to break a cyclic
dependency. SVGFilterBuilder was modified to accept the SourceGraphic
and SourceAlpha FilterEffects in its constructor and factory function,
rather than extracting them from the parent Filter. (This is necessary
so that the url() filter can correctly hook up its inputs from
previous CSS filters.)
Reviewed by Dean Jackson.
Tests: css3/filters/effect-reference-external.html
css3/filters/effect-reference-hw.html
css3/filters/effect-reference-ordering.html
css3/filters/effect-reference.html
* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
Add WebKitCSSSVGDocumentValue to the various build files.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::valueForFilter):
Use the reference filter's url when getting the computed style for
a reference filter.
* css/CSSParser.cpp:
(WebCore::CSSParser::parseFilter):
Create the referenceFilterValue's argument as a
WebKitCSSSVGDocumentValue instead of a CSS string.
* css/CSSValue.cpp:
(WebCore::CSSValue::cssText):
Add support for WebKitCSSSVGDocumentValue.
(WebCore::CSSValue::destroy):
Add support for WebKitCSSSVGDocumentValue.
* css/CSSValue.h:
(WebCore::CSSValue::isWebKitCSSSVGDocumentValue):
Add support for WebKitCSSSVGDocumentValue.
* css/StyleResolver.cpp:
(WebCore::StyleResolver::collectMatchingRulesForList):
Keep track of pending SVG document references, and load them when
necessary.
* css/StyleResolver.h:
* css/WebKitCSSSVGDocumentValue.cpp: Added.
New CSSValue subclass for holding SVG document references.
(WebCore::WebKitCSSSVGDocumentValue::WebKitCSSSVGDocumentValue):
(WebCore::WebKitCSSSVGDocumentValue::~WebKitCSSSVGDocumentValue):
(WebCore::WebKitCSSSVGDocumentValue::load):
(WebCore::WebKitCSSSVGDocumentValue::customCssText):
* css/WebKitCSSSVGDocumentValue.h: Added.
(WebCore::WebKitCSSSVGDocumentValue::create):
(WebCore::WebKitCSSSVGDocumentValue::cachedSVGDocument):
(WebCore::WebKitCSSSVGDocumentValue::url):
(WebCore::WebKitCSSSVGDocumentValue::loadRequested):
* platform/graphics/GraphicsLayer.h:
Refactor PlatformLayer out into its own file, to avoid circular
includes.
* platform/graphics/ImageBuffer.h:
Include PlatformLayer.h instead of GraphicsLayer.h.
* platform/graphics/PlatformLayer.h: Added.
Refactor PlatformLayer out into its own file, to avoid circular
includes.
* platform/graphics/filters/FilterOperation.h:
(WebCore::ReferenceFilterOperation::create):
(WebCore::ReferenceFilterOperation::clone):
(WebCore::ReferenceFilterOperation::url):
(WebCore::ReferenceFilterOperation::fragment):
(ReferenceFilterOperation):
(WebCore::ReferenceFilterOperation::data):
(WebCore::ReferenceFilterOperation::setData):
(WebCore::ReferenceFilterOperation::operator==):
(WebCore::ReferenceFilterOperation::ReferenceFilterOperation):
Augment ReferenceFilterOperation to maintain a data pointer,
in order to preserve context while loading external SVG documents.
Replace "reference" with "url" and "fragment" members, in order to
ease retrieval of the appropriate DOM objects.
* platform/graphics/filters/FilterOperations.cpp:
(WebCore::FilterOperations::hasReferenceFilter):
Convenience function for finding reference filters.
* platform/graphics/filters/FilterOperations.h:
(FilterOperations):
* platform/mac/ScrollbarThemeMac.mm:
Include GraphicsLayer.h explicitly, since ImageBuffer.h no longer
includes it (and only includes PlatformLayer.h).
* rendering/FilterEffectRenderer.cpp:
(WebCore::FilterEffectRenderer::buildReferenceFilter):
Utility function to build a FilterEffect node graph for a
ReferenceFilterOperation.
(WebCore::FilterEffectRenderer::build):
Call the above builder function for ReferenceFilterOperations.
* rendering/FilterEffectRenderer.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateOrRemoveFilterEffect):
If we have reference filters, update them along with other filters.
(WebCore::RenderLayer::filterNeedsRepaint):
* rendering/RenderLayerFilterInfo.cpp:
(WebCore::RenderLayerFilterInfo::~RenderLayerFilterInfo):
(WebCore::RenderLayerFilterInfo::notifyFinished):
Implement callback function when external SVGDocuments are loaded.
(WebCore::RenderLayerFilterInfo::updateReferenceFilterClients):
Add the FilterInfo as a client to be called when SVGDocuments are
loaded.
(WebCore::RenderLayerFilterInfo::removeReferenceFilterClients):
Remove this from the list of notified clients.
* rendering/RenderLayerFilterInfo.h:
Add new member vars for tracking internal and external SVG
references, so we can remove ourselves as a client when done.
* rendering/svg/RenderSVGResourceContainer.cpp:
(WebCore::RenderSVGResourceContainer::markAllClientsForInvalidation):
When marking client DOM nodes for repaint, also mark any RenderLayers
referring to this DOM tree via filters as needing repaint.
(WebCore::RenderSVGResourceContainer::addClientRenderLayer):
(WebCore::RenderSVGResourceContainer::removeClientRenderLayer):
* rendering/svg/RenderSVGResourceContainer.h:
Maintain a list of RenderLayer clients on each SVG resource container,
and turn SVG DOM repaint notifications into filter repaint (CSS)
notifications.
* rendering/svg/RenderSVGResourceFilter.cpp:
(WebCore::RenderSVGResourceFilter::buildPrimitives):
Construct a SourceGraphic and SourceAlpha node explicitly for the
SVG builder case.
* svg/graphics/filters/SVGFilterBuilder.cpp:
(WebCore::SVGFilterBuilder::SVGFilterBuilder):
* svg/graphics/filters/SVGFilterBuilder.h:
(WebCore::SVGFilterBuilder::create):
Add the SourceGraphic and SourceAlpha as parameters to the constructor
and create() methods, so they can be supplied by the caller.
LayoutTests: Add tests for the url() filter function.
https://bugs.webkit.org/show_bug.cgi?id=72443
Reviewed by Dean Jackson.
* css3/filters/effect-reference-external.html: Added.
* css3/filters/effect-reference-hw.html: Added.
* css3/filters/effect-reference-ordering.html: Added.
* css3/filters/effect-reference.html: Added.
* css3/filters/resources/hueRotate.svg: Added.
* platform/chromium-linux/css3/filters/effect-reference-expected.png: Added.
* platform/chromium-linux/css3/filters/effect-reference-expected.txt: Added.
* platform/chromium-linux/css3/filters/effect-reference-external-expected.png: Added.
* platform/chromium-linux/css3/filters/effect-reference-external-expected.txt: Added.
* platform/chromium-linux/css3/filters/effect-reference-hw-expected.png: Added.
* platform/chromium-linux/css3/filters/effect-reference-hw-expected.txt: Added.
* platform/chromium-linux/css3/filters/effect-reference-ordering-expected.png: Added.
* platform/chromium-linux/css3/filters/effect-reference-ordering-expected.txt: Added.
* platform/chromium/TestExpectations:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121513
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-06-28 Stephen White <senorblanco@chromium.org>
+
+ Add tests for the url() filter function.
+ https://bugs.webkit.org/show_bug.cgi?id=72443
+
+ Reviewed by Dean Jackson.
+
+ * css3/filters/effect-reference-external.html: Added.
+ * css3/filters/effect-reference-hw.html: Added.
+ * css3/filters/effect-reference-ordering.html: Added.
+ * css3/filters/effect-reference.html: Added.
+ * css3/filters/resources/hueRotate.svg: Added.
+ * platform/chromium-linux/css3/filters/effect-reference-expected.png: Added.
+ * platform/chromium-linux/css3/filters/effect-reference-expected.txt: Added.
+ * platform/chromium-linux/css3/filters/effect-reference-external-expected.png: Added.
+ * platform/chromium-linux/css3/filters/effect-reference-external-expected.txt: Added.
+ * platform/chromium-linux/css3/filters/effect-reference-hw-expected.png: Added.
+ * platform/chromium-linux/css3/filters/effect-reference-hw-expected.txt: Added.
+ * platform/chromium-linux/css3/filters/effect-reference-ordering-expected.png: Added.
+ * platform/chromium-linux/css3/filters/effect-reference-ordering-expected.txt: Added.
+ * platform/chromium/TestExpectations:
+
2012-06-28 Mike Lawther <mikelawther@chromium.org>
Unreviewed gardening.
--- /dev/null
+<style>
+img {
+ margin: 10px;
+}
+</style>
+<img style="-webkit-filter: url(resources/hueRotate.svg#MyFilter); filter: url(resources/hueRotate.svg#MyFilter);" src="resources/reference.png">
--- /dev/null
+<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0" version="1.1">
+ <defs>
+ <filter id="MyFilter">
+ <feColorMatrix type="hueRotate" values="180"/>
+ </filter>
+ </defs>
+</svg>
+<style>
+img {
+ margin: 10px;
+ -webkit-transform: translateZ(0);
+}
+</style>
+<img style="-webkit-filter: url(#MyFilter); filter: url(#MyFilter);" src="resources/reference.png">
--- /dev/null
+<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0" version="1.1">
+ <defs>
+ <filter id="blurX">
+ <feGaussianBlur stdDeviation="5 0"/>
+ </filter>
+ <filter id="blurY">
+ <feGaussianBlur stdDeviation="0 5"/>
+ </filter>
+ </defs>
+</svg>
+<style>
+img {
+ margin: 10px;
+}
+</style>
+<img style="-webkit-filter: url(#blurY);" src="resources/reference.png">
+<img style="-webkit-filter: contrast(500%) url(#blurY);" src="resources/reference.png">
+<img style="-webkit-filter: url(#blurY) contrast(500%);" src="resources/reference.png">
+<img style="-webkit-filter: url(#blurX) contrast(500%); url(#blurY);" src="resources/reference.png">
--- /dev/null
+<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0" version="1.1">
+ <defs>
+ <filter id="MyFilter">
+ <feColorMatrix type="hueRotate" values="180"/>
+ </filter>
+ </defs>
+</svg>
+<style>
+img {
+ margin: 10px;
+}
+</style>
+<img style="-webkit-filter: url(#MyFilter); filter: url(#MyFilter);" src="resources/reference.png">
--- /dev/null
+<svg width="0" height="0" xmlns="http://www.w3.org/2000/svg" version="1.1">
+ <defs>
+ <filter id="MyFilter">
+ <feColorMatrix type="hueRotate" values="180"/>
+ </filter>
+ </defs>
+</svg>
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderSVGRoot {svg} at (8,118) size 0x0
+ RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+ RenderSVGResourceFilter {filter} [id="MyFilter"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+ [feColorMatrix type="HUEROTATE" values="180.00"]
+ [SourceGraphic]
+ RenderText {#text} at (0,95) size 4x19
+ text run at (0,95) width 4: " "
+ RenderText {#text} at (0,0) size 0x0
+ RenderText {#text} at (0,0) size 0x0
+layer at (22,18) size 160x90
+ RenderImage {IMG} at (14,10) size 160x90
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderText {#text} at (0,0) size 0x0
+layer at (18,18) size 160x90
+ RenderImage {IMG} at (10,10) size 160x90
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderSVGRoot {svg} at (8,118) size 0x0
+ RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+ RenderSVGResourceFilter {filter} [id="MyFilter"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+ [feColorMatrix type="HUEROTATE" values="180.00"]
+ [SourceGraphic]
+ RenderText {#text} at (0,95) size 4x19
+ text run at (0,95) width 4: " "
+ RenderText {#text} at (0,0) size 0x0
+ RenderText {#text} at (0,0) size 0x0
+layer at (22,18) size 160x90
+ RenderImage {IMG} at (14,10) size 160x90
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderSVGRoot {svg} at (8,118) size 0x0
+ RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+ RenderSVGResourceFilter {filter} [id="blurX"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+ [feGaussianBlur stdDeviation="5.00, 0.00"]
+ [SourceGraphic]
+ RenderSVGResourceFilter {filter} [id="blurY"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+ [feGaussianBlur stdDeviation="0.00, 5.00"]
+ [SourceGraphic]
+ RenderText {#text} at (0,95) size 4x19
+ text run at (0,95) width 4: " "
+ RenderText {#text} at (0,0) size 0x0
+ RenderText {#text} at (184,95) size 4x19
+ text run at (184,95) width 4: " "
+ RenderText {#text} at (368,95) size 4x19
+ text run at (368,95) width 4: " "
+ RenderText {#text} at (552,95) size 4x19
+ text run at (552,95) width 4: " "
+ RenderText {#text} at (0,0) size 0x0
+layer at (22,18) size 160x90
+ RenderImage {IMG} at (14,10) size 160x90
+layer at (206,18) size 160x90
+ RenderImage {IMG} at (198,10) size 160x90
+layer at (390,18) size 160x90
+ RenderImage {IMG} at (382,10) size 160x90
+layer at (574,18) size 160x90
+ RenderImage {IMG} at (566,10) size 160x90
// Appears to be failing on Skia platforms
BUGWK83199 : svg/filters/big-sized-filter.svg = IMAGE PASS
+// This will need to be rebaselined after
+// https://bugs.webkit.org/show_bug.cgi?id=72443 lands.
+BUG_SENORBLANCO WIN MAC : css3/filters/effect-reference.html = IMAGE IMAGE+TEXT TEXT
+BUG_SENORBLANCO WIN MAC : css3/filters/effect-reference-hw.html = IMAGE IMAGE+TEXT TEXT
+BUG_SENORBLANCO WIN MAC : css3/filters/effect-reference-external.html = IMAGE IMAGE+TEXT TEXT
+BUG_SENORBLANCO WIN MAC : css3/filters/effect-reference-ordering.html = IMAGE IMAGE+TEXT TEXT
+
// Many WIN and Linux SVG tests containing text are flaky. It seems different fonts are used at different times.
BUGWK83303 WIN LINUX : svg/zoom/text/zoom-hixie-mixed-009.xml = PASS IMAGE
BUGWK83303 WIN LINUX : svg/zoom/page/zoom-hixie-mixed-009.xml = PASS IMAGE
css/WebKitCSSKeyframesRule.cpp
css/WebKitCSSMatrix.cpp
css/WebKitCSSRegionRule.cpp
+ css/WebKitCSSSVGDocumentValue.cpp
css/WebKitCSSTransformValue.cpp
dom/ActiveDOMObject.cpp
+2012-06-28 Stephen White <senorblanco@chromium.org>
+
+ Implement filter url() function.
+ https://bugs.webkit.org/show_bug.cgi?id=72443
+
+ url() references can be internal, in which case the DOM nodes are
+ retrieved directly from the current document, or external, in which
+ case a CachedSVGDocument request is made, and the filter node build is
+ deferred until the document is loaded. WebKitSVGDocumentValue
+ holds the CachedSVGDocument (if any) and the URL as a CSSValue,
+ and is stored in the CSSValue chain as the argument to the reference
+ filter.
+
+ One notable difference between internal and external references is
+ that internal references will automatically update on an SVG filter node
+ attribute change, while external references will not, since they live
+ in a separate document. This is consistent with the Mozilla
+ implementation. In order to make this work, the RenderLayer is made a
+ client of the RenderSVGResourceContainer, and calls
+ filterNeedsRepaint() when the SVG nodes are invalidated.
+
+ Some plumbing: The CSS StyleResolver was refactored to load all
+ all external resources (images, shaders and (now) SVG filters) in a
+ single function, loadPendingResources(). The PlatformLayer typedef
+ was moved out into its own file, in order to break a cyclic
+ dependency. SVGFilterBuilder was modified to accept the SourceGraphic
+ and SourceAlpha FilterEffects in its constructor and factory function,
+ rather than extracting them from the parent Filter. (This is necessary
+ so that the url() filter can correctly hook up its inputs from
+ previous CSS filters.)
+
+ Reviewed by Dean Jackson.
+
+ Tests: css3/filters/effect-reference-external.html
+ css3/filters/effect-reference-hw.html
+ css3/filters/effect-reference-ordering.html
+ css3/filters/effect-reference.html
+
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * Target.pri:
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ Add WebKitCSSSVGDocumentValue to the various build files.
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::CSSComputedStyleDeclaration::valueForFilter):
+ Use the reference filter's url when getting the computed style for
+ a reference filter.
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseFilter):
+ Create the referenceFilterValue's argument as a
+ WebKitCSSSVGDocumentValue instead of a CSS string.
+ * css/CSSValue.cpp:
+ (WebCore::CSSValue::cssText):
+ Add support for WebKitCSSSVGDocumentValue.
+ (WebCore::CSSValue::destroy):
+ Add support for WebKitCSSSVGDocumentValue.
+ * css/CSSValue.h:
+ (WebCore::CSSValue::isWebKitCSSSVGDocumentValue):
+ Add support for WebKitCSSSVGDocumentValue.
+ * css/StyleResolver.cpp:
+ (WebCore::StyleResolver::collectMatchingRulesForList):
+ Keep track of pending SVG document references, and load them when
+ necessary.
+ * css/StyleResolver.h:
+ * css/WebKitCSSSVGDocumentValue.cpp: Added.
+ New CSSValue subclass for holding SVG document references.
+ (WebCore::WebKitCSSSVGDocumentValue::WebKitCSSSVGDocumentValue):
+ (WebCore::WebKitCSSSVGDocumentValue::~WebKitCSSSVGDocumentValue):
+ (WebCore::WebKitCSSSVGDocumentValue::load):
+ (WebCore::WebKitCSSSVGDocumentValue::customCssText):
+ * css/WebKitCSSSVGDocumentValue.h: Added.
+ (WebCore::WebKitCSSSVGDocumentValue::create):
+ (WebCore::WebKitCSSSVGDocumentValue::cachedSVGDocument):
+ (WebCore::WebKitCSSSVGDocumentValue::url):
+ (WebCore::WebKitCSSSVGDocumentValue::loadRequested):
+ * platform/graphics/GraphicsLayer.h:
+ Refactor PlatformLayer out into its own file, to avoid circular
+ includes.
+ * platform/graphics/ImageBuffer.h:
+ Include PlatformLayer.h instead of GraphicsLayer.h.
+ * platform/graphics/PlatformLayer.h: Added.
+ Refactor PlatformLayer out into its own file, to avoid circular
+ includes.
+ * platform/graphics/filters/FilterOperation.h:
+ (WebCore::ReferenceFilterOperation::create):
+ (WebCore::ReferenceFilterOperation::clone):
+ (WebCore::ReferenceFilterOperation::url):
+ (WebCore::ReferenceFilterOperation::fragment):
+ (ReferenceFilterOperation):
+ (WebCore::ReferenceFilterOperation::data):
+ (WebCore::ReferenceFilterOperation::setData):
+ (WebCore::ReferenceFilterOperation::operator==):
+ (WebCore::ReferenceFilterOperation::ReferenceFilterOperation):
+ Augment ReferenceFilterOperation to maintain a data pointer,
+ in order to preserve context while loading external SVG documents.
+ Replace "reference" with "url" and "fragment" members, in order to
+ ease retrieval of the appropriate DOM objects.
+ * platform/graphics/filters/FilterOperations.cpp:
+ (WebCore::FilterOperations::hasReferenceFilter):
+ Convenience function for finding reference filters.
+ * platform/graphics/filters/FilterOperations.h:
+ (FilterOperations):
+ * platform/mac/ScrollbarThemeMac.mm:
+ Include GraphicsLayer.h explicitly, since ImageBuffer.h no longer
+ includes it (and only includes PlatformLayer.h).
+ * rendering/FilterEffectRenderer.cpp:
+ (WebCore::FilterEffectRenderer::buildReferenceFilter):
+ Utility function to build a FilterEffect node graph for a
+ ReferenceFilterOperation.
+ (WebCore::FilterEffectRenderer::build):
+ Call the above builder function for ReferenceFilterOperations.
+ * rendering/FilterEffectRenderer.h:
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::updateOrRemoveFilterEffect):
+ If we have reference filters, update them along with other filters.
+ (WebCore::RenderLayer::filterNeedsRepaint):
+ * rendering/RenderLayerFilterInfo.cpp:
+ (WebCore::RenderLayerFilterInfo::~RenderLayerFilterInfo):
+ (WebCore::RenderLayerFilterInfo::notifyFinished):
+ Implement callback function when external SVGDocuments are loaded.
+ (WebCore::RenderLayerFilterInfo::updateReferenceFilterClients):
+ Add the FilterInfo as a client to be called when SVGDocuments are
+ loaded.
+ (WebCore::RenderLayerFilterInfo::removeReferenceFilterClients):
+ Remove this from the list of notified clients.
+ * rendering/RenderLayerFilterInfo.h:
+ Add new member vars for tracking internal and external SVG
+ references, so we can remove ourselves as a client when done.
+ * rendering/svg/RenderSVGResourceContainer.cpp:
+ (WebCore::RenderSVGResourceContainer::markAllClientsForInvalidation):
+ When marking client DOM nodes for repaint, also mark any RenderLayers
+ referring to this DOM tree via filters as needing repaint.
+ (WebCore::RenderSVGResourceContainer::addClientRenderLayer):
+ (WebCore::RenderSVGResourceContainer::removeClientRenderLayer):
+ * rendering/svg/RenderSVGResourceContainer.h:
+ Maintain a list of RenderLayer clients on each SVG resource container,
+ and turn SVG DOM repaint notifications into filter repaint (CSS)
+ notifications.
+ * rendering/svg/RenderSVGResourceFilter.cpp:
+ (WebCore::RenderSVGResourceFilter::buildPrimitives):
+ Construct a SourceGraphic and SourceAlpha node explicitly for the
+ SVG builder case.
+ * svg/graphics/filters/SVGFilterBuilder.cpp:
+ (WebCore::SVGFilterBuilder::SVGFilterBuilder):
+ * svg/graphics/filters/SVGFilterBuilder.h:
+ (WebCore::SVGFilterBuilder::create):
+ Add the SourceGraphic and SourceAlpha as parameters to the constructor
+ and create() methods, so they can be supplied by the caller.
+
2012-06-28 Kenichi Ishibashi <bashi@chromium.org>
[Chromium] CTFontCopyTable of MacOSX10.5 SDK doesn't work for layout tables
Source/WebCore/css/WebKitCSSMatrix.h \
Source/WebCore/css/WebKitCSSRegionRule.cpp \
Source/WebCore/css/WebKitCSSRegionRule.h \
+ Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp \
+ Source/WebCore/css/WebKitCSSSVGDocumentValue.h \
Source/WebCore/css/WebKitCSSShaderValue.cpp \
Source/WebCore/css/WebKitCSSShaderValue.h \
Source/WebCore/css/WebKitCSSTransformValue.cpp \
Source/WebCore/platform/graphics/PathTraversalState.h \
Source/WebCore/platform/graphics/Pattern.cpp \
Source/WebCore/platform/graphics/Pattern.h \
+ Source/WebCore/platform/graphics/PlatformLayer.h \
Source/WebCore/platform/graphics/Region.cpp \
Source/WebCore/platform/graphics/Region.h \
Source/WebCore/platform/graphics/RoundedRect.cpp \
css/WebKitCSSKeyframesRule.cpp \
css/WebKitCSSMatrix.cpp \
css/WebKitCSSRegionRule.cpp \
+ css/WebKitCSSSVGDocumentValue.cpp \
css/WebKitCSSShaderValue.cpp \
css/WebKitCSSTransformValue.cpp \
dom/ActiveDOMObject.cpp \
css/WebKitCSSKeyframesRule.h \
css/WebKitCSSMatrix.h \
css/WebKitCSSRegionRule.h \
+ css/WebKitCSSSVGDocumentValue.h \
css/WebKitCSSShaderValue.h \
css/WebKitCSSTransformValue.h \
dom/ActiveDOMObject.h \
platform/graphics/Path.h \
platform/graphics/PathTraversalState.h \
platform/graphics/Pattern.h \
+ platform/graphics/PlatformLayer.h \
platform/graphics/Region.h \
platform/graphics/RoundedRect.h \
platform/graphics/qt/FontCustomPlatformData.h \
'platform/graphics/MediaPlayer.h',
'platform/graphics/Path.h',
'platform/graphics/Pattern.h',
+ 'platform/graphics/PlatformLayer.h',
'platform/graphics/Region.h',
'platform/graphics/RoundedRect.h',
'platform/graphics/SimpleFontData.h',
'css/WebKitCSSRegionRule.h',
'css/WebKitCSSShaderValue.cpp',
'css/WebKitCSSShaderValue.h',
+ 'css/WebKitCSSSVGDocumentValue.cpp',
+ 'css/WebKitCSSSVGDocumentValue.h',
'css/WebKitCSSTransformValue.cpp',
'editing/AlternativeTextController.cpp',
'editing/AlternativeTextController.h',
>
</File>
<File
+ RelativePath="..\platform\graphics\PlatformLayer.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\graphics\Region.cpp"
>
</File>
>
</File>
<File
- RelativePath="..\css\WebKitCSSShaderValue.cpp"
+ RelativePath="..\css\WebKitCSSSVGDocumentValue.cpp"
>
</File>
<File
- RelativePath="..\css\WebKitCSSShaderValue.h"
+ RelativePath="..\css\WebKitCSSSVGDocumentValue.h"
+ >
+ </File>
+ <File
+ RelativePath="..\css\WebKitCSSShaderValue.cpp"
>
</File>
<File
033A6A83147E08A600509B36 /* JSHTMLPropertiesCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 033A6A82147E08A600509B36 /* JSHTMLPropertiesCollection.h */; };
052BFCE9128ABF1500FD338D /* GeolocationClientMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 052BFCE8128ABF1500FD338D /* GeolocationClientMock.cpp */; };
052BFCEB128ABF2100FD338D /* GeolocationClientMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 052BFCEA128ABF2100FD338D /* GeolocationClientMock.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 0562F9461573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0562F9441573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.cpp */; };
+ 0562F9471573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 0562F9451573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h */; };
+ 0562F9611573F88F0031CA16 /* PlatformLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0562F9601573F88F0031CA16 /* PlatformLayer.h */; settings = {ATTRIBUTES = (Private, ); }; };
05FD69E012845D4300B2BEB3 /* DOMTimeStamp.h in Headers */ = {isa = PBXBuildFile; fileRef = 05FD69DF12845D4300B2BEB3 /* DOMTimeStamp.h */; settings = {ATTRIBUTES = (Private, ); }; };
06027CAD0B1CBFC000884B2D /* ContextMenuItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 06027CAC0B1CBFC000884B2D /* ContextMenuItem.h */; settings = {ATTRIBUTES = (Private, ); }; };
06027CB30B1CC03D00884B2D /* ContextMenuItemMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 06027CB20B1CC03D00884B2D /* ContextMenuItemMac.mm */; };
A0EE0DF7144F825500F80B0D /* WebGLDebugShaders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0EE0DF3144F825500F80B0D /* WebGLDebugShaders.cpp */; };
A0EE0DF8144F825500F80B0D /* WebGLDebugShaders.h in Headers */ = {isa = PBXBuildFile; fileRef = A0EE0DF4144F825500F80B0D /* WebGLDebugShaders.h */; };
A104F24314C71F7A009E2C23 /* CachedSVGDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A104F24114C71F7A009E2C23 /* CachedSVGDocument.cpp */; };
- A104F24414C71F7A009E2C23 /* CachedSVGDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = A104F24214C71F7A009E2C23 /* CachedSVGDocument.h */; };
+ A104F24414C71F7A009E2C23 /* CachedSVGDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = A104F24214C71F7A009E2C23 /* CachedSVGDocument.h */; settings = {ATTRIBUTES = (Private, ); }; };
A10BB5851484E3A700B2E87A /* RenderSVGRect.h in Headers */ = {isa = PBXBuildFile; fileRef = A10BB5831484E3A700B2E87A /* RenderSVGRect.h */; };
A10BB58B1484E3B300B2E87A /* RenderSVGShape.h in Headers */ = {isa = PBXBuildFile; fileRef = A10BB5891484E3B300B2E87A /* RenderSVGShape.h */; };
A10DC76A14747BAB005E2471 /* StyleGridData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A10DC76814747BAB005E2471 /* StyleGridData.cpp */; };
B22279B00D00BF220071B782 /* SVGDescElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B222781A0D00BF1F0071B782 /* SVGDescElement.cpp */; };
B22279B10D00BF220071B782 /* SVGDescElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B222781B0D00BF1F0071B782 /* SVGDescElement.h */; };
B22279B30D00BF220071B782 /* SVGDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B222781D0D00BF1F0071B782 /* SVGDocument.cpp */; };
- B22279B40D00BF220071B782 /* SVGDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = B222781E0D00BF1F0071B782 /* SVGDocument.h */; };
+ B22279B40D00BF220071B782 /* SVGDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = B222781E0D00BF1F0071B782 /* SVGDocument.h */; settings = {ATTRIBUTES = (Private, ); }; };
B22279B60D00BF220071B782 /* SVGElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22278200D00BF1F0071B782 /* SVGElement.cpp */; };
B22279B70D00BF220071B782 /* SVGElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278210D00BF1F0071B782 /* SVGElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
B22279B90D00BF220071B782 /* SVGElementInstance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22278230D00BF1F0071B782 /* SVGElementInstance.cpp */; };
033A6A82147E08A600509B36 /* JSHTMLPropertiesCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLPropertiesCollection.h; sourceTree = "<group>"; };
052BFCE8128ABF1500FD338D /* GeolocationClientMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GeolocationClientMock.cpp; path = mock/GeolocationClientMock.cpp; sourceTree = "<group>"; };
052BFCEA128ABF2100FD338D /* GeolocationClientMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GeolocationClientMock.h; path = mock/GeolocationClientMock.h; sourceTree = "<group>"; };
+ 0562F9441573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSSVGDocumentValue.cpp; sourceTree = "<group>"; };
+ 0562F9451573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitCSSSVGDocumentValue.h; sourceTree = "<group>"; };
+ 0562F9601573F88F0031CA16 /* PlatformLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformLayer.h; sourceTree = "<group>"; };
05FD69DF12845D4300B2BEB3 /* DOMTimeStamp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMTimeStamp.h; sourceTree = "<group>"; };
06027CAC0B1CBFC000884B2D /* ContextMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ContextMenuItem.h; sourceTree = "<group>"; };
06027CB20B1CC03D00884B2D /* ContextMenuItemMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = ContextMenuItemMac.mm; sourceTree = "<group>"; };
B2A015910AF6CD53006BCE0E /* graphics */ = {
isa = PBXGroup;
children = (
+ 0562F9601573F88F0031CA16 /* PlatformLayer.h */,
076F0D0812B8192700C26AA4 /* avfoundation */,
499B3EC0128CCC1800E726C2 /* ca */,
B27535290B053814002CE64F /* cg */,
8AA61CFD144D595B00F37350 /* WebKitCSSRegionRule.cpp */,
8AA61CFE144D595B00F37350 /* WebKitCSSRegionRule.h */,
8AD0A55614C87425000D83C5 /* WebKitCSSRegionRule.idl */,
+ 0562F9441573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.cpp */,
+ 0562F9451573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h */,
5038BC0614711CDB0095E0D1 /* WebKitCSSShaderValue.cpp */,
50B42157146976960087E604 /* WebKitCSSShaderValue.h */,
BC9ADD7F0CC4092200098C4C /* WebKitCSSTransformValue.cpp */,
A723F77B1484CA4C008C6DBE /* PlatformExportMacros.h in Headers */,
BC9585E112F0989500755821 /* PlatformGestureEvent.h in Headers */,
935C476809AC4D4300A6AAB4 /* PlatformKeyboardEvent.h in Headers */,
+ 0562F9611573F88F0031CA16 /* PlatformLayer.h in Headers */,
932871C00B20DEB70049035A /* PlatformMenuDescription.h in Headers */,
41BF70100FE86F61005E8DEC /* PlatformMessagePortChannel.h in Headers */,
935C476909AC4D4300A6AAB4 /* PlatformMouseEvent.h in Headers */,
31288E750E3005D6003619AE /* WebKitCSSKeyframesRule.h in Headers */,
498391590F1E776900C23782 /* WebKitCSSMatrix.h in Headers */,
8AA61D00144D595B00F37350 /* WebKitCSSRegionRule.h in Headers */,
+ 0562F9471573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h in Headers */,
29CD61DE146D02890068E82A /* WebKitCSSShaderValue.h in Headers */,
BC9ADD230CC4032600098C4C /* WebKitCSSTransformValue.h in Headers */,
89878566122CA064003AABDA /* WebKitFlags.h in Headers */,
498391580F1E776900C23782 /* WebKitCSSMatrix.cpp in Sources */,
8AA61CFF144D595B00F37350 /* WebKitCSSRegionRule.cpp in Sources */,
5038BC0714711CDB0095E0D1 /* WebKitCSSShaderValue.cpp in Sources */,
+ 0562F9461573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.cpp in Sources */,
BC9ADD800CC4092200098C4C /* WebKitCSSTransformValue.cpp in Sources */,
1A1414B513A0F0500019996C /* WebKitFontFamilyNames.cpp in Sources */,
C6F0900E14327B6100685849 /* WebKitMutationObserver.cpp in Sources */,
case FilterOperation::REFERENCE: {
ReferenceFilterOperation* referenceOperation = static_cast<ReferenceFilterOperation*>(filterOperation);
filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::ReferenceFilterOperation);
- filterValue->append(cssValuePool().createValue(referenceOperation->reference(), CSSPrimitiveValue::CSS_STRING));
+ filterValue->append(cssValuePool().createValue(referenceOperation->url(), CSSPrimitiveValue::CSS_STRING));
break;
}
case FilterOperation::GRAYSCALE: {
#if ENABLE(CSS_FILTERS)
#include "WebKitCSSFilterValue.h"
+#if ENABLE(SVG)
+#include "WebKitCSSSVGDocumentValue.h"
+#endif
#endif
#if ENABLE(CSS_SHADERS)
// See if the specified primitive is one we understand.
if (value->unit == CSSPrimitiveValue::CSS_URI) {
+#if ENABLE(SVG)
RefPtr<WebKitCSSFilterValue> referenceFilterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::ReferenceFilterOperation);
list->append(referenceFilterValue);
- referenceFilterValue->append(cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_STRING));
+ referenceFilterValue->append(WebKitCSSSVGDocumentValue::create(value->string));
+#endif
} else {
const CSSParserString name = value->function->name;
unsigned maximumArgumentCount = 1;
#include "WebKitCSSShaderValue.h"
#include "WebKitCSSTransformValue.h"
+#if ENABLE(SVG)
+#include "WebKitCSSSVGDocumentValue.h"
+#endif
+
namespace WebCore {
struct SameSizeAsCSSValue : public RefCounted<SameSizeAsCSSValue> {
return static_cast<const SVGColor*>(this)->customCssText();
case SVGPaintClass:
return static_cast<const SVGPaint*>(this)->customCssText();
+ case WebKitCSSSVGDocumentClass:
+ return static_cast<const WebKitCSSSVGDocumentValue*>(this)->customCssText();
#endif
}
ASSERT_NOT_REACHED();
case SVGPaintClass:
delete static_cast<SVGPaint*>(this);
return;
+ case WebKitCSSSVGDocumentClass:
+ delete static_cast<WebKitCSSSVGDocumentValue*>(this);
+ return;
#endif
}
ASSERT_NOT_REACHED();
#if ENABLE(SVG)
bool isSVGColor() const { return m_classType == SVGColorClass || m_classType == SVGPaintClass; }
bool isSVGPaint() const { return m_classType == SVGPaintClass; }
+ bool isWebKitCSSSVGDocumentValue() const { return m_classType == WebKitCSSSVGDocumentClass; }
#endif
bool isCSSOMSafe() const { return m_isCSSOMSafe; }
#if ENABLE(SVG)
SVGColorClass,
SVGPaintClass,
+ WebKitCSSSVGDocumentClass,
#endif
// List class types must appear after ValueListClass.
#endif
#if ENABLE(SVG)
+#include "CachedSVGDocument.h"
+#include "SVGDocument.h"
#include "SVGElement.h"
#include "SVGNames.h"
+#include "SVGURIReference.h"
+#include "WebKitCSSSVGDocumentValue.h"
#endif
#if ENABLE(CSS_SHADERS)
// go ahead and update it a second time.
updateFont();
- // Start loading images referenced by this style.
- loadPendingImages();
+ // Start loading resources referenced by this style.
+ loadPendingResources();
-#if ENABLE(CSS_SHADERS)
- // Start loading the shaders referenced by this style.
- loadPendingShaders();
-#endif
-
// Add all the animating properties to the keyframe.
if (StylePropertySet* styleDeclaration = keyframe->properties()) {
unsigned propertyCount = styleDeclaration->propertyCount();
// Clean up our style object's display and text decorations (among other fixups).
adjustRenderStyle(style(), parentStyle, 0);
- // Start loading images referenced by this style.
- loadPendingImages();
-
-#if ENABLE(CSS_SHADERS)
- // Start loading the shaders referenced by this style.
- loadPendingShaders();
-#endif
+ // Start loading resources referenced by this style.
+ loadPendingResources();
// Now return the style.
return m_style.release();
applyMatchedProperties<LowPriorityProperties>(result, false, 0, result.matchedProperties.size() - 1, inheritedOnly);
- // Start loading images referenced by this style.
- loadPendingImages();
-
-#if ENABLE(CSS_SHADERS)
- // Start loading the shaders referenced by this style.
- loadPendingShaders();
-#endif
+ // Start loading resources referenced by this style.
+ loadPendingResources();
// Now return the style.
return m_style.release();
applyMatchedProperties<LowPriorityProperties>(matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly);
applyMatchedProperties<LowPriorityProperties>(matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly);
applyMatchedProperties<LowPriorityProperties>(matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
-
- loadPendingImages();
-
-#if ENABLE(CSS_SHADERS)
- loadPendingShaders();
-#endif
+
+ // Start loading resources referenced by this style.
+ loadPendingResources();
ASSERT(!m_fontDirty);
return FilterOperation::NONE;
}
+#if ENABLE(CSS_FILTERS) && ENABLE(SVG)
+void StyleResolver::loadPendingSVGDocuments()
+{
+ if (!m_style->hasFilter() || m_pendingSVGDocuments.isEmpty())
+ return;
+
+ CachedResourceLoader* cachedResourceLoader = m_element->document()->cachedResourceLoader();
+ Vector<RefPtr<FilterOperation> >& filterOperations = m_style->filter().operations();
+ for (unsigned i = 0; i < filterOperations.size(); ++i) {
+ RefPtr<FilterOperation> filterOperation = filterOperations.at(i);
+ if (filterOperation->getOperationType() == FilterOperation::REFERENCE) {
+ ReferenceFilterOperation* referenceFilter = static_cast<ReferenceFilterOperation*>(filterOperation.get());
+
+ WebKitCSSSVGDocumentValue* value = m_pendingSVGDocuments.get(referenceFilter);
+ if (!value)
+ continue;
+ CachedSVGDocument* cachedDocument = value->load(cachedResourceLoader);
+ if (!cachedDocument)
+ continue;
+
+ // Stash the CachedSVGDocument on the reference filter.
+ referenceFilter->setData(cachedDocument);
+ }
+ }
+ m_pendingSVGDocuments.clear();
+}
+#endif
+
#if ENABLE(CSS_SHADERS)
StyleShader* StyleResolver::styleShader(CSSValue* value)
{
continue;
}
#endif
+ if (operationType == FilterOperation::REFERENCE) {
+#if ENABLE(SVG)
+ if (filterValue->length() != 1)
+ continue;
+ CSSValue* argument = filterValue->itemWithoutBoundsCheck(0);
+
+ if (!argument->isWebKitCSSSVGDocumentValue())
+ continue;
+
+ WebKitCSSSVGDocumentValue* svgDocumentValue = static_cast<WebKitCSSSVGDocumentValue*>(argument);
+ KURL url = m_element->document()->completeURL(svgDocumentValue->url());
+
+ RefPtr<ReferenceFilterOperation> operation = ReferenceFilterOperation::create(svgDocumentValue->url(), url.fragmentIdentifier(), operationType);
+ if (SVGURIReference::isExternalURIReference(svgDocumentValue->url(), m_element->document())) {
+ if (!svgDocumentValue->loadRequested())
+ m_pendingSVGDocuments.set(operation.get(), svgDocumentValue);
+ else
+ operation->setData(svgDocumentValue->cachedSVGDocument());
+ }
+ operations.operations().append(operation);
+#endif
+ continue;
+ }
// Check that all parameters are primitive values, with the
// exception of drop shadow which has a ShadowValue parameter.
CSSPrimitiveValue* firstValue = filterValue->length() ? static_cast<CSSPrimitiveValue*>(filterValue->itemWithoutBoundsCheck(0)) : 0;
switch (filterValue->operationType()) {
- case WebKitCSSFilterValue::ReferenceFilterOperation: {
- if (firstValue)
- operations.operations().append(ReferenceFilterOperation::create(firstValue->getStringValue(), operationType));
- break;
- }
case WebKitCSSFilterValue::GrayscaleFilterOperation:
case WebKitCSSFilterValue::SepiaFilterOperation:
case WebKitCSSFilterValue::SaturateFilterOperation: {
m_pendingImageProperties.clear();
}
+void StyleResolver::loadPendingResources()
+{
+ // Start loading images referenced by this style.
+ loadPendingImages();
+
+#if ENABLE(CSS_SHADERS)
+ // Start loading the shaders referenced by this style.
+ loadPendingShaders();
+#endif
+
+#if ENABLE(CSS_FILTERS) && ENABLE(SVG)
+ // Start loading the SVG Documents referenced by this style.
+ loadPendingSVGDocuments();
+#endif
+}
+
} // namespace WebCore
class StyledElement;
class WebKitCSSFilterValue;
class WebKitCSSShaderValue;
+class WebKitCSSSVGDocumentValue;
#if ENABLE(CSS_SHADERS)
typedef Vector<RefPtr<CustomFilterParameter> > CustomFilterParameterList;
PassRefPtr<CustomFilterOperation> createCustomFilterOperation(WebKitCSSFilterValue*);
void loadPendingShaders();
#endif
+#if ENABLE(SVG)
+ void loadPendingSVGDocuments();
+#endif
#endif // ENABLE(CSS_FILTERS)
+ void loadPendingResources();
+
struct RuleFeature {
RuleFeature(StyleRule* rule, CSSSelector* selector, bool hasDocumentSecurityOrigin)
: rule(rule)
bool m_hasPendingShaders;
#endif
+#if ENABLE(CSS_FILTERS) && ENABLE(SVG)
+ HashMap<FilterOperation*, WebKitCSSSVGDocumentValue*> m_pendingSVGDocuments;
+#endif
+
#if ENABLE(STYLE_SCOPED)
const ContainerNode* determineScope(const CSSStyleSheet*);
--- /dev/null
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(SVG)
+#include "WebKitCSSSVGDocumentValue.h"
+
+#include "CSSParser.h"
+#include "CachedResourceLoader.h"
+#include "Document.h"
+
+namespace WebCore {
+
+WebKitCSSSVGDocumentValue::WebKitCSSSVGDocumentValue(const String& url)
+ : CSSValue(WebKitCSSSVGDocumentClass)
+ , m_url(url)
+ , m_loadRequested(false)
+{
+}
+
+WebKitCSSSVGDocumentValue::~WebKitCSSSVGDocumentValue()
+{
+}
+
+CachedSVGDocument* WebKitCSSSVGDocumentValue::load(CachedResourceLoader* loader)
+{
+ ASSERT(loader);
+
+ if (!m_loadRequested) {
+ m_loadRequested = true;
+
+ ResourceRequest request(loader->document()->completeURL(m_url));
+ m_document = loader->requestSVGDocument(request);
+ }
+
+ return m_document.get();
+}
+
+String WebKitCSSSVGDocumentValue::customCssText() const
+{
+ return quoteCSSStringIfNeeded(m_url);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
--- /dev/null
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebKitCSSSVGDocumentValue_h
+#define WebKitCSSSVGDocumentValue_h
+
+#include "CSSValue.h"
+#include "CachedResourceHandle.h"
+#include "CachedSVGDocument.h"
+
+namespace WebCore {
+
+class CachedResourceLoader;
+
+class WebKitCSSSVGDocumentValue : public CSSValue {
+public:
+ static PassRefPtr<WebKitCSSSVGDocumentValue> create(const String& url) { return adoptRef(new WebKitCSSSVGDocumentValue(url)); }
+ ~WebKitCSSSVGDocumentValue();
+
+ CachedSVGDocument* cachedSVGDocument() const { return m_document.get(); }
+ CachedSVGDocument* load(CachedResourceLoader*);
+
+ String customCssText() const;
+ const String& url() const { return m_url; }
+ bool loadRequested() const { return m_loadRequested; }
+
+private:
+ WebKitCSSSVGDocumentValue(const String& url);
+
+ String m_url;
+ CachedResourceHandle<CachedSVGDocument> m_document;
+ bool m_loadRequested;
+};
+
+} // namespace WebCore
+
+#endif // WebKitCSSSVGDocumentValue_h
#include "FloatSize.h"
#include "GraphicsLayerClient.h"
#include "IntRect.h"
+#include "PlatformLayer.h"
#include "TransformationMatrix.h"
#include "TransformOperations.h"
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
-#if PLATFORM(MAC)
-OBJC_CLASS CALayer;
-typedef CALayer PlatformLayer;
-#elif PLATFORM(WIN)
-typedef struct _CACFLayer PlatformLayer;
-#elif PLATFORM(QT)
-#if USE(TEXTURE_MAPPER)
-namespace WebCore {
-class TextureMapperPlatformLayer;
-typedef TextureMapperPlatformLayer PlatformLayer;
-};
-#else
-QT_BEGIN_NAMESPACE
-class QGraphicsObject;
-QT_END_NAMESPACE
-namespace WebCore {
-typedef QGraphicsObject PlatformLayer;
-}
-#endif
-#elif PLATFORM(CHROMIUM)
-namespace WebCore {
-class LayerChromium;
-typedef LayerChromium PlatformLayer;
-}
-#elif PLATFORM(GTK)
-#if USE(TEXTURE_MAPPER_CAIRO) || USE(TEXTURE_MAPPER_GL)
-namespace WebCore {
-class TextureMapperPlatformLayer;
-typedef TextureMapperPlatformLayer PlatformLayer;
-};
-#elif USE(CLUTTER)
-typedef struct _ClutterActor ClutterActor;
-namespace WebCore {
-typedef ClutterActor PlatformLayer;
-};
-#endif
-#else
-typedef void* PlatformLayer;
-#endif
-
enum LayerTreeAsTextBehaviorFlags {
LayerTreeAsTextBehaviorNormal = 0,
LayerTreeAsTextDebug = 1 << 0, // Dump extra debugging info like layer addresses.
#include "FloatRect.h"
#include "GraphicsContext.h"
#if USE(ACCELERATED_COMPOSITING)
-#include "GraphicsLayer.h"
+#include "PlatformLayer.h"
#endif
#include "GraphicsTypes.h"
#include "GraphicsTypes3D.h"
--- /dev/null
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PlatformLayer_h
+#define PlatformLayer_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#if PLATFORM(MAC)
+OBJC_CLASS CALayer;
+typedef CALayer PlatformLayer;
+#elif PLATFORM(WIN)
+typedef struct _CACFLayer PlatformLayer;
+#elif PLATFORM(QT)
+#if USE(TEXTURE_MAPPER)
+namespace WebCore {
+class TextureMapperPlatformLayer;
+typedef TextureMapperPlatformLayer PlatformLayer;
+};
+#else
+QT_BEGIN_NAMESPACE
+class QGraphicsObject;
+QT_END_NAMESPACE
+namespace WebCore {
+typedef QGraphicsObject PlatformLayer;
+}
+#endif
+#elif PLATFORM(CHROMIUM)
+namespace WebCore {
+class LayerChromium;
+typedef LayerChromium PlatformLayer;
+}
+#elif PLATFORM(GTK)
+#if USE(TEXTURE_MAPPER_CAIRO) || USE(TEXTURE_MAPPER_GL)
+namespace WebCore {
+class TextureMapperPlatformLayer;
+typedef TextureMapperPlatformLayer PlatformLayer;
+};
+#elif USE(CLUTTER)
+typedef struct _ClutterActor ClutterActor;
+namespace WebCore {
+typedef ClutterActor PlatformLayer;
+};
+#endif
+#else
+typedef void* PlatformLayer;
+#endif
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif // PlatformLayer_h
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/RefCounted.h>
-#include <wtf/text/AtomicString.h>
+#include <wtf/text/WTFString.h>
// Annoyingly, wingdi.h #defines this.
#ifdef PASSTHROUGH
class ReferenceFilterOperation : public FilterOperation {
public:
- static PassRefPtr<ReferenceFilterOperation> create(const AtomicString& reference, OperationType type)
+ static PassRefPtr<ReferenceFilterOperation> create(const String& url, const String& fragment, OperationType type)
{
- return adoptRef(new ReferenceFilterOperation(reference, type));
+ return adoptRef(new ReferenceFilterOperation(url, fragment, type));
}
virtual PassRefPtr<FilterOperation> clone() const
{
- // AtomicString is thread-hostile, so we can't be cloned.
+ // Unimplemented
return 0;
}
virtual bool affectsOpacity() const { return true; }
virtual bool movesPixels() const { return true; }
- const AtomicString& reference() const { return m_reference; }
+ const String& url() const { return m_url; }
+ const String& fragment() const { return m_fragment; }
+
+ void* data() const { return m_data; }
+ void setData(void* data) { m_data = data; }
private:
if (!isSameType(o))
return false;
const ReferenceFilterOperation* other = static_cast<const ReferenceFilterOperation*>(&o);
- return m_reference == other->m_reference;
+ return m_url == other->m_url;
}
- ReferenceFilterOperation(const AtomicString& reference, OperationType type)
+ ReferenceFilterOperation(const String& url, const String& fragment, OperationType type)
: FilterOperation(type)
- , m_reference(reference)
+ , m_url(url)
+ , m_fragment(fragment)
+ , m_data(0)
{
}
- AtomicString m_reference;
+ String m_url;
+ String m_fragment;
+ void* m_data;
};
// GRAYSCALE, SEPIA, SATURATE and HUE_ROTATE are variations on a basic color matrix effect.
}
#endif
+bool FilterOperations::hasReferenceFilter() const
+{
+ for (size_t i = 0; i < m_operations.size(); ++i) {
+ if (m_operations.at(i)->getOperationType() == FilterOperation::REFERENCE)
+ return true;
+ }
+ return false;
+}
+
bool FilterOperations::hasOutsets() const
{
for (size_t i = 0; i < m_operations.size(); ++i) {
#if ENABLE(CSS_SHADERS)
bool hasCustomFilter() const;
#endif
+ bool hasReferenceFilter() const;
private:
Vector<RefPtr<FilterOperation> > m_operations;
};
#include "ScrollbarThemeMac.h"
#include "ImageBuffer.h"
+#include "GraphicsLayer.h"
#include "LocalCurrentGraphicsContext.h"
#include "NSScrollerImpDetails.h"
#include "PlatformMouseEvent.h"
#include "Settings.h"
#endif
+#if ENABLE(SVG)
+#include "CachedSVGDocument.h"
+#include "SVGElement.h"
+#include "SVGFilterPrimitiveStandardAttributes.h"
+#include "SourceAlpha.h"
+#endif
+
namespace WebCore {
static inline void endMatrixRow(Vector<float>& parameters)
return sourceImage() ? sourceImage()->context() : 0;
}
+PassRefPtr<FilterEffect> FilterEffectRenderer::buildReferenceFilter(Document* document, PassRefPtr<FilterEffect> previousEffect, ReferenceFilterOperation* op)
+{
+#if ENABLE(SVG)
+ CachedSVGDocument* cachedSVGDocument = static_cast<CachedSVGDocument*>(op->data());
+
+ // If we have an SVG document, this is an external reference. Otherwise
+ // we look up the referenced node in the current document.
+ if (cachedSVGDocument)
+ document = cachedSVGDocument->document();
+
+ if (!document)
+ return 0;
+
+ Element* filter = document->getElementById(op->fragment());
+ if (!filter)
+ return 0;
+
+ RefPtr<FilterEffect> effect;
+
+ // FIXME: Figure out what to do with SourceAlpha. Right now, we're
+ // using the alpha of the original input layer, which is obviously
+ // wrong. We should probably be extracting the alpha from the
+ // previousEffect, but this requires some more processing.
+ // This may need a spec clarification.
+ RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(previousEffect, SourceAlpha::create(this));
+
+ for (Node* node = filter->firstChild(); node; node = node->nextSibling()) {
+ if (!node->isSVGElement())
+ continue;
+
+ SVGElement* element = static_cast<SVGElement*>(node);
+ if (!element->isFilterEffect())
+ continue;
+
+ SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFilterPrimitiveStandardAttributes*>(element);
+
+ effect = effectElement->build(builder.get(), this);
+ if (!effect)
+ continue;
+
+ effectElement->setStandardAttributes(effect.get());
+ builder->add(effectElement->result(), effect);
+ m_effects.append(effect);
+ }
+ return effect;
+#else
+ return 0;
+#endif
+}
+
bool FilterEffectRenderer::build(Document* document, const FilterOperations& operations)
{
#if !ENABLE(CSS_SHADERS) || !ENABLE(WEBGL)
operations.getOutsets(m_topOutset, m_rightOutset, m_bottomOutset, m_leftOutset);
m_effects.clear();
- RefPtr<FilterEffect> previousEffect;
+ RefPtr<FilterEffect> previousEffect = m_sourceGraphic;
for (size_t i = 0; i < operations.operations().size(); ++i) {
RefPtr<FilterEffect> effect;
FilterOperation* filterOperation = operations.operations().at(i).get();
switch (filterOperation->getOperationType()) {
case FilterOperation::REFERENCE: {
- // FIXME: Not yet implemented.
- // https://bugs.webkit.org/show_bug.cgi?id=72443
+ effect = buildReferenceFilter(document, previousEffect, static_cast<ReferenceFilterOperation*>(filterOperation));
break;
}
case FilterOperation::GRAYSCALE: {
// Unlike SVG, filters applied here should not clip to their primitive subregions.
effect->setClipsToBounds(false);
- if (previousEffect)
+ if (filterOperation->getOperationType() != FilterOperation::REFERENCE) {
effect->inputEffects().append(previousEffect);
- m_effects.append(effect);
+ m_effects.append(effect);
+ }
previousEffect = effect.release();
}
}
// If we didn't make any effects, tell our caller we are not valid
- if (!previousEffect)
+ if (!m_effects.size())
return false;
- m_effects.first()->inputEffects().append(m_sourceGraphic);
setMaxEffectRects(m_sourceDrawingRegion);
return true;
ImageBuffer* output() const { return lastEffect()->asImageBuffer(); }
bool build(Document*, const FilterOperations&);
+ PassRefPtr<FilterEffect> buildReferenceFilter(Document*, PassRefPtr<FilterEffect> previousEffect, ReferenceFilterOperation*);
bool updateBackingStoreRect(const FloatRect& filterRect);
void allocateBackingStoreIfNeeded();
void clearIntermediateResults();
else if (hasFilterInfo())
filterInfo()->removeCustomFilterClients();
#endif
-
+
+#if ENABLE(SVG)
+ if (renderer()->style()->filter().hasReferenceFilter())
+ ensureFilterInfo()->updateReferenceFilterClients(renderer()->style()->filter());
+ else if (hasFilterInfo())
+ filterInfo()->removeReferenceFilterClients();
+#endif
+
if (!paintsWithFilters()) {
// Don't delete the whole filter info here, because we might use it
// for loading CSS shader files.
void RenderLayer::filterNeedsRepaint()
{
renderer()->node()->setNeedsStyleRecalc(SyntheticStyleChange);
- renderer()->repaint();
+ if (renderer()->view())
+ renderer()->repaint();
}
#endif
#include "FilterEffectRenderer.h"
#include "RenderLayer.h"
+#if ENABLE(SVG)
+#include "CachedSVGDocument.h"
+#include "SVGElement.h"
+#include "SVGFilter.h"
+#include "SVGFilterPrimitiveStandardAttributes.h"
+#endif
+
#if ENABLE(CSS_SHADERS)
#include "CustomFilterOperation.h"
#include "CustomFilterProgram.h"
#if ENABLE(CSS_SHADERS)
removeCustomFilterClients();
#endif
+#if ENABLE(SVG)
+ removeReferenceFilterClients();
+#endif
}
void RenderLayerFilterInfo::setRenderer(PassRefPtr<FilterEffectRenderer> renderer)
m_renderer = renderer;
}
+#if ENABLE(SVG)
+void RenderLayerFilterInfo::notifyFinished(CachedResource*)
+{
+ RenderObject* renderer = m_layer->renderer();
+ renderer->node()->setNeedsStyleRecalc(SyntheticStyleChange);
+ renderer->repaint();
+}
+
+void RenderLayerFilterInfo::updateReferenceFilterClients(const FilterOperations& operations)
+{
+ removeReferenceFilterClients();
+ for (size_t i = 0; i < operations.size(); ++i) {
+ RefPtr<FilterOperation> filterOperation = operations.operations().at(i);
+ if (filterOperation->getOperationType() != FilterOperation::REFERENCE)
+ continue;
+ ReferenceFilterOperation* referenceFilterOperation = static_cast<ReferenceFilterOperation*>(filterOperation.get());
+ CachedSVGDocument* cachedSVGDocument = static_cast<CachedSVGDocument*>(referenceFilterOperation->data());
+
+ if (cachedSVGDocument) {
+ // Reference is external; wait for notifyFinished().
+ cachedSVGDocument->addClient(this);
+ m_externalSVGReferences.append(cachedSVGDocument);
+ } else {
+ // Reference is internal; add layer as a client so we can trigger
+ // filter repaint on SVG attribute change.
+ Element* filter = m_layer->renderer()->node()->document()->getElementById(referenceFilterOperation->fragment());
+ if (!filter || !filter->renderer())
+ continue;
+ ASSERT(filter->renderer()->isSVGResourceContainer());
+ filter->renderer()->toRenderSVGResourceContainer()->addClientRenderLayer(m_layer);
+ m_internalSVGReferences.append(filter);
+ }
+ }
+}
+
+void RenderLayerFilterInfo::removeReferenceFilterClients()
+{
+ for (size_t i = 0; i < m_externalSVGReferences.size(); ++i)
+ m_externalSVGReferences.at(i)->removeClient(this);
+ m_externalSVGReferences.clear();
+ for (size_t i = 0; i < m_internalSVGReferences.size(); ++i) {
+ Element* filter = m_internalSVGReferences.at(i).get();
+ if (!filter->renderer())
+ continue;
+ filter->renderer()->toRenderSVGResourceContainer()->removeClientRenderLayer(m_layer);
+ }
+ m_internalSVGReferences.clear();
+}
+#endif
+
#if ENABLE(CSS_SHADERS)
void RenderLayerFilterInfo::notifyCustomFilterProgramLoaded(CustomFilterProgram*)
{
#if ENABLE(CSS_FILTERS)
+#if ENABLE(SVG)
+#include "CachedSVGDocument.h"
+#endif
+#include "FilterOperation.h"
#include "LayoutTypes.h"
#include <wtf/HashMap.h>
#include <wtf/PassRefPtr.h>
class RenderLayerFilterInfo
#if ENABLE(CSS_SHADERS)
: public CustomFilterProgramClient
+#if ENABLE(SVG)
+ , public CachedSVGDocumentClient
+#endif
+#elif ENABLE(SVG)
+ : public CachedSVGDocumentClient
#endif
{
public:
void removeCustomFilterClients();
#endif
-
+#if ENABLE(SVG)
+ void updateReferenceFilterClients(const FilterOperations&);
+ virtual void notifyFinished(CachedResource*);
+ void removeReferenceFilterClients();
+#endif
+
private:
RenderLayerFilterInfo(RenderLayer*);
~RenderLayerFilterInfo();
#endif
static RenderLayerFilterInfoMap* s_filterMap;
+#if ENABLE(SVG)
+ Vector<RefPtr<Element> > m_internalSVGReferences;
+ Vector<CachedResourceHandle<CachedSVGDocument> > m_externalSVGReferences;
+#endif
};
} // namespace WebCore
#if ENABLE(SVG)
#include "RenderSVGResourceContainer.h"
+#include "RenderLayer.h"
#include "RenderSVGRoot.h"
#include "RenderView.h"
#include "SVGRenderingContext.h"
void RenderSVGResourceContainer::markAllClientsForInvalidation(InvalidationMode mode)
{
- if (m_clients.isEmpty() || m_isInvalidating)
+ if ((m_clients.isEmpty() && m_clientLayers.isEmpty()) || m_isInvalidating)
return;
m_isInvalidating = true;
RenderSVGResource::markForLayoutAndParentResourceInvalidation(client, needsLayout);
}
+
+#if ENABLE(CSS_FILTERS)
+ HashSet<RenderLayer*>::iterator layerEnd = m_clientLayers.end();
+ for (HashSet<RenderLayer*>::iterator it = m_clientLayers.begin(); it != layerEnd; ++it)
+ (*it)->filterNeedsRepaint();
+#endif
+
m_isInvalidating = false;
}
m_clients.remove(client);
}
+void RenderSVGResourceContainer::addClientRenderLayer(RenderLayer* client)
+{
+ ASSERT(client);
+ m_clientLayers.add(client);
+}
+
+void RenderSVGResourceContainer::removeClientRenderLayer(RenderLayer* client)
+{
+ ASSERT(client);
+ m_clientLayers.remove(client);
+}
+
void RenderSVGResourceContainer::registerResource()
{
SVGDocumentExtensions* extensions = svgExtensionsFromNode(node());
namespace WebCore {
+class RenderLayer;
+
class RenderSVGResourceContainer : public RenderSVGHiddenContainer,
public RenderSVGResource {
public:
static AffineTransform transformOnNonScalingStroke(RenderObject*, const AffineTransform& resourceTransform);
void idChanged();
+ void addClientRenderLayer(RenderLayer*);
+ void removeClientRenderLayer(RenderLayer*);
protected:
enum InvalidationMode {
bool m_registered : 1;
bool m_isInvalidating : 1;
HashSet<RenderObject*> m_clients;
+ HashSet<RenderLayer*> m_clientLayers;
};
inline RenderSVGResourceContainer* getRenderSVGResourceContainerById(Document* document, const AtomicString& id)
#include "Page.h"
#include "RenderSVGResource.h"
#include "RenderSVGResourceFilterPrimitive.h"
-#include "Settings.h"
#include "SVGElement.h"
#include "SVGFilter.h"
#include "SVGFilterElement.h"
#include "SVGRenderingContext.h"
#include "SVGStyledElement.h"
#include "SVGUnitTypes.h"
+#include "Settings.h"
+#include "SourceAlpha.h"
+#include "SourceGraphic.h"
#include <wtf/UnusedParam.h>
#include <wtf/Vector.h>
FloatRect targetBoundingBox = filter->targetBoundingBox();
// Add effects to the builder
- RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(filter);
+ RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(SourceGraphic::create(filter), SourceAlpha::create(filter));
for (Node* node = filterElement->firstChild(); node; node = node->nextSibling()) {
if (!node->isSVGElement())
continue;
namespace WebCore {
-SVGFilterBuilder::SVGFilterBuilder(Filter* filter)
+SVGFilterBuilder::SVGFilterBuilder(PassRefPtr<FilterEffect> sourceGraphic, PassRefPtr<FilterEffect> sourceAlpha)
{
- m_builtinEffects.add(SourceGraphic::effectName(), SourceGraphic::create(filter));
- m_builtinEffects.add(SourceAlpha::effectName(), SourceAlpha::create(filter));
+ m_builtinEffects.add(SourceGraphic::effectName(), sourceGraphic);
+ m_builtinEffects.add(SourceAlpha::effectName(), sourceAlpha);
addBuiltinEffects();
}
public:
typedef HashSet<FilterEffect*> FilterEffectSet;
- static PassRefPtr<SVGFilterBuilder> create(Filter* filter) { return adoptRef(new SVGFilterBuilder(filter)); }
+ static PassRefPtr<SVGFilterBuilder> create(PassRefPtr<FilterEffect> sourceGraphic, PassRefPtr<FilterEffect> sourceAlpha) { return adoptRef(new SVGFilterBuilder(sourceGraphic, sourceAlpha)); }
void add(const AtomicString& id, PassRefPtr<FilterEffect>);
void clearResultsRecursive(FilterEffect*);
private:
- SVGFilterBuilder(Filter*);
+ SVGFilterBuilder(PassRefPtr<FilterEffect> sourceGraphic, PassRefPtr<FilterEffect> sourceAlpha);
inline void addBuiltinEffects()
{