source: webkit/trunk/Source/WebCore/css/parser/CSSParserContext.h

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

Replace CSS3_TEXT build flag with Experimental feature settings
https://bugs.webkit.org/show_bug.cgi?id=121875

Patch by Kiet Ho <Kiet Ho> on 2022-05-29
Reviewed by Tim Nguyen and Myles C. Maxfield.

Currently, -webkit-text-align-last and -webkit-text-justify are gated behind
the ENABLE(CSS3_TEXT) build flag. EWS bots doesn't enable it, hence the properties
aren't tested even though tests are available for them. This patch replaces the build
flag with two experimental settings, which is on during layout tests, allowing the
properties to be tested.

  • LayoutTests/TestExpectations:
  • LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
  • LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
  • LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
  • LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
  • LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
  • LayoutTests/platform/win/TestExpectations:
  • LayoutTests/platform/wincairo/TestExpectations:
  • LayoutTests/platform/wpe/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
  • LayoutTests/platform/wpe/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
  • Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml:
  • Source/WTF/wtf/PlatformEnable.h:
  • Source/WebCore/animation/CSSPropertyAnimation.cpp:

(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
Temporarily mark -webkit-text-align-last and -webkit-text-justify as not animatable
to avoid the assert. CSS animations for those properties will be implemented in
webkit.org/b/240591.

  • Source/WebCore/css/CSSComputedStyleDeclaration.cpp:

(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):

  • Source/WebCore/css/CSSPrimitiveValueMappings.h:

(WebCore::CSSPrimitiveValue::operator TextJustify const):

  • Source/WebCore/css/CSSProperties.json:
  • Source/WebCore/css/StyleProperties.cpp:
  • Source/WebCore/css/parser/CSSParserContext.cpp:

(WebCore::operator==):
(WebCore::add):
(WebCore::CSSParserContext::isPropertyRuntimeDisabled const):

  • Source/WebCore/css/parser/CSSParserContext.h:
  • Source/WebCore/css/parser/CSSParserFastPaths.cpp:

(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
(WebCore::CSSParserFastPaths::isKeywordPropertyID):

  • Source/WebCore/rendering/LegacyLineLayout.cpp:

(WebCore::LegacyLineLayout::textAlignmentForLine const):

  • Source/WebCore/rendering/style/RenderStyle.cpp:

(WebCore::rareInheritedDataChangeRequiresLayout):

  • Source/WebCore/rendering/style/RenderStyle.h:

(WebCore::RenderStyle::textIndentType const):
(WebCore::RenderStyle::textJustify const):
(WebCore::RenderStyle::setTextIndentType):
(WebCore::RenderStyle::setTextJustify):
(WebCore::RenderStyle::initialTextIndentType):
(WebCore::RenderStyle::initialTextJustify):

  • Source/WebCore/rendering/style/RenderStyleConstants.h:
  • Source/WebCore/rendering/style/StyleRareInheritedData.cpp:

(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator== const):

  • Source/WebCore/rendering/style/StyleRareInheritedData.h:
  • Source/WebKitLegacy/win/WebPreferences.cpp:

(WebPreferences::cssTextAlignLastEnabled):
(WebPreferences::cssTextJustifyEnabled):

  • Source/WebKitLegacy/win/WebPreferences.h:
  • Source/WebKitLegacy/win/WebView.cpp:

(WebView::notifyPreferencesChanged):

  • Source/cmake/OptionsWin.cmake:
  • Source/cmake/WebKitFeatures.cmake:
  • Source/cmake/tools/vsprops/FeatureDefines.props:
  • Source/cmake/tools/vsprops/FeatureDefinesCairo.props:
  • Tools/DumpRenderTree/TestOptions.cpp:

(WTR::TestOptions::defaults):

  • Tools/Scripts/webkitperl/FeatureList.pm:

Canonical link: https://commits.webkit.org/251105@main

File size: 5.1 KB
Line 
1/*
2 * Copyright (C) 2018-2022 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 "CSSParserMode.h"
29#include "CSSPropertyNames.h"
30#include "StyleRuleType.h"
31#include <pal/text/TextEncoding.h>
32#include <wtf/HashFunctions.h>
33#include <wtf/Hasher.h>
34#include <wtf/URL.h>
35
36namespace WebCore {
37
38class Document;
39
40struct ResolvedURL;
41
42struct CSSParserContext {
43 WTF_MAKE_STRUCT_FAST_ALLOCATED;
44
45 URL baseURL;
46 String charset;
47 CSSParserMode mode { HTMLStandardMode };
48 std::optional<StyleRuleType> enclosingRuleType;
49 bool isHTMLDocument { false };
50
51 // This is only needed to support getMatchedCSSRules.
52 bool hasDocumentSecurityOrigin { false };
53
54 bool isContentOpaque { false };
55 bool useSystemAppearance { false };
56
57 // Settings.
58 bool accentColorEnabled { false };
59 bool aspectRatioEnabled { false };
60 bool colorContrastEnabled { false };
61 bool colorFilterEnabled { false };
62 bool colorMixEnabled { false };
63 bool constantPropertiesEnabled { false };
64 bool containmentEnabled { false };
65 bool counterStyleAtRulesEnabled { false };
66 bool counterStyleAtRuleImageSymbolsEnabled { false };
67 bool cssColor4 { false };
68 bool individualTransformPropertiesEnabled { false };
69#if ENABLE(OVERFLOW_SCROLLING_TOUCH)
70 bool legacyOverflowScrollingTouchEnabled { false };
71#endif
72 bool overscrollBehaviorEnabled { false };
73 bool relativeColorSyntaxEnabled { false };
74 bool scrollBehaviorEnabled { false };
75 bool springTimingFunctionEnabled { false };
76#if ENABLE(TEXT_AUTOSIZING)
77 bool textAutosizingEnabled { false };
78#endif
79#if ENABLE(CSS_TRANSFORM_STYLE_OPTIMIZED_3D)
80 bool transformStyleOptimized3DEnabled { false };
81#endif
82 bool useLegacyBackgroundSizeShorthandBehavior { false };
83 bool focusVisibleEnabled { false };
84 bool hasPseudoClassEnabled { false };
85 bool cascadeLayersEnabled { false };
86 bool containerQueriesEnabled { false };
87 bool overflowClipEnabled { false };
88 bool gradientPremultipliedAlphaInterpolationEnabled { false };
89 bool gradientInterpolationColorSpacesEnabled { false };
90 bool inputSecurityEnabled { false };
91 bool subgridEnabled { false };
92 bool containIntrinsicSizeEnabled { false };
93 bool motionPathEnabled { false };
94 bool cssTextAlignLastEnabled { false };
95 bool cssTextJustifyEnabled { false };
96
97 // RuntimeEnabledFeatures.
98#if ENABLE(ATTACHMENT_ELEMENT)
99 bool attachmentEnabled { false };
100#endif
101
102 CSSParserContext(CSSParserMode, const URL& baseURL = URL());
103 WEBCORE_EXPORT CSSParserContext(const Document&, const URL& baseURL = URL(), const String& charset = emptyString());
104 bool isPropertyRuntimeDisabled(CSSPropertyID) const;
105 ResolvedURL completeURL(const String&) const;
106};
107
108bool operator==(const CSSParserContext&, const CSSParserContext&);
109inline bool operator!=(const CSSParserContext& a, const CSSParserContext& b) { return !(a == b); }
110
111void add(Hasher&, const CSSParserContext&);
112
113WEBCORE_EXPORT const CSSParserContext& strictCSSParserContext();
114
115struct CSSParserContextHash {
116 static unsigned hash(const CSSParserContext& context) { return computeHash(context); }
117 static bool equal(const CSSParserContext& a, const CSSParserContext& b) { return a == b; }
118 static const bool safeToCompareToEmptyOrDeleted = false;
119};
120
121} // namespace WebCore
122
123namespace WTF {
124
125template<> struct HashTraits<WebCore::CSSParserContext> : GenericHashTraits<WebCore::CSSParserContext> {
126 static void constructDeletedValue(WebCore::CSSParserContext& slot) { new (NotNull, &slot.baseURL) URL(WTF::HashTableDeletedValue); }
127 static bool isDeletedValue(const WebCore::CSSParserContext& value) { return value.baseURL.isHashTableDeletedValue(); }
128 static WebCore::CSSParserContext emptyValue() { return WebCore::CSSParserContext(WebCore::HTMLStandardMode); }
129};
130
131template<> struct DefaultHash<WebCore::CSSParserContext> : WebCore::CSSParserContextHash { };
132
133} // namespace WTF
Note: See TracBrowser for help on using the repository browser.