Changeset 121513 in webkit


Ignore:
Timestamp:
Jun 28, 2012 7:50:27 PM (12 years ago)
Author:
senorblanco@chromium.org
Message:

Source/WebCore: 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.

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:
Location:
trunk
Files:
16 added
31 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r121506 r121513  
     12012-06-28  Stephen White  <senorblanco@chromium.org>
     2
     3        Add tests for the url() filter function.
     4        https://bugs.webkit.org/show_bug.cgi?id=72443
     5
     6        Reviewed by Dean Jackson.
     7
     8        * css3/filters/effect-reference-external.html: Added.
     9        * css3/filters/effect-reference-hw.html: Added.
     10        * css3/filters/effect-reference-ordering.html: Added.
     11        * css3/filters/effect-reference.html: Added.
     12        * css3/filters/resources/hueRotate.svg: Added.
     13        * platform/chromium-linux/css3/filters/effect-reference-expected.png: Added.
     14        * platform/chromium-linux/css3/filters/effect-reference-expected.txt: Added.
     15        * platform/chromium-linux/css3/filters/effect-reference-external-expected.png: Added.
     16        * platform/chromium-linux/css3/filters/effect-reference-external-expected.txt: Added.
     17        * platform/chromium-linux/css3/filters/effect-reference-hw-expected.png: Added.
     18        * platform/chromium-linux/css3/filters/effect-reference-hw-expected.txt: Added.
     19        * platform/chromium-linux/css3/filters/effect-reference-ordering-expected.png: Added.
     20        * platform/chromium-linux/css3/filters/effect-reference-ordering-expected.txt: Added.
     21        * platform/chromium/TestExpectations:
     22
    1232012-06-28  Mike Lawther  <mikelawther@chromium.org>
    224
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r121506 r121513  
    12901290BUGWK83199 : svg/filters/big-sized-filter.svg = IMAGE PASS
    12911291
     1292// This will need to be rebaselined after
     1293// https://bugs.webkit.org/show_bug.cgi?id=72443 lands.
     1294BUG_SENORBLANCO WIN MAC : css3/filters/effect-reference.html = IMAGE IMAGE+TEXT TEXT
     1295BUG_SENORBLANCO WIN MAC : css3/filters/effect-reference-hw.html = IMAGE IMAGE+TEXT TEXT
     1296BUG_SENORBLANCO WIN MAC : css3/filters/effect-reference-external.html = IMAGE IMAGE+TEXT TEXT
     1297BUG_SENORBLANCO WIN MAC : css3/filters/effect-reference-ordering.html = IMAGE IMAGE+TEXT TEXT
     1298
    12921299// Many WIN and Linux SVG tests containing text are flaky. It seems different fonts are used at different times.
    12931300BUGWK83303 WIN LINUX : svg/zoom/text/zoom-hixie-mixed-009.xml = PASS IMAGE
  • trunk/Source/WebCore/CMakeLists.txt

    r121164 r121513  
    540540    css/WebKitCSSMatrix.cpp
    541541    css/WebKitCSSRegionRule.cpp
     542    css/WebKitCSSSVGDocumentValue.cpp
    542543    css/WebKitCSSTransformValue.cpp
    543544
  • trunk/Source/WebCore/ChangeLog

    r121510 r121513  
     12012-06-28  Stephen White  <senorblanco@chromium.org>
     2
     3        Implement filter url() function.
     4        https://bugs.webkit.org/show_bug.cgi?id=72443
     5
     6        url() references can be internal, in which case the DOM nodes are
     7        retrieved directly from the current document, or external, in which
     8        case a CachedSVGDocument request is made, and the filter node build is
     9        deferred until the document is loaded.  WebKitSVGDocumentValue
     10        holds the CachedSVGDocument (if any) and the URL as a CSSValue,
     11        and is stored in the CSSValue chain as the argument to the reference
     12        filter.
     13
     14        One notable difference between internal and external references is
     15        that internal references will automatically update on an SVG filter node
     16        attribute change, while external references will not, since they live
     17        in a separate document.  This is consistent with the Mozilla
     18        implementation.  In order to make this work, the RenderLayer is made a
     19        client of the RenderSVGResourceContainer, and calls
     20        filterNeedsRepaint() when the SVG nodes are invalidated.
     21
     22        Some plumbing:  The CSS StyleResolver was refactored to load all
     23        all external resources (images, shaders and (now) SVG filters) in a
     24        single function, loadPendingResources().  The PlatformLayer typedef
     25        was moved out into its own file, in order to break a cyclic
     26        dependency.  SVGFilterBuilder was modified to accept the SourceGraphic
     27        and SourceAlpha FilterEffects in its constructor and factory function,
     28        rather than extracting them from the parent Filter.  (This is necessary
     29        so that the url() filter can correctly hook up its inputs from
     30        previous CSS filters.)
     31
     32        Reviewed by Dean Jackson.
     33
     34        Tests: css3/filters/effect-reference-external.html
     35               css3/filters/effect-reference-hw.html
     36               css3/filters/effect-reference-ordering.html
     37               css3/filters/effect-reference.html
     38
     39        * CMakeLists.txt:
     40        * GNUmakefile.list.am:
     41        * Target.pri:
     42        * WebCore.gypi:
     43        * WebCore.vcproj/WebCore.vcproj:
     44        * WebCore.xcodeproj/project.pbxproj:
     45        Add WebKitCSSSVGDocumentValue to the various build files.
     46        * css/CSSComputedStyleDeclaration.cpp:
     47        (WebCore::CSSComputedStyleDeclaration::valueForFilter):
     48        Use the reference filter's url when getting the computed style for
     49        a reference filter.
     50        * css/CSSParser.cpp:
     51        (WebCore::CSSParser::parseFilter):
     52        Create the referenceFilterValue's argument as a
     53        WebKitCSSSVGDocumentValue instead of a CSS string.
     54        * css/CSSValue.cpp:
     55        (WebCore::CSSValue::cssText):
     56        Add support for WebKitCSSSVGDocumentValue.
     57        (WebCore::CSSValue::destroy):
     58        Add support for WebKitCSSSVGDocumentValue.
     59        * css/CSSValue.h:
     60        (WebCore::CSSValue::isWebKitCSSSVGDocumentValue):
     61        Add support for WebKitCSSSVGDocumentValue.
     62        * css/StyleResolver.cpp:
     63        (WebCore::StyleResolver::collectMatchingRulesForList):
     64        Keep track of pending SVG document references, and load them when
     65        necessary.
     66        * css/StyleResolver.h:
     67        * css/WebKitCSSSVGDocumentValue.cpp: Added.
     68        New CSSValue subclass for holding SVG document references.
     69        (WebCore::WebKitCSSSVGDocumentValue::WebKitCSSSVGDocumentValue):
     70        (WebCore::WebKitCSSSVGDocumentValue::~WebKitCSSSVGDocumentValue):
     71        (WebCore::WebKitCSSSVGDocumentValue::load):
     72        (WebCore::WebKitCSSSVGDocumentValue::customCssText):
     73        * css/WebKitCSSSVGDocumentValue.h: Added.
     74        (WebCore::WebKitCSSSVGDocumentValue::create):
     75        (WebCore::WebKitCSSSVGDocumentValue::cachedSVGDocument):
     76        (WebCore::WebKitCSSSVGDocumentValue::url):
     77        (WebCore::WebKitCSSSVGDocumentValue::loadRequested):
     78        * platform/graphics/GraphicsLayer.h:
     79        Refactor PlatformLayer out into its own file, to avoid circular
     80        includes.
     81        * platform/graphics/ImageBuffer.h:
     82        Include PlatformLayer.h instead of GraphicsLayer.h.
     83        * platform/graphics/PlatformLayer.h: Added.
     84        Refactor PlatformLayer out into its own file, to avoid circular
     85        includes.
     86        * platform/graphics/filters/FilterOperation.h:
     87        (WebCore::ReferenceFilterOperation::create):
     88        (WebCore::ReferenceFilterOperation::clone):
     89        (WebCore::ReferenceFilterOperation::url):
     90        (WebCore::ReferenceFilterOperation::fragment):
     91        (ReferenceFilterOperation):
     92        (WebCore::ReferenceFilterOperation::data):
     93        (WebCore::ReferenceFilterOperation::setData):
     94        (WebCore::ReferenceFilterOperation::operator==):
     95        (WebCore::ReferenceFilterOperation::ReferenceFilterOperation):
     96        Augment ReferenceFilterOperation to maintain a data pointer,
     97        in order to preserve context while loading external SVG documents.
     98        Replace "reference" with "url" and "fragment" members, in order to
     99        ease retrieval of the appropriate DOM objects.
     100        * platform/graphics/filters/FilterOperations.cpp:
     101        (WebCore::FilterOperations::hasReferenceFilter):
     102        Convenience function for finding reference filters.
     103        * platform/graphics/filters/FilterOperations.h:
     104        (FilterOperations):
     105        * platform/mac/ScrollbarThemeMac.mm:
     106        Include GraphicsLayer.h explicitly, since ImageBuffer.h no longer
     107        includes it (and only includes PlatformLayer.h).
     108        * rendering/FilterEffectRenderer.cpp:
     109        (WebCore::FilterEffectRenderer::buildReferenceFilter):
     110        Utility function to build a FilterEffect node graph for a
     111        ReferenceFilterOperation.
     112        (WebCore::FilterEffectRenderer::build):
     113        Call the above builder function for ReferenceFilterOperations.
     114        * rendering/FilterEffectRenderer.h:
     115        * rendering/RenderLayer.cpp:
     116        (WebCore::RenderLayer::updateOrRemoveFilterEffect):
     117        If we have reference filters, update them along with other filters.
     118        (WebCore::RenderLayer::filterNeedsRepaint):
     119        * rendering/RenderLayerFilterInfo.cpp:
     120        (WebCore::RenderLayerFilterInfo::~RenderLayerFilterInfo):
     121        (WebCore::RenderLayerFilterInfo::notifyFinished):
     122        Implement callback function when external SVGDocuments are loaded.
     123        (WebCore::RenderLayerFilterInfo::updateReferenceFilterClients):
     124        Add the FilterInfo as a client to be called when SVGDocuments are
     125        loaded.
     126        (WebCore::RenderLayerFilterInfo::removeReferenceFilterClients):
     127        Remove this from the list of notified clients.
     128        * rendering/RenderLayerFilterInfo.h:
     129        Add new member vars for tracking internal and external SVG
     130        references, so we can remove ourselves as a client when done.
     131        * rendering/svg/RenderSVGResourceContainer.cpp:
     132        (WebCore::RenderSVGResourceContainer::markAllClientsForInvalidation):
     133        When marking client DOM nodes for repaint, also mark any RenderLayers
     134        referring to this DOM tree via filters as needing repaint.
     135        (WebCore::RenderSVGResourceContainer::addClientRenderLayer):
     136        (WebCore::RenderSVGResourceContainer::removeClientRenderLayer):
     137        * rendering/svg/RenderSVGResourceContainer.h:
     138        Maintain a list of RenderLayer clients on each SVG resource container,
     139        and turn SVG DOM repaint notifications into filter repaint (CSS)
     140        notifications.
     141        * rendering/svg/RenderSVGResourceFilter.cpp:
     142        (WebCore::RenderSVGResourceFilter::buildPrimitives):
     143        Construct a SourceGraphic and SourceAlpha node explicitly for the
     144        SVG builder case.
     145        * svg/graphics/filters/SVGFilterBuilder.cpp:
     146        (WebCore::SVGFilterBuilder::SVGFilterBuilder):
     147        * svg/graphics/filters/SVGFilterBuilder.h:
     148        (WebCore::SVGFilterBuilder::create):
     149        Add the SourceGraphic and SourceAlpha as parameters to the constructor
     150        and create() methods, so they can be supplied by the caller.
     151
    11522012-06-28  Kenichi Ishibashi  <bashi@chromium.org>
    2153
  • trunk/Source/WebCore/GNUmakefile.list.am

    r121332 r121513  
    17731773        Source/WebCore/css/WebKitCSSRegionRule.cpp \
    17741774        Source/WebCore/css/WebKitCSSRegionRule.h \
     1775        Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp \
     1776        Source/WebCore/css/WebKitCSSSVGDocumentValue.h \
    17751777        Source/WebCore/css/WebKitCSSShaderValue.cpp \
    17761778        Source/WebCore/css/WebKitCSSShaderValue.h \
     
    33693371        Source/WebCore/platform/graphics/Pattern.cpp \
    33703372        Source/WebCore/platform/graphics/Pattern.h \
     3373        Source/WebCore/platform/graphics/PlatformLayer.h \
    33713374        Source/WebCore/platform/graphics/Region.cpp \
    33723375        Source/WebCore/platform/graphics/Region.h \
  • trunk/Source/WebCore/Target.pri

    r121336 r121513  
    503503    css/WebKitCSSMatrix.cpp \
    504504    css/WebKitCSSRegionRule.cpp \
     505    css/WebKitCSSSVGDocumentValue.cpp \
    505506    css/WebKitCSSShaderValue.cpp \
    506507    css/WebKitCSSTransformValue.cpp \
     
    16871688    css/WebKitCSSMatrix.h \
    16881689    css/WebKitCSSRegionRule.h \
     1690    css/WebKitCSSSVGDocumentValue.h \
    16891691    css/WebKitCSSShaderValue.h \
    16901692    css/WebKitCSSTransformValue.h \
     
    23012303    platform/graphics/PathTraversalState.h \
    23022304    platform/graphics/Pattern.h \
     2305    platform/graphics/PlatformLayer.h \
    23032306    platform/graphics/Region.h \
    23042307    platform/graphics/RoundedRect.h \
  • trunk/Source/WebCore/WebCore.gypi

    r121473 r121513  
    395395            'platform/graphics/Path.h',
    396396            'platform/graphics/Pattern.h',
     397            'platform/graphics/PlatformLayer.h',
    397398            'platform/graphics/Region.h',
    398399            'platform/graphics/RoundedRect.h',
     
    25832584            'css/WebKitCSSShaderValue.cpp',
    25842585            'css/WebKitCSSShaderValue.h',
     2586            'css/WebKitCSSSVGDocumentValue.cpp',
     2587            'css/WebKitCSSSVGDocumentValue.h',
    25852588            'css/WebKitCSSTransformValue.cpp',
    25862589            'editing/AlternativeTextController.cpp',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r121164 r121513  
    2936329363                                </File>
    2936429364                                <File
     29365                                        RelativePath="..\platform\graphics\PlatformLayer.h"
     29366                                        >
     29367                                </File>
     29368                                <File
    2936529369                                        RelativePath="..\platform\graphics\Region.cpp"
    2936629370                                        >
     
    3757637580                        </File>
    3757737581                        <File
     37582                                RelativePath="..\css\WebKitCSSSVGDocumentValue.cpp"
     37583                                >
     37584                        </File>
     37585                        <File
     37586                                RelativePath="..\css\WebKitCSSSVGDocumentValue.h"
     37587                                >
     37588                        </File>
     37589                        <File
    3757837590                                RelativePath="..\css\WebKitCSSShaderValue.cpp"
    37579                                 >
    37580                         </File>
    37581                         <File
    37582                                 RelativePath="..\css\WebKitCSSShaderValue.h"
    3758337591                                >
    3758437592                        </File>
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r121358 r121513  
    7979                052BFCE9128ABF1500FD338D /* GeolocationClientMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 052BFCE8128ABF1500FD338D /* GeolocationClientMock.cpp */; };
    8080                052BFCEB128ABF2100FD338D /* GeolocationClientMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 052BFCEA128ABF2100FD338D /* GeolocationClientMock.h */; settings = {ATTRIBUTES = (Private, ); }; };
     81                0562F9461573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0562F9441573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.cpp */; };
     82                0562F9471573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 0562F9451573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h */; };
     83                0562F9611573F88F0031CA16 /* PlatformLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0562F9601573F88F0031CA16 /* PlatformLayer.h */; settings = {ATTRIBUTES = (Private, ); }; };
    8184                05FD69E012845D4300B2BEB3 /* DOMTimeStamp.h in Headers */ = {isa = PBXBuildFile; fileRef = 05FD69DF12845D4300B2BEB3 /* DOMTimeStamp.h */; settings = {ATTRIBUTES = (Private, ); }; };
    8285                06027CAD0B1CBFC000884B2D /* ContextMenuItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 06027CAC0B1CBFC000884B2D /* ContextMenuItem.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    36983701                A0EE0DF8144F825500F80B0D /* WebGLDebugShaders.h in Headers */ = {isa = PBXBuildFile; fileRef = A0EE0DF4144F825500F80B0D /* WebGLDebugShaders.h */; };
    36993702                A104F24314C71F7A009E2C23 /* CachedSVGDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A104F24114C71F7A009E2C23 /* CachedSVGDocument.cpp */; };
    3700                 A104F24414C71F7A009E2C23 /* CachedSVGDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = A104F24214C71F7A009E2C23 /* CachedSVGDocument.h */; };
     3703                A104F24414C71F7A009E2C23 /* CachedSVGDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = A104F24214C71F7A009E2C23 /* CachedSVGDocument.h */; settings = {ATTRIBUTES = (Private, ); }; };
    37013704                A10BB5851484E3A700B2E87A /* RenderSVGRect.h in Headers */ = {isa = PBXBuildFile; fileRef = A10BB5831484E3A700B2E87A /* RenderSVGRect.h */; };
    37023705                A10BB58B1484E3B300B2E87A /* RenderSVGShape.h in Headers */ = {isa = PBXBuildFile; fileRef = A10BB5891484E3B300B2E87A /* RenderSVGShape.h */; };
     
    45454548                B22279B10D00BF220071B782 /* SVGDescElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B222781B0D00BF1F0071B782 /* SVGDescElement.h */; };
    45464549                B22279B30D00BF220071B782 /* SVGDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B222781D0D00BF1F0071B782 /* SVGDocument.cpp */; };
    4547                 B22279B40D00BF220071B782 /* SVGDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = B222781E0D00BF1F0071B782 /* SVGDocument.h */; };
     4550                B22279B40D00BF220071B782 /* SVGDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = B222781E0D00BF1F0071B782 /* SVGDocument.h */; settings = {ATTRIBUTES = (Private, ); }; };
    45484551                B22279B60D00BF220071B782 /* SVGElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22278200D00BF1F0071B782 /* SVGElement.cpp */; };
    45494552                B22279B70D00BF220071B782 /* SVGElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278210D00BF1F0071B782 /* SVGElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    69946997                052BFCE8128ABF1500FD338D /* GeolocationClientMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GeolocationClientMock.cpp; path = mock/GeolocationClientMock.cpp; sourceTree = "<group>"; };
    69956998                052BFCEA128ABF2100FD338D /* GeolocationClientMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GeolocationClientMock.h; path = mock/GeolocationClientMock.h; sourceTree = "<group>"; };
     6999                0562F9441573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSSVGDocumentValue.cpp; sourceTree = "<group>"; };
     7000                0562F9451573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitCSSSVGDocumentValue.h; sourceTree = "<group>"; };
     7001                0562F9601573F88F0031CA16 /* PlatformLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformLayer.h; sourceTree = "<group>"; };
    69967002                05FD69DF12845D4300B2BEB3 /* DOMTimeStamp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMTimeStamp.h; sourceTree = "<group>"; };
    69977003                06027CAC0B1CBFC000884B2D /* ContextMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ContextMenuItem.h; sourceTree = "<group>"; };
     
    1954919555                        isa = PBXGroup;
    1955019556                        children = (
     19557                                0562F9601573F88F0031CA16 /* PlatformLayer.h */,
    1955119558                                076F0D0812B8192700C26AA4 /* avfoundation */,
    1955219559                                499B3EC0128CCC1800E726C2 /* ca */,
     
    2099721004                                8AA61CFE144D595B00F37350 /* WebKitCSSRegionRule.h */,
    2099821005                                8AD0A55614C87425000D83C5 /* WebKitCSSRegionRule.idl */,
     21006                                0562F9441573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.cpp */,
     21007                                0562F9451573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h */,
    2099921008                                5038BC0614711CDB0095E0D1 /* WebKitCSSShaderValue.cpp */,
    2100021009                                50B42157146976960087E604 /* WebKitCSSShaderValue.h */,
     
    2420024209                                BC9585E112F0989500755821 /* PlatformGestureEvent.h in Headers */,
    2420124210                                935C476809AC4D4300A6AAB4 /* PlatformKeyboardEvent.h in Headers */,
     24211                                0562F9611573F88F0031CA16 /* PlatformLayer.h in Headers */,
    2420224212                                932871C00B20DEB70049035A /* PlatformMenuDescription.h in Headers */,
    2420324213                                41BF70100FE86F61005E8DEC /* PlatformMessagePortChannel.h in Headers */,
     
    2504425054                                498391590F1E776900C23782 /* WebKitCSSMatrix.h in Headers */,
    2504525055                                8AA61D00144D595B00F37350 /* WebKitCSSRegionRule.h in Headers */,
     25056                                0562F9471573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h in Headers */,
    2504625057                                29CD61DE146D02890068E82A /* WebKitCSSShaderValue.h in Headers */,
    2504725058                                BC9ADD230CC4032600098C4C /* WebKitCSSTransformValue.h in Headers */,
     
    2810928120                                8AA61CFF144D595B00F37350 /* WebKitCSSRegionRule.cpp in Sources */,
    2811028121                                5038BC0714711CDB0095E0D1 /* WebKitCSSShaderValue.cpp in Sources */,
     28122        0562F9461573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.cpp in Sources */,
    2811128123                                BC9ADD800CC4092200098C4C /* WebKitCSSTransformValue.cpp in Sources */,
    2811228124                                1A1414B513A0F0500019996C /* WebKitFontFamilyNames.cpp in Sources */,
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r121442 r121513  
    786786            ReferenceFilterOperation* referenceOperation = static_cast<ReferenceFilterOperation*>(filterOperation);
    787787            filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::ReferenceFilterOperation);
    788             filterValue->append(cssValuePool().createValue(referenceOperation->reference(), CSSPrimitiveValue::CSS_STRING));
     788            filterValue->append(cssValuePool().createValue(referenceOperation->url(), CSSPrimitiveValue::CSS_STRING));
    789789            break;
    790790        }
  • trunk/Source/WebCore/css/CSSParser.cpp

    r121442 r121513  
    9595#if ENABLE(CSS_FILTERS)
    9696#include "WebKitCSSFilterValue.h"
     97#if ENABLE(SVG)
     98#include "WebKitCSSSVGDocumentValue.h"
     99#endif
    97100#endif
    98101
     
    75597562        // See if the specified primitive is one we understand.
    75607563        if (value->unit == CSSPrimitiveValue::CSS_URI) {
     7564#if ENABLE(SVG)
    75617565            RefPtr<WebKitCSSFilterValue> referenceFilterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::ReferenceFilterOperation);
    75627566            list->append(referenceFilterValue);
    7563             referenceFilterValue->append(cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_STRING));
     7567            referenceFilterValue->append(WebKitCSSSVGDocumentValue::create(value->string));
     7568#endif
    75647569        } else {
    75657570            const CSSParserString name = value->function->name;
  • trunk/Source/WebCore/css/CSSValue.cpp

    r120154 r121513  
    5959#include "WebKitCSSShaderValue.h"
    6060#include "WebKitCSSTransformValue.h"
     61
     62#if ENABLE(SVG)
     63#include "WebKitCSSSVGDocumentValue.h"
     64#endif
    6165
    6266namespace WebCore {
     
    198202    case SVGPaintClass:
    199203        return static_cast<const SVGPaint*>(this)->customCssText();
     204    case WebKitCSSSVGDocumentClass:
     205        return static_cast<const WebKitCSSSVGDocumentValue*>(this)->customCssText();
    200206#endif
    201207    }
     
    331337    case SVGPaintClass:
    332338        delete static_cast<SVGPaint*>(this);
     339        return;
     340    case WebKitCSSSVGDocumentClass:
     341        delete static_cast<WebKitCSSSVGDocumentValue*>(this);
    333342        return;
    334343#endif
  • trunk/Source/WebCore/css/CSSValue.h

    r121189 r121513  
    100100    bool isSVGColor() const { return m_classType == SVGColorClass || m_classType == SVGPaintClass; }
    101101    bool isSVGPaint() const { return m_classType == SVGPaintClass; }
     102    bool isWebKitCSSSVGDocumentValue() const { return m_classType == WebKitCSSSVGDocumentClass; }
    102103#endif
    103104   
     
    162163        SVGColorClass,
    163164        SVGPaintClass,
     165        WebKitCSSSVGDocumentClass,
    164166#endif
    165167
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r121442 r121513  
    137137
    138138#if ENABLE(SVG)
     139#include "CachedSVGDocument.h"
     140#include "SVGDocument.h"
    139141#include "SVGElement.h"
    140142#include "SVGNames.h"
     143#include "SVGURIReference.h"
     144#include "WebKitCSSSVGDocumentValue.h"
    141145#endif
    142146
     
    17941798    updateFont();
    17951799
    1796     // Start loading images referenced by this style.
    1797     loadPendingImages();
     1800    // Start loading resources referenced by this style.
     1801    loadPendingResources();
    17981802   
    1799 #if ENABLE(CSS_SHADERS)
    1800     // Start loading the shaders referenced by this style.
    1801     loadPendingShaders();
    1802 #endif
    1803 
    18041803    // Add all the animating properties to the keyframe.
    18051804    if (StylePropertySet* styleDeclaration = keyframe->properties()) {
     
    19151914    adjustRenderStyle(style(), parentStyle, 0);
    19161915
    1917     // Start loading images referenced by this style.
    1918     loadPendingImages();
    1919 
    1920 #if ENABLE(CSS_SHADERS)
    1921     // Start loading the shaders referenced by this style.
    1922     loadPendingShaders();
    1923 #endif
     1916    // Start loading resources referenced by this style.
     1917    loadPendingResources();
    19241918
    19251919    // Now return the style.
     
    19591953    applyMatchedProperties<LowPriorityProperties>(result, false, 0, result.matchedProperties.size() - 1, inheritedOnly);
    19601954
    1961     // Start loading images referenced by this style.
    1962     loadPendingImages();
    1963 
    1964 #if ENABLE(CSS_SHADERS)
    1965     // Start loading the shaders referenced by this style.
    1966     loadPendingShaders();
    1967 #endif
     1955    // Start loading resources referenced by this style.
     1956    loadPendingResources();
    19681957
    19691958    // Now return the style.
     
    30102999    applyMatchedProperties<LowPriorityProperties>(matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly);
    30113000    applyMatchedProperties<LowPriorityProperties>(matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
    3012    
    3013     loadPendingImages();
    3014    
    3015 #if ENABLE(CSS_SHADERS)
    3016     loadPendingShaders();
    3017 #endif
     3001   
     3002    // Start loading resources referenced by this style.
     3003    loadPendingResources();
    30183004   
    30193005    ASSERT(!m_fontDirty);
     
    50935079}
    50945080
     5081#if ENABLE(CSS_FILTERS) && ENABLE(SVG)
     5082void StyleResolver::loadPendingSVGDocuments()
     5083{
     5084    if (!m_style->hasFilter() || m_pendingSVGDocuments.isEmpty())
     5085        return;
     5086
     5087    CachedResourceLoader* cachedResourceLoader = m_element->document()->cachedResourceLoader();
     5088    Vector<RefPtr<FilterOperation> >& filterOperations = m_style->filter().operations();
     5089    for (unsigned i = 0; i < filterOperations.size(); ++i) {
     5090        RefPtr<FilterOperation> filterOperation = filterOperations.at(i);
     5091        if (filterOperation->getOperationType() == FilterOperation::REFERENCE) {
     5092            ReferenceFilterOperation* referenceFilter = static_cast<ReferenceFilterOperation*>(filterOperation.get());
     5093
     5094            WebKitCSSSVGDocumentValue* value = m_pendingSVGDocuments.get(referenceFilter);
     5095            if (!value)
     5096                continue;
     5097            CachedSVGDocument* cachedDocument = value->load(cachedResourceLoader);
     5098            if (!cachedDocument)
     5099                continue;
     5100
     5101            // Stash the CachedSVGDocument on the reference filter.
     5102            referenceFilter->setData(cachedDocument);
     5103        }
     5104    }
     5105    m_pendingSVGDocuments.clear();
     5106}
     5107#endif
     5108
    50955109#if ENABLE(CSS_SHADERS)
    50965110StyleShader* StyleResolver::styleShader(CSSValue* value)
     
    53385352        }
    53395353#endif
     5354        if (operationType == FilterOperation::REFERENCE) {
     5355#if ENABLE(SVG)
     5356            if (filterValue->length() != 1)
     5357                continue;
     5358            CSSValue* argument = filterValue->itemWithoutBoundsCheck(0);
     5359
     5360            if (!argument->isWebKitCSSSVGDocumentValue())
     5361                continue;
     5362
     5363            WebKitCSSSVGDocumentValue* svgDocumentValue = static_cast<WebKitCSSSVGDocumentValue*>(argument);
     5364            KURL url = m_element->document()->completeURL(svgDocumentValue->url());
     5365
     5366            RefPtr<ReferenceFilterOperation> operation = ReferenceFilterOperation::create(svgDocumentValue->url(), url.fragmentIdentifier(), operationType);
     5367            if (SVGURIReference::isExternalURIReference(svgDocumentValue->url(), m_element->document())) {
     5368                if (!svgDocumentValue->loadRequested())
     5369                    m_pendingSVGDocuments.set(operation.get(), svgDocumentValue);
     5370                else
     5371                    operation->setData(svgDocumentValue->cachedSVGDocument());
     5372            }
     5373            operations.operations().append(operation);
     5374#endif
     5375            continue;
     5376        }
    53405377
    53415378        // Check that all parameters are primitive values, with the
     
    53555392        CSSPrimitiveValue* firstValue = filterValue->length() ? static_cast<CSSPrimitiveValue*>(filterValue->itemWithoutBoundsCheck(0)) : 0;
    53565393        switch (filterValue->operationType()) {
    5357         case WebKitCSSFilterValue::ReferenceFilterOperation: {
    5358             if (firstValue)
    5359                 operations.operations().append(ReferenceFilterOperation::create(firstValue->getStringValue(), operationType));
    5360             break;
    5361         }
    53625394        case WebKitCSSFilterValue::GrayscaleFilterOperation:
    53635395        case WebKitCSSFilterValue::SepiaFilterOperation:
     
    55445576}
    55455577
     5578void StyleResolver::loadPendingResources()
     5579{
     5580    // Start loading images referenced by this style.
     5581    loadPendingImages();
     5582
     5583#if ENABLE(CSS_SHADERS)
     5584    // Start loading the shaders referenced by this style.
     5585    loadPendingShaders();
     5586#endif
     5587   
     5588#if ENABLE(CSS_FILTERS) && ENABLE(SVG)
     5589    // Start loading the SVG Documents referenced by this style.
     5590    loadPendingSVGDocuments();
     5591#endif
     5592}
     5593
    55465594} // namespace WebCore
  • trunk/Source/WebCore/css/StyleResolver.h

    r121289 r121513  
    8888class WebKitCSSFilterValue;
    8989class WebKitCSSShaderValue;
     90class WebKitCSSSVGDocumentValue;
    9091
    9192#if ENABLE(CSS_SHADERS)
     
    263264    void loadPendingShaders();
    264265#endif
     266#if ENABLE(SVG)
     267    void loadPendingSVGDocuments();
     268#endif
    265269#endif // ENABLE(CSS_FILTERS)
     270
     271    void loadPendingResources();
    266272
    267273    struct RuleFeature {
     
    496502#endif
    497503
     504#if ENABLE(CSS_FILTERS) && ENABLE(SVG)
     505    HashMap<FilterOperation*, WebKitCSSSVGDocumentValue*> m_pendingSVGDocuments;
     506#endif
     507
    498508#if ENABLE(STYLE_SCOPED)
    499509    const ContainerNode* determineScope(const CSSStyleSheet*);
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.h

    r121461 r121513  
    3939#include "GraphicsLayerClient.h"
    4040#include "IntRect.h"
     41#include "PlatformLayer.h"
    4142#include "TransformationMatrix.h"
    4243#include "TransformOperations.h"
    4344#include <wtf/OwnPtr.h>
    4445#include <wtf/PassOwnPtr.h>
    45 
    46 #if PLATFORM(MAC)
    47 OBJC_CLASS CALayer;
    48 typedef CALayer PlatformLayer;
    49 #elif PLATFORM(WIN)
    50 typedef struct _CACFLayer PlatformLayer;
    51 #elif PLATFORM(QT)
    52 #if USE(TEXTURE_MAPPER)
    53 namespace WebCore {
    54 class TextureMapperPlatformLayer;
    55 typedef TextureMapperPlatformLayer PlatformLayer;
    56 };
    57 #else
    58 QT_BEGIN_NAMESPACE
    59 class QGraphicsObject;
    60 QT_END_NAMESPACE
    61 namespace WebCore {
    62 typedef QGraphicsObject PlatformLayer;
    63 }
    64 #endif
    65 #elif PLATFORM(CHROMIUM)
    66 namespace WebCore {
    67 class LayerChromium;
    68 typedef LayerChromium PlatformLayer;
    69 }
    70 #elif PLATFORM(GTK)
    71 #if USE(TEXTURE_MAPPER_CAIRO) || USE(TEXTURE_MAPPER_GL)
    72 namespace WebCore {
    73 class TextureMapperPlatformLayer;
    74 typedef TextureMapperPlatformLayer PlatformLayer;
    75 };
    76 #elif USE(CLUTTER)
    77 typedef struct _ClutterActor ClutterActor;
    78 namespace WebCore {
    79 typedef ClutterActor PlatformLayer;
    80 };
    81 #endif
    82 #else
    83 typedef void* PlatformLayer;
    84 #endif
    8546
    8647enum LayerTreeAsTextBehaviorFlags {
  • trunk/Source/WebCore/platform/graphics/ImageBuffer.h

    r121055 r121513  
    3434#include "GraphicsContext.h"
    3535#if USE(ACCELERATED_COMPOSITING)
    36 #include "GraphicsLayer.h"
     36#include "PlatformLayer.h"
    3737#endif
    3838#include "GraphicsTypes.h"
  • trunk/Source/WebCore/platform/graphics/filters/FilterOperation.h

    r114520 r121513  
    3434#include <wtf/PassOwnPtr.h>
    3535#include <wtf/RefCounted.h>
    36 #include <wtf/text/AtomicString.h>
     36#include <wtf/text/WTFString.h>
    3737
    3838// Annoyingly, wingdi.h #defines this.
     
    148148class ReferenceFilterOperation : public FilterOperation {
    149149public:
    150     static PassRefPtr<ReferenceFilterOperation> create(const AtomicString& reference, OperationType type)
    151     {
    152         return adoptRef(new ReferenceFilterOperation(reference, type));
    153     }
    154 
    155     virtual PassRefPtr<FilterOperation> clone() const
    156     {
    157         // AtomicString is thread-hostile, so we can't be cloned.
     150    static PassRefPtr<ReferenceFilterOperation> create(const String& url, const String& fragment, OperationType type)
     151    {
     152        return adoptRef(new ReferenceFilterOperation(url, fragment, type));
     153    }
     154
     155    virtual PassRefPtr<FilterOperation> clone() const
     156    {
     157        // Unimplemented
    158158        return 0;
    159159    }
     
    162162    virtual bool movesPixels() const { return true; }
    163163
    164     const AtomicString& reference() const { return m_reference; }
     164    const String& url() const { return m_url; }
     165    const String& fragment() const { return m_fragment; }
     166
     167    void* data() const { return m_data; }
     168    void setData(void* data) { m_data = data; }
    165169
    166170private:
     
    171175            return false;
    172176        const ReferenceFilterOperation* other = static_cast<const ReferenceFilterOperation*>(&o);
    173         return m_reference == other->m_reference;
    174     }
    175 
    176     ReferenceFilterOperation(const AtomicString& reference, OperationType type)
    177         : FilterOperation(type)
    178         , m_reference(reference)
    179     {
    180     }
    181 
    182     AtomicString m_reference;
     177        return m_url == other->m_url;
     178    }
     179
     180    ReferenceFilterOperation(const String& url, const String& fragment, OperationType type)
     181        : FilterOperation(type)
     182        , m_url(url)
     183        , m_fragment(fragment)
     184        , m_data(0)
     185    {
     186    }
     187
     188    String m_url;
     189    String m_fragment;
     190    void* m_data;
    183191};
    184192
  • trunk/Source/WebCore/platform/graphics/filters/FilterOperations.cpp

    r115123 r121513  
    9999#endif
    100100
     101bool FilterOperations::hasReferenceFilter() const
     102{
     103    for (size_t i = 0; i < m_operations.size(); ++i) {
     104        if (m_operations.at(i)->getOperationType() == FilterOperation::REFERENCE)
     105            return true;
     106    }
     107    return false;
     108}
     109
    101110bool FilterOperations::hasOutsets() const
    102111{
  • trunk/Source/WebCore/platform/graphics/filters/FilterOperations.h

    r115123 r121513  
    7373    bool hasCustomFilter() const;
    7474#endif
     75    bool hasReferenceFilter() const;
    7576private:
    7677    Vector<RefPtr<FilterOperation> > m_operations;
  • trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm

    r115868 r121513  
    2828
    2929#include "ImageBuffer.h"
     30#include "GraphicsLayer.h"
    3031#include "LocalCurrentGraphicsContext.h"
    3132#include "NSScrollerImpDetails.h"
  • trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp

    r120757 r121513  
    5151#endif
    5252
     53#if ENABLE(SVG)
     54#include "CachedSVGDocument.h"
     55#include "SVGElement.h"
     56#include "SVGFilterPrimitiveStandardAttributes.h"
     57#include "SourceAlpha.h"
     58#endif
     59
    5360namespace WebCore {
    5461
     
    109116}
    110117
     118PassRefPtr<FilterEffect> FilterEffectRenderer::buildReferenceFilter(Document* document, PassRefPtr<FilterEffect> previousEffect, ReferenceFilterOperation* op)
     119{
     120#if ENABLE(SVG)
     121    CachedSVGDocument* cachedSVGDocument = static_cast<CachedSVGDocument*>(op->data());
     122
     123    // If we have an SVG document, this is an external reference. Otherwise
     124    // we look up the referenced node in the current document.
     125    if (cachedSVGDocument)
     126        document = cachedSVGDocument->document();
     127
     128    if (!document)
     129        return 0;
     130
     131    Element* filter = document->getElementById(op->fragment());
     132    if (!filter)
     133        return 0;
     134
     135    RefPtr<FilterEffect> effect;
     136
     137    // FIXME: Figure out what to do with SourceAlpha. Right now, we're
     138    // using the alpha of the original input layer, which is obviously
     139    // wrong. We should probably be extracting the alpha from the
     140    // previousEffect, but this requires some more processing. 
     141    // This may need a spec clarification.
     142    RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(previousEffect, SourceAlpha::create(this));
     143
     144    for (Node* node = filter->firstChild(); node; node = node->nextSibling()) {
     145        if (!node->isSVGElement())
     146            continue;
     147
     148        SVGElement* element = static_cast<SVGElement*>(node);
     149        if (!element->isFilterEffect())
     150            continue;
     151
     152        SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFilterPrimitiveStandardAttributes*>(element);
     153
     154        effect = effectElement->build(builder.get(), this);
     155        if (!effect)
     156            continue;
     157
     158        effectElement->setStandardAttributes(effect.get());
     159        builder->add(effectElement->result(), effect);
     160        m_effects.append(effect);
     161    }
     162    return effect;
     163#else
     164    return 0;
     165#endif
     166}
     167
    111168bool FilterEffectRenderer::build(Document* document, const FilterOperations& operations)
    112169{
     
    123180    m_effects.clear();
    124181
    125     RefPtr<FilterEffect> previousEffect;
     182    RefPtr<FilterEffect> previousEffect = m_sourceGraphic;
    126183    for (size_t i = 0; i < operations.operations().size(); ++i) {
    127184        RefPtr<FilterEffect> effect;
     
    129186        switch (filterOperation->getOperationType()) {
    130187        case FilterOperation::REFERENCE: {
    131             // FIXME: Not yet implemented.
    132             // https://bugs.webkit.org/show_bug.cgi?id=72443
     188            effect = buildReferenceFilter(document, previousEffect, static_cast<ReferenceFilterOperation*>(filterOperation));
    133189            break;
    134190        }
     
    292348            effect->setClipsToBounds(false);
    293349           
    294             if (previousEffect)
     350            if (filterOperation->getOperationType() != FilterOperation::REFERENCE) {
    295351                effect->inputEffects().append(previousEffect);
    296             m_effects.append(effect);
     352                m_effects.append(effect);
     353            }
    297354            previousEffect = effect.release();
    298355        }
     
    300357
    301358    // If we didn't make any effects, tell our caller we are not valid
    302     if (!previousEffect)
     359    if (!m_effects.size())
    303360        return false;
    304361
    305     m_effects.first()->inputEffects().append(m_sourceGraphic);
    306362    setMaxEffectRects(m_sourceDrawingRegion);
    307363   
  • trunk/Source/WebCore/rendering/FilterEffectRenderer.h

    r115138 r121513  
    101101
    102102    bool build(Document*, const FilterOperations&);
     103    PassRefPtr<FilterEffect> buildReferenceFilter(Document*, PassRefPtr<FilterEffect> previousEffect, ReferenceFilterOperation*);
    103104    bool updateBackingStoreRect(const FloatRect& filterRect);
    104105    void allocateBackingStoreIfNeeded();
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r121123 r121513  
    49954995        filterInfo()->removeCustomFilterClients();
    49964996#endif
    4997    
     4997
     4998#if ENABLE(SVG)
     4999    if (renderer()->style()->filter().hasReferenceFilter())
     5000        ensureFilterInfo()->updateReferenceFilterClients(renderer()->style()->filter());
     5001    else if (hasFilterInfo())
     5002        filterInfo()->removeReferenceFilterClients();
     5003#endif
     5004
    49985005    if (!paintsWithFilters()) {
    49995006        // Don't delete the whole filter info here, because we might use it
     
    50215028{
    50225029    renderer()->node()->setNeedsStyleRecalc(SyntheticStyleChange);
    5023     renderer()->repaint();
     5030    if (renderer()->view())
     5031        renderer()->repaint();
    50245032}
    50255033#endif
  • trunk/Source/WebCore/rendering/RenderLayerFilterInfo.cpp

    r115123 r121513  
    3636#include "RenderLayer.h"
    3737
     38#if ENABLE(SVG)
     39#include "CachedSVGDocument.h"
     40#include "SVGElement.h"
     41#include "SVGFilter.h"
     42#include "SVGFilterPrimitiveStandardAttributes.h"
     43#endif
     44
    3845#if ENABLE(CSS_SHADERS)
    3946#include "CustomFilterOperation.h"
     
    97104    removeCustomFilterClients();
    98105#endif
     106#if ENABLE(SVG)
     107    removeReferenceFilterClients();
     108#endif
    99109}
    100110
     
    103113    m_renderer = renderer;
    104114}
     115
     116#if ENABLE(SVG)
     117void RenderLayerFilterInfo::notifyFinished(CachedResource*)
     118{
     119    RenderObject* renderer = m_layer->renderer();
     120    renderer->node()->setNeedsStyleRecalc(SyntheticStyleChange);
     121    renderer->repaint();
     122}
     123
     124void RenderLayerFilterInfo::updateReferenceFilterClients(const FilterOperations& operations)
     125{
     126    removeReferenceFilterClients();
     127    for (size_t i = 0; i < operations.size(); ++i) {
     128        RefPtr<FilterOperation> filterOperation = operations.operations().at(i);
     129        if (filterOperation->getOperationType() != FilterOperation::REFERENCE)
     130            continue;
     131        ReferenceFilterOperation* referenceFilterOperation = static_cast<ReferenceFilterOperation*>(filterOperation.get());
     132        CachedSVGDocument* cachedSVGDocument = static_cast<CachedSVGDocument*>(referenceFilterOperation->data());
     133
     134        if (cachedSVGDocument) {
     135            // Reference is external; wait for notifyFinished().
     136            cachedSVGDocument->addClient(this);
     137            m_externalSVGReferences.append(cachedSVGDocument);
     138        } else {
     139            // Reference is internal; add layer as a client so we can trigger
     140            // filter repaint on SVG attribute change.
     141            Element* filter = m_layer->renderer()->node()->document()->getElementById(referenceFilterOperation->fragment());
     142            if (!filter || !filter->renderer())
     143                continue;
     144            ASSERT(filter->renderer()->isSVGResourceContainer());
     145            filter->renderer()->toRenderSVGResourceContainer()->addClientRenderLayer(m_layer);
     146            m_internalSVGReferences.append(filter);
     147        }
     148    }
     149}
     150
     151void RenderLayerFilterInfo::removeReferenceFilterClients()
     152{
     153    for (size_t i = 0; i < m_externalSVGReferences.size(); ++i)
     154        m_externalSVGReferences.at(i)->removeClient(this);
     155    m_externalSVGReferences.clear();
     156    for (size_t i = 0; i < m_internalSVGReferences.size(); ++i) {
     157        Element* filter = m_internalSVGReferences.at(i).get();
     158        if (!filter->renderer())
     159            continue;
     160        filter->renderer()->toRenderSVGResourceContainer()->removeClientRenderLayer(m_layer);
     161    }
     162    m_internalSVGReferences.clear();
     163}
     164#endif
    105165
    106166#if ENABLE(CSS_SHADERS)
  • trunk/Source/WebCore/rendering/RenderLayerFilterInfo.h

    r115123 r121513  
    3333#if ENABLE(CSS_FILTERS)
    3434
     35#if ENABLE(SVG)
     36#include "CachedSVGDocument.h"
     37#endif
     38#include "FilterOperation.h"
    3539#include "LayoutTypes.h"
    3640#include <wtf/HashMap.h>
     
    5458#if ENABLE(CSS_SHADERS)
    5559    : public CustomFilterProgramClient
     60#if ENABLE(SVG)
     61    , public CachedSVGDocumentClient
     62#endif
     63#elif ENABLE(SVG)
     64    : public CachedSVGDocumentClient
    5665#endif
    5766{
     
    7685#endif
    7786
    78    
     87#if ENABLE(SVG)
     88    void updateReferenceFilterClients(const FilterOperations&);
     89    virtual void notifyFinished(CachedResource*);
     90    void removeReferenceFilterClients();
     91#endif
     92
    7993private:
    8094    RenderLayerFilterInfo(RenderLayer*);
     
    92106   
    93107    static RenderLayerFilterInfoMap* s_filterMap;
     108#if ENABLE(SVG)
     109    Vector<RefPtr<Element> > m_internalSVGReferences;
     110    Vector<CachedResourceHandle<CachedSVGDocument> > m_externalSVGReferences;
     111#endif
    94112};
    95113
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp

    r120706 r121513  
    2323#include "RenderSVGResourceContainer.h"
    2424
     25#include "RenderLayer.h"
    2526#include "RenderSVGRoot.h"
    2627#include "RenderView.h"
     
    9293void RenderSVGResourceContainer::markAllClientsForInvalidation(InvalidationMode mode)
    9394{
    94     if (m_clients.isEmpty() || m_isInvalidating)
     95    if ((m_clients.isEmpty() && m_clientLayers.isEmpty()) || m_isInvalidating)
    9596        return;
    9697
     
    112113        RenderSVGResource::markForLayoutAndParentResourceInvalidation(client, needsLayout);
    113114    }
     115
     116#if ENABLE(CSS_FILTERS)
     117    HashSet<RenderLayer*>::iterator layerEnd = m_clientLayers.end();
     118    for (HashSet<RenderLayer*>::iterator it = m_clientLayers.begin(); it != layerEnd; ++it)
     119        (*it)->filterNeedsRepaint();
     120#endif
     121
    114122    m_isInvalidating = false;
    115123}
     
    146154}
    147155
     156void RenderSVGResourceContainer::addClientRenderLayer(RenderLayer* client)
     157{
     158    ASSERT(client);
     159    m_clientLayers.add(client);
     160}
     161
     162void RenderSVGResourceContainer::removeClientRenderLayer(RenderLayer* client)
     163{
     164    ASSERT(client);
     165    m_clientLayers.remove(client);
     166}
     167
    148168void RenderSVGResourceContainer::registerResource()
    149169{
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceContainer.h

    r120314 r121513  
    2727namespace WebCore {
    2828
     29class RenderLayer;
     30
    2931class RenderSVGResourceContainer : public RenderSVGHiddenContainer,
    3032                                   public RenderSVGResource {
     
    4345
    4446    void idChanged();
     47    void addClientRenderLayer(RenderLayer*);
     48    void removeClientRenderLayer(RenderLayer*);
    4549
    4650protected:
     
    6973    bool m_isInvalidating : 1;
    7074    HashSet<RenderObject*> m_clients;
     75    HashSet<RenderLayer*> m_clientLayers;
    7176};
    7277
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp

    r111674 r121513  
    3939#include "RenderSVGResource.h"
    4040#include "RenderSVGResourceFilterPrimitive.h"
    41 #include "Settings.h"
    4241#include "SVGElement.h"
    4342#include "SVGFilter.h"
     
    4847#include "SVGStyledElement.h"
    4948#include "SVGUnitTypes.h"
     49#include "Settings.h"
     50#include "SourceAlpha.h"
     51#include "SourceGraphic.h"
    5052
    5153#include <wtf/UnusedParam.h>
     
    102104
    103105    // Add effects to the builder
    104     RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(filter);
     106    RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(SourceGraphic::create(filter), SourceAlpha::create(filter));
    105107    for (Node* node = filterElement->firstChild(); node; node = node->nextSibling()) {
    106108        if (!node->isSVGElement())
  • trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp

    r95901 r121513  
    3232namespace WebCore {
    3333
    34 SVGFilterBuilder::SVGFilterBuilder(Filter* filter)
     34SVGFilterBuilder::SVGFilterBuilder(PassRefPtr<FilterEffect> sourceGraphic, PassRefPtr<FilterEffect> sourceAlpha)
    3535{
    36     m_builtinEffects.add(SourceGraphic::effectName(), SourceGraphic::create(filter));
    37     m_builtinEffects.add(SourceAlpha::effectName(), SourceAlpha::create(filter));
     36    m_builtinEffects.add(SourceGraphic::effectName(), sourceGraphic);
     37    m_builtinEffects.add(SourceAlpha::effectName(), sourceAlpha);
    3838    addBuiltinEffects();
    3939}
  • trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.h

    r95901 r121513  
    3838    typedef HashSet<FilterEffect*> FilterEffectSet;
    3939
    40     static PassRefPtr<SVGFilterBuilder> create(Filter* filter) { return adoptRef(new SVGFilterBuilder(filter)); }
     40    static PassRefPtr<SVGFilterBuilder> create(PassRefPtr<FilterEffect> sourceGraphic, PassRefPtr<FilterEffect> sourceAlpha) { return adoptRef(new SVGFilterBuilder(sourceGraphic, sourceAlpha)); }
    4141
    4242    void add(const AtomicString& id, PassRefPtr<FilterEffect>);
     
    6161
    6262private:
    63     SVGFilterBuilder(Filter*);
     63    SVGFilterBuilder(PassRefPtr<FilterEffect> sourceGraphic, PassRefPtr<FilterEffect> sourceAlpha);
    6464
    6565    inline void addBuiltinEffects()
Note: See TracChangeset for help on using the changeset viewer.