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 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 positionList->append(zoomAdjustedPixelValueForLength(layer.yPosition(), styl
e)); | 101 positionList->append(zoomAdjustedPixelValueForLength(layer.yPosition(), styl
e)); |
102 return positionList.release(); | 102 return positionList.release(); |
103 } | 103 } |
104 | 104 |
105 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> ComputedStyleCSSValueMapping::currentC
olorOrValidColor(const ComputedStyle& style, const StyleColor& color) | 105 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> ComputedStyleCSSValueMapping::currentC
olorOrValidColor(const ComputedStyle& style, const StyleColor& color) |
106 { | 106 { |
107 // This function does NOT look at visited information, so that computed styl
e doesn't expose that. | 107 // This function does NOT look at visited information, so that computed styl
e doesn't expose that. |
108 return cssValuePool().createColorValue(color.resolve(style.color()).rgb()); | 108 return cssValuePool().createColorValue(color.resolve(style.color()).rgb()); |
109 } | 109 } |
110 | 110 |
111 static PassRefPtrWillBeRawPtr<CSSValue> valueForFillSize(const FillSize& fillSiz
e, const ComputedStyle& style) | 111 static CSSValue valueForFillSize(const FillSize& fillSize, const ComputedStyle&
style) |
112 { | 112 { |
113 if (fillSize.type == Contain) | 113 if (fillSize.type == Contain) |
114 return cssValuePool().createIdentifierValue(CSSValueContain); | 114 return cssValuePool().createIdentifierValue(CSSValueContain); |
115 | 115 |
116 if (fillSize.type == Cover) | 116 if (fillSize.type == Cover) |
117 return cssValuePool().createIdentifierValue(CSSValueCover); | 117 return cssValuePool().createIdentifierValue(CSSValueCover); |
118 | 118 |
119 if (fillSize.size.height().isAuto()) | 119 if (fillSize.size.height().isAuto()) |
120 return zoomAdjustedPixelValueForLength(fillSize.size.width(), style); | 120 return zoomAdjustedPixelValueForLength(fillSize.size.width(), style); |
121 | 121 |
122 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 122 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
123 list->append(zoomAdjustedPixelValueForLength(fillSize.size.width(), style)); | 123 list->append(zoomAdjustedPixelValueForLength(fillSize.size.width(), style)); |
124 list->append(zoomAdjustedPixelValueForLength(fillSize.size.height(), style))
; | 124 list->append(zoomAdjustedPixelValueForLength(fillSize.size.height(), style))
; |
125 return list.release(); | 125 return list.release(); |
126 } | 126 } |
127 | 127 |
128 static PassRefPtrWillBeRawPtr<CSSValue> valueForFillRepeat(EFillRepeat xRepeat,
EFillRepeat yRepeat) | 128 static CSSValue valueForFillRepeat(EFillRepeat xRepeat, EFillRepeat yRepeat) |
129 { | 129 { |
130 // For backwards compatibility, if both values are equal, just return one of
them. And | 130 // For backwards compatibility, if both values are equal, just return one of
them. And |
131 // if the two values are equivalent to repeat-x or repeat-y, just return the
shorthand. | 131 // if the two values are equivalent to repeat-x or repeat-y, just return the
shorthand. |
132 if (xRepeat == yRepeat) | 132 if (xRepeat == yRepeat) |
133 return cssValuePool().createValue(xRepeat); | 133 return cssValuePool().createValue(xRepeat); |
134 if (xRepeat == RepeatFill && yRepeat == NoRepeatFill) | 134 if (xRepeat == RepeatFill && yRepeat == NoRepeatFill) |
135 return cssValuePool().createIdentifierValue(CSSValueRepeatX); | 135 return cssValuePool().createIdentifierValue(CSSValueRepeatX); |
136 if (xRepeat == NoRepeatFill && yRepeat == RepeatFill) | 136 if (xRepeat == NoRepeatFill && yRepeat == RepeatFill) |
137 return cssValuePool().createIdentifierValue(CSSValueRepeatY); | 137 return cssValuePool().createIdentifierValue(CSSValueRepeatY); |
138 | 138 |
139 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 139 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
140 list->append(cssValuePool().createValue(xRepeat)); | 140 list->append(cssValuePool().createValue(xRepeat)); |
141 list->append(cssValuePool().createValue(yRepeat)); | 141 list->append(cssValuePool().createValue(yRepeat)); |
142 return list.release(); | 142 return list.release(); |
143 } | 143 } |
144 | 144 |
145 static PassRefPtrWillBeRawPtr<CSSValue> valueForFillSourceType(EMaskSourceType t
ype) | 145 static CSSValue valueForFillSourceType(EMaskSourceType type) |
146 { | 146 { |
147 switch (type) { | 147 switch (type) { |
148 case MaskAlpha: | 148 case MaskAlpha: |
149 return cssValuePool().createValue(CSSValueAlpha); | 149 return cssValuePool().createValue(CSSValueAlpha); |
150 case MaskLuminance: | 150 case MaskLuminance: |
151 return cssValuePool().createValue(CSSValueLuminance); | 151 return cssValuePool().createValue(CSSValueLuminance); |
152 } | 152 } |
153 | 153 |
154 ASSERT_NOT_REACHED(); | 154 ASSERT_NOT_REACHED(); |
155 | 155 return cssValuePool().createValue(CSSValueAlpha); |
156 return nullptr; | |
157 } | 156 } |
158 | 157 |
159 static PassRefPtrWillBeRawPtr<CSSValue> valueForPositionOffset(const ComputedSty
le& style, CSSPropertyID propertyID, const LayoutObject* layoutObject) | 158 static CSSValue valueForPositionOffset(const ComputedStyle& style, CSSPropertyID
propertyID, const LayoutObject* layoutObject) |
160 { | 159 { |
161 Length offset; | 160 Length offset; |
162 switch (propertyID) { | 161 switch (propertyID) { |
163 case CSSPropertyLeft: | 162 case CSSPropertyLeft: |
164 offset = style.left(); | 163 offset = style.left(); |
165 break; | 164 break; |
166 case CSSPropertyRight: | 165 case CSSPropertyRight: |
167 offset = style.right(); | 166 offset = style.right(); |
168 break; | 167 break; |
169 case CSSPropertyTop: | 168 case CSSPropertyTop: |
170 offset = style.top(); | 169 offset = style.top(); |
171 break; | 170 break; |
172 case CSSPropertyBottom: | 171 case CSSPropertyBottom: |
173 offset = style.bottom(); | 172 offset = style.bottom(); |
174 break; | 173 break; |
175 default: | 174 default: |
176 return nullptr; | 175 return cssValuePool().createIdentifierValue(CSSValueAuto); |
177 } | 176 } |
178 | 177 |
179 if (offset.hasPercent() && layoutObject && layoutObject->isBox() && layoutOb
ject->isPositioned()) { | 178 if (offset.hasPercent() && layoutObject && layoutObject->isBox() && layoutOb
ject->isPositioned()) { |
180 LayoutUnit containingBlockSize = (propertyID == CSSPropertyLeft || prope
rtyID == CSSPropertyRight) ? | 179 LayoutUnit containingBlockSize = (propertyID == CSSPropertyLeft || prope
rtyID == CSSPropertyRight) ? |
181 toLayoutBox(layoutObject)->containingBlockLogicalWidthForContent() : | 180 toLayoutBox(layoutObject)->containingBlockLogicalWidthForContent() : |
182 toLayoutBox(layoutObject)->containingBlockLogicalHeightForGetCompute
dStyle(); | 181 toLayoutBox(layoutObject)->containingBlockLogicalHeightForGetCompute
dStyle(); |
183 return zoomAdjustedPixelValue(valueForLength(offset, containingBlockSize
), style); | 182 return zoomAdjustedPixelValue(valueForLength(offset, containingBlockSize
), style); |
184 } | 183 } |
185 if (offset.isAuto()) { | 184 if (offset.isAuto()) { |
186 // FIXME: It's not enough to simply return "auto" values for one offset
if the other side is defined. | 185 // FIXME: It's not enough to simply return "auto" values for one offset
if the other side is defined. |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 return CSSValueRepeat; | 304 return CSSValueRepeat; |
306 case RoundImageRule: | 305 case RoundImageRule: |
307 return CSSValueRound; | 306 return CSSValueRound; |
308 case SpaceImageRule: | 307 case SpaceImageRule: |
309 return CSSValueSpace; | 308 return CSSValueSpace; |
310 default: | 309 default: |
311 return CSSValueStretch; | 310 return CSSValueStretch; |
312 } | 311 } |
313 } | 312 } |
314 | 313 |
315 static PassRefPtrWillBeRawPtr<CSSValue> valueForNinePieceImageRepeat(const NineP
ieceImage& image) | 314 static CSSValue valueForNinePieceImageRepeat(const NinePieceImage& image) |
316 { | 315 { |
317 RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalRepeat = nullptr; | 316 RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalRepeat = nullptr; |
318 RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalRepeat = nullptr; | 317 RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalRepeat = nullptr; |
319 | 318 |
320 horizontalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(i
mage.horizontalRule())); | 319 horizontalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(i
mage.horizontalRule())); |
321 if (image.horizontalRule() == image.verticalRule()) | 320 if (image.horizontalRule() == image.verticalRule()) |
322 verticalRepeat = horizontalRepeat; | 321 verticalRepeat = horizontalRepeat; |
323 else | 322 else |
324 verticalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule
(image.verticalRule())); | 323 verticalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule
(image.verticalRule())); |
325 return cssValuePool().createValue(Pair::create(horizontalRepeat.release(), v
erticalRepeat.release(), Pair::DropIdenticalValues)); | 324 return cssValuePool().createValue(Pair::create(horizontalRepeat.release(), v
erticalRepeat.release(), Pair::DropIdenticalValues)); |
326 } | 325 } |
327 | 326 |
328 static PassRefPtrWillBeRawPtr<CSSValue> valueForNinePieceImage(const NinePieceIm
age& image, const ComputedStyle& style) | 327 static CSSValue valueForNinePieceImage(const NinePieceImage& image, const Comput
edStyle& style) |
329 { | 328 { |
330 if (!image.hasImage()) | 329 if (!image.hasImage()) |
331 return cssValuePool().createIdentifierValue(CSSValueNone); | 330 return cssValuePool().createIdentifierValue(CSSValueNone); |
332 | 331 |
333 // Image first. | 332 // Image first. |
334 RefPtrWillBeRawPtr<CSSValue> imageValue = nullptr; | 333 NullableCSSValue imageValue; |
335 if (image.image()) | 334 if (image.image()) |
336 imageValue = image.image()->cssValue(); | 335 imageValue = image.image()->cssValue(); |
337 | 336 |
338 // Create the image slice. | 337 // Create the image slice. |
339 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> imageSlices = valueForNinePiece
ImageSlice(image); | 338 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> imageSlices = valueForNinePiece
ImageSlice(image); |
340 | 339 |
341 // Create the border area slices. | 340 // Create the border area slices. |
342 RefPtrWillBeRawPtr<CSSValue> borderSlices = valueForNinePieceImageQuad(image
.borderSlices(), style); | 341 CSSValue borderSlices = valueForNinePieceImageQuad(image.borderSlices(), sty
le); |
343 | 342 |
344 // Create the border outset. | 343 // Create the border outset. |
345 RefPtrWillBeRawPtr<CSSValue> outset = valueForNinePieceImageQuad(image.outse
t(), style); | 344 CSSValue outset = valueForNinePieceImageQuad(image.outset(), style); |
346 | 345 |
347 // Create the repeat rules. | 346 // Create the repeat rules. |
348 RefPtrWillBeRawPtr<CSSValue> repeat = valueForNinePieceImageRepeat(image); | 347 CSSValue repeat = valueForNinePieceImageRepeat(image); |
349 | 348 |
350 return createBorderImageValue(imageValue.release(), imageSlices.release(), b
orderSlices.release(), outset.release(), repeat.release()); | 349 return createBorderImageValue(imageValue, imageSlices, borderSlices, outset,
repeat); |
351 } | 350 } |
352 | 351 |
353 static PassRefPtrWillBeRawPtr<CSSValue> valueForReflection(const StyleReflection
* reflection, const ComputedStyle& style) | 352 static CSSValue valueForReflection(const StyleReflection* reflection, const Comp
utedStyle& style) |
354 { | 353 { |
355 if (!reflection) | 354 if (!reflection) |
356 return cssValuePool().createIdentifierValue(CSSValueNone); | 355 return cssValuePool().createIdentifierValue(CSSValueNone); |
357 | 356 |
358 RefPtrWillBeRawPtr<CSSPrimitiveValue> offset = nullptr; | 357 RefPtrWillBeRawPtr<CSSPrimitiveValue> offset = nullptr; |
359 // TODO(alancutter): Make this work correctly for calc lengths. | 358 // TODO(alancutter): Make this work correctly for calc lengths. |
360 if (reflection->offset().hasPercent()) | 359 if (reflection->offset().hasPercent()) |
361 offset = cssValuePool().createValue(reflection->offset().percent(), CSSP
rimitiveValue::CSS_PERCENTAGE); | 360 offset = cssValuePool().createValue(reflection->offset().percent(), CSSP
rimitiveValue::CSS_PERCENTAGE); |
362 else | 361 else |
363 offset = zoomAdjustedPixelValue(reflection->offset().value(), style); | 362 offset = zoomAdjustedPixelValue(reflection->offset().value(), style); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign
mentDefault) | 397 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign
mentDefault) |
399 result->append(CSSPrimitiveValue::create(overflowAlignment)); | 398 result->append(CSSPrimitiveValue::create(overflowAlignment)); |
400 ASSERT(result->length() <= 2); | 399 ASSERT(result->length() <= 2); |
401 return result.release(); | 400 return result.release(); |
402 } | 401 } |
403 | 402 |
404 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForGridShorthand(const StylePr
opertyShorthand& shorthand, const ComputedStyle& style, const LayoutObject* layo
utObject, Node* styledNode, bool allowVisitedStyle) | 403 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForGridShorthand(const StylePr
opertyShorthand& shorthand, const ComputedStyle& style, const LayoutObject* layo
utObject, Node* styledNode, bool allowVisitedStyle) |
405 { | 404 { |
406 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated()
; | 405 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated()
; |
407 for (size_t i = 0; i < shorthand.length(); ++i) { | 406 for (size_t i = 0; i < shorthand.length(); ++i) { |
408 RefPtrWillBeRawPtr<CSSValue> value = ComputedStyleCSSValueMapping::get(s
horthand.properties()[i], style, layoutObject, styledNode, allowVisitedStyle); | 407 NullableCSSValue value = ComputedStyleCSSValueMapping::get(shorthand.pro
perties()[i], style, layoutObject, styledNode, allowVisitedStyle); |
409 ASSERT(value); | 408 list->append(*value); |
410 list->append(value.release()); | |
411 } | 409 } |
412 return list.release(); | 410 return list.release(); |
413 } | 411 } |
414 | 412 |
415 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForShorthandProperty(const Sty
lePropertyShorthand& shorthand, const ComputedStyle& style, const LayoutObject*
layoutObject, Node* styledNode, bool allowVisitedStyle) | 413 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForShorthandProperty(const Sty
lePropertyShorthand& shorthand, const ComputedStyle& style, const LayoutObject*
layoutObject, Node* styledNode, bool allowVisitedStyle) |
416 { | 414 { |
417 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 415 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
418 for (size_t i = 0; i < shorthand.length(); ++i) { | 416 for (size_t i = 0; i < shorthand.length(); ++i) { |
419 RefPtrWillBeRawPtr<CSSValue> value = ComputedStyleCSSValueMapping::get(s
horthand.properties()[i], style, layoutObject, styledNode, allowVisitedStyle); | 417 NullableCSSValue value = ComputedStyleCSSValueMapping::get(shorthand.pro
perties()[i], style, layoutObject, styledNode, allowVisitedStyle); |
420 ASSERT(value); | 418 list->append(*value); |
421 list->append(value); | |
422 } | 419 } |
423 return list.release(); | 420 return list.release(); |
424 } | 421 } |
425 | 422 |
426 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForBackgroundShorthand(const C
omputedStyle& style, const LayoutObject* layoutObject, Node* styledNode, bool al
lowVisitedStyle) | 423 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForBackgroundShorthand(const C
omputedStyle& style, const LayoutObject* layoutObject, Node* styledNode, bool al
lowVisitedStyle) |
427 { | 424 { |
428 RefPtrWillBeRawPtr<CSSValueList> ret = CSSValueList::createCommaSeparated(); | 425 RefPtrWillBeRawPtr<CSSValueList> ret = CSSValueList::createCommaSeparated(); |
429 const FillLayer* currLayer = &style.backgroundLayers(); | 426 const FillLayer* currLayer = &style.backgroundLayers(); |
430 for (; currLayer; currLayer = currLayer->next()) { | 427 for (; currLayer; currLayer = currLayer->next()) { |
431 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparat
ed(); | 428 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparat
ed(); |
432 RefPtrWillBeRawPtr<CSSValueList> beforeSlash = CSSValueList::createSpace
Separated(); | 429 RefPtrWillBeRawPtr<CSSValueList> beforeSlash = CSSValueList::createSpace
Separated(); |
433 if (!currLayer->next()) { // color only for final layer | 430 if (!currLayer->next()) { // color only for final layer |
434 RefPtrWillBeRawPtr<CSSValue> value = ComputedStyleCSSValueMapping::g
et(CSSPropertyBackgroundColor, style, layoutObject, styledNode, allowVisitedStyl
e); | 431 NullableCSSValue value = ComputedStyleCSSValueMapping::get(CSSProper
tyBackgroundColor, style, layoutObject, styledNode, allowVisitedStyle); |
435 ASSERT(value); | 432 beforeSlash->append(*value); |
436 beforeSlash->append(value); | |
437 } | 433 } |
438 beforeSlash->append(currLayer->image() ? currLayer->image()->cssValue()
: cssValuePool().createIdentifierValue(CSSValueNone)); | 434 beforeSlash->append(currLayer->image() ? *currLayer->image()->cssValue()
: cssValuePool().createIdentifierValue(CSSValueNone)); |
439 beforeSlash->append(valueForFillRepeat(currLayer->repeatX(), currLayer->
repeatY())); | 435 beforeSlash->append(valueForFillRepeat(currLayer->repeatX(), currLayer->
repeatY())); |
440 beforeSlash->append(cssValuePool().createValue(currLayer->attachment()))
; | 436 beforeSlash->append(cssValuePool().createValue(currLayer->attachment()))
; |
441 beforeSlash->append(createPositionListForLayer(CSSPropertyBackgroundPosi
tion, *currLayer, style)); | 437 beforeSlash->append(createPositionListForLayer(CSSPropertyBackgroundPosi
tion, *currLayer, style)); |
442 list->append(beforeSlash); | 438 list->append(beforeSlash); |
443 RefPtrWillBeRawPtr<CSSValueList> afterSlash = CSSValueList::createSpaceS
eparated(); | 439 RefPtrWillBeRawPtr<CSSValueList> afterSlash = CSSValueList::createSpaceS
eparated(); |
444 afterSlash->append(valueForFillSize(currLayer->size(), style)); | 440 afterSlash->append(valueForFillSize(currLayer->size(), style)); |
445 afterSlash->append(cssValuePool().createValue(currLayer->origin())); | 441 afterSlash->append(cssValuePool().createValue(currLayer->origin())); |
446 afterSlash->append(cssValuePool().createValue(currLayer->clip())); | 442 afterSlash->append(cssValuePool().createValue(currLayer->clip())); |
447 list->append(afterSlash); | 443 list->append(afterSlash); |
448 ret->append(list); | 444 ret->append(list); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontVariant(const Compu
tedStyle& style) | 531 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontVariant(const Compu
tedStyle& style) |
536 { | 532 { |
537 return cssValuePool().createValue(style.fontDescription().variant()); | 533 return cssValuePool().createValue(style.fontDescription().variant()); |
538 } | 534 } |
539 | 535 |
540 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontWeight(const Comput
edStyle& style) | 536 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontWeight(const Comput
edStyle& style) |
541 { | 537 { |
542 return cssValuePool().createValue(style.fontDescription().weight()); | 538 return cssValuePool().createValue(style.fontDescription().weight()); |
543 } | 539 } |
544 | 540 |
545 static PassRefPtrWillBeRawPtr<CSSValue> specifiedValueForGridTrackBreadth(const
GridLength& trackBreadth, const ComputedStyle& style) | 541 static CSSValue specifiedValueForGridTrackBreadth(const GridLength& trackBreadth
, const ComputedStyle& style) |
546 { | 542 { |
547 if (!trackBreadth.isLength()) | 543 if (!trackBreadth.isLength()) |
548 return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue
::CSS_FR); | 544 return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue
::CSS_FR); |
549 | 545 |
550 const Length& trackBreadthLength = trackBreadth.length(); | 546 const Length& trackBreadthLength = trackBreadth.length(); |
551 if (trackBreadthLength.isAuto()) | 547 if (trackBreadthLength.isAuto()) |
552 return cssValuePool().createIdentifierValue(CSSValueAuto); | 548 return cssValuePool().createIdentifierValue(CSSValueAuto); |
553 return zoomAdjustedPixelValueForLength(trackBreadthLength, style); | 549 return zoomAdjustedPixelValueForLength(trackBreadthLength, style); |
554 } | 550 } |
555 | 551 |
556 static PassRefPtrWillBeRawPtr<CSSValue> specifiedValueForGridTrackSize(const Gri
dTrackSize& trackSize, const ComputedStyle& style) | 552 static CSSValue specifiedValueForGridTrackSize(const GridTrackSize& trackSize, c
onst ComputedStyle& style) |
557 { | 553 { |
558 switch (trackSize.type()) { | 554 switch (trackSize.type()) { |
559 case LengthTrackSizing: | 555 case LengthTrackSizing: |
560 return specifiedValueForGridTrackBreadth(trackSize.length(), style); | 556 return specifiedValueForGridTrackBreadth(trackSize.length(), style); |
561 case MinMaxTrackSizing: | 557 case MinMaxTrackSizing: |
562 RefPtrWillBeRawPtr<CSSFunctionValue> minMaxTrackBreadths = CSSFunctionVa
lue::create(CSSValueMinmax); | 558 RefPtrWillBeRawPtr<CSSFunctionValue> minMaxTrackBreadths = CSSFunctionVa
lue::create(CSSValueMinmax); |
563 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.
minTrackBreadth(), style)); | 559 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.
minTrackBreadth(), style)); |
564 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.
maxTrackBreadth(), style)); | 560 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.
maxTrackBreadth(), style)); |
565 return minMaxTrackBreadths.release(); | 561 return minMaxTrackBreadths.release(); |
566 } | 562 } |
567 ASSERT_NOT_REACHED(); | 563 ASSERT_NOT_REACHED(); |
568 return nullptr; | 564 return specifiedValueForGridTrackBreadth(trackSize.length(), style); |
569 } | 565 } |
570 | 566 |
571 static void addValuesForNamedGridLinesAtIndex(const OrderedNamedGridLines& order
edNamedGridLines, size_t i, CSSValueList& list) | 567 static void addValuesForNamedGridLinesAtIndex(const OrderedNamedGridLines& order
edNamedGridLines, size_t i, CSSValueList& list) |
572 { | 568 { |
573 const Vector<String>& namedGridLines = orderedNamedGridLines.get(i); | 569 const Vector<String>& namedGridLines = orderedNamedGridLines.get(i); |
574 if (namedGridLines.isEmpty()) | 570 if (namedGridLines.isEmpty()) |
575 return; | 571 return; |
576 | 572 |
577 RefPtrWillBeRawPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue:
:create(); | 573 RefPtrWillBeRawPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue:
:create(); |
578 for (size_t j = 0; j < namedGridLines.size(); ++j) | 574 for (size_t j = 0; j < namedGridLines.size(); ++j) |
579 lineNames->append(cssValuePool().createValue(namedGridLines[j], CSSPrimi
tiveValue::CSS_CUSTOM_IDENT)); | 575 lineNames->append(cssValuePool().createValue(namedGridLines[j], CSSPrimi
tiveValue::CSS_CUSTOM_IDENT)); |
580 list.append(lineNames.release()); | 576 list.append(lineNames.release()); |
581 } | 577 } |
582 | 578 |
583 static PassRefPtrWillBeRawPtr<CSSValue> valueForGridTrackList(GridTrackSizingDir
ection direction, const LayoutObject* layoutObject, const ComputedStyle& style) | 579 static CSSValue valueForGridTrackList(GridTrackSizingDirection direction, const
LayoutObject* layoutObject, const ComputedStyle& style) |
584 { | 580 { |
585 const Vector<GridTrackSize>& trackSizes = direction == ForColumns ? style.gr
idTemplateColumns() : style.gridTemplateRows(); | 581 const Vector<GridTrackSize>& trackSizes = direction == ForColumns ? style.gr
idTemplateColumns() : style.gridTemplateRows(); |
586 const OrderedNamedGridLines& orderedNamedGridLines = direction == ForColumns
? style.orderedNamedGridColumnLines() : style.orderedNamedGridRowLines(); | 582 const OrderedNamedGridLines& orderedNamedGridLines = direction == ForColumns
? style.orderedNamedGridColumnLines() : style.orderedNamedGridRowLines(); |
587 bool isLayoutGrid = layoutObject && layoutObject->isLayoutGrid(); | 583 bool isLayoutGrid = layoutObject && layoutObject->isLayoutGrid(); |
588 | 584 |
589 // Handle the 'none' case. | 585 // Handle the 'none' case. |
590 bool trackListIsEmpty = trackSizes.isEmpty(); | 586 bool trackListIsEmpty = trackSizes.isEmpty(); |
591 if (isLayoutGrid && trackListIsEmpty) { | 587 if (isLayoutGrid && trackListIsEmpty) { |
592 // For grids we should consider every listed track, whether implicitly o
r explicitly created. If we don't have | 588 // For grids we should consider every listed track, whether implicitly o
r explicitly created. If we don't have |
593 // any explicit track and there are no children then there are no implic
it tracks. We cannot simply check the | 589 // any explicit track and there are no children then there are no implic
it tracks. We cannot simply check the |
(...skipping 24 matching lines...) Expand all Loading... |
618 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); | 614 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); |
619 list->append(specifiedValueForGridTrackSize(trackSizes[i], style)); | 615 list->append(specifiedValueForGridTrackSize(trackSizes[i], style)); |
620 } | 616 } |
621 insertionIndex = trackSizes.size(); | 617 insertionIndex = trackSizes.size(); |
622 } | 618 } |
623 // Those are the trailing <string>* allowed in the syntax. | 619 // Those are the trailing <string>* allowed in the syntax. |
624 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, insertionIndex, *li
st); | 620 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, insertionIndex, *li
st); |
625 return list.release(); | 621 return list.release(); |
626 } | 622 } |
627 | 623 |
628 static PassRefPtrWillBeRawPtr<CSSValue> valueForGridPosition(const GridPosition&
position) | 624 static CSSValue valueForGridPosition(const GridPosition& position) |
629 { | 625 { |
630 if (position.isAuto()) | 626 if (position.isAuto()) |
631 return cssValuePool().createIdentifierValue(CSSValueAuto); | 627 return cssValuePool().createIdentifierValue(CSSValueAuto); |
632 | 628 |
633 if (position.isNamedGridArea()) | 629 if (position.isNamedGridArea()) |
634 return cssValuePool().createValue(position.namedGridLine(), CSSPrimitive
Value::CSS_CUSTOM_IDENT); | 630 return cssValuePool().createValue(position.namedGridLine(), CSSPrimitive
Value::CSS_CUSTOM_IDENT); |
635 | 631 |
636 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 632 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
637 if (position.isSpan()) { | 633 if (position.isSpan()) { |
638 list->append(cssValuePool().createIdentifierValue(CSSValueSpan)); | 634 list->append(cssValuePool().createIdentifierValue(CSSValueSpan)); |
639 list->append(cssValuePool().createValue(position.spanPosition(), CSSPrim
itiveValue::CSS_NUMBER)); | 635 list->append(cssValuePool().createValue(position.spanPosition(), CSSPrim
itiveValue::CSS_NUMBER)); |
640 } else { | 636 } else { |
641 list->append(cssValuePool().createValue(position.integerPosition(), CSSP
rimitiveValue::CSS_NUMBER)); | 637 list->append(cssValuePool().createValue(position.integerPosition(), CSSP
rimitiveValue::CSS_NUMBER)); |
642 } | 638 } |
643 | 639 |
644 if (!position.namedGridLine().isNull()) | 640 if (!position.namedGridLine().isNull()) |
645 list->append(cssValuePool().createValue(position.namedGridLine(), CSSPri
mitiveValue::CSS_CUSTOM_IDENT)); | 641 list->append(cssValuePool().createValue(position.namedGridLine(), CSSPri
mitiveValue::CSS_CUSTOM_IDENT)); |
646 return list; | 642 return list; |
647 } | 643 } |
648 | 644 |
649 static LayoutRect sizingBox(const LayoutObject* layoutObject) | 645 static LayoutRect sizingBox(const LayoutObject* layoutObject) |
650 { | 646 { |
651 if (!layoutObject->isBox()) | 647 if (!layoutObject->isBox()) |
652 return LayoutRect(); | 648 return LayoutRect(); |
653 | 649 |
654 const LayoutBox* box = toLayoutBox(layoutObject); | 650 const LayoutBox* box = toLayoutBox(layoutObject); |
655 return box->style()->boxSizing() == BORDER_BOX ? box->borderBoxRect() : box-
>computedCSSContentBoxRect(); | 651 return box->style()->boxSizing() == BORDER_BOX ? box->borderBoxRect() : box-
>computedCSSContentBoxRect(); |
656 } | 652 } |
657 | 653 |
658 static PassRefPtrWillBeRawPtr<CSSValue> scrollBlocksOnFlagsToCSSValue(WebScrollB
locksOn scrollBlocksOn) | 654 static CSSValue scrollBlocksOnFlagsToCSSValue(WebScrollBlocksOn scrollBlocksOn) |
659 { | 655 { |
660 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 656 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
661 | 657 |
662 if (scrollBlocksOn == WebScrollBlocksOnNone) | 658 if (scrollBlocksOn == WebScrollBlocksOnNone) |
663 return cssValuePool().createIdentifierValue(CSSValueNone); | 659 return cssValuePool().createIdentifierValue(CSSValueNone); |
664 | 660 |
665 if (scrollBlocksOn & WebScrollBlocksOnStartTouch) | 661 if (scrollBlocksOn & WebScrollBlocksOnStartTouch) |
666 list->append(cssValuePool().createIdentifierValue(CSSValueStartTouch)); | 662 list->append(cssValuePool().createIdentifierValue(CSSValueStartTouch)); |
667 if (scrollBlocksOn & WebScrollBlocksOnWheelEvent) | 663 if (scrollBlocksOn & WebScrollBlocksOnWheelEvent) |
668 list->append(cssValuePool().createIdentifierValue(CSSValueWheelEvent)); | 664 list->append(cssValuePool().createIdentifierValue(CSSValueWheelEvent)); |
669 if (scrollBlocksOn & WebScrollBlocksOnScrollEvent) | 665 if (scrollBlocksOn & WebScrollBlocksOnScrollEvent) |
670 list->append(cssValuePool().createIdentifierValue(CSSValueScrollEvent)); | 666 list->append(cssValuePool().createIdentifierValue(CSSValueScrollEvent)); |
671 ASSERT(list->length()); | 667 ASSERT(list->length()); |
672 return list.release(); | 668 return list.release(); |
673 } | 669 } |
674 | 670 |
675 static PassRefPtrWillBeRawPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int
textDecoration) | 671 static CSSValue renderTextDecorationFlagsToCSSValue(int textDecoration) |
676 { | 672 { |
677 // Blink value is ignored. | 673 // Blink value is ignored. |
678 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 674 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
679 if (textDecoration & TextDecorationUnderline) | 675 if (textDecoration & TextDecorationUnderline) |
680 list->append(cssValuePool().createIdentifierValue(CSSValueUnderline)); | 676 list->append(cssValuePool().createIdentifierValue(CSSValueUnderline)); |
681 if (textDecoration & TextDecorationOverline) | 677 if (textDecoration & TextDecorationOverline) |
682 list->append(cssValuePool().createIdentifierValue(CSSValueOverline)); | 678 list->append(cssValuePool().createIdentifierValue(CSSValueOverline)); |
683 if (textDecoration & TextDecorationLineThrough) | 679 if (textDecoration & TextDecorationLineThrough) |
684 list->append(cssValuePool().createIdentifierValue(CSSValueLineThrough)); | 680 list->append(cssValuePool().createIdentifierValue(CSSValueLineThrough)); |
685 | 681 |
686 if (!list->length()) | 682 if (!list->length()) |
687 return cssValuePool().createIdentifierValue(CSSValueNone); | 683 return cssValuePool().createIdentifierValue(CSSValueNone); |
688 return list.release(); | 684 return list.release(); |
689 } | 685 } |
690 | 686 |
691 static PassRefPtrWillBeRawPtr<CSSValue> valueForTextDecorationStyle(TextDecorati
onStyle textDecorationStyle) | 687 static CSSValue valueForTextDecorationStyle(TextDecorationStyle textDecorationSt
yle) |
692 { | 688 { |
693 switch (textDecorationStyle) { | 689 switch (textDecorationStyle) { |
694 case TextDecorationStyleSolid: | 690 case TextDecorationStyleSolid: |
695 return cssValuePool().createIdentifierValue(CSSValueSolid); | 691 return cssValuePool().createIdentifierValue(CSSValueSolid); |
696 case TextDecorationStyleDouble: | 692 case TextDecorationStyleDouble: |
697 return cssValuePool().createIdentifierValue(CSSValueDouble); | 693 return cssValuePool().createIdentifierValue(CSSValueDouble); |
698 case TextDecorationStyleDotted: | 694 case TextDecorationStyleDotted: |
699 return cssValuePool().createIdentifierValue(CSSValueDotted); | 695 return cssValuePool().createIdentifierValue(CSSValueDotted); |
700 case TextDecorationStyleDashed: | 696 case TextDecorationStyleDashed: |
701 return cssValuePool().createIdentifierValue(CSSValueDashed); | 697 return cssValuePool().createIdentifierValue(CSSValueDashed); |
702 case TextDecorationStyleWavy: | 698 case TextDecorationStyleWavy: |
703 return cssValuePool().createIdentifierValue(CSSValueWavy); | 699 return cssValuePool().createIdentifierValue(CSSValueWavy); |
704 } | 700 } |
705 | 701 |
706 ASSERT_NOT_REACHED(); | 702 ASSERT_NOT_REACHED(); |
707 return cssValuePool().createExplicitInitialValue(); | 703 return cssValuePool().createExplicitInitialValue(); |
708 } | 704 } |
709 | 705 |
710 static PassRefPtrWillBeRawPtr<CSSValue> touchActionFlagsToCSSValue(TouchAction t
ouchAction) | 706 static CSSValue touchActionFlagsToCSSValue(TouchAction touchAction) |
711 { | 707 { |
712 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 708 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
713 if (touchAction == TouchActionAuto) | 709 if (touchAction == TouchActionAuto) |
714 list->append(cssValuePool().createIdentifierValue(CSSValueAuto)); | 710 list->append(cssValuePool().createIdentifierValue(CSSValueAuto)); |
715 if (touchAction & TouchActionNone) { | 711 if (touchAction & TouchActionNone) { |
716 ASSERT(touchAction == TouchActionNone); | 712 ASSERT(touchAction == TouchActionNone); |
717 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); | 713 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); |
718 } | 714 } |
719 if (touchAction == (TouchActionPanX | TouchActionPanY | TouchActionPinchZoom
)) { | 715 if (touchAction == (TouchActionPanX | TouchActionPanY | TouchActionPinchZoom
)) { |
720 list->append(cssValuePool().createIdentifierValue(CSSValueManipulation))
; | 716 list->append(cssValuePool().createIdentifierValue(CSSValueManipulation))
; |
721 } else { | 717 } else { |
722 if ((touchAction & TouchActionPanX) == TouchActionPanX) | 718 if ((touchAction & TouchActionPanX) == TouchActionPanX) |
723 list->append(cssValuePool().createIdentifierValue(CSSValuePanX)); | 719 list->append(cssValuePool().createIdentifierValue(CSSValuePanX)); |
724 else if (touchAction & TouchActionPanLeft) | 720 else if (touchAction & TouchActionPanLeft) |
725 list->append(cssValuePool().createIdentifierValue(CSSValuePanLeft)); | 721 list->append(cssValuePool().createIdentifierValue(CSSValuePanLeft)); |
726 else if (touchAction & TouchActionPanRight) | 722 else if (touchAction & TouchActionPanRight) |
727 list->append(cssValuePool().createIdentifierValue(CSSValuePanRight))
; | 723 list->append(cssValuePool().createIdentifierValue(CSSValuePanRight))
; |
728 | 724 |
729 if ((touchAction & TouchActionPanY) == TouchActionPanY) | 725 if ((touchAction & TouchActionPanY) == TouchActionPanY) |
730 list->append(cssValuePool().createIdentifierValue(CSSValuePanY)); | 726 list->append(cssValuePool().createIdentifierValue(CSSValuePanY)); |
731 else if (touchAction & TouchActionPanUp) | 727 else if (touchAction & TouchActionPanUp) |
732 list->append(cssValuePool().createIdentifierValue(CSSValuePanUp)); | 728 list->append(cssValuePool().createIdentifierValue(CSSValuePanUp)); |
733 else if (touchAction & TouchActionPanDown) | 729 else if (touchAction & TouchActionPanDown) |
734 list->append(cssValuePool().createIdentifierValue(CSSValuePanDown)); | 730 list->append(cssValuePool().createIdentifierValue(CSSValuePanDown)); |
735 } | 731 } |
736 ASSERT(list->length()); | 732 ASSERT(list->length()); |
737 return list.release(); | 733 return list.release(); |
738 } | 734 } |
739 | 735 |
740 static PassRefPtrWillBeRawPtr<CSSValue> valueForWillChange(const Vector<CSSPrope
rtyID>& willChangeProperties, bool willChangeContents, bool willChangeScrollPosi
tion) | 736 static CSSValue valueForWillChange(const Vector<CSSPropertyID>& willChangeProper
ties, bool willChangeContents, bool willChangeScrollPosition) |
741 { | 737 { |
742 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 738 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; |
743 if (willChangeContents) | 739 if (willChangeContents) |
744 list->append(cssValuePool().createIdentifierValue(CSSValueContents)); | 740 list->append(cssValuePool().createIdentifierValue(CSSValueContents)); |
745 if (willChangeScrollPosition) | 741 if (willChangeScrollPosition) |
746 list->append(cssValuePool().createIdentifierValue(CSSValueScrollPosition
)); | 742 list->append(cssValuePool().createIdentifierValue(CSSValueScrollPosition
)); |
747 for (size_t i = 0; i < willChangeProperties.size(); ++i) | 743 for (size_t i = 0; i < willChangeProperties.size(); ++i) |
748 list->append(cssValuePool().createIdentifierValue(willChangeProperties[i
])); | 744 list->append(cssValuePool().createIdentifierValue(willChangeProperties[i
])); |
749 if (!list->length()) | 745 if (!list->length()) |
750 list->append(cssValuePool().createIdentifierValue(CSSValueAuto)); | 746 list->append(cssValuePool().createIdentifierValue(CSSValueAuto)); |
751 return list.release(); | 747 return list.release(); |
752 } | 748 } |
753 | 749 |
754 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationDelay(const CSSTimingDa
ta* timingData) | 750 static CSSValue valueForAnimationDelay(const CSSTimingData* timingData) |
755 { | 751 { |
756 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 752 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; |
757 if (timingData) { | 753 if (timingData) { |
758 for (size_t i = 0; i < timingData->delayList().size(); ++i) | 754 for (size_t i = 0; i < timingData->delayList().size(); ++i) |
759 list->append(cssValuePool().createValue(timingData->delayList()[i],
CSSPrimitiveValue::CSS_S)); | 755 list->append(cssValuePool().createValue(timingData->delayList()[i],
CSSPrimitiveValue::CSS_S)); |
760 } else { | 756 } else { |
761 list->append(cssValuePool().createValue(CSSTimingData::initialDelay(), C
SSPrimitiveValue::CSS_S)); | 757 list->append(cssValuePool().createValue(CSSTimingData::initialDelay(), C
SSPrimitiveValue::CSS_S)); |
762 } | 758 } |
763 return list.release(); | 759 return list.release(); |
764 } | 760 } |
765 | 761 |
766 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationDirection(Timing::Playb
ackDirection direction) | 762 static CSSValue valueForAnimationDirection(Timing::PlaybackDirection direction) |
767 { | 763 { |
768 switch (direction) { | 764 switch (direction) { |
769 case Timing::PlaybackDirectionNormal: | 765 case Timing::PlaybackDirectionNormal: |
770 return cssValuePool().createIdentifierValue(CSSValueNormal); | 766 return cssValuePool().createIdentifierValue(CSSValueNormal); |
771 case Timing::PlaybackDirectionAlternate: | 767 case Timing::PlaybackDirectionAlternate: |
772 return cssValuePool().createIdentifierValue(CSSValueAlternate); | 768 return cssValuePool().createIdentifierValue(CSSValueAlternate); |
773 case Timing::PlaybackDirectionReverse: | 769 case Timing::PlaybackDirectionReverse: |
774 return cssValuePool().createIdentifierValue(CSSValueReverse); | 770 return cssValuePool().createIdentifierValue(CSSValueReverse); |
775 case Timing::PlaybackDirectionAlternateReverse: | 771 case Timing::PlaybackDirectionAlternateReverse: |
776 return cssValuePool().createIdentifierValue(CSSValueAlternateReverse); | 772 return cssValuePool().createIdentifierValue(CSSValueAlternateReverse); |
777 default: | 773 default: |
778 ASSERT_NOT_REACHED(); | 774 ASSERT_NOT_REACHED(); |
779 return nullptr; | 775 return cssValuePool().createIdentifierValue(CSSValueNormal); |
780 } | 776 } |
781 } | 777 } |
782 | 778 |
783 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationDuration(const CSSTimin
gData* timingData) | 779 static CSSValue valueForAnimationDuration(const CSSTimingData* timingData) |
784 { | 780 { |
785 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 781 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; |
786 if (timingData) { | 782 if (timingData) { |
787 for (size_t i = 0; i < timingData->durationList().size(); ++i) | 783 for (size_t i = 0; i < timingData->durationList().size(); ++i) |
788 list->append(cssValuePool().createValue(timingData->durationList()[i
], CSSPrimitiveValue::CSS_S)); | 784 list->append(cssValuePool().createValue(timingData->durationList()[i
], CSSPrimitiveValue::CSS_S)); |
789 } else { | 785 } else { |
790 list->append(cssValuePool().createValue(CSSTimingData::initialDuration()
, CSSPrimitiveValue::CSS_S)); | 786 list->append(cssValuePool().createValue(CSSTimingData::initialDuration()
, CSSPrimitiveValue::CSS_S)); |
791 } | 787 } |
792 return list.release(); | 788 return list.release(); |
793 } | 789 } |
794 | 790 |
795 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationFillMode(Timing::FillMo
de fillMode) | 791 static CSSValue valueForAnimationFillMode(Timing::FillMode fillMode) |
796 { | 792 { |
797 switch (fillMode) { | 793 switch (fillMode) { |
798 case Timing::FillModeNone: | 794 case Timing::FillModeNone: |
799 return cssValuePool().createIdentifierValue(CSSValueNone); | 795 return cssValuePool().createIdentifierValue(CSSValueNone); |
800 case Timing::FillModeForwards: | 796 case Timing::FillModeForwards: |
801 return cssValuePool().createIdentifierValue(CSSValueForwards); | 797 return cssValuePool().createIdentifierValue(CSSValueForwards); |
802 case Timing::FillModeBackwards: | 798 case Timing::FillModeBackwards: |
803 return cssValuePool().createIdentifierValue(CSSValueBackwards); | 799 return cssValuePool().createIdentifierValue(CSSValueBackwards); |
804 case Timing::FillModeBoth: | 800 case Timing::FillModeBoth: |
805 return cssValuePool().createIdentifierValue(CSSValueBoth); | 801 return cssValuePool().createIdentifierValue(CSSValueBoth); |
806 default: | 802 default: |
807 ASSERT_NOT_REACHED(); | 803 ASSERT_NOT_REACHED(); |
808 return nullptr; | 804 return cssValuePool().createIdentifierValue(CSSValueNone); |
809 } | 805 } |
810 } | 806 } |
811 | 807 |
812 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationIterationCount(double i
terationCount) | 808 static CSSValue valueForAnimationIterationCount(double iterationCount) |
813 { | 809 { |
814 if (iterationCount == std::numeric_limits<double>::infinity()) | 810 if (iterationCount == std::numeric_limits<double>::infinity()) |
815 return cssValuePool().createIdentifierValue(CSSValueInfinite); | 811 return cssValuePool().createIdentifierValue(CSSValueInfinite); |
816 return cssValuePool().createValue(iterationCount, CSSPrimitiveValue::CSS_NUM
BER); | 812 return cssValuePool().createValue(iterationCount, CSSPrimitiveValue::CSS_NUM
BER); |
817 } | 813 } |
818 | 814 |
819 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationPlayState(EAnimPlayStat
e playState) | 815 static CSSValue valueForAnimationPlayState(EAnimPlayState playState) |
820 { | 816 { |
821 if (playState == AnimPlayStatePlaying) | 817 if (playState == AnimPlayStatePlaying) |
822 return cssValuePool().createIdentifierValue(CSSValueRunning); | 818 return cssValuePool().createIdentifierValue(CSSValueRunning); |
823 ASSERT(playState == AnimPlayStatePaused); | 819 ASSERT(playState == AnimPlayStatePaused); |
824 return cssValuePool().createIdentifierValue(CSSValuePaused); | 820 return cssValuePool().createIdentifierValue(CSSValuePaused); |
825 } | 821 } |
826 | 822 |
827 static PassRefPtrWillBeRawPtr<CSSValue> createTimingFunctionValue(const TimingFu
nction* timingFunction) | 823 static CSSValue createTimingFunctionValue(const TimingFunction* timingFunction) |
828 { | 824 { |
829 switch (timingFunction->type()) { | 825 switch (timingFunction->type()) { |
830 case TimingFunction::CubicBezierFunction: | 826 case TimingFunction::CubicBezierFunction: |
831 { | 827 { |
832 const CubicBezierTimingFunction* bezierTimingFunction = toCubicBezie
rTimingFunction(timingFunction); | 828 const CubicBezierTimingFunction* bezierTimingFunction = toCubicBezie
rTimingFunction(timingFunction); |
833 if (bezierTimingFunction->subType() != CubicBezierTimingFunction::Cu
stom) { | 829 if (bezierTimingFunction->subType() != CubicBezierTimingFunction::Cu
stom) { |
834 CSSValueID valueId = CSSValueInvalid; | 830 CSSValueID valueId = CSSValueInvalid; |
835 switch (bezierTimingFunction->subType()) { | 831 switch (bezierTimingFunction->subType()) { |
836 case CubicBezierTimingFunction::Ease: | 832 case CubicBezierTimingFunction::Ease: |
837 valueId = CSSValueEase; | 833 valueId = CSSValueEase; |
838 break; | 834 break; |
839 case CubicBezierTimingFunction::EaseIn: | 835 case CubicBezierTimingFunction::EaseIn: |
840 valueId = CSSValueEaseIn; | 836 valueId = CSSValueEaseIn; |
841 break; | 837 break; |
842 case CubicBezierTimingFunction::EaseOut: | 838 case CubicBezierTimingFunction::EaseOut: |
843 valueId = CSSValueEaseOut; | 839 valueId = CSSValueEaseOut; |
844 break; | 840 break; |
845 case CubicBezierTimingFunction::EaseInOut: | 841 case CubicBezierTimingFunction::EaseInOut: |
846 valueId = CSSValueEaseInOut; | 842 valueId = CSSValueEaseInOut; |
847 break; | 843 break; |
848 default: | 844 default: |
849 ASSERT_NOT_REACHED(); | 845 ASSERT_NOT_REACHED(); |
850 return nullptr; | 846 valueId = CSSValueEase; |
851 } | 847 } |
852 return cssValuePool().createIdentifierValue(valueId); | 848 return cssValuePool().createIdentifierValue(valueId); |
853 } | 849 } |
854 return CSSCubicBezierTimingFunctionValue::create(bezierTimingFunctio
n->x1(), bezierTimingFunction->y1(), bezierTimingFunction->x2(), bezierTimingFun
ction->y2()); | 850 return CSSCubicBezierTimingFunctionValue::create(bezierTimingFunctio
n->x1(), bezierTimingFunction->y1(), bezierTimingFunction->x2(), bezierTimingFun
ction->y2()); |
855 } | 851 } |
856 | 852 |
857 case TimingFunction::StepsFunction: | 853 case TimingFunction::StepsFunction: |
858 { | 854 { |
859 const StepsTimingFunction* stepsTimingFunction = toStepsTimingFuncti
on(timingFunction); | 855 const StepsTimingFunction* stepsTimingFunction = toStepsTimingFuncti
on(timingFunction); |
860 StepsTimingFunction::StepAtPosition position = stepsTimingFunction->
stepAtPosition(); | 856 StepsTimingFunction::StepAtPosition position = stepsTimingFunction->
stepAtPosition(); |
861 int steps = stepsTimingFunction->numberOfSteps(); | 857 int steps = stepsTimingFunction->numberOfSteps(); |
862 ASSERT(position == StepsTimingFunction::Start || position == StepsTi
mingFunction::End); | 858 ASSERT(position == StepsTimingFunction::Start || position == StepsTi
mingFunction::End); |
863 | 859 |
864 if (steps > 1) | 860 if (steps > 1) |
865 return CSSStepsTimingFunctionValue::create(steps, position); | 861 return CSSStepsTimingFunctionValue::create(steps, position); |
866 CSSValueID valueId = position == StepsTimingFunction::Start ? CSSVal
ueStepStart : CSSValueStepEnd; | 862 CSSValueID valueId = position == StepsTimingFunction::Start ? CSSVal
ueStepStart : CSSValueStepEnd; |
867 return cssValuePool().createIdentifierValue(valueId); | 863 return cssValuePool().createIdentifierValue(valueId); |
868 } | 864 } |
869 | 865 |
870 default: | 866 default: |
871 return cssValuePool().createIdentifierValue(CSSValueLinear); | 867 return cssValuePool().createIdentifierValue(CSSValueLinear); |
872 } | 868 } |
873 } | 869 } |
874 | 870 |
875 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationTimingFunction(const CS
STimingData* timingData) | 871 static CSSValue valueForAnimationTimingFunction(const CSSTimingData* timingData) |
876 { | 872 { |
877 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 873 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; |
878 if (timingData) { | 874 if (timingData) { |
879 for (size_t i = 0; i < timingData->timingFunctionList().size(); ++i) | 875 for (size_t i = 0; i < timingData->timingFunctionList().size(); ++i) |
880 list->append(createTimingFunctionValue(timingData->timingFunctionLis
t()[i].get())); | 876 list->append(createTimingFunctionValue(timingData->timingFunctionLis
t()[i].get())); |
881 } else { | 877 } else { |
882 list->append(createTimingFunctionValue(CSSTimingData::initialTimingFunct
ion().get())); | 878 list->append(createTimingFunctionValue(CSSTimingData::initialTimingFunct
ion().get())); |
883 } | 879 } |
884 return list.release(); | 880 return list.release(); |
885 } | 881 } |
886 | 882 |
887 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForBorderRadiusCorner(LengthSi
ze radius, const ComputedStyle& style) | 883 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForBorderRadiusCorner(LengthSi
ze radius, const ComputedStyle& style) |
888 { | 884 { |
889 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 885 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
890 if (radius.width().type() == Percent) | 886 if (radius.width().type() == Percent) |
891 list->append(cssValuePool().createValue(radius.width().percent(), CSSPri
mitiveValue::CSS_PERCENTAGE)); | 887 list->append(cssValuePool().createValue(radius.width().percent(), CSSPri
mitiveValue::CSS_PERCENTAGE)); |
892 else | 888 else |
893 list->append(zoomAdjustedPixelValueForLength(radius.width(), style)); | 889 list->append(zoomAdjustedPixelValueForLength(radius.width(), style)); |
894 if (radius.height().type() == Percent) | 890 if (radius.height().type() == Percent) |
895 list->append(cssValuePool().createValue(radius.height().percent(), CSSPr
imitiveValue::CSS_PERCENTAGE)); | 891 list->append(cssValuePool().createValue(radius.height().percent(), CSSPr
imitiveValue::CSS_PERCENTAGE)); |
896 else | 892 else |
897 list->append(zoomAdjustedPixelValueForLength(radius.height(), style)); | 893 list->append(zoomAdjustedPixelValueForLength(radius.height(), style)); |
898 return list.release(); | 894 return list.release(); |
899 } | 895 } |
900 | 896 |
901 static PassRefPtrWillBeRawPtr<CSSValue> valueForBorderRadiusCorner(LengthSize ra
dius, const ComputedStyle& style) | 897 static CSSValue valueForBorderRadiusCorner(LengthSize radius, const ComputedStyl
e& style) |
902 { | 898 { |
903 RefPtrWillBeRawPtr<CSSValueList> list = valuesForBorderRadiusCorner(radius,
style); | 899 RefPtrWillBeRawPtr<CSSValueList> list = valuesForBorderRadiusCorner(radius,
style); |
904 if (list->item(0)->equals(*list->item(1))) | 900 if (list->item(0).equals(list->item(1))) |
905 return list->item(0); | 901 return list->item(0); |
906 return list.release(); | 902 return list.release(); |
907 } | 903 } |
908 | 904 |
909 static PassRefPtrWillBeRawPtr<CSSFunctionValue> valueForMatrixTransform(const Tr
ansformationMatrix& transform, const ComputedStyle& style) | 905 static PassRefPtrWillBeRawPtr<CSSFunctionValue> valueForMatrixTransform(const Tr
ansformationMatrix& transform, const ComputedStyle& style) |
910 { | 906 { |
911 RefPtrWillBeRawPtr<CSSFunctionValue> transformValue = nullptr; | 907 RefPtrWillBeRawPtr<CSSFunctionValue> transformValue = nullptr; |
912 if (transform.isAffine()) { | 908 if (transform.isAffine()) { |
913 transformValue = CSSFunctionValue::create(CSSValueMatrix); | 909 transformValue = CSSFunctionValue::create(CSSValueMatrix); |
914 | 910 |
(...skipping 23 matching lines...) Expand all Loading... |
938 | 934 |
939 transformValue->append(zoomAdjustedNumberValue(transform.m41(), style)); | 935 transformValue->append(zoomAdjustedNumberValue(transform.m41(), style)); |
940 transformValue->append(zoomAdjustedNumberValue(transform.m42(), style)); | 936 transformValue->append(zoomAdjustedNumberValue(transform.m42(), style)); |
941 transformValue->append(zoomAdjustedNumberValue(transform.m43(), style)); | 937 transformValue->append(zoomAdjustedNumberValue(transform.m43(), style)); |
942 transformValue->append(cssValuePool().createValue(transform.m44(), CSSPr
imitiveValue::CSS_NUMBER)); | 938 transformValue->append(cssValuePool().createValue(transform.m44(), CSSPr
imitiveValue::CSS_NUMBER)); |
943 } | 939 } |
944 | 940 |
945 return transformValue.release(); | 941 return transformValue.release(); |
946 } | 942 } |
947 | 943 |
948 static PassRefPtrWillBeRawPtr<CSSValue> computedTransform(const LayoutObject* la
youtObject, const ComputedStyle& style) | 944 static CSSValue computedTransform(const LayoutObject* layoutObject, const Comput
edStyle& style) |
949 { | 945 { |
950 if (!layoutObject || !layoutObject->hasTransformRelatedProperty() || !style.
hasTransform()) | 946 if (!layoutObject || !layoutObject->hasTransformRelatedProperty() || !style.
hasTransform()) |
951 return cssValuePool().createIdentifierValue(CSSValueNone); | 947 return cssValuePool().createIdentifierValue(CSSValueNone); |
952 | 948 |
953 IntRect box; | 949 IntRect box; |
954 if (layoutObject->isBox()) | 950 if (layoutObject->isBox()) |
955 box = pixelSnappedIntRect(toLayoutBox(layoutObject)->borderBoxRect()); | 951 box = pixelSnappedIntRect(toLayoutBox(layoutObject)->borderBoxRect()); |
956 | 952 |
957 TransformationMatrix transform; | 953 TransformationMatrix transform; |
958 style.applyTransform(transform, LayoutSize(box.size()), ComputedStyle::Exclu
deTransformOrigin, ComputedStyle::ExcludeMotionPath); | 954 style.applyTransform(transform, LayoutSize(box.size()), ComputedStyle::Exclu
deTransformOrigin, ComputedStyle::ExcludeMotionPath); |
959 | 955 |
960 // FIXME: Need to print out individual functions (https://bugs.webkit.org/sh
ow_bug.cgi?id=23924) | 956 // FIXME: Need to print out individual functions (https://bugs.webkit.org/sh
ow_bug.cgi?id=23924) |
961 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 957 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
962 list->append(valueForMatrixTransform(transform, style)); | 958 list->append(valueForMatrixTransform(transform, style)); |
963 | 959 |
964 return list.release(); | 960 return list.release(); |
965 } | 961 } |
966 | 962 |
967 static PassRefPtrWillBeRawPtr<CSSValue> createTransitionPropertyValue(const CSST
ransitionData::TransitionProperty& property) | 963 static CSSValue createTransitionPropertyValue(const CSSTransitionData::Transitio
nProperty& property) |
968 { | 964 { |
969 if (property.propertyType == CSSTransitionData::TransitionNone) | 965 if (property.propertyType == CSSTransitionData::TransitionNone) |
970 return cssValuePool().createIdentifierValue(CSSValueNone); | 966 return cssValuePool().createIdentifierValue(CSSValueNone); |
971 if (property.propertyType == CSSTransitionData::TransitionAll) | 967 if (property.propertyType == CSSTransitionData::TransitionAll) |
972 return cssValuePool().createIdentifierValue(CSSValueAll); | 968 return cssValuePool().createIdentifierValue(CSSValueAll); |
973 if (property.propertyType == CSSTransitionData::TransitionUnknown) | 969 if (property.propertyType == CSSTransitionData::TransitionUnknown) |
974 return cssValuePool().createValue(property.propertyString, CSSPrimitiveV
alue::CSS_CUSTOM_IDENT); | 970 return cssValuePool().createValue(property.propertyString, CSSPrimitiveV
alue::CSS_CUSTOM_IDENT); |
975 ASSERT(property.propertyType == CSSTransitionData::TransitionSingleProperty)
; | 971 ASSERT(property.propertyType == CSSTransitionData::TransitionSingleProperty)
; |
976 return cssValuePool().createValue(getPropertyNameString(property.unresolvedP
roperty), CSSPrimitiveValue::CSS_CUSTOM_IDENT); | 972 return cssValuePool().createValue(getPropertyNameString(property.unresolvedP
roperty), CSSPrimitiveValue::CSS_CUSTOM_IDENT); |
977 } | 973 } |
978 | 974 |
979 static PassRefPtrWillBeRawPtr<CSSValue> valueForTransitionProperty(const CSSTran
sitionData* transitionData) | 975 static CSSValue valueForTransitionProperty(const CSSTransitionData* transitionDa
ta) |
980 { | 976 { |
981 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 977 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; |
982 if (transitionData) { | 978 if (transitionData) { |
983 for (size_t i = 0; i < transitionData->propertyList().size(); ++i) | 979 for (size_t i = 0; i < transitionData->propertyList().size(); ++i) |
984 list->append(createTransitionPropertyValue(transitionData->propertyL
ist()[i])); | 980 list->append(createTransitionPropertyValue(transitionData->propertyL
ist()[i])); |
985 } else { | 981 } else { |
986 list->append(cssValuePool().createIdentifierValue(CSSValueAll)); | 982 list->append(cssValuePool().createIdentifierValue(CSSValueAll)); |
987 } | 983 } |
988 return list.release(); | 984 return list.release(); |
989 } | 985 } |
990 | 986 |
991 static PassRefPtrWillBeRawPtr<CSSValue> createLineBoxContainValue(unsigned lineB
oxContain) | 987 static CSSValue createLineBoxContainValue(unsigned lineBoxContain) |
992 { | 988 { |
993 if (!lineBoxContain) | 989 if (!lineBoxContain) |
994 return cssValuePool().createIdentifierValue(CSSValueNone); | 990 return cssValuePool().createIdentifierValue(CSSValueNone); |
995 return CSSLineBoxContainValue::create(lineBoxContain); | 991 return CSSLineBoxContainValue::create(lineBoxContain); |
996 } | 992 } |
997 | 993 |
998 CSSValueID valueForQuoteType(const QuoteType quoteType) | 994 CSSValueID valueForQuoteType(const QuoteType quoteType) |
999 { | 995 { |
1000 switch (quoteType) { | 996 switch (quoteType) { |
1001 case NO_OPEN_QUOTE: | 997 case NO_OPEN_QUOTE: |
1002 return CSSValueNoOpenQuote; | 998 return CSSValueNoOpenQuote; |
1003 case NO_CLOSE_QUOTE: | 999 case NO_CLOSE_QUOTE: |
1004 return CSSValueNoCloseQuote; | 1000 return CSSValueNoCloseQuote; |
1005 case CLOSE_QUOTE: | 1001 case CLOSE_QUOTE: |
1006 return CSSValueCloseQuote; | 1002 return CSSValueCloseQuote; |
1007 case OPEN_QUOTE: | 1003 case OPEN_QUOTE: |
1008 return CSSValueOpenQuote; | 1004 return CSSValueOpenQuote; |
1009 } | 1005 } |
1010 ASSERT_NOT_REACHED(); | 1006 ASSERT_NOT_REACHED(); |
1011 return CSSValueInvalid; | 1007 return CSSValueInvalid; |
1012 } | 1008 } |
1013 | 1009 |
1014 static PassRefPtrWillBeRawPtr<CSSValue> valueForContentData(const ComputedStyle&
style) | 1010 static CSSValue valueForContentData(const ComputedStyle& style) |
1015 { | 1011 { |
1016 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 1012 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
1017 for (const ContentData* contentData = style.contentData(); contentData; cont
entData = contentData->next()) { | 1013 for (const ContentData* contentData = style.contentData(); contentData; cont
entData = contentData->next()) { |
1018 if (contentData->isCounter()) { | 1014 if (contentData->isCounter()) { |
1019 const CounterContent* counter = toCounterContentData(contentData)->c
ounter(); | 1015 const CounterContent* counter = toCounterContentData(contentData)->c
ounter(); |
1020 ASSERT(counter); | 1016 ASSERT(counter); |
1021 RefPtrWillBeRawPtr<CSSPrimitiveValue> identifier = cssValuePool().cr
eateValue(counter->identifier(), CSSPrimitiveValue::CSS_CUSTOM_IDENT); | 1017 RefPtrWillBeRawPtr<CSSPrimitiveValue> identifier = cssValuePool().cr
eateValue(counter->identifier(), CSSPrimitiveValue::CSS_CUSTOM_IDENT); |
1022 RefPtrWillBeRawPtr<CSSPrimitiveValue> separator = cssValuePool().cre
ateValue(counter->separator(), CSSPrimitiveValue::CSS_CUSTOM_IDENT); | 1018 RefPtrWillBeRawPtr<CSSPrimitiveValue> separator = cssValuePool().cre
ateValue(counter->separator(), CSSPrimitiveValue::CSS_CUSTOM_IDENT); |
1023 CSSValueID listStyleIdent = CSSValueNone; | 1019 CSSValueID listStyleIdent = CSSValueNone; |
1024 if (counter->listStyle() != NoneListStyle) | 1020 if (counter->listStyle() != NoneListStyle) |
1025 listStyleIdent = static_cast<CSSValueID>(CSSValueDisc + counter-
>listStyle()); | 1021 listStyleIdent = static_cast<CSSValueID>(CSSValueDisc + counter-
>listStyle()); |
1026 RefPtrWillBeRawPtr<CSSPrimitiveValue> listStyle = cssValuePool().cre
ateIdentifierValue(listStyleIdent); | 1022 RefPtrWillBeRawPtr<CSSPrimitiveValue> listStyle = cssValuePool().cre
ateIdentifierValue(listStyleIdent); |
1027 list->append(cssValuePool().createValue(Counter::create(identifier.r
elease(), listStyle.release(), separator.release()))); | 1023 list->append(cssValuePool().createValue(Counter::create(identifier.r
elease(), listStyle.release(), separator.release()))); |
1028 } else if (contentData->isImage()) { | 1024 } else if (contentData->isImage()) { |
1029 const StyleImage* image = toImageContentData(contentData)->image(); | 1025 const StyleImage* image = toImageContentData(contentData)->image(); |
1030 ASSERT(image); | 1026 ASSERT(image); |
1031 list->append(image->cssValue()); | 1027 list->append(*image->cssValue()); |
1032 } else if (contentData->isText()) { | 1028 } else if (contentData->isText()) { |
1033 list->append(cssValuePool().createValue(toTextContentData(contentDat
a)->text(), CSSPrimitiveValue::CSS_STRING)); | 1029 list->append(cssValuePool().createValue(toTextContentData(contentDat
a)->text(), CSSPrimitiveValue::CSS_STRING)); |
1034 } else if (contentData->isQuote()) { | 1030 } else if (contentData->isQuote()) { |
1035 const QuoteType quoteType = toQuoteContentData(contentData)->quote()
; | 1031 const QuoteType quoteType = toQuoteContentData(contentData)->quote()
; |
1036 list->append(cssValuePool().createIdentifierValue(valueForQuoteType(
quoteType))); | 1032 list->append(cssValuePool().createIdentifierValue(valueForQuoteType(
quoteType))); |
1037 } else { | 1033 } else { |
1038 ASSERT_NOT_REACHED(); | 1034 ASSERT_NOT_REACHED(); |
1039 } | 1035 } |
1040 } | 1036 } |
1041 return list.release(); | 1037 return list.release(); |
1042 } | 1038 } |
1043 | 1039 |
1044 static PassRefPtrWillBeRawPtr<CSSValue> valueForCounterDirectives(const Computed
Style& style, CSSPropertyID propertyID) | 1040 static CSSValue valueForCounterDirectives(const ComputedStyle& style, CSSPropert
yID propertyID) |
1045 { | 1041 { |
1046 const CounterDirectiveMap* map = style.counterDirectives(); | 1042 const CounterDirectiveMap* map = style.counterDirectives(); |
1047 if (!map) | 1043 if (!map) |
1048 return cssValuePool().createIdentifierValue(CSSValueNone); | 1044 return cssValuePool().createIdentifierValue(CSSValueNone); |
1049 | 1045 |
1050 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 1046 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
1051 for (const auto& item : *map) { | 1047 for (const auto& item : *map) { |
1052 bool isValidCounterValue = propertyID == CSSPropertyCounterIncrement ? i
tem.value.isIncrement() : item.value.isReset(); | 1048 bool isValidCounterValue = propertyID == CSSPropertyCounterIncrement ? i
tem.value.isIncrement() : item.value.isReset(); |
1053 if (!isValidCounterValue) | 1049 if (!isValidCounterValue) |
1054 continue; | 1050 continue; |
1055 | 1051 |
1056 list->append(cssValuePool().createValue(item.key, CSSPrimitiveValue::CSS
_CUSTOM_IDENT)); | 1052 list->append(cssValuePool().createValue(item.key, CSSPrimitiveValue::CSS
_CUSTOM_IDENT)); |
1057 short number = propertyID == CSSPropertyCounterIncrement ? item.value.in
crementValue() : item.value.resetValue(); | 1053 short number = propertyID == CSSPropertyCounterIncrement ? item.value.in
crementValue() : item.value.resetValue(); |
1058 list->append(cssValuePool().createValue((double)number, CSSPrimitiveValu
e::CSS_NUMBER)); | 1054 list->append(cssValuePool().createValue((double)number, CSSPrimitiveValu
e::CSS_NUMBER)); |
1059 } | 1055 } |
1060 | 1056 |
1061 if (!list->length()) | 1057 if (!list->length()) |
1062 return cssValuePool().createIdentifierValue(CSSValueNone); | 1058 return cssValuePool().createIdentifierValue(CSSValueNone); |
1063 | 1059 |
1064 return list.release(); | 1060 return list.release(); |
1065 } | 1061 } |
1066 | 1062 |
1067 static PassRefPtrWillBeRawPtr<CSSValue> valueForShape(const ComputedStyle& style
, ShapeValue* shapeValue) | 1063 static CSSValue valueForShape(const ComputedStyle& style, ShapeValue* shapeValue
) |
1068 { | 1064 { |
1069 if (!shapeValue) | 1065 if (!shapeValue) |
1070 return cssValuePool().createIdentifierValue(CSSValueNone); | 1066 return cssValuePool().createIdentifierValue(CSSValueNone); |
1071 if (shapeValue->type() == ShapeValue::Box) | 1067 if (shapeValue->type() == ShapeValue::Box) |
1072 return cssValuePool().createValue(shapeValue->cssBox()); | 1068 return cssValuePool().createValue(shapeValue->cssBox()); |
1073 if (shapeValue->type() == ShapeValue::Image) { | 1069 if (shapeValue->type() == ShapeValue::Image) { |
1074 if (shapeValue->image()) | 1070 if (shapeValue->image()) |
1075 return shapeValue->image()->cssValue(); | 1071 return *shapeValue->image()->cssValue(); |
1076 return cssValuePool().createIdentifierValue(CSSValueNone); | 1072 return cssValuePool().createIdentifierValue(CSSValueNone); |
1077 } | 1073 } |
1078 | 1074 |
1079 ASSERT(shapeValue->type() == ShapeValue::Shape); | 1075 ASSERT(shapeValue->type() == ShapeValue::Shape); |
1080 | 1076 |
1081 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 1077 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
1082 list->append(valueForBasicShape(style, shapeValue->shape())); | 1078 list->append(valueForBasicShape(style, shapeValue->shape())); |
1083 if (shapeValue->cssBox() != BoxMissing) | 1079 if (shapeValue->cssBox() != BoxMissing) |
1084 list->append(cssValuePool().createValue(shapeValue->cssBox())); | 1080 list->append(cssValuePool().createValue(shapeValue->cssBox())); |
1085 return list.release(); | 1081 return list.release(); |
1086 } | 1082 } |
1087 | 1083 |
1088 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForSidesShorthand(const StyleP
ropertyShorthand& shorthand, const ComputedStyle& style, const LayoutObject* lay
outObject, Node* styledNode, bool allowVisitedStyle) | 1084 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForSidesShorthand(const StyleP
ropertyShorthand& shorthand, const ComputedStyle& style, const LayoutObject* lay
outObject, Node* styledNode, bool allowVisitedStyle) |
1089 { | 1085 { |
1090 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 1086 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
1091 // Assume the properties are in the usual order top, right, bottom, left. | 1087 // Assume the properties are in the usual order top, right, bottom, left. |
1092 RefPtrWillBeRawPtr<CSSValue> topValue = ComputedStyleCSSValueMapping::get(sh
orthand.properties()[0], style, layoutObject, styledNode, allowVisitedStyle); | 1088 NullableCSSValue topValue = ComputedStyleCSSValueMapping::get(shorthand.prop
erties()[0], style, layoutObject, styledNode, allowVisitedStyle); |
1093 RefPtrWillBeRawPtr<CSSValue> rightValue = ComputedStyleCSSValueMapping::get(
shorthand.properties()[1], style, layoutObject, styledNode, allowVisitedStyle); | 1089 NullableCSSValue rightValue = ComputedStyleCSSValueMapping::get(shorthand.pr
operties()[1], style, layoutObject, styledNode, allowVisitedStyle); |
1094 RefPtrWillBeRawPtr<CSSValue> bottomValue = ComputedStyleCSSValueMapping::get
(shorthand.properties()[2], style, layoutObject, styledNode, allowVisitedStyle); | 1090 NullableCSSValue bottomValue = ComputedStyleCSSValueMapping::get(shorthand.p
roperties()[2], style, layoutObject, styledNode, allowVisitedStyle); |
1095 RefPtrWillBeRawPtr<CSSValue> leftValue = ComputedStyleCSSValueMapping::get(s
horthand.properties()[3], style, layoutObject, styledNode, allowVisitedStyle); | 1091 NullableCSSValue leftValue = ComputedStyleCSSValueMapping::get(shorthand.pro
perties()[3], style, layoutObject, styledNode, allowVisitedStyle); |
1096 | 1092 |
1097 // All 4 properties must be specified. | 1093 // All 4 properties must be specified. |
1098 if (!topValue || !rightValue || !bottomValue || !leftValue) | 1094 if (!topValue || !rightValue || !bottomValue || !leftValue) |
1099 return nullptr; | 1095 return nullptr; |
1100 | 1096 |
1101 bool showLeft = !compareCSSValuePtr(rightValue, leftValue); | 1097 bool showLeft = !rightValue->equals(*leftValue); |
1102 bool showBottom = !compareCSSValuePtr(topValue, bottomValue) || showLeft; | 1098 bool showBottom = !topValue->equals(*bottomValue) || showLeft; |
1103 bool showRight = !compareCSSValuePtr(topValue, rightValue) || showBottom; | 1099 bool showRight = !topValue->equals(*rightValue) || showBottom; |
1104 | 1100 |
1105 list->append(topValue.release()); | 1101 list->append(*topValue); |
1106 if (showRight) | 1102 if (showRight) |
1107 list->append(rightValue.release()); | 1103 list->append(*rightValue); |
1108 if (showBottom) | 1104 if (showBottom) |
1109 list->append(bottomValue.release()); | 1105 list->append(*bottomValue); |
1110 if (showLeft) | 1106 if (showLeft) |
1111 list->append(leftValue.release()); | 1107 list->append(*leftValue); |
1112 | 1108 |
1113 return list.release(); | 1109 return list.release(); |
1114 } | 1110 } |
1115 | 1111 |
1116 static PassRefPtrWillBeRawPtr<CSSValueList> valueForBorderRadiusShorthand(const
ComputedStyle& style) | 1112 static PassRefPtrWillBeRawPtr<CSSValueList> valueForBorderRadiusShorthand(const
ComputedStyle& style) |
1117 { | 1113 { |
1118 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated()
; | 1114 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated()
; |
1119 | 1115 |
1120 bool showHorizontalBottomLeft = style.borderTopRightRadius().width() != styl
e.borderBottomLeftRadius().width(); | 1116 bool showHorizontalBottomLeft = style.borderTopRightRadius().width() != styl
e.borderBottomLeftRadius().width(); |
1121 bool showHorizontalBottomRight = showHorizontalBottomLeft || (style.borderBo
ttomRightRadius().width() != style.borderTopLeftRadius().width()); | 1117 bool showHorizontalBottomRight = showHorizontalBottomLeft || (style.borderBo
ttomRightRadius().width() != style.borderTopLeftRadius().width()); |
(...skipping 21 matching lines...) Expand all Loading... |
1143 | 1139 |
1144 RefPtrWillBeRawPtr<CSSValueList> verticalRadii = CSSValueList::createSpaceSe
parated(); | 1140 RefPtrWillBeRawPtr<CSSValueList> verticalRadii = CSSValueList::createSpaceSe
parated(); |
1145 verticalRadii->append(topLeftRadius->item(1)); | 1141 verticalRadii->append(topLeftRadius->item(1)); |
1146 if (showVerticalTopRight) | 1142 if (showVerticalTopRight) |
1147 verticalRadii->append(topRightRadius->item(1)); | 1143 verticalRadii->append(topRightRadius->item(1)); |
1148 if (showVerticalBottomRight) | 1144 if (showVerticalBottomRight) |
1149 verticalRadii->append(bottomRightRadius->item(1)); | 1145 verticalRadii->append(bottomRightRadius->item(1)); |
1150 if (showVerticalBottomLeft) | 1146 if (showVerticalBottomLeft) |
1151 verticalRadii->append(bottomLeftRadius->item(1)); | 1147 verticalRadii->append(bottomLeftRadius->item(1)); |
1152 | 1148 |
1153 if (!verticalRadii->equals(*toCSSValueList(list->item(0)))) | 1149 if (!verticalRadii->equals(toCSSValueList(list->item(0)))) |
1154 list->append(verticalRadii.release()); | 1150 list->append(verticalRadii.release()); |
1155 | 1151 |
1156 return list.release(); | 1152 return list.release(); |
1157 } | 1153 } |
1158 | 1154 |
1159 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> glyphOrientationToCSSPrimitiveV
alue(EGlyphOrientation orientation) | 1155 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> glyphOrientationToCSSPrimitiveV
alue(EGlyphOrientation orientation) |
1160 { | 1156 { |
1161 switch (orientation) { | 1157 switch (orientation) { |
1162 case GO_0DEG: | 1158 case GO_0DEG: |
1163 return CSSPrimitiveValue::create(0.0f, CSSPrimitiveValue::CSS_DEG); | 1159 return CSSPrimitiveValue::create(0.0f, CSSPrimitiveValue::CSS_DEG); |
1164 case GO_90DEG: | 1160 case GO_90DEG: |
1165 return CSSPrimitiveValue::create(90.0f, CSSPrimitiveValue::CSS_DEG); | 1161 return CSSPrimitiveValue::create(90.0f, CSSPrimitiveValue::CSS_DEG); |
1166 case GO_180DEG: | 1162 case GO_180DEG: |
1167 return CSSPrimitiveValue::create(180.0f, CSSPrimitiveValue::CSS_DEG); | 1163 return CSSPrimitiveValue::create(180.0f, CSSPrimitiveValue::CSS_DEG); |
1168 case GO_270DEG: | 1164 case GO_270DEG: |
1169 return CSSPrimitiveValue::create(270.0f, CSSPrimitiveValue::CSS_DEG); | 1165 return CSSPrimitiveValue::create(270.0f, CSSPrimitiveValue::CSS_DEG); |
1170 default: | 1166 default: |
1171 return nullptr; | 1167 return nullptr; |
1172 } | 1168 } |
1173 } | 1169 } |
1174 | 1170 |
1175 static PassRefPtrWillBeRawPtr<CSSValue> strokeDashArrayToCSSValueList(const SVGD
ashArray& dashes, const ComputedStyle& style) | 1171 static CSSValue strokeDashArrayToCSSValueList(const SVGDashArray& dashes, const
ComputedStyle& style) |
1176 { | 1172 { |
1177 if (dashes.isEmpty()) | 1173 if (dashes.isEmpty()) |
1178 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | 1174 return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
1179 | 1175 |
1180 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 1176 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; |
1181 for (const Length& dashLength : dashes.vector()) | 1177 for (const Length& dashLength : dashes.vector()) |
1182 list->append(zoomAdjustedPixelValueForLength(dashLength, style)); | 1178 list->append(zoomAdjustedPixelValueForLength(dashLength, style)); |
1183 | 1179 |
1184 return list.release(); | 1180 return list.release(); |
1185 } | 1181 } |
1186 | 1182 |
1187 static PassRefPtrWillBeRawPtr<CSSValue> paintOrderToCSSValueList(EPaintOrder pai
ntorder) | 1183 static CSSValue paintOrderToCSSValueList(EPaintOrder paintorder) |
1188 { | 1184 { |
1189 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 1185 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
1190 do { | 1186 do { |
1191 EPaintOrderType paintOrderType = (EPaintOrderType)(paintorder & ((1 << k
PaintOrderBitwidth) - 1)); | 1187 EPaintOrderType paintOrderType = (EPaintOrderType)(paintorder & ((1 << k
PaintOrderBitwidth) - 1)); |
1192 switch (paintOrderType) { | 1188 switch (paintOrderType) { |
1193 case PT_FILL: | 1189 case PT_FILL: |
1194 case PT_STROKE: | 1190 case PT_STROKE: |
1195 case PT_MARKERS: | 1191 case PT_MARKERS: |
1196 list->append(CSSPrimitiveValue::create(paintOrderType)); | 1192 list->append(CSSPrimitiveValue::create(paintOrderType)); |
1197 break; | 1193 break; |
1198 case PT_NONE: | 1194 case PT_NONE: |
1199 default: | 1195 default: |
1200 ASSERT_NOT_REACHED(); | 1196 ASSERT_NOT_REACHED(); |
1201 break; | 1197 break; |
1202 } | 1198 } |
1203 } while (paintorder >>= kPaintOrderBitwidth); | 1199 } while (paintorder >>= kPaintOrderBitwidth); |
1204 | 1200 |
1205 return list.release(); | 1201 return list.release(); |
1206 } | 1202 } |
1207 | 1203 |
1208 static PassRefPtrWillBeRawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintTy
pe paintType, const String& url, const Color& color, const Color& currentColor) | 1204 static CSSValue adjustSVGPaintForCurrentColor(SVGPaintType paintType, const Stri
ng& url, const Color& color, const Color& currentColor) |
1209 { | 1205 { |
1210 if (paintType >= SVG_PAINTTYPE_URI_NONE) { | 1206 if (paintType >= SVG_PAINTTYPE_URI_NONE) { |
1211 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSepar
ated(); | 1207 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSepar
ated(); |
1212 values->append(CSSPrimitiveValue::create(url, CSSPrimitiveValue::CSS_URI
)); | 1208 values->append(CSSPrimitiveValue::create(url, CSSPrimitiveValue::CSS_URI
)); |
1213 if (paintType == SVG_PAINTTYPE_URI_NONE) | 1209 if (paintType == SVG_PAINTTYPE_URI_NONE) |
1214 values->append(CSSPrimitiveValue::create(CSSValueNone)); | 1210 values->append(CSSPrimitiveValue::create(CSSValueNone)); |
1215 else if (paintType == SVG_PAINTTYPE_URI_CURRENTCOLOR) | 1211 else if (paintType == SVG_PAINTTYPE_URI_CURRENTCOLOR) |
1216 values->append(CSSPrimitiveValue::createColor(currentColor.rgb())); | 1212 values->append(CSSPrimitiveValue::createColor(currentColor.rgb())); |
1217 else if (paintType == SVG_PAINTTYPE_URI_RGBCOLOR) | 1213 else if (paintType == SVG_PAINTTYPE_URI_RGBCOLOR) |
1218 values->append(CSSPrimitiveValue::createColor(color.rgb())); | 1214 values->append(CSSPrimitiveValue::createColor(color.rgb())); |
1219 return values.release(); | 1215 return values.release(); |
1220 } | 1216 } |
1221 if (paintType == SVG_PAINTTYPE_NONE) | 1217 if (paintType == SVG_PAINTTYPE_NONE) |
1222 return CSSPrimitiveValue::create(CSSValueNone); | 1218 return CSSPrimitiveValue::create(CSSValueNone); |
1223 if (paintType == SVG_PAINTTYPE_CURRENTCOLOR) | 1219 if (paintType == SVG_PAINTTYPE_CURRENTCOLOR) |
1224 return CSSPrimitiveValue::createColor(currentColor.rgb()); | 1220 return CSSPrimitiveValue::createColor(currentColor.rgb()); |
1225 | 1221 |
1226 return CSSPrimitiveValue::createColor(color.rgb()); | 1222 return CSSPrimitiveValue::createColor(color.rgb()); |
1227 } | 1223 } |
1228 | 1224 |
1229 static inline String serializeAsFragmentIdentifier(const AtomicString& resource) | 1225 static inline String serializeAsFragmentIdentifier(const AtomicString& resource) |
1230 { | 1226 { |
1231 return "#" + resource; | 1227 return "#" + resource; |
1232 } | 1228 } |
1233 | 1229 |
1234 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowDat
a(const ShadowData& shadow, const ComputedStyle& style, bool useSpread) | 1230 CSSValue ComputedStyleCSSValueMapping::valueForShadowData(const ShadowData& shad
ow, const ComputedStyle& style, bool useSpread) |
1235 { | 1231 { |
1236 RefPtrWillBeRawPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(shadow.x(),
style); | 1232 RefPtrWillBeRawPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(shadow.x(),
style); |
1237 RefPtrWillBeRawPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(shadow.y(),
style); | 1233 RefPtrWillBeRawPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(shadow.y(),
style); |
1238 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(shadow.b
lur(), style); | 1234 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(shadow.b
lur(), style); |
1239 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = useSpread ? zoomAdjustedPixel
Value(shadow.spread(), style) : PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullpt
r); | 1235 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = useSpread ? zoomAdjustedPixel
Value(shadow.spread(), style) : PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullpt
r); |
1240 RefPtrWillBeRawPtr<CSSPrimitiveValue> shadowStyle = shadow.style() == Normal
? PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullptr) : cssValuePool().createIde
ntifierValue(CSSValueInset); | 1236 RefPtrWillBeRawPtr<CSSPrimitiveValue> shadowStyle = shadow.style() == Normal
? PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullptr) : cssValuePool().createIde
ntifierValue(CSSValueInset); |
1241 RefPtrWillBeRawPtr<CSSPrimitiveValue> color = currentColorOrValidColor(style
, shadow.color()); | 1237 RefPtrWillBeRawPtr<CSSPrimitiveValue> color = currentColorOrValidColor(style
, shadow.color()); |
1242 return CSSShadowValue::create(x.release(), y.release(), blur.release(), spre
ad.release(), shadowStyle.release(), color.release()); | 1238 return CSSShadowValue::create(x.release(), y.release(), blur.release(), spre
ad.release(), shadowStyle.release(), color.release()); |
1243 } | 1239 } |
1244 | 1240 |
1245 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowLis
t(const ShadowList* shadowList, const ComputedStyle& style, bool useSpread) | 1241 CSSValue ComputedStyleCSSValueMapping::valueForShadowList(const ShadowList* shad
owList, const ComputedStyle& style, bool useSpread) |
1246 { | 1242 { |
1247 if (!shadowList) | 1243 if (!shadowList) |
1248 return cssValuePool().createIdentifierValue(CSSValueNone); | 1244 return cssValuePool().createIdentifierValue(CSSValueNone); |
1249 | 1245 |
1250 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 1246 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; |
1251 size_t shadowCount = shadowList->shadows().size(); | 1247 size_t shadowCount = shadowList->shadows().size(); |
1252 for (size_t i = 0; i < shadowCount; ++i) | 1248 for (size_t i = 0; i < shadowCount; ++i) |
1253 list->append(valueForShadowData(shadowList->shadows()[i], style, useSpre
ad)); | 1249 list->append(valueForShadowData(shadowList->shadows()[i], style, useSpre
ad)); |
1254 return list.release(); | 1250 return list.release(); |
1255 } | 1251 } |
1256 | 1252 |
1257 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForFilter(co
nst ComputedStyle& style) | 1253 CSSValue ComputedStyleCSSValueMapping::valueForFilter(const ComputedStyle& style
) |
1258 { | 1254 { |
1259 if (style.filter().operations().isEmpty()) | 1255 if (style.filter().operations().isEmpty()) |
1260 return cssValuePool().createIdentifierValue(CSSValueNone); | 1256 return cssValuePool().createIdentifierValue(CSSValueNone); |
1261 | 1257 |
1262 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 1258 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
1263 | 1259 |
1264 RefPtrWillBeRawPtr<CSSFunctionValue> filterValue = nullptr; | 1260 RefPtrWillBeRawPtr<CSSFunctionValue> filterValue = nullptr; |
1265 | 1261 |
1266 for (const auto& operation : style.filter().operations()) { | 1262 for (const auto& operation : style.filter().operations()) { |
1267 FilterOperation* filterOperation = operation.get(); | 1263 FilterOperation* filterOperation = operation.get(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1317 default: | 1313 default: |
1318 ASSERT_NOT_REACHED(); | 1314 ASSERT_NOT_REACHED(); |
1319 break; | 1315 break; |
1320 } | 1316 } |
1321 list->append(filterValue.release()); | 1317 list->append(filterValue.release()); |
1322 } | 1318 } |
1323 | 1319 |
1324 return list.release(); | 1320 return list.release(); |
1325 } | 1321 } |
1326 | 1322 |
1327 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForFont(cons
t ComputedStyle& style) | 1323 CSSValue ComputedStyleCSSValueMapping::valueForFont(const ComputedStyle& style) |
1328 { | 1324 { |
1329 // Add a slash between size and line-height. | 1325 // Add a slash between size and line-height. |
1330 RefPtrWillBeRawPtr<CSSValueList> sizeAndLineHeight = CSSValueList::createSla
shSeparated(); | 1326 RefPtrWillBeRawPtr<CSSValueList> sizeAndLineHeight = CSSValueList::createSla
shSeparated(); |
1331 sizeAndLineHeight->append(valueForFontSize(style)); | 1327 sizeAndLineHeight->append(valueForFontSize(style)); |
1332 sizeAndLineHeight->append(valueForLineHeight(style)); | 1328 sizeAndLineHeight->append(valueForLineHeight(style)); |
1333 | 1329 |
1334 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 1330 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
1335 list->append(valueForFontStyle(style)); | 1331 list->append(valueForFontStyle(style)); |
1336 list->append(valueForFontVariant(style)); | 1332 list->append(valueForFontVariant(style)); |
1337 list->append(valueForFontWeight(style)); | 1333 list->append(valueForFontWeight(style)); |
1338 list->append(valueForFontStretch(style)); | 1334 list->append(valueForFontStretch(style)); |
1339 list->append(sizeAndLineHeight.release()); | 1335 list->append(sizeAndLineHeight.release()); |
1340 list->append(valueForFontFamily(style)); | 1336 list->append(valueForFontFamily(style)); |
1341 | 1337 |
1342 return list.release(); | 1338 return list.release(); |
1343 } | 1339 } |
1344 | 1340 |
1345 static PassRefPtrWillBeRawPtr<CSSValue> valueForScrollSnapDestination(const Leng
thPoint& destination, const ComputedStyle& style) | 1341 static CSSValue valueForScrollSnapDestination(const LengthPoint& destination, co
nst ComputedStyle& style) |
1346 { | 1342 { |
1347 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 1343 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
1348 list->append(zoomAdjustedPixelValueForLength(destination.x(), style)); | 1344 list->append(zoomAdjustedPixelValueForLength(destination.x(), style)); |
1349 list->append(zoomAdjustedPixelValueForLength(destination.y(), style)); | 1345 list->append(zoomAdjustedPixelValueForLength(destination.y(), style)); |
1350 return list.release(); | 1346 return list.release(); |
1351 } | 1347 } |
1352 | 1348 |
1353 static PassRefPtrWillBeRawPtr<CSSValue> valueForScrollSnapPoints(const ScrollSna
pPoints& points, const ComputedStyle& style) | 1349 static CSSValue valueForScrollSnapPoints(const ScrollSnapPoints& points, const C
omputedStyle& style) |
1354 { | 1350 { |
1355 if (points.hasRepeat) { | 1351 if (points.hasRepeat) { |
1356 RefPtrWillBeRawPtr<CSSFunctionValue> repeat = CSSFunctionValue::create(C
SSValueRepeat); | 1352 RefPtrWillBeRawPtr<CSSFunctionValue> repeat = CSSFunctionValue::create(C
SSValueRepeat); |
1357 repeat->append(zoomAdjustedPixelValueForLength(points.repeatOffset, styl
e)); | 1353 repeat->append(zoomAdjustedPixelValueForLength(points.repeatOffset, styl
e)); |
1358 return repeat.release(); | 1354 return repeat.release(); |
1359 } | 1355 } |
1360 | 1356 |
1361 return cssValuePool().createIdentifierValue(CSSValueNone); | 1357 return cssValuePool().createIdentifierValue(CSSValueNone); |
1362 } | 1358 } |
1363 | 1359 |
1364 static PassRefPtrWillBeRawPtr<CSSValue> valueForScrollSnapCoordinate(const Vecto
r<LengthPoint>& coordinates, const ComputedStyle& style) | 1360 static CSSValue valueForScrollSnapCoordinate(const Vector<LengthPoint>& coordina
tes, const ComputedStyle& style) |
1365 { | 1361 { |
1366 if (coordinates.isEmpty()) | 1362 if (coordinates.isEmpty()) |
1367 return cssValuePool().createIdentifierValue(CSSValueNone); | 1363 return cssValuePool().createIdentifierValue(CSSValueNone); |
1368 | 1364 |
1369 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 1365 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; |
1370 | 1366 |
1371 for (auto& coordinate : coordinates) { | 1367 for (auto& coordinate : coordinates) { |
1372 auto pair = CSSValueList::createSpaceSeparated(); | 1368 auto pair = CSSValueList::createSpaceSeparated(); |
1373 pair->append(zoomAdjustedPixelValueForLength(coordinate.x(), style)); | 1369 pair->append(zoomAdjustedPixelValueForLength(coordinate.x(), style)); |
1374 pair->append(zoomAdjustedPixelValueForLength(coordinate.y(), style)); | 1370 pair->append(zoomAdjustedPixelValueForLength(coordinate.y(), style)); |
1375 list->append(pair); | 1371 list->append(pair); |
1376 } | 1372 } |
1377 | 1373 |
1378 return list.release(); | 1374 return list.release(); |
1379 } | 1375 } |
1380 | 1376 |
1381 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::get(CSSPropertyID
propertyID, const ComputedStyle& style, const LayoutObject* layoutObject, Node*
styledNode, bool allowVisitedStyle) | 1377 NullableCSSValue ComputedStyleCSSValueMapping::get(CSSPropertyID propertyID, con
st ComputedStyle& style, const LayoutObject* layoutObject, Node* styledNode, boo
l allowVisitedStyle) |
1382 { | 1378 { |
1383 const SVGComputedStyle& svgStyle = style.svgStyle(); | 1379 const SVGComputedStyle& svgStyle = style.svgStyle(); |
1384 propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style.di
rection(), style.writingMode()); | 1380 propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style.di
rection(), style.writingMode()); |
1385 switch (propertyID) { | 1381 switch (propertyID) { |
1386 case CSSPropertyInvalid: | 1382 case CSSPropertyInvalid: |
1387 return nullptr; | 1383 return nullptr; |
1388 | 1384 |
1389 case CSSPropertyBackgroundColor: | 1385 case CSSPropertyBackgroundColor: |
1390 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited
DependentColor(CSSPropertyBackgroundColor).rgb()) : currentColorOrValidColor(sty
le, style.backgroundColor()); | 1386 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited
DependentColor(CSSPropertyBackgroundColor).rgb()) : currentColorOrValidColor(sty
le, style.backgroundColor()); |
1391 case CSSPropertyBackgroundImage: | 1387 case CSSPropertyBackgroundImage: |
1392 case CSSPropertyWebkitMaskImage: { | 1388 case CSSPropertyWebkitMaskImage: { |
1393 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); | 1389 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); |
1394 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskImage ?
&style.maskLayers() : &style.backgroundLayers(); | 1390 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskImage ?
&style.maskLayers() : &style.backgroundLayers(); |
1395 for (; currLayer; currLayer = currLayer->next()) { | 1391 for (; currLayer; currLayer = currLayer->next()) { |
1396 if (currLayer->image()) | 1392 if (currLayer->image()) |
1397 list->append(currLayer->image()->cssValue()); | 1393 list->append(*currLayer->image()->cssValue()); |
1398 else | 1394 else |
1399 list->append(cssValuePool().createIdentifierValue(CSSValueNone))
; | 1395 list->append(cssValuePool().createIdentifierValue(CSSValueNone))
; |
1400 } | 1396 } |
1401 return list.release(); | 1397 return list.release(); |
1402 } | 1398 } |
1403 case CSSPropertyBackgroundSize: | 1399 case CSSPropertyBackgroundSize: |
1404 case CSSPropertyWebkitMaskSize: { | 1400 case CSSPropertyWebkitMaskSize: { |
1405 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); | 1401 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); |
1406 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskSize ? &
style.maskLayers() : &style.backgroundLayers(); | 1402 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskSize ? &
style.maskLayers() : &style.backgroundLayers(); |
1407 for (; currLayer; currLayer = currLayer->next()) | 1403 for (; currLayer; currLayer = currLayer->next()) |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1583 case CSSPropertyTabSize: | 1579 case CSSPropertyTabSize: |
1584 return cssValuePool().createValue( | 1580 return cssValuePool().createValue( |
1585 style.tabSize().getPixelSize(1.0), style.tabSize().isSpaces() ? CSSP
rimitiveValue::CSS_NUMBER : CSSPrimitiveValue::CSS_PX); | 1581 style.tabSize().getPixelSize(1.0), style.tabSize().isSpaces() ? CSSP
rimitiveValue::CSS_NUMBER : CSSPrimitiveValue::CSS_PX); |
1586 case CSSPropertyCursor: { | 1582 case CSSPropertyCursor: { |
1587 RefPtrWillBeRawPtr<CSSValueList> list = nullptr; | 1583 RefPtrWillBeRawPtr<CSSValueList> list = nullptr; |
1588 CursorList* cursors = style.cursors(); | 1584 CursorList* cursors = style.cursors(); |
1589 if (cursors && cursors->size() > 0) { | 1585 if (cursors && cursors->size() > 0) { |
1590 list = CSSValueList::createCommaSeparated(); | 1586 list = CSSValueList::createCommaSeparated(); |
1591 for (unsigned i = 0; i < cursors->size(); ++i) { | 1587 for (unsigned i = 0; i < cursors->size(); ++i) { |
1592 if (StyleImage* image = cursors->at(i).image()) | 1588 if (StyleImage* image = cursors->at(i).image()) |
1593 list->append(image->cssValue()); | 1589 list->append(*image->cssValue()); |
1594 } | 1590 } |
1595 } | 1591 } |
1596 RefPtrWillBeRawPtr<CSSValue> value = cssValuePool().createValue(style.cu
rsor()); | 1592 CSSValue value = cssValuePool().createValue(style.cursor()); |
1597 if (list) { | 1593 if (list) { |
1598 list->append(value.release()); | 1594 list->append(value); |
1599 return list.release(); | 1595 return list.release(); |
1600 } | 1596 } |
1601 return value.release(); | 1597 return value; |
1602 } | 1598 } |
1603 case CSSPropertyDirection: | 1599 case CSSPropertyDirection: |
1604 return cssValuePool().createValue(style.direction()); | 1600 return cssValuePool().createValue(style.direction()); |
1605 case CSSPropertyDisplay: | 1601 case CSSPropertyDisplay: |
1606 return cssValuePool().createValue(style.display()); | 1602 return cssValuePool().createValue(style.display()); |
1607 case CSSPropertyEmptyCells: | 1603 case CSSPropertyEmptyCells: |
1608 return cssValuePool().createValue(style.emptyCells()); | 1604 return cssValuePool().createValue(style.emptyCells()); |
1609 case CSSPropertyAlignContent: | 1605 case CSSPropertyAlignContent: |
1610 return valueForContentPositionAndDistributionWithOverflowAlignment(resol
veContentAlignmentAuto(style.alignContentPosition(), style.alignContentDistribut
ion(), styledNode), style.alignContentOverflowAlignment(), style.alignContentDis
tribution()); | 1606 return valueForContentPositionAndDistributionWithOverflowAlignment(resol
veContentAlignmentAuto(style.alignContentPosition(), style.alignContentDistribut
ion(), styledNode), style.alignContentOverflowAlignment(), style.alignContentDis
tribution()); |
1611 case CSSPropertyAlignItems: | 1607 case CSSPropertyAlignItems: |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2356 | 2352 |
2357 case CSSPropertyBackgroundBlendMode: { | 2353 case CSSPropertyBackgroundBlendMode: { |
2358 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); | 2354 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); |
2359 for (const FillLayer* currLayer = &style.backgroundLayers(); currLayer;
currLayer = currLayer->next()) | 2355 for (const FillLayer* currLayer = &style.backgroundLayers(); currLayer;
currLayer = currLayer->next()) |
2360 list->append(cssValuePool().createValue(currLayer->blendMode())); | 2356 list->append(cssValuePool().createValue(currLayer->blendMode())); |
2361 return list.release(); | 2357 return list.release(); |
2362 } | 2358 } |
2363 case CSSPropertyBackground: | 2359 case CSSPropertyBackground: |
2364 return valuesForBackgroundShorthand(style, layoutObject, styledNode, all
owVisitedStyle); | 2360 return valuesForBackgroundShorthand(style, layoutObject, styledNode, all
owVisitedStyle); |
2365 case CSSPropertyBorder: { | 2361 case CSSPropertyBorder: { |
2366 RefPtrWillBeRawPtr<CSSValue> value = get(CSSPropertyBorderTop, style, la
youtObject, styledNode, allowVisitedStyle); | 2362 NullableCSSValue value = get(CSSPropertyBorderTop, style, layoutObject,
styledNode, allowVisitedStyle); |
2367 const CSSPropertyID properties[] = { | 2363 const CSSPropertyID properties[] = { |
2368 CSSPropertyBorderRight, | 2364 CSSPropertyBorderRight, |
2369 CSSPropertyBorderBottom, | 2365 CSSPropertyBorderBottom, |
2370 CSSPropertyBorderLeft | 2366 CSSPropertyBorderLeft |
2371 }; | 2367 }; |
2372 for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) { | 2368 for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) { |
2373 if (!compareCSSValuePtr<CSSValue>(value, get(properties[i], style, l
ayoutObject, styledNode, allowVisitedStyle))) | 2369 if (value != get(properties[i], style, layoutObject, styledNode, all
owVisitedStyle)) |
2374 return nullptr; | 2370 return nullptr; |
2375 } | 2371 } |
2376 return value.release(); | 2372 return *value; |
2377 } | 2373 } |
2378 case CSSPropertyBorderBottom: | 2374 case CSSPropertyBorderBottom: |
2379 return valuesForShorthandProperty(borderBottomShorthand(), style, layout
Object, styledNode, allowVisitedStyle); | 2375 return valuesForShorthandProperty(borderBottomShorthand(), style, layout
Object, styledNode, allowVisitedStyle); |
2380 case CSSPropertyBorderColor: | 2376 case CSSPropertyBorderColor: |
2381 return valuesForSidesShorthand(borderColorShorthand(), style, layoutObje
ct, styledNode, allowVisitedStyle); | 2377 return valuesForSidesShorthand(borderColorShorthand(), style, layoutObje
ct, styledNode, allowVisitedStyle); |
2382 case CSSPropertyBorderLeft: | 2378 case CSSPropertyBorderLeft: |
2383 return valuesForShorthandProperty(borderLeftShorthand(), style, layoutOb
ject, styledNode, allowVisitedStyle); | 2379 return valuesForShorthandProperty(borderLeftShorthand(), style, layoutOb
ject, styledNode, allowVisitedStyle); |
2384 case CSSPropertyBorderImage: | 2380 case CSSPropertyBorderImage: |
2385 return valueForNinePieceImage(style.borderImage(), style); | 2381 return valueForNinePieceImage(style.borderImage(), style); |
2386 case CSSPropertyBorderRadius: | 2382 case CSSPropertyBorderRadius: |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2642 case CSSPropertyAll: | 2638 case CSSPropertyAll: |
2643 return nullptr; | 2639 return nullptr; |
2644 default: | 2640 default: |
2645 break; | 2641 break; |
2646 } | 2642 } |
2647 ASSERT_NOT_REACHED(); | 2643 ASSERT_NOT_REACHED(); |
2648 return nullptr; | 2644 return nullptr; |
2649 } | 2645 } |
2650 | 2646 |
2651 } | 2647 } |
OLD | NEW |