diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/core/css')
805 files changed, 7880 insertions, 8224 deletions
diff --git a/chromium/third_party/blink/renderer/core/css/BUILD.gn b/chromium/third_party/blink/renderer/core/css/BUILD.gn index f67c3131428..fe7c36aa421 100644 --- a/chromium/third_party/blink/renderer/core/css/BUILD.gn +++ b/chromium/third_party/blink/renderer/core/css/BUILD.gn @@ -58,6 +58,8 @@ blink_core_sources("css") { "css_font_family_value.h", "css_font_feature_value.cc", "css_font_feature_value.h", + "css_font_feature_values_rule.cc", + "css_font_feature_values_rule.h", "css_font_selector.cc", "css_font_selector.h", "css_font_style_range_value.cc", @@ -92,6 +94,8 @@ blink_core_sources("css") { "css_inherited_value.h", "css_initial_value.cc", "css_initial_value.h", + "css_invalid_variable_value.cc", + "css_invalid_variable_value.h", "css_keyframe_rule.cc", "css_keyframe_rule.h", "css_keyframes_rule.cc", @@ -120,6 +124,8 @@ blink_core_sources("css") { "css_property_equality.cc", "css_property_equality.h", "css_property_id_templates.h", + "css_property_name.cc", + "css_property_name.h", "css_property_source_data.cc", "css_property_source_data.h", "css_property_value.cc", @@ -158,6 +164,8 @@ blink_core_sources("css") { "css_style_sheet.h", "css_supports_rule.cc", "css_supports_rule.h", + "css_syntax_component.cc", + "css_syntax_component.h", "css_syntax_descriptor.cc", "css_syntax_descriptor.h", "css_timing_function_value.cc", @@ -256,8 +264,9 @@ blink_core_sources("css") { "cssom/prepopulated_computed_style_property_map.h", "cssom/style_property_map.cc", "cssom/style_property_map.h", - "cssom/style_property_map_read_only.cc", "cssom/style_property_map_read_only.h", + "cssom/style_property_map_read_only_main_thread.cc", + "cssom/style_property_map_read_only_main_thread.h", "cssom/style_value_factory.cc", "cssom/style_value_factory.h", "document_style_environment_variables.cc", @@ -270,6 +279,8 @@ blink_core_sources("css") { "dom_window_css.h", "element_rule_collector.cc", "element_rule_collector.h", + "font_display.cc", + "font_display.h", "font_face.cc", "font_face.h", "font_face_cache.cc", @@ -392,6 +403,8 @@ blink_core_sources("css") { "properties/css_parsing_utils.cc", "properties/css_parsing_utils.h", "properties/css_property_base_custom.cc", + "properties/css_property_ref.cc", + "properties/css_property_ref.h", "properties/longhand.h", "properties/longhands/align_content_custom.cc", "properties/longhands/align_items_custom.cc", @@ -478,6 +491,8 @@ blink_core_sources("css") { "properties/longhands/counter_increment_custom.cc", "properties/longhands/counter_reset_custom.cc", "properties/longhands/cursor_custom.cc", + "properties/longhands/custom_property.cc", + "properties/longhands/custom_property.h", "properties/longhands/cx_custom.cc", "properties/longhands/cy_custom.cc", "properties/longhands/d_custom.cc", diff --git a/chromium/third_party/blink/renderer/core/css/OWNERS b/chromium/third_party/blink/renderer/core/css/OWNERS index 7d528afeb3b..070536afc22 100644 --- a/chromium/third_party/blink/renderer/core/css/OWNERS +++ b/chromium/third_party/blink/renderer/core/css/OWNERS @@ -1,9 +1,6 @@ +alancutter@chromium.org andruud@chromium.org ericwilligers@chromium.org -shend@chromium.org - -# Also core owners -alancutter@chromium.org futhark@chromium.org # COMPONENT: Blink>CSS diff --git a/chromium/third_party/blink/renderer/core/css/abstract_property_set_css_style_declaration.cc b/chromium/third_party/blink/renderer/core/css/abstract_property_set_css_style_declaration.cc index bae87db1759..2ddf7ae7e00 100644 --- a/chromium/third_party/blink/renderer/core/css/abstract_property_set_css_style_declaration.cc +++ b/chromium/third_party/blink/renderer/core/css/abstract_property_set_css_style_declaration.cc @@ -213,7 +213,7 @@ void AbstractPropertySetCSSStyleDeclaration::SetPropertyInternal( Element* parent = ParentElement(); if (parent) { parent->GetDocument().GetStyleEngine().AttributeChangedForElement( - HTMLNames::styleAttr, *parent); + html_names::kStyleAttr, *parent); } mutation_scope.EnqueueMutationRecord(); } diff --git a/chromium/third_party/blink/renderer/core/css/active_style_sheets_test.cc b/chromium/third_party/blink/renderer/core/css/active_style_sheets_test.cc index ce80993fe51..a319ce84d97 100644 --- a/chromium/third_party/blink/renderer/core/css/active_style_sheets_test.cc +++ b/chromium/third_party/blink/renderer/core/css/active_style_sheets_test.cc @@ -419,7 +419,7 @@ TEST_F(ActiveStyleSheetsTest, CompareActiveStyleSheets_AddRemoveNonMatchingMQ) { } TEST_F(ApplyRulesetsTest, AddUniversalRuleToDocument) { - UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); CSSStyleSheet* sheet = CreateSheet("body * { color:red }"); @@ -440,7 +440,7 @@ TEST_F(ApplyRulesetsTest, AddUniversalRuleToShadowTree) { ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); CSSStyleSheet* sheet = CreateSheet("body * { color:red }"); @@ -456,7 +456,7 @@ TEST_F(ApplyRulesetsTest, AddUniversalRuleToShadowTree) { } TEST_F(ApplyRulesetsTest, AddFontFaceRuleToDocument) { - UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); CSSStyleSheet* sheet = CreateSheet("@font-face { font-family: ahum; src: url(ahum.ttf) }"); @@ -478,7 +478,7 @@ TEST_F(ApplyRulesetsTest, AddFontFaceRuleToShadowTree) { ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); - UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); CSSStyleSheet* sheet = CreateSheet("@font-face { font-family: ahum; src: url(ahum.ttf) }"); @@ -505,7 +505,7 @@ TEST_F(ApplyRulesetsTest, RemoveSheetFromShadowTree) { host->AttachShadowRootInternal(ShadowRootType::kOpen); shadow_root.SetInnerHTMLFromString( "<style>::slotted(#dummy){color:pink}</style>"); - UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); EXPECT_TRUE(GetStyleEngine().TreeBoundaryCrossingScopes().IsEmpty()); ASSERT_EQ(1u, shadow_root.StyleSheets().length()); diff --git a/chromium/third_party/blink/renderer/core/css/affected_by_pseudo_test.cc b/chromium/third_party/blink/renderer/core/css/affected_by_pseudo_test.cc index 980fec89761..0884a530c0d 100644 --- a/chromium/third_party/blink/renderer/core/css/affected_by_pseudo_test.cc +++ b/chromium/third_party/blink/renderer/core/css/affected_by_pseudo_test.cc @@ -16,7 +16,7 @@ namespace blink { -using namespace HTMLNames; +using namespace html_names; class AffectedByPseudoTest : public PageTestBase { protected: @@ -33,7 +33,7 @@ class AffectedByPseudoTest : public PageTestBase { void AffectedByPseudoTest::SetHtmlInnerHTML(const char* html_content) { GetDocument().documentElement()->SetInnerHTMLFromString( String::FromUTF8(html_content)); - UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); } void AffectedByPseudoTest::CheckElementsForFocus( @@ -57,11 +57,11 @@ void AffectedByPseudoTest::CheckElementsForFocus( // ":focus div" will mark ascendants of all divs with // childrenOrSiblingsAffectedByFocus. TEST_F(AffectedByPseudoTest, FocusedAscendant) { - ElementResult expected[] = {{bodyTag, true}, - {divTag, true}, - {divTag, false}, - {divTag, false}, - {spanTag, false}}; + ElementResult expected[] = {{kBodyTag, true}, + {kDivTag, true}, + {kDivTag, false}, + {kDivTag, false}, + {kSpanTag, false}}; SetHtmlInnerHTML(R"HTML( <head> @@ -79,11 +79,11 @@ TEST_F(AffectedByPseudoTest, FocusedAscendant) { // "body:focus div" will mark the body element with // childrenOrSiblingsAffectedByFocus. TEST_F(AffectedByPseudoTest, FocusedAscendantWithType) { - ElementResult expected[] = {{bodyTag, true}, - {divTag, false}, - {divTag, false}, - {divTag, false}, - {spanTag, false}}; + ElementResult expected[] = {{kBodyTag, true}, + {kDivTag, false}, + {kDivTag, false}, + {kDivTag, false}, + {kSpanTag, false}}; SetHtmlInnerHTML(R"HTML( <head> @@ -104,11 +104,11 @@ TEST_F(AffectedByPseudoTest, FocusedAscendantWithType) { // is checked and the childrenOrSiblingsAffectedByFocus flag set before the // negated type selector is found. TEST_F(AffectedByPseudoTest, FocusedAscendantWithNegatedType) { - ElementResult expected[] = {{bodyTag, false}, - {divTag, true}, - {divTag, false}, - {divTag, false}, - {spanTag, false}}; + ElementResult expected[] = {{kBodyTag, false}, + {kDivTag, true}, + {kDivTag, false}, + {kDivTag, false}, + {kSpanTag, false}}; SetHtmlInnerHTML(R"HTML( <head> @@ -131,7 +131,7 @@ TEST_F(AffectedByPseudoTest, FocusedAscendantWithNegatedType) { // makes sure the sibling also gets its styles recalculated. TEST_F(AffectedByPseudoTest, FocusedSibling) { ElementResult expected[] = { - {bodyTag, false}, {divTag, true}, {spanTag, false}, {divTag, false}}; + {kBodyTag, false}, {kDivTag, true}, {kSpanTag, false}, {kDivTag, false}}; SetHtmlInnerHTML(R"HTML( <head> @@ -168,12 +168,12 @@ TEST_F(AffectedByPseudoTest, AffectedByFocusUpdate) { </div> )HTML"); - UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); unsigned start_count = GetStyleEngine().StyleForElementCount(); GetElementById("d")->focus(); - UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); unsigned element_count = GetStyleEngine().StyleForElementCount() - start_count; @@ -201,12 +201,12 @@ TEST_F(AffectedByPseudoTest, ChildrenOrSiblingsAffectedByFocusUpdate) { </div> )HTML"); - UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); unsigned start_count = GetStyleEngine().StyleForElementCount(); GetElementById("d")->focus(); - UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); unsigned element_count = GetStyleEngine().StyleForElementCount() - start_count; @@ -234,12 +234,12 @@ TEST_F(AffectedByPseudoTest, InvalidationSetFocusUpdate) { </div> )HTML"); - UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); unsigned start_count = GetStyleEngine().StyleForElementCount(); GetElementById("d")->focus(); - UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); unsigned element_count = GetStyleEngine().StyleForElementCount() - start_count; @@ -269,12 +269,12 @@ TEST_F(AffectedByPseudoTest, NoInvalidationSetFocusUpdate) { </div> )HTML"); - UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); unsigned start_count = GetStyleEngine().StyleForElementCount(); GetElementById("d")->focus(); - UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); unsigned element_count = GetStyleEngine().StyleForElementCount() - start_count; @@ -296,12 +296,12 @@ TEST_F(AffectedByPseudoTest, FocusWithinCommonAncestor) { </div> )HTML"); - UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); unsigned start_count = GetStyleEngine().StyleForElementCount(); GetElementById("focusme1")->focus(); - UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); unsigned element_count = GetStyleEngine().StyleForElementCount() - start_count; @@ -311,7 +311,7 @@ TEST_F(AffectedByPseudoTest, FocusWithinCommonAncestor) { start_count += element_count; GetElementById("focusme2")->focus(); - UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); element_count = GetStyleEngine().StyleForElementCount() - start_count; @@ -325,7 +325,7 @@ TEST_F(AffectedByPseudoTest, HoverScrollbar) { "<style>div::-webkit-scrollbar:hover { color: pink; }</style>" "<div id=div1></div>"); - UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); EXPECT_FALSE(GetElementById("div1")->GetComputedStyle()->AffectedByHover()); } diff --git a/chromium/third_party/blink/renderer/core/css/computed_style_css_value_mapping.cc b/chromium/third_party/blink/renderer/core/css/computed_style_css_value_mapping.cc index 4df98db90f6..58c4a150e98 100644 --- a/chromium/third_party/blink/renderer/core/css/computed_style_css_value_mapping.cc +++ b/chromium/third_party/blink/renderer/core/css/computed_style_css_value_mapping.cc @@ -27,6 +27,7 @@ #include "third_party/blink/renderer/core/css/css_custom_property_declaration.h" #include "third_party/blink/renderer/core/css/css_value.h" +#include "third_party/blink/renderer/core/css/properties/longhands/custom_property.h" #include "third_party/blink/renderer/core/css/property_registry.h" #include "third_party/blink/renderer/core/style/computed_style.h" @@ -36,25 +37,10 @@ const CSSValue* ComputedStyleCSSValueMapping::Get( const AtomicString custom_property_name, const ComputedStyle& style, const PropertyRegistry* registry) { - if (registry) { - const PropertyRegistration* registration = - registry->Registration(custom_property_name); - if (registration) { - const CSSValue* result = style.GetRegisteredVariable( - custom_property_name, registration->Inherits()); - if (result) - return result; - return registration->Initial(); - } - } - - bool is_inherited_property = true; - CSSVariableData* data = - style.GetVariable(custom_property_name, is_inherited_property); - if (!data) - return nullptr; - - return CSSCustomPropertyDeclaration::Create(custom_property_name, data); + CustomProperty custom_property(custom_property_name, registry); + return custom_property.CSSValueFromComputedStyle( + style, nullptr /* layout_object */, nullptr /* styled_node */, + false /* allow_visited_style */); } HeapHashMap<AtomicString, Member<const CSSValue>> diff --git a/chromium/third_party/blink/renderer/core/css/computed_style_css_value_mapping.h b/chromium/third_party/blink/renderer/core/css/computed_style_css_value_mapping.h index 5d3d03bcbd6..29103fc597a 100644 --- a/chromium/third_party/blink/renderer/core/css/computed_style_css_value_mapping.h +++ b/chromium/third_party/blink/renderer/core/css/computed_style_css_value_mapping.h @@ -17,12 +17,14 @@ class ComputedStyleCSSValueMapping { STATIC_ONLY(ComputedStyleCSSValueMapping); public: - static const CSSValue* Get(const AtomicString custom_property_name, - const ComputedStyle&, - const PropertyRegistry*); static HeapHashMap<AtomicString, Member<const CSSValue>> GetVariables( const ComputedStyle& style, const PropertyRegistry*); + + private: + static const CSSValue* Get(const AtomicString custom_property_name, + const ComputedStyle&, + const PropertyRegistry*); }; } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/computed_style_diff_functions.json5 b/chromium/third_party/blink/renderer/core/css/computed_style_diff_functions.json5 deleted file mode 100644 index 4cae09bf50f..00000000000 --- a/chromium/third_party/blink/renderer/core/css/computed_style_diff_functions.json5 +++ /dev/null @@ -1,442 +0,0 @@ -{ - // This file specifies the fields we want to diff in the various diff functions - // in ComputedStyle. - - parameters: { - // The name parameter represents the name of the function to be created. - - fields_to_diff: { - default: [], - }, - - // A list of methods to diff (these can be public getters of fields or - // functions that use fields to determine a value). - // Each entry is expressed as a dict of two fields: - // 1. method: the method to be diffed - // 2. field_dependencies: lists the properties this method depends on. - methods_to_diff: { - default: [], - }, - - // A list of predicates that have the diff logic built into them and are only - // called by the diff functions in ComputedStyle. - // Each entry is expressed as a dict of two fields: - // 1. predicate: the predicate to be tested - // 2. field_dependencies: lists the properties this predicate test depends on. - // TODO: Note that you also have to pass in the arguments for the predicate. - // This may be removed in the future if we are always passing the other ComputedStyle - predicates_to_test: { - default: [], - }, - }, - data: [ - { - name: "ScrollAnchorDisablingPropertyChanged", - fields_to_diff: ["width", "min-width", "max-width", "height", "min-height", "max-height", "margin-top", "margin-left", "margin-right", "margin-bottom", - "left", "right", "top", "bottom", "padding-top", - "padding-left", "padding-right", "padding-bottom"], - methods_to_diff: [ - { - method: "GetPosition()", - field_dependencies: ["position"] - }, - ] - }, - { - name: "DiffNeedsFullLayoutAndPaintInvalidation", - fields_to_diff: ["padding-top", "padding-left", "padding-right", - "padding-bottom", "-webkit-appearance", - "-webkit-margin-before-collapse", - "-webkit-margin-after-collapse", "-webkit-line-clamp", - "text-overflow", "shape-margin", "order", "-webkit-highlight", - "text-indent", "text-align-last", "TextIndentLine", "EffectiveZoom", - "word-break", "overflow-wrap", "-webkit-line-break", - "-webkit-text-security", "hyphens", "HyphenationLimitBefore", - "HyphenationLimitAfter", "-webkit-hyphenate-character", - "image-orientation", "-webkit-ruby-position", - "TextEmphasisMark", "-webkit-text-emphasis-position", - "TextEmphasisCustomMark", "text-justify", "text-orientation", - "text-combine-upright", "tab-size", "text-size-adjust", - "list-style-image", "line-height-step", - "-webkit-text-stroke-width", "line-height", "font", - "-webkit-border-horizontal-spacing", - "-webkit-border-vertical-spacing", "TextAutosizingMultiplier", - "NamedGridColumnLines", "NamedGridRowLines", "OrderedNamedGridColumnLines", - "OrderedNamedGridRowLines", "AutoRepeatNamedGridColumnLines", - "AutoRepeatNamedGridRowLines", "AutoRepeatOrderedNamedGridColumnLines", - "AutoRepeatOrderedNamedGridRowLines", "NamedGridArea", "grid-auto-rows", - "grid-template-rows", "grid-template-columns", "grid-auto-columns", "row-gap", - "NamedGridAreaRowCount", "NamedGridAreaColumnCount", - "GridAutoRepeatColumns", "GridAutoRepeatRows", "GridAutoRepeatColumnsInsertionPoint", - "GridAutoRepeatRowsInsertionPoint", "grid-auto-flow", "GridAutoRepeatColumnsType", - "GridAutoRepeatRowsType", "-webkit-box-flex", - "-webkit-box-ordinal-group", "flex-basis", - "flex-shrink", "flex-grow", "flex-direction", "flex-wrap", "-webkit-box-align", - "-webkit-box-pack", "-webkit-box-orient", - "grid-row-start", "grid-row-end", "grid-column-start", "grid-column-end", - "column-gap", "column-width", "column-rule-style", - "column-rule-width", "column-rule-color", "ColumnRuleColorIsCurrentColor", "VisitedLinkColumnRuleColor", - "column-count", "HasAutoColumnCount", "HasAutoColumnWidth", "column-fill", "column-span",], - methods_to_diff: [ - { - method: "BorderLeftWidth()", - field_dependencies: ["border-left-width"] - }, - { - method: "BorderTopWidth()", - field_dependencies: ["border-top-width"] - }, - { - method: "BorderBottomWidth()", - field_dependencies: ["border-bottom-width"] - }, - { - method: "BorderRightWidth()", - field_dependencies: ["border-right-width"] - }, - { - method: "HasFilters()", - field_dependencies: ["filter"] - }, - { - method: "FontInternal().LoadingCustomFonts()", - field_dependencies: ["font"] - }, - { - method: "HasPseudoStyle(kPseudoIdScrollbar)", - field_dependencies: ["StyleType"] - }, - { - method: "BoxDirection()", - field_dependencies: ["-webkit-box-direction"] - }, - { - method: "RtlOrdering()", - field_dependencies: ["-webkit-rtl-ordering"] - }, - { - method: "GetTextAlign()", - field_dependencies: ["text-align"] - }, - { - method: "TextTransform()", - field_dependencies: ["text-transform"] - }, - { - method: "Direction()", - field_dependencies: ["direction"] - }, - { - method: "WhiteSpace()", - field_dependencies: ["white-space"] - }, - { - method: "GetWritingMode()", - field_dependencies: ["writing-mode"] - }, - { - method: "OverflowX()", - field_dependencies: ["overflow-x"] - }, - { - method: "OverflowY()", - field_dependencies: ["overflow-y"] - }, - { - method: "Clear()", - field_dependencies: ["clear"] - }, - { - method: "GetUnicodeBidi()", - field_dependencies: ["unicode-bidi"] - }, - { - method: "Floating()", - field_dependencies: ["float"] - }, - { - method: "DisplayLayoutCustomName()", - field_dependencies: ["DisplayLayoutCustomName"] - }, - { - method: "OriginalDisplay()", - field_dependencies: ["OriginalDisplay"] - }, - ], - predicates_to_test: [ - { - predicate: "a.TextShadowDataEquivalent(b)", - field_dependencies: ["text-shadow"] - }, - { - predicate: "a.QuotesDataEquivalent(b)", - field_dependencies: ["quotes"] - }, - { - predicate: "a.OpacityChangedStackingContext(b)", - field_dependencies: ["IsStackingContext", "opacity"] - }, - ] - }, - { - name: "DiffNeedsFullLayoutAndPaintInvalidationDisplayTableType", - methods_to_diff: [ - { - method: "BorderCollapse()", - field_dependencies: ["border-collapse"] - }, - { - method: "EmptyCells()", - field_dependencies: ["empty-cells"] - }, - { - method: "CaptionSide()", - field_dependencies: ["caption-side"] - }, - { - method: "TableLayout()", - field_dependencies: ["table-layout"] - }, - ] - }, - { - name: "DiffNeedsFullLayoutAndPaintInvalidationDisplayListItem", - methods_to_diff: [ - { - method: "ListStyleType()", - field_dependencies: ["list-style-type"] - }, - { - method: "ListStylePosition()", - field_dependencies: ["list-style-position"] - }, - ] - }, - { - name: "DiffNeedsFullLayout", - fields_to_diff: ["width", "min-width", "max-width", "height", "min-height", - "max-height", "VerticalAlignLength", "box-sizing", "align-content", - "align-items", "align-self", "justify-content", "justify-items", - "justify-self", "contain"], - methods_to_diff: [ - { - method: "VerticalAlign()", - field_dependencies: ["VerticalAlign"] - }, - { - method: "GetPosition()", - field_dependencies: ["position"] - }, - ] - }, - { - name: "DiffNeedsPaintInvalidationSubtree", - fields_to_diff: ["mix-blend-mode", "isolation", "Mask", "MaskBoxImage"], - }, - { - name: "DiffNeedsPaintInvalidationObject", - fields_to_diff: ["-webkit-user-modify", "user-select", "image-rendering", - "-webkit-user-drag", "object-fit", "object-position"], - methods_to_diff: [ - { - method: "Visibility()", - field_dependencies: ["visibility"] - }, - { - method: "PrintColorAdjust()", - field_dependencies: ["-webkit-print-color-adjust"] - }, - { - method: "InsideLink()", - field_dependencies: ["InsideLink"] - }, - { - method: "VisitedLinkBackgroundColor()", - field_dependencies: ["VisitedLinkBackgroundColor"] - }, - { - method: "Resize()", - field_dependencies: ["resize"] - }, - ], - predicates_to_test: [ - { - predicate: "a.BoxShadowDataEquivalent(b)", - field_dependencies: ["box-shadow"] - }, - { - predicate: "a.ShapeOutsideDataEquivalent(b)", - field_dependencies: ["shape-outside"] - }, - { - predicate: "a.ClipPathDataEquivalent(b)", - field_dependencies: ["clip-path"] - }, - { - predicate: "a.OutlineVisuallyEqual(b)", - field_dependencies: ["outline-width", "outline-color", "OutlineColorIsCurrentColor", "outline-offset", "outline-style", "OutlineStyleIsAuto"] - }, - { - predicate: "a.VisitedLinkBorderLeftColorHasNotChanged(b)", - field_dependencies: ["VisitedLinkBorderLeftColor"] - }, - { - predicate: "a.VisitedLinkBorderRightColorHasNotChanged(b)", - field_dependencies: ["VisitedLinkBorderRightColor"] - }, - { - predicate: "a.VisitedLinkBorderBottomColorHasNotChanged(b)", - field_dependencies: ["VisitedLinkBorderBottomColor"] - }, - { - predicate: "a.VisitedLinkBorderTopColorHasNotChanged(b)", - field_dependencies: ["VisitedLinkBorderTopColor"] - }, - { - predicate: "a.VisitedLinkOutlineColorHasNotChanged(b)", - field_dependencies: ["VisitedLinkOutlineColor"] - }, - ] - }, - { - name: "DiffNeedsVisualRectUpdate", - methods_to_diff: [ - { - method: "Visibility()", - field_dependencies: ["visibility"] - }, - { - method: "Resize()", - field_dependencies: ["resize"] - }, - ] - }, - { - name: "UpdatePropertySpecificDifferencesZIndex", - fields_to_diff: ["z-index"], - methods_to_diff: [ - { - method: "IsStackingContext()", - field_dependencies: ["IsStackingContext"] - }, - ] - }, - { - name: "DiffTransformData", - fields_to_diff: ["transform", "translate", "rotate", - "scale", "offset-path", "offset-rotate", "transform-origin", - "offset-position", "offset-anchor", "offset-distance", - "transform-box"], - }, - { - name: "UpdatePropertySpecificDifferencesTransform", - fields_to_diff: ["transform", "translate", "rotate", - "scale", "offset-path", "offset-rotate", "transform-origin", - "offset-position", "offset-anchor", "offset-distance", - "perspective", "perspective-origin", "transform-box"], - methods_to_diff: [ - { - // It's possible for the old and new style transform data to be equivalent - // while hasTransform() differs, as it checks a number of conditions aside - // from just the matrix, including but not limited to animation state. - method: "HasTransform()", - field_dependencies: ["transform", "offset-position", - "HasCurrentTransformAnimation", "translate", "rotate", - "scale"] - }, - ] - }, - { - name: "UpdatePropertySpecificDifferencesOpacity", - fields_to_diff: ["opacity"], - }, - { - name: "UpdatePropertySpecificDifferencesFilter", - predicates_to_test: [ - { - predicate: "a.ReflectionDataEquivalent(b)", - field_dependencies: ["-webkit-box-reflect"] - }, - { - predicate: "a.FilterDataEquivalent(b)", - field_dependencies: ["filter"] - }, - ] - }, - { - name: "UpdatePropertySpecificDifferencesMask", - fields_to_diff: ["Mask", "MaskBoxImage"], - }, - { - name: "UpdatePropertySpecificDifferencesNeedsRecomputeOverflow", - predicates_to_test: [ - { - predicate: "a.BoxShadowDataEquivalent(b)", - field_dependencies: ["box-shadow"] - }, - { - predicate: "a.OutlineVisuallyEqual(b)", - field_dependencies: ["outline-width", "outline-color", "OutlineColorIsCurrentColor", "outline-offset", "outline-style", "OutlineStyleIsAuto"] - }, - { - predicate: "a.BorderVisualOverflowEqual(b)", - field_dependencies: ["border-image"] - }, - ] - }, - { - name: "UpdatePropertySpecificDifferencesBackdropFilter", - predicates_to_test: [ - { - predicate: "a.BackdropFilterDataEquivalent(b)", - field_dependencies: ["backdrop-filter"] - }, - ] - }, - { - name: "UpdatePropertySpecificDifferencesTextDecorationOrColor", - fields_to_diff: ["color", "VisitedLinkColor", "text-decoration-line", - "text-decoration-style", "text-decoration-color", - "VisitedLinkTextDecorationColor", "TextEmphasisFill", - "text-underline-position", "text-decoration-skip-ink", "AppliedTextDecorations"], - methods_to_diff: [ - { - method: "HasSimpleUnderlineInternal()", - field_dependencies: ["HasSimpleUnderline"] - }, - { - method: "TextFillColor()", - field_dependencies: ["-webkit-text-fill-color"] - }, - { - method: "TextStrokeColor()", - field_dependencies: ["-webkit-text-stroke-color"] - }, - { - method: "TextEmphasisColor()", - field_dependencies: ["-webkit-text-emphasis-color"] - }, - { - method: "VisitedLinkTextFillColor()", - field_dependencies: ["VisitedLinkTextFillColor"] - }, - { - method: "VisitedLinkTextStrokeColor()", - field_dependencies: ["VisitedLinkTextStrokeColor"] - }, - { - method: "VisitedLinkTextEmphasisColor()", - field_dependencies: ["VisitedLinkTextEmphasisColor"] - }, - { - method: "CaretColor()", - field_dependencies: ["caret-color"] - }, - { - method: "VisitedLinkCaretColor()", - field_dependencies: ["VisitedLinkCaretColor"] - }, - ] - }, - ], -} diff --git a/chromium/third_party/blink/renderer/core/css/computed_style_extra_fields.json5 b/chromium/third_party/blink/renderer/core/css/computed_style_extra_fields.json5 deleted file mode 100644 index 343ffb99431..00000000000 --- a/chromium/third_party/blink/renderer/core/css/computed_style_extra_fields.json5 +++ /dev/null @@ -1,1045 +0,0 @@ -{ -// This file specifies fields in ComputedStyle that we would like to -// generate, but are not CSS properties. - - parameters: { - // If true, we do not include this field in ComputedStyleBase::InheritFrom - // and ComputedStyleBase::CopyNonInheritedFromCached. - custom_copy: { - default: false, - }, - - // If true, we do not include this field in ComputedStyleBase::InheritedEqual - // and ComputedStyleBase::NonInheritedEqual. - custom_compare: { - default: false, - }, - - // Controls whether the field has the "mutable" C++ keyword. - mutable: { - default: false, - }, - - // The rest is the same as css_properties.json5, but the only relevant ones in - // this file are: - // name, field_template, include_paths, default_value, type_name, keyword, - // inherited - }, - - data: [ - { - name: "IsLink", - field_template: "monotonic_flag", - default_value: "false", - custom_copy: true, - custom_compare: true, - }, - { - name: "BorderLeftColorIsCurrentColor", - field_template: "primitive", - default_value: "true", - type_name: "bool", - field_group: "surround", - }, - { - name: "BorderRightColorIsCurrentColor", - field_template: "primitive", - default_value: "true", - type_name: "bool", - field_group: "surround", - }, - { - name: "BorderTopColorIsCurrentColor", - field_template: "primitive", - default_value: "true", - type_name: "bool", - field_group: "surround", - }, - { - name: "BorderBottomColorIsCurrentColor", - field_template: "primitive", - default_value: "true", - type_name: "bool", - field_group: "surround", - }, - { - name: "Display", - field_template: "keyword", - type_name: "EDisplay", - keywords: [ - "inline", "block", "list-item", "inline-block", "table", "inline-table", - "table-row-group", "table-header-group", "table-footer-group", - "table-row", "table-column-group", "table-column", "table-cell", - "table-caption", "-webkit-box", "-webkit-inline-box", "flex", - "inline-flex", "grid", "inline-grid", "contents", "flow-root", "none", - "layout-custom", "inline-layout-custom", - ], - default_value: "inline", - }, - { - name: "DisplayLayoutCustomName", - field_template: "external", - field_group: "*", - type_name: "AtomicString", - include_paths: ["third_party/blink/renderer/platform/wtf/text/atomic_string.h"], - default_value: "g_null_atom", - }, - { - name: "DisplayLayoutCustomParentName", - field_template: "external", - field_group: "*", - type_name: "AtomicString", - include_paths: ["third_party/blink/renderer/platform/wtf/text/atomic_string.h"], - default_value: "g_null_atom", - }, - { - name: "OriginalDisplay", - field_template: "keyword", - type_name: "EDisplay", - keywords: [ - "inline", "block", "list-item", "inline-block", "table", "inline-table", - "table-row-group", "table-header-group", "table-footer-group", - "table-row", "table-column-group", "table-column", "table-cell", - "table-caption", "-webkit-box", "-webkit-inline-box", "flex", - "inline-flex", "grid", "inline-grid", "contents", "flow-root", "none", - "layout-custom", "inline-layout-custom", - ], - default_value: "inline", - }, - { - name: "InsideLink", - field_template: "keyword", - default_value: "not-inside-link", - keywords: ["not-inside-link", "inside-unvisited-link", "inside-visited-link"], - inherited: true, - }, - // Style has content property with attr() values. - { - name: "HasAttrContent", - field_template: "monotonic_flag", - default_value: "false", - custom_copy: true, - custom_compare: true, - }, - // Whether this style is affected by these pseudo-classes. - { - name: "AffectedByFocusWithin", - field_template: "monotonic_flag", - default_value: "false", - custom_copy: true, - custom_compare: true, - }, - { - name: "AffectedByHover", - field_template: "monotonic_flag", - default_value: "false", - custom_copy: true, - custom_compare: true, - }, - { - name: "AffectedByActive", - field_template: "monotonic_flag", - default_value: "false", - custom_copy: true, - custom_compare: true, - }, - { - name: "AffectedByDrag", - field_template: "monotonic_flag", - default_value: "false", - custom_copy: true, - custom_compare: true, - }, - // A non-inherited property references a variable or @apply is used - { - name: "HasVariableReferenceFromNonInheritedProperty", - field_template: "monotonic_flag", - default_value: "false", - custom_copy: true, - custom_compare: true, - }, - // Explicitly inherits a non-inherited property - { - name: "HasExplicitlyInheritedProperties", - field_template: "monotonic_flag", - default_value: "false", - custom_copy: true, - custom_compare: true, - mutable: true, - }, - // These are set if we used viewport or rem units when resolving a length. - // FIXME: HasViewportUnits should be a monotonic_flag. - { - name: "HasViewportUnits", - field_template: "primitive", - default_value: "false", - type_name: "bool", - custom_compare: true, - }, - { - name: "HasRemUnits", - field_template: "monotonic_flag", - default_value: "false", - custom_compare: true, - }, - // These properties only have generated storage, and their methods are handwritten in ComputedStyle. - { - name: "StyleType", - field_template: "primitive", - field_size: 6, - default_value: "PseudoId::kPseudoIdNone", - type_name: "unsigned", - custom_copy: true, - custom_compare: true, - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "PseudoBits", - field_template: "primitive", - field_size: 7, - default_value: "kPseudoIdNone", - type_name: "unsigned", - custom_copy: true, - custom_compare: true, - computed_style_custom_functions: ["getter", "setter"], - }, - // True if 'underline solid' is the only text decoration on this element. - { - name: "HasSimpleUnderline", - field_template: "primitive", - default_value: "false", - type_name: "bool", - inherited: true, - computed_style_custom_functions: ["getter", "setter"], - }, - // FIXME: vertical align is actually a CSS property, but since we don't support union fields - // which can be either a keyword or Length, this is specified in this file for now. Remove this - // once we can support union fields. - { - name: "VerticalAlign", - field_template: "primitive", - field_size: 4, - type_name: "unsigned", - default_value: "static_cast<unsigned>(EVerticalAlign::kBaseline)", - computed_style_custom_functions: ["initial", "getter", "setter"], - }, - { - name: "VerticalAlignLength", - field_template: "external", - default_value: "Length()", - include_paths: ["third_party/blink/renderer/platform/length.h"], - type_name: "Length", - field_group: "box", - getter: "GetVerticalAlignLength", - computed_style_custom_functions: ["setter"], - }, - { - name: "border-image", - field_template: "external", - include_paths: ["third_party/blink/renderer/core/style/nine_piece_image.h"], - type_name: "NinePieceImage", - field_group: "surround", - default_value: "NinePieceImage()", - }, - { - name: "Background", - field_template: "external", - include_paths: ["third_party/blink/renderer/core/style/fill_layer.h"], - type_name: "FillLayer", - default_value: "FillLayer(EFillLayerType::kBackground, true)", - field_group: "background", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "HasAutoClip", - field_template: "primitive", - type_name: "bool", - default_value: "true", - field_group: "visual", - computed_style_custom_functions: ["setter"], - }, - { - name: "HasAutoZIndex", - field_template: "primitive", - type_name: "bool", - field_group: "box", - default_value: "true", - computed_style_custom_functions: ["setter"], - }, - { - name: "font", - field_template: "external", - include_paths: ["third_party/blink/renderer/platform/fonts/font.h"], - type_name: "Font", - field_group: "inherited->font", - inherited: true, - default_value: "Font()", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "VisitedLinkColor", - inherited: true, - field_template: "<color>", - field_group: "inherited", - default_value: "Color::kBlack", - }, - { - name: "TextAutosizingMultiplier", - inherited: true, - field_template: "primitive", - type_name: "float", - field_group: "inherited", - default_value: "1.0", - computed_style_custom_functions: ["setter"], - }, - { - name: "VisitedLinkTextStrokeColor", - inherited: true, - field_template: "external", - type_name: "Color", - include_paths: ["third_party/blink/renderer/platform/graphics/color.h"], - default_value: "Color()", - field_group: "*", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "VisitedLinkTextFillColor", - inherited: true, - field_template: "external", - type_name: "Color", - include_paths: ["third_party/blink/renderer/platform/graphics/color.h"], - default_value: "Color()", - field_group: "*", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "VisitedLinkTextEmphasisColor", - inherited: true, - field_template: "external", - type_name: "Color", - include_paths: ["third_party/blink/renderer/platform/graphics/color.h"], - default_value: "Color()", - field_group: "*", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "VisitedLinkCaretColor", - inherited: true, - field_template: "external", - type_name: "Color", - include_paths: ["third_party/blink/renderer/platform/graphics/color.h"], - default_value: "Color()", - field_group: "*", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "CursorData", - inherited: true, - field_template: "external", - type_name: "CursorList", - include_paths: ["third_party/blink/renderer/core/style/cursor_list.h"], - default_value: "nullptr", - wrapper_pointer_name: "Persistent", - field_group: "*", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "EffectiveZoom", - inherited: true, - field_template: "primitive", - type_name: "float", - default_value: "1.0f", - field_group: "*", - computed_style_custom_functions: ["setter"], - }, - { - name: "TextStrokeColorIsCurrentColor", - inherited: true, - field_template: "primitive", - type_name: "bool", - default_value: "true", - field_group: "*", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "TextFillColorIsCurrentColor", - inherited: true, - field_template: "primitive", - type_name: "bool", - default_value: "true", - field_group: "*", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "TextEmphasisColorIsCurrentColor", - inherited: true, - field_template: "primitive", - type_name: "bool", - default_value: "true", - field_group: "*", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "CaretColorIsCurrentColor", - inherited: true, - field_template: "primitive", - type_name: "bool", - default_value: "false", - field_group: "*", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "CaretColorIsAuto", - inherited: true, - field_template: "primitive", - type_name: "bool", - default_value: "true", - field_group: "*", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "VisitedLinkTextStrokeColorIsCurrentColor", - inherited: true, - field_template: "primitive", - type_name: "bool", - default_value: "true", - field_group: "*", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "VisitedLinkTextFillColorIsCurrentColor", - inherited: true, - field_template: "primitive", - type_name: "bool", - default_value: "true", - field_group: "*", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "VisitedLinkTextEmphasisColorIsCurrentColor", - inherited: true, - field_template: "primitive", - type_name: "bool", - default_value: "true", - field_group: "*", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "VisitedLinkCaretColorIsCurrentColor", - inherited: true, - field_template: "primitive", - type_name: "bool", - default_value: "false", - field_group: "*", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "VisitedLinkCaretColorIsAuto", - inherited: true, - field_template: "primitive", - type_name: "bool", - default_value: "true", - field_group: "*", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "TextEmphasisFill", - inherited: true, - field_template: "keyword", - type_name: "TextEmphasisFill", - default_value: "filled", - keywords: ["filled", "open"], - field_group: "*", - }, - { - name: "TextEmphasisMark", - inherited: true, - field_template: "keyword", - type_name: "TextEmphasisMark", - default_value: "none", - keywords: ["none", "auto", "dot", "circle", "double-circle", "triangle", "sesame", "custom"], - field_group: "*", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "TextIndentLine", - inherited: true, - field_template: "keyword", - type_name: "TextIndentLine", - keywords: ["first-line", "each-line"], - default_value: "first-line", - field_group: "*", - }, - { - name: "TextIndentType", - inherited: true, - field_template: "keyword", - type_name: "TextIndentType", - keywords: ["normal", "hanging"], - default_value: "normal", - field_group: "*", - }, - // Though will-change is not itself an inherited property, the intent - // expressed by 'will-change: contents' includes descendants. - { - name: "SubtreeWillChangeContents", - inherited: true, - field_template: "primitive", - type_name: "bool", - default_value: "false", - field_group: "*", - }, - { - name: "SelfOrAncestorHasDirAutoAttribute", - inherited: true, - field_template: "primitive", - type_name: "bool", - default_value: "false", - field_group: "*", - }, - // Though position: sticky is not itself an inherited property, being a - // descendent of a sticky element changes some document lifecycle logic. - { - name: "SubtreeIsSticky", - inherited: true, - field_template: "primitive", - type_name: "bool", - default_value: "false", - field_group: "*", - }, - { - name: "HyphenationLimitBefore", - inherited: true, - field_template: "primitive", - type_name: "short", - default_value: "-1", - field_group: "*", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "HyphenationLimitAfter", - inherited: true, - field_template: "primitive", - type_name: "short", - default_value: "-1", - field_group: "*", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "HyphenationLimitLines", - inherited: true, - field_template: "primitive", - type_name: "short", - default_value: "-1", - field_group: "*", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "EffectiveTouchAction", - inherited: true, - field_template: "primitive", - include_paths: ["third_party/blink/renderer/platform/graphics/touch_action.h"], - type_name: "TouchAction", - field_size: 6, - default_value: "TouchAction::kTouchActionAuto", - field_group: "*", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "TextEmphasisCustomMark", - inherited: true, - field_template: "external", - type_name: "AtomicString", - include_paths: ["third_party/blink/renderer/platform/wtf/text/atomic_string.h"], - default_value: "AtomicString()", - field_group: "*", - }, - { - name: "AppliedTextDecorations", - inherited: true, - field_template: "external", - type_name: "AppliedTextDecorationList", - include_paths: ["third_party/blink/renderer/core/style/applied_text_decoration_list.h"], - default_value: "nullptr", - wrapper_pointer_name: "scoped_refptr", - field_group: "*", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "InheritedVariables", - inherited: true, - field_template: "external", - type_name: "StyleInheritedVariables", - include_paths: ["third_party/blink/renderer/core/style/style_inherited_variables.h"], - default_value: "nullptr", - wrapper_pointer_name: "scoped_refptr", - field_group: "*", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "Mask", - field_template: "external", - type_name: "FillLayer", - field_group: "*", - default_value: "FillLayer(EFillLayerType::kMask, true)", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "CounterDirectives", - field_template: "external", - type_name: "CounterDirectiveMap", - field_group: "*", - default_value: "nullptr", - wrapper_pointer_name: "std::unique_ptr", - include_paths: ["third_party/blink/renderer/core/style/counter_directives.h"], - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "Animations", - field_template: "external", - type_name: "CSSAnimationData", - field_group: "*", - default_value: "nullptr", - wrapper_pointer_name: "std::unique_ptr", - include_paths: ["third_party/blink/renderer/core/animation/css/css_animation_data.h"], - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "Transitions", - field_template: "external", - type_name: "CSSTransitionData", - field_group: "*", - default_value: "nullptr", - wrapper_pointer_name: "std::unique_ptr", - include_paths: ["third_party/blink/renderer/core/animation/css/css_transition_data.h"], - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "MaskBoxImage", - field_template: "external", - type_name: "NinePieceImage", - field_group: "*", - default_value: "NinePieceImage::MaskDefaults()", - include_paths: ["third_party/blink/renderer/core/style/nine_piece_image.h"], - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "PageSize", - field_template: "external", - type_name: "FloatSize", - field_group: "*", - default_value: "FloatSize()", - include_paths: ["third_party/blink/renderer/platform/geometry/float_size.h"], - }, - { - name: "OutlineColorIsCurrentColor", - field_template: "primitive", - default_value: "true", - type_name: "bool", - field_group: "*", - }, - { - name: "OutlineStyleIsAuto", - field_template: "primitive", - type_name: "bool", - default_value: "false", - field_group: "*", - }, - { - name: "VisitedLinkTextDecorationColor", - field_template: "external", - type_name: "StyleColor", - field_group: "*", - default_value: "StyleColor::CurrentColor()", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "VisitedLinkBackgroundColor", - field_template: "external", - type_name: "StyleColor", - field_group: "*", - default_value: "StyleColor(Color::kTransparent)", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "VisitedLinkOutlineColor", - field_template: "external", - type_name: "StyleColor", - field_group: "*", - default_value: "StyleColor::CurrentColor()", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "VisitedLinkBorderLeftColor", - field_template: "external", - type_name: "StyleColor", - field_group: "*", - default_value: "StyleColor::CurrentColor()", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "VisitedLinkBorderRightColor", - field_template: "external", - type_name: "StyleColor", - field_group: "*", - default_value: "StyleColor::CurrentColor()", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "VisitedLinkBorderTopColor", - field_template: "external", - type_name: "StyleColor", - field_group: "*", - default_value: "StyleColor::CurrentColor()", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "VisitedLinkBorderBottomColor", - field_template: "external", - type_name: "StyleColor", - field_group: "*", - default_value: "StyleColor::CurrentColor()", - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "CallbackSelectors", - field_template: "external", - type_name: "Vector<String>", - field_group: "*", - default_value: "Vector<String>()", - include_paths: ["third_party/blink/renderer/platform/wtf/vector.h", - "third_party/blink/renderer/platform/wtf/text/wtf_string.h"], - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "PaintImages", - field_template: "external", - type_name: "PaintImages", - field_group: "*", - default_value: "nullptr", - wrapper_pointer_name: "std::unique_ptr", - custom_compare: true, - include_paths: ["third_party/blink/renderer/core/style/paint_images.h"], - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "NonInheritedVariables", - field_template: "external", - type_name: "StyleNonInheritedVariables", - field_group: "*", - default_value: "nullptr", - wrapper_pointer_name: "std::unique_ptr", - include_paths: ["third_party/blink/renderer/core/style/style_non_inherited_variables.h"], - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "PageSizeType", - field_template: "keyword", - keywords: ["auto", "landscape", "portrait", "resolved"], - field_group: "*", - default_value: "auto", - }, - { - name: "HasCurrentOpacityAnimation", - field_template: "primitive", - type_name: "bool", - field_group: "*", - default_value: "false", - }, - { - name: "HasCurrentTransformAnimation", - field_template: "primitive", - type_name: "bool", - field_group: "*", - default_value: "false", - }, - { - name: "HasCurrentFilterAnimation", - field_template: "primitive", - type_name: "bool", - field_group: "*", - default_value: "false", - }, - { - name: "HasCurrentBackdropFilterAnimation", - field_template: "primitive", - type_name: "bool", - field_group: "*", - default_value: "false", - }, - { - name: "IsRunningOpacityAnimationOnCompositor", - field_template: "primitive", - type_name: "bool", - field_group: "*", - custom_compare: true, - default_value: "false", - }, - { - name: "IsRunningTransformAnimationOnCompositor", - field_template: "primitive", - type_name: "bool", - field_group: "*", - custom_compare: true, - default_value: "false", - }, - { - name: "IsRunningFilterAnimationOnCompositor", - field_template: "primitive", - type_name: "bool", - field_group: "*", - custom_compare: true, - default_value: "false", - }, - { - name: "IsRunningBackdropFilterAnimationOnCompositor", - field_template: "primitive", - type_name: "bool", - field_group: "*", - custom_compare: true, - default_value: "false", - }, - // A stacking context is painted atomically and defines a stacking order, - // whereas a containing stacking context defines in which order the stacking - // contexts below are painted. - // See CSS 2.1, Appendix E (https://www.w3.org/TR/CSS21/zindex.html) for more - // details. - { - name: "IsStackingContext", - field_template: "primitive", - type_name: "bool", - field_group: "*", - default_value: "false", - }, - // Plugins require accelerated compositing for reasons external to blink. - // In which case, we need to update the ComputedStyle on the - // LayoutEmbeddedObject, so store this bit so that the style actually changes - // when the plugin becomes composited. - { - name: "RequiresAcceleratedCompositingForExternalReasons", - field_template: "primitive", - type_name: "bool", - field_group: "*", - default_value: "false", - }, - { - name: "HasInlineTransform", - field_template: "primitive", - type_name: "bool", - field_group: "*", - default_value: "false", - }, - // Style adjustment for appearance is disabled when certain properties are set. - { - name: "HasAuthorBackground", - field_template: "primitive", - type_name: "bool", - field_group: "*", - default_value: "false", - }, - { - name: "HasAuthorBorder", - field_template: "primitive", - type_name: "bool", - field_group: "*", - default_value: "false", - }, - { - name: "WillChangeProperties", - field_template: "external", - type_name: "Vector<CSSPropertyID>", - field_group: "*->will-change", - default_value: "Vector<CSSPropertyID>()", - include_paths: ["third_party/blink/renderer/platform/wtf/vector.h", - "third_party/blink/renderer/core/css_property_names.h"], - }, - { - name: "WillChangeContents", - field_template: "primitive", - type_name: "bool", - field_group: "*->will-change", - default_value: "false", - }, - { - name: "WillChangeScrollPosition", - field_template: "primitive", - type_name: "bool", - field_group: "*->will-change", - default_value: "false", - }, - { - name: "ColumnRuleColorIsCurrentColor", - field_template: "primitive", - default_value: "true", - type_name: "bool", - field_group: "*->multi-col", - }, - { - name: "VisitedLinkColumnRuleColor", - field_template: "external", - type_name: "StyleColor", - field_group: "*->multi-col", - default_value: "StyleColor::CurrentColor()", - include_paths: ["third_party/blink/renderer/core/css/style_color.h"], - computed_style_custom_functions: ["getter", "setter"], - }, - { - name: "HasAutoColumnWidth", - field_template: "primitive", - type_name: "bool", - field_group: "*->multi-col", - default_value: "true", - computed_style_custom_functions: ["setter"], - }, - { - name: "HasAutoColumnCount", - field_template: "primitive", - type_name: "bool", - field_group: "*->multi-col", - default_value: "true", - computed_style_custom_functions: ["setter"], - }, - { - name: "NamedGridColumnLines", - field_template: "external", - type_name: "NamedGridLinesMap", - field_group: "*->grid", - default_value: "NamedGridLinesMap()", - include_paths: ["third_party/blink/renderer/core/style/named_grid_lines_map.h"], - }, - { - name: "NamedGridRowLines", - field_template: "external", - type_name: "NamedGridLinesMap", - field_group: "*->grid", - default_value: "NamedGridLinesMap()", - include_paths: ["third_party/blink/renderer/core/style/named_grid_lines_map.h"], - }, - { - name: "OrderedNamedGridColumnLines", - field_template: "external", - type_name: "OrderedNamedGridLines", - field_group: "*->grid", - default_value: "OrderedNamedGridLines()", - include_paths: ["third_party/blink/renderer/core/style/ordered_named_grid_lines.h"], - }, - { - name: "OrderedNamedGridRowLines", - field_template: "external", - type_name: "OrderedNamedGridLines", - field_group: "*->grid", - default_value: "OrderedNamedGridLines()", - include_paths: ["third_party/blink/renderer/core/style/ordered_named_grid_lines.h"], - }, - { - name: "AutoRepeatNamedGridColumnLines", - field_template: "external", - type_name: "NamedGridLinesMap", - field_group: "*->grid", - default_value: "NamedGridLinesMap()", - include_paths: ["third_party/blink/renderer/core/style/named_grid_lines_map.h"], - }, - { - name: "AutoRepeatNamedGridRowLines", - field_template: "external", - type_name: "NamedGridLinesMap", - field_group: "*->grid", - default_value: "NamedGridLinesMap()", - include_paths: ["third_party/blink/renderer/core/style/named_grid_lines_map.h"], - }, - { - name: "AutoRepeatOrderedNamedGridColumnLines", - field_template: "external", - type_name: "OrderedNamedGridLines", - field_group: "*->grid", - default_value: "OrderedNamedGridLines()", - include_paths: ["third_party/blink/renderer/core/style/ordered_named_grid_lines.h"], - }, - { - name: "AutoRepeatOrderedNamedGridRowLines", - field_template: "external", - type_name: "OrderedNamedGridLines", - field_group: "*->grid", - default_value: "OrderedNamedGridLines()", - include_paths: ["third_party/blink/renderer/core/style/ordered_named_grid_lines.h"], - }, - { - name: "NamedGridArea", - field_template: "external", - type_name: "NamedGridAreaMap", - field_group: "*->grid", - default_value: "NamedGridAreaMap()", - include_paths: ["third_party/blink/renderer/core/style/grid_area.h"] - }, - { - name: "NamedGridAreaRowCount", - field_template: "primitive", - type_name: "size_t", - field_group: "*->grid", - default_value: "0", - }, - { - name: "NamedGridAreaColumnCount", - field_template: "primitive", - type_name: "size_t", - field_group: "*->grid", - default_value: "0", - }, - { - name: "GridAutoRepeatColumns", - field_template: "external", - type_name: "Vector<GridTrackSize>", - field_group: "*->grid", - default_value: "Vector<GridTrackSize>()", - include_paths: ["third_party/blink/renderer/platform/wtf/vector.h", - "third_party/blink/renderer/core/style/grid_track_size.h"], - }, - { - name: "GridAutoRepeatRows", - field_template: "external", - type_name: "Vector<GridTrackSize>", - field_group: "*->grid", - default_value: "Vector<GridTrackSize>()", - include_paths: ["third_party/blink/renderer/platform/wtf/vector.h", - "third_party/blink/renderer/core/style/grid_track_size.h"], - }, - { - name: "GridAutoRepeatColumnsInsertionPoint", - field_template: "primitive", - type_name: "size_t", - field_group: "*->grid", - default_value: "0", - }, - { - name: "GridAutoRepeatRowsInsertionPoint", - field_template: "primitive", - type_name: "size_t", - field_group: "*->grid", - default_value: "0", - }, - { - name: "GridAutoRepeatColumnsType", - field_template: "keyword", - type_name: "AutoRepeatType", - field_group: "*->grid", - keywords: ["no-auto-repeat", "auto-fill", "auto-fit"], - default_value: "no-auto-repeat", - }, - { - name: "GridAutoRepeatRowsType", - field_template: "keyword", - type_name: "AutoRepeatType", - field_group: "*->grid", - keywords: ["no-auto-repeat", "auto-fill", "auto-fit"], - default_value: "no-auto-repeat", - }, - { - name: "ForceLegacyLayout", - inherited: true, - field_template: "primitive", - type_name: "bool", - default_value: "false", - field_group: "*", - }, - ], -} diff --git a/chromium/third_party/blink/renderer/core/css/computed_style_field_aliases.json5 b/chromium/third_party/blink/renderer/core/css/computed_style_field_aliases.json5 index cce3321d5a6..cef592a33e0 100644 --- a/chromium/third_party/blink/renderer/core/css/computed_style_field_aliases.json5 +++ b/chromium/third_party/blink/renderer/core/css/computed_style_field_aliases.json5 @@ -8,7 +8,7 @@ "name": "<length>", "field_template": "external", "type_name": "Length", - "include_paths": ["third_party/blink/renderer/platform/length.h"] + "include_paths": ["third_party/blink/renderer/platform/geometry/length.h"] }, { "name": "<color>", diff --git a/chromium/third_party/blink/renderer/core/css/css_basic_shape_values.cc b/chromium/third_party/blink/renderer/core/css/css_basic_shape_values.cc index 28776fe111a..289cd8db99c 100644 --- a/chromium/third_party/blink/renderer/core/css/css_basic_shape_values.cc +++ b/chromium/third_party/blink/renderer/core/css/css_basic_shape_values.cc @@ -32,7 +32,7 @@ #include "third_party/blink/renderer/core/css/css_identifier_value.h" #include "third_party/blink/renderer/core/css/css_primitive_value.h" #include "third_party/blink/renderer/core/css/css_value_pair.h" -#include "third_party/blink/renderer/platform/length.h" +#include "third_party/blink/renderer/platform/geometry/length.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" namespace blink { diff --git a/chromium/third_party/blink/renderer/core/css/css_basic_shape_values.h b/chromium/third_party/blink/renderer/core/css/css_basic_shape_values.h index 4e1e047db77..037514d3f61 100644 --- a/chromium/third_party/blink/renderer/core/css/css_basic_shape_values.h +++ b/chromium/third_party/blink/renderer/core/css/css_basic_shape_values.h @@ -44,9 +44,11 @@ namespace cssvalue { class CSSBasicShapeCircleValue final : public CSSValue { public: static CSSBasicShapeCircleValue* Create() { - return new CSSBasicShapeCircleValue; + return MakeGarbageCollected<CSSBasicShapeCircleValue>(); } + CSSBasicShapeCircleValue() : CSSValue(kBasicShapeCircleClass) {} + String CustomCSSText() const; bool Equals(const CSSBasicShapeCircleValue&) const; @@ -62,8 +64,6 @@ class CSSBasicShapeCircleValue final : public CSSValue { void TraceAfterDispatch(blink::Visitor*); private: - CSSBasicShapeCircleValue() : CSSValue(kBasicShapeCircleClass) {} - Member<CSSValue> center_x_; Member<CSSValue> center_y_; Member<CSSValue> radius_; @@ -72,9 +72,11 @@ class CSSBasicShapeCircleValue final : public CSSValue { class CSSBasicShapeEllipseValue final : public CSSValue { public: static CSSBasicShapeEllipseValue* Create() { - return new CSSBasicShapeEllipseValue; + return MakeGarbageCollected<CSSBasicShapeEllipseValue>(); } + CSSBasicShapeEllipseValue() : CSSValue(kBasicShapeEllipseClass) {} + String CustomCSSText() const; bool Equals(const CSSBasicShapeEllipseValue&) const; @@ -92,8 +94,6 @@ class CSSBasicShapeEllipseValue final : public CSSValue { void TraceAfterDispatch(blink::Visitor*); private: - CSSBasicShapeEllipseValue() : CSSValue(kBasicShapeEllipseClass) {} - Member<CSSValue> center_x_; Member<CSSValue> center_y_; Member<CSSValue> radius_x_; @@ -103,9 +103,12 @@ class CSSBasicShapeEllipseValue final : public CSSValue { class CSSBasicShapePolygonValue final : public CSSValue { public: static CSSBasicShapePolygonValue* Create() { - return new CSSBasicShapePolygonValue; + return MakeGarbageCollected<CSSBasicShapePolygonValue>(); } + CSSBasicShapePolygonValue() + : CSSValue(kBasicShapePolygonClass), wind_rule_(RULE_NONZERO) {} + void AppendPoint(CSSPrimitiveValue* x, CSSPrimitiveValue* y) { values_.push_back(x); values_.push_back(y); @@ -127,9 +130,6 @@ class CSSBasicShapePolygonValue final : public CSSValue { void TraceAfterDispatch(blink::Visitor*); private: - CSSBasicShapePolygonValue() - : CSSValue(kBasicShapePolygonClass), wind_rule_(RULE_NONZERO) {} - HeapVector<Member<CSSPrimitiveValue>> values_; WindRule wind_rule_; }; @@ -137,9 +137,11 @@ class CSSBasicShapePolygonValue final : public CSSValue { class CSSBasicShapeInsetValue final : public CSSValue { public: static CSSBasicShapeInsetValue* Create() { - return new CSSBasicShapeInsetValue; + return MakeGarbageCollected<CSSBasicShapeInsetValue>(); } + CSSBasicShapeInsetValue() : CSSValue(kBasicShapeInsetClass) {} + CSSPrimitiveValue* Top() const { return top_.Get(); } CSSPrimitiveValue* Right() const { return right_.Get(); } CSSPrimitiveValue* Bottom() const { return bottom_.Get(); } @@ -196,8 +198,6 @@ class CSSBasicShapeInsetValue final : public CSSValue { void TraceAfterDispatch(blink::Visitor*); private: - CSSBasicShapeInsetValue() : CSSValue(kBasicShapeInsetClass) {} - Member<CSSPrimitiveValue> top_; Member<CSSPrimitiveValue> right_; Member<CSSPrimitiveValue> bottom_; diff --git a/chromium/third_party/blink/renderer/core/css/css_border_image_slice_value.h b/chromium/third_party/blink/renderer/core/css/css_border_image_slice_value.h index 2f3f0bae087..c19bb059311 100644 --- a/chromium/third_party/blink/renderer/core/css/css_border_image_slice_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_border_image_slice_value.h @@ -35,9 +35,11 @@ namespace cssvalue { class CSSBorderImageSliceValue : public CSSValue { public: static CSSBorderImageSliceValue* Create(CSSQuadValue* slices, bool fill) { - return new CSSBorderImageSliceValue(slices, fill); + return MakeGarbageCollected<CSSBorderImageSliceValue>(slices, fill); } + CSSBorderImageSliceValue(CSSQuadValue* slices, bool fill); + String CustomCSSText() const; // TODO(sashab): Change this to a quad of CSSPrimitiveValues, or add separate @@ -50,8 +52,6 @@ class CSSBorderImageSliceValue : public CSSValue { void TraceAfterDispatch(blink::Visitor*); private: - CSSBorderImageSliceValue(CSSQuadValue* slices, bool fill); - // These four values are used to make "cuts" in the border image. They can be // numbers or percentages. Member<CSSQuadValue> slices_; diff --git a/chromium/third_party/blink/renderer/core/css/css_calculation_value.cc b/chromium/third_party/blink/renderer/core/css/css_calculation_value.cc index e785bd05a2b..cac6c210359 100644 --- a/chromium/third_party/blink/renderer/core/css/css_calculation_value.cc +++ b/chromium/third_party/blink/renderer/core/css/css_calculation_value.cc @@ -165,7 +165,7 @@ class CSSCalcPrimitiveValue final : public CSSCalcExpressionNode { public: static CSSCalcPrimitiveValue* Create(CSSPrimitiveValue* value, bool is_integer) { - return new CSSCalcPrimitiveValue(value, is_integer); + return MakeGarbageCollected<CSSCalcPrimitiveValue>(value, is_integer); } static CSSCalcPrimitiveValue* Create(double value, @@ -173,10 +173,15 @@ class CSSCalcPrimitiveValue final : public CSSCalcExpressionNode { bool is_integer) { if (std::isnan(value) || std::isinf(value)) return nullptr; - return new CSSCalcPrimitiveValue(CSSPrimitiveValue::Create(value, type), - is_integer); + return MakeGarbageCollected<CSSCalcPrimitiveValue>( + CSSPrimitiveValue::Create(value, type), is_integer); } + CSSCalcPrimitiveValue(CSSPrimitiveValue* value, bool is_integer) + : CSSCalcExpressionNode(UnitCategory(value->TypeWithCalcResolved()), + is_integer), + value_(value) {} + bool IsZero() const override { return !value_->GetDoubleValue(); } String CustomCSSText() const override { return value_->CssText(); } @@ -278,11 +283,6 @@ class CSSCalcPrimitiveValue final : public CSSCalcExpressionNode { } private: - CSSCalcPrimitiveValue(CSSPrimitiveValue* value, bool is_integer) - : CSSCalcExpressionNode(UnitCategory(value->TypeWithCalcResolved()), - is_integer), - value_(value) {} - Member<CSSPrimitiveValue> value_; }; @@ -375,7 +375,8 @@ class CSSCalcBinaryOperation final : public CSSCalcExpressionNode { if (new_category == kCalcOther) return nullptr; - return new CSSCalcBinaryOperation(left_side, right_side, op, new_category); + return MakeGarbageCollected<CSSCalcBinaryOperation>(left_side, right_side, + op, new_category); } static CSSCalcExpressionNode* CreateSimplified( @@ -462,6 +463,16 @@ class CSSCalcBinaryOperation final : public CSSCalcExpressionNode { return Create(left_side, right_side, op); } + CSSCalcBinaryOperation(CSSCalcExpressionNode* left_side, + CSSCalcExpressionNode* right_side, + CalcOperator op, + CalculationCategory category) + : CSSCalcExpressionNode(category, + IsIntegerResult(left_side, right_side, op)), + left_side_(left_side), + right_side_(right_side), + operator_(op) {} + bool IsZero() const override { return !DoubleValue(); } void AccumulatePixelsAndPercent( @@ -627,16 +638,6 @@ class CSSCalcBinaryOperation final : public CSSCalcExpressionNode { } private: - CSSCalcBinaryOperation(CSSCalcExpressionNode* left_side, - CSSCalcExpressionNode* right_side, - CalcOperator op, - CalculationCategory category) - : CSSCalcExpressionNode(category, - IsIntegerResult(left_side, right_side, op)), - left_side_(left_side), - right_side_(right_side), - operator_(op) {} - static CSSCalcExpressionNode* GetNumberSide( CSSCalcExpressionNode* left_side, CSSCalcExpressionNode* right_side) { @@ -837,13 +838,13 @@ CSSCalcExpressionNode* CSSCalcValue::CreateExpressionNode( CSSCalcExpressionNode* CSSCalcValue::CreateExpressionNode(double pixels, double percent) { return CreateExpressionNode( - CreateExpressionNode(CSSPrimitiveValue::Create( - pixels, CSSPrimitiveValue::UnitType::kPixels), - pixels == trunc(pixels)), CreateExpressionNode( CSSPrimitiveValue::Create(percent, CSSPrimitiveValue::UnitType::kPercentage), percent == trunc(percent)), + CreateExpressionNode(CSSPrimitiveValue::Create( + pixels, CSSPrimitiveValue::UnitType::kPixels), + pixels == trunc(pixels)), kCalcAdd); } @@ -852,12 +853,13 @@ CSSCalcValue* CSSCalcValue::Create(const CSSParserTokenRange& tokens, CSSCalcExpressionNodeParser parser; CSSCalcExpressionNode* expression = parser.ParseCalc(tokens); - return expression ? new CSSCalcValue(expression, range) : nullptr; + return expression ? MakeGarbageCollected<CSSCalcValue>(expression, range) + : nullptr; } CSSCalcValue* CSSCalcValue::Create(CSSCalcExpressionNode* expression, ValueRange range) { - return new CSSCalcValue(expression, range); + return MakeGarbageCollected<CSSCalcValue>(expression, range); } } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/css_calculation_value.h b/chromium/third_party/blink/renderer/core/css/css_calculation_value.h index 3f53cb637d6..609924e4964 100644 --- a/chromium/third_party/blink/renderer/core/css/css_calculation_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_calculation_value.h @@ -35,7 +35,7 @@ #include "third_party/blink/renderer/core/css/css_primitive_value.h" #include "third_party/blink/renderer/core/css/css_value.h" #include "third_party/blink/renderer/core/css/parser/css_parser_token_range.h" -#include "third_party/blink/renderer/platform/calculation_value.h" +#include "third_party/blink/renderer/platform/geometry/calculation_value.h" #include "third_party/blink/renderer/platform/wtf/forward.h" namespace blink { @@ -120,6 +120,10 @@ class CORE_EXPORT CSSCalcValue : public GarbageCollected<CSSCalcValue> { static CSSCalcExpressionNode* CreateExpressionNode(double pixels, double percent); + CSSCalcValue(CSSCalcExpressionNode* expression, ValueRange range) + : expression_(expression), + non_negative_(range == kValueRangeNonNegative) {} + scoped_refptr<CalculationValue> ToCalcValue( const CSSToLengthConversionData& conversion_data) const { PixelsAndPercent value(0, 0); @@ -147,10 +151,6 @@ class CORE_EXPORT CSSCalcValue : public GarbageCollected<CSSCalcValue> { void Trace(blink::Visitor* visitor) { visitor->Trace(expression_); } private: - CSSCalcValue(CSSCalcExpressionNode* expression, ValueRange range) - : expression_(expression), - non_negative_(range == kValueRangeNonNegative) {} - double ClampToPermittedRange(double) const; const Member<CSSCalcExpressionNode> expression_; diff --git a/chromium/third_party/blink/renderer/core/css/css_color_value.cc b/chromium/third_party/blink/renderer/core/css/css_color_value.cc index 9066791175f..85d833278c4 100644 --- a/chromium/third_party/blink/renderer/core/css/css_color_value.cc +++ b/chromium/third_party/blink/renderer/core/css/css_color_value.cc @@ -5,6 +5,7 @@ #include "third_party/blink/renderer/core/css/css_color_value.h" #include "third_party/blink/renderer/core/css/css_value_pool.h" +#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" namespace blink { namespace cssvalue { @@ -22,9 +23,43 @@ CSSColorValue* CSSColorValue::Create(RGBA32 color) { CSSValuePool::ColorValueCache::AddResult entry = CssValuePool().GetColorCacheEntry(color); if (entry.is_new_entry) - entry.stored_value->value = new CSSColorValue(color); + entry.stored_value->value = MakeGarbageCollected<CSSColorValue>(color); return entry.stored_value->value; } +String CSSColorValue::SerializeAsCSSComponentValue(Color color) { + StringBuilder result; + result.ReserveCapacity(32); + bool color_has_alpha = color.HasAlpha(); + if (color_has_alpha) + result.Append("rgba("); + else + result.Append("rgb("); + + result.AppendNumber(static_cast<unsigned char>(color.Red())); + result.Append(", "); + + result.AppendNumber(static_cast<unsigned char>(color.Green())); + result.Append(", "); + + result.AppendNumber(static_cast<unsigned char>(color.Blue())); + if (color_has_alpha) { + result.Append(", "); + // See <alphavalue> section in + // https://drafts.csswg.org/cssom/#serializing-css-values + int alphavalue = color.Alpha(); + float rounded = round(alphavalue * 100 / 255.0f) / 100; + if (round(rounded * 255) == alphavalue) { + result.AppendNumber(rounded, 2); + } else { + rounded = round(alphavalue * 1000 / 255.0f) / 1000; + result.AppendNumber(rounded, 3); + } + } + + result.Append(')'); + return result.ToString(); +} + } // namespace cssvalue } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/css_color_value.h b/chromium/third_party/blink/renderer/core/css/css_color_value.h index 56007897b09..a63b22ab3ec 100644 --- a/chromium/third_party/blink/renderer/core/css/css_color_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_color_value.h @@ -21,9 +21,9 @@ class CSSColorValue : public CSSValue { // TODO(sashab): Make this create() method take a Color instead. static CSSColorValue* Create(RGBA32 color); - String CustomCSSText() const { - return color_.SerializedAsCSSComponentValue(); - } + CSSColorValue(Color color) : CSSValue(kColorClass), color_(color) {} + + String CustomCSSText() const { return SerializeAsCSSComponentValue(color_); } Color Value() const { return color_; } @@ -35,11 +35,13 @@ class CSSColorValue : public CSSValue { CSSValue::TraceAfterDispatch(visitor); } + // Returns the color serialized according to CSSOM: + // https://drafts.csswg.org/cssom/#serialize-a-css-component-value + static String SerializeAsCSSComponentValue(Color color); + private: friend class ::blink::CSSValuePool; - CSSColorValue(Color color) : CSSValue(kColorClass), color_(color) {} - Color color_; }; diff --git a/chromium/third_party/blink/renderer/core/css/css_computed_style_declaration.cc b/chromium/third_party/blink/renderer/core/css/css_computed_style_declaration.cc index 5af1c199552..163d827584a 100644 --- a/chromium/third_party/blink/renderer/core/css/css_computed_style_declaration.cc +++ b/chromium/third_party/blink/renderer/core/css/css_computed_style_declaration.cc @@ -29,12 +29,13 @@ #include "third_party/blink/renderer/core/css/css_primitive_value.h" #include "third_party/blink/renderer/core/css/css_primitive_value_mappings.h" #include "third_party/blink/renderer/core/css/css_property_id_templates.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/css_selector.h" #include "third_party/blink/renderer/core/css/css_variable_data.h" #include "third_party/blink/renderer/core/css/parser/css_parser.h" +#include "third_party/blink/renderer/core/css/properties/css_property_ref.h" #include "third_party/blink/renderer/core/css/style_engine.h" #include "third_party/blink/renderer/core/css/zoom_adjusted_pixel_value.h" -#include "third_party/blink/renderer/core/css_property_names.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/pseudo_element.h" #include "third_party/blink/renderer/core/frame/use_counter.h" @@ -182,6 +183,8 @@ CSSValueID CssIdentifierForFontSizeKeyword(int keyword_size) { void LogUnimplementedPropertyID(const CSSProperty& property) { DEFINE_STATIC_LOCAL(HashSet<CSSPropertyID>, property_id_set, ()); + if (property.PropertyID() == CSSPropertyVariable) + return; if (!property_id_set.insert(property.PropertyID()).is_new_entry) return; @@ -304,16 +307,8 @@ const CSSValue* CSSComputedStyleDeclaration::GetPropertyCSSValue( if (!styled_node) return nullptr; - styled_node->GetDocument().UpdateStyleAndLayoutTreeForNode(styled_node); - - const ComputedStyle* style = ComputeComputedStyle(); - if (!style) - return nullptr; - // Don't use styled_node in case it was discarded or replaced in - // UpdateStyleAndLayoutTreeForNode. - return ComputedStyleCSSValueMapping::Get( - custom_property_name, *style, - StyledNode()->GetDocument().GetPropertyRegistry()); + CSSPropertyRef ref(custom_property_name, styled_node->GetDocument()); + return GetPropertyCSSValue(ref.GetProperty()); } HeapHashMap<AtomicString, Member<const CSSValue>> diff --git a/chromium/third_party/blink/renderer/core/css/css_computed_style_declaration.h b/chromium/third_party/blink/renderer/core/css/css_computed_style_declaration.h index 9e9a46a9611..bc7cfa45f7f 100644 --- a/chromium/third_party/blink/renderer/core/css/css_computed_style_declaration.h +++ b/chromium/third_party/blink/renderer/core/css/css_computed_style_declaration.h @@ -46,11 +46,13 @@ class CORE_EXPORT CSSComputedStyleDeclaration final Node* node, bool allow_visited_style = false, const String& pseudo_element_name = String()) { - return new CSSComputedStyleDeclaration(node, allow_visited_style, - pseudo_element_name); + return MakeGarbageCollected<CSSComputedStyleDeclaration>( + node, allow_visited_style, pseudo_element_name); } static const Vector<const CSSProperty*>& ComputableProperties(); + + CSSComputedStyleDeclaration(Node*, bool allow_visited_style, const String&); ~CSSComputedStyleDeclaration() override; String GetPropertyValue(CSSPropertyID) const; @@ -75,8 +77,6 @@ class CORE_EXPORT CSSComputedStyleDeclaration final void Trace(blink::Visitor*) override; private: - CSSComputedStyleDeclaration(Node*, bool allow_visited_style, const String&); - // The styled node is either the node passed into getComputedStyle, or the // PseudoElement for :before and :after if they exist. // FIXME: This should be styledElement since in JS getComputedStyle only works diff --git a/chromium/third_party/blink/renderer/core/css/css_computed_style_declaration_test.cc b/chromium/third_party/blink/renderer/core/css/css_computed_style_declaration_test.cc index 9b9a9917de4..60651762c50 100644 --- a/chromium/third_party/blink/renderer/core/css/css_computed_style_declaration_test.cc +++ b/chromium/third_party/blink/renderer/core/css/css_computed_style_declaration_test.cc @@ -19,7 +19,7 @@ TEST_F(CSSComputedStyleDeclarationTest, CleanAncestorsNoRecalc) { <div id=target style='color:green'></div> </div> )HTML"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); EXPECT_FALSE(GetDocument().NeedsLayoutTreeUpdate()); GetDocument().getElementById("dirty")->setAttribute("style", "color:pink"); @@ -48,7 +48,7 @@ TEST_F(CSSComputedStyleDeclarationTest, CleanShadowAncestorsNoRecalc) { <div id=target style='color:green'></div> )HTML"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); EXPECT_FALSE(GetDocument().NeedsLayoutTreeUpdate()); GetDocument().getElementById("dirty")->setAttribute("style", "color:pink"); @@ -63,4 +63,46 @@ TEST_F(CSSComputedStyleDeclarationTest, CleanShadowAncestorsNoRecalc) { EXPECT_TRUE(GetDocument().NeedsLayoutTreeUpdate()); } +TEST_F(CSSComputedStyleDeclarationTest, NeedsAdjacentStyleRecalc) { + GetDocument().body()->SetInnerHTMLFromString(R"HTML( + <style> + #a + #b { color: green } + </style> + <div id="container" style="display:none"> + <span id="a"></span> + <span id="b"> + <span id="c"></span> + <span id="d"></span> + </span> + </div> + )HTML"); + + UpdateAllLifecyclePhasesForTest(); + + EXPECT_FALSE(GetDocument().NeedsLayoutTreeUpdate()); + + Element* container = GetDocument().getElementById("container"); + Element* c_span = GetDocument().getElementById("c"); + Element* d_span = GetDocument().getElementById("d"); + d_span->setAttribute("style", "color:pink"); + + EXPECT_TRUE(GetDocument().NeedsLayoutTreeUpdate()); + EXPECT_TRUE(GetDocument().NeedsLayoutTreeUpdateForNode(*d_span)); + EXPECT_FALSE(GetDocument().NeedsLayoutTreeUpdateForNode(*c_span)); + EXPECT_FALSE(GetDocument().NeedsLayoutTreeUpdateForNode(*c_span, true)); + EXPECT_FALSE(container->NeedsAdjacentStyleRecalc()); + + CSSComputedStyleDeclaration* computed = + CSSComputedStyleDeclaration::Create(c_span); + + EXPECT_STREQ("rgb(0, 128, 0)", + computed->GetPropertyValue(CSSPropertyColor).Utf8().data()); + + EXPECT_TRUE(GetDocument().NeedsLayoutTreeUpdate()); + EXPECT_TRUE(GetDocument().NeedsLayoutTreeUpdateForNode(*d_span)); + EXPECT_TRUE(GetDocument().NeedsLayoutTreeUpdateForNode(*c_span)); + EXPECT_FALSE(GetDocument().NeedsLayoutTreeUpdateForNode(*c_span, true)); + EXPECT_TRUE(container->NeedsAdjacentStyleRecalc()); +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/css_content_distribution_value.h b/chromium/third_party/blink/renderer/core/css/css_content_distribution_value.h index 88165080352..a9da14f1c3c 100644 --- a/chromium/third_party/blink/renderer/core/css/css_content_distribution_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_content_distribution_value.h @@ -18,8 +18,13 @@ class CSSContentDistributionValue : public CSSValue { static CSSContentDistributionValue* Create(CSSValueID distribution, CSSValueID position, CSSValueID overflow) { - return new CSSContentDistributionValue(distribution, position, overflow); + return MakeGarbageCollected<CSSContentDistributionValue>( + distribution, position, overflow); } + + CSSContentDistributionValue(CSSValueID distribution, + CSSValueID position, + CSSValueID overflow); ~CSSContentDistributionValue(); CSSValueID Distribution() const { return distribution_; } @@ -37,10 +42,6 @@ class CSSContentDistributionValue : public CSSValue { } private: - CSSContentDistributionValue(CSSValueID distribution, - CSSValueID position, - CSSValueID overflow); - CSSValueID distribution_; CSSValueID position_; CSSValueID overflow_; diff --git a/chromium/third_party/blink/renderer/core/css/css_counter_value.h b/chromium/third_party/blink/renderer/core/css/css_counter_value.h index f7754bdd8df..1cc4f25f232 100644 --- a/chromium/third_party/blink/renderer/core/css/css_counter_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_counter_value.h @@ -35,9 +35,18 @@ class CSSCounterValue : public CSSValue { static CSSCounterValue* Create(CSSCustomIdentValue* identifier, CSSIdentifierValue* list_style, CSSStringValue* separator) { - return new CSSCounterValue(identifier, list_style, separator); + return MakeGarbageCollected<CSSCounterValue>(identifier, list_style, + separator); } + CSSCounterValue(CSSCustomIdentValue* identifier, + CSSIdentifierValue* list_style, + CSSStringValue* separator) + : CSSValue(kCounterClass), + identifier_(identifier), + list_style_(list_style), + separator_(separator) {} + String Identifier() const { return identifier_->Value(); } CSSValueID ListStyle() const { return list_style_->GetValueID(); } String Separator() const { return separator_->Value(); } @@ -52,14 +61,6 @@ class CSSCounterValue : public CSSValue { void TraceAfterDispatch(blink::Visitor*); private: - CSSCounterValue(CSSCustomIdentValue* identifier, - CSSIdentifierValue* list_style, - CSSStringValue* separator) - : CSSValue(kCounterClass), - identifier_(identifier), - list_style_(list_style), - separator_(separator) {} - Member<CSSCustomIdentValue> identifier_; // string Member<CSSIdentifierValue> list_style_; // ident Member<CSSStringValue> separator_; // string diff --git a/chromium/third_party/blink/renderer/core/css/css_crossfade_value.h b/chromium/third_party/blink/renderer/core/css/css_crossfade_value.h index 1a12acea169..f5d5df37369 100644 --- a/chromium/third_party/blink/renderer/core/css/css_crossfade_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_crossfade_value.h @@ -47,9 +47,13 @@ class CORE_EXPORT CSSCrossfadeValue final : public CSSImageGeneratorValue { static CSSCrossfadeValue* Create(CSSValue* from_value, CSSValue* to_value, CSSPrimitiveValue* percentage_value) { - return new CSSCrossfadeValue(from_value, to_value, percentage_value); + return MakeGarbageCollected<CSSCrossfadeValue>(from_value, to_value, + percentage_value); } + CSSCrossfadeValue(CSSValue* from_value, + CSSValue* to_value, + CSSPrimitiveValue* percentage_value); ~CSSCrossfadeValue(); String CustomCSSText() const; @@ -75,10 +79,6 @@ class CORE_EXPORT CSSCrossfadeValue final : public CSSImageGeneratorValue { void TraceAfterDispatch(blink::Visitor*); private: - CSSCrossfadeValue(CSSValue* from_value, - CSSValue* to_value, - CSSPrimitiveValue* percentage_value); - void Dispose(); class CrossfadeSubimageObserverProxy final : public ImageResourceObserver { diff --git a/chromium/third_party/blink/renderer/core/css/css_cursor_image_value.h b/chromium/third_party/blink/renderer/core/css/css_cursor_image_value.h index ea7e0ccb820..affb948e2dc 100644 --- a/chromium/third_party/blink/renderer/core/css/css_cursor_image_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_cursor_image_value.h @@ -33,9 +33,13 @@ class CSSCursorImageValue : public CSSValue { static const CSSCursorImageValue* Create(const CSSValue& image_value, bool hot_spot_specified, const IntPoint& hot_spot) { - return new CSSCursorImageValue(image_value, hot_spot_specified, hot_spot); + return MakeGarbageCollected<CSSCursorImageValue>( + image_value, hot_spot_specified, hot_spot); } + CSSCursorImageValue(const CSSValue& image_value, + bool hot_spot_specified, + const IntPoint& hot_spot); ~CSSCursorImageValue(); bool HotSpotSpecified() const { return hot_spot_specified_; } @@ -49,10 +53,6 @@ class CSSCursorImageValue : public CSSValue { void TraceAfterDispatch(blink::Visitor*); private: - CSSCursorImageValue(const CSSValue& image_value, - bool hot_spot_specified, - const IntPoint& hot_spot); - Member<const CSSValue> image_value_; IntPoint hot_spot_; bool hot_spot_specified_; diff --git a/chromium/third_party/blink/renderer/core/css/css_custom_ident_value.h b/chromium/third_party/blink/renderer/core/css/css_custom_ident_value.h index dd2cef19419..12800f70824 100644 --- a/chromium/third_party/blink/renderer/core/css/css_custom_ident_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_custom_ident_value.h @@ -5,8 +5,8 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_CUSTOM_IDENT_VALUE_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_CUSTOM_IDENT_VALUE_H_ +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/css_value.h" -#include "third_party/blink/renderer/core/css_property_names.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" namespace blink { @@ -14,15 +14,18 @@ namespace blink { class CORE_EXPORT CSSCustomIdentValue : public CSSValue { public: static CSSCustomIdentValue* Create(const AtomicString& str) { - return new CSSCustomIdentValue(str); + return MakeGarbageCollected<CSSCustomIdentValue>(str); } // TODO(sashab, timloh): Remove this and lazily parse the CSSPropertyID in // isKnownPropertyID(). static CSSCustomIdentValue* Create(CSSPropertyID id) { - return new CSSCustomIdentValue(id); + return MakeGarbageCollected<CSSCustomIdentValue>(id); } + explicit CSSCustomIdentValue(const AtomicString&); + explicit CSSCustomIdentValue(CSSPropertyID); + AtomicString Value() const { DCHECK(!IsKnownPropertyID()); return string_; @@ -43,9 +46,6 @@ class CORE_EXPORT CSSCustomIdentValue : public CSSValue { void TraceAfterDispatch(blink::Visitor*); private: - explicit CSSCustomIdentValue(const AtomicString&); - explicit CSSCustomIdentValue(CSSPropertyID); - AtomicString string_; CSSPropertyID property_id_; }; diff --git a/chromium/third_party/blink/renderer/core/css/css_custom_property_declaration.h b/chromium/third_party/blink/renderer/core/css/css_custom_property_declaration.h index 32d5722cc46..c81b2d1ddd0 100644 --- a/chromium/third_party/blink/renderer/core/css/css_custom_property_declaration.h +++ b/chromium/third_party/blink/renderer/core/css/css_custom_property_declaration.h @@ -17,14 +17,31 @@ class CORE_EXPORT CSSCustomPropertyDeclaration : public CSSValue { static CSSCustomPropertyDeclaration* Create( const AtomicString& name, scoped_refptr<CSSVariableData> value) { - return new CSSCustomPropertyDeclaration(name, std::move(value)); + return MakeGarbageCollected<CSSCustomPropertyDeclaration>(name, + std::move(value)); } static CSSCustomPropertyDeclaration* Create(const AtomicString& name, CSSValueID id) { - return new CSSCustomPropertyDeclaration(name, id); + return MakeGarbageCollected<CSSCustomPropertyDeclaration>(name, id); } + CSSCustomPropertyDeclaration(const AtomicString& name, CSSValueID id) + : CSSValue(kCustomPropertyDeclarationClass), + name_(name), + value_(nullptr), + value_id_(id) { + DCHECK(id == CSSValueInherit || id == CSSValueInitial || + id == CSSValueUnset); + } + + CSSCustomPropertyDeclaration(const AtomicString& name, + scoped_refptr<CSSVariableData> value) + : CSSValue(kCustomPropertyDeclarationClass), + name_(name), + value_(std::move(value)), + value_id_(CSSValueInvalid) {} + const AtomicString& GetName() const { return name_; } CSSVariableData* Value() const { return value_.get(); } @@ -46,22 +63,6 @@ class CORE_EXPORT CSSCustomPropertyDeclaration : public CSSValue { void TraceAfterDispatch(blink::Visitor*); private: - CSSCustomPropertyDeclaration(const AtomicString& name, CSSValueID id) - : CSSValue(kCustomPropertyDeclarationClass), - name_(name), - value_(nullptr), - value_id_(id) { - DCHECK(id == CSSValueInherit || id == CSSValueInitial || - id == CSSValueUnset); - } - - CSSCustomPropertyDeclaration(const AtomicString& name, - scoped_refptr<CSSVariableData> value) - : CSSValue(kCustomPropertyDeclarationClass), - name_(name), - value_(std::move(value)), - value_id_(CSSValueInvalid) {} - const AtomicString name_; scoped_refptr<CSSVariableData> value_; CSSValueID value_id_; diff --git a/chromium/third_party/blink/renderer/core/css/css_default_style_sheets.cc b/chromium/third_party/blink/renderer/core/css/css_default_style_sheets.cc index 8e34a4c54e6..07a7419077b 100644 --- a/chromium/third_party/blink/renderer/core/css/css_default_style_sheets.cc +++ b/chromium/third_party/blink/renderer/core/css/css_default_style_sheets.cc @@ -43,8 +43,6 @@ namespace blink { -using namespace HTMLNames; - CSSDefaultStyleSheets& CSSDefaultStyleSheets::Instance() { DEFINE_STATIC_LOCAL(Persistent<CSSDefaultStyleSheets>, css_default_style_sheets, (new CSSDefaultStyleSheets)); @@ -53,13 +51,13 @@ CSSDefaultStyleSheets& CSSDefaultStyleSheets::Instance() { static const MediaQueryEvaluator& ScreenEval() { DEFINE_STATIC_LOCAL(Persistent<MediaQueryEvaluator>, static_screen_eval, - (new MediaQueryEvaluator("screen"))); + (MakeGarbageCollected<MediaQueryEvaluator>("screen"))); return *static_screen_eval; } static const MediaQueryEvaluator& PrintEval() { DEFINE_STATIC_LOCAL(Persistent<MediaQueryEvaluator>, static_print_eval, - (new MediaQueryEvaluator("print"))); + (MakeGarbageCollected<MediaQueryEvaluator>("print"))); return *static_print_eval; } @@ -173,7 +171,7 @@ bool CSSDefaultStyleSheets::EnsureDefaultStyleSheetsForElement( } // FIXME: We should assert that the sheet only styles MathML elements. - if (element.namespaceURI() == MathMLNames::mathmlNamespaceURI && + if (element.namespaceURI() == mathml_names::kNamespaceURI && !mathml_style_sheet_) { mathml_style_sheet_ = ParseUASheet(GetDataResourceAsASCIIString("mathml.css")); diff --git a/chromium/third_party/blink/renderer/core/css/css_font_face.cc b/chromium/third_party/blink/renderer/core/css/css_font_face.cc index 9ef4032fcf4..397dfeb7d69 100644 --- a/chromium/third_party/blink/renderer/core/css/css_font_face.cc +++ b/chromium/third_party/blink/renderer/core/css/css_font_face.cc @@ -205,14 +205,11 @@ void CSSFontFace::SetLoadStatus(FontFace::LoadStatusType new_status) { if (!segmented_font_face_ || !font_face_->GetExecutionContext()) return; - if (Document* document = - DynamicTo<Document>(font_face_->GetExecutionContext())) { + if (auto* document = DynamicTo<Document>(font_face_->GetExecutionContext())) { if (new_status == FontFace::kLoading) FontFaceSetDocument::From(*document)->BeginFontLoading(font_face_); - } - if (font_face_->GetExecutionContext()->IsWorkerGlobalScope()) { - WorkerGlobalScope* scope = - ToWorkerGlobalScope(font_face_->GetExecutionContext()); + } else if (auto* scope = DynamicTo<WorkerGlobalScope>( + font_face_->GetExecutionContext())) { if (new_status == FontFace::kLoading) FontFaceSetWorker::From(*scope)->BeginFontLoading(font_face_); } diff --git a/chromium/third_party/blink/renderer/core/css/css_font_face_rule.h b/chromium/third_party/blink/renderer/core/css/css_font_face_rule.h index 3e37da4ac89..f7412603f14 100644 --- a/chromium/third_party/blink/renderer/core/css/css_font_face_rule.h +++ b/chromium/third_party/blink/renderer/core/css/css_font_face_rule.h @@ -37,9 +37,10 @@ class CSSFontFaceRule final : public CSSRule { public: static CSSFontFaceRule* Create(StyleRuleFontFace* rule, CSSStyleSheet* sheet) { - return new CSSFontFaceRule(rule, sheet); + return MakeGarbageCollected<CSSFontFaceRule>(rule, sheet); } + CSSFontFaceRule(StyleRuleFontFace*, CSSStyleSheet* parent); ~CSSFontFaceRule() override; String cssText() const override; @@ -52,8 +53,6 @@ class CSSFontFaceRule final : public CSSRule { void Trace(blink::Visitor*) override; private: - CSSFontFaceRule(StyleRuleFontFace*, CSSStyleSheet* parent); - CSSRule::Type type() const override { return kFontFaceRule; } Member<StyleRuleFontFace> font_face_rule_; diff --git a/chromium/third_party/blink/renderer/core/css/css_font_face_rule.idl b/chromium/third_party/blink/renderer/core/css/css_font_face_rule.idl index 5b9cddb7502..2e2a7530a30 100644 --- a/chromium/third_party/blink/renderer/core/css/css_font_face_rule.idl +++ b/chromium/third_party/blink/renderer/core/css/css_font_face_rule.idl @@ -18,14 +18,7 @@ * Boston, MA 02110-1301, USA. */ -// The CSSFontFaceRule interface was introduced in DOM Level 2 Style, but has -// been replaced by an entirely different interface in CSS Fonts: -// https://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSFontFaceRule // https://drafts.csswg.org/css-fonts/#om-fontface -// -// TODO(foolip): Make CSSFontFaceRule match new spec and/or change spec to match -// what's implemented. https://crbug.com/709013 -// https://github.com/w3c/csswg-drafts/issues/825 interface CSSFontFaceRule : CSSRule { [Measure] readonly attribute CSSStyleDeclaration style; diff --git a/chromium/third_party/blink/renderer/core/css/css_font_face_source.h b/chromium/third_party/blink/renderer/core/css/css_font_face_source.h index 683b223fc32..cfb07ee67df 100644 --- a/chromium/third_party/blink/renderer/core/css/css_font_face_source.h +++ b/chromium/third_party/blink/renderer/core/css/css_font_face_source.h @@ -28,6 +28,7 @@ #include "base/macros.h" #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/css/font_display.h" #include "third_party/blink/renderer/platform/fonts/font_cache_key.h" #include "third_party/blink/renderer/platform/fonts/font_selection_types.h" #include "third_party/blink/renderer/platform/heap/handle.h" @@ -40,15 +41,6 @@ namespace blink { class FontDescription; class SimpleFontData; -enum FontDisplay { - kFontDisplayAuto, - kFontDisplayBlock, - kFontDisplaySwap, - kFontDisplayFallback, - kFontDisplayOptional, - kFontDisplayEnumMax -}; - class CORE_EXPORT CSSFontFaceSource : public GarbageCollectedFinalized<CSSFontFaceSource> { public: diff --git a/chromium/third_party/blink/renderer/core/css/css_font_face_src_value.cc b/chromium/third_party/blink/renderer/core/css/css_font_face_src_value.cc index c8b5f4fd0fe..c1843a36109 100644 --- a/chromium/third_party/blink/renderer/core/css/css_font_face_src_value.cc +++ b/chromium/third_party/blink/renderer/core/css/css_font_face_src_value.cc @@ -86,7 +86,7 @@ FontResource& CSSFontFaceSrcValue::Fetch(ExecutionContext* context, resource_request.SetHTTPReferrer(SecurityPolicy::GenerateReferrer( referrer_.referrer_policy, resource_request.Url(), referrer_.referrer)); ResourceLoaderOptions options; - options.initiator_info.name = FetchInitiatorTypeNames::css; + options.initiator_info.name = fetch_initiator_type_names::kCSS; FetchParameters params(resource_request, options); if (RuntimeEnabledFeatures::WebFontsCacheAwareTimeoutAdaptationEnabled()) params.SetCacheAwareLoadingEnabled(kIsCacheAwareLoadingEnabled); @@ -101,8 +101,8 @@ FontResource& CSSFontFaceSrcValue::Fetch(ExecutionContext* context, } // For Workers, Fetcher is lazily loaded, so we must ensure it's available // here. - if (context->IsWorkerGlobalScope()) { - ToWorkerGlobalScope(context)->EnsureFetcher(); + if (auto* scope = DynamicTo<WorkerGlobalScope>(context)) { + scope->EnsureFetcher(); } fetched_ = FontResourceHelper::Create( FontResource::Fetch(params, context->Fetcher(), client), @@ -131,7 +131,7 @@ void CSSFontFaceSrcValue::RestoreCachedResourceIfNeeded( fetched_->GetResource()->Options().content_security_policy_option); context->Fetcher()->EmulateLoadStartedForInspector( fetched_->GetResource(), KURL(resource_url), - mojom::RequestContextType::FONT, FetchInitiatorTypeNames::css); + mojom::RequestContextType::FONT, fetch_initiator_type_names::kCSS); } bool CSSFontFaceSrcValue::Equals(const CSSFontFaceSrcValue& other) const { diff --git a/chromium/third_party/blink/renderer/core/css/css_font_face_src_value.h b/chromium/third_party/blink/renderer/core/css/css_font_face_src_value.h index 6b36900d575..e850ea379f1 100644 --- a/chromium/third_party/blink/renderer/core/css/css_font_face_src_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_font_face_src_value.h @@ -43,18 +43,32 @@ class CORE_EXPORT CSSFontFaceSrcValue : public CSSValue { const String& absolute_resource, const Referrer& referrer, ContentSecurityPolicyDisposition should_check_content_security_policy) { - return new CSSFontFaceSrcValue(specified_resource, absolute_resource, - referrer, false, - should_check_content_security_policy); + return MakeGarbageCollected<CSSFontFaceSrcValue>( + specified_resource, absolute_resource, referrer, false, + should_check_content_security_policy); } static CSSFontFaceSrcValue* CreateLocal( const String& absolute_resource, ContentSecurityPolicyDisposition should_check_content_security_policy) { - return new CSSFontFaceSrcValue(g_empty_string, absolute_resource, - Referrer(), true, - should_check_content_security_policy); + return MakeGarbageCollected<CSSFontFaceSrcValue>( + g_empty_string, absolute_resource, Referrer(), true, + should_check_content_security_policy); } + CSSFontFaceSrcValue( + const String& specified_resource, + const String& absolute_resource, + const Referrer& referrer, + bool local, + ContentSecurityPolicyDisposition should_check_content_security_policy) + : CSSValue(kFontFaceSrcClass), + absolute_resource_(absolute_resource), + specified_resource_(specified_resource), + referrer_(referrer), + is_local_(local), + should_check_content_security_policy_( + should_check_content_security_policy) {} + const String& GetResource() const { return absolute_resource_; } const String& Format() const { return format_; } bool IsLocal() const { return is_local_; } @@ -77,20 +91,6 @@ class CORE_EXPORT CSSFontFaceSrcValue : public CSSValue { } private: - CSSFontFaceSrcValue( - const String& specified_resource, - const String& absolute_resource, - const Referrer& referrer, - bool local, - ContentSecurityPolicyDisposition should_check_content_security_policy) - : CSSValue(kFontFaceSrcClass), - absolute_resource_(absolute_resource), - specified_resource_(specified_resource), - referrer_(referrer), - is_local_(local), - should_check_content_security_policy_( - should_check_content_security_policy) {} - void RestoreCachedResourceIfNeeded(ExecutionContext*) const; String absolute_resource_; @@ -109,19 +109,19 @@ class CORE_EXPORT CSSFontFaceSrcValue : public CSSValue { static FontResourceHelper* Create( FontResource* resource, base::SingleThreadTaskRunner* task_runner) { - return new FontResourceHelper(resource, task_runner); + return MakeGarbageCollected<FontResourceHelper>(resource, task_runner); } - void Trace(blink::Visitor* visitor) override { - FontResourceClient::Trace(visitor); - } - - private: FontResourceHelper(FontResource* resource, base::SingleThreadTaskRunner* task_runner) { SetResource(resource, task_runner); } + void Trace(blink::Visitor* visitor) override { + FontResourceClient::Trace(visitor); + } + + private: String DebugName() const override { return "CSSFontFaceSrcValue::FontResourceHelper"; } diff --git a/chromium/third_party/blink/renderer/core/css/css_font_family_value.cc b/chromium/third_party/blink/renderer/core/css/css_font_family_value.cc index 9420fbe6733..99e4f96e486 100644 --- a/chromium/third_party/blink/renderer/core/css/css_font_family_value.cc +++ b/chromium/third_party/blink/renderer/core/css/css_font_family_value.cc @@ -12,11 +12,13 @@ namespace blink { CSSFontFamilyValue* CSSFontFamilyValue::Create(const String& family_name) { if (family_name.IsNull()) - return new CSSFontFamilyValue(family_name); + return MakeGarbageCollected<CSSFontFamilyValue>(family_name); CSSValuePool::FontFamilyValueCache::AddResult entry = CssValuePool().GetFontFamilyCacheEntry(family_name); - if (!entry.stored_value->value) - entry.stored_value->value = new CSSFontFamilyValue(family_name); + if (!entry.stored_value->value) { + entry.stored_value->value = + MakeGarbageCollected<CSSFontFamilyValue>(family_name); + } return entry.stored_value->value; } diff --git a/chromium/third_party/blink/renderer/core/css/css_font_family_value.h b/chromium/third_party/blink/renderer/core/css/css_font_family_value.h index ffe15d414df..4ed587dba2a 100644 --- a/chromium/third_party/blink/renderer/core/css/css_font_family_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_font_family_value.h @@ -14,6 +14,8 @@ class CORE_EXPORT CSSFontFamilyValue : public CSSValue { public: static CSSFontFamilyValue* Create(const String& family_name); + CSSFontFamilyValue(const String&); + String Value() const { return string_; } String CustomCSSText() const; @@ -27,8 +29,6 @@ class CORE_EXPORT CSSFontFamilyValue : public CSSValue { private: friend class CSSValuePool; - CSSFontFamilyValue(const String&); - // TODO(sashab): Change this to an AtomicString. String string_; }; diff --git a/chromium/third_party/blink/renderer/core/css/css_font_feature_value.h b/chromium/third_party/blink/renderer/core/css/css_font_feature_value.h index c9138b5c1c7..e9c07bd60e0 100644 --- a/chromium/third_party/blink/renderer/core/css/css_font_feature_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_font_feature_value.h @@ -34,9 +34,11 @@ namespace cssvalue { class CSSFontFeatureValue : public CSSValue { public: static CSSFontFeatureValue* Create(const AtomicString& tag, int value) { - return new CSSFontFeatureValue(tag, value); + return MakeGarbageCollected<CSSFontFeatureValue>(tag, value); } + CSSFontFeatureValue(const AtomicString& tag, int value); + const AtomicString& Tag() const { return tag_; } int Value() const { return value_; } String CustomCSSText() const; @@ -48,8 +50,6 @@ class CSSFontFeatureValue : public CSSValue { } private: - CSSFontFeatureValue(const AtomicString& tag, int value); - AtomicString tag_; const int value_; }; diff --git a/chromium/third_party/blink/renderer/core/css/css_font_feature_values_rule.cc b/chromium/third_party/blink/renderer/core/css/css_font_feature_values_rule.cc new file mode 100644 index 00000000000..629a9dc3ba4 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/css_font_feature_values_rule.cc @@ -0,0 +1,61 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/css_font_feature_values_rule.h" + +#include "third_party/blink/renderer/core/css/css_identifier_value.h" +#include "third_party/blink/renderer/core/css/css_value_list.h" +#include "third_party/blink/renderer/core/css/style_rule.h" +#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" + +namespace blink { + +CSSFontFeatureValuesRule::CSSFontFeatureValuesRule( + StyleRuleFontFeatureValues* font_feature_values_rule, + CSSStyleSheet* parent) + : CSSRule(parent), font_feature_values_rule_(font_feature_values_rule) {} + +CSSFontFeatureValuesRule::~CSSFontFeatureValuesRule() = default; + +void CSSFontFeatureValuesRule::setFontFamily(const String& font_family) {} + +String CSSFontFeatureValuesRule::fontFamily() { + return font_feature_values_rule_->FontFamily().CssText(); +} + +void CSSFontFeatureValuesRule::setFontDisplay(const String& font_display) {} + +String CSSFontFeatureValuesRule::fontDisplay() { + if (font_feature_values_rule_->FontDisplay()) + return font_feature_values_rule_->FontDisplay()->CssText(); + return ""; +} + +String CSSFontFeatureValuesRule::cssText() const { + StringBuilder result; + result.Append("@font-feature-values "); + DCHECK(font_feature_values_rule_); + result.Append(font_feature_values_rule_->FontFamily().CssText()); + result.Append(" { "); + if (const CSSIdentifierValue* display = + font_feature_values_rule_->FontDisplay()) { + result.Append("{ font-display: "); + result.Append(display->CssText()); + result.Append("; } "); + } + result.Append("}"); + return result.ToString(); +} + +void CSSFontFeatureValuesRule::Reattach(StyleRuleBase* rule) { + DCHECK(rule); + font_feature_values_rule_ = ToStyleRuleFontFeatureValues(rule); +} + +void CSSFontFeatureValuesRule::Trace(blink::Visitor* visitor) { + visitor->Trace(font_feature_values_rule_); + CSSRule::Trace(visitor); +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/css_font_feature_values_rule.h b/chromium/third_party/blink/renderer/core/css/css_font_feature_values_rule.h new file mode 100644 index 00000000000..a70caec1ee7 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/css_font_feature_values_rule.h @@ -0,0 +1,52 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_FONT_FEATURE_VALUES_RULE_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_FONT_FEATURE_VALUES_RULE_H_ + +#include "third_party/blink/renderer/core/css/css_rule.h" +#include "third_party/blink/renderer/platform/heap/handle.h" + +namespace blink { + +class StyleRuleFontFeatureValues; + +class CSSFontFeatureValuesRule final : public CSSRule { + DEFINE_WRAPPERTYPEINFO(); + + public: + static CSSFontFeatureValuesRule* Create(StyleRuleFontFeatureValues* rule, + CSSStyleSheet* sheet) { + return new CSSFontFeatureValuesRule(rule, sheet); + } + + ~CSSFontFeatureValuesRule() override; + + void setFontFamily(const String& font_family); + String fontFamily(); + void setFontDisplay(const String& font_display); + String fontDisplay(); + + String cssText() const override; + void Reattach(StyleRuleBase*) override; + + StyleRuleFontFeatureValues* StyleRule() const { + return font_feature_values_rule_.Get(); + } + + void Trace(blink::Visitor*) override; + + private: + CSSFontFeatureValuesRule(StyleRuleFontFeatureValues*, CSSStyleSheet* parent); + + CSSRule::Type type() const override { return kFontFeatureValuesRule; } + + Member<StyleRuleFontFeatureValues> font_feature_values_rule_; +}; + +DEFINE_CSS_RULE_TYPE_CASTS(CSSFontFeatureValuesRule, kFontFeatureValuesRule); + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_FONT_FEATURE_VALUES_RULE_H_ diff --git a/chromium/third_party/blink/renderer/core/css/css_font_feature_values_rule.idl b/chromium/third_party/blink/renderer/core/css/css_font_feature_values_rule.idl new file mode 100644 index 00000000000..e65dd40ea22 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/css_font_feature_values_rule.idl @@ -0,0 +1,12 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + RuntimeEnabled=CSSFontFeatureValues +] interface CSSFontFeatureValuesRule : CSSRule { + attribute CSSOMString fontFamily; + + // fontDisplay is not reflected in CSSOM according to the current draft. + attribute CSSOMString fontDisplay; +}; diff --git a/chromium/third_party/blink/renderer/core/css/css_font_selector.h b/chromium/third_party/blink/renderer/core/css/css_font_selector.h index e15f782aac2..b39f1389c30 100644 --- a/chromium/third_party/blink/renderer/core/css/css_font_selector.h +++ b/chromium/third_party/blink/renderer/core/css/css_font_selector.h @@ -43,8 +43,10 @@ class FontDescription; class CORE_EXPORT CSSFontSelector : public FontSelector { public: static CSSFontSelector* Create(Document* document) { - return new CSSFontSelector(document); + return MakeGarbageCollected<CSSFontSelector>(document); } + + explicit CSSFontSelector(Document*); ~CSSFontSelector() override; unsigned Version() const override { return font_face_cache_.Version(); } @@ -81,8 +83,6 @@ class CORE_EXPORT CSSFontSelector : public FontSelector { void Trace(blink::Visitor*) override; protected: - explicit CSSFontSelector(Document*); - void DispatchInvalidationCallbacks(); private: diff --git a/chromium/third_party/blink/renderer/core/css/css_font_style_range_value.h b/chromium/third_party/blink/renderer/core/css/css_font_style_range_value.h index 6e64b2724eb..7330a1bf490 100644 --- a/chromium/third_party/blink/renderer/core/css/css_font_style_range_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_font_style_range_value.h @@ -36,14 +36,26 @@ class CSSFontStyleRangeValue final : public CSSValue { public: static CSSFontStyleRangeValue* Create( const CSSIdentifierValue& font_style_value) { - return new CSSFontStyleRangeValue(font_style_value); + return MakeGarbageCollected<CSSFontStyleRangeValue>(font_style_value); } static CSSFontStyleRangeValue* Create( const CSSIdentifierValue& font_style_value, const CSSValueList& oblique_values) { - return new CSSFontStyleRangeValue(font_style_value, oblique_values); + return MakeGarbageCollected<CSSFontStyleRangeValue>(font_style_value, + oblique_values); } + CSSFontStyleRangeValue(const CSSIdentifierValue& font_style_value, + const CSSValueList& oblique_values) + : CSSValue(kFontStyleRangeClass), + font_style_value_(&font_style_value), + oblique_values_(&oblique_values) {} + + CSSFontStyleRangeValue(const CSSIdentifierValue& font_style_value) + : CSSValue(kFontStyleRangeClass), + font_style_value_(&font_style_value), + oblique_values_(nullptr) {} + const CSSIdentifierValue* GetFontStyleValue() const { return font_style_value_.Get(); } @@ -56,17 +68,6 @@ class CSSFontStyleRangeValue final : public CSSValue { void TraceAfterDispatch(blink::Visitor*); private: - CSSFontStyleRangeValue(const CSSIdentifierValue& font_style_value, - const CSSValueList& oblique_values) - : CSSValue(kFontStyleRangeClass), - font_style_value_(&font_style_value), - oblique_values_(&oblique_values) {} - - CSSFontStyleRangeValue(const CSSIdentifierValue& font_style_value) - : CSSValue(kFontStyleRangeClass), - font_style_value_(&font_style_value), - oblique_values_(nullptr) {} - Member<const CSSIdentifierValue> font_style_value_; Member<const CSSValueList> oblique_values_; }; diff --git a/chromium/third_party/blink/renderer/core/css/css_font_variation_value.h b/chromium/third_party/blink/renderer/core/css/css_font_variation_value.h index 4a2afd76c1f..6f08ebc5df6 100644 --- a/chromium/third_party/blink/renderer/core/css/css_font_variation_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_font_variation_value.h @@ -14,9 +14,11 @@ namespace cssvalue { class CSSFontVariationValue : public CSSValue { public: static CSSFontVariationValue* Create(const AtomicString& tag, float value) { - return new CSSFontVariationValue(tag, value); + return MakeGarbageCollected<CSSFontVariationValue>(tag, value); } + CSSFontVariationValue(const AtomicString& tag, float value); + const AtomicString& Tag() const { return tag_; } float Value() const { return value_; } String CustomCSSText() const; @@ -28,8 +30,6 @@ class CSSFontVariationValue : public CSSValue { } private: - CSSFontVariationValue(const AtomicString& tag, float value); - AtomicString tag_; const float value_; }; diff --git a/chromium/third_party/blink/renderer/core/css/css_function_value.h b/chromium/third_party/blink/renderer/core/css/css_function_value.h index 14fde898b0e..ffc0cbbd8d2 100644 --- a/chromium/third_party/blink/renderer/core/css/css_function_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_function_value.h @@ -13,9 +13,12 @@ namespace blink { class CSSFunctionValue : public CSSValueList { public: static CSSFunctionValue* Create(CSSValueID id) { - return new CSSFunctionValue(id); + return MakeGarbageCollected<CSSFunctionValue>(id); } + CSSFunctionValue(CSSValueID id) + : CSSValueList(kFunctionClass, kCommaSeparator), value_id_(id) {} + String CustomCSSText() const; bool Equals(const CSSFunctionValue& other) const { @@ -28,9 +31,6 @@ class CSSFunctionValue : public CSSValueList { } private: - CSSFunctionValue(CSSValueID id) - : CSSValueList(kFunctionClass, kCommaSeparator), value_id_(id) {} - const CSSValueID value_id_; }; diff --git a/chromium/third_party/blink/renderer/core/css/css_global_rule_set.h b/chromium/third_party/blink/renderer/core/css/css_global_rule_set.h index d0f2e160c86..61d5dc8ddfe 100644 --- a/chromium/third_party/blink/renderer/core/css/css_global_rule_set.h +++ b/chromium/third_party/blink/renderer/core/css/css_global_rule_set.h @@ -24,7 +24,11 @@ class RuleSet; class CSSGlobalRuleSet : public GarbageCollectedFinalized<CSSGlobalRuleSet> { public: - static CSSGlobalRuleSet* Create() { return new CSSGlobalRuleSet(); } + static CSSGlobalRuleSet* Create() { + return MakeGarbageCollected<CSSGlobalRuleSet>(); + } + + CSSGlobalRuleSet() = default; void Dispose(); void InitWatchedSelectorsRuleSet(Document&); @@ -44,7 +48,6 @@ class CSSGlobalRuleSet : public GarbageCollectedFinalized<CSSGlobalRuleSet> { void Trace(blink::Visitor*); private: - CSSGlobalRuleSet() = default; // Constructed from rules in all TreeScopes including UA style and style // injected from extensions. RuleFeatureSet features_; diff --git a/chromium/third_party/blink/renderer/core/css/css_gradient_value.h b/chromium/third_party/blink/renderer/core/css/css_gradient_value.h index b110024bfa5..76807dd7dc3 100644 --- a/chromium/third_party/blink/renderer/core/css/css_gradient_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_gradient_value.h @@ -162,23 +162,10 @@ class CSSLinearGradientValue final : public CSSGradientValue { const CSSPrimitiveValue* angle, CSSGradientRepeat repeat, CSSGradientType gradient_type = kCSSLinearGradient) { - return new CSSLinearGradientValue(first_x, first_y, second_x, second_y, - angle, repeat, gradient_type); + return MakeGarbageCollected<CSSLinearGradientValue>( + first_x, first_y, second_x, second_y, angle, repeat, gradient_type); } - String CustomCSSText() const; - - // Create the gradient for a given size. - scoped_refptr<Gradient> CreateGradient(const CSSToLengthConversionData&, - const FloatSize&, - const Document&, - const ComputedStyle&) const; - - bool Equals(const CSSLinearGradientValue&) const; - - void TraceAfterDispatch(blink::Visitor*); - - private: CSSLinearGradientValue(const CSSValue* first_x, const CSSValue* first_y, const CSSValue* second_x, @@ -193,6 +180,19 @@ class CSSLinearGradientValue final : public CSSGradientValue { second_y_(second_y), angle_(angle) {} + String CustomCSSText() const; + + // Create the gradient for a given size. + scoped_refptr<Gradient> CreateGradient(const CSSToLengthConversionData&, + const FloatSize&, + const Document&, + const ComputedStyle&) const; + + bool Equals(const CSSLinearGradientValue&) const; + + void TraceAfterDispatch(blink::Visitor*); + + private: // Any of these may be null. Member<const CSSValue> first_x_; Member<const CSSValue> first_y_; @@ -214,9 +214,9 @@ class CSSRadialGradientValue final : public CSSGradientValue { const CSSPrimitiveValue* second_radius, CSSGradientRepeat repeat, CSSGradientType gradient_type = kCSSRadialGradient) { - return new CSSRadialGradientValue(first_x, first_y, first_radius, second_x, - second_y, second_radius, nullptr, nullptr, - nullptr, nullptr, repeat, gradient_type); + return MakeGarbageCollected<CSSRadialGradientValue>( + first_x, first_y, first_radius, second_x, second_y, second_radius, + nullptr, nullptr, nullptr, nullptr, repeat, gradient_type); } static CSSGradientValue* Create(const CSSValue* center_x, @@ -227,32 +227,11 @@ class CSSRadialGradientValue final : public CSSGradientValue { const CSSPrimitiveValue* vertical_size, CSSGradientRepeat repeat, CSSGradientType gradient_type) { - return new CSSRadialGradientValue( + return MakeGarbageCollected<CSSRadialGradientValue>( center_x, center_y, nullptr, center_x, center_y, nullptr, shape, sizing_behavior, horizontal_size, vertical_size, repeat, gradient_type); } - String CustomCSSText() const; - - void SetShape(CSSIdentifierValue* val) { shape_ = val; } - void SetSizingBehavior(CSSIdentifierValue* val) { sizing_behavior_ = val; } - - void SetEndHorizontalSize(CSSPrimitiveValue* val) { - end_horizontal_size_ = val; - } - void SetEndVerticalSize(CSSPrimitiveValue* val) { end_vertical_size_ = val; } - - // Create the gradient for a given size. - scoped_refptr<Gradient> CreateGradient(const CSSToLengthConversionData&, - const FloatSize&, - const Document&, - const ComputedStyle&) const; - - bool Equals(const CSSRadialGradientValue&) const; - - void TraceAfterDispatch(blink::Visitor*); - - private: CSSRadialGradientValue(const CSSValue* first_x, const CSSValue* first_y, const CSSPrimitiveValue* first_radius, @@ -277,6 +256,27 @@ class CSSRadialGradientValue final : public CSSGradientValue { end_horizontal_size_(horizontal_size), end_vertical_size_(vertical_size) {} + String CustomCSSText() const; + + void SetShape(CSSIdentifierValue* val) { shape_ = val; } + void SetSizingBehavior(CSSIdentifierValue* val) { sizing_behavior_ = val; } + + void SetEndHorizontalSize(CSSPrimitiveValue* val) { + end_horizontal_size_ = val; + } + void SetEndVerticalSize(CSSPrimitiveValue* val) { end_vertical_size_ = val; } + + // Create the gradient for a given size. + scoped_refptr<Gradient> CreateGradient(const CSSToLengthConversionData&, + const FloatSize&, + const Document&, + const ComputedStyle&) const; + + bool Equals(const CSSRadialGradientValue&) const; + + void TraceAfterDispatch(blink::Visitor*); + + private: // Any of these may be null. Member<const CSSValue> first_x_; Member<const CSSValue> first_y_; @@ -304,9 +304,19 @@ class CSSConicGradientValue final : public CSSGradientValue { const CSSValue* y, const CSSPrimitiveValue* from_angle, CSSGradientRepeat repeat) { - return new CSSConicGradientValue(x, y, from_angle, repeat); + return MakeGarbageCollected<CSSConicGradientValue>(x, y, from_angle, + repeat); } + CSSConicGradientValue(const CSSValue* x, + const CSSValue* y, + const CSSPrimitiveValue* from_angle, + CSSGradientRepeat repeat) + : CSSGradientValue(kConicGradientClass, repeat, kCSSConicGradient), + x_(x), + y_(y), + from_angle_(from_angle) {} + String CustomCSSText() const; // Create the gradient for a given size. @@ -320,15 +330,6 @@ class CSSConicGradientValue final : public CSSGradientValue { void TraceAfterDispatch(blink::Visitor*); private: - CSSConicGradientValue(const CSSValue* x, - const CSSValue* y, - const CSSPrimitiveValue* from_angle, - CSSGradientRepeat repeat) - : CSSGradientValue(kConicGradientClass, repeat, kCSSConicGradient), - x_(x), - y_(y), - from_angle_(from_angle) {} - // Any of these may be null. Member<const CSSValue> x_; Member<const CSSValue> y_; diff --git a/chromium/third_party/blink/renderer/core/css/css_grid_auto_repeat_value.h b/chromium/third_party/blink/renderer/core/css/css_grid_auto_repeat_value.h index ba728b91487..bfb629bb4ea 100644 --- a/chromium/third_party/blink/renderer/core/css/css_grid_auto_repeat_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_grid_auto_repeat_value.h @@ -26,7 +26,13 @@ namespace blink { class CSSGridAutoRepeatValue : public CSSValueList { public: static CSSGridAutoRepeatValue* Create(CSSValueID id) { - return new CSSGridAutoRepeatValue(id); + return MakeGarbageCollected<CSSGridAutoRepeatValue>(id); + } + + CSSGridAutoRepeatValue(CSSValueID id) + : CSSValueList(kGridAutoRepeatClass, kSpaceSeparator), + auto_repeat_id_(id) { + DCHECK(id == CSSValueAutoFill || id == CSSValueAutoFit); } String CustomCSSText() const; @@ -37,12 +43,6 @@ class CSSGridAutoRepeatValue : public CSSValueList { } private: - CSSGridAutoRepeatValue(CSSValueID id) - : CSSValueList(kGridAutoRepeatClass, kSpaceSeparator), - auto_repeat_id_(id) { - DCHECK(id == CSSValueAutoFill || id == CSSValueAutoFit); - } - const CSSValueID auto_repeat_id_; }; diff --git a/chromium/third_party/blink/renderer/core/css/css_grid_line_names_value.h b/chromium/third_party/blink/renderer/core/css/css_grid_line_names_value.h index 18cb9c8ffba..dec5c986ecb 100644 --- a/chromium/third_party/blink/renderer/core/css/css_grid_line_names_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_grid_line_names_value.h @@ -37,16 +37,17 @@ namespace blink { class CSSGridLineNamesValue : public CSSValueList { public: - static CSSGridLineNamesValue* Create() { return new CSSGridLineNamesValue(); } + static CSSGridLineNamesValue* Create() { + return MakeGarbageCollected<CSSGridLineNamesValue>(); + } + + CSSGridLineNamesValue(); String CustomCSSText() const; void TraceAfterDispatch(blink::Visitor* visitor) { CSSValueList::TraceAfterDispatch(visitor); } - - private: - CSSGridLineNamesValue(); }; DEFINE_CSS_VALUE_TYPE_CASTS(CSSGridLineNamesValue, IsGridLineNamesValue()); diff --git a/chromium/third_party/blink/renderer/core/css/css_grid_template_areas_value.h b/chromium/third_party/blink/renderer/core/css/css_grid_template_areas_value.h index 027dde5a858..c2cba1c92f8 100644 --- a/chromium/third_party/blink/renderer/core/css/css_grid_template_areas_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_grid_template_areas_value.h @@ -43,9 +43,13 @@ class CSSGridTemplateAreasValue : public CSSValue { const NamedGridAreaMap& grid_area_map, size_t row_count, size_t column_count) { - return new CSSGridTemplateAreasValue(grid_area_map, row_count, - column_count); + return MakeGarbageCollected<CSSGridTemplateAreasValue>( + grid_area_map, row_count, column_count); } + + CSSGridTemplateAreasValue(const NamedGridAreaMap&, + size_t row_count, + size_t column_count); ~CSSGridTemplateAreasValue() = default; String CustomCSSText() const; @@ -61,10 +65,6 @@ class CSSGridTemplateAreasValue : public CSSValue { } private: - CSSGridTemplateAreasValue(const NamedGridAreaMap&, - size_t row_count, - size_t column_count); - NamedGridAreaMap grid_area_map_; size_t row_count_; size_t column_count_; diff --git a/chromium/third_party/blink/renderer/core/css/css_identifier_value.cc b/chromium/third_party/blink/renderer/core/css/css_identifier_value.cc index b8e722f01bf..63f0c70c009 100644 --- a/chromium/third_party/blink/renderer/core/css/css_identifier_value.cc +++ b/chromium/third_party/blink/renderer/core/css/css_identifier_value.cc @@ -6,7 +6,7 @@ #include "third_party/blink/renderer/core/css/css_markup.h" #include "third_party/blink/renderer/core/css/css_value_pool.h" -#include "third_party/blink/renderer/platform/length.h" +#include "third_party/blink/renderer/platform/geometry/length.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" @@ -16,7 +16,7 @@ CSSIdentifierValue* CSSIdentifierValue::Create(CSSValueID value_id) { CSSIdentifierValue* css_value = CssValuePool().IdentifierCacheValue(value_id); if (!css_value) { css_value = CssValuePool().SetIdentifierCacheValue( - value_id, new CSSIdentifierValue(value_id)); + value_id, MakeGarbageCollected<CSSIdentifierValue>(value_id)); } return css_value; } diff --git a/chromium/third_party/blink/renderer/core/css/css_identifier_value.h b/chromium/third_party/blink/renderer/core/css/css_identifier_value.h index 8829909b1cb..3ca9441b4f4 100644 --- a/chromium/third_party/blink/renderer/core/css/css_identifier_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_identifier_value.h @@ -26,13 +26,24 @@ class CORE_EXPORT CSSIdentifierValue : public CSSValue { static_assert(!std::is_same<T, CSSValueID>::value, "Do not call create() with a CSSValueID; call " "createIdentifier() instead"); - return new CSSIdentifierValue(value); + return MakeGarbageCollected<CSSIdentifierValue>(value); } static CSSIdentifierValue* Create(const Length& value) { - return new CSSIdentifierValue(value); + return MakeGarbageCollected<CSSIdentifierValue>(value); } + explicit CSSIdentifierValue(CSSValueID); + + // TODO(sashab): Remove this function, and update mapping methods to + // specialize the create() method instead. + template <typename T> + CSSIdentifierValue( + T t) // Overriden for special cases in CSSPrimitiveValueMappings.h + : CSSValue(kIdentifierClass), value_id_(PlatformEnumToCSSValueID(t)) {} + + CSSIdentifierValue(const Length&); + CSSValueID GetValueID() const { return value_id_; } String CustomCSSText() const; @@ -50,17 +61,6 @@ class CORE_EXPORT CSSIdentifierValue : public CSSValue { void TraceAfterDispatch(blink::Visitor*); private: - explicit CSSIdentifierValue(CSSValueID); - - // TODO(sashab): Remove this function, and update mapping methods to - // specialize the create() method instead. - template <typename T> - CSSIdentifierValue( - T t) // Overriden for special cases in CSSPrimitiveValueMappings.h - : CSSValue(kIdentifierClass), value_id_(PlatformEnumToCSSValueID(t)) {} - - CSSIdentifierValue(const Length&); - CSSValueID value_id_; }; diff --git a/chromium/third_party/blink/renderer/core/css/css_image_set_value.cc b/chromium/third_party/blink/renderer/core/css/css_image_set_value.cc index 879635ba386..597ea7685b3 100644 --- a/chromium/third_party/blink/renderer/core/css/css_image_set_value.cc +++ b/chromium/third_party/blink/renderer/core/css/css_image_set_value.cc @@ -117,8 +117,8 @@ StyleImage* CSSImageSetValue::CacheImage( resource_request.SetHTTPReferrer(image.referrer); ResourceLoaderOptions options; options.initiator_info.name = parser_mode_ == kUASheetMode - ? FetchInitiatorTypeNames::uacss - : FetchInitiatorTypeNames::css; + ? fetch_initiator_type_names::kUacss + : fetch_initiator_type_names::kCSS; FetchParameters params(resource_request, options); if (cross_origin != kCrossOriginAttributeNotSet) { diff --git a/chromium/third_party/blink/renderer/core/css/css_image_set_value.h b/chromium/third_party/blink/renderer/core/css/css_image_set_value.h index 2841c7367b4..43b9db23886 100644 --- a/chromium/third_party/blink/renderer/core/css/css_image_set_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_image_set_value.h @@ -41,8 +41,10 @@ class StyleImage; class CSSImageSetValue : public CSSValueList { public: static CSSImageSetValue* Create(CSSParserMode parser_mode) { - return new CSSImageSetValue(parser_mode); + return MakeGarbageCollected<CSSImageSetValue>(parser_mode); } + + explicit CSSImageSetValue(CSSParserMode); ~CSSImageSetValue(); bool IsCachePending(float device_scale_factor) const; @@ -72,8 +74,6 @@ class CSSImageSetValue : public CSSValueList { ImageWithScale BestImageForScaleFactor(float scale_factor); private: - explicit CSSImageSetValue(CSSParserMode); - void FillImageSet(); static inline bool CompareByScaleFactor(ImageWithScale first, ImageWithScale second) { diff --git a/chromium/third_party/blink/renderer/core/css/css_image_value.cc b/chromium/third_party/blink/renderer/core/css/css_image_value.cc index 8cafaa9575a..ac9305000c7 100644 --- a/chromium/third_party/blink/renderer/core/css/css_image_value.cc +++ b/chromium/third_party/blink/renderer/core/css/css_image_value.cc @@ -64,7 +64,7 @@ StyleImage* CSSImageValue::CacheImage( referrer_.referrer_policy, resource_request.Url(), referrer_.referrer)); ResourceLoaderOptions options; options.initiator_info.name = initiator_name_.IsEmpty() - ? FetchInitiatorTypeNames::css + ? fetch_initiator_type_names::kCSS : initiator_name_; FetchParameters params(resource_request, options); @@ -97,7 +97,7 @@ void CSSImageValue::RestoreCachedResourceIfNeeded( resource->EmulateLoadStartedForInspector( document.Fetcher(), KURL(absolute_url_), - initiator_name_.IsEmpty() ? FetchInitiatorTypeNames::css + initiator_name_.IsEmpty() ? fetch_initiator_type_names::kCSS : initiator_name_); } diff --git a/chromium/third_party/blink/renderer/core/css/css_image_value.h b/chromium/third_party/blink/renderer/core/css/css_image_value.h index 6124f79d61f..ec7e0cfe1c3 100644 --- a/chromium/third_party/blink/renderer/core/css/css_image_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_image_value.h @@ -55,11 +55,17 @@ class CORE_EXPORT CSSImageValue : public CSSValue { const KURL& url, const Referrer& referrer, StyleImage* image = nullptr) { - return new CSSImageValue(raw_value, url, referrer, image); + return MakeGarbageCollected<CSSImageValue>(raw_value, url, referrer, image); } static CSSImageValue* Create(const AtomicString& absolute_url) { - return new CSSImageValue(absolute_url); + return MakeGarbageCollected<CSSImageValue>(absolute_url); } + + CSSImageValue(const AtomicString& raw_value, + const KURL&, + const Referrer&, + StyleImage*); + CSSImageValue(const AtomicString& absolute_url); ~CSSImageValue(); bool IsCachePending() const { return !cached_image_; } @@ -101,12 +107,6 @@ class CORE_EXPORT CSSImageValue : public CSSValue { void RestoreCachedResourceIfNeeded(const Document&) const; private: - CSSImageValue(const AtomicString& raw_value, - const KURL&, - const Referrer&, - StyleImage*); - CSSImageValue(const AtomicString& absolute_url); - AtomicString relative_url_; Referrer referrer_; AtomicString initiator_name_; diff --git a/chromium/third_party/blink/renderer/core/css/css_import_rule.h b/chromium/third_party/blink/renderer/core/css/css_import_rule.h index 546eb5da4a6..d9be4fdcdfd 100644 --- a/chromium/third_party/blink/renderer/core/css/css_import_rule.h +++ b/chromium/third_party/blink/renderer/core/css/css_import_rule.h @@ -35,9 +35,10 @@ class CSSImportRule final : public CSSRule { public: static CSSImportRule* Create(StyleRuleImport* rule, CSSStyleSheet* sheet) { - return new CSSImportRule(rule, sheet); + return MakeGarbageCollected<CSSImportRule>(rule, sheet); } + CSSImportRule(StyleRuleImport*, CSSStyleSheet*); ~CSSImportRule() override; String cssText() const override; @@ -50,8 +51,6 @@ class CSSImportRule final : public CSSRule { void Trace(blink::Visitor*) override; private: - CSSImportRule(StyleRuleImport*, CSSStyleSheet*); - CSSRule::Type type() const override { return kImportRule; } Member<StyleRuleImport> import_rule_; diff --git a/chromium/third_party/blink/renderer/core/css/css_initial_value.h b/chromium/third_party/blink/renderer/core/css/css_initial_value.h index 7f127949f05..7cbecaf0dfb 100644 --- a/chromium/third_party/blink/renderer/core/css/css_initial_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_initial_value.h @@ -22,14 +22,17 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_INITIAL_VALUE_H_ #include "base/memory/scoped_refptr.h" +#include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/css/css_value.h" namespace blink { -class CSSInitialValue : public CSSValue { +class CORE_EXPORT CSSInitialValue : public CSSValue { public: static CSSInitialValue* Create(); + CSSInitialValue() : CSSValue(kInitialClass) {} + String CustomCSSText() const; bool Equals(const CSSInitialValue&) const { return true; } @@ -40,8 +43,6 @@ class CSSInitialValue : public CSSValue { private: friend class CSSValuePool; - - CSSInitialValue() : CSSValue(kInitialClass) {} }; DEFINE_CSS_VALUE_TYPE_CASTS(CSSInitialValue, IsInitialValue()); diff --git a/chromium/third_party/blink/renderer/core/css/css_invalid_variable_value.cc b/chromium/third_party/blink/renderer/core/css/css_invalid_variable_value.cc new file mode 100644 index 00000000000..7d191c2276a --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/css_invalid_variable_value.cc @@ -0,0 +1,20 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/css_invalid_variable_value.h" + +#include "third_party/blink/renderer/core/css/css_value_pool.h" +#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" + +namespace blink { + +CSSInvalidVariableValue* CSSInvalidVariableValue::Create() { + return CssValuePool().InvalidVariableValue(); +} + +String CSSInvalidVariableValue::CustomCSSText() const { + return ""; +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/css_invalid_variable_value.h b/chromium/third_party/blink/renderer/core/css/css_invalid_variable_value.h new file mode 100644 index 00000000000..090ca837b2c --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/css_invalid_variable_value.h @@ -0,0 +1,35 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_INVALID_VARIABLE_VALUE_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_INVALID_VARIABLE_VALUE_H_ + +#include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/css/css_value.h" + +namespace blink { + +class CORE_EXPORT CSSInvalidVariableValue : public CSSValue { + public: + static CSSInvalidVariableValue* Create(); + + String CustomCSSText() const; + + bool Equals(const CSSInvalidVariableValue&) const { return true; } + + void TraceAfterDispatch(blink::Visitor* visitor) { + CSSValue::TraceAfterDispatch(visitor); + } + + private: + friend class CSSValuePool; + + CSSInvalidVariableValue() : CSSValue(kInvalidVariableValueClass) {} +}; + +DEFINE_CSS_VALUE_TYPE_CASTS(CSSInvalidVariableValue, IsInvalidVariableValue()); + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_INVALID_VARIABLE_VALUE_H_ diff --git a/chromium/third_party/blink/renderer/core/css/css_invalid_variable_value_test.cc b/chromium/third_party/blink/renderer/core/css/css_invalid_variable_value_test.cc new file mode 100644 index 00000000000..dcedc4f0fad --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/css_invalid_variable_value_test.cc @@ -0,0 +1,34 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/css_invalid_variable_value.h" + +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" + +namespace blink { +namespace { + +TEST(CSSInvalidVariableValueTest, Create) { + EXPECT_TRUE(CSSInvalidVariableValue::Create()); +} + +TEST(CSSInvalidVariableValueTest, Pool) { + const CSSInvalidVariableValue* value1 = CSSInvalidVariableValue::Create(); + const CSSInvalidVariableValue* value2 = CSSInvalidVariableValue::Create(); + EXPECT_EQ(value1, value2); +} + +TEST(CSSInvalidVariableValueTest, Equals) { + const CSSInvalidVariableValue* value1 = CSSInvalidVariableValue::Create(); + const CSSInvalidVariableValue* value2 = CSSInvalidVariableValue::Create(); + EXPECT_TRUE(value1->Equals(*value2)); +} + +TEST(CSSInvalidVariableValueTest, CustomCSSText) { + EXPECT_EQ("", CSSInvalidVariableValue::Create()->CustomCSSText()); +} + +} // namespace +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/css_keyframe_rule.h b/chromium/third_party/blink/renderer/core/css/css_keyframe_rule.h index e4172f50071..df8f03f392f 100644 --- a/chromium/third_party/blink/renderer/core/css/css_keyframe_rule.h +++ b/chromium/third_party/blink/renderer/core/css/css_keyframe_rule.h @@ -40,6 +40,7 @@ class CSSKeyframeRule final : public CSSRule { DEFINE_WRAPPERTYPEINFO(); public: + CSSKeyframeRule(StyleRuleKeyframe*, CSSKeyframesRule* parent); ~CSSKeyframeRule() override; String cssText() const override { return keyframe_->CssText(); } @@ -53,8 +54,6 @@ class CSSKeyframeRule final : public CSSRule { void Trace(blink::Visitor*) override; private: - CSSKeyframeRule(StyleRuleKeyframe*, CSSKeyframesRule* parent); - CSSRule::Type type() const override { return kKeyframeRule; } Member<StyleRuleKeyframe> keyframe_; diff --git a/chromium/third_party/blink/renderer/core/css/css_keyframes_rule.cc b/chromium/third_party/blink/renderer/core/css/css_keyframes_rule.cc index 4a7b8e2e294..93650f7a901 100644 --- a/chromium/third_party/blink/renderer/core/css/css_keyframes_rule.cc +++ b/chromium/third_party/blink/renderer/core/css/css_keyframes_rule.cc @@ -162,9 +162,11 @@ CSSKeyframeRule* CSSKeyframesRule::Item(unsigned index) const { DCHECK_EQ(child_rule_cssom_wrappers_.size(), keyframes_rule_->Keyframes().size()); Member<CSSKeyframeRule>& rule = child_rule_cssom_wrappers_[index]; - if (!rule) - rule = new CSSKeyframeRule(keyframes_rule_->Keyframes()[index].Get(), - const_cast<CSSKeyframesRule*>(this)); + if (!rule) { + rule = MakeGarbageCollected<CSSKeyframeRule>( + keyframes_rule_->Keyframes()[index].Get(), + const_cast<CSSKeyframesRule*>(this)); + } return rule.Get(); } diff --git a/chromium/third_party/blink/renderer/core/css/css_keyframes_rule.h b/chromium/third_party/blink/renderer/core/css/css_keyframes_rule.h index 032d1ce4eb1..e9db4179268 100644 --- a/chromium/third_party/blink/renderer/core/css/css_keyframes_rule.h +++ b/chromium/third_party/blink/renderer/core/css/css_keyframes_rule.h @@ -39,8 +39,12 @@ class StyleRuleKeyframe; class StyleRuleKeyframes final : public StyleRuleBase { public: - static StyleRuleKeyframes* Create() { return new StyleRuleKeyframes(); } + static StyleRuleKeyframes* Create() { + return MakeGarbageCollected<StyleRuleKeyframes>(); + } + StyleRuleKeyframes(); + explicit StyleRuleKeyframes(const StyleRuleKeyframes&); ~StyleRuleKeyframes(); const HeapVector<Member<StyleRuleKeyframe>>& Keyframes() const { @@ -59,7 +63,9 @@ class StyleRuleKeyframes final : public StyleRuleBase { int FindKeyframeIndex(const String& key) const; - StyleRuleKeyframes* Copy() const { return new StyleRuleKeyframes(*this); } + StyleRuleKeyframes* Copy() const { + return MakeGarbageCollected<StyleRuleKeyframes>(*this); + } void TraceAfterDispatch(blink::Visitor*); @@ -67,9 +73,6 @@ class StyleRuleKeyframes final : public StyleRuleBase { unsigned Version() const { return version_; } private: - StyleRuleKeyframes(); - explicit StyleRuleKeyframes(const StyleRuleKeyframes&); - HeapVector<Member<StyleRuleKeyframe>> keyframes_; AtomicString name_; unsigned version_ : 31; @@ -84,9 +87,10 @@ class CSSKeyframesRule final : public CSSRule { public: static CSSKeyframesRule* Create(StyleRuleKeyframes* rule, CSSStyleSheet* sheet) { - return new CSSKeyframesRule(rule, sheet); + return MakeGarbageCollected<CSSKeyframesRule>(rule, sheet); } + CSSKeyframesRule(StyleRuleKeyframes*, CSSStyleSheet* parent); ~CSSKeyframesRule() override; StyleRuleKeyframes* Keyframes() { return keyframes_rule_.Get(); } @@ -116,8 +120,6 @@ class CSSKeyframesRule final : public CSSRule { void Trace(blink::Visitor*) override; private: - CSSKeyframesRule(StyleRuleKeyframes*, CSSStyleSheet* parent); - CSSRule::Type type() const override { return kKeyframesRule; } Member<StyleRuleKeyframes> keyframes_rule_; diff --git a/chromium/third_party/blink/renderer/core/css/css_layout_function_value.h b/chromium/third_party/blink/renderer/core/css/css_layout_function_value.h index 6ca76cacea4..e85c02cc38b 100644 --- a/chromium/third_party/blink/renderer/core/css/css_layout_function_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_layout_function_value.h @@ -19,8 +19,10 @@ class CSSLayoutFunctionValue : public CSSValue { public: static CSSLayoutFunctionValue* Create(CSSCustomIdentValue* name, bool is_inline) { - return new CSSLayoutFunctionValue(name, is_inline); + return MakeGarbageCollected<CSSLayoutFunctionValue>(name, is_inline); } + + CSSLayoutFunctionValue(CSSCustomIdentValue* name, bool is_inline); ~CSSLayoutFunctionValue(); String CustomCSSText() const; @@ -31,8 +33,6 @@ class CSSLayoutFunctionValue : public CSSValue { void TraceAfterDispatch(blink::Visitor*); private: - CSSLayoutFunctionValue(CSSCustomIdentValue* name, bool is_inline); - Member<CSSCustomIdentValue> name_; bool is_inline_; }; diff --git a/chromium/third_party/blink/renderer/core/css/css_media_rule.h b/chromium/third_party/blink/renderer/core/css/css_media_rule.h index fb6b752f910..1991686d906 100644 --- a/chromium/third_party/blink/renderer/core/css/css_media_rule.h +++ b/chromium/third_party/blink/renderer/core/css/css_media_rule.h @@ -35,9 +35,10 @@ class CSSMediaRule final : public CSSConditionRule { public: static CSSMediaRule* Create(StyleRuleMedia* rule, CSSStyleSheet* sheet) { - return new CSSMediaRule(rule, sheet); + return MakeGarbageCollected<CSSMediaRule>(rule, sheet); } + CSSMediaRule(StyleRuleMedia*, CSSStyleSheet*); ~CSSMediaRule() override; void Reattach(StyleRuleBase*) override; @@ -49,8 +50,6 @@ class CSSMediaRule final : public CSSConditionRule { void Trace(blink::Visitor*) override; private: - CSSMediaRule(StyleRuleMedia*, CSSStyleSheet*); - CSSRule::Type type() const override { return kMediaRule; } scoped_refptr<MediaQuerySet> MediaQueries() const; diff --git a/chromium/third_party/blink/renderer/core/css/css_namespace_rule.h b/chromium/third_party/blink/renderer/core/css/css_namespace_rule.h index ad2f2f2bd3e..448891b6a16 100644 --- a/chromium/third_party/blink/renderer/core/css/css_namespace_rule.h +++ b/chromium/third_party/blink/renderer/core/css/css_namespace_rule.h @@ -17,9 +17,10 @@ class CSSNamespaceRule final : public CSSRule { public: static CSSNamespaceRule* Create(StyleRuleNamespace* rule, CSSStyleSheet* sheet) { - return new CSSNamespaceRule(rule, sheet); + return MakeGarbageCollected<CSSNamespaceRule>(rule, sheet); } + CSSNamespaceRule(StyleRuleNamespace*, CSSStyleSheet*); ~CSSNamespaceRule() override; String cssText() const override; @@ -31,8 +32,6 @@ class CSSNamespaceRule final : public CSSRule { void Trace(blink::Visitor*) override; private: - CSSNamespaceRule(StyleRuleNamespace*, CSSStyleSheet*); - CSSRule::Type type() const override { return kNamespaceRule; } Member<StyleRuleNamespace> namespace_rule_; diff --git a/chromium/third_party/blink/renderer/core/css/css_page_rule.h b/chromium/third_party/blink/renderer/core/css/css_page_rule.h index 9e839663776..c5f756cbb7c 100644 --- a/chromium/third_party/blink/renderer/core/css/css_page_rule.h +++ b/chromium/third_party/blink/renderer/core/css/css_page_rule.h @@ -38,9 +38,10 @@ class CORE_EXPORT CSSPageRule final : public CSSRule { public: static CSSPageRule* Create(StyleRulePage* rule, CSSStyleSheet* sheet) { - return new CSSPageRule(rule, sheet); + return MakeGarbageCollected<CSSPageRule>(rule, sheet); } + CSSPageRule(StyleRulePage*, CSSStyleSheet*); ~CSSPageRule() override; String cssText() const override; @@ -54,8 +55,6 @@ class CORE_EXPORT CSSPageRule final : public CSSRule { void Trace(blink::Visitor*) override; private: - CSSPageRule(StyleRulePage*, CSSStyleSheet*); - CSSRule::Type type() const override { return kPageRule; } Member<StyleRulePage> page_rule_; diff --git a/chromium/third_party/blink/renderer/core/css/css_page_rule_test.cc b/chromium/third_party/blink/renderer/core/css/css_page_rule_test.cc index 7ad3b52d9d9..e6b7c0c0a8f 100644 --- a/chromium/third_party/blink/renderer/core/css/css_page_rule_test.cc +++ b/chromium/third_party/blink/renderer/core/css/css_page_rule_test.cc @@ -5,52 +5,54 @@ #include "third_party/blink/renderer/core/css/css_page_rule.h" #include "third_party/blink/renderer/core/css/css_rule_list.h" -#include "third_party/blink/renderer/core/css/css_test_helper.h" +#include "third_party/blink/renderer/core/css/css_test_helpers.h" #include "third_party/blink/renderer/core/dom/document.h" #include "testing/gtest/include/gtest/gtest.h" namespace blink { +using namespace css_test_helpers; + TEST(CSSPageRule, Serializing) { - CSSTestHelper helper; + TestStyleSheet sheet; const char* css_rule = "@page :left { size: auto; }"; - helper.AddCSSRules(css_rule); - if (helper.CssRules()) { - EXPECT_EQ(1u, helper.CssRules()->length()); - EXPECT_EQ(String(css_rule), helper.CssRules()->item(0)->cssText()); - EXPECT_EQ(CSSRule::kPageRule, helper.CssRules()->item(0)->type()); - if (CSSPageRule* page_rule = ToCSSPageRule(helper.CssRules()->item(0))) + sheet.AddCSSRules(css_rule); + if (sheet.CssRules()) { + EXPECT_EQ(1u, sheet.CssRules()->length()); + EXPECT_EQ(String(css_rule), sheet.CssRules()->item(0)->cssText()); + EXPECT_EQ(CSSRule::kPageRule, sheet.CssRules()->item(0)->type()); + if (CSSPageRule* page_rule = ToCSSPageRule(sheet.CssRules()->item(0))) EXPECT_EQ(":left", page_rule->selectorText()); } } TEST(CSSPageRule, selectorText) { - CSSTestHelper helper; + TestStyleSheet sheet; const char* css_rule = "@page :left { size: auto; }"; - helper.AddCSSRules(css_rule); - DCHECK(helper.CssRules()); - EXPECT_EQ(1u, helper.CssRules()->length()); + sheet.AddCSSRules(css_rule); + DCHECK(sheet.CssRules()); + EXPECT_EQ(1u, sheet.CssRules()->length()); - CSSPageRule* page_rule = ToCSSPageRule(helper.CssRules()->item(0)); + CSSPageRule* page_rule = ToCSSPageRule(sheet.CssRules()->item(0)); EXPECT_EQ(":left", page_rule->selectorText()); // set invalid page selector. - page_rule->setSelectorText(&helper.GetDocument(), ":hover"); + page_rule->setSelectorText(&sheet.GetDocument(), ":hover"); EXPECT_EQ(":left", page_rule->selectorText()); // set invalid page selector. - page_rule->setSelectorText(&helper.GetDocument(), "right { bla"); + page_rule->setSelectorText(&sheet.GetDocument(), "right { bla"); EXPECT_EQ(":left", page_rule->selectorText()); // set page pseudo class selector. - page_rule->setSelectorText(&helper.GetDocument(), ":right"); + page_rule->setSelectorText(&sheet.GetDocument(), ":right"); EXPECT_EQ(":right", page_rule->selectorText()); // set page type selector. - page_rule->setSelectorText(&helper.GetDocument(), "namedpage"); + page_rule->setSelectorText(&sheet.GetDocument(), "namedpage"); EXPECT_EQ("namedpage", page_rule->selectorText()); } diff --git a/chromium/third_party/blink/renderer/core/css/css_paint_image_generator.h b/chromium/third_party/blink/renderer/core/css/css_paint_image_generator.h index 7998542b4ec..ccecc1e9be9 100644 --- a/chromium/third_party/blink/renderer/core/css/css_paint_image_generator.h +++ b/chromium/third_party/blink/renderer/core/css/css_paint_image_generator.h @@ -6,9 +6,9 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PAINT_IMAGE_GENERATOR_H_ #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/cssom/css_style_value.h" -#include "third_party/blink/renderer/core/css_property_names.h" -#include "third_party/blink/renderer/platform/geometry/int_size.h" +#include "third_party/blink/renderer/platform/geometry/float_size.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { @@ -50,7 +50,7 @@ class CORE_EXPORT CSSPaintImageGenerator // representing an invalid image if an error occurred. // The |container_size| is the container size with subpixel snapping. virtual scoped_refptr<Image> Paint(const ImageResourceObserver&, - const IntSize& container_size, + const FloatSize& container_size, const CSSStyleValueVector*) = 0; virtual const Vector<CSSPropertyID>& NativeInvalidationProperties() const = 0; diff --git a/chromium/third_party/blink/renderer/core/css/css_paint_value.cc b/chromium/third_party/blink/renderer/core/css/css_paint_value.cc index d97f41b6b6b..0069f562e35 100644 --- a/chromium/third_party/blink/renderer/core/css/css_paint_value.cc +++ b/chromium/third_party/blink/renderer/core/css/css_paint_value.cc @@ -16,7 +16,7 @@ namespace blink { CSSPaintValue::CSSPaintValue(CSSCustomIdentValue* name) : CSSImageGeneratorValue(kPaintClass), name_(name), - paint_image_generator_observer_(new Observer(this)) {} + paint_image_generator_observer_(MakeGarbageCollected<Observer>(this)) {} CSSPaintValue::CSSPaintValue( CSSCustomIdentValue* name, @@ -61,8 +61,7 @@ scoped_refptr<Image> CSSPaintValue::GetImage( if (!ParseInputArguments(document)) return nullptr; - return generator_->Paint(client, RoundedIntSize(target_size), - parsed_input_arguments_); + return generator_->Paint(client, target_size, parsed_input_arguments_); } bool CSSPaintValue::ParseInputArguments(const Document& document) { @@ -83,7 +82,7 @@ bool CSSPaintValue::ParseInputArguments(const Document& document) { return false; } - parsed_input_arguments_ = new CSSStyleValueVector(); + parsed_input_arguments_ = MakeGarbageCollected<CSSStyleValueVector>(); for (wtf_size_t i = 0; i < argument_variable_data_.size(); ++i) { // If we are parsing a paint() function, we must be a secure context. diff --git a/chromium/third_party/blink/renderer/core/css/css_paint_value.h b/chromium/third_party/blink/renderer/core/css/css_paint_value.h index fc879596b9b..32953d12af0 100644 --- a/chromium/third_party/blink/renderer/core/css/css_paint_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_paint_value.h @@ -18,15 +18,18 @@ namespace blink { class CORE_EXPORT CSSPaintValue : public CSSImageGeneratorValue { public: static CSSPaintValue* Create(CSSCustomIdentValue* name) { - return new CSSPaintValue(name); + return MakeGarbageCollected<CSSPaintValue>(name); } static CSSPaintValue* Create( CSSCustomIdentValue* name, Vector<scoped_refptr<CSSVariableData>>& variable_data) { - return new CSSPaintValue(name, variable_data); + return MakeGarbageCollected<CSSPaintValue>(name, variable_data); } + explicit CSSPaintValue(CSSCustomIdentValue* name); + CSSPaintValue(CSSCustomIdentValue* name, + Vector<scoped_refptr<CSSVariableData>>&); ~CSSPaintValue(); String CustomCSSText() const; @@ -59,11 +62,6 @@ class CORE_EXPORT CSSPaintValue : public CSSImageGeneratorValue { void TraceAfterDispatch(blink::Visitor*); private: - explicit CSSPaintValue(CSSCustomIdentValue* name); - - CSSPaintValue(CSSCustomIdentValue* name, - Vector<scoped_refptr<CSSVariableData>>&); - class Observer final : public CSSPaintImageGenerator::Observer { public: explicit Observer(CSSPaintValue* owner_value) : owner_value_(owner_value) {} diff --git a/chromium/third_party/blink/renderer/core/css/css_paint_value_test.cc b/chromium/third_party/blink/renderer/core/css/css_paint_value_test.cc index 923faeaf823..bca3c182049 100644 --- a/chromium/third_party/blink/renderer/core/css/css_paint_value_test.cc +++ b/chromium/third_party/blink/renderer/core/css/css_paint_value_test.cc @@ -23,17 +23,18 @@ class CSSPaintValueTest : public RenderingTest { void LoadTestData(const std::string& file_name) { String testing_path = test::BlinkRootDir(); testing_path.append("/renderer/core/css/test_data/"); - WebURL url = URLTestHelpers::RegisterMockedURLLoadFromBase( + WebURL url = url_test_helpers::RegisterMockedURLLoadFromBase( WebString::FromUTF8(base_url_), testing_path, WebString::FromUTF8(file_name)); - FrameTestHelpers::LoadFrame(helper_.GetWebView()->MainFrameImpl(), - base_url_ + file_name); + frame_test_helpers::LoadFrame(helper_.GetWebView()->MainFrameImpl(), + base_url_ + file_name); ForceFullCompositingUpdate(); - URLTestHelpers::RegisterMockedURLUnregister(url); + url_test_helpers::RegisterMockedURLUnregister(url); } void ForceFullCompositingUpdate() { - helper_.GetWebView()->UpdateAllLifecyclePhases(); + helper_.GetWebView()->MainFrameWidget()->UpdateAllLifecyclePhases( + WebWidget::LifecycleUpdateReason::kTest); } LocalFrame* GetFrame() const { return helper_.LocalMainFrame()->GetFrame(); } @@ -45,7 +46,7 @@ class CSSPaintValueTest : public RenderingTest { helper_.Initialize(nullptr, nullptr, nullptr); base_url_ = "https://www.test.com/"; } - FrameTestHelpers::WebViewHelper helper_; + frame_test_helpers::WebViewHelper helper_; std::string base_url_; }; diff --git a/chromium/third_party/blink/renderer/core/css/css_path_value.cc b/chromium/third_party/blink/renderer/core/css/css_path_value.cc index 5382bad7a65..573f1e8f2f5 100644 --- a/chromium/third_party/blink/renderer/core/css/css_path_value.cc +++ b/chromium/third_party/blink/renderer/core/css/css_path_value.cc @@ -16,7 +16,8 @@ namespace cssvalue { CSSPathValue* CSSPathValue::Create( scoped_refptr<StylePath> style_path, PathSerializationFormat serialization_format) { - return new CSSPathValue(std::move(style_path), serialization_format); + return MakeGarbageCollected<CSSPathValue>(std::move(style_path), + serialization_format); } CSSPathValue* CSSPathValue::Create( diff --git a/chromium/third_party/blink/renderer/core/css/css_path_value.h b/chromium/third_party/blink/renderer/core/css/css_path_value.h index 9352a74d9b5..5366847b20b 100644 --- a/chromium/third_party/blink/renderer/core/css/css_path_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_path_value.h @@ -27,6 +27,8 @@ class CSSPathValue : public CSSValue { static CSSPathValue& EmptyPathValue(); + CSSPathValue(scoped_refptr<StylePath>, PathSerializationFormat); + StylePath* GetStylePath() const { return style_path_.get(); } String CustomCSSText() const; @@ -39,8 +41,6 @@ class CSSPathValue : public CSSValue { } private: - CSSPathValue(scoped_refptr<StylePath>, PathSerializationFormat); - scoped_refptr<StylePath> style_path_; const PathSerializationFormat serialization_format_; }; diff --git a/chromium/third_party/blink/renderer/core/css/css_pending_substitution_value.h b/chromium/third_party/blink/renderer/core/css/css_pending_substitution_value.h index 8533f6f4999..c26dcb6d16d 100644 --- a/chromium/third_party/blink/renderer/core/css/css_pending_substitution_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_pending_substitution_value.h @@ -5,9 +5,9 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PENDING_SUBSTITUTION_VALUE_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PENDING_SUBSTITUTION_VALUE_H_ +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/css_value.h" #include "third_party/blink/renderer/core/css/css_variable_reference_value.h" -#include "third_party/blink/renderer/core/css_property_names.h" namespace blink { @@ -16,10 +16,16 @@ class CSSPendingSubstitutionValue : public CSSValue { static CSSPendingSubstitutionValue* Create( CSSPropertyID shorthand_property_id, CSSVariableReferenceValue* shorthand_value) { - return new CSSPendingSubstitutionValue(shorthand_property_id, - shorthand_value); + return MakeGarbageCollected<CSSPendingSubstitutionValue>( + shorthand_property_id, shorthand_value); } + CSSPendingSubstitutionValue(CSSPropertyID shorthand_property_id, + CSSVariableReferenceValue* shorthand_value) + : CSSValue(kPendingSubstitutionValueClass), + shorthand_property_id_(shorthand_property_id), + shorthand_value_(shorthand_value) {} + CSSVariableReferenceValue* ShorthandValue() const { return shorthand_value_.Get(); } @@ -34,12 +40,6 @@ class CSSPendingSubstitutionValue : public CSSValue { void TraceAfterDispatch(blink::Visitor*); private: - CSSPendingSubstitutionValue(CSSPropertyID shorthand_property_id, - CSSVariableReferenceValue* shorthand_value) - : CSSValue(kPendingSubstitutionValueClass), - shorthand_property_id_(shorthand_property_id), - shorthand_value_(shorthand_value) {} - CSSPropertyID shorthand_property_id_; Member<CSSVariableReferenceValue> shorthand_value_; }; diff --git a/chromium/third_party/blink/renderer/core/css/css_primitive_value.cc b/chromium/third_party/blink/renderer/core/css/css_primitive_value.cc index f0357072aa5..11e9d167736 100644 --- a/chromium/third_party/blink/renderer/core/css/css_primitive_value.cc +++ b/chromium/third_party/blink/renderer/core/css/css_primitive_value.cc @@ -27,7 +27,7 @@ #include "third_party/blink/renderer/core/css/css_resolution_units.h" #include "third_party/blink/renderer/core/css/css_to_length_conversion_data.h" #include "third_party/blink/renderer/core/css/css_value_pool.h" -#include "third_party/blink/renderer/platform/layout_unit.h" +#include "third_party/blink/renderer/platform/geometry/layout_unit.h" #include "third_party/blink/renderer/platform/wtf/size_assertions.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" @@ -95,37 +95,39 @@ CSSPrimitiveValue* CSSPrimitiveValue::Create(double value, UnitType type) { value = 0; if (value < 0 || value > CSSValuePool::kMaximumCacheableIntegerValue) - return new CSSPrimitiveValue(value, type); + return MakeGarbageCollected<CSSPrimitiveValue>(value, type); - int int_value = static_cast<int>(value); + int int_value = clampTo<int>(value); if (value != int_value) - return new CSSPrimitiveValue(value, type); + return MakeGarbageCollected<CSSPrimitiveValue>(value, type); CSSValuePool& pool = CssValuePool(); CSSPrimitiveValue* result = nullptr; switch (type) { case CSSPrimitiveValue::UnitType::kPixels: result = pool.PixelCacheValue(int_value); - if (!result) - result = pool.SetPixelCacheValue(int_value, - new CSSPrimitiveValue(value, type)); + if (!result) { + result = pool.SetPixelCacheValue( + int_value, MakeGarbageCollected<CSSPrimitiveValue>(value, type)); + } return result; case CSSPrimitiveValue::UnitType::kPercentage: result = pool.PercentCacheValue(int_value); - if (!result) - result = pool.SetPercentCacheValue(int_value, - new CSSPrimitiveValue(value, type)); + if (!result) { + result = pool.SetPercentCacheValue( + int_value, MakeGarbageCollected<CSSPrimitiveValue>(value, type)); + } return result; case CSSPrimitiveValue::UnitType::kNumber: case CSSPrimitiveValue::UnitType::kInteger: result = pool.NumberCacheValue(int_value); if (!result) result = pool.SetNumberCacheValue( - int_value, new CSSPrimitiveValue( + int_value, MakeGarbageCollected<CSSPrimitiveValue>( value, CSSPrimitiveValue::UnitType::kInteger)); return result; default: - return new CSSPrimitiveValue(value, type); + return MakeGarbageCollected<CSSPrimitiveValue>(value, type); } } diff --git a/chromium/third_party/blink/renderer/core/css/css_primitive_value.h b/chromium/third_party/blink/renderer/core/css/css_primitive_value.h index a4b4f3a30ca..467bbb18c5b 100644 --- a/chromium/third_party/blink/renderer/core/css/css_primitive_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_primitive_value.h @@ -23,8 +23,8 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PRIMITIVE_VALUE_H_ #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/css_value.h" -#include "third_party/blink/renderer/core/css_property_names.h" #include "third_party/blink/renderer/core/css_value_keywords.h" #include "third_party/blink/renderer/platform/wtf/bit_vector.h" #include "third_party/blink/renderer/platform/wtf/forward.h" @@ -199,7 +199,7 @@ class CORE_EXPORT CSSPrimitiveValue : public CSSValue { static bool IsTime(UnitType unit) { return unit == UnitType::kSeconds || unit == UnitType::kMilliseconds; } - bool IsTime() const { return IsTime(GetType()); } + bool IsTime() const { return IsTime(TypeWithCalcResolved()); } static bool IsFrequency(UnitType unit) { return unit == UnitType::kHertz || unit == UnitType::kKilohertz; } @@ -214,20 +214,29 @@ class CORE_EXPORT CSSPrimitiveValue : public CSSValue { return type >= UnitType::kDotsPerPixel && type <= UnitType::kDotsPerCentimeter; } + bool IsResolution() const { return IsResolution(GetType()); } static bool IsFlex(UnitType unit) { return unit == UnitType::kFraction; } bool IsFlex() const { return IsFlex(GetType()); } static CSSPrimitiveValue* Create(double value, UnitType); static CSSPrimitiveValue* Create(const Length& value, float zoom) { - return new CSSPrimitiveValue(value, zoom); + return MakeGarbageCollected<CSSPrimitiveValue>(value, zoom); } // TODO(sashab): Remove this. template <typename T> static CSSPrimitiveValue* Create(T value) { - return new CSSPrimitiveValue(value); + return MakeGarbageCollected<CSSPrimitiveValue>(value); } + CSSPrimitiveValue(const Length&, float zoom); + CSSPrimitiveValue(double, UnitType); + template <typename T> + CSSPrimitiveValue(T); // Defined in CSSPrimitiveValueMappings.h + template <typename T> + CSSPrimitiveValue(T* val) : CSSValue(kPrimitiveClass) { + Init(val); + } ~CSSPrimitiveValue(); UnitType TypeWithCalcResolved() const; @@ -281,23 +290,12 @@ class CORE_EXPORT CSSPrimitiveValue : public CSSValue { static UnitType LengthUnitTypeToUnitType(LengthUnitType); private: - CSSPrimitiveValue(const Length&, float zoom); - CSSPrimitiveValue(double, UnitType); - - template <typename T> - CSSPrimitiveValue(T); // Defined in CSSPrimitiveValueMappings.h - - template <typename T> - CSSPrimitiveValue(T* val) : CSSValue(kPrimitiveClass) { - Init(val); - } - static void Create(int); // compile-time guard static void Create(unsigned); // compile-time guard template <typename T> operator T*(); // compile-time guard - // Code generated by CSSPrimitiveValueUnitTrie.cpp.tmpl + // Code generated by css_primitive_value_unit_trie.cc.tmpl static UnitType StringToUnitType(const LChar*, unsigned length); static UnitType StringToUnitType(const UChar*, unsigned length); diff --git a/chromium/third_party/blink/renderer/core/css/css_primitive_value_mappings.h b/chromium/third_party/blink/renderer/core/css/css_primitive_value_mappings.h index fd8d8b9466b..9b8165cb58c 100644 --- a/chromium/third_party/blink/renderer/core/css/css_primitive_value_mappings.h +++ b/chromium/third_party/blink/renderer/core/css/css_primitive_value_mappings.h @@ -44,9 +44,9 @@ #include "third_party/blink/renderer/platform/fonts/font_description.h" #include "third_party/blink/renderer/platform/fonts/font_smoothing_mode.h" #include "third_party/blink/renderer/platform/fonts/text_rendering_mode.h" +#include "third_party/blink/renderer/platform/geometry/length.h" #include "third_party/blink/renderer/platform/graphics/graphics_types.h" #include "third_party/blink/renderer/platform/graphics/touch_action.h" -#include "third_party/blink/renderer/platform/length.h" #include "third_party/blink/renderer/platform/text/text_run.h" #include "third_party/blink/renderer/platform/text/writing_mode.h" #include "third_party/blink/renderer/platform/theme_types.h" @@ -549,6 +549,12 @@ inline CSSIdentifierValue::CSSIdentifierValue(EFloat e) case EFloat::kRight: value_id_ = CSSValueRight; break; + case EFloat::kInlineStart: + value_id_ = CSSValueInlineStart; + break; + case EFloat::kInlineEnd: + value_id_ = CSSValueInlineEnd; + break; } } @@ -559,6 +565,10 @@ inline EFloat CSSIdentifierValue::ConvertTo() const { return EFloat::kLeft; case CSSValueRight: return EFloat::kRight; + case CSSValueInlineStart: + return EFloat::kInlineStart; + case CSSValueInlineEnd: + return EFloat::kInlineEnd; case CSSValueNone: return EFloat::kNone; default: @@ -1491,31 +1501,31 @@ inline TouchAction CSSIdentifierValue::ConvertTo() const { } template <> -inline ScrollCustomization::ScrollDirection CSSIdentifierValue::ConvertTo() +inline scroll_customization::ScrollDirection CSSIdentifierValue::ConvertTo() const { switch (value_id_) { case CSSValueNone: - return ScrollCustomization::kScrollDirectionNone; + return scroll_customization::kScrollDirectionNone; case CSSValueAuto: - return ScrollCustomization::kScrollDirectionAuto; + return scroll_customization::kScrollDirectionAuto; case CSSValuePanLeft: - return ScrollCustomization::kScrollDirectionPanLeft; + return scroll_customization::kScrollDirectionPanLeft; case CSSValuePanRight: - return ScrollCustomization::kScrollDirectionPanRight; + return scroll_customization::kScrollDirectionPanRight; case CSSValuePanX: - return ScrollCustomization::kScrollDirectionPanX; + return scroll_customization::kScrollDirectionPanX; case CSSValuePanUp: - return ScrollCustomization::kScrollDirectionPanUp; + return scroll_customization::kScrollDirectionPanUp; case CSSValuePanDown: - return ScrollCustomization::kScrollDirectionPanDown; + return scroll_customization::kScrollDirectionPanDown; case CSSValuePanY: - return ScrollCustomization::kScrollDirectionPanY; + return scroll_customization::kScrollDirectionPanY; default: break; } NOTREACHED(); - return ScrollCustomization::kScrollDirectionNone; + return scroll_customization::kScrollDirectionNone; } template <> diff --git a/chromium/third_party/blink/renderer/core/css/css_primitive_value_test.cc b/chromium/third_party/blink/renderer/core/css/css_primitive_value_test.cc new file mode 100644 index 00000000000..b1c55ffec75 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/css_primitive_value_test.cc @@ -0,0 +1,59 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/css_primitive_value.h" + +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/renderer/core/css/css_calculation_value.h" + +namespace blink { +namespace { + +using UnitType = CSSPrimitiveValue::UnitType; + +struct UnitValue { + double value; + UnitType unit_type; +}; + +CSSPrimitiveValue* Create(UnitValue v) { + return CSSPrimitiveValue::Create(v.value, v.unit_type); +} + +CSSPrimitiveValue* CreateAddition(UnitValue a, UnitValue b) { + return CSSPrimitiveValue::Create( + CSSCalcValue::Create(CSSCalcValue::CreateExpressionNode( + CSSCalcValue::CreateExpressionNode(Create(a)), + CSSCalcValue::CreateExpressionNode(Create(b)), kCalcAdd))); +} + +TEST(CSSPrimitiveValueTest, IsTime) { + EXPECT_FALSE(Create({5.0, UnitType::kNumber})->IsTime()); + EXPECT_FALSE(Create({5.0, UnitType::kDegrees})->IsTime()); + EXPECT_TRUE(Create({5.0, UnitType::kSeconds})->IsTime()); + EXPECT_TRUE(Create({5.0, UnitType::kMilliseconds})->IsTime()); +} + +TEST(CSSPrimitiveValueTest, IsTimeCalc) { + { + UnitValue a = {1.0, UnitType::kSeconds}; + UnitValue b = {1000.0, UnitType::kMilliseconds}; + EXPECT_TRUE(CreateAddition(a, b)->IsTime()); + } + { + UnitValue a = {1.0, UnitType::kDegrees}; + UnitValue b = {1000.0, UnitType::kGradians}; + EXPECT_FALSE(CreateAddition(a, b)->IsTime()); + } +} + +TEST(CSSPrimitiveValueTest, IsResolution) { + EXPECT_FALSE(Create({5.0, UnitType::kNumber})->IsResolution()); + EXPECT_FALSE(Create({5.0, UnitType::kDegrees})->IsResolution()); + EXPECT_TRUE(Create({5.0, UnitType::kDotsPerPixel})->IsResolution()); + EXPECT_TRUE(Create({5.0, UnitType::kDotsPerCentimeter})->IsResolution()); +} + +} // namespace +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/css_properties.json5 b/chromium/third_party/blink/renderer/core/css/css_properties.json5 index cee6cb0c474..9a6fcd2c5f5 100644 --- a/chromium/third_party/blink/renderer/core/css/css_properties.json5 +++ b/chromium/third_party/blink/renderer/core/css/css_properties.json5 @@ -1025,7 +1025,7 @@ interpolable: true, field_group: "surround", field_template: "external", - include_paths: ["third_party/blink/renderer/platform/length_size.h"], + include_paths: ["third_party/blink/renderer/platform/geometry/length_size.h"], default_value: "LengthSize(Length(0, kFixed), Length(0, kFixed))", type_name: "LengthSize", converter: "ConvertRadius", @@ -1037,7 +1037,7 @@ interpolable: true, field_group: "surround", field_template: "external", - include_paths: ["third_party/blink/renderer/platform/length_size.h"], + include_paths: ["third_party/blink/renderer/platform/geometry/length_size.h"], default_value: "LengthSize(Length(0, kFixed), Length(0, kFixed))", type_name: "LengthSize", converter: "ConvertRadius", @@ -1062,7 +1062,7 @@ interpolable: true, field_group: "surround", field_template: "external", - include_paths: ["third_party/blink/renderer/platform/layout_unit.h"], + include_paths: ["third_party/blink/renderer/platform/geometry/layout_unit.h"], keywords: ["thin", "medium", "thick"], default_value: "LayoutUnit(3)", typedom_types: ["Keyword", "Length"], @@ -1164,7 +1164,7 @@ interpolable: true, field_group: "surround", field_template: "external", - include_paths: ["third_party/blink/renderer/platform/layout_unit.h"], + include_paths: ["third_party/blink/renderer/platform/geometry/layout_unit.h"], keywords: ["thin", "medium", "thick"], default_value: "LayoutUnit(3)", typedom_types: ["Keyword", "Length"], @@ -1207,7 +1207,7 @@ interpolable: true, field_group: "surround", field_template: "external", - include_paths: ["third_party/blink/renderer/platform/layout_unit.h"], + include_paths: ["third_party/blink/renderer/platform/geometry/layout_unit.h"], keywords: ["thin", "medium", "thick"], default_value: "LayoutUnit(3)", typedom_types: ["Keyword", "Length"], @@ -1237,7 +1237,7 @@ interpolable: true, field_group: "surround", field_template: "external", - include_paths: ["third_party/blink/renderer/platform/length_size.h"], + include_paths: ["third_party/blink/renderer/platform/geometry/length_size.h"], default_value: "LengthSize(Length(0, kFixed), Length(0, kFixed))", type_name: "LengthSize", converter: "ConvertRadius", @@ -1249,7 +1249,7 @@ interpolable: true, field_group: "surround", field_template: "external", - include_paths: ["third_party/blink/renderer/platform/length_size.h"], + include_paths: ["third_party/blink/renderer/platform/geometry/length_size.h"], default_value: "LengthSize(Length(0, kFixed), Length(0, kFixed))", type_name: "LengthSize", converter: "ConvertRadius", @@ -1274,7 +1274,7 @@ interpolable: true, field_group: "surround", field_template: "external", - include_paths: ["third_party/blink/renderer/platform/layout_unit.h"], + include_paths: ["third_party/blink/renderer/platform/geometry/layout_unit.h"], keywords: ["thin", "medium", "thick"], default_value: "LayoutUnit(3)", typedom_types: ["Keyword", "Length"], @@ -1390,10 +1390,9 @@ name: "clear", property_methods: ["CSSValueFromComputedStyleInternal"], field_template: "keyword", - keywords: ["none", "left", "right", "both"], + keywords: ["none", "left", "right", "both", "inline-start", "inline-end"], typedom_types: ["Keyword"], default_value: "none", - style_builder_custom_functions: ["value"], }, { name: "clip", @@ -1401,7 +1400,7 @@ interpolable: true, field_group: "visual", field_template: "external", - include_paths: ["third_party/blink/renderer/platform/length_box.h"], + include_paths: ["third_party/blink/renderer/platform/geometry/length_box.h"], default_value: "LengthBox()", type_name: "LengthBox", computed_style_custom_functions: ["setter"], @@ -1606,7 +1605,7 @@ interpolable: true, inherited: true, svg: true, - converter: "ConvertNumberOrPercentage", + converter: "ConvertAlpha", typedom_types: ["Number"], }, { @@ -1687,12 +1686,11 @@ name: "float", property_methods: ["CSSValueFromComputedStyleInternal"], field_template: "keyword", - keywords: ["none", "left", "right"], + keywords: ["none", "left", "right", "inline-start", "inline-end"], typedom_types: ["Keyword"], default_value: "none", name_for_methods: "Floating", type_name: "EFloat", - style_builder_custom_functions: ["value"], }, { name: "flood-color", @@ -1708,7 +1706,7 @@ property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], interpolable: true, svg: true, - converter: "ConvertNumberOrPercentage", + converter: "ConvertAlpha", typedom_types: ["Number"] }, { @@ -2212,7 +2210,7 @@ interpolable: true, field_group: "*", field_template: "external", - include_paths: ["third_party/blink/renderer/platform/length_point.h"], + include_paths: ["third_party/blink/renderer/platform/geometry/length_point.h"], default_value: "LengthPoint(Length(50.0, kPercent), Length(50.0, kPercent))", type_name: "LengthPoint", converter: "ConvertPosition", @@ -2225,7 +2223,7 @@ runtime_flag: "CSSOffsetPositionAnchor", field_group: "*", field_template: "external", - include_paths: ["third_party/blink/renderer/platform/length_point.h"], + include_paths: ["third_party/blink/renderer/platform/geometry/length_point.h"], default_value: "LengthPoint(Length(kAuto), Length(kAuto))", type_name: "LengthPoint", converter: "ConvertPositionOrAuto", @@ -2263,7 +2261,7 @@ runtime_flag: "CSSOffsetPositionAnchor", field_group: "*", field_template: "external", - include_paths: ["third_party/blink/renderer/platform/length_point.h"], + include_paths: ["third_party/blink/renderer/platform/geometry/length_point.h"], default_value: "LengthPoint(Length(kAuto), Length(kAuto))", type_name: "LengthPoint", converter: "ConvertPositionOrAuto", @@ -2366,7 +2364,7 @@ interpolable: true, field_group: "*", field_template: "external", - include_paths: ["third_party/blink/renderer/platform/layout_unit.h"], + include_paths: ["third_party/blink/renderer/platform/geometry/layout_unit.h"], default_value: "LayoutUnit(3)", type_name: "LayoutUnit", computed_style_custom_functions: ["initial", "getter", "setter"], @@ -2509,7 +2507,7 @@ layout_dependent: true, field_group: "*", field_template: "external", - include_paths: ["third_party/blink/renderer/platform/length_point.h"], + include_paths: ["third_party/blink/renderer/platform/geometry/length_point.h"], default_value: "LengthPoint(Length(50.0, kPercent), Length(50.0, kPercent))", type_name: "LengthPoint", converter: "ConvertPosition", @@ -2522,8 +2520,8 @@ inherited: true, field_template: "keyword", keywords: [ - "none", "auto", "stroke", "fill", "painted", "visible", "visibleStroke", - "visibleFill", "visiblePainted", "bounding-box", "all" + "none", "auto", "stroke", "fill", "painted", "visible", "visiblestroke", + "visiblefill", "visiblepainted", "bounding-box", "all" ], typedom_types: ["Keyword"], default_value: "auto", @@ -2559,7 +2557,7 @@ property_methods: ["CSSValueFromComputedStyleInternal"], field_group: "*", field_template: "keyword", - keywords: ["none", "both", "horizontal", "vertical"], + keywords: ["none", "both", "horizontal", "vertical", "block", "inline"], typedom_types: ["Keyword"], default_value: "none", style_builder_custom_functions: ["value"], @@ -2605,7 +2603,6 @@ { name: "scroll-behavior", property_methods: ["CSSValueFromComputedStyleInternal"], - runtime_flag: "CSSOMSmoothScroll", field_group: "*", field_size: 2, // FIXME: Convert this to a keyword field field_template: "primitive", @@ -2617,7 +2614,6 @@ { name: "scroll-margin-block-end", property_methods: ["ParseSingleValue"], - runtime_flag: "CSSScrollSnapPoints", direction_aware_options: { logical_side: "after", shorthand_for_physical_side: "scrollMarginShorthand", @@ -2627,19 +2623,18 @@ { name: "scroll-customization", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - converter: "ConvertFlags<blink::ScrollCustomization::ScrollDirection>", - type_name: "ScrollCustomization::ScrollDirection", + converter: "ConvertFlags<blink::scroll_customization::ScrollDirection>", + type_name: "scroll_customization::ScrollDirection", field_group: "*", field_size: 4, field_template: "primitive", - default_value: "ScrollCustomization::kScrollDirectionNone", + default_value: "scroll_customization::kScrollDirectionNone", include_paths: ["third_party/blink/renderer/core/scroll/scroll_customization.h"], runtime_flag: "ScrollCustomization", }, { name: "scroll-margin-block-start", property_methods: ["ParseSingleValue"], - runtime_flag: "CSSScrollSnapPoints", direction_aware_options: { logical_side: "before", shorthand_for_physical_side: "scrollMarginShorthand", @@ -2649,7 +2644,6 @@ { name: "scroll-margin-bottom", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - runtime_flag: "CSSScrollSnapPoints", field_group: "*", field_template: "primitive", default_value: "0.0f", @@ -2660,7 +2654,6 @@ { name: "scroll-margin-inline-end", property_methods: ["ParseSingleValue"], - runtime_flag: "CSSScrollSnapPoints", direction_aware_options: { logical_side: "end", shorthand_for_physical_side: "scrollMarginShorthand", @@ -2670,7 +2663,6 @@ { name: "scroll-margin-inline-start", property_methods: ["ParseSingleValue"], - runtime_flag: "CSSScrollSnapPoints", direction_aware_options: { logical_side: "start", shorthand_for_physical_side: "scrollMarginShorthand", @@ -2680,7 +2672,6 @@ { name: "scroll-margin-left", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - runtime_flag: "CSSScrollSnapPoints", field_group: "*", field_template: "primitive", default_value: "0.0f", @@ -2691,7 +2682,6 @@ { name: "scroll-margin-right", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - runtime_flag: "CSSScrollSnapPoints", field_group: "*", field_template: "primitive", default_value: "0.0f", @@ -2702,7 +2692,6 @@ { name: "scroll-margin-top", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - runtime_flag: "CSSScrollSnapPoints", field_group: "*", field_template: "primitive", default_value: "0.0f", @@ -2713,8 +2702,7 @@ { name: "scroll-padding-block-end", property_methods: ["ParseSingleValue"], - runtime_flag: "CSSScrollSnapPoints", - include_paths: ["third_party/blink/renderer/platform/length.h"], + include_paths: ["third_party/blink/renderer/platform/geometry/length.h"], typedom_types: ["Keyword", "Length", "Percentage"], type_name: "Length", converter: "ConvertLength", @@ -2726,8 +2714,7 @@ { name: "scroll-padding-block-start", property_methods: ["ParseSingleValue"], - runtime_flag: "CSSScrollSnapPoints", - include_paths: ["third_party/blink/renderer/platform/length.h"], + include_paths: ["third_party/blink/renderer/platform/geometry/length.h"], typedom_types: ["Keyword", "Length", "Percentage"], type_name: "Length", converter: "ConvertLength", @@ -2739,7 +2726,6 @@ { name: "scroll-padding-bottom", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - runtime_flag: "CSSScrollSnapPoints", field_group: "*", field_template: "<length>", default_value: "Length()", @@ -2749,8 +2735,7 @@ { name: "scroll-padding-inline-end", property_methods: ["ParseSingleValue"], - runtime_flag: "CSSScrollSnapPoints", - include_paths: ["third_party/blink/renderer/platform/length.h"], + include_paths: ["third_party/blink/renderer/platform/geometry/length.h"], typedom_types: ["Keyword", "Length", "Percentage"], type_name: "Length", converter: "ConvertLength", @@ -2762,8 +2747,7 @@ { name: "scroll-padding-inline-start", property_methods: ["ParseSingleValue"], - runtime_flag: "CSSScrollSnapPoints", - include_paths: ["third_party/blink/renderer/platform/length.h"], + include_paths: ["third_party/blink/renderer/platform/geometry/length.h"], typedom_types: ["Keyword", "Length", "Percentage"], type_name: "Length", converter: "ConvertLength", @@ -2775,7 +2759,6 @@ { name: "scroll-padding-left", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - runtime_flag: "CSSScrollSnapPoints", field_group: "*", field_template: "<length>", default_value: "Length()", @@ -2785,7 +2768,6 @@ { name: "scroll-padding-right", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - runtime_flag: "CSSScrollSnapPoints", field_group: "*", field_template: "<length>", default_value: "Length()", @@ -2795,7 +2777,6 @@ { name: "scroll-padding-top", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - runtime_flag: "CSSScrollSnapPoints", field_group: "*", field_template: "<length>", default_value: "Length()", @@ -2805,7 +2786,6 @@ { name: "scroll-snap-align", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - runtime_flag: "CSSScrollSnapPoints", field_group: "*", field_template: "external", include_paths: ["third_party/blink/renderer/platform/scroll/scroll_snap_data.h"], @@ -2819,7 +2799,6 @@ { name: "scroll-snap-stop", property_methods: ["CSSValueFromComputedStyleInternal"], - runtime_flag: "CSSScrollSnapPoints", field_template: "keyword", keywords: ["normal", "always"], default_value: "normal", @@ -2828,7 +2807,6 @@ { name: "scroll-snap-type", property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], - runtime_flag: "CSSScrollSnapPoints", field_group: "*", field_template: "external", include_paths: ["third_party/blink/renderer/platform/scroll/scroll_snap_data.h"], @@ -2915,7 +2893,7 @@ property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal"], interpolable: true, svg: true, - converter: "ConvertNumberOrPercentage", + converter: "ConvertAlpha", typedom_types: ["Number"] }, { @@ -2989,7 +2967,7 @@ interpolable: true, inherited: true, svg: true, - converter: "ConvertNumberOrPercentage", + converter: "ConvertAlpha", typedom_types: ["Number"] }, { @@ -3567,7 +3545,7 @@ interpolable: true, field_group: "*", field_template: "external", - include_paths: ["third_party/blink/renderer/platform/layout_unit.h"], + include_paths: ["third_party/blink/renderer/platform/geometry/layout_unit.h"], default_value: "LayoutUnit(3)", type_name: "LayoutUnit", computed_style_custom_functions: ["initial", "getter", "setter"], @@ -4918,19 +4896,16 @@ name: "scroll-margin", longhands: ["scroll-margin-top", "scroll-margin-right", "scroll-margin-bottom", "scroll-margin-left"], property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], - runtime_flag: "CSSScrollSnapPoints", }, { name: "scroll-margin-block", longhands: ["scroll-margin-block-start", "scroll-margin-block-end"], property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], - runtime_flag: "CSSScrollSnapPoints", }, { name: "scroll-margin-inline", longhands: ["scroll-margin-inline-start", "scroll-margin-inline-end"], property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], - runtime_flag: "CSSScrollSnapPoints", }, { name: "scroll-padding", @@ -4939,19 +4914,16 @@ "scroll-padding-left" ], property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], - runtime_flag: "CSSScrollSnapPoints", }, { name: "scroll-padding-block", longhands: ["scroll-padding-block-start", "scroll-padding-block-end"], property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], - runtime_flag: "CSSScrollSnapPoints", }, { name: "scroll-padding-inline", longhands: ["scroll-padding-inline-start", "scroll-padding-inline-end"], property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], - runtime_flag: "CSSScrollSnapPoints", }, { name: "text-decoration", diff --git a/chromium/third_party/blink/renderer/core/css/css_property_equality.h b/chromium/third_party/blink/renderer/core/css/css_property_equality.h index 0e48b7c4f07..33fe623e74f 100644 --- a/chromium/third_party/blink/renderer/core/css/css_property_equality.h +++ b/chromium/third_party/blink/renderer/core/css/css_property_equality.h @@ -5,7 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PROPERTY_EQUALITY_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PROPERTY_EQUALITY_H_ -#include "third_party/blink/renderer/core/css_property_names.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" diff --git a/chromium/third_party/blink/renderer/core/css/css_property_id_templates.h b/chromium/third_party/blink/renderer/core/css/css_property_id_templates.h index 8f326764079..ac0f2f50be1 100644 --- a/chromium/third_party/blink/renderer/core/css/css_property_id_templates.h +++ b/chromium/third_party/blink/renderer/core/css/css_property_id_templates.h @@ -5,7 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PROPERTY_ID_TEMPLATES_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PROPERTY_ID_TEMPLATES_H_ -#include "third_party/blink/renderer/core/css_property_names.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/platform/wtf/hash_functions.h" #include "third_party/blink/renderer/platform/wtf/hash_traits.h" diff --git a/chromium/third_party/blink/renderer/core/css/css_property_name.cc b/chromium/third_party/blink/renderer/core/css/css_property_name.cc new file mode 100644 index 00000000000..a268c6772e3 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/css_property_name.cc @@ -0,0 +1,30 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/css_property_name.h" + +#include "third_party/blink/renderer/core/css/properties/css_property.h" + +namespace blink { + +namespace { + +// TODO(andruud): Reduce this to sizeof(void*). +struct SameSizeAsCSSPropertyName { + CSSPropertyID property_id_; + AtomicString custom_property_name_; +}; + +static_assert(sizeof(CSSPropertyName) == sizeof(SameSizeAsCSSPropertyName), + "CSSPropertyName should stay small"); + +} // namespace + +AtomicString CSSPropertyName::ToAtomicString() const { + if (IsCustomProperty()) + return custom_property_name_; + return CSSProperty::Get(property_id_).GetPropertyNameAtomicString(); +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/css_property_name.h b/chromium/third_party/blink/renderer/core/css/css_property_name.h new file mode 100644 index 00000000000..517dd73599d --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/css_property_name.h @@ -0,0 +1,44 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PROPERTY_NAME_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PROPERTY_NAME_H_ + +#include "third_party/blink/renderer/core/css/css_property_names.h" +#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" + +namespace blink { + +// This class may be used to represent the name of any valid CSS property, +// including custom properties. +class CORE_EXPORT CSSPropertyName { + DISALLOW_NEW(); + + public: + explicit CSSPropertyName(CSSPropertyID property_id) + : property_id_(property_id) { + DCHECK_NE(property_id, CSSPropertyInvalid); + DCHECK_NE(property_id, CSSPropertyVariable); + } + + explicit CSSPropertyName(const AtomicString& custom_property_name) + : property_id_(CSSPropertyVariable), + custom_property_name_(custom_property_name) { + DCHECK(!custom_property_name.IsNull()); + } + + CSSPropertyID Id() const { return property_id_; } + + bool IsCustomProperty() const { return property_id_ == CSSPropertyVariable; } + + AtomicString ToAtomicString() const; + + private: + CSSPropertyID property_id_; + AtomicString custom_property_name_; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PROPERTY_NAME_H_ diff --git a/chromium/third_party/blink/renderer/core/css/css_property_name_test.cc b/chromium/third_party/blink/renderer/core/css/css_property_name_test.cc new file mode 100644 index 00000000000..7dd12abe1dc --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/css_property_name_test.cc @@ -0,0 +1,31 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/css_property_name.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace blink { + +TEST(CSSPropertyNameTest, IdStandardProperty) { + CSSPropertyName name(CSSPropertyFontSize); + EXPECT_EQ(CSSPropertyFontSize, name.Id()); +} + +TEST(CSSPropertyNameTest, IdCustomProperty) { + CSSPropertyName name(AtomicString("--x")); + EXPECT_EQ(CSSPropertyVariable, name.Id()); + EXPECT_TRUE(name.IsCustomProperty()); +} + +TEST(CSSPropertyNameTest, GetNameStandardProperty) { + CSSPropertyName name(CSSPropertyFontSize); + EXPECT_EQ(AtomicString("font-size"), name.ToAtomicString()); +} + +TEST(CSSPropertyNameTest, GetNameCustomProperty) { + CSSPropertyName name(AtomicString("--x")); + EXPECT_EQ(AtomicString("--x"), name.ToAtomicString()); +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/css_property_value.cc b/chromium/third_party/blink/renderer/core/css/css_property_value.cc index 8d7ee819a7e..8d9162ecd74 100644 --- a/chromium/third_party/blink/renderer/core/css/css_property_value.cc +++ b/chromium/third_party/blink/renderer/core/css/css_property_value.cc @@ -20,6 +20,8 @@ #include "third_party/blink/renderer/core/css/css_property_value.h" +#include "third_party/blink/renderer/core/css/css_custom_property_declaration.h" +#include "third_party/blink/renderer/core/css/css_property_name.h" #include "third_party/blink/renderer/core/style/computed_style_constants.h" #include "third_party/blink/renderer/core/style_property_shorthand.h" @@ -46,6 +48,12 @@ CSSPropertyID CSSPropertyValueMetadata::ShorthandID() const { return shorthands.at(index_in_shorthands_vector_).id(); } +CSSPropertyName CSSPropertyValue::Name() const { + if (Id() != CSSPropertyVariable) + return CSSPropertyName(Id()); + return CSSPropertyName(ToCSSCustomPropertyDeclaration(value_)->GetName()); +} + bool CSSPropertyValue::operator==(const CSSPropertyValue& other) const { return DataEquivalent(value_, other.value_) && IsImportant() == other.IsImportant(); diff --git a/chromium/third_party/blink/renderer/core/css/css_property_value.h b/chromium/third_party/blink/renderer/core/css/css_property_value.h index 431b1bcbf2f..d956eb9dbd2 100644 --- a/chromium/third_party/blink/renderer/core/css/css_property_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_property_value.h @@ -21,9 +21,10 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PROPERTY_VALUE_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PROPERTY_VALUE_H_ +#include "third_party/blink/renderer/core/css/css_property_name.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/css_value.h" #include "third_party/blink/renderer/core/css/properties/css_property.h" -#include "third_party/blink/renderer/core/css_property_names.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" namespace blink { @@ -86,6 +87,7 @@ class CSSPropertyValue { bool IsSetFromShorthand() const { return metadata_.is_set_from_shorthand_; } CSSPropertyID ShorthandID() const { return metadata_.ShorthandID(); } bool IsImportant() const { return metadata_.important_; } + CSSPropertyName Name() const; const CSSValue* Value() const { return value_.Get(); } diff --git a/chromium/third_party/blink/renderer/core/css/css_property_value_set.cc b/chromium/third_party/blink/renderer/core/css/css_property_value_set.cc index 25f487820f2..97ca29e6f06 100644 --- a/chromium/third_party/blink/renderer/core/css/css_property_value_set.cc +++ b/chromium/third_party/blink/renderer/core/css/css_property_value_set.cc @@ -59,6 +59,12 @@ ImmutableCSSPropertyValueSet* ImmutableCSSPropertyValueSet::Create( ImmutableCSSPropertyValueSet(properties, count, css_parser_mode); } +CSSPropertyName CSSPropertyValueSet::PropertyReference::Name() const { + if (Id() != CSSPropertyVariable) + return CSSPropertyName(Id()); + return CSSPropertyName(ToCSSCustomPropertyDeclaration(Value()).GetName()); +} + ImmutableCSSPropertyValueSet* CSSPropertyValueSet::ImmutableCopyIfNeeded() const { if (!IsMutable()) { @@ -410,12 +416,8 @@ void MutableCSSPropertyValueSet::SetProperty(CSSPropertyID property_id, bool MutableCSSPropertyValueSet::SetProperty(const CSSPropertyValue& property, CSSPropertyValue* slot) { - const AtomicString& name = - (property.Id() == CSSPropertyVariable) - ? ToCSSCustomPropertyDeclaration(property.Value())->GetName() - : g_null_atom; CSSPropertyValue* to_replace = - slot ? slot : FindCSSPropertyWithID(property.Id(), name); + slot ? slot : FindCSSPropertyWithName(property.Name()); if (to_replace && *to_replace == property) return false; if (to_replace) { @@ -479,8 +481,7 @@ void MutableCSSPropertyValueSet::MergeAndOverrideOnConflict( unsigned size = other->PropertyCount(); for (unsigned n = 0; n < size; ++n) { PropertyReference to_merge = other->PropertyAt(n); - // TODO(leviw): This probably doesn't work correctly with Custom Properties - CSSPropertyValue* old = FindCSSPropertyWithID(to_merge.Id()); + CSSPropertyValue* old = FindCSSPropertyWithName(to_merge.Name()); if (old) { SetProperty( CSSPropertyValue(to_merge.PropertyMetadata(), to_merge.Value()), old); @@ -537,18 +538,11 @@ bool MutableCSSPropertyValueSet::RemovePropertiesInSet(const CSSProperty** set, return false; } -CSSPropertyValue* MutableCSSPropertyValueSet::FindCSSPropertyWithID( - CSSPropertyID property_id, - const AtomicString& custom_property_name) { - int found_property_index = -1; - if (property_id == CSSPropertyVariable && !custom_property_name.IsNull()) { - // TODO(shanestephens): fix call sites so we always have a - // customPropertyName here. - found_property_index = FindPropertyIndex(custom_property_name); - } else { - DCHECK(custom_property_name.IsNull()); - found_property_index = FindPropertyIndex(property_id); - } +CSSPropertyValue* MutableCSSPropertyValueSet::FindCSSPropertyWithName( + const CSSPropertyName& name) { + int found_property_index = name.IsCustomProperty() + ? FindPropertyIndex(name.ToAtomicString()) + : FindPropertyIndex(name.Id()); if (found_property_index == -1) return nullptr; return &property_vector_.at(found_property_index); @@ -592,7 +586,7 @@ void MutableCSSPropertyValueSet::RemoveEquivalentProperties( } MutableCSSPropertyValueSet* CSSPropertyValueSet::MutableCopy() const { - return new MutableCSSPropertyValueSet(*this); + return MakeGarbageCollected<MutableCSSPropertyValueSet>(*this); } MutableCSSPropertyValueSet* CSSPropertyValueSet::CopyPropertiesInSet( @@ -617,7 +611,7 @@ CSSStyleDeclaration* MutableCSSPropertyValueSet::EnsureCSSStyleDeclaration() { DCHECK(!cssom_wrapper_->ParentElement()); return cssom_wrapper_.Get(); } - cssom_wrapper_ = new PropertySetCSSStyleDeclaration(*this); + cssom_wrapper_ = MakeGarbageCollected<PropertySetCSSStyleDeclaration>(*this); return cssom_wrapper_.Get(); } @@ -670,13 +664,13 @@ void CSSPropertyValueSet::ShowStyle() { MutableCSSPropertyValueSet* MutableCSSPropertyValueSet::Create( CSSParserMode css_parser_mode) { - return new MutableCSSPropertyValueSet(css_parser_mode); + return MakeGarbageCollected<MutableCSSPropertyValueSet>(css_parser_mode); } MutableCSSPropertyValueSet* MutableCSSPropertyValueSet::Create( const CSSPropertyValue* properties, unsigned count) { - return new MutableCSSPropertyValueSet(properties, count); + return MakeGarbageCollected<MutableCSSPropertyValueSet>(properties, count); } void CSSLazyPropertyParser::Trace(blink::Visitor* visitor) {} diff --git a/chromium/third_party/blink/renderer/core/css/css_property_value_set.h b/chromium/third_party/blink/renderer/core/css/css_property_value_set.h index 80f1a4ca7bf..dc8810152ea 100644 --- a/chromium/third_party/blink/renderer/core/css/css_property_value_set.h +++ b/chromium/third_party/blink/renderer/core/css/css_property_value_set.h @@ -24,10 +24,11 @@ #include "base/macros.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/css/css_primitive_value.h" +#include "third_party/blink/renderer/core/css/css_property_name.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/css_property_value.h" #include "third_party/blink/renderer/core/css/parser/css_parser_mode.h" #include "third_party/blink/renderer/core/css/property_set_css_style_declaration.h" -#include "third_party/blink/renderer/core/css_property_names.h" #include "third_party/blink/renderer/platform/heap/persistent.h" #include "third_party/blink/renderer/platform/wtf/noncopyable.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" @@ -67,6 +68,8 @@ class CORE_EXPORT CSSPropertyValueSet return PropertyMetadata().ShorthandID(); } + CSSPropertyName Name() const; + bool IsImportant() const { return PropertyMetadata().important_; } bool IsInherited() const { return PropertyMetadata().inherited_; } bool IsImplicit() const { return PropertyMetadata().implicit_; } @@ -175,7 +178,11 @@ class CSSLazyPropertyParser class CORE_EXPORT ImmutableCSSPropertyValueSet : public CSSPropertyValueSet { public: + ImmutableCSSPropertyValueSet(const CSSPropertyValue*, + unsigned count, + CSSParserMode); ~ImmutableCSSPropertyValueSet(); + static ImmutableCSSPropertyValueSet* Create(const CSSPropertyValue* properties, unsigned count, CSSParserMode); @@ -192,11 +199,6 @@ class CORE_EXPORT ImmutableCSSPropertyValueSet : public CSSPropertyValueSet { void* operator new(std::size_t, void* location) { return location; } void* storage_; - - private: - ImmutableCSSPropertyValueSet(const CSSPropertyValue*, - unsigned count, - CSSParserMode); }; inline const Member<const CSSValue>* ImmutableCSSPropertyValueSet::ValueArray() @@ -220,7 +222,12 @@ DEFINE_TYPE_CASTS(ImmutableCSSPropertyValueSet, class CORE_EXPORT MutableCSSPropertyValueSet : public CSSPropertyValueSet { public: + explicit MutableCSSPropertyValueSet(CSSParserMode); + explicit MutableCSSPropertyValueSet(const CSSPropertyValueSet&); + MutableCSSPropertyValueSet(const CSSPropertyValue* properties, + unsigned count); ~MutableCSSPropertyValueSet() = default; + static MutableCSSPropertyValueSet* Create(CSSParserMode); static MutableCSSPropertyValueSet* Create(const CSSPropertyValue* properties, unsigned count); @@ -277,20 +284,13 @@ class CORE_EXPORT MutableCSSPropertyValueSet : public CSSPropertyValueSet { void TraceAfterDispatch(blink::Visitor*); private: - explicit MutableCSSPropertyValueSet(CSSParserMode); - explicit MutableCSSPropertyValueSet(const CSSPropertyValueSet&); - MutableCSSPropertyValueSet(const CSSPropertyValue* properties, - unsigned count); - bool RemovePropertyAtIndex(int, String* return_text); bool RemoveShorthandProperty(CSSPropertyID); bool RemoveShorthandProperty(const AtomicString& custom_property_name) { return false; } - CSSPropertyValue* FindCSSPropertyWithID( - CSSPropertyID, - const AtomicString& custom_property_name = g_null_atom); + CSSPropertyValue* FindCSSPropertyWithName(const CSSPropertyName&); Member<PropertySetCSSStyleDeclaration> cssom_wrapper_; friend class CSSPropertyValueSet; diff --git a/chromium/third_party/blink/renderer/core/css/css_property_value_set_test.cc b/chromium/third_party/blink/renderer/core/css/css_property_value_set_test.cc new file mode 100644 index 00000000000..5c8e384b1f7 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/css_property_value_set_test.cc @@ -0,0 +1,67 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/css_property_value_set.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/renderer/core/css/parser/css_parser.h" +#include "third_party/blink/renderer/core/css/parser/css_parser_context.h" +#include "third_party/blink/renderer/core/css/style_rule.h" +#include "third_party/blink/renderer/core/css/style_sheet_contents.h" +#include "third_party/blink/renderer/core/testing/page_test_base.h" + +namespace blink { + +class CSSPropertyValueSetTest : public PageTestBase { + public: + StyleRule* RuleAt(StyleSheetContents* sheet, wtf_size_t index) { + return ToStyleRule(sheet->ChildRules()[index]); + } +}; + +TEST_F(CSSPropertyValueSetTest, MergeAndOverrideOnConflictCustomProperty) { + CSSParserContext* context = CSSParserContext::Create(GetDocument()); + StyleSheetContents* style_sheet = StyleSheetContents::Create(context); + + String sheet_text = R"CSS( + #first { + color: red; + --x:foo; + --y:foo; + } + #second { + color: green; + --x:bar; + --y:bar; + } + )CSS"; + + CSSParser::ParseSheet(context, style_sheet, sheet_text, + CSSDeferPropertyParsing::kNo); + StyleRule* rule0 = RuleAt(style_sheet, 0); + StyleRule* rule1 = RuleAt(style_sheet, 1); + MutableCSSPropertyValueSet& set0 = rule0->MutableProperties(); + MutableCSSPropertyValueSet& set1 = rule1->MutableProperties(); + + EXPECT_EQ(3u, set0.PropertyCount()); + EXPECT_EQ("red", set0.GetPropertyValue(CSSPropertyColor)); + EXPECT_EQ("foo", set0.GetPropertyValue(AtomicString("--x"))); + EXPECT_EQ("foo", set0.GetPropertyValue(AtomicString("--y"))); + EXPECT_EQ(3u, set1.PropertyCount()); + EXPECT_EQ("green", set1.GetPropertyValue(CSSPropertyColor)); + EXPECT_EQ("bar", set1.GetPropertyValue(AtomicString("--x"))); + EXPECT_EQ("bar", set1.GetPropertyValue(AtomicString("--y"))); + + set0.MergeAndOverrideOnConflict(&set1); + + EXPECT_EQ(3u, set0.PropertyCount()); + EXPECT_EQ("green", set0.GetPropertyValue(CSSPropertyColor)); + EXPECT_EQ("bar", set0.GetPropertyValue(AtomicString("--x"))); + EXPECT_EQ("bar", set0.GetPropertyValue(AtomicString("--y"))); + EXPECT_EQ(3u, set1.PropertyCount()); + EXPECT_EQ("green", set1.GetPropertyValue(CSSPropertyColor)); + EXPECT_EQ("bar", set1.GetPropertyValue(AtomicString("--x"))); + EXPECT_EQ("bar", set1.GetPropertyValue(AtomicString("--y"))); +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/css_quad_value.h b/chromium/third_party/blink/renderer/core/css/css_quad_value.h index dffd9412bcb..dc6718c1f88 100644 --- a/chromium/third_party/blink/renderer/core/css/css_quad_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_quad_value.h @@ -36,9 +36,22 @@ class CORE_EXPORT CSSQuadValue : public CSSValue { CSSValue* bottom, CSSValue* left, TypeForSerialization serialization_type) { - return new CSSQuadValue(top, right, bottom, left, serialization_type); + return MakeGarbageCollected<CSSQuadValue>(top, right, bottom, left, + serialization_type); } + CSSQuadValue(CSSValue* top, + CSSValue* right, + CSSValue* bottom, + CSSValue* left, + TypeForSerialization serialization_type) + : CSSValue(kQuadClass), + serialization_type_(serialization_type), + top_(top), + right_(right), + bottom_(bottom), + left_(left) {} + CSSValue* Top() const { return top_.Get(); } CSSValue* Right() const { return right_.Get(); } CSSValue* Bottom() const { return bottom_.Get(); } @@ -57,19 +70,6 @@ class CORE_EXPORT CSSQuadValue : public CSSValue { void TraceAfterDispatch(blink::Visitor*); - protected: - CSSQuadValue(CSSValue* top, - CSSValue* right, - CSSValue* bottom, - CSSValue* left, - TypeForSerialization serialization_type) - : CSSValue(kQuadClass), - serialization_type_(serialization_type), - top_(top), - right_(right), - bottom_(bottom), - left_(left) {} - private: TypeForSerialization serialization_type_; Member<CSSValue> top_; diff --git a/chromium/third_party/blink/renderer/core/css/css_ray_value.cc b/chromium/third_party/blink/renderer/core/css/css_ray_value.cc index 9fc1f9289ad..01f870cc6c3 100644 --- a/chromium/third_party/blink/renderer/core/css/css_ray_value.cc +++ b/chromium/third_party/blink/renderer/core/css/css_ray_value.cc @@ -14,7 +14,7 @@ namespace cssvalue { CSSRayValue* CSSRayValue::Create(const CSSPrimitiveValue& angle, const CSSIdentifierValue& size, const CSSIdentifierValue* contain) { - return new CSSRayValue(angle, size, contain); + return MakeGarbageCollected<CSSRayValue>(angle, size, contain); } CSSRayValue::CSSRayValue(const CSSPrimitiveValue& angle, diff --git a/chromium/third_party/blink/renderer/core/css/css_ray_value.h b/chromium/third_party/blink/renderer/core/css/css_ray_value.h index 0abb78c7dd8..261abf9a81c 100644 --- a/chromium/third_party/blink/renderer/core/css/css_ray_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_ray_value.h @@ -20,6 +20,10 @@ class CSSRayValue : public CSSValue { const CSSIdentifierValue& size, const CSSIdentifierValue* contain); + CSSRayValue(const CSSPrimitiveValue& angle, + const CSSIdentifierValue& size, + const CSSIdentifierValue* contain); + const CSSPrimitiveValue& Angle() const { return *angle_; } const CSSIdentifierValue& Size() const { return *size_; } const CSSIdentifierValue* Contain() const { return contain_.Get(); } @@ -31,10 +35,6 @@ class CSSRayValue : public CSSValue { void TraceAfterDispatch(blink::Visitor*); private: - CSSRayValue(const CSSPrimitiveValue& angle, - const CSSIdentifierValue& size, - const CSSIdentifierValue* contain); - Member<const CSSPrimitiveValue> angle_; Member<const CSSIdentifierValue> size_; Member<const CSSIdentifierValue> contain_; diff --git a/chromium/third_party/blink/renderer/core/css/css_reflect_value.h b/chromium/third_party/blink/renderer/core/css/css_reflect_value.h index 4df6bf54b7f..f299357094a 100644 --- a/chromium/third_party/blink/renderer/core/css/css_reflect_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_reflect_value.h @@ -41,9 +41,17 @@ class CSSReflectValue : public CSSValue { static CSSReflectValue* Create(CSSIdentifierValue* direction, CSSPrimitiveValue* offset, CSSValue* mask) { - return new CSSReflectValue(direction, offset, mask); + return MakeGarbageCollected<CSSReflectValue>(direction, offset, mask); } + CSSReflectValue(CSSIdentifierValue* direction, + CSSPrimitiveValue* offset, + CSSValue* mask) + : CSSValue(kReflectClass), + direction_(direction), + offset_(offset), + mask_(mask) {} + CSSIdentifierValue* Direction() const { return direction_.Get(); } CSSPrimitiveValue* Offset() const { return offset_.Get(); } CSSValue* Mask() const { return mask_.Get(); } @@ -55,14 +63,6 @@ class CSSReflectValue : public CSSValue { void TraceAfterDispatch(blink::Visitor*); private: - CSSReflectValue(CSSIdentifierValue* direction, - CSSPrimitiveValue* offset, - CSSValue* mask) - : CSSValue(kReflectClass), - direction_(direction), - offset_(offset), - mask_(mask) {} - Member<CSSIdentifierValue> direction_; Member<CSSPrimitiveValue> offset_; Member<CSSValue> mask_; diff --git a/chromium/third_party/blink/renderer/core/css/css_rule.h b/chromium/third_party/blink/renderer/core/css/css_rule.h index 5e733cbffe7..917dadf01fd 100644 --- a/chromium/third_party/blink/renderer/core/css/css_rule.h +++ b/chromium/third_party/blink/renderer/core/css/css_rule.h @@ -53,6 +53,7 @@ class CORE_EXPORT CSSRule : public ScriptWrappable { kKeyframeRule = 8, kNamespaceRule = 10, kSupportsRule = 12, + kFontFeatureValuesRule = 14, kViewportRule = 15, }; diff --git a/chromium/third_party/blink/renderer/core/css/css_rule.idl b/chromium/third_party/blink/renderer/core/css/css_rule.idl index 6de5c973d76..49e771e6df0 100644 --- a/chromium/third_party/blink/renderer/core/css/css_rule.idl +++ b/chromium/third_party/blink/renderer/core/css/css_rule.idl @@ -46,6 +46,10 @@ // https://drafts.csswg.org/css-conditional/#extentions-to-cssrule-interface const unsigned short SUPPORTS_RULE = 12; + // CSS Fonts Level 4 + // https://drafts.csswg.org/css-fonts-4/#font-feature-values + [RuntimeEnabled=CSSFontFeatureValues] const unsigned short FONT_FEATURE_VALUES_RULE = 14; + // CSS Device Adaptation // https://drafts.csswg.org/css-device-adapt/#css-rule-interface [RuntimeEnabled=CSSViewport] const unsigned short VIEWPORT_RULE = 15; diff --git a/chromium/third_party/blink/renderer/core/css/css_rule_list.h b/chromium/third_party/blink/renderer/core/css/css_rule_list.h index dd02709d921..8f208c9d77e 100644 --- a/chromium/third_party/blink/renderer/core/css/css_rule_list.h +++ b/chromium/third_party/blink/renderer/core/css/css_rule_list.h @@ -51,7 +51,11 @@ class CSSRuleList : public ScriptWrappable { class StaticCSSRuleList final : public CSSRuleList { public: - static StaticCSSRuleList* Create() { return new StaticCSSRuleList(); } + static StaticCSSRuleList* Create() { + return MakeGarbageCollected<StaticCSSRuleList>(); + } + + StaticCSSRuleList(); HeapVector<Member<CSSRule>>& Rules() { return rules_; } @@ -60,8 +64,6 @@ class StaticCSSRuleList final : public CSSRuleList { void Trace(blink::Visitor*) override; private: - StaticCSSRuleList(); - unsigned length() const override { return rules_.size(); } CSSRule* item(unsigned index) const override { return index < rules_.size() ? rules_[index].Get() : nullptr; @@ -74,17 +76,17 @@ template <class Rule> class LiveCSSRuleList final : public CSSRuleList { public: static LiveCSSRuleList* Create(Rule* rule) { - return new LiveCSSRuleList(rule); + return MakeGarbageCollected<LiveCSSRuleList>(rule); } + LiveCSSRuleList(Rule* rule) : rule_(rule) {} + void Trace(blink::Visitor* visitor) override { visitor->Trace(rule_); CSSRuleList::Trace(visitor); } private: - LiveCSSRuleList(Rule* rule) : rule_(rule) {} - unsigned length() const override { return rule_->length(); } CSSRule* item(unsigned index) const override { return rule_->Item(index); } CSSStyleSheet* GetStyleSheet() const override { diff --git a/chromium/third_party/blink/renderer/core/css/css_segmented_font_face.h b/chromium/third_party/blink/renderer/core/css/css_segmented_font_face.h index f521100cade..ff69a70a037 100644 --- a/chromium/third_party/blink/renderer/core/css/css_segmented_font_face.h +++ b/chromium/third_party/blink/renderer/core/css/css_segmented_font_face.h @@ -47,8 +47,11 @@ class CSSSegmentedFontFace final public: static CSSSegmentedFontFace* Create( FontSelectionCapabilities font_selection_capabilities) { - return new CSSSegmentedFontFace(font_selection_capabilities); + return MakeGarbageCollected<CSSSegmentedFontFace>( + font_selection_capabilities); } + + CSSSegmentedFontFace(FontSelectionCapabilities); ~CSSSegmentedFontFace(); FontSelectionCapabilities GetFontSelectionCapabilities() const { @@ -76,8 +79,6 @@ class CSSSegmentedFontFace final void Trace(blink::Visitor*); private: - CSSSegmentedFontFace(FontSelectionCapabilities); - void PruneTable(); bool IsValid() const; diff --git a/chromium/third_party/blink/renderer/core/css/css_selector.cc b/chromium/third_party/blink/renderer/core/css/css_selector.cc index 58b9234b3a3..8b651b9b6d0 100644 --- a/chromium/third_party/blink/renderer/core/css/css_selector.cc +++ b/chromium/third_party/blink/renderer/core/css/css_selector.cc @@ -44,8 +44,6 @@ namespace blink { -using namespace HTMLNames; - struct SameSizeAsCSSSelector { unsigned bitfields; void* pointers[1]; @@ -118,7 +116,7 @@ inline unsigned CSSSelector::SpecificityForOneSelector() const { // FIXME: PseudoAny should base the specificity on the sub-selectors. // See http://lists.w3.org/Archives/Public/www-style/2010Sep/0530.html case kPseudoAny: - case kPseudoMatches: + case kPseudoIs: default: break; } @@ -217,8 +215,8 @@ PseudoId CSSSelector::GetPseudoId(PseudoType type) { case kPseudoLink: case kPseudoVisited: case kPseudoAny: - case kPseudoMatches: - case kPseudoIS: + case kPseudoIs: + case kPseudoWhere: case kPseudoAnyLink: case kPseudoWebkitAnyLink: case kPseudoAutofill: @@ -399,9 +397,8 @@ const static NameToPseudoStruct kPseudoTypeWithArgumentsMap[] = { {"cue", CSSSelector::kPseudoCue}, {"host", CSSSelector::kPseudoHost}, {"host-context", CSSSelector::kPseudoHostContext}, - {"is", CSSSelector::kPseudoIS}, + {"is", CSSSelector::kPseudoIs}, {"lang", CSSSelector::kPseudoLang}, - {"matches", CSSSelector::kPseudoMatches}, {"not", CSSSelector::kPseudoNot}, {"nth-child", CSSSelector::kPseudoNthChild}, {"nth-last-child", CSSSelector::kPseudoNthLastChild}, @@ -409,24 +406,7 @@ const static NameToPseudoStruct kPseudoTypeWithArgumentsMap[] = { {"nth-of-type", CSSSelector::kPseudoNthOfType}, {"part", CSSSelector::kPseudoPart}, {"slotted", CSSSelector::kPseudoSlotted}, -}; - -class NameToPseudoCompare { - public: - NameToPseudoCompare(const AtomicString& key) : key_(key) { - DCHECK(key_.Is8Bit()); - } - - bool operator()(const NameToPseudoStruct& entry, const NameToPseudoStruct&) { - DCHECK(entry.string); - const char* key = reinterpret_cast<const char*>(key_.Characters8()); - // If strncmp returns 0, then either the keys are equal, or |key_| sorts - // before |entry|. - return strncmp(entry.string, key, key_.length()) < 0; - } - - private: - const AtomicString& key_; + {"where", CSSSelector::kPseudoWhere}, }; static CSSSelector::PseudoType NameToPseudoType(const AtomicString& name, @@ -445,10 +425,17 @@ static CSSSelector::PseudoType NameToPseudoType(const AtomicString& name, pseudo_type_map_end = kPseudoTypeWithoutArgumentsMap + arraysize(kPseudoTypeWithoutArgumentsMap); } - NameToPseudoStruct dummy_key = {nullptr, CSSSelector::kPseudoUnknown}; - const NameToPseudoStruct* match = - std::lower_bound(pseudo_type_map, pseudo_type_map_end, dummy_key, - NameToPseudoCompare(name)); + const NameToPseudoStruct* match = std::lower_bound( + pseudo_type_map, pseudo_type_map_end, name, + [](const NameToPseudoStruct& entry, const AtomicString& name) -> bool { + DCHECK(name.Is8Bit()); + DCHECK(entry.string); + // If strncmp returns 0, then either the keys are equal, or |name| sorts + // before |entry|. + return strncmp(entry.string, + reinterpret_cast<const char*>(name.Characters8()), + name.length()) < 0; + }); if (match == pseudo_type_map_end || match->string != name.GetString()) return CSSSelector::kPseudoUnknown; @@ -619,12 +606,12 @@ void CSSSelector::UpdatePseudoType(const AtomicString& value, case kPseudoIncrement: case kPseudoIndeterminate: case kPseudoInvalid: - case kPseudoIS: + case kPseudoWhere: case kPseudoLang: case kPseudoLastChild: case kPseudoLastOfType: case kPseudoLink: - case kPseudoMatches: + case kPseudoIs: case kPseudoNoButton: case kPseudoNot: case kPseudoNthChild: @@ -770,8 +757,8 @@ const CSSSelector* CSSSelector::SerializeCompound( case kPseudoHost: case kPseudoHostContext: case kPseudoAny: - case kPseudoMatches: - case kPseudoIS: + case kPseudoIs: + case kPseudoWhere: break; default: break; @@ -1049,6 +1036,12 @@ bool CSSSelector::MatchesPseudoElement() const { return false; } +bool CSSSelector::IsTreeAbidingPseudoElement() const { + return Match() == CSSSelector::kPseudoElement && + (GetPseudoType() == kPseudoBefore || GetPseudoType() == kPseudoAfter || + GetPseudoType() == kPseudoPlaceholder); +} + template <typename Functor> static bool ForAnyInTagHistory(const Functor& functor, const CSSSelector& selector) { @@ -1102,17 +1095,17 @@ bool CSSSelector::NeedsUpdatedDistribution() const { *this); } -bool CSSSelector::HasPseudoMatches() const { +bool CSSSelector::HasPseudoIs() const { for (const CSSSelector* s = this; s; s = s->TagHistory()) { - if (s->GetPseudoType() == CSSSelector::kPseudoMatches) + if (s->GetPseudoType() == CSSSelector::kPseudoIs) return true; } return false; } -bool CSSSelector::HasPseudoIS() const { +bool CSSSelector::HasPseudoWhere() const { for (const CSSSelector* s = this; s; s = s->TagHistory()) { - if (s->GetPseudoType() == CSSSelector::kPseudoIS) + if (s->GetPseudoType() == CSSSelector::kPseudoWhere) return true; } return false; diff --git a/chromium/third_party/blink/renderer/core/css/css_selector.h b/chromium/third_party/blink/renderer/core/css/css_selector.h index b32eb9ed14d..72f1d831db9 100644 --- a/chromium/third_party/blink/renderer/core/css/css_selector.h +++ b/chromium/third_party/blink/renderer/core/css/css_selector.h @@ -163,8 +163,8 @@ class CORE_EXPORT CSSSelector { kPseudoLink, kPseudoVisited, kPseudoAny, - kPseudoMatches, - kPseudoIS, + kPseudoIs, + kPseudoWhere, kPseudoAnyLink, kPseudoWebkitAnyLink, kPseudoAutofill, @@ -380,13 +380,14 @@ class CORE_EXPORT CSSSelector { } bool MatchesPseudoElement() const; + bool IsTreeAbidingPseudoElement() const; bool HasContentPseudo() const; bool HasSlottedPseudo() const; bool HasDeepCombinatorOrShadowPseudo() const; bool NeedsUpdatedDistribution() const; - bool HasPseudoMatches() const; - bool HasPseudoIS() const; + bool HasPseudoIs() const; + bool HasPseudoWhere() const; private: unsigned relation_ : 4; // enum RelationType diff --git a/chromium/third_party/blink/renderer/core/css/css_selector_list.cc b/chromium/third_party/blink/renderer/core/css/css_selector_list.cc index ac9ac12e768..5a4542f40d1 100644 --- a/chromium/third_party/blink/renderer/core/css/css_selector_list.cc +++ b/chromium/third_party/blink/renderer/core/css/css_selector_list.cc @@ -122,7 +122,7 @@ void AddToList(CSSSelector*& destination, if (!selector_to_expand->IsLastInTagHistory()) destination->SetLastInTagHistory(false); } - if (selector_to_expand->GetPseudoType() == CSSSelector::kPseudoIS || + if (selector_to_expand->GetPseudoType() == CSSSelector::kPseudoWhere || selector_to_expand->IgnoreSpecificity()) destination->SetIgnoreSpecificity(true); destination->SetLastInSelectorList(false); @@ -139,8 +139,8 @@ CSSSelectorList CSSSelectorList::ExpandedFirstPseudoClass() const { size_t i = 0; CSSSelectorList transformed = this->Copy(); - while (!selector_boundaries[i]->HasPseudoMatches() && - !selector_boundaries[i]->HasPseudoIS()) + while (!selector_boundaries[i]->HasPseudoIs() && + !selector_boundaries[i]->HasPseudoWhere()) ++i; const CSSSelector* selector_to_expand_begin = selector_boundaries[i]; @@ -149,8 +149,8 @@ CSSSelectorList CSSSelectorList::ExpandedFirstPseudoClass() const { static_cast<unsigned>(selector_to_expand_end - selector_to_expand_begin); const CSSSelector* simple_selector = selector_to_expand_begin; - while (simple_selector->GetPseudoType() != CSSSelector::kPseudoMatches && - simple_selector->GetPseudoType() != CSSSelector::kPseudoIS) { + while (simple_selector->GetPseudoType() != CSSSelector::kPseudoIs && + simple_selector->GetPseudoType() != CSSSelector::kPseudoWhere) { simple_selector = simple_selector->TagHistory(); } @@ -217,17 +217,17 @@ CSSSelectorList CSSSelectorList::TransformForListExpansion() { return CSSSelectorList::ConcatenateListExpansion(transformed, *this); } -bool CSSSelectorList::HasPseudoMatches() const { +bool CSSSelectorList::HasPseudoIs() const { for (const CSSSelector* s = FirstForCSSOM(); s; s = Next(*s)) { - if (s->HasPseudoMatches()) + if (s->HasPseudoIs()) return true; } return false; } -bool CSSSelectorList::HasPseudoIS() const { +bool CSSSelectorList::HasPseudoWhere() const { for (const CSSSelector* s = FirstForCSSOM(); s; s = Next(*s)) { - if (s->HasPseudoIS()) + if (s->HasPseudoWhere()) return true; } return false; @@ -235,7 +235,7 @@ bool CSSSelectorList::HasPseudoIS() const { bool CSSSelectorList::RequiresExpansion() const { for (const CSSSelector* s = FirstForCSSOM(); s; s = Next(*s)) { - if (s->HasPseudoMatches() || s->HasPseudoIS()) + if (s->HasPseudoIs() || s->HasPseudoWhere()) return true; } return false; diff --git a/chromium/third_party/blink/renderer/core/css/css_selector_list.h b/chromium/third_party/blink/renderer/core/css/css_selector_list.h index db3b8b87daf..51f354b6bf4 100644 --- a/chromium/third_party/blink/renderer/core/css/css_selector_list.h +++ b/chromium/third_party/blink/renderer/core/css/css_selector_list.h @@ -77,8 +77,8 @@ class CORE_EXPORT CSSSelectorList { CSSSelectorList ExpandedFirstPseudoClass() const; CSSSelectorList TransformForListExpansion(); - bool HasPseudoMatches() const; - bool HasPseudoIS() const; + bool HasPseudoIs() const; + bool HasPseudoWhere() const; bool RequiresExpansion() const; CSSSelectorList& operator=(CSSSelectorList&& o) { diff --git a/chromium/third_party/blink/renderer/core/css/css_selector_test.cc b/chromium/third_party/blink/renderer/core/css/css_selector_test.cc index 16017e47215..694d59f6568 100644 --- a/chromium/third_party/blink/renderer/core/css/css_selector_test.cc +++ b/chromium/third_party/blink/renderer/core/css/css_selector_test.cc @@ -2,15 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/css_test_helper.h" +#include "third_party/blink/renderer/core/css/css_test_helpers.h" #include "third_party/blink/renderer/core/css/rule_set.h" #include "testing/gtest/include/gtest/gtest.h" namespace blink { +using namespace css_test_helpers; + TEST(CSSSelector, Representations) { - CSSTestHelper helper; + TestStyleSheet sheet; const char* css_rules = "summary::-webkit-details-marker { }" @@ -46,11 +48,11 @@ TEST(CSSSelector, Representations) { ".a.b .c {}"; - helper.AddCSSRules(css_rules); + sheet.AddCSSRules(css_rules); EXPECT_EQ(30u, - helper.GetRuleSet().RuleCount()); // .a, .b counts as two rules. + sheet.GetRuleSet().RuleCount()); // .a, .b counts as two rules. #ifndef NDEBUG - helper.GetRuleSet().Show(); + sheet.GetRuleSet().Show(); #endif } diff --git a/chromium/third_party/blink/renderer/core/css/css_selector_watch.cc b/chromium/third_party/blink/renderer/core/css/css_selector_watch.cc index cb416216e27..0c6ad72e1a9 100644 --- a/chromium/third_party/blink/renderer/core/css/css_selector_watch.cc +++ b/chromium/third_party/blink/renderer/core/css/css_selector_watch.cc @@ -55,7 +55,7 @@ CSSSelectorWatch::CSSSelectorWatch(Document& document) CSSSelectorWatch& CSSSelectorWatch::From(Document& document) { CSSSelectorWatch* watch = FromIfExists(document); if (!watch) { - watch = new CSSSelectorWatch(document); + watch = MakeGarbageCollected<CSSSelectorWatch>(document); ProvideTo(document, watch); } return *watch; diff --git a/chromium/third_party/blink/renderer/core/css/css_selector_watch.h b/chromium/third_party/blink/renderer/core/css/css_selector_watch.h index fcc7e9537a8..1f8f1677498 100644 --- a/chromium/third_party/blink/renderer/core/css/css_selector_watch.h +++ b/chromium/third_party/blink/renderer/core/css/css_selector_watch.h @@ -50,6 +50,7 @@ class CORE_EXPORT CSSSelectorWatch final public: static const char kSupplementName[]; + explicit CSSSelectorWatch(Document&); virtual ~CSSSelectorWatch() = default; static CSSSelectorWatch& From(Document&); @@ -66,7 +67,6 @@ class CORE_EXPORT CSSSelectorWatch final void Trace(blink::Visitor*) override; private: - explicit CSSSelectorWatch(Document&); void CallbackSelectorChangeTimerFired(TimerBase*); HeapVector<Member<StyleRule>> watched_callback_selectors_; diff --git a/chromium/third_party/blink/renderer/core/css/css_selector_watch_test.cc b/chromium/third_party/blink/renderer/core/css/css_selector_watch_test.cc index 4bb106de70f..55351d77d3e 100644 --- a/chromium/third_party/blink/renderer/core/css/css_selector_watch_test.cc +++ b/chromium/third_party/blink/renderer/core/css/css_selector_watch_test.cc @@ -47,7 +47,7 @@ TEST_F(CSSSelectorWatchTest, RecalcOnDocumentChange) { selectors.push_back(".a"); watch.WatchCSSSelectors(selectors); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); selectors.clear(); selectors.push_back(".b"); @@ -55,7 +55,7 @@ TEST_F(CSSSelectorWatchTest, RecalcOnDocumentChange) { selectors.push_back("#nomatch"); watch.WatchCSSSelectors(selectors); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); Element* x = GetDocument().getElementById("x"); Element* y = GetDocument().getElementById("y"); @@ -64,14 +64,14 @@ TEST_F(CSSSelectorWatchTest, RecalcOnDocumentChange) { ASSERT_TRUE(y); ASSERT_TRUE(z); - x->removeAttribute(HTMLNames::classAttr); - y->removeAttribute(HTMLNames::classAttr); - z->setAttribute(HTMLNames::classAttr, "c"); + x->removeAttribute(html_names::kClassAttr); + y->removeAttribute(html_names::kClassAttr); + z->setAttribute(html_names::kClassAttr, "c"); ClearAddedRemoved(watch); unsigned before_count = GetStyleEngine().StyleForElementCount(); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); unsigned after_count = GetStyleEngine().StyleForElementCount(); EXPECT_EQ(2u, after_count - before_count); diff --git a/chromium/third_party/blink/renderer/core/css/css_shadow_value.h b/chromium/third_party/blink/renderer/core/css/css_shadow_value.h index d42c673e3fe..0783d72ce63 100644 --- a/chromium/third_party/blink/renderer/core/css/css_shadow_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_shadow_value.h @@ -39,9 +39,17 @@ class CORE_EXPORT CSSShadowValue : public CSSValue { CSSPrimitiveValue* spread, CSSIdentifierValue* style, CSSValue* color) { - return new CSSShadowValue(x, y, blur, spread, style, color); + return MakeGarbageCollected<CSSShadowValue>(x, y, blur, spread, style, + color); } + CSSShadowValue(CSSPrimitiveValue* x, + CSSPrimitiveValue* y, + CSSPrimitiveValue* blur, + CSSPrimitiveValue* spread, + CSSIdentifierValue* style, + CSSValue* color); + String CustomCSSText() const; bool Equals(const CSSShadowValue&) const; @@ -54,14 +62,6 @@ class CORE_EXPORT CSSShadowValue : public CSSValue { Member<CSSValue> color; void TraceAfterDispatch(blink::Visitor*); - - private: - CSSShadowValue(CSSPrimitiveValue* x, - CSSPrimitiveValue* y, - CSSPrimitiveValue* blur, - CSSPrimitiveValue* spread, - CSSIdentifierValue* style, - CSSValue* color); }; DEFINE_CSS_VALUE_TYPE_CASTS(CSSShadowValue, IsShadowValue()); diff --git a/chromium/third_party/blink/renderer/core/css/css_string_value.h b/chromium/third_party/blink/renderer/core/css/css_string_value.h index c5ef637f9db..6c0ed697237 100644 --- a/chromium/third_party/blink/renderer/core/css/css_string_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_string_value.h @@ -13,9 +13,11 @@ namespace blink { class CSSStringValue : public CSSValue { public: static CSSStringValue* Create(const String& str) { - return new CSSStringValue(str); + return MakeGarbageCollected<CSSStringValue>(str); } + CSSStringValue(const String&); + String Value() const { return string_; } String CustomCSSText() const; @@ -27,8 +29,6 @@ class CSSStringValue : public CSSValue { void TraceAfterDispatch(blink::Visitor*); private: - CSSStringValue(const String&); - String string_; }; diff --git a/chromium/third_party/blink/renderer/core/css/css_style_declaration.cc b/chromium/third_party/blink/renderer/core/css/css_style_declaration.cc index 4032f2f8586..d4c61489d99 100644 --- a/chromium/third_party/blink/renderer/core/css/css_style_declaration.cc +++ b/chromium/third_party/blink/renderer/core/css/css_style_declaration.cc @@ -34,11 +34,11 @@ #include "third_party/blink/renderer/core/css/css_primitive_value.h" #include "third_party/blink/renderer/core/css/css_property_id_templates.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/css_style_declaration.h" #include "third_party/blink/renderer/core/css/css_value.h" #include "third_party/blink/renderer/core/css/parser/css_parser.h" #include "third_party/blink/renderer/core/css/properties/css_property.h" -#include "third_party/blink/renderer/core/css_property_names.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/wtf/ascii_ctype.h" diff --git a/chromium/third_party/blink/renderer/core/css/css_style_declaration.h b/chromium/third_party/blink/renderer/core/css/css_style_declaration.h index e2ce951b3fd..6dae92035d8 100644 --- a/chromium/third_party/blink/renderer/core/css/css_style_declaration.h +++ b/chromium/third_party/blink/renderer/core/css/css_style_declaration.h @@ -23,7 +23,7 @@ #include "base/macros.h" #include "third_party/blink/renderer/core/core_export.h" -#include "third_party/blink/renderer/core/css_property_names.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/wtf/forward.h" diff --git a/chromium/third_party/blink/renderer/core/css/css_style_declaration.idl b/chromium/third_party/blink/renderer/core/css/css_style_declaration.idl index 03e8b072200..934c1c95401 100644 --- a/chromium/third_party/blink/renderer/core/css/css_style_declaration.idl +++ b/chromium/third_party/blink/renderer/core/css/css_style_declaration.idl @@ -28,12 +28,12 @@ [Affects=Nothing] getter DOMString item(unsigned long index); DOMString getPropertyValue(DOMString property); DOMString getPropertyPriority(DOMString property); - [CEReactions, RaisesException, CallWith=ExecutionContext] void setProperty(DOMString property, [TreatNullAs=EmptyString] DOMString value, [TreatNullAs=EmptyString] optional DOMString priority = ""); + [CEReactions, RaisesException, CallWith=ExecutionContext] void setProperty(DOMString property, [TreatNullAs=EmptyString] DOMString value, optional [TreatNullAs=EmptyString] DOMString priority = ""); // void setPropertyValue(DOMString property, [TreatNullAs=EmptyString] DOMString value); // void setPropertyPriority(DOMString property, [TreatNullAs=EmptyString] DOMString priority); [CEReactions, RaisesException] DOMString removeProperty(DOMString property); readonly attribute CSSRule? parentRule; - [CEReactions, SetterCallWith=ExecutionContext, RaisesException=Setter, TreatNullAs=EmptyString] attribute DOMString cssFloat; + [CEReactions, SetterCallWith=ExecutionContext, RaisesException=Setter] attribute [TreatNullAs=EmptyString] DOMString cssFloat; // The camel-cased and dashed attribute getters have custom bindings. // https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-camel-cased-attribute diff --git a/chromium/third_party/blink/renderer/core/css/css_style_declaration_test.cc b/chromium/third_party/blink/renderer/core/css/css_style_declaration_test.cc index 217943bb028..93d258add61 100644 --- a/chromium/third_party/blink/renderer/core/css/css_style_declaration_test.cc +++ b/chromium/third_party/blink/renderer/core/css/css_style_declaration_test.cc @@ -6,20 +6,22 @@ #include "third_party/blink/renderer/core/css/css_rule_list.h" #include "third_party/blink/renderer/core/css/css_style_rule.h" -#include "third_party/blink/renderer/core/css/css_test_helper.h" +#include "third_party/blink/renderer/core/css/css_test_helpers.h" #include "testing/gtest/include/gtest/gtest.h" namespace blink { +using namespace css_test_helpers; + TEST(CSSStyleDeclarationTest, getPropertyShorthand) { - CSSTestHelper helper; + TestStyleSheet sheet; - helper.AddCSSRules("div { padding: var(--p); }"); - ASSERT_TRUE(helper.CssRules()); - ASSERT_EQ(1u, helper.CssRules()->length()); - ASSERT_EQ(CSSRule::kStyleRule, helper.CssRules()->item(0)->type()); - CSSStyleRule* style_rule = ToCSSStyleRule(helper.CssRules()->item(0)); + sheet.AddCSSRules("div { padding: var(--p); }"); + ASSERT_TRUE(sheet.CssRules()); + ASSERT_EQ(1u, sheet.CssRules()->length()); + ASSERT_EQ(CSSRule::kStyleRule, sheet.CssRules()->item(0)->type()); + CSSStyleRule* style_rule = ToCSSStyleRule(sheet.CssRules()->item(0)); CSSStyleDeclaration* style = style_rule->style(); ASSERT_TRUE(style); EXPECT_EQ(AtomicString(), style->GetPropertyShorthand("padding")); diff --git a/chromium/third_party/blink/renderer/core/css/css_style_rule.cc b/chromium/third_party/blink/renderer/core/css/css_style_rule.cc index c2e6d1b4b98..1818ed6394a 100644 --- a/chromium/third_party/blink/renderer/core/css/css_style_rule.cc +++ b/chromium/third_party/blink/renderer/core/css/css_style_rule.cc @@ -37,14 +37,14 @@ using SelectorTextCache = HeapHashMap<WeakMember<const CSSStyleRule>, String>; static SelectorTextCache& GetSelectorTextCache() { DEFINE_STATIC_LOCAL(Persistent<SelectorTextCache>, cache, - (new SelectorTextCache)); + (MakeGarbageCollected<SelectorTextCache>())); return *cache; } CSSStyleRule::CSSStyleRule(StyleRule* style_rule, CSSStyleSheet* parent) : CSSRule(parent), style_rule_(style_rule), - style_map_(new DeclaredStylePropertyMap(this)) {} + style_map_(MakeGarbageCollected<DeclaredStylePropertyMap>(this)) {} CSSStyleRule::~CSSStyleRule() = default; diff --git a/chromium/third_party/blink/renderer/core/css/css_style_rule.h b/chromium/third_party/blink/renderer/core/css/css_style_rule.h index c8e8a3e3538..bde00b92ecf 100644 --- a/chromium/third_party/blink/renderer/core/css/css_style_rule.h +++ b/chromium/third_party/blink/renderer/core/css/css_style_rule.h @@ -38,9 +38,10 @@ class CORE_EXPORT CSSStyleRule final : public CSSRule { public: static CSSStyleRule* Create(StyleRule* rule, CSSStyleSheet* sheet) { - return new CSSStyleRule(rule, sheet); + return MakeGarbageCollected<CSSStyleRule>(rule, sheet); } + CSSStyleRule(StyleRule*, CSSStyleSheet*); ~CSSStyleRule() override; String cssText() const override; @@ -59,8 +60,6 @@ class CORE_EXPORT CSSStyleRule final : public CSSRule { void Trace(blink::Visitor*) override; private: - CSSStyleRule(StyleRule*, CSSStyleSheet*); - CSSRule::Type type() const override { return kStyleRule; } Member<StyleRule> style_rule_; diff --git a/chromium/third_party/blink/renderer/core/css/css_style_sheet.cc b/chromium/third_party/blink/renderer/core/css/css_style_sheet.cc index b564ea18dce..eba408502a8 100644 --- a/chromium/third_party/blink/renderer/core/css/css_style_sheet.cc +++ b/chromium/third_party/blink/renderer/core/css/css_style_sheet.cc @@ -47,22 +47,22 @@ namespace blink { -using namespace HTMLNames; +using namespace html_names; class StyleSheetCSSRuleList final : public CSSRuleList { public: static StyleSheetCSSRuleList* Create(CSSStyleSheet* sheet) { - return new StyleSheetCSSRuleList(sheet); + return MakeGarbageCollected<StyleSheetCSSRuleList>(sheet); } + StyleSheetCSSRuleList(CSSStyleSheet* sheet) : style_sheet_(sheet) {} + void Trace(blink::Visitor* visitor) override { visitor->Trace(style_sheet_); CSSRuleList::Trace(visitor); } private: - StyleSheetCSSRuleList(CSSStyleSheet* sheet) : style_sheet_(sheet) {} - unsigned length() const override { return style_sheet_->length(); } CSSRule* item(unsigned index) const override { return style_sheet_->item(index); @@ -93,7 +93,7 @@ const Document* CSSStyleSheet::SingleOwnerDocument( } CSSStyleSheet* CSSStyleSheet::Create(Document& document, - const CSSStyleSheetInit& options, + const CSSStyleSheetInit* options, ExceptionState& exception_state) { if (!RuntimeEnabledFeatures::ConstructableStylesheetsEnabled()) { exception_state.ThrowTypeError("Illegal constructor"); @@ -103,41 +103,42 @@ CSSStyleSheet* CSSStyleSheet::Create(Document& document, // https://wicg.github.io/construct-stylesheets/#dom-cssstylesheet-cssstylesheet CSSParserContext* parser_context = CSSParserContext::Create(document); StyleSheetContents* contents = StyleSheetContents::Create(parser_context); - CSSStyleSheet* sheet = new CSSStyleSheet(contents, nullptr); - sheet->SetTitle(options.title()); + CSSStyleSheet* sheet = MakeGarbageCollected<CSSStyleSheet>(contents, nullptr); + sheet->SetTitle(options->title()); sheet->ClearOwnerNode(); sheet->ClearOwnerRule(); scoped_refptr<MediaQuerySet> media_query_set; - if (options.media().IsString()) - media_query_set = MediaQuerySet::Create(options.media().GetAsString()); + if (options->media().IsString()) + media_query_set = MediaQuerySet::Create(options->media().GetAsString()); else - media_query_set = options.media().GetAsMediaList()->Queries()->Copy(); + media_query_set = options->media().GetAsMediaList()->Queries()->Copy(); MediaList* media_list = MediaList::Create(media_query_set, const_cast<CSSStyleSheet*>(sheet)); sheet->SetMedia(media_list); - if (options.alternate()) + if (options->alternate()) sheet->SetAlternateFromConstructor(true); - if (options.disabled()) + if (options->disabled()) sheet->setDisabled(true); return sheet; } CSSStyleSheet* CSSStyleSheet::Create(StyleSheetContents* sheet, CSSImportRule* owner_rule) { - return new CSSStyleSheet(sheet, owner_rule); + return MakeGarbageCollected<CSSStyleSheet>(sheet, owner_rule); } CSSStyleSheet* CSSStyleSheet::Create(StyleSheetContents* sheet, Node& owner_node) { - return new CSSStyleSheet(sheet, owner_node, false, - TextPosition::MinimumPosition()); + return MakeGarbageCollected<CSSStyleSheet>(sheet, owner_node, false, + TextPosition::MinimumPosition()); } CSSStyleSheet* CSSStyleSheet::CreateInline(StyleSheetContents* sheet, Node& owner_node, const TextPosition& start_position) { DCHECK(sheet); - return new CSSStyleSheet(sheet, owner_node, true, start_position); + return MakeGarbageCollected<CSSStyleSheet>(sheet, owner_node, true, + start_position); } CSSStyleSheet* CSSStyleSheet::CreateInline(Node& owner_node, @@ -150,7 +151,8 @@ CSSStyleSheet* CSSStyleSheet::CreateInline(Node& owner_node, owner_node.GetDocument().GetReferrerPolicy(), encoding); StyleSheetContents* sheet = StyleSheetContents::Create(base_url.GetString(), parser_context); - return new CSSStyleSheet(sheet, owner_node, true, start_position); + return MakeGarbageCollected<CSSStyleSheet>(sheet, owner_node, true, + start_position); } CSSStyleSheet::CSSStyleSheet(StyleSheetContents* contents, @@ -551,7 +553,7 @@ void CSSStyleSheet::SetAlternateFromConstructor( bool CSSStyleSheet::IsAlternate() const { if (owner_node_) { return owner_node_->IsElementNode() && - ToElement(owner_node_)->getAttribute(relAttr).Contains("alternate"); + ToElement(owner_node_)->getAttribute(kRelAttr).Contains("alternate"); } return alternate_from_constructor_; } diff --git a/chromium/third_party/blink/renderer/core/css/css_style_sheet.h b/chromium/third_party/blink/renderer/core/css/css_style_sheet.h index dcafec0c17f..51d77f9a018 100644 --- a/chromium/third_party/blink/renderer/core/css/css_style_sheet.h +++ b/chromium/third_party/blink/renderer/core/css/css_style_sheet.h @@ -54,7 +54,7 @@ class CORE_EXPORT CSSStyleSheet final : public StyleSheet { static const Document* SingleOwnerDocument(const CSSStyleSheet*); static CSSStyleSheet* Create(Document&, - const CSSStyleSheetInit&, + const CSSStyleSheetInit*, ExceptionState&); static CSSStyleSheet* Create(StyleSheetContents*, @@ -70,6 +70,11 @@ class CORE_EXPORT CSSStyleSheet final : public StyleSheet { Node& owner_node, const TextPosition& start_position = TextPosition::MinimumPosition()); + CSSStyleSheet(StyleSheetContents*, CSSImportRule* owner_rule); + CSSStyleSheet(StyleSheetContents*, + Node& owner_node, + bool is_inline_stylesheet, + const TextPosition& start_position); ~CSSStyleSheet() override; CSSStyleSheet* parentStyleSheet() const override; @@ -193,12 +198,6 @@ class CORE_EXPORT CSSStyleSheet final : public StyleSheet { void Trace(blink::Visitor*) override; private: - CSSStyleSheet(StyleSheetContents*, CSSImportRule* owner_rule); - CSSStyleSheet(StyleSheetContents*, - Node& owner_node, - bool is_inline_stylesheet, - const TextPosition& start_position); - bool IsCSSStyleSheet() const override { return true; } String type() const override { return "text/css"; } diff --git a/chromium/third_party/blink/renderer/core/css/css_style_sheet_test.cc b/chromium/third_party/blink/renderer/core/css/css_style_sheet_test.cc index 234c6883238..3cdf716f661 100644 --- a/chromium/third_party/blink/renderer/core/css/css_style_sheet_test.cc +++ b/chromium/third_party/blink/renderer/core/css/css_style_sheet_test.cc @@ -28,14 +28,15 @@ class CSSStyleSheetTest : public PageTestBase { public: static v8::Local<v8::Function> CreateFunction(ScriptState* script_state, ScriptValue* output) { - FunctionForTest* self = new FunctionForTest(script_state, output); + FunctionForTest* self = + MakeGarbageCollected<FunctionForTest>(script_state, output); return self->BindToV8Function(); } - private: FunctionForTest(ScriptState* script_state, ScriptValue* output) : ScriptFunction(script_state), output_(output) {} + private: ScriptValue Call(ScriptValue value) override { DCHECK(!value.IsEmpty()); *output_ = value; @@ -49,7 +50,7 @@ class CSSStyleSheetTest : public PageTestBase { TEST_F(CSSStyleSheetTest, ConstructorWithoutRuntimeFlagThrowsException) { DummyExceptionStateForTesting exception_state; RuntimeEnabledFeatures::SetConstructableStylesheetsEnabled(false); - EXPECT_EQ(CSSStyleSheet::Create(GetDocument(), CSSStyleSheetInit(), + EXPECT_EQ(CSSStyleSheet::Create(GetDocument(), CSSStyleSheetInit::Create(), exception_state), nullptr); ASSERT_TRUE(exception_state.HadException()); @@ -58,11 +59,11 @@ TEST_F(CSSStyleSheetTest, ConstructorWithoutRuntimeFlagThrowsException) { TEST_F(CSSStyleSheetTest, CSSStyleSheetConstructionWithNonEmptyCSSStyleSheetInit) { DummyExceptionStateForTesting exception_state; - CSSStyleSheetInit init; - init.setMedia(MediaListOrString::FromString("screen, print")); - init.setTitle("test"); - init.setAlternate(true); - init.setDisabled(true); + CSSStyleSheetInit* init = CSSStyleSheetInit::Create(); + init->setMedia(MediaListOrString::FromString("screen, print")); + init->setTitle("test"); + init->setAlternate(true); + init->setDisabled(true); CSSStyleSheet* sheet = CSSStyleSheet::Create(GetDocument(), init, exception_state); ASSERT_FALSE(exception_state.HadException()); @@ -71,8 +72,8 @@ TEST_F(CSSStyleSheetTest, EXPECT_EQ(sheet->ownerNode(), nullptr); EXPECT_EQ(sheet->ownerRule(), nullptr); EXPECT_EQ(sheet->media()->length(), 2U); - EXPECT_EQ(sheet->media()->mediaText(), init.media().GetAsString()); - EXPECT_EQ(sheet->title(), init.title()); + EXPECT_EQ(sheet->media()->mediaText(), init->media().GetAsString()); + EXPECT_EQ(sheet->title(), init->title()); EXPECT_TRUE(sheet->AlternateFromConstructor()); EXPECT_TRUE(sheet->disabled()); EXPECT_EQ(sheet->cssRules(exception_state)->length(), 0U); @@ -83,7 +84,7 @@ TEST_F(CSSStyleSheetTest, CreateEmptyCSSStyleSheetWithEmptyCSSStyleSheetInit) { V8TestingScope scope; DummyExceptionStateForTesting exception_state; CSSStyleSheet* sheet = GetDocument().createEmptyCSSStyleSheet( - scope.GetScriptState(), CSSStyleSheetInit(), exception_state); + scope.GetScriptState(), CSSStyleSheetInit::Create(), exception_state); ASSERT_FALSE(exception_state.HadException()); EXPECT_TRUE(sheet->href().IsNull()); EXPECT_EQ(sheet->parentStyleSheet(), nullptr); @@ -99,11 +100,11 @@ TEST_F(CSSStyleSheetTest, CreateEmptyCSSStyleSheetWithEmptyCSSStyleSheetInit) { TEST_F(CSSStyleSheetTest, CreateEmptyCSSStyleSheetWithNonEmptyCSSStyleSheetInit) { - CSSStyleSheetInit init; - init.setMedia(MediaListOrString::FromString("screen, print")); - init.setTitle("test"); - init.setAlternate(true); - init.setDisabled(true); + CSSStyleSheetInit* init = CSSStyleSheetInit::Create(); + init->setMedia(MediaListOrString::FromString("screen, print")); + init->setTitle("test"); + init->setAlternate(true); + init->setDisabled(true); V8TestingScope scope; DummyExceptionStateForTesting exception_state; CSSStyleSheet* sheet = GetDocument().createEmptyCSSStyleSheet( @@ -114,8 +115,8 @@ TEST_F(CSSStyleSheetTest, EXPECT_EQ(sheet->ownerNode(), nullptr); EXPECT_EQ(sheet->ownerRule(), nullptr); EXPECT_EQ(sheet->media()->length(), 2U); - EXPECT_EQ(sheet->media()->mediaText(), init.media().GetAsString()); - EXPECT_EQ(sheet->title(), init.title()); + EXPECT_EQ(sheet->media()->mediaText(), init->media().GetAsString()); + EXPECT_EQ(sheet->title(), init->title()); EXPECT_TRUE(sheet->AlternateFromConstructor()); EXPECT_TRUE(sheet->disabled()); ASSERT_FALSE(exception_state.HadException()); @@ -126,7 +127,7 @@ TEST_F(CSSStyleSheetTest, V8TestingScope scope; DummyExceptionStateForTesting exception_state; ScriptPromise promise = GetDocument().createCSSStyleSheet( - scope.GetScriptState(), "", CSSStyleSheetInit(), exception_state); + scope.GetScriptState(), "", CSSStyleSheetInit::Create(), exception_state); EXPECT_FALSE(promise.IsEmpty()); ASSERT_FALSE(exception_state.HadException()); ScriptValue on_fulfilled, on_rejected; @@ -153,11 +154,11 @@ TEST_F(CSSStyleSheetTest, CreateCSSStyleSheetWithNonEmptyCSSStyleSheetInitAndText) { String styleText[2] = {".red { color: red; }", ".red + span + span { color: red; }"}; - CSSStyleSheetInit init; - init.setMedia(MediaListOrString::FromString("screen, print")); - init.setTitle("test"); - init.setAlternate(true); - init.setDisabled(true); + CSSStyleSheetInit* init = CSSStyleSheetInit::Create(); + init->setMedia(MediaListOrString::FromString("screen, print")); + init->setTitle("test"); + init->setAlternate(true); + init->setDisabled(true); V8TestingScope scope; DummyExceptionStateForTesting exception_state; ScriptPromise promise = GetDocument().createCSSStyleSheet( @@ -179,8 +180,8 @@ TEST_F(CSSStyleSheetTest, EXPECT_EQ(sheet->ownerNode(), nullptr); EXPECT_EQ(sheet->ownerRule(), nullptr); EXPECT_EQ(sheet->media()->length(), 2U); - EXPECT_EQ(sheet->media()->mediaText(), init.media().GetAsString()); - EXPECT_EQ(sheet->title(), init.title()); + EXPECT_EQ(sheet->media()->mediaText(), init->media().GetAsString()); + EXPECT_EQ(sheet->title(), init->title()); EXPECT_TRUE(sheet->AlternateFromConstructor()); EXPECT_TRUE(sheet->disabled()); EXPECT_EQ(sheet->cssRules(exception_state)->length(), 2U); diff --git a/chromium/third_party/blink/renderer/core/css/css_supports_rule.h b/chromium/third_party/blink/renderer/core/css/css_supports_rule.h index 75088cf78e6..2ff67c34347 100644 --- a/chromium/third_party/blink/renderer/core/css/css_supports_rule.h +++ b/chromium/third_party/blink/renderer/core/css/css_supports_rule.h @@ -41,16 +41,15 @@ class CSSSupportsRule final : public CSSConditionRule { public: static CSSSupportsRule* Create(StyleRuleSupports* rule, CSSStyleSheet* sheet) { - return new CSSSupportsRule(rule, sheet); + return MakeGarbageCollected<CSSSupportsRule>(rule, sheet); } + CSSSupportsRule(StyleRuleSupports*, CSSStyleSheet*); ~CSSSupportsRule() override = default; String cssText() const override; private: - CSSSupportsRule(StyleRuleSupports*, CSSStyleSheet*); - CSSRule::Type type() const override { return kSupportsRule; } }; diff --git a/chromium/third_party/blink/renderer/core/css/css_syntax_component.cc b/chromium/third_party/blink/renderer/core/css/css_syntax_component.cc new file mode 100644 index 00000000000..926d064fa8f --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/css_syntax_component.cc @@ -0,0 +1,63 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/css_syntax_component.h" + +#include "third_party/blink/renderer/core/css/cssom/css_keyword_value.h" +#include "third_party/blink/renderer/core/css/cssom/css_style_value.h" +#include "third_party/blink/renderer/core/css/cssom/cssom_types.h" + +namespace blink { + +bool CSSSyntaxComponent::CanTake(const CSSStyleValue& value) const { + switch (type_) { + case CSSSyntaxType::kTokenStream: + return value.GetType() == CSSStyleValue::kUnparsedType; + case CSSSyntaxType::kIdent: + return value.GetType() == CSSStyleValue::kKeywordType && + static_cast<const CSSKeywordValue&>(value).value() == string_; + case CSSSyntaxType::kLength: + return CSSOMTypes::IsCSSStyleValueLength(value); + case CSSSyntaxType::kInteger: + // TODO(andruud): Support rounding. + // https://drafts.css-houdini.org/css-typed-om-1/#numeric-objects + FALLTHROUGH; + case CSSSyntaxType::kNumber: + return CSSOMTypes::IsCSSStyleValueNumber(value); + case CSSSyntaxType::kPercentage: + return CSSOMTypes::IsCSSStyleValuePercentage(value); + case CSSSyntaxType::kLengthPercentage: + // TODO(andruud): Support calc(X% + Ypx). + return CSSOMTypes::IsCSSStyleValueLength(value) || + CSSOMTypes::IsCSSStyleValuePercentage(value); + case CSSSyntaxType::kColor: + // TODO(andruud): Support custom properties in CSSUnsupportedStyleValue. + return false; + case CSSSyntaxType::kImage: + case CSSSyntaxType::kUrl: + return value.GetType() == CSSStyleValue::kURLImageType; + case CSSSyntaxType::kAngle: + return CSSOMTypes::IsCSSStyleValueAngle(value); + case CSSSyntaxType::kTime: + return CSSOMTypes::IsCSSStyleValueTime(value); + case CSSSyntaxType::kResolution: + return CSSOMTypes::IsCSSStyleValueResolution(value); + case CSSSyntaxType::kTransformFunction: + // TODO(andruud): Currently not supported by Typed OM. + // https://github.com/w3c/css-houdini-drafts/issues/290 + // For now, this should accept a CSSUnsupportedStyleValue, such that + // <transform-function> values can be moved from one registered property + // to another. + // TODO(andruud): Support custom properties in CSSUnsupportedStyleValue. + return false; + case CSSSyntaxType::kTransformList: + return value.GetType() == CSSStyleValue::kTransformType; + case CSSSyntaxType::kCustomIdent: + return value.GetType() == CSSStyleValue::kKeywordType; + default: + return false; + } +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/css_syntax_component.h b/chromium/third_party/blink/renderer/core/css/css_syntax_component.h new file mode 100644 index 00000000000..a828a13909d --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/css_syntax_component.h @@ -0,0 +1,68 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_SYNTAX_COMPONENT_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_SYNTAX_COMPONENT_H_ + +#include "base/macros.h" +#include "third_party/blink/renderer/core/css/css_value.h" +#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" + +namespace blink { + +class CSSStyleValue; + +enum class CSSSyntaxType { + kTokenStream, + kIdent, + kLength, + kNumber, + kPercentage, + kLengthPercentage, + kColor, + kImage, + kUrl, + kInteger, + kAngle, + kTime, + kResolution, + kTransformFunction, + kTransformList, + kCustomIdent, +}; + +enum class CSSSyntaxRepeat { kNone, kSpaceSeparated, kCommaSeparated }; + +class CSSSyntaxComponent { + public: + CSSSyntaxComponent(CSSSyntaxType type, + const String& string, + CSSSyntaxRepeat repeat) + : type_(type), string_(string), repeat_(repeat) {} + + bool operator==(const CSSSyntaxComponent& a) const { + return type_ == a.type_ && string_ == a.string_ && repeat_ == a.repeat_; + } + + CSSSyntaxType GetType() const { return type_; } + const String& GetString() const { return string_; } + CSSSyntaxRepeat GetRepeat() const { return repeat_; } + bool IsRepeatable() const { return repeat_ != CSSSyntaxRepeat::kNone; } + bool IsInteger() const { return type_ == CSSSyntaxType::kInteger; } + char Separator() const { + DCHECK(IsRepeatable()); + return repeat_ == CSSSyntaxRepeat::kSpaceSeparated ? ' ' : ','; + } + + bool CanTake(const CSSStyleValue&) const; + + private: + CSSSyntaxType type_; + String string_; // Only used when type_ is CSSSyntaxType::kIdent + CSSSyntaxRepeat repeat_; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_SYNTAX_COMPONENT_H_ diff --git a/chromium/third_party/blink/renderer/core/css/css_syntax_descriptor.cc b/chromium/third_party/blink/renderer/core/css/css_syntax_descriptor.cc index a60e132796c..0f252c37254 100644 --- a/chromium/third_party/blink/renderer/core/css/css_syntax_descriptor.cc +++ b/chromium/third_party/blink/renderer/core/css/css_syntax_descriptor.cc @@ -5,16 +5,15 @@ #include "third_party/blink/renderer/core/css/css_syntax_descriptor.h" #include "third_party/blink/renderer/core/css/css_custom_property_declaration.h" +#include "third_party/blink/renderer/core/css/css_syntax_component.h" #include "third_party/blink/renderer/core/css/css_uri_value.h" #include "third_party/blink/renderer/core/css/css_value_list.h" #include "third_party/blink/renderer/core/css/css_variable_reference_value.h" -#include "third_party/blink/renderer/core/css/cssom/css_keyword_value.h" -#include "third_party/blink/renderer/core/css/cssom/css_style_value.h" -#include "third_party/blink/renderer/core/css/cssom/cssom_types.h" #include "third_party/blink/renderer/core/css/parser/css_parser_idioms.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/css/parser/css_variable_parser.h" #include "third_party/blink/renderer/core/html/parser/html_parser_idioms.h" +#include "third_party/blink/renderer/platform/runtime_enabled_features.h" namespace blink { @@ -45,8 +44,10 @@ CSSSyntaxType ParseSyntaxType(String type) { return CSSSyntaxType::kLengthPercentage; if (type == "color") return CSSSyntaxType::kColor; - if (type == "image") - return CSSSyntaxType::kImage; + if (RuntimeEnabledFeatures::CSSVariables2ImageValuesEnabled()) { + if (type == "image") + return CSSSyntaxType::kImage; + } if (type == "url") return CSSSyntaxType::kUrl; if (type == "integer") @@ -57,10 +58,12 @@ CSSSyntaxType ParseSyntaxType(String type) { return CSSSyntaxType::kTime; if (type == "resolution") return CSSSyntaxType::kResolution; - if (type == "transform-function") - return CSSSyntaxType::kTransformFunction; - if (type == "transform-list") - return CSSSyntaxType::kTransformList; + if (RuntimeEnabledFeatures::CSSVariables2TransformValuesEnabled()) { + if (type == "transform-function") + return CSSSyntaxType::kTransformFunction; + if (type == "transform-list") + return CSSSyntaxType::kTransformList; + } if (type == "custom-ident") return CSSSyntaxType::kCustomIdent; // Not an Ident, just used to indicate failure @@ -93,7 +96,7 @@ bool ConsumeSyntaxIdent(const String& input, if (offset == ident_start) return false; ident = input.Substring(ident_start, offset - ident_start); - return !CSSPropertyParserHelpers::IsCSSWideKeyword(ident); + return !css_property_parser_helpers::IsCSSWideKeyword(ident); } CSSSyntaxDescriptor::CSSSyntaxDescriptor(const String& input) { @@ -152,14 +155,14 @@ CSSSyntaxDescriptor::CSSSyntaxDescriptor(const String& input) { const CSSValue* ConsumeSingleType(const CSSSyntaxComponent& syntax, CSSParserTokenRange& range, const CSSParserContext* context) { - using namespace CSSPropertyParserHelpers; + using namespace css_property_parser_helpers; - switch (syntax.type_) { + switch (syntax.GetType()) { case CSSSyntaxType::kIdent: if (range.Peek().GetType() == kIdentToken && - range.Peek().Value() == syntax.string_) { + range.Peek().Value() == syntax.GetString()) { range.ConsumeIncludingWhitespace(); - return CSSCustomIdentValue::Create(AtomicString(syntax.string_)); + return CSSCustomIdentValue::Create(AtomicString(syntax.GetString())); } return nullptr; case CSSSyntaxType::kLength: @@ -179,7 +182,7 @@ const CSSValue* ConsumeSingleType(const CSSSyntaxComponent& syntax, case CSSSyntaxType::kUrl: return ConsumeUrl(range, context); case CSSSyntaxType::kInteger: - return ConsumeInteger(range); + return ConsumeIntegerOrNumberCalc(range); case CSSSyntaxType::kAngle: return ConsumeAngle(range, context, base::Optional<WebFeature>()); case CSSSyntaxType::kTime: @@ -191,7 +194,7 @@ const CSSValue* ConsumeSingleType(const CSSSyntaxComponent& syntax, case CSSSyntaxType::kTransformList: return ConsumeTransformList(range, *context); case CSSSyntaxType::kCustomIdent: - return ConsumeCustomIdent(range); + return ConsumeCustomIdent(range, *context); default: NOTREACHED(); return nullptr; @@ -202,7 +205,7 @@ const CSSValue* ConsumeSyntaxComponent(const CSSSyntaxComponent& syntax, CSSParserTokenRange range, const CSSParserContext* context) { // CSS-wide keywords are already handled by the CSSPropertyParser - if (syntax.repeat_ == CSSSyntaxRepeat::kSpaceSeparated) { + if (syntax.GetRepeat() == CSSSyntaxRepeat::kSpaceSeparated) { CSSValueList* list = CSSValueList::CreateSpaceSeparated(); while (!range.AtEnd()) { const CSSValue* value = ConsumeSingleType(syntax, range, context); @@ -210,17 +213,18 @@ const CSSValue* ConsumeSyntaxComponent(const CSSSyntaxComponent& syntax, return nullptr; list->Append(*value); } - return list; + return list->length() ? list : nullptr; } - if (syntax.repeat_ == CSSSyntaxRepeat::kCommaSeparated) { + if (syntax.GetRepeat() == CSSSyntaxRepeat::kCommaSeparated) { CSSValueList* list = CSSValueList::CreateCommaSeparated(); do { const CSSValue* value = ConsumeSingleType(syntax, range, context); if (!value) return nullptr; list->Append(*value); - } while (CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(range)); - return list; + } while ( + css_property_parser_helpers::ConsumeCommaIncludingWhitespace(range)); + return list->length() ? list : nullptr; } const CSSValue* result = ConsumeSingleType(syntax, range, context); if (!range.AtEnd()) @@ -228,62 +232,17 @@ const CSSValue* ConsumeSyntaxComponent(const CSSSyntaxComponent& syntax, return result; } -bool CSSSyntaxComponent::CanTake(const CSSStyleValue& value) const { - switch (type_) { - case CSSSyntaxType::kTokenStream: - return value.GetType() == CSSStyleValue::kUnparsedType; - case CSSSyntaxType::kIdent: - return value.GetType() == CSSStyleValue::kKeywordType && - static_cast<const CSSKeywordValue&>(value).value() == string_; - case CSSSyntaxType::kLength: - return CSSOMTypes::IsCSSStyleValueLength(value); - case CSSSyntaxType::kInteger: - // TODO(andruud): Support rounding. - // https://drafts.css-houdini.org/css-typed-om-1/#numeric-objects - FALLTHROUGH; - case CSSSyntaxType::kNumber: - return CSSOMTypes::IsCSSStyleValueNumber(value); - case CSSSyntaxType::kPercentage: - return CSSOMTypes::IsCSSStyleValuePercentage(value); - case CSSSyntaxType::kLengthPercentage: - // TODO(andruud): Support calc(X% + Ypx). - return CSSOMTypes::IsCSSStyleValueLength(value) || - CSSOMTypes::IsCSSStyleValuePercentage(value); - case CSSSyntaxType::kColor: - // TODO(andruud): Support custom properties in CSSUnsupportedStyleValue. - return false; - case CSSSyntaxType::kImage: - case CSSSyntaxType::kUrl: - return value.GetType() == CSSStyleValue::kURLImageType; - case CSSSyntaxType::kAngle: - return CSSOMTypes::IsCSSStyleValueAngle(value); - case CSSSyntaxType::kTime: - return CSSOMTypes::IsCSSStyleValueTime(value); - case CSSSyntaxType::kResolution: - return CSSOMTypes::IsCSSStyleValueResolution(value); - case CSSSyntaxType::kTransformFunction: - // TODO(andruud): Currently not supported by Typed OM. - // https://github.com/w3c/css-houdini-drafts/issues/290 - // For now, this should accept a CSSUnsupportedStyleValue, such that - // <transform-function> values can be moved from one registered property - // to another. - // TODO(andruud): Support custom properties in CSSUnsupportedStyleValue. - return false; - case CSSSyntaxType::kTransformList: - return value.GetType() == CSSStyleValue::kTransformType; - case CSSSyntaxType::kCustomIdent: - return value.GetType() == CSSStyleValue::kKeywordType; - default: - return false; +const CSSSyntaxComponent* CSSSyntaxDescriptor::Match( + const CSSStyleValue& value) const { + for (const CSSSyntaxComponent& component : syntax_components_) { + if (component.CanTake(value)) + return &component; } + return nullptr; } bool CSSSyntaxDescriptor::CanTake(const CSSStyleValue& value) const { - for (const CSSSyntaxComponent& component : syntax_components_) { - if (component.CanTake(value)) - return true; - } - return false; + return Match(value); } const CSSValue* CSSSyntaxDescriptor::Parse(CSSParserTokenRange range, diff --git a/chromium/third_party/blink/renderer/core/css/css_syntax_descriptor.h b/chromium/third_party/blink/renderer/core/css/css_syntax_descriptor.h index ec88ced9391..e08b46ee86a 100644 --- a/chromium/third_party/blink/renderer/core/css/css_syntax_descriptor.h +++ b/chromium/third_party/blink/renderer/core/css/css_syntax_descriptor.h @@ -5,54 +5,14 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_SYNTAX_DESCRIPTOR_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_SYNTAX_DESCRIPTOR_H_ +#include "third_party/blink/renderer/core/css/css_syntax_component.h" #include "third_party/blink/renderer/core/css/parser/css_parser_token_range.h" namespace blink { class CSSParserContext; -class CSSStyleValue; class CSSValue; -enum class CSSSyntaxType { - kTokenStream, - kIdent, - kLength, - kNumber, - kPercentage, - kLengthPercentage, - kColor, - kImage, - kUrl, - kInteger, - kAngle, - kTime, - kResolution, - kTransformFunction, - kTransformList, - kCustomIdent, -}; - -enum class CSSSyntaxRepeat { kNone, kSpaceSeparated, kCommaSeparated }; - -struct CSSSyntaxComponent { - CSSSyntaxComponent(CSSSyntaxType type, - const String& string, - CSSSyntaxRepeat repeat) - : type_(type), string_(string), repeat_(repeat) {} - - bool operator==(const CSSSyntaxComponent& a) const { - return type_ == a.type_ && string_ == a.string_ && repeat_ == a.repeat_; - } - - bool IsRepeatable() const { return repeat_ != CSSSyntaxRepeat::kNone; } - - bool CanTake(const CSSStyleValue&) const; - - CSSSyntaxType type_; - String string_; // Only used when type_ is CSSSyntaxType::kIdent - CSSSyntaxRepeat repeat_; -}; - class CORE_EXPORT CSSSyntaxDescriptor { public: explicit CSSSyntaxDescriptor(const String& syntax); @@ -60,15 +20,16 @@ class CORE_EXPORT CSSSyntaxDescriptor { const CSSValue* Parse(CSSParserTokenRange, const CSSParserContext*, bool is_animation_tainted) const; + const CSSSyntaxComponent* Match(const CSSStyleValue&) const; bool CanTake(const CSSStyleValue&) const; bool IsValid() const { return !syntax_components_.IsEmpty(); } bool IsTokenStream() const { return syntax_components_.size() == 1 && - syntax_components_[0].type_ == CSSSyntaxType::kTokenStream; + syntax_components_[0].GetType() == CSSSyntaxType::kTokenStream; } bool HasUrlSyntax() const { for (const CSSSyntaxComponent& component : syntax_components_) { - if (component.type_ == CSSSyntaxType::kUrl) + if (component.GetType() == CSSSyntaxType::kUrl) return true; } return false; diff --git a/chromium/third_party/blink/renderer/core/css/css_test_helper.cc b/chromium/third_party/blink/renderer/core/css/css_test_helper.cc deleted file mode 100644 index 7a5acf84252..00000000000 --- a/chromium/third_party/blink/renderer/core/css/css_test_helper.cc +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2014, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Opera Software ASA nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "third_party/blink/renderer/core/css/css_test_helper.h" - -#include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/renderer/core/css/css_rule_list.h" -#include "third_party/blink/renderer/core/css/css_style_sheet.h" -#include "third_party/blink/renderer/core/css/rule_set.h" -#include "third_party/blink/renderer/core/css/style_sheet_contents.h" -#include "third_party/blink/renderer/core/dom/document.h" -#include "third_party/blink/renderer/platform/bindings/exception_state.h" -#include "third_party/blink/renderer/platform/wtf/text/text_encoding.h" - -namespace blink { - -CSSTestHelper::~CSSTestHelper() = default; - -CSSTestHelper::CSSTestHelper() { - document_ = Document::CreateForTest(); - TextPosition position; - style_sheet_ = CSSStyleSheet::CreateInline(*document_, NullURL(), position, - UTF8Encoding()); -} - -CSSRuleList* CSSTestHelper::CssRules() { - DummyExceptionStateForTesting exception_state; - CSSRuleList* result = style_sheet_->cssRules(exception_state); - EXPECT_FALSE(exception_state.HadException()); - return result; -} - -RuleSet& CSSTestHelper::GetRuleSet() { - RuleSet& rule_set = style_sheet_->Contents()->EnsureRuleSet( - MediaQueryEvaluator(), kRuleHasNoSpecialState); - rule_set.CompactRulesIfNeeded(); - return rule_set; -} - -void CSSTestHelper::AddCSSRules(const char* css_text, bool is_empty_sheet) { - TextPosition position; - unsigned sheet_length = style_sheet_->length(); - style_sheet_->Contents()->ParseStringAtPosition(css_text, position); - if (!is_empty_sheet) - ASSERT_GT(style_sheet_->length(), sheet_length); - else - ASSERT_EQ(style_sheet_->length(), sheet_length); -} - -} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/css_test_helper.h b/chromium/third_party/blink/renderer/core/css/css_test_helper.h deleted file mode 100644 index b64d3469b68..00000000000 --- a/chromium/third_party/blink/renderer/core/css/css_test_helper.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2014, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Opera Software ASA nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_TEST_HELPER_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_TEST_HELPER_H_ - -#include "base/memory/scoped_refptr.h" -#include "third_party/blink/renderer/core/css/rule_set.h" -#include "third_party/blink/renderer/platform/wtf/allocator.h" - -namespace blink { - -class Document; -class CSSStyleSheet; - -// A helper class for writing tests of CSS rules. Example usage: -// -// CSSTestHelper helper; -// helper.addCSSRule("body { color: red} #a { position: absolute }"); -// RuleSet& ruleSet = helper.ruleSet(); -// ... examine RuleSet to find the rule and test properties on it. - -class CSSTestHelper { - STACK_ALLOCATED(); - - public: - CSSTestHelper(); - ~CSSTestHelper(); - - const Document& GetDocument() { return *document_; }; - - void AddCSSRules(const char* rule_text, bool is_empty_sheet = false); - RuleSet& GetRuleSet(); - CSSRuleList* CssRules(); - - private: - Persistent<Document> document_; - Persistent<CSSStyleSheet> style_sheet_; -}; - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_TEST_HELPER_H_ diff --git a/chromium/third_party/blink/renderer/core/css/css_test_helpers.cc b/chromium/third_party/blink/renderer/core/css/css_test_helpers.cc new file mode 100644 index 00000000000..9b1fac6b088 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/css_test_helpers.cc @@ -0,0 +1,73 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/css_test_helpers.h" + +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/renderer/core/css/css_rule_list.h" +#include "third_party/blink/renderer/core/css/css_style_sheet.h" +#include "third_party/blink/renderer/core/css/property_descriptor.h" +#include "third_party/blink/renderer/core/css/property_registration.h" +#include "third_party/blink/renderer/core/css/property_registry.h" +#include "third_party/blink/renderer/core/css/rule_set.h" +#include "third_party/blink/renderer/core/css/style_sheet_contents.h" +#include "third_party/blink/renderer/core/dom/document.h" +#include "third_party/blink/renderer/core/testing/page_test_base.h" +#include "third_party/blink/renderer/platform/bindings/exception_state.h" +#include "third_party/blink/renderer/platform/wtf/text/text_encoding.h" + +namespace blink { +namespace css_test_helpers { + +TestStyleSheet::~TestStyleSheet() = default; + +TestStyleSheet::TestStyleSheet() { + document_ = Document::CreateForTest(); + TextPosition position; + style_sheet_ = CSSStyleSheet::CreateInline(*document_, NullURL(), position, + UTF8Encoding()); +} + +CSSRuleList* TestStyleSheet::CssRules() { + DummyExceptionStateForTesting exception_state; + CSSRuleList* result = style_sheet_->cssRules(exception_state); + EXPECT_FALSE(exception_state.HadException()); + return result; +} + +RuleSet& TestStyleSheet::GetRuleSet() { + RuleSet& rule_set = style_sheet_->Contents()->EnsureRuleSet( + MediaQueryEvaluator(), kRuleHasNoSpecialState); + rule_set.CompactRulesIfNeeded(); + return rule_set; +} + +void TestStyleSheet::AddCSSRules(const char* css_text, bool is_empty_sheet) { + TextPosition position; + unsigned sheet_length = style_sheet_->length(); + style_sheet_->Contents()->ParseStringAtPosition(css_text, position); + if (!is_empty_sheet) + ASSERT_GT(style_sheet_->length(), sheet_length); + else + ASSERT_EQ(style_sheet_->length(), sheet_length); +} + +void RegisterProperty(Document& document, + const String& name, + const String& syntax, + const String& initial_value, + bool is_inherited) { + DummyExceptionStateForTesting exception_state; + PropertyDescriptor* property_descriptor = PropertyDescriptor::Create(); + property_descriptor->setName(name); + property_descriptor->setSyntax(syntax); + property_descriptor->setInitialValue(initial_value); + property_descriptor->setInherits(is_inherited); + PropertyRegistration::registerProperty(&document, property_descriptor, + exception_state); + ASSERT_FALSE(exception_state.HadException()); +} + +} // namespace css_test_helpers +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/css_test_helpers.h b/chromium/third_party/blink/renderer/core/css/css_test_helpers.h new file mode 100644 index 00000000000..8d4e5b9bcee --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/css_test_helpers.h @@ -0,0 +1,52 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_TEST_HELPERS_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_TEST_HELPERS_H_ + +#include "base/memory/scoped_refptr.h" +#include "third_party/blink/renderer/core/css/rule_set.h" +#include "third_party/blink/renderer/platform/wtf/allocator.h" + +namespace blink { + +class Document; +class CSSStyleSheet; + +namespace css_test_helpers { + +// Example usage: +// +// css_test_helpers::TestStyleSheet sheet; +// sheet.addCSSRule("body { color: red} #a { position: absolute }"); +// RuleSet& ruleSet = sheet.ruleSet(); +// ... examine RuleSet to find the rule and test properties on it. +class TestStyleSheet { + STACK_ALLOCATED(); + + public: + TestStyleSheet(); + ~TestStyleSheet(); + + const Document& GetDocument() { return *document_; }; + + void AddCSSRules(const char* rule_text, bool is_empty_sheet = false); + RuleSet& GetRuleSet(); + CSSRuleList* CssRules(); + + private: + Persistent<Document> document_; + Persistent<CSSStyleSheet> style_sheet_; +}; + +void RegisterProperty(Document& document, + const String& name, + const String& syntax, + const String& initial_value, + bool is_inherited); + +} // namespace css_test_helpers +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_TEST_HELPERS_H_ diff --git a/chromium/third_party/blink/renderer/core/css/css_timing_function_value.h b/chromium/third_party/blink/renderer/core/css/css_timing_function_value.h index 3aa915fdd5c..3ded042f157 100644 --- a/chromium/third_party/blink/renderer/core/css/css_timing_function_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_timing_function_value.h @@ -40,9 +40,17 @@ class CSSCubicBezierTimingFunctionValue : public CSSValue { double y1, double x2, double y2) { - return new CSSCubicBezierTimingFunctionValue(x1, y1, x2, y2); + return MakeGarbageCollected<CSSCubicBezierTimingFunctionValue>(x1, y1, x2, + y2); } + CSSCubicBezierTimingFunctionValue(double x1, double y1, double x2, double y2) + : CSSValue(kCubicBezierTimingFunctionClass), + x1_(x1), + y1_(y1), + x2_(x2), + y2_(y2) {} + String CustomCSSText() const; double X1() const { return x1_; } @@ -57,13 +65,6 @@ class CSSCubicBezierTimingFunctionValue : public CSSValue { } private: - CSSCubicBezierTimingFunctionValue(double x1, double y1, double x2, double y2) - : CSSValue(kCubicBezierTimingFunctionClass), - x1_(x1), - y1_(y1), - x2_(x2), - y2_(y2) {} - double x1_; double y1_; double x2_; @@ -78,9 +79,16 @@ class CSSStepsTimingFunctionValue : public CSSValue { static CSSStepsTimingFunctionValue* Create( int steps, StepsTimingFunction::StepPosition step_position) { - return new CSSStepsTimingFunctionValue(steps, step_position); + return MakeGarbageCollected<CSSStepsTimingFunctionValue>(steps, + step_position); } + CSSStepsTimingFunctionValue(int steps, + StepsTimingFunction::StepPosition step_position) + : CSSValue(kStepsTimingFunctionClass), + steps_(steps), + step_position_(step_position) {} + int NumberOfSteps() const { return steps_; } StepsTimingFunction::StepPosition GetStepPosition() const { return step_position_; @@ -95,12 +103,6 @@ class CSSStepsTimingFunctionValue : public CSSValue { } private: - CSSStepsTimingFunctionValue(int steps, - StepsTimingFunction::StepPosition step_position) - : CSSValue(kStepsTimingFunctionClass), - steps_(steps), - step_position_(step_position) {} - int steps_; StepsTimingFunction::StepPosition step_position_; }; @@ -111,7 +113,12 @@ DEFINE_CSS_VALUE_TYPE_CASTS(CSSStepsTimingFunctionValue, class CSSFramesTimingFunctionValue : public CSSValue { public: static CSSFramesTimingFunctionValue* Create(int frames) { - return new CSSFramesTimingFunctionValue(frames); + return MakeGarbageCollected<CSSFramesTimingFunctionValue>(frames); + } + + CSSFramesTimingFunctionValue(int frames) + : CSSValue(kFramesTimingFunctionClass), frames_(frames) { + DCHECK(RuntimeEnabledFeatures::FramesTimingFunctionEnabled()); } int NumberOfFrames() const { return frames_; } @@ -125,11 +132,6 @@ class CSSFramesTimingFunctionValue : public CSSValue { } private: - CSSFramesTimingFunctionValue(int frames) - : CSSValue(kFramesTimingFunctionClass), frames_(frames) { - DCHECK(RuntimeEnabledFeatures::FramesTimingFunctionEnabled()); - } - int frames_; }; diff --git a/chromium/third_party/blink/renderer/core/css/css_unicode_range_value.h b/chromium/third_party/blink/renderer/core/css/css_unicode_range_value.h index 7562110314c..7057845a785 100644 --- a/chromium/third_party/blink/renderer/core/css/css_unicode_range_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_unicode_range_value.h @@ -34,9 +34,12 @@ namespace blink { class CSSUnicodeRangeValue : public CSSValue { public: static CSSUnicodeRangeValue* Create(UChar32 from, UChar32 to) { - return new CSSUnicodeRangeValue(from, to); + return MakeGarbageCollected<CSSUnicodeRangeValue>(from, to); } + CSSUnicodeRangeValue(UChar32 from, UChar32 to) + : CSSValue(kUnicodeRangeClass), from_(from), to_(to) {} + UChar32 From() const { return from_; } UChar32 To() const { return to_; } @@ -49,9 +52,6 @@ class CSSUnicodeRangeValue : public CSSValue { } private: - CSSUnicodeRangeValue(UChar32 from, UChar32 to) - : CSSValue(kUnicodeRangeClass), from_(from), to_(to) {} - UChar32 from_; UChar32 to_; }; diff --git a/chromium/third_party/blink/renderer/core/css/css_uri_value.cc b/chromium/third_party/blink/renderer/core/css/css_uri_value.cc index be594ae52e3..ef22d478644 100644 --- a/chromium/third_party/blink/renderer/core/css/css_uri_value.cc +++ b/chromium/third_party/blink/renderer/core/css/css_uri_value.cc @@ -25,7 +25,7 @@ CSSURIValue::~CSSURIValue() = default; SVGResource* CSSURIValue::EnsureResourceReference() const { if (!resource_) - resource_ = new ExternalSVGResource(AbsoluteUrl()); + resource_ = MakeGarbageCollected<ExternalSVGResource>(AbsoluteUrl()); return resource_; } diff --git a/chromium/third_party/blink/renderer/core/css/css_uri_value.h b/chromium/third_party/blink/renderer/core/css/css_uri_value.h index 57b4519d0bb..2f0ea52240d 100644 --- a/chromium/third_party/blink/renderer/core/css/css_uri_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_uri_value.h @@ -17,11 +17,15 @@ class SVGResource; class CSSURIValue : public CSSValue { public: static CSSURIValue* Create(const String& relative_url, const KURL& url) { - return new CSSURIValue(AtomicString(relative_url), url); + return MakeGarbageCollected<CSSURIValue>(AtomicString(relative_url), url); } static CSSURIValue* Create(const AtomicString& absolute_url) { - return new CSSURIValue(absolute_url, absolute_url); + return MakeGarbageCollected<CSSURIValue>(absolute_url, absolute_url); } + + CSSURIValue(const AtomicString&, const KURL&); + CSSURIValue(const AtomicString& relative_url, + const AtomicString& absolute_url); ~CSSURIValue(); SVGResource* EnsureResourceReference() const; @@ -41,10 +45,6 @@ class CSSURIValue : public CSSValue { void TraceAfterDispatch(blink::Visitor*); private: - CSSURIValue(const AtomicString&, const KURL&); - CSSURIValue(const AtomicString& relative_url, - const AtomicString& absolute_url); - KURL AbsoluteUrl() const; AtomicString relative_url_; diff --git a/chromium/third_party/blink/renderer/core/css/css_value.cc b/chromium/third_party/blink/renderer/core/css/css_value.cc index d7a9cc8b282..e00e74ec82f 100644 --- a/chromium/third_party/blink/renderer/core/css/css_value.cc +++ b/chromium/third_party/blink/renderer/core/css/css_value.cc @@ -50,6 +50,7 @@ #include "third_party/blink/renderer/core/css/css_image_value.h" #include "third_party/blink/renderer/core/css/css_inherited_value.h" #include "third_party/blink/renderer/core/css/css_initial_value.h" +#include "third_party/blink/renderer/core/css/css_invalid_variable_value.h" #include "third_party/blink/renderer/core/css/css_layout_function_value.h" #include "third_party/blink/renderer/core/css/css_paint_value.h" #include "third_party/blink/renderer/core/css/css_path_value.h" @@ -67,7 +68,7 @@ #include "third_party/blink/renderer/core/css/css_value_list.h" #include "third_party/blink/renderer/core/css/css_value_pair.h" #include "third_party/blink/renderer/core/css/css_variable_reference_value.h" -#include "third_party/blink/renderer/platform/length.h" +#include "third_party/blink/renderer/platform/geometry/length.h" #include "third_party/blink/renderer/platform/wtf/size_assertions.h" namespace blink { @@ -246,6 +247,8 @@ bool CSSValue::operator==(const CSSValue& other) const { return CompareCSSValues<CSSVariableReferenceValue>(*this, other); case kPendingSubstitutionValueClass: return CompareCSSValues<CSSPendingSubstitutionValue>(*this, other); + case kInvalidVariableValueClass: + return CompareCSSValues<CSSInvalidVariableValue>(*this, other); } NOTREACHED(); return false; @@ -351,6 +354,8 @@ String CSSValue::CssText() const { return ToCSSCustomPropertyDeclaration(this)->CustomCSSText(); case kPendingSubstitutionValueClass: return ToCSSPendingSubstitutionValue(this)->CustomCSSText(); + case kInvalidVariableValueClass: + return ToCSSInvalidVariableValue(this)->CustomCSSText(); } NOTREACHED(); return String(); @@ -503,6 +508,9 @@ void CSSValue::FinalizeGarbageCollectedObject() { case kPendingSubstitutionValueClass: ToCSSPendingSubstitutionValue(this)->~CSSPendingSubstitutionValue(); return; + case kInvalidVariableValueClass: + ToCSSInvalidVariableValue(this)->~CSSInvalidVariableValue(); + return; } NOTREACHED(); } @@ -653,6 +661,9 @@ void CSSValue::Trace(blink::Visitor* visitor) { case kPendingSubstitutionValueClass: ToCSSPendingSubstitutionValue(this)->TraceAfterDispatch(visitor); return; + case kInvalidVariableValueClass: + ToCSSInvalidVariableValue(this)->TraceAfterDispatch(visitor); + return; } NOTREACHED(); } diff --git a/chromium/third_party/blink/renderer/core/css/css_value.h b/chromium/third_party/blink/renderer/core/css/css_value.h index 84b6e122740..e1bd04894f7 100644 --- a/chromium/third_party/blink/renderer/core/css/css_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_value.h @@ -161,6 +161,9 @@ class CORE_EXPORT CSSValue : public GarbageCollectedFinalized<CSSValue> { bool IsPendingSubstitutionValue() const { return class_type_ == kPendingSubstitutionValueClass; } + bool IsInvalidVariableValue() const { + return class_type_ == kInvalidVariableValueClass; + } bool HasFailedOrCanceledSubresources() const; bool MayContainUrl() const; @@ -235,6 +238,7 @@ class CORE_EXPORT CSSValue : public GarbageCollectedFinalized<CSSValue> { kVariableReferenceClass, kCustomPropertyDeclarationClass, kPendingSubstitutionValueClass, + kInvalidVariableValueClass, kLayoutFunctionClass, kCSSContentDistributionClass, diff --git a/chromium/third_party/blink/renderer/core/css/css_value_id_mappings.h b/chromium/third_party/blink/renderer/core/css/css_value_id_mappings.h index 6185d2ff0bb..e4008a50463 100644 --- a/chromium/third_party/blink/renderer/core/css/css_value_id_mappings.h +++ b/chromium/third_party/blink/renderer/core/css/css_value_id_mappings.h @@ -5,7 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_VALUE_ID_MAPPINGS_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_VALUE_ID_MAPPINGS_H_ -#include "third_party/blink/renderer/core/css_value_id_mappings_generated.h" +#include "third_party/blink/renderer/core/css/css_value_id_mappings_generated.h" namespace blink { diff --git a/chromium/third_party/blink/renderer/core/css/css_value_keywords.json5 b/chromium/third_party/blink/renderer/core/css/css_value_keywords.json5 index b944b4c8ef4..6967328735d 100644 --- a/chromium/third_party/blink/renderer/core/css/css_value_keywords.json5 +++ b/chromium/third_party/blink/renderer/core/css/css_value_keywords.json5 @@ -797,9 +797,9 @@ // // pointer-events // - "visiblePainted", - "visibleFill", - "visibleStroke", + "visiblepainted", + "visiblefill", + "visiblestroke", //visible "painted", "fill", diff --git a/chromium/third_party/blink/renderer/core/css/css_value_list.h b/chromium/third_party/blink/renderer/core/css/css_value_list.h index 085c2021f45..090786ffa73 100644 --- a/chromium/third_party/blink/renderer/core/css/css_value_list.h +++ b/chromium/third_party/blink/renderer/core/css/css_value_list.h @@ -36,19 +36,22 @@ class CORE_EXPORT CSSValueList : public CSSValue { using const_iterator = HeapVector<Member<const CSSValue>, 4>::const_iterator; static CSSValueList* CreateCommaSeparated() { - return new CSSValueList(kCommaSeparator); + return MakeGarbageCollected<CSSValueList>(kCommaSeparator); } static CSSValueList* CreateSpaceSeparated() { - return new CSSValueList(kSpaceSeparator); + return MakeGarbageCollected<CSSValueList>(kSpaceSeparator); } static CSSValueList* CreateSlashSeparated() { - return new CSSValueList(kSlashSeparator); + return MakeGarbageCollected<CSSValueList>(kSlashSeparator); } static CSSValueList* CreateWithSeparatorFrom(const CSSValueList& list) { - return new CSSValueList( + return MakeGarbageCollected<CSSValueList>( static_cast<ValueListSeparator>(list.value_list_separator_)); } + CSSValueList(ClassType, ValueListSeparator); + explicit CSSValueList(ValueListSeparator); + iterator begin() { return values_.begin(); } iterator end() { return values_.end(); } const_iterator begin() const { return values_.begin(); } @@ -72,12 +75,7 @@ class CORE_EXPORT CSSValueList : public CSSValue { void TraceAfterDispatch(blink::Visitor*); - protected: - CSSValueList(ClassType, ValueListSeparator); - private: - explicit CSSValueList(ValueListSeparator); - HeapVector<Member<const CSSValue>, 4> values_; DISALLOW_COPY_AND_ASSIGN(CSSValueList); }; diff --git a/chromium/third_party/blink/renderer/core/css/css_value_pair.h b/chromium/third_party/blink/renderer/core/css/css_value_pair.h index 211ec99feb6..92312f72ffb 100644 --- a/chromium/third_party/blink/renderer/core/css/css_value_pair.h +++ b/chromium/third_party/blink/renderer/core/css/css_value_pair.h @@ -34,7 +34,19 @@ class CORE_EXPORT CSSValuePair : public CSSValue { static CSSValuePair* Create(const CSSValue* first, const CSSValue* second, IdenticalValuesPolicy identical_values_policy) { - return new CSSValuePair(first, second, identical_values_policy); + return MakeGarbageCollected<CSSValuePair>(first, second, + identical_values_policy); + } + + CSSValuePair(const CSSValue* first, + const CSSValue* second, + IdenticalValuesPolicy identical_values_policy) + : CSSValue(kValuePairClass), + first_(first), + second_(second), + identical_values_policy_(identical_values_policy) { + DCHECK(first_); + DCHECK(second_); } const CSSValue& First() const { return *first_; } @@ -61,17 +73,6 @@ class CORE_EXPORT CSSValuePair : public CSSValue { void TraceAfterDispatch(blink::Visitor*); private: - CSSValuePair(const CSSValue* first, - const CSSValue* second, - IdenticalValuesPolicy identical_values_policy) - : CSSValue(kValuePairClass), - first_(first), - second_(second), - identical_values_policy_(identical_values_policy) { - DCHECK(first_); - DCHECK(second_); - } - Member<const CSSValue> first_; Member<const CSSValue> second_; IdenticalValuesPolicy identical_values_policy_; diff --git a/chromium/third_party/blink/renderer/core/css/css_value_pool.cc b/chromium/third_party/blink/renderer/core/css/css_value_pool.cc index 147ed0eb85d..7d8e1ecde74 100644 --- a/chromium/third_party/blink/renderer/core/css/css_value_pool.cc +++ b/chromium/third_party/blink/renderer/core/css/css_value_pool.cc @@ -37,7 +37,7 @@ CSSValuePool& CssValuePool() { thread_specific_pool, ()); Persistent<CSSValuePool>& pool_handle = *thread_specific_pool; if (!pool_handle) { - pool_handle = new CSSValuePool; + pool_handle = MakeGarbageCollected<CSSValuePool>(); pool_handle.RegisterAsStaticReference(); } return *pool_handle; @@ -45,11 +45,13 @@ CSSValuePool& CssValuePool() { CSSValuePool::CSSValuePool() : inherited_value_(new CSSInheritedValue), - initial_value_(new CSSInitialValue()), + initial_value_(MakeGarbageCollected<CSSInitialValue>()), unset_value_(new CSSUnsetValue), - color_transparent_(new CSSColorValue(Color::kTransparent)), - color_white_(new CSSColorValue(Color::kWhite)), - color_black_(new CSSColorValue(Color::kBlack)) { + invalid_variable_value_(new CSSInvalidVariableValue), + color_transparent_( + MakeGarbageCollected<CSSColorValue>(Color::kTransparent)), + color_white_(MakeGarbageCollected<CSSColorValue>(Color::kWhite)), + color_black_(MakeGarbageCollected<CSSColorValue>(Color::kBlack)) { identifier_value_cache_.resize(numCSSValueKeywords); pixel_value_cache_.resize(kMaximumCacheableIntegerValue + 1); percent_value_cache_.resize(kMaximumCacheableIntegerValue + 1); @@ -60,6 +62,7 @@ void CSSValuePool::Trace(blink::Visitor* visitor) { visitor->Trace(inherited_value_); visitor->Trace(initial_value_); visitor->Trace(unset_value_); + visitor->Trace(invalid_variable_value_); visitor->Trace(color_transparent_); visitor->Trace(color_white_); visitor->Trace(color_black_); diff --git a/chromium/third_party/blink/renderer/core/css/css_value_pool.h b/chromium/third_party/blink/renderer/core/css/css_value_pool.h index ecfe36cddba..b0ad715acf8 100644 --- a/chromium/third_party/blink/renderer/core/css/css_value_pool.h +++ b/chromium/third_party/blink/renderer/core/css/css_value_pool.h @@ -35,10 +35,11 @@ #include "third_party/blink/renderer/core/css/css_identifier_value.h" #include "third_party/blink/renderer/core/css/css_inherited_value.h" #include "third_party/blink/renderer/core/css/css_initial_value.h" +#include "third_party/blink/renderer/core/css/css_invalid_variable_value.h" #include "third_party/blink/renderer/core/css/css_primitive_value.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/css_unset_value.h" #include "third_party/blink/renderer/core/css/css_value_list.h" -#include "third_party/blink/renderer/core/css_property_names.h" #include "third_party/blink/renderer/core/css_value_keywords.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string_hash.h" @@ -60,6 +61,8 @@ class CORE_EXPORT CSSValuePool static const unsigned kMaximumFontFaceCacheSize = 128; using FontFamilyValueCache = HeapHashMap<String, Member<CSSFontFamilyValue>>; + CSSValuePool(); + // Cached individual values. CSSColorValue* TransparentColor() { return color_transparent_; } CSSColorValue* WhiteColor() { return color_white_; } @@ -67,6 +70,9 @@ class CORE_EXPORT CSSValuePool CSSInheritedValue* InheritedValue() { return inherited_value_; } CSSInitialValue* InitialValue() { return initial_value_; } CSSUnsetValue* UnsetValue() { return unset_value_; } + CSSInvalidVariableValue* InvalidVariableValue() { + return invalid_variable_value_; + } // Vector caches. CSSIdentifierValue* IdentifierCacheValue(CSSValueID ident) { @@ -120,12 +126,11 @@ class CORE_EXPORT CSSValuePool void Trace(blink::Visitor*); private: - CSSValuePool(); - // Cached individual values. Member<CSSInheritedValue> inherited_value_; Member<CSSInitialValue> initial_value_; Member<CSSUnsetValue> unset_value_; + Member<CSSInvalidVariableValue> invalid_variable_value_; Member<CSSColorValue> color_transparent_; Member<CSSColorValue> color_white_; Member<CSSColorValue> color_black_; diff --git a/chromium/third_party/blink/renderer/core/css/css_variable_reference_value.h b/chromium/third_party/blink/renderer/core/css/css_variable_reference_value.h index b79c7e4e4e4..278f07d6f65 100644 --- a/chromium/third_party/blink/renderer/core/css/css_variable_reference_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_variable_reference_value.h @@ -16,13 +16,25 @@ class CSSVariableReferenceValue : public CSSValue { public: static CSSVariableReferenceValue* Create( scoped_refptr<CSSVariableData> data) { - return new CSSVariableReferenceValue(std::move(data)); + return MakeGarbageCollected<CSSVariableReferenceValue>(std::move(data)); } static CSSVariableReferenceValue* Create(scoped_refptr<CSSVariableData> data, const CSSParserContext& context) { - return new CSSVariableReferenceValue(std::move(data), context); + return MakeGarbageCollected<CSSVariableReferenceValue>(std::move(data), + context); } + CSSVariableReferenceValue(scoped_refptr<CSSVariableData> data) + : CSSValue(kVariableReferenceClass), + data_(std::move(data)), + parser_context_(nullptr) {} + + CSSVariableReferenceValue(scoped_refptr<CSSVariableData> data, + const CSSParserContext& context) + : CSSValue(kVariableReferenceClass), + data_(std::move(data)), + parser_context_(context) {} + CSSVariableData* VariableDataValue() const { return data_.get(); } const CSSParserContext* ParserContext() const { DCHECK(parser_context_); @@ -37,18 +49,6 @@ class CSSVariableReferenceValue : public CSSValue { void TraceAfterDispatch(blink::Visitor*); private: - CSSVariableReferenceValue(scoped_refptr<CSSVariableData> data) - : CSSValue(kVariableReferenceClass), - data_(std::move(data)), - parser_context_(nullptr) {} - - CSSVariableReferenceValue(scoped_refptr<CSSVariableData> data, - const CSSParserContext& context) - : CSSValue(kVariableReferenceClass), - data_(std::move(data)), - parser_context_(context) { - } - scoped_refptr<CSSVariableData> data_; Member<const CSSParserContext> parser_context_; }; diff --git a/chromium/third_party/blink/renderer/core/css/css_viewport_rule.h b/chromium/third_party/blink/renderer/core/css/css_viewport_rule.h index ec49f61f634..4ed4ce89d57 100644 --- a/chromium/third_party/blink/renderer/core/css/css_viewport_rule.h +++ b/chromium/third_party/blink/renderer/core/css/css_viewport_rule.h @@ -46,8 +46,10 @@ class CSSViewportRule final : public CSSRule { public: static CSSViewportRule* Create(StyleRuleViewport* viewport_rule, CSSStyleSheet* sheet) { - return new CSSViewportRule(viewport_rule, sheet); + return MakeGarbageCollected<CSSViewportRule>(viewport_rule, sheet); } + + CSSViewportRule(StyleRuleViewport*, CSSStyleSheet*); ~CSSViewportRule() override; String cssText() const override; @@ -58,8 +60,6 @@ class CSSViewportRule final : public CSSRule { void Trace(blink::Visitor*) override; private: - CSSViewportRule(StyleRuleViewport*, CSSStyleSheet*); - CSSRule::Type type() const override { return kViewportRule; } Member<StyleRuleViewport> viewport_rule_; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/computed_style_property_map.cc b/chromium/third_party/blink/renderer/core/css/cssom/computed_style_property_map.cc index 16d58911f2d..e7c767f2c26 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/computed_style_property_map.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/computed_style_property_map.cc @@ -9,6 +9,7 @@ #include "third_party/blink/renderer/core/css/css_function_value.h" #include "third_party/blink/renderer/core/css/css_identifier_value.h" #include "third_party/blink/renderer/core/css/css_variable_data.h" +#include "third_party/blink/renderer/core/css/properties/css_property_ref.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/pseudo_element.h" #include "third_party/blink/renderer/core/style/computed_style.h" @@ -234,7 +235,8 @@ const CSSValue* ComputedStylePropertyMap::GetProperty( default: return CSSProperty::Get(property_id) .CSSValueFromComputedStyle(*style, nullptr /* layout_object */, - StyledNode(), false); + StyledNode(), + false /* allow_visited_style */); } } @@ -243,8 +245,10 @@ const CSSValue* ComputedStylePropertyMap::GetCustomProperty( const ComputedStyle* style = UpdateStyle(); if (!style) return nullptr; - return ComputedStyleCSSValueMapping::Get( - property_name, *style, node_->GetDocument().GetPropertyRegistry()); + CSSPropertyRef ref(property_name, node_->GetDocument()); + return ref.GetProperty().CSSValueFromComputedStyle( + *style, nullptr /* layout_object */, StyledNode(), + false /* allow_visited_style */); } void ComputedStylePropertyMap::ForEachProperty( diff --git a/chromium/third_party/blink/renderer/core/css/cssom/computed_style_property_map.h b/chromium/third_party/blink/renderer/core/css/cssom/computed_style_property_map.h index 4c517e14fbb..9fa239bacc2 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/computed_style_property_map.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/computed_style_property_map.h @@ -8,7 +8,7 @@ #include "base/macros.h" #include "third_party/blink/renderer/core/css/css_computed_style_declaration.h" #include "third_party/blink/renderer/core/css/css_selector.h" -#include "third_party/blink/renderer/core/css/cssom/style_property_map_read_only.h" +#include "third_party/blink/renderer/core/css/cssom/style_property_map_read_only_main_thread.h" #include "third_party/blink/renderer/core/dom/node.h" namespace blink { @@ -17,11 +17,13 @@ namespace blink { // API. The specification is here: // https://drafts.css-houdini.org/css-typed-om/#computed-StylePropertyMapReadOnly-objects // -// The computed StylePropertyMapReadOnly retrieves computed styles and returns -// them as CSSStyleValues. The IDL for this class is in StylePropertyMap.idl. -// The computed StylePropertyMapReadOnly for an element is accessed via -// element.computedStyleMap() (see ElementComputedStyleMap.idl/h) -class CORE_EXPORT ComputedStylePropertyMap : public StylePropertyMapReadOnly { +// The computed StylePropertyMapReadOnlyMainThread retrieves computed styles and +// returns them as CSSStyleValues. The IDL for this class is in +// StylePropertyMap.idl. The computed StylePropertyMapReadOnlyMainThread for an +// element is accessed via element.computedStyleMap() (see +// ElementComputedStyleMap.idl/h) +class CORE_EXPORT ComputedStylePropertyMap + : public StylePropertyMapReadOnlyMainThread { public: static ComputedStylePropertyMap* Create(Node* node) { return new ComputedStylePropertyMap(node); @@ -29,7 +31,7 @@ class CORE_EXPORT ComputedStylePropertyMap : public StylePropertyMapReadOnly { void Trace(blink::Visitor* visitor) override { visitor->Trace(node_); - StylePropertyMapReadOnly::Trace(visitor); + StylePropertyMapReadOnlyMainThread::Trace(visitor); } unsigned int size() override; @@ -41,7 +43,7 @@ class CORE_EXPORT ComputedStylePropertyMap : public StylePropertyMapReadOnly { protected: ComputedStylePropertyMap(Node* node, const String& pseudo_element = String()) - : StylePropertyMapReadOnly(), + : StylePropertyMapReadOnlyMainThread(), pseudo_id_(CSSSelector::ParsePseudoId(pseudo_element)), node_(node) {} diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_keyword_value.cc b/chromium/third_party/blink/renderer/core/css/cssom/css_keyword_value.cc index b23b9d6e813..a1de447a133 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_keyword_value.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_keyword_value.cc @@ -22,18 +22,18 @@ CSSKeywordValue* CSSKeywordValue::Create(const String& keyword, "CSSKeywordValue does not support empty strings"); return nullptr; } - return new CSSKeywordValue(keyword); + return MakeGarbageCollected<CSSKeywordValue>(keyword); } CSSKeywordValue* CSSKeywordValue::FromCSSValue(const CSSValue& value) { if (value.IsInheritedValue()) - return new CSSKeywordValue(getValueName(CSSValueInherit)); + return MakeGarbageCollected<CSSKeywordValue>(getValueName(CSSValueInherit)); if (value.IsInitialValue()) - return new CSSKeywordValue(getValueName(CSSValueInitial)); + return MakeGarbageCollected<CSSKeywordValue>(getValueName(CSSValueInitial)); if (value.IsUnsetValue()) - return new CSSKeywordValue(getValueName(CSSValueUnset)); + return MakeGarbageCollected<CSSKeywordValue>(getValueName(CSSValueUnset)); if (value.IsIdentifierValue()) { - return new CSSKeywordValue( + return MakeGarbageCollected<CSSKeywordValue>( getValueName(ToCSSIdentifierValue(value).GetValueID())); } if (value.IsCustomIdentValue()) { @@ -43,7 +43,7 @@ CSSKeywordValue* CSSKeywordValue::FromCSSValue(const CSSValue& value) { // CSSKeywordValue represents a RHS. return nullptr; } - return new CSSKeywordValue(ident_value.Value()); + return MakeGarbageCollected<CSSKeywordValue>(ident_value.Value()); } NOTREACHED(); return nullptr; @@ -51,7 +51,7 @@ CSSKeywordValue* CSSKeywordValue::FromCSSValue(const CSSValue& value) { CSSKeywordValue* CSSKeywordValue::Create(const String& keyword) { DCHECK(!keyword.IsEmpty()); - return new CSSKeywordValue(keyword); + return MakeGarbageCollected<CSSKeywordValue>(keyword); } const String& CSSKeywordValue::value() const { diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_keyword_value.h b/chromium/third_party/blink/renderer/core/css/cssom/css_keyword_value.h index 8ecb9824756..77acd90166e 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_keyword_value.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_keyword_value.h @@ -22,6 +22,8 @@ class CORE_EXPORT CSSKeywordValue final : public CSSStyleValue { static CSSKeywordValue* Create(const String& keyword, ExceptionState&); static CSSKeywordValue* FromCSSValue(const CSSValue&); + explicit CSSKeywordValue(const String& keyword) : keyword_value_(keyword) {} + StyleValueType GetType() const override { return kKeywordType; } const String& value() const; @@ -31,8 +33,6 @@ class CORE_EXPORT CSSKeywordValue final : public CSSStyleValue { const CSSValue* ToCSSValue() const override; private: - explicit CSSKeywordValue(const String& keyword) : keyword_value_(keyword) {} - String keyword_value_; DISALLOW_COPY_AND_ASSIGN(CSSKeywordValue); }; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_math_invert.h b/chromium/third_party/blink/renderer/core/css/cssom/css_math_invert.h index 2d164c6d2e1..134df106c0d 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_math_invert.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_math_invert.h @@ -22,10 +22,13 @@ class CORE_EXPORT CSSMathInvert : public CSSMathValue { } // Blink-internal constructor static CSSMathInvert* Create(CSSNumericValue* value) { - return new CSSMathInvert( + return MakeGarbageCollected<CSSMathInvert>( value, CSSNumericValueType::NegateExponents(value->Type())); } + CSSMathInvert(CSSNumericValue* value, const CSSNumericValueType& type) + : CSSMathValue(type), value_(value) {} + String getOperator() const final { return "invert"; } void value(CSSNumberish& value) { value.SetCSSNumericValue(value_); } @@ -56,9 +59,6 @@ class CORE_EXPORT CSSMathInvert : public CSSMathValue { } private: - CSSMathInvert(CSSNumericValue* value, const CSSNumericValueType& type) - : CSSMathValue(type), value_(value) {} - // From CSSNumericValue CSSNumericValue* Invert() final { return value_.Get(); } base::Optional<CSSNumericSumValue> SumValue() const final; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_math_max.cc b/chromium/third_party/blink/renderer/core/css/cssom/css_math_max.cc index afad8017ee3..07986816d82 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_math_max.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_math_max.cc @@ -31,8 +31,8 @@ CSSMathMax* CSSMathMax::Create(CSSNumericValueVector values) { CSSNumericValueType final_type = CSSMathVariadic::TypeCheck(values, CSSNumericValueType::Add, error); return error ? nullptr - : new CSSMathMax(CSSNumericArray::Create(std::move(values)), - final_type); + : MakeGarbageCollected<CSSMathMax>( + CSSNumericArray::Create(std::move(values)), final_type); } base::Optional<CSSNumericSumValue> CSSMathMax::SumValue() const { diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_math_max.h b/chromium/third_party/blink/renderer/core/css/cssom/css_math_max.h index 7643359418e..c307520d1ee 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_math_max.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_math_max.h @@ -22,6 +22,9 @@ class CORE_EXPORT CSSMathMax final : public CSSMathVariadic { // Blink-internal constructor. static CSSMathMax* Create(CSSNumericValueVector); + CSSMathMax(CSSNumericArray* values, const CSSNumericValueType& type) + : CSSMathVariadic(values, type) {} + String getOperator() const final { return "max"; } // From CSSStyleValue. @@ -33,9 +36,6 @@ class CORE_EXPORT CSSMathMax final : public CSSMathVariadic { } private: - CSSMathMax(CSSNumericArray* values, const CSSNumericValueType& type) - : CSSMathVariadic(values, type) {} - void BuildCSSText(Nested, ParenLess, StringBuilder&) const final; base::Optional<CSSNumericSumValue> SumValue() const final; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_math_min.cc b/chromium/third_party/blink/renderer/core/css/cssom/css_math_min.cc index 49afba461d3..93cf2c90e64 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_math_min.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_math_min.cc @@ -31,8 +31,8 @@ CSSMathMin* CSSMathMin::Create(CSSNumericValueVector values) { CSSNumericValueType final_type = CSSMathVariadic::TypeCheck(values, CSSNumericValueType::Add, error); return error ? nullptr - : new CSSMathMin(CSSNumericArray::Create(std::move(values)), - final_type); + : MakeGarbageCollected<CSSMathMin>( + CSSNumericArray::Create(std::move(values)), final_type); } base::Optional<CSSNumericSumValue> CSSMathMin::SumValue() const { diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_math_min.h b/chromium/third_party/blink/renderer/core/css/cssom/css_math_min.h index 7edde5b0f85..6f7dbdb6b6e 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_math_min.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_math_min.h @@ -24,6 +24,9 @@ class CORE_EXPORT CSSMathMin final : public CSSMathVariadic { // Blink-internal constructor. static CSSMathMin* Create(CSSNumericValueVector); + CSSMathMin(CSSNumericArray* values, const CSSNumericValueType& type) + : CSSMathVariadic(values, type) {} + String getOperator() const final { return "min"; } // From CSSStyleValue. @@ -35,9 +38,6 @@ class CORE_EXPORT CSSMathMin final : public CSSMathVariadic { } private: - CSSMathMin(CSSNumericArray* values, const CSSNumericValueType& type) - : CSSMathVariadic(values, type) {} - void BuildCSSText(Nested, ParenLess, StringBuilder&) const final; base::Optional<CSSNumericSumValue> SumValue() const final; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_math_negate.h b/chromium/third_party/blink/renderer/core/css/cssom/css_math_negate.h index 56201d2614f..b80022290f5 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_math_negate.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_math_negate.h @@ -22,9 +22,12 @@ class CORE_EXPORT CSSMathNegate : public CSSMathValue { } // Blink-internal constructor static CSSMathNegate* Create(CSSNumericValue* value) { - return new CSSMathNegate(value, value->Type()); + return MakeGarbageCollected<CSSMathNegate>(value, value->Type()); } + CSSMathNegate(CSSNumericValue* value, const CSSNumericValueType& type) + : CSSMathValue(type), value_(value) {} + String getOperator() const final { return "negate"; } void value(CSSNumberish& value) { value.SetCSSNumericValue(value_); } @@ -55,9 +58,6 @@ class CORE_EXPORT CSSMathNegate : public CSSMathValue { } private: - CSSMathNegate(CSSNumericValue* value, const CSSNumericValueType& type) - : CSSMathValue(type), value_(value) {} - // From CSSNumericValue CSSNumericValue* Negate() final { return value_.Get(); } base::Optional<CSSNumericSumValue> SumValue() const final; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_math_product.cc b/chromium/third_party/blink/renderer/core/css/cssom/css_math_product.cc index 88a6435c7dd..f38e313c93d 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_math_product.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_math_product.cc @@ -53,8 +53,8 @@ CSSMathProduct* CSSMathProduct::Create(CSSNumericValueVector values) { CSSNumericValueType final_type = CSSMathVariadic::TypeCheck(values, CSSNumericValueType::Multiply, error); return error ? nullptr - : new CSSMathProduct(CSSNumericArray::Create(std::move(values)), - final_type); + : MakeGarbageCollected<CSSMathProduct>( + CSSNumericArray::Create(std::move(values)), final_type); } base::Optional<CSSNumericSumValue> CSSMathProduct::SumValue() const { diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_math_product.h b/chromium/third_party/blink/renderer/core/css/cssom/css_math_product.h index 3fa5ced14b4..f0b32102198 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_math_product.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_math_product.h @@ -22,6 +22,9 @@ class CORE_EXPORT CSSMathProduct final : public CSSMathVariadic { // Blink internal-constructor. static CSSMathProduct* Create(CSSNumericValueVector); + CSSMathProduct(CSSNumericArray* values, const CSSNumericValueType& type) + : CSSMathVariadic(values, type) {} + String getOperator() const final { return "product"; } // From CSSStyleValue. @@ -30,9 +33,6 @@ class CORE_EXPORT CSSMathProduct final : public CSSMathVariadic { CSSCalcExpressionNode* ToCalcExpressionNode() const final; private: - CSSMathProduct(CSSNumericArray* values, const CSSNumericValueType& type) - : CSSMathVariadic(values, type) {} - void BuildCSSText(Nested, ParenLess, StringBuilder&) const final; base::Optional<CSSNumericSumValue> SumValue() const final; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_math_sum.cc b/chromium/third_party/blink/renderer/core/css/cssom/css_math_sum.cc index b468e1d776f..a69b0904610 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_math_sum.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_math_sum.cc @@ -71,8 +71,8 @@ CSSMathSum* CSSMathSum::Create(CSSNumericValueVector values) { CSSNumericValueType final_type = CSSMathVariadic::TypeCheck(values, CSSNumericValueType::Add, error); return error ? nullptr - : new CSSMathSum(CSSNumericArray::Create(std::move(values)), - final_type); + : MakeGarbageCollected<CSSMathSum>( + CSSNumericArray::Create(std::move(values)), final_type); } base::Optional<CSSNumericSumValue> CSSMathSum::SumValue() const { diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_math_sum.h b/chromium/third_party/blink/renderer/core/css/cssom/css_math_sum.h index 69398350506..0ff1d04455b 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_math_sum.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_math_sum.h @@ -22,6 +22,9 @@ class CORE_EXPORT CSSMathSum final : public CSSMathVariadic { // Blink-internal constructor. static CSSMathSum* Create(CSSNumericValueVector); + CSSMathSum(CSSNumericArray* values, const CSSNumericValueType& type) + : CSSMathVariadic(values, type) {} + String getOperator() const final { return "sum"; } // From CSSStyleValue. @@ -30,9 +33,6 @@ class CORE_EXPORT CSSMathSum final : public CSSMathVariadic { CSSCalcExpressionNode* ToCalcExpressionNode() const final; private: - CSSMathSum(CSSNumericArray* values, const CSSNumericValueType& type) - : CSSMathVariadic(values, type) {} - void BuildCSSText(Nested, ParenLess, StringBuilder&) const final; base::Optional<CSSNumericSumValue> SumValue() const final; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_matrix_component.cc b/chromium/third_party/blink/renderer/core/css/cssom/css_matrix_component.cc index 29b3b6b6eff..568cfb74e25 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_matrix_component.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_matrix_component.cc @@ -28,9 +28,9 @@ DOMMatrix* To2DMatrix(DOMMatrixReadOnly* matrix) { CSSMatrixComponent* CSSMatrixComponent::Create( DOMMatrixReadOnly* matrix, - const CSSMatrixComponentOptions& options) { - return new CSSMatrixComponent( - matrix, options.hasIs2D() ? options.is2D() : matrix->is2D()); + const CSSMatrixComponentOptions* options) { + return MakeGarbageCollected<CSSMatrixComponent>( + matrix, options->hasIs2D() ? options->is2D() : matrix->is2D()); } DOMMatrix* CSSMatrixComponent::toMatrix(ExceptionState&) const { @@ -47,7 +47,7 @@ CSSMatrixComponent* CSSMatrixComponent::FromCSSValue( return CSSMatrixComponent::Create( DOMMatrixReadOnly::CreateForSerialization(entries.data(), entries.size()), - CSSMatrixComponentOptions()); + CSSMatrixComponentOptions::Create()); } const CSSFunctionValue* CSSMatrixComponent::ToCSSValue() const { diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_matrix_component.h b/chromium/third_party/blink/renderer/core/css/cssom/css_matrix_component.h index 2f3537272e1..e60ebefee2c 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_matrix_component.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_matrix_component.h @@ -23,11 +23,14 @@ class CORE_EXPORT CSSMatrixComponent final : public CSSTransformComponent { public: // Constructors defined in the IDL. static CSSMatrixComponent* Create(DOMMatrixReadOnly*, - const CSSMatrixComponentOptions&); + const CSSMatrixComponentOptions*); // Blink-internal ways of creating CSSMatrixComponents. static CSSMatrixComponent* FromCSSValue(const CSSFunctionValue&); + CSSMatrixComponent(DOMMatrixReadOnly* matrix, bool is2D) + : CSSTransformComponent(is2D), matrix_(DOMMatrix::Create(matrix)) {} + // Getters and setters for attributes defined in the IDL. DOMMatrix* matrix() { return matrix_.Get(); } void setMatrix(DOMMatrix* matrix) { matrix_ = matrix; } @@ -44,9 +47,6 @@ class CORE_EXPORT CSSMatrixComponent final : public CSSTransformComponent { } private: - CSSMatrixComponent(DOMMatrixReadOnly* matrix, bool is2D) - : CSSTransformComponent(is2D), matrix_(DOMMatrix::Create(matrix)) {} - Member<DOMMatrix> matrix_; DISALLOW_COPY_AND_ASSIGN(CSSMatrixComponent); }; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_numeric_array.h b/chromium/third_party/blink/renderer/core/css/cssom/css_numeric_array.h index fbd9c5ea161..529f6a463ba 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_numeric_array.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_numeric_array.h @@ -17,13 +17,17 @@ class CORE_EXPORT CSSNumericArray final : public ScriptWrappable { public: // blink internal static CSSNumericArray* Create(CSSNumericValueVector values) { - return new CSSNumericArray(std::move(values)); + return MakeGarbageCollected<CSSNumericArray>(std::move(values)); } static CSSNumericArray* FromNumberishes( const HeapVector<CSSNumberish>& values) { - return new CSSNumericArray(CSSNumberishesToNumericValues(values)); + return MakeGarbageCollected<CSSNumericArray>( + CSSNumberishesToNumericValues(values)); } + explicit CSSNumericArray(CSSNumericValueVector values) + : values_(std::move(values)) {} + void Trace(blink::Visitor* visitor) override { visitor->Trace(values_); ScriptWrappable::Trace(visitor); @@ -39,9 +43,6 @@ class CORE_EXPORT CSSNumericArray final : public ScriptWrappable { const CSSNumericValueVector& Values() const { return values_; } private: - explicit CSSNumericArray(CSSNumericValueVector values) - : values_(std::move(values)) {} - CSSNumericValueVector values_; DISALLOW_COPY_AND_ASSIGN(CSSNumericArray); }; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_numeric_value.cc b/chromium/third_party/blink/renderer/core/css/cssom/css_numeric_value.cc index 14b9576b6bd..34e865b98bb 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_numeric_value.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_numeric_value.cc @@ -364,27 +364,29 @@ CSSMathSum* CSSNumericValue::toSum(const Vector<String>& unit_strings, return value; } -void CSSNumericValue::type(CSSNumericType& type) const { +CSSNumericType* CSSNumericValue::type() const { + CSSNumericType* type = CSSNumericType::Create(); using BaseType = CSSNumericValueType::BaseType; if (int exponent = type_.Exponent(BaseType::kLength)) - type.setLength(exponent); + type->setLength(exponent); if (int exponent = type_.Exponent(BaseType::kAngle)) - type.setAngle(exponent); + type->setAngle(exponent); if (int exponent = type_.Exponent(BaseType::kTime)) - type.setTime(exponent); + type->setTime(exponent); if (int exponent = type_.Exponent(BaseType::kFrequency)) - type.setFrequency(exponent); + type->setFrequency(exponent); if (int exponent = type_.Exponent(BaseType::kResolution)) - type.setResolution(exponent); + type->setResolution(exponent); if (int exponent = type_.Exponent(BaseType::kFlex)) - type.setFlex(exponent); + type->setFlex(exponent); if (int exponent = type_.Exponent(BaseType::kPercent)) - type.setPercent(exponent); + type->setPercent(exponent); if (type_.HasPercentHint()) { - type.setPercentHint( + type->setPercentHint( CSSNumericValueType::BaseTypeToString(type_.PercentHint())); } + return type; } CSSNumericValue* CSSNumericValue::add( diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_numeric_value.h b/chromium/third_party/blink/renderer/core/css/cssom/css_numeric_value.h index 89937e7a8c1..ecdd7bfd4e9 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_numeric_value.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_numeric_value.h @@ -50,7 +50,7 @@ class CORE_EXPORT CSSNumericValue : public CSSStyleValue { CSSUnitValue* to(const String&, ExceptionState&); CSSMathSum* toSum(const Vector<String>&, ExceptionState&); - void type(CSSNumericType&) const; + CSSNumericType* type() const; String toString() const final; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_perspective.cc b/chromium/third_party/blink/renderer/core/css/cssom/css_perspective.cc index e6969ce5359..e992b7f3a45 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_perspective.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_perspective.cc @@ -26,7 +26,7 @@ CSSPerspective* CSSPerspective::Create(CSSNumericValue* length, exception_state.ThrowTypeError("Must pass length to CSSPerspective"); return nullptr; } - return new CSSPerspective(length); + return MakeGarbageCollected<CSSPerspective>(length); } void CSSPerspective::setLength(CSSNumericValue* length, @@ -43,7 +43,7 @@ CSSPerspective* CSSPerspective::FromCSSValue(const CSSFunctionValue& value) { DCHECK_EQ(value.length(), 1U); CSSNumericValue* length = CSSNumericValue::FromCSSValue(ToCSSPrimitiveValue(value.Item(0))); - return new CSSPerspective(length); + return MakeGarbageCollected<CSSPerspective>(length); } DOMMatrix* CSSPerspective::toMatrix(ExceptionState& exception_state) const { diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_perspective.h b/chromium/third_party/blink/renderer/core/css/cssom/css_perspective.h index 3e78565edf8..ff15be0e46a 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_perspective.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_perspective.h @@ -28,6 +28,8 @@ class CORE_EXPORT CSSPerspective final : public CSSTransformComponent { // Blink-internal ways of creating CSSPerspectives. static CSSPerspective* FromCSSValue(const CSSFunctionValue&); + CSSPerspective(CSSNumericValue* length); + // Getters and setters for attributes defined in the IDL. CSSNumericValue* length() { return length_.Get(); } void setLength(CSSNumericValue*, ExceptionState&); @@ -49,8 +51,6 @@ class CORE_EXPORT CSSPerspective final : public CSSTransformComponent { } private: - CSSPerspective(CSSNumericValue* length); - Member<CSSNumericValue> length_; DISALLOW_COPY_AND_ASSIGN(CSSPerspective); }; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_position_value.cc b/chromium/third_party/blink/renderer/core/css/cssom/css_position_value.cc index 81c2b3cc8ca..1ed55ac309b 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_position_value.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_position_value.cc @@ -86,14 +86,14 @@ CSSPositionValue* CSSPositionValue::Create(CSSNumericValue* x, "Must pass length or percentage to y in CSSPositionValue"); return nullptr; } - return new CSSPositionValue(x, y); + return MakeGarbageCollected<CSSPositionValue>(x, y); } CSSPositionValue* CSSPositionValue::Create(CSSNumericValue* x, CSSNumericValue* y) { if (!IsValidPositionCoord(x) || !IsValidPositionCoord(y)) return nullptr; - return new CSSPositionValue(x, y); + return MakeGarbageCollected<CSSPositionValue>(x, y); } CSSPositionValue* CSSPositionValue::FromCSSValue(const CSSValue& value) { diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_position_value.h b/chromium/third_party/blink/renderer/core/css/cssom/css_position_value.h index 4b720156427..4d9d1ac5d93 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_position_value.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_position_value.h @@ -29,6 +29,8 @@ class CORE_EXPORT CSSPositionValue final : public CSSStyleValue { static CSSPositionValue* FromCSSValue(const CSSValue&); + CSSPositionValue(CSSNumericValue* x, CSSNumericValue* y) : x_(x), y_(y) {} + // Getters and setters defined in the IDL. CSSNumericValue* x() { return x_.Get(); } CSSNumericValue* y() { return y_.Get(); } @@ -50,8 +52,6 @@ class CORE_EXPORT CSSPositionValue final : public CSSStyleValue { static bool IsValidCoordinate(CSSNumericValue* coord); protected: - CSSPositionValue(CSSNumericValue* x, CSSNumericValue* y) : x_(x), y_(y) {} - Member<CSSNumericValue> x_; Member<CSSNumericValue> y_; DISALLOW_COPY_AND_ASSIGN(CSSPositionValue); diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_rotate.cc b/chromium/third_party/blink/renderer/core/css/cssom/css_rotate.cc index 51bd5f8503d..f746471b546 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_rotate.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_rotate.cc @@ -75,8 +75,9 @@ CSSRotate* CSSRotate::Create(CSSNumericValue* angle, exception_state.ThrowTypeError("Must pass an angle to CSSRotate"); return nullptr; } - return new CSSRotate(CSSUnitValue::Create(0), CSSUnitValue::Create(0), - CSSUnitValue::Create(1), angle, true /* is2D */); + return MakeGarbageCollected<CSSRotate>( + CSSUnitValue::Create(0), CSSUnitValue::Create(0), CSSUnitValue::Create(1), + angle, true /* is2D */); } CSSRotate* CSSRotate::Create(const CSSNumberish& x, @@ -97,19 +98,21 @@ CSSRotate* CSSRotate::Create(const CSSNumberish& x, exception_state.ThrowTypeError("Must pass an angle to CSSRotate"); return nullptr; } - return new CSSRotate(x_value, y_value, z_value, angle, false /* is2D */); + return MakeGarbageCollected<CSSRotate>(x_value, y_value, z_value, angle, + false /* is2D */); } CSSRotate* CSSRotate::Create(CSSNumericValue* angle) { - return new CSSRotate(CSSUnitValue::Create(0), CSSUnitValue::Create(0), - CSSUnitValue::Create(1), angle, true /* is2D */); + return MakeGarbageCollected<CSSRotate>( + CSSUnitValue::Create(0), CSSUnitValue::Create(0), CSSUnitValue::Create(1), + angle, true /* is2D */); } CSSRotate* CSSRotate::Create(CSSNumericValue* x, CSSNumericValue* y, CSSNumericValue* z, CSSNumericValue* angle) { - return new CSSRotate(x, y, z, angle, false /* is2D */); + return MakeGarbageCollected<CSSRotate>(x, y, z, angle, false /* is2D */); } CSSRotate* CSSRotate::FromCSSValue(const CSSFunctionValue& value) { diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_rotate.h b/chromium/third_party/blink/renderer/core/css/cssom/css_rotate.h index 7b3659aa052..f0a5f04a575 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_rotate.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_rotate.h @@ -38,6 +38,12 @@ class CORE_EXPORT CSSRotate final : public CSSTransformComponent { CSSNumericValue* angle); static CSSRotate* FromCSSValue(const CSSFunctionValue&); + CSSRotate(CSSNumericValue* x, + CSSNumericValue* y, + CSSNumericValue* z, + CSSNumericValue* angle, + bool is2D); + // Getters and setters for attributes defined in the IDL. CSSNumericValue* angle() { return angle_.Get(); } void setAngle(CSSNumericValue* angle, ExceptionState&); @@ -63,12 +69,6 @@ class CORE_EXPORT CSSRotate final : public CSSTransformComponent { } private: - CSSRotate(CSSNumericValue* x, - CSSNumericValue* y, - CSSNumericValue* z, - CSSNumericValue* angle, - bool is2D); - Member<CSSNumericValue> angle_; Member<CSSNumericValue> x_; Member<CSSNumericValue> y_; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_scale.h b/chromium/third_party/blink/renderer/core/css/cssom/css_scale.h index 76bcf7736e6..e564e330d76 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_scale.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_scale.h @@ -33,15 +33,21 @@ class CORE_EXPORT CSSScale final : public CSSTransformComponent { // Blink-internal ways of creating CSSScales. static CSSScale* Create(CSSNumericValue* x, CSSNumericValue* y) { - return new CSSScale(x, y, CSSUnitValue::Create(1), true /* is2D */); + return MakeGarbageCollected<CSSScale>(x, y, CSSUnitValue::Create(1), + true /* is2D */); } static CSSScale* Create(CSSNumericValue* x, CSSNumericValue* y, CSSNumericValue* z) { - return new CSSScale(x, y, z, false /* is2D */); + return MakeGarbageCollected<CSSScale>(x, y, z, false /* is2D */); } static CSSScale* FromCSSValue(const CSSFunctionValue&); + CSSScale(CSSNumericValue* x, + CSSNumericValue* y, + CSSNumericValue* z, + bool is2D); + // Getters and setters for attributes defined in the IDL. void x(CSSNumberish& x) { x.SetCSSNumericValue(x_); } void y(CSSNumberish& y) { y.SetCSSNumericValue(y_); } @@ -64,11 +70,6 @@ class CORE_EXPORT CSSScale final : public CSSTransformComponent { } private: - CSSScale(CSSNumericValue* x, - CSSNumericValue* y, - CSSNumericValue* z, - bool is2D); - Member<CSSNumericValue> x_; Member<CSSNumericValue> y_; Member<CSSNumericValue> z_; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_skew.cc b/chromium/third_party/blink/renderer/core/css/cssom/css_skew.cc index 9bf1634eff4..22584e4eff8 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_skew.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_skew.cc @@ -30,7 +30,7 @@ CSSSkew* CSSSkew::Create(CSSNumericValue* ax, exception_state.ThrowTypeError("CSSSkew does not support non-angles"); return nullptr; } - return new CSSSkew(ax, ay); + return MakeGarbageCollected<CSSSkew>(ax, ay); } void CSSSkew::setAx(CSSNumericValue* value, ExceptionState& exception_state) { diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_skew.h b/chromium/third_party/blink/renderer/core/css/cssom/css_skew.h index 6b4d7d711f0..9fddbe91471 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_skew.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_skew.h @@ -24,12 +24,14 @@ class CORE_EXPORT CSSSkew final : public CSSTransformComponent { // Constructor defined in the IDL. static CSSSkew* Create(CSSNumericValue*, CSSNumericValue*, ExceptionState&); static CSSSkew* Create(CSSNumericValue* ax, CSSNumericValue* ay) { - return new CSSSkew(ax, ay); + return MakeGarbageCollected<CSSSkew>(ax, ay); } // Internal ways of creating CSSSkew. static CSSSkew* FromCSSValue(const CSSFunctionValue&); + CSSSkew(CSSNumericValue* ax, CSSNumericValue* ay); + // Getters and setters for the ax and ay attributes defined in the IDL. CSSNumericValue* ax() { return ax_.Get(); } CSSNumericValue* ay() { return ay_.Get(); } @@ -54,8 +56,6 @@ class CORE_EXPORT CSSSkew final : public CSSTransformComponent { } private: - CSSSkew(CSSNumericValue* ax, CSSNumericValue* ay); - Member<CSSNumericValue> ax_; Member<CSSNumericValue> ay_; DISALLOW_COPY_AND_ASSIGN(CSSSkew); diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_skew_x.cc b/chromium/third_party/blink/renderer/core/css/cssom/css_skew_x.cc index 424665d8524..cfaa123f171 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_skew_x.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_skew_x.cc @@ -29,7 +29,7 @@ CSSSkewX* CSSSkewX::Create(CSSNumericValue* ax, exception_state.ThrowTypeError("CSSSkewX does not support non-angles"); return nullptr; } - return new CSSSkewX(ax); + return MakeGarbageCollected<CSSSkewX>(ax); } void CSSSkewX::setAx(CSSNumericValue* value, ExceptionState& exception_state) { diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_skew_x.h b/chromium/third_party/blink/renderer/core/css/cssom/css_skew_x.h index ce9aec9ae8c..7e16aac2c3e 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_skew_x.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_skew_x.h @@ -23,11 +23,15 @@ class CORE_EXPORT CSSSkewX final : public CSSTransformComponent { public: // Constructor defined in the IDL. static CSSSkewX* Create(CSSNumericValue*, ExceptionState&); - static CSSSkewX* Create(CSSNumericValue* ax) { return new CSSSkewX(ax); } + static CSSSkewX* Create(CSSNumericValue* ax) { + return MakeGarbageCollected<CSSSkewX>(ax); + } // Internal ways of creating CSSSkewX. static CSSSkewX* FromCSSValue(const CSSFunctionValue&); + CSSSkewX(CSSNumericValue* ax); + // Getters and setters for the ax attributes defined in the IDL. CSSNumericValue* ax() { return ax_.Get(); } void setAx(CSSNumericValue*, ExceptionState&); @@ -49,8 +53,6 @@ class CORE_EXPORT CSSSkewX final : public CSSTransformComponent { } private: - CSSSkewX(CSSNumericValue* ax); - Member<CSSNumericValue> ax_; DISALLOW_COPY_AND_ASSIGN(CSSSkewX); }; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_skew_y.cc b/chromium/third_party/blink/renderer/core/css/cssom/css_skew_y.cc index f064f891e0e..d491642b3df 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_skew_y.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_skew_y.cc @@ -29,7 +29,7 @@ CSSSkewY* CSSSkewY::Create(CSSNumericValue* ay, exception_state.ThrowTypeError("CSSSkewY does not support non-angles"); return nullptr; } - return new CSSSkewY(ay); + return MakeGarbageCollected<CSSSkewY>(ay); } void CSSSkewY::setAy(CSSNumericValue* value, ExceptionState& exception_state) { diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_skew_y.h b/chromium/third_party/blink/renderer/core/css/cssom/css_skew_y.h index cb133668085..10378a73b9a 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_skew_y.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_skew_y.h @@ -23,11 +23,15 @@ class CORE_EXPORT CSSSkewY final : public CSSTransformComponent { public: // Constructor defined in the IDL. static CSSSkewY* Create(CSSNumericValue*, ExceptionState&); - static CSSSkewY* Create(CSSNumericValue* ay) { return new CSSSkewY(ay); } + static CSSSkewY* Create(CSSNumericValue* ay) { + return MakeGarbageCollected<CSSSkewY>(ay); + } // Internal ways of creating CSSSkewY. static CSSSkewY* FromCSSValue(const CSSFunctionValue&); + CSSSkewY(CSSNumericValue* ay); + // Getters and setters for the ay attributes defined in the IDL. CSSNumericValue* ay() { return ay_.Get(); } void setAy(CSSNumericValue*, ExceptionState&); @@ -49,8 +53,6 @@ class CORE_EXPORT CSSSkewY final : public CSSTransformComponent { } private: - CSSSkewY(CSSNumericValue* ay); - Member<CSSNumericValue> ay_; DISALLOW_COPY_AND_ASSIGN(CSSSkewY); }; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_style_value.h b/chromium/third_party/blink/renderer/core/css/cssom/css_style_value.h index 2e6a16201b5..2d1f43bf1a3 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_style_value.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_style_value.h @@ -8,13 +8,14 @@ #include "base/macros.h" #include "base/optional.h" #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/css_value.h" -#include "third_party/blink/renderer/core/css_property_names.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" namespace blink { +class CSSSyntaxComponent; class ExceptionState; class ExecutionContext; enum class SecureContextMode; @@ -66,7 +67,9 @@ class CORE_EXPORT CSSStyleValue : public ScriptWrappable { virtual const CSSValue* ToCSSValue() const = 0; // FIXME: We should make this a method on CSSProperty instead. - virtual const CSSValue* ToCSSValueWithProperty(CSSPropertyID) const { + virtual const CSSValue* ToCSSValueWithProperty( + CSSPropertyID, + const CSSSyntaxComponent*) const { return ToCSSValue(); } virtual String toString() const; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_style_variable_reference_value.cc b/chromium/third_party/blink/renderer/core/css/cssom/css_style_variable_reference_value.cc index 444ce68626b..9a5859364d4 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_style_variable_reference_value.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_style_variable_reference_value.cc @@ -30,7 +30,8 @@ CSSStyleVariableReferenceValue* CSSStyleVariableReferenceValue::Create( CSSUnparsedValue* fallback) { if (!variable.StartsWith("--")) return nullptr; - return new CSSStyleVariableReferenceValue(variable, fallback); + return MakeGarbageCollected<CSSStyleVariableReferenceValue>(variable, + fallback); } void CSSStyleVariableReferenceValue::setVariable( diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_style_variable_reference_value.h b/chromium/third_party/blink/renderer/core/css/cssom/css_style_variable_reference_value.h index 87fd19e0dc8..2173b0cef9a 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_style_variable_reference_value.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_style_variable_reference_value.h @@ -32,6 +32,10 @@ class CORE_EXPORT CSSStyleVariableReferenceValue final const String& variable, CSSUnparsedValue* fallback = nullptr); + CSSStyleVariableReferenceValue(const String& variable, + CSSUnparsedValue* fallback) + : variable_(variable), fallback_(fallback) {} + const String& variable() const { return variable_; } void setVariable(const String&, ExceptionState&); @@ -44,10 +48,6 @@ class CORE_EXPORT CSSStyleVariableReferenceValue final } protected: - CSSStyleVariableReferenceValue(const String& variable, - CSSUnparsedValue* fallback) - : variable_(variable), fallback_(fallback) {} - String variable_; Member<CSSUnparsedValue> fallback_; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_transform_value.cc b/chromium/third_party/blink/renderer/core/css/cssom/css_transform_value.cc index 3a85ef3a30a..3247963c4c9 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_transform_value.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_transform_value.cc @@ -28,7 +28,7 @@ CSSTransformValue* CSSTransformValue::Create( const HeapVector<Member<CSSTransformComponent>>& transform_components) { if (transform_components.IsEmpty()) return nullptr; - return new CSSTransformValue(transform_components); + return MakeGarbageCollected<CSSTransformValue>(transform_components); } CSSTransformValue* CSSTransformValue::FromCSSValue(const CSSValue& css_value) { diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_transform_value.h b/chromium/third_party/blink/renderer/core/css/cssom/css_transform_value.h index 8a6dc7a5236..c7bcc5a4103 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_transform_value.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_transform_value.h @@ -30,6 +30,10 @@ class CORE_EXPORT CSSTransformValue final : public CSSStyleValue { static CSSTransformValue* FromCSSValue(const CSSValue&); + CSSTransformValue( + const HeapVector<Member<CSSTransformComponent>>& transform_components) + : CSSStyleValue(), transform_components_(transform_components) {} + bool is2D() const; DOMMatrix* toMatrix(ExceptionState&) const; @@ -53,10 +57,6 @@ class CORE_EXPORT CSSTransformValue final : public CSSStyleValue { } private: - CSSTransformValue( - const HeapVector<Member<CSSTransformComponent>>& transform_components) - : CSSStyleValue(), transform_components_(transform_components) {} - HeapVector<Member<CSSTransformComponent>> transform_components_; DISALLOW_COPY_AND_ASSIGN(CSSTransformValue); }; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_translate.cc b/chromium/third_party/blink/renderer/core/css/cssom/css_translate.cc index f571a1e4758..3a40305704d 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_translate.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_translate.cc @@ -92,7 +92,7 @@ CSSTranslate* CSSTranslate::Create(CSSNumericValue* x, "Must pass length or percentage to X and Y of CSSTranslate"); return nullptr; } - return new CSSTranslate( + return MakeGarbageCollected<CSSTranslate>( x, y, CSSUnitValue::Create(0, CSSPrimitiveValue::UnitType::kPixels), true /* is2D */); } @@ -107,11 +107,11 @@ CSSTranslate* CSSTranslate::Create(CSSNumericValue* x, "Must pass length or percentage to X, Y and Z of CSSTranslate"); return nullptr; } - return new CSSTranslate(x, y, z, false /* is2D */); + return MakeGarbageCollected<CSSTranslate>(x, y, z, false /* is2D */); } CSSTranslate* CSSTranslate::Create(CSSNumericValue* x, CSSNumericValue* y) { - return new CSSTranslate( + return MakeGarbageCollected<CSSTranslate>( x, y, CSSUnitValue::Create(0, CSSPrimitiveValue::UnitType::kPixels), true /* is2D */); } @@ -119,7 +119,7 @@ CSSTranslate* CSSTranslate::Create(CSSNumericValue* x, CSSNumericValue* y) { CSSTranslate* CSSTranslate::Create(CSSNumericValue* x, CSSNumericValue* y, CSSNumericValue* z) { - return new CSSTranslate(x, y, z, false /* is2D */); + return MakeGarbageCollected<CSSTranslate>(x, y, z, false /* is2D */); } CSSTranslate* CSSTranslate::FromCSSValue(const CSSFunctionValue& value) { diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_translate.h b/chromium/third_party/blink/renderer/core/css/cssom/css_translate.h index 34ff0ba7015..e28fa08ee1c 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_translate.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_translate.h @@ -40,6 +40,11 @@ class CORE_EXPORT CSSTranslate final : public CSSTransformComponent { CSSNumericValue* z); static CSSTranslate* FromCSSValue(const CSSFunctionValue&); + CSSTranslate(CSSNumericValue* x, + CSSNumericValue* y, + CSSNumericValue* z, + bool is2D); + // Getters and setters for attributes defined in the IDL. CSSNumericValue* x() { return x_; } CSSNumericValue* y() { return y_; } @@ -62,11 +67,6 @@ class CORE_EXPORT CSSTranslate final : public CSSTransformComponent { } private: - CSSTranslate(CSSNumericValue* x, - CSSNumericValue* y, - CSSNumericValue* z, - bool is2D); - Member<CSSNumericValue> x_; Member<CSSNumericValue> y_; Member<CSSNumericValue> z_; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_unit_value.cc b/chromium/third_party/blink/renderer/core/css/cssom/css_unit_value.cc index 22b3c060978..5af88ff840d 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_unit_value.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_unit_value.cc @@ -7,6 +7,7 @@ #include "third_party/blink/renderer/core/animation/length_property_functions.h" #include "third_party/blink/renderer/core/css/css_calculation_value.h" #include "third_party/blink/renderer/core/css/css_resolution_units.h" +#include "third_party/blink/renderer/core/css/css_syntax_descriptor.h" #include "third_party/blink/renderer/core/css/cssom/css_math_invert.h" #include "third_party/blink/renderer/core/css/cssom/css_math_max.h" #include "third_party/blink/renderer/core/css/cssom/css_math_min.h" @@ -37,7 +38,8 @@ CSSPrimitiveValue::UnitType ToCanonicalUnitIfPossible( bool IsValueOutOfRangeForProperty(CSSPropertyID property_id, double value, - CSSPrimitiveValue::UnitType unit) { + CSSPrimitiveValue::UnitType unit, + const CSSSyntaxComponent* match) { // FIXME: Avoid this CSSProperty::Get call as it can be costly. // The caller often has a CSSProperty already, so we can just pass it here. if (LengthPropertyFunctions::GetValueRange(CSSProperty::Get(property_id)) == @@ -47,6 +49,10 @@ bool IsValueOutOfRangeForProperty(CSSPropertyID property_id, // For non-length properties and special cases. switch (property_id) { + case CSSPropertyVariable: + if (match && match->IsInteger()) + return round(value) != value; + return false; case CSSPropertyOrder: case CSSPropertyZIndex: return round(value) != value; @@ -91,13 +97,13 @@ CSSUnitValue* CSSUnitValue::Create(double value, exception_state.ThrowTypeError("Invalid unit: " + unit_name); return nullptr; } - return new CSSUnitValue(value, unit); + return MakeGarbageCollected<CSSUnitValue>(value, unit); } CSSUnitValue* CSSUnitValue::Create(double value, CSSPrimitiveValue::UnitType unit) { DCHECK(IsValidUnit(unit)); - return new CSSUnitValue(value, unit); + return MakeGarbageCollected<CSSUnitValue>(value, unit); } CSSUnitValue* CSSUnitValue::FromCSSValue(const CSSPrimitiveValue& value) { @@ -107,7 +113,7 @@ CSSUnitValue* CSSUnitValue::FromCSSValue(const CSSPrimitiveValue& value) { if (!IsValidUnit(unit)) return nullptr; - return new CSSUnitValue(value.GetDoubleValue(), unit); + return MakeGarbageCollected<CSSUnitValue>(value.GetDoubleValue(), unit); } String CSSUnitValue::unit() const { @@ -167,8 +173,9 @@ const CSSPrimitiveValue* CSSUnitValue::ToCSSValue() const { } const CSSPrimitiveValue* CSSUnitValue::ToCSSValueWithProperty( - CSSPropertyID property_id) const { - if (IsValueOutOfRangeForProperty(property_id, value_, unit_)) { + CSSPropertyID property_id, + const CSSSyntaxComponent* match) const { + if (IsValueOutOfRangeForProperty(property_id, value_, unit_, match)) { // Wrap out of range values with a calc. CSSCalcExpressionNode* node = ToCalcExpressionNode(); node->SetIsNestedCalc(); diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_unit_value.h b/chromium/third_party/blink/renderer/core/css/cssom/css_unit_value.h index 127d3a8605c..3d5b8ddfbb5 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_unit_value.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_unit_value.h @@ -28,6 +28,11 @@ class CORE_EXPORT CSSUnitValue final : public CSSNumericValue { CSSPrimitiveValue::UnitType = CSSPrimitiveValue::UnitType::kNumber); static CSSUnitValue* FromCSSValue(const CSSPrimitiveValue&); + CSSUnitValue(double value, CSSPrimitiveValue::UnitType unit) + : CSSNumericValue(CSSNumericValueType(unit)), + value_(value), + unit_(unit) {} + // Setters and getters for attributes defined in the IDL. void setValue(double new_value) { value_ = new_value; } double value() const { return value_; } @@ -46,15 +51,12 @@ class CORE_EXPORT CSSUnitValue final : public CSSNumericValue { // From CSSStyleValue. StyleValueType GetType() const final; const CSSPrimitiveValue* ToCSSValue() const final; - const CSSPrimitiveValue* ToCSSValueWithProperty(CSSPropertyID) const final; + const CSSPrimitiveValue* ToCSSValueWithProperty( + CSSPropertyID, + const CSSSyntaxComponent*) const final; CSSCalcExpressionNode* ToCalcExpressionNode() const final; private: - CSSUnitValue(double value, CSSPrimitiveValue::UnitType unit) - : CSSNumericValue(CSSNumericValueType(unit)), - value_(value), - unit_(unit) {} - double ConvertFixedLength(CSSPrimitiveValue::UnitType) const; double ConvertAngle(CSSPrimitiveValue::UnitType) const; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_unparsed_value.h b/chromium/third_party/blink/renderer/core/css/cssom/css_unparsed_value.h index a8b7d2268f4..dc29d1e65d7 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_unparsed_value.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_unparsed_value.h @@ -23,7 +23,7 @@ class CORE_EXPORT CSSUnparsedValue final : public CSSStyleValue { public: static CSSUnparsedValue* Create( const HeapVector<CSSUnparsedSegment>& tokens) { - return new CSSUnparsedValue(tokens); + return MakeGarbageCollected<CSSUnparsedValue>(tokens); } // Blink-internal constructor @@ -34,6 +34,9 @@ class CORE_EXPORT CSSUnparsedValue final : public CSSStyleValue { static CSSUnparsedValue* FromCSSValue(const CSSCustomPropertyDeclaration&); static CSSUnparsedValue* FromCSSVariableData(const CSSVariableData&); + CSSUnparsedValue(const HeapVector<CSSUnparsedSegment>& tokens) + : CSSStyleValue(), tokens_(tokens) {} + const CSSValue* ToCSSValue() const override; StyleValueType GetType() const override { return kUnparsedType; } @@ -50,10 +53,6 @@ class CORE_EXPORT CSSUnparsedValue final : public CSSStyleValue { CSSStyleValue::Trace(visitor); } - protected: - CSSUnparsedValue(const HeapVector<CSSUnparsedSegment>& tokens) - : CSSStyleValue(), tokens_(tokens) {} - private: static CSSUnparsedValue* FromString(const String& string) { HeapVector<CSSUnparsedSegment> tokens; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_unsupported_style_value.cc b/chromium/third_party/blink/renderer/core/css/cssom/css_unsupported_style_value.cc index 894e4747c90..3da34b07a9a 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_unsupported_style_value.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_unsupported_style_value.cc @@ -4,8 +4,8 @@ #include "third_party/blink/renderer/core/css/cssom/css_unsupported_style_value.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/parser/css_parser.h" -#include "third_party/blink/renderer/core/css_property_names.h" namespace blink { diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_unsupported_style_value.h b/chromium/third_party/blink/renderer/core/css/cssom/css_unsupported_style_value.h index 5a384a11df7..ce971b49259 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_unsupported_style_value.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_unsupported_style_value.h @@ -20,15 +20,23 @@ class CORE_EXPORT CSSUnsupportedStyleValue final : public CSSStyleValue { CSSPropertyID property, const AtomicString& custom_property_name, const String& css_text) { - return new CSSUnsupportedStyleValue(property, custom_property_name, - css_text); + return MakeGarbageCollected<CSSUnsupportedStyleValue>( + property, custom_property_name, css_text); } static CSSUnsupportedStyleValue* Create( CSSPropertyID property, const AtomicString& custom_property_name, const CSSValue& value) { - return new CSSUnsupportedStyleValue(property, custom_property_name, - value.CssText()); + return MakeGarbageCollected<CSSUnsupportedStyleValue>( + property, custom_property_name, value.CssText()); + } + + CSSUnsupportedStyleValue(CSSPropertyID property, + const AtomicString& custom_property_name, + const String& css_text) + : property_(property), custom_property_name_(custom_property_name) { + SetCSSText(css_text); + DCHECK_EQ(property == CSSPropertyVariable, !custom_property_name.IsNull()); } StyleValueType GetType() const override { @@ -46,14 +54,6 @@ class CORE_EXPORT CSSUnsupportedStyleValue final : public CSSStyleValue { String toString() const final { return CSSText(); } private: - CSSUnsupportedStyleValue(CSSPropertyID property, - const AtomicString& custom_property_name, - const String& css_text) - : property_(property), custom_property_name_(custom_property_name) { - SetCSSText(css_text); - DCHECK_EQ(property == CSSPropertyVariable, !custom_property_name.IsNull()); - } - const CSSPropertyID property_; // Name is set when property_ is CSSPropertyVariable, otherwise it's // g_null_atom. diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_url_image_value.cc b/chromium/third_party/blink/renderer/core/css/cssom/css_url_image_value.cc index d0bb96c66fe..97005aba840 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_url_image_value.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_url_image_value.cc @@ -25,12 +25,12 @@ CSSURLImageValue* CSSURLImageValue::Create(ScriptState* script_state, } // Use absolute URL for CSSImageValue but keep relative URL for // getter and serialization. - return new CSSURLImageValue( + return MakeGarbageCollected<CSSURLImageValue>( *CSSImageValue::Create(url, parsed_url, Referrer())); } CSSURLImageValue* CSSURLImageValue::FromCSSValue(const CSSImageValue& value) { - return new CSSURLImageValue(value); + return MakeGarbageCollected<CSSURLImageValue>(value); } const String& CSSURLImageValue::url() const { diff --git a/chromium/third_party/blink/renderer/core/css/cssom/css_url_image_value.h b/chromium/third_party/blink/renderer/core/css/cssom/css_url_image_value.h index 81ce5e2e6db..9635cb30954 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/css_url_image_value.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/css_url_image_value.h @@ -21,6 +21,8 @@ class CORE_EXPORT CSSURLImageValue final : public CSSStyleImageValue { static CSSURLImageValue* FromCSSValue(const CSSImageValue&); + explicit CSSURLImageValue(const CSSImageValue& value) : value_(value) {} + const String& url() const; // CSSStyleImageValue @@ -40,8 +42,6 @@ class CORE_EXPORT CSSURLImageValue final : public CSSStyleImageValue { void Trace(blink::Visitor*) override; private: - explicit CSSURLImageValue(const CSSImageValue& value) : value_(value) {} - scoped_refptr<Image> GetImage() const; Member<const CSSImageValue> value_; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/cssom_keywords.h b/chromium/third_party/blink/renderer/core/css/cssom/cssom_keywords.h index 3e5388eb8b3..86bd5e28f91 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/cssom_keywords.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/cssom_keywords.h @@ -5,7 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSSOM_CSSOM_KEYWORDS_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSSOM_CSSOM_KEYWORDS_H_ -#include "third_party/blink/renderer/core/css_property_names.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" namespace blink { diff --git a/chromium/third_party/blink/renderer/core/css/cssom/cssom_types.h b/chromium/third_party/blink/renderer/core/css/cssom/cssom_types.h index e96cf7a5709..d43ebea52f2 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/cssom_types.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/cssom_types.h @@ -5,8 +5,8 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSSOM_CSSOM_TYPES_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSSOM_CSSOM_TYPES_H_ +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/cssom/css_style_value.h" -#include "third_party/blink/renderer/core/css_property_names.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" namespace blink { @@ -33,10 +33,15 @@ class CSSOMTypes { static bool IsCSSStyleValuePosition(const CSSStyleValue&); static bool IsPropertySupported(CSSPropertyID); + // For registered custom properties, if the CSSStyleValue is accepted + // because it matches the registered grammar (and not because it is + // a CSSUnsupportedStyleValue with matching name), 'match' will be set + // to the component that was matched. static bool PropertyCanTake(CSSPropertyID, const AtomicString& custom_property_name, const PropertyRegistration*, - const CSSStyleValue&); + const CSSStyleValue&, + const CSSSyntaxComponent*& match); }; } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map.cc b/chromium/third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map.cc index d7beaf9eae8..310444d9973 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map.cc @@ -9,6 +9,7 @@ #include "third_party/blink/renderer/core/css/css_variable_data.h" #include "third_party/blink/renderer/core/css/cssom/computed_style_property_map.h" #include "third_party/blink/renderer/core/css/cssom/css_unparsed_value.h" +#include "third_party/blink/renderer/core/css/properties/css_property_ref.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/style/computed_style.h" @@ -20,7 +21,7 @@ PrepopulatedComputedStylePropertyMap::PrepopulatedComputedStylePropertyMap( Node* styled_node, const Vector<CSSPropertyID>& native_properties, const Vector<AtomicString>& custom_properties) - : StylePropertyMapReadOnly(), styled_node_(styled_node) { + : StylePropertyMapReadOnlyMainThread(), styled_node_(styled_node) { // NOTE: This may over-reserve as shorthand properties will get dropped from // being in the map. native_values_.ReserveCapacityForSize(native_properties.size()); @@ -71,8 +72,10 @@ void PrepopulatedComputedStylePropertyMap::UpdateCustomProperty( const Document& document, const ComputedStyle& style, const AtomicString& property_name) { - const CSSValue* value = ComputedStyleCSSValueMapping::Get( - property_name, style, document.GetPropertyRegistry()); + CSSPropertyRef ref(property_name, document); + const CSSValue* value = ref.GetProperty().CSSValueFromComputedStyle( + style, /* layout_object */ nullptr, styled_node_, + /* allow_visited_style */ false); if (!value) value = CSSUnparsedValue::Create()->ToCSSValue(); @@ -125,7 +128,7 @@ void PrepopulatedComputedStylePropertyMap::Trace(blink::Visitor* visitor) { visitor->Trace(styled_node_); visitor->Trace(native_values_); visitor->Trace(custom_values_); - StylePropertyMapReadOnly::Trace(visitor); + StylePropertyMapReadOnlyMainThread::Trace(visitor); } } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map.h b/chromium/third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map.h index f691eafe73f..7d346e5f2ad 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map.h @@ -7,7 +7,7 @@ #include "base/macros.h" #include "third_party/blink/renderer/core/css/css_property_id_templates.h" -#include "third_party/blink/renderer/core/css/cssom/style_property_map_read_only.h" +#include "third_party/blink/renderer/core/css/cssom/style_property_map_read_only_main_thread.h" namespace blink { @@ -24,7 +24,7 @@ class ComputedStyle; // result when the ComputedStyle changes UpdateStyle needs to be called to // re-populate the internal maps. class CORE_EXPORT PrepopulatedComputedStylePropertyMap - : public StylePropertyMapReadOnly { + : public StylePropertyMapReadOnlyMainThread { public: // NOTE: styled_node may be null, in the case where this map is for an // anonymous box. diff --git a/chromium/third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map_test.cc b/chromium/third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map_test.cc index 4fec89eb08f..30e93f2bee1 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map_test.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/prepopulated_computed_style_property_map_test.cc @@ -39,11 +39,11 @@ TEST_F(PrepopulatedComputedStylePropertyMapTest, NativePropertyAccessors) { {CSSPropertyColor, CSSPropertyAlignItems}); Vector<AtomicString> empty_custom_properties; - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); Node* node = PageNode(); PrepopulatedComputedStylePropertyMap* map = - new PrepopulatedComputedStylePropertyMap( + MakeGarbageCollected<PrepopulatedComputedStylePropertyMap>( GetDocument(), node->ComputedStyleRef(), node, native_properties, empty_custom_properties); @@ -75,11 +75,11 @@ TEST_F(PrepopulatedComputedStylePropertyMapTest, CustomPropertyAccessors) { Vector<CSSPropertyID> empty_native_properties; Vector<AtomicString> custom_properties({"--foo", "--bar"}); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); Node* node = PageNode(); PrepopulatedComputedStylePropertyMap* map = - new PrepopulatedComputedStylePropertyMap( + MakeGarbageCollected<PrepopulatedComputedStylePropertyMap>( GetDocument(), node->ComputedStyleRef(), node, empty_native_properties, custom_properties); diff --git a/chromium/third_party/blink/renderer/core/css/cssom/style_property_map.cc b/chromium/third_party/blink/renderer/core/css/cssom/style_property_map.cc index adc08f09890..3994c6abc7e 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/style_property_map.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/style_property_map.cc @@ -22,6 +22,21 @@ namespace blink { namespace { +bool IsListValuedProperty(const CSSProperty& property, + const PropertyRegistration* registration) { + if (property.IsRepeated()) + return true; + // TODO(andruud): The concept of "list-valued properties" doesn't fully work + // in all cases. See https://github.com/w3c/css-houdini-drafts/issues/823 + // For now we only consider a custom property list-valued if it has a single + // syntax component that is repeatable (e.g. <length>+). + if (property.IDEquals(CSSPropertyVariable) && registration) { + const auto& components = registration->Syntax().Components(); + return components.size() == 1 && components[0].IsRepeatable(); + } + return false; +} + CSSValueList* CssValueListForPropertyID(CSSPropertyID property_id) { DCHECK(CSSProperty::Get(property_id).IsRepeated()); char separator = CSSProperty::Get(property_id).RepetitionSeparator(); @@ -38,6 +53,56 @@ CSSValueList* CssValueListForPropertyID(CSSPropertyID property_id) { } } +String StyleValueToString(const CSSProperty& property, + const CSSStyleValue& style_value, + const CSSSyntaxComponent* syntax_component) { + if (style_value.GetType() == CSSStyleValue::kUnknownType) + return style_value.toString(); + return style_value + .ToCSSValueWithProperty(property.PropertyID(), syntax_component) + ->CssText(); +} + +const CSSVariableReferenceValue* CreateVariableReferenceValue( + const String& value, + const CSSParserContext& context) { + CSSTokenizer tokenizer(value); + const auto tokens = tokenizer.TokenizeToEOF(); + CSSParserTokenRange range(tokens); + scoped_refptr<CSSVariableData> variable_data = CSSVariableData::Create( + range, false, false, context.BaseURL(), context.Charset()); + return CSSVariableReferenceValue::Create(variable_data, context); +} + +const CSSVariableReferenceValue* CreateVariableReferenceValue( + const CSSProperty& property, + const AtomicString& custom_property_name, + const PropertyRegistration& registration, + const CSSStyleValueVector& values, + const CSSParserContext& context) { + DCHECK(IsListValuedProperty(property, ®istration)); + DCHECK_EQ(registration.Syntax().Components().size(), 1U); + + char separator = registration.Syntax().Components()[0].Separator(); + + StringBuilder builder; + + for (const auto& value : values) { + const CSSSyntaxComponent* syntax_component = nullptr; + + if (!CSSOMTypes::PropertyCanTake(property.PropertyID(), + custom_property_name, ®istration, + *value, syntax_component)) { + return nullptr; + } + if (!builder.IsEmpty()) + builder.Append(separator); + builder.Append(StyleValueToString(property, *value, syntax_component)); + } + + return CreateVariableReferenceValue(builder.ToString(), context); +} + const CSSValue* StyleValueToCSSValue( const CSSProperty& property, const AtomicString& custom_property_name, @@ -47,9 +112,12 @@ const CSSValue* StyleValueToCSSValue( DCHECK_EQ(property.IDEquals(CSSPropertyVariable), !custom_property_name.IsNull()); + const CSSSyntaxComponent* syntax_component = nullptr; + const CSSPropertyID property_id = property.PropertyID(); if (!CSSOMTypes::PropertyCanTake(property_id, custom_property_name, - registration, style_value)) { + registration, style_value, + syntax_component)) { return nullptr; } @@ -69,13 +137,10 @@ const CSSValue* StyleValueToCSSValue( case CSSPropertyVariable: if (registration && style_value.GetType() != CSSStyleValue::kUnparsedType) { - CSSTokenizer tokenizer(style_value.toString()); - const auto tokens = tokenizer.TokenizeToEOF(); - CSSParserTokenRange range(tokens); CSSParserContext* context = CSSParserContext::Create(execution_context); - scoped_refptr<CSSVariableData> variable_data = CSSVariableData::Create( - range, false, false, context->BaseURL(), context->Charset()); - return CSSVariableReferenceValue::Create(variable_data, *context); + String string = + StyleValueToString(property, style_value, syntax_component); + return CreateVariableReferenceValue(string, *context); } break; case CSSPropertyBorderBottomLeftRadius: @@ -198,7 +263,7 @@ const CSSValue* StyleValueToCSSValue( break; } - return style_value.ToCSSValueWithProperty(property_id); + return style_value.ToCSSValueWithProperty(property_id, syntax_component); } const CSSValue* CoerceStyleValueOrString( @@ -207,7 +272,7 @@ const CSSValue* CoerceStyleValueOrString( const PropertyRegistration* registration, const CSSStyleValueOrString& value, const ExecutionContext& execution_context) { - DCHECK(!property.IsRepeated()); + DCHECK(!IsListValuedProperty(property, registration)); DCHECK_EQ(property.IDEquals(CSSPropertyVariable), !custom_property_name.IsNull()); @@ -233,9 +298,10 @@ const CSSValue* CoerceStyleValueOrString( const CSSValue* CoerceStyleValuesOrStrings( const CSSProperty& property, const AtomicString& custom_property_name, + const PropertyRegistration* registration, const HeapVector<CSSStyleValueOrString>& values, const ExecutionContext& execution_context) { - DCHECK(property.IsRepeated()); + DCHECK(IsListValuedProperty(property, registration)); DCHECK_EQ(property.IDEquals(CSSPropertyVariable), !custom_property_name.IsNull()); if (values.IsEmpty()) @@ -243,11 +309,18 @@ const CSSValue* CoerceStyleValuesOrStrings( CSSStyleValueVector style_values = StyleValueFactory::CoerceStyleValuesOrStrings( - property, custom_property_name, nullptr, values, execution_context); + property, custom_property_name, registration, values, + execution_context); if (style_values.IsEmpty()) return nullptr; + if (property.IDEquals(CSSPropertyVariable) && registration) { + CSSParserContext* context = CSSParserContext::Create(execution_context); + return CreateVariableReferenceValue(property, custom_property_name, + *registration, style_values, *context); + } + CSSValueList* result = CssValueListForPropertyID(property.PropertyID()); for (const auto& style_value : style_values) { const CSSValue* css_value = @@ -286,8 +359,10 @@ void StylePropertyMap::set(const ExecutionContext* execution_context, String css_text; if (values[0].IsCSSStyleValue()) { CSSStyleValue* style_value = values[0].GetAsCSSStyleValue(); - if (style_value && CSSOMTypes::PropertyCanTake(property_id, g_null_atom, - nullptr, *style_value)) { + const CSSSyntaxComponent* syntax_component = nullptr; + if (style_value && + CSSOMTypes::PropertyCanTake(property_id, g_null_atom, nullptr, + *style_value, syntax_component)) { css_text = style_value->toString(); } } else { @@ -317,9 +392,10 @@ void StylePropertyMap::set(const ExecutionContext* execution_context, } const CSSValue* result = nullptr; - if (property.IsRepeated()) { - result = CoerceStyleValuesOrStrings(property, custom_property_name, values, - *execution_context); + if (IsListValuedProperty(property, registration)) { + result = + CoerceStyleValuesOrStrings(property, custom_property_name, registration, + values, *execution_context); } else if (values.size() == 1U) { result = CoerceStyleValueOrString(property, custom_property_name, registration, @@ -351,13 +427,55 @@ void StylePropertyMap::append(const ExecutionContext* execution_context, return; } + const CSSProperty& property = CSSProperty::Get(property_id); + if (property_id == CSSPropertyVariable) { + AtomicString custom_property_name(property_name); + + const PropertyRegistration* registration = + PropertyRegistration::From(execution_context, custom_property_name); + + if (registration && IsListValuedProperty(property, registration)) { + CSSStyleValueVector style_values; + + // Add existing CSSStyleValues: + if (const CSSValue* css_value = + GetCustomProperty(*execution_context, custom_property_name)) { + DCHECK(css_value->IsValueList()); + style_values = StyleValueFactory::CssValueToStyleValueVector( + property_id, custom_property_name, *css_value); + } + + // Append incoming CSSStyleValues: + CSSStyleValueVector incoming_style_values = + StyleValueFactory::CoerceStyleValuesOrStrings( + property, custom_property_name, registration, values, + *execution_context); + + const CSSValue* result = nullptr; + + if (!incoming_style_values.IsEmpty()) { + style_values.AppendVector(incoming_style_values); + CSSParserContext* context = + CSSParserContext::Create(*execution_context); + result = + CreateVariableReferenceValue(property, custom_property_name, + *registration, style_values, *context); + } + + if (!result) { + exception_state.ThrowTypeError("Invalid type for property"); + return; + } + + SetCustomProperty(custom_property_name, *result); + return; + } exception_state.ThrowTypeError( "Appending to custom properties is not supported"); return; } - const CSSProperty& property = CSSProperty::Get(property_id); if (!property.IsRepeated()) { exception_state.ThrowTypeError("Property does not support multiple values"); return; @@ -371,10 +489,8 @@ void StylePropertyMap::append(const ExecutionContext* execution_context, current_value = CssValueListForPropertyID(property_id); } - // TODO(andruud): Don't pass g_null_atom as custom property name - // once appending to custom properties is supported. const CSSValue* result = CoerceStyleValuesOrStrings( - property, g_null_atom, values, *execution_context); + property, g_null_atom, nullptr, values, *execution_context); if (!result || !result->IsValueList()) { exception_state.ThrowTypeError("Invalid type for property"); return; diff --git a/chromium/third_party/blink/renderer/core/css/cssom/style_property_map.h b/chromium/third_party/blink/renderer/core/css/cssom/style_property_map.h index 37b32d505c5..6bbc19bb0f2 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/style_property_map.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/style_property_map.h @@ -7,7 +7,7 @@ #include "base/macros.h" #include "third_party/blink/renderer/bindings/core/v8/css_style_value_or_string.h" -#include "third_party/blink/renderer/core/css/cssom/style_property_map_read_only.h" +#include "third_party/blink/renderer/core/css/cssom/style_property_map_read_only_main_thread.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" namespace blink { @@ -15,7 +15,7 @@ namespace blink { class ExceptionState; class ExecutionContext; -class CORE_EXPORT StylePropertyMap : public StylePropertyMapReadOnly { +class CORE_EXPORT StylePropertyMap : public StylePropertyMapReadOnlyMainThread { DEFINE_WRAPPERTYPEINFO(); public: diff --git a/chromium/third_party/blink/renderer/core/css/cssom/style_property_map_read_only.h b/chromium/third_party/blink/renderer/core/css/cssom/style_property_map_read_only.h index 49415543ac8..bdb84457ec6 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/style_property_map_read_only.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/style_property_map_read_only.h @@ -8,57 +8,29 @@ #include "base/macros.h" #include "third_party/blink/renderer/bindings/core/v8/iterable.h" #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/cssom/css_style_value.h" -#include "third_party/blink/renderer/core/css_property_names.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" namespace blink { -class CSSProperty; - class CORE_EXPORT StylePropertyMapReadOnly : public ScriptWrappable, public PairIterable<String, CSSStyleValueVector> { DEFINE_WRAPPERTYPEINFO(); public: - using StylePropertyMapEntry = std::pair<String, CSSStyleValueVector>; - - ~StylePropertyMapReadOnly() override = default; - - CSSStyleValue* get(const ExecutionContext*, - const String& property_name, - ExceptionState&); - CSSStyleValueVector getAll(const ExecutionContext*, + virtual CSSStyleValue* get(const ExecutionContext*, const String& property_name, - ExceptionState&); - bool has(const ExecutionContext*, - const String& property_name, - ExceptionState&); + ExceptionState&) = 0; + virtual CSSStyleValueVector getAll(const ExecutionContext*, + const String& property_name, + ExceptionState&) = 0; + virtual bool has(const ExecutionContext*, + const String& property_name, + ExceptionState&) = 0; virtual unsigned int size() = 0; - - protected: - StylePropertyMapReadOnly() = default; - - virtual const CSSValue* GetProperty(CSSPropertyID) = 0; - virtual const CSSValue* GetCustomProperty(AtomicString) = 0; - - using IterationCallback = - std::function<void(const AtomicString&, const CSSValue&)>; - virtual void ForEachProperty(const IterationCallback&) = 0; - - virtual String SerializationForShorthand(const CSSProperty&) = 0; - - private: - IterationSource* StartIteration(ScriptState*, ExceptionState&) override; - - CSSStyleValue* GetShorthandProperty(const CSSProperty&); - const CSSValue* GetCustomProperty(const ExecutionContext&, - const AtomicString&); - - private: - DISALLOW_COPY_AND_ASSIGN(StylePropertyMapReadOnly); }; } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/cssom/style_property_map_read_only.cc b/chromium/third_party/blink/renderer/core/css/cssom/style_property_map_read_only_main_thread.cc index 2a8d4804dae..3adb7f95625 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/style_property_map_read_only.cc +++ b/chromium/third_party/blink/renderer/core/css/cssom/style_property_map_read_only_main_thread.cc @@ -1,10 +1,11 @@ -// Copyright 2016 the chromium authors. All rights reserved. +// Copyright 2018 the chromium authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/cssom/style_property_map_read_only.h" +#include "third_party/blink/renderer/core/css/cssom/style_property_map_read_only_main_thread.h" #include "third_party/blink/renderer/core/css/css_custom_property_declaration.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/css_value_list.h" #include "third_party/blink/renderer/core/css/css_variable_reference_value.h" #include "third_party/blink/renderer/core/css/cssom/css_style_value.h" @@ -14,7 +15,6 @@ #include "third_party/blink/renderer/core/css/properties/css_property.h" #include "third_party/blink/renderer/core/css/property_registration.h" #include "third_party/blink/renderer/core/css/property_registry.h" -#include "third_party/blink/renderer/core/css_property_names.h" #include "third_party/blink/renderer/core/style_property_shorthand.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" @@ -26,7 +26,8 @@ class StylePropertyMapIterationSource final : public PairIterable<String, CSSStyleValueVector>::IterationSource { public: explicit StylePropertyMapIterationSource( - HeapVector<StylePropertyMapReadOnly::StylePropertyMapEntry> values) + HeapVector<StylePropertyMapReadOnlyMainThread::StylePropertyMapEntry> + values) : index_(0), values_(values) {} bool Next(ScriptState*, @@ -36,7 +37,7 @@ class StylePropertyMapIterationSource final if (index_ >= values_.size()) return false; - const StylePropertyMapReadOnly::StylePropertyMapEntry& pair = + const StylePropertyMapReadOnlyMainThread::StylePropertyMapEntry& pair = values_.at(index_++); key = pair.first; value = pair.second; @@ -50,12 +51,13 @@ class StylePropertyMapIterationSource final private: wtf_size_t index_; - const HeapVector<StylePropertyMapReadOnly::StylePropertyMapEntry> values_; + const HeapVector<StylePropertyMapReadOnlyMainThread::StylePropertyMapEntry> + values_; }; } // namespace -CSSStyleValue* StylePropertyMapReadOnly::get( +CSSStyleValue* StylePropertyMapReadOnlyMainThread::get( const ExecutionContext* execution_context, const String& property_name, ExceptionState& exception_state) { @@ -93,7 +95,7 @@ CSSStyleValue* StylePropertyMapReadOnly::get( custom_property_name, *value); } -CSSStyleValueVector StylePropertyMapReadOnly::getAll( +CSSStyleValueVector StylePropertyMapReadOnlyMainThread::getAll( const ExecutionContext* execution_context, const String& property_name, ExceptionState& exception_state) { @@ -127,16 +129,29 @@ CSSStyleValueVector StylePropertyMapReadOnly::getAll( property_id, custom_property_name, *value); } -bool StylePropertyMapReadOnly::has(const ExecutionContext* execution_context, - const String& property_name, - ExceptionState& exception_state) { +bool StylePropertyMapReadOnlyMainThread::has( + const ExecutionContext* execution_context, + const String& property_name, + ExceptionState& exception_state) { return !getAll(execution_context, property_name, exception_state).IsEmpty(); } -StylePropertyMapReadOnly::IterationSource* -StylePropertyMapReadOnly::StartIteration(ScriptState* script_state, - ExceptionState&) { - HeapVector<StylePropertyMapReadOnly::StylePropertyMapEntry> result; +const CSSValue* StylePropertyMapReadOnlyMainThread::GetCustomProperty( + const ExecutionContext& execution_context, + const AtomicString& property_name) { + const CSSValue* value = GetCustomProperty(property_name); + + const auto* document = DynamicTo<Document>(execution_context); + if (!document) + return value; + + return PropertyRegistry::ParseIfRegistered(*document, property_name, value); +} + +StylePropertyMapReadOnlyMainThread::IterationSource* +StylePropertyMapReadOnlyMainThread::StartIteration(ScriptState* script_state, + ExceptionState&) { + HeapVector<StylePropertyMapReadOnlyMainThread::StylePropertyMapEntry> result; const ExecutionContext& execution_context = *ExecutionContext::From(script_state); @@ -166,7 +181,7 @@ StylePropertyMapReadOnly::StartIteration(ScriptState* script_state, return new StylePropertyMapIterationSource(result); } -CSSStyleValue* StylePropertyMapReadOnly::GetShorthandProperty( +CSSStyleValue* StylePropertyMapReadOnlyMainThread::GetShorthandProperty( const CSSProperty& property) { DCHECK(property.IsShorthand()); const auto serialization = SerializationForShorthand(property); @@ -176,16 +191,4 @@ CSSStyleValue* StylePropertyMapReadOnly::GetShorthandProperty( serialization); } -const CSSValue* StylePropertyMapReadOnly::GetCustomProperty( - const ExecutionContext& execution_context, - const AtomicString& property_name) { - const CSSValue* value = GetCustomProperty(property_name); - - const auto* document = DynamicTo<Document>(execution_context); - if (!document) - return value; - - return PropertyRegistry::ParseIfRegistered(*document, property_name, value); -} - } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/cssom/style_property_map_read_only_main_thread.h b/chromium/third_party/blink/renderer/core/css/cssom/style_property_map_read_only_main_thread.h new file mode 100644 index 00000000000..dab11e66550 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/cssom/style_property_map_read_only_main_thread.h @@ -0,0 +1,59 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSSOM_STYLE_PROPERTY_MAP_READ_ONLY_MAIN_THREAD_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSSOM_STYLE_PROPERTY_MAP_READ_ONLY_MAIN_THREAD_H_ + +#include "third_party/blink/renderer/core/css/cssom/style_property_map_read_only.h" + +namespace blink { + +class CSSProperty; + +class CORE_EXPORT StylePropertyMapReadOnlyMainThread + : public StylePropertyMapReadOnly { + public: + using StylePropertyMapEntry = std::pair<String, CSSStyleValueVector>; + + ~StylePropertyMapReadOnlyMainThread() override = default; + + CSSStyleValue* get(const ExecutionContext*, + const String& property_name, + ExceptionState&) override; + CSSStyleValueVector getAll(const ExecutionContext*, + const String& property_name, + ExceptionState&) override; + bool has(const ExecutionContext*, + const String& property_name, + ExceptionState&) override; + + unsigned int size() override = 0; + + protected: + StylePropertyMapReadOnlyMainThread() = default; + + virtual const CSSValue* GetProperty(CSSPropertyID) = 0; + virtual const CSSValue* GetCustomProperty(AtomicString) = 0; + + using IterationCallback = + std::function<void(const AtomicString&, const CSSValue&)>; + virtual void ForEachProperty(const IterationCallback&) = 0; + + virtual String SerializationForShorthand(const CSSProperty&) = 0; + + const CSSValue* GetCustomProperty(const ExecutionContext&, + const AtomicString&); + + private: + IterationSource* StartIteration(ScriptState*, ExceptionState&) override; + + CSSStyleValue* GetShorthandProperty(const CSSProperty&); + + private: + DISALLOW_COPY_AND_ASSIGN(StylePropertyMapReadOnlyMainThread); +}; + +} // namespace blink + +#endif diff --git a/chromium/third_party/blink/renderer/core/css/cssom/style_value_factory.h b/chromium/third_party/blink/renderer/core/css/cssom/style_value_factory.h index 603aa2f6a9e..094c4635dc1 100644 --- a/chromium/third_party/blink/renderer/core/css/cssom/style_value_factory.h +++ b/chromium/third_party/blink/renderer/core/css/cssom/style_value_factory.h @@ -6,8 +6,8 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSSOM_STYLE_VALUE_FACTORY_H_ #include "third_party/blink/renderer/bindings/core/v8/css_style_value_or_string.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/cssom/css_style_value.h" -#include "third_party/blink/renderer/core/css_property_names.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" namespace blink { diff --git a/chromium/third_party/blink/renderer/core/css/document_style_sheet_collection.h b/chromium/third_party/blink/renderer/core/css/document_style_sheet_collection.h index ad4361b3bc7..f99ced9a805 100644 --- a/chromium/third_party/blink/renderer/core/css/document_style_sheet_collection.h +++ b/chromium/third_party/blink/renderer/core/css/document_style_sheet_collection.h @@ -44,9 +44,11 @@ class DocumentStyleSheetCollection final : public TreeScopeStyleSheetCollection { public: static DocumentStyleSheetCollection* Create(TreeScope& tree_scope) { - return new DocumentStyleSheetCollection(tree_scope); + return MakeGarbageCollected<DocumentStyleSheetCollection>(tree_scope); } + explicit DocumentStyleSheetCollection(TreeScope&); + void UpdateActiveStyleSheets(StyleEngine& master_engine); void CollectStyleSheets(StyleEngine& master_engine, DocumentStyleSheetCollector&); @@ -57,8 +59,6 @@ class DocumentStyleSheetCollection final } private: - explicit DocumentStyleSheetCollection(TreeScope&); - void CollectStyleSheetsFromCandidates(StyleEngine& master_engine, DocumentStyleSheetCollector&); DISALLOW_COPY_AND_ASSIGN(DocumentStyleSheetCollection); diff --git a/chromium/third_party/blink/renderer/core/css/drag_update_test.cc b/chromium/third_party/blink/renderer/core/css/drag_update_test.cc index b34d15fd9fd..54682f3e691 100644 --- a/chromium/third_party/blink/renderer/core/css/drag_update_test.cc +++ b/chromium/third_party/blink/renderer/core/css/drag_update_test.cc @@ -30,11 +30,13 @@ TEST(DragUpdateTest, AffectedByDragUpdate) { </div> )HTML"); - document.View()->UpdateAllLifecyclePhases(); + document.View()->UpdateAllLifecyclePhases( + DocumentLifecycle::LifecycleUpdateReason::kTest); unsigned start_count = document.GetStyleEngine().StyleForElementCount(); document.getElementById("div")->SetDragged(true); - document.View()->UpdateAllLifecyclePhases(); + document.View()->UpdateAllLifecyclePhases( + DocumentLifecycle::LifecycleUpdateReason::kTest); unsigned element_count = document.GetStyleEngine().StyleForElementCount() - start_count; diff --git a/chromium/third_party/blink/renderer/core/css/element_rule_collector.cc b/chromium/third_party/blink/renderer/core/css/element_rule_collector.cc index 73d56c10a62..59008329f55 100644 --- a/chromium/third_party/blink/renderer/core/css/element_rule_collector.cc +++ b/chromium/third_party/blink/renderer/core/css/element_rule_collector.cc @@ -84,7 +84,7 @@ void ElementRuleCollector::ClearMatchedRules() { inline StyleRuleList* ElementRuleCollector::EnsureStyleRuleList() { if (!style_rule_list_) - style_rule_list_ = new StyleRuleList(); + style_rule_list_ = MakeGarbageCollected<StyleRuleList>(); return style_rule_list_; } @@ -235,9 +235,16 @@ void ElementRuleCollector::CollectMatchingRules( if (SelectorChecker::MatchesFocusPseudoClass(element)) CollectMatchingRulesForList(match_request.rule_set->FocusPseudoClassRules(), cascade_order, match_request); - CollectMatchingRulesForList( - match_request.rule_set->TagRules(element.LocalNameForSelectorMatching()), - cascade_order, match_request); + if (SelectorChecker::MatchesSpatialNavigationFocusPseudoClass(element)) { + CollectMatchingRulesForList( + match_request.rule_set->SpatialNavigationFocusPseudoClassRules(), + cascade_order, match_request); + } + AtomicString element_name = matching_ua_rules_ + ? element.localName() + : element.LocalNameForSelectorMatching(); + CollectMatchingRulesForList(match_request.rule_set->TagRules(element_name), + cascade_order, match_request); CollectMatchingRulesForList(match_request.rule_set->UniversalRules(), cascade_order, match_request); } diff --git a/chromium/third_party/blink/renderer/core/css/font_display.cc b/chromium/third_party/blink/renderer/core/css/font_display.cc new file mode 100644 index 00000000000..c30ea41239d --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/font_display.cc @@ -0,0 +1,31 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/font_display.h" + +#include "third_party/blink/renderer/core/css/css_identifier_value.h" + +namespace blink { + +FontDisplay CSSValueToFontDisplay(const CSSValue* value) { + if (value && value->IsIdentifierValue()) { + switch (ToCSSIdentifierValue(value)->GetValueID()) { + case CSSValueAuto: + return kFontDisplayAuto; + case CSSValueBlock: + return kFontDisplayBlock; + case CSSValueSwap: + return kFontDisplaySwap; + case CSSValueFallback: + return kFontDisplayFallback; + case CSSValueOptional: + return kFontDisplayOptional; + default: + break; + } + } + return kFontDisplayAuto; +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/font_display.h b/chromium/third_party/blink/renderer/core/css/font_display.h new file mode 100644 index 00000000000..ede328708df --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/font_display.h @@ -0,0 +1,25 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_FONT_DISPLAY_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_FONT_DISPLAY_H_ + +namespace blink { + +class CSSValue; + +enum FontDisplay { + kFontDisplayAuto, + kFontDisplayBlock, + kFontDisplaySwap, + kFontDisplayFallback, + kFontDisplayOptional, + kFontDisplayEnumMax, +}; + +FontDisplay CSSValueToFontDisplay(const CSSValue*); + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_FONT_DISPLAY_H_ diff --git a/chromium/third_party/blink/renderer/core/css/font_face.cc b/chromium/third_party/blink/renderer/core/css/font_face.cc index 88a4b9b9a73..85cb342aa95 100644 --- a/chromium/third_party/blink/renderer/core/css/font_face.cc +++ b/chromium/third_party/blink/renderer/core/css/font_face.cc @@ -81,26 +81,6 @@ const CSSValue* ParseCSSValue(const ExecutionContext* context, *parser_context); } -FontDisplay CSSValueToFontDisplay(const CSSValue* value) { - if (value && value->IsIdentifierValue()) { - switch (ToCSSIdentifierValue(value)->GetValueID()) { - case CSSValueAuto: - return kFontDisplayAuto; - case CSSValueBlock: - return kFontDisplayBlock; - case CSSValueSwap: - return kFontDisplaySwap; - case CSSValueFallback: - return kFontDisplayFallback; - case CSSValueOptional: - return kFontDisplayOptional; - default: - break; - } - } - return kFontDisplayAuto; -} - CSSFontFace* CreateCSSFontFace(FontFace* font_face, const CSSValue* unicode_range) { Vector<UnicodeRange> ranges; @@ -113,7 +93,7 @@ CSSFontFace* CreateCSSFontFace(FontFace* font_face, } } - return new CSSFontFace(font_face, ranges); + return MakeGarbageCollected<CSSFontFace>(font_face, ranges); } } // namespace @@ -121,7 +101,7 @@ CSSFontFace* CreateCSSFontFace(FontFace* font_face, FontFace* FontFace::Create(ExecutionContext* context, const AtomicString& family, StringOrArrayBufferOrArrayBufferView& source, - const FontFaceDescriptors& descriptors) { + const FontFaceDescriptors* descriptors) { if (source.IsString()) return Create(context, family, source.GetAsString(), descriptors); if (source.IsArrayBuffer()) @@ -137,8 +117,9 @@ FontFace* FontFace::Create(ExecutionContext* context, FontFace* FontFace::Create(ExecutionContext* context, const AtomicString& family, const String& source, - const FontFaceDescriptors& descriptors) { - FontFace* font_face = new FontFace(context, family, descriptors); + const FontFaceDescriptors* descriptors) { + FontFace* font_face = + MakeGarbageCollected<FontFace>(context, family, descriptors); const CSSValue* src = ParseCSSValue(context, source, AtRuleDescriptorID::Src); if (!src || !src->IsValueList()) { @@ -155,8 +136,9 @@ FontFace* FontFace::Create(ExecutionContext* context, FontFace* FontFace::Create(ExecutionContext* context, const AtomicString& family, DOMArrayBuffer* source, - const FontFaceDescriptors& descriptors) { - FontFace* font_face = new FontFace(context, family, descriptors); + const FontFaceDescriptors* descriptors) { + FontFace* font_face = + MakeGarbageCollected<FontFace>(context, family, descriptors); font_face->InitCSSFontFace(static_cast<const unsigned char*>(source->Data()), source->ByteLength()); return font_face; @@ -165,8 +147,9 @@ FontFace* FontFace::Create(ExecutionContext* context, FontFace* FontFace::Create(ExecutionContext* context, const AtomicString& family, DOMArrayBufferView* source, - const FontFaceDescriptors& descriptors) { - FontFace* font_face = new FontFace(context, family, descriptors); + const FontFaceDescriptors* descriptors) { + FontFace* font_face = + MakeGarbageCollected<FontFace>(context, family, descriptors); font_face->InitCSSFontFace( static_cast<const unsigned char*>(source->BaseAddress()), source->byteLength()); @@ -186,7 +169,7 @@ FontFace* FontFace::Create(Document* document, if (!src || !src->IsValueList()) return nullptr; - FontFace* font_face = new FontFace(document); + FontFace* font_face = MakeGarbageCollected<FontFace>(document); if (font_face->SetFamilyValue(*family) && font_face->SetPropertyFromStyle(properties, @@ -216,21 +199,21 @@ FontFace::FontFace(ExecutionContext* context) FontFace::FontFace(ExecutionContext* context, const AtomicString& family, - const FontFaceDescriptors& descriptors) + const FontFaceDescriptors* descriptors) : ContextClient(context), family_(family), status_(kUnloaded) { - SetPropertyFromString(context, descriptors.style(), + SetPropertyFromString(context, descriptors->style(), AtRuleDescriptorID::FontStyle); - SetPropertyFromString(context, descriptors.weight(), + SetPropertyFromString(context, descriptors->weight(), AtRuleDescriptorID::FontWeight); - SetPropertyFromString(context, descriptors.stretch(), + SetPropertyFromString(context, descriptors->stretch(), AtRuleDescriptorID::FontStretch); - SetPropertyFromString(context, descriptors.unicodeRange(), + SetPropertyFromString(context, descriptors->unicodeRange(), AtRuleDescriptorID::UnicodeRange); - SetPropertyFromString(context, descriptors.variant(), + SetPropertyFromString(context, descriptors->variant(), AtRuleDescriptorID::FontVariant); - SetPropertyFromString(context, descriptors.featureSettings(), + SetPropertyFromString(context, descriptors->featureSettings(), AtRuleDescriptorID::FontFeatureSettings); - SetPropertyFromString(context, descriptors.display(), + SetPropertyFromString(context, descriptors->display(), AtRuleDescriptorID::FontDisplay); } @@ -379,22 +362,22 @@ bool FontFace::SetFamilyValue(const CSSValue& family_value) { // types. switch (ToCSSIdentifierValue(family_value).GetValueID()) { case CSSValueSerif: - family = FontFamilyNames::webkit_serif; + family = font_family_names::kWebkitSerif; break; case CSSValueSansSerif: - family = FontFamilyNames::webkit_sans_serif; + family = font_family_names::kWebkitSansSerif; break; case CSSValueCursive: - family = FontFamilyNames::webkit_cursive; + family = font_family_names::kWebkitCursive; break; case CSSValueFantasy: - family = FontFamilyNames::webkit_fantasy; + family = font_family_names::kWebkitFantasy; break; case CSSValueMonospace: - family = FontFamilyNames::webkit_monospace; + family = font_family_names::kWebkitMonospace; break; case CSSValueWebkitPictograph: - family = FontFamilyNames::webkit_pictograph; + family = font_family_names::kWebkitPictograph; break; default: return false; @@ -725,19 +708,21 @@ void FontFace::InitCSSFontFace(ExecutionContext* context, const CSSValue& src) { FontSelector* font_selector = nullptr; if (auto* document = DynamicTo<Document>(context)) { font_selector = document->GetStyleEngine().GetFontSelector(); - } else if (context->IsWorkerGlobalScope()) { - font_selector = ToWorkerGlobalScope(context)->GetFontSelector(); + } else if (auto* scope = DynamicTo<WorkerGlobalScope>(context)) { + font_selector = scope->GetFontSelector(); } else { NOTREACHED(); } RemoteFontFaceSource* source = - new RemoteFontFaceSource(css_font_face_, font_selector, - CSSValueToFontDisplay(display_.Get())); + MakeGarbageCollected<RemoteFontFaceSource>( + css_font_face_, font_selector, + CSSValueToFontDisplay(display_.Get())); item.Fetch(context, source); css_font_face_->AddSource(source); } } else { - css_font_face_->AddSource(new LocalFontFaceSource(item.GetResource())); + css_font_face_->AddSource( + MakeGarbageCollected<LocalFontFaceSource>(item.GetResource())); } } @@ -789,4 +774,13 @@ bool FontFace::HasPendingActivity() const { return status_ == kLoading && GetExecutionContext(); } +FontDisplay FontFace::GetFontDisplayWithFallback() const { + if (display_) + return CSSValueToFontDisplay(display_.Get()); + ExecutionContext* context = GetExecutionContext(); + if (!context || !context->IsDocument()) + return kFontDisplayAuto; + return To<Document>(context)->GetStyleEngine().GetDefaultFontDisplay(family_); +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/font_face.h b/chromium/third_party/blink/renderer/core/css/font_face.h index 05ec831413d..6669a2e5d40 100644 --- a/chromium/third_party/blink/renderer/core/css/font_face.h +++ b/chromium/third_party/blink/renderer/core/css/font_face.h @@ -36,6 +36,7 @@ #include "third_party/blink/renderer/bindings/core/v8/script_promise.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise_property.h" #include "third_party/blink/renderer/core/css/css_value.h" +#include "third_party/blink/renderer/core/css/font_display.h" #include "third_party/blink/renderer/core/css/parser/at_rule_descriptors.h" #include "third_party/blink/renderer/core/dom/context_lifecycle_observer.h" #include "third_party/blink/renderer/core/dom/dom_exception.h" @@ -68,9 +69,13 @@ class CORE_EXPORT FontFace : public ScriptWrappable, static FontFace* Create(ExecutionContext*, const AtomicString& family, StringOrArrayBufferOrArrayBufferView&, - const FontFaceDescriptors&); + const FontFaceDescriptors*); static FontFace* Create(Document*, const StyleRuleFontFace*); + explicit FontFace(ExecutionContext*); + FontFace(ExecutionContext*, + const AtomicString& family, + const FontFaceDescriptors*); ~FontFace() override; const AtomicString& family() const { return family_; } @@ -108,6 +113,9 @@ class CORE_EXPORT FontFace : public ScriptWrappable, FontSelectionCapabilities GetFontSelectionCapabilities() const; CSSFontFace* CssFontFace() { return css_font_face_.Get(); } size_t ApproximateBlankCharacterCount() const; + // Return FontDisplay using the default from @font-feature-values if not + // specified on this FontFace. + FontDisplay GetFontDisplayWithFallback() const; void Trace(blink::Visitor*) override; @@ -130,20 +138,15 @@ class CORE_EXPORT FontFace : public ScriptWrappable, static FontFace* Create(ExecutionContext*, const AtomicString& family, DOMArrayBuffer* source, - const FontFaceDescriptors&); + const FontFaceDescriptors*); static FontFace* Create(ExecutionContext*, const AtomicString& family, DOMArrayBufferView*, - const FontFaceDescriptors&); + const FontFaceDescriptors*); static FontFace* Create(ExecutionContext*, const AtomicString& family, const String& source, - const FontFaceDescriptors&); - - explicit FontFace(ExecutionContext*); - FontFace(ExecutionContext*, - const AtomicString& family, - const FontFaceDescriptors&); + const FontFaceDescriptors*); void InitCSSFontFace(ExecutionContext*, const CSSValue& src); void InitCSSFontFace(const unsigned char* data, size_t); diff --git a/chromium/third_party/blink/renderer/core/css/font_face_cache.cc b/chromium/third_party/blink/renderer/core/css/font_face_cache.cc index 68c4e3cb9aa..0e434aba849 100644 --- a/chromium/third_party/blink/renderer/core/css/font_face_cache.cc +++ b/chromium/third_party/blink/renderer/core/css/font_face_cache.cc @@ -51,8 +51,10 @@ void FontFaceCache::AddFontFace(FontFace* font_face, bool css_connected) { SegmentedFacesByFamily::AddResult capabilities_result = segmented_faces_.insert(font_face->family(), nullptr); - if (capabilities_result.is_new_entry) - capabilities_result.stored_value->value = new CapabilitiesSet(); + if (capabilities_result.is_new_entry) { + capabilities_result.stored_value->value = + MakeGarbageCollected<CapabilitiesSet>(); + } DCHECK(font_face->GetFontSelectionCapabilities().IsValid() && !font_face->GetFontSelectionCapabilities().IsHashTableDeletedValue()); @@ -156,8 +158,8 @@ CSSSegmentedFontFace* FontFaceCache::Get( // Either add or retrieve a cache entry in the selection query cache for the // specified family. FontSelectionQueryCache::AddResult cache_entry_for_family_add = - font_selection_query_cache_.insert(family, - new FontSelectionQueryResult()); + font_selection_query_cache_.insert( + family, MakeGarbageCollected<FontSelectionQueryResult>()); auto cache_entry_for_family = cache_entry_for_family_add.stored_value->value; const FontSelectionRequest& request = diff --git a/chromium/third_party/blink/renderer/core/css/font_face_set.cc b/chromium/third_party/blink/renderer/core/css/font_face_set.cc index 2c3ab8ebdc6..d67753bbdfa 100644 --- a/chromium/third_party/blink/renderer/core/css/font_face_set.cc +++ b/chromium/third_party/blink/renderer/core/css/font_face_set.cc @@ -39,7 +39,7 @@ void FontFaceSet::FireLoadingEvent() { if (should_fire_loading_event_) { should_fire_loading_event_ = false; DispatchEvent( - *FontFaceSetLoadEvent::CreateForFontFaces(EventTypeNames::loading)); + *FontFaceSetLoadEvent::CreateForFontFaces(event_type_names::kLoading)); } } @@ -236,11 +236,11 @@ void FontFaceSet::FireDoneEvent() { FontFaceSetLoadEvent* done_event = nullptr; FontFaceSetLoadEvent* error_event = nullptr; done_event = FontFaceSetLoadEvent::CreateForFontFaces( - EventTypeNames::loadingdone, loaded_fonts_); + event_type_names::kLoadingdone, loaded_fonts_); loaded_fonts_.clear(); if (!failed_fonts_.IsEmpty()) { error_event = FontFaceSetLoadEvent::CreateForFontFaces( - EventTypeNames::loadingerror, failed_fonts_); + event_type_names::kLoadingerror, failed_fonts_); failed_fonts_.clear(); } is_loading_ = false; @@ -308,7 +308,7 @@ FontFaceSetIterable::IterationSource* FontFaceSet::StartIteration( for (const auto& font_face : non_css_connected_faces_) font_faces.push_back(font_face); } - return new IterationSource(font_faces); + return MakeGarbageCollected<IterationSource>(font_faces); } } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/font_face_set.h b/chromium/third_party/blink/renderer/core/css/font_face_set.h index 5568339a66c..b56e097baf1 100644 --- a/chromium/third_party/blink/renderer/core/css/font_face_set.h +++ b/chromium/third_party/blink/renderer/core/css/font_face_set.h @@ -51,9 +51,9 @@ class CORE_EXPORT FontFaceSet : public EventTargetWithInlineData, context.GetTaskRunner(TaskType::kInternalDefault))) {} ~FontFaceSet() override = default; - DEFINE_ATTRIBUTE_EVENT_LISTENER(loading); - DEFINE_ATTRIBUTE_EVENT_LISTENER(loadingdone); - DEFINE_ATTRIBUTE_EVENT_LISTENER(loadingerror); + DEFINE_ATTRIBUTE_EVENT_LISTENER(loading, kLoading); + DEFINE_ATTRIBUTE_EVENT_LISTENER(loadingdone, kLoadingdone); + DEFINE_ATTRIBUTE_EVENT_LISTENER(loadingerror, kLoadingerror); bool check(const String& font, const String& text, ExceptionState&); ScriptPromise load(ScriptState*, const String& font, const String& text); @@ -64,7 +64,7 @@ class CORE_EXPORT FontFaceSet : public EventTargetWithInlineData, } const AtomicString& InterfaceName() const override { - return EventTargetNames::FontFaceSet; + return event_target_names::kFontFaceSet; } FontFaceSet* addForBinding(ScriptState*, FontFace*, ExceptionState&); @@ -146,7 +146,14 @@ class CORE_EXPORT FontFaceSet : public EventTargetWithInlineData, public: static LoadFontPromiseResolver* Create(FontFaceArray faces, ScriptState* script_state) { - return new LoadFontPromiseResolver(faces, script_state); + return MakeGarbageCollected<LoadFontPromiseResolver>(faces, script_state); + } + + LoadFontPromiseResolver(FontFaceArray faces, ScriptState* script_state) + : num_loading_(faces.size()), + error_occured_(false), + resolver_(ScriptPromiseResolver::Create(script_state)) { + font_faces_.swap(faces); } void LoadFonts(); @@ -158,13 +165,6 @@ class CORE_EXPORT FontFaceSet : public EventTargetWithInlineData, void Trace(blink::Visitor*) override; private: - LoadFontPromiseResolver(FontFaceArray faces, ScriptState* script_state) - : num_loading_(faces.size()), - error_occured_(false), - resolver_(ScriptPromiseResolver::Create(script_state)) { - font_faces_.swap(faces); - } - HeapVector<Member<FontFace>> font_faces_; int num_loading_; bool error_occured_; diff --git a/chromium/third_party/blink/renderer/core/css/font_face_set_document.h b/chromium/third_party/blink/renderer/core/css/font_face_set_document.h index b1ff2d832bd..0ced9aaa9fc 100644 --- a/chromium/third_party/blink/renderer/core/css/font_face_set_document.h +++ b/chromium/third_party/blink/renderer/core/css/font_face_set_document.h @@ -52,6 +52,7 @@ class CORE_EXPORT FontFaceSetDocument final : public FontFaceSet, public: static const char kSupplementName[]; + explicit FontFaceSetDocument(Document&); ~FontFaceSetDocument() override; ScriptPromise ready(ScriptState*) override; @@ -85,11 +86,9 @@ class CORE_EXPORT FontFaceSetDocument final : public FontFaceSet, private: static FontFaceSetDocument* Create(Document& document) { - return new FontFaceSetDocument(document); + return MakeGarbageCollected<FontFaceSetDocument>(document); } - explicit FontFaceSetDocument(Document&); - void FireDoneEventIfPossible() override; const HeapLinkedHashSet<Member<FontFace>>& CSSConnectedFontFaceList() const override; diff --git a/chromium/third_party/blink/renderer/core/css/font_face_set_load_event.cc b/chromium/third_party/blink/renderer/core/css/font_face_set_load_event.cc index 5fcb64bf46b..7ecec065917 100644 --- a/chromium/third_party/blink/renderer/core/css/font_face_set_load_event.cc +++ b/chromium/third_party/blink/renderer/core/css/font_face_set_load_event.cc @@ -30,6 +30,8 @@ #include "third_party/blink/renderer/core/css/font_face_set_load_event.h" +#include "third_party/blink/renderer/core/event_interface_names.h" + namespace blink { FontFaceSetLoadEvent::FontFaceSetLoadEvent(const AtomicString& type, @@ -38,13 +40,13 @@ FontFaceSetLoadEvent::FontFaceSetLoadEvent(const AtomicString& type, FontFaceSetLoadEvent::FontFaceSetLoadEvent( const AtomicString& type, - const FontFaceSetLoadEventInit& initializer) - : Event(type, initializer), fontfaces_(initializer.fontfaces()) {} + const FontFaceSetLoadEventInit* initializer) + : Event(type, initializer), fontfaces_(initializer->fontfaces()) {} FontFaceSetLoadEvent::~FontFaceSetLoadEvent() = default; const AtomicString& FontFaceSetLoadEvent::InterfaceName() const { - return EventNames::FontFaceSetLoadEvent; + return event_interface_names::kFontFaceSetLoadEvent; } void FontFaceSetLoadEvent::Trace(blink::Visitor* visitor) { diff --git a/chromium/third_party/blink/renderer/core/css/font_face_set_load_event.h b/chromium/third_party/blink/renderer/core/css/font_face_set_load_event.h index b1c302791bb..ca012ca0c24 100644 --- a/chromium/third_party/blink/renderer/core/css/font_face_set_load_event.h +++ b/chromium/third_party/blink/renderer/core/css/font_face_set_load_event.h @@ -44,16 +44,18 @@ class FontFaceSetLoadEvent final : public Event { public: static FontFaceSetLoadEvent* Create( const AtomicString& type, - const FontFaceSetLoadEventInit& initializer) { - return new FontFaceSetLoadEvent(type, initializer); + const FontFaceSetLoadEventInit* initializer) { + return MakeGarbageCollected<FontFaceSetLoadEvent>(type, initializer); } static FontFaceSetLoadEvent* CreateForFontFaces( const AtomicString& type, const FontFaceArray& fontfaces = FontFaceArray()) { - return new FontFaceSetLoadEvent(type, fontfaces); + return MakeGarbageCollected<FontFaceSetLoadEvent>(type, fontfaces); } + FontFaceSetLoadEvent(const AtomicString&, const FontFaceArray&); + FontFaceSetLoadEvent(const AtomicString&, const FontFaceSetLoadEventInit*); ~FontFaceSetLoadEvent() override; FontFaceArray fontfaces() const { return fontfaces_; } @@ -63,9 +65,6 @@ class FontFaceSetLoadEvent final : public Event { void Trace(blink::Visitor*) override; private: - FontFaceSetLoadEvent(const AtomicString&, const FontFaceArray&); - FontFaceSetLoadEvent(const AtomicString&, const FontFaceSetLoadEventInit&); - FontFaceArray fontfaces_; }; diff --git a/chromium/third_party/blink/renderer/core/css/font_face_set_worker.cc b/chromium/third_party/blink/renderer/core/css/font_face_set_worker.cc index c65f6ab466b..5e7ee27f0fb 100644 --- a/chromium/third_party/blink/renderer/core/css/font_face_set_worker.cc +++ b/chromium/third_party/blink/renderer/core/css/font_face_set_worker.cc @@ -32,7 +32,7 @@ FontFaceSetWorker::FontFaceSetWorker(WorkerGlobalScope& worker) FontFaceSetWorker::~FontFaceSetWorker() = default; WorkerGlobalScope* FontFaceSetWorker::GetWorker() const { - return ToWorkerGlobalScope(GetExecutionContext()); + return To<WorkerGlobalScope>(GetExecutionContext()); } AtomicString FontFaceSetWorker::status() const { diff --git a/chromium/third_party/blink/renderer/core/css/font_face_set_worker.h b/chromium/third_party/blink/renderer/core/css/font_face_set_worker.h index 63c8734a29b..f56d7f2903a 100644 --- a/chromium/third_party/blink/renderer/core/css/font_face_set_worker.h +++ b/chromium/third_party/blink/renderer/core/css/font_face_set_worker.h @@ -29,6 +29,7 @@ class CORE_EXPORT FontFaceSetWorker final public: static const char kSupplementName[]; + explicit FontFaceSetWorker(WorkerGlobalScope&); ~FontFaceSetWorker() override; ScriptPromise ready(ScriptState*) override; @@ -65,11 +66,9 @@ class CORE_EXPORT FontFaceSetWorker final private: static FontFaceSetWorker* Create(WorkerGlobalScope& worker) { - return new FontFaceSetWorker(worker); + return MakeGarbageCollected<FontFaceSetWorker>(worker); } - explicit FontFaceSetWorker(WorkerGlobalScope&); - void FireDoneEventIfPossible() override; DISALLOW_COPY_AND_ASSIGN(FontFaceSetWorker); }; diff --git a/chromium/third_party/blink/renderer/core/css/html.css b/chromium/third_party/blink/renderer/core/css/html.css deleted file mode 100644 index 9ad329ba565..00000000000 --- a/chromium/third_party/blink/renderer/core/css/html.css +++ /dev/null @@ -1,1152 +0,0 @@ -/* - * The default style sheet used to render HTML. - * - * Copyright (C) 2000 Lars Knoll (knoll@kde.org) - * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -@namespace "http://www.w3.org/1999/xhtml"; - -html { - display: block -} - -/* children of the <head> element all have display:none */ -head { - display: none -} - -meta { - display: none -} - -title { - display: none -} - -link { - display: none -} - -style { - display: none -} - -script { - display: none -} - -/* generic block-level elements */ - -body { - display: block; - margin: 8px -} - -body:-webkit-full-page-media { - background-color: rgb(0, 0, 0) -} - -p { - display: block; - -webkit-margin-before: 1__qem; - -webkit-margin-after: 1__qem; - -webkit-margin-start: 0; - -webkit-margin-end: 0; -} - -div { - display: block -} - -layer { - display: block -} - -article, aside, footer, header, hgroup, main, nav, section { - display: block -} - -marquee { - display: inline-block; - width: -webkit-fill-available; -} - -address { - display: block -} - -blockquote { - display: block; - -webkit-margin-before: 1__qem; - -webkit-margin-after: 1em; - -webkit-margin-start: 40px; - -webkit-margin-end: 40px; -} - -figcaption { - display: block -} - -figure { - display: block; - -webkit-margin-before: 1em; - -webkit-margin-after: 1em; - -webkit-margin-start: 40px; - -webkit-margin-end: 40px; -} - -q { - display: inline -} - -q:before { - content: open-quote; -} - -q:after { - content: close-quote; -} - -center { - display: block; - /* special centering to be able to emulate the html4/netscape behaviour */ - text-align: -webkit-center -} - -hr { - display: block; - overflow: hidden; - unicode-bidi: isolate; - -webkit-margin-before: 0.5em; - -webkit-margin-after: 0.5em; - -webkit-margin-start: auto; - -webkit-margin-end: auto; - border-style: inset; - border-width: 1px -} - -map { - display: inline -} - -video { - object-fit: contain; -} - -/* heading elements */ - -h1 { - display: block; - font-size: 2em; - -webkit-margin-before: 0.67__qem; - -webkit-margin-after: 0.67em; - -webkit-margin-start: 0; - -webkit-margin-end: 0; - font-weight: bold -} - -:-webkit-any(article,aside,nav,section) h1 { - font-size: 1.5em; - -webkit-margin-before: 0.83__qem; - -webkit-margin-after: 0.83em; -} - -:-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) h1 { - font-size: 1.17em; - -webkit-margin-before: 1__qem; - -webkit-margin-after: 1em; -} - -:-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) h1 { - font-size: 1.00em; - -webkit-margin-before: 1.33__qem; - -webkit-margin-after: 1.33em; -} - -:-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) h1 { - font-size: .83em; - -webkit-margin-before: 1.67__qem; - -webkit-margin-after: 1.67em; -} - -:-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) h1 { - font-size: .67em; - -webkit-margin-before: 2.33__qem; - -webkit-margin-after: 2.33em; -} - -h2 { - display: block; - font-size: 1.5em; - -webkit-margin-before: 0.83__qem; - -webkit-margin-after: 0.83em; - -webkit-margin-start: 0; - -webkit-margin-end: 0; - font-weight: bold -} - -h3 { - display: block; - font-size: 1.17em; - -webkit-margin-before: 1__qem; - -webkit-margin-after: 1em; - -webkit-margin-start: 0; - -webkit-margin-end: 0; - font-weight: bold -} - -h4 { - display: block; - -webkit-margin-before: 1.33__qem; - -webkit-margin-after: 1.33em; - -webkit-margin-start: 0; - -webkit-margin-end: 0; - font-weight: bold -} - -h5 { - display: block; - font-size: .83em; - -webkit-margin-before: 1.67__qem; - -webkit-margin-after: 1.67em; - -webkit-margin-start: 0; - -webkit-margin-end: 0; - font-weight: bold -} - -h6 { - display: block; - font-size: .67em; - -webkit-margin-before: 2.33__qem; - -webkit-margin-after: 2.33em; - -webkit-margin-start: 0; - -webkit-margin-end: 0; - font-weight: bold -} - -/* tables */ - -table { - display: table; - border-collapse: separate; - border-spacing: 2px; - border-color: gray -} - -thead { - display: table-header-group; - vertical-align: middle; - border-color: inherit -} - -tbody { - display: table-row-group; - vertical-align: middle; - border-color: inherit -} - -tfoot { - display: table-footer-group; - vertical-align: middle; - border-color: inherit -} - -/* for tables without table section elements (can happen with XHTML or dynamically created tables) */ -table > tr { - vertical-align: middle; -} - -col { - display: table-column -} - -colgroup { - display: table-column-group -} - -tr { - display: table-row; - vertical-align: inherit; - border-color: inherit -} - -td, th { - display: table-cell; - vertical-align: inherit -} - -th { - font-weight: bold; - text-align: -internal-center -} - -caption { - display: table-caption; - text-align: -webkit-center -} - -/* lists */ - -ul, menu, dir { - display: block; - list-style-type: disc; - -webkit-margin-before: 1__qem; - -webkit-margin-after: 1em; - -webkit-margin-start: 0; - -webkit-margin-end: 0; - -webkit-padding-start: 40px -} - -ol { - display: block; - list-style-type: decimal; - -webkit-margin-before: 1__qem; - -webkit-margin-after: 1em; - -webkit-margin-start: 0; - -webkit-margin-end: 0; - -webkit-padding-start: 40px -} - -li { - display: list-item; - text-align: -webkit-match-parent; -} - -ul ul, ol ul { - list-style-type: circle -} - -ol ol ul, ol ul ul, ul ol ul, ul ul ul { - list-style-type: square -} - -dd { - display: block; - -webkit-margin-start: 40px -} - -dl { - display: block; - -webkit-margin-before: 1__qem; - -webkit-margin-after: 1em; - -webkit-margin-start: 0; - -webkit-margin-end: 0; -} - -dt { - display: block -} - -ol ul, ul ol, ul ul, ol ol { - -webkit-margin-before: 0; - -webkit-margin-after: 0 -} - -/* form elements */ - -form { - display: block; - margin-top: 0__qem; -} - -:-webkit-any(table, thead, tbody, tfoot, tr) > form:-internal-is-html { - display: none !important; -} - -label { - cursor: default; -} - -legend { - display: block; - -webkit-padding-start: 2px; - -webkit-padding-end: 2px; - border: none -} - -fieldset { - display: block; - -webkit-margin-start: 2px; - -webkit-margin-end: 2px; - -webkit-padding-before: 0.35em; - -webkit-padding-start: 0.75em; - -webkit-padding-end: 0.75em; - -webkit-padding-after: 0.625em; - border: 2px groove ThreeDFace; - min-inline-size: min-content; -} - -button { - -webkit-appearance: button; -} - -/* Form controls don't go vertical. */ -input, textarea, select, button, meter, progress { - -webkit-writing-mode: horizontal-tb !important; -} - -input, textarea, select, button { - margin: 0__qem; - font: -webkit-small-control; - text-rendering: auto; /* FIXME: Remove when tabs work with optimizeLegibility. */ - color: initial; - letter-spacing: normal; - word-spacing: normal; - line-height: normal; - text-transform: none; - text-indent: 0; - text-shadow: none; - display: inline-block; - text-align: start; -} - -input[type="hidden" i] { - display: none -} - -input { - -webkit-appearance: textfield; - padding: 1px; - background-color: white; - border: 2px inset; - -webkit-rtl-ordering: logical; - cursor: text; -} - -input[type="search" i] { - -webkit-appearance: searchfield; - box-sizing: border-box; -} - -input::-webkit-textfield-decoration-container { - display: flex; - align-items: center; - -webkit-user-modify: read-only !important; - content: none !important; -} - -input::-webkit-clear-button { - -webkit-appearance: searchfield-cancel-button; - display: inline-block; - cursor: default; - flex: none; - -webkit-user-modify: read-only !important; - -webkit-margin-start: 2px; - opacity: 0; - pointer-events: none; -} - -input:enabled:read-write:-webkit-any(:focus,:hover)::-webkit-clear-button { - opacity: 1; - pointer-events: auto; -} - -input[type="search" i]::-webkit-search-cancel-button { - -webkit-appearance: searchfield-cancel-button; - display: block; - cursor: default; - flex: none; - -webkit-user-modify: read-only !important; - -webkit-margin-start: 1px; - opacity: 0; - pointer-events: none; - user-select: none !important; -} - -input[type="search" i]:enabled:read-write:-webkit-any(:focus,:hover)::-webkit-search-cancel-button { - opacity: 1; - pointer-events: auto; -} - -input::-webkit-inner-spin-button { - -webkit-appearance: inner-spin-button; - display: inline-block; - cursor: default; - flex: none; - align-self: stretch; - -webkit-user-modify: read-only !important; - opacity: 0; - pointer-events: none; -} - -input:enabled:read-write:-webkit-any(:focus,:hover)::-webkit-inner-spin-button { - opacity: 1; - pointer-events: auto; -} - -select { - border-radius: 5px; -} - -textarea { - -webkit-appearance: textarea; - background-color: white; - border: 1px solid; - -webkit-rtl-ordering: logical; - flex-direction: column; - resize: auto; - cursor: text; - padding: 2px; - white-space: pre-wrap; - word-wrap: break-word; -} - -::-webkit-input-placeholder { - -webkit-text-security: none; - color: #757575; - pointer-events: none !important; -} - -input::-webkit-input-placeholder { - text-overflow: inherit; - line-height: initial; - white-space: pre; - word-wrap: normal; - overflow: hidden; - -webkit-user-modify: read-only !important; -} - -input::-internal-input-suggested { - text-overflow: inherit; - white-space: nowrap; - overflow: hidden; -} - -input[type="password" i] { - -webkit-text-security: disc !important; -} - -input[type="password" i]::-internal-input-suggested { - -webkit-text-security: disc !important; -} - -input[type="hidden" i], input[type="image" i], input[type="file" i] { - -webkit-appearance: initial; - padding: initial; - background-color: initial; - border: initial; - cursor: default; -} - -input[type="file" i] { - align-items: baseline; - color: inherit; - text-align: start !important; -} - -input[type="image" i] { - cursor: pointer; -} - -input[type="radio" i], input[type="checkbox" i] { - margin: 3px 0.5ex; - padding: initial; - background-color: initial; - border: initial; - cursor: default; -} - -input[type="button" i], input[type="submit" i], input[type="reset" i] { - -webkit-appearance: push-button; - -webkit-user-select: none; - white-space: pre -} - -input[type="file" i]::-webkit-file-upload-button { - -webkit-appearance: push-button; - -webkit-user-modify: read-only !important; - white-space: nowrap; - margin: 0; - font-size: inherit; -} - -input[type="button" i], input[type="submit" i], input[type="reset" i], input[type="file" i]::-webkit-file-upload-button, button { - align-items: flex-start; - text-align: center; - cursor: default; - color: ButtonText; - padding: 2px 6px 3px 6px; - border: 2px outset ButtonFace; - background-color: ButtonFace; - box-sizing: border-box -} - -input[type="range" i] { - -webkit-appearance: slider-horizontal; - padding: initial; - border: initial; - margin: 2px; - color: #909090; - cursor: default; -} - -input[type="range" i]::-webkit-slider-container, input[type="range" i]::-webkit-media-slider-container { - -webkit-appearance: inherit; - flex: 1; - min-width: 0; - box-sizing: border-box; - -webkit-user-modify: read-only !important; - display: flex; -} - -input[type="range" i]::-webkit-slider-runnable-track { - flex: 1; - min-width: 0; - -webkit-align-self: center; - - box-sizing: border-box; - -webkit-user-modify: read-only !important; - display: block; -} - -input[type="range" i]::-webkit-slider-thumb, input[type="range" i]::-webkit-media-slider-thumb { - -webkit-appearance: sliderthumb-horizontal; - box-sizing: border-box; - -webkit-user-modify: read-only !important; - display: block; -} - -input[type="button" i]:disabled, input[type="submit" i]:disabled, input[type="reset" i]:disabled, -input[type="file" i]:disabled::-webkit-file-upload-button, button:disabled, -select:disabled, optgroup:disabled, option:disabled, -select[disabled]>option { - color: GrayText -} - -input[type="button" i]:active, input[type="submit" i]:active, input[type="reset" i]:active, input[type="file" i]:active::-webkit-file-upload-button, button:active { - border-style: inset -} - -input[type="button" i]:active:disabled, input[type="submit" i]:active:disabled, input[type="reset" i]:active:disabled, input[type="file" i]:active:disabled::-webkit-file-upload-button, button:active:disabled { - border-style: outset -} - -input:disabled, textarea:disabled { - color: #545454; - cursor: default; -} - -option:-internal-spatial-navigation-focus { - outline: black dashed 1px; - outline-offset: -1px; -} - -datalist { - display: none -} - -area { - display: inline; - cursor: pointer; -} - -param { - display: none -} - -input[type="checkbox" i] { - -webkit-appearance: checkbox; - box-sizing: border-box; -} - -input[type="radio" i] { - -webkit-appearance: radio; - box-sizing: border-box; -} - -input[type="color" i] { - -webkit-appearance: square-button; - width: 44px; - height: 23px; - background-color: ButtonFace; - /* Same as native_theme_base. */ - border: 1px #a9a9a9 solid; - padding: 1px 2px; - cursor: default; -} - -input[type="color" i]::-webkit-color-swatch-wrapper { - display:flex; - padding: 4px 2px; - box-sizing: border-box; - -webkit-user-modify: read-only !important; - width: 100%; - height: 100% -} - -input[type="color" i]::-webkit-color-swatch { - background-color: #000000; - border: 1px solid #777777; - flex: 1; - min-width: 0; - -webkit-user-modify: read-only !important; -} - -input[type="color" i][list] { - -webkit-appearance: menulist; - width: 88px; - height: 23px -} - -input[type="color" i][list]::-webkit-color-swatch-wrapper { - -webkit-padding-start: 8px; - -webkit-padding-end: 24px; -} - -input[type="color" i][list]::-webkit-color-swatch { - border-color: #000000; -} - -input::-webkit-calendar-picker-indicator { - display: inline-block; - width: 0.66em; - height: 0.66em; - padding: 0.17em 0.34em; - -webkit-user-modify: read-only !important; - opacity: 0; - cursor: default; - pointer-events: none; -} - -input::-webkit-calendar-picker-indicator:hover { - background-color: #eee; -} - -input:enabled:read-write:-webkit-any(:focus,:hover)::-webkit-calendar-picker-indicator, -input::-webkit-calendar-picker-indicator:focus { - opacity: 1; - pointer-events: auto; -} - -input[type="date" i]:disabled::-webkit-clear-button, -input[type="date" i]:disabled::-webkit-inner-spin-button, -input[type="datetime-local" i]:disabled::-webkit-clear-button, -input[type="datetime-local" i]:disabled::-webkit-inner-spin-button, -input[type="month" i]:disabled::-webkit-clear-button, -input[type="month" i]:disabled::-webkit-inner-spin-button, -input[type="week" i]:disabled::-webkit-clear-button, -input[type="week" i]:disabled::-webkit-inner-spin-button, -input:disabled::-webkit-calendar-picker-indicator, -input[type="date" i][readonly]::-webkit-clear-button, -input[type="date" i][readonly]::-webkit-inner-spin-button, -input[type="datetime-local" i][readonly]::-webkit-clear-button, -input[type="datetime-local" i][readonly]::-webkit-inner-spin-button, -input[type="month" i][readonly]::-webkit-clear-button, -input[type="month" i][readonly]::-webkit-inner-spin-button, -input[type="week" i][readonly]::-webkit-clear-button, -input[type="week" i][readonly]::-webkit-inner-spin-button, -input[readonly]::-webkit-calendar-picker-indicator { - visibility: hidden; -} - -select { - -webkit-appearance: menulist; - box-sizing: border-box; - align-items: center; - border: 1px solid; - white-space: pre; - -webkit-rtl-ordering: logical; - color: black; - background-color: white; - cursor: default; -} - -select:not(:-internal-list-box) { - overflow: visible !important; -} - -select:-internal-list-box { - -webkit-appearance: listbox; - align-items: flex-start; - border: 1px inset gray; - border-radius: initial; - overflow-x: hidden; - overflow-y: scroll; - vertical-align: text-bottom; - white-space: nowrap; -} - -optgroup { - font-weight: bolder; - display: block; -} - -option { - font-weight: normal; - display: block; - padding: 0 2px 1px 2px; - white-space: pre; - min-height: 1.2em; -} - -select:-internal-list-box optgroup option:before { - content: "\00a0\00a0\00a0\00a0";; -} - -select:-internal-list-box option, -select:-internal-list-box optgroup { - line-height: initial !important; -} - -select:-internal-list-box:focus option:checked { - background-color: -internal-active-list-box-selection !important; - color: -internal-active-list-box-selection-text !important; -} - -select:-internal-list-box:focus option:checked:disabled { - background-color: -internal-inactive-list-box-selection !important; -} - -select:-internal-list-box option:checked { - background-color: -internal-inactive-list-box-selection !important; - color: -internal-inactive-list-box-selection-text !important; -} - -select:-internal-list-box:disabled option:checked, -select:-internal-list-box option:checked:disabled { - color: gray !important; -} - -select:-internal-list-box hr { - border-style: none; - -webkit-margin-before: 0.5em; - -webkit-margin-after: 0; -} - -output { - display: inline; -} - -/* meter */ - -meter { - -webkit-appearance: meter; - box-sizing: border-box; - display: inline-block; - height: 1em; - width: 5em; - vertical-align: -0.2em; - -webkit-user-modify: read-only !important; -} - -meter::-webkit-meter-inner-element { - -webkit-appearance: inherit; - box-sizing: inherit; - display: none; - -webkit-user-modify: read-only !important; - height: 100%; - width: 100%; -} - -meter::-webkit-meter-inner-element:-internal-shadow-host-has-appearance { - display: block; -} - -meter::-internal-fallback:-internal-shadow-host-has-appearance { - display: none; -} - -meter::-webkit-meter-bar { - background: linear-gradient(to bottom, #ddd, #eee 20%, #ccc 45%, #ccc 55%, #ddd); - height: 100%; - width: 100%; - -webkit-user-modify: read-only !important; - box-sizing: border-box; -} - -meter::-webkit-meter-optimum-value { - background: linear-gradient(to bottom, #ad7, #cea 20%, #7a3 45%, #7a3 55%, #ad7); - height: 100%; - -webkit-user-modify: read-only !important; - box-sizing: border-box; -} - -meter::-webkit-meter-suboptimum-value { - background: linear-gradient(to bottom, #fe7, #ffc 20%, #db3 45%, #db3 55%, #fe7); - height: 100%; - -webkit-user-modify: read-only !important; - box-sizing: border-box; -} - -meter::-webkit-meter-even-less-good-value { - background: linear-gradient(to bottom, #f77, #fcc 20%, #d44 45%, #d44 55%, #f77); - height: 100%; - -webkit-user-modify: read-only !important; - box-sizing: border-box; -} - -/* progress */ - -progress { - -webkit-appearance: progress-bar; - box-sizing: border-box; - display: inline-block; - height: 1em; - width: 10em; - vertical-align: -0.2em; -} - -progress::-webkit-progress-inner-element { - box-sizing: inherit; - -webkit-user-modify: read-only; - height: 100%; - width: 100%; -} - -progress::-webkit-progress-bar { - background-color: gray; - height: 100%; - width: 100%; - -webkit-user-modify: read-only !important; - box-sizing: border-box; -} - -progress::-webkit-progress-value { - background-color: green; - height: 100%; - width: 50%; /* should be removed later */ - -webkit-user-modify: read-only !important; - box-sizing: border-box; -} - -/* inline elements */ - -u, ins { - text-decoration: underline -} - -abbr[title], acronym[title] { - text-decoration: dotted underline; -} - -strong, b { - font-weight: bold -} - -i, cite, em, var, address, dfn { - font-style: italic -} - -tt, code, kbd, samp { - font-family: monospace -} - -pre, xmp, plaintext, listing { - display: block; - font-family: monospace; - white-space: pre; - margin: 1__qem 0 -} - -mark { - background-color: yellow; - color: black -} - -big { - font-size: larger -} - -small { - font-size: smaller -} - -s, strike, del { - text-decoration: line-through -} - -sub { - vertical-align: sub; - font-size: smaller -} - -sup { - vertical-align: super; - font-size: smaller -} - -nobr { - white-space: nowrap -} - -/* states */ - -:focus { - outline: auto 5px -webkit-focus-ring-color -} - -html:focus, body:focus { - outline: none -} - -embed:focus, iframe:focus, object:focus { - outline: none -} - -input:focus, textarea:focus, select:focus { - outline-offset: -2px -} - -input[type="button" i]:focus, -input[type="checkbox" i]:focus, -input[type="file" i]:focus, -input[type="hidden" i]:focus, -input[type="image" i]:focus, -input[type="radio" i]:focus, -input[type="reset" i]:focus, -input[type="submit" i]:focus, -input[type="file" i]:focus::-webkit-file-upload-button { - outline-offset: 0 -} - -a:-webkit-any-link { - color: -webkit-link; - text-decoration: underline; - cursor: pointer; -} - -a:-webkit-any-link:active { - color: -webkit-activelink -} - -a:-webkit-any-link:read-write { - cursor: text; -} - -/* HTML5 ruby elements */ - -ruby, rt { - text-indent: 0; /* blocks used for ruby rendering should not trigger this */ -} - -rt { - line-height: normal; - -webkit-text-emphasis: none; -} - -ruby > rt { - display: block; - font-size: 50%; - text-align: start; -} - -rp { - display: none; -} - -/* other elements */ - -noframes { - display: none -} - -frameset, frame { - display: block -} - -frameset { - border-color: inherit -} - -iframe { - border: 2px inset -} - -details { - display: block -} - -summary { - display: block -} - -summary::-webkit-details-marker { - display: inline-block; - width: 0.66em; - height: 0.66em; - -webkit-margin-end: 0.4em; -} - -template { - display: none -} - -bdi, output { - unicode-bidi: -webkit-isolate; -} - -bdo { - unicode-bidi: bidi-override; -} - -textarea[dir=auto i] { - unicode-bidi: -webkit-plaintext; -} - -dialog:not([open]) { - display: none -} - -dialog { - display: block; - position: absolute; - left: 0; - right: 0; - width: -webkit-fit-content; - height: -webkit-fit-content; - margin: auto; - border: solid; - padding: 1em; - background: white; - color: black -} - -/* TODO(foolip): In the Fullscreen spec, there's a ::backdrop block with the - properties shared with :fullscreen::backdrop (see fullscreen.css). */ -dialog::backdrop { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - background: rgba(0,0,0,0.1) -} - -slot { - display: contents; -} - -/* page */ - -@page { - /* FIXME: Define the right default values for page properties. */ - size: auto; - margin: auto; - padding: 0px; - border-width: 0px; -} - -/* Allows thead sections to print at the top of each page. */ -@media print { - thead { break-inside:avoid; } - tfoot { break-inside:avoid; } -} - -/* noscript is handled internally, as it depends on settings. */ diff --git a/chromium/third_party/blink/renderer/core/css/inline_css_style_declaration.cc b/chromium/third_party/blink/renderer/core/css/inline_css_style_declaration.cc index 3e7201ed8cf..bbb0eb61bd3 100644 --- a/chromium/third_party/blink/renderer/core/css/inline_css_style_declaration.cc +++ b/chromium/third_party/blink/renderer/core/css/inline_css_style_declaration.cc @@ -43,7 +43,7 @@ void InlineCSSStyleDeclaration::DidMutate(MutationType type) { parent_element_->ClearMutableInlineStyleIfEmpty(); parent_element_->SetNeedsStyleRecalc( kLocalStyleChange, StyleChangeReasonForTracing::Create( - StyleChangeReason::kInlineCSSStyleMutated)); + style_change_reason::kInlineCSSStyleMutated)); parent_element_->InvalidateStyleAttribute(); StyleAttributeMutationScope(this).DidInvalidateStyleAttr(); } diff --git a/chromium/third_party/blink/renderer/core/css/invalidation/invalidation_set.cc b/chromium/third_party/blink/renderer/core/css/invalidation/invalidation_set.cc index 1e115ca278b..c8192681129 100644 --- a/chromium/third_party/blink/renderer/core/css/invalidation/invalidation_set.cc +++ b/chromium/third_party/blink/renderer/core/css/invalidation/invalidation_set.cc @@ -106,7 +106,7 @@ bool InvalidationSet::InvalidatesElement(Element& element) const { } } - if (element.HasPartName() && invalidation_flags_.InvalidatesParts()) { + if (element.HasPart() && invalidation_flags_.InvalidatesParts()) { TRACE_STYLE_INVALIDATOR_INVALIDATION_SELECTORPART_IF_ENABLED( element, kInvalidationSetMatchedPart, *this, ""); return true; diff --git a/chromium/third_party/blink/renderer/core/css/invalidation/pending_invalidations.cc b/chromium/third_party/blink/renderer/core/css/invalidation/pending_invalidations.cc index 585ecd48017..224fc759863 100644 --- a/chromium/third_party/blink/renderer/core/css/invalidation/pending_invalidations.cc +++ b/chromium/third_party/blink/renderer/core/css/invalidation/pending_invalidations.cc @@ -32,7 +32,7 @@ void PendingInvalidations::ScheduleInvalidationSetsForNode( if (invalidation_set->WholeSubtreeInvalid()) { node.SetNeedsStyleRecalc(kSubtreeStyleChange, StyleChangeReasonForTracing::Create( - StyleChangeReason::kStyleInvalidator)); + style_change_reason::kStyleInvalidator)); requires_descendant_invalidation = false; break; } @@ -40,7 +40,7 @@ void PendingInvalidations::ScheduleInvalidationSetsForNode( if (invalidation_set->InvalidatesSelf()) { node.SetNeedsStyleRecalc(kLocalStyleChange, StyleChangeReasonForTracing::Create( - StyleChangeReason::kStyleInvalidator)); + style_change_reason::kStyleInvalidator)); } if (!invalidation_set->IsEmpty()) @@ -94,7 +94,7 @@ void PendingInvalidations::ScheduleSiblingInvalidationsAsDescendants( if (invalidation_set->WholeSubtreeInvalid()) { scheduling_parent.SetNeedsStyleRecalc( kSubtreeStyleChange, StyleChangeReasonForTracing::Create( - StyleChangeReason::kStyleInvalidator)); + style_change_reason::kStyleInvalidator)); return; } if (invalidation_set->InvalidatesSelf() && @@ -106,7 +106,7 @@ void PendingInvalidations::ScheduleSiblingInvalidationsAsDescendants( if (descendants->WholeSubtreeInvalid()) { scheduling_parent.SetNeedsStyleRecalc( kSubtreeStyleChange, StyleChangeReasonForTracing::Create( - StyleChangeReason::kStyleInvalidator)); + style_change_reason::kStyleInvalidator)); return; } if (!pending_invalidations.Descendants().Contains(descendants)) diff --git a/chromium/third_party/blink/renderer/core/css/invalidation/pending_invalidations_test.cc b/chromium/third_party/blink/renderer/core/css/invalidation/pending_invalidations_test.cc index afd1968ad1c..d67db7ccf42 100644 --- a/chromium/third_party/blink/renderer/core/css/invalidation/pending_invalidations_test.cc +++ b/chromium/third_party/blink/renderer/core/css/invalidation/pending_invalidations_test.cc @@ -33,7 +33,8 @@ void PendingInvalidationsTest::SetUp() { TEST_F(PendingInvalidationsTest, ScheduleOnDocumentNode) { GetDocument().body()->SetInnerHTMLFromString( "<div id='d'></div><i id='i'></i><span></span>"); - GetDocument().View()->UpdateAllLifecyclePhases(); + GetDocument().View()->UpdateAllLifecyclePhases( + DocumentLifecycle::LifecycleUpdateReason::kTest); unsigned before_count = GetStyleEngine().StyleForElementCount(); @@ -57,7 +58,8 @@ TEST_F(PendingInvalidationsTest, ScheduleOnDocumentNode) { EXPECT_FALSE(GetDocument().NeedsStyleRecalc()); EXPECT_TRUE(GetDocument().ChildNeedsStyleRecalc()); - GetDocument().View()->UpdateAllLifecyclePhases(); + GetDocument().View()->UpdateAllLifecyclePhases( + DocumentLifecycle::LifecycleUpdateReason::kTest); unsigned after_count = GetStyleEngine().StyleForElementCount(); EXPECT_EQ(2u, after_count - before_count); } diff --git a/chromium/third_party/blink/renderer/core/css/invalidation/style_invalidator.cc b/chromium/third_party/blink/renderer/core/css/invalidation/style_invalidator.cc index 68e6fb95f51..40f2db6256c 100644 --- a/chromium/third_party/blink/renderer/core/css/invalidation/style_invalidator.cc +++ b/chromium/third_party/blink/renderer/core/css/invalidation/style_invalidator.cc @@ -169,9 +169,9 @@ bool StyleInvalidator::SiblingData::MatchCurrentInvalidationSets( if (const DescendantInvalidationSet* descendants = invalidation_set.SiblingDescendants()) { if (descendants->WholeSubtreeInvalid()) { - element.SetNeedsStyleRecalc(kSubtreeStyleChange, - StyleChangeReasonForTracing::Create( - StyleChangeReason::kStyleInvalidator)); + element.SetNeedsStyleRecalc( + kSubtreeStyleChange, StyleChangeReasonForTracing::Create( + style_change_reason::kStyleInvalidator)); return true; } @@ -209,7 +209,7 @@ void StyleInvalidator::PushInvalidationSetsForContainerNode( TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidationTracking"), "StyleInvalidatorInvalidationTracking", TRACE_EVENT_SCOPE_THREAD, "data", - InspectorStyleInvalidatorInvalidateEvent::InvalidationList( + inspector_style_invalidator_invalidate_event::InvalidationList( node, pending_invalidations.Descendants())); } } @@ -276,7 +276,7 @@ void StyleInvalidator::Invalidate(Element& element, SiblingData& sibling_data) { } else if (CheckInvalidationSetsAgainstElement(element, sibling_data)) { element.SetNeedsStyleRecalc(kLocalStyleChange, StyleChangeReasonForTracing::Create( - StyleChangeReason::kStyleInvalidator)); + style_change_reason::kStyleInvalidator)); } if (UNLIKELY(element.NeedsStyleInvalidation())) PushInvalidationSetsForContainerNode(element, sibling_data); @@ -295,7 +295,7 @@ void StyleInvalidator::Invalidate(Element& element, SiblingData& sibling_data) { if (InsertionPointCrossing() && element.IsV0InsertionPoint()) { element.SetNeedsStyleRecalc(kSubtreeStyleChange, StyleChangeReasonForTracing::Create( - StyleChangeReason::kStyleInvalidator)); + style_change_reason::kStyleInvalidator)); } } @@ -320,10 +320,11 @@ void StyleInvalidator::InvalidateSlotDistributedElements( continue; if (!distributed_node->IsElementNode()) continue; - if (MatchesCurrentInvalidationSetsAsSlotted(ToElement(*distributed_node))) + if (MatchesCurrentInvalidationSetsAsSlotted(ToElement(*distributed_node))) { distributed_node->SetNeedsStyleRecalc( kLocalStyleChange, StyleChangeReasonForTracing::Create( - StyleChangeReason::kStyleInvalidator)); + style_change_reason::kStyleInvalidator)); + } } } diff --git a/chromium/third_party/blink/renderer/core/css/keyframe_style_rule_css_style_declaration.h b/chromium/third_party/blink/renderer/core/css/keyframe_style_rule_css_style_declaration.h index 40a95e38ff2..7c57d95552c 100644 --- a/chromium/third_party/blink/renderer/core/css/keyframe_style_rule_css_style_declaration.h +++ b/chromium/third_party/blink/renderer/core/css/keyframe_style_rule_css_style_declaration.h @@ -17,13 +17,14 @@ class KeyframeStyleRuleCSSStyleDeclaration final static KeyframeStyleRuleCSSStyleDeclaration* Create( MutableCSSPropertyValueSet& property_set, CSSKeyframeRule* parent_rule) { - return new KeyframeStyleRuleCSSStyleDeclaration(property_set, parent_rule); + return MakeGarbageCollected<KeyframeStyleRuleCSSStyleDeclaration>( + property_set, parent_rule); } - private: KeyframeStyleRuleCSSStyleDeclaration(MutableCSSPropertyValueSet&, CSSKeyframeRule*); + private: void DidMutate(MutationType) override; bool IsKeyframeStyle() const final { return true; } }; diff --git a/chromium/third_party/blink/renderer/core/css/media_feature_names.json5 b/chromium/third_party/blink/renderer/core/css/media_feature_names.json5 index c36a0f83f81..4640d1a8340 100644 --- a/chromium/third_party/blink/renderer/core/css/media_feature_names.json5 +++ b/chromium/third_party/blink/renderer/core/css/media_feature_names.json5 @@ -1,6 +1,6 @@ { metadata: { - namespace: "MediaFeature", + namespace: "media_feature_names", export: "", }, diff --git a/chromium/third_party/blink/renderer/core/css/media_list.h b/chromium/third_party/blink/renderer/core/css/media_list.h index 5018623ccb4..4019995841b 100644 --- a/chromium/third_party/blink/renderer/core/css/media_list.h +++ b/chromium/third_party/blink/renderer/core/css/media_list.h @@ -74,14 +74,19 @@ class MediaList final : public ScriptWrappable { public: static MediaList* Create(scoped_refptr<MediaQuerySet> media_queries, CSSStyleSheet* parent_sheet) { - return new MediaList(std::move(media_queries), parent_sheet); + return MakeGarbageCollected<MediaList>(std::move(media_queries), + parent_sheet); } static MediaList* Create(scoped_refptr<MediaQuerySet> media_queries, CSSRule* parent_rule) { - return new MediaList(std::move(media_queries), parent_rule); + return MakeGarbageCollected<MediaList>(std::move(media_queries), + parent_rule); } + MediaList(scoped_refptr<MediaQuerySet>, CSSStyleSheet* parent_sheet); + MediaList(scoped_refptr<MediaQuerySet>, CSSRule* parent_rule); + unsigned length() const { return media_queries_->QueryVector().size(); } String item(unsigned index) const; void deleteMedium(const String& old_medium, ExceptionState&); @@ -101,9 +106,6 @@ class MediaList final : public ScriptWrappable { void Trace(blink::Visitor*) override; private: - MediaList(scoped_refptr<MediaQuerySet>, CSSStyleSheet* parent_sheet); - MediaList(scoped_refptr<MediaQuerySet>, CSSRule* parent_rule); - scoped_refptr<MediaQuerySet> media_queries_; Member<CSSStyleSheet> parent_style_sheet_; Member<CSSRule> parent_rule_; diff --git a/chromium/third_party/blink/renderer/core/css/media_query.cc b/chromium/third_party/blink/renderer/core/css/media_query.cc index 2a002db3ef1..2748773e071 100644 --- a/chromium/third_party/blink/renderer/core/css/media_query.cc +++ b/chromium/third_party/blink/renderer/core/css/media_query.cc @@ -56,7 +56,7 @@ String MediaQuery::Serialize() const { return result.ToString(); } - if (media_type_ != MediaTypeNames::all || restrictor_ != kNone) { + if (media_type_ != media_type_names::kAll || restrictor_ != kNone) { result.Append(media_type_); result.Append(" and "); } @@ -74,7 +74,7 @@ static bool ExpressionCompare(const MediaQueryExp& a, const MediaQueryExp& b) { } std::unique_ptr<MediaQuery> MediaQuery::CreateNotAll() { - return std::make_unique<MediaQuery>(MediaQuery::kNot, MediaTypeNames::all, + return std::make_unique<MediaQuery>(MediaQuery::kNot, media_type_names::kAll, ExpressionHeapVector()); } diff --git a/chromium/third_party/blink/renderer/core/css/media_query_evaluator.cc b/chromium/third_party/blink/renderer/core/css/media_query_evaluator.cc index 5c6aa02a23b..e0e5ca28faa 100644 --- a/chromium/third_party/blink/renderer/core/css/media_query_evaluator.cc +++ b/chromium/third_party/blink/renderer/core/css/media_query_evaluator.cc @@ -55,7 +55,7 @@ namespace blink { -using namespace MediaFeatureNames; +using namespace media_feature_names; enum MediaFeaturePrefix { kMinPrefix, kMaxPrefix, kNoPrefix }; @@ -100,7 +100,7 @@ bool MediaQueryEvaluator::MediaTypeMatch( const String& media_type_to_match) const { return media_type_to_match.IsEmpty() || DeprecatedEqualIgnoringCase(media_type_to_match, - MediaTypeNames::all) || + media_type_names::kAll) || DeprecatedEqualIgnoringCase(media_type_to_match, MediaType()); } @@ -322,10 +322,10 @@ static bool EvalResolution(const MediaQueryExpValue& value, // in the query. Thus, if if the document's media type is "print", the // media type of the query will either be "print" or "all". if (DeprecatedEqualIgnoringCase(media_values.MediaType(), - MediaTypeNames::screen)) { + media_type_names::kScreen)) { actual_resolution = clampTo<float>(media_values.DevicePixelRatio()); } else if (DeprecatedEqualIgnoringCase(media_values.MediaType(), - MediaTypeNames::print)) { + media_type_names::kPrint)) { // The resolution of images while printing should not depend on the DPI // of the screen. Until we support proper ways of querying this info // we use 300px which is considered minimum for current printers. @@ -752,7 +752,7 @@ static bool ScanMediaFeatureEval(const MediaQueryExpValue& value, const MediaValues& media_values) { // Scan only applies to 'tv' media. if (!DeprecatedEqualIgnoringCase(media_values.MediaType(), - MediaTypeNames::tv)) + media_type_names::kTv)) return false; if (!value.IsValid()) diff --git a/chromium/third_party/blink/renderer/core/css/media_query_evaluator_test.cc b/chromium/third_party/blink/renderer/core/css/media_query_evaluator_test.cc index b8eecf98174..e2de522ff15 100644 --- a/chromium/third_party/blink/renderer/core/css/media_query_evaluator_test.cc +++ b/chromium/third_party/blink/renderer/core/css/media_query_evaluator_test.cc @@ -209,7 +209,7 @@ TEST(MediaQueryEvaluatorTest, Cached) { data.primary_hover_type = kHoverTypeHover; data.default_font_size = 16; data.three_d_enabled = true; - data.media_type = MediaTypeNames::screen; + data.media_type = media_type_names::kScreen; data.strict_mode = true; data.display_mode = kWebDisplayModeBrowser; data.display_shape = kDisplayShapeRect; @@ -228,11 +228,11 @@ TEST(MediaQueryEvaluatorTest, Cached) { // Print values. { - data.media_type = MediaTypeNames::print; + data.media_type = media_type_names::kPrint; MediaValues* media_values = MediaValuesCached::Create(data); MediaQueryEvaluator media_query_evaluator(*media_values); TestMQEvaluator(g_print_test_cases, media_query_evaluator); - data.media_type = MediaTypeNames::screen; + data.media_type = media_type_names::kScreen; } // Monochrome values. @@ -261,11 +261,11 @@ TEST(MediaQueryEvaluatorTest, Cached) { TEST(MediaQueryEvaluatorTest, Dynamic) { std::unique_ptr<DummyPageHolder> page_holder = DummyPageHolder::Create(IntSize(500, 500)); - page_holder->GetFrameView().SetMediaType(MediaTypeNames::screen); + page_holder->GetFrameView().SetMediaType(media_type_names::kScreen); MediaQueryEvaluator media_query_evaluator(&page_holder->GetFrame()); TestMQEvaluator(g_viewport_test_cases, media_query_evaluator); - page_holder->GetFrameView().SetMediaType(MediaTypeNames::print); + page_holder->GetFrameView().SetMediaType(media_type_names::kPrint); TestMQEvaluator(g_print_test_cases, media_query_evaluator); } @@ -304,7 +304,7 @@ TEST(MediaQueryEvaluatorTest, CachedFloatViewportNonFloatFriendly) { TEST(MediaQueryEvaluatorTest, InitialViewport) { std::unique_ptr<DummyPageHolder> page_holder = DummyPageHolder::Create(IntSize(500, 500)); - page_holder->GetFrameView().SetMediaType(MediaTypeNames::screen); + page_holder->GetFrameView().SetMediaType(media_type_names::kScreen); page_holder->GetFrameView().SetLayoutSizeFixedToFrameSize(false); page_holder->GetFrameView().SetInitialViewportSize(IntSize(500, 500)); page_holder->GetFrameView().SetLayoutSize(IntSize(800, 800)); @@ -318,7 +318,7 @@ TEST(MediaQueryEvaluatorTest, InitialViewport) { TEST(MediaQueryEvaluatorTest, DynamicImmersive) { std::unique_ptr<DummyPageHolder> page_holder = DummyPageHolder::Create(IntSize(500, 500)); - page_holder->GetFrameView().SetMediaType(MediaTypeNames::screen); + page_holder->GetFrameView().SetMediaType(media_type_names::kScreen); MediaQueryEvaluator media_query_evaluator(&page_holder->GetFrame()); page_holder->GetDocument().GetSettings()->SetImmersiveModeEnabled(false); diff --git a/chromium/third_party/blink/renderer/core/css/media_query_exp.cc b/chromium/third_party/blink/renderer/core/css/media_query_exp.cc index b61a883d3cc..8719608cb98 100644 --- a/chromium/third_party/blink/renderer/core/css/media_query_exp.cc +++ b/chromium/third_party/blink/renderer/core/css/media_query_exp.cc @@ -39,35 +39,35 @@ namespace blink { -using namespace MediaFeatureNames; +using namespace media_feature_names; static inline bool FeatureWithValidIdent(const String& media_feature, CSSValueID ident) { - if (media_feature == displayModeMediaFeature) + if (media_feature == kDisplayModeMediaFeature) return ident == CSSValueFullscreen || ident == CSSValueStandalone || ident == CSSValueMinimalUi || ident == CSSValueBrowser; - if (media_feature == orientationMediaFeature) + if (media_feature == kOrientationMediaFeature) return ident == CSSValuePortrait || ident == CSSValueLandscape; - if (media_feature == pointerMediaFeature || - media_feature == anyPointerMediaFeature) + if (media_feature == kPointerMediaFeature || + media_feature == kAnyPointerMediaFeature) return ident == CSSValueNone || ident == CSSValueCoarse || ident == CSSValueFine; - if (media_feature == hoverMediaFeature || - media_feature == anyHoverMediaFeature) + if (media_feature == kHoverMediaFeature || + media_feature == kAnyHoverMediaFeature) return ident == CSSValueNone || ident == CSSValueHover; - if (media_feature == scanMediaFeature) + if (media_feature == kScanMediaFeature) return ident == CSSValueInterlace || ident == CSSValueProgressive; if (RuntimeEnabledFeatures::MediaQueryShapeEnabled()) { - if (media_feature == shapeMediaFeature) + if (media_feature == kShapeMediaFeature) return ident == CSSValueRect || ident == CSSValueRound; } - if (media_feature == colorGamutMediaFeature) { + if (media_feature == kColorGamutMediaFeature) { return ident == CSSValueSRGB || ident == CSSValueP3 || ident == CSSValueRec2020; } @@ -82,18 +82,18 @@ static inline bool FeatureWithValidPositiveLength( (value->IsNumber() && value->GetDoubleValue() == 0))) return false; - return media_feature == heightMediaFeature || - media_feature == maxHeightMediaFeature || - media_feature == minHeightMediaFeature || - media_feature == widthMediaFeature || - media_feature == maxWidthMediaFeature || - media_feature == minWidthMediaFeature || - media_feature == deviceHeightMediaFeature || - media_feature == maxDeviceHeightMediaFeature || - media_feature == minDeviceHeightMediaFeature || - media_feature == deviceWidthMediaFeature || - media_feature == minDeviceWidthMediaFeature || - media_feature == maxDeviceWidthMediaFeature; + return media_feature == kHeightMediaFeature || + media_feature == kMaxHeightMediaFeature || + media_feature == kMinHeightMediaFeature || + media_feature == kWidthMediaFeature || + media_feature == kMaxWidthMediaFeature || + media_feature == kMinWidthMediaFeature || + media_feature == kDeviceHeightMediaFeature || + media_feature == kMaxDeviceHeightMediaFeature || + media_feature == kMinDeviceHeightMediaFeature || + media_feature == kDeviceWidthMediaFeature || + media_feature == kMinDeviceWidthMediaFeature || + media_feature == kMaxDeviceWidthMediaFeature; } static inline bool FeatureWithValidDensity(const String& media_feature, @@ -107,23 +107,23 @@ static inline bool FeatureWithValidDensity(const String& media_feature, value->GetDoubleValue() <= 0) return false; - return media_feature == resolutionMediaFeature || - media_feature == minResolutionMediaFeature || - media_feature == maxResolutionMediaFeature; + return media_feature == kResolutionMediaFeature || + media_feature == kMinResolutionMediaFeature || + media_feature == kMaxResolutionMediaFeature; } static inline bool FeatureExpectingPositiveInteger( const String& media_feature) { - return media_feature == colorMediaFeature || - media_feature == maxColorMediaFeature || - media_feature == minColorMediaFeature || - media_feature == colorIndexMediaFeature || - media_feature == maxColorIndexMediaFeature || - media_feature == minColorIndexMediaFeature || - media_feature == monochromeMediaFeature || - media_feature == maxMonochromeMediaFeature || - media_feature == minMonochromeMediaFeature || - media_feature == immersiveMediaFeature; + return media_feature == kColorMediaFeature || + media_feature == kMaxColorMediaFeature || + media_feature == kMinColorMediaFeature || + media_feature == kColorIndexMediaFeature || + media_feature == kMaxColorIndexMediaFeature || + media_feature == kMinColorIndexMediaFeature || + media_feature == kMonochromeMediaFeature || + media_feature == kMaxMonochromeMediaFeature || + media_feature == kMinMonochromeMediaFeature || + media_feature == kImmersiveMediaFeature; } static inline bool FeatureWithPositiveInteger(const String& media_feature, @@ -138,10 +138,10 @@ static inline bool FeatureWithPositiveNumber(const String& media_feature, if (!value->IsNumber()) return false; - return media_feature == transform3dMediaFeature || - media_feature == devicePixelRatioMediaFeature || - media_feature == maxDevicePixelRatioMediaFeature || - media_feature == minDevicePixelRatioMediaFeature; + return media_feature == kTransform3dMediaFeature || + media_feature == kDevicePixelRatioMediaFeature || + media_feature == kMaxDevicePixelRatioMediaFeature || + media_feature == kMinDevicePixelRatioMediaFeature; } static inline bool FeatureWithZeroOrOne(const String& media_feature, @@ -150,73 +150,73 @@ static inline bool FeatureWithZeroOrOne(const String& media_feature, !(value->GetDoubleValue() == 1 || !value->GetDoubleValue())) return false; - return media_feature == gridMediaFeature; + return media_feature == kGridMediaFeature; } static inline bool FeatureWithAspectRatio(const String& media_feature) { - return media_feature == aspectRatioMediaFeature || - media_feature == deviceAspectRatioMediaFeature || - media_feature == minAspectRatioMediaFeature || - media_feature == maxAspectRatioMediaFeature || - media_feature == minDeviceAspectRatioMediaFeature || - media_feature == maxDeviceAspectRatioMediaFeature; + return media_feature == kAspectRatioMediaFeature || + media_feature == kDeviceAspectRatioMediaFeature || + media_feature == kMinAspectRatioMediaFeature || + media_feature == kMaxAspectRatioMediaFeature || + media_feature == kMinDeviceAspectRatioMediaFeature || + media_feature == kMaxDeviceAspectRatioMediaFeature; } static inline bool FeatureWithoutValue(const String& media_feature) { // Media features that are prefixed by min/max cannot be used without a value. - return media_feature == monochromeMediaFeature || - media_feature == colorMediaFeature || - media_feature == colorIndexMediaFeature || - media_feature == gridMediaFeature || - media_feature == heightMediaFeature || - media_feature == widthMediaFeature || - media_feature == deviceHeightMediaFeature || - media_feature == deviceWidthMediaFeature || - media_feature == orientationMediaFeature || - media_feature == aspectRatioMediaFeature || - media_feature == deviceAspectRatioMediaFeature || - media_feature == hoverMediaFeature || - media_feature == anyHoverMediaFeature || - media_feature == transform3dMediaFeature || - media_feature == pointerMediaFeature || - media_feature == anyPointerMediaFeature || - media_feature == devicePixelRatioMediaFeature || - media_feature == resolutionMediaFeature || - media_feature == displayModeMediaFeature || - media_feature == scanMediaFeature || - media_feature == shapeMediaFeature || - media_feature == colorGamutMediaFeature || - media_feature == immersiveMediaFeature; + return media_feature == kMonochromeMediaFeature || + media_feature == kColorMediaFeature || + media_feature == kColorIndexMediaFeature || + media_feature == kGridMediaFeature || + media_feature == kHeightMediaFeature || + media_feature == kWidthMediaFeature || + media_feature == kDeviceHeightMediaFeature || + media_feature == kDeviceWidthMediaFeature || + media_feature == kOrientationMediaFeature || + media_feature == kAspectRatioMediaFeature || + media_feature == kDeviceAspectRatioMediaFeature || + media_feature == kHoverMediaFeature || + media_feature == kAnyHoverMediaFeature || + media_feature == kTransform3dMediaFeature || + media_feature == kPointerMediaFeature || + media_feature == kAnyPointerMediaFeature || + media_feature == kDevicePixelRatioMediaFeature || + media_feature == kResolutionMediaFeature || + media_feature == kDisplayModeMediaFeature || + media_feature == kScanMediaFeature || + media_feature == kShapeMediaFeature || + media_feature == kColorGamutMediaFeature || + media_feature == kImmersiveMediaFeature; } bool MediaQueryExp::IsViewportDependent() const { - return media_feature_ == widthMediaFeature || - media_feature_ == heightMediaFeature || - media_feature_ == minWidthMediaFeature || - media_feature_ == minHeightMediaFeature || - media_feature_ == maxWidthMediaFeature || - media_feature_ == maxHeightMediaFeature || - media_feature_ == orientationMediaFeature || - media_feature_ == aspectRatioMediaFeature || - media_feature_ == minAspectRatioMediaFeature || - media_feature_ == devicePixelRatioMediaFeature || - media_feature_ == resolutionMediaFeature || - media_feature_ == maxAspectRatioMediaFeature || - media_feature_ == maxDevicePixelRatioMediaFeature || - media_feature_ == minDevicePixelRatioMediaFeature; + return media_feature_ == kWidthMediaFeature || + media_feature_ == kHeightMediaFeature || + media_feature_ == kMinWidthMediaFeature || + media_feature_ == kMinHeightMediaFeature || + media_feature_ == kMaxWidthMediaFeature || + media_feature_ == kMaxHeightMediaFeature || + media_feature_ == kOrientationMediaFeature || + media_feature_ == kAspectRatioMediaFeature || + media_feature_ == kMinAspectRatioMediaFeature || + media_feature_ == kDevicePixelRatioMediaFeature || + media_feature_ == kResolutionMediaFeature || + media_feature_ == kMaxAspectRatioMediaFeature || + media_feature_ == kMaxDevicePixelRatioMediaFeature || + media_feature_ == kMinDevicePixelRatioMediaFeature; } bool MediaQueryExp::IsDeviceDependent() const { - return media_feature_ == deviceAspectRatioMediaFeature || - media_feature_ == deviceWidthMediaFeature || - media_feature_ == deviceHeightMediaFeature || - media_feature_ == minDeviceAspectRatioMediaFeature || - media_feature_ == minDeviceWidthMediaFeature || - media_feature_ == minDeviceHeightMediaFeature || - media_feature_ == maxDeviceAspectRatioMediaFeature || - media_feature_ == maxDeviceWidthMediaFeature || - media_feature_ == maxDeviceHeightMediaFeature || - media_feature_ == shapeMediaFeature; + return media_feature_ == kDeviceAspectRatioMediaFeature || + media_feature_ == kDeviceWidthMediaFeature || + media_feature_ == kDeviceHeightMediaFeature || + media_feature_ == kMinDeviceAspectRatioMediaFeature || + media_feature_ == kMinDeviceWidthMediaFeature || + media_feature_ == kMinDeviceHeightMediaFeature || + media_feature_ == kMaxDeviceAspectRatioMediaFeature || + media_feature_ == kMaxDeviceWidthMediaFeature || + media_feature_ == kMaxDeviceHeightMediaFeature || + media_feature_ == kShapeMediaFeature; } MediaQueryExp::MediaQueryExp(const MediaQueryExp& other) @@ -234,16 +234,19 @@ MediaQueryExp MediaQueryExp::Create(const String& media_feature, String lower_media_feature = AttemptStaticStringCreation(media_feature.LowerASCII()); - CSSPrimitiveValue* value = CSSPropertyParserHelpers::ConsumeInteger(range, 0); + CSSPrimitiveValue* value = + css_property_parser_helpers::ConsumeInteger(range, 0); if (!value && !FeatureExpectingPositiveInteger(lower_media_feature) && - !FeatureWithAspectRatio(lower_media_feature)) - value = - CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeNonNegative); - if (!value) - value = CSSPropertyParserHelpers::ConsumeLength(range, kHTMLStandardMode, - kValueRangeNonNegative); + !FeatureWithAspectRatio(lower_media_feature)) { + value = css_property_parser_helpers::ConsumeNumber(range, + kValueRangeNonNegative); + } + if (!value) { + value = css_property_parser_helpers::ConsumeLength(range, kHTMLStandardMode, + kValueRangeNonNegative); + } if (!value) - value = CSSPropertyParserHelpers::ConsumeResolution(range); + value = css_property_parser_helpers::ConsumeResolution(range); // Create value for media query expression that must have 1 or more values. if (value) { if (FeatureWithAspectRatio(lower_media_feature)) { @@ -251,10 +254,10 @@ MediaQueryExp MediaQueryExp::Create(const String& media_feature, CSSPrimitiveValue::UnitType::kInteger || value->GetDoubleValue() == 0) return Invalid(); - if (!CSSPropertyParserHelpers::ConsumeSlashIncludingWhitespace(range)) + if (!css_property_parser_helpers::ConsumeSlashIncludingWhitespace(range)) return Invalid(); CSSPrimitiveValue* denominator = - CSSPropertyParserHelpers::ConsumePositiveInteger(range); + css_property_parser_helpers::ConsumePositiveInteger(range); if (!denominator) return Invalid(); @@ -275,7 +278,8 @@ MediaQueryExp MediaQueryExp::Create(const String& media_feature, } else { return Invalid(); } - } else if (CSSIdentifierValue* ident = CSSPropertyParserHelpers::ConsumeIdent(range)) { + } else if (CSSIdentifierValue* ident = + css_property_parser_helpers::ConsumeIdent(range)) { CSSValueID ident_id = ident->GetValueID(); if (!FeatureWithValidIdent(lower_media_feature, ident_id)) return Invalid(); diff --git a/chromium/third_party/blink/renderer/core/css/media_query_list.cc b/chromium/third_party/blink/renderer/core/css/media_query_list.cc index f8efddac98c..51ebc837cb4 100644 --- a/chromium/third_party/blink/renderer/core/css/media_query_list.cc +++ b/chromium/third_party/blink/renderer/core/css/media_query_list.cc @@ -30,8 +30,8 @@ namespace blink { MediaQueryList* MediaQueryList::Create(ExecutionContext* context, MediaQueryMatcher* matcher, scoped_refptr<MediaQuerySet> media) { - return new MediaQueryList(context, matcher, - scoped_refptr<MediaQuerySet>(media)); + return MakeGarbageCollected<MediaQueryList>( + context, matcher, scoped_refptr<MediaQuerySet>(media)); } MediaQueryList::MediaQueryList(ExecutionContext* context, @@ -56,14 +56,14 @@ void MediaQueryList::addDeprecatedListener(EventListener* listener) { if (!listener) return; - addEventListener(EventTypeNames::change, listener, false); + addEventListener(event_type_names::kChange, listener, false); } void MediaQueryList::removeDeprecatedListener(EventListener* listener) { if (!listener) return; - removeEventListener(EventTypeNames::change, listener, false); + removeEventListener(event_type_names::kChange, listener, false); } void MediaQueryList::AddListener(MediaQueryListListener* listener) { @@ -82,7 +82,7 @@ void MediaQueryList::RemoveListener(MediaQueryListListener* listener) { bool MediaQueryList::HasPendingActivity() const { return GetExecutionContext() && - (listeners_.size() || HasEventListeners(EventTypeNames::change)); + (listeners_.size() || HasEventListeners(event_type_names::kChange)); } void MediaQueryList::ContextDestroyed(ExecutionContext*) { @@ -98,7 +98,7 @@ bool MediaQueryList::MediaFeaturesChanged( for (const auto& listener : listeners_) { listeners_to_notify->push_back(listener); } - return HasEventListeners(EventTypeNames::change); + return HasEventListeners(event_type_names::kChange); } bool MediaQueryList::UpdateMatches() { @@ -123,7 +123,7 @@ void MediaQueryList::Trace(blink::Visitor* visitor) { } const AtomicString& MediaQueryList::InterfaceName() const { - return EventTargetNames::MediaQueryList; + return event_target_names::kMediaQueryList; } ExecutionContext* MediaQueryList::GetExecutionContext() const { diff --git a/chromium/third_party/blink/renderer/core/css/media_query_list.h b/chromium/third_party/blink/renderer/core/css/media_query_list.h index 615b8e9cdd5..4ca8fd6b741 100644 --- a/chromium/third_party/blink/renderer/core/css/media_query_list.h +++ b/chromium/third_party/blink/renderer/core/css/media_query_list.h @@ -53,12 +53,16 @@ class CORE_EXPORT MediaQueryList final static MediaQueryList* Create(ExecutionContext*, MediaQueryMatcher*, scoped_refptr<MediaQuerySet>); + + MediaQueryList(ExecutionContext*, + MediaQueryMatcher*, + scoped_refptr<MediaQuerySet>); ~MediaQueryList() override; String media() const; bool matches(); - DEFINE_ATTRIBUTE_EVENT_LISTENER(change); + DEFINE_ATTRIBUTE_EVENT_LISTENER(change, kChange); // These two functions are provided for compatibility with JS code // written before the change listener became a DOM event. @@ -86,10 +90,6 @@ class CORE_EXPORT MediaQueryList final ExecutionContext* GetExecutionContext() const override; private: - MediaQueryList(ExecutionContext*, - MediaQueryMatcher*, - scoped_refptr<MediaQuerySet>); - bool UpdateMatches(); Member<MediaQueryMatcher> matcher_; diff --git a/chromium/third_party/blink/renderer/core/css/media_query_list_event.h b/chromium/third_party/blink/renderer/core/css/media_query_list_event.h index 7307703fd7e..c150a53a640 100644 --- a/chromium/third_party/blink/renderer/core/css/media_query_list_event.h +++ b/chromium/third_party/blink/renderer/core/css/media_query_list_event.h @@ -8,6 +8,7 @@ #include "third_party/blink/renderer/core/css/media_query_list.h" #include "third_party/blink/renderer/core/css/media_query_list_event_init.h" #include "third_party/blink/renderer/core/dom/events/event.h" +#include "third_party/blink/renderer/core/event_interface_names.h" namespace blink { @@ -16,17 +17,36 @@ class MediaQueryListEvent final : public Event { public: static MediaQueryListEvent* Create(MediaQueryList* list) { - return new MediaQueryListEvent(list); + return MakeGarbageCollected<MediaQueryListEvent>(list); } static MediaQueryListEvent* Create(const String& media, bool matches) { - return new MediaQueryListEvent(media, matches); + return MakeGarbageCollected<MediaQueryListEvent>(media, matches); } static MediaQueryListEvent* Create( const AtomicString& event_type, - const MediaQueryListEventInit& initializer) { - return new MediaQueryListEvent(event_type, initializer); + const MediaQueryListEventInit* initializer) { + return MakeGarbageCollected<MediaQueryListEvent>(event_type, initializer); + } + + MediaQueryListEvent(const String& media, bool matches) + : Event(event_type_names::kChange, Bubbles::kNo, Cancelable::kNo), + media_(media), + matches_(matches) {} + + explicit MediaQueryListEvent(MediaQueryList* list) + : Event(event_type_names::kChange, Bubbles::kNo, Cancelable::kNo), + media_query_list_(list), + matches_(false) {} + + MediaQueryListEvent(const AtomicString& event_type, + const MediaQueryListEventInit* initializer) + : Event(event_type, initializer), matches_(false) { + if (initializer->hasMedia()) + media_ = initializer->media(); + if (initializer->hasMatches()) + matches_ = initializer->matches(); } String media() const { @@ -37,7 +57,7 @@ class MediaQueryListEvent final : public Event { } const AtomicString& InterfaceName() const override { - return EventNames::MediaQueryListEvent; + return event_interface_names::kMediaQueryListEvent; } void Trace(blink::Visitor* visitor) override { @@ -46,25 +66,6 @@ class MediaQueryListEvent final : public Event { } private: - MediaQueryListEvent(const String& media, bool matches) - : Event(EventTypeNames::change, Bubbles::kNo, Cancelable::kNo), - media_(media), - matches_(matches) {} - - explicit MediaQueryListEvent(MediaQueryList* list) - : Event(EventTypeNames::change, Bubbles::kNo, Cancelable::kNo), - media_query_list_(list), - matches_(false) {} - - MediaQueryListEvent(const AtomicString& event_type, - const MediaQueryListEventInit& initializer) - : Event(event_type, initializer), matches_(false) { - if (initializer.hasMedia()) - media_ = initializer.media(); - if (initializer.hasMatches()) - matches_ = initializer.matches(); - } - // We have media_/matches_ for JS-created events; we use media_query_list_ // for events that blink generates. Member<MediaQueryList> media_query_list_; diff --git a/chromium/third_party/blink/renderer/core/css/media_query_matcher.cc b/chromium/third_party/blink/renderer/core/css/media_query_matcher.cc index 6465d6afa34..d478c870953 100644 --- a/chromium/third_party/blink/renderer/core/css/media_query_matcher.cc +++ b/chromium/third_party/blink/renderer/core/css/media_query_matcher.cc @@ -33,7 +33,7 @@ namespace blink { MediaQueryMatcher* MediaQueryMatcher::Create(Document& document) { - return new MediaQueryMatcher(document); + return MakeGarbageCollected<MediaQueryMatcher>(document); } MediaQueryMatcher::MediaQueryMatcher(Document& document) @@ -52,7 +52,7 @@ MediaQueryEvaluator* MediaQueryMatcher::CreateEvaluator() const { if (!document_ || !document_->GetFrame()) return nullptr; - return new MediaQueryEvaluator(document_->GetFrame()); + return MakeGarbageCollected<MediaQueryEvaluator>(document_->GetFrame()); } bool MediaQueryMatcher::Evaluate(const MediaQuerySet* media) { diff --git a/chromium/third_party/blink/renderer/core/css/media_query_matcher.h b/chromium/third_party/blink/renderer/core/css/media_query_matcher.h index 4b02434e602..6a2b90ff3ca 100644 --- a/chromium/third_party/blink/renderer/core/css/media_query_matcher.h +++ b/chromium/third_party/blink/renderer/core/css/media_query_matcher.h @@ -44,6 +44,8 @@ class CORE_EXPORT MediaQueryMatcher final public: static MediaQueryMatcher* Create(Document&); + + explicit MediaQueryMatcher(Document&); ~MediaQueryMatcher(); void DocumentDetached(); @@ -63,8 +65,6 @@ class CORE_EXPORT MediaQueryMatcher final void Trace(blink::Visitor*); private: - explicit MediaQueryMatcher(Document&); - MediaQueryEvaluator* CreateEvaluator() const; Member<Document> document_; diff --git a/chromium/third_party/blink/renderer/core/css/media_query_matcher_test.cc b/chromium/third_party/blink/renderer/core/css/media_query_matcher_test.cc index 8505778fcc3..5c9b1d8615a 100644 --- a/chromium/third_party/blink/renderer/core/css/media_query_matcher_test.cc +++ b/chromium/third_party/blink/renderer/core/css/media_query_matcher_test.cc @@ -18,7 +18,7 @@ TEST(MediaQueryMatcherTest, LostFrame) { MediaQueryMatcher* matcher = MediaQueryMatcher::Create(page_holder->GetDocument()); scoped_refptr<MediaQuerySet> query_set = - MediaQuerySet::Create(MediaTypeNames::all); + MediaQuerySet::Create(media_type_names::kAll); ASSERT_TRUE(matcher->Evaluate(query_set.get())); matcher->DocumentDetached(); diff --git a/chromium/third_party/blink/renderer/core/css/media_type_names.json5 b/chromium/third_party/blink/renderer/core/css/media_type_names.json5 index 8e638e10bb5..64cee27c01a 100644 --- a/chromium/third_party/blink/renderer/core/css/media_type_names.json5 +++ b/chromium/third_party/blink/renderer/core/css/media_type_names.json5 @@ -1,6 +1,6 @@ { metadata: { - namespace: "MediaType", + namespace: "media_type_names", export: "CORE_EXPORT", }, diff --git a/chromium/third_party/blink/renderer/core/css/media_values_cached.cc b/chromium/third_party/blink/renderer/core/css/media_values_cached.cc index 57bf67ec453..5d8f675d030 100644 --- a/chromium/third_party/blink/renderer/core/css/media_values_cached.cc +++ b/chromium/third_party/blink/renderer/core/css/media_values_cached.cc @@ -73,12 +73,12 @@ MediaValuesCached::MediaValuesCachedData::MediaValuesCachedData( } MediaValuesCached* MediaValuesCached::Create() { - return new MediaValuesCached(); + return MakeGarbageCollected<MediaValuesCached>(); } MediaValuesCached* MediaValuesCached::Create( const MediaValuesCachedData& data) { - return new MediaValuesCached(data); + return MakeGarbageCollected<MediaValuesCached>(data); } MediaValuesCached::MediaValuesCached() = default; @@ -87,7 +87,7 @@ MediaValuesCached::MediaValuesCached(const MediaValuesCachedData& data) : data_(data) {} MediaValues* MediaValuesCached::Copy() const { - return new MediaValuesCached(data_); + return MakeGarbageCollected<MediaValuesCached>(data_); } bool MediaValuesCached::ComputeLength(double value, diff --git a/chromium/third_party/blink/renderer/core/css/media_values_cached.h b/chromium/third_party/blink/renderer/core/css/media_values_cached.h index 0a5c22a2740..dfa427f7c38 100644 --- a/chromium/third_party/blink/renderer/core/css/media_values_cached.h +++ b/chromium/third_party/blink/renderer/core/css/media_values_cached.h @@ -67,6 +67,11 @@ class CORE_EXPORT MediaValuesCached final : public MediaValues { static MediaValuesCached* Create(); static MediaValuesCached* Create(const MediaValuesCachedData&); + + MediaValuesCached(); + MediaValuesCached(LocalFrame*); + MediaValuesCached(const MediaValuesCachedData&); + MediaValues* Copy() const override; bool ComputeLength(double value, CSSPrimitiveValue::UnitType, @@ -99,10 +104,6 @@ class CORE_EXPORT MediaValuesCached final : public MediaValues { void OverrideViewportDimensions(double width, double height) override; protected: - MediaValuesCached(); - MediaValuesCached(LocalFrame*); - MediaValuesCached(const MediaValuesCachedData&); - MediaValuesCachedData data_; }; diff --git a/chromium/third_party/blink/renderer/core/css/media_values_dynamic.cc b/chromium/third_party/blink/renderer/core/css/media_values_dynamic.cc index ee785dd3980..6d8ad635a0c 100644 --- a/chromium/third_party/blink/renderer/core/css/media_values_dynamic.cc +++ b/chromium/third_party/blink/renderer/core/css/media_values_dynamic.cc @@ -21,7 +21,7 @@ MediaValues* MediaValuesDynamic::Create(LocalFrame* frame) { if (!frame || !frame->View() || !frame->GetDocument() || !frame->GetDocument()->GetLayoutView()) return MediaValuesCached::Create(); - return new MediaValuesDynamic(frame); + return MakeGarbageCollected<MediaValuesDynamic>(frame); } MediaValuesDynamic::MediaValuesDynamic(LocalFrame* frame) @@ -44,9 +44,9 @@ MediaValuesDynamic::MediaValuesDynamic(LocalFrame* frame, } MediaValues* MediaValuesDynamic::Copy() const { - return new MediaValuesDynamic(frame_, viewport_dimensions_overridden_, - viewport_width_override_, - viewport_height_override_); + return MakeGarbageCollected<MediaValuesDynamic>( + frame_, viewport_dimensions_overridden_, viewport_width_override_, + viewport_height_override_); } bool MediaValuesDynamic::ComputeLength(double value, diff --git a/chromium/third_party/blink/renderer/core/css/media_values_dynamic.h b/chromium/third_party/blink/renderer/core/css/media_values_dynamic.h index d4c346fd082..0d522475059 100644 --- a/chromium/third_party/blink/renderer/core/css/media_values_dynamic.h +++ b/chromium/third_party/blink/renderer/core/css/media_values_dynamic.h @@ -15,6 +15,13 @@ class CORE_EXPORT MediaValuesDynamic : public MediaValues { public: static MediaValues* Create(Document&); static MediaValues* Create(LocalFrame*); + + MediaValuesDynamic(LocalFrame*); + MediaValuesDynamic(LocalFrame*, + bool overridden_viewport_dimensions, + double viewport_width, + double viewport_height); + MediaValues* Copy() const override; bool ComputeLength(double value, CSSPrimitiveValue::UnitType, @@ -48,12 +55,6 @@ class CORE_EXPORT MediaValuesDynamic : public MediaValues { void Trace(blink::Visitor*) override; protected: - MediaValuesDynamic(LocalFrame*); - MediaValuesDynamic(LocalFrame*, - bool overridden_viewport_dimensions, - double viewport_width, - double viewport_height); - Member<LocalFrame> frame_; bool viewport_dimensions_overridden_; double viewport_width_override_; diff --git a/chromium/third_party/blink/renderer/core/css/media_values_initial_viewport.cc b/chromium/third_party/blink/renderer/core/css/media_values_initial_viewport.cc index 8333e597584..876b2531e93 100644 --- a/chromium/third_party/blink/renderer/core/css/media_values_initial_viewport.cc +++ b/chromium/third_party/blink/renderer/core/css/media_values_initial_viewport.cc @@ -12,7 +12,7 @@ namespace blink { MediaValuesInitialViewport* MediaValuesInitialViewport::Create( LocalFrame& frame) { - return new MediaValuesInitialViewport(frame); + return MakeGarbageCollected<MediaValuesInitialViewport>(frame); } MediaValuesInitialViewport::MediaValuesInitialViewport(LocalFrame& frame) diff --git a/chromium/third_party/blink/renderer/core/css/media_values_initial_viewport.h b/chromium/third_party/blink/renderer/core/css/media_values_initial_viewport.h index 741c4d6b7b4..2956252dfe9 100644 --- a/chromium/third_party/blink/renderer/core/css/media_values_initial_viewport.h +++ b/chromium/third_party/blink/renderer/core/css/media_values_initial_viewport.h @@ -13,11 +13,10 @@ class CORE_EXPORT MediaValuesInitialViewport final : public MediaValuesDynamic { public: static MediaValuesInitialViewport* Create(LocalFrame&); + MediaValuesInitialViewport(LocalFrame&); + double ViewportWidth() const override; double ViewportHeight() const override; - - private: - MediaValuesInitialViewport(LocalFrame&); }; } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/offscreen_font_selector.h b/chromium/third_party/blink/renderer/core/css/offscreen_font_selector.h index 88fd83136bc..79c2a1d077f 100644 --- a/chromium/third_party/blink/renderer/core/css/offscreen_font_selector.h +++ b/chromium/third_party/blink/renderer/core/css/offscreen_font_selector.h @@ -22,8 +22,10 @@ class FontDescription; class CORE_EXPORT OffscreenFontSelector : public FontSelector { public: static OffscreenFontSelector* Create(ExecutionContext* context) { - return new OffscreenFontSelector(context); + return MakeGarbageCollected<OffscreenFontSelector>(context); } + + explicit OffscreenFontSelector(ExecutionContext*); ~OffscreenFontSelector() override; unsigned Version() const override { return 1; } @@ -64,8 +66,6 @@ class CORE_EXPORT OffscreenFontSelector : public FontSelector { void Trace(blink::Visitor*) override; protected: - explicit OffscreenFontSelector(ExecutionContext*); - void DispatchInvalidationCallbacks(); private: diff --git a/chromium/third_party/blink/renderer/core/css/parser/at_rule_descriptor_parser.cc b/chromium/third_party/blink/renderer/core/css/parser/at_rule_descriptor_parser.cc index f67b97c821d..d64c6986e16 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/at_rule_descriptor_parser.cc +++ b/chromium/third_party/blink/renderer/core/css/parser/at_rule_descriptor_parser.cc @@ -28,13 +28,13 @@ CSSValue* ConsumeFontVariantList(CSSParserTokenRange& range) { // 'all' is only allowed in @font-face and with no other values. if (values->length()) return nullptr; - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); } CSSIdentifierValue* font_variant = - CSSParsingUtils::ConsumeFontVariantCSS21(range); + css_parsing_utils::ConsumeFontVariantCSS21(range); if (font_variant) values->Append(*font_variant); - } while (CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(range)); + } while (css_property_parser_helpers::ConsumeCommaIncludingWhitespace(range)); if (values->length()) return values; @@ -43,9 +43,9 @@ CSSValue* ConsumeFontVariantList(CSSParserTokenRange& range) { } CSSIdentifierValue* ConsumeFontDisplay(CSSParserTokenRange& range) { - return CSSPropertyParserHelpers::ConsumeIdent<CSSValueAuto, CSSValueBlock, - CSSValueSwap, CSSValueFallback, - CSSValueOptional>(range); + return css_property_parser_helpers::ConsumeIdent< + CSSValueAuto, CSSValueBlock, CSSValueSwap, CSSValueFallback, + CSSValueOptional>(range); } CSSValueList* ConsumeFontFaceUnicodeRange(CSSParserTokenRange& range) { @@ -61,7 +61,7 @@ CSSValueList* ConsumeFontFaceUnicodeRange(CSSParserTokenRange& range) { if (start > end) return nullptr; values->Append(*CSSUnicodeRangeValue::Create(start, end)); - } while (CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(range)); + } while (css_property_parser_helpers::ConsumeCommaIncludingWhitespace(range)); return values; } @@ -69,7 +69,7 @@ CSSValueList* ConsumeFontFaceUnicodeRange(CSSParserTokenRange& range) { CSSValue* ConsumeFontFaceSrcURI(CSSParserTokenRange& range, const CSSParserContext& context) { String url = - CSSPropertyParserHelpers::ConsumeUrlAsStringView(range).ToString(); + css_property_parser_helpers::ConsumeUrlAsStringView(range).ToString(); if (url.IsNull()) return nullptr; CSSFontFaceSrcValue* uri_value(CSSFontFaceSrcValue::Create( @@ -82,7 +82,8 @@ CSSValue* ConsumeFontFaceSrcURI(CSSParserTokenRange& range, // FIXME: https://drafts.csswg.org/css-fonts says that format() contains a // comma-separated list of strings, but CSSFontFaceSrcValue stores only one // format. Allowing one format for now. - CSSParserTokenRange args = CSSPropertyParserHelpers::ConsumeFunction(range); + CSSParserTokenRange args = + css_property_parser_helpers::ConsumeFunction(range); const CSSParserToken& arg = args.ConsumeIncludingWhitespace(); if ((arg.GetType() != kStringToken) || !args.AtEnd()) return nullptr; @@ -92,7 +93,8 @@ CSSValue* ConsumeFontFaceSrcURI(CSSParserTokenRange& range, CSSValue* ConsumeFontFaceSrcLocal(CSSParserTokenRange& range, const CSSParserContext& context) { - CSSParserTokenRange args = CSSPropertyParserHelpers::ConsumeFunction(range); + CSSParserTokenRange args = + css_property_parser_helpers::ConsumeFunction(range); ContentSecurityPolicyDisposition should_check_content_security_policy = context.ShouldCheckContentSecurityPolicy(); if (args.Peek().GetType() == kStringToken) { @@ -103,7 +105,7 @@ CSSValue* ConsumeFontFaceSrcLocal(CSSParserTokenRange& range, arg.Value().ToString(), should_check_content_security_policy); } if (args.Peek().GetType() == kIdentToken) { - String family_name = CSSParsingUtils::ConcatenateFamilyName(args); + String family_name = css_parsing_utils::ConcatenateFamilyName(args); if (!args.AtEnd()) return nullptr; return CSSFontFaceSrcValue::CreateLocal( @@ -127,7 +129,7 @@ CSSValueList* ConsumeFontFaceSrc(CSSParserTokenRange& range, if (!parsed_value) return nullptr; values->Append(*parsed_value); - } while (CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(range)); + } while (css_property_parser_helpers::ConsumeCommaIncludingWhitespace(range)); return values; } @@ -141,9 +143,9 @@ CSSValue* AtRuleDescriptorParser::ParseFontFaceDescriptor( range.ConsumeWhitespace(); switch (id) { case AtRuleDescriptorID::FontFamily: - if (CSSParsingUtils::ConsumeGenericFamily(range)) + if (css_parsing_utils::ConsumeGenericFamily(range)) return nullptr; - parsed_value = CSSParsingUtils::ConsumeFamilyName(range); + parsed_value = css_parsing_utils::ConsumeFamilyName(range); break; case AtRuleDescriptorID::Src: // This is a list of urls or local // references. @@ -157,21 +159,21 @@ CSSValue* AtRuleDescriptorParser::ParseFontFaceDescriptor( break; case AtRuleDescriptorID::FontStretch: parsed_value = - CSSParsingUtils::ConsumeFontStretch(range, kCSSFontFaceRuleMode); + css_parsing_utils::ConsumeFontStretch(range, kCSSFontFaceRuleMode); break; case AtRuleDescriptorID::FontStyle: parsed_value = - CSSParsingUtils::ConsumeFontStyle(range, kCSSFontFaceRuleMode); + css_parsing_utils::ConsumeFontStyle(range, kCSSFontFaceRuleMode); break; case AtRuleDescriptorID::FontVariant: parsed_value = ConsumeFontVariantList(range); break; case AtRuleDescriptorID::FontWeight: parsed_value = - CSSParsingUtils::ConsumeFontWeight(range, kCSSFontFaceRuleMode); + css_parsing_utils::ConsumeFontWeight(range, kCSSFontFaceRuleMode); break; case AtRuleDescriptorID::FontFeatureSettings: - parsed_value = CSSParsingUtils::ConsumeFontFeatureSettings(range); + parsed_value = css_parsing_utils::ConsumeFontFeatureSettings(range); break; default: break; diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_at_rule_id.cc b/chromium/third_party/blink/renderer/core/css/parser/css_at_rule_id.cc index ca147bf985e..d9850ed87ce 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_at_rule_id.cc +++ b/chromium/third_party/blink/renderer/core/css/parser/css_at_rule_id.cc @@ -14,6 +14,8 @@ CSSAtRuleID CssAtRuleID(StringView name) { return kCSSAtRuleCharset; if (EqualIgnoringASCIICase(name, "font-face")) return kCSSAtRuleFontFace; + if (EqualIgnoringASCIICase(name, "font-feature-values")) + return kCSSAtRuleFontFeatureValues; if (EqualIgnoringASCIICase(name, "import")) return kCSSAtRuleImport; if (EqualIgnoringASCIICase(name, "keyframes")) @@ -43,6 +45,9 @@ void CountAtRule(const CSSParserContext* context, CSSAtRuleID rule_id) { case kCSSAtRuleFontFace: feature = WebFeature::kCSSAtRuleFontFace; break; + case kCSSAtRuleFontFeatureValues: + feature = WebFeature::kCSSAtRuleFontFeatureValues; + break; case kCSSAtRuleImport: feature = WebFeature::kCSSAtRuleImport; break; diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_at_rule_id.h b/chromium/third_party/blink/renderer/core/css/parser/css_at_rule_id.h index 60bed62c078..89404368c14 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_at_rule_id.h +++ b/chromium/third_party/blink/renderer/core/css/parser/css_at_rule_id.h @@ -12,19 +12,18 @@ namespace blink { class CSSParserContext; enum CSSAtRuleID { - kCSSAtRuleInvalid = 0, - - kCSSAtRuleCharset = 1, - kCSSAtRuleFontFace = 2, - kCSSAtRuleImport = 3, - kCSSAtRuleKeyframes = 4, - kCSSAtRuleMedia = 5, - kCSSAtRuleNamespace = 6, - kCSSAtRulePage = 7, - kCSSAtRuleSupports = 8, - kCSSAtRuleViewport = 9, - - kCSSAtRuleWebkitKeyframes = 10, + kCSSAtRuleInvalid, + kCSSAtRuleCharset, + kCSSAtRuleFontFace, + kCSSAtRuleFontFeatureValues, + kCSSAtRuleImport, + kCSSAtRuleKeyframes, + kCSSAtRuleMedia, + kCSSAtRuleNamespace, + kCSSAtRulePage, + kCSSAtRuleSupports, + kCSSAtRuleViewport, + kCSSAtRuleWebkitKeyframes, }; CSSAtRuleID CssAtRuleID(StringView name); diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_lazy_parsing_state.cc b/chromium/third_party/blink/renderer/core/css/parser/css_lazy_parsing_state.cc index 1051232f6a7..9188af0af1f 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_lazy_parsing_state.cc +++ b/chromium/third_party/blink/renderer/core/css/parser/css_lazy_parsing_state.cc @@ -35,27 +35,6 @@ const CSSParserContext* CSSLazyParsingState::Context() { return context_; } -bool CSSLazyParsingState::ShouldLazilyParseProperties( - const CSSSelectorList& selectors) const { - // Disallow lazy parsing for blocks which have before/after in their selector - // list. This ensures we don't cause a collectFeatures() when we trigger - // parsing for attr() functions which would trigger expensive invalidation - // propagation. - for (const auto* s = selectors.FirstForCSSOM(); s; - s = CSSSelectorList::Next(*s)) { - for (const CSSSelector* current = s; current; - current = current->TagHistory()) { - const CSSSelector::PseudoType type(current->GetPseudoType()); - if (type == CSSSelector::kPseudoBefore || - type == CSSSelector::kPseudoAfter) - return false; - if (current->Relation() != CSSSelector::kSubSelector) - break; - } - } - return true; -} - void CSSLazyParsingState::Trace(blink::Visitor* visitor) { visitor->Trace(owning_contents_); visitor->Trace(document_); diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_lazy_parsing_state.h b/chromium/third_party/blink/renderer/core/css/parser/css_lazy_parsing_state.h index 1e50644f8ea..6b7ad897bc1 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_lazy_parsing_state.h +++ b/chromium/third_party/blink/renderer/core/css/parser/css_lazy_parsing_state.h @@ -30,7 +30,6 @@ class CSSLazyParsingState const CSSParserContext* Context(); const String& SheetText() const { return sheet_text_; } - bool ShouldLazilyParseProperties(const CSSSelectorList&) const; void Trace(blink::Visitor*); diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_lazy_parsing_test.cc b/chromium/third_party/blink/renderer/core/css/parser/css_lazy_parsing_test.cc index 961cfad7598..394a65d1f91 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_lazy_parsing_test.cc +++ b/chromium/third_party/blink/renderer/core/css/parser/css_lazy_parsing_test.cc @@ -45,9 +45,7 @@ TEST_F(CSSLazyParsingTest, Simple) { EXPECT_TRUE(HasParsedProperties(rule)); } -// Avoid parsing rules with ::before or ::after to avoid causing -// collectFeatures() when we trigger parsing for attr(); -TEST_F(CSSLazyParsingTest, DontLazyParseBeforeAfter) { +TEST_F(CSSLazyParsingTest, LazyParseBeforeAfter) { CSSParserContext* context = CSSParserContext::Create( kHTMLStandardMode, SecureContextMode::kInsecureContext); StyleSheetContents* style_sheet = StyleSheetContents::Create(context); @@ -57,8 +55,8 @@ TEST_F(CSSLazyParsingTest, DontLazyParseBeforeAfter) { CSSParser::ParseSheet(context, style_sheet, sheet_text, CSSDeferPropertyParsing::kYes); - EXPECT_TRUE(HasParsedProperties(RuleAt(style_sheet, 0))); - EXPECT_TRUE(HasParsedProperties(RuleAt(style_sheet, 1))); + EXPECT_FALSE(HasParsedProperties(RuleAt(style_sheet, 0))); + EXPECT_FALSE(HasParsedProperties(RuleAt(style_sheet, 1))); } // Test for crbug.com/664115 where |shouldConsiderForMatchingRules| would flip @@ -88,8 +86,8 @@ TEST_F(CSSLazyParsingTest, ShouldConsiderForMatchingRulesDoesntChange1) { rule->ShouldConsiderForMatchingRules(false /* includeEmptyRules */)); } -// Test the same thing as above, with a property that does not get lazy parsed, -// to ensure that we perform the optimization where possible. +// Test the same thing as above with lazy parsing off to ensure that we perform +// the optimization where possible. TEST_F(CSSLazyParsingTest, ShouldConsiderForMatchingRulesSimple) { CSSParserContext* context = CSSParserContext::Create( kHTMLStandardMode, SecureContextMode::kInsecureContext); @@ -97,7 +95,7 @@ TEST_F(CSSLazyParsingTest, ShouldConsiderForMatchingRulesSimple) { String sheet_text = "p::before { ,badness, } "; CSSParser::ParseSheet(context, style_sheet, sheet_text, - CSSDeferPropertyParsing::kYes); + CSSDeferPropertyParsing::kNo); StyleRule* rule = RuleAt(style_sheet, 0); EXPECT_TRUE(HasParsedProperties(rule)); diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_parser.cc b/chromium/third_party/blink/renderer/core/css/parser/css_parser.cc index 9f354dd04ec..35d92911d1d 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_parser.cc +++ b/chromium/third_party/blink/renderer/core/css/parser/css_parser.cc @@ -186,6 +186,14 @@ ImmutableCSSPropertyValueSet* CSSParser::ParseInlineStyleDeclaration( return CSSParserImpl::ParseInlineStyleDeclaration(style_string, element); } +ImmutableCSSPropertyValueSet* CSSParser::ParseInlineStyleDeclaration( + const String& style_string, + CSSParserMode parser_mode, + SecureContextMode secure_context_mode) { + return CSSParserImpl::ParseInlineStyleDeclaration(style_string, parser_mode, + secure_context_mode); +} + std::unique_ptr<Vector<double>> CSSParser::ParseKeyframeKeyList( const String& key_list) { return CSSParserImpl::ParseKeyframeKeyList(key_list); diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_parser.h b/chromium/third_party/blink/renderer/core/css/parser/css_parser.h index 118bb97223f..e13bb6c4f01 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_parser.h +++ b/chromium/third_party/blink/renderer/core/css/parser/css_parser.h @@ -7,9 +7,9 @@ #include <memory> #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/css_property_value_set.h" #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" -#include "third_party/blink/renderer/core/css_property_names.h" namespace blink { @@ -88,6 +88,8 @@ class CORE_EXPORT CSSParser { static ImmutableCSSPropertyValueSet* ParseInlineStyleDeclaration( const String&, Element*); + static ImmutableCSSPropertyValueSet* + ParseInlineStyleDeclaration(const String&, CSSParserMode, SecureContextMode); static std::unique_ptr<Vector<double>> ParseKeyframeKeyList(const String&); static StyleRuleKeyframe* ParseKeyframeRule(const CSSParserContext*, diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_parser_context.cc b/chromium/third_party/blink/renderer/core/css/parser/css_parser_context.cc index b02890d02ff..fa214682792 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_parser_context.cc +++ b/chromium/third_party/blink/renderer/core/css/parser/css_parser_context.cc @@ -4,9 +4,14 @@ #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" +#include "third_party/blink/renderer/core/css/css_custom_ident_value.h" #include "third_party/blink/renderer/core/css/css_style_sheet.h" +#include "third_party/blink/renderer/core/css/css_value_list.h" +#include "third_party/blink/renderer/core/css/style_rule_keyframe.h" #include "third_party/blink/renderer/core/css/style_sheet_contents.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" +#include "third_party/blink/renderer/core/feature_policy/feature_policy.h" +#include "third_party/blink/renderer/core/feature_policy/layout_animations_policy.h" #include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" #include "third_party/blink/renderer/core/frame/deprecation.h" #include "third_party/blink/renderer/core/frame/settings.h" @@ -27,7 +32,7 @@ CSSParserContext* CSSParserContext::Create(const ExecutionContext& context) { else policy_disposition = kCheckContentSecurityPolicy; - return new CSSParserContext( + return MakeGarbageCollected<CSSParserContext>( context.Url(), false /* is_opaque_response_from_service_worker */, WTF::TextEncoding(), kHTMLStandardMode, kHTMLStandardMode, kLiveProfile, referrer, true, false, context.GetSecureContextMode(), policy_disposition, @@ -54,7 +59,7 @@ CSSParserContext* CSSParserContext::CreateWithStyleSheetContents( CSSParserContext* CSSParserContext::Create( const CSSParserContext* other, const Document* use_counter_document) { - return new CSSParserContext( + return MakeGarbageCollected<CSSParserContext>( other->base_url_, other->is_opaque_response_from_service_worker_, other->charset_, other->mode_, other->match_mode_, other->profile_, other->referrer_, other->is_html_document_, @@ -68,10 +73,10 @@ CSSParserContext* CSSParserContext::Create( const CSSParserContext* other, const KURL& base_url, bool is_opaque_response_from_service_worker, - ReferrerPolicy referrer_policy, + network::mojom::ReferrerPolicy referrer_policy, const WTF::TextEncoding& charset, const Document* use_counter_document) { - return new CSSParserContext( + return MakeGarbageCollected<CSSParserContext>( base_url, is_opaque_response_from_service_worker, charset, other->mode_, other->match_mode_, other->profile_, Referrer(base_url.StrippedForUseAsReferrer(), referrer_policy), @@ -87,7 +92,7 @@ CSSParserContext* CSSParserContext::Create( SecureContextMode secure_context_mode, SelectorProfile profile, const Document* use_counter_document) { - return new CSSParserContext( + return MakeGarbageCollected<CSSParserContext>( KURL(), false /* is_opaque_response_from_service_worker */, WTF::TextEncoding(), mode, mode, profile, Referrer(), false, false, secure_context_mode, kDoNotCheckContentSecurityPolicy, @@ -107,7 +112,7 @@ CSSParserContext* CSSParserContext::Create( const Document& document, const KURL& base_url_override, bool is_opaque_response_from_service_worker, - ReferrerPolicy referrer_policy_override, + network::mojom::ReferrerPolicy referrer_policy_override, const WTF::TextEncoding& charset, SelectorProfile profile) { CSSParserMode mode = @@ -137,7 +142,7 @@ CSSParserContext* CSSParserContext::Create( else policy_disposition = kCheckContentSecurityPolicy; - return new CSSParserContext( + return MakeGarbageCollected<CSSParserContext>( base_url_override, is_opaque_response_from_service_worker, charset, mode, match_mode, profile, referrer, document.IsHTMLDocument(), use_legacy_background_size_shorthand_behavior, @@ -239,6 +244,22 @@ bool CSSParserContext::IsDocumentHandleEqual(const Document* other) const { return document_.Get() == other; } +bool CSSParserContext::IsLayoutAnimationsPolicyEnforced() const { + return document_ && !document_->IsFeatureEnabled( + mojom::FeaturePolicyFeature::kLayoutAnimations); +} + +void CSSParserContext::ReportLayoutAnimationsViolationIfNeeded( + const StyleRuleKeyframe& rule) const { + DCHECK(IsLayoutAnimationsPolicyEnforced()); + for (size_t i = 0; i < rule.Properties().PropertyCount(); ++i) { + const CSSProperty& property = rule.Properties().PropertyAt(i).Property(); + if (!LayoutAnimationsPolicy::AffectedCSSProperties().Contains(&property)) + continue; + LayoutAnimationsPolicy::ReportViolation(property, *document_); + } +} + void CSSParserContext::Trace(blink::Visitor* visitor) { visitor->Trace(document_); } diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_parser_context.h b/chromium/third_party/blink/renderer/core/css/parser/css_parser_context.h index 851e068e373..c14c66fda31 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_parser_context.h +++ b/chromium/third_party/blink/renderer/core/css/parser/css_parser_context.h @@ -6,8 +6,8 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PARSER_CSS_PARSER_CONTEXT_H_ #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/parser/css_parser_mode.h" -#include "third_party/blink/renderer/core/css_property_names.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/frame/web_feature_forward.h" #include "third_party/blink/renderer/platform/heap/handle.h" @@ -20,6 +20,7 @@ namespace blink { class CSSStyleSheet; class Document; +class StyleRuleKeyframe; class StyleSheetContents; class CORE_EXPORT CSSParserContext @@ -41,12 +42,13 @@ class CORE_EXPORT CSSParserContext static CSSParserContext* Create(const CSSParserContext* other, const Document* use_counter_document); - static CSSParserContext* Create(const CSSParserContext* other, - const KURL& base_url_override, - bool is_opaque_response_from_service_worker, - ReferrerPolicy referrer_policy_override, - const WTF::TextEncoding& charset_override, - const Document* use_counter_document); + static CSSParserContext* Create( + const CSSParserContext* other, + const KURL& base_url_override, + bool is_opaque_response_from_service_worker, + network::mojom::ReferrerPolicy referrer_policy_override, + const WTF::TextEncoding& charset_override, + const Document* use_counter_document); static CSSParserContext* Create( CSSParserMode, @@ -58,12 +60,25 @@ class CORE_EXPORT CSSParserContext const Document&, const KURL& base_url_override, bool is_opaque_response_from_service_worker, - ReferrerPolicy referrer_policy_override, + network::mojom::ReferrerPolicy referrer_policy_override, const WTF::TextEncoding& charset = WTF::TextEncoding(), SelectorProfile = kLiveProfile); // This is used for workers, where we don't have a document. static CSSParserContext* Create(const ExecutionContext&); + CSSParserContext(const KURL& base_url, + bool is_opaque_response_from_service_worker, + const WTF::TextEncoding& charset, + CSSParserMode, + CSSParserMode match_mode, + SelectorProfile, + const Referrer&, + bool is_html_document, + bool use_legacy_background_size_shorthand_behavior, + SecureContextMode, + ContentSecurityPolicyDisposition, + const Document* use_counter_document); + bool operator==(const CSSParserContext&) const; bool operator!=(const CSSParserContext& other) const { return !(*this == other); @@ -110,22 +125,16 @@ class CORE_EXPORT CSSParserContext return should_check_content_security_policy_; } + // TODO(ekaramad): We currently only report @keyframes violations. We need to + // report CSS transitions as well (https://crbug.com/906147). + // TODO(ekaramad): We should provide a source location in the violation + // report (https://crbug.com/906150, ). + bool IsLayoutAnimationsPolicyEnforced() const; + void ReportLayoutAnimationsViolationIfNeeded(const StyleRuleKeyframe&) const; + void Trace(blink::Visitor*); private: - CSSParserContext(const KURL& base_url, - bool is_opaque_response_from_service_worker, - const WTF::TextEncoding& charset, - CSSParserMode, - CSSParserMode match_mode, - SelectorProfile, - const Referrer&, - bool is_html_document, - bool use_legacy_background_size_shorthand_behavior, - SecureContextMode, - ContentSecurityPolicyDisposition, - const Document* use_counter_document); - KURL base_url_; const bool is_opaque_response_from_service_worker_; WTF::TextEncoding charset_; diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_parser_fast_paths.cc b/chromium/third_party/blink/renderer/core/css/parser/css_parser_fast_paths.cc index 19be54166b1..07d25b3c6f3 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_parser_fast_paths.cc +++ b/chromium/third_party/blink/renderer/core/css/parser/css_parser_fast_paths.cc @@ -665,7 +665,7 @@ bool CSSParserFastPaths::IsValidKeywordPropertyAndValue( case CSSPropertyPointerEvents: return value_id == CSSValueVisible || value_id == CSSValueNone || value_id == CSSValueAll || value_id == CSSValueAuto || - (value_id >= CSSValueVisiblePainted && + (value_id >= CSSValueVisiblepainted && value_id <= CSSValueBoundingBox); case CSSPropertyPosition: return value_id == CSSValueStatic || value_id == CSSValueRelative || @@ -678,7 +678,6 @@ bool CSSParserFastPaths::IsValidKeywordPropertyAndValue( (value_id == CSSValueBlock || value_id == CSSValueInline)) || value_id == CSSValueAuto; case CSSPropertyScrollBehavior: - DCHECK(RuntimeEnabledFeatures::CSSOMSmoothScrollEnabled()); return value_id == CSSValueAuto || value_id == CSSValueSmooth; case CSSPropertyShapeRendering: return value_id == CSSValueAuto || value_id == CSSValueOptimizespeed || @@ -883,7 +882,6 @@ bool CSSParserFastPaths::IsValidKeywordPropertyAndValue( return value_id == CSSValueNormal || value_id == CSSValueBreakAll || value_id == CSSValueKeepAll || value_id == CSSValueBreakWord; case CSSPropertyScrollSnapStop: - DCHECK(RuntimeEnabledFeatures::CSSScrollSnapPointsEnabled()); return value_id == CSSValueNormal || value_id == CSSValueAlways; case CSSPropertyOverscrollBehaviorX: return value_id == CSSValueAuto || value_id == CSSValueContain || diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_parser_fast_paths.h b/chromium/third_party/blink/renderer/core/css/parser/css_parser_fast_paths.h index 4d491dc3e65..17109539d67 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_parser_fast_paths.h +++ b/chromium/third_party/blink/renderer/core/css/parser/css_parser_fast_paths.h @@ -5,7 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PARSER_CSS_PARSER_FAST_PATHS_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PARSER_CSS_PARSER_FAST_PATHS_H_ -#include "third_party/blink/renderer/core/css_property_names.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css_value_keywords.h" #include "third_party/blink/renderer/platform/graphics/color.h" #include "third_party/blink/renderer/platform/heap/handle.h" diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_parser_fast_paths_fuzzer.cc b/chromium/third_party/blink/renderer/core/css/parser/css_parser_fast_paths_fuzzer.cc index 193e767d8ae..7d1c0e37830 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_parser_fast_paths_fuzzer.cc +++ b/chromium/third_party/blink/renderer/core/css/parser/css_parser_fast_paths_fuzzer.cc @@ -18,7 +18,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { blink::FuzzedDataProvider provider(data, size); const auto property_id = - blink::convertToCSSPropertyID(provider.ConsumeInt32InRange( + blink::convertToCSSPropertyID(provider.ConsumeIntegralInRange<int>( blink::firstCSSProperty, blink::lastCSSProperty)); const auto data_string = provider.ConsumeRemainingBytes(); @@ -31,12 +31,5 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { static_cast<blink::CSSParserMode>(parser_mode)); } -#if defined(ADDRESS_SANITIZER) - // LSAN needs unreachable objects to be released to avoid reporting them - // incorrectly as a memory leak. - blink::ThreadState* currentThreadState = blink::ThreadState::Current(); - currentThreadState->CollectAllGarbage(); -#endif - return 0; } diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_parser_impl.cc b/chromium/third_party/blink/renderer/core/css/parser/css_parser_impl.cc index a38daa0943c..1f1d7f8c47e 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_parser_impl.cc +++ b/chromium/third_party/blink/renderer/core/css/parser/css_parser_impl.cc @@ -25,6 +25,7 @@ #include "third_party/blink/renderer/core/css/parser/css_tokenizer.h" #include "third_party/blink/renderer/core/css/parser/css_variable_parser.h" #include "third_party/blink/renderer/core/css/parser/media_query_parser.h" +#include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" #include "third_party/blink/renderer/core/css/property_registry.h" #include "third_party/blink/renderer/core/css/style_rule_import.h" #include "third_party/blink/renderer/core/css/style_rule_keyframe.h" @@ -192,6 +193,19 @@ ImmutableCSSPropertyValueSet* CSSParserImpl::ParseInlineStyleDeclaration( return CreateCSSPropertyValueSet(parser.parsed_properties_, mode); } +ImmutableCSSPropertyValueSet* CSSParserImpl::ParseInlineStyleDeclaration( + const String& string, + CSSParserMode parser_mode, + SecureContextMode secure_context_mode) { + CSSParserContext* context = + CSSParserContext::Create(parser_mode, secure_context_mode); + CSSParserImpl parser(context); + CSSTokenizer tokenizer(string); + CSSParserTokenStream stream(tokenizer); + parser.ConsumeDeclarationList(stream, StyleRule::kStyle); + return CreateCSSPropertyValueSet(parser.parsed_properties_, parser_mode); +} + bool CSSParserImpl::ParseDeclarationList( MutableCSSPropertyValueSet* declaration, const String& string, @@ -258,8 +272,8 @@ ParseSheetResult CSSParserImpl::ParseStyleSheet( CSSParserTokenStream stream(tokenizer); CSSParserImpl parser(context, style_sheet); if (defer_property_parsing == CSSDeferPropertyParsing::kYes) { - parser.lazy_state_ = - new CSSLazyParsingState(context, string, parser.style_sheet_); + parser.lazy_state_ = MakeGarbageCollected<CSSLazyParsingState>( + context, string, parser.style_sheet_); } ParseSheetResult result = ParseSheetResult::kSucceeded; bool first_rule_valid = parser.ConsumeRuleList( @@ -397,6 +411,7 @@ static CSSParserImpl::AllowedRulesType ComputeNewAllowedRules( CSSParserImpl::AllowedRulesType allowed_rules, StyleRuleBase* rule) { if (!rule || allowed_rules == CSSParserImpl::kKeyframeRules || + allowed_rules == CSSParserImpl::kFontFeatureRules || allowed_rules == CSSParserImpl::kNoRules) return allowed_rules; DCHECK_LE(allowed_rules, CSSParserImpl::kRegularRules); @@ -422,6 +437,9 @@ bool CSSParserImpl::ConsumeRuleList(CSSParserTokenStream& stream, case kKeyframesRuleList: allowed_rules = kKeyframeRules; break; + case kFontFeatureRuleList: + allowed_rules = kFontFeatureRules; + break; default: NOTREACHED(); } @@ -502,6 +520,9 @@ StyleRuleBase* CSSParserImpl::ConsumeAtRule(CSSParserTokenStream& stream, if (allowed_rules == kKeyframeRules) return nullptr; // Parse error, no at-rules supported inside @keyframes + // Parse error, no at-rules currently supported inside @font-feature-values + if (allowed_rules == kFontFeatureRules) + return nullptr; if (allowed_rules == kNoRules) return nullptr; // Parse error, no at-rules with blocks supported inside // declaration lists @@ -517,6 +538,8 @@ StyleRuleBase* CSSParserImpl::ConsumeAtRule(CSSParserTokenStream& stream, return ConsumeViewportRule(prelude, prelude_offset, stream); case kCSSAtRuleFontFace: return ConsumeFontFaceRule(prelude, prelude_offset, stream); + case kCSSAtRuleFontFeatureValues: + return ConsumeFontFeatureValuesRule(prelude, prelude_offset, stream); case kCSSAtRuleWebkitKeyframes: return ConsumeKeyframesRule(true, prelude, prelude_offset, stream); case kCSSAtRuleKeyframes: @@ -547,7 +570,34 @@ StyleRuleBase* CSSParserImpl::ConsumeQualifiedRule( return nullptr; // Parse error, EOF instead of qualified rule block CSSParserTokenStream::BlockGuard guard(stream); - return ConsumeKeyframeStyleRule(prelude, prelude_offset, stream); + StyleRuleKeyframe* keyframe_style_rule = + ConsumeKeyframeStyleRule(prelude, prelude_offset, stream); + if (context_->IsLayoutAnimationsPolicyEnforced()) { + context_->ReportLayoutAnimationsViolationIfNeeded(*keyframe_style_rule); + } + return keyframe_style_rule; + } + if (allowed_rules == kFontFeatureRules) { + stream.ConsumeWhitespace(); + if (stream.AtEnd()) + return nullptr; // Parse error, EOF instead of qualified rule block + bool prelude_invalid = false; + stream.EnsureLookAhead(); + if (stream.UncheckedPeek().GetType() != kLeftBraceToken) { + prelude_invalid = true; + while (!stream.AtEnd() && + stream.UncheckedPeek().GetType() != kLeftBraceToken) + stream.UncheckedConsumeComponentValue(); + if (stream.AtEnd()) + return nullptr; + } + + CSSParserTokenStream::BlockGuard guard(stream); + if (prelude_invalid) + return nullptr; + ConsumeDeclarationList(stream, StyleRule::kFontFace); + return StyleRuleFontFace::Create( + CreateCSSPropertyValueSet(parsed_properties_, kCSSFontFaceRuleMode)); } NOTREACHED(); @@ -716,6 +766,43 @@ StyleRuleFontFace* CSSParserImpl::ConsumeFontFaceRule( CreateCSSPropertyValueSet(parsed_properties_, kCSSFontFaceRuleMode)); } +StyleRuleFontFeatureValues* CSSParserImpl::ConsumeFontFeatureValuesRule( + CSSParserTokenRange prelude, + const RangeOffset& prelude_offset, + CSSParserTokenStream& block) { + if (!RuntimeEnabledFeatures::CSSFontFeatureValuesEnabled()) + return nullptr; + + const CSSValueList* font_family = + css_parsing_utils::ConsumeFontFamily(prelude); + if (!font_family || !prelude.AtEnd()) + return nullptr; + + if (observer_) { + observer_->StartRuleHeader(StyleRule::kFontFeatureValues, + prelude_offset.start); + observer_->EndRuleHeader(prelude_offset.end); + observer_->StartRuleBody(block.Offset()); + } + + const CSSIdentifierValue* font_display = nullptr; + ConsumeRuleList( + block, kFontFeatureRuleList, [&font_display](StyleRuleBase* rule) { + const CSSValue* value = + ToStyleRuleFontFace(rule)->Properties().GetPropertyCSSValue( + CSSPropertyFontDisplay); + if (value) + font_display = ToCSSIdentifierValue(value); + }); + + if (observer_) + observer_->EndRuleBody(block.Offset()); + + if (!block.AtEnd()) + return nullptr; + return StyleRuleFontFeatureValues::Create(font_family, font_display); +} + StyleRuleKeyframes* CSSParserImpl::ConsumeKeyframesRule( bool webkit_prefixed, CSSParserTokenRange prelude, @@ -824,12 +911,12 @@ StyleRule* CSSParserImpl::ConsumeStyleRule(CSSParserTokenStream& stream) { return nullptr; // Parse error, invalid selector list // TODO(csharrison): How should we lazily parse css that needs the observer? - if (!observer_ && lazy_state_ && - lazy_state_->ShouldLazilyParseProperties(selector_list)) { + if (!observer_ && lazy_state_) { DCHECK(style_sheet_); return StyleRule::CreateLazy( std::move(selector_list), - new CSSLazyPropertyParserImpl(stream.Offset() - 1, lazy_state_)); + MakeGarbageCollected<CSSLazyPropertyParserImpl>(stream.Offset() - 1, + lazy_state_)); } ConsumeDeclarationList(stream, StyleRule::kStyle); diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_parser_impl.h b/chromium/third_party/blink/renderer/core/css/parser/css_parser_impl.h index 37bf28a0b98..58c53ab8ebf 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_parser_impl.h +++ b/chromium/third_party/blink/renderer/core/css/parser/css_parser_impl.h @@ -8,11 +8,11 @@ #include <memory> #include "base/macros.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/css_property_source_data.h" #include "third_party/blink/renderer/core/css/css_property_value.h" #include "third_party/blink/renderer/core/css/css_property_value_set.h" #include "third_party/blink/renderer/core/css/parser/css_parser_token_range.h" -#include "third_party/blink/renderer/core/css_property_names.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/vector.h" @@ -26,6 +26,7 @@ class CSSParserTokenStream; class StyleRule; class StyleRuleBase; class StyleRuleCharset; +class StyleRuleFontFeatureValues; class StyleRuleFontFace; class StyleRuleImport; class StyleRuleKeyframe; @@ -60,7 +61,8 @@ class CSSParserImpl { kAllowNamespaceRules, kRegularRules, kKeyframeRules, - kNoRules, // For parsing at-rules inside declaration lists + kFontFeatureRules, + kNoRules, // For parsing at-rules inside declaration lists }; // Represents the start and end offsets of a CSSParserTokenRange. @@ -93,6 +95,8 @@ class CSSParserImpl { static ImmutableCSSPropertyValueSet* ParseInlineStyleDeclaration( const String&, Element*); + static ImmutableCSSPropertyValueSet* + ParseInlineStyleDeclaration(const String&, CSSParserMode, SecureContextMode); static bool ParseDeclarationList(MutableCSSPropertyValueSet*, const String&, const CSSParserContext*); @@ -127,7 +131,12 @@ class CSSParserImpl { const CSSParserContext*); private: - enum RuleListType { kTopLevelRuleList, kRegularRuleList, kKeyframesRuleList }; + enum RuleListType { + kTopLevelRuleList, + kRegularRuleList, + kKeyframesRuleList, + kFontFeatureRuleList, + }; // Returns whether the first encountered rule was valid template <typename T> @@ -154,6 +163,10 @@ class CSSParserImpl { StyleRuleFontFace* ConsumeFontFaceRule(CSSParserTokenRange prelude, const RangeOffset& prelude_offset, CSSParserTokenStream& block); + StyleRuleFontFeatureValues* ConsumeFontFeatureValuesRule( + CSSParserTokenRange prelude, + const RangeOffset& prelude_offset, + CSSParserTokenStream& block); StyleRuleKeyframes* ConsumeKeyframesRule(bool webkit_prefixed, CSSParserTokenRange prelude, const RangeOffset& prelude_offset, diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_parser_local_context.cc b/chromium/third_party/blink/renderer/core/css/parser/css_parser_local_context.cc index bb8cefa4425..6ac76945e1a 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_parser_local_context.cc +++ b/chromium/third_party/blink/renderer/core/css/parser/css_parser_local_context.cc @@ -7,19 +7,54 @@ namespace blink { CSSParserLocalContext::CSSParserLocalContext() - : use_alias_parsing_(false), current_shorthand_(CSSPropertyInvalid) {} + : use_alias_parsing_(false), + is_animation_tainted_(false), + current_shorthand_(CSSPropertyInvalid), + variable_mode_(VariableMode::kTyped) {} -CSSParserLocalContext::CSSParserLocalContext(bool use_alias_parsing, - CSSPropertyID current_shorthand) - : use_alias_parsing_(use_alias_parsing), - current_shorthand_(current_shorthand) {} +CSSParserLocalContext CSSParserLocalContext::WithAliasParsing( + bool use_alias_parsing) const { + CSSParserLocalContext context = *this; + context.use_alias_parsing_ = use_alias_parsing; + return context; +} + +CSSParserLocalContext CSSParserLocalContext::WithAnimationTainted( + bool is_animation_tainted) const { + CSSParserLocalContext context = *this; + context.is_animation_tainted_ = is_animation_tainted; + return context; +} + +CSSParserLocalContext CSSParserLocalContext::WithCurrentShorthand( + CSSPropertyID current_shorthand) const { + CSSParserLocalContext context = *this; + context.current_shorthand_ = current_shorthand; + return context; +} + +CSSParserLocalContext CSSParserLocalContext::WithVariableMode( + VariableMode variable_mode) const { + CSSParserLocalContext context = *this; + context.variable_mode_ = variable_mode; + return context; +} bool CSSParserLocalContext::UseAliasParsing() const { return use_alias_parsing_; } +bool CSSParserLocalContext::IsAnimationTainted() const { + return is_animation_tainted_; +} + CSSPropertyID CSSParserLocalContext::CurrentShorthand() const { return current_shorthand_; } +CSSParserLocalContext::VariableMode CSSParserLocalContext::GetVariableMode() + const { + return variable_mode_; +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_parser_local_context.h b/chromium/third_party/blink/renderer/core/css/parser/css_parser_local_context.h index 2f1fbf3a20d..d5de80e82ed 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_parser_local_context.h +++ b/chromium/third_party/blink/renderer/core/css/parser/css_parser_local_context.h @@ -5,26 +5,56 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PARSER_CSS_PARSER_LOCAL_CONTEXT_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PARSER_CSS_PARSER_LOCAL_CONTEXT_H_ -#include "third_party/blink/renderer/core/css_property_names.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" namespace blink { // A wrapper class containing all local context when parsing a property. -class CSSParserLocalContext { +class CORE_EXPORT CSSParserLocalContext { STACK_ALLOCATED(); public: CSSParserLocalContext(); - CSSParserLocalContext(bool use_alias_parsing, - CSSPropertyID current_shorthand); + + // When parsing registered custom properties, a different result is required + // depending on the context. + enum class VariableMode { + // The custom property is parsed according to the registered syntax (if + // available). + kTyped, + // The registration of the custom property (if any) is ignored; the custom + // property will parse as if unregistered. + kUntyped, + // The custom property will be parsed as if unregistered (that is, + // a CSSCustomPropertyDeclaration will be returned), but the tokens must + // also match the registered syntax (if any). This is useful for CSSOM, + // where incoming values must validate against the registered syntax, but + // are otherwise treated as unregistered. + kValidatedUntyped + }; + + CSSParserLocalContext WithAliasParsing(bool) const; + CSSParserLocalContext WithAnimationTainted(bool) const; + CSSParserLocalContext WithCurrentShorthand(CSSPropertyID) const; + CSSParserLocalContext WithVariableMode(VariableMode) const; + bool UseAliasParsing() const; + // Any custom property used in a @keyframes rule becomes animation-tainted, + // which prevents the custom property from being substituted into the + // 'animation' property, or one of its longhands. + // + // https://drafts.csswg.org/css-variables/#animation-tainted + bool IsAnimationTainted() const; CSSPropertyID CurrentShorthand() const; + VariableMode GetVariableMode() const; private: bool use_alias_parsing_; + bool is_animation_tainted_; CSSPropertyID current_shorthand_; + VariableMode variable_mode_; }; } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_parser_local_context_test.cc b/chromium/third_party/blink/renderer/core/css/parser/css_parser_local_context_test.cc new file mode 100644 index 00000000000..4fbcac6d178 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/parser/css_parser_local_context_test.cc @@ -0,0 +1,89 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/parser/css_parser_local_context.h" + +#include "testing/gtest/include/gtest/gtest.h" + +namespace blink { + +using VariableMode = CSSParserLocalContext::VariableMode; + +TEST(CSSParserLocalContextTest, Constructor) { + EXPECT_FALSE(CSSParserLocalContext().UseAliasParsing()); + EXPECT_FALSE(CSSParserLocalContext().IsAnimationTainted()); + EXPECT_EQ(CSSPropertyInvalid, CSSParserLocalContext().CurrentShorthand()); + EXPECT_EQ(VariableMode::kTyped, CSSParserLocalContext().GetVariableMode()); +} + +TEST(CSSParserLocalContextTest, WithAliasParsing) { + const CSSParserLocalContext context; + EXPECT_FALSE(context.WithAliasParsing(false).UseAliasParsing()); + EXPECT_TRUE(context.WithAliasParsing(true).UseAliasParsing()); +} + +TEST(CSSParserLocalContextTest, WithAnimationTainted) { + const CSSParserLocalContext context; + EXPECT_FALSE(context.WithAnimationTainted(false).IsAnimationTainted()); + EXPECT_TRUE(context.WithAnimationTainted(true).IsAnimationTainted()); +} + +TEST(CSSParserLocalContextTest, WithCurrentShorthand) { + const CSSParserLocalContext context; + const CSSPropertyID shorthand = CSSPropertyBackground; + EXPECT_EQ(shorthand, + context.WithCurrentShorthand(shorthand).CurrentShorthand()); +} + +TEST(CSSParserLocalContextTest, WithVariableMode) { + auto mode = VariableMode::kUntyped; + auto context = CSSParserLocalContext().WithVariableMode(mode); + EXPECT_EQ(mode, context.GetVariableMode()); +} + +TEST(CSSParserLocalContextTest, LocalMutation) { + CSSParserLocalContext context; + context = context.WithAliasParsing(true); + context = context.WithAnimationTainted(true); + context = context.WithCurrentShorthand(CSSPropertyBackground); + context = context.WithVariableMode(VariableMode::kUntyped); + + // WithAliasParsing only changes that member. + { + auto local_context = context.WithAliasParsing(false); + EXPECT_FALSE(local_context.UseAliasParsing()); + EXPECT_EQ(CSSPropertyBackground, local_context.CurrentShorthand()); + EXPECT_TRUE(local_context.IsAnimationTainted()); + EXPECT_EQ(VariableMode::kUntyped, local_context.GetVariableMode()); + } + + // WithAnimationTainted only changes that member. + { + auto local_context = context.WithAnimationTainted(false); + EXPECT_TRUE(local_context.UseAliasParsing()); + EXPECT_EQ(CSSPropertyBackground, local_context.CurrentShorthand()); + EXPECT_FALSE(local_context.IsAnimationTainted()); + EXPECT_EQ(VariableMode::kUntyped, local_context.GetVariableMode()); + } + + // WithCurrentShorthand only changes that member. + { + auto local_context = context.WithCurrentShorthand(CSSPropertyPadding); + EXPECT_TRUE(local_context.UseAliasParsing()); + EXPECT_EQ(CSSPropertyPadding, local_context.CurrentShorthand()); + EXPECT_TRUE(local_context.IsAnimationTainted()); + EXPECT_EQ(VariableMode::kUntyped, local_context.GetVariableMode()); + } + + // WithVariableMode only changes that member. + { + auto local_context = context.WithVariableMode(VariableMode::kTyped); + EXPECT_TRUE(local_context.UseAliasParsing()); + EXPECT_EQ(CSSPropertyBackground, local_context.CurrentShorthand()); + EXPECT_TRUE(local_context.IsAnimationTainted()); + EXPECT_EQ(VariableMode::kTyped, local_context.GetVariableMode()); + } +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_parser_selector.h b/chromium/third_party/blink/renderer/core/css/parser/css_parser_selector.h index cf602a8948d..b55eda0e968 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_parser_selector.h +++ b/chromium/third_party/blink/renderer/core/css/parser/css_parser_selector.h @@ -96,6 +96,9 @@ class CORE_EXPORT CSSParserSelector { CSSSelector::PseudoType GetPseudoType() const { return selector_->GetPseudoType(); } + bool IsTreeAbidingPseudoElement() const { + return selector_->IsTreeAbidingPseudoElement(); + } const CSSSelectorList* SelectorList() const { return selector_->SelectorList(); } diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_parser_token.cc b/chromium/third_party/blink/renderer/core/css/parser/css_parser_token.cc index aa43d67d9a8..be1580b43da 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_parser_token.cc +++ b/chromium/third_party/blink/renderer/core/css/parser/css_parser_token.cc @@ -131,11 +131,11 @@ bool CSSParserToken::ValueDataCharRawEqual(const CSSParserToken& other) const { return false; if (value_data_char_raw_ == other.value_data_char_raw_ && - value_is8_bit_ == other.value_is8_bit_) + value_is_8bit_ == other.value_is_8bit_) return true; - if (value_is8_bit_) { - return other.value_is8_bit_ + if (value_is_8bit_) { + return other.value_is_8bit_ ? Equal(static_cast<const LChar*>(value_data_char_raw_), static_cast<const LChar*>(other.value_data_char_raw_), value_length_) @@ -143,7 +143,7 @@ bool CSSParserToken::ValueDataCharRawEqual(const CSSParserToken& other) const { static_cast<const UChar*>(other.value_data_char_raw_), value_length_); } else { - return other.value_is8_bit_ + return other.value_is_8bit_ ? Equal(static_cast<const UChar*>(value_data_char_raw_), static_cast<const LChar*>(other.value_data_char_raw_), value_length_) diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_parser_token.h b/chromium/third_party/blink/renderer/core/css/parser/css_parser_token.h index 240d2e7297f..9feebcf15a5 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_parser_token.h +++ b/chromium/third_party/blink/renderer/core/css/parser/css_parser_token.h @@ -111,7 +111,7 @@ class CORE_EXPORT CSSParserToken { return static_cast<CSSParserTokenType>(type_); } StringView Value() const { - if (value_is8_bit_) + if (value_is_8bit_) return StringView(reinterpret_cast<const LChar*>(value_data_char_raw_), value_length_); return StringView(reinterpret_cast<const UChar*>(value_data_char_raw_), @@ -155,7 +155,7 @@ class CORE_EXPORT CSSParserToken { private: void InitValueFromStringView(StringView string) { value_length_ = string.length(); - value_is8_bit_ = string.Is8Bit(); + value_is_8bit_ = string.Is8Bit(); value_data_char_raw_ = string.Bytes(); } bool ValueDataCharRawEqual(const CSSParserToken& other) const; @@ -167,7 +167,7 @@ class CORE_EXPORT CSSParserToken { unsigned unit_ : 7; // CSSPrimitiveValue::UnitType // value_... is an unpacked StringView so that we can pack it // tightly with the rest of this object for a smaller object size. - bool value_is8_bit_ : 1; + bool value_is_8bit_ : 1; unsigned value_length_; const void* value_data_char_raw_; // Either LChar* or UChar*. diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_property_parser.cc b/chromium/third_party/blink/renderer/core/css/parser/css_property_parser.cc index 1f44e2df51b..33bfdf16fe7 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_property_parser.cc +++ b/chromium/third_party/blink/renderer/core/css/parser/css_property_parser.cc @@ -23,7 +23,7 @@ namespace blink { -using namespace CSSPropertyParserHelpers; +using namespace css_property_parser_helpers; class CSSIdentifierValue; @@ -96,13 +96,14 @@ bool CSSPropertyParser::ParseValueStart(CSSPropertyID unresolved_property, bool is_shorthand = property.IsShorthand(); DCHECK(context_); if (is_shorthand) { + const auto local_context = + CSSParserLocalContext() + .WithAliasParsing(isPropertyAlias(unresolved_property)) + .WithCurrentShorthand(property_id); // Variable references will fail to parse here and will fall out to the // variable ref parser below. if (ToShorthand(property).ParseShorthand( - important, range_, *context_, - CSSParserLocalContext(isPropertyAlias(unresolved_property), - property_id), - *parsed_properties_)) + important, range_, *context_, local_context, *parsed_properties_)) return true; } else { if (const CSSValue* parsed_value = ParseLonghand( diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_property_parser_helpers.cc b/chromium/third_party/blink/renderer/core/css/parser/css_property_parser_helpers.cc index 497d1a5fade..7e7a1d43cac 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_property_parser_helpers.cc +++ b/chromium/third_party/blink/renderer/core/css/parser/css_property_parser_helpers.cc @@ -33,7 +33,7 @@ namespace blink { using namespace cssvalue; -namespace CSSPropertyParserHelpers { +namespace css_property_parser_helpers { namespace { @@ -85,13 +85,14 @@ CSSFunctionValue* ConsumeFilterFunction(CSSParserTokenRange& range, CSSValueID filter_type = range.Peek().FunctionId(); if (filter_type < CSSValueInvert || filter_type > CSSValueDropShadow) return nullptr; - CSSParserTokenRange args = CSSPropertyParserHelpers::ConsumeFunction(range); + CSSParserTokenRange args = + css_property_parser_helpers::ConsumeFunction(range); CSSFunctionValue* filter_value = CSSFunctionValue::Create(filter_type); CSSValue* parsed_value = nullptr; if (filter_type == CSSValueDropShadow) { - parsed_value = CSSParsingUtils::ParseSingleShadow( - args, context.Mode(), CSSParsingUtils::AllowInsetAndSpread::kForbid); + parsed_value = css_parsing_utils::ParseSingleShadow( + args, context.Mode(), css_parsing_utils::AllowInsetAndSpread::kForbid); } else { if (args.AtEnd()) { context.Count(WebFeature::kCSSFilterFunctionNoArguments); @@ -100,23 +101,23 @@ CSSFunctionValue* ConsumeFilterFunction(CSSParserTokenRange& range, if (filter_type == CSSValueBrightness) { // FIXME (crbug.com/397061): Support calc expressions like calc(10% + 0.5) parsed_value = - CSSPropertyParserHelpers::ConsumePercent(args, kValueRangeAll); + css_property_parser_helpers::ConsumePercent(args, kValueRangeAll); if (!parsed_value) { - parsed_value = CSSPropertyParserHelpers::ConsumeNumber( + parsed_value = css_property_parser_helpers::ConsumeNumber( args, kValueRangeNonNegative); } } else if (filter_type == CSSValueHueRotate) { - parsed_value = CSSPropertyParserHelpers::ConsumeAngle( + parsed_value = css_property_parser_helpers::ConsumeAngle( args, &context, WebFeature::kUnitlessZeroAngleFilter); } else if (filter_type == CSSValueBlur) { - parsed_value = CSSPropertyParserHelpers::ConsumeLength( + parsed_value = css_property_parser_helpers::ConsumeLength( args, kHTMLStandardMode, kValueRangeNonNegative); } else { // FIXME (crbug.com/397061): Support calc expressions like calc(10% + 0.5) - parsed_value = CSSPropertyParserHelpers::ConsumePercent( + parsed_value = css_property_parser_helpers::ConsumePercent( args, kValueRangeNonNegative); if (!parsed_value) { - parsed_value = CSSPropertyParserHelpers::ConsumeNumber( + parsed_value = css_property_parser_helpers::ConsumeNumber( args, kValueRangeNonNegative); } if (parsed_value && filter_type != CSSValueSaturate && @@ -245,6 +246,30 @@ CSSPrimitiveValue* ConsumeInteger(CSSParserTokenRange& range, return nullptr; } +// This implements the behavior defined in [1], where calc() expressions +// are valid when <integer> is expected, even if the calc()-expression does +// not result in an integral value. +// +// TODO(andruud): Eventually this behavior should just be part of +// ConsumeInteger, and this function can be removed. For now, having a separate +// function with this behavior allows us to implement [1] gradually. +// +// [1] https://drafts.csswg.org/css-values-4/#calc-type-checking +CSSPrimitiveValue* ConsumeIntegerOrNumberCalc(CSSParserTokenRange& range) { + CSSParserTokenRange int_range(range); + if (CSSPrimitiveValue* value = ConsumeInteger(int_range)) { + range = int_range; + return value; + } + CalcParser calc_parser(range); + if (const CSSCalcValue* calculation = calc_parser.Value()) { + if (calculation->Category() != kCalcNumber) + return nullptr; + return calc_parser.ConsumeValue(); + } + return nullptr; +} + CSSPrimitiveValue* ConsumePositiveInteger(CSSParserTokenRange& range) { return ConsumeInteger(range, 1); } @@ -395,6 +420,28 @@ CSSPrimitiveValue* ConsumeLengthOrPercent(CSSParserTokenRange& range, return nullptr; } +namespace { + +bool IsNonZeroUserUnitsValue(const CSSPrimitiveValue* value) { + return value && + value->TypeWithCalcResolved() == + CSSPrimitiveValue::UnitType::kUserUnits && + value->GetDoubleValue() != 0; +} + +} // namespace + +CSSPrimitiveValue* ConsumeSVGGeometryPropertyLength( + CSSParserTokenRange& range, + const CSSParserContext& context, + ValueRange value_range) { + CSSPrimitiveValue* value = ConsumeLengthOrPercent( + range, kSVGAttributeMode, value_range, UnitlessQuirk::kForbid); + if (IsNonZeroUserUnitsValue(value)) + context.Count(WebFeature::kSVGGeometryPropertyHasNonZeroUnitlessValue); + return value; +} + CSSPrimitiveValue* ConsumeGradientLengthOrPercent( CSSParserTokenRange& range, const CSSParserContext& context, @@ -489,17 +536,26 @@ CSSIdentifierValue* ConsumeIdentRange(CSSParserTokenRange& range, return ConsumeIdent(range); } -CSSCustomIdentValue* ConsumeCustomIdentWithToken(const CSSParserToken& token) { +CSSCustomIdentValue* ConsumeCustomIdentWithToken( + const CSSParserToken& token, + const CSSParserContext& context) { if (token.GetType() != kIdentToken || IsCSSWideKeyword(token.Value())) return nullptr; + + if (EqualIgnoringASCIICase(token.Value(), "default")) + context.Count(WebFeature::kDefaultInCustomIdent); + return CSSCustomIdentValue::Create(token.Value().ToAtomicString()); } -CSSCustomIdentValue* ConsumeCustomIdent(CSSParserTokenRange& range) { +CSSCustomIdentValue* ConsumeCustomIdent(CSSParserTokenRange& range, + const CSSParserContext& context) { if (range.Peek().GetType() != kIdentToken || IsCSSWideKeyword(range.Peek().Value())) return nullptr; - return ConsumeCustomIdentWithToken(range.ConsumeIncludingWhitespace()); + + return ConsumeCustomIdentWithToken(range.ConsumeIncludingWhitespace(), + context); } CSSStringValue* ConsumeString(CSSParserTokenRange& range) { @@ -962,21 +1018,21 @@ bool ConsumeBorderShorthand(CSSParserTokenRange& range, const CSSValue*& result_color) { while (!result_width || !result_style || !result_color) { if (!result_width) { - result_width = CSSPropertyParserHelpers::ConsumeLineWidth( + result_width = css_property_parser_helpers::ConsumeLineWidth( range, context.Mode(), - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); if (result_width) continue; } if (!result_style) { - result_style = CSSPropertyParserHelpers::ParseLonghand( + result_style = css_property_parser_helpers::ParseLonghand( CSSPropertyBorderLeftStyle, CSSPropertyBorder, context, range); if (result_style) continue; } if (!result_color) { result_color = - CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); + css_property_parser_helpers::ConsumeColor(range, context.Mode()); if (result_color) continue; } @@ -1428,7 +1484,7 @@ static CSSValue* ConsumeCrossFade(CSSParserTokenRange& args, static CSSValue* ConsumePaint(CSSParserTokenRange& args, const CSSParserContext* context) { const CSSParserToken& name_token = args.ConsumeIncludingWhitespace(); - CSSCustomIdentValue* name = ConsumeCustomIdentWithToken(name_token); + CSSCustomIdentValue* name = ConsumeCustomIdentWithToken(name_token, *context); if (!name) return nullptr; @@ -1638,14 +1694,14 @@ void AddProperty(CSSPropertyID resolved_property, CSSValue* ConsumeTransformValue(CSSParserTokenRange& range, const CSSParserContext& context) { bool use_legacy_parsing = false; - return CSSParsingUtils::ConsumeTransformValue(range, context, - use_legacy_parsing); + return css_parsing_utils::ConsumeTransformValue(range, context, + use_legacy_parsing); } CSSValue* ConsumeTransformList(CSSParserTokenRange& range, const CSSParserContext& context) { - return CSSParsingUtils::ConsumeTransformList(range, context, - CSSParserLocalContext()); + return css_parsing_utils::ConsumeTransformList(range, context, + CSSParserLocalContext()); } CSSValue* ConsumeFilterFunctionList(CSSParserTokenRange& range, @@ -1746,12 +1802,13 @@ const CSSValue* ParseLonghand(CSSPropertyID unresolved_property, return nullptr; } - const CSSValue* result = - ToLonghand(CSSProperty::Get(property_id)) - .ParseSingleValue( - range, context, - CSSParserLocalContext(isPropertyAlias(unresolved_property), - current_shorthand)); + const auto local_context = + CSSParserLocalContext() + .WithAliasParsing(isPropertyAlias(unresolved_property)) + .WithCurrentShorthand(current_shorthand); + + const CSSValue* result = ToLonghand(CSSProperty::Get(property_id)) + .ParseSingleValue(range, context, local_context); return result; } @@ -1885,6 +1942,6 @@ void AddExpandedPropertyForValue( } } -} // namespace CSSPropertyParserHelpers +} // namespace css_property_parser_helpers } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h b/chromium/third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h index c8cc6856851..dc58c66aafc 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h +++ b/chromium/third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h @@ -14,8 +14,8 @@ #include "third_party/blink/renderer/core/css/parser/css_parser_mode.h" #include "third_party/blink/renderer/core/css/parser/css_parser_token_range.h" #include "third_party/blink/renderer/core/frame/web_feature_forward.h" +#include "third_party/blink/renderer/platform/geometry/length.h" // For ValueRange #include "third_party/blink/renderer/platform/heap/handle.h" -#include "third_party/blink/renderer/platform/length.h" // For ValueRange namespace blink { @@ -30,7 +30,7 @@ class StylePropertyShorthand; // tokens from the range and also consume any whitespace which follows. When // the start of the range doesn't match the type we're looking for, the range // will not be modified. -namespace CSSPropertyParserHelpers { +namespace css_property_parser_helpers { void Complete4Sides(CSSValue* side[4]); @@ -45,6 +45,7 @@ enum class UnitlessQuirk { kAllow, kForbid }; CSSPrimitiveValue* ConsumeInteger( CSSParserTokenRange&, double minimum_value = -std::numeric_limits<double>::max()); +CSSPrimitiveValue* ConsumeIntegerOrNumberCalc(CSSParserTokenRange&); CSSPrimitiveValue* ConsumePositiveInteger(CSSParserTokenRange&); bool ConsumeNumberRaw(CSSParserTokenRange&, double& result); CSSPrimitiveValue* ConsumeNumber(CSSParserTokenRange&, ValueRange); @@ -58,6 +59,9 @@ CSSPrimitiveValue* ConsumeLengthOrPercent( CSSParserMode, ValueRange, UnitlessQuirk = UnitlessQuirk::kForbid); +CSSPrimitiveValue* ConsumeSVGGeometryPropertyLength(CSSParserTokenRange&, + const CSSParserContext&, + ValueRange); CSSPrimitiveValue* ConsumeAngle( CSSParserTokenRange&, @@ -75,7 +79,8 @@ inline bool IdentMatches(CSSValueID id); template <CSSValueID... allowedIdents> CSSIdentifierValue* ConsumeIdent(CSSParserTokenRange&); -CSSCustomIdentValue* ConsumeCustomIdent(CSSParserTokenRange&); +CSSCustomIdentValue* ConsumeCustomIdent(CSSParserTokenRange&, + const CSSParserContext&); CSSStringValue* ConsumeString(CSSParserTokenRange&); StringView ConsumeUrlAsStringView(CSSParserTokenRange&); CSSURIValue* ConsumeUrl(CSSParserTokenRange&, const CSSParserContext*); @@ -205,7 +210,7 @@ CSSValue* ConsumeTransformList(CSSParserTokenRange&, const CSSParserContext&); CSSValue* ConsumeFilterFunctionList(CSSParserTokenRange&, const CSSParserContext&); -} // namespace CSSPropertyParserHelpers +} // namespace css_property_parser_helpers } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_property_parser_test.cc b/chromium/third_party/blink/renderer/core/css/parser/css_property_parser_test.cc index 89b0b1bdea6..34d072e00f6 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_property_parser_test.cc +++ b/chromium/third_party/blink/renderer/core/css/parser/css_property_parser_test.cc @@ -457,4 +457,111 @@ TEST(CSSPropertyParserTest, DropFontfaceDescriptor) { IsValidPropertyValueForStyleRule(CSSPropertySrc, "var(--dummy)")); } +class CSSPropertyUseCounterTest : public ::testing::Test { + public: + void SetUp() override { + dummy_page_holder_ = DummyPageHolder::Create(IntSize(800, 600)); + Page::InsertOrdinaryPageForTesting(&dummy_page_holder_->GetPage()); + // Use strict mode. + GetDocument().SetCompatibilityMode(Document::kNoQuirksMode); + } + void TearDown() override { dummy_page_holder_ = nullptr; } + + void ParseProperty(CSSPropertyID property, const char* value_string) { + const CSSValue* value = + CSSParser::ParseSingleValue(property, String(value_string), + CSSParserContext::Create(GetDocument())); + DCHECK(value); + } + + bool IsCounted(WebFeature feature) { + return UseCounter::IsCounted(GetDocument(), feature); + } + + private: + Document& GetDocument() { return dummy_page_holder_->GetDocument(); } + + std::unique_ptr<DummyPageHolder> dummy_page_holder_; +}; + +TEST_F(CSSPropertyUseCounterTest, CSSPropertyXUnitlessUseCount) { + WebFeature feature = WebFeature::kSVGGeometryPropertyHasNonZeroUnitlessValue; + EXPECT_FALSE(IsCounted(feature)); + ParseProperty(CSSPropertyX, "0"); + // Unitless zero should not register. + EXPECT_FALSE(IsCounted(feature)); + ParseProperty(CSSPropertyX, "42"); + EXPECT_TRUE(IsCounted(feature)); +} + +TEST_F(CSSPropertyUseCounterTest, CSSPropertyYUnitlessUseCount) { + WebFeature feature = WebFeature::kSVGGeometryPropertyHasNonZeroUnitlessValue; + EXPECT_FALSE(IsCounted(feature)); + ParseProperty(CSSPropertyY, "0"); + // Unitless zero should not register. + EXPECT_FALSE(IsCounted(feature)); + ParseProperty(CSSPropertyY, "42"); + EXPECT_TRUE(IsCounted(feature)); +} + +TEST_F(CSSPropertyUseCounterTest, CSSPropertyRUnitlessUseCount) { + WebFeature feature = WebFeature::kSVGGeometryPropertyHasNonZeroUnitlessValue; + EXPECT_FALSE(IsCounted(feature)); + ParseProperty(CSSPropertyR, "0"); + // Unitless zero should not register. + EXPECT_FALSE(IsCounted(feature)); + ParseProperty(CSSPropertyR, "42"); + EXPECT_TRUE(IsCounted(feature)); +} + +TEST_F(CSSPropertyUseCounterTest, CSSPropertyRxUnitlessUseCount) { + WebFeature feature = WebFeature::kSVGGeometryPropertyHasNonZeroUnitlessValue; + EXPECT_FALSE(IsCounted(feature)); + ParseProperty(CSSPropertyRx, "0"); + // Unitless zero should not register. + EXPECT_FALSE(IsCounted(feature)); + ParseProperty(CSSPropertyRx, "42"); + EXPECT_TRUE(IsCounted(feature)); +} + +TEST_F(CSSPropertyUseCounterTest, CSSPropertyRyUnitlessUseCount) { + WebFeature feature = WebFeature::kSVGGeometryPropertyHasNonZeroUnitlessValue; + EXPECT_FALSE(IsCounted(feature)); + ParseProperty(CSSPropertyRy, "0"); + // Unitless zero should not register. + EXPECT_FALSE(IsCounted(feature)); + ParseProperty(CSSPropertyRy, "42"); + EXPECT_TRUE(IsCounted(feature)); +} + +TEST_F(CSSPropertyUseCounterTest, CSSPropertyCxUnitlessUseCount) { + WebFeature feature = WebFeature::kSVGGeometryPropertyHasNonZeroUnitlessValue; + EXPECT_FALSE(IsCounted(feature)); + ParseProperty(CSSPropertyCx, "0"); + // Unitless zero should not register. + EXPECT_FALSE(IsCounted(feature)); + ParseProperty(CSSPropertyCx, "42"); + EXPECT_TRUE(IsCounted(feature)); +} + +TEST_F(CSSPropertyUseCounterTest, CSSPropertyCyUnitlessUseCount) { + WebFeature feature = WebFeature::kSVGGeometryPropertyHasNonZeroUnitlessValue; + EXPECT_FALSE(IsCounted(feature)); + ParseProperty(CSSPropertyCy, "0"); + // Unitless zero should not register. + EXPECT_FALSE(IsCounted(feature)); + ParseProperty(CSSPropertyCy, "42"); + EXPECT_TRUE(IsCounted(feature)); +} + +TEST_F(CSSPropertyUseCounterTest, CSSPropertyAnimationNameCustomIdentUseCount) { + WebFeature feature = WebFeature::kDefaultInCustomIdent; + EXPECT_FALSE(IsCounted(feature)); + ParseProperty(CSSPropertyAnimationName, "initial"); + // css-wide keywords in custom ident other than default should not register. + EXPECT_FALSE(IsCounted(feature)); + ParseProperty(CSSPropertyAnimationName, "default"); + EXPECT_TRUE(IsCounted(feature)); +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_selector_parser.cc b/chromium/third_party/blink/renderer/core/css/parser/css_selector_parser.cc index 5431ec0ad88..2918f7a99ee 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_selector_parser.cc +++ b/chromium/third_party/blink/renderer/core/css/parser/css_selector_parser.cc @@ -6,6 +6,7 @@ #include "third_party/blink/renderer/core/css/parser/css_selector_parser.h" #include <memory> +#include "base/numerics/safe_conversions.h" #include "third_party/blink/renderer/core/css/css_selector_list.h" #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "third_party/blink/renderer/core/css/parser/css_parser_observer.h" @@ -266,12 +267,8 @@ bool IsSimpleSelectorValidAfterPseudoElement( return true; if (compound_pseudo_element == CSSSelector::kPseudoContent) return simple_selector.Match() != CSSSelector::kPseudoElement; - if (compound_pseudo_element == CSSSelector::kPseudoSlotted) { - return simple_selector.Match() == CSSSelector::kPseudoElement && - (simple_selector.GetPseudoType() == CSSSelector::kPseudoBefore || - simple_selector.GetPseudoType() == CSSSelector::kPseudoAfter); - } - + if (compound_pseudo_element == CSSSelector::kPseudoSlotted) + return simple_selector.IsTreeAbidingPseudoElement(); if (simple_selector.Match() != CSSSelector::kPseudoClass) return false; CSSSelector::PseudoType pseudo = simple_selector.GetPseudoType(); @@ -328,6 +325,7 @@ std::unique_ptr<CSSParserSelector> CSSSelectorParser::ConsumeCompoundSelector( if (!compound_selector) { AtomicString namespace_uri = DetermineNamespace(namespace_prefix); if (namespace_uri.IsNull()) { + context_->Count(WebFeature::kCSSUnknownNamespacePrefixInSelector); failed_parsing_ = true; return nullptr; } @@ -489,6 +487,44 @@ std::unique_ptr<CSSParserSelector> CSSSelectorParser::ConsumeAttribute( return selector; } +void CSSSelectorParser::CountRejectedNot(CSSParserTokenRange& range) { + bool exists_valid = false; + bool exists_invalid = false; + + do { + if (exists_valid || exists_invalid) { + DCHECK(range.Peek().GetType() == kCommaToken); + range.ConsumeIncludingWhitespace(); + } + // else we are parsing the first complex selector + + failed_parsing_ = false; + bool consumed_invalid = !ConsumeComplexSelector(range) || failed_parsing_; + range.ConsumeWhitespace(); + while (!range.AtEnd() && range.Peek().GetType() != kCommaToken) { + consumed_invalid = true; + range.ConsumeIncludingWhitespace(); + } + + if (consumed_invalid) + exists_invalid = true; + else + exists_valid = true; + } while (!range.AtEnd()); + + WebFeature feature; + if (exists_valid) { + if (exists_invalid) + feature = WebFeature::kCSSSelectorNotWithPartiallyValidList; + else + feature = WebFeature::kCSSSelectorNotWithValidList; + } else { + feature = WebFeature::kCSSSelectorNotWithInvalidList; + } + context_->Count(feature); + failed_parsing_ = true; +} + std::unique_ptr<CSSParserSelector> CSSSelectorParser::ConsumePseudo( CSSParserTokenRange& range) { DCHECK_EQ(range.Peek().GetType(), kColonToken); @@ -535,8 +571,8 @@ std::unique_ptr<CSSParserSelector> CSSSelectorParser::ConsumePseudo( return nullptr; switch (selector->GetPseudoType()) { - case CSSSelector::kPseudoMatches: { - if (!RuntimeEnabledFeatures::CSSMatchesEnabled()) + case CSSSelector::kPseudoIs: { + if (!RuntimeEnabledFeatures::CSSPseudoIsEnabled()) break; DisallowPseudoElementsScope scope(this); @@ -549,8 +585,8 @@ std::unique_ptr<CSSParserSelector> CSSSelectorParser::ConsumePseudo( selector->SetSelectorList(std::move(selector_list)); return selector; } - case CSSSelector::kPseudoIS: { - if (!RuntimeEnabledFeatures::CSSPseudoISEnabled()) + case CSSSelector::kPseudoWhere: { + if (!RuntimeEnabledFeatures::CSSPseudoWhereEnabled()) break; DisallowPseudoElementsScope scope(this); @@ -573,17 +609,23 @@ std::unique_ptr<CSSParserSelector> CSSSelectorParser::ConsumePseudo( std::make_unique<CSSSelectorList>(); *selector_list = ConsumeCompoundSelectorList(block); if (!selector_list->IsValid() || !block.AtEnd() || - selector_list->HasPseudoMatches() || selector_list->HasPseudoIS()) + selector_list->HasPseudoIs() || selector_list->HasPseudoWhere()) return nullptr; selector->SetSelectorList(std::move(selector_list)); return selector; } case CSSSelector::kPseudoNot: { + CSSParserTokenRange fallback_block = block; + std::unique_ptr<CSSParserSelector> inner_selector = ConsumeCompoundSelector(block); block.ConsumeWhitespace(); - if (!inner_selector || !inner_selector->IsSimple() || !block.AtEnd()) + if (!inner_selector || !inner_selector->IsSimple() || + inner_selector->Relation() != CSSSelector::kSubSelector || + !block.AtEnd()) { + CountRejectedNot(fallback_block); return nullptr; + } Vector<std::unique_ptr<CSSParserSelector>> selector_vector; selector_vector.push_back(std::move(inner_selector)); selector->AdoptSelectorVector(selector_vector); @@ -605,8 +647,8 @@ std::unique_ptr<CSSParserSelector> CSSSelectorParser::ConsumePseudo( ConsumeCompoundSelector(block); block.ConsumeWhitespace(); if (!inner_selector || !block.AtEnd() || - inner_selector->GetPseudoType() == CSSSelector::kPseudoMatches || - inner_selector->GetPseudoType() == CSSSelector::kPseudoIS) + inner_selector->GetPseudoType() == CSSSelector::kPseudoIs || + inner_selector->GetPseudoType() == CSSSelector::kPseudoWhere) return nullptr; Vector<std::unique_ptr<CSSParserSelector>> selector_vector; selector_vector.push_back(std::move(inner_selector)); @@ -917,14 +959,149 @@ CSSSelectorParser::SplitCompoundAtImplicitShadowCrossingCombinator( if (!split_after || !split_after->TagHistory()) return compound_selector; - std::unique_ptr<CSSParserSelector> second_compound = + std::unique_ptr<CSSParserSelector> remaining = split_after->ReleaseTagHistory(); - second_compound->AppendTagHistory( - second_compound->GetImplicitShadowCombinatorForMatching(), - std::move(compound_selector)); - return second_compound; + CSSSelector::RelationType relation = + remaining->GetImplicitShadowCombinatorForMatching(); + // We might need to split the compound twice since ::placeholder is allowed + // after ::slotted and they both need an implicit combinator for matching. + remaining = + SplitCompoundAtImplicitShadowCrossingCombinator(std::move(remaining)); + remaining->AppendTagHistory(relation, std::move(compound_selector)); + return remaining; +} + +namespace { + +struct PseudoElementFeatureMapEntry { + template <unsigned key_length> + PseudoElementFeatureMapEntry(const char (&key)[key_length], + WebFeature feature) + : key(key), + key_length(base::checked_cast<uint16_t>(key_length - 1)), + feature(base::checked_cast<uint16_t>(feature)) {} + const char* const key; + const uint16_t key_length; + const uint16_t feature; +}; + +WebFeature FeatureForWebKitCustomPseudoElement(const AtomicString& name) { + static const PseudoElementFeatureMapEntry feature_table[] = { + {"cue", WebFeature::kCSSSelectorCue}, + {"-internal-media-controls-overlay-cast-button", + WebFeature::kCSSSelectorInternalMediaControlsOverlayCastButton}, + {"-webkit-calendar-picker-indicator", + WebFeature::kCSSSelectorWebkitCalendarPickerIndicator}, + {"-webkit-clear-button", WebFeature::kCSSSelectorWebkitClearButton}, + {"-webkit-color-swatch", WebFeature::kCSSSelectorWebkitColorSwatch}, + {"-webkit-color-swatch-wrapper", + WebFeature::kCSSSelectorWebkitColorSwatchWrapper}, + {"-webkit-date-and-time-value", + WebFeature::kCSSSelectorWebkitDateAndTimeValue}, + {"-webkit-datetime-edit", WebFeature::kCSSSelectorWebkitDatetimeEdit}, + {"-webkit-datetime-edit-ampm-field", + WebFeature::kCSSSelectorWebkitDatetimeEditAmpmField}, + {"-webkit-datetime-edit-day-field", + WebFeature::kCSSSelectorWebkitDatetimeEditDayField}, + {"-webkit-datetime-edit-fields-wrapper", + WebFeature::kCSSSelectorWebkitDatetimeEditFieldsWrapper}, + {"-webkit-datetime-edit-hour-field", + WebFeature::kCSSSelectorWebkitDatetimeEditHourField}, + {"-webkit-datetime-edit-millisecond-field", + WebFeature::kCSSSelectorWebkitDatetimeEditMillisecondField}, + {"-webkit-datetime-edit-minute-field", + WebFeature::kCSSSelectorWebkitDatetimeEditMinuteField}, + {"-webkit-datetime-edit-month-field", + WebFeature::kCSSSelectorWebkitDatetimeEditMonthField}, + {"-webkit-datetime-edit-second-field", + WebFeature::kCSSSelectorWebkitDatetimeEditSecondField}, + {"-webkit-datetime-edit-text", + WebFeature::kCSSSelectorWebkitDatetimeEditText}, + {"-webkit-datetime-edit-week-field", + WebFeature::kCSSSelectorWebkitDatetimeEditWeekField}, + {"-webkit-datetime-edit-year-field", + WebFeature::kCSSSelectorWebkitDatetimeEditYearField}, + {"-webkit-details-marker", WebFeature::kCSSSelectorWebkitDetailsMarker}, + {"-webkit-file-upload-button", + WebFeature::kCSSSelectorWebkitFileUploadButton}, + {"-webkit-inner-spin-button", + WebFeature::kCSSSelectorWebkitInnerSpinButton}, + {"-webkit-input-placeholder", + WebFeature::kCSSSelectorWebkitInputPlaceholder}, + {"-webkit-media-controls", WebFeature::kCSSSelectorWebkitMediaControls}, + {"-webkit-media-controls-current-time-display", + WebFeature::kCSSSelectorWebkitMediaControlsCurrentTimeDisplay}, + {"-webkit-media-controls-enclosure", + WebFeature::kCSSSelectorWebkitMediaControlsEnclosure}, + {"-webkit-media-controls-fullscreen-button", + WebFeature::kCSSSelectorWebkitMediaControlsFullscreenButton}, + {"-webkit-media-controls-mute-button", + WebFeature::kCSSSelectorWebkitMediaControlsMuteButton}, + {"-webkit-media-controls-overlay-enclosure", + WebFeature::kCSSSelectorWebkitMediaControlsOverlayEnclosure}, + {"-webkit-media-controls-overlay-play-button", + WebFeature::kCSSSelectorWebkitMediaControlsOverlayPlayButton}, + {"-webkit-media-controls-panel", + WebFeature::kCSSSelectorWebkitMediaControlsPanel}, + {"-webkit-media-controls-play-button", + WebFeature::kCSSSelectorWebkitMediaControlsPlayButton}, + {"-webkit-media-controls-timeline", + WebFeature::kCSSSelectorWebkitMediaControlsTimeline}, + // Note: This feature is no longer implemented in Blink. + {"-webkit-media-controls-timeline-container", + WebFeature::kCSSSelectorWebkitMediaControlsTimelineContainer}, + {"-webkit-media-controls-time-remaining-display", + WebFeature::kCSSSelectorWebkitMediaControlsTimeRemainingDisplay}, + {"-webkit-media-controls-toggle-closed-captions-button", + WebFeature::kCSSSelectorWebkitMediaControlsToggleClosedCaptionsButton}, + {"-webkit-media-controls-volume-slider", + WebFeature::kCSSSelectorWebkitMediaControlsVolumeSlider}, + {"-webkit-media-slider-container", + WebFeature::kCSSSelectorWebkitMediaSliderContainer}, + {"-webkit-media-slider-thumb", + WebFeature::kCSSSelectorWebkitMediaSliderThumb}, + {"-webkit-media-text-track-container", + WebFeature::kCSSSelectorWebkitMediaTextTrackContainer}, + {"-webkit-media-text-track-display", + WebFeature::kCSSSelectorWebkitMediaTextTrackDisplay}, + {"-webkit-media-text-track-region", + WebFeature::kCSSSelectorWebkitMediaTextTrackRegion}, + {"-webkit-media-text-track-region-container", + WebFeature::kCSSSelectorWebkitMediaTextTrackRegionContainer}, + {"-webkit-meter-bar", WebFeature::kCSSSelectorWebkitMeterBar}, + {"-webkit-meter-even-less-good-value", + WebFeature::kCSSSelectorWebkitMeterEvenLessGoodValue}, + {"-webkit-meter-inner-element", + WebFeature::kCSSSelectorWebkitMeterInnerElement}, + {"-webkit-meter-optimum-value", + WebFeature::kCSSSelectorWebkitMeterOptimumValue}, + {"-webkit-meter-suboptimum-value", + WebFeature::kCSSSelectorWebkitMeterSuboptimumValue}, + {"-webkit-progress-bar", WebFeature::kCSSSelectorWebkitProgressBar}, + {"-webkit-progress-inner-element", + WebFeature::kCSSSelectorWebkitProgressInnerElement}, + {"-webkit-progress-value", WebFeature::kCSSSelectorWebkitProgressValue}, + {"-webkit-search-cancel-button", + WebFeature::kCSSSelectorWebkitSearchCancelButton}, + {"-webkit-slider-container", + WebFeature::kCSSSelectorWebkitSliderContainer}, + {"-webkit-slider-runnable-track", + WebFeature::kCSSSelectorWebkitSliderRunnableTrack}, + {"-webkit-slider-thumb", WebFeature::kCSSSelectorWebkitSliderThumb}, + {"-webkit-textfield-decoration-container", + WebFeature::kCSSSelectorWebkitTextfieldDecorationContainer}, + }; + // TODO(fs): Could use binary search once there's a less finicky way to + // compare (order) String and StringView/non-String. + for (const auto& entry : feature_table) { + if (name == StringView(entry.key, entry.key_length)) + return static_cast<WebFeature>(entry.feature); + } + return WebFeature::kCSSSelectorWebkitUnknownPseudo; } +} // namespace + void CSSSelectorParser::RecordUsageAndDeprecations( const CSSSelectorList& selector_list) { if (!context_->IsUseCounterRecordingEnabled()) @@ -939,9 +1116,9 @@ void CSSSelectorParser::RecordUsageAndDeprecations( case CSSSelector::kPseudoAny: feature = WebFeature::kCSSSelectorPseudoAny; break; - case CSSSelector::kPseudoMatches: - DCHECK(RuntimeEnabledFeatures::CSSMatchesEnabled()); - feature = WebFeature::kCSSSelectorPseudoMatches; + case CSSSelector::kPseudoIs: + DCHECK(RuntimeEnabledFeatures::CSSPseudoIsEnabled()); + feature = WebFeature::kCSSSelectorPseudoIs; break; case CSSSelector::kPseudoFocusVisible: DCHECK(RuntimeEnabledFeatures::CSSFocusVisibleEnabled()); @@ -958,9 +1135,9 @@ void CSSSelectorParser::RecordUsageAndDeprecations( case CSSSelector::kPseudoWebkitAnyLink: feature = WebFeature::kCSSSelectorPseudoWebkitAnyLink; break; - case CSSSelector::kPseudoIS: - DCHECK(RuntimeEnabledFeatures::CSSPseudoISEnabled()); - feature = WebFeature::kCSSSelectorPseudoIS; + case CSSSelector::kPseudoWhere: + DCHECK(RuntimeEnabledFeatures::CSSPseudoWhereEnabled()); + feature = WebFeature::kCSSSelectorPseudoWhere; break; case CSSSelector::kPseudoUnresolved: feature = WebFeature::kCSSSelectorPseudoUnresolved; @@ -991,156 +1168,8 @@ void CSSSelectorParser::RecordUsageAndDeprecations( feature = WebFeature::kCSSSelectorInternalPseudoListBox; break; case CSSSelector::kPseudoWebKitCustomElement: - if (context_->Mode() != kUASheetMode) { - if (current->Value() == "cue") { - feature = WebFeature::kCSSSelectorCue; - } else if (current->Value() == - "-internal-media-controls-overlay-cast-button") { - feature = WebFeature:: - kCSSSelectorInternalMediaControlsOverlayCastButton; - } else if (current->Value() == - "-webkit-calendar-picker-indicator") { - feature = WebFeature::kCSSSelectorWebkitCalendarPickerIndicator; - } else if (current->Value() == "-webkit-clear-button") { - feature = WebFeature::kCSSSelectorWebkitClearButton; - } else if (current->Value() == "-webkit-color-swatch") { - feature = WebFeature::kCSSSelectorWebkitColorSwatch; - } else if (current->Value() == "-webkit-color-swatch-wrapper") { - feature = WebFeature::kCSSSelectorWebkitColorSwatchWrapper; - } else if (current->Value() == "-webkit-date-and-time-value") { - feature = WebFeature::kCSSSelectorWebkitDateAndTimeValue; - } else if (current->Value() == "-webkit-datetime-edit") { - feature = WebFeature::kCSSSelectorWebkitDatetimeEdit; - } else if (current->Value() == "-webkit-datetime-edit-ampm-field") { - feature = WebFeature::kCSSSelectorWebkitDatetimeEditAmpmField; - } else if (current->Value() == "-webkit-datetime-edit-day-field") { - feature = WebFeature::kCSSSelectorWebkitDatetimeEditDayField; - } else if (current->Value() == - "-webkit-datetime-edit-fields-wrapper") { - feature = WebFeature::kCSSSelectorWebkitDatetimeEditFieldsWrapper; - } else if (current->Value() == "-webkit-datetime-edit-hour-field") { - feature = WebFeature::kCSSSelectorWebkitDatetimeEditHourField; - } else if (current->Value() == - "-webkit-datetime-edit-millisecond-field") { - feature = - WebFeature::kCSSSelectorWebkitDatetimeEditMillisecondField; - } else if (current->Value() == - "-webkit-datetime-edit-minute-field") { - feature = WebFeature::kCSSSelectorWebkitDatetimeEditMinuteField; - } else if (current->Value() == - "-webkit-datetime-edit-month-field") { - feature = WebFeature::kCSSSelectorWebkitDatetimeEditMonthField; - } else if (current->Value() == - "-webkit-datetime-edit-second-field") { - feature = WebFeature::kCSSSelectorWebkitDatetimeEditSecondField; - } else if (current->Value() == "-webkit-datetime-edit-text") { - feature = WebFeature::kCSSSelectorWebkitDatetimeEditText; - } else if (current->Value() == "-webkit-datetime-edit-week-field") { - feature = WebFeature::kCSSSelectorWebkitDatetimeEditWeekField; - } else if (current->Value() == "-webkit-datetime-edit-year-field") { - feature = WebFeature::kCSSSelectorWebkitDatetimeEditYearField; - } else if (current->Value() == "-webkit-details-marker") { - feature = WebFeature::kCSSSelectorWebkitDetailsMarker; - } else if (current->Value() == "-webkit-file-upload-button") { - feature = WebFeature::kCSSSelectorWebkitFileUploadButton; - } else if (current->Value() == "-webkit-inner-spin-button") { - feature = WebFeature::kCSSSelectorWebkitInnerSpinButton; - } else if (current->Value() == "-webkit-input-placeholder") { - feature = WebFeature::kCSSSelectorWebkitInputPlaceholder; - } else if (current->Value() == "-webkit-media-controls") { - feature = WebFeature::kCSSSelectorWebkitMediaControls; - } else if (current->Value() == - "-webkit-media-controls-current-time-display") { - feature = - WebFeature::kCSSSelectorWebkitMediaControlsCurrentTimeDisplay; - } else if (current->Value() == "-webkit-media-controls-enclosure") { - feature = WebFeature::kCSSSelectorWebkitMediaControlsEnclosure; - } else if (current->Value() == - "-webkit-media-controls-fullscreen-button") { - feature = - WebFeature::kCSSSelectorWebkitMediaControlsFullscreenButton; - } else if (current->Value() == - "-webkit-media-controls-mute-button") { - feature = WebFeature::kCSSSelectorWebkitMediaControlsMuteButton; - } else if (current->Value() == - "-webkit-media-controls-overlay-enclosure") { - feature = - WebFeature::kCSSSelectorWebkitMediaControlsOverlayEnclosure; - } else if (current->Value() == - "-webkit-media-controls-overlay-play-button") { - feature = - WebFeature::kCSSSelectorWebkitMediaControlsOverlayPlayButton; - } else if (current->Value() == "-webkit-media-controls-panel") { - feature = WebFeature::kCSSSelectorWebkitMediaControlsPanel; - } else if (current->Value() == - "-webkit-media-controls-play-button") { - feature = WebFeature::kCSSSelectorWebkitMediaControlsPlayButton; - } else if (current->Value() == "-webkit-media-controls-timeline") { - feature = WebFeature::kCSSSelectorWebkitMediaControlsTimeline; - } else if (current->Value() == - "-webkit-media-controls-timeline-container") { - // Note: This feature is no longer implemented in Blink. - feature = - WebFeature::kCSSSelectorWebkitMediaControlsTimelineContainer; - } else if (current->Value() == - "-webkit-media-controls-time-remaining-display") { - feature = WebFeature:: - kCSSSelectorWebkitMediaControlsTimeRemainingDisplay; - } else if (current->Value() == - "-webkit-media-controls-toggle-closed-captions-button") { - feature = WebFeature:: - kCSSSelectorWebkitMediaControlsToggleClosedCaptionsButton; - } else if (current->Value() == - "-webkit-media-controls-volume-slider") { - feature = WebFeature::kCSSSelectorWebkitMediaControlsVolumeSlider; - } else if (current->Value() == "-webkit-media-slider-container") { - feature = WebFeature::kCSSSelectorWebkitMediaSliderContainer; - } else if (current->Value() == "-webkit-media-slider-thumb") { - feature = WebFeature::kCSSSelectorWebkitMediaSliderThumb; - } else if (current->Value() == - "-webkit-media-text-track-container") { - feature = WebFeature::kCSSSelectorWebkitMediaTextTrackContainer; - } else if (current->Value() == "-webkit-media-text-track-display") { - feature = WebFeature::kCSSSelectorWebkitMediaTextTrackDisplay; - } else if (current->Value() == "-webkit-media-text-track-region") { - feature = WebFeature::kCSSSelectorWebkitMediaTextTrackRegion; - } else if (current->Value() == - "-webkit-media-text-track-region-container") { - feature = - WebFeature::kCSSSelectorWebkitMediaTextTrackRegionContainer; - } else if (current->Value() == "-webkit-meter-bar") { - feature = WebFeature::kCSSSelectorWebkitMeterBar; - } else if (current->Value() == - "-webkit-meter-even-less-good-value") { - feature = WebFeature::kCSSSelectorWebkitMeterEvenLessGoodValue; - } else if (current->Value() == "-webkit-meter-inner-element") { - feature = WebFeature::kCSSSelectorWebkitMeterInnerElement; - } else if (current->Value() == "-webkit-meter-optimum-value") { - feature = WebFeature::kCSSSelectorWebkitMeterOptimumValue; - } else if (current->Value() == "-webkit-meter-suboptimum-value") { - feature = WebFeature::kCSSSelectorWebkitMeterSuboptimumValue; - } else if (current->Value() == "-webkit-progress-bar") { - feature = WebFeature::kCSSSelectorWebkitProgressBar; - } else if (current->Value() == "-webkit-progress-inner-element") { - feature = WebFeature::kCSSSelectorWebkitProgressInnerElement; - } else if (current->Value() == "-webkit-progress-value") { - feature = WebFeature::kCSSSelectorWebkitProgressValue; - } else if (current->Value() == "-webkit-search-cancel-button") { - feature = WebFeature::kCSSSelectorWebkitSearchCancelButton; - } else if (current->Value() == "-webkit-slider-container") { - feature = WebFeature::kCSSSelectorWebkitSliderContainer; - } else if (current->Value() == "-webkit-slider-runnable-track") { - feature = WebFeature::kCSSSelectorWebkitSliderRunnableTrack; - } else if (current->Value() == "-webkit-slider-thumb") { - feature = WebFeature::kCSSSelectorWebkitSliderThumb; - } else if (current->Value() == - "-webkit-textfield-decoration-container") { - feature = - WebFeature::kCSSSelectorWebkitTextfieldDecorationContainer; - } else { - feature = WebFeature::kCSSSelectorWebkitUnknownPseudo; - } - } + if (context_->Mode() != kUASheetMode) + feature = FeatureForWebKitCustomPseudoElement(current->Value()); break; case CSSSelector::kPseudoSpatialNavigationFocus: if (context_->Mode() != kUASheetMode) { diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_selector_parser.h b/chromium/third_party/blink/renderer/core/css/parser/css_selector_parser.h index b1a8442a5ab..f75374c742c 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_selector_parser.h +++ b/chromium/third_party/blink/renderer/core/css/parser/css_selector_parser.h @@ -80,6 +80,7 @@ class CORE_EXPORT CSSSelectorParser { SplitCompoundAtImplicitShadowCrossingCombinator( std::unique_ptr<CSSParserSelector> compound_selector); void RecordUsageAndDeprecations(const CSSSelectorList&); + void CountRejectedNot(CSSParserTokenRange&); Member<const CSSParserContext> context_; Member<const StyleSheetContents> style_sheet_; diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_selector_parser_test.cc b/chromium/third_party/blink/renderer/core/css/parser/css_selector_parser_test.cc index c67ee0f9a91..a795cba47fa 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_selector_parser_test.cc +++ b/chromium/third_party/blink/renderer/core/css/parser/css_selector_parser_test.cc @@ -364,24 +364,24 @@ TEST(CSSSelectorParserTest, InternalPseudo) { } } -TEST(CSSSelectorParserTest, InvalidNestingPseudoMatches) { - // :matches() is currently not supported within these pseudo classes as they - // currently do not support complex selector arguments (:matches() does - // support this and the expansion of :matches() may provide complex selector +TEST(CSSSelectorParserTest, InvalidNestingPseudoIs) { + // :is() is currently not supported within these pseudo classes as they + // currently do not support complex selector arguments (:is() does + // support this and the expansion of :is() may provide complex selector // arguments to these pseudo classes). Most of these test cases should // eventually be removed once they support complex selector arguments. - const char* test_cases[] = {":-webkit-any(:matches(.a))", - "::cue(:matches(.a))", - ":cue(:matches(.a))", - ":host(:matches(.a))", - ":host-context(:matches(.a))", - ":lang(:matches(.a))", - ":not(:matches(.a))", - ":nth-child(:matches(.a))", - ":nth-last-child(:matches(.a))", - ":nth-last-of-type(:matches(.a))", - ":nth-of-type(:matches(.a))", - "::slotted(:matches(.a))"}; + const char* test_cases[] = {":-webkit-any(:is(.a))", + "::cue(:is(.a))", + ":cue(:is(.a))", + ":host(:is(.a))", + ":host-context(:is(.a))", + ":lang(:is(.a))", + ":not(:is(.a))", + ":nth-child(:is(.a))", + ":nth-last-child(:is(.a))", + ":nth-last-of-type(:is(.a))", + ":nth-of-type(:is(.a))", + "::slotted(:is(.a))"}; CSSParserContext* context = CSSParserContext::Create( kHTMLStandardMode, SecureContextMode::kInsecureContext); @@ -398,30 +398,30 @@ TEST(CSSSelectorParserTest, InvalidNestingPseudoMatches) { } } -TEST(CSSSelectorParserTest, InvalidPseudoMatchesArguments) { - // Pseudo-elements are not valid within :matches() as per the spec: +TEST(CSSSelectorParserTest, InvalidPseudoIsArguments) { + // Pseudo-elements are not valid within :is() as per the spec: // https://drafts.csswg.org/selectors-4/#matches - const char* test_cases[] = {":matches(::-webkit-progress-bar)", - ":matches(::-webkit-progress-value)", - ":matches(::-webkit-slider-runnable-track)", - ":matches(::-webkit-slider-thumb)", - ":matches(::after)", - ":matches(::backdrop)", - ":matches(::before)", - ":matches(::cue)", - ":matches(::first-letter)", - ":matches(::first-line)", - ":matches(::grammar-error)", - ":matches(::marker)", - ":matches(::placeholder)", - ":matches(::selection)", - ":matches(::slotted)", - ":matches(::spelling-error)", - ":matches(:after)", - ":matches(:before)", - ":matches(:cue)", - ":matches(:first-letter)", - ":matches(:first-line)"}; + const char* test_cases[] = {":is(::-webkit-progress-bar)", + ":is(::-webkit-progress-value)", + ":is(::-webkit-slider-runnable-track)", + ":is(::-webkit-slider-thumb)", + ":is(::after)", + ":is(::backdrop)", + ":is(::before)", + ":is(::cue)", + ":is(::first-letter)", + ":is(::first-line)", + ":is(::grammar-error)", + ":is(::marker)", + ":is(::placeholder)", + ":is(::selection)", + ":is(::slotted)", + ":is(::spelling-error)", + ":is(:after)", + ":is(:before)", + ":is(:cue)", + ":is(:first-letter)", + ":is(:first-line)"}; CSSParserContext* context = CSSParserContext::Create( kHTMLStandardMode, SecureContextMode::kInsecureContext); @@ -438,24 +438,24 @@ TEST(CSSSelectorParserTest, InvalidPseudoMatchesArguments) { } } -TEST(CSSSelectorParserTest, InvalidNestingPseudoIS) { - // :is() is currently not supported within these pseudo classes as they - // currently do not support complex selector arguments (:is() does support - // this and the expansion of :is() may provide complex selector arguments to - // these pseudo classes). Most of these test cases should eventually be +TEST(CSSSelectorParserTest, InvalidNestingPseudoWhere) { + // :where() is currently not supported within these pseudo classes as they + // currently do not support complex selector arguments (:where() does support + // this and the expansion of :where() may provide complex selector arguments + // to these pseudo classes). Most of these test cases should eventually be // removed once they support complex selector arguments. - const char* test_cases[] = {":-webkit-any(:is(.a))", - "::cue(:is(.a))", - ":cue(:is(.a))", - ":host(:is(.a))", - ":host-context(:is(.a))", - ":lang(:is(.a))", - ":not(:is(.a))", - ":nth-child(:is(.a))", - ":nth-last-child(:is(.a))", - ":nth-last-of-type(:is(.a))", - ":nth-of-type(:is(.a))", - "::slotted(:is(.a))"}; + const char* test_cases[] = {":-webkit-any(:where(.a))", + "::cue(:where(.a))", + ":cue(:where(.a))", + ":host(:where(.a))", + ":host-context(:where(.a))", + ":lang(:where(.a))", + ":not(:where(.a))", + ":nth-child(:where(.a))", + ":nth-last-child(:where(.a))", + ":nth-last-of-type(:where(.a))", + ":nth-of-type(:where(.a))", + "::slotted(:where(.a))"}; CSSParserContext* context = CSSParserContext::Create( kHTMLStandardMode, SecureContextMode::kInsecureContext); @@ -700,4 +700,159 @@ TEST(CSSSelectorParserTest, UseCountShadowPseudo) { WebFeature::kCSSSelectorWebkitUnknownPseudo); } +TEST(CSSSelectorParserTest, ImplicitShadowCrossingCombinators) { + struct ShadowCombinatorTest { + const char* input; + std::vector<std::pair<AtomicString, CSSSelector::RelationType>> expectation; + }; + + const ShadowCombinatorTest test_cases[] = { + { + "*::placeholder", + { + {"placeholder", CSSSelector::kShadowPseudo}, + {g_null_atom, CSSSelector::kSubSelector}, + }, + }, + { + "div::slotted(*)", + { + {"slotted", CSSSelector::kShadowSlot}, + {"div", CSSSelector::kSubSelector}, + }, + }, + { + "::slotted(*)::placeholder", + { + {"placeholder", CSSSelector::kShadowPseudo}, + {"slotted", CSSSelector::kShadowSlot}, + {g_null_atom, CSSSelector::kSubSelector}, + }, + }, + { + "span::part(my-part)", + { + {"part", CSSSelector::kShadowPart}, + {"span", CSSSelector::kSubSelector}, + }, + }, + { + "video::-webkit-media-controls", + { + {"-webkit-media-controls", CSSSelector::kShadowPseudo}, + {"video", CSSSelector::kSubSelector}, + }, + }, + }; + + CSSParserContext* context = CSSParserContext::Create( + kHTMLStandardMode, SecureContextMode::kInsecureContext); + StyleSheetContents* sheet = StyleSheetContents::Create(context); + + for (auto test_case : test_cases) { + SCOPED_TRACE(test_case.input); + CSSTokenizer tokenizer(test_case.input); + const auto tokens = tokenizer.TokenizeToEOF(); + CSSParserTokenRange range(tokens); + CSSSelectorList list = + CSSSelectorParser::ParseSelector(range, context, sheet); + EXPECT_TRUE(list.IsValid()); + const CSSSelector* selector = list.First(); + for (auto sub_expectation : test_case.expectation) { + ASSERT_TRUE(selector); + AtomicString selector_value = selector->Match() == CSSSelector::kTag + ? selector->TagQName().LocalName() + : selector->Value(); + EXPECT_EQ(sub_expectation.first, selector_value); + EXPECT_EQ(sub_expectation.second, selector->Relation()); + selector = selector->TagHistory(); + } + EXPECT_FALSE(selector); + } +} + +TEST(CSSSelectorParserTest, UseCountRejectedNot) { + auto ExpectCount = [](const char* selector, WebFeature feature) { + std::unique_ptr<DummyPageHolder> dummy_holder = + DummyPageHolder::Create(IntSize(500, 500)); + Document* doc = &dummy_holder->GetDocument(); + Page::InsertOrdinaryPageForTesting(&dummy_holder->GetPage()); + CSSParserContext* context = CSSParserContext::Create( + kHTMLStandardMode, SecureContextMode::kSecureContext, + CSSParserContext::kLiveProfile, doc); + StyleSheetContents* sheet = StyleSheetContents::Create(context); + EXPECT_FALSE(UseCounter::IsCounted(*doc, feature)); + + CSSTokenizer tokenizer(selector); + const auto tokens = tokenizer.TokenizeToEOF(); + CSSParserTokenRange range(tokens); + CSSSelectorParser::ParseSelector(range, context, sheet); + + bool result = UseCounter::IsCounted(*doc, feature); + EXPECT_TRUE(result); + }; + + ExpectCount(":not(:nonsense :gibberish)", + WebFeature::kCSSSelectorNotWithInvalidList); + ExpectCount(":not(:nonsense :gibberish, .a)", + WebFeature::kCSSSelectorNotWithPartiallyValidList); + ExpectCount(":not()", WebFeature::kCSSSelectorNotWithInvalidList); + ExpectCount(":not(,)", WebFeature::kCSSSelectorNotWithInvalidList); + ExpectCount(":not(,,)", WebFeature::kCSSSelectorNotWithInvalidList); + ExpectCount(":not(* .a)", WebFeature::kCSSSelectorNotWithValidList); + ExpectCount(":not(:nonsense)", WebFeature::kCSSSelectorNotWithInvalidList); + ExpectCount(":not(* * .previouslyFailed)", + WebFeature::kCSSSelectorNotWithValidList); + ExpectCount(":not(* :nonsense)", WebFeature::kCSSSelectorNotWithInvalidList); + ExpectCount(":not(:nonsense *)", WebFeature::kCSSSelectorNotWithInvalidList); + ExpectCount(":not(*,)", WebFeature::kCSSSelectorNotWithPartiallyValidList); + ExpectCount(":not(*,,)", WebFeature::kCSSSelectorNotWithPartiallyValidList); + ExpectCount(":not(:nonsense ,)", WebFeature::kCSSSelectorNotWithInvalidList); + ExpectCount(":not(:nonsense,,)", WebFeature::kCSSSelectorNotWithInvalidList); + ExpectCount(":not(*, *)", WebFeature::kCSSSelectorNotWithValidList); + ExpectCount(":not(*, :nonsense)", + WebFeature::kCSSSelectorNotWithPartiallyValidList); + ExpectCount(":not(* , * *)", WebFeature::kCSSSelectorNotWithValidList); + ExpectCount(":not(*, * :nonsense)", + WebFeature::kCSSSelectorNotWithPartiallyValidList); + ExpectCount(":not(:nonsense,*)", + WebFeature::kCSSSelectorNotWithPartiallyValidList); + ExpectCount(":not(:nonsense , :nonsense)", + WebFeature::kCSSSelectorNotWithInvalidList); + ExpectCount(":not(:nonsense, * *)", + WebFeature::kCSSSelectorNotWithPartiallyValidList); + ExpectCount(":not(:nonsense, * :nonsense )", + WebFeature::kCSSSelectorNotWithInvalidList); + ExpectCount(":not(*, :not(* * :nonsense))", + WebFeature::kCSSSelectorNotWithPartiallyValidList); + ExpectCount(":not(:not(* * :nonsense) , *)", + WebFeature::kCSSSelectorNotWithPartiallyValidList); + ExpectCount(":not(.a || :nonsense, *)", + WebFeature::kCSSSelectorNotWithPartiallyValidList); +} + +TEST(CSSSelectorParserTest, SimpleNotNeverCounted) { + // :not with a simple selector from CSS Selectors 3 is not counted. + std::unique_ptr<DummyPageHolder> dummy_holder = + DummyPageHolder::Create(IntSize(500, 500)); + Document* doc = &dummy_holder->GetDocument(); + Page::InsertOrdinaryPageForTesting(&dummy_holder->GetPage()); + CSSParserContext* context = CSSParserContext::Create( + kHTMLStandardMode, SecureContextMode::kSecureContext, + CSSParserContext::kLiveProfile, doc); + StyleSheetContents* sheet = StyleSheetContents::Create(context); + + CSSTokenizer tokenizer(":not(*)"); + const auto tokens = tokenizer.TokenizeToEOF(); + CSSParserTokenRange range(tokens); + CSSSelectorParser::ParseSelector(range, context, sheet); + + EXPECT_FALSE( + UseCounter::IsCounted(*doc, WebFeature::kCSSSelectorNotWithValidList)); + EXPECT_FALSE( + UseCounter::IsCounted(*doc, WebFeature::kCSSSelectorNotWithInvalidList)); + EXPECT_FALSE(UseCounter::IsCounted( + *doc, WebFeature::kCSSSelectorNotWithPartiallyValidList)); +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_tokenizer.cc b/chromium/third_party/blink/renderer/core/css/parser/css_tokenizer.cc index 94e41a16dfb..0ae81f1bf23 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_tokenizer.cc +++ b/chromium/third_party/blink/renderer/core/css/parser/css_tokenizer.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/parser/css_tokenizer.h" namespace blink { -#include "third_party/blink/renderer/core/css_tokenizer_codepoints.cc" +#include "third_party/blink/renderer/core/css/css_tokenizer_codepoints.cc" } #include "third_party/blink/renderer/core/css/parser/css_parser_idioms.h" diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_variable_parser.cc b/chromium/third_party/blink/renderer/core/css/parser/css_variable_parser.cc index 3c931168a48..0ebe89db420 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_variable_parser.cc +++ b/chromium/third_party/blink/renderer/core/css/parser/css_variable_parser.cc @@ -36,8 +36,6 @@ bool ClassifyBlock(CSSParserTokenRange range, has_references = true; continue; case CSSValueEnv: - if (!RuntimeEnabledFeatures::CSSEnvironmentVariablesEnabled()) - return false; if (!IsValidEnvVariableReference(range.ConsumeBlock(), skip_variables)) return false; // Invalid reference. diff --git a/chromium/third_party/blink/renderer/core/css/parser/font_variant_east_asian_parser.h b/chromium/third_party/blink/renderer/core/css/parser/font_variant_east_asian_parser.h index 4877ca89196..bc06cea9d18 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/font_variant_east_asian_parser.h +++ b/chromium/third_party/blink/renderer/core/css/parser/font_variant_east_asian_parser.h @@ -33,18 +33,20 @@ class FontVariantEastAsianParser { case CSSValueTraditional: if (east_asian_form_value_) return ParseResult::kDisallowedValue; - east_asian_form_value_ = CSSPropertyParserHelpers::ConsumeIdent(range); + east_asian_form_value_ = + css_property_parser_helpers::ConsumeIdent(range); return ParseResult::kConsumedValue; case CSSValueFullWidth: case CSSValueProportionalWidth: if (east_asian_width_value_) return ParseResult::kDisallowedValue; - east_asian_width_value_ = CSSPropertyParserHelpers::ConsumeIdent(range); + east_asian_width_value_ = + css_property_parser_helpers::ConsumeIdent(range); return ParseResult::kConsumedValue; case CSSValueRuby: if (ruby_value_) return ParseResult::kDisallowedValue; - ruby_value_ = CSSPropertyParserHelpers::ConsumeIdent(range); + ruby_value_ = css_property_parser_helpers::ConsumeIdent(range); return ParseResult::kConsumedValue; default: return ParseResult::kUnknownValue; diff --git a/chromium/third_party/blink/renderer/core/css/parser/font_variant_ligatures_parser.h b/chromium/third_party/blink/renderer/core/css/parser/font_variant_ligatures_parser.h index 14495b685bb..71baf46c3df 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/font_variant_ligatures_parser.h +++ b/chromium/third_party/blink/renderer/core/css/parser/font_variant_ligatures_parser.h @@ -55,7 +55,7 @@ class FontVariantLigaturesParser { default: return ParseResult::kUnknownValue; } - result_->Append(*CSSPropertyParserHelpers::ConsumeIdent(range)); + result_->Append(*css_property_parser_helpers::ConsumeIdent(range)); return ParseResult::kConsumedValue; } diff --git a/chromium/third_party/blink/renderer/core/css/parser/font_variant_numeric_parser.h b/chromium/third_party/blink/renderer/core/css/parser/font_variant_numeric_parser.h index 3b39eb0f7ec..f0721c58af6 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/font_variant_numeric_parser.h +++ b/chromium/third_party/blink/renderer/core/css/parser/font_variant_numeric_parser.h @@ -59,7 +59,7 @@ class FontVariantNumericParser { default: return ParseResult::kUnknownValue; } - result_->Append(*CSSPropertyParserHelpers::ConsumeIdent(range)); + result_->Append(*css_property_parser_helpers::ConsumeIdent(range)); return ParseResult::kConsumedValue; } diff --git a/chromium/third_party/blink/renderer/core/css/parser/media_query_parser.cc b/chromium/third_party/blink/renderer/core/css/parser/media_query_parser.cc index 9539cc29415..0dcf599e730 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/media_query_parser.cc +++ b/chromium/third_party/blink/renderer/core/css/parser/media_query_parser.cc @@ -283,17 +283,17 @@ scoped_refptr<MediaQuerySet> MediaQueryParser::ParseImpl( bool MediaQueryParser::IsMediaFeatureAllowedInMode( const String& media_feature) const { return mode_ == kUASheetMode || - media_feature != MediaFeatureNames::immersiveMediaFeature; + media_feature != media_feature_names::kImmersiveMediaFeature; } MediaQueryData::MediaQueryData() : restrictor_(MediaQuery::kNone), - media_type_(MediaTypeNames::all), + media_type_(media_type_names::kAll), media_type_set_(false) {} void MediaQueryData::Clear() { restrictor_ = MediaQuery::kNone; - media_type_ = MediaTypeNames::all; + media_type_ = media_type_names::kAll; media_type_set_ = false; media_feature_ = String(); expressions_.clear(); diff --git a/chromium/third_party/blink/renderer/core/css/parser/sizes_attribute_parser_test.cc b/chromium/third_party/blink/renderer/core/css/parser/sizes_attribute_parser_test.cc index d35078dc288..ef509ed1119 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/sizes_attribute_parser_test.cc +++ b/chromium/third_party/blink/renderer/core/css/parser/sizes_attribute_parser_test.cc @@ -85,7 +85,7 @@ TEST(SizesAttributeParserTest, Basic) { data.primary_pointer_type = kPointerTypeFine; data.default_font_size = 16; data.three_d_enabled = true; - data.media_type = MediaTypeNames::screen; + data.media_type = media_type_names::kScreen; data.strict_mode = true; data.display_mode = kWebDisplayModeBrowser; MediaValues* media_values = MediaValuesCached::Create(data); @@ -166,7 +166,7 @@ TEST(SizesAttributeParserTest, FloatViewportWidth) { data.primary_pointer_type = kPointerTypeFine; data.default_font_size = 16; data.three_d_enabled = true; - data.media_type = MediaTypeNames::screen; + data.media_type = media_type_names::kScreen; data.strict_mode = true; data.display_mode = kWebDisplayModeBrowser; MediaValues* media_values = MediaValuesCached::Create(data); diff --git a/chromium/third_party/blink/renderer/core/css/parser/sizes_calc_parser_test.cc b/chromium/third_party/blink/renderer/core/css/parser/sizes_calc_parser_test.cc index 240981082f4..56b3d919b0d 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/sizes_calc_parser_test.cc +++ b/chromium/third_party/blink/renderer/core/css/parser/sizes_calc_parser_test.cc @@ -119,7 +119,7 @@ TEST(SizesCalcParserTest, Basic) { data.primary_pointer_type = kPointerTypeFine; data.default_font_size = 16; data.three_d_enabled = true; - data.media_type = MediaTypeNames::screen; + data.media_type = media_type_names::kScreen; data.strict_mode = true; data.display_mode = kWebDisplayModeBrowser; MediaValues* media_values = MediaValuesCached::Create(data); diff --git a/chromium/third_party/blink/renderer/core/css/properties/README.md b/chromium/third_party/blink/renderer/core/css/properties/README.md index c2e56dd4eb4..4083ed4a7ef 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/README.md +++ b/chromium/third_party/blink/renderer/core/css/properties/README.md @@ -89,7 +89,7 @@ headers are in this directory. 2. Implement the required methods on the property class. 3. If logic is required by multiple property classes you may need to create a new Utils file. These utils methods are grouped by pipeline function (e.g. - [CSSParsingUtils](https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/css/properties/css_parsing_utils.h)). + [css_parsing_utils](https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/css/properties/css_parsing_utils.h)). 4. Add the new property to `core/css/css_properties.json5`. Ensure that you include all the methods implemented on the property in the 'property_methods' flag so that the header file is generated correctly (see diff --git a/chromium/third_party/blink/renderer/core/css/properties/computed_style_utils.cc b/chromium/third_party/blink/renderer/core/css/properties/computed_style_utils.cc index 566b70cc563..73b8a08f7a3 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/computed_style_utils.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/computed_style_utils.cc @@ -709,17 +709,17 @@ CSSValue* ComputedStyleUtils::ValueForLineHeight(const ComputedStyle& style) { } CSSValueID IdentifierForFamily(const AtomicString& family) { - if (family == FontFamilyNames::webkit_cursive) + if (family == font_family_names::kWebkitCursive) return CSSValueCursive; - if (family == FontFamilyNames::webkit_fantasy) + if (family == font_family_names::kWebkitFantasy) return CSSValueFantasy; - if (family == FontFamilyNames::webkit_monospace) + if (family == font_family_names::kWebkitMonospace) return CSSValueMonospace; - if (family == FontFamilyNames::webkit_pictograph) + if (family == font_family_names::kWebkitPictograph) return CSSValueWebkitPictograph; - if (family == FontFamilyNames::webkit_sans_serif) + if (family == font_family_names::kWebkitSansSerif) return CSSValueSansSerif; - if (family == FontFamilyNames::webkit_serif) + if (family == font_family_names::kWebkitSerif) return CSSValueSerif; return CSSValueInvalid; } @@ -1856,27 +1856,6 @@ CSSValue* ComputedStyleUtils::StrokeDashArrayToCSSValueList( return list; } -CSSValue* ComputedStyleUtils::PaintOrderToCSSValueList( - const SVGComputedStyle& svg_style) { - CSSValueList* list = CSSValueList::CreateSpaceSeparated(); - for (int i = 0; i < 3; i++) { - EPaintOrderType paint_order_type = svg_style.PaintOrderType(i); - switch (paint_order_type) { - case PT_FILL: - case PT_STROKE: - case PT_MARKERS: - list->Append(*CSSIdentifierValue::Create(paint_order_type)); - break; - case PT_NONE: - default: - NOTREACHED(); - break; - } - } - - return list; -} - CSSValue* ComputedStyleUtils::AdjustSVGPaintForCurrentColor( const SVGPaint& paint, const Color& current_color) { @@ -2309,30 +2288,30 @@ CSSValue* ComputedStyleUtils::ValuesForFontVariantProperty( // Returns up to two values for 'scroll-customization' property. The values // correspond to the customization values for 'x' and 'y' axes. CSSValue* ComputedStyleUtils::ScrollCustomizationFlagsToCSSValue( - ScrollCustomization::ScrollDirection scroll_customization) { + scroll_customization::ScrollDirection scroll_customization) { CSSValueList* list = CSSValueList::CreateSpaceSeparated(); - if (scroll_customization == ScrollCustomization::kScrollDirectionAuto) { + if (scroll_customization == scroll_customization::kScrollDirectionAuto) { list->Append(*CSSIdentifierValue::Create(CSSValueAuto)); } else if (scroll_customization == - ScrollCustomization::kScrollDirectionNone) { + scroll_customization::kScrollDirectionNone) { list->Append(*CSSIdentifierValue::Create(CSSValueNone)); } else { - if ((scroll_customization & ScrollCustomization::kScrollDirectionPanX) == - ScrollCustomization::kScrollDirectionPanX) + if ((scroll_customization & scroll_customization::kScrollDirectionPanX) == + scroll_customization::kScrollDirectionPanX) list->Append(*CSSIdentifierValue::Create(CSSValuePanX)); else if (scroll_customization & - ScrollCustomization::kScrollDirectionPanLeft) + scroll_customization::kScrollDirectionPanLeft) list->Append(*CSSIdentifierValue::Create(CSSValuePanLeft)); else if (scroll_customization & - ScrollCustomization::kScrollDirectionPanRight) + scroll_customization::kScrollDirectionPanRight) list->Append(*CSSIdentifierValue::Create(CSSValuePanRight)); - if ((scroll_customization & ScrollCustomization::kScrollDirectionPanY) == - ScrollCustomization::kScrollDirectionPanY) + if ((scroll_customization & scroll_customization::kScrollDirectionPanY) == + scroll_customization::kScrollDirectionPanY) list->Append(*CSSIdentifierValue::Create(CSSValuePanY)); - else if (scroll_customization & ScrollCustomization::kScrollDirectionPanUp) + else if (scroll_customization & scroll_customization::kScrollDirectionPanUp) list->Append(*CSSIdentifierValue::Create(CSSValuePanUp)); else if (scroll_customization & - ScrollCustomization::kScrollDirectionPanDown) + scroll_customization::kScrollDirectionPanDown) list->Append(*CSSIdentifierValue::Create(CSSValuePanDown)); } diff --git a/chromium/third_party/blink/renderer/core/css/properties/computed_style_utils.h b/chromium/third_party/blink/renderer/core/css/properties/computed_style_utils.h index 2ec83b6ae44..b4133eeac32 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/computed_style_utils.h +++ b/chromium/third_party/blink/renderer/core/css/properties/computed_style_utils.h @@ -143,7 +143,6 @@ class ComputedStyleUtils { static CSSValueList* ValueForBorderRadiusShorthand(const ComputedStyle&); static CSSValue* StrokeDashArrayToCSSValueList(const SVGDashArray&, const ComputedStyle&); - static CSSValue* PaintOrderToCSSValueList(const SVGComputedStyle&); static CSSValue* AdjustSVGPaintForCurrentColor(const SVGPaint&, const Color&); static CSSValue* ValueForSVGResource(const StyleSVGResource*); static CSSValue* ValueForShadowData(const ShadowData&, @@ -189,7 +188,7 @@ class ComputedStyleUtils { Node*, bool allow_visited_style); static CSSValue* ScrollCustomizationFlagsToCSSValue( - ScrollCustomization::ScrollDirection); + scroll_customization::ScrollDirection); static CSSValue* ValueForGapLength(const GapLength&, const ComputedStyle&); }; diff --git a/chromium/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc b/chromium/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc index b686b57582a..b7c96bbf4ae 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc @@ -19,6 +19,7 @@ #include "third_party/blink/renderer/core/css/css_initial_value.h" #include "third_party/blink/renderer/core/css/css_path_value.h" #include "third_party/blink/renderer/core/css/css_primitive_value.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/css_ray_value.h" #include "third_party/blink/renderer/core/css/css_shadow_value.h" #include "third_party/blink/renderer/core/css/css_timing_function_value.h" @@ -34,7 +35,6 @@ #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/css/properties/css_property.h" #include "third_party/blink/renderer/core/css/properties/longhand.h" -#include "third_party/blink/renderer/core/css_property_names.h" #include "third_party/blink/renderer/core/css_value_keywords.h" #include "third_party/blink/renderer/core/frame/use_counter.h" #include "third_party/blink/renderer/core/frame/web_feature.h" @@ -42,7 +42,7 @@ #include "third_party/blink/renderer/core/svg/svg_parsing_error.h" #include "third_party/blink/renderer/core/svg/svg_path_utilities.h" #include "third_party/blink/renderer/platform/animation/timing_function.h" -#include "third_party/blink/renderer/platform/length.h" +#include "third_party/blink/renderer/platform/geometry/length.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" @@ -50,43 +50,43 @@ namespace blink { using namespace cssvalue; -namespace CSSParsingUtils { +namespace css_parsing_utils { namespace { bool IsLeftOrRightKeyword(CSSValueID id) { - return CSSPropertyParserHelpers::IdentMatches<CSSValueLeft, CSSValueRight>( + return css_property_parser_helpers::IdentMatches<CSSValueLeft, CSSValueRight>( id); } bool IsAuto(CSSValueID id) { - return CSSPropertyParserHelpers::IdentMatches<CSSValueAuto>(id); + return css_property_parser_helpers::IdentMatches<CSSValueAuto>(id); } bool IsNormalOrStretch(CSSValueID id) { - return CSSPropertyParserHelpers::IdentMatches<CSSValueNormal, - CSSValueStretch>(id); + return css_property_parser_helpers::IdentMatches<CSSValueNormal, + CSSValueStretch>(id); } bool IsContentDistributionKeyword(CSSValueID id) { - return CSSPropertyParserHelpers::IdentMatches< + return css_property_parser_helpers::IdentMatches< CSSValueSpaceBetween, CSSValueSpaceAround, CSSValueSpaceEvenly, CSSValueStretch>(id); } bool IsOverflowKeyword(CSSValueID id) { - return CSSPropertyParserHelpers::IdentMatches<CSSValueUnsafe, CSSValueSafe>( - id); + return css_property_parser_helpers::IdentMatches<CSSValueUnsafe, + CSSValueSafe>(id); } CSSIdentifierValue* ConsumeOverflowPositionKeyword(CSSParserTokenRange& range) { return IsOverflowKeyword(range.Peek().Id()) - ? CSSPropertyParserHelpers::ConsumeIdent(range) + ? css_property_parser_helpers::ConsumeIdent(range) : nullptr; } bool IsBaselineKeyword(CSSValueID id) { - return CSSPropertyParserHelpers::IdentMatches<CSSValueFirst, CSSValueLast, - CSSValueBaseline>(id); + return css_property_parser_helpers::IdentMatches<CSSValueFirst, CSSValueLast, + CSSValueBaseline>(id); } CSSValueID GetBaselineKeyword(CSSValue& value) { @@ -104,10 +104,10 @@ CSSValueID GetBaselineKeyword(CSSValue& value) { CSSValue* ConsumeBaselineKeyword(CSSParserTokenRange& range) { CSSIdentifierValue* preference = - CSSPropertyParserHelpers::ConsumeIdent<CSSValueFirst, CSSValueLast>( + css_property_parser_helpers::ConsumeIdent<CSSValueFirst, CSSValueLast>( range); CSSIdentifierValue* baseline = - CSSPropertyParserHelpers::ConsumeIdent<CSSValueBaseline>(range); + css_property_parser_helpers::ConsumeIdent<CSSValueBaseline>(range); if (!baseline) return nullptr; if (preference && preference->GetValueID() == CSSValueLast) { @@ -121,16 +121,16 @@ CSSValue* ConsumeSteps(CSSParserTokenRange& range) { DCHECK_EQ(range.Peek().FunctionId(), CSSValueSteps); CSSParserTokenRange range_copy = range; CSSParserTokenRange args = - CSSPropertyParserHelpers::ConsumeFunction(range_copy); + css_property_parser_helpers::ConsumeFunction(range_copy); CSSPrimitiveValue* steps = - CSSPropertyParserHelpers::ConsumePositiveInteger(args); + css_property_parser_helpers::ConsumePositiveInteger(args); if (!steps) return nullptr; StepsTimingFunction::StepPosition position = StepsTimingFunction::StepPosition::END; - if (CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args)) { + if (css_property_parser_helpers::ConsumeCommaIncludingWhitespace(args)) { switch (args.ConsumeIncludingWhitespace().Id()) { case CSSValueMiddle: if (!RuntimeEnabledFeatures::WebAnimationsAPIEnabled()) @@ -159,10 +159,10 @@ CSSValue* ConsumeFrames(CSSParserTokenRange& range) { DCHECK_EQ(range.Peek().FunctionId(), CSSValueFrames); CSSParserTokenRange range_copy = range; CSSParserTokenRange args = - CSSPropertyParserHelpers::ConsumeFunction(range_copy); + css_property_parser_helpers::ConsumeFunction(range_copy); CSSPrimitiveValue* frames = - CSSPropertyParserHelpers::ConsumePositiveInteger(args); + css_property_parser_helpers::ConsumePositiveInteger(args); if (!frames) return nullptr; @@ -181,18 +181,18 @@ CSSValue* ConsumeCubicBezier(CSSParserTokenRange& range) { DCHECK_EQ(range.Peek().FunctionId(), CSSValueCubicBezier); CSSParserTokenRange range_copy = range; CSSParserTokenRange args = - CSSPropertyParserHelpers::ConsumeFunction(range_copy); + css_property_parser_helpers::ConsumeFunction(range_copy); double x1, y1, x2, y2; - if (CSSPropertyParserHelpers::ConsumeNumberRaw(args, x1) && x1 >= 0 && + if (css_property_parser_helpers::ConsumeNumberRaw(args, x1) && x1 >= 0 && x1 <= 1 && - CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args) && - CSSPropertyParserHelpers::ConsumeNumberRaw(args, y1) && - CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args) && - CSSPropertyParserHelpers::ConsumeNumberRaw(args, x2) && x2 >= 0 && + css_property_parser_helpers::ConsumeCommaIncludingWhitespace(args) && + css_property_parser_helpers::ConsumeNumberRaw(args, y1) && + css_property_parser_helpers::ConsumeCommaIncludingWhitespace(args) && + css_property_parser_helpers::ConsumeNumberRaw(args, x2) && x2 >= 0 && x2 <= 1 && - CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args) && - CSSPropertyParserHelpers::ConsumeNumberRaw(args, y2) && args.AtEnd()) { + css_property_parser_helpers::ConsumeCommaIncludingWhitespace(args) && + css_property_parser_helpers::ConsumeNumberRaw(args, y2) && args.AtEnd()) { range = range_copy; return CSSCubicBezierTimingFunctionValue::Create(x1, y1, x2, y2); } @@ -202,13 +202,13 @@ CSSValue* ConsumeCubicBezier(CSSParserTokenRange& range) { CSSIdentifierValue* ConsumeBorderImageRepeatKeyword( CSSParserTokenRange& range) { - return CSSPropertyParserHelpers::ConsumeIdent<CSSValueStretch, CSSValueRepeat, - CSSValueSpace, CSSValueRound>( - range); + return css_property_parser_helpers::ConsumeIdent< + CSSValueStretch, CSSValueRepeat, CSSValueSpace, CSSValueRound>(range); } bool ConsumeCSSValueId(CSSParserTokenRange& range, CSSValueID& value) { - CSSIdentifierValue* keyword = CSSPropertyParserHelpers::ConsumeIdent(range); + CSSIdentifierValue* keyword = + css_property_parser_helpers::ConsumeIdent(range); if (!keyword || !range.AtEnd()) return false; value = keyword->GetValueID(); @@ -217,11 +217,11 @@ bool ConsumeCSSValueId(CSSParserTokenRange& range, CSSValueID& value) { CSSValue* ConsumeShapeRadius(CSSParserTokenRange& args, CSSParserMode css_parser_mode) { - if (CSSPropertyParserHelpers::IdentMatches<CSSValueClosestSide, - CSSValueFarthestSide>( + if (css_property_parser_helpers::IdentMatches<CSSValueClosestSide, + CSSValueFarthestSide>( args.Peek().Id())) - return CSSPropertyParserHelpers::ConsumeIdent(args); - return CSSPropertyParserHelpers::ConsumeLengthOrPercent( + return css_property_parser_helpers::ConsumeIdent(args); + return css_property_parser_helpers::ConsumeLengthOrPercent( args, css_parser_mode, kValueRangeNonNegative); } @@ -233,11 +233,11 @@ CSSBasicShapeCircleValue* ConsumeBasicShapeCircle( CSSBasicShapeCircleValue* shape = CSSBasicShapeCircleValue::Create(); if (CSSValue* radius = ConsumeShapeRadius(args, context.Mode())) shape->SetRadius(radius); - if (CSSPropertyParserHelpers::ConsumeIdent<CSSValueAt>(args)) { + if (css_property_parser_helpers::ConsumeIdent<CSSValueAt>(args)) { CSSValue* center_x = nullptr; CSSValue* center_y = nullptr; if (!ConsumePosition(args, context, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid, + css_property_parser_helpers::UnitlessQuirk::kForbid, base::Optional<WebFeature>(), center_x, center_y)) return nullptr; shape->SetCenterX(center_x); @@ -261,11 +261,11 @@ CSSBasicShapeEllipseValue* ConsumeBasicShapeEllipse( feature = WebFeature::kBasicShapeEllipseTwoRadius; } } - if (CSSPropertyParserHelpers::ConsumeIdent<CSSValueAt>(args)) { + if (css_property_parser_helpers::ConsumeIdent<CSSValueAt>(args)) { CSSValue* center_x = nullptr; CSSValue* center_y = nullptr; if (!ConsumePosition(args, context, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid, + css_property_parser_helpers::UnitlessQuirk::kForbid, base::Optional<WebFeature>(), center_x, center_y)) return nullptr; shape->SetCenterX(center_x); @@ -279,28 +279,29 @@ CSSBasicShapePolygonValue* ConsumeBasicShapePolygon( CSSParserTokenRange& args, const CSSParserContext& context) { CSSBasicShapePolygonValue* shape = CSSBasicShapePolygonValue::Create(); - if (CSSPropertyParserHelpers::IdentMatches<CSSValueEvenodd, CSSValueNonzero>( + if (css_property_parser_helpers::IdentMatches<CSSValueEvenodd, + CSSValueNonzero>( args.Peek().Id())) { shape->SetWindRule(args.ConsumeIncludingWhitespace().Id() == CSSValueEvenodd ? RULE_EVENODD : RULE_NONZERO); - if (!CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args)) + if (!css_property_parser_helpers::ConsumeCommaIncludingWhitespace(args)) return nullptr; } do { CSSPrimitiveValue* x_length = - CSSPropertyParserHelpers::ConsumeLengthOrPercent(args, context.Mode(), - kValueRangeAll); + css_property_parser_helpers::ConsumeLengthOrPercent( + args, context.Mode(), kValueRangeAll); if (!x_length) return nullptr; CSSPrimitiveValue* y_length = - CSSPropertyParserHelpers::ConsumeLengthOrPercent(args, context.Mode(), - kValueRangeAll); + css_property_parser_helpers::ConsumeLengthOrPercent( + args, context.Mode(), kValueRangeAll); if (!y_length) return nullptr; shape->AppendPoint(x_length, y_length); - } while (CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args)); + } while (css_property_parser_helpers::ConsumeCommaIncludingWhitespace(args)); return shape; } @@ -308,19 +309,20 @@ CSSBasicShapeInsetValue* ConsumeBasicShapeInset( CSSParserTokenRange& args, const CSSParserContext& context) { CSSBasicShapeInsetValue* shape = CSSBasicShapeInsetValue::Create(); - CSSPrimitiveValue* top = CSSPropertyParserHelpers::ConsumeLengthOrPercent( + CSSPrimitiveValue* top = css_property_parser_helpers::ConsumeLengthOrPercent( args, context.Mode(), kValueRangeAll); if (!top) return nullptr; - CSSPrimitiveValue* right = CSSPropertyParserHelpers::ConsumeLengthOrPercent( - args, context.Mode(), kValueRangeAll); + CSSPrimitiveValue* right = + css_property_parser_helpers::ConsumeLengthOrPercent(args, context.Mode(), + kValueRangeAll); CSSPrimitiveValue* bottom = nullptr; CSSPrimitiveValue* left = nullptr; if (right) { - bottom = CSSPropertyParserHelpers::ConsumeLengthOrPercent( + bottom = css_property_parser_helpers::ConsumeLengthOrPercent( args, context.Mode(), kValueRangeAll); if (bottom) { - left = CSSPropertyParserHelpers::ConsumeLengthOrPercent( + left = css_property_parser_helpers::ConsumeLengthOrPercent( args, context.Mode(), kValueRangeAll); } } @@ -333,7 +335,7 @@ CSSBasicShapeInsetValue* ConsumeBasicShapeInset( else shape->UpdateShapeSize1Value(top); - if (CSSPropertyParserHelpers::ConsumeIdent<CSSValueRound>(args)) { + if (css_property_parser_helpers::ConsumeIdent<CSSValueRound>(args)) { CSSValue* horizontal_radii[4] = {nullptr}; CSSValue* vertical_radii[4] = {nullptr}; if (!ConsumeRadii(horizontal_radii, vertical_radii, args, context.Mode(), @@ -360,12 +362,12 @@ bool ConsumeNumbers(CSSParserTokenRange& args, unsigned number_of_arguments) { do { CSSValue* parsed_value = - CSSPropertyParserHelpers::ConsumeNumber(args, kValueRangeAll); + css_property_parser_helpers::ConsumeNumber(args, kValueRangeAll); if (!parsed_value) return false; transform_value->Append(*parsed_value); if (--number_of_arguments && - !CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args)) { + !css_property_parser_helpers::ConsumeCommaIncludingWhitespace(args)) { return false; } } while (number_of_arguments); @@ -376,11 +378,11 @@ bool ConsumePerspective(CSSParserTokenRange& args, const CSSParserContext& context, CSSFunctionValue*& transform_value, bool use_legacy_parsing) { - CSSPrimitiveValue* parsed_value = CSSPropertyParserHelpers::ConsumeLength( + CSSPrimitiveValue* parsed_value = css_property_parser_helpers::ConsumeLength( args, context.Mode(), kValueRangeNonNegative); if (!parsed_value && use_legacy_parsing) { double perspective; - if (!CSSPropertyParserHelpers::ConsumeNumberRaw(args, perspective) || + if (!css_property_parser_helpers::ConsumeNumberRaw(args, perspective) || perspective < 0) { return false; } @@ -400,16 +402,16 @@ bool ConsumeTranslate3d(CSSParserTokenRange& args, unsigned number_of_arguments = 2; CSSValue* parsed_value = nullptr; do { - parsed_value = CSSPropertyParserHelpers::ConsumeLengthOrPercent( + parsed_value = css_property_parser_helpers::ConsumeLengthOrPercent( args, css_parser_mode, kValueRangeAll); if (!parsed_value) return false; transform_value->Append(*parsed_value); - if (!CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args)) + if (!css_property_parser_helpers::ConsumeCommaIncludingWhitespace(args)) return false; } while (--number_of_arguments); - parsed_value = CSSPropertyParserHelpers::ConsumeLength(args, css_parser_mode, - kValueRangeAll); + parsed_value = css_property_parser_helpers::ConsumeLength( + args, css_parser_mode, kValueRangeAll); if (!parsed_value) return false; transform_value->Append(*parsed_value); @@ -419,7 +421,7 @@ bool ConsumeTranslate3d(CSSParserTokenRange& args, } // namespace bool IsSelfPositionKeyword(CSSValueID id) { - return CSSPropertyParserHelpers::IdentMatches< + return css_property_parser_helpers::IdentMatches< CSSValueStart, CSSValueEnd, CSSValueCenter, CSSValueSelfStart, CSSValueSelfEnd, CSSValueFlexStart, CSSValueFlexEnd>(id); } @@ -429,7 +431,7 @@ bool IsSelfPositionOrLeftOrRightKeyword(CSSValueID id) { } bool IsContentPositionKeyword(CSSValueID id) { - return CSSPropertyParserHelpers::IdentMatches< + return css_property_parser_helpers::IdentMatches< CSSValueStart, CSSValueEnd, CSSValueCenter, CSSValueFlexStart, CSSValueFlexEnd>(id); } @@ -440,9 +442,10 @@ bool IsContentPositionOrLeftOrRightKeyword(CSSValueID id) { CSSValue* ConsumeScrollOffset(CSSParserTokenRange& range) { range.ConsumeWhitespace(); - if (CSSPropertyParserHelpers::IdentMatches<CSSValueAuto>(range.Peek().Id())) - return CSSPropertyParserHelpers::ConsumeIdent(range); - CSSValue* value = CSSPropertyParserHelpers::ConsumeLengthOrPercent( + if (css_property_parser_helpers::IdentMatches<CSSValueAuto>( + range.Peek().Id())) + return css_property_parser_helpers::ConsumeIdent(range); + CSSValue* value = css_property_parser_helpers::ConsumeLengthOrPercent( range, kHTMLStandardMode, kValueRangeNonNegative); if (!range.AtEnd()) return nullptr; @@ -455,7 +458,7 @@ CSSValue* ConsumeSelfPositionOverflowPosition( DCHECK(is_position_keyword); CSSValueID id = range.Peek().Id(); if (IsAuto(id) || IsNormalOrStretch(id)) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); if (IsBaselineKeyword(id)) return ConsumeBaselineKeyword(range); @@ -464,7 +467,7 @@ CSSValue* ConsumeSelfPositionOverflowPosition( if (!is_position_keyword(range.Peek().Id())) return nullptr; CSSIdentifierValue* self_position = - CSSPropertyParserHelpers::ConsumeIdent(range); + css_property_parser_helpers::ConsumeIdent(range); if (overflow_position) { return CSSValuePair::Create(overflow_position, self_position, CSSValuePair::kDropIdenticalValues); @@ -477,7 +480,7 @@ CSSValue* ConsumeContentDistributionOverflowPosition( IsPositionKeyword is_position_keyword) { DCHECK(is_position_keyword); CSSValueID id = range.Peek().Id(); - if (CSSPropertyParserHelpers::IdentMatches<CSSValueNormal>(id)) { + if (css_property_parser_helpers::IdentMatches<CSSValueNormal>(id)) { return CSSContentDistributionValue::Create( CSSValueInvalid, range.ConsumeIncludingWhitespace().Id(), CSSValueInvalid); @@ -510,15 +513,16 @@ CSSValue* ConsumeContentDistributionOverflowPosition( CSSValue* ConsumeAnimationIterationCount(CSSParserTokenRange& range) { if (range.Peek().Id() == CSSValueInfinite) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeNonNegative); + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeNumber(range, + kValueRangeNonNegative); } CSSValue* ConsumeAnimationName(CSSParserTokenRange& range, const CSSParserContext& context, bool allow_quoted_name) { if (range.Peek().Id() == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); if (allow_quoted_name && range.Peek().GetType() == kStringToken) { // Legacy support for strings in prefixed animations. @@ -530,7 +534,7 @@ CSSValue* ConsumeAnimationName(CSSParserTokenRange& range, return CSSCustomIdentValue::Create(token.Value().ToAtomicString()); } - return CSSPropertyParserHelpers::ConsumeCustomIdent(range); + return css_property_parser_helpers::ConsumeCustomIdent(range, context); } CSSValue* ConsumeAnimationTimingFunction(CSSParserTokenRange& range) { @@ -539,7 +543,7 @@ CSSValue* ConsumeAnimationTimingFunction(CSSParserTokenRange& range) { id == CSSValueEaseOut || id == CSSValueEaseInOut || id == CSSValueStepStart || id == CSSValueStepEnd || id == CSSValueStepMiddle) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); CSSValueID function = range.Peek().FunctionId(); if (function == CSSValueSteps) @@ -596,7 +600,7 @@ bool ConsumeAnimationShorthand( } parsed_longhand[i] = false; } - } while (CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(range)); + } while (css_property_parser_helpers::ConsumeCommaIncludingWhitespace(range)); return true; } @@ -616,41 +620,41 @@ void AddBackgroundValue(CSSValue*& list, CSSValue* value) { } CSSValue* ConsumeBackgroundAttachment(CSSParserTokenRange& range) { - return CSSPropertyParserHelpers::ConsumeIdent<CSSValueScroll, CSSValueFixed, - CSSValueLocal>(range); + return css_property_parser_helpers::ConsumeIdent< + CSSValueScroll, CSSValueFixed, CSSValueLocal>(range); } CSSValue* ConsumeBackgroundBlendMode(CSSParserTokenRange& range) { CSSValueID id = range.Peek().Id(); if (id == CSSValueNormal || id == CSSValueOverlay || (id >= CSSValueMultiply && id <= CSSValueLuminosity)) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); return nullptr; } CSSValue* ConsumeBackgroundBox(CSSParserTokenRange& range) { - return CSSPropertyParserHelpers::ConsumeIdent< + return css_property_parser_helpers::ConsumeIdent< CSSValueBorderBox, CSSValuePaddingBox, CSSValueContentBox>(range); } CSSValue* ConsumeBackgroundComposite(CSSParserTokenRange& range) { - return CSSPropertyParserHelpers::ConsumeIdentRange(range, CSSValueClear, - CSSValuePlusLighter); + return css_property_parser_helpers::ConsumeIdentRange(range, CSSValueClear, + CSSValuePlusLighter); } CSSValue* ConsumeMaskSourceType(CSSParserTokenRange& range) { DCHECK(RuntimeEnabledFeatures::CSSMaskSourceTypeEnabled()); - return CSSPropertyParserHelpers::ConsumeIdent<CSSValueAuto, CSSValueAlpha, - CSSValueLuminance>(range); + return css_property_parser_helpers::ConsumeIdent<CSSValueAuto, CSSValueAlpha, + CSSValueLuminance>(range); } CSSPrimitiveValue* ConsumeLengthOrPercentCountNegative( CSSParserTokenRange& range, const CSSParserContext& context, base::Optional<WebFeature> negative_size) { - CSSPrimitiveValue* result = - ConsumeLengthOrPercent(range, context.Mode(), kValueRangeNonNegative, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + CSSPrimitiveValue* result = ConsumeLengthOrPercent( + range, context.Mode(), kValueRangeNonNegative, + css_property_parser_helpers::UnitlessQuirk::kForbid); if (!result && negative_size) context.Count(*negative_size); return result; @@ -660,13 +664,13 @@ CSSValue* ConsumeBackgroundSize(CSSParserTokenRange& range, const CSSParserContext& context, base::Optional<WebFeature> negative_size, ParsingStyle parsing_style) { - if (CSSPropertyParserHelpers::IdentMatches<CSSValueContain, CSSValueCover>( + if (css_property_parser_helpers::IdentMatches<CSSValueContain, CSSValueCover>( range.Peek().Id())) { - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); } CSSValue* horizontal = - CSSPropertyParserHelpers::ConsumeIdent<CSSValueAuto>(range); + css_property_parser_helpers::ConsumeIdent<CSSValueAuto>(range); if (!horizontal) { horizontal = ConsumeLengthOrPercentCountNegative(range, context, negative_size); @@ -693,21 +697,22 @@ CSSValue* ConsumeBackgroundSize(CSSParserTokenRange& range, CSSValuePair::kKeepIdenticalValues); } -bool ConsumeBackgroundPosition(CSSParserTokenRange& range, - const CSSParserContext& context, - CSSPropertyParserHelpers::UnitlessQuirk unitless, - CSSValue*& result_x, - CSSValue*& result_y) { +bool ConsumeBackgroundPosition( + CSSParserTokenRange& range, + const CSSParserContext& context, + css_property_parser_helpers::UnitlessQuirk unitless, + CSSValue*& result_x, + CSSValue*& result_y) { do { CSSValue* position_x = nullptr; CSSValue* position_y = nullptr; - if (!CSSPropertyParserHelpers::ConsumePosition( + if (!css_property_parser_helpers::ConsumePosition( range, context, unitless, WebFeature::kThreeValuedPositionBackground, position_x, position_y)) return false; AddBackgroundValue(result_x, position_x); AddBackgroundValue(result_y, position_y); - } while (CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(range)); + } while (css_property_parser_helpers::ConsumeCommaIncludingWhitespace(range)); return true; } @@ -715,12 +720,12 @@ CSSValue* ConsumePrefixedBackgroundBox(CSSParserTokenRange& range, AllowTextValue allow_text_value) { // The values 'border', 'padding' and 'content' are deprecated and do not // apply to the version of the property that has the -webkit- prefix removed. - if (CSSValue* value = CSSPropertyParserHelpers::ConsumeIdentRange( + if (CSSValue* value = css_property_parser_helpers::ConsumeIdentRange( range, CSSValueBorder, CSSValuePaddingBox)) return value; if (allow_text_value == AllowTextValue::kAllow && range.Peek().Id() == CSSValueText) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); return nullptr; } @@ -729,10 +734,10 @@ CSSValue* ParseBackgroundBox(CSSParserTokenRange& range, AllowTextValue alias_allow_text_value) { // This is legacy behavior that does not match spec, see crbug.com/604023 if (local_context.UseAliasParsing()) { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( + return css_property_parser_helpers::ConsumeCommaSeparatedList( ConsumePrefixedBackgroundBox, range, alias_allow_text_value); } - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( + return css_property_parser_helpers::ConsumeCommaSeparatedList( ConsumeBackgroundBox, range); } @@ -740,7 +745,7 @@ CSSValue* ParseBackgroundOrMaskSize(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext& local_context, base::Optional<WebFeature> negative_size) { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( + return css_property_parser_helpers::ConsumeCommaSeparatedList( ConsumeBackgroundSize, range, context, negative_size, local_context.UseAliasParsing() ? ParsingStyle::kLegacy : ParsingStyle::kNotLegacy); @@ -760,7 +765,7 @@ CSSValue* ConsumeBackgroundComponent(CSSPropertyID resolved_property, return ConsumeBackgroundBox(range); case CSSPropertyBackgroundImage: case CSSPropertyWebkitMaskImage: - return CSSPropertyParserHelpers::ConsumeImageOrNone(range, &context); + return css_property_parser_helpers::ConsumeImageOrNone(range, &context); case CSSPropertyBackgroundPositionX: case CSSPropertyWebkitMaskPositionX: return ConsumePositionLonghand<CSSValueLeft, CSSValueRight>( @@ -778,7 +783,7 @@ CSSValue* ConsumeBackgroundComponent(CSSPropertyID resolved_property, WebFeature::kNegativeMaskSize, ParsingStyle::kNotLegacy); case CSSPropertyBackgroundColor: - return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); + return css_property_parser_helpers::ConsumeColor(range, context.Mode()); case CSSPropertyWebkitMaskClip: return ConsumePrefixedBackgroundBox(range, AllowTextValue::kAllow); case CSSPropertyWebkitMaskOrigin: @@ -833,14 +838,15 @@ bool ParseBackgroundOrMask(bool important, ConsumeRepeatStyleComponent(range, value, value_y, implicit); } else if (property.IDEquals(CSSPropertyBackgroundPositionX) || property.IDEquals(CSSPropertyWebkitMaskPositionX)) { - if (!CSSPropertyParserHelpers::ConsumePosition( + if (!css_property_parser_helpers::ConsumePosition( range, context, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid, + css_property_parser_helpers::UnitlessQuirk::kForbid, WebFeature::kThreeValuedPositionBackground, value, value_y)) continue; } else if (property.IDEquals(CSSPropertyBackgroundSize) || property.IDEquals(CSSPropertyWebkitMaskSize)) { - if (!CSSPropertyParserHelpers::ConsumeSlashIncludingWhitespace(range)) + if (!css_property_parser_helpers::ConsumeSlashIncludingWhitespace( + range)) continue; value = ConsumeBackgroundSize(range, context, @@ -899,7 +905,7 @@ bool ParseBackgroundOrMask(bool important, AddBackgroundValue(longhands[i], CSSInitialValue::Create()); } } - } while (CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(range)); + } while (css_property_parser_helpers::ConsumeCommaIncludingWhitespace(range)); if (!range.AtEnd()) return false; @@ -908,10 +914,11 @@ bool ParseBackgroundOrMask(bool important, if (property.IDEquals(CSSPropertyBackgroundSize) && longhands[i] && context.UseLegacyBackgroundSizeShorthandBehavior()) continue; - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( property.PropertyID(), shorthand.id(), *longhands[i], important, - implicit ? CSSPropertyParserHelpers::IsImplicitProperty::kImplicit - : CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + implicit + ? css_property_parser_helpers::IsImplicitProperty::kImplicit + : css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); } return true; @@ -921,24 +928,24 @@ bool ConsumeRepeatStyleComponent(CSSParserTokenRange& range, CSSValue*& value1, CSSValue*& value2, bool& implicit) { - if (CSSPropertyParserHelpers::ConsumeIdent<CSSValueRepeatX>(range)) { + if (css_property_parser_helpers::ConsumeIdent<CSSValueRepeatX>(range)) { value1 = CSSIdentifierValue::Create(CSSValueRepeat); value2 = CSSIdentifierValue::Create(CSSValueNoRepeat); implicit = true; return true; } - if (CSSPropertyParserHelpers::ConsumeIdent<CSSValueRepeatY>(range)) { + if (css_property_parser_helpers::ConsumeIdent<CSSValueRepeatY>(range)) { value1 = CSSIdentifierValue::Create(CSSValueNoRepeat); value2 = CSSIdentifierValue::Create(CSSValueRepeat); implicit = true; return true; } - value1 = CSSPropertyParserHelpers::ConsumeIdent< + value1 = css_property_parser_helpers::ConsumeIdent< CSSValueRepeat, CSSValueNoRepeat, CSSValueRound, CSSValueSpace>(range); if (!value1) return false; - value2 = CSSPropertyParserHelpers::ConsumeIdent< + value2 = css_property_parser_helpers::ConsumeIdent< CSSValueRepeat, CSSValueNoRepeat, CSSValueRound, CSSValueSpace>(range); if (!value2) { value2 = value1; @@ -958,7 +965,7 @@ bool ConsumeRepeatStyle(CSSParserTokenRange& range, return false; AddBackgroundValue(result_x, repeat_x); AddBackgroundValue(result_y, repeat_y); - } while (CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(range)); + } while (css_property_parser_helpers::ConsumeCommaIncludingWhitespace(range)); return true; } @@ -985,7 +992,7 @@ bool ConsumeBorderImageComponents(CSSParserTokenRange& range, DefaultFill default_fill) { do { if (!source) { - source = CSSPropertyParserHelpers::ConsumeImageOrNone(range, &context); + source = css_property_parser_helpers::ConsumeImageOrNone(range, &context); if (source) continue; } @@ -999,9 +1006,10 @@ bool ConsumeBorderImageComponents(CSSParserTokenRange& range, if (slice) { DCHECK(!width); DCHECK(!outset); - if (CSSPropertyParserHelpers::ConsumeSlashIncludingWhitespace(range)) { + if (css_property_parser_helpers::ConsumeSlashIncludingWhitespace( + range)) { width = ConsumeBorderImageWidth(range); - if (CSSPropertyParserHelpers::ConsumeSlashIncludingWhitespace( + if (css_property_parser_helpers::ConsumeSlashIncludingWhitespace( range)) { outset = ConsumeBorderImageOutset(range); if (!outset) @@ -1033,15 +1041,15 @@ CSSValue* ConsumeBorderImageRepeat(CSSParserTokenRange& range) { CSSValue* ConsumeBorderImageSlice(CSSParserTokenRange& range, DefaultFill default_fill) { - bool fill = CSSPropertyParserHelpers::ConsumeIdent<CSSValueFill>(range); + bool fill = css_property_parser_helpers::ConsumeIdent<CSSValueFill>(range); CSSValue* slices[4] = {nullptr}; for (size_t index = 0; index < 4; ++index) { - CSSPrimitiveValue* value = - CSSPropertyParserHelpers::ConsumePercent(range, kValueRangeNonNegative); + CSSPrimitiveValue* value = css_property_parser_helpers::ConsumePercent( + range, kValueRangeNonNegative); if (!value) { - value = CSSPropertyParserHelpers::ConsumeNumber(range, - kValueRangeNonNegative); + value = css_property_parser_helpers::ConsumeNumber( + range, kValueRangeNonNegative); } if (!value) break; @@ -1049,12 +1057,12 @@ CSSValue* ConsumeBorderImageSlice(CSSParserTokenRange& range, } if (!slices[0]) return nullptr; - if (CSSPropertyParserHelpers::ConsumeIdent<CSSValueFill>(range)) { + if (css_property_parser_helpers::ConsumeIdent<CSSValueFill>(range)) { if (fill) return nullptr; fill = true; } - CSSPropertyParserHelpers::Complete4Sides(slices); + css_property_parser_helpers::Complete4Sides(slices); if (default_fill == DefaultFill::kFill) fill = true; return CSSBorderImageSliceValue::Create( @@ -1068,22 +1076,22 @@ CSSValue* ConsumeBorderImageWidth(CSSParserTokenRange& range) { CSSValue* value = nullptr; for (size_t index = 0; index < 4; ++index) { - value = - CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeNonNegative); + value = css_property_parser_helpers::ConsumeNumber(range, + kValueRangeNonNegative); if (!value) { - value = CSSPropertyParserHelpers::ConsumeLengthOrPercent( + value = css_property_parser_helpers::ConsumeLengthOrPercent( range, kHTMLStandardMode, kValueRangeNonNegative, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } if (!value) - value = CSSPropertyParserHelpers::ConsumeIdent<CSSValueAuto>(range); + value = css_property_parser_helpers::ConsumeIdent<CSSValueAuto>(range); if (!value) break; widths[index] = value; } if (!widths[0]) return nullptr; - CSSPropertyParserHelpers::Complete4Sides(widths); + css_property_parser_helpers::Complete4Sides(widths); return CSSQuadValue::Create(widths[0], widths[1], widths[2], widths[3], CSSQuadValue::kSerializeAsQuad); } @@ -1093,11 +1101,11 @@ CSSValue* ConsumeBorderImageOutset(CSSParserTokenRange& range) { CSSValue* value = nullptr; for (size_t index = 0; index < 4; ++index) { - value = - CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeNonNegative); + value = css_property_parser_helpers::ConsumeNumber(range, + kValueRangeNonNegative); if (!value) { - value = CSSPropertyParserHelpers::ConsumeLength(range, kHTMLStandardMode, - kValueRangeNonNegative); + value = css_property_parser_helpers::ConsumeLength( + range, kHTMLStandardMode, kValueRangeNonNegative); } if (!value) break; @@ -1105,18 +1113,18 @@ CSSValue* ConsumeBorderImageOutset(CSSParserTokenRange& range) { } if (!outsets[0]) return nullptr; - CSSPropertyParserHelpers::Complete4Sides(outsets); + css_property_parser_helpers::Complete4Sides(outsets); return CSSQuadValue::Create(outsets[0], outsets[1], outsets[2], outsets[3], CSSQuadValue::kSerializeAsQuad); } CSSValue* ParseBorderRadiusCorner(CSSParserTokenRange& range, const CSSParserContext& context) { - CSSValue* parsed_value1 = CSSPropertyParserHelpers::ConsumeLengthOrPercent( + CSSValue* parsed_value1 = css_property_parser_helpers::ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative); if (!parsed_value1) return nullptr; - CSSValue* parsed_value2 = CSSPropertyParserHelpers::ConsumeLengthOrPercent( + CSSValue* parsed_value2 = css_property_parser_helpers::ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative); if (!parsed_value2) parsed_value2 = parsed_value1; @@ -1131,9 +1139,10 @@ CSSValue* ParseBorderWidthSide(CSSParserTokenRange& range, bool allow_quirky_lengths = IsQuirksModeBehavior(context.Mode()) && (shorthand == CSSPropertyInvalid || shorthand == CSSPropertyBorderWidth); - CSSPropertyParserHelpers::UnitlessQuirk unitless = - allow_quirky_lengths ? CSSPropertyParserHelpers::UnitlessQuirk::kAllow - : CSSPropertyParserHelpers::UnitlessQuirk::kForbid; + css_property_parser_helpers::UnitlessQuirk unitless = + allow_quirky_lengths + ? css_property_parser_helpers::UnitlessQuirk::kAllow + : css_property_parser_helpers::UnitlessQuirk::kForbid; return ConsumeBorderWidth(range, context.Mode(), unitless); } @@ -1141,8 +1150,8 @@ CSSValue* ConsumeShadow(CSSParserTokenRange& range, CSSParserMode css_parser_mode, AllowInsetAndSpread inset_and_spread) { if (range.Peek().Id() == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeCommaSeparatedList( ParseSingleShadow, range, css_parser_mode, inset_and_spread); } @@ -1155,27 +1164,28 @@ CSSShadowValue* ParseSingleShadow(CSSParserTokenRange& range, if (range.AtEnd()) return nullptr; - color = CSSPropertyParserHelpers::ConsumeColor(range, css_parser_mode); + color = css_property_parser_helpers::ConsumeColor(range, css_parser_mode); if (range.Peek().Id() == CSSValueInset) { if (inset_and_spread != AllowInsetAndSpread::kAllow) return nullptr; - style = CSSPropertyParserHelpers::ConsumeIdent(range); + style = css_property_parser_helpers::ConsumeIdent(range); if (!color) - color = CSSPropertyParserHelpers::ConsumeColor(range, css_parser_mode); + color = css_property_parser_helpers::ConsumeColor(range, css_parser_mode); } CSSPrimitiveValue* horizontal_offset = - CSSPropertyParserHelpers::ConsumeLength(range, css_parser_mode, - kValueRangeAll); + css_property_parser_helpers::ConsumeLength(range, css_parser_mode, + kValueRangeAll); if (!horizontal_offset) return nullptr; - CSSPrimitiveValue* vertical_offset = CSSPropertyParserHelpers::ConsumeLength( - range, css_parser_mode, kValueRangeAll); + CSSPrimitiveValue* vertical_offset = + css_property_parser_helpers::ConsumeLength(range, css_parser_mode, + kValueRangeAll); if (!vertical_offset) return nullptr; - CSSPrimitiveValue* blur_radius = CSSPropertyParserHelpers::ConsumeLength( + CSSPrimitiveValue* blur_radius = css_property_parser_helpers::ConsumeLength( range, css_parser_mode, kValueRangeAll); CSSPrimitiveValue* spread_distance = nullptr; if (blur_radius) { @@ -1183,20 +1193,22 @@ CSSShadowValue* ParseSingleShadow(CSSParserTokenRange& range, if (blur_radius->GetDoubleValue() < 0) return nullptr; if (inset_and_spread == AllowInsetAndSpread::kAllow) { - spread_distance = CSSPropertyParserHelpers::ConsumeLength( + spread_distance = css_property_parser_helpers::ConsumeLength( range, css_parser_mode, kValueRangeAll); } } if (!range.AtEnd()) { if (!color) - color = CSSPropertyParserHelpers::ConsumeColor(range, css_parser_mode); + color = css_property_parser_helpers::ConsumeColor(range, css_parser_mode); if (range.Peek().Id() == CSSValueInset) { if (inset_and_spread != AllowInsetAndSpread::kAllow || style) return nullptr; - style = CSSPropertyParserHelpers::ConsumeIdent(range); - if (!color) - color = CSSPropertyParserHelpers::ConsumeColor(range, css_parser_mode); + style = css_property_parser_helpers::ConsumeIdent(range); + if (!color) { + color = + css_property_parser_helpers::ConsumeColor(range, css_parser_mode); + } } } return CSSShadowValue::Create(horizontal_offset, vertical_offset, blur_radius, @@ -1205,16 +1217,16 @@ CSSShadowValue* ParseSingleShadow(CSSParserTokenRange& range, CSSValue* ConsumeColumnCount(CSSParserTokenRange& range) { if (range.Peek().Id() == CSSValueAuto) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumePositiveInteger(range); + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumePositiveInteger(range); } CSSValue* ConsumeColumnWidth(CSSParserTokenRange& range) { if (range.Peek().Id() == CSSValueAuto) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); // Always parse lengths in strict mode here, since it would be ambiguous // otherwise when used in the 'columns' shorthand property. - CSSPrimitiveValue* column_width = CSSPropertyParserHelpers::ConsumeLength( + CSSPrimitiveValue* column_width = css_property_parser_helpers::ConsumeLength( range, kHTMLStandardMode, kValueRangeNonNegative); if (!column_width) return nullptr; @@ -1225,7 +1237,7 @@ bool ConsumeColumnWidthOrCount(CSSParserTokenRange& range, CSSValue*& column_width, CSSValue*& column_count) { if (range.Peek().Id() == CSSValueAuto) { - CSSPropertyParserHelpers::ConsumeIdent(range); + css_property_parser_helpers::ConsumeIdent(range); return true; } if (!column_width) { @@ -1241,24 +1253,26 @@ bool ConsumeColumnWidthOrCount(CSSParserTokenRange& range, CSSValue* ConsumeGapLength(CSSParserTokenRange& range, const CSSParserContext& context) { if (range.Peek().Id() == CSSValueNormal) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeLengthOrPercent( + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative); } -CSSValue* ConsumeCounter(CSSParserTokenRange& range, int default_value) { +CSSValue* ConsumeCounter(CSSParserTokenRange& range, + const CSSParserContext& context, + int default_value) { if (range.Peek().Id() == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); CSSValueList* list = CSSValueList::CreateSpaceSeparated(); do { CSSCustomIdentValue* counter_name = - CSSPropertyParserHelpers::ConsumeCustomIdent(range); + css_property_parser_helpers::ConsumeCustomIdent(range, context); if (!counter_name) return nullptr; int value = default_value; if (CSSPrimitiveValue* counter_value = - CSSPropertyParserHelpers::ConsumeInteger(range)) + css_property_parser_helpers::ConsumeInteger(range)) value = clampTo<int>(counter_value->GetDoubleValue()); list->Append(*CSSValuePair::Create( counter_name, @@ -1270,24 +1284,24 @@ CSSValue* ConsumeCounter(CSSParserTokenRange& range, int default_value) { CSSValue* ConsumeFontSize(CSSParserTokenRange& range, CSSParserMode css_parser_mode, - CSSPropertyParserHelpers::UnitlessQuirk unitless) { + css_property_parser_helpers::UnitlessQuirk unitless) { if (range.Peek().Id() >= CSSValueXxSmall && range.Peek().Id() <= CSSValueLarger) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeLengthOrPercent( + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeLengthOrPercent( range, css_parser_mode, kValueRangeNonNegative, unitless); } CSSValue* ConsumeLineHeight(CSSParserTokenRange& range, CSSParserMode css_parser_mode) { if (range.Peek().Id() == CSSValueNormal) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); CSSPrimitiveValue* line_height = - CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeNonNegative); + css_property_parser_helpers::ConsumeNumber(range, kValueRangeNonNegative); if (line_height) return line_height; - return CSSPropertyParserHelpers::ConsumeLengthOrPercent( + return css_property_parser_helpers::ConsumeLengthOrPercent( range, css_parser_mode, kValueRangeNonNegative); } @@ -1305,13 +1319,13 @@ CSSValueList* ConsumeFontFamily(CSSParserTokenRange& range) { return nullptr; } } - } while (CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(range)); + } while (css_property_parser_helpers::ConsumeCommaIncludingWhitespace(range)); return list; } CSSValue* ConsumeGenericFamily(CSSParserTokenRange& range) { - return CSSPropertyParserHelpers::ConsumeIdentRange(range, CSSValueSerif, - CSSValueWebkitBody); + return css_property_parser_helpers::ConsumeIdentRange(range, CSSValueSerif, + CSSValueWebkitBody); } CSSValue* ConsumeFamilyName(CSSParserTokenRange& range) { @@ -1339,7 +1353,7 @@ String ConcatenateFamilyName(CSSParserTokenRange& range) { builder.Append(range.ConsumeIncludingWhitespace().Value()); } if (!added_space && - (CSSPropertyParserHelpers::IsCSSWideKeyword(first_token.Value()) || + (css_property_parser_helpers::IsCSSWideKeyword(first_token.Value()) || EqualIgnoringASCIICase(first_token.Value(), "default"))) { return String(); } @@ -1368,16 +1382,16 @@ CSSValue* ConsumeFontStyle(CSSParserTokenRange& range, const CSSParserMode& parser_mode) { if (range.Peek().Id() == CSSValueNormal || range.Peek().Id() == CSSValueItalic) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); if (range.Peek().Id() != CSSValueOblique) return nullptr; CSSIdentifierValue* oblique_identifier = - CSSPropertyParserHelpers::ConsumeIdent<CSSValueOblique>(range); + css_property_parser_helpers::ConsumeIdent<CSSValueOblique>(range); CSSPrimitiveValue* start_angle = - CSSPropertyParserHelpers::ConsumeAngle(range, nullptr, base::nullopt); + css_property_parser_helpers::ConsumeAngle(range, nullptr, base::nullopt); if (!start_angle) return oblique_identifier; if (!IsAngleWithinLimits(start_angle)) @@ -1390,7 +1404,7 @@ CSSValue* ConsumeFontStyle(CSSParserTokenRange& range, } CSSPrimitiveValue* end_angle = - CSSPropertyParserHelpers::ConsumeAngle(range, nullptr, base::nullopt); + css_property_parser_helpers::ConsumeAngle(range, nullptr, base::nullopt); if (!end_angle || !IsAngleWithinLimits(end_angle)) return nullptr; @@ -1404,7 +1418,7 @@ CSSIdentifierValue* ConsumeFontStretchKeywordOnly(CSSParserTokenRange& range) { const CSSParserToken& token = range.Peek(); if (token.Id() == CSSValueNormal || (token.Id() >= CSSValueUltraCondensed && token.Id() <= CSSValueUltraExpanded)) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); return nullptr; } @@ -1415,7 +1429,8 @@ CSSValue* ConsumeFontStretch(CSSParserTokenRange& range, return parsed_keyword; CSSPrimitiveValue* start_percent = - CSSPropertyParserHelpers::ConsumePercent(range, kValueRangeNonNegative); + css_property_parser_helpers::ConsumePercent(range, + kValueRangeNonNegative); if (!start_percent) return nullptr; @@ -1423,8 +1438,8 @@ CSSValue* ConsumeFontStretch(CSSParserTokenRange& range, if (parser_mode != kCSSFontFaceRuleMode || range.AtEnd()) return start_percent; - CSSPrimitiveValue* end_percent = - CSSPropertyParserHelpers::ConsumePercent(range, kValueRangeNonNegative); + CSSPrimitiveValue* end_percent = css_property_parser_helpers::ConsumePercent( + range, kValueRangeNonNegative); if (!end_percent) return nullptr; @@ -1435,7 +1450,7 @@ CSSValue* ConsumeFontWeight(CSSParserTokenRange& range, const CSSParserMode& parser_mode) { const CSSParserToken& token = range.Peek(); if (token.Id() >= CSSValueNormal && token.Id() <= CSSValueLighter) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); // Avoid consuming the first zero of font: 0/0; e.g. in the Acid3 test. In // font:0/0; the first zero is the font size, the second is the line height. @@ -1449,7 +1464,7 @@ CSSValue* ConsumeFontWeight(CSSParserTokenRange& range, return nullptr; CSSPrimitiveValue* start_weight = - CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeNonNegative); + css_property_parser_helpers::ConsumeNumber(range, kValueRangeNonNegative); if (!start_weight || start_weight->GetFloatValue() < 1 || start_weight->GetFloatValue() > 1000) return nullptr; @@ -1461,7 +1476,7 @@ CSSValue* ConsumeFontWeight(CSSParserTokenRange& range, return start_weight; CSSPrimitiveValue* end_weight = - CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeNonNegative); + css_property_parser_helpers::ConsumeNumber(range, kValueRangeNonNegative); if (!end_weight || end_weight->GetFloatValue() < 1 || end_weight->GetFloatValue() > 1000) return nullptr; @@ -1471,14 +1486,14 @@ CSSValue* ConsumeFontWeight(CSSParserTokenRange& range, CSSValue* ConsumeFontFeatureSettings(CSSParserTokenRange& range) { if (range.Peek().Id() == CSSValueNormal) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); CSSValueList* settings = CSSValueList::CreateCommaSeparated(); do { CSSFontFeatureValue* font_feature_value = ConsumeFontFeatureTag(range); if (!font_feature_value) return nullptr; settings->Append(*font_feature_value); - } while (CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(range)); + } while (css_property_parser_helpers::ConsumeCommaIncludingWhitespace(range)); return settings; } @@ -1504,7 +1519,7 @@ CSSFontFeatureValue* ConsumeFontFeatureTag(CSSParserTokenRange& range) { int tag_value = 1; // Feature tag values could follow: <integer> | on | off if (CSSPrimitiveValue* value = - CSSPropertyParserHelpers::ConsumeInteger(range, 0)) { + css_property_parser_helpers::ConsumeInteger(range, 0)) { tag_value = clampTo<int>(value->GetDoubleValue()); } else if (range.Peek().Id() == CSSValueOn || range.Peek().Id() == CSSValueOff) { @@ -1514,8 +1529,8 @@ CSSFontFeatureValue* ConsumeFontFeatureTag(CSSParserTokenRange& range) { } CSSIdentifierValue* ConsumeFontVariantCSS21(CSSParserTokenRange& range) { - return CSSPropertyParserHelpers::ConsumeIdent<CSSValueNormal, - CSSValueSmallCaps>(range); + return css_property_parser_helpers::ConsumeIdent<CSSValueNormal, + CSSValueSmallCaps>(range); } Vector<String> ParseGridTemplateAreasColumnNames(const String& grid_row_names) { @@ -1562,10 +1577,9 @@ Vector<String> ParseGridTemplateAreasColumnNames(const String& grid_row_names) { CSSValue* ConsumeGridBreadth(CSSParserTokenRange& range, CSSParserMode css_parser_mode) { const CSSParserToken& token = range.Peek(); - if (CSSPropertyParserHelpers::IdentMatches<CSSValueMinContent, - CSSValueMaxContent, CSSValueAuto>( - token.Id())) - return CSSPropertyParserHelpers::ConsumeIdent(range); + if (css_property_parser_helpers::IdentMatches< + CSSValueMinContent, CSSValueMaxContent, CSSValueAuto>(token.Id())) + return css_property_parser_helpers::ConsumeIdent(range); if (token.GetType() == kDimensionToken && token.GetUnitType() == CSSPrimitiveValue::UnitType::kFraction) { if (range.Peek().NumericValue() < 0) @@ -1574,19 +1588,20 @@ CSSValue* ConsumeGridBreadth(CSSParserTokenRange& range, range.ConsumeIncludingWhitespace().NumericValue(), CSSPrimitiveValue::UnitType::kFraction); } - return CSSPropertyParserHelpers::ConsumeLengthOrPercent( + return css_property_parser_helpers::ConsumeLengthOrPercent( range, css_parser_mode, kValueRangeNonNegative, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } CSSValue* ConsumeFitContent(CSSParserTokenRange& range, CSSParserMode css_parser_mode) { CSSParserTokenRange range_copy = range; CSSParserTokenRange args = - CSSPropertyParserHelpers::ConsumeFunction(range_copy); - CSSPrimitiveValue* length = CSSPropertyParserHelpers::ConsumeLengthOrPercent( - args, css_parser_mode, kValueRangeNonNegative, - CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + css_property_parser_helpers::ConsumeFunction(range_copy); + CSSPrimitiveValue* length = + css_property_parser_helpers::ConsumeLengthOrPercent( + args, css_parser_mode, kValueRangeNonNegative, + css_property_parser_helpers::UnitlessQuirk::kAllow); if (!length || !args.AtEnd()) return nullptr; range = range_copy; @@ -1628,18 +1643,18 @@ bool IsGridTrackFixedSized(const CSSValue& value) { CSSValue* ConsumeGridTrackSize(CSSParserTokenRange& range, CSSParserMode css_parser_mode) { const CSSParserToken& token = range.Peek(); - if (CSSPropertyParserHelpers::IdentMatches<CSSValueAuto>(token.Id())) - return CSSPropertyParserHelpers::ConsumeIdent(range); + if (css_property_parser_helpers::IdentMatches<CSSValueAuto>(token.Id())) + return css_property_parser_helpers::ConsumeIdent(range); if (token.FunctionId() == CSSValueMinmax) { CSSParserTokenRange range_copy = range; CSSParserTokenRange args = - CSSPropertyParserHelpers::ConsumeFunction(range_copy); + css_property_parser_helpers::ConsumeFunction(range_copy); CSSValue* min_track_breadth = ConsumeGridBreadth(args, css_parser_mode); if (!min_track_breadth || (min_track_breadth->IsPrimitiveValue() && ToCSSPrimitiveValue(min_track_breadth)->IsFlex()) || - !CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args)) + !css_property_parser_helpers::ConsumeCommaIncludingWhitespace(args)) return nullptr; CSSValue* max_track_breadth = ConsumeGridBreadth(args, css_parser_mode); if (!max_track_breadth || !args.AtEnd()) @@ -1657,17 +1672,20 @@ CSSValue* ConsumeGridTrackSize(CSSParserTokenRange& range, return ConsumeGridBreadth(range, css_parser_mode); } -CSSCustomIdentValue* ConsumeCustomIdentForGridLine(CSSParserTokenRange& range) { +CSSCustomIdentValue* ConsumeCustomIdentForGridLine( + CSSParserTokenRange& range, + const CSSParserContext& context) { if (range.Peek().Id() == CSSValueAuto || range.Peek().Id() == CSSValueSpan || range.Peek().Id() == CSSValueDefault) return nullptr; - return CSSPropertyParserHelpers::ConsumeCustomIdent(range); + return css_property_parser_helpers::ConsumeCustomIdent(range, context); } // Appends to the passed in CSSGridLineNamesValue if any, otherwise creates a // new one. CSSGridLineNamesValue* ConsumeGridLineNames( CSSParserTokenRange& range, + const CSSParserContext& context, CSSGridLineNamesValue* line_names = nullptr) { CSSParserTokenRange range_copy = range; if (range_copy.ConsumeIncludingWhitespace().GetType() != kLeftBracketToken) @@ -1675,7 +1693,7 @@ CSSGridLineNamesValue* ConsumeGridLineNames( if (!line_names) line_names = CSSGridLineNamesValue::Create(); while (CSSCustomIdentValue* line_name = - ConsumeCustomIdentForGridLine(range_copy)) + ConsumeCustomIdentForGridLine(range_copy, context)) line_names->Append(*line_name); if (range_copy.ConsumeIncludingWhitespace().GetType() != kRightBracketToken) return nullptr; @@ -1684,17 +1702,19 @@ CSSGridLineNamesValue* ConsumeGridLineNames( } bool ConsumeGridTrackRepeatFunction(CSSParserTokenRange& range, + const CSSParserContext& context, CSSParserMode css_parser_mode, CSSValueList& list, bool& is_auto_repeat, bool& all_tracks_are_fixed_sized) { - CSSParserTokenRange args = CSSPropertyParserHelpers::ConsumeFunction(range); + CSSParserTokenRange args = + css_property_parser_helpers::ConsumeFunction(range); // The number of repetitions for <auto-repeat> is not important at parsing // level because it will be computed later, let's set it to 1. size_t repetitions = 1; - is_auto_repeat = - CSSPropertyParserHelpers::IdentMatches<CSSValueAutoFill, CSSValueAutoFit>( - args.Peek().Id()); + is_auto_repeat = css_property_parser_helpers::IdentMatches<CSSValueAutoFill, + CSSValueAutoFit>( + args.Peek().Id()); CSSValueList* repeated_values; if (is_auto_repeat) { repeated_values = @@ -1702,16 +1722,16 @@ bool ConsumeGridTrackRepeatFunction(CSSParserTokenRange& range, } else { // TODO(rob.buis): a consumeIntegerRaw would be more efficient here. CSSPrimitiveValue* repetition = - CSSPropertyParserHelpers::ConsumePositiveInteger(args); + css_property_parser_helpers::ConsumePositiveInteger(args); if (!repetition) return false; repetitions = clampTo<size_t>(repetition->GetDoubleValue(), 0, kGridMaxTracks); repeated_values = CSSValueList::CreateSpaceSeparated(); } - if (!CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args)) + if (!css_property_parser_helpers::ConsumeCommaIncludingWhitespace(args)) return false; - CSSGridLineNamesValue* line_names = ConsumeGridLineNames(args); + CSSGridLineNamesValue* line_names = ConsumeGridLineNames(args, context); if (line_names) repeated_values->Append(*line_names); @@ -1724,7 +1744,7 @@ bool ConsumeGridTrackRepeatFunction(CSSParserTokenRange& range, all_tracks_are_fixed_sized = IsGridTrackFixedSized(*track_size); repeated_values->Append(*track_size); ++number_of_tracks; - line_names = ConsumeGridLineNames(args); + line_names = ConsumeGridLineNames(args, context); if (line_names) repeated_values->Append(*line_names); } @@ -1769,7 +1789,7 @@ bool ConsumeGridTemplateRowsAndAreasAndColumns(bool important, do { // Handle leading <custom-ident>*. bool has_previous_line_names = line_names; - line_names = ConsumeGridLineNames(range, line_names); + line_names = ConsumeGridLineNames(range, context, line_names); if (line_names && !has_previous_line_names) template_rows_value_list->Append(*line_names); @@ -1788,17 +1808,17 @@ bool ConsumeGridTemplateRowsAndAreasAndColumns(bool important, template_rows_value_list->Append(*value); // This will handle the trailing/leading <custom-ident>* in the grammar. - line_names = ConsumeGridLineNames(range); + line_names = ConsumeGridLineNames(range, context); if (line_names) template_rows_value_list->Append(*line_names); } while (!range.AtEnd() && !(range.Peek().GetType() == kDelimiterToken && range.Peek().Delimiter() == '/')); if (!range.AtEnd()) { - if (!CSSPropertyParserHelpers::ConsumeSlashIncludingWhitespace(range)) + if (!css_property_parser_helpers::ConsumeSlashIncludingWhitespace(range)) return false; template_columns = ConsumeGridTrackList( - range, context.Mode(), TrackListType::kGridTemplateNoRepeat); + range, context, context.Mode(), TrackListType::kGridTemplateNoRepeat); if (!template_columns || !range.AtEnd()) return false; } else { @@ -1811,30 +1831,31 @@ bool ConsumeGridTemplateRowsAndAreasAndColumns(bool important, return true; } -CSSValue* ConsumeGridLine(CSSParserTokenRange& range) { +CSSValue* ConsumeGridLine(CSSParserTokenRange& range, + const CSSParserContext& context) { if (range.Peek().Id() == CSSValueAuto) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); CSSIdentifierValue* span_value = nullptr; CSSCustomIdentValue* grid_line_name = nullptr; CSSPrimitiveValue* numeric_value = - CSSPropertyParserHelpers::ConsumeInteger(range); + css_property_parser_helpers::ConsumeInteger(range); if (numeric_value) { - grid_line_name = ConsumeCustomIdentForGridLine(range); - span_value = CSSPropertyParserHelpers::ConsumeIdent<CSSValueSpan>(range); + grid_line_name = ConsumeCustomIdentForGridLine(range, context); + span_value = css_property_parser_helpers::ConsumeIdent<CSSValueSpan>(range); } else { - span_value = CSSPropertyParserHelpers::ConsumeIdent<CSSValueSpan>(range); + span_value = css_property_parser_helpers::ConsumeIdent<CSSValueSpan>(range); if (span_value) { - numeric_value = CSSPropertyParserHelpers::ConsumeInteger(range); - grid_line_name = ConsumeCustomIdentForGridLine(range); + numeric_value = css_property_parser_helpers::ConsumeInteger(range); + grid_line_name = ConsumeCustomIdentForGridLine(range, context); if (!numeric_value) - numeric_value = CSSPropertyParserHelpers::ConsumeInteger(range); + numeric_value = css_property_parser_helpers::ConsumeInteger(range); } else { - grid_line_name = ConsumeCustomIdentForGridLine(range); + grid_line_name = ConsumeCustomIdentForGridLine(range, context); if (grid_line_name) { - numeric_value = CSSPropertyParserHelpers::ConsumeInteger(range); + numeric_value = css_property_parser_helpers::ConsumeInteger(range); span_value = - CSSPropertyParserHelpers::ConsumeIdent<CSSValueSpan>(range); + css_property_parser_helpers::ConsumeIdent<CSSValueSpan>(range); if (!span_value && !numeric_value) return grid_line_name; } else { @@ -1869,11 +1890,12 @@ CSSValue* ConsumeGridLine(CSSParserTokenRange& range) { } CSSValue* ConsumeGridTrackList(CSSParserTokenRange& range, + const CSSParserContext& context, CSSParserMode css_parser_mode, TrackListType track_list_type) { bool allow_grid_line_names = track_list_type != TrackListType::kGridAuto; CSSValueList* values = CSSValueList::CreateSpaceSeparated(); - CSSGridLineNamesValue* line_names = ConsumeGridLineNames(range); + CSSGridLineNamesValue* line_names = ConsumeGridLineNames(range, context); if (line_names) { if (!allow_grid_line_names) return nullptr; @@ -1888,8 +1910,8 @@ CSSValue* ConsumeGridTrackList(CSSParserTokenRange& range, if (range.Peek().FunctionId() == CSSValueRepeat) { if (!allow_repeat) return nullptr; - if (!ConsumeGridTrackRepeatFunction(range, css_parser_mode, *values, - is_auto_repeat, + if (!ConsumeGridTrackRepeatFunction(range, context, css_parser_mode, + *values, is_auto_repeat, all_tracks_are_fixed_sized)) return nullptr; if (is_auto_repeat && seen_auto_repeat) @@ -1904,7 +1926,7 @@ CSSValue* ConsumeGridTrackList(CSSParserTokenRange& range, } if (seen_auto_repeat && !all_tracks_are_fixed_sized) return nullptr; - line_names = ConsumeGridLineNames(range); + line_names = ConsumeGridLineNames(range, context); if (line_names) { if (!allow_grid_line_names) return nullptr; @@ -1918,7 +1940,7 @@ bool ParseGridTemplateAreasRow(const String& grid_row_names, NamedGridAreaMap& grid_area_map, const size_t row_count, size_t& column_count) { - if (grid_row_names.IsEmpty() || grid_row_names.ContainsOnlyWhitespace()) + if (grid_row_names.ContainsOnlyWhitespaceOrEmpty()) return false; Vector<String> column_names = @@ -1983,27 +2005,29 @@ bool ParseGridTemplateAreasRow(const String& grid_row_names, } CSSValue* ConsumeGridTemplatesRowsOrColumns(CSSParserTokenRange& range, + const CSSParserContext& context, CSSParserMode css_parser_mode) { if (range.Peek().Id() == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return ConsumeGridTrackList(range, css_parser_mode, + return css_property_parser_helpers::ConsumeIdent(range); + return ConsumeGridTrackList(range, context, css_parser_mode, TrackListType::kGridTemplate); } bool ConsumeGridItemPositionShorthand(bool important, CSSParserTokenRange& range, + const CSSParserContext& context, CSSValue*& start_value, CSSValue*& end_value) { // Input should be nullptrs. DCHECK(!start_value); DCHECK(!end_value); - start_value = ConsumeGridLine(range); + start_value = ConsumeGridLine(range, context); if (!start_value) return false; - if (CSSPropertyParserHelpers::ConsumeSlashIncludingWhitespace(range)) { - end_value = ConsumeGridLine(range); + if (css_property_parser_helpers::ConsumeSlashIncludingWhitespace(range)) { + end_value = ConsumeGridLine(range, context); if (!end_value) return false; } else { @@ -2028,7 +2052,8 @@ bool ConsumeGridTemplateShorthand(bool important, DCHECK_EQ(gridTemplateShorthand().length(), 3u); CSSParserTokenRange range_copy = range; - template_rows = CSSPropertyParserHelpers::ConsumeIdent<CSSValueNone>(range); + template_rows = + css_property_parser_helpers::ConsumeIdent<CSSValueNone>(range); // 1- 'none' case. if (template_rows && range.AtEnd()) { @@ -2040,14 +2065,15 @@ bool ConsumeGridTemplateShorthand(bool important, // 2- <grid-template-rows> / <grid-template-columns> if (!template_rows) { - template_rows = ConsumeGridTrackList(range, context.Mode(), + template_rows = ConsumeGridTrackList(range, context, context.Mode(), TrackListType::kGridTemplate); } if (template_rows) { - if (!CSSPropertyParserHelpers::ConsumeSlashIncludingWhitespace(range)) + if (!css_property_parser_helpers::ConsumeSlashIncludingWhitespace(range)) return false; - template_columns = ConsumeGridTemplatesRowsOrColumns(range, context.Mode()); + template_columns = + ConsumeGridTemplatesRowsOrColumns(range, context, context.Mode()); if (!template_columns || !range.AtEnd()) return false; @@ -2131,7 +2157,7 @@ CSSValue* ConsumePath(CSSParserTokenRange& range) { CSSParserTokenRange function_range = range; CSSParserTokenRange function_args = - CSSPropertyParserHelpers::ConsumeFunction(function_range); + css_property_parser_helpers::ConsumeFunction(function_range); if (function_args.Peek().GetType() != kStringToken) return nullptr; @@ -2156,27 +2182,27 @@ CSSValue* ConsumeRay(CSSParserTokenRange& range, DCHECK_EQ(range.Peek().FunctionId(), CSSValueRay); CSSParserTokenRange function_range = range; CSSParserTokenRange function_args = - CSSPropertyParserHelpers::ConsumeFunction(function_range); + css_property_parser_helpers::ConsumeFunction(function_range); CSSPrimitiveValue* angle = nullptr; CSSIdentifierValue* size = nullptr; CSSIdentifierValue* contain = nullptr; while (!function_args.AtEnd()) { if (!angle) { - angle = CSSPropertyParserHelpers::ConsumeAngle( + angle = css_property_parser_helpers::ConsumeAngle( function_args, &context, base::Optional<WebFeature>()); if (angle) continue; } if (!size) { - size = CSSPropertyParserHelpers::ConsumeIdent< + size = css_property_parser_helpers::ConsumeIdent< CSSValueClosestSide, CSSValueClosestCorner, CSSValueFarthestSide, CSSValueFarthestCorner, CSSValueSides>(function_args); if (size) continue; } if (RuntimeEnabledFeatures::CSSOffsetPathRayContainEnabled() && !contain) { - contain = CSSPropertyParserHelpers::ConsumeIdent<CSSValueContain>( + contain = css_property_parser_helpers::ConsumeIdent<CSSValueContain>( function_args); if (contain) continue; @@ -2192,32 +2218,32 @@ CSSValue* ConsumeRay(CSSParserTokenRange& range, CSSValue* ConsumeMaxWidthOrHeight( CSSParserTokenRange& range, const CSSParserContext& context, - CSSPropertyParserHelpers::UnitlessQuirk unitless) { + css_property_parser_helpers::UnitlessQuirk unitless) { if (range.Peek().Id() == CSSValueNone || ValidWidthOrHeightKeyword(range.Peek().Id(), context)) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeLengthOrPercent( + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative, unitless); } CSSValue* ConsumeWidthOrHeight( CSSParserTokenRange& range, const CSSParserContext& context, - CSSPropertyParserHelpers::UnitlessQuirk unitless) { + css_property_parser_helpers::UnitlessQuirk unitless) { if (range.Peek().Id() == CSSValueAuto || ValidWidthOrHeightKeyword(range.Peek().Id(), context)) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeLengthOrPercent( + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative, unitless); } CSSValue* ConsumeMarginOrOffset( CSSParserTokenRange& range, CSSParserMode css_parser_mode, - CSSPropertyParserHelpers::UnitlessQuirk unitless) { + css_property_parser_helpers::UnitlessQuirk unitless) { if (range.Peek().Id() == CSSValueAuto) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeLengthOrPercent( + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeLengthOrPercent( range, css_parser_mode, kValueRangeAll, unitless); } @@ -2239,23 +2265,23 @@ CSSValue* ConsumeOffsetPath(CSSParserTokenRange& range, CSSValue* ConsumePathOrNone(CSSParserTokenRange& range) { CSSValueID id = range.Peek().Id(); if (id == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); return ConsumePath(range); } CSSValue* ConsumeOffsetRotate(CSSParserTokenRange& range, const CSSParserContext& context) { - CSSValue* angle = CSSPropertyParserHelpers::ConsumeAngle( + CSSValue* angle = css_property_parser_helpers::ConsumeAngle( range, &context, base::Optional<WebFeature>()); CSSValue* keyword = - CSSPropertyParserHelpers::ConsumeIdent<CSSValueAuto, CSSValueReverse>( + css_property_parser_helpers::ConsumeIdent<CSSValueAuto, CSSValueReverse>( range); if (!angle && !keyword) return nullptr; if (!angle) { - angle = CSSPropertyParserHelpers::ConsumeAngle( + angle = css_property_parser_helpers::ConsumeAngle( range, &context, base::Optional<WebFeature>()); } @@ -2275,7 +2301,7 @@ bool ConsumeRadii(CSSValue* horizontal_radii[4], unsigned i = 0; for (; i < 4 && !range.AtEnd() && range.Peek().GetType() != kDelimiterToken; ++i) { - horizontal_radii[i] = CSSPropertyParserHelpers::ConsumeLengthOrPercent( + horizontal_radii[i] = css_property_parser_helpers::ConsumeLengthOrPercent( range, css_parser_mode, kValueRangeNonNegative); if (!horizontal_radii[i]) return false; @@ -2289,16 +2315,16 @@ bool ConsumeRadii(CSSValue* horizontal_radii[4], vertical_radii[0] = horizontal_radii[1]; horizontal_radii[1] = nullptr; } else { - CSSPropertyParserHelpers::Complete4Sides(horizontal_radii); + css_property_parser_helpers::Complete4Sides(horizontal_radii); for (unsigned i = 0; i < 4; ++i) vertical_radii[i] = horizontal_radii[i]; return true; } } else { - if (!CSSPropertyParserHelpers::ConsumeSlashIncludingWhitespace(range)) + if (!css_property_parser_helpers::ConsumeSlashIncludingWhitespace(range)) return false; for (i = 0; i < 4 && !range.AtEnd(); ++i) { - vertical_radii[i] = CSSPropertyParserHelpers::ConsumeLengthOrPercent( + vertical_radii[i] = css_property_parser_helpers::ConsumeLengthOrPercent( range, css_parser_mode, kValueRangeNonNegative); if (!vertical_radii[i]) return false; @@ -2306,8 +2332,8 @@ bool ConsumeRadii(CSSValue* horizontal_radii[4], if (!vertical_radii[0] || !range.AtEnd()) return false; } - CSSPropertyParserHelpers::Complete4Sides(horizontal_radii); - CSSPropertyParserHelpers::Complete4Sides(vertical_radii); + css_property_parser_helpers::Complete4Sides(horizontal_radii); + css_property_parser_helpers::Complete4Sides(vertical_radii); return true; } @@ -2319,7 +2345,7 @@ CSSValue* ConsumeBasicShape(CSSParserTokenRange& range, CSSValueID id = range.Peek().FunctionId(); CSSParserTokenRange range_copy = range; CSSParserTokenRange args = - CSSPropertyParserHelpers::ConsumeFunction(range_copy); + css_property_parser_helpers::ConsumeFunction(range_copy); if (id == CSSValueCircle) shape = ConsumeBasicShapeCircle(args, context); else if (id == CSSValueEllipse) @@ -2339,14 +2365,13 @@ CSSValue* ConsumeBasicShape(CSSParserTokenRange& range, CSSValue* ConsumeTextDecorationLine(CSSParserTokenRange& range) { CSSValueID id = range.Peek().Id(); if (id == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); CSSValueList* list = CSSValueList::CreateSpaceSeparated(); while (true) { - CSSIdentifierValue* ident = - CSSPropertyParserHelpers::ConsumeIdent<CSSValueBlink, CSSValueUnderline, - CSSValueOverline, - CSSValueLineThrough>(range); + CSSIdentifierValue* ident = css_property_parser_helpers::ConsumeIdent< + CSSValueBlink, CSSValueUnderline, CSSValueOverline, + CSSValueLineThrough>(range); if (!ident) break; if (list->HasValue(*ident)) @@ -2365,7 +2390,8 @@ CSSValue* ConsumeTransformValue(CSSParserTokenRange& range, CSSValueID function_id = range.Peek().FunctionId(); if (function_id == CSSValueInvalid) return nullptr; - CSSParserTokenRange args = CSSPropertyParserHelpers::ConsumeFunction(range); + CSSParserTokenRange args = + css_property_parser_helpers::ConsumeFunction(range); if (args.AtEnd()) return nullptr; CSSFunctionValue* transform_value = CSSFunctionValue::Create(function_id); @@ -2378,14 +2404,14 @@ CSSValue* ConsumeTransformValue(CSSParserTokenRange& range, case CSSValueSkewX: case CSSValueSkewY: case CSSValueSkew: - parsed_value = CSSPropertyParserHelpers::ConsumeAngle( + parsed_value = css_property_parser_helpers::ConsumeAngle( args, &context, WebFeature::kUnitlessZeroAngleTransform); if (!parsed_value) return nullptr; if (function_id == CSSValueSkew && - CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args)) { + css_property_parser_helpers::ConsumeCommaIncludingWhitespace(args)) { transform_value->Append(*parsed_value); - parsed_value = CSSPropertyParserHelpers::ConsumeAngle( + parsed_value = css_property_parser_helpers::ConsumeAngle( args, &context, WebFeature::kUnitlessZeroAngleTransform); if (!parsed_value) return nullptr; @@ -2396,14 +2422,14 @@ CSSValue* ConsumeTransformValue(CSSParserTokenRange& range, case CSSValueScaleZ: case CSSValueScale: parsed_value = - CSSPropertyParserHelpers::ConsumeNumber(args, kValueRangeAll); + css_property_parser_helpers::ConsumeNumber(args, kValueRangeAll); if (!parsed_value) return nullptr; if (function_id == CSSValueScale && - CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args)) { + css_property_parser_helpers::ConsumeCommaIncludingWhitespace(args)) { transform_value->Append(*parsed_value); parsed_value = - CSSPropertyParserHelpers::ConsumeNumber(args, kValueRangeAll); + css_property_parser_helpers::ConsumeNumber(args, kValueRangeAll); if (!parsed_value) return nullptr; } @@ -2417,21 +2443,21 @@ CSSValue* ConsumeTransformValue(CSSParserTokenRange& range, case CSSValueTranslateX: case CSSValueTranslateY: case CSSValueTranslate: - parsed_value = CSSPropertyParserHelpers::ConsumeLengthOrPercent( + parsed_value = css_property_parser_helpers::ConsumeLengthOrPercent( args, context.Mode(), kValueRangeAll); if (!parsed_value) return nullptr; if (function_id == CSSValueTranslate && - CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args)) { + css_property_parser_helpers::ConsumeCommaIncludingWhitespace(args)) { transform_value->Append(*parsed_value); - parsed_value = CSSPropertyParserHelpers::ConsumeLengthOrPercent( + parsed_value = css_property_parser_helpers::ConsumeLengthOrPercent( args, context.Mode(), kValueRangeAll); if (!parsed_value) return nullptr; } break; case CSSValueTranslateZ: - parsed_value = CSSPropertyParserHelpers::ConsumeLength( + parsed_value = css_property_parser_helpers::ConsumeLength( args, context.Mode(), kValueRangeAll); break; case CSSValueMatrix: @@ -2447,10 +2473,10 @@ CSSValue* ConsumeTransformValue(CSSParserTokenRange& range, break; case CSSValueRotate3d: if (!ConsumeNumbers(args, transform_value, 3) || - !CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args)) { + !css_property_parser_helpers::ConsumeCommaIncludingWhitespace(args)) { return nullptr; } - parsed_value = CSSPropertyParserHelpers::ConsumeAngle( + parsed_value = css_property_parser_helpers::ConsumeAngle( args, &context, WebFeature::kUnitlessZeroAngleTransform); if (!parsed_value) return nullptr; @@ -2473,7 +2499,7 @@ CSSValue* ConsumeTransformList(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext& local_context) { if (range.Peek().Id() == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); CSSValueList* list = CSSValueList::CreateSpaceSeparated(); do { @@ -2487,12 +2513,13 @@ CSSValue* ConsumeTransformList(CSSParserTokenRange& range, return list; } -CSSValue* ConsumeTransitionProperty(CSSParserTokenRange& range) { +CSSValue* ConsumeTransitionProperty(CSSParserTokenRange& range, + const CSSParserContext& context) { const CSSParserToken& token = range.Peek(); if (token.GetType() != kIdentToken) return nullptr; if (token.Id() == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); CSSPropertyID unresolved_property = token.ParseAsUnresolvedCSSPropertyID(); if (unresolved_property != CSSPropertyInvalid && unresolved_property != CSSPropertyVariable) { @@ -2503,7 +2530,7 @@ CSSValue* ConsumeTransitionProperty(CSSParserTokenRange& range) { range.ConsumeIncludingWhitespace(); return CSSCustomIdentValue::Create(unresolved_property); } - return CSSPropertyParserHelpers::ConsumeCustomIdent(range); + return css_property_parser_helpers::ConsumeCustomIdent(range, context); } bool IsValidPropertyList(const CSSValueList& value_list) { @@ -2524,39 +2551,40 @@ CSSValue* ConsumeBorderColorSide(CSSParserTokenRange& range, bool allow_quirky_colors = IsQuirksModeBehavior(context.Mode()) && (shorthand == CSSPropertyInvalid || shorthand == CSSPropertyBorderColor); - return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode(), - allow_quirky_colors); + return css_property_parser_helpers::ConsumeColor(range, context.Mode(), + allow_quirky_colors); } -CSSValue* ConsumeBorderWidth(CSSParserTokenRange& range, - CSSParserMode css_parser_mode, - CSSPropertyParserHelpers::UnitlessQuirk unitless) { - return CSSPropertyParserHelpers::ConsumeLineWidth(range, css_parser_mode, - unitless); +CSSValue* ConsumeBorderWidth( + CSSParserTokenRange& range, + CSSParserMode css_parser_mode, + css_property_parser_helpers::UnitlessQuirk unitless) { + return css_property_parser_helpers::ConsumeLineWidth(range, css_parser_mode, + unitless); } CSSValue* ParseSpacing(CSSParserTokenRange& range, const CSSParserContext& context) { if (range.Peek().Id() == CSSValueNormal) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); // TODO(timloh): allow <percentage>s in word-spacing. - return CSSPropertyParserHelpers::ConsumeLength( + return css_property_parser_helpers::ConsumeLength( range, context.Mode(), kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + css_property_parser_helpers::UnitlessQuirk::kAllow); } CSSValue* ParsePaintStroke(CSSParserTokenRange& range, const CSSParserContext& context) { if (range.Peek().Id() == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); - CSSURIValue* url = CSSPropertyParserHelpers::ConsumeUrl(range, &context); + return css_property_parser_helpers::ConsumeIdent(range); + CSSURIValue* url = css_property_parser_helpers::ConsumeUrl(range, &context); if (url) { CSSValue* parsed_value = nullptr; if (range.Peek().Id() == CSSValueNone) { - parsed_value = CSSPropertyParserHelpers::ConsumeIdent(range); + parsed_value = css_property_parser_helpers::ConsumeIdent(range); } else { parsed_value = - CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); + css_property_parser_helpers::ConsumeColor(range, context.Mode()); } if (parsed_value) { CSSValueList* values = CSSValueList::CreateSpaceSeparated(); @@ -2566,8 +2594,8 @@ CSSValue* ParsePaintStroke(CSSParserTokenRange& range, } return url; } - return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); + return css_property_parser_helpers::ConsumeColor(range, context.Mode()); } -} // namespace CSSParsingUtils +} // namespace css_parsing_utils } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/css_parsing_utils.h b/chromium/third_party/blink/renderer/core/css/properties/css_parsing_utils.h index 44358b05e8e..c7cbb4c5316 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/css_parsing_utils.h +++ b/chromium/third_party/blink/renderer/core/css/properties/css_parsing_utils.h @@ -24,7 +24,7 @@ class CSSValue; class CSSValueList; class StylePropertyShorthand; -namespace CSSParsingUtils { +namespace css_parsing_utils { enum class AllowInsetAndSpread { kAllow, kForbid }; enum class AllowTextValue { kAllow, kForbid }; @@ -78,7 +78,7 @@ CSSValue* ConsumeBackgroundComposite(CSSParserTokenRange&); CSSValue* ConsumeMaskSourceType(CSSParserTokenRange&); bool ConsumeBackgroundPosition(CSSParserTokenRange&, const CSSParserContext&, - CSSPropertyParserHelpers::UnitlessQuirk, + css_property_parser_helpers::UnitlessQuirk, CSSValue*& result_x, CSSValue*& result_y); CSSValue* ConsumePrefixedBackgroundBox(CSSParserTokenRange&, AllowTextValue); @@ -137,12 +137,13 @@ CSSValue* ConsumeColumnWidth(CSSParserTokenRange&); bool ConsumeColumnWidthOrCount(CSSParserTokenRange&, CSSValue*&, CSSValue*&); CSSValue* ConsumeGapLength(CSSParserTokenRange&, const CSSParserContext&); -CSSValue* ConsumeCounter(CSSParserTokenRange&, int); +CSSValue* ConsumeCounter(CSSParserTokenRange&, const CSSParserContext&, int); -CSSValue* ConsumeFontSize(CSSParserTokenRange&, - CSSParserMode, - CSSPropertyParserHelpers::UnitlessQuirk = - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); +CSSValue* ConsumeFontSize( + CSSParserTokenRange&, + CSSParserMode, + css_property_parser_helpers::UnitlessQuirk = + css_property_parser_helpers::UnitlessQuirk::kForbid); CSSValue* ConsumeLineHeight(CSSParserTokenRange&, CSSParserMode); @@ -158,8 +159,9 @@ CSSValue* ConsumeFontFeatureSettings(CSSParserTokenRange&); cssvalue::CSSFontFeatureValue* ConsumeFontFeatureTag(CSSParserTokenRange&); CSSIdentifierValue* ConsumeFontVariantCSS21(CSSParserTokenRange&); -CSSValue* ConsumeGridLine(CSSParserTokenRange&); +CSSValue* ConsumeGridLine(CSSParserTokenRange&, const CSSParserContext&); CSSValue* ConsumeGridTrackList(CSSParserTokenRange&, + const CSSParserContext&, CSSParserMode, TrackListType); bool ParseGridTemplateAreasRow(const WTF::String& grid_row_names, @@ -167,9 +169,11 @@ bool ParseGridTemplateAreasRow(const WTF::String& grid_row_names, const size_t row_count, size_t& column_count); CSSValue* ConsumeGridTemplatesRowsOrColumns(CSSParserTokenRange&, + const CSSParserContext&, CSSParserMode); bool ConsumeGridItemPositionShorthand(bool important, CSSParserTokenRange&, + const CSSParserContext&, CSSValue*& start_value, CSSValue*& end_value); bool ConsumeGridTemplateShorthand(bool important, @@ -190,17 +194,17 @@ bool ConsumeFromColumnOrPageBreakInside(CSSParserTokenRange&, CSSValueID&); CSSValue* ConsumeMaxWidthOrHeight( CSSParserTokenRange&, const CSSParserContext&, - CSSPropertyParserHelpers::UnitlessQuirk = - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk = + css_property_parser_helpers::UnitlessQuirk::kForbid); CSSValue* ConsumeWidthOrHeight( CSSParserTokenRange&, const CSSParserContext&, - CSSPropertyParserHelpers::UnitlessQuirk = - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk = + css_property_parser_helpers::UnitlessQuirk::kForbid); CSSValue* ConsumeMarginOrOffset(CSSParserTokenRange&, CSSParserMode, - CSSPropertyParserHelpers::UnitlessQuirk); + css_property_parser_helpers::UnitlessQuirk); CSSValue* ConsumeOffsetPath(CSSParserTokenRange&, const CSSParserContext&); CSSValue* ConsumePathOrNone(CSSParserTokenRange&); CSSValue* ConsumeOffsetRotate(CSSParserTokenRange&, const CSSParserContext&); @@ -220,7 +224,8 @@ CSSValue* ConsumeTransformValue(CSSParserTokenRange&, CSSValue* ConsumeTransformList(CSSParserTokenRange&, const CSSParserContext&, const CSSParserLocalContext&); -CSSValue* ConsumeTransitionProperty(CSSParserTokenRange&); +CSSValue* ConsumeTransitionProperty(CSSParserTokenRange&, + const CSSParserContext&); bool IsValidPropertyList(const CSSValueList&); CSSValue* ConsumeBorderColorSide(CSSParserTokenRange&, @@ -228,7 +233,7 @@ CSSValue* ConsumeBorderColorSide(CSSParserTokenRange&, const CSSParserLocalContext&); CSSValue* ConsumeBorderWidth(CSSParserTokenRange&, CSSParserMode, - CSSPropertyParserHelpers::UnitlessQuirk); + css_property_parser_helpers::UnitlessQuirk); CSSValue* ParsePaintStroke(CSSParserTokenRange&, const CSSParserContext&); CSSValue* ParseSpacing(CSSParserTokenRange&, const CSSParserContext&); @@ -250,11 +255,11 @@ CSSValue* ConsumePositionLonghand(CSSParserTokenRange& range, return CSSPrimitiveValue::Create(percent, CSSPrimitiveValue::UnitType::kPercentage); } - return CSSPropertyParserHelpers::ConsumeLengthOrPercent( + return css_property_parser_helpers::ConsumeLengthOrPercent( range, css_parser_mode, kValueRangeAll); } -} // namespace CSSParsingUtils +} // namespace css_parsing_utils } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTIES_CSS_PARSING_UTILS_H_ diff --git a/chromium/third_party/blink/renderer/core/css/properties/css_property_ref.cc b/chromium/third_party/blink/renderer/core/css/properties/css_property_ref.cc new file mode 100644 index 00000000000..ebe0cc4859f --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/css_property_ref.cc @@ -0,0 +1,35 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/css_property_ref.h" + +#include "third_party/blink/renderer/core/dom/document.h" + +namespace blink { + +CSSPropertyRef::CSSPropertyRef(const String& name, const Document& document) + : property_id_(unresolvedCSSPropertyID(name)) { + if (property_id_ == CSSPropertyVariable) + custom_property_ = CustomProperty(AtomicString(name), document); +} + +CSSPropertyRef::CSSPropertyRef(const CSSPropertyName& name, + const Document& document) + : property_id_(name.Id()) { + DCHECK_NE(name.Id(), CSSPropertyInvalid); + if (property_id_ == CSSPropertyVariable) + custom_property_ = CustomProperty(name.ToAtomicString(), document); +} + +CSSPropertyRef::CSSPropertyRef(const CSSProperty& property) + : property_id_(property.PropertyID()) { + if (property.PropertyID() == CSSPropertyVariable) { + if (!Variable::IsStaticInstance(property)) + custom_property_ = static_cast<const CustomProperty&>(property); + else + property_id_ = CSSPropertyInvalid; + } +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/css_property_ref.h b/chromium/third_party/blink/renderer/core/css/properties/css_property_ref.h new file mode 100644 index 00000000000..557414d776f --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/css_property_ref.h @@ -0,0 +1,78 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTIES_CSS_PROPERTY_REF_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTIES_CSS_PROPERTY_REF_H_ + +#include "third_party/blink/renderer/core/css/properties/longhands/custom_property.h" + +namespace blink { + +class CSSPropertyName; +class Document; + +// Use this class to acquire a reference to a CSSProperty instance. The +// reference returned by GetProperty() may point to the embedded CustomProperty +// object, hence this reference is only valid for the lifetime of the +// CSSPropertyRef object. +// +// Usage: +// +// CSSPropertyRef ref(some_string, document); +// +// if (ref.IsValid()) { +// LOG(INFO) << ref.GetProperty().GetName(); +// } +// +// Note that any CSSPropertyRef constructor may produce an invalid +// CSSPropertyRef (e.g. if a non-existent property name is provided), so be +// sure to always check IsValid() before calling GetProperty(). +class CORE_EXPORT CSSPropertyRef { + DISALLOW_NEW(); + + public: + // Look up (or create) a CSSProperty. + // + // If the incoming 'name' is not a CSS property, the CSSPropertyRef is + // invalid. + CSSPropertyRef(const String& name, const Document&); + + // Like above, but will never produce an invalid CSSPropertyRef. + CSSPropertyRef(const CSSPropertyName&, const Document&); + + // If you already have a CSSProperty& object, you may use it to get + // a CSSPropertyRef again. + // + // Note that the CSSProperty& returned by GetProperty() may be different + // than the incoming CSSProperty&. + // + // Note also that this CSSPropertyRef is invalid if the incoming CSSProperty& + // is the static Variable instance. + CSSPropertyRef(const CSSProperty&); + + bool IsValid() const { return property_id_ != CSSPropertyInvalid; } + + const CSSProperty& GetProperty() const { + DCHECK(IsValid()); + if (property_id_ == CSSPropertyVariable) + return custom_property_; + return CSSProperty::Get(resolveCSSPropertyID(property_id_)); + } + + const CSSUnresolvedProperty& GetUnresolvedProperty() const { + if (isPropertyAlias(property_id_)) + return *CSSUnresolvedProperty::GetAliasProperty(property_id_); + return GetProperty(); + } + + void Trace(blink::Visitor* visitor) { visitor->Trace(custom_property_); } + + private: + CSSPropertyID property_id_; + CustomProperty custom_property_; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTIES_CSS_PROPERTY_REF_H_ diff --git a/chromium/third_party/blink/renderer/core/css/properties/css_property_ref_test.cc b/chromium/third_party/blink/renderer/core/css/properties/css_property_ref_test.cc new file mode 100644 index 00000000000..42c03ced91e --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/css_property_ref_test.cc @@ -0,0 +1,99 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/css_property_ref.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/renderer/core/css/css_property_name.h" +#include "third_party/blink/renderer/core/css/css_test_helpers.h" +#include "third_party/blink/renderer/core/testing/page_test_base.h" + +namespace blink { + +using namespace css_test_helpers; + +namespace { + +class CSSPropertyRefTest : public PageTestBase {}; + +} // namespace + +TEST_F(CSSPropertyRefTest, LookupUnregistred) { + CSSPropertyRef ref("--x", GetDocument()); + EXPECT_TRUE(ref.IsValid()); + EXPECT_EQ(CSSPropertyVariable, ref.GetProperty().PropertyID()); +} + +TEST_F(CSSPropertyRefTest, LookupRegistered) { + RegisterProperty(GetDocument(), "--x", "<length>", "42px", false); + CSSPropertyRef ref("--x", GetDocument()); + EXPECT_TRUE(ref.IsValid()); + EXPECT_EQ(CSSPropertyVariable, ref.GetProperty().PropertyID()); +} + +TEST_F(CSSPropertyRefTest, LookupStandard) { + CSSPropertyRef ref("font-size", GetDocument()); + EXPECT_TRUE(ref.IsValid()); + EXPECT_EQ(CSSPropertyFontSize, ref.GetProperty().PropertyID()); +} + +TEST_F(CSSPropertyRefTest, IsValid) { + CSSPropertyRef ref("nosuchproperty", GetDocument()); + EXPECT_FALSE(ref.IsValid()); +} + +TEST_F(CSSPropertyRefTest, FromCustomProperty) { + CustomProperty custom(AtomicString("--x"), GetDocument()); + CSSPropertyRef ref(custom); + EXPECT_TRUE(ref.IsValid()); + EXPECT_EQ(CSSPropertyVariable, ref.GetProperty().PropertyID()); +} + +TEST_F(CSSPropertyRefTest, FromStandardProperty) { + CSSPropertyRef ref(GetCSSPropertyFontSize()); + EXPECT_TRUE(ref.IsValid()); + EXPECT_EQ(CSSPropertyFontSize, ref.GetProperty().PropertyID()); +} + +TEST_F(CSSPropertyRefTest, FromStaticVariableInstance) { + CSSPropertyRef ref(GetCSSPropertyVariable()); + EXPECT_FALSE(ref.IsValid()); +} + +TEST_F(CSSPropertyRefTest, GetUnresolvedPropertyStandard) { + CSSPropertyRef ref("font-size", GetDocument()); + EXPECT_TRUE(ref.GetUnresolvedProperty().IsResolvedProperty()); +} + +TEST_F(CSSPropertyRefTest, GetUnresolvedPropertyCustom) { + CSSPropertyRef ref("--x", GetDocument()); + EXPECT_TRUE(ref.GetUnresolvedProperty().IsResolvedProperty()); +} + +TEST_F(CSSPropertyRefTest, GetUnresolvedPropertyAlias) { + // -webkit-transform is an arbitrarily chosen alias. + CSSPropertyRef ref("-webkit-transform", GetDocument()); + const auto& unresolved = ref.GetUnresolvedProperty(); + EXPECT_FALSE(unresolved.IsResolvedProperty()); + EXPECT_EQ("-webkit-transform", unresolved.GetPropertyNameString()); +} + +TEST_F(CSSPropertyRefTest, GetResolvedPropertyAlias) { + // -webkit-transform is an arbitrarily chosen alias. + CSSPropertyRef ref("-webkit-transform", GetDocument()); + EXPECT_TRUE(ref.GetProperty().IsResolvedProperty()); + EXPECT_EQ("transform", ref.GetProperty().GetPropertyNameString()); +} + +TEST_F(CSSPropertyRefTest, FromCSSPropertyNameCustom) { + RegisterProperty(GetDocument(), "--x", "<length>", "42px", false); + CSSPropertyRef ref(CSSPropertyName("--x"), GetDocument()); + EXPECT_EQ(CSSPropertyVariable, ref.GetProperty().PropertyID()); +} + +TEST_F(CSSPropertyRefTest, FromCSSPropertyNameStandard) { + CSSPropertyRef ref(CSSPropertyName(CSSPropertyFontSize), GetDocument()); + EXPECT_EQ(CSSPropertyFontSize, ref.GetProperty().PropertyID()); +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/align_content_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/align_content_custom.cc index 2c2215420c2..3ffafa147fc 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/align_content_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/align_content_custom.cc @@ -9,14 +9,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* AlignContent::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeContentDistributionOverflowPosition( - range, CSSParsingUtils::IsContentPositionKeyword); + return css_parsing_utils::ConsumeContentDistributionOverflowPosition( + range, css_parsing_utils::IsContentPositionKeyword); } const CSSValue* AlignContent::CSSValueFromComputedStyleInternal( @@ -30,5 +30,5 @@ const CSSValue* AlignContent::CSSValueFromComputedStyleInternal( style.AlignContent()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/align_items_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/align_items_custom.cc index fe5538132b2..e77d25d8739 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/align_items_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/align_items_custom.cc @@ -10,17 +10,18 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* AlignItems::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { // align-items property does not allow the 'auto' value. - if (CSSPropertyParserHelpers::IdentMatches<CSSValueAuto>(range.Peek().Id())) + if (css_property_parser_helpers::IdentMatches<CSSValueAuto>( + range.Peek().Id())) return nullptr; - return CSSParsingUtils::ConsumeSelfPositionOverflowPosition( - range, CSSParsingUtils::IsSelfPositionKeyword); + return css_parsing_utils::ConsumeSelfPositionOverflowPosition( + range, css_parsing_utils::IsSelfPositionKeyword); } const CSSValue* AlignItems::CSSValueFromComputedStyleInternal( @@ -33,5 +34,5 @@ const CSSValue* AlignItems::CSSValueFromComputedStyleInternal( style.AlignItems()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/align_self_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/align_self_custom.cc index 9fc2ec591a4..9565047cd11 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/align_self_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/align_self_custom.cc @@ -9,14 +9,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* AlignSelf::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeSelfPositionOverflowPosition( - range, CSSParsingUtils::IsSelfPositionKeyword); + return css_parsing_utils::ConsumeSelfPositionOverflowPosition( + range, css_parsing_utils::IsSelfPositionKeyword); } const CSSValue* AlignSelf::CSSValueFromComputedStyleInternal( @@ -29,5 +29,5 @@ const CSSValue* AlignSelf::CSSValueFromComputedStyleInternal( style.AlignSelf()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/alignment_baseline_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/alignment_baseline_custom.cc index f725b6c3ada..6ee34f480ea 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/alignment_baseline_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/alignment_baseline_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/alignment_baseline.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* AlignmentBaseline::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* AlignmentBaseline::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(svg_style.AlignmentBaseline()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_delay_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_delay_custom.cc index 3bfcd9ac19a..06dfd297b21 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_delay_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_delay_custom.cc @@ -7,17 +7,17 @@ #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" #include "third_party/blink/renderer/core/style/computed_style.h" -#include "third_party/blink/renderer/platform/length.h" +#include "third_party/blink/renderer/platform/geometry/length.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* AnimationDelay::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSPropertyParserHelpers::ConsumeTime, range, kValueRangeAll); + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_property_parser_helpers::ConsumeTime, range, kValueRangeAll); } const CSSValue* AnimationDelay::CSSValueFromComputedStyleInternal( @@ -37,5 +37,5 @@ const CSSValue* AnimationDelay::InitialValue() const { return value; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_direction_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_direction_custom.cc index 8572a3a924f..4deae2d747a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_direction_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_direction_custom.cc @@ -10,16 +10,16 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* AnimationDirection::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSPropertyParserHelpers::ConsumeIdent<CSSValueNormal, CSSValueAlternate, - CSSValueReverse, - CSSValueAlternateReverse>, + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_property_parser_helpers::ConsumeIdent< + CSSValueNormal, CSSValueAlternate, CSSValueReverse, + CSSValueAlternateReverse>, range); } @@ -48,5 +48,5 @@ const CSSValue* AnimationDirection::InitialValue() const { return value; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_duration_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_duration_custom.cc index b4fba58f73f..5158fb343bf 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_duration_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_duration_custom.cc @@ -7,17 +7,17 @@ #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" #include "third_party/blink/renderer/core/style/computed_style.h" -#include "third_party/blink/renderer/platform/length.h" +#include "third_party/blink/renderer/platform/geometry/length.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* AnimationDuration::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSPropertyParserHelpers::ConsumeTime, range, kValueRangeNonNegative); + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_property_parser_helpers::ConsumeTime, range, kValueRangeNonNegative); } const CSSValue* AnimationDuration::CSSValueFromComputedStyleInternal( @@ -37,5 +37,5 @@ const CSSValue* AnimationDuration::InitialValue() const { return value; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_fill_mode_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_fill_mode_custom.cc index fa1c4ab13a8..e1fb8603598 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_fill_mode_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_fill_mode_custom.cc @@ -10,15 +10,15 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* AnimationFillMode::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSPropertyParserHelpers::ConsumeIdent<CSSValueNone, CSSValueForwards, - CSSValueBackwards, CSSValueBoth>, + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_property_parser_helpers::ConsumeIdent< + CSSValueNone, CSSValueForwards, CSSValueBackwards, CSSValueBoth>, range); } @@ -47,5 +47,5 @@ const CSSValue* AnimationFillMode::InitialValue() const { return value; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_iteration_count_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_iteration_count_custom.cc index e8c25fd0dea..b0eaa447849 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_iteration_count_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_iteration_count_custom.cc @@ -11,14 +11,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* AnimationIterationCount::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSParsingUtils::ConsumeAnimationIterationCount, range); + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_parsing_utils::ConsumeAnimationIterationCount, range); } const CSSValue* AnimationIterationCount::CSSValueFromComputedStyleInternal( @@ -49,5 +49,5 @@ const CSSValue* AnimationIterationCount::InitialValue() const { return value; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_name_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_name_custom.cc index 4b708e88d16..8603f6ab954 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_name_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_name_custom.cc @@ -10,15 +10,15 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* AnimationName::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext& local_context) const { // Allow quoted name if this is an alias property. - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSParsingUtils::ConsumeAnimationName, range, context, + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_parsing_utils::ConsumeAnimationName, range, context, local_context.UseAliasParsing()); } @@ -45,5 +45,5 @@ const CSSValue* AnimationName::InitialValue() const { return value; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_play_state_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_play_state_custom.cc index 418090b3b6e..16e02578f9a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_play_state_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_play_state_custom.cc @@ -10,14 +10,15 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* AnimationPlayState::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSPropertyParserHelpers::ConsumeIdent<CSSValueRunning, CSSValuePaused>, + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_property_parser_helpers::ConsumeIdent<CSSValueRunning, + CSSValuePaused>, range); } @@ -46,5 +47,5 @@ const CSSValue* AnimationPlayState::InitialValue() const { return value; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_timing_function_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_timing_function_custom.cc index 19983ebe080..205f3331a94 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_timing_function_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/animation_timing_function_custom.cc @@ -10,14 +10,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* AnimationTimingFunction::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSParsingUtils::ConsumeAnimationTimingFunction, range); + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_parsing_utils::ConsumeAnimationTimingFunction, range); } const CSSValue* AnimationTimingFunction::CSSValueFromComputedStyleInternal( @@ -36,5 +36,5 @@ const CSSValue* AnimationTimingFunction::InitialValue() const { return value; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/backdrop_filter_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/backdrop_filter_custom.cc index 41eb3346fbd..50302fdfc3d 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/backdrop_filter_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/backdrop_filter_custom.cc @@ -10,13 +10,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BackdropFilter::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeFilterFunctionList(range, context); + return css_property_parser_helpers::ConsumeFilterFunctionList(range, context); } const CSSValue* BackdropFilter::CSSValueFromComputedStyleInternal( @@ -28,5 +28,5 @@ const CSSValue* BackdropFilter::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForFilter(style, style.BackdropFilter()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/backface_visibility_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/backface_visibility_custom.cc index aa12196f7cc..7ef04f62c53 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/backface_visibility_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/backface_visibility_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/backface_visibility.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BackfaceVisibility::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -19,5 +19,5 @@ const CSSValue* BackfaceVisibility::CSSValueFromComputedStyleInternal( : CSSValueVisible); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/background_attachment_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/background_attachment_custom.cc index 2bff0de99d4..e0591339c82 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/background_attachment_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/background_attachment_custom.cc @@ -8,14 +8,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BackgroundAttachment::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSParsingUtils::ConsumeBackgroundAttachment, range); + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_parsing_utils::ConsumeBackgroundAttachment, range); } const CSSValue* BackgroundAttachment::CSSValueFromComputedStyleInternal( @@ -31,5 +31,5 @@ const CSSValue* BackgroundAttachment::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/background_blend_mode_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/background_blend_mode_custom.cc index 4a89a5f37b6..08417ec6c78 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/background_blend_mode_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/background_blend_mode_custom.cc @@ -8,14 +8,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BackgroundBlendMode::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSParsingUtils::ConsumeBackgroundBlendMode, range); + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_parsing_utils::ConsumeBackgroundBlendMode, range); } const CSSValue* BackgroundBlendMode::CSSValueFromComputedStyleInternal( @@ -31,5 +31,5 @@ const CSSValue* BackgroundBlendMode::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/background_clip_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/background_clip_custom.cc index 0941b8fc1d4..a2e80e5c9fe 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/background_clip_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/background_clip_custom.cc @@ -8,14 +8,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BackgroundClip::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext& local_context) const { - return CSSParsingUtils::ParseBackgroundBox( - range, local_context, CSSParsingUtils::AllowTextValue::kAllow); + return css_parsing_utils::ParseBackgroundBox( + range, local_context, css_parsing_utils::AllowTextValue::kAllow); } const CSSValue* BackgroundClip::CSSValueFromComputedStyleInternal( @@ -33,5 +33,5 @@ const CSSValue* BackgroundClip::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/background_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/background_color_custom.cc index 78dafacc84d..1fb8f509d1a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/background_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/background_color_custom.cc @@ -12,13 +12,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BackgroundColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeColor( + return css_property_parser_helpers::ConsumeColor( range, context.Mode(), IsQuirksModeBehavior(context.Mode())); } @@ -57,5 +57,5 @@ const CSSValue* BackgroundColor::CSSValueFromComputedStyleInternal( style, style.BackgroundColor()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/background_image_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/background_image_custom.cc index 9e47d1b0a45..bc8afb10d05 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/background_image_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/background_image_custom.cc @@ -9,14 +9,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BackgroundImage::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSPropertyParserHelpers::ConsumeImageOrNone, range, &context); + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_property_parser_helpers::ConsumeImageOrNone, range, &context); } const CSSValue* BackgroundImage::CSSValueFromComputedStyleInternal( @@ -29,5 +29,5 @@ const CSSValue* BackgroundImage::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::BackgroundImageOrWebkitMaskImage(fill_layer); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/background_origin_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/background_origin_custom.cc index 0224310c538..3b076d97db1 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/background_origin_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/background_origin_custom.cc @@ -8,14 +8,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BackgroundOrigin::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext& local_context) const { - return CSSParsingUtils::ParseBackgroundBox( - range, local_context, CSSParsingUtils::AllowTextValue::kForbid); + return css_parsing_utils::ParseBackgroundBox( + range, local_context, css_parsing_utils::AllowTextValue::kForbid); } const CSSValue* BackgroundOrigin::CSSValueFromComputedStyleInternal( @@ -33,5 +33,5 @@ const CSSValue* BackgroundOrigin::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/background_position_x_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/background_position_x_custom.cc index 00322791db5..de6066de717 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/background_position_x_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/background_position_x_custom.cc @@ -11,14 +11,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BackgroundPositionX::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSParsingUtils::ConsumePositionLonghand<CSSValueLeft, CSSValueRight>, + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_parsing_utils::ConsumePositionLonghand<CSSValueLeft, CSSValueRight>, range, context.Mode()); } @@ -33,5 +33,5 @@ const CSSValue* BackgroundPositionX::CSSValueFromComputedStyleInternal( style, curr_layer); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/background_position_y_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/background_position_y_custom.cc index a1f096894b4..f5a453c9b17 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/background_position_y_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/background_position_y_custom.cc @@ -11,14 +11,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BackgroundPositionY::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSParsingUtils::ConsumePositionLonghand<CSSValueTop, CSSValueBottom>, + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_parsing_utils::ConsumePositionLonghand<CSSValueTop, CSSValueBottom>, range, context.Mode()); } @@ -33,5 +33,5 @@ const CSSValue* BackgroundPositionY::CSSValueFromComputedStyleInternal( style, curr_layer); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/background_size_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/background_size_custom.cc index 8663381d549..c426a54df67 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/background_size_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/background_size_custom.cc @@ -10,13 +10,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BackgroundSize::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext& local_context) const { - return CSSParsingUtils::ParseBackgroundOrMaskSize( + return css_parsing_utils::ParseBackgroundOrMaskSize( range, context, local_context, WebFeature::kNegativeBackgroundSize); } @@ -30,5 +30,5 @@ const CSSValue* BackgroundSize::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::BackgroundImageOrWebkitMaskSize(style, fill_layer); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/baseline_shift_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/baseline_shift_custom.cc index 26734d4bc0d..a16199c840a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/baseline_shift_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/baseline_shift_custom.cc @@ -11,7 +11,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BaselineShift::ParseSingleValue( CSSParserTokenRange& range, @@ -19,8 +19,8 @@ const CSSValue* BaselineShift::ParseSingleValue( const CSSParserLocalContext&) const { CSSValueID id = range.Peek().Id(); if (id == CSSValueBaseline || id == CSSValueSub || id == CSSValueSuper) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeLengthOrPercent( + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeLengthOrPercent( range, kSVGAttributeMode, kValueRangeAll); } @@ -77,5 +77,5 @@ void BaselineShift::ApplyValue(StyleResolverState& state, } } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/block_size_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/block_size_custom.cc index 0bf6c111c7a..56bba6cf32d 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/block_size_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/block_size_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/layout/layout_object.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BlockSize::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeWidthOrHeight(range, context); + return css_parsing_utils::ConsumeWidthOrHeight(range, context); } bool BlockSize::IsLayoutDependent(const ComputedStyle* style, @@ -23,5 +23,5 @@ bool BlockSize::IsLayoutDependent(const ComputedStyle* style, return layout_object && layout_object->IsBox(); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_end_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_end_color_custom.cc index 584cd2e7b9b..f66392706e2 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_end_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_end_color_custom.cc @@ -12,14 +12,14 @@ namespace blink { class CSSParserLocalContext; -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderBlockEndColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); + return css_property_parser_helpers::ConsumeColor(range, context.Mode()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_end_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_end_width_custom.cc index b51c04782ef..e57415d7891 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_end_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_end_width_custom.cc @@ -10,15 +10,16 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderBlockEndWidth::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeBorderWidth( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_parsing_utils::ConsumeBorderWidth( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_start_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_start_color_custom.cc index 30d384981f3..ea96b89508e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_start_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_start_color_custom.cc @@ -12,14 +12,14 @@ namespace blink { class CSSParserLocalContext; -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderBlockStartColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); + return css_property_parser_helpers::ConsumeColor(range, context.Mode()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_start_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_start_width_custom.cc index a4bc114343b..8a15fcbc2ab 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_start_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_start_width_custom.cc @@ -10,15 +10,16 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderBlockStartWidth::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeBorderWidth( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_parsing_utils::ConsumeBorderWidth( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_bottom_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_bottom_color_custom.cc index 14681dc3162..1935e6a27a6 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_bottom_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_bottom_color_custom.cc @@ -15,13 +15,14 @@ class CSSParserContext; class CSSParserLocalContext; class CSSParserTokenRange; -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderBottomColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext& local_context) const { - return CSSParsingUtils::ConsumeBorderColorSide(range, context, local_context); + return css_parsing_utils::ConsumeBorderColorSide(range, context, + local_context); } const blink::Color BorderBottomColor::ColorIncludingFallback( @@ -46,5 +47,5 @@ const CSSValue* BorderBottomColor::CSSValueFromComputedStyleInternal( style, style.BorderBottomColor()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_bottom_left_radius_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_bottom_left_radius_custom.cc index 7ef63ec14cd..791b4cdc3fc 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_bottom_left_radius_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_bottom_left_radius_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderBottomLeftRadius::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ParseBorderRadiusCorner(range, context); + return css_parsing_utils::ParseBorderRadiusCorner(range, context); } const CSSValue* BorderBottomLeftRadius::CSSValueFromComputedStyleInternal( @@ -28,5 +28,5 @@ const CSSValue* BorderBottomLeftRadius::CSSValueFromComputedStyleInternal( style.BorderBottomLeftRadius(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_bottom_right_radius_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_bottom_right_radius_custom.cc index fa10ed696b7..1eb8d4ec7f3 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_bottom_right_radius_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_bottom_right_radius_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderBottomRightRadius::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ParseBorderRadiusCorner(range, context); + return css_parsing_utils::ParseBorderRadiusCorner(range, context); } const CSSValue* BorderBottomRightRadius::CSSValueFromComputedStyleInternal( @@ -28,5 +28,5 @@ const CSSValue* BorderBottomRightRadius::CSSValueFromComputedStyleInternal( style.BorderBottomRightRadius(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_bottom_style_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_bottom_style_custom.cc index fbdec89087b..5b1894cf293 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_bottom_style_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_bottom_style_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/border_bottom_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderBottomStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* BorderBottomStyle::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.BorderBottomStyle()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_bottom_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_bottom_width_custom.cc index 90240194ace..253c9b0792c 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_bottom_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_bottom_width_custom.cc @@ -8,13 +8,13 @@ #include "third_party/blink/renderer/core/css/zoom_adjusted_pixel_value.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderBottomWidth::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext& local_context) const { - return CSSParsingUtils::ParseBorderWidthSide(range, context, local_context); + return css_parsing_utils::ParseBorderWidthSide(range, context, local_context); } const CSSValue* BorderBottomWidth::CSSValueFromComputedStyleInternal( @@ -26,5 +26,5 @@ const CSSValue* BorderBottomWidth::CSSValueFromComputedStyleInternal( return ZoomAdjustedPixelValue(style.BorderBottomWidth(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_collapse_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_collapse_custom.cc index d815b21921a..d6a4bfdffa9 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_collapse_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_collapse_custom.cc @@ -7,7 +7,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderCollapse::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -20,5 +20,5 @@ const CSSValue* BorderCollapse::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(CSSValueSeparate); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_outset_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_outset_custom.cc index 43fcc5ef118..7f0185f3c27 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_outset_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_outset_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderImageOutset::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeBorderImageOutset(range); + return css_parsing_utils::ConsumeBorderImageOutset(range); } const CSSValue* BorderImageOutset::CSSValueFromComputedStyleInternal( @@ -39,5 +39,5 @@ const CSSValue* BorderImageOutset::InitialValue() const { return value; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_repeat_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_repeat_custom.cc index 4a9bcb09ad8..96d735818ae 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_repeat_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_repeat_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderImageRepeat::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeBorderImageRepeat(range); + return css_parsing_utils::ConsumeBorderImageRepeat(range); } const CSSValue* BorderImageRepeat::CSSValueFromComputedStyleInternal( @@ -33,5 +33,5 @@ const CSSValue* BorderImageRepeat::InitialValue() const { return value; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_slice_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_slice_custom.cc index 3376506b45e..62888d64f9e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_slice_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_slice_custom.cc @@ -9,14 +9,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderImageSlice::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeBorderImageSlice( - range, CSSParsingUtils::DefaultFill::kNoFill); + return css_parsing_utils::ConsumeBorderImageSlice( + range, css_parsing_utils::DefaultFill::kNoFill); } const CSSValue* BorderImageSlice::CSSValueFromComputedStyleInternal( @@ -35,5 +35,5 @@ const CSSValue* BorderImageSlice::InitialValue() const { return value; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_source_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_source_custom.cc index 8f5375a87c3..17622ae42f7 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_source_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_source_custom.cc @@ -12,13 +12,13 @@ namespace blink { class CSSParserLocalContext; -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderImageSource::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeImageOrNone(range, &context); + return css_property_parser_helpers::ConsumeImageOrNone(range, &context); } const CSSValue* BorderImageSource::CSSValueFromComputedStyleInternal( @@ -44,5 +44,5 @@ void BorderImageSource::ApplyValue(StyleResolverState& state, state.GetStyleImage(CSSPropertyBorderImageSource, value)); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_width_custom.cc index d981f2bbd9f..6b3bd3bd6a1 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_width_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderImageWidth::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeBorderImageWidth(range); + return css_parsing_utils::ConsumeBorderImageWidth(range); } const CSSValue* BorderImageWidth::CSSValueFromComputedStyleInternal( @@ -39,5 +39,5 @@ const CSSValue* BorderImageWidth::InitialValue() const { return value; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_end_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_end_color_custom.cc index 250d1d60b90..4a76f43041a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_end_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_end_color_custom.cc @@ -12,14 +12,14 @@ namespace blink { class CSSParserLocalContext; -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderInlineEndColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); + return css_property_parser_helpers::ConsumeColor(range, context.Mode()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_end_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_end_width_custom.cc index 9b239eac685..ce62e09ee46 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_end_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_end_width_custom.cc @@ -10,15 +10,16 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderInlineEndWidth::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeBorderWidth( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_parsing_utils::ConsumeBorderWidth( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_start_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_start_color_custom.cc index 927a86240e3..35c90842baa 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_start_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_start_color_custom.cc @@ -12,14 +12,14 @@ namespace blink { class CSSParserLocalContext; -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderInlineStartColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); + return css_property_parser_helpers::ConsumeColor(range, context.Mode()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_start_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_start_width_custom.cc index 803070f0843..a9cdb5f1e44 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_start_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_start_width_custom.cc @@ -10,15 +10,16 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderInlineStartWidth::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeBorderWidth( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_parsing_utils::ConsumeBorderWidth( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_left_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_left_color_custom.cc index 1b243bd0284..899c48f5284 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_left_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_left_color_custom.cc @@ -15,13 +15,14 @@ class CSSParserContext; class CSSParserLocalContext; class CSSParserTokenRange; -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderLeftColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext& local_context) const { - return CSSParsingUtils::ConsumeBorderColorSide(range, context, local_context); + return css_parsing_utils::ConsumeBorderColorSide(range, context, + local_context); } const blink::Color BorderLeftColor::ColorIncludingFallback( @@ -46,5 +47,5 @@ const CSSValue* BorderLeftColor::CSSValueFromComputedStyleInternal( style, style.BorderLeftColor()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_left_style_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_left_style_custom.cc index 5789b084c24..eca1f56a9da 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_left_style_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_left_style_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/border_left_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderLeftStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* BorderLeftStyle::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.BorderLeftStyle()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_left_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_left_width_custom.cc index 6bfccb3ede8..cccc045086e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_left_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_left_width_custom.cc @@ -8,13 +8,13 @@ #include "third_party/blink/renderer/core/css/zoom_adjusted_pixel_value.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderLeftWidth::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext& local_context) const { - return CSSParsingUtils::ParseBorderWidthSide(range, context, local_context); + return css_parsing_utils::ParseBorderWidthSide(range, context, local_context); } const CSSValue* BorderLeftWidth::CSSValueFromComputedStyleInternal( @@ -26,5 +26,5 @@ const CSSValue* BorderLeftWidth::CSSValueFromComputedStyleInternal( return ZoomAdjustedPixelValue(style.BorderLeftWidth(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_right_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_right_color_custom.cc index da1f4d3ff38..5adefc67e86 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_right_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_right_color_custom.cc @@ -15,13 +15,14 @@ class CSSParserContext; class CSSParserLocalContext; class CSSParserTokenRange; -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderRightColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext& local_context) const { - return CSSParsingUtils::ConsumeBorderColorSide(range, context, local_context); + return css_parsing_utils::ConsumeBorderColorSide(range, context, + local_context); } const blink::Color BorderRightColor::ColorIncludingFallback( @@ -46,5 +47,5 @@ const CSSValue* BorderRightColor::CSSValueFromComputedStyleInternal( style, style.BorderRightColor()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_right_style_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_right_style_custom.cc index eb04928a72b..bb8bcde223e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_right_style_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_right_style_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/border_right_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderRightStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* BorderRightStyle::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.BorderRightStyle()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_right_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_right_width_custom.cc index 0c1fca8c791..9850f28e996 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_right_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_right_width_custom.cc @@ -8,13 +8,13 @@ #include "third_party/blink/renderer/core/css/zoom_adjusted_pixel_value.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderRightWidth::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext& local_context) const { - return CSSParsingUtils::ParseBorderWidthSide(range, context, local_context); + return css_parsing_utils::ParseBorderWidthSide(range, context, local_context); } const CSSValue* BorderRightWidth::CSSValueFromComputedStyleInternal( @@ -26,5 +26,5 @@ const CSSValue* BorderRightWidth::CSSValueFromComputedStyleInternal( return ZoomAdjustedPixelValue(style.BorderRightWidth(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_top_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_top_color_custom.cc index c7793559a67..10319b5022f 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_top_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_top_color_custom.cc @@ -15,13 +15,14 @@ class CSSParserContext; class CSSParserLocalContext; class CSSParserTokenRange; -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderTopColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext& local_context) const { - return CSSParsingUtils::ConsumeBorderColorSide(range, context, local_context); + return css_parsing_utils::ConsumeBorderColorSide(range, context, + local_context); } const blink::Color BorderTopColor::ColorIncludingFallback( @@ -47,5 +48,5 @@ const CSSValue* BorderTopColor::CSSValueFromComputedStyleInternal( style, style.BorderTopColor()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_top_left_radius_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_top_left_radius_custom.cc index 7b4b65ad323..7c01a8a4091 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_top_left_radius_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_top_left_radius_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderTopLeftRadius::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ParseBorderRadiusCorner(range, context); + return css_parsing_utils::ParseBorderRadiusCorner(range, context); } const CSSValue* BorderTopLeftRadius::CSSValueFromComputedStyleInternal( @@ -28,5 +28,5 @@ const CSSValue* BorderTopLeftRadius::CSSValueFromComputedStyleInternal( style.BorderTopLeftRadius(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_top_right_radius_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_top_right_radius_custom.cc index 297749b001f..723f4005d0a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_top_right_radius_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_top_right_radius_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderTopRightRadius::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ParseBorderRadiusCorner(range, context); + return css_parsing_utils::ParseBorderRadiusCorner(range, context); } const CSSValue* BorderTopRightRadius::CSSValueFromComputedStyleInternal( @@ -28,5 +28,5 @@ const CSSValue* BorderTopRightRadius::CSSValueFromComputedStyleInternal( style.BorderTopRightRadius(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_top_style_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_top_style_custom.cc index 7b524a901e3..e00e4d0acb5 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_top_style_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_top_style_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/border_top_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderTopStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* BorderTopStyle::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.BorderTopStyle()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_top_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_top_width_custom.cc index ee94b04b747..864199510b4 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_top_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_top_width_custom.cc @@ -8,13 +8,13 @@ #include "third_party/blink/renderer/core/css/zoom_adjusted_pixel_value.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BorderTopWidth::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext& local_context) const { - return CSSParsingUtils::ParseBorderWidthSide(range, context, local_context); + return css_parsing_utils::ParseBorderWidthSide(range, context, local_context); } const CSSValue* BorderTopWidth::CSSValueFromComputedStyleInternal( @@ -26,5 +26,5 @@ const CSSValue* BorderTopWidth::CSSValueFromComputedStyleInternal( return ZoomAdjustedPixelValue(style.BorderTopWidth(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/bottom_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/bottom_custom.cc index 68606e85b46..7f22bfd645a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/bottom_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/bottom_custom.cc @@ -15,13 +15,14 @@ namespace blink { class CSSParserLocalContext; -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Bottom::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeMarginOrOffset( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + return css_parsing_utils::ConsumeMarginOrOffset( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kAllow); } bool Bottom::IsLayoutDependent(const ComputedStyle* style, @@ -39,5 +40,5 @@ const CSSValue* Bottom::CSSValueFromComputedStyleInternal( layout_object); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/box_shadow_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/box_shadow_custom.cc index 615e14d8391..0004a5d3b4e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/box_shadow_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/box_shadow_custom.cc @@ -10,14 +10,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BoxShadow::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeShadow( - range, context.Mode(), CSSParsingUtils::AllowInsetAndSpread::kAllow); + return css_parsing_utils::ConsumeShadow( + range, context.Mode(), css_parsing_utils::AllowInsetAndSpread::kAllow); } const CSSValue* BoxShadow::CSSValueFromComputedStyleInternal( @@ -29,5 +29,5 @@ const CSSValue* BoxShadow::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForShadowList(style.BoxShadow(), style, true); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/box_sizing_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/box_sizing_custom.cc index 2ece767f398..560b580eb18 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/box_sizing_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/box_sizing_custom.cc @@ -7,7 +7,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BoxSizing::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -20,5 +20,5 @@ const CSSValue* BoxSizing::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(CSSValueBorderBox); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/break_after_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/break_after_custom.cc index cc54c807b06..fdf5814187a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/break_after_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/break_after_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/break_after.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BreakAfter::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* BreakAfter::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.BreakAfter()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/break_before_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/break_before_custom.cc index 131cd9e6cfb..7626cb72834 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/break_before_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/break_before_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/break_before.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BreakBefore::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* BreakBefore::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.BreakBefore()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/break_inside_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/break_inside_custom.cc index 118eb08012e..36c675bcc0c 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/break_inside_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/break_inside_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/break_inside.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BreakInside::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* BreakInside::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.BreakInside()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/buffered_rendering_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/buffered_rendering_custom.cc index 8fb703f5e35..a65e2fb894c 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/buffered_rendering_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/buffered_rendering_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/buffered_rendering.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* BufferedRendering::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* BufferedRendering::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(svg_style.BufferedRendering()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/caption_side_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/caption_side_custom.cc index 68b07a20bc0..26175888763 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/caption_side_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/caption_side_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/caption_side.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* CaptionSide::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* CaptionSide::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.CaptionSide()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/caret_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/caret_color_custom.cc index bd1010e20f8..48d4150244d 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/caret_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/caret_color_custom.cc @@ -11,15 +11,15 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* CaretColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueAuto) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeColor(range, context.Mode()); } const blink::Color CaretColor::ColorIncludingFallback( @@ -80,5 +80,5 @@ void CaretColor::ApplyValue(StyleResolverState& state, } } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/clear_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/clear_custom.cc index 0fa6c74e360..23784392b93 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/clear_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/clear_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/clear.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Clear::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,27 +16,5 @@ const CSSValue* Clear::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.Clear()); } -void Clear::ApplyValue(StyleResolverState& state, const CSSValue& value) const { - const CSSIdentifierValue& identifier_value = ToCSSIdentifierValue(value); - - EClear c; - CSSValueID id = identifier_value.GetValueID(); - switch (id) { - case CSSValueInlineStart: - case CSSValueInlineEnd: - if ((id == CSSValueInlineStart) == - (state.Style()->Direction() == TextDirection::kLtr)) { - c = EClear::kLeft; - } else { - c = EClear::kRight; - } - break; - default: - c = identifier_value.ConvertTo<EClear>(); - break; - } - state.Style()->SetClear(c); -} - -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/clip_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/clip_custom.cc index 1a703b112ff..968d00af06d 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/clip_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/clip_custom.cc @@ -16,40 +16,41 @@ namespace { CSSValue* ConsumeClipComponent(CSSParserTokenRange& range, CSSParserMode css_parser_mode) { if (range.Peek().Id() == CSSValueAuto) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeLength( + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeLength( range, css_parser_mode, kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + css_property_parser_helpers::UnitlessQuirk::kAllow); } } // namespace -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Clip::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueAuto) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); if (range.Peek().FunctionId() != CSSValueRect) return nullptr; - CSSParserTokenRange args = CSSPropertyParserHelpers::ConsumeFunction(range); + CSSParserTokenRange args = + css_property_parser_helpers::ConsumeFunction(range); // rect(t, r, b, l) || rect(t r b l) CSSValue* top = ConsumeClipComponent(args, context.Mode()); if (!top) return nullptr; bool needs_comma = - CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args); + css_property_parser_helpers::ConsumeCommaIncludingWhitespace(args); CSSValue* right = ConsumeClipComponent(args, context.Mode()); if (!right || (needs_comma && - !CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args))) + !css_property_parser_helpers::ConsumeCommaIncludingWhitespace(args))) return nullptr; CSSValue* bottom = ConsumeClipComponent(args, context.Mode()); if (!bottom || (needs_comma && - !CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args))) + !css_property_parser_helpers::ConsumeCommaIncludingWhitespace(args))) return nullptr; CSSValue* left = ConsumeClipComponent(args, context.Mode()); if (!left || !args.AtEnd()) @@ -78,5 +79,5 @@ const CSSValue* Clip::CSSValueFromComputedStyleInternal( CSSQuadValue::kSerializeAsRect); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/clip_path_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/clip_path_custom.cc index 5b9ff89b12e..c12fa9f5789 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/clip_path_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/clip_path_custom.cc @@ -13,16 +13,17 @@ #include "third_party/blink/renderer/core/style/shape_clip_path_operation.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ClipPath::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); - if (CSSURIValue* url = CSSPropertyParserHelpers::ConsumeUrl(range, &context)) + return css_property_parser_helpers::ConsumeIdent(range); + if (CSSURIValue* url = + css_property_parser_helpers::ConsumeUrl(range, &context)) return url; - return CSSParsingUtils::ConsumeBasicShape(range, context); + return css_parsing_utils::ConsumeBasicShape(range, context); } const CSSValue* ClipPath::CSSValueFromComputedStyleInternal( @@ -44,5 +45,5 @@ const CSSValue* ClipPath::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(CSSValueNone); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/clip_rule_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/clip_rule_custom.cc index 355a6a2cca9..dbdb9899612 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/clip_rule_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/clip_rule_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/clip_rule.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ClipRule::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* ClipRule::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(svg_style.ClipRule()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/color_custom.cc index 8061da94d70..75fb0a421c9 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/color_custom.cc @@ -12,12 +12,12 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Color::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeColor( + return css_property_parser_helpers::ConsumeColor( range, context.Mode(), IsQuirksModeBehavior(context.Mode())); } @@ -73,5 +73,5 @@ void Color::ApplyValue(StyleResolverState& state, const CSSValue& value) const { } } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/color_interpolation_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/color_interpolation_custom.cc index 73f1c308162..473436ee526 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/color_interpolation_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/color_interpolation_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/color_interpolation.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ColorInterpolation::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* ColorInterpolation::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(svg_style.ColorInterpolation()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/color_interpolation_filters_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/color_interpolation_filters_custom.cc index 586a813ac1b..edbc6013164 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/color_interpolation_filters_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/color_interpolation_filters_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/color_interpolation_filters.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ColorInterpolationFilters::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* ColorInterpolationFilters::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(svg_style.ColorInterpolationFilters()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/color_rendering_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/color_rendering_custom.cc index 0fa6eec6581..9c76a140b16 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/color_rendering_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/color_rendering_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/color_rendering.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ColorRendering::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* ColorRendering::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(svg_style.ColorRendering()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/column_count_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/column_count_custom.cc index d7e0ab5359a..629c19f687a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/column_count_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/column_count_custom.cc @@ -8,13 +8,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ColumnCount::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeColumnCount(range); + return css_parsing_utils::ConsumeColumnCount(range); } const CSSValue* ColumnCount::CSSValueFromComputedStyleInternal( @@ -29,5 +29,5 @@ const CSSValue* ColumnCount::CSSValueFromComputedStyleInternal( CSSPrimitiveValue::UnitType::kNumber); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/column_fill_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/column_fill_custom.cc index 5e5ac8851d2..01b60be1d6f 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/column_fill_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/column_fill_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/column_fill.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ColumnFill::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* ColumnFill::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.GetColumnFill()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/column_gap_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/column_gap_custom.cc index 58f45a2aede..e84fc9dd077 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/column_gap_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/column_gap_custom.cc @@ -11,13 +11,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ColumnGap::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeGapLength(range, context); + return css_parsing_utils::ConsumeGapLength(range, context); } const CSSValue* ColumnGap::CSSValueFromComputedStyleInternal( @@ -29,5 +29,5 @@ const CSSValue* ColumnGap::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForGapLength(style.ColumnGap(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/column_rule_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/column_rule_color_custom.cc index e9294e47db1..95f128af7e2 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/column_rule_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/column_rule_color_custom.cc @@ -11,13 +11,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ColumnRuleColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); + return css_property_parser_helpers::ConsumeColor(range, context.Mode()); } const blink::Color ColumnRuleColor::ColorIncludingFallback( @@ -42,5 +42,5 @@ const CSSValue* ColumnRuleColor::CSSValueFromComputedStyleInternal( style, style.ColumnRuleColor()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/column_rule_style_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/column_rule_style_custom.cc index 0813b5d596a..bace7dd7dbf 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/column_rule_style_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/column_rule_style_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/column_rule_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ColumnRuleStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* ColumnRuleStyle::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.ColumnRuleStyle()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/column_rule_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/column_rule_width_custom.cc index 2c4ac28f911..1dce9d4295c 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/column_rule_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/column_rule_width_custom.cc @@ -9,14 +9,15 @@ #include "third_party/blink/renderer/core/css/zoom_adjusted_pixel_value.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ColumnRuleWidth::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeLineWidth( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_property_parser_helpers::ConsumeLineWidth( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kForbid); } const CSSValue* ColumnRuleWidth::CSSValueFromComputedStyleInternal( @@ -28,5 +29,5 @@ const CSSValue* ColumnRuleWidth::CSSValueFromComputedStyleInternal( return ZoomAdjustedPixelValue(style.ColumnRuleWidth(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/column_span_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/column_span_custom.cc index be13a3ac7ef..030e7a86fff 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/column_span_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/column_span_custom.cc @@ -7,13 +7,13 @@ #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ColumnSpan::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeIdent<CSSValueAll, CSSValueNone>( + return css_property_parser_helpers::ConsumeIdent<CSSValueAll, CSSValueNone>( range); } @@ -28,5 +28,5 @@ const CSSValue* ColumnSpan::CSSValueFromComputedStyleInternal( : CSSValueNone); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/column_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/column_width_custom.cc index e06bf3c3bec..d8f23451c5c 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/column_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/column_width_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ColumnWidth::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeColumnWidth(range); + return css_parsing_utils::ConsumeColumnWidth(range); } const CSSValue* ColumnWidth::CSSValueFromComputedStyleInternal( @@ -29,5 +29,5 @@ const CSSValue* ColumnWidth::CSSValueFromComputedStyleInternal( return ZoomAdjustedPixelValue(style.ColumnWidth(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/contain_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/contain_custom.cc index effdab99b06..b6fab7d6254 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/contain_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/contain_custom.cc @@ -10,31 +10,47 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { -// none | strict | content | [ layout || style || paint || size ] +// none | strict | content | [ size || layout || style || paint ] const CSSValue* Contain::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { CSSValueID id = range.Peek().Id(); if (id == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); CSSValueList* list = CSSValueList::CreateSpaceSeparated(); if (id == CSSValueStrict || id == CSSValueContent) { - list->Append(*CSSPropertyParserHelpers::ConsumeIdent(range)); + list->Append(*css_property_parser_helpers::ConsumeIdent(range)); return list; } + + CSSIdentifierValue* size = nullptr; + CSSIdentifierValue* layout = nullptr; + CSSIdentifierValue* style = nullptr; + CSSIdentifierValue* paint = nullptr; while (true) { - CSSIdentifierValue* ident = CSSPropertyParserHelpers::ConsumeIdent< - CSSValuePaint, CSSValueLayout, CSSValueStyle, CSSValueSize>(range); - if (!ident) + CSSValueID id = range.Peek().Id(); + if (id == CSSValueSize && !size) + size = css_property_parser_helpers::ConsumeIdent(range); + else if (id == CSSValueLayout && !layout) + layout = css_property_parser_helpers::ConsumeIdent(range); + else if (id == CSSValueStyle && !style) + style = css_property_parser_helpers::ConsumeIdent(range); + else if (id == CSSValuePaint && !paint) + paint = css_property_parser_helpers::ConsumeIdent(range); + else break; - if (list->HasValue(*ident)) - return nullptr; - list->Append(*ident); } - + if (size) + list->Append(*size); + if (layout) + list->Append(*layout); + if (style) + list->Append(*style); + if (paint) + list->Append(*paint); if (!list->length()) return nullptr; return list; @@ -54,17 +70,17 @@ const CSSValue* Contain::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(CSSValueContent); CSSValueList* list = CSSValueList::CreateSpaceSeparated(); - if (style.ContainsStyle()) - list->Append(*CSSIdentifierValue::Create(CSSValueStyle)); + if (style.ContainsSize()) + list->Append(*CSSIdentifierValue::Create(CSSValueSize)); if (style.Contain() & kContainsLayout) list->Append(*CSSIdentifierValue::Create(CSSValueLayout)); + if (style.ContainsStyle()) + list->Append(*CSSIdentifierValue::Create(CSSValueStyle)); if (style.ContainsPaint()) list->Append(*CSSIdentifierValue::Create(CSSValuePaint)); - if (style.ContainsSize()) - list->Append(*CSSIdentifierValue::Create(CSSValueSize)); DCHECK(list->length()); return list; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/content_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/content_custom.cc index 63916ae2e6e..ee8e477a028 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/content_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/content_custom.cc @@ -35,9 +35,11 @@ CSSValue* ConsumeAttr(CSSParserTokenRange args, return attr_value; } -CSSValue* ConsumeCounterContent(CSSParserTokenRange args, bool counters) { +CSSValue* ConsumeCounterContent(CSSParserTokenRange args, + const CSSParserContext& context, + bool counters) { CSSCustomIdentValue* identifier = - CSSPropertyParserHelpers::ConsumeCustomIdent(args); + css_property_parser_helpers::ConsumeCustomIdent(args, context); if (!identifier) return nullptr; @@ -45,7 +47,7 @@ CSSValue* ConsumeCounterContent(CSSParserTokenRange args, bool counters) { if (!counters) { separator = CSSStringValue::Create(String()); } else { - if (!CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args) || + if (!css_property_parser_helpers::ConsumeCommaIncludingWhitespace(args) || args.Peek().GetType() != kStringToken) return nullptr; separator = CSSStringValue::Create( @@ -53,12 +55,12 @@ CSSValue* ConsumeCounterContent(CSSParserTokenRange args, bool counters) { } CSSIdentifierValue* list_style = nullptr; - if (CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args)) { + if (css_property_parser_helpers::ConsumeCommaIncludingWhitespace(args)) { CSSValueID id = args.Peek().Id(); if ((id != CSSValueNone && (id < CSSValueDisc || id > CSSValueKatakanaIroha))) return nullptr; - list_style = CSSPropertyParserHelpers::ConsumeIdent(args); + list_style = css_property_parser_helpers::ConsumeIdent(args); } else { list_style = CSSIdentifierValue::Create(CSSValueDecimal); } @@ -69,37 +71,38 @@ CSSValue* ConsumeCounterContent(CSSParserTokenRange args, bool counters) { } } // namespace -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Content::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - if (CSSPropertyParserHelpers::IdentMatches<CSSValueNone, CSSValueNormal>( + if (css_property_parser_helpers::IdentMatches<CSSValueNone, CSSValueNormal>( range.Peek().Id())) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); CSSValueList* values = CSSValueList::CreateSpaceSeparated(); do { CSSValue* parsed_value = - CSSPropertyParserHelpers::ConsumeImage(range, &context); + css_property_parser_helpers::ConsumeImage(range, &context); if (!parsed_value) { - parsed_value = CSSPropertyParserHelpers::ConsumeIdent< + parsed_value = css_property_parser_helpers::ConsumeIdent< CSSValueOpenQuote, CSSValueCloseQuote, CSSValueNoOpenQuote, CSSValueNoCloseQuote>(range); } if (!parsed_value) - parsed_value = CSSPropertyParserHelpers::ConsumeString(range); + parsed_value = css_property_parser_helpers::ConsumeString(range); if (!parsed_value) { if (range.Peek().FunctionId() == CSSValueAttr) { parsed_value = ConsumeAttr( - CSSPropertyParserHelpers::ConsumeFunction(range), context); + css_property_parser_helpers::ConsumeFunction(range), context); } else if (range.Peek().FunctionId() == CSSValueCounter) { parsed_value = ConsumeCounterContent( - CSSPropertyParserHelpers::ConsumeFunction(range), false); + css_property_parser_helpers::ConsumeFunction(range), context, + false); } else if (range.Peek().FunctionId() == CSSValueCounters) { parsed_value = ConsumeCounterContent( - CSSPropertyParserHelpers::ConsumeFunction(range), true); + css_property_parser_helpers::ConsumeFunction(range), context, true); } if (!parsed_value) return nullptr; @@ -209,5 +212,5 @@ void Content::ApplyValue(StyleResolverState& state, state.Style()->SetContent(first_content); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/counter_increment_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/counter_increment_custom.cc index 7d28408aa67..d93128e1cc1 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/counter_increment_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/counter_increment_custom.cc @@ -9,15 +9,16 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const int kCounterIncrementDefaultValue = 1; const CSSValue* CounterIncrement::ParseSingleValue( CSSParserTokenRange& range, - const CSSParserContext&, + const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeCounter(range, kCounterIncrementDefaultValue); + return css_parsing_utils::ConsumeCounter(range, context, + kCounterIncrementDefaultValue); } const CSSValue* CounterIncrement::CSSValueFromComputedStyleInternal( @@ -29,5 +30,5 @@ const CSSValue* CounterIncrement::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForCounterDirectives(style, true); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/counter_reset_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/counter_reset_custom.cc index 5784e093cf4..04a48a00e80 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/counter_reset_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/counter_reset_custom.cc @@ -9,15 +9,16 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const int kCounterResetDefaultValue = 0; const CSSValue* CounterReset::ParseSingleValue( CSSParserTokenRange& range, - const CSSParserContext&, + const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeCounter(range, kCounterResetDefaultValue); + return css_parsing_utils::ConsumeCounter(range, context, + kCounterResetDefaultValue); } const CSSValue* CounterReset::CSSValueFromComputedStyleInternal( @@ -29,5 +30,5 @@ const CSSValue* CounterReset::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForCounterDirectives(style, false); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/cursor_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/cursor_custom.cc index ae8607ec0ff..4b93b78aa24 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/cursor_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/cursor_custom.cc @@ -13,22 +13,23 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Cursor::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { bool in_quirks_mode = IsQuirksModeBehavior(context.Mode()); CSSValueList* list = nullptr; - while (CSSValue* image = CSSPropertyParserHelpers::ConsumeImage( - range, &context, - CSSPropertyParserHelpers::ConsumeGeneratedImagePolicy::kForbid)) { + while ( + CSSValue* image = css_property_parser_helpers::ConsumeImage( + range, &context, + css_property_parser_helpers::ConsumeGeneratedImagePolicy::kForbid)) { double num; IntPoint hot_spot(-1, -1); bool hot_spot_specified = false; - if (CSSPropertyParserHelpers::ConsumeNumberRaw(range, num)) { + if (css_property_parser_helpers::ConsumeNumberRaw(range, num)) { hot_spot.SetX(clampTo<int>(num)); - if (!CSSPropertyParserHelpers::ConsumeNumberRaw(range, num)) + if (!css_property_parser_helpers::ConsumeNumberRaw(range, num)) return nullptr; hot_spot.SetY(clampTo<int>(num)); hot_spot_specified = true; @@ -39,7 +40,7 @@ const CSSValue* Cursor::ParseSingleValue(CSSParserTokenRange& range, list->Append(*cssvalue::CSSCursorImageValue::Create( *image, hot_spot_specified, hot_spot)); - if (!CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(range)) + if (!css_property_parser_helpers::ConsumeCommaIncludingWhitespace(range)) return nullptr; } @@ -62,7 +63,7 @@ const CSSValue* Cursor::ParseSingleValue(CSSParserTokenRange& range, range.ConsumeIncludingWhitespace(); } else if ((id >= CSSValueAuto && id <= CSSValueWebkitZoomOut) || id == CSSValueCopy || id == CSSValueNone) { - cursor_type = CSSPropertyParserHelpers::ConsumeIdent(range); + cursor_type = css_property_parser_helpers::ConsumeIdent(range); } else { return nullptr; } @@ -131,5 +132,5 @@ void Cursor::ApplyValue(StyleResolverState& state, } } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property.cc new file mode 100644 index 00000000000..f139d170b76 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property.cc @@ -0,0 +1,144 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/longhands/custom_property.h" + +#include "third_party/blink/renderer/core/css/css_custom_property_declaration.h" +#include "third_party/blink/renderer/core/css/parser/css_parser_local_context.h" +#include "third_party/blink/renderer/core/css/parser/css_variable_parser.h" +#include "third_party/blink/renderer/core/css/property_registration.h" +#include "third_party/blink/renderer/core/css/property_registry.h" +#include "third_party/blink/renderer/core/style/computed_style.h" + +namespace blink { + +CustomProperty::CustomProperty(const AtomicString& name, + const Document& document) + : name_(name), registration_(PropertyRegistration::From(&document, name)) {} + +CustomProperty::CustomProperty(const AtomicString& name, + const PropertyRegistry* registry) + : name_(name), + registration_(registry ? registry->Registration(name) : nullptr) {} + +bool CustomProperty::IsInherited() const { + return !registration_ || registration_->Inherits(); +} + +const AtomicString& CustomProperty::GetPropertyNameAtomicString() const { + return name_; +} + +void CustomProperty::ApplyInitial(StyleResolverState& state) const { + state.Style()->RemoveVariable(name_, IsInherited()); +} + +void CustomProperty::ApplyInherit(StyleResolverState& state) const { + bool is_inherited_property = IsInherited(); + state.Style()->RemoveVariable(name_, is_inherited_property); + + CSSVariableData* parent_value = + state.ParentStyle()->GetVariable(name_, is_inherited_property); + + if (!parent_value) + return; + + state.Style()->SetVariable(name_, parent_value, is_inherited_property); + + if (registration_) { + const CSSValue* parent_css_value = + parent_value ? state.ParentStyle()->GetNonInitialRegisteredVariable( + name_, is_inherited_property) + : nullptr; + state.Style()->SetRegisteredVariable(name_, parent_css_value, + is_inherited_property); + } +} + +void CustomProperty::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + const CSSCustomPropertyDeclaration& declaration = + ToCSSCustomPropertyDeclaration(value); + + bool is_inherited_property = IsInherited(); + bool initial = declaration.IsInitial(is_inherited_property); + bool inherit = declaration.IsInherit(is_inherited_property); + DCHECK(!(initial && inherit)); + + // TODO(andruud): Use regular initial/inherit dispatch in StyleBuilder + // once custom properties are Ribbonized. + if (initial) { + ApplyInitial(state); + } else if (inherit) { + ApplyInherit(state); + } else { + state.Style()->SetVariable(name_, declaration.Value(), + is_inherited_property); + if (registration_) { + state.Style()->SetRegisteredVariable(name_, nullptr, + is_inherited_property); + } + } +} + +const CSSValue* CustomProperty::ParseSingleValue( + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext& local_context) const { + using VariableMode = CSSParserLocalContext::VariableMode; + + switch (local_context.GetVariableMode()) { + case VariableMode::kTyped: + return ParseTyped(range, context, local_context); + case VariableMode::kUntyped: + return ParseUntyped(range, context, local_context); + case VariableMode::kValidatedUntyped: + if (registration_ && !ParseTyped(range, context, local_context)) + return nullptr; + return ParseUntyped(range, context, local_context); + } +} + +const CSSValue* CustomProperty::CSSValueFromComputedStyleInternal( + const ComputedStyle& style, + const SVGComputedStyle&, + const LayoutObject*, + Node* styled_node, + bool allow_visited_style) const { + if (registration_) { + const CSSValue* value = style.GetRegisteredVariable(name_, IsInherited()); + if (value) + return value; + // If we don't have CSSValue for this registered property, it means that + // that the property was not registered at the time |style| was calculated, + // hence we proceed with unregistered behavior. + } + + CSSVariableData* data = style.GetVariable(name_, IsInherited()); + + if (!data) + return nullptr; + + return CSSCustomPropertyDeclaration::Create(name_, data); +} + +const CSSValue* CustomProperty::ParseUntyped( + CSSParserTokenRange range, + const CSSParserContext& context, + const CSSParserLocalContext& local_context) const { + return CSSVariableParser::ParseDeclarationValue( + name_, range, local_context.IsAnimationTainted(), context); +} + +const CSSValue* CustomProperty::ParseTyped( + CSSParserTokenRange range, + const CSSParserContext& context, + const CSSParserLocalContext& local_context) const { + if (!registration_) + return ParseUntyped(range, context, local_context); + return registration_->Syntax().Parse(range, &context, + local_context.IsAnimationTainted()); +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property.h b/chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property.h new file mode 100644 index 00000000000..57a2f0fb393 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property.h @@ -0,0 +1,65 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTIES_LONGHANDS_CUSTOM_PROPERTY_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTIES_LONGHANDS_CUSTOM_PROPERTY_H_ + +#include "third_party/blink/renderer/core/css/properties/longhands/variable.h" + +#include "third_party/blink/renderer/core/css/property_registration.h" + +namespace blink { + +class PropertyRegistry; + +// Represents a custom property (both registered and unregistered). +// +// Unlike all other CSSProperty instances, instances of this class are +// allocated dynamically on demand. (See CSSPropertyRef). +// +// TODO(andruud): Move functionality from Variable to here, and eventually +// remove Variable. +class CORE_EXPORT CustomProperty : public Variable { + DISALLOW_NEW(); + + public: + CustomProperty() = default; + CustomProperty(const AtomicString& name, const Document&); + CustomProperty(const AtomicString& name, const PropertyRegistry*); + + bool IsInherited() const override; + const AtomicString& GetPropertyNameAtomicString() const override; + + void ApplyInitial(StyleResolverState&) const override; + void ApplyInherit(StyleResolverState&) const override; + void ApplyValue(StyleResolverState&, const CSSValue&) const override; + + const CSSValue* ParseSingleValue(CSSParserTokenRange&, + const CSSParserContext&, + const CSSParserLocalContext&) const override; + + const CSSValue* CSSValueFromComputedStyleInternal( + const ComputedStyle&, + const SVGComputedStyle&, + const LayoutObject*, + Node* styled_node, + bool allow_visited_style) const override; + + void Trace(blink::Visitor* visitor) { visitor->Trace(registration_); } + + private: + const CSSValue* ParseUntyped(CSSParserTokenRange, + const CSSParserContext&, + const CSSParserLocalContext&) const; + const CSSValue* ParseTyped(CSSParserTokenRange, + const CSSParserContext&, + const CSSParserLocalContext&) const; + + AtomicString name_; + Member<const PropertyRegistration> registration_; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTIES_LONGHANDS_CUSTOM_PROPERTY_H_ diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property_test.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property_test.cc new file mode 100644 index 00000000000..9224db4b406 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property_test.cc @@ -0,0 +1,197 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/longhands/custom_property.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/renderer/core/css/css_custom_property_declaration.h" +#include "third_party/blink/renderer/core/css/css_primitive_value.h" +#include "third_party/blink/renderer/core/css/css_test_helpers.h" +#include "third_party/blink/renderer/core/css/parser/css_parser_local_context.h" +#include "third_party/blink/renderer/core/css/parser/css_tokenizer.h" +#include "third_party/blink/renderer/core/dom/node_computed_style.h" +#include "third_party/blink/renderer/core/html/html_element.h" +#include "third_party/blink/renderer/core/testing/page_test_base.h" + +namespace blink { + +using namespace css_test_helpers; +using VariableMode = CSSParserLocalContext::VariableMode; + +namespace { + +class CustomPropertyTest : public PageTestBase { + public: + void SetElementWithStyle(const String& value) { + GetDocument().body()->SetInnerHTMLFromString("<div id='target' style='" + + value + "'></div>"); + UpdateAllLifecyclePhasesForTest(); + } + + const CSSValue* GetComputedValue(const CustomProperty& property) { + Element* node = GetDocument().getElementById("target"); + return property.CSSValueFromComputedStyle(node->ComputedStyleRef(), + nullptr /* layout_object*/, node, + false /* allow_visisted_style */); + } + + const CSSValue* ParseValue(const Longhand& property, + const String& value, + const CSSParserLocalContext& local_context) { + CSSTokenizer tokenizer(value); + const auto tokens = tokenizer.TokenizeToEOF(); + CSSParserTokenRange range(tokens); + CSSParserContext* context = CSSParserContext::Create(GetDocument()); + return property.ParseSingleValue(range, *context, local_context); + } +}; + +} // namespace + +TEST_F(CustomPropertyTest, UnregisteredPropertyIsInherited) { + CustomProperty property("--x", GetDocument()); + EXPECT_TRUE(property.IsInherited()); +} + +TEST_F(CustomPropertyTest, RegisteredNonInheritedPropertyIsNotInherited) { + RegisterProperty(GetDocument(), "--x", "<length>", "42px", false); + CustomProperty property("--x", GetDocument()); + EXPECT_FALSE(property.IsInherited()); +} + +TEST_F(CustomPropertyTest, RegisteredInheritedPropertyIsInherited) { + RegisterProperty(GetDocument(), "--x", "<length>", "42px", true); + CustomProperty property("--x", GetDocument()); + EXPECT_TRUE(property.IsInherited()); +} + +TEST_F(CustomPropertyTest, StaticVariableInstance) { + CustomProperty property("--x", GetDocument()); + EXPECT_FALSE(Variable::IsStaticInstance(property)); + EXPECT_TRUE(Variable::IsStaticInstance(GetCSSPropertyVariable())); +} + +TEST_F(CustomPropertyTest, PropertyID) { + CustomProperty property("--x", GetDocument()); + EXPECT_EQ(CSSPropertyVariable, property.PropertyID()); +} + +TEST_F(CustomPropertyTest, GetPropertyNameAtomicString) { + CustomProperty property("--x", GetDocument()); + EXPECT_EQ(AtomicString("--x"), property.GetPropertyNameAtomicString()); +} + +TEST_F(CustomPropertyTest, ComputedCSSValueUnregistered) { + CustomProperty property("--x", GetDocument()); + SetElementWithStyle("--x:foo"); + const CSSValue* value = GetComputedValue(property); + EXPECT_TRUE(value->IsCustomPropertyDeclaration()); + EXPECT_EQ("foo", value->CssText()); +} + +TEST_F(CustomPropertyTest, ComputedCSSValueInherited) { + RegisterProperty(GetDocument(), "--x", "<length>", "0px", true); + CustomProperty property("--x", GetDocument()); + SetElementWithStyle("--x:100px"); + const CSSValue* value = GetComputedValue(property); + ASSERT_TRUE(value->IsPrimitiveValue()); + const CSSPrimitiveValue* primitive_value = ToCSSPrimitiveValue(value); + EXPECT_EQ(100, primitive_value->GetIntValue()); +} + +TEST_F(CustomPropertyTest, ComputedCSSValueNonInherited) { + RegisterProperty(GetDocument(), "--x", "<length>", "0px", false); + CustomProperty property("--x", GetDocument()); + SetElementWithStyle("--x:100px"); + const CSSValue* value = GetComputedValue(property); + ASSERT_TRUE(value->IsPrimitiveValue()); + const CSSPrimitiveValue* primitive_value = ToCSSPrimitiveValue(value); + EXPECT_EQ(100, primitive_value->GetIntValue()); +} + +TEST_F(CustomPropertyTest, ComputedCSSValueInitial) { + RegisterProperty(GetDocument(), "--x", "<length>", "100px", false); + CustomProperty property("--x", GetDocument()); + SetElementWithStyle(""); // Do not apply --x. + const CSSValue* value = GetComputedValue(property); + ASSERT_TRUE(value->IsPrimitiveValue()); + const CSSPrimitiveValue* primitive_value = ToCSSPrimitiveValue(value); + EXPECT_EQ(100, primitive_value->GetIntValue()); +} + +TEST_F(CustomPropertyTest, ComputedCSSValueEmptyInitial) { + CustomProperty property("--x", GetDocument()); + SetElementWithStyle(""); // Do not apply --x. + const CSSValue* value = GetComputedValue(property); + EXPECT_FALSE(value); +} + +TEST_F(CustomPropertyTest, ComputedCSSValueLateRegistration) { + CustomProperty property("--x", GetDocument()); + SetElementWithStyle("--x:100px"); + RegisterProperty(GetDocument(), "--x", "<length>", "100px", false); + // The property was not registered when the style was computed, hence the + // computed value should be what we expect for an unregistered property. + const CSSValue* value = GetComputedValue(property); + EXPECT_TRUE(value->IsCustomPropertyDeclaration()); + EXPECT_EQ("100px", value->CssText()); +} + +TEST_F(CustomPropertyTest, ParseSingleValueUnregistered) { + CustomProperty property("--x", GetDocument()); + const CSSValue* value = + ParseValue(property, "100px", CSSParserLocalContext()); + ASSERT_TRUE(value->IsCustomPropertyDeclaration()); + EXPECT_EQ("100px", value->CssText()); +} + +TEST_F(CustomPropertyTest, ParseSingleValueAnimationTainted) { + CustomProperty property("--x", GetDocument()); + const CSSValue* value1 = ParseValue( + property, "100px", CSSParserLocalContext().WithAnimationTainted(true)); + const CSSValue* value2 = ParseValue( + property, "100px", CSSParserLocalContext().WithAnimationTainted(false)); + + EXPECT_TRUE( + ToCSSCustomPropertyDeclaration(value1)->Value()->IsAnimationTainted()); + EXPECT_FALSE( + ToCSSCustomPropertyDeclaration(value2)->Value()->IsAnimationTainted()); +} + +TEST_F(CustomPropertyTest, ParseSingleValueTyped) { + RegisterProperty(GetDocument(), "--x", "<length>", "0px", false); + CustomProperty property("--x", GetDocument()); + const CSSValue* value1 = + ParseValue(property, "100px", CSSParserLocalContext()); + EXPECT_TRUE(value1->IsPrimitiveValue()); + EXPECT_EQ(100, ToCSSPrimitiveValue(value1)->GetIntValue()); + + const CSSValue* value2 = + ParseValue(property, "maroon", CSSParserLocalContext()); + EXPECT_FALSE(value2); +} + +TEST_F(CustomPropertyTest, ParseSingleValueUntyped) { + RegisterProperty(GetDocument(), "--x", "<length>", "0px", false); + CustomProperty property("--x", GetDocument()); + const CSSValue* value = ParseValue( + property, "maroon", + CSSParserLocalContext().WithVariableMode(VariableMode::kUntyped)); + ASSERT_TRUE(value->IsCustomPropertyDeclaration()); + EXPECT_EQ("maroon", value->CssText()); +} + +TEST_F(CustomPropertyTest, ParseSingleValueValidatedUntyped) { + RegisterProperty(GetDocument(), "--x", "<length>", "0px", false); + CustomProperty property("--x", GetDocument()); + auto local_context = + CSSParserLocalContext().WithVariableMode(VariableMode::kValidatedUntyped); + const CSSValue* value1 = ParseValue(property, "100px", local_context); + ASSERT_TRUE(value1->IsCustomPropertyDeclaration()); + EXPECT_EQ("100px", value1->CssText()); + + const CSSValue* value2 = ParseValue(property, "maroon", local_context); + EXPECT_FALSE(value2); +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/cx_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/cx_custom.cc index 2acdba943a3..517c04ccd01 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/cx_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/cx_custom.cc @@ -8,14 +8,13 @@ #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Cx::ParseSingleValue(CSSParserTokenRange& range, - const CSSParserContext&, + const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeLengthOrPercent( - range, kSVGAttributeMode, kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_property_parser_helpers::ConsumeSVGGeometryPropertyLength( + range, context, kValueRangeAll); } const CSSValue* Cx::CSSValueFromComputedStyleInternal( @@ -28,5 +27,5 @@ const CSSValue* Cx::CSSValueFromComputedStyleInternal( style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/cy_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/cy_custom.cc index e3bc5b1dfab..97b5a99fba0 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/cy_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/cy_custom.cc @@ -8,14 +8,13 @@ #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Cy::ParseSingleValue(CSSParserTokenRange& range, - const CSSParserContext&, + const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeLengthOrPercent( - range, kSVGAttributeMode, kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_property_parser_helpers::ConsumeSVGGeometryPropertyLength( + range, context, kValueRangeAll); } const CSSValue* Cy::CSSValueFromComputedStyleInternal( @@ -28,5 +27,5 @@ const CSSValue* Cy::CSSValueFromComputedStyleInternal( style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/d_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/d_custom.cc index 0b56e58d910..c24d8c19491 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/d_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/d_custom.cc @@ -8,12 +8,12 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* D::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumePathOrNone(range); + return css_parsing_utils::ConsumePathOrNone(range); } const CSSValue* D::CSSValueFromComputedStyleInternal( @@ -27,5 +27,5 @@ const CSSValue* D::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(CSSValueNone); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/direction_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/direction_custom.cc index 7cd95e7323f..13c848354db 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/direction_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/direction_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/direction.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Direction::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -22,5 +22,5 @@ void Direction::ApplyValue(StyleResolverState& state, ToCSSIdentifierValue(value).ConvertTo<TextDirection>()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/display_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/display_custom.cc index 4d8e2fc6825..123540f454d 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/display_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/display_custom.cc @@ -11,7 +11,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Display::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, @@ -30,9 +30,9 @@ const CSSValue* Display::ParseSingleValue(CSSParserTokenRange& range, CSSParserTokenRange range_copy = range; CSSParserTokenRange args = - CSSPropertyParserHelpers::ConsumeFunction(range_copy); + css_property_parser_helpers::ConsumeFunction(range_copy); CSSCustomIdentValue* name = - CSSPropertyParserHelpers::ConsumeCustomIdent(args); + css_property_parser_helpers::ConsumeCustomIdent(args, context); // If we didn't get a custom-ident or didn't exhaust the function arguments // return nothing. @@ -92,5 +92,5 @@ void Display::ApplyValue(StyleResolverState& state, state.Style()->SetDisplayLayoutCustomName(layout_function_value.GetName()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/dominant_baseline_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/dominant_baseline_custom.cc index 85123ec2db7..cb4b4550253 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/dominant_baseline_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/dominant_baseline_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/dominant_baseline.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* DominantBaseline::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* DominantBaseline::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(svg_style.DominantBaseline()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/empty_cells_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/empty_cells_custom.cc index d12909378d7..cefac2dbff9 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/empty_cells_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/empty_cells_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/empty_cells.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* EmptyCells::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* EmptyCells::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.EmptyCells()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/fill_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/fill_custom.cc index 4f3bff29011..f266db3dd5a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/fill_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/fill_custom.cc @@ -9,12 +9,12 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Fill::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ParsePaintStroke(range, context); + return css_parsing_utils::ParsePaintStroke(range, context); } const CSSValue* Fill::CSSValueFromComputedStyleInternal( @@ -27,5 +27,5 @@ const CSSValue* Fill::CSSValueFromComputedStyleInternal( svg_style.FillPaint(), style.GetColor()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/fill_opacity_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/fill_opacity_custom.cc index 50809fc6b35..4ff579ef5aa 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/fill_opacity_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/fill_opacity_custom.cc @@ -11,13 +11,13 @@ namespace blink { class CSSParserLocalContext; -namespace CSSLonghand { +namespace css_longhand { const CSSValue* FillOpacity::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeAll); + return css_property_parser_helpers::ConsumeNumber(range, kValueRangeAll); } const CSSValue* FillOpacity::CSSValueFromComputedStyleInternal( @@ -30,5 +30,5 @@ const CSSValue* FillOpacity::CSSValueFromComputedStyleInternal( CSSPrimitiveValue::UnitType::kNumber); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/fill_rule_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/fill_rule_custom.cc index c496cdf7b7b..90e993eef6d 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/fill_rule_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/fill_rule_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/fill_rule.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* FillRule::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* FillRule::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(svg_style.FillRule()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/filter_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/filter_custom.cc index 8ceee228f32..74313572334 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/filter_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/filter_custom.cc @@ -10,12 +10,12 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Filter::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeFilterFunctionList(range, context); + return css_property_parser_helpers::ConsumeFilterFunctionList(range, context); } const CSSValue* Filter::CSSValueFromComputedStyleInternal( @@ -27,5 +27,5 @@ const CSSValue* Filter::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForFilter(style, style.Filter()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/flex_basis_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/flex_basis_custom.cc index fecc16d65ef..f186c4087b1 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/flex_basis_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/flex_basis_custom.cc @@ -9,7 +9,7 @@ #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* FlexBasis::ParseSingleValue( CSSParserTokenRange& range, @@ -17,8 +17,8 @@ const CSSValue* FlexBasis::ParseSingleValue( const CSSParserLocalContext&) const { // FIXME: Support intrinsic dimensions too. if (range.Peek().Id() == CSSValueAuto) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeLengthOrPercent( + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative); } @@ -32,5 +32,5 @@ const CSSValue* FlexBasis::CSSValueFromComputedStyleInternal( style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/flex_direction_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/flex_direction_custom.cc index 47f5aa587e3..50bd0037b7e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/flex_direction_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/flex_direction_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/flex_direction.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* FlexDirection::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* FlexDirection::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.FlexDirection()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/flex_grow_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/flex_grow_custom.cc index 144a0ec1bd5..7636c88f28c 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/flex_grow_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/flex_grow_custom.cc @@ -6,15 +6,16 @@ #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/style/computed_style.h" -#include "third_party/blink/renderer/platform/length.h" +#include "third_party/blink/renderer/platform/geometry/length.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* FlexGrow::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeNonNegative); + return css_property_parser_helpers::ConsumeNumber(range, + kValueRangeNonNegative); } const CSSValue* FlexGrow::CSSValueFromComputedStyleInternal( @@ -27,5 +28,5 @@ const CSSValue* FlexGrow::CSSValueFromComputedStyleInternal( CSSPrimitiveValue::UnitType::kNumber); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/flex_shrink_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/flex_shrink_custom.cc index f98dba4ab7c..6268696a385 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/flex_shrink_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/flex_shrink_custom.cc @@ -6,16 +6,17 @@ #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/style/computed_style.h" -#include "third_party/blink/renderer/platform/length.h" +#include "third_party/blink/renderer/platform/geometry/length.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* FlexShrink::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeNonNegative); + return css_property_parser_helpers::ConsumeNumber(range, + kValueRangeNonNegative); } const CSSValue* FlexShrink::CSSValueFromComputedStyleInternal( @@ -28,5 +29,5 @@ const CSSValue* FlexShrink::CSSValueFromComputedStyleInternal( CSSPrimitiveValue::UnitType::kNumber); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/flex_wrap_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/flex_wrap_custom.cc index 2c604c97966..4ecb245a842 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/flex_wrap_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/flex_wrap_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/flex_wrap.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* FlexWrap::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* FlexWrap::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.FlexWrap()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/float_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/float_custom.cc index 37c2bd54e46..3eacdda8eee 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/float_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/float_custom.cc @@ -7,7 +7,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Float::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -20,27 +20,5 @@ const CSSValue* Float::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.Floating()); } -void Float::ApplyValue(StyleResolverState& state, const CSSValue& value) const { - const CSSIdentifierValue& identifier_value = ToCSSIdentifierValue(value); - - EFloat f; - CSSValueID id = identifier_value.GetValueID(); - switch (id) { - case CSSValueInlineStart: - case CSSValueInlineEnd: - if ((id == CSSValueInlineStart) == - (state.Style()->Direction() == TextDirection::kLtr)) { - f = EFloat::kLeft; - } else { - f = EFloat::kRight; - } - break; - default: - f = identifier_value.ConvertTo<EFloat>(); - break; - } - state.Style()->SetFloating(f); -} - -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/flood_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/flood_color_custom.cc index a72ef4f7a08..6885c49ee22 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/flood_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/flood_color_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* FloodColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); + return css_property_parser_helpers::ConsumeColor(range, context.Mode()); } const blink::Color FloodColor::ColorIncludingFallback( @@ -37,5 +37,5 @@ const CSSValue* FloodColor::CSSValueFromComputedStyleInternal( style.FloodColor()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/flood_opacity_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/flood_opacity_custom.cc index 07130aeb339..768b47fc2ab 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/flood_opacity_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/flood_opacity_custom.cc @@ -8,13 +8,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* FloodOpacity::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeAll); + return css_property_parser_helpers::ConsumeNumber(range, kValueRangeAll); } const CSSValue* FloodOpacity::CSSValueFromComputedStyleInternal( @@ -27,5 +27,5 @@ const CSSValue* FloodOpacity::CSSValueFromComputedStyleInternal( CSSPrimitiveValue::UnitType::kNumber); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_family_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_family_custom.cc index 6b4097039ca..e417f758528 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_family_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_family_custom.cc @@ -10,13 +10,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* FontFamily::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeFontFamily(range); + return css_parsing_utils::ConsumeFontFamily(range); } const CSSValue* FontFamily::CSSValueFromComputedStyleInternal( @@ -28,5 +28,5 @@ const CSSValue* FontFamily::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForFontFamily(style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_feature_settings_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_feature_settings_custom.cc index 41f0a944f37..68ddb3d10c0 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_feature_settings_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_feature_settings_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* FontFeatureSettings::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeFontFeatureSettings(range); + return css_parsing_utils::ConsumeFontFeatureSettings(range); } const CSSValue* FontFeatureSettings::CSSValueFromComputedStyleInternal( @@ -38,5 +38,5 @@ const CSSValue* FontFeatureSettings::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_kerning_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_kerning_custom.cc index 56d651114fa..3d7d64c6a41 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_kerning_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_kerning_custom.cc @@ -7,7 +7,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* FontKerning::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -18,5 +18,5 @@ const CSSValue* FontKerning::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.GetFontDescription().GetKerning()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_size_adjust_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_size_adjust_custom.cc index 6c66e137f1b..182ee12b354 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_size_adjust_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_size_adjust_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/platform/runtime_enabled_features.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* FontSizeAdjust::ParseSingleValue( CSSParserTokenRange& range, @@ -18,8 +18,9 @@ const CSSValue* FontSizeAdjust::ParseSingleValue( const CSSParserLocalContext&) const { DCHECK(RuntimeEnabledFeatures::CSSFontSizeAdjustEnabled()); if (range.Peek().Id() == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeNonNegative); + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeNumber(range, + kValueRangeNonNegative); } const CSSValue* FontSizeAdjust::CSSValueFromComputedStyleInternal( @@ -35,5 +36,5 @@ const CSSValue* FontSizeAdjust::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(CSSValueNone); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_size_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_size_custom.cc index 70387fa1cb3..c7949a255a0 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_size_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_size_custom.cc @@ -11,13 +11,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* FontSize::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeFontSize( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + return css_parsing_utils::ConsumeFontSize( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kAllow); } const CSSValue* FontSize::CSSValueFromComputedStyleInternal( @@ -29,5 +30,5 @@ const CSSValue* FontSize::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForFontSize(style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_stretch_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_stretch_custom.cc index 8de80b777fd..e84ab2b5de8 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_stretch_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_stretch_custom.cc @@ -10,13 +10,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* FontStretch::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeFontStretch(range, context.Mode()); + return css_parsing_utils::ConsumeFontStretch(range, context.Mode()); } const CSSValue* FontStretch::CSSValueFromComputedStyleInternal( @@ -28,5 +28,5 @@ const CSSValue* FontStretch::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForFontStretch(style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_style_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_style_custom.cc index f4239d0f68b..0fece06ceda 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_style_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_style_custom.cc @@ -10,13 +10,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* FontStyle::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeFontStyle(range, context.Mode()); + return css_parsing_utils::ConsumeFontStyle(range, context.Mode()); } const CSSValue* FontStyle::CSSValueFromComputedStyleInternal( @@ -28,5 +28,5 @@ const CSSValue* FontStyle::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForFontStyle(style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_variant_caps_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_variant_caps_custom.cc index a1784986c48..d129401f182 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_variant_caps_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_variant_caps_custom.cc @@ -10,13 +10,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* FontVariantCaps::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeIdent< + return css_property_parser_helpers::ConsumeIdent< CSSValueNormal, CSSValueSmallCaps, CSSValueAllSmallCaps, CSSValuePetiteCaps, CSSValueAllPetiteCaps, CSSValueUnicase, CSSValueTitlingCaps>(range); @@ -31,5 +31,5 @@ const CSSValue* FontVariantCaps::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForFontVariantCaps(style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_variant_east_asian_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_variant_east_asian_custom.cc index ada95bfb47e..4fad3ff66eb 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_variant_east_asian_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_variant_east_asian_custom.cc @@ -10,14 +10,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* FontVariantEastAsian::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueNormal) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); FontVariantEastAsianParser east_asian_parser; do { @@ -38,5 +38,5 @@ const CSSValue* FontVariantEastAsian::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForFontVariantEastAsian(style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_variant_ligatures_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_variant_ligatures_custom.cc index 533510c52d8..3d0f7921443 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_variant_ligatures_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_variant_ligatures_custom.cc @@ -10,14 +10,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* FontVariantLigatures::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueNormal || range.Peek().Id() == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); FontVariantLigaturesParser ligatures_parser; do { @@ -38,5 +38,5 @@ const CSSValue* FontVariantLigatures::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForFontVariantLigatures(style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_variant_numeric_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_variant_numeric_custom.cc index 4f781142443..999082a7215 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_variant_numeric_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_variant_numeric_custom.cc @@ -10,14 +10,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* FontVariantNumeric::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueNormal) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); FontVariantNumericParser numeric_parser; do { @@ -38,5 +38,5 @@ const CSSValue* FontVariantNumeric::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForFontVariantNumeric(style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_variation_settings_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_variation_settings_custom.cc index 6c71543ecad..96c5224f019 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_variation_settings_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_variation_settings_custom.cc @@ -35,21 +35,21 @@ cssvalue::CSSFontVariationValue* ConsumeFontVariationTag( } double tag_value = 0; - if (!CSSPropertyParserHelpers::ConsumeNumberRaw(range, tag_value)) + if (!css_property_parser_helpers::ConsumeNumberRaw(range, tag_value)) return nullptr; return cssvalue::CSSFontVariationValue::Create(tag, clampTo<float>(tag_value)); } } // namespace -namespace CSSLonghand { +namespace css_longhand { const CSSValue* FontVariationSettings::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueNormal) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); CSSValueList* variation_settings = CSSValueList::CreateCommaSeparated(); do { cssvalue::CSSFontVariationValue* font_variation_value = @@ -57,7 +57,7 @@ const CSSValue* FontVariationSettings::ParseSingleValue( if (!font_variation_value) return nullptr; variation_settings->Append(*font_variation_value); - } while (CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(range)); + } while (css_property_parser_helpers::ConsumeCommaIncludingWhitespace(range)); return variation_settings; } @@ -82,5 +82,5 @@ const CSSValue* FontVariationSettings::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_weight_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_weight_custom.cc index fd211a3cabf..45f37e6d6e5 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/font_weight_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/font_weight_custom.cc @@ -10,13 +10,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* FontWeight::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeFontWeight(range, context.Mode()); + return css_parsing_utils::ConsumeFontWeight(range, context.Mode()); } const CSSValue* FontWeight::CSSValueFromComputedStyleInternal( @@ -28,5 +28,5 @@ const CSSValue* FontWeight::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForFontWeight(style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_auto_columns_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_auto_columns_custom.cc index c165ed1ab18..b1cf05a1232 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_auto_columns_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_auto_columns_custom.cc @@ -10,14 +10,15 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* GridAutoColumns::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeGridTrackList( - range, context.Mode(), CSSParsingUtils::TrackListType::kGridAuto); + return css_parsing_utils::ConsumeGridTrackList( + range, context, context.Mode(), + css_parsing_utils::TrackListType::kGridAuto); } // Specs mention that getComputedStyle() should return the used value of the @@ -36,5 +37,5 @@ const CSSValue* GridAutoColumns::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForGridTrackSizeList(kForColumns, style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_auto_flow_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_auto_flow_custom.cc index d45027906c4..5120a20c50a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_auto_flow_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_auto_flow_custom.cc @@ -10,20 +10,20 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* GridAutoFlow::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { CSSIdentifierValue* row_or_column_value = - CSSPropertyParserHelpers::ConsumeIdent<CSSValueRow, CSSValueColumn>( + css_property_parser_helpers::ConsumeIdent<CSSValueRow, CSSValueColumn>( range); CSSIdentifierValue* dense_algorithm = - CSSPropertyParserHelpers::ConsumeIdent<CSSValueDense>(range); + css_property_parser_helpers::ConsumeIdent<CSSValueDense>(range); if (!row_or_column_value) { row_or_column_value = - CSSPropertyParserHelpers::ConsumeIdent<CSSValueRow, CSSValueColumn>( + css_property_parser_helpers::ConsumeIdent<CSSValueRow, CSSValueColumn>( range); if (!row_or_column_value && !dense_algorithm) return nullptr; @@ -69,5 +69,5 @@ const CSSValue* GridAutoFlow::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_auto_rows_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_auto_rows_custom.cc index 455be520703..cb690bf9bc9 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_auto_rows_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_auto_rows_custom.cc @@ -10,14 +10,15 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* GridAutoRows::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeGridTrackList( - range, context.Mode(), CSSParsingUtils::TrackListType::kGridAuto); + return css_parsing_utils::ConsumeGridTrackList( + range, context, context.Mode(), + css_parsing_utils::TrackListType::kGridAuto); } const CSSValue* GridAutoRows::CSSValueFromComputedStyleInternal( @@ -29,5 +30,5 @@ const CSSValue* GridAutoRows::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForGridTrackSizeList(kForRows, style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_column_end_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_column_end_custom.cc index 69c716ba34d..7ac7e9760b5 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_column_end_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_column_end_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* GridColumnEnd::ParseSingleValue( CSSParserTokenRange& range, - const CSSParserContext&, + const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeGridLine(range); + return css_parsing_utils::ConsumeGridLine(range, context); } const CSSValue* GridColumnEnd::CSSValueFromComputedStyleInternal( @@ -27,5 +27,5 @@ const CSSValue* GridColumnEnd::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForGridPosition(style.GridColumnEnd()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_column_start_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_column_start_custom.cc index db39b83b1c9..d1a36822ad6 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_column_start_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_column_start_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* GridColumnStart::ParseSingleValue( CSSParserTokenRange& range, - const CSSParserContext&, + const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeGridLine(range); + return css_parsing_utils::ConsumeGridLine(range, context); } const CSSValue* GridColumnStart::CSSValueFromComputedStyleInternal( @@ -27,5 +27,5 @@ const CSSValue* GridColumnStart::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForGridPosition(style.GridColumnStart()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_row_end_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_row_end_custom.cc index 84515376ca8..df82567cdeb 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_row_end_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_row_end_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* GridRowEnd::ParseSingleValue( CSSParserTokenRange& range, - const CSSParserContext&, + const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeGridLine(range); + return css_parsing_utils::ConsumeGridLine(range, context); } const CSSValue* GridRowEnd::CSSValueFromComputedStyleInternal( @@ -27,5 +27,5 @@ const CSSValue* GridRowEnd::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForGridPosition(style.GridRowEnd()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_row_start_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_row_start_custom.cc index c104b9502ab..c7263362aff 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_row_start_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_row_start_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* GridRowStart::ParseSingleValue( CSSParserTokenRange& range, - const CSSParserContext&, + const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeGridLine(range); + return css_parsing_utils::ConsumeGridLine(range, context); } const CSSValue* GridRowStart::CSSValueFromComputedStyleInternal( @@ -27,5 +27,5 @@ const CSSValue* GridRowStart::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForGridPosition(style.GridRowStart()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_template_areas_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_template_areas_custom.cc index 67153f84505..17aee7d456b 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_template_areas_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_template_areas_custom.cc @@ -16,21 +16,21 @@ #include "third_party/blink/renderer/core/style/grid_area.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* GridTemplateAreas::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); NamedGridAreaMap grid_area_map; size_t row_count = 0; size_t column_count = 0; while (range.Peek().GetType() == kStringToken) { - if (!CSSParsingUtils::ParseGridTemplateAreasRow( + if (!css_parsing_utils::ParseGridTemplateAreasRow( range.ConsumeIncludingWhitespace().Value().ToString(), grid_area_map, row_count, column_count)) return nullptr; @@ -109,5 +109,5 @@ void GridTemplateAreas::ApplyValue(StyleResolverState& state, grid_template_areas_value.ColumnCount()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_template_columns_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_template_columns_custom.cc index d928c37f805..629599b8c55 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_template_columns_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_template_columns_custom.cc @@ -11,14 +11,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* GridTemplateColumns::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeGridTemplatesRowsOrColumns(range, - context.Mode()); + return css_parsing_utils::ConsumeGridTemplatesRowsOrColumns(range, context, + context.Mode()); } bool GridTemplateColumns::IsLayoutDependent(const ComputedStyle* style, @@ -36,5 +36,5 @@ const CSSValue* GridTemplateColumns::CSSValueFromComputedStyleInternal( style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_template_rows_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_template_rows_custom.cc index 9902a4c4384..5fff8e567b4 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_template_rows_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_template_rows_custom.cc @@ -11,14 +11,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* GridTemplateRows::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeGridTemplatesRowsOrColumns(range, - context.Mode()); + return css_parsing_utils::ConsumeGridTemplatesRowsOrColumns(range, context, + context.Mode()); } bool GridTemplateRows::IsLayoutDependent(const ComputedStyle* style, @@ -36,5 +36,5 @@ const CSSValue* GridTemplateRows::CSSValueFromComputedStyleInternal( style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/height_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/height_custom.cc index e2e707a71d9..4c843c38f23 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/height_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/height_custom.cc @@ -11,13 +11,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Height::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeWidthOrHeight( - range, context, CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + return css_parsing_utils::ConsumeWidthOrHeight( + range, context, css_property_parser_helpers::UnitlessQuirk::kAllow); } bool Height::IsLayoutDependent(const ComputedStyle* style, @@ -39,5 +39,5 @@ const CSSValue* Height::CSSValueFromComputedStyleInternal( style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/hyphens_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/hyphens_custom.cc index d38676b1815..126d04077d9 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/hyphens_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/hyphens_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/hyphens.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Hyphens::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* Hyphens::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.GetHyphens()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/image_orientation_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/image_orientation_custom.cc index 0c21d6cd7f2..839465070f7 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/image_orientation_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/image_orientation_custom.cc @@ -11,7 +11,7 @@ #include "third_party/blink/renderer/platform/runtime_enabled_features.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ImageOrientation::ParseSingleValue( CSSParserTokenRange& range, @@ -19,9 +19,9 @@ const CSSValue* ImageOrientation::ParseSingleValue( const CSSParserLocalContext&) const { DCHECK(RuntimeEnabledFeatures::ImageOrientationEnabled()); if (range.Peek().Id() == CSSValueFromImage) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); if (range.Peek().GetType() != kNumberToken) { - CSSPrimitiveValue* angle = CSSPropertyParserHelpers::ConsumeAngle( + CSSPrimitiveValue* angle = css_property_parser_helpers::ConsumeAngle( range, &context, base::Optional<WebFeature>()); if (angle && angle->GetDoubleValue() == 0) return angle; @@ -40,5 +40,5 @@ const CSSValue* ImageOrientation::CSSValueFromComputedStyleInternal( return CSSPrimitiveValue::Create(0, CSSPrimitiveValue::UnitType::kDegrees); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/image_rendering_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/image_rendering_custom.cc index 2afb6b3902d..75bd3729492 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/image_rendering_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/image_rendering_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/image_rendering.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ImageRendering::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* ImageRendering::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.ImageRendering()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/inline_size_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/inline_size_custom.cc index 5b7d8f892d8..0352962c3ad 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/inline_size_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/inline_size_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/layout/layout_object.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* InlineSize::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeWidthOrHeight(range, context); + return css_parsing_utils::ConsumeWidthOrHeight(range, context); } bool InlineSize::IsLayoutDependent(const ComputedStyle* style, @@ -23,5 +23,5 @@ bool InlineSize::IsLayoutDependent(const ComputedStyle* style, return layout_object && layout_object->IsBox(); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_block_end_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_block_end_custom.cc index 631aa57ae9e..fa897cfdc13 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_block_end_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_block_end_custom.cc @@ -10,15 +10,16 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* InsetBlockEnd::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeMarginOrOffset( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_parsing_utils::ConsumeMarginOrOffset( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_block_start_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_block_start_custom.cc index 27cbd329d83..0e86d55187a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_block_start_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_block_start_custom.cc @@ -10,15 +10,16 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* InsetBlockStart::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeMarginOrOffset( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_parsing_utils::ConsumeMarginOrOffset( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_inline_end_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_inline_end_custom.cc index 6b1113d3795..fb265c3584d 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_inline_end_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_inline_end_custom.cc @@ -10,15 +10,16 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* InsetInlineEnd::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeMarginOrOffset( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_parsing_utils::ConsumeMarginOrOffset( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_inline_start_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_inline_start_custom.cc index 2a394eba3d0..dd4b9b0b486 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_inline_start_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_inline_start_custom.cc @@ -10,15 +10,16 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* InsetInlineStart::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeMarginOrOffset( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_parsing_utils::ConsumeMarginOrOffset( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/isolation_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/isolation_custom.cc index 7e3a5078bad..4e27da49414 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/isolation_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/isolation_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/isolation.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Isolation::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* Isolation::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.Isolation()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/justify_content_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/justify_content_custom.cc index 20bb4725139..0bada6ec34c 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/justify_content_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/justify_content_custom.cc @@ -9,19 +9,19 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* JustifyContent::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { // justify-content property does not allow the <baseline-position> values. - if (CSSPropertyParserHelpers::IdentMatches<CSSValueFirst, CSSValueLast, - CSSValueBaseline>( + if (css_property_parser_helpers::IdentMatches<CSSValueFirst, CSSValueLast, + CSSValueBaseline>( range.Peek().Id())) return nullptr; - return CSSParsingUtils::ConsumeContentDistributionOverflowPosition( - range, CSSParsingUtils::IsContentPositionOrLeftOrRightKeyword); + return css_parsing_utils::ConsumeContentDistributionOverflowPosition( + range, css_parsing_utils::IsContentPositionOrLeftOrRightKeyword); } const CSSValue* JustifyContent::CSSValueFromComputedStyleInternal( @@ -35,5 +35,5 @@ const CSSValue* JustifyContent::CSSValueFromComputedStyleInternal( style.JustifyContent()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/justify_items_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/justify_items_custom.cc index 43e958f4ee8..327401ed601 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/justify_items_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/justify_items_custom.cc @@ -12,7 +12,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* JustifyItems::ParseSingleValue( CSSParserTokenRange& range, @@ -20,15 +20,18 @@ const CSSValue* JustifyItems::ParseSingleValue( const CSSParserLocalContext&) const { CSSParserTokenRange range_copy = range; // justify-items property does not allow the 'auto' value. - if (CSSPropertyParserHelpers::IdentMatches<CSSValueAuto>(range.Peek().Id())) + if (css_property_parser_helpers::IdentMatches<CSSValueAuto>( + range.Peek().Id())) return nullptr; CSSIdentifierValue* legacy = - CSSPropertyParserHelpers::ConsumeIdent<CSSValueLegacy>(range_copy); + css_property_parser_helpers::ConsumeIdent<CSSValueLegacy>(range_copy); CSSIdentifierValue* position_keyword = - CSSPropertyParserHelpers::ConsumeIdent<CSSValueCenter, CSSValueLeft, - CSSValueRight>(range_copy); - if (!legacy) - legacy = CSSPropertyParserHelpers::ConsumeIdent<CSSValueLegacy>(range_copy); + css_property_parser_helpers::ConsumeIdent<CSSValueCenter, CSSValueLeft, + CSSValueRight>(range_copy); + if (!legacy) { + legacy = + css_property_parser_helpers::ConsumeIdent<CSSValueLegacy>(range_copy); + } if (legacy) { range = range_copy; if (position_keyword) { @@ -39,8 +42,8 @@ const CSSValue* JustifyItems::ParseSingleValue( return legacy; } - return CSSParsingUtils::ConsumeSelfPositionOverflowPosition( - range, CSSParsingUtils::IsSelfPositionOrLeftOrRightKeyword); + return css_parsing_utils::ConsumeSelfPositionOverflowPosition( + range, css_parsing_utils::IsSelfPositionOrLeftOrRightKeyword); } const CSSValue* JustifyItems::CSSValueFromComputedStyleInternal( @@ -55,5 +58,5 @@ const CSSValue* JustifyItems::CSSValueFromComputedStyleInternal( : style.JustifyItems()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/justify_self_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/justify_self_custom.cc index 0cd0d27b556..68e13866043 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/justify_self_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/justify_self_custom.cc @@ -9,14 +9,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* JustifySelf::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeSelfPositionOverflowPosition( - range, CSSParsingUtils::IsSelfPositionOrLeftOrRightKeyword); + return css_parsing_utils::ConsumeSelfPositionOverflowPosition( + range, css_parsing_utils::IsSelfPositionOrLeftOrRightKeyword); } const CSSValue* JustifySelf::CSSValueFromComputedStyleInternal( @@ -29,5 +29,5 @@ const CSSValue* JustifySelf::CSSValueFromComputedStyleInternal( style.JustifySelf()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/left_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/left_custom.cc index 322894322db..e9f4074e5e4 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/left_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/left_custom.cc @@ -15,13 +15,14 @@ namespace blink { class CSSParserLocalContext; -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Left::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeMarginOrOffset( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + return css_parsing_utils::ConsumeMarginOrOffset( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kAllow); } bool Left::IsLayoutDependent(const ComputedStyle* style, @@ -39,5 +40,5 @@ const CSSValue* Left::CSSValueFromComputedStyleInternal( layout_object); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/letter_spacing_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/letter_spacing_custom.cc index 27c26b5c2df..612ec5b4c73 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/letter_spacing_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/letter_spacing_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* LetterSpacing::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ParseSpacing(range, context); + return css_parsing_utils::ParseSpacing(range, context); } const CSSValue* LetterSpacing::CSSValueFromComputedStyleInternal( @@ -29,5 +29,5 @@ const CSSValue* LetterSpacing::CSSValueFromComputedStyleInternal( return ZoomAdjustedPixelValue(style.LetterSpacing(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/lighting_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/lighting_color_custom.cc index 45ae29982d0..761f4f8b93c 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/lighting_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/lighting_color_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* LightingColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); + return css_property_parser_helpers::ConsumeColor(range, context.Mode()); } const blink::Color LightingColor::ColorIncludingFallback( @@ -37,5 +37,5 @@ const CSSValue* LightingColor::CSSValueFromComputedStyleInternal( style.LightingColor()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/line_break_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/line_break_custom.cc index 010d62acc5d..c980562989a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/line_break_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/line_break_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/line_break.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* LineBreak::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* LineBreak::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.GetLineBreak()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/line_height_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/line_height_custom.cc index 0f6b4a24ad7..585a3f2b92a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/line_height_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/line_height_custom.cc @@ -10,13 +10,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* LineHeight::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeLineHeight(range, context.Mode()); + return css_parsing_utils::ConsumeLineHeight(range, context.Mode()); } const CSSValue* LineHeight::CSSValueFromComputedStyleInternal( @@ -28,5 +28,5 @@ const CSSValue* LineHeight::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForLineHeight(style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/line_height_step_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/line_height_step_custom.cc index 0f94c53db55..68f5ca47b7a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/line_height_step_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/line_height_step_custom.cc @@ -10,14 +10,14 @@ #include "third_party/blink/renderer/core/css/zoom_adjusted_pixel_value.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* LineHeightStep::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeLength(range, context.Mode(), - kValueRangeNonNegative); + return css_property_parser_helpers::ConsumeLength(range, context.Mode(), + kValueRangeNonNegative); } const CSSValue* LineHeightStep::CSSValueFromComputedStyleInternal( @@ -29,5 +29,5 @@ const CSSValue* LineHeightStep::CSSValueFromComputedStyleInternal( return ZoomAdjustedPixelValue(style.LineHeightStep(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/list_style_image_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/list_style_image_custom.cc index 8563f505af3..597e9890cfd 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/list_style_image_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/list_style_image_custom.cc @@ -11,13 +11,13 @@ namespace blink { class CSSParserLocalContext; -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ListStyleImage::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeImageOrNone(range, &context); + return css_property_parser_helpers::ConsumeImageOrNone(range, &context); } const CSSValue* ListStyleImage::CSSValueFromComputedStyleInternal( @@ -37,5 +37,5 @@ void ListStyleImage::ApplyValue(StyleResolverState& state, state.GetStyleImage(CSSPropertyListStyleImage, value)); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/list_style_position_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/list_style_position_custom.cc index 984c1346f02..f723f944ba4 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/list_style_position_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/list_style_position_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/list_style_position.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ListStylePosition::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* ListStylePosition::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.ListStylePosition()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/list_style_type_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/list_style_type_custom.cc index 766f0ec3fe4..1e76b7a130d 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/list_style_type_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/list_style_type_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/list_style_type.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ListStyleType::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* ListStyleType::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.ListStyleType()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_block_end_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_block_end_custom.cc index 1472ef90e71..75e8af0220f 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_block_end_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_block_end_custom.cc @@ -10,15 +10,16 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* MarginBlockEnd::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeMarginOrOffset( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_parsing_utils::ConsumeMarginOrOffset( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_block_start_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_block_start_custom.cc index 1cea46eee03..92934df9ce3 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_block_start_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_block_start_custom.cc @@ -10,15 +10,16 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* MarginBlockStart::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeMarginOrOffset( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_parsing_utils::ConsumeMarginOrOffset( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_bottom_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_bottom_custom.cc index 01dfd4de9c7..ed9228046e3 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_bottom_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_bottom_custom.cc @@ -13,14 +13,15 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* MarginBottom::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeMarginOrOffset( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + return css_parsing_utils::ConsumeMarginOrOffset( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kAllow); } bool MarginBottom::IsLayoutDependent(const ComputedStyle* style, @@ -44,5 +45,5 @@ const CSSValue* MarginBottom::CSSValueFromComputedStyleInternal( style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_inline_end_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_inline_end_custom.cc index 5dd6bdcbf1a..ac895c4dd89 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_inline_end_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_inline_end_custom.cc @@ -10,15 +10,16 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* MarginInlineEnd::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeMarginOrOffset( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_parsing_utils::ConsumeMarginOrOffset( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_inline_start_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_inline_start_custom.cc index c4134551d94..058c5030209 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_inline_start_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_inline_start_custom.cc @@ -10,15 +10,16 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* MarginInlineStart::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeMarginOrOffset( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_parsing_utils::ConsumeMarginOrOffset( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_left_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_left_custom.cc index c040712a2a3..24e7d794ac2 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_left_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_left_custom.cc @@ -13,14 +13,15 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* MarginLeft::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeMarginOrOffset( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + return css_parsing_utils::ConsumeMarginOrOffset( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kAllow); } bool MarginLeft::IsLayoutDependent(const ComputedStyle* style, @@ -44,5 +45,5 @@ const CSSValue* MarginLeft::CSSValueFromComputedStyleInternal( style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_right_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_right_custom.cc index 2bc750d4e3f..6740f711fff 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_right_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_right_custom.cc @@ -13,14 +13,15 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* MarginRight::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeMarginOrOffset( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + return css_parsing_utils::ConsumeMarginOrOffset( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kAllow); } bool MarginRight::IsLayoutDependent(const ComputedStyle* style, @@ -58,5 +59,5 @@ const CSSValue* MarginRight::CSSValueFromComputedStyleInternal( return ZoomAdjustedPixelValue(value, style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_top_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_top_custom.cc index 6dc19f53f6d..7cac20e2153 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_top_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_top_custom.cc @@ -13,14 +13,15 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* MarginTop::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeMarginOrOffset( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + return css_parsing_utils::ConsumeMarginOrOffset( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kAllow); } bool MarginTop::IsLayoutDependent(const ComputedStyle* style, @@ -43,5 +44,5 @@ const CSSValue* MarginTop::CSSValueFromComputedStyleInternal( return ZoomAdjustedPixelValue(ToLayoutBox(layout_object)->MarginTop(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/marker_end_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/marker_end_custom.cc index b8813a24559..092e27b984a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/marker_end_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/marker_end_custom.cc @@ -11,15 +11,15 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* MarkerEnd::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeUrl(range, &context); + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeUrl(range, &context); } const CSSValue* MarkerEnd::CSSValueFromComputedStyleInternal( @@ -31,5 +31,5 @@ const CSSValue* MarkerEnd::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForSVGResource(svg_style.MarkerEndResource()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/marker_mid_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/marker_mid_custom.cc index 4f886cf502a..e6f75ae0833 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/marker_mid_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/marker_mid_custom.cc @@ -11,15 +11,15 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* MarkerMid::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeUrl(range, &context); + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeUrl(range, &context); } const CSSValue* MarkerMid::CSSValueFromComputedStyleInternal( @@ -31,5 +31,5 @@ const CSSValue* MarkerMid::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForSVGResource(svg_style.MarkerMidResource()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/marker_start_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/marker_start_custom.cc index fc475fbf8bc..8fcf23a05b0 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/marker_start_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/marker_start_custom.cc @@ -11,15 +11,15 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* MarkerStart::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeUrl(range, &context); + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeUrl(range, &context); } const CSSValue* MarkerStart::CSSValueFromComputedStyleInternal( @@ -32,5 +32,5 @@ const CSSValue* MarkerStart::CSSValueFromComputedStyleInternal( svg_style.MarkerStartResource()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/mask_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/mask_custom.cc index 4f7ca4ffce8..c891a09a861 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/mask_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/mask_custom.cc @@ -11,14 +11,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Mask::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeUrl(range, &context); + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeUrl(range, &context); } const CSSValue* Mask::CSSValueFromComputedStyleInternal( @@ -30,5 +30,5 @@ const CSSValue* Mask::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForSVGResource(svg_style.MaskerResource()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/mask_source_type_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/mask_source_type_custom.cc index 0490eb0f0b5..70c72ab01cc 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/mask_source_type_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/mask_source_type_custom.cc @@ -8,14 +8,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* MaskSourceType::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSParsingUtils::ConsumeMaskSourceType, range); + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_parsing_utils::ConsumeMaskSourceType, range); } static CSSValue* ValueForFillSourceType(EMaskSourceType type) { @@ -42,5 +42,5 @@ const CSSValue* MaskSourceType::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/mask_type_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/mask_type_custom.cc index bde23dfb9ac..ce1c69bc9b2 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/mask_type_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/mask_type_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/mask_type.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* MaskType::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* MaskType::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(svg_style.MaskType()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/max_block_size_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/max_block_size_custom.cc index acf81e5b40f..caaad31ad77 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/max_block_size_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/max_block_size_custom.cc @@ -7,14 +7,14 @@ #include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* MaxBlockSize::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeMaxWidthOrHeight(range, context); + return css_parsing_utils::ConsumeMaxWidthOrHeight(range, context); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/max_height_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/max_height_custom.cc index efc599c165e..76456f5d08e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/max_height_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/max_height_custom.cc @@ -9,14 +9,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* MaxHeight::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeMaxWidthOrHeight( - range, context, CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + return css_parsing_utils::ConsumeMaxWidthOrHeight( + range, context, css_property_parser_helpers::UnitlessQuirk::kAllow); } const CSSValue* MaxHeight::CSSValueFromComputedStyleInternal( @@ -31,5 +31,5 @@ const CSSValue* MaxHeight::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ZoomAdjustedPixelValueForLength(max_height, style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/max_inline_size_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/max_inline_size_custom.cc index 91e63e07405..b0a8c1d0cb7 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/max_inline_size_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/max_inline_size_custom.cc @@ -7,14 +7,14 @@ #include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* MaxInlineSize::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeMaxWidthOrHeight(range, context); + return css_parsing_utils::ConsumeMaxWidthOrHeight(range, context); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/max_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/max_width_custom.cc index 711c944a35d..5dd083dbbfc 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/max_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/max_width_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* MaxWidth::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeMaxWidthOrHeight( - range, context, CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + return css_parsing_utils::ConsumeMaxWidthOrHeight( + range, context, css_property_parser_helpers::UnitlessQuirk::kAllow); } const CSSValue* MaxWidth::CSSValueFromComputedStyleInternal( @@ -30,5 +30,5 @@ const CSSValue* MaxWidth::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ZoomAdjustedPixelValueForLength(max_width, style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/min_block_size_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/min_block_size_custom.cc index 7e82be7a46f..b5b6278ca7d 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/min_block_size_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/min_block_size_custom.cc @@ -8,14 +8,14 @@ #include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* MinBlockSize::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeWidthOrHeight(range, context); + return css_parsing_utils::ConsumeWidthOrHeight(range, context); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/min_height_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/min_height_custom.cc index 6ea9dec83cd..0f91093df1a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/min_height_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/min_height_custom.cc @@ -13,14 +13,14 @@ namespace blink { class CSSParserLocalContext; -namespace CSSLonghand { +namespace css_longhand { const CSSValue* MinHeight::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeWidthOrHeight( - range, context, CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + return css_parsing_utils::ConsumeWidthOrHeight( + range, context, css_property_parser_helpers::UnitlessQuirk::kAllow); } const CSSValue* MinHeight::CSSValueFromComputedStyleInternal( @@ -35,5 +35,5 @@ const CSSValue* MinHeight::CSSValueFromComputedStyleInternal( style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/min_inline_size_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/min_inline_size_custom.cc index 93a7aaa4f38..3f207f0a026 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/min_inline_size_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/min_inline_size_custom.cc @@ -8,14 +8,14 @@ #include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* MinInlineSize::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeWidthOrHeight(range, context); + return css_parsing_utils::ConsumeWidthOrHeight(range, context); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/min_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/min_width_custom.cc index 92f488b6ea8..a332e0a8cbb 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/min_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/min_width_custom.cc @@ -13,13 +13,13 @@ namespace blink { class CSSParserLocalContext; -namespace CSSLonghand { +namespace css_longhand { const CSSValue* MinWidth::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeWidthOrHeight( - range, context, CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + return css_parsing_utils::ConsumeWidthOrHeight( + range, context, css_property_parser_helpers::UnitlessQuirk::kAllow); } const CSSValue* MinWidth::CSSValueFromComputedStyleInternal( @@ -34,5 +34,5 @@ const CSSValue* MinWidth::CSSValueFromComputedStyleInternal( style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/mix_blend_mode_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/mix_blend_mode_custom.cc index e6453fd8693..601297a1b71 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/mix_blend_mode_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/mix_blend_mode_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/mix_blend_mode.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* MixBlendMode::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* MixBlendMode::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.GetBlendMode()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/object_fit_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/object_fit_custom.cc index fe43af9f307..13856d7b963 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/object_fit_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/object_fit_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/object_fit.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ObjectFit::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* ObjectFit::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.GetObjectFit()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/object_position_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/object_position_custom.cc index 29e04cdabb0..52edd499b33 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/object_position_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/object_position_custom.cc @@ -11,14 +11,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ObjectPosition::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { return ConsumePosition(range, context, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid, + css_property_parser_helpers::UnitlessQuirk::kForbid, base::Optional<WebFeature>()); } @@ -36,5 +36,5 @@ const CSSValue* ObjectPosition::CSSValueFromComputedStyleInternal( CSSValuePair::kKeepIdenticalValues); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/offset_anchor_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/offset_anchor_custom.cc index 47d0c45799e..f1d20ee301c 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/offset_anchor_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/offset_anchor_custom.cc @@ -12,9 +12,9 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { -using namespace CSSPropertyParserHelpers; +using namespace css_property_parser_helpers; const CSSValue* OffsetAnchor::ParseSingleValue( CSSParserTokenRange& range, @@ -36,5 +36,5 @@ const CSSValue* OffsetAnchor::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForPosition(style.OffsetAnchor(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/offset_distance_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/offset_distance_custom.cc index a68f4e163eb..fe0f5b0ff8e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/offset_distance_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/offset_distance_custom.cc @@ -7,17 +7,17 @@ #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" -#include "third_party/blink/renderer/platform/length.h" +#include "third_party/blink/renderer/platform/geometry/length.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* OffsetDistance::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeLengthOrPercent(range, context.Mode(), - kValueRangeAll); + return css_property_parser_helpers::ConsumeLengthOrPercent( + range, context.Mode(), kValueRangeAll); } const CSSValue* OffsetDistance::CSSValueFromComputedStyleInternal( @@ -30,5 +30,5 @@ const CSSValue* OffsetDistance::CSSValueFromComputedStyleInternal( style.OffsetDistance(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/offset_path_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/offset_path_custom.cc index e222f236ed6..31463258b2b 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/offset_path_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/offset_path_custom.cc @@ -8,13 +8,13 @@ #include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* OffsetPath::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeOffsetPath(range, context); + return css_parsing_utils::ConsumeOffsetPath(range, context); } const CSSValue* OffsetPath::CSSValueFromComputedStyleInternal( @@ -28,5 +28,5 @@ const CSSValue* OffsetPath::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(CSSValueNone); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/offset_position_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/offset_position_custom.cc index dc022d7129e..f7fa82fc16a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/offset_position_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/offset_position_custom.cc @@ -12,9 +12,9 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { -using namespace CSSPropertyParserHelpers; +using namespace css_property_parser_helpers; const CSSValue* OffsetPosition::ParseSingleValue( CSSParserTokenRange& range, @@ -41,5 +41,5 @@ const CSSValue* OffsetPosition::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForPosition(style.OffsetPosition(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/offset_rotate_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/offset_rotate_custom.cc index 7fe1a2bfcd0..de1a31d2bd8 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/offset_rotate_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/offset_rotate_custom.cc @@ -7,13 +7,13 @@ #include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* OffsetRotate::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeOffsetRotate(range, context); + return css_parsing_utils::ConsumeOffsetRotate(range, context); } const CSSValue* OffsetRotate::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -29,5 +29,5 @@ const CSSValue* OffsetRotate::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/opacity_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/opacity_custom.cc index 8d2d656efde..39e52b64fac 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/opacity_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/opacity_custom.cc @@ -8,12 +8,12 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Opacity::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeAll); + return css_property_parser_helpers::ConsumeNumber(range, kValueRangeAll); } const CSSValue* Opacity::CSSValueFromComputedStyleInternal( @@ -26,5 +26,5 @@ const CSSValue* Opacity::CSSValueFromComputedStyleInternal( CSSPrimitiveValue::UnitType::kNumber); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/order_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/order_custom.cc index 93d607766d2..b8e95bf557f 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/order_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/order_custom.cc @@ -8,12 +8,12 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Order::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeInteger(range); + return css_property_parser_helpers::ConsumeInteger(range); } const CSSValue* Order::CSSValueFromComputedStyleInternal( @@ -26,5 +26,5 @@ const CSSValue* Order::CSSValueFromComputedStyleInternal( CSSPrimitiveValue::UnitType::kNumber); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/orphans_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/orphans_custom.cc index 30efcefe46f..468c68c14d0 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/orphans_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/orphans_custom.cc @@ -8,12 +8,12 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Orphans::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumePositiveInteger(range); + return css_property_parser_helpers::ConsumePositiveInteger(range); } const CSSValue* Orphans::CSSValueFromComputedStyleInternal( @@ -26,5 +26,5 @@ const CSSValue* Orphans::CSSValueFromComputedStyleInternal( CSSPrimitiveValue::UnitType::kNumber); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/outline_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/outline_color_custom.cc index d3e3582da3d..aebb8f06d83 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/outline_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/outline_color_custom.cc @@ -11,7 +11,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* OutlineColor::ParseSingleValue( CSSParserTokenRange& range, @@ -19,8 +19,8 @@ const CSSValue* OutlineColor::ParseSingleValue( const CSSParserLocalContext&) const { // Allow the special focus color even in HTML Standard parsing mode. if (range.Peek().Id() == CSSValueWebkitFocusRingColor) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeColor(range, context.Mode()); } const blink::Color OutlineColor::ColorIncludingFallback( @@ -45,5 +45,5 @@ const CSSValue* OutlineColor::CSSValueFromComputedStyleInternal( style, style.OutlineColor()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/outline_offset_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/outline_offset_custom.cc index a0dcf6fcd62..a83f5a13983 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/outline_offset_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/outline_offset_custom.cc @@ -9,14 +9,14 @@ #include "third_party/blink/renderer/core/css/zoom_adjusted_pixel_value.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* OutlineOffset::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeLength(range, context.Mode(), - kValueRangeAll); + return css_property_parser_helpers::ConsumeLength(range, context.Mode(), + kValueRangeAll); } const CSSValue* OutlineOffset::CSSValueFromComputedStyleInternal( @@ -28,5 +28,5 @@ const CSSValue* OutlineOffset::CSSValueFromComputedStyleInternal( return ZoomAdjustedPixelValue(style.OutlineOffset(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/outline_style_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/outline_style_custom.cc index 85ebb2889bf..dabcba11d61 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/outline_style_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/outline_style_custom.cc @@ -8,7 +8,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* OutlineStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -41,5 +41,5 @@ void OutlineStyle::ApplyValue(StyleResolverState& state, state.Style()->SetOutlineStyle(identifier_value.ConvertTo<EBorderStyle>()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/outline_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/outline_width_custom.cc index d34a69a3fed..ce38ee02276 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/outline_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/outline_width_custom.cc @@ -9,14 +9,15 @@ #include "third_party/blink/renderer/core/css/zoom_adjusted_pixel_value.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* OutlineWidth::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeLineWidth( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_property_parser_helpers::ConsumeLineWidth( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kForbid); } const CSSValue* OutlineWidth::CSSValueFromComputedStyleInternal( @@ -28,5 +29,5 @@ const CSSValue* OutlineWidth::CSSValueFromComputedStyleInternal( return ZoomAdjustedPixelValue(style.OutlineWidth(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/overflow_anchor_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/overflow_anchor_custom.cc index 44c9069cd49..7bd0665462d 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/overflow_anchor_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/overflow_anchor_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/overflow_anchor.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* OverflowAnchor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* OverflowAnchor::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.OverflowAnchor()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/overflow_wrap_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/overflow_wrap_custom.cc index dc9adb59529..9bf7fe542f8 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/overflow_wrap_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/overflow_wrap_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/overflow_wrap.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* OverflowWrap::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* OverflowWrap::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.OverflowWrap()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/overflow_x_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/overflow_x_custom.cc index bc9b1e08011..46213f16eb4 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/overflow_x_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/overflow_x_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/overflow_x.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* OverflowX::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* OverflowX::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.OverflowX()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/overflow_y_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/overflow_y_custom.cc index 267cf121759..f006aee57c1 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/overflow_y_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/overflow_y_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/overflow_y.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* OverflowY::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* OverflowY::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.OverflowY()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/overscroll_behavior_x_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/overscroll_behavior_x_custom.cc index b175e01ebe9..257dd525840 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/overscroll_behavior_x_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/overscroll_behavior_x_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/overscroll_behavior_x.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* OverscrollBehaviorX::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* OverscrollBehaviorX::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.OverscrollBehaviorX()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/overscroll_behavior_y_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/overscroll_behavior_y_custom.cc index ce62081c754..69800afadf4 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/overscroll_behavior_y_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/overscroll_behavior_y_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/overscroll_behavior_y.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* OverscrollBehaviorY::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* OverscrollBehaviorY::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.OverscrollBehaviorY()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_block_end_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_block_end_custom.cc index d0764c3e0bb..499c6eacabb 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_block_end_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_block_end_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* PaddingBlockEnd::ParseSingleValue( CSSParserTokenRange& range, @@ -18,8 +18,8 @@ const CSSValue* PaddingBlockEnd::ParseSingleValue( const CSSParserLocalContext&) const { return ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_block_start_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_block_start_custom.cc index b431bcda79e..ebfbe2bc833 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_block_start_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_block_start_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* PaddingBlockStart::ParseSingleValue( CSSParserTokenRange& range, @@ -18,8 +18,8 @@ const CSSValue* PaddingBlockStart::ParseSingleValue( const CSSParserLocalContext&) const { return ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_bottom_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_bottom_custom.cc index c483b3c766e..9154c40885d 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_bottom_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_bottom_custom.cc @@ -12,7 +12,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* PaddingBottom::ParseSingleValue( CSSParserTokenRange& range, @@ -20,7 +20,7 @@ const CSSValue* PaddingBottom::ParseSingleValue( const CSSParserLocalContext&) const { return ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative, - CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + css_property_parser_helpers::UnitlessQuirk::kAllow); } bool PaddingBottom::IsLayoutDependent(const ComputedStyle* style, @@ -44,5 +44,5 @@ const CSSValue* PaddingBottom::CSSValueFromComputedStyleInternal( ToLayoutBox(layout_object)->ComputedCSSPaddingBottom(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_inline_end_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_inline_end_custom.cc index 371658bd81d..714efdb955b 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_inline_end_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_inline_end_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* PaddingInlineEnd::ParseSingleValue( CSSParserTokenRange& range, @@ -18,8 +18,8 @@ const CSSValue* PaddingInlineEnd::ParseSingleValue( const CSSParserLocalContext&) const { return ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_inline_start_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_inline_start_custom.cc index f5224eeb1d5..5e9e128306c 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_inline_start_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_inline_start_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* PaddingInlineStart::ParseSingleValue( CSSParserTokenRange& range, @@ -18,8 +18,8 @@ const CSSValue* PaddingInlineStart::ParseSingleValue( const CSSParserLocalContext&) const { return ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_left_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_left_custom.cc index 762006e8499..9620b075c17 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_left_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_left_custom.cc @@ -12,7 +12,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* PaddingLeft::ParseSingleValue( CSSParserTokenRange& range, @@ -20,7 +20,7 @@ const CSSValue* PaddingLeft::ParseSingleValue( const CSSParserLocalContext&) const { return ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative, - CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + css_property_parser_helpers::UnitlessQuirk::kAllow); } bool PaddingLeft::IsLayoutDependent(const ComputedStyle* style, @@ -44,5 +44,5 @@ const CSSValue* PaddingLeft::CSSValueFromComputedStyleInternal( ToLayoutBox(layout_object)->ComputedCSSPaddingLeft(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_right_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_right_custom.cc index c057367746e..848f041118e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_right_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_right_custom.cc @@ -12,7 +12,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* PaddingRight::ParseSingleValue( CSSParserTokenRange& range, @@ -20,7 +20,7 @@ const CSSValue* PaddingRight::ParseSingleValue( const CSSParserLocalContext&) const { return ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative, - CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + css_property_parser_helpers::UnitlessQuirk::kAllow); } bool PaddingRight::IsLayoutDependent(const ComputedStyle* style, @@ -44,5 +44,5 @@ const CSSValue* PaddingRight::CSSValueFromComputedStyleInternal( ToLayoutBox(layout_object)->ComputedCSSPaddingRight(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_top_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_top_custom.cc index 636ccb58bf1..4624004ab53 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_top_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_top_custom.cc @@ -12,7 +12,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* PaddingTop::ParseSingleValue( CSSParserTokenRange& range, @@ -20,7 +20,7 @@ const CSSValue* PaddingTop::ParseSingleValue( const CSSParserLocalContext&) const { return ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative, - CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + css_property_parser_helpers::UnitlessQuirk::kAllow); } bool PaddingTop::IsLayoutDependent(const ComputedStyle* style, @@ -44,5 +44,5 @@ const CSSValue* PaddingTop::CSSValueFromComputedStyleInternal( ToLayoutBox(layout_object)->ComputedCSSPaddingTop(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/page_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/page_custom.cc index 64b140d3bdd..68be30e287a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/page_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/page_custom.cc @@ -7,15 +7,15 @@ #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Page::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueAuto) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeCustomIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeCustomIdent(range, context); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/paint_order_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/paint_order_custom.cc index 05a9a44ebe0..6a0e2fdf0cb 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/paint_order_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/paint_order_custom.cc @@ -6,18 +6,17 @@ #include "third_party/blink/renderer/core/css/css_value_list.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" -#include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* PaintOrder::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueNormal) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); Vector<CSSValueID, 3> paint_type_list; CSSIdentifierValue* fill = nullptr; @@ -26,11 +25,11 @@ const CSSValue* PaintOrder::ParseSingleValue( do { CSSValueID id = range.Peek().Id(); if (id == CSSValueFill && !fill) - fill = CSSPropertyParserHelpers::ConsumeIdent(range); + fill = css_property_parser_helpers::ConsumeIdent(range); else if (id == CSSValueStroke && !stroke) - stroke = CSSPropertyParserHelpers::ConsumeIdent(range); + stroke = css_property_parser_helpers::ConsumeIdent(range); else if (id == CSSValueMarkers && !markers) - markers = CSSPropertyParserHelpers::ConsumeIdent(range); + markers = css_property_parser_helpers::ConsumeIdent(range); else return nullptr; paint_type_list.push_back(id); @@ -69,10 +68,39 @@ const CSSValue* PaintOrder::CSSValueFromComputedStyleInternal( const ComputedStyle&, const SVGComputedStyle& svg_style, const LayoutObject*, - Node* styled_node, + Node*, bool allow_visited_style) const { - return ComputedStyleUtils::PaintOrderToCSSValueList(svg_style); + const EPaintOrder paint_order = svg_style.PaintOrder(); + if (paint_order == kPaintOrderNormal) + return CSSIdentifierValue::Create(CSSValueNormal); + + // Table mapping to the shortest (canonical) form of the property. + // + // Per spec, if any keyword is omitted it will be added last using + // the standard ordering. So "stroke" implies an order "stroke fill + // markers" etc. From a serialization PoV this means we never need + // to emit the last keyword. + // + // https://svgwg.org/svg2-draft/painting.html#PaintOrder + static const uint8_t canonical_form[][2] = { + // kPaintOrderNormal is handled above. + {PT_FILL, PT_NONE}, // kPaintOrderFillStrokeMarkers + {PT_FILL, PT_MARKERS}, // kPaintOrderFillMarkersStroke + {PT_STROKE, PT_NONE}, // kPaintOrderStrokeFillMarkers + {PT_STROKE, PT_MARKERS}, // kPaintOrderStrokeMarkersFill + {PT_MARKERS, PT_NONE}, // kPaintOrderMarkersFillStroke + {PT_MARKERS, PT_STROKE}, // kPaintOrderMarkersStrokeFill + }; + DCHECK_LT(static_cast<size_t>(paint_order) - 1, base::size(canonical_form)); + CSSValueList* list = CSSValueList::CreateSpaceSeparated(); + for (const auto& keyword : canonical_form[paint_order - 1]) { + const auto paint_order_type = static_cast<EPaintOrderType>(keyword); + if (paint_order_type == PT_NONE) + break; + list->Append(*CSSIdentifierValue::Create(paint_order_type)); + } + return list; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/perspective_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/perspective_custom.cc index a781987d300..19f423c38b4 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/perspective_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/perspective_custom.cc @@ -12,20 +12,20 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Perspective::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext& localContext) const { if (range.Peek().Id() == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); - CSSPrimitiveValue* parsed_value = CSSPropertyParserHelpers::ConsumeLength( + return css_property_parser_helpers::ConsumeIdent(range); + CSSPrimitiveValue* parsed_value = css_property_parser_helpers::ConsumeLength( range, context.Mode(), kValueRangeAll); bool use_legacy_parsing = localContext.UseAliasParsing(); if (!parsed_value && use_legacy_parsing) { double perspective; - if (!CSSPropertyParserHelpers::ConsumeNumberRaw(range, perspective)) + if (!css_property_parser_helpers::ConsumeNumberRaw(range, perspective)) return nullptr; context.Count(WebFeature::kUnitlessPerspectiveInPerspectiveProperty); parsed_value = CSSPrimitiveValue::Create( @@ -48,5 +48,5 @@ const CSSValue* Perspective::CSSValueFromComputedStyleInternal( return ZoomAdjustedPixelValue(style.Perspective(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/perspective_origin_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/perspective_origin_custom.cc index e6a7c62ba1f..dc142e7e941 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/perspective_origin_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/perspective_origin_custom.cc @@ -13,14 +13,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* PerspectiveOrigin::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { return ConsumePosition(range, context, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid, + css_property_parser_helpers::UnitlessQuirk::kForbid, base::Optional<WebFeature>()); } @@ -58,5 +58,5 @@ const CSSValue* PerspectiveOrigin::CSSValueFromComputedStyleInternal( } } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/pointer_events_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/pointer_events_custom.cc index c501f1aaf2c..f7b562480dd 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/pointer_events_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/pointer_events_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/pointer_events.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* PointerEvents::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* PointerEvents::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.PointerEvents()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/position_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/position_custom.cc index 1b4c438e4dd..68fc098ae5f 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/position_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/position_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/position.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Position::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -21,5 +21,5 @@ void Position::ApplyInherit(StyleResolverState& state) const { state.Style()->SetPosition(state.ParentStyle()->GetPosition()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/quotes_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/quotes_custom.cc index 56874b3fb94..9524d5e9c8e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/quotes_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/quotes_custom.cc @@ -11,17 +11,17 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Quotes::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); CSSValueList* values = CSSValueList::CreateSpaceSeparated(); while (!range.AtEnd()) { CSSStringValue* parsed_value = - CSSPropertyParserHelpers::ConsumeString(range); + css_property_parser_helpers::ConsumeString(range); if (!parsed_value) return nullptr; values->Append(*parsed_value); @@ -53,5 +53,5 @@ const CSSValue* Quotes::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(CSSValueNone); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/r_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/r_custom.cc index fb272fcc38a..7f3111ad37e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/r_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/r_custom.cc @@ -8,14 +8,13 @@ #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* R::ParseSingleValue(CSSParserTokenRange& range, - const CSSParserContext&, + const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeLengthOrPercent( - range, kSVGAttributeMode, kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_property_parser_helpers::ConsumeSVGGeometryPropertyLength( + range, context, kValueRangeNonNegative); } const CSSValue* R::CSSValueFromComputedStyleInternal( @@ -28,5 +27,5 @@ const CSSValue* R::CSSValueFromComputedStyleInternal( style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/resize_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/resize_custom.cc index 9068e5b207f..f2cefd9e40b 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/resize_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/resize_custom.cc @@ -9,7 +9,7 @@ #include "third_party/blink/renderer/core/frame/web_feature.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Resize::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -25,30 +25,17 @@ void Resize::ApplyValue(StyleResolverState& state, const CSSIdentifierValue& identifier_value = ToCSSIdentifierValue(value); EResize r = EResize::kNone; - CSSValueID id = identifier_value.GetValueID(); - switch (id) { - case CSSValueAuto: - if (Settings* settings = state.GetDocument().GetSettings()) { - r = settings->GetTextAreasAreResizable() ? EResize::kBoth - : EResize::kNone; - } - UseCounter::Count(state.GetDocument(), WebFeature::kCSSResizeAuto); - break; - case CSSValueBlock: - case CSSValueInline: - if ((id == CSSValueBlock) == - IsHorizontalWritingMode(state.Style()->GetWritingMode())) { - r = EResize::kVertical; - } else { - r = EResize::kHorizontal; - } - break; - default: - r = identifier_value.ConvertTo<EResize>(); - break; + if (identifier_value.GetValueID() == CSSValueAuto) { + if (Settings* settings = state.GetDocument().GetSettings()) { + r = settings->GetTextAreasAreResizable() ? EResize::kBoth + : EResize::kNone; + } + UseCounter::Count(state.GetDocument(), WebFeature::kCSSResizeAuto); + } else { + r = identifier_value.ConvertTo<EResize>(); } state.Style()->SetResize(r); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/right_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/right_custom.cc index 3d7218df1c2..3ea427901af 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/right_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/right_custom.cc @@ -15,13 +15,14 @@ namespace blink { class CSSParserLocalContext; -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Right::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeMarginOrOffset( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + return css_parsing_utils::ConsumeMarginOrOffset( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kAllow); } bool Right::IsLayoutDependent(const ComputedStyle* style, @@ -39,5 +40,5 @@ const CSSValue* Right::CSSValueFromComputedStyleInternal( layout_object); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/rotate_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/rotate_custom.cc index b68f3b8fb77..69367f266a4 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/rotate_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/rotate_custom.cc @@ -11,7 +11,7 @@ #include "third_party/blink/renderer/platform/runtime_enabled_features.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Rotate::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, @@ -20,16 +20,16 @@ const CSSValue* Rotate::ParseSingleValue(CSSParserTokenRange& range, CSSValueID id = range.Peek().Id(); if (id == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); CSSValueList* list = CSSValueList::CreateSpaceSeparated(); - CSSValue* rotation = CSSPropertyParserHelpers::ConsumeAngle( + CSSValue* rotation = css_property_parser_helpers::ConsumeAngle( range, &context, base::Optional<WebFeature>()); CSSValueID axis_id = range.Peek().Id(); if (axis_id == CSSValueX) { - CSSPropertyParserHelpers::ConsumeIdent(range); + css_property_parser_helpers::ConsumeIdent(range); list->Append( *CSSPrimitiveValue::Create(1, CSSPrimitiveValue::UnitType::kNumber)); list->Append( @@ -37,7 +37,7 @@ const CSSValue* Rotate::ParseSingleValue(CSSParserTokenRange& range, list->Append( *CSSPrimitiveValue::Create(0, CSSPrimitiveValue::UnitType::kNumber)); } else if (axis_id == CSSValueY) { - CSSPropertyParserHelpers::ConsumeIdent(range); + css_property_parser_helpers::ConsumeIdent(range); list->Append( *CSSPrimitiveValue::Create(0, CSSPrimitiveValue::UnitType::kNumber)); list->Append( @@ -45,7 +45,7 @@ const CSSValue* Rotate::ParseSingleValue(CSSParserTokenRange& range, list->Append( *CSSPrimitiveValue::Create(0, CSSPrimitiveValue::UnitType::kNumber)); } else if (axis_id == CSSValueZ) { - CSSPropertyParserHelpers::ConsumeIdent(range); + css_property_parser_helpers::ConsumeIdent(range); list->Append( *CSSPrimitiveValue::Create(0, CSSPrimitiveValue::UnitType::kNumber)); list->Append( @@ -55,7 +55,7 @@ const CSSValue* Rotate::ParseSingleValue(CSSParserTokenRange& range, } else { for (unsigned i = 0; i < 3; i++) { // 3 dimensions of rotation CSSValue* dimension = - CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeAll); + css_property_parser_helpers::ConsumeNumber(range, kValueRangeAll); if (!dimension) { if (i == 0) break; @@ -66,7 +66,7 @@ const CSSValue* Rotate::ParseSingleValue(CSSParserTokenRange& range, } if (!rotation) { - rotation = CSSPropertyParserHelpers::ConsumeAngle( + rotation = css_property_parser_helpers::ConsumeAngle( range, &context, base::Optional<WebFeature>()); if (!rotation) return nullptr; @@ -100,5 +100,5 @@ const CSSValue* Rotate::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/row_gap_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/row_gap_custom.cc index c320f6f763b..5b5c1df1601 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/row_gap_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/row_gap_custom.cc @@ -11,12 +11,12 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* RowGap::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeGapLength(range, context); + return css_parsing_utils::ConsumeGapLength(range, context); } const CSSValue* RowGap::CSSValueFromComputedStyleInternal( @@ -28,5 +28,5 @@ const CSSValue* RowGap::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForGapLength(style.RowGap(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/rx_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/rx_custom.cc index 1df2543f1f3..231414c6601 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/rx_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/rx_custom.cc @@ -8,16 +8,15 @@ #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Rx::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueAuto) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeLengthOrPercent( - range, kSVGAttributeMode, kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeSVGGeometryPropertyLength( + range, context, kValueRangeNonNegative); } const CSSValue* Rx::CSSValueFromComputedStyleInternal( @@ -30,5 +29,5 @@ const CSSValue* Rx::CSSValueFromComputedStyleInternal( style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/ry_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/ry_custom.cc index 88d773f1aa2..d8f95008385 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/ry_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/ry_custom.cc @@ -8,16 +8,15 @@ #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Ry::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueAuto) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeLengthOrPercent( - range, kSVGAttributeMode, kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeSVGGeometryPropertyLength( + range, context, kValueRangeNonNegative); } const CSSValue* Ry::CSSValueFromComputedStyleInternal( @@ -30,5 +29,5 @@ const CSSValue* Ry::CSSValueFromComputedStyleInternal( style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/scale_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/scale_custom.cc index e2c747d37a9..461a180942a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/scale_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/scale_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/platform/runtime_enabled_features.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Scale::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, @@ -19,18 +19,18 @@ const CSSValue* Scale::ParseSingleValue(CSSParserTokenRange& range, CSSValueID id = range.Peek().Id(); if (id == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); CSSValue* scale = - CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeAll); + css_property_parser_helpers::ConsumeNumber(range, kValueRangeAll); if (!scale) return nullptr; CSSValueList* list = CSSValueList::CreateSpaceSeparated(); list->Append(*scale); - scale = CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeAll); + scale = css_property_parser_helpers::ConsumeNumber(range, kValueRangeAll); if (scale) { list->Append(*scale); - scale = CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeAll); + scale = css_property_parser_helpers::ConsumeNumber(range, kValueRangeAll); if (scale) list->Append(*scale); } @@ -58,5 +58,5 @@ const CSSValue* Scale::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_behavior_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_behavior_custom.cc index 16f81194168..ece75e07a8f 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_behavior_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_behavior_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/scroll_behavior.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ScrollBehavior::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* ScrollBehavior::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.GetScrollBehavior()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_customization_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_customization_custom.cc index 69dc5af8b40..8f1e4e47e8d 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_customization_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_customization_custom.cc @@ -20,11 +20,11 @@ static bool ConsumePan(CSSParserTokenRange& range, CSSValueID id = range.Peek().Id(); if ((id == CSSValuePanX || id == CSSValuePanRight || id == CSSValuePanLeft) && !*pan_x) { - *pan_x = CSSPropertyParserHelpers::ConsumeIdent(range); + *pan_x = css_property_parser_helpers::ConsumeIdent(range); } else if ((id == CSSValuePanY || id == CSSValuePanDown || id == CSSValuePanUp) && !*pan_y) { - *pan_y = CSSPropertyParserHelpers::ConsumeIdent(range); + *pan_y = css_property_parser_helpers::ConsumeIdent(range); } else { return false; } @@ -32,7 +32,7 @@ static bool ConsumePan(CSSParserTokenRange& range, } } // namespace -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ScrollCustomization::ParseSingleValue( CSSParserTokenRange& range, @@ -41,7 +41,7 @@ const CSSValue* ScrollCustomization::ParseSingleValue( CSSValueList* list = CSSValueList::CreateSpaceSeparated(); CSSValueID id = range.Peek().Id(); if (id == CSSValueAuto || id == CSSValueNone) { - list->Append(*CSSPropertyParserHelpers::ConsumeIdent(range)); + list->Append(*css_property_parser_helpers::ConsumeIdent(range)); return list; } @@ -69,5 +69,5 @@ const CSSValue* ScrollCustomization::CSSValueFromComputedStyleInternal( style.ScrollCustomization()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_block_end_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_block_end_custom.cc index 29fbe3c76c6..a835df34dcd 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_block_end_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_block_end_custom.cc @@ -10,15 +10,15 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ScrollMarginBlockEnd::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { return ConsumeLength(range, context.Mode(), kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_block_start_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_block_start_custom.cc index e6ba6321476..472e5b76052 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_block_start_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_block_start_custom.cc @@ -10,15 +10,15 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ScrollMarginBlockStart::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { return ConsumeLength(range, context.Mode(), kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_bottom_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_bottom_custom.cc index 5583fdc311e..978ebde3936 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_bottom_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_bottom_custom.cc @@ -10,14 +10,14 @@ #include "third_party/blink/renderer/core/css/zoom_adjusted_pixel_value.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ScrollMarginBottom::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { return ConsumeLength(range, context.Mode(), kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } const CSSValue* ScrollMarginBottom::CSSValueFromComputedStyleInternal( @@ -29,5 +29,5 @@ const CSSValue* ScrollMarginBottom::CSSValueFromComputedStyleInternal( return ZoomAdjustedPixelValue(style.ScrollMarginBottom(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_inline_end_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_inline_end_custom.cc index bb8b8236c77..7f17fd30c3c 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_inline_end_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_inline_end_custom.cc @@ -10,15 +10,15 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ScrollMarginInlineEnd::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { return ConsumeLength(range, context.Mode(), kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_inline_start_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_inline_start_custom.cc index 0a2668ca02c..cab85ffb07a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_inline_start_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_inline_start_custom.cc @@ -10,15 +10,15 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ScrollMarginInlineStart::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { return ConsumeLength(range, context.Mode(), kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_left_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_left_custom.cc index 362208441c8..a7fe021568e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_left_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_left_custom.cc @@ -10,14 +10,14 @@ #include "third_party/blink/renderer/core/css/zoom_adjusted_pixel_value.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ScrollMarginLeft::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { return ConsumeLength(range, context.Mode(), kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } const CSSValue* ScrollMarginLeft::CSSValueFromComputedStyleInternal( @@ -29,5 +29,5 @@ const CSSValue* ScrollMarginLeft::CSSValueFromComputedStyleInternal( return ZoomAdjustedPixelValue(style.ScrollMarginLeft(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_right_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_right_custom.cc index 2ce02b1564d..9769d15ddc7 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_right_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_right_custom.cc @@ -10,14 +10,14 @@ #include "third_party/blink/renderer/core/css/zoom_adjusted_pixel_value.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ScrollMarginRight::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { return ConsumeLength(range, context.Mode(), kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } const CSSValue* ScrollMarginRight::CSSValueFromComputedStyleInternal( @@ -29,5 +29,5 @@ const CSSValue* ScrollMarginRight::CSSValueFromComputedStyleInternal( return ZoomAdjustedPixelValue(style.ScrollMarginRight(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_top_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_top_custom.cc index e6ce2a2b4b9..5a9a4d42572 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_top_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_margin_top_custom.cc @@ -10,14 +10,14 @@ #include "third_party/blink/renderer/core/css/zoom_adjusted_pixel_value.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ScrollMarginTop::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { return ConsumeLength(range, context.Mode(), kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } const CSSValue* ScrollMarginTop::CSSValueFromComputedStyleInternal( @@ -29,5 +29,5 @@ const CSSValue* ScrollMarginTop::CSSValueFromComputedStyleInternal( return ZoomAdjustedPixelValue(style.ScrollMarginTop(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_block_end_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_block_end_custom.cc index 1f66c7e803b..d4d9484710f 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_block_end_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_block_end_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ScrollPaddingBlockEnd::ParseSingleValue( CSSParserTokenRange& range, @@ -18,8 +18,8 @@ const CSSValue* ScrollPaddingBlockEnd::ParseSingleValue( const CSSParserLocalContext&) const { return ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_block_start_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_block_start_custom.cc index 3c93e003db6..1a2ae5d04f0 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_block_start_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_block_start_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ScrollPaddingBlockStart::ParseSingleValue( CSSParserTokenRange& range, @@ -18,8 +18,8 @@ const CSSValue* ScrollPaddingBlockStart::ParseSingleValue( const CSSParserLocalContext&) const { return ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_bottom_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_bottom_custom.cc index 862abd5a324..fbce2ba039b 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_bottom_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_bottom_custom.cc @@ -9,7 +9,7 @@ #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ScrollPaddingBottom::ParseSingleValue( CSSParserTokenRange& range, @@ -17,7 +17,7 @@ const CSSValue* ScrollPaddingBottom::ParseSingleValue( const CSSParserLocalContext&) const { return ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } const CSSValue* ScrollPaddingBottom::CSSValueFromComputedStyleInternal( @@ -30,5 +30,5 @@ const CSSValue* ScrollPaddingBottom::CSSValueFromComputedStyleInternal( style.ScrollPaddingBottom(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_inline_end_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_inline_end_custom.cc index adaadd255d2..9bb8dd65868 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_inline_end_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_inline_end_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ScrollPaddingInlineEnd::ParseSingleValue( CSSParserTokenRange& range, @@ -18,8 +18,8 @@ const CSSValue* ScrollPaddingInlineEnd::ParseSingleValue( const CSSParserLocalContext&) const { return ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_inline_start_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_inline_start_custom.cc index 7a98a9b3f96..ee82bf526a8 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_inline_start_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_inline_start_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ScrollPaddingInlineStart::ParseSingleValue( CSSParserTokenRange& range, @@ -18,8 +18,8 @@ const CSSValue* ScrollPaddingInlineStart::ParseSingleValue( const CSSParserLocalContext&) const { return ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_left_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_left_custom.cc index ee232f22c70..d0a38ccfdf9 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_left_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_left_custom.cc @@ -9,7 +9,7 @@ #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ScrollPaddingLeft::ParseSingleValue( CSSParserTokenRange& range, @@ -17,7 +17,7 @@ const CSSValue* ScrollPaddingLeft::ParseSingleValue( const CSSParserLocalContext&) const { return ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } const CSSValue* ScrollPaddingLeft::CSSValueFromComputedStyleInternal( @@ -30,5 +30,5 @@ const CSSValue* ScrollPaddingLeft::CSSValueFromComputedStyleInternal( style.ScrollPaddingLeft(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_right_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_right_custom.cc index 089a2302b7a..987d1dcae86 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_right_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_right_custom.cc @@ -9,7 +9,7 @@ #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ScrollPaddingRight::ParseSingleValue( CSSParserTokenRange& range, @@ -17,7 +17,7 @@ const CSSValue* ScrollPaddingRight::ParseSingleValue( const CSSParserLocalContext&) const { return ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } const CSSValue* ScrollPaddingRight::CSSValueFromComputedStyleInternal( @@ -30,5 +30,5 @@ const CSSValue* ScrollPaddingRight::CSSValueFromComputedStyleInternal( style.ScrollPaddingRight(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_top_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_top_custom.cc index 80886a1b94c..6636efca5e0 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_top_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_padding_top_custom.cc @@ -9,7 +9,7 @@ #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ScrollPaddingTop::ParseSingleValue( CSSParserTokenRange& range, @@ -17,7 +17,7 @@ const CSSValue* ScrollPaddingTop::ParseSingleValue( const CSSParserLocalContext&) const { return ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } const CSSValue* ScrollPaddingTop::CSSValueFromComputedStyleInternal( @@ -30,5 +30,5 @@ const CSSValue* ScrollPaddingTop::CSSValueFromComputedStyleInternal( style.ScrollPaddingTop(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_snap_align_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_snap_align_custom.cc index 889016363c7..3fc3e664eb7 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_snap_align_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_snap_align_custom.cc @@ -10,20 +10,20 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ScrollSnapAlign::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - CSSValue* block_value = CSSPropertyParserHelpers::ConsumeIdent< + CSSValue* block_value = css_property_parser_helpers::ConsumeIdent< CSSValueNone, CSSValueStart, CSSValueEnd, CSSValueCenter>(range); if (!block_value) return nullptr; if (range.AtEnd()) return block_value; - CSSValue* inline_value = CSSPropertyParserHelpers::ConsumeIdent< + CSSValue* inline_value = css_property_parser_helpers::ConsumeIdent< CSSValueNone, CSSValueStart, CSSValueEnd, CSSValueCenter>(range); if (!inline_value) return block_value; @@ -42,5 +42,5 @@ const CSSValue* ScrollSnapAlign::CSSValueFromComputedStyleInternal( style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_snap_stop_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_snap_stop_custom.cc index 072376f4b23..38b79555e14 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_snap_stop_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_snap_stop_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/scroll_snap_stop.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ScrollSnapStop::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* ScrollSnapStop::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.ScrollSnapStop()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_snap_type_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_snap_type_custom.cc index 84d979ec0ab..edc61c33045 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_snap_type_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/scroll_snap_type_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ScrollSnapType::ParseSingleValue( CSSParserTokenRange& range, @@ -21,14 +21,14 @@ const CSSValue* ScrollSnapType::ParseSingleValue( axis_id != CSSValueBlock && axis_id != CSSValueInline && axis_id != CSSValueBoth) return nullptr; - CSSValue* axis_value = CSSPropertyParserHelpers::ConsumeIdent(range); + CSSValue* axis_value = css_property_parser_helpers::ConsumeIdent(range); if (range.AtEnd() || axis_id == CSSValueNone) return axis_value; CSSValueID strictness_id = range.Peek().Id(); if (strictness_id != CSSValueProximity && strictness_id != CSSValueMandatory) return axis_value; - CSSValue* strictness_value = CSSPropertyParserHelpers::ConsumeIdent(range); + CSSValue* strictness_value = css_property_parser_helpers::ConsumeIdent(range); CSSValuePair* pair = CSSValuePair::Create(axis_value, strictness_value, CSSValuePair::kDropIdenticalValues); return pair; @@ -44,5 +44,5 @@ const CSSValue* ScrollSnapType::CSSValueFromComputedStyleInternal( style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/shape_image_threshold_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/shape_image_threshold_custom.cc index 3a297190611..b9a90b43fce 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/shape_image_threshold_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/shape_image_threshold_custom.cc @@ -8,13 +8,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ShapeImageThreshold::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeAll); + return css_property_parser_helpers::ConsumeNumber(range, kValueRangeAll); } const CSSValue* ShapeImageThreshold::CSSValueFromComputedStyleInternal( @@ -27,5 +27,5 @@ const CSSValue* ShapeImageThreshold::CSSValueFromComputedStyleInternal( CSSPrimitiveValue::UnitType::kNumber); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/shape_margin_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/shape_margin_custom.cc index b7fafb30899..a541cd5c29a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/shape_margin_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/shape_margin_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ShapeMargin::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeLengthOrPercent( + return css_property_parser_helpers::ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative); } @@ -28,5 +28,5 @@ const CSSValue* ShapeMargin::CSSValueFromComputedStyleInternal( return CSSValue::Create(style.ShapeMargin(), style.EffectiveZoom()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/shape_outside_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/shape_outside_custom.cc index 7ee480ac605..27434eaab75 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/shape_outside_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/shape_outside_custom.cc @@ -12,9 +12,9 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { -using namespace CSSPropertyParserHelpers; +using namespace css_property_parser_helpers; const CSSValue* ShapeOutside::ParseSingleValue( CSSParserTokenRange& range, @@ -26,7 +26,7 @@ const CSSValue* ShapeOutside::ParseSingleValue( if (CSSValue* box_value = ConsumeShapeBox(range)) list->Append(*box_value); if (CSSValue* shape_value = - CSSParsingUtils::ConsumeBasicShape(range, context)) { + css_parsing_utils::ConsumeBasicShape(range, context)) { list->Append(*shape_value); if (list->length() < 2) { if (CSSValue* box_value = ConsumeShapeBox(range)) @@ -47,5 +47,5 @@ const CSSValue* ShapeOutside::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForShape(style, style.ShapeOutside()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/shape_rendering_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/shape_rendering_custom.cc index 901f7de5509..707fc51e844 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/shape_rendering_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/shape_rendering_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/shape_rendering.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ShapeRendering::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* ShapeRendering::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(svg_style.ShapeRendering()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/size_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/size_custom.cc index 5ed6ab5d3c8..1c6af681b8d 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/size_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/size_custom.cc @@ -10,10 +10,10 @@ #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { static CSSValue* ConsumePageSize(CSSParserTokenRange& range) { - return CSSPropertyParserHelpers::ConsumeIdent< + return css_property_parser_helpers::ConsumeIdent< CSSValueA3, CSSValueA4, CSSValueA5, CSSValueB4, CSSValueB5, CSSValueLedger, CSSValueLegal, CSSValueLetter>(range); } @@ -54,13 +54,13 @@ const CSSValue* Size::ParseSingleValue(CSSParserTokenRange& range, CSSValueList* result = CSSValueList::CreateSpaceSeparated(); if (range.Peek().Id() == CSSValueAuto) { - result->Append(*CSSPropertyParserHelpers::ConsumeIdent(range)); + result->Append(*css_property_parser_helpers::ConsumeIdent(range)); return result; } - if (CSSValue* width = CSSPropertyParserHelpers::ConsumeLength( + if (CSSValue* width = css_property_parser_helpers::ConsumeLength( range, context.Mode(), kValueRangeNonNegative)) { - CSSValue* height = CSSPropertyParserHelpers::ConsumeLength( + CSSValue* height = css_property_parser_helpers::ConsumeLength( range, context.Mode(), kValueRangeNonNegative); result->Append(*width); if (height) @@ -70,8 +70,8 @@ const CSSValue* Size::ParseSingleValue(CSSParserTokenRange& range, CSSValue* page_size = ConsumePageSize(range); CSSValue* orientation = - CSSPropertyParserHelpers::ConsumeIdent<CSSValuePortrait, - CSSValueLandscape>(range); + css_property_parser_helpers::ConsumeIdent<CSSValuePortrait, + CSSValueLandscape>(range); if (!page_size) page_size = ConsumePageSize(range); @@ -147,5 +147,5 @@ void Size::ApplyValue(StyleResolverState& state, const CSSValue& value) const { state.Style()->SetPageSize(size); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/speak_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/speak_custom.cc index 74983d0f8b2..46db889f029 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/speak_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/speak_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/speak.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Speak::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* Speak::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.Speak()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/stop_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/stop_color_custom.cc index 0d0cac293b7..ff92bf917b1 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/stop_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/stop_color_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* StopColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); + return css_property_parser_helpers::ConsumeColor(range, context.Mode()); } const blink::Color StopColor::ColorIncludingFallback( @@ -36,5 +36,5 @@ const CSSValue* StopColor::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::CurrentColorOrValidColor(style, style.StopColor()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/stop_opacity_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/stop_opacity_custom.cc index 551df8fe22e..8c34280915c 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/stop_opacity_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/stop_opacity_custom.cc @@ -8,13 +8,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* StopOpacity::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeAll); + return css_property_parser_helpers::ConsumeNumber(range, kValueRangeAll); } const CSSValue* StopOpacity::CSSValueFromComputedStyleInternal( @@ -27,5 +27,5 @@ const CSSValue* StopOpacity::CSSValueFromComputedStyleInternal( CSSPrimitiveValue::UnitType::kNumber); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_custom.cc index 99b51e88341..2a48ffc5a96 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_custom.cc @@ -9,12 +9,12 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Stroke::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ParsePaintStroke(range, context); + return css_parsing_utils::ParsePaintStroke(range, context); } const CSSValue* Stroke::CSSValueFromComputedStyleInternal( @@ -27,5 +27,5 @@ const CSSValue* Stroke::CSSValueFromComputedStyleInternal( svg_style.StrokePaint(), style.GetColor()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_dasharray_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_dasharray_custom.cc index b9b25b1eb11..214fb673c7f 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_dasharray_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_dasharray_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* StrokeDasharray::ParseSingleValue( CSSParserTokenRange& range, @@ -18,14 +18,15 @@ const CSSValue* StrokeDasharray::ParseSingleValue( const CSSParserLocalContext&) const { CSSValueID id = range.Peek().Id(); if (id == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); CSSValueList* dashes = CSSValueList::CreateCommaSeparated(); do { - CSSPrimitiveValue* dash = CSSPropertyParserHelpers::ConsumeLengthOrPercent( - range, kSVGAttributeMode, kValueRangeNonNegative); + CSSPrimitiveValue* dash = + css_property_parser_helpers::ConsumeLengthOrPercent( + range, kSVGAttributeMode, kValueRangeNonNegative); if (!dash || - (CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(range) && + (css_property_parser_helpers::ConsumeCommaIncludingWhitespace(range) && range.AtEnd())) return nullptr; dashes->Append(*dash); @@ -43,5 +44,5 @@ const CSSValue* StrokeDasharray::CSSValueFromComputedStyleInternal( *svg_style.StrokeDashArray(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_dashoffset_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_dashoffset_custom.cc index a6f3ab8d349..c0e1406ceb4 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_dashoffset_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_dashoffset_custom.cc @@ -8,15 +8,15 @@ #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* StrokeDashoffset::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeLengthOrPercent( + return css_property_parser_helpers::ConsumeLengthOrPercent( range, kSVGAttributeMode, kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); } const CSSValue* StrokeDashoffset::CSSValueFromComputedStyleInternal( @@ -29,5 +29,5 @@ const CSSValue* StrokeDashoffset::CSSValueFromComputedStyleInternal( style.StrokeDashOffset(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_linecap_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_linecap_custom.cc index 72f69396608..97d000ab119 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_linecap_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_linecap_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/stroke_linecap.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* StrokeLinecap::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* StrokeLinecap::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(svg_style.CapStyle()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_linejoin_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_linejoin_custom.cc index 1ee5aa3994a..74dc509c00c 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_linejoin_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_linejoin_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/stroke_linejoin.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* StrokeLinejoin::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* StrokeLinejoin::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(svg_style.JoinStyle()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_miterlimit_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_miterlimit_custom.cc index 61a3fe4bd10..ba2f77bf4a7 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_miterlimit_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_miterlimit_custom.cc @@ -8,13 +8,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* StrokeMiterlimit::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeNonNegative); + return css_property_parser_helpers::ConsumeNumber(range, + kValueRangeNonNegative); } const CSSValue* StrokeMiterlimit::CSSValueFromComputedStyleInternal( @@ -27,5 +28,5 @@ const CSSValue* StrokeMiterlimit::CSSValueFromComputedStyleInternal( CSSPrimitiveValue::UnitType::kNumber); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_opacity_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_opacity_custom.cc index 726c74a5112..0f4f7ffe448 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_opacity_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_opacity_custom.cc @@ -11,13 +11,13 @@ namespace blink { class CSSParserLocalContext; -namespace CSSLonghand { +namespace css_longhand { const CSSValue* StrokeOpacity::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeAll); + return css_property_parser_helpers::ConsumeNumber(range, kValueRangeAll); } const CSSValue* StrokeOpacity::CSSValueFromComputedStyleInternal( @@ -30,5 +30,5 @@ const CSSValue* StrokeOpacity::CSSValueFromComputedStyleInternal( CSSPrimitiveValue::UnitType::kNumber); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_width_custom.cc index 705680040fe..7c90d530e8e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/stroke_width_custom.cc @@ -8,15 +8,15 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* StrokeWidth::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeLengthOrPercent( - range, kSVGAttributeMode, kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_property_parser_helpers::ConsumeLengthOrPercent( + range, kSVGAttributeMode, kValueRangeNonNegative, + css_property_parser_helpers::UnitlessQuirk::kForbid); } const CSSValue* StrokeWidth::CSSValueFromComputedStyleInternal( @@ -33,5 +33,5 @@ const CSSValue* StrokeWidth::CSSValueFromComputedStyleInternal( return CSSValue::Create(length, style.EffectiveZoom()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/tab_size_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/tab_size_custom.cc index 60a76b70e7e..6ff737c2e17 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/tab_size_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/tab_size_custom.cc @@ -9,17 +9,17 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TabSize::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { CSSPrimitiveValue* parsed_value = - CSSPropertyParserHelpers::ConsumeInteger(range, 0); + css_property_parser_helpers::ConsumeInteger(range, 0); if (parsed_value) return parsed_value; - return CSSPropertyParserHelpers::ConsumeLength(range, context.Mode(), - kValueRangeNonNegative); + return css_property_parser_helpers::ConsumeLength(range, context.Mode(), + kValueRangeNonNegative); } const CSSValue* TabSize::CSSValueFromComputedStyleInternal( @@ -34,5 +34,5 @@ const CSSValue* TabSize::CSSValueFromComputedStyleInternal( : CSSPrimitiveValue::UnitType::kPixels); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/table_layout_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/table_layout_custom.cc index 33527a3bdd7..028428c4433 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/table_layout_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/table_layout_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/table_layout.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TableLayout::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* TableLayout::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.TableLayout()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_align_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_align_custom.cc index 4b614bd4faf..4377366d66d 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_align_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_align_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/text_align.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TextAlign::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -43,5 +43,5 @@ void TextAlign::ApplyValue(StyleResolverState& state, } } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_align_last_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_align_last_custom.cc index ff841754c43..37a2dafc678 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_align_last_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_align_last_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/text_align_last.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TextAlignLast::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* TextAlignLast::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.TextAlignLast()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_anchor_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_anchor_custom.cc index 4ab7953083d..b6fe998ce43 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_anchor_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_anchor_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/text_anchor.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TextAnchor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* TextAnchor::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(svg_style.TextAnchor()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_combine_upright_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_combine_upright_custom.cc index f219d0d4fcf..36087bf36a6 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_combine_upright_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_combine_upright_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/text_combine_upright.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TextCombineUpright::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* TextCombineUpright::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.TextCombine()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_decoration_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_decoration_color_custom.cc index 9215dd483ec..e7d5215360c 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_decoration_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_decoration_color_custom.cc @@ -10,13 +10,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TextDecorationColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); + return css_property_parser_helpers::ConsumeColor(range, context.Mode()); } const blink::Color TextDecorationColor::ColorIncludingFallback( @@ -38,5 +38,5 @@ const CSSValue* TextDecorationColor::CSSValueFromComputedStyleInternal( style, style.TextDecorationColor()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_decoration_line_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_decoration_line_custom.cc index 7a20bb815a7..c6b25d15e29 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_decoration_line_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_decoration_line_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TextDecorationLine::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeTextDecorationLine(range); + return css_parsing_utils::ConsumeTextDecorationLine(range); } const CSSValue* TextDecorationLine::CSSValueFromComputedStyleInternal( @@ -28,5 +28,5 @@ const CSSValue* TextDecorationLine::CSSValueFromComputedStyleInternal( style.GetTextDecoration()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_decoration_skip_ink_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_decoration_skip_ink_custom.cc index ff991853cce..b7786fcf102 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_decoration_skip_ink_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_decoration_skip_ink_custom.cc @@ -8,7 +8,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TextDecorationSkipInk::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -20,5 +20,5 @@ const CSSValue* TextDecorationSkipInk::CSSValueFromComputedStyleInternal( style.TextDecorationSkipInk()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_decoration_style_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_decoration_style_custom.cc index 19bd6b59362..b5afc9a0731 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_decoration_style_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_decoration_style_custom.cc @@ -8,7 +8,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TextDecorationStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -20,5 +20,5 @@ const CSSValue* TextDecorationStyle::CSSValueFromComputedStyleInternal( style.TextDecorationStyle()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_indent_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_indent_custom.cc index 2b3e126b407..a581d1e6da1 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_indent_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_indent_custom.cc @@ -12,7 +12,7 @@ #include "third_party/blink/renderer/platform/runtime_enabled_features.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TextIndent::ParseSingleValue( CSSParserTokenRange& range, @@ -25,9 +25,9 @@ const CSSValue* TextIndent::ParseSingleValue( CSSValue* each_line = nullptr; do { if (!length_percentage) { - length_percentage = CSSPropertyParserHelpers::ConsumeLengthOrPercent( + length_percentage = css_property_parser_helpers::ConsumeLengthOrPercent( range, context.Mode(), kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + css_property_parser_helpers::UnitlessQuirk::kAllow); if (length_percentage) { continue; } @@ -36,11 +36,11 @@ const CSSValue* TextIndent::ParseSingleValue( if (RuntimeEnabledFeatures::CSS3TextEnabled()) { CSSValueID id = range.Peek().Id(); if (!hanging && id == CSSValueHanging) { - hanging = CSSPropertyParserHelpers::ConsumeIdent(range); + hanging = css_property_parser_helpers::ConsumeIdent(range); continue; } if (!each_line && id == CSSValueEachLine) { - each_line = CSSPropertyParserHelpers::ConsumeIdent(range); + each_line = css_property_parser_helpers::ConsumeIdent(range); continue; } } @@ -122,5 +122,5 @@ void TextIndent::ApplyValue(StyleResolverState& state, state.Style()->SetTextIndentType(text_indent_type_value); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_justify_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_justify_custom.cc index 3d90c41da2b..14ea4675b6b 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_justify_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_justify_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/text_justify.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TextJustify::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* TextJustify::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.GetTextJustify()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_orientation_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_orientation_custom.cc index 80680e04cf4..e07fff1d0e9 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_orientation_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_orientation_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/text_orientation.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TextOrientation::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -22,5 +22,5 @@ void TextOrientation::ApplyValue(StyleResolverState& state, ToCSSIdentifierValue(value).ConvertTo<ETextOrientation>()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_overflow_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_overflow_custom.cc index 3a2b259c3ed..7d8863c63e1 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_overflow_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_overflow_custom.cc @@ -7,7 +7,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TextOverflow::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -20,5 +20,5 @@ const CSSValue* TextOverflow::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(CSSValueClip); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_rendering_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_rendering_custom.cc index e06ef3615bb..7dba68991f1 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_rendering_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_rendering_custom.cc @@ -7,7 +7,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TextRendering::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -18,5 +18,5 @@ const CSSValue* TextRendering::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.GetFontDescription().TextRendering()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_shadow_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_shadow_custom.cc index b6961ebf2e3..2c4a85746e2 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_shadow_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_shadow_custom.cc @@ -10,14 +10,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TextShadow::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeShadow( - range, context.Mode(), CSSParsingUtils::AllowInsetAndSpread::kForbid); + return css_parsing_utils::ConsumeShadow( + range, context.Mode(), css_parsing_utils::AllowInsetAndSpread::kForbid); } const CSSValue* TextShadow::CSSValueFromComputedStyleInternal( @@ -30,5 +30,5 @@ const CSSValue* TextShadow::CSSValueFromComputedStyleInternal( false); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_size_adjust_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_size_adjust_custom.cc index 9179c1dc0b9..865b9276310 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_size_adjust_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_size_adjust_custom.cc @@ -9,18 +9,18 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TextSizeAdjust::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueAuto) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); if (range.Peek().Id() == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumePercent(range, - kValueRangeNonNegative); + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumePercent(range, + kValueRangeNonNegative); } const CSSValue* TextSizeAdjust::CSSValueFromComputedStyleInternal( @@ -35,5 +35,5 @@ const CSSValue* TextSizeAdjust::CSSValueFromComputedStyleInternal( CSSPrimitiveValue::UnitType::kPercentage); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_transform_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_transform_custom.cc index 84332fa3c28..2a2a0f7df9b 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_transform_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_transform_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/text_transform.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TextTransform::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* TextTransform::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.TextTransform()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_underline_position_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_underline_position_custom.cc index 882eb40ca80..912e2606b86 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_underline_position_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_underline_position_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { // auto | [ under || [ left | right ] ] const CSSValue* TextUnderlinePosition::ParseSingleValue( @@ -18,18 +18,18 @@ const CSSValue* TextUnderlinePosition::ParseSingleValue( const CSSParserContext& context, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueAuto) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); CSSIdentifierValue* under_value = - CSSPropertyParserHelpers::ConsumeIdent<CSSValueUnder>(range); + css_property_parser_helpers::ConsumeIdent<CSSValueUnder>(range); CSSIdentifierValue* left_or_right_value = nullptr; if (RuntimeEnabledFeatures::TextUnderlinePositionLeftRightEnabled()) { left_or_right_value = - CSSPropertyParserHelpers::ConsumeIdent<CSSValueLeft, CSSValueRight>( + css_property_parser_helpers::ConsumeIdent<CSSValueLeft, CSSValueRight>( range); if (left_or_right_value && !under_value) { under_value = - CSSPropertyParserHelpers::ConsumeIdent<CSSValueUnder>(range); + css_property_parser_helpers::ConsumeIdent<CSSValueUnder>(range); } } if (!under_value && !left_or_right_value) { @@ -70,5 +70,5 @@ const CSSValue* TextUnderlinePosition::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/top_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/top_custom.cc index 8804de29e32..34328499657 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/top_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/top_custom.cc @@ -15,13 +15,14 @@ namespace blink { class CSSParserLocalContext; -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Top::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeMarginOrOffset( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + return css_parsing_utils::ConsumeMarginOrOffset( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kAllow); } bool Top::IsLayoutDependent(const ComputedStyle* style, @@ -39,5 +40,5 @@ const CSSValue* Top::CSSValueFromComputedStyleInternal( layout_object); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/touch_action_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/touch_action_custom.cc index 3905ac916a6..57897d6290c 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/touch_action_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/touch_action_custom.cc @@ -19,13 +19,13 @@ static bool ConsumePan(CSSParserTokenRange& range, CSSValueID id = range.Peek().Id(); if ((id == CSSValuePanX || id == CSSValuePanRight || id == CSSValuePanLeft) && !pan_x) { - pan_x = CSSPropertyParserHelpers::ConsumeIdent(range); + pan_x = css_property_parser_helpers::ConsumeIdent(range); } else if ((id == CSSValuePanY || id == CSSValuePanDown || id == CSSValuePanUp) && !pan_y) { - pan_y = CSSPropertyParserHelpers::ConsumeIdent(range); + pan_y = css_property_parser_helpers::ConsumeIdent(range); } else if (id == CSSValuePinchZoom && !pinch_zoom) { - pinch_zoom = CSSPropertyParserHelpers::ConsumeIdent(range); + pinch_zoom = css_property_parser_helpers::ConsumeIdent(range); } else { return false; } @@ -33,7 +33,7 @@ static bool ConsumePan(CSSParserTokenRange& range, } } // namespace -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TouchAction::ParseSingleValue( CSSParserTokenRange& range, @@ -42,7 +42,7 @@ const CSSValue* TouchAction::ParseSingleValue( CSSValueList* list = CSSValueList::CreateSpaceSeparated(); CSSValueID id = range.Peek().Id(); if (id == CSSValueAuto || id == CSSValueNone || id == CSSValueManipulation) { - list->Append(*CSSPropertyParserHelpers::ConsumeIdent(range)); + list->Append(*css_property_parser_helpers::ConsumeIdent(range)); return list; } @@ -74,5 +74,5 @@ const CSSValue* TouchAction::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::TouchActionFlagsToCSSValue(style.GetTouchAction()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_box_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_box_custom.cc index 137c2b0dab7..50dfff861b5 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_box_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_box_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/transform_box.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TransformBox::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* TransformBox::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.TransformBox()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_custom.cc index 133bedb6965..e419eb86f4c 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_custom.cc @@ -14,13 +14,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Transform::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext& local_context) const { - return CSSParsingUtils::ConsumeTransformList(range, context, local_context); + return css_parsing_utils::ConsumeTransformList(range, context, local_context); } bool Transform::IsLayoutDependent(const ComputedStyle* style, @@ -37,5 +37,5 @@ const CSSValue* Transform::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ComputedTransform(layout_object, style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_origin_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_origin_custom.cc index 1b17685c5d6..e5fd8d94be9 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_origin_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_origin_custom.cc @@ -13,7 +13,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TransformOrigin::ParseSingleValue( CSSParserTokenRange& range, @@ -21,20 +21,17 @@ const CSSValue* TransformOrigin::ParseSingleValue( const CSSParserLocalContext&) const { CSSValue* result_x = nullptr; CSSValue* result_y = nullptr; - if (CSSPropertyParserHelpers::ConsumeOneOrTwoValuedPosition( + if (css_property_parser_helpers::ConsumeOneOrTwoValuedPosition( range, context.Mode(), - CSSPropertyParserHelpers::UnitlessQuirk::kForbid, result_x, + css_property_parser_helpers::UnitlessQuirk::kForbid, result_x, result_y)) { CSSValueList* list = CSSValueList::CreateSpaceSeparated(); list->Append(*result_x); list->Append(*result_y); - CSSValue* result_z = CSSPropertyParserHelpers::ConsumeLength( + CSSValue* result_z = css_property_parser_helpers::ConsumeLength( range, context.Mode(), kValueRangeAll); - if (!result_z) { - result_z = - CSSPrimitiveValue::Create(0, CSSPrimitiveValue::UnitType::kPixels); - } - list->Append(*result_z); + if (result_z) + list->Append(*result_z); return list; } return nullptr; @@ -74,5 +71,5 @@ const CSSValue* TransformOrigin::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_style_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_style_custom.cc index e167986a014..60712b2ab6f 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_style_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_style_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/transform_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TransformStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -19,5 +19,5 @@ const CSSValue* TransformStyle::CSSValueFromComputedStyleInternal( : CSSValueFlat); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/transition_delay_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/transition_delay_custom.cc index 5fb5fc382c5..55a077efa5a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/transition_delay_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/transition_delay_custom.cc @@ -7,17 +7,17 @@ #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" #include "third_party/blink/renderer/core/style/computed_style.h" -#include "third_party/blink/renderer/platform/length.h" +#include "third_party/blink/renderer/platform/geometry/length.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TransitionDelay::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSPropertyParserHelpers::ConsumeTime, range, kValueRangeAll); + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_property_parser_helpers::ConsumeTime, range, kValueRangeAll); } const CSSValue* TransitionDelay::CSSValueFromComputedStyleInternal( @@ -37,5 +37,5 @@ const CSSValue* TransitionDelay::InitialValue() const { return value; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/transition_duration_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/transition_duration_custom.cc index 4055c9891b1..dadf1e03d0f 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/transition_duration_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/transition_duration_custom.cc @@ -7,17 +7,17 @@ #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" #include "third_party/blink/renderer/core/style/computed_style.h" -#include "third_party/blink/renderer/platform/length.h" +#include "third_party/blink/renderer/platform/geometry/length.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TransitionDuration::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSPropertyParserHelpers::ConsumeTime, range, kValueRangeNonNegative); + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_property_parser_helpers::ConsumeTime, range, kValueRangeNonNegative); } const CSSValue* TransitionDuration::CSSValueFromComputedStyleInternal( @@ -37,5 +37,5 @@ const CSSValue* TransitionDuration::InitialValue() const { return value; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/transition_property_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/transition_property_custom.cc index 2d5db6a1dec..407674c7647 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/transition_property_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/transition_property_custom.cc @@ -11,15 +11,15 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TransitionProperty::ParseSingleValue( CSSParserTokenRange& range, - const CSSParserContext&, + const CSSParserContext& context, const CSSParserLocalContext&) const { - CSSValueList* list = CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSParsingUtils::ConsumeTransitionProperty, range); - if (!list || !CSSParsingUtils::IsValidPropertyList(*list)) + CSSValueList* list = css_property_parser_helpers::ConsumeCommaSeparatedList( + css_parsing_utils::ConsumeTransitionProperty, range, context); + if (!list || !css_parsing_utils::IsValidPropertyList(*list)) return nullptr; return list; } @@ -39,5 +39,5 @@ const CSSValue* TransitionProperty::InitialValue() const { return value; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/transition_timing_function_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/transition_timing_function_custom.cc index fe475045bfa..50b2a1d5e3f 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/transition_timing_function_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/transition_timing_function_custom.cc @@ -10,14 +10,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* TransitionTimingFunction::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSParsingUtils::ConsumeAnimationTimingFunction, range); + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_parsing_utils::ConsumeAnimationTimingFunction, range); } const CSSValue* TransitionTimingFunction::CSSValueFromComputedStyleInternal( @@ -36,5 +36,5 @@ const CSSValue* TransitionTimingFunction::InitialValue() const { return value; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/translate_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/translate_custom.cc index d924ca40c22..e513d0ee54a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/translate_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/translate_custom.cc @@ -14,7 +14,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Translate::ParseSingleValue( CSSParserTokenRange& range, @@ -23,22 +23,27 @@ const CSSValue* Translate::ParseSingleValue( DCHECK(RuntimeEnabledFeatures::CSSIndependentTransformPropertiesEnabled()); CSSValueID id = range.Peek().Id(); if (id == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); - CSSValue* translate = CSSPropertyParserHelpers::ConsumeLengthOrPercent( + CSSValue* translate_x = css_property_parser_helpers::ConsumeLengthOrPercent( range, context.Mode(), kValueRangeAll); - if (!translate) + if (!translate_x) return nullptr; CSSValueList* list = CSSValueList::CreateSpaceSeparated(); - list->Append(*translate); - translate = CSSPropertyParserHelpers::ConsumeLengthOrPercent( - range, context.Mode(), kValueRangeAll); - if (translate) { - list->Append(*translate); - translate = CSSPropertyParserHelpers::ConsumeLength(range, context.Mode(), - kValueRangeAll); - if (translate) - list->Append(*translate); + list->Append(*translate_x); + CSSPrimitiveValue* translate_y = + css_property_parser_helpers::ConsumeLengthOrPercent(range, context.Mode(), + kValueRangeAll); + if (translate_y) { + CSSValue* translate_z = css_property_parser_helpers::ConsumeLength( + range, context.Mode(), kValueRangeAll); + if (translate_y->GetIntValue() == 0 && !translate_z) + return list; + + list->Append(*translate_y); + if (translate_z) { + list->Append(*translate_z); + } } return list; @@ -73,5 +78,5 @@ const CSSValue* Translate::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/unicode_bidi_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/unicode_bidi_custom.cc index 847227cff15..8680d3ec356 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/unicode_bidi_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/unicode_bidi_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/unicode_bidi.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* UnicodeBidi::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* UnicodeBidi::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.GetUnicodeBidi()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/user_select_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/user_select_custom.cc index 2c72d4e6ca0..5fca6fed2b0 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/user_select_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/user_select_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/user_select.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* UserSelect::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* UserSelect::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.UserSelect()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/variable.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/variable.cc index 398f185b0c5..4c21de56427 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/variable.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/variable.cc @@ -4,77 +4,12 @@ #include "third_party/blink/renderer/core/css/properties/longhands/variable.h" -#include "third_party/blink/renderer/core/css/css_custom_property_declaration.h" -#include "third_party/blink/renderer/core/css/property_registration.h" -#include "third_party/blink/renderer/core/css/property_registry.h" -#include "third_party/blink/renderer/core/style/computed_style.h" +#include "third_party/blink/renderer/core/css/properties/css_property.h" namespace blink { -namespace { - -void ApplyInitialValue(StyleResolverState& state, - const AtomicString& name, - const PropertyRegistration* registration) { - bool is_inherited_property = !registration || registration->Inherits(); - state.Style()->RemoveVariable(name, is_inherited_property); -} - -void ApplyInheritValue(StyleResolverState& state, - const AtomicString& name, - const PropertyRegistration* registration) { - bool is_inherited_property = !registration || registration->Inherits(); - state.Style()->RemoveVariable(name, is_inherited_property); - - CSSVariableData* parent_value = - state.ParentStyle()->GetVariable(name, is_inherited_property); - - if (!parent_value) - return; - - state.Style()->SetVariable(name, parent_value, is_inherited_property); - - if (registration) { - const CSSValue* parent_css_value = - parent_value ? state.ParentStyle()->GetRegisteredVariable( - name, is_inherited_property) - : nullptr; - state.Style()->SetRegisteredVariable(name, parent_css_value, - is_inherited_property); - } -} - -} // namespace - -void Variable::ApplyValue(StyleResolverState& state, - const CSSValue& value) const { - const CSSCustomPropertyDeclaration& declaration = - ToCSSCustomPropertyDeclaration(value); - const AtomicString& name = declaration.GetName(); - const PropertyRegistration* registration = nullptr; - const PropertyRegistry* registry = state.GetDocument().GetPropertyRegistry(); - if (registry) - registration = registry->Registration(name); - - bool is_inherited_property = !registration || registration->Inherits(); - bool initial = declaration.IsInitial(is_inherited_property); - bool inherit = declaration.IsInherit(is_inherited_property); - DCHECK(!(initial && inherit)); - - // TODO(andruud): Use regular initial/inherit dispatch in StyleBuilder - // once custom properties are Ribbonized. - if (initial) { - ApplyInitialValue(state, name, registration); - } else if (inherit) { - ApplyInheritValue(state, name, registration); - } else { - state.Style()->SetVariable(name, declaration.Value(), - is_inherited_property); - if (registration) { - state.Style()->SetRegisteredVariable(name, nullptr, - is_inherited_property); - } - } +bool Variable::IsStaticInstance(const CSSProperty& property) { + return &property == &GetCSSPropertyVariable(); } } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/variable.h b/chromium/third_party/blink/renderer/core/css/properties/longhands/variable.h index 6faf1e60701..cb0137e5c2b 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/variable.h +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/variable.h @@ -13,7 +13,9 @@ namespace blink { -class Variable final : public Longhand { +// TODO(andruud): Remove this class when the static Variable instance +// (as returned by GetCSSPropertyVariable()) has been removed. +class CORE_EXPORT Variable : public Longhand { public: constexpr Variable() : Longhand() {} @@ -25,18 +27,8 @@ class Variable final : public Longhand { DEFINE_STATIC_LOCAL(const AtomicString, name, ("variable")); return name; } - const CSSValue* CSSValueFromComputedStyleInternal( - const ComputedStyle&, - const SVGComputedStyle&, - const LayoutObject*, - Node*, - bool allow_visited_style) const override { - NOTREACHED(); - return nullptr; - } - void ApplyValue(StyleResolverState& state, - const CSSValue& value) const override; + static bool IsStaticInstance(const CSSProperty&); }; } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/vector_effect_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/vector_effect_custom.cc index 245092978a8..2c65fd53465 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/vector_effect_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/vector_effect_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/vector_effect.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* VectorEffect::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* VectorEffect::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(svg_style.VectorEffect()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/vertical_align_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/vertical_align_custom.cc index faebb54554b..33acfa75f5c 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/vertical_align_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/vertical_align_custom.cc @@ -10,18 +10,18 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* VerticalAlign::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - CSSValue* parsed_value = CSSPropertyParserHelpers::ConsumeIdentRange( + CSSValue* parsed_value = css_property_parser_helpers::ConsumeIdentRange( range, CSSValueBaseline, CSSValueWebkitBaselineMiddle); if (!parsed_value) { - parsed_value = CSSPropertyParserHelpers::ConsumeLengthOrPercent( + parsed_value = css_property_parser_helpers::ConsumeLengthOrPercent( range, context.Mode(), kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + css_property_parser_helpers::UnitlessQuirk::kAllow); } return parsed_value; } @@ -80,5 +80,5 @@ void VerticalAlign::ApplyValue(StyleResolverState& state, } } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/visibility_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/visibility_custom.cc index 674c338796f..bf661350510 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/visibility_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/visibility_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/visibility.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Visibility::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* Visibility::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.Visibility()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_app_region_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_app_region_custom.cc index acf27dac60f..b14f67f6250 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_app_region_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_app_region_custom.cc @@ -8,7 +8,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitAppRegion::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -38,5 +38,5 @@ void WebkitAppRegion::ApplyValue(StyleResolverState& state, state.GetDocument().SetHasAnnotatedRegions(true); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_appearance_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_appearance_custom.cc index 15407fff637..e548064bca0 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_appearance_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_appearance_custom.cc @@ -7,7 +7,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitAppearance::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -18,5 +18,5 @@ const CSSValue* WebkitAppearance::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.Appearance()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_horizontal_spacing_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_horizontal_spacing_custom.cc index 26d334c183b..965ce1c4f71 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_horizontal_spacing_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_horizontal_spacing_custom.cc @@ -9,14 +9,14 @@ #include "third_party/blink/renderer/core/css/zoom_adjusted_pixel_value.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitBorderHorizontalSpacing::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeLength(range, context.Mode(), - kValueRangeNonNegative); + return css_property_parser_helpers::ConsumeLength(range, context.Mode(), + kValueRangeNonNegative); } const CSSValue* @@ -29,5 +29,5 @@ WebkitBorderHorizontalSpacing::CSSValueFromComputedStyleInternal( return ZoomAdjustedPixelValue(style.HorizontalBorderSpacing(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_image_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_image_custom.cc index 700e42d5a6c..ae40d8937e0 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_image_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_image_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitBorderImage::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeWebkitBorderImage(range, context); + return css_parsing_utils::ConsumeWebkitBorderImage(range, context); } const CSSValue* WebkitBorderImage::CSSValueFromComputedStyleInternal( @@ -35,5 +35,5 @@ void WebkitBorderImage::ApplyValue(StyleResolverState& state, state.Style()->SetBorderImage(image); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_vertical_spacing_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_vertical_spacing_custom.cc index 113f14447fc..b0fd820cb86 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_vertical_spacing_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_vertical_spacing_custom.cc @@ -9,14 +9,14 @@ #include "third_party/blink/renderer/core/css/zoom_adjusted_pixel_value.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitBorderVerticalSpacing::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeLength(range, context.Mode(), - kValueRangeNonNegative); + return css_property_parser_helpers::ConsumeLength(range, context.Mode(), + kValueRangeNonNegative); } const CSSValue* WebkitBorderVerticalSpacing::CSSValueFromComputedStyleInternal( @@ -28,5 +28,5 @@ const CSSValue* WebkitBorderVerticalSpacing::CSSValueFromComputedStyleInternal( return ZoomAdjustedPixelValue(style.VerticalBorderSpacing(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_align_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_align_custom.cc index faeb97de4dd..5541d46614d 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_align_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_align_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/webkit_box_align.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitBoxAlign::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* WebkitBoxAlign::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.BoxAlign()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_decoration_break_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_decoration_break_custom.cc index f2e3bfc460a..25bc591dc1b 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_decoration_break_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_decoration_break_custom.cc @@ -7,7 +7,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitBoxDecorationBreak::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -20,5 +20,5 @@ const CSSValue* WebkitBoxDecorationBreak::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(CSSValueClone); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_direction_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_direction_custom.cc index 9b65e12dd84..9c27821b884 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_direction_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_direction_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/webkit_box_direction.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitBoxDirection::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* WebkitBoxDirection::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.BoxDirection()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_flex_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_flex_custom.cc index 1fde2e2fed8..5504909e0bd 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_flex_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_flex_custom.cc @@ -8,13 +8,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitBoxFlex::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeNumber(range, kValueRangeAll); + return css_property_parser_helpers::ConsumeNumber(range, kValueRangeAll); } const CSSValue* WebkitBoxFlex::CSSValueFromComputedStyleInternal( @@ -27,5 +27,5 @@ const CSSValue* WebkitBoxFlex::CSSValueFromComputedStyleInternal( CSSPrimitiveValue::UnitType::kNumber); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_ordinal_group_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_ordinal_group_custom.cc index 7ef8905eda4..502aaef4d83 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_ordinal_group_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_ordinal_group_custom.cc @@ -8,13 +8,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitBoxOrdinalGroup::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumePositiveInteger(range); + return css_property_parser_helpers::ConsumePositiveInteger(range); } const CSSValue* WebkitBoxOrdinalGroup::CSSValueFromComputedStyleInternal( @@ -27,5 +27,5 @@ const CSSValue* WebkitBoxOrdinalGroup::CSSValueFromComputedStyleInternal( CSSPrimitiveValue::UnitType::kNumber); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_orient_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_orient_custom.cc index 82dd04f19b8..ec1ace9bdd7 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_orient_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_orient_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/webkit_box_orient.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitBoxOrient::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* WebkitBoxOrient::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.BoxOrient()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_pack_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_pack_custom.cc index 9d8c74f6ed1..834b6e36dfd 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_pack_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_pack_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/webkit_box_pack.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitBoxPack::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* WebkitBoxPack::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.BoxPack()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_reflect_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_reflect_custom.cc index a370a0ee5bc..187e7478023 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_reflect_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_box_reflect_custom.cc @@ -17,7 +17,7 @@ namespace { CSSValue* ConsumeReflect(CSSParserTokenRange& range, const CSSParserContext& context) { - CSSIdentifierValue* direction = CSSPropertyParserHelpers::ConsumeIdent< + CSSIdentifierValue* direction = css_property_parser_helpers::ConsumeIdent< CSSValueAbove, CSSValueBelow, CSSValueLeft, CSSValueRight>(range); if (!direction) return nullptr; @@ -28,14 +28,14 @@ CSSValue* ConsumeReflect(CSSParserTokenRange& range, } else { offset = ConsumeLengthOrPercent( range, context.Mode(), kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + css_property_parser_helpers::UnitlessQuirk::kForbid); if (!offset) return nullptr; } CSSValue* mask = nullptr; if (!range.AtEnd()) { - mask = CSSParsingUtils::ConsumeWebkitBorderImage(range, context); + mask = css_parsing_utils::ConsumeWebkitBorderImage(range, context); if (!mask) return nullptr; } @@ -43,7 +43,7 @@ CSSValue* ConsumeReflect(CSSParserTokenRange& range, } } // namespace -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitBoxReflect::ParseSingleValue( CSSParserTokenRange& range, @@ -61,5 +61,5 @@ const CSSValue* WebkitBoxReflect::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForReflection(style.BoxReflect(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_font_size_delta_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_font_size_delta_custom.cc index 3a91866211e..ed33b92f2ff 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_font_size_delta_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_font_size_delta_custom.cc @@ -8,16 +8,16 @@ #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitFontSizeDelta::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeLength( + return css_property_parser_helpers::ConsumeLength( range, context.Mode(), kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + css_property_parser_helpers::UnitlessQuirk::kAllow); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_font_smoothing_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_font_smoothing_custom.cc index c6239aa39d0..7efe52b5b7d 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_font_smoothing_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_font_smoothing_custom.cc @@ -7,7 +7,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitFontSmoothing::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -18,5 +18,5 @@ const CSSValue* WebkitFontSmoothing::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.GetFontDescription().FontSmoothing()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_highlight_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_highlight_custom.cc index a464f6fbf49..04f5bc26246 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_highlight_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_highlight_custom.cc @@ -9,15 +9,15 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitHighlight::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeString(range); + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeString(range); } const CSSValue* WebkitHighlight::CSSValueFromComputedStyleInternal( @@ -31,5 +31,5 @@ const CSSValue* WebkitHighlight::CSSValueFromComputedStyleInternal( return CSSStringValue::Create(style.Highlight()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_hyphenate_character_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_hyphenate_character_custom.cc index fca12033eaa..8009063c998 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_hyphenate_character_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_hyphenate_character_custom.cc @@ -9,15 +9,15 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitHyphenateCharacter::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueAuto) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeString(range); + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeString(range); } const CSSValue* WebkitHyphenateCharacter::CSSValueFromComputedStyleInternal( @@ -31,5 +31,5 @@ const CSSValue* WebkitHyphenateCharacter::CSSValueFromComputedStyleInternal( return CSSStringValue::Create(style.HyphenationString()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_line_break_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_line_break_custom.cc index e2940892c2d..3e56971b4b9 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_line_break_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_line_break_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/webkit_line_break.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitLineBreak::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* WebkitLineBreak::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.GetLineBreak()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_line_clamp_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_line_clamp_custom.cc index 23a30d3d7f6..6bb0bb1bc73 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_line_clamp_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_line_clamp_custom.cc @@ -8,14 +8,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitLineClamp::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { // When specifying number of lines, don't allow 0 as a valid value. - return CSSPropertyParserHelpers::ConsumePositiveInteger(range); + return css_property_parser_helpers::ConsumePositiveInteger(range); } const CSSValue* WebkitLineClamp::CSSValueFromComputedStyleInternal( @@ -30,5 +30,5 @@ const CSSValue* WebkitLineClamp::CSSValueFromComputedStyleInternal( CSSPrimitiveValue::UnitType::kNumber); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_locale_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_locale_custom.cc index 96b3e203bb8..e603549ff25 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_locale_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_locale_custom.cc @@ -9,15 +9,15 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitLocale::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueAuto) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeString(range); + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeString(range); } const CSSValue* WebkitLocale::CSSValueFromComputedStyleInternal( @@ -42,5 +42,5 @@ void WebkitLocale::ApplyValue(StyleResolverState& state, } } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_after_collapse_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_after_collapse_custom.cc index 985fbc80880..cc9a58395ee 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_after_collapse_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_after_collapse_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/webkit_margin_after_collapse.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitMarginAfterCollapse::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* WebkitMarginAfterCollapse::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.MarginAfterCollapse()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_before_collapse_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_before_collapse_custom.cc index 10fb47023eb..d5aed0b912f 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_before_collapse_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_before_collapse_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/webkit_margin_before_collapse.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitMarginBeforeCollapse::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* WebkitMarginBeforeCollapse::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.MarginBeforeCollapse()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_bottom_collapse_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_bottom_collapse_custom.cc index 3965797b787..096a6a59c13 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_bottom_collapse_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_bottom_collapse_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/webkit_margin_bottom_collapse.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitMarginBottomCollapse::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* WebkitMarginBottomCollapse::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.MarginAfterCollapse()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_top_collapse_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_top_collapse_custom.cc index c2b5350e1b9..b249f9a086b 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_top_collapse_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_top_collapse_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/webkit_margin_top_collapse.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitMarginTopCollapse::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* WebkitMarginTopCollapse::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.MarginBeforeCollapse()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_outset_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_outset_custom.cc index 4e276e20827..f06733d65a2 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_outset_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_outset_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitMaskBoxImageOutset::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeBorderImageOutset(range); + return css_parsing_utils::ConsumeBorderImageOutset(range); } const CSSValue* WebkitMaskBoxImageOutset::CSSValueFromComputedStyleInternal( @@ -28,5 +28,5 @@ const CSSValue* WebkitMaskBoxImageOutset::CSSValueFromComputedStyleInternal( style.MaskBoxImage().Outset(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_repeat_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_repeat_custom.cc index ed21f3f8800..814a43b04bb 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_repeat_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_repeat_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitMaskBoxImageRepeat::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeBorderImageRepeat(range); + return css_parsing_utils::ConsumeBorderImageRepeat(range); } const CSSValue* WebkitMaskBoxImageRepeat::CSSValueFromComputedStyleInternal( @@ -27,5 +27,5 @@ const CSSValue* WebkitMaskBoxImageRepeat::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForNinePieceImageRepeat(style.MaskBoxImage()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_slice_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_slice_custom.cc index de6bd72960c..93383d22e55 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_slice_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_slice_custom.cc @@ -9,14 +9,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitMaskBoxImageSlice::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeBorderImageSlice( - range, CSSParsingUtils::DefaultFill::kNoFill); + return css_parsing_utils::ConsumeBorderImageSlice( + range, css_parsing_utils::DefaultFill::kNoFill); } const CSSValue* WebkitMaskBoxImageSlice::CSSValueFromComputedStyleInternal( @@ -28,5 +28,5 @@ const CSSValue* WebkitMaskBoxImageSlice::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForNinePieceImageSlice(style.MaskBoxImage()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_source_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_source_custom.cc index 7390074dd9a..dae0afee1c2 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_source_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_source_custom.cc @@ -11,13 +11,13 @@ namespace blink { class CSSParserLocalContext; -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitMaskBoxImageSource::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeImageOrNone(range, &context); + return css_property_parser_helpers::ConsumeImageOrNone(range, &context); } const CSSValue* WebkitMaskBoxImageSource::CSSValueFromComputedStyleInternal( @@ -37,5 +37,5 @@ void WebkitMaskBoxImageSource::ApplyValue(StyleResolverState& state, state.GetStyleImage(CSSPropertyWebkitMaskBoxImageSource, value)); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_width_custom.cc index 497407b6a3a..5480dac2b7f 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_width_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitMaskBoxImageWidth::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeBorderImageWidth(range); + return css_parsing_utils::ConsumeBorderImageWidth(range); } const CSSValue* WebkitMaskBoxImageWidth::CSSValueFromComputedStyleInternal( @@ -28,5 +28,5 @@ const CSSValue* WebkitMaskBoxImageWidth::CSSValueFromComputedStyleInternal( style.MaskBoxImage().BorderSlices(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_clip_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_clip_custom.cc index d42ed11f491..6b4721c41d9 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_clip_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_clip_custom.cc @@ -10,15 +10,15 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitMaskClip::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSParsingUtils::ConsumePrefixedBackgroundBox, range, - CSSParsingUtils::AllowTextValue::kAllow); + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_parsing_utils::ConsumePrefixedBackgroundBox, range, + css_parsing_utils::AllowTextValue::kAllow); } const CSSValue* WebkitMaskClip::CSSValueFromComputedStyleInternal( @@ -36,5 +36,5 @@ const CSSValue* WebkitMaskClip::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_composite_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_composite_custom.cc index 36a82ce4b75..65aa267478a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_composite_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_composite_custom.cc @@ -8,14 +8,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitMaskComposite::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSParsingUtils::ConsumeBackgroundComposite, range); + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_parsing_utils::ConsumeBackgroundComposite, range); } const CSSValue* WebkitMaskComposite::CSSValueFromComputedStyleInternal( @@ -31,5 +31,5 @@ const CSSValue* WebkitMaskComposite::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_image_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_image_custom.cc index cd7007c2e93..07f34cb7a3f 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_image_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_image_custom.cc @@ -9,14 +9,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitMaskImage::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSPropertyParserHelpers::ConsumeImageOrNone, range, &context); + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_property_parser_helpers::ConsumeImageOrNone, range, &context); } const CSSValue* WebkitMaskImage::CSSValueFromComputedStyleInternal( @@ -29,5 +29,5 @@ const CSSValue* WebkitMaskImage::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::BackgroundImageOrWebkitMaskImage(fill_layer); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_origin_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_origin_custom.cc index ecfc25b2308..1ef8a4bd92a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_origin_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_origin_custom.cc @@ -10,15 +10,15 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitMaskOrigin::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSParsingUtils::ConsumePrefixedBackgroundBox, range, - CSSParsingUtils::AllowTextValue::kForbid); + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_parsing_utils::ConsumePrefixedBackgroundBox, range, + css_parsing_utils::AllowTextValue::kForbid); } const CSSValue* WebkitMaskOrigin::CSSValueFromComputedStyleInternal( @@ -36,5 +36,5 @@ const CSSValue* WebkitMaskOrigin::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_position_x_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_position_x_custom.cc index 442bfafa946..5de6d2e0d79 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_position_x_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_position_x_custom.cc @@ -11,14 +11,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitMaskPositionX::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSParsingUtils::ConsumePositionLonghand<CSSValueLeft, CSSValueRight>, + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_parsing_utils::ConsumePositionLonghand<CSSValueLeft, CSSValueRight>, range, context.Mode()); } @@ -33,5 +33,5 @@ const CSSValue* WebkitMaskPositionX::CSSValueFromComputedStyleInternal( style, curr_layer); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_position_y_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_position_y_custom.cc index c61426e6e31..1327489a9ca 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_position_y_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_position_y_custom.cc @@ -11,14 +11,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitMaskPositionY::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeCommaSeparatedList( - CSSParsingUtils::ConsumePositionLonghand<CSSValueTop, CSSValueBottom>, + return css_property_parser_helpers::ConsumeCommaSeparatedList( + css_parsing_utils::ConsumePositionLonghand<CSSValueTop, CSSValueBottom>, range, context.Mode()); } @@ -33,5 +33,5 @@ const CSSValue* WebkitMaskPositionY::CSSValueFromComputedStyleInternal( style, curr_layer); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_size_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_size_custom.cc index 5a179bc208d..2f6565b60c4 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_size_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_size_custom.cc @@ -10,13 +10,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitMaskSize::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext& local_context) const { - return CSSParsingUtils::ParseBackgroundOrMaskSize( + return css_parsing_utils::ParseBackgroundOrMaskSize( range, context, local_context, WebFeature::kNegativeMaskSize); } @@ -30,5 +30,5 @@ const CSSValue* WebkitMaskSize::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::BackgroundImageOrWebkitMaskSize(style, fill_layer); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_perspective_origin_x_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_perspective_origin_x_custom.cc index 1320f1a9035..8b2599d0cc7 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_perspective_origin_x_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_perspective_origin_x_custom.cc @@ -9,15 +9,16 @@ #include "third_party/blink/renderer/core/css_value_keywords.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitPerspectiveOriginX::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumePositionLonghand<CSSValueLeft, CSSValueRight>( + return css_parsing_utils::ConsumePositionLonghand<CSSValueLeft, + CSSValueRight>( range, context.Mode()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_perspective_origin_y_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_perspective_origin_y_custom.cc index dde58f0021f..3b4020f3c1a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_perspective_origin_y_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_perspective_origin_y_custom.cc @@ -9,15 +9,16 @@ #include "third_party/blink/renderer/core/css_value_keywords.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitPerspectiveOriginY::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumePositionLonghand<CSSValueTop, CSSValueBottom>( + return css_parsing_utils::ConsumePositionLonghand<CSSValueTop, + CSSValueBottom>( range, context.Mode()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_print_color_adjust_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_print_color_adjust_custom.cc index fd9a805f78b..6f2f4def100 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_print_color_adjust_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_print_color_adjust_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/webkit_print_color_adjust.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitPrintColorAdjust::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* WebkitPrintColorAdjust::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.PrintColorAdjust()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_rtl_ordering_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_rtl_ordering_custom.cc index 7b951869cec..7419992f18e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_rtl_ordering_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_rtl_ordering_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/webkit_rtl_ordering.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitRtlOrdering::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -18,5 +18,5 @@ const CSSValue* WebkitRtlOrdering::CSSValueFromComputedStyleInternal( : CSSValueLogical); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_ruby_position_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_ruby_position_custom.cc index 79cfda5c7a3..27992bae1c8 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_ruby_position_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_ruby_position_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/webkit_ruby_position.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitRubyPosition::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* WebkitRubyPosition::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.GetRubyPosition()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_tap_highlight_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_tap_highlight_color_custom.cc index 6294875e7af..f438a4bc1ab 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_tap_highlight_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_tap_highlight_color_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitTapHighlightColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); + return css_property_parser_helpers::ConsumeColor(range, context.Mode()); } const blink::Color WebkitTapHighlightColor::ColorIncludingFallback( @@ -37,5 +37,5 @@ const CSSValue* WebkitTapHighlightColor::CSSValueFromComputedStyleInternal( style, style.TapHighlightColor()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_combine_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_combine_custom.cc index d4c3ec458f8..ba24bd2364e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_combine_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_combine_custom.cc @@ -7,7 +7,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitTextCombine::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -20,5 +20,5 @@ const CSSValue* WebkitTextCombine::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.TextCombine()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_decorations_in_effect_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_decorations_in_effect_custom.cc index b849101df4c..af03a24e751 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_decorations_in_effect_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_decorations_in_effect_custom.cc @@ -9,13 +9,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitTextDecorationsInEffect::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext&, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeTextDecorationLine(range); + return css_parsing_utils::ConsumeTextDecorationLine(range); } const CSSValue* @@ -29,5 +29,5 @@ WebkitTextDecorationsInEffect::CSSValueFromComputedStyleInternal( style.TextDecorationsInEffect()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_emphasis_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_emphasis_color_custom.cc index 5b748146760..fa8356403d6 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_emphasis_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_emphasis_color_custom.cc @@ -10,13 +10,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitTextEmphasisColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); + return css_property_parser_helpers::ConsumeColor(range, context.Mode()); } const blink::Color WebkitTextEmphasisColor::ColorIncludingFallback( @@ -39,5 +39,5 @@ const CSSValue* WebkitTextEmphasisColor::CSSValueFromComputedStyleInternal( style, style.TextEmphasisColor()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_emphasis_position_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_emphasis_position_custom.cc index 074b51f337c..68079e5a9eb 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_emphasis_position_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_emphasis_position_custom.cc @@ -13,7 +13,7 @@ namespace blink { class CSSParserLocalContext; -namespace CSSLonghand { +namespace css_longhand { // [ over | under ] && [ right | left ]? // If [ right | left ] is omitted, it defaults to right. @@ -22,13 +22,13 @@ const CSSValue* WebkitTextEmphasisPosition::ParseSingleValue( const CSSParserContext& context, const CSSParserLocalContext&) const { CSSIdentifierValue* values[2] = { - CSSPropertyParserHelpers::ConsumeIdent<CSSValueOver, CSSValueUnder, - CSSValueRight, CSSValueLeft>( + css_property_parser_helpers::ConsumeIdent<CSSValueOver, CSSValueUnder, + CSSValueRight, CSSValueLeft>( range), nullptr}; if (!values[0]) return nullptr; - values[1] = CSSPropertyParserHelpers::ConsumeIdent< + values[1] = css_property_parser_helpers::ConsumeIdent< CSSValueOver, CSSValueUnder, CSSValueRight, CSSValueLeft>(range); CSSIdentifierValue* over_under = nullptr; CSSIdentifierValue* left_right = nullptr; @@ -92,5 +92,5 @@ const CSSValue* WebkitTextEmphasisPosition::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_emphasis_style_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_emphasis_style_custom.cc index cbc33535993..6468e778391 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_emphasis_style_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_emphasis_style_custom.cc @@ -11,7 +11,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitTextEmphasisStyle::ParseSingleValue( CSSParserTokenRange& range, @@ -19,23 +19,22 @@ const CSSValue* WebkitTextEmphasisStyle::ParseSingleValue( const CSSParserLocalContext&) const { CSSValueID id = range.Peek().Id(); if (id == CSSValueNone) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); if (CSSValue* text_emphasis_style = - CSSPropertyParserHelpers::ConsumeString(range)) + css_property_parser_helpers::ConsumeString(range)) return text_emphasis_style; CSSIdentifierValue* fill = - CSSPropertyParserHelpers::ConsumeIdent<CSSValueFilled, CSSValueOpen>( - range); - CSSIdentifierValue* shape = - CSSPropertyParserHelpers::ConsumeIdent<CSSValueDot, CSSValueCircle, - CSSValueDoubleCircle, - CSSValueTriangle, CSSValueSesame>( + css_property_parser_helpers::ConsumeIdent<CSSValueFilled, CSSValueOpen>( range); + CSSIdentifierValue* shape = css_property_parser_helpers::ConsumeIdent< + CSSValueDot, CSSValueCircle, CSSValueDoubleCircle, CSSValueTriangle, + CSSValueSesame>(range); if (!fill) { - fill = CSSPropertyParserHelpers::ConsumeIdent<CSSValueFilled, CSSValueOpen>( - range); + fill = + css_property_parser_helpers::ConsumeIdent<CSSValueFilled, CSSValueOpen>( + range); } if (fill && shape) { CSSValueList* parsed_values = CSSValueList::CreateSpaceSeparated(); @@ -138,5 +137,5 @@ void WebkitTextEmphasisStyle::ApplyValue(StyleResolverState& state, } } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_fill_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_fill_color_custom.cc index 3aeeb2de6dd..bb214a61028 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_fill_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_fill_color_custom.cc @@ -10,13 +10,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitTextFillColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); + return css_property_parser_helpers::ConsumeColor(range, context.Mode()); } const blink::Color WebkitTextFillColor::ColorIncludingFallback( @@ -39,5 +39,5 @@ const CSSValue* WebkitTextFillColor::CSSValueFromComputedStyleInternal( style.TextFillColor()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_orientation_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_orientation_custom.cc index fa32fe3a0e2..354ead7741f 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_orientation_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_orientation_custom.cc @@ -7,7 +7,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitTextOrientation::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -26,5 +26,5 @@ void WebkitTextOrientation::ApplyValue(StyleResolverState& state, ToCSSIdentifierValue(value).ConvertTo<ETextOrientation>()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_security_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_security_custom.cc index 4388ee02c57..4fc247e1ac5 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_security_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_security_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/webkit_text_security.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitTextSecurity::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* WebkitTextSecurity::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.TextSecurity()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_stroke_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_stroke_color_custom.cc index 0fe2bf8d629..1da797d6a34 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_stroke_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_stroke_color_custom.cc @@ -13,13 +13,13 @@ namespace blink { class CSSParserLocalContext; -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitTextStrokeColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); + return css_property_parser_helpers::ConsumeColor(range, context.Mode()); } const blink::Color WebkitTextStrokeColor::ColorIncludingFallback( @@ -42,5 +42,5 @@ const CSSValue* WebkitTextStrokeColor::CSSValueFromComputedStyleInternal( style.TextStrokeColor()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_stroke_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_stroke_width_custom.cc index 48a0e1f98c9..5623d1b274b 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_stroke_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_stroke_width_custom.cc @@ -9,14 +9,15 @@ #include "third_party/blink/renderer/core/css/zoom_adjusted_pixel_value.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitTextStrokeWidth::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeLineWidth( - range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_property_parser_helpers::ConsumeLineWidth( + range, context.Mode(), + css_property_parser_helpers::UnitlessQuirk::kForbid); } const CSSValue* WebkitTextStrokeWidth::CSSValueFromComputedStyleInternal( @@ -28,5 +29,5 @@ const CSSValue* WebkitTextStrokeWidth::CSSValueFromComputedStyleInternal( return ZoomAdjustedPixelValue(style.TextStrokeWidth(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_transform_origin_x_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_transform_origin_x_custom.cc index 62ac87f860b..5b3f9696467 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_transform_origin_x_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_transform_origin_x_custom.cc @@ -9,15 +9,16 @@ #include "third_party/blink/renderer/core/css_value_keywords.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitTransformOriginX::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumePositionLonghand<CSSValueLeft, CSSValueRight>( + return css_parsing_utils::ConsumePositionLonghand<CSSValueLeft, + CSSValueRight>( range, context.Mode()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_transform_origin_y_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_transform_origin_y_custom.cc index cf89929fa15..0d0d1f3f51d 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_transform_origin_y_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_transform_origin_y_custom.cc @@ -9,15 +9,16 @@ #include "third_party/blink/renderer/core/css_value_keywords.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitTransformOriginY::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumePositionLonghand<CSSValueTop, CSSValueBottom>( + return css_parsing_utils::ConsumePositionLonghand<CSSValueTop, + CSSValueBottom>( range, context.Mode()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_transform_origin_z_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_transform_origin_z_custom.cc index be88496d3e1..d417dd43f9d 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_transform_origin_z_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_transform_origin_z_custom.cc @@ -8,15 +8,15 @@ #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitTransformOriginZ::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeLength(range, context.Mode(), - kValueRangeAll); + return css_property_parser_helpers::ConsumeLength(range, context.Mode(), + kValueRangeAll); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_user_drag_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_user_drag_custom.cc index 0ddc3d4b847..284a76c64ea 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_user_drag_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_user_drag_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/webkit_user_drag.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitUserDrag::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* WebkitUserDrag::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.UserDrag()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_user_modify_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_user_modify_custom.cc index 27ea95382df..f0ee863bba4 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_user_modify_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_user_modify_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/webkit_user_modify.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitUserModify::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* WebkitUserModify::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.UserModify()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_writing_mode_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_writing_mode_custom.cc index 1aa5e106d86..bfa124478fc 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_writing_mode_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_writing_mode_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/webkit_writing_mode.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WebkitWritingMode::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -22,5 +22,5 @@ void WebkitWritingMode::ApplyValue(StyleResolverState& state, ToCSSIdentifierValue(value).ConvertTo<blink::WritingMode>()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/white_space_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/white_space_custom.cc index 5ee78020bf6..d35361227ba 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/white_space_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/white_space_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/white_space.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WhiteSpace::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* WhiteSpace::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.WhiteSpace()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/widows_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/widows_custom.cc index ab2a9a90936..cded0238bc6 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/widows_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/widows_custom.cc @@ -8,12 +8,12 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Widows::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumePositiveInteger(range); + return css_property_parser_helpers::ConsumePositiveInteger(range); } const CSSValue* Widows::CSSValueFromComputedStyleInternal( @@ -26,5 +26,5 @@ const CSSValue* Widows::CSSValueFromComputedStyleInternal( CSSPrimitiveValue::UnitType::kNumber); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/width_custom.cc index 875578372a1..e48fb203761 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/width_custom.cc @@ -11,13 +11,13 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Width::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeWidthOrHeight( - range, context, CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + return css_parsing_utils::ConsumeWidthOrHeight( + range, context, css_property_parser_helpers::UnitlessQuirk::kAllow); } bool Width::IsLayoutDependent(const ComputedStyle* style, @@ -39,5 +39,5 @@ const CSSValue* Width::CSSValueFromComputedStyleInternal( style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/will_change_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/will_change_custom.cc index 8caadeae027..aefee07e956 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/will_change_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/will_change_custom.cc @@ -12,14 +12,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WillChange::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueAuto) - return CSSPropertyParserHelpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeIdent(range); CSSValueList* values = CSSValueList::CreateCommaSeparated(); // Every comma-separated list of identifiers is a valid will-change value, @@ -53,7 +53,7 @@ const CSSValue* WillChange::ParseSingleValue( return nullptr; case CSSValueContents: case CSSValueScrollPosition: - values->Append(*CSSPropertyParserHelpers::ConsumeIdent(range)); + values->Append(*css_property_parser_helpers::ConsumeIdent(range)); break; default: range.ConsumeIncludingWhitespace(); @@ -63,7 +63,7 @@ const CSSValue* WillChange::ParseSingleValue( if (range.AtEnd()) break; - if (!CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(range)) + if (!css_property_parser_helpers::ConsumeCommaIncludingWhitespace(range)) return nullptr; } @@ -132,5 +132,5 @@ void WillChange::ApplyValue(StyleResolverState& state, will_change_contents || state.ParentStyle()->SubtreeWillChangeContents()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/word_break_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/word_break_custom.cc index 90d0875bf7c..e1ebe16edcb 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/word_break_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/word_break_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/word_break.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WordBreak::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -16,5 +16,5 @@ const CSSValue* WordBreak::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.WordBreak()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/word_spacing_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/word_spacing_custom.cc index 12f0d3f79aa..8c0b30674d5 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/word_spacing_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/word_spacing_custom.cc @@ -8,13 +8,13 @@ #include "third_party/blink/renderer/core/css/zoom_adjusted_pixel_value.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WordSpacing::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSParsingUtils::ParseSpacing(range, context); + return css_parsing_utils::ParseSpacing(range, context); } const CSSValue* WordSpacing::CSSValueFromComputedStyleInternal( @@ -26,5 +26,5 @@ const CSSValue* WordSpacing::CSSValueFromComputedStyleInternal( return ZoomAdjustedPixelValue(style.WordSpacing(), style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/writing_mode_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/writing_mode_custom.cc index 36b2dd68322..7c73effe1a3 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/writing_mode_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/writing_mode_custom.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/writing_mode.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* WritingMode::CSSValueFromComputedStyleInternal( const ComputedStyle& style, @@ -22,5 +22,5 @@ void WritingMode::ApplyValue(StyleResolverState& state, ToCSSIdentifierValue(value).ConvertTo<blink::WritingMode>()); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/x_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/x_custom.cc index 1d40a1a1603..27166019a09 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/x_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/x_custom.cc @@ -8,14 +8,13 @@ #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* X::ParseSingleValue(CSSParserTokenRange& range, - const CSSParserContext&, + const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeLengthOrPercent( - range, kSVGAttributeMode, kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_property_parser_helpers::ConsumeSVGGeometryPropertyLength( + range, context, kValueRangeAll); } const CSSValue* X::CSSValueFromComputedStyleInternal( @@ -28,5 +27,5 @@ const CSSValue* X::CSSValueFromComputedStyleInternal( style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/y_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/y_custom.cc index 3f11b322eac..eaa456c3308 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/y_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/y_custom.cc @@ -8,14 +8,13 @@ #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Y::ParseSingleValue(CSSParserTokenRange& range, - const CSSParserContext&, + const CSSParserContext& context, const CSSParserLocalContext&) const { - return CSSPropertyParserHelpers::ConsumeLengthOrPercent( - range, kSVGAttributeMode, kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); + return css_property_parser_helpers::ConsumeSVGGeometryPropertyLength( + range, context, kValueRangeAll); } const CSSValue* Y::CSSValueFromComputedStyleInternal( @@ -28,5 +27,5 @@ const CSSValue* Y::CSSValueFromComputedStyleInternal( style); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/z_index_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/z_index_custom.cc index f807bef3d45..966179c2cae 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/z_index_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/z_index_custom.cc @@ -9,14 +9,14 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* ZIndex::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { if (range.Peek().Id() == CSSValueAuto) - return CSSPropertyParserHelpers::ConsumeIdent(range); - return CSSPropertyParserHelpers::ConsumeInteger(range); + return css_property_parser_helpers::ConsumeIdent(range); + return css_property_parser_helpers::ConsumeInteger(range); } const CSSValue* ZIndex::CSSValueFromComputedStyleInternal( @@ -31,5 +31,5 @@ const CSSValue* ZIndex::CSSValueFromComputedStyleInternal( CSSPrimitiveValue::UnitType::kInteger); } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/zoom_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/zoom_custom.cc index 150dc75aefa..269a6107887 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/zoom_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/zoom_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSLonghand { +namespace css_longhand { const CSSValue* Zoom::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, @@ -18,13 +18,13 @@ const CSSValue* Zoom::ParseSingleValue(CSSParserTokenRange& range, const CSSParserToken& token = range.Peek(); CSSValue* zoom = nullptr; if (token.GetType() == kIdentToken) { - zoom = CSSPropertyParserHelpers::ConsumeIdent<CSSValueNormal>(range); + zoom = css_property_parser_helpers::ConsumeIdent<CSSValueNormal>(range); } else { - zoom = - CSSPropertyParserHelpers::ConsumePercent(range, kValueRangeNonNegative); + zoom = css_property_parser_helpers::ConsumePercent(range, + kValueRangeNonNegative); if (!zoom) { - zoom = CSSPropertyParserHelpers::ConsumeNumber(range, - kValueRangeNonNegative); + zoom = css_property_parser_helpers::ConsumeNumber(range, + kValueRangeNonNegative); } } if (zoom) { @@ -80,5 +80,5 @@ void Zoom::ApplyValue(StyleResolverState& state, const CSSValue& value) const { } } -} // namespace CSSLonghand +} // namespace css_longhand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/animation_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/animation_custom.cc index 29e35a17f76..eb60bd55abb 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/animation_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/animation_custom.cc @@ -23,28 +23,28 @@ CSSValue* ConsumeAnimationValue(CSSPropertyID property, bool use_legacy_parsing) { switch (property) { case CSSPropertyAnimationDelay: - return CSSPropertyParserHelpers::ConsumeTime(range, kValueRangeAll); + return css_property_parser_helpers::ConsumeTime(range, kValueRangeAll); case CSSPropertyAnimationDirection: - return CSSPropertyParserHelpers::ConsumeIdent< + return css_property_parser_helpers::ConsumeIdent< CSSValueNormal, CSSValueAlternate, CSSValueReverse, CSSValueAlternateReverse>(range); case CSSPropertyAnimationDuration: - return CSSPropertyParserHelpers::ConsumeTime(range, - kValueRangeNonNegative); + return css_property_parser_helpers::ConsumeTime(range, + kValueRangeNonNegative); case CSSPropertyAnimationFillMode: - return CSSPropertyParserHelpers::ConsumeIdent< + return css_property_parser_helpers::ConsumeIdent< CSSValueNone, CSSValueForwards, CSSValueBackwards, CSSValueBoth>( range); case CSSPropertyAnimationIterationCount: - return CSSParsingUtils::ConsumeAnimationIterationCount(range); + return css_parsing_utils::ConsumeAnimationIterationCount(range); case CSSPropertyAnimationName: - return CSSParsingUtils::ConsumeAnimationName(range, context, - use_legacy_parsing); + return css_parsing_utils::ConsumeAnimationName(range, context, + use_legacy_parsing); case CSSPropertyAnimationPlayState: - return CSSPropertyParserHelpers::ConsumeIdent<CSSValueRunning, - CSSValuePaused>(range); + return css_property_parser_helpers::ConsumeIdent<CSSValueRunning, + CSSValuePaused>(range); case CSSPropertyAnimationTimingFunction: - return CSSParsingUtils::ConsumeAnimationTimingFunction(range); + return css_parsing_utils::ConsumeAnimationTimingFunction(range); default: NOTREACHED(); return nullptr; @@ -52,7 +52,7 @@ CSSValue* ConsumeAnimationValue(CSSPropertyID property, } } // namespace -namespace CSSShorthand { +namespace css_shorthand { bool Animation::ParseShorthand( bool important, @@ -63,18 +63,19 @@ bool Animation::ParseShorthand( const StylePropertyShorthand shorthand = animationShorthandForParsing(); const unsigned longhand_count = shorthand.length(); - HeapVector<Member<CSSValueList>, CSSParsingUtils::kMaxNumAnimationLonghands> + HeapVector<Member<CSSValueList>, css_parsing_utils::kMaxNumAnimationLonghands> longhands(longhand_count); - if (!CSSParsingUtils::ConsumeAnimationShorthand( + if (!css_parsing_utils::ConsumeAnimationShorthand( shorthand, longhands, ConsumeAnimationValue, range, context, local_context.UseAliasParsing())) { return false; } for (unsigned i = 0; i < longhand_count; ++i) { - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( shorthand.properties()[i]->PropertyID(), shorthand.id(), *longhands[i], - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); } return range.AtEnd(); @@ -136,5 +137,5 @@ const CSSValue* Animation::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/background_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/background_custom.cc index f410e160208..a0cd224bd3b 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/background_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/background_custom.cc @@ -9,7 +9,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool Background::ParseShorthand( bool important, @@ -17,8 +17,8 @@ bool Background::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext& local_context, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSParsingUtils::ParseBackgroundOrMask(important, range, context, - local_context, properties); + return css_parsing_utils::ParseBackgroundOrMask(important, range, context, + local_context, properties); } const CSSValue* Background::CSSValueFromComputedStyleInternal( @@ -31,5 +31,5 @@ const CSSValue* Background::CSSValueFromComputedStyleInternal( style, layout_object, styled_node, allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/background_position_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/background_position_custom.cc index 3ec724e5cfb..cef5bc7fed9 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/background_position_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/background_position_custom.cc @@ -11,7 +11,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BackgroundPosition::ParseShorthand( bool important, @@ -22,20 +22,20 @@ bool BackgroundPosition::ParseShorthand( CSSValue* result_x = nullptr; CSSValue* result_y = nullptr; - if (!CSSParsingUtils::ConsumeBackgroundPosition( - range, context, CSSPropertyParserHelpers::UnitlessQuirk::kAllow, + if (!css_parsing_utils::ConsumeBackgroundPosition( + range, context, css_property_parser_helpers::UnitlessQuirk::kAllow, result_x, result_y) || !range.AtEnd()) return false; - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyBackgroundPositionX, CSSPropertyBackgroundPosition, *result_x, - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyBackgroundPositionY, CSSPropertyBackgroundPosition, *result_y, - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); return true; } @@ -50,5 +50,5 @@ const CSSValue* BackgroundPosition::CSSValueFromComputedStyleInternal( *this, style, &style.BackgroundLayers()); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/background_repeat_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/background_repeat_custom.cc index c99c683f3d4..61a9742e99b 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/background_repeat_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/background_repeat_custom.cc @@ -13,7 +13,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BackgroundRepeat::ParseShorthand( bool important, @@ -24,22 +24,22 @@ bool BackgroundRepeat::ParseShorthand( CSSValue* result_x = nullptr; CSSValue* result_y = nullptr; bool implicit = false; - if (!CSSParsingUtils::ConsumeRepeatStyle(range, result_x, result_y, - implicit) || + if (!css_parsing_utils::ConsumeRepeatStyle(range, result_x, result_y, + implicit) || !range.AtEnd()) return false; - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyBackgroundRepeatX, CSSPropertyBackgroundRepeat, *result_x, important, - implicit ? CSSPropertyParserHelpers::IsImplicitProperty::kImplicit - : CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + implicit ? css_property_parser_helpers::IsImplicitProperty::kImplicit + : css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyBackgroundRepeatY, CSSPropertyBackgroundRepeat, *result_y, important, - implicit ? CSSPropertyParserHelpers::IsImplicitProperty::kImplicit - : CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + implicit ? css_property_parser_helpers::IsImplicitProperty::kImplicit + : css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); return true; @@ -55,5 +55,5 @@ const CSSValue* BackgroundRepeat::CSSValueFromComputedStyleInternal( &style.BackgroundLayers()); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_color_custom.cc index c1ab6852b74..1304f373293 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_color_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BorderBlockColor::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool BorderBlockColor::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + return css_property_parser_helpers::ConsumeShorthandVia2Longhands( borderBlockColorShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* BorderBlockColor::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_custom.cc index d18442f8e88..92797531d4e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_custom.cc @@ -8,7 +8,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BorderBlock::ParseShorthand( bool important, @@ -20,16 +20,16 @@ bool BorderBlock::ParseShorthand( const CSSValue* style = nullptr; const CSSValue* color = nullptr; - if (!CSSPropertyParserHelpers::ConsumeBorderShorthand(range, context, width, - style, color)) { + if (!css_property_parser_helpers::ConsumeBorderShorthand( + range, context, width, style, color)) { return false; }; - CSSPropertyParserHelpers::AddExpandedPropertyForValue( + css_property_parser_helpers::AddExpandedPropertyForValue( CSSPropertyBorderBlockWidth, *width, important, properties); - CSSPropertyParserHelpers::AddExpandedPropertyForValue( + css_property_parser_helpers::AddExpandedPropertyForValue( CSSPropertyBorderBlockStyle, *style, important, properties); - CSSPropertyParserHelpers::AddExpandedPropertyForValue( + css_property_parser_helpers::AddExpandedPropertyForValue( CSSPropertyBorderBlockColor, *color, important, properties); return range.AtEnd(); @@ -53,5 +53,5 @@ const CSSValue* BorderBlock::CSSValueFromComputedStyleInternal( return value_start; } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_end_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_end_custom.cc index 8e9665afe4e..78b27a6f287 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_end_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_end_custom.cc @@ -8,7 +8,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BorderBlockEnd::ParseShorthand( bool important, @@ -16,9 +16,9 @@ bool BorderBlockEnd::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( + return css_property_parser_helpers::ConsumeShorthandGreedilyViaLonghands( borderBlockEndShorthand(), important, context, range, properties); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_start_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_start_custom.cc index 22f27305992..0b725a37d14 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_start_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_start_custom.cc @@ -8,7 +8,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BorderBlockStart::ParseShorthand( bool important, @@ -16,9 +16,9 @@ bool BorderBlockStart::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( + return css_property_parser_helpers::ConsumeShorthandGreedilyViaLonghands( borderBlockStartShorthand(), important, context, range, properties); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_style_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_style_custom.cc index d873dee0a73..66ad0ee5dc7 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_style_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_style_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BorderBlockStyle::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool BorderBlockStyle::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + return css_property_parser_helpers::ConsumeShorthandVia2Longhands( borderBlockStyleShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* BorderBlockStyle::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_width_custom.cc index 7d3523291bf..bde08ce83a6 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_width_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BorderBlockWidth::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool BorderBlockWidth::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + return css_property_parser_helpers::ConsumeShorthandVia2Longhands( borderBlockWidthShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* BorderBlockWidth::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_bottom_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_bottom_custom.cc index 55b4aac34bc..1c27bc33a4a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_bottom_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_bottom_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BorderBottom::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool BorderBottom::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( + return css_property_parser_helpers::ConsumeShorthandGreedilyViaLonghands( borderBottomShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* BorderBottom::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_color_custom.cc index 509f2e38a9c..92abd043d7f 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_color_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BorderColor::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool BorderColor::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia4Longhands( + return css_property_parser_helpers::ConsumeShorthandVia4Longhands( borderColorShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* BorderColor::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_custom.cc index 7dff25ea3ef..9ac731d078b 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_custom.cc @@ -11,7 +11,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool Border::ParseShorthand( bool important, @@ -23,18 +23,18 @@ bool Border::ParseShorthand( const CSSValue* style = nullptr; const CSSValue* color = nullptr; - if (!CSSPropertyParserHelpers::ConsumeBorderShorthand(range, context, width, - style, color)) { + if (!css_property_parser_helpers::ConsumeBorderShorthand( + range, context, width, style, color)) { return false; }; - CSSPropertyParserHelpers::AddExpandedPropertyForValue( + css_property_parser_helpers::AddExpandedPropertyForValue( CSSPropertyBorderWidth, *width, important, properties); - CSSPropertyParserHelpers::AddExpandedPropertyForValue( + css_property_parser_helpers::AddExpandedPropertyForValue( CSSPropertyBorderStyle, *style, important, properties); - CSSPropertyParserHelpers::AddExpandedPropertyForValue( + css_property_parser_helpers::AddExpandedPropertyForValue( CSSPropertyBorderColor, *color, important, properties); - CSSPropertyParserHelpers::AddExpandedPropertyForValue( + css_property_parser_helpers::AddExpandedPropertyForValue( CSSPropertyBorderImage, *CSSInitialValue::Create(), important, properties); @@ -62,5 +62,5 @@ const CSSValue* Border::CSSValueFromComputedStyleInternal( return value; } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_image_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_image_custom.cc index 679d657ce1f..7928f6994b9 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_image_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_image_custom.cc @@ -13,7 +13,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BorderImage::ParseShorthand( bool important, @@ -27,41 +27,41 @@ bool BorderImage::ParseShorthand( CSSValue* outset = nullptr; CSSValue* repeat = nullptr; - if (!CSSParsingUtils::ConsumeBorderImageComponents( + if (!css_parsing_utils::ConsumeBorderImageComponents( range, context, source, slice, width, outset, repeat, - CSSParsingUtils::DefaultFill::kNoFill)) { + css_parsing_utils::DefaultFill::kNoFill)) { return false; } - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyBorderImageSource, CSSPropertyBorderImage, source ? *source : *ToLonghand(&GetCSSPropertyBorderImageSource())->InitialValue(), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyBorderImageSlice, CSSPropertyBorderImage, slice ? *slice : *ToLonghand(&GetCSSPropertyBorderImageSlice())->InitialValue(), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyBorderImageWidth, CSSPropertyBorderImage, width ? *width : *ToLonghand(&GetCSSPropertyBorderImageWidth())->InitialValue(), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyBorderImageOutset, CSSPropertyBorderImage, outset ? *outset : *ToLonghand(&GetCSSPropertyBorderImageOutset())->InitialValue(), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyBorderImageRepeat, CSSPropertyBorderImage, repeat ? *repeat : *ToLonghand(&GetCSSPropertyBorderImageRepeat())->InitialValue(), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); return true; @@ -76,5 +76,5 @@ const CSSValue* BorderImage::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForNinePieceImage(style.BorderImage(), style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_color_custom.cc index 15ebaa985e9..675514b42ed 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_color_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BorderInlineColor::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool BorderInlineColor::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + return css_property_parser_helpers::ConsumeShorthandVia2Longhands( borderInlineColorShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* BorderInlineColor::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_custom.cc index b08fe2e7f51..3d8d79109dd 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_custom.cc @@ -8,7 +8,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BorderInline::ParseShorthand( bool important, @@ -20,16 +20,16 @@ bool BorderInline::ParseShorthand( const CSSValue* style = nullptr; const CSSValue* color = nullptr; - if (!CSSPropertyParserHelpers::ConsumeBorderShorthand(range, context, width, - style, color)) { + if (!css_property_parser_helpers::ConsumeBorderShorthand( + range, context, width, style, color)) { return false; }; - CSSPropertyParserHelpers::AddExpandedPropertyForValue( + css_property_parser_helpers::AddExpandedPropertyForValue( CSSPropertyBorderInlineWidth, *width, important, properties); - CSSPropertyParserHelpers::AddExpandedPropertyForValue( + css_property_parser_helpers::AddExpandedPropertyForValue( CSSPropertyBorderInlineStyle, *style, important, properties); - CSSPropertyParserHelpers::AddExpandedPropertyForValue( + css_property_parser_helpers::AddExpandedPropertyForValue( CSSPropertyBorderInlineColor, *color, important, properties); return range.AtEnd(); @@ -53,5 +53,5 @@ const CSSValue* BorderInline::CSSValueFromComputedStyleInternal( return value_start; } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_end_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_end_custom.cc index 53c9c7d72d8..bac89861d35 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_end_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_end_custom.cc @@ -8,7 +8,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BorderInlineEnd::ParseShorthand( bool important, @@ -16,9 +16,9 @@ bool BorderInlineEnd::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( + return css_property_parser_helpers::ConsumeShorthandGreedilyViaLonghands( borderInlineEndShorthand(), important, context, range, properties); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_start_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_start_custom.cc index 7440a220bc1..28a36350300 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_start_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_start_custom.cc @@ -8,7 +8,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BorderInlineStart::ParseShorthand( bool important, @@ -16,9 +16,9 @@ bool BorderInlineStart::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( + return css_property_parser_helpers::ConsumeShorthandGreedilyViaLonghands( borderInlineStartShorthand(), important, context, range, properties); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_style_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_style_custom.cc index b30e9c2047d..c559d957b94 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_style_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_style_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BorderInlineStyle::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool BorderInlineStyle::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + return css_property_parser_helpers::ConsumeShorthandVia2Longhands( borderInlineStyleShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* BorderInlineStyle::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_width_custom.cc index a0e10839891..76577f274dc 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_width_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BorderInlineWidth::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool BorderInlineWidth::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + return css_property_parser_helpers::ConsumeShorthandVia2Longhands( borderInlineWidthShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* BorderInlineWidth::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_left_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_left_custom.cc index 0a26d4b4d0f..af9b336c80e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_left_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_left_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BorderLeft::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool BorderLeft::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( + return css_property_parser_helpers::ConsumeShorthandGreedilyViaLonghands( borderLeftShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* BorderLeft::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_radius_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_radius_custom.cc index 22b397760aa..5f0b7591578 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_radius_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_radius_custom.cc @@ -13,7 +13,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BorderRadius::ParseShorthand( bool important, @@ -24,34 +24,34 @@ bool BorderRadius::ParseShorthand( CSSValue* horizontal_radii[4] = {nullptr}; CSSValue* vertical_radii[4] = {nullptr}; - if (!CSSParsingUtils::ConsumeRadii(horizontal_radii, vertical_radii, range, - context.Mode(), - local_context.UseAliasParsing())) + if (!css_parsing_utils::ConsumeRadii(horizontal_radii, vertical_radii, range, + context.Mode(), + local_context.UseAliasParsing())) return false; - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyBorderTopLeftRadius, CSSPropertyBorderRadius, *CSSValuePair::Create(horizontal_radii[0], vertical_radii[0], CSSValuePair::kDropIdenticalValues), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyBorderTopRightRadius, CSSPropertyBorderRadius, *CSSValuePair::Create(horizontal_radii[1], vertical_radii[1], CSSValuePair::kDropIdenticalValues), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyBorderBottomRightRadius, CSSPropertyBorderRadius, *CSSValuePair::Create(horizontal_radii[2], vertical_radii[2], CSSValuePair::kDropIdenticalValues), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyBorderBottomLeftRadius, CSSPropertyBorderRadius, *CSSValuePair::Create(horizontal_radii[3], vertical_radii[3], CSSValuePair::kDropIdenticalValues), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); return true; } @@ -65,5 +65,5 @@ const CSSValue* BorderRadius::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForBorderRadiusShorthand(style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_right_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_right_custom.cc index 0a573903858..0075cff9bd8 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_right_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_right_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BorderRight::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool BorderRight::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( + return css_property_parser_helpers::ConsumeShorthandGreedilyViaLonghands( borderRightShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* BorderRight::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_spacing_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_spacing_custom.cc index ea06cdb8fdb..73ed905d19c 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_spacing_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_spacing_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BorderSpacing::ParseShorthand( bool important, @@ -20,25 +20,27 @@ bool BorderSpacing::ParseShorthand( HeapVector<CSSPropertyValue, 256>& properties) const { CSSValue* horizontal_spacing = ConsumeLength(range, context.Mode(), kValueRangeNonNegative, - CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + css_property_parser_helpers::UnitlessQuirk::kAllow); if (!horizontal_spacing) return false; CSSValue* vertical_spacing = horizontal_spacing; if (!range.AtEnd()) { vertical_spacing = ConsumeLength(range, context.Mode(), kValueRangeNonNegative, - CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + css_property_parser_helpers::UnitlessQuirk::kAllow); } if (!vertical_spacing || !range.AtEnd()) return false; - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyWebkitBorderHorizontalSpacing, CSSPropertyBorderSpacing, *horizontal_spacing, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyWebkitBorderVerticalSpacing, CSSPropertyBorderSpacing, *vertical_spacing, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return true; } @@ -54,5 +56,5 @@ const CSSValue* BorderSpacing::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_style_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_style_custom.cc index bfea74affd3..bbbd07c6d96 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_style_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_style_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BorderStyle::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool BorderStyle::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia4Longhands( + return css_property_parser_helpers::ConsumeShorthandVia4Longhands( borderStyleShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* BorderStyle::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_top_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_top_custom.cc index 158fcbb8f67..1dd99d0a058 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_top_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_top_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BorderTop::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool BorderTop::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( + return css_property_parser_helpers::ConsumeShorthandGreedilyViaLonghands( borderTopShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* BorderTop::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_width_custom.cc index 22b31b1f9a0..7d8b7b302e0 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_width_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool BorderWidth::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool BorderWidth::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia4Longhands( + return css_property_parser_helpers::ConsumeShorthandVia4Longhands( borderWidthShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* BorderWidth::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/column_rule_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/column_rule_custom.cc index 639d8725a3f..7f05677e429 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/column_rule_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/column_rule_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool ColumnRule::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool ColumnRule::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( + return css_property_parser_helpers::ConsumeShorthandGreedilyViaLonghands( columnRuleShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* ColumnRule::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/columns_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/columns_custom.cc index d5f2371db0e..5968080e518 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/columns_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/columns_custom.cc @@ -13,7 +13,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool Columns::ParseShorthand( bool important, @@ -23,22 +23,25 @@ bool Columns::ParseShorthand( HeapVector<CSSPropertyValue, 256>& properties) const { CSSValue* column_width = nullptr; CSSValue* column_count = nullptr; - if (!CSSParsingUtils::ConsumeColumnWidthOrCount(range, column_width, - column_count)) + if (!css_parsing_utils::ConsumeColumnWidthOrCount(range, column_width, + column_count)) return false; - CSSParsingUtils::ConsumeColumnWidthOrCount(range, column_width, column_count); + css_parsing_utils::ConsumeColumnWidthOrCount(range, column_width, + column_count); if (!range.AtEnd()) return false; if (!column_width) column_width = CSSIdentifierValue::Create(CSSValueAuto); if (!column_count) column_count = CSSIdentifierValue::Create(CSSValueAuto); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyColumnWidth, CSSPropertyInvalid, *column_width, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyColumnCount, CSSPropertyInvalid, *column_count, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return true; } @@ -53,5 +56,5 @@ const CSSValue* Columns::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/flex_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/flex_custom.cc index 0ed2a6b08b0..443787e8764 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/flex_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/flex_custom.cc @@ -13,7 +13,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool Flex::ParseShorthand(bool important, CSSParserTokenRange& range, @@ -34,7 +34,7 @@ bool Flex::ParseShorthand(bool important, unsigned index = 0; while (!range.AtEnd() && index++ < 3) { double num; - if (CSSPropertyParserHelpers::ConsumeNumberRaw(range, num)) { + if (css_property_parser_helpers::ConsumeNumberRaw(range, num)) { if (num < 0) return false; if (flex_grow == kUnsetValue) { @@ -52,9 +52,9 @@ bool Flex::ParseShorthand(bool important, } } else if (!flex_basis) { if (range.Peek().Id() == CSSValueAuto) - flex_basis = CSSPropertyParserHelpers::ConsumeIdent(range); + flex_basis = css_property_parser_helpers::ConsumeIdent(range); if (!flex_basis) { - flex_basis = CSSPropertyParserHelpers::ConsumeLengthOrPercent( + flex_basis = css_property_parser_helpers::ConsumeLengthOrPercent( range, context.Mode(), kValueRangeNonNegative); } if (index == 2 && !range.AtEnd()) @@ -75,22 +75,23 @@ bool Flex::ParseShorthand(bool important, if (!range.AtEnd()) return false; - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyFlexGrow, CSSPropertyFlex, *CSSPrimitiveValue::Create(clampTo<float>(flex_grow), CSSPrimitiveValue::UnitType::kNumber), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyFlexShrink, CSSPropertyFlex, *CSSPrimitiveValue::Create(clampTo<float>(flex_shrink), CSSPrimitiveValue::UnitType::kNumber), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyFlexBasis, CSSPropertyFlex, *flex_basis, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return true; } @@ -105,5 +106,5 @@ const CSSValue* Flex::CSSValueFromComputedStyleInternal( flexShorthand(), style, layout_object, styled_node, allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/flex_flow_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/flex_flow_custom.cc index 8310114b8fe..4289d1d7d68 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/flex_flow_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/flex_flow_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool FlexFlow::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool FlexFlow::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( + return css_property_parser_helpers::ConsumeShorthandGreedilyViaLonghands( flexFlowShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* FlexFlow::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/font_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/font_custom.cc index 321d19f3aaf..1150e5dec38 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/font_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/font_custom.cc @@ -35,55 +35,62 @@ bool ConsumeSystemFont(bool important, LayoutTheme::GetTheme().SystemFont(system_font_id, font_style, font_weight, font_size, font_family); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyFontStyle, CSSPropertyFont, *CSSIdentifierValue::Create( font_style == ItalicSlopeValue() ? CSSValueItalic : CSSValueNormal), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyFontWeight, CSSPropertyFont, *CSSPrimitiveValue::Create(font_weight, CSSPrimitiveValue::UnitType::kNumber), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyFontSize, CSSPropertyFont, *CSSPrimitiveValue::Create(font_size, CSSPrimitiveValue::UnitType::kPixels), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); CSSValueList* font_family_list = CSSValueList::CreateCommaSeparated(); font_family_list->Append(*CSSFontFamilyValue::Create(font_family)); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyFontFamily, CSSPropertyFont, *font_family_list, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyFontStretch, CSSPropertyFont, *CSSIdentifierValue::Create(CSSValueNormal), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyFontVariantCaps, CSSPropertyFont, *CSSIdentifierValue::Create(CSSValueNormal), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyFontVariantLigatures, CSSPropertyFont, *CSSIdentifierValue::Create(CSSValueNormal), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyFontVariantNumeric, CSSPropertyFont, *CSSIdentifierValue::Create(CSSValueNormal), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyFontVariantEastAsian, CSSPropertyFont, *CSSIdentifierValue::Create(CSSValueNormal), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyLineHeight, CSSPropertyFont, *CSSIdentifierValue::Create(CSSValueNormal), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return true; } @@ -100,7 +107,7 @@ bool ConsumeFont(bool important, CSSValueID id = range.Peek().Id(); if (!font_style && (id == CSSValueNormal || id == CSSValueItalic || id == CSSValueOblique)) { - font_style = CSSParsingUtils::ConsumeFontStyle(range, context.Mode()); + font_style = css_parsing_utils::ConsumeFontStyle(range, context.Mode()); continue; } if (!font_variant_caps && @@ -108,12 +115,12 @@ bool ConsumeFont(bool important, // Font variant in the shorthand is particular, it only accepts normal or // small-caps. // See https://drafts.csswg.org/css-fonts/#propdef-font - font_variant_caps = CSSParsingUtils::ConsumeFontVariantCSS21(range); + font_variant_caps = css_parsing_utils::ConsumeFontVariantCSS21(range); if (font_variant_caps) continue; } if (!font_weight) { - font_weight = CSSParsingUtils::ConsumeFontWeight(range, context.Mode()); + font_weight = css_parsing_utils::ConsumeFontWeight(range, context.Mode()); if (font_weight) continue; } @@ -125,81 +132,90 @@ bool ConsumeFont(bool important, // shorthand, compare: [ [ <‘font-style’> || <font-variant-css21> || // <‘font-weight’> || <font-stretch-css3> ]? if (font_stretch || - !(font_stretch = CSSParsingUtils::ConsumeFontStretchKeywordOnly(range))) + !(font_stretch = + css_parsing_utils::ConsumeFontStretchKeywordOnly(range))) break; } if (range.AtEnd()) return false; - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyFontStyle, CSSPropertyFont, font_style ? *font_style : *CSSIdentifierValue::Create(CSSValueNormal), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyFontVariantCaps, CSSPropertyFont, font_variant_caps ? *font_variant_caps : *CSSIdentifierValue::Create(CSSValueNormal), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyFontVariantLigatures, CSSPropertyFont, *CSSIdentifierValue::Create(CSSValueNormal), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyFontVariantNumeric, CSSPropertyFont, *CSSIdentifierValue::Create(CSSValueNormal), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyFontVariantEastAsian, CSSPropertyFont, *CSSIdentifierValue::Create(CSSValueNormal), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyFontWeight, CSSPropertyFont, font_weight ? *font_weight : *CSSIdentifierValue::Create(CSSValueNormal), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyFontStretch, CSSPropertyFont, font_stretch ? *font_stretch : *CSSIdentifierValue::Create(CSSValueNormal), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); // Now a font size _must_ come. - CSSValue* font_size = CSSParsingUtils::ConsumeFontSize(range, context.Mode()); + CSSValue* font_size = + css_parsing_utils::ConsumeFontSize(range, context.Mode()); if (!font_size || range.AtEnd()) return false; - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyFontSize, CSSPropertyFont, *font_size, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); - if (CSSPropertyParserHelpers::ConsumeSlashIncludingWhitespace(range)) { + if (css_property_parser_helpers::ConsumeSlashIncludingWhitespace(range)) { CSSValue* line_height = - CSSParsingUtils::ConsumeLineHeight(range, context.Mode()); + css_parsing_utils::ConsumeLineHeight(range, context.Mode()); if (!line_height) return false; - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyLineHeight, CSSPropertyFont, *line_height, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); } else { - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyLineHeight, CSSPropertyFont, *CSSIdentifierValue::Create(CSSValueNormal), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); } // Font family must come now. - CSSValue* parsed_family_value = CSSParsingUtils::ConsumeFontFamily(range); + CSSValue* parsed_family_value = css_parsing_utils::ConsumeFontFamily(range); if (!parsed_family_value) return false; - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyFontFamily, CSSPropertyFont, *parsed_family_value, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); // FIXME: http://www.w3.org/TR/2011/WD-css3-fonts-20110324/#font-prop requires // that "font-stretch", "font-size-adjust", and "font-kerning" be reset to @@ -209,7 +225,7 @@ bool ConsumeFont(bool important, } } // namespace -namespace CSSShorthand { +namespace css_shorthand { bool Font::ParseShorthand(bool important, CSSParserTokenRange& range, @@ -231,5 +247,5 @@ const CSSValue* Font::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForFont(style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/font_variant_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/font_variant_custom.cc index 503bcca3c64..e4fab73c675 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/font_variant_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/font_variant_custom.cc @@ -13,7 +13,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool FontVariant::ParseShorthand( bool important, @@ -21,24 +21,28 @@ bool FontVariant::ParseShorthand( const CSSParserContext&, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - if (CSSPropertyParserHelpers::IdentMatches<CSSValueNormal, CSSValueNone>( + if (css_property_parser_helpers::IdentMatches<CSSValueNormal, CSSValueNone>( range.Peek().Id())) { - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyFontVariantLigatures, CSSPropertyFontVariant, - *CSSPropertyParserHelpers::ConsumeIdent(range), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + *css_property_parser_helpers::ConsumeIdent(range), important, + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyFontVariantCaps, CSSPropertyFontVariant, *CSSIdentifierValue::Create(CSSValueNormal), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyFontVariantNumeric, CSSPropertyFontVariant, *CSSIdentifierValue::Create(CSSValueNormal), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyFontVariantEastAsian, CSSPropertyFontVariant, *CSSIdentifierValue::Create(CSSValueNormal), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return range.AtEnd(); } @@ -80,29 +84,32 @@ bool FontVariant::ParseShorthand( // Only one caps value permitted in font-variant grammar. if (caps_value) return false; - caps_value = CSSPropertyParserHelpers::ConsumeIdent(range); + caps_value = css_property_parser_helpers::ConsumeIdent(range); break; default: return false; } } while (!range.AtEnd()); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyFontVariantLigatures, CSSPropertyFontVariant, *ligatures_parser.FinalizeValue(), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyFontVariantNumeric, CSSPropertyFontVariant, *numeric_parser.FinalizeValue(), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyFontVariantEastAsian, CSSPropertyFontVariant, *east_asian_parser.FinalizeValue(), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyFontVariantCaps, CSSPropertyFontVariant, caps_value ? *caps_value : *CSSIdentifierValue::Create(CSSValueNormal), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); return true; } @@ -117,5 +124,5 @@ const CSSValue* FontVariant::CSSValueFromComputedStyleInternal( style, layout_object, styled_node, allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/gap_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/gap_custom.cc index d55424277da..47016d25a2a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/gap_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/gap_custom.cc @@ -11,7 +11,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool Gap::ParseShorthand(bool important, CSSParserTokenRange& range, @@ -19,18 +19,20 @@ bool Gap::ParseShorthand(bool important, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { DCHECK_EQ(shorthandForProperty(CSSPropertyGap).length(), 2u); - CSSValue* row_gap = CSSParsingUtils::ConsumeGapLength(range, context); - CSSValue* column_gap = CSSParsingUtils::ConsumeGapLength(range, context); + CSSValue* row_gap = css_parsing_utils::ConsumeGapLength(range, context); + CSSValue* column_gap = css_parsing_utils::ConsumeGapLength(range, context); if (!row_gap || !range.AtEnd()) return false; if (!column_gap) column_gap = row_gap; - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyRowGap, CSSPropertyGap, *row_gap, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyColumnGap, CSSPropertyGap, *column_gap, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return true; } @@ -44,5 +46,5 @@ const CSSValue* Gap::CSSValueFromComputedStyleInternal( gapShorthand(), style, layout_object, styled_node, allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_area_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_area_custom.cc index ce88adcc16d..493bc85c0cf 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_area_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_area_custom.cc @@ -11,32 +11,33 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool GridArea::ParseShorthand( bool important, CSSParserTokenRange& range, - const CSSParserContext&, + const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { DCHECK_EQ(gridAreaShorthand().length(), 4u); - CSSValue* row_start_value = CSSParsingUtils::ConsumeGridLine(range); + CSSValue* row_start_value = + css_parsing_utils::ConsumeGridLine(range, context); if (!row_start_value) return false; CSSValue* column_start_value = nullptr; CSSValue* row_end_value = nullptr; CSSValue* column_end_value = nullptr; - if (CSSPropertyParserHelpers::ConsumeSlashIncludingWhitespace(range)) { - column_start_value = CSSParsingUtils::ConsumeGridLine(range); + if (css_property_parser_helpers::ConsumeSlashIncludingWhitespace(range)) { + column_start_value = css_parsing_utils::ConsumeGridLine(range, context); if (!column_start_value) return false; - if (CSSPropertyParserHelpers::ConsumeSlashIncludingWhitespace(range)) { - row_end_value = CSSParsingUtils::ConsumeGridLine(range); + if (css_property_parser_helpers::ConsumeSlashIncludingWhitespace(range)) { + row_end_value = css_parsing_utils::ConsumeGridLine(range, context); if (!row_end_value) return false; - if (CSSPropertyParserHelpers::ConsumeSlashIncludingWhitespace(range)) { - column_end_value = CSSParsingUtils::ConsumeGridLine(range); + if (css_property_parser_helpers::ConsumeSlashIncludingWhitespace(range)) { + column_end_value = css_parsing_utils::ConsumeGridLine(range, context); if (!column_end_value) return false; } @@ -60,19 +61,21 @@ bool GridArea::ParseShorthand( : CSSIdentifierValue::Create(CSSValueAuto); } - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyGridRowStart, CSSPropertyGridArea, *row_start_value, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyGridColumnStart, CSSPropertyGridArea, *column_start_value, - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyGridRowEnd, CSSPropertyGridArea, *row_end_value, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyGridColumnEnd, CSSPropertyGridArea, *column_end_value, - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); return true; } @@ -88,5 +91,5 @@ const CSSValue* GridArea::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_column_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_column_custom.cc index 5fb067c9745..94884442f74 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_column_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_column_custom.cc @@ -12,12 +12,12 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool GridColumn::ParseShorthand( bool important, CSSParserTokenRange& range, - const CSSParserContext&, + const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { const StylePropertyShorthand& shorthand = @@ -26,19 +26,21 @@ bool GridColumn::ParseShorthand( CSSValue* start_value = nullptr; CSSValue* end_value = nullptr; - if (!CSSParsingUtils::ConsumeGridItemPositionShorthand( - important, range, start_value, end_value)) { + if (!css_parsing_utils::ConsumeGridItemPositionShorthand( + important, range, context, start_value, end_value)) { return false; } - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( shorthand.properties()[0]->PropertyID(), CSSPropertyGridColumn, *start_value, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( shorthand.properties()[1]->PropertyID(), CSSPropertyGridColumn, *end_value, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return true; } @@ -54,5 +56,5 @@ const CSSValue* GridColumn::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_column_gap_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_column_gap_custom.cc index 8ba54bc9575..e40ef508d61 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_column_gap_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_column_gap_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool GridColumnGap::ParseShorthand( bool important, @@ -18,13 +18,14 @@ bool GridColumnGap::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - CSSValue* gap_length = CSSParsingUtils::ConsumeGapLength(range, context); + CSSValue* gap_length = css_parsing_utils::ConsumeGapLength(range, context); if (!gap_length || !range.AtEnd()) return false; - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyColumnGap, CSSPropertyGridColumnGap, *gap_length, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return true; } @@ -39,5 +40,5 @@ const CSSValue* GridColumnGap::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_custom.cc index 0a30b7b7a0a..ac57385e3bd 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_custom.cc @@ -20,15 +20,15 @@ CSSValueList* ConsumeImplicitAutoFlow(CSSParserTokenRange& range, const CSSValue& flow_direction) { // [ auto-flow && dense? ] CSSValue* dense_algorithm = nullptr; - if ((CSSPropertyParserHelpers::ConsumeIdent<CSSValueAutoFlow>(range))) { + if ((css_property_parser_helpers::ConsumeIdent<CSSValueAutoFlow>(range))) { dense_algorithm = - CSSPropertyParserHelpers::ConsumeIdent<CSSValueDense>(range); + css_property_parser_helpers::ConsumeIdent<CSSValueDense>(range); } else { dense_algorithm = - CSSPropertyParserHelpers::ConsumeIdent<CSSValueDense>(range); + css_property_parser_helpers::ConsumeIdent<CSSValueDense>(range); if (!dense_algorithm) return nullptr; - if (!CSSPropertyParserHelpers::ConsumeIdent<CSSValueAutoFlow>(range)) + if (!css_property_parser_helpers::ConsumeIdent<CSSValueAutoFlow>(range)) return nullptr; } CSSValueList* list = CSSValueList::CreateSpaceSeparated(); @@ -39,7 +39,7 @@ CSSValueList* ConsumeImplicitAutoFlow(CSSParserTokenRange& range, } } // namespace -namespace CSSShorthand { +namespace css_shorthand { bool Grid::ParseShorthand(bool important, CSSParserTokenRange& range, @@ -54,39 +54,45 @@ bool Grid::ParseShorthand(bool important, CSSValue* template_columns = nullptr; CSSValue* template_areas = nullptr; - if (CSSParsingUtils::ConsumeGridTemplateShorthand( + if (css_parsing_utils::ConsumeGridTemplateShorthand( important, range, context, template_rows, template_columns, template_areas)) { DCHECK(template_rows); DCHECK(template_columns); DCHECK(template_areas); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyGridTemplateRows, CSSPropertyGrid, *template_rows, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyGridTemplateColumns, CSSPropertyGrid, *template_columns, - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyGridTemplateAreas, CSSPropertyGrid, *template_areas, - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); // It can only be specified the explicit or the implicit grid properties in // a single grid declaration. The sub-properties not specified are set to // their initial value, as normal for shorthands. - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyGridAutoFlow, CSSPropertyGrid, *CSSInitialValue::Create(), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyGridAutoColumns, CSSPropertyGrid, *CSSInitialValue::Create(), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyGridAutoRows, CSSPropertyGrid, *CSSInitialValue::Create(), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); return true; } @@ -99,35 +105,38 @@ bool Grid::ParseShorthand(bool important, template_rows = nullptr; template_columns = nullptr; - if (CSSPropertyParserHelpers::IdentMatches<CSSValueDense, CSSValueAutoFlow>( + if (css_property_parser_helpers::IdentMatches<CSSValueDense, + CSSValueAutoFlow>( range.Peek().Id())) { // 2- [ auto-flow && dense? ] <grid-auto-rows>? / <grid-template-columns> grid_auto_flow = ConsumeImplicitAutoFlow( range, *CSSIdentifierValue::Create(CSSValueRow)); if (!grid_auto_flow) return false; - if (CSSPropertyParserHelpers::ConsumeSlashIncludingWhitespace(range)) { + if (css_property_parser_helpers::ConsumeSlashIncludingWhitespace(range)) { auto_rows_value = CSSInitialValue::Create(); } else { - auto_rows_value = CSSParsingUtils::ConsumeGridTrackList( - range, context.Mode(), CSSParsingUtils::TrackListType::kGridAuto); + auto_rows_value = css_parsing_utils::ConsumeGridTrackList( + range, context, context.Mode(), + css_parsing_utils::TrackListType::kGridAuto); if (!auto_rows_value) return false; - if (!CSSPropertyParserHelpers::ConsumeSlashIncludingWhitespace(range)) + if (!css_property_parser_helpers::ConsumeSlashIncludingWhitespace(range)) return false; } - if (!(template_columns = CSSParsingUtils::ConsumeGridTemplatesRowsOrColumns( - range, context.Mode()))) + if (!(template_columns = + css_parsing_utils::ConsumeGridTemplatesRowsOrColumns( + range, context, context.Mode()))) return false; template_rows = CSSInitialValue::Create(); auto_columns_value = CSSInitialValue::Create(); } else { // 3- <grid-template-rows> / [ auto-flow && dense? ] <grid-auto-columns>? - template_rows = CSSParsingUtils::ConsumeGridTemplatesRowsOrColumns( - range, context.Mode()); + template_rows = css_parsing_utils::ConsumeGridTemplatesRowsOrColumns( + range, context, context.Mode()); if (!template_rows) return false; - if (!CSSPropertyParserHelpers::ConsumeSlashIncludingWhitespace(range)) + if (!css_property_parser_helpers::ConsumeSlashIncludingWhitespace(range)) return false; grid_auto_flow = ConsumeImplicitAutoFlow( range, *CSSIdentifierValue::Create(CSSValueColumn)); @@ -136,8 +145,9 @@ bool Grid::ParseShorthand(bool important, if (range.AtEnd()) { auto_columns_value = CSSInitialValue::Create(); } else { - auto_columns_value = CSSParsingUtils::ConsumeGridTrackList( - range, context.Mode(), CSSParsingUtils::TrackListType::kGridAuto); + auto_columns_value = css_parsing_utils::ConsumeGridTrackList( + range, context, context.Mode(), + css_parsing_utils::TrackListType::kGridAuto); if (!auto_columns_value) return false; } @@ -151,27 +161,30 @@ bool Grid::ParseShorthand(bool important, // It can only be specified the explicit or the implicit grid properties in a // single grid declaration. The sub-properties not specified are set to their // initial value, as normal for shorthands. - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyGridTemplateColumns, CSSPropertyGrid, *template_columns, - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyGridTemplateRows, CSSPropertyGrid, *template_rows, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyGridTemplateAreas, CSSPropertyGrid, *CSSInitialValue::Create(), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyGridAutoFlow, CSSPropertyGrid, *grid_auto_flow, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyGridAutoColumns, CSSPropertyGrid, *auto_columns_value, - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyGridAutoRows, CSSPropertyGrid, *auto_rows_value, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return true; } @@ -190,5 +203,5 @@ const CSSValue* Grid::CSSValueFromComputedStyleInternal( gridShorthand(), style, layout_object, styled_node, allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_gap_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_gap_custom.cc index 745d12a4772..a78285a531f 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_gap_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_gap_custom.cc @@ -12,7 +12,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool GridGap::ParseShorthand( bool important, @@ -21,18 +21,20 @@ bool GridGap::ParseShorthand( const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { DCHECK_EQ(shorthandForProperty(CSSPropertyGridGap).length(), 2u); - CSSValue* row_gap = CSSParsingUtils::ConsumeGapLength(range, context); - CSSValue* column_gap = CSSParsingUtils::ConsumeGapLength(range, context); + CSSValue* row_gap = css_parsing_utils::ConsumeGapLength(range, context); + CSSValue* column_gap = css_parsing_utils::ConsumeGapLength(range, context); if (!row_gap || !range.AtEnd()) return false; if (!column_gap) column_gap = row_gap; - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyRowGap, CSSPropertyGap, *row_gap, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyColumnGap, CSSPropertyGap, *column_gap, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return true; } @@ -47,5 +49,5 @@ const CSSValue* GridGap::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_row_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_row_custom.cc index 01c3a4833e8..11877a4f8d0 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_row_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_row_custom.cc @@ -12,12 +12,12 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool GridRow::ParseShorthand( bool important, CSSParserTokenRange& range, - const CSSParserContext&, + const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { const StylePropertyShorthand& shorthand = @@ -26,18 +26,18 @@ bool GridRow::ParseShorthand( CSSValue* start_value = nullptr; CSSValue* end_value = nullptr; - if (!CSSParsingUtils::ConsumeGridItemPositionShorthand( - important, range, start_value, end_value)) { + if (!css_parsing_utils::ConsumeGridItemPositionShorthand( + important, range, context, start_value, end_value)) { return false; } - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( shorthand.properties()[0]->PropertyID(), CSSPropertyGridRow, *start_value, - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( shorthand.properties()[1]->PropertyID(), CSSPropertyGridRow, *end_value, - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); return true; @@ -54,5 +54,5 @@ const CSSValue* GridRow::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_row_gap_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_row_gap_custom.cc index 6150d68f0b6..3a35691a678 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_row_gap_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_row_gap_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool GridRowGap::ParseShorthand( bool important, @@ -18,13 +18,14 @@ bool GridRowGap::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - CSSValue* gap_length = CSSParsingUtils::ConsumeGapLength(range, context); + CSSValue* gap_length = css_parsing_utils::ConsumeGapLength(range, context); if (!gap_length || !range.AtEnd()) return false; - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyRowGap, CSSPropertyGridRowGap, *gap_length, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return true; } @@ -39,5 +40,5 @@ const CSSValue* GridRowGap::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_template_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_template_custom.cc index d4a921bdcf2..514539f0c34 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_template_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/grid_template_custom.cc @@ -13,7 +13,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool GridTemplate::ParseShorthand( bool important, @@ -24,7 +24,7 @@ bool GridTemplate::ParseShorthand( CSSValue* template_rows = nullptr; CSSValue* template_columns = nullptr; CSSValue* template_areas = nullptr; - if (!CSSParsingUtils::ConsumeGridTemplateShorthand( + if (!css_parsing_utils::ConsumeGridTemplateShorthand( important, range, context, template_rows, template_columns, template_areas)) return false; @@ -33,17 +33,18 @@ bool GridTemplate::ParseShorthand( DCHECK(template_columns); DCHECK(template_areas); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyGridTemplateRows, CSSPropertyGridTemplate, *template_rows, - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyGridTemplateColumns, CSSPropertyGridTemplate, *template_columns, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyGridTemplateAreas, CSSPropertyGridTemplate, *template_areas, - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); return true; @@ -65,5 +66,5 @@ const CSSValue* GridTemplate::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/inset_block_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/inset_block_custom.cc index c60122b98b7..078558ede26 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/inset_block_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/inset_block_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool InsetBlock::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool InsetBlock::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + return css_property_parser_helpers::ConsumeShorthandVia2Longhands( insetBlockShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* InsetBlock::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/inset_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/inset_custom.cc index e76065f6e0b..d7cf29c2a70 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/inset_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/inset_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool Inset::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool Inset::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia4Longhands( + return css_property_parser_helpers::ConsumeShorthandVia4Longhands( insetShorthand(), important, context, range, properties); } @@ -32,5 +32,5 @@ const CSSValue* Inset::CSSValueFromComputedStyleInternal( insetShorthand(), style, layout_object, styled_node, allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/inset_inline_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/inset_inline_custom.cc index 7a6e6d27ec0..7d04665f6d4 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/inset_inline_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/inset_inline_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool InsetInline::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool InsetInline::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + return css_property_parser_helpers::ConsumeShorthandVia2Longhands( insetInlineShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* InsetInline::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/list_style_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/list_style_custom.cc index 28332ec69ec..0c99adbfbb2 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/list_style_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/list_style_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool ListStyle::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool ListStyle::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( + return css_property_parser_helpers::ConsumeShorthandGreedilyViaLonghands( listStyleShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* ListStyle::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/margin_block_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/margin_block_custom.cc index aa8384ab05c..ffb1a795592 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/margin_block_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/margin_block_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool MarginBlock::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool MarginBlock::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + return css_property_parser_helpers::ConsumeShorthandVia2Longhands( marginBlockShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* MarginBlock::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/margin_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/margin_custom.cc index 7d3493eeb65..03334831065 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/margin_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/margin_custom.cc @@ -11,7 +11,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool Margin::ParseShorthand( bool important, @@ -19,7 +19,7 @@ bool Margin::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia4Longhands( + return css_property_parser_helpers::ConsumeShorthandVia4Longhands( marginShorthand(), important, context, range, properties); } @@ -42,5 +42,5 @@ const CSSValue* Margin::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/margin_inline_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/margin_inline_custom.cc index f6ad3c6ff84..deb0ef952d9 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/margin_inline_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/margin_inline_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool MarginInline::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool MarginInline::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + return css_property_parser_helpers::ConsumeShorthandVia2Longhands( marginInlineShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* MarginInline::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/marker_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/marker_custom.cc index 5ecb12677af..5f304bfbe31 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/marker_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/marker_custom.cc @@ -7,7 +7,7 @@ #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool Marker::ParseShorthand( bool important, @@ -15,22 +15,25 @@ bool Marker::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - const CSSValue* marker = CSSPropertyParserHelpers::ParseLonghand( + const CSSValue* marker = css_property_parser_helpers::ParseLonghand( CSSPropertyMarkerStart, CSSPropertyMarker, context, range); if (!marker || !range.AtEnd()) return false; - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyMarkerStart, CSSPropertyMarker, *marker, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyMarkerMid, CSSPropertyMarker, *marker, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyMarkerEnd, CSSPropertyMarker, *marker, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return true; } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/offset_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/offset_custom.cc index bfdc1cab2e0..81169ef4b7c 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/offset_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/offset_custom.cc @@ -15,7 +15,7 @@ #include "third_party/blink/renderer/platform/runtime_enabled_features.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool Offset::ParseShorthand( bool important, @@ -31,20 +31,20 @@ bool Offset::ParseShorthand( ToLonghand(GetCSSPropertyOffsetPosition()) .ParseSingleValue(range, context, CSSParserLocalContext()); const CSSValue* offset_path = - CSSParsingUtils::ConsumeOffsetPath(range, context); + css_parsing_utils::ConsumeOffsetPath(range, context); const CSSValue* offset_distance = nullptr; const CSSValue* offset_rotate = nullptr; if (offset_path) { - offset_distance = CSSPropertyParserHelpers::ConsumeLengthOrPercent( + offset_distance = css_property_parser_helpers::ConsumeLengthOrPercent( range, context.Mode(), kValueRangeAll); - offset_rotate = CSSParsingUtils::ConsumeOffsetRotate(range, context); + offset_rotate = css_parsing_utils::ConsumeOffsetRotate(range, context); if (offset_rotate && !offset_distance) { - offset_distance = CSSPropertyParserHelpers::ConsumeLengthOrPercent( + offset_distance = css_property_parser_helpers::ConsumeLengthOrPercent( range, context.Mode(), kValueRangeAll); } } const CSSValue* offset_anchor = nullptr; - if (CSSPropertyParserHelpers::ConsumeSlashIncludingWhitespace(range)) { + if (css_property_parser_helpers::ConsumeSlashIncludingWhitespace(range)) { offset_anchor = ToLonghand(GetCSSPropertyOffsetAnchor()) .ParseSingleValue(range, context, CSSParserLocalContext()); @@ -59,59 +59,69 @@ bool Offset::ParseShorthand( return false; if (offset_position) { - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyOffsetPosition, CSSPropertyOffset, *offset_position, - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); } else if (RuntimeEnabledFeatures::CSSOffsetPositionAnchorEnabled()) { - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyOffsetPosition, CSSPropertyOffset, *CSSInitialValue::Create(), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); } if (offset_path) { - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyOffsetPath, CSSPropertyOffset, *offset_path, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); } else { - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyOffsetPath, CSSPropertyOffset, *CSSInitialValue::Create(), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); } if (offset_distance) { - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyOffsetDistance, CSSPropertyOffset, *offset_distance, - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); } else { - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyOffsetDistance, CSSPropertyOffset, *CSSInitialValue::Create(), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); } if (offset_rotate) { - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyOffsetRotate, CSSPropertyOffset, *offset_rotate, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); } else { - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyOffsetRotate, CSSPropertyOffset, *CSSInitialValue::Create(), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); } if (offset_anchor) { - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyOffsetAnchor, CSSPropertyOffset, *offset_anchor, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); } else if (RuntimeEnabledFeatures::CSSOffsetPositionAnchorEnabled()) { - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyOffsetAnchor, CSSPropertyOffset, *CSSInitialValue::Create(), - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); } @@ -128,5 +138,5 @@ const CSSValue* Offset::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/outline_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/outline_custom.cc index a387e6bd181..48fc568b9ed 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/outline_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/outline_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool Outline::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool Outline::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( + return css_property_parser_helpers::ConsumeShorthandGreedilyViaLonghands( outlineShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* Outline::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/overflow_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/overflow_custom.cc index fac920462eb..47d279acc4b 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/overflow_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/overflow_custom.cc @@ -11,7 +11,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool Overflow::ParseShorthand( bool important, @@ -51,12 +51,14 @@ bool Overflow::ParseShorthand( overflow_x_value = CSSIdentifierValue::Create(CSSValueAuto); else overflow_x_value = overflow_y_value; - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyOverflowX, CSSPropertyOverflow, *overflow_x_value, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyOverflowY, CSSPropertyOverflow, *overflow_y_value, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return true; } @@ -74,5 +76,5 @@ const CSSValue* Overflow::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/overscroll_behavior_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/overscroll_behavior_custom.cc index c43ba762fcd..92e2ceaae74 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/overscroll_behavior_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/overscroll_behavior_custom.cc @@ -9,7 +9,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool OverscrollBehavior::ParseShorthand( bool important, @@ -17,7 +17,7 @@ bool OverscrollBehavior::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + return css_property_parser_helpers::ConsumeShorthandVia2Longhands( overscrollBehaviorShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* OverscrollBehavior::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/padding_block_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/padding_block_custom.cc index 036c17e0815..580b8a03278 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/padding_block_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/padding_block_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool PaddingBlock::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool PaddingBlock::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + return css_property_parser_helpers::ConsumeShorthandVia2Longhands( paddingBlockShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* PaddingBlock::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/padding_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/padding_custom.cc index 808e45efc9d..c44429896ba 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/padding_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/padding_custom.cc @@ -11,7 +11,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool Padding::ParseShorthand( bool important, @@ -19,7 +19,7 @@ bool Padding::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia4Longhands( + return css_property_parser_helpers::ConsumeShorthandVia4Longhands( paddingShorthand(), important, context, range, properties); } @@ -42,5 +42,5 @@ const CSSValue* Padding::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/padding_inline_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/padding_inline_custom.cc index 73c747b6a4d..b60986b8822 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/padding_inline_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/padding_inline_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool PaddingInline::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool PaddingInline::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + return css_property_parser_helpers::ConsumeShorthandVia2Longhands( paddingInlineShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* PaddingInline::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/page_break_after_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/page_break_after_custom.cc index 3960363453e..44e8dd93372 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/page_break_after_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/page_break_after_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool PageBreakAfter::ParseShorthand( bool important, @@ -19,15 +19,16 @@ bool PageBreakAfter::ParseShorthand( const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { CSSValueID value; - if (!CSSParsingUtils::ConsumeFromPageBreakBetween(range, value)) { + if (!css_parsing_utils::ConsumeFromPageBreakBetween(range, value)) { return false; } DCHECK_NE(value, CSSValueInvalid); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyBreakAfter, CSSPropertyPageBreakAfter, *CSSIdentifierValue::Create(value), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return true; } @@ -40,5 +41,5 @@ const CSSValue* PageBreakAfter::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForPageBreakBetween(style.BreakAfter()); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/page_break_before_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/page_break_before_custom.cc index 44c0fbd0844..a9958fb23d1 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/page_break_before_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/page_break_before_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool PageBreakBefore::ParseShorthand( bool important, @@ -19,15 +19,16 @@ bool PageBreakBefore::ParseShorthand( const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { CSSValueID value; - if (!CSSParsingUtils::ConsumeFromPageBreakBetween(range, value)) { + if (!css_parsing_utils::ConsumeFromPageBreakBetween(range, value)) { return false; } DCHECK_NE(value, CSSValueInvalid); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyBreakBefore, CSSPropertyPageBreakBefore, *CSSIdentifierValue::Create(value), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return true; } @@ -40,5 +41,5 @@ const CSSValue* PageBreakBefore::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForPageBreakBetween(style.BreakBefore()); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/page_break_inside_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/page_break_inside_custom.cc index f038750ebbf..0860022c8fa 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/page_break_inside_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/page_break_inside_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool PageBreakInside::ParseShorthand( bool important, @@ -19,14 +19,15 @@ bool PageBreakInside::ParseShorthand( const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { CSSValueID value; - if (!CSSParsingUtils::ConsumeFromColumnOrPageBreakInside(range, value)) { + if (!css_parsing_utils::ConsumeFromColumnOrPageBreakInside(range, value)) { return false; } - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyBreakInside, CSSPropertyPageBreakInside, *CSSIdentifierValue::Create(value), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return true; } @@ -39,5 +40,5 @@ const CSSValue* PageBreakInside::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForPageBreakInside(style.BreakInside()); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/place_content_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/place_content_custom.cc index 3114d6601d8..99c29aac3fc 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/place_content_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/place_content_custom.cc @@ -12,7 +12,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool PlaceContent::ParseShorthand( bool important, @@ -41,14 +41,15 @@ bool PlaceContent::ParseShorthand( DCHECK(align_content_value); DCHECK(justify_content_value); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyAlignContent, CSSPropertyPlaceContent, *align_content_value, - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyJustifyContent, CSSPropertyPlaceContent, *justify_content_value, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return true; } @@ -66,5 +67,5 @@ const CSSValue* PlaceContent::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/place_items_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/place_items_custom.cc index 7870df724d7..c7b6c2fbc6b 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/place_items_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/place_items_custom.cc @@ -12,7 +12,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool PlaceItems::ParseShorthand( bool important, @@ -41,13 +41,13 @@ bool PlaceItems::ParseShorthand( DCHECK(align_items_value); DCHECK(justify_items_value); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyAlignItems, CSSPropertyPlaceItems, *align_items_value, - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyJustifyItems, CSSPropertyPlaceItems, *justify_items_value, - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); return true; @@ -66,5 +66,5 @@ const CSSValue* PlaceItems::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/place_self_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/place_self_custom.cc index c41c353b28c..c4683c941f8 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/place_self_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/place_self_custom.cc @@ -12,7 +12,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool PlaceSelf::ParseShorthand( bool important, @@ -41,12 +41,13 @@ bool PlaceSelf::ParseShorthand( DCHECK(align_self_value); DCHECK(justify_self_value); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyAlignSelf, CSSPropertyPlaceSelf, *align_self_value, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyJustifySelf, CSSPropertyPlaceSelf, *justify_self_value, - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); return true; @@ -65,5 +66,5 @@ const CSSValue* PlaceSelf::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_margin_block_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_margin_block_custom.cc index 9da1785091e..9b2f504b6f7 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_margin_block_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_margin_block_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool ScrollMarginBlock::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool ScrollMarginBlock::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + return css_property_parser_helpers::ConsumeShorthandVia2Longhands( scrollMarginBlockShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* ScrollMarginBlock::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_margin_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_margin_custom.cc index 57a56333f85..3cf8b9c7386 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_margin_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_margin_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool ScrollMargin::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool ScrollMargin::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia4Longhands( + return css_property_parser_helpers::ConsumeShorthandVia4Longhands( scrollMarginShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* ScrollMargin::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_margin_inline_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_margin_inline_custom.cc index 0ea529f1a03..1c8b2b737ca 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_margin_inline_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_margin_inline_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool ScrollMarginInline::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool ScrollMarginInline::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + return css_property_parser_helpers::ConsumeShorthandVia2Longhands( scrollMarginInlineShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* ScrollMarginInline::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_padding_block_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_padding_block_custom.cc index 404d7b7f5b4..f3c70674a02 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_padding_block_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_padding_block_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool ScrollPaddingBlock::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool ScrollPaddingBlock::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + return css_property_parser_helpers::ConsumeShorthandVia2Longhands( scrollPaddingBlockShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* ScrollPaddingBlock::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_padding_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_padding_custom.cc index 28330aab1a7..2075592e5c0 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_padding_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_padding_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool ScrollPadding::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool ScrollPadding::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia4Longhands( + return css_property_parser_helpers::ConsumeShorthandVia4Longhands( scrollPaddingShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* ScrollPadding::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_padding_inline_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_padding_inline_custom.cc index a46a074d0bb..414a5825aa6 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_padding_inline_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/scroll_padding_inline_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool ScrollPaddingInline::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool ScrollPaddingInline::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + return css_property_parser_helpers::ConsumeShorthandVia2Longhands( scrollPaddingInlineShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* ScrollPaddingInline::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/text_decoration_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/text_decoration_custom.cc index c321e20999c..9aefde62344 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/text_decoration_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/text_decoration_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool TextDecoration::ParseShorthand( bool important, @@ -18,7 +18,7 @@ bool TextDecoration::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( + return css_property_parser_helpers::ConsumeShorthandGreedilyViaLonghands( textDecorationShorthand(), important, context, range, properties); } @@ -33,5 +33,5 @@ const CSSValue* TextDecoration::CSSValueFromComputedStyleInternal( allow_visited_style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/transition_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/transition_custom.cc index ddce931bfb5..e68f627cfb3 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/transition_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/transition_custom.cc @@ -18,18 +18,18 @@ namespace { CSSValue* ConsumeTransitionValue(CSSPropertyID property, CSSParserTokenRange& range, - const CSSParserContext&, + const CSSParserContext& context, bool use_legacy_parsing) { switch (property) { case CSSPropertyTransitionDelay: - return CSSPropertyParserHelpers::ConsumeTime(range, kValueRangeAll); + return css_property_parser_helpers::ConsumeTime(range, kValueRangeAll); case CSSPropertyTransitionDuration: - return CSSPropertyParserHelpers::ConsumeTime(range, - kValueRangeNonNegative); + return css_property_parser_helpers::ConsumeTime(range, + kValueRangeNonNegative); case CSSPropertyTransitionProperty: - return CSSParsingUtils::ConsumeTransitionProperty(range); + return css_parsing_utils::ConsumeTransitionProperty(range, context); case CSSPropertyTransitionTimingFunction: - return CSSParsingUtils::ConsumeAnimationTimingFunction(range); + return css_parsing_utils::ConsumeAnimationTimingFunction(range); default: NOTREACHED(); return nullptr; @@ -37,7 +37,7 @@ CSSValue* ConsumeTransitionValue(CSSPropertyID property, } } // namespace -namespace CSSShorthand { +namespace css_shorthand { bool Transition::ParseShorthand( bool important, @@ -48,9 +48,9 @@ bool Transition::ParseShorthand( const StylePropertyShorthand shorthand = transitionShorthandForParsing(); const unsigned longhand_count = shorthand.length(); - HeapVector<Member<CSSValueList>, CSSParsingUtils::kMaxNumAnimationLonghands> + HeapVector<Member<CSSValueList>, css_parsing_utils::kMaxNumAnimationLonghands> longhands(longhand_count); - if (!CSSParsingUtils::ConsumeAnimationShorthand( + if (!css_parsing_utils::ConsumeAnimationShorthand( shorthand, longhands, ConsumeTransitionValue, range, context, local_context.UseAliasParsing())) { return false; @@ -58,14 +58,15 @@ bool Transition::ParseShorthand( for (unsigned i = 0; i < longhand_count; ++i) { if (shorthand.properties()[i]->IDEquals(CSSPropertyTransitionProperty) && - !CSSParsingUtils::IsValidPropertyList(*longhands[i])) + !css_parsing_utils::IsValidPropertyList(*longhands[i])) return false; } for (unsigned i = 0; i < longhand_count; ++i) { - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( shorthand.properties()[i]->PropertyID(), shorthand.id(), *longhands[i], - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); } @@ -113,5 +114,5 @@ const CSSValue* Transition::CSSValueFromComputedStyleInternal( return list; } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_column_break_after_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_column_break_after_custom.cc index cddb2ff5e65..bd9fad47841 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_column_break_after_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_column_break_after_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool WebkitColumnBreakAfter::ParseShorthand( bool important, @@ -19,14 +19,15 @@ bool WebkitColumnBreakAfter::ParseShorthand( const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { CSSValueID value; - if (!CSSParsingUtils::ConsumeFromColumnBreakBetween(range, value)) { + if (!css_parsing_utils::ConsumeFromColumnBreakBetween(range, value)) { return false; } - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyBreakAfter, CSSPropertyWebkitColumnBreakAfter, *CSSIdentifierValue::Create(value), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return true; } @@ -40,5 +41,5 @@ const CSSValue* WebkitColumnBreakAfter::CSSValueFromComputedStyleInternal( style.BreakAfter()); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_column_break_before_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_column_break_before_custom.cc index 724002b33f8..cd9807b5d5e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_column_break_before_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_column_break_before_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool WebkitColumnBreakBefore::ParseShorthand( bool important, @@ -19,14 +19,15 @@ bool WebkitColumnBreakBefore::ParseShorthand( const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { CSSValueID value; - if (!CSSParsingUtils::ConsumeFromColumnBreakBetween(range, value)) { + if (!css_parsing_utils::ConsumeFromColumnBreakBetween(range, value)) { return false; } - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyBreakBefore, CSSPropertyWebkitColumnBreakBefore, *CSSIdentifierValue::Create(value), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return true; } @@ -40,5 +41,5 @@ const CSSValue* WebkitColumnBreakBefore::CSSValueFromComputedStyleInternal( style.BreakBefore()); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_column_break_inside_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_column_break_inside_custom.cc index b703c990c22..8265c9485c0 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_column_break_inside_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_column_break_inside_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool WebkitColumnBreakInside::ParseShorthand( bool important, @@ -19,14 +19,15 @@ bool WebkitColumnBreakInside::ParseShorthand( const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { CSSValueID value; - if (!CSSParsingUtils::ConsumeFromColumnOrPageBreakInside(range, value)) { + if (!css_parsing_utils::ConsumeFromColumnOrPageBreakInside(range, value)) { return false; } - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyBreakInside, CSSPropertyWebkitColumnBreakInside, *CSSIdentifierValue::Create(value), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return true; } @@ -40,5 +41,5 @@ const CSSValue* WebkitColumnBreakInside::CSSValueFromComputedStyleInternal( style.BreakInside()); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_margin_collapse_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_margin_collapse_custom.cc index 985f3eb7a4e..abb474f6aa1 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_margin_collapse_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_margin_collapse_custom.cc @@ -10,7 +10,7 @@ #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool WebkitMarginCollapse::ParseShorthand( bool important, @@ -24,16 +24,18 @@ bool WebkitMarginCollapse::ParseShorthand( return false; CSSValue* before_collapse = CSSIdentifierValue::Create(id); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyWebkitMarginBeforeCollapse, CSSPropertyWebkitMarginCollapse, *before_collapse, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); if (range.AtEnd()) { - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyWebkitMarginAfterCollapse, CSSPropertyWebkitMarginCollapse, *before_collapse, important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return true; } @@ -41,12 +43,13 @@ bool WebkitMarginCollapse::ParseShorthand( if (!CSSParserFastPaths::IsValidKeywordPropertyAndValue( CSSPropertyWebkitMarginAfterCollapse, id, context.Mode())) return false; - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyWebkitMarginAfterCollapse, CSSPropertyWebkitMarginCollapse, *CSSIdentifierValue::Create(id), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return true; } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_mask_box_image_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_mask_box_image_custom.cc index 3fa1f752e36..5bc3049e018 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_mask_box_image_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_mask_box_image_custom.cc @@ -12,7 +12,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool WebkitMaskBoxImage::ParseShorthand( bool important, @@ -26,32 +26,37 @@ bool WebkitMaskBoxImage::ParseShorthand( CSSValue* outset = nullptr; CSSValue* repeat = nullptr; - if (!CSSParsingUtils::ConsumeBorderImageComponents( + if (!css_parsing_utils::ConsumeBorderImageComponents( range, context, source, slice, width, outset, repeat, - CSSParsingUtils::DefaultFill::kFill)) { + css_parsing_utils::DefaultFill::kFill)) { return false; } - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyWebkitMaskBoxImageSource, CSSPropertyWebkitMaskBoxImage, source ? *source : *CSSInitialValue::Create(), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyWebkitMaskBoxImageSlice, CSSPropertyWebkitMaskBoxImage, slice ? *slice : *CSSInitialValue::Create(), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyWebkitMaskBoxImageWidth, CSSPropertyWebkitMaskBoxImage, width ? *width : *CSSInitialValue::Create(), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyWebkitMaskBoxImageOutset, CSSPropertyWebkitMaskBoxImage, outset ? *outset : *CSSInitialValue::Create(), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); + css_property_parser_helpers::AddProperty( CSSPropertyWebkitMaskBoxImageRepeat, CSSPropertyWebkitMaskBoxImage, repeat ? *repeat : *CSSInitialValue::Create(), important, - CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); + css_property_parser_helpers::IsImplicitProperty::kNotImplicit, + properties); return true; } @@ -66,5 +71,5 @@ const CSSValue* WebkitMaskBoxImage::CSSValueFromComputedStyleInternal( style); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_mask_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_mask_custom.cc index 36461420a20..5656c80725b 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_mask_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_mask_custom.cc @@ -7,7 +7,7 @@ #include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool WebkitMask::ParseShorthand( bool important, @@ -15,9 +15,9 @@ bool WebkitMask::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext& local_context, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSParsingUtils::ParseBackgroundOrMask(important, range, context, - local_context, properties); + return css_parsing_utils::ParseBackgroundOrMask(important, range, context, + local_context, properties); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_mask_position_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_mask_position_custom.cc index 7cdd0fa4405..d0746642917 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_mask_position_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_mask_position_custom.cc @@ -11,7 +11,7 @@ #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool WebkitMaskPosition::ParseShorthand( bool important, @@ -22,20 +22,20 @@ bool WebkitMaskPosition::ParseShorthand( CSSValue* result_x = nullptr; CSSValue* result_y = nullptr; - if (!CSSParsingUtils::ConsumeBackgroundPosition( - range, context, CSSPropertyParserHelpers::UnitlessQuirk::kAllow, + if (!css_parsing_utils::ConsumeBackgroundPosition( + range, context, css_property_parser_helpers::UnitlessQuirk::kAllow, result_x, result_y) || !range.AtEnd()) return false; - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyWebkitMaskPositionX, CSSPropertyWebkitMaskPosition, *result_x, - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyWebkitMaskPositionY, CSSPropertyWebkitMaskPosition, *result_y, - important, CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + important, css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); return true; } @@ -50,5 +50,5 @@ const CSSValue* WebkitMaskPosition::CSSValueFromComputedStyleInternal( *this, style, &style.MaskLayers()); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_mask_repeat_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_mask_repeat_custom.cc index 8d070634fbb..585000554b6 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_mask_repeat_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_mask_repeat_custom.cc @@ -13,7 +13,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool WebkitMaskRepeat::ParseShorthand( bool important, @@ -24,22 +24,22 @@ bool WebkitMaskRepeat::ParseShorthand( CSSValue* result_x = nullptr; CSSValue* result_y = nullptr; bool implicit = false; - if (!CSSParsingUtils::ConsumeRepeatStyle(range, result_x, result_y, - implicit) || + if (!css_parsing_utils::ConsumeRepeatStyle(range, result_x, result_y, + implicit) || !range.AtEnd()) return false; - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyWebkitMaskRepeatX, CSSPropertyWebkitMaskRepeat, *result_x, important, - implicit ? CSSPropertyParserHelpers::IsImplicitProperty::kImplicit - : CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + implicit ? css_property_parser_helpers::IsImplicitProperty::kImplicit + : css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); - CSSPropertyParserHelpers::AddProperty( + css_property_parser_helpers::AddProperty( CSSPropertyWebkitMaskRepeatY, CSSPropertyWebkitMaskRepeat, *result_y, important, - implicit ? CSSPropertyParserHelpers::IsImplicitProperty::kImplicit - : CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, + implicit ? css_property_parser_helpers::IsImplicitProperty::kImplicit + : css_property_parser_helpers::IsImplicitProperty::kNotImplicit, properties); return true; @@ -55,5 +55,5 @@ const CSSValue* WebkitMaskRepeat::CSSValueFromComputedStyleInternal( &style.MaskLayers()); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_text_emphasis_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_text_emphasis_custom.cc index 55b0f8e237d..ad5322714ea 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_text_emphasis_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_text_emphasis_custom.cc @@ -8,7 +8,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool WebkitTextEmphasis::ParseShorthand( bool important, @@ -16,9 +16,9 @@ bool WebkitTextEmphasis::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( + return css_property_parser_helpers::ConsumeShorthandGreedilyViaLonghands( webkitTextEmphasisShorthand(), important, context, range, properties); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_text_stroke_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_text_stroke_custom.cc index df10d4b3b7a..3ed0b964f1e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_text_stroke_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_text_stroke_custom.cc @@ -8,7 +8,7 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { -namespace CSSShorthand { +namespace css_shorthand { bool WebkitTextStroke::ParseShorthand( bool important, @@ -16,9 +16,9 @@ bool WebkitTextStroke::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( + return css_property_parser_helpers::ConsumeShorthandGreedilyViaLonghands( webkitTextStrokeShorthand(), important, context, range, properties); } -} // namespace CSSShorthand +} // namespace css_shorthand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/style_building_utils.h b/chromium/third_party/blink/renderer/core/css/properties/style_building_utils.h index 1fba8a59397..730c294698e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/style_building_utils.h +++ b/chromium/third_party/blink/renderer/core/css/properties/style_building_utils.h @@ -7,11 +7,11 @@ #include "third_party/blink/renderer/core/style/border_image_length.h" #include "third_party/blink/renderer/core/style/border_image_length_box.h" -#include "third_party/blink/renderer/platform/length.h" -#include "third_party/blink/renderer/platform/length_box.h" +#include "third_party/blink/renderer/platform/geometry/length.h" +#include "third_party/blink/renderer/platform/geometry/length_box.h" namespace blink { -namespace StyleBuildingUtils { +namespace style_building_utils { inline bool BorderImageLengthMatchesAllSides( const BorderImageLengthBox& border_image_length_box, @@ -27,7 +27,7 @@ inline bool LengthMatchesAllSides(const LengthBox& length_box, length_box.Top() == length && length_box.Bottom() == length); } -} // namespace StyleBuildingUtils +} // namespace style_building_utils } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTIES_STYLE_BUILDING_UTILS_H_ diff --git a/chromium/third_party/blink/renderer/core/css/property_registration.cc b/chromium/third_party/blink/renderer/core/css/property_registration.cc index d5d49d7a862..883f87f96ec 100644 --- a/chromium/third_party/blink/renderer/core/css/property_registration.cc +++ b/chromium/third_party/blink/renderer/core/css/property_registration.cc @@ -46,7 +46,8 @@ PropertyRegistration::PropertyRegistration( CSSInterpolationTypesMap::CreateInterpolationTypesForCSSSyntax( name, syntax, - *this)) { + *this)), + referenced_(false) { DCHECK(RuntimeEnabledFeatures::CSSVariables2Enabled()); } @@ -90,14 +91,14 @@ static bool ComputationallyIndependent(const CSSValue& value) { void PropertyRegistration::registerProperty( ExecutionContext* execution_context, - const PropertyDescriptor& descriptor, + const PropertyDescriptor* descriptor, ExceptionState& exception_state) { // Bindings code ensures these are set. - DCHECK(descriptor.hasName()); - DCHECK(descriptor.hasInherits()); - DCHECK(descriptor.hasSyntax()); + DCHECK(descriptor->hasName()); + DCHECK(descriptor->hasInherits()); + DCHECK(descriptor->hasSyntax()); - String name = descriptor.name(); + String name = descriptor->name(); if (!CSSVariableParser::IsValidVariableName(name)) { exception_state.ThrowDOMException( DOMExceptionCode::kSyntaxError, @@ -114,7 +115,7 @@ void PropertyRegistration::registerProperty( return; } - CSSSyntaxDescriptor syntax_descriptor(descriptor.syntax()); + CSSSyntaxDescriptor syntax_descriptor(descriptor->syntax()); if (!syntax_descriptor.IsValid()) { exception_state.ThrowDOMException( DOMExceptionCode::kSyntaxError, @@ -127,8 +128,8 @@ void PropertyRegistration::registerProperty( const CSSValue* initial = nullptr; scoped_refptr<CSSVariableData> initial_variable_data; - if (descriptor.hasInitialValue()) { - CSSTokenizer tokenizer(descriptor.initialValue()); + if (descriptor->hasInitialValue()) { + CSSTokenizer tokenizer(descriptor->initialValue()); const auto tokens = tokenizer.TokenizeToEOF(); bool is_animation_tainted = false; initial = syntax_descriptor.Parse(CSSParserTokenRange(tokens), @@ -145,8 +146,8 @@ void PropertyRegistration::registerProperty( "The initial value provided is not computationally independent."); return; } - initial = - &StyleBuilderConverter::ConvertRegisteredPropertyInitialValue(*initial); + initial = &StyleBuilderConverter::ConvertRegisteredPropertyInitialValue( + *document, *initial); initial_variable_data = CSSVariableData::Create( CSSParserTokenRange(tokens), is_animation_tainted, false, parser_context->BaseURL(), parser_context->Charset()); @@ -159,9 +160,9 @@ void PropertyRegistration::registerProperty( } } registry.RegisterProperty( - atomic_name, *new PropertyRegistration(atomic_name, syntax_descriptor, - descriptor.inherits(), initial, - std::move(initial_variable_data))); + atomic_name, *MakeGarbageCollected<PropertyRegistration>( + atomic_name, syntax_descriptor, descriptor->inherits(), + initial, std::move(initial_variable_data))); document->GetStyleEngine().CustomPropertyRegistered(); } diff --git a/chromium/third_party/blink/renderer/core/css/property_registration.h b/chromium/third_party/blink/renderer/core/css/property_registration.h index 68639ad494b..2986ee03c42 100644 --- a/chromium/third_party/blink/renderer/core/css/property_registration.h +++ b/chromium/third_party/blink/renderer/core/css/property_registration.h @@ -26,12 +26,18 @@ class CORE_EXPORT PropertyRegistration : public GarbageCollectedFinalized<PropertyRegistration> { public: static void registerProperty(ExecutionContext*, - const PropertyDescriptor&, + const PropertyDescriptor*, ExceptionState&); static const PropertyRegistration* From(const ExecutionContext*, const AtomicString& property_name); + PropertyRegistration(const AtomicString& name, + const CSSSyntaxDescriptor&, + bool inherits, + const CSSValue* initial, + scoped_refptr<CSSVariableData> initial_variable_data); + const CSSSyntaxDescriptor& Syntax() const { return syntax_; } bool Inherits() const { return inherits_; } const CSSValue* Initial() const { return initial_; } @@ -45,17 +51,14 @@ class CORE_EXPORT PropertyRegistration void Trace(blink::Visitor* visitor) { visitor->Trace(initial_); } private: - PropertyRegistration(const AtomicString& name, - const CSSSyntaxDescriptor&, - bool inherits, - const CSSValue* initial, - scoped_refptr<CSSVariableData> initial_variable_data); + friend class ::blink::PropertyRegistry; const CSSSyntaxDescriptor syntax_; const bool inherits_; const Member<const CSSValue> initial_; const scoped_refptr<CSSVariableData> initial_variable_data_; const InterpolationTypes interpolation_types_; + mutable bool referenced_; FRIEND_TEST_ALL_PREFIXES(CSSVariableResolverTest, NeedsResolutionClearedByResolver); diff --git a/chromium/third_party/blink/renderer/core/css/property_registry.cc b/chromium/third_party/blink/renderer/core/css/property_registry.cc index 28ff581082c..8bc06920796 100644 --- a/chromium/third_party/blink/renderer/core/css/property_registry.cc +++ b/chromium/third_party/blink/renderer/core/css/property_registry.cc @@ -57,4 +57,19 @@ const CSSValue* PropertyRegistry::ParseIfRegistered( return parsed_value ? parsed_value : value; } +void PropertyRegistry::MarkReferenced(const AtomicString& property_name) const { + const PropertyRegistration* registration = Registration(property_name); + if (registration) { + registration->referenced_ = true; + } +} + +bool PropertyRegistry::WasReferenced(const AtomicString& property_name) const { + const PropertyRegistration* registration = Registration(property_name); + if (!registration) { + return false; + } + return registration->referenced_; +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/property_registry.h b/chromium/third_party/blink/renderer/core/css/property_registry.h index b9dc7a10ef4..6f7f0503db4 100644 --- a/chromium/third_party/blink/renderer/core/css/property_registry.h +++ b/chromium/third_party/blink/renderer/core/css/property_registry.h @@ -16,7 +16,9 @@ class CORE_EXPORT PropertyRegistry : public GarbageCollected<PropertyRegistry> { using RegistrationMap = HeapHashMap<AtomicString, Member<PropertyRegistration>>; - static PropertyRegistry* Create() { return new PropertyRegistry(); } + static PropertyRegistry* Create() { + return MakeGarbageCollected<PropertyRegistry>(); + } void RegisterProperty(const AtomicString&, PropertyRegistration&); const PropertyRegistration* Registration(const AtomicString&) const; @@ -36,6 +38,9 @@ class CORE_EXPORT PropertyRegistry : public GarbageCollected<PropertyRegistry> { const AtomicString& property_name, const CSSValue*); + void MarkReferenced(const AtomicString&) const; + bool WasReferenced(const AtomicString&) const; + private: RegistrationMap registrations_; }; diff --git a/chromium/third_party/blink/renderer/core/css/quirks.css b/chromium/third_party/blink/renderer/core/css/quirks.css deleted file mode 100644 index e880fe0e90f..00000000000 --- a/chromium/third_party/blink/renderer/core/css/quirks.css +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Additonal style sheet used to render HTML pages in quirks mode. - * - * Copyright (C) 2000-2003 Lars Knoll (knoll@kde.org) - * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -/* Give floated images margins of 3px */ -img[align="left" i] { - margin-right: 3px; -} -img[align="right" i] { - margin-left: 3px; -} - -/* Tables reset both line-height and white-space in quirks mode. */ -/* Compatible with WinIE. Note that font-family is *not* reset. */ -table { - white-space: normal; - line-height: normal; - font-weight: normal; - font-size: medium; - font-variant: normal; - font-style: normal; - color: -internal-quirk-inherit; - text-align: start; -} - -/* This will apply only to text fields, since all other inputs already use border box sizing */ -input:not([type=image i]), textarea { - box-sizing: border-box; -} - -/* Set margin-bottom for form element in quirks mode. */ -/* Compatible with Gecko. (Doing this only for quirks mode is a fix for bug 17696.) */ -form { - margin-block-end: 1em -} diff --git a/chromium/third_party/blink/renderer/core/css/remote_font_face_source.cc b/chromium/third_party/blink/renderer/core/css/remote_font_face_source.cc index 9eff7047b0d..2f758c5d349 100644 --- a/chromium/third_party/blink/renderer/core/css/remote_font_face_source.cc +++ b/chromium/third_party/blink/renderer/core/css/remote_font_face_source.cc @@ -235,9 +235,9 @@ RemoteFontFaceSource::CreateLoadingFallbackFontData( const FontDescription& font_description) { // This temporary font is not retained and should not be returned. FontCachePurgePreventer font_cache_purge_preventer; - SimpleFontData* temporary_font = - FontCache::GetFontCache()->GetNonRetainedLastResortFallbackFont( - font_description); + scoped_refptr<SimpleFontData> temporary_font = + FontCache::GetFontCache()->GetLastResortFallbackFont(font_description, + kDoNotRetain); if (!temporary_font) { NOTREACHED(); return nullptr; @@ -253,6 +253,8 @@ void RemoteFontFaceSource::BeginLoadIfNeeded() { return; DCHECK(GetResource()); + SetDisplay(face_->GetFontFace()->GetFontDisplayWithFallback()); + FontResource* font = ToFontResource(GetResource()); if (font->StillNeedsLoad()) { if (font->IsLowPriorityLoadingAllowedForRemoteFont()) { @@ -330,11 +332,11 @@ void RemoteFontFaceSource::FontLoadHistograms::RecordRemoteFont( int duration = static_cast<int>(CurrentTimeMS() - load_start_time_); RecordLoadTimeHistogram(font, duration); - enum { kCORSFail, kCORSSuccess, kCORSEnumMax }; + enum { kCorsFail, kCorsSuccess, kCorsEnumMax }; int cors_value = - font->GetResponse().IsCORSSameOrigin() ? kCORSSuccess : kCORSFail; + font->GetResponse().IsCorsSameOrigin() ? kCorsSuccess : kCorsFail; DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, cors_histogram, - ("WebFont.CORSSuccess", kCORSEnumMax)); + ("WebFont.CORSSuccess", kCorsEnumMax)); cors_histogram.Count(cors_value); } } diff --git a/chromium/third_party/blink/renderer/core/css/resolver/animated_style_builder.h b/chromium/third_party/blink/renderer/core/css/resolver/animated_style_builder.h index bfe5802f203..196c1b68426 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/animated_style_builder.h +++ b/chromium/third_party/blink/renderer/core/css/resolver/animated_style_builder.h @@ -31,7 +31,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_RESOLVER_ANIMATED_STYLE_BUILDER_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_RESOLVER_ANIMATED_STYLE_BUILDER_H_ -#include "third_party/blink/renderer/core/css_property_names.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" namespace blink { diff --git a/chromium/third_party/blink/renderer/core/css/resolver/css_property_priority.h b/chromium/third_party/blink/renderer/core/css/resolver/css_property_priority.h index 74a835ca3de..0d90ca3fe4f 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/css_property_priority.h +++ b/chromium/third_party/blink/renderer/core/css/resolver/css_property_priority.h @@ -5,7 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_RESOLVER_CSS_PROPERTY_PRIORITY_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_RESOLVER_CSS_PROPERTY_PRIORITY_H_ -#include "third_party/blink/renderer/core/css_property_names.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" namespace blink { diff --git a/chromium/third_party/blink/renderer/core/css/resolver/css_to_style_map.h b/chromium/third_party/blink/renderer/core/css/resolver/css_to_style_map.h index 827b91cde84..a50c47a51d8 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/css_to_style_map.h +++ b/chromium/third_party/blink/renderer/core/css/resolver/css_to_style_map.h @@ -25,7 +25,7 @@ #include "third_party/blink/renderer/core/animation/css/css_transition_data.h" #include "third_party/blink/renderer/core/animation/timing.h" -#include "third_party/blink/renderer/core/css_property_names.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/style/computed_style_constants.h" #include "third_party/blink/renderer/platform/animation/timing_function.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" diff --git a/chromium/third_party/blink/renderer/core/css/resolver/css_variable_resolver.cc b/chromium/third_party/blink/renderer/core/css/resolver/css_variable_resolver.cc index 57172354634..48160c189ca 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/css_variable_resolver.cc +++ b/chromium/third_party/blink/renderer/core/css/resolver/css_variable_resolver.cc @@ -5,7 +5,9 @@ #include "third_party/blink/renderer/core/css/resolver/css_variable_resolver.h" #include "third_party/blink/renderer/core/css/css_custom_property_declaration.h" +#include "third_party/blink/renderer/core/css/css_invalid_variable_value.h" #include "third_party/blink/renderer/core/css/css_pending_substitution_value.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/css_unset_value.h" #include "third_party/blink/renderer/core/css/css_variable_data.h" #include "third_party/blink/renderer/core/css/css_variable_reference_value.h" @@ -20,7 +22,6 @@ #include "third_party/blink/renderer/core/css/resolver/style_resolver_state.h" #include "third_party/blink/renderer/core/css/resolver/style_resolver_stats.h" #include "third_party/blink/renderer/core/css/style_engine.h" -#include "third_party/blink/renderer/core/css_property_names.h" #include "third_party/blink/renderer/core/css_value_keywords.h" #include "third_party/blink/renderer/core/dom/shadow_root.h" #include "third_party/blink/renderer/core/style/computed_style.h" @@ -85,14 +86,28 @@ scoped_refptr<CSSVariableData> ComputedVariableData( } // namespace -bool CSSVariableResolver::ResolveFallback(CSSParserTokenRange range, - const Options& options, - Result& result) { +CSSVariableResolver::Fallback CSSVariableResolver::ResolveFallback( + CSSParserTokenRange range, + const Options& options, + const PropertyRegistration* registration, + Result& result) { if (range.AtEnd()) - return false; + return Fallback::kNone; DCHECK_EQ(range.Peek().GetType(), kCommaToken); range.Consume(); - return ResolveTokenRange(range, options, result); + size_t first_fallback_token = result.tokens.size(); + if (!ResolveTokenRange(range, options, result)) + return Fallback::kFail; + if (registration) { + CSSParserTokenRange range(result.tokens); + range = range.MakeSubRange(&range.Peek(first_fallback_token), range.end()); + const CSSParserContext* context = + StrictCSSParserContext(state_.GetDocument().GetSecureContextMode()); + const bool is_animation_tainted = false; + if (!registration->Syntax().Parse(range, context, is_animation_tainted)) + return Fallback::kFail; + } + return Fallback::kSuccess; } scoped_refptr<CSSVariableData> CSSVariableResolver::ValueForCustomProperty( @@ -109,11 +124,31 @@ scoped_refptr<CSSVariableData> CSSVariableResolver::ValueForCustomProperty( CSSVariableData* variable_data = GetVariable(name, registration); - if (!variable_data) - return registration ? registration->InitialVariableData() : nullptr; + if (!variable_data) { + // For unregistered properties, not having a CSSVariableData here means + // that it either never existed, or we have resolved it earlier, but + // resolution failed. Either way, we return nullptr to signify that this is + // an invalid variable. + if (!registration) + return nullptr; + // For registered properties, it's more complicated. Here too, it can mean + // that it never existed, or that resolution failed earlier, but now we need + // to know which; in the former case we must provide the initial value, and + // in the latter case the variable is invalid. + return IsRegisteredVariableInvalid(name, *registration) + ? nullptr + : registration->InitialVariableData(); + } - scoped_refptr<CSSVariableData> resolved_data = - ResolveCustomPropertyIfNeeded(name, variable_data, options); + bool cycle_detected = false; + scoped_refptr<CSSVariableData> resolved_data = ResolveCustomPropertyIfNeeded( + name, variable_data, options, cycle_detected); + + if (!resolved_data && cycle_detected) { + if (options.absolutize) + SetInvalidVariable(name, registration); + return nullptr; + } if (resolved_data) { if (IsVariableDisallowed(*resolved_data, options, registration)) @@ -146,7 +181,8 @@ scoped_refptr<CSSVariableData> CSSVariableResolver::ValueForCustomProperty( // take inherited values instead of falling back on initial. if (registration->Inherits() && !resolved_data) { resolved_data = state_.ParentStyle()->GetVariable(name, true); - resolved_value = state_.ParentStyle()->GetRegisteredVariable(name, true); + resolved_value = + state_.ParentStyle()->GetNonInitialRegisteredVariable(name, true); } DCHECK(!!resolved_data == !!resolved_value); @@ -197,9 +233,10 @@ scoped_refptr<CSSVariableData> CSSVariableResolver::ResolveCustomProperty( bool success = ResolveTokenRange(variable_data.Tokens(), options, result); variables_seen_.erase(name); - if (!success || !cycle_start_points_.IsEmpty()) { - cycle_start_points_.erase(name); + if (!cycle_start_points_.IsEmpty()) cycle_detected = true; + if (!success || cycle_detected) { + cycle_start_points_.erase(name); return nullptr; } cycle_detected = false; @@ -219,14 +256,14 @@ scoped_refptr<CSSVariableData> CSSVariableResolver::ResolveCustomPropertyIfNeeded( AtomicString name, CSSVariableData* variable_data, - const Options& options) { + const Options& options, + bool& cycle_detected) { DCHECK(variable_data); bool resolve_urls = ShouldResolveRelativeUrls(name, *variable_data); if (!variable_data->NeedsVariableResolution() && !resolve_urls) return variable_data; - bool unused_cycle_detected; return ResolveCustomProperty(name, *variable_data, options, resolve_urls, - unused_cycle_detected); + cycle_detected); } void CSSVariableResolver::ResolveRelativeUrls( @@ -319,6 +356,25 @@ void CSSVariableResolver::SetRegisteredVariable( } } +void CSSVariableResolver::SetInvalidVariable( + const AtomicString& name, + const PropertyRegistration* registration) { + // TODO(andruud): Use RemoveVariable instead, but currently it also does + // a lookup in the registered map, which seems wasteful. + SetVariable(name, registration, nullptr); + if (registration) { + const CSSValue* value = CSSInvalidVariableValue::Create(); + SetRegisteredVariable(name, *registration, value); + } +} + +bool CSSVariableResolver::IsRegisteredVariableInvalid( + const AtomicString& name, + const PropertyRegistration& registration) { + const CSSValue* value = GetRegisteredVariable(name, registration); + return value && value->IsInvalidVariableValue(); +} + bool CSSVariableResolver::ResolveVariableReference(CSSParserTokenRange range, const Options& options, bool is_env_variable, @@ -337,6 +393,13 @@ bool CSSVariableResolver::ResolveVariableReference(CSSParserTokenRange range, non_inherited_variables_ = state_.Style()->NonInheritedVariables(); } + const PropertyRegistration* registration = nullptr; + if (registry_) { + registration = registry_->Registration(variable_name); + if (!is_env_variable) + registry_->MarkReferenced(variable_name); + } + scoped_refptr<CSSVariableData> variable_data = is_env_variable ? ValueForEnvironmentVariable(variable_name) : ValueForCustomProperty(variable_name, options); @@ -344,7 +407,8 @@ bool CSSVariableResolver::ResolveVariableReference(CSSParserTokenRange range, if (!variable_data) { // TODO(alancutter): Append the registered initial custom property value if // we are disallowing an animation tainted value. - return ResolveFallback(range, options, result); + return ResolveFallback(range, options, registration, result) == + Fallback::kSuccess; } result.tokens.AppendVector(variable_data->Tokens()); @@ -356,7 +420,13 @@ bool CSSVariableResolver::ResolveVariableReference(CSSParserTokenRange range, result.absolutized &= variable_data->IsAbsolutized(); Result trash; - ResolveFallback(range, options, trash); + Fallback fallback = ResolveFallback(range, options, registration, trash); + + // For registered properties, the fallback (if present) must be valid, even + // if it's not used. + if (registration && fallback == Fallback::kFail) + return false; + return true; } diff --git a/chromium/third_party/blink/renderer/core/css/resolver/css_variable_resolver.h b/chromium/third_party/blink/renderer/core/css/resolver/css_variable_resolver.h index d7481380a68..a68e4265adc 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/css_variable_resolver.h +++ b/chromium/third_party/blink/renderer/core/css/resolver/css_variable_resolver.h @@ -5,8 +5,8 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_RESOLVER_CSS_VARIABLE_RESOLVER_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_RESOLVER_CSS_VARIABLE_RESOLVER_H_ +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/parser/css_parser_token.h" -#include "third_party/blink/renderer/core/css_property_names.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string_hash.h" @@ -134,9 +134,26 @@ class CORE_EXPORT CSSVariableResolver { // Resolves a range which may contain var() or env() references. bool ResolveTokenRange(CSSParserTokenRange, const Options&, Result&); + + // Return value for ResolveFallback. + enum class Fallback { + // Fallback not present. + kNone, + // Fallback present, but resolution failed (i.e. invalid variables + // referenced), or the result did not match the syntax registered for + // the referenced variable (if applicable). + kFail, + // Fallback present, resolution succeeded, and syntax matched (if + // applicable). + kSuccess + }; + // Resolves the fallback (if present) of a var() or env() reference, starting // from the comma. - bool ResolveFallback(CSSParserTokenRange, const Options&, Result&); + Fallback ResolveFallback(CSSParserTokenRange, + const Options&, + const PropertyRegistration*, + Result&); // Resolves the contents of a var() or env() reference. bool ResolveVariableReference(CSSParserTokenRange, const Options&, @@ -163,7 +180,8 @@ class CORE_EXPORT CSSVariableResolver { scoped_refptr<CSSVariableData> ResolveCustomPropertyIfNeeded( AtomicString name, CSSVariableData*, - const Options&); + const Options&, + bool& cycle_detected); // Rewrites (in-place) kUrlTokens and kFunctionToken/CSSValueUrls to contain // absolute URLs. void ResolveRelativeUrls(Vector<CSSParserToken>& tokens, @@ -191,6 +209,10 @@ class CORE_EXPORT CSSVariableResolver { void SetRegisteredVariable(const AtomicString& name, const PropertyRegistration&, const CSSValue*); + void SetInvalidVariable(const AtomicString& name, + const PropertyRegistration*); + bool IsRegisteredVariableInvalid(const AtomicString& name, + const PropertyRegistration&); const StyleResolverState& state_; StyleInheritedVariables* inherited_variables_; diff --git a/chromium/third_party/blink/renderer/core/css/resolver/css_variable_resolver_test.cc b/chromium/third_party/blink/renderer/core/css/resolver/css_variable_resolver_test.cc index aea966ed443..bd5d4b631c7 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/css_variable_resolver_test.cc +++ b/chromium/third_party/blink/renderer/core/css/resolver/css_variable_resolver_test.cc @@ -11,6 +11,7 @@ #include "third_party/blink/renderer/core/css/parser/css_variable_parser.h" #include "third_party/blink/renderer/core/css/properties/css_property.h" #include "third_party/blink/renderer/core/css/properties/longhand.h" +#include "third_party/blink/renderer/core/css/properties/longhands/custom_property.h" #include "third_party/blink/renderer/core/css/property_registration.h" #include "third_party/blink/renderer/core/css/property_registry.h" #include "third_party/blink/renderer/core/css/resolver/style_resolver_state.h" @@ -40,7 +41,6 @@ class CSSVariableResolverTest : public PageTestBase { void SetUp() override { PageTestBase::SetUp(); - RuntimeEnabledFeatures::SetCSSEnvironmentVariablesEnabled(true); GetStyleEngine().EnsureEnvironmentVariables().SetVariable("test", "red"); } @@ -57,7 +57,7 @@ class CSSVariableResolverTest : public PageTestBase { "<div>" " <div id=target></div>" "</div>"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); } const CSSCustomPropertyDeclaration* CreateCustomProperty( @@ -261,16 +261,17 @@ TEST_F(CSSVariableResolverTest, NeedsResolutionClearedByResolver) { token_syntax.Parse(CSSParserTokenRange(tokens), context, false); ASSERT_TRUE(initial_value); ASSERT_TRUE(initial_value->IsVariableReferenceValue()); - PropertyRegistration* registration = new PropertyRegistration( - "--prop3", token_syntax, false, initial_value, - ToCSSVariableReferenceValue(*initial_value).VariableDataValue()); + PropertyRegistration* registration = + MakeGarbageCollected<PropertyRegistration>( + "--prop3", token_syntax, false, initial_value, + ToCSSVariableReferenceValue(*initial_value).VariableDataValue()); ASSERT_TRUE(GetDocument().GetPropertyRegistry()); GetDocument().GetPropertyRegistry()->RegisterProperty("--prop3", *registration); - ToLonghand(GetCSSPropertyVariable()).ApplyValue(state, *prop1); - ToLonghand(GetCSSPropertyVariable()).ApplyValue(state, *prop2); - ToLonghand(GetCSSPropertyVariable()).ApplyValue(state, *prop3); + CustomProperty("--prop1", GetDocument()).ApplyValue(state, *prop1); + CustomProperty("--prop2", GetDocument()).ApplyValue(state, *prop2); + CustomProperty("--prop3", GetDocument()).ApplyValue(state, *prop3); EXPECT_TRUE(state.Style()->InheritedVariables()->NeedsResolution()); EXPECT_TRUE(state.Style()->NonInheritedVariables()->NeedsResolution()); diff --git a/chromium/third_party/blink/renderer/core/css/resolver/element_resolve_context.h b/chromium/third_party/blink/renderer/core/css/resolver/element_resolve_context.h index 49bb15d112a..9bcf1581af9 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/element_resolve_context.h +++ b/chromium/third_party/blink/renderer/core/css/resolver/element_resolve_context.h @@ -24,6 +24,7 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_RESOLVER_ELEMENT_RESOLVE_CONTEXT_H_ #include "third_party/blink/renderer/core/dom/element.h" +#include "third_party/blink/renderer/core/dom/node_computed_style.h" #include "third_party/blink/renderer/core/style/computed_style_constants.h" namespace blink { diff --git a/chromium/third_party/blink/renderer/core/css/resolver/element_style_resources.cc b/chromium/third_party/blink/renderer/core/css/resolver/element_style_resources.cc index c1ea3013309..8cf83d116c4 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/element_style_resources.cc +++ b/chromium/third_party/blink/renderer/core/css/resolver/element_style_resources.cc @@ -25,12 +25,13 @@ #include "third_party/blink/renderer/core/css/css_gradient_value.h" #include "third_party/blink/renderer/core/css/css_image_value.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/css_uri_value.h" -#include "third_party/blink/renderer/core/css_property_names.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/element.h" #include "third_party/blink/renderer/core/dom/tree_scope.h" #include "third_party/blink/renderer/core/frame/local_frame.h" +#include "third_party/blink/renderer/core/frame/settings.h" #include "third_party/blink/renderer/core/html/lazy_load_image_observer.h" #include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/core/style/content_data.h" @@ -44,7 +45,7 @@ #include "third_party/blink/renderer/core/style/style_pending_image.h" #include "third_party/blink/renderer/core/svg/svg_resource.h" #include "third_party/blink/renderer/core/svg/svg_tree_scope_resources.h" -#include "third_party/blink/renderer/platform/length.h" +#include "third_party/blink/renderer/platform/geometry/length.h" #include "third_party/blink/renderer/platform/loader/fetch/fetch_parameters.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h" @@ -203,7 +204,9 @@ void ElementStyleResources::LoadPendingImages(ComputedStyle* style) { FetchParameters::ImageRequestOptimization image_request_optimization = FetchParameters::kNone; if (!BackgroundLayerMayBeSprite(*background_layer)) { - if (element_->GetDocument() + if (element_->GetDocument().GetSettings() && + element_->GetDocument().GetSettings()->GetLazyLoadEnabled() && + element_->GetDocument() .GetFrame() ->IsLazyLoadingImageAllowed()) { image_request_optimization = FetchParameters::kDeferImageLoad; diff --git a/chromium/third_party/blink/renderer/core/css/resolver/element_style_resources.h b/chromium/third_party/blink/renderer/core/css/resolver/element_style_resources.h index 08ebe761f06..f90ebdba843 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/element_style_resources.h +++ b/chromium/third_party/blink/renderer/core/css/resolver/element_style_resources.h @@ -26,7 +26,7 @@ #include "base/macros.h" #include "third_party/blink/renderer/core/css/css_property_id_templates.h" -#include "third_party/blink/renderer/core/css_property_names.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/platform/cross_origin_attribute_value.h" #include "third_party/blink/renderer/platform/graphics/color.h" #include "third_party/blink/renderer/platform/heap/handle.h" diff --git a/chromium/third_party/blink/renderer/core/css/resolver/filter_operation_resolver.cc b/chromium/third_party/blink/renderer/core/css/resolver/filter_operation_resolver.cc index 4e6c08de9ec..8b147e0bb58 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/filter_operation_resolver.cc +++ b/chromium/third_party/blink/renderer/core/css/resolver/filter_operation_resolver.cc @@ -120,6 +120,38 @@ static void CountFilterUse(FilterOperation::OperationType operation_type, UseCounter::Count(document, feature); } +static double ResolveFirstArgumentForFunction(const CSSFunctionValue& filter, + const CSSPrimitiveValue* value) { + switch (filter.FunctionType()) { + case CSSValueGrayscale: + case CSSValueSepia: + case CSSValueSaturate: + case CSSValueInvert: + case CSSValueBrightness: + case CSSValueContrast: + case CSSValueOpacity: { + double amount = (filter.FunctionType() == CSSValueBrightness || + filter.FunctionType() == CSSValueInvert) + ? 0 + : 1; + if (filter.length() == 1) { + amount = value->GetDoubleValue(); + if (value->IsPercentage()) + amount /= 100; + } + return amount; + } + case CSSValueHueRotate: { + double angle = 0; + if (filter.length() == 1) + angle = value->ComputeDegrees(); + return angle; + } + default: + return 0; + } +} + FilterOperations FilterOperationResolver::CreateFilterOperations( StyleResolverState& state, const CSSValue& in_value) { @@ -158,7 +190,7 @@ FilterOperations FilterOperationResolver::CreateFilterOperations( ? &ToCSSPrimitiveValue(filter_value->Item(0)) : nullptr; double first_number = - StyleBuilderConverter::ConvertValueToNumber(filter_value, first_value); + ResolveFirstArgumentForFunction(*filter_value, first_value); switch (filter_value->FunctionType()) { case CSSValueGrayscale: @@ -242,7 +274,7 @@ FilterOperations FilterOperationResolver::CreateOffscreenFilterOperations( ? &ToCSSPrimitiveValue(filter_value->Item(0)) : nullptr; double first_number = - StyleBuilderConverter::ConvertValueToNumber(filter_value, first_value); + ResolveFirstArgumentForFunction(*filter_value, first_value); switch (filter_value->FunctionType()) { case CSSValueGrayscale: diff --git a/chromium/third_party/blink/renderer/core/css/resolver/font_builder.cc b/chromium/third_party/blink/renderer/core/css/resolver/font_builder.cc index c5302a92614..e46dfec3c15 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/font_builder.cc +++ b/chromium/third_party/blink/renderer/core/css/resolver/font_builder.cc @@ -86,17 +86,17 @@ AtomicString FontBuilder::GenericFontFamilyName( case FontDescription::kStandardFamily: return StandardFontFamilyName(); case FontDescription::kSerifFamily: - return FontFamilyNames::webkit_serif; + return font_family_names::kWebkitSerif; case FontDescription::kSansSerifFamily: - return FontFamilyNames::webkit_sans_serif; + return font_family_names::kWebkitSansSerif; case FontDescription::kMonospaceFamily: - return FontFamilyNames::webkit_monospace; + return font_family_names::kWebkitMonospace; case FontDescription::kCursiveFamily: - return FontFamilyNames::webkit_cursive; + return font_family_names::kWebkitCursive; case FontDescription::kFantasyFamily: - return FontFamilyNames::webkit_fantasy; + return font_family_names::kWebkitFantasy; case FontDescription::kPictographFamily: - return FontFamilyNames::webkit_pictograph; + return font_family_names::kWebkitPictograph; } } diff --git a/chromium/third_party/blink/renderer/core/css/resolver/match_result_test.cc b/chromium/third_party/blink/renderer/core/css/resolver/match_result_test.cc index 1b2775e4062..027bf590582 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/match_result_test.cc +++ b/chromium/third_party/blink/renderer/core/css/resolver/match_result_test.cc @@ -22,7 +22,8 @@ class MatchResultTest : public testing::Test { }; void MatchResultTest::SetUp() { - property_sets = new HeapVector<Member<MutableCSSPropertyValueSet>, 8>(); + property_sets = + MakeGarbageCollected<HeapVector<Member<MutableCSSPropertyValueSet>, 8>>(); for (unsigned i = 0; i < 8; i++) { property_sets->push_back( MutableCSSPropertyValueSet::Create(kHTMLQuirksMode)); diff --git a/chromium/third_party/blink/renderer/core/css/resolver/scoped_style_resolver.cc b/chromium/third_party/blink/renderer/core/css/resolver/scoped_style_resolver.cc index b60eabca74e..9f4f7482a19 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/scoped_style_resolver.cc +++ b/chromium/third_party/blink/renderer/core/css/resolver/scoped_style_resolver.cc @@ -81,6 +81,9 @@ void ScopedStyleResolver::AddFontFaceRules(const RuleSet& rule_set) { } if (font_face_rules.size() && document.GetStyleResolver()) document.GetStyleResolver()->InvalidateMatchedPropertiesCache(); + + for (const auto& rule : rule_set.FontFeatureValuesRules()) + document.GetStyleEngine().AddDefaultFontDisplay(rule); } void ScopedStyleResolver::AppendActiveStyleSheets( @@ -206,7 +209,7 @@ void ScopedStyleResolver::KeyframesRulesAdded(const TreeScope& tree_scope) { InvalidationRootForTreeScope(tree_scope) .SetNeedsStyleRecalc(kSubtreeStyleChange, StyleChangeReasonForTracing::Create( - StyleChangeReason::kStyleSheetChange)); + style_change_reason::kStyleSheetChange)); return; } @@ -326,7 +329,8 @@ void ScopedStyleResolver::AddTreeBoundaryCrossingRules( AddRules(rule_set_for_scope, author_rules.ContentPseudoElementRules()); if (!tree_boundary_crossing_rule_set_) { - tree_boundary_crossing_rule_set_ = new CSSStyleSheetRuleSubSet(); + tree_boundary_crossing_rule_set_ = + MakeGarbageCollected<CSSStyleSheetRuleSubSet>(); GetTreeScope().GetDocument().GetStyleEngine().AddTreeBoundaryCrossingScope( GetTreeScope()); } @@ -341,7 +345,8 @@ void ScopedStyleResolver::V0ShadowAddedOnV1Document() { return; if (!tree_boundary_crossing_rule_set_) { - tree_boundary_crossing_rule_set_ = new CSSStyleSheetRuleSubSet(); + tree_boundary_crossing_rule_set_ = + MakeGarbageCollected<CSSStyleSheetRuleSubSet>(); GetTreeScope().GetDocument().GetStyleEngine().AddTreeBoundaryCrossingScope( GetTreeScope()); } @@ -369,7 +374,8 @@ void ScopedStyleResolver::AddSlottedRules(const RuleSet& author_rules, // rule sets. See V0ShadowAddedOnV1Document(). if (GetTreeScope().GetDocument().MayContainV0Shadow()) { if (!tree_boundary_crossing_rule_set_) { - tree_boundary_crossing_rule_set_ = new CSSStyleSheetRuleSubSet(); + tree_boundary_crossing_rule_set_ = + MakeGarbageCollected<CSSStyleSheetRuleSubSet>(); GetTreeScope() .GetDocument() .GetStyleEngine() @@ -380,7 +386,7 @@ void ScopedStyleResolver::AddSlottedRules(const RuleSet& author_rules, return; } if (!slotted_rule_set_) - slotted_rule_set_ = new CSSStyleSheetRuleSubSet(); + slotted_rule_set_ = MakeGarbageCollected<CSSStyleSheetRuleSubSet>(); slotted_rule_set_->push_back( RuleSubSet::Create(parent_style_sheet, sheet_index, slotted_rule_set)); } diff --git a/chromium/third_party/blink/renderer/core/css/resolver/scoped_style_resolver.h b/chromium/third_party/blink/renderer/core/css/resolver/scoped_style_resolver.h index acda21dc2e5..1504e045932 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/scoped_style_resolver.h +++ b/chromium/third_party/blink/renderer/core/css/resolver/scoped_style_resolver.h @@ -52,9 +52,11 @@ class ScopedStyleResolver final public: static ScopedStyleResolver* Create(TreeScope& scope) { - return new ScopedStyleResolver(scope); + return MakeGarbageCollected<ScopedStyleResolver>(scope); } + explicit ScopedStyleResolver(TreeScope& scope) : scope_(scope) {} + const TreeScope& GetTreeScope() const { return *scope_; } ScopedStyleResolver* Parent() const; @@ -94,8 +96,6 @@ class ScopedStyleResolver final void Trace(blink::Visitor*); private: - explicit ScopedStyleResolver(TreeScope& scope) : scope_(scope) {} - void AddTreeBoundaryCrossingRules(const RuleSet&, CSSStyleSheet*, unsigned sheet_index); @@ -119,18 +119,17 @@ class ScopedStyleResolver final static RuleSubSet* Create(CSSStyleSheet* sheet, unsigned index, RuleSet* rules) { - return new RuleSubSet(sheet, index, rules); + return MakeGarbageCollected<RuleSubSet>(sheet, index, rules); } + RuleSubSet(CSSStyleSheet* sheet, unsigned index, RuleSet* rules) + : parent_style_sheet_(sheet), parent_index_(index), rule_set_(rules) {} + Member<CSSStyleSheet> parent_style_sheet_; unsigned parent_index_; Member<RuleSet> rule_set_; void Trace(blink::Visitor*); - - private: - RuleSubSet(CSSStyleSheet* sheet, unsigned index, RuleSet* rules) - : parent_style_sheet_(sheet), parent_index_(index), rule_set_(rules) {} }; using CSSStyleSheetRuleSubSet = HeapVector<Member<RuleSubSet>>; diff --git a/chromium/third_party/blink/renderer/core/css/resolver/selector_filter_parent_scope_test.cc b/chromium/third_party/blink/renderer/core/css/resolver/selector_filter_parent_scope_test.cc index 9382d366d46..efcf3dfbc03 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/selector_filter_parent_scope_test.cc +++ b/chromium/third_party/blink/renderer/core/css/resolver/selector_filter_parent_scope_test.cc @@ -26,7 +26,7 @@ class SelectorFilterParentScopeTest : public testing::Test { }; TEST_F(SelectorFilterParentScopeTest, ParentScope) { - GetDocument().body()->setAttribute(HTMLNames::classAttr, "match"); + GetDocument().body()->setAttribute(html_names::kClassAttr, "match"); GetDocument().documentElement()->SetIdAttribute("myId"); SelectorFilter& filter = GetDocument().EnsureStyleResolver().GetSelectorFilter(); diff --git a/chromium/third_party/blink/renderer/core/css/resolver/style_adjuster.cc b/chromium/third_party/blink/renderer/core/css/resolver/style_adjuster.cc index 530c91882cc..0b552a69d2b 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/style_adjuster.cc +++ b/chromium/third_party/blink/renderer/core/css/resolver/style_adjuster.cc @@ -56,15 +56,13 @@ #include "third_party/blink/renderer/core/style/computed_style_constants.h" #include "third_party/blink/renderer/core/svg/svg_svg_element.h" #include "third_party/blink/renderer/core/svg_names.h" -#include "third_party/blink/renderer/platform/length.h" +#include "third_party/blink/renderer/platform/geometry/length.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/transforms/transform_operations.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" namespace blink { -using namespace HTMLNames; - namespace { TouchAction AdjustTouchActionForElement(TouchAction touch_action, diff --git a/chromium/third_party/blink/renderer/core/css/resolver/style_adjuster_test.cc b/chromium/third_party/blink/renderer/core/css/resolver/style_adjuster_test.cc index 6521f2f00db..0d79e06aebc 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/style_adjuster_test.cc +++ b/chromium/third_party/blink/renderer/core/css/resolver/style_adjuster_test.cc @@ -27,15 +27,15 @@ TEST_F(StyleAdjusterTest, TouchActionPropagatedAcrossIframes) { </style> <div id='target' style='touch-action: pinch-zoom'></div> )HTML"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); Element* target = ChildDocument().getElementById("target"); EXPECT_EQ(TouchAction::kTouchActionNone, target->GetComputedStyle()->GetEffectiveTouchAction()); Element* owner = GetDocument().getElementById("owner"); - owner->setAttribute(HTMLNames::styleAttr, "touch-action: auto"); - GetDocument().View()->UpdateAllLifecyclePhases(); + owner->setAttribute(html_names::kStyleAttr, "touch-action: auto"); + UpdateAllLifecyclePhasesForTest(); EXPECT_EQ(TouchAction::kTouchActionPinchZoom, target->GetComputedStyle()->GetEffectiveTouchAction()); } @@ -49,7 +49,7 @@ TEST_F(StyleAdjusterTest, TouchActionPanningReEnabledByScrollers) { <div id='ancestor'><div id='scroller'><div id='target'> </div></div></div> )HTML"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); Element* target = GetDocument().getElementById("target"); EXPECT_EQ(TouchAction::kTouchActionManipulation, @@ -65,22 +65,22 @@ TEST_F(StyleAdjusterTest, TouchActionPropagatedWhenAncestorStyleChanges) { <div id='ancestor'><div id='potential-scroller'><div id='target'> </div></div></div> )HTML"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); Element* target = GetDocument().getElementById("target"); EXPECT_EQ(TouchAction::kTouchActionPanX, target->GetComputedStyle()->GetEffectiveTouchAction()); Element* ancestor = GetDocument().getElementById("ancestor"); - ancestor->setAttribute(HTMLNames::styleAttr, "touch-action: pan-y"); - GetDocument().View()->UpdateAllLifecyclePhases(); + ancestor->setAttribute(html_names::kStyleAttr, "touch-action: pan-y"); + UpdateAllLifecyclePhasesForTest(); EXPECT_EQ(TouchAction::kTouchActionPanY, target->GetComputedStyle()->GetEffectiveTouchAction()); Element* potential_scroller = GetDocument().getElementById("potential-scroller"); - potential_scroller->setAttribute(HTMLNames::styleAttr, "overflow: scroll"); - GetDocument().View()->UpdateAllLifecyclePhases(); + potential_scroller->setAttribute(html_names::kStyleAttr, "overflow: scroll"); + UpdateAllLifecyclePhasesForTest(); EXPECT_EQ(TouchAction::kTouchActionPan, target->GetComputedStyle()->GetEffectiveTouchAction()); } @@ -93,15 +93,15 @@ TEST_F(StyleAdjusterTest, TouchActionRestrictedByLowerAncestor) { <div id='target' style='touch-action: pan-x'> </div></div></div> )HTML"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); Element* target = GetDocument().getElementById("target"); EXPECT_EQ(TouchAction::kTouchActionPanRight, target->GetComputedStyle()->GetEffectiveTouchAction()); Element* parent = GetDocument().getElementById("parent"); - parent->setAttribute(HTMLNames::styleAttr, "touch-action: auto"); - GetDocument().View()->UpdateAllLifecyclePhases(); + parent->setAttribute(html_names::kStyleAttr, "touch-action: auto"); + UpdateAllLifecyclePhasesForTest(); EXPECT_EQ(TouchAction::kTouchActionPanX, target->GetComputedStyle()->GetEffectiveTouchAction()); } diff --git a/chromium/third_party/blink/renderer/core/css/resolver/style_builder.cc b/chromium/third_party/blink/renderer/core/css/resolver/style_builder.cc index 056f19c56af..78c281e59d1 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/style_builder.cc +++ b/chromium/third_party/blink/renderer/core/css/resolver/style_builder.cc @@ -42,7 +42,10 @@ #include <utility> #include "third_party/blink/renderer/core/animation/css/css_animations.h" +#include "third_party/blink/renderer/core/css/css_property_name.h" +#include "third_party/blink/renderer/core/css/properties/css_property_ref.h" #include "third_party/blink/renderer/core/css/properties/longhand.h" +#include "third_party/blink/renderer/core/css/properties/longhands/variable.h" #include "third_party/blink/renderer/core/css/resolver/css_variable_resolver.h" #include "third_party/blink/renderer/core/css/resolver/style_builder.h" #include "third_party/blink/renderer/core/css/resolver/style_resolver_state.h" @@ -50,9 +53,21 @@ namespace blink { +void StyleBuilder::ApplyProperty(const CSSPropertyName& name, + StyleResolverState& state, + const CSSValue& value) { + CSSPropertyRef ref(name, state.GetDocument()); + DCHECK(ref.IsValid()); + + ApplyProperty(ref.GetProperty(), state, value); +} + void StyleBuilder::ApplyProperty(const CSSProperty& property, StyleResolverState& state, const CSSValue& value) { + DCHECK(!Variable::IsStaticInstance(property)) + << "Please use a CustomProperty instance to apply custom properties"; + CSSPropertyID id = property.PropertyID(); bool is_inherited = property.IsInherited(); if (id != CSSPropertyVariable && (value.IsVariableReferenceValue() || diff --git a/chromium/third_party/blink/renderer/core/css/resolver/style_builder.h b/chromium/third_party/blink/renderer/core/css/resolver/style_builder.h index 1693a7498db..455e2f8994c 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/style_builder.h +++ b/chromium/third_party/blink/renderer/core/css/resolver/style_builder.h @@ -32,12 +32,13 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_RESOLVER_STYLE_BUILDER_H_ #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/properties/css_property.h" -#include "third_party/blink/renderer/core/css_property_names.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { +class CSSPropertyName; class CSSValue; class StyleResolverState; @@ -45,6 +46,19 @@ class CORE_EXPORT StyleBuilder { STATIC_ONLY(StyleBuilder); public: + // Apply a property/value pair to the ComputedStyle. + // + // If the incoming CSSPropertyName is a custom property, a temporary + // CustomProperty instance is created to carry out the application. + static void ApplyProperty(const CSSPropertyName&, + StyleResolverState&, + const CSSValue&); + + // Apply a property/value pair to the ComputedStyle. + // + // If you are applying a custom property, please ensure that the incoming + // CSSProperty is an instance of CustomProperty, and not the static Variable + // instance. See Variable::IsStaticInstance. static void ApplyProperty(const CSSProperty&, StyleResolverState&, const CSSValue&); diff --git a/chromium/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc b/chromium/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc index 750b9f99e83..559595ebb78 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc +++ b/chromium/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc @@ -198,7 +198,7 @@ static bool ConvertFontFamilyName( #if defined(OS_MACOSX) if (family_name == FontCache::LegacySystemFontFamily()) { UseCounter::Count(*document_for_count, WebFeature::kBlinkMacSystemFont); - family_name = FontFamilyNames::system_ui; + family_name = font_family_names::kSystemUi; } #endif } else if (font_builder) { @@ -356,39 +356,6 @@ float StyleBuilderConverter::ConvertFontSizeAdjust(StyleResolverState& state, return primitive_value.GetFloatValue(); } -double StyleBuilderConverter::ConvertValueToNumber( - const CSSFunctionValue* filter, - const CSSPrimitiveValue* value) { - switch (filter->FunctionType()) { - case CSSValueGrayscale: - case CSSValueSepia: - case CSSValueSaturate: - case CSSValueInvert: - case CSSValueBrightness: - case CSSValueContrast: - case CSSValueOpacity: { - double amount = (filter->FunctionType() == CSSValueBrightness || - filter->FunctionType() == CSSValueInvert) - ? 0 - : 1; - if (filter->length() == 1) { - amount = value->GetDoubleValue(); - if (value->IsPercentage()) - amount /= 100; - } - return amount; - } - case CSSValueHueRotate: { - double angle = 0; - if (filter->length() == 1) - angle = value->ComputeDegrees(); - return angle; - } - default: - return 0; - } -} - FontSelectionValue StyleBuilderConverterBase::ConvertFontStretch( const blink::CSSValue& value) { if (value.IsPrimitiveValue()) { @@ -1135,6 +1102,11 @@ float StyleBuilderConverter::ConvertNumberOrPercentage( return primitive_value.GetFloatValue() / 100.0f; } +float StyleBuilderConverter::ConvertAlpha(StyleResolverState& state, + const CSSValue& value) { + return clampTo<float>(ConvertNumberOrPercentage(state, value), 0, 1); +} + StyleOffsetRotation StyleBuilderConverter::ConvertOffsetRotate( StyleResolverState&, const CSSValue& value) { @@ -1510,15 +1482,20 @@ TransformOrigin StyleBuilderConverter::ConvertTransformOrigin( StyleResolverState& state, const CSSValue& value) { const CSSValueList& list = ToCSSValueList(value); - DCHECK_EQ(list.length(), 3U); + DCHECK_GE(list.length(), 2u); DCHECK(list.Item(0).IsPrimitiveValue() || list.Item(0).IsIdentifierValue()); DCHECK(list.Item(1).IsPrimitiveValue() || list.Item(1).IsIdentifierValue()); - DCHECK(list.Item(2).IsPrimitiveValue()); + float z = 0; + if (list.length() == 3) { + DCHECK(list.Item(2).IsPrimitiveValue()); + z = StyleBuilderConverter::ConvertComputedLength<float>(state, + list.Item(2)); + } return TransformOrigin( ConvertPositionLength<CSSValueLeft, CSSValueRight>(state, list.Item(0)), ConvertPositionLength<CSSValueTop, CSSValueBottom>(state, list.Item(1)), - StyleBuilderConverter::ConvertComputedLength<float>(state, list.Item(2))); + z); } ScrollSnapType StyleBuilderConverter::ConvertSnapType(StyleResolverState&, @@ -1665,6 +1642,7 @@ scoped_refptr<BasicShape> StyleBuilderConverter::ConvertOffsetPath( } static const CSSValue& ComputeRegisteredPropertyValue( + const Document& document, const CSSToLengthConversionData& css_to_length_conversion_data, const CSSValue& value) { // TODO(timloh): Images values can also contain lengths. @@ -1674,7 +1652,7 @@ static const CSSValue& ComputeRegisteredPropertyValue( CSSFunctionValue::Create(function_value.FunctionType()); for (const CSSValue* inner_value : ToCSSValueList(value)) { new_function->Append(ComputeRegisteredPropertyValue( - css_to_length_conversion_data, *inner_value)); + document, css_to_length_conversion_data, *inner_value)); } return *new_function; } @@ -1684,7 +1662,7 @@ static const CSSValue& ComputeRegisteredPropertyValue( CSSValueList* new_list = CSSValueList::CreateWithSeparatorFrom(old_list); for (const CSSValue* inner_value : old_list) { new_list->Append(ComputeRegisteredPropertyValue( - css_to_length_conversion_data, *inner_value)); + document, css_to_length_conversion_data, *inner_value)); } return *new_list; } @@ -1701,20 +1679,63 @@ static const CSSValue& ComputeRegisteredPropertyValue( css_to_length_conversion_data.CopyWithAdjustedZoom(1)); return *CSSPrimitiveValue::Create(length, 1); } + // If we encounter a calculated number that was not resolved during + // parsing, it means that a calc()-expression was allowed in place of + // an integer. Such calc()-for-integers must be rounded at computed value + // time. + // https://drafts.csswg.org/css-values-4/#calc-type-checking + if (primitive_value.IsCalculated() && + (primitive_value.TypeWithCalcResolved() == + CSSPrimitiveValue::UnitType::kNumber)) { + double double_value = primitive_value.CssCalcValue()->DoubleValue(); + auto unit_type = CSSPrimitiveValue::UnitType::kInteger; + return *CSSPrimitiveValue::Create(std::round(double_value), unit_type); + } + + if (primitive_value.IsAngle()) { + return *CSSPrimitiveValue::Create(primitive_value.ComputeDegrees(), + CSSPrimitiveValue::UnitType::kDegrees); + } + + if (primitive_value.IsTime()) { + return *CSSPrimitiveValue::Create(primitive_value.ComputeSeconds(), + CSSPrimitiveValue::UnitType::kSeconds); + } + + if (primitive_value.IsResolution()) { + return *CSSPrimitiveValue::Create( + primitive_value.ComputeDotsPerPixel(), + CSSPrimitiveValue::UnitType::kDotsPerPixel); + } } + + if (value.IsIdentifierValue()) { + const CSSIdentifierValue& identifier_value = ToCSSIdentifierValue(value); + CSSValueID value_id = identifier_value.GetValueID(); + if (value_id == CSSValueCurrentcolor) + return value; + if (StyleColor::IsColorKeyword(value_id)) { + Color color = + document.GetTextLinkColors().ColorFromCSSValue(value, Color(), false); + return *CSSColorValue::Create(color.Rgb()); + } + } + return value; } const CSSValue& StyleBuilderConverter::ConvertRegisteredPropertyInitialValue( + const Document& document, const CSSValue& value) { - return ComputeRegisteredPropertyValue(CSSToLengthConversionData(), value); + return ComputeRegisteredPropertyValue(document, CSSToLengthConversionData(), + value); } const CSSValue& StyleBuilderConverter::ConvertRegisteredPropertyValue( const StyleResolverState& state, const CSSValue& value) { - return ComputeRegisteredPropertyValue(state.CssToLengthConversionData(), - value); + return ComputeRegisteredPropertyValue( + state.GetDocument(), state.CssToLengthConversionData(), value); } const CSSToLengthConversionData& diff --git a/chromium/third_party/blink/renderer/core/css/resolver/style_builder_converter.h b/chromium/third_party/blink/renderer/core/css/resolver/style_builder_converter.h index 90e63408249..933d95edeea 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/style_builder_converter.h +++ b/chromium/third_party/blink/renderer/core/css/resolver/style_builder_converter.h @@ -45,8 +45,8 @@ #include "third_party/blink/renderer/core/style/svg_computed_style_defs.h" #include "third_party/blink/renderer/core/style/transform_origin.h" #include "third_party/blink/renderer/platform/fonts/font_description.h" +#include "third_party/blink/renderer/platform/geometry/length_size.h" #include "third_party/blink/renderer/platform/graphics/image_orientation.h" -#include "third_party/blink/renderer/platform/length_size.h" #include "third_party/blink/renderer/platform/text/tab_size.h" #include "third_party/blink/renderer/platform/transforms/rotation.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" @@ -167,6 +167,8 @@ class StyleBuilderConverter { static TabSize ConvertLengthOrTabSpaces(StyleResolverState&, const CSSValue&); static Length ConvertLineHeight(StyleResolverState&, const CSSValue&); static float ConvertNumberOrPercentage(StyleResolverState&, const CSSValue&); + static float ConvertAlpha(StyleResolverState&, + const CSSValue&); // clamps to [0,1] static StyleOffsetRotation ConvertOffsetRotate(StyleResolverState&, const CSSValue&); static LengthPoint ConvertPosition(StyleResolverState&, const CSSValue&); @@ -181,8 +183,6 @@ class StyleBuilderConverter { static ShadowData ConvertShadow(const CSSToLengthConversionData&, StyleResolverState*, const CSSValue&); - static double ConvertValueToNumber(const CSSFunctionValue*, - const CSSPrimitiveValue*); static scoped_refptr<ShadowList> ConvertShadowList(StyleResolverState&, const CSSValue&); static ShapeValue* ConvertShapeValue(StyleResolverState&, const CSSValue&); @@ -254,7 +254,8 @@ class StyleBuilderConverter { static Length ConvertPositionLength(StyleResolverState&, const CSSValue&); static Rotation ConvertRotation(const CSSValue&); - static const CSSValue& ConvertRegisteredPropertyInitialValue(const CSSValue&); + static const CSSValue& ConvertRegisteredPropertyInitialValue(const Document&, + const CSSValue&); static const CSSValue& ConvertRegisteredPropertyValue( const StyleResolverState&, const CSSValue&); diff --git a/chromium/third_party/blink/renderer/core/css/resolver/style_resolver.cc b/chromium/third_party/blink/renderer/core/css/resolver/style_resolver.cc index a8ed17a4fe4..b492c41928e 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/style_resolver.cc +++ b/chromium/third_party/blink/renderer/core/css/resolver/style_resolver.cc @@ -46,6 +46,7 @@ #include "third_party/blink/renderer/core/css/css_identifier_value.h" #include "third_party/blink/renderer/core/css/css_keyframe_rule.h" #include "third_party/blink/renderer/core/css/css_keyframes_rule.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/css_property_value_set.h" #include "third_party/blink/renderer/core/css/css_reflect_value.h" #include "third_party/blink/renderer/core/css/css_rule_list.h" @@ -60,6 +61,7 @@ #include "third_party/blink/renderer/core/css/page_rule_collector.h" #include "third_party/blink/renderer/core/css/part_names.h" #include "third_party/blink/renderer/core/css/properties/css_property.h" +#include "third_party/blink/renderer/core/css/properties/css_property_ref.h" #include "third_party/blink/renderer/core/css/resolver/animated_style_builder.h" #include "third_party/blink/renderer/core/css/resolver/css_variable_animator.h" #include "third_party/blink/renderer/core/css/resolver/css_variable_resolver.h" @@ -74,7 +76,6 @@ #include "third_party/blink/renderer/core/css/style_engine.h" #include "third_party/blink/renderer/core/css/style_rule_import.h" #include "third_party/blink/renderer/core/css/style_sheet_contents.h" -#include "third_party/blink/renderer/core/css_property_names.h" #include "third_party/blink/renderer/core/dom/first_letter_pseudo_element.h" #include "third_party/blink/renderer/core/dom/node_computed_style.h" #include "third_party/blink/renderer/core/dom/shadow_root.h" @@ -91,6 +92,7 @@ #include "third_party/blink/renderer/core/media_type_names.h" #include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/core/style/style_inherited_variables.h" +#include "third_party/blink/renderer/core/style/style_initial_data.h" #include "third_party/blink/renderer/core/style_property_shorthand.h" #include "third_party/blink/renderer/core/svg/svg_element.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" @@ -114,9 +116,7 @@ void SetAnimationUpdateIfNeeded(StyleResolverState& state, Element& element) { } // namespace -using namespace HTMLNames; - -ComputedStyle* StyleResolver::style_not_yet_available_; +using namespace html_names; static CSSPropertyValueSet* LeftToRightDeclaration() { DEFINE_STATIC_LOCAL(Persistent<MutableCSSPropertyValueSet>, @@ -215,8 +215,12 @@ static void MatchCustomElementRules(const Element& element, element.GetCustomElementDefinition()) { if (definition->HasDefaultStyleSheets()) { for (CSSStyleSheet* style : definition->DefaultStyleSheets()) { - collector.CollectMatchingRules(MatchRequest( - element.GetDocument().GetStyleEngine().RuleSetForSheet(*style))); + if (!style) + continue; + RuleSet* rule_set = + element.GetDocument().GetStyleEngine().RuleSetForSheet(*style); + if (rule_set) + collector.CollectMatchingRules(MatchRequest(rule_set)); } } } @@ -238,12 +242,44 @@ static void MatchHostAndCustomElementRules(const Element& element, collector.FinishAddingAuthorRulesForTreeScope(); } +static void MatchSlottedRules(const Element&, ElementRuleCollector&); +static void MatchSlottedRulesForUAHost(const Element& element, + ElementRuleCollector& collector) { + if (element.ShadowPseudoId() != "-webkit-input-placeholder") + return; + + // We allow ::placeholder pseudo element after ::slotted(). Since we are + // matching such pseudo elements starting from inside the UA shadow DOM of + // the element having the placeholder, we need to match ::slotted rules from + // the scopes to which the placeholder's host element may be slotted. + // + // Example: + // + // <div id=host> + // <:shadow-root> + // <style>::slotted(input)::placeholder { color: green }</style> + // <slot /> + // </:shadow-root> + // <input placeholder="PLACEHOLDER-TEXT"> + // <:ua-shadow-root> + // ... <placeholder>PLACEHOLDER-TEXT</placeholder> ... + // </:ua-shadow-root> + // </input> + // </div> + // + // Here we need to match the ::slotted rule from the #host shadow tree where + // the input is slotted on the placeholder element. + DCHECK(element.OwnerShadowHost()); + MatchSlottedRules(*element.OwnerShadowHost(), collector); +} + // Matches `::slotted` selectors. It matches rules in the element's slot's // scope. If that slot is itself slotted it will match rules in the slot's // slot's scope and so on. The result is that it considers a chain of scopes // descending from the element's own scope. static void MatchSlottedRules(const Element& element, ElementRuleCollector& collector) { + MatchSlottedRulesForUAHost(element, collector); HTMLSlotElement* slot = element.AssignedSlot(); if (!slot) return; @@ -290,11 +326,11 @@ void StyleResolver::MatchPseudoPartRules(const Element& element, if (!RuntimeEnabledFeatures::CSSPartPseudoElementEnabled()) return; - const SpaceSplitString* part_names = element.PartNames(); - if (!part_names) + DOMTokenList* part = element.GetPart(); + if (!part) return; - PartNames current_names(*part_names); + PartNames current_names(part->TokenSet()); // ::part selectors in the shadow host's scope and above can match this // element. @@ -416,7 +452,6 @@ void StyleResolver::MatchAuthorRules(const Element& element, MatchAuthorRulesV0(element, collector); return; } - MatchHostAndCustomElementRules(element, collector); ScopedStyleResolver* element_scope_resolver = ScopedResolverFor(element); @@ -654,24 +689,6 @@ scoped_refptr<ComputedStyle> StyleResolver::StyleForElement( DCHECK(GetDocument().GetFrame()); DCHECK(GetDocument().GetSettings()); - // Once an element has a layout object or non-layout style, we don't try to - // destroy it, since that means it could be rendering already and we cannot - // arbitrarily change its style during loading. - if (!GetDocument().IsRenderingReady() && !element->GetLayoutObject() && - !element->NonLayoutObjectComputedStyle()) { - if (!style_not_yet_available_) { - auto style = ComputedStyle::Create(); - style->AddRef(); - style_not_yet_available_ = style.get(); - style_not_yet_available_->SetDisplay(EDisplay::kNone); - style_not_yet_available_->GetFont().Update( - GetDocument().GetStyleEngine().GetFontSelector()); - } - - GetDocument().SetHasNodesWithPlaceholderStyle(); - return style_not_yet_available_; - } - GetDocument().GetStyleEngine().IncStyleForElementCount(); INCREMENT_STYLE_STATS_COUNTER(GetDocument().GetStyleEngine(), elements_styled, 1); @@ -741,7 +758,7 @@ scoped_refptr<ComputedStyle> StyleResolver::StyleForElement( matching_behavior != kMatchAllRulesExcludingSMIL); // TODO(dominicc): Remove this counter when Issue 590014 is fixed. - if (element->HasTagName(HTMLNames::summaryTag)) { + if (element->HasTagName(html_names::kSummaryTag)) { MatchedPropertiesRange matched_range = collector.MatchedResult().AuthorRules(); for (const auto& matched : matched_range) { @@ -827,7 +844,7 @@ AnimatableValue* StyleResolver::CreateAnimatableValueSnapshot( parent_style); state.SetStyle(ComputedStyle::Clone(base_style)); if (value) { - StyleBuilder::ApplyProperty(property.GetCSSProperty(), state, *value); + StyleBuilder::ApplyProperty(property.GetCSSPropertyName(), state, *value); state.GetFontBuilder().CreateFont( state.GetDocument().GetStyleEngine().GetFontSelector(), state.StyleRef()); @@ -1008,6 +1025,12 @@ scoped_refptr<ComputedStyle> StyleResolver::InitialStyleForElement( ? EUserModify::kReadWrite : EUserModify::kReadOnly); document.SetupFontBuilder(*initial_style); + + scoped_refptr<StyleInitialData> initial_data = + document.GetStyleEngine().MaybeCreateAndGetInitialData(); + if (initial_data) + initial_style->SetInitialData(std::move(initial_data)); + return initial_style; } @@ -1452,6 +1475,25 @@ void StyleResolver::ApplyAllProperty( } } +template <CSSPropertyPriority priority> +static inline void ApplyProperty( + const CSSPropertyValueSet::PropertyReference& reference, + StyleResolverState& state) { + static_assert( + priority != kResolveVariables, + "Application of custom properties must use specialized template"); + DCHECK_NE(reference.Id(), CSSPropertyVariable); + StyleBuilder::ApplyProperty(reference.Property(), state, reference.Value()); +} + +template <> +inline void ApplyProperty<kResolveVariables>( + const CSSPropertyValueSet::PropertyReference& reference, + StyleResolverState& state) { + CSSPropertyRef ref(reference.Name(), state.GetDocument()); + StyleBuilder::ApplyProperty(ref.GetProperty(), state, reference.Value()); +} + template <CSSPropertyPriority priority, StyleResolver::ShouldUpdateNeedsApplyPass shouldUpdateNeedsApplyPass> void StyleResolver::ApplyProperties( @@ -1504,7 +1546,7 @@ void StyleResolver::ApplyProperties( if (!CSSPropertyPriorityData<priority>::PropertyHasPriority(property_id)) continue; - StyleBuilder::ApplyProperty(current.Property(), state, current.Value()); + ApplyProperty<priority>(current, state); } } @@ -1929,8 +1971,8 @@ void StyleResolver::ComputeFont(ComputedStyle* style, void StyleResolver::UpdateMediaType() { if (LocalFrameView* view = GetDocument().View()) { bool was_print = print_media_type_; - print_media_type_ = - DeprecatedEqualIgnoringCase(view->MediaType(), MediaTypeNames::print); + print_media_type_ = DeprecatedEqualIgnoringCase(view->MediaType(), + media_type_names::kPrint); if (was_print != print_media_type_) matched_properties_cache_.ClearViewportDependent(); } diff --git a/chromium/third_party/blink/renderer/core/css/resolver/style_resolver.h b/chromium/third_party/blink/renderer/core/css/resolver/style_resolver.h index a84ffa57094..fe4ae0d29fc 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/style_resolver.h +++ b/chromium/third_party/blink/renderer/core/css/resolver/style_resolver.h @@ -64,8 +64,10 @@ class CORE_EXPORT StyleResolver final public: static StyleResolver* Create(Document& document) { - return new StyleResolver(document); + return MakeGarbageCollected<StyleResolver>(document); } + + explicit StyleResolver(Document&); ~StyleResolver(); void Dispose(); @@ -75,6 +77,8 @@ class CORE_EXPORT StyleResolver final const ComputedStyle* layout_parent_style = nullptr, RuleMatchingBehavior = kMatchAllRules); + static scoped_refptr<ComputedStyle> InitialStyleForElement(Document&); + static AnimatableValue* CreateAnimatableValueSnapshot( Element&, const ComputedStyle& base_style, @@ -128,11 +132,6 @@ class CORE_EXPORT StyleResolver final void SetResizedForViewportUnits(); void ClearResizedForViewportUnits(); - // Exposed for ComputedStyle::IsStyleAvailable(). - static ComputedStyle* StyleNotYetAvailable() { - return style_not_yet_available_; - } - void SetRuleUsageTracker(StyleRuleUsageTracker*); void UpdateMediaType(); @@ -141,10 +140,6 @@ class CORE_EXPORT StyleResolver final void Trace(blink::Visitor*); private: - explicit StyleResolver(Document&); - - static scoped_refptr<ComputedStyle> InitialStyleForElement(Document&); - // FIXME: This should probably go away, folded into FontBuilder. void UpdateFont(StyleResolverState&); @@ -282,8 +277,6 @@ class CORE_EXPORT StyleResolver final Document& GetDocument() const { return *document_; } bool WasViewportResized() const { return was_viewport_resized_; } - static ComputedStyle* style_not_yet_available_; - MatchedPropertiesCache matched_properties_cache_; Member<Document> document_; SelectorFilter selector_filter_; diff --git a/chromium/third_party/blink/renderer/core/css/resolver/style_resolver_state.cc b/chromium/third_party/blink/renderer/core/css/resolver/style_resolver_state.cc index 27faa263a84..9f64fd7ffd7 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/style_resolver_state.cc +++ b/chromium/third_party/blink/renderer/core/css/resolver/style_resolver_state.cc @@ -169,7 +169,8 @@ StyleResolverState::ParsedPropertiesForPendingSubstitutionCache( HeapHashMap<CSSPropertyID, Member<const CSSValue>>* map = parsed_properties_for_pending_substitution_cache_.at(&value); if (!map) { - map = new HeapHashMap<CSSPropertyID, Member<const CSSValue>>; + map = MakeGarbageCollected< + HeapHashMap<CSSPropertyID, Member<const CSSValue>>>(); parsed_properties_for_pending_substitution_cache_.Set(&value, map); } return *map; diff --git a/chromium/third_party/blink/renderer/core/css/resolver/style_resolver_state.h b/chromium/third_party/blink/renderer/core/css/resolver/style_resolver_state.h index fc9664a418c..b50afc5490c 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/style_resolver_state.h +++ b/chromium/third_party/blink/renderer/core/css/resolver/style_resolver_state.h @@ -28,12 +28,12 @@ #include "third_party/blink/renderer/core/animation/css/css_animation_update.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/css/css_pending_substitution_value.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/css_to_length_conversion_data.h" #include "third_party/blink/renderer/core/css/resolver/css_to_style_map.h" #include "third_party/blink/renderer/core/css/resolver/element_resolve_context.h" #include "third_party/blink/renderer/core/css/resolver/element_style_resources.h" #include "third_party/blink/renderer/core/css/resolver/font_builder.h" -#include "third_party/blink/renderer/core/css_property_names.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/element.h" #include "third_party/blink/renderer/core/style/cached_ua_style.h" diff --git a/chromium/third_party/blink/renderer/core/css/resolver/viewport_style_resolver.cc b/chromium/third_party/blink/renderer/core/css/resolver/viewport_style_resolver.cc index 2957bc5bd55..c4cb3ec71a8 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/viewport_style_resolver.cc +++ b/chromium/third_party/blink/renderer/core/css/resolver/viewport_style_resolver.cc @@ -66,7 +66,7 @@ bool HasViewportFitProperty(const CSSPropertyValueSet* property_set) { ViewportStyleResolver::ViewportStyleResolver(Document& document) : document_(document) { DCHECK(document.GetFrame()); - initial_viewport_medium_ = new MediaQueryEvaluator( + initial_viewport_medium_ = MakeGarbageCollected<MediaQueryEvaluator>( MediaValuesInitialViewport::Create(*document.GetFrame())); } diff --git a/chromium/third_party/blink/renderer/core/css/resolver/viewport_style_resolver.h b/chromium/third_party/blink/renderer/core/css/resolver/viewport_style_resolver.h index 541f3b6a2fc..6b70c9c902b 100644 --- a/chromium/third_party/blink/renderer/core/css/resolver/viewport_style_resolver.h +++ b/chromium/third_party/blink/renderer/core/css/resolver/viewport_style_resolver.h @@ -31,10 +31,10 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_RESOLVER_VIEWPORT_STYLE_RESOLVER_H_ #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/rule_set.h" -#include "third_party/blink/renderer/core/css_property_names.h" #include "third_party/blink/renderer/core/page/viewport_description.h" -#include "third_party/blink/renderer/platform/length.h" +#include "third_party/blink/renderer/platform/geometry/length.h" namespace blink { @@ -48,9 +48,11 @@ class CORE_EXPORT ViewportStyleResolver : public GarbageCollectedFinalized<ViewportStyleResolver> { public: static ViewportStyleResolver* Create(Document& document) { - return new ViewportStyleResolver(document); + return MakeGarbageCollected<ViewportStyleResolver>(document); } + explicit ViewportStyleResolver(Document&); + void InitialStyleChanged(); void InitialViewportChanged(); void SetNeedsCollectRules(); @@ -62,8 +64,6 @@ class CORE_EXPORT ViewportStyleResolver void Trace(blink::Visitor*); private: - explicit ViewportStyleResolver(Document&); - void Reset(); void Resolve(); diff --git a/chromium/third_party/blink/renderer/core/css/rule_feature_set.cc b/chromium/third_party/blink/renderer/core/css/rule_feature_set.cc index f9426163d7d..91ad65c8d0c 100644 --- a/chromium/third_party/blink/renderer/core/css/rule_feature_set.cc +++ b/chromium/third_party/blink/renderer/core/css/rule_feature_set.cc @@ -167,8 +167,8 @@ bool SupportsInvalidation(CSSSelector::PseudoType type) { case CSSSelector::kPseudoVideoPersistent: case CSSSelector::kPseudoVideoPersistentAncestor: return true; - case CSSSelector::kPseudoMatches: - case CSSSelector::kPseudoIS: + case CSSSelector::kPseudoIs: + case CSSSelector::kPseudoWhere: case CSSSelector::kPseudoUnknown: case CSSSelector::kPseudoLeftPage: case CSSSelector::kPseudoRightPage: @@ -415,10 +415,6 @@ void RuleFeatureSet::ExtractInvalidationSetFeaturesFromSimpleSelector( case CSSSelector::kPseudoBlinkInternalElement: features.invalidation_flags.SetInvalidateCustomPseudo(true); return; - case CSSSelector::kPseudoBefore: - case CSSSelector::kPseudoAfter: - features.has_before_or_after = true; - return; case CSSSelector::kPseudoSlotted: features.invalidation_flags.SetInvalidatesSlotted(true); return; @@ -485,6 +481,7 @@ InvalidationSet* RuleFeatureSet::InvalidationSetForSimpleSelector( case CSSSelector::kPseudoDefined: case CSSSelector::kPseudoVideoPersistent: case CSSSelector::kPseudoVideoPersistentAncestor: + case CSSSelector::kPseudoSpatialNavigationFocus: return &EnsurePseudoInvalidationSet(selector.GetPseudoType(), type, position); case CSSSelector::kPseudoFirstOfType: @@ -526,8 +523,6 @@ void RuleFeatureSet::UpdateInvalidationSets(const RuleData* rule_data) { features.invalidation_flags.SetWholeSubtreeInvalid(true); if (features.has_nth_pseudo) AddFeaturesToInvalidationSet(EnsureNthInvalidationSet(), features); - if (features.has_before_or_after) - UpdateInvalidationSetsForContentAttribute(rule_data); const CSSSelector* next_compound = last_in_compound ? last_in_compound->TagHistory() @@ -567,39 +562,6 @@ void RuleFeatureSet::UpdateRuleSetInvalidation( type_rule_invalidation_set_->AddTagName(tag_name); } -void RuleFeatureSet::UpdateInvalidationSetsForContentAttribute( - const RuleData* rule_data) { - // If any ::before and ::after rules specify 'content: attr(...)', we - // need to create invalidation sets for those attributes to have content - // changes applied through style recalc. - - const CSSPropertyValueSet& property_set = rule_data->Rule()->Properties(); - - int property_index = property_set.FindPropertyIndex(CSSPropertyContent); - - if (property_index == -1) - return; - - CSSPropertyValueSet::PropertyReference content_property = - property_set.PropertyAt(property_index); - const CSSValue& content_value = content_property.Value(); - - if (!content_value.IsValueList()) - return; - - for (auto& item : ToCSSValueList(content_value)) { - if (!item->IsFunctionValue()) - continue; - const CSSFunctionValue* function_value = ToCSSFunctionValue(item.Get()); - if (function_value->FunctionType() != CSSValueAttr) - continue; - EnsureAttributeInvalidationSet( - AtomicString(ToCSSCustomIdentValue(function_value->Item(0)).Value()), - kInvalidateDescendants, kSubject) - .SetInvalidatesSelf(); - } -} - RuleFeatureSet::FeatureInvalidationType RuleFeatureSet::ExtractInvalidationSetFeaturesFromSelectorList( const CSSSelector& simple_selector, @@ -1260,7 +1222,6 @@ void RuleFeatureSet::InvalidationSetFeatures::Add( max_direct_adjacent_selectors = std::max(max_direct_adjacent_selectors, other.max_direct_adjacent_selectors); invalidation_flags.Merge(other.invalidation_flags); - has_before_or_after |= other.has_before_or_after; content_pseudo_crossing |= other.content_pseudo_crossing; has_nth_pseudo |= other.has_nth_pseudo; } diff --git a/chromium/third_party/blink/renderer/core/css/rule_feature_set.h b/chromium/third_party/blink/renderer/core/css/rule_feature_set.h index 9e4ecbc3b60..b81bfba81b2 100644 --- a/chromium/third_party/blink/renderer/core/css/rule_feature_set.h +++ b/chromium/third_party/blink/renderer/core/css/rule_feature_set.h @@ -194,7 +194,6 @@ class CORE_EXPORT RuleFeatureSet { DescendantInvalidationSet& EnsurePartInvalidationSet(); void UpdateInvalidationSets(const RuleData*); - void UpdateInvalidationSetsForContentAttribute(const RuleData*); struct InvalidationSetFeatures { DISALLOW_NEW(); @@ -209,7 +208,6 @@ class CORE_EXPORT RuleFeatureSet { Vector<AtomicString> tag_names; unsigned max_direct_adjacent_selectors = 0; InvalidationFlags invalidation_flags; - bool has_before_or_after = false; bool content_pseudo_crossing = false; bool has_nth_pseudo = false; bool has_features_for_rule_set_invalidation = false; diff --git a/chromium/third_party/blink/renderer/core/css/rule_feature_set_test.cc b/chromium/third_party/blink/renderer/core/css/rule_feature_set_test.cc index b3e32f3142e..b70ba8a458f 100644 --- a/chromium/third_party/blink/renderer/core/css/rule_feature_set_test.cc +++ b/chromium/third_party/blink/renderer/core/css/rule_feature_set_test.cc @@ -51,8 +51,9 @@ class RuleFeatureSetTest : public testing::Test { RuleFeatureSet::SelectorPreMatch result = RuleFeatureSet::SelectorPreMatch::kSelectorNeverMatches; for (unsigned i = 0; i < indices.size(); ++i) { - RuleData* rule_data = - new RuleData(style_rule, indices[i], 0, kRuleHasNoSpecialState); + RuleData* rule_data = RuleData::MaybeCreate(style_rule, indices[i], 0, + kRuleHasNoSpecialState); + DCHECK(rule_data); if (rule_feature_set_.CollectFeaturesFromRuleData(rule_data)) result = RuleFeatureSet::SelectorPreMatch::kSelectorMayMatch; } @@ -986,9 +987,9 @@ TEST_F(RuleFeatureSetTest, ReplaceSelfInvalidationSet) { ExpectNotSelfInvalidationSet(invalidation_lists.descendants); } -TEST_F(RuleFeatureSetTest, pseudoMatchesSibling) { +TEST_F(RuleFeatureSetTest, pseudoIsSibling) { EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, - CollectFeatures(":matches(.q, .r) ~ .s .t")); + CollectFeatures(":is(.q, .r) ~ .s .t")); { InvalidationLists invalidation_lists; CollectInvalidationSetsForClass(invalidation_lists, "q"); @@ -1005,9 +1006,8 @@ TEST_F(RuleFeatureSetTest, pseudoMatchesSibling) { } } -TEST_F(RuleFeatureSetTest, pseudoMatches) { - EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, - CollectFeatures(":matches(.w, .x)")); +TEST_F(RuleFeatureSetTest, pseudoIs) { + EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, CollectFeatures(":is(.w, .x)")); { InvalidationLists invalidation_lists; @@ -1023,27 +1023,27 @@ TEST_F(RuleFeatureSetTest, pseudoMatches) { } } -TEST_F(RuleFeatureSetTest, pseudoMatchesIdDescendant) { +TEST_F(RuleFeatureSetTest, pseudoIsIdDescendant) { EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, - CollectFeatures(".a :matches(#b, #c)")); + CollectFeatures(".a :is(#b, #c)")); InvalidationLists invalidation_lists; CollectInvalidationSetsForClass(invalidation_lists, "a"); ExpectIdInvalidation("b", "c", invalidation_lists.descendants); } -TEST_F(RuleFeatureSetTest, pseudoMatchesTagDescendant) { +TEST_F(RuleFeatureSetTest, pseudoIsTagDescendant) { EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, - CollectFeatures(".a :matches(span, div)")); + CollectFeatures(".a :is(span, div)")); InvalidationLists invalidation_lists; CollectInvalidationSetsForClass(invalidation_lists, "a"); ExpectTagNameInvalidation("span", "div", invalidation_lists.descendants); } -TEST_F(RuleFeatureSetTest, pseudoMatchesAnySibling) { +TEST_F(RuleFeatureSetTest, pseudoIsAnySibling) { EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, - CollectFeatures(".v ~ :matches(.w, .x)")); + CollectFeatures(".v ~ :is(.w, .x)")); InvalidationLists invalidation_lists; CollectInvalidationSetsForClass(invalidation_lists, "v"); @@ -1051,9 +1051,9 @@ TEST_F(RuleFeatureSetTest, pseudoMatchesAnySibling) { ExpectClassInvalidation("w", "x", invalidation_lists.siblings); } -TEST_F(RuleFeatureSetTest, pseudoMatchesDescendantSibling) { +TEST_F(RuleFeatureSetTest, pseudoIsDescendantSibling) { EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, - CollectFeatures(".u .v ~ :matches(.w, .x)")); + CollectFeatures(".u .v ~ :is(.w, .x)")); InvalidationLists invalidation_lists; CollectInvalidationSetsForClass(invalidation_lists, "u"); @@ -1061,9 +1061,9 @@ TEST_F(RuleFeatureSetTest, pseudoMatchesDescendantSibling) { ExpectNoInvalidation(invalidation_lists.siblings); } -TEST_F(RuleFeatureSetTest, pseudoMatchesWithComplexSelectors) { +TEST_F(RuleFeatureSetTest, pseudoIsWithComplexSelectors) { EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, - CollectFeatures(".a :matches(.w+.b, .x>#c)")); + CollectFeatures(".a :is(.w+.b, .x>#c)")); InvalidationLists invalidation_lists; CollectInvalidationSetsForClass(invalidation_lists, "a"); @@ -1072,9 +1072,9 @@ TEST_F(RuleFeatureSetTest, pseudoMatchesWithComplexSelectors) { ExpectNoInvalidation(invalidation_lists.siblings); } -TEST_F(RuleFeatureSetTest, pseudoMatchesNested) { +TEST_F(RuleFeatureSetTest, pseudoIsNested) { EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, - CollectFeatures(".a :matches(.w+.b, .e+:matches(.c, #d))")); + CollectFeatures(".a :is(.w+.b, .e+:is(.c, #d))")); InvalidationLists invalidation_lists; CollectInvalidationSetsForClass(invalidation_lists, "a"); @@ -1083,16 +1083,16 @@ TEST_F(RuleFeatureSetTest, pseudoMatchesNested) { ExpectNoInvalidation(invalidation_lists.siblings); } -TEST_F(RuleFeatureSetTest, pseudoMatchesTooLarge) { +TEST_F(RuleFeatureSetTest, pseudoIsTooLarge) { // RuleData cannot support selectors at index 8192 or beyond so the expansion // is limited to this size EXPECT_EQ(RuleFeatureSet::kSelectorNeverMatches, - CollectFeatures(":matches(.a#a, .b#b, .c#c, .d#d) + " - ":matches(.e#e, .f#f, .g#g, .h#h) + " - ":matches(.i#i, .j#j, .k#k, .l#l) + " - ":matches(.m#m, .n#n, .o#o, .p#p) + " - ":matches(.q#q, .r#r, .s#s, .t#t) + " - ":matches(.u#u, .v#v, .w#w, .x#x)")); + CollectFeatures(":is(.a#a, .b#b, .c#c, .d#d) + " + ":is(.e#e, .f#f, .g#g, .h#h) + " + ":is(.i#i, .j#j, .k#k, .l#l) + " + ":is(.m#m, .n#n, .o#o, .p#p) + " + ":is(.q#q, .r#r, .s#s, .t#t) + " + ":is(.u#u, .v#v, .w#w, .x#x)")); InvalidationLists invalidation_lists; CollectInvalidationSetsForClass(invalidation_lists, "a"); @@ -1100,8 +1100,9 @@ TEST_F(RuleFeatureSetTest, pseudoMatchesTooLarge) { ExpectNoInvalidation(invalidation_lists.siblings); } -TEST_F(RuleFeatureSetTest, pseudoIS) { - EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, CollectFeatures(":is(.w, .x)")); +TEST_F(RuleFeatureSetTest, pseudoWhere) { + EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, + CollectFeatures(":where(.w, .x)")); { InvalidationLists invalidation_lists; @@ -1117,9 +1118,9 @@ TEST_F(RuleFeatureSetTest, pseudoIS) { } } -TEST_F(RuleFeatureSetTest, pseudoISSibling) { +TEST_F(RuleFeatureSetTest, pseudoWhereSibling) { EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, - CollectFeatures(":is(.q, .r) ~ .s .t")); + CollectFeatures(":where(.q, .r) ~ .s .t")); { InvalidationLists invalidation_lists; CollectInvalidationSetsForClass(invalidation_lists, "q"); @@ -1136,27 +1137,27 @@ TEST_F(RuleFeatureSetTest, pseudoISSibling) { } } -TEST_F(RuleFeatureSetTest, pseudoISIdDescendant) { +TEST_F(RuleFeatureSetTest, pseudoWhereIdDescendant) { EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, - CollectFeatures(".a :is(#b, #c)")); + CollectFeatures(".a :where(#b, #c)")); InvalidationLists invalidation_lists; CollectInvalidationSetsForClass(invalidation_lists, "a"); ExpectIdInvalidation("b", "c", invalidation_lists.descendants); } -TEST_F(RuleFeatureSetTest, pseudoISTagDescendant) { +TEST_F(RuleFeatureSetTest, pseudoWhereTagDescendant) { EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, - CollectFeatures(".a :is(span, div)")); + CollectFeatures(".a :where(span, div)")); InvalidationLists invalidation_lists; CollectInvalidationSetsForClass(invalidation_lists, "a"); ExpectTagNameInvalidation("span", "div", invalidation_lists.descendants); } -TEST_F(RuleFeatureSetTest, pseudoISAnySibling) { +TEST_F(RuleFeatureSetTest, pseudoWhereAnySibling) { EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, - CollectFeatures(".v ~ :is(.w, .x)")); + CollectFeatures(".v ~ :where(.w, .x)")); InvalidationLists invalidation_lists; CollectInvalidationSetsForClass(invalidation_lists, "v"); @@ -1164,9 +1165,9 @@ TEST_F(RuleFeatureSetTest, pseudoISAnySibling) { ExpectClassInvalidation("w", "x", invalidation_lists.siblings); } -TEST_F(RuleFeatureSetTest, pseudoISDescendantSibling) { +TEST_F(RuleFeatureSetTest, pseudoWhereDescendantSibling) { EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, - CollectFeatures(".u .v ~ :is(.w, .x)")); + CollectFeatures(".u .v ~ :where(.w, .x)")); InvalidationLists invalidation_lists; CollectInvalidationSetsForClass(invalidation_lists, "u"); @@ -1174,9 +1175,9 @@ TEST_F(RuleFeatureSetTest, pseudoISDescendantSibling) { ExpectNoInvalidation(invalidation_lists.siblings); } -TEST_F(RuleFeatureSetTest, pseudoISWithComplexSelectors) { +TEST_F(RuleFeatureSetTest, pseudoWhereWithComplexSelectors) { EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, - CollectFeatures(".a :is(.w+.b, .x>#c)")); + CollectFeatures(".a :where(.w+.b, .x>#c)")); InvalidationLists invalidation_lists; CollectInvalidationSetsForClass(invalidation_lists, "a"); @@ -1185,9 +1186,9 @@ TEST_F(RuleFeatureSetTest, pseudoISWithComplexSelectors) { ExpectNoInvalidation(invalidation_lists.siblings); } -TEST_F(RuleFeatureSetTest, pseudoISNested) { +TEST_F(RuleFeatureSetTest, pseudoWhereNested) { EXPECT_EQ(RuleFeatureSet::kSelectorMayMatch, - CollectFeatures(".a :is(.w+.b, .e+:is(.c, #d))")); + CollectFeatures(".a :where(.w+.b, .e+:where(.c, #d))")); InvalidationLists invalidation_lists; CollectInvalidationSetsForClass(invalidation_lists, "a"); @@ -1196,16 +1197,16 @@ TEST_F(RuleFeatureSetTest, pseudoISNested) { ExpectNoInvalidation(invalidation_lists.siblings); } -TEST_F(RuleFeatureSetTest, pseudoISTooLarge) { +TEST_F(RuleFeatureSetTest, pseudoWhereTooLarge) { // RuleData cannot support selectors at index 8192 or beyond so the expansion // is limited to this size EXPECT_EQ(RuleFeatureSet::kSelectorNeverMatches, - CollectFeatures(":is(.a#a, .b#b, .c#c, .d#d) + " - ":is(.e#e, .f#f, .g#g, .h#h) + " - ":is(.i#i, .j#j, .k#k, .l#l) + " - ":is(.m#m, .n#n, .o#o, .p#p) + " - ":is(.q#q, .r#r, .s#s, .t#t) + " - ":is(.u#u, .v#v, .w#w, .x#x)")); + CollectFeatures(":where(.a#a, .b#b, .c#c, .d#d) + " + ":where(.e#e, .f#f, .g#g, .h#h) + " + ":where(.i#i, .j#j, .k#k, .l#l) + " + ":where(.m#m, .n#n, .o#o, .p#p) + " + ":where(.q#q, .r#r, .s#s, .t#t) + " + ":where(.u#u, .v#v, .w#w, .x#x)")); InvalidationLists invalidation_lists; CollectInvalidationSetsForClass(invalidation_lists, "a"); diff --git a/chromium/third_party/blink/renderer/core/css/rule_set.cc b/chromium/third_party/blink/renderer/core/css/rule_set.cc index 0233c8ab397..5dd78121577 100644 --- a/chromium/third_party/blink/renderer/core/css/rule_set.cc +++ b/chromium/third_party/blink/renderer/core/css/rule_set.cc @@ -38,7 +38,6 @@ #include "third_party/blink/renderer/core/css/style_sheet_contents.h" #include "third_party/blink/renderer/core/html/track/text_track_cue.h" #include "third_party/blink/renderer/core/html_names.h" -#include "third_party/blink/renderer/platform/heap/heap_terminated_array_builder.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" @@ -46,8 +45,6 @@ namespace blink { -using namespace HTMLNames; - static inline PropertyWhitelistType DeterminePropertyWhitelistType( const AddRuleFlags add_rule_flags, const CSSSelector& selector) { @@ -63,6 +60,20 @@ static inline PropertyWhitelistType DeterminePropertyWhitelistType( return kPropertyWhitelistNone; } +RuleData* RuleData::MaybeCreate(StyleRule* rule, + unsigned selector_index, + unsigned position, + AddRuleFlags add_rule_flags) { + // The selector index field in RuleData is only 13 bits so we can't support + // selectors at index 8192 or beyond. + // See https://crbug.com/804179 + if (selector_index >= (1 << RuleData::kSelectorIndexBits)) + return nullptr; + if (position >= (1 << RuleData::kPositionBits)) + return nullptr; + return new RuleData(rule, selector_index, position, add_rule_flags); +} + RuleData::RuleData(StyleRule* rule, unsigned selector_index, unsigned position, @@ -125,6 +136,7 @@ static void ExtractSelectorValues(const CSSSelector* selector, case CSSSelector::kPseudoPart: case CSSSelector::kPseudoHost: case CSSSelector::kPseudoHostContext: + case CSSSelector::kPseudoSpatialNavigationFocus: pseudo_type = selector->GetPseudoType(); break; case CSSSelector::kPseudoWebKitCustomElement: @@ -196,6 +208,9 @@ bool RuleSet::FindBestRuleSetAndAdd(const CSSSelector& component, case CSSSelector::kPseudoWebkitAnyLink: link_pseudo_class_rules_.push_back(rule_data); return true; + case CSSSelector::kPseudoSpatialNavigationFocus: + spatial_navigation_focus_class_rules_.push_back(rule_data); + return true; case CSSSelector::kPseudoFocus: focus_pseudo_class_rules_.push_back(rule_data); return true; @@ -228,13 +243,13 @@ bool RuleSet::FindBestRuleSetAndAdd(const CSSSelector& component, void RuleSet::AddRule(StyleRule* rule, unsigned selector_index, AddRuleFlags add_rule_flags) { - // The selector index field in RuleData is only 13 bits so we can't support - // selectors at index 8192 or beyond. - // See https://crbug.com/804179 - if (selector_index >= 8192) - return; RuleData* rule_data = - new RuleData(rule, selector_index, rule_count_++, add_rule_flags); + RuleData::MaybeCreate(rule, selector_index, rule_count_, add_rule_flags); + if (!rule_data) { + // This can happen if selector_index or position is out of range. + return; + } + ++rule_count_; if (features_.CollectFeaturesFromRuleData(rule_data) == RuleFeatureSet::kSelectorNeverMatches) return; @@ -256,6 +271,11 @@ void RuleSet::AddFontFaceRule(StyleRuleFontFace* rule) { font_face_rules_.push_back(rule); } +void RuleSet::AddFontFeatureValuesRule(StyleRuleFontFeatureValues* rule) { + EnsurePendingRules(); + font_feature_values_rules_.push_back(rule); +} + void RuleSet::AddKeyframesRule(StyleRuleKeyframes* rule) { EnsurePendingRules(); // So that keyframes_rules_.ShrinkToFit() gets called. keyframes_rules_.push_back(rule); @@ -298,6 +318,8 @@ void RuleSet::AddChildRules(const HeapVector<Member<StyleRuleBase>>& rules, AddChildRules(media_rule->ChildRules(), medium, add_rule_flags); } else if (rule->IsFontFaceRule()) { AddFontFaceRule(ToStyleRuleFontFace(rule)); + } else if (rule->IsFontFeatureValuesRule()) { + AddFontFeatureValuesRule(ToStyleRuleFontFeatureValues(rule)); } else if (rule->IsKeyframesRule()) { AddKeyframesRule(ToStyleRuleKeyframes(rule)); } else if (rule->IsSupportsRule() && @@ -347,7 +369,7 @@ void RuleSet::CompactPendingRules(PendingRuleMap& pending_map, Member<HeapVector<Member<const RuleData>>>& rules = compact_map.insert(item.key, nullptr).stored_value->value; if (!rules) { - rules = new HeapVector<Member<const RuleData>>(); + rules = MakeGarbageCollected<HeapVector<Member<const RuleData>>>(); rules->ReserveInitialCapacity(pending_rules->size()); } else { rules->ReserveCapacity(pending_rules->size()); @@ -370,10 +392,12 @@ void RuleSet::CompactRules() { link_pseudo_class_rules_.ShrinkToFit(); cue_pseudo_rules_.ShrinkToFit(); focus_pseudo_class_rules_.ShrinkToFit(); + spatial_navigation_focus_class_rules_.ShrinkToFit(); universal_rules_.ShrinkToFit(); shadow_host_rules_.ShrinkToFit(); page_rules_.ShrinkToFit(); font_face_rules_.ShrinkToFit(); + font_feature_values_rules_.ShrinkToFit(); keyframes_rules_.ShrinkToFit(); deep_combinator_or_shadow_pseudo_rules_.ShrinkToFit(); part_pseudo_rules_.ShrinkToFit(); @@ -404,10 +428,12 @@ void RuleSet::Trace(blink::Visitor* visitor) { visitor->Trace(link_pseudo_class_rules_); visitor->Trace(cue_pseudo_rules_); visitor->Trace(focus_pseudo_class_rules_); + visitor->Trace(spatial_navigation_focus_class_rules_); visitor->Trace(universal_rules_); visitor->Trace(shadow_host_rules_); visitor->Trace(page_rules_); visitor->Trace(font_face_rules_); + visitor->Trace(font_feature_values_rules_); visitor->Trace(keyframes_rules_); visitor->Trace(deep_combinator_or_shadow_pseudo_rules_); visitor->Trace(part_pseudo_rules_); diff --git a/chromium/third_party/blink/renderer/core/css/rule_set.h b/chromium/third_party/blink/renderer/core/css/rule_set.h index 44d4da9d233..6f57a02f8b5 100644 --- a/chromium/third_party/blink/renderer/core/css/rule_set.h +++ b/chromium/third_party/blink/renderer/core/css/rule_set.h @@ -79,10 +79,10 @@ namespace blink { // and makes it accessible cheaply. class CORE_EXPORT RuleData : public GarbageCollected<RuleData> { public: - RuleData(StyleRule*, - unsigned selector_index, - unsigned position, - AddRuleFlags); + static RuleData* MaybeCreate(StyleRule*, + unsigned selector_index, + unsigned position, + AddRuleFlags); unsigned GetPosition() const { return position_; } StyleRule* Rule() const { return rule_; } @@ -114,16 +114,25 @@ class CORE_EXPORT RuleData : public GarbageCollected<RuleData> { void Trace(blink::Visitor*); - private: - Member<StyleRule> rule_; // This number is picked fairly arbitrary. If lowered, be aware that there // might be sites and extensions using style rules with selector lists // exceeding the number of simple selectors to fit in this bitfield. // See https://crbug.com/312913 and https://crbug.com/704562 - unsigned selector_index_ : 13; + static constexpr size_t kSelectorIndexBits = 13; + // This number was picked fairly arbitrarily. We can probably lower it if we // need to. Some simple testing showed <100,000 RuleData's on large sites. - unsigned position_ : 18; + static constexpr size_t kPositionBits = 18; + + private: + RuleData(StyleRule*, + unsigned selector_index, + unsigned position, + AddRuleFlags); + + Member<StyleRule> rule_; + unsigned selector_index_ : kSelectorIndexBits; + unsigned position_ : kPositionBits; unsigned contains_uncommon_attribute_selector_ : 1; // 32 bits above unsigned specificity_ : 24; @@ -161,7 +170,9 @@ static_assert(sizeof(RuleData) == sizeof(SameSizeAsRuleData), // ElementRuleCollector::CollectMatchingRules. class CORE_EXPORT RuleSet : public GarbageCollectedFinalized<RuleSet> { public: - static RuleSet* Create() { return new RuleSet; } + static RuleSet* Create() { return MakeGarbageCollected<RuleSet>(); } + + RuleSet() : rule_count_(0) {} void AddRulesFromSheet(StyleSheetContents*, const MediaQueryEvaluator&, @@ -203,6 +214,11 @@ class CORE_EXPORT RuleSet : public GarbageCollectedFinalized<RuleSet> { DCHECK(!pending_rules_); return &focus_pseudo_class_rules_; } + const HeapVector<Member<const RuleData>>* + SpatialNavigationFocusPseudoClassRules() const { + DCHECK(!pending_rules_); + return &spatial_navigation_focus_class_rules_; + } const HeapVector<Member<const RuleData>>* UniversalRules() const { DCHECK(!pending_rules_); return &universal_rules_; @@ -222,6 +238,10 @@ class CORE_EXPORT RuleSet : public GarbageCollectedFinalized<RuleSet> { const HeapVector<Member<StyleRuleFontFace>>& FontFaceRules() const { return font_face_rules_; } + const HeapVector<Member<StyleRuleFontFeatureValues>>& FontFeatureValuesRules() + const { + return font_feature_values_rules_; + } const HeapVector<Member<StyleRuleKeyframes>>& KeyframesRules() const { return keyframes_rules_; } @@ -270,12 +290,11 @@ class CORE_EXPORT RuleSet : public GarbageCollectedFinalized<RuleSet> { using CompactRuleMap = HeapHashMap<AtomicString, Member<HeapVector<Member<const RuleData>>>>; - RuleSet() : rule_count_(0) {} - void AddToRuleSet(const AtomicString& key, PendingRuleMap&, const RuleData*); void AddPageRule(StyleRulePage*); void AddViewportRule(StyleRuleViewport*); void AddFontFaceRule(StyleRuleFontFace*); + void AddFontFeatureValuesRule(StyleRuleFontFeatureValues*); void AddKeyframesRule(StyleRuleKeyframes*); void AddChildRules(const HeapVector<Member<StyleRuleBase>>&, @@ -288,7 +307,11 @@ class CORE_EXPORT RuleSet : public GarbageCollectedFinalized<RuleSet> { class PendingRuleMaps : public GarbageCollected<PendingRuleMaps> { public: - static PendingRuleMaps* Create() { return new PendingRuleMaps; } + static PendingRuleMaps* Create() { + return MakeGarbageCollected<PendingRuleMaps>(); + } + + PendingRuleMaps() = default; PendingRuleMap id_rules; PendingRuleMap class_rules; @@ -296,9 +319,6 @@ class CORE_EXPORT RuleSet : public GarbageCollectedFinalized<RuleSet> { PendingRuleMap shadow_pseudo_element_rules; void Trace(blink::Visitor*); - - private: - PendingRuleMaps() = default; }; PendingRuleMaps* EnsurePendingRules() { @@ -314,12 +334,14 @@ class CORE_EXPORT RuleSet : public GarbageCollectedFinalized<RuleSet> { HeapVector<Member<const RuleData>> link_pseudo_class_rules_; HeapVector<Member<const RuleData>> cue_pseudo_rules_; HeapVector<Member<const RuleData>> focus_pseudo_class_rules_; + HeapVector<Member<const RuleData>> spatial_navigation_focus_class_rules_; HeapVector<Member<const RuleData>> universal_rules_; HeapVector<Member<const RuleData>> shadow_host_rules_; HeapVector<Member<const RuleData>> part_pseudo_rules_; RuleFeatureSet features_; HeapVector<Member<StyleRulePage>> page_rules_; HeapVector<Member<StyleRuleFontFace>> font_face_rules_; + HeapVector<Member<StyleRuleFontFeatureValues>> font_feature_values_rules_; HeapVector<Member<StyleRuleKeyframes>> keyframes_rules_; HeapVector<MinimalRuleData> deep_combinator_or_shadow_pseudo_rules_; HeapVector<MinimalRuleData> content_pseudo_element_rules_; diff --git a/chromium/third_party/blink/renderer/core/css/rule_set_test.cc b/chromium/third_party/blink/renderer/core/css/rule_set_test.cc index 720857871ee..8eaaf158b90 100644 --- a/chromium/third_party/blink/renderer/core/css/rule_set_test.cc +++ b/chromium/third_party/blink/renderer/core/css/rule_set_test.cc @@ -30,16 +30,31 @@ #include "third_party/blink/renderer/core/css/rule_set.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/renderer/core/css/css_test_helper.h" +#include "third_party/blink/renderer/core/css/css_test_helpers.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" namespace blink { +using namespace css_test_helpers; + +namespace { + +StyleRule* CreateDummyStyleRule() { + TestStyleSheet sheet; + sheet.AddCSSRules("#id { color: tomato; }"); + const RuleSet& rule_set = sheet.GetRuleSet(); + const HeapVector<Member<const RuleData>>* rules = rule_set.IdRules("id"); + DCHECK_EQ(1u, rules->size()); + return rules->at(0)->Rule(); +} + +} // namespace + TEST(RuleSetTest, findBestRuleSetAndAdd_CustomPseudoElements) { - CSSTestHelper helper; + TestStyleSheet sheet; - helper.AddCSSRules("summary::-webkit-details-marker { }"); - RuleSet& rule_set = helper.GetRuleSet(); + sheet.AddCSSRules("summary::-webkit-details-marker { }"); + RuleSet& rule_set = sheet.GetRuleSet(); AtomicString str("-webkit-details-marker"); const HeapVector<Member<const RuleData>>* rules = rule_set.ShadowPseudoElementRules(str); @@ -48,10 +63,10 @@ TEST(RuleSetTest, findBestRuleSetAndAdd_CustomPseudoElements) { } TEST(RuleSetTest, findBestRuleSetAndAdd_Id) { - CSSTestHelper helper; + TestStyleSheet sheet; - helper.AddCSSRules("#id { }"); - RuleSet& rule_set = helper.GetRuleSet(); + sheet.AddCSSRules("#id { }"); + RuleSet& rule_set = sheet.GetRuleSet(); AtomicString str("id"); const HeapVector<Member<const RuleData>>* rules = rule_set.IdRules(str); ASSERT_EQ(1u, rules->size()); @@ -59,10 +74,10 @@ TEST(RuleSetTest, findBestRuleSetAndAdd_Id) { } TEST(RuleSetTest, findBestRuleSetAndAdd_NthChild) { - CSSTestHelper helper; + TestStyleSheet sheet; - helper.AddCSSRules("div:nth-child(2) { }"); - RuleSet& rule_set = helper.GetRuleSet(); + sheet.AddCSSRules("div:nth-child(2) { }"); + RuleSet& rule_set = sheet.GetRuleSet(); AtomicString str("div"); const HeapVector<Member<const RuleData>>* rules = rule_set.TagRules(str); ASSERT_EQ(1u, rules->size()); @@ -70,10 +85,10 @@ TEST(RuleSetTest, findBestRuleSetAndAdd_NthChild) { } TEST(RuleSetTest, findBestRuleSetAndAdd_ClassThenId) { - CSSTestHelper helper; + TestStyleSheet sheet; - helper.AddCSSRules(".class#id { }"); - RuleSet& rule_set = helper.GetRuleSet(); + sheet.AddCSSRules(".class#id { }"); + RuleSet& rule_set = sheet.GetRuleSet(); AtomicString str("id"); // id is prefered over class even if class preceeds it in the selector. const HeapVector<Member<const RuleData>>* rules = rule_set.IdRules(str); @@ -83,10 +98,10 @@ TEST(RuleSetTest, findBestRuleSetAndAdd_ClassThenId) { } TEST(RuleSetTest, findBestRuleSetAndAdd_IdThenClass) { - CSSTestHelper helper; + TestStyleSheet sheet; - helper.AddCSSRules("#id.class { }"); - RuleSet& rule_set = helper.GetRuleSet(); + sheet.AddCSSRules("#id.class { }"); + RuleSet& rule_set = sheet.GetRuleSet(); AtomicString str("id"); const HeapVector<Member<const RuleData>>* rules = rule_set.IdRules(str); ASSERT_EQ(1u, rules->size()); @@ -94,10 +109,10 @@ TEST(RuleSetTest, findBestRuleSetAndAdd_IdThenClass) { } TEST(RuleSetTest, findBestRuleSetAndAdd_AttrThenId) { - CSSTestHelper helper; + TestStyleSheet sheet; - helper.AddCSSRules("[attr]#id { }"); - RuleSet& rule_set = helper.GetRuleSet(); + sheet.AddCSSRules("[attr]#id { }"); + RuleSet& rule_set = sheet.GetRuleSet(); AtomicString str("id"); const HeapVector<Member<const RuleData>>* rules = rule_set.IdRules(str); ASSERT_EQ(1u, rules->size()); @@ -106,10 +121,10 @@ TEST(RuleSetTest, findBestRuleSetAndAdd_AttrThenId) { } TEST(RuleSetTest, findBestRuleSetAndAdd_TagThenAttrThenId) { - CSSTestHelper helper; + TestStyleSheet sheet; - helper.AddCSSRules("div[attr]#id { }"); - RuleSet& rule_set = helper.GetRuleSet(); + sheet.AddCSSRules("div[attr]#id { }"); + RuleSet& rule_set = sheet.GetRuleSet(); AtomicString str("id"); const HeapVector<Member<const RuleData>>* rules = rule_set.IdRules(str); ASSERT_EQ(1u, rules->size()); @@ -118,10 +133,10 @@ TEST(RuleSetTest, findBestRuleSetAndAdd_TagThenAttrThenId) { } TEST(RuleSetTest, findBestRuleSetAndAdd_DivWithContent) { - CSSTestHelper helper; + TestStyleSheet sheet; - helper.AddCSSRules("div::content { }"); - RuleSet& rule_set = helper.GetRuleSet(); + sheet.AddCSSRules("div::content { }"); + RuleSet& rule_set = sheet.GetRuleSet(); AtomicString str("div"); const HeapVector<Member<const RuleData>>* rules = rule_set.TagRules(str); ASSERT_EQ(1u, rules->size()); @@ -130,46 +145,46 @@ TEST(RuleSetTest, findBestRuleSetAndAdd_DivWithContent) { } TEST(RuleSetTest, findBestRuleSetAndAdd_Host) { - CSSTestHelper helper; + TestStyleSheet sheet; - helper.AddCSSRules(":host { }"); - RuleSet& rule_set = helper.GetRuleSet(); + sheet.AddCSSRules(":host { }"); + RuleSet& rule_set = sheet.GetRuleSet(); const HeapVector<Member<const RuleData>>* rules = rule_set.ShadowHostRules(); ASSERT_EQ(1u, rules->size()); } TEST(RuleSetTest, findBestRuleSetAndAdd_HostWithId) { - CSSTestHelper helper; + TestStyleSheet sheet; - helper.AddCSSRules(":host(#x) { }"); - RuleSet& rule_set = helper.GetRuleSet(); + sheet.AddCSSRules(":host(#x) { }"); + RuleSet& rule_set = sheet.GetRuleSet(); const HeapVector<Member<const RuleData>>* rules = rule_set.ShadowHostRules(); ASSERT_EQ(1u, rules->size()); } TEST(RuleSetTest, findBestRuleSetAndAdd_HostContext) { - CSSTestHelper helper; + TestStyleSheet sheet; - helper.AddCSSRules(":host-context(*) { }"); - RuleSet& rule_set = helper.GetRuleSet(); + sheet.AddCSSRules(":host-context(*) { }"); + RuleSet& rule_set = sheet.GetRuleSet(); const HeapVector<Member<const RuleData>>* rules = rule_set.ShadowHostRules(); ASSERT_EQ(1u, rules->size()); } TEST(RuleSetTest, findBestRuleSetAndAdd_HostContextWithId) { - CSSTestHelper helper; + TestStyleSheet sheet; - helper.AddCSSRules(":host-context(#x) { }"); - RuleSet& rule_set = helper.GetRuleSet(); + sheet.AddCSSRules(":host-context(#x) { }"); + RuleSet& rule_set = sheet.GetRuleSet(); const HeapVector<Member<const RuleData>>* rules = rule_set.ShadowHostRules(); ASSERT_EQ(1u, rules->size()); } TEST(RuleSetTest, findBestRuleSetAndAdd_HostAndHostContextNotInRightmost) { - CSSTestHelper helper; + TestStyleSheet sheet; - helper.AddCSSRules(":host-context(#x) .y, :host(.a) > #b { }"); - RuleSet& rule_set = helper.GetRuleSet(); + sheet.AddCSSRules(":host-context(#x) .y, :host(.a) > #b { }"); + RuleSet& rule_set = sheet.GetRuleSet(); const HeapVector<Member<const RuleData>>* shadow_rules = rule_set.ShadowHostRules(); const HeapVector<Member<const RuleData>>* id_rules = rule_set.IdRules("b"); @@ -181,74 +196,74 @@ TEST(RuleSetTest, findBestRuleSetAndAdd_HostAndHostContextNotInRightmost) { } TEST(RuleSetTest, findBestRuleSetAndAdd_HostAndClass) { - CSSTestHelper helper; + TestStyleSheet sheet; - helper.AddCSSRules(".foo:host { }"); - RuleSet& rule_set = helper.GetRuleSet(); + sheet.AddCSSRules(".foo:host { }"); + RuleSet& rule_set = sheet.GetRuleSet(); const HeapVector<Member<const RuleData>>* rules = rule_set.ShadowHostRules(); ASSERT_EQ(0u, rules->size()); } TEST(RuleSetTest, findBestRuleSetAndAdd_HostContextAndClass) { - CSSTestHelper helper; + TestStyleSheet sheet; - helper.AddCSSRules(".foo:host-context(*) { }"); - RuleSet& rule_set = helper.GetRuleSet(); + sheet.AddCSSRules(".foo:host-context(*) { }"); + RuleSet& rule_set = sheet.GetRuleSet(); const HeapVector<Member<const RuleData>>* rules = rule_set.ShadowHostRules(); ASSERT_EQ(0u, rules->size()); } TEST(RuleSetTest, findBestRuleSetAndAdd_Focus) { - CSSTestHelper helper; + TestStyleSheet sheet; - helper.AddCSSRules(":focus { }"); - helper.AddCSSRules("[attr]:focus { }"); - RuleSet& rule_set = helper.GetRuleSet(); + sheet.AddCSSRules(":focus { }"); + sheet.AddCSSRules("[attr]:focus { }"); + RuleSet& rule_set = sheet.GetRuleSet(); const HeapVector<Member<const RuleData>>* rules = rule_set.FocusPseudoClassRules(); ASSERT_EQ(2u, rules->size()); } TEST(RuleSetTest, findBestRuleSetAndAdd_LinkVisited) { - CSSTestHelper helper; - - helper.AddCSSRules(":link { }"); - helper.AddCSSRules("[attr]:link { }"); - helper.AddCSSRules(":visited { }"); - helper.AddCSSRules("[attr]:visited { }"); - helper.AddCSSRules(":-webkit-any-link { }"); - helper.AddCSSRules("[attr]:-webkit-any-link { }"); - RuleSet& rule_set = helper.GetRuleSet(); + TestStyleSheet sheet; + + sheet.AddCSSRules(":link { }"); + sheet.AddCSSRules("[attr]:link { }"); + sheet.AddCSSRules(":visited { }"); + sheet.AddCSSRules("[attr]:visited { }"); + sheet.AddCSSRules(":-webkit-any-link { }"); + sheet.AddCSSRules("[attr]:-webkit-any-link { }"); + RuleSet& rule_set = sheet.GetRuleSet(); const HeapVector<Member<const RuleData>>* rules = rule_set.LinkPseudoClassRules(); ASSERT_EQ(6u, rules->size()); } TEST(RuleSetTest, findBestRuleSetAndAdd_Cue) { - CSSTestHelper helper; + TestStyleSheet sheet; - helper.AddCSSRules("::cue(b) { }"); - helper.AddCSSRules("video::cue(u) { }"); - RuleSet& rule_set = helper.GetRuleSet(); + sheet.AddCSSRules("::cue(b) { }"); + sheet.AddCSSRules("video::cue(u) { }"); + RuleSet& rule_set = sheet.GetRuleSet(); const HeapVector<Member<const RuleData>>* rules = rule_set.CuePseudoRules(); ASSERT_EQ(2u, rules->size()); } TEST(RuleSetTest, findBestRuleSetAndAdd_PlaceholderPseudo) { - CSSTestHelper helper; + TestStyleSheet sheet; - helper.AddCSSRules("::placeholder { }"); - helper.AddCSSRules("input::placeholder { }"); - RuleSet& rule_set = helper.GetRuleSet(); + sheet.AddCSSRules("::placeholder { }"); + sheet.AddCSSRules("input::placeholder { }"); + RuleSet& rule_set = sheet.GetRuleSet(); auto* rules = rule_set.ShadowPseudoElementRules("-webkit-input-placeholder"); ASSERT_EQ(2u, rules->size()); } -TEST(RuleSetTest, findBestRuleSetAndAdd_PseudoMatches) { - CSSTestHelper helper; +TEST(RuleSetTest, findBestRuleSetAndAdd_PseudoIs) { + TestStyleSheet sheet; - helper.AddCSSRules(".a :matches(.b+.c, .d>:matches(.e, .f)) { }"); - RuleSet& rule_set = helper.GetRuleSet(); + sheet.AddCSSRules(".a :is(.b+.c, .d>:is(.e, .f)) { }"); + RuleSet& rule_set = sheet.GetRuleSet(); { AtomicString str("c"); const HeapVector<Member<const RuleData>>* rules = rule_set.ClassRules(str); @@ -269,11 +284,11 @@ TEST(RuleSetTest, findBestRuleSetAndAdd_PseudoMatches) { } } -TEST(RuleSetTest, findBestRuleSetAndAdd_PseudoIS) { - CSSTestHelper helper; +TEST(RuleSetTest, findBestRuleSetAndAdd_PseudoWhere) { + TestStyleSheet sheet; - helper.AddCSSRules(".a :is(.b+.c, .d>:is(.e, .f)) { }"); - RuleSet& rule_set = helper.GetRuleSet(); + sheet.AddCSSRules(".a :where(.b+.c, .d>:where(.e, .f)) { }"); + RuleSet& rule_set = sheet.GetRuleSet(); { AtomicString str("c"); const HeapVector<Member<const RuleData>>* rules = rule_set.ClassRules(str); @@ -294,40 +309,47 @@ TEST(RuleSetTest, findBestRuleSetAndAdd_PseudoIS) { } } -TEST(RuleSetTest, findBestRuleSetAndAdd_PseudoMatchesTooLarge) { +TEST(RuleSetTest, findBestRuleSetAndAdd_PseudoIsTooLarge) { // RuleData cannot support selectors at index 8192 or beyond so the expansion // is limited to this size - CSSTestHelper helper; - - helper.AddCSSRules( - ":matches(.a#a, .b#b, .c#c, .d#d) + " - ":matches(.e#e, .f#f, .g#g, .h#h) + " - ":matches(.i#i, .j#j, .k#k, .l#l) + " - ":matches(.m#m, .n#n, .o#o, .p#p) + " - ":matches(.q#q, .r#r, .s#s, .t#t) + " - ":matches(.u#u, .v#v, .w#w, .x#x) { }", + TestStyleSheet sheet; + + sheet.AddCSSRules( + ":is(.a#a, .b#b, .c#c, .d#d) + " + ":is(.e#e, .f#f, .g#g, .h#h) + " + ":is(.i#i, .j#j, .k#k, .l#l) + " + ":is(.m#m, .n#n, .o#o, .p#p) + " + ":is(.q#q, .r#r, .s#s, .t#t) + " + ":is(.u#u, .v#v, .w#w, .x#x) { }", true); - RuleSet& rule_set = helper.GetRuleSet(); + RuleSet& rule_set = sheet.GetRuleSet(); ASSERT_EQ(0u, rule_set.RuleCount()); } -TEST(RuleSetTest, findBestRuleSetAndAdd_PseudoISTooLarge) { +TEST(RuleSetTest, findBestRuleSetAndAdd_PseudoWhereTooLarge) { // RuleData cannot support selectors at index 8192 or beyond so the expansion // is limited to this size - CSSTestHelper helper; + TestStyleSheet sheet; - helper.AddCSSRules( - ":is(.a#a, .b#b, .c#c, .d#d) + :is(.e#e, .f#f, .g#g, .h#h) + " - ":is(.i#i, .j#j, .k#k, .l#l) + :is(.m#m, .n#n, .o#o, .p#p) + " - ":is(.q#q, .r#r, .s#s, .t#t) + :is(.u#u, .v#v, .w#w, .x#x) { }", + sheet.AddCSSRules( + ":where(.a#a, .b#b, .c#c, .d#d) + :where(.e#e, .f#f, .g#g, .h#h) + " + ":where(.i#i, .j#j, .k#k, .l#l) + :where(.m#m, .n#n, .o#o, .p#p) + " + ":where(.q#q, .r#r, .s#s, .t#t) + :where(.u#u, .v#v, .w#w, .x#x) { }", true); - RuleSet& rule_set = helper.GetRuleSet(); + RuleSet& rule_set = sheet.GetRuleSet(); ASSERT_EQ(0u, rule_set.RuleCount()); } TEST(RuleSetTest, SelectorIndexLimit) { + // It's not feasible to run this test for a large number of bits. If the + // number of bits have increased to a large number, consider removing this + // test and making do with RuleSetTest.RuleDataSelectorIndexLimit. + static_assert( + RuleData::kSelectorIndexBits == 13, + "Please manually consider whether this test should be removed."); + StringBuilder builder; // We use 13 bits to storing the selector start index in RuleData. This is a @@ -338,13 +360,51 @@ TEST(RuleSetTest, SelectorIndexLimit) { builder.Append("b,span {}"); - CSSTestHelper helper; - helper.AddCSSRules(builder.ToString().Ascii().data()); - const RuleSet& rule_set = helper.GetRuleSet(); + TestStyleSheet sheet; + sheet.AddCSSRules(builder.ToString().Ascii().data()); + const RuleSet& rule_set = sheet.GetRuleSet(); const HeapVector<Member<const RuleData>>* rules = rule_set.TagRules("b"); ASSERT_EQ(1u, rules->size()); EXPECT_EQ("b", rules->at(0)->Selector().TagQName().LocalName()); EXPECT_FALSE(rule_set.TagRules("span")); } +TEST(RuleSetTest, RuleDataSelectorIndexLimit) { + StyleRule* rule = CreateDummyStyleRule(); + AddRuleFlags flags = kRuleHasNoSpecialState; + const unsigned position = 0; + EXPECT_TRUE(RuleData::MaybeCreate(rule, 0, position, flags)); + EXPECT_FALSE(RuleData::MaybeCreate(rule, (1 << RuleData::kSelectorIndexBits), + position, flags)); + EXPECT_FALSE(RuleData::MaybeCreate( + rule, (1 << RuleData::kSelectorIndexBits) + 1, position, flags)); +} + +TEST(RuleSetTest, RuleDataPositionLimit) { + StyleRule* rule = CreateDummyStyleRule(); + AddRuleFlags flags = kRuleHasNoSpecialState; + const unsigned selector_index = 0; + EXPECT_TRUE(RuleData::MaybeCreate(rule, selector_index, 0, flags)); + EXPECT_FALSE(RuleData::MaybeCreate(rule, selector_index, + (1 << RuleData::kPositionBits), flags)); + EXPECT_FALSE(RuleData::MaybeCreate( + rule, selector_index, (1 << RuleData::kPositionBits) + 1, flags)); +} + +TEST(RuleSetTest, RuleCountNotIncreasedByInvalidRuleData) { + RuleSet* rule_set = RuleSet::Create(); + EXPECT_EQ(0u, rule_set->RuleCount()); + + AddRuleFlags flags = kRuleHasNoSpecialState; + StyleRule* rule = CreateDummyStyleRule(); + + // Add with valid selector_index=0. + rule_set->AddRule(rule, 0, flags); + EXPECT_EQ(1u, rule_set->RuleCount()); + + // Adding with invalid selector_index should not lead to a change in count. + rule_set->AddRule(rule, 1 << RuleData::kSelectorIndexBits, flags); + EXPECT_EQ(1u, rule_set->RuleCount()); +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/selector_checker.cc b/chromium/third_party/blink/renderer/core/css/selector_checker.cc index 5e0b242e194..971c5659c92 100644 --- a/chromium/third_party/blink/renderer/core/css/selector_checker.cc +++ b/chromium/third_party/blink/renderer/core/css/selector_checker.cc @@ -58,6 +58,7 @@ #include "third_party/blink/renderer/core/html_names.h" #include "third_party/blink/renderer/core/page/focus_controller.h" #include "third_party/blink/renderer/core/page/page.h" +#include "third_party/blink/renderer/core/page/spatial_navigation.h" #include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/core/scroll/scrollable_area.h" #include "third_party/blink/renderer/core/scroll/scrollbar_theme.h" @@ -66,8 +67,6 @@ namespace blink { -using namespace HTMLNames; - static bool IsFrameFocused(const Element& element) { return element.GetDocument().GetFrame() && element.GetDocument() .GetFrame() @@ -75,12 +74,6 @@ static bool IsFrameFocused(const Element& element) { .FrameIsFocusedAndActive(); } -static bool MatchesSpatialNavigationFocusPseudoClass(const Element& element) { - return IsHTMLOptionElement(element) && - ToHTMLOptionElement(element).SpatialNavigationFocused() && - IsFrameFocused(element); -} - static bool MatchesListBoxPseudoClass(const Element& element) { return IsHTMLSelectElement(element) && !ToHTMLSelectElement(element).UsesMenuList(); @@ -763,6 +756,7 @@ bool SelectorChecker::CheckPseudoClass(const SelectorCheckingContext& context, return CheckPseudoNot(context, result); case CSSSelector::kPseudoEmpty: { bool result = true; + bool has_whitespace = false; for (Node* n = element.firstChild(); n; n = n->nextSibling()) { if (n->IsElementNode()) { result = false; @@ -771,11 +765,20 @@ bool SelectorChecker::CheckPseudoClass(const SelectorCheckingContext& context, if (n->IsTextNode()) { Text* text_node = ToText(n); if (!text_node->data().IsEmpty()) { - result = false; - break; + if (text_node->ContainsOnlyWhitespaceOrEmpty()) { + has_whitespace = true; + } else { + result = false; + break; + } } } } + if (result && has_whitespace) { + UseCounter::Count(context.element->GetDocument(), + WebFeature::kCSSSelectorEmptyWhitespaceOnlyFail); + result = false; + } if (mode_ == kResolvingStyle) element.SetStyleAffectedByEmpty(); return result; @@ -1099,8 +1102,8 @@ bool SelectorChecker::CheckPseudoClass(const SelectorCheckingContext& context, case CSSSelector::kPseudoCornerPresent: return false; case CSSSelector::kPseudoUnknown: - case CSSSelector::kPseudoMatches: - case CSSSelector::kPseudoIS: + case CSSSelector::kPseudoIs: + case CSSSelector::kPseudoWhere: default: NOTREACHED(); break; @@ -1390,4 +1393,20 @@ bool SelectorChecker::MatchesFocusVisiblePseudoClass(const Element& element) { always_show_focus_ring); } +// static +bool SelectorChecker::MatchesSpatialNavigationFocusPseudoClass( + const Element& element) { + if (!IsSpatialNavigationEnabled(element.GetDocument().GetFrame())) + return false; + if (RuntimeEnabledFeatures::SpatialNavigationForcesOutlineEnabled()) { + // TODO(mthiesse): Decouple spatial navigation target from focus, so that + // if spat nav is enabled, but not used, we don't override focus ring + // behavior on that element. + return element.IsFocused() && IsFrameFocused(element); + } + return IsHTMLOptionElement(element) && + ToHTMLOptionElement(element).SpatialNavigationFocused() && + IsFrameFocused(element); +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/selector_checker.h b/chromium/third_party/blink/renderer/core/css/selector_checker.h index 014dd143ebf..c657a9ea06f 100644 --- a/chromium/third_party/blink/renderer/core/css/selector_checker.h +++ b/chromium/third_party/blink/renderer/core/css/selector_checker.h @@ -153,6 +153,7 @@ class SelectorChecker { static bool MatchesFocusPseudoClass(const Element&); static bool MatchesFocusVisiblePseudoClass(const Element&); + static bool MatchesSpatialNavigationFocusPseudoClass(const Element&); private: // Does the work of checking whether the simple selector and element pointed diff --git a/chromium/third_party/blink/renderer/core/css/selector_query.cc b/chromium/third_party/blink/renderer/core/css/selector_query.cc index fa10f0df333..642f0b61a1b 100644 --- a/chromium/third_party/blink/renderer/core/css/selector_query.cc +++ b/chromium/third_party/blink/renderer/core/css/selector_query.cc @@ -46,7 +46,7 @@ namespace blink { -using namespace HTMLNames; +using namespace html_names; #if DCHECK_IS_ON() || defined(RELEASE_QUERY_STATS) static SelectorQuery::QueryStats& CurrentQueryStats() { @@ -503,7 +503,7 @@ SelectorQuery::SelectorQuery(CSSSelectorList selector_list) // We only use the fast path when in standards mode where #id selectors // are case sensitive, so we need the same behavior for [id=value]. if (current->Match() == CSSSelector::kAttributeExact && - current->Attribute() == idAttr && + current->Attribute() == kIdAttr && current->AttributeMatch() == CSSSelector::kCaseSensitive) { selector_id_ = current->Value(); break; diff --git a/chromium/third_party/blink/renderer/core/css/selector_query_test.cc b/chromium/third_party/blink/renderer/core/css/selector_query_test.cc index 9ad67cb14c0..b677facb58f 100644 --- a/chromium/third_party/blink/renderer/core/css/selector_query_test.cc +++ b/chromium/third_party/blink/renderer/core/css/selector_query_test.cc @@ -71,7 +71,7 @@ TEST(SelectorQueryTest, NotMatchingPseudoElement) { CSSParserContext::Create( *document, NullURL(), false /* is_opaque_response_from_service_worker */, - kReferrerPolicyDefault, WTF::TextEncoding(), + network::mojom::ReferrerPolicy::kDefault, WTF::TextEncoding(), CSSParserContext::kSnapshotProfile), nullptr, "span::before"); std::unique_ptr<SelectorQuery> query = @@ -83,7 +83,7 @@ TEST(SelectorQueryTest, NotMatchingPseudoElement) { CSSParserContext::Create( *document, NullURL(), false /* is_opaque_response_from_service_worker */, - kReferrerPolicyDefault, WTF::TextEncoding(), + network::mojom::ReferrerPolicy::kDefault, WTF::TextEncoding(), CSSParserContext::kSnapshotProfile), nullptr, "span"); query = SelectorQuery::Adopt(std::move(selector_list)); @@ -104,7 +104,7 @@ TEST(SelectorQueryTest, LastOfTypeNotFinishedParsing) { CSSParserContext::Create( *document, NullURL(), false /* is_opaque_response_from_service_worker */, - kReferrerPolicyDefault, WTF::TextEncoding(), + network::mojom::ReferrerPolicy::kDefault, WTF::TextEncoding(), CSSParserContext::kSnapshotProfile), nullptr, "p:last-of-type"); std::unique_ptr<SelectorQuery> query = @@ -330,7 +330,7 @@ TEST(SelectorQueryTest, QuirksModeSlowPath) { TEST(SelectorQueryTest, DisconnectedSubtree) { Document* document = HTMLDocument::CreateForTest(); - Element* scope = document->CreateRawElement(HTMLNames::divTag); + Element* scope = document->CreateRawElement(html_names::kDivTag); scope->SetInnerHTMLFromString(R"HTML( <section> <span id=first> @@ -357,7 +357,7 @@ TEST(SelectorQueryTest, DisconnectedSubtree) { TEST(SelectorQueryTest, DisconnectedTreeScope) { Document* document = HTMLDocument::CreateForTest(); - Element* host = document->CreateRawElement(HTMLNames::divTag); + Element* host = document->CreateRawElement(html_names::kDivTag); ShadowRoot& shadowRoot = host->AttachShadowRootInternal(ShadowRootType::kOpen); shadowRoot.SetInnerHTMLFromString(R"HTML( diff --git a/chromium/third_party/blink/renderer/core/css/shadow_tree_style_sheet_collection.cc b/chromium/third_party/blink/renderer/core/css/shadow_tree_style_sheet_collection.cc index 4c8a15752cc..8a8867ac811 100644 --- a/chromium/third_party/blink/renderer/core/css/shadow_tree_style_sheet_collection.cc +++ b/chromium/third_party/blink/renderer/core/css/shadow_tree_style_sheet_collection.cc @@ -40,8 +40,6 @@ namespace blink { -using namespace HTMLNames; - ShadowTreeStyleSheetCollection::ShadowTreeStyleSheetCollection( ShadowRoot& shadow_root) : TreeScopeStyleSheetCollection(shadow_root) {} diff --git a/chromium/third_party/blink/renderer/core/css/style_attribute_mutation_scope.cc b/chromium/third_party/blink/renderer/core/css/style_attribute_mutation_scope.cc index d9050cb824f..58ff83ce080 100644 --- a/chromium/third_party/blink/renderer/core/css/style_attribute_mutation_scope.cc +++ b/chromium/third_party/blink/renderer/core/css/style_attribute_mutation_scope.cc @@ -68,21 +68,21 @@ StyleAttributeMutationScope::StyleAttributeMutationScope( mutation_recipients_ = MutationObserverInterestGroup::CreateForAttributesMutation( - *current_decl_->ParentElement(), HTMLNames::styleAttr); + *current_decl_->ParentElement(), html_names::kStyleAttr); bool should_read_old_value = (mutation_recipients_ && mutation_recipients_->IsOldValueRequested()) || DefinitionIfStyleChangedCallback(current_decl_->ParentElement()); if (should_read_old_value) { old_value_ = - current_decl_->ParentElement()->getAttribute(HTMLNames::styleAttr); + current_decl_->ParentElement()->getAttribute(html_names::kStyleAttr); } if (mutation_recipients_) { AtomicString requested_old_value = mutation_recipients_->IsOldValueRequested() ? old_value_ : g_null_atom; mutation_ = MutationRecord::CreateAttributes(current_decl_->ParentElement(), - HTMLNames::styleAttr, + html_names::kStyleAttr, requested_old_value); } } @@ -101,8 +101,8 @@ StyleAttributeMutationScope::~StyleAttributeMutationScope() { if (CustomElementDefinition* definition = DefinitionIfStyleChangedCallback(element)) { definition->EnqueueAttributeChangedCallback( - element, HTMLNames::styleAttr, old_value_, - element->getAttribute(HTMLNames::styleAttr)); + element, html_names::kStyleAttr, old_value_, + element->getAttribute(html_names::kStyleAttr)); } should_deliver_ = false; diff --git a/chromium/third_party/blink/renderer/core/css/style_change_reason.cc b/chromium/third_party/blink/renderer/core/css/style_change_reason.cc index a8ff0fa0fa8..7fed20e4839 100644 --- a/chromium/third_party/blink/renderer/core/css/style_change_reason.cc +++ b/chromium/third_party/blink/renderer/core/css/style_change_reason.cc @@ -10,7 +10,7 @@ namespace blink { -namespace StyleChangeReason { +namespace style_change_reason { const char kActiveStylesheetsUpdate[] = "ActiveStylesheetsUpdate"; const char kAnimation[] = "Animation"; const char kAttribute[] = "Attribute"; @@ -50,9 +50,9 @@ const char kVisitedLink[] = "VisitedLink"; const char kVisuallyOrdered[] = "VisuallyOrdered"; const char kWritingModeChange[] = "WritingModeChange"; const char kZoom[] = "Zoom"; -} // namespace StyleChangeReason +} // namespace style_change_reason -namespace StyleChangeExtraData { +namespace style_change_extra_data { DEFINE_GLOBAL(AtomicString, g_active); DEFINE_GLOBAL(AtomicString, g_disabled); DEFINE_GLOBAL(AtomicString, g_drag); @@ -77,6 +77,6 @@ void Init() { new (NotNull, (void*)&g_unresolved) AtomicString(":unresolved"); } -} // namespace StyleChangeExtraData +} // namespace style_change_extra_data } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/style_change_reason.h b/chromium/third_party/blink/renderer/core/css/style_change_reason.h index 06d03249ab5..7d21ac935b0 100644 --- a/chromium/third_party/blink/renderer/core/css/style_change_reason.h +++ b/chromium/third_party/blink/renderer/core/css/style_change_reason.h @@ -13,7 +13,7 @@ namespace blink { class QualifiedName; -namespace StyleChangeReason { +namespace style_change_reason { extern const char kActiveStylesheetsUpdate[]; extern const char kAnimation[]; extern const char kAttribute[]; @@ -50,10 +50,10 @@ extern const char kVisitedLink[]; extern const char kVisuallyOrdered[]; extern const char kWritingModeChange[]; extern const char kZoom[]; -} // namespace StyleChangeReason +} // namespace style_change_reason typedef const char StyleChangeReasonString[]; -namespace StyleChangeExtraData { +namespace style_change_extra_data { extern const AtomicString& g_active; extern const AtomicString& g_disabled; extern const AtomicString& g_drag; @@ -65,7 +65,7 @@ extern const AtomicString& g_past; extern const AtomicString& g_unresolved; void Init(); -} // namespace StyleChangeExtraData +} // namespace style_change_extra_data // |StyleChangeReasonForTracing| is used to trace the reason a // |Node::setNeedsStyleRecalc| call was made to show it in DevTools or in @@ -89,7 +89,7 @@ class StyleChangeReasonForTracing { static StyleChangeReasonForTracing FromAttribute( const QualifiedName& attribute_name) { - return StyleChangeReasonForTracing(StyleChangeReason::kAttribute, + return StyleChangeReasonForTracing(style_change_reason::kAttribute, attribute_name.LocalName()); } diff --git a/chromium/third_party/blink/renderer/core/css/style_color.h b/chromium/third_party/blink/renderer/core/css/style_color.h index f3ebcf21c6a..b43684bf76f 100644 --- a/chromium/third_party/blink/renderer/core/css/style_color.h +++ b/chromium/third_party/blink/renderer/core/css/style_color.h @@ -55,6 +55,8 @@ class StyleColor { return current_color_ ? current_color : color_; } + bool HasAlpha() const { return !current_color_ && color_.HasAlpha(); } + static Color ColorFromKeyword(CSSValueID); static bool IsColorKeyword(CSSValueID); static bool IsSystemColor(CSSValueID); diff --git a/chromium/third_party/blink/renderer/core/css/style_element.cc b/chromium/third_party/blink/renderer/core/css/style_element.cc index 5edb773c8f0..7c5da2dc8f5 100644 --- a/chromium/third_party/blink/renderer/core/css/style_element.cc +++ b/chromium/third_party/blink/renderer/core/css/style_element.cc @@ -123,8 +123,7 @@ void StyleElement::ClearSheet(Element& owner_element) { static bool ShouldBypassMainWorldCSP(const Element& element) { // Main world CSP is bypassed within an isolated world. - LocalFrame* frame = element.GetDocument().GetFrame(); - if (frame && frame->GetScriptController().ShouldBypassMainWorldCSP()) + if (ContentSecurityPolicy::ShouldBypassMainWorld(&element.GetDocument())) return true; // Main world CSP is bypassed for style elements in user agent shadow DOM. diff --git a/chromium/third_party/blink/renderer/core/css/style_engine.cc b/chromium/third_party/blink/renderer/core/css/style_engine.cc index d941f6606e1..2fd4861f44b 100644 --- a/chromium/third_party/blink/renderer/core/css/style_engine.cc +++ b/chromium/third_party/blink/renderer/core/css/style_engine.cc @@ -30,12 +30,16 @@ #include "third_party/blink/renderer/core/css/style_engine.h" #include "third_party/blink/renderer/core/css/css_default_style_sheets.h" +#include "third_party/blink/renderer/core/css/css_font_family_value.h" #include "third_party/blink/renderer/core/css/css_font_selector.h" +#include "third_party/blink/renderer/core/css/css_identifier_value.h" #include "third_party/blink/renderer/core/css/css_style_sheet.h" +#include "third_party/blink/renderer/core/css/css_value_list.h" #include "third_party/blink/renderer/core/css/document_style_environment_variables.h" #include "third_party/blink/renderer/core/css/document_style_sheet_collector.h" #include "third_party/blink/renderer/core/css/font_face_cache.h" #include "third_party/blink/renderer/core/css/invalidation/invalidation_set.h" +#include "third_party/blink/renderer/core/css/property_registry.h" #include "third_party/blink/renderer/core/css/resolver/scoped_style_resolver.h" #include "third_party/blink/renderer/core/css/resolver/selector_filter_parent_scope.h" #include "third_party/blink/renderer/core/css/resolver/style_rule_usage_tracker.h" @@ -47,6 +51,7 @@ #include "third_party/blink/renderer/core/dom/element.h" #include "third_party/blink/renderer/core/dom/element_traversal.h" #include "third_party/blink/renderer/core/dom/layout_tree_builder_traversal.h" +#include "third_party/blink/renderer/core/dom/node_computed_style.h" #include "third_party/blink/renderer/core/dom/processing_instruction.h" #include "third_party/blink/renderer/core/dom/shadow_root.h" #include "third_party/blink/renderer/core/dom/text.h" @@ -60,6 +65,7 @@ #include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/core/style/computed_style.h" +#include "third_party/blink/renderer/core/style/style_initial_data.h" #include "third_party/blink/renderer/core/svg/svg_style_element.h" #include "third_party/blink/renderer/platform/fonts/font_cache.h" #include "third_party/blink/renderer/platform/fonts/font_selector.h" @@ -67,8 +73,6 @@ namespace blink { -using namespace HTMLNames; - StyleEngine::StyleEngine(Document& document) : document_(&document), is_master_(!document.IsHTMLImport()), @@ -110,7 +114,8 @@ TreeScopeStyleSheetCollection& StyleEngine::EnsureStyleSheetCollectionFor( style_sheet_collection_map_.insert(&tree_scope, nullptr); if (result.is_new_entry) { result.stored_value->value = - new ShadowTreeStyleSheetCollection(ToShadowRoot(tree_scope)); + MakeGarbageCollected<ShadowTreeStyleSheetCollection>( + ToShadowRoot(tree_scope)); } return *result.stored_value->value.Get(); } @@ -341,7 +346,7 @@ void StyleEngine::WatchedSelectorsChanged() { // TODO(futhark@chromium.org): Should be able to use RuleSetInvalidation here. GetDocument().SetNeedsStyleRecalc( kSubtreeStyleChange, StyleChangeReasonForTracing::Create( - StyleChangeReason::kDeclarativeContent)); + style_change_reason::kDeclarativeContent)); } bool StyleEngine::ShouldUpdateDocumentStyleSheetCollection() const { @@ -599,13 +604,39 @@ void StyleEngine::ClearFontCacheAndAddUserFonts() { resolver_->InvalidateMatchedPropertiesCache(); } + default_font_display_map_.clear(); // Rebuild the font cache with @font-face rules from user style sheets. for (unsigned i = 0; i < active_user_style_sheets_.size(); ++i) { DCHECK(active_user_style_sheets_[i].second); - AddFontFaceRules(*active_user_style_sheets_[i].second); + AddUserFontFaceRules(*active_user_style_sheets_[i].second); + for (const auto& rule : + active_user_style_sheets_[i].second->FontFeatureValuesRules()) { + AddDefaultFontDisplay(rule); + } + } +} + +void StyleEngine::AddDefaultFontDisplay( + const StyleRuleFontFeatureValues* rule) { + if (!rule->FontDisplay()) + return; + for (const auto& family_value : rule->FontFamily()) { + if (family_value->IsFontFamilyValue()) { + default_font_display_map_.Set( + AtomicString(ToCSSFontFamilyValue(family_value)->Value()), + CSSValueToFontDisplay(rule->FontDisplay())); + } } } +FontDisplay StyleEngine::GetDefaultFontDisplay( + const AtomicString& family) const { + auto it = default_font_display_map_.find(family); + if (it == default_font_display_map_.end()) + return kFontDisplayAuto; + return it->value; +} + void StyleEngine::UpdateGenericFontFamilySettings() { // FIXME: we should not update generic font family settings when // document is inactive. @@ -747,7 +778,7 @@ void StyleEngine::FontsNeedUpdate(FontSelector*) { resolver_->InvalidateMatchedPropertiesCache(); GetDocument().SetNeedsStyleRecalc( kSubtreeStyleChange, - StyleChangeReasonForTracing::Create(StyleChangeReason::kFonts)); + StyleChangeReasonForTracing::Create(style_change_reason::kFonts)); probe::fontsUpdated(document_, nullptr, String(), nullptr); } @@ -764,7 +795,7 @@ void StyleEngine::PlatformColorsChanged() { resolver_->InvalidateMatchedPropertiesCache(); GetDocument().SetNeedsStyleRecalc( kSubtreeStyleChange, StyleChangeReasonForTracing::Create( - StyleChangeReason::kPlatformColorChange)); + style_change_reason::kPlatformColorChange)); } bool StyleEngine::ShouldSkipInvalidationFor(const Element& element) const { @@ -842,6 +873,24 @@ void StyleEngine::ClassChangedForElement(const SpaceSplitString& old_classes, element); } +namespace { + +bool HasAttributeDependentGeneratedContent(const Element& element) { + if (PseudoElement* before = element.GetPseudoElement(kPseudoIdBefore)) { + const ComputedStyle* style = before->GetComputedStyle(); + if (style && style->HasAttrContent()) + return true; + } + if (PseudoElement* after = element.GetPseudoElement(kPseudoIdAfter)) { + const ComputedStyle* style = after->GetComputedStyle(); + if (style && style->HasAttrContent()) + return true; + } + return false; +} + +} // namespace + void StyleEngine::AttributeChangedForElement( const QualifiedName& attribute_name, Element& element) { @@ -853,6 +902,13 @@ void StyleEngine::AttributeChangedForElement( invalidation_lists, element, attribute_name); pending_invalidations_.ScheduleInvalidationSetsForNode(invalidation_lists, element); + + if (!element.NeedsStyleRecalc() && + HasAttributeDependentGeneratedContent(element)) { + element.SetNeedsStyleRecalc( + kLocalStyleChange, + StyleChangeReasonForTracing::FromAttribute(attribute_name)); + } } void StyleEngine::IdChangedForElement(const AtomicString& old_id, @@ -893,10 +949,10 @@ void StyleEngine::PartChangedForElement(Element& element) { return; element.SetNeedsStyleRecalc( kLocalStyleChange, - StyleChangeReasonForTracing::FromAttribute(HTMLNames::partAttr)); + StyleChangeReasonForTracing::FromAttribute(html_names::kPartAttr)); } -void StyleEngine::PartmapChangedForElement(Element& element) { +void StyleEngine::ExportpartsChangedForElement(Element& element) { if (ShouldSkipInvalidationFor(element)) return; if (!element.GetShadowRoot()) @@ -1055,7 +1111,7 @@ void StyleEngine::ScheduleTypeRuleSetInvalidations( if (invalidation_set->InvalidatesTagName(host)) { host.SetNeedsStyleRecalc(kLocalStyleChange, StyleChangeReasonForTracing::Create( - StyleChangeReason::kStyleSheetChange)); + style_change_reason::kStyleSheetChange)); return; } } @@ -1088,7 +1144,7 @@ void StyleEngine::InvalidateSlottedElements(HTMLSlotElement& slot) { if (node->IsElementNode()) { node->SetNeedsStyleRecalc(kLocalStyleChange, StyleChangeReasonForTracing::Create( - StyleChangeReason::kStyleSheetChange)); + style_change_reason::kStyleSheetChange)); } } } @@ -1204,7 +1260,7 @@ void StyleEngine::InitialStyleChanged() { GetDocument().SetNeedsStyleRecalc( kSubtreeStyleChange, - StyleChangeReasonForTracing::Create(StyleChangeReason::kSettings)); + StyleChangeReasonForTracing::Create(style_change_reason::kSettings)); } void StyleEngine::InitialViewportChanged() { @@ -1238,8 +1294,9 @@ void StyleEngine::HtmlImportAddedOrRemoved() { MarkDocumentDirty(); resolver->SetNeedsAppendAllSheets(); GetDocument().SetNeedsStyleRecalc( - kSubtreeStyleChange, StyleChangeReasonForTracing::Create( - StyleChangeReason::kActiveStylesheetsUpdate)); + kSubtreeStyleChange, + StyleChangeReasonForTracing::Create( + style_change_reason::kActiveStylesheetsUpdate)); } } @@ -1257,7 +1314,9 @@ namespace { enum RuleSetFlags { kFontFaceRules = 1 << 0, kKeyframesRules = 1 << 1, - kFullRecalcRules = 1 << 2 + kFullRecalcRules = 1 << 2, + kFontFeatureValuesRules = 1 << 3, + kFontRules = kFontFaceRules | kFontFeatureValuesRules, }; unsigned GetRuleSetFlags(const HeapHashSet<Member<RuleSet>> rule_sets) { @@ -1270,6 +1329,8 @@ unsigned GetRuleSetFlags(const HeapHashSet<Member<RuleSet>> rule_sets) { flags |= kFontFaceRules; if (rule_set->NeedsFullRecalcForRuleSetInvalidation()) flags |= kFullRecalcRules; + if (!rule_set->FontFeatureValuesRules().IsEmpty()) + flags |= kFontFeatureValuesRules; } return flags; } @@ -1287,8 +1348,9 @@ void StyleEngine::InvalidateForRuleSetChanges( if (!tree_scope.GetDocument().body() || tree_scope.GetDocument().HasNodesWithPlaceholderStyle()) { tree_scope.GetDocument().SetNeedsStyleRecalc( - kSubtreeStyleChange, StyleChangeReasonForTracing::Create( - StyleChangeReason::kCleanupPlaceholderStyles)); + kSubtreeStyleChange, + StyleChangeReasonForTracing::Create( + style_change_reason::kCleanupPlaceholderStyles)); return; } @@ -1304,8 +1366,9 @@ void StyleEngine::InvalidateForRuleSetChanges( ((changed_rule_flags & kFontFaceRules) && tree_scope.RootNode().IsDocumentNode())) { invalidation_root.SetNeedsStyleRecalc( - kSubtreeStyleChange, StyleChangeReasonForTracing::Create( - StyleChangeReason::kActiveStylesheetsUpdate)); + kSubtreeStyleChange, + StyleChangeReasonForTracing::Create( + style_change_reason::kActiveStylesheetsUpdate)); return; } @@ -1313,6 +1376,10 @@ void StyleEngine::InvalidateForRuleSetChanges( invalidation_scope); } +void StyleEngine::InvalidateInitialData() { + initial_data_ = nullptr; +} + void StyleEngine::ApplyUserRuleSetChanges( const ActiveStyleSheetVector& old_style_sheets, const ActiveStyleSheetVector& new_style_sheets) { @@ -1330,7 +1397,7 @@ void StyleEngine::ApplyUserRuleSetChanges( global_rule_set_->MarkDirty(); unsigned changed_rule_flags = GetRuleSetFlags(changed_rule_sets); - if (changed_rule_flags & kFontFaceRules) { + if (changed_rule_flags & kFontRules) { if (ScopedStyleResolver* scoped_resolver = GetDocument().GetScopedStyleResolver()) { // User style and document scope author style shares the font cache. If @@ -1351,7 +1418,7 @@ void StyleEngine::ApplyUserRuleSetChanges( for (auto* it = new_style_sheets.begin(); it != new_style_sheets.end(); it++) { DCHECK(it->second); - AddKeyframeRules(*it->second); + AddUserKeyframeRules(*it->second); } ScopedStyleResolver::KeyframesRulesAdded(GetDocument()); } @@ -1374,7 +1441,7 @@ void StyleEngine::ApplyRuleSetChanges( unsigned changed_rule_flags = GetRuleSetFlags(changed_rule_sets); bool rebuild_font_cache = change == kActiveSheetsChanged && - (changed_rule_flags & kFontFaceRules) && + (changed_rule_flags & kFontRules) && tree_scope.RootNode().IsDocumentNode(); ScopedStyleResolver* scoped_resolver = tree_scope.GetScopedStyleResolver(); if (scoped_resolver && scoped_resolver->NeedsAppendAllSheets()) { @@ -1422,9 +1489,9 @@ const MediaQueryEvaluator& StyleEngine::EnsureMediaQueryEvaluator() { if (!media_query_evaluator_) { if (GetDocument().GetFrame()) { media_query_evaluator_ = - new MediaQueryEvaluator(GetDocument().GetFrame()); + MakeGarbageCollected<MediaQueryEvaluator>(GetDocument().GetFrame()); } else { - media_query_evaluator_ = new MediaQueryEvaluator("all"); + media_query_evaluator_ = MakeGarbageCollected<MediaQueryEvaluator>("all"); } } return *media_query_evaluator_; @@ -1476,15 +1543,16 @@ void StyleEngine::CustomPropertyRegistered() { // TODO(timloh): Invalidate only elements with this custom property set GetDocument().SetNeedsStyleRecalc( kSubtreeStyleChange, StyleChangeReasonForTracing::Create( - StyleChangeReason::kPropertyRegistration)); + style_change_reason::kPropertyRegistration)); if (resolver_) resolver_->InvalidateMatchedPropertiesCache(); + InvalidateInitialData(); } void StyleEngine::EnvironmentVariableChanged() { GetDocument().SetNeedsStyleRecalc( kSubtreeStyleChange, StyleChangeReasonForTracing::Create( - StyleChangeReason::kPropertyRegistration)); + style_change_reason::kPropertyRegistration)); if (resolver_) resolver_->InvalidateMatchedPropertiesCache(); } @@ -1555,7 +1623,7 @@ void StyleEngine::CollectMatchingUserRules( } } -void StyleEngine::AddFontFaceRules(const RuleSet& rule_set) { +void StyleEngine::AddUserFontFaceRules(const RuleSet& rule_set) { if (!font_selector_) return; @@ -1569,14 +1637,14 @@ void StyleEngine::AddFontFaceRules(const RuleSet& rule_set) { resolver_->InvalidateMatchedPropertiesCache(); } -void StyleEngine::AddKeyframeRules(const RuleSet& rule_set) { +void StyleEngine::AddUserKeyframeRules(const RuleSet& rule_set) { const HeapVector<Member<StyleRuleKeyframes>> keyframes_rules = rule_set.KeyframesRules(); for (unsigned i = 0; i < keyframes_rules.size(); ++i) - AddKeyframeStyle(keyframes_rules[i]); + AddUserKeyframeStyle(keyframes_rules[i]); } -void StyleEngine::AddKeyframeStyle(StyleRuleKeyframes* rule) { +void StyleEngine::AddUserKeyframeStyle(StyleRuleKeyframes* rule) { AtomicString animation_name(rule->GetName()); if (rule->IsVendorPrefixed()) { @@ -1610,6 +1678,16 @@ DocumentStyleEnvironmentVariables& StyleEngine::EnsureEnvironmentVariables() { return *environment_variables_.get(); } +scoped_refptr<StyleInitialData> StyleEngine::MaybeCreateAndGetInitialData() { + if (initial_data_) + return initial_data_; + if (PropertyRegistry* registry = document_->GetPropertyRegistry()) { + if (registry->RegistrationCount()) + initial_data_ = StyleInitialData::Create(*registry); + } + return initial_data_; +} + void StyleEngine::RecalcStyle(StyleRecalcChange change) { DCHECK(GetDocument().documentElement()); DCHECK(GetDocument().ChildNeedsStyleRecalc() || change == kForce); diff --git a/chromium/third_party/blink/renderer/core/css/style_engine.h b/chromium/third_party/blink/renderer/core/css/style_engine.h index 0f8f464f23d..354d1c7cb62 100644 --- a/chromium/third_party/blink/renderer/core/css/style_engine.h +++ b/chromium/third_party/blink/renderer/core/css/style_engine.h @@ -38,6 +38,7 @@ #include "third_party/blink/renderer/core/css/active_style_sheets.h" #include "third_party/blink/renderer/core/css/css_global_rule_set.h" #include "third_party/blink/renderer/core/css/document_style_sheet_collection.h" +#include "third_party/blink/renderer/core/css/font_display.h" #include "third_party/blink/renderer/core/css/invalidation/pending_invalidations.h" #include "third_party/blink/renderer/core/css/invalidation/style_invalidator.h" #include "third_party/blink/renderer/core/css/layout_tree_rebuild_root.h" @@ -69,6 +70,7 @@ class DocumentStyleEnvironmentVariables; class StyleRuleFontFace; class StyleRuleUsageTracker; class StyleSheetContents; +class StyleInitialData; class ViewportStyleResolver; enum InvalidationScope { kInvalidateCurrentScope, kInvalidateAllScopes }; @@ -90,7 +92,10 @@ class CORE_EXPORT StyleEngine final public: IgnoringPendingStylesheet(StyleEngine& engine) - : scope_(&engine.ignore_pending_stylesheets_, true) {} + : scope_(&engine.ignore_pending_stylesheets_, + !RuntimeEnabledFeatures::CSSInBodyDoesNotBlockPaintEnabled()) { + } + private: base::AutoReset<bool> scope_; }; @@ -107,9 +112,10 @@ class CORE_EXPORT StyleEngine final }; static StyleEngine* Create(Document& document) { - return new StyleEngine(document); + return MakeGarbageCollected<StyleEngine>(document); } + StyleEngine(Document&); ~StyleEngine() override; const HeapVector<TraceWrapperMember<StyleSheet>>& @@ -268,8 +274,10 @@ class CORE_EXPORT StyleEngine final CollectUserStyleFeaturesTo(features); CollectScopedStyleFeaturesTo(features); for (CSSStyleSheet* sheet : custom_element_default_style_sheets_) { - if (sheet) - features.Add(RuleSetForSheet(*sheet)->Features()); + if (!sheet) + continue; + if (RuleSet* rule_set = RuleSetForSheet(*sheet)) + features.Add(rule_set->Features()); } } @@ -291,7 +299,7 @@ class CORE_EXPORT StyleEngine final Element&); void PseudoStateChangedForElement(CSSSelector::PseudoType, Element&); void PartChangedForElement(Element&); - void PartmapChangedForElement(Element&); + void ExportpartsChangedForElement(Element&); void ScheduleSiblingInvalidationsForElement(Element&, ContainerNode& scheduling_parent, @@ -342,6 +350,10 @@ class CORE_EXPORT StyleEngine final const AtomicString& animation_name); DocumentStyleEnvironmentVariables& EnsureEnvironmentVariables(); + void AddDefaultFontDisplay(const StyleRuleFontFeatureValues*); + FontDisplay GetDefaultFontDisplay(const AtomicString& family) const; + + scoped_refptr<StyleInitialData> MaybeCreateAndGetInitialData(); void RecalcStyle(StyleRecalcChange change); void RebuildLayoutTree(); @@ -355,7 +367,6 @@ class CORE_EXPORT StyleEngine final void FontsNeedUpdate(FontSelector*) override; private: - StyleEngine(Document&); bool NeedsActiveStyleSheetUpdate() const { return all_tree_scopes_dirty_ || tree_scopes_removed_ || document_scope_dirty_ || dirty_tree_scopes_.size() || @@ -420,6 +431,7 @@ class CORE_EXPORT StyleEngine final const HeapHashSet<Member<RuleSet>>& changed_rule_sets, unsigned changed_rule_flags, InvalidationScope invalidation_scope); + void InvalidateInitialData(); void UpdateViewport(); void UpdateActiveUserStyleSheets(); @@ -435,9 +447,9 @@ class CORE_EXPORT StyleEngine final void ClearFontCacheAndAddUserFonts(); void ClearKeyframeRules() { keyframes_rule_map_.clear(); } - void AddFontFaceRules(const RuleSet&); - void AddKeyframeRules(const RuleSet&); - void AddKeyframeStyle(StyleRuleKeyframes*); + void AddUserFontFaceRules(const RuleSet&); + void AddUserKeyframeRules(const RuleSet&); + void AddUserKeyframeStyle(StyleRuleKeyframes*); Member<Document> document_; bool is_master_; @@ -518,6 +530,12 @@ class CORE_EXPORT StyleEngine final scoped_refptr<DocumentStyleEnvironmentVariables> environment_variables_; + scoped_refptr<StyleInitialData> initial_data_; + + // Default font-display collected from @font-feature-values rules. The key is + // font-family. + HashMap<AtomicString, FontDisplay> default_font_display_map_; + friend class StyleEngineTest; }; diff --git a/chromium/third_party/blink/renderer/core/css/style_engine_test.cc b/chromium/third_party/blink/renderer/core/css/style_engine_test.cc index 2e11be19c9a..26cd17b201c 100644 --- a/chromium/third_party/blink/renderer/core/css/style_engine_test.cc +++ b/chromium/third_party/blink/renderer/core/css/style_engine_test.cc @@ -12,6 +12,7 @@ #include "third_party/blink/renderer/core/css/css_rule_list.h" #include "third_party/blink/renderer/core/css/css_style_rule.h" #include "third_party/blink/renderer/core/css/css_style_sheet.h" +#include "third_party/blink/renderer/core/css/css_test_helpers.h" #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "third_party/blink/renderer/core/css/style_sheet_contents.h" #include "third_party/blink/renderer/core/dom/document.h" @@ -23,6 +24,7 @@ #include "third_party/blink/renderer/core/frame/frame_test_helpers.h" #include "third_party/blink/renderer/core/frame/local_frame_view.h" #include "third_party/blink/renderer/core/frame/viewport_data.h" +#include "third_party/blink/renderer/core/html/html_collection.h" #include "third_party/blink/renderer/core/html/html_element.h" #include "third_party/blink/renderer/core/html/html_span_element.h" #include "third_party/blink/renderer/core/html/html_style_element.h" @@ -34,6 +36,8 @@ namespace blink { +using namespace css_test_helpers; + class StyleEngineTest : public testing::Test { protected: void SetUp() override; @@ -52,6 +56,12 @@ class StyleEngineTest : public testing::Test { RuleSetInvalidation ScheduleInvalidationsForRules(TreeScope&, const String& css_text); + // A wrapper to add a reason for UpdateAllLifecyclePhases + void UpdateAllLifecyclePhases() { + GetDocument().View()->UpdateAllLifecyclePhases( + DocumentLifecycle::LifecycleUpdateReason::kTest); + } + private: std::unique_ptr<DummyPageHolder> dummy_page_holder_; }; @@ -84,7 +94,7 @@ TEST_F(StyleEngineTest, DocumentDirtyAfterInject) { parsed_sheet->ParseString("div {}"); GetStyleEngine().InjectSheet("", parsed_sheet); EXPECT_FALSE(IsDocumentStyleSheetCollectionClean()); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); EXPECT_TRUE(IsDocumentStyleSheetCollectionClean()); } @@ -122,7 +132,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { <div id='t11'>White</div> <div></div> )HTML"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); Element* t1 = GetDocument().getElementById("t1"); Element* t2 = GetDocument().getElementById("t2"); @@ -151,7 +161,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { StyleSheetKey green_key("green"); GetStyleEngine().InjectSheet(green_key, green_parsed_sheet, WebDocument::kUserOrigin); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); EXPECT_EQ(3u, GetStyleEngine().StyleForElementCount() - initial_count); @@ -177,7 +187,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { StyleSheetKey blue_key("blue"); GetStyleEngine().InjectSheet(blue_key, blue_parsed_sheet, WebDocument::kUserOrigin); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); EXPECT_EQ(6u, GetStyleEngine().StyleForElementCount() - initial_count); @@ -197,7 +207,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { t3->GetComputedStyle()->VisitedDependentColor(GetCSSPropertyColor())); GetStyleEngine().RemoveInjectedSheet(green_key, WebDocument::kUserOrigin); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); EXPECT_EQ(9u, GetStyleEngine().StyleForElementCount() - initial_count); ASSERT_TRUE(t1->GetComputedStyle()); ASSERT_TRUE(t2->GetComputedStyle()); @@ -213,7 +223,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { t3->GetComputedStyle()->VisitedDependentColor(GetCSSPropertyColor())); GetStyleEngine().RemoveInjectedSheet(blue_key, WebDocument::kUserOrigin); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); EXPECT_EQ(12u, GetStyleEngine().StyleForElementCount() - initial_count); ASSERT_TRUE(t1->GetComputedStyle()); ASSERT_TRUE(t2->GetComputedStyle()); @@ -258,7 +268,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { StyleSheetKey font_face_key("font_face"); GetStyleEngine().InjectSheet(font_face_key, font_face_parsed_sheet, WebDocument::kUserOrigin); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); // After injecting a more specific font, now there are two and the // bold-italic one is selected. @@ -284,7 +294,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { " font-style: italic;" "}"); GetDocument().body()->AppendChild(style_element); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); // Now there are three fonts, but the newest one does not override the older, // better matching one. @@ -301,7 +311,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { FontSelectionRange({ItalicSlopeValue(), ItalicSlopeValue()})); GetStyleEngine().RemoveInjectedSheet(font_face_key, WebDocument::kUserOrigin); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); // After removing the injected style sheet we're left with a bold-normal and // a normal-italic font, and the latter is selected by the matching algorithm @@ -333,7 +343,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { StyleSheetKey keyframes_key("keyframes"); GetStyleEngine().InjectSheet(keyframes_key, keyframes_parsed_sheet, WebDocument::kUserOrigin); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); // After injecting the style sheet, a @keyframes rule named dummy-animation // is found with one keyframe. @@ -347,7 +357,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { style_element->SetInnerHTMLFromString( "@keyframes dummy-animation { from {} to {} }"); GetDocument().body()->AppendChild(style_element); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); // Author @keyframes rules take precedence; now there are two keyframes (from // and to). @@ -357,7 +367,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { EXPECT_EQ(2u, keyframes->Keyframes().size()); GetDocument().body()->RemoveChild(style_element); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); keyframes = GetStyleEngine().Resolver()->FindKeyframesRule( t5, AtomicString("dummy-animation")); @@ -365,7 +375,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { EXPECT_EQ(1u, keyframes->Keyframes().size()); GetStyleEngine().RemoveInjectedSheet(keyframes_key, WebDocument::kUserOrigin); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); // Injected @keyframes rules are no longer available once removed. ASSERT_FALSE(GetStyleEngine().Resolver()->FindKeyframesRule( @@ -396,7 +406,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { GetStyleEngine().InjectSheet(custom_properties_key, custom_properties_parsed_sheet, WebDocument::kUserOrigin); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); ASSERT_TRUE(t6->GetComputedStyle()); ASSERT_TRUE(t7->GetComputedStyle()); EXPECT_EQ(MakeRGB(255, 0, 0), t6->GetComputedStyle()->VisitedDependentColor( @@ -407,7 +417,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { GetStyleEngine().RemoveInjectedSheet(custom_properties_key, WebDocument::kUserOrigin); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); ASSERT_TRUE(t6->GetComputedStyle()); ASSERT_TRUE(t7->GetComputedStyle()); EXPECT_EQ(MakeRGB(0, 0, 0), t6->GetComputedStyle()->VisitedDependentColor( @@ -442,7 +452,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { GetStyleEngine().InjectSheet(media_queries_sheet_key, media_queries_parsed_sheet, WebDocument::kUserOrigin); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); ASSERT_TRUE(t8->GetComputedStyle()); EXPECT_EQ(MakeRGB(255, 0, 0), t8->GetComputedStyle()->VisitedDependentColor( GetCSSPropertyColor())); @@ -460,7 +470,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { GetStyleEngine().RemoveInjectedSheet(media_queries_sheet_key, WebDocument::kUserOrigin); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); ASSERT_TRUE(t8->GetComputedStyle()); EXPECT_EQ( MakeRGB(255, 255, 255), @@ -491,7 +501,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { StyleSheetKey author_sheet_key("author_sheet"); GetStyleEngine().InjectSheet(author_sheet_key, parsed_author_sheet, WebDocument::kAuthorOrigin); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); ASSERT_TRUE(t9->GetComputedStyle()); ASSERT_TRUE(t10->GetComputedStyle()); @@ -504,7 +514,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { GetStyleEngine().RemoveInjectedSheet(author_sheet_key, WebDocument::kAuthorOrigin); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); ASSERT_TRUE(t9->GetComputedStyle()); ASSERT_TRUE(t10->GetComputedStyle()); EXPECT_EQ(MakeRGB(255, 0, 0), t9->GetComputedStyle()->VisitedDependentColor( @@ -528,7 +538,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { GetStyleEngine().InjectSheet(removable_red_sheet_key, parsed_removable_red_sheet, WebDocument::kUserOrigin); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); ASSERT_TRUE(t11->GetComputedStyle()); EXPECT_EQ(MakeRGB(255, 0, 0), t11->GetComputedStyle()->VisitedDependentColor( @@ -542,7 +552,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { GetStyleEngine().InjectSheet(removable_green_sheet_key, parsed_removable_green_sheet, WebDocument::kUserOrigin); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); ASSERT_TRUE(t11->GetComputedStyle()); EXPECT_EQ(MakeRGB(0, 128, 0), t11->GetComputedStyle()->VisitedDependentColor( @@ -554,7 +564,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { GetStyleEngine().InjectSheet(removable_red_sheet_key, parsed_removable_red_sheet2, WebDocument::kUserOrigin); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); ASSERT_TRUE(t11->GetComputedStyle()); EXPECT_EQ(MakeRGB(255, 0, 0), t11->GetComputedStyle()->VisitedDependentColor( @@ -562,7 +572,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { GetStyleEngine().RemoveInjectedSheet(removable_red_sheet_key, WebDocument::kAuthorOrigin); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); ASSERT_TRUE(t11->GetComputedStyle()); // Removal works only within the same origin. @@ -571,7 +581,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { GetStyleEngine().RemoveInjectedSheet(removable_red_sheet_key, WebDocument::kUserOrigin); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); ASSERT_TRUE(t11->GetComputedStyle()); // The last sheet with the given key is removed. @@ -580,7 +590,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { GetStyleEngine().RemoveInjectedSheet(removable_green_sheet_key, WebDocument::kUserOrigin); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); ASSERT_TRUE(t11->GetComputedStyle()); // Only the last sheet with the given key is removed. @@ -589,7 +599,7 @@ TEST_F(StyleEngineTest, AnalyzedInject) { GetStyleEngine().RemoveInjectedSheet(removable_red_sheet_key, WebDocument::kUserOrigin); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); ASSERT_TRUE(t11->GetComputedStyle()); EXPECT_EQ( @@ -597,11 +607,44 @@ TEST_F(StyleEngineTest, AnalyzedInject) { t11->GetComputedStyle()->VisitedDependentColor(GetCSSPropertyColor())); } +TEST_F(StyleEngineTest, InjectedFontFace) { + GetDocument().body()->SetInnerHTMLFromString(R"HTML( + <style> + @font-face { + font-family: 'Author'; + src: url(user); + } + </style> + )HTML"); + UpdateAllLifecyclePhases(); + + FontDescription font_description; + FontFaceCache* cache = GetStyleEngine().GetFontSelector()->GetFontFaceCache(); + EXPECT_TRUE(cache->Get(font_description, "Author")); + EXPECT_FALSE(cache->Get(font_description, "User")); + + StyleSheetContents* user_sheet = + StyleSheetContents::Create(CSSParserContext::Create(GetDocument())); + user_sheet->ParseString( + "@font-face {" + " font-family: 'User';" + " src: url(author);" + "}"); + + StyleSheetKey user_key("user"); + GetStyleEngine().InjectSheet(user_key, user_sheet, WebDocument::kUserOrigin); + + UpdateAllLifecyclePhases(); + + EXPECT_TRUE(cache->Get(font_description, "Author")); + EXPECT_TRUE(cache->Get(font_description, "User")); +} + TEST_F(StyleEngineTest, IgnoreInvalidPropertyValue) { GetDocument().body()->SetInnerHTMLFromString( "<section><div id='t1'>Red</div></section>" "<style id='s1'>div { color: red; } section div#t1 { color:rgb(0"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); Element* t1 = GetDocument().getElementById("t1"); ASSERT_TRUE(t1); @@ -661,13 +704,13 @@ TEST_F(StyleEngineTest, RuleSetInvalidationTypeSelectors) { </i> )HTML"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); unsigned before_count = GetStyleEngine().StyleForElementCount(); EXPECT_EQ(kRuleSetInvalidationsScheduled, ScheduleInvalidationsForRules(GetDocument(), "span { background: green}")); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); unsigned after_count = GetStyleEngine().StyleForElementCount(); EXPECT_EQ(1u, after_count - before_count); @@ -675,20 +718,20 @@ TEST_F(StyleEngineTest, RuleSetInvalidationTypeSelectors) { EXPECT_EQ(kRuleSetInvalidationsScheduled, ScheduleInvalidationsForRules(GetDocument(), "body div { background: green}")); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); after_count = GetStyleEngine().StyleForElementCount(); EXPECT_EQ(2u, after_count - before_count); EXPECT_EQ(kRuleSetInvalidationFullRecalc, ScheduleInvalidationsForRules(GetDocument(), "div * { background: green}")); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); before_count = GetStyleEngine().StyleForElementCount(); EXPECT_EQ(kRuleSetInvalidationsScheduled, ScheduleInvalidationsForRules(GetDocument(), "#i b { background: green}")); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); after_count = GetStyleEngine().StyleForElementCount(); EXPECT_EQ(1u, after_count - before_count); } @@ -700,13 +743,13 @@ TEST_F(StyleEngineTest, RuleSetInvalidationCustomPseudo) { <div></div><div></div><div></div><div></div><div></div><div></div> )HTML"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); unsigned before_count = GetStyleEngine().StyleForElementCount(); EXPECT_EQ(ScheduleInvalidationsForRules( GetDocument(), "::-webkit-progress-bar { background: green }"), kRuleSetInvalidationsScheduled); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); unsigned after_count = GetStyleEngine().StyleForElementCount(); EXPECT_EQ(3u, after_count - before_count); } @@ -721,13 +764,13 @@ TEST_F(StyleEngineTest, RuleSetInvalidationHost) { host->AttachShadowRootInternal(ShadowRootType::kOpen); shadow_root.SetInnerHTMLFromString("<div></div><div></div><div></div>"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); unsigned before_count = GetStyleEngine().StyleForElementCount(); EXPECT_EQ(ScheduleInvalidationsForRules( shadow_root, ":host(#nohost), #nohost { background: green}"), kRuleSetInvalidationsScheduled); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); unsigned after_count = GetStyleEngine().StyleForElementCount(); EXPECT_EQ(0u, after_count - before_count); @@ -735,7 +778,7 @@ TEST_F(StyleEngineTest, RuleSetInvalidationHost) { EXPECT_EQ(ScheduleInvalidationsForRules(shadow_root, ":host(#host) { background: green}"), kRuleSetInvalidationsScheduled); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); after_count = GetStyleEngine().StyleForElementCount(); EXPECT_EQ(1u, after_count - before_count); EXPECT_EQ(ScheduleInvalidationsForRules(shadow_root, @@ -767,13 +810,13 @@ TEST_F(StyleEngineTest, RuleSetInvalidationSlotted) { host->AttachShadowRootInternal(ShadowRootType::kOpen); shadow_root.SetInnerHTMLFromString("<slot name=other></slot><slot></slot>"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); unsigned before_count = GetStyleEngine().StyleForElementCount(); EXPECT_EQ(ScheduleInvalidationsForRules( shadow_root, "::slotted(.s1) { background: green}"), kRuleSetInvalidationsScheduled); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); unsigned after_count = GetStyleEngine().StyleForElementCount(); EXPECT_EQ(4u, after_count - before_count); @@ -781,7 +824,7 @@ TEST_F(StyleEngineTest, RuleSetInvalidationSlotted) { EXPECT_EQ(ScheduleInvalidationsForRules(shadow_root, "::slotted(*) { background: green}"), kRuleSetInvalidationsScheduled); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); after_count = GetStyleEngine().StyleForElementCount(); EXPECT_EQ(4u, after_count - before_count); } @@ -796,13 +839,13 @@ TEST_F(StyleEngineTest, RuleSetInvalidationHostContext) { shadow_root.SetInnerHTMLFromString( "<div></div><div class=a></div><div></div>"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); unsigned before_count = GetStyleEngine().StyleForElementCount(); EXPECT_EQ(ScheduleInvalidationsForRules( shadow_root, ":host-context(.nomatch) .a { background: green}"), kRuleSetInvalidationsScheduled); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); unsigned after_count = GetStyleEngine().StyleForElementCount(); EXPECT_EQ(1u, after_count - before_count); @@ -824,7 +867,7 @@ TEST_F(StyleEngineTest, RuleSetInvalidationV0BoundaryCrossing) { shadow_root.SetInnerHTMLFromString( "<div></div><div class=a></div><div></div>"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); EXPECT_EQ(ScheduleInvalidationsForRules( shadow_root, ".a ::content span { background: green}"), @@ -843,15 +886,15 @@ TEST_F(StyleEngineTest, HasViewportDependentMediaQueries) { for (unsigned i = 0; i < 10; i++) { GetDocument().body()->RemoveChild(style_element); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); GetDocument().body()->AppendChild(style_element); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); } EXPECT_TRUE(GetStyleEngine().HasViewportDependentMediaQueries()); GetDocument().body()->RemoveChild(style_element); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); EXPECT_FALSE(GetStyleEngine().HasViewportDependentMediaQueries()); } @@ -860,7 +903,7 @@ TEST_F(StyleEngineTest, StyleMediaAttributeStyleChange) { GetDocument().body()->SetInnerHTMLFromString( "<style id='s1' media='(max-width: 1px)'>#t1 { color: green }</style>" "<div id='t1'>Green</div><div></div>"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); Element* t1 = GetDocument().getElementById("t1"); ASSERT_TRUE(t1); @@ -871,8 +914,8 @@ TEST_F(StyleEngineTest, StyleMediaAttributeStyleChange) { unsigned before_count = GetStyleEngine().StyleForElementCount(); Element* s1 = GetDocument().getElementById("s1"); - s1->setAttribute(blink::HTMLNames::mediaAttr, "(max-width: 2000px)"); - GetDocument().View()->UpdateAllLifecyclePhases(); + s1->setAttribute(blink::html_names::kMediaAttr, "(max-width: 2000px)"); + UpdateAllLifecyclePhases(); unsigned after_count = GetStyleEngine().StyleForElementCount(); EXPECT_EQ(1u, after_count - before_count); @@ -886,7 +929,7 @@ TEST_F(StyleEngineTest, StyleMediaAttributeNoStyleChange) { GetDocument().body()->SetInnerHTMLFromString( "<style id='s1' media='(max-width: 1000px)'>#t1 { color: green }</style>" "<div id='t1'>Green</div><div></div>"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); Element* t1 = GetDocument().getElementById("t1"); ASSERT_TRUE(t1); @@ -897,8 +940,8 @@ TEST_F(StyleEngineTest, StyleMediaAttributeNoStyleChange) { unsigned before_count = GetStyleEngine().StyleForElementCount(); Element* s1 = GetDocument().getElementById("s1"); - s1->setAttribute(blink::HTMLNames::mediaAttr, "(max-width: 2000px)"); - GetDocument().View()->UpdateAllLifecyclePhases(); + s1->setAttribute(blink::html_names::kMediaAttr, "(max-width: 2000px)"); + UpdateAllLifecyclePhases(); unsigned after_count = GetStyleEngine().StyleForElementCount(); EXPECT_EQ(0u, after_count - before_count); @@ -917,7 +960,7 @@ TEST_F(StyleEngineTest, ModifyStyleRuleMatchedPropertiesCache) { GetDocument().body()->SetInnerHTMLFromString( "<style id='s1'>#t1 { color: blue }</style>" "<div id='t1'>Green</div>"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); Element* t1 = GetDocument().getElementById("t1"); ASSERT_TRUE(t1); @@ -940,7 +983,7 @@ TEST_F(StyleEngineTest, ModifyStyleRuleMatchedPropertiesCache) { // hash value will be the same. style_rule->style()->setProperty(&GetDocument(), "color", "red", "", ASSERT_NO_EXCEPTION); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); ASSERT_TRUE(t1->GetComputedStyle()); EXPECT_EQ(MakeRGB(255, 0, 0), t1->GetComputedStyle()->VisitedDependentColor( @@ -948,7 +991,7 @@ TEST_F(StyleEngineTest, ModifyStyleRuleMatchedPropertiesCache) { style_rule->style()->setProperty(&GetDocument(), "color", "green", "", ASSERT_NO_EXCEPTION); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); ASSERT_TRUE(t1->GetComputedStyle()); EXPECT_EQ(MakeRGB(0, 128, 0), t1->GetComputedStyle()->VisitedDependentColor( @@ -962,7 +1005,7 @@ TEST_F(StyleEngineTest, VisitedExplicitInheritanceMatchedPropertiesCache) { </style> <span id="span"><a href></a></span> )HTML"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); Element* span = GetDocument().getElementById("span"); const ComputedStyle* style = span->GetComputedStyle(); @@ -974,7 +1017,7 @@ TEST_F(StyleEngineTest, VisitedExplicitInheritanceMatchedPropertiesCache) { span->SetInlineStyleProperty(CSSPropertyColor, "blue"); // Should not DCHECK on applying overflow:inherit on cached matched properties - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); } TEST_F(StyleEngineTest, ScheduleInvalidationAfterSubtreeRecalc) { @@ -987,7 +1030,7 @@ TEST_F(StyleEngineTest, ScheduleInvalidationAfterSubtreeRecalc) { <div id='t1'></div> <div id='t2'></div> )HTML"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); Element* t1 = GetDocument().getElementById("t1"); Element* t2 = GetDocument().getElementById("t2"); @@ -995,12 +1038,12 @@ TEST_F(StyleEngineTest, ScheduleInvalidationAfterSubtreeRecalc) { ASSERT_TRUE(t2); // Sanity test. - t1->setAttribute(blink::HTMLNames::classAttr, "t1"); + t1->setAttribute(blink::html_names::kClassAttr, "t1"); EXPECT_FALSE(GetDocument().NeedsStyleInvalidation()); EXPECT_TRUE(GetDocument().ChildNeedsStyleInvalidation()); EXPECT_TRUE(t1->NeedsStyleInvalidation()); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); // platformColorsChanged() triggers SubtreeStyleChange on document(). If that // for some reason should change, this test will start failing and the @@ -1011,11 +1054,11 @@ TEST_F(StyleEngineTest, ScheduleInvalidationAfterSubtreeRecalc) { // Check that no invalidations sets are scheduled when the document node is // already SubtreeStyleChange. - t2->setAttribute(blink::HTMLNames::classAttr, "t2"); + t2->setAttribute(blink::html_names::kClassAttr, "t2"); EXPECT_FALSE(GetDocument().NeedsStyleInvalidation()); EXPECT_FALSE(GetDocument().ChildNeedsStyleInvalidation()); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); HTMLStyleElement* s2 = ToHTMLStyleElement(GetDocument().getElementById("s2")); ASSERT_TRUE(s2); s2->setDisabled(true); @@ -1023,14 +1066,14 @@ TEST_F(StyleEngineTest, ScheduleInvalidationAfterSubtreeRecalc) { EXPECT_FALSE(GetDocument().ChildNeedsStyleInvalidation()); EXPECT_TRUE(GetDocument().NeedsStyleInvalidation()); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); GetStyleEngine().PlatformColorsChanged(); s2->setDisabled(false); GetStyleEngine().UpdateActiveStyle(); EXPECT_FALSE(GetDocument().ChildNeedsStyleInvalidation()); EXPECT_FALSE(GetDocument().NeedsStyleInvalidation()); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); HTMLStyleElement* s1 = ToHTMLStyleElement(GetDocument().getElementById("s1")); ASSERT_TRUE(s1); s1->setDisabled(true); @@ -1040,7 +1083,7 @@ TEST_F(StyleEngineTest, ScheduleInvalidationAfterSubtreeRecalc) { EXPECT_TRUE(t1->NeedsStyleInvalidation()); EXPECT_TRUE(t2->NeedsStyleInvalidation()); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); GetStyleEngine().PlatformColorsChanged(); s1->setDisabled(false); GetStyleEngine().UpdateActiveStyle(); @@ -1055,7 +1098,7 @@ TEST_F(StyleEngineTest, NoScheduledRuleSetInvalidationsOnNewShadow) { Element* host = GetDocument().getElementById("host"); ASSERT_TRUE(host); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); @@ -1076,7 +1119,7 @@ TEST_F(StyleEngineTest, NoScheduledRuleSetInvalidationsOnNewShadow) { TEST_F(StyleEngineTest, EmptyHttpEquivDefaultStyle) { GetDocument().body()->SetInnerHTMLFromString( "<style>div { color:pink }</style><div id=container></div>"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); EXPECT_FALSE(GetStyleEngine().NeedsActiveStyleUpdate()); @@ -1120,7 +1163,7 @@ TEST_F(StyleEngineTest, StyleSheetsForStyleSheetList_ShadowRoot) { Element* host = GetDocument().getElementById("host"); ASSERT_TRUE(host); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); ShadowRoot& shadow_root = host->AttachShadowRootInternal(ShadowRootType::kOpen); @@ -1146,7 +1189,7 @@ TEST_F(StyleEngineTest, StyleSheetsForStyleSheetList_ShadowRoot) { EXPECT_FALSE(GetStyleEngine().NeedsActiveStyleUpdate()); } -class StyleEngineClient : public FrameTestHelpers::TestWebViewClient { +class StyleEngineClient : public frame_test_helpers::TestWebViewClient { public: StyleEngineClient() : device_scale_factor_(1.f) {} void ConvertWindowToViewport(WebFloatRect* rect) override { @@ -1167,10 +1210,11 @@ TEST_F(StyleEngineTest, ViewportDescriptionForZoomDSF) { StyleEngineClient client; client.set_device_scale_factor(1.f); - FrameTestHelpers::WebViewHelper web_view_helper; + frame_test_helpers::WebViewHelper web_view_helper; WebViewImpl* web_view_impl = web_view_helper.Initialize(nullptr, &client, nullptr, nullptr); - web_view_impl->UpdateAllLifecyclePhases(); + web_view_impl->MainFrameWidget()->UpdateAllLifecyclePhases( + WebWidget::LifecycleUpdateReason::kTest); Document* document = ToLocalFrame(web_view_impl->GetPage()->MainFrame())->GetDocument(); @@ -1183,7 +1227,8 @@ TEST_F(StyleEngineTest, ViewportDescriptionForZoomDSF) { const float device_scale = 3.5f; client.set_device_scale_factor(device_scale); - web_view_impl->UpdateAllLifecyclePhases(); + web_view_impl->MainFrameWidget()->UpdateAllLifecyclePhases( + WebWidget::LifecycleUpdateReason::kTest); desc = document->GetViewportData().GetViewportDescription(); EXPECT_FLOAT_EQ(device_scale * min_width, desc.min_width.GetFloatValue()); @@ -1195,7 +1240,7 @@ TEST_F(StyleEngineTest, ViewportDescriptionForZoomDSF) { TEST_F(StyleEngineTest, MediaQueryAffectingValueChanged_StyleElementNoMedia) { GetDocument().body()->SetInnerHTMLFromString( "<style>div{color:pink}</style>"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); GetStyleEngine().MediaQueryAffectingValueChanged(); EXPECT_FALSE(GetStyleEngine().NeedsActiveStyleUpdate()); } @@ -1204,7 +1249,7 @@ TEST_F(StyleEngineTest, MediaQueryAffectingValueChanged_StyleElementMediaNoValue) { GetDocument().body()->SetInnerHTMLFromString( "<style media>div{color:pink}</style>"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); GetStyleEngine().MediaQueryAffectingValueChanged(); EXPECT_FALSE(GetStyleEngine().NeedsActiveStyleUpdate()); } @@ -1213,7 +1258,7 @@ TEST_F(StyleEngineTest, MediaQueryAffectingValueChanged_StyleElementMediaEmpty) { GetDocument().body()->SetInnerHTMLFromString( "<style media=''>div{color:pink}</style>"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); GetStyleEngine().MediaQueryAffectingValueChanged(); EXPECT_FALSE(GetStyleEngine().NeedsActiveStyleUpdate()); } @@ -1226,7 +1271,7 @@ TEST_F(StyleEngineTest, MediaQueryAffectingValueChanged_StyleElementMediaNoValid) { GetDocument().body()->SetInnerHTMLFromString( "<style media=',,'>div{color:pink}</style>"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); GetStyleEngine().MediaQueryAffectingValueChanged(); EXPECT_TRUE(GetStyleEngine().NeedsActiveStyleUpdate()); } @@ -1234,7 +1279,7 @@ TEST_F(StyleEngineTest, TEST_F(StyleEngineTest, MediaQueryAffectingValueChanged_StyleElementMediaAll) { GetDocument().body()->SetInnerHTMLFromString( "<style media='all'>div{color:pink}</style>"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); GetStyleEngine().MediaQueryAffectingValueChanged(); EXPECT_TRUE(GetStyleEngine().NeedsActiveStyleUpdate()); } @@ -1243,7 +1288,7 @@ TEST_F(StyleEngineTest, MediaQueryAffectingValueChanged_StyleElementMediaNotAll) { GetDocument().body()->SetInnerHTMLFromString( "<style media='not all'>div{color:pink}</style>"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); GetStyleEngine().MediaQueryAffectingValueChanged(); EXPECT_TRUE(GetStyleEngine().NeedsActiveStyleUpdate()); } @@ -1251,7 +1296,7 @@ TEST_F(StyleEngineTest, TEST_F(StyleEngineTest, MediaQueryAffectingValueChanged_StyleElementMediaType) { GetDocument().body()->SetInnerHTMLFromString( "<style media='print'>div{color:pink}</style>"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); GetStyleEngine().MediaQueryAffectingValueChanged(); EXPECT_TRUE(GetStyleEngine().NeedsActiveStyleUpdate()); } @@ -1267,7 +1312,7 @@ TEST_F(StyleEngineTest, EmptyPseudo_RemoveLast) { <span></span> )HTML"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); Element* t1 = GetDocument().getElementById("t1"); t1->firstChild()->remove(); @@ -1289,7 +1334,7 @@ TEST_F(StyleEngineTest, EmptyPseudo_RemoveNotLast) { <span></span> )HTML"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); Element* t1 = GetDocument().getElementById("t1"); t1->firstChild()->remove(); @@ -1311,7 +1356,7 @@ TEST_F(StyleEngineTest, EmptyPseudo_InsertFirst) { <span></span> )HTML"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); Element* t1 = GetDocument().getElementById("t1"); t1->appendChild(Text::Create(GetDocument(), "Text")); @@ -1333,7 +1378,7 @@ TEST_F(StyleEngineTest, EmptyPseudo_InsertNotFirst) { <span></span> )HTML"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); Element* t1 = GetDocument().getElementById("t1"); t1->appendChild(Text::Create(GetDocument(), "Text")); @@ -1363,7 +1408,7 @@ TEST_F(StyleEngineTest, EmptyPseudo_ModifyTextData_SingleNode) { t2->appendChild(Text::Create(GetDocument(), "")); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); ToText(t1->firstChild())->setData(""); EXPECT_TRUE(t1->NeedsStyleInvalidation()); @@ -1396,7 +1441,7 @@ TEST_F(StyleEngineTest, EmptyPseudo_ModifyTextData_HasSiblings) { t2->appendChild(Text::Create(GetDocument(), "")); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); ToText(t1->firstChild())->setData(""); EXPECT_FALSE(t1->NeedsStyleInvalidation()); @@ -1419,13 +1464,13 @@ TEST_F(StyleEngineTest, MediaQueriesChangeDefaultFontSize) { <body></body> )HTML"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); EXPECT_EQ(MakeRGB(255, 0, 0), GetDocument().body()->GetComputedStyle()->VisitedDependentColor( GetCSSPropertyColor())); GetDocument().GetSettings()->SetDefaultFontSize(40); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); EXPECT_EQ(MakeRGB(0, 128, 0), GetDocument().body()->GetComputedStyle()->VisitedDependentColor( GetCSSPropertyColor())); @@ -1445,12 +1490,12 @@ TEST_F(StyleEngineTest, ShadowRootStyleRecalcCrash) { :nth-child(odd) { color: green } </style> )HTML"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); // This should not cause DCHECK errors on style recalc flags. shadow_root.getElementById("span")->remove(); host->SetInlineStyleProperty(CSSPropertyDisplay, "inline"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); } TEST_F(StyleEngineTest, GetComputedStyleOutsideFlatTreeCrash) { @@ -1463,11 +1508,11 @@ TEST_F(StyleEngineTest, GetComputedStyleOutsideFlatTreeCrash) { )HTML"); GetDocument().documentElement()->CreateV0ShadowRootForTesting(); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); GetDocument().body()->EnsureComputedStyle(); GetDocument().getElementById("inner")->SetInlineStyleProperty( CSSPropertyColor, "blue"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); } TEST_F(StyleEngineTest, RejectSelectorForPseudoElement) { @@ -1478,7 +1523,7 @@ TEST_F(StyleEngineTest, RejectSelectorForPseudoElement) { </style> <div class='not-in-filter'></div> )HTML"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); StyleEngine& engine = GetStyleEngine(); engine.SetStatsEnabled(true); @@ -1509,7 +1554,7 @@ TEST_F(StyleEngineTest, MarkForWhitespaceReattachment) { Element* d2 = GetDocument().getElementById("d2"); Element* d3 = GetDocument().getElementById("d3"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); d1->firstChild()->remove(); EXPECT_TRUE(GetStyleEngine().NeedsWhitespaceReattachment(d1)); @@ -1520,7 +1565,7 @@ TEST_F(StyleEngineTest, MarkForWhitespaceReattachment) { GetStyleEngine().MarkForWhitespaceReattachment(); EXPECT_FALSE(GetDocument().ChildNeedsReattachLayoutTree()); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); d2->firstChild()->remove(); d2->firstChild()->remove(); @@ -1532,7 +1577,7 @@ TEST_F(StyleEngineTest, MarkForWhitespaceReattachment) { GetStyleEngine().MarkForWhitespaceReattachment(); EXPECT_FALSE(GetDocument().ChildNeedsReattachLayoutTree()); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); d3->firstChild()->remove(); EXPECT_TRUE(GetStyleEngine().NeedsWhitespaceReattachment(d3)); @@ -1551,7 +1596,7 @@ TEST_F(StyleEngineTest, FirstLetterRemoved) { <div class=fl id=d2><div><span id=f2>BB</span></div></div> <div class=fl id=d3><div><span id=f3>C<!---->C</span></div></div> )HTML"); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); Element* d1 = GetDocument().getElementById("d1"); Element* d2 = GetDocument().getElementById("d2"); @@ -1569,7 +1614,7 @@ TEST_F(StyleEngineTest, FirstLetterRemoved) { EXPECT_TRUE(d1->ChildNeedsStyleRecalc()); EXPECT_TRUE(fl1->NeedsStyleRecalc()); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); EXPECT_FALSE( ToFirstLetterPseudoElement(d1->GetPseudoElement(kPseudoIdFirstLetter))); @@ -1585,7 +1630,7 @@ TEST_F(StyleEngineTest, FirstLetterRemoved) { EXPECT_TRUE(d2->ChildNeedsStyleRecalc()); EXPECT_TRUE(fl2->NeedsStyleRecalc()); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); EXPECT_FALSE( ToFirstLetterPseudoElement(d2->GetPseudoElement(kPseudoIdFirstLetter))); @@ -1602,11 +1647,73 @@ TEST_F(StyleEngineTest, FirstLetterRemoved) { EXPECT_TRUE(d3->ChildNeedsStyleRecalc()); EXPECT_TRUE(fl3->NeedsStyleRecalc()); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhases(); fl3 = ToFirstLetterPseudoElement(d3->GetPseudoElement(kPseudoIdFirstLetter)); EXPECT_TRUE(fl3); EXPECT_EQ(f3->lastChild()->GetLayoutObject(), fl3->RemainingTextLayoutObject()); } +TEST_F(StyleEngineTest, InitialDataCreation) { + UpdateAllLifecyclePhases(); + + // There should be no initial data if nothing is registered. + EXPECT_FALSE(GetStyleEngine().MaybeCreateAndGetInitialData()); + + // After registering, there should be initial data. + RegisterProperty(GetDocument(), "--x", "<length>", "10px", false); + auto data1 = GetStyleEngine().MaybeCreateAndGetInitialData(); + EXPECT_TRUE(data1); + + // After a full recalc, we should have the same initial data. + GetDocument().body()->SetInnerHTMLFromString( + "<style>* { font-size: 1px; } </style>"); + EXPECT_TRUE(GetDocument().NeedsStyleRecalc()); + EXPECT_TRUE(GetDocument().ChildNeedsStyleRecalc()); + UpdateAllLifecyclePhases(); + auto data2 = GetStyleEngine().MaybeCreateAndGetInitialData(); + EXPECT_TRUE(data2); + EXPECT_EQ(data1, data2); + + // After registering a new property, initial data should be invalidated, + // such that the new initial data is different. + RegisterProperty(GetDocument(), "--y", "<color>", "black", false); + EXPECT_NE(data1, GetStyleEngine().MaybeCreateAndGetInitialData()); +} + +TEST_F(StyleEngineTest, CSSSelectorEmptyWhitespaceOnlyFail) { + GetDocument().body()->SetInnerHTMLFromString(R"HTML( + <style>.match:empty { background-color: red }</style> + <div></div> + <div> <span></span></div> + <div> <!-- -->X</div> + <div></div> + <div> <!-- --></div> + )HTML"); + GetDocument().View()->UpdateAllLifecyclePhases( + DocumentLifecycle::LifecycleUpdateReason::kTest); + + EXPECT_FALSE(UseCounter::IsCounted( + GetDocument(), WebFeature::kCSSSelectorEmptyWhitespaceOnlyFail)); + + auto* div_elements = GetDocument().getElementsByTagName("div"); + ASSERT_TRUE(div_elements); + ASSERT_EQ(5u, div_elements->length()); + + auto is_counted = [](Element* element) { + element->setAttribute(blink::html_names::kClassAttr, "match"); + element->GetDocument().View()->UpdateAllLifecyclePhases( + DocumentLifecycle::LifecycleUpdateReason::kTest); + return UseCounter::IsCounted( + element->GetDocument(), + WebFeature::kCSSSelectorEmptyWhitespaceOnlyFail); + }; + + EXPECT_FALSE(is_counted(div_elements->item(0))); + EXPECT_FALSE(is_counted(div_elements->item(1))); + EXPECT_FALSE(is_counted(div_elements->item(2))); + EXPECT_FALSE(is_counted(div_elements->item(3))); + EXPECT_TRUE(is_counted(div_elements->item(4))); +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/style_environment_variables_test.cc b/chromium/third_party/blink/renderer/core/css/style_environment_variables_test.cc index 455df4b9044..1979b42a684 100644 --- a/chromium/third_party/blink/renderer/core/css/style_environment_variables_test.cc +++ b/chromium/third_party/blink/renderer/core/css/style_environment_variables_test.cc @@ -41,8 +41,6 @@ class StyleEnvironmentVariablesTest : public PageTestBase { void SetUp() override { PageTestBase::SetUp(); - RuntimeEnabledFeatures::SetCSSEnvironmentVariablesEnabled(true); - // Needed for RecordUseCounter_IgnoreMediaControls. RuntimeEnabledFeatures::SetModernMediaControlsEnabled(true); } @@ -58,7 +56,8 @@ class StyleEnvironmentVariablesTest : public PageTestBase { void InitializeWithHTML(LocalFrame& frame, const String& html_content) { // Sets the inner html and runs the document lifecycle. frame.GetDocument()->body()->SetInnerHTMLFromString(html_content); - frame.GetDocument()->View()->UpdateAllLifecyclePhases(); + frame.GetDocument()->View()->UpdateAllLifecyclePhases( + DocumentLifecycle::LifecycleUpdateReason::kTest); } void InitializeTestPageWithVariableNamed(LocalFrame& frame, @@ -105,7 +104,7 @@ TEST_F(StyleEnvironmentVariablesTest, DocumentVariable_AfterLoad) { // Ensure that the document has been invalidated. EXPECT_TRUE(GetDocument().NeedsLayoutTreeUpdate()); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); // Check that the element has the background color provided by the variable. Element* target = GetDocument().getElementById("target"); @@ -122,7 +121,7 @@ TEST_F(StyleEnvironmentVariablesTest, DocumentVariable_Change) { // Ensure that the document has been invalidated. EXPECT_TRUE(GetDocument().NeedsLayoutTreeUpdate()); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); // Check that the element has the background color provided by the variable. Element* target = GetDocument().getElementById("target"); @@ -148,7 +147,7 @@ TEST_F(StyleEnvironmentVariablesTest, // Ensure that the document has been invalidated. EXPECT_TRUE(GetDocument().NeedsLayoutTreeUpdate()); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); // Check that the element has the background color provided by the document // variable. @@ -160,7 +159,7 @@ TEST_F(StyleEnvironmentVariablesTest, // Ensure that the document has been invalidated. EXPECT_TRUE(GetDocument().NeedsLayoutTreeUpdate()); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); // Check that the element has the background color provided by the global // variable. @@ -185,7 +184,7 @@ TEST_F(StyleEnvironmentVariablesTest, DocumentVariable_Override_RemoveGlobal) { // Ensure that the document has been invalidated. EXPECT_TRUE(GetDocument().NeedsLayoutTreeUpdate()); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); // Check that the element has the background color provided by the document // variable. @@ -223,7 +222,7 @@ TEST_F(StyleEnvironmentVariablesTest, DocumentVariable_Remove) { // Ensure that the document has been invalidated. EXPECT_TRUE(GetDocument().NeedsLayoutTreeUpdate()); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); // Check that the element does not have the background color any more. EXPECT_NE(kTestColorRed, target->ComputedStyleRef().VisitedDependentColor( @@ -241,7 +240,8 @@ TEST_F(StyleEnvironmentVariablesTest, MultiDocumentInvalidation_FromRoot) { // Create an empty page that does not use the variable. std::unique_ptr<DummyPageHolder> empty_page = DummyPageHolder::Create(IntSize(800, 600)); - empty_page->GetDocument().View()->UpdateAllLifecyclePhases(); + empty_page->GetDocument().View()->UpdateAllLifecyclePhases( + DocumentLifecycle::LifecycleUpdateReason::kTest); StyleEnvironmentVariables::GetRootInstance().SetVariable(kVariableName, kVariableTestColor); @@ -287,7 +287,7 @@ TEST_F(StyleEnvironmentVariablesTest, GlobalVariable_AfterLoad) { // Ensure that the document has been invalidated. EXPECT_TRUE(GetDocument().NeedsLayoutTreeUpdate()); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); // Check that the element has the background color provided by the variable. Element* target = GetDocument().getElementById("target"); @@ -306,7 +306,7 @@ TEST_F(StyleEnvironmentVariablesTest, GlobalVariable_Change) { // Ensure that the document has been invalidated. EXPECT_TRUE(GetDocument().NeedsLayoutTreeUpdate()); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); // Check that the element has the background color provided by the variable. Element* target = GetDocument().getElementById("target"); @@ -355,7 +355,7 @@ TEST_F(StyleEnvironmentVariablesTest, GlobalVariable_Remove) { // Ensure that the document has been invalidated. EXPECT_TRUE(GetDocument().NeedsLayoutTreeUpdate()); - GetDocument().View()->UpdateAllLifecyclePhases(); + UpdateAllLifecyclePhasesForTest(); // Check that the element does not have the background color any more. EXPECT_NE(kTestColorRed, target->ComputedStyleRef().VisitedDependentColor( diff --git a/chromium/third_party/blink/renderer/core/css/style_media.h b/chromium/third_party/blink/renderer/core/css/style_media.h index f5385febe4b..546e6897053 100644 --- a/chromium/third_party/blink/renderer/core/css/style_media.h +++ b/chromium/third_party/blink/renderer/core/css/style_media.h @@ -41,15 +41,16 @@ class StyleMedia final : public ScriptWrappable, public ContextClient { USING_GARBAGE_COLLECTED_MIXIN(StyleMedia); public: - static StyleMedia* Create(LocalFrame* frame) { return new StyleMedia(frame); } + static StyleMedia* Create(LocalFrame* frame) { + return MakeGarbageCollected<StyleMedia>(frame); + } + + explicit StyleMedia(LocalFrame*); AtomicString type() const; bool matchMedium(const String&) const; void Trace(blink::Visitor*) override; - - private: - explicit StyleMedia(LocalFrame*); }; } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/style_rule.cc b/chromium/third_party/blink/renderer/core/css/style_rule.cc index 4235e4dabd6..6ca909b749e 100644 --- a/chromium/third_party/blink/renderer/core/css/style_rule.cc +++ b/chromium/third_party/blink/renderer/core/css/style_rule.cc @@ -22,6 +22,8 @@ #include "third_party/blink/renderer/core/css/style_rule.h" #include "third_party/blink/renderer/core/css/css_font_face_rule.h" +#include "third_party/blink/renderer/core/css/css_font_feature_values_rule.h" +#include "third_party/blink/renderer/core/css/css_identifier_value.h" #include "third_party/blink/renderer/core/css/css_import_rule.h" #include "third_party/blink/renderer/core/css/css_keyframes_rule.h" #include "third_party/blink/renderer/core/css/css_media_rule.h" @@ -29,6 +31,7 @@ #include "third_party/blink/renderer/core/css/css_page_rule.h" #include "third_party/blink/renderer/core/css/css_style_rule.h" #include "third_party/blink/renderer/core/css/css_supports_rule.h" +#include "third_party/blink/renderer/core/css/css_value_list.h" #include "third_party/blink/renderer/core/css/css_viewport_rule.h" #include "third_party/blink/renderer/core/css/style_rule_import.h" #include "third_party/blink/renderer/core/css/style_rule_keyframe.h" @@ -87,6 +90,9 @@ void StyleRuleBase::Trace(blink::Visitor* visitor) { case kViewport: ToStyleRuleViewport(this)->TraceAfterDispatch(visitor); return; + case kFontFeatureValues: + ToStyleRuleFontFeatureValues(this)->TraceAfterDispatch(visitor); + return; } NOTREACHED(); } @@ -126,6 +132,9 @@ void StyleRuleBase::FinalizeGarbageCollectedObject() { case kViewport: ToStyleRuleViewport(this)->~StyleRuleViewport(); return; + case kFontFeatureValues: + ToStyleRuleFontFeatureValues(this)->~StyleRuleFontFeatureValues(); + return; } NOTREACHED(); } @@ -152,6 +161,8 @@ StyleRuleBase* StyleRuleBase::Copy() const { return ToStyleRuleViewport(this)->Copy(); case kNamespace: return ToStyleRuleNamespace(this)->Copy(); + case kFontFeatureValues: + return ToStyleRuleFontFeatureValues(this)->Copy(); case kCharset: case kKeyframe: NOTREACHED(); @@ -193,6 +204,10 @@ CSSRule* StyleRuleBase::CreateCSSOMWrapper(CSSStyleSheet* parent_sheet, case kViewport: rule = CSSViewportRule::Create(ToStyleRuleViewport(self), parent_sheet); break; + case kFontFeatureValues: + rule = CSSFontFeatureValuesRule::Create( + ToStyleRuleFontFeatureValues(self), parent_sheet); + break; case kKeyframe: case kCharset: NOTREACHED(); @@ -397,4 +412,17 @@ void StyleRuleViewport::TraceAfterDispatch(blink::Visitor* visitor) { StyleRuleBase::TraceAfterDispatch(visitor); } +StyleRuleFontFeatureValues::StyleRuleFontFeatureValues( + const CSSValueList* font_family, + const CSSIdentifierValue* font_display) + : StyleRuleBase(kFontFeatureValues), + font_family_(font_family), + font_display_(font_display) {} + +void StyleRuleFontFeatureValues::TraceAfterDispatch(blink::Visitor* visitor) { + visitor->Trace(font_family_); + visitor->Trace(font_display_); + StyleRuleBase::TraceAfterDispatch(visitor); +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/style_rule.h b/chromium/third_party/blink/renderer/core/css/style_rule.h index 7a06d7b72b1..a6488356465 100644 --- a/chromium/third_party/blink/renderer/core/css/style_rule.h +++ b/chromium/third_party/blink/renderer/core/css/style_rule.h @@ -31,8 +31,10 @@ namespace blink { +class CSSIdentifierValue; class CSSRule; class CSSStyleSheet; +class CSSValueList; class CORE_EXPORT StyleRuleBase : public GarbageCollectedFinalized<StyleRuleBase> { @@ -49,6 +51,7 @@ class CORE_EXPORT StyleRuleBase kNamespace, kSupports, kViewport, + kFontFeatureValues, }; RuleType GetType() const { return static_cast<RuleType>(type_); } @@ -64,6 +67,9 @@ class CORE_EXPORT StyleRuleBase bool IsSupportsRule() const { return GetType() == kSupports; } bool IsViewportRule() const { return GetType() == kViewport; } bool IsImportRule() const { return GetType() == kImport; } + bool IsFontFeatureValuesRule() const { + return GetType() == kFontFeatureValues; + } StyleRuleBase* Copy() const; @@ -100,13 +106,18 @@ class CORE_EXPORT StyleRule : public StyleRuleBase { // Adopts the selector list static StyleRule* Create(CSSSelectorList selector_list, CSSPropertyValueSet* properties) { - return new StyleRule(std::move(selector_list), properties); + return MakeGarbageCollected<StyleRule>(std::move(selector_list), + properties); } static StyleRule* CreateLazy(CSSSelectorList selector_list, CSSLazyPropertyParser* lazy_property_parser) { - return new StyleRule(std::move(selector_list), lazy_property_parser); + return MakeGarbageCollected<StyleRule>(std::move(selector_list), + lazy_property_parser); } + StyleRule(CSSSelectorList, CSSPropertyValueSet*); + StyleRule(CSSSelectorList, CSSLazyPropertyParser*); + StyleRule(const StyleRule&); ~StyleRule(); const CSSSelectorList& SelectorList() const { return selector_list_; } @@ -117,7 +128,7 @@ class CORE_EXPORT StyleRule : public StyleRuleBase { selector_list_ = std::move(selectors); } - StyleRule* Copy() const { return new StyleRule(*this); } + StyleRule* Copy() const { return MakeGarbageCollected<StyleRule>(*this); } static unsigned AverageSizeInBytes(); @@ -131,10 +142,6 @@ class CORE_EXPORT StyleRule : public StyleRuleBase { friend class CSSLazyParsingTest; bool HasParsedProperties() const; - StyleRule(CSSSelectorList, CSSPropertyValueSet*); - StyleRule(CSSSelectorList, CSSLazyPropertyParser*); - StyleRule(const StyleRule&); - // Whether or not we should consider this for matching rules. Usually we try // to avoid considering empty property sets, as an optimization. This is // not possible for lazy properties, which always need to be considered. The @@ -154,22 +161,23 @@ class CORE_EXPORT StyleRule : public StyleRuleBase { class CORE_EXPORT StyleRuleFontFace : public StyleRuleBase { public: static StyleRuleFontFace* Create(CSSPropertyValueSet* properties) { - return new StyleRuleFontFace(properties); + return MakeGarbageCollected<StyleRuleFontFace>(properties); } + StyleRuleFontFace(CSSPropertyValueSet*); + StyleRuleFontFace(const StyleRuleFontFace&); ~StyleRuleFontFace(); const CSSPropertyValueSet& Properties() const { return *properties_; } MutableCSSPropertyValueSet& MutableProperties(); - StyleRuleFontFace* Copy() const { return new StyleRuleFontFace(*this); } + StyleRuleFontFace* Copy() const { + return MakeGarbageCollected<StyleRuleFontFace>(*this); + } void TraceAfterDispatch(blink::Visitor*); private: - StyleRuleFontFace(CSSPropertyValueSet*); - StyleRuleFontFace(const StyleRuleFontFace&); - Member<CSSPropertyValueSet> properties_; // Cannot be null. }; @@ -178,9 +186,12 @@ class StyleRulePage : public StyleRuleBase { // Adopts the selector list static StyleRulePage* Create(CSSSelectorList selector_list, CSSPropertyValueSet* properties) { - return new StyleRulePage(std::move(selector_list), properties); + return MakeGarbageCollected<StyleRulePage>(std::move(selector_list), + properties); } + StyleRulePage(CSSSelectorList, CSSPropertyValueSet*); + StyleRulePage(const StyleRulePage&); ~StyleRulePage(); const CSSSelector* Selector() const { return selector_list_.First(); } @@ -191,14 +202,13 @@ class StyleRulePage : public StyleRuleBase { selector_list_ = std::move(selectors); } - StyleRulePage* Copy() const { return new StyleRulePage(*this); } + StyleRulePage* Copy() const { + return MakeGarbageCollected<StyleRulePage>(*this); + } void TraceAfterDispatch(blink::Visitor*); private: - StyleRulePage(CSSSelectorList, CSSPropertyValueSet*); - StyleRulePage(const StyleRulePage&); - Member<CSSPropertyValueSet> properties_; // Cannot be null. CSSSelectorList selector_list_; }; @@ -244,20 +254,22 @@ class CORE_EXPORT StyleRuleMedia : public StyleRuleCondition { static StyleRuleMedia* Create( scoped_refptr<MediaQuerySet> media, HeapVector<Member<StyleRuleBase>>& adopt_rules) { - return new StyleRuleMedia(media, adopt_rules); + return MakeGarbageCollected<StyleRuleMedia>(media, adopt_rules); } + StyleRuleMedia(scoped_refptr<MediaQuerySet>, + HeapVector<Member<StyleRuleBase>>& adopt_rules); + StyleRuleMedia(const StyleRuleMedia&); + MediaQuerySet* MediaQueries() const { return media_queries_.get(); } - StyleRuleMedia* Copy() const { return new StyleRuleMedia(*this); } + StyleRuleMedia* Copy() const { + return MakeGarbageCollected<StyleRuleMedia>(*this); + } void TraceAfterDispatch(blink::Visitor*); private: - StyleRuleMedia(scoped_refptr<MediaQuerySet>, - HeapVector<Member<StyleRuleBase>>& adopt_rules); - StyleRuleMedia(const StyleRuleMedia&); - scoped_refptr<MediaQuerySet> media_queries_; }; @@ -267,23 +279,25 @@ class StyleRuleSupports : public StyleRuleCondition { const String& condition_text, bool condition_is_supported, HeapVector<Member<StyleRuleBase>>& adopt_rules) { - return new StyleRuleSupports(condition_text, condition_is_supported, - adopt_rules); + return MakeGarbageCollected<StyleRuleSupports>( + condition_text, condition_is_supported, adopt_rules); } + StyleRuleSupports(const String& condition_text, + bool condition_is_supported, + HeapVector<Member<StyleRuleBase>>& adopt_rules); + StyleRuleSupports(const StyleRuleSupports&); + bool ConditionIsSupported() const { return condition_is_supported_; } - StyleRuleSupports* Copy() const { return new StyleRuleSupports(*this); } + StyleRuleSupports* Copy() const { + return MakeGarbageCollected<StyleRuleSupports>(*this); + } void TraceAfterDispatch(blink::Visitor* visitor) { StyleRuleCondition::TraceAfterDispatch(visitor); } private: - StyleRuleSupports(const String& condition_text, - bool condition_is_supported, - HeapVector<Member<StyleRuleBase>>& adopt_rules); - StyleRuleSupports(const StyleRuleSupports&); - String condition_text_; bool condition_is_supported_; }; @@ -291,35 +305,68 @@ class StyleRuleSupports : public StyleRuleCondition { class StyleRuleViewport : public StyleRuleBase { public: static StyleRuleViewport* Create(CSSPropertyValueSet* properties) { - return new StyleRuleViewport(properties); + return MakeGarbageCollected<StyleRuleViewport>(properties); } + StyleRuleViewport(CSSPropertyValueSet*); + StyleRuleViewport(const StyleRuleViewport&); ~StyleRuleViewport(); const CSSPropertyValueSet& Properties() const { return *properties_; } MutableCSSPropertyValueSet& MutableProperties(); - StyleRuleViewport* Copy() const { return new StyleRuleViewport(*this); } + StyleRuleViewport* Copy() const { + return MakeGarbageCollected<StyleRuleViewport>(*this); + } void TraceAfterDispatch(blink::Visitor*); private: - StyleRuleViewport(CSSPropertyValueSet*); - StyleRuleViewport(const StyleRuleViewport&); - Member<CSSPropertyValueSet> properties_; // Cannot be null }; // This should only be used within the CSS Parser class StyleRuleCharset : public StyleRuleBase { public: - static StyleRuleCharset* Create() { return new StyleRuleCharset(); } + static StyleRuleCharset* Create() { + return MakeGarbageCollected<StyleRuleCharset>(); + } + + StyleRuleCharset() : StyleRuleBase(kCharset) {} void TraceAfterDispatch(blink::Visitor* visitor) { StyleRuleBase::TraceAfterDispatch(visitor); } private: - StyleRuleCharset() : StyleRuleBase(kCharset) {} +}; + +class CORE_EXPORT StyleRuleFontFeatureValues : public StyleRuleBase { + public: + static StyleRuleFontFeatureValues* Create( + const CSSValueList* font_family, + const CSSIdentifierValue* font_display) { + return new StyleRuleFontFeatureValues(font_family, font_display); + } + + StyleRuleFontFeatureValues* Copy() const { + return new StyleRuleFontFeatureValues(*this); + } + + const CSSValueList& FontFamily() const { + DCHECK(font_family_); + return *font_family_; + } + const CSSIdentifierValue* FontDisplay() const { return font_display_; } + + void TraceAfterDispatch(blink::Visitor*); + + private: + StyleRuleFontFeatureValues(const CSSValueList* font_family, + const CSSIdentifierValue* font_display); + StyleRuleFontFeatureValues(const StyleRuleFontFeatureValues&) = default; + + Member<const CSSValueList> font_family_; + Member<const CSSIdentifierValue> font_display_; }; #define DEFINE_STYLE_RULE_TYPE_CASTS(Type) \ @@ -337,6 +384,7 @@ DEFINE_STYLE_RULE_TYPE_CASTS(Media); DEFINE_STYLE_RULE_TYPE_CASTS(Supports); DEFINE_STYLE_RULE_TYPE_CASTS(Viewport); DEFINE_STYLE_RULE_TYPE_CASTS(Charset); +DEFINE_STYLE_RULE_TYPE_CASTS(FontFeatureValues); } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/style_rule_css_style_declaration.h b/chromium/third_party/blink/renderer/core/css/style_rule_css_style_declaration.h index 618b296f702..255798dea7f 100644 --- a/chromium/third_party/blink/renderer/core/css/style_rule_css_style_declaration.h +++ b/chromium/third_party/blink/renderer/core/css/style_rule_css_style_declaration.h @@ -39,17 +39,18 @@ class StyleRuleCSSStyleDeclaration : public PropertySetCSSStyleDeclaration { static StyleRuleCSSStyleDeclaration* Create( MutableCSSPropertyValueSet& property_set, CSSRule* parent_rule) { - return new StyleRuleCSSStyleDeclaration(property_set, parent_rule); + return MakeGarbageCollected<StyleRuleCSSStyleDeclaration>(property_set, + parent_rule); } + StyleRuleCSSStyleDeclaration(MutableCSSPropertyValueSet&, CSSRule*); + ~StyleRuleCSSStyleDeclaration() override; + void Reattach(MutableCSSPropertyValueSet&); void Trace(blink::Visitor*) override; protected: - StyleRuleCSSStyleDeclaration(MutableCSSPropertyValueSet&, CSSRule*); - ~StyleRuleCSSStyleDeclaration() override; - CSSStyleSheet* ParentStyleSheet() const override; CSSRule* parentRule() const override { return parent_rule_; } diff --git a/chromium/third_party/blink/renderer/core/css/style_rule_import.cc b/chromium/third_party/blink/renderer/core/css/style_rule_import.cc index 05e833ba58e..c53f60348eb 100644 --- a/chromium/third_party/blink/renderer/core/css/style_rule_import.cc +++ b/chromium/third_party/blink/renderer/core/css/style_rule_import.cc @@ -34,14 +34,14 @@ namespace blink { StyleRuleImport* StyleRuleImport::Create(const String& href, scoped_refptr<MediaQuerySet> media) { - return new StyleRuleImport(href, media); + return MakeGarbageCollected<StyleRuleImport>(href, media); } StyleRuleImport::StyleRuleImport(const String& href, scoped_refptr<MediaQuerySet> media) : StyleRuleBase(kImport), parent_style_sheet_(nullptr), - style_sheet_client_(new ImportedStyleSheetClient(this)), + style_sheet_client_(MakeGarbageCollected<ImportedStyleSheetClient>(this)), str_href_(href), media_queries_(media), loading_(false) { @@ -134,7 +134,7 @@ void StyleRuleImport::RequestStyleSheet() { } ResourceLoaderOptions options; - options.initiator_info.name = FetchInitiatorTypeNames::css; + options.initiator_info.name = fetch_initiator_type_names::kCSS; FetchParameters params(ResourceRequest(abs_url), options); params.SetCharset(parent_style_sheet_->Charset()); loading_ = true; diff --git a/chromium/third_party/blink/renderer/core/css/style_rule_import.h b/chromium/third_party/blink/renderer/core/css/style_rule_import.h index 4e90a9cf5ef..0e2189468ff 100644 --- a/chromium/third_party/blink/renderer/core/css/style_rule_import.h +++ b/chromium/third_party/blink/renderer/core/css/style_rule_import.h @@ -38,6 +38,7 @@ class StyleRuleImport : public StyleRuleBase { static StyleRuleImport* Create(const String& href, scoped_refptr<MediaQuerySet>); + StyleRuleImport(const String& href, scoped_refptr<MediaQuerySet>); ~StyleRuleImport(); StyleSheetContents* ParentStyleSheet() const { return parent_style_sheet_; } @@ -89,8 +90,6 @@ class StyleRuleImport : public StyleRuleBase { void NotifyFinished(Resource*); - StyleRuleImport(const String& href, scoped_refptr<MediaQuerySet>); - void Dispose(); Member<StyleSheetContents> parent_style_sheet_; diff --git a/chromium/third_party/blink/renderer/core/css/style_rule_keyframe.h b/chromium/third_party/blink/renderer/core/css/style_rule_keyframe.h index 0f33b88069c..bf0ac2f383b 100644 --- a/chromium/third_party/blink/renderer/core/css/style_rule_keyframe.h +++ b/chromium/third_party/blink/renderer/core/css/style_rule_keyframe.h @@ -17,9 +17,11 @@ class StyleRuleKeyframe final : public StyleRuleBase { public: static StyleRuleKeyframe* Create(std::unique_ptr<Vector<double>> keys, CSSPropertyValueSet* properties) { - return new StyleRuleKeyframe(std::move(keys), properties); + return MakeGarbageCollected<StyleRuleKeyframe>(std::move(keys), properties); } + StyleRuleKeyframe(std::unique_ptr<Vector<double>>, CSSPropertyValueSet*); + // Exposed to JavaScript. String KeyText() const; bool SetKeyText(const String&); @@ -35,8 +37,6 @@ class StyleRuleKeyframe final : public StyleRuleBase { void TraceAfterDispatch(blink::Visitor*); private: - StyleRuleKeyframe(std::unique_ptr<Vector<double>>, CSSPropertyValueSet*); - Member<CSSPropertyValueSet> properties_; Vector<double> keys_; }; diff --git a/chromium/third_party/blink/renderer/core/css/style_rule_namespace.h b/chromium/third_party/blink/renderer/core/css/style_rule_namespace.h index 8a0208b7965..bebb5e0148d 100644 --- a/chromium/third_party/blink/renderer/core/css/style_rule_namespace.h +++ b/chromium/third_party/blink/renderer/core/css/style_rule_namespace.h @@ -14,11 +14,14 @@ namespace blink { class StyleRuleNamespace final : public StyleRuleBase { public: static StyleRuleNamespace* Create(AtomicString prefix, AtomicString uri) { - return new StyleRuleNamespace(prefix, uri); + return MakeGarbageCollected<StyleRuleNamespace>(prefix, uri); } + StyleRuleNamespace(AtomicString prefix, AtomicString uri) + : StyleRuleBase(kNamespace), prefix_(prefix), uri_(uri) {} + StyleRuleNamespace* Copy() const { - return new StyleRuleNamespace(prefix_, uri_); + return MakeGarbageCollected<StyleRuleNamespace>(prefix_, uri_); } AtomicString Prefix() const { return prefix_; } @@ -29,9 +32,6 @@ class StyleRuleNamespace final : public StyleRuleBase { } private: - StyleRuleNamespace(AtomicString prefix, AtomicString uri) - : StyleRuleBase(kNamespace), prefix_(prefix), uri_(uri) {} - AtomicString prefix_; AtomicString uri_; }; diff --git a/chromium/third_party/blink/renderer/core/css/style_sheet_candidate.cc b/chromium/third_party/blink/renderer/core/css/style_sheet_candidate.cc index 5bd16a9accb..321f00c166e 100644 --- a/chromium/third_party/blink/renderer/core/css/style_sheet_candidate.cc +++ b/chromium/third_party/blink/renderer/core/css/style_sheet_candidate.cc @@ -37,10 +37,10 @@ namespace blink { -using namespace HTMLNames; +using namespace html_names; AtomicString StyleSheetCandidate::Title() const { - return IsElement() ? ToElement(GetNode()).FastGetAttribute(titleAttr) + return IsElement() ? ToElement(GetNode()).FastGetAttribute(kTitleAttr) : g_null_atom; } diff --git a/chromium/third_party/blink/renderer/core/css/style_sheet_collection.h b/chromium/third_party/blink/renderer/core/css/style_sheet_collection.h index b8fd00326a9..bc47cfb4f84 100644 --- a/chromium/third_party/blink/renderer/core/css/style_sheet_collection.h +++ b/chromium/third_party/blink/renderer/core/css/style_sheet_collection.h @@ -50,7 +50,11 @@ class CORE_EXPORT StyleSheetCollection friend class ActiveDocumentStyleSheetCollector; friend class ImportedDocumentStyleSheetCollector; - static StyleSheetCollection* Create() { return new StyleSheetCollection; } + static StyleSheetCollection* Create() { + return MakeGarbageCollected<StyleSheetCollection>(); + } + + StyleSheetCollection(); const ActiveStyleSheetVector& ActiveAuthorStyleSheets() const { return active_author_style_sheets_; @@ -74,8 +78,6 @@ class CORE_EXPORT StyleSheetCollection void Dispose(); protected: - StyleSheetCollection(); - HeapVector<TraceWrapperMember<StyleSheet>> style_sheets_for_style_sheet_list_; ActiveStyleSheetVector active_author_style_sheets_; bool sheet_list_dirty_ = true; diff --git a/chromium/third_party/blink/renderer/core/css/style_sheet_contents.cc b/chromium/third_party/blink/renderer/core/css/style_sheet_contents.cc index 0725d4d71d7..2338cc7a86b 100644 --- a/chromium/third_party/blink/renderer/core/css/style_sheet_contents.cc +++ b/chromium/third_party/blink/renderer/core/css/style_sheet_contents.cc @@ -332,8 +332,9 @@ const AtomicString& StyleSheetContents::NamespaceURIFromPrefix( void StyleSheetContents::ParseAuthorStyleSheet( const CSSStyleSheetResource* cached_style_sheet, const SecurityOrigin* security_origin) { - TRACE_EVENT1("blink,devtools.timeline", "ParseAuthorStyleSheet", "data", - InspectorParseAuthorStyleSheetEvent::Data(cached_style_sheet)); + TRACE_EVENT1( + "blink,devtools.timeline", "ParseAuthorStyleSheet", "data", + inspector_parse_author_style_sheet_event::Data(cached_style_sheet)); TimeTicks start_time = CurrentTimeTicks(); bool is_same_origin_request = @@ -360,10 +361,10 @@ void StyleSheetContents::ParseAuthorStyleSheet( cached_style_sheet->SheetText(parser_context_, mime_type_check); const ResourceResponse& response = cached_style_sheet->GetResponse(); - source_map_url_ = response.HttpHeaderField(HTTPNames::SourceMap); + source_map_url_ = response.HttpHeaderField(http_names::kSourceMap); if (source_map_url_.IsEmpty()) { // Try to get deprecated header. - source_map_url_ = response.HttpHeaderField(HTTPNames::X_SourceMap); + source_map_url_ = response.HttpHeaderField(http_names::kXSourceMap); } const CSSParserContext* context = @@ -535,6 +536,7 @@ static bool ChildRulesHaveFailedOrCanceledSubresources( case StyleRuleBase::kKeyframe: case StyleRuleBase::kSupports: case StyleRuleBase::kViewport: + case StyleRuleBase::kFontFeatureValues: break; } } diff --git a/chromium/third_party/blink/renderer/core/css/style_sheet_contents.h b/chromium/third_party/blink/renderer/core/css/style_sheet_contents.h index acf61566509..81e515579dd 100644 --- a/chromium/third_party/blink/renderer/core/css/style_sheet_contents.h +++ b/chromium/third_party/blink/renderer/core/css/style_sheet_contents.h @@ -50,20 +50,27 @@ class CORE_EXPORT StyleSheetContents : public GarbageCollectedFinalized<StyleSheetContents> { public: static StyleSheetContents* Create(const CSSParserContext* context) { - return new StyleSheetContents(nullptr, String(), context); + return MakeGarbageCollected<StyleSheetContents>(nullptr, String(), context); } static StyleSheetContents* Create(const String& original_url, const CSSParserContext* context) { - return new StyleSheetContents(nullptr, original_url, context); + return MakeGarbageCollected<StyleSheetContents>(nullptr, original_url, + context); } static StyleSheetContents* Create(StyleRuleImport* owner_rule, const String& original_url, const CSSParserContext* context) { - return new StyleSheetContents(owner_rule, original_url, context); + return MakeGarbageCollected<StyleSheetContents>(owner_rule, original_url, + context); } static const Document* SingleOwnerDocument(const StyleSheetContents*); + StyleSheetContents(StyleRuleImport* owner_rule, + const String& original_url, + const CSSParserContext*); + StyleSheetContents(const StyleSheetContents&); + StyleSheetContents() = delete; ~StyleSheetContents(); const CSSParserContext* ParserContext() const { return parser_context_; } @@ -174,7 +181,9 @@ class CORE_EXPORT StyleSheetContents bool WrapperInsertRule(StyleRuleBase*, unsigned index); bool WrapperDeleteRule(unsigned index); - StyleSheetContents* Copy() const { return new StyleSheetContents(*this); } + StyleSheetContents* Copy() const { + return MakeGarbageCollected<StyleSheetContents>(*this); + } void RegisterClient(CSSStyleSheet*); void UnregisterClient(CSSStyleSheet*); @@ -214,11 +223,6 @@ class CORE_EXPORT StyleSheetContents void Trace(blink::Visitor*); private: - StyleSheetContents(StyleRuleImport* owner_rule, - const String& original_url, - const CSSParserContext*); - StyleSheetContents(const StyleSheetContents&); - StyleSheetContents() = delete; StyleSheetContents& operator=(const StyleSheetContents&) = delete; void NotifyRemoveFontFaceRule(const StyleRuleFontFace*); diff --git a/chromium/third_party/blink/renderer/core/css/style_sheet_contents_fuzzer.cc b/chromium/third_party/blink/renderer/core/css/style_sheet_contents_fuzzer.cc index 1921cf6c6bc..374f2aa783d 100644 --- a/chromium/third_party/blink/renderer/core/css/style_sheet_contents_fuzzer.cc +++ b/chromium/third_party/blink/renderer/core/css/style_sheet_contents_fuzzer.cc @@ -27,13 +27,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { styleSheet->ParseString(String::FromUTF8WithLatin1Fallback( reinterpret_cast<const char*>(data), size)); -#if defined(ADDRESS_SANITIZER) - // LSAN needs unreachable objects to be released to avoid reporting them - // incorrectly as a memory leak. - blink::ThreadState* currentThreadState = blink::ThreadState::Current(); - currentThreadState->CollectAllGarbage(); -#endif - return 0; } diff --git a/chromium/third_party/blink/renderer/core/css/style_sheet_contents_test.cc b/chromium/third_party/blink/renderer/core/css/style_sheet_contents_test.cc index e884bbdab91..4bbf05458f8 100644 --- a/chromium/third_party/blink/renderer/core/css/style_sheet_contents_test.cc +++ b/chromium/third_party/blink/renderer/core/css/style_sheet_contents_test.cc @@ -5,7 +5,6 @@ #include "third_party/blink/renderer/core/css/style_sheet_contents.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/renderer/core/css/css_test_helper.h" #include "third_party/blink/renderer/core/css/parser/css_parser.h" namespace blink { diff --git a/chromium/third_party/blink/renderer/core/css/style_sheet_list.cc b/chromium/third_party/blink/renderer/core/css/style_sheet_list.cc index 3045da40df5..2990d6a88b3 100644 --- a/chromium/third_party/blink/renderer/core/css/style_sheet_list.cc +++ b/chromium/third_party/blink/renderer/core/css/style_sheet_list.cc @@ -29,11 +29,9 @@ namespace blink { -using namespace HTMLNames; - StyleSheetList* StyleSheetList::Create() { DCHECK(RuntimeEnabledFeatures::ConstructableStylesheetsEnabled()); - return new StyleSheetList(); + return MakeGarbageCollected<StyleSheetList>(); } StyleSheetList* StyleSheetList::Create( @@ -43,7 +41,7 @@ StyleSheetList* StyleSheetList::Create( exception_state.ThrowTypeError("Illegal constructor"); return nullptr; } - return new StyleSheetList(style_sheet_vector); + return MakeGarbageCollected<StyleSheetList>(style_sheet_vector); } StyleSheetList::StyleSheetList( diff --git a/chromium/third_party/blink/renderer/core/css/style_sheet_list.h b/chromium/third_party/blink/renderer/core/css/style_sheet_list.h index 3ec4f37a496..4533e7cda07 100644 --- a/chromium/third_party/blink/renderer/core/css/style_sheet_list.h +++ b/chromium/third_party/blink/renderer/core/css/style_sheet_list.h @@ -42,9 +42,13 @@ class CORE_EXPORT StyleSheetList final : public ScriptWrappable { ExceptionState&); static StyleSheetList* Create(TreeScope* tree_scope) { - return new StyleSheetList(tree_scope); + return MakeGarbageCollected<StyleSheetList>(tree_scope); } + explicit StyleSheetList(const HeapVector<Member<CSSStyleSheet>>&); + explicit StyleSheetList(TreeScope*); + StyleSheetList() {} + unsigned length(); StyleSheet* item(unsigned index); @@ -59,9 +63,6 @@ class CORE_EXPORT StyleSheetList final : public ScriptWrappable { void Trace(blink::Visitor*) override; private: - explicit StyleSheetList(const HeapVector<Member<CSSStyleSheet>>&); - explicit StyleSheetList(TreeScope*); - StyleSheetList() {} const HeapVector<TraceWrapperMember<StyleSheet>>& StyleSheets() const; Member<TreeScope> tree_scope_; diff --git a/chromium/third_party/blink/renderer/core/css/style_traversal_root_test.cc b/chromium/third_party/blink/renderer/core/css/style_traversal_root_test.cc index d74387881c5..ca8c7277e56 100644 --- a/chromium/third_party/blink/renderer/core/css/style_traversal_root_test.cc +++ b/chromium/third_party/blink/renderer/core/css/style_traversal_root_test.cc @@ -49,9 +49,9 @@ class StyleTraversalRootTest : public testing::Test { enum ElementIndex { kA, kB, kC, kD, kE, kF, kG, kElementCount }; void SetUp() final { document_ = Document::CreateForTest(); - elements_ = new HeapVector<Member<Element>, 7>; + elements_ = MakeGarbageCollected<HeapVector<Member<Element>, 7>>(); for (size_t i = 0; i < kElementCount; i++) { - elements_->push_back(GetDocument().CreateRawElement(HTMLNames::divTag)); + elements_->push_back(GetDocument().CreateRawElement(html_names::kDivTag)); } GetDocument().appendChild(DivElement(kA)); DivElement(kA)->appendChild(DivElement(kB)); diff --git a/chromium/third_party/blink/renderer/core/css/themeChromiumAndroid.css b/chromium/third_party/blink/renderer/core/css/themeChromiumAndroid.css deleted file mode 100644 index ce254bb4010..00000000000 --- a/chromium/third_party/blink/renderer/core/css/themeChromiumAndroid.css +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* These styles override other user-agent styles for Chromium on Android. */ - -input[type="date" i]:disabled, -input[type="datetime-local" i]:disabled, -input[type="month" i]:disabled, -input[type="time" i]:disabled, -input[type="week" i]:disabled, -input[type="date" i]:read-only, -input[type="datetime-local" i]:read-only, -input[type="month" i]:read-only, -input[type="time" i]:read-only, -input[type="week" i]:read-only { - background-color: ButtonFace; - color: GrayText; -} - -input[type="date" i], -input[type="datetime-local" i], -input[type="month" i], -input[type="time" i], -input[type="week" i] { - align-items: center; - -webkit-appearance: menulist; - background-color: ButtonFace; - border: 1px solid #a9a9a9; - display: -webkit-inline-flex; - overflow: hidden; - width: 10em; -} - -input[type="datetime-local" i] { - width: 15em; -} - -input::-webkit-date-and-time-value { - margin: 1px 24px 1px 4px; - overflow: hidden; - white-space: pre; -} diff --git a/chromium/third_party/blink/renderer/core/css/themeChromiumLinux.css b/chromium/third_party/blink/renderer/core/css/themeChromiumLinux.css deleted file mode 100644 index f45f6c7678a..00000000000 --- a/chromium/third_party/blink/renderer/core/css/themeChromiumLinux.css +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* These styles override other user-agent styles for Chromium on Linux. */ - -select:not(:-internal-list-box) { - /* Selects with popup menus look like buttons with a drop down triangle on Linux. */ - background-color: ButtonFace; -} - -input[type=range i] { - color: #9d968E; -} diff --git a/chromium/third_party/blink/renderer/core/css/themeInputMultipleFields.css b/chromium/third_party/blink/renderer/core/css/themeInputMultipleFields.css deleted file mode 100644 index e0ff0efb7b5..00000000000 --- a/chromium/third_party/blink/renderer/core/css/themeInputMultipleFields.css +++ /dev/null @@ -1,97 +0,0 @@ -/* Copyright 2014 The Chromium Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -input[type="date" i], -input[type="datetime-local" i], -input[type="month" i], -input[type="time" i], -input[type="week" i] { - align-items: center; - display: -webkit-inline-flex; - font-family: monospace; - overflow: hidden; - padding: 0; - -webkit-padding-start: 1px; - cursor: default; -} - -input::-webkit-datetime-edit { - flex: 1; - min-width: 0; - -webkit-user-modify: read-only !important; - display: inline-block; - overflow: hidden; -} - -input::-webkit-datetime-edit-fields-wrapper { - -webkit-user-modify: read-only !important; - display: inline-block; - padding: 1px 0; - white-space: pre; -} - -/* If you update padding, border, or margin in the following ruleset, update - DateTimeFieldElement::maximumWidth too. */ -input::-webkit-datetime-edit-ampm-field, -input::-webkit-datetime-edit-day-field, -input::-webkit-datetime-edit-hour-field, -input::-webkit-datetime-edit-millisecond-field, -input::-webkit-datetime-edit-minute-field, -input::-webkit-datetime-edit-month-field, -input::-webkit-datetime-edit-second-field, -input::-webkit-datetime-edit-week-field, -input::-webkit-datetime-edit-year-field { - -webkit-user-modify: read-only !important; - border: none; - display: inline; - font: inherit !important; - padding: 1px; -} - -/* Remove focus ring from fields and use highlight color */ -input::-webkit-datetime-edit-ampm-field:focus, -input::-webkit-datetime-edit-day-field:focus, -input::-webkit-datetime-edit-hour-field:focus, -input::-webkit-datetime-edit-millisecond-field:focus, -input::-webkit-datetime-edit-minute-field:focus, -input::-webkit-datetime-edit-month-field:focus, -input::-webkit-datetime-edit-second-field:focus, -input::-webkit-datetime-edit-week-field:focus, -input::-webkit-datetime-edit-year-field:focus { - background-color: highlight; - color: highlighttext; - outline: none; -} - -input::-webkit-datetime-edit-year-field[disabled], -input::-webkit-datetime-edit-month-field[disabled], -input::-webkit-datetime-edit-week-field[disabled], -input::-webkit-datetime-edit-day-field[disabled], -input::-webkit-datetime-edit-ampm-field[disabled], -input::-webkit-datetime-edit-hour-field[disabled], -input::-webkit-datetime-edit-millisecond-field[disabled], -input::-webkit-datetime-edit-minute-field[disabled], -input::-webkit-datetime-edit-second-field[disabled] { - color: GrayText; -} - -/* If you update padding, border, or margin in the following ruleset, update - DateTimeEditElement::customStyelForRenderer too. */ -input::-webkit-datetime-edit-text { - -webkit-user-modify: read-only !important; - display: inline; - font: inherit !important; -} - -input[type="date" i]::-webkit-inner-spin-button, -input[type="datetime" i]::-webkit-inner-spin-button, -input[type="datetime-local" i]::-webkit-inner-spin-button, -input[type="month" i]::-webkit-inner-spin-button, -input[type="time" i]::-webkit-inner-spin-button, -input[type="week" i]::-webkit-inner-spin-button { - /* FIXME: Remove height. */ - height: 1.5em; - -webkit-margin-start: 2px; -} diff --git a/chromium/third_party/blink/renderer/core/css/themeMac.css b/chromium/third_party/blink/renderer/core/css/themeMac.css deleted file mode 100644 index a99fce958a5..00000000000 --- a/chromium/third_party/blink/renderer/core/css/themeMac.css +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright 2014 The Chromium Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -select, input[type="color" i][list] { - /* TODO(tkent): Use ButtonFace and border same as buttons. */ - background-color: #f8f8f8; - border: 1px solid #a6a6a6; -} - -select:-internal-list-box { - background-color: white; - border: 1px solid #999999; -} - -input::-webkit-inner-spin-button { - align-self: center; -} - -input[type="button" i], -input[type="submit" i], -input[type="reset" i], -input[type="file" i]::-webkit-file-upload-button, -button { - /* The color is similar to the border of OSX 10.12 buttons. */ - border-color: #d8d8d8 #d1d1d1 #bababa; - border-style: solid; - border-width: 1px; - /* Fixed padding provided by ThemeMac::ControlPadding() - 1px for broder */ - padding: 1px 7px 2px; -} diff --git a/chromium/third_party/blink/renderer/core/css/themeWin.css b/chromium/third_party/blink/renderer/core/css/themeWin.css deleted file mode 100644 index ed659eed4df..00000000000 --- a/chromium/third_party/blink/renderer/core/css/themeWin.css +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* These styles override the default styling for HTML elements as defined in - WebCore/css/html.css. So far we have used this file exclusively for - making our form elements match Firefox's. */ - -/* - * Update padding for all text-like types including unknown types. - * Non-text types have input[type="foo" i] with padding properties in - * html.css or themeInputMultipleFields.css. - */ -input { - padding:1px 0; -} - -input[type="search" i] { - padding:1px; -} - -input[type="checkbox" i] { - margin:3px 3px 3px 4px; -} - -input[type="radio" i] { - margin:3px 3px 0 5px; -} - -input[type="range" i] { - color: #c4c4c4; -} - -/* Not sure this is the right color. #EBEBE4 is what Firefox uses. */ -textarea:disabled, -input:disabled { - background-color: #EBEBE4; -} - -/* Cancel the above rule set for some input types. */ -input[type="button" i]:disabled, -input[type="reset" i]:disabled, -input[type="submit" i]:disabled { - background-color: ButtonFace; -} -input[type="checkbox" i]:disabled, -input[type="file" i]:disabled, -input[type="hidden" i]:disabled, -input[type="image" i]:disabled, -input[type="radio" i]:disabled, -input[type="range" i]:disabled { - background-color: initial; -} - -input[type="search" i]::-webkit-search-cancel-button { - margin-right: 3px; -} - -input[type="search" i]::-webkit-search-results-decoration { - margin: auto 3px auto 2px; -} - -input[type="button" i], input[type="submit" i], input[type="reset" i], input[type="file" i]::-webkit-file-upload-button, button { - padding: 1px 6px; -} - -/* Windows selects are not rounded. Custom borders for them shouldn't be either. */ -select { - border-radius: 0; - /* Same as native_theme_base. */ - border-color: #a9a9a9; -} - -select:-internal-list-box { - /* Same as native_theme_base. */ - border: 1px solid #a9a9a9; -} - -textarea { - font-family: monospace; - /* Same as native_theme_base. */ - border-color: #a9a9a9; -} diff --git a/chromium/third_party/blink/renderer/core/css/themeWinQuirks.css b/chromium/third_party/blink/renderer/core/css/themeWinQuirks.css deleted file mode 100644 index c69b74c7146..00000000000 --- a/chromium/third_party/blink/renderer/core/css/themeWinQuirks.css +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* These styles override the default styling for HTML elements in quirks-mode - as defined in WebCore/css/quirks.css. So far we have used this file exclusively for - making our form elements match Firefox's. */ - -textarea { - /* Matches IE's text offsets in quirksmode (causes text to wrap the same as IE). */ - padding: 2px 0 0 2px; -} diff --git a/chromium/third_party/blink/renderer/core/css/threaded/css_parser_threaded_test.cc b/chromium/third_party/blink/renderer/core/css/threaded/css_parser_threaded_test.cc index 679d1af4a87..83e290f8064 100644 --- a/chromium/third_party/blink/renderer/core/css/threaded/css_parser_threaded_test.cc +++ b/chromium/third_party/blink/renderer/core/css/threaded/css_parser_threaded_test.cc @@ -6,9 +6,9 @@ #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/css_property_value_set.h" #include "third_party/blink/renderer/core/css/threaded/multi_threaded_test_util.h" -#include "third_party/blink/renderer/core/css_property_names.h" namespace blink { diff --git a/chromium/third_party/blink/renderer/core/css/threaded/css_to_length_conversion_data_threaded_test.cc b/chromium/third_party/blink/renderer/core/css/threaded/css_to_length_conversion_data_threaded_test.cc index 916e7e79fde..afa544e0650 100644 --- a/chromium/third_party/blink/renderer/core/css/threaded/css_to_length_conversion_data_threaded_test.cc +++ b/chromium/third_party/blink/renderer/core/css/threaded/css_to_length_conversion_data_threaded_test.cc @@ -8,7 +8,7 @@ #include "third_party/blink/renderer/core/css/threaded/multi_threaded_test_util.h" #include "third_party/blink/renderer/platform/fonts/font.h" #include "third_party/blink/renderer/platform/fonts/font_description.h" -#include "third_party/blink/renderer/platform/length.h" +#include "third_party/blink/renderer/platform/geometry/length.h" namespace blink { diff --git a/chromium/third_party/blink/renderer/core/css/threaded/font_object_threaded_test.cc b/chromium/third_party/blink/renderer/core/css/threaded/font_object_threaded_test.cc index c3351970cce..a22eac0d5db 100644 --- a/chromium/third_party/blink/renderer/core/css/threaded/font_object_threaded_test.cc +++ b/chromium/third_party/blink/renderer/core/css/threaded/font_object_threaded_test.cc @@ -130,16 +130,16 @@ TSAN_TEST(FontObjectThreadedTest, WordShaperTest) { CachingWordShapeIterator iter(&cache, text_run, &font); ASSERT_TRUE(iter.Next(&result)); - EXPECT_EQ(0u, result->StartIndexForResult()); - EXPECT_EQ(3u, result->EndIndexForResult()); + EXPECT_EQ(0u, result->StartIndex()); + EXPECT_EQ(3u, result->EndIndex()); ASSERT_TRUE(iter.Next(&result)); - EXPECT_EQ(0u, result->StartIndexForResult()); - EXPECT_EQ(1u, result->EndIndexForResult()); + EXPECT_EQ(0u, result->StartIndex()); + EXPECT_EQ(1u, result->EndIndex()); ASSERT_TRUE(iter.Next(&result)); - EXPECT_EQ(0u, result->StartIndexForResult()); - EXPECT_EQ(4u, result->EndIndexForResult()); + EXPECT_EQ(0u, result->StartIndex()); + EXPECT_EQ(4u, result->EndIndex()); ASSERT_FALSE(iter.Next(&result)); }); diff --git a/chromium/third_party/blink/renderer/core/css/threaded/multi_threaded_test_util.h b/chromium/third_party/blink/renderer/core/css/threaded/multi_threaded_test_util.h index c97cdc47cfd..b0e022ff97c 100644 --- a/chromium/third_party/blink/renderer/core/css/threaded/multi_threaded_test_util.h +++ b/chromium/third_party/blink/renderer/core/css/threaded/multi_threaded_test_util.h @@ -12,10 +12,10 @@ #include "base/single_thread_task_runner.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/platform/cross_thread_functional.h" +#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h" #include "third_party/blink/renderer/platform/waitable_event.h" -#include "third_party/blink/renderer/platform/web_task_runner.h" #include "third_party/blink/renderer/platform/web_thread_supporting_gc.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/ref_counted.h" |