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