source: webkit/trunk/Source/WebCore/css/CSSValuePool.h

Last change on this file was 286795, checked in by [email protected], 3 years ago

Unprefix -webkit-mask
https://bugs.webkit.org/show_bug.cgi?id=229082

Patch by Matt Woodrow <[email protected]> on 2021-12-09
Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

  • web-platform-tests/css/css-masking/animations/mask-image-interpolation-expected.txt:
  • web-platform-tests/css/css-masking/animations/mask-position-interpolation-expected.txt:
  • web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-expected.html:
  • web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-filter-expected.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-expected.html.
  • web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-filter.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation.html.
  • web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-incompatible-shapes1-expected.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-expected.html.
  • web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-incompatible-shapes1.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation.html.
  • web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-incompatible-shapes2-expected.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-expected.html.
  • web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-incompatible-shapes2.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation.html.
  • web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-overflow-expected.html: Added.
  • web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-overflow.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation.html.
  • web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-three-keyframes1-expected.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-expected.html.
  • web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-three-keyframes1.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation.html.
  • web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-three-keyframes2-expected.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-expected.html.
  • web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-three-keyframes2.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation.html.
  • web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation.html:
  • web-platform-tests/css/css-masking/clip-path/animations/clip-path-transition-expected.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-expected.html.
  • web-platform-tests/css/css-masking/clip-path/animations/clip-path-transition.html: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation.html.
  • web-platform-tests/css/css-masking/clip-path/animations/w3c-import.log:
  • web-platform-tests/css/css-masking/clip-path/clip-path-columns-shape-002.html:
  • web-platform-tests/css/css-masking/clip-path/clip-path-descendant-text-mutated-001.html:
  • web-platform-tests/css/css-masking/clip-path/clip-path-element-userSpaceOnUse-001.html:
  • web-platform-tests/css/css-masking/clip-path/clip-path-element-userSpaceOnUse-002.html:
  • web-platform-tests/css/css-masking/clip-path/clip-path-element-userSpaceOnUse-003.html:
  • web-platform-tests/css/css-masking/clip-path/clip-path-element-userSpaceOnUse-004.html:
  • web-platform-tests/css/css-masking/clip-path/clip-path-fixed-scroll-expected.html: Added.
  • web-platform-tests/css/css-masking/clip-path/clip-path-fixed-scroll.html: Added.
  • web-platform-tests/css/css-masking/clip-path/clip-path-path-001-expected.html:
  • web-platform-tests/css/css-masking/clip-path/clip-path-path-002-expected.html:
  • web-platform-tests/css/css-masking/clip-path/clip-path-path-interpolation-001-expected.html:
  • web-platform-tests/css/css-masking/clip-path/clip-path-path-interpolation-002-expected.html:
  • web-platform-tests/css/css-masking/clip-path/clip-path-reference-restore.html:
  • web-platform-tests/css/css-masking/clip-path/clip-path-svg-invalidate-expected.html:
  • web-platform-tests/css/css-masking/clip-path/clip-path-svg-invalidate.html:
  • web-platform-tests/css/css-masking/clip-path/clip-path-svg-text-backdrop-filter.html:
  • web-platform-tests/css/css-masking/clip-path/clip-path-svg-text-font-loading.html:
  • web-platform-tests/css/css-masking/clip-path/clip-path-transform-mutated-001.html:
  • web-platform-tests/css/css-masking/clip-path/clip-path-transform-mutated-002.html:
  • web-platform-tests/css/css-masking/clip-path/clip-path-url-reference-change-from-empty.html:
  • web-platform-tests/css/css-masking/clip-path/clip-path-url-reference-change.html:
  • web-platform-tests/css/css-masking/clip-path/reference-local-url-with-base-001.html:
  • web-platform-tests/css/css-masking/clip-path/reference-mutated.html:
  • web-platform-tests/css/css-masking/clip-path/reference-nonexisting-existing-local.html:
  • web-platform-tests/css/css-masking/clip-path/w3c-import.log:
  • web-platform-tests/css/css-masking/clip-rule/clip-rule-001.html:
  • web-platform-tests/css/css-masking/clip-rule/clip-rule-002.html:
  • web-platform-tests/css/css-masking/hit-test/clip-path-element-objectboundingbox-001.html:
  • web-platform-tests/css/css-masking/hit-test/clip-path-element-objectboundingbox-002.html:
  • web-platform-tests/css/css-masking/hit-test/clip-path-element-userspaceonuse-001.html:
  • web-platform-tests/css/css-masking/idlharness.html:
  • web-platform-tests/css/css-masking/inheritance.sub-expected.txt:
  • web-platform-tests/css/css-masking/parsing/mask-position-valid-expected.txt:
  • web-platform-tests/css/css-masking/parsing/mask-valid.sub-expected.txt:

Source/WebCore:

Tests: fast/masking/parsing-webkit-mask.html

imported/w3c/web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-filter.html
imported/w3c/web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-incompatible-shapes1.html
imported/w3c/web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-incompatible-shapes2.html
imported/w3c/web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-overflow.html
imported/w3c/web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-three-keyframes1.html
imported/w3c/web-platform-tests/css/css-masking/clip-path/animations/clip-path-animation-three-keyframes2.html
imported/w3c/web-platform-tests/css/css-masking/clip-path/animations/clip-path-transition.html
imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-fixed-scroll.html
svg/masking/mask-external-reference-expected.svg
svg/masking/mask-external-reference.svg

  • animation/CSSPropertyAnimation.cpp:

(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::createPositionListForLayer):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):

  • css/CSSImageValue.cpp:

(WebCore::ResolvedURL::isLocalURL const):
(WebCore::CSSImageValue::reresolvedURL const):

  • css/CSSImageValue.h:
  • css/CSSPrimitiveValue.h:

(WebCore::CSSPrimitiveValue::create):

  • css/CSSPrimitiveValueMappings.h:

(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator CompositeOperator const):
(WebCore::CSSPrimitiveValue::operator FillBox const):

  • css/CSSProperties.json:
  • css/CSSToStyleMap.cpp:

(WebCore::CSSToStyleMap::mapFillMaskMode):

  • css/CSSValueKeywords.in:
  • css/CSSValuePool.h:

(WebCore::CSSValuePool::createValue):

  • css/SVGCSSComputedStyleDeclaration.cpp:

(WebCore::ComputedStyleExtractor::svgPropertyValue):

  • css/StyleProperties.cpp:

(WebCore::StyleProperties::getPropertyValue const):
(WebCore::resolvedClipValue):
(WebCore::isSameAsInitialClipValue):
(WebCore::StyleProperties::getLayeredShorthandValue const):
(WebCore::StyleProperties::asText const):

  • css/parser/CSSPropertyParser.cpp:

(WebCore::consumeMaskClip):
(WebCore::consumePrefixedBackgroundComposite):
(WebCore::consumeBackgroundComposite):
(WebCore::consumeBackgroundComponent):
(WebCore::CSSPropertyParser::parseSingleValue):
(WebCore::consumeBackgroundPosition):
(WebCore::CSSPropertyParser::consumeBackgroundShorthand):
(WebCore::CSSPropertyParser::parseShorthand):

  • css/parser/CSSPropertyParserHelpers.cpp:

(WebCore::CSSPropertyParserHelpers::consumePositionCoordinates):

  • display/css/DisplayBoxDecorationPainter.cpp:

(WebCore::Display::BoxDecorationPainter::paintFillLayer const):

  • rendering/style/FillLayer.cpp:

(WebCore::clipMax):
(WebCore::FillLayer::computeClipMax const):

  • rendering/style/FillLayer.h:
  • rendering/style/RenderStyle.cpp:

(WebCore::rareNonInheritedDataChangeRequiresLayerRepaint):

  • rendering/style/RenderStyle.h:

(WebCore::RenderStyle::hasPositionedMask const):

  • rendering/style/RenderStyleConstants.cpp:

(WebCore::operator<<):

  • rendering/style/RenderStyleConstants.h:
  • rendering/style/SVGRenderStyle.cpp:

(WebCore::SVGRenderStyle::SVGRenderStyle):
(WebCore::SVGRenderStyle::operator== const):
(WebCore::SVGRenderStyle::copyNonInheritedFrom):
(WebCore::SVGRenderStyle::diff const):

  • rendering/style/SVGRenderStyle.h:

(WebCore::SVGRenderStyle::initialLightingColor):
(WebCore::SVGRenderStyle::y const):
(WebCore::SVGRenderStyle::hasFill const):
(WebCore::SVGRenderStyle::initialMaskerResource): Deleted.
(WebCore::SVGRenderStyle::maskerResource const): Deleted.
(WebCore::SVGRenderStyle::hasMasker const): Deleted.
(WebCore::SVGRenderStyle::isolatesBlending const): Deleted.
(WebCore::SVGRenderStyle::setMaskerResource): Deleted.

  • rendering/style/SVGRenderStyleDefs.cpp:

(WebCore::StyleResourceData::StyleResourceData): Deleted.
(WebCore::StyleResourceData::copy const): Deleted.
(WebCore::StyleResourceData::operator== const): Deleted.

  • rendering/style/SVGRenderStyleDefs.h:

(WebCore::StyleResourceData::create): Deleted.
(WebCore::StyleResourceData::operator!= const): Deleted.

  • rendering/style/StyleCachedImage.cpp:

(WebCore::StyleCachedImage::imageURL const):
(WebCore::StyleCachedImage::reresolvedURL const):
(WebCore::StyleCachedImage::imageURL): Deleted.

  • rendering/style/StyleCachedImage.h:
  • rendering/style/WillChangeData.cpp:

(WebCore::WillChangeData::propertyCreatesStackingContext):

  • rendering/svg/SVGRenderSupport.cpp:

(WebCore::SVGRenderSupport::isolatesBlending):
(WebCore::SVGRenderSupport::updateMaskedAncestorShouldIsolateBlending):

  • rendering/svg/SVGRenderTreeAsText.cpp:

(WebCore::writeResources):

  • rendering/svg/SVGRenderingContext.cpp:

(WebCore::SVGRenderingContext::prepareToRenderSVGContent):

  • rendering/svg/SVGResources.cpp:

(WebCore::SVGResources::buildCachedResources):

LayoutTests:

  • fast/masking/parsing-mask-expected.txt:
  • fast/masking/parsing-mask-mode.html:
  • fast/masking/parsing-mask.html:
  • fast/masking/parsing-webkit-mask-expected.txt: Copied from LayoutTests/fast/masking/parsing-mask-expected.txt.
  • fast/masking/parsing-webkit-mask.html: Copied from LayoutTests/fast/masking/parsing-mask.html.
  • platform/mac/imported/w3c/web-platform-tests/css/css-masking/animations/mask-image-interpolation-expected.png: Added.
  • platform/mac/imported/w3c/web-platform-tests/css/css-masking/parsing/mask-valid.sub-expected.png: Added.
  • svg/masking/mask-external-reference-expected.svg: Added.
  • svg/masking/mask-external-reference.svg: Added.
  • svg/masking/resources/mask-resource.svg: Added.
File size: 4.6 KB
Line 
1/*
2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#pragma once
27
28#include "CSSPrimitiveValue.h"
29#include "CSSPropertyNames.h"
30#include "CSSValueKeywords.h"
31#include "ColorHash.h"
32#include <utility>
33#include <wtf/HashMap.h>
34#include <wtf/NeverDestroyed.h>
35#include <wtf/RefPtr.h>
36#include <wtf/text/AtomStringHash.h>
37
38namespace WebCore {
39
40class CSSValueList;
41class CSSValuePool;
42
43enum class FromSystemFontID { No, Yes };
44
45class StaticCSSValuePool {
46 friend class CSSValuePool;
47 friend class LazyNeverDestroyed<StaticCSSValuePool>;
48public:
49 static void init();
50
51private:
52 StaticCSSValuePool();
53
54 LazyNeverDestroyed<CSSPrimitiveValue> m_implicitInitialValue;
55
56 LazyNeverDestroyed<CSSPrimitiveValue> m_transparentColor;
57 LazyNeverDestroyed<CSSPrimitiveValue> m_whiteColor;
58 LazyNeverDestroyed<CSSPrimitiveValue> m_blackColor;
59
60 static constexpr int maximumCacheableIntegerValue = 255;
61
62 LazyNeverDestroyed<CSSPrimitiveValue> m_pixelValues[maximumCacheableIntegerValue + 1];
63 LazyNeverDestroyed<CSSPrimitiveValue> m_percentValues[maximumCacheableIntegerValue + 1];
64 LazyNeverDestroyed<CSSPrimitiveValue> m_numberValues[maximumCacheableIntegerValue + 1];
65 LazyNeverDestroyed<CSSPrimitiveValue> m_identifierValues[numCSSValueKeywords];
66};
67
68WEBCORE_EXPORT extern LazyNeverDestroyed<StaticCSSValuePool> staticCSSValuePool;
69
70class CSSValuePool {
71 WTF_MAKE_FAST_ALLOCATED;
72 WTF_MAKE_NONCOPYABLE(CSSValuePool);
73public:
74 CSSValuePool();
75
76 static CSSValuePool& singleton();
77
78 RefPtr<CSSValueList> createFontFaceValue(const AtomString&);
79 Ref<CSSPrimitiveValue> createFontFamilyValue(const String&, FromSystemFontID = FromSystemFontID::No);
80 Ref<CSSPrimitiveValue> createImplicitInitialValue() { return staticCSSValuePool->m_implicitInitialValue.get(); }
81 Ref<CSSPrimitiveValue> createIdentifierValue(CSSValueID identifier);
82 Ref<CSSPrimitiveValue> createIdentifierValue(CSSPropertyID identifier);
83 Ref<CSSPrimitiveValue> createColorValue(const Color&);
84 Ref<CSSPrimitiveValue> createValue(double value, CSSUnitType);
85 Ref<CSSPrimitiveValue> createValue(const String& value, CSSUnitType type) { return CSSPrimitiveValue::create(value, type); }
86 Ref<CSSPrimitiveValue> createValue(const Length& value, const RenderStyle& style) { return CSSPrimitiveValue::create(value, style); }
87 Ref<CSSPrimitiveValue> createValue(const LengthSize& value, const RenderStyle& style) { return CSSPrimitiveValue::create(value, style); }
88 Ref<CSSPrimitiveValue> createCustomIdent(const String& value) { return CSSPrimitiveValue::create(value, CSSUnitType::CustomIdent); }
89 template<typename T> static Ref<CSSPrimitiveValue> createValue(T&& value) { return CSSPrimitiveValue::create(std::forward<T>(value)); }
90 template<typename T> static Ref<CSSPrimitiveValue> createValue(T&& value, CSSPropertyID identifier) { return CSSPrimitiveValue::create(std::forward<T>(value), identifier); }
91
92 void drain();
93
94private:
95 typedef HashMap<Color, RefPtr<CSSPrimitiveValue>> ColorValueCache;
96 ColorValueCache m_colorValueCache;
97
98 typedef HashMap<AtomString, RefPtr<CSSValueList>> FontFaceValueCache;
99 FontFaceValueCache m_fontFaceValueCache;
100
101 typedef HashMap<std::pair<String, bool>, RefPtr<CSSPrimitiveValue>> FontFamilyValueCache;
102 FontFamilyValueCache m_fontFamilyValueCache;
103
104 friend class NeverDestroyed<CSSValuePool>;
105};
106
107} // namespace WebCore
Note: See TracBrowser for help on using the repository browser.