haikuwebkit/LayoutTests/css3/filters/effect-reference-delete-cra...

28 lines
835 B
HTML
Raw Permalink Normal View History

CSS url() filters with forward references don't work https://bugs.webkit.org/show_bug.cgi?id=90405 Based on a patch by Keyar Hood. Reviewed by Dirk Schulze. Source/WebCore: In order for CSS to reference SVG filters that will occur later in the document, or will be added at a future time, we need a way to notify the target element (the one the filter style is applied to) when the correct SVG filter is added to the DOM. There is already code for SVG elements that handles this problem, in SVGResourcesCache. This patch allows any element to have a reference to an SVG element in SVGResourceCache. Tests: css3/filters/effect-reference-after.html css3/filters/effect-reference-delete-crash.html css3/filters/effect-reference-delete.html css3/filters/effect-reference-removed-while-pending-resources.html css3/filters/effect-reference-rename.html css3/filters/effect-reference-reset-style-delete-crash.html svg/filters/filter-cycle.html * dom/Element.cpp: (WebCore::Element::~Element): (WebCore::Element::removedFrom): When an Element is deleted or removed from its container, and it has pending resources, remove it from the SVGResourceCache resources on deletion or when removed from its container. (WebCore::Element::hasPendingResources): (WebCore::Element::setHasPendingResources): (WebCore::Element::clearHasPendingResources): Accessors for ElementRareData's new bit flag. * dom/Element.h: (WebCore::Element::buildPendingResource): Virtual function to override for referenced elements (moved from SVGElement). * dom/ElementRareData.h: (WebCore::ElementRareData::hasPendingResources): (WebCore::ElementRareData::setHasPendingResources): (WebCore::ElementRareData::ElementRareData): Add a new bit flag to indicate whether the element depends on pending resources or not, and accessors. * dom/NodeRareData.h: (WebCore::NodeRareData::NodeRareData): (NodeRareData): The actual flag bit lives in NodeRareData, so it compacts better with other flags. * platform/graphics/texmap/TextureMapperImageBuffer.cpp: (WebCore::BitmapTextureImageBuffer::applyFilters): Changed to the new function signature for FilterEffectRenderer::build(). * rendering/FilterEffectRenderer.cpp: (WebCore::createCustomFilterEffect): (WebCore::FilterEffectRenderer::buildReferenceFilter): Changed signature to accept a RenderObject rather than a Document, so we know which node to notify when the SVG filter arrives. If the referenced filter cannot be found, add its id as a pending reference. (WebCore::FilterEffectRenderer::build): * rendering/FilterEffectRenderer.h: Change to signatures of build() and buildReferenceFilter() to pass * rendering/RenderLayer.cpp: (WebCore::RenderLayer::updateOrRemoveFilterEffectRenderer): Use the new semantics for FilterEffectRenderer::build(). * rendering/svg/RenderSVGResourceContainer.cpp: (WebCore::RenderSVGResourceContainer::registerResource): Call clearHasPendingResourceIfPossible on the SVGDocumentExtensions, not on the element, since we want to support generic Elements. * rendering/svg/SVGResourcesCache.cpp: (WebCore::SVGResourcesCache::addResourcesFromRenderObject): (WebCore::SVGResourcesCache::clientStyleChanged): For non-SVG elements, set a synthetic style change when parent resources are invalidated. (WebCore::SVGResourcesCache::resourceDestroyed): Add support for non-SVG Elements. * svg/SVGDocumentExtensions.cpp: (WebCore::SVGDocumentExtensions::addPendingResource): (WebCore::SVGDocumentExtensions::isElementPendingResources): (WebCore::SVGDocumentExtensions::isElementPendingResource): Changed to allow use of Element instead of SVGElement. (WebCore::SVGDocumentExtensions::clearHasPendingResourcesIfPossible): Moved from SVGElement, and made to work on any Element. This way, we avoid adding this function to Element itself. (WebCore::SVGDocumentExtensions::removeElementFromPendingResources): (WebCore::SVGDocumentExtensions::removeElementFromPendingResourcesForRemoval): Changed to allow use of Element instead of SVGElement. * svg/SVGDocumentExtensions.h: SVGElement -> Element. * svg/SVGElement.cpp: (WebCore::SVGElement::~SVGElement): (WebCore::SVGElement::removedFrom): Don't handle pending resource notifications (Element will do it). * svg/SVGElement.h: All functions moved to Element, except for clearHasPendingResourcesIfPossible() moved to SVGDocumentExtensions. * svg/SVGElementRareData.h: (WebCore::SVGElementRareData::SVGElementRareData): m_hasPendingResources and accessors moved to ElementRareData. * svg/SVGStyledElement.cpp: (WebCore::SVGStyledElement::buildPendingResourcesIfNeeded): SVGElement -> Element, and call SVGDocumentExtensions for clearHasPendingResourcesIfPossible(). LayoutTests: * css3/filters/effect-reference-after-expected.html: Added. * css3/filters/effect-reference-after.html: Added. * css3/filters/effect-reference-delete-crash.html: Added. * css3/filters/effect-reference-delete-expected.html: Added. * css3/filters/effect-reference-delete.html: Added. * css3/filters/effect-reference-removed-while-pending-resources-expected.html: Added. * css3/filters/effect-reference-removed-while-pending-resources.html: Added. * css3/filters/effect-reference-rename-expected.html: Added. * css3/filters/effect-reference-rename.html: Added. * css3/filters/effect-reference-reset-style-delete-crash-expected.txt: Added. * css3/filters/effect-reference-reset-style-delete-crash.html: Added. * css3/filters/script-tests/effect-reference-delete-crash.js: Added. * css3/filters/script-tests/effect-reference-reset-style-delete-crash.js: Added. * svg/filters/filter-cycle-expected.html: Added. * svg/filters/filter-cycle.html: Added. Canonical link: https://commits.webkit.org/124298@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@138823 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-01-04 19:48:10 +00:00
<!DOCTYPE html>
<html>
<head>
Change LayoutTests' c* files to use pre and post js files in LayoutTests/resources. https://bugs.webkit.org/show_bug.cgi?id=120986. Rubber stamped by Filip Pizlo. * canvas/philip/tests/2d.composite.globalComposite.html: * compositing/repaint/shrink-layer.html: * css1/units/rounding.html: * css3/calc/color-hsl.html: * css3/calc/color-rgb.html: * css3/calc/font-size-fractional.html: * css3/calc/font-size.html: * css3/calc/font.html: * css3/calc/getComputedStyle-margin-percentage.html: * css3/calc/line-height.html: * css3/calc/margin.html: * css3/calc/table-border-spacing.html: * css3/calc/table-calcs.html: * css3/calc/zoom-with-em.html: * css3/compositing/background-blend-mode-property-parsing.html: * css3/compositing/background-blend-mode-property.html: * css3/compositing/blend-mode-property-parsing-invalid.html: * css3/compositing/blend-mode-property-parsing.html: * css3/compositing/blend-mode-property.html: * css3/compositing/should-have-compositing-layer.html: * css3/filters/custom-with-at-rule-syntax/parsing-at-rule-invalid.html: * css3/filters/custom-with-at-rule-syntax/parsing-at-rule-valid.html: * css3/filters/custom-with-at-rule-syntax/parsing-custom-function-invalid.html: * css3/filters/custom-with-at-rule-syntax/parsing-custom-function-valid.html: * css3/filters/custom-with-at-rule-syntax/parsing-geometry-property-invalid.html: * css3/filters/custom-with-at-rule-syntax/parsing-geometry-property-valid.html: * css3/filters/custom-with-at-rule-syntax/parsing-mix-property-invalid.html: * css3/filters/custom-with-at-rule-syntax/parsing-mix-property-valid.html: * css3/filters/custom-with-at-rule-syntax/parsing-parameters-property-invalid.html: * css3/filters/custom-with-at-rule-syntax/parsing-parameters-property-valid.html: * css3/filters/custom-with-at-rule-syntax/parsing-src-property-invalid.html: * css3/filters/custom-with-at-rule-syntax/parsing-src-property-valid.html: * css3/filters/custom/custom-filter-crash-inline-computed-style.html: * css3/filters/custom/custom-filter-mix-bindings.html: * css3/filters/custom/custom-filter-property-computed-style.html: * css3/filters/custom/custom-filter-property-parsing-invalid.html: * css3/filters/custom/custom-filter-property-parsing.html: * css3/filters/custom/effect-custom-disabled.html: * css3/filters/effect-reference-delete-crash.html: * css3/filters/effect-reference-reset-style-delete-crash.html: * css3/filters/filter-property-computed-style.html: * css3/filters/filter-property-parsing-invalid.html: * css3/filters/filter-property-parsing.html: * css3/filters/filter-property.html: * css3/filters/script-tests/TEMPLATE.html: * css3/filters/should-not-have-compositing-layer.html: * css3/flexbox/align-absolute-child.html: * css3/flexbox/css-properties.html: * css3/flexbox/display-flexbox-set-get.html: * css3/flexbox/flex-align-baseline.html: * css3/flexbox/flex-flow-initial.html: * css3/flexbox/flex-longhand-parsing.html: * css3/flexbox/flex-property-parsing.html: * css3/flexbox/flexitem-no-margin-collapsing.html: * css3/flexbox/overflow-keep-scrollpos.html: * css3/font-feature-settings-parsing.html: * css3/supports-cssom.html: * css3/supports-dom-api.html: * css3/supports.html: * css3/unicode-bidi-insolate-parse.html: * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-getStyle.html: * css3/zoom-coords.xhtml: Canonical link: https://commits.webkit.org/138879@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155275 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-09-08 02:07:30 +00:00
<script src="../../resources/js-test-pre.js"></script>
CSS url() filters with forward references don't work https://bugs.webkit.org/show_bug.cgi?id=90405 Based on a patch by Keyar Hood. Reviewed by Dirk Schulze. Source/WebCore: In order for CSS to reference SVG filters that will occur later in the document, or will be added at a future time, we need a way to notify the target element (the one the filter style is applied to) when the correct SVG filter is added to the DOM. There is already code for SVG elements that handles this problem, in SVGResourcesCache. This patch allows any element to have a reference to an SVG element in SVGResourceCache. Tests: css3/filters/effect-reference-after.html css3/filters/effect-reference-delete-crash.html css3/filters/effect-reference-delete.html css3/filters/effect-reference-removed-while-pending-resources.html css3/filters/effect-reference-rename.html css3/filters/effect-reference-reset-style-delete-crash.html svg/filters/filter-cycle.html * dom/Element.cpp: (WebCore::Element::~Element): (WebCore::Element::removedFrom): When an Element is deleted or removed from its container, and it has pending resources, remove it from the SVGResourceCache resources on deletion or when removed from its container. (WebCore::Element::hasPendingResources): (WebCore::Element::setHasPendingResources): (WebCore::Element::clearHasPendingResources): Accessors for ElementRareData's new bit flag. * dom/Element.h: (WebCore::Element::buildPendingResource): Virtual function to override for referenced elements (moved from SVGElement). * dom/ElementRareData.h: (WebCore::ElementRareData::hasPendingResources): (WebCore::ElementRareData::setHasPendingResources): (WebCore::ElementRareData::ElementRareData): Add a new bit flag to indicate whether the element depends on pending resources or not, and accessors. * dom/NodeRareData.h: (WebCore::NodeRareData::NodeRareData): (NodeRareData): The actual flag bit lives in NodeRareData, so it compacts better with other flags. * platform/graphics/texmap/TextureMapperImageBuffer.cpp: (WebCore::BitmapTextureImageBuffer::applyFilters): Changed to the new function signature for FilterEffectRenderer::build(). * rendering/FilterEffectRenderer.cpp: (WebCore::createCustomFilterEffect): (WebCore::FilterEffectRenderer::buildReferenceFilter): Changed signature to accept a RenderObject rather than a Document, so we know which node to notify when the SVG filter arrives. If the referenced filter cannot be found, add its id as a pending reference. (WebCore::FilterEffectRenderer::build): * rendering/FilterEffectRenderer.h: Change to signatures of build() and buildReferenceFilter() to pass * rendering/RenderLayer.cpp: (WebCore::RenderLayer::updateOrRemoveFilterEffectRenderer): Use the new semantics for FilterEffectRenderer::build(). * rendering/svg/RenderSVGResourceContainer.cpp: (WebCore::RenderSVGResourceContainer::registerResource): Call clearHasPendingResourceIfPossible on the SVGDocumentExtensions, not on the element, since we want to support generic Elements. * rendering/svg/SVGResourcesCache.cpp: (WebCore::SVGResourcesCache::addResourcesFromRenderObject): (WebCore::SVGResourcesCache::clientStyleChanged): For non-SVG elements, set a synthetic style change when parent resources are invalidated. (WebCore::SVGResourcesCache::resourceDestroyed): Add support for non-SVG Elements. * svg/SVGDocumentExtensions.cpp: (WebCore::SVGDocumentExtensions::addPendingResource): (WebCore::SVGDocumentExtensions::isElementPendingResources): (WebCore::SVGDocumentExtensions::isElementPendingResource): Changed to allow use of Element instead of SVGElement. (WebCore::SVGDocumentExtensions::clearHasPendingResourcesIfPossible): Moved from SVGElement, and made to work on any Element. This way, we avoid adding this function to Element itself. (WebCore::SVGDocumentExtensions::removeElementFromPendingResources): (WebCore::SVGDocumentExtensions::removeElementFromPendingResourcesForRemoval): Changed to allow use of Element instead of SVGElement. * svg/SVGDocumentExtensions.h: SVGElement -> Element. * svg/SVGElement.cpp: (WebCore::SVGElement::~SVGElement): (WebCore::SVGElement::removedFrom): Don't handle pending resource notifications (Element will do it). * svg/SVGElement.h: All functions moved to Element, except for clearHasPendingResourcesIfPossible() moved to SVGDocumentExtensions. * svg/SVGElementRareData.h: (WebCore::SVGElementRareData::SVGElementRareData): m_hasPendingResources and accessors moved to ElementRareData. * svg/SVGStyledElement.cpp: (WebCore::SVGStyledElement::buildPendingResourcesIfNeeded): SVGElement -> Element, and call SVGDocumentExtensions for clearHasPendingResourcesIfPossible(). LayoutTests: * css3/filters/effect-reference-after-expected.html: Added. * css3/filters/effect-reference-after.html: Added. * css3/filters/effect-reference-delete-crash.html: Added. * css3/filters/effect-reference-delete-expected.html: Added. * css3/filters/effect-reference-delete.html: Added. * css3/filters/effect-reference-removed-while-pending-resources-expected.html: Added. * css3/filters/effect-reference-removed-while-pending-resources.html: Added. * css3/filters/effect-reference-rename-expected.html: Added. * css3/filters/effect-reference-rename.html: Added. * css3/filters/effect-reference-reset-style-delete-crash-expected.txt: Added. * css3/filters/effect-reference-reset-style-delete-crash.html: Added. * css3/filters/script-tests/effect-reference-delete-crash.js: Added. * css3/filters/script-tests/effect-reference-reset-style-delete-crash.js: Added. * svg/filters/filter-cycle-expected.html: Added. * svg/filters/filter-cycle.html: Added. Canonical link: https://commits.webkit.org/124298@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@138823 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-01-04 19:48:10 +00:00
</head>
<body>
<img id="html" style="-webkit-filter: url(#MyFilter); filter: url(#MyFilter);" src="resources/reference.png">
<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0" version="1.1" id="svg">
<defs>
<filter id="MyFilter">
<feColorMatrix type="hueRotate" values="180"/>
</filter>
</defs>
</svg>
Remove WebKitCSSFilterValue to make Hyatt happy https://bugs.webkit.org/show_bug.cgi?id=164289 <rdar://problems/29050973> Reviewed by Simon Fraser. Source/WebCore: The new CSS parser should not use WebKitCSSFilterValue. It's non-standard, very likely only used in our tests, doesn't provide much benefit, and will be covered by the new CSSOM function interface. Covered by modifying existing tests. * DerivedSources.make: Remove WebKitCSSFilterValue.idl. * WebCore.xcodeproj/project.pbxproj: Make CSSFunctionValue.h private so API testing can see it. * bindings/js/JSCSSValueCustom.cpp: (WebCore::toJSNewlyCreated): No WebKitCSSFilterValue. * css/CSSComputedStyleDeclaration.cpp: Use CSSFunctionValue or CSSPrimitiveValue to build up the computed style. (WebCore::ComputedStyleExtractor::valueForFilter): * css/CSSValue.cpp: No WebKitCSSFilterValue. (WebCore::CSSValue::equals): (WebCore::CSSValue::cssText): (WebCore::CSSValue::destroy): (WebCore::CSSValue::cloneForCSSOM): * css/CSSValue.h: (WebCore::CSSValue::isFilterImageValue): (WebCore::CSSValue::isWebKitCSSFilterValue): Deleted. * css/StyleResolver.cpp: Resolve against CSSFunctionValues with CSSValueIDs as name, rather than WebKitCSSFilterValue. (WebCore::filterOperationForType): (WebCore::StyleResolver::createFilterOperations): * css/StyleResolver.h: * css/WebKitCSSFilterValue.cpp: Removed. * css/WebKitCSSFilterValue.h: Removed. * css/WebKitCSSFilterValue.idl: Removed. * css/parser/CSSParser.cpp: Parse into CSSPrimitiveValue and CSSFunctionValue. (WebCore::isValidPrimitiveFilterFunction): (WebCore::CSSParser::parseBuiltinFilterArguments): (WebCore::cssValueKeywordIDForFunctionName): (WebCore::CSSParser::parseFilter): (WebCore::filterInfoForName): Deleted. * css/parser/CSSParser.h: * css/parser/CSSPropertyParser.cpp: (WebCore::consumeFilterFunction): LayoutTests: Update the filters tests now that WebKitCSSFilterValue no longer exists. Unfortunately CSSFunctionValue isn't exposed to the Web, so we just rely on the cssText of the resulting CSSStyleDeclaration. I also moved all the script-tests into the HTML files, since there is no point them being separate. * css3/filters/backdrop/backdropfilter-property-computed-style-expected.txt: * css3/filters/backdrop/backdropfilter-property-computed-style.html: * css3/filters/backdrop/backdropfilter-property-parsing-expected.txt: * css3/filters/backdrop/backdropfilter-property-parsing-invalid.html: * css3/filters/backdrop/backdropfilter-property-parsing.html: * css3/filters/backdrop/backdropfilter-property.html: * css3/filters/backdrop/script-tests/backdropfilter-property-computed-style.js: Removed. * css3/filters/backdrop/script-tests/backdropfilter-property-parsing-invalid.js: Removed. * css3/filters/backdrop/script-tests/backdropfilter-property-parsing.js: Removed. * css3/filters/backdrop/script-tests/backdropfilter-property.js: Removed. * css3/filters/effect-reference-delete-crash.html: * css3/filters/effect-reference-reset-style-delete-crash.html: * css3/filters/filter-property-computed-style-expected.txt: * css3/filters/filter-property-computed-style.html: * css3/filters/filter-property-parsing-expected.txt: * css3/filters/filter-property-parsing-invalid.html: * css3/filters/filter-property-parsing.html: * css3/filters/filter-property.html: * css3/filters/script-tests/TEMPLATE.html: Removed. * css3/filters/script-tests/effect-reference-delete-crash.js: Removed. * css3/filters/script-tests/effect-reference-reset-style-delete-crash.js: Removed. * css3/filters/script-tests/filter-property-computed-style.js: Removed. * css3/filters/script-tests/filter-property-parsing-invalid.js: Removed. * css3/filters/script-tests/filter-property-parsing.js: Removed. * css3/filters/script-tests/filter-property.js: Removed. * css3/filters/script-tests/unprefixed.js: Removed. * css3/filters/unprefixed-expected.txt: * css3/filters/unprefixed.html: Canonical link: https://commits.webkit.org/182019@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-01 22:31:52 +00:00
<script>
description("Test that no crash occurs when a SVG filter is deleted that was referenced by a deleted HTML element.");
html = document.getElementById('html');
html.parentNode.removeChild(html);
svg = document.getElementById('svg');
svg.parentNode.removeChild(svg);
successfullyParsed = true;
</script>
Change LayoutTests' c* files to use pre and post js files in LayoutTests/resources. https://bugs.webkit.org/show_bug.cgi?id=120986. Rubber stamped by Filip Pizlo. * canvas/philip/tests/2d.composite.globalComposite.html: * compositing/repaint/shrink-layer.html: * css1/units/rounding.html: * css3/calc/color-hsl.html: * css3/calc/color-rgb.html: * css3/calc/font-size-fractional.html: * css3/calc/font-size.html: * css3/calc/font.html: * css3/calc/getComputedStyle-margin-percentage.html: * css3/calc/line-height.html: * css3/calc/margin.html: * css3/calc/table-border-spacing.html: * css3/calc/table-calcs.html: * css3/calc/zoom-with-em.html: * css3/compositing/background-blend-mode-property-parsing.html: * css3/compositing/background-blend-mode-property.html: * css3/compositing/blend-mode-property-parsing-invalid.html: * css3/compositing/blend-mode-property-parsing.html: * css3/compositing/blend-mode-property.html: * css3/compositing/should-have-compositing-layer.html: * css3/filters/custom-with-at-rule-syntax/parsing-at-rule-invalid.html: * css3/filters/custom-with-at-rule-syntax/parsing-at-rule-valid.html: * css3/filters/custom-with-at-rule-syntax/parsing-custom-function-invalid.html: * css3/filters/custom-with-at-rule-syntax/parsing-custom-function-valid.html: * css3/filters/custom-with-at-rule-syntax/parsing-geometry-property-invalid.html: * css3/filters/custom-with-at-rule-syntax/parsing-geometry-property-valid.html: * css3/filters/custom-with-at-rule-syntax/parsing-mix-property-invalid.html: * css3/filters/custom-with-at-rule-syntax/parsing-mix-property-valid.html: * css3/filters/custom-with-at-rule-syntax/parsing-parameters-property-invalid.html: * css3/filters/custom-with-at-rule-syntax/parsing-parameters-property-valid.html: * css3/filters/custom-with-at-rule-syntax/parsing-src-property-invalid.html: * css3/filters/custom-with-at-rule-syntax/parsing-src-property-valid.html: * css3/filters/custom/custom-filter-crash-inline-computed-style.html: * css3/filters/custom/custom-filter-mix-bindings.html: * css3/filters/custom/custom-filter-property-computed-style.html: * css3/filters/custom/custom-filter-property-parsing-invalid.html: * css3/filters/custom/custom-filter-property-parsing.html: * css3/filters/custom/effect-custom-disabled.html: * css3/filters/effect-reference-delete-crash.html: * css3/filters/effect-reference-reset-style-delete-crash.html: * css3/filters/filter-property-computed-style.html: * css3/filters/filter-property-parsing-invalid.html: * css3/filters/filter-property-parsing.html: * css3/filters/filter-property.html: * css3/filters/script-tests/TEMPLATE.html: * css3/filters/should-not-have-compositing-layer.html: * css3/flexbox/align-absolute-child.html: * css3/flexbox/css-properties.html: * css3/flexbox/display-flexbox-set-get.html: * css3/flexbox/flex-align-baseline.html: * css3/flexbox/flex-flow-initial.html: * css3/flexbox/flex-longhand-parsing.html: * css3/flexbox/flex-property-parsing.html: * css3/flexbox/flexitem-no-margin-collapsing.html: * css3/flexbox/overflow-keep-scrollpos.html: * css3/font-feature-settings-parsing.html: * css3/supports-cssom.html: * css3/supports-dom-api.html: * css3/supports.html: * css3/unicode-bidi-insolate-parse.html: * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-getStyle.html: * css3/zoom-coords.xhtml: Canonical link: https://commits.webkit.org/138879@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155275 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-09-08 02:07:30 +00:00
<script src="../../resources/js-test-post.js"></script>
CSS url() filters with forward references don't work https://bugs.webkit.org/show_bug.cgi?id=90405 Based on a patch by Keyar Hood. Reviewed by Dirk Schulze. Source/WebCore: In order for CSS to reference SVG filters that will occur later in the document, or will be added at a future time, we need a way to notify the target element (the one the filter style is applied to) when the correct SVG filter is added to the DOM. There is already code for SVG elements that handles this problem, in SVGResourcesCache. This patch allows any element to have a reference to an SVG element in SVGResourceCache. Tests: css3/filters/effect-reference-after.html css3/filters/effect-reference-delete-crash.html css3/filters/effect-reference-delete.html css3/filters/effect-reference-removed-while-pending-resources.html css3/filters/effect-reference-rename.html css3/filters/effect-reference-reset-style-delete-crash.html svg/filters/filter-cycle.html * dom/Element.cpp: (WebCore::Element::~Element): (WebCore::Element::removedFrom): When an Element is deleted or removed from its container, and it has pending resources, remove it from the SVGResourceCache resources on deletion or when removed from its container. (WebCore::Element::hasPendingResources): (WebCore::Element::setHasPendingResources): (WebCore::Element::clearHasPendingResources): Accessors for ElementRareData's new bit flag. * dom/Element.h: (WebCore::Element::buildPendingResource): Virtual function to override for referenced elements (moved from SVGElement). * dom/ElementRareData.h: (WebCore::ElementRareData::hasPendingResources): (WebCore::ElementRareData::setHasPendingResources): (WebCore::ElementRareData::ElementRareData): Add a new bit flag to indicate whether the element depends on pending resources or not, and accessors. * dom/NodeRareData.h: (WebCore::NodeRareData::NodeRareData): (NodeRareData): The actual flag bit lives in NodeRareData, so it compacts better with other flags. * platform/graphics/texmap/TextureMapperImageBuffer.cpp: (WebCore::BitmapTextureImageBuffer::applyFilters): Changed to the new function signature for FilterEffectRenderer::build(). * rendering/FilterEffectRenderer.cpp: (WebCore::createCustomFilterEffect): (WebCore::FilterEffectRenderer::buildReferenceFilter): Changed signature to accept a RenderObject rather than a Document, so we know which node to notify when the SVG filter arrives. If the referenced filter cannot be found, add its id as a pending reference. (WebCore::FilterEffectRenderer::build): * rendering/FilterEffectRenderer.h: Change to signatures of build() and buildReferenceFilter() to pass * rendering/RenderLayer.cpp: (WebCore::RenderLayer::updateOrRemoveFilterEffectRenderer): Use the new semantics for FilterEffectRenderer::build(). * rendering/svg/RenderSVGResourceContainer.cpp: (WebCore::RenderSVGResourceContainer::registerResource): Call clearHasPendingResourceIfPossible on the SVGDocumentExtensions, not on the element, since we want to support generic Elements. * rendering/svg/SVGResourcesCache.cpp: (WebCore::SVGResourcesCache::addResourcesFromRenderObject): (WebCore::SVGResourcesCache::clientStyleChanged): For non-SVG elements, set a synthetic style change when parent resources are invalidated. (WebCore::SVGResourcesCache::resourceDestroyed): Add support for non-SVG Elements. * svg/SVGDocumentExtensions.cpp: (WebCore::SVGDocumentExtensions::addPendingResource): (WebCore::SVGDocumentExtensions::isElementPendingResources): (WebCore::SVGDocumentExtensions::isElementPendingResource): Changed to allow use of Element instead of SVGElement. (WebCore::SVGDocumentExtensions::clearHasPendingResourcesIfPossible): Moved from SVGElement, and made to work on any Element. This way, we avoid adding this function to Element itself. (WebCore::SVGDocumentExtensions::removeElementFromPendingResources): (WebCore::SVGDocumentExtensions::removeElementFromPendingResourcesForRemoval): Changed to allow use of Element instead of SVGElement. * svg/SVGDocumentExtensions.h: SVGElement -> Element. * svg/SVGElement.cpp: (WebCore::SVGElement::~SVGElement): (WebCore::SVGElement::removedFrom): Don't handle pending resource notifications (Element will do it). * svg/SVGElement.h: All functions moved to Element, except for clearHasPendingResourcesIfPossible() moved to SVGDocumentExtensions. * svg/SVGElementRareData.h: (WebCore::SVGElementRareData::SVGElementRareData): m_hasPendingResources and accessors moved to ElementRareData. * svg/SVGStyledElement.cpp: (WebCore::SVGStyledElement::buildPendingResourcesIfNeeded): SVGElement -> Element, and call SVGDocumentExtensions for clearHasPendingResourcesIfPossible(). LayoutTests: * css3/filters/effect-reference-after-expected.html: Added. * css3/filters/effect-reference-after.html: Added. * css3/filters/effect-reference-delete-crash.html: Added. * css3/filters/effect-reference-delete-expected.html: Added. * css3/filters/effect-reference-delete.html: Added. * css3/filters/effect-reference-removed-while-pending-resources-expected.html: Added. * css3/filters/effect-reference-removed-while-pending-resources.html: Added. * css3/filters/effect-reference-rename-expected.html: Added. * css3/filters/effect-reference-rename.html: Added. * css3/filters/effect-reference-reset-style-delete-crash-expected.txt: Added. * css3/filters/effect-reference-reset-style-delete-crash.html: Added. * css3/filters/script-tests/effect-reference-delete-crash.js: Added. * css3/filters/script-tests/effect-reference-reset-style-delete-crash.js: Added. * svg/filters/filter-cycle-expected.html: Added. * svg/filters/filter-cycle.html: Added. Canonical link: https://commits.webkit.org/124298@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@138823 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-01-04 19:48:10 +00:00
</body>
</html>