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

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

Issue 1033943002: Rename LayoutStyle to papayawhip (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ensureComputedStyle Created 5 years, 8 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/LayoutStyleCSSValueMapping.h ('k') | Source/core/css/MediaQueryEvaluator.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
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.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2011 Sencha, Inc. All rights reserved.
7 * Copyright (C) 2015 Google Inc. All rights reserved.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 * 02110-1301 USA
23 */
24
25 #include "config.h"
26 #include "core/css/LayoutStyleCSSValueMapping.h"
27
28 #include "core/StylePropertyShorthand.h"
29 #include "core/css/BasicShapeFunctions.h"
30 #include "core/css/CSSBorderImage.h"
31 #include "core/css/CSSBorderImageSliceValue.h"
32 #include "core/css/CSSFontFeatureValue.h"
33 #include "core/css/CSSFontValue.h"
34 #include "core/css/CSSFunctionValue.h"
35 #include "core/css/CSSGridLineNamesValue.h"
36 #include "core/css/CSSGridTemplateAreasValue.h"
37 #include "core/css/CSSPathValue.h"
38 #include "core/css/CSSPrimitiveValueMappings.h"
39 #include "core/css/CSSReflectValue.h"
40 #include "core/css/CSSShadowValue.h"
41 #include "core/css/CSSTimingFunctionValue.h"
42 #include "core/css/CSSValueList.h"
43 #include "core/css/CSSValuePool.h"
44 #include "core/css/Pair.h"
45 #include "core/css/Rect.h"
46 #include "core/layout/LayoutBlock.h"
47 #include "core/layout/LayoutBox.h"
48 #include "core/layout/LayoutGrid.h"
49 #include "core/layout/LayoutObject.h"
50 #include "core/layout/style/ContentData.h"
51 #include "core/layout/style/LayoutStyle.h"
52 #include "core/layout/style/PathStyleMotionPath.h"
53 #include "core/layout/style/ShadowList.h"
54 #include "platform/LengthFunctions.h"
55
56 namespace blink {
57
58 inline static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedPixelValue(d ouble value, const LayoutStyle& style)
59 {
60 return cssValuePool().createValue(adjustFloatForAbsoluteZoom(value, style), CSSPrimitiveValue::CSS_PX);
61 }
62
63 inline static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedNumberValue( double value, const LayoutStyle& style)
64 {
65 return cssValuePool().createValue(value / style.effectiveZoom(), CSSPrimitiv eValue::CSS_NUMBER);
66 }
67
68 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedPixelValueForLength (const Length& length, const LayoutStyle& style)
69 {
70 if (length.isFixed())
71 return zoomAdjustedPixelValue(length.value(), style);
72 return cssValuePool().createValue(length, style);
73 }
74
75 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> pixelValueForUnzoomedLength(con st UnzoomedLength& unzoomedLength, const LayoutStyle& style)
76 {
77 const Length& length = unzoomedLength.length();
78 if (length.isFixed())
79 return cssValuePool().createValue(length.value(), CSSPrimitiveValue::CSS _PX);
80 return cssValuePool().createValue(length, style);
81 }
82
83 static PassRefPtrWillBeRawPtr<CSSValueList> createPositionListForLayer(CSSProper tyID propertyID, const FillLayer& layer, const LayoutStyle& style)
84 {
85 RefPtrWillBeRawPtr<CSSValueList> positionList = CSSValueList::createSpaceSep arated();
86 if (layer.isBackgroundXOriginSet()) {
87 ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPosition || propertyID == CSSPropertyWebkitMaskPosition);
88 positionList->append(cssValuePool().createValue(layer.backgroundXOrigin( )));
89 }
90 positionList->append(zoomAdjustedPixelValueForLength(layer.xPosition(), styl e));
91 if (layer.isBackgroundYOriginSet()) {
92 ASSERT(propertyID == CSSPropertyBackgroundPosition || propertyID == CSSP ropertyWebkitMaskPosition);
93 positionList->append(cssValuePool().createValue(layer.backgroundYOrigin( )));
94 }
95 positionList->append(zoomAdjustedPixelValueForLength(layer.yPosition(), styl e));
96 return positionList.release();
97 }
98
99 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> LayoutStyleCSSValueMapping::currentCol orOrValidColor(const LayoutStyle& style, const StyleColor& color)
100 {
101 // This function does NOT look at visited information, so that computed styl e doesn't expose that.
102 return cssValuePool().createColorValue(color.resolve(style.color()).rgb());
103 }
104
105 static PassRefPtrWillBeRawPtr<CSSValue> valueForFillSize(const FillSize& fillSiz e, const LayoutStyle& style)
106 {
107 if (fillSize.type == Contain)
108 return cssValuePool().createIdentifierValue(CSSValueContain);
109
110 if (fillSize.type == Cover)
111 return cssValuePool().createIdentifierValue(CSSValueCover);
112
113 if (fillSize.size.height().isAuto())
114 return zoomAdjustedPixelValueForLength(fillSize.size.width(), style);
115
116 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
117 list->append(zoomAdjustedPixelValueForLength(fillSize.size.width(), style));
118 list->append(zoomAdjustedPixelValueForLength(fillSize.size.height(), style)) ;
119 return list.release();
120 }
121
122 static PassRefPtrWillBeRawPtr<CSSValue> valueForFillRepeat(EFillRepeat xRepeat, EFillRepeat yRepeat)
123 {
124 // For backwards compatibility, if both values are equal, just return one of them. And
125 // if the two values are equivalent to repeat-x or repeat-y, just return the shorthand.
126 if (xRepeat == yRepeat)
127 return cssValuePool().createValue(xRepeat);
128 if (xRepeat == RepeatFill && yRepeat == NoRepeatFill)
129 return cssValuePool().createIdentifierValue(CSSValueRepeatX);
130 if (xRepeat == NoRepeatFill && yRepeat == RepeatFill)
131 return cssValuePool().createIdentifierValue(CSSValueRepeatY);
132
133 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
134 list->append(cssValuePool().createValue(xRepeat));
135 list->append(cssValuePool().createValue(yRepeat));
136 return list.release();
137 }
138
139 static PassRefPtrWillBeRawPtr<CSSValue> valueForFillSourceType(EMaskSourceType t ype)
140 {
141 switch (type) {
142 case MaskAlpha:
143 return cssValuePool().createValue(CSSValueAlpha);
144 case MaskLuminance:
145 return cssValuePool().createValue(CSSValueLuminance);
146 }
147
148 ASSERT_NOT_REACHED();
149
150 return nullptr;
151 }
152
153 static PassRefPtrWillBeRawPtr<CSSValue> valueForPositionOffset(const LayoutStyle & style, CSSPropertyID propertyID, const LayoutObject* renderer)
154 {
155 Length offset;
156 switch (propertyID) {
157 case CSSPropertyLeft:
158 offset = style.left();
159 break;
160 case CSSPropertyRight:
161 offset = style.right();
162 break;
163 case CSSPropertyTop:
164 offset = style.top();
165 break;
166 case CSSPropertyBottom:
167 offset = style.bottom();
168 break;
169 default:
170 return nullptr;
171 }
172
173 if (offset.isPercent() && renderer && renderer->isBox()) {
174 LayoutUnit containingBlockSize = (propertyID == CSSPropertyLeft || prope rtyID == CSSPropertyRight) ?
175 toLayoutBox(renderer)->containingBlockLogicalWidthForContent() :
176 toLayoutBox(renderer)->containingBlockLogicalHeightForContent(Exclud eMarginBorderPadding);
177 return zoomAdjustedPixelValue(valueForLength(offset, containingBlockSize ), style);
178 }
179 if (offset.isAuto()) {
180 // FIXME: It's not enough to simply return "auto" values for one offset if the other side is defined.
181 // In other words if left is auto and right is not auto, then left's com puted value is negative right().
182 // So we should get the opposite length unit and see if it is auto.
183 return cssValuePool().createIdentifierValue(CSSValueAuto);
184 }
185
186 return zoomAdjustedPixelValueForLength(offset, style);
187 }
188
189 static PassRefPtrWillBeRawPtr<CSSBorderImageSliceValue> valueForNinePieceImageSl ice(const NinePieceImage& image)
190 {
191 // Create the slices.
192 RefPtrWillBeRawPtr<CSSPrimitiveValue> top = nullptr;
193 RefPtrWillBeRawPtr<CSSPrimitiveValue> right = nullptr;
194 RefPtrWillBeRawPtr<CSSPrimitiveValue> bottom = nullptr;
195 RefPtrWillBeRawPtr<CSSPrimitiveValue> left = nullptr;
196
197 if (image.imageSlices().top().isPercent())
198 top = cssValuePool().createValue(image.imageSlices().top().value(), CSSP rimitiveValue::CSS_PERCENTAGE);
199 else
200 top = cssValuePool().createValue(image.imageSlices().top().value(), CSSP rimitiveValue::CSS_NUMBER);
201
202 if (image.imageSlices().right() == image.imageSlices().top() && image.imageS lices().bottom() == image.imageSlices().top()
203 && image.imageSlices().left() == image.imageSlices().top()) {
204 right = top;
205 bottom = top;
206 left = top;
207 } else {
208 if (image.imageSlices().right().isPercent())
209 right = cssValuePool().createValue(image.imageSlices().right().value (), CSSPrimitiveValue::CSS_PERCENTAGE);
210 else
211 right = cssValuePool().createValue(image.imageSlices().right().value (), CSSPrimitiveValue::CSS_NUMBER);
212
213 if (image.imageSlices().bottom() == image.imageSlices().top() && image.i mageSlices().right() == image.imageSlices().left()) {
214 bottom = top;
215 left = right;
216 } else {
217 if (image.imageSlices().bottom().isPercent())
218 bottom = cssValuePool().createValue(image.imageSlices().bottom() .value(), CSSPrimitiveValue::CSS_PERCENTAGE);
219 else
220 bottom = cssValuePool().createValue(image.imageSlices().bottom() .value(), CSSPrimitiveValue::CSS_NUMBER);
221
222 if (image.imageSlices().left() == image.imageSlices().right()) {
223 left = right;
224 } else {
225 if (image.imageSlices().left().isPercent())
226 left = cssValuePool().createValue(image.imageSlices().left() .value(), CSSPrimitiveValue::CSS_PERCENTAGE);
227 else
228 left = cssValuePool().createValue(image.imageSlices().left() .value(), CSSPrimitiveValue::CSS_NUMBER);
229 }
230 }
231 }
232
233 RefPtrWillBeRawPtr<Quad> quad = Quad::create();
234 quad->setTop(top);
235 quad->setRight(right);
236 quad->setBottom(bottom);
237 quad->setLeft(left);
238
239 return CSSBorderImageSliceValue::create(cssValuePool().createValue(quad.rele ase()), image.fill());
240 }
241
242 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForNinePieceImageQuad(cons t BorderImageLengthBox& box, const LayoutStyle& style)
243 {
244 // Create the slices.
245 RefPtrWillBeRawPtr<CSSPrimitiveValue> top = nullptr;
246 RefPtrWillBeRawPtr<CSSPrimitiveValue> right = nullptr;
247 RefPtrWillBeRawPtr<CSSPrimitiveValue> bottom = nullptr;
248 RefPtrWillBeRawPtr<CSSPrimitiveValue> left = nullptr;
249
250 if (box.top().isNumber())
251 top = cssValuePool().createValue(box.top().number(), CSSPrimitiveValue:: CSS_NUMBER);
252 else
253 top = cssValuePool().createValue(box.top().length(), style);
254
255 if (box.right() == box.top() && box.bottom() == box.top() && box.left() == b ox.top()) {
256 right = top;
257 bottom = top;
258 left = top;
259 } else {
260 if (box.right().isNumber())
261 right = cssValuePool().createValue(box.right().number(), CSSPrimitiv eValue::CSS_NUMBER);
262 else
263 right = cssValuePool().createValue(box.right().length(), style);
264
265 if (box.bottom() == box.top() && box.right() == box.left()) {
266 bottom = top;
267 left = right;
268 } else {
269 if (box.bottom().isNumber())
270 bottom = cssValuePool().createValue(box.bottom().number(), CSSPr imitiveValue::CSS_NUMBER);
271 else
272 bottom = cssValuePool().createValue(box.bottom().length(), style );
273
274 if (box.left() == box.right()) {
275 left = right;
276 } else {
277 if (box.left().isNumber())
278 left = cssValuePool().createValue(box.left().number(), CSSPr imitiveValue::CSS_NUMBER);
279 else
280 left = cssValuePool().createValue(box.left().length(), style );
281 }
282 }
283 }
284
285 RefPtrWillBeRawPtr<Quad> quad = Quad::create();
286 quad->setTop(top);
287 quad->setRight(right);
288 quad->setBottom(bottom);
289 quad->setLeft(left);
290
291 return cssValuePool().createValue(quad.release());
292 }
293
294 static CSSValueID valueForRepeatRule(int rule)
295 {
296 switch (rule) {
297 case RepeatImageRule:
298 return CSSValueRepeat;
299 case RoundImageRule:
300 return CSSValueRound;
301 case SpaceImageRule:
302 return CSSValueSpace;
303 default:
304 return CSSValueStretch;
305 }
306 }
307
308 static PassRefPtrWillBeRawPtr<CSSValue> valueForNinePieceImageRepeat(const NineP ieceImage& image)
309 {
310 RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalRepeat = nullptr;
311 RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalRepeat = nullptr;
312
313 horizontalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(i mage.horizontalRule()));
314 if (image.horizontalRule() == image.verticalRule())
315 verticalRepeat = horizontalRepeat;
316 else
317 verticalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule (image.verticalRule()));
318 return cssValuePool().createValue(Pair::create(horizontalRepeat.release(), v erticalRepeat.release(), Pair::DropIdenticalValues));
319 }
320
321 static PassRefPtrWillBeRawPtr<CSSValue> valueForNinePieceImage(const NinePieceIm age& image, const LayoutStyle& style)
322 {
323 if (!image.hasImage())
324 return cssValuePool().createIdentifierValue(CSSValueNone);
325
326 // Image first.
327 RefPtrWillBeRawPtr<CSSValue> imageValue = nullptr;
328 if (image.image())
329 imageValue = image.image()->cssValue();
330
331 // Create the image slice.
332 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> imageSlices = valueForNinePiece ImageSlice(image);
333
334 // Create the border area slices.
335 RefPtrWillBeRawPtr<CSSValue> borderSlices = valueForNinePieceImageQuad(image .borderSlices(), style);
336
337 // Create the border outset.
338 RefPtrWillBeRawPtr<CSSValue> outset = valueForNinePieceImageQuad(image.outse t(), style);
339
340 // Create the repeat rules.
341 RefPtrWillBeRawPtr<CSSValue> repeat = valueForNinePieceImageRepeat(image);
342
343 return createBorderImageValue(imageValue.release(), imageSlices.release(), b orderSlices.release(), outset.release(), repeat.release());
344 }
345
346 static PassRefPtrWillBeRawPtr<CSSValue> valueForReflection(const StyleReflection * reflection, const LayoutStyle& style)
347 {
348 if (!reflection)
349 return cssValuePool().createIdentifierValue(CSSValueNone);
350
351 RefPtrWillBeRawPtr<CSSPrimitiveValue> offset = nullptr;
352 if (reflection->offset().isPercent())
353 offset = cssValuePool().createValue(reflection->offset().percent(), CSSP rimitiveValue::CSS_PERCENTAGE);
354 else
355 offset = zoomAdjustedPixelValue(reflection->offset().value(), style);
356
357 RefPtrWillBeRawPtr<CSSPrimitiveValue> direction = nullptr;
358 switch (reflection->direction()) {
359 case ReflectionBelow:
360 direction = cssValuePool().createIdentifierValue(CSSValueBelow);
361 break;
362 case ReflectionAbove:
363 direction = cssValuePool().createIdentifierValue(CSSValueAbove);
364 break;
365 case ReflectionLeft:
366 direction = cssValuePool().createIdentifierValue(CSSValueLeft);
367 break;
368 case ReflectionRight:
369 direction = cssValuePool().createIdentifierValue(CSSValueRight);
370 break;
371 }
372
373 return CSSReflectValue::create(direction.release(), offset.release(), valueF orNinePieceImage(reflection->mask(), style));
374 }
375
376 static ItemPosition resolveAlignmentAuto(ItemPosition position, Node* element)
377 {
378 if (position != ItemPositionAuto)
379 return position;
380
381 bool isFlexOrGrid = element && element->computedStyle()
382 && element->computedStyle()->isDisplayFlexibleOrGridBox();
383
384 return isFlexOrGrid ? ItemPositionStretch : ItemPositionStart;
385 }
386
387 static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlig nment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, ItemPositi onType positionType)
388 {
389 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated ();
390 if (positionType == LegacyPosition)
391 result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy));
392 result->append(CSSPrimitiveValue::create(itemPosition));
393 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign mentDefault)
394 result->append(CSSPrimitiveValue::create(overflowAlignment));
395 ASSERT(result->length() <= 2);
396 return result.release();
397 }
398
399 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForGridShorthand(const StylePr opertyShorthand& shorthand, const LayoutStyle& style, const LayoutObject* render er, Node* styledNode, bool allowVisitedStyle)
400 {
401 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated() ;
402 for (size_t i = 0; i < shorthand.length(); ++i) {
403 RefPtrWillBeRawPtr<CSSValue> value = LayoutStyleCSSValueMapping::get(sho rthand.properties()[i], style, renderer, styledNode, allowVisitedStyle);
404 ASSERT(value);
405 list->append(value.release());
406 }
407 return list.release();
408 }
409
410 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForShorthandProperty(const Sty lePropertyShorthand& shorthand, const LayoutStyle& style, const LayoutObject* re nderer, Node* styledNode, bool allowVisitedStyle)
411 {
412 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
413 for (size_t i = 0; i < shorthand.length(); ++i) {
414 RefPtrWillBeRawPtr<CSSValue> value = LayoutStyleCSSValueMapping::get(sho rthand.properties()[i], style, renderer, styledNode, allowVisitedStyle);
415 ASSERT(value);
416 list->append(value);
417 }
418 return list.release();
419 }
420
421 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForBackgroundShorthand(const L ayoutStyle& style, const LayoutObject* renderer, Node* styledNode, bool allowVis itedStyle)
422 {
423 RefPtrWillBeRawPtr<CSSValueList> ret = CSSValueList::createCommaSeparated();
424 const FillLayer* currLayer = &style.backgroundLayers();
425 for (; currLayer; currLayer = currLayer->next()) {
426 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparat ed();
427 RefPtrWillBeRawPtr<CSSValueList> beforeSlash = CSSValueList::createSpace Separated();
428 if (!currLayer->next()) { // color only for final layer
429 RefPtrWillBeRawPtr<CSSValue> value = LayoutStyleCSSValueMapping::get (CSSPropertyBackgroundColor, style, renderer, styledNode, allowVisitedStyle);
430 ASSERT(value);
431 beforeSlash->append(value);
432 }
433 beforeSlash->append(currLayer->image() ? currLayer->image()->cssValue() : cssValuePool().createIdentifierValue(CSSValueNone));
434 beforeSlash->append(valueForFillRepeat(currLayer->repeatX(), currLayer-> repeatY()));
435 beforeSlash->append(cssValuePool().createValue(currLayer->attachment())) ;
436 beforeSlash->append(createPositionListForLayer(CSSPropertyBackgroundPosi tion, *currLayer, style));
437 list->append(beforeSlash);
438 RefPtrWillBeRawPtr<CSSValueList> afterSlash = CSSValueList::createSpaceS eparated();
439 afterSlash->append(valueForFillSize(currLayer->size(), style));
440 afterSlash->append(cssValuePool().createValue(currLayer->origin()));
441 afterSlash->append(cssValuePool().createValue(currLayer->clip()));
442 list->append(afterSlash);
443 ret->append(list);
444 }
445 return ret.release();
446 }
447
448 static ContentPosition resolveContentAlignmentAuto(ContentPosition position, Con tentDistributionType distribution, Node* element)
449 {
450 if (position != ContentPositionAuto || distribution != ContentDistributionDe fault)
451 return position;
452
453 bool isFlex = element && element->computedStyle()
454 && element->computedStyle()->isDisplayFlexibleBox();
455
456 return isFlex ? ContentPositionFlexStart : ContentPositionStart;
457 }
458
459 static PassRefPtrWillBeRawPtr<CSSValueList> valueForContentPositionAndDistributi onWithOverflowAlignment(ContentPosition position, OverflowAlignment overflowAlig nment, ContentDistributionType distribution)
460 {
461 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated ();
462 if (distribution != ContentDistributionDefault)
463 result->append(CSSPrimitiveValue::create(distribution));
464 if (distribution == ContentDistributionDefault || position != ContentPositio nAuto)
465 result->append(CSSPrimitiveValue::create(position));
466 if ((position >= ContentPositionCenter || distribution != ContentDistributio nDefault) && overflowAlignment != OverflowAlignmentDefault)
467 result->append(CSSPrimitiveValue::create(overflowAlignment));
468 ASSERT(result->length() > 0);
469 ASSERT(result->length() <= 3);
470 return result.release();
471 }
472
473 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForLineHeight(const Layout Style& style)
474 {
475 Length length = style.lineHeight();
476 if (length.isNegative())
477 return cssValuePool().createIdentifierValue(CSSValueNormal);
478
479 float floatValue = floatValueForLength(length, style.fontDescription().speci fiedSize());
480 if (length.isPercent())
481 return cssValuePool().createValue(floatValue, CSSPrimitiveValue::CSS_PX) ;
482
483 return zoomAdjustedPixelValue(floatValue, style);
484 }
485
486 static CSSValueID identifierForFamily(const AtomicString& family)
487 {
488 if (family == FontFamilyNames::webkit_cursive)
489 return CSSValueCursive;
490 if (family == FontFamilyNames::webkit_fantasy)
491 return CSSValueFantasy;
492 if (family == FontFamilyNames::webkit_monospace)
493 return CSSValueMonospace;
494 if (family == FontFamilyNames::webkit_pictograph)
495 return CSSValueWebkitPictograph;
496 if (family == FontFamilyNames::webkit_sans_serif)
497 return CSSValueSansSerif;
498 if (family == FontFamilyNames::webkit_serif)
499 return CSSValueSerif;
500 return CSSValueInvalid;
501 }
502
503 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFamily(const AtomicStri ng& family)
504 {
505 if (CSSValueID familyIdentifier = identifierForFamily(family))
506 return cssValuePool().createIdentifierValue(familyIdentifier);
507 return cssValuePool().createValue(family.string(), CSSPrimitiveValue::CSS_CU STOM_IDENT);
508 }
509
510 static PassRefPtrWillBeRawPtr<CSSValueList> valueForFontFamily(const LayoutStyle & style)
511 {
512 const FontFamily& firstFamily = style.fontDescription().family();
513 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ;
514 for (const FontFamily* family = &firstFamily; family; family = family->next( ))
515 list->append(valueForFamily(family->family()));
516 return list.release();
517 }
518
519 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontSize(const LayoutSt yle& style)
520 {
521 return zoomAdjustedPixelValue(style.fontDescription().computedSize(), style) ;
522 }
523
524 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStretch(const Layou tStyle& style)
525 {
526 return cssValuePool().createValue(style.fontDescription().stretch());
527 }
528
529 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStyle(const LayoutS tyle& style)
530 {
531 return cssValuePool().createValue(style.fontDescription().style());
532 }
533
534 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontVariant(const Layou tStyle& style)
535 {
536 return cssValuePool().createValue(style.fontDescription().variant());
537 }
538
539 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontWeight(const Layout Style& style)
540 {
541 return cssValuePool().createValue(style.fontDescription().weight());
542 }
543
544 static PassRefPtrWillBeRawPtr<CSSValue> specifiedValueForGridTrackBreadth(const GridLength& trackBreadth, const LayoutStyle& style)
545 {
546 if (!trackBreadth.isLength())
547 return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue ::CSS_FR);
548
549 const Length& trackBreadthLength = trackBreadth.length();
550 if (trackBreadthLength.isAuto())
551 return cssValuePool().createIdentifierValue(CSSValueAuto);
552 return zoomAdjustedPixelValueForLength(trackBreadthLength, style);
553 }
554
555 static PassRefPtrWillBeRawPtr<CSSValue> specifiedValueForGridTrackSize(const Gri dTrackSize& trackSize, const LayoutStyle& style)
556 {
557 switch (trackSize.type()) {
558 case LengthTrackSizing:
559 return specifiedValueForGridTrackBreadth(trackSize.length(), style);
560 case MinMaxTrackSizing:
561 RefPtrWillBeRawPtr<CSSFunctionValue> minMaxTrackBreadths = CSSFunctionVa lue::create(CSSValueMinmax);
562 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize. minTrackBreadth(), style));
563 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize. maxTrackBreadth(), style));
564 return minMaxTrackBreadths.release();
565 }
566 ASSERT_NOT_REACHED();
567 return nullptr;
568 }
569
570 static void addValuesForNamedGridLinesAtIndex(const OrderedNamedGridLines& order edNamedGridLines, size_t i, CSSValueList& list)
571 {
572 const Vector<String>& namedGridLines = orderedNamedGridLines.get(i);
573 if (namedGridLines.isEmpty())
574 return;
575
576 RefPtrWillBeRawPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue: :create();
577 for (size_t j = 0; j < namedGridLines.size(); ++j)
578 lineNames->append(cssValuePool().createValue(namedGridLines[j], CSSPrimi tiveValue::CSS_CUSTOM_IDENT));
579 list.append(lineNames.release());
580 }
581
582 static PassRefPtrWillBeRawPtr<CSSValue> valueForGridTrackList(GridTrackSizingDir ection direction, const LayoutObject* renderer, const LayoutStyle& style)
583 {
584 const Vector<GridTrackSize>& trackSizes = direction == ForColumns ? style.gr idTemplateColumns() : style.gridTemplateRows();
585 const OrderedNamedGridLines& orderedNamedGridLines = direction == ForColumns ? style.orderedNamedGridColumnLines() : style.orderedNamedGridRowLines();
586 bool isLayoutGrid = renderer && renderer->isLayoutGrid();
587
588 // Handle the 'none' case.
589 bool trackListIsEmpty = trackSizes.isEmpty();
590 if (isLayoutGrid && trackListIsEmpty) {
591 // For grids we should consider every listed track, whether implicitly o r explicitly created. If we don't have
592 // any explicit track and there are no children then there are no implic it tracks. We cannot simply check the
593 // number of rows/columns in our internal grid representation because it 's always at least 1x1 (see r143331).
594 trackListIsEmpty = !toLayoutBlock(renderer)->firstChild();
595 }
596
597 if (trackListIsEmpty) {
598 ASSERT(orderedNamedGridLines.isEmpty());
599 return cssValuePool().createIdentifierValue(CSSValueNone);
600 }
601
602 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
603 if (isLayoutGrid) {
604 const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? toL ayoutGrid(renderer)->columnPositions() : toLayoutGrid(renderer)->rowPositions();
605 // There are at least #tracks + 1 grid lines (trackPositions). Apart fro m that, the grid container can generate implicit grid tracks,
606 // so we'll have more trackPositions than trackSizes as the latter only contain the explicit grid.
607 ASSERT(trackPositions.size() - 1 >= trackSizes.size());
608
609 for (size_t i = 0; i < trackPositions.size() - 1; ++i) {
610 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list);
611 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPos itions[i], style));
612 }
613 } else {
614 for (size_t i = 0; i < trackSizes.size(); ++i) {
615 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list);
616 list->append(specifiedValueForGridTrackSize(trackSizes[i], style));
617 }
618 }
619 // Those are the trailing <string>* allowed in the syntax.
620 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, trackSizes.size(), *list);
621 return list.release();
622 }
623
624 static PassRefPtrWillBeRawPtr<CSSValue> valueForGridPosition(const GridPosition& position)
625 {
626 if (position.isAuto())
627 return cssValuePool().createIdentifierValue(CSSValueAuto);
628
629 if (position.isNamedGridArea())
630 return cssValuePool().createValue(position.namedGridLine(), CSSPrimitive Value::CSS_CUSTOM_IDENT);
631
632 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
633 if (position.isSpan()) {
634 list->append(cssValuePool().createIdentifierValue(CSSValueSpan));
635 list->append(cssValuePool().createValue(position.spanPosition(), CSSPrim itiveValue::CSS_NUMBER));
636 } else {
637 list->append(cssValuePool().createValue(position.integerPosition(), CSSP rimitiveValue::CSS_NUMBER));
638 }
639
640 if (!position.namedGridLine().isNull())
641 list->append(cssValuePool().createValue(position.namedGridLine(), CSSPri mitiveValue::CSS_CUSTOM_IDENT));
642 return list;
643 }
644
645 static LayoutRect sizingBox(const LayoutObject* renderer)
646 {
647 if (!renderer->isBox())
648 return LayoutRect();
649
650 const LayoutBox* box = toLayoutBox(renderer);
651 return box->style()->boxSizing() == BORDER_BOX ? box->borderBoxRect() : box- >computedCSSContentBoxRect();
652 }
653
654 static PassRefPtrWillBeRawPtr<CSSValue> scrollBlocksOnFlagsToCSSValue(WebScrollB locksOn scrollBlocksOn)
655 {
656 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
657
658 if (scrollBlocksOn == WebScrollBlocksOnNone)
659 return cssValuePool().createIdentifierValue(CSSValueNone);
660
661 if (scrollBlocksOn & WebScrollBlocksOnStartTouch)
662 list->append(cssValuePool().createIdentifierValue(CSSValueStartTouch));
663 if (scrollBlocksOn & WebScrollBlocksOnWheelEvent)
664 list->append(cssValuePool().createIdentifierValue(CSSValueWheelEvent));
665 if (scrollBlocksOn & WebScrollBlocksOnScrollEvent)
666 list->append(cssValuePool().createIdentifierValue(CSSValueScrollEvent));
667 ASSERT(list->length());
668 return list.release();
669 }
670
671 static PassRefPtrWillBeRawPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecoration)
672 {
673 // Blink value is ignored.
674 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
675 if (textDecoration & TextDecorationUnderline)
676 list->append(cssValuePool().createIdentifierValue(CSSValueUnderline));
677 if (textDecoration & TextDecorationOverline)
678 list->append(cssValuePool().createIdentifierValue(CSSValueOverline));
679 if (textDecoration & TextDecorationLineThrough)
680 list->append(cssValuePool().createIdentifierValue(CSSValueLineThrough));
681
682 if (!list->length())
683 return cssValuePool().createIdentifierValue(CSSValueNone);
684 return list.release();
685 }
686
687 static PassRefPtrWillBeRawPtr<CSSValue> valueForTextDecorationStyle(TextDecorati onStyle textDecorationStyle)
688 {
689 switch (textDecorationStyle) {
690 case TextDecorationStyleSolid:
691 return cssValuePool().createIdentifierValue(CSSValueSolid);
692 case TextDecorationStyleDouble:
693 return cssValuePool().createIdentifierValue(CSSValueDouble);
694 case TextDecorationStyleDotted:
695 return cssValuePool().createIdentifierValue(CSSValueDotted);
696 case TextDecorationStyleDashed:
697 return cssValuePool().createIdentifierValue(CSSValueDashed);
698 case TextDecorationStyleWavy:
699 return cssValuePool().createIdentifierValue(CSSValueWavy);
700 }
701
702 ASSERT_NOT_REACHED();
703 return cssValuePool().createExplicitInitialValue();
704 }
705
706 static PassRefPtrWillBeRawPtr<CSSValue> touchActionFlagsToCSSValue(TouchAction t ouchAction)
707 {
708 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
709 if (touchAction == TouchActionAuto)
710 list->append(cssValuePool().createIdentifierValue(CSSValueAuto));
711 if (touchAction & TouchActionNone) {
712 ASSERT(touchAction == TouchActionNone);
713 list->append(cssValuePool().createIdentifierValue(CSSValueNone));
714 }
715 if (touchAction == (TouchActionPanX | TouchActionPanY | TouchActionPinchZoom )) {
716 list->append(cssValuePool().createIdentifierValue(CSSValueManipulation)) ;
717 } else {
718 if (touchAction & TouchActionPanX)
719 list->append(cssValuePool().createIdentifierValue(CSSValuePanX));
720 if (touchAction & TouchActionPanY)
721 list->append(cssValuePool().createIdentifierValue(CSSValuePanY));
722 }
723 ASSERT(list->length());
724 return list.release();
725 }
726
727 static PassRefPtrWillBeRawPtr<CSSValue> valueForWillChange(const Vector<CSSPrope rtyID>& willChangeProperties, bool willChangeContents, bool willChangeScrollPosi tion)
728 {
729 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ;
730 if (willChangeContents)
731 list->append(cssValuePool().createIdentifierValue(CSSValueContents));
732 if (willChangeScrollPosition)
733 list->append(cssValuePool().createIdentifierValue(CSSValueScrollPosition ));
734 for (size_t i = 0; i < willChangeProperties.size(); ++i)
735 list->append(cssValuePool().createIdentifierValue(willChangeProperties[i ]));
736 if (!list->length())
737 list->append(cssValuePool().createIdentifierValue(CSSValueAuto));
738 return list.release();
739 }
740
741 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationDelay(const CSSTimingDa ta* timingData)
742 {
743 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ;
744 if (timingData) {
745 for (size_t i = 0; i < timingData->delayList().size(); ++i)
746 list->append(cssValuePool().createValue(timingData->delayList()[i], CSSPrimitiveValue::CSS_S));
747 } else {
748 list->append(cssValuePool().createValue(CSSTimingData::initialDelay(), C SSPrimitiveValue::CSS_S));
749 }
750 return list.release();
751 }
752
753 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationDirection(Timing::Playb ackDirection direction)
754 {
755 switch (direction) {
756 case Timing::PlaybackDirectionNormal:
757 return cssValuePool().createIdentifierValue(CSSValueNormal);
758 case Timing::PlaybackDirectionAlternate:
759 return cssValuePool().createIdentifierValue(CSSValueAlternate);
760 case Timing::PlaybackDirectionReverse:
761 return cssValuePool().createIdentifierValue(CSSValueReverse);
762 case Timing::PlaybackDirectionAlternateReverse:
763 return cssValuePool().createIdentifierValue(CSSValueAlternateReverse);
764 default:
765 ASSERT_NOT_REACHED();
766 return nullptr;
767 }
768 }
769
770 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationDuration(const CSSTimin gData* timingData)
771 {
772 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ;
773 if (timingData) {
774 for (size_t i = 0; i < timingData->durationList().size(); ++i)
775 list->append(cssValuePool().createValue(timingData->durationList()[i ], CSSPrimitiveValue::CSS_S));
776 } else {
777 list->append(cssValuePool().createValue(CSSTimingData::initialDuration() , CSSPrimitiveValue::CSS_S));
778 }
779 return list.release();
780 }
781
782 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationFillMode(Timing::FillMo de fillMode)
783 {
784 switch (fillMode) {
785 case Timing::FillModeNone:
786 return cssValuePool().createIdentifierValue(CSSValueNone);
787 case Timing::FillModeForwards:
788 return cssValuePool().createIdentifierValue(CSSValueForwards);
789 case Timing::FillModeBackwards:
790 return cssValuePool().createIdentifierValue(CSSValueBackwards);
791 case Timing::FillModeBoth:
792 return cssValuePool().createIdentifierValue(CSSValueBoth);
793 default:
794 ASSERT_NOT_REACHED();
795 return nullptr;
796 }
797 }
798
799 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationIterationCount(double i terationCount)
800 {
801 if (iterationCount == std::numeric_limits<double>::infinity())
802 return cssValuePool().createIdentifierValue(CSSValueInfinite);
803 return cssValuePool().createValue(iterationCount, CSSPrimitiveValue::CSS_NUM BER);
804 }
805
806 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationPlayState(EAnimPlayStat e playState)
807 {
808 if (playState == AnimPlayStatePlaying)
809 return cssValuePool().createIdentifierValue(CSSValueRunning);
810 ASSERT(playState == AnimPlayStatePaused);
811 return cssValuePool().createIdentifierValue(CSSValuePaused);
812 }
813
814 static PassRefPtrWillBeRawPtr<CSSValue> createTimingFunctionValue(const TimingFu nction* timingFunction)
815 {
816 switch (timingFunction->type()) {
817 case TimingFunction::CubicBezierFunction:
818 {
819 const CubicBezierTimingFunction* bezierTimingFunction = toCubicBezie rTimingFunction(timingFunction);
820 if (bezierTimingFunction->subType() != CubicBezierTimingFunction::Cu stom) {
821 CSSValueID valueId = CSSValueInvalid;
822 switch (bezierTimingFunction->subType()) {
823 case CubicBezierTimingFunction::Ease:
824 valueId = CSSValueEase;
825 break;
826 case CubicBezierTimingFunction::EaseIn:
827 valueId = CSSValueEaseIn;
828 break;
829 case CubicBezierTimingFunction::EaseOut:
830 valueId = CSSValueEaseOut;
831 break;
832 case CubicBezierTimingFunction::EaseInOut:
833 valueId = CSSValueEaseInOut;
834 break;
835 default:
836 ASSERT_NOT_REACHED();
837 return nullptr;
838 }
839 return cssValuePool().createIdentifierValue(valueId);
840 }
841 return CSSCubicBezierTimingFunctionValue::create(bezierTimingFunctio n->x1(), bezierTimingFunction->y1(), bezierTimingFunction->x2(), bezierTimingFun ction->y2());
842 }
843
844 case TimingFunction::StepsFunction:
845 {
846 const StepsTimingFunction* stepsTimingFunction = toStepsTimingFuncti on(timingFunction);
847 StepsTimingFunction::StepAtPosition position = stepsTimingFunction-> stepAtPosition();
848 int steps = stepsTimingFunction->numberOfSteps();
849 ASSERT(position == StepsTimingFunction::Start || position == StepsTi mingFunction::End);
850
851 if (steps > 1)
852 return CSSStepsTimingFunctionValue::create(steps, position);
853 CSSValueID valueId = position == StepsTimingFunction::Start ? CSSVal ueStepStart : CSSValueStepEnd;
854 return cssValuePool().createIdentifierValue(valueId);
855 }
856
857 default:
858 return cssValuePool().createIdentifierValue(CSSValueLinear);
859 }
860 }
861
862 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationTimingFunction(const CS STimingData* timingData)
863 {
864 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ;
865 if (timingData) {
866 for (size_t i = 0; i < timingData->timingFunctionList().size(); ++i)
867 list->append(createTimingFunctionValue(timingData->timingFunctionLis t()[i].get()));
868 } else {
869 list->append(createTimingFunctionValue(CSSTimingData::initialTimingFunct ion().get()));
870 }
871 return list.release();
872 }
873
874 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForBorderRadiusCorner(LengthSi ze radius, const LayoutStyle& style)
875 {
876 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
877 if (radius.width().type() == Percent)
878 list->append(cssValuePool().createValue(radius.width().percent(), CSSPri mitiveValue::CSS_PERCENTAGE));
879 else
880 list->append(zoomAdjustedPixelValueForLength(radius.width(), style));
881 if (radius.height().type() == Percent)
882 list->append(cssValuePool().createValue(radius.height().percent(), CSSPr imitiveValue::CSS_PERCENTAGE));
883 else
884 list->append(zoomAdjustedPixelValueForLength(radius.height(), style));
885 return list.release();
886 }
887
888 static PassRefPtrWillBeRawPtr<CSSValue> valueForBorderRadiusCorner(LengthSize ra dius, const LayoutStyle& style)
889 {
890 RefPtrWillBeRawPtr<CSSValueList> list = valuesForBorderRadiusCorner(radius, style);
891 if (list->item(0)->equals(*list->item(1)))
892 return list->item(0);
893 return list.release();
894 }
895
896 static PassRefPtrWillBeRawPtr<CSSFunctionValue> valueForMatrixTransform(const Tr ansformationMatrix& transform, const LayoutStyle& style)
897 {
898 RefPtrWillBeRawPtr<CSSFunctionValue> transformValue = nullptr;
899 if (transform.isAffine()) {
900 transformValue = CSSFunctionValue::create(CSSValueMatrix);
901
902 transformValue->append(cssValuePool().createValue(transform.a(), CSSPrim itiveValue::CSS_NUMBER));
903 transformValue->append(cssValuePool().createValue(transform.b(), CSSPrim itiveValue::CSS_NUMBER));
904 transformValue->append(cssValuePool().createValue(transform.c(), CSSPrim itiveValue::CSS_NUMBER));
905 transformValue->append(cssValuePool().createValue(transform.d(), CSSPrim itiveValue::CSS_NUMBER));
906 transformValue->append(zoomAdjustedNumberValue(transform.e(), style));
907 transformValue->append(zoomAdjustedNumberValue(transform.f(), style));
908 } else {
909 transformValue = CSSFunctionValue::create(CSSValueMatrix3d);
910
911 transformValue->append(cssValuePool().createValue(transform.m11(), CSSPr imitiveValue::CSS_NUMBER));
912 transformValue->append(cssValuePool().createValue(transform.m12(), CSSPr imitiveValue::CSS_NUMBER));
913 transformValue->append(cssValuePool().createValue(transform.m13(), CSSPr imitiveValue::CSS_NUMBER));
914 transformValue->append(cssValuePool().createValue(transform.m14(), CSSPr imitiveValue::CSS_NUMBER));
915
916 transformValue->append(cssValuePool().createValue(transform.m21(), CSSPr imitiveValue::CSS_NUMBER));
917 transformValue->append(cssValuePool().createValue(transform.m22(), CSSPr imitiveValue::CSS_NUMBER));
918 transformValue->append(cssValuePool().createValue(transform.m23(), CSSPr imitiveValue::CSS_NUMBER));
919 transformValue->append(cssValuePool().createValue(transform.m24(), CSSPr imitiveValue::CSS_NUMBER));
920
921 transformValue->append(cssValuePool().createValue(transform.m31(), CSSPr imitiveValue::CSS_NUMBER));
922 transformValue->append(cssValuePool().createValue(transform.m32(), CSSPr imitiveValue::CSS_NUMBER));
923 transformValue->append(cssValuePool().createValue(transform.m33(), CSSPr imitiveValue::CSS_NUMBER));
924 transformValue->append(cssValuePool().createValue(transform.m34(), CSSPr imitiveValue::CSS_NUMBER));
925
926 transformValue->append(zoomAdjustedNumberValue(transform.m41(), style));
927 transformValue->append(zoomAdjustedNumberValue(transform.m42(), style));
928 transformValue->append(zoomAdjustedNumberValue(transform.m43(), style));
929 transformValue->append(cssValuePool().createValue(transform.m44(), CSSPr imitiveValue::CSS_NUMBER));
930 }
931
932 return transformValue.release();
933 }
934
935 static PassRefPtrWillBeRawPtr<CSSValue> computedTransform(const LayoutObject* re nderer, const LayoutStyle& style)
936 {
937 if (!renderer || !renderer->hasTransformRelatedProperty() || !style.hasTrans form())
938 return cssValuePool().createIdentifierValue(CSSValueNone);
939
940 IntRect box;
941 if (renderer->isBox())
942 box = pixelSnappedIntRect(toLayoutBox(renderer)->borderBoxRect());
943
944 TransformationMatrix transform;
945 style.applyTransform(transform, LayoutSize(box.size()), LayoutStyle::Exclude TransformOrigin, LayoutStyle::ExcludeMotionPath);
946
947 // FIXME: Need to print out individual functions (https://bugs.webkit.org/sh ow_bug.cgi?id=23924)
948 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
949 list->append(valueForMatrixTransform(transform, style));
950
951 return list.release();
952 }
953
954 static PassRefPtrWillBeRawPtr<CSSValue> createTransitionPropertyValue(const CSST ransitionData::TransitionProperty& property)
955 {
956 if (property.propertyType == CSSTransitionData::TransitionNone)
957 return cssValuePool().createIdentifierValue(CSSValueNone);
958 if (property.propertyType == CSSTransitionData::TransitionAll)
959 return cssValuePool().createIdentifierValue(CSSValueAll);
960 if (property.propertyType == CSSTransitionData::TransitionUnknown)
961 return cssValuePool().createValue(property.propertyString, CSSPrimitiveV alue::CSS_CUSTOM_IDENT);
962 ASSERT(property.propertyType == CSSTransitionData::TransitionSingleProperty) ;
963 return cssValuePool().createValue(getPropertyNameString(property.propertyId) , CSSPrimitiveValue::CSS_CUSTOM_IDENT);
964 }
965
966 static PassRefPtrWillBeRawPtr<CSSValue> valueForTransitionProperty(const CSSTran sitionData* transitionData)
967 {
968 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ;
969 if (transitionData) {
970 for (size_t i = 0; i < transitionData->propertyList().size(); ++i)
971 list->append(createTransitionPropertyValue(transitionData->propertyL ist()[i]));
972 } else {
973 list->append(cssValuePool().createIdentifierValue(CSSValueAll));
974 }
975 return list.release();
976 }
977
978 static PassRefPtrWillBeRawPtr<CSSValue> createLineBoxContainValue(unsigned lineB oxContain)
979 {
980 if (!lineBoxContain)
981 return cssValuePool().createIdentifierValue(CSSValueNone);
982 return CSSLineBoxContainValue::create(lineBoxContain);
983 }
984
985 static PassRefPtrWillBeRawPtr<CSSValue> valueForContentData(const LayoutStyle& s tyle)
986 {
987 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
988 for (const ContentData* contentData = style.contentData(); contentData; cont entData = contentData->next()) {
989 if (contentData->isCounter()) {
990 const CounterContent* counter = toCounterContentData(contentData)->c ounter();
991 ASSERT(counter);
992 list->append(cssValuePool().createValue(counter->identifier(), CSSPr imitiveValue::CSS_COUNTER_NAME));
993 } else if (contentData->isImage()) {
994 const StyleImage* image = toImageContentData(contentData)->image();
995 ASSERT(image);
996 list->append(image->cssValue());
997 } else if (contentData->isText()) {
998 list->append(cssValuePool().createValue(toTextContentData(contentDat a)->text(), CSSPrimitiveValue::CSS_STRING));
999 }
1000 }
1001 return list.release();
1002 }
1003
1004 static PassRefPtrWillBeRawPtr<CSSValue> valueForCounterDirectives(const LayoutSt yle& style, CSSPropertyID propertyID)
1005 {
1006 const CounterDirectiveMap* map = style.counterDirectives();
1007 if (!map)
1008 return cssValuePool().createIdentifierValue(CSSValueNone);
1009
1010 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
1011 for (const auto& item : *map) {
1012 bool isValidCounterValue = propertyID == CSSPropertyCounterIncrement ? i tem.value.isIncrement() : item.value.isReset();
1013 if (!isValidCounterValue)
1014 continue;
1015
1016 list->append(cssValuePool().createValue(item.key, CSSPrimitiveValue::CSS _CUSTOM_IDENT));
1017 short number = propertyID == CSSPropertyCounterIncrement ? item.value.in crementValue() : item.value.resetValue();
1018 list->append(cssValuePool().createValue((double)number, CSSPrimitiveValu e::CSS_NUMBER));
1019 }
1020
1021 if (!list->length())
1022 return cssValuePool().createIdentifierValue(CSSValueNone);
1023
1024 return list.release();
1025 }
1026
1027 static PassRefPtrWillBeRawPtr<CSSValue> valueForShape(const LayoutStyle& style, ShapeValue* shapeValue)
1028 {
1029 if (!shapeValue)
1030 return cssValuePool().createIdentifierValue(CSSValueNone);
1031 if (shapeValue->type() == ShapeValue::Box)
1032 return cssValuePool().createValue(shapeValue->cssBox());
1033 if (shapeValue->type() == ShapeValue::Image) {
1034 if (shapeValue->image())
1035 return shapeValue->image()->cssValue();
1036 return cssValuePool().createIdentifierValue(CSSValueNone);
1037 }
1038
1039 ASSERT(shapeValue->type() == ShapeValue::Shape);
1040
1041 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
1042 list->append(valueForBasicShape(style, shapeValue->shape()));
1043 if (shapeValue->cssBox() != BoxMissing)
1044 list->append(cssValuePool().createValue(shapeValue->cssBox()));
1045 return list.release();
1046 }
1047
1048 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForSidesShorthand(const StyleP ropertyShorthand& shorthand, const LayoutStyle& style, const LayoutObject* rende rer, Node* styledNode, bool allowVisitedStyle)
1049 {
1050 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
1051 // Assume the properties are in the usual order top, right, bottom, left.
1052 RefPtrWillBeRawPtr<CSSValue> topValue = LayoutStyleCSSValueMapping::get(shor thand.properties()[0], style, renderer, styledNode, allowVisitedStyle);
1053 RefPtrWillBeRawPtr<CSSValue> rightValue = LayoutStyleCSSValueMapping::get(sh orthand.properties()[1], style, renderer, styledNode, allowVisitedStyle);
1054 RefPtrWillBeRawPtr<CSSValue> bottomValue = LayoutStyleCSSValueMapping::get(s horthand.properties()[2], style, renderer, styledNode, allowVisitedStyle);
1055 RefPtrWillBeRawPtr<CSSValue> leftValue = LayoutStyleCSSValueMapping::get(sho rthand.properties()[3], style, renderer, styledNode, allowVisitedStyle);
1056
1057 // All 4 properties must be specified.
1058 if (!topValue || !rightValue || !bottomValue || !leftValue)
1059 return nullptr;
1060
1061 bool showLeft = !compareCSSValuePtr(rightValue, leftValue);
1062 bool showBottom = !compareCSSValuePtr(topValue, bottomValue) || showLeft;
1063 bool showRight = !compareCSSValuePtr(topValue, rightValue) || showBottom;
1064
1065 list->append(topValue.release());
1066 if (showRight)
1067 list->append(rightValue.release());
1068 if (showBottom)
1069 list->append(bottomValue.release());
1070 if (showLeft)
1071 list->append(leftValue.release());
1072
1073 return list.release();
1074 }
1075
1076 static PassRefPtrWillBeRawPtr<CSSValueList> valueForBorderRadiusShorthand(const LayoutStyle& style)
1077 {
1078 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated() ;
1079
1080 bool showHorizontalBottomLeft = style.borderTopRightRadius().width() != styl e.borderBottomLeftRadius().width();
1081 bool showHorizontalBottomRight = showHorizontalBottomLeft || (style.borderBo ttomRightRadius().width() != style.borderTopLeftRadius().width());
1082 bool showHorizontalTopRight = showHorizontalBottomRight || (style.borderTopR ightRadius().width() != style.borderTopLeftRadius().width());
1083
1084 bool showVerticalBottomLeft = style.borderTopRightRadius().height() != style .borderBottomLeftRadius().height();
1085 bool showVerticalBottomRight = showVerticalBottomLeft || (style.borderBottom RightRadius().height() != style.borderTopLeftRadius().height());
1086 bool showVerticalTopRight = showVerticalBottomRight || (style.borderTopRight Radius().height() != style.borderTopLeftRadius().height());
1087
1088 RefPtrWillBeRawPtr<CSSValueList> topLeftRadius = valuesForBorderRadiusCorner (style.borderTopLeftRadius(), style);
1089 RefPtrWillBeRawPtr<CSSValueList> topRightRadius = valuesForBorderRadiusCorne r(style.borderTopRightRadius(), style);
1090 RefPtrWillBeRawPtr<CSSValueList> bottomRightRadius = valuesForBorderRadiusCo rner(style.borderBottomRightRadius(), style);
1091 RefPtrWillBeRawPtr<CSSValueList> bottomLeftRadius = valuesForBorderRadiusCor ner(style.borderBottomLeftRadius(), style);
1092
1093 RefPtrWillBeRawPtr<CSSValueList> horizontalRadii = CSSValueList::createSpace Separated();
1094 horizontalRadii->append(topLeftRadius->item(0));
1095 if (showHorizontalTopRight)
1096 horizontalRadii->append(topRightRadius->item(0));
1097 if (showHorizontalBottomRight)
1098 horizontalRadii->append(bottomRightRadius->item(0));
1099 if (showHorizontalBottomLeft)
1100 horizontalRadii->append(bottomLeftRadius->item(0));
1101
1102 list->append(horizontalRadii.release());
1103
1104 RefPtrWillBeRawPtr<CSSValueList> verticalRadii = CSSValueList::createSpaceSe parated();
1105 verticalRadii->append(topLeftRadius->item(1));
1106 if (showVerticalTopRight)
1107 verticalRadii->append(topRightRadius->item(1));
1108 if (showVerticalBottomRight)
1109 verticalRadii->append(bottomRightRadius->item(1));
1110 if (showVerticalBottomLeft)
1111 verticalRadii->append(bottomLeftRadius->item(1));
1112
1113 if (!verticalRadii->equals(*toCSSValueList(list->item(0))))
1114 list->append(verticalRadii.release());
1115
1116 return list.release();
1117 }
1118
1119 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> glyphOrientationToCSSPrimitiveV alue(EGlyphOrientation orientation)
1120 {
1121 switch (orientation) {
1122 case GO_0DEG:
1123 return CSSPrimitiveValue::create(0.0f, CSSPrimitiveValue::CSS_DEG);
1124 case GO_90DEG:
1125 return CSSPrimitiveValue::create(90.0f, CSSPrimitiveValue::CSS_DEG);
1126 case GO_180DEG:
1127 return CSSPrimitiveValue::create(180.0f, CSSPrimitiveValue::CSS_DEG);
1128 case GO_270DEG:
1129 return CSSPrimitiveValue::create(270.0f, CSSPrimitiveValue::CSS_DEG);
1130 default:
1131 return nullptr;
1132 }
1133 }
1134
1135 static PassRefPtrWillBeRawPtr<CSSValue> strokeDashArrayToCSSValueList(const SVGD ashArray& dashes, const LayoutStyle& style)
1136 {
1137 if (dashes.isEmpty())
1138 return CSSPrimitiveValue::createIdentifier(CSSValueNone);
1139
1140 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ;
1141 for (const Length& dashLength : dashes.vector())
1142 list->append(zoomAdjustedPixelValueForLength(dashLength, style));
1143
1144 return list.release();
1145 }
1146
1147 static PassRefPtrWillBeRawPtr<CSSValue> paintOrderToCSSValueList(EPaintOrder pai ntorder)
1148 {
1149 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
1150 do {
1151 EPaintOrderType paintOrderType = (EPaintOrderType)(paintorder & ((1 << k PaintOrderBitwidth) - 1));
1152 switch (paintOrderType) {
1153 case PT_FILL:
1154 case PT_STROKE:
1155 case PT_MARKERS:
1156 list->append(CSSPrimitiveValue::create(paintOrderType));
1157 break;
1158 case PT_NONE:
1159 default:
1160 ASSERT_NOT_REACHED();
1161 break;
1162 }
1163 } while (paintorder >>= kPaintOrderBitwidth);
1164
1165 return list.release();
1166 }
1167
1168 static PassRefPtrWillBeRawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintTy pe paintType, const String& url, const Color& color, const Color& currentColor)
1169 {
1170 if (paintType >= SVG_PAINTTYPE_URI_NONE) {
1171 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSepar ated();
1172 values->append(CSSPrimitiveValue::create(url, CSSPrimitiveValue::CSS_URI ));
1173 if (paintType == SVG_PAINTTYPE_URI_NONE)
1174 values->append(CSSPrimitiveValue::create(CSSValueNone));
1175 else if (paintType == SVG_PAINTTYPE_URI_CURRENTCOLOR)
1176 values->append(CSSPrimitiveValue::createColor(currentColor.rgb()));
1177 else if (paintType == SVG_PAINTTYPE_URI_RGBCOLOR)
1178 values->append(CSSPrimitiveValue::createColor(color.rgb()));
1179 return values.release();
1180 }
1181 if (paintType == SVG_PAINTTYPE_NONE)
1182 return CSSPrimitiveValue::create(CSSValueNone);
1183 if (paintType == SVG_PAINTTYPE_CURRENTCOLOR)
1184 return CSSPrimitiveValue::createColor(currentColor.rgb());
1185
1186 return CSSPrimitiveValue::createColor(color.rgb());
1187 }
1188
1189 static inline String serializeAsFragmentIdentifier(const AtomicString& resource)
1190 {
1191 return "#" + resource;
1192 }
1193
1194 PassRefPtrWillBeRawPtr<CSSValue> LayoutStyleCSSValueMapping::valueForShadowData( const ShadowData& shadow, const LayoutStyle& style, bool useSpread)
1195 {
1196 RefPtrWillBeRawPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(shadow.x(), style);
1197 RefPtrWillBeRawPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(shadow.y(), style);
1198 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(shadow.b lur(), style);
1199 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = useSpread ? zoomAdjustedPixel Value(shadow.spread(), style) : PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullpt r);
1200 RefPtrWillBeRawPtr<CSSPrimitiveValue> shadowStyle = shadow.style() == Normal ? PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullptr) : cssValuePool().createIde ntifierValue(CSSValueInset);
1201 RefPtrWillBeRawPtr<CSSPrimitiveValue> color = currentColorOrValidColor(style , shadow.color());
1202 return CSSShadowValue::create(x.release(), y.release(), blur.release(), spre ad.release(), shadowStyle.release(), color.release());
1203 }
1204
1205 PassRefPtrWillBeRawPtr<CSSValue> LayoutStyleCSSValueMapping::valueForShadowList( const ShadowList* shadowList, const LayoutStyle& style, bool useSpread)
1206 {
1207 if (!shadowList)
1208 return cssValuePool().createIdentifierValue(CSSValueNone);
1209
1210 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ;
1211 size_t shadowCount = shadowList->shadows().size();
1212 for (size_t i = 0; i < shadowCount; ++i)
1213 list->append(valueForShadowData(shadowList->shadows()[i], style, useSpre ad));
1214 return list.release();
1215 }
1216
1217 PassRefPtrWillBeRawPtr<CSSValue> LayoutStyleCSSValueMapping::valueForFilter(cons t LayoutStyle& style)
1218 {
1219 if (style.filter().operations().isEmpty())
1220 return cssValuePool().createIdentifierValue(CSSValueNone);
1221
1222 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
1223
1224 RefPtrWillBeRawPtr<CSSFunctionValue> filterValue = nullptr;
1225
1226 for (const auto& operation : style.filter().operations()) {
1227 FilterOperation* filterOperation = operation.get();
1228 switch (filterOperation->type()) {
1229 case FilterOperation::REFERENCE:
1230 filterValue = CSSFunctionValue::create(CSSValueUrl);
1231 filterValue->append(cssValuePool().createValue(toReferenceFilterOper ation(filterOperation)->url(), CSSPrimitiveValue::CSS_CUSTOM_IDENT));
1232 break;
1233 case FilterOperation::GRAYSCALE:
1234 filterValue = CSSFunctionValue::create(CSSValueGrayscale);
1235 filterValue->append(cssValuePool().createValue(toBasicColorMatrixFil terOperation(filterOperation)->amount(), CSSPrimitiveValue::CSS_NUMBER));
1236 break;
1237 case FilterOperation::SEPIA:
1238 filterValue = CSSFunctionValue::create(CSSValueSepia);
1239 filterValue->append(cssValuePool().createValue(toBasicColorMatrixFil terOperation(filterOperation)->amount(), CSSPrimitiveValue::CSS_NUMBER));
1240 break;
1241 case FilterOperation::SATURATE:
1242 filterValue = CSSFunctionValue::create(CSSValueSaturate);
1243 filterValue->append(cssValuePool().createValue(toBasicColorMatrixFil terOperation(filterOperation)->amount(), CSSPrimitiveValue::CSS_NUMBER));
1244 break;
1245 case FilterOperation::HUE_ROTATE:
1246 filterValue = CSSFunctionValue::create(CSSValueHueRotate);
1247 filterValue->append(cssValuePool().createValue(toBasicColorMatrixFil terOperation(filterOperation)->amount(), CSSPrimitiveValue::CSS_DEG));
1248 break;
1249 case FilterOperation::INVERT:
1250 filterValue = CSSFunctionValue::create(CSSValueInvert);
1251 filterValue->append(cssValuePool().createValue(toBasicComponentTrans ferFilterOperation(filterOperation)->amount(), CSSPrimitiveValue::CSS_NUMBER));
1252 break;
1253 case FilterOperation::OPACITY:
1254 filterValue = CSSFunctionValue::create(CSSValueOpacity);
1255 filterValue->append(cssValuePool().createValue(toBasicComponentTrans ferFilterOperation(filterOperation)->amount(), CSSPrimitiveValue::CSS_NUMBER));
1256 break;
1257 case FilterOperation::BRIGHTNESS:
1258 filterValue = CSSFunctionValue::create(CSSValueBrightness);
1259 filterValue->append(cssValuePool().createValue(toBasicComponentTrans ferFilterOperation(filterOperation)->amount(), CSSPrimitiveValue::CSS_NUMBER));
1260 break;
1261 case FilterOperation::CONTRAST:
1262 filterValue = CSSFunctionValue::create(CSSValueContrast);
1263 filterValue->append(cssValuePool().createValue(toBasicComponentTrans ferFilterOperation(filterOperation)->amount(), CSSPrimitiveValue::CSS_NUMBER));
1264 break;
1265 case FilterOperation::BLUR:
1266 filterValue = CSSFunctionValue::create(CSSValueBlur);
1267 filterValue->append(zoomAdjustedPixelValue(toBlurFilterOperation(fil terOperation)->stdDeviation().value(), style));
1268 break;
1269 case FilterOperation::DROP_SHADOW: {
1270 DropShadowFilterOperation* dropShadowOperation = toDropShadowFilterO peration(filterOperation);
1271 filterValue = CSSFunctionValue::create(CSSValueDropShadow);
1272 // We want our computed style to look like that of a text shadow (ha s neither spread nor inset style).
1273 ShadowData shadow(dropShadowOperation->location(), dropShadowOperati on->stdDeviation(), 0, Normal, dropShadowOperation->color());
1274 filterValue->append(valueForShadowData(shadow, style, false));
1275 break;
1276 }
1277 default:
1278 ASSERT_NOT_REACHED();
1279 break;
1280 }
1281 list->append(filterValue.release());
1282 }
1283
1284 return list.release();
1285 }
1286
1287 PassRefPtrWillBeRawPtr<CSSValue> LayoutStyleCSSValueMapping::get(CSSPropertyID p ropertyID, const LayoutStyle& style, const LayoutObject* renderer, Node* styledN ode, bool allowVisitedStyle)
1288 {
1289 const SVGLayoutStyle& svgStyle = style.svgStyle();
1290 propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style.di rection(), style.writingMode());
1291 switch (propertyID) {
1292 case CSSPropertyInvalid:
1293 return nullptr;
1294
1295 case CSSPropertyBackgroundColor:
1296 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited DependentColor(CSSPropertyBackgroundColor).rgb()) : currentColorOrValidColor(sty le, style.backgroundColor());
1297 case CSSPropertyBackgroundImage:
1298 case CSSPropertyWebkitMaskImage: {
1299 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed();
1300 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskImage ? &style.maskLayers() : &style.backgroundLayers();
1301 for (; currLayer; currLayer = currLayer->next()) {
1302 if (currLayer->image())
1303 list->append(currLayer->image()->cssValue());
1304 else
1305 list->append(cssValuePool().createIdentifierValue(CSSValueNone)) ;
1306 }
1307 return list.release();
1308 }
1309 case CSSPropertyBackgroundSize:
1310 case CSSPropertyWebkitBackgroundSize:
1311 case CSSPropertyWebkitMaskSize: {
1312 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed();
1313 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskSize ? & style.maskLayers() : &style.backgroundLayers();
1314 for (; currLayer; currLayer = currLayer->next())
1315 list->append(valueForFillSize(currLayer->size(), style));
1316 return list.release();
1317 }
1318 case CSSPropertyBackgroundRepeat:
1319 case CSSPropertyWebkitMaskRepeat: {
1320 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed();
1321 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskRepeat ? &style.maskLayers() : &style.backgroundLayers();
1322 for (; currLayer; currLayer = currLayer->next())
1323 list->append(valueForFillRepeat(currLayer->repeatX(), currLayer->rep eatY()));
1324 return list.release();
1325 }
1326 case CSSPropertyMaskSourceType: {
1327 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed();
1328 for (const FillLayer* currLayer = &style.maskLayers(); currLayer; currLa yer = currLayer->next())
1329 list->append(valueForFillSourceType(currLayer->maskSourceType()));
1330 return list.release();
1331 }
1332 case CSSPropertyWebkitBackgroundComposite:
1333 case CSSPropertyWebkitMaskComposite: {
1334 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed();
1335 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskComposit e ? &style.maskLayers() : &style.backgroundLayers();
1336 for (; currLayer; currLayer = currLayer->next())
1337 list->append(cssValuePool().createValue(currLayer->composite()));
1338 return list.release();
1339 }
1340 case CSSPropertyBackgroundAttachment: {
1341 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed();
1342 for (const FillLayer* currLayer = &style.backgroundLayers(); currLayer; currLayer = currLayer->next())
1343 list->append(cssValuePool().createValue(currLayer->attachment()));
1344 return list.release();
1345 }
1346 case CSSPropertyBackgroundClip:
1347 case CSSPropertyBackgroundOrigin:
1348 case CSSPropertyWebkitBackgroundClip:
1349 case CSSPropertyWebkitBackgroundOrigin:
1350 case CSSPropertyWebkitMaskClip:
1351 case CSSPropertyWebkitMaskOrigin: {
1352 bool isClip = propertyID == CSSPropertyBackgroundClip || propertyID == C SSPropertyWebkitBackgroundClip || propertyID == CSSPropertyWebkitMaskClip;
1353 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed();
1354 const FillLayer* currLayer = (propertyID == CSSPropertyWebkitMaskClip || propertyID == CSSPropertyWebkitMaskOrigin) ? &style.maskLayers() : &style.backg roundLayers();
1355 for (; currLayer; currLayer = currLayer->next()) {
1356 EFillBox box = isClip ? currLayer->clip() : currLayer->origin();
1357 list->append(cssValuePool().createValue(box));
1358 }
1359 return list.release();
1360 }
1361 case CSSPropertyBackgroundPosition:
1362 case CSSPropertyWebkitMaskPosition: {
1363 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed();
1364 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition ? &style.maskLayers() : &style.backgroundLayers();
1365 for (; currLayer; currLayer = currLayer->next())
1366 list->append(createPositionListForLayer(propertyID, *currLayer, styl e));
1367 return list.release();
1368 }
1369 case CSSPropertyBackgroundPositionX:
1370 case CSSPropertyWebkitMaskPositionX: {
1371 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed();
1372 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition X ? &style.maskLayers() : &style.backgroundLayers();
1373 for (; currLayer; currLayer = currLayer->next())
1374 list->append(zoomAdjustedPixelValueForLength(currLayer->xPosition(), style));
1375 return list.release();
1376 }
1377 case CSSPropertyBackgroundPositionY:
1378 case CSSPropertyWebkitMaskPositionY: {
1379 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed();
1380 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition Y ? &style.maskLayers() : &style.backgroundLayers();
1381 for (; currLayer; currLayer = currLayer->next())
1382 list->append(zoomAdjustedPixelValueForLength(currLayer->yPosition(), style));
1383 return list.release();
1384 }
1385 case CSSPropertyBorderCollapse:
1386 if (style.borderCollapse())
1387 return cssValuePool().createIdentifierValue(CSSValueCollapse);
1388 return cssValuePool().createIdentifierValue(CSSValueSeparate);
1389 case CSSPropertyBorderSpacing: {
1390 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed();
1391 list->append(zoomAdjustedPixelValue(style.horizontalBorderSpacing(), sty le));
1392 list->append(zoomAdjustedPixelValue(style.verticalBorderSpacing(), style ));
1393 return list.release();
1394 }
1395 case CSSPropertyWebkitBorderHorizontalSpacing:
1396 return zoomAdjustedPixelValue(style.horizontalBorderSpacing(), style);
1397 case CSSPropertyWebkitBorderVerticalSpacing:
1398 return zoomAdjustedPixelValue(style.verticalBorderSpacing(), style);
1399 case CSSPropertyBorderImageSource:
1400 if (style.borderImageSource())
1401 return style.borderImageSource()->cssValue();
1402 return cssValuePool().createIdentifierValue(CSSValueNone);
1403 case CSSPropertyBorderTopColor:
1404 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited DependentColor(CSSPropertyBorderTopColor).rgb()) : currentColorOrValidColor(styl e, style.borderTopColor());
1405 case CSSPropertyBorderRightColor:
1406 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited DependentColor(CSSPropertyBorderRightColor).rgb()) : currentColorOrValidColor(st yle, style.borderRightColor());
1407 case CSSPropertyBorderBottomColor:
1408 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited DependentColor(CSSPropertyBorderBottomColor).rgb()) : currentColorOrValidColor(s tyle, style.borderBottomColor());
1409 case CSSPropertyBorderLeftColor:
1410 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited DependentColor(CSSPropertyBorderLeftColor).rgb()) : currentColorOrValidColor(sty le, style.borderLeftColor());
1411 case CSSPropertyBorderTopStyle:
1412 return cssValuePool().createValue(style.borderTopStyle());
1413 case CSSPropertyBorderRightStyle:
1414 return cssValuePool().createValue(style.borderRightStyle());
1415 case CSSPropertyBorderBottomStyle:
1416 return cssValuePool().createValue(style.borderBottomStyle());
1417 case CSSPropertyBorderLeftStyle:
1418 return cssValuePool().createValue(style.borderLeftStyle());
1419 case CSSPropertyBorderTopWidth:
1420 return zoomAdjustedPixelValue(style.borderTopWidth(), style);
1421 case CSSPropertyBorderRightWidth:
1422 return zoomAdjustedPixelValue(style.borderRightWidth(), style);
1423 case CSSPropertyBorderBottomWidth:
1424 return zoomAdjustedPixelValue(style.borderBottomWidth(), style);
1425 case CSSPropertyBorderLeftWidth:
1426 return zoomAdjustedPixelValue(style.borderLeftWidth(), style);
1427 case CSSPropertyBottom:
1428 return valueForPositionOffset(style, CSSPropertyBottom, renderer);
1429 case CSSPropertyWebkitBoxAlign:
1430 return cssValuePool().createValue(style.boxAlign());
1431 case CSSPropertyWebkitBoxDecorationBreak:
1432 if (style.boxDecorationBreak() == DSLICE)
1433 return cssValuePool().createIdentifierValue(CSSValueSlice);
1434 return cssValuePool().createIdentifierValue(CSSValueClone);
1435 case CSSPropertyWebkitBoxDirection:
1436 return cssValuePool().createValue(style.boxDirection());
1437 case CSSPropertyWebkitBoxFlex:
1438 return cssValuePool().createValue(style.boxFlex(), CSSPrimitiveValue::CS S_NUMBER);
1439 case CSSPropertyWebkitBoxFlexGroup:
1440 return cssValuePool().createValue(style.boxFlexGroup(), CSSPrimitiveValu e::CSS_NUMBER);
1441 case CSSPropertyWebkitBoxLines:
1442 return cssValuePool().createValue(style.boxLines());
1443 case CSSPropertyWebkitBoxOrdinalGroup:
1444 return cssValuePool().createValue(style.boxOrdinalGroup(), CSSPrimitiveV alue::CSS_NUMBER);
1445 case CSSPropertyWebkitBoxOrient:
1446 return cssValuePool().createValue(style.boxOrient());
1447 case CSSPropertyWebkitBoxPack:
1448 return cssValuePool().createValue(style.boxPack());
1449 case CSSPropertyWebkitBoxReflect:
1450 return valueForReflection(style.boxReflect(), style);
1451 case CSSPropertyBoxShadow:
1452 case CSSPropertyWebkitBoxShadow:
1453 return valueForShadowList(style.boxShadow(), style, true);
1454 case CSSPropertyCaptionSide:
1455 return cssValuePool().createValue(style.captionSide());
1456 case CSSPropertyClear:
1457 return cssValuePool().createValue(style.clear());
1458 case CSSPropertyColor:
1459 return cssValuePool().createColorValue(allowVisitedStyle ? style.visited DependentColor(CSSPropertyColor).rgb() : style.color().rgb());
1460 case CSSPropertyWebkitPrintColorAdjust:
1461 return cssValuePool().createValue(style.printColorAdjust());
1462 case CSSPropertyWebkitColumnCount:
1463 if (style.hasAutoColumnCount())
1464 return cssValuePool().createIdentifierValue(CSSValueAuto);
1465 return cssValuePool().createValue(style.columnCount(), CSSPrimitiveValue ::CSS_NUMBER);
1466 case CSSPropertyColumnFill:
1467 ASSERT(RuntimeEnabledFeatures::regionBasedColumnsEnabled());
1468 return cssValuePool().createValue(style.columnFill());
1469 case CSSPropertyWebkitColumnGap:
1470 if (style.hasNormalColumnGap())
1471 return cssValuePool().createIdentifierValue(CSSValueNormal);
1472 return zoomAdjustedPixelValue(style.columnGap(), style);
1473 case CSSPropertyWebkitColumnRuleColor:
1474 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited DependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style, style.columnRuleColor());
1475 case CSSPropertyWebkitColumnRuleStyle:
1476 return cssValuePool().createValue(style.columnRuleStyle());
1477 case CSSPropertyWebkitColumnRuleWidth:
1478 return zoomAdjustedPixelValue(style.columnRuleWidth(), style);
1479 case CSSPropertyWebkitColumnSpan:
1480 return cssValuePool().createIdentifierValue(style.columnSpan() ? CSSValu eAll : CSSValueNone);
1481 case CSSPropertyWebkitColumnBreakAfter:
1482 return cssValuePool().createValue(style.columnBreakAfter());
1483 case CSSPropertyWebkitColumnBreakBefore:
1484 return cssValuePool().createValue(style.columnBreakBefore());
1485 case CSSPropertyWebkitColumnBreakInside:
1486 return cssValuePool().createValue(style.columnBreakInside());
1487 case CSSPropertyWebkitColumnWidth:
1488 if (style.hasAutoColumnWidth())
1489 return cssValuePool().createIdentifierValue(CSSValueAuto);
1490 return zoomAdjustedPixelValue(style.columnWidth(), style);
1491 case CSSPropertyTabSize:
1492 return cssValuePool().createValue(
1493 style.tabSize().getPixelSize(1.0), style.tabSize().isSpaces() ? CSSP rimitiveValue::CSS_NUMBER : CSSPrimitiveValue::CSS_PX);
1494 case CSSPropertyCursor: {
1495 RefPtrWillBeRawPtr<CSSValueList> list = nullptr;
1496 CursorList* cursors = style.cursors();
1497 if (cursors && cursors->size() > 0) {
1498 list = CSSValueList::createCommaSeparated();
1499 for (unsigned i = 0; i < cursors->size(); ++i) {
1500 if (StyleImage* image = cursors->at(i).image())
1501 list->append(image->cssValue());
1502 }
1503 }
1504 RefPtrWillBeRawPtr<CSSValue> value = cssValuePool().createValue(style.cu rsor());
1505 if (list) {
1506 list->append(value.release());
1507 return list.release();
1508 }
1509 return value.release();
1510 }
1511 case CSSPropertyDirection:
1512 return cssValuePool().createValue(style.direction());
1513 case CSSPropertyDisplay:
1514 return cssValuePool().createValue(style.display());
1515 case CSSPropertyEmptyCells:
1516 return cssValuePool().createValue(style.emptyCells());
1517 case CSSPropertyAlignContent:
1518 return valueForContentPositionAndDistributionWithOverflowAlignment(resol veContentAlignmentAuto(style.alignContent(), style.alignContentDistribution(), s tyledNode), style.alignContentOverflowAlignment(), style.alignContentDistributio n());
1519 case CSSPropertyAlignItems:
1520 return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(st yle.alignItems(), styledNode), style.alignItemsOverflowAlignment(), NonLegacyPos ition);
1521 case CSSPropertyAlignSelf:
1522 return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(st yle.alignSelf(), styledNode->parentNode()), style.alignSelfOverflowAlignment(), NonLegacyPosition);
1523 case CSSPropertyFlex:
1524 return valuesForShorthandProperty(flexShorthand(), style, renderer, styl edNode, allowVisitedStyle);
1525 case CSSPropertyFlexBasis:
1526 return zoomAdjustedPixelValueForLength(style.flexBasis(), style);
1527 case CSSPropertyFlexDirection:
1528 return cssValuePool().createValue(style.flexDirection());
1529 case CSSPropertyFlexFlow:
1530 return valuesForShorthandProperty(flexFlowShorthand(), style, renderer, styledNode, allowVisitedStyle);
1531 case CSSPropertyFlexGrow:
1532 return cssValuePool().createValue(style.flexGrow());
1533 case CSSPropertyFlexShrink:
1534 return cssValuePool().createValue(style.flexShrink());
1535 case CSSPropertyFlexWrap:
1536 return cssValuePool().createValue(style.flexWrap());
1537 case CSSPropertyJustifyContent:
1538 return valueForContentPositionAndDistributionWithOverflowAlignment(resol veContentAlignmentAuto(style.justifyContent(), style.justifyContentDistribution( ), styledNode), style.justifyContentOverflowAlignment(), style.justifyContentDis tribution());
1539 case CSSPropertyOrder:
1540 return cssValuePool().createValue(style.order(), CSSPrimitiveValue::CSS_ NUMBER);
1541 case CSSPropertyFloat:
1542 if (style.display() != NONE && style.hasOutOfFlowPosition())
1543 return cssValuePool().createIdentifierValue(CSSValueNone);
1544 return cssValuePool().createValue(style.floating());
1545 case CSSPropertyFont: {
1546 RefPtrWillBeRawPtr<CSSFontValue> computedFont = CSSFontValue::create();
1547 computedFont->style = valueForFontStyle(style);
1548 computedFont->variant = valueForFontVariant(style);
1549 computedFont->weight = valueForFontWeight(style);
1550 computedFont->stretch = valueForFontStretch(style);
1551 computedFont->size = valueForFontSize(style);
1552 computedFont->lineHeight = valueForLineHeight(style);
1553 computedFont->family = valueForFontFamily(style);
1554 return computedFont.release();
1555 }
1556 case CSSPropertyFontFamily:
1557 return valueForFontFamily(style);
1558 case CSSPropertyFontSize:
1559 return valueForFontSize(style);
1560 case CSSPropertyFontSizeAdjust:
1561 if (style.hasFontSizeAdjust())
1562 return cssValuePool().createValue(style.fontSizeAdjust(), CSSPrimiti veValue::CSS_NUMBER);
1563 return cssValuePool().createIdentifierValue(CSSValueNone);
1564 case CSSPropertyFontStretch:
1565 return valueForFontStretch(style);
1566 case CSSPropertyFontStyle:
1567 return valueForFontStyle(style);
1568 case CSSPropertyFontVariant:
1569 return valueForFontVariant(style);
1570 case CSSPropertyFontWeight:
1571 return valueForFontWeight(style);
1572 case CSSPropertyWebkitFontFeatureSettings: {
1573 const FontFeatureSettings* featureSettings = style.fontDescription().fea tureSettings();
1574 if (!featureSettings || !featureSettings->size())
1575 return cssValuePool().createIdentifierValue(CSSValueNormal);
1576 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed();
1577 for (unsigned i = 0; i < featureSettings->size(); ++i) {
1578 const FontFeature& feature = featureSettings->at(i);
1579 RefPtrWillBeRawPtr<CSSFontFeatureValue> featureValue = CSSFontFeatur eValue::create(feature.tag(), feature.value());
1580 list->append(featureValue.release());
1581 }
1582 return list.release();
1583 }
1584 case CSSPropertyGridAutoFlow: {
1585 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed();
1586 switch (style.gridAutoFlow()) {
1587 case AutoFlowRow:
1588 case AutoFlowRowDense:
1589 list->append(cssValuePool().createIdentifierValue(CSSValueRow));
1590 break;
1591 case AutoFlowColumn:
1592 case AutoFlowColumnDense:
1593 list->append(cssValuePool().createIdentifierValue(CSSValueColumn));
1594 break;
1595 default:
1596 ASSERT_NOT_REACHED();
1597 }
1598
1599 switch (style.gridAutoFlow()) {
1600 case AutoFlowRowDense:
1601 case AutoFlowColumnDense:
1602 list->append(cssValuePool().createIdentifierValue(CSSValueDense));
1603 break;
1604 default:
1605 // Do nothing.
1606 break;
1607 }
1608
1609 return list.release();
1610 }
1611 // Specs mention that getComputedStyle() should return the used value of the property instead of the computed
1612 // one for grid-definition-{rows|columns} but not for the grid-auto-{rows|co lumns} as things like
1613 // grid-auto-columns: 2fr; cannot be resolved to a value in pixels as the '2 fr' means very different things
1614 // depending on the size of the explicit grid or the number of implicit trac ks added to the grid. See
1615 // http://lists.w3.org/Archives/Public/www-style/2013Nov/0014.html
1616 case CSSPropertyGridAutoColumns:
1617 return specifiedValueForGridTrackSize(style.gridAutoColumns(), style);
1618 case CSSPropertyGridAutoRows:
1619 return specifiedValueForGridTrackSize(style.gridAutoRows(), style);
1620
1621 case CSSPropertyGridTemplateColumns:
1622 return valueForGridTrackList(ForColumns, renderer, style);
1623 case CSSPropertyGridTemplateRows:
1624 return valueForGridTrackList(ForRows, renderer, style);
1625
1626 case CSSPropertyGridColumnStart:
1627 return valueForGridPosition(style.gridColumnStart());
1628 case CSSPropertyGridColumnEnd:
1629 return valueForGridPosition(style.gridColumnEnd());
1630 case CSSPropertyGridRowStart:
1631 return valueForGridPosition(style.gridRowStart());
1632 case CSSPropertyGridRowEnd:
1633 return valueForGridPosition(style.gridRowEnd());
1634 case CSSPropertyGridColumn:
1635 return valuesForGridShorthand(gridColumnShorthand(), style, renderer, st yledNode, allowVisitedStyle);
1636 case CSSPropertyGridRow:
1637 return valuesForGridShorthand(gridRowShorthand(), style, renderer, style dNode, allowVisitedStyle);
1638 case CSSPropertyGridArea:
1639 return valuesForGridShorthand(gridAreaShorthand(), style, renderer, styl edNode, allowVisitedStyle);
1640 case CSSPropertyGridTemplate:
1641 return valuesForGridShorthand(gridTemplateShorthand(), style, renderer, styledNode, allowVisitedStyle);
1642 case CSSPropertyGrid:
1643 return valuesForGridShorthand(gridShorthand(), style, renderer, styledNo de, allowVisitedStyle);
1644 case CSSPropertyGridTemplateAreas:
1645 if (!style.namedGridAreaRowCount()) {
1646 ASSERT(!style.namedGridAreaColumnCount());
1647 return cssValuePool().createIdentifierValue(CSSValueNone);
1648 }
1649
1650 return CSSGridTemplateAreasValue::create(style.namedGridArea(), style.na medGridAreaRowCount(), style.namedGridAreaColumnCount());
1651
1652 case CSSPropertyHeight:
1653 if (renderer) {
1654 // According to http://www.w3.org/TR/CSS2/visudet.html#the-height-pr operty,
1655 // the "height" property does not apply for non-replaced inline elem ents.
1656 if (!renderer->isReplaced() && renderer->isInline())
1657 return cssValuePool().createIdentifierValue(CSSValueAuto);
1658 return zoomAdjustedPixelValue(sizingBox(renderer).height(), style);
1659 }
1660 return zoomAdjustedPixelValueForLength(style.height(), style);
1661 case CSSPropertyWebkitHighlight:
1662 if (style.highlight() == nullAtom)
1663 return cssValuePool().createIdentifierValue(CSSValueNone);
1664 return cssValuePool().createValue(style.highlight(), CSSPrimitiveValue:: CSS_STRING);
1665 case CSSPropertyWebkitHyphenateCharacter:
1666 if (style.hyphenationString().isNull())
1667 return cssValuePool().createIdentifierValue(CSSValueAuto);
1668 return cssValuePool().createValue(style.hyphenationString(), CSSPrimitiv eValue::CSS_STRING);
1669 case CSSPropertyImageRendering:
1670 return CSSPrimitiveValue::create(style.imageRendering());
1671 case CSSPropertyIsolation:
1672 return cssValuePool().createValue(style.isolation());
1673 case CSSPropertyJustifyItems:
1674 return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(st yle.justifyItems(), styledNode), style.justifyItemsOverflowAlignment(), style.ju stifyItemsPositionType());
1675 case CSSPropertyJustifySelf:
1676 return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(st yle.justifySelf(), styledNode->parentNode()), style.justifySelfOverflowAlignment (), NonLegacyPosition);
1677 case CSSPropertyLeft:
1678 return valueForPositionOffset(style, CSSPropertyLeft, renderer);
1679 case CSSPropertyLetterSpacing:
1680 if (!style.letterSpacing())
1681 return cssValuePool().createIdentifierValue(CSSValueNormal);
1682 return zoomAdjustedPixelValue(style.letterSpacing(), style);
1683 case CSSPropertyWebkitLineClamp:
1684 if (style.lineClamp().isNone())
1685 return cssValuePool().createIdentifierValue(CSSValueNone);
1686 return cssValuePool().createValue(style.lineClamp().value(), style.lineC lamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveValue::C SS_NUMBER);
1687 case CSSPropertyLineHeight:
1688 return valueForLineHeight(style);
1689 case CSSPropertyListStyleImage:
1690 if (style.listStyleImage())
1691 return style.listStyleImage()->cssValue();
1692 return cssValuePool().createIdentifierValue(CSSValueNone);
1693 case CSSPropertyListStylePosition:
1694 return cssValuePool().createValue(style.listStylePosition());
1695 case CSSPropertyListStyleType:
1696 return cssValuePool().createValue(style.listStyleType());
1697 case CSSPropertyWebkitLocale:
1698 if (style.locale().isNull())
1699 return cssValuePool().createIdentifierValue(CSSValueAuto);
1700 return cssValuePool().createValue(style.locale(), CSSPrimitiveValue::CSS _STRING);
1701 case CSSPropertyMarginTop: {
1702 Length marginTop = style.marginTop();
1703 if (marginTop.isFixed() || !renderer || !renderer->isBox())
1704 return zoomAdjustedPixelValueForLength(marginTop, style);
1705 return zoomAdjustedPixelValue(toLayoutBox(renderer)->marginTop(), style) ;
1706 }
1707 case CSSPropertyMarginRight: {
1708 Length marginRight = style.marginRight();
1709 if (marginRight.isFixed() || !renderer || !renderer->isBox())
1710 return zoomAdjustedPixelValueForLength(marginRight, style);
1711 float value;
1712 if (marginRight.isPercent()) {
1713 // LayoutBox gives a marginRight() that is the distance between the right-edge of the child box
1714 // and the right-edge of the containing box, when display == BLOCK. Let's calculate the absolute
1715 // value of the specified margin-right % instead of relying on Layou tBox's marginRight() value.
1716 value = minimumValueForLength(marginRight, toLayoutBox(renderer)->co ntainingBlockLogicalWidthForContent()).toFloat();
1717 } else {
1718 value = toLayoutBox(renderer)->marginRight().toFloat();
1719 }
1720 return zoomAdjustedPixelValue(value, style);
1721 }
1722 case CSSPropertyMarginBottom: {
1723 Length marginBottom = style.marginBottom();
1724 if (marginBottom.isFixed() || !renderer || !renderer->isBox())
1725 return zoomAdjustedPixelValueForLength(marginBottom, style);
1726 return zoomAdjustedPixelValue(toLayoutBox(renderer)->marginBottom(), sty le);
1727 }
1728 case CSSPropertyMarginLeft: {
1729 Length marginLeft = style.marginLeft();
1730 if (marginLeft.isFixed() || !renderer || !renderer->isBox())
1731 return zoomAdjustedPixelValueForLength(marginLeft, style);
1732 return zoomAdjustedPixelValue(toLayoutBox(renderer)->marginLeft(), style );
1733 }
1734 case CSSPropertyWebkitUserModify:
1735 return cssValuePool().createValue(style.userModify());
1736 case CSSPropertyMaxHeight: {
1737 const Length& maxHeight = style.maxHeight();
1738 if (maxHeight.isMaxSizeNone())
1739 return cssValuePool().createIdentifierValue(CSSValueNone);
1740 return zoomAdjustedPixelValueForLength(maxHeight, style);
1741 }
1742 case CSSPropertyMaxWidth: {
1743 const Length& maxWidth = style.maxWidth();
1744 if (maxWidth.isMaxSizeNone())
1745 return cssValuePool().createIdentifierValue(CSSValueNone);
1746 return zoomAdjustedPixelValueForLength(maxWidth, style);
1747 }
1748 case CSSPropertyMinHeight:
1749 // FIXME: For flex-items, min-height:auto should compute to min-content.
1750 if (style.minHeight().isAuto())
1751 return zoomAdjustedPixelValue(0, style);
1752 return zoomAdjustedPixelValueForLength(style.minHeight(), style);
1753 case CSSPropertyMinWidth:
1754 // FIXME: For flex-items, min-width:auto should compute to min-content.
1755 if (style.minWidth().isAuto())
1756 return zoomAdjustedPixelValue(0, style);
1757 return zoomAdjustedPixelValueForLength(style.minWidth(), style);
1758 case CSSPropertyObjectFit:
1759 return cssValuePool().createValue(style.objectFit());
1760 case CSSPropertyObjectPosition:
1761 return cssValuePool().createValue(
1762 Pair::create(
1763 zoomAdjustedPixelValueForLength(style.objectPosition().x(), styl e),
1764 zoomAdjustedPixelValueForLength(style.objectPosition().y(), styl e),
1765 Pair::KeepIdenticalValues));
1766 case CSSPropertyOpacity:
1767 return cssValuePool().createValue(style.opacity(), CSSPrimitiveValue::CS S_NUMBER);
1768 case CSSPropertyOrphans:
1769 if (style.hasAutoOrphans())
1770 return cssValuePool().createIdentifierValue(CSSValueAuto);
1771 return cssValuePool().createValue(style.orphans(), CSSPrimitiveValue::CS S_NUMBER);
1772 case CSSPropertyOutlineColor:
1773 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited DependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style, style.outlineColor());
1774 case CSSPropertyOutlineOffset:
1775 return zoomAdjustedPixelValue(style.outlineOffset(), style);
1776 case CSSPropertyOutlineStyle:
1777 if (style.outlineStyleIsAuto())
1778 return cssValuePool().createIdentifierValue(CSSValueAuto);
1779 return cssValuePool().createValue(style.outlineStyle());
1780 case CSSPropertyOutlineWidth:
1781 return zoomAdjustedPixelValue(style.outlineWidth(), style);
1782 case CSSPropertyOverflow:
1783 return cssValuePool().createValue(max(style.overflowX(), style.overflowY ()));
1784 case CSSPropertyOverflowWrap:
1785 return cssValuePool().createValue(style.overflowWrap());
1786 case CSSPropertyOverflowX:
1787 return cssValuePool().createValue(style.overflowX());
1788 case CSSPropertyOverflowY:
1789 return cssValuePool().createValue(style.overflowY());
1790 case CSSPropertyPaddingTop: {
1791 Length paddingTop = style.paddingTop();
1792 if (paddingTop.isFixed() || !renderer || !renderer->isBox())
1793 return zoomAdjustedPixelValueForLength(paddingTop, style);
1794 return zoomAdjustedPixelValue(toLayoutBox(renderer)->computedCSSPaddingT op(), style);
1795 }
1796 case CSSPropertyPaddingRight: {
1797 Length paddingRight = style.paddingRight();
1798 if (paddingRight.isFixed() || !renderer || !renderer->isBox())
1799 return zoomAdjustedPixelValueForLength(paddingRight, style);
1800 return zoomAdjustedPixelValue(toLayoutBox(renderer)->computedCSSPaddingR ight(), style);
1801 }
1802 case CSSPropertyPaddingBottom: {
1803 Length paddingBottom = style.paddingBottom();
1804 if (paddingBottom.isFixed() || !renderer || !renderer->isBox())
1805 return zoomAdjustedPixelValueForLength(paddingBottom, style);
1806 return zoomAdjustedPixelValue(toLayoutBox(renderer)->computedCSSPaddingB ottom(), style);
1807 }
1808 case CSSPropertyPaddingLeft: {
1809 Length paddingLeft = style.paddingLeft();
1810 if (paddingLeft.isFixed() || !renderer || !renderer->isBox())
1811 return zoomAdjustedPixelValueForLength(paddingLeft, style);
1812 return zoomAdjustedPixelValue(toLayoutBox(renderer)->computedCSSPaddingL eft(), style);
1813 }
1814 case CSSPropertyPageBreakAfter:
1815 return cssValuePool().createValue(style.pageBreakAfter());
1816 case CSSPropertyPageBreakBefore:
1817 return cssValuePool().createValue(style.pageBreakBefore());
1818 case CSSPropertyPageBreakInside: {
1819 EPageBreak pageBreak = style.pageBreakInside();
1820 ASSERT(pageBreak != PBALWAYS);
1821 if (pageBreak == PBALWAYS)
1822 return nullptr;
1823 return cssValuePool().createValue(style.pageBreakInside());
1824 }
1825 case CSSPropertyPosition:
1826 return cssValuePool().createValue(style.position());
1827 case CSSPropertyRight:
1828 return valueForPositionOffset(style, CSSPropertyRight, renderer);
1829 case CSSPropertyWebkitRubyPosition:
1830 return cssValuePool().createValue(style.rubyPosition());
1831 case CSSPropertyScrollBehavior:
1832 return cssValuePool().createValue(style.scrollBehavior());
1833 case CSSPropertyScrollBlocksOn:
1834 return scrollBlocksOnFlagsToCSSValue(style.scrollBlocksOn());
1835 case CSSPropertyTableLayout:
1836 return cssValuePool().createValue(style.tableLayout());
1837 case CSSPropertyTextAlign:
1838 return cssValuePool().createValue(style.textAlign());
1839 case CSSPropertyTextAlignLast:
1840 return cssValuePool().createValue(style.textAlignLast());
1841 case CSSPropertyTextDecoration:
1842 if (RuntimeEnabledFeatures::css3TextDecorationsEnabled())
1843 return valuesForShorthandProperty(textDecorationShorthand(), style, renderer, styledNode, allowVisitedStyle);
1844 // Fall through.
1845 case CSSPropertyTextDecorationLine:
1846 return renderTextDecorationFlagsToCSSValue(style.textDecoration());
1847 case CSSPropertyTextDecorationStyle:
1848 return valueForTextDecorationStyle(style.textDecorationStyle());
1849 case CSSPropertyTextDecorationColor:
1850 return currentColorOrValidColor(style, style.textDecorationColor());
1851 case CSSPropertyTextJustify:
1852 return cssValuePool().createValue(style.textJustify());
1853 case CSSPropertyTextUnderlinePosition:
1854 return cssValuePool().createValue(style.textUnderlinePosition());
1855 case CSSPropertyWebkitTextDecorationsInEffect:
1856 return renderTextDecorationFlagsToCSSValue(style.textDecorationsInEffect ());
1857 case CSSPropertyWebkitTextFillColor:
1858 return currentColorOrValidColor(style, style.textFillColor());
1859 case CSSPropertyWebkitTextEmphasisColor:
1860 return currentColorOrValidColor(style, style.textEmphasisColor());
1861 case CSSPropertyWebkitTextEmphasisPosition:
1862 return cssValuePool().createValue(style.textEmphasisPosition());
1863 case CSSPropertyWebkitTextEmphasisStyle:
1864 switch (style.textEmphasisMark()) {
1865 case TextEmphasisMarkNone:
1866 return cssValuePool().createIdentifierValue(CSSValueNone);
1867 case TextEmphasisMarkCustom:
1868 return cssValuePool().createValue(style.textEmphasisCustomMark(), CS SPrimitiveValue::CSS_STRING);
1869 case TextEmphasisMarkAuto:
1870 ASSERT_NOT_REACHED();
1871 // Fall through
1872 case TextEmphasisMarkDot:
1873 case TextEmphasisMarkCircle:
1874 case TextEmphasisMarkDoubleCircle:
1875 case TextEmphasisMarkTriangle:
1876 case TextEmphasisMarkSesame: {
1877 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSep arated();
1878 list->append(cssValuePool().createValue(style.textEmphasisFill()));
1879 list->append(cssValuePool().createValue(style.textEmphasisMark()));
1880 return list.release();
1881 }
1882 }
1883 case CSSPropertyTextIndent: {
1884 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed();
1885 list->append(zoomAdjustedPixelValueForLength(style.textIndent(), style)) ;
1886 if (RuntimeEnabledFeatures::css3TextEnabled() && (style.textIndentLine() == TextIndentEachLine || style.textIndentType() == TextIndentHanging)) {
1887 if (style.textIndentLine() == TextIndentEachLine)
1888 list->append(cssValuePool().createIdentifierValue(CSSValueEachLi ne));
1889 if (style.textIndentType() == TextIndentHanging)
1890 list->append(cssValuePool().createIdentifierValue(CSSValueHangin g));
1891 }
1892 return list.release();
1893 }
1894 case CSSPropertyTextShadow:
1895 return valueForShadowList(style.textShadow(), style, false);
1896 case CSSPropertyTextRendering:
1897 return cssValuePool().createValue(style.fontDescription().textRendering( ));
1898 case CSSPropertyTextOverflow:
1899 if (style.textOverflow())
1900 return cssValuePool().createIdentifierValue(CSSValueEllipsis);
1901 return cssValuePool().createIdentifierValue(CSSValueClip);
1902 case CSSPropertyWebkitTextSecurity:
1903 return cssValuePool().createValue(style.textSecurity());
1904 case CSSPropertyWebkitTextStrokeColor:
1905 return currentColorOrValidColor(style, style.textStrokeColor());
1906 case CSSPropertyWebkitTextStrokeWidth:
1907 return zoomAdjustedPixelValue(style.textStrokeWidth(), style);
1908 case CSSPropertyTextTransform:
1909 return cssValuePool().createValue(style.textTransform());
1910 case CSSPropertyTop:
1911 return valueForPositionOffset(style, CSSPropertyTop, renderer);
1912 case CSSPropertyTouchAction:
1913 return touchActionFlagsToCSSValue(style.touchAction());
1914 case CSSPropertyUnicodeBidi:
1915 return cssValuePool().createValue(style.unicodeBidi());
1916 case CSSPropertyVerticalAlign:
1917 switch (style.verticalAlign()) {
1918 case BASELINE:
1919 return cssValuePool().createIdentifierValue(CSSValueBaseline);
1920 case MIDDLE:
1921 return cssValuePool().createIdentifierValue(CSSValueMiddle);
1922 case SUB:
1923 return cssValuePool().createIdentifierValue(CSSValueSub);
1924 case SUPER:
1925 return cssValuePool().createIdentifierValue(CSSValueSuper);
1926 case TEXT_TOP:
1927 return cssValuePool().createIdentifierValue(CSSValueTextTop);
1928 case TEXT_BOTTOM:
1929 return cssValuePool().createIdentifierValue(CSSValueTextBottom);
1930 case TOP:
1931 return cssValuePool().createIdentifierValue(CSSValueTop);
1932 case BOTTOM:
1933 return cssValuePool().createIdentifierValue(CSSValueBottom);
1934 case BASELINE_MIDDLE:
1935 return cssValuePool().createIdentifierValue(CSSValueWebkitBaselineMi ddle);
1936 case LENGTH:
1937 return zoomAdjustedPixelValueForLength(style.verticalAlignLength(), style);
1938 }
1939 ASSERT_NOT_REACHED();
1940 return nullptr;
1941 case CSSPropertyVisibility:
1942 return cssValuePool().createValue(style.visibility());
1943 case CSSPropertyWhiteSpace:
1944 return cssValuePool().createValue(style.whiteSpace());
1945 case CSSPropertyWidows:
1946 return cssValuePool().createValue(style.widows(), CSSPrimitiveValue::CSS _NUMBER);
1947 case CSSPropertyWidth:
1948 if (renderer) {
1949 // According to http://www.w3.org/TR/CSS2/visudet.html#the-width-pro perty,
1950 // the "width" property does not apply for non-replaced inline eleme nts.
1951 if (!renderer->isReplaced() && renderer->isInline())
1952 return cssValuePool().createIdentifierValue(CSSValueAuto);
1953 return zoomAdjustedPixelValue(sizingBox(renderer).width(), style);
1954 }
1955 return zoomAdjustedPixelValueForLength(style.width(), style);
1956 case CSSPropertyWillChange:
1957 return valueForWillChange(style.willChangeProperties(), style.willChange Contents(), style.willChangeScrollPosition());
1958 case CSSPropertyWordBreak:
1959 return cssValuePool().createValue(style.wordBreak());
1960 case CSSPropertyWordSpacing:
1961 return zoomAdjustedPixelValue(style.wordSpacing(), style);
1962 case CSSPropertyWordWrap:
1963 return cssValuePool().createValue(style.overflowWrap());
1964 case CSSPropertyWebkitLineBreak:
1965 return cssValuePool().createValue(style.lineBreak());
1966 case CSSPropertyResize:
1967 return cssValuePool().createValue(style.resize());
1968 case CSSPropertyFontKerning:
1969 return cssValuePool().createValue(style.fontDescription().kerning());
1970 case CSSPropertyWebkitFontSmoothing:
1971 return cssValuePool().createValue(style.fontDescription().fontSmoothing( ));
1972 case CSSPropertyFontVariantLigatures: {
1973 FontDescription::LigaturesState commonLigaturesState = style.fontDescrip tion().commonLigaturesState();
1974 FontDescription::LigaturesState discretionaryLigaturesState = style.font Description().discretionaryLigaturesState();
1975 FontDescription::LigaturesState historicalLigaturesState = style.fontDes cription().historicalLigaturesState();
1976 FontDescription::LigaturesState contextualLigaturesState = style.fontDes cription().contextualLigaturesState();
1977 if (commonLigaturesState == FontDescription::NormalLigaturesState && dis cretionaryLigaturesState == FontDescription::NormalLigaturesState
1978 && historicalLigaturesState == FontDescription::NormalLigaturesState && contextualLigaturesState == FontDescription::NormalLigaturesState)
1979 return cssValuePool().createIdentifierValue(CSSValueNormal);
1980
1981 RefPtrWillBeRawPtr<CSSValueList> valueList = CSSValueList::createSpaceSe parated();
1982 if (commonLigaturesState != FontDescription::NormalLigaturesState)
1983 valueList->append(cssValuePool().createIdentifierValue(commonLigatur esState == FontDescription::DisabledLigaturesState ? CSSValueNoCommonLigatures : CSSValueCommonLigatures));
1984 if (discretionaryLigaturesState != FontDescription::NormalLigaturesState )
1985 valueList->append(cssValuePool().createIdentifierValue(discretionary LigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoDiscretion aryLigatures : CSSValueDiscretionaryLigatures));
1986 if (historicalLigaturesState != FontDescription::NormalLigaturesState)
1987 valueList->append(cssValuePool().createIdentifierValue(historicalLig aturesState == FontDescription::DisabledLigaturesState ? CSSValueNoHistoricalLig atures : CSSValueHistoricalLigatures));
1988 if (contextualLigaturesState != FontDescription::NormalLigaturesState)
1989 valueList->append(cssValuePool().createIdentifierValue(contextualLig aturesState == FontDescription::DisabledLigaturesState ? CSSValueNoContextual : CSSValueContextual));
1990 return valueList;
1991 }
1992 case CSSPropertyZIndex:
1993 if (style.hasAutoZIndex())
1994 return cssValuePool().createIdentifierValue(CSSValueAuto);
1995 return cssValuePool().createValue(style.zIndex(), CSSPrimitiveValue::CSS _NUMBER);
1996 case CSSPropertyZoom:
1997 return cssValuePool().createValue(style.zoom(), CSSPrimitiveValue::CSS_N UMBER);
1998 case CSSPropertyBoxSizing:
1999 if (style.boxSizing() == CONTENT_BOX)
2000 return cssValuePool().createIdentifierValue(CSSValueContentBox);
2001 return cssValuePool().createIdentifierValue(CSSValueBorderBox);
2002 case CSSPropertyWebkitAppRegion:
2003 return cssValuePool().createIdentifierValue(style.getDraggableRegionMode () == DraggableRegionDrag ? CSSValueDrag : CSSValueNoDrag);
2004 case CSSPropertyAnimationDelay:
2005 ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
2006 case CSSPropertyWebkitAnimationDelay:
2007 return valueForAnimationDelay(style.animations());
2008 case CSSPropertyAnimationDirection:
2009 ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
2010 case CSSPropertyWebkitAnimationDirection: {
2011 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed();
2012 const CSSAnimationData* animationData = style.animations();
2013 if (animationData) {
2014 for (size_t i = 0; i < animationData->directionList().size(); ++i)
2015 list->append(valueForAnimationDirection(animationData->direction List()[i]));
2016 } else {
2017 list->append(cssValuePool().createIdentifierValue(CSSValueNormal));
2018 }
2019 return list.release();
2020 }
2021 case CSSPropertyAnimationDuration:
2022 ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
2023 case CSSPropertyWebkitAnimationDuration:
2024 return valueForAnimationDuration(style.animations());
2025 case CSSPropertyAnimationFillMode:
2026 ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
2027 case CSSPropertyWebkitAnimationFillMode: {
2028 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed();
2029 const CSSAnimationData* animationData = style.animations();
2030 if (animationData) {
2031 for (size_t i = 0; i < animationData->fillModeList().size(); ++i)
2032 list->append(valueForAnimationFillMode(animationData->fillModeLi st()[i]));
2033 } else {
2034 list->append(cssValuePool().createIdentifierValue(CSSValueNone));
2035 }
2036 return list.release();
2037 }
2038 case CSSPropertyAnimationIterationCount:
2039 ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
2040 case CSSPropertyWebkitAnimationIterationCount: {
2041 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed();
2042 const CSSAnimationData* animationData = style.animations();
2043 if (animationData) {
2044 for (size_t i = 0; i < animationData->iterationCountList().size(); + +i)
2045 list->append(valueForAnimationIterationCount(animationData->iter ationCountList()[i]));
2046 } else {
2047 list->append(cssValuePool().createValue(CSSAnimationData::initialIte rationCount(), CSSPrimitiveValue::CSS_NUMBER));
2048 }
2049 return list.release();
2050 }
2051 case CSSPropertyAnimationName:
2052 ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
2053 case CSSPropertyWebkitAnimationName: {
2054 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed();
2055 const CSSAnimationData* animationData = style.animations();
2056 if (animationData) {
2057 for (size_t i = 0; i < animationData->nameList().size(); ++i)
2058 list->append(cssValuePool().createValue(animationData->nameList( )[i], CSSPrimitiveValue::CSS_CUSTOM_IDENT));
2059 } else {
2060 list->append(cssValuePool().createIdentifierValue(CSSValueNone));
2061 }
2062 return list.release();
2063 }
2064 case CSSPropertyAnimationPlayState:
2065 ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
2066 case CSSPropertyWebkitAnimationPlayState: {
2067 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed();
2068 const CSSAnimationData* animationData = style.animations();
2069 if (animationData) {
2070 for (size_t i = 0; i < animationData->playStateList().size(); ++i)
2071 list->append(valueForAnimationPlayState(animationData->playState List()[i]));
2072 } else {
2073 list->append(cssValuePool().createIdentifierValue(CSSValueRunning));
2074 }
2075 return list.release();
2076 }
2077 case CSSPropertyAnimationTimingFunction:
2078 ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
2079 case CSSPropertyWebkitAnimationTimingFunction:
2080 return valueForAnimationTimingFunction(style.animations());
2081 case CSSPropertyAnimation:
2082 case CSSPropertyWebkitAnimation: {
2083 const CSSAnimationData* animationData = style.animations();
2084 if (animationData) {
2085 RefPtrWillBeRawPtr<CSSValueList> animationsList = CSSValueList::crea teCommaSeparated();
2086 for (size_t i = 0; i < animationData->nameList().size(); ++i) {
2087 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpac eSeparated();
2088 list->append(cssValuePool().createValue(animationData->nameList( )[i], CSSPrimitiveValue::CSS_CUSTOM_IDENT));
2089 list->append(cssValuePool().createValue(CSSTimingData::getRepeat ed(animationData->durationList(), i), CSSPrimitiveValue::CSS_S));
2090 list->append(createTimingFunctionValue(CSSTimingData::getRepeate d(animationData->timingFunctionList(), i).get()));
2091 list->append(cssValuePool().createValue(CSSTimingData::getRepeat ed(animationData->delayList(), i), CSSPrimitiveValue::CSS_S));
2092 list->append(valueForAnimationIterationCount(CSSTimingData::getR epeated(animationData->iterationCountList(), i)));
2093 list->append(valueForAnimationDirection(CSSTimingData::getRepeat ed(animationData->directionList(), i)));
2094 list->append(valueForAnimationFillMode(CSSTimingData::getRepeate d(animationData->fillModeList(), i)));
2095 list->append(valueForAnimationPlayState(CSSTimingData::getRepeat ed(animationData->playStateList(), i)));
2096 animationsList->append(list);
2097 }
2098 return animationsList.release();
2099 }
2100
2101 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed();
2102 // animation-name default value.
2103 list->append(cssValuePool().createIdentifierValue(CSSValueNone));
2104 list->append(cssValuePool().createValue(CSSAnimationData::initialDuratio n(), CSSPrimitiveValue::CSS_S));
2105 list->append(createTimingFunctionValue(CSSAnimationData::initialTimingFu nction().get()));
2106 list->append(cssValuePool().createValue(CSSAnimationData::initialDelay() , CSSPrimitiveValue::CSS_S));
2107 list->append(cssValuePool().createValue(CSSAnimationData::initialIterati onCount(), CSSPrimitiveValue::CSS_NUMBER));
2108 list->append(valueForAnimationDirection(CSSAnimationData::initialDirecti on()));
2109 list->append(valueForAnimationFillMode(CSSAnimationData::initialFillMode ()));
2110 // Initial animation-play-state.
2111 list->append(cssValuePool().createIdentifierValue(CSSValueRunning));
2112 return list.release();
2113 }
2114 case CSSPropertyWebkitAppearance:
2115 return cssValuePool().createValue(style.appearance());
2116 case CSSPropertyBackfaceVisibility:
2117 case CSSPropertyWebkitBackfaceVisibility:
2118 return cssValuePool().createIdentifierValue((style.backfaceVisibility() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible);
2119 case CSSPropertyWebkitBorderImage:
2120 return valueForNinePieceImage(style.borderImage(), style);
2121 case CSSPropertyBorderImageOutset:
2122 return valueForNinePieceImageQuad(style.borderImage().outset(), style);
2123 case CSSPropertyBorderImageRepeat:
2124 return valueForNinePieceImageRepeat(style.borderImage());
2125 case CSSPropertyBorderImageSlice:
2126 return valueForNinePieceImageSlice(style.borderImage());
2127 case CSSPropertyBorderImageWidth:
2128 return valueForNinePieceImageQuad(style.borderImage().borderSlices(), st yle);
2129 case CSSPropertyWebkitMaskBoxImage:
2130 return valueForNinePieceImage(style.maskBoxImage(), style);
2131 case CSSPropertyWebkitMaskBoxImageOutset:
2132 return valueForNinePieceImageQuad(style.maskBoxImage().outset(), style);
2133 case CSSPropertyWebkitMaskBoxImageRepeat:
2134 return valueForNinePieceImageRepeat(style.maskBoxImage());
2135 case CSSPropertyWebkitMaskBoxImageSlice:
2136 return valueForNinePieceImageSlice(style.maskBoxImage());
2137 case CSSPropertyWebkitMaskBoxImageWidth:
2138 return valueForNinePieceImageQuad(style.maskBoxImage().borderSlices(), s tyle);
2139 case CSSPropertyWebkitMaskBoxImageSource:
2140 if (style.maskBoxImageSource())
2141 return style.maskBoxImageSource()->cssValue();
2142 return cssValuePool().createIdentifierValue(CSSValueNone);
2143 case CSSPropertyWebkitFontSizeDelta:
2144 // Not a real style property -- used by the editing engine -- so has no computed value.
2145 return nullptr;
2146 case CSSPropertyWebkitMarginBottomCollapse:
2147 case CSSPropertyWebkitMarginAfterCollapse:
2148 return cssValuePool().createValue(style.marginAfterCollapse());
2149 case CSSPropertyWebkitMarginTopCollapse:
2150 case CSSPropertyWebkitMarginBeforeCollapse:
2151 return cssValuePool().createValue(style.marginBeforeCollapse());
2152 case CSSPropertyPerspective:
2153 case CSSPropertyWebkitPerspective:
2154 if (!style.hasPerspective())
2155 return cssValuePool().createIdentifierValue(CSSValueNone);
2156 return zoomAdjustedPixelValue(style.perspective(), style);
2157 case CSSPropertyPerspectiveOrigin:
2158 case CSSPropertyWebkitPerspectiveOrigin: {
2159 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed();
2160 if (renderer) {
2161 LayoutRect box;
2162 if (renderer->isBox())
2163 box = toLayoutBox(renderer)->borderBoxRect();
2164
2165 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.pers pectiveOriginX(), box.width()), style));
2166 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.pers pectiveOriginY(), box.height()), style));
2167 } else {
2168 list->append(zoomAdjustedPixelValueForLength(style.perspectiveOrigin X(), style));
2169 list->append(zoomAdjustedPixelValueForLength(style.perspectiveOrigin Y(), style));
2170 }
2171 return list.release();
2172 }
2173 case CSSPropertyWebkitRtlOrdering:
2174 return cssValuePool().createIdentifierValue(style.rtlOrdering() ? CSSVal ueVisual : CSSValueLogical);
2175 case CSSPropertyWebkitTapHighlightColor:
2176 return currentColorOrValidColor(style, style.tapHighlightColor());
2177 case CSSPropertyWebkitUserDrag:
2178 return cssValuePool().createValue(style.userDrag());
2179 case CSSPropertyWebkitUserSelect:
2180 return cssValuePool().createValue(style.userSelect());
2181 case CSSPropertyBorderBottomLeftRadius:
2182 return valueForBorderRadiusCorner(style.borderBottomLeftRadius(), style) ;
2183 case CSSPropertyBorderBottomRightRadius:
2184 return valueForBorderRadiusCorner(style.borderBottomRightRadius(), style );
2185 case CSSPropertyBorderTopLeftRadius:
2186 return valueForBorderRadiusCorner(style.borderTopLeftRadius(), style);
2187 case CSSPropertyBorderTopRightRadius:
2188 return valueForBorderRadiusCorner(style.borderTopRightRadius(), style);
2189 case CSSPropertyClip: {
2190 if (style.hasAutoClip())
2191 return cssValuePool().createIdentifierValue(CSSValueAuto);
2192 RefPtrWillBeRawPtr<Rect> rect = Rect::create();
2193 rect->setTop(zoomAdjustedPixelValue(style.clip().top().value(), style));
2194 rect->setRight(zoomAdjustedPixelValue(style.clip().right().value(), styl e));
2195 rect->setBottom(zoomAdjustedPixelValue(style.clip().bottom().value(), st yle));
2196 rect->setLeft(zoomAdjustedPixelValue(style.clip().left().value(), style) );
2197 return cssValuePool().createValue(rect.release());
2198 }
2199 case CSSPropertySpeak:
2200 return cssValuePool().createValue(style.speak());
2201 case CSSPropertyTransform:
2202 case CSSPropertyWebkitTransform:
2203 return computedTransform(renderer, style);
2204 case CSSPropertyTransformOrigin:
2205 case CSSPropertyWebkitTransformOrigin: {
2206 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed();
2207 if (renderer) {
2208 LayoutRect box;
2209 if (renderer->isBox())
2210 box = toLayoutBox(renderer)->borderBoxRect();
2211
2212 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.tran sformOriginX(), box.width()), style));
2213 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.tran sformOriginY(), box.height()), style));
2214 if (style.transformOriginZ() != 0)
2215 list->append(zoomAdjustedPixelValue(style.transformOriginZ(), st yle));
2216 } else {
2217 list->append(zoomAdjustedPixelValueForLength(style.transformOriginX( ), style));
2218 list->append(zoomAdjustedPixelValueForLength(style.transformOriginY( ), style));
2219 if (style.transformOriginZ() != 0)
2220 list->append(zoomAdjustedPixelValue(style.transformOriginZ(), st yle));
2221 }
2222 return list.release();
2223 }
2224 case CSSPropertyTransformStyle:
2225 case CSSPropertyWebkitTransformStyle:
2226 return cssValuePool().createIdentifierValue((style.transformStyle3D() == TransformStyle3DPreserve3D) ? CSSValuePreserve3d : CSSValueFlat);
2227 case CSSPropertyTransitionDelay:
2228 case CSSPropertyWebkitTransitionDelay:
2229 return valueForAnimationDelay(style.transitions());
2230 case CSSPropertyTransitionDuration:
2231 case CSSPropertyWebkitTransitionDuration:
2232 return valueForAnimationDuration(style.transitions());
2233 case CSSPropertyTransitionProperty:
2234 case CSSPropertyWebkitTransitionProperty:
2235 return valueForTransitionProperty(style.transitions());
2236 case CSSPropertyTransitionTimingFunction:
2237 case CSSPropertyWebkitTransitionTimingFunction:
2238 return valueForAnimationTimingFunction(style.transitions());
2239 case CSSPropertyTransition:
2240 case CSSPropertyWebkitTransition: {
2241 const CSSTransitionData* transitionData = style.transitions();
2242 if (transitionData) {
2243 RefPtrWillBeRawPtr<CSSValueList> transitionsList = CSSValueList::cre ateCommaSeparated();
2244 for (size_t i = 0; i < transitionData->propertyList().size(); ++i) {
2245 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpac eSeparated();
2246 list->append(createTransitionPropertyValue(transitionData->prope rtyList()[i]));
2247 list->append(cssValuePool().createValue(CSSTimingData::getRepeat ed(transitionData->durationList(), i), CSSPrimitiveValue::CSS_S));
2248 list->append(createTimingFunctionValue(CSSTimingData::getRepeate d(transitionData->timingFunctionList(), i).get()));
2249 list->append(cssValuePool().createValue(CSSTimingData::getRepeat ed(transitionData->delayList(), i), CSSPrimitiveValue::CSS_S));
2250 transitionsList->append(list);
2251 }
2252 return transitionsList.release();
2253 }
2254
2255 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed();
2256 // transition-property default value.
2257 list->append(cssValuePool().createIdentifierValue(CSSValueAll));
2258 list->append(cssValuePool().createValue(CSSTransitionData::initialDurati on(), CSSPrimitiveValue::CSS_S));
2259 list->append(createTimingFunctionValue(CSSTransitionData::initialTimingF unction().get()));
2260 list->append(cssValuePool().createValue(CSSTransitionData::initialDelay( ), CSSPrimitiveValue::CSS_S));
2261 return list.release();
2262 }
2263 case CSSPropertyPointerEvents:
2264 return cssValuePool().createValue(style.pointerEvents());
2265 case CSSPropertyWebkitWritingMode:
2266 return cssValuePool().createValue(style.writingMode());
2267 case CSSPropertyWebkitTextCombine:
2268 return cssValuePool().createValue(style.textCombine());
2269 case CSSPropertyWebkitTextOrientation:
2270 return CSSPrimitiveValue::create(style.textOrientation());
2271 case CSSPropertyWebkitLineBoxContain:
2272 return createLineBoxContainValue(style.lineBoxContain());
2273 case CSSPropertyContent:
2274 return valueForContentData(style);
2275 case CSSPropertyCounterIncrement:
2276 return valueForCounterDirectives(style, propertyID);
2277 case CSSPropertyCounterReset:
2278 return valueForCounterDirectives(style, propertyID);
2279 case CSSPropertyWebkitClipPath:
2280 if (ClipPathOperation* operation = style.clipPath()) {
2281 if (operation->type() == ClipPathOperation::SHAPE)
2282 return valueForBasicShape(style, toShapeClipPathOperation(operat ion)->basicShape());
2283 if (operation->type() == ClipPathOperation::REFERENCE)
2284 return CSSPrimitiveValue::create(toReferenceClipPathOperation(op eration)->url(), CSSPrimitiveValue::CSS_URI);
2285 }
2286 return cssValuePool().createIdentifierValue(CSSValueNone);
2287 case CSSPropertyShapeMargin:
2288 return cssValuePool().createValue(style.shapeMargin(), style);
2289 case CSSPropertyShapeImageThreshold:
2290 return cssValuePool().createValue(style.shapeImageThreshold(), CSSPrimit iveValue::CSS_NUMBER);
2291 case CSSPropertyShapeOutside:
2292 return valueForShape(style, style.shapeOutside());
2293 case CSSPropertyWebkitFilter:
2294 return valueForFilter(style);
2295 case CSSPropertyMixBlendMode:
2296 return cssValuePool().createValue(style.blendMode());
2297
2298 case CSSPropertyBackgroundBlendMode: {
2299 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat ed();
2300 for (const FillLayer* currLayer = &style.backgroundLayers(); currLayer; currLayer = currLayer->next())
2301 list->append(cssValuePool().createValue(currLayer->blendMode()));
2302 return list.release();
2303 }
2304 case CSSPropertyBackground:
2305 return valuesForBackgroundShorthand(style, renderer, styledNode, allowVi sitedStyle);
2306 case CSSPropertyBorder: {
2307 RefPtrWillBeRawPtr<CSSValue> value = get(CSSPropertyBorderTop, style, re nderer, styledNode, allowVisitedStyle);
2308 const CSSPropertyID properties[] = {
2309 CSSPropertyBorderRight,
2310 CSSPropertyBorderBottom,
2311 CSSPropertyBorderLeft
2312 };
2313 for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) {
2314 if (!compareCSSValuePtr<CSSValue>(value, get(properties[i], style, r enderer, styledNode, allowVisitedStyle)))
2315 return nullptr;
2316 }
2317 return value.release();
2318 }
2319 case CSSPropertyBorderBottom:
2320 return valuesForShorthandProperty(borderBottomShorthand(), style, render er, styledNode, allowVisitedStyle);
2321 case CSSPropertyBorderColor:
2322 return valuesForSidesShorthand(borderColorShorthand(), style, renderer, styledNode, allowVisitedStyle);
2323 case CSSPropertyBorderLeft:
2324 return valuesForShorthandProperty(borderLeftShorthand(), style, renderer , styledNode, allowVisitedStyle);
2325 case CSSPropertyBorderImage:
2326 return valueForNinePieceImage(style.borderImage(), style);
2327 case CSSPropertyBorderRadius:
2328 return valueForBorderRadiusShorthand(style);
2329 case CSSPropertyBorderRight:
2330 return valuesForShorthandProperty(borderRightShorthand(), style, rendere r, styledNode, allowVisitedStyle);
2331 case CSSPropertyBorderStyle:
2332 return valuesForSidesShorthand(borderStyleShorthand(), style, renderer, styledNode, allowVisitedStyle);
2333 case CSSPropertyBorderTop:
2334 return valuesForShorthandProperty(borderTopShorthand(), style, renderer, styledNode, allowVisitedStyle);
2335 case CSSPropertyBorderWidth:
2336 return valuesForSidesShorthand(borderWidthShorthand(), style, renderer, styledNode, allowVisitedStyle);
2337 case CSSPropertyWebkitColumnRule:
2338 return valuesForShorthandProperty(webkitColumnRuleShorthand(), style, re nderer, styledNode, allowVisitedStyle);
2339 case CSSPropertyWebkitColumns:
2340 return valuesForShorthandProperty(webkitColumnsShorthand(), style, rende rer, styledNode, allowVisitedStyle);
2341 case CSSPropertyListStyle:
2342 return valuesForShorthandProperty(listStyleShorthand(), style, renderer, styledNode, allowVisitedStyle);
2343 case CSSPropertyMargin:
2344 return valuesForSidesShorthand(marginShorthand(), style, renderer, style dNode, allowVisitedStyle);
2345 case CSSPropertyOutline:
2346 return valuesForShorthandProperty(outlineShorthand(), style, renderer, s tyledNode, allowVisitedStyle);
2347 case CSSPropertyPadding:
2348 return valuesForSidesShorthand(paddingShorthand(), style, renderer, styl edNode, allowVisitedStyle);
2349 // Individual properties not part of the spec.
2350 case CSSPropertyBackgroundRepeatX:
2351 case CSSPropertyBackgroundRepeatY:
2352 return nullptr;
2353
2354 case CSSPropertyMotion:
2355 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled());
2356 return valuesForShorthandProperty(motionShorthand(), style, renderer, st yledNode, allowVisitedStyle);
2357
2358 case CSSPropertyMotionPath: {
2359 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled());
2360 const StyleMotionPath* styleMotionPath = style.motionPath();
2361 if (!styleMotionPath)
2362 return cssValuePool().createIdentifierValue(CSSValueNone);
2363
2364 ASSERT(styleMotionPath->isPathStyleMotionPath());
2365 return CSSPathValue::create(toPathStyleMotionPath(styleMotionPath)->path String());
2366 }
2367
2368 case CSSPropertyMotionOffset:
2369 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled());
2370 return zoomAdjustedPixelValueForLength(style.motionOffset(), style);
2371
2372 case CSSPropertyMotionRotation: {
2373 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled());
2374 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed();
2375 if (style.motionRotationType() == MotionRotationAuto)
2376 list->append(cssValuePool().createIdentifierValue(CSSValueAuto));
2377 list->append(cssValuePool().createValue(style.motionRotation(), CSSPrimi tiveValue::CSS_DEG));
2378 return list.release();
2379 }
2380
2381 // Unimplemented CSS 3 properties (including CSS3 shorthand properties).
2382 case CSSPropertyWebkitTextEmphasis:
2383 return nullptr;
2384
2385 // Directional properties are resolved by resolveDirectionAwareProperty() be fore the switch.
2386 case CSSPropertyWebkitBorderEnd:
2387 case CSSPropertyWebkitBorderEndColor:
2388 case CSSPropertyWebkitBorderEndStyle:
2389 case CSSPropertyWebkitBorderEndWidth:
2390 case CSSPropertyWebkitBorderStart:
2391 case CSSPropertyWebkitBorderStartColor:
2392 case CSSPropertyWebkitBorderStartStyle:
2393 case CSSPropertyWebkitBorderStartWidth:
2394 case CSSPropertyWebkitBorderAfter:
2395 case CSSPropertyWebkitBorderAfterColor:
2396 case CSSPropertyWebkitBorderAfterStyle:
2397 case CSSPropertyWebkitBorderAfterWidth:
2398 case CSSPropertyWebkitBorderBefore:
2399 case CSSPropertyWebkitBorderBeforeColor:
2400 case CSSPropertyWebkitBorderBeforeStyle:
2401 case CSSPropertyWebkitBorderBeforeWidth:
2402 case CSSPropertyWebkitMarginEnd:
2403 case CSSPropertyWebkitMarginStart:
2404 case CSSPropertyWebkitMarginAfter:
2405 case CSSPropertyWebkitMarginBefore:
2406 case CSSPropertyWebkitPaddingEnd:
2407 case CSSPropertyWebkitPaddingStart:
2408 case CSSPropertyWebkitPaddingAfter:
2409 case CSSPropertyWebkitPaddingBefore:
2410 case CSSPropertyWebkitLogicalWidth:
2411 case CSSPropertyWebkitLogicalHeight:
2412 case CSSPropertyWebkitMinLogicalWidth:
2413 case CSSPropertyWebkitMinLogicalHeight:
2414 case CSSPropertyWebkitMaxLogicalWidth:
2415 case CSSPropertyWebkitMaxLogicalHeight:
2416 ASSERT_NOT_REACHED();
2417 return nullptr;
2418
2419 // Unimplemented @font-face properties.
2420 case CSSPropertySrc:
2421 case CSSPropertyUnicodeRange:
2422 return nullptr;
2423
2424 // Other unimplemented properties.
2425 case CSSPropertyPage: // for @page
2426 case CSSPropertyQuotes: // FIXME: needs implementation
2427 case CSSPropertySize: // for @page
2428 return nullptr;
2429
2430 // Unimplemented -webkit- properties.
2431 case CSSPropertyWebkitBorderRadius:
2432 case CSSPropertyWebkitMarginCollapse:
2433 case CSSPropertyWebkitMask:
2434 case CSSPropertyWebkitMaskRepeatX:
2435 case CSSPropertyWebkitMaskRepeatY:
2436 case CSSPropertyWebkitPerspectiveOriginX:
2437 case CSSPropertyWebkitPerspectiveOriginY:
2438 case CSSPropertyWebkitTextStroke:
2439 case CSSPropertyWebkitTransformOriginX:
2440 case CSSPropertyWebkitTransformOriginY:
2441 case CSSPropertyWebkitTransformOriginZ:
2442 return nullptr;
2443
2444 // @viewport rule properties.
2445 case CSSPropertyMaxZoom:
2446 case CSSPropertyMinZoom:
2447 case CSSPropertyOrientation:
2448 case CSSPropertyUserZoom:
2449 return nullptr;
2450
2451 // SVG properties.
2452 case CSSPropertyClipRule:
2453 return CSSPrimitiveValue::create(svgStyle.clipRule());
2454 case CSSPropertyFloodOpacity:
2455 return CSSPrimitiveValue::create(svgStyle.floodOpacity(), CSSPrimitiveVa lue::CSS_NUMBER);
2456 case CSSPropertyStopOpacity:
2457 return CSSPrimitiveValue::create(svgStyle.stopOpacity(), CSSPrimitiveVal ue::CSS_NUMBER);
2458 case CSSPropertyColorInterpolation:
2459 return CSSPrimitiveValue::create(svgStyle.colorInterpolation());
2460 case CSSPropertyColorInterpolationFilters:
2461 return CSSPrimitiveValue::create(svgStyle.colorInterpolationFilters());
2462 case CSSPropertyFillOpacity:
2463 return CSSPrimitiveValue::create(svgStyle.fillOpacity(), CSSPrimitiveVal ue::CSS_NUMBER);
2464 case CSSPropertyFillRule:
2465 return CSSPrimitiveValue::create(svgStyle.fillRule());
2466 case CSSPropertyColorRendering:
2467 return CSSPrimitiveValue::create(svgStyle.colorRendering());
2468 case CSSPropertyShapeRendering:
2469 return CSSPrimitiveValue::create(svgStyle.shapeRendering());
2470 case CSSPropertyStrokeLinecap:
2471 return CSSPrimitiveValue::create(svgStyle.capStyle());
2472 case CSSPropertyStrokeLinejoin:
2473 return CSSPrimitiveValue::create(svgStyle.joinStyle());
2474 case CSSPropertyStrokeMiterlimit:
2475 return CSSPrimitiveValue::create(svgStyle.strokeMiterLimit(), CSSPrimiti veValue::CSS_NUMBER);
2476 case CSSPropertyStrokeOpacity:
2477 return CSSPrimitiveValue::create(svgStyle.strokeOpacity(), CSSPrimitiveV alue::CSS_NUMBER);
2478 case CSSPropertyAlignmentBaseline:
2479 return CSSPrimitiveValue::create(svgStyle.alignmentBaseline());
2480 case CSSPropertyDominantBaseline:
2481 return CSSPrimitiveValue::create(svgStyle.dominantBaseline());
2482 case CSSPropertyTextAnchor:
2483 return CSSPrimitiveValue::create(svgStyle.textAnchor());
2484 case CSSPropertyWritingMode:
2485 return CSSPrimitiveValue::create(svgStyle.writingMode());
2486 case CSSPropertyClipPath:
2487 if (!svgStyle.clipperResource().isEmpty())
2488 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgSt yle.clipperResource()), CSSPrimitiveValue::CSS_URI);
2489 return CSSPrimitiveValue::createIdentifier(CSSValueNone);
2490 case CSSPropertyMask:
2491 if (!svgStyle.maskerResource().isEmpty())
2492 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgSt yle.maskerResource()), CSSPrimitiveValue::CSS_URI);
2493 return CSSPrimitiveValue::createIdentifier(CSSValueNone);
2494 case CSSPropertyFilter:
2495 if (!svgStyle.filterResource().isEmpty())
2496 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgSt yle.filterResource()), CSSPrimitiveValue::CSS_URI);
2497 return CSSPrimitiveValue::createIdentifier(CSSValueNone);
2498 case CSSPropertyFloodColor:
2499 return currentColorOrValidColor(style, svgStyle.floodColor());
2500 case CSSPropertyLightingColor:
2501 return currentColorOrValidColor(style, svgStyle.lightingColor());
2502 case CSSPropertyStopColor:
2503 return currentColorOrValidColor(style, svgStyle.stopColor());
2504 case CSSPropertyFill:
2505 return adjustSVGPaintForCurrentColor(svgStyle.fillPaintType(), svgStyle. fillPaintUri(), svgStyle.fillPaintColor(), style.color());
2506 case CSSPropertyMarkerEnd:
2507 if (!svgStyle.markerEndResource().isEmpty())
2508 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgSt yle.markerEndResource()), CSSPrimitiveValue::CSS_URI);
2509 return CSSPrimitiveValue::createIdentifier(CSSValueNone);
2510 case CSSPropertyMarkerMid:
2511 if (!svgStyle.markerMidResource().isEmpty())
2512 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgSt yle.markerMidResource()), CSSPrimitiveValue::CSS_URI);
2513 return CSSPrimitiveValue::createIdentifier(CSSValueNone);
2514 case CSSPropertyMarkerStart:
2515 if (!svgStyle.markerStartResource().isEmpty())
2516 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgSt yle.markerStartResource()), CSSPrimitiveValue::CSS_URI);
2517 return CSSPrimitiveValue::createIdentifier(CSSValueNone);
2518 case CSSPropertyStroke:
2519 return adjustSVGPaintForCurrentColor(svgStyle.strokePaintType(), svgStyl e.strokePaintUri(), svgStyle.strokePaintColor(), style.color());
2520 case CSSPropertyStrokeDasharray:
2521 return strokeDashArrayToCSSValueList(*svgStyle.strokeDashArray(), style) ;
2522 case CSSPropertyStrokeDashoffset:
2523 return zoomAdjustedPixelValueForLength(svgStyle.strokeDashOffset(), styl e);
2524 case CSSPropertyStrokeWidth:
2525 return pixelValueForUnzoomedLength(svgStyle.strokeWidth(), style);
2526 case CSSPropertyBaselineShift: {
2527 switch (svgStyle.baselineShift()) {
2528 case BS_SUPER:
2529 return CSSPrimitiveValue::createIdentifier(CSSValueSuper);
2530 case BS_SUB:
2531 return CSSPrimitiveValue::createIdentifier(CSSValueSub);
2532 case BS_LENGTH:
2533 return zoomAdjustedPixelValueForLength(svgStyle.baselineShiftValue() , style);
2534 }
2535 ASSERT_NOT_REACHED();
2536 return nullptr;
2537 }
2538 case CSSPropertyBufferedRendering:
2539 return CSSPrimitiveValue::create(svgStyle.bufferedRendering());
2540 case CSSPropertyGlyphOrientationHorizontal:
2541 return glyphOrientationToCSSPrimitiveValue(svgStyle.glyphOrientationHori zontal());
2542 case CSSPropertyGlyphOrientationVertical: {
2543 if (RefPtrWillBeRawPtr<CSSPrimitiveValue> value = glyphOrientationToCSSP rimitiveValue(svgStyle.glyphOrientationVertical()))
2544 return value.release();
2545 if (svgStyle.glyphOrientationVertical() == GO_AUTO)
2546 return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
2547 return nullptr;
2548 }
2549 case CSSPropertyPaintOrder:
2550 return paintOrderToCSSValueList(svgStyle.paintOrder());
2551 case CSSPropertyVectorEffect:
2552 return CSSPrimitiveValue::create(svgStyle.vectorEffect());
2553 case CSSPropertyMaskType:
2554 return CSSPrimitiveValue::create(svgStyle.maskType());
2555 case CSSPropertyMarker:
2556 case CSSPropertyEnableBackground:
2557 // the above properties are not yet implemented in the engine
2558 return nullptr;
2559 case CSSPropertyCx:
2560 return zoomAdjustedPixelValueForLength(svgStyle.cx(), style);
2561 case CSSPropertyCy:
2562 return zoomAdjustedPixelValueForLength(svgStyle.cy(), style);
2563 case CSSPropertyX:
2564 return zoomAdjustedPixelValueForLength(svgStyle.x(), style);
2565 case CSSPropertyY:
2566 return zoomAdjustedPixelValueForLength(svgStyle.y(), style);
2567 case CSSPropertyR:
2568 return zoomAdjustedPixelValueForLength(svgStyle.r(), style);
2569 case CSSPropertyRx:
2570 return zoomAdjustedPixelValueForLength(svgStyle.rx(), style);
2571 case CSSPropertyRy:
2572 return zoomAdjustedPixelValueForLength(svgStyle.ry(), style);
2573
2574 case CSSPropertyAll:
2575 return nullptr;
2576 }
2577 ASSERT_NOT_REACHED();
2578 return nullptr;
2579 }
2580
2581 }
OLDNEW
« no previous file with comments | « Source/core/css/LayoutStyleCSSValueMapping.h ('k') | Source/core/css/MediaQueryEvaluator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698