Commit 4cf82e06 authored by Renee Wright's avatar Renee Wright Committed by Commit Bot

[Ribbon] ComputedStyleCSSValueMapping remaining cases

Bug: 775360
Change-Id: I27ee051b48ca02cd6021638fb6a269a584b41384
Reviewed-on: https://chromium-review.googlesource.com/872692Reviewed-by: default avatarnainar <nainar@chromium.org>
Commit-Queue: Renée Wright <rjwright@chromium.org>
Cr-Commit-Position: refs/heads/master@{#530359}
parent 27cc0e39
......@@ -93,6 +93,8 @@ class CSSProperty : public CSSUnresolvedProperty {
const LayoutObject*,
Node*,
bool allow_visited_style) const { return nullptr; }
// FIXME: Resolve computed auto alignment in applyProperty/ComputedStyle and
// remove this non-const Node parameter.
const CSSValue* CSSValueFromComputedStyle(const ComputedStyle&,
const LayoutObject*,
Node*,
......
......@@ -357,8 +357,8 @@ const CSSValue* CSSComputedStyleDeclaration::GetPropertyCSSValue(
if (!style)
return nullptr;
const CSSValue* value = ComputedStyleCSSValueMapping::Get(
property_class, *style, layout_object, styled_node, allow_visited_style_);
const CSSValue* value = property_class.CSSValueFromComputedStyle(
*style, layout_object, styled_node, allow_visited_style_);
if (value)
return value;
......
......@@ -3833,14 +3833,14 @@
"border-image-source", "border-image-slice", "border-image-width",
"border-image-outset", "border-image-repeat"
],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
},
{
name: "border-bottom",
longhands: [
"border-bottom-width", "border-bottom-style", "border-bottom-color"
],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
},
{
name: "border-color",
......@@ -3848,7 +3848,7 @@
"border-top-color", "border-right-color", "border-bottom-color",
"border-left-color"
],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
},
{
name: "border-image",
......@@ -3863,7 +3863,7 @@
longhands: [
"border-left-width", "border-left-style", "border-left-color"
],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
},
{
name: "border-radius",
......@@ -3878,7 +3878,7 @@
longhands: [
"border-right-width", "border-right-style", "border-right-color"
],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
},
{
name: "border-spacing",
......@@ -3893,14 +3893,14 @@
"border-top-style", "border-right-style", "border-bottom-style",
"border-left-style"
],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
keywords: ["none"],
typedom_types: ["Image"],
},
{
name: "border-top",
longhands: ["border-top-width", "border-top-style", "border-top-color"],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
},
{
name: "border-width",
......@@ -3908,17 +3908,17 @@
"border-top-width", "border-right-width", "border-bottom-width",
"border-left-width"
],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
},
{
name: "flex",
longhands: ["flex-grow", "flex-shrink", "flex-basis"],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
},
{
name: "flex-flow",
longhands: ["flex-direction", "flex-wrap"],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
},
{
name: "font",
......@@ -3935,7 +3935,7 @@
"font-variant-ligatures", "font-variant-caps",
"font-variant-numeric", "font-variant-east-asian"
],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
is_descriptor: true,
},
{
......@@ -3944,22 +3944,22 @@
"grid-template-rows", "grid-template-columns", "grid-template-areas",
"grid-auto-flow", "grid-auto-rows", "grid-auto-columns"
],
property_methods: ["ParseShorthand", "IsLayoutDependent"],
property_methods: ["ParseShorthand", "IsLayoutDependent", "CSSValueFromComputedStyleInternal"],
},
{
name: "place-content",
longhands: ["align-content", "justify-content"],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
},
{
name: "place-items",
longhands: ["align-items", "justify-items"],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
},
{
name: "place-self",
longhands: ["align-self", "justify-self"],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
},
{
name: "grid-area",
......@@ -3967,39 +3967,39 @@
"grid-row-start", "grid-column-start", "grid-row-end",
"grid-column-end"
],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
},
{
name: "grid-column",
longhands: ["grid-column-start", "grid-column-end"],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
},
{
name: "grid-gap",
longhands: ["grid-row-gap", "grid-column-gap"],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
},
{
name: "grid-row",
longhands: ["grid-row-start", "grid-row-end"],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
},
{
name: "grid-template",
longhands: [
"grid-template-rows", "grid-template-columns", "grid-template-areas"
],
property_methods: ["ParseShorthand", "IsLayoutDependent"],
property_methods: ["ParseShorthand", "IsLayoutDependent", "CSSValueFromComputedStyleInternal"],
},
{
name: "list-style",
longhands: ["list-style-type", "list-style-position", "list-style-image"],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
},
{
name: "margin",
longhands: ["margin-top", "margin-right", "margin-bottom", "margin-left"],
property_methods: ["ParseShorthand", "IsLayoutDependent"],
property_methods: ["ParseShorthand", "IsLayoutDependent", "CSSValueFromComputedStyleInternal"],
},
{
name: "marker",
......@@ -4017,7 +4017,7 @@
{
name: "outline",
longhands: ["outline-color", "outline-style", "outline-width"],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
},
{
name: "overflow",
......@@ -4035,7 +4035,7 @@
longhands: [
"padding-top", "padding-right", "padding-bottom", "padding-left"
],
property_methods: ["ParseShorthand", "IsLayoutDependent"],
property_methods: ["ParseShorthand", "IsLayoutDependent", "CSSValueFromComputedStyleInternal"],
},
{
name: "page-break-after",
......@@ -4055,19 +4055,19 @@
{
name: "scroll-margin",
longhands: ["scroll-margin-top", "scroll-margin-right", "scroll-margin-bottom", "scroll-margin-left"],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
runtime_flag: "CSSScrollSnapPoints",
},
{
name: "scroll-margin-block",
longhands: ["scroll-margin-block-start", "scroll-margin-block-end"],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
runtime_flag: "CSSScrollSnapPoints",
},
{
name: "scroll-margin-inline",
longhands: ["scroll-margin-inline-start", "scroll-margin-inline-end"],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
runtime_flag: "CSSScrollSnapPoints",
},
{
......@@ -4076,25 +4076,25 @@
"scroll-padding-top", "scroll-padding-right", "scroll-padding-bottom",
"scroll-padding-left"
],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
runtime_flag: "CSSScrollSnapPoints",
},
{
name: "scroll-padding-block",
longhands: ["scroll-padding-block-start", "scroll-padding-block-end"],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
runtime_flag: "CSSScrollSnapPoints",
},
{
name: "scroll-padding-inline",
longhands: ["scroll-padding-inline-start", "scroll-padding-inline-end"],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
runtime_flag: "CSSScrollSnapPoints",
},
{
name: "text-decoration",
longhands: ["text-decoration-line", "text-decoration-style", "text-decoration-color"],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
},
{
name: "transition",
......@@ -4172,12 +4172,12 @@
longhands: [
"column-rule-width", "column-rule-style", "column-rule-color"
],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
},
{
name: "columns",
longhands: ["column-width", "column-count"],
property_methods: ["ParseShorthand"],
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
},
{
name: "-webkit-margin-collapse",
......
......@@ -25,216 +25,13 @@
#include "core/css/ComputedStyleCSSValueMapping.h"
#include "base/macros.h"
#include "core/StylePropertyShorthand.h"
#include "core/animation/css/CSSAnimationData.h"
#include "core/animation/css/CSSTransitionData.h"
#include "core/css/BasicShapeFunctions.h"
#include "core/css/CSSBasicShapeValues.h"
#include "core/css/CSSColorValue.h"
#include "core/css/CSSCounterValue.h"
#include "core/css/CSSCursorImageValue.h"
#include "core/css/CSSCustomIdentValue.h"
#include "core/css/CSSCustomPropertyDeclaration.h"
#include "core/css/CSSFontFamilyValue.h"
#include "core/css/CSSFontFeatureValue.h"
#include "core/css/CSSFontStyleRangeValue.h"
#include "core/css/CSSFontVariationValue.h"
#include "core/css/CSSFunctionValue.h"
#include "core/css/CSSGridLineNamesValue.h"
#include "core/css/CSSGridTemplateAreasValue.h"
#include "core/css/CSSIdentifierValue.h"
#include "core/css/CSSInitialValue.h"
#include "core/css/CSSPathValue.h"
#include "core/css/CSSPrimitiveValue.h"
#include "core/css/CSSPrimitiveValueMappings.h"
#include "core/css/CSSQuadValue.h"
#include "core/css/CSSShadowValue.h"
#include "core/css/CSSStringValue.h"
#include "core/css/CSSTimingFunctionValue.h"
#include "core/css/CSSURIValue.h"
#include "core/css/CSSValueList.h"
#include "core/css/CSSValuePair.h"
#include "core/css/CSSValue.h"
#include "core/css/PropertyRegistry.h"
#include "core/css/ZoomAdjustedPixelValue.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/layout/LayoutBlock.h"
#include "core/layout/LayoutBox.h"
#include "core/layout/LayoutGrid.h"
#include "core/layout/LayoutObject.h"
#include "core/style/ComputedStyle.h"
#include "core/style/ContentData.h"
#include "core/style/CursorData.h"
#include "core/style/QuotesData.h"
#include "core/style/ShadowList.h"
#include "core/style/StyleInheritedVariables.h"
#include "core/style/StyleNonInheritedVariables.h"
#include "platform/LengthFunctions.h"
namespace blink {
using namespace cssvalue;
static CSSValueList* ValuesForGridShorthand(
const StylePropertyShorthand& shorthand,
const ComputedStyle& style,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) {
CSSValueList* list = CSSValueList::CreateSlashSeparated();
for (size_t i = 0; i < shorthand.length(); ++i) {
const CSSValue* value = ComputedStyleCSSValueMapping::Get(
*shorthand.properties()[i], style, layout_object, styled_node,
allow_visited_style);
DCHECK(value);
list->Append(*value);
}
return list;
}
static CSSValueList* ValuesForShorthandProperty(
const StylePropertyShorthand& shorthand,
const ComputedStyle& style,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) {
CSSValueList* list = CSSValueList::CreateSpaceSeparated();
for (size_t i = 0; i < shorthand.length(); ++i) {
const CSSValue* value = ComputedStyleCSSValueMapping::Get(
*shorthand.properties()[i], style, layout_object, styled_node,
allow_visited_style);
DCHECK(value);
list->Append(*value);
}
return list;
}
static CSSValue* ExpandNoneLigaturesValue() {
CSSValueList* list = CSSValueList::CreateSpaceSeparated();
list->Append(*CSSIdentifierValue::Create(CSSValueNoCommonLigatures));
list->Append(*CSSIdentifierValue::Create(CSSValueNoDiscretionaryLigatures));
list->Append(*CSSIdentifierValue::Create(CSSValueNoHistoricalLigatures));
list->Append(*CSSIdentifierValue::Create(CSSValueNoContextual));
return list;
}
static CSSValue* ValuesForFontVariantProperty(const ComputedStyle& style,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) {
enum VariantShorthandCases {
kAllNormal,
kNoneLigatures,
kConcatenateNonNormal
};
StylePropertyShorthand shorthand = fontVariantShorthand();
VariantShorthandCases shorthand_case = kAllNormal;
for (size_t i = 0; i < shorthand.length(); ++i) {
const CSSValue* value = ComputedStyleCSSValueMapping::Get(
*shorthand.properties()[i], style, layout_object, styled_node,
allow_visited_style);
if (shorthand_case == kAllNormal && value->IsIdentifierValue() &&
ToCSSIdentifierValue(value)->GetValueID() == CSSValueNone &&
shorthand.properties()[i]->IDEquals(CSSPropertyFontVariantLigatures)) {
shorthand_case = kNoneLigatures;
} else if (!(value->IsIdentifierValue() &&
ToCSSIdentifierValue(value)->GetValueID() == CSSValueNormal)) {
shorthand_case = kConcatenateNonNormal;
break;
}
}
switch (shorthand_case) {
case kAllNormal:
return CSSIdentifierValue::Create(CSSValueNormal);
case kNoneLigatures:
return CSSIdentifierValue::Create(CSSValueNone);
case kConcatenateNonNormal: {
CSSValueList* list = CSSValueList::CreateSpaceSeparated();
for (size_t i = 0; i < shorthand.length(); ++i) {
const CSSValue* value = ComputedStyleCSSValueMapping::Get(
*shorthand.properties()[i], style, layout_object, styled_node,
allow_visited_style);
DCHECK(value);
if (value->IsIdentifierValue() &&
ToCSSIdentifierValue(value)->GetValueID() == CSSValueNone) {
list->Append(*ExpandNoneLigaturesValue());
} else if (!(value->IsIdentifierValue() &&
ToCSSIdentifierValue(value)->GetValueID() ==
CSSValueNormal)) {
list->Append(*value);
}
}
return list;
}
default:
NOTREACHED();
return nullptr;
}
}
static CSSValueList* ValuesForSidesShorthand(
const StylePropertyShorthand& shorthand,
const ComputedStyle& style,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) {
CSSValueList* list = CSSValueList::CreateSpaceSeparated();
// Assume the properties are in the usual order top, right, bottom, left.
const CSSValue* top_value = ComputedStyleCSSValueMapping::Get(
*shorthand.properties()[0], style, layout_object, styled_node,
allow_visited_style);
const CSSValue* right_value = ComputedStyleCSSValueMapping::Get(
*shorthand.properties()[1], style, layout_object, styled_node,
allow_visited_style);
const CSSValue* bottom_value = ComputedStyleCSSValueMapping::Get(
*shorthand.properties()[2], style, layout_object, styled_node,
allow_visited_style);
const CSSValue* left_value = ComputedStyleCSSValueMapping::Get(
*shorthand.properties()[3], style, layout_object, styled_node,
allow_visited_style);
// All 4 properties must be specified.
if (!top_value || !right_value || !bottom_value || !left_value)
return nullptr;
bool show_left = !DataEquivalent(right_value, left_value);
bool show_bottom = !DataEquivalent(top_value, bottom_value) || show_left;
bool show_right = !DataEquivalent(top_value, right_value) || show_bottom;
list->Append(*top_value);
if (show_right)
list->Append(*right_value);
if (show_bottom)
list->Append(*bottom_value);
if (show_left)
list->Append(*left_value);
return list;
}
static CSSValuePair* ValuesForInlineBlockShorthand(
const StylePropertyShorthand& shorthand,
const ComputedStyle& style,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) {
const CSSValue* start_value = ComputedStyleCSSValueMapping::Get(
*shorthand.properties()[0], style, layout_object, styled_node,
allow_visited_style);
const CSSValue* end_value = ComputedStyleCSSValueMapping::Get(
*shorthand.properties()[1], style, layout_object, styled_node,
allow_visited_style);
// Both properties must be specified.
if (!start_value || !end_value)
return nullptr;
CSSValuePair* pair = CSSValuePair::Create(start_value, end_value,
CSSValuePair::kDropIdenticalValues);
return pair;
}
const CSSValue* ComputedStyleCSSValueMapping::Get(
const AtomicString custom_property_name,
const ComputedStyle& style,
......@@ -269,163 +66,4 @@ ComputedStyleCSSValueMapping::GetVariables(const ComputedStyle& style) {
return nullptr;
}
const CSSValue* ComputedStyleCSSValueMapping::Get(
const CSSProperty& property,
const ComputedStyle& style,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) {
const CSSProperty& resolved_property = property.ResolveDirectionAwareProperty(
style.Direction(), style.GetWritingMode());
switch (resolved_property.PropertyID()) {
case CSSPropertyGridColumn:
return ValuesForGridShorthand(gridColumnShorthand(), style, layout_object,
styled_node, allow_visited_style);
case CSSPropertyGridRow:
return ValuesForGridShorthand(gridRowShorthand(), style, layout_object,
styled_node, allow_visited_style);
case CSSPropertyGridArea:
return ValuesForGridShorthand(gridAreaShorthand(), style, layout_object,
styled_node, allow_visited_style);
case CSSPropertyGridTemplate:
return ValuesForGridShorthand(gridTemplateShorthand(), style,
layout_object, styled_node,
allow_visited_style);
case CSSPropertyGrid:
return ValuesForGridShorthand(gridShorthand(), style, layout_object,
styled_node, allow_visited_style);
case CSSPropertyPlaceContent: {
// TODO (jfernandez): The spec states that we should return the specified
// value.
return ValuesForShorthandProperty(placeContentShorthand(), style,
layout_object, styled_node,
allow_visited_style);
}
case CSSPropertyPlaceItems: {
// TODO (jfernandez): The spec states that we should return the specified
// value.
return ValuesForShorthandProperty(placeItemsShorthand(), style,
layout_object, styled_node,
allow_visited_style);
}
case CSSPropertyPlaceSelf: {
// TODO (jfernandez): The spec states that we should return the specified
// value.
return ValuesForShorthandProperty(placeSelfShorthand(), style,
layout_object, styled_node,
allow_visited_style);
}
case CSSPropertyFlex:
return ValuesForShorthandProperty(flexShorthand(), style, layout_object,
styled_node, allow_visited_style);
case CSSPropertyFlexFlow:
return ValuesForShorthandProperty(flexFlowShorthand(), style,
layout_object, styled_node,
allow_visited_style);
case CSSPropertyGridGap:
return ValuesForShorthandProperty(gridGapShorthand(), style,
layout_object, styled_node,
allow_visited_style);
case CSSPropertyTextDecoration:
return ValuesForShorthandProperty(textDecorationShorthand(), style,
layout_object, styled_node,
allow_visited_style);
case CSSPropertyBorder: {
const CSSValue* value =
Get(GetCSSPropertyBorderTop(), style, layout_object, styled_node,
allow_visited_style);
static const CSSProperty* kProperties[3] = {&GetCSSPropertyBorderRight(),
&GetCSSPropertyBorderBottom(),
&GetCSSPropertyBorderLeft()};
for (size_t i = 0; i < WTF_ARRAY_LENGTH(kProperties); ++i) {
if (!DataEquivalent(value, Get(*kProperties[i], style, layout_object,
styled_node, allow_visited_style)))
return nullptr;
}
return value;
}
case CSSPropertyBorderBottom:
return ValuesForShorthandProperty(borderBottomShorthand(), style,
layout_object, styled_node,
allow_visited_style);
case CSSPropertyBorderColor:
return ValuesForSidesShorthand(borderColorShorthand(), style,
layout_object, styled_node,
allow_visited_style);
case CSSPropertyBorderLeft:
return ValuesForShorthandProperty(borderLeftShorthand(), style,
layout_object, styled_node,
allow_visited_style);
case CSSPropertyBorderRight:
return ValuesForShorthandProperty(borderRightShorthand(), style,
layout_object, styled_node,
allow_visited_style);
case CSSPropertyBorderStyle:
return ValuesForSidesShorthand(borderStyleShorthand(), style,
layout_object, styled_node,
allow_visited_style);
case CSSPropertyBorderTop:
return ValuesForShorthandProperty(borderTopShorthand(), style,
layout_object, styled_node,
allow_visited_style);
case CSSPropertyBorderWidth:
return ValuesForSidesShorthand(borderWidthShorthand(), style,
layout_object, styled_node,
allow_visited_style);
case CSSPropertyColumnRule:
return ValuesForShorthandProperty(columnRuleShorthand(), style,
layout_object, styled_node,
allow_visited_style);
case CSSPropertyColumns:
return ValuesForShorthandProperty(columnsShorthand(), style,
layout_object, styled_node,
allow_visited_style);
case CSSPropertyListStyle:
return ValuesForShorthandProperty(listStyleShorthand(), style,
layout_object, styled_node,
allow_visited_style);
case CSSPropertyMargin:
return ValuesForSidesShorthand(marginShorthand(), style, layout_object,
styled_node, allow_visited_style);
case CSSPropertyOutline:
return ValuesForShorthandProperty(outlineShorthand(), style,
layout_object, styled_node,
allow_visited_style);
case CSSPropertyFontVariant:
return ValuesForFontVariantProperty(style, layout_object, styled_node,
allow_visited_style);
case CSSPropertyPadding:
return ValuesForSidesShorthand(paddingShorthand(), style, layout_object,
styled_node, allow_visited_style);
case CSSPropertyScrollPadding:
return ValuesForSidesShorthand(scrollPaddingShorthand(), style,
layout_object, styled_node,
allow_visited_style);
case CSSPropertyScrollPaddingBlock:
return ValuesForInlineBlockShorthand(scrollPaddingBlockShorthand(), style,
layout_object, styled_node,
allow_visited_style);
case CSSPropertyScrollPaddingInline:
return ValuesForInlineBlockShorthand(scrollPaddingInlineShorthand(),
style, layout_object, styled_node,
allow_visited_style);
case CSSPropertyScrollMargin:
return ValuesForSidesShorthand(scrollMarginShorthand(), style,
layout_object, styled_node,
allow_visited_style);
case CSSPropertyScrollMarginBlock:
return ValuesForInlineBlockShorthand(scrollMarginBlockShorthand(), style,
layout_object, styled_node,
allow_visited_style);
case CSSPropertyScrollMarginInline:
return ValuesForInlineBlockShorthand(scrollMarginInlineShorthand(), style,
layout_object, styled_node,
allow_visited_style);
default:
return resolved_property.CSSValueFromComputedStyle(
style, layout_object, styled_node, allow_visited_style);
}
}
} // namespace blink
......@@ -5,32 +5,19 @@
#ifndef ComputedStyleCSSValueMapping_h
#define ComputedStyleCSSValueMapping_h
#include "core/CSSPropertyNames.h"
#include "core/css/CSSValue.h"
#include "core/css/properties/CSSProperty.h"
#include "platform/wtf/Allocator.h"
#include "platform/wtf/HashMap.h"
#include "platform/wtf/text/AtomicString.h"
namespace blink {
class CSSVariableData;
class ComputedStyle;
class LayoutObject;
class Node;
class PropertyRegistry;
class ComputedStyleCSSValueMapping {
STATIC_ONLY(ComputedStyleCSSValueMapping);
public:
// FIXME: Resolve computed auto alignment in applyProperty/ComputedStyle and
// remove this non-const styledNode parameter.
static const CSSValue* Get(const CSSProperty&,
const ComputedStyle&,
const LayoutObject* = nullptr,
Node* styled_node = nullptr,
bool allow_visited_style = false);
static const CSSValue* Get(const AtomicString custom_property_name,
const ComputedStyle&,
const PropertyRegistry*);
......
......@@ -53,9 +53,9 @@ const CSSValue* ComputedStylePropertyMap::GetProperty(
const ComputedStyle* style = UpdateStyle();
if (!style)
return nullptr;
return ComputedStyleCSSValueMapping::Get(CSSProperty::Get(property_id),
*style, nullptr /* layout_object */,
StyledNode());
return CSSProperty::Get(property_id)
.CSSValueFromComputedStyle(*style, nullptr /* layout_object */,
StyledNode(), false);
}
const CSSValue* ComputedStylePropertyMap::GetCustomProperty(
......@@ -77,8 +77,8 @@ void ComputedStylePropertyMap::ForEachProperty(
CSSComputedStyleDeclaration::ComputableProperties()) {
DCHECK(property);
DCHECK(!property->IDEquals(CSSPropertyVariable));
const CSSValue* value = ComputedStyleCSSValueMapping::Get(
*property, *style, nullptr /* layout_object */, StyledNode());
const CSSValue* value = property->CSSValueFromComputedStyle(
*style, nullptr /* layout_object */, StyledNode(), false);
if (value)
callback(property->GetPropertyName(), *value);
}
......
......@@ -4,6 +4,7 @@
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/StylePropertyShorthand.h"
#include "core/css/BasicShapeFunctions.h"
#include "core/css/CSSBorderImage.h"
#include "core/css/CSSBorderImageSliceValue.h"
......@@ -2114,4 +2115,165 @@ bool ComputedStyleUtils::WidthOrHeightShouldReturnUsedValue(
return !object->IsSVGChild();
}
CSSValueList* ComputedStyleUtils::ValuesForShorthandProperty(
const StylePropertyShorthand& shorthand,
const ComputedStyle& style,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) {
CSSValueList* list = CSSValueList::CreateSpaceSeparated();
for (size_t i = 0; i < shorthand.length(); ++i) {
const CSSValue* value =
shorthand.properties()[i]->CSSValueFromComputedStyle(
style, layout_object, styled_node, allow_visited_style);
DCHECK(value);
list->Append(*value);
}
return list;
}
CSSValueList* ComputedStyleUtils::ValuesForGridShorthand(
const StylePropertyShorthand& shorthand,
const ComputedStyle& style,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) {
CSSValueList* list = CSSValueList::CreateSlashSeparated();
for (size_t i = 0; i < shorthand.length(); ++i) {
const CSSValue* value =
shorthand.properties()[i]->CSSValueFromComputedStyle(
style, layout_object, styled_node, allow_visited_style);
DCHECK(value);
list->Append(*value);
}
return list;
}
CSSValueList* ComputedStyleUtils::ValuesForSidesShorthand(
const StylePropertyShorthand& shorthand,
const ComputedStyle& style,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) {
CSSValueList* list = CSSValueList::CreateSpaceSeparated();
// Assume the properties are in the usual order top, right, bottom, left.
const CSSValue* top_value =
shorthand.properties()[0]->CSSValueFromComputedStyle(
style, layout_object, styled_node, allow_visited_style);
const CSSValue* right_value =
shorthand.properties()[1]->CSSValueFromComputedStyle(
style, layout_object, styled_node, allow_visited_style);
const CSSValue* bottom_value =
shorthand.properties()[2]->CSSValueFromComputedStyle(
style, layout_object, styled_node, allow_visited_style);
const CSSValue* left_value =
shorthand.properties()[3]->CSSValueFromComputedStyle(
style, layout_object, styled_node, allow_visited_style);
// All 4 properties must be specified.
if (!top_value || !right_value || !bottom_value || !left_value)
return nullptr;
bool show_left = !DataEquivalent(right_value, left_value);
bool show_bottom = !DataEquivalent(top_value, bottom_value) || show_left;
bool show_right = !DataEquivalent(top_value, right_value) || show_bottom;
list->Append(*top_value);
if (show_right)
list->Append(*right_value);
if (show_bottom)
list->Append(*bottom_value);
if (show_left)
list->Append(*left_value);
return list;
}
CSSValuePair* ComputedStyleUtils::ValuesForInlineBlockShorthand(
const StylePropertyShorthand& shorthand,
const ComputedStyle& style,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) {
const CSSValue* start_value =
shorthand.properties()[0]->CSSValueFromComputedStyle(
style, layout_object, styled_node, allow_visited_style);
const CSSValue* end_value =
shorthand.properties()[1]->CSSValueFromComputedStyle(
style, layout_object, styled_node, allow_visited_style);
// Both properties must be specified.
if (!start_value || !end_value)
return nullptr;
CSSValuePair* pair = CSSValuePair::Create(start_value, end_value,
CSSValuePair::kDropIdenticalValues);
return pair;
}
static CSSValue* ExpandNoneLigaturesValue() {
CSSValueList* list = CSSValueList::CreateSpaceSeparated();
list->Append(*CSSIdentifierValue::Create(CSSValueNoCommonLigatures));
list->Append(*CSSIdentifierValue::Create(CSSValueNoDiscretionaryLigatures));
list->Append(*CSSIdentifierValue::Create(CSSValueNoHistoricalLigatures));
list->Append(*CSSIdentifierValue::Create(CSSValueNoContextual));
return list;
}
CSSValue* ComputedStyleUtils::ValuesForFontVariantProperty(
const ComputedStyle& style,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) {
enum VariantShorthandCases {
kAllNormal,
kNoneLigatures,
kConcatenateNonNormal
};
StylePropertyShorthand shorthand = fontVariantShorthand();
VariantShorthandCases shorthand_case = kAllNormal;
for (size_t i = 0; i < shorthand.length(); ++i) {
const CSSValue* value =
shorthand.properties()[i]->CSSValueFromComputedStyle(
style, layout_object, styled_node, allow_visited_style);
if (shorthand_case == kAllNormal && value->IsIdentifierValue() &&
ToCSSIdentifierValue(value)->GetValueID() == CSSValueNone &&
shorthand.properties()[i]->IDEquals(CSSPropertyFontVariantLigatures)) {
shorthand_case = kNoneLigatures;
} else if (!(value->IsIdentifierValue() &&
ToCSSIdentifierValue(value)->GetValueID() == CSSValueNormal)) {
shorthand_case = kConcatenateNonNormal;
break;
}
}
switch (shorthand_case) {
case kAllNormal:
return CSSIdentifierValue::Create(CSSValueNormal);
case kNoneLigatures:
return CSSIdentifierValue::Create(CSSValueNone);
case kConcatenateNonNormal: {
CSSValueList* list = CSSValueList::CreateSpaceSeparated();
for (size_t i = 0; i < shorthand.length(); ++i) {
const CSSValue* value =
shorthand.properties()[i]->CSSValueFromComputedStyle(
style, layout_object, styled_node, allow_visited_style);
DCHECK(value);
if (value->IsIdentifierValue() &&
ToCSSIdentifierValue(value)->GetValueID() == CSSValueNone) {
list->Append(*ExpandNoneLigaturesValue());
} else if (!(value->IsIdentifierValue() &&
ToCSSIdentifierValue(value)->GetValueID() ==
CSSValueNormal)) {
list->Append(*value);
}
}
return list;
}
default:
NOTREACHED();
return nullptr;
}
}
} // namespace blink
......@@ -8,6 +8,7 @@
#include "core/css/CSSBorderImageSliceValue.h"
#include "core/css/CSSIdentifierValue.h"
#include "core/css/CSSValueList.h"
#include "core/css/CSSValuePair.h"
#include "core/css/ZoomAdjustedPixelValue.h"
#include "core/style/ComputedStyle.h"
#include "core/style/ComputedStyleConstants.h"
......@@ -169,6 +170,31 @@ class ComputedStyleUtils {
static CSSValue* ValueForPageBreakInside(EBreakInside);
static CSSValue* ValueForWebkitColumnBreakInside(EBreakInside);
static bool WidthOrHeightShouldReturnUsedValue(const LayoutObject*);
static CSSValueList* ValuesForShorthandProperty(const StylePropertyShorthand&,
const ComputedStyle&,
const LayoutObject*,
Node*,
bool allow_visited_style);
static CSSValueList* ValuesForGridShorthand(const StylePropertyShorthand&,
const ComputedStyle&,
const LayoutObject*,
Node*,
bool allow_visited_style);
static CSSValueList* ValuesForSidesShorthand(const StylePropertyShorthand&,
const ComputedStyle&,
const LayoutObject*,
Node*,
bool allow_visited_style);
static CSSValuePair* ValuesForInlineBlockShorthand(
const StylePropertyShorthand&,
const ComputedStyle&,
const LayoutObject*,
Node*,
bool allow_visited_style);
static CSSValue* ValuesForFontVariantProperty(const ComputedStyle&,
const LayoutObject*,
Node*,
bool allow_visited_style);
};
} // namespace blink
......
......@@ -13,7 +13,7 @@ namespace CSSLonghand {
const CSSValue* TextDecorationStyle::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject*,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValueForTextDecorationStyle(
......
......@@ -6,6 +6,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -20,5 +22,16 @@ bool BorderBottom::ParseShorthand(
borderBottomShorthand(), important, context, range, properties);
}
const CSSValue* BorderBottom::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForShorthandProperty(
borderBottomShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -6,6 +6,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -20,5 +22,16 @@ bool BorderColor::ParseShorthand(
borderColorShorthand(), important, context, range, properties);
}
const CSSValue* BorderColor::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForSidesShorthand(
borderColorShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -7,6 +7,7 @@
#include "core/css/CSSInitialValue.h"
#include "core/css/parser/CSSParserContext.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
......@@ -69,5 +70,26 @@ bool Border::ParseShorthand(
return range.AtEnd();
}
const CSSValue* Border::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
const CSSValue* value = GetCSSPropertyBorderTop().CSSValueFromComputedStyle(
style, layout_object, styled_node, allow_visited_style);
static const CSSProperty* kProperties[3] = {&GetCSSPropertyBorderRight(),
&GetCSSPropertyBorderBottom(),
&GetCSSPropertyBorderLeft()};
for (size_t i = 0; i < WTF_ARRAY_LENGTH(kProperties); ++i) {
const CSSValue* value_for_side = kProperties[i]->CSSValueFromComputedStyle(
style, layout_object, styled_node, allow_visited_style);
if (!DataEquivalent(value, value_for_side)) {
return nullptr;
}
}
return value;
}
} // namespace CSSShorthand
} // namespace blink
......@@ -6,6 +6,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -20,5 +22,16 @@ bool BorderLeft::ParseShorthand(
borderLeftShorthand(), important, context, range, properties);
}
const CSSValue* BorderLeft::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForShorthandProperty(
borderLeftShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -6,6 +6,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -20,5 +22,16 @@ bool BorderRight::ParseShorthand(
borderRightShorthand(), important, context, range, properties);
}
const CSSValue* BorderRight::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForShorthandProperty(
borderRightShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -6,6 +6,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -20,5 +22,16 @@ bool BorderStyle::ParseShorthand(
borderStyleShorthand(), important, context, range, properties);
}
const CSSValue* BorderStyle::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForSidesShorthand(
borderStyleShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -6,6 +6,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -20,5 +22,16 @@ bool BorderTop::ParseShorthand(
borderTopShorthand(), important, context, range, properties);
}
const CSSValue* BorderTop::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForShorthandProperty(
borderTopShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -6,6 +6,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -20,5 +22,16 @@ bool BorderWidth::ParseShorthand(
borderWidthShorthand(), important, context, range, properties);
}
const CSSValue* BorderWidth::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForSidesShorthand(
borderWidthShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -6,6 +6,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -20,5 +22,16 @@ bool ColumnRule::ParseShorthand(
columnRuleShorthand(), important, context, range, properties);
}
const CSSValue* ColumnRule::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForShorthandProperty(
columnRuleShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -4,10 +4,13 @@
#include "core/css/properties/shorthands/Columns.h"
#include "core/StylePropertyShorthand.h"
#include "core/css/CSSIdentifierValue.h"
#include "core/css/parser/CSSParserContext.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/CSSParsingUtils.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -39,5 +42,16 @@ bool Columns::ParseShorthand(
return true;
}
const CSSValue* Columns::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForShorthandProperty(
columnsShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -4,10 +4,13 @@
#include "core/css/properties/shorthands/Flex.h"
#include "core/StylePropertyShorthand.h"
#include "core/css/CSSIdentifierValue.h"
#include "core/css/parser/CSSParserContext.h"
#include "core/css/parser/CSSParserLocalContext.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -92,5 +95,15 @@ bool Flex::ParseShorthand(bool important,
return true;
}
const CSSValue* Flex::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForShorthandProperty(
flexShorthand(), style, layout_object, styled_node, allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -6,6 +6,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -20,5 +22,16 @@ bool FlexFlow::ParseShorthand(
flexFlowShorthand(), important, context, range, properties);
}
const CSSValue* FlexFlow::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForShorthandProperty(
flexFlowShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -9,6 +9,8 @@
#include "core/css/parser/FontVariantEastAsianParser.h"
#include "core/css/parser/FontVariantLigaturesParser.h"
#include "core/css/parser/FontVariantNumericParser.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -105,5 +107,15 @@ bool FontVariant::ParseShorthand(
return true;
}
const CSSValue* FontVariant::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForFontVariantProperty(
style, layout_object, styled_node, allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -7,6 +7,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/CSSParsingUtils.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -75,5 +77,16 @@ bool GridArea::ParseShorthand(
return true;
}
const CSSValue* GridArea::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForGridShorthand(gridAreaShorthand(), style,
layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -8,6 +8,8 @@
#include "core/css/parser/CSSParserContext.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/CSSParsingUtils.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -41,5 +43,16 @@ bool GridColumn::ParseShorthand(
return true;
}
const CSSValue* GridColumn::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForGridShorthand(
gridColumnShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -9,7 +9,9 @@
#include "core/css/parser/CSSParserContext.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/CSSParsingUtils.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/layout/LayoutObject.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace {
......@@ -178,5 +180,15 @@ bool Grid::IsLayoutDependent(const ComputedStyle* style,
return layout_object && layout_object->IsLayoutGrid();
}
const CSSValue* Grid::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForGridShorthand(
gridShorthand(), style, layout_object, styled_node, allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -7,6 +7,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSParserContext.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -35,5 +37,16 @@ bool GridGap::ParseShorthand(
return true;
}
const CSSValue* GridGap::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForShorthandProperty(
gridGapShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -8,6 +8,8 @@
#include "core/css/parser/CSSParserContext.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/CSSParsingUtils.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -41,5 +43,16 @@ bool GridRow::ParseShorthand(
return true;
}
const CSSValue* GridRow::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForGridShorthand(gridRowShorthand(), style,
layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -4,10 +4,13 @@
#include "core/css/properties/shorthands/GridTemplate.h"
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSParserContext.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/CSSParsingUtils.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/layout/LayoutObject.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -51,5 +54,16 @@ bool GridTemplate::IsLayoutDependent(const ComputedStyle* style,
return layout_object && layout_object->IsLayoutGrid();
}
const CSSValue* GridTemplate::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForGridShorthand(
gridTemplateShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -6,6 +6,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -20,5 +22,16 @@ bool ListStyle::ParseShorthand(
listStyleShorthand(), important, context, range, properties);
}
const CSSValue* ListStyle::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForShorthandProperty(
listStyleShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -6,6 +6,7 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/layout/LayoutObject.h"
#include "core/style/ComputedStyle.h"
......@@ -30,5 +31,16 @@ bool Margin::IsLayoutDependent(const ComputedStyle* style,
!style->MarginRight().IsFixed());
}
const CSSValue* Margin::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForSidesShorthand(marginShorthand(), style,
layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -6,6 +6,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -20,5 +22,16 @@ bool Outline::ParseShorthand(
outlineShorthand(), important, context, range, properties);
}
const CSSValue* Outline::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForShorthandProperty(
outlineShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -6,6 +6,7 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/layout/LayoutObject.h"
#include "core/style/ComputedStyle.h"
......@@ -30,5 +31,16 @@ bool Padding::IsLayoutDependent(const ComputedStyle* style,
!style->PaddingRight().IsFixed());
}
const CSSValue* Padding::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForSidesShorthand(paddingShorthand(), style,
layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -7,6 +7,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/CSSParsingUtils.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -42,5 +44,18 @@ bool PlaceContent::ParseShorthand(
return true;
}
const CSSValue* PlaceContent::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
// TODO (jfernandez): The spec states that we should return the specified
// value.
return ComputedStyleUtils::ValuesForShorthandProperty(
placeContentShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -7,6 +7,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/CSSParsingUtils.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -45,5 +47,18 @@ bool PlaceItems::ParseShorthand(
return true;
}
const CSSValue* PlaceItems::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
// TODO (jfernandez): The spec states that we should return the specified
// value.
return ComputedStyleUtils::ValuesForShorthandProperty(
placeItemsShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -7,6 +7,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/CSSParsingUtils.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -41,5 +43,18 @@ bool PlaceSelf::ParseShorthand(
return true;
}
const CSSValue* PlaceSelf::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
// TODO (jfernandez): The spec states that we should return the specified
// value.
return ComputedStyleUtils::ValuesForShorthandProperty(
placeSelfShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -6,6 +6,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -20,5 +22,16 @@ bool ScrollMarginBlock::ParseShorthand(
scrollMarginBlockShorthand(), important, context, range, properties);
}
const CSSValue* ScrollMarginBlock::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForInlineBlockShorthand(
scrollMarginBlockShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -6,6 +6,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -20,5 +22,16 @@ bool ScrollMargin::ParseShorthand(
scrollMarginShorthand(), important, context, range, properties);
}
const CSSValue* ScrollMargin::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForSidesShorthand(
scrollMarginShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -6,6 +6,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -20,5 +22,16 @@ bool ScrollMarginInline::ParseShorthand(
scrollMarginInlineShorthand(), important, context, range, properties);
}
const CSSValue* ScrollMarginInline::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForInlineBlockShorthand(
scrollMarginInlineShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -6,6 +6,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -20,5 +22,16 @@ bool ScrollPaddingBlock::ParseShorthand(
scrollPaddingBlockShorthand(), important, context, range, properties);
}
const CSSValue* ScrollPaddingBlock::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForInlineBlockShorthand(
scrollPaddingBlockShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -6,6 +6,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -20,5 +22,16 @@ bool ScrollPadding::ParseShorthand(
scrollPaddingShorthand(), important, context, range, properties);
}
const CSSValue* ScrollPadding::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForSidesShorthand(
scrollPaddingShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -6,6 +6,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -20,5 +22,16 @@ bool ScrollPaddingInline::ParseShorthand(
scrollPaddingInlineShorthand(), important, context, range, properties);
}
const CSSValue* ScrollPaddingInline::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForInlineBlockShorthand(
scrollPaddingInlineShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
......@@ -6,6 +6,8 @@
#include "core/StylePropertyShorthand.h"
#include "core/css/parser/CSSPropertyParserHelpers.h"
#include "core/css/properties/ComputedStyleUtils.h"
#include "core/style/ComputedStyle.h"
namespace blink {
namespace CSSShorthand {
......@@ -20,5 +22,16 @@ bool TextDecoration::ParseShorthand(
textDecorationShorthand(), important, context, range, properties);
}
const CSSValue* TextDecoration::CSSValueFromComputedStyleInternal(
const ComputedStyle& style,
const SVGComputedStyle&,
const LayoutObject* layout_object,
Node* styled_node,
bool allow_visited_style) const {
return ComputedStyleUtils::ValuesForShorthandProperty(
textDecorationShorthand(), style, layout_object, styled_node,
allow_visited_style);
}
} // namespace CSSShorthand
} // namespace blink
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment