diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-08-28 15:28:34 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-08-28 13:54:51 +0000 |
commit | 2a19c63448c84c1805fb1a585c3651318bb86ca7 (patch) | |
tree | eb17888e8531aa6ee5e85721bd553b832a7e5156 /chromium/third_party/blink/renderer/core/css/properties | |
parent | b014812705fc80bff0a5c120dfcef88f349816dc (diff) | |
download | qtwebengine-chromium-2a19c63448c84c1805fb1a585c3651318bb86ca7.tar.gz |
BASELINE: Update Chromium to 69.0.3497.70
Change-Id: I2b7b56e4e7a8b26656930def0d4575dc32b900a0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/css/properties')
86 files changed, 1629 insertions, 405 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 c9bedf95a82..a651b7ff521 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 @@ -30,6 +30,7 @@ #include "third_party/blink/renderer/core/layout/layout_box.h" #include "third_party/blink/renderer/core/layout/layout_grid.h" #include "third_party/blink/renderer/core/style/computed_style_constants.h" +#include "third_party/blink/renderer/core/style/style_svg_resource.h" #include "third_party/blink/renderer/core/style_property_shorthand.h" 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 f9b66b3c5e0..218c46468cc 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 @@ -416,116 +416,6 @@ bool ConsumeTranslate3d(CSSParserTokenRange& args, return true; } -CSSValue* ConsumeTransformValue(CSSParserTokenRange& range, - const CSSParserContext& context, - bool use_legacy_parsing) { - CSSValueID function_id = range.Peek().FunctionId(); - if (function_id == CSSValueInvalid) - return nullptr; - CSSParserTokenRange args = CSSPropertyParserHelpers::ConsumeFunction(range); - if (args.AtEnd()) - return nullptr; - CSSFunctionValue* transform_value = CSSFunctionValue::Create(function_id); - CSSValue* parsed_value = nullptr; - switch (function_id) { - case CSSValueRotate: - case CSSValueRotateX: - case CSSValueRotateY: - case CSSValueRotateZ: - case CSSValueSkewX: - case CSSValueSkewY: - case CSSValueSkew: - parsed_value = CSSPropertyParserHelpers::ConsumeAngle( - args, &context, WebFeature::kUnitlessZeroAngleTransform); - if (!parsed_value) - return nullptr; - if (function_id == CSSValueSkew && - CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args)) { - transform_value->Append(*parsed_value); - parsed_value = CSSPropertyParserHelpers::ConsumeAngle( - args, &context, WebFeature::kUnitlessZeroAngleTransform); - if (!parsed_value) - return nullptr; - } - break; - case CSSValueScaleX: - case CSSValueScaleY: - case CSSValueScaleZ: - case CSSValueScale: - parsed_value = - CSSPropertyParserHelpers::ConsumeNumber(args, kValueRangeAll); - if (!parsed_value) - return nullptr; - if (function_id == CSSValueScale && - CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args)) { - transform_value->Append(*parsed_value); - parsed_value = - CSSPropertyParserHelpers::ConsumeNumber(args, kValueRangeAll); - if (!parsed_value) - return nullptr; - } - break; - case CSSValuePerspective: - if (!ConsumePerspective(args, context, transform_value, - use_legacy_parsing)) { - return nullptr; - } - break; - case CSSValueTranslateX: - case CSSValueTranslateY: - case CSSValueTranslate: - parsed_value = CSSPropertyParserHelpers::ConsumeLengthOrPercent( - args, context.Mode(), kValueRangeAll); - if (!parsed_value) - return nullptr; - if (function_id == CSSValueTranslate && - CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args)) { - transform_value->Append(*parsed_value); - parsed_value = CSSPropertyParserHelpers::ConsumeLengthOrPercent( - args, context.Mode(), kValueRangeAll); - if (!parsed_value) - return nullptr; - } - break; - case CSSValueTranslateZ: - parsed_value = CSSPropertyParserHelpers::ConsumeLength( - args, context.Mode(), kValueRangeAll); - break; - case CSSValueMatrix: - case CSSValueMatrix3d: - if (!ConsumeNumbers(args, transform_value, - (function_id == CSSValueMatrix3d) ? 16 : 6)) { - return nullptr; - } - break; - case CSSValueScale3d: - if (!ConsumeNumbers(args, transform_value, 3)) - return nullptr; - break; - case CSSValueRotate3d: - if (!ConsumeNumbers(args, transform_value, 3) || - !CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args)) { - return nullptr; - } - parsed_value = CSSPropertyParserHelpers::ConsumeAngle( - args, &context, WebFeature::kUnitlessZeroAngleTransform); - if (!parsed_value) - return nullptr; - break; - case CSSValueTranslate3d: - if (!ConsumeTranslate3d(args, context.Mode(), transform_value)) - return nullptr; - break; - default: - return nullptr; - } - if (parsed_value) - transform_value->Append(*parsed_value); - if (!args.AtEnd()) - return nullptr; - return transform_value; -} - } // namespace bool IsSelfPositionKeyword(CSSValueID id) { @@ -750,14 +640,7 @@ CSSPrimitiveValue* ConsumeLengthOrPercentCountNegative( CSSPrimitiveValue* result = ConsumeLengthOrPercent(range, context.Mode(), kValueRangeNonNegative, CSSPropertyParserHelpers::UnitlessQuirk::kForbid); - if (result || !negative_size) - return result; - - result = - ConsumeLengthOrPercent(range, context.Mode(), kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); - - if (result) + if (!result && negative_size) context.Count(*negative_size); return result; } @@ -777,6 +660,8 @@ CSSValue* ConsumeBackgroundSize(CSSParserTokenRange& range, horizontal = ConsumeLengthOrPercentCountNegative(range, context, negative_size); } + if (!horizontal) + return nullptr; CSSValue* vertical = nullptr; if (!range.AtEnd()) { @@ -2463,6 +2348,116 @@ CSSValue* ConsumeTextDecorationLine(CSSParserTokenRange& range) { return list; } +CSSValue* ConsumeTransformValue(CSSParserTokenRange& range, + const CSSParserContext& context, + bool use_legacy_parsing) { + CSSValueID function_id = range.Peek().FunctionId(); + if (function_id == CSSValueInvalid) + return nullptr; + CSSParserTokenRange args = CSSPropertyParserHelpers::ConsumeFunction(range); + if (args.AtEnd()) + return nullptr; + CSSFunctionValue* transform_value = CSSFunctionValue::Create(function_id); + CSSValue* parsed_value = nullptr; + switch (function_id) { + case CSSValueRotate: + case CSSValueRotateX: + case CSSValueRotateY: + case CSSValueRotateZ: + case CSSValueSkewX: + case CSSValueSkewY: + case CSSValueSkew: + parsed_value = CSSPropertyParserHelpers::ConsumeAngle( + args, &context, WebFeature::kUnitlessZeroAngleTransform); + if (!parsed_value) + return nullptr; + if (function_id == CSSValueSkew && + CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args)) { + transform_value->Append(*parsed_value); + parsed_value = CSSPropertyParserHelpers::ConsumeAngle( + args, &context, WebFeature::kUnitlessZeroAngleTransform); + if (!parsed_value) + return nullptr; + } + break; + case CSSValueScaleX: + case CSSValueScaleY: + case CSSValueScaleZ: + case CSSValueScale: + parsed_value = + CSSPropertyParserHelpers::ConsumeNumber(args, kValueRangeAll); + if (!parsed_value) + return nullptr; + if (function_id == CSSValueScale && + CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args)) { + transform_value->Append(*parsed_value); + parsed_value = + CSSPropertyParserHelpers::ConsumeNumber(args, kValueRangeAll); + if (!parsed_value) + return nullptr; + } + break; + case CSSValuePerspective: + if (!ConsumePerspective(args, context, transform_value, + use_legacy_parsing)) { + return nullptr; + } + break; + case CSSValueTranslateX: + case CSSValueTranslateY: + case CSSValueTranslate: + parsed_value = CSSPropertyParserHelpers::ConsumeLengthOrPercent( + args, context.Mode(), kValueRangeAll); + if (!parsed_value) + return nullptr; + if (function_id == CSSValueTranslate && + CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args)) { + transform_value->Append(*parsed_value); + parsed_value = CSSPropertyParserHelpers::ConsumeLengthOrPercent( + args, context.Mode(), kValueRangeAll); + if (!parsed_value) + return nullptr; + } + break; + case CSSValueTranslateZ: + parsed_value = CSSPropertyParserHelpers::ConsumeLength( + args, context.Mode(), kValueRangeAll); + break; + case CSSValueMatrix: + case CSSValueMatrix3d: + if (!ConsumeNumbers(args, transform_value, + (function_id == CSSValueMatrix3d) ? 16 : 6)) { + return nullptr; + } + break; + case CSSValueScale3d: + if (!ConsumeNumbers(args, transform_value, 3)) + return nullptr; + break; + case CSSValueRotate3d: + if (!ConsumeNumbers(args, transform_value, 3) || + !CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(args)) { + return nullptr; + } + parsed_value = CSSPropertyParserHelpers::ConsumeAngle( + args, &context, WebFeature::kUnitlessZeroAngleTransform); + if (!parsed_value) + return nullptr; + break; + case CSSValueTranslate3d: + if (!ConsumeTranslate3d(args, context.Mode(), transform_value)) + return nullptr; + break; + default: + return nullptr; + } + if (parsed_value) + transform_value->Append(*parsed_value); + if (!args.AtEnd()) + return nullptr; + return transform_value; +} + CSSValue* ConsumeTransformList(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext& local_context) { 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 a68f3b6652f..130ab18ecc0 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 @@ -213,6 +213,9 @@ bool ConsumeRadii(CSSValue* horizontal_radii[4], CSSValue* ConsumeTextDecorationLine(CSSParserTokenRange&); +CSSValue* ConsumeTransformValue(CSSParserTokenRange&, + const CSSParserContext&, + bool use_legacy_parsing); CSSValue* ConsumeTransformList(CSSParserTokenRange&, const CSSParserContext&, const CSSParserLocalContext&); diff --git a/chromium/third_party/blink/renderer/core/css/properties/css_parsing_utils_test.cc b/chromium/third_party/blink/renderer/core/css/properties/css_parsing_utils_test.cc index 2292232de94..b93ab5a6a82 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/css_parsing_utils_test.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/css_parsing_utils_test.cc @@ -13,6 +13,7 @@ namespace blink { TEST(CSSParsingUtilsTest, BasicShapeUseCount) { std::unique_ptr<DummyPageHolder> dummy_page_holder = DummyPageHolder::Create(IntSize(800, 600)); + Page::InsertOrdinaryPageForTesting(&dummy_page_holder->GetPage()); Document& document = dummy_page_holder->GetDocument(); WebFeature feature = WebFeature::kCSSBasicShape; EXPECT_FALSE(UseCounter::IsCounted(document, feature)); diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/baseline_shift_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/baseline_shift_custom.cc index 242da103d23..26734d4bc0d 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/baseline_shift_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/baseline_shift_custom.cc @@ -7,6 +7,7 @@ #include "third_party/blink/renderer/core/css/css_value_list.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" +#include "third_party/blink/renderer/core/css/resolver/style_builder_converter.h" #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { @@ -42,5 +43,39 @@ const CSSValue* BaselineShift::CSSValueFromComputedStyleInternal( 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()); +} + +void BaselineShift::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + SVGComputedStyle& svg_style = state.Style()->AccessSVGStyle(); + if (!value.IsIdentifierValue()) { + svg_style.SetBaselineShift(BS_LENGTH); + svg_style.SetBaselineShiftValue(StyleBuilderConverter::ConvertLength( + state, ToCSSPrimitiveValue(value))); + return; + } + switch (ToCSSIdentifierValue(value).GetValueID()) { + case CSSValueBaseline: + svg_style.SetBaselineShift(BS_LENGTH); + svg_style.SetBaselineShiftValue(Length(kFixed)); + return; + case CSSValueSub: + svg_style.SetBaselineShift(BS_SUB); + return; + case CSSValueSuper: + svg_style.SetBaselineShift(BS_SUPER); + return; + default: + NOTREACHED(); + } +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/block_size_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/block_size_custom.cc index ae88c121e49..0bf6c111c7a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/block_size_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/block_size_custom.cc @@ -6,6 +6,7 @@ #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" +#include "third_party/blink/renderer/core/layout/layout_object.h" namespace blink { namespace CSSLonghand { @@ -17,5 +18,10 @@ const CSSValue* BlockSize::ParseSingleValue( return CSSParsingUtils::ConsumeWidthOrHeight(range, context); } +bool BlockSize::IsLayoutDependent(const ComputedStyle* style, + LayoutObject* layout_object) const { + return layout_object && layout_object->IsBox(); +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_end_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_end_color_custom.cc index 1ddbbeeab24..584cd2e7b9b 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_end_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_end_color_custom.cc @@ -1,8 +1,8 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/longhands/webkit_border_end_color.h" +#include "third_party/blink/renderer/core/css/properties/longhands/border_block_end_color.h" #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" @@ -14,7 +14,7 @@ class CSSParserLocalContext; namespace CSSLonghand { -const CSSValue* WebkitBorderEndColor::ParseSingleValue( +const CSSValue* BorderBlockEndColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_end_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_end_width_custom.cc index 9cf3f207430..b51c04782ef 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_end_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_end_width_custom.cc @@ -1,8 +1,8 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/longhands/webkit_border_end_width.h" +#include "third_party/blink/renderer/core/css/properties/longhands/border_block_end_width.h" #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" @@ -12,7 +12,7 @@ namespace blink { namespace CSSLonghand { -const CSSValue* WebkitBorderEndWidth::ParseSingleValue( +const CSSValue* BorderBlockEndWidth::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_after_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_start_color_custom.cc index b0dbe9fa17d..30d384981f3 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_after_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_start_color_custom.cc @@ -1,8 +1,8 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/longhands/webkit_border_after_color.h" +#include "third_party/blink/renderer/core/css/properties/longhands/border_block_start_color.h" #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" @@ -14,7 +14,7 @@ class CSSParserLocalContext; namespace CSSLonghand { -const CSSValue* WebkitBorderAfterColor::ParseSingleValue( +const CSSValue* BorderBlockStartColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_after_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_start_width_custom.cc index ae13e62f563..a4bc114343b 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_after_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_block_start_width_custom.cc @@ -1,8 +1,8 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/longhands/webkit_border_after_width.h" +#include "third_party/blink/renderer/core/css/properties/longhands/border_block_start_width.h" #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" @@ -12,7 +12,7 @@ namespace blink { namespace CSSLonghand { -const CSSValue* WebkitBorderAfterWidth::ParseSingleValue( +const CSSValue* BorderBlockStartWidth::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_source_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_source_custom.cc index 98c7f78a7a9..89c113006e0 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_source_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_source_custom.cc @@ -38,5 +38,11 @@ const CSSValue* BorderImageSource::InitialValue() const { return &value; } +void BorderImageSource::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + state.Style()->SetBorderImageSource( + state.GetStyleImage(CSSPropertyBorderImageSource, value)); +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_start_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_end_color_custom.cc index 65aeb3e50cd..250d1d60b90 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_start_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_end_color_custom.cc @@ -1,8 +1,8 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/longhands/webkit_border_start_color.h" +#include "third_party/blink/renderer/core/css/properties/longhands/border_inline_end_color.h" #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" @@ -14,7 +14,7 @@ class CSSParserLocalContext; namespace CSSLonghand { -const CSSValue* WebkitBorderStartColor::ParseSingleValue( +const CSSValue* BorderInlineEndColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_start_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_end_width_custom.cc index 6074d69f766..9b239eac685 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_start_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_end_width_custom.cc @@ -1,8 +1,8 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/longhands/webkit_border_start_width.h" +#include "third_party/blink/renderer/core/css/properties/longhands/border_inline_end_width.h" #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" @@ -12,7 +12,7 @@ namespace blink { namespace CSSLonghand { -const CSSValue* WebkitBorderStartWidth::ParseSingleValue( +const CSSValue* BorderInlineEndWidth::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_before_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_start_color_custom.cc index 790ccb483de..927a86240e3 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_before_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_start_color_custom.cc @@ -1,8 +1,8 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/longhands/webkit_border_before_color.h" +#include "third_party/blink/renderer/core/css/properties/longhands/border_inline_start_color.h" #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" @@ -14,7 +14,7 @@ class CSSParserLocalContext; namespace CSSLonghand { -const CSSValue* WebkitBorderBeforeColor::ParseSingleValue( +const CSSValue* BorderInlineStartColor::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_before_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_start_width_custom.cc index 51321dd4fbb..803070f0843 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_before_width_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_inline_start_width_custom.cc @@ -1,8 +1,8 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/longhands/webkit_border_before_width.h" +#include "third_party/blink/renderer/core/css/properties/longhands/border_inline_start_width.h" #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" @@ -12,7 +12,7 @@ namespace blink { namespace CSSLonghand { -const CSSValue* WebkitBorderBeforeWidth::ParseSingleValue( +const CSSValue* BorderInlineStartWidth::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/caret_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/caret_color_custom.cc index db87c7fe11c..bd1010e20f8 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/caret_color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/caret_color_custom.cc @@ -7,6 +7,7 @@ #include "third_party/blink/renderer/core/css/css_color_value.h" #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" +#include "third_party/blink/renderer/core/css/resolver/style_builder_converter.h" #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { @@ -51,5 +52,33 @@ const CSSValue* CaretColor::CSSValueFromComputedStyleInternal( return cssvalue::CSSColorValue::Create(color.Rgb()); } +void CaretColor::ApplyInitial(StyleResolverState& state) const { + StyleAutoColor color = StyleAutoColor::AutoColor(); + if (state.ApplyPropertyToRegularStyle()) + state.Style()->SetCaretColor(color); + if (state.ApplyPropertyToVisitedLinkStyle()) + state.Style()->SetVisitedLinkCaretColor(color); +} + +void CaretColor::ApplyInherit(StyleResolverState& state) const { + StyleAutoColor color = state.ParentStyle()->CaretColor(); + if (state.ApplyPropertyToRegularStyle()) + state.Style()->SetCaretColor(color); + if (state.ApplyPropertyToVisitedLinkStyle()) + state.Style()->SetVisitedLinkCaretColor(color); +} + +void CaretColor::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + if (state.ApplyPropertyToRegularStyle()) { + state.Style()->SetCaretColor( + StyleBuilderConverter::ConvertStyleAutoColor(state, value)); + } + if (state.ApplyPropertyToVisitedLinkStyle()) { + state.Style()->SetVisitedLinkCaretColor( + StyleBuilderConverter::ConvertStyleAutoColor(state, value, true)); + } +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/clip_path_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/clip_path_custom.cc index 353f51daffa..cde4e5ba9bc 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/clip_path_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/clip_path_custom.cc @@ -9,6 +9,8 @@ #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" #include "third_party/blink/renderer/core/style/computed_style.h" +#include "third_party/blink/renderer/core/style/reference_clip_path_operation.h" +#include "third_party/blink/renderer/core/style/shape_clip_path_operation.h" namespace blink { namespace CSSLonghand { diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/color_custom.cc index 4bd493eaf14..8061da94d70 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/color_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/color_custom.cc @@ -8,6 +8,7 @@ #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "third_party/blink/renderer/core/css/parser/css_parser_mode.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" +#include "third_party/blink/renderer/core/css/resolver/style_builder_converter.h" #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { @@ -40,5 +41,37 @@ const CSSValue* Color::CSSValueFromComputedStyleInternal( : style.GetColor().Rgb()); } +void Color::ApplyInitial(StyleResolverState& state) const { + blink::Color color = ComputedStyleInitialValues::InitialColor(); + if (state.ApplyPropertyToRegularStyle()) + state.Style()->SetColor(color); + if (state.ApplyPropertyToVisitedLinkStyle()) + state.Style()->SetVisitedLinkColor(color); +} + +void Color::ApplyInherit(StyleResolverState& state) const { + blink::Color color = state.ParentStyle()->GetColor(); + if (state.ApplyPropertyToRegularStyle()) + state.Style()->SetColor(color); + if (state.ApplyPropertyToVisitedLinkStyle()) + state.Style()->SetVisitedLinkColor(color); +} + +void Color::ApplyValue(StyleResolverState& state, const CSSValue& value) const { + // As per the spec, 'color: currentColor' is treated as 'color: inherit' + if (value.IsIdentifierValue() && + ToCSSIdentifierValue(value).GetValueID() == CSSValueCurrentcolor) { + ApplyInherit(state); + return; + } + + if (state.ApplyPropertyToRegularStyle()) + state.Style()->SetColor(StyleBuilderConverter::ConvertColor(state, value)); + if (state.ApplyPropertyToVisitedLinkStyle()) { + state.Style()->SetVisitedLinkColor( + StyleBuilderConverter::ConvertColor(state, value, true)); + } +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/content_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/content_custom.cc index af51dda04f9..a9efadf71c6 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/content_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/content_custom.cc @@ -119,5 +119,95 @@ const CSSValue* Content::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForContentData(style); } +void Content::ApplyInitial(StyleResolverState& state) const { + state.Style()->SetContent(nullptr); +} + +void Content::ApplyInherit(StyleResolverState& state) const { + // FIXME: In CSS3, it will be possible to inherit content. In CSS2 it is not. + // This note is a reminder that eventually "inherit" needs to be supported. +} + +void Content::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + if (value.IsIdentifierValue()) { + DCHECK(ToCSSIdentifierValue(value).GetValueID() == CSSValueNormal || + ToCSSIdentifierValue(value).GetValueID() == CSSValueNone); + state.Style()->SetContent(nullptr); + return; + } + + ContentData* first_content = nullptr; + ContentData* prev_content = nullptr; + for (auto& item : ToCSSValueList(value)) { + ContentData* next_content = nullptr; + if (item->IsImageGeneratorValue() || item->IsImageSetValue() || + item->IsImageValue()) { + next_content = + ContentData::Create(state.GetStyleImage(CSSPropertyContent, *item)); + } else if (item->IsCounterValue()) { + const cssvalue::CSSCounterValue* counter_value = + cssvalue::ToCSSCounterValue(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 = ContentData::Create(std::move(counter)); + } else if (item->IsIdentifierValue()) { + QuoteType quote_type; + switch (ToCSSIdentifierValue(*item).GetValueID()) { + default: + NOTREACHED(); + FALLTHROUGH; + case CSSValueOpenQuote: + quote_type = QuoteType::kOpen; + break; + case CSSValueCloseQuote: + quote_type = QuoteType::kClose; + break; + case CSSValueNoOpenQuote: + quote_type = QuoteType::kNoOpen; + break; + case CSSValueNoCloseQuote: + quote_type = QuoteType::kNoClose; + break; + } + next_content = ContentData::Create(quote_type); + } else { + String string; + if (item->IsFunctionValue()) { + const CSSFunctionValue* function_value = ToCSSFunctionValue(item.Get()); + DCHECK_EQ(function_value->FunctionType(), CSSValueAttr); + state.Style()->SetUnique(); + // TODO: Can a namespace be specified for an attr(foo)? + QualifiedName attr( + g_null_atom, ToCSSCustomIdentValue(function_value->Item(0)).Value(), + g_null_atom); + const AtomicString& value = state.GetElement()->getAttribute(attr); + string = value.IsNull() ? g_empty_string : value.GetString(); + } else { + string = ToCSSStringValue(*item).Value(); + } + if (prev_content && prev_content->IsText()) { + TextContentData* text_content = ToTextContentData(prev_content); + text_content->SetText(text_content->GetText() + string); + continue; + } + next_content = ContentData::Create(string); + } + + if (!first_content) + first_content = next_content; + else + prev_content->SetNext(next_content); + + prev_content = next_content; + } + DCHECK(first_content); + state.Style()->SetContent(first_content); +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/cursor_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/cursor_custom.cc index 4b2b8d648b4..ae8607ec0ff 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/cursor_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/cursor_custom.cc @@ -27,10 +27,10 @@ const CSSValue* Cursor::ParseSingleValue(CSSParserTokenRange& range, IntPoint hot_spot(-1, -1); bool hot_spot_specified = false; if (CSSPropertyParserHelpers::ConsumeNumberRaw(range, num)) { - hot_spot.SetX(int(num)); + hot_spot.SetX(clampTo<int>(num)); if (!CSSPropertyParserHelpers::ConsumeNumberRaw(range, num)) return nullptr; - hot_spot.SetY(int(num)); + hot_spot.SetY(clampTo<int>(num)); hot_spot_specified = true; } @@ -99,5 +99,37 @@ const CSSValue* Cursor::CSSValueFromComputedStyleInternal( return value; } +void Cursor::ApplyInitial(StyleResolverState& state) const { + state.Style()->ClearCursorList(); + state.Style()->SetCursor(ComputedStyleInitialValues::InitialCursor()); +} + +void Cursor::ApplyInherit(StyleResolverState& state) const { + state.Style()->SetCursor(state.ParentStyle()->Cursor()); + state.Style()->SetCursorList(state.ParentStyle()->Cursors()); +} + +void Cursor::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + state.Style()->ClearCursorList(); + if (value.IsValueList()) { + state.Style()->SetCursor(ECursor::kAuto); + for (const auto& item : ToCSSValueList(value)) { + if (item->IsCursorImageValue()) { + const cssvalue::CSSCursorImageValue& cursor = + cssvalue::ToCSSCursorImageValue(*item); + const CSSValue& image = cursor.ImageValue(); + state.Style()->AddCursor(state.GetStyleImage(CSSPropertyCursor, image), + cursor.HotSpotSpecified(), cursor.HotSpot()); + } else { + state.Style()->SetCursor( + ToCSSIdentifierValue(*item).ConvertTo<ECursor>()); + } + } + } else { + state.Style()->SetCursor(ToCSSIdentifierValue(value).ConvertTo<ECursor>()); + } +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/direction_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/direction_custom.cc index ed8e51db52d..7cd95e7323f 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/direction_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/direction_custom.cc @@ -16,5 +16,11 @@ const CSSValue* Direction::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.Direction()); } +void Direction::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + state.Style()->SetDirection( + ToCSSIdentifierValue(value).ConvertTo<TextDirection>()); +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/display_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/display_custom.cc index 5ce16e23876..4d8e2fc6825 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/display_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/display_custom.cc @@ -59,5 +59,38 @@ const CSSValue* Display::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.Display()); } +void Display::ApplyInitial(StyleResolverState& state) const { + state.Style()->SetDisplay(ComputedStyleInitialValues::InitialDisplay()); + state.Style()->SetDisplayLayoutCustomName( + ComputedStyleInitialValues::InitialDisplayLayoutCustomName()); +} + +void Display::ApplyInherit(StyleResolverState& state) const { + state.Style()->SetDisplay(state.ParentStyle()->Display()); + state.Style()->SetDisplayLayoutCustomName( + state.ParentStyle()->DisplayLayoutCustomName()); +} + +void Display::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + if (value.IsIdentifierValue()) { + state.Style()->SetDisplay( + ToCSSIdentifierValue(value).ConvertTo<EDisplay>()); + state.Style()->SetDisplayLayoutCustomName( + ComputedStyleInitialValues::InitialDisplayLayoutCustomName()); + return; + } + + DCHECK(value.IsLayoutFunctionValue()); + const cssvalue::CSSLayoutFunctionValue& layout_function_value = + cssvalue::ToCSSLayoutFunctionValue(value); + + EDisplay display = layout_function_value.IsInline() + ? EDisplay::kInlineLayoutCustom + : EDisplay::kLayoutCustom; + state.Style()->SetDisplay(display); + state.Style()->SetDisplayLayoutCustomName(layout_function_value.GetName()); +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_template_areas_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_template_areas_custom.cc index fb868d561aa..67153f84505 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_template_areas_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/grid_template_areas_custom.cc @@ -10,6 +10,7 @@ #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/css/properties/computed_style_utils.h" #include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" +#include "third_party/blink/renderer/core/css/resolver/style_builder_converter.h" #include "third_party/blink/renderer/core/css_value_keywords.h" #include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/core/style/grid_area.h" @@ -59,5 +60,54 @@ const CSSValue* GridTemplateAreas::CSSValueFromComputedStyleInternal( style.NamedGridAreaColumnCount()); } +void GridTemplateAreas::ApplyInitial(StyleResolverState& state) const { + state.Style()->SetNamedGridArea( + ComputedStyleInitialValues::InitialNamedGridArea()); + state.Style()->SetNamedGridAreaRowCount( + ComputedStyleInitialValues::InitialNamedGridAreaRowCount()); + state.Style()->SetNamedGridAreaColumnCount( + ComputedStyleInitialValues::InitialNamedGridAreaColumnCount()); +} + +void GridTemplateAreas::ApplyInherit(StyleResolverState& state) const { + state.Style()->SetNamedGridArea(state.ParentStyle()->NamedGridArea()); + state.Style()->SetNamedGridAreaRowCount( + state.ParentStyle()->NamedGridAreaRowCount()); + state.Style()->SetNamedGridAreaColumnCount( + state.ParentStyle()->NamedGridAreaColumnCount()); +} + +void GridTemplateAreas::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + if (value.IsIdentifierValue()) { + // FIXME: Shouldn't we clear the grid-area values + DCHECK_EQ(ToCSSIdentifierValue(value).GetValueID(), CSSValueNone); + return; + } + + const CSSGridTemplateAreasValue& grid_template_areas_value = + ToCSSGridTemplateAreasValue(value); + const NamedGridAreaMap& new_named_grid_areas = + grid_template_areas_value.GridAreaMap(); + + NamedGridLinesMap named_grid_column_lines; + NamedGridLinesMap named_grid_row_lines; + StyleBuilderConverter::ConvertOrderedNamedGridLinesMapToNamedGridLinesMap( + state.Style()->OrderedNamedGridColumnLines(), named_grid_column_lines); + StyleBuilderConverter::ConvertOrderedNamedGridLinesMapToNamedGridLinesMap( + state.Style()->OrderedNamedGridRowLines(), named_grid_row_lines); + StyleBuilderConverter::CreateImplicitNamedGridLinesFromGridArea( + new_named_grid_areas, named_grid_column_lines, kForColumns); + StyleBuilderConverter::CreateImplicitNamedGridLinesFromGridArea( + new_named_grid_areas, named_grid_row_lines, kForRows); + state.Style()->SetNamedGridColumnLines(named_grid_column_lines); + state.Style()->SetNamedGridRowLines(named_grid_row_lines); + + state.Style()->SetNamedGridArea(new_named_grid_areas); + state.Style()->SetNamedGridAreaRowCount(grid_template_areas_value.RowCount()); + state.Style()->SetNamedGridAreaColumnCount( + grid_template_areas_value.ColumnCount()); +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/inline_size_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/inline_size_custom.cc index 5d0386051f2..5b7d8f892d8 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/inline_size_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/inline_size_custom.cc @@ -6,6 +6,7 @@ #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" +#include "third_party/blink/renderer/core/layout/layout_object.h" namespace blink { namespace CSSLonghand { @@ -17,5 +18,10 @@ const CSSValue* InlineSize::ParseSingleValue( return CSSParsingUtils::ConsumeWidthOrHeight(range, context); } +bool InlineSize::IsLayoutDependent(const ComputedStyle* style, + LayoutObject* layout_object) const { + return layout_object && layout_object->IsBox(); +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_end_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_block_end_custom.cc index 8e07cd5ceaa..631aa57ae9e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_end_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_block_end_custom.cc @@ -1,8 +1,8 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/longhands/webkit_margin_end.h" +#include "third_party/blink/renderer/core/css/properties/longhands/inset_block_end.h" #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" @@ -12,7 +12,7 @@ namespace blink { namespace CSSLonghand { -const CSSValue* WebkitMarginEnd::ParseSingleValue( +const CSSValue* InsetBlockEnd::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_start_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_block_start_custom.cc index a466a01907e..27cbd329d83 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_start_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_block_start_custom.cc @@ -1,8 +1,8 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/longhands/webkit_margin_start.h" +#include "third_party/blink/renderer/core/css/properties/longhands/inset_block_start.h" #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" @@ -12,7 +12,7 @@ namespace blink { namespace CSSLonghand { -const CSSValue* WebkitMarginStart::ParseSingleValue( +const CSSValue* InsetBlockStart::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_after_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_inline_end_custom.cc index 97fb130868a..6b1113d3795 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_after_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_inline_end_custom.cc @@ -1,8 +1,8 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/longhands/webkit_margin_after.h" +#include "third_party/blink/renderer/core/css/properties/longhands/inset_inline_end.h" #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" @@ -12,7 +12,7 @@ namespace blink { namespace CSSLonghand { -const CSSValue* WebkitMarginAfter::ParseSingleValue( +const CSSValue* InsetInlineEnd::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_before_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_inline_start_custom.cc index d90cc0249a2..2a394eba3d0 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_margin_before_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/inset_inline_start_custom.cc @@ -1,8 +1,8 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/longhands/webkit_margin_before.h" +#include "third_party/blink/renderer/core/css/properties/longhands/inset_inline_start.h" #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" @@ -12,7 +12,7 @@ namespace blink { namespace CSSLonghand { -const CSSValue* WebkitMarginBefore::ParseSingleValue( +const CSSValue* InsetInlineStart::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/list_style_image_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/list_style_image_custom.cc index 1af5930c6d8..8563f505af3 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/list_style_image_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/list_style_image_custom.cc @@ -31,5 +31,11 @@ const CSSValue* ListStyleImage::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(CSSValueNone); } +void ListStyleImage::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + state.Style()->SetListStyleImage( + state.GetStyleImage(CSSPropertyListStyleImage, value)); +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_block_end_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_block_end_custom.cc new file mode 100644 index 00000000000..1472ef90e71 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_block_end_custom.cc @@ -0,0 +1,24 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/longhands/margin_block_end.h" + +#include "third_party/blink/renderer/core/css/parser/css_parser_context.h" +#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" +#include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" +#include "third_party/blink/renderer/core/style_property_shorthand.h" + +namespace blink { +namespace CSSLonghand { + +const CSSValue* MarginBlockEnd::ParseSingleValue( + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&) const { + return CSSParsingUtils::ConsumeMarginOrOffset( + range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); +} + +} // namespace CSSLonghand +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_block_start_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_block_start_custom.cc new file mode 100644 index 00000000000..1cea46eee03 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_block_start_custom.cc @@ -0,0 +1,24 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/longhands/margin_block_start.h" + +#include "third_party/blink/renderer/core/css/parser/css_parser_context.h" +#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" +#include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" +#include "third_party/blink/renderer/core/style_property_shorthand.h" + +namespace blink { +namespace CSSLonghand { + +const CSSValue* MarginBlockStart::ParseSingleValue( + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&) const { + return CSSParsingUtils::ConsumeMarginOrOffset( + range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); +} + +} // namespace CSSLonghand +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_inline_end_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_inline_end_custom.cc new file mode 100644 index 00000000000..5dd6bdcbf1a --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_inline_end_custom.cc @@ -0,0 +1,24 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/longhands/margin_inline_end.h" + +#include "third_party/blink/renderer/core/css/parser/css_parser_context.h" +#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" +#include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" +#include "third_party/blink/renderer/core/style_property_shorthand.h" + +namespace blink { +namespace CSSLonghand { + +const CSSValue* MarginInlineEnd::ParseSingleValue( + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&) const { + return CSSParsingUtils::ConsumeMarginOrOffset( + range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); +} + +} // namespace CSSLonghand +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_inline_start_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_inline_start_custom.cc new file mode 100644 index 00000000000..c4134551d94 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/margin_inline_start_custom.cc @@ -0,0 +1,24 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/longhands/margin_inline_start.h" + +#include "third_party/blink/renderer/core/css/parser/css_parser_context.h" +#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" +#include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" +#include "third_party/blink/renderer/core/style_property_shorthand.h" + +namespace blink { +namespace CSSLonghand { + +const CSSValue* MarginInlineStart::ParseSingleValue( + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&) const { + return CSSParsingUtils::ConsumeMarginOrOffset( + range, context.Mode(), CSSPropertyParserHelpers::UnitlessQuirk::kForbid); +} + +} // namespace CSSLonghand +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/outline_style_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/outline_style_custom.cc index 8bd75d73eec..85ebb2889bf 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/outline_style_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/outline_style_custom.cc @@ -21,5 +21,25 @@ const CSSValue* OutlineStyle::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.OutlineStyle()); } +void OutlineStyle::ApplyInitial(StyleResolverState& state) const { + state.Style()->SetOutlineStyleIsAuto( + ComputedStyleInitialValues::InitialOutlineStyleIsAuto()); + state.Style()->SetOutlineStyle(EBorderStyle::kNone); +} + +void OutlineStyle::ApplyInherit(StyleResolverState& state) const { + state.Style()->SetOutlineStyleIsAuto( + state.ParentStyle()->OutlineStyleIsAuto()); + state.Style()->SetOutlineStyle(state.ParentStyle()->OutlineStyle()); +} + +void OutlineStyle::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + const CSSIdentifierValue& identifier_value = ToCSSIdentifierValue(value); + state.Style()->SetOutlineStyleIsAuto( + static_cast<bool>(identifier_value.ConvertTo<OutlineIsAuto>())); + state.Style()->SetOutlineStyle(identifier_value.ConvertTo<EBorderStyle>()); +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_padding_end_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_block_end_custom.cc index 04b3897e9e8..d0764c3e0bb 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_padding_end_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_block_end_custom.cc @@ -1,8 +1,8 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/longhands/webkit_padding_end.h" +#include "third_party/blink/renderer/core/css/properties/longhands/padding_block_end.h" #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "third_party/blink/renderer/core/css/parser/css_parser_token_range.h" @@ -12,7 +12,7 @@ namespace blink { namespace CSSLonghand { -const CSSValue* WebkitPaddingEnd::ParseSingleValue( +const CSSValue* PaddingBlockEnd::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_padding_after_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_block_start_custom.cc index 129b8b0218c..b431bcda79e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_padding_after_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_block_start_custom.cc @@ -1,8 +1,8 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/longhands/webkit_padding_after.h" +#include "third_party/blink/renderer/core/css/properties/longhands/padding_block_start.h" #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "third_party/blink/renderer/core/css/parser/css_parser_token_range.h" @@ -12,7 +12,7 @@ namespace blink { namespace CSSLonghand { -const CSSValue* WebkitPaddingAfter::ParseSingleValue( +const CSSValue* PaddingBlockStart::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_padding_start_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_inline_end_custom.cc index 0383dd562f5..371658bd81d 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_padding_start_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_inline_end_custom.cc @@ -1,8 +1,8 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/longhands/webkit_padding_start.h" +#include "third_party/blink/renderer/core/css/properties/longhands/padding_inline_end.h" #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "third_party/blink/renderer/core/css/parser/css_parser_token_range.h" @@ -12,7 +12,7 @@ namespace blink { namespace CSSLonghand { -const CSSValue* WebkitPaddingStart::ParseSingleValue( +const CSSValue* PaddingInlineEnd::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_padding_before_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_inline_start_custom.cc index 771e728e381..f5224eeb1d5 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_padding_before_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/padding_inline_start_custom.cc @@ -1,8 +1,8 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/longhands/webkit_padding_before.h" +#include "third_party/blink/renderer/core/css/properties/longhands/padding_inline_start.h" #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "third_party/blink/renderer/core/css/parser/css_parser_token_range.h" @@ -12,7 +12,7 @@ namespace blink { namespace CSSLonghand { -const CSSValue* WebkitPaddingBefore::ParseSingleValue( +const CSSValue* PaddingInlineStart::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/position_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/position_custom.cc index 436e3152e98..1b4c438e4dd 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/position_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/position_custom.cc @@ -16,5 +16,10 @@ const CSSValue* Position::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.GetPosition()); } +void Position::ApplyInherit(StyleResolverState& state) const { + if (!state.ParentNode()->IsDocumentNode()) + state.Style()->SetPosition(state.ParentStyle()->GetPosition()); +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/resize_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/resize_custom.cc index 2b257b0d310..646a4d6da2e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/resize_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/resize_custom.cc @@ -4,6 +4,10 @@ #include "third_party/blink/renderer/core/css/properties/longhands/resize.h" +#include "third_party/blink/renderer/core/frame/settings.h" +#include "third_party/blink/renderer/core/frame/use_counter.h" +#include "third_party/blink/renderer/core/frame/web_feature.h" + namespace blink { namespace CSSLonghand { @@ -16,5 +20,22 @@ const CSSValue* Resize::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.Resize()); } +void Resize::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + const CSSIdentifierValue& identifier_value = ToCSSIdentifierValue(value); + + EResize r = EResize::kNone; + if (identifier_value.GetValueID() == CSSValueAuto) { + if (Settings* settings = state.GetDocument().GetSettings()) { + r = settings->GetTextAreasAreResizable() ? EResize::kBoth + : EResize::kNone; + } + UseCounter::Count(state.GetDocument(), WebFeature::kCSSResizeAuto); + } else { + r = identifier_value.ConvertTo<EResize>(); + } + state.Style()->SetResize(r); +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/size_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/size_custom.cc index 5c4b0a7fd57..5ed6ab5d3c8 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/size_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/size_custom.cc @@ -4,6 +4,7 @@ #include "third_party/blink/renderer/core/css/properties/longhands/size.h" +#include "third_party/blink/renderer/core/css/css_resolution_units.h" #include "third_party/blink/renderer/core/css/css_value_list.h" #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" @@ -17,6 +18,36 @@ static CSSValue* ConsumePageSize(CSSParserTokenRange& range) { CSSValueLedger, CSSValueLegal, CSSValueLetter>(range); } +static float MmToPx(float mm) { + return mm * kCssPixelsPerMillimeter; +} +static float InchToPx(float inch) { + return inch * kCssPixelsPerInch; +} +static FloatSize GetPageSizeFromName(const CSSIdentifierValue& page_size_name) { + switch (page_size_name.GetValueID()) { + case CSSValueA5: + return FloatSize(MmToPx(148), MmToPx(210)); + case CSSValueA4: + return FloatSize(MmToPx(210), MmToPx(297)); + case CSSValueA3: + return FloatSize(MmToPx(297), MmToPx(420)); + case CSSValueB5: + return FloatSize(MmToPx(176), MmToPx(250)); + case CSSValueB4: + return FloatSize(MmToPx(250), MmToPx(353)); + case CSSValueLetter: + return FloatSize(InchToPx(8.5), InchToPx(11)); + case CSSValueLegal: + return FloatSize(InchToPx(8.5), InchToPx(14)); + case CSSValueLedger: + return FloatSize(InchToPx(11), InchToPx(17)); + default: + NOTREACHED(); + return FloatSize(0, 0); + } +} + const CSSValue* Size::ParseSingleValue(CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { @@ -53,5 +84,68 @@ const CSSValue* Size::ParseSingleValue(CSSParserTokenRange& range, return result; } +void Size::ApplyInitial(StyleResolverState& state) const {} + +void Size::ApplyInherit(StyleResolverState& state) const {} + +void Size::ApplyValue(StyleResolverState& state, const CSSValue& value) const { + state.Style()->ResetPageSizeType(); + FloatSize size; + EPageSizeType page_size_type = EPageSizeType::kAuto; + const CSSValueList& list = ToCSSValueList(value); + if (list.length() == 2) { + // <length>{2} | <page-size> <orientation> + const CSSValue& first = list.Item(0); + const CSSValue& second = list.Item(1); + if (first.IsPrimitiveValue() && ToCSSPrimitiveValue(first).IsLength()) { + // <length>{2} + size = FloatSize( + ToCSSPrimitiveValue(first).ComputeLength<float>( + state.CssToLengthConversionData().CopyWithAdjustedZoom(1.0)), + ToCSSPrimitiveValue(second).ComputeLength<float>( + state.CssToLengthConversionData().CopyWithAdjustedZoom(1.0))); + } else { + // <page-size> <orientation> + size = GetPageSizeFromName(ToCSSIdentifierValue(first)); + + DCHECK(ToCSSIdentifierValue(second).GetValueID() == CSSValueLandscape || + ToCSSIdentifierValue(second).GetValueID() == CSSValuePortrait); + if (ToCSSIdentifierValue(second).GetValueID() == CSSValueLandscape) + size = size.TransposedSize(); + } + page_size_type = EPageSizeType::kResolved; + } else { + DCHECK_EQ(list.length(), 1U); + // <length> | auto | <page-size> | [ portrait | landscape] + const CSSValue& first = list.Item(0); + if (first.IsPrimitiveValue() && ToCSSPrimitiveValue(first).IsLength()) { + // <length> + page_size_type = EPageSizeType::kResolved; + float width = ToCSSPrimitiveValue(first).ComputeLength<float>( + state.CssToLengthConversionData().CopyWithAdjustedZoom(1.0)); + size = FloatSize(width, width); + } else { + const CSSIdentifierValue& ident = ToCSSIdentifierValue(first); + switch (ident.GetValueID()) { + case CSSValueAuto: + page_size_type = EPageSizeType::kAuto; + break; + case CSSValuePortrait: + page_size_type = EPageSizeType::kPortrait; + break; + case CSSValueLandscape: + page_size_type = EPageSizeType::kLandscape; + break; + default: + // <page-size> + page_size_type = EPageSizeType::kResolved; + size = GetPageSizeFromName(ident); + } + } + } + state.Style()->SetPageSizeType(page_size_type); + state.Style()->SetPageSize(size); +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_align_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_align_custom.cc index 20e54c75905..4b614bd4faf 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_align_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_align_custom.cc @@ -16,5 +16,32 @@ const CSSValue* TextAlign::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.GetTextAlign()); } +void TextAlign::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + if (value.IsIdentifierValue() && + ToCSSIdentifierValue(value).GetValueID() != CSSValueWebkitMatchParent) { + // Special case for th elements - UA stylesheet text-align does not apply if + // parent's computed value for text-align is not its initial value + // https://html.spec.whatwg.org/multipage/rendering.html#tables-2 + const CSSIdentifierValue& ident_value = ToCSSIdentifierValue(value); + if (ident_value.GetValueID() == CSSValueInternalCenter && + state.ParentStyle()->GetTextAlign() != + ComputedStyleInitialValues::InitialTextAlign()) + state.Style()->SetTextAlign(state.ParentStyle()->GetTextAlign()); + else + state.Style()->SetTextAlign(ident_value.ConvertTo<ETextAlign>()); + } else if (state.ParentStyle()->GetTextAlign() == ETextAlign::kStart) { + state.Style()->SetTextAlign(state.ParentStyle()->IsLeftToRightDirection() + ? ETextAlign::kLeft + : ETextAlign::kRight); + } else if (state.ParentStyle()->GetTextAlign() == ETextAlign::kEnd) { + state.Style()->SetTextAlign(state.ParentStyle()->IsLeftToRightDirection() + ? ETextAlign::kRight + : ETextAlign::kLeft); + } else { + state.Style()->SetTextAlign(state.ParentStyle()->GetTextAlign()); + } +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_indent_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_indent_custom.cc index 2b1cd444411..2b3e126b407 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_indent_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_indent_custom.cc @@ -20,42 +20,43 @@ const CSSValue* TextIndent::ParseSingleValue( const CSSParserLocalContext&) const { // [ <length> | <percentage> ] && hanging? && each-line? // Keywords only allowed when css3Text is enabled. - CSSValueList* list = CSSValueList::CreateSpaceSeparated(); - - bool has_length_or_percentage = false; - bool has_each_line = false; - bool has_hanging = false; - + CSSValue* length_percentage = nullptr; + CSSValue* hanging = nullptr; + CSSValue* each_line = nullptr; do { - if (!has_length_or_percentage) { - if (CSSValue* text_indent = - CSSPropertyParserHelpers::ConsumeLengthOrPercent( - range, context.Mode(), kValueRangeAll, - CSSPropertyParserHelpers::UnitlessQuirk::kAllow)) { - list->Append(*text_indent); - has_length_or_percentage = true; + if (!length_percentage) { + length_percentage = CSSPropertyParserHelpers::ConsumeLengthOrPercent( + range, context.Mode(), kValueRangeAll, + CSSPropertyParserHelpers::UnitlessQuirk::kAllow); + if (length_percentage) { continue; } } if (RuntimeEnabledFeatures::CSS3TextEnabled()) { CSSValueID id = range.Peek().Id(); - if (!has_each_line && id == CSSValueEachLine) { - list->Append(*CSSPropertyParserHelpers::ConsumeIdent(range)); - has_each_line = true; + if (!hanging && id == CSSValueHanging) { + hanging = CSSPropertyParserHelpers::ConsumeIdent(range); continue; } - if (!has_hanging && id == CSSValueHanging) { - list->Append(*CSSPropertyParserHelpers::ConsumeIdent(range)); - has_hanging = true; + if (!each_line && id == CSSValueEachLine) { + each_line = CSSPropertyParserHelpers::ConsumeIdent(range); continue; } } return nullptr; } while (!range.AtEnd()); - if (!has_length_or_percentage) + if (!length_percentage) return nullptr; + CSSValueList* list = CSSValueList::CreateSpaceSeparated(); + list->Append(*length_percentage); + + if (hanging) + list->Append(*hanging); + + if (each_line) + list->Append(*each_line); return list; } @@ -69,16 +70,57 @@ const CSSValue* TextIndent::CSSValueFromComputedStyleInternal( CSSValueList* list = CSSValueList::CreateSpaceSeparated(); list->Append(*ComputedStyleUtils::ZoomAdjustedPixelValueForLength( style.TextIndent(), style)); - if (RuntimeEnabledFeatures::CSS3TextEnabled() && - (style.GetTextIndentLine() == TextIndentLine::kEachLine || - style.GetTextIndentType() == TextIndentType::kHanging)) { - if (style.GetTextIndentLine() == TextIndentLine::kEachLine) - list->Append(*CSSIdentifierValue::Create(CSSValueEachLine)); + if (RuntimeEnabledFeatures::CSS3TextEnabled()) { if (style.GetTextIndentType() == TextIndentType::kHanging) list->Append(*CSSIdentifierValue::Create(CSSValueHanging)); + if (style.GetTextIndentLine() == TextIndentLine::kEachLine) + list->Append(*CSSIdentifierValue::Create(CSSValueEachLine)); } return list; } +void TextIndent::ApplyInitial(StyleResolverState& state) const { + state.Style()->SetTextIndent(ComputedStyleInitialValues::InitialTextIndent()); + state.Style()->SetTextIndentLine( + ComputedStyleInitialValues::InitialTextIndentLine()); + state.Style()->SetTextIndentType( + ComputedStyleInitialValues::InitialTextIndentType()); +} + +void TextIndent::ApplyInherit(StyleResolverState& state) const { + state.Style()->SetTextIndent(state.ParentStyle()->TextIndent()); + state.Style()->SetTextIndentLine(state.ParentStyle()->GetTextIndentLine()); + state.Style()->SetTextIndentType(state.ParentStyle()->GetTextIndentType()); +} + +void TextIndent::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + Length length_or_percentage_value; + TextIndentLine text_indent_line_value = + ComputedStyleInitialValues::InitialTextIndentLine(); + TextIndentType text_indent_type_value = + ComputedStyleInitialValues::InitialTextIndentType(); + + for (auto& list_value : ToCSSValueList(value)) { + if (list_value->IsPrimitiveValue()) { + length_or_percentage_value = + ToCSSPrimitiveValue(*list_value) + .ConvertToLength(state.CssToLengthConversionData()); + } else if (ToCSSIdentifierValue(*list_value).GetValueID() == + CSSValueEachLine) { + text_indent_line_value = TextIndentLine::kEachLine; + } else if (ToCSSIdentifierValue(*list_value).GetValueID() == + CSSValueHanging) { + text_indent_type_value = TextIndentType::kHanging; + } else { + NOTREACHED(); + } + } + + state.Style()->SetTextIndent(length_or_percentage_value); + state.Style()->SetTextIndentLine(text_indent_line_value); + state.Style()->SetTextIndentType(text_indent_type_value); +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_orientation_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_orientation_custom.cc index 6ececb1a4e7..80680e04cf4 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_orientation_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_orientation_custom.cc @@ -16,5 +16,11 @@ const CSSValue* TextOrientation::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.GetTextOrientation()); } +void TextOrientation::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + state.SetTextOrientation( + ToCSSIdentifierValue(value).ConvertTo<ETextOrientation>()); +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_underline_position_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_underline_position_custom.cc index 45c9d23c0a0..882eb40ca80 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/text_underline_position_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/text_underline_position_custom.cc @@ -4,20 +4,43 @@ #include "third_party/blink/renderer/core/css/properties/longhands/text_underline_position.h" +#include "third_party/blink/renderer/core/css/css_identifier_value.h" +#include "third_party/blink/renderer/core/css/css_value_list.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { namespace CSSLonghand { +// auto | [ under || [ left | right ] ] const CSSValue* TextUnderlinePosition::ParseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&) const { - // auto | [ under || [ left | right ] ], but we only support auto | under - // for now - return CSSPropertyParserHelpers::ConsumeIdent<CSSValueAuto, CSSValueUnder>( - range); + if (range.Peek().Id() == CSSValueAuto) + return CSSPropertyParserHelpers::ConsumeIdent(range); + + CSSIdentifierValue* under_value = + CSSPropertyParserHelpers::ConsumeIdent<CSSValueUnder>(range); + CSSIdentifierValue* left_or_right_value = nullptr; + if (RuntimeEnabledFeatures::TextUnderlinePositionLeftRightEnabled()) { + left_or_right_value = + CSSPropertyParserHelpers::ConsumeIdent<CSSValueLeft, CSSValueRight>( + range); + if (left_or_right_value && !under_value) { + under_value = + CSSPropertyParserHelpers::ConsumeIdent<CSSValueUnder>(range); + } + } + if (!under_value && !left_or_right_value) { + return nullptr; + } + CSSValueList* list = CSSValueList::CreateSpaceSeparated(); + if (under_value) + list->Append(*under_value); + if (left_or_right_value) + list->Append(*left_or_right_value); + return list; } const CSSValue* TextUnderlinePosition::CSSValueFromComputedStyleInternal( @@ -26,7 +49,25 @@ const CSSValue* TextUnderlinePosition::CSSValueFromComputedStyleInternal( const LayoutObject*, Node*, bool allow_visited_style) const { - return CSSIdentifierValue::Create(style.GetTextUnderlinePosition()); + auto text_underline_position = style.TextUnderlinePosition(); + if (text_underline_position == kTextUnderlinePositionAuto) + return CSSIdentifierValue::Create(CSSValueAuto); + if (text_underline_position == kTextUnderlinePositionUnder) + return CSSIdentifierValue::Create(CSSValueUnder); + if (text_underline_position == kTextUnderlinePositionLeft) + return CSSIdentifierValue::Create(CSSValueLeft); + if (text_underline_position == kTextUnderlinePositionRight) + return CSSIdentifierValue::Create(CSSValueRight); + + CSSValueList* list = CSSValueList::CreateSpaceSeparated(); + DCHECK(text_underline_position & kTextUnderlinePositionUnder); + list->Append(*CSSIdentifierValue::Create(CSSValueUnder)); + if (text_underline_position & kTextUnderlinePositionLeft) + list->Append(*CSSIdentifierValue::Create(CSSValueLeft)); + if (text_underline_position & kTextUnderlinePositionRight) + list->Append(*CSSIdentifierValue::Create(CSSValueRight)); + DCHECK_EQ(list->length(), 2U); + return list; } } // namespace CSSLonghand diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/variable.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/variable.cc new file mode 100644 index 00000000000..2e4064b3561 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/variable.cc @@ -0,0 +1,98 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/longhands/variable.h" + +#include "third_party/blink/renderer/core/css/css_custom_property_declaration.h" +#include "third_party/blink/renderer/core/css/property_registration.h" +#include "third_party/blink/renderer/core/css/property_registry.h" +#include "third_party/blink/renderer/core/style/computed_style.h" + +namespace blink { + +void Variable::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + const CSSCustomPropertyDeclaration& declaration = + ToCSSCustomPropertyDeclaration(value); + const AtomicString& name = declaration.GetName(); + const PropertyRegistration* registration = nullptr; + const PropertyRegistry* registry = state.GetDocument().GetPropertyRegistry(); + if (registry) + registration = registry->Registration(name); + + bool is_inherited_property = !registration || registration->Inherits(); + bool initial = declaration.IsInitial(is_inherited_property); + bool inherit = declaration.IsInherit(is_inherited_property); + DCHECK(!(initial && inherit)); + + if (!initial && !inherit) { + if (declaration.Value()->NeedsVariableResolution()) { + if (is_inherited_property) { + state.Style()->SetUnresolvedInheritedVariable(name, + declaration.Value()); + } else { + state.Style()->SetUnresolvedNonInheritedVariable(name, + declaration.Value()); + } + return; + } + + if (!registration) { + state.Style()->SetResolvedUnregisteredVariable(name, declaration.Value()); + return; + } + + const CSSValue* parsed_value = declaration.Value()->ParseForSyntax( + registration->Syntax(), state.GetDocument().GetSecureContextMode()); + if (parsed_value) { + DCHECK(parsed_value); + if (is_inherited_property) { + state.Style()->SetResolvedInheritedVariable(name, declaration.Value(), + parsed_value); + } else { + state.Style()->SetResolvedNonInheritedVariable( + name, declaration.Value(), parsed_value); + } + return; + } + if (is_inherited_property) + inherit = true; + else + initial = true; + } + DCHECK(initial ^ inherit); + + state.Style()->RemoveVariable(name, is_inherited_property); + if (initial) { + return; + } + + DCHECK(inherit); + CSSVariableData* parent_value = + state.ParentStyle()->GetVariable(name, is_inherited_property); + const CSSValue* parent_css_value = + registration && parent_value ? state.ParentStyle()->GetRegisteredVariable( + name, is_inherited_property) + : nullptr; + + if (!is_inherited_property) { + DCHECK(registration); + if (parent_value) { + state.Style()->SetResolvedNonInheritedVariable(name, parent_value, + parent_css_value); + } + return; + } + + if (parent_value) { + if (!registration) { + state.Style()->SetResolvedUnregisteredVariable(name, parent_value); + } else { + state.Style()->SetResolvedInheritedVariable(name, parent_value, + parent_css_value); + } + } +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/variable.h b/chromium/third_party/blink/renderer/core/css/properties/longhands/variable.h index 34dbd49c5c3..e10d8238cd0 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/variable.h +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/variable.h @@ -9,13 +9,13 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTIES_LONGHANDS_VARIABLE_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTIES_LONGHANDS_VARIABLE_H_ -#include "third_party/blink/renderer/core/css/properties/css_property.h" +#include "third_party/blink/renderer/core/css/properties/longhand.h" namespace blink { -class Variable final : public CSSProperty { +class Variable final : public Longhand { public: - constexpr Variable() : CSSProperty() {} + constexpr Variable() : Longhand() {} bool IsInherited() const override { return true; } bool IsAffectedByAll() const override { return false; } @@ -34,6 +34,9 @@ class Variable final : public CSSProperty { NOTREACHED(); return nullptr; } + + void ApplyValue(StyleResolverState& state, + const CSSValue& value) const override; }; } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/vertical_align_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/vertical_align_custom.cc index 564fc7c3a74..faebb54554b 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/vertical_align_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/vertical_align_custom.cc @@ -59,5 +59,26 @@ const CSSValue* VerticalAlign::CSSValueFromComputedStyleInternal( return nullptr; } +void VerticalAlign::ApplyInherit(StyleResolverState& state) const { + EVerticalAlign vertical_align = state.ParentStyle()->VerticalAlign(); + state.Style()->SetVerticalAlign(vertical_align); + if (vertical_align == EVerticalAlign::kLength) { + state.Style()->SetVerticalAlignLength( + state.ParentStyle()->GetVerticalAlignLength()); + } +} + +void VerticalAlign::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + if (value.IsIdentifierValue()) { + state.Style()->SetVerticalAlign( + ToCSSIdentifierValue(value).ConvertTo<EVerticalAlign>()); + } else { + state.Style()->SetVerticalAlignLength( + ToCSSPrimitiveValue(value).ConvertToLength( + state.CssToLengthConversionData())); + } +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_app_region_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_app_region_custom.cc index 9bd8df3eab6..acf27dac60f 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_app_region_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_app_region_custom.cc @@ -24,5 +24,19 @@ const CSSValue* WebkitAppRegion::CSSValueFromComputedStyleInternal( : CSSValueNoDrag); } +void WebkitAppRegion::ApplyInitial(StyleResolverState& state) const {} + +void WebkitAppRegion::ApplyInherit(StyleResolverState& state) const {} + +void WebkitAppRegion::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + const CSSIdentifierValue& identifier_value = ToCSSIdentifierValue(value); + state.Style()->SetDraggableRegionMode(identifier_value.GetValueID() == + CSSValueDrag + ? EDraggableRegionMode::kDrag + : EDraggableRegionMode::kNoDrag); + state.GetDocument().SetHasAnnotatedRegions(true); +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_image_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_image_custom.cc index fb50a817491..700e42d5a6c 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_image_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_border_image_custom.cc @@ -27,5 +27,13 @@ const CSSValue* WebkitBorderImage::CSSValueFromComputedStyleInternal( return ComputedStyleUtils::ValueForNinePieceImage(style.BorderImage(), style); } +void WebkitBorderImage::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + NinePieceImage image; + CSSToStyleMap::MapNinePieceImage(state, CSSPropertyWebkitBorderImage, value, + image); + state.Style()->SetBorderImage(image); +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_locale_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_locale_custom.cc index 9de939565ed..96b3e203bb8 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_locale_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_locale_custom.cc @@ -31,5 +31,16 @@ const CSSValue* WebkitLocale::CSSValueFromComputedStyleInternal( return CSSStringValue::Create(style.Locale()); } +void WebkitLocale::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + if (value.IsIdentifierValue()) { + DCHECK_EQ(ToCSSIdentifierValue(value).GetValueID(), CSSValueAuto); + state.GetFontBuilder().SetLocale(nullptr); + } else { + state.GetFontBuilder().SetLocale( + LayoutLocale::Get(AtomicString(ToCSSStringValue(value).Value()))); + } +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_logical_height_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_logical_height_custom.cc deleted file mode 100644 index 51ab4e86c0e..00000000000 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_logical_height_custom.cc +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "third_party/blink/renderer/core/css/properties/longhands/webkit_logical_height.h" - -#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" -#include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" - -namespace blink { -namespace CSSLonghand { - -const CSSValue* WebkitLogicalHeight::ParseSingleValue( - CSSParserTokenRange& range, - const CSSParserContext& context, - const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeWidthOrHeight(range, context); -} - -} // namespace CSSLonghand -} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_logical_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_logical_width_custom.cc deleted file mode 100644 index 181dd754ad6..00000000000 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_logical_width_custom.cc +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "third_party/blink/renderer/core/css/properties/longhands/webkit_logical_width.h" - -#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" -#include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" - -namespace blink { -namespace CSSLonghand { - -const CSSValue* WebkitLogicalWidth::ParseSingleValue( - CSSParserTokenRange& range, - const CSSParserContext& context, - const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeWidthOrHeight(range, context); -} - -} // namespace CSSLonghand -} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_source_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_source_custom.cc index 39721e3c258..7390074dd9a 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_source_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_mask_box_image_source_custom.cc @@ -31,5 +31,11 @@ const CSSValue* WebkitMaskBoxImageSource::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(CSSValueNone); } +void WebkitMaskBoxImageSource::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + state.Style()->SetMaskBoxImageSource( + state.GetStyleImage(CSSPropertyWebkitMaskBoxImageSource, value)); +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_max_logical_height_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_max_logical_height_custom.cc deleted file mode 100644 index b7c5833c9cd..00000000000 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_max_logical_height_custom.cc +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "third_party/blink/renderer/core/css/properties/longhands/webkit_max_logical_height.h" - -#include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" - -namespace blink { -namespace CSSLonghand { - -const CSSValue* WebkitMaxLogicalHeight::ParseSingleValue( - CSSParserTokenRange& range, - const CSSParserContext& context, - const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeMaxWidthOrHeight(range, context); -} - -} // namespace CSSLonghand -} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_max_logical_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_max_logical_width_custom.cc deleted file mode 100644 index 150ad71b164..00000000000 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_max_logical_width_custom.cc +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "third_party/blink/renderer/core/css/properties/longhands/webkit_max_logical_width.h" - -#include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" - -namespace blink { -namespace CSSLonghand { - -const CSSValue* WebkitMaxLogicalWidth::ParseSingleValue( - CSSParserTokenRange& range, - const CSSParserContext& context, - const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeMaxWidthOrHeight(range, context); -} - -} // namespace CSSLonghand -} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_min_logical_height_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_min_logical_height_custom.cc deleted file mode 100644 index 8f001e7e73e..00000000000 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_min_logical_height_custom.cc +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "third_party/blink/renderer/core/css/properties/longhands/webkit_min_logical_height.h" - -#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" -#include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" - -namespace blink { -namespace CSSLonghand { - -const CSSValue* WebkitMinLogicalHeight::ParseSingleValue( - CSSParserTokenRange& range, - const CSSParserContext& context, - const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeWidthOrHeight(range, context); -} - -} // namespace CSSLonghand -} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_min_logical_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_min_logical_width_custom.cc deleted file mode 100644 index 440f38802dc..00000000000 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_min_logical_width_custom.cc +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "third_party/blink/renderer/core/css/properties/longhands/webkit_min_logical_width.h" - -#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" -#include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" - -namespace blink { -namespace CSSLonghand { - -const CSSValue* WebkitMinLogicalWidth::ParseSingleValue( - CSSParserTokenRange& range, - const CSSParserContext& context, - const CSSParserLocalContext&) const { - return CSSParsingUtils::ConsumeWidthOrHeight(range, context); -} - -} // namespace CSSLonghand -} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_emphasis_style_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_emphasis_style_custom.cc index 1bb819692e4..cbc33535993 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_emphasis_style_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_emphasis_style_custom.cc @@ -79,5 +79,64 @@ const CSSValue* WebkitTextEmphasisStyle::CSSValueFromComputedStyleInternal( return nullptr; } +void WebkitTextEmphasisStyle::ApplyInitial(StyleResolverState& state) const { + state.Style()->SetTextEmphasisFill( + ComputedStyleInitialValues::InitialTextEmphasisFill()); + state.Style()->SetTextEmphasisMark( + ComputedStyleInitialValues::InitialTextEmphasisMark()); + state.Style()->SetTextEmphasisCustomMark( + ComputedStyleInitialValues::InitialTextEmphasisCustomMark()); +} + +void WebkitTextEmphasisStyle::ApplyInherit(StyleResolverState& state) const { + state.Style()->SetTextEmphasisFill( + state.ParentStyle()->GetTextEmphasisFill()); + state.Style()->SetTextEmphasisMark( + state.ParentStyle()->GetTextEmphasisMark()); + state.Style()->SetTextEmphasisCustomMark( + state.ParentStyle()->TextEmphasisCustomMark()); +} + +void WebkitTextEmphasisStyle::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + if (value.IsValueList()) { + const CSSValueList& list = ToCSSValueList(value); + DCHECK_EQ(list.length(), 2U); + for (unsigned i = 0; i < 2; ++i) { + const CSSIdentifierValue& value = ToCSSIdentifierValue(list.Item(i)); + if (value.GetValueID() == CSSValueFilled || + value.GetValueID() == CSSValueOpen) + state.Style()->SetTextEmphasisFill(value.ConvertTo<TextEmphasisFill>()); + else + state.Style()->SetTextEmphasisMark(value.ConvertTo<TextEmphasisMark>()); + } + state.Style()->SetTextEmphasisCustomMark(g_null_atom); + return; + } + + if (value.IsStringValue()) { + state.Style()->SetTextEmphasisFill(TextEmphasisFill::kFilled); + state.Style()->SetTextEmphasisMark(TextEmphasisMark::kCustom); + state.Style()->SetTextEmphasisCustomMark( + AtomicString(ToCSSStringValue(value).Value())); + return; + } + + const CSSIdentifierValue& identifier_value = ToCSSIdentifierValue(value); + + state.Style()->SetTextEmphasisCustomMark(g_null_atom); + + if (identifier_value.GetValueID() == CSSValueFilled || + identifier_value.GetValueID() == CSSValueOpen) { + state.Style()->SetTextEmphasisFill( + identifier_value.ConvertTo<TextEmphasisFill>()); + state.Style()->SetTextEmphasisMark(TextEmphasisMark::kAuto); + } else { + state.Style()->SetTextEmphasisFill(TextEmphasisFill::kFilled); + state.Style()->SetTextEmphasisMark( + identifier_value.ConvertTo<TextEmphasisMark>()); + } +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_orientation_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_orientation_custom.cc index 3662d685dba..fa32fe3a0e2 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_orientation_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_text_orientation_custom.cc @@ -20,5 +20,11 @@ const CSSValue* WebkitTextOrientation::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.GetTextOrientation()); } +void WebkitTextOrientation::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + state.SetTextOrientation( + ToCSSIdentifierValue(value).ConvertTo<ETextOrientation>()); +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_writing_mode_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_writing_mode_custom.cc index dbece1cf8ee..1aa5e106d86 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_writing_mode_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/webkit_writing_mode_custom.cc @@ -16,5 +16,11 @@ const CSSValue* WebkitWritingMode::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.GetWritingMode()); } +void WebkitWritingMode::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + state.SetWritingMode( + ToCSSIdentifierValue(value).ConvertTo<blink::WritingMode>()); +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/will_change_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/will_change_custom.cc index 8a362a70969..8caadeae027 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/will_change_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/will_change_custom.cc @@ -81,5 +81,56 @@ const CSSValue* WillChange::CSSValueFromComputedStyleInternal( style.WillChangeScrollPosition()); } +void WillChange::ApplyInitial(StyleResolverState& state) const { + state.Style()->SetWillChangeContents(false); + state.Style()->SetWillChangeScrollPosition(false); + state.Style()->SetWillChangeProperties(Vector<CSSPropertyID>()); + state.Style()->SetSubtreeWillChangeContents( + state.ParentStyle()->SubtreeWillChangeContents()); +} + +void WillChange::ApplyInherit(StyleResolverState& state) const { + state.Style()->SetWillChangeContents( + state.ParentStyle()->WillChangeContents()); + state.Style()->SetWillChangeScrollPosition( + state.ParentStyle()->WillChangeScrollPosition()); + state.Style()->SetWillChangeProperties( + state.ParentStyle()->WillChangeProperties()); + state.Style()->SetSubtreeWillChangeContents( + state.ParentStyle()->SubtreeWillChangeContents()); +} + +void WillChange::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + bool will_change_contents = false; + bool will_change_scroll_position = false; + Vector<CSSPropertyID> will_change_properties; + + if (value.IsIdentifierValue()) { + DCHECK_EQ(ToCSSIdentifierValue(value).GetValueID(), CSSValueAuto); + } else { + DCHECK(value.IsValueList()); + for (auto& will_change_value : ToCSSValueList(value)) { + if (will_change_value->IsCustomIdentValue()) { + will_change_properties.push_back( + ToCSSCustomIdentValue(*will_change_value).ValueAsPropertyID()); + } else if (ToCSSIdentifierValue(*will_change_value).GetValueID() == + CSSValueContents) { + will_change_contents = true; + } else if (ToCSSIdentifierValue(*will_change_value).GetValueID() == + CSSValueScrollPosition) { + will_change_scroll_position = true; + } else { + NOTREACHED(); + } + } + } + state.Style()->SetWillChangeContents(will_change_contents); + state.Style()->SetWillChangeScrollPosition(will_change_scroll_position); + state.Style()->SetWillChangeProperties(will_change_properties); + state.Style()->SetSubtreeWillChangeContents( + will_change_contents || state.ParentStyle()->SubtreeWillChangeContents()); +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/word_wrap_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/word_wrap_custom.cc deleted file mode 100644 index 76a1d958961..00000000000 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/word_wrap_custom.cc +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "third_party/blink/renderer/core/css/properties/longhands/word_wrap.h" - -namespace blink { -namespace CSSLonghand { - -const CSSValue* WordWrap::CSSValueFromComputedStyleInternal( - const ComputedStyle& style, - const SVGComputedStyle&, - const LayoutObject*, - Node*, - bool allow_visited_style) const { - return CSSIdentifierValue::Create(style.OverflowWrap()); -} - -} // namespace CSSLonghand -} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/writing_mode_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/writing_mode_custom.cc index 9d510d0c545..36b2dd68322 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/writing_mode_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/writing_mode_custom.cc @@ -16,5 +16,11 @@ const CSSValue* WritingMode::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.GetWritingMode()); } +void WritingMode::ApplyValue(StyleResolverState& state, + const CSSValue& value) const { + state.SetWritingMode( + ToCSSIdentifierValue(value).ConvertTo<blink::WritingMode>()); +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/zoom_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/zoom_custom.cc index 99e37a1dc6b..150dc75aefa 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/longhands/zoom_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/zoom_custom.cc @@ -48,5 +48,37 @@ const CSSValue* Zoom::CSSValueFromComputedStyleInternal( CSSPrimitiveValue::UnitType::kNumber); } +void Zoom::ApplyInitial(StyleResolverState& state) const { + state.SetZoom(ComputedStyleInitialValues::InitialZoom()); +} + +void Zoom::ApplyInherit(StyleResolverState& state) const { + state.SetZoom(state.ParentStyle()->Zoom()); +} + +void Zoom::ApplyValue(StyleResolverState& state, const CSSValue& value) const { + SECURITY_DCHECK(value.IsPrimitiveValue() || value.IsIdentifierValue()); + + if (value.IsIdentifierValue()) { + const CSSIdentifierValue& identifier_value = ToCSSIdentifierValue(value); + if (identifier_value.GetValueID() == CSSValueNormal) { + state.SetZoom(ComputedStyleInitialValues::InitialZoom()); + } + } else if (value.IsPrimitiveValue()) { + const CSSPrimitiveValue& primitive_value = ToCSSPrimitiveValue(value); + if (primitive_value.IsPercentage()) { + if (float percent = primitive_value.GetFloatValue()) + state.SetZoom(percent / 100.0f); + else + state.SetZoom(1.0f); + } else if (primitive_value.IsNumber()) { + if (float number = primitive_value.GetFloatValue()) + state.SetZoom(number); + else + state.SetZoom(1.0f); + } + } +} + } // namespace CSSLonghand } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_color_custom.cc new file mode 100644 index 00000000000..a067b26f7a8 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_color_custom.cc @@ -0,0 +1,24 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/shorthands/border_block_color.h" + +#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" +#include "third_party/blink/renderer/core/style_property_shorthand.h" + +namespace blink { +namespace CSSShorthand { + +bool BorderBlockColor::ParseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&, + HeapVector<CSSPropertyValue, 256>& properties) const { + return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + borderBlockColorShorthand(), important, context, range, properties); +} + +} // namespace CSSShorthand +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_custom.cc new file mode 100644 index 00000000000..111168bdb9b --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_custom.cc @@ -0,0 +1,39 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/shorthands/border_block.h" + +#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" +#include "third_party/blink/renderer/core/style_property_shorthand.h" + +namespace blink { +namespace CSSShorthand { + +bool BorderBlock::ParseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&, + HeapVector<CSSPropertyValue, 256>& properties) const { + const CSSValue* width = nullptr; + const CSSValue* style = nullptr; + const CSSValue* color = nullptr; + + if (!CSSPropertyParserHelpers::ConsumeBorderShorthand(range, context, width, + style, color)) { + return false; + }; + + CSSPropertyParserHelpers::AddExpandedPropertyForValue( + CSSPropertyBorderBlockWidth, *width, important, properties); + CSSPropertyParserHelpers::AddExpandedPropertyForValue( + CSSPropertyBorderBlockStyle, *style, important, properties); + CSSPropertyParserHelpers::AddExpandedPropertyForValue( + CSSPropertyBorderBlockColor, *color, important, properties); + + return range.AtEnd(); +} + +} // namespace CSSShorthand +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_border_start_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_end_custom.cc index bb8814c0927..8e9665afe4e 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_border_start_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_end_custom.cc @@ -1,8 +1,8 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/shorthands/webkit_border_start.h" +#include "third_party/blink/renderer/core/css/properties/shorthands/border_block_end.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/style_property_shorthand.h" @@ -10,14 +10,14 @@ namespace blink { namespace CSSShorthand { -bool WebkitBorderStart::ParseShorthand( +bool BorderBlockEnd::ParseShorthand( bool important, CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( - webkitBorderStartShorthand(), important, context, range, properties); + borderBlockEndShorthand(), important, context, range, properties); } } // namespace CSSShorthand diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_border_before_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_start_custom.cc index 2c6c48c5bac..22f27305992 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_border_before_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_start_custom.cc @@ -1,8 +1,8 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/shorthands/webkit_border_before.h" +#include "third_party/blink/renderer/core/css/properties/shorthands/border_block_start.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/style_property_shorthand.h" @@ -10,14 +10,14 @@ namespace blink { namespace CSSShorthand { -bool WebkitBorderBefore::ParseShorthand( +bool BorderBlockStart::ParseShorthand( bool important, CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( - webkitBorderBeforeShorthand(), important, context, range, properties); + borderBlockStartShorthand(), important, context, range, properties); } } // namespace CSSShorthand diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_style_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_style_custom.cc new file mode 100644 index 00000000000..9258ef733cb --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_style_custom.cc @@ -0,0 +1,24 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/shorthands/border_block_style.h" + +#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" +#include "third_party/blink/renderer/core/style_property_shorthand.h" + +namespace blink { +namespace CSSShorthand { + +bool BorderBlockStyle::ParseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&, + HeapVector<CSSPropertyValue, 256>& properties) const { + return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + borderBlockStyleShorthand(), important, context, range, properties); +} + +} // namespace CSSShorthand +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_width_custom.cc new file mode 100644 index 00000000000..da619397494 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_block_width_custom.cc @@ -0,0 +1,24 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/shorthands/border_block_width.h" + +#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" +#include "third_party/blink/renderer/core/style_property_shorthand.h" + +namespace blink { +namespace CSSShorthand { + +bool BorderBlockWidth::ParseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&, + HeapVector<CSSPropertyValue, 256>& properties) const { + return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + borderBlockWidthShorthand(), important, context, range, properties); +} + +} // namespace CSSShorthand +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_custom.cc index ba242f99ed6..7dff25ea3ef 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_custom.cc @@ -19,43 +19,14 @@ bool Border::ParseShorthand( const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { - CSSValue* width = nullptr; + const CSSValue* width = nullptr; const CSSValue* style = nullptr; - CSSValue* color = nullptr; + const CSSValue* color = nullptr; - while (!width || !style || !color) { - if (!width) { - width = CSSPropertyParserHelpers::ConsumeLineWidth( - range, context.Mode(), - CSSPropertyParserHelpers::UnitlessQuirk::kForbid); - if (width) - continue; - } - if (!style) { - bool needs_legacy_parsing = false; - style = CSSPropertyParserHelpers::ParseLonghand( - CSSPropertyBorderLeftStyle, CSSPropertyBorder, context, range); - DCHECK(!needs_legacy_parsing); - if (style) - continue; - } - if (!color) { - color = CSSPropertyParserHelpers::ConsumeColor(range, context.Mode()); - if (color) - continue; - } - break; - } - - if (!width && !style && !color) + if (!CSSPropertyParserHelpers::ConsumeBorderShorthand(range, context, width, + style, color)) { return false; - - if (!width) - width = CSSInitialValue::Create(); - if (!style) - style = CSSInitialValue::Create(); - if (!color) - color = CSSInitialValue::Create(); + }; CSSPropertyParserHelpers::AddExpandedPropertyForValue( CSSPropertyBorderWidth, *width, important, properties); diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_color_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_color_custom.cc new file mode 100644 index 00000000000..315135b5f34 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_color_custom.cc @@ -0,0 +1,24 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/shorthands/border_inline_color.h" + +#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" +#include "third_party/blink/renderer/core/style_property_shorthand.h" + +namespace blink { +namespace CSSShorthand { + +bool BorderInlineColor::ParseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&, + HeapVector<CSSPropertyValue, 256>& properties) const { + return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + borderInlineColorShorthand(), important, context, range, properties); +} + +} // namespace CSSShorthand +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_custom.cc new file mode 100644 index 00000000000..67d5695906d --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_custom.cc @@ -0,0 +1,39 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/shorthands/border_inline.h" + +#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" +#include "third_party/blink/renderer/core/style_property_shorthand.h" + +namespace blink { +namespace CSSShorthand { + +bool BorderInline::ParseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&, + HeapVector<CSSPropertyValue, 256>& properties) const { + const CSSValue* width = nullptr; + const CSSValue* style = nullptr; + const CSSValue* color = nullptr; + + if (!CSSPropertyParserHelpers::ConsumeBorderShorthand(range, context, width, + style, color)) { + return false; + }; + + CSSPropertyParserHelpers::AddExpandedPropertyForValue( + CSSPropertyBorderInlineWidth, *width, important, properties); + CSSPropertyParserHelpers::AddExpandedPropertyForValue( + CSSPropertyBorderInlineStyle, *style, important, properties); + CSSPropertyParserHelpers::AddExpandedPropertyForValue( + CSSPropertyBorderInlineColor, *color, important, properties); + + return range.AtEnd(); +} + +} // namespace CSSShorthand +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_border_end_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_end_custom.cc index 23630c205be..53c9c7d72d8 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_border_end_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_end_custom.cc @@ -1,8 +1,8 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/shorthands/webkit_border_end.h" +#include "third_party/blink/renderer/core/css/properties/shorthands/border_inline_end.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/style_property_shorthand.h" @@ -10,14 +10,14 @@ namespace blink { namespace CSSShorthand { -bool WebkitBorderEnd::ParseShorthand( +bool BorderInlineEnd::ParseShorthand( bool important, CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( - webkitBorderEndShorthand(), important, context, range, properties); + borderInlineEndShorthand(), important, context, range, properties); } } // namespace CSSShorthand diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_border_after_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_start_custom.cc index f9667447cf0..7440a220bc1 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/webkit_border_after_custom.cc +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_start_custom.cc @@ -1,8 +1,8 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/core/css/properties/shorthands/webkit_border_after.h" +#include "third_party/blink/renderer/core/css/properties/shorthands/border_inline_start.h" #include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" #include "third_party/blink/renderer/core/style_property_shorthand.h" @@ -10,14 +10,14 @@ namespace blink { namespace CSSShorthand { -bool WebkitBorderAfter::ParseShorthand( +bool BorderInlineStart::ParseShorthand( bool important, CSSParserTokenRange& range, const CSSParserContext& context, const CSSParserLocalContext&, HeapVector<CSSPropertyValue, 256>& properties) const { return CSSPropertyParserHelpers::ConsumeShorthandGreedilyViaLonghands( - webkitBorderAfterShorthand(), important, context, range, properties); + borderInlineStartShorthand(), important, context, range, properties); } } // namespace CSSShorthand diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_style_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_style_custom.cc new file mode 100644 index 00000000000..83859ed8424 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_style_custom.cc @@ -0,0 +1,24 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/shorthands/border_inline_style.h" + +#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" +#include "third_party/blink/renderer/core/style_property_shorthand.h" + +namespace blink { +namespace CSSShorthand { + +bool BorderInlineStyle::ParseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&, + HeapVector<CSSPropertyValue, 256>& properties) const { + return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + borderInlineStyleShorthand(), important, context, range, properties); +} + +} // namespace CSSShorthand +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_width_custom.cc new file mode 100644 index 00000000000..1fdacb111d4 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/border_inline_width_custom.cc @@ -0,0 +1,24 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/shorthands/border_inline_width.h" + +#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" +#include "third_party/blink/renderer/core/style_property_shorthand.h" + +namespace blink { +namespace CSSShorthand { + +bool BorderInlineWidth::ParseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&, + HeapVector<CSSPropertyValue, 256>& properties) const { + return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + borderInlineWidthShorthand(), important, context, range, properties); +} + +} // namespace CSSShorthand +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/inset_block_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/inset_block_custom.cc new file mode 100644 index 00000000000..d9616b4405f --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/inset_block_custom.cc @@ -0,0 +1,24 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/shorthands/inset_block.h" + +#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" +#include "third_party/blink/renderer/core/style_property_shorthand.h" + +namespace blink { +namespace CSSShorthand { + +bool InsetBlock::ParseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&, + HeapVector<CSSPropertyValue, 256>& properties) const { + return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + insetBlockShorthand(), important, context, range, properties); +} + +} // namespace CSSShorthand +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/inset_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/inset_custom.cc new file mode 100644 index 00000000000..06744cb17c8 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/inset_custom.cc @@ -0,0 +1,24 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/shorthands/inset.h" + +#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" +#include "third_party/blink/renderer/core/style_property_shorthand.h" + +namespace blink { +namespace CSSShorthand { + +bool Inset::ParseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&, + HeapVector<CSSPropertyValue, 256>& properties) const { + return CSSPropertyParserHelpers::ConsumeShorthandVia4Longhands( + insetShorthand(), important, context, range, properties); +} + +} // namespace CSSShorthand +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/inset_inline_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/inset_inline_custom.cc new file mode 100644 index 00000000000..2ae7dce5d07 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/inset_inline_custom.cc @@ -0,0 +1,24 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/shorthands/inset_inline.h" + +#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" +#include "third_party/blink/renderer/core/style_property_shorthand.h" + +namespace blink { +namespace CSSShorthand { + +bool InsetInline::ParseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&, + HeapVector<CSSPropertyValue, 256>& properties) const { + return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + insetInlineShorthand(), important, context, range, properties); +} + +} // namespace CSSShorthand +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/margin_block_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/margin_block_custom.cc new file mode 100644 index 00000000000..3d91f6d7c46 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/margin_block_custom.cc @@ -0,0 +1,24 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/shorthands/margin_block.h" + +#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" +#include "third_party/blink/renderer/core/style_property_shorthand.h" + +namespace blink { +namespace CSSShorthand { + +bool MarginBlock::ParseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&, + HeapVector<CSSPropertyValue, 256>& properties) const { + return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + marginBlockShorthand(), important, context, range, properties); +} + +} // namespace CSSShorthand +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/margin_inline_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/margin_inline_custom.cc new file mode 100644 index 00000000000..3dabd4b34d5 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/margin_inline_custom.cc @@ -0,0 +1,24 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/shorthands/margin_inline.h" + +#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" +#include "third_party/blink/renderer/core/style_property_shorthand.h" + +namespace blink { +namespace CSSShorthand { + +bool MarginInline::ParseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&, + HeapVector<CSSPropertyValue, 256>& properties) const { + return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + marginInlineShorthand(), important, context, range, properties); +} + +} // namespace CSSShorthand +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/padding_block_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/padding_block_custom.cc new file mode 100644 index 00000000000..959c9ed651e --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/padding_block_custom.cc @@ -0,0 +1,24 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/shorthands/padding_block.h" + +#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" +#include "third_party/blink/renderer/core/style_property_shorthand.h" + +namespace blink { +namespace CSSShorthand { + +bool PaddingBlock::ParseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&, + HeapVector<CSSPropertyValue, 256>& properties) const { + return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + paddingBlockShorthand(), important, context, range, properties); +} + +} // namespace CSSShorthand +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/padding_inline_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/padding_inline_custom.cc new file mode 100644 index 00000000000..79c0a3b0ef1 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/padding_inline_custom.cc @@ -0,0 +1,24 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/properties/shorthands/padding_inline.h" + +#include "third_party/blink/renderer/core/css/parser/css_property_parser_helpers.h" +#include "third_party/blink/renderer/core/style_property_shorthand.h" + +namespace blink { +namespace CSSShorthand { + +bool PaddingInline::ParseShorthand( + bool important, + CSSParserTokenRange& range, + const CSSParserContext& context, + const CSSParserLocalContext&, + HeapVector<CSSPropertyValue, 256>& properties) const { + return CSSPropertyParserHelpers::ConsumeShorthandVia2Longhands( + paddingInlineShorthand(), important, context, range, properties); +} + +} // namespace CSSShorthand +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/properties/style_building_utils.h b/chromium/third_party/blink/renderer/core/css/properties/style_building_utils.h index b679a39cafc..1fba8a59397 100644 --- a/chromium/third_party/blink/renderer/core/css/properties/style_building_utils.h +++ b/chromium/third_party/blink/renderer/core/css/properties/style_building_utils.h @@ -13,18 +13,18 @@ namespace blink { namespace StyleBuildingUtils { -inline bool borderImageLengthMatchesAllSides( - const BorderImageLengthBox& borderImageLengthBox, - const BorderImageLength& borderImageLength) { - return (borderImageLengthBox.Left() == borderImageLength && - borderImageLengthBox.Right() == borderImageLength && - borderImageLengthBox.Top() == borderImageLength && - borderImageLengthBox.Bottom() == borderImageLength); +inline bool BorderImageLengthMatchesAllSides( + const BorderImageLengthBox& border_image_length_box, + const BorderImageLength& border_image_length) { + return (border_image_length_box.Left() == border_image_length && + border_image_length_box.Right() == border_image_length && + border_image_length_box.Top() == border_image_length && + border_image_length_box.Bottom() == border_image_length); } -inline bool lengthMatchesAllSides(const LengthBox& lengthBox, +inline bool LengthMatchesAllSides(const LengthBox& length_box, const Length& length) { - return (lengthBox.Left() == length && lengthBox.Right() == length && - lengthBox.Top() == length && lengthBox.Bottom() == length); + return (length_box.Left() == length && length_box.Right() == length && + length_box.Top() == length && length_box.Bottom() == length); } } // namespace StyleBuildingUtils |