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

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

Issue 1303173007: Oilpan: Unship Oilpan from CSSValues Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/ComputedStyleCSSValueMapping.h ('k') | Source/core/css/FontFace.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 #include "platform/LengthFunctions.h" 55 #include "platform/LengthFunctions.h"
56 56
57 namespace blink { 57 namespace blink {
58 58
59 inline static bool isFlexOrGrid(Node* element) 59 inline static bool isFlexOrGrid(Node* element)
60 { 60 {
61 return element && element->ensureComputedStyle() 61 return element && element->ensureComputedStyle()
62 && element->ensureComputedStyle()->isDisplayFlexibleOrGridBox(); 62 && element->ensureComputedStyle()->isDisplayFlexibleOrGridBox();
63 } 63 }
64 64
65 inline static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedPixelValue(d ouble value, const ComputedStyle& style) 65 inline static PassRefPtr<CSSPrimitiveValue> zoomAdjustedPixelValue(double value, const ComputedStyle& style)
66 { 66 {
67 return cssValuePool().createValue(adjustFloatForAbsoluteZoom(value, style), CSSPrimitiveValue::UnitType::Pixels); 67 return cssValuePool().createValue(adjustFloatForAbsoluteZoom(value, style), CSSPrimitiveValue::UnitType::Pixels);
68 } 68 }
69 69
70 inline static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedNumberValue( double value, const ComputedStyle& style) 70 inline static PassRefPtr<CSSPrimitiveValue> zoomAdjustedNumberValue(double value , const ComputedStyle& style)
71 { 71 {
72 return cssValuePool().createValue(value / style.effectiveZoom(), CSSPrimitiv eValue::UnitType::Number); 72 return cssValuePool().createValue(value / style.effectiveZoom(), CSSPrimitiv eValue::UnitType::Number);
73 } 73 }
74 74
75 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedPixelValueForLength (const Length& length, const ComputedStyle& style) 75 static PassRefPtr<CSSPrimitiveValue> zoomAdjustedPixelValueForLength(const Lengt h& length, const ComputedStyle& style)
76 { 76 {
77 if (length.isFixed()) 77 if (length.isFixed())
78 return zoomAdjustedPixelValue(length.value(), style); 78 return zoomAdjustedPixelValue(length.value(), style);
79 return cssValuePool().createValue(length, style); 79 return cssValuePool().createValue(length, style);
80 } 80 }
81 81
82 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> pixelValueForUnzoomedLength(con st UnzoomedLength& unzoomedLength, const ComputedStyle& style) 82 static PassRefPtr<CSSPrimitiveValue> pixelValueForUnzoomedLength(const UnzoomedL ength& unzoomedLength, const ComputedStyle& style)
83 { 83 {
84 const Length& length = unzoomedLength.length(); 84 const Length& length = unzoomedLength.length();
85 if (length.isFixed()) 85 if (length.isFixed())
86 return cssValuePool().createValue(length.value(), CSSPrimitiveValue::Uni tType::Pixels); 86 return cssValuePool().createValue(length.value(), CSSPrimitiveValue::Uni tType::Pixels);
87 return cssValuePool().createValue(length, style); 87 return cssValuePool().createValue(length, style);
88 } 88 }
89 89
90 static PassRefPtrWillBeRawPtr<CSSValueList> createPositionListForLayer(CSSProper tyID propertyID, const FillLayer& layer, const ComputedStyle& style) 90 static PassRefPtr<CSSValueList> createPositionListForLayer(CSSPropertyID propert yID, const FillLayer& layer, const ComputedStyle& style)
91 { 91 {
92 RefPtrWillBeRawPtr<CSSValueList> positionList = CSSValueList::createSpaceSep arated(); 92 RefPtr<CSSValueList> positionList = CSSValueList::createSpaceSeparated();
93 if (layer.isBackgroundXOriginSet()) { 93 if (layer.isBackgroundXOriginSet()) {
94 ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPosition || propertyID == CSSPropertyWebkitMaskPosition); 94 ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPosition || propertyID == CSSPropertyWebkitMaskPosition);
95 positionList->append(cssValuePool().createValue(layer.backgroundXOrigin( ))); 95 positionList->append(cssValuePool().createValue(layer.backgroundXOrigin( )));
96 } 96 }
97 positionList->append(zoomAdjustedPixelValueForLength(layer.xPosition(), styl e)); 97 positionList->append(zoomAdjustedPixelValueForLength(layer.xPosition(), styl e));
98 if (layer.isBackgroundYOriginSet()) { 98 if (layer.isBackgroundYOriginSet()) {
99 ASSERT(propertyID == CSSPropertyBackgroundPosition || propertyID == CSSP ropertyWebkitMaskPosition); 99 ASSERT(propertyID == CSSPropertyBackgroundPosition || propertyID == CSSP ropertyWebkitMaskPosition);
100 positionList->append(cssValuePool().createValue(layer.backgroundYOrigin( ))); 100 positionList->append(cssValuePool().createValue(layer.backgroundYOrigin( )));
101 } 101 }
102 positionList->append(zoomAdjustedPixelValueForLength(layer.yPosition(), styl e)); 102 positionList->append(zoomAdjustedPixelValueForLength(layer.yPosition(), styl e));
103 return positionList.release(); 103 return positionList.release();
104 } 104 }
105 105
106 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> ComputedStyleCSSValueMapping::currentC olorOrValidColor(const ComputedStyle& style, const StyleColor& color) 106 PassRefPtr<CSSPrimitiveValue> ComputedStyleCSSValueMapping::currentColorOrValidC olor(const ComputedStyle& style, const StyleColor& color)
107 { 107 {
108 // This function does NOT look at visited information, so that computed styl e doesn't expose that. 108 // This function does NOT look at visited information, so that computed styl e doesn't expose that.
109 return cssValuePool().createColorValue(color.resolve(style.color()).rgb()); 109 return cssValuePool().createColorValue(color.resolve(style.color()).rgb());
110 } 110 }
111 111
112 static PassRefPtrWillBeRawPtr<CSSValue> valueForFillSize(const FillSize& fillSiz e, const ComputedStyle& style) 112 static PassRefPtr<CSSValue> valueForFillSize(const FillSize& fillSize, const Com putedStyle& style)
113 { 113 {
114 if (fillSize.type == Contain) 114 if (fillSize.type == Contain)
115 return cssValuePool().createIdentifierValue(CSSValueContain); 115 return cssValuePool().createIdentifierValue(CSSValueContain);
116 116
117 if (fillSize.type == Cover) 117 if (fillSize.type == Cover)
118 return cssValuePool().createIdentifierValue(CSSValueCover); 118 return cssValuePool().createIdentifierValue(CSSValueCover);
119 119
120 if (fillSize.size.height().isAuto()) 120 if (fillSize.size.height().isAuto())
121 return zoomAdjustedPixelValueForLength(fillSize.size.width(), style); 121 return zoomAdjustedPixelValueForLength(fillSize.size.width(), style);
122 122
123 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 123 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
124 list->append(zoomAdjustedPixelValueForLength(fillSize.size.width(), style)); 124 list->append(zoomAdjustedPixelValueForLength(fillSize.size.width(), style));
125 list->append(zoomAdjustedPixelValueForLength(fillSize.size.height(), style)) ; 125 list->append(zoomAdjustedPixelValueForLength(fillSize.size.height(), style)) ;
126 return list.release(); 126 return list.release();
127 } 127 }
128 128
129 static PassRefPtrWillBeRawPtr<CSSValue> valueForFillRepeat(EFillRepeat xRepeat, EFillRepeat yRepeat) 129 static PassRefPtr<CSSValue> valueForFillRepeat(EFillRepeat xRepeat, EFillRepeat yRepeat)
130 { 130 {
131 // For backwards compatibility, if both values are equal, just return one of them. And 131 // For backwards compatibility, if both values are equal, just return one of them. And
132 // if the two values are equivalent to repeat-x or repeat-y, just return the shorthand. 132 // if the two values are equivalent to repeat-x or repeat-y, just return the shorthand.
133 if (xRepeat == yRepeat) 133 if (xRepeat == yRepeat)
134 return cssValuePool().createValue(xRepeat); 134 return cssValuePool().createValue(xRepeat);
135 if (xRepeat == RepeatFill && yRepeat == NoRepeatFill) 135 if (xRepeat == RepeatFill && yRepeat == NoRepeatFill)
136 return cssValuePool().createIdentifierValue(CSSValueRepeatX); 136 return cssValuePool().createIdentifierValue(CSSValueRepeatX);
137 if (xRepeat == NoRepeatFill && yRepeat == RepeatFill) 137 if (xRepeat == NoRepeatFill && yRepeat == RepeatFill)
138 return cssValuePool().createIdentifierValue(CSSValueRepeatY); 138 return cssValuePool().createIdentifierValue(CSSValueRepeatY);
139 139
140 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 140 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
141 list->append(cssValuePool().createValue(xRepeat)); 141 list->append(cssValuePool().createValue(xRepeat));
142 list->append(cssValuePool().createValue(yRepeat)); 142 list->append(cssValuePool().createValue(yRepeat));
143 return list.release(); 143 return list.release();
144 } 144 }
145 145
146 static PassRefPtrWillBeRawPtr<CSSValue> valueForFillSourceType(EMaskSourceType t ype) 146 static PassRefPtr<CSSValue> valueForFillSourceType(EMaskSourceType type)
147 { 147 {
148 switch (type) { 148 switch (type) {
149 case MaskAlpha: 149 case MaskAlpha:
150 return cssValuePool().createValue(CSSValueAlpha); 150 return cssValuePool().createValue(CSSValueAlpha);
151 case MaskLuminance: 151 case MaskLuminance:
152 return cssValuePool().createValue(CSSValueLuminance); 152 return cssValuePool().createValue(CSSValueLuminance);
153 } 153 }
154 154
155 ASSERT_NOT_REACHED(); 155 ASSERT_NOT_REACHED();
156 156
157 return nullptr; 157 return nullptr;
158 } 158 }
159 159
160 static PassRefPtrWillBeRawPtr<CSSValue> valueForPositionOffset(const ComputedSty le& style, CSSPropertyID propertyID, const LayoutObject* layoutObject) 160 static PassRefPtr<CSSValue> valueForPositionOffset(const ComputedStyle& style, C SSPropertyID propertyID, const LayoutObject* layoutObject)
161 { 161 {
162 Length offset; 162 Length offset;
163 switch (propertyID) { 163 switch (propertyID) {
164 case CSSPropertyLeft: 164 case CSSPropertyLeft:
165 offset = style.left(); 165 offset = style.left();
166 break; 166 break;
167 case CSSPropertyRight: 167 case CSSPropertyRight:
168 offset = style.right(); 168 offset = style.right();
169 break; 169 break;
170 case CSSPropertyTop: 170 case CSSPropertyTop:
(...skipping 15 matching lines...) Expand all
186 if (offset.isAuto()) { 186 if (offset.isAuto()) {
187 // FIXME: It's not enough to simply return "auto" values for one offset if the other side is defined. 187 // FIXME: It's not enough to simply return "auto" values for one offset if the other side is defined.
188 // In other words if left is auto and right is not auto, then left's com puted value is negative right(). 188 // In other words if left is auto and right is not auto, then left's com puted value is negative right().
189 // So we should get the opposite length unit and see if it is auto. 189 // So we should get the opposite length unit and see if it is auto.
190 return cssValuePool().createIdentifierValue(CSSValueAuto); 190 return cssValuePool().createIdentifierValue(CSSValueAuto);
191 } 191 }
192 192
193 return zoomAdjustedPixelValueForLength(offset, style); 193 return zoomAdjustedPixelValueForLength(offset, style);
194 } 194 }
195 195
196 static PassRefPtrWillBeRawPtr<CSSBorderImageSliceValue> valueForNinePieceImageSl ice(const NinePieceImage& image) 196 static PassRefPtr<CSSBorderImageSliceValue> valueForNinePieceImageSlice(const Ni nePieceImage& image)
197 { 197 {
198 // Create the slices. 198 // Create the slices.
199 RefPtrWillBeRawPtr<CSSPrimitiveValue> top = nullptr; 199 RefPtr<CSSPrimitiveValue> top = nullptr;
200 RefPtrWillBeRawPtr<CSSPrimitiveValue> right = nullptr; 200 RefPtr<CSSPrimitiveValue> right = nullptr;
201 RefPtrWillBeRawPtr<CSSPrimitiveValue> bottom = nullptr; 201 RefPtr<CSSPrimitiveValue> bottom = nullptr;
202 RefPtrWillBeRawPtr<CSSPrimitiveValue> left = nullptr; 202 RefPtr<CSSPrimitiveValue> left = nullptr;
203 203
204 // TODO(alancutter): Make this code aware of calc lengths. 204 // TODO(alancutter): Make this code aware of calc lengths.
205 if (image.imageSlices().top().hasPercent()) 205 if (image.imageSlices().top().hasPercent())
206 top = cssValuePool().createValue(image.imageSlices().top().value(), CSSP rimitiveValue::UnitType::Percentage); 206 top = cssValuePool().createValue(image.imageSlices().top().value(), CSSP rimitiveValue::UnitType::Percentage);
207 else 207 else
208 top = cssValuePool().createValue(image.imageSlices().top().value(), CSSP rimitiveValue::UnitType::Number); 208 top = cssValuePool().createValue(image.imageSlices().top().value(), CSSP rimitiveValue::UnitType::Number);
209 209
210 if (image.imageSlices().right() == image.imageSlices().top() && image.imageS lices().bottom() == image.imageSlices().top() 210 if (image.imageSlices().right() == image.imageSlices().top() && image.imageS lices().bottom() == image.imageSlices().top()
211 && image.imageSlices().left() == image.imageSlices().top()) { 211 && image.imageSlices().left() == image.imageSlices().top()) {
212 right = top; 212 right = top;
(...skipping 18 matching lines...) Expand all
231 left = right; 231 left = right;
232 } else { 232 } else {
233 if (image.imageSlices().left().hasPercent()) 233 if (image.imageSlices().left().hasPercent())
234 left = cssValuePool().createValue(image.imageSlices().left() .value(), CSSPrimitiveValue::UnitType::Percentage); 234 left = cssValuePool().createValue(image.imageSlices().left() .value(), CSSPrimitiveValue::UnitType::Percentage);
235 else 235 else
236 left = cssValuePool().createValue(image.imageSlices().left() .value(), CSSPrimitiveValue::UnitType::Number); 236 left = cssValuePool().createValue(image.imageSlices().left() .value(), CSSPrimitiveValue::UnitType::Number);
237 } 237 }
238 } 238 }
239 } 239 }
240 240
241 RefPtrWillBeRawPtr<Quad> quad = Quad::create(); 241 RefPtr<Quad> quad = Quad::create();
242 quad->setTop(top); 242 quad->setTop(top);
243 quad->setRight(right); 243 quad->setRight(right);
244 quad->setBottom(bottom); 244 quad->setBottom(bottom);
245 quad->setLeft(left); 245 quad->setLeft(left);
246 246
247 return CSSBorderImageSliceValue::create(cssValuePool().createValue(quad.rele ase()), image.fill()); 247 return CSSBorderImageSliceValue::create(cssValuePool().createValue(quad.rele ase()), image.fill());
248 } 248 }
249 249
250 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForNinePieceImageQuad(cons t BorderImageLengthBox& box, const ComputedStyle& style) 250 static PassRefPtr<CSSPrimitiveValue> valueForNinePieceImageQuad(const BorderImag eLengthBox& box, const ComputedStyle& style)
251 { 251 {
252 // Create the slices. 252 // Create the slices.
253 RefPtrWillBeRawPtr<CSSPrimitiveValue> top = nullptr; 253 RefPtr<CSSPrimitiveValue> top = nullptr;
254 RefPtrWillBeRawPtr<CSSPrimitiveValue> right = nullptr; 254 RefPtr<CSSPrimitiveValue> right = nullptr;
255 RefPtrWillBeRawPtr<CSSPrimitiveValue> bottom = nullptr; 255 RefPtr<CSSPrimitiveValue> bottom = nullptr;
256 RefPtrWillBeRawPtr<CSSPrimitiveValue> left = nullptr; 256 RefPtr<CSSPrimitiveValue> left = nullptr;
257 257
258 if (box.top().isNumber()) 258 if (box.top().isNumber())
259 top = cssValuePool().createValue(box.top().number(), CSSPrimitiveValue:: UnitType::Number); 259 top = cssValuePool().createValue(box.top().number(), CSSPrimitiveValue:: UnitType::Number);
260 else 260 else
261 top = cssValuePool().createValue(box.top().length(), style); 261 top = cssValuePool().createValue(box.top().length(), style);
262 262
263 if (box.right() == box.top() && box.bottom() == box.top() && box.left() == b ox.top()) { 263 if (box.right() == box.top() && box.bottom() == box.top() && box.left() == b ox.top()) {
264 right = top; 264 right = top;
265 bottom = top; 265 bottom = top;
266 left = top; 266 left = top;
(...skipping 16 matching lines...) Expand all
283 left = right; 283 left = right;
284 } else { 284 } else {
285 if (box.left().isNumber()) 285 if (box.left().isNumber())
286 left = cssValuePool().createValue(box.left().number(), CSSPr imitiveValue::UnitType::Number); 286 left = cssValuePool().createValue(box.left().number(), CSSPr imitiveValue::UnitType::Number);
287 else 287 else
288 left = cssValuePool().createValue(box.left().length(), style ); 288 left = cssValuePool().createValue(box.left().length(), style );
289 } 289 }
290 } 290 }
291 } 291 }
292 292
293 RefPtrWillBeRawPtr<Quad> quad = Quad::create(); 293 RefPtr<Quad> quad = Quad::create();
294 quad->setTop(top); 294 quad->setTop(top);
295 quad->setRight(right); 295 quad->setRight(right);
296 quad->setBottom(bottom); 296 quad->setBottom(bottom);
297 quad->setLeft(left); 297 quad->setLeft(left);
298 298
299 return cssValuePool().createValue(quad.release()); 299 return cssValuePool().createValue(quad.release());
300 } 300 }
301 301
302 static CSSValueID valueForRepeatRule(int rule) 302 static CSSValueID valueForRepeatRule(int rule)
303 { 303 {
304 switch (rule) { 304 switch (rule) {
305 case RepeatImageRule: 305 case RepeatImageRule:
306 return CSSValueRepeat; 306 return CSSValueRepeat;
307 case RoundImageRule: 307 case RoundImageRule:
308 return CSSValueRound; 308 return CSSValueRound;
309 case SpaceImageRule: 309 case SpaceImageRule:
310 return CSSValueSpace; 310 return CSSValueSpace;
311 default: 311 default:
312 return CSSValueStretch; 312 return CSSValueStretch;
313 } 313 }
314 } 314 }
315 315
316 static PassRefPtrWillBeRawPtr<CSSValue> valueForNinePieceImageRepeat(const NineP ieceImage& image) 316 static PassRefPtr<CSSValue> valueForNinePieceImageRepeat(const NinePieceImage& i mage)
317 { 317 {
318 RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalRepeat = nullptr; 318 RefPtr<CSSPrimitiveValue> horizontalRepeat = nullptr;
319 RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalRepeat = nullptr; 319 RefPtr<CSSPrimitiveValue> verticalRepeat = nullptr;
320 320
321 horizontalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(i mage.horizontalRule())); 321 horizontalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(i mage.horizontalRule()));
322 if (image.horizontalRule() == image.verticalRule()) 322 if (image.horizontalRule() == image.verticalRule())
323 verticalRepeat = horizontalRepeat; 323 verticalRepeat = horizontalRepeat;
324 else 324 else
325 verticalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule (image.verticalRule())); 325 verticalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule (image.verticalRule()));
326 return cssValuePool().createValue(Pair::create(horizontalRepeat.release(), v erticalRepeat.release(), Pair::DropIdenticalValues)); 326 return cssValuePool().createValue(Pair::create(horizontalRepeat.release(), v erticalRepeat.release(), Pair::DropIdenticalValues));
327 } 327 }
328 328
329 static PassRefPtrWillBeRawPtr<CSSValue> valueForNinePieceImage(const NinePieceIm age& image, const ComputedStyle& style) 329 static PassRefPtr<CSSValue> valueForNinePieceImage(const NinePieceImage& image, const ComputedStyle& style)
330 { 330 {
331 if (!image.hasImage()) 331 if (!image.hasImage())
332 return cssValuePool().createIdentifierValue(CSSValueNone); 332 return cssValuePool().createIdentifierValue(CSSValueNone);
333 333
334 // Image first. 334 // Image first.
335 RefPtrWillBeRawPtr<CSSValue> imageValue = nullptr; 335 RefPtr<CSSValue> imageValue = nullptr;
336 if (image.image()) 336 if (image.image())
337 imageValue = image.image()->cssValue(); 337 imageValue = image.image()->cssValue();
338 338
339 // Create the image slice. 339 // Create the image slice.
340 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> imageSlices = valueForNinePiece ImageSlice(image); 340 RefPtr<CSSBorderImageSliceValue> imageSlices = valueForNinePieceImageSlice(i mage);
341 341
342 // Create the border area slices. 342 // Create the border area slices.
343 RefPtrWillBeRawPtr<CSSValue> borderSlices = valueForNinePieceImageQuad(image .borderSlices(), style); 343 RefPtr<CSSValue> borderSlices = valueForNinePieceImageQuad(image.borderSlice s(), style);
344 344
345 // Create the border outset. 345 // Create the border outset.
346 RefPtrWillBeRawPtr<CSSValue> outset = valueForNinePieceImageQuad(image.outse t(), style); 346 RefPtr<CSSValue> outset = valueForNinePieceImageQuad(image.outset(), style);
347 347
348 // Create the repeat rules. 348 // Create the repeat rules.
349 RefPtrWillBeRawPtr<CSSValue> repeat = valueForNinePieceImageRepeat(image); 349 RefPtr<CSSValue> repeat = valueForNinePieceImageRepeat(image);
350 350
351 return createBorderImageValue(imageValue.release(), imageSlices.release(), b orderSlices.release(), outset.release(), repeat.release()); 351 return createBorderImageValue(imageValue.release(), imageSlices.release(), b orderSlices.release(), outset.release(), repeat.release());
352 } 352 }
353 353
354 static PassRefPtrWillBeRawPtr<CSSValue> valueForReflection(const StyleReflection * reflection, const ComputedStyle& style) 354 static PassRefPtr<CSSValue> valueForReflection(const StyleReflection* reflection , const ComputedStyle& style)
355 { 355 {
356 if (!reflection) 356 if (!reflection)
357 return cssValuePool().createIdentifierValue(CSSValueNone); 357 return cssValuePool().createIdentifierValue(CSSValueNone);
358 358
359 RefPtrWillBeRawPtr<CSSPrimitiveValue> offset = nullptr; 359 RefPtr<CSSPrimitiveValue> offset = nullptr;
360 // TODO(alancutter): Make this work correctly for calc lengths. 360 // TODO(alancutter): Make this work correctly for calc lengths.
361 if (reflection->offset().hasPercent()) 361 if (reflection->offset().hasPercent())
362 offset = cssValuePool().createValue(reflection->offset().percent(), CSSP rimitiveValue::UnitType::Percentage); 362 offset = cssValuePool().createValue(reflection->offset().percent(), CSSP rimitiveValue::UnitType::Percentage);
363 else 363 else
364 offset = zoomAdjustedPixelValue(reflection->offset().value(), style); 364 offset = zoomAdjustedPixelValue(reflection->offset().value(), style);
365 365
366 RefPtrWillBeRawPtr<CSSPrimitiveValue> direction = nullptr; 366 RefPtr<CSSPrimitiveValue> direction = nullptr;
367 switch (reflection->direction()) { 367 switch (reflection->direction()) {
368 case ReflectionBelow: 368 case ReflectionBelow:
369 direction = cssValuePool().createIdentifierValue(CSSValueBelow); 369 direction = cssValuePool().createIdentifierValue(CSSValueBelow);
370 break; 370 break;
371 case ReflectionAbove: 371 case ReflectionAbove:
372 direction = cssValuePool().createIdentifierValue(CSSValueAbove); 372 direction = cssValuePool().createIdentifierValue(CSSValueAbove);
373 break; 373 break;
374 case ReflectionLeft: 374 case ReflectionLeft:
375 direction = cssValuePool().createIdentifierValue(CSSValueLeft); 375 direction = cssValuePool().createIdentifierValue(CSSValueLeft);
376 break; 376 break;
377 case ReflectionRight: 377 case ReflectionRight:
378 direction = cssValuePool().createIdentifierValue(CSSValueRight); 378 direction = cssValuePool().createIdentifierValue(CSSValueRight);
379 break; 379 break;
380 } 380 }
381 381
382 return CSSReflectValue::create(direction.release(), offset.release(), valueF orNinePieceImage(reflection->mask(), style)); 382 return CSSReflectValue::create(direction.release(), offset.release(), valueF orNinePieceImage(reflection->mask(), style));
383 } 383 }
384 384
385 static ItemPosition resolveAlignmentAuto(ItemPosition position, Node* element) 385 static ItemPosition resolveAlignmentAuto(ItemPosition position, Node* element)
386 { 386 {
387 if (position != ItemPositionAuto) 387 if (position != ItemPositionAuto)
388 return position; 388 return position;
389 389
390 return isFlexOrGrid(element) ? ItemPositionStretch : ItemPositionStart; 390 return isFlexOrGrid(element) ? ItemPositionStretch : ItemPositionStart;
391 } 391 }
392 392
393 static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlig nment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, ItemPositi onType positionType) 393 static PassRefPtr<CSSValueList> valueForItemPositionWithOverflowAlignment(ItemPo sition itemPosition, OverflowAlignment overflowAlignment, ItemPositionType posit ionType)
394 { 394 {
395 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated (); 395 RefPtr<CSSValueList> result = CSSValueList::createSpaceSeparated();
396 if (positionType == LegacyPosition) 396 if (positionType == LegacyPosition)
397 result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy)); 397 result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy));
398 result->append(CSSPrimitiveValue::create(itemPosition)); 398 result->append(CSSPrimitiveValue::create(itemPosition));
399 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign mentDefault) 399 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign mentDefault)
400 result->append(CSSPrimitiveValue::create(overflowAlignment)); 400 result->append(CSSPrimitiveValue::create(overflowAlignment));
401 ASSERT(result->length() <= 2); 401 ASSERT(result->length() <= 2);
402 return result.release(); 402 return result.release();
403 } 403 }
404 404
405 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForGridShorthand(const StylePr opertyShorthand& shorthand, const ComputedStyle& style, const LayoutObject* layo utObject, Node* styledNode, bool allowVisitedStyle) 405 static PassRefPtr<CSSValueList> valuesForGridShorthand(const StylePropertyShorth and& shorthand, const ComputedStyle& style, const LayoutObject* layoutObject, No de* styledNode, bool allowVisitedStyle)
406 { 406 {
407 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated() ; 407 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
408 for (size_t i = 0; i < shorthand.length(); ++i) { 408 for (size_t i = 0; i < shorthand.length(); ++i) {
409 RefPtrWillBeRawPtr<CSSValue> value = ComputedStyleCSSValueMapping::get(s horthand.properties()[i], style, layoutObject, styledNode, allowVisitedStyle); 409 RefPtr<CSSValue> value = ComputedStyleCSSValueMapping::get(shorthand.pro perties()[i], style, layoutObject, styledNode, allowVisitedStyle);
410 ASSERT(value); 410 ASSERT(value);
411 list->append(value.release()); 411 list->append(value.release());
412 } 412 }
413 return list.release(); 413 return list.release();
414 } 414 }
415 415
416 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForShorthandProperty(const Sty lePropertyShorthand& shorthand, const ComputedStyle& style, const LayoutObject* layoutObject, Node* styledNode, bool allowVisitedStyle) 416 static PassRefPtr<CSSValueList> valuesForShorthandProperty(const StylePropertySh orthand& shorthand, const ComputedStyle& style, const LayoutObject* layoutObject , Node* styledNode, bool allowVisitedStyle)
417 { 417 {
418 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 418 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
419 for (size_t i = 0; i < shorthand.length(); ++i) { 419 for (size_t i = 0; i < shorthand.length(); ++i) {
420 RefPtrWillBeRawPtr<CSSValue> value = ComputedStyleCSSValueMapping::get(s horthand.properties()[i], style, layoutObject, styledNode, allowVisitedStyle); 420 RefPtr<CSSValue> value = ComputedStyleCSSValueMapping::get(shorthand.pro perties()[i], style, layoutObject, styledNode, allowVisitedStyle);
421 ASSERT(value); 421 ASSERT(value);
422 list->append(value); 422 list->append(value);
423 } 423 }
424 return list.release(); 424 return list.release();
425 } 425 }
426 426
427 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForBackgroundShorthand(const C omputedStyle& style, const LayoutObject* layoutObject, Node* styledNode, bool al lowVisitedStyle) 427 static PassRefPtr<CSSValueList> valuesForBackgroundShorthand(const ComputedStyle & style, const LayoutObject* layoutObject, Node* styledNode, bool allowVisitedSt yle)
428 { 428 {
429 RefPtrWillBeRawPtr<CSSValueList> ret = CSSValueList::createCommaSeparated(); 429 RefPtr<CSSValueList> ret = CSSValueList::createCommaSeparated();
430 const FillLayer* currLayer = &style.backgroundLayers(); 430 const FillLayer* currLayer = &style.backgroundLayers();
431 for (; currLayer; currLayer = currLayer->next()) { 431 for (; currLayer; currLayer = currLayer->next()) {
432 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparat ed(); 432 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
433 RefPtrWillBeRawPtr<CSSValueList> beforeSlash = CSSValueList::createSpace Separated(); 433 RefPtr<CSSValueList> beforeSlash = CSSValueList::createSpaceSeparated();
434 if (!currLayer->next()) { // color only for final layer 434 if (!currLayer->next()) { // color only for final layer
435 RefPtrWillBeRawPtr<CSSValue> value = ComputedStyleCSSValueMapping::g et(CSSPropertyBackgroundColor, style, layoutObject, styledNode, allowVisitedStyl e); 435 RefPtr<CSSValue> value = ComputedStyleCSSValueMapping::get(CSSProper tyBackgroundColor, style, layoutObject, styledNode, allowVisitedStyle);
436 ASSERT(value); 436 ASSERT(value);
437 beforeSlash->append(value); 437 beforeSlash->append(value);
438 } 438 }
439 beforeSlash->append(currLayer->image() ? currLayer->image()->cssValue() : cssValuePool().createIdentifierValue(CSSValueNone)); 439 beforeSlash->append(currLayer->image() ? currLayer->image()->cssValue() : cssValuePool().createIdentifierValue(CSSValueNone));
440 beforeSlash->append(valueForFillRepeat(currLayer->repeatX(), currLayer-> repeatY())); 440 beforeSlash->append(valueForFillRepeat(currLayer->repeatX(), currLayer-> repeatY()));
441 beforeSlash->append(cssValuePool().createValue(currLayer->attachment())) ; 441 beforeSlash->append(cssValuePool().createValue(currLayer->attachment())) ;
442 beforeSlash->append(createPositionListForLayer(CSSPropertyBackgroundPosi tion, *currLayer, style)); 442 beforeSlash->append(createPositionListForLayer(CSSPropertyBackgroundPosi tion, *currLayer, style));
443 list->append(beforeSlash); 443 list->append(beforeSlash);
444 RefPtrWillBeRawPtr<CSSValueList> afterSlash = CSSValueList::createSpaceS eparated(); 444 RefPtr<CSSValueList> afterSlash = CSSValueList::createSpaceSeparated();
445 afterSlash->append(valueForFillSize(currLayer->size(), style)); 445 afterSlash->append(valueForFillSize(currLayer->size(), style));
446 afterSlash->append(cssValuePool().createValue(currLayer->origin())); 446 afterSlash->append(cssValuePool().createValue(currLayer->origin()));
447 afterSlash->append(cssValuePool().createValue(currLayer->clip())); 447 afterSlash->append(cssValuePool().createValue(currLayer->clip()));
448 list->append(afterSlash); 448 list->append(afterSlash);
449 ret->append(list); 449 ret->append(list);
450 } 450 }
451 return ret.release(); 451 return ret.release();
452 } 452 }
453 453
454 static ContentPosition resolveContentAlignmentAuto(ContentPosition position, Con tentDistributionType distribution, Node* element) 454 static ContentPosition resolveContentAlignmentAuto(ContentPosition position, Con tentDistributionType distribution, Node* element)
455 { 455 {
456 if (position != ContentPositionAuto || distribution != ContentDistributionDe fault) 456 if (position != ContentPositionAuto || distribution != ContentDistributionDe fault)
457 return position; 457 return position;
458 458
459 bool isFlex = element && element->ensureComputedStyle() 459 bool isFlex = element && element->ensureComputedStyle()
460 && element->ensureComputedStyle()->isDisplayFlexibleBox(); 460 && element->ensureComputedStyle()->isDisplayFlexibleBox();
461 461
462 return isFlex ? ContentPositionFlexStart : ContentPositionStart; 462 return isFlex ? ContentPositionFlexStart : ContentPositionStart;
463 } 463 }
464 464
465 static PassRefPtrWillBeRawPtr<CSSValueList> valueForContentPositionAndDistributi onWithOverflowAlignment(ContentPosition position, OverflowAlignment overflowAlig nment, ContentDistributionType distribution) 465 static PassRefPtr<CSSValueList> valueForContentPositionAndDistributionWithOverfl owAlignment(ContentPosition position, OverflowAlignment overflowAlignment, Conte ntDistributionType distribution)
466 { 466 {
467 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated (); 467 RefPtr<CSSValueList> result = CSSValueList::createSpaceSeparated();
468 if (distribution != ContentDistributionDefault) 468 if (distribution != ContentDistributionDefault)
469 result->append(CSSPrimitiveValue::create(distribution)); 469 result->append(CSSPrimitiveValue::create(distribution));
470 if (distribution == ContentDistributionDefault || position != ContentPositio nAuto) 470 if (distribution == ContentDistributionDefault || position != ContentPositio nAuto)
471 result->append(CSSPrimitiveValue::create(position)); 471 result->append(CSSPrimitiveValue::create(position));
472 if ((position >= ContentPositionCenter || distribution != ContentDistributio nDefault) && overflowAlignment != OverflowAlignmentDefault) 472 if ((position >= ContentPositionCenter || distribution != ContentDistributio nDefault) && overflowAlignment != OverflowAlignmentDefault)
473 result->append(CSSPrimitiveValue::create(overflowAlignment)); 473 result->append(CSSPrimitiveValue::create(overflowAlignment));
474 ASSERT(result->length() > 0); 474 ASSERT(result->length() > 0);
475 ASSERT(result->length() <= 3); 475 ASSERT(result->length() <= 3);
476 return result.release(); 476 return result.release();
477 } 477 }
478 478
479 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForLineHeight(const Comput edStyle& style) 479 static PassRefPtr<CSSPrimitiveValue> valueForLineHeight(const ComputedStyle& sty le)
480 { 480 {
481 Length length = style.lineHeight(); 481 Length length = style.lineHeight();
482 if (length.isNegative()) 482 if (length.isNegative())
483 return cssValuePool().createIdentifierValue(CSSValueNormal); 483 return cssValuePool().createIdentifierValue(CSSValueNormal);
484 484
485 return zoomAdjustedPixelValue(floatValueForLength(length, style.fontDescript ion().specifiedSize()), style); 485 return zoomAdjustedPixelValue(floatValueForLength(length, style.fontDescript ion().specifiedSize()), style);
486 } 486 }
487 487
488 static CSSValueID identifierForFamily(const AtomicString& family) 488 static CSSValueID identifierForFamily(const AtomicString& family)
489 { 489 {
490 if (family == FontFamilyNames::webkit_cursive) 490 if (family == FontFamilyNames::webkit_cursive)
491 return CSSValueCursive; 491 return CSSValueCursive;
492 if (family == FontFamilyNames::webkit_fantasy) 492 if (family == FontFamilyNames::webkit_fantasy)
493 return CSSValueFantasy; 493 return CSSValueFantasy;
494 if (family == FontFamilyNames::webkit_monospace) 494 if (family == FontFamilyNames::webkit_monospace)
495 return CSSValueMonospace; 495 return CSSValueMonospace;
496 if (family == FontFamilyNames::webkit_pictograph) 496 if (family == FontFamilyNames::webkit_pictograph)
497 return CSSValueWebkitPictograph; 497 return CSSValueWebkitPictograph;
498 if (family == FontFamilyNames::webkit_sans_serif) 498 if (family == FontFamilyNames::webkit_sans_serif)
499 return CSSValueSansSerif; 499 return CSSValueSansSerif;
500 if (family == FontFamilyNames::webkit_serif) 500 if (family == FontFamilyNames::webkit_serif)
501 return CSSValueSerif; 501 return CSSValueSerif;
502 return CSSValueInvalid; 502 return CSSValueInvalid;
503 } 503 }
504 504
505 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFamily(const AtomicStri ng& family) 505 static PassRefPtr<CSSPrimitiveValue> valueForFamily(const AtomicString& family)
506 { 506 {
507 if (CSSValueID familyIdentifier = identifierForFamily(family)) 507 if (CSSValueID familyIdentifier = identifierForFamily(family))
508 return cssValuePool().createIdentifierValue(familyIdentifier); 508 return cssValuePool().createIdentifierValue(familyIdentifier);
509 return cssValuePool().createValue(family.string(), CSSPrimitiveValue::UnitTy pe::CustomIdentifier); 509 return cssValuePool().createValue(family.string(), CSSPrimitiveValue::UnitTy pe::CustomIdentifier);
510 } 510 }
511 511
512 static PassRefPtrWillBeRawPtr<CSSValueList> valueForFontFamily(const ComputedSty le& style) 512 static PassRefPtr<CSSValueList> valueForFontFamily(const ComputedStyle& style)
513 { 513 {
514 const FontFamily& firstFamily = style.fontDescription().family(); 514 const FontFamily& firstFamily = style.fontDescription().family();
515 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ; 515 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
516 for (const FontFamily* family = &firstFamily; family; family = family->next( )) 516 for (const FontFamily* family = &firstFamily; family; family = family->next( ))
517 list->append(valueForFamily(family->family())); 517 list->append(valueForFamily(family->family()));
518 return list.release(); 518 return list.release();
519 } 519 }
520 520
521 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontSize(const Computed Style& style) 521 static PassRefPtr<CSSPrimitiveValue> valueForFontSize(const ComputedStyle& style )
522 { 522 {
523 return zoomAdjustedPixelValue(style.fontDescription().computedSize(), style) ; 523 return zoomAdjustedPixelValue(style.fontDescription().computedSize(), style) ;
524 } 524 }
525 525
526 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStretch(const Compu tedStyle& style) 526 static PassRefPtr<CSSPrimitiveValue> valueForFontStretch(const ComputedStyle& st yle)
527 { 527 {
528 return cssValuePool().createValue(style.fontDescription().stretch()); 528 return cssValuePool().createValue(style.fontDescription().stretch());
529 } 529 }
530 530
531 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStyle(const Compute dStyle& style) 531 static PassRefPtr<CSSPrimitiveValue> valueForFontStyle(const ComputedStyle& styl e)
532 { 532 {
533 return cssValuePool().createValue(style.fontDescription().style()); 533 return cssValuePool().createValue(style.fontDescription().style());
534 } 534 }
535 535
536 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontVariant(const Compu tedStyle& style) 536 static PassRefPtr<CSSPrimitiveValue> valueForFontVariant(const ComputedStyle& st yle)
537 { 537 {
538 return cssValuePool().createValue(style.fontDescription().variant()); 538 return cssValuePool().createValue(style.fontDescription().variant());
539 } 539 }
540 540
541 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontWeight(const Comput edStyle& style) 541 static PassRefPtr<CSSPrimitiveValue> valueForFontWeight(const ComputedStyle& sty le)
542 { 542 {
543 return cssValuePool().createValue(style.fontDescription().weight()); 543 return cssValuePool().createValue(style.fontDescription().weight());
544 } 544 }
545 545
546 static PassRefPtrWillBeRawPtr<CSSValue> specifiedValueForGridTrackBreadth(const GridLength& trackBreadth, const ComputedStyle& style) 546 static PassRefPtr<CSSValue> specifiedValueForGridTrackBreadth(const GridLength& trackBreadth, const ComputedStyle& style)
547 { 547 {
548 if (!trackBreadth.isLength()) 548 if (!trackBreadth.isLength())
549 return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue ::UnitType::Fraction); 549 return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue ::UnitType::Fraction);
550 550
551 const Length& trackBreadthLength = trackBreadth.length(); 551 const Length& trackBreadthLength = trackBreadth.length();
552 if (trackBreadthLength.isAuto()) 552 if (trackBreadthLength.isAuto())
553 return cssValuePool().createIdentifierValue(CSSValueAuto); 553 return cssValuePool().createIdentifierValue(CSSValueAuto);
554 return zoomAdjustedPixelValueForLength(trackBreadthLength, style); 554 return zoomAdjustedPixelValueForLength(trackBreadthLength, style);
555 } 555 }
556 556
557 static PassRefPtrWillBeRawPtr<CSSValue> specifiedValueForGridTrackSize(const Gri dTrackSize& trackSize, const ComputedStyle& style) 557 static PassRefPtr<CSSValue> specifiedValueForGridTrackSize(const GridTrackSize& trackSize, const ComputedStyle& style)
558 { 558 {
559 switch (trackSize.type()) { 559 switch (trackSize.type()) {
560 case LengthTrackSizing: 560 case LengthTrackSizing:
561 return specifiedValueForGridTrackBreadth(trackSize.length(), style); 561 return specifiedValueForGridTrackBreadth(trackSize.length(), style);
562 case MinMaxTrackSizing: 562 case MinMaxTrackSizing:
563 RefPtrWillBeRawPtr<CSSFunctionValue> minMaxTrackBreadths = CSSFunctionVa lue::create(CSSValueMinmax); 563 RefPtr<CSSFunctionValue> minMaxTrackBreadths = CSSFunctionValue::create( CSSValueMinmax);
564 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize. minTrackBreadth(), style)); 564 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize. minTrackBreadth(), style));
565 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize. maxTrackBreadth(), style)); 565 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize. maxTrackBreadth(), style));
566 return minMaxTrackBreadths.release(); 566 return minMaxTrackBreadths.release();
567 } 567 }
568 ASSERT_NOT_REACHED(); 568 ASSERT_NOT_REACHED();
569 return nullptr; 569 return nullptr;
570 } 570 }
571 571
572 static void addValuesForNamedGridLinesAtIndex(const OrderedNamedGridLines& order edNamedGridLines, size_t i, CSSValueList& list) 572 static void addValuesForNamedGridLinesAtIndex(const OrderedNamedGridLines& order edNamedGridLines, size_t i, CSSValueList& list)
573 { 573 {
574 const Vector<String>& namedGridLines = orderedNamedGridLines.get(i); 574 const Vector<String>& namedGridLines = orderedNamedGridLines.get(i);
575 if (namedGridLines.isEmpty()) 575 if (namedGridLines.isEmpty())
576 return; 576 return;
577 577
578 RefPtrWillBeRawPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue: :create(); 578 RefPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue::create();
579 for (size_t j = 0; j < namedGridLines.size(); ++j) 579 for (size_t j = 0; j < namedGridLines.size(); ++j)
580 lineNames->append(cssValuePool().createValue(namedGridLines[j], CSSPrimi tiveValue::UnitType::CustomIdentifier)); 580 lineNames->append(cssValuePool().createValue(namedGridLines[j], CSSPrimi tiveValue::UnitType::CustomIdentifier));
581 list.append(lineNames.release()); 581 list.append(lineNames.release());
582 } 582 }
583 583
584 static PassRefPtrWillBeRawPtr<CSSValue> valueForGridTrackList(GridTrackSizingDir ection direction, const LayoutObject* layoutObject, const ComputedStyle& style) 584 static PassRefPtr<CSSValue> valueForGridTrackList(GridTrackSizingDirection direc tion, const LayoutObject* layoutObject, const ComputedStyle& style)
585 { 585 {
586 const Vector<GridTrackSize>& trackSizes = direction == ForColumns ? style.gr idTemplateColumns() : style.gridTemplateRows(); 586 const Vector<GridTrackSize>& trackSizes = direction == ForColumns ? style.gr idTemplateColumns() : style.gridTemplateRows();
587 const OrderedNamedGridLines& orderedNamedGridLines = direction == ForColumns ? style.orderedNamedGridColumnLines() : style.orderedNamedGridRowLines(); 587 const OrderedNamedGridLines& orderedNamedGridLines = direction == ForColumns ? style.orderedNamedGridColumnLines() : style.orderedNamedGridRowLines();
588 bool isLayoutGrid = layoutObject && layoutObject->isLayoutGrid(); 588 bool isLayoutGrid = layoutObject && layoutObject->isLayoutGrid();
589 589
590 // Handle the 'none' case. 590 // Handle the 'none' case.
591 bool trackListIsEmpty = trackSizes.isEmpty(); 591 bool trackListIsEmpty = trackSizes.isEmpty();
592 if (isLayoutGrid && trackListIsEmpty) { 592 if (isLayoutGrid && trackListIsEmpty) {
593 // For grids we should consider every listed track, whether implicitly o r explicitly created. If we don't have 593 // For grids we should consider every listed track, whether implicitly o r explicitly created. If we don't have
594 // any explicit track and there are no children then there are no implic it tracks. We cannot simply check the 594 // any explicit track and there are no children then there are no implic it tracks. We cannot simply check the
595 // number of rows/columns in our internal grid representation because it 's always at least 1x1 (see r143331). 595 // number of rows/columns in our internal grid representation because it 's always at least 1x1 (see r143331).
596 trackListIsEmpty = !toLayoutBlock(layoutObject)->firstChild(); 596 trackListIsEmpty = !toLayoutBlock(layoutObject)->firstChild();
597 } 597 }
598 598
599 if (trackListIsEmpty) { 599 if (trackListIsEmpty) {
600 ASSERT(orderedNamedGridLines.isEmpty()); 600 ASSERT(orderedNamedGridLines.isEmpty());
601 return cssValuePool().createIdentifierValue(CSSValueNone); 601 return cssValuePool().createIdentifierValue(CSSValueNone);
602 } 602 }
603 603
604 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 604 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
605 size_t insertionIndex; 605 size_t insertionIndex;
606 if (isLayoutGrid) { 606 if (isLayoutGrid) {
607 const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? toL ayoutGrid(layoutObject)->columnPositions() : toLayoutGrid(layoutObject)->rowPosi tions(); 607 const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? toL ayoutGrid(layoutObject)->columnPositions() : toLayoutGrid(layoutObject)->rowPosi tions();
608 // There are at least #tracks + 1 grid lines (trackPositions). Apart fro m that, the grid container can generate implicit grid tracks, 608 // There are at least #tracks + 1 grid lines (trackPositions). Apart fro m that, the grid container can generate implicit grid tracks,
609 // so we'll have more trackPositions than trackSizes as the latter only contain the explicit grid. 609 // so we'll have more trackPositions than trackSizes as the latter only contain the explicit grid.
610 ASSERT(trackPositions.size() - 1 >= trackSizes.size()); 610 ASSERT(trackPositions.size() - 1 >= trackSizes.size());
611 611
612 for (size_t i = 0; i < trackPositions.size() - 1; ++i) { 612 for (size_t i = 0; i < trackPositions.size() - 1; ++i) {
613 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); 613 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list);
614 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPos itions[i], style)); 614 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPos itions[i], style));
615 } 615 }
616 insertionIndex = trackPositions.size() - 1; 616 insertionIndex = trackPositions.size() - 1;
617 } else { 617 } else {
618 for (size_t i = 0; i < trackSizes.size(); ++i) { 618 for (size_t i = 0; i < trackSizes.size(); ++i) {
619 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); 619 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list);
620 list->append(specifiedValueForGridTrackSize(trackSizes[i], style)); 620 list->append(specifiedValueForGridTrackSize(trackSizes[i], style));
621 } 621 }
622 insertionIndex = trackSizes.size(); 622 insertionIndex = trackSizes.size();
623 } 623 }
624 // Those are the trailing <string>* allowed in the syntax. 624 // Those are the trailing <string>* allowed in the syntax.
625 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, insertionIndex, *li st); 625 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, insertionIndex, *li st);
626 return list.release(); 626 return list.release();
627 } 627 }
628 628
629 static PassRefPtrWillBeRawPtr<CSSValue> valueForGridPosition(const GridPosition& position) 629 static PassRefPtr<CSSValue> valueForGridPosition(const GridPosition& position)
630 { 630 {
631 if (position.isAuto()) 631 if (position.isAuto())
632 return cssValuePool().createIdentifierValue(CSSValueAuto); 632 return cssValuePool().createIdentifierValue(CSSValueAuto);
633 633
634 if (position.isNamedGridArea()) 634 if (position.isNamedGridArea())
635 return cssValuePool().createValue(position.namedGridLine(), CSSPrimitive Value::UnitType::CustomIdentifier); 635 return cssValuePool().createValue(position.namedGridLine(), CSSPrimitive Value::UnitType::CustomIdentifier);
636 636
637 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 637 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
638 if (position.isSpan()) { 638 if (position.isSpan()) {
639 list->append(cssValuePool().createIdentifierValue(CSSValueSpan)); 639 list->append(cssValuePool().createIdentifierValue(CSSValueSpan));
640 list->append(cssValuePool().createValue(position.spanPosition(), CSSPrim itiveValue::UnitType::Number)); 640 list->append(cssValuePool().createValue(position.spanPosition(), CSSPrim itiveValue::UnitType::Number));
641 } else { 641 } else {
642 list->append(cssValuePool().createValue(position.integerPosition(), CSSP rimitiveValue::UnitType::Number)); 642 list->append(cssValuePool().createValue(position.integerPosition(), CSSP rimitiveValue::UnitType::Number));
643 } 643 }
644 644
645 if (!position.namedGridLine().isNull()) 645 if (!position.namedGridLine().isNull())
646 list->append(cssValuePool().createValue(position.namedGridLine(), CSSPri mitiveValue::UnitType::CustomIdentifier)); 646 list->append(cssValuePool().createValue(position.namedGridLine(), CSSPri mitiveValue::UnitType::CustomIdentifier));
647 return list; 647 return list;
648 } 648 }
649 649
650 static LayoutRect sizingBox(const LayoutObject* layoutObject) 650 static LayoutRect sizingBox(const LayoutObject* layoutObject)
651 { 651 {
652 if (!layoutObject->isBox()) 652 if (!layoutObject->isBox())
653 return LayoutRect(); 653 return LayoutRect();
654 654
655 const LayoutBox* box = toLayoutBox(layoutObject); 655 const LayoutBox* box = toLayoutBox(layoutObject);
656 return box->style()->boxSizing() == BORDER_BOX ? box->borderBoxRect() : box- >computedCSSContentBoxRect(); 656 return box->style()->boxSizing() == BORDER_BOX ? box->borderBoxRect() : box- >computedCSSContentBoxRect();
657 } 657 }
658 658
659 static PassRefPtrWillBeRawPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecoration) 659 static PassRefPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecorati on)
660 { 660 {
661 // Blink value is ignored. 661 // Blink value is ignored.
662 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 662 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
663 if (textDecoration & TextDecorationUnderline) 663 if (textDecoration & TextDecorationUnderline)
664 list->append(cssValuePool().createIdentifierValue(CSSValueUnderline)); 664 list->append(cssValuePool().createIdentifierValue(CSSValueUnderline));
665 if (textDecoration & TextDecorationOverline) 665 if (textDecoration & TextDecorationOverline)
666 list->append(cssValuePool().createIdentifierValue(CSSValueOverline)); 666 list->append(cssValuePool().createIdentifierValue(CSSValueOverline));
667 if (textDecoration & TextDecorationLineThrough) 667 if (textDecoration & TextDecorationLineThrough)
668 list->append(cssValuePool().createIdentifierValue(CSSValueLineThrough)); 668 list->append(cssValuePool().createIdentifierValue(CSSValueLineThrough));
669 669
670 if (!list->length()) 670 if (!list->length())
671 return cssValuePool().createIdentifierValue(CSSValueNone); 671 return cssValuePool().createIdentifierValue(CSSValueNone);
672 return list.release(); 672 return list.release();
673 } 673 }
674 674
675 static PassRefPtrWillBeRawPtr<CSSValue> valueForTextDecorationStyle(TextDecorati onStyle textDecorationStyle) 675 static PassRefPtr<CSSValue> valueForTextDecorationStyle(TextDecorationStyle text DecorationStyle)
676 { 676 {
677 switch (textDecorationStyle) { 677 switch (textDecorationStyle) {
678 case TextDecorationStyleSolid: 678 case TextDecorationStyleSolid:
679 return cssValuePool().createIdentifierValue(CSSValueSolid); 679 return cssValuePool().createIdentifierValue(CSSValueSolid);
680 case TextDecorationStyleDouble: 680 case TextDecorationStyleDouble:
681 return cssValuePool().createIdentifierValue(CSSValueDouble); 681 return cssValuePool().createIdentifierValue(CSSValueDouble);
682 case TextDecorationStyleDotted: 682 case TextDecorationStyleDotted:
683 return cssValuePool().createIdentifierValue(CSSValueDotted); 683 return cssValuePool().createIdentifierValue(CSSValueDotted);
684 case TextDecorationStyleDashed: 684 case TextDecorationStyleDashed:
685 return cssValuePool().createIdentifierValue(CSSValueDashed); 685 return cssValuePool().createIdentifierValue(CSSValueDashed);
686 case TextDecorationStyleWavy: 686 case TextDecorationStyleWavy:
687 return cssValuePool().createIdentifierValue(CSSValueWavy); 687 return cssValuePool().createIdentifierValue(CSSValueWavy);
688 } 688 }
689 689
690 ASSERT_NOT_REACHED(); 690 ASSERT_NOT_REACHED();
691 return cssValuePool().createExplicitInitialValue(); 691 return cssValuePool().createExplicitInitialValue();
692 } 692 }
693 693
694 static PassRefPtrWillBeRawPtr<CSSValue> touchActionFlagsToCSSValue(TouchAction t ouchAction) 694 static PassRefPtr<CSSValue> touchActionFlagsToCSSValue(TouchAction touchAction)
695 { 695 {
696 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 696 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
697 if (touchAction == TouchActionAuto) 697 if (touchAction == TouchActionAuto)
698 list->append(cssValuePool().createIdentifierValue(CSSValueAuto)); 698 list->append(cssValuePool().createIdentifierValue(CSSValueAuto));
699 if (touchAction & TouchActionNone) { 699 if (touchAction & TouchActionNone) {
700 ASSERT(touchAction == TouchActionNone); 700 ASSERT(touchAction == TouchActionNone);
701 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); 701 list->append(cssValuePool().createIdentifierValue(CSSValueNone));
702 } 702 }
703 if (touchAction == (TouchActionPanX | TouchActionPanY | TouchActionPinchZoom )) { 703 if (touchAction == (TouchActionPanX | TouchActionPanY | TouchActionPinchZoom )) {
704 list->append(cssValuePool().createIdentifierValue(CSSValueManipulation)) ; 704 list->append(cssValuePool().createIdentifierValue(CSSValueManipulation)) ;
705 } else { 705 } else {
706 if ((touchAction & TouchActionPanX) == TouchActionPanX) 706 if ((touchAction & TouchActionPanX) == TouchActionPanX)
707 list->append(cssValuePool().createIdentifierValue(CSSValuePanX)); 707 list->append(cssValuePool().createIdentifierValue(CSSValuePanX));
708 else if (touchAction & TouchActionPanLeft) 708 else if (touchAction & TouchActionPanLeft)
709 list->append(cssValuePool().createIdentifierValue(CSSValuePanLeft)); 709 list->append(cssValuePool().createIdentifierValue(CSSValuePanLeft));
710 else if (touchAction & TouchActionPanRight) 710 else if (touchAction & TouchActionPanRight)
711 list->append(cssValuePool().createIdentifierValue(CSSValuePanRight)) ; 711 list->append(cssValuePool().createIdentifierValue(CSSValuePanRight)) ;
712 712
713 if ((touchAction & TouchActionPanY) == TouchActionPanY) 713 if ((touchAction & TouchActionPanY) == TouchActionPanY)
714 list->append(cssValuePool().createIdentifierValue(CSSValuePanY)); 714 list->append(cssValuePool().createIdentifierValue(CSSValuePanY));
715 else if (touchAction & TouchActionPanUp) 715 else if (touchAction & TouchActionPanUp)
716 list->append(cssValuePool().createIdentifierValue(CSSValuePanUp)); 716 list->append(cssValuePool().createIdentifierValue(CSSValuePanUp));
717 else if (touchAction & TouchActionPanDown) 717 else if (touchAction & TouchActionPanDown)
718 list->append(cssValuePool().createIdentifierValue(CSSValuePanDown)); 718 list->append(cssValuePool().createIdentifierValue(CSSValuePanDown));
719 } 719 }
720 ASSERT(list->length()); 720 ASSERT(list->length());
721 return list.release(); 721 return list.release();
722 } 722 }
723 723
724 static PassRefPtrWillBeRawPtr<CSSValue> valueForWillChange(const Vector<CSSPrope rtyID>& willChangeProperties, bool willChangeContents, bool willChangeScrollPosi tion) 724 static PassRefPtr<CSSValue> valueForWillChange(const Vector<CSSPropertyID>& will ChangeProperties, bool willChangeContents, bool willChangeScrollPosition)
725 { 725 {
726 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ; 726 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
727 if (willChangeContents) 727 if (willChangeContents)
728 list->append(cssValuePool().createIdentifierValue(CSSValueContents)); 728 list->append(cssValuePool().createIdentifierValue(CSSValueContents));
729 if (willChangeScrollPosition) 729 if (willChangeScrollPosition)
730 list->append(cssValuePool().createIdentifierValue(CSSValueScrollPosition )); 730 list->append(cssValuePool().createIdentifierValue(CSSValueScrollPosition ));
731 for (size_t i = 0; i < willChangeProperties.size(); ++i) 731 for (size_t i = 0; i < willChangeProperties.size(); ++i)
732 list->append(cssValuePool().createIdentifierValue(willChangeProperties[i ])); 732 list->append(cssValuePool().createIdentifierValue(willChangeProperties[i ]));
733 if (!list->length()) 733 if (!list->length())
734 list->append(cssValuePool().createIdentifierValue(CSSValueAuto)); 734 list->append(cssValuePool().createIdentifierValue(CSSValueAuto));
735 return list.release(); 735 return list.release();
736 } 736 }
737 737
738 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationDelay(const CSSTimingDa ta* timingData) 738 static PassRefPtr<CSSValue> valueForAnimationDelay(const CSSTimingData* timingDa ta)
739 { 739 {
740 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ; 740 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
741 if (timingData) { 741 if (timingData) {
742 for (size_t i = 0; i < timingData->delayList().size(); ++i) 742 for (size_t i = 0; i < timingData->delayList().size(); ++i)
743 list->append(cssValuePool().createValue(timingData->delayList()[i], CSSPrimitiveValue::UnitType::Seconds)); 743 list->append(cssValuePool().createValue(timingData->delayList()[i], CSSPrimitiveValue::UnitType::Seconds));
744 } else { 744 } else {
745 list->append(cssValuePool().createValue(CSSTimingData::initialDelay(), C SSPrimitiveValue::UnitType::Seconds)); 745 list->append(cssValuePool().createValue(CSSTimingData::initialDelay(), C SSPrimitiveValue::UnitType::Seconds));
746 } 746 }
747 return list.release(); 747 return list.release();
748 } 748 }
749 749
750 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationDirection(Timing::Playb ackDirection direction) 750 static PassRefPtr<CSSValue> valueForAnimationDirection(Timing::PlaybackDirection direction)
751 { 751 {
752 switch (direction) { 752 switch (direction) {
753 case Timing::PlaybackDirectionNormal: 753 case Timing::PlaybackDirectionNormal:
754 return cssValuePool().createIdentifierValue(CSSValueNormal); 754 return cssValuePool().createIdentifierValue(CSSValueNormal);
755 case Timing::PlaybackDirectionAlternate: 755 case Timing::PlaybackDirectionAlternate:
756 return cssValuePool().createIdentifierValue(CSSValueAlternate); 756 return cssValuePool().createIdentifierValue(CSSValueAlternate);
757 case Timing::PlaybackDirectionReverse: 757 case Timing::PlaybackDirectionReverse:
758 return cssValuePool().createIdentifierValue(CSSValueReverse); 758 return cssValuePool().createIdentifierValue(CSSValueReverse);
759 case Timing::PlaybackDirectionAlternateReverse: 759 case Timing::PlaybackDirectionAlternateReverse:
760 return cssValuePool().createIdentifierValue(CSSValueAlternateReverse); 760 return cssValuePool().createIdentifierValue(CSSValueAlternateReverse);
761 default: 761 default:
762 ASSERT_NOT_REACHED(); 762 ASSERT_NOT_REACHED();
763 return nullptr; 763 return nullptr;
764 } 764 }
765 } 765 }
766 766
767 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationDuration(const CSSTimin gData* timingData) 767 static PassRefPtr<CSSValue> valueForAnimationDuration(const CSSTimingData* timin gData)
768 { 768 {
769 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ; 769 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
770 if (timingData) { 770 if (timingData) {
771 for (size_t i = 0; i < timingData->durationList().size(); ++i) 771 for (size_t i = 0; i < timingData->durationList().size(); ++i)
772 list->append(cssValuePool().createValue(timingData->durationList()[i ], CSSPrimitiveValue::UnitType::Seconds)); 772 list->append(cssValuePool().createValue(timingData->durationList()[i ], CSSPrimitiveValue::UnitType::Seconds));
773 } else { 773 } else {
774 list->append(cssValuePool().createValue(CSSTimingData::initialDuration() , CSSPrimitiveValue::UnitType::Seconds)); 774 list->append(cssValuePool().createValue(CSSTimingData::initialDuration() , CSSPrimitiveValue::UnitType::Seconds));
775 } 775 }
776 return list.release(); 776 return list.release();
777 } 777 }
778 778
779 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationFillMode(Timing::FillMo de fillMode) 779 static PassRefPtr<CSSValue> valueForAnimationFillMode(Timing::FillMode fillMode)
780 { 780 {
781 switch (fillMode) { 781 switch (fillMode) {
782 case Timing::FillModeNone: 782 case Timing::FillModeNone:
783 return cssValuePool().createIdentifierValue(CSSValueNone); 783 return cssValuePool().createIdentifierValue(CSSValueNone);
784 case Timing::FillModeForwards: 784 case Timing::FillModeForwards:
785 return cssValuePool().createIdentifierValue(CSSValueForwards); 785 return cssValuePool().createIdentifierValue(CSSValueForwards);
786 case Timing::FillModeBackwards: 786 case Timing::FillModeBackwards:
787 return cssValuePool().createIdentifierValue(CSSValueBackwards); 787 return cssValuePool().createIdentifierValue(CSSValueBackwards);
788 case Timing::FillModeBoth: 788 case Timing::FillModeBoth:
789 return cssValuePool().createIdentifierValue(CSSValueBoth); 789 return cssValuePool().createIdentifierValue(CSSValueBoth);
790 default: 790 default:
791 ASSERT_NOT_REACHED(); 791 ASSERT_NOT_REACHED();
792 return nullptr; 792 return nullptr;
793 } 793 }
794 } 794 }
795 795
796 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationIterationCount(double i terationCount) 796 static PassRefPtr<CSSValue> valueForAnimationIterationCount(double iterationCoun t)
797 { 797 {
798 if (iterationCount == std::numeric_limits<double>::infinity()) 798 if (iterationCount == std::numeric_limits<double>::infinity())
799 return cssValuePool().createIdentifierValue(CSSValueInfinite); 799 return cssValuePool().createIdentifierValue(CSSValueInfinite);
800 return cssValuePool().createValue(iterationCount, CSSPrimitiveValue::UnitTyp e::Number); 800 return cssValuePool().createValue(iterationCount, CSSPrimitiveValue::UnitTyp e::Number);
801 } 801 }
802 802
803 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationPlayState(EAnimPlayStat e playState) 803 static PassRefPtr<CSSValue> valueForAnimationPlayState(EAnimPlayState playState)
804 { 804 {
805 if (playState == AnimPlayStatePlaying) 805 if (playState == AnimPlayStatePlaying)
806 return cssValuePool().createIdentifierValue(CSSValueRunning); 806 return cssValuePool().createIdentifierValue(CSSValueRunning);
807 ASSERT(playState == AnimPlayStatePaused); 807 ASSERT(playState == AnimPlayStatePaused);
808 return cssValuePool().createIdentifierValue(CSSValuePaused); 808 return cssValuePool().createIdentifierValue(CSSValuePaused);
809 } 809 }
810 810
811 static PassRefPtrWillBeRawPtr<CSSValue> createTimingFunctionValue(const TimingFu nction* timingFunction) 811 static PassRefPtr<CSSValue> createTimingFunctionValue(const TimingFunction* timi ngFunction)
812 { 812 {
813 switch (timingFunction->type()) { 813 switch (timingFunction->type()) {
814 case TimingFunction::CubicBezierFunction: 814 case TimingFunction::CubicBezierFunction:
815 { 815 {
816 const CubicBezierTimingFunction* bezierTimingFunction = toCubicBezie rTimingFunction(timingFunction); 816 const CubicBezierTimingFunction* bezierTimingFunction = toCubicBezie rTimingFunction(timingFunction);
817 if (bezierTimingFunction->subType() != CubicBezierTimingFunction::Cu stom) { 817 if (bezierTimingFunction->subType() != CubicBezierTimingFunction::Cu stom) {
818 CSSValueID valueId = CSSValueInvalid; 818 CSSValueID valueId = CSSValueInvalid;
819 switch (bezierTimingFunction->subType()) { 819 switch (bezierTimingFunction->subType()) {
820 case CubicBezierTimingFunction::Ease: 820 case CubicBezierTimingFunction::Ease:
821 valueId = CSSValueEase; 821 valueId = CSSValueEase;
(...skipping 27 matching lines...) Expand all
849 return CSSStepsTimingFunctionValue::create(steps, position); 849 return CSSStepsTimingFunctionValue::create(steps, position);
850 CSSValueID valueId = position == StepsTimingFunction::Start ? CSSVal ueStepStart : CSSValueStepEnd; 850 CSSValueID valueId = position == StepsTimingFunction::Start ? CSSVal ueStepStart : CSSValueStepEnd;
851 return cssValuePool().createIdentifierValue(valueId); 851 return cssValuePool().createIdentifierValue(valueId);
852 } 852 }
853 853
854 default: 854 default:
855 return cssValuePool().createIdentifierValue(CSSValueLinear); 855 return cssValuePool().createIdentifierValue(CSSValueLinear);
856 } 856 }
857 } 857 }
858 858
859 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationTimingFunction(const CS STimingData* timingData) 859 static PassRefPtr<CSSValue> valueForAnimationTimingFunction(const CSSTimingData* timingData)
860 { 860 {
861 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ; 861 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
862 if (timingData) { 862 if (timingData) {
863 for (size_t i = 0; i < timingData->timingFunctionList().size(); ++i) 863 for (size_t i = 0; i < timingData->timingFunctionList().size(); ++i)
864 list->append(createTimingFunctionValue(timingData->timingFunctionLis t()[i].get())); 864 list->append(createTimingFunctionValue(timingData->timingFunctionLis t()[i].get()));
865 } else { 865 } else {
866 list->append(createTimingFunctionValue(CSSTimingData::initialTimingFunct ion().get())); 866 list->append(createTimingFunctionValue(CSSTimingData::initialTimingFunct ion().get()));
867 } 867 }
868 return list.release(); 868 return list.release();
869 } 869 }
870 870
871 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForBorderRadiusCorner(LengthSi ze radius, const ComputedStyle& style) 871 static PassRefPtr<CSSValueList> valuesForBorderRadiusCorner(LengthSize radius, c onst ComputedStyle& style)
872 { 872 {
873 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 873 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
874 if (radius.width().type() == Percent) 874 if (radius.width().type() == Percent)
875 list->append(cssValuePool().createValue(radius.width().percent(), CSSPri mitiveValue::UnitType::Percentage)); 875 list->append(cssValuePool().createValue(radius.width().percent(), CSSPri mitiveValue::UnitType::Percentage));
876 else 876 else
877 list->append(zoomAdjustedPixelValueForLength(radius.width(), style)); 877 list->append(zoomAdjustedPixelValueForLength(radius.width(), style));
878 if (radius.height().type() == Percent) 878 if (radius.height().type() == Percent)
879 list->append(cssValuePool().createValue(radius.height().percent(), CSSPr imitiveValue::UnitType::Percentage)); 879 list->append(cssValuePool().createValue(radius.height().percent(), CSSPr imitiveValue::UnitType::Percentage));
880 else 880 else
881 list->append(zoomAdjustedPixelValueForLength(radius.height(), style)); 881 list->append(zoomAdjustedPixelValueForLength(radius.height(), style));
882 return list.release(); 882 return list.release();
883 } 883 }
884 884
885 static PassRefPtrWillBeRawPtr<CSSValue> valueForBorderRadiusCorner(LengthSize ra dius, const ComputedStyle& style) 885 static PassRefPtr<CSSValue> valueForBorderRadiusCorner(LengthSize radius, const ComputedStyle& style)
886 { 886 {
887 RefPtrWillBeRawPtr<CSSValueList> list = valuesForBorderRadiusCorner(radius, style); 887 RefPtr<CSSValueList> list = valuesForBorderRadiusCorner(radius, style);
888 if (list->item(0)->equals(*list->item(1))) 888 if (list->item(0)->equals(*list->item(1)))
889 return list->item(0); 889 return list->item(0);
890 return list.release(); 890 return list.release();
891 } 891 }
892 892
893 static PassRefPtrWillBeRawPtr<CSSFunctionValue> valueForMatrixTransform(const Tr ansformationMatrix& transform, const ComputedStyle& style) 893 static PassRefPtr<CSSFunctionValue> valueForMatrixTransform(const Transformation Matrix& transform, const ComputedStyle& style)
894 { 894 {
895 RefPtrWillBeRawPtr<CSSFunctionValue> transformValue = nullptr; 895 RefPtr<CSSFunctionValue> transformValue = nullptr;
896 if (transform.isAffine()) { 896 if (transform.isAffine()) {
897 transformValue = CSSFunctionValue::create(CSSValueMatrix); 897 transformValue = CSSFunctionValue::create(CSSValueMatrix);
898 898
899 transformValue->append(cssValuePool().createValue(transform.a(), CSSPrim itiveValue::UnitType::Number)); 899 transformValue->append(cssValuePool().createValue(transform.a(), CSSPrim itiveValue::UnitType::Number));
900 transformValue->append(cssValuePool().createValue(transform.b(), CSSPrim itiveValue::UnitType::Number)); 900 transformValue->append(cssValuePool().createValue(transform.b(), CSSPrim itiveValue::UnitType::Number));
901 transformValue->append(cssValuePool().createValue(transform.c(), CSSPrim itiveValue::UnitType::Number)); 901 transformValue->append(cssValuePool().createValue(transform.c(), CSSPrim itiveValue::UnitType::Number));
902 transformValue->append(cssValuePool().createValue(transform.d(), CSSPrim itiveValue::UnitType::Number)); 902 transformValue->append(cssValuePool().createValue(transform.d(), CSSPrim itiveValue::UnitType::Number));
903 transformValue->append(zoomAdjustedNumberValue(transform.e(), style)); 903 transformValue->append(zoomAdjustedNumberValue(transform.e(), style));
904 transformValue->append(zoomAdjustedNumberValue(transform.f(), style)); 904 transformValue->append(zoomAdjustedNumberValue(transform.f(), style));
905 } else { 905 } else {
(...skipping 16 matching lines...) Expand all
922 922
923 transformValue->append(zoomAdjustedNumberValue(transform.m41(), style)); 923 transformValue->append(zoomAdjustedNumberValue(transform.m41(), style));
924 transformValue->append(zoomAdjustedNumberValue(transform.m42(), style)); 924 transformValue->append(zoomAdjustedNumberValue(transform.m42(), style));
925 transformValue->append(zoomAdjustedNumberValue(transform.m43(), style)); 925 transformValue->append(zoomAdjustedNumberValue(transform.m43(), style));
926 transformValue->append(cssValuePool().createValue(transform.m44(), CSSPr imitiveValue::UnitType::Number)); 926 transformValue->append(cssValuePool().createValue(transform.m44(), CSSPr imitiveValue::UnitType::Number));
927 } 927 }
928 928
929 return transformValue.release(); 929 return transformValue.release();
930 } 930 }
931 931
932 static PassRefPtrWillBeRawPtr<CSSValue> computedTransform(const LayoutObject* la youtObject, const ComputedStyle& style) 932 static PassRefPtr<CSSValue> computedTransform(const LayoutObject* layoutObject, const ComputedStyle& style)
933 { 933 {
934 if (!layoutObject || !style.hasTransform()) 934 if (!layoutObject || !style.hasTransform())
935 return cssValuePool().createIdentifierValue(CSSValueNone); 935 return cssValuePool().createIdentifierValue(CSSValueNone);
936 936
937 IntRect box; 937 IntRect box;
938 if (layoutObject->isBox()) 938 if (layoutObject->isBox())
939 box = pixelSnappedIntRect(toLayoutBox(layoutObject)->borderBoxRect()); 939 box = pixelSnappedIntRect(toLayoutBox(layoutObject)->borderBoxRect());
940 940
941 TransformationMatrix transform; 941 TransformationMatrix transform;
942 style.applyTransform(transform, LayoutSize(box.size()), ComputedStyle::Exclu deTransformOrigin, ComputedStyle::ExcludeMotionPath, ComputedStyle::ExcludeIndep endentTransformProperties); 942 style.applyTransform(transform, LayoutSize(box.size()), ComputedStyle::Exclu deTransformOrigin, ComputedStyle::ExcludeMotionPath, ComputedStyle::ExcludeIndep endentTransformProperties);
943 943
944 // FIXME: Need to print out individual functions (https://bugs.webkit.org/sh ow_bug.cgi?id=23924) 944 // FIXME: Need to print out individual functions (https://bugs.webkit.org/sh ow_bug.cgi?id=23924)
945 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 945 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
946 list->append(valueForMatrixTransform(transform, style)); 946 list->append(valueForMatrixTransform(transform, style));
947 947
948 return list.release(); 948 return list.release();
949 } 949 }
950 950
951 static PassRefPtrWillBeRawPtr<CSSValue> createTransitionPropertyValue(const CSST ransitionData::TransitionProperty& property) 951 static PassRefPtr<CSSValue> createTransitionPropertyValue(const CSSTransitionDat a::TransitionProperty& property)
952 { 952 {
953 if (property.propertyType == CSSTransitionData::TransitionNone) 953 if (property.propertyType == CSSTransitionData::TransitionNone)
954 return cssValuePool().createIdentifierValue(CSSValueNone); 954 return cssValuePool().createIdentifierValue(CSSValueNone);
955 if (property.propertyType == CSSTransitionData::TransitionUnknownProperty) 955 if (property.propertyType == CSSTransitionData::TransitionUnknownProperty)
956 return cssValuePool().createValue(property.propertyString, CSSPrimitiveV alue::UnitType::CustomIdentifier); 956 return cssValuePool().createValue(property.propertyString, CSSPrimitiveV alue::UnitType::CustomIdentifier);
957 ASSERT(property.propertyType == CSSTransitionData::TransitionKnownProperty); 957 ASSERT(property.propertyType == CSSTransitionData::TransitionKnownProperty);
958 return cssValuePool().createValue(getPropertyNameString(property.unresolvedP roperty), CSSPrimitiveValue::UnitType::CustomIdentifier); 958 return cssValuePool().createValue(getPropertyNameString(property.unresolvedP roperty), CSSPrimitiveValue::UnitType::CustomIdentifier);
959 } 959 }
960 960
961 static PassRefPtrWillBeRawPtr<CSSValue> valueForTransitionProperty(const CSSTran sitionData* transitionData) 961 static PassRefPtr<CSSValue> valueForTransitionProperty(const CSSTransitionData* transitionData)
962 { 962 {
963 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ; 963 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
964 if (transitionData) { 964 if (transitionData) {
965 for (size_t i = 0; i < transitionData->propertyList().size(); ++i) 965 for (size_t i = 0; i < transitionData->propertyList().size(); ++i)
966 list->append(createTransitionPropertyValue(transitionData->propertyL ist()[i])); 966 list->append(createTransitionPropertyValue(transitionData->propertyL ist()[i]));
967 } else { 967 } else {
968 list->append(cssValuePool().createIdentifierValue(CSSValueAll)); 968 list->append(cssValuePool().createIdentifierValue(CSSValueAll));
969 } 969 }
970 return list.release(); 970 return list.release();
971 } 971 }
972 972
973 static PassRefPtrWillBeRawPtr<CSSValue> createLineBoxContainValue(unsigned lineB oxContain) 973 static PassRefPtr<CSSValue> createLineBoxContainValue(unsigned lineBoxContain)
974 { 974 {
975 if (!lineBoxContain) 975 if (!lineBoxContain)
976 return cssValuePool().createIdentifierValue(CSSValueNone); 976 return cssValuePool().createIdentifierValue(CSSValueNone);
977 return CSSLineBoxContainValue::create(lineBoxContain); 977 return CSSLineBoxContainValue::create(lineBoxContain);
978 } 978 }
979 979
980 CSSValueID valueForQuoteType(const QuoteType quoteType) 980 CSSValueID valueForQuoteType(const QuoteType quoteType)
981 { 981 {
982 switch (quoteType) { 982 switch (quoteType) {
983 case NO_OPEN_QUOTE: 983 case NO_OPEN_QUOTE:
984 return CSSValueNoOpenQuote; 984 return CSSValueNoOpenQuote;
985 case NO_CLOSE_QUOTE: 985 case NO_CLOSE_QUOTE:
986 return CSSValueNoCloseQuote; 986 return CSSValueNoCloseQuote;
987 case CLOSE_QUOTE: 987 case CLOSE_QUOTE:
988 return CSSValueCloseQuote; 988 return CSSValueCloseQuote;
989 case OPEN_QUOTE: 989 case OPEN_QUOTE:
990 return CSSValueOpenQuote; 990 return CSSValueOpenQuote;
991 } 991 }
992 ASSERT_NOT_REACHED(); 992 ASSERT_NOT_REACHED();
993 return CSSValueInvalid; 993 return CSSValueInvalid;
994 } 994 }
995 995
996 static PassRefPtrWillBeRawPtr<CSSValue> valueForContentData(const ComputedStyle& style) 996 static PassRefPtr<CSSValue> valueForContentData(const ComputedStyle& style)
997 { 997 {
998 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 998 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
999 for (const ContentData* contentData = style.contentData(); contentData; cont entData = contentData->next()) { 999 for (const ContentData* contentData = style.contentData(); contentData; cont entData = contentData->next()) {
1000 if (contentData->isCounter()) { 1000 if (contentData->isCounter()) {
1001 const CounterContent* counter = toCounterContentData(contentData)->c ounter(); 1001 const CounterContent* counter = toCounterContentData(contentData)->c ounter();
1002 ASSERT(counter); 1002 ASSERT(counter);
1003 RefPtrWillBeRawPtr<CSSPrimitiveValue> identifier = cssValuePool().cr eateValue(counter->identifier(), CSSPrimitiveValue::UnitType::CustomIdentifier); 1003 RefPtr<CSSPrimitiveValue> identifier = cssValuePool().createValue(co unter->identifier(), CSSPrimitiveValue::UnitType::CustomIdentifier);
1004 RefPtrWillBeRawPtr<CSSPrimitiveValue> separator = cssValuePool().cre ateValue(counter->separator(), CSSPrimitiveValue::UnitType::CustomIdentifier); 1004 RefPtr<CSSPrimitiveValue> separator = cssValuePool().createValue(cou nter->separator(), CSSPrimitiveValue::UnitType::CustomIdentifier);
1005 CSSValueID listStyleIdent = CSSValueNone; 1005 CSSValueID listStyleIdent = CSSValueNone;
1006 if (counter->listStyle() != NoneListStyle) 1006 if (counter->listStyle() != NoneListStyle)
1007 listStyleIdent = static_cast<CSSValueID>(CSSValueDisc + counter- >listStyle()); 1007 listStyleIdent = static_cast<CSSValueID>(CSSValueDisc + counter- >listStyle());
1008 RefPtrWillBeRawPtr<CSSPrimitiveValue> listStyle = cssValuePool().cre ateIdentifierValue(listStyleIdent); 1008 RefPtr<CSSPrimitiveValue> listStyle = cssValuePool().createIdentifie rValue(listStyleIdent);
1009 list->append(CSSCounterValue::create(identifier.release(), listStyle .release(), separator.release())); 1009 list->append(CSSCounterValue::create(identifier.release(), listStyle .release(), separator.release()));
1010 } else if (contentData->isImage()) { 1010 } else if (contentData->isImage()) {
1011 const StyleImage* image = toImageContentData(contentData)->image(); 1011 const StyleImage* image = toImageContentData(contentData)->image();
1012 ASSERT(image); 1012 ASSERT(image);
1013 list->append(image->cssValue()); 1013 list->append(image->cssValue());
1014 } else if (contentData->isText()) { 1014 } else if (contentData->isText()) {
1015 list->append(cssValuePool().createValue(toTextContentData(contentDat a)->text(), CSSPrimitiveValue::UnitType::String)); 1015 list->append(cssValuePool().createValue(toTextContentData(contentDat a)->text(), CSSPrimitiveValue::UnitType::String));
1016 } else if (contentData->isQuote()) { 1016 } else if (contentData->isQuote()) {
1017 const QuoteType quoteType = toQuoteContentData(contentData)->quote() ; 1017 const QuoteType quoteType = toQuoteContentData(contentData)->quote() ;
1018 list->append(cssValuePool().createIdentifierValue(valueForQuoteType( quoteType))); 1018 list->append(cssValuePool().createIdentifierValue(valueForQuoteType( quoteType)));
1019 } else { 1019 } else {
1020 ASSERT_NOT_REACHED(); 1020 ASSERT_NOT_REACHED();
1021 } 1021 }
1022 } 1022 }
1023 return list.release(); 1023 return list.release();
1024 } 1024 }
1025 1025
1026 static PassRefPtrWillBeRawPtr<CSSValue> valueForCounterDirectives(const Computed Style& style, CSSPropertyID propertyID) 1026 static PassRefPtr<CSSValue> valueForCounterDirectives(const ComputedStyle& style , CSSPropertyID propertyID)
1027 { 1027 {
1028 const CounterDirectiveMap* map = style.counterDirectives(); 1028 const CounterDirectiveMap* map = style.counterDirectives();
1029 if (!map) 1029 if (!map)
1030 return cssValuePool().createIdentifierValue(CSSValueNone); 1030 return cssValuePool().createIdentifierValue(CSSValueNone);
1031 1031
1032 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 1032 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1033 for (const auto& item : *map) { 1033 for (const auto& item : *map) {
1034 bool isValidCounterValue = propertyID == CSSPropertyCounterIncrement ? i tem.value.isIncrement() : item.value.isReset(); 1034 bool isValidCounterValue = propertyID == CSSPropertyCounterIncrement ? i tem.value.isIncrement() : item.value.isReset();
1035 if (!isValidCounterValue) 1035 if (!isValidCounterValue)
1036 continue; 1036 continue;
1037 1037
1038 list->append(cssValuePool().createValue(item.key, CSSPrimitiveValue::Uni tType::CustomIdentifier)); 1038 list->append(cssValuePool().createValue(item.key, CSSPrimitiveValue::Uni tType::CustomIdentifier));
1039 short number = propertyID == CSSPropertyCounterIncrement ? item.value.in crementValue() : item.value.resetValue(); 1039 short number = propertyID == CSSPropertyCounterIncrement ? item.value.in crementValue() : item.value.resetValue();
1040 list->append(cssValuePool().createValue((double)number, CSSPrimitiveValu e::UnitType::Number)); 1040 list->append(cssValuePool().createValue((double)number, CSSPrimitiveValu e::UnitType::Number));
1041 } 1041 }
1042 1042
1043 if (!list->length()) 1043 if (!list->length())
1044 return cssValuePool().createIdentifierValue(CSSValueNone); 1044 return cssValuePool().createIdentifierValue(CSSValueNone);
1045 1045
1046 return list.release(); 1046 return list.release();
1047 } 1047 }
1048 1048
1049 static PassRefPtrWillBeRawPtr<CSSValue> valueForShape(const ComputedStyle& style , ShapeValue* shapeValue) 1049 static PassRefPtr<CSSValue> valueForShape(const ComputedStyle& style, ShapeValue * shapeValue)
1050 { 1050 {
1051 if (!shapeValue) 1051 if (!shapeValue)
1052 return cssValuePool().createIdentifierValue(CSSValueNone); 1052 return cssValuePool().createIdentifierValue(CSSValueNone);
1053 if (shapeValue->type() == ShapeValue::Box) 1053 if (shapeValue->type() == ShapeValue::Box)
1054 return cssValuePool().createValue(shapeValue->cssBox()); 1054 return cssValuePool().createValue(shapeValue->cssBox());
1055 if (shapeValue->type() == ShapeValue::Image) { 1055 if (shapeValue->type() == ShapeValue::Image) {
1056 if (shapeValue->image()) 1056 if (shapeValue->image())
1057 return shapeValue->image()->cssValue(); 1057 return shapeValue->image()->cssValue();
1058 return cssValuePool().createIdentifierValue(CSSValueNone); 1058 return cssValuePool().createIdentifierValue(CSSValueNone);
1059 } 1059 }
1060 1060
1061 ASSERT(shapeValue->type() == ShapeValue::Shape); 1061 ASSERT(shapeValue->type() == ShapeValue::Shape);
1062 1062
1063 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 1063 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1064 list->append(valueForBasicShape(style, shapeValue->shape())); 1064 list->append(valueForBasicShape(style, shapeValue->shape()));
1065 if (shapeValue->cssBox() != BoxMissing) 1065 if (shapeValue->cssBox() != BoxMissing)
1066 list->append(cssValuePool().createValue(shapeValue->cssBox())); 1066 list->append(cssValuePool().createValue(shapeValue->cssBox()));
1067 return list.release(); 1067 return list.release();
1068 } 1068 }
1069 1069
1070 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForSidesShorthand(const StyleP ropertyShorthand& shorthand, const ComputedStyle& style, const LayoutObject* lay outObject, Node* styledNode, bool allowVisitedStyle) 1070 static PassRefPtr<CSSValueList> valuesForSidesShorthand(const StylePropertyShort hand& shorthand, const ComputedStyle& style, const LayoutObject* layoutObject, N ode* styledNode, bool allowVisitedStyle)
1071 { 1071 {
1072 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 1072 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1073 // Assume the properties are in the usual order top, right, bottom, left. 1073 // Assume the properties are in the usual order top, right, bottom, left.
1074 RefPtrWillBeRawPtr<CSSValue> topValue = ComputedStyleCSSValueMapping::get(sh orthand.properties()[0], style, layoutObject, styledNode, allowVisitedStyle); 1074 RefPtr<CSSValue> topValue = ComputedStyleCSSValueMapping::get(shorthand.prop erties()[0], style, layoutObject, styledNode, allowVisitedStyle);
1075 RefPtrWillBeRawPtr<CSSValue> rightValue = ComputedStyleCSSValueMapping::get( shorthand.properties()[1], style, layoutObject, styledNode, allowVisitedStyle); 1075 RefPtr<CSSValue> rightValue = ComputedStyleCSSValueMapping::get(shorthand.pr operties()[1], style, layoutObject, styledNode, allowVisitedStyle);
1076 RefPtrWillBeRawPtr<CSSValue> bottomValue = ComputedStyleCSSValueMapping::get (shorthand.properties()[2], style, layoutObject, styledNode, allowVisitedStyle); 1076 RefPtr<CSSValue> bottomValue = ComputedStyleCSSValueMapping::get(shorthand.p roperties()[2], style, layoutObject, styledNode, allowVisitedStyle);
1077 RefPtrWillBeRawPtr<CSSValue> leftValue = ComputedStyleCSSValueMapping::get(s horthand.properties()[3], style, layoutObject, styledNode, allowVisitedStyle); 1077 RefPtr<CSSValue> leftValue = ComputedStyleCSSValueMapping::get(shorthand.pro perties()[3], style, layoutObject, styledNode, allowVisitedStyle);
1078 1078
1079 // All 4 properties must be specified. 1079 // All 4 properties must be specified.
1080 if (!topValue || !rightValue || !bottomValue || !leftValue) 1080 if (!topValue || !rightValue || !bottomValue || !leftValue)
1081 return nullptr; 1081 return nullptr;
1082 1082
1083 bool showLeft = !compareCSSValuePtr(rightValue, leftValue); 1083 bool showLeft = !compareCSSValuePtr(rightValue, leftValue);
1084 bool showBottom = !compareCSSValuePtr(topValue, bottomValue) || showLeft; 1084 bool showBottom = !compareCSSValuePtr(topValue, bottomValue) || showLeft;
1085 bool showRight = !compareCSSValuePtr(topValue, rightValue) || showBottom; 1085 bool showRight = !compareCSSValuePtr(topValue, rightValue) || showBottom;
1086 1086
1087 list->append(topValue.release()); 1087 list->append(topValue.release());
1088 if (showRight) 1088 if (showRight)
1089 list->append(rightValue.release()); 1089 list->append(rightValue.release());
1090 if (showBottom) 1090 if (showBottom)
1091 list->append(bottomValue.release()); 1091 list->append(bottomValue.release());
1092 if (showLeft) 1092 if (showLeft)
1093 list->append(leftValue.release()); 1093 list->append(leftValue.release());
1094 1094
1095 return list.release(); 1095 return list.release();
1096 } 1096 }
1097 1097
1098 static PassRefPtrWillBeRawPtr<CSSValueList> valueForBorderRadiusShorthand(const ComputedStyle& style) 1098 static PassRefPtr<CSSValueList> valueForBorderRadiusShorthand(const ComputedStyl e& style)
1099 { 1099 {
1100 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated() ; 1100 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
1101 1101
1102 bool showHorizontalBottomLeft = style.borderTopRightRadius().width() != styl e.borderBottomLeftRadius().width(); 1102 bool showHorizontalBottomLeft = style.borderTopRightRadius().width() != styl e.borderBottomLeftRadius().width();
1103 bool showHorizontalBottomRight = showHorizontalBottomLeft || (style.borderBo ttomRightRadius().width() != style.borderTopLeftRadius().width()); 1103 bool showHorizontalBottomRight = showHorizontalBottomLeft || (style.borderBo ttomRightRadius().width() != style.borderTopLeftRadius().width());
1104 bool showHorizontalTopRight = showHorizontalBottomRight || (style.borderTopR ightRadius().width() != style.borderTopLeftRadius().width()); 1104 bool showHorizontalTopRight = showHorizontalBottomRight || (style.borderTopR ightRadius().width() != style.borderTopLeftRadius().width());
1105 1105
1106 bool showVerticalBottomLeft = style.borderTopRightRadius().height() != style .borderBottomLeftRadius().height(); 1106 bool showVerticalBottomLeft = style.borderTopRightRadius().height() != style .borderBottomLeftRadius().height();
1107 bool showVerticalBottomRight = showVerticalBottomLeft || (style.borderBottom RightRadius().height() != style.borderTopLeftRadius().height()); 1107 bool showVerticalBottomRight = showVerticalBottomLeft || (style.borderBottom RightRadius().height() != style.borderTopLeftRadius().height());
1108 bool showVerticalTopRight = showVerticalBottomRight || (style.borderTopRight Radius().height() != style.borderTopLeftRadius().height()); 1108 bool showVerticalTopRight = showVerticalBottomRight || (style.borderTopRight Radius().height() != style.borderTopLeftRadius().height());
1109 1109
1110 RefPtrWillBeRawPtr<CSSValueList> topLeftRadius = valuesForBorderRadiusCorner (style.borderTopLeftRadius(), style); 1110 RefPtr<CSSValueList> topLeftRadius = valuesForBorderRadiusCorner(style.borde rTopLeftRadius(), style);
1111 RefPtrWillBeRawPtr<CSSValueList> topRightRadius = valuesForBorderRadiusCorne r(style.borderTopRightRadius(), style); 1111 RefPtr<CSSValueList> topRightRadius = valuesForBorderRadiusCorner(style.bord erTopRightRadius(), style);
1112 RefPtrWillBeRawPtr<CSSValueList> bottomRightRadius = valuesForBorderRadiusCo rner(style.borderBottomRightRadius(), style); 1112 RefPtr<CSSValueList> bottomRightRadius = valuesForBorderRadiusCorner(style.b orderBottomRightRadius(), style);
1113 RefPtrWillBeRawPtr<CSSValueList> bottomLeftRadius = valuesForBorderRadiusCor ner(style.borderBottomLeftRadius(), style); 1113 RefPtr<CSSValueList> bottomLeftRadius = valuesForBorderRadiusCorner(style.bo rderBottomLeftRadius(), style);
1114 1114
1115 RefPtrWillBeRawPtr<CSSValueList> horizontalRadii = CSSValueList::createSpace Separated(); 1115 RefPtr<CSSValueList> horizontalRadii = CSSValueList::createSpaceSeparated();
1116 horizontalRadii->append(topLeftRadius->item(0)); 1116 horizontalRadii->append(topLeftRadius->item(0));
1117 if (showHorizontalTopRight) 1117 if (showHorizontalTopRight)
1118 horizontalRadii->append(topRightRadius->item(0)); 1118 horizontalRadii->append(topRightRadius->item(0));
1119 if (showHorizontalBottomRight) 1119 if (showHorizontalBottomRight)
1120 horizontalRadii->append(bottomRightRadius->item(0)); 1120 horizontalRadii->append(bottomRightRadius->item(0));
1121 if (showHorizontalBottomLeft) 1121 if (showHorizontalBottomLeft)
1122 horizontalRadii->append(bottomLeftRadius->item(0)); 1122 horizontalRadii->append(bottomLeftRadius->item(0));
1123 1123
1124 list->append(horizontalRadii.release()); 1124 list->append(horizontalRadii.release());
1125 1125
1126 RefPtrWillBeRawPtr<CSSValueList> verticalRadii = CSSValueList::createSpaceSe parated(); 1126 RefPtr<CSSValueList> verticalRadii = CSSValueList::createSpaceSeparated();
1127 verticalRadii->append(topLeftRadius->item(1)); 1127 verticalRadii->append(topLeftRadius->item(1));
1128 if (showVerticalTopRight) 1128 if (showVerticalTopRight)
1129 verticalRadii->append(topRightRadius->item(1)); 1129 verticalRadii->append(topRightRadius->item(1));
1130 if (showVerticalBottomRight) 1130 if (showVerticalBottomRight)
1131 verticalRadii->append(bottomRightRadius->item(1)); 1131 verticalRadii->append(bottomRightRadius->item(1));
1132 if (showVerticalBottomLeft) 1132 if (showVerticalBottomLeft)
1133 verticalRadii->append(bottomLeftRadius->item(1)); 1133 verticalRadii->append(bottomLeftRadius->item(1));
1134 1134
1135 if (!verticalRadii->equals(*toCSSValueList(list->item(0)))) 1135 if (!verticalRadii->equals(*toCSSValueList(list->item(0))))
1136 list->append(verticalRadii.release()); 1136 list->append(verticalRadii.release());
1137 1137
1138 return list.release(); 1138 return list.release();
1139 } 1139 }
1140 1140
1141 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> glyphOrientationToCSSPrimitiveV alue(EGlyphOrientation orientation) 1141 static PassRefPtr<CSSPrimitiveValue> glyphOrientationToCSSPrimitiveValue(EGlyphO rientation orientation)
1142 { 1142 {
1143 switch (orientation) { 1143 switch (orientation) {
1144 case GO_0DEG: 1144 case GO_0DEG:
1145 return CSSPrimitiveValue::create(0.0f, CSSPrimitiveValue::UnitType::Degr ees); 1145 return CSSPrimitiveValue::create(0.0f, CSSPrimitiveValue::UnitType::Degr ees);
1146 case GO_90DEG: 1146 case GO_90DEG:
1147 return CSSPrimitiveValue::create(90.0f, CSSPrimitiveValue::UnitType::Deg rees); 1147 return CSSPrimitiveValue::create(90.0f, CSSPrimitiveValue::UnitType::Deg rees);
1148 case GO_180DEG: 1148 case GO_180DEG:
1149 return CSSPrimitiveValue::create(180.0f, CSSPrimitiveValue::UnitType::De grees); 1149 return CSSPrimitiveValue::create(180.0f, CSSPrimitiveValue::UnitType::De grees);
1150 case GO_270DEG: 1150 case GO_270DEG:
1151 return CSSPrimitiveValue::create(270.0f, CSSPrimitiveValue::UnitType::De grees); 1151 return CSSPrimitiveValue::create(270.0f, CSSPrimitiveValue::UnitType::De grees);
1152 default: 1152 default:
1153 return nullptr; 1153 return nullptr;
1154 } 1154 }
1155 } 1155 }
1156 1156
1157 static PassRefPtrWillBeRawPtr<CSSValue> strokeDashArrayToCSSValueList(const SVGD ashArray& dashes, const ComputedStyle& style) 1157 static PassRefPtr<CSSValue> strokeDashArrayToCSSValueList(const SVGDashArray& da shes, const ComputedStyle& style)
1158 { 1158 {
1159 if (dashes.isEmpty()) 1159 if (dashes.isEmpty())
1160 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 1160 return CSSPrimitiveValue::createIdentifier(CSSValueNone);
1161 1161
1162 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ; 1162 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1163 for (const Length& dashLength : dashes.vector()) 1163 for (const Length& dashLength : dashes.vector())
1164 list->append(zoomAdjustedPixelValueForLength(dashLength, style)); 1164 list->append(zoomAdjustedPixelValueForLength(dashLength, style));
1165 1165
1166 return list.release(); 1166 return list.release();
1167 } 1167 }
1168 1168
1169 static PassRefPtrWillBeRawPtr<CSSValue> paintOrderToCSSValueList(const SVGComput edStyle& svgStyle) 1169 static PassRefPtr<CSSValue> paintOrderToCSSValueList(const SVGComputedStyle& svg Style)
1170 { 1170 {
1171 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 1171 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1172 for (int i = 0; i < 3; i++) { 1172 for (int i = 0; i < 3; i++) {
1173 EPaintOrderType paintOrderType = svgStyle.paintOrderType(i); 1173 EPaintOrderType paintOrderType = svgStyle.paintOrderType(i);
1174 switch (paintOrderType) { 1174 switch (paintOrderType) {
1175 case PT_FILL: 1175 case PT_FILL:
1176 case PT_STROKE: 1176 case PT_STROKE:
1177 case PT_MARKERS: 1177 case PT_MARKERS:
1178 list->append(CSSPrimitiveValue::create(paintOrderType)); 1178 list->append(CSSPrimitiveValue::create(paintOrderType));
1179 break; 1179 break;
1180 case PT_NONE: 1180 case PT_NONE:
1181 default: 1181 default:
1182 ASSERT_NOT_REACHED(); 1182 ASSERT_NOT_REACHED();
1183 break; 1183 break;
1184 } 1184 }
1185 } 1185 }
1186 1186
1187 return list.release(); 1187 return list.release();
1188 } 1188 }
1189 1189
1190 static PassRefPtrWillBeRawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintTy pe paintType, const String& url, const Color& color, const Color& currentColor) 1190 static PassRefPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintType paintType , const String& url, const Color& color, const Color& currentColor)
1191 { 1191 {
1192 if (paintType >= SVG_PAINTTYPE_URI_NONE) { 1192 if (paintType >= SVG_PAINTTYPE_URI_NONE) {
1193 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSepar ated(); 1193 RefPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
1194 values->append(CSSPrimitiveValue::create(url, CSSPrimitiveValue::UnitTyp e::URI)); 1194 values->append(CSSPrimitiveValue::create(url, CSSPrimitiveValue::UnitTyp e::URI));
1195 if (paintType == SVG_PAINTTYPE_URI_NONE) 1195 if (paintType == SVG_PAINTTYPE_URI_NONE)
1196 values->append(CSSPrimitiveValue::create(CSSValueNone)); 1196 values->append(CSSPrimitiveValue::create(CSSValueNone));
1197 else if (paintType == SVG_PAINTTYPE_URI_CURRENTCOLOR) 1197 else if (paintType == SVG_PAINTTYPE_URI_CURRENTCOLOR)
1198 values->append(CSSPrimitiveValue::createColor(currentColor.rgb())); 1198 values->append(CSSPrimitiveValue::createColor(currentColor.rgb()));
1199 else if (paintType == SVG_PAINTTYPE_URI_RGBCOLOR) 1199 else if (paintType == SVG_PAINTTYPE_URI_RGBCOLOR)
1200 values->append(CSSPrimitiveValue::createColor(color.rgb())); 1200 values->append(CSSPrimitiveValue::createColor(color.rgb()));
1201 return values.release(); 1201 return values.release();
1202 } 1202 }
1203 if (paintType == SVG_PAINTTYPE_NONE) 1203 if (paintType == SVG_PAINTTYPE_NONE)
1204 return CSSPrimitiveValue::create(CSSValueNone); 1204 return CSSPrimitiveValue::create(CSSValueNone);
1205 if (paintType == SVG_PAINTTYPE_CURRENTCOLOR) 1205 if (paintType == SVG_PAINTTYPE_CURRENTCOLOR)
1206 return CSSPrimitiveValue::createColor(currentColor.rgb()); 1206 return CSSPrimitiveValue::createColor(currentColor.rgb());
1207 1207
1208 return CSSPrimitiveValue::createColor(color.rgb()); 1208 return CSSPrimitiveValue::createColor(color.rgb());
1209 } 1209 }
1210 1210
1211 static inline String serializeAsFragmentIdentifier(const AtomicString& resource) 1211 static inline String serializeAsFragmentIdentifier(const AtomicString& resource)
1212 { 1212 {
1213 return "#" + resource; 1213 return "#" + resource;
1214 } 1214 }
1215 1215
1216 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowDat a(const ShadowData& shadow, const ComputedStyle& style, bool useSpread) 1216 PassRefPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowData(const Shad owData& shadow, const ComputedStyle& style, bool useSpread)
1217 { 1217 {
1218 RefPtrWillBeRawPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(shadow.x(), style); 1218 RefPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(shadow.x(), style);
1219 RefPtrWillBeRawPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(shadow.y(), style); 1219 RefPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(shadow.y(), style);
1220 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(shadow.b lur(), style); 1220 RefPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(shadow.blur(), style );
1221 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = useSpread ? zoomAdjustedPixel Value(shadow.spread(), style) : PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullpt r); 1221 RefPtr<CSSPrimitiveValue> spread = useSpread ? zoomAdjustedPixelValue(shadow .spread(), style) : PassRefPtr<CSSPrimitiveValue>(nullptr);
1222 RefPtrWillBeRawPtr<CSSPrimitiveValue> shadowStyle = shadow.style() == Normal ? PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullptr) : cssValuePool().createIde ntifierValue(CSSValueInset); 1222 RefPtr<CSSPrimitiveValue> shadowStyle = shadow.style() == Normal ? PassRefPt r<CSSPrimitiveValue>(nullptr) : cssValuePool().createIdentifierValue(CSSValueIns et);
1223 RefPtrWillBeRawPtr<CSSPrimitiveValue> color = currentColorOrValidColor(style , shadow.color()); 1223 RefPtr<CSSPrimitiveValue> color = currentColorOrValidColor(style, shadow.col or());
1224 return CSSShadowValue::create(x.release(), y.release(), blur.release(), spre ad.release(), shadowStyle.release(), color.release()); 1224 return CSSShadowValue::create(x.release(), y.release(), blur.release(), spre ad.release(), shadowStyle.release(), color.release());
1225 } 1225 }
1226 1226
1227 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowLis t(const ShadowList* shadowList, const ComputedStyle& style, bool useSpread) 1227 PassRefPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowList(const Shad owList* shadowList, const ComputedStyle& style, bool useSpread)
1228 { 1228 {
1229 if (!shadowList) 1229 if (!shadowList)
1230 return cssValuePool().createIdentifierValue(CSSValueNone); 1230 return cssValuePool().createIdentifierValue(CSSValueNone);
1231 1231
1232 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ; 1232 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1233 size_t shadowCount = shadowList->shadows().size(); 1233 size_t shadowCount = shadowList->shadows().size();
1234 for (size_t i = 0; i < shadowCount; ++i) 1234 for (size_t i = 0; i < shadowCount; ++i)
1235 list->append(valueForShadowData(shadowList->shadows()[i], style, useSpre ad)); 1235 list->append(valueForShadowData(shadowList->shadows()[i], style, useSpre ad));
1236 return list.release(); 1236 return list.release();
1237 } 1237 }
1238 1238
1239 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForFilter(co nst ComputedStyle& style) 1239 PassRefPtr<CSSValue> ComputedStyleCSSValueMapping::valueForFilter(const Computed Style& style)
1240 { 1240 {
1241 if (style.filter().operations().isEmpty()) 1241 if (style.filter().operations().isEmpty())
1242 return cssValuePool().createIdentifierValue(CSSValueNone); 1242 return cssValuePool().createIdentifierValue(CSSValueNone);
1243 1243
1244 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 1244 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1245 1245
1246 RefPtrWillBeRawPtr<CSSFunctionValue> filterValue = nullptr; 1246 RefPtr<CSSFunctionValue> filterValue = nullptr;
1247 1247
1248 for (const auto& operation : style.filter().operations()) { 1248 for (const auto& operation : style.filter().operations()) {
1249 FilterOperation* filterOperation = operation.get(); 1249 FilterOperation* filterOperation = operation.get();
1250 switch (filterOperation->type()) { 1250 switch (filterOperation->type()) {
1251 case FilterOperation::REFERENCE: 1251 case FilterOperation::REFERENCE:
1252 filterValue = CSSFunctionValue::create(CSSValueUrl); 1252 filterValue = CSSFunctionValue::create(CSSValueUrl);
1253 filterValue->append(cssValuePool().createValue(toReferenceFilterOper ation(filterOperation)->url(), CSSPrimitiveValue::UnitType::CustomIdentifier)); 1253 filterValue->append(cssValuePool().createValue(toReferenceFilterOper ation(filterOperation)->url(), CSSPrimitiveValue::UnitType::CustomIdentifier));
1254 break; 1254 break;
1255 case FilterOperation::GRAYSCALE: 1255 case FilterOperation::GRAYSCALE:
1256 filterValue = CSSFunctionValue::create(CSSValueGrayscale); 1256 filterValue = CSSFunctionValue::create(CSSValueGrayscale);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 default: 1299 default:
1300 ASSERT_NOT_REACHED(); 1300 ASSERT_NOT_REACHED();
1301 break; 1301 break;
1302 } 1302 }
1303 list->append(filterValue.release()); 1303 list->append(filterValue.release());
1304 } 1304 }
1305 1305
1306 return list.release(); 1306 return list.release();
1307 } 1307 }
1308 1308
1309 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForFont(cons t ComputedStyle& style) 1309 PassRefPtr<CSSValue> ComputedStyleCSSValueMapping::valueForFont(const ComputedSt yle& style)
1310 { 1310 {
1311 // Add a slash between size and line-height. 1311 // Add a slash between size and line-height.
1312 RefPtrWillBeRawPtr<CSSValueList> sizeAndLineHeight = CSSValueList::createSla shSeparated(); 1312 RefPtr<CSSValueList> sizeAndLineHeight = CSSValueList::createSlashSeparated( );
1313 sizeAndLineHeight->append(valueForFontSize(style)); 1313 sizeAndLineHeight->append(valueForFontSize(style));
1314 sizeAndLineHeight->append(valueForLineHeight(style)); 1314 sizeAndLineHeight->append(valueForLineHeight(style));
1315 1315
1316 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 1316 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1317 list->append(valueForFontStyle(style)); 1317 list->append(valueForFontStyle(style));
1318 list->append(valueForFontVariant(style)); 1318 list->append(valueForFontVariant(style));
1319 list->append(valueForFontWeight(style)); 1319 list->append(valueForFontWeight(style));
1320 list->append(valueForFontStretch(style)); 1320 list->append(valueForFontStretch(style));
1321 list->append(sizeAndLineHeight.release()); 1321 list->append(sizeAndLineHeight.release());
1322 list->append(valueForFontFamily(style)); 1322 list->append(valueForFontFamily(style));
1323 1323
1324 return list.release(); 1324 return list.release();
1325 } 1325 }
1326 1326
1327 static PassRefPtrWillBeRawPtr<CSSValue> valueForScrollSnapDestination(const Leng thPoint& destination, const ComputedStyle& style) 1327 static PassRefPtr<CSSValue> valueForScrollSnapDestination(const LengthPoint& des tination, const ComputedStyle& style)
1328 { 1328 {
1329 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 1329 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1330 list->append(zoomAdjustedPixelValueForLength(destination.x(), style)); 1330 list->append(zoomAdjustedPixelValueForLength(destination.x(), style));
1331 list->append(zoomAdjustedPixelValueForLength(destination.y(), style)); 1331 list->append(zoomAdjustedPixelValueForLength(destination.y(), style));
1332 return list.release(); 1332 return list.release();
1333 } 1333 }
1334 1334
1335 static PassRefPtrWillBeRawPtr<CSSValue> valueForScrollSnapPoints(const ScrollSna pPoints& points, const ComputedStyle& style) 1335 static PassRefPtr<CSSValue> valueForScrollSnapPoints(const ScrollSnapPoints& poi nts, const ComputedStyle& style)
1336 { 1336 {
1337 if (points.hasRepeat) { 1337 if (points.hasRepeat) {
1338 RefPtrWillBeRawPtr<CSSFunctionValue> repeat = CSSFunctionValue::create(C SSValueRepeat); 1338 RefPtr<CSSFunctionValue> repeat = CSSFunctionValue::create(CSSValueRepea t);
1339 repeat->append(zoomAdjustedPixelValueForLength(points.repeatOffset, styl e)); 1339 repeat->append(zoomAdjustedPixelValueForLength(points.repeatOffset, styl e));
1340 return repeat.release(); 1340 return repeat.release();
1341 } 1341 }
1342 1342
1343 return cssValuePool().createIdentifierValue(CSSValueNone); 1343 return cssValuePool().createIdentifierValue(CSSValueNone);
1344 } 1344 }
1345 1345
1346 static PassRefPtrWillBeRawPtr<CSSValue> valueForScrollSnapCoordinate(const Vecto r<LengthPoint>& coordinates, const ComputedStyle& style) 1346 static PassRefPtr<CSSValue> valueForScrollSnapCoordinate(const Vector<LengthPoin t>& coordinates, const ComputedStyle& style)
1347 { 1347 {
1348 if (coordinates.isEmpty()) 1348 if (coordinates.isEmpty())
1349 return cssValuePool().createIdentifierValue(CSSValueNone); 1349 return cssValuePool().createIdentifierValue(CSSValueNone);
1350 1350
1351 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ; 1351 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1352 1352
1353 for (auto& coordinate : coordinates) { 1353 for (auto& coordinate : coordinates) {
1354 auto pair = CSSValueList::createSpaceSeparated(); 1354 auto pair = CSSValueList::createSpaceSeparated();
1355 pair->append(zoomAdjustedPixelValueForLength(coordinate.x(), style)); 1355 pair->append(zoomAdjustedPixelValueForLength(coordinate.x(), style));
1356 pair->append(zoomAdjustedPixelValueForLength(coordinate.y(), style)); 1356 pair->append(zoomAdjustedPixelValueForLength(coordinate.y(), style));
1357 list->append(pair); 1357 list->append(pair);
1358 } 1358 }
1359 1359
1360 return list.release(); 1360 return list.release();
1361 } 1361 }
1362 1362
1363 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::get(CSSPropertyID propertyID, const ComputedStyle& style, const LayoutObject* layoutObject, Node* styledNode, bool allowVisitedStyle) 1363 PassRefPtr<CSSValue> ComputedStyleCSSValueMapping::get(CSSPropertyID propertyID, const ComputedStyle& style, const LayoutObject* layoutObject, Node* styledNode, bool allowVisitedStyle)
1364 { 1364 {
1365 const SVGComputedStyle& svgStyle = style.svgStyle(); 1365 const SVGComputedStyle& svgStyle = style.svgStyle();
1366 propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style.di rection(), style.writingMode()); 1366 propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style.di rection(), style.writingMode());
1367 switch (propertyID) { 1367 switch (propertyID) {
1368 case CSSPropertyInvalid: 1368 case CSSPropertyInvalid:
1369 return nullptr; 1369 return nullptr;
1370 1370
1371 case CSSPropertyBackgroundColor: 1371 case CSSPropertyBackgroundColor:
1372 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited DependentColor(CSSPropertyBackgroundColor).rgb()) : currentColorOrValidColor(sty le, style.backgroundColor()); 1372 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited DependentColor(CSSPropertyBackgroundColor).rgb()) : currentColorOrValidColor(sty le, style.backgroundColor());
1373 case CSSPropertyBackgroundImage: 1373 case CSSPropertyBackgroundImage:
1374 case CSSPropertyWebkitMaskImage: { 1374 case CSSPropertyWebkitMaskImage: {
1375 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed(); 1375 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1376 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskImage ? &style.maskLayers() : &style.backgroundLayers(); 1376 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskImage ? &style.maskLayers() : &style.backgroundLayers();
1377 for (; currLayer; currLayer = currLayer->next()) { 1377 for (; currLayer; currLayer = currLayer->next()) {
1378 if (currLayer->image()) 1378 if (currLayer->image())
1379 list->append(currLayer->image()->cssValue()); 1379 list->append(currLayer->image()->cssValue());
1380 else 1380 else
1381 list->append(cssValuePool().createIdentifierValue(CSSValueNone)) ; 1381 list->append(cssValuePool().createIdentifierValue(CSSValueNone)) ;
1382 } 1382 }
1383 return list.release(); 1383 return list.release();
1384 } 1384 }
1385 case CSSPropertyBackgroundSize: 1385 case CSSPropertyBackgroundSize:
1386 case CSSPropertyWebkitMaskSize: { 1386 case CSSPropertyWebkitMaskSize: {
1387 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed(); 1387 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1388 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskSize ? & style.maskLayers() : &style.backgroundLayers(); 1388 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskSize ? & style.maskLayers() : &style.backgroundLayers();
1389 for (; currLayer; currLayer = currLayer->next()) 1389 for (; currLayer; currLayer = currLayer->next())
1390 list->append(valueForFillSize(currLayer->size(), style)); 1390 list->append(valueForFillSize(currLayer->size(), style));
1391 return list.release(); 1391 return list.release();
1392 } 1392 }
1393 case CSSPropertyBackgroundRepeat: 1393 case CSSPropertyBackgroundRepeat:
1394 case CSSPropertyWebkitMaskRepeat: { 1394 case CSSPropertyWebkitMaskRepeat: {
1395 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed(); 1395 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1396 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskRepeat ? &style.maskLayers() : &style.backgroundLayers(); 1396 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskRepeat ? &style.maskLayers() : &style.backgroundLayers();
1397 for (; currLayer; currLayer = currLayer->next()) 1397 for (; currLayer; currLayer = currLayer->next())
1398 list->append(valueForFillRepeat(currLayer->repeatX(), currLayer->rep eatY())); 1398 list->append(valueForFillRepeat(currLayer->repeatX(), currLayer->rep eatY()));
1399 return list.release(); 1399 return list.release();
1400 } 1400 }
1401 case CSSPropertyMaskSourceType: { 1401 case CSSPropertyMaskSourceType: {
1402 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed(); 1402 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1403 for (const FillLayer* currLayer = &style.maskLayers(); currLayer; currLa yer = currLayer->next()) 1403 for (const FillLayer* currLayer = &style.maskLayers(); currLayer; currLa yer = currLayer->next())
1404 list->append(valueForFillSourceType(currLayer->maskSourceType())); 1404 list->append(valueForFillSourceType(currLayer->maskSourceType()));
1405 return list.release(); 1405 return list.release();
1406 } 1406 }
1407 case CSSPropertyWebkitBackgroundComposite: 1407 case CSSPropertyWebkitBackgroundComposite:
1408 case CSSPropertyWebkitMaskComposite: { 1408 case CSSPropertyWebkitMaskComposite: {
1409 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed(); 1409 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1410 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskComposit e ? &style.maskLayers() : &style.backgroundLayers(); 1410 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskComposit e ? &style.maskLayers() : &style.backgroundLayers();
1411 for (; currLayer; currLayer = currLayer->next()) 1411 for (; currLayer; currLayer = currLayer->next())
1412 list->append(cssValuePool().createValue(currLayer->composite())); 1412 list->append(cssValuePool().createValue(currLayer->composite()));
1413 return list.release(); 1413 return list.release();
1414 } 1414 }
1415 case CSSPropertyBackgroundAttachment: { 1415 case CSSPropertyBackgroundAttachment: {
1416 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed(); 1416 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1417 for (const FillLayer* currLayer = &style.backgroundLayers(); currLayer; currLayer = currLayer->next()) 1417 for (const FillLayer* currLayer = &style.backgroundLayers(); currLayer; currLayer = currLayer->next())
1418 list->append(cssValuePool().createValue(currLayer->attachment())); 1418 list->append(cssValuePool().createValue(currLayer->attachment()));
1419 return list.release(); 1419 return list.release();
1420 } 1420 }
1421 case CSSPropertyBackgroundClip: 1421 case CSSPropertyBackgroundClip:
1422 case CSSPropertyBackgroundOrigin: 1422 case CSSPropertyBackgroundOrigin:
1423 case CSSPropertyWebkitBackgroundClip: 1423 case CSSPropertyWebkitBackgroundClip:
1424 case CSSPropertyWebkitBackgroundOrigin: 1424 case CSSPropertyWebkitBackgroundOrigin:
1425 case CSSPropertyWebkitMaskClip: 1425 case CSSPropertyWebkitMaskClip:
1426 case CSSPropertyWebkitMaskOrigin: { 1426 case CSSPropertyWebkitMaskOrigin: {
1427 bool isClip = propertyID == CSSPropertyBackgroundClip || propertyID == C SSPropertyWebkitBackgroundClip || propertyID == CSSPropertyWebkitMaskClip; 1427 bool isClip = propertyID == CSSPropertyBackgroundClip || propertyID == C SSPropertyWebkitBackgroundClip || propertyID == CSSPropertyWebkitMaskClip;
1428 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed(); 1428 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1429 const FillLayer* currLayer = (propertyID == CSSPropertyWebkitMaskClip || propertyID == CSSPropertyWebkitMaskOrigin) ? &style.maskLayers() : &style.backg roundLayers(); 1429 const FillLayer* currLayer = (propertyID == CSSPropertyWebkitMaskClip || propertyID == CSSPropertyWebkitMaskOrigin) ? &style.maskLayers() : &style.backg roundLayers();
1430 for (; currLayer; currLayer = currLayer->next()) { 1430 for (; currLayer; currLayer = currLayer->next()) {
1431 EFillBox box = isClip ? currLayer->clip() : currLayer->origin(); 1431 EFillBox box = isClip ? currLayer->clip() : currLayer->origin();
1432 list->append(cssValuePool().createValue(box)); 1432 list->append(cssValuePool().createValue(box));
1433 } 1433 }
1434 return list.release(); 1434 return list.release();
1435 } 1435 }
1436 case CSSPropertyBackgroundPosition: 1436 case CSSPropertyBackgroundPosition:
1437 case CSSPropertyWebkitMaskPosition: { 1437 case CSSPropertyWebkitMaskPosition: {
1438 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed(); 1438 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1439 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition ? &style.maskLayers() : &style.backgroundLayers(); 1439 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition ? &style.maskLayers() : &style.backgroundLayers();
1440 for (; currLayer; currLayer = currLayer->next()) 1440 for (; currLayer; currLayer = currLayer->next())
1441 list->append(createPositionListForLayer(propertyID, *currLayer, styl e)); 1441 list->append(createPositionListForLayer(propertyID, *currLayer, styl e));
1442 return list.release(); 1442 return list.release();
1443 } 1443 }
1444 case CSSPropertyBackgroundPositionX: 1444 case CSSPropertyBackgroundPositionX:
1445 case CSSPropertyWebkitMaskPositionX: { 1445 case CSSPropertyWebkitMaskPositionX: {
1446 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed(); 1446 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1447 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition X ? &style.maskLayers() : &style.backgroundLayers(); 1447 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition X ? &style.maskLayers() : &style.backgroundLayers();
1448 for (; currLayer; currLayer = currLayer->next()) 1448 for (; currLayer; currLayer = currLayer->next())
1449 list->append(zoomAdjustedPixelValueForLength(currLayer->xPosition(), style)); 1449 list->append(zoomAdjustedPixelValueForLength(currLayer->xPosition(), style));
1450 return list.release(); 1450 return list.release();
1451 } 1451 }
1452 case CSSPropertyBackgroundPositionY: 1452 case CSSPropertyBackgroundPositionY:
1453 case CSSPropertyWebkitMaskPositionY: { 1453 case CSSPropertyWebkitMaskPositionY: {
1454 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed(); 1454 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1455 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition Y ? &style.maskLayers() : &style.backgroundLayers(); 1455 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition Y ? &style.maskLayers() : &style.backgroundLayers();
1456 for (; currLayer; currLayer = currLayer->next()) 1456 for (; currLayer; currLayer = currLayer->next())
1457 list->append(zoomAdjustedPixelValueForLength(currLayer->yPosition(), style)); 1457 list->append(zoomAdjustedPixelValueForLength(currLayer->yPosition(), style));
1458 return list.release(); 1458 return list.release();
1459 } 1459 }
1460 case CSSPropertyBorderCollapse: 1460 case CSSPropertyBorderCollapse:
1461 if (style.borderCollapse()) 1461 if (style.borderCollapse())
1462 return cssValuePool().createIdentifierValue(CSSValueCollapse); 1462 return cssValuePool().createIdentifierValue(CSSValueCollapse);
1463 return cssValuePool().createIdentifierValue(CSSValueSeparate); 1463 return cssValuePool().createIdentifierValue(CSSValueSeparate);
1464 case CSSPropertyBorderSpacing: { 1464 case CSSPropertyBorderSpacing: {
1465 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed(); 1465 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1466 list->append(zoomAdjustedPixelValue(style.horizontalBorderSpacing(), sty le)); 1466 list->append(zoomAdjustedPixelValue(style.horizontalBorderSpacing(), sty le));
1467 list->append(zoomAdjustedPixelValue(style.verticalBorderSpacing(), style )); 1467 list->append(zoomAdjustedPixelValue(style.verticalBorderSpacing(), style ));
1468 return list.release(); 1468 return list.release();
1469 } 1469 }
1470 case CSSPropertyWebkitBorderHorizontalSpacing: 1470 case CSSPropertyWebkitBorderHorizontalSpacing:
1471 return zoomAdjustedPixelValue(style.horizontalBorderSpacing(), style); 1471 return zoomAdjustedPixelValue(style.horizontalBorderSpacing(), style);
1472 case CSSPropertyWebkitBorderVerticalSpacing: 1472 case CSSPropertyWebkitBorderVerticalSpacing:
1473 return zoomAdjustedPixelValue(style.verticalBorderSpacing(), style); 1473 return zoomAdjustedPixelValue(style.verticalBorderSpacing(), style);
1474 case CSSPropertyBorderImageSource: 1474 case CSSPropertyBorderImageSource:
1475 if (style.borderImageSource()) 1475 if (style.borderImageSource())
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 case CSSPropertyWebkitColumnBreakInside: 1559 case CSSPropertyWebkitColumnBreakInside:
1560 return cssValuePool().createValue(style.columnBreakInside()); 1560 return cssValuePool().createValue(style.columnBreakInside());
1561 case CSSPropertyWebkitColumnWidth: 1561 case CSSPropertyWebkitColumnWidth:
1562 if (style.hasAutoColumnWidth()) 1562 if (style.hasAutoColumnWidth())
1563 return cssValuePool().createIdentifierValue(CSSValueAuto); 1563 return cssValuePool().createIdentifierValue(CSSValueAuto);
1564 return zoomAdjustedPixelValue(style.columnWidth(), style); 1564 return zoomAdjustedPixelValue(style.columnWidth(), style);
1565 case CSSPropertyTabSize: 1565 case CSSPropertyTabSize:
1566 return cssValuePool().createValue( 1566 return cssValuePool().createValue(
1567 style.tabSize().getPixelSize(1.0), style.tabSize().isSpaces() ? CSSP rimitiveValue::UnitType::Number : CSSPrimitiveValue::UnitType::Pixels); 1567 style.tabSize().getPixelSize(1.0), style.tabSize().isSpaces() ? CSSP rimitiveValue::UnitType::Number : CSSPrimitiveValue::UnitType::Pixels);
1568 case CSSPropertyCursor: { 1568 case CSSPropertyCursor: {
1569 RefPtrWillBeRawPtr<CSSValueList> list = nullptr; 1569 RefPtr<CSSValueList> list = nullptr;
1570 CursorList* cursors = style.cursors(); 1570 CursorList* cursors = style.cursors();
1571 if (cursors && cursors->size() > 0) { 1571 if (cursors && cursors->size() > 0) {
1572 list = CSSValueList::createCommaSeparated(); 1572 list = CSSValueList::createCommaSeparated();
1573 for (unsigned i = 0; i < cursors->size(); ++i) { 1573 for (unsigned i = 0; i < cursors->size(); ++i) {
1574 if (StyleImage* image = cursors->at(i).image()) 1574 if (StyleImage* image = cursors->at(i).image())
1575 list->append(image->cssValue()); 1575 list->append(image->cssValue());
1576 } 1576 }
1577 } 1577 }
1578 RefPtrWillBeRawPtr<CSSValue> value = cssValuePool().createValue(style.cu rsor()); 1578 RefPtr<CSSValue> value = cssValuePool().createValue(style.cursor());
1579 if (list) { 1579 if (list) {
1580 list->append(value.release()); 1580 list->append(value.release());
1581 return list.release(); 1581 return list.release();
1582 } 1582 }
1583 return value.release(); 1583 return value.release();
1584 } 1584 }
1585 case CSSPropertyDirection: 1585 case CSSPropertyDirection:
1586 return cssValuePool().createValue(style.direction()); 1586 return cssValuePool().createValue(style.direction());
1587 case CSSPropertyDisplay: 1587 case CSSPropertyDisplay:
1588 return cssValuePool().createValue(style.display()); 1588 return cssValuePool().createValue(style.display());
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 case CSSPropertyFontStyle: 1631 case CSSPropertyFontStyle:
1632 return valueForFontStyle(style); 1632 return valueForFontStyle(style);
1633 case CSSPropertyFontVariant: 1633 case CSSPropertyFontVariant:
1634 return valueForFontVariant(style); 1634 return valueForFontVariant(style);
1635 case CSSPropertyFontWeight: 1635 case CSSPropertyFontWeight:
1636 return valueForFontWeight(style); 1636 return valueForFontWeight(style);
1637 case CSSPropertyWebkitFontFeatureSettings: { 1637 case CSSPropertyWebkitFontFeatureSettings: {
1638 const FontFeatureSettings* featureSettings = style.fontDescription().fea tureSettings(); 1638 const FontFeatureSettings* featureSettings = style.fontDescription().fea tureSettings();
1639 if (!featureSettings || !featureSettings->size()) 1639 if (!featureSettings || !featureSettings->size())
1640 return cssValuePool().createIdentifierValue(CSSValueNormal); 1640 return cssValuePool().createIdentifierValue(CSSValueNormal);
1641 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed(); 1641 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
1642 for (unsigned i = 0; i < featureSettings->size(); ++i) { 1642 for (unsigned i = 0; i < featureSettings->size(); ++i) {
1643 const FontFeature& feature = featureSettings->at(i); 1643 const FontFeature& feature = featureSettings->at(i);
1644 RefPtrWillBeRawPtr<CSSFontFeatureValue> featureValue = CSSFontFeatur eValue::create(feature.tag(), feature.value()); 1644 RefPtr<CSSFontFeatureValue> featureValue = CSSFontFeatureValue::crea te(feature.tag(), feature.value());
1645 list->append(featureValue.release()); 1645 list->append(featureValue.release());
1646 } 1646 }
1647 return list.release(); 1647 return list.release();
1648 } 1648 }
1649 case CSSPropertyGridAutoFlow: { 1649 case CSSPropertyGridAutoFlow: {
1650 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed(); 1650 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1651 switch (style.gridAutoFlow()) { 1651 switch (style.gridAutoFlow()) {
1652 case AutoFlowRow: 1652 case AutoFlowRow:
1653 case AutoFlowRowDense: 1653 case AutoFlowRowDense:
1654 list->append(cssValuePool().createIdentifierValue(CSSValueRow)); 1654 list->append(cssValuePool().createIdentifierValue(CSSValueRow));
1655 break; 1655 break;
1656 case AutoFlowColumn: 1656 case AutoFlowColumn:
1657 case AutoFlowColumnDense: 1657 case AutoFlowColumnDense:
1658 list->append(cssValuePool().createIdentifierValue(CSSValueColumn)); 1658 list->append(cssValuePool().createIdentifierValue(CSSValueColumn));
1659 break; 1659 break;
1660 default: 1660 default:
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1896 return cssValuePool().createValue(style.pageBreakInside()); 1896 return cssValuePool().createValue(style.pageBreakInside());
1897 } 1897 }
1898 case CSSPropertyPosition: 1898 case CSSPropertyPosition:
1899 return cssValuePool().createValue(style.position()); 1899 return cssValuePool().createValue(style.position());
1900 case CSSPropertyQuotes: 1900 case CSSPropertyQuotes:
1901 if (!style.quotes()) { 1901 if (!style.quotes()) {
1902 // TODO(ramya.v): We should return the quote values that we're actua lly using. 1902 // TODO(ramya.v): We should return the quote values that we're actua lly using.
1903 return nullptr; 1903 return nullptr;
1904 } 1904 }
1905 if (style.quotes()->size()) { 1905 if (style.quotes()->size()) {
1906 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSep arated(); 1906 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1907 for (int i = 0; i < style.quotes()->size(); i++) { 1907 for (int i = 0; i < style.quotes()->size(); i++) {
1908 list->append(cssValuePool().createValue(style.quotes()->getOpenQ uote(i), CSSPrimitiveValue::UnitType::String)); 1908 list->append(cssValuePool().createValue(style.quotes()->getOpenQ uote(i), CSSPrimitiveValue::UnitType::String));
1909 list->append(cssValuePool().createValue(style.quotes()->getClose Quote(i), CSSPrimitiveValue::UnitType::String)); 1909 list->append(cssValuePool().createValue(style.quotes()->getClose Quote(i), CSSPrimitiveValue::UnitType::String));
1910 } 1910 }
1911 return list.release(); 1911 return list.release();
1912 } 1912 }
1913 return cssValuePool().createIdentifierValue(CSSValueNone); 1913 return cssValuePool().createIdentifierValue(CSSValueNone);
1914 case CSSPropertyRight: 1914 case CSSPropertyRight:
1915 return valueForPositionOffset(style, CSSPropertyRight, layoutObject); 1915 return valueForPositionOffset(style, CSSPropertyRight, layoutObject);
1916 case CSSPropertyWebkitRubyPosition: 1916 case CSSPropertyWebkitRubyPosition:
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1952 case TextEmphasisMarkCustom: 1952 case TextEmphasisMarkCustom:
1953 return cssValuePool().createValue(style.textEmphasisCustomMark(), CS SPrimitiveValue::UnitType::String); 1953 return cssValuePool().createValue(style.textEmphasisCustomMark(), CS SPrimitiveValue::UnitType::String);
1954 case TextEmphasisMarkAuto: 1954 case TextEmphasisMarkAuto:
1955 ASSERT_NOT_REACHED(); 1955 ASSERT_NOT_REACHED();
1956 // Fall through 1956 // Fall through
1957 case TextEmphasisMarkDot: 1957 case TextEmphasisMarkDot:
1958 case TextEmphasisMarkCircle: 1958 case TextEmphasisMarkCircle:
1959 case TextEmphasisMarkDoubleCircle: 1959 case TextEmphasisMarkDoubleCircle:
1960 case TextEmphasisMarkTriangle: 1960 case TextEmphasisMarkTriangle:
1961 case TextEmphasisMarkSesame: { 1961 case TextEmphasisMarkSesame: {
1962 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSep arated(); 1962 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1963 list->append(cssValuePool().createValue(style.textEmphasisFill())); 1963 list->append(cssValuePool().createValue(style.textEmphasisFill()));
1964 list->append(cssValuePool().createValue(style.textEmphasisMark())); 1964 list->append(cssValuePool().createValue(style.textEmphasisMark()));
1965 return list.release(); 1965 return list.release();
1966 } 1966 }
1967 } 1967 }
1968 case CSSPropertyTextIndent: { 1968 case CSSPropertyTextIndent: {
1969 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed(); 1969 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1970 list->append(zoomAdjustedPixelValueForLength(style.textIndent(), style)) ; 1970 list->append(zoomAdjustedPixelValueForLength(style.textIndent(), style)) ;
1971 if (RuntimeEnabledFeatures::css3TextEnabled() && (style.textIndentLine() == TextIndentEachLine || style.textIndentType() == TextIndentHanging)) { 1971 if (RuntimeEnabledFeatures::css3TextEnabled() && (style.textIndentLine() == TextIndentEachLine || style.textIndentType() == TextIndentHanging)) {
1972 if (style.textIndentLine() == TextIndentEachLine) 1972 if (style.textIndentLine() == TextIndentEachLine)
1973 list->append(cssValuePool().createIdentifierValue(CSSValueEachLi ne)); 1973 list->append(cssValuePool().createIdentifierValue(CSSValueEachLi ne));
1974 if (style.textIndentType() == TextIndentHanging) 1974 if (style.textIndentType() == TextIndentHanging)
1975 list->append(cssValuePool().createIdentifierValue(CSSValueHangin g)); 1975 list->append(cssValuePool().createIdentifierValue(CSSValueHangin g));
1976 } 1976 }
1977 return list.release(); 1977 return list.release();
1978 } 1978 }
1979 case CSSPropertyTextShadow: 1979 case CSSPropertyTextShadow:
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2056 return cssValuePool().createValue(style.fontDescription().fontSmoothing( )); 2056 return cssValuePool().createValue(style.fontDescription().fontSmoothing( ));
2057 case CSSPropertyFontVariantLigatures: { 2057 case CSSPropertyFontVariantLigatures: {
2058 FontDescription::LigaturesState commonLigaturesState = style.fontDescrip tion().commonLigaturesState(); 2058 FontDescription::LigaturesState commonLigaturesState = style.fontDescrip tion().commonLigaturesState();
2059 FontDescription::LigaturesState discretionaryLigaturesState = style.font Description().discretionaryLigaturesState(); 2059 FontDescription::LigaturesState discretionaryLigaturesState = style.font Description().discretionaryLigaturesState();
2060 FontDescription::LigaturesState historicalLigaturesState = style.fontDes cription().historicalLigaturesState(); 2060 FontDescription::LigaturesState historicalLigaturesState = style.fontDes cription().historicalLigaturesState();
2061 FontDescription::LigaturesState contextualLigaturesState = style.fontDes cription().contextualLigaturesState(); 2061 FontDescription::LigaturesState contextualLigaturesState = style.fontDes cription().contextualLigaturesState();
2062 if (commonLigaturesState == FontDescription::NormalLigaturesState && dis cretionaryLigaturesState == FontDescription::NormalLigaturesState 2062 if (commonLigaturesState == FontDescription::NormalLigaturesState && dis cretionaryLigaturesState == FontDescription::NormalLigaturesState
2063 && historicalLigaturesState == FontDescription::NormalLigaturesState && contextualLigaturesState == FontDescription::NormalLigaturesState) 2063 && historicalLigaturesState == FontDescription::NormalLigaturesState && contextualLigaturesState == FontDescription::NormalLigaturesState)
2064 return cssValuePool().createIdentifierValue(CSSValueNormal); 2064 return cssValuePool().createIdentifierValue(CSSValueNormal);
2065 2065
2066 RefPtrWillBeRawPtr<CSSValueList> valueList = CSSValueList::createSpaceSe parated(); 2066 RefPtr<CSSValueList> valueList = CSSValueList::createSpaceSeparated();
2067 if (commonLigaturesState != FontDescription::NormalLigaturesState) 2067 if (commonLigaturesState != FontDescription::NormalLigaturesState)
2068 valueList->append(cssValuePool().createIdentifierValue(commonLigatur esState == FontDescription::DisabledLigaturesState ? CSSValueNoCommonLigatures : CSSValueCommonLigatures)); 2068 valueList->append(cssValuePool().createIdentifierValue(commonLigatur esState == FontDescription::DisabledLigaturesState ? CSSValueNoCommonLigatures : CSSValueCommonLigatures));
2069 if (discretionaryLigaturesState != FontDescription::NormalLigaturesState ) 2069 if (discretionaryLigaturesState != FontDescription::NormalLigaturesState )
2070 valueList->append(cssValuePool().createIdentifierValue(discretionary LigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoDiscretion aryLigatures : CSSValueDiscretionaryLigatures)); 2070 valueList->append(cssValuePool().createIdentifierValue(discretionary LigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoDiscretion aryLigatures : CSSValueDiscretionaryLigatures));
2071 if (historicalLigaturesState != FontDescription::NormalLigaturesState) 2071 if (historicalLigaturesState != FontDescription::NormalLigaturesState)
2072 valueList->append(cssValuePool().createIdentifierValue(historicalLig aturesState == FontDescription::DisabledLigaturesState ? CSSValueNoHistoricalLig atures : CSSValueHistoricalLigatures)); 2072 valueList->append(cssValuePool().createIdentifierValue(historicalLig aturesState == FontDescription::DisabledLigaturesState ? CSSValueNoHistoricalLig atures : CSSValueHistoricalLigatures));
2073 if (contextualLigaturesState != FontDescription::NormalLigaturesState) 2073 if (contextualLigaturesState != FontDescription::NormalLigaturesState)
2074 valueList->append(cssValuePool().createIdentifierValue(contextualLig aturesState == FontDescription::DisabledLigaturesState ? CSSValueNoContextual : CSSValueContextual)); 2074 valueList->append(cssValuePool().createIdentifierValue(contextualLig aturesState == FontDescription::DisabledLigaturesState ? CSSValueNoContextual : CSSValueContextual));
2075 return valueList; 2075 return valueList;
2076 } 2076 }
2077 case CSSPropertyZIndex: 2077 case CSSPropertyZIndex:
2078 if (style.hasAutoZIndex()) 2078 if (style.hasAutoZIndex())
2079 return cssValuePool().createIdentifierValue(CSSValueAuto); 2079 return cssValuePool().createIdentifierValue(CSSValueAuto);
2080 return cssValuePool().createValue(style.zIndex(), CSSPrimitiveValue::Uni tType::Integer); 2080 return cssValuePool().createValue(style.zIndex(), CSSPrimitiveValue::Uni tType::Integer);
2081 case CSSPropertyZoom: 2081 case CSSPropertyZoom:
2082 return cssValuePool().createValue(style.zoom(), CSSPrimitiveValue::UnitT ype::Number); 2082 return cssValuePool().createValue(style.zoom(), CSSPrimitiveValue::UnitT ype::Number);
2083 case CSSPropertyBoxSizing: 2083 case CSSPropertyBoxSizing:
2084 if (style.boxSizing() == CONTENT_BOX) 2084 if (style.boxSizing() == CONTENT_BOX)
2085 return cssValuePool().createIdentifierValue(CSSValueContentBox); 2085 return cssValuePool().createIdentifierValue(CSSValueContentBox);
2086 return cssValuePool().createIdentifierValue(CSSValueBorderBox); 2086 return cssValuePool().createIdentifierValue(CSSValueBorderBox);
2087 case CSSPropertyWebkitAppRegion: 2087 case CSSPropertyWebkitAppRegion:
2088 return cssValuePool().createIdentifierValue(style.getDraggableRegionMode () == DraggableRegionDrag ? CSSValueDrag : CSSValueNoDrag); 2088 return cssValuePool().createIdentifierValue(style.getDraggableRegionMode () == DraggableRegionDrag ? CSSValueDrag : CSSValueNoDrag);
2089 case CSSPropertyAnimationDelay: 2089 case CSSPropertyAnimationDelay:
2090 return valueForAnimationDelay(style.animations()); 2090 return valueForAnimationDelay(style.animations());
2091 case CSSPropertyAnimationDirection: { 2091 case CSSPropertyAnimationDirection: {
2092 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed(); 2092 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2093 const CSSAnimationData* animationData = style.animations(); 2093 const CSSAnimationData* animationData = style.animations();
2094 if (animationData) { 2094 if (animationData) {
2095 for (size_t i = 0; i < animationData->directionList().size(); ++i) 2095 for (size_t i = 0; i < animationData->directionList().size(); ++i)
2096 list->append(valueForAnimationDirection(animationData->direction List()[i])); 2096 list->append(valueForAnimationDirection(animationData->direction List()[i]));
2097 } else { 2097 } else {
2098 list->append(cssValuePool().createIdentifierValue(CSSValueNormal)); 2098 list->append(cssValuePool().createIdentifierValue(CSSValueNormal));
2099 } 2099 }
2100 return list.release(); 2100 return list.release();
2101 } 2101 }
2102 case CSSPropertyAnimationDuration: 2102 case CSSPropertyAnimationDuration:
2103 return valueForAnimationDuration(style.animations()); 2103 return valueForAnimationDuration(style.animations());
2104 case CSSPropertyAnimationFillMode: { 2104 case CSSPropertyAnimationFillMode: {
2105 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed(); 2105 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2106 const CSSAnimationData* animationData = style.animations(); 2106 const CSSAnimationData* animationData = style.animations();
2107 if (animationData) { 2107 if (animationData) {
2108 for (size_t i = 0; i < animationData->fillModeList().size(); ++i) 2108 for (size_t i = 0; i < animationData->fillModeList().size(); ++i)
2109 list->append(valueForAnimationFillMode(animationData->fillModeLi st()[i])); 2109 list->append(valueForAnimationFillMode(animationData->fillModeLi st()[i]));
2110 } else { 2110 } else {
2111 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); 2111 list->append(cssValuePool().createIdentifierValue(CSSValueNone));
2112 } 2112 }
2113 return list.release(); 2113 return list.release();
2114 } 2114 }
2115 case CSSPropertyAnimationIterationCount: { 2115 case CSSPropertyAnimationIterationCount: {
2116 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed(); 2116 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2117 const CSSAnimationData* animationData = style.animations(); 2117 const CSSAnimationData* animationData = style.animations();
2118 if (animationData) { 2118 if (animationData) {
2119 for (size_t i = 0; i < animationData->iterationCountList().size(); + +i) 2119 for (size_t i = 0; i < animationData->iterationCountList().size(); + +i)
2120 list->append(valueForAnimationIterationCount(animationData->iter ationCountList()[i])); 2120 list->append(valueForAnimationIterationCount(animationData->iter ationCountList()[i]));
2121 } else { 2121 } else {
2122 list->append(cssValuePool().createValue(CSSAnimationData::initialIte rationCount(), CSSPrimitiveValue::UnitType::Number)); 2122 list->append(cssValuePool().createValue(CSSAnimationData::initialIte rationCount(), CSSPrimitiveValue::UnitType::Number));
2123 } 2123 }
2124 return list.release(); 2124 return list.release();
2125 } 2125 }
2126 case CSSPropertyAnimationName: { 2126 case CSSPropertyAnimationName: {
2127 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed(); 2127 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2128 const CSSAnimationData* animationData = style.animations(); 2128 const CSSAnimationData* animationData = style.animations();
2129 if (animationData) { 2129 if (animationData) {
2130 for (size_t i = 0; i < animationData->nameList().size(); ++i) 2130 for (size_t i = 0; i < animationData->nameList().size(); ++i)
2131 list->append(cssValuePool().createValue(animationData->nameList( )[i], CSSPrimitiveValue::UnitType::CustomIdentifier)); 2131 list->append(cssValuePool().createValue(animationData->nameList( )[i], CSSPrimitiveValue::UnitType::CustomIdentifier));
2132 } else { 2132 } else {
2133 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); 2133 list->append(cssValuePool().createIdentifierValue(CSSValueNone));
2134 } 2134 }
2135 return list.release(); 2135 return list.release();
2136 } 2136 }
2137 case CSSPropertyAnimationPlayState: { 2137 case CSSPropertyAnimationPlayState: {
2138 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed(); 2138 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2139 const CSSAnimationData* animationData = style.animations(); 2139 const CSSAnimationData* animationData = style.animations();
2140 if (animationData) { 2140 if (animationData) {
2141 for (size_t i = 0; i < animationData->playStateList().size(); ++i) 2141 for (size_t i = 0; i < animationData->playStateList().size(); ++i)
2142 list->append(valueForAnimationPlayState(animationData->playState List()[i])); 2142 list->append(valueForAnimationPlayState(animationData->playState List()[i]));
2143 } else { 2143 } else {
2144 list->append(cssValuePool().createIdentifierValue(CSSValueRunning)); 2144 list->append(cssValuePool().createIdentifierValue(CSSValueRunning));
2145 } 2145 }
2146 return list.release(); 2146 return list.release();
2147 } 2147 }
2148 case CSSPropertyAnimationTimingFunction: 2148 case CSSPropertyAnimationTimingFunction:
2149 return valueForAnimationTimingFunction(style.animations()); 2149 return valueForAnimationTimingFunction(style.animations());
2150 case CSSPropertyAnimation: { 2150 case CSSPropertyAnimation: {
2151 const CSSAnimationData* animationData = style.animations(); 2151 const CSSAnimationData* animationData = style.animations();
2152 if (animationData) { 2152 if (animationData) {
2153 RefPtrWillBeRawPtr<CSSValueList> animationsList = CSSValueList::crea teCommaSeparated(); 2153 RefPtr<CSSValueList> animationsList = CSSValueList::createCommaSepar ated();
2154 for (size_t i = 0; i < animationData->nameList().size(); ++i) { 2154 for (size_t i = 0; i < animationData->nameList().size(); ++i) {
2155 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpac eSeparated(); 2155 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
2156 list->append(cssValuePool().createValue(animationData->nameList( )[i], CSSPrimitiveValue::UnitType::CustomIdentifier)); 2156 list->append(cssValuePool().createValue(animationData->nameList( )[i], CSSPrimitiveValue::UnitType::CustomIdentifier));
2157 list->append(cssValuePool().createValue(CSSTimingData::getRepeat ed(animationData->durationList(), i), CSSPrimitiveValue::UnitType::Seconds)); 2157 list->append(cssValuePool().createValue(CSSTimingData::getRepeat ed(animationData->durationList(), i), CSSPrimitiveValue::UnitType::Seconds));
2158 list->append(createTimingFunctionValue(CSSTimingData::getRepeate d(animationData->timingFunctionList(), i).get())); 2158 list->append(createTimingFunctionValue(CSSTimingData::getRepeate d(animationData->timingFunctionList(), i).get()));
2159 list->append(cssValuePool().createValue(CSSTimingData::getRepeat ed(animationData->delayList(), i), CSSPrimitiveValue::UnitType::Seconds)); 2159 list->append(cssValuePool().createValue(CSSTimingData::getRepeat ed(animationData->delayList(), i), CSSPrimitiveValue::UnitType::Seconds));
2160 list->append(valueForAnimationIterationCount(CSSTimingData::getR epeated(animationData->iterationCountList(), i))); 2160 list->append(valueForAnimationIterationCount(CSSTimingData::getR epeated(animationData->iterationCountList(), i)));
2161 list->append(valueForAnimationDirection(CSSTimingData::getRepeat ed(animationData->directionList(), i))); 2161 list->append(valueForAnimationDirection(CSSTimingData::getRepeat ed(animationData->directionList(), i)));
2162 list->append(valueForAnimationFillMode(CSSTimingData::getRepeate d(animationData->fillModeList(), i))); 2162 list->append(valueForAnimationFillMode(CSSTimingData::getRepeate d(animationData->fillModeList(), i)));
2163 list->append(valueForAnimationPlayState(CSSTimingData::getRepeat ed(animationData->playStateList(), i))); 2163 list->append(valueForAnimationPlayState(CSSTimingData::getRepeat ed(animationData->playStateList(), i)));
2164 animationsList->append(list); 2164 animationsList->append(list);
2165 } 2165 }
2166 return animationsList.release(); 2166 return animationsList.release();
2167 } 2167 }
2168 2168
2169 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed(); 2169 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
2170 // animation-name default value. 2170 // animation-name default value.
2171 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); 2171 list->append(cssValuePool().createIdentifierValue(CSSValueNone));
2172 list->append(cssValuePool().createValue(CSSAnimationData::initialDuratio n(), CSSPrimitiveValue::UnitType::Seconds)); 2172 list->append(cssValuePool().createValue(CSSAnimationData::initialDuratio n(), CSSPrimitiveValue::UnitType::Seconds));
2173 list->append(createTimingFunctionValue(CSSAnimationData::initialTimingFu nction().get())); 2173 list->append(createTimingFunctionValue(CSSAnimationData::initialTimingFu nction().get()));
2174 list->append(cssValuePool().createValue(CSSAnimationData::initialDelay() , CSSPrimitiveValue::UnitType::Seconds)); 2174 list->append(cssValuePool().createValue(CSSAnimationData::initialDelay() , CSSPrimitiveValue::UnitType::Seconds));
2175 list->append(cssValuePool().createValue(CSSAnimationData::initialIterati onCount(), CSSPrimitiveValue::UnitType::Number)); 2175 list->append(cssValuePool().createValue(CSSAnimationData::initialIterati onCount(), CSSPrimitiveValue::UnitType::Number));
2176 list->append(valueForAnimationDirection(CSSAnimationData::initialDirecti on())); 2176 list->append(valueForAnimationDirection(CSSAnimationData::initialDirecti on()));
2177 list->append(valueForAnimationFillMode(CSSAnimationData::initialFillMode ())); 2177 list->append(valueForAnimationFillMode(CSSAnimationData::initialFillMode ()));
2178 // Initial animation-play-state. 2178 // Initial animation-play-state.
2179 list->append(cssValuePool().createIdentifierValue(CSSValueRunning)); 2179 list->append(cssValuePool().createIdentifierValue(CSSValueRunning));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2214 case CSSPropertyWebkitMarginAfterCollapse: 2214 case CSSPropertyWebkitMarginAfterCollapse:
2215 return cssValuePool().createValue(style.marginAfterCollapse()); 2215 return cssValuePool().createValue(style.marginAfterCollapse());
2216 case CSSPropertyWebkitMarginTopCollapse: 2216 case CSSPropertyWebkitMarginTopCollapse:
2217 case CSSPropertyWebkitMarginBeforeCollapse: 2217 case CSSPropertyWebkitMarginBeforeCollapse:
2218 return cssValuePool().createValue(style.marginBeforeCollapse()); 2218 return cssValuePool().createValue(style.marginBeforeCollapse());
2219 case CSSPropertyPerspective: 2219 case CSSPropertyPerspective:
2220 if (!style.hasPerspective()) 2220 if (!style.hasPerspective())
2221 return cssValuePool().createIdentifierValue(CSSValueNone); 2221 return cssValuePool().createIdentifierValue(CSSValueNone);
2222 return zoomAdjustedPixelValue(style.perspective(), style); 2222 return zoomAdjustedPixelValue(style.perspective(), style);
2223 case CSSPropertyPerspectiveOrigin: { 2223 case CSSPropertyPerspectiveOrigin: {
2224 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed(); 2224 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
2225 if (layoutObject) { 2225 if (layoutObject) {
2226 LayoutRect box; 2226 LayoutRect box;
2227 if (layoutObject->isBox()) 2227 if (layoutObject->isBox())
2228 box = toLayoutBox(layoutObject)->borderBoxRect(); 2228 box = toLayoutBox(layoutObject)->borderBoxRect();
2229 2229
2230 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.pers pectiveOriginX(), box.width()), style)); 2230 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.pers pectiveOriginX(), box.width()), style));
2231 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.pers pectiveOriginY(), box.height()), style)); 2231 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.pers pectiveOriginY(), box.height()), style));
2232 } else { 2232 } else {
2233 list->append(zoomAdjustedPixelValueForLength(style.perspectiveOrigin X(), style)); 2233 list->append(zoomAdjustedPixelValueForLength(style.perspectiveOrigin X(), style));
2234 list->append(zoomAdjustedPixelValueForLength(style.perspectiveOrigin Y(), style)); 2234 list->append(zoomAdjustedPixelValueForLength(style.perspectiveOrigin Y(), style));
(...skipping 12 matching lines...) Expand all
2247 return valueForBorderRadiusCorner(style.borderBottomLeftRadius(), style) ; 2247 return valueForBorderRadiusCorner(style.borderBottomLeftRadius(), style) ;
2248 case CSSPropertyBorderBottomRightRadius: 2248 case CSSPropertyBorderBottomRightRadius:
2249 return valueForBorderRadiusCorner(style.borderBottomRightRadius(), style ); 2249 return valueForBorderRadiusCorner(style.borderBottomRightRadius(), style );
2250 case CSSPropertyBorderTopLeftRadius: 2250 case CSSPropertyBorderTopLeftRadius:
2251 return valueForBorderRadiusCorner(style.borderTopLeftRadius(), style); 2251 return valueForBorderRadiusCorner(style.borderTopLeftRadius(), style);
2252 case CSSPropertyBorderTopRightRadius: 2252 case CSSPropertyBorderTopRightRadius:
2253 return valueForBorderRadiusCorner(style.borderTopRightRadius(), style); 2253 return valueForBorderRadiusCorner(style.borderTopRightRadius(), style);
2254 case CSSPropertyClip: { 2254 case CSSPropertyClip: {
2255 if (style.hasAutoClip()) 2255 if (style.hasAutoClip())
2256 return cssValuePool().createIdentifierValue(CSSValueAuto); 2256 return cssValuePool().createIdentifierValue(CSSValueAuto);
2257 RefPtrWillBeRawPtr<Rect> rect = Rect::create(); 2257 RefPtr<Rect> rect = Rect::create();
2258 rect->setTop(zoomAdjustedPixelValue(style.clip().top().value(), style)); 2258 rect->setTop(zoomAdjustedPixelValue(style.clip().top().value(), style));
2259 rect->setRight(zoomAdjustedPixelValue(style.clip().right().value(), styl e)); 2259 rect->setRight(zoomAdjustedPixelValue(style.clip().right().value(), styl e));
2260 rect->setBottom(zoomAdjustedPixelValue(style.clip().bottom().value(), st yle)); 2260 rect->setBottom(zoomAdjustedPixelValue(style.clip().bottom().value(), st yle));
2261 rect->setLeft(zoomAdjustedPixelValue(style.clip().left().value(), style) ); 2261 rect->setLeft(zoomAdjustedPixelValue(style.clip().left().value(), style) );
2262 return cssValuePool().createValue(rect.release()); 2262 return cssValuePool().createValue(rect.release());
2263 } 2263 }
2264 case CSSPropertySpeak: 2264 case CSSPropertySpeak:
2265 return cssValuePool().createValue(style.speak()); 2265 return cssValuePool().createValue(style.speak());
2266 case CSSPropertyTransform: 2266 case CSSPropertyTransform:
2267 return computedTransform(layoutObject, style); 2267 return computedTransform(layoutObject, style);
2268 case CSSPropertyTransformOrigin: { 2268 case CSSPropertyTransformOrigin: {
2269 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed(); 2269 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
2270 if (layoutObject) { 2270 if (layoutObject) {
2271 LayoutRect box; 2271 LayoutRect box;
2272 if (layoutObject->isBox()) 2272 if (layoutObject->isBox())
2273 box = toLayoutBox(layoutObject)->borderBoxRect(); 2273 box = toLayoutBox(layoutObject)->borderBoxRect();
2274 2274
2275 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.tran sformOriginX(), box.width()), style)); 2275 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.tran sformOriginX(), box.width()), style));
2276 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.tran sformOriginY(), box.height()), style)); 2276 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.tran sformOriginY(), box.height()), style));
2277 if (style.transformOriginZ() != 0) 2277 if (style.transformOriginZ() != 0)
2278 list->append(zoomAdjustedPixelValue(style.transformOriginZ(), st yle)); 2278 list->append(zoomAdjustedPixelValue(style.transformOriginZ(), st yle));
2279 } else { 2279 } else {
(...skipping 10 matching lines...) Expand all
2290 return valueForAnimationDelay(style.transitions()); 2290 return valueForAnimationDelay(style.transitions());
2291 case CSSPropertyTransitionDuration: 2291 case CSSPropertyTransitionDuration:
2292 return valueForAnimationDuration(style.transitions()); 2292 return valueForAnimationDuration(style.transitions());
2293 case CSSPropertyTransitionProperty: 2293 case CSSPropertyTransitionProperty:
2294 return valueForTransitionProperty(style.transitions()); 2294 return valueForTransitionProperty(style.transitions());
2295 case CSSPropertyTransitionTimingFunction: 2295 case CSSPropertyTransitionTimingFunction:
2296 return valueForAnimationTimingFunction(style.transitions()); 2296 return valueForAnimationTimingFunction(style.transitions());
2297 case CSSPropertyTransition: { 2297 case CSSPropertyTransition: {
2298 const CSSTransitionData* transitionData = style.transitions(); 2298 const CSSTransitionData* transitionData = style.transitions();
2299 if (transitionData) { 2299 if (transitionData) {
2300 RefPtrWillBeRawPtr<CSSValueList> transitionsList = CSSValueList::cre ateCommaSeparated(); 2300 RefPtr<CSSValueList> transitionsList = CSSValueList::createCommaSepa rated();
2301 for (size_t i = 0; i < transitionData->propertyList().size(); ++i) { 2301 for (size_t i = 0; i < transitionData->propertyList().size(); ++i) {
2302 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpac eSeparated(); 2302 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
2303 list->append(createTransitionPropertyValue(transitionData->prope rtyList()[i])); 2303 list->append(createTransitionPropertyValue(transitionData->prope rtyList()[i]));
2304 list->append(cssValuePool().createValue(CSSTimingData::getRepeat ed(transitionData->durationList(), i), CSSPrimitiveValue::UnitType::Seconds)); 2304 list->append(cssValuePool().createValue(CSSTimingData::getRepeat ed(transitionData->durationList(), i), CSSPrimitiveValue::UnitType::Seconds));
2305 list->append(createTimingFunctionValue(CSSTimingData::getRepeate d(transitionData->timingFunctionList(), i).get())); 2305 list->append(createTimingFunctionValue(CSSTimingData::getRepeate d(transitionData->timingFunctionList(), i).get()));
2306 list->append(cssValuePool().createValue(CSSTimingData::getRepeat ed(transitionData->delayList(), i), CSSPrimitiveValue::UnitType::Seconds)); 2306 list->append(cssValuePool().createValue(CSSTimingData::getRepeat ed(transitionData->delayList(), i), CSSPrimitiveValue::UnitType::Seconds));
2307 transitionsList->append(list); 2307 transitionsList->append(list);
2308 } 2308 }
2309 return transitionsList.release(); 2309 return transitionsList.release();
2310 } 2310 }
2311 2311
2312 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed(); 2312 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
2313 // transition-property default value. 2313 // transition-property default value.
2314 list->append(cssValuePool().createIdentifierValue(CSSValueAll)); 2314 list->append(cssValuePool().createIdentifierValue(CSSValueAll));
2315 list->append(cssValuePool().createValue(CSSTransitionData::initialDurati on(), CSSPrimitiveValue::UnitType::Seconds)); 2315 list->append(cssValuePool().createValue(CSSTransitionData::initialDurati on(), CSSPrimitiveValue::UnitType::Seconds));
2316 list->append(createTimingFunctionValue(CSSTransitionData::initialTimingF unction().get())); 2316 list->append(createTimingFunctionValue(CSSTransitionData::initialTimingF unction().get()));
2317 list->append(cssValuePool().createValue(CSSTransitionData::initialDelay( ), CSSPrimitiveValue::UnitType::Seconds)); 2317 list->append(cssValuePool().createValue(CSSTransitionData::initialDelay( ), CSSPrimitiveValue::UnitType::Seconds));
2318 return list.release(); 2318 return list.release();
2319 } 2319 }
2320 case CSSPropertyPointerEvents: 2320 case CSSPropertyPointerEvents:
2321 return cssValuePool().createValue(style.pointerEvents()); 2321 return cssValuePool().createValue(style.pointerEvents());
2322 case CSSPropertyWebkitWritingMode: 2322 case CSSPropertyWebkitWritingMode:
(...skipping 23 matching lines...) Expand all
2346 case CSSPropertyShapeImageThreshold: 2346 case CSSPropertyShapeImageThreshold:
2347 return cssValuePool().createValue(style.shapeImageThreshold(), CSSPrimit iveValue::UnitType::Number); 2347 return cssValuePool().createValue(style.shapeImageThreshold(), CSSPrimit iveValue::UnitType::Number);
2348 case CSSPropertyShapeOutside: 2348 case CSSPropertyShapeOutside:
2349 return valueForShape(style, style.shapeOutside()); 2349 return valueForShape(style, style.shapeOutside());
2350 case CSSPropertyWebkitFilter: 2350 case CSSPropertyWebkitFilter:
2351 return valueForFilter(style); 2351 return valueForFilter(style);
2352 case CSSPropertyMixBlendMode: 2352 case CSSPropertyMixBlendMode:
2353 return cssValuePool().createValue(style.blendMode()); 2353 return cssValuePool().createValue(style.blendMode());
2354 2354
2355 case CSSPropertyBackgroundBlendMode: { 2355 case CSSPropertyBackgroundBlendMode: {
2356 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed(); 2356 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2357 for (const FillLayer* currLayer = &style.backgroundLayers(); currLayer; currLayer = currLayer->next()) 2357 for (const FillLayer* currLayer = &style.backgroundLayers(); currLayer; currLayer = currLayer->next())
2358 list->append(cssValuePool().createValue(currLayer->blendMode())); 2358 list->append(cssValuePool().createValue(currLayer->blendMode()));
2359 return list.release(); 2359 return list.release();
2360 } 2360 }
2361 case CSSPropertyBackground: 2361 case CSSPropertyBackground:
2362 return valuesForBackgroundShorthand(style, layoutObject, styledNode, all owVisitedStyle); 2362 return valuesForBackgroundShorthand(style, layoutObject, styledNode, all owVisitedStyle);
2363 case CSSPropertyBorder: { 2363 case CSSPropertyBorder: {
2364 RefPtrWillBeRawPtr<CSSValue> value = get(CSSPropertyBorderTop, style, la youtObject, styledNode, allowVisitedStyle); 2364 RefPtr<CSSValue> value = get(CSSPropertyBorderTop, style, layoutObject, styledNode, allowVisitedStyle);
2365 const CSSPropertyID properties[] = { 2365 const CSSPropertyID properties[] = {
2366 CSSPropertyBorderRight, 2366 CSSPropertyBorderRight,
2367 CSSPropertyBorderBottom, 2367 CSSPropertyBorderBottom,
2368 CSSPropertyBorderLeft 2368 CSSPropertyBorderLeft
2369 }; 2369 };
2370 for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) { 2370 for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) {
2371 if (!compareCSSValuePtr<CSSValue>(value, get(properties[i], style, l ayoutObject, styledNode, allowVisitedStyle))) 2371 if (!compareCSSValuePtr<CSSValue>(value, get(properties[i], style, l ayoutObject, styledNode, allowVisitedStyle)))
2372 return nullptr; 2372 return nullptr;
2373 } 2373 }
2374 return value.release(); 2374 return value.release();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2421 ASSERT(styleMotionPath->isPathStyleMotionPath()); 2421 ASSERT(styleMotionPath->isPathStyleMotionPath());
2422 return CSSPathValue::create(toPathStyleMotionPath(styleMotionPath)->path String()); 2422 return CSSPathValue::create(toPathStyleMotionPath(styleMotionPath)->path String());
2423 } 2423 }
2424 2424
2425 case CSSPropertyMotionOffset: 2425 case CSSPropertyMotionOffset:
2426 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); 2426 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled());
2427 return zoomAdjustedPixelValueForLength(style.motionOffset(), style); 2427 return zoomAdjustedPixelValueForLength(style.motionOffset(), style);
2428 2428
2429 case CSSPropertyMotionRotation: { 2429 case CSSPropertyMotionRotation: {
2430 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); 2430 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled());
2431 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed(); 2431 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
2432 if (style.motionRotationType() == MotionRotationAuto) 2432 if (style.motionRotationType() == MotionRotationAuto)
2433 list->append(cssValuePool().createIdentifierValue(CSSValueAuto)); 2433 list->append(cssValuePool().createIdentifierValue(CSSValueAuto));
2434 list->append(cssValuePool().createValue(style.motionRotation(), CSSPrimi tiveValue::UnitType::Degrees)); 2434 list->append(cssValuePool().createValue(style.motionRotation(), CSSPrimi tiveValue::UnitType::Degrees));
2435 return list.release(); 2435 return list.release();
2436 } 2436 }
2437 2437
2438 // Unimplemented CSS 3 properties (including CSS3 shorthand properties). 2438 // Unimplemented CSS 3 properties (including CSS3 shorthand properties).
2439 case CSSPropertyWebkitTextEmphasis: 2439 case CSSPropertyWebkitTextEmphasis:
2440 return nullptr; 2440 return nullptr;
2441 2441
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2588 return zoomAdjustedPixelValueForLength(svgStyle.baselineShiftValue() , style); 2588 return zoomAdjustedPixelValueForLength(svgStyle.baselineShiftValue() , style);
2589 } 2589 }
2590 ASSERT_NOT_REACHED(); 2590 ASSERT_NOT_REACHED();
2591 return nullptr; 2591 return nullptr;
2592 } 2592 }
2593 case CSSPropertyBufferedRendering: 2593 case CSSPropertyBufferedRendering:
2594 return CSSPrimitiveValue::create(svgStyle.bufferedRendering()); 2594 return CSSPrimitiveValue::create(svgStyle.bufferedRendering());
2595 case CSSPropertyGlyphOrientationHorizontal: 2595 case CSSPropertyGlyphOrientationHorizontal:
2596 return glyphOrientationToCSSPrimitiveValue(svgStyle.glyphOrientationHori zontal()); 2596 return glyphOrientationToCSSPrimitiveValue(svgStyle.glyphOrientationHori zontal());
2597 case CSSPropertyGlyphOrientationVertical: { 2597 case CSSPropertyGlyphOrientationVertical: {
2598 if (RefPtrWillBeRawPtr<CSSPrimitiveValue> value = glyphOrientationToCSSP rimitiveValue(svgStyle.glyphOrientationVertical())) 2598 if (RefPtr<CSSPrimitiveValue> value = glyphOrientationToCSSPrimitiveValu e(svgStyle.glyphOrientationVertical()))
2599 return value.release(); 2599 return value.release();
2600 if (svgStyle.glyphOrientationVertical() == GO_AUTO) 2600 if (svgStyle.glyphOrientationVertical() == GO_AUTO)
2601 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 2601 return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
2602 return nullptr; 2602 return nullptr;
2603 } 2603 }
2604 case CSSPropertyPaintOrder: 2604 case CSSPropertyPaintOrder:
2605 return paintOrderToCSSValueList(svgStyle); 2605 return paintOrderToCSSValueList(svgStyle);
2606 case CSSPropertyVectorEffect: 2606 case CSSPropertyVectorEffect:
2607 return CSSPrimitiveValue::create(svgStyle.vectorEffect()); 2607 return CSSPrimitiveValue::create(svgStyle.vectorEffect());
2608 case CSSPropertyMaskType: 2608 case CSSPropertyMaskType:
(...skipping 22 matching lines...) Expand all
2631 case CSSPropertyScrollSnapPointsY: 2631 case CSSPropertyScrollSnapPointsY:
2632 return valueForScrollSnapPoints(style.scrollSnapPointsY(), style); 2632 return valueForScrollSnapPoints(style.scrollSnapPointsY(), style);
2633 case CSSPropertyScrollSnapCoordinate: 2633 case CSSPropertyScrollSnapCoordinate:
2634 return valueForScrollSnapCoordinate(style.scrollSnapCoordinate(), style) ; 2634 return valueForScrollSnapCoordinate(style.scrollSnapCoordinate(), style) ;
2635 case CSSPropertyScrollSnapDestination: 2635 case CSSPropertyScrollSnapDestination:
2636 return valueForScrollSnapDestination(style.scrollSnapDestination(), styl e); 2636 return valueForScrollSnapDestination(style.scrollSnapDestination(), styl e);
2637 case CSSPropertyTranslate: { 2637 case CSSPropertyTranslate: {
2638 if (!style.translate()) 2638 if (!style.translate())
2639 return cssValuePool().createValue(0, CSSPrimitiveValue::UnitType::Pi xels); 2639 return cssValuePool().createValue(0, CSSPrimitiveValue::UnitType::Pi xels);
2640 2640
2641 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed(); 2641 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
2642 if (layoutObject && layoutObject->isBox()) { 2642 if (layoutObject && layoutObject->isBox()) {
2643 LayoutRect box = toLayoutBox(layoutObject)->borderBoxRect(); 2643 LayoutRect box = toLayoutBox(layoutObject)->borderBoxRect();
2644 list->append(zoomAdjustedPixelValue(floatValueForLength(style.transl ate()->x(), box.width().toFloat()), style)); 2644 list->append(zoomAdjustedPixelValue(floatValueForLength(style.transl ate()->x(), box.width().toFloat()), style));
2645 2645
2646 if (!style.translate()->y().isZero() || style.translate()->z() != 0) 2646 if (!style.translate()->y().isZero() || style.translate()->z() != 0)
2647 list->append(zoomAdjustedPixelValue(floatValueForLength(style.tr anslate()->y(), box.height().toFloat()), style)); 2647 list->append(zoomAdjustedPixelValue(floatValueForLength(style.tr anslate()->y(), box.height().toFloat()), style));
2648 2648
2649 } else { 2649 } else {
2650 // No box to resolve the percentage values 2650 // No box to resolve the percentage values
2651 list->append(zoomAdjustedPixelValueForLength(style.translate()->x(), style)); 2651 list->append(zoomAdjustedPixelValueForLength(style.translate()->x(), style));
2652 2652
2653 if (!style.translate()->y().isZero() || style.translate()->z() != 0) 2653 if (!style.translate()->y().isZero() || style.translate()->z() != 0)
2654 list->append(zoomAdjustedPixelValueForLength(style.translate()-> y(), style)); 2654 list->append(zoomAdjustedPixelValueForLength(style.translate()-> y(), style));
2655 } 2655 }
2656 2656
2657 if (style.translate()->z() != 0) 2657 if (style.translate()->z() != 0)
2658 list->append(zoomAdjustedPixelValue(style.translate()->z(), style)); 2658 list->append(zoomAdjustedPixelValue(style.translate()->z(), style));
2659 2659
2660 return list.release(); 2660 return list.release();
2661 } 2661 }
2662 case CSSPropertyRotate: { 2662 case CSSPropertyRotate: {
2663 if (!style.rotate()) 2663 if (!style.rotate())
2664 return cssValuePool().createValue(0, CSSPrimitiveValue::UnitType::De grees); 2664 return cssValuePool().createValue(0, CSSPrimitiveValue::UnitType::De grees);
2665 2665
2666 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed(); 2666 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
2667 list->append(cssValuePool().createValue(style.rotate()->angle(), CSSPrim itiveValue::UnitType::Degrees)); 2667 list->append(cssValuePool().createValue(style.rotate()->angle(), CSSPrim itiveValue::UnitType::Degrees));
2668 if (style.rotate()->x() != 0 || style.rotate()->y() != 0 || style.rotate ()->z() != 1) { 2668 if (style.rotate()->x() != 0 || style.rotate()->y() != 0 || style.rotate ()->z() != 1) {
2669 list->append(cssValuePool().createValue(style.rotate()->x(), CSSPrim itiveValue::UnitType::Number)); 2669 list->append(cssValuePool().createValue(style.rotate()->x(), CSSPrim itiveValue::UnitType::Number));
2670 list->append(cssValuePool().createValue(style.rotate()->y(), CSSPrim itiveValue::UnitType::Number)); 2670 list->append(cssValuePool().createValue(style.rotate()->y(), CSSPrim itiveValue::UnitType::Number));
2671 list->append(cssValuePool().createValue(style.rotate()->z(), CSSPrim itiveValue::UnitType::Number)); 2671 list->append(cssValuePool().createValue(style.rotate()->z(), CSSPrim itiveValue::UnitType::Number));
2672 } 2672 }
2673 return list.release(); 2673 return list.release();
2674 } 2674 }
2675 case CSSPropertyScale: { 2675 case CSSPropertyScale: {
2676 if (!style.scale()) 2676 if (!style.scale())
2677 return cssValuePool().createValue(1, CSSPrimitiveValue::UnitType::Nu mber); 2677 return cssValuePool().createValue(1, CSSPrimitiveValue::UnitType::Nu mber);
2678 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed(); 2678 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
2679 list->append(cssValuePool().createValue(style.scale()->x(), CSSPrimitive Value::UnitType::Number)); 2679 list->append(cssValuePool().createValue(style.scale()->x(), CSSPrimitive Value::UnitType::Number));
2680 if (style.scale()->y() == 1 && style.scale()->z() == 1) 2680 if (style.scale()->y() == 1 && style.scale()->z() == 1)
2681 return list.release(); 2681 return list.release();
2682 list->append(cssValuePool().createValue(style.scale()->y(), CSSPrimitive Value::UnitType::Number)); 2682 list->append(cssValuePool().createValue(style.scale()->y(), CSSPrimitive Value::UnitType::Number));
2683 if (style.scale()->z() != 1) 2683 if (style.scale()->z() != 1)
2684 list->append(cssValuePool().createValue(style.scale()->z(), CSSPrimi tiveValue::UnitType::Number)); 2684 list->append(cssValuePool().createValue(style.scale()->z(), CSSPrimi tiveValue::UnitType::Number));
2685 return list.release(); 2685 return list.release();
2686 } 2686 }
2687 case CSSPropertyAll: 2687 case CSSPropertyAll:
2688 return nullptr; 2688 return nullptr;
2689 default: 2689 default:
2690 break; 2690 break;
2691 } 2691 }
2692 ASSERT_NOT_REACHED(); 2692 ASSERT_NOT_REACHED();
2693 return nullptr; 2693 return nullptr;
2694 } 2694 }
2695 2695
2696 } 2696 }
OLDNEW
« no previous file with comments | « Source/core/css/ComputedStyleCSSValueMapping.h ('k') | Source/core/css/FontFace.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698