diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-05-20 09:47:09 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-06-07 11:15:42 +0000 |
commit | 189d4fd8fad9e3c776873be51938cd31a42b6177 (patch) | |
tree | 6497caeff5e383937996768766ab3bb2081a40b2 /chromium/third_party/blink/renderer/core/css/properties | |
parent | 8bc75099d364490b22f43a7ce366b366c08f4164 (diff) | |
download | qtwebengine-chromium-189d4fd8fad9e3c776873be51938cd31a42b6177.tar.gz |
BASELINE: Update Chromium to 90.0.4430.221
Change-Id: Iff4d9d18d2fcf1a576f3b1f453010f744a232920
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/css/properties')
19 files changed, 1246 insertions, 980 deletions
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 22fb558d35f..8af2ba5d82f 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 @@ -330,69 +330,42 @@ const CSSValue* ComputedStyleUtils::BackgroundPositionYOrWebkitMaskPositionY( return list; } +static CSSNumericLiteralValue* ValueForImageSlice(const Length& slice) { + // TODO(alancutter): Make this code aware of calc lengths. + return CSSNumericLiteralValue::Create( + slice.Value(), slice.IsPercentOrCalc() + ? CSSPrimitiveValue::UnitType::kPercentage + : CSSPrimitiveValue::UnitType::kNumber); +} + cssvalue::CSSBorderImageSliceValue* ComputedStyleUtils::ValueForNinePieceImageSlice(const NinePieceImage& image) { + const LengthBox& slices = image.ImageSlices(); + // Create the slices. - CSSPrimitiveValue* top = nullptr; + CSSPrimitiveValue* top = ValueForImageSlice(slices.Top()); + CSSPrimitiveValue* right = nullptr; CSSPrimitiveValue* bottom = nullptr; CSSPrimitiveValue* left = nullptr; - - // TODO(alancutter): Make this code aware of calc lengths. - if (image.ImageSlices().Top().IsPercentOrCalc()) { - top = CSSNumericLiteralValue::Create( - image.ImageSlices().Top().Value(), - CSSPrimitiveValue::UnitType::kPercentage); - } else { - top = CSSNumericLiteralValue::Create(image.ImageSlices().Top().Value(), - CSSPrimitiveValue::UnitType::kNumber); - } - - if (image.ImageSlices().Right() == image.ImageSlices().Top() && - image.ImageSlices().Bottom() == image.ImageSlices().Top() && - image.ImageSlices().Left() == image.ImageSlices().Top()) { + if (slices.Right() == slices.Top() && slices.Bottom() == slices.Top() && + slices.Left() == slices.Top()) { right = top; bottom = top; left = top; } else { - if (image.ImageSlices().Right().IsPercentOrCalc()) { - right = CSSNumericLiteralValue::Create( - image.ImageSlices().Right().Value(), - CSSPrimitiveValue::UnitType::kPercentage); - } else { - right = - CSSNumericLiteralValue::Create(image.ImageSlices().Right().Value(), - CSSPrimitiveValue::UnitType::kNumber); - } + right = ValueForImageSlice(slices.Right()); - if (image.ImageSlices().Bottom() == image.ImageSlices().Top() && - image.ImageSlices().Right() == image.ImageSlices().Left()) { + if (slices.Bottom() == slices.Top() && slices.Right() == slices.Left()) { bottom = top; left = right; } else { - if (image.ImageSlices().Bottom().IsPercentOrCalc()) { - bottom = CSSNumericLiteralValue::Create( - image.ImageSlices().Bottom().Value(), - CSSPrimitiveValue::UnitType::kPercentage); - } else { - bottom = CSSNumericLiteralValue::Create( - image.ImageSlices().Bottom().Value(), - CSSPrimitiveValue::UnitType::kNumber); - } + bottom = ValueForImageSlice(slices.Bottom()); - if (image.ImageSlices().Left() == image.ImageSlices().Right()) { + if (slices.Left() == slices.Right()) left = right; - } else { - if (image.ImageSlices().Left().IsPercentOrCalc()) { - left = CSSNumericLiteralValue::Create( - image.ImageSlices().Left().Value(), - CSSPrimitiveValue::UnitType::kPercentage); - } else { - left = CSSNumericLiteralValue::Create( - image.ImageSlices().Left().Value(), - CSSPrimitiveValue::UnitType::kNumber); - } - } + else + left = ValueForImageSlice(slices.Left()); } } @@ -590,12 +563,14 @@ CSSValue* ComputedStyleUtils::ValueForPositionOffset( if (offset.IsPercentOrCalc() && box && layout_object->IsPositioned()) { LayoutUnit containing_block_size; if (layout_object->IsStickyPositioned()) { - const LayoutBox& enclosing_scrollport_box = box->EnclosingScrollportBox(); - bool use_inline_size = is_horizontal_property == - enclosing_scrollport_box.IsHorizontalWritingMode(); + const LayoutBox* enclosing_scrollport_box = box->EnclosingScrollportBox(); + DCHECK(enclosing_scrollport_box); + bool use_inline_size = + is_horizontal_property == + enclosing_scrollport_box->IsHorizontalWritingMode(); containing_block_size = - use_inline_size ? enclosing_scrollport_box.ContentLogicalWidth() - : enclosing_scrollport_box.ContentLogicalHeight(); + use_inline_size ? enclosing_scrollport_box->ContentLogicalWidth() + : enclosing_scrollport_box->ContentLogicalHeight(); } else { containing_block_size = is_horizontal_property == @@ -1365,6 +1340,8 @@ CSSValue* ComputedStyleUtils::ValueForGridTrackList( : style.GridTemplateRows().LegacyTrackList(); const Vector<GridTrackSize>& auto_repeat_track_sizes = is_row_axis ? style.GridAutoRepeatColumns() : style.GridAutoRepeatRows(); + + // TODO(crbug.com/1045599): Implement similar logic for GridNG. bool is_layout_grid = layout_object && layout_object->IsLayoutGrid(); // Handle the 'none' case. @@ -1374,8 +1351,8 @@ CSSValue* ComputedStyleUtils::ValueForGridTrackList( // For grids we should consider every listed track, whether implicitly or // explicitly created. Empty grids have a sole grid line per axis. auto& positions = is_row_axis - ? ToLayoutGrid(layout_object)->ColumnPositions() - : ToLayoutGrid(layout_object)->RowPositions(); + ? To<LayoutGrid>(layout_object)->ColumnPositions() + : To<LayoutGrid>(layout_object)->RowPositions(); track_list_is_empty = positions.size() == 1; } @@ -1387,7 +1364,7 @@ CSSValue* ComputedStyleUtils::ValueForGridTrackList( // If the element is a grid container, the resolved value is the used value, // specifying track sizes in pixels and expanding the repeat() notation. if (is_layout_grid) { - const auto* grid = ToLayoutGrid(layout_object); + const auto* grid = To<LayoutGrid>(layout_object); OrderedNamedLinesCollectorInGridLayout collector( style, is_row_axis, grid->AutoRepeatCountForDirection(direction), auto_repeat_track_sizes.size()); @@ -2048,22 +2025,13 @@ CSSValue* ComputedStyleUtils::ValueForContentData(const ComputedStyle& style, for (const ContentData* content_data = style.GetContentData(); content_data; content_data = content_data->Next()) { if (content_data->IsCounter()) { - const CounterContent* counter = - To<CounterContentData>(content_data)->Counter(); - DCHECK(counter); + const CounterContentData& counter = To<CounterContentData>(*content_data); auto* identifier = - MakeGarbageCollected<CSSCustomIdentValue>(counter->Identifier()); + MakeGarbageCollected<CSSCustomIdentValue>(counter.Identifier()); auto* separator = - MakeGarbageCollected<CSSStringValue>(counter->Separator()); - CSSValueID list_style_ident = CSSValueID::kNone; - if (counter->ListStyle() != EListStyleType::kNone) { - // TODO(sashab): Change this to use a converter instead of - // CSSPrimitiveValueMappings. - list_style_ident = - CSSIdentifierValue::Create(counter->ListStyle())->GetValueID(); - } - CSSIdentifierValue* list_style = - CSSIdentifierValue::Create(list_style_ident); + MakeGarbageCollected<CSSStringValue>(counter.Separator()); + auto* list_style = + MakeGarbageCollected<CSSCustomIdentValue>(counter.ListStyle()); list->Append(*MakeGarbageCollected<cssvalue::CSSCounterValue>( identifier, list_style, separator)); } else if (content_data->IsImage()) { diff --git a/chromium/third_party/blink/renderer/core/css/properties/css_bitset.h b/chromium/third_party/blink/renderer/core/css/properties/css_bitset.h index 998864c8e6b..f9c92c7912d 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/css_bitset.h +++ b/chromium/third_party/blink/renderer/core/css/properties/css_bitset.h @@ -24,7 +24,7 @@ template <size_t kBits> class CORE_EXPORT CSSBitsetBase { public: static_assert( - kBits <= numCSSProperties, + kBits <= kNumCSSProperties, "Bit count must not exceed numCSSProperties, as each bit position must " "be representable as a CSSPropertyID"); @@ -98,7 +98,7 @@ class CORE_EXPORT CSSBitsetBase { } inline CSSPropertyID operator*() const { - DCHECK_LT(index_, static_cast<size_t>(numCSSProperties)); + DCHECK_LT(index_, static_cast<size_t>(kNumCSSProperties)); return static_cast<CSSPropertyID>(index_); } @@ -158,7 +158,7 @@ class CORE_EXPORT CSSBitsetBase { uint64_t chunks_[kChunks]; }; -using CSSBitset = CSSBitsetBase<numCSSProperties>; +using CSSBitset = CSSBitsetBase<kNumCSSProperties>; } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/css_bitset_test.cc b/chromium/third_party/blink/renderer/core/css/properties/css_bitset_test.cc index 020be2fafad..b6bf9753014 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/css_bitset_test.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/css_bitset_test.cc @@ -161,7 +161,7 @@ TEST(CSSBitsetTest, BaseBitCount129) { TEST(CSSBitsetTest, AllBits) { std::vector<size_t> all_bits; - for (size_t i = 0; i < numCSSProperties; ++i) + for (size_t i = 0; i < kNumCSSProperties; ++i) all_bits.push_back(i); AssertBitset<1>(all_bits.data(), all_bits.data() + 1); @@ -265,7 +265,7 @@ TEST(CSSBitsetTest, Iterator) { actual.Set(CSSPropertyID::kWidth); actual.Set(CSSPropertyID::kVariable); - std::bitset<numCSSProperties> expected; + std::bitset<kNumCSSProperties> expected; expected.set(static_cast<size_t>(CSSPropertyID::kHeight)); expected.set(static_cast<size_t>(CSSPropertyID::kWidth)); expected.set(static_cast<size_t>(CSSPropertyID::kVariable)); diff --git a/chromium/third_party/blink/renderer/core/css/properties/css_direction_aware_resolver.cc b/chromium/third_party/blink/renderer/core/css/properties/css_direction_aware_resolver.cc index 451c66bec37..3b1b6963106 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/css_direction_aware_resolver.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/css_direction_aware_resolver.cc @@ -11,110 +11,260 @@ namespace blink { namespace { template <size_t size> -using PhysicalGroup = CSSDirectionAwareResolver::PhysicalGroup<size>; +using LogicalMapping = CSSDirectionAwareResolver::LogicalMapping<size>; +template <size_t size> +using PhysicalMapping = CSSDirectionAwareResolver::PhysicalMapping<size>; enum PhysicalAxis { kPhysicalAxisX, kPhysicalAxisY }; enum PhysicalBoxSide { kTopSide, kRightSide, kBottomSide, kLeftSide }; +enum PhysicalBoxCorner { + kTopLeftCorner, + kTopRightCorner, + kBottomRightCorner, + kBottomLeftCorner +}; } // namespace template <size_t size> -CSSDirectionAwareResolver::PhysicalGroup<size>::PhysicalGroup( +CSSDirectionAwareResolver::Group<size>::Group( const StylePropertyShorthand& shorthand) : properties_(shorthand.properties()) { DCHECK_EQ(size, shorthand.length()); } template <size_t size> -CSSDirectionAwareResolver::PhysicalGroup<size>::PhysicalGroup( +CSSDirectionAwareResolver::Group<size>::Group( const CSSProperty* (&properties)[size]) : properties_(properties) {} template <size_t size> -const CSSProperty& CSSDirectionAwareResolver::PhysicalGroup<size>::GetProperty( +const CSSProperty& CSSDirectionAwareResolver::Group<size>::GetProperty( size_t index) const { DCHECK_LT(index, size); return *properties_[index]; } -PhysicalGroup<4> CSSDirectionAwareResolver::BorderGroup() { +template <size_t size> +bool CSSDirectionAwareResolver::Group<size>::Contains(CSSPropertyID id) const { + for (size_t i = 0; i < size; ++i) { + if (properties_[i]->IDEquals(id)) + return true; + } + return false; +} + +template class CSSDirectionAwareResolver::Group<2ul>; +template class CSSDirectionAwareResolver::Group<4ul>; + +LogicalMapping<4> CSSDirectionAwareResolver::LogicalBorderMapping() { + static const CSSProperty* kProperties[] = { + &GetCSSPropertyBorderBlockStart(), &GetCSSPropertyBorderBlockEnd(), + &GetCSSPropertyBorderInlineStart(), &GetCSSPropertyBorderInlineEnd()}; + return LogicalMapping<4>(kProperties); +} + +PhysicalMapping<4> CSSDirectionAwareResolver::PhysicalBorderMapping() { static const CSSProperty* kProperties[] = { &GetCSSPropertyBorderTop(), &GetCSSPropertyBorderRight(), &GetCSSPropertyBorderBottom(), &GetCSSPropertyBorderLeft()}; - return PhysicalGroup<4>(kProperties); + return PhysicalMapping<4>(kProperties); } -PhysicalGroup<4> CSSDirectionAwareResolver::BorderColorGroup() { - return PhysicalGroup<4>(borderColorShorthand()); +LogicalMapping<4> CSSDirectionAwareResolver::LogicalBorderColorMapping() { + static const CSSProperty* kProperties[] = { + &GetCSSPropertyBorderBlockStartColor(), + &GetCSSPropertyBorderBlockEndColor(), + &GetCSSPropertyBorderInlineStartColor(), + &GetCSSPropertyBorderInlineEndColor()}; + return LogicalMapping<4>(kProperties); } -PhysicalGroup<4> CSSDirectionAwareResolver::BorderStyleGroup() { - return PhysicalGroup<4>(borderStyleShorthand()); +PhysicalMapping<4> CSSDirectionAwareResolver::PhysicalBorderColorMapping() { + return PhysicalMapping<4>(borderColorShorthand()); } -PhysicalGroup<4> CSSDirectionAwareResolver::BorderWidthGroup() { - return PhysicalGroup<4>(borderWidthShorthand()); +LogicalMapping<4> CSSDirectionAwareResolver::LogicalBorderStyleMapping() { + static const CSSProperty* kProperties[] = { + &GetCSSPropertyBorderBlockStartStyle(), + &GetCSSPropertyBorderBlockEndStyle(), + &GetCSSPropertyBorderInlineStartStyle(), + &GetCSSPropertyBorderInlineEndStyle()}; + return LogicalMapping<4>(kProperties); } -PhysicalGroup<4> CSSDirectionAwareResolver::InsetGroup() { - return PhysicalGroup<4>(insetShorthand()); +PhysicalMapping<4> CSSDirectionAwareResolver::PhysicalBorderStyleMapping() { + return PhysicalMapping<4>(borderStyleShorthand()); } -PhysicalGroup<4> CSSDirectionAwareResolver::MarginGroup() { - return PhysicalGroup<4>(marginShorthand()); +LogicalMapping<4> CSSDirectionAwareResolver::LogicalBorderWidthMapping() { + static const CSSProperty* kProperties[] = { + &GetCSSPropertyBorderBlockStartWidth(), + &GetCSSPropertyBorderBlockEndWidth(), + &GetCSSPropertyBorderInlineStartWidth(), + &GetCSSPropertyBorderInlineEndWidth()}; + return LogicalMapping<4>(kProperties); +} + +LogicalMapping<4> CSSDirectionAwareResolver::LogicalBorderRadiusMapping() { + static const CSSProperty* kProperties[] = { + &GetCSSPropertyBorderStartStartRadius(), + &GetCSSPropertyBorderStartEndRadius(), + &GetCSSPropertyBorderEndStartRadius(), + &GetCSSPropertyBorderEndEndRadius()}; + return LogicalMapping<4>(kProperties); +} + +PhysicalMapping<4> CSSDirectionAwareResolver::PhysicalBorderRadiusMapping() { + return PhysicalMapping<4>(borderRadiusShorthand()); +} + +PhysicalMapping<4> CSSDirectionAwareResolver::PhysicalBorderWidthMapping() { + return PhysicalMapping<4>(borderWidthShorthand()); } -PhysicalGroup<2> CSSDirectionAwareResolver::MaxSizeGroup() { +LogicalMapping<4> CSSDirectionAwareResolver::LogicalInsetMapping() { + static const CSSProperty* kProperties[] = { + &GetCSSPropertyInsetBlockStart(), &GetCSSPropertyInsetBlockEnd(), + &GetCSSPropertyInsetInlineStart(), &GetCSSPropertyInsetInlineEnd()}; + return LogicalMapping<4>(kProperties); +} + +PhysicalMapping<4> CSSDirectionAwareResolver::PhysicalInsetMapping() { + return PhysicalMapping<4>(insetShorthand()); +} + +LogicalMapping<4> CSSDirectionAwareResolver::LogicalMarginMapping() { + static const CSSProperty* kProperties[] = { + &GetCSSPropertyMarginBlockStart(), &GetCSSPropertyMarginBlockEnd(), + &GetCSSPropertyMarginInlineStart(), &GetCSSPropertyMarginInlineEnd()}; + return LogicalMapping<4>(kProperties); +} + +PhysicalMapping<4> CSSDirectionAwareResolver::PhysicalMarginMapping() { + return PhysicalMapping<4>(marginShorthand()); +} + +LogicalMapping<2> CSSDirectionAwareResolver::LogicalMaxSizeMapping() { + static const CSSProperty* kProperties[] = {&GetCSSPropertyMaxBlockSize(), + &GetCSSPropertyMaxInlineSize()}; + return LogicalMapping<2>(kProperties); +} + +PhysicalMapping<2> CSSDirectionAwareResolver::PhysicalMaxSizeMapping() { static const CSSProperty* kProperties[] = {&GetCSSPropertyMaxWidth(), &GetCSSPropertyMaxHeight()}; - return PhysicalGroup<2>(kProperties); + return PhysicalMapping<2>(kProperties); } -PhysicalGroup<2> CSSDirectionAwareResolver::MinSizeGroup() { +LogicalMapping<2> CSSDirectionAwareResolver::LogicalMinSizeMapping() { + static const CSSProperty* kProperties[] = {&GetCSSPropertyMinBlockSize(), + &GetCSSPropertyMinInlineSize()}; + return LogicalMapping<2>(kProperties); +} + +PhysicalMapping<2> CSSDirectionAwareResolver::PhysicalMinSizeMapping() { static const CSSProperty* kProperties[] = {&GetCSSPropertyMinWidth(), &GetCSSPropertyMinHeight()}; - return PhysicalGroup<2>(kProperties); + return PhysicalMapping<2>(kProperties); +} + +LogicalMapping<2> CSSDirectionAwareResolver::LogicalOverflowMapping() { + static const CSSProperty* kProperties[] = {&GetCSSPropertyOverflowBlock(), + &GetCSSPropertyOverflowInline()}; + return LogicalMapping<2>(kProperties); +} + +PhysicalMapping<2> CSSDirectionAwareResolver::PhysicalOverflowMapping() { + return PhysicalMapping<2>(overflowShorthand()); +} + +LogicalMapping<2> +CSSDirectionAwareResolver::LogicalOverscrollBehaviorMapping() { + static const CSSProperty* kProperties[] = { + &GetCSSPropertyOverscrollBehaviorBlock(), + &GetCSSPropertyOverscrollBehaviorInline()}; + return LogicalMapping<2>(kProperties); +} + +PhysicalMapping<2> +CSSDirectionAwareResolver::PhysicalOverscrollBehaviorMapping() { + return PhysicalMapping<2>(overscrollBehaviorShorthand()); +} + +LogicalMapping<4> CSSDirectionAwareResolver::LogicalPaddingMapping() { + static const CSSProperty* kProperties[] = { + &GetCSSPropertyPaddingBlockStart(), &GetCSSPropertyPaddingBlockEnd(), + &GetCSSPropertyPaddingInlineStart(), &GetCSSPropertyPaddingInlineEnd()}; + return LogicalMapping<4>(kProperties); } -PhysicalGroup<2> CSSDirectionAwareResolver::OverflowGroup() { - return PhysicalGroup<2>(overflowShorthand()); +PhysicalMapping<4> CSSDirectionAwareResolver::PhysicalPaddingMapping() { + return PhysicalMapping<4>(paddingShorthand()); } -PhysicalGroup<2> CSSDirectionAwareResolver::OverscrollBehaviorGroup() { - return PhysicalGroup<2>(overscrollBehaviorShorthand()); +LogicalMapping<4> CSSDirectionAwareResolver::LogicalScrollMarginMapping() { + static const CSSProperty* kProperties[] = { + &GetCSSPropertyScrollMarginBlockStart(), + &GetCSSPropertyScrollMarginBlockEnd(), + &GetCSSPropertyScrollMarginInlineStart(), + &GetCSSPropertyScrollMarginInlineEnd()}; + return LogicalMapping<4>(kProperties); } -PhysicalGroup<4> CSSDirectionAwareResolver::PaddingGroup() { - return PhysicalGroup<4>(paddingShorthand()); +PhysicalMapping<4> CSSDirectionAwareResolver::PhysicalScrollMarginMapping() { + return PhysicalMapping<4>(scrollMarginShorthand()); } -PhysicalGroup<4> CSSDirectionAwareResolver::ScrollMarginGroup() { - return PhysicalGroup<4>(scrollMarginShorthand()); +LogicalMapping<4> CSSDirectionAwareResolver::LogicalScrollPaddingMapping() { + static const CSSProperty* kProperties[] = { + &GetCSSPropertyScrollPaddingBlockStart(), + &GetCSSPropertyScrollPaddingBlockEnd(), + &GetCSSPropertyScrollPaddingInlineStart(), + &GetCSSPropertyScrollPaddingInlineEnd()}; + return LogicalMapping<4>(kProperties); } -PhysicalGroup<4> CSSDirectionAwareResolver::ScrollPaddingGroup() { - return PhysicalGroup<4>(scrollPaddingShorthand()); +PhysicalMapping<4> CSSDirectionAwareResolver::PhysicalScrollPaddingMapping() { + return PhysicalMapping<4>(scrollPaddingShorthand()); } -PhysicalGroup<2> CSSDirectionAwareResolver::SizeGroup() { +LogicalMapping<2> CSSDirectionAwareResolver::LogicalSizeMapping() { + static const CSSProperty* kProperties[] = {&GetCSSPropertyBlockSize(), + &GetCSSPropertyInlineSize()}; + return LogicalMapping<2>(kProperties); +} + +PhysicalMapping<2> CSSDirectionAwareResolver::PhysicalSizeMapping() { static const CSSProperty* kProperties[] = {&GetCSSPropertyWidth(), &GetCSSPropertyHeight()}; - return PhysicalGroup<2>(kProperties); + return PhysicalMapping<2>(kProperties); +} + +LogicalMapping<4> +CSSDirectionAwareResolver::LogicalVisitedBorderColorMapping() { + static const CSSProperty* kProperties[] = { + &GetCSSPropertyInternalVisitedBorderBlockStartColor(), + &GetCSSPropertyInternalVisitedBorderBlockEndColor(), + &GetCSSPropertyInternalVisitedBorderInlineStartColor(), + &GetCSSPropertyInternalVisitedBorderInlineEndColor()}; + return LogicalMapping<4>(kProperties); } -PhysicalGroup<4> CSSDirectionAwareResolver::VisitedBorderColorGroup() { +PhysicalMapping<4> +CSSDirectionAwareResolver::PhysicalVisitedBorderColorMapping() { static const CSSProperty* kProperties[] = { &GetCSSPropertyInternalVisitedBorderTopColor(), &GetCSSPropertyInternalVisitedBorderRightColor(), &GetCSSPropertyInternalVisitedBorderBottomColor(), &GetCSSPropertyInternalVisitedBorderLeftColor()}; - return PhysicalGroup<4>(kProperties); + return PhysicalMapping<4>(kProperties); } const CSSProperty& CSSDirectionAwareResolver::ResolveInlineStart( TextDirection direction, WritingMode writing_mode, - const PhysicalGroup<4>& group) { + const PhysicalMapping<4>& group) { if (direction == TextDirection::kLtr) { if (IsHorizontalWritingMode(writing_mode)) return group.GetProperty(kLeftSide); @@ -128,7 +278,7 @@ const CSSProperty& CSSDirectionAwareResolver::ResolveInlineStart( const CSSProperty& CSSDirectionAwareResolver::ResolveInlineEnd( TextDirection direction, WritingMode writing_mode, - const PhysicalGroup<4>& group) { + const PhysicalMapping<4>& group) { if (direction == TextDirection::kLtr) { if (IsHorizontalWritingMode(writing_mode)) return group.GetProperty(kRightSide); @@ -142,7 +292,7 @@ const CSSProperty& CSSDirectionAwareResolver::ResolveInlineEnd( const CSSProperty& CSSDirectionAwareResolver::ResolveBlockStart( TextDirection direction, WritingMode writing_mode, - const PhysicalGroup<4>& group) { + const PhysicalMapping<4>& group) { if (IsHorizontalWritingMode(writing_mode)) return group.GetProperty(kTopSide); if (IsFlippedLinesWritingMode(writing_mode)) @@ -153,7 +303,7 @@ const CSSProperty& CSSDirectionAwareResolver::ResolveBlockStart( const CSSProperty& CSSDirectionAwareResolver::ResolveBlockEnd( TextDirection direction, WritingMode writing_mode, - const PhysicalGroup<4>& group) { + const PhysicalMapping<4>& group) { if (IsHorizontalWritingMode(writing_mode)) return group.GetProperty(kBottomSide); if (IsFlippedLinesWritingMode(writing_mode)) @@ -164,7 +314,7 @@ const CSSProperty& CSSDirectionAwareResolver::ResolveBlockEnd( const CSSProperty& CSSDirectionAwareResolver::ResolveInline( TextDirection, WritingMode writing_mode, - const PhysicalGroup<2>& group) { + const PhysicalMapping<2>& group) { if (IsHorizontalWritingMode(writing_mode)) return group.GetProperty(kPhysicalAxisX); return group.GetProperty(kPhysicalAxisY); @@ -173,10 +323,78 @@ const CSSProperty& CSSDirectionAwareResolver::ResolveInline( const CSSProperty& CSSDirectionAwareResolver::ResolveBlock( TextDirection, WritingMode writing_mode, - const PhysicalGroup<2>& group) { + const PhysicalMapping<2>& group) { if (IsHorizontalWritingMode(writing_mode)) return group.GetProperty(kPhysicalAxisY); return group.GetProperty(kPhysicalAxisX); } +const CSSProperty& CSSDirectionAwareResolver::ResolveStartStart( + TextDirection direction, + WritingMode writing_mode, + const PhysicalMapping<4>& group) { + if (direction == TextDirection::kLtr) { + if (IsHorizontalWritingMode(writing_mode) || + IsFlippedLinesWritingMode(writing_mode)) + return group.GetProperty(kTopLeftCorner); + return group.GetProperty(kTopRightCorner); + } + if (IsHorizontalWritingMode(writing_mode)) + return group.GetProperty(kTopRightCorner); + if (IsFlippedLinesWritingMode(writing_mode)) + return group.GetProperty(kBottomLeftCorner); + return group.GetProperty(kBottomRightCorner); +} + +const CSSProperty& CSSDirectionAwareResolver::ResolveStartEnd( + TextDirection direction, + WritingMode writing_mode, + const PhysicalMapping<4>& group) { + if (direction == TextDirection::kLtr) { + if (IsHorizontalWritingMode(writing_mode)) + return group.GetProperty(kTopRightCorner); + if (IsFlippedLinesWritingMode(writing_mode)) + return group.GetProperty(kBottomLeftCorner); + return group.GetProperty(kBottomRightCorner); + } + if (IsHorizontalWritingMode(writing_mode) || + IsFlippedLinesWritingMode(writing_mode)) + return group.GetProperty(kTopLeftCorner); + return group.GetProperty(kTopRightCorner); +} + +const CSSProperty& CSSDirectionAwareResolver::ResolveEndStart( + TextDirection direction, + WritingMode writing_mode, + const PhysicalMapping<4>& group) { + if (direction == TextDirection::kLtr) { + if (IsHorizontalWritingMode(writing_mode)) + return group.GetProperty(kBottomLeftCorner); + if (IsFlippedLinesWritingMode(writing_mode)) + return group.GetProperty(kTopRightCorner); + return group.GetProperty(kTopLeftCorner); + } + if (IsHorizontalWritingMode(writing_mode) || + IsFlippedLinesWritingMode(writing_mode)) + return group.GetProperty(kBottomRightCorner); + return group.GetProperty(kBottomLeftCorner); +} + +const CSSProperty& CSSDirectionAwareResolver::ResolveEndEnd( + TextDirection direction, + WritingMode writing_mode, + const PhysicalMapping<4>& group) { + if (direction == TextDirection::kLtr) { + if (IsHorizontalWritingMode(writing_mode) || + IsFlippedLinesWritingMode(writing_mode)) + return group.GetProperty(kBottomRightCorner); + return group.GetProperty(kBottomLeftCorner); + } + if (IsHorizontalWritingMode(writing_mode)) + return group.GetProperty(kBottomLeftCorner); + if (IsFlippedLinesWritingMode(writing_mode)) + return group.GetProperty(kTopRightCorner); + return group.GetProperty(kTopLeftCorner); +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/css_direction_aware_resolver.h b/chromium/third_party/blink/renderer/core/css/properties/css_direction_aware_resolver.h index 4340a49a9c1..b8fc2efebbb 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/css_direction_aware_resolver.h +++ b/chromium/third_party/blink/renderer/core/css/properties/css_direction_aware_resolver.h @@ -11,65 +11,163 @@ namespace blink { +enum class CSSPropertyID; class CSSProperty; class StylePropertyShorthand; class CSSDirectionAwareResolver { STATIC_ONLY(CSSDirectionAwareResolver); - public: - // A group of physical properties that's used by the 'Resolve*' functions - // to convert a direction-aware property into a physical property. + private: template <size_t size> - class PhysicalGroup { + class Group { public: - PhysicalGroup(const StylePropertyShorthand&); - PhysicalGroup(const CSSProperty* (&properties)[size]); + explicit Group(const StylePropertyShorthand&); + explicit Group(const CSSProperty* (&properties)[size]); const CSSProperty& GetProperty(size_t index) const; + bool Contains(CSSPropertyID) const; private: const CSSProperty** properties_; }; - static PhysicalGroup<4> BorderGroup(); - static PhysicalGroup<4> BorderColorGroup(); - static PhysicalGroup<4> BorderStyleGroup(); - static PhysicalGroup<4> BorderWidthGroup(); - static PhysicalGroup<4> InsetGroup(); - static PhysicalGroup<4> MarginGroup(); - static PhysicalGroup<2> MaxSizeGroup(); - static PhysicalGroup<2> MinSizeGroup(); - static PhysicalGroup<2> OverflowGroup(); - static PhysicalGroup<2> OverscrollBehaviorGroup(); - static PhysicalGroup<4> PaddingGroup(); - static PhysicalGroup<4> ScrollMarginGroup(); - static PhysicalGroup<4> ScrollPaddingGroup(); - static PhysicalGroup<2> SizeGroup(); - static PhysicalGroup<4> VisitedBorderColorGroup(); - - // These resolvers expect a PhysicalGroup with box sides, in the following + public: + // A group of logical properties that's used by the 'Resolve*' functions + // to convert a physical property into a direction-aware property. + // It represents the properties in a logical property group [1] with + // a flow-relative mapping logic [2]. + // [1]: https://drafts.csswg.org/css-logical/#logical-property-group + // [2]: https://drafts.csswg.org/css-logical/#mapping-logic + template <size_t size> + class LogicalMapping : public Group<size> { + using Group<size>::Group; + }; + + // A group of physical properties that's used by the 'Resolve*' functions + // to convert a direction-aware property into a physical property. + // It represents the properties in a logical property group [1] with + // a physical mapping logic [2]. + // [1]: https://drafts.csswg.org/css-logical/#logical-property-group + // [2]: https://drafts.csswg.org/css-logical/#mapping-logic + template <size_t size> + class PhysicalMapping : public Group<size> { + using Group<size>::Group; + }; + + static LogicalMapping<4> LogicalBorderMapping(); + static LogicalMapping<4> LogicalBorderColorMapping(); + static LogicalMapping<4> LogicalBorderRadiusMapping(); + static LogicalMapping<4> LogicalBorderStyleMapping(); + static LogicalMapping<4> LogicalBorderWidthMapping(); + static LogicalMapping<4> LogicalInsetMapping(); + static LogicalMapping<4> LogicalMarginMapping(); + static LogicalMapping<2> LogicalMaxSizeMapping(); + static LogicalMapping<2> LogicalMinSizeMapping(); + static LogicalMapping<2> LogicalOverflowMapping(); + static LogicalMapping<2> LogicalOverscrollBehaviorMapping(); + static LogicalMapping<4> LogicalPaddingMapping(); + static LogicalMapping<4> LogicalScrollMarginMapping(); + static LogicalMapping<4> LogicalScrollPaddingMapping(); + static LogicalMapping<2> LogicalSizeMapping(); + static LogicalMapping<4> LogicalVisitedBorderColorMapping(); + + static PhysicalMapping<4> PhysicalBorderMapping(); + static PhysicalMapping<4> PhysicalBorderColorMapping(); + static PhysicalMapping<4> PhysicalBorderRadiusMapping(); + static PhysicalMapping<4> PhysicalBorderStyleMapping(); + static PhysicalMapping<4> PhysicalBorderWidthMapping(); + static PhysicalMapping<4> PhysicalInsetMapping(); + static PhysicalMapping<4> PhysicalMarginMapping(); + static PhysicalMapping<2> PhysicalMaxSizeMapping(); + static PhysicalMapping<2> PhysicalMinSizeMapping(); + static PhysicalMapping<2> PhysicalOverflowMapping(); + static PhysicalMapping<2> PhysicalOverscrollBehaviorMapping(); + static PhysicalMapping<4> PhysicalPaddingMapping(); + static PhysicalMapping<4> PhysicalScrollMarginMapping(); + static PhysicalMapping<4> PhysicalScrollPaddingMapping(); + static PhysicalMapping<2> PhysicalSizeMapping(); + static PhysicalMapping<4> PhysicalVisitedBorderColorMapping(); + + // These resolvers expect a PhysicalMapping with box sides, in the following // order: top, right, bottom, left. static const CSSProperty& ResolveInlineStart(TextDirection, WritingMode, - const PhysicalGroup<4>&); + const PhysicalMapping<4>&); static const CSSProperty& ResolveInlineEnd(TextDirection, WritingMode, - const PhysicalGroup<4>&); + const PhysicalMapping<4>&); static const CSSProperty& ResolveBlockStart(TextDirection, WritingMode, - const PhysicalGroup<4>&); + const PhysicalMapping<4>&); static const CSSProperty& ResolveBlockEnd(TextDirection, WritingMode, - const PhysicalGroup<4>&); + const PhysicalMapping<4>&); - // These resolvers expect a PhysicalGroup with dimensions, in the following + // These resolvers expect a LogicalMapping with box sides, in the following + // order: block-start, block-end, inline-start, inline-end. + // TODO(layout-dev): Implement them, if needed. + static const CSSProperty& ResolveTop(TextDirection, + WritingMode, + const LogicalMapping<4>&); + static const CSSProperty& ResolveBottom(TextDirection, + WritingMode, + const LogicalMapping<4>&); + static const CSSProperty& ResolveLeft(TextDirection, + WritingMode, + const LogicalMapping<4>&); + static const CSSProperty& ResolveRight(TextDirection, + WritingMode, + const LogicalMapping<4>&); + + // These resolvers expect a PhysicalMapping with dimensions, in the following // order: horizontal, vertical. static const CSSProperty& ResolveInline(TextDirection, WritingMode, - const PhysicalGroup<2>&); + const PhysicalMapping<2>&); static const CSSProperty& ResolveBlock(TextDirection, WritingMode, - const PhysicalGroup<2>&); + const PhysicalMapping<2>&); + + // These resolvers expect a LogicalMapping with dimensions, in the following + // order: block, inline. + // TODO(layout-dev): Implement them, if needed. + static const CSSProperty& ResolveHorizontal(TextDirection, + WritingMode, + const LogicalMapping<2>&); + static const CSSProperty& ResolveVertical(TextDirection, + WritingMode, + const LogicalMapping<2>&); + + // These resolvers expect a a PhysicalMapping with box corners, in the + // following order: top-left, top-right, bottom-right, bottom-left. + static const CSSProperty& ResolveStartStart(TextDirection, + WritingMode, + const PhysicalMapping<4>&); + static const CSSProperty& ResolveStartEnd(TextDirection, + WritingMode, + const PhysicalMapping<4>&); + static const CSSProperty& ResolveEndStart(TextDirection, + WritingMode, + const PhysicalMapping<4>&); + static const CSSProperty& ResolveEndEnd(TextDirection, + WritingMode, + const PhysicalMapping<4>&); + + // These resolvers expect a a LogicalMapping with box corners, in the + // following order: start-start, start-end, end-start, end-end. + // TODO(layout-dev): Implement them, if needed. + static const CSSProperty& ResolveTopLeft(TextDirection, + WritingMode, + const LogicalMapping<4>&); + static const CSSProperty& ResolveTopRight(TextDirection, + WritingMode, + const LogicalMapping<4>&); + static const CSSProperty& ResolveBottomRight(TextDirection, + WritingMode, + const LogicalMapping<4>&); + static const CSSProperty& ResolveBottomLeft(TextDirection, + WritingMode, + const LogicalMapping<4>&); }; } // namespace blink 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 d169af4d044..da5eebcb425 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 @@ -7,6 +7,7 @@ #include <memory> #include <utility> +#include "third_party/blink/renderer/core/css/counter_style_map.h" #include "third_party/blink/renderer/core/css/css_axis_value.h" #include "third_party/blink/renderer/core/css/css_basic_shape_values.h" #include "third_party/blink/renderer/core/css/css_border_image.h" @@ -69,6 +70,7 @@ #include "third_party/blink/renderer/platform/geometry/length.h" #include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/instrumentation/use_counter.h" +#include "third_party/blink/renderer/platform/loader/fetch/fetch_initiator_type_names.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" @@ -2163,28 +2165,29 @@ static CSSValue* ConsumeGeneratedImage(CSSParserTokenRange& range, return result; } -static CSSValue* CreateCSSImageValueWithReferrer( +static CSSImageValue* CreateCSSImageValueWithReferrer( const AtomicString& raw_value, const CSSParserContext& context) { - CSSValue* image_value = MakeGarbageCollected<CSSImageValue>( + return MakeGarbageCollected<CSSImageValue>( raw_value, context.CompleteURL(raw_value), context.GetReferrer(), context.IsOriginClean() ? OriginClean::kTrue : OriginClean::kFalse, context.IsAdRelated()); - return image_value; } static CSSValue* ConsumeImageSet(CSSParserTokenRange& range, const CSSParserContext& context) { CSSParserTokenRange range_copy = range; CSSParserTokenRange args = ConsumeFunction(range_copy); - auto* image_set = MakeGarbageCollected<CSSImageSetValue>(context.Mode()); + auto* image_set = MakeGarbageCollected<CSSImageSetValue>(); do { AtomicString url_value = ConsumeUrlAsStringView(args, context).ToAtomicString(); if (url_value.IsNull()) return nullptr; - CSSValue* image = CreateCSSImageValueWithReferrer(url_value, context); + CSSImageValue* image = CreateCSSImageValueWithReferrer(url_value, context); + if (context.Mode() == kUASheetMode) + image->SetInitiator(fetch_initiator_type_names::kUacss); image_set->Append(*image); const CSSParserToken& token = args.ConsumeIncludingWhitespace(); @@ -2251,14 +2254,14 @@ void AddProperty(CSSPropertyID resolved_property, bool important, IsImplicitProperty implicit, HeapVector<CSSPropertyValue, 256>& properties) { - DCHECK(!isPropertyAlias(resolved_property)); + DCHECK(!IsPropertyAlias(resolved_property)); DCHECK(implicit == IsImplicitProperty::kNotImplicit || implicit == IsImplicitProperty::kImplicit); int shorthand_index = 0; bool set_from_shorthand = false; - if (isValidCSSPropertyID(current_shorthand)) { + if (IsValidCSSPropertyID(current_shorthand)) { Vector<StylePropertyShorthand, 4> shorthands; getMatchingShorthandsForLonghand(resolved_property, &shorthands); set_from_shorthand = true; @@ -2408,7 +2411,7 @@ const CSSValue* ParseLonghand(CSSPropertyID unresolved_property, CSSPropertyID current_shorthand, const CSSParserContext& context, CSSParserTokenRange& range) { - CSSPropertyID property_id = resolveCSSPropertyID(unresolved_property); + CSSPropertyID property_id = ResolveCSSPropertyID(unresolved_property); DCHECK(!CSSProperty::Get(property_id).IsShorthand()); if (CSSParserFastPaths::IsKeywordPropertyID(property_id)) { if (CSSParserFastPaths::IsValidKeywordPropertyAndValue( @@ -2417,14 +2420,12 @@ const CSSValue* ParseLonghand(CSSPropertyID unresolved_property, return ConsumeIdent(range); } - // Some properties need to fallback onto the regular parser. - if (!CSSParserFastPaths::IsPartialKeywordPropertyID(property_id)) - return nullptr; + return nullptr; } const auto local_context = CSSParserLocalContext() - .WithAliasParsing(isPropertyAlias(unresolved_property)) + .WithAliasParsing(IsPropertyAlias(unresolved_property)) .WithCurrentShorthand(current_shorthand); const CSSValue* result = To<Longhand>(CSSProperty::Get(property_id)) @@ -4803,7 +4804,7 @@ CSSValue* ConsumeTransitionProperty(CSSParserTokenRange& range, if (unresolved_property != CSSPropertyID::kInvalid && unresolved_property != CSSPropertyID::kVariable) { #if DCHECK_IS_ON() - DCHECK(CSSProperty::Get(resolveCSSPropertyID(unresolved_property)) + DCHECK(CSSProperty::Get(ResolveCSSPropertyID(unresolved_property)) .IsWebExposed(execution_context)); #endif range.ConsumeIncludingWhitespace(); @@ -4847,8 +4848,8 @@ CSSValue* ParseSpacing(CSSParserTokenRange& range, return ConsumeLength(range, context, kValueRangeAll, UnitlessQuirk::kAllow); } -CSSValue* ParsePaintStroke(CSSParserTokenRange& range, - const CSSParserContext& context) { +CSSValue* ConsumeSVGPaint(CSSParserTokenRange& range, + const CSSParserContext& context) { if (range.Peek().Id() == CSSValueID::kNone) return ConsumeIdent(range); cssvalue::CSSURIValue* url = ConsumeUrl(range, context); @@ -4877,5 +4878,61 @@ UnitlessQuirk UnitlessUnlessShorthand( : UnitlessQuirk::kForbid; } +bool ShouldLowerCaseCounterStyleNameOnParse(const AtomicString& name, + const CSSParserContext& context) { + DCHECK(RuntimeEnabledFeatures::CSSAtRuleCounterStyleEnabled()); + + if (context.Mode() == kUASheetMode) { + // Names in UA sheet should be already in lower case. + DCHECK_EQ(name, name.LowerASCII()); + return false; + } + return CounterStyleMap::GetUACounterStyleMap()->FindCounterStyleAcrossScopes( + name.LowerASCII()); +} + +CSSCustomIdentValue* ConsumeCounterStyleName(CSSParserTokenRange& range, + const CSSParserContext& context) { + DCHECK(RuntimeEnabledFeatures::CSSAtRuleCounterStyleEnabled()); + + CSSParserTokenRange original_range = range; + + // <counter-style-name> is a <custom-ident> that is not an ASCII + // case-insensitive match for "none". + const CSSParserToken& name_token = range.ConsumeIncludingWhitespace(); + if (name_token.GetType() != kIdentToken || + !css_parsing_utils::IsCustomIdent<CSSValueID::kNone>(name_token.Id())) { + range = original_range; + return nullptr; + } + + AtomicString name(name_token.Value().ToString()); + if (ShouldLowerCaseCounterStyleNameOnParse(name, context)) + name = name.LowerASCII(); + return MakeGarbageCollected<CSSCustomIdentValue>(name); +} + +AtomicString ConsumeCounterStyleNameInPrelude(CSSParserTokenRange& prelude, + const CSSParserContext& context) { + const CSSParserToken& name_token = prelude.ConsumeIncludingWhitespace(); + if (!prelude.AtEnd()) + return g_null_atom; + + if (name_token.GetType() != kIdentToken || + !IsCustomIdent<CSSValueID::kNone>(name_token.Id())) + return g_null_atom; + + if (context.Mode() != kUASheetMode) { + if (name_token.Id() == CSSValueID::kDecimal || + name_token.Id() == CSSValueID::kDisc) + return g_null_atom; + } + + AtomicString name(name_token.Value().ToString()); + if (ShouldLowerCaseCounterStyleNameOnParse(name, context)) + name = name.LowerASCII(); + return name; +} + } // 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 543a8615638..ac372d91226 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 @@ -444,11 +444,22 @@ CSSValue* ConsumeBorderColorSide(CSSParserTokenRange&, CSSValue* ConsumeBorderWidth(CSSParserTokenRange&, const CSSParserContext&, UnitlessQuirk); -CSSValue* ParsePaintStroke(CSSParserTokenRange&, const CSSParserContext&); +CSSValue* ConsumeSVGPaint(CSSParserTokenRange&, const CSSParserContext&); CSSValue* ParseSpacing(CSSParserTokenRange&, const CSSParserContext&); UnitlessQuirk UnitlessUnlessShorthand(const CSSParserLocalContext&); +// https://drafts.csswg.org/css-counter-styles-3/#typedef-counter-style-name +CSSCustomIdentValue* ConsumeCounterStyleName(CSSParserTokenRange&, + const CSSParserContext&); +AtomicString ConsumeCounterStyleNameInPrelude(CSSParserTokenRange&, + const CSSParserContext&); + +// When parsing a counter style name, it should be ASCII lowercased if it's an +// ASCII case-insensitive match of any predefined counter style name. +bool ShouldLowerCaseCounterStyleNameOnParse(const AtomicString&, + const CSSParserContext&); + // Template implementations are at the bottom of the file for readability. template <typename... emptyBaseCase> diff --git a/chromium/third_party/blink/renderer/core/css/properties/css_property.cc b/chromium/third_party/blink/renderer/core/css/properties/css_property.cc index af17d6cc31b..ac97989bd73 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/css_property.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/css_property.cc @@ -9,7 +9,6 @@ #include "third_party/blink/renderer/core/css/cssom/style_value_factory.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/core/style/svg_computed_style.h" #include "third_party/blink/renderer/core/style_property_shorthand.h" namespace blink { @@ -20,7 +19,7 @@ const CSSProperty& GetCSSPropertyVariable() { const CSSProperty& CSSProperty::Get(CSSPropertyID id) { DCHECK_NE(id, CSSPropertyID::kInvalid); - DCHECK_LE(id, lastCSSProperty); // last property id + DCHECK_LE(id, kLastCSSProperty); // last property id return To<CSSProperty>(CSSUnresolvedProperty::GetNonAliasProperty(id)); } @@ -45,11 +44,10 @@ const CSSValue* CSSProperty::CSSValueFromComputedStyle( const ComputedStyle& style, const LayoutObject* layout_object, bool allow_visited_style) const { - const SVGComputedStyle& svg_style = style.SvgStyle(); const CSSProperty& resolved_property = ResolveDirectionAwareProperty(style.Direction(), style.GetWritingMode()); return resolved_property.CSSValueFromComputedStyleInternal( - style, svg_style, layout_object, allow_visited_style); + style, layout_object, allow_visited_style); } void CSSProperty::FilterWebExposedCSSPropertiesIntoVector( diff --git a/chromium/third_party/blink/renderer/core/css/properties/css_property.h b/chromium/third_party/blink/renderer/core/css/properties/css_property.h index f50158c64fb..f44487e025d 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/css_property.h +++ b/chromium/third_party/blink/renderer/core/css/properties/css_property.h @@ -8,6 +8,7 @@ #include <memory> #include "third_party/blink/renderer/core/css/css_property_name.h" #include "third_party/blink/renderer/core/css/css_value.h" +#include "third_party/blink/renderer/core/css/properties/css_direction_aware_resolver.h" #include "third_party/blink/renderer/core/css/properties/css_unresolved_property.h" #include "third_party/blink/renderer/platform/heap/heap_allocator.h" #include "third_party/blink/renderer/platform/text/text_direction.h" @@ -21,7 +22,6 @@ class ComputedStyle; class CrossThreadStyleValue; class ExecutionContext; class LayoutObject; -class SVGComputedStyle; class CORE_EXPORT CSSProperty : public CSSUnresolvedProperty { public: @@ -58,10 +58,10 @@ class CORE_EXPORT CSSProperty : public CSSUnresolvedProperty { bool AffectsFont() const { return flags_ & kAffectsFont; } bool IsBackground() const { return flags_ & kBackground; } bool IsBorder() const { return flags_ & kBorder; } - bool IsComputedValueComparable() const { - return flags_ & kComputedValueComparable; - } bool TakesTreeScopedValue() const { return flags_ & kTreeScopedValue; } + bool IsInLogicalPropertyGroup() const { + return flags_ & kInLogicalPropertyGroup; + } bool IsRepeated() const { return repetition_separator_ != '\0'; } char RepetitionSeparator() const { return repetition_separator_; } @@ -75,16 +75,8 @@ class CORE_EXPORT CSSProperty : public CSSUnresolvedProperty { return false; } - virtual bool ComputedValuesEqual(const ComputedStyle&, - const ComputedStyle&) const { - // May only be called if IsComputedValueComparable() is true. - NOTREACHED(); - return false; - } - virtual const CSSValue* CSSValueFromComputedStyleInternal( const ComputedStyle&, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return nullptr; @@ -100,6 +92,10 @@ class CORE_EXPORT CSSProperty : public CSSUnresolvedProperty { WritingMode) const { return *this; } + virtual bool IsInSameLogicalPropertyGroupWithDifferentMappingLogic( + CSSPropertyID) const { + return false; + } virtual const CSSProperty* GetVisitedProperty() const { return nullptr; } virtual const CSSProperty* GetUnvisitedProperty() const { return nullptr; } @@ -145,12 +141,12 @@ class CORE_EXPORT CSSProperty : public CSSUnresolvedProperty { // element, the native appearance must be disabled. kBackground = 1 << 15, kBorder = 1 << 16, - // Set if ComputedValuesEqual is implemented for the given CSSProperty. - kComputedValueComparable = 1 << 17, // Set if the property values are tree-scoped references. - kTreeScopedValue = 1 << 18, + kTreeScopedValue = 1 << 17, // https://drafts.csswg.org/css-pseudo-4/#highlight-styling - kValidForHighlight = 1 << 19, + kValidForHighlight = 1 << 18, + // https://drafts.csswg.org/css-logical/#logical-property-group + kInLogicalPropertyGroup = 1 << 19, }; constexpr CSSProperty(CSSPropertyID property_id, diff --git a/chromium/third_party/blink/renderer/core/css/properties/css_property_methods.json5 b/chromium/third_party/blink/renderer/core/css/properties/css_property_methods.json5 index b3b00959700..326bc0e5cff 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/css_property_methods.json5 +++ b/chromium/third_party/blink/renderer/core/css/properties/css_property_methods.json5 @@ -32,7 +32,7 @@ { name: "CSSValueFromComputedStyleInternal", return_type: "const CSSValue*", - parameters: "(const ComputedStyle&, const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style)", + parameters: "(const ComputedStyle&, const LayoutObject*, bool allow_visited_style)", }, { name: "ColorIncludingFallback", 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 index 0cd1fdcae0a..d93f3fbdb7d 100644 --- 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 @@ -10,7 +10,7 @@ namespace blink { CSSPropertyRef::CSSPropertyRef(const String& name, const Document& document) : property_id_( - unresolvedCSSPropertyID(document.GetExecutionContext(), name)) { + UnresolvedCSSPropertyID(document.GetExecutionContext(), name)) { if (property_id_ == CSSPropertyID::kVariable) custom_property_ = CustomProperty(AtomicString(name), document); } 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 index c956e974602..6855c397af6 100644 --- 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 @@ -57,11 +57,11 @@ class CORE_EXPORT CSSPropertyRef { DCHECK(IsValid()); if (property_id_ == CSSPropertyID::kVariable) return custom_property_; - return CSSProperty::Get(resolveCSSPropertyID(property_id_)); + return CSSProperty::Get(ResolveCSSPropertyID(property_id_)); } const CSSUnresolvedProperty& GetUnresolvedProperty() const { - if (isPropertyAlias(property_id_)) + if (IsPropertyAlias(property_id_)) return *CSSUnresolvedProperty::GetAliasProperty(property_id_); return GetProperty(); } diff --git a/chromium/third_party/blink/renderer/core/css/properties/css_property_test.cc b/chromium/third_party/blink/renderer/core/css/properties/css_property_test.cc index 7495249acac..851f356e326 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/css_property_test.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/css_property_test.cc @@ -129,164 +129,18 @@ TEST_F(CSSPropertyTest, Surrogates) { WritingMode::kHorizontalTb)); } -TEST_F(CSSPropertyTest, ComputedValuesEqualsSelf) { - scoped_refptr<ComputedStyle> style = ComputedStyle::Create(); - - for (CSSPropertyID id : CSSPropertyIDList()) { - const CSSProperty& property = CSSProperty::Get(id); - if (!property.IsComputedValueComparable()) - continue; - EXPECT_TRUE(property.ComputedValuesEqual(*style, *style)); - } -} - -namespace { - -// Examples must produce unique computed values. For example, it's not -// allowed to list both 2px and calc(1px + 1px). -const char* align_content_examples[] = {"normal", "first baseline", "stretch", - "safe end", nullptr}; -const char* border_style_examples[] = {"none", "solid", "dashed", nullptr}; -const char* color_examples[] = {"red", "green", "#fef", "#faf", nullptr}; -const char* direction_examples[] = {"ltr", "rtl", nullptr}; -const char* flex_direction_examples[] = {"row", "column", nullptr}; -const char* flex_wrap_examples[] = {"nowrap", "wrap", nullptr}; -const char* float_examples[] = {"1", "2.5", nullptr}; -const char* justify_content_examples[] = {"normal", "stretch", "safe end", - "left", nullptr}; -const char* length_or_auto_examples[] = {"auto", "1px", "2px", "5%", nullptr}; -const char* length_or_none_examples[] = {"none", "1px", "2px", "5%", nullptr}; -const char* length_percentage_examples[] = {"1px", "2%", "calc(1% + 2px)", - nullptr}; -const char* length_size_examples[] = {"4px", "1px 2px", "3%", "calc(1% + 1px)", - nullptr}; -const char* line_width_examples[] = {"medium", "thin", "100px", nullptr}; -const char* none_auto_examples[] = {"none", "auto", nullptr}; -const char* self_align_examples[] = {"flex-start", "flex-end", "first baseline", - "safe end", nullptr}; -const char* text_decoration_line_examples[] = {"none", "underline", nullptr}; -const char* text_decoration_style_examples[] = {"solid", "dashed", nullptr}; -const char* vertical_align_examples[] = {"sub", "super", "1px", "3%", nullptr}; -const char* writing_mode_examples[] = {"horizontal-tb", "vertical-rl", nullptr}; - -struct ComputedValuesEqualData { - const char* name; - const char** examples; -} computed_values_equal_data[] = { - {"-webkit-writing-mode", writing_mode_examples}, - {"align-content", align_content_examples}, - {"align-items", self_align_examples}, - {"align-self", self_align_examples}, - {"border-bottom-color", color_examples}, - {"border-bottom-left-radius", length_size_examples}, - {"border-bottom-right-radius", length_size_examples}, - {"border-bottom-style", border_style_examples}, - {"border-bottom-width", line_width_examples}, - {"border-left-color", color_examples}, - {"border-left-style", border_style_examples}, - {"border-left-width", line_width_examples}, - {"border-right-color", color_examples}, - {"border-right-style", border_style_examples}, - {"border-right-width", line_width_examples}, - {"border-top-color", color_examples}, - {"border-top-left-radius", length_size_examples}, - {"border-top-right-radius", length_size_examples}, - {"border-top-style", border_style_examples}, - {"border-top-width", line_width_examples}, - {"bottom", length_or_auto_examples}, - {"direction", direction_examples}, - {"flex-basis", length_or_auto_examples}, - {"flex-direction", flex_direction_examples}, - {"flex-grow", float_examples}, - {"flex-shrink", float_examples}, - {"flex-wrap", flex_wrap_examples}, - {"height", length_or_auto_examples}, - {"justify-content", justify_content_examples}, - {"justify-items", self_align_examples}, - {"justify-self", self_align_examples}, - {"left", length_or_auto_examples}, - {"margin-bottom", length_or_auto_examples}, - {"margin-left", length_or_auto_examples}, - {"margin-right", length_or_auto_examples}, - {"margin-top", length_or_auto_examples}, - {"max-height", length_or_none_examples}, - {"max-width", length_or_none_examples}, - {"min-height", length_or_auto_examples}, - {"min-width", length_or_auto_examples}, - {"padding-bottom", length_percentage_examples}, - {"padding-left", length_percentage_examples}, - {"padding-right", length_percentage_examples}, - {"padding-top", length_percentage_examples}, - {"right", length_or_auto_examples}, - {"text-decoration-color", color_examples}, - {"text-decoration-line", text_decoration_line_examples}, - {"text-decoration-skip-ink", none_auto_examples}, - {"text-decoration-style", text_decoration_style_examples}, - {"text-decoration-thickness", length_or_auto_examples}, - {"top", length_or_auto_examples}, - {"vertical-align", vertical_align_examples}, - {"width", length_or_auto_examples}, - {"writing-mode", writing_mode_examples}, -}; - -} // namespace - -TEST_F(CSSPropertyTest, ComparablePropertiesAreListed) { - HashSet<String> names; - for (const auto& data : computed_values_equal_data) - names.insert(data.name); - - for (CSSPropertyID id : CSSPropertyIDList()) { - const CSSProperty& property = CSSProperty::Get(id); - EXPECT_TRUE(!property.IsComputedValueComparable() || - names.Contains(property.GetPropertyNameString())) - << property.GetPropertyNameString() << " missing"; - } -} - -// This test verifies the correctness of CSSProperty::ComputedValuesEqual for -// all properties that have the kComputedValueComparable flag. -class ComputedValuesEqual - : public CSSPropertyTest, - public testing::WithParamInterface<ComputedValuesEqualData> {}; - -INSTANTIATE_TEST_SUITE_P(CSSPropertyTest, - ComputedValuesEqual, - testing::ValuesIn(computed_values_equal_data)); - -TEST_P(ComputedValuesEqual, Examples) { - auto data = GetParam(); - - CSSPropertyRef ref(data.name, GetDocument()); - ASSERT_TRUE(ref.IsValid()) << data.name; - const CSSProperty& property = ref.GetProperty(); - ASSERT_TRUE(property.IsComputedValueComparable()) << data.name; - - // Convert const char* examples to CSSValues. - HeapVector<Member<const CSSValue>> values; - for (const char** example = data.examples; *example; ++example) { - const CSSValue* value = Parse(data.name, *example); - ASSERT_TRUE(value) << data.name << ":" << *example; - values.push_back(value); - } - - for (const CSSValue* value_a : values) { - for (const CSSValue* value_b : values) { - auto style_a = ComputedStyleWithValue(property, *value_a); - auto style_b = ComputedStyleWithValue(property, *value_b); - if (value_a == value_b) { - EXPECT_TRUE(property.ComputedValuesEqual(*style_a, *style_b)) - << property.GetPropertyNameString() - << ": expected equality between " << value_a->CssText() << " and " - << value_b->CssText(); - } else { - EXPECT_FALSE(property.ComputedValuesEqual(*style_a, *style_b)) - << property.GetPropertyNameString() - << ": expected non-equality between " << value_a->CssText() - << " and " << value_b->CssText(); - } - } - } +TEST_F(CSSPropertyTest, PairsWithIdenticalValues) { + const CSSValue* border_radius = css_test_helpers::ParseLonghand( + GetDocument(), GetCSSPropertyBorderTopLeftRadius(), "1% 1%"); + const CSSValue* perspective_origin = css_test_helpers::ParseLonghand( + GetDocument(), GetCSSPropertyPerspectiveOrigin(), "1% 1%"); + + // Border radius drops identical values + EXPECT_EQ("1%", border_radius->CssText()); + // Perspective origin keeps identical values + EXPECT_EQ("1% 1%", perspective_origin->CssText()); + // Therefore, the values are different + EXPECT_NE(*border_radius, *perspective_origin); } } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/css_unresolved_property.cc b/chromium/third_party/blink/renderer/core/css/properties/css_unresolved_property.cc index 901de0c53ae..904443d3438 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/css_unresolved_property.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/css_unresolved_property.cc @@ -27,8 +27,8 @@ const CSSUnresolvedProperty& CSSUnresolvedProperty::GetNonAliasProperty( const CSSUnresolvedProperty& CSSUnresolvedProperty::Get(CSSPropertyID id) { DCHECK_NE(id, CSSPropertyID::kInvalid); - DCHECK_LE(id, lastUnresolvedCSSProperty); - if (id <= lastCSSProperty) + DCHECK_LE(id, kLastUnresolvedCSSProperty); + if (id <= kLastCSSProperty) return GetNonAliasProperty(id); return *GetAliasProperty(id); } 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 index ddb9465d25a..8baa9775229 100644 --- 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 @@ -38,8 +38,7 @@ CustomProperty::CustomProperty(const AtomicString& name, CustomProperty::CustomProperty(const AtomicString& name, const PropertyRegistration* registration) - : Variable(InheritedFlag(registration) | - CSSProperty::kComputedValueComparable), + : Variable(InheritedFlag(registration)), name_(name), registration_(registration) {} @@ -156,23 +155,8 @@ const CSSValue* CustomProperty::ParseSingleValue( } } -bool CustomProperty::ComputedValuesEqual(const ComputedStyle& a, - const ComputedStyle& b) const { - if (registration_) { - const CSSValue* a_value = a.GetVariableValue(name_, IsInherited()); - const CSSValue* b_value = b.GetVariableValue(name_, IsInherited()); - if (!DataEquivalent(a_value, b_value)) - return false; - } - - CSSVariableData* a_data = a.GetVariableData(name_, IsInherited()); - CSSVariableData* b_data = b.GetVariableData(name_, IsInherited()); - return DataEquivalent(a_data, b_data); -} - const CSSValue* CustomProperty::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (registration_) { 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 index e847acf2a7b..2666dc84bd5 100644 --- 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 @@ -41,12 +41,8 @@ class CORE_EXPORT CustomProperty : public Variable { const CSSParserContext&, const CSSParserLocalContext&) const override; - bool ComputedValuesEqual(const ComputedStyle&, - const ComputedStyle&) const override; - const CSSValue* CSSValueFromComputedStyleInternal( const ComputedStyle&, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const override; 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 index 3adeb6553bd..ec5b1bed86b 100644 --- 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 @@ -87,38 +87,6 @@ TEST_F(CustomPropertyTest, GetPropertyNameAtomicString) { EXPECT_EQ(AtomicString("--x"), property.GetPropertyNameAtomicString()); } -TEST_F(CustomPropertyTest, ComputedValuesEqual) { - RegisterProperty(GetDocument(), "--y", "<length>", "100px", false); - - CustomProperty x("--x", GetDocument()); - CustomProperty y("--y", GetDocument()); - - SetElementWithStyle("--x:foo;--y:10px"); - auto style1 = ComputedStyle::Clone(GetComputedStyle()); - - SetElementWithStyle("--x:foo;--y:10px"); - auto style2 = ComputedStyle::Clone(GetComputedStyle()); - - SetElementWithStyle("--x:bar;--y:30px"); - auto style3 = ComputedStyle::Clone(GetComputedStyle()); - - ASSERT_TRUE(x.IsComputedValueComparable()); - EXPECT_TRUE(x.ComputedValuesEqual(*style1, *style1)); - EXPECT_TRUE(x.ComputedValuesEqual(*style2, *style2)); - EXPECT_TRUE(x.ComputedValuesEqual(*style1, *style2)); - EXPECT_TRUE(x.ComputedValuesEqual(*style2, *style1)); - EXPECT_FALSE(x.ComputedValuesEqual(*style1, *style3)); - EXPECT_FALSE(x.ComputedValuesEqual(*style2, *style3)); - - ASSERT_TRUE(y.IsComputedValueComparable()); - EXPECT_TRUE(y.ComputedValuesEqual(*style1, *style1)); - EXPECT_TRUE(y.ComputedValuesEqual(*style2, *style2)); - EXPECT_TRUE(y.ComputedValuesEqual(*style1, *style2)); - EXPECT_TRUE(y.ComputedValuesEqual(*style2, *style1)); - EXPECT_FALSE(y.ComputedValuesEqual(*style1, *style3)); - EXPECT_FALSE(y.ComputedValuesEqual(*style2, *style3)); -} - TEST_F(CustomPropertyTest, ComputedCSSValueUnregistered) { CustomProperty property("--x", GetDocument()); SetElementWithStyle("--x:foo"); diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc index aca3425b947..a50b34f73be 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc @@ -9,6 +9,7 @@ #include "third_party/blink/renderer/core/css/css_cursor_image_value.h" #include "third_party/blink/renderer/core/css/css_custom_ident_value.h" #include "third_party/blink/renderer/core/css/css_font_feature_value.h" +#include "third_party/blink/renderer/core/css/css_font_selector.h" #include "third_party/blink/renderer/core/css/css_font_variation_value.h" #include "third_party/blink/renderer/core/css/css_function_value.h" #include "third_party/blink/renderer/core/css/css_grid_template_areas_value.h" @@ -74,7 +75,6 @@ const CSSValue* AlignContent::ParseSingleValue( const CSSValue* AlignContent::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils:: @@ -95,7 +95,6 @@ const CSSValue* AlignItems::ParseSingleValue( const CSSValue* AlignItems::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForItemPositionWithOverflowAlignment( @@ -112,7 +111,6 @@ const CSSValue* AlignSelf::ParseSingleValue( const CSSValue* AlignSelf::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForItemPositionWithOverflowAlignment( @@ -120,10 +118,9 @@ const CSSValue* AlignSelf::CSSValueFromComputedStyleInternal( } const CSSValue* AlignmentBaseline::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return CSSIdentifierValue::Create(svg_style.AlignmentBaseline()); + return CSSIdentifierValue::Create(style.AlignmentBaseline()); } const CSSValue* AnimationDelay::ParseSingleValue( @@ -136,7 +133,6 @@ const CSSValue* AnimationDelay::ParseSingleValue( const CSSValue* AnimationDelay::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForAnimationDelay(style.Animations()); @@ -163,7 +159,6 @@ const CSSValue* AnimationDirection::ParseSingleValue( const CSSValue* AnimationDirection::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { CSSValueList* list = CSSValueList::CreateCommaSeparated(); @@ -195,7 +190,6 @@ const CSSValue* AnimationDuration::ParseSingleValue( const CSSValue* AnimationDuration::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForAnimationDuration(style.Animations()); @@ -222,7 +216,6 @@ const CSSValue* AnimationFillMode::ParseSingleValue( const CSSValue* AnimationFillMode::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { CSSValueList* list = CSSValueList::CreateCommaSeparated(); @@ -254,7 +247,6 @@ const CSSValue* AnimationIterationCount::ParseSingleValue( const CSSValue* AnimationIterationCount::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { CSSValueList* list = CSSValueList::CreateCommaSeparated(); @@ -291,7 +283,6 @@ const CSSValue* AnimationName::ParseSingleValue( const CSSValue* AnimationName::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { CSSValueList* list = CSSValueList::CreateCommaSeparated(); @@ -331,7 +322,6 @@ const CSSValue* AnimationPlayState::ParseSingleValue( const CSSValue* AnimationPlayState::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { CSSValueList* list = CSSValueList::CreateCommaSeparated(); @@ -363,7 +353,6 @@ const CSSValue* AnimationTimeline::ParseSingleValue( const CSSValue* AnimationTimeline::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { CSSValueList* list = CSSValueList::CreateCommaSeparated(); @@ -391,7 +380,6 @@ const CSSValue* AnimationTimingFunction::ParseSingleValue( const CSSValue* AnimationTimingFunction::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForAnimationTimingFunction( @@ -424,6 +412,8 @@ const CSSValue* AspectRatio::ParseSingleValue( if (css_parsing_utils::ConsumeSlashIncludingWhitespace(range)) { height = css_parsing_utils::ConsumeNumber(range, context, kValueRangeNonNegative); + if (!height) + return nullptr; } else { // A missing height is treated as 1. height = CSSNumericLiteralValue::Create( @@ -451,7 +441,6 @@ const CSSValue* AspectRatio::ParseSingleValue( const CSSValue* AspectRatio::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { auto& ratio = style.AspectRatio(); @@ -482,14 +471,20 @@ const CSSValue* BackdropFilter::ParseSingleValue( const CSSValue* BackdropFilter::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForFilter(style, style.BackdropFilter()); } + +void BackdropFilter::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + state.Style()->SetBackdropFilter( + StyleBuilderConverter::ConvertFilterOperations(state, value, + PropertyID())); +} + const CSSValue* BackfaceVisibility::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create( @@ -508,7 +503,6 @@ const CSSValue* BackgroundAttachment::ParseSingleValue( const CSSValue* BackgroundAttachment::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { CSSValueList* list = CSSValueList::CreateCommaSeparated(); @@ -528,7 +522,6 @@ const CSSValue* BackgroundBlendMode::ParseSingleValue( const CSSValue* BackgroundBlendMode::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { CSSValueList* list = CSSValueList::CreateCommaSeparated(); @@ -548,7 +541,6 @@ const CSSValue* BackgroundClip::ParseSingleValue( const CSSValue* BackgroundClip::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { CSSValueList* list = CSSValueList::CreateCommaSeparated(); @@ -572,13 +564,17 @@ const blink::Color BackgroundColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(!visited_link); - return style.BackgroundColor().Resolve(style.GetCurrentColor(), - style.UsedColorScheme()); + StyleColor background_color = style.BackgroundColor(); + if (style.ShouldForceColor(background_color)) { + return To<Longhand>(GetCSSPropertyInternalForcedBackgroundColor()) + .ColorIncludingFallback(false, style); + } + return background_color.Resolve(style.GetCurrentColor(), + style.UsedColorScheme()); } const CSSValue* BackgroundColor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (allow_visited_style) { @@ -586,10 +582,15 @@ const CSSValue* BackgroundColor::CSSValueFromComputedStyleInternal( style.VisitedDependentColor(*this).Rgb()); } + StyleColor background_color = style.BackgroundColor(); + if (style.ShouldForceColor(background_color)) { + return GetCSSPropertyInternalForcedBackgroundColor() + .CSSValueFromComputedStyle(style, nullptr, allow_visited_style); + } // https://drafts.csswg.org/cssom/#resolved-values // For this property, the resolved value is the used value. return ComputedStyleUtils::CurrentColorOrValidColor( - style, style.BackgroundColor(), CSSValuePhase::kUsedValue); + style, background_color, CSSValuePhase::kUsedValue); } const CSSValue* BackgroundImage::ParseSingleValue( @@ -602,7 +603,6 @@ const CSSValue* BackgroundImage::ParseSingleValue( const CSSValue* BackgroundImage::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { const FillLayer& fill_layer = style.BackgroundLayers(); @@ -620,7 +620,6 @@ const CSSValue* BackgroundOrigin::ParseSingleValue( const CSSValue* BackgroundOrigin::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { CSSValueList* list = CSSValueList::CreateCommaSeparated(); @@ -644,7 +643,6 @@ const CSSValue* BackgroundPositionX::ParseSingleValue( const CSSValue* BackgroundPositionX::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { const FillLayer* curr_layer = &style.BackgroundLayers(); @@ -664,7 +662,6 @@ const CSSValue* BackgroundPositionY::ParseSingleValue( const CSSValue* BackgroundPositionY::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { const FillLayer* curr_layer = &style.BackgroundLayers(); @@ -682,7 +679,6 @@ const CSSValue* BackgroundSize::ParseSingleValue( const CSSValue* BackgroundSize::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { const FillLayer& fill_layer = style.BackgroundLayers(); @@ -704,54 +700,49 @@ const CSSValue* BaselineShift::ParseSingleValue( const CSSValue* BaselineShift::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - switch (svg_style.BaselineShift()) { - case BS_SUPER: + switch (style.BaselineShiftType()) { + case EBaselineShiftType::kSuper: return CSSIdentifierValue::Create(CSSValueID::kSuper); - case BS_SUB: + case EBaselineShiftType::kSub: return CSSIdentifierValue::Create(CSSValueID::kSub); - case BS_LENGTH: + case EBaselineShiftType::kLength: return ComputedStyleUtils::ZoomAdjustedPixelValueForLength( - svg_style.BaselineShiftValue(), style); + style.BaselineShift(), style); } NOTREACHED(); return nullptr; } void BaselineShift::ApplyInherit(StyleResolverState& state) const { - const SVGComputedStyle& parent_svg_style = state.ParentStyle()->SvgStyle(); - EBaselineShift baseline_shift = parent_svg_style.BaselineShift(); - SVGComputedStyle& svg_style = state.Style()->AccessSVGStyle(); - svg_style.SetBaselineShift(baseline_shift); - if (baseline_shift == BS_LENGTH) - svg_style.SetBaselineShiftValue(parent_svg_style.BaselineShiftValue()); + state.Style()->SetBaselineShiftType(state.ParentStyle()->BaselineShiftType()); + state.Style()->SetBaselineShift(state.ParentStyle()->BaselineShift()); } void BaselineShift::ApplyValue(StyleResolverState& state, const CSSValue& value) const { - SVGComputedStyle& svg_style = state.Style()->AccessSVGStyle(); - auto* identifier_value = DynamicTo<CSSIdentifierValue>(value); - if (!identifier_value) { - svg_style.SetBaselineShift(BS_LENGTH); - svg_style.SetBaselineShiftValue(StyleBuilderConverter::ConvertLength( + if (auto* identifier_value = DynamicTo<CSSIdentifierValue>(value)) { + EBaselineShiftType baseline_shift_type = EBaselineShiftType::kLength; + switch (identifier_value->GetValueID()) { + case CSSValueID::kBaseline: + baseline_shift_type = EBaselineShiftType::kLength; + break; + case CSSValueID::kSub: + baseline_shift_type = EBaselineShiftType::kSub; + break; + case CSSValueID::kSuper: + baseline_shift_type = EBaselineShiftType::kSuper; + break; + default: + NOTREACHED(); + } + state.Style()->SetBaselineShiftType(baseline_shift_type); + state.Style()->SetBaselineShift(Length::Fixed()); + } else { + state.Style()->SetBaselineShiftType(EBaselineShiftType::kLength); + state.Style()->SetBaselineShift(StyleBuilderConverter::ConvertLength( state, To<CSSPrimitiveValue>(value))); - return; - } - switch (identifier_value->GetValueID()) { - case CSSValueID::kBaseline: - svg_style.SetBaselineShift(BS_LENGTH); - svg_style.SetBaselineShiftValue(Length::Fixed()); - return; - case CSSValueID::kSub: - svg_style.SetBaselineShift(BS_SUB); - return; - case CSSValueID::kSuper: - svg_style.SetBaselineShift(BS_SUPER); - return; - default: - NOTREACHED(); } } @@ -809,23 +800,31 @@ const blink::Color BorderBottomColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(!visited_link); - return ComputedStyleUtils::BorderSideColor(style, style.BorderBottomColor(), - style.BorderBottomStyle(), - visited_link); + StyleColor border_bottom_color = style.BorderBottomColor(); + if (style.ShouldForceColor(border_bottom_color)) { + return To<Longhand>(GetCSSPropertyInternalForcedBorderColor()) + .ColorIncludingFallback(false, style); + } + return ComputedStyleUtils::BorderSideColor( + style, border_bottom_color, style.BorderBottomStyle(), visited_link); } const CSSValue* BorderBottomColor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { + StyleColor border_bottom_color = style.BorderBottomColor(); + if (style.ShouldForceColor(border_bottom_color)) { + return GetCSSPropertyInternalForcedBorderColor().CSSValueFromComputedStyle( + style, nullptr, allow_visited_style); + } // https://drafts.csswg.org/cssom/#resolved-values // For this property, the resolved value is the used value. return allow_visited_style ? cssvalue::CSSColorValue::Create( style.VisitedDependentColor(*this).Rgb()) : ComputedStyleUtils::CurrentColorOrValidColor( - style, style.BorderBottomColor(), CSSValuePhase::kUsedValue); + style, border_bottom_color, CSSValuePhase::kUsedValue); } const CSSValue* BorderBottomLeftRadius::ParseSingleValue( @@ -837,7 +836,6 @@ const CSSValue* BorderBottomLeftRadius::ParseSingleValue( const CSSValue* BorderBottomLeftRadius::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForBorderRadiusCorner( @@ -853,7 +851,6 @@ const CSSValue* BorderBottomRightRadius::ParseSingleValue( const CSSValue* BorderBottomRightRadius::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForBorderRadiusCorner( @@ -861,7 +858,6 @@ const CSSValue* BorderBottomRightRadius::CSSValueFromComputedStyleInternal( } const CSSValue* BorderBottomStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.BorderBottomStyle()); @@ -876,7 +872,6 @@ const CSSValue* BorderBottomWidth::ParseSingleValue( const CSSValue* BorderBottomWidth::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ZoomAdjustedPixelValue(style.BorderBottomWidth(), style); @@ -884,7 +879,6 @@ const CSSValue* BorderBottomWidth::CSSValueFromComputedStyleInternal( const CSSValue* BorderCollapse::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.BorderCollapse() == EBorderCollapse::kCollapse) @@ -892,6 +886,20 @@ const CSSValue* BorderCollapse::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(CSSValueID::kSeparate); } +const CSSValue* BorderEndEndRadius::ParseSingleValue( + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&) const { + return css_parsing_utils::ParseBorderRadiusCorner(range, context); +} + +const CSSValue* BorderEndStartRadius::ParseSingleValue( + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&) const { + return css_parsing_utils::ParseBorderRadiusCorner(range, context); +} + const CSSValue* BorderImageOutset::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, @@ -901,7 +909,6 @@ const CSSValue* BorderImageOutset::ParseSingleValue( const CSSValue* BorderImageOutset::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForNinePieceImageQuad( @@ -926,7 +933,6 @@ const CSSValue* BorderImageRepeat::ParseSingleValue( const CSSValue* BorderImageRepeat::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForNinePieceImageRepeat(style.BorderImage()); @@ -948,7 +954,6 @@ const CSSValue* BorderImageSlice::ParseSingleValue( const CSSValue* BorderImageSlice::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForNinePieceImageSlice(style.BorderImage()); @@ -975,7 +980,6 @@ const CSSValue* BorderImageSource::ParseSingleValue( const CSSValue* BorderImageSource::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.BorderImageSource()) { @@ -1006,7 +1010,6 @@ const CSSValue* BorderImageWidth::ParseSingleValue( const CSSValue* BorderImageWidth::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForNinePieceImageQuad( @@ -1064,27 +1067,35 @@ const blink::Color BorderLeftColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(!visited_link); + StyleColor border_left_color = style.BorderLeftColor(); + if (style.ShouldForceColor(border_left_color)) { + return To<Longhand>(GetCSSPropertyInternalForcedBorderColor()) + .ColorIncludingFallback(false, style); + } return ComputedStyleUtils::BorderSideColor( - style, style.BorderLeftColor(), style.BorderLeftStyle(), visited_link); + style, border_left_color, style.BorderLeftStyle(), visited_link); } const CSSValue* BorderLeftColor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { + StyleColor border_left_color = style.BorderLeftColor(); + if (style.ShouldForceColor(border_left_color)) { + return GetCSSPropertyInternalForcedBorderColor().CSSValueFromComputedStyle( + style, nullptr, allow_visited_style); + } // https://drafts.csswg.org/cssom/#resolved-values // For this property, the resolved value is the used value. return allow_visited_style ? cssvalue::CSSColorValue::Create( style.VisitedDependentColor(*this).Rgb()) : ComputedStyleUtils::CurrentColorOrValidColor( - style, style.BorderLeftColor(), CSSValuePhase::kUsedValue); + style, border_left_color, CSSValuePhase::kUsedValue); } const CSSValue* BorderLeftStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.BorderLeftStyle()); @@ -1099,7 +1110,6 @@ const CSSValue* BorderLeftWidth::ParseSingleValue( const CSSValue* BorderLeftWidth::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ZoomAdjustedPixelValue(style.BorderLeftWidth(), style); @@ -1117,27 +1127,35 @@ const blink::Color BorderRightColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(!visited_link); - return ComputedStyleUtils::BorderSideColor( - style, style.BorderRightColor(), style.BorderRightStyle(), visited_link); + StyleColor border_right_color = style.BorderRightColor(); + if (style.ShouldForceColor(border_right_color)) { + return To<Longhand>(GetCSSPropertyInternalForcedBorderColor()) + .ColorIncludingFallback(false, style); + } + return ComputedStyleUtils::BorderSideColor(style, border_right_color, + style.BorderRightStyle(), false); } const CSSValue* BorderRightColor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { + StyleColor border_right_color = style.BorderRightColor(); + if (style.ShouldForceColor(border_right_color)) { + return GetCSSPropertyInternalForcedBorderColor().CSSValueFromComputedStyle( + style, nullptr, allow_visited_style); + } // https://drafts.csswg.org/cssom/#resolved-values // For this property, the resolved value is the used value. return allow_visited_style ? cssvalue::CSSColorValue::Create( style.VisitedDependentColor(*this).Rgb()) : ComputedStyleUtils::CurrentColorOrValidColor( - style, style.BorderRightColor(), CSSValuePhase::kUsedValue); + style, border_right_color, CSSValuePhase::kUsedValue); } const CSSValue* BorderRightStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.BorderRightStyle()); @@ -1152,12 +1170,25 @@ const CSSValue* BorderRightWidth::ParseSingleValue( const CSSValue* BorderRightWidth::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ZoomAdjustedPixelValue(style.BorderRightWidth(), style); } +const CSSValue* BorderStartStartRadius::ParseSingleValue( + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&) const { + return css_parsing_utils::ParseBorderRadiusCorner(range, context); +} + +const CSSValue* BorderStartEndRadius::ParseSingleValue( + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&) const { + return css_parsing_utils::ParseBorderRadiusCorner(range, context); +} + const CSSValue* BorderTopColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, @@ -1170,22 +1201,31 @@ const blink::Color BorderTopColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(!visited_link); + StyleColor border_top_color = style.BorderTopColor(); + if (style.ShouldForceColor(border_top_color)) { + return To<Longhand>(GetCSSPropertyInternalForcedBorderColor()) + .ColorIncludingFallback(false, style); + } return ComputedStyleUtils::BorderSideColor( - style, style.BorderTopColor(), style.BorderTopStyle(), visited_link); + style, border_top_color, style.BorderTopStyle(), visited_link); } const CSSValue* BorderTopColor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { + StyleColor border_top_color = style.BorderTopColor(); + if (style.ShouldForceColor(border_top_color)) { + return GetCSSPropertyInternalForcedBorderColor().CSSValueFromComputedStyle( + style, nullptr, allow_visited_style); + } // https://drafts.csswg.org/cssom/#resolved-values // For this property, the resolved value is the used value. return allow_visited_style ? cssvalue::CSSColorValue::Create( style.VisitedDependentColor(*this).Rgb()) : ComputedStyleUtils::ComputedStyleUtils::CurrentColorOrValidColor( - style, style.BorderTopColor(), CSSValuePhase::kUsedValue); + style, border_top_color, CSSValuePhase::kUsedValue); } const CSSValue* BorderTopLeftRadius::ParseSingleValue( @@ -1197,7 +1237,6 @@ const CSSValue* BorderTopLeftRadius::ParseSingleValue( const CSSValue* BorderTopLeftRadius::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForBorderRadiusCorner( @@ -1213,7 +1252,6 @@ const CSSValue* BorderTopRightRadius::ParseSingleValue( const CSSValue* BorderTopRightRadius::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForBorderRadiusCorner( @@ -1222,7 +1260,6 @@ const CSSValue* BorderTopRightRadius::CSSValueFromComputedStyleInternal( const CSSValue* BorderTopStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.BorderTopStyle()); @@ -1237,7 +1274,6 @@ const CSSValue* BorderTopWidth::ParseSingleValue( const CSSValue* BorderTopWidth::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ZoomAdjustedPixelValue(style.BorderTopWidth(), style); @@ -1259,7 +1295,6 @@ bool Bottom::IsLayoutDependent(const ComputedStyle* style, const CSSValue* Bottom::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValueForPositionOffset(style, *this, @@ -1276,7 +1311,6 @@ const CSSValue* BoxShadow::ParseSingleValue( const CSSValue* BoxShadow::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { // https://drafts.csswg.org/cssom/#resolved-values @@ -1287,7 +1321,6 @@ const CSSValue* BoxShadow::CSSValueFromComputedStyleInternal( const CSSValue* BoxSizing::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.BoxSizing() == EBoxSizing::kContentBox) @@ -1297,7 +1330,6 @@ const CSSValue* BoxSizing::CSSValueFromComputedStyleInternal( const CSSValue* BreakAfter::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.BreakAfter()); @@ -1305,7 +1337,6 @@ const CSSValue* BreakAfter::CSSValueFromComputedStyleInternal( const CSSValue* BreakBefore::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.BreakBefore()); @@ -1313,7 +1344,6 @@ const CSSValue* BreakBefore::CSSValueFromComputedStyleInternal( const CSSValue* BreakInside::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.BreakInside()); @@ -1321,15 +1351,13 @@ const CSSValue* BreakInside::CSSValueFromComputedStyleInternal( const CSSValue* BufferedRendering::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return CSSIdentifierValue::Create(svg_style.BufferedRendering()); + return CSSIdentifierValue::Create(style.BufferedRendering()); } const CSSValue* CaptionSide::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.CaptionSide()); @@ -1353,12 +1381,13 @@ const blink::Color CaretColor::ColorIncludingFallback( // the background to ensure good visibility and contrast. StyleColor result = auto_color.IsAutoColor() ? StyleColor::CurrentColor() : auto_color.ToStyleColor(); + if (style.ShouldForceColor(result)) + return style.GetInternalForcedCurrentColor(); return result.Resolve(style.GetCurrentColor(), style.UsedColorScheme()); } const CSSValue* CaretColor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (allow_visited_style) { @@ -1366,6 +1395,16 @@ const CSSValue* CaretColor::CSSValueFromComputedStyleInternal( style.VisitedDependentColor(*this).Rgb()); } + StyleAutoColor auto_color = style.CaretColor(); + // TODO(rego): We may want to adjust the caret color if it's the same as + // the background to ensure good visibility and contrast. + StyleColor result = auto_color.IsAutoColor() ? StyleColor::CurrentColor() + : auto_color.ToStyleColor(); + if (style.ShouldForceColor(result)) { + return cssvalue::CSSColorValue::Create( + style.GetInternalForcedCurrentColor().Rgb()); + } + // https://drafts.csswg.org/cssom/#resolved-values // For this property, the resolved value is the used value. return ComputedStyleUtils::ValueForStyleAutoColor(style, style.CaretColor(), @@ -1388,7 +1427,6 @@ void CaretColor::ApplyValue(StyleResolverState& state, const CSSValue* Clear::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.Clear()); @@ -1438,7 +1476,6 @@ const CSSValue* Clip::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* Clip::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.HasAutoClip()) @@ -1469,7 +1506,6 @@ const CSSValue* ClipPath::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* ClipPath::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (ClipPathOperation* operation = style.ClipPath()) { @@ -1487,10 +1523,9 @@ const CSSValue* ClipPath::CSSValueFromComputedStyleInternal( const CSSValue* ClipRule::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return CSSIdentifierValue::Create(svg_style.ClipRule()); + return CSSIdentifierValue::Create(style.ClipRule()); } const CSSValue* Color::ParseSingleValue(CSSParserTokenRange& range, @@ -1504,14 +1539,21 @@ const blink::Color Color::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(!visited_link); + if (style.ShouldForceColor(style.GetColor())) { + return To<Longhand>(GetCSSPropertyInternalForcedColor()) + .ColorIncludingFallback(false, style); + } return style.GetCurrentColor(); } const CSSValue* Color::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { + if (style.ShouldForceColor(style.GetColor())) { + return GetCSSPropertyInternalForcedColor().CSSValueFromComputedStyle( + style, nullptr, allow_visited_style); + } return cssvalue::CSSColorValue::Create( allow_visited_style ? style.VisitedDependentColor(*this).Rgb() : style.GetCurrentColor().Rgb()); @@ -1544,26 +1586,23 @@ void Color::ApplyValue(StyleResolverState& state, const CSSValue& value) const { const CSSValue* ColorInterpolation::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return CSSIdentifierValue::Create(svg_style.ColorInterpolation()); + return CSSIdentifierValue::Create(style.ColorInterpolation()); } const CSSValue* ColorInterpolationFilters::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return CSSIdentifierValue::Create(svg_style.ColorInterpolationFilters()); + return CSSIdentifierValue::Create(style.ColorInterpolationFilters()); } const CSSValue* ColorRendering::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return CSSIdentifierValue::Create(svg_style.ColorRendering()); + return CSSIdentifierValue::Create(style.ColorRendering()); } const CSSValue* ColorScheme::ParseSingleValue( @@ -1597,7 +1636,6 @@ const CSSValue* ColorScheme::ParseSingleValue( const CSSValue* ColorScheme::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.ColorScheme().IsEmpty()) @@ -1674,7 +1712,6 @@ const CSSValue* ColumnCount::ParseSingleValue( const CSSValue* ColumnCount::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.HasAutoColumnCount()) @@ -1685,7 +1722,6 @@ const CSSValue* ColumnCount::CSSValueFromComputedStyleInternal( const CSSValue* ColumnFill::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.GetColumnFill()); @@ -1700,7 +1736,6 @@ const CSSValue* ColumnGap::ParseSingleValue( const CSSValue* ColumnGap::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool) const { return ComputedStyleUtils::ValueForGapLength(style.ColumnGap(), style); @@ -1717,13 +1752,15 @@ const blink::Color ColumnRuleColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(!visited_link); - return style.ColumnRuleColor().Resolve(style.GetCurrentColor(), - style.UsedColorScheme()); + StyleColor column_rule_color = style.ColumnRuleColor(); + if (style.ShouldForceColor(column_rule_color)) + return style.GetInternalForcedCurrentColor(); + return column_rule_color.Resolve(style.GetCurrentColor(), + style.UsedColorScheme()); } const CSSValue* ColumnRuleColor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return allow_visited_style ? cssvalue::CSSColorValue::Create( @@ -1735,7 +1772,6 @@ const CSSValue* ColumnRuleColor::CSSValueFromComputedStyleInternal( const CSSValue* ColumnRuleStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.ColumnRuleStyle()); @@ -1751,7 +1787,6 @@ const CSSValue* ColumnRuleWidth::ParseSingleValue( const CSSValue* ColumnRuleWidth::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ZoomAdjustedPixelValue(style.ColumnRuleWidth(), style); @@ -1767,7 +1802,6 @@ const CSSValue* ColumnSpan::ParseSingleValue( const CSSValue* ColumnSpan::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(static_cast<unsigned>(style.GetColumnSpan()) @@ -1784,7 +1818,6 @@ const CSSValue* ColumnWidth::ParseSingleValue( const CSSValue* ColumnWidth::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.HasAutoColumnWidth()) @@ -1812,16 +1845,20 @@ const CSSValue* Contain::ParseSingleValue(CSSParserTokenRange& range, CSSIdentifierValue* paint = nullptr; while (true) { id = range.Peek().Id(); - if (id == CSSValueID::kSize && !size) + if ((id == CSSValueID::kSize || + (RuntimeEnabledFeatures::CSSContainSize1DEnabled() && + (id == CSSValueID::kBlockSize || id == CSSValueID::kInlineSize))) && + !size) { size = css_parsing_utils::ConsumeIdent(range); - else if (id == CSSValueID::kLayout && !layout) + } else if (id == CSSValueID::kLayout && !layout) { layout = css_parsing_utils::ConsumeIdent(range); - else if (id == CSSValueID::kStyle && !style) + } else if (id == CSSValueID::kStyle && !style) { style = css_parsing_utils::ConsumeIdent(range); - else if (id == CSSValueID::kPaint && !paint) + } else if (id == CSSValueID::kPaint && !paint) { paint = css_parsing_utils::ConsumeIdent(range); - else + } else { break; + } } if (size) list->Append(*size); @@ -1840,7 +1877,6 @@ const CSSValue* Contain::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* Contain::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (!style.Contain()) @@ -1851,9 +1887,15 @@ const CSSValue* Contain::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(CSSValueID::kContent); CSSValueList* list = CSSValueList::CreateSpaceSeparated(); - if (style.ContainsSize()) + if (style.ContainsSize()) { list->Append(*CSSIdentifierValue::Create(CSSValueID::kSize)); - if (style.Contain() & kContainsLayout) + } else { + if (style.ContainsInlineSize()) + list->Append(*CSSIdentifierValue::Create(CSSValueID::kInlineSize)); + else if (style.ContainsBlockSize()) + list->Append(*CSSIdentifierValue::Create(CSSValueID::kBlockSize)); + } + if (style.ContainsLayout()) list->Append(*CSSIdentifierValue::Create(CSSValueID::kLayout)); if (style.ContainsStyle()) list->Append(*CSSIdentifierValue::Create(CSSValueID::kStyle)); @@ -1883,7 +1925,6 @@ const CSSValue* ContainIntrinsicSize::ParseSingleValue( const CSSValue* ContainIntrinsicSize::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { auto& size = style.ContainIntrinsicSize(); @@ -1939,18 +1980,32 @@ CSSValue* ConsumeCounterContent(CSSParserTokenRange args, args.ConsumeIncludingWhitespace().Value().ToString()); } - CSSIdentifierValue* list_style = nullptr; + CSSCustomIdentValue* list_style = nullptr; if (css_parsing_utils::ConsumeCommaIncludingWhitespace(args)) { - CSSValueID id = args.Peek().Id(); - if ((id != CSSValueID::kNone && - (id < CSSValueID::kDisc || id > CSSValueID::kKatakanaIroha))) - return nullptr; - list_style = css_parsing_utils::ConsumeIdent(args); + if (!RuntimeEnabledFeatures::CSSAtRuleCounterStyleEnabled()) { + CSSValueID id = args.Peek().Id(); + if ((id != CSSValueID::kNone && + (id < CSSValueID::kDisc || id > CSSValueID::kKatakanaIroha))) + return nullptr; + list_style = MakeGarbageCollected<CSSCustomIdentValue>( + AtomicString(getValueName(id))); + args.ConsumeIncludingWhitespace(); + } else { + // Note: CSS3 spec doesn't allow 'none' but CSS2.1 allows it. We currently + // allow it for backward compatibility. + // See https://github.com/w3c/csswg-drafts/issues/5795 for details. + if (args.Peek().Id() == CSSValueID::kNone) { + list_style = MakeGarbageCollected<CSSCustomIdentValue>("none"); + args.ConsumeIncludingWhitespace(); + } else { + list_style = css_parsing_utils::ConsumeCounterStyleName(args, context); + } + } } else { - list_style = CSSIdentifierValue::Create(CSSValueID::kDecimal); + list_style = MakeGarbageCollected<CSSCustomIdentValue>("decimal"); } - if (!args.AtEnd()) + if (!list_style || !args.AtEnd()) return nullptr; return MakeGarbageCollected<cssvalue::CSSCounterValue>(identifier, list_style, separator); @@ -2015,7 +2070,6 @@ const CSSValue* Content::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* Content::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForContentData(style, allow_visited_style); @@ -2032,6 +2086,12 @@ void Content::ApplyInherit(StyleResolverState& state) const { void Content::ApplyValue(StyleResolverState& state, const CSSValue& value) const { + NOTREACHED(); +} + +void Content::ApplyValue(StyleResolverState& state, + const ScopedCSSValue& scoped_value) const { + const CSSValue& value = scoped_value.GetCSSValue(); if (auto* identifier_value = DynamicTo<CSSIdentifierValue>(value)) { DCHECK(identifier_value->GetValueID() == CSSValueID::kNormal || identifier_value->GetValueID() == CSSValueID::kNone); @@ -2052,14 +2112,10 @@ void Content::ApplyValue(StyleResolverState& state, state.GetStyleImage(CSSPropertyID::kContent, *item)); } else if (const auto* counter_value = DynamicTo<cssvalue::CSSCounterValue>(item.Get())) { - const auto list_style_type = - CssValueIDToPlatformEnum<EListStyleType>(counter_value->ListStyle()); - std::unique_ptr<CounterContent> counter = - std::make_unique<CounterContent>( - AtomicString(counter_value->Identifier()), list_style_type, - AtomicString(counter_value->Separator())); - next_content = - MakeGarbageCollected<CounterContentData>(std::move(counter)); + next_content = MakeGarbageCollected<CounterContentData>( + AtomicString(counter_value->Identifier()), counter_value->ListStyle(), + AtomicString(counter_value->Separator()), + scoped_value.GetTreeScope()); } else if (auto* item_identifier_value = DynamicTo<CSSIdentifierValue>(item.Get())) { QuoteType quote_type; @@ -2135,7 +2191,6 @@ const CSSValue* CounterIncrement::ParseSingleValue( const CSSValue* CounterIncrement::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForCounterDirectives( @@ -2154,7 +2209,6 @@ const CSSValue* CounterReset::ParseSingleValue( const CSSValue* CounterReset::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForCounterDirectives(style, @@ -2173,7 +2227,6 @@ const CSSValue* CounterSet::ParseSingleValue( const CSSValue* CounterSet::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForCounterDirectives(style, @@ -2240,7 +2293,6 @@ const CSSValue* Cursor::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* Cursor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { CSSValueList* list = nullptr; @@ -2305,11 +2357,9 @@ const CSSValue* Cx::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* Cx::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return ComputedStyleUtils::ZoomAdjustedPixelValueForLength(svg_style.Cx(), - style); + return ComputedStyleUtils::ZoomAdjustedPixelValueForLength(style.Cx(), style); } const CSSValue* Cy::ParseSingleValue(CSSParserTokenRange& range, @@ -2321,11 +2371,9 @@ const CSSValue* Cy::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* Cy::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return ComputedStyleUtils::ZoomAdjustedPixelValueForLength(svg_style.Cy(), - style); + return ComputedStyleUtils::ZoomAdjustedPixelValueForLength(style.Cy(), style); } const CSSValue* D::ParseSingleValue(CSSParserTokenRange& range, @@ -2336,17 +2384,15 @@ const CSSValue* D::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* D::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - if (const StylePath* style_path = svg_style.D()) + if (const StylePath* style_path = style.D()) return style_path->ComputedCSSValue(); return CSSIdentifierValue::Create(CSSValueID::kNone); } const CSSValue* Direction::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.Direction()); @@ -2451,7 +2497,6 @@ const CSSValue* Display::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* Display::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.IsDisplayLayoutCustomBox()) { @@ -2522,15 +2567,13 @@ void Display::ApplyValue(StyleResolverState& state, const CSSValue* DominantBaseline::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return CSSIdentifierValue::Create(svg_style.DominantBaseline()); + return CSSIdentifierValue::Create(style.DominantBaseline()); } const CSSValue* EmptyCells::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.EmptyCells()); @@ -2539,15 +2582,25 @@ const CSSValue* EmptyCells::CSSValueFromComputedStyleInternal( const CSSValue* Fill::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return css_parsing_utils::ParsePaintStroke(range, context); + return css_parsing_utils::ConsumeSVGPaint(range, context); } const CSSValue* Fill::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return ComputedStyleUtils::ValueForSVGPaint(svg_style.FillPaint(), style); + return ComputedStyleUtils::ValueForSVGPaint(style.FillPaint(), style); +} + +const blink::Color Fill::ColorIncludingFallback( + bool visited_link, + const ComputedStyle& style) const { + DCHECK(!visited_link); + DCHECK(style.FillPaint().HasColor()); + const StyleColor& fill_color = style.FillPaint().GetColor(); + if (style.ShouldForceColor(fill_color)) + return style.GetInternalForcedCurrentColor(); + return fill_color.Resolve(style.GetCurrentColor(), style.UsedColorScheme()); } const CSSValue* FillOpacity::ParseSingleValue( @@ -2558,20 +2611,18 @@ const CSSValue* FillOpacity::ParseSingleValue( } const CSSValue* FillOpacity::CSSValueFromComputedStyleInternal( - const ComputedStyle&, - const SVGComputedStyle& svg_style, + const ComputedStyle& style, const LayoutObject*, bool allow_visited_style) const { - return CSSNumericLiteralValue::Create(svg_style.FillOpacity(), + return CSSNumericLiteralValue::Create(style.FillOpacity(), CSSPrimitiveValue::UnitType::kNumber); } const CSSValue* FillRule::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return CSSIdentifierValue::Create(svg_style.FillRule()); + return CSSIdentifierValue::Create(style.FillRule()); } const CSSValue* Filter::ParseSingleValue(CSSParserTokenRange& range, @@ -2582,12 +2633,17 @@ const CSSValue* Filter::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* Filter::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForFilter(style, style.Filter()); } +void Filter::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + state.Style()->SetFilter(StyleBuilderConverter::ConvertFilterOperations( + state, value, PropertyID())); +} + const CSSValue* FlexBasis::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, @@ -2601,7 +2657,6 @@ const CSSValue* FlexBasis::ParseSingleValue( const CSSValue* FlexBasis::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ZoomAdjustedPixelValueForLength(style.FlexBasis(), @@ -2610,7 +2665,6 @@ const CSSValue* FlexBasis::CSSValueFromComputedStyleInternal( const CSSValue* FlexDirection::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.FlexDirection()); @@ -2625,7 +2679,6 @@ const CSSValue* FlexGrow::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* FlexGrow::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSNumericLiteralValue::Create(style.FlexGrow(), @@ -2642,7 +2695,6 @@ const CSSValue* FlexShrink::ParseSingleValue( const CSSValue* FlexShrink::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSNumericLiteralValue::Create(style.FlexShrink(), @@ -2651,7 +2703,6 @@ const CSSValue* FlexShrink::CSSValueFromComputedStyleInternal( const CSSValue* FlexWrap::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.FlexWrap()); @@ -2659,7 +2710,6 @@ const CSSValue* FlexWrap::CSSValueFromComputedStyleInternal( const CSSValue* Float::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.HasOutOfFlowPosition()) @@ -2677,12 +2727,14 @@ const CSSValue* FloodColor::ParseSingleValue( const blink::Color FloodColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { - return style.ResolvedColor(style.FloodColor()); + StyleColor flood_color = style.FloodColor(); + if (style.ShouldForceColor(flood_color)) + return style.GetInternalForcedCurrentColor(); + return style.ResolvedColor(flood_color); } const CSSValue* FloodColor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::CurrentColorOrValidColor( @@ -2697,11 +2749,10 @@ const CSSValue* FloodOpacity::ParseSingleValue( } const CSSValue* FloodOpacity::CSSValueFromComputedStyleInternal( - const ComputedStyle&, - const SVGComputedStyle& svg_style, + const ComputedStyle& style, const LayoutObject*, bool allow_visited_style) const { - return CSSNumericLiteralValue::Create(svg_style.FloodOpacity(), + return CSSNumericLiteralValue::Create(style.FloodOpacity(), CSSPrimitiveValue::UnitType::kNumber); } @@ -2714,7 +2765,6 @@ const CSSValue* FontFamily::ParseSingleValue( const CSSValue* FontFamily::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForFontFamily(style); @@ -2722,11 +2772,25 @@ const CSSValue* FontFamily::CSSValueFromComputedStyleInternal( void FontFamily::ApplyValue(StyleResolverState& state, const ScopedCSSValue& scoped_value) const { - // TODO(futhark): Set TreeScope on the FontBuilder so that it can create a - // Font with a FontSelector for that TreeScope. + state.GetFontBuilder().SetFamilyTreeScope(scoped_value.GetTreeScope()); ApplyValue(state, scoped_value.GetCSSValue()); } +void FontFamily::ApplyInitial(StyleResolverState& state) const { + state.GetFontBuilder().SetFamilyDescription( + FontBuilder::InitialFamilyDescription()); + state.GetFontBuilder().SetFamilyTreeScope(nullptr); +} + +void FontFamily::ApplyInherit(StyleResolverState& state) const { + state.GetFontBuilder().SetFamilyDescription( + state.ParentFontDescription().GetFamilyDescription()); + CSSFontSelector* selector = static_cast<CSSFontSelector*>( + state.ParentStyle()->GetFont().GetFontSelector()); + const TreeScope* tree_scope = selector ? selector->GetTreeScope() : nullptr; + state.GetFontBuilder().SetFamilyTreeScope(tree_scope); +} + const CSSValue* FontFeatureSettings::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, @@ -2736,7 +2800,6 @@ const CSSValue* FontFeatureSettings::ParseSingleValue( const CSSValue* FontFeatureSettings::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { const blink::FontFeatureSettings* feature_settings = @@ -2755,7 +2818,6 @@ const CSSValue* FontFeatureSettings::CSSValueFromComputedStyleInternal( const CSSValue* FontKerning::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.GetFontDescription().GetKerning()); @@ -2763,7 +2825,6 @@ const CSSValue* FontKerning::CSSValueFromComputedStyleInternal( const CSSValue* FontOpticalSizing::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create( @@ -2783,7 +2844,6 @@ const CSSValue* FontSizeAdjust::ParseSingleValue( const CSSValue* FontSizeAdjust::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.HasFontSizeAdjust()) { @@ -2802,7 +2862,6 @@ const CSSValue* FontSize::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* FontSize::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForFontSize(style); @@ -2817,7 +2876,6 @@ const CSSValue* FontStretch::ParseSingleValue( const CSSValue* FontStretch::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForFontStretch(style); @@ -2832,7 +2890,6 @@ const CSSValue* FontStyle::ParseSingleValue( const CSSValue* FontStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForFontStyle(style); @@ -2850,7 +2907,6 @@ const CSSValue* FontVariantCaps::ParseSingleValue( const CSSValue* FontVariantCaps::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForFontVariantCaps(style); @@ -2875,7 +2931,6 @@ const CSSValue* FontVariantEastAsian::ParseSingleValue( const CSSValue* FontVariantEastAsian::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForFontVariantEastAsian(style); @@ -2901,7 +2956,6 @@ const CSSValue* FontVariantLigatures::ParseSingleValue( const CSSValue* FontVariantLigatures::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForFontVariantLigatures(style); @@ -2926,7 +2980,6 @@ const CSSValue* FontVariantNumeric::ParseSingleValue( const CSSValue* FontVariantNumeric::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForFontVariantNumeric(style); @@ -2983,7 +3036,6 @@ const CSSValue* FontVariationSettings::ParseSingleValue( const CSSValue* FontVariationSettings::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { const blink::FontVariationSettings* variation_settings = @@ -3010,7 +3062,6 @@ const CSSValue* FontWeight::ParseSingleValue( const CSSValue* FontWeight::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForFontWeight(style); @@ -3018,7 +3069,6 @@ const CSSValue* FontWeight::CSSValueFromComputedStyleInternal( const CSSValue* ForcedColorAdjust::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.ForcedColorAdjust()); @@ -3056,6 +3106,10 @@ const blink::Color InternalVisitedColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(visited_link); + if (style.ShouldForceColor(style.InternalVisitedColor())) { + return To<Longhand>(GetCSSPropertyInternalForcedVisitedColor()) + .ColorIncludingFallback(true, style); + } return style.GetInternalVisitedCurrentColor(); } @@ -3084,7 +3138,6 @@ const CSSValue* GridAutoColumns::ParseSingleValue( // http://lists.w3.org/Archives/Public/www-style/2013Nov/0014.html const CSSValue* GridAutoColumns::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForGridTrackSizeList(kForColumns, style); @@ -3116,7 +3169,6 @@ const CSSValue* GridAutoFlow::ParseSingleValue( const CSSValue* GridAutoFlow::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { CSSValueList* list = CSSValueList::CreateSpaceSeparated(); @@ -3156,7 +3208,6 @@ const CSSValue* GridAutoRows::ParseSingleValue( const CSSValue* GridAutoRows::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForGridTrackSizeList(kForRows, style); @@ -3171,7 +3222,6 @@ const CSSValue* GridColumnEnd::ParseSingleValue( const CSSValue* GridColumnEnd::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForGridPosition(style.GridColumnEnd()); @@ -3186,7 +3236,6 @@ const CSSValue* GridColumnStart::ParseSingleValue( const CSSValue* GridColumnStart::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForGridPosition(style.GridColumnStart()); @@ -3201,7 +3250,6 @@ const CSSValue* GridRowEnd::ParseSingleValue( const CSSValue* GridRowEnd::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForGridPosition(style.GridRowEnd()); @@ -3216,7 +3264,6 @@ const CSSValue* GridRowStart::ParseSingleValue( const CSSValue* GridRowStart::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForGridPosition(style.GridRowStart()); @@ -3250,7 +3297,6 @@ const CSSValue* GridTemplateAreas::ParseSingleValue( const CSSValue* GridTemplateAreas::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (!style.NamedGridAreaRowCount()) { @@ -3328,12 +3374,11 @@ const CSSValue* GridTemplateColumns::ParseSingleValue( bool GridTemplateColumns::IsLayoutDependent(const ComputedStyle* style, LayoutObject* layout_object) const { - return layout_object && layout_object->IsLayoutGrid(); + return layout_object && layout_object->IsLayoutGridIncludingNG(); } const CSSValue* GridTemplateColumns::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValueForGridTrackList(kForColumns, layout_object, @@ -3349,12 +3394,11 @@ const CSSValue* GridTemplateRows::ParseSingleValue( bool GridTemplateRows::IsLayoutDependent(const ComputedStyle* style, LayoutObject* layout_object) const { - return layout_object && layout_object->IsLayoutGrid(); + return layout_object && layout_object->IsLayoutGridIncludingNG(); } const CSSValue* GridTemplateRows::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValueForGridTrackList(kForRows, layout_object, @@ -3375,7 +3419,6 @@ bool Height::IsLayoutDependent(const ComputedStyle* style, const CSSValue* Height::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { if (ComputedStyleUtils::WidthOrHeightShouldReturnUsedValue(layout_object)) { @@ -3388,7 +3431,6 @@ const CSSValue* Height::CSSValueFromComputedStyleInternal( const CSSValue* Hyphens::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.GetHyphens()); @@ -3398,7 +3440,6 @@ const CSSValue* ImageOrientation::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - DCHECK(RuntimeEnabledFeatures::ImageOrientationEnabled()); if (range.Peek().Id() == CSSValueID::kFromImage) return css_parsing_utils::ConsumeIdent(range); if (range.Peek().Id() == CSSValueID::kNone) { @@ -3409,7 +3450,6 @@ const CSSValue* ImageOrientation::ParseSingleValue( const CSSValue* ImageOrientation::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.RespectImageOrientation() == kRespectImageOrientation) @@ -3419,7 +3459,6 @@ const CSSValue* ImageOrientation::CSSValueFromComputedStyleInternal( const CSSValue* ImageRendering::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.ImageRendering()); @@ -3474,7 +3513,12 @@ const blink::Color InternalVisitedBackgroundColor::ColorIncludingFallback( const ComputedStyle& style) const { DCHECK(visited_link); - blink::Color color = style.InternalVisitedBackgroundColor().Resolve( + StyleColor visited_background_color = style.InternalVisitedBackgroundColor(); + if (style.ShouldForceColor(visited_background_color)) { + return To<Longhand>(GetCSSPropertyInternalForcedBackgroundColor()) + .ColorIncludingFallback(true, style); + } + blink::Color color = visited_background_color.Resolve( style.GetInternalVisitedCurrentColor(), style.UsedColorScheme()); // TODO: Technically someone could explicitly specify the color @@ -3504,7 +3548,12 @@ const blink::Color InternalVisitedBorderLeftColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(visited_link); - return style.InternalVisitedBorderLeftColor().Resolve( + StyleColor visited_border_left_color = style.InternalVisitedBorderLeftColor(); + if (style.ShouldForceColor(visited_border_left_color)) { + return To<Longhand>(GetCSSPropertyInternalForcedBorderColor()) + .ColorIncludingFallback(true, style); + } + return visited_border_left_color.Resolve( style.GetInternalVisitedCurrentColor(), style.UsedColorScheme()); } @@ -3520,7 +3569,12 @@ const blink::Color InternalVisitedBorderTopColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(visited_link); - return style.InternalVisitedBorderTopColor().Resolve( + StyleColor visited_border_top_color = style.InternalVisitedBorderTopColor(); + if (style.ShouldForceColor(visited_border_top_color)) { + return To<Longhand>(GetCSSPropertyInternalForcedBorderColor()) + .ColorIncludingFallback(true, style); + } + return visited_border_top_color.Resolve( style.GetInternalVisitedCurrentColor(), style.UsedColorScheme()); } @@ -3539,6 +3593,8 @@ const blink::Color InternalVisitedCaretColor::ColorIncludingFallback( StyleAutoColor auto_color = style.InternalVisitedCaretColor(); StyleColor result = auto_color.IsAutoColor() ? StyleColor::CurrentColor() : auto_color.ToStyleColor(); + if (style.ShouldForceColor(result)) + return style.GetInternalForcedVisitedCurrentColor(); return result.Resolve(style.GetInternalVisitedCurrentColor(), style.UsedColorScheme()); } @@ -3555,7 +3611,13 @@ const blink::Color InternalVisitedBorderRightColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(visited_link); - return style.InternalVisitedBorderRightColor().Resolve( + StyleColor visited_border_right_color = + style.InternalVisitedBorderRightColor(); + if (style.ShouldForceColor(visited_border_right_color)) { + return To<Longhand>(GetCSSPropertyInternalForcedBorderColor()) + .ColorIncludingFallback(true, style); + } + return visited_border_right_color.Resolve( style.GetInternalVisitedCurrentColor(), style.UsedColorScheme()); } @@ -3571,7 +3633,13 @@ const blink::Color InternalVisitedBorderBottomColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(visited_link); - return style.InternalVisitedBorderBottomColor().Resolve( + StyleColor visited_border_bottom_color = + style.InternalVisitedBorderBottomColor(); + if (style.ShouldForceColor(visited_border_bottom_color)) { + return To<Longhand>(GetCSSPropertyInternalForcedBorderColor()) + .ColorIncludingFallback(true, style); + } + return visited_border_bottom_color.Resolve( style.GetInternalVisitedCurrentColor(), style.UsedColorScheme()); } @@ -3619,14 +3687,36 @@ const CSSValue* InternalVisitedFill::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext& local_context) const { - return css_parsing_utils::ParsePaintStroke(range, context); + return css_parsing_utils::ConsumeSVGPaint(range, context); +} + +const blink::Color InternalVisitedFill::ColorIncludingFallback( + bool visited_link, + const ComputedStyle& style) const { + DCHECK(visited_link); + const SVGPaint& paint = style.InternalVisitedFillPaint(); + + // FIXME: This code doesn't support the uri component of the visited link + // paint, https://bugs.webkit.org/show_bug.cgi?id=70006 + if (!paint.HasColor()) { + return To<Longhand>(GetCSSPropertyFill()) + .ColorIncludingFallback(false, style); + } + const StyleColor& visited_fill_color = paint.GetColor(); + if (style.ShouldForceColor(visited_fill_color)) + return style.GetInternalForcedVisitedCurrentColor(); + return visited_fill_color.Resolve(style.GetInternalVisitedCurrentColor(), + style.UsedColorScheme()); } const blink::Color InternalVisitedColumnRuleColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(visited_link); - return style.InternalVisitedColumnRuleColor().Resolve( + StyleColor visited_column_rule_color = style.InternalVisitedColumnRuleColor(); + if (style.ShouldForceColor(visited_column_rule_color)) + return style.GetInternalForcedVisitedCurrentColor(); + return visited_column_rule_color.Resolve( style.GetInternalVisitedCurrentColor(), style.UsedColorScheme()); } @@ -3641,8 +3731,13 @@ const blink::Color InternalVisitedOutlineColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(visited_link); - return style.InternalVisitedOutlineColor().Resolve( - style.GetInternalVisitedCurrentColor(), style.UsedColorScheme()); + StyleColor visited_outline_color = style.InternalVisitedOutlineColor(); + if (style.ShouldForceColor(visited_outline_color)) { + return To<Longhand>(GetCSSPropertyInternalForcedOutlineColor()) + .ColorIncludingFallback(true, style); + } + return visited_outline_color.Resolve(style.GetInternalVisitedCurrentColor(), + style.UsedColorScheme()); } const CSSValue* InternalVisitedOutlineColor::ParseSingleValue( @@ -3657,15 +3752,38 @@ const CSSValue* InternalVisitedStroke::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext& local_context) const { - return css_parsing_utils::ParsePaintStroke(range, context); + return css_parsing_utils::ConsumeSVGPaint(range, context); +} + +const blink::Color InternalVisitedStroke::ColorIncludingFallback( + bool visited_link, + const ComputedStyle& style) const { + DCHECK(visited_link); + const SVGPaint& paint = style.InternalVisitedStrokePaint(); + + // FIXME: This code doesn't support the uri component of the visited link + // paint, https://bugs.webkit.org/show_bug.cgi?id=70006 + if (!paint.HasColor()) { + return To<Longhand>(GetCSSPropertyStroke()) + .ColorIncludingFallback(false, style); + } + const StyleColor& visited_stroke_color = paint.GetColor(); + if (style.ShouldForceColor(visited_stroke_color)) + return style.GetInternalForcedVisitedCurrentColor(); + return visited_stroke_color.Resolve(style.GetInternalVisitedCurrentColor(), + style.UsedColorScheme()); } const blink::Color InternalVisitedTextDecorationColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(visited_link); - return style.DecorationColorIncludingFallback(visited_link) - .Resolve(style.GetInternalVisitedCurrentColor(), style.UsedColorScheme()); + StyleColor visited_decoration_color = + style.DecorationColorIncludingFallback(visited_link); + if (style.ShouldForceColor(visited_decoration_color)) + return style.GetInternalForcedVisitedCurrentColor(); + return visited_decoration_color.Resolve( + style.GetInternalVisitedCurrentColor(), style.UsedColorScheme()); } const CSSValue* InternalVisitedTextDecorationColor::ParseSingleValue( @@ -3679,7 +3797,11 @@ const blink::Color InternalVisitedTextEmphasisColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(visited_link); - return style.InternalVisitedTextEmphasisColor().Resolve( + StyleColor visited_text_emphasis_color = + style.InternalVisitedTextEmphasisColor(); + if (style.ShouldForceColor(visited_text_emphasis_color)) + return style.GetInternalForcedVisitedCurrentColor(); + return visited_text_emphasis_color.Resolve( style.GetInternalVisitedCurrentColor(), style.UsedColorScheme()); } @@ -3694,8 +3816,11 @@ const blink::Color InternalVisitedTextFillColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(visited_link); - return style.InternalVisitedTextFillColor().Resolve( - style.GetInternalVisitedCurrentColor(), style.UsedColorScheme()); + StyleColor visited_text_fill_color = style.InternalVisitedTextFillColor(); + if (style.ShouldForceColor(visited_text_fill_color)) + return style.GetInternalForcedVisitedCurrentColor(); + return visited_text_fill_color.Resolve(style.GetInternalVisitedCurrentColor(), + style.UsedColorScheme()); } const CSSValue* InternalVisitedTextFillColor::ParseSingleValue( @@ -3709,7 +3834,10 @@ const blink::Color InternalVisitedTextStrokeColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(visited_link); - return style.InternalVisitedTextStrokeColor().Resolve( + StyleColor visited_text_stroke_color = style.InternalVisitedTextStrokeColor(); + if (style.ShouldForceColor(visited_text_stroke_color)) + return style.GetInternalForcedVisitedCurrentColor(); + return visited_text_stroke_color.Resolve( style.GetInternalVisitedCurrentColor(), style.UsedColorScheme()); } @@ -3720,9 +3848,203 @@ const CSSValue* InternalVisitedTextStrokeColor::ParseSingleValue( return css_parsing_utils::ConsumeColor(range, context); } +const blink::Color InternalForcedBackgroundColor::ColorIncludingFallback( + bool visited_link, + const ComputedStyle& style) const { + blink::Color forced_current_color; + int alpha; + if (visited_link) { + forced_current_color = style.GetInternalForcedVisitedCurrentColor(); + alpha = style.InternalVisitedBackgroundColor() + .Resolve(style.GetInternalVisitedCurrentColor(), + style.UsedColorScheme()) + .Alpha(); + } else { + forced_current_color = style.GetInternalForcedCurrentColor(); + alpha = style.BackgroundColor() + .Resolve(style.GetCurrentColor(), style.UsedColorScheme()) + .Alpha(); + } + + return style.InternalForcedBackgroundColor().ResolveWithAlpha( + forced_current_color, style.UsedColorScheme(), alpha, + /* is_forced_color */ true); +} + +const CSSValue* +InternalForcedBackgroundColor::CSSValueFromComputedStyleInternal( + const ComputedStyle& style, + const LayoutObject*, + bool allow_visited_style) const { + bool visited_link = allow_visited_style && + style.InsideLink() == EInsideLink::kInsideVisitedLink; + return cssvalue::CSSColorValue::Create( + ColorIncludingFallback(visited_link, style).Rgb()); +} + +const CSSValue* InternalForcedBackgroundColor::ParseSingleValue( + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext& local_context) const { + return css_parsing_utils::ConsumeColor(range, context, + IsQuirksModeBehavior(context.Mode())); +} + +const blink::Color InternalForcedBorderColor::ColorIncludingFallback( + bool visited_link, + const ComputedStyle& style) const { + blink::Color current_color = + visited_link ? style.GetInternalForcedVisitedCurrentColor() + : style.GetInternalForcedCurrentColor(); + + return style.InternalForcedBorderColor().Resolve(current_color, + style.UsedColorScheme()); +} + +const CSSValue* InternalForcedBorderColor::CSSValueFromComputedStyleInternal( + const ComputedStyle& style, + const LayoutObject*, + bool allow_visited_style) const { + bool visited_link = allow_visited_style && + style.InsideLink() == EInsideLink::kInsideVisitedLink; + return cssvalue::CSSColorValue::Create( + ColorIncludingFallback(visited_link, style).Rgb()); +} + +const CSSValue* InternalForcedBorderColor::ParseSingleValue( + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext& local_context) const { + return css_parsing_utils::ConsumeColor(range, context, + IsQuirksModeBehavior(context.Mode())); +} + +void InternalForcedColor::ApplyInitial(StyleResolverState& state) const { + state.Style()->SetInternalForcedColor( + ComputedStyleInitialValues::InitialInternalForcedColor()); +} + +void InternalForcedColor::ApplyInherit(StyleResolverState& state) const { + auto color = state.ParentStyle()->InternalForcedColor(); + state.Style()->SetInternalForcedColor(color); +} + +void InternalForcedColor::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + auto* identifier_value = DynamicTo<CSSIdentifierValue>(value); + if (identifier_value && + identifier_value->GetValueID() == CSSValueID::kCurrentcolor) { + ApplyInherit(state); + return; + } + if (auto* initial_color_value = DynamicTo<CSSInitialColorValue>(value)) { + DCHECK_EQ(state.GetElement(), state.GetDocument().documentElement()); + state.Style()->SetInternalForcedColor( + ComputedStyleInitialValues::InitialInternalForcedColor()); + return; + } + state.Style()->SetInternalForcedColor( + StyleBuilderConverter::ConvertStyleColor(state, value)); +} + +const blink::Color InternalForcedColor::ColorIncludingFallback( + bool visited_link, + const ComputedStyle& style) const { + DCHECK(!visited_link); + return style.GetInternalForcedCurrentColor(); +} + +const CSSValue* InternalForcedColor::CSSValueFromComputedStyleInternal( + const ComputedStyle& style, + const LayoutObject*, + bool allow_visited_style) const { + return cssvalue::CSSColorValue::Create( + allow_visited_style ? style.VisitedDependentColor(*this).Rgb() + : style.GetInternalForcedCurrentColor().Rgb()); +} + +const CSSValue* InternalForcedColor::ParseSingleValue( + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext& local_context) const { + return css_parsing_utils::ConsumeColor(range, context, + IsQuirksModeBehavior(context.Mode())); +} + +const blink::Color InternalForcedOutlineColor::ColorIncludingFallback( + bool visited_link, + const ComputedStyle& style) const { + blink::Color current_color = + visited_link ? style.GetInternalForcedVisitedCurrentColor() + : style.GetInternalForcedCurrentColor(); + + return style.InternalForcedOutlineColor().Resolve(current_color, + style.UsedColorScheme()); +} + +const CSSValue* InternalForcedOutlineColor::CSSValueFromComputedStyleInternal( + const ComputedStyle& style, + const LayoutObject*, + bool allow_visited_style) const { + bool visited_link = allow_visited_style && + style.InsideLink() == EInsideLink::kInsideVisitedLink; + return cssvalue::CSSColorValue::Create( + ColorIncludingFallback(visited_link, style).Rgb()); +} + +const CSSValue* InternalForcedOutlineColor::ParseSingleValue( + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext& local_context) const { + return css_parsing_utils::ConsumeColor(range, context, + IsQuirksModeBehavior(context.Mode())); +} + +void InternalForcedVisitedColor::ApplyInitial(StyleResolverState& state) const { + state.Style()->SetInternalForcedVisitedColor( + ComputedStyleInitialValues::InitialInternalForcedVisitedColor()); +} + +void InternalForcedVisitedColor::ApplyInherit(StyleResolverState& state) const { + auto color = state.ParentStyle()->InternalForcedVisitedColor(); + state.Style()->SetInternalForcedVisitedColor(color); +} + +void InternalForcedVisitedColor::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + auto* identifier_value = DynamicTo<CSSIdentifierValue>(value); + if (identifier_value && + identifier_value->GetValueID() == CSSValueID::kCurrentcolor) { + ApplyInherit(state); + return; + } + if (auto* initial_color_value = DynamicTo<CSSInitialColorValue>(value)) { + DCHECK_EQ(state.GetElement(), state.GetDocument().documentElement()); + state.Style()->SetInternalForcedVisitedColor( + ComputedStyleInitialValues::InitialInternalForcedVisitedColor()); + return; + } + state.Style()->SetInternalForcedVisitedColor( + StyleBuilderConverter::ConvertStyleColor(state, value, true)); +} + +const blink::Color InternalForcedVisitedColor::ColorIncludingFallback( + bool visited_link, + const ComputedStyle& style) const { + DCHECK(visited_link); + return style.GetInternalForcedVisitedCurrentColor(); +} + +const CSSValue* InternalForcedVisitedColor::ParseSingleValue( + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext& local_context) const { + return css_parsing_utils::ConsumeColor(range, context, + IsQuirksModeBehavior(context.Mode())); +} + const CSSValue* Isolation::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.Isolation()); @@ -3742,7 +4064,6 @@ const CSSValue* JustifyContent::ParseSingleValue( const CSSValue* JustifyContent::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils:: @@ -3782,7 +4103,6 @@ const CSSValue* JustifyItems::ParseSingleValue( const CSSValue* JustifyItems::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForItemPositionWithOverflowAlignment( @@ -3801,7 +4121,6 @@ const CSSValue* JustifySelf::ParseSingleValue( const CSSValue* JustifySelf::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForItemPositionWithOverflowAlignment( @@ -3824,7 +4143,6 @@ bool Left::IsLayoutDependent(const ComputedStyle* style, const CSSValue* Left::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValueForPositionOffset(style, *this, @@ -3840,7 +4158,6 @@ const CSSValue* LetterSpacing::ParseSingleValue( const CSSValue* LetterSpacing::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (!style.LetterSpacing()) @@ -3858,12 +4175,14 @@ const CSSValue* LightingColor::ParseSingleValue( const blink::Color LightingColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { - return style.ResolvedColor(style.LightingColor()); + StyleColor lighting_color = style.LightingColor(); + if (style.ShouldForceColor(lighting_color)) + return style.GetInternalForcedCurrentColor(); + return style.ResolvedColor(lighting_color); } const CSSValue* LightingColor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::CurrentColorOrValidColor( @@ -3872,7 +4191,6 @@ const CSSValue* LightingColor::CSSValueFromComputedStyleInternal( const CSSValue* LineBreak::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.GetLineBreak()); @@ -3887,7 +4205,6 @@ const CSSValue* LineHeight::ParseSingleValue( const CSSValue* LineHeight::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForLineHeight(style); @@ -3903,7 +4220,6 @@ const CSSValue* LineHeightStep::ParseSingleValue( const CSSValue* LineHeightStep::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ZoomAdjustedPixelValue(style.LineHeightStep(), style); @@ -3918,7 +4234,6 @@ const CSSValue* ListStyleImage::ParseSingleValue( const CSSValue* ListStyleImage::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.ListStyleImage()) @@ -3934,7 +4249,6 @@ void ListStyleImage::ApplyValue(StyleResolverState& state, const CSSValue* ListStylePosition::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.ListStylePosition()); @@ -3944,47 +4258,74 @@ const CSSValue* ListStyleType::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - // NOTE: All the keyword values for the list-style-type property are handled - // by the CSSParserFastPaths. + if (auto* none = css_parsing_utils::ConsumeIdent<CSSValueID::kNone>(range)) + return none; + + if (!RuntimeEnabledFeatures::CSSAtRuleCounterStyleEnabled()) { + if (auto* ident = css_parsing_utils::ConsumeIdent(range)) { + CSSValueID value_id = ident->GetValueID(); + if (value_id < CSSValueID::kDisc || value_id > CSSValueID::kKatakanaIroha) + return nullptr; + return MakeGarbageCollected<CSSCustomIdentValue>( + AtomicString(getValueName(value_id))); + } + } else { + if (auto* counter_style_name = + css_parsing_utils::ConsumeCounterStyleName(range, context)) + return counter_style_name; + } + return css_parsing_utils::ConsumeString(range); } const CSSValue* ListStyleType::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { - if (style.ListStyleType() == EListStyleType::kString) - return MakeGarbageCollected<CSSStringValue>(style.ListStyleStringValue()); - return CSSIdentifierValue::Create(style.ListStyleType()); + if (!style.GetListStyleType()) + return CSSIdentifierValue::Create(CSSValueID::kNone); + if (style.GetListStyleType()->IsString()) { + return MakeGarbageCollected<CSSStringValue>( + style.GetListStyleType()->GetStringValue()); + } + // TODO(crbug.com/687225): Return a scoped CSSValue? + return MakeGarbageCollected<CSSCustomIdentValue>( + style.GetListStyleType()->GetCounterStyleName()); } void ListStyleType::ApplyInitial(StyleResolverState& state) const { state.Style()->SetListStyleType( ComputedStyleInitialValues::InitialListStyleType()); - state.Style()->SetListStyleStringValue( - ComputedStyleInitialValues::InitialListStyleStringValue()); } void ListStyleType::ApplyInherit(StyleResolverState& state) const { - state.Style()->SetListStyleType(state.ParentStyle()->ListStyleType()); - state.Style()->SetListStyleStringValue( - state.ParentStyle()->ListStyleStringValue()); + state.Style()->SetListStyleType(state.ParentStyle()->GetListStyleType()); } void ListStyleType::ApplyValue(StyleResolverState& state, const CSSValue& value) const { - if (auto* identifier_value = DynamicTo<CSSIdentifierValue>(value)) { + NOTREACHED(); +} + +void ListStyleType::ApplyValue(StyleResolverState& state, + const ScopedCSSValue& scoped_value) const { + const CSSValue& value = scoped_value.GetCSSValue(); + if (const auto* identifier_value = DynamicTo<CSSIdentifierValue>(value)) { + DCHECK_EQ(CSSValueID::kNone, identifier_value->GetValueID()); + state.Style()->SetListStyleType(nullptr); + return; + } + + if (const auto* string_value = DynamicTo<CSSStringValue>(value)) { state.Style()->SetListStyleType( - identifier_value->ConvertTo<EListStyleType>()); - state.Style()->SetListStyleStringValue( - ComputedStyleInitialValues::InitialListStyleStringValue()); + ListStyleTypeData::CreateString(AtomicString(string_value->Value()))); return; } - state.Style()->SetListStyleType(EListStyleType::kString); - state.Style()->SetListStyleStringValue( - AtomicString(To<CSSStringValue>(value).Value())); + DCHECK(value.IsCustomIdentValue()); + const auto& custom_ident_value = To<CSSCustomIdentValue>(value); + state.Style()->SetListStyleType(ListStyleTypeData::CreateCounterStyle( + custom_ident_value.Value(), scoped_value.GetTreeScope())); } bool MarginBlockEnd::IsLayoutDependent(const ComputedStyle* style, @@ -4029,7 +4370,6 @@ bool MarginBottom::IsLayoutDependent(const ComputedStyle* style, const CSSValue* MarginBottom::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { const Length& margin_bottom = style.MarginBottom(); @@ -4083,7 +4423,6 @@ bool MarginLeft::IsLayoutDependent(const ComputedStyle* style, const CSSValue* MarginLeft::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { const Length& margin_left = style.MarginLeft(); @@ -4111,7 +4450,6 @@ bool MarginRight::IsLayoutDependent(const ComputedStyle* style, const CSSValue* MarginRight::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { const Length& margin_right = style.MarginRight(); @@ -4152,7 +4490,6 @@ bool MarginTop::IsLayoutDependent(const ComputedStyle* style, const CSSValue* MarginTop::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { const Length& margin_top = style.MarginTop(); @@ -4175,10 +4512,9 @@ const CSSValue* MarkerEnd::ParseSingleValue( const CSSValue* MarkerEnd::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return ComputedStyleUtils::ValueForSVGResource(svg_style.MarkerEndResource()); + return ComputedStyleUtils::ValueForSVGResource(style.MarkerEndResource()); } const CSSValue* MarkerMid::ParseSingleValue( @@ -4192,10 +4528,9 @@ const CSSValue* MarkerMid::ParseSingleValue( const CSSValue* MarkerMid::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return ComputedStyleUtils::ValueForSVGResource(svg_style.MarkerMidResource()); + return ComputedStyleUtils::ValueForSVGResource(style.MarkerMidResource()); } const CSSValue* MarkerStart::ParseSingleValue( @@ -4209,11 +4544,9 @@ const CSSValue* MarkerStart::ParseSingleValue( const CSSValue* MarkerStart::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return ComputedStyleUtils::ValueForSVGResource( - svg_style.MarkerStartResource()); + return ComputedStyleUtils::ValueForSVGResource(style.MarkerStartResource()); } const CSSValue* Mask::ParseSingleValue(CSSParserTokenRange& range, @@ -4226,23 +4559,20 @@ const CSSValue* Mask::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* Mask::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return ComputedStyleUtils::ValueForSVGResource(svg_style.MaskerResource()); + return ComputedStyleUtils::ValueForSVGResource(style.MaskerResource()); } const CSSValue* MaskType::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return CSSIdentifierValue::Create(svg_style.MaskType()); + return CSSIdentifierValue::Create(style.MaskType()); } const CSSValue* MathShift::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.MathShift()); @@ -4250,7 +4580,6 @@ const CSSValue* MathShift::CSSValueFromComputedStyleInternal( const CSSValue* MathStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.MathStyle()); @@ -4265,7 +4594,6 @@ const CSSValue* MathDepth::ParseSingleValue( const CSSValue* MathDepth::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSNumericLiteralValue::Create(style.MathDepth(), @@ -4307,7 +4635,6 @@ const CSSValue* MaxHeight::ParseSingleValue( const CSSValue* MaxHeight::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { const Length& max_height = style.MaxHeight(); @@ -4332,7 +4659,6 @@ const CSSValue* MaxWidth::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* MaxWidth::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { const Length& max_width = style.MaxWidth(); @@ -4358,7 +4684,6 @@ const CSSValue* MinHeight::ParseSingleValue( const CSSValue* MinHeight::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { if (style.MinHeight().IsAuto()) @@ -4383,7 +4708,6 @@ const CSSValue* MinWidth::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* MinWidth::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { if (style.MinWidth().IsAuto()) @@ -4394,7 +4718,6 @@ const CSSValue* MinWidth::CSSValueFromComputedStyleInternal( const CSSValue* MixBlendMode::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.GetBlendMode()); @@ -4402,7 +4725,6 @@ const CSSValue* MixBlendMode::CSSValueFromComputedStyleInternal( const CSSValue* ObjectFit::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.GetObjectFit()); @@ -4419,7 +4741,6 @@ const CSSValue* ObjectPosition::ParseSingleValue( const CSSValue* ObjectPosition::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return MakeGarbageCollected<CSSValuePair>( @@ -4444,7 +4765,6 @@ const CSSValue* OffsetAnchor::ParseSingleValue( const CSSValue* OffsetAnchor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForPosition(style.OffsetAnchor(), style); @@ -4460,7 +4780,6 @@ const CSSValue* OffsetDistance::ParseSingleValue( const CSSValue* OffsetDistance::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ZoomAdjustedPixelValueForLength( @@ -4476,7 +4795,6 @@ const CSSValue* OffsetPath::ParseSingleValue( const CSSValue* OffsetPath::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (const BasicShape* style_motion_path = style.OffsetPath()) @@ -4503,7 +4821,6 @@ const CSSValue* OffsetPosition::ParseSingleValue( const CSSValue* OffsetPosition::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForPosition(style.OffsetPosition(), style); @@ -4517,7 +4834,6 @@ const CSSValue* OffsetRotate::ParseSingleValue( } const CSSValue* OffsetRotate::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { CSSValueList* list = CSSValueList::CreateSpaceSeparated(); @@ -4536,7 +4852,6 @@ const CSSValue* Opacity::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* Opacity::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSNumericLiteralValue::Create(style.Opacity(), @@ -4551,7 +4866,6 @@ const CSSValue* Order::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* Order::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSNumericLiteralValue::Create(style.Order(), @@ -4560,7 +4874,6 @@ const CSSValue* Order::CSSValueFromComputedStyleInternal( const CSSValue* OriginTrialTestProperty::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.OriginTrialTestProperty()); @@ -4575,7 +4888,6 @@ const CSSValue* Orphans::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* Orphans::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSNumericLiteralValue::Create(style.Orphans(), @@ -4596,22 +4908,31 @@ const blink::Color OutlineColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(!visited_link); - return style.OutlineColor().Resolve(style.GetCurrentColor(), - style.UsedColorScheme()); + StyleColor outline_color = style.OutlineColor(); + if (style.ShouldForceColor(outline_color)) { + return To<Longhand>(GetCSSPropertyInternalForcedOutlineColor()) + .ColorIncludingFallback(false, style); + } + return outline_color.Resolve(style.GetCurrentColor(), + style.UsedColorScheme()); } const CSSValue* OutlineColor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { + StyleColor outline_color = style.OutlineColor(); + if (style.ShouldForceColor(outline_color)) { + return GetCSSPropertyInternalForcedOutlineColor().CSSValueFromComputedStyle( + style, nullptr, allow_visited_style); + } // https://drafts.csswg.org/cssom/#resolved-values // For this property, the resolved value is the used value. return allow_visited_style ? cssvalue::CSSColorValue::Create( style.VisitedDependentColor(*this).Rgb()) : ComputedStyleUtils::CurrentColorOrValidColor( - style, style.OutlineColor(), CSSValuePhase::kUsedValue); + style, outline_color, CSSValuePhase::kUsedValue); } const CSSValue* OutlineOffset::ParseSingleValue( @@ -4623,7 +4944,6 @@ const CSSValue* OutlineOffset::ParseSingleValue( const CSSValue* OutlineOffset::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ZoomAdjustedPixelValue(style.OutlineOffset(), style); @@ -4631,7 +4951,6 @@ const CSSValue* OutlineOffset::CSSValueFromComputedStyleInternal( const CSSValue* OutlineStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.OutlineStyleIsAuto()) @@ -4669,7 +4988,6 @@ const CSSValue* OutlineWidth::ParseSingleValue( const CSSValue* OutlineWidth::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ZoomAdjustedPixelValue(style.OutlineWidth(), style); @@ -4677,7 +4995,6 @@ const CSSValue* OutlineWidth::CSSValueFromComputedStyleInternal( const CSSValue* OverflowAnchor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.OverflowAnchor()); @@ -4685,7 +5002,6 @@ const CSSValue* OverflowAnchor::CSSValueFromComputedStyleInternal( const CSSValue* OverflowClipMargin::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ZoomAdjustedPixelValue(style.OverflowClipMargin(), style); @@ -4701,7 +5017,6 @@ const CSSValue* OverflowClipMargin::ParseSingleValue( const CSSValue* OverflowWrap::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.OverflowWrap()); @@ -4709,7 +5024,6 @@ const CSSValue* OverflowWrap::CSSValueFromComputedStyleInternal( const CSSValue* OverflowX::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.OverflowX()); @@ -4717,7 +5031,6 @@ const CSSValue* OverflowX::CSSValueFromComputedStyleInternal( const CSSValue* OverflowY::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.OverflowY()); @@ -4725,7 +5038,6 @@ const CSSValue* OverflowY::CSSValueFromComputedStyleInternal( const CSSValue* OverscrollBehaviorX::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.OverscrollBehaviorX()); @@ -4733,7 +5045,6 @@ const CSSValue* OverscrollBehaviorX::CSSValueFromComputedStyleInternal( const CSSValue* OverscrollBehaviorY::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.OverscrollBehaviorY()); @@ -4781,7 +5092,6 @@ bool PaddingBottom::IsLayoutDependent(const ComputedStyle* style, const CSSValue* PaddingBottom::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { const Length& padding_bottom = style.PaddingBottom(); @@ -4835,7 +5145,6 @@ bool PaddingLeft::IsLayoutDependent(const ComputedStyle* style, const CSSValue* PaddingLeft::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { const Length& padding_left = style.PaddingLeft(); @@ -4863,7 +5172,6 @@ bool PaddingRight::IsLayoutDependent(const ComputedStyle* style, const CSSValue* PaddingRight::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { const Length& padding_right = style.PaddingRight(); @@ -4891,7 +5199,6 @@ bool PaddingTop::IsLayoutDependent(const ComputedStyle* style, const CSSValue* PaddingTop::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { const Length& padding_top = style.PaddingTop(); @@ -4913,7 +5220,6 @@ const CSSValue* Page::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* Page::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.Page().IsNull()) @@ -4975,11 +5281,10 @@ const CSSValue* PaintOrder::ParseSingleValue( } const CSSValue* PaintOrder::CSSValueFromComputedStyleInternal( - const ComputedStyle&, - const SVGComputedStyle& svg_style, + const ComputedStyle& style, const LayoutObject*, bool allow_visited_style) const { - const EPaintOrder paint_order = svg_style.PaintOrder(); + const EPaintOrder paint_order = style.PaintOrder(); if (paint_order == kPaintOrderNormal) return CSSIdentifierValue::Create(CSSValueID::kNormal); @@ -5036,7 +5341,6 @@ const CSSValue* Perspective::ParseSingleValue( const CSSValue* Perspective::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (!style.HasPerspective()) @@ -5060,7 +5364,6 @@ bool PerspectiveOrigin::IsLayoutDependent(const ComputedStyle* style, const CSSValue* PerspectiveOrigin::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { if (layout_object) { @@ -5088,7 +5391,6 @@ const CSSValue* PerspectiveOrigin::CSSValueFromComputedStyleInternal( const CSSValue* PointerEvents::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.PointerEvents()); @@ -5096,7 +5398,6 @@ const CSSValue* PointerEvents::CSSValueFromComputedStyleInternal( const CSSValue* Position::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.GetPosition()); @@ -5129,7 +5430,6 @@ const CSSValue* Quotes::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* Quotes::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (!style.Quotes()) @@ -5156,16 +5456,13 @@ const CSSValue* R::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* R::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return ComputedStyleUtils::ZoomAdjustedPixelValueForLength(svg_style.R(), - style); + return ComputedStyleUtils::ZoomAdjustedPixelValueForLength(style.R(), style); } const CSSValue* Resize::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.Resize()); @@ -5204,7 +5501,6 @@ bool Right::IsLayoutDependent(const ComputedStyle* style, const CSSValue* Right::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValueForPositionOffset(style, *this, @@ -5244,7 +5540,6 @@ const CSSValue* Rotate::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* Rotate::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (!style.Rotate()) @@ -5271,7 +5566,6 @@ const CSSValue* RowGap::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* RowGap::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool) const { return ComputedStyleUtils::ValueForGapLength(style.RowGap(), style); @@ -5288,11 +5582,9 @@ const CSSValue* Rx::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* Rx::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return ComputedStyleUtils::ZoomAdjustedPixelValueForLength(svg_style.Rx(), - style); + return ComputedStyleUtils::ZoomAdjustedPixelValueForLength(style.Rx(), style); } const CSSValue* Ry::ParseSingleValue(CSSParserTokenRange& range, @@ -5306,11 +5598,9 @@ const CSSValue* Ry::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* Ry::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return ComputedStyleUtils::ZoomAdjustedPixelValueForLength(svg_style.Ry(), - style); + return ComputedStyleUtils::ZoomAdjustedPixelValueForLength(style.Ry(), style); } const CSSValue* Scale::ParseSingleValue(CSSParserTokenRange& range, @@ -5349,7 +5639,6 @@ const CSSValue* Scale::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* Scale::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { ScaleTransformOperation* scale = style.Scale(); @@ -5421,7 +5710,6 @@ const CSSValue* ScrollbarGutter::ParseSingleValue( const CSSValue* ScrollbarGutter::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { auto scrollbar_gutter = style.ScrollbarGutter(); @@ -5450,7 +5738,6 @@ const CSSValue* ScrollbarGutter::CSSValueFromComputedStyleInternal( const CSSValue* ScrollbarWidth::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.ScrollbarWidth()); @@ -5458,7 +5745,6 @@ const CSSValue* ScrollbarWidth::CSSValueFromComputedStyleInternal( const CSSValue* ScrollBehavior::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.GetScrollBehavior()); @@ -5513,7 +5799,6 @@ const CSSValue* ScrollCustomization::ParseSingleValue( const CSSValue* ScrollCustomization::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ScrollCustomizationFlagsToCSSValue( @@ -5546,7 +5831,6 @@ const CSSValue* ScrollMarginBottom::ParseSingleValue( const CSSValue* ScrollMarginBottom::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ZoomAdjustedPixelValue(style.ScrollMarginBottom(), style); @@ -5578,7 +5862,6 @@ const CSSValue* ScrollMarginLeft::ParseSingleValue( const CSSValue* ScrollMarginLeft::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ZoomAdjustedPixelValue(style.ScrollMarginLeft(), style); @@ -5594,7 +5877,6 @@ const CSSValue* ScrollMarginRight::ParseSingleValue( const CSSValue* ScrollMarginRight::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ZoomAdjustedPixelValue(style.ScrollMarginRight(), style); @@ -5610,7 +5892,6 @@ const CSSValue* ScrollMarginTop::ParseSingleValue( const CSSValue* ScrollMarginTop::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ZoomAdjustedPixelValue(style.ScrollMarginTop(), style); @@ -5639,7 +5920,6 @@ const CSSValue* ScrollPaddingBottom::ParseSingleValue( const CSSValue* ScrollPaddingBottom::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ZoomAdjustedPixelValueForLength( @@ -5669,7 +5949,6 @@ const CSSValue* ScrollPaddingLeft::ParseSingleValue( const CSSValue* ScrollPaddingLeft::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ZoomAdjustedPixelValueForLength( @@ -5685,7 +5964,6 @@ const CSSValue* ScrollPaddingRight::ParseSingleValue( const CSSValue* ScrollPaddingRight::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ZoomAdjustedPixelValueForLength( @@ -5701,7 +5979,6 @@ const CSSValue* ScrollPaddingTop::ParseSingleValue( const CSSValue* ScrollPaddingTop::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ZoomAdjustedPixelValueForLength( @@ -5734,7 +6011,6 @@ const CSSValue* ScrollSnapAlign::ParseSingleValue( const CSSValue* ScrollSnapAlign::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForScrollSnapAlign(style.GetScrollSnapAlign(), @@ -5743,7 +6019,6 @@ const CSSValue* ScrollSnapAlign::CSSValueFromComputedStyleInternal( const CSSValue* ScrollSnapStop::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.ScrollSnapStop()); @@ -5776,7 +6051,6 @@ const CSSValue* ScrollSnapType::ParseSingleValue( const CSSValue* ScrollSnapType::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForScrollSnapType(style.GetScrollSnapType(), @@ -5792,7 +6066,6 @@ const CSSValue* ShapeImageThreshold::ParseSingleValue( const CSSValue* ShapeImageThreshold::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSNumericLiteralValue::Create(style.ShapeImageThreshold(), @@ -5809,7 +6082,6 @@ const CSSValue* ShapeMargin::ParseSingleValue( const CSSValue* ShapeMargin::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSValue::Create(style.ShapeMargin(), style.EffectiveZoom()); @@ -5840,7 +6112,6 @@ const CSSValue* ShapeOutside::ParseSingleValue( const CSSValue* ShapeOutside::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForShape(style, allow_visited_style, @@ -5849,10 +6120,9 @@ const CSSValue* ShapeOutside::CSSValueFromComputedStyleInternal( const CSSValue* ShapeRendering::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return CSSIdentifierValue::Create(svg_style.ShapeRendering()); + return CSSIdentifierValue::Create(style.ShapeRendering()); } static CSSValue* ConsumePageSize(CSSParserTokenRange& range) { @@ -6001,7 +6271,6 @@ void Size::ApplyValue(StyleResolverState& state, const CSSValue& value) const { const CSSValue* Speak::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.Speak()); @@ -6017,12 +6286,14 @@ const CSSValue* StopColor::ParseSingleValue( const blink::Color StopColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { - return style.ResolvedColor(style.StopColor()); + StyleColor stop_color = style.StopColor(); + if (style.ShouldForceColor(stop_color)) + return style.GetInternalForcedCurrentColor(); + return style.ResolvedColor(stop_color); } const CSSValue* StopColor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::CurrentColorOrValidColor( @@ -6037,26 +6308,35 @@ const CSSValue* StopOpacity::ParseSingleValue( } const CSSValue* StopOpacity::CSSValueFromComputedStyleInternal( - const ComputedStyle&, - const SVGComputedStyle& svg_style, + const ComputedStyle& style, const LayoutObject*, bool allow_visited_style) const { - return CSSNumericLiteralValue::Create(svg_style.StopOpacity(), + return CSSNumericLiteralValue::Create(style.StopOpacity(), CSSPrimitiveValue::UnitType::kNumber); } const CSSValue* Stroke::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - return css_parsing_utils::ParsePaintStroke(range, context); + return css_parsing_utils::ConsumeSVGPaint(range, context); } const CSSValue* Stroke::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return ComputedStyleUtils::ValueForSVGPaint(svg_style.StrokePaint(), style); + return ComputedStyleUtils::ValueForSVGPaint(style.StrokePaint(), style); +} + +const blink::Color Stroke::ColorIncludingFallback( + bool visited_link, + const ComputedStyle& style) const { + DCHECK(!visited_link); + DCHECK(style.StrokePaint().HasColor()); + const StyleColor& stroke_color = style.StrokePaint().GetColor(); + if (style.ShouldForceColor(stroke_color)) + return style.GetInternalForcedCurrentColor(); + return stroke_color.Resolve(style.GetCurrentColor(), style.UsedColorScheme()); } const CSSValue* StrokeDasharray::ParseSingleValue( @@ -6082,11 +6362,10 @@ const CSSValue* StrokeDasharray::ParseSingleValue( const CSSValue* StrokeDasharray::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::StrokeDashArrayToCSSValueList( - *svg_style.StrokeDashArray(), style); + *style.StrokeDashArray(), style); } const CSSValue* StrokeDashoffset::ParseSingleValue( @@ -6101,7 +6380,6 @@ const CSSValue* StrokeDashoffset::ParseSingleValue( const CSSValue* StrokeDashoffset::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ZoomAdjustedPixelValueForLength( @@ -6110,18 +6388,16 @@ const CSSValue* StrokeDashoffset::CSSValueFromComputedStyleInternal( const CSSValue* StrokeLinecap::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return CSSIdentifierValue::Create(svg_style.CapStyle()); + return CSSIdentifierValue::Create(style.CapStyle()); } const CSSValue* StrokeLinejoin::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return CSSIdentifierValue::Create(svg_style.JoinStyle()); + return CSSIdentifierValue::Create(style.JoinStyle()); } const CSSValue* StrokeMiterlimit::ParseSingleValue( @@ -6133,11 +6409,10 @@ const CSSValue* StrokeMiterlimit::ParseSingleValue( } const CSSValue* StrokeMiterlimit::CSSValueFromComputedStyleInternal( - const ComputedStyle&, - const SVGComputedStyle& svg_style, + const ComputedStyle& style, const LayoutObject*, bool allow_visited_style) const { - return CSSNumericLiteralValue::Create(svg_style.StrokeMiterLimit(), + return CSSNumericLiteralValue::Create(style.StrokeMiterLimit(), CSSPrimitiveValue::UnitType::kNumber); } @@ -6149,11 +6424,10 @@ const CSSValue* StrokeOpacity::ParseSingleValue( } const CSSValue* StrokeOpacity::CSSValueFromComputedStyleInternal( - const ComputedStyle&, - const SVGComputedStyle& svg_style, + const ComputedStyle& style, const LayoutObject*, bool allow_visited_style) const { - return CSSNumericLiteralValue::Create(svg_style.StrokeOpacity(), + return CSSNumericLiteralValue::Create(style.StrokeOpacity(), CSSPrimitiveValue::UnitType::kNumber); } @@ -6169,17 +6443,15 @@ const CSSValue* StrokeWidth::ParseSingleValue( const CSSValue* StrokeWidth::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { // We store the unzoomed stroke-width value using ConvertUnzoomedLength(). // Don't apply zoom here either. - return CSSValue::Create(svg_style.StrokeWidth().length(), 1); + return CSSValue::Create(style.StrokeWidth().length(), 1); } const CSSValue* ContentVisibility::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.ContentVisibility()); @@ -6212,7 +6484,6 @@ const CSSValue* TabSize::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* TabSize::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSNumericLiteralValue::Create( @@ -6223,7 +6494,6 @@ const CSSValue* TabSize::CSSValueFromComputedStyleInternal( const CSSValue* TableLayout::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.TableLayout()); @@ -6231,7 +6501,6 @@ const CSSValue* TableLayout::CSSValueFromComputedStyleInternal( const CSSValue* TextAlign::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.GetTextAlign()); @@ -6266,7 +6535,6 @@ void TextAlign::ApplyValue(StyleResolverState& state, const CSSValue* TextAlignLast::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.TextAlignLast()); @@ -6274,15 +6542,13 @@ const CSSValue* TextAlignLast::CSSValueFromComputedStyleInternal( const CSSValue* TextAnchor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return CSSIdentifierValue::Create(svg_style.TextAnchor()); + return CSSIdentifierValue::Create(style.TextAnchor()); } const CSSValue* TextCombineUpright::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.TextCombine()); @@ -6299,13 +6565,16 @@ const blink::Color TextDecorationColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(!visited_link); - return style.DecorationColorIncludingFallback(visited_link) - .Resolve(style.GetCurrentColor(), style.UsedColorScheme()); + StyleColor decoration_color = + style.DecorationColorIncludingFallback(visited_link); + if (style.ShouldForceColor(decoration_color)) + return style.GetInternalForcedCurrentColor(); + return decoration_color.Resolve(style.GetCurrentColor(), + style.UsedColorScheme()); } const CSSValue* TextDecorationColor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::CurrentColorOrValidColor( @@ -6321,7 +6590,6 @@ const CSSValue* TextDecorationLine::ParseSingleValue( const CSSValue* TextDecorationLine::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::RenderTextDecorationFlagsToCSSValue( @@ -6330,7 +6598,6 @@ const CSSValue* TextDecorationLine::CSSValueFromComputedStyleInternal( const CSSValue* TextDecorationSkipInk::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForTextDecorationSkipInk( @@ -6339,7 +6606,6 @@ const CSSValue* TextDecorationSkipInk::CSSValueFromComputedStyleInternal( const CSSValue* TextDecorationStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValueForTextDecorationStyle( @@ -6361,7 +6627,6 @@ const CSSValue* TextDecorationThickness::ParseSingleValue( const CSSValue* TextDecorationThickness::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { DCHECK(RuntimeEnabledFeatures::UnderlineOffsetThicknessEnabled()); @@ -6425,7 +6690,6 @@ const CSSValue* TextIndent::ParseSingleValue( const CSSValue* TextIndent::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { CSSValueList* list = CSSValueList::CreateSpaceSeparated(); @@ -6485,7 +6749,6 @@ void TextIndent::ApplyValue(StyleResolverState& state, const CSSValue* TextJustify::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.GetTextJustify()); @@ -6493,7 +6756,6 @@ const CSSValue* TextJustify::CSSValueFromComputedStyleInternal( const CSSValue* TextOrientation::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.GetTextOrientation()); @@ -6516,7 +6778,6 @@ void TextOrientation::ApplyValue(StyleResolverState& state, const CSSValue* TextOverflow::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.TextOverflow() != ETextOverflow::kClip) @@ -6526,7 +6787,6 @@ const CSSValue* TextOverflow::CSSValueFromComputedStyleInternal( const CSSValue* TextRendering::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.GetFontDescription().TextRendering()); @@ -6542,7 +6802,6 @@ const CSSValue* TextShadow::ParseSingleValue( const CSSValue* TextShadow::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForShadowList( @@ -6563,7 +6822,6 @@ const CSSValue* TextSizeAdjust::ParseSingleValue( const CSSValue* TextSizeAdjust::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.GetTextSizeAdjust().IsAuto()) @@ -6575,7 +6833,6 @@ const CSSValue* TextSizeAdjust::CSSValueFromComputedStyleInternal( const CSSValue* TextTransform::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.TextTransform()); @@ -6617,7 +6874,6 @@ const CSSValue* TextUnderlinePosition::ParseSingleValue( const CSSValue* TextUnderlinePosition::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { auto text_underline_position = style.TextUnderlinePosition(); @@ -6660,7 +6916,6 @@ const CSSValue* TextUnderlineOffset::ParseSingleValue( const CSSValue* TextUnderlineOffset::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ZoomAdjustedPixelValueForLength( @@ -6683,7 +6938,6 @@ bool Top::IsLayoutDependent(const ComputedStyle* style, const CSSValue* Top::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValueForPositionOffset(style, *this, @@ -6748,7 +7002,6 @@ const CSSValue* TouchAction::ParseSingleValue( const CSSValue* TouchAction::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::TouchActionFlagsToCSSValue(style.GetTouchAction()); @@ -6756,7 +7009,6 @@ const CSSValue* TouchAction::CSSValueFromComputedStyleInternal( const CSSValue* TransformBox::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.TransformBox()); @@ -6777,7 +7029,6 @@ bool Transform::IsLayoutDependent(const ComputedStyle* style, const CSSValue* Transform::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ResolvedTransform(layout_object, style); @@ -6812,7 +7063,6 @@ bool TransformOrigin::IsLayoutDependent(const ComputedStyle* style, const CSSValue* TransformOrigin::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { CSSValueList* list = CSSValueList::CreateSpaceSeparated(); @@ -6837,7 +7087,6 @@ const CSSValue* TransformOrigin::CSSValueFromComputedStyleInternal( const CSSValue* TransformStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create( @@ -6856,7 +7105,6 @@ const CSSValue* TransitionDelay::ParseSingleValue( const CSSValue* TransitionDelay::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForAnimationDelay(style.Transitions()); @@ -6880,7 +7128,6 @@ const CSSValue* TransitionDuration::ParseSingleValue( const CSSValue* TransitionDuration::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForAnimationDuration(style.Transitions()); @@ -6907,7 +7154,6 @@ const CSSValue* TransitionProperty::ParseSingleValue( const CSSValue* TransitionProperty::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForTransitionProperty(style.Transitions()); @@ -6929,7 +7175,6 @@ const CSSValue* TransitionTimingFunction::ParseSingleValue( const CSSValue* TransitionTimingFunction::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForAnimationTimingFunction( @@ -6981,7 +7226,6 @@ bool Translate::IsLayoutDependent(const ComputedStyle* style, const CSSValue* Translate::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { if (!style.Translate()) @@ -7004,7 +7248,6 @@ const CSSValue* Translate::CSSValueFromComputedStyleInternal( const CSSValue* UnicodeBidi::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.GetUnicodeBidi()); @@ -7012,7 +7255,6 @@ const CSSValue* UnicodeBidi::CSSValueFromComputedStyleInternal( const CSSValue* UserSelect::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.UserSelect()); @@ -7020,10 +7262,9 @@ const CSSValue* UserSelect::CSSValueFromComputedStyleInternal( const CSSValue* VectorEffect::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return CSSIdentifierValue::Create(svg_style.VectorEffect()); + return CSSIdentifierValue::Create(style.VectorEffect()); } const CSSValue* VerticalAlign::ParseSingleValue( @@ -7042,7 +7283,6 @@ const CSSValue* VerticalAlign::ParseSingleValue( const CSSValue* VerticalAlign::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { switch (style.VerticalAlign()) { @@ -7095,7 +7335,6 @@ void VerticalAlign::ApplyValue(StyleResolverState& state, const CSSValue* Visibility::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.Visibility()); @@ -7103,7 +7342,6 @@ const CSSValue* Visibility::CSSValueFromComputedStyleInternal( const CSSValue* WebkitAppRegion::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.DraggableRegionMode() == EDraggableRegionMode::kNone) @@ -7146,7 +7384,6 @@ const CSSValue* Appearance::ParseSingleValue( const CSSValue* Appearance::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.Appearance()); @@ -7163,7 +7400,6 @@ const CSSValue* WebkitBorderHorizontalSpacing::ParseSingleValue( const CSSValue* WebkitBorderHorizontalSpacing::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ZoomAdjustedPixelValue(style.HorizontalBorderSpacing(), style); @@ -7178,7 +7414,6 @@ const CSSValue* WebkitBorderImage::ParseSingleValue( const CSSValue* WebkitBorderImage::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForNinePieceImage(style.BorderImage(), style, @@ -7203,7 +7438,6 @@ const CSSValue* WebkitBorderVerticalSpacing::ParseSingleValue( const CSSValue* WebkitBorderVerticalSpacing::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ZoomAdjustedPixelValue(style.VerticalBorderSpacing(), style); @@ -7211,7 +7445,6 @@ const CSSValue* WebkitBorderVerticalSpacing::CSSValueFromComputedStyleInternal( const CSSValue* WebkitBoxAlign::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.BoxAlign()); @@ -7219,7 +7452,6 @@ const CSSValue* WebkitBoxAlign::CSSValueFromComputedStyleInternal( const CSSValue* WebkitBoxDecorationBreak::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.BoxDecorationBreak() == EBoxDecorationBreak::kSlice) @@ -7229,7 +7461,6 @@ const CSSValue* WebkitBoxDecorationBreak::CSSValueFromComputedStyleInternal( const CSSValue* WebkitBoxDirection::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.BoxDirection()); @@ -7244,7 +7475,6 @@ const CSSValue* WebkitBoxFlex::ParseSingleValue( const CSSValue* WebkitBoxFlex::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSNumericLiteralValue::Create(style.BoxFlex(), @@ -7260,7 +7490,6 @@ const CSSValue* WebkitBoxOrdinalGroup::ParseSingleValue( const CSSValue* WebkitBoxOrdinalGroup::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSNumericLiteralValue::Create(style.BoxOrdinalGroup(), @@ -7269,7 +7498,6 @@ const CSSValue* WebkitBoxOrdinalGroup::CSSValueFromComputedStyleInternal( const CSSValue* WebkitBoxOrient::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.BoxOrient()); @@ -7277,7 +7505,6 @@ const CSSValue* WebkitBoxOrient::CSSValueFromComputedStyleInternal( const CSSValue* WebkitBoxPack::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.BoxPack()); @@ -7326,7 +7553,6 @@ const CSSValue* WebkitBoxReflect::ParseSingleValue( const CSSValue* WebkitBoxReflect::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForReflection(style.BoxReflect(), style, @@ -7343,7 +7569,6 @@ const CSSValue* InternalFontSizeDelta::ParseSingleValue( const CSSValue* WebkitFontSmoothing::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.GetFontDescription().FontSmoothing()); @@ -7360,7 +7585,6 @@ const CSSValue* WebkitHighlight::ParseSingleValue( const CSSValue* WebkitHighlight::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.Highlight() == g_null_atom) @@ -7379,7 +7603,6 @@ const CSSValue* WebkitHyphenateCharacter::ParseSingleValue( const CSSValue* WebkitHyphenateCharacter::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.HyphenationString().IsNull()) @@ -7389,7 +7612,6 @@ const CSSValue* WebkitHyphenateCharacter::CSSValueFromComputedStyleInternal( const CSSValue* WebkitLineBreak::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.GetLineBreak()); @@ -7405,7 +7627,6 @@ const CSSValue* WebkitLineClamp::ParseSingleValue( const CSSValue* WebkitLineClamp::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (!style.HasLineClamp()) @@ -7425,7 +7646,6 @@ const CSSValue* WebkitLocale::ParseSingleValue( const CSSValue* WebkitLocale::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.Locale().IsNull()) @@ -7453,7 +7673,6 @@ const CSSValue* WebkitMaskBoxImageOutset::ParseSingleValue( const CSSValue* WebkitMaskBoxImageOutset::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForNinePieceImageQuad( @@ -7469,7 +7688,6 @@ const CSSValue* WebkitMaskBoxImageRepeat::ParseSingleValue( const CSSValue* WebkitMaskBoxImageRepeat::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForNinePieceImageRepeat(style.MaskBoxImage()); @@ -7485,7 +7703,6 @@ const CSSValue* WebkitMaskBoxImageSlice::ParseSingleValue( const CSSValue* WebkitMaskBoxImageSlice::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForNinePieceImageSlice(style.MaskBoxImage()); @@ -7500,7 +7717,6 @@ const CSSValue* WebkitMaskBoxImageSource::ParseSingleValue( const CSSValue* WebkitMaskBoxImageSource::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.MaskBoxImageSource()) { @@ -7525,7 +7741,6 @@ const CSSValue* WebkitMaskBoxImageWidth::ParseSingleValue( const CSSValue* WebkitMaskBoxImageWidth::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForNinePieceImageQuad( @@ -7543,7 +7758,6 @@ const CSSValue* WebkitMaskClip::ParseSingleValue( const CSSValue* WebkitMaskClip::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { CSSValueList* list = CSSValueList::CreateCommaSeparated(); @@ -7565,7 +7779,6 @@ const CSSValue* WebkitMaskComposite::ParseSingleValue( const CSSValue* WebkitMaskComposite::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { CSSValueList* list = CSSValueList::CreateCommaSeparated(); @@ -7585,7 +7798,6 @@ const CSSValue* WebkitMaskImage::ParseSingleValue( const CSSValue* WebkitMaskImage::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { const FillLayer& fill_layer = style.MaskLayers(); @@ -7604,7 +7816,6 @@ const CSSValue* WebkitMaskOrigin::ParseSingleValue( const CSSValue* WebkitMaskOrigin::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { CSSValueList* list = CSSValueList::CreateCommaSeparated(); @@ -7628,7 +7839,6 @@ const CSSValue* WebkitMaskPositionX::ParseSingleValue( const CSSValue* WebkitMaskPositionX::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { const FillLayer* curr_layer = &style.MaskLayers(); @@ -7648,7 +7858,6 @@ const CSSValue* WebkitMaskPositionY::ParseSingleValue( const CSSValue* WebkitMaskPositionY::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { const FillLayer* curr_layer = &style.MaskLayers(); @@ -7666,7 +7875,6 @@ const CSSValue* WebkitMaskSize::ParseSingleValue( const CSSValue* WebkitMaskSize::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { const FillLayer& fill_layer = style.MaskLayers(); @@ -7693,7 +7901,6 @@ const CSSValue* WebkitPerspectiveOriginY::ParseSingleValue( const CSSValue* WebkitPrintColorAdjust::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.PrintColorAdjust()); @@ -7701,7 +7908,6 @@ const CSSValue* WebkitPrintColorAdjust::CSSValueFromComputedStyleInternal( const CSSValue* WebkitRtlOrdering::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.RtlOrdering() == EOrder::kVisual @@ -7711,7 +7917,6 @@ const CSSValue* WebkitRtlOrdering::CSSValueFromComputedStyleInternal( const CSSValue* WebkitRubyPosition::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.GetRubyPosition()); @@ -7719,7 +7924,6 @@ const CSSValue* WebkitRubyPosition::CSSValueFromComputedStyleInternal( const CSSValue* RubyPosition::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { switch (style.GetRubyPosition()) { @@ -7742,12 +7946,16 @@ const CSSValue* WebkitTapHighlightColor::ParseSingleValue( const blink::Color WebkitTapHighlightColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { + StyleColor highlight_color = style.TapHighlightColor(); + if (style.ShouldForceColor(highlight_color)) { + return visited_link ? style.GetInternalForcedVisitedCurrentColor() + : style.GetInternalForcedCurrentColor(); + } return style.ResolvedColor(style.TapHighlightColor()); } const CSSValue* WebkitTapHighlightColor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::CurrentColorOrValidColor( @@ -7756,7 +7964,6 @@ const CSSValue* WebkitTapHighlightColor::CSSValueFromComputedStyleInternal( const CSSValue* WebkitTextCombine::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.TextCombine() == ETextCombine::kAll) @@ -7774,7 +7981,6 @@ const CSSValue* WebkitTextDecorationsInEffect::ParseSingleValue( const CSSValue* WebkitTextDecorationsInEffect::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::RenderTextDecorationFlagsToCSSValue( @@ -7792,13 +7998,15 @@ const blink::Color WebkitTextEmphasisColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(!visited_link); - return style.TextEmphasisColor().Resolve(style.GetCurrentColor(), - style.UsedColorScheme()); + StyleColor text_emphasis_color = style.TextEmphasisColor(); + if (style.ShouldForceColor(text_emphasis_color)) + return style.GetInternalForcedCurrentColor(); + return text_emphasis_color.Resolve(style.GetCurrentColor(), + style.UsedColorScheme()); } const CSSValue* WebkitTextEmphasisColor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::CurrentColorOrValidColor( @@ -7858,7 +8066,6 @@ const CSSValue* WebkitTextEmphasisPosition::ParseSingleValue( const CSSValue* WebkitTextEmphasisPosition::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { CSSValueList* list = CSSValueList::CreateSpaceSeparated(); @@ -7920,7 +8127,6 @@ const CSSValue* WebkitTextEmphasisStyle::ParseSingleValue( const CSSValue* WebkitTextEmphasisStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { switch (style.GetTextEmphasisMark()) { @@ -8019,13 +8225,15 @@ const blink::Color WebkitTextFillColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(!visited_link); - return style.TextFillColor().Resolve(style.GetCurrentColor(), - style.UsedColorScheme()); + StyleColor text_fill_color = style.TextFillColor(); + if (style.ShouldForceColor(text_fill_color)) + return style.GetInternalForcedCurrentColor(); + return text_fill_color.Resolve(style.GetCurrentColor(), + style.UsedColorScheme()); } const CSSValue* WebkitTextFillColor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::CurrentColorOrValidColor( @@ -8034,7 +8242,6 @@ const CSSValue* WebkitTextFillColor::CSSValueFromComputedStyleInternal( const CSSValue* WebkitTextOrientation::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.GetTextOrientation() == ETextOrientation::kMixed) @@ -8059,7 +8266,6 @@ void WebkitTextOrientation::ApplyValue(StyleResolverState& state, const CSSValue* WebkitTextSecurity::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.TextSecurity()); @@ -8076,13 +8282,15 @@ const blink::Color WebkitTextStrokeColor::ColorIncludingFallback( bool visited_link, const ComputedStyle& style) const { DCHECK(!visited_link); - return style.TextStrokeColor().Resolve(style.GetCurrentColor(), - style.UsedColorScheme()); + StyleColor text_stroke_color = style.TextStrokeColor(); + if (style.ShouldForceColor(text_stroke_color)) + return style.GetInternalForcedCurrentColor(); + return text_stroke_color.Resolve(style.GetCurrentColor(), + style.UsedColorScheme()); } const CSSValue* WebkitTextStrokeColor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::CurrentColorOrValidColor( @@ -8099,7 +8307,6 @@ const CSSValue* WebkitTextStrokeWidth::ParseSingleValue( const CSSValue* WebkitTextStrokeWidth::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ZoomAdjustedPixelValue(style.TextStrokeWidth(), style); @@ -8132,7 +8339,6 @@ const CSSValue* WebkitTransformOriginZ::ParseSingleValue( const CSSValue* WebkitUserDrag::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.UserDrag()); @@ -8140,7 +8346,6 @@ const CSSValue* WebkitUserDrag::CSSValueFromComputedStyleInternal( const CSSValue* WebkitUserModify::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.UserModify()); @@ -8148,7 +8353,6 @@ const CSSValue* WebkitUserModify::CSSValueFromComputedStyleInternal( const CSSValue* WebkitWritingMode::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.GetWritingMode()); @@ -8169,7 +8373,6 @@ void WebkitWritingMode::ApplyValue(StyleResolverState& state, const CSSValue* WhiteSpace::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.WhiteSpace()); @@ -8183,7 +8386,6 @@ const CSSValue* Widows::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* Widows::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSNumericLiteralValue::Create(style.Widows(), @@ -8204,7 +8406,6 @@ bool Width::IsLayoutDependent(const ComputedStyle* style, const CSSValue* Width::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { if (ComputedStyleUtils::WidthOrHeightShouldReturnUsedValue(layout_object)) { @@ -8233,7 +8434,7 @@ const CSSValue* WillChange::ParseSingleValue( if (unresolved_property != CSSPropertyID::kInvalid && unresolved_property != CSSPropertyID::kVariable) { #if DCHECK_IS_ON() - DCHECK(CSSProperty::Get(resolveCSSPropertyID(unresolved_property)) + DCHECK(CSSProperty::Get(ResolveCSSPropertyID(unresolved_property)) .IsWebExposed(context.GetExecutionContext())); #endif // Now "all" is used by both CSSValue and CSSPropertyValue. @@ -8275,7 +8476,6 @@ const CSSValue* WillChange::ParseSingleValue( const CSSValue* WillChange::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForWillChange( @@ -8335,7 +8535,6 @@ void WillChange::ApplyValue(StyleResolverState& state, const CSSValue* WordBreak::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.WordBreak()); @@ -8350,7 +8549,6 @@ const CSSValue* WordSpacing::ParseSingleValue( const CSSValue* WordSpacing::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ZoomAdjustedPixelValue(style.WordSpacing(), style); @@ -8358,7 +8556,6 @@ const CSSValue* WordSpacing::CSSValueFromComputedStyleInternal( const CSSValue* WritingMode::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSIdentifierValue::Create(style.GetWritingMode()); @@ -8387,11 +8584,9 @@ const CSSValue* X::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* X::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return ComputedStyleUtils::ZoomAdjustedPixelValueForLength(svg_style.X(), - style); + return ComputedStyleUtils::ZoomAdjustedPixelValueForLength(style.X(), style); } const CSSValue* Y::ParseSingleValue(CSSParserTokenRange& range, @@ -8403,11 +8598,9 @@ const CSSValue* Y::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* Y::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject*, bool allow_visited_style) const { - return ComputedStyleUtils::ZoomAdjustedPixelValueForLength(svg_style.Y(), - style); + return ComputedStyleUtils::ZoomAdjustedPixelValueForLength(style.Y(), style); } const CSSValue* ZIndex::ParseSingleValue(CSSParserTokenRange& range, @@ -8420,7 +8613,6 @@ const CSSValue* ZIndex::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* ZIndex::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { if (style.HasAutoZIndex()) @@ -8457,7 +8649,6 @@ const CSSValue* Zoom::ParseSingleValue(CSSParserTokenRange& range, const CSSValue* Zoom::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return CSSNumericLiteralValue::Create(style.Zoom(), diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc index 47bd06e633f..485b157c49a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc @@ -102,7 +102,6 @@ bool Animation::ParseShorthand( const CSSValue* Animation::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { const CSSAnimationData* animation_data = style.Animations(); @@ -177,7 +176,6 @@ bool Background::ParseShorthand( const CSSValue* Background::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForBackgroundShorthand(style, layout_object, @@ -213,7 +211,6 @@ bool BackgroundPosition::ParseShorthand( const CSSValue* BackgroundPosition::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::BackgroundPositionOrWebkitMaskPosition( @@ -252,7 +249,6 @@ bool BackgroundRepeat::ParseShorthand( const CSSValue* BackgroundRepeat::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::BackgroundRepeatOrWebkitMaskRepeat( @@ -271,7 +267,6 @@ bool BorderBlockColor::ParseShorthand( const CSSValue* BorderBlockColor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForInlineBlockShorthand( @@ -305,7 +300,6 @@ bool BorderBlock::ParseShorthand( const CSSValue* BorderBlock::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { const CSSValue* value_start = @@ -352,7 +346,6 @@ bool BorderBlockStyle::ParseShorthand( const CSSValue* BorderBlockStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForInlineBlockShorthand( @@ -371,7 +364,6 @@ bool BorderBlockWidth::ParseShorthand( const CSSValue* BorderBlockWidth::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForInlineBlockShorthand( @@ -390,7 +382,6 @@ bool BorderBottom::ParseShorthand( const CSSValue* BorderBottom::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForShorthandProperty( @@ -409,7 +400,6 @@ bool BorderColor::ParseShorthand( const CSSValue* BorderColor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForSidesShorthand( @@ -446,7 +436,6 @@ bool Border::ParseShorthand( const CSSValue* Border::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { const CSSValue* value = GetCSSPropertyBorderTop().CSSValueFromComputedStyle( @@ -521,7 +510,6 @@ bool BorderImage::ParseShorthand( const CSSValue* BorderImage::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForNinePieceImage(style.BorderImage(), style, @@ -540,7 +528,6 @@ bool BorderInlineColor::ParseShorthand( const CSSValue* BorderInlineColor::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForInlineBlockShorthand( @@ -574,7 +561,6 @@ bool BorderInline::ParseShorthand( const CSSValue* BorderInline::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { const CSSValue* value_start = @@ -621,7 +607,6 @@ bool BorderInlineStyle::ParseShorthand( const CSSValue* BorderInlineStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForInlineBlockShorthand( @@ -640,7 +625,6 @@ bool BorderInlineWidth::ParseShorthand( const CSSValue* BorderInlineWidth::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForInlineBlockShorthand( @@ -659,7 +643,6 @@ bool BorderLeft::ParseShorthand( const CSSValue* BorderLeft::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForShorthandProperty( @@ -713,7 +696,6 @@ bool BorderRadius::ParseShorthand( const CSSValue* BorderRadius::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForBorderRadiusShorthand(style); @@ -731,7 +713,6 @@ bool BorderRight::ParseShorthand( const CSSValue* BorderRight::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForShorthandProperty( @@ -769,7 +750,6 @@ bool BorderSpacing::ParseShorthand( const CSSValue* BorderSpacing::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { CSSValueList* list = CSSValueList::CreateSpaceSeparated(); @@ -790,7 +770,6 @@ bool BorderStyle::ParseShorthand( const CSSValue* BorderStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForSidesShorthand( @@ -809,7 +788,6 @@ bool BorderTop::ParseShorthand( const CSSValue* BorderTop::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForShorthandProperty( @@ -828,7 +806,6 @@ bool BorderWidth::ParseShorthand( const CSSValue* BorderWidth::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForSidesShorthand( @@ -847,7 +824,6 @@ bool ColumnRule::ParseShorthand( const CSSValue* ColumnRule::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForShorthandProperty( @@ -886,7 +862,6 @@ bool Columns::ParseShorthand( const CSSValue* Columns::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForShorthandProperty( @@ -975,7 +950,6 @@ bool Flex::ParseShorthand(bool important, const CSSValue* Flex::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForShorthandProperty( @@ -994,7 +968,6 @@ bool FlexFlow::ParseShorthand( const CSSValue* FlexFlow::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForShorthandProperty( @@ -1221,7 +1194,6 @@ bool Font::ParseShorthand(bool important, const CSSValue* Font::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForFont(style); @@ -1322,7 +1294,6 @@ bool FontVariant::ParseShorthand( const CSSValue* FontVariant::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForFontVariantProperty(style, layout_object, @@ -1352,7 +1323,6 @@ bool Gap::ParseShorthand(bool important, const CSSValue* Gap::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForGapShorthand( @@ -1428,7 +1398,6 @@ bool GridArea::ParseShorthand( const CSSValue* GridArea::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForGridShorthand( @@ -1466,7 +1435,6 @@ bool GridColumn::ParseShorthand( const CSSValue* GridColumn::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForGridShorthand( @@ -1492,7 +1460,6 @@ bool GridColumnGap::ParseShorthand( const CSSValue* GridColumnGap::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForShorthandProperty( @@ -1667,12 +1634,11 @@ bool Grid::ParseShorthand(bool important, bool Grid::IsLayoutDependent(const ComputedStyle* style, LayoutObject* layout_object) const { - return layout_object && layout_object->IsLayoutGrid(); + return layout_object && layout_object->IsLayoutGridIncludingNG(); } const CSSValue* Grid::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForGridShorthand( @@ -1703,7 +1669,6 @@ bool GridGap::ParseShorthand( const CSSValue* GridGap::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForShorthandProperty( @@ -1741,7 +1706,6 @@ bool GridRow::ParseShorthand( const CSSValue* GridRow::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForGridShorthand( @@ -1767,7 +1731,6 @@ bool GridRowGap::ParseShorthand( const CSSValue* GridRowGap::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForShorthandProperty( @@ -1810,12 +1773,11 @@ bool GridTemplate::ParseShorthand( bool GridTemplate::IsLayoutDependent(const ComputedStyle* style, LayoutObject* layout_object) const { - return layout_object && layout_object->IsLayoutGrid(); + return layout_object && layout_object->IsLayoutGridIncludingNG(); } const CSSValue* GridTemplate::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForGridShorthand( @@ -1834,7 +1796,6 @@ bool InsetBlock::ParseShorthand( const CSSValue* InsetBlock::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForInlineBlockShorthand( @@ -1853,7 +1814,6 @@ bool Inset::ParseShorthand( const CSSValue* Inset::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForSidesShorthand( @@ -1872,7 +1832,6 @@ bool InsetInline::ParseShorthand( const CSSValue* InsetInline::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForInlineBlockShorthand( @@ -1968,7 +1927,6 @@ bool ListStyle::ParseShorthand( const CSSValue* ListStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForShorthandProperty( @@ -1987,7 +1945,6 @@ bool MarginBlock::ParseShorthand( const CSSValue* MarginBlock::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForInlineBlockShorthand( @@ -2014,7 +1971,6 @@ bool Margin::IsLayoutDependent(const ComputedStyle* style, const CSSValue* Margin::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForSidesShorthand( @@ -2033,7 +1989,6 @@ bool MarginInline::ParseShorthand( const CSSValue* MarginInline::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForInlineBlockShorthand( @@ -2065,15 +2020,14 @@ bool Marker::ParseShorthand( const CSSValue* Marker::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle& svg_style, const LayoutObject* layout_object, bool allow_visited_style) const { const CSSValue* marker_start = - ComputedStyleUtils::ValueForSVGResource(svg_style.MarkerStartResource()); - if (*marker_start == *ComputedStyleUtils::ValueForSVGResource( - svg_style.MarkerMidResource()) && - *marker_start == *ComputedStyleUtils::ValueForSVGResource( - svg_style.MarkerEndResource())) { + ComputedStyleUtils::ValueForSVGResource(style.MarkerStartResource()); + if (*marker_start == + *ComputedStyleUtils::ValueForSVGResource(style.MarkerMidResource()) && + *marker_start == + *ComputedStyleUtils::ValueForSVGResource(style.MarkerEndResource())) { return marker_start; } return nullptr; @@ -2185,7 +2139,6 @@ bool Offset::ParseShorthand( const CSSValue* Offset::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValueForOffset(style, layout_object, @@ -2204,7 +2157,6 @@ bool Outline::ParseShorthand( const CSSValue* Outline::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForShorthandProperty( @@ -2223,7 +2175,6 @@ bool Overflow::ParseShorthand( const CSSValue* Overflow::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { CSSValueList* list = CSSValueList::CreateSpaceSeparated(); @@ -2246,7 +2197,6 @@ bool OverscrollBehavior::ParseShorthand( const CSSValue* OverscrollBehavior::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { CSSValueList* list = CSSValueList::CreateSpaceSeparated(); @@ -2269,7 +2219,6 @@ bool PaddingBlock::ParseShorthand( const CSSValue* PaddingBlock::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForInlineBlockShorthand( @@ -2296,7 +2245,6 @@ bool Padding::IsLayoutDependent(const ComputedStyle* style, const CSSValue* Padding::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForSidesShorthand( @@ -2315,7 +2263,6 @@ bool PaddingInline::ParseShorthand( const CSSValue* PaddingInline::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForInlineBlockShorthand( @@ -2343,7 +2290,6 @@ bool PageBreakAfter::ParseShorthand( const CSSValue* PageBreakAfter::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForPageBreakBetween(style.BreakAfter()); @@ -2370,7 +2316,6 @@ bool PageBreakBefore::ParseShorthand( const CSSValue* PageBreakBefore::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForPageBreakBetween(style.BreakBefore()); @@ -2396,7 +2341,6 @@ bool PageBreakInside::ParseShorthand( const CSSValue* PageBreakInside::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForPageBreakInside(style.BreakInside()); @@ -2454,7 +2398,6 @@ bool PlaceContent::ParseShorthand( const CSSValue* PlaceContent::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForPlaceShorthand( @@ -2502,7 +2445,6 @@ bool PlaceItems::ParseShorthand( const CSSValue* PlaceItems::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForPlaceShorthand( @@ -2550,7 +2492,6 @@ bool PlaceSelf::ParseShorthand( const CSSValue* PlaceSelf::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForPlaceShorthand( @@ -2569,7 +2510,6 @@ bool ScrollMarginBlock::ParseShorthand( const CSSValue* ScrollMarginBlock::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForInlineBlockShorthand( @@ -2588,7 +2528,6 @@ bool ScrollMargin::ParseShorthand( const CSSValue* ScrollMargin::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForSidesShorthand( @@ -2607,7 +2546,6 @@ bool ScrollMarginInline::ParseShorthand( const CSSValue* ScrollMarginInline::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForInlineBlockShorthand( @@ -2626,7 +2564,6 @@ bool ScrollPaddingBlock::ParseShorthand( const CSSValue* ScrollPaddingBlock::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForInlineBlockShorthand( @@ -2645,7 +2582,6 @@ bool ScrollPadding::ParseShorthand( const CSSValue* ScrollPadding::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForSidesShorthand( @@ -2664,7 +2600,6 @@ bool ScrollPaddingInline::ParseShorthand( const CSSValue* ScrollPaddingInline::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { return ComputedStyleUtils::ValuesForInlineBlockShorthand( @@ -2687,7 +2622,6 @@ bool TextDecoration::ParseShorthand( const CSSValue* TextDecoration::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject* layout_object, bool allow_visited_style) const { // Use RuntimeEnabledFeature-aware shorthandForProperty() method until @@ -2777,7 +2711,6 @@ bool Transition::ParseShorthand( const CSSValue* Transition::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { const CSSTransitionData* transition_data = style.Transitions(); @@ -2835,7 +2768,6 @@ bool WebkitColumnBreakAfter::ParseShorthand( const CSSValue* WebkitColumnBreakAfter::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForWebkitColumnBreakBetween( @@ -2862,7 +2794,6 @@ bool WebkitColumnBreakBefore::ParseShorthand( const CSSValue* WebkitColumnBreakBefore::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForWebkitColumnBreakBetween( @@ -2889,7 +2820,6 @@ bool WebkitColumnBreakInside::ParseShorthand( const CSSValue* WebkitColumnBreakInside::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForWebkitColumnBreakInside( @@ -2945,7 +2875,6 @@ bool WebkitMaskBoxImage::ParseShorthand( const CSSValue* WebkitMaskBoxImage::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::ValueForNinePieceImage(style.MaskBoxImage(), style, @@ -2991,7 +2920,6 @@ bool WebkitMaskPosition::ParseShorthand( const CSSValue* WebkitMaskPosition::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::BackgroundPositionOrWebkitMaskPosition( @@ -3030,7 +2958,6 @@ bool WebkitMaskRepeat::ParseShorthand( const CSSValue* WebkitMaskRepeat::CSSValueFromComputedStyleInternal( const ComputedStyle& style, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { return ComputedStyleUtils::BackgroundRepeatOrWebkitMaskRepeat( |