summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/css/properties
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-13 16:23:34 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-14 10:37:21 +0000
commit38a9a29f4f9436cace7f0e7abf9c586057df8a4e (patch)
treec4e8c458dc595bc0ddb435708fa2229edfd00bd4 /chromium/third_party/blink/renderer/core/css/properties
parente684a3455bcc29a6e3e66a004e352dea4e1141e7 (diff)
downloadqtwebengine-chromium-38a9a29f4f9436cace7f0e7abf9c586057df8a4e.tar.gz
BASELINE: Update Chromium to 73.0.3683.37
Change-Id: I08c9af2948b645f671e5d933aca1f7a90ea372f2 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/css/properties')
-rw-r--r--chromium/third_party/blink/renderer/core/css/properties/computed_style_utils.cc61
-rw-r--r--chromium/third_party/blink/renderer/core/css/properties/computed_style_utils.h13
-rw-r--r--chromium/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc16
-rw-r--r--chromium/third_party/blink/renderer/core/css/properties/css_parsing_utils.h3
-rw-r--r--chromium/third_party/blink/renderer/core/css/properties/css_property_base_custom.cc6
-rw-r--r--chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_outset_custom.cc8
-rw-r--r--chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_slice_custom.cc11
-rw-r--r--chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_width_custom.cc8
-rw-r--r--chromium/third_party/blink/renderer/core/css/properties/longhands/bottom_custom.cc9
-rw-r--r--chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property.cc4
-rw-r--r--chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property.h1
-rw-r--r--chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property_test.cc9
-rw-r--r--chromium/third_party/blink/renderer/core/css/properties/longhands/height_custom.cc4
-rw-r--r--chromium/third_party/blink/renderer/core/css/properties/longhands/left_custom.cc9
-rw-r--r--chromium/third_party/blink/renderer/core/css/properties/longhands/right_custom.cc9
-rw-r--r--chromium/third_party/blink/renderer/core/css/properties/longhands/top_custom.cc9
-rw-r--r--chromium/third_party/blink/renderer/core/css/properties/longhands/transform_custom.cc3
-rw-r--r--chromium/third_party/blink/renderer/core/css/properties/longhands/transform_origin_custom.cc24
-rw-r--r--chromium/third_party/blink/renderer/core/css/properties/longhands/variable.h4
-rw-r--r--chromium/third_party/blink/renderer/core/css/properties/longhands/width_custom.cc4
-rw-r--r--chromium/third_party/blink/renderer/core/css/properties/shorthands/animation_custom.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/css/properties/shorthands/border_custom.cc3
22 files changed, 144 insertions, 76 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 73b8a08f7a3..e71a1b6bef6 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
@@ -32,6 +32,7 @@
#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"
+#include "third_party/blink/renderer/core/svg/svg_element.h"
namespace blink {
@@ -502,7 +503,7 @@ CSSValue* ComputedStyleUtils::MinWidthOrMinHeightAuto(
LayoutObject* layout_object =
styled_node ? styled_node->GetLayoutObject() : nullptr;
if (layout_object && layout_object->IsBox() &&
- (ToLayoutBox(layout_object)->IsFlexItem() ||
+ (ToLayoutBox(layout_object)->IsFlexItemIncludingNG() ||
ToLayoutBox(layout_object)->IsGridItem())) {
return CSSIdentifierValue::Create(CSSValueAuto);
}
@@ -1272,14 +1273,28 @@ CSSValue* ComputedStyleUtils::ValueForGridPosition(
return list;
}
-LayoutRect ComputedStyleUtils::SizingBox(const LayoutObject& layout_object) {
- if (!layout_object.IsBox())
- return LayoutRect();
+static bool IsSVGObjectWithWidthAndHeight(const LayoutObject& layout_object) {
+ DCHECK(layout_object.IsSVGChild());
+ return layout_object.IsSVGImage() || layout_object.IsSVGForeignObject() ||
+ (layout_object.IsSVGShape() &&
+ IsSVGRectElement(layout_object.GetNode()));
+}
+FloatSize ComputedStyleUtils::UsedBoxSize(const LayoutObject& layout_object) {
+ if (layout_object.IsSVGChild() &&
+ IsSVGObjectWithWidthAndHeight(layout_object)) {
+ FloatSize size(layout_object.ObjectBoundingBox().Size());
+ // The object bounding box does not have zoom applied. Multiply with zoom
+ // here since we'll divide by it when we produce the CSS value.
+ size.Scale(layout_object.StyleRef().EffectiveZoom());
+ return size;
+ }
+ if (!layout_object.IsBox())
+ return FloatSize();
const LayoutBox& box = ToLayoutBox(layout_object);
- return box.StyleRef().BoxSizing() == EBoxSizing::kBorderBox
- ? box.BorderBoxRect()
- : box.ComputedCSSContentBoxRect();
+ return FloatSize(box.StyleRef().BoxSizing() == EBoxSizing::kBorderBox
+ ? box.BorderBoxRect().Size()
+ : box.ComputedCSSContentBoxRect().Size());
}
CSSValue* ComputedStyleUtils::RenderTextDecorationFlagsToCSSValue(
@@ -1627,18 +1642,30 @@ CSSFunctionValue* ValueForMatrixTransform(
return transform_value;
}
+FloatRect ComputedStyleUtils::ReferenceBoxForTransform(
+ const LayoutObject& layout_object,
+ UsePixelSnappedBox pixel_snap_box) {
+ if (layout_object.IsSVGChild())
+ return ComputeSVGTransformReferenceBox(layout_object);
+ if (layout_object.IsBox()) {
+ const auto& layout_box = ToLayoutBox(layout_object);
+ if (pixel_snap_box == kUsePixelSnappedBox)
+ return FloatRect(layout_box.PixelSnappedBorderBoxRect());
+ return FloatRect(layout_box.BorderBoxRect());
+ }
+ return FloatRect();
+}
+
CSSValue* ComputedStyleUtils::ComputedTransform(
const LayoutObject* layout_object,
const ComputedStyle& style) {
if (!layout_object || !style.HasTransform())
return CSSIdentifierValue::Create(CSSValueNone);
- IntRect box;
- if (layout_object->IsBox())
- box = PixelSnappedIntRect(ToLayoutBox(layout_object)->BorderBoxRect());
+ FloatRect reference_box = ReferenceBoxForTransform(*layout_object);
TransformationMatrix transform;
- style.ApplyTransform(transform, LayoutSize(box.Size()),
+ style.ApplyTransform(transform, reference_box,
ComputedStyle::kExcludeTransformOrigin,
ComputedStyle::kExcludeMotionPath,
ComputedStyle::kExcludeIndependentTransformProperties);
@@ -2111,17 +2138,15 @@ bool ComputedStyleUtils::WidthOrHeightShouldReturnUsedValue(
// The display property is 'none'.
if (!object)
return false;
+ // Non-root SVG objects return the resolved value except <image>,
+ // <rect> and <foreignObject> which return the used value.
+ if (object->IsSVGChild())
+ return IsSVGObjectWithWidthAndHeight(*object);
// According to
// http://www.w3.org/TR/CSS2/visudet.html#the-width-property and
// http://www.w3.org/TR/CSS2/visudet.html#the-height-property, the "width" or
// "height" property does not apply to non-atomic inline elements.
- if (!object->IsAtomicInlineLevel() && object->IsInline())
- return false;
- // Non-root SVG objects return the resolved value.
- // TODO(fs): Return the used value for <image>, <rect> and <foreignObject> (to
- // which 'width' or 'height' can be said to apply) too? We don't return the
- // used value for other geometric properties ('x', 'y' et.c.)
- return !object->IsSVGChild();
+ return object->IsAtomicInlineLevel() || !object->IsInline();
}
CSSValueList* ComputedStyleUtils::ValuesForShorthandProperty(
diff --git a/chromium/third_party/blink/renderer/core/css/properties/computed_style_utils.h b/chromium/third_party/blink/renderer/core/css/properties/computed_style_utils.h
index b4133eeac32..c4dead787ab 100644
--- a/chromium/third_party/blink/renderer/core/css/properties/computed_style_utils.h
+++ b/chromium/third_party/blink/renderer/core/css/properties/computed_style_utils.h
@@ -112,7 +112,7 @@ class ComputedStyleUtils {
const LayoutObject*,
const ComputedStyle&);
static CSSValue* ValueForGridPosition(const GridPosition&);
- static LayoutRect SizingBox(const LayoutObject&);
+ static FloatSize UsedBoxSize(const LayoutObject&);
static CSSValue* RenderTextDecorationFlagsToCSSValue(TextDecoration);
static CSSValue* ValueForTextDecorationStyle(ETextDecorationStyle);
static CSSValue* ValueForTextDecorationSkipInk(ETextDecorationSkipInk);
@@ -132,6 +132,17 @@ class ComputedStyleUtils {
const ComputedStyle&);
static const CSSValue& ValueForBorderRadiusCorner(const LengthSize&,
const ComputedStyle&);
+ // TODO(fs): For some properties ('transform') we use the pixel snapped
+ // border-box as the reference box. In other cases ('transform-origin') we use
+ // the "unsnapped" border-box. Maybe use the same (the "unsnapped") in both
+ // cases?
+ enum UsePixelSnappedBox {
+ kDontUsePixelSnappedBox,
+ kUsePixelSnappedBox,
+ };
+ static FloatRect ReferenceBoxForTransform(
+ const LayoutObject&,
+ UsePixelSnappedBox = kUsePixelSnappedBox);
static CSSValue* ComputedTransform(const LayoutObject*, const ComputedStyle&);
static CSSValue* CreateTransitionPropertyValue(
const CSSTransitionData::TransitionProperty&);
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 b7c96bbf4ae..69c35eae760 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
@@ -42,6 +42,7 @@
#include "third_party/blink/renderer/core/svg/svg_parsing_error.h"
#include "third_party/blink/renderer/core/svg/svg_path_utilities.h"
#include "third_party/blink/renderer/platform/animation/timing_function.h"
+#include "third_party/blink/renderer/platform/fonts/font_selection_types.h"
#include "third_party/blink/renderer/platform/geometry/length.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
@@ -1390,8 +1391,8 @@ CSSValue* ConsumeFontStyle(CSSParserTokenRange& range,
CSSIdentifierValue* oblique_identifier =
css_property_parser_helpers::ConsumeIdent<CSSValueOblique>(range);
- CSSPrimitiveValue* start_angle =
- css_property_parser_helpers::ConsumeAngle(range, nullptr, base::nullopt);
+ CSSPrimitiveValue* start_angle = css_property_parser_helpers::ConsumeAngle(
+ range, nullptr, base::nullopt, MinObliqueValue(), MaxObliqueValue());
if (!start_angle)
return oblique_identifier;
if (!IsAngleWithinLimits(start_angle))
@@ -1403,8 +1404,8 @@ CSSValue* ConsumeFontStyle(CSSParserTokenRange& range,
return CSSFontStyleRangeValue::Create(*oblique_identifier, *value_list);
}
- CSSPrimitiveValue* end_angle =
- css_property_parser_helpers::ConsumeAngle(range, nullptr, base::nullopt);
+ CSSPrimitiveValue* end_angle = css_property_parser_helpers::ConsumeAngle(
+ range, nullptr, base::nullopt, MinObliqueValue(), MaxObliqueValue());
if (!end_angle || !IsAngleWithinLimits(end_angle))
return nullptr;
@@ -2597,5 +2598,12 @@ CSSValue* ParsePaintStroke(CSSParserTokenRange& range,
return css_property_parser_helpers::ConsumeColor(range, context.Mode());
}
+css_property_parser_helpers::UnitlessQuirk UnitlessUnlessShorthand(
+ const CSSParserLocalContext& local_context) {
+ return local_context.CurrentShorthand() == CSSPropertyInvalid
+ ? css_property_parser_helpers::UnitlessQuirk::kAllow
+ : css_property_parser_helpers::UnitlessQuirk::kForbid;
+}
+
} // namespace css_parsing_utils
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/css/properties/css_parsing_utils.h b/chromium/third_party/blink/renderer/core/css/properties/css_parsing_utils.h
index c7cbb4c5316..342e6547a33 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
@@ -237,6 +237,9 @@ CSSValue* ConsumeBorderWidth(CSSParserTokenRange&,
CSSValue* ParsePaintStroke(CSSParserTokenRange&, const CSSParserContext&);
CSSValue* ParseSpacing(CSSParserTokenRange&, const CSSParserContext&);
+css_property_parser_helpers::UnitlessQuirk UnitlessUnlessShorthand(
+ const CSSParserLocalContext&);
+
template <CSSValueID start, CSSValueID end>
CSSValue* ConsumePositionLonghand(CSSParserTokenRange& range,
CSSParserMode css_parser_mode) {
diff --git a/chromium/third_party/blink/renderer/core/css/properties/css_property_base_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/css_property_base_custom.cc
index 11ba397918c..3748065020d 100644
--- a/chromium/third_party/blink/renderer/core/css/properties/css_property_base_custom.cc
+++ b/chromium/third_party/blink/renderer/core/css/properties/css_property_base_custom.cc
@@ -6,6 +6,7 @@
#include "third_party/blink/renderer/core/css/properties/css_property.h"
+#include "base/stl_util.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/core/style/svg_computed_style.h"
#include "third_party/blink/renderer/core/style_property_shorthand.h"
@@ -16,8 +17,9 @@ const StylePropertyShorthand& CSSProperty::BorderDirections() {
static const CSSProperty* kProperties[4] = {
&GetCSSPropertyBorderTop(), &GetCSSPropertyBorderRight(),
&GetCSSPropertyBorderBottom(), &GetCSSPropertyBorderLeft()};
- DEFINE_STATIC_LOCAL(StylePropertyShorthand, border_directions,
- (CSSPropertyBorder, kProperties, arraysize(kProperties)));
+ DEFINE_STATIC_LOCAL(
+ StylePropertyShorthand, border_directions,
+ (CSSPropertyBorder, kProperties, base::size(kProperties)));
return border_directions;
}
diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_outset_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_outset_custom.cc
index 7f0185f3c27..e0f12599988 100644
--- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_outset_custom.cc
+++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_outset_custom.cc
@@ -30,12 +30,10 @@ const CSSValue* BorderImageOutset::CSSValueFromComputedStyleInternal(
const CSSValue* BorderImageOutset::InitialValue() const {
DEFINE_STATIC_LOCAL(
- Persistent<CSSValue>, zeroInteger,
- (CSSPrimitiveValue::Create(0, CSSPrimitiveValue::UnitType::kInteger)));
- DEFINE_STATIC_LOCAL(
Persistent<CSSQuadValue>, value,
- (CSSQuadValue::Create(zeroInteger, zeroInteger, zeroInteger, zeroInteger,
- CSSQuadValue::kSerializeAsQuad)));
+ (CSSQuadValue::Create(
+ CSSPrimitiveValue::Create(0, CSSPrimitiveValue::UnitType::kInteger),
+ CSSQuadValue::kSerializeAsQuad)));
return value;
}
diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_slice_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_slice_custom.cc
index 62888d64f9e..83a8d7ab3f4 100644
--- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_slice_custom.cc
+++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_slice_custom.cc
@@ -29,9 +29,14 @@ const CSSValue* BorderImageSlice::CSSValueFromComputedStyleInternal(
}
const CSSValue* BorderImageSlice::InitialValue() const {
- DEFINE_STATIC_LOCAL(Persistent<CSSValue>, value,
- (CSSPrimitiveValue::Create(
- 100, CSSPrimitiveValue::UnitType::kPercentage)));
+ DEFINE_STATIC_LOCAL(
+ Persistent<CSSBorderImageSliceValue>, value,
+ (CSSBorderImageSliceValue::Create(
+ CSSQuadValue::Create(
+ CSSPrimitiveValue::Create(
+ 100, CSSPrimitiveValue::UnitType::kPercentage),
+ CSSQuadValue::kSerializeAsQuad),
+ /* fill */ false)));
return value;
}
diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_width_custom.cc
index 6b3bd3bd6a1..cbf66971fbe 100644
--- a/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_width_custom.cc
+++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/border_image_width_custom.cc
@@ -30,12 +30,10 @@ const CSSValue* BorderImageWidth::CSSValueFromComputedStyleInternal(
const CSSValue* BorderImageWidth::InitialValue() const {
DEFINE_STATIC_LOCAL(
- Persistent<CSSValue>, oneInteger,
- (CSSPrimitiveValue::Create(1, CSSPrimitiveValue::UnitType::kInteger)));
- DEFINE_STATIC_LOCAL(
Persistent<CSSQuadValue>, value,
- (CSSQuadValue::Create(oneInteger, oneInteger, oneInteger, oneInteger,
- CSSQuadValue::kSerializeAsQuad)));
+ (CSSQuadValue::Create(
+ CSSPrimitiveValue::Create(1, CSSPrimitiveValue::UnitType::kInteger),
+ CSSQuadValue::kSerializeAsQuad)));
return value;
}
diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/bottom_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/bottom_custom.cc
index 7f22bfd645a..bed946ff1fe 100644
--- a/chromium/third_party/blink/renderer/core/css/properties/longhands/bottom_custom.cc
+++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/bottom_custom.cc
@@ -17,12 +17,13 @@ class CSSParserLocalContext;
namespace css_longhand {
-const CSSValue* Bottom::ParseSingleValue(CSSParserTokenRange& range,
- const CSSParserContext& context,
- const CSSParserLocalContext&) const {
+const CSSValue* Bottom::ParseSingleValue(
+ CSSParserTokenRange& range,
+ const CSSParserContext& context,
+ const CSSParserLocalContext& local_context) const {
return css_parsing_utils::ConsumeMarginOrOffset(
range, context.Mode(),
- css_property_parser_helpers::UnitlessQuirk::kAllow);
+ css_parsing_utils::UnitlessUnlessShorthand(local_context));
}
bool Bottom::IsLayoutDependent(const ComputedStyle* style,
diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property.cc
index f139d170b76..d68af9edff8 100644
--- a/chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property.cc
+++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property.cc
@@ -30,6 +30,10 @@ const AtomicString& CustomProperty::GetPropertyNameAtomicString() const {
return name_;
}
+CSSPropertyName CustomProperty::GetCSSPropertyName() const {
+ return CSSPropertyName(name_);
+}
+
void CustomProperty::ApplyInitial(StyleResolverState& state) const {
state.Style()->RemoveVariable(name_, IsInherited());
}
diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property.h b/chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property.h
index 57a2f0fb393..0cbabc05847 100644
--- a/chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property.h
+++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property.h
@@ -30,6 +30,7 @@ class CORE_EXPORT CustomProperty : public Variable {
bool IsInherited() const override;
const AtomicString& GetPropertyNameAtomicString() const override;
+ CSSPropertyName GetCSSPropertyName() const override;
void ApplyInitial(StyleResolverState&) const override;
void ApplyInherit(StyleResolverState&) const override;
diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property_test.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property_test.cc
index 9224db4b406..af4ec4caa8e 100644
--- a/chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property_test.cc
+++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/custom_property_test.cc
@@ -31,8 +31,8 @@ class CustomPropertyTest : public PageTestBase {
const CSSValue* GetComputedValue(const CustomProperty& property) {
Element* node = GetDocument().getElementById("target");
return property.CSSValueFromComputedStyle(node->ComputedStyleRef(),
- nullptr /* layout_object*/, node,
- false /* allow_visisted_style */);
+ nullptr /* layout_object */, node,
+ false /* allow_visited_style */);
}
const CSSValue* ParseValue(const Longhand& property,
@@ -194,4 +194,9 @@ TEST_F(CustomPropertyTest, ParseSingleValueValidatedUntyped) {
EXPECT_FALSE(value2);
}
+TEST_F(CustomPropertyTest, GetCSSPropertyName) {
+ CustomProperty property("--x", GetDocument());
+ EXPECT_EQ(CSSPropertyName("--x"), property.GetCSSPropertyName());
+}
+
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/height_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/height_custom.cc
index 4c843c38f23..09104b72ed9 100644
--- a/chromium/third_party/blink/renderer/core/css/properties/longhands/height_custom.cc
+++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/height_custom.cc
@@ -22,7 +22,7 @@ const CSSValue* Height::ParseSingleValue(CSSParserTokenRange& range,
bool Height::IsLayoutDependent(const ComputedStyle* style,
LayoutObject* layout_object) const {
- return layout_object && layout_object->IsBox();
+ return layout_object && (layout_object->IsBox() || layout_object->IsSVG());
}
const CSSValue* Height::CSSValueFromComputedStyleInternal(
@@ -33,7 +33,7 @@ const CSSValue* Height::CSSValueFromComputedStyleInternal(
bool allow_visited_style) const {
if (ComputedStyleUtils::WidthOrHeightShouldReturnUsedValue(layout_object)) {
return ZoomAdjustedPixelValue(
- ComputedStyleUtils::SizingBox(*layout_object).Height(), style);
+ ComputedStyleUtils::UsedBoxSize(*layout_object).Height(), style);
}
return ComputedStyleUtils::ZoomAdjustedPixelValueForLength(style.Height(),
style);
diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/left_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/left_custom.cc
index e9f4074e5e4..d986478cf27 100644
--- a/chromium/third_party/blink/renderer/core/css/properties/longhands/left_custom.cc
+++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/left_custom.cc
@@ -17,12 +17,13 @@ class CSSParserLocalContext;
namespace css_longhand {
-const CSSValue* Left::ParseSingleValue(CSSParserTokenRange& range,
- const CSSParserContext& context,
- const CSSParserLocalContext&) const {
+const CSSValue* Left::ParseSingleValue(
+ CSSParserTokenRange& range,
+ const CSSParserContext& context,
+ const CSSParserLocalContext& local_context) const {
return css_parsing_utils::ConsumeMarginOrOffset(
range, context.Mode(),
- css_property_parser_helpers::UnitlessQuirk::kAllow);
+ css_parsing_utils::UnitlessUnlessShorthand(local_context));
}
bool Left::IsLayoutDependent(const ComputedStyle* style,
diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/right_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/right_custom.cc
index 3ea427901af..55e234c0428 100644
--- a/chromium/third_party/blink/renderer/core/css/properties/longhands/right_custom.cc
+++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/right_custom.cc
@@ -17,12 +17,13 @@ class CSSParserLocalContext;
namespace css_longhand {
-const CSSValue* Right::ParseSingleValue(CSSParserTokenRange& range,
- const CSSParserContext& context,
- const CSSParserLocalContext&) const {
+const CSSValue* Right::ParseSingleValue(
+ CSSParserTokenRange& range,
+ const CSSParserContext& context,
+ const CSSParserLocalContext& local_context) const {
return css_parsing_utils::ConsumeMarginOrOffset(
range, context.Mode(),
- css_property_parser_helpers::UnitlessQuirk::kAllow);
+ css_parsing_utils::UnitlessUnlessShorthand(local_context));
}
bool Right::IsLayoutDependent(const ComputedStyle* style,
diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/top_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/top_custom.cc
index 34328499657..2d56fccd642 100644
--- a/chromium/third_party/blink/renderer/core/css/properties/longhands/top_custom.cc
+++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/top_custom.cc
@@ -17,12 +17,13 @@ class CSSParserLocalContext;
namespace css_longhand {
-const CSSValue* Top::ParseSingleValue(CSSParserTokenRange& range,
- const CSSParserContext& context,
- const CSSParserLocalContext&) const {
+const CSSValue* Top::ParseSingleValue(
+ CSSParserTokenRange& range,
+ const CSSParserContext& context,
+ const CSSParserLocalContext& local_context) const {
return css_parsing_utils::ConsumeMarginOrOffset(
range, context.Mode(),
- css_property_parser_helpers::UnitlessQuirk::kAllow);
+ css_parsing_utils::UnitlessUnlessShorthand(local_context));
}
bool Top::IsLayoutDependent(const ComputedStyle* style,
diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_custom.cc
index e419eb86f4c..a84008a1470 100644
--- a/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_custom.cc
+++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_custom.cc
@@ -25,7 +25,8 @@ const CSSValue* Transform::ParseSingleValue(
bool Transform::IsLayoutDependent(const ComputedStyle* style,
LayoutObject* layout_object) const {
- return layout_object && layout_object->IsBox();
+ return layout_object &&
+ (layout_object->IsBox() || layout_object->IsSVGChild());
}
const CSSValue* Transform::CSSValueFromComputedStyleInternal(
diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_origin_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_origin_custom.cc
index e5fd8d94be9..1cdce977413 100644
--- a/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_origin_custom.cc
+++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/transform_origin_custom.cc
@@ -39,7 +39,8 @@ const CSSValue* TransformOrigin::ParseSingleValue(
bool TransformOrigin::IsLayoutDependent(const ComputedStyle* style,
LayoutObject* layout_object) const {
- return layout_object && layout_object->IsBox();
+ return layout_object &&
+ (layout_object->IsBox() || layout_object->IsSVGChild());
}
const CSSValue* TransformOrigin::CSSValueFromComputedStyleInternal(
@@ -50,24 +51,21 @@ const CSSValue* TransformOrigin::CSSValueFromComputedStyleInternal(
bool allow_visited_style) const {
CSSValueList* list = CSSValueList::CreateSpaceSeparated();
if (layout_object) {
- LayoutRect box;
- if (layout_object->IsBox())
- box = ToLayoutBox(layout_object)->BorderBoxRect();
-
- list->Append(*ZoomAdjustedPixelValue(
- MinimumValueForLength(style.TransformOriginX(), box.Width()), style));
- list->Append(*ZoomAdjustedPixelValue(
- MinimumValueForLength(style.TransformOriginY(), box.Height()), style));
- if (style.TransformOriginZ() != 0)
- list->Append(*ZoomAdjustedPixelValue(style.TransformOriginZ(), style));
+ FloatRect reference_box = ComputedStyleUtils::ReferenceBoxForTransform(
+ *layout_object, ComputedStyleUtils::kDontUsePixelSnappedBox);
+ FloatSize resolved_origin(
+ FloatValueForLength(style.TransformOriginX(), reference_box.Width()),
+ FloatValueForLength(style.TransformOriginY(), reference_box.Height()));
+ list->Append(*ZoomAdjustedPixelValue(resolved_origin.Width(), style));
+ list->Append(*ZoomAdjustedPixelValue(resolved_origin.Height(), style));
} else {
list->Append(*ComputedStyleUtils::ZoomAdjustedPixelValueForLength(
style.TransformOriginX(), style));
list->Append(*ComputedStyleUtils::ZoomAdjustedPixelValueForLength(
style.TransformOriginY(), style));
- if (style.TransformOriginZ() != 0)
- list->Append(*ZoomAdjustedPixelValue(style.TransformOriginZ(), style));
}
+ if (style.TransformOriginZ() != 0)
+ list->Append(*ZoomAdjustedPixelValue(style.TransformOriginZ(), style));
return list;
}
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 cb0137e5c2b..f1eb99390db 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
@@ -22,6 +22,10 @@ class CORE_EXPORT Variable : public Longhand {
bool IsInherited() const override { return true; }
bool IsAffectedByAll() const override { return false; }
CSSPropertyID PropertyID() const override { return CSSPropertyVariable; }
+ CSSPropertyName GetCSSPropertyName() const override {
+ NOTREACHED();
+ return CSSPropertyName("");
+ }
const char* GetPropertyName() const override { return "variable"; }
const WTF::AtomicString& GetPropertyNameAtomicString() const override {
DEFINE_STATIC_LOCAL(const AtomicString, name, ("variable"));
diff --git a/chromium/third_party/blink/renderer/core/css/properties/longhands/width_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/longhands/width_custom.cc
index e48fb203761..8414fa9c0c8 100644
--- a/chromium/third_party/blink/renderer/core/css/properties/longhands/width_custom.cc
+++ b/chromium/third_party/blink/renderer/core/css/properties/longhands/width_custom.cc
@@ -22,7 +22,7 @@ const CSSValue* Width::ParseSingleValue(CSSParserTokenRange& range,
bool Width::IsLayoutDependent(const ComputedStyle* style,
LayoutObject* layout_object) const {
- return layout_object && layout_object->IsBox();
+ return layout_object && (layout_object->IsBox() || layout_object->IsSVG());
}
const CSSValue* Width::CSSValueFromComputedStyleInternal(
@@ -33,7 +33,7 @@ const CSSValue* Width::CSSValueFromComputedStyleInternal(
bool allow_visited_style) const {
if (ComputedStyleUtils::WidthOrHeightShouldReturnUsedValue(layout_object)) {
return ZoomAdjustedPixelValue(
- ComputedStyleUtils::SizingBox(*layout_object).Width(), style);
+ ComputedStyleUtils::UsedBoxSize(*layout_object).Width(), style);
}
return ComputedStyleUtils::ZoomAdjustedPixelValueForLength(style.Width(),
style);
diff --git a/chromium/third_party/blink/renderer/core/css/properties/shorthands/animation_custom.cc b/chromium/third_party/blink/renderer/core/css/properties/shorthands/animation_custom.cc
index eb60bd55abb..4f27aa440cf 100644
--- a/chromium/third_party/blink/renderer/core/css/properties/shorthands/animation_custom.cc
+++ b/chromium/third_party/blink/renderer/core/css/properties/shorthands/animation_custom.cc
@@ -92,7 +92,6 @@ const CSSValue* Animation::CSSValueFromComputedStyleInternal(
CSSValueList* animations_list = CSSValueList::CreateCommaSeparated();
for (wtf_size_t i = 0; i < animation_data->NameList().size(); ++i) {
CSSValueList* list = CSSValueList::CreateSpaceSeparated();
- list->Append(*CSSCustomIdentValue::Create(animation_data->NameList()[i]));
list->Append(*CSSPrimitiveValue::Create(
CSSTimingData::GetRepeated(animation_data->DurationList(), i),
CSSPrimitiveValue::UnitType::kSeconds));
@@ -110,6 +109,7 @@ const CSSValue* Animation::CSSValueFromComputedStyleInternal(
CSSTimingData::GetRepeated(animation_data->FillModeList(), i)));
list->Append(*ComputedStyleUtils::ValueForAnimationPlayState(
CSSTimingData::GetRepeated(animation_data->PlayStateList(), i)));
+ list->Append(*CSSCustomIdentValue::Create(animation_data->NameList()[i]));
animations_list->Append(*list);
}
return animations_list;
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 9ac731d078b..60909281584 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
@@ -4,6 +4,7 @@
#include "third_party/blink/renderer/core/css/properties/shorthands/border.h"
+#include "base/stl_util.h"
#include "third_party/blink/renderer/core/css/css_initial_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"
@@ -52,7 +53,7 @@ const CSSValue* Border::CSSValueFromComputedStyleInternal(
static const CSSProperty* kProperties[3] = {&GetCSSPropertyBorderRight(),
&GetCSSPropertyBorderBottom(),
&GetCSSPropertyBorderLeft()};
- for (size_t i = 0; i < arraysize(kProperties); ++i) {
+ for (size_t i = 0; i < base::size(kProperties); ++i) {
const CSSValue* value_for_side = kProperties[i]->CSSValueFromComputedStyle(
style, layout_object, styled_node, allow_visited_style);
if (!DataEquivalent(value, value_for_side)) {