Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp

Issue 2346193002: Split CSSPrimitiveValue into CSSPrimitiveValue and CSSIdentifierValue (Closed)
Patch Set: Replaced ASSERTs with DCHECKS in presubmit warnings Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved.
7 * Copyright (C) 2015 Google Inc. All rights reserved. 7 * Copyright (C) 2015 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public 10 * modify it under the terms of the GNU Lesser General Public
(...skipping 23 matching lines...) Expand all
34 #include "core/css/CSSColorValue.h" 34 #include "core/css/CSSColorValue.h"
35 #include "core/css/CSSCounterValue.h" 35 #include "core/css/CSSCounterValue.h"
36 #include "core/css/CSSCursorImageValue.h" 36 #include "core/css/CSSCursorImageValue.h"
37 #include "core/css/CSSCustomIdentValue.h" 37 #include "core/css/CSSCustomIdentValue.h"
38 #include "core/css/CSSCustomPropertyDeclaration.h" 38 #include "core/css/CSSCustomPropertyDeclaration.h"
39 #include "core/css/CSSFontFamilyValue.h" 39 #include "core/css/CSSFontFamilyValue.h"
40 #include "core/css/CSSFontFeatureValue.h" 40 #include "core/css/CSSFontFeatureValue.h"
41 #include "core/css/CSSFunctionValue.h" 41 #include "core/css/CSSFunctionValue.h"
42 #include "core/css/CSSGridLineNamesValue.h" 42 #include "core/css/CSSGridLineNamesValue.h"
43 #include "core/css/CSSGridTemplateAreasValue.h" 43 #include "core/css/CSSGridTemplateAreasValue.h"
44 #include "core/css/CSSIdentifierValue.h"
44 #include "core/css/CSSInitialValue.h" 45 #include "core/css/CSSInitialValue.h"
45 #include "core/css/CSSPathValue.h" 46 #include "core/css/CSSPathValue.h"
46 #include "core/css/CSSPrimitiveValue.h" 47 #include "core/css/CSSPrimitiveValue.h"
47 #include "core/css/CSSPrimitiveValueMappings.h" 48 #include "core/css/CSSPrimitiveValueMappings.h"
48 #include "core/css/CSSQuadValue.h" 49 #include "core/css/CSSQuadValue.h"
49 #include "core/css/CSSReflectValue.h" 50 #include "core/css/CSSReflectValue.h"
50 #include "core/css/CSSShadowValue.h" 51 #include "core/css/CSSShadowValue.h"
51 #include "core/css/CSSStringValue.h" 52 #include "core/css/CSSStringValue.h"
52 #include "core/css/CSSTimingFunctionValue.h" 53 #include "core/css/CSSTimingFunctionValue.h"
53 #include "core/css/CSSURIValue.h" 54 #include "core/css/CSSURIValue.h"
(...skipping 17 matching lines...) Expand all
71 inline static bool isFlexOrGrid(const ComputedStyle* style) 72 inline static bool isFlexOrGrid(const ComputedStyle* style)
72 { 73 {
73 return style && style->isDisplayFlexibleOrGridBox(); 74 return style && style->isDisplayFlexibleOrGridBox();
74 } 75 }
75 76
76 inline static CSSPrimitiveValue* zoomAdjustedPixelValue(double value, const Comp utedStyle& style) 77 inline static CSSPrimitiveValue* zoomAdjustedPixelValue(double value, const Comp utedStyle& style)
77 { 78 {
78 return CSSPrimitiveValue::create(adjustFloatForAbsoluteZoom(value, style), C SSPrimitiveValue::UnitType::Pixels); 79 return CSSPrimitiveValue::create(adjustFloatForAbsoluteZoom(value, style), C SSPrimitiveValue::UnitType::Pixels);
79 } 80 }
80 81
82 inline static CSSValue* zoomAdjustedPixelValueOrAuto(const Length& length, const ComputedStyle& style)
83 {
84 if (length.isAuto())
85 return CSSIdentifierValue::createIdentifier(CSSValueAuto);
86 return zoomAdjustedPixelValue(length.value(), style);
87 }
88
81 inline static CSSPrimitiveValue* zoomAdjustedNumberValue(double value, const Com putedStyle& style) 89 inline static CSSPrimitiveValue* zoomAdjustedNumberValue(double value, const Com putedStyle& style)
82 { 90 {
83 return CSSPrimitiveValue::create(value / style.effectiveZoom(), CSSPrimitive Value::UnitType::Number); 91 return CSSPrimitiveValue::create(value / style.effectiveZoom(), CSSPrimitive Value::UnitType::Number);
84 } 92 }
85 93
86 static CSSPrimitiveValue* zoomAdjustedPixelValueForLength(const Length& length, const ComputedStyle& style) 94 static CSSValue* zoomAdjustedPixelValueForLength(const Length& length, const Com putedStyle& style)
87 { 95 {
88 if (length.isFixed()) 96 if (length.isFixed())
89 return zoomAdjustedPixelValue(length.value(), style); 97 return zoomAdjustedPixelValue(length.value(), style);
90 return CSSPrimitiveValue::create(length, style.effectiveZoom()); 98 return CSSValue::create(length, style.effectiveZoom());
91 } 99 }
92 100
93 static CSSPrimitiveValue* pixelValueForUnzoomedLength(const UnzoomedLength& unzo omedLength, const ComputedStyle& style) 101 static CSSValue* pixelValueForUnzoomedLength(const UnzoomedLength& unzoomedLengt h, const ComputedStyle& style)
94 { 102 {
95 const Length& length = unzoomedLength.length(); 103 const Length& length = unzoomedLength.length();
96 if (length.isFixed()) 104 if (length.isFixed())
97 return CSSPrimitiveValue::create(length.value(), CSSPrimitiveValue::Unit Type::Pixels); 105 return CSSPrimitiveValue::create(length.value(), CSSPrimitiveValue::Unit Type::Pixels);
98 return CSSPrimitiveValue::create(length, style.effectiveZoom()); 106 return CSSValue::create(length, style.effectiveZoom());
99 } 107 }
100 108
101 static CSSValueList* createPositionListForLayer(CSSPropertyID propertyID, const FillLayer& layer, const ComputedStyle& style) 109 static CSSValueList* createPositionListForLayer(CSSPropertyID propertyID, const FillLayer& layer, const ComputedStyle& style)
102 { 110 {
103 CSSValueList* positionList = CSSValueList::createSpaceSeparated(); 111 CSSValueList* positionList = CSSValueList::createSpaceSeparated();
104 if (layer.isBackgroundXOriginSet()) { 112 if (layer.isBackgroundXOriginSet()) {
105 ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPosition || propertyID == CSSPropertyWebkitMaskPosition); 113 ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPosition || propertyID == CSSPropertyWebkitMaskPosition);
106 positionList->append(*CSSPrimitiveValue::create(layer.backgroundXOrigin( ))); 114 positionList->append(*CSSIdentifierValue::create(layer.backgroundXOrigin ()));
107 } 115 }
108 positionList->append(*zoomAdjustedPixelValueForLength(layer.xPosition(), sty le)); 116 positionList->append(*zoomAdjustedPixelValueForLength(layer.xPosition(), sty le));
109 if (layer.isBackgroundYOriginSet()) { 117 if (layer.isBackgroundYOriginSet()) {
110 ASSERT(propertyID == CSSPropertyBackgroundPosition || propertyID == CSSP ropertyWebkitMaskPosition); 118 ASSERT(propertyID == CSSPropertyBackgroundPosition || propertyID == CSSP ropertyWebkitMaskPosition);
111 positionList->append(*CSSPrimitiveValue::create(layer.backgroundYOrigin( ))); 119 positionList->append(*CSSIdentifierValue::create(layer.backgroundYOrigin ()));
112 } 120 }
113 positionList->append(*zoomAdjustedPixelValueForLength(layer.yPosition(), sty le)); 121 positionList->append(*zoomAdjustedPixelValueForLength(layer.yPosition(), sty le));
114 return positionList; 122 return positionList;
115 } 123 }
116 124
117 CSSValue* ComputedStyleCSSValueMapping::currentColorOrValidColor(const ComputedS tyle& style, const StyleColor& color) 125 CSSValue* ComputedStyleCSSValueMapping::currentColorOrValidColor(const ComputedS tyle& style, const StyleColor& color)
118 { 126 {
119 // This function does NOT look at visited information, so that computed styl e doesn't expose that. 127 // This function does NOT look at visited information, so that computed styl e doesn't expose that.
120 return CSSColorValue::create(color.resolve(style.color()).rgb()); 128 return CSSColorValue::create(color.resolve(style.color()).rgb());
121 } 129 }
122 130
123 static CSSValue* valueForFillSize(const FillSize& fillSize, const ComputedStyle& style) 131 static CSSValue* valueForFillSize(const FillSize& fillSize, const ComputedStyle& style)
124 { 132 {
125 if (fillSize.type == Contain) 133 if (fillSize.type == Contain)
126 return CSSPrimitiveValue::createIdentifier(CSSValueContain); 134 return CSSIdentifierValue::createIdentifier(CSSValueContain);
127 135
128 if (fillSize.type == Cover) 136 if (fillSize.type == Cover)
129 return CSSPrimitiveValue::createIdentifier(CSSValueCover); 137 return CSSIdentifierValue::createIdentifier(CSSValueCover);
130 138
131 if (fillSize.size.height().isAuto()) 139 if (fillSize.size.height().isAuto())
132 return zoomAdjustedPixelValueForLength(fillSize.size.width(), style); 140 return zoomAdjustedPixelValueForLength(fillSize.size.width(), style);
133 141
134 CSSValueList* list = CSSValueList::createSpaceSeparated(); 142 CSSValueList* list = CSSValueList::createSpaceSeparated();
135 list->append(*zoomAdjustedPixelValueForLength(fillSize.size.width(), style)) ; 143 list->append(*zoomAdjustedPixelValueForLength(fillSize.size.width(), style)) ;
136 list->append(*zoomAdjustedPixelValueForLength(fillSize.size.height(), style) ); 144 list->append(*zoomAdjustedPixelValueForLength(fillSize.size.height(), style) );
137 return list; 145 return list;
138 } 146 }
139 147
140 static CSSValue* valueForFillRepeat(EFillRepeat xRepeat, EFillRepeat yRepeat) 148 static CSSValue* valueForFillRepeat(EFillRepeat xRepeat, EFillRepeat yRepeat)
141 { 149 {
142 // For backwards compatibility, if both values are equal, just return one of them. And 150 // For backwards compatibility, if both values are equal, just return one of them. And
143 // if the two values are equivalent to repeat-x or repeat-y, just return the shorthand. 151 // if the two values are equivalent to repeat-x or repeat-y, just return the shorthand.
144 if (xRepeat == yRepeat) 152 if (xRepeat == yRepeat)
145 return CSSPrimitiveValue::create(xRepeat); 153 return CSSIdentifierValue::create(xRepeat);
146 if (xRepeat == RepeatFill && yRepeat == NoRepeatFill) 154 if (xRepeat == RepeatFill && yRepeat == NoRepeatFill)
147 return CSSPrimitiveValue::createIdentifier(CSSValueRepeatX); 155 return CSSIdentifierValue::createIdentifier(CSSValueRepeatX);
148 if (xRepeat == NoRepeatFill && yRepeat == RepeatFill) 156 if (xRepeat == NoRepeatFill && yRepeat == RepeatFill)
149 return CSSPrimitiveValue::createIdentifier(CSSValueRepeatY); 157 return CSSIdentifierValue::createIdentifier(CSSValueRepeatY);
150 158
151 CSSValueList* list = CSSValueList::createSpaceSeparated(); 159 CSSValueList* list = CSSValueList::createSpaceSeparated();
152 list->append(*CSSPrimitiveValue::create(xRepeat)); 160 list->append(*CSSIdentifierValue::create(xRepeat));
153 list->append(*CSSPrimitiveValue::create(yRepeat)); 161 list->append(*CSSIdentifierValue::create(yRepeat));
154 return list; 162 return list;
155 } 163 }
156 164
157 static CSSValue* valueForFillSourceType(EMaskSourceType type) 165 static CSSValue* valueForFillSourceType(EMaskSourceType type)
158 { 166 {
159 switch (type) { 167 switch (type) {
160 case MaskAlpha: 168 case MaskAlpha:
161 return CSSPrimitiveValue::createIdentifier(CSSValueAlpha); 169 return CSSIdentifierValue::createIdentifier(CSSValueAlpha);
162 case MaskLuminance: 170 case MaskLuminance:
163 return CSSPrimitiveValue::createIdentifier(CSSValueLuminance); 171 return CSSIdentifierValue::createIdentifier(CSSValueLuminance);
164 } 172 }
165 173
166 ASSERT_NOT_REACHED(); 174 ASSERT_NOT_REACHED();
167 175
168 return nullptr; 176 return nullptr;
169 } 177 }
170 178
171 static CSSValue* valueForPositionOffset(const ComputedStyle& style, CSSPropertyI D propertyID, const LayoutObject* layoutObject) 179 static CSSValue* valueForPositionOffset(const ComputedStyle& style, CSSPropertyI D propertyID, const LayoutObject* layoutObject)
172 { 180 {
173 Length offset, opposite; 181 Length offset, opposite;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 218
211 if (opposite.isPercentOrCalc() || opposite.isCalculated()) { 219 if (opposite.isPercentOrCalc() || opposite.isCalculated()) {
212 if (layoutObject->isBox()) { 220 if (layoutObject->isBox()) {
213 LayoutUnit containingBlockSize = 221 LayoutUnit containingBlockSize =
214 (propertyID == CSSPropertyLeft || propertyID == CSSPrope rtyRight) ? 222 (propertyID == CSSPropertyLeft || propertyID == CSSPrope rtyRight) ?
215 toLayoutBox(layoutObject)->containingBlockLogicalWidthFo rContent() : 223 toLayoutBox(layoutObject)->containingBlockLogicalWidthFo rContent() :
216 toLayoutBox(layoutObject)->containingBlockLogicalHeightF orGetComputedStyle(); 224 toLayoutBox(layoutObject)->containingBlockLogicalHeightF orGetComputedStyle();
217 return zoomAdjustedPixelValue(-floatValueForLength(opposite, containingBlockSize), style); 225 return zoomAdjustedPixelValue(-floatValueForLength(opposite, containingBlockSize), style);
218 } 226 }
219 // FIXME: fall back to auto for position:relative, display:inli ne 227 // FIXME: fall back to auto for position:relative, display:inli ne
220 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 228 return CSSIdentifierValue::createIdentifier(CSSValueAuto);
221 } 229 }
222 230
223 // Length doesn't provide operator -, so multiply by -1. 231 // Length doesn't provide operator -, so multiply by -1.
224 opposite *= -1.f; 232 opposite *= -1.f;
225 return zoomAdjustedPixelValueForLength(opposite, style); 233 return zoomAdjustedPixelValueForLength(opposite, style);
226 } 234 }
227 235
228 if (layoutObject->isOutOfFlowPositioned() && layoutObject->isBox()) { 236 if (layoutObject->isOutOfFlowPositioned() && layoutObject->isBox()) {
229 // For fixed and absolute positioned elements, the top, left, bottom , and right 237 // For fixed and absolute positioned elements, the top, left, bottom , and right
230 // are defined relative to the corresponding sides of the containing block. 238 // are defined relative to the corresponding sides of the containing block.
(...skipping 22 matching lines...) Expand all
253 (layoutBox->offsetHeight() + clientOffset.height()); 261 (layoutBox->offsetHeight() + clientOffset.height());
254 break; 262 break;
255 default: 263 default:
256 ASSERT_NOT_REACHED(); 264 ASSERT_NOT_REACHED();
257 } 265 }
258 return zoomAdjustedPixelValue(position, style); 266 return zoomAdjustedPixelValue(position, style);
259 } 267 }
260 } 268 }
261 269
262 if (offset.isAuto()) 270 if (offset.isAuto())
263 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 271 return CSSIdentifierValue::createIdentifier(CSSValueAuto);
264 272
265 return zoomAdjustedPixelValueForLength(offset, style); 273 return zoomAdjustedPixelValueForLength(offset, style);
266 } 274 }
267 275
268 static CSSBorderImageSliceValue* valueForNinePieceImageSlice(const NinePieceImag e& image) 276 static CSSBorderImageSliceValue* valueForNinePieceImageSlice(const NinePieceImag e& image)
269 { 277 {
270 // Create the slices. 278 // Create the slices.
271 CSSPrimitiveValue* top = nullptr; 279 CSSPrimitiveValue* top = nullptr;
272 CSSPrimitiveValue* right = nullptr; 280 CSSPrimitiveValue* right = nullptr;
273 CSSPrimitiveValue* bottom = nullptr; 281 CSSPrimitiveValue* bottom = nullptr;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 left = CSSPrimitiveValue::create(image.imageSlices().left(). value(), CSSPrimitiveValue::UnitType::Percentage); 314 left = CSSPrimitiveValue::create(image.imageSlices().left(). value(), CSSPrimitiveValue::UnitType::Percentage);
307 else 315 else
308 left = CSSPrimitiveValue::create(image.imageSlices().left(). value(), CSSPrimitiveValue::UnitType::Number); 316 left = CSSPrimitiveValue::create(image.imageSlices().left(). value(), CSSPrimitiveValue::UnitType::Number);
309 } 317 }
310 } 318 }
311 } 319 }
312 320
313 return CSSBorderImageSliceValue::create(CSSQuadValue::create(top, right, bot tom, left, CSSQuadValue::SerializeAsQuad), image.fill()); 321 return CSSBorderImageSliceValue::create(CSSQuadValue::create(top, right, bot tom, left, CSSQuadValue::SerializeAsQuad), image.fill());
314 } 322 }
315 323
316 static CSSPrimitiveValue* valueForBorderImageLength(const BorderImageLength& bor derImageLength, const ComputedStyle& style) 324 static CSSValue* valueForBorderImageLength(const BorderImageLength& borderImageL ength, const ComputedStyle& style)
317 { 325 {
318 if (borderImageLength.isNumber()) 326 if (borderImageLength.isNumber())
319 return CSSPrimitiveValue::create(borderImageLength.number(), CSSPrimitiv eValue::UnitType::Number); 327 return CSSPrimitiveValue::create(borderImageLength.number(), CSSPrimitiv eValue::UnitType::Number);
320 return CSSPrimitiveValue::create(borderImageLength.length(), style.effective Zoom()); 328 return CSSValue::create(borderImageLength.length(), style.effectiveZoom());
321 } 329 }
322 330
323 static CSSQuadValue* valueForNinePieceImageQuad(const BorderImageLengthBox& box, const ComputedStyle& style) 331 static CSSQuadValue* valueForNinePieceImageQuad(const BorderImageLengthBox& box, const ComputedStyle& style)
324 { 332 {
325 // Create the slices. 333 // Create the slices.
326 CSSPrimitiveValue* top = nullptr; 334 CSSValue* top = nullptr;
327 CSSPrimitiveValue* right = nullptr; 335 CSSValue* right = nullptr;
328 CSSPrimitiveValue* bottom = nullptr; 336 CSSValue* bottom = nullptr;
329 CSSPrimitiveValue* left = nullptr; 337 CSSValue* left = nullptr;
330 338
331 top = valueForBorderImageLength(box.top(), style); 339 top = valueForBorderImageLength(box.top(), style);
332 340
333 if (box.right() == box.top() && box.bottom() == box.top() && box.left() == b ox.top()) { 341 if (box.right() == box.top() && box.bottom() == box.top() && box.left() == b ox.top()) {
334 right = top; 342 right = top;
335 bottom = top; 343 bottom = top;
336 left = top; 344 left = top;
337 } else { 345 } else {
338 right = valueForBorderImageLength(box.right(), style); 346 right = valueForBorderImageLength(box.right(), style);
339 347
(...skipping 21 matching lines...) Expand all
361 return CSSValueRound; 369 return CSSValueRound;
362 case SpaceImageRule: 370 case SpaceImageRule:
363 return CSSValueSpace; 371 return CSSValueSpace;
364 default: 372 default:
365 return CSSValueStretch; 373 return CSSValueStretch;
366 } 374 }
367 } 375 }
368 376
369 static CSSValue* valueForNinePieceImageRepeat(const NinePieceImage& image) 377 static CSSValue* valueForNinePieceImageRepeat(const NinePieceImage& image)
370 { 378 {
371 CSSPrimitiveValue* horizontalRepeat = nullptr; 379 CSSIdentifierValue* horizontalRepeat = nullptr;
372 CSSPrimitiveValue* verticalRepeat = nullptr; 380 CSSIdentifierValue* verticalRepeat = nullptr;
373 381
374 horizontalRepeat = CSSPrimitiveValue::createIdentifier(valueForRepeatRule(im age.horizontalRule())); 382 horizontalRepeat = CSSIdentifierValue::createIdentifier(valueForRepeatRule(i mage.horizontalRule()));
375 if (image.horizontalRule() == image.verticalRule()) 383 if (image.horizontalRule() == image.verticalRule())
376 verticalRepeat = horizontalRepeat; 384 verticalRepeat = horizontalRepeat;
377 else 385 else
378 verticalRepeat = CSSPrimitiveValue::createIdentifier(valueForRepeatRule( image.verticalRule())); 386 verticalRepeat = CSSIdentifierValue::createIdentifier(valueForRepeatRule (image.verticalRule()));
379 return CSSValuePair::create(horizontalRepeat, verticalRepeat, CSSValuePair:: DropIdenticalValues); 387 return CSSValuePair::create(horizontalRepeat, verticalRepeat, CSSValuePair:: DropIdenticalValues);
380 } 388 }
381 389
382 static CSSValue* valueForNinePieceImage(const NinePieceImage& image, const Compu tedStyle& style) 390 static CSSValue* valueForNinePieceImage(const NinePieceImage& image, const Compu tedStyle& style)
383 { 391 {
384 if (!image.hasImage()) 392 if (!image.hasImage())
385 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 393 return CSSIdentifierValue::createIdentifier(CSSValueNone);
386 394
387 // Image first. 395 // Image first.
388 CSSValue* imageValue = nullptr; 396 CSSValue* imageValue = nullptr;
389 if (image.image()) 397 if (image.image())
390 imageValue = image.image()->computedCSSValue(); 398 imageValue = image.image()->computedCSSValue();
391 399
392 // Create the image slice. 400 // Create the image slice.
393 CSSBorderImageSliceValue* imageSlices = valueForNinePieceImageSlice(image); 401 CSSBorderImageSliceValue* imageSlices = valueForNinePieceImageSlice(image);
394 402
395 // Create the border area slices. 403 // Create the border area slices.
396 CSSValue* borderSlices = valueForNinePieceImageQuad(image.borderSlices(), st yle); 404 CSSValue* borderSlices = valueForNinePieceImageQuad(image.borderSlices(), st yle);
397 405
398 // Create the border outset. 406 // Create the border outset.
399 CSSValue* outset = valueForNinePieceImageQuad(image.outset(), style); 407 CSSValue* outset = valueForNinePieceImageQuad(image.outset(), style);
400 408
401 // Create the repeat rules. 409 // Create the repeat rules.
402 CSSValue* repeat = valueForNinePieceImageRepeat(image); 410 CSSValue* repeat = valueForNinePieceImageRepeat(image);
403 411
404 return createBorderImageValue(imageValue, imageSlices, borderSlices, outset, repeat); 412 return createBorderImageValue(imageValue, imageSlices, borderSlices, outset, repeat);
405 } 413 }
406 414
407 static CSSValue* valueForReflection(const StyleReflection* reflection, const Com putedStyle& style) 415 static CSSValue* valueForReflection(const StyleReflection* reflection, const Com putedStyle& style)
408 { 416 {
409 if (!reflection) 417 if (!reflection)
410 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 418 return CSSIdentifierValue::createIdentifier(CSSValueNone);
411 419
412 CSSPrimitiveValue* offset = nullptr; 420 CSSPrimitiveValue* offset = nullptr;
413 // TODO(alancutter): Make this work correctly for calc lengths. 421 // TODO(alancutter): Make this work correctly for calc lengths.
414 if (reflection->offset().isPercentOrCalc()) 422 if (reflection->offset().isPercentOrCalc())
415 offset = CSSPrimitiveValue::create(reflection->offset().percent(), CSSPr imitiveValue::UnitType::Percentage); 423 offset = CSSPrimitiveValue::create(reflection->offset().percent(), CSSPr imitiveValue::UnitType::Percentage);
416 else 424 else
417 offset = zoomAdjustedPixelValue(reflection->offset().value(), style); 425 offset = zoomAdjustedPixelValue(reflection->offset().value(), style);
418 426
419 CSSPrimitiveValue* direction = nullptr; 427 CSSIdentifierValue* direction = nullptr;
420 switch (reflection->direction()) { 428 switch (reflection->direction()) {
421 case ReflectionBelow: 429 case ReflectionBelow:
422 direction = CSSPrimitiveValue::createIdentifier(CSSValueBelow); 430 direction = CSSIdentifierValue::createIdentifier(CSSValueBelow);
423 break; 431 break;
424 case ReflectionAbove: 432 case ReflectionAbove:
425 direction = CSSPrimitiveValue::createIdentifier(CSSValueAbove); 433 direction = CSSIdentifierValue::createIdentifier(CSSValueAbove);
426 break; 434 break;
427 case ReflectionLeft: 435 case ReflectionLeft:
428 direction = CSSPrimitiveValue::createIdentifier(CSSValueLeft); 436 direction = CSSIdentifierValue::createIdentifier(CSSValueLeft);
429 break; 437 break;
430 case ReflectionRight: 438 case ReflectionRight:
431 direction = CSSPrimitiveValue::createIdentifier(CSSValueRight); 439 direction = CSSIdentifierValue::createIdentifier(CSSValueRight);
432 break; 440 break;
433 } 441 }
434 442
435 return CSSReflectValue::create(direction, offset, valueForNinePieceImage(ref lection->mask(), style)); 443 return CSSReflectValue::create(direction, offset, valueForNinePieceImage(ref lection->mask(), style));
436 } 444 }
437 445
438 static CSSValueList* valueForItemPositionWithOverflowAlignment(const StyleSelfAl ignmentData& data) 446 static CSSValueList* valueForItemPositionWithOverflowAlignment(const StyleSelfAl ignmentData& data)
439 { 447 {
440 CSSValueList* result = CSSValueList::createSpaceSeparated(); 448 CSSValueList* result = CSSValueList::createSpaceSeparated();
441 if (data.positionType() == LegacyPosition) 449 if (data.positionType() == LegacyPosition)
442 result->append(*CSSPrimitiveValue::createIdentifier(CSSValueLegacy)); 450 result->append(*CSSIdentifierValue::createIdentifier(CSSValueLegacy));
443 // To avoid needing to copy the RareNonInheritedData, we repurpose the 'auto ' flag to not just mean 'auto' prior to running the StyleAdjuster but also mean 'normal' after running it. 451 // To avoid needing to copy the RareNonInheritedData, we repurpose the 'auto ' flag to not just mean 'auto' prior to running the StyleAdjuster but also mean 'normal' after running it.
444 result->append(*CSSPrimitiveValue::create(data.position() == ItemPositionAut o ? ComputedStyle::initialDefaultAlignment().position() : data.position())); 452 result->append(*CSSIdentifierValue::create(data.position() == ItemPositionAu to ? ComputedStyle::initialDefaultAlignment().position() : data.position()));
445 if (data.position() >= ItemPositionCenter && data.overflow() != OverflowAlig nmentDefault) 453 if (data.position() >= ItemPositionCenter && data.overflow() != OverflowAlig nmentDefault)
446 result->append(*CSSPrimitiveValue::create(data.overflow())); 454 result->append(*CSSIdentifierValue::create(data.overflow()));
447 ASSERT(result->length() <= 2); 455 ASSERT(result->length() <= 2);
448 return result; 456 return result;
449 } 457 }
450 458
451 static CSSValueList* valuesForGridShorthand(const StylePropertyShorthand& shorth and, const ComputedStyle& style, const LayoutObject* layoutObject, Node* styledN ode, bool allowVisitedStyle) 459 static CSSValueList* valuesForGridShorthand(const StylePropertyShorthand& shorth and, const ComputedStyle& style, const LayoutObject* layoutObject, Node* styledN ode, bool allowVisitedStyle)
452 { 460 {
453 CSSValueList* list = CSSValueList::createSlashSeparated(); 461 CSSValueList* list = CSSValueList::createSlashSeparated();
454 for (size_t i = 0; i < shorthand.length(); ++i) { 462 for (size_t i = 0; i < shorthand.length(); ++i) {
455 const CSSValue* value = ComputedStyleCSSValueMapping::get(shorthand.prop erties()[i], style, layoutObject, styledNode, allowVisitedStyle); 463 const CSSValue* value = ComputedStyleCSSValueMapping::get(shorthand.prop erties()[i], style, layoutObject, styledNode, allowVisitedStyle);
456 ASSERT(value); 464 ASSERT(value);
457 list->append(*value); 465 list->append(*value);
458 } 466 }
459 return list; 467 return list;
460 } 468 }
461 469
462 static CSSValueList* valuesForShorthandProperty(const StylePropertyShorthand& sh orthand, const ComputedStyle& style, const LayoutObject* layoutObject, Node* sty ledNode, bool allowVisitedStyle) 470 static CSSValueList* valuesForShorthandProperty(const StylePropertyShorthand& sh orthand, const ComputedStyle& style, const LayoutObject* layoutObject, Node* sty ledNode, bool allowVisitedStyle)
463 { 471 {
464 CSSValueList* list = CSSValueList::createSpaceSeparated(); 472 CSSValueList* list = CSSValueList::createSpaceSeparated();
465 for (size_t i = 0; i < shorthand.length(); ++i) { 473 for (size_t i = 0; i < shorthand.length(); ++i) {
466 const CSSValue* value = ComputedStyleCSSValueMapping::get(shorthand.prop erties()[i], style, layoutObject, styledNode, allowVisitedStyle); 474 const CSSValue* value = ComputedStyleCSSValueMapping::get(shorthand.prop erties()[i], style, layoutObject, styledNode, allowVisitedStyle);
467 ASSERT(value); 475 ASSERT(value);
468 list->append(*value); 476 list->append(*value);
469 } 477 }
470 return list; 478 return list;
471 } 479 }
472 480
473 static CSSValue* expandNoneLigaturesValue() 481 static CSSValue* expandNoneLigaturesValue()
474 { 482 {
475 CSSValueList* list = CSSValueList::createSpaceSeparated(); 483 CSSValueList* list = CSSValueList::createSpaceSeparated();
476 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueNoCommonLigatures) ); 484 list->append(*CSSIdentifierValue::createIdentifier(CSSValueNoCommonLigatures ));
477 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueNoDiscretionaryLig atures)); 485 list->append(*CSSIdentifierValue::createIdentifier(CSSValueNoDiscretionaryLi gatures));
478 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueNoHistoricalLigatu res)); 486 list->append(*CSSIdentifierValue::createIdentifier(CSSValueNoHistoricalLigat ures));
479 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueNoContextual)); 487 list->append(*CSSIdentifierValue::createIdentifier(CSSValueNoContextual));
480 return list; 488 return list;
481 } 489 }
482 490
483 static CSSValue* valuesForFontVariantProperty(const ComputedStyle& style, const LayoutObject* layoutObject, Node* styledNode, bool allowVisitedStyle) 491 static CSSValue* valuesForFontVariantProperty(const ComputedStyle& style, const LayoutObject* layoutObject, Node* styledNode, bool allowVisitedStyle)
484 { 492 {
485 enum VariantShorthandCases { AllNormal, NoneLigatures, ConcatenateNonNormal }; 493 enum VariantShorthandCases { AllNormal, NoneLigatures, ConcatenateNonNormal };
486 VariantShorthandCases shorthandCase = AllNormal; 494 VariantShorthandCases shorthandCase = AllNormal;
487 for (size_t i = 0; i < fontVariantShorthand().length(); ++i) { 495 for (size_t i = 0; i < fontVariantShorthand().length(); ++i) {
488 const CSSValue* value = ComputedStyleCSSValueMapping::get(fontVariantSho rthand().properties()[i], style, layoutObject, styledNode, allowVisitedStyle); 496 const CSSValue* value = ComputedStyleCSSValueMapping::get(fontVariantSho rthand().properties()[i], style, layoutObject, styledNode, allowVisitedStyle);
489 497
490 if (shorthandCase == AllNormal 498 if (shorthandCase == AllNormal
491 && value->isPrimitiveValue() 499 && value->isIdentifierValue()
492 && toCSSPrimitiveValue(value)->getValueID() == CSSValueNone 500 && toCSSIdentifierValue(value)->getValueID() == CSSValueNone
493 && fontVariantShorthand().properties()[i] == CSSPropertyFontVariantL igatures) { 501 && fontVariantShorthand().properties()[i] == CSSPropertyFontVariantL igatures) {
494 shorthandCase = NoneLigatures; 502 shorthandCase = NoneLigatures;
495 } else if (!(value->isPrimitiveValue() && toCSSPrimitiveValue(value)->ge tValueID() == CSSValueNormal)) { 503 } else if (!(value->isIdentifierValue() && toCSSIdentifierValue(value)-> getValueID() == CSSValueNormal)) {
496 shorthandCase = ConcatenateNonNormal; 504 shorthandCase = ConcatenateNonNormal;
497 break; 505 break;
498 } 506 }
499 } 507 }
500 508
501 switch (shorthandCase) { 509 switch (shorthandCase) {
502 case AllNormal: 510 case AllNormal:
503 return CSSPrimitiveValue::createIdentifier(CSSValueNormal); 511 return CSSIdentifierValue::createIdentifier(CSSValueNormal);
504 case NoneLigatures: 512 case NoneLigatures:
505 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 513 return CSSIdentifierValue::createIdentifier(CSSValueNone);
506 case ConcatenateNonNormal: 514 case ConcatenateNonNormal:
507 { 515 {
508 CSSValueList* list = CSSValueList::createSpaceSeparated(); 516 CSSValueList* list = CSSValueList::createSpaceSeparated();
509 for (size_t i = 0; i < fontVariantShorthand().length(); ++i) { 517 for (size_t i = 0; i < fontVariantShorthand().length(); ++i) {
510 const CSSValue* value = ComputedStyleCSSValueMapping::get(fontVarian tShorthand().properties()[i], style, layoutObject, styledNode, allowVisitedStyle ); 518 const CSSValue* value = ComputedStyleCSSValueMapping::get(fontVarian tShorthand().properties()[i], style, layoutObject, styledNode, allowVisitedStyle );
511 ASSERT(value); 519 ASSERT(value);
512 if (value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValu eID() == CSSValueNone) { 520 if (value->isIdentifierValue() && toCSSIdentifierValue(value)->getVa lueID() == CSSValueNone) {
513 list->append(*expandNoneLigaturesValue()); 521 list->append(*expandNoneLigaturesValue());
514 } else if (!(value->isPrimitiveValue() && toCSSPrimitiveValue(value) ->getValueID() == CSSValueNormal)) { 522 } else if (!(value->isIdentifierValue() && toCSSIdentifierValue(valu e)->getValueID() == CSSValueNormal)) {
515 list->append(*value); 523 list->append(*value);
516 } 524 }
517 } 525 }
518 return list; 526 return list;
519 } 527 }
520 default: 528 default:
521 NOTREACHED(); 529 NOTREACHED();
522 return nullptr; 530 return nullptr;
523 } 531 }
524 } 532 }
525 533
526 static CSSValueList* valuesForBackgroundShorthand(const ComputedStyle& style, co nst LayoutObject* layoutObject, Node* styledNode, bool allowVisitedStyle) 534 static CSSValueList* valuesForBackgroundShorthand(const ComputedStyle& style, co nst LayoutObject* layoutObject, Node* styledNode, bool allowVisitedStyle)
527 { 535 {
528 CSSValueList* ret = CSSValueList::createCommaSeparated(); 536 CSSValueList* ret = CSSValueList::createCommaSeparated();
529 const FillLayer* currLayer = &style.backgroundLayers(); 537 const FillLayer* currLayer = &style.backgroundLayers();
530 for (; currLayer; currLayer = currLayer->next()) { 538 for (; currLayer; currLayer = currLayer->next()) {
531 CSSValueList* list = CSSValueList::createSlashSeparated(); 539 CSSValueList* list = CSSValueList::createSlashSeparated();
532 CSSValueList* beforeSlash = CSSValueList::createSpaceSeparated(); 540 CSSValueList* beforeSlash = CSSValueList::createSpaceSeparated();
533 if (!currLayer->next()) { // color only for final layer 541 if (!currLayer->next()) { // color only for final layer
534 const CSSValue* value = ComputedStyleCSSValueMapping::get(CSSPropert yBackgroundColor, style, layoutObject, styledNode, allowVisitedStyle); 542 const CSSValue* value = ComputedStyleCSSValueMapping::get(CSSPropert yBackgroundColor, style, layoutObject, styledNode, allowVisitedStyle);
535 ASSERT(value); 543 ASSERT(value);
536 beforeSlash->append(*value); 544 beforeSlash->append(*value);
537 } 545 }
538 beforeSlash->append(currLayer->image() ? *currLayer->image()->computedCS SValue() : *CSSPrimitiveValue::createIdentifier(CSSValueNone)); 546 beforeSlash->append(currLayer->image() ? *currLayer->image()->computedCS SValue() : *CSSIdentifierValue::createIdentifier(CSSValueNone));
539 beforeSlash->append(*valueForFillRepeat(currLayer->repeatX(), currLayer- >repeatY())); 547 beforeSlash->append(*valueForFillRepeat(currLayer->repeatX(), currLayer- >repeatY()));
540 beforeSlash->append(*CSSPrimitiveValue::create(currLayer->attachment())) ; 548 beforeSlash->append(*CSSIdentifierValue::create(currLayer->attachment()) );
541 beforeSlash->append(*createPositionListForLayer(CSSPropertyBackgroundPos ition, *currLayer, style)); 549 beforeSlash->append(*createPositionListForLayer(CSSPropertyBackgroundPos ition, *currLayer, style));
542 list->append(*beforeSlash); 550 list->append(*beforeSlash);
543 CSSValueList* afterSlash = CSSValueList::createSpaceSeparated(); 551 CSSValueList* afterSlash = CSSValueList::createSpaceSeparated();
544 afterSlash->append(*valueForFillSize(currLayer->size(), style)); 552 afterSlash->append(*valueForFillSize(currLayer->size(), style));
545 afterSlash->append(*CSSPrimitiveValue::create(currLayer->origin())); 553 afterSlash->append(*CSSIdentifierValue::create(currLayer->origin()));
546 afterSlash->append(*CSSPrimitiveValue::create(currLayer->clip())); 554 afterSlash->append(*CSSIdentifierValue::create(currLayer->clip()));
547 list->append(*afterSlash); 555 list->append(*afterSlash);
548 ret->append(*list); 556 ret->append(*list);
549 } 557 }
550 return ret; 558 return ret;
551 } 559 }
552 560
553 static CSSValueList* valueForContentPositionAndDistributionWithOverflowAlignment (const StyleContentAlignmentData& data) 561 static CSSValueList* valueForContentPositionAndDistributionWithOverflowAlignment (const StyleContentAlignmentData& data)
554 { 562 {
555 CSSValueList* result = CSSValueList::createSpaceSeparated(); 563 CSSValueList* result = CSSValueList::createSpaceSeparated();
556 if (data.distribution() != ContentDistributionDefault) 564 if (data.distribution() != ContentDistributionDefault)
557 result->append(*CSSPrimitiveValue::create(data.distribution())); 565 result->append(*CSSIdentifierValue::create(data.distribution()));
558 if (data.distribution() == ContentDistributionDefault || data.position() != ContentPositionNormal) 566 if (data.distribution() == ContentDistributionDefault || data.position() != ContentPositionNormal)
559 result->append(*CSSPrimitiveValue::create(data.position())); 567 result->append(*CSSIdentifierValue::create(data.position()));
560 if ((data.position() >= ContentPositionCenter || data.distribution() != Cont entDistributionDefault) && data.overflow() != OverflowAlignmentDefault) 568 if ((data.position() >= ContentPositionCenter || data.distribution() != Cont entDistributionDefault) && data.overflow() != OverflowAlignmentDefault)
561 result->append(*CSSPrimitiveValue::create(data.overflow())); 569 result->append(*CSSIdentifierValue::create(data.overflow()));
562 ASSERT(result->length() > 0); 570 ASSERT(result->length() > 0);
563 ASSERT(result->length() <= 3); 571 ASSERT(result->length() <= 3);
564 return result; 572 return result;
565 } 573 }
566 574
567 static CSSPrimitiveValue* valueForLineHeight(const ComputedStyle& style) 575 static CSSValue* valueForLineHeight(const ComputedStyle& style)
568 { 576 {
569 Length length = style.lineHeight(); 577 Length length = style.lineHeight();
570 if (length.isNegative()) 578 if (length.isNegative())
571 return CSSPrimitiveValue::createIdentifier(CSSValueNormal); 579 return CSSIdentifierValue::createIdentifier(CSSValueNormal);
572 580
573 return zoomAdjustedPixelValue(floatValueForLength(length, style.getFontDescr iption().computedSize()), style); 581 return zoomAdjustedPixelValue(floatValueForLength(length, style.getFontDescr iption().computedSize()), style);
574 } 582 }
575 583
576 static CSSValueID identifierForFamily(const AtomicString& family) 584 static CSSValueID identifierForFamily(const AtomicString& family)
577 { 585 {
578 if (family == FontFamilyNames::webkit_cursive) 586 if (family == FontFamilyNames::webkit_cursive)
579 return CSSValueCursive; 587 return CSSValueCursive;
580 if (family == FontFamilyNames::webkit_fantasy) 588 if (family == FontFamilyNames::webkit_fantasy)
581 return CSSValueFantasy; 589 return CSSValueFantasy;
582 if (family == FontFamilyNames::webkit_monospace) 590 if (family == FontFamilyNames::webkit_monospace)
583 return CSSValueMonospace; 591 return CSSValueMonospace;
584 if (family == FontFamilyNames::webkit_pictograph) 592 if (family == FontFamilyNames::webkit_pictograph)
585 return CSSValueWebkitPictograph; 593 return CSSValueWebkitPictograph;
586 if (family == FontFamilyNames::webkit_sans_serif) 594 if (family == FontFamilyNames::webkit_sans_serif)
587 return CSSValueSansSerif; 595 return CSSValueSansSerif;
588 if (family == FontFamilyNames::webkit_serif) 596 if (family == FontFamilyNames::webkit_serif)
589 return CSSValueSerif; 597 return CSSValueSerif;
590 return CSSValueInvalid; 598 return CSSValueInvalid;
591 } 599 }
592 600
593 static CSSValue* valueForFamily(const AtomicString& family) 601 static CSSValue* valueForFamily(const AtomicString& family)
594 { 602 {
595 if (CSSValueID familyIdentifier = identifierForFamily(family)) 603 if (CSSValueID familyIdentifier = identifierForFamily(family))
596 return CSSPrimitiveValue::createIdentifier(familyIdentifier); 604 return CSSIdentifierValue::createIdentifier(familyIdentifier);
597 return CSSFontFamilyValue::create(family.getString()); 605 return CSSFontFamilyValue::create(family.getString());
598 } 606 }
599 607
600 static CSSValueList* valueForFontFamily(const ComputedStyle& style) 608 static CSSValueList* valueForFontFamily(const ComputedStyle& style)
601 { 609 {
602 const FontFamily& firstFamily = style.getFontDescription().family(); 610 const FontFamily& firstFamily = style.getFontDescription().family();
603 CSSValueList* list = CSSValueList::createCommaSeparated(); 611 CSSValueList* list = CSSValueList::createCommaSeparated();
604 for (const FontFamily* family = &firstFamily; family; family = family->next( )) 612 for (const FontFamily* family = &firstFamily; family; family = family->next( ))
605 list->append(*valueForFamily(family->family())); 613 list->append(*valueForFamily(family->family()));
606 return list; 614 return list;
607 } 615 }
608 616
609 static CSSPrimitiveValue* valueForFontSize(const ComputedStyle& style) 617 static CSSPrimitiveValue* valueForFontSize(const ComputedStyle& style)
610 { 618 {
611 return zoomAdjustedPixelValue(style.getFontDescription().computedSize(), sty le); 619 return zoomAdjustedPixelValue(style.getFontDescription().computedSize(), sty le);
612 } 620 }
613 621
614 static CSSPrimitiveValue* valueForFontStretch(const ComputedStyle& style) 622 static CSSIdentifierValue* valueForFontStretch(const ComputedStyle& style)
615 { 623 {
616 return CSSPrimitiveValue::create(style.getFontDescription().stretch()); 624 return CSSIdentifierValue::create(style.getFontDescription().stretch());
617 } 625 }
618 626
619 static CSSPrimitiveValue* valueForFontStyle(const ComputedStyle& style) 627 static CSSIdentifierValue* valueForFontStyle(const ComputedStyle& style)
620 { 628 {
621 return CSSPrimitiveValue::create(style.getFontDescription().style()); 629 return CSSIdentifierValue::create(style.getFontDescription().style());
622 } 630 }
623 631
624 static CSSPrimitiveValue* valueForFontWeight(const ComputedStyle& style) 632 static CSSIdentifierValue* valueForFontWeight(const ComputedStyle& style)
625 { 633 {
626 return CSSPrimitiveValue::create(style.getFontDescription().weight()); 634 return CSSIdentifierValue::create(style.getFontDescription().weight());
627 } 635 }
628 636
629 static CSSPrimitiveValue* valueForFontVariantCaps(const ComputedStyle& style) 637 static CSSIdentifierValue* valueForFontVariantCaps(const ComputedStyle& style)
630 { 638 {
631 FontDescription::FontVariantCaps variantCaps = style.getFontDescription().va riantCaps(); 639 FontDescription::FontVariantCaps variantCaps = style.getFontDescription().va riantCaps();
632 switch (variantCaps) { 640 switch (variantCaps) {
633 case FontDescription::CapsNormal: 641 case FontDescription::CapsNormal:
634 return CSSPrimitiveValue::createIdentifier(CSSValueNormal); 642 return CSSIdentifierValue::createIdentifier(CSSValueNormal);
635 case FontDescription::SmallCaps: 643 case FontDescription::SmallCaps:
636 return CSSPrimitiveValue::createIdentifier(CSSValueSmallCaps); 644 return CSSIdentifierValue::createIdentifier(CSSValueSmallCaps);
637 case FontDescription::AllSmallCaps: 645 case FontDescription::AllSmallCaps:
638 return CSSPrimitiveValue::createIdentifier(CSSValueAllSmallCaps); 646 return CSSIdentifierValue::createIdentifier(CSSValueAllSmallCaps);
639 case FontDescription::PetiteCaps: 647 case FontDescription::PetiteCaps:
640 return CSSPrimitiveValue::createIdentifier(CSSValuePetiteCaps); 648 return CSSIdentifierValue::createIdentifier(CSSValuePetiteCaps);
641 case FontDescription::AllPetiteCaps: 649 case FontDescription::AllPetiteCaps:
642 return CSSPrimitiveValue::createIdentifier(CSSValueAllPetiteCaps); 650 return CSSIdentifierValue::createIdentifier(CSSValueAllPetiteCaps);
643 case FontDescription::Unicase: 651 case FontDescription::Unicase:
644 return CSSPrimitiveValue::createIdentifier(CSSValueUnicase); 652 return CSSIdentifierValue::createIdentifier(CSSValueUnicase);
645 case FontDescription::TitlingCaps: 653 case FontDescription::TitlingCaps:
646 return CSSPrimitiveValue::createIdentifier(CSSValueTitlingCaps); 654 return CSSIdentifierValue::createIdentifier(CSSValueTitlingCaps);
647 default: 655 default:
648 NOTREACHED(); 656 NOTREACHED();
649 return nullptr; 657 return nullptr;
650 } 658 }
651 } 659 }
652 660
653 static CSSValue* valueForFontVariantLigatures(const ComputedStyle& style) 661 static CSSValue* valueForFontVariantLigatures(const ComputedStyle& style)
654 { 662 {
655 FontDescription::LigaturesState commonLigaturesState = style.getFontDescript ion().commonLigaturesState(); 663 FontDescription::LigaturesState commonLigaturesState = style.getFontDescript ion().commonLigaturesState();
656 FontDescription::LigaturesState discretionaryLigaturesState = style.getFontD escription().discretionaryLigaturesState(); 664 FontDescription::LigaturesState discretionaryLigaturesState = style.getFontD escription().discretionaryLigaturesState();
657 FontDescription::LigaturesState historicalLigaturesState = style.getFontDesc ription().historicalLigaturesState(); 665 FontDescription::LigaturesState historicalLigaturesState = style.getFontDesc ription().historicalLigaturesState();
658 FontDescription::LigaturesState contextualLigaturesState = style.getFontDesc ription().contextualLigaturesState(); 666 FontDescription::LigaturesState contextualLigaturesState = style.getFontDesc ription().contextualLigaturesState();
659 if (commonLigaturesState == FontDescription::NormalLigaturesState && discret ionaryLigaturesState == FontDescription::NormalLigaturesState 667 if (commonLigaturesState == FontDescription::NormalLigaturesState && discret ionaryLigaturesState == FontDescription::NormalLigaturesState
660 && historicalLigaturesState == FontDescription::NormalLigaturesState && contextualLigaturesState == FontDescription::NormalLigaturesState) 668 && historicalLigaturesState == FontDescription::NormalLigaturesState && contextualLigaturesState == FontDescription::NormalLigaturesState)
661 return CSSPrimitiveValue::createIdentifier(CSSValueNormal); 669 return CSSIdentifierValue::createIdentifier(CSSValueNormal);
662 670
663 if (commonLigaturesState == FontDescription::DisabledLigaturesState && discr etionaryLigaturesState == FontDescription::DisabledLigaturesState 671 if (commonLigaturesState == FontDescription::DisabledLigaturesState && discr etionaryLigaturesState == FontDescription::DisabledLigaturesState
664 && historicalLigaturesState == FontDescription::DisabledLigaturesState & & contextualLigaturesState == FontDescription::DisabledLigaturesState) 672 && historicalLigaturesState == FontDescription::DisabledLigaturesState & & contextualLigaturesState == FontDescription::DisabledLigaturesState)
665 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 673 return CSSIdentifierValue::createIdentifier(CSSValueNone);
666 674
667 CSSValueList* valueList = CSSValueList::createSpaceSeparated(); 675 CSSValueList* valueList = CSSValueList::createSpaceSeparated();
668 if (commonLigaturesState != FontDescription::NormalLigaturesState) 676 if (commonLigaturesState != FontDescription::NormalLigaturesState)
669 valueList->append(*CSSPrimitiveValue::createIdentifier(commonLigaturesSt ate == FontDescription::DisabledLigaturesState ? CSSValueNoCommonLigatures : CSS ValueCommonLigatures)); 677 valueList->append(*CSSIdentifierValue::createIdentifier(commonLigaturesS tate == FontDescription::DisabledLigaturesState ? CSSValueNoCommonLigatures : CS SValueCommonLigatures));
670 if (discretionaryLigaturesState != FontDescription::NormalLigaturesState) 678 if (discretionaryLigaturesState != FontDescription::NormalLigaturesState)
671 valueList->append(*CSSPrimitiveValue::createIdentifier(discretionaryLiga turesState == FontDescription::DisabledLigaturesState ? CSSValueNoDiscretionaryL igatures : CSSValueDiscretionaryLigatures)); 679 valueList->append(*CSSIdentifierValue::createIdentifier(discretionaryLig aturesState == FontDescription::DisabledLigaturesState ? CSSValueNoDiscretionary Ligatures : CSSValueDiscretionaryLigatures));
672 if (historicalLigaturesState != FontDescription::NormalLigaturesState) 680 if (historicalLigaturesState != FontDescription::NormalLigaturesState)
673 valueList->append(*CSSPrimitiveValue::createIdentifier(historicalLigatur esState == FontDescription::DisabledLigaturesState ? CSSValueNoHistoricalLigatur es : CSSValueHistoricalLigatures)); 681 valueList->append(*CSSIdentifierValue::createIdentifier(historicalLigatu resState == FontDescription::DisabledLigaturesState ? CSSValueNoHistoricalLigatu res : CSSValueHistoricalLigatures));
674 if (contextualLigaturesState != FontDescription::NormalLigaturesState) 682 if (contextualLigaturesState != FontDescription::NormalLigaturesState)
675 valueList->append(*CSSPrimitiveValue::createIdentifier(contextualLigatur esState == FontDescription::DisabledLigaturesState ? CSSValueNoContextual : CSSV alueContextual)); 683 valueList->append(*CSSIdentifierValue::createIdentifier(contextualLigatu resState == FontDescription::DisabledLigaturesState ? CSSValueNoContextual : CSS ValueContextual));
676 return valueList; 684 return valueList;
677 } 685 }
678 686
679 static CSSValue* valueForFontVariantNumeric(const ComputedStyle& style) 687 static CSSValue* valueForFontVariantNumeric(const ComputedStyle& style)
680 { 688 {
681 FontVariantNumeric variantNumeric = style.getFontDescription().variantNumeri c(); 689 FontVariantNumeric variantNumeric = style.getFontDescription().variantNumeri c();
682 if (variantNumeric.isAllNormal()) 690 if (variantNumeric.isAllNormal())
683 return CSSPrimitiveValue::createIdentifier(CSSValueNormal); 691 return CSSIdentifierValue::createIdentifier(CSSValueNormal);
684 692
685 CSSValueList* valueList = CSSValueList::createSpaceSeparated(); 693 CSSValueList* valueList = CSSValueList::createSpaceSeparated();
686 if (variantNumeric.numericFigureValue() != FontVariantNumeric::NormalFigure) 694 if (variantNumeric.numericFigureValue() != FontVariantNumeric::NormalFigure)
687 valueList->append(*CSSPrimitiveValue::createIdentifier(variantNumeric.nu mericFigureValue() == FontVariantNumeric::LiningNums ? CSSValueLiningNums : CSSV alueOldstyleNums)); 695 valueList->append(*CSSIdentifierValue::createIdentifier(variantNumeric.n umericFigureValue() == FontVariantNumeric::LiningNums ? CSSValueLiningNums : CSS ValueOldstyleNums));
688 if (variantNumeric.numericSpacingValue() != FontVariantNumeric::NormalSpacin g) 696 if (variantNumeric.numericSpacingValue() != FontVariantNumeric::NormalSpacin g)
689 valueList->append(*CSSPrimitiveValue::createIdentifier(variantNumeric.nu mericSpacingValue() == FontVariantNumeric::ProportionalNums ? CSSValueProportion alNums : CSSValueTabularNums)); 697 valueList->append(*CSSIdentifierValue::createIdentifier(variantNumeric.n umericSpacingValue() == FontVariantNumeric::ProportionalNums ? CSSValueProportio nalNums : CSSValueTabularNums));
690 if (variantNumeric.numericFractionValue() != FontVariantNumeric::NormalFract ion) 698 if (variantNumeric.numericFractionValue() != FontVariantNumeric::NormalFract ion)
691 valueList->append(*CSSPrimitiveValue::createIdentifier(variantNumeric.nu mericFractionValue() == FontVariantNumeric::DiagonalFractions ? CSSValueDiagonal Fractions : CSSValueStackedFractions)); 699 valueList->append(*CSSIdentifierValue::createIdentifier(variantNumeric.n umericFractionValue() == FontVariantNumeric::DiagonalFractions ? CSSValueDiagona lFractions : CSSValueStackedFractions));
692 if (variantNumeric.ordinalValue() == FontVariantNumeric::OrdinalOn) 700 if (variantNumeric.ordinalValue() == FontVariantNumeric::OrdinalOn)
693 valueList->append(*CSSPrimitiveValue::createIdentifier(CSSValueOrdinal)) ; 701 valueList->append(*CSSIdentifierValue::createIdentifier(CSSValueOrdinal) );
694 if (variantNumeric.slashedZeroValue() == FontVariantNumeric::SlashedZeroOn) 702 if (variantNumeric.slashedZeroValue() == FontVariantNumeric::SlashedZeroOn)
695 valueList->append(*CSSPrimitiveValue::createIdentifier(CSSValueSlashedZe ro)); 703 valueList->append(*CSSIdentifierValue::createIdentifier(CSSValueSlashedZ ero));
696 704
697 return valueList; 705 return valueList;
698 } 706 }
699 707
700 708
701 static CSSValue* specifiedValueForGridTrackBreadth(const GridLength& trackBreadt h, const ComputedStyle& style) 709 static CSSValue* specifiedValueForGridTrackBreadth(const GridLength& trackBreadt h, const ComputedStyle& style)
702 { 710 {
703 if (!trackBreadth.isLength()) 711 if (!trackBreadth.isLength())
704 return CSSPrimitiveValue::create(trackBreadth.flex(), CSSPrimitiveValue: :UnitType::Fraction); 712 return CSSPrimitiveValue::create(trackBreadth.flex(), CSSPrimitiveValue: :UnitType::Fraction);
705 713
706 const Length& trackBreadthLength = trackBreadth.length(); 714 const Length& trackBreadthLength = trackBreadth.length();
707 if (trackBreadthLength.isAuto()) 715 if (trackBreadthLength.isAuto())
708 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 716 return CSSIdentifierValue::createIdentifier(CSSValueAuto);
709 return zoomAdjustedPixelValueForLength(trackBreadthLength, style); 717 return zoomAdjustedPixelValueForLength(trackBreadthLength, style);
710 } 718 }
711 719
712 static CSSValue* specifiedValueForGridTrackSize(const GridTrackSize& trackSize, const ComputedStyle& style) 720 static CSSValue* specifiedValueForGridTrackSize(const GridTrackSize& trackSize, const ComputedStyle& style)
713 { 721 {
714 switch (trackSize.type()) { 722 switch (trackSize.type()) {
715 case LengthTrackSizing: 723 case LengthTrackSizing:
716 return specifiedValueForGridTrackBreadth(trackSize.minTrackBreadth(), st yle); 724 return specifiedValueForGridTrackBreadth(trackSize.minTrackBreadth(), st yle);
717 case MinMaxTrackSizing: { 725 case MinMaxTrackSizing: {
718 auto* minMaxTrackBreadths = CSSFunctionValue::create(CSSValueMinmax); 726 auto* minMaxTrackBreadths = CSSFunctionValue::create(CSSValueMinmax);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 // Handle the 'none' case. 840 // Handle the 'none' case.
833 bool trackListIsEmpty = trackSizes.isEmpty() && autoRepeatTrackSizes.isEmpty (); 841 bool trackListIsEmpty = trackSizes.isEmpty() && autoRepeatTrackSizes.isEmpty ();
834 if (isLayoutGrid && trackListIsEmpty) { 842 if (isLayoutGrid && trackListIsEmpty) {
835 // For grids we should consider every listed track, whether implicitly o r explicitly 843 // For grids we should consider every listed track, whether implicitly o r explicitly
836 // created. Empty grids have a sole grid line per axis. 844 // created. Empty grids have a sole grid line per axis.
837 auto& positions = isRowAxis ? toLayoutGrid(layoutObject)->columnPosition s() : toLayoutGrid(layoutObject)->rowPositions(); 845 auto& positions = isRowAxis ? toLayoutGrid(layoutObject)->columnPosition s() : toLayoutGrid(layoutObject)->rowPositions();
838 trackListIsEmpty = positions.size() == 1; 846 trackListIsEmpty = positions.size() == 1;
839 } 847 }
840 848
841 if (trackListIsEmpty) 849 if (trackListIsEmpty)
842 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 850 return CSSIdentifierValue::createIdentifier(CSSValueNone);
843 851
844 size_t autoRepeatTotalTracks = isLayoutGrid ? toLayoutGrid(layoutObject)->au toRepeatCountForDirection(direction) : 0; 852 size_t autoRepeatTotalTracks = isLayoutGrid ? toLayoutGrid(layoutObject)->au toRepeatCountForDirection(direction) : 0;
845 OrderedNamedLinesCollector collector(style, isRowAxis, autoRepeatTotalTracks ); 853 OrderedNamedLinesCollector collector(style, isRowAxis, autoRepeatTotalTracks );
846 CSSValueList* list = CSSValueList::createSpaceSeparated(); 854 CSSValueList* list = CSSValueList::createSpaceSeparated();
847 size_t insertionIndex; 855 size_t insertionIndex;
848 if (isLayoutGrid) { 856 if (isLayoutGrid) {
849 const auto* grid = toLayoutGrid(layoutObject); 857 const auto* grid = toLayoutGrid(layoutObject);
850 Vector<LayoutUnit> computedTrackSizes = grid->trackSizesForComputedStyle (direction); 858 Vector<LayoutUnit> computedTrackSizes = grid->trackSizesForComputedStyle (direction);
851 size_t numTracks = computedTrackSizes.size(); 859 size_t numTracks = computedTrackSizes.size();
852 860
(...skipping 12 matching lines...) Expand all
865 insertionIndex = trackSizes.size(); 873 insertionIndex = trackSizes.size();
866 } 874 }
867 // Those are the trailing <string>* allowed in the syntax. 875 // Those are the trailing <string>* allowed in the syntax.
868 addValuesForNamedGridLinesAtIndex(collector, insertionIndex, *list); 876 addValuesForNamedGridLinesAtIndex(collector, insertionIndex, *list);
869 return list; 877 return list;
870 } 878 }
871 879
872 static CSSValue* valueForGridPosition(const GridPosition& position) 880 static CSSValue* valueForGridPosition(const GridPosition& position)
873 { 881 {
874 if (position.isAuto()) 882 if (position.isAuto())
875 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 883 return CSSIdentifierValue::createIdentifier(CSSValueAuto);
876 884
877 if (position.isNamedGridArea()) 885 if (position.isNamedGridArea())
878 return CSSCustomIdentValue::create(position.namedGridLine()); 886 return CSSCustomIdentValue::create(position.namedGridLine());
879 887
880 CSSValueList* list = CSSValueList::createSpaceSeparated(); 888 CSSValueList* list = CSSValueList::createSpaceSeparated();
881 if (position.isSpan()) { 889 if (position.isSpan()) {
882 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueSpan)); 890 list->append(*CSSIdentifierValue::createIdentifier(CSSValueSpan));
883 list->append(*CSSPrimitiveValue::create(position.spanPosition(), CSSPrim itiveValue::UnitType::Number)); 891 list->append(*CSSPrimitiveValue::create(position.spanPosition(), CSSPrim itiveValue::UnitType::Number));
884 } else { 892 } else {
885 list->append(*CSSPrimitiveValue::create(position.integerPosition(), CSSP rimitiveValue::UnitType::Number)); 893 list->append(*CSSPrimitiveValue::create(position.integerPosition(), CSSP rimitiveValue::UnitType::Number));
886 } 894 }
887 895
888 if (!position.namedGridLine().isNull()) 896 if (!position.namedGridLine().isNull())
889 list->append(*CSSCustomIdentValue::create(position.namedGridLine())); 897 list->append(*CSSCustomIdentValue::create(position.namedGridLine()));
890 return list; 898 return list;
891 } 899 }
892 900
893 static LayoutRect sizingBox(const LayoutObject* layoutObject) 901 static LayoutRect sizingBox(const LayoutObject* layoutObject)
894 { 902 {
895 if (!layoutObject->isBox()) 903 if (!layoutObject->isBox())
896 return LayoutRect(); 904 return LayoutRect();
897 905
898 const LayoutBox* box = toLayoutBox(layoutObject); 906 const LayoutBox* box = toLayoutBox(layoutObject);
899 return box->style()->boxSizing() == BoxSizingBorderBox ? box->borderBoxRect( ) : box->computedCSSContentBoxRect(); 907 return box->style()->boxSizing() == BoxSizingBorderBox ? box->borderBoxRect( ) : box->computedCSSContentBoxRect();
900 } 908 }
901 909
902 static CSSValue* renderTextDecorationFlagsToCSSValue(int textDecoration) 910 static CSSValue* renderTextDecorationFlagsToCSSValue(int textDecoration)
903 { 911 {
904 // Blink value is ignored. 912 // Blink value is ignored.
905 CSSValueList* list = CSSValueList::createSpaceSeparated(); 913 CSSValueList* list = CSSValueList::createSpaceSeparated();
906 if (textDecoration & TextDecorationUnderline) 914 if (textDecoration & TextDecorationUnderline)
907 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueUnderline)); 915 list->append(*CSSIdentifierValue::createIdentifier(CSSValueUnderline));
908 if (textDecoration & TextDecorationOverline) 916 if (textDecoration & TextDecorationOverline)
909 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueOverline)); 917 list->append(*CSSIdentifierValue::createIdentifier(CSSValueOverline));
910 if (textDecoration & TextDecorationLineThrough) 918 if (textDecoration & TextDecorationLineThrough)
911 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueLineThrough)); 919 list->append(*CSSIdentifierValue::createIdentifier(CSSValueLineThrough)) ;
912 920
913 if (!list->length()) 921 if (!list->length())
914 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 922 return CSSIdentifierValue::createIdentifier(CSSValueNone);
915 return list; 923 return list;
916 } 924 }
917 925
918 static CSSValue* valueForTextDecorationStyle(TextDecorationStyle textDecorationS tyle) 926 static CSSValue* valueForTextDecorationStyle(TextDecorationStyle textDecorationS tyle)
919 { 927 {
920 switch (textDecorationStyle) { 928 switch (textDecorationStyle) {
921 case TextDecorationStyleSolid: 929 case TextDecorationStyleSolid:
922 return CSSPrimitiveValue::createIdentifier(CSSValueSolid); 930 return CSSIdentifierValue::createIdentifier(CSSValueSolid);
923 case TextDecorationStyleDouble: 931 case TextDecorationStyleDouble:
924 return CSSPrimitiveValue::createIdentifier(CSSValueDouble); 932 return CSSIdentifierValue::createIdentifier(CSSValueDouble);
925 case TextDecorationStyleDotted: 933 case TextDecorationStyleDotted:
926 return CSSPrimitiveValue::createIdentifier(CSSValueDotted); 934 return CSSIdentifierValue::createIdentifier(CSSValueDotted);
927 case TextDecorationStyleDashed: 935 case TextDecorationStyleDashed:
928 return CSSPrimitiveValue::createIdentifier(CSSValueDashed); 936 return CSSIdentifierValue::createIdentifier(CSSValueDashed);
929 case TextDecorationStyleWavy: 937 case TextDecorationStyleWavy:
930 return CSSPrimitiveValue::createIdentifier(CSSValueWavy); 938 return CSSIdentifierValue::createIdentifier(CSSValueWavy);
931 } 939 }
932 940
933 ASSERT_NOT_REACHED(); 941 ASSERT_NOT_REACHED();
934 return CSSInitialValue::create(); 942 return CSSInitialValue::create();
935 } 943 }
936 944
937 static CSSValue* touchActionFlagsToCSSValue(TouchAction touchAction) 945 static CSSValue* touchActionFlagsToCSSValue(TouchAction touchAction)
938 { 946 {
939 CSSValueList* list = CSSValueList::createSpaceSeparated(); 947 CSSValueList* list = CSSValueList::createSpaceSeparated();
940 if (touchAction == TouchActionAuto) { 948 if (touchAction == TouchActionAuto) {
941 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueAuto)); 949 list->append(*CSSIdentifierValue::createIdentifier(CSSValueAuto));
942 } else if (touchAction == TouchActionNone) { 950 } else if (touchAction == TouchActionNone) {
943 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueNone)); 951 list->append(*CSSIdentifierValue::createIdentifier(CSSValueNone));
944 } else if (touchAction == TouchActionManipulation) { 952 } else if (touchAction == TouchActionManipulation) {
945 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueManipulation)) ; 953 list->append(*CSSIdentifierValue::createIdentifier(CSSValueManipulation) );
946 } else { 954 } else {
947 if ((touchAction & TouchActionPanX) == TouchActionPanX) 955 if ((touchAction & TouchActionPanX) == TouchActionPanX)
948 list->append(*CSSPrimitiveValue::createIdentifier(CSSValuePanX)); 956 list->append(*CSSIdentifierValue::createIdentifier(CSSValuePanX));
949 else if (touchAction & TouchActionPanLeft) 957 else if (touchAction & TouchActionPanLeft)
950 list->append(*CSSPrimitiveValue::createIdentifier(CSSValuePanLeft)); 958 list->append(*CSSIdentifierValue::createIdentifier(CSSValuePanLeft)) ;
951 else if (touchAction & TouchActionPanRight) 959 else if (touchAction & TouchActionPanRight)
952 list->append(*CSSPrimitiveValue::createIdentifier(CSSValuePanRight)) ; 960 list->append(*CSSIdentifierValue::createIdentifier(CSSValuePanRight) );
953 961
954 if ((touchAction & TouchActionPanY) == TouchActionPanY) 962 if ((touchAction & TouchActionPanY) == TouchActionPanY)
955 list->append(*CSSPrimitiveValue::createIdentifier(CSSValuePanY)); 963 list->append(*CSSIdentifierValue::createIdentifier(CSSValuePanY));
956 else if (touchAction & TouchActionPanUp) 964 else if (touchAction & TouchActionPanUp)
957 list->append(*CSSPrimitiveValue::createIdentifier(CSSValuePanUp)); 965 list->append(*CSSIdentifierValue::createIdentifier(CSSValuePanUp));
958 else if (touchAction & TouchActionPanDown) 966 else if (touchAction & TouchActionPanDown)
959 list->append(*CSSPrimitiveValue::createIdentifier(CSSValuePanDown)); 967 list->append(*CSSIdentifierValue::createIdentifier(CSSValuePanDown)) ;
960 } 968 }
961 ASSERT(list->length()); 969 ASSERT(list->length());
962 return list; 970 return list;
963 } 971 }
964 972
965 static CSSValue* valueForWillChange(const Vector<CSSPropertyID>& willChangePrope rties, bool willChangeContents, bool willChangeScrollPosition) 973 static CSSValue* valueForWillChange(const Vector<CSSPropertyID>& willChangePrope rties, bool willChangeContents, bool willChangeScrollPosition)
966 { 974 {
967 CSSValueList* list = CSSValueList::createCommaSeparated(); 975 CSSValueList* list = CSSValueList::createCommaSeparated();
968 if (willChangeContents) 976 if (willChangeContents)
969 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueContents)); 977 list->append(*CSSIdentifierValue::createIdentifier(CSSValueContents));
970 if (willChangeScrollPosition) 978 if (willChangeScrollPosition)
971 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueScrollPosition )); 979 list->append(*CSSIdentifierValue::createIdentifier(CSSValueScrollPositio n));
972 for (size_t i = 0; i < willChangeProperties.size(); ++i) 980 for (size_t i = 0; i < willChangeProperties.size(); ++i)
973 list->append(*CSSCustomIdentValue::create(willChangeProperties[i])); 981 list->append(*CSSCustomIdentValue::create(willChangeProperties[i]));
974 if (!list->length()) 982 if (!list->length())
975 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueAuto)); 983 list->append(*CSSIdentifierValue::createIdentifier(CSSValueAuto));
976 return list; 984 return list;
977 } 985 }
978 986
979 static CSSValue* valueForAnimationDelay(const CSSTimingData* timingData) 987 static CSSValue* valueForAnimationDelay(const CSSTimingData* timingData)
980 { 988 {
981 CSSValueList* list = CSSValueList::createCommaSeparated(); 989 CSSValueList* list = CSSValueList::createCommaSeparated();
982 if (timingData) { 990 if (timingData) {
983 for (size_t i = 0; i < timingData->delayList().size(); ++i) 991 for (size_t i = 0; i < timingData->delayList().size(); ++i)
984 list->append(*CSSPrimitiveValue::create(timingData->delayList()[i], CSSPrimitiveValue::UnitType::Seconds)); 992 list->append(*CSSPrimitiveValue::create(timingData->delayList()[i], CSSPrimitiveValue::UnitType::Seconds));
985 } else { 993 } else {
986 list->append(*CSSPrimitiveValue::create(CSSTimingData::initialDelay(), C SSPrimitiveValue::UnitType::Seconds)); 994 list->append(*CSSPrimitiveValue::create(CSSTimingData::initialDelay(), C SSPrimitiveValue::UnitType::Seconds));
987 } 995 }
988 return list; 996 return list;
989 } 997 }
990 998
991 static CSSValue* valueForAnimationDirection(Timing::PlaybackDirection direction) 999 static CSSValue* valueForAnimationDirection(Timing::PlaybackDirection direction)
992 { 1000 {
993 switch (direction) { 1001 switch (direction) {
994 case Timing::PlaybackDirection::NORMAL: 1002 case Timing::PlaybackDirection::NORMAL:
995 return CSSPrimitiveValue::createIdentifier(CSSValueNormal); 1003 return CSSIdentifierValue::createIdentifier(CSSValueNormal);
996 case Timing::PlaybackDirection::ALTERNATE_NORMAL: 1004 case Timing::PlaybackDirection::ALTERNATE_NORMAL:
997 return CSSPrimitiveValue::createIdentifier(CSSValueAlternate); 1005 return CSSIdentifierValue::createIdentifier(CSSValueAlternate);
998 case Timing::PlaybackDirection::REVERSE: 1006 case Timing::PlaybackDirection::REVERSE:
999 return CSSPrimitiveValue::createIdentifier(CSSValueReverse); 1007 return CSSIdentifierValue::createIdentifier(CSSValueReverse);
1000 case Timing::PlaybackDirection::ALTERNATE_REVERSE: 1008 case Timing::PlaybackDirection::ALTERNATE_REVERSE:
1001 return CSSPrimitiveValue::createIdentifier(CSSValueAlternateReverse); 1009 return CSSIdentifierValue::createIdentifier(CSSValueAlternateReverse);
1002 default: 1010 default:
1003 ASSERT_NOT_REACHED(); 1011 ASSERT_NOT_REACHED();
1004 return nullptr; 1012 return nullptr;
1005 } 1013 }
1006 } 1014 }
1007 1015
1008 static CSSValue* valueForAnimationDuration(const CSSTimingData* timingData) 1016 static CSSValue* valueForAnimationDuration(const CSSTimingData* timingData)
1009 { 1017 {
1010 CSSValueList* list = CSSValueList::createCommaSeparated(); 1018 CSSValueList* list = CSSValueList::createCommaSeparated();
1011 if (timingData) { 1019 if (timingData) {
1012 for (size_t i = 0; i < timingData->durationList().size(); ++i) 1020 for (size_t i = 0; i < timingData->durationList().size(); ++i)
1013 list->append(*CSSPrimitiveValue::create(timingData->durationList()[i ], CSSPrimitiveValue::UnitType::Seconds)); 1021 list->append(*CSSPrimitiveValue::create(timingData->durationList()[i ], CSSPrimitiveValue::UnitType::Seconds));
1014 } else { 1022 } else {
1015 list->append(*CSSPrimitiveValue::create(CSSTimingData::initialDuration() , CSSPrimitiveValue::UnitType::Seconds)); 1023 list->append(*CSSPrimitiveValue::create(CSSTimingData::initialDuration() , CSSPrimitiveValue::UnitType::Seconds));
1016 } 1024 }
1017 return list; 1025 return list;
1018 } 1026 }
1019 1027
1020 static CSSValue* valueForAnimationFillMode(Timing::FillMode fillMode) 1028 static CSSValue* valueForAnimationFillMode(Timing::FillMode fillMode)
1021 { 1029 {
1022 switch (fillMode) { 1030 switch (fillMode) {
1023 case Timing::FillMode::NONE: 1031 case Timing::FillMode::NONE:
1024 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 1032 return CSSIdentifierValue::createIdentifier(CSSValueNone);
1025 case Timing::FillMode::FORWARDS: 1033 case Timing::FillMode::FORWARDS:
1026 return CSSPrimitiveValue::createIdentifier(CSSValueForwards); 1034 return CSSIdentifierValue::createIdentifier(CSSValueForwards);
1027 case Timing::FillMode::BACKWARDS: 1035 case Timing::FillMode::BACKWARDS:
1028 return CSSPrimitiveValue::createIdentifier(CSSValueBackwards); 1036 return CSSIdentifierValue::createIdentifier(CSSValueBackwards);
1029 case Timing::FillMode::BOTH: 1037 case Timing::FillMode::BOTH:
1030 return CSSPrimitiveValue::createIdentifier(CSSValueBoth); 1038 return CSSIdentifierValue::createIdentifier(CSSValueBoth);
1031 default: 1039 default:
1032 ASSERT_NOT_REACHED(); 1040 ASSERT_NOT_REACHED();
1033 return nullptr; 1041 return nullptr;
1034 } 1042 }
1035 } 1043 }
1036 1044
1037 static CSSValue* valueForAnimationIterationCount(double iterationCount) 1045 static CSSValue* valueForAnimationIterationCount(double iterationCount)
1038 { 1046 {
1039 if (iterationCount == std::numeric_limits<double>::infinity()) 1047 if (iterationCount == std::numeric_limits<double>::infinity())
1040 return CSSPrimitiveValue::createIdentifier(CSSValueInfinite); 1048 return CSSIdentifierValue::createIdentifier(CSSValueInfinite);
1041 return CSSPrimitiveValue::create(iterationCount, CSSPrimitiveValue::UnitType ::Number); 1049 return CSSPrimitiveValue::create(iterationCount, CSSPrimitiveValue::UnitType ::Number);
1042 } 1050 }
1043 1051
1044 static CSSValue* valueForAnimationPlayState(EAnimPlayState playState) 1052 static CSSValue* valueForAnimationPlayState(EAnimPlayState playState)
1045 { 1053 {
1046 if (playState == AnimPlayStatePlaying) 1054 if (playState == AnimPlayStatePlaying)
1047 return CSSPrimitiveValue::createIdentifier(CSSValueRunning); 1055 return CSSIdentifierValue::createIdentifier(CSSValueRunning);
1048 ASSERT(playState == AnimPlayStatePaused); 1056 ASSERT(playState == AnimPlayStatePaused);
1049 return CSSPrimitiveValue::createIdentifier(CSSValuePaused); 1057 return CSSIdentifierValue::createIdentifier(CSSValuePaused);
1050 } 1058 }
1051 1059
1052 static CSSValue* createTimingFunctionValue(const TimingFunction* timingFunction) 1060 static CSSValue* createTimingFunctionValue(const TimingFunction* timingFunction)
1053 { 1061 {
1054 switch (timingFunction->getType()) { 1062 switch (timingFunction->getType()) {
1055 case TimingFunction::Type::CUBIC_BEZIER: 1063 case TimingFunction::Type::CUBIC_BEZIER:
1056 { 1064 {
1057 const CubicBezierTimingFunction* bezierTimingFunction = toCubicBezie rTimingFunction(timingFunction); 1065 const CubicBezierTimingFunction* bezierTimingFunction = toCubicBezie rTimingFunction(timingFunction);
1058 if (bezierTimingFunction->getEaseType() != CubicBezierTimingFunction ::EaseType::CUSTOM) { 1066 if (bezierTimingFunction->getEaseType() != CubicBezierTimingFunction ::EaseType::CUSTOM) {
1059 CSSValueID valueId = CSSValueInvalid; 1067 CSSValueID valueId = CSSValueInvalid;
1060 switch (bezierTimingFunction->getEaseType()) { 1068 switch (bezierTimingFunction->getEaseType()) {
1061 case CubicBezierTimingFunction::EaseType::EASE: 1069 case CubicBezierTimingFunction::EaseType::EASE:
1062 valueId = CSSValueEase; 1070 valueId = CSSValueEase;
1063 break; 1071 break;
1064 case CubicBezierTimingFunction::EaseType::EASE_IN: 1072 case CubicBezierTimingFunction::EaseType::EASE_IN:
1065 valueId = CSSValueEaseIn; 1073 valueId = CSSValueEaseIn;
1066 break; 1074 break;
1067 case CubicBezierTimingFunction::EaseType::EASE_OUT: 1075 case CubicBezierTimingFunction::EaseType::EASE_OUT:
1068 valueId = CSSValueEaseOut; 1076 valueId = CSSValueEaseOut;
1069 break; 1077 break;
1070 case CubicBezierTimingFunction::EaseType::EASE_IN_OUT: 1078 case CubicBezierTimingFunction::EaseType::EASE_IN_OUT:
1071 valueId = CSSValueEaseInOut; 1079 valueId = CSSValueEaseInOut;
1072 break; 1080 break;
1073 default: 1081 default:
1074 ASSERT_NOT_REACHED(); 1082 ASSERT_NOT_REACHED();
1075 return nullptr; 1083 return nullptr;
1076 } 1084 }
1077 return CSSPrimitiveValue::createIdentifier(valueId); 1085 return CSSIdentifierValue::createIdentifier(valueId);
1078 } 1086 }
1079 return CSSCubicBezierTimingFunctionValue::create(bezierTimingFunctio n->x1(), bezierTimingFunction->y1(), bezierTimingFunction->x2(), bezierTimingFun ction->y2()); 1087 return CSSCubicBezierTimingFunctionValue::create(bezierTimingFunctio n->x1(), bezierTimingFunction->y1(), bezierTimingFunction->x2(), bezierTimingFun ction->y2());
1080 } 1088 }
1081 1089
1082 case TimingFunction::Type::STEPS: 1090 case TimingFunction::Type::STEPS:
1083 { 1091 {
1084 const StepsTimingFunction* stepsTimingFunction = toStepsTimingFuncti on(timingFunction); 1092 const StepsTimingFunction* stepsTimingFunction = toStepsTimingFuncti on(timingFunction);
1085 StepsTimingFunction::StepPosition position = stepsTimingFunction->ge tStepPosition(); 1093 StepsTimingFunction::StepPosition position = stepsTimingFunction->ge tStepPosition();
1086 int steps = stepsTimingFunction->numberOfSteps(); 1094 int steps = stepsTimingFunction->numberOfSteps();
1087 DCHECK(position == StepsTimingFunction::StepPosition::START || posit ion == StepsTimingFunction::StepPosition::END); 1095 DCHECK(position == StepsTimingFunction::StepPosition::START || posit ion == StepsTimingFunction::StepPosition::END);
1088 1096
1089 if (steps > 1) 1097 if (steps > 1)
1090 return CSSStepsTimingFunctionValue::create(steps, position); 1098 return CSSStepsTimingFunctionValue::create(steps, position);
1091 CSSValueID valueId = position == StepsTimingFunction::StepPosition:: START ? CSSValueStepStart : CSSValueStepEnd; 1099 CSSValueID valueId = position == StepsTimingFunction::StepPosition:: START ? CSSValueStepStart : CSSValueStepEnd;
1092 return CSSPrimitiveValue::createIdentifier(valueId); 1100 return CSSIdentifierValue::createIdentifier(valueId);
1093 } 1101 }
1094 1102
1095 default: 1103 default:
1096 return CSSPrimitiveValue::createIdentifier(CSSValueLinear); 1104 return CSSIdentifierValue::createIdentifier(CSSValueLinear);
1097 } 1105 }
1098 } 1106 }
1099 1107
1100 static CSSValue* valueForAnimationTimingFunction(const CSSTimingData* timingData ) 1108 static CSSValue* valueForAnimationTimingFunction(const CSSTimingData* timingData )
1101 { 1109 {
1102 CSSValueList* list = CSSValueList::createCommaSeparated(); 1110 CSSValueList* list = CSSValueList::createCommaSeparated();
1103 if (timingData) { 1111 if (timingData) {
1104 for (size_t i = 0; i < timingData->timingFunctionList().size(); ++i) 1112 for (size_t i = 0; i < timingData->timingFunctionList().size(); ++i)
1105 list->append(*createTimingFunctionValue(timingData->timingFunctionLi st()[i].get())); 1113 list->append(*createTimingFunctionValue(timingData->timingFunctionLi st()[i].get()));
1106 } else { 1114 } else {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 transformValue->append(*zoomAdjustedNumberValue(transform.m43(), style)) ; 1174 transformValue->append(*zoomAdjustedNumberValue(transform.m43(), style)) ;
1167 transformValue->append(*CSSPrimitiveValue::create(transform.m44(), CSSPr imitiveValue::UnitType::Number)); 1175 transformValue->append(*CSSPrimitiveValue::create(transform.m44(), CSSPr imitiveValue::UnitType::Number));
1168 } 1176 }
1169 1177
1170 return transformValue; 1178 return transformValue;
1171 } 1179 }
1172 1180
1173 static CSSValue* computedTransform(const LayoutObject* layoutObject, const Compu tedStyle& style) 1181 static CSSValue* computedTransform(const LayoutObject* layoutObject, const Compu tedStyle& style)
1174 { 1182 {
1175 if (!layoutObject || !style.hasTransform()) 1183 if (!layoutObject || !style.hasTransform())
1176 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 1184 return CSSIdentifierValue::createIdentifier(CSSValueNone);
1177 1185
1178 IntRect box; 1186 IntRect box;
1179 if (layoutObject->isBox()) 1187 if (layoutObject->isBox())
1180 box = pixelSnappedIntRect(toLayoutBox(layoutObject)->borderBoxRect()); 1188 box = pixelSnappedIntRect(toLayoutBox(layoutObject)->borderBoxRect());
1181 1189
1182 TransformationMatrix transform; 1190 TransformationMatrix transform;
1183 style.applyTransform(transform, LayoutSize(box.size()), ComputedStyle::Exclu deTransformOrigin, ComputedStyle::ExcludeMotionPath, ComputedStyle::ExcludeIndep endentTransformProperties); 1191 style.applyTransform(transform, LayoutSize(box.size()), ComputedStyle::Exclu deTransformOrigin, ComputedStyle::ExcludeMotionPath, ComputedStyle::ExcludeIndep endentTransformProperties);
1184 1192
1185 // FIXME: Need to print out individual functions (https://bugs.webkit.org/sh ow_bug.cgi?id=23924) 1193 // FIXME: Need to print out individual functions (https://bugs.webkit.org/sh ow_bug.cgi?id=23924)
1186 CSSValueList* list = CSSValueList::createSpaceSeparated(); 1194 CSSValueList* list = CSSValueList::createSpaceSeparated();
1187 list->append(*valueForMatrixTransform(transform, style)); 1195 list->append(*valueForMatrixTransform(transform, style));
1188 1196
1189 return list; 1197 return list;
1190 } 1198 }
1191 1199
1192 static CSSValue* createTransitionPropertyValue(const CSSTransitionData::Transiti onProperty& property) 1200 static CSSValue* createTransitionPropertyValue(const CSSTransitionData::Transiti onProperty& property)
1193 { 1201 {
1194 if (property.propertyType == CSSTransitionData::TransitionNone) 1202 if (property.propertyType == CSSTransitionData::TransitionNone)
1195 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 1203 return CSSIdentifierValue::createIdentifier(CSSValueNone);
1196 if (property.propertyType == CSSTransitionData::TransitionUnknownProperty) 1204 if (property.propertyType == CSSTransitionData::TransitionUnknownProperty)
1197 return CSSCustomIdentValue::create(property.propertyString); 1205 return CSSCustomIdentValue::create(property.propertyString);
1198 ASSERT(property.propertyType == CSSTransitionData::TransitionKnownProperty); 1206 ASSERT(property.propertyType == CSSTransitionData::TransitionKnownProperty);
1199 return CSSCustomIdentValue::create(getPropertyNameAtomicString(property.unre solvedProperty)); 1207 return CSSCustomIdentValue::create(getPropertyNameAtomicString(property.unre solvedProperty));
1200 } 1208 }
1201 1209
1202 static CSSValue* valueForTransitionProperty(const CSSTransitionData* transitionD ata) 1210 static CSSValue* valueForTransitionProperty(const CSSTransitionData* transitionD ata)
1203 { 1211 {
1204 CSSValueList* list = CSSValueList::createCommaSeparated(); 1212 CSSValueList* list = CSSValueList::createCommaSeparated();
1205 if (transitionData) { 1213 if (transitionData) {
1206 for (size_t i = 0; i < transitionData->propertyList().size(); ++i) 1214 for (size_t i = 0; i < transitionData->propertyList().size(); ++i)
1207 list->append(*createTransitionPropertyValue(transitionData->property List()[i])); 1215 list->append(*createTransitionPropertyValue(transitionData->property List()[i]));
1208 } else { 1216 } else {
1209 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueAll)); 1217 list->append(*CSSIdentifierValue::createIdentifier(CSSValueAll));
1210 } 1218 }
1211 return list; 1219 return list;
1212 } 1220 }
1213 1221
1214 CSSValueID valueForQuoteType(const QuoteType quoteType) 1222 CSSValueID valueForQuoteType(const QuoteType quoteType)
1215 { 1223 {
1216 switch (quoteType) { 1224 switch (quoteType) {
1217 case NO_OPEN_QUOTE: 1225 case NO_OPEN_QUOTE:
1218 return CSSValueNoOpenQuote; 1226 return CSSValueNoOpenQuote;
1219 case NO_CLOSE_QUOTE: 1227 case NO_CLOSE_QUOTE:
(...skipping 12 matching lines...) Expand all
1232 CSSValueList* list = CSSValueList::createSpaceSeparated(); 1240 CSSValueList* list = CSSValueList::createSpaceSeparated();
1233 for (const ContentData* contentData = style.contentData(); contentData; cont entData = contentData->next()) { 1241 for (const ContentData* contentData = style.contentData(); contentData; cont entData = contentData->next()) {
1234 if (contentData->isCounter()) { 1242 if (contentData->isCounter()) {
1235 const CounterContent* counter = toCounterContentData(contentData)->c ounter(); 1243 const CounterContent* counter = toCounterContentData(contentData)->c ounter();
1236 ASSERT(counter); 1244 ASSERT(counter);
1237 CSSCustomIdentValue* identifier = CSSCustomIdentValue::create(counte r->identifier()); 1245 CSSCustomIdentValue* identifier = CSSCustomIdentValue::create(counte r->identifier());
1238 CSSStringValue* separator = CSSStringValue::create(counter->separato r()); 1246 CSSStringValue* separator = CSSStringValue::create(counter->separato r());
1239 CSSValueID listStyleIdent = CSSValueNone; 1247 CSSValueID listStyleIdent = CSSValueNone;
1240 if (counter->listStyle() != NoneListStyle) 1248 if (counter->listStyle() != NoneListStyle)
1241 listStyleIdent = static_cast<CSSValueID>(CSSValueDisc + counter- >listStyle()); 1249 listStyleIdent = static_cast<CSSValueID>(CSSValueDisc + counter- >listStyle());
1242 CSSPrimitiveValue* listStyle = CSSPrimitiveValue::createIdentifier(l istStyleIdent); 1250 CSSIdentifierValue* listStyle = CSSIdentifierValue::createIdentifier (listStyleIdent);
1243 list->append(*CSSCounterValue::create(identifier, listStyle, separat or)); 1251 list->append(*CSSCounterValue::create(identifier, listStyle, separat or));
1244 } else if (contentData->isImage()) { 1252 } else if (contentData->isImage()) {
1245 const StyleImage* image = toImageContentData(contentData)->image(); 1253 const StyleImage* image = toImageContentData(contentData)->image();
1246 ASSERT(image); 1254 ASSERT(image);
1247 list->append(*image->computedCSSValue()); 1255 list->append(*image->computedCSSValue());
1248 } else if (contentData->isText()) { 1256 } else if (contentData->isText()) {
1249 list->append(*CSSStringValue::create(toTextContentData(contentData)- >text())); 1257 list->append(*CSSStringValue::create(toTextContentData(contentData)- >text()));
1250 } else if (contentData->isQuote()) { 1258 } else if (contentData->isQuote()) {
1251 const QuoteType quoteType = toQuoteContentData(contentData)->quote() ; 1259 const QuoteType quoteType = toQuoteContentData(contentData)->quote() ;
1252 list->append(*CSSPrimitiveValue::createIdentifier(valueForQuoteType( quoteType))); 1260 list->append(*CSSIdentifierValue::createIdentifier(valueForQuoteType (quoteType)));
1253 } else { 1261 } else {
1254 ASSERT_NOT_REACHED(); 1262 ASSERT_NOT_REACHED();
1255 } 1263 }
1256 } 1264 }
1257 return list; 1265 return list;
1258 } 1266 }
1259 1267
1260 static CSSValue* valueForCounterDirectives(const ComputedStyle& style, CSSProper tyID propertyID) 1268 static CSSValue* valueForCounterDirectives(const ComputedStyle& style, CSSProper tyID propertyID)
1261 { 1269 {
1262 const CounterDirectiveMap* map = style.counterDirectives(); 1270 const CounterDirectiveMap* map = style.counterDirectives();
1263 if (!map) 1271 if (!map)
1264 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 1272 return CSSIdentifierValue::createIdentifier(CSSValueNone);
1265 1273
1266 CSSValueList* list = CSSValueList::createSpaceSeparated(); 1274 CSSValueList* list = CSSValueList::createSpaceSeparated();
1267 for (const auto& item : *map) { 1275 for (const auto& item : *map) {
1268 bool isValidCounterValue = propertyID == CSSPropertyCounterIncrement ? i tem.value.isIncrement() : item.value.isReset(); 1276 bool isValidCounterValue = propertyID == CSSPropertyCounterIncrement ? i tem.value.isIncrement() : item.value.isReset();
1269 if (!isValidCounterValue) 1277 if (!isValidCounterValue)
1270 continue; 1278 continue;
1271 1279
1272 list->append(*CSSCustomIdentValue::create(item.key)); 1280 list->append(*CSSCustomIdentValue::create(item.key));
1273 short number = propertyID == CSSPropertyCounterIncrement ? item.value.in crementValue() : item.value.resetValue(); 1281 short number = propertyID == CSSPropertyCounterIncrement ? item.value.in crementValue() : item.value.resetValue();
1274 list->append(*CSSPrimitiveValue::create((double)number, CSSPrimitiveValu e::UnitType::Integer)); 1282 list->append(*CSSPrimitiveValue::create((double)number, CSSPrimitiveValu e::UnitType::Integer));
1275 } 1283 }
1276 1284
1277 if (!list->length()) 1285 if (!list->length())
1278 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 1286 return CSSIdentifierValue::createIdentifier(CSSValueNone);
1279 1287
1280 return list; 1288 return list;
1281 } 1289 }
1282 1290
1283 static CSSValue* valueForShape(const ComputedStyle& style, ShapeValue* shapeValu e) 1291 static CSSValue* valueForShape(const ComputedStyle& style, ShapeValue* shapeValu e)
1284 { 1292 {
1285 if (!shapeValue) 1293 if (!shapeValue)
1286 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 1294 return CSSIdentifierValue::createIdentifier(CSSValueNone);
1287 if (shapeValue->type() == ShapeValue::Box) 1295 if (shapeValue->type() == ShapeValue::Box)
1288 return CSSPrimitiveValue::create(shapeValue->cssBox()); 1296 return CSSIdentifierValue::create(shapeValue->cssBox());
1289 if (shapeValue->type() == ShapeValue::Image) { 1297 if (shapeValue->type() == ShapeValue::Image) {
1290 if (shapeValue->image()) 1298 if (shapeValue->image())
1291 return shapeValue->image()->computedCSSValue(); 1299 return shapeValue->image()->computedCSSValue();
1292 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 1300 return CSSIdentifierValue::createIdentifier(CSSValueNone);
1293 } 1301 }
1294 1302
1295 ASSERT(shapeValue->type() == ShapeValue::Shape); 1303 ASSERT(shapeValue->type() == ShapeValue::Shape);
1296 1304
1297 CSSValueList* list = CSSValueList::createSpaceSeparated(); 1305 CSSValueList* list = CSSValueList::createSpaceSeparated();
1298 list->append(*valueForBasicShape(style, shapeValue->shape())); 1306 list->append(*valueForBasicShape(style, shapeValue->shape()));
1299 if (shapeValue->cssBox() != BoxMissing) 1307 if (shapeValue->cssBox() != BoxMissing)
1300 list->append(*CSSPrimitiveValue::create(shapeValue->cssBox())); 1308 list->append(*CSSIdentifierValue::create(shapeValue->cssBox()));
1301 return list; 1309 return list;
1302 } 1310 }
1303 1311
1304 static CSSValueList* valuesForSidesShorthand(const StylePropertyShorthand& short hand, const ComputedStyle& style, const LayoutObject* layoutObject, Node* styled Node, bool allowVisitedStyle) 1312 static CSSValueList* valuesForSidesShorthand(const StylePropertyShorthand& short hand, const ComputedStyle& style, const LayoutObject* layoutObject, Node* styled Node, bool allowVisitedStyle)
1305 { 1313 {
1306 CSSValueList* list = CSSValueList::createSpaceSeparated(); 1314 CSSValueList* list = CSSValueList::createSpaceSeparated();
1307 // Assume the properties are in the usual order top, right, bottom, left. 1315 // Assume the properties are in the usual order top, right, bottom, left.
1308 const CSSValue* topValue = ComputedStyleCSSValueMapping::get(shorthand.prope rties()[0], style, layoutObject, styledNode, allowVisitedStyle); 1316 const CSSValue* topValue = ComputedStyleCSSValueMapping::get(shorthand.prope rties()[0], style, layoutObject, styledNode, allowVisitedStyle);
1309 const CSSValue* rightValue = ComputedStyleCSSValueMapping::get(shorthand.pro perties()[1], style, layoutObject, styledNode, allowVisitedStyle); 1317 const CSSValue* rightValue = ComputedStyleCSSValueMapping::get(shorthand.pro perties()[1], style, layoutObject, styledNode, allowVisitedStyle);
1310 const CSSValue* bottomValue = ComputedStyleCSSValueMapping::get(shorthand.pr operties()[2], style, layoutObject, styledNode, allowVisitedStyle); 1318 const CSSValue* bottomValue = ComputedStyleCSSValueMapping::get(shorthand.pr operties()[2], style, layoutObject, styledNode, allowVisitedStyle);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 1376
1369 if (!verticalRadii->equals(toCSSValueList(list->item(0)))) 1377 if (!verticalRadii->equals(toCSSValueList(list->item(0))))
1370 list->append(*verticalRadii); 1378 list->append(*verticalRadii);
1371 1379
1372 return list; 1380 return list;
1373 } 1381 }
1374 1382
1375 static CSSValue* strokeDashArrayToCSSValueList(const SVGDashArray& dashes, const ComputedStyle& style) 1383 static CSSValue* strokeDashArrayToCSSValueList(const SVGDashArray& dashes, const ComputedStyle& style)
1376 { 1384 {
1377 if (dashes.isEmpty()) 1385 if (dashes.isEmpty())
1378 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 1386 return CSSIdentifierValue::createIdentifier(CSSValueNone);
1379 1387
1380 CSSValueList* list = CSSValueList::createCommaSeparated(); 1388 CSSValueList* list = CSSValueList::createCommaSeparated();
1381 for (const Length& dashLength : dashes.vector()) 1389 for (const Length& dashLength : dashes.vector())
1382 list->append(*zoomAdjustedPixelValueForLength(dashLength, style)); 1390 list->append(*zoomAdjustedPixelValueForLength(dashLength, style));
1383 1391
1384 return list; 1392 return list;
1385 } 1393 }
1386 1394
1387 static CSSValue* paintOrderToCSSValueList(const SVGComputedStyle& svgStyle) 1395 static CSSValue* paintOrderToCSSValueList(const SVGComputedStyle& svgStyle)
1388 { 1396 {
1389 CSSValueList* list = CSSValueList::createSpaceSeparated(); 1397 CSSValueList* list = CSSValueList::createSpaceSeparated();
1390 for (int i = 0; i < 3; i++) { 1398 for (int i = 0; i < 3; i++) {
1391 EPaintOrderType paintOrderType = svgStyle.paintOrderType(i); 1399 EPaintOrderType paintOrderType = svgStyle.paintOrderType(i);
1392 switch (paintOrderType) { 1400 switch (paintOrderType) {
1393 case PT_FILL: 1401 case PT_FILL:
1394 case PT_STROKE: 1402 case PT_STROKE:
1395 case PT_MARKERS: 1403 case PT_MARKERS:
1396 list->append(*CSSPrimitiveValue::create(paintOrderType)); 1404 list->append(*CSSIdentifierValue::create(paintOrderType));
1397 break; 1405 break;
1398 case PT_NONE: 1406 case PT_NONE:
1399 default: 1407 default:
1400 ASSERT_NOT_REACHED(); 1408 ASSERT_NOT_REACHED();
1401 break; 1409 break;
1402 } 1410 }
1403 } 1411 }
1404 1412
1405 return list; 1413 return list;
1406 } 1414 }
1407 1415
1408 static CSSValue* adjustSVGPaintForCurrentColor(SVGPaintType paintType, const Str ing& url, const Color& color, const Color& currentColor) 1416 static CSSValue* adjustSVGPaintForCurrentColor(SVGPaintType paintType, const Str ing& url, const Color& color, const Color& currentColor)
1409 { 1417 {
1410 if (paintType >= SVG_PAINTTYPE_URI_NONE) { 1418 if (paintType >= SVG_PAINTTYPE_URI_NONE) {
1411 CSSValueList* values = CSSValueList::createSpaceSeparated(); 1419 CSSValueList* values = CSSValueList::createSpaceSeparated();
1412 values->append(*CSSURIValue::create(url)); 1420 values->append(*CSSURIValue::create(url));
1413 if (paintType == SVG_PAINTTYPE_URI_NONE) 1421 if (paintType == SVG_PAINTTYPE_URI_NONE)
1414 values->append(*CSSPrimitiveValue::createIdentifier(CSSValueNone)); 1422 values->append(*CSSIdentifierValue::createIdentifier(CSSValueNone));
1415 else if (paintType == SVG_PAINTTYPE_URI_CURRENTCOLOR) 1423 else if (paintType == SVG_PAINTTYPE_URI_CURRENTCOLOR)
1416 values->append(*CSSColorValue::create(currentColor.rgb())); 1424 values->append(*CSSColorValue::create(currentColor.rgb()));
1417 else if (paintType == SVG_PAINTTYPE_URI_RGBCOLOR) 1425 else if (paintType == SVG_PAINTTYPE_URI_RGBCOLOR)
1418 values->append(*CSSColorValue::create(color.rgb())); 1426 values->append(*CSSColorValue::create(color.rgb()));
1419 return values; 1427 return values;
1420 } 1428 }
1421 if (paintType == SVG_PAINTTYPE_NONE) 1429 if (paintType == SVG_PAINTTYPE_NONE)
1422 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 1430 return CSSIdentifierValue::createIdentifier(CSSValueNone);
1423 if (paintType == SVG_PAINTTYPE_CURRENTCOLOR) 1431 if (paintType == SVG_PAINTTYPE_CURRENTCOLOR)
1424 return CSSColorValue::create(currentColor.rgb()); 1432 return CSSColorValue::create(currentColor.rgb());
1425 1433
1426 return CSSColorValue::create(color.rgb()); 1434 return CSSColorValue::create(color.rgb());
1427 } 1435 }
1428 1436
1429 static inline String serializeAsFragmentIdentifier(const AtomicString& resource) 1437 static inline String serializeAsFragmentIdentifier(const AtomicString& resource)
1430 { 1438 {
1431 return "#" + resource; 1439 return "#" + resource;
1432 } 1440 }
1433 1441
1434 CSSValue* ComputedStyleCSSValueMapping::valueForShadowData(const ShadowData& sha dow, const ComputedStyle& style, bool useSpread) 1442 CSSValue* ComputedStyleCSSValueMapping::valueForShadowData(const ShadowData& sha dow, const ComputedStyle& style, bool useSpread)
1435 { 1443 {
1436 CSSPrimitiveValue* x = zoomAdjustedPixelValue(shadow.x(), style); 1444 CSSPrimitiveValue* x = zoomAdjustedPixelValue(shadow.x(), style);
1437 CSSPrimitiveValue* y = zoomAdjustedPixelValue(shadow.y(), style); 1445 CSSPrimitiveValue* y = zoomAdjustedPixelValue(shadow.y(), style);
1438 CSSPrimitiveValue* blur = zoomAdjustedPixelValue(shadow.blur(), style); 1446 CSSPrimitiveValue* blur = zoomAdjustedPixelValue(shadow.blur(), style);
1439 CSSPrimitiveValue* spread = useSpread ? zoomAdjustedPixelValue(shadow.spread (), style) : nullptr; 1447 CSSPrimitiveValue* spread = useSpread ? zoomAdjustedPixelValue(shadow.spread (), style) : nullptr;
1440 CSSPrimitiveValue* shadowStyle = shadow.style() == Normal ? nullptr : CSSPri mitiveValue::createIdentifier(CSSValueInset); 1448 CSSIdentifierValue* shadowStyle = shadow.style() == Normal ? nullptr : CSSId entifierValue::createIdentifier(CSSValueInset);
1441 CSSValue* color = currentColorOrValidColor(style, shadow.color()); 1449 CSSValue* color = currentColorOrValidColor(style, shadow.color());
1442 return CSSShadowValue::create(x, y, blur, spread, shadowStyle, color); 1450 return CSSShadowValue::create(x, y, blur, spread, shadowStyle, color);
1443 } 1451 }
1444 1452
1445 CSSValue* ComputedStyleCSSValueMapping::valueForShadowList(const ShadowList* sha dowList, const ComputedStyle& style, bool useSpread) 1453 CSSValue* ComputedStyleCSSValueMapping::valueForShadowList(const ShadowList* sha dowList, const ComputedStyle& style, bool useSpread)
1446 { 1454 {
1447 if (!shadowList) 1455 if (!shadowList)
1448 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 1456 return CSSIdentifierValue::createIdentifier(CSSValueNone);
1449 1457
1450 CSSValueList* list = CSSValueList::createCommaSeparated(); 1458 CSSValueList* list = CSSValueList::createCommaSeparated();
1451 size_t shadowCount = shadowList->shadows().size(); 1459 size_t shadowCount = shadowList->shadows().size();
1452 for (size_t i = 0; i < shadowCount; ++i) 1460 for (size_t i = 0; i < shadowCount; ++i)
1453 list->append(*valueForShadowData(shadowList->shadows()[i], style, useSpr ead)); 1461 list->append(*valueForShadowData(shadowList->shadows()[i], style, useSpr ead));
1454 return list; 1462 return list;
1455 } 1463 }
1456 1464
1457 CSSValue* ComputedStyleCSSValueMapping::valueForFilter(const ComputedStyle& styl e, const FilterOperations& filterOperations) 1465 CSSValue* ComputedStyleCSSValueMapping::valueForFilter(const ComputedStyle& styl e, const FilterOperations& filterOperations)
1458 { 1466 {
1459 if (filterOperations.operations().isEmpty()) 1467 if (filterOperations.operations().isEmpty())
1460 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 1468 return CSSIdentifierValue::createIdentifier(CSSValueNone);
1461 1469
1462 CSSValueList* list = CSSValueList::createSpaceSeparated(); 1470 CSSValueList* list = CSSValueList::createSpaceSeparated();
1463 1471
1464 CSSFunctionValue* filterValue = nullptr; 1472 CSSFunctionValue* filterValue = nullptr;
1465 1473
1466 for (const auto& operation : filterOperations.operations()) { 1474 for (const auto& operation : filterOperations.operations()) {
1467 FilterOperation* filterOperation = operation.get(); 1475 FilterOperation* filterOperation = operation.get();
1468 switch (filterOperation->type()) { 1476 switch (filterOperation->type()) {
1469 case FilterOperation::REFERENCE: 1477 case FilterOperation::REFERENCE:
1470 filterValue = CSSFunctionValue::create(CSSValueUrl); 1478 filterValue = CSSFunctionValue::create(CSSValueUrl);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 CSSValueList* sizeAndLineHeight = CSSValueList::createSlashSeparated(); 1538 CSSValueList* sizeAndLineHeight = CSSValueList::createSlashSeparated();
1531 sizeAndLineHeight->append(*valueForFontSize(style)); 1539 sizeAndLineHeight->append(*valueForFontSize(style));
1532 sizeAndLineHeight->append(*valueForLineHeight(style)); 1540 sizeAndLineHeight->append(*valueForLineHeight(style));
1533 1541
1534 CSSValueList* list = CSSValueList::createSpaceSeparated(); 1542 CSSValueList* list = CSSValueList::createSpaceSeparated();
1535 list->append(*valueForFontStyle(style)); 1543 list->append(*valueForFontStyle(style));
1536 1544
1537 // Check that non-initial font-variant subproperties are not conflicting wit h this serialization. 1545 // Check that non-initial font-variant subproperties are not conflicting wit h this serialization.
1538 CSSValue* ligaturesValue = valueForFontVariantLigatures(style); 1546 CSSValue* ligaturesValue = valueForFontVariantLigatures(style);
1539 CSSValue* numericValue = valueForFontVariantNumeric(style); 1547 CSSValue* numericValue = valueForFontVariantNumeric(style);
1540 if (!ligaturesValue->equals(*CSSPrimitiveValue::createIdentifier(CSSValueNor mal)) 1548 if (!ligaturesValue->equals(*CSSIdentifierValue::createIdentifier(CSSValueNo rmal))
1541 || !numericValue->equals(*CSSPrimitiveValue::createIdentifier(CSSValueNo rmal))) 1549 || !numericValue->equals(*CSSIdentifierValue::createIdentifier(CSSValueN ormal)))
1542 return nullptr; 1550 return nullptr;
1543 1551
1544 CSSPrimitiveValue* capsValue = valueForFontVariantCaps(style); 1552 CSSIdentifierValue* capsValue = valueForFontVariantCaps(style);
1545 if (!capsValue->equals(*CSSPrimitiveValue::createIdentifier(CSSValueNormal)) 1553 if (capsValue->getValueID() != CSSValueNormal
1546 && !capsValue->equals(*CSSPrimitiveValue::createIdentifier(CSSValueSmall Caps))) 1554 && capsValue->getValueID() != CSSValueSmallCaps)
1547 return nullptr; 1555 return nullptr;
1548 list->append(*capsValue); 1556 list->append(*capsValue);
1549 1557
1550 list->append(*valueForFontWeight(style)); 1558 list->append(*valueForFontWeight(style));
1551 list->append(*valueForFontStretch(style)); 1559 list->append(*valueForFontStretch(style));
1552 list->append(*sizeAndLineHeight); 1560 list->append(*sizeAndLineHeight);
1553 list->append(*valueForFontFamily(style)); 1561 list->append(*valueForFontFamily(style));
1554 1562
1555 return list; 1563 return list;
1556 } 1564 }
1557 1565
1558 static CSSValue* valueForScrollSnapDestination(const LengthPoint& destination, c onst ComputedStyle& style) 1566 static CSSValue* valueForScrollSnapDestination(const LengthPoint& destination, c onst ComputedStyle& style)
1559 { 1567 {
1560 CSSValueList* list = CSSValueList::createSpaceSeparated(); 1568 CSSValueList* list = CSSValueList::createSpaceSeparated();
1561 list->append(*zoomAdjustedPixelValueForLength(destination.x(), style)); 1569 list->append(*zoomAdjustedPixelValueForLength(destination.x(), style));
1562 list->append(*zoomAdjustedPixelValueForLength(destination.y(), style)); 1570 list->append(*zoomAdjustedPixelValueForLength(destination.y(), style));
1563 return list; 1571 return list;
1564 } 1572 }
1565 1573
1566 static CSSValue* valueForScrollSnapPoints(const ScrollSnapPoints& points, const ComputedStyle& style) 1574 static CSSValue* valueForScrollSnapPoints(const ScrollSnapPoints& points, const ComputedStyle& style)
1567 { 1575 {
1568 if (points.hasRepeat) { 1576 if (points.hasRepeat) {
1569 CSSFunctionValue* repeat = CSSFunctionValue::create(CSSValueRepeat); 1577 CSSFunctionValue* repeat = CSSFunctionValue::create(CSSValueRepeat);
1570 repeat->append(*zoomAdjustedPixelValueForLength(points.repeatOffset, sty le)); 1578 repeat->append(*zoomAdjustedPixelValueForLength(points.repeatOffset, sty le));
1571 return repeat; 1579 return repeat;
1572 } 1580 }
1573 1581
1574 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 1582 return CSSIdentifierValue::createIdentifier(CSSValueNone);
1575 } 1583 }
1576 1584
1577 static CSSValue* valueForScrollSnapCoordinate(const Vector<LengthPoint>& coordin ates, const ComputedStyle& style) 1585 static CSSValue* valueForScrollSnapCoordinate(const Vector<LengthPoint>& coordin ates, const ComputedStyle& style)
1578 { 1586 {
1579 if (coordinates.isEmpty()) 1587 if (coordinates.isEmpty())
1580 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 1588 return CSSIdentifierValue::createIdentifier(CSSValueNone);
1581 1589
1582 CSSValueList* list = CSSValueList::createCommaSeparated(); 1590 CSSValueList* list = CSSValueList::createCommaSeparated();
1583 1591
1584 for (auto& coordinate : coordinates) { 1592 for (auto& coordinate : coordinates) {
1585 auto pair = CSSValueList::createSpaceSeparated(); 1593 auto pair = CSSValueList::createSpaceSeparated();
1586 pair->append(*zoomAdjustedPixelValueForLength(coordinate.x(), style)); 1594 pair->append(*zoomAdjustedPixelValueForLength(coordinate.x(), style));
1587 pair->append(*zoomAdjustedPixelValueForLength(coordinate.y(), style)); 1595 pair->append(*zoomAdjustedPixelValueForLength(coordinate.y(), style));
1588 list->append(*pair); 1596 list->append(*pair);
1589 } 1597 }
1590 1598
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1671 case CSSPropertyBackgroundColor: 1679 case CSSPropertyBackgroundColor:
1672 return allowVisitedStyle ? CSSColorValue::create(style.visitedDependentC olor(CSSPropertyBackgroundColor).rgb()) : currentColorOrValidColor(style, style. backgroundColor()); 1680 return allowVisitedStyle ? CSSColorValue::create(style.visitedDependentC olor(CSSPropertyBackgroundColor).rgb()) : currentColorOrValidColor(style, style. backgroundColor());
1673 case CSSPropertyBackgroundImage: 1681 case CSSPropertyBackgroundImage:
1674 case CSSPropertyWebkitMaskImage: { 1682 case CSSPropertyWebkitMaskImage: {
1675 CSSValueList* list = CSSValueList::createCommaSeparated(); 1683 CSSValueList* list = CSSValueList::createCommaSeparated();
1676 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskImage ? &style.maskLayers() : &style.backgroundLayers(); 1684 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskImage ? &style.maskLayers() : &style.backgroundLayers();
1677 for (; currLayer; currLayer = currLayer->next()) { 1685 for (; currLayer; currLayer = currLayer->next()) {
1678 if (currLayer->image()) 1686 if (currLayer->image())
1679 list->append(*currLayer->image()->computedCSSValue()); 1687 list->append(*currLayer->image()->computedCSSValue());
1680 else 1688 else
1681 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueNone)) ; 1689 list->append(*CSSIdentifierValue::createIdentifier(CSSValueNone) );
1682 } 1690 }
1683 return list; 1691 return list;
1684 } 1692 }
1685 case CSSPropertyBackgroundSize: 1693 case CSSPropertyBackgroundSize:
1686 case CSSPropertyWebkitMaskSize: { 1694 case CSSPropertyWebkitMaskSize: {
1687 CSSValueList* list = CSSValueList::createCommaSeparated(); 1695 CSSValueList* list = CSSValueList::createCommaSeparated();
1688 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskSize ? & style.maskLayers() : &style.backgroundLayers(); 1696 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskSize ? & style.maskLayers() : &style.backgroundLayers();
1689 for (; currLayer; currLayer = currLayer->next()) 1697 for (; currLayer; currLayer = currLayer->next())
1690 list->append(*valueForFillSize(currLayer->size(), style)); 1698 list->append(*valueForFillSize(currLayer->size(), style));
1691 return list; 1699 return list;
1692 } 1700 }
1693 case CSSPropertyBackgroundRepeat: 1701 case CSSPropertyBackgroundRepeat:
1694 case CSSPropertyWebkitMaskRepeat: { 1702 case CSSPropertyWebkitMaskRepeat: {
1695 CSSValueList* list = CSSValueList::createCommaSeparated(); 1703 CSSValueList* list = CSSValueList::createCommaSeparated();
1696 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskRepeat ? &style.maskLayers() : &style.backgroundLayers(); 1704 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskRepeat ? &style.maskLayers() : &style.backgroundLayers();
1697 for (; currLayer; currLayer = currLayer->next()) 1705 for (; currLayer; currLayer = currLayer->next())
1698 list->append(*valueForFillRepeat(currLayer->repeatX(), currLayer->re peatY())); 1706 list->append(*valueForFillRepeat(currLayer->repeatX(), currLayer->re peatY()));
1699 return list; 1707 return list;
1700 } 1708 }
1701 case CSSPropertyMaskSourceType: { 1709 case CSSPropertyMaskSourceType: {
1702 CSSValueList* list = CSSValueList::createCommaSeparated(); 1710 CSSValueList* list = CSSValueList::createCommaSeparated();
1703 for (const FillLayer* currLayer = &style.maskLayers(); currLayer; currLa yer = currLayer->next()) 1711 for (const FillLayer* currLayer = &style.maskLayers(); currLayer; currLa yer = currLayer->next())
1704 list->append(*valueForFillSourceType(currLayer->maskSourceType())); 1712 list->append(*valueForFillSourceType(currLayer->maskSourceType()));
1705 return list; 1713 return list;
1706 } 1714 }
1707 case CSSPropertyWebkitMaskComposite: { 1715 case CSSPropertyWebkitMaskComposite: {
1708 CSSValueList* list = CSSValueList::createCommaSeparated(); 1716 CSSValueList* list = CSSValueList::createCommaSeparated();
1709 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskComposit e ? &style.maskLayers() : &style.backgroundLayers(); 1717 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskComposit e ? &style.maskLayers() : &style.backgroundLayers();
1710 for (; currLayer; currLayer = currLayer->next()) 1718 for (; currLayer; currLayer = currLayer->next())
1711 list->append(*CSSPrimitiveValue::create(currLayer->composite())); 1719 list->append(*CSSIdentifierValue::create(currLayer->composite()));
1712 return list; 1720 return list;
1713 } 1721 }
1714 case CSSPropertyBackgroundAttachment: { 1722 case CSSPropertyBackgroundAttachment: {
1715 CSSValueList* list = CSSValueList::createCommaSeparated(); 1723 CSSValueList* list = CSSValueList::createCommaSeparated();
1716 for (const FillLayer* currLayer = &style.backgroundLayers(); currLayer; currLayer = currLayer->next()) 1724 for (const FillLayer* currLayer = &style.backgroundLayers(); currLayer; currLayer = currLayer->next())
1717 list->append(*CSSPrimitiveValue::create(currLayer->attachment())); 1725 list->append(*CSSIdentifierValue::create(currLayer->attachment()));
1718 return list; 1726 return list;
1719 } 1727 }
1720 case CSSPropertyBackgroundClip: 1728 case CSSPropertyBackgroundClip:
1721 case CSSPropertyBackgroundOrigin: 1729 case CSSPropertyBackgroundOrigin:
1722 case CSSPropertyWebkitBackgroundClip: 1730 case CSSPropertyWebkitBackgroundClip:
1723 case CSSPropertyWebkitBackgroundOrigin: 1731 case CSSPropertyWebkitBackgroundOrigin:
1724 case CSSPropertyWebkitMaskClip: 1732 case CSSPropertyWebkitMaskClip:
1725 case CSSPropertyWebkitMaskOrigin: { 1733 case CSSPropertyWebkitMaskOrigin: {
1726 bool isClip = propertyID == CSSPropertyBackgroundClip || propertyID == C SSPropertyWebkitBackgroundClip || propertyID == CSSPropertyWebkitMaskClip; 1734 bool isClip = propertyID == CSSPropertyBackgroundClip || propertyID == C SSPropertyWebkitBackgroundClip || propertyID == CSSPropertyWebkitMaskClip;
1727 CSSValueList* list = CSSValueList::createCommaSeparated(); 1735 CSSValueList* list = CSSValueList::createCommaSeparated();
1728 const FillLayer* currLayer = (propertyID == CSSPropertyWebkitMaskClip || propertyID == CSSPropertyWebkitMaskOrigin) ? &style.maskLayers() : &style.backg roundLayers(); 1736 const FillLayer* currLayer = (propertyID == CSSPropertyWebkitMaskClip || propertyID == CSSPropertyWebkitMaskOrigin) ? &style.maskLayers() : &style.backg roundLayers();
1729 for (; currLayer; currLayer = currLayer->next()) { 1737 for (; currLayer; currLayer = currLayer->next()) {
1730 EFillBox box = isClip ? currLayer->clip() : currLayer->origin(); 1738 EFillBox box = isClip ? currLayer->clip() : currLayer->origin();
1731 list->append(*CSSPrimitiveValue::create(box)); 1739 list->append(*CSSIdentifierValue::create(box));
1732 } 1740 }
1733 return list; 1741 return list;
1734 } 1742 }
1735 case CSSPropertyBackgroundPosition: 1743 case CSSPropertyBackgroundPosition:
1736 case CSSPropertyWebkitMaskPosition: { 1744 case CSSPropertyWebkitMaskPosition: {
1737 CSSValueList* list = CSSValueList::createCommaSeparated(); 1745 CSSValueList* list = CSSValueList::createCommaSeparated();
1738 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition ? &style.maskLayers() : &style.backgroundLayers(); 1746 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition ? &style.maskLayers() : &style.backgroundLayers();
1739 for (; currLayer; currLayer = currLayer->next()) 1747 for (; currLayer; currLayer = currLayer->next())
1740 list->append(*createPositionListForLayer(propertyID, *currLayer, sty le)); 1748 list->append(*createPositionListForLayer(propertyID, *currLayer, sty le));
1741 return list; 1749 return list;
1742 } 1750 }
1743 case CSSPropertyBackgroundPositionX: 1751 case CSSPropertyBackgroundPositionX:
1744 case CSSPropertyWebkitMaskPositionX: { 1752 case CSSPropertyWebkitMaskPositionX: {
1745 CSSValueList* list = CSSValueList::createCommaSeparated(); 1753 CSSValueList* list = CSSValueList::createCommaSeparated();
1746 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition X ? &style.maskLayers() : &style.backgroundLayers(); 1754 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition X ? &style.maskLayers() : &style.backgroundLayers();
1747 for (; currLayer; currLayer = currLayer->next()) 1755 for (; currLayer; currLayer = currLayer->next())
1748 list->append(*zoomAdjustedPixelValueForLength(currLayer->xPosition() , style)); 1756 list->append(*zoomAdjustedPixelValueForLength(currLayer->xPosition() , style));
1749 return list; 1757 return list;
1750 } 1758 }
1751 case CSSPropertyBackgroundPositionY: 1759 case CSSPropertyBackgroundPositionY:
1752 case CSSPropertyWebkitMaskPositionY: { 1760 case CSSPropertyWebkitMaskPositionY: {
1753 CSSValueList* list = CSSValueList::createCommaSeparated(); 1761 CSSValueList* list = CSSValueList::createCommaSeparated();
1754 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition Y ? &style.maskLayers() : &style.backgroundLayers(); 1762 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition Y ? &style.maskLayers() : &style.backgroundLayers();
1755 for (; currLayer; currLayer = currLayer->next()) 1763 for (; currLayer; currLayer = currLayer->next())
1756 list->append(*zoomAdjustedPixelValueForLength(currLayer->yPosition() , style)); 1764 list->append(*zoomAdjustedPixelValueForLength(currLayer->yPosition() , style));
1757 return list; 1765 return list;
1758 } 1766 }
1759 case CSSPropertyBorderCollapse: 1767 case CSSPropertyBorderCollapse:
1760 if (style.borderCollapse()) 1768 if (style.borderCollapse())
1761 return CSSPrimitiveValue::createIdentifier(CSSValueCollapse); 1769 return CSSIdentifierValue::createIdentifier(CSSValueCollapse);
1762 return CSSPrimitiveValue::createIdentifier(CSSValueSeparate); 1770 return CSSIdentifierValue::createIdentifier(CSSValueSeparate);
1763 case CSSPropertyBorderSpacing: { 1771 case CSSPropertyBorderSpacing: {
1764 CSSValueList* list = CSSValueList::createSpaceSeparated(); 1772 CSSValueList* list = CSSValueList::createSpaceSeparated();
1765 list->append(*zoomAdjustedPixelValue(style.horizontalBorderSpacing(), st yle)); 1773 list->append(*zoomAdjustedPixelValue(style.horizontalBorderSpacing(), st yle));
1766 list->append(*zoomAdjustedPixelValue(style.verticalBorderSpacing(), styl e)); 1774 list->append(*zoomAdjustedPixelValue(style.verticalBorderSpacing(), styl e));
1767 return list; 1775 return list;
1768 } 1776 }
1769 case CSSPropertyWebkitBorderHorizontalSpacing: 1777 case CSSPropertyWebkitBorderHorizontalSpacing:
1770 return zoomAdjustedPixelValue(style.horizontalBorderSpacing(), style); 1778 return zoomAdjustedPixelValue(style.horizontalBorderSpacing(), style);
1771 case CSSPropertyWebkitBorderVerticalSpacing: 1779 case CSSPropertyWebkitBorderVerticalSpacing:
1772 return zoomAdjustedPixelValue(style.verticalBorderSpacing(), style); 1780 return zoomAdjustedPixelValue(style.verticalBorderSpacing(), style);
1773 case CSSPropertyBorderImageSource: 1781 case CSSPropertyBorderImageSource:
1774 if (style.borderImageSource()) 1782 if (style.borderImageSource())
1775 return style.borderImageSource()->computedCSSValue(); 1783 return style.borderImageSource()->computedCSSValue();
1776 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 1784 return CSSIdentifierValue::createIdentifier(CSSValueNone);
1777 case CSSPropertyBorderTopColor: 1785 case CSSPropertyBorderTopColor:
1778 return allowVisitedStyle ? CSSColorValue::create(style.visitedDependentC olor(CSSPropertyBorderTopColor).rgb()) : currentColorOrValidColor(style, style.b orderTopColor()); 1786 return allowVisitedStyle ? CSSColorValue::create(style.visitedDependentC olor(CSSPropertyBorderTopColor).rgb()) : currentColorOrValidColor(style, style.b orderTopColor());
1779 case CSSPropertyBorderRightColor: 1787 case CSSPropertyBorderRightColor:
1780 return allowVisitedStyle ? CSSColorValue::create(style.visitedDependentC olor(CSSPropertyBorderRightColor).rgb()) : currentColorOrValidColor(style, style .borderRightColor()); 1788 return allowVisitedStyle ? CSSColorValue::create(style.visitedDependentC olor(CSSPropertyBorderRightColor).rgb()) : currentColorOrValidColor(style, style .borderRightColor());
1781 case CSSPropertyBorderBottomColor: 1789 case CSSPropertyBorderBottomColor:
1782 return allowVisitedStyle ? CSSColorValue::create(style.visitedDependentC olor(CSSPropertyBorderBottomColor).rgb()) : currentColorOrValidColor(style, styl e.borderBottomColor()); 1790 return allowVisitedStyle ? CSSColorValue::create(style.visitedDependentC olor(CSSPropertyBorderBottomColor).rgb()) : currentColorOrValidColor(style, styl e.borderBottomColor());
1783 case CSSPropertyBorderLeftColor: 1791 case CSSPropertyBorderLeftColor:
1784 return allowVisitedStyle ? CSSColorValue::create(style.visitedDependentC olor(CSSPropertyBorderLeftColor).rgb()) : currentColorOrValidColor(style, style. borderLeftColor()); 1792 return allowVisitedStyle ? CSSColorValue::create(style.visitedDependentC olor(CSSPropertyBorderLeftColor).rgb()) : currentColorOrValidColor(style, style. borderLeftColor());
1785 case CSSPropertyBorderTopStyle: 1793 case CSSPropertyBorderTopStyle:
1786 return CSSPrimitiveValue::create(style.borderTopStyle()); 1794 return CSSIdentifierValue::create(style.borderTopStyle());
1787 case CSSPropertyBorderRightStyle: 1795 case CSSPropertyBorderRightStyle:
1788 return CSSPrimitiveValue::create(style.borderRightStyle()); 1796 return CSSIdentifierValue::create(style.borderRightStyle());
1789 case CSSPropertyBorderBottomStyle: 1797 case CSSPropertyBorderBottomStyle:
1790 return CSSPrimitiveValue::create(style.borderBottomStyle()); 1798 return CSSIdentifierValue::create(style.borderBottomStyle());
1791 case CSSPropertyBorderLeftStyle: 1799 case CSSPropertyBorderLeftStyle:
1792 return CSSPrimitiveValue::create(style.borderLeftStyle()); 1800 return CSSIdentifierValue::create(style.borderLeftStyle());
1793 case CSSPropertyBorderTopWidth: 1801 case CSSPropertyBorderTopWidth:
1794 return zoomAdjustedPixelValue(style.borderTopWidth(), style); 1802 return zoomAdjustedPixelValue(style.borderTopWidth(), style);
1795 case CSSPropertyBorderRightWidth: 1803 case CSSPropertyBorderRightWidth:
1796 return zoomAdjustedPixelValue(style.borderRightWidth(), style); 1804 return zoomAdjustedPixelValue(style.borderRightWidth(), style);
1797 case CSSPropertyBorderBottomWidth: 1805 case CSSPropertyBorderBottomWidth:
1798 return zoomAdjustedPixelValue(style.borderBottomWidth(), style); 1806 return zoomAdjustedPixelValue(style.borderBottomWidth(), style);
1799 case CSSPropertyBorderLeftWidth: 1807 case CSSPropertyBorderLeftWidth:
1800 return zoomAdjustedPixelValue(style.borderLeftWidth(), style); 1808 return zoomAdjustedPixelValue(style.borderLeftWidth(), style);
1801 case CSSPropertyBottom: 1809 case CSSPropertyBottom:
1802 return valueForPositionOffset(style, CSSPropertyBottom, layoutObject); 1810 return valueForPositionOffset(style, CSSPropertyBottom, layoutObject);
1803 case CSSPropertyWebkitBoxAlign: 1811 case CSSPropertyWebkitBoxAlign:
1804 return CSSPrimitiveValue::create(style.boxAlign()); 1812 return CSSIdentifierValue::create(style.boxAlign());
1805 case CSSPropertyWebkitBoxDecorationBreak: 1813 case CSSPropertyWebkitBoxDecorationBreak:
1806 if (style.boxDecorationBreak() == BoxDecorationBreakSlice) 1814 if (style.boxDecorationBreak() == BoxDecorationBreakSlice)
1807 return CSSPrimitiveValue::createIdentifier(CSSValueSlice); 1815 return CSSIdentifierValue::createIdentifier(CSSValueSlice);
1808 return CSSPrimitiveValue::createIdentifier(CSSValueClone); 1816 return CSSIdentifierValue::createIdentifier(CSSValueClone);
1809 case CSSPropertyWebkitBoxDirection: 1817 case CSSPropertyWebkitBoxDirection:
1810 return CSSPrimitiveValue::create(style.boxDirection()); 1818 return CSSIdentifierValue::create(style.boxDirection());
1811 case CSSPropertyWebkitBoxFlex: 1819 case CSSPropertyWebkitBoxFlex:
1812 return CSSPrimitiveValue::create(style.boxFlex(), CSSPrimitiveValue::Uni tType::Number); 1820 return CSSPrimitiveValue::create(style.boxFlex(), CSSPrimitiveValue::Uni tType::Number);
1813 case CSSPropertyWebkitBoxFlexGroup: 1821 case CSSPropertyWebkitBoxFlexGroup:
1814 return CSSPrimitiveValue::create(style.boxFlexGroup(), CSSPrimitiveValue ::UnitType::Number); 1822 return CSSPrimitiveValue::create(style.boxFlexGroup(), CSSPrimitiveValue ::UnitType::Number);
1815 case CSSPropertyWebkitBoxLines: 1823 case CSSPropertyWebkitBoxLines:
1816 return CSSPrimitiveValue::create(style.boxLines()); 1824 return CSSIdentifierValue::create(style.boxLines());
1817 case CSSPropertyWebkitBoxOrdinalGroup: 1825 case CSSPropertyWebkitBoxOrdinalGroup:
1818 return CSSPrimitiveValue::create(style.boxOrdinalGroup(), CSSPrimitiveVa lue::UnitType::Number); 1826 return CSSPrimitiveValue::create(style.boxOrdinalGroup(), CSSPrimitiveVa lue::UnitType::Number);
1819 case CSSPropertyWebkitBoxOrient: 1827 case CSSPropertyWebkitBoxOrient:
1820 return CSSPrimitiveValue::create(style.boxOrient()); 1828 return CSSIdentifierValue::create(style.boxOrient());
1821 case CSSPropertyWebkitBoxPack: 1829 case CSSPropertyWebkitBoxPack:
1822 return CSSPrimitiveValue::create(style.boxPack()); 1830 return CSSIdentifierValue::create(style.boxPack());
1823 case CSSPropertyWebkitBoxReflect: 1831 case CSSPropertyWebkitBoxReflect:
1824 return valueForReflection(style.boxReflect(), style); 1832 return valueForReflection(style.boxReflect(), style);
1825 case CSSPropertyBoxShadow: 1833 case CSSPropertyBoxShadow:
1826 return valueForShadowList(style.boxShadow(), style, true); 1834 return valueForShadowList(style.boxShadow(), style, true);
1827 case CSSPropertyCaptionSide: 1835 case CSSPropertyCaptionSide:
1828 return CSSPrimitiveValue::create(style.captionSide()); 1836 return CSSIdentifierValue::create(style.captionSide());
1829 case CSSPropertyClear: 1837 case CSSPropertyClear:
1830 return CSSPrimitiveValue::create(style.clear()); 1838 return CSSIdentifierValue::create(style.clear());
1831 case CSSPropertyColor: 1839 case CSSPropertyColor:
1832 return CSSColorValue::create(allowVisitedStyle ? style.visitedDependentC olor(CSSPropertyColor).rgb() : style.color().rgb()); 1840 return CSSColorValue::create(allowVisitedStyle ? style.visitedDependentC olor(CSSPropertyColor).rgb() : style.color().rgb());
1833 case CSSPropertyWebkitPrintColorAdjust: 1841 case CSSPropertyWebkitPrintColorAdjust:
1834 return CSSPrimitiveValue::create(style.getPrintColorAdjust()); 1842 return CSSIdentifierValue::create(style.getPrintColorAdjust());
1835 case CSSPropertyColumnCount: 1843 case CSSPropertyColumnCount:
1836 if (style.hasAutoColumnCount()) 1844 if (style.hasAutoColumnCount())
1837 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 1845 return CSSIdentifierValue::createIdentifier(CSSValueAuto);
1838 return CSSPrimitiveValue::create(style.columnCount(), CSSPrimitiveValue: :UnitType::Number); 1846 return CSSPrimitiveValue::create(style.columnCount(), CSSPrimitiveValue: :UnitType::Number);
1839 case CSSPropertyColumnFill: 1847 case CSSPropertyColumnFill:
1840 return CSSPrimitiveValue::create(style.getColumnFill()); 1848 return CSSIdentifierValue::create(style.getColumnFill());
1841 case CSSPropertyColumnGap: 1849 case CSSPropertyColumnGap:
1842 if (style.hasNormalColumnGap()) 1850 if (style.hasNormalColumnGap())
1843 return CSSPrimitiveValue::createIdentifier(CSSValueNormal); 1851 return CSSIdentifierValue::createIdentifier(CSSValueNormal);
1844 return zoomAdjustedPixelValue(style.columnGap(), style); 1852 return zoomAdjustedPixelValue(style.columnGap(), style);
1845 case CSSPropertyColumnRuleColor: 1853 case CSSPropertyColumnRuleColor:
1846 return allowVisitedStyle ? CSSColorValue::create(style.visitedDependentC olor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style, style.col umnRuleColor()); 1854 return allowVisitedStyle ? CSSColorValue::create(style.visitedDependentC olor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style, style.col umnRuleColor());
1847 case CSSPropertyColumnRuleStyle: 1855 case CSSPropertyColumnRuleStyle:
1848 return CSSPrimitiveValue::create(style.columnRuleStyle()); 1856 return CSSIdentifierValue::create(style.columnRuleStyle());
1849 case CSSPropertyColumnRuleWidth: 1857 case CSSPropertyColumnRuleWidth:
1850 return zoomAdjustedPixelValue(style.columnRuleWidth(), style); 1858 return zoomAdjustedPixelValue(style.columnRuleWidth(), style);
1851 case CSSPropertyColumnSpan: 1859 case CSSPropertyColumnSpan:
1852 return CSSPrimitiveValue::createIdentifier(style.getColumnSpan() ? CSSVa lueAll : CSSValueNone); 1860 return CSSIdentifierValue::createIdentifier(style.getColumnSpan() ? CSSV alueAll : CSSValueNone);
1853 case CSSPropertyWebkitColumnBreakAfter: 1861 case CSSPropertyWebkitColumnBreakAfter:
1854 return CSSPrimitiveValue::create(mapToColumnBreakValue(style.breakAfter( ))); 1862 return CSSIdentifierValue::create(mapToColumnBreakValue(style.breakAfter ()));
1855 case CSSPropertyWebkitColumnBreakBefore: 1863 case CSSPropertyWebkitColumnBreakBefore:
1856 return CSSPrimitiveValue::create(mapToColumnBreakValue(style.breakBefore ())); 1864 return CSSIdentifierValue::create(mapToColumnBreakValue(style.breakBefor e()));
1857 case CSSPropertyWebkitColumnBreakInside: 1865 case CSSPropertyWebkitColumnBreakInside:
1858 return CSSPrimitiveValue::create(mapToColumnBreakValue(style.breakInside ())); 1866 return CSSIdentifierValue::create(mapToColumnBreakValue(style.breakInsid e()));
1859 case CSSPropertyColumnWidth: 1867 case CSSPropertyColumnWidth:
1860 if (style.hasAutoColumnWidth()) 1868 if (style.hasAutoColumnWidth())
1861 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 1869 return CSSIdentifierValue::createIdentifier(CSSValueAuto);
1862 return zoomAdjustedPixelValue(style.columnWidth(), style); 1870 return zoomAdjustedPixelValue(style.columnWidth(), style);
1863 case CSSPropertyTabSize: 1871 case CSSPropertyTabSize:
1864 return CSSPrimitiveValue::create( 1872 return CSSPrimitiveValue::create(
1865 style.getTabSize().getPixelSize(1.0), style.getTabSize().isSpaces() ? CSSPrimitiveValue::UnitType::Number : CSSPrimitiveValue::UnitType::Pixels); 1873 style.getTabSize().getPixelSize(1.0), style.getTabSize().isSpaces() ? CSSPrimitiveValue::UnitType::Number : CSSPrimitiveValue::UnitType::Pixels);
1866 case CSSPropertyTextSizeAdjust: 1874 case CSSPropertyTextSizeAdjust:
1867 if (style.getTextSizeAdjust().isAuto()) 1875 if (style.getTextSizeAdjust().isAuto())
1868 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 1876 return CSSIdentifierValue::createIdentifier(CSSValueAuto);
1869 return CSSPrimitiveValue::create(style.getTextSizeAdjust().multiplier() * 100, CSSPrimitiveValue::UnitType::Percentage); 1877 return CSSPrimitiveValue::create(style.getTextSizeAdjust().multiplier() * 100, CSSPrimitiveValue::UnitType::Percentage);
1870 case CSSPropertyCursor: { 1878 case CSSPropertyCursor: {
1871 CSSValueList* list = nullptr; 1879 CSSValueList* list = nullptr;
1872 CursorList* cursors = style.cursors(); 1880 CursorList* cursors = style.cursors();
1873 if (cursors && cursors->size() > 0) { 1881 if (cursors && cursors->size() > 0) {
1874 list = CSSValueList::createCommaSeparated(); 1882 list = CSSValueList::createCommaSeparated();
1875 for (unsigned i = 0; i < cursors->size(); ++i) { 1883 for (unsigned i = 0; i < cursors->size(); ++i) {
1876 if (StyleImage* image = cursors->at(i).image()) 1884 if (StyleImage* image = cursors->at(i).image())
1877 list->append(*CSSCursorImageValue::create(image->computedCSS Value(), cursors->at(i).hotSpotSpecified(), cursors->at(i).hotSpot())); 1885 list->append(*CSSCursorImageValue::create(image->computedCSS Value(), cursors->at(i).hotSpotSpecified(), cursors->at(i).hotSpot()));
1878 } 1886 }
1879 } 1887 }
1880 CSSValue* value = CSSPrimitiveValue::create(style.cursor()); 1888 CSSValue* value = CSSIdentifierValue::create(style.cursor());
1881 if (list) { 1889 if (list) {
1882 list->append(*value); 1890 list->append(*value);
1883 return list; 1891 return list;
1884 } 1892 }
1885 return value; 1893 return value;
1886 } 1894 }
1887 case CSSPropertyDirection: 1895 case CSSPropertyDirection:
1888 return CSSPrimitiveValue::create(style.direction()); 1896 return CSSIdentifierValue::create(style.direction());
1889 case CSSPropertyDisplay: 1897 case CSSPropertyDisplay:
1890 return CSSPrimitiveValue::create(style.display()); 1898 return CSSIdentifierValue::create(style.display());
1891 case CSSPropertyEmptyCells: 1899 case CSSPropertyEmptyCells:
1892 return CSSPrimitiveValue::create(style.emptyCells()); 1900 return CSSIdentifierValue::create(style.emptyCells());
1893 case CSSPropertyAlignContent: 1901 case CSSPropertyAlignContent:
1894 return valueForContentPositionAndDistributionWithOverflowAlignment(style .alignContent()); 1902 return valueForContentPositionAndDistributionWithOverflowAlignment(style .alignContent());
1895 case CSSPropertyAlignItems: 1903 case CSSPropertyAlignItems:
1896 return valueForItemPositionWithOverflowAlignment(style.alignItems()); 1904 return valueForItemPositionWithOverflowAlignment(style.alignItems());
1897 case CSSPropertyAlignSelf: 1905 case CSSPropertyAlignSelf:
1898 return valueForItemPositionWithOverflowAlignment(style.alignSelf()); 1906 return valueForItemPositionWithOverflowAlignment(style.alignSelf());
1899 case CSSPropertyFlex: 1907 case CSSPropertyFlex:
1900 return valuesForShorthandProperty(flexShorthand(), style, layoutObject, styledNode, allowVisitedStyle); 1908 return valuesForShorthandProperty(flexShorthand(), style, layoutObject, styledNode, allowVisitedStyle);
1901 case CSSPropertyFlexBasis: 1909 case CSSPropertyFlexBasis:
1902 return zoomAdjustedPixelValueForLength(style.flexBasis(), style); 1910 return zoomAdjustedPixelValueForLength(style.flexBasis(), style);
1903 case CSSPropertyFlexDirection: 1911 case CSSPropertyFlexDirection:
1904 return CSSPrimitiveValue::create(style.flexDirection()); 1912 return CSSIdentifierValue::create(style.flexDirection());
1905 case CSSPropertyFlexFlow: 1913 case CSSPropertyFlexFlow:
1906 return valuesForShorthandProperty(flexFlowShorthand(), style, layoutObje ct, styledNode, allowVisitedStyle); 1914 return valuesForShorthandProperty(flexFlowShorthand(), style, layoutObje ct, styledNode, allowVisitedStyle);
1907 case CSSPropertyFlexGrow: 1915 case CSSPropertyFlexGrow:
1908 return CSSPrimitiveValue::create(style.flexGrow(), CSSPrimitiveValue::Un itType::Number); 1916 return CSSPrimitiveValue::create(style.flexGrow(), CSSPrimitiveValue::Un itType::Number);
1909 case CSSPropertyFlexShrink: 1917 case CSSPropertyFlexShrink:
1910 return CSSPrimitiveValue::create(style.flexShrink(), CSSPrimitiveValue:: UnitType::Number); 1918 return CSSPrimitiveValue::create(style.flexShrink(), CSSPrimitiveValue:: UnitType::Number);
1911 case CSSPropertyFlexWrap: 1919 case CSSPropertyFlexWrap:
1912 return CSSPrimitiveValue::create(style.flexWrap()); 1920 return CSSIdentifierValue::create(style.flexWrap());
1913 case CSSPropertyJustifyContent: 1921 case CSSPropertyJustifyContent:
1914 return valueForContentPositionAndDistributionWithOverflowAlignment(style .justifyContent()); 1922 return valueForContentPositionAndDistributionWithOverflowAlignment(style .justifyContent());
1915 case CSSPropertyOrder: 1923 case CSSPropertyOrder:
1916 return CSSPrimitiveValue::create(style.order(), CSSPrimitiveValue::UnitT ype::Number); 1924 return CSSPrimitiveValue::create(style.order(), CSSPrimitiveValue::UnitT ype::Number);
1917 case CSSPropertyFloat: 1925 case CSSPropertyFloat:
1918 if (style.display() != NONE && style.hasOutOfFlowPosition()) 1926 if (style.display() != NONE && style.hasOutOfFlowPosition())
1919 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 1927 return CSSIdentifierValue::createIdentifier(CSSValueNone);
1920 return CSSPrimitiveValue::create(style.floating()); 1928 return CSSIdentifierValue::create(style.floating());
1921 case CSSPropertyFont: 1929 case CSSPropertyFont:
1922 return valueForFont(style); 1930 return valueForFont(style);
1923 case CSSPropertyFontFamily: 1931 case CSSPropertyFontFamily:
1924 return valueForFontFamily(style); 1932 return valueForFontFamily(style);
1925 case CSSPropertyFontSize: 1933 case CSSPropertyFontSize:
1926 return valueForFontSize(style); 1934 return valueForFontSize(style);
1927 case CSSPropertyFontSizeAdjust: 1935 case CSSPropertyFontSizeAdjust:
1928 if (style.hasFontSizeAdjust()) 1936 if (style.hasFontSizeAdjust())
1929 return CSSPrimitiveValue::create(style.fontSizeAdjust(), CSSPrimitiv eValue::UnitType::Number); 1937 return CSSPrimitiveValue::create(style.fontSizeAdjust(), CSSPrimitiv eValue::UnitType::Number);
1930 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 1938 return CSSIdentifierValue::createIdentifier(CSSValueNone);
1931 case CSSPropertyFontStretch: 1939 case CSSPropertyFontStretch:
1932 return valueForFontStretch(style); 1940 return valueForFontStretch(style);
1933 case CSSPropertyFontStyle: 1941 case CSSPropertyFontStyle:
1934 return valueForFontStyle(style); 1942 return valueForFontStyle(style);
1935 case CSSPropertyFontVariant: 1943 case CSSPropertyFontVariant:
1936 return valuesForFontVariantProperty(style, layoutObject, styledNode, all owVisitedStyle); 1944 return valuesForFontVariantProperty(style, layoutObject, styledNode, all owVisitedStyle);
1937 case CSSPropertyFontWeight: 1945 case CSSPropertyFontWeight:
1938 return valueForFontWeight(style); 1946 return valueForFontWeight(style);
1939 case CSSPropertyFontFeatureSettings: { 1947 case CSSPropertyFontFeatureSettings: {
1940 const FontFeatureSettings* featureSettings = style.getFontDescription(). featureSettings(); 1948 const FontFeatureSettings* featureSettings = style.getFontDescription(). featureSettings();
1941 if (!featureSettings || !featureSettings->size()) 1949 if (!featureSettings || !featureSettings->size())
1942 return CSSPrimitiveValue::createIdentifier(CSSValueNormal); 1950 return CSSIdentifierValue::createIdentifier(CSSValueNormal);
1943 CSSValueList* list = CSSValueList::createCommaSeparated(); 1951 CSSValueList* list = CSSValueList::createCommaSeparated();
1944 for (unsigned i = 0; i < featureSettings->size(); ++i) { 1952 for (unsigned i = 0; i < featureSettings->size(); ++i) {
1945 const FontFeature& feature = featureSettings->at(i); 1953 const FontFeature& feature = featureSettings->at(i);
1946 CSSFontFeatureValue* featureValue = CSSFontFeatureValue::create(feat ure.tag(), feature.value()); 1954 CSSFontFeatureValue* featureValue = CSSFontFeatureValue::create(feat ure.tag(), feature.value());
1947 list->append(*featureValue); 1955 list->append(*featureValue);
1948 } 1956 }
1949 return list; 1957 return list;
1950 } 1958 }
1951 case CSSPropertyGridAutoFlow: { 1959 case CSSPropertyGridAutoFlow: {
1952 CSSValueList* list = CSSValueList::createSpaceSeparated(); 1960 CSSValueList* list = CSSValueList::createSpaceSeparated();
1953 switch (style.getGridAutoFlow()) { 1961 switch (style.getGridAutoFlow()) {
1954 case AutoFlowRow: 1962 case AutoFlowRow:
1955 case AutoFlowRowDense: 1963 case AutoFlowRowDense:
1956 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueRow)); 1964 list->append(*CSSIdentifierValue::createIdentifier(CSSValueRow));
1957 break; 1965 break;
1958 case AutoFlowColumn: 1966 case AutoFlowColumn:
1959 case AutoFlowColumnDense: 1967 case AutoFlowColumnDense:
1960 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueColumn)); 1968 list->append(*CSSIdentifierValue::createIdentifier(CSSValueColumn));
1961 break; 1969 break;
1962 default: 1970 default:
1963 ASSERT_NOT_REACHED(); 1971 ASSERT_NOT_REACHED();
1964 } 1972 }
1965 1973
1966 switch (style.getGridAutoFlow()) { 1974 switch (style.getGridAutoFlow()) {
1967 case AutoFlowRowDense: 1975 case AutoFlowRowDense:
1968 case AutoFlowColumnDense: 1976 case AutoFlowColumnDense:
1969 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueDense)); 1977 list->append(*CSSIdentifierValue::createIdentifier(CSSValueDense));
1970 break; 1978 break;
1971 default: 1979 default:
1972 // Do nothing. 1980 // Do nothing.
1973 break; 1981 break;
1974 } 1982 }
1975 1983
1976 return list; 1984 return list;
1977 } 1985 }
1978 // Specs mention that getComputedStyle() should return the used value of the property instead of the computed 1986 // Specs mention that getComputedStyle() should return the used value of the property instead of the computed
1979 // one for grid-template-{rows|columns} but not for the grid-auto-{rows|colu mns} as things like 1987 // one for grid-template-{rows|columns} but not for the grid-auto-{rows|colu mns} as things like
(...skipping 24 matching lines...) Expand all
2004 return valuesForGridShorthand(gridRowShorthand(), style, layoutObject, s tyledNode, allowVisitedStyle); 2012 return valuesForGridShorthand(gridRowShorthand(), style, layoutObject, s tyledNode, allowVisitedStyle);
2005 case CSSPropertyGridArea: 2013 case CSSPropertyGridArea:
2006 return valuesForGridShorthand(gridAreaShorthand(), style, layoutObject, styledNode, allowVisitedStyle); 2014 return valuesForGridShorthand(gridAreaShorthand(), style, layoutObject, styledNode, allowVisitedStyle);
2007 case CSSPropertyGridTemplate: 2015 case CSSPropertyGridTemplate:
2008 return valuesForGridShorthand(gridTemplateShorthand(), style, layoutObje ct, styledNode, allowVisitedStyle); 2016 return valuesForGridShorthand(gridTemplateShorthand(), style, layoutObje ct, styledNode, allowVisitedStyle);
2009 case CSSPropertyGrid: 2017 case CSSPropertyGrid:
2010 return valuesForGridShorthand(gridShorthand(), style, layoutObject, styl edNode, allowVisitedStyle); 2018 return valuesForGridShorthand(gridShorthand(), style, layoutObject, styl edNode, allowVisitedStyle);
2011 case CSSPropertyGridTemplateAreas: 2019 case CSSPropertyGridTemplateAreas:
2012 if (!style.namedGridAreaRowCount()) { 2020 if (!style.namedGridAreaRowCount()) {
2013 ASSERT(!style.namedGridAreaColumnCount()); 2021 ASSERT(!style.namedGridAreaColumnCount());
2014 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2022 return CSSIdentifierValue::createIdentifier(CSSValueNone);
2015 } 2023 }
2016 2024
2017 return CSSGridTemplateAreasValue::create(style.namedGridArea(), style.na medGridAreaRowCount(), style.namedGridAreaColumnCount()); 2025 return CSSGridTemplateAreasValue::create(style.namedGridArea(), style.na medGridAreaRowCount(), style.namedGridAreaColumnCount());
2018 case CSSPropertyGridColumnGap: 2026 case CSSPropertyGridColumnGap:
2019 return zoomAdjustedPixelValueForLength(style.gridColumnGap(), style); 2027 return zoomAdjustedPixelValueForLength(style.gridColumnGap(), style);
2020 case CSSPropertyGridRowGap: 2028 case CSSPropertyGridRowGap:
2021 return zoomAdjustedPixelValueForLength(style.gridRowGap(), style); 2029 return zoomAdjustedPixelValueForLength(style.gridRowGap(), style);
2022 case CSSPropertyGridGap: 2030 case CSSPropertyGridGap:
2023 return valuesForShorthandProperty(gridGapShorthand(), style, layoutObjec t, styledNode, allowVisitedStyle); 2031 return valuesForShorthandProperty(gridGapShorthand(), style, layoutObjec t, styledNode, allowVisitedStyle);
2024 2032
2025 case CSSPropertyHeight: 2033 case CSSPropertyHeight:
2026 if (layoutObject) { 2034 if (layoutObject) {
2027 // According to http://www.w3.org/TR/CSS2/visudet.html#the-height-pr operty, 2035 // According to http://www.w3.org/TR/CSS2/visudet.html#the-height-pr operty,
2028 // the "height" property does not apply for non-atomic inline elemen ts. 2036 // the "height" property does not apply for non-atomic inline elemen ts.
2029 if (!layoutObject->isAtomicInlineLevel() && layoutObject->isInline() ) 2037 if (!layoutObject->isAtomicInlineLevel() && layoutObject->isInline() )
2030 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 2038 return CSSIdentifierValue::createIdentifier(CSSValueAuto);
2031 return zoomAdjustedPixelValue(sizingBox(layoutObject).height(), styl e); 2039 return zoomAdjustedPixelValue(sizingBox(layoutObject).height(), styl e);
2032 } 2040 }
2033 return zoomAdjustedPixelValueForLength(style.height(), style); 2041 return zoomAdjustedPixelValueForLength(style.height(), style);
2034 case CSSPropertyWebkitHighlight: 2042 case CSSPropertyWebkitHighlight:
2035 if (style.highlight() == nullAtom) 2043 if (style.highlight() == nullAtom)
2036 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2044 return CSSIdentifierValue::createIdentifier(CSSValueNone);
2037 return CSSStringValue::create(style.highlight()); 2045 return CSSStringValue::create(style.highlight());
2038 case CSSPropertyHyphens: 2046 case CSSPropertyHyphens:
2039 return CSSPrimitiveValue::create(style.getHyphens()); 2047 return CSSIdentifierValue::create(style.getHyphens());
2040 case CSSPropertyWebkitHyphenateCharacter: 2048 case CSSPropertyWebkitHyphenateCharacter:
2041 if (style.hyphenationString().isNull()) 2049 if (style.hyphenationString().isNull())
2042 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 2050 return CSSIdentifierValue::createIdentifier(CSSValueAuto);
2043 return CSSStringValue::create(style.hyphenationString()); 2051 return CSSStringValue::create(style.hyphenationString());
2044 case CSSPropertyImageRendering: 2052 case CSSPropertyImageRendering:
2045 return CSSPrimitiveValue::create(style.imageRendering()); 2053 return CSSIdentifierValue::create(style.imageRendering());
2046 case CSSPropertyImageOrientation: 2054 case CSSPropertyImageOrientation:
2047 if (style.respectImageOrientation() == RespectImageOrientation) 2055 if (style.respectImageOrientation() == RespectImageOrientation)
2048 return CSSPrimitiveValue::createIdentifier(CSSValueFromImage); 2056 return CSSIdentifierValue::createIdentifier(CSSValueFromImage);
2049 return CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::Degrees ); 2057 return CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::Degrees );
2050 case CSSPropertyIsolation: 2058 case CSSPropertyIsolation:
2051 return CSSPrimitiveValue::create(style.isolation()); 2059 return CSSIdentifierValue::create(style.isolation());
2052 case CSSPropertyJustifyItems: 2060 case CSSPropertyJustifyItems:
2053 return valueForItemPositionWithOverflowAlignment(style.justifyItems()); 2061 return valueForItemPositionWithOverflowAlignment(style.justifyItems());
2054 case CSSPropertyJustifySelf: 2062 case CSSPropertyJustifySelf:
2055 return valueForItemPositionWithOverflowAlignment(style.justifySelf()); 2063 return valueForItemPositionWithOverflowAlignment(style.justifySelf());
2056 case CSSPropertyLeft: 2064 case CSSPropertyLeft:
2057 return valueForPositionOffset(style, CSSPropertyLeft, layoutObject); 2065 return valueForPositionOffset(style, CSSPropertyLeft, layoutObject);
2058 case CSSPropertyLetterSpacing: 2066 case CSSPropertyLetterSpacing:
2059 if (!style.letterSpacing()) 2067 if (!style.letterSpacing())
2060 return CSSPrimitiveValue::createIdentifier(CSSValueNormal); 2068 return CSSIdentifierValue::createIdentifier(CSSValueNormal);
2061 return zoomAdjustedPixelValue(style.letterSpacing(), style); 2069 return zoomAdjustedPixelValue(style.letterSpacing(), style);
2062 case CSSPropertyWebkitLineClamp: 2070 case CSSPropertyWebkitLineClamp:
2063 if (style.lineClamp().isNone()) 2071 if (style.lineClamp().isNone())
2064 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2072 return CSSIdentifierValue::createIdentifier(CSSValueNone);
2065 return CSSPrimitiveValue::create(style.lineClamp().value(), style.lineCl amp().isPercentage() ? CSSPrimitiveValue::UnitType::Percentage : CSSPrimitiveVal ue::UnitType::Number); 2073 return CSSPrimitiveValue::create(style.lineClamp().value(), style.lineCl amp().isPercentage() ? CSSPrimitiveValue::UnitType::Percentage : CSSPrimitiveVal ue::UnitType::Number);
2066 case CSSPropertyLineHeight: 2074 case CSSPropertyLineHeight:
2067 return valueForLineHeight(style); 2075 return valueForLineHeight(style);
2068 case CSSPropertyListStyleImage: 2076 case CSSPropertyListStyleImage:
2069 if (style.listStyleImage()) 2077 if (style.listStyleImage())
2070 return style.listStyleImage()->computedCSSValue(); 2078 return style.listStyleImage()->computedCSSValue();
2071 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2079 return CSSIdentifierValue::createIdentifier(CSSValueNone);
2072 case CSSPropertyListStylePosition: 2080 case CSSPropertyListStylePosition:
2073 return CSSPrimitiveValue::create(style.listStylePosition()); 2081 return CSSIdentifierValue::create(style.listStylePosition());
2074 case CSSPropertyListStyleType: 2082 case CSSPropertyListStyleType:
2075 return CSSPrimitiveValue::create(style.listStyleType()); 2083 return CSSIdentifierValue::create(style.listStyleType());
2076 case CSSPropertyWebkitLocale: 2084 case CSSPropertyWebkitLocale:
2077 if (style.locale().isNull()) 2085 if (style.locale().isNull())
2078 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 2086 return CSSIdentifierValue::createIdentifier(CSSValueAuto);
2079 return CSSStringValue::create(style.locale()); 2087 return CSSStringValue::create(style.locale());
2080 case CSSPropertyMarginTop: { 2088 case CSSPropertyMarginTop: {
2081 Length marginTop = style.marginTop(); 2089 Length marginTop = style.marginTop();
2082 if (marginTop.isFixed() || !layoutObject || !layoutObject->isBox()) 2090 if (marginTop.isFixed() || !layoutObject || !layoutObject->isBox())
2083 return zoomAdjustedPixelValueForLength(marginTop, style); 2091 return zoomAdjustedPixelValueForLength(marginTop, style);
2084 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->marginTop(), st yle); 2092 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->marginTop(), st yle);
2085 } 2093 }
2086 case CSSPropertyMarginRight: { 2094 case CSSPropertyMarginRight: {
2087 Length marginRight = style.marginRight(); 2095 Length marginRight = style.marginRight();
2088 if (marginRight.isFixed() || !layoutObject || !layoutObject->isBox()) 2096 if (marginRight.isFixed() || !layoutObject || !layoutObject->isBox())
(...skipping 15 matching lines...) Expand all
2104 return zoomAdjustedPixelValueForLength(marginBottom, style); 2112 return zoomAdjustedPixelValueForLength(marginBottom, style);
2105 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->marginBottom(), style); 2113 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->marginBottom(), style);
2106 } 2114 }
2107 case CSSPropertyMarginLeft: { 2115 case CSSPropertyMarginLeft: {
2108 Length marginLeft = style.marginLeft(); 2116 Length marginLeft = style.marginLeft();
2109 if (marginLeft.isFixed() || !layoutObject || !layoutObject->isBox()) 2117 if (marginLeft.isFixed() || !layoutObject || !layoutObject->isBox())
2110 return zoomAdjustedPixelValueForLength(marginLeft, style); 2118 return zoomAdjustedPixelValueForLength(marginLeft, style);
2111 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->marginLeft(), s tyle); 2119 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->marginLeft(), s tyle);
2112 } 2120 }
2113 case CSSPropertyWebkitUserModify: 2121 case CSSPropertyWebkitUserModify:
2114 return CSSPrimitiveValue::create(style.userModify()); 2122 return CSSIdentifierValue::create(style.userModify());
2115 case CSSPropertyMaxHeight: { 2123 case CSSPropertyMaxHeight: {
2116 const Length& maxHeight = style.maxHeight(); 2124 const Length& maxHeight = style.maxHeight();
2117 if (maxHeight.isMaxSizeNone()) 2125 if (maxHeight.isMaxSizeNone())
2118 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2126 return CSSIdentifierValue::createIdentifier(CSSValueNone);
2119 return zoomAdjustedPixelValueForLength(maxHeight, style); 2127 return zoomAdjustedPixelValueForLength(maxHeight, style);
2120 } 2128 }
2121 case CSSPropertyMaxWidth: { 2129 case CSSPropertyMaxWidth: {
2122 const Length& maxWidth = style.maxWidth(); 2130 const Length& maxWidth = style.maxWidth();
2123 if (maxWidth.isMaxSizeNone()) 2131 if (maxWidth.isMaxSizeNone())
2124 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2132 return CSSIdentifierValue::createIdentifier(CSSValueNone);
2125 return zoomAdjustedPixelValueForLength(maxWidth, style); 2133 return zoomAdjustedPixelValueForLength(maxWidth, style);
2126 } 2134 }
2127 case CSSPropertyMinHeight: 2135 case CSSPropertyMinHeight:
2128 if (style.minHeight().isAuto()) { 2136 if (style.minHeight().isAuto()) {
2129 Node* parent = styledNode->parentNode(); 2137 Node* parent = styledNode->parentNode();
2130 if (isFlexOrGrid(parent ? parent->ensureComputedStyle() : nullptr)) 2138 if (isFlexOrGrid(parent ? parent->ensureComputedStyle() : nullptr))
2131 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 2139 return CSSIdentifierValue::createIdentifier(CSSValueAuto);
2132 return zoomAdjustedPixelValue(0, style); 2140 return zoomAdjustedPixelValue(0, style);
2133 } 2141 }
2134 return zoomAdjustedPixelValueForLength(style.minHeight(), style); 2142 return zoomAdjustedPixelValueForLength(style.minHeight(), style);
2135 case CSSPropertyMinWidth: 2143 case CSSPropertyMinWidth:
2136 if (style.minWidth().isAuto()) { 2144 if (style.minWidth().isAuto()) {
2137 Node* parent = styledNode->parentNode(); 2145 Node* parent = styledNode->parentNode();
2138 if (isFlexOrGrid(parent ? parent->ensureComputedStyle() : nullptr)) 2146 if (isFlexOrGrid(parent ? parent->ensureComputedStyle() : nullptr))
2139 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 2147 return CSSIdentifierValue::createIdentifier(CSSValueAuto);
2140 return zoomAdjustedPixelValue(0, style); 2148 return zoomAdjustedPixelValue(0, style);
2141 } 2149 }
2142 return zoomAdjustedPixelValueForLength(style.minWidth(), style); 2150 return zoomAdjustedPixelValueForLength(style.minWidth(), style);
2143 case CSSPropertyObjectFit: 2151 case CSSPropertyObjectFit:
2144 return CSSPrimitiveValue::create(style.getObjectFit()); 2152 return CSSIdentifierValue::create(style.getObjectFit());
2145 case CSSPropertyObjectPosition: 2153 case CSSPropertyObjectPosition:
2146 return CSSValuePair::create( 2154 return CSSValuePair::create(
2147 zoomAdjustedPixelValueForLength(style.objectPosition().x(), style), 2155 zoomAdjustedPixelValueForLength(style.objectPosition().x(), style),
2148 zoomAdjustedPixelValueForLength(style.objectPosition().y(), style), 2156 zoomAdjustedPixelValueForLength(style.objectPosition().y(), style),
2149 CSSValuePair::KeepIdenticalValues); 2157 CSSValuePair::KeepIdenticalValues);
2150 case CSSPropertyOpacity: 2158 case CSSPropertyOpacity:
2151 return CSSPrimitiveValue::create(style.opacity(), CSSPrimitiveValue::Uni tType::Number); 2159 return CSSPrimitiveValue::create(style.opacity(), CSSPrimitiveValue::Uni tType::Number);
2152 case CSSPropertyOrphans: 2160 case CSSPropertyOrphans:
2153 return CSSPrimitiveValue::create(style.orphans(), CSSPrimitiveValue::Uni tType::Number); 2161 return CSSPrimitiveValue::create(style.orphans(), CSSPrimitiveValue::Uni tType::Number);
2154 case CSSPropertyOutlineColor: 2162 case CSSPropertyOutlineColor:
2155 return allowVisitedStyle ? CSSColorValue::create(style.visitedDependentC olor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style, style.out lineColor()); 2163 return allowVisitedStyle ? CSSColorValue::create(style.visitedDependentC olor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style, style.out lineColor());
2156 case CSSPropertyOutlineOffset: 2164 case CSSPropertyOutlineOffset:
2157 return zoomAdjustedPixelValue(style.outlineOffset(), style); 2165 return zoomAdjustedPixelValue(style.outlineOffset(), style);
2158 case CSSPropertyOutlineStyle: 2166 case CSSPropertyOutlineStyle:
2159 if (style.outlineStyleIsAuto()) 2167 if (style.outlineStyleIsAuto())
2160 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 2168 return CSSIdentifierValue::createIdentifier(CSSValueAuto);
2161 return CSSPrimitiveValue::create(style.outlineStyle()); 2169 return CSSIdentifierValue::create(style.outlineStyle());
2162 case CSSPropertyOutlineWidth: 2170 case CSSPropertyOutlineWidth:
2163 return zoomAdjustedPixelValue(style.outlineWidth(), style); 2171 return zoomAdjustedPixelValue(style.outlineWidth(), style);
2164 case CSSPropertyOverflow: 2172 case CSSPropertyOverflow:
2165 return CSSPrimitiveValue::create(max(style.overflowX(), style.overflowY( ))); 2173 return CSSIdentifierValue::create(max(style.overflowX(), style.overflowY ()));
2166 case CSSPropertyOverflowAnchor: 2174 case CSSPropertyOverflowAnchor:
2167 return CSSPrimitiveValue::create(style.overflowAnchor()); 2175 return CSSIdentifierValue::create(style.overflowAnchor());
2168 case CSSPropertyOverflowWrap: 2176 case CSSPropertyOverflowWrap:
2169 return CSSPrimitiveValue::create(style.overflowWrap()); 2177 return CSSIdentifierValue::create(style.overflowWrap());
2170 case CSSPropertyOverflowX: 2178 case CSSPropertyOverflowX:
2171 return CSSPrimitiveValue::create(style.overflowX()); 2179 return CSSIdentifierValue::create(style.overflowX());
2172 case CSSPropertyOverflowY: 2180 case CSSPropertyOverflowY:
2173 return CSSPrimitiveValue::create(style.overflowY()); 2181 return CSSIdentifierValue::create(style.overflowY());
2174 case CSSPropertyPaddingTop: { 2182 case CSSPropertyPaddingTop: {
2175 Length paddingTop = style.paddingTop(); 2183 Length paddingTop = style.paddingTop();
2176 if (paddingTop.isFixed() || !layoutObject || !layoutObject->isBox()) 2184 if (paddingTop.isFixed() || !layoutObject || !layoutObject->isBox())
2177 return zoomAdjustedPixelValueForLength(paddingTop, style); 2185 return zoomAdjustedPixelValueForLength(paddingTop, style);
2178 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->computedCSSPadd ingTop(), style); 2186 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->computedCSSPadd ingTop(), style);
2179 } 2187 }
2180 case CSSPropertyPaddingRight: { 2188 case CSSPropertyPaddingRight: {
2181 Length paddingRight = style.paddingRight(); 2189 Length paddingRight = style.paddingRight();
2182 if (paddingRight.isFixed() || !layoutObject || !layoutObject->isBox()) 2190 if (paddingRight.isFixed() || !layoutObject || !layoutObject->isBox())
2183 return zoomAdjustedPixelValueForLength(paddingRight, style); 2191 return zoomAdjustedPixelValueForLength(paddingRight, style);
2184 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->computedCSSPadd ingRight(), style); 2192 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->computedCSSPadd ingRight(), style);
2185 } 2193 }
2186 case CSSPropertyPaddingBottom: { 2194 case CSSPropertyPaddingBottom: {
2187 Length paddingBottom = style.paddingBottom(); 2195 Length paddingBottom = style.paddingBottom();
2188 if (paddingBottom.isFixed() || !layoutObject || !layoutObject->isBox()) 2196 if (paddingBottom.isFixed() || !layoutObject || !layoutObject->isBox())
2189 return zoomAdjustedPixelValueForLength(paddingBottom, style); 2197 return zoomAdjustedPixelValueForLength(paddingBottom, style);
2190 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->computedCSSPadd ingBottom(), style); 2198 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->computedCSSPadd ingBottom(), style);
2191 } 2199 }
2192 case CSSPropertyPaddingLeft: { 2200 case CSSPropertyPaddingLeft: {
2193 Length paddingLeft = style.paddingLeft(); 2201 Length paddingLeft = style.paddingLeft();
2194 if (paddingLeft.isFixed() || !layoutObject || !layoutObject->isBox()) 2202 if (paddingLeft.isFixed() || !layoutObject || !layoutObject->isBox())
2195 return zoomAdjustedPixelValueForLength(paddingLeft, style); 2203 return zoomAdjustedPixelValueForLength(paddingLeft, style);
2196 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->computedCSSPadd ingLeft(), style); 2204 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->computedCSSPadd ingLeft(), style);
2197 } 2205 }
2198 case CSSPropertyBreakAfter: 2206 case CSSPropertyBreakAfter:
2199 return CSSPrimitiveValue::create(style.breakAfter()); 2207 return CSSIdentifierValue::create(style.breakAfter());
2200 case CSSPropertyBreakBefore: 2208 case CSSPropertyBreakBefore:
2201 return CSSPrimitiveValue::create(style.breakBefore()); 2209 return CSSIdentifierValue::create(style.breakBefore());
2202 case CSSPropertyBreakInside: 2210 case CSSPropertyBreakInside:
2203 return CSSPrimitiveValue::create(style.breakInside()); 2211 return CSSIdentifierValue::create(style.breakInside());
2204 case CSSPropertyPageBreakAfter: 2212 case CSSPropertyPageBreakAfter:
2205 return CSSPrimitiveValue::create(mapToPageBreakValue(style.breakAfter()) ); 2213 return CSSIdentifierValue::create(mapToPageBreakValue(style.breakAfter() ));
2206 case CSSPropertyPageBreakBefore: 2214 case CSSPropertyPageBreakBefore:
2207 return CSSPrimitiveValue::create(mapToPageBreakValue(style.breakBefore() )); 2215 return CSSIdentifierValue::create(mapToPageBreakValue(style.breakBefore( )));
2208 case CSSPropertyPageBreakInside: 2216 case CSSPropertyPageBreakInside:
2209 return CSSPrimitiveValue::create(mapToPageBreakValue(style.breakInside() )); 2217 return CSSIdentifierValue::create(mapToPageBreakValue(style.breakInside( )));
2210 case CSSPropertyPosition: 2218 case CSSPropertyPosition:
2211 return CSSPrimitiveValue::create(style.position()); 2219 return CSSIdentifierValue::create(style.position());
2212 case CSSPropertyQuotes: 2220 case CSSPropertyQuotes:
2213 if (!style.quotes()) { 2221 if (!style.quotes()) {
2214 // TODO(ramya.v): We should return the quote values that we're actua lly using. 2222 // TODO(ramya.v): We should return the quote values that we're actua lly using.
2215 return nullptr; 2223 return nullptr;
2216 } 2224 }
2217 if (style.quotes()->size()) { 2225 if (style.quotes()->size()) {
2218 CSSValueList* list = CSSValueList::createSpaceSeparated(); 2226 CSSValueList* list = CSSValueList::createSpaceSeparated();
2219 for (int i = 0; i < style.quotes()->size(); i++) { 2227 for (int i = 0; i < style.quotes()->size(); i++) {
2220 list->append(*CSSStringValue::create(style.quotes()->getOpenQuot e(i))); 2228 list->append(*CSSStringValue::create(style.quotes()->getOpenQuot e(i)));
2221 list->append(*CSSStringValue::create(style.quotes()->getCloseQuo te(i))); 2229 list->append(*CSSStringValue::create(style.quotes()->getCloseQuo te(i)));
2222 } 2230 }
2223 return list; 2231 return list;
2224 } 2232 }
2225 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2233 return CSSIdentifierValue::createIdentifier(CSSValueNone);
2226 case CSSPropertyRight: 2234 case CSSPropertyRight:
2227 return valueForPositionOffset(style, CSSPropertyRight, layoutObject); 2235 return valueForPositionOffset(style, CSSPropertyRight, layoutObject);
2228 case CSSPropertyWebkitRubyPosition: 2236 case CSSPropertyWebkitRubyPosition:
2229 return CSSPrimitiveValue::create(style.getRubyPosition()); 2237 return CSSIdentifierValue::create(style.getRubyPosition());
2230 case CSSPropertyScrollBehavior: 2238 case CSSPropertyScrollBehavior:
2231 return CSSPrimitiveValue::create(style.getScrollBehavior()); 2239 return CSSIdentifierValue::create(style.getScrollBehavior());
2232 case CSSPropertyTableLayout: 2240 case CSSPropertyTableLayout:
2233 return CSSPrimitiveValue::create(style.tableLayout()); 2241 return CSSIdentifierValue::create(style.tableLayout());
2234 case CSSPropertyTextAlign: 2242 case CSSPropertyTextAlign:
2235 return CSSPrimitiveValue::create(style.textAlign()); 2243 return CSSIdentifierValue::create(style.textAlign());
2236 case CSSPropertyTextAlignLast: 2244 case CSSPropertyTextAlignLast:
2237 return CSSPrimitiveValue::create(style.getTextAlignLast()); 2245 return CSSIdentifierValue::create(style.getTextAlignLast());
2238 case CSSPropertyTextDecoration: 2246 case CSSPropertyTextDecoration:
2239 if (RuntimeEnabledFeatures::css3TextDecorationsEnabled()) 2247 if (RuntimeEnabledFeatures::css3TextDecorationsEnabled())
2240 return valuesForShorthandProperty(textDecorationShorthand(), style, layoutObject, styledNode, allowVisitedStyle); 2248 return valuesForShorthandProperty(textDecorationShorthand(), style, layoutObject, styledNode, allowVisitedStyle);
2241 // Fall through. 2249 // Fall through.
2242 case CSSPropertyTextDecorationLine: 2250 case CSSPropertyTextDecorationLine:
2243 return renderTextDecorationFlagsToCSSValue(style.getTextDecoration()); 2251 return renderTextDecorationFlagsToCSSValue(style.getTextDecoration());
2244 case CSSPropertyTextDecorationStyle: 2252 case CSSPropertyTextDecorationStyle:
2245 return valueForTextDecorationStyle(style.getTextDecorationStyle()); 2253 return valueForTextDecorationStyle(style.getTextDecorationStyle());
2246 case CSSPropertyTextDecorationColor: 2254 case CSSPropertyTextDecorationColor:
2247 return currentColorOrValidColor(style, style.textDecorationColor()); 2255 return currentColorOrValidColor(style, style.textDecorationColor());
2248 case CSSPropertyTextJustify: 2256 case CSSPropertyTextJustify:
2249 return CSSPrimitiveValue::create(style.getTextJustify()); 2257 return CSSIdentifierValue::create(style.getTextJustify());
2250 case CSSPropertyTextUnderlinePosition: 2258 case CSSPropertyTextUnderlinePosition:
2251 return CSSPrimitiveValue::create(style.getTextUnderlinePosition()); 2259 return CSSIdentifierValue::create(style.getTextUnderlinePosition());
2252 case CSSPropertyWebkitTextDecorationsInEffect: 2260 case CSSPropertyWebkitTextDecorationsInEffect:
2253 return renderTextDecorationFlagsToCSSValue(style.textDecorationsInEffect ()); 2261 return renderTextDecorationFlagsToCSSValue(style.textDecorationsInEffect ());
2254 case CSSPropertyWebkitTextFillColor: 2262 case CSSPropertyWebkitTextFillColor:
2255 return currentColorOrValidColor(style, style.textFillColor()); 2263 return currentColorOrValidColor(style, style.textFillColor());
2256 case CSSPropertyWebkitTextEmphasisColor: 2264 case CSSPropertyWebkitTextEmphasisColor:
2257 return currentColorOrValidColor(style, style.textEmphasisColor()); 2265 return currentColorOrValidColor(style, style.textEmphasisColor());
2258 case CSSPropertyWebkitTextEmphasisPosition: 2266 case CSSPropertyWebkitTextEmphasisPosition:
2259 return CSSPrimitiveValue::create(style.getTextEmphasisPosition()); 2267 return CSSIdentifierValue::create(style.getTextEmphasisPosition());
2260 case CSSPropertyWebkitTextEmphasisStyle: 2268 case CSSPropertyWebkitTextEmphasisStyle:
2261 switch (style.getTextEmphasisMark()) { 2269 switch (style.getTextEmphasisMark()) {
2262 case TextEmphasisMarkNone: 2270 case TextEmphasisMarkNone:
2263 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2271 return CSSIdentifierValue::createIdentifier(CSSValueNone);
2264 case TextEmphasisMarkCustom: 2272 case TextEmphasisMarkCustom:
2265 return CSSStringValue::create(style.textEmphasisCustomMark()); 2273 return CSSStringValue::create(style.textEmphasisCustomMark());
2266 case TextEmphasisMarkAuto: 2274 case TextEmphasisMarkAuto:
2267 ASSERT_NOT_REACHED(); 2275 ASSERT_NOT_REACHED();
2268 // Fall through 2276 // Fall through
2269 case TextEmphasisMarkDot: 2277 case TextEmphasisMarkDot:
2270 case TextEmphasisMarkCircle: 2278 case TextEmphasisMarkCircle:
2271 case TextEmphasisMarkDoubleCircle: 2279 case TextEmphasisMarkDoubleCircle:
2272 case TextEmphasisMarkTriangle: 2280 case TextEmphasisMarkTriangle:
2273 case TextEmphasisMarkSesame: { 2281 case TextEmphasisMarkSesame: {
2274 CSSValueList* list = CSSValueList::createSpaceSeparated(); 2282 CSSValueList* list = CSSValueList::createSpaceSeparated();
2275 list->append(*CSSPrimitiveValue::create(style.getTextEmphasisFill()) ); 2283 list->append(*CSSIdentifierValue::create(style.getTextEmphasisFill() ));
2276 list->append(*CSSPrimitiveValue::create(style.getTextEmphasisMark()) ); 2284 list->append(*CSSIdentifierValue::create(style.getTextEmphasisMark() ));
2277 return list; 2285 return list;
2278 } 2286 }
2279 } 2287 }
2280 case CSSPropertyTextIndent: { 2288 case CSSPropertyTextIndent: {
2281 CSSValueList* list = CSSValueList::createSpaceSeparated(); 2289 CSSValueList* list = CSSValueList::createSpaceSeparated();
2282 list->append(*zoomAdjustedPixelValueForLength(style.textIndent(), style) ); 2290 list->append(*zoomAdjustedPixelValueForLength(style.textIndent(), style) );
2283 if (RuntimeEnabledFeatures::css3TextEnabled() && (style.getTextIndentLin e() == TextIndentEachLine || style.getTextIndentType() == TextIndentHanging)) { 2291 if (RuntimeEnabledFeatures::css3TextEnabled() && (style.getTextIndentLin e() == TextIndentEachLine || style.getTextIndentType() == TextIndentHanging)) {
2284 if (style.getTextIndentLine() == TextIndentEachLine) 2292 if (style.getTextIndentLine() == TextIndentEachLine)
2285 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueEachLi ne)); 2293 list->append(*CSSIdentifierValue::createIdentifier(CSSValueEachL ine));
2286 if (style.getTextIndentType() == TextIndentHanging) 2294 if (style.getTextIndentType() == TextIndentHanging)
2287 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueHangin g)); 2295 list->append(*CSSIdentifierValue::createIdentifier(CSSValueHangi ng));
2288 } 2296 }
2289 return list; 2297 return list;
2290 } 2298 }
2291 case CSSPropertyTextShadow: 2299 case CSSPropertyTextShadow:
2292 return valueForShadowList(style.textShadow(), style, false); 2300 return valueForShadowList(style.textShadow(), style, false);
2293 case CSSPropertyTextRendering: 2301 case CSSPropertyTextRendering:
2294 return CSSPrimitiveValue::create(style.getFontDescription().textRenderin g()); 2302 return CSSIdentifierValue::create(style.getFontDescription().textRenderi ng());
2295 case CSSPropertyTextOverflow: 2303 case CSSPropertyTextOverflow:
2296 if (style.getTextOverflow()) 2304 if (style.getTextOverflow())
2297 return CSSPrimitiveValue::createIdentifier(CSSValueEllipsis); 2305 return CSSIdentifierValue::createIdentifier(CSSValueEllipsis);
2298 return CSSPrimitiveValue::createIdentifier(CSSValueClip); 2306 return CSSIdentifierValue::createIdentifier(CSSValueClip);
2299 case CSSPropertyWebkitTextSecurity: 2307 case CSSPropertyWebkitTextSecurity:
2300 return CSSPrimitiveValue::create(style.textSecurity()); 2308 return CSSIdentifierValue::create(style.textSecurity());
2301 case CSSPropertyWebkitTextStrokeColor: 2309 case CSSPropertyWebkitTextStrokeColor:
2302 return currentColorOrValidColor(style, style.textStrokeColor()); 2310 return currentColorOrValidColor(style, style.textStrokeColor());
2303 case CSSPropertyWebkitTextStrokeWidth: 2311 case CSSPropertyWebkitTextStrokeWidth:
2304 return zoomAdjustedPixelValue(style.textStrokeWidth(), style); 2312 return zoomAdjustedPixelValue(style.textStrokeWidth(), style);
2305 case CSSPropertyTextTransform: 2313 case CSSPropertyTextTransform:
2306 return CSSPrimitiveValue::create(style.textTransform()); 2314 return CSSIdentifierValue::create(style.textTransform());
2307 case CSSPropertyTop: 2315 case CSSPropertyTop:
2308 return valueForPositionOffset(style, CSSPropertyTop, layoutObject); 2316 return valueForPositionOffset(style, CSSPropertyTop, layoutObject);
2309 case CSSPropertyTouchAction: 2317 case CSSPropertyTouchAction:
2310 return touchActionFlagsToCSSValue(style.getTouchAction()); 2318 return touchActionFlagsToCSSValue(style.getTouchAction());
2311 case CSSPropertyUnicodeBidi: 2319 case CSSPropertyUnicodeBidi:
2312 return CSSPrimitiveValue::create(style.unicodeBidi()); 2320 return CSSIdentifierValue::create(style.unicodeBidi());
2313 case CSSPropertyVerticalAlign: 2321 case CSSPropertyVerticalAlign:
2314 switch (style.verticalAlign()) { 2322 switch (style.verticalAlign()) {
2315 case VerticalAlignBaseline: 2323 case VerticalAlignBaseline:
2316 return CSSPrimitiveValue::createIdentifier(CSSValueBaseline); 2324 return CSSIdentifierValue::createIdentifier(CSSValueBaseline);
2317 case VerticalAlignMiddle: 2325 case VerticalAlignMiddle:
2318 return CSSPrimitiveValue::createIdentifier(CSSValueMiddle); 2326 return CSSIdentifierValue::createIdentifier(CSSValueMiddle);
2319 case VerticalAlignSub: 2327 case VerticalAlignSub:
2320 return CSSPrimitiveValue::createIdentifier(CSSValueSub); 2328 return CSSIdentifierValue::createIdentifier(CSSValueSub);
2321 case VerticalAlignSuper: 2329 case VerticalAlignSuper:
2322 return CSSPrimitiveValue::createIdentifier(CSSValueSuper); 2330 return CSSIdentifierValue::createIdentifier(CSSValueSuper);
2323 case VerticalAlignTextTop: 2331 case VerticalAlignTextTop:
2324 return CSSPrimitiveValue::createIdentifier(CSSValueTextTop); 2332 return CSSIdentifierValue::createIdentifier(CSSValueTextTop);
2325 case VerticalAlignTextBottom: 2333 case VerticalAlignTextBottom:
2326 return CSSPrimitiveValue::createIdentifier(CSSValueTextBottom); 2334 return CSSIdentifierValue::createIdentifier(CSSValueTextBottom);
2327 case VerticalAlignTop: 2335 case VerticalAlignTop:
2328 return CSSPrimitiveValue::createIdentifier(CSSValueTop); 2336 return CSSIdentifierValue::createIdentifier(CSSValueTop);
2329 case VerticalAlignBottom: 2337 case VerticalAlignBottom:
2330 return CSSPrimitiveValue::createIdentifier(CSSValueBottom); 2338 return CSSIdentifierValue::createIdentifier(CSSValueBottom);
2331 case VerticalAlignBaselineMiddle: 2339 case VerticalAlignBaselineMiddle:
2332 return CSSPrimitiveValue::createIdentifier(CSSValueWebkitBaselineMid dle); 2340 return CSSIdentifierValue::createIdentifier(CSSValueWebkitBaselineMi ddle);
2333 case VerticalAlignLength: 2341 case VerticalAlignLength:
2334 return zoomAdjustedPixelValueForLength(style.getVerticalAlignLength( ), style); 2342 return zoomAdjustedPixelValueForLength(style.getVerticalAlignLength( ), style);
2335 } 2343 }
2336 ASSERT_NOT_REACHED(); 2344 ASSERT_NOT_REACHED();
2337 return nullptr; 2345 return nullptr;
2338 case CSSPropertyVisibility: 2346 case CSSPropertyVisibility:
2339 return CSSPrimitiveValue::create(style.visibility()); 2347 return CSSIdentifierValue::create(style.visibility());
2340 case CSSPropertyWhiteSpace: 2348 case CSSPropertyWhiteSpace:
2341 return CSSPrimitiveValue::create(style.whiteSpace()); 2349 return CSSIdentifierValue::create(style.whiteSpace());
2342 case CSSPropertyWidows: 2350 case CSSPropertyWidows:
2343 return CSSPrimitiveValue::create(style.widows(), CSSPrimitiveValue::Unit Type::Number); 2351 return CSSPrimitiveValue::create(style.widows(), CSSPrimitiveValue::Unit Type::Number);
2344 case CSSPropertyWidth: 2352 case CSSPropertyWidth:
2345 if (layoutObject) { 2353 if (layoutObject) {
2346 // According to http://www.w3.org/TR/CSS2/visudet.html#the-width-pro perty, 2354 // According to http://www.w3.org/TR/CSS2/visudet.html#the-width-pro perty,
2347 // the "width" property does not apply for non-atomic inline element s. 2355 // the "width" property does not apply for non-atomic inline element s.
2348 if (!layoutObject->isAtomicInlineLevel() && layoutObject->isInline() ) 2356 if (!layoutObject->isAtomicInlineLevel() && layoutObject->isInline() )
2349 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 2357 return CSSIdentifierValue::createIdentifier(CSSValueAuto);
2350 return zoomAdjustedPixelValue(sizingBox(layoutObject).width(), style ); 2358 return zoomAdjustedPixelValue(sizingBox(layoutObject).width(), style );
2351 } 2359 }
2352 return zoomAdjustedPixelValueForLength(style.width(), style); 2360 return zoomAdjustedPixelValueForLength(style.width(), style);
2353 case CSSPropertyWillChange: 2361 case CSSPropertyWillChange:
2354 return valueForWillChange(style.willChangeProperties(), style.willChange Contents(), style.willChangeScrollPosition()); 2362 return valueForWillChange(style.willChangeProperties(), style.willChange Contents(), style.willChangeScrollPosition());
2355 case CSSPropertyWordBreak: 2363 case CSSPropertyWordBreak:
2356 return CSSPrimitiveValue::create(style.wordBreak()); 2364 return CSSIdentifierValue::create(style.wordBreak());
2357 case CSSPropertyWordSpacing: 2365 case CSSPropertyWordSpacing:
2358 return zoomAdjustedPixelValue(style.wordSpacing(), style); 2366 return zoomAdjustedPixelValue(style.wordSpacing(), style);
2359 case CSSPropertyWordWrap: 2367 case CSSPropertyWordWrap:
2360 return CSSPrimitiveValue::create(style.overflowWrap()); 2368 return CSSIdentifierValue::create(style.overflowWrap());
2361 case CSSPropertyWebkitLineBreak: 2369 case CSSPropertyWebkitLineBreak:
2362 return CSSPrimitiveValue::create(style.getLineBreak()); 2370 return CSSIdentifierValue::create(style.getLineBreak());
2363 case CSSPropertyResize: 2371 case CSSPropertyResize:
2364 return CSSPrimitiveValue::create(style.resize()); 2372 return CSSIdentifierValue::create(style.resize());
2365 case CSSPropertyFontKerning: 2373 case CSSPropertyFontKerning:
2366 return CSSPrimitiveValue::create(style.getFontDescription().getKerning() ); 2374 return CSSIdentifierValue::create(style.getFontDescription().getKerning( ));
2367 case CSSPropertyWebkitFontSmoothing: 2375 case CSSPropertyWebkitFontSmoothing:
2368 return CSSPrimitiveValue::create(style.getFontDescription().fontSmoothin g()); 2376 return CSSIdentifierValue::create(style.getFontDescription().fontSmoothi ng());
2369 case CSSPropertyFontVariantLigatures: 2377 case CSSPropertyFontVariantLigatures:
2370 return valueForFontVariantLigatures(style); 2378 return valueForFontVariantLigatures(style);
2371 case CSSPropertyFontVariantCaps: 2379 case CSSPropertyFontVariantCaps:
2372 return valueForFontVariantCaps(style); 2380 return valueForFontVariantCaps(style);
2373 case CSSPropertyFontVariantNumeric: 2381 case CSSPropertyFontVariantNumeric:
2374 return valueForFontVariantNumeric(style); 2382 return valueForFontVariantNumeric(style);
2375 case CSSPropertyZIndex: 2383 case CSSPropertyZIndex:
2376 if (style.hasAutoZIndex()) 2384 if (style.hasAutoZIndex())
2377 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 2385 return CSSIdentifierValue::createIdentifier(CSSValueAuto);
2378 return CSSPrimitiveValue::create(style.zIndex(), CSSPrimitiveValue::Unit Type::Integer); 2386 return CSSPrimitiveValue::create(style.zIndex(), CSSPrimitiveValue::Unit Type::Integer);
2379 case CSSPropertyZoom: 2387 case CSSPropertyZoom:
2380 return CSSPrimitiveValue::create(style.zoom(), CSSPrimitiveValue::UnitTy pe::Number); 2388 return CSSPrimitiveValue::create(style.zoom(), CSSPrimitiveValue::UnitTy pe::Number);
2381 case CSSPropertyBoxSizing: 2389 case CSSPropertyBoxSizing:
2382 if (style.boxSizing() == BoxSizingContentBox) 2390 if (style.boxSizing() == BoxSizingContentBox)
2383 return CSSPrimitiveValue::createIdentifier(CSSValueContentBox); 2391 return CSSIdentifierValue::createIdentifier(CSSValueContentBox);
2384 return CSSPrimitiveValue::createIdentifier(CSSValueBorderBox); 2392 return CSSIdentifierValue::createIdentifier(CSSValueBorderBox);
2385 case CSSPropertyWebkitAppRegion: 2393 case CSSPropertyWebkitAppRegion:
2386 return CSSPrimitiveValue::createIdentifier(style.getDraggableRegionMode( ) == DraggableRegionDrag ? CSSValueDrag : CSSValueNoDrag); 2394 return CSSIdentifierValue::createIdentifier(style.getDraggableRegionMode () == DraggableRegionDrag ? CSSValueDrag : CSSValueNoDrag);
2387 case CSSPropertyAnimationDelay: 2395 case CSSPropertyAnimationDelay:
2388 return valueForAnimationDelay(style.animations()); 2396 return valueForAnimationDelay(style.animations());
2389 case CSSPropertyAnimationDirection: { 2397 case CSSPropertyAnimationDirection: {
2390 CSSValueList* list = CSSValueList::createCommaSeparated(); 2398 CSSValueList* list = CSSValueList::createCommaSeparated();
2391 const CSSAnimationData* animationData = style.animations(); 2399 const CSSAnimationData* animationData = style.animations();
2392 if (animationData) { 2400 if (animationData) {
2393 for (size_t i = 0; i < animationData->directionList().size(); ++i) 2401 for (size_t i = 0; i < animationData->directionList().size(); ++i)
2394 list->append(*valueForAnimationDirection(animationData->directio nList()[i])); 2402 list->append(*valueForAnimationDirection(animationData->directio nList()[i]));
2395 } else { 2403 } else {
2396 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueNormal)); 2404 list->append(*CSSIdentifierValue::createIdentifier(CSSValueNormal));
2397 } 2405 }
2398 return list; 2406 return list;
2399 } 2407 }
2400 case CSSPropertyAnimationDuration: 2408 case CSSPropertyAnimationDuration:
2401 return valueForAnimationDuration(style.animations()); 2409 return valueForAnimationDuration(style.animations());
2402 case CSSPropertyAnimationFillMode: { 2410 case CSSPropertyAnimationFillMode: {
2403 CSSValueList* list = CSSValueList::createCommaSeparated(); 2411 CSSValueList* list = CSSValueList::createCommaSeparated();
2404 const CSSAnimationData* animationData = style.animations(); 2412 const CSSAnimationData* animationData = style.animations();
2405 if (animationData) { 2413 if (animationData) {
2406 for (size_t i = 0; i < animationData->fillModeList().size(); ++i) 2414 for (size_t i = 0; i < animationData->fillModeList().size(); ++i)
2407 list->append(*valueForAnimationFillMode(animationData->fillModeL ist()[i])); 2415 list->append(*valueForAnimationFillMode(animationData->fillModeL ist()[i]));
2408 } else { 2416 } else {
2409 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueNone)); 2417 list->append(*CSSIdentifierValue::createIdentifier(CSSValueNone));
2410 } 2418 }
2411 return list; 2419 return list;
2412 } 2420 }
2413 case CSSPropertyAnimationIterationCount: { 2421 case CSSPropertyAnimationIterationCount: {
2414 CSSValueList* list = CSSValueList::createCommaSeparated(); 2422 CSSValueList* list = CSSValueList::createCommaSeparated();
2415 const CSSAnimationData* animationData = style.animations(); 2423 const CSSAnimationData* animationData = style.animations();
2416 if (animationData) { 2424 if (animationData) {
2417 for (size_t i = 0; i < animationData->iterationCountList().size(); + +i) 2425 for (size_t i = 0; i < animationData->iterationCountList().size(); + +i)
2418 list->append(*valueForAnimationIterationCount(animationData->ite rationCountList()[i])); 2426 list->append(*valueForAnimationIterationCount(animationData->ite rationCountList()[i]));
2419 } else { 2427 } else {
2420 list->append(*CSSPrimitiveValue::create(CSSAnimationData::initialIte rationCount(), CSSPrimitiveValue::UnitType::Number)); 2428 list->append(*CSSPrimitiveValue::create(CSSAnimationData::initialIte rationCount(), CSSPrimitiveValue::UnitType::Number));
2421 } 2429 }
2422 return list; 2430 return list;
2423 } 2431 }
2424 case CSSPropertyAnimationName: { 2432 case CSSPropertyAnimationName: {
2425 CSSValueList* list = CSSValueList::createCommaSeparated(); 2433 CSSValueList* list = CSSValueList::createCommaSeparated();
2426 const CSSAnimationData* animationData = style.animations(); 2434 const CSSAnimationData* animationData = style.animations();
2427 if (animationData) { 2435 if (animationData) {
2428 for (size_t i = 0; i < animationData->nameList().size(); ++i) 2436 for (size_t i = 0; i < animationData->nameList().size(); ++i)
2429 list->append(*CSSCustomIdentValue::create(animationData->nameLis t()[i])); 2437 list->append(*CSSCustomIdentValue::create(animationData->nameLis t()[i]));
2430 } else { 2438 } else {
2431 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueNone)); 2439 list->append(*CSSIdentifierValue::createIdentifier(CSSValueNone));
2432 } 2440 }
2433 return list; 2441 return list;
2434 } 2442 }
2435 case CSSPropertyAnimationPlayState: { 2443 case CSSPropertyAnimationPlayState: {
2436 CSSValueList* list = CSSValueList::createCommaSeparated(); 2444 CSSValueList* list = CSSValueList::createCommaSeparated();
2437 const CSSAnimationData* animationData = style.animations(); 2445 const CSSAnimationData* animationData = style.animations();
2438 if (animationData) { 2446 if (animationData) {
2439 for (size_t i = 0; i < animationData->playStateList().size(); ++i) 2447 for (size_t i = 0; i < animationData->playStateList().size(); ++i)
2440 list->append(*valueForAnimationPlayState(animationData->playStat eList()[i])); 2448 list->append(*valueForAnimationPlayState(animationData->playStat eList()[i]));
2441 } else { 2449 } else {
2442 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueRunning)); 2450 list->append(*CSSIdentifierValue::createIdentifier(CSSValueRunning)) ;
2443 } 2451 }
2444 return list; 2452 return list;
2445 } 2453 }
2446 case CSSPropertyAnimationTimingFunction: 2454 case CSSPropertyAnimationTimingFunction:
2447 return valueForAnimationTimingFunction(style.animations()); 2455 return valueForAnimationTimingFunction(style.animations());
2448 case CSSPropertyAnimation: { 2456 case CSSPropertyAnimation: {
2449 const CSSAnimationData* animationData = style.animations(); 2457 const CSSAnimationData* animationData = style.animations();
2450 if (animationData) { 2458 if (animationData) {
2451 CSSValueList* animationsList = CSSValueList::createCommaSeparated(); 2459 CSSValueList* animationsList = CSSValueList::createCommaSeparated();
2452 for (size_t i = 0; i < animationData->nameList().size(); ++i) { 2460 for (size_t i = 0; i < animationData->nameList().size(); ++i) {
2453 CSSValueList* list = CSSValueList::createSpaceSeparated(); 2461 CSSValueList* list = CSSValueList::createSpaceSeparated();
2454 list->append(*CSSCustomIdentValue::create(animationData->nameLis t()[i])); 2462 list->append(*CSSCustomIdentValue::create(animationData->nameLis t()[i]));
2455 list->append(*CSSPrimitiveValue::create(CSSTimingData::getRepeat ed(animationData->durationList(), i), CSSPrimitiveValue::UnitType::Seconds)); 2463 list->append(*CSSPrimitiveValue::create(CSSTimingData::getRepeat ed(animationData->durationList(), i), CSSPrimitiveValue::UnitType::Seconds));
2456 list->append(*createTimingFunctionValue(CSSTimingData::getRepeat ed(animationData->timingFunctionList(), i).get())); 2464 list->append(*createTimingFunctionValue(CSSTimingData::getRepeat ed(animationData->timingFunctionList(), i).get()));
2457 list->append(*CSSPrimitiveValue::create(CSSTimingData::getRepeat ed(animationData->delayList(), i), CSSPrimitiveValue::UnitType::Seconds)); 2465 list->append(*CSSPrimitiveValue::create(CSSTimingData::getRepeat ed(animationData->delayList(), i), CSSPrimitiveValue::UnitType::Seconds));
2458 list->append(*valueForAnimationIterationCount(CSSTimingData::get Repeated(animationData->iterationCountList(), i))); 2466 list->append(*valueForAnimationIterationCount(CSSTimingData::get Repeated(animationData->iterationCountList(), i)));
2459 list->append(*valueForAnimationDirection(CSSTimingData::getRepea ted(animationData->directionList(), i))); 2467 list->append(*valueForAnimationDirection(CSSTimingData::getRepea ted(animationData->directionList(), i)));
2460 list->append(*valueForAnimationFillMode(CSSTimingData::getRepeat ed(animationData->fillModeList(), i))); 2468 list->append(*valueForAnimationFillMode(CSSTimingData::getRepeat ed(animationData->fillModeList(), i)));
2461 list->append(*valueForAnimationPlayState(CSSTimingData::getRepea ted(animationData->playStateList(), i))); 2469 list->append(*valueForAnimationPlayState(CSSTimingData::getRepea ted(animationData->playStateList(), i)));
2462 animationsList->append(*list); 2470 animationsList->append(*list);
2463 } 2471 }
2464 return animationsList; 2472 return animationsList;
2465 } 2473 }
2466 2474
2467 CSSValueList* list = CSSValueList::createSpaceSeparated(); 2475 CSSValueList* list = CSSValueList::createSpaceSeparated();
2468 // animation-name default value. 2476 // animation-name default value.
2469 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueNone)); 2477 list->append(*CSSIdentifierValue::createIdentifier(CSSValueNone));
2470 list->append(*CSSPrimitiveValue::create(CSSAnimationData::initialDuratio n(), CSSPrimitiveValue::UnitType::Seconds)); 2478 list->append(*CSSPrimitiveValue::create(CSSAnimationData::initialDuratio n(), CSSPrimitiveValue::UnitType::Seconds));
2471 list->append(*createTimingFunctionValue(CSSAnimationData::initialTimingF unction().get())); 2479 list->append(*createTimingFunctionValue(CSSAnimationData::initialTimingF unction().get()));
2472 list->append(*CSSPrimitiveValue::create(CSSAnimationData::initialDelay() , CSSPrimitiveValue::UnitType::Seconds)); 2480 list->append(*CSSPrimitiveValue::create(CSSAnimationData::initialDelay() , CSSPrimitiveValue::UnitType::Seconds));
2473 list->append(*CSSPrimitiveValue::create(CSSAnimationData::initialIterati onCount(), CSSPrimitiveValue::UnitType::Number)); 2481 list->append(*CSSPrimitiveValue::create(CSSAnimationData::initialIterati onCount(), CSSPrimitiveValue::UnitType::Number));
2474 list->append(*valueForAnimationDirection(CSSAnimationData::initialDirect ion())); 2482 list->append(*valueForAnimationDirection(CSSAnimationData::initialDirect ion()));
2475 list->append(*valueForAnimationFillMode(CSSAnimationData::initialFillMod e())); 2483 list->append(*valueForAnimationFillMode(CSSAnimationData::initialFillMod e()));
2476 // Initial animation-play-state. 2484 // Initial animation-play-state.
2477 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueRunning)); 2485 list->append(*CSSIdentifierValue::createIdentifier(CSSValueRunning));
2478 return list; 2486 return list;
2479 } 2487 }
2480 case CSSPropertyWebkitAppearance: 2488 case CSSPropertyWebkitAppearance:
2481 return CSSPrimitiveValue::create(style.appearance()); 2489 return CSSIdentifierValue::create(style.appearance());
2482 case CSSPropertyBackfaceVisibility: 2490 case CSSPropertyBackfaceVisibility:
2483 return CSSPrimitiveValue::createIdentifier((style.backfaceVisibility() = = BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible); 2491 return CSSIdentifierValue::createIdentifier((style.backfaceVisibility() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible);
2484 case CSSPropertyWebkitBorderImage: 2492 case CSSPropertyWebkitBorderImage:
2485 return valueForNinePieceImage(style.borderImage(), style); 2493 return valueForNinePieceImage(style.borderImage(), style);
2486 case CSSPropertyBorderImageOutset: 2494 case CSSPropertyBorderImageOutset:
2487 return valueForNinePieceImageQuad(style.borderImage().outset(), style); 2495 return valueForNinePieceImageQuad(style.borderImage().outset(), style);
2488 case CSSPropertyBorderImageRepeat: 2496 case CSSPropertyBorderImageRepeat:
2489 return valueForNinePieceImageRepeat(style.borderImage()); 2497 return valueForNinePieceImageRepeat(style.borderImage());
2490 case CSSPropertyBorderImageSlice: 2498 case CSSPropertyBorderImageSlice:
2491 return valueForNinePieceImageSlice(style.borderImage()); 2499 return valueForNinePieceImageSlice(style.borderImage());
2492 case CSSPropertyBorderImageWidth: 2500 case CSSPropertyBorderImageWidth:
2493 return valueForNinePieceImageQuad(style.borderImage().borderSlices(), st yle); 2501 return valueForNinePieceImageQuad(style.borderImage().borderSlices(), st yle);
2494 case CSSPropertyWebkitMaskBoxImage: 2502 case CSSPropertyWebkitMaskBoxImage:
2495 return valueForNinePieceImage(style.maskBoxImage(), style); 2503 return valueForNinePieceImage(style.maskBoxImage(), style);
2496 case CSSPropertyWebkitMaskBoxImageOutset: 2504 case CSSPropertyWebkitMaskBoxImageOutset:
2497 return valueForNinePieceImageQuad(style.maskBoxImage().outset(), style); 2505 return valueForNinePieceImageQuad(style.maskBoxImage().outset(), style);
2498 case CSSPropertyWebkitMaskBoxImageRepeat: 2506 case CSSPropertyWebkitMaskBoxImageRepeat:
2499 return valueForNinePieceImageRepeat(style.maskBoxImage()); 2507 return valueForNinePieceImageRepeat(style.maskBoxImage());
2500 case CSSPropertyWebkitMaskBoxImageSlice: 2508 case CSSPropertyWebkitMaskBoxImageSlice:
2501 return valueForNinePieceImageSlice(style.maskBoxImage()); 2509 return valueForNinePieceImageSlice(style.maskBoxImage());
2502 case CSSPropertyWebkitMaskBoxImageWidth: 2510 case CSSPropertyWebkitMaskBoxImageWidth:
2503 return valueForNinePieceImageQuad(style.maskBoxImage().borderSlices(), s tyle); 2511 return valueForNinePieceImageQuad(style.maskBoxImage().borderSlices(), s tyle);
2504 case CSSPropertyWebkitMaskBoxImageSource: 2512 case CSSPropertyWebkitMaskBoxImageSource:
2505 if (style.maskBoxImageSource()) 2513 if (style.maskBoxImageSource())
2506 return style.maskBoxImageSource()->computedCSSValue(); 2514 return style.maskBoxImageSource()->computedCSSValue();
2507 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2515 return CSSIdentifierValue::createIdentifier(CSSValueNone);
2508 case CSSPropertyWebkitFontSizeDelta: 2516 case CSSPropertyWebkitFontSizeDelta:
2509 // Not a real style property -- used by the editing engine -- so has no computed value. 2517 // Not a real style property -- used by the editing engine -- so has no computed value.
2510 return nullptr; 2518 return nullptr;
2511 case CSSPropertyWebkitMarginBottomCollapse: 2519 case CSSPropertyWebkitMarginBottomCollapse:
2512 case CSSPropertyWebkitMarginAfterCollapse: 2520 case CSSPropertyWebkitMarginAfterCollapse:
2513 return CSSPrimitiveValue::create(style.marginAfterCollapse()); 2521 return CSSIdentifierValue::create(style.marginAfterCollapse());
2514 case CSSPropertyWebkitMarginTopCollapse: 2522 case CSSPropertyWebkitMarginTopCollapse:
2515 case CSSPropertyWebkitMarginBeforeCollapse: 2523 case CSSPropertyWebkitMarginBeforeCollapse:
2516 return CSSPrimitiveValue::create(style.marginBeforeCollapse()); 2524 return CSSIdentifierValue::create(style.marginBeforeCollapse());
2517 case CSSPropertyPerspective: 2525 case CSSPropertyPerspective:
2518 if (!style.hasPerspective()) 2526 if (!style.hasPerspective())
2519 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2527 return CSSIdentifierValue::createIdentifier(CSSValueNone);
2520 return zoomAdjustedPixelValue(style.perspective(), style); 2528 return zoomAdjustedPixelValue(style.perspective(), style);
2521 case CSSPropertyPerspectiveOrigin: { 2529 case CSSPropertyPerspectiveOrigin: {
2522 CSSValueList* list = CSSValueList::createSpaceSeparated(); 2530 CSSValueList* list = CSSValueList::createSpaceSeparated();
2523 if (layoutObject) { 2531 if (layoutObject) {
2524 LayoutRect box; 2532 LayoutRect box;
2525 if (layoutObject->isBox()) 2533 if (layoutObject->isBox())
2526 box = toLayoutBox(layoutObject)->borderBoxRect(); 2534 box = toLayoutBox(layoutObject)->borderBoxRect();
2527 2535
2528 list->append(*zoomAdjustedPixelValue(minimumValueForLength(style.per spectiveOriginX(), box.width()), style)); 2536 list->append(*zoomAdjustedPixelValue(minimumValueForLength(style.per spectiveOriginX(), box.width()), style));
2529 list->append(*zoomAdjustedPixelValue(minimumValueForLength(style.per spectiveOriginY(), box.height()), style)); 2537 list->append(*zoomAdjustedPixelValue(minimumValueForLength(style.per spectiveOriginY(), box.height()), style));
2530 } else { 2538 } else {
2531 list->append(*zoomAdjustedPixelValueForLength(style.perspectiveOrigi nX(), style)); 2539 list->append(*zoomAdjustedPixelValueForLength(style.perspectiveOrigi nX(), style));
2532 list->append(*zoomAdjustedPixelValueForLength(style.perspectiveOrigi nY(), style)); 2540 list->append(*zoomAdjustedPixelValueForLength(style.perspectiveOrigi nY(), style));
2533 } 2541 }
2534 return list; 2542 return list;
2535 } 2543 }
2536 case CSSPropertyWebkitRtlOrdering: 2544 case CSSPropertyWebkitRtlOrdering:
2537 return CSSPrimitiveValue::createIdentifier(style.rtlOrdering() ? CSSValu eVisual : CSSValueLogical); 2545 return CSSIdentifierValue::createIdentifier(style.rtlOrdering() ? CSSVal ueVisual : CSSValueLogical);
2538 case CSSPropertyWebkitTapHighlightColor: 2546 case CSSPropertyWebkitTapHighlightColor:
2539 return currentColorOrValidColor(style, style.tapHighlightColor()); 2547 return currentColorOrValidColor(style, style.tapHighlightColor());
2540 case CSSPropertyWebkitUserDrag: 2548 case CSSPropertyWebkitUserDrag:
2541 return CSSPrimitiveValue::create(style.userDrag()); 2549 return CSSIdentifierValue::create(style.userDrag());
2542 case CSSPropertyUserSelect: 2550 case CSSPropertyUserSelect:
2543 return CSSPrimitiveValue::create(style.userSelect()); 2551 return CSSIdentifierValue::create(style.userSelect());
2544 case CSSPropertyBorderBottomLeftRadius: 2552 case CSSPropertyBorderBottomLeftRadius:
2545 return &valueForBorderRadiusCorner(style.borderBottomLeftRadius(), style ); 2553 return &valueForBorderRadiusCorner(style.borderBottomLeftRadius(), style );
2546 case CSSPropertyBorderBottomRightRadius: 2554 case CSSPropertyBorderBottomRightRadius:
2547 return &valueForBorderRadiusCorner(style.borderBottomRightRadius(), styl e); 2555 return &valueForBorderRadiusCorner(style.borderBottomRightRadius(), styl e);
2548 case CSSPropertyBorderTopLeftRadius: 2556 case CSSPropertyBorderTopLeftRadius:
2549 return &valueForBorderRadiusCorner(style.borderTopLeftRadius(), style); 2557 return &valueForBorderRadiusCorner(style.borderTopLeftRadius(), style);
2550 case CSSPropertyBorderTopRightRadius: 2558 case CSSPropertyBorderTopRightRadius:
2551 return &valueForBorderRadiusCorner(style.borderTopRightRadius(), style); 2559 return &valueForBorderRadiusCorner(style.borderTopRightRadius(), style);
2552 case CSSPropertyClip: { 2560 case CSSPropertyClip: {
2553 if (style.hasAutoClip()) 2561 if (style.hasAutoClip())
2554 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 2562 return CSSIdentifierValue::createIdentifier(CSSValueAuto);
2555 CSSPrimitiveValue* top = style.clip().top().isAuto() 2563 CSSValue* top = zoomAdjustedPixelValueOrAuto(style.clip().top(), style);
2556 ? CSSPrimitiveValue::createIdentifier(CSSValueAuto) 2564 CSSValue* right = zoomAdjustedPixelValueOrAuto(style.clip().right(), sty le);
2557 : zoomAdjustedPixelValue(style.clip().top().value(), style); 2565 CSSValue* bottom = zoomAdjustedPixelValueOrAuto(style.clip().bottom(), s tyle);
2558 CSSPrimitiveValue* right = style.clip().right().isAuto() 2566 CSSValue* left = zoomAdjustedPixelValueOrAuto(style.clip().left(), style );
2559 ? CSSPrimitiveValue::createIdentifier(CSSValueAuto)
2560 : zoomAdjustedPixelValue(style.clip().right().value(), style);
2561 CSSPrimitiveValue* bottom = style.clip().bottom().isAuto()
2562 ? CSSPrimitiveValue::createIdentifier(CSSValueAuto)
2563 : zoomAdjustedPixelValue(style.clip().bottom().value(), style);
2564 CSSPrimitiveValue* left = style.clip().left().isAuto()
2565 ? CSSPrimitiveValue::createIdentifier(CSSValueAuto)
2566 : zoomAdjustedPixelValue(style.clip().left().value(), style);
2567 return CSSQuadValue::create(top, right, bottom, left, CSSQuadValue::Seri alizeAsRect); 2567 return CSSQuadValue::create(top, right, bottom, left, CSSQuadValue::Seri alizeAsRect);
2568 } 2568 }
2569 case CSSPropertySpeak: 2569 case CSSPropertySpeak:
2570 return CSSPrimitiveValue::create(style.speak()); 2570 return CSSIdentifierValue::create(style.speak());
2571 case CSSPropertyTransform: 2571 case CSSPropertyTransform:
2572 return computedTransform(layoutObject, style); 2572 return computedTransform(layoutObject, style);
2573 case CSSPropertyTransformOrigin: { 2573 case CSSPropertyTransformOrigin: {
2574 CSSValueList* list = CSSValueList::createSpaceSeparated(); 2574 CSSValueList* list = CSSValueList::createSpaceSeparated();
2575 if (layoutObject) { 2575 if (layoutObject) {
2576 LayoutRect box; 2576 LayoutRect box;
2577 if (layoutObject->isBox()) 2577 if (layoutObject->isBox())
2578 box = toLayoutBox(layoutObject)->borderBoxRect(); 2578 box = toLayoutBox(layoutObject)->borderBoxRect();
2579 2579
2580 list->append(*zoomAdjustedPixelValue(minimumValueForLength(style.tra nsformOriginX(), box.width()), style)); 2580 list->append(*zoomAdjustedPixelValue(minimumValueForLength(style.tra nsformOriginX(), box.width()), style));
2581 list->append(*zoomAdjustedPixelValue(minimumValueForLength(style.tra nsformOriginY(), box.height()), style)); 2581 list->append(*zoomAdjustedPixelValue(minimumValueForLength(style.tra nsformOriginY(), box.height()), style));
2582 if (style.transformOriginZ() != 0) 2582 if (style.transformOriginZ() != 0)
2583 list->append(*zoomAdjustedPixelValue(style.transformOriginZ(), s tyle)); 2583 list->append(*zoomAdjustedPixelValue(style.transformOriginZ(), s tyle));
2584 } else { 2584 } else {
2585 list->append(*zoomAdjustedPixelValueForLength(style.transformOriginX (), style)); 2585 list->append(*zoomAdjustedPixelValueForLength(style.transformOriginX (), style));
2586 list->append(*zoomAdjustedPixelValueForLength(style.transformOriginY (), style)); 2586 list->append(*zoomAdjustedPixelValueForLength(style.transformOriginY (), style));
2587 if (style.transformOriginZ() != 0) 2587 if (style.transformOriginZ() != 0)
2588 list->append(*zoomAdjustedPixelValue(style.transformOriginZ(), s tyle)); 2588 list->append(*zoomAdjustedPixelValue(style.transformOriginZ(), s tyle));
2589 } 2589 }
2590 return list; 2590 return list;
2591 } 2591 }
2592 case CSSPropertyTransformStyle: 2592 case CSSPropertyTransformStyle:
2593 return CSSPrimitiveValue::createIdentifier((style.transformStyle3D() == TransformStyle3DPreserve3D) ? CSSValuePreserve3d : CSSValueFlat); 2593 return CSSIdentifierValue::createIdentifier((style.transformStyle3D() == TransformStyle3DPreserve3D) ? CSSValuePreserve3d : CSSValueFlat);
2594 case CSSPropertyTransitionDelay: 2594 case CSSPropertyTransitionDelay:
2595 return valueForAnimationDelay(style.transitions()); 2595 return valueForAnimationDelay(style.transitions());
2596 case CSSPropertyTransitionDuration: 2596 case CSSPropertyTransitionDuration:
2597 return valueForAnimationDuration(style.transitions()); 2597 return valueForAnimationDuration(style.transitions());
2598 case CSSPropertyTransitionProperty: 2598 case CSSPropertyTransitionProperty:
2599 return valueForTransitionProperty(style.transitions()); 2599 return valueForTransitionProperty(style.transitions());
2600 case CSSPropertyTransitionTimingFunction: 2600 case CSSPropertyTransitionTimingFunction:
2601 return valueForAnimationTimingFunction(style.transitions()); 2601 return valueForAnimationTimingFunction(style.transitions());
2602 case CSSPropertyTransition: { 2602 case CSSPropertyTransition: {
2603 const CSSTransitionData* transitionData = style.transitions(); 2603 const CSSTransitionData* transitionData = style.transitions();
2604 if (transitionData) { 2604 if (transitionData) {
2605 CSSValueList* transitionsList = CSSValueList::createCommaSeparated() ; 2605 CSSValueList* transitionsList = CSSValueList::createCommaSeparated() ;
2606 for (size_t i = 0; i < transitionData->propertyList().size(); ++i) { 2606 for (size_t i = 0; i < transitionData->propertyList().size(); ++i) {
2607 CSSValueList* list = CSSValueList::createSpaceSeparated(); 2607 CSSValueList* list = CSSValueList::createSpaceSeparated();
2608 list->append(*createTransitionPropertyValue(transitionData->prop ertyList()[i])); 2608 list->append(*createTransitionPropertyValue(transitionData->prop ertyList()[i]));
2609 list->append(*CSSPrimitiveValue::create(CSSTimingData::getRepeat ed(transitionData->durationList(), i), CSSPrimitiveValue::UnitType::Seconds)); 2609 list->append(*CSSPrimitiveValue::create(CSSTimingData::getRepeat ed(transitionData->durationList(), i), CSSPrimitiveValue::UnitType::Seconds));
2610 list->append(*createTimingFunctionValue(CSSTimingData::getRepeat ed(transitionData->timingFunctionList(), i).get())); 2610 list->append(*createTimingFunctionValue(CSSTimingData::getRepeat ed(transitionData->timingFunctionList(), i).get()));
2611 list->append(*CSSPrimitiveValue::create(CSSTimingData::getRepeat ed(transitionData->delayList(), i), CSSPrimitiveValue::UnitType::Seconds)); 2611 list->append(*CSSPrimitiveValue::create(CSSTimingData::getRepeat ed(transitionData->delayList(), i), CSSPrimitiveValue::UnitType::Seconds));
2612 transitionsList->append(*list); 2612 transitionsList->append(*list);
2613 } 2613 }
2614 return transitionsList; 2614 return transitionsList;
2615 } 2615 }
2616 2616
2617 CSSValueList* list = CSSValueList::createSpaceSeparated(); 2617 CSSValueList* list = CSSValueList::createSpaceSeparated();
2618 // transition-property default value. 2618 // transition-property default value.
2619 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueAll)); 2619 list->append(*CSSIdentifierValue::createIdentifier(CSSValueAll));
2620 list->append(*CSSPrimitiveValue::create(CSSTransitionData::initialDurati on(), CSSPrimitiveValue::UnitType::Seconds)); 2620 list->append(*CSSPrimitiveValue::create(CSSTransitionData::initialDurati on(), CSSPrimitiveValue::UnitType::Seconds));
2621 list->append(*createTimingFunctionValue(CSSTransitionData::initialTiming Function().get())); 2621 list->append(*createTimingFunctionValue(CSSTransitionData::initialTiming Function().get()));
2622 list->append(*CSSPrimitiveValue::create(CSSTransitionData::initialDelay( ), CSSPrimitiveValue::UnitType::Seconds)); 2622 list->append(*CSSPrimitiveValue::create(CSSTransitionData::initialDelay( ), CSSPrimitiveValue::UnitType::Seconds));
2623 return list; 2623 return list;
2624 } 2624 }
2625 case CSSPropertyPointerEvents: 2625 case CSSPropertyPointerEvents:
2626 return CSSPrimitiveValue::create(style.pointerEvents()); 2626 return CSSIdentifierValue::create(style.pointerEvents());
2627 case CSSPropertyWritingMode: 2627 case CSSPropertyWritingMode:
2628 case CSSPropertyWebkitWritingMode: 2628 case CSSPropertyWebkitWritingMode:
2629 return CSSPrimitiveValue::create(style.getWritingMode()); 2629 return CSSIdentifierValue::create(style.getWritingMode());
2630 case CSSPropertyWebkitTextCombine: 2630 case CSSPropertyWebkitTextCombine:
2631 if (style.getTextCombine() == TextCombineAll) 2631 if (style.getTextCombine() == TextCombineAll)
2632 return CSSPrimitiveValue::createIdentifier(CSSValueHorizontal); 2632 return CSSIdentifierValue::createIdentifier(CSSValueHorizontal);
2633 case CSSPropertyTextCombineUpright: 2633 case CSSPropertyTextCombineUpright:
2634 return CSSPrimitiveValue::create(style.getTextCombine()); 2634 return CSSIdentifierValue::create(style.getTextCombine());
2635 case CSSPropertyWebkitTextOrientation: 2635 case CSSPropertyWebkitTextOrientation:
2636 if (style.getTextOrientation() == TextOrientationMixed) 2636 if (style.getTextOrientation() == TextOrientationMixed)
2637 return CSSPrimitiveValue::createIdentifier(CSSValueVerticalRight); 2637 return CSSIdentifierValue::createIdentifier(CSSValueVerticalRight);
2638 case CSSPropertyTextOrientation: 2638 case CSSPropertyTextOrientation:
2639 return CSSPrimitiveValue::create(style.getTextOrientation()); 2639 return CSSIdentifierValue::create(style.getTextOrientation());
2640 case CSSPropertyContent: 2640 case CSSPropertyContent:
2641 return valueForContentData(style); 2641 return valueForContentData(style);
2642 case CSSPropertyCounterIncrement: 2642 case CSSPropertyCounterIncrement:
2643 return valueForCounterDirectives(style, propertyID); 2643 return valueForCounterDirectives(style, propertyID);
2644 case CSSPropertyCounterReset: 2644 case CSSPropertyCounterReset:
2645 return valueForCounterDirectives(style, propertyID); 2645 return valueForCounterDirectives(style, propertyID);
2646 case CSSPropertyClipPath: 2646 case CSSPropertyClipPath:
2647 if (ClipPathOperation* operation = style.clipPath()) { 2647 if (ClipPathOperation* operation = style.clipPath()) {
2648 if (operation->type() == ClipPathOperation::SHAPE) 2648 if (operation->type() == ClipPathOperation::SHAPE)
2649 return valueForBasicShape(style, toShapeClipPathOperation(operat ion)->basicShape()); 2649 return valueForBasicShape(style, toShapeClipPathOperation(operat ion)->basicShape());
2650 if (operation->type() == ClipPathOperation::REFERENCE) 2650 if (operation->type() == ClipPathOperation::REFERENCE)
2651 return CSSURIValue::create(toReferenceClipPathOperation(operatio n)->url()); 2651 return CSSURIValue::create(toReferenceClipPathOperation(operatio n)->url());
2652 } 2652 }
2653 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2653 return CSSIdentifierValue::createIdentifier(CSSValueNone);
2654 case CSSPropertyShapeMargin: 2654 case CSSPropertyShapeMargin:
2655 return CSSPrimitiveValue::create(style.shapeMargin(), style.effectiveZoo m()); 2655 return CSSValue::create(style.shapeMargin(), style.effectiveZoom());
2656 case CSSPropertyShapeImageThreshold: 2656 case CSSPropertyShapeImageThreshold:
2657 return CSSPrimitiveValue::create(style.shapeImageThreshold(), CSSPrimiti veValue::UnitType::Number); 2657 return CSSPrimitiveValue::create(style.shapeImageThreshold(), CSSPrimiti veValue::UnitType::Number);
2658 case CSSPropertyShapeOutside: 2658 case CSSPropertyShapeOutside:
2659 return valueForShape(style, style.shapeOutside()); 2659 return valueForShape(style, style.shapeOutside());
2660 case CSSPropertyFilter: 2660 case CSSPropertyFilter:
2661 return valueForFilter(style, style.filter()); 2661 return valueForFilter(style, style.filter());
2662 case CSSPropertyBackdropFilter: 2662 case CSSPropertyBackdropFilter:
2663 return valueForFilter(style, style.backdropFilter()); 2663 return valueForFilter(style, style.backdropFilter());
2664 case CSSPropertyMixBlendMode: 2664 case CSSPropertyMixBlendMode:
2665 return CSSPrimitiveValue::create(style.blendMode()); 2665 return CSSIdentifierValue::create(style.blendMode());
2666 2666
2667 case CSSPropertyBackgroundBlendMode: { 2667 case CSSPropertyBackgroundBlendMode: {
2668 CSSValueList* list = CSSValueList::createCommaSeparated(); 2668 CSSValueList* list = CSSValueList::createCommaSeparated();
2669 for (const FillLayer* currLayer = &style.backgroundLayers(); currLayer; currLayer = currLayer->next()) 2669 for (const FillLayer* currLayer = &style.backgroundLayers(); currLayer; currLayer = currLayer->next())
2670 list->append(*CSSPrimitiveValue::create(currLayer->blendMode())); 2670 list->append(*CSSIdentifierValue::create(currLayer->blendMode()));
2671 return list; 2671 return list;
2672 } 2672 }
2673 case CSSPropertyBackground: 2673 case CSSPropertyBackground:
2674 return valuesForBackgroundShorthand(style, layoutObject, styledNode, all owVisitedStyle); 2674 return valuesForBackgroundShorthand(style, layoutObject, styledNode, all owVisitedStyle);
2675 case CSSPropertyBorder: { 2675 case CSSPropertyBorder: {
2676 const CSSValue* value = get(CSSPropertyBorderTop, style, layoutObject, s tyledNode, allowVisitedStyle); 2676 const CSSValue* value = get(CSSPropertyBorderTop, style, layoutObject, s tyledNode, allowVisitedStyle);
2677 const CSSPropertyID properties[] = { 2677 const CSSPropertyID properties[] = {
2678 CSSPropertyBorderRight, 2678 CSSPropertyBorderRight,
2679 CSSPropertyBorderBottom, 2679 CSSPropertyBorderBottom,
2680 CSSPropertyBorderLeft 2680 CSSPropertyBorderLeft
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2719 case CSSPropertyBackgroundRepeatX: 2719 case CSSPropertyBackgroundRepeatX:
2720 case CSSPropertyBackgroundRepeatY: 2720 case CSSPropertyBackgroundRepeatY:
2721 return nullptr; 2721 return nullptr;
2722 2722
2723 case CSSPropertyMotion: 2723 case CSSPropertyMotion:
2724 return valuesForShorthandProperty(motionShorthand(), style, layoutObject , styledNode, allowVisitedStyle); 2724 return valuesForShorthandProperty(motionShorthand(), style, layoutObject , styledNode, allowVisitedStyle);
2725 2725
2726 case CSSPropertyMotionPath: 2726 case CSSPropertyMotionPath:
2727 if (const StylePath* styleMotionPath = style.motionPath()) 2727 if (const StylePath* styleMotionPath = style.motionPath())
2728 return styleMotionPath->computedCSSValue(); 2728 return styleMotionPath->computedCSSValue();
2729 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2729 return CSSIdentifierValue::createIdentifier(CSSValueNone);
2730 2730
2731 case CSSPropertyMotionOffset: 2731 case CSSPropertyMotionOffset:
2732 return zoomAdjustedPixelValueForLength(style.motionOffset(), style); 2732 return zoomAdjustedPixelValueForLength(style.motionOffset(), style);
2733 2733
2734 case CSSPropertyMotionRotation: { 2734 case CSSPropertyMotionRotation: {
2735 CSSValueList* list = CSSValueList::createSpaceSeparated(); 2735 CSSValueList* list = CSSValueList::createSpaceSeparated();
2736 if (style.motionRotation().type == MotionRotationAuto) 2736 if (style.motionRotation().type == MotionRotationAuto)
2737 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueAuto)); 2737 list->append(*CSSIdentifierValue::createIdentifier(CSSValueAuto));
2738 list->append(*CSSPrimitiveValue::create(style.motionRotation().angle, CS SPrimitiveValue::UnitType::Degrees)); 2738 list->append(*CSSPrimitiveValue::create(style.motionRotation().angle, CS SPrimitiveValue::UnitType::Degrees));
2739 return list; 2739 return list;
2740 } 2740 }
2741 2741
2742 // Unimplemented CSS 3 properties (including CSS3 shorthand properties). 2742 // Unimplemented CSS 3 properties (including CSS3 shorthand properties).
2743 case CSSPropertyWebkitTextEmphasis: 2743 case CSSPropertyWebkitTextEmphasis:
2744 return nullptr; 2744 return nullptr;
2745 2745
2746 // Directional properties are resolved by resolveDirectionAwareProperty() be fore the switch. 2746 // Directional properties are resolved by resolveDirectionAwareProperty() be fore the switch.
2747 case CSSPropertyWebkitBorderEnd: 2747 case CSSPropertyWebkitBorderEnd:
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2802 2802
2803 // @viewport rule properties. 2803 // @viewport rule properties.
2804 case CSSPropertyMaxZoom: 2804 case CSSPropertyMaxZoom:
2805 case CSSPropertyMinZoom: 2805 case CSSPropertyMinZoom:
2806 case CSSPropertyOrientation: 2806 case CSSPropertyOrientation:
2807 case CSSPropertyUserZoom: 2807 case CSSPropertyUserZoom:
2808 return nullptr; 2808 return nullptr;
2809 2809
2810 // SVG properties. 2810 // SVG properties.
2811 case CSSPropertyClipRule: 2811 case CSSPropertyClipRule:
2812 return CSSPrimitiveValue::create(svgStyle.clipRule()); 2812 return CSSIdentifierValue::create(svgStyle.clipRule());
2813 case CSSPropertyFloodOpacity: 2813 case CSSPropertyFloodOpacity:
2814 return CSSPrimitiveValue::create(svgStyle.floodOpacity(), CSSPrimitiveVa lue::UnitType::Number); 2814 return CSSPrimitiveValue::create(svgStyle.floodOpacity(), CSSPrimitiveVa lue::UnitType::Number);
2815 case CSSPropertyStopOpacity: 2815 case CSSPropertyStopOpacity:
2816 return CSSPrimitiveValue::create(svgStyle.stopOpacity(), CSSPrimitiveVal ue::UnitType::Number); 2816 return CSSPrimitiveValue::create(svgStyle.stopOpacity(), CSSPrimitiveVal ue::UnitType::Number);
2817 case CSSPropertyColorInterpolation: 2817 case CSSPropertyColorInterpolation:
2818 return CSSPrimitiveValue::create(svgStyle.colorInterpolation()); 2818 return CSSIdentifierValue::create(svgStyle.colorInterpolation());
2819 case CSSPropertyColorInterpolationFilters: 2819 case CSSPropertyColorInterpolationFilters:
2820 return CSSPrimitiveValue::create(svgStyle.colorInterpolationFilters()); 2820 return CSSIdentifierValue::create(svgStyle.colorInterpolationFilters());
2821 case CSSPropertyFillOpacity: 2821 case CSSPropertyFillOpacity:
2822 return CSSPrimitiveValue::create(svgStyle.fillOpacity(), CSSPrimitiveVal ue::UnitType::Number); 2822 return CSSPrimitiveValue::create(svgStyle.fillOpacity(), CSSPrimitiveVal ue::UnitType::Number);
2823 case CSSPropertyFillRule: 2823 case CSSPropertyFillRule:
2824 return CSSPrimitiveValue::create(svgStyle.fillRule()); 2824 return CSSIdentifierValue::create(svgStyle.fillRule());
2825 case CSSPropertyColorRendering: 2825 case CSSPropertyColorRendering:
2826 return CSSPrimitiveValue::create(svgStyle.colorRendering()); 2826 return CSSIdentifierValue::create(svgStyle.colorRendering());
2827 case CSSPropertyShapeRendering: 2827 case CSSPropertyShapeRendering:
2828 return CSSPrimitiveValue::create(svgStyle.shapeRendering()); 2828 return CSSIdentifierValue::create(svgStyle.shapeRendering());
2829 case CSSPropertyStrokeLinecap: 2829 case CSSPropertyStrokeLinecap:
2830 return CSSPrimitiveValue::create(svgStyle.capStyle()); 2830 return CSSIdentifierValue::create(svgStyle.capStyle());
2831 case CSSPropertyStrokeLinejoin: 2831 case CSSPropertyStrokeLinejoin:
2832 return CSSPrimitiveValue::create(svgStyle.joinStyle()); 2832 return CSSIdentifierValue::create(svgStyle.joinStyle());
2833 case CSSPropertyStrokeMiterlimit: 2833 case CSSPropertyStrokeMiterlimit:
2834 return CSSPrimitiveValue::create(svgStyle.strokeMiterLimit(), CSSPrimiti veValue::UnitType::Number); 2834 return CSSPrimitiveValue::create(svgStyle.strokeMiterLimit(), CSSPrimiti veValue::UnitType::Number);
2835 case CSSPropertyStrokeOpacity: 2835 case CSSPropertyStrokeOpacity:
2836 return CSSPrimitiveValue::create(svgStyle.strokeOpacity(), CSSPrimitiveV alue::UnitType::Number); 2836 return CSSPrimitiveValue::create(svgStyle.strokeOpacity(), CSSPrimitiveV alue::UnitType::Number);
2837 case CSSPropertyAlignmentBaseline: 2837 case CSSPropertyAlignmentBaseline:
2838 return CSSPrimitiveValue::create(svgStyle.alignmentBaseline()); 2838 return CSSIdentifierValue::create(svgStyle.alignmentBaseline());
2839 case CSSPropertyDominantBaseline: 2839 case CSSPropertyDominantBaseline:
2840 return CSSPrimitiveValue::create(svgStyle.dominantBaseline()); 2840 return CSSIdentifierValue::create(svgStyle.dominantBaseline());
2841 case CSSPropertyTextAnchor: 2841 case CSSPropertyTextAnchor:
2842 return CSSPrimitiveValue::create(svgStyle.textAnchor()); 2842 return CSSIdentifierValue::create(svgStyle.textAnchor());
2843 case CSSPropertyMask: 2843 case CSSPropertyMask:
2844 if (!svgStyle.maskerResource().isEmpty()) 2844 if (!svgStyle.maskerResource().isEmpty())
2845 return CSSURIValue::create(serializeAsFragmentIdentifier(svgStyle.ma skerResource())); 2845 return CSSURIValue::create(serializeAsFragmentIdentifier(svgStyle.ma skerResource()));
2846 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2846 return CSSIdentifierValue::createIdentifier(CSSValueNone);
2847 case CSSPropertyFloodColor: 2847 case CSSPropertyFloodColor:
2848 return currentColorOrValidColor(style, svgStyle.floodColor()); 2848 return currentColorOrValidColor(style, svgStyle.floodColor());
2849 case CSSPropertyLightingColor: 2849 case CSSPropertyLightingColor:
2850 return currentColorOrValidColor(style, svgStyle.lightingColor()); 2850 return currentColorOrValidColor(style, svgStyle.lightingColor());
2851 case CSSPropertyStopColor: 2851 case CSSPropertyStopColor:
2852 return currentColorOrValidColor(style, svgStyle.stopColor()); 2852 return currentColorOrValidColor(style, svgStyle.stopColor());
2853 case CSSPropertyFill: 2853 case CSSPropertyFill:
2854 return adjustSVGPaintForCurrentColor(svgStyle.fillPaintType(), svgStyle. fillPaintUri(), svgStyle.fillPaintColor(), style.color()); 2854 return adjustSVGPaintForCurrentColor(svgStyle.fillPaintType(), svgStyle. fillPaintUri(), svgStyle.fillPaintColor(), style.color());
2855 case CSSPropertyMarkerEnd: 2855 case CSSPropertyMarkerEnd:
2856 if (!svgStyle.markerEndResource().isEmpty()) 2856 if (!svgStyle.markerEndResource().isEmpty())
2857 return CSSURIValue::create(serializeAsFragmentIdentifier(svgStyle.ma rkerEndResource())); 2857 return CSSURIValue::create(serializeAsFragmentIdentifier(svgStyle.ma rkerEndResource()));
2858 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2858 return CSSIdentifierValue::createIdentifier(CSSValueNone);
2859 case CSSPropertyMarkerMid: 2859 case CSSPropertyMarkerMid:
2860 if (!svgStyle.markerMidResource().isEmpty()) 2860 if (!svgStyle.markerMidResource().isEmpty())
2861 return CSSURIValue::create(serializeAsFragmentIdentifier(svgStyle.ma rkerMidResource())); 2861 return CSSURIValue::create(serializeAsFragmentIdentifier(svgStyle.ma rkerMidResource()));
2862 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2862 return CSSIdentifierValue::createIdentifier(CSSValueNone);
2863 case CSSPropertyMarkerStart: 2863 case CSSPropertyMarkerStart:
2864 if (!svgStyle.markerStartResource().isEmpty()) 2864 if (!svgStyle.markerStartResource().isEmpty())
2865 return CSSURIValue::create(serializeAsFragmentIdentifier(svgStyle.ma rkerStartResource())); 2865 return CSSURIValue::create(serializeAsFragmentIdentifier(svgStyle.ma rkerStartResource()));
2866 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2866 return CSSIdentifierValue::createIdentifier(CSSValueNone);
2867 case CSSPropertyStroke: 2867 case CSSPropertyStroke:
2868 return adjustSVGPaintForCurrentColor(svgStyle.strokePaintType(), svgStyl e.strokePaintUri(), svgStyle.strokePaintColor(), style.color()); 2868 return adjustSVGPaintForCurrentColor(svgStyle.strokePaintType(), svgStyl e.strokePaintUri(), svgStyle.strokePaintColor(), style.color());
2869 case CSSPropertyStrokeDasharray: 2869 case CSSPropertyStrokeDasharray:
2870 return strokeDashArrayToCSSValueList(*svgStyle.strokeDashArray(), style) ; 2870 return strokeDashArrayToCSSValueList(*svgStyle.strokeDashArray(), style) ;
2871 case CSSPropertyStrokeDashoffset: 2871 case CSSPropertyStrokeDashoffset:
2872 return zoomAdjustedPixelValueForLength(svgStyle.strokeDashOffset(), styl e); 2872 return zoomAdjustedPixelValueForLength(svgStyle.strokeDashOffset(), styl e);
2873 case CSSPropertyStrokeWidth: 2873 case CSSPropertyStrokeWidth:
2874 return pixelValueForUnzoomedLength(svgStyle.strokeWidth(), style); 2874 return pixelValueForUnzoomedLength(svgStyle.strokeWidth(), style);
2875 case CSSPropertyBaselineShift: { 2875 case CSSPropertyBaselineShift: {
2876 switch (svgStyle.baselineShift()) { 2876 switch (svgStyle.baselineShift()) {
2877 case BS_SUPER: 2877 case BS_SUPER:
2878 return CSSPrimitiveValue::createIdentifier(CSSValueSuper); 2878 return CSSIdentifierValue::createIdentifier(CSSValueSuper);
2879 case BS_SUB: 2879 case BS_SUB:
2880 return CSSPrimitiveValue::createIdentifier(CSSValueSub); 2880 return CSSIdentifierValue::createIdentifier(CSSValueSub);
2881 case BS_LENGTH: 2881 case BS_LENGTH:
2882 return zoomAdjustedPixelValueForLength(svgStyle.baselineShiftValue() , style); 2882 return zoomAdjustedPixelValueForLength(svgStyle.baselineShiftValue() , style);
2883 } 2883 }
2884 ASSERT_NOT_REACHED(); 2884 ASSERT_NOT_REACHED();
2885 return nullptr; 2885 return nullptr;
2886 } 2886 }
2887 case CSSPropertyBufferedRendering: 2887 case CSSPropertyBufferedRendering:
2888 return CSSPrimitiveValue::create(svgStyle.bufferedRendering()); 2888 return CSSIdentifierValue::create(svgStyle.bufferedRendering());
2889 case CSSPropertyPaintOrder: 2889 case CSSPropertyPaintOrder:
2890 return paintOrderToCSSValueList(svgStyle); 2890 return paintOrderToCSSValueList(svgStyle);
2891 case CSSPropertyVectorEffect: 2891 case CSSPropertyVectorEffect:
2892 return CSSPrimitiveValue::create(svgStyle.vectorEffect()); 2892 return CSSIdentifierValue::create(svgStyle.vectorEffect());
2893 case CSSPropertyMaskType: 2893 case CSSPropertyMaskType:
2894 return CSSPrimitiveValue::create(svgStyle.maskType()); 2894 return CSSIdentifierValue::create(svgStyle.maskType());
2895 case CSSPropertyMarker: 2895 case CSSPropertyMarker:
2896 // the above properties are not yet implemented in the engine 2896 // the above properties are not yet implemented in the engine
2897 return nullptr; 2897 return nullptr;
2898 case CSSPropertyD: 2898 case CSSPropertyD:
2899 if (const StylePath* stylePath = svgStyle.d()) 2899 if (const StylePath* stylePath = svgStyle.d())
2900 return stylePath->computedCSSValue(); 2900 return stylePath->computedCSSValue();
2901 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2901 return CSSIdentifierValue::createIdentifier(CSSValueNone);
2902 case CSSPropertyCx: 2902 case CSSPropertyCx:
2903 return zoomAdjustedPixelValueForLength(svgStyle.cx(), style); 2903 return zoomAdjustedPixelValueForLength(svgStyle.cx(), style);
2904 case CSSPropertyCy: 2904 case CSSPropertyCy:
2905 return zoomAdjustedPixelValueForLength(svgStyle.cy(), style); 2905 return zoomAdjustedPixelValueForLength(svgStyle.cy(), style);
2906 case CSSPropertyX: 2906 case CSSPropertyX:
2907 return zoomAdjustedPixelValueForLength(svgStyle.x(), style); 2907 return zoomAdjustedPixelValueForLength(svgStyle.x(), style);
2908 case CSSPropertyY: 2908 case CSSPropertyY:
2909 return zoomAdjustedPixelValueForLength(svgStyle.y(), style); 2909 return zoomAdjustedPixelValueForLength(svgStyle.y(), style);
2910 case CSSPropertyR: 2910 case CSSPropertyR:
2911 return zoomAdjustedPixelValueForLength(svgStyle.r(), style); 2911 return zoomAdjustedPixelValueForLength(svgStyle.r(), style);
2912 case CSSPropertyRx: 2912 case CSSPropertyRx:
2913 return zoomAdjustedPixelValueForLength(svgStyle.rx(), style); 2913 return zoomAdjustedPixelValueForLength(svgStyle.rx(), style);
2914 case CSSPropertyRy: 2914 case CSSPropertyRy:
2915 return zoomAdjustedPixelValueForLength(svgStyle.ry(), style); 2915 return zoomAdjustedPixelValueForLength(svgStyle.ry(), style);
2916 case CSSPropertyScrollSnapType: 2916 case CSSPropertyScrollSnapType:
2917 return CSSPrimitiveValue::create(style.getScrollSnapType()); 2917 return CSSIdentifierValue::create(style.getScrollSnapType());
2918 case CSSPropertyScrollSnapPointsX: 2918 case CSSPropertyScrollSnapPointsX:
2919 return valueForScrollSnapPoints(style.scrollSnapPointsX(), style); 2919 return valueForScrollSnapPoints(style.scrollSnapPointsX(), style);
2920 case CSSPropertyScrollSnapPointsY: 2920 case CSSPropertyScrollSnapPointsY:
2921 return valueForScrollSnapPoints(style.scrollSnapPointsY(), style); 2921 return valueForScrollSnapPoints(style.scrollSnapPointsY(), style);
2922 case CSSPropertyScrollSnapCoordinate: 2922 case CSSPropertyScrollSnapCoordinate:
2923 return valueForScrollSnapCoordinate(style.scrollSnapCoordinate(), style) ; 2923 return valueForScrollSnapCoordinate(style.scrollSnapCoordinate(), style) ;
2924 case CSSPropertyScrollSnapDestination: 2924 case CSSPropertyScrollSnapDestination:
2925 return valueForScrollSnapDestination(style.scrollSnapDestination(), styl e); 2925 return valueForScrollSnapDestination(style.scrollSnapDestination(), styl e);
2926 case CSSPropertyTranslate: { 2926 case CSSPropertyTranslate: {
2927 if (!style.translate()) 2927 if (!style.translate())
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2968 list->append(*CSSPrimitiveValue::create(style.scale()->x(), CSSPrimitive Value::UnitType::Number)); 2968 list->append(*CSSPrimitiveValue::create(style.scale()->x(), CSSPrimitive Value::UnitType::Number));
2969 if (style.scale()->y() == 1 && style.scale()->z() == 1) 2969 if (style.scale()->y() == 1 && style.scale()->z() == 1)
2970 return list; 2970 return list;
2971 list->append(*CSSPrimitiveValue::create(style.scale()->y(), CSSPrimitive Value::UnitType::Number)); 2971 list->append(*CSSPrimitiveValue::create(style.scale()->y(), CSSPrimitive Value::UnitType::Number));
2972 if (style.scale()->z() != 1) 2972 if (style.scale()->z() != 1)
2973 list->append(*CSSPrimitiveValue::create(style.scale()->z(), CSSPrimi tiveValue::UnitType::Number)); 2973 list->append(*CSSPrimitiveValue::create(style.scale()->z(), CSSPrimi tiveValue::UnitType::Number));
2974 return list; 2974 return list;
2975 } 2975 }
2976 case CSSPropertyContain: { 2976 case CSSPropertyContain: {
2977 if (!style.contain()) 2977 if (!style.contain())
2978 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2978 return CSSIdentifierValue::createIdentifier(CSSValueNone);
2979 if (style.contain() == ContainsStrict) 2979 if (style.contain() == ContainsStrict)
2980 return CSSPrimitiveValue::createIdentifier(CSSValueStrict); 2980 return CSSIdentifierValue::createIdentifier(CSSValueStrict);
2981 if (style.contain() == ContainsContent) 2981 if (style.contain() == ContainsContent)
2982 return CSSPrimitiveValue::createIdentifier(CSSValueContent); 2982 return CSSIdentifierValue::createIdentifier(CSSValueContent);
2983 2983
2984 CSSValueList* list = CSSValueList::createSpaceSeparated(); 2984 CSSValueList* list = CSSValueList::createSpaceSeparated();
2985 if (style.containsStyle()) 2985 if (style.containsStyle())
2986 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueStyle)); 2986 list->append(*CSSIdentifierValue::createIdentifier(CSSValueStyle));
2987 if (style.contain() & ContainsLayout) 2987 if (style.contain() & ContainsLayout)
2988 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueLayout)); 2988 list->append(*CSSIdentifierValue::createIdentifier(CSSValueLayout));
2989 if (style.containsPaint()) 2989 if (style.containsPaint())
2990 list->append(*CSSPrimitiveValue::createIdentifier(CSSValuePaint)); 2990 list->append(*CSSIdentifierValue::createIdentifier(CSSValuePaint));
2991 if (style.containsSize()) 2991 if (style.containsSize())
2992 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueSize)); 2992 list->append(*CSSIdentifierValue::createIdentifier(CSSValueSize));
2993 ASSERT(list->length()); 2993 ASSERT(list->length());
2994 return list; 2994 return list;
2995 } 2995 }
2996 case CSSPropertySnapHeight: { 2996 case CSSPropertySnapHeight: {
2997 if (!style.snapHeightUnit()) 2997 if (!style.snapHeightUnit())
2998 return CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::Pix els); 2998 return CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::Pix els);
2999 CSSValueList* list = CSSValueList::createSpaceSeparated(); 2999 CSSValueList* list = CSSValueList::createSpaceSeparated();
3000 list->append(*CSSPrimitiveValue::create(style.snapHeightUnit(), CSSPrimi tiveValue::UnitType::Pixels)); 3000 list->append(*CSSPrimitiveValue::create(style.snapHeightUnit(), CSSPrimi tiveValue::UnitType::Pixels));
3001 if (style.snapHeightPosition()) 3001 if (style.snapHeightPosition())
3002 list->append(*CSSPrimitiveValue::create(style.snapHeightPosition(), CSSPrimitiveValue::UnitType::Integer)); 3002 list->append(*CSSPrimitiveValue::create(style.snapHeightPosition(), CSSPrimitiveValue::UnitType::Integer));
3003 return list; 3003 return list;
3004 } 3004 }
3005 case CSSPropertyVariable: 3005 case CSSPropertyVariable:
3006 // Variables are retrieved via get(AtomicString). 3006 // Variables are retrieved via get(AtomicString).
3007 ASSERT_NOT_REACHED(); 3007 ASSERT_NOT_REACHED();
3008 return nullptr; 3008 return nullptr;
3009 case CSSPropertyAll: 3009 case CSSPropertyAll:
3010 return nullptr; 3010 return nullptr;
3011 default: 3011 default:
3012 break; 3012 break;
3013 } 3013 }
3014 ASSERT_NOT_REACHED(); 3014 ASSERT_NOT_REACHED();
3015 return nullptr; 3015 return nullptr;
3016 } 3016 }
3017 3017
3018 } // namespace blink 3018 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698