OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> | 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. | 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. |
7 * Copyright (C) 2015 Google Inc. All rights reserved. | 7 * Copyright (C) 2015 Google Inc. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Lesser General Public | 10 * modify it under the terms of the GNU Lesser General Public |
11 * License as published by the Free Software Foundation; either | 11 * License as published by the Free Software Foundation; either |
12 * version 2 of the License, or (at your option) any later version. | 12 * version 2 of the License, or (at your option) any later version. |
13 * | 13 * |
14 * This library is distributed in the hope that it will be useful, | 14 * This library is distributed in the hope that it will be useful, |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 * Lesser General Public License for more details. | 17 * Lesser General Public License for more details. |
18 * | 18 * |
19 * You should have received a copy of the GNU Lesser General Public | 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 | 20 * License along with this library; if not, write to the Free Software |
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
22 * 02110-1301 USA | 22 * 02110-1301 USA |
23 */ | 23 */ |
24 | 24 |
25 #include "config.h" | 25 #include "config.h" |
26 #include "core/css/LayoutStyleCSSValueMapping.h" | 26 #include "core/css/ComputedStyleCSSValueMapping.h" |
27 | 27 |
28 #include "core/StylePropertyShorthand.h" | 28 #include "core/StylePropertyShorthand.h" |
29 #include "core/css/BasicShapeFunctions.h" | 29 #include "core/css/BasicShapeFunctions.h" |
30 #include "core/css/CSSBorderImage.h" | 30 #include "core/css/CSSBorderImage.h" |
31 #include "core/css/CSSBorderImageSliceValue.h" | 31 #include "core/css/CSSBorderImageSliceValue.h" |
32 #include "core/css/CSSFontFeatureValue.h" | 32 #include "core/css/CSSFontFeatureValue.h" |
33 #include "core/css/CSSFontValue.h" | 33 #include "core/css/CSSFontValue.h" |
34 #include "core/css/CSSFunctionValue.h" | 34 #include "core/css/CSSFunctionValue.h" |
35 #include "core/css/CSSGridLineNamesValue.h" | 35 #include "core/css/CSSGridLineNamesValue.h" |
36 #include "core/css/CSSGridTemplateAreasValue.h" | 36 #include "core/css/CSSGridTemplateAreasValue.h" |
37 #include "core/css/CSSPathValue.h" | 37 #include "core/css/CSSPathValue.h" |
38 #include "core/css/CSSPrimitiveValueMappings.h" | 38 #include "core/css/CSSPrimitiveValueMappings.h" |
39 #include "core/css/CSSReflectValue.h" | 39 #include "core/css/CSSReflectValue.h" |
40 #include "core/css/CSSShadowValue.h" | 40 #include "core/css/CSSShadowValue.h" |
41 #include "core/css/CSSTimingFunctionValue.h" | 41 #include "core/css/CSSTimingFunctionValue.h" |
42 #include "core/css/CSSValueList.h" | 42 #include "core/css/CSSValueList.h" |
43 #include "core/css/CSSValuePool.h" | 43 #include "core/css/CSSValuePool.h" |
44 #include "core/css/Pair.h" | 44 #include "core/css/Pair.h" |
45 #include "core/css/Rect.h" | 45 #include "core/css/Rect.h" |
46 #include "core/layout/LayoutBlock.h" | 46 #include "core/layout/LayoutBlock.h" |
47 #include "core/layout/LayoutBox.h" | 47 #include "core/layout/LayoutBox.h" |
48 #include "core/layout/LayoutGrid.h" | 48 #include "core/layout/LayoutGrid.h" |
49 #include "core/layout/LayoutObject.h" | 49 #include "core/layout/LayoutObject.h" |
50 #include "core/layout/style/ContentData.h" | 50 #include "core/layout/style/ContentData.h" |
51 #include "core/layout/style/LayoutStyle.h" | 51 #include "core/layout/style/ComputedStyle.h" |
52 #include "core/layout/style/PathStyleMotionPath.h" | 52 #include "core/layout/style/PathStyleMotionPath.h" |
53 #include "core/layout/style/ShadowList.h" | 53 #include "core/layout/style/ShadowList.h" |
54 #include "platform/LengthFunctions.h" | 54 #include "platform/LengthFunctions.h" |
55 | 55 |
56 namespace blink { | 56 namespace blink { |
57 | 57 |
58 inline static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedPixelValue(d
ouble value, const LayoutStyle& style) | 58 inline static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedPixelValue(d
ouble value, const ComputedStyle& style) |
59 { | 59 { |
60 return cssValuePool().createValue(adjustFloatForAbsoluteZoom(value, style),
CSSPrimitiveValue::CSS_PX); | 60 return cssValuePool().createValue(adjustFloatForAbsoluteZoom(value, style),
CSSPrimitiveValue::CSS_PX); |
61 } | 61 } |
62 | 62 |
63 inline static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedNumberValue(
double value, const LayoutStyle& style) | 63 inline static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedNumberValue(
double value, const ComputedStyle& style) |
64 { | 64 { |
65 return cssValuePool().createValue(value / style.effectiveZoom(), CSSPrimitiv
eValue::CSS_NUMBER); | 65 return cssValuePool().createValue(value / style.effectiveZoom(), CSSPrimitiv
eValue::CSS_NUMBER); |
66 } | 66 } |
67 | 67 |
68 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedPixelValueForLength
(const Length& length, const LayoutStyle& style) | 68 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedPixelValueForLength
(const Length& length, const ComputedStyle& style) |
69 { | 69 { |
70 if (length.isFixed()) | 70 if (length.isFixed()) |
71 return zoomAdjustedPixelValue(length.value(), style); | 71 return zoomAdjustedPixelValue(length.value(), style); |
72 return cssValuePool().createValue(length, style); | 72 return cssValuePool().createValue(length, style); |
73 } | 73 } |
74 | 74 |
75 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> pixelValueForUnzoomedLength(con
st UnzoomedLength& unzoomedLength, const LayoutStyle& style) | 75 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> pixelValueForUnzoomedLength(con
st UnzoomedLength& unzoomedLength, const ComputedStyle& style) |
76 { | 76 { |
77 const Length& length = unzoomedLength.length(); | 77 const Length& length = unzoomedLength.length(); |
78 if (length.isFixed()) | 78 if (length.isFixed()) |
79 return cssValuePool().createValue(length.value(), CSSPrimitiveValue::CSS
_PX); | 79 return cssValuePool().createValue(length.value(), CSSPrimitiveValue::CSS
_PX); |
80 return cssValuePool().createValue(length, style); | 80 return cssValuePool().createValue(length, style); |
81 } | 81 } |
82 | 82 |
83 static PassRefPtrWillBeRawPtr<CSSValueList> createPositionListForLayer(CSSProper
tyID propertyID, const FillLayer& layer, const LayoutStyle& style) | 83 static PassRefPtrWillBeRawPtr<CSSValueList> createPositionListForLayer(CSSProper
tyID propertyID, const FillLayer& layer, const ComputedStyle& style) |
84 { | 84 { |
85 RefPtrWillBeRawPtr<CSSValueList> positionList = CSSValueList::createSpaceSep
arated(); | 85 RefPtrWillBeRawPtr<CSSValueList> positionList = CSSValueList::createSpaceSep
arated(); |
86 if (layer.isBackgroundXOriginSet()) { | 86 if (layer.isBackgroundXOriginSet()) { |
87 ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPosition ||
propertyID == CSSPropertyWebkitMaskPosition); | 87 ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPosition ||
propertyID == CSSPropertyWebkitMaskPosition); |
88 positionList->append(cssValuePool().createValue(layer.backgroundXOrigin(
))); | 88 positionList->append(cssValuePool().createValue(layer.backgroundXOrigin(
))); |
89 } | 89 } |
90 positionList->append(zoomAdjustedPixelValueForLength(layer.xPosition(), styl
e)); | 90 positionList->append(zoomAdjustedPixelValueForLength(layer.xPosition(), styl
e)); |
91 if (layer.isBackgroundYOriginSet()) { | 91 if (layer.isBackgroundYOriginSet()) { |
92 ASSERT(propertyID == CSSPropertyBackgroundPosition || propertyID == CSSP
ropertyWebkitMaskPosition); | 92 ASSERT(propertyID == CSSPropertyBackgroundPosition || propertyID == CSSP
ropertyWebkitMaskPosition); |
93 positionList->append(cssValuePool().createValue(layer.backgroundYOrigin(
))); | 93 positionList->append(cssValuePool().createValue(layer.backgroundYOrigin(
))); |
94 } | 94 } |
95 positionList->append(zoomAdjustedPixelValueForLength(layer.yPosition(), styl
e)); | 95 positionList->append(zoomAdjustedPixelValueForLength(layer.yPosition(), styl
e)); |
96 return positionList.release(); | 96 return positionList.release(); |
97 } | 97 } |
98 | 98 |
99 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> LayoutStyleCSSValueMapping::currentCol
orOrValidColor(const LayoutStyle& style, const StyleColor& color) | 99 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> ComputedStyleCSSValueMapping::currentC
olorOrValidColor(const ComputedStyle& style, const StyleColor& color) |
100 { | 100 { |
101 // This function does NOT look at visited information, so that computed styl
e doesn't expose that. | 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()); | 102 return cssValuePool().createColorValue(color.resolve(style.color()).rgb()); |
103 } | 103 } |
104 | 104 |
105 static PassRefPtrWillBeRawPtr<CSSValue> valueForFillSize(const FillSize& fillSiz
e, const LayoutStyle& style) | 105 static PassRefPtrWillBeRawPtr<CSSValue> valueForFillSize(const FillSize& fillSiz
e, const ComputedStyle& style) |
106 { | 106 { |
107 if (fillSize.type == Contain) | 107 if (fillSize.type == Contain) |
108 return cssValuePool().createIdentifierValue(CSSValueContain); | 108 return cssValuePool().createIdentifierValue(CSSValueContain); |
109 | 109 |
110 if (fillSize.type == Cover) | 110 if (fillSize.type == Cover) |
111 return cssValuePool().createIdentifierValue(CSSValueCover); | 111 return cssValuePool().createIdentifierValue(CSSValueCover); |
112 | 112 |
113 if (fillSize.size.height().isAuto()) | 113 if (fillSize.size.height().isAuto()) |
114 return zoomAdjustedPixelValueForLength(fillSize.size.width(), style); | 114 return zoomAdjustedPixelValueForLength(fillSize.size.width(), style); |
115 | 115 |
(...skipping 27 matching lines...) Expand all Loading... |
143 return cssValuePool().createValue(CSSValueAlpha); | 143 return cssValuePool().createValue(CSSValueAlpha); |
144 case MaskLuminance: | 144 case MaskLuminance: |
145 return cssValuePool().createValue(CSSValueLuminance); | 145 return cssValuePool().createValue(CSSValueLuminance); |
146 } | 146 } |
147 | 147 |
148 ASSERT_NOT_REACHED(); | 148 ASSERT_NOT_REACHED(); |
149 | 149 |
150 return nullptr; | 150 return nullptr; |
151 } | 151 } |
152 | 152 |
153 static PassRefPtrWillBeRawPtr<CSSValue> valueForPositionOffset(const LayoutStyle
& style, CSSPropertyID propertyID, const LayoutObject* renderer) | 153 static PassRefPtrWillBeRawPtr<CSSValue> valueForPositionOffset(const ComputedSty
le& style, CSSPropertyID propertyID, const LayoutObject* renderer) |
154 { | 154 { |
155 Length offset; | 155 Length offset; |
156 switch (propertyID) { | 156 switch (propertyID) { |
157 case CSSPropertyLeft: | 157 case CSSPropertyLeft: |
158 offset = style.left(); | 158 offset = style.left(); |
159 break; | 159 break; |
160 case CSSPropertyRight: | 160 case CSSPropertyRight: |
161 offset = style.right(); | 161 offset = style.right(); |
162 break; | 162 break; |
163 case CSSPropertyTop: | 163 case CSSPropertyTop: |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 232 |
233 RefPtrWillBeRawPtr<Quad> quad = Quad::create(); | 233 RefPtrWillBeRawPtr<Quad> quad = Quad::create(); |
234 quad->setTop(top); | 234 quad->setTop(top); |
235 quad->setRight(right); | 235 quad->setRight(right); |
236 quad->setBottom(bottom); | 236 quad->setBottom(bottom); |
237 quad->setLeft(left); | 237 quad->setLeft(left); |
238 | 238 |
239 return CSSBorderImageSliceValue::create(cssValuePool().createValue(quad.rele
ase()), image.fill()); | 239 return CSSBorderImageSliceValue::create(cssValuePool().createValue(quad.rele
ase()), image.fill()); |
240 } | 240 } |
241 | 241 |
242 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForNinePieceImageQuad(cons
t BorderImageLengthBox& box, const LayoutStyle& style) | 242 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForNinePieceImageQuad(cons
t BorderImageLengthBox& box, const ComputedStyle& style) |
243 { | 243 { |
244 // Create the slices. | 244 // Create the slices. |
245 RefPtrWillBeRawPtr<CSSPrimitiveValue> top = nullptr; | 245 RefPtrWillBeRawPtr<CSSPrimitiveValue> top = nullptr; |
246 RefPtrWillBeRawPtr<CSSPrimitiveValue> right = nullptr; | 246 RefPtrWillBeRawPtr<CSSPrimitiveValue> right = nullptr; |
247 RefPtrWillBeRawPtr<CSSPrimitiveValue> bottom = nullptr; | 247 RefPtrWillBeRawPtr<CSSPrimitiveValue> bottom = nullptr; |
248 RefPtrWillBeRawPtr<CSSPrimitiveValue> left = nullptr; | 248 RefPtrWillBeRawPtr<CSSPrimitiveValue> left = nullptr; |
249 | 249 |
250 if (box.top().isNumber()) | 250 if (box.top().isNumber()) |
251 top = cssValuePool().createValue(box.top().number(), CSSPrimitiveValue::
CSS_NUMBER); | 251 top = cssValuePool().createValue(box.top().number(), CSSPrimitiveValue::
CSS_NUMBER); |
252 else | 252 else |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalRepeat = nullptr; | 311 RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalRepeat = nullptr; |
312 | 312 |
313 horizontalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(i
mage.horizontalRule())); | 313 horizontalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(i
mage.horizontalRule())); |
314 if (image.horizontalRule() == image.verticalRule()) | 314 if (image.horizontalRule() == image.verticalRule()) |
315 verticalRepeat = horizontalRepeat; | 315 verticalRepeat = horizontalRepeat; |
316 else | 316 else |
317 verticalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule
(image.verticalRule())); | 317 verticalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule
(image.verticalRule())); |
318 return cssValuePool().createValue(Pair::create(horizontalRepeat.release(), v
erticalRepeat.release(), Pair::DropIdenticalValues)); | 318 return cssValuePool().createValue(Pair::create(horizontalRepeat.release(), v
erticalRepeat.release(), Pair::DropIdenticalValues)); |
319 } | 319 } |
320 | 320 |
321 static PassRefPtrWillBeRawPtr<CSSValue> valueForNinePieceImage(const NinePieceIm
age& image, const LayoutStyle& style) | 321 static PassRefPtrWillBeRawPtr<CSSValue> valueForNinePieceImage(const NinePieceIm
age& image, const ComputedStyle& style) |
322 { | 322 { |
323 if (!image.hasImage()) | 323 if (!image.hasImage()) |
324 return cssValuePool().createIdentifierValue(CSSValueNone); | 324 return cssValuePool().createIdentifierValue(CSSValueNone); |
325 | 325 |
326 // Image first. | 326 // Image first. |
327 RefPtrWillBeRawPtr<CSSValue> imageValue = nullptr; | 327 RefPtrWillBeRawPtr<CSSValue> imageValue = nullptr; |
328 if (image.image()) | 328 if (image.image()) |
329 imageValue = image.image()->cssValue(); | 329 imageValue = image.image()->cssValue(); |
330 | 330 |
331 // Create the image slice. | 331 // Create the image slice. |
332 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> imageSlices = valueForNinePiece
ImageSlice(image); | 332 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> imageSlices = valueForNinePiece
ImageSlice(image); |
333 | 333 |
334 // Create the border area slices. | 334 // Create the border area slices. |
335 RefPtrWillBeRawPtr<CSSValue> borderSlices = valueForNinePieceImageQuad(image
.borderSlices(), style); | 335 RefPtrWillBeRawPtr<CSSValue> borderSlices = valueForNinePieceImageQuad(image
.borderSlices(), style); |
336 | 336 |
337 // Create the border outset. | 337 // Create the border outset. |
338 RefPtrWillBeRawPtr<CSSValue> outset = valueForNinePieceImageQuad(image.outse
t(), style); | 338 RefPtrWillBeRawPtr<CSSValue> outset = valueForNinePieceImageQuad(image.outse
t(), style); |
339 | 339 |
340 // Create the repeat rules. | 340 // Create the repeat rules. |
341 RefPtrWillBeRawPtr<CSSValue> repeat = valueForNinePieceImageRepeat(image); | 341 RefPtrWillBeRawPtr<CSSValue> repeat = valueForNinePieceImageRepeat(image); |
342 | 342 |
343 return createBorderImageValue(imageValue.release(), imageSlices.release(), b
orderSlices.release(), outset.release(), repeat.release()); | 343 return createBorderImageValue(imageValue.release(), imageSlices.release(), b
orderSlices.release(), outset.release(), repeat.release()); |
344 } | 344 } |
345 | 345 |
346 static PassRefPtrWillBeRawPtr<CSSValue> valueForReflection(const StyleReflection
* reflection, const LayoutStyle& style) | 346 static PassRefPtrWillBeRawPtr<CSSValue> valueForReflection(const StyleReflection
* reflection, const ComputedStyle& style) |
347 { | 347 { |
348 if (!reflection) | 348 if (!reflection) |
349 return cssValuePool().createIdentifierValue(CSSValueNone); | 349 return cssValuePool().createIdentifierValue(CSSValueNone); |
350 | 350 |
351 RefPtrWillBeRawPtr<CSSPrimitiveValue> offset = nullptr; | 351 RefPtrWillBeRawPtr<CSSPrimitiveValue> offset = nullptr; |
352 if (reflection->offset().isPercent()) | 352 if (reflection->offset().isPercent()) |
353 offset = cssValuePool().createValue(reflection->offset().percent(), CSSP
rimitiveValue::CSS_PERCENTAGE); | 353 offset = cssValuePool().createValue(reflection->offset().percent(), CSSP
rimitiveValue::CSS_PERCENTAGE); |
354 else | 354 else |
355 offset = zoomAdjustedPixelValue(reflection->offset().value(), style); | 355 offset = zoomAdjustedPixelValue(reflection->offset().value(), style); |
356 | 356 |
(...skipping 14 matching lines...) Expand all Loading... |
371 } | 371 } |
372 | 372 |
373 return CSSReflectValue::create(direction.release(), offset.release(), valueF
orNinePieceImage(reflection->mask(), style)); | 373 return CSSReflectValue::create(direction.release(), offset.release(), valueF
orNinePieceImage(reflection->mask(), style)); |
374 } | 374 } |
375 | 375 |
376 static ItemPosition resolveAlignmentAuto(ItemPosition position, Node* element) | 376 static ItemPosition resolveAlignmentAuto(ItemPosition position, Node* element) |
377 { | 377 { |
378 if (position != ItemPositionAuto) | 378 if (position != ItemPositionAuto) |
379 return position; | 379 return position; |
380 | 380 |
381 bool isFlexOrGrid = element && element->computedStyle() | 381 bool isFlexOrGrid = element && element->ensureComputedStyle() |
382 && element->computedStyle()->isDisplayFlexibleOrGridBox(); | 382 && element->ensureComputedStyle()->isDisplayFlexibleOrGridBox(); |
383 | 383 |
384 return isFlexOrGrid ? ItemPositionStretch : ItemPositionStart; | 384 return isFlexOrGrid ? ItemPositionStretch : ItemPositionStart; |
385 } | 385 } |
386 | 386 |
387 static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlig
nment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, ItemPositi
onType positionType) | 387 static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlig
nment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, ItemPositi
onType positionType) |
388 { | 388 { |
389 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated
(); | 389 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated
(); |
390 if (positionType == LegacyPosition) | 390 if (positionType == LegacyPosition) |
391 result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy)); | 391 result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy)); |
392 result->append(CSSPrimitiveValue::create(itemPosition)); | 392 result->append(CSSPrimitiveValue::create(itemPosition)); |
393 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign
mentDefault) | 393 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign
mentDefault) |
394 result->append(CSSPrimitiveValue::create(overflowAlignment)); | 394 result->append(CSSPrimitiveValue::create(overflowAlignment)); |
395 ASSERT(result->length() <= 2); | 395 ASSERT(result->length() <= 2); |
396 return result.release(); | 396 return result.release(); |
397 } | 397 } |
398 | 398 |
399 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForGridShorthand(const StylePr
opertyShorthand& shorthand, const LayoutStyle& style, const LayoutObject* render
er, Node* styledNode, bool allowVisitedStyle) | 399 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForGridShorthand(const StylePr
opertyShorthand& shorthand, const ComputedStyle& style, const LayoutObject* rend
erer, Node* styledNode, bool allowVisitedStyle) |
400 { | 400 { |
401 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated()
; | 401 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated()
; |
402 for (size_t i = 0; i < shorthand.length(); ++i) { | 402 for (size_t i = 0; i < shorthand.length(); ++i) { |
403 RefPtrWillBeRawPtr<CSSValue> value = LayoutStyleCSSValueMapping::get(sho
rthand.properties()[i], style, renderer, styledNode, allowVisitedStyle); | 403 RefPtrWillBeRawPtr<CSSValue> value = ComputedStyleCSSValueMapping::get(s
horthand.properties()[i], style, renderer, styledNode, allowVisitedStyle); |
404 ASSERT(value); | 404 ASSERT(value); |
405 list->append(value.release()); | 405 list->append(value.release()); |
406 } | 406 } |
407 return list.release(); | 407 return list.release(); |
408 } | 408 } |
409 | 409 |
410 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForShorthandProperty(const Sty
lePropertyShorthand& shorthand, const LayoutStyle& style, const LayoutObject* re
nderer, Node* styledNode, bool allowVisitedStyle) | 410 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForShorthandProperty(const Sty
lePropertyShorthand& shorthand, const ComputedStyle& style, const LayoutObject*
renderer, Node* styledNode, bool allowVisitedStyle) |
411 { | 411 { |
412 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 412 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
413 for (size_t i = 0; i < shorthand.length(); ++i) { | 413 for (size_t i = 0; i < shorthand.length(); ++i) { |
414 RefPtrWillBeRawPtr<CSSValue> value = LayoutStyleCSSValueMapping::get(sho
rthand.properties()[i], style, renderer, styledNode, allowVisitedStyle); | 414 RefPtrWillBeRawPtr<CSSValue> value = ComputedStyleCSSValueMapping::get(s
horthand.properties()[i], style, renderer, styledNode, allowVisitedStyle); |
415 ASSERT(value); | 415 ASSERT(value); |
416 list->append(value); | 416 list->append(value); |
417 } | 417 } |
418 return list.release(); | 418 return list.release(); |
419 } | 419 } |
420 | 420 |
421 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForBackgroundShorthand(const L
ayoutStyle& style, const LayoutObject* renderer, Node* styledNode, bool allowVis
itedStyle) | 421 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForBackgroundShorthand(const C
omputedStyle& style, const LayoutObject* renderer, Node* styledNode, bool allowV
isitedStyle) |
422 { | 422 { |
423 RefPtrWillBeRawPtr<CSSValueList> ret = CSSValueList::createCommaSeparated(); | 423 RefPtrWillBeRawPtr<CSSValueList> ret = CSSValueList::createCommaSeparated(); |
424 const FillLayer* currLayer = &style.backgroundLayers(); | 424 const FillLayer* currLayer = &style.backgroundLayers(); |
425 for (; currLayer; currLayer = currLayer->next()) { | 425 for (; currLayer; currLayer = currLayer->next()) { |
426 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparat
ed(); | 426 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparat
ed(); |
427 RefPtrWillBeRawPtr<CSSValueList> beforeSlash = CSSValueList::createSpace
Separated(); | 427 RefPtrWillBeRawPtr<CSSValueList> beforeSlash = CSSValueList::createSpace
Separated(); |
428 if (!currLayer->next()) { // color only for final layer | 428 if (!currLayer->next()) { // color only for final layer |
429 RefPtrWillBeRawPtr<CSSValue> value = LayoutStyleCSSValueMapping::get
(CSSPropertyBackgroundColor, style, renderer, styledNode, allowVisitedStyle); | 429 RefPtrWillBeRawPtr<CSSValue> value = ComputedStyleCSSValueMapping::g
et(CSSPropertyBackgroundColor, style, renderer, styledNode, allowVisitedStyle); |
430 ASSERT(value); | 430 ASSERT(value); |
431 beforeSlash->append(value); | 431 beforeSlash->append(value); |
432 } | 432 } |
433 beforeSlash->append(currLayer->image() ? currLayer->image()->cssValue()
: cssValuePool().createIdentifierValue(CSSValueNone)); | 433 beforeSlash->append(currLayer->image() ? currLayer->image()->cssValue()
: cssValuePool().createIdentifierValue(CSSValueNone)); |
434 beforeSlash->append(valueForFillRepeat(currLayer->repeatX(), currLayer->
repeatY())); | 434 beforeSlash->append(valueForFillRepeat(currLayer->repeatX(), currLayer->
repeatY())); |
435 beforeSlash->append(cssValuePool().createValue(currLayer->attachment()))
; | 435 beforeSlash->append(cssValuePool().createValue(currLayer->attachment()))
; |
436 beforeSlash->append(createPositionListForLayer(CSSPropertyBackgroundPosi
tion, *currLayer, style)); | 436 beforeSlash->append(createPositionListForLayer(CSSPropertyBackgroundPosi
tion, *currLayer, style)); |
437 list->append(beforeSlash); | 437 list->append(beforeSlash); |
438 RefPtrWillBeRawPtr<CSSValueList> afterSlash = CSSValueList::createSpaceS
eparated(); | 438 RefPtrWillBeRawPtr<CSSValueList> afterSlash = CSSValueList::createSpaceS
eparated(); |
439 afterSlash->append(valueForFillSize(currLayer->size(), style)); | 439 afterSlash->append(valueForFillSize(currLayer->size(), style)); |
440 afterSlash->append(cssValuePool().createValue(currLayer->origin())); | 440 afterSlash->append(cssValuePool().createValue(currLayer->origin())); |
441 afterSlash->append(cssValuePool().createValue(currLayer->clip())); | 441 afterSlash->append(cssValuePool().createValue(currLayer->clip())); |
442 list->append(afterSlash); | 442 list->append(afterSlash); |
443 ret->append(list); | 443 ret->append(list); |
444 } | 444 } |
445 return ret.release(); | 445 return ret.release(); |
446 } | 446 } |
447 | 447 |
448 static ContentPosition resolveContentAlignmentAuto(ContentPosition position, Con
tentDistributionType distribution, Node* element) | 448 static ContentPosition resolveContentAlignmentAuto(ContentPosition position, Con
tentDistributionType distribution, Node* element) |
449 { | 449 { |
450 if (position != ContentPositionAuto || distribution != ContentDistributionDe
fault) | 450 if (position != ContentPositionAuto || distribution != ContentDistributionDe
fault) |
451 return position; | 451 return position; |
452 | 452 |
453 bool isFlex = element && element->computedStyle() | 453 bool isFlex = element && element->ensureComputedStyle() |
454 && element->computedStyle()->isDisplayFlexibleBox(); | 454 && element->ensureComputedStyle()->isDisplayFlexibleBox(); |
455 | 455 |
456 return isFlex ? ContentPositionFlexStart : ContentPositionStart; | 456 return isFlex ? ContentPositionFlexStart : ContentPositionStart; |
457 } | 457 } |
458 | 458 |
459 static PassRefPtrWillBeRawPtr<CSSValueList> valueForContentPositionAndDistributi
onWithOverflowAlignment(ContentPosition position, OverflowAlignment overflowAlig
nment, ContentDistributionType distribution) | 459 static PassRefPtrWillBeRawPtr<CSSValueList> valueForContentPositionAndDistributi
onWithOverflowAlignment(ContentPosition position, OverflowAlignment overflowAlig
nment, ContentDistributionType distribution) |
460 { | 460 { |
461 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated
(); | 461 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated
(); |
462 if (distribution != ContentDistributionDefault) | 462 if (distribution != ContentDistributionDefault) |
463 result->append(CSSPrimitiveValue::create(distribution)); | 463 result->append(CSSPrimitiveValue::create(distribution)); |
464 if (distribution == ContentDistributionDefault || position != ContentPositio
nAuto) | 464 if (distribution == ContentDistributionDefault || position != ContentPositio
nAuto) |
465 result->append(CSSPrimitiveValue::create(position)); | 465 result->append(CSSPrimitiveValue::create(position)); |
466 if ((position >= ContentPositionCenter || distribution != ContentDistributio
nDefault) && overflowAlignment != OverflowAlignmentDefault) | 466 if ((position >= ContentPositionCenter || distribution != ContentDistributio
nDefault) && overflowAlignment != OverflowAlignmentDefault) |
467 result->append(CSSPrimitiveValue::create(overflowAlignment)); | 467 result->append(CSSPrimitiveValue::create(overflowAlignment)); |
468 ASSERT(result->length() > 0); | 468 ASSERT(result->length() > 0); |
469 ASSERT(result->length() <= 3); | 469 ASSERT(result->length() <= 3); |
470 return result.release(); | 470 return result.release(); |
471 } | 471 } |
472 | 472 |
473 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForLineHeight(const Layout
Style& style) | 473 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForLineHeight(const Comput
edStyle& style) |
474 { | 474 { |
475 Length length = style.lineHeight(); | 475 Length length = style.lineHeight(); |
476 if (length.isNegative()) | 476 if (length.isNegative()) |
477 return cssValuePool().createIdentifierValue(CSSValueNormal); | 477 return cssValuePool().createIdentifierValue(CSSValueNormal); |
478 | 478 |
479 float floatValue = floatValueForLength(length, style.fontDescription().speci
fiedSize()); | 479 float floatValue = floatValueForLength(length, style.fontDescription().speci
fiedSize()); |
480 if (length.isPercent()) | 480 if (length.isPercent()) |
481 return cssValuePool().createValue(floatValue, CSSPrimitiveValue::CSS_PX)
; | 481 return cssValuePool().createValue(floatValue, CSSPrimitiveValue::CSS_PX)
; |
482 | 482 |
483 return zoomAdjustedPixelValue(floatValue, style); | 483 return zoomAdjustedPixelValue(floatValue, style); |
(...skipping 16 matching lines...) Expand all Loading... |
500 return CSSValueInvalid; | 500 return CSSValueInvalid; |
501 } | 501 } |
502 | 502 |
503 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFamily(const AtomicStri
ng& family) | 503 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFamily(const AtomicStri
ng& family) |
504 { | 504 { |
505 if (CSSValueID familyIdentifier = identifierForFamily(family)) | 505 if (CSSValueID familyIdentifier = identifierForFamily(family)) |
506 return cssValuePool().createIdentifierValue(familyIdentifier); | 506 return cssValuePool().createIdentifierValue(familyIdentifier); |
507 return cssValuePool().createValue(family.string(), CSSPrimitiveValue::CSS_CU
STOM_IDENT); | 507 return cssValuePool().createValue(family.string(), CSSPrimitiveValue::CSS_CU
STOM_IDENT); |
508 } | 508 } |
509 | 509 |
510 static PassRefPtrWillBeRawPtr<CSSValueList> valueForFontFamily(const LayoutStyle
& style) | 510 static PassRefPtrWillBeRawPtr<CSSValueList> valueForFontFamily(const ComputedSty
le& style) |
511 { | 511 { |
512 const FontFamily& firstFamily = style.fontDescription().family(); | 512 const FontFamily& firstFamily = style.fontDescription().family(); |
513 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 513 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; |
514 for (const FontFamily* family = &firstFamily; family; family = family->next(
)) | 514 for (const FontFamily* family = &firstFamily; family; family = family->next(
)) |
515 list->append(valueForFamily(family->family())); | 515 list->append(valueForFamily(family->family())); |
516 return list.release(); | 516 return list.release(); |
517 } | 517 } |
518 | 518 |
519 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontSize(const LayoutSt
yle& style) | 519 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontSize(const Computed
Style& style) |
520 { | 520 { |
521 return zoomAdjustedPixelValue(style.fontDescription().computedSize(), style)
; | 521 return zoomAdjustedPixelValue(style.fontDescription().computedSize(), style)
; |
522 } | 522 } |
523 | 523 |
524 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStretch(const Layou
tStyle& style) | 524 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStretch(const Compu
tedStyle& style) |
525 { | 525 { |
526 return cssValuePool().createValue(style.fontDescription().stretch()); | 526 return cssValuePool().createValue(style.fontDescription().stretch()); |
527 } | 527 } |
528 | 528 |
529 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStyle(const LayoutS
tyle& style) | 529 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStyle(const Compute
dStyle& style) |
530 { | 530 { |
531 return cssValuePool().createValue(style.fontDescription().style()); | 531 return cssValuePool().createValue(style.fontDescription().style()); |
532 } | 532 } |
533 | 533 |
534 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontVariant(const Layou
tStyle& style) | 534 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontVariant(const Compu
tedStyle& style) |
535 { | 535 { |
536 return cssValuePool().createValue(style.fontDescription().variant()); | 536 return cssValuePool().createValue(style.fontDescription().variant()); |
537 } | 537 } |
538 | 538 |
539 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontWeight(const Layout
Style& style) | 539 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontWeight(const Comput
edStyle& style) |
540 { | 540 { |
541 return cssValuePool().createValue(style.fontDescription().weight()); | 541 return cssValuePool().createValue(style.fontDescription().weight()); |
542 } | 542 } |
543 | 543 |
544 static PassRefPtrWillBeRawPtr<CSSValue> specifiedValueForGridTrackBreadth(const
GridLength& trackBreadth, const LayoutStyle& style) | 544 static PassRefPtrWillBeRawPtr<CSSValue> specifiedValueForGridTrackBreadth(const
GridLength& trackBreadth, const ComputedStyle& style) |
545 { | 545 { |
546 if (!trackBreadth.isLength()) | 546 if (!trackBreadth.isLength()) |
547 return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue
::CSS_FR); | 547 return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue
::CSS_FR); |
548 | 548 |
549 const Length& trackBreadthLength = trackBreadth.length(); | 549 const Length& trackBreadthLength = trackBreadth.length(); |
550 if (trackBreadthLength.isAuto()) | 550 if (trackBreadthLength.isAuto()) |
551 return cssValuePool().createIdentifierValue(CSSValueAuto); | 551 return cssValuePool().createIdentifierValue(CSSValueAuto); |
552 return zoomAdjustedPixelValueForLength(trackBreadthLength, style); | 552 return zoomAdjustedPixelValueForLength(trackBreadthLength, style); |
553 } | 553 } |
554 | 554 |
555 static PassRefPtrWillBeRawPtr<CSSValue> specifiedValueForGridTrackSize(const Gri
dTrackSize& trackSize, const LayoutStyle& style) | 555 static PassRefPtrWillBeRawPtr<CSSValue> specifiedValueForGridTrackSize(const Gri
dTrackSize& trackSize, const ComputedStyle& style) |
556 { | 556 { |
557 switch (trackSize.type()) { | 557 switch (trackSize.type()) { |
558 case LengthTrackSizing: | 558 case LengthTrackSizing: |
559 return specifiedValueForGridTrackBreadth(trackSize.length(), style); | 559 return specifiedValueForGridTrackBreadth(trackSize.length(), style); |
560 case MinMaxTrackSizing: | 560 case MinMaxTrackSizing: |
561 RefPtrWillBeRawPtr<CSSFunctionValue> minMaxTrackBreadths = CSSFunctionVa
lue::create(CSSValueMinmax); | 561 RefPtrWillBeRawPtr<CSSFunctionValue> minMaxTrackBreadths = CSSFunctionVa
lue::create(CSSValueMinmax); |
562 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.
minTrackBreadth(), style)); | 562 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.
minTrackBreadth(), style)); |
563 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.
maxTrackBreadth(), style)); | 563 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.
maxTrackBreadth(), style)); |
564 return minMaxTrackBreadths.release(); | 564 return minMaxTrackBreadths.release(); |
565 } | 565 } |
566 ASSERT_NOT_REACHED(); | 566 ASSERT_NOT_REACHED(); |
567 return nullptr; | 567 return nullptr; |
568 } | 568 } |
569 | 569 |
570 static void addValuesForNamedGridLinesAtIndex(const OrderedNamedGridLines& order
edNamedGridLines, size_t i, CSSValueList& list) | 570 static void addValuesForNamedGridLinesAtIndex(const OrderedNamedGridLines& order
edNamedGridLines, size_t i, CSSValueList& list) |
571 { | 571 { |
572 const Vector<String>& namedGridLines = orderedNamedGridLines.get(i); | 572 const Vector<String>& namedGridLines = orderedNamedGridLines.get(i); |
573 if (namedGridLines.isEmpty()) | 573 if (namedGridLines.isEmpty()) |
574 return; | 574 return; |
575 | 575 |
576 RefPtrWillBeRawPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue:
:create(); | 576 RefPtrWillBeRawPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue:
:create(); |
577 for (size_t j = 0; j < namedGridLines.size(); ++j) | 577 for (size_t j = 0; j < namedGridLines.size(); ++j) |
578 lineNames->append(cssValuePool().createValue(namedGridLines[j], CSSPrimi
tiveValue::CSS_CUSTOM_IDENT)); | 578 lineNames->append(cssValuePool().createValue(namedGridLines[j], CSSPrimi
tiveValue::CSS_CUSTOM_IDENT)); |
579 list.append(lineNames.release()); | 579 list.append(lineNames.release()); |
580 } | 580 } |
581 | 581 |
582 static PassRefPtrWillBeRawPtr<CSSValue> valueForGridTrackList(GridTrackSizingDir
ection direction, const LayoutObject* renderer, const LayoutStyle& style) | 582 static PassRefPtrWillBeRawPtr<CSSValue> valueForGridTrackList(GridTrackSizingDir
ection direction, const LayoutObject* renderer, const ComputedStyle& style) |
583 { | 583 { |
584 const Vector<GridTrackSize>& trackSizes = direction == ForColumns ? style.gr
idTemplateColumns() : style.gridTemplateRows(); | 584 const Vector<GridTrackSize>& trackSizes = direction == ForColumns ? style.gr
idTemplateColumns() : style.gridTemplateRows(); |
585 const OrderedNamedGridLines& orderedNamedGridLines = direction == ForColumns
? style.orderedNamedGridColumnLines() : style.orderedNamedGridRowLines(); | 585 const OrderedNamedGridLines& orderedNamedGridLines = direction == ForColumns
? style.orderedNamedGridColumnLines() : style.orderedNamedGridRowLines(); |
586 bool isLayoutGrid = renderer && renderer->isLayoutGrid(); | 586 bool isLayoutGrid = renderer && renderer->isLayoutGrid(); |
587 | 587 |
588 // Handle the 'none' case. | 588 // Handle the 'none' case. |
589 bool trackListIsEmpty = trackSizes.isEmpty(); | 589 bool trackListIsEmpty = trackSizes.isEmpty(); |
590 if (isLayoutGrid && trackListIsEmpty) { | 590 if (isLayoutGrid && trackListIsEmpty) { |
591 // For grids we should consider every listed track, whether implicitly o
r explicitly created. If we don't have | 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 | 592 // any explicit track and there are no children then there are no implic
it tracks. We cannot simply check the |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 864 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; |
865 if (timingData) { | 865 if (timingData) { |
866 for (size_t i = 0; i < timingData->timingFunctionList().size(); ++i) | 866 for (size_t i = 0; i < timingData->timingFunctionList().size(); ++i) |
867 list->append(createTimingFunctionValue(timingData->timingFunctionLis
t()[i].get())); | 867 list->append(createTimingFunctionValue(timingData->timingFunctionLis
t()[i].get())); |
868 } else { | 868 } else { |
869 list->append(createTimingFunctionValue(CSSTimingData::initialTimingFunct
ion().get())); | 869 list->append(createTimingFunctionValue(CSSTimingData::initialTimingFunct
ion().get())); |
870 } | 870 } |
871 return list.release(); | 871 return list.release(); |
872 } | 872 } |
873 | 873 |
874 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForBorderRadiusCorner(LengthSi
ze radius, const LayoutStyle& style) | 874 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForBorderRadiusCorner(LengthSi
ze radius, const ComputedStyle& style) |
875 { | 875 { |
876 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 876 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
877 if (radius.width().type() == Percent) | 877 if (radius.width().type() == Percent) |
878 list->append(cssValuePool().createValue(radius.width().percent(), CSSPri
mitiveValue::CSS_PERCENTAGE)); | 878 list->append(cssValuePool().createValue(radius.width().percent(), CSSPri
mitiveValue::CSS_PERCENTAGE)); |
879 else | 879 else |
880 list->append(zoomAdjustedPixelValueForLength(radius.width(), style)); | 880 list->append(zoomAdjustedPixelValueForLength(radius.width(), style)); |
881 if (radius.height().type() == Percent) | 881 if (radius.height().type() == Percent) |
882 list->append(cssValuePool().createValue(radius.height().percent(), CSSPr
imitiveValue::CSS_PERCENTAGE)); | 882 list->append(cssValuePool().createValue(radius.height().percent(), CSSPr
imitiveValue::CSS_PERCENTAGE)); |
883 else | 883 else |
884 list->append(zoomAdjustedPixelValueForLength(radius.height(), style)); | 884 list->append(zoomAdjustedPixelValueForLength(radius.height(), style)); |
885 return list.release(); | 885 return list.release(); |
886 } | 886 } |
887 | 887 |
888 static PassRefPtrWillBeRawPtr<CSSValue> valueForBorderRadiusCorner(LengthSize ra
dius, const LayoutStyle& style) | 888 static PassRefPtrWillBeRawPtr<CSSValue> valueForBorderRadiusCorner(LengthSize ra
dius, const ComputedStyle& style) |
889 { | 889 { |
890 RefPtrWillBeRawPtr<CSSValueList> list = valuesForBorderRadiusCorner(radius,
style); | 890 RefPtrWillBeRawPtr<CSSValueList> list = valuesForBorderRadiusCorner(radius,
style); |
891 if (list->item(0)->equals(*list->item(1))) | 891 if (list->item(0)->equals(*list->item(1))) |
892 return list->item(0); | 892 return list->item(0); |
893 return list.release(); | 893 return list.release(); |
894 } | 894 } |
895 | 895 |
896 static PassRefPtrWillBeRawPtr<CSSFunctionValue> valueForMatrixTransform(const Tr
ansformationMatrix& transform, const LayoutStyle& style) | 896 static PassRefPtrWillBeRawPtr<CSSFunctionValue> valueForMatrixTransform(const Tr
ansformationMatrix& transform, const ComputedStyle& style) |
897 { | 897 { |
898 RefPtrWillBeRawPtr<CSSFunctionValue> transformValue = nullptr; | 898 RefPtrWillBeRawPtr<CSSFunctionValue> transformValue = nullptr; |
899 if (transform.isAffine()) { | 899 if (transform.isAffine()) { |
900 transformValue = CSSFunctionValue::create(CSSValueMatrix); | 900 transformValue = CSSFunctionValue::create(CSSValueMatrix); |
901 | 901 |
902 transformValue->append(cssValuePool().createValue(transform.a(), CSSPrim
itiveValue::CSS_NUMBER)); | 902 transformValue->append(cssValuePool().createValue(transform.a(), CSSPrim
itiveValue::CSS_NUMBER)); |
903 transformValue->append(cssValuePool().createValue(transform.b(), 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)); | 904 transformValue->append(cssValuePool().createValue(transform.c(), CSSPrim
itiveValue::CSS_NUMBER)); |
905 transformValue->append(cssValuePool().createValue(transform.d(), CSSPrim
itiveValue::CSS_NUMBER)); | 905 transformValue->append(cssValuePool().createValue(transform.d(), CSSPrim
itiveValue::CSS_NUMBER)); |
906 transformValue->append(zoomAdjustedNumberValue(transform.e(), style)); | 906 transformValue->append(zoomAdjustedNumberValue(transform.e(), style)); |
(...skipping 18 matching lines...) Expand all Loading... |
925 | 925 |
926 transformValue->append(zoomAdjustedNumberValue(transform.m41(), style)); | 926 transformValue->append(zoomAdjustedNumberValue(transform.m41(), style)); |
927 transformValue->append(zoomAdjustedNumberValue(transform.m42(), style)); | 927 transformValue->append(zoomAdjustedNumberValue(transform.m42(), style)); |
928 transformValue->append(zoomAdjustedNumberValue(transform.m43(), style)); | 928 transformValue->append(zoomAdjustedNumberValue(transform.m43(), style)); |
929 transformValue->append(cssValuePool().createValue(transform.m44(), CSSPr
imitiveValue::CSS_NUMBER)); | 929 transformValue->append(cssValuePool().createValue(transform.m44(), CSSPr
imitiveValue::CSS_NUMBER)); |
930 } | 930 } |
931 | 931 |
932 return transformValue.release(); | 932 return transformValue.release(); |
933 } | 933 } |
934 | 934 |
935 static PassRefPtrWillBeRawPtr<CSSValue> computedTransform(const LayoutObject* re
nderer, const LayoutStyle& style) | 935 static PassRefPtrWillBeRawPtr<CSSValue> computedTransform(const LayoutObject* re
nderer, const ComputedStyle& style) |
936 { | 936 { |
937 if (!renderer || !renderer->hasTransformRelatedProperty() || !style.hasTrans
form()) | 937 if (!renderer || !renderer->hasTransformRelatedProperty() || !style.hasTrans
form()) |
938 return cssValuePool().createIdentifierValue(CSSValueNone); | 938 return cssValuePool().createIdentifierValue(CSSValueNone); |
939 | 939 |
940 IntRect box; | 940 IntRect box; |
941 if (renderer->isBox()) | 941 if (renderer->isBox()) |
942 box = pixelSnappedIntRect(toLayoutBox(renderer)->borderBoxRect()); | 942 box = pixelSnappedIntRect(toLayoutBox(renderer)->borderBoxRect()); |
943 | 943 |
944 TransformationMatrix transform; | 944 TransformationMatrix transform; |
945 style.applyTransform(transform, LayoutSize(box.size()), LayoutStyle::Exclude
TransformOrigin, LayoutStyle::ExcludeMotionPath); | 945 style.applyTransform(transform, LayoutSize(box.size()), ComputedStyle::Exclu
deTransformOrigin, ComputedStyle::ExcludeMotionPath); |
946 | 946 |
947 // FIXME: Need to print out individual functions (https://bugs.webkit.org/sh
ow_bug.cgi?id=23924) | 947 // FIXME: Need to print out individual functions (https://bugs.webkit.org/sh
ow_bug.cgi?id=23924) |
948 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 948 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
949 list->append(valueForMatrixTransform(transform, style)); | 949 list->append(valueForMatrixTransform(transform, style)); |
950 | 950 |
951 return list.release(); | 951 return list.release(); |
952 } | 952 } |
953 | 953 |
954 static PassRefPtrWillBeRawPtr<CSSValue> createTransitionPropertyValue(const CSST
ransitionData::TransitionProperty& property) | 954 static PassRefPtrWillBeRawPtr<CSSValue> createTransitionPropertyValue(const CSST
ransitionData::TransitionProperty& property) |
955 { | 955 { |
(...skipping 19 matching lines...) Expand all Loading... |
975 return list.release(); | 975 return list.release(); |
976 } | 976 } |
977 | 977 |
978 static PassRefPtrWillBeRawPtr<CSSValue> createLineBoxContainValue(unsigned lineB
oxContain) | 978 static PassRefPtrWillBeRawPtr<CSSValue> createLineBoxContainValue(unsigned lineB
oxContain) |
979 { | 979 { |
980 if (!lineBoxContain) | 980 if (!lineBoxContain) |
981 return cssValuePool().createIdentifierValue(CSSValueNone); | 981 return cssValuePool().createIdentifierValue(CSSValueNone); |
982 return CSSLineBoxContainValue::create(lineBoxContain); | 982 return CSSLineBoxContainValue::create(lineBoxContain); |
983 } | 983 } |
984 | 984 |
985 static PassRefPtrWillBeRawPtr<CSSValue> valueForContentData(const LayoutStyle& s
tyle) | 985 static PassRefPtrWillBeRawPtr<CSSValue> valueForContentData(const ComputedStyle&
style) |
986 { | 986 { |
987 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 987 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
988 for (const ContentData* contentData = style.contentData(); contentData; cont
entData = contentData->next()) { | 988 for (const ContentData* contentData = style.contentData(); contentData; cont
entData = contentData->next()) { |
989 if (contentData->isCounter()) { | 989 if (contentData->isCounter()) { |
990 const CounterContent* counter = toCounterContentData(contentData)->c
ounter(); | 990 const CounterContent* counter = toCounterContentData(contentData)->c
ounter(); |
991 ASSERT(counter); | 991 ASSERT(counter); |
992 list->append(cssValuePool().createValue(counter->identifier(), CSSPr
imitiveValue::CSS_COUNTER_NAME)); | 992 list->append(cssValuePool().createValue(counter->identifier(), CSSPr
imitiveValue::CSS_COUNTER_NAME)); |
993 } else if (contentData->isImage()) { | 993 } else if (contentData->isImage()) { |
994 const StyleImage* image = toImageContentData(contentData)->image(); | 994 const StyleImage* image = toImageContentData(contentData)->image(); |
995 ASSERT(image); | 995 ASSERT(image); |
996 list->append(image->cssValue()); | 996 list->append(image->cssValue()); |
997 } else if (contentData->isText()) { | 997 } else if (contentData->isText()) { |
998 list->append(cssValuePool().createValue(toTextContentData(contentDat
a)->text(), CSSPrimitiveValue::CSS_STRING)); | 998 list->append(cssValuePool().createValue(toTextContentData(contentDat
a)->text(), CSSPrimitiveValue::CSS_STRING)); |
999 } | 999 } |
1000 } | 1000 } |
1001 return list.release(); | 1001 return list.release(); |
1002 } | 1002 } |
1003 | 1003 |
1004 static PassRefPtrWillBeRawPtr<CSSValue> valueForCounterDirectives(const LayoutSt
yle& style, CSSPropertyID propertyID) | 1004 static PassRefPtrWillBeRawPtr<CSSValue> valueForCounterDirectives(const Computed
Style& style, CSSPropertyID propertyID) |
1005 { | 1005 { |
1006 const CounterDirectiveMap* map = style.counterDirectives(); | 1006 const CounterDirectiveMap* map = style.counterDirectives(); |
1007 if (!map) | 1007 if (!map) |
1008 return cssValuePool().createIdentifierValue(CSSValueNone); | 1008 return cssValuePool().createIdentifierValue(CSSValueNone); |
1009 | 1009 |
1010 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 1010 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
1011 for (const auto& item : *map) { | 1011 for (const auto& item : *map) { |
1012 bool isValidCounterValue = propertyID == CSSPropertyCounterIncrement ? i
tem.value.isIncrement() : item.value.isReset(); | 1012 bool isValidCounterValue = propertyID == CSSPropertyCounterIncrement ? i
tem.value.isIncrement() : item.value.isReset(); |
1013 if (!isValidCounterValue) | 1013 if (!isValidCounterValue) |
1014 continue; | 1014 continue; |
1015 | 1015 |
1016 list->append(cssValuePool().createValue(item.key, CSSPrimitiveValue::CSS
_CUSTOM_IDENT)); | 1016 list->append(cssValuePool().createValue(item.key, CSSPrimitiveValue::CSS
_CUSTOM_IDENT)); |
1017 short number = propertyID == CSSPropertyCounterIncrement ? item.value.in
crementValue() : item.value.resetValue(); | 1017 short number = propertyID == CSSPropertyCounterIncrement ? item.value.in
crementValue() : item.value.resetValue(); |
1018 list->append(cssValuePool().createValue((double)number, CSSPrimitiveValu
e::CSS_NUMBER)); | 1018 list->append(cssValuePool().createValue((double)number, CSSPrimitiveValu
e::CSS_NUMBER)); |
1019 } | 1019 } |
1020 | 1020 |
1021 if (!list->length()) | 1021 if (!list->length()) |
1022 return cssValuePool().createIdentifierValue(CSSValueNone); | 1022 return cssValuePool().createIdentifierValue(CSSValueNone); |
1023 | 1023 |
1024 return list.release(); | 1024 return list.release(); |
1025 } | 1025 } |
1026 | 1026 |
1027 static PassRefPtrWillBeRawPtr<CSSValue> valueForShape(const LayoutStyle& style,
ShapeValue* shapeValue) | 1027 static PassRefPtrWillBeRawPtr<CSSValue> valueForShape(const ComputedStyle& style
, ShapeValue* shapeValue) |
1028 { | 1028 { |
1029 if (!shapeValue) | 1029 if (!shapeValue) |
1030 return cssValuePool().createIdentifierValue(CSSValueNone); | 1030 return cssValuePool().createIdentifierValue(CSSValueNone); |
1031 if (shapeValue->type() == ShapeValue::Box) | 1031 if (shapeValue->type() == ShapeValue::Box) |
1032 return cssValuePool().createValue(shapeValue->cssBox()); | 1032 return cssValuePool().createValue(shapeValue->cssBox()); |
1033 if (shapeValue->type() == ShapeValue::Image) { | 1033 if (shapeValue->type() == ShapeValue::Image) { |
1034 if (shapeValue->image()) | 1034 if (shapeValue->image()) |
1035 return shapeValue->image()->cssValue(); | 1035 return shapeValue->image()->cssValue(); |
1036 return cssValuePool().createIdentifierValue(CSSValueNone); | 1036 return cssValuePool().createIdentifierValue(CSSValueNone); |
1037 } | 1037 } |
1038 | 1038 |
1039 ASSERT(shapeValue->type() == ShapeValue::Shape); | 1039 ASSERT(shapeValue->type() == ShapeValue::Shape); |
1040 | 1040 |
1041 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 1041 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
1042 list->append(valueForBasicShape(style, shapeValue->shape())); | 1042 list->append(valueForBasicShape(style, shapeValue->shape())); |
1043 if (shapeValue->cssBox() != BoxMissing) | 1043 if (shapeValue->cssBox() != BoxMissing) |
1044 list->append(cssValuePool().createValue(shapeValue->cssBox())); | 1044 list->append(cssValuePool().createValue(shapeValue->cssBox())); |
1045 return list.release(); | 1045 return list.release(); |
1046 } | 1046 } |
1047 | 1047 |
1048 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForSidesShorthand(const StyleP
ropertyShorthand& shorthand, const LayoutStyle& style, const LayoutObject* rende
rer, Node* styledNode, bool allowVisitedStyle) | 1048 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForSidesShorthand(const StyleP
ropertyShorthand& shorthand, const ComputedStyle& style, const LayoutObject* ren
derer, Node* styledNode, bool allowVisitedStyle) |
1049 { | 1049 { |
1050 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 1050 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
1051 // Assume the properties are in the usual order top, right, bottom, left. | 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); | 1052 RefPtrWillBeRawPtr<CSSValue> topValue = ComputedStyleCSSValueMapping::get(sh
orthand.properties()[0], style, renderer, styledNode, allowVisitedStyle); |
1053 RefPtrWillBeRawPtr<CSSValue> rightValue = LayoutStyleCSSValueMapping::get(sh
orthand.properties()[1], style, renderer, styledNode, allowVisitedStyle); | 1053 RefPtrWillBeRawPtr<CSSValue> rightValue = ComputedStyleCSSValueMapping::get(
shorthand.properties()[1], style, renderer, styledNode, allowVisitedStyle); |
1054 RefPtrWillBeRawPtr<CSSValue> bottomValue = LayoutStyleCSSValueMapping::get(s
horthand.properties()[2], style, renderer, styledNode, allowVisitedStyle); | 1054 RefPtrWillBeRawPtr<CSSValue> bottomValue = ComputedStyleCSSValueMapping::get
(shorthand.properties()[2], style, renderer, styledNode, allowVisitedStyle); |
1055 RefPtrWillBeRawPtr<CSSValue> leftValue = LayoutStyleCSSValueMapping::get(sho
rthand.properties()[3], style, renderer, styledNode, allowVisitedStyle); | 1055 RefPtrWillBeRawPtr<CSSValue> leftValue = ComputedStyleCSSValueMapping::get(s
horthand.properties()[3], style, renderer, styledNode, allowVisitedStyle); |
1056 | 1056 |
1057 // All 4 properties must be specified. | 1057 // All 4 properties must be specified. |
1058 if (!topValue || !rightValue || !bottomValue || !leftValue) | 1058 if (!topValue || !rightValue || !bottomValue || !leftValue) |
1059 return nullptr; | 1059 return nullptr; |
1060 | 1060 |
1061 bool showLeft = !compareCSSValuePtr(rightValue, leftValue); | 1061 bool showLeft = !compareCSSValuePtr(rightValue, leftValue); |
1062 bool showBottom = !compareCSSValuePtr(topValue, bottomValue) || showLeft; | 1062 bool showBottom = !compareCSSValuePtr(topValue, bottomValue) || showLeft; |
1063 bool showRight = !compareCSSValuePtr(topValue, rightValue) || showBottom; | 1063 bool showRight = !compareCSSValuePtr(topValue, rightValue) || showBottom; |
1064 | 1064 |
1065 list->append(topValue.release()); | 1065 list->append(topValue.release()); |
1066 if (showRight) | 1066 if (showRight) |
1067 list->append(rightValue.release()); | 1067 list->append(rightValue.release()); |
1068 if (showBottom) | 1068 if (showBottom) |
1069 list->append(bottomValue.release()); | 1069 list->append(bottomValue.release()); |
1070 if (showLeft) | 1070 if (showLeft) |
1071 list->append(leftValue.release()); | 1071 list->append(leftValue.release()); |
1072 | 1072 |
1073 return list.release(); | 1073 return list.release(); |
1074 } | 1074 } |
1075 | 1075 |
1076 static PassRefPtrWillBeRawPtr<CSSValueList> valueForBorderRadiusShorthand(const
LayoutStyle& style) | 1076 static PassRefPtrWillBeRawPtr<CSSValueList> valueForBorderRadiusShorthand(const
ComputedStyle& style) |
1077 { | 1077 { |
1078 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated()
; | 1078 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated()
; |
1079 | 1079 |
1080 bool showHorizontalBottomLeft = style.borderTopRightRadius().width() != styl
e.borderBottomLeftRadius().width(); | 1080 bool showHorizontalBottomLeft = style.borderTopRightRadius().width() != styl
e.borderBottomLeftRadius().width(); |
1081 bool showHorizontalBottomRight = showHorizontalBottomLeft || (style.borderBo
ttomRightRadius().width() != style.borderTopLeftRadius().width()); | 1081 bool showHorizontalBottomRight = showHorizontalBottomLeft || (style.borderBo
ttomRightRadius().width() != style.borderTopLeftRadius().width()); |
1082 bool showHorizontalTopRight = showHorizontalBottomRight || (style.borderTopR
ightRadius().width() != style.borderTopLeftRadius().width()); | 1082 bool showHorizontalTopRight = showHorizontalBottomRight || (style.borderTopR
ightRadius().width() != style.borderTopLeftRadius().width()); |
1083 | 1083 |
1084 bool showVerticalBottomLeft = style.borderTopRightRadius().height() != style
.borderBottomLeftRadius().height(); | 1084 bool showVerticalBottomLeft = style.borderTopRightRadius().height() != style
.borderBottomLeftRadius().height(); |
1085 bool showVerticalBottomRight = showVerticalBottomLeft || (style.borderBottom
RightRadius().height() != style.borderTopLeftRadius().height()); | 1085 bool showVerticalBottomRight = showVerticalBottomLeft || (style.borderBottom
RightRadius().height() != style.borderTopLeftRadius().height()); |
1086 bool showVerticalTopRight = showVerticalBottomRight || (style.borderTopRight
Radius().height() != style.borderTopLeftRadius().height()); | 1086 bool showVerticalTopRight = showVerticalBottomRight || (style.borderTopRight
Radius().height() != style.borderTopLeftRadius().height()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 return CSSPrimitiveValue::create(90.0f, CSSPrimitiveValue::CSS_DEG); | 1125 return CSSPrimitiveValue::create(90.0f, CSSPrimitiveValue::CSS_DEG); |
1126 case GO_180DEG: | 1126 case GO_180DEG: |
1127 return CSSPrimitiveValue::create(180.0f, CSSPrimitiveValue::CSS_DEG); | 1127 return CSSPrimitiveValue::create(180.0f, CSSPrimitiveValue::CSS_DEG); |
1128 case GO_270DEG: | 1128 case GO_270DEG: |
1129 return CSSPrimitiveValue::create(270.0f, CSSPrimitiveValue::CSS_DEG); | 1129 return CSSPrimitiveValue::create(270.0f, CSSPrimitiveValue::CSS_DEG); |
1130 default: | 1130 default: |
1131 return nullptr; | 1131 return nullptr; |
1132 } | 1132 } |
1133 } | 1133 } |
1134 | 1134 |
1135 static PassRefPtrWillBeRawPtr<CSSValue> strokeDashArrayToCSSValueList(const SVGD
ashArray& dashes, const LayoutStyle& style) | 1135 static PassRefPtrWillBeRawPtr<CSSValue> strokeDashArrayToCSSValueList(const SVGD
ashArray& dashes, const ComputedStyle& style) |
1136 { | 1136 { |
1137 if (dashes.isEmpty()) | 1137 if (dashes.isEmpty()) |
1138 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | 1138 return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
1139 | 1139 |
1140 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 1140 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; |
1141 for (const Length& dashLength : dashes.vector()) | 1141 for (const Length& dashLength : dashes.vector()) |
1142 list->append(zoomAdjustedPixelValueForLength(dashLength, style)); | 1142 list->append(zoomAdjustedPixelValueForLength(dashLength, style)); |
1143 | 1143 |
1144 return list.release(); | 1144 return list.release(); |
1145 } | 1145 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 return CSSPrimitiveValue::createColor(currentColor.rgb()); | 1184 return CSSPrimitiveValue::createColor(currentColor.rgb()); |
1185 | 1185 |
1186 return CSSPrimitiveValue::createColor(color.rgb()); | 1186 return CSSPrimitiveValue::createColor(color.rgb()); |
1187 } | 1187 } |
1188 | 1188 |
1189 static inline String serializeAsFragmentIdentifier(const AtomicString& resource) | 1189 static inline String serializeAsFragmentIdentifier(const AtomicString& resource) |
1190 { | 1190 { |
1191 return "#" + resource; | 1191 return "#" + resource; |
1192 } | 1192 } |
1193 | 1193 |
1194 PassRefPtrWillBeRawPtr<CSSValue> LayoutStyleCSSValueMapping::valueForShadowData(
const ShadowData& shadow, const LayoutStyle& style, bool useSpread) | 1194 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowDat
a(const ShadowData& shadow, const ComputedStyle& style, bool useSpread) |
1195 { | 1195 { |
1196 RefPtrWillBeRawPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(shadow.x(),
style); | 1196 RefPtrWillBeRawPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(shadow.x(),
style); |
1197 RefPtrWillBeRawPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(shadow.y(),
style); | 1197 RefPtrWillBeRawPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(shadow.y(),
style); |
1198 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(shadow.b
lur(), style); | 1198 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(shadow.b
lur(), style); |
1199 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = useSpread ? zoomAdjustedPixel
Value(shadow.spread(), style) : PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullpt
r); | 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); | 1200 RefPtrWillBeRawPtr<CSSPrimitiveValue> shadowStyle = shadow.style() == Normal
? PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullptr) : cssValuePool().createIde
ntifierValue(CSSValueInset); |
1201 RefPtrWillBeRawPtr<CSSPrimitiveValue> color = currentColorOrValidColor(style
, shadow.color()); | 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()); | 1202 return CSSShadowValue::create(x.release(), y.release(), blur.release(), spre
ad.release(), shadowStyle.release(), color.release()); |
1203 } | 1203 } |
1204 | 1204 |
1205 PassRefPtrWillBeRawPtr<CSSValue> LayoutStyleCSSValueMapping::valueForShadowList(
const ShadowList* shadowList, const LayoutStyle& style, bool useSpread) | 1205 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowLis
t(const ShadowList* shadowList, const ComputedStyle& style, bool useSpread) |
1206 { | 1206 { |
1207 if (!shadowList) | 1207 if (!shadowList) |
1208 return cssValuePool().createIdentifierValue(CSSValueNone); | 1208 return cssValuePool().createIdentifierValue(CSSValueNone); |
1209 | 1209 |
1210 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 1210 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; |
1211 size_t shadowCount = shadowList->shadows().size(); | 1211 size_t shadowCount = shadowList->shadows().size(); |
1212 for (size_t i = 0; i < shadowCount; ++i) | 1212 for (size_t i = 0; i < shadowCount; ++i) |
1213 list->append(valueForShadowData(shadowList->shadows()[i], style, useSpre
ad)); | 1213 list->append(valueForShadowData(shadowList->shadows()[i], style, useSpre
ad)); |
1214 return list.release(); | 1214 return list.release(); |
1215 } | 1215 } |
1216 | 1216 |
1217 PassRefPtrWillBeRawPtr<CSSValue> LayoutStyleCSSValueMapping::valueForFilter(cons
t LayoutStyle& style) | 1217 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForFilter(co
nst ComputedStyle& style) |
1218 { | 1218 { |
1219 if (style.filter().operations().isEmpty()) | 1219 if (style.filter().operations().isEmpty()) |
1220 return cssValuePool().createIdentifierValue(CSSValueNone); | 1220 return cssValuePool().createIdentifierValue(CSSValueNone); |
1221 | 1221 |
1222 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 1222 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
1223 | 1223 |
1224 RefPtrWillBeRawPtr<CSSFunctionValue> filterValue = nullptr; | 1224 RefPtrWillBeRawPtr<CSSFunctionValue> filterValue = nullptr; |
1225 | 1225 |
1226 for (const auto& operation : style.filter().operations()) { | 1226 for (const auto& operation : style.filter().operations()) { |
1227 FilterOperation* filterOperation = operation.get(); | 1227 FilterOperation* filterOperation = operation.get(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 default: | 1277 default: |
1278 ASSERT_NOT_REACHED(); | 1278 ASSERT_NOT_REACHED(); |
1279 break; | 1279 break; |
1280 } | 1280 } |
1281 list->append(filterValue.release()); | 1281 list->append(filterValue.release()); |
1282 } | 1282 } |
1283 | 1283 |
1284 return list.release(); | 1284 return list.release(); |
1285 } | 1285 } |
1286 | 1286 |
1287 PassRefPtrWillBeRawPtr<CSSValue> LayoutStyleCSSValueMapping::get(CSSPropertyID p
ropertyID, const LayoutStyle& style, const LayoutObject* renderer, Node* styledN
ode, bool allowVisitedStyle) | 1287 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::get(CSSPropertyID
propertyID, const ComputedStyle& style, const LayoutObject* renderer, Node* sty
ledNode, bool allowVisitedStyle) |
1288 { | 1288 { |
1289 const SVGLayoutStyle& svgStyle = style.svgStyle(); | 1289 const SVGComputedStyle& svgStyle = style.svgStyle(); |
1290 propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style.di
rection(), style.writingMode()); | 1290 propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style.di
rection(), style.writingMode()); |
1291 switch (propertyID) { | 1291 switch (propertyID) { |
1292 case CSSPropertyInvalid: | 1292 case CSSPropertyInvalid: |
1293 return nullptr; | 1293 return nullptr; |
1294 | 1294 |
1295 case CSSPropertyBackgroundColor: | 1295 case CSSPropertyBackgroundColor: |
1296 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited
DependentColor(CSSPropertyBackgroundColor).rgb()) : currentColorOrValidColor(sty
le, style.backgroundColor()); | 1296 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited
DependentColor(CSSPropertyBackgroundColor).rgb()) : currentColorOrValidColor(sty
le, style.backgroundColor()); |
1297 case CSSPropertyBackgroundImage: | 1297 case CSSPropertyBackgroundImage: |
1298 case CSSPropertyWebkitMaskImage: { | 1298 case CSSPropertyWebkitMaskImage: { |
1299 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); | 1299 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); |
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2572 return zoomAdjustedPixelValueForLength(svgStyle.ry(), style); | 2572 return zoomAdjustedPixelValueForLength(svgStyle.ry(), style); |
2573 | 2573 |
2574 case CSSPropertyAll: | 2574 case CSSPropertyAll: |
2575 return nullptr; | 2575 return nullptr; |
2576 } | 2576 } |
2577 ASSERT_NOT_REACHED(); | 2577 ASSERT_NOT_REACHED(); |
2578 return nullptr; | 2578 return nullptr; |
2579 } | 2579 } |
2580 | 2580 |
2581 } | 2581 } |
OLD | NEW |