| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 #include "core/style/StyleVariableData.h" | 58 #include "core/style/StyleVariableData.h" |
| 59 #include "platform/LengthFunctions.h" | 59 #include "platform/LengthFunctions.h" |
| 60 | 60 |
| 61 namespace blink { | 61 namespace blink { |
| 62 | 62 |
| 63 inline static bool isFlexOrGrid(const ComputedStyle* style) | 63 inline static bool isFlexOrGrid(const ComputedStyle* style) |
| 64 { | 64 { |
| 65 return style && style->isDisplayFlexibleOrGridBox(); | 65 return style && style->isDisplayFlexibleOrGridBox(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 inline static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedPixelValue(d
ouble value, const ComputedStyle& style) | 68 inline static RawPtr<CSSPrimitiveValue> zoomAdjustedPixelValue(double value, con
st ComputedStyle& style) |
| 69 { | 69 { |
| 70 return cssValuePool().createValue(adjustFloatForAbsoluteZoom(value, style),
CSSPrimitiveValue::UnitType::Pixels); | 70 return cssValuePool().createValue(adjustFloatForAbsoluteZoom(value, style),
CSSPrimitiveValue::UnitType::Pixels); |
| 71 } | 71 } |
| 72 | 72 |
| 73 inline static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedNumberValue(
double value, const ComputedStyle& style) | 73 inline static RawPtr<CSSPrimitiveValue> zoomAdjustedNumberValue(double value, co
nst ComputedStyle& style) |
| 74 { | 74 { |
| 75 return cssValuePool().createValue(value / style.effectiveZoom(), CSSPrimitiv
eValue::UnitType::Number); | 75 return cssValuePool().createValue(value / style.effectiveZoom(), CSSPrimitiv
eValue::UnitType::Number); |
| 76 } | 76 } |
| 77 | 77 |
| 78 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedPixelValueForLength
(const Length& length, const ComputedStyle& style) | 78 static RawPtr<CSSPrimitiveValue> zoomAdjustedPixelValueForLength(const Length& l
ength, const ComputedStyle& style) |
| 79 { | 79 { |
| 80 if (length.isFixed()) | 80 if (length.isFixed()) |
| 81 return zoomAdjustedPixelValue(length.value(), style); | 81 return zoomAdjustedPixelValue(length.value(), style); |
| 82 return cssValuePool().createValue(length, style); | 82 return cssValuePool().createValue(length, style); |
| 83 } | 83 } |
| 84 | 84 |
| 85 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> pixelValueForUnzoomedLength(con
st UnzoomedLength& unzoomedLength, const ComputedStyle& style) | 85 static RawPtr<CSSPrimitiveValue> pixelValueForUnzoomedLength(const UnzoomedLengt
h& unzoomedLength, const ComputedStyle& style) |
| 86 { | 86 { |
| 87 const Length& length = unzoomedLength.length(); | 87 const Length& length = unzoomedLength.length(); |
| 88 if (length.isFixed()) | 88 if (length.isFixed()) |
| 89 return cssValuePool().createValue(length.value(), CSSPrimitiveValue::Uni
tType::Pixels); | 89 return cssValuePool().createValue(length.value(), CSSPrimitiveValue::Uni
tType::Pixels); |
| 90 return cssValuePool().createValue(length, style); | 90 return cssValuePool().createValue(length, style); |
| 91 } | 91 } |
| 92 | 92 |
| 93 static PassRefPtrWillBeRawPtr<CSSValueList> createPositionListForLayer(CSSProper
tyID propertyID, const FillLayer& layer, const ComputedStyle& style) | 93 static RawPtr<CSSValueList> createPositionListForLayer(CSSPropertyID propertyID,
const FillLayer& layer, const ComputedStyle& style) |
| 94 { | 94 { |
| 95 RefPtrWillBeRawPtr<CSSValueList> positionList = CSSValueList::createSpaceSep
arated(); | 95 RawPtr<CSSValueList> positionList = CSSValueList::createSpaceSeparated(); |
| 96 if (layer.isBackgroundXOriginSet()) { | 96 if (layer.isBackgroundXOriginSet()) { |
| 97 ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPosition ||
propertyID == CSSPropertyWebkitMaskPosition); | 97 ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPosition ||
propertyID == CSSPropertyWebkitMaskPosition); |
| 98 positionList->append(cssValuePool().createValue(layer.backgroundXOrigin(
))); | 98 positionList->append(cssValuePool().createValue(layer.backgroundXOrigin(
))); |
| 99 } | 99 } |
| 100 positionList->append(zoomAdjustedPixelValueForLength(layer.xPosition(), styl
e)); | 100 positionList->append(zoomAdjustedPixelValueForLength(layer.xPosition(), styl
e)); |
| 101 if (layer.isBackgroundYOriginSet()) { | 101 if (layer.isBackgroundYOriginSet()) { |
| 102 ASSERT(propertyID == CSSPropertyBackgroundPosition || propertyID == CSSP
ropertyWebkitMaskPosition); | 102 ASSERT(propertyID == CSSPropertyBackgroundPosition || propertyID == CSSP
ropertyWebkitMaskPosition); |
| 103 positionList->append(cssValuePool().createValue(layer.backgroundYOrigin(
))); | 103 positionList->append(cssValuePool().createValue(layer.backgroundYOrigin(
))); |
| 104 } | 104 } |
| 105 positionList->append(zoomAdjustedPixelValueForLength(layer.yPosition(), styl
e)); | 105 positionList->append(zoomAdjustedPixelValueForLength(layer.yPosition(), styl
e)); |
| 106 return positionList.release(); | 106 return positionList.release(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::currentColorOrVal
idColor(const ComputedStyle& style, const StyleColor& color) | 109 RawPtr<CSSValue> ComputedStyleCSSValueMapping::currentColorOrValidColor(const Co
mputedStyle& style, const StyleColor& color) |
| 110 { | 110 { |
| 111 // This function does NOT look at visited information, so that computed styl
e doesn't expose that. | 111 // This function does NOT look at visited information, so that computed styl
e doesn't expose that. |
| 112 return cssValuePool().createColorValue(color.resolve(style.color()).rgb()); | 112 return cssValuePool().createColorValue(color.resolve(style.color()).rgb()); |
| 113 } | 113 } |
| 114 | 114 |
| 115 static PassRefPtrWillBeRawPtr<CSSValue> valueForFillSize(const FillSize& fillSiz
e, const ComputedStyle& style) | 115 static RawPtr<CSSValue> valueForFillSize(const FillSize& fillSize, const Compute
dStyle& style) |
| 116 { | 116 { |
| 117 if (fillSize.type == Contain) | 117 if (fillSize.type == Contain) |
| 118 return cssValuePool().createIdentifierValue(CSSValueContain); | 118 return cssValuePool().createIdentifierValue(CSSValueContain); |
| 119 | 119 |
| 120 if (fillSize.type == Cover) | 120 if (fillSize.type == Cover) |
| 121 return cssValuePool().createIdentifierValue(CSSValueCover); | 121 return cssValuePool().createIdentifierValue(CSSValueCover); |
| 122 | 122 |
| 123 if (fillSize.size.height().isAuto()) | 123 if (fillSize.size.height().isAuto()) |
| 124 return zoomAdjustedPixelValueForLength(fillSize.size.width(), style); | 124 return zoomAdjustedPixelValueForLength(fillSize.size.width(), style); |
| 125 | 125 |
| 126 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 126 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 127 list->append(zoomAdjustedPixelValueForLength(fillSize.size.width(), style)); | 127 list->append(zoomAdjustedPixelValueForLength(fillSize.size.width(), style)); |
| 128 list->append(zoomAdjustedPixelValueForLength(fillSize.size.height(), style))
; | 128 list->append(zoomAdjustedPixelValueForLength(fillSize.size.height(), style))
; |
| 129 return list.release(); | 129 return list.release(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 static PassRefPtrWillBeRawPtr<CSSValue> valueForFillRepeat(EFillRepeat xRepeat,
EFillRepeat yRepeat) | 132 static RawPtr<CSSValue> valueForFillRepeat(EFillRepeat xRepeat, EFillRepeat yRep
eat) |
| 133 { | 133 { |
| 134 // For backwards compatibility, if both values are equal, just return one of
them. And | 134 // For backwards compatibility, if both values are equal, just return one of
them. And |
| 135 // if the two values are equivalent to repeat-x or repeat-y, just return the
shorthand. | 135 // if the two values are equivalent to repeat-x or repeat-y, just return the
shorthand. |
| 136 if (xRepeat == yRepeat) | 136 if (xRepeat == yRepeat) |
| 137 return cssValuePool().createValue(xRepeat); | 137 return cssValuePool().createValue(xRepeat); |
| 138 if (xRepeat == RepeatFill && yRepeat == NoRepeatFill) | 138 if (xRepeat == RepeatFill && yRepeat == NoRepeatFill) |
| 139 return cssValuePool().createIdentifierValue(CSSValueRepeatX); | 139 return cssValuePool().createIdentifierValue(CSSValueRepeatX); |
| 140 if (xRepeat == NoRepeatFill && yRepeat == RepeatFill) | 140 if (xRepeat == NoRepeatFill && yRepeat == RepeatFill) |
| 141 return cssValuePool().createIdentifierValue(CSSValueRepeatY); | 141 return cssValuePool().createIdentifierValue(CSSValueRepeatY); |
| 142 | 142 |
| 143 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 143 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 144 list->append(cssValuePool().createValue(xRepeat)); | 144 list->append(cssValuePool().createValue(xRepeat)); |
| 145 list->append(cssValuePool().createValue(yRepeat)); | 145 list->append(cssValuePool().createValue(yRepeat)); |
| 146 return list.release(); | 146 return list.release(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 static PassRefPtrWillBeRawPtr<CSSValue> valueForFillSourceType(EMaskSourceType t
ype) | 149 static RawPtr<CSSValue> valueForFillSourceType(EMaskSourceType type) |
| 150 { | 150 { |
| 151 switch (type) { | 151 switch (type) { |
| 152 case MaskAlpha: | 152 case MaskAlpha: |
| 153 return cssValuePool().createIdentifierValue(CSSValueAlpha); | 153 return cssValuePool().createIdentifierValue(CSSValueAlpha); |
| 154 case MaskLuminance: | 154 case MaskLuminance: |
| 155 return cssValuePool().createIdentifierValue(CSSValueLuminance); | 155 return cssValuePool().createIdentifierValue(CSSValueLuminance); |
| 156 } | 156 } |
| 157 | 157 |
| 158 ASSERT_NOT_REACHED(); | 158 ASSERT_NOT_REACHED(); |
| 159 | 159 |
| 160 return nullptr; | 160 return nullptr; |
| 161 } | 161 } |
| 162 | 162 |
| 163 static PassRefPtrWillBeRawPtr<CSSValue> valueForPositionOffset(const ComputedSty
le& style, CSSPropertyID propertyID, const LayoutObject* layoutObject) | 163 static RawPtr<CSSValue> valueForPositionOffset(const ComputedStyle& style, CSSPr
opertyID propertyID, const LayoutObject* layoutObject) |
| 164 { | 164 { |
| 165 Length offset; | 165 Length offset; |
| 166 switch (propertyID) { | 166 switch (propertyID) { |
| 167 case CSSPropertyLeft: | 167 case CSSPropertyLeft: |
| 168 offset = style.left(); | 168 offset = style.left(); |
| 169 break; | 169 break; |
| 170 case CSSPropertyRight: | 170 case CSSPropertyRight: |
| 171 offset = style.right(); | 171 offset = style.right(); |
| 172 break; | 172 break; |
| 173 case CSSPropertyTop: | 173 case CSSPropertyTop: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 189 if (offset.isAuto()) { | 189 if (offset.isAuto()) { |
| 190 // FIXME: It's not enough to simply return "auto" values for one offset
if the other side is defined. | 190 // FIXME: It's not enough to simply return "auto" values for one offset
if the other side is defined. |
| 191 // In other words if left is auto and right is not auto, then left's com
puted value is negative right(). | 191 // In other words if left is auto and right is not auto, then left's com
puted value is negative right(). |
| 192 // So we should get the opposite length unit and see if it is auto. | 192 // So we should get the opposite length unit and see if it is auto. |
| 193 return cssValuePool().createIdentifierValue(CSSValueAuto); | 193 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 194 } | 194 } |
| 195 | 195 |
| 196 return zoomAdjustedPixelValueForLength(offset, style); | 196 return zoomAdjustedPixelValueForLength(offset, style); |
| 197 } | 197 } |
| 198 | 198 |
| 199 static PassRefPtrWillBeRawPtr<CSSBorderImageSliceValue> valueForNinePieceImageSl
ice(const NinePieceImage& image) | 199 static RawPtr<CSSBorderImageSliceValue> valueForNinePieceImageSlice(const NinePi
eceImage& image) |
| 200 { | 200 { |
| 201 // Create the slices. | 201 // Create the slices. |
| 202 RefPtrWillBeRawPtr<CSSPrimitiveValue> top = nullptr; | 202 RawPtr<CSSPrimitiveValue> top = nullptr; |
| 203 RefPtrWillBeRawPtr<CSSPrimitiveValue> right = nullptr; | 203 RawPtr<CSSPrimitiveValue> right = nullptr; |
| 204 RefPtrWillBeRawPtr<CSSPrimitiveValue> bottom = nullptr; | 204 RawPtr<CSSPrimitiveValue> bottom = nullptr; |
| 205 RefPtrWillBeRawPtr<CSSPrimitiveValue> left = nullptr; | 205 RawPtr<CSSPrimitiveValue> left = nullptr; |
| 206 | 206 |
| 207 // TODO(alancutter): Make this code aware of calc lengths. | 207 // TODO(alancutter): Make this code aware of calc lengths. |
| 208 if (image.imageSlices().top().hasPercent()) | 208 if (image.imageSlices().top().hasPercent()) |
| 209 top = cssValuePool().createValue(image.imageSlices().top().value(), CSSP
rimitiveValue::UnitType::Percentage); | 209 top = cssValuePool().createValue(image.imageSlices().top().value(), CSSP
rimitiveValue::UnitType::Percentage); |
| 210 else | 210 else |
| 211 top = cssValuePool().createValue(image.imageSlices().top().value(), CSSP
rimitiveValue::UnitType::Number); | 211 top = cssValuePool().createValue(image.imageSlices().top().value(), CSSP
rimitiveValue::UnitType::Number); |
| 212 | 212 |
| 213 if (image.imageSlices().right() == image.imageSlices().top() && image.imageS
lices().bottom() == image.imageSlices().top() | 213 if (image.imageSlices().right() == image.imageSlices().top() && image.imageS
lices().bottom() == image.imageSlices().top() |
| 214 && image.imageSlices().left() == image.imageSlices().top()) { | 214 && image.imageSlices().left() == image.imageSlices().top()) { |
| 215 right = top; | 215 right = top; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 237 left = cssValuePool().createValue(image.imageSlices().left()
.value(), CSSPrimitiveValue::UnitType::Percentage); | 237 left = cssValuePool().createValue(image.imageSlices().left()
.value(), CSSPrimitiveValue::UnitType::Percentage); |
| 238 else | 238 else |
| 239 left = cssValuePool().createValue(image.imageSlices().left()
.value(), CSSPrimitiveValue::UnitType::Number); | 239 left = cssValuePool().createValue(image.imageSlices().left()
.value(), CSSPrimitiveValue::UnitType::Number); |
| 240 } | 240 } |
| 241 } | 241 } |
| 242 } | 242 } |
| 243 | 243 |
| 244 return CSSBorderImageSliceValue::create(CSSQuadValue::create(top.release(),
right.release(), bottom.release(), left.release(), CSSQuadValue::SerializeAsQuad
), image.fill()); | 244 return CSSBorderImageSliceValue::create(CSSQuadValue::create(top.release(),
right.release(), bottom.release(), left.release(), CSSQuadValue::SerializeAsQuad
), image.fill()); |
| 245 } | 245 } |
| 246 | 246 |
| 247 static PassRefPtrWillBeRawPtr<CSSQuadValue> valueForNinePieceImageQuad(const Bor
derImageLengthBox& box, const ComputedStyle& style) | 247 static RawPtr<CSSQuadValue> valueForNinePieceImageQuad(const BorderImageLengthBo
x& box, const ComputedStyle& style) |
| 248 { | 248 { |
| 249 // Create the slices. | 249 // Create the slices. |
| 250 RefPtrWillBeRawPtr<CSSPrimitiveValue> top = nullptr; | 250 RawPtr<CSSPrimitiveValue> top = nullptr; |
| 251 RefPtrWillBeRawPtr<CSSPrimitiveValue> right = nullptr; | 251 RawPtr<CSSPrimitiveValue> right = nullptr; |
| 252 RefPtrWillBeRawPtr<CSSPrimitiveValue> bottom = nullptr; | 252 RawPtr<CSSPrimitiveValue> bottom = nullptr; |
| 253 RefPtrWillBeRawPtr<CSSPrimitiveValue> left = nullptr; | 253 RawPtr<CSSPrimitiveValue> left = nullptr; |
| 254 | 254 |
| 255 if (box.top().isNumber()) | 255 if (box.top().isNumber()) |
| 256 top = cssValuePool().createValue(box.top().number(), CSSPrimitiveValue::
UnitType::Number); | 256 top = cssValuePool().createValue(box.top().number(), CSSPrimitiveValue::
UnitType::Number); |
| 257 else | 257 else |
| 258 top = cssValuePool().createValue(box.top().length(), style); | 258 top = cssValuePool().createValue(box.top().length(), style); |
| 259 | 259 |
| 260 if (box.right() == box.top() && box.bottom() == box.top() && box.left() == b
ox.top()) { | 260 if (box.right() == box.top() && box.bottom() == box.top() && box.left() == b
ox.top()) { |
| 261 right = top; | 261 right = top; |
| 262 bottom = top; | 262 bottom = top; |
| 263 left = top; | 263 left = top; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 return CSSValueRepeat; | 297 return CSSValueRepeat; |
| 298 case RoundImageRule: | 298 case RoundImageRule: |
| 299 return CSSValueRound; | 299 return CSSValueRound; |
| 300 case SpaceImageRule: | 300 case SpaceImageRule: |
| 301 return CSSValueSpace; | 301 return CSSValueSpace; |
| 302 default: | 302 default: |
| 303 return CSSValueStretch; | 303 return CSSValueStretch; |
| 304 } | 304 } |
| 305 } | 305 } |
| 306 | 306 |
| 307 static PassRefPtrWillBeRawPtr<CSSValue> valueForNinePieceImageRepeat(const NineP
ieceImage& image) | 307 static RawPtr<CSSValue> valueForNinePieceImageRepeat(const NinePieceImage& image
) |
| 308 { | 308 { |
| 309 RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalRepeat = nullptr; | 309 RawPtr<CSSPrimitiveValue> horizontalRepeat = nullptr; |
| 310 RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalRepeat = nullptr; | 310 RawPtr<CSSPrimitiveValue> verticalRepeat = nullptr; |
| 311 | 311 |
| 312 horizontalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(i
mage.horizontalRule())); | 312 horizontalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(i
mage.horizontalRule())); |
| 313 if (image.horizontalRule() == image.verticalRule()) | 313 if (image.horizontalRule() == image.verticalRule()) |
| 314 verticalRepeat = horizontalRepeat; | 314 verticalRepeat = horizontalRepeat; |
| 315 else | 315 else |
| 316 verticalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule
(image.verticalRule())); | 316 verticalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule
(image.verticalRule())); |
| 317 return CSSValuePair::create(horizontalRepeat.release(), verticalRepeat.relea
se(), CSSValuePair::DropIdenticalValues); | 317 return CSSValuePair::create(horizontalRepeat.release(), verticalRepeat.relea
se(), CSSValuePair::DropIdenticalValues); |
| 318 } | 318 } |
| 319 | 319 |
| 320 static PassRefPtrWillBeRawPtr<CSSValue> valueForNinePieceImage(const NinePieceIm
age& image, const ComputedStyle& style) | 320 static RawPtr<CSSValue> valueForNinePieceImage(const NinePieceImage& image, cons
t ComputedStyle& style) |
| 321 { | 321 { |
| 322 if (!image.hasImage()) | 322 if (!image.hasImage()) |
| 323 return cssValuePool().createIdentifierValue(CSSValueNone); | 323 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 324 | 324 |
| 325 // Image first. | 325 // Image first. |
| 326 RefPtrWillBeRawPtr<CSSValue> imageValue = nullptr; | 326 RawPtr<CSSValue> imageValue = nullptr; |
| 327 if (image.image()) | 327 if (image.image()) |
| 328 imageValue = image.image()->computedCSSValue(); | 328 imageValue = image.image()->computedCSSValue(); |
| 329 | 329 |
| 330 // Create the image slice. | 330 // Create the image slice. |
| 331 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> imageSlices = valueForNinePiece
ImageSlice(image); | 331 RawPtr<CSSBorderImageSliceValue> imageSlices = valueForNinePieceImageSlice(i
mage); |
| 332 | 332 |
| 333 // Create the border area slices. | 333 // Create the border area slices. |
| 334 RefPtrWillBeRawPtr<CSSValue> borderSlices = valueForNinePieceImageQuad(image
.borderSlices(), style); | 334 RawPtr<CSSValue> borderSlices = valueForNinePieceImageQuad(image.borderSlice
s(), style); |
| 335 | 335 |
| 336 // Create the border outset. | 336 // Create the border outset. |
| 337 RefPtrWillBeRawPtr<CSSValue> outset = valueForNinePieceImageQuad(image.outse
t(), style); | 337 RawPtr<CSSValue> outset = valueForNinePieceImageQuad(image.outset(), style); |
| 338 | 338 |
| 339 // Create the repeat rules. | 339 // Create the repeat rules. |
| 340 RefPtrWillBeRawPtr<CSSValue> repeat = valueForNinePieceImageRepeat(image); | 340 RawPtr<CSSValue> repeat = valueForNinePieceImageRepeat(image); |
| 341 | 341 |
| 342 return createBorderImageValue(imageValue.release(), imageSlices.release(), b
orderSlices.release(), outset.release(), repeat.release()); | 342 return createBorderImageValue(imageValue.release(), imageSlices.release(), b
orderSlices.release(), outset.release(), repeat.release()); |
| 343 } | 343 } |
| 344 | 344 |
| 345 static PassRefPtrWillBeRawPtr<CSSValue> valueForReflection(const StyleReflection
* reflection, const ComputedStyle& style) | 345 static RawPtr<CSSValue> valueForReflection(const StyleReflection* reflection, co
nst ComputedStyle& style) |
| 346 { | 346 { |
| 347 if (!reflection) | 347 if (!reflection) |
| 348 return cssValuePool().createIdentifierValue(CSSValueNone); | 348 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 349 | 349 |
| 350 RefPtrWillBeRawPtr<CSSPrimitiveValue> offset = nullptr; | 350 RawPtr<CSSPrimitiveValue> offset = nullptr; |
| 351 // TODO(alancutter): Make this work correctly for calc lengths. | 351 // TODO(alancutter): Make this work correctly for calc lengths. |
| 352 if (reflection->offset().hasPercent()) | 352 if (reflection->offset().hasPercent()) |
| 353 offset = cssValuePool().createValue(reflection->offset().percent(), CSSP
rimitiveValue::UnitType::Percentage); | 353 offset = cssValuePool().createValue(reflection->offset().percent(), CSSP
rimitiveValue::UnitType::Percentage); |
| 354 else | 354 else |
| 355 offset = zoomAdjustedPixelValue(reflection->offset().value(), style); | 355 offset = zoomAdjustedPixelValue(reflection->offset().value(), style); |
| 356 | 356 |
| 357 RefPtrWillBeRawPtr<CSSPrimitiveValue> direction = nullptr; | 357 RawPtr<CSSPrimitiveValue> direction = nullptr; |
| 358 switch (reflection->direction()) { | 358 switch (reflection->direction()) { |
| 359 case ReflectionBelow: | 359 case ReflectionBelow: |
| 360 direction = cssValuePool().createIdentifierValue(CSSValueBelow); | 360 direction = cssValuePool().createIdentifierValue(CSSValueBelow); |
| 361 break; | 361 break; |
| 362 case ReflectionAbove: | 362 case ReflectionAbove: |
| 363 direction = cssValuePool().createIdentifierValue(CSSValueAbove); | 363 direction = cssValuePool().createIdentifierValue(CSSValueAbove); |
| 364 break; | 364 break; |
| 365 case ReflectionLeft: | 365 case ReflectionLeft: |
| 366 direction = cssValuePool().createIdentifierValue(CSSValueLeft); | 366 direction = cssValuePool().createIdentifierValue(CSSValueLeft); |
| 367 break; | 367 break; |
| 368 case ReflectionRight: | 368 case ReflectionRight: |
| 369 direction = cssValuePool().createIdentifierValue(CSSValueRight); | 369 direction = cssValuePool().createIdentifierValue(CSSValueRight); |
| 370 break; | 370 break; |
| 371 } | 371 } |
| 372 | 372 |
| 373 return CSSReflectValue::create(direction.release(), offset.release(), valueF
orNinePieceImage(reflection->mask(), style)); | 373 return CSSReflectValue::create(direction.release(), offset.release(), valueF
orNinePieceImage(reflection->mask(), style)); |
| 374 } | 374 } |
| 375 | 375 |
| 376 static ItemPosition resolveAlignmentAuto(ItemPosition position, const ComputedSt
yle* style) | 376 static ItemPosition resolveAlignmentAuto(ItemPosition position, const ComputedSt
yle* style) |
| 377 { | 377 { |
| 378 if (position != ItemPositionAuto) | 378 if (position != ItemPositionAuto) |
| 379 return position; | 379 return position; |
| 380 | 380 |
| 381 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) | 381 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) |
| 382 return ItemPositionStretch; | 382 return ItemPositionStretch; |
| 383 | 383 |
| 384 return isFlexOrGrid(style) ? ItemPositionStretch : ItemPositionStart; | 384 return isFlexOrGrid(style) ? ItemPositionStretch : ItemPositionStart; |
| 385 } | 385 } |
| 386 | 386 |
| 387 static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlig
nment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, ItemPositi
onType positionType) | 387 static RawPtr<CSSValueList> valueForItemPositionWithOverflowAlignment(ItemPositi
on itemPosition, OverflowAlignment overflowAlignment, ItemPositionType positionT
ype) |
| 388 { | 388 { |
| 389 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated
(); | 389 RawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated(); |
| 390 if (positionType == LegacyPosition) | 390 if (positionType == LegacyPosition) |
| 391 result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy)); | 391 result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy)); |
| 392 result->append(CSSPrimitiveValue::create(itemPosition)); | 392 result->append(CSSPrimitiveValue::create(itemPosition)); |
| 393 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign
mentDefault) | 393 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign
mentDefault) |
| 394 result->append(CSSPrimitiveValue::create(overflowAlignment)); | 394 result->append(CSSPrimitiveValue::create(overflowAlignment)); |
| 395 ASSERT(result->length() <= 2); | 395 ASSERT(result->length() <= 2); |
| 396 return result.release(); | 396 return result.release(); |
| 397 } | 397 } |
| 398 | 398 |
| 399 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForGridShorthand(const StylePr
opertyShorthand& shorthand, const ComputedStyle& style, const LayoutObject* layo
utObject, Node* styledNode, bool allowVisitedStyle) | 399 static RawPtr<CSSValueList> valuesForGridShorthand(const StylePropertyShorthand&
shorthand, const ComputedStyle& style, const LayoutObject* layoutObject, Node*
styledNode, bool allowVisitedStyle) |
| 400 { | 400 { |
| 401 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated()
; | 401 RawPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); |
| 402 for (size_t i = 0; i < shorthand.length(); ++i) { | 402 for (size_t i = 0; i < shorthand.length(); ++i) { |
| 403 RefPtrWillBeRawPtr<CSSValue> value = ComputedStyleCSSValueMapping::get(s
horthand.properties()[i], style, layoutObject, styledNode, allowVisitedStyle); | 403 RawPtr<CSSValue> value = ComputedStyleCSSValueMapping::get(shorthand.pro
perties()[i], style, layoutObject, styledNode, allowVisitedStyle); |
| 404 ASSERT(value); | 404 ASSERT(value); |
| 405 list->append(value.release()); | 405 list->append(value.release()); |
| 406 } | 406 } |
| 407 return list.release(); | 407 return list.release(); |
| 408 } | 408 } |
| 409 | 409 |
| 410 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForShorthandProperty(const Sty
lePropertyShorthand& shorthand, const ComputedStyle& style, const LayoutObject*
layoutObject, Node* styledNode, bool allowVisitedStyle) | 410 static RawPtr<CSSValueList> valuesForShorthandProperty(const StylePropertyShorth
and& shorthand, const ComputedStyle& style, const LayoutObject* layoutObject, No
de* styledNode, bool allowVisitedStyle) |
| 411 { | 411 { |
| 412 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 412 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 413 for (size_t i = 0; i < shorthand.length(); ++i) { | 413 for (size_t i = 0; i < shorthand.length(); ++i) { |
| 414 RefPtrWillBeRawPtr<CSSValue> value = ComputedStyleCSSValueMapping::get(s
horthand.properties()[i], style, layoutObject, styledNode, allowVisitedStyle); | 414 RawPtr<CSSValue> value = ComputedStyleCSSValueMapping::get(shorthand.pro
perties()[i], style, layoutObject, styledNode, allowVisitedStyle); |
| 415 ASSERT(value); | 415 ASSERT(value); |
| 416 list->append(value); | 416 list->append(value); |
| 417 } | 417 } |
| 418 return list.release(); | 418 return list.release(); |
| 419 } | 419 } |
| 420 | 420 |
| 421 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForBackgroundShorthand(const C
omputedStyle& style, const LayoutObject* layoutObject, Node* styledNode, bool al
lowVisitedStyle) | 421 static RawPtr<CSSValueList> valuesForBackgroundShorthand(const ComputedStyle& st
yle, const LayoutObject* layoutObject, Node* styledNode, bool allowVisitedStyle) |
| 422 { | 422 { |
| 423 RefPtrWillBeRawPtr<CSSValueList> ret = CSSValueList::createCommaSeparated(); | 423 RawPtr<CSSValueList> ret = CSSValueList::createCommaSeparated(); |
| 424 const FillLayer* currLayer = &style.backgroundLayers(); | 424 const FillLayer* currLayer = &style.backgroundLayers(); |
| 425 for (; currLayer; currLayer = currLayer->next()) { | 425 for (; currLayer; currLayer = currLayer->next()) { |
| 426 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparat
ed(); | 426 RawPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); |
| 427 RefPtrWillBeRawPtr<CSSValueList> beforeSlash = CSSValueList::createSpace
Separated(); | 427 RawPtr<CSSValueList> beforeSlash = CSSValueList::createSpaceSeparated(); |
| 428 if (!currLayer->next()) { // color only for final layer | 428 if (!currLayer->next()) { // color only for final layer |
| 429 RefPtrWillBeRawPtr<CSSValue> value = ComputedStyleCSSValueMapping::g
et(CSSPropertyBackgroundColor, style, layoutObject, styledNode, allowVisitedStyl
e); | 429 RawPtr<CSSValue> value = ComputedStyleCSSValueMapping::get(CSSProper
tyBackgroundColor, style, layoutObject, styledNode, allowVisitedStyle); |
| 430 ASSERT(value); | 430 ASSERT(value); |
| 431 beforeSlash->append(value); | 431 beforeSlash->append(value); |
| 432 } | 432 } |
| 433 beforeSlash->append(currLayer->image() ? currLayer->image()->computedCSS
Value() : cssValuePool().createIdentifierValue(CSSValueNone)); | 433 beforeSlash->append(currLayer->image() ? currLayer->image()->computedCSS
Value() : cssValuePool().createIdentifierValue(CSSValueNone)); |
| 434 beforeSlash->append(valueForFillRepeat(currLayer->repeatX(), currLayer->
repeatY())); | 434 beforeSlash->append(valueForFillRepeat(currLayer->repeatX(), currLayer->
repeatY())); |
| 435 beforeSlash->append(cssValuePool().createValue(currLayer->attachment()))
; | 435 beforeSlash->append(cssValuePool().createValue(currLayer->attachment()))
; |
| 436 beforeSlash->append(createPositionListForLayer(CSSPropertyBackgroundPosi
tion, *currLayer, style)); | 436 beforeSlash->append(createPositionListForLayer(CSSPropertyBackgroundPosi
tion, *currLayer, style)); |
| 437 list->append(beforeSlash); | 437 list->append(beforeSlash); |
| 438 RefPtrWillBeRawPtr<CSSValueList> afterSlash = CSSValueList::createSpaceS
eparated(); | 438 RawPtr<CSSValueList> afterSlash = CSSValueList::createSpaceSeparated(); |
| 439 afterSlash->append(valueForFillSize(currLayer->size(), style)); | 439 afterSlash->append(valueForFillSize(currLayer->size(), style)); |
| 440 afterSlash->append(cssValuePool().createValue(currLayer->origin())); | 440 afterSlash->append(cssValuePool().createValue(currLayer->origin())); |
| 441 afterSlash->append(cssValuePool().createValue(currLayer->clip())); | 441 afterSlash->append(cssValuePool().createValue(currLayer->clip())); |
| 442 list->append(afterSlash); | 442 list->append(afterSlash); |
| 443 ret->append(list); | 443 ret->append(list); |
| 444 } | 444 } |
| 445 return ret.release(); | 445 return ret.release(); |
| 446 } | 446 } |
| 447 | 447 |
| 448 static PassRefPtrWillBeRawPtr<CSSValueList> valueForContentPositionAndDistributi
onWithOverflowAlignment(const StyleContentAlignmentData& data) | 448 static RawPtr<CSSValueList> valueForContentPositionAndDistributionWithOverflowAl
ignment(const StyleContentAlignmentData& data) |
| 449 { | 449 { |
| 450 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated
(); | 450 RawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated(); |
| 451 if (data.distribution() != ContentDistributionDefault) | 451 if (data.distribution() != ContentDistributionDefault) |
| 452 result->append(CSSPrimitiveValue::create(data.distribution())); | 452 result->append(CSSPrimitiveValue::create(data.distribution())); |
| 453 if (data.distribution() == ContentDistributionDefault || data.position() !=
ContentPositionNormal) | 453 if (data.distribution() == ContentDistributionDefault || data.position() !=
ContentPositionNormal) |
| 454 result->append(CSSPrimitiveValue::create(data.position())); | 454 result->append(CSSPrimitiveValue::create(data.position())); |
| 455 if ((data.position() >= ContentPositionCenter || data.distribution() != Cont
entDistributionDefault) && data.overflow() != OverflowAlignmentDefault) | 455 if ((data.position() >= ContentPositionCenter || data.distribution() != Cont
entDistributionDefault) && data.overflow() != OverflowAlignmentDefault) |
| 456 result->append(CSSPrimitiveValue::create(data.overflow())); | 456 result->append(CSSPrimitiveValue::create(data.overflow())); |
| 457 ASSERT(result->length() > 0); | 457 ASSERT(result->length() > 0); |
| 458 ASSERT(result->length() <= 3); | 458 ASSERT(result->length() <= 3); |
| 459 return result.release(); | 459 return result.release(); |
| 460 } | 460 } |
| 461 | 461 |
| 462 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForLineHeight(const Comput
edStyle& style) | 462 static RawPtr<CSSPrimitiveValue> valueForLineHeight(const ComputedStyle& style) |
| 463 { | 463 { |
| 464 Length length = style.lineHeight(); | 464 Length length = style.lineHeight(); |
| 465 if (length.isNegative()) | 465 if (length.isNegative()) |
| 466 return cssValuePool().createIdentifierValue(CSSValueNormal); | 466 return cssValuePool().createIdentifierValue(CSSValueNormal); |
| 467 | 467 |
| 468 return zoomAdjustedPixelValue(floatValueForLength(length, style.getFontDescr
iption().computedSize()), style); | 468 return zoomAdjustedPixelValue(floatValueForLength(length, style.getFontDescr
iption().computedSize()), style); |
| 469 } | 469 } |
| 470 | 470 |
| 471 static CSSValueID identifierForFamily(const AtomicString& family) | 471 static CSSValueID identifierForFamily(const AtomicString& family) |
| 472 { | 472 { |
| 473 if (family == FontFamilyNames::webkit_cursive) | 473 if (family == FontFamilyNames::webkit_cursive) |
| 474 return CSSValueCursive; | 474 return CSSValueCursive; |
| 475 if (family == FontFamilyNames::webkit_fantasy) | 475 if (family == FontFamilyNames::webkit_fantasy) |
| 476 return CSSValueFantasy; | 476 return CSSValueFantasy; |
| 477 if (family == FontFamilyNames::webkit_monospace) | 477 if (family == FontFamilyNames::webkit_monospace) |
| 478 return CSSValueMonospace; | 478 return CSSValueMonospace; |
| 479 if (family == FontFamilyNames::webkit_pictograph) | 479 if (family == FontFamilyNames::webkit_pictograph) |
| 480 return CSSValueWebkitPictograph; | 480 return CSSValueWebkitPictograph; |
| 481 if (family == FontFamilyNames::webkit_sans_serif) | 481 if (family == FontFamilyNames::webkit_sans_serif) |
| 482 return CSSValueSansSerif; | 482 return CSSValueSansSerif; |
| 483 if (family == FontFamilyNames::webkit_serif) | 483 if (family == FontFamilyNames::webkit_serif) |
| 484 return CSSValueSerif; | 484 return CSSValueSerif; |
| 485 return CSSValueInvalid; | 485 return CSSValueInvalid; |
| 486 } | 486 } |
| 487 | 487 |
| 488 static PassRefPtrWillBeRawPtr<CSSValue> valueForFamily(const AtomicString& famil
y) | 488 static RawPtr<CSSValue> valueForFamily(const AtomicString& family) |
| 489 { | 489 { |
| 490 if (CSSValueID familyIdentifier = identifierForFamily(family)) | 490 if (CSSValueID familyIdentifier = identifierForFamily(family)) |
| 491 return cssValuePool().createIdentifierValue(familyIdentifier); | 491 return cssValuePool().createIdentifierValue(familyIdentifier); |
| 492 return cssValuePool().createFontFamilyValue(family.getString()); | 492 return cssValuePool().createFontFamilyValue(family.getString()); |
| 493 } | 493 } |
| 494 | 494 |
| 495 static PassRefPtrWillBeRawPtr<CSSValueList> valueForFontFamily(const ComputedSty
le& style) | 495 static RawPtr<CSSValueList> valueForFontFamily(const ComputedStyle& style) |
| 496 { | 496 { |
| 497 const FontFamily& firstFamily = style.getFontDescription().family(); | 497 const FontFamily& firstFamily = style.getFontDescription().family(); |
| 498 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 498 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 499 for (const FontFamily* family = &firstFamily; family; family = family->next(
)) | 499 for (const FontFamily* family = &firstFamily; family; family = family->next(
)) |
| 500 list->append(valueForFamily(family->family())); | 500 list->append(valueForFamily(family->family())); |
| 501 return list.release(); | 501 return list.release(); |
| 502 } | 502 } |
| 503 | 503 |
| 504 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontSize(const Computed
Style& style) | 504 static RawPtr<CSSPrimitiveValue> valueForFontSize(const ComputedStyle& style) |
| 505 { | 505 { |
| 506 return zoomAdjustedPixelValue(style.getFontDescription().computedSize(), sty
le); | 506 return zoomAdjustedPixelValue(style.getFontDescription().computedSize(), sty
le); |
| 507 } | 507 } |
| 508 | 508 |
| 509 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStretch(const Compu
tedStyle& style) | 509 static RawPtr<CSSPrimitiveValue> valueForFontStretch(const ComputedStyle& style) |
| 510 { | 510 { |
| 511 return cssValuePool().createValue(style.getFontDescription().stretch()); | 511 return cssValuePool().createValue(style.getFontDescription().stretch()); |
| 512 } | 512 } |
| 513 | 513 |
| 514 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStyle(const Compute
dStyle& style) | 514 static RawPtr<CSSPrimitiveValue> valueForFontStyle(const ComputedStyle& style) |
| 515 { | 515 { |
| 516 return cssValuePool().createValue(style.getFontDescription().style()); | 516 return cssValuePool().createValue(style.getFontDescription().style()); |
| 517 } | 517 } |
| 518 | 518 |
| 519 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontVariant(const Compu
tedStyle& style) | 519 static RawPtr<CSSPrimitiveValue> valueForFontVariant(const ComputedStyle& style) |
| 520 { | 520 { |
| 521 return cssValuePool().createValue(style.getFontDescription().variant()); | 521 return cssValuePool().createValue(style.getFontDescription().variant()); |
| 522 } | 522 } |
| 523 | 523 |
| 524 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontWeight(const Comput
edStyle& style) | 524 static RawPtr<CSSPrimitiveValue> valueForFontWeight(const ComputedStyle& style) |
| 525 { | 525 { |
| 526 return cssValuePool().createValue(style.getFontDescription().weight()); | 526 return cssValuePool().createValue(style.getFontDescription().weight()); |
| 527 } | 527 } |
| 528 | 528 |
| 529 static PassRefPtrWillBeRawPtr<CSSValue> specifiedValueForGridTrackBreadth(const
GridLength& trackBreadth, const ComputedStyle& style) | 529 static RawPtr<CSSValue> specifiedValueForGridTrackBreadth(const GridLength& trac
kBreadth, const ComputedStyle& style) |
| 530 { | 530 { |
| 531 if (!trackBreadth.isLength()) | 531 if (!trackBreadth.isLength()) |
| 532 return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue
::UnitType::Fraction); | 532 return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue
::UnitType::Fraction); |
| 533 | 533 |
| 534 const Length& trackBreadthLength = trackBreadth.length(); | 534 const Length& trackBreadthLength = trackBreadth.length(); |
| 535 if (trackBreadthLength.isAuto()) | 535 if (trackBreadthLength.isAuto()) |
| 536 return cssValuePool().createIdentifierValue(CSSValueAuto); | 536 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 537 return zoomAdjustedPixelValueForLength(trackBreadthLength, style); | 537 return zoomAdjustedPixelValueForLength(trackBreadthLength, style); |
| 538 } | 538 } |
| 539 | 539 |
| 540 static PassRefPtrWillBeRawPtr<CSSValue> specifiedValueForGridTrackSize(const Gri
dTrackSize& trackSize, const ComputedStyle& style) | 540 static RawPtr<CSSValue> specifiedValueForGridTrackSize(const GridTrackSize& trac
kSize, const ComputedStyle& style) |
| 541 { | 541 { |
| 542 switch (trackSize.type()) { | 542 switch (trackSize.type()) { |
| 543 case LengthTrackSizing: | 543 case LengthTrackSizing: |
| 544 return specifiedValueForGridTrackBreadth(trackSize.length(), style); | 544 return specifiedValueForGridTrackBreadth(trackSize.length(), style); |
| 545 case MinMaxTrackSizing: | 545 case MinMaxTrackSizing: |
| 546 RefPtrWillBeRawPtr<CSSFunctionValue> minMaxTrackBreadths = CSSFunctionVa
lue::create(CSSValueMinmax); | 546 RawPtr<CSSFunctionValue> minMaxTrackBreadths = CSSFunctionValue::create(
CSSValueMinmax); |
| 547 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.
minTrackBreadth(), style)); | 547 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.
minTrackBreadth(), style)); |
| 548 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.
maxTrackBreadth(), style)); | 548 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.
maxTrackBreadth(), style)); |
| 549 return minMaxTrackBreadths.release(); | 549 return minMaxTrackBreadths.release(); |
| 550 } | 550 } |
| 551 ASSERT_NOT_REACHED(); | 551 ASSERT_NOT_REACHED(); |
| 552 return nullptr; | 552 return nullptr; |
| 553 } | 553 } |
| 554 | 554 |
| 555 static void addValuesForNamedGridLinesAtIndex(const OrderedNamedGridLines& order
edNamedGridLines, size_t i, CSSValueList& list) | 555 static void addValuesForNamedGridLinesAtIndex(const OrderedNamedGridLines& order
edNamedGridLines, size_t i, CSSValueList& list) |
| 556 { | 556 { |
| 557 const Vector<String>& namedGridLines = orderedNamedGridLines.get(i); | 557 const Vector<String>& namedGridLines = orderedNamedGridLines.get(i); |
| 558 if (namedGridLines.isEmpty()) | 558 if (namedGridLines.isEmpty()) |
| 559 return; | 559 return; |
| 560 | 560 |
| 561 RefPtrWillBeRawPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue:
:create(); | 561 RawPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue::create(); |
| 562 for (size_t j = 0; j < namedGridLines.size(); ++j) | 562 for (size_t j = 0; j < namedGridLines.size(); ++j) |
| 563 lineNames->append(CSSCustomIdentValue::create(namedGridLines[j])); | 563 lineNames->append(CSSCustomIdentValue::create(namedGridLines[j])); |
| 564 list.append(lineNames.release()); | 564 list.append(lineNames.release()); |
| 565 } | 565 } |
| 566 | 566 |
| 567 static PassRefPtrWillBeRawPtr<CSSValue> valueForGridTrackList(GridTrackSizingDir
ection direction, const LayoutObject* layoutObject, const ComputedStyle& style) | 567 static RawPtr<CSSValue> valueForGridTrackList(GridTrackSizingDirection direction
, const LayoutObject* layoutObject, const ComputedStyle& style) |
| 568 { | 568 { |
| 569 bool isRowAxis = direction == ForColumns; | 569 bool isRowAxis = direction == ForColumns; |
| 570 const Vector<GridTrackSize>& trackSizes = isRowAxis ? style.gridTemplateColu
mns() : style.gridTemplateRows(); | 570 const Vector<GridTrackSize>& trackSizes = isRowAxis ? style.gridTemplateColu
mns() : style.gridTemplateRows(); |
| 571 const Vector<GridTrackSize>& autoRepeatTrackSizes = isRowAxis ? style.gridAu
toRepeatColumns() : style.gridAutoRepeatRows(); | 571 const Vector<GridTrackSize>& autoRepeatTrackSizes = isRowAxis ? style.gridAu
toRepeatColumns() : style.gridAutoRepeatRows(); |
| 572 const OrderedNamedGridLines& orderedNamedGridLines = isRowAxis ? style.order
edNamedGridColumnLines() : style.orderedNamedGridRowLines(); | 572 const OrderedNamedGridLines& orderedNamedGridLines = isRowAxis ? style.order
edNamedGridColumnLines() : style.orderedNamedGridRowLines(); |
| 573 | 573 |
| 574 bool isLayoutGrid = layoutObject && layoutObject->isLayoutGrid(); | 574 bool isLayoutGrid = layoutObject && layoutObject->isLayoutGrid(); |
| 575 | 575 |
| 576 // Handle the 'none' case. | 576 // Handle the 'none' case. |
| 577 bool trackListIsEmpty = trackSizes.isEmpty() && autoRepeatTrackSizes.isEmpty
(); | 577 bool trackListIsEmpty = trackSizes.isEmpty() && autoRepeatTrackSizes.isEmpty
(); |
| 578 if (isLayoutGrid && trackListIsEmpty) { | 578 if (isLayoutGrid && trackListIsEmpty) { |
| 579 // For grids we should consider every listed track, whether implicitly o
r explicitly created. If we don't have | 579 // For grids we should consider every listed track, whether implicitly o
r explicitly created. If we don't have |
| 580 // any explicit track and there are no children then there are no implic
it tracks. We cannot simply check the | 580 // any explicit track and there are no children then there are no implic
it tracks. We cannot simply check the |
| 581 // number of rows/columns in our internal grid representation because it
's always at least 1x1 (see r143331). | 581 // number of rows/columns in our internal grid representation because it
's always at least 1x1 (see r143331). |
| 582 trackListIsEmpty = !toLayoutBlock(layoutObject)->firstChild(); | 582 trackListIsEmpty = !toLayoutBlock(layoutObject)->firstChild(); |
| 583 } | 583 } |
| 584 | 584 |
| 585 if (trackListIsEmpty) { | 585 if (trackListIsEmpty) { |
| 586 ASSERT(orderedNamedGridLines.isEmpty()); | 586 ASSERT(orderedNamedGridLines.isEmpty()); |
| 587 return cssValuePool().createIdentifierValue(CSSValueNone); | 587 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 588 } | 588 } |
| 589 | 589 |
| 590 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 590 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 591 size_t insertionIndex; | 591 size_t insertionIndex; |
| 592 if (isLayoutGrid) { | 592 if (isLayoutGrid) { |
| 593 const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? toL
ayoutGrid(layoutObject)->columnPositions() : toLayoutGrid(layoutObject)->rowPosi
tions(); | 593 const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? toL
ayoutGrid(layoutObject)->columnPositions() : toLayoutGrid(layoutObject)->rowPosi
tions(); |
| 594 // There are at least #tracks + 1 grid lines (trackPositions). Apart fro
m that, the grid container can generate implicit grid tracks, | 594 // There are at least #tracks + 1 grid lines (trackPositions). Apart fro
m that, the grid container can generate implicit grid tracks, |
| 595 // so we'll have more trackPositions than trackSizes as the latter only
contain the explicit grid. | 595 // so we'll have more trackPositions than trackSizes as the latter only
contain the explicit grid. |
| 596 ASSERT(trackPositions.size() - 1 >= trackSizes.size()); | 596 ASSERT(trackPositions.size() - 1 >= trackSizes.size()); |
| 597 | 597 |
| 598 size_t i; | 598 size_t i; |
| 599 LayoutUnit gutterSize = toLayoutGrid(layoutObject)->guttersSize(directio
n, 2); | 599 LayoutUnit gutterSize = toLayoutGrid(layoutObject)->guttersSize(directio
n, 2); |
| 600 for (i = 0; i < trackPositions.size() - 2; ++i) { | 600 for (i = 0; i < trackPositions.size() - 2; ++i) { |
| 601 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); | 601 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); |
| 602 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPos
itions[i] - gutterSize, style)); | 602 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPos
itions[i] - gutterSize, style)); |
| 603 } | 603 } |
| 604 // Last track line does not have any gutter. | 604 // Last track line does not have any gutter. |
| 605 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); | 605 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); |
| 606 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPositio
ns[i], style)); | 606 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPositio
ns[i], style)); |
| 607 insertionIndex = trackPositions.size() - 1; | 607 insertionIndex = trackPositions.size() - 1; |
| 608 } else { | 608 } else { |
| 609 for (size_t i = 0; i < trackSizes.size(); ++i) { | 609 for (size_t i = 0; i < trackSizes.size(); ++i) { |
| 610 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); | 610 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); |
| 611 list->append(specifiedValueForGridTrackSize(trackSizes[i], style)); | 611 list->append(specifiedValueForGridTrackSize(trackSizes[i], style)); |
| 612 } | 612 } |
| 613 insertionIndex = trackSizes.size(); | 613 insertionIndex = trackSizes.size(); |
| 614 } | 614 } |
| 615 // Those are the trailing <string>* allowed in the syntax. | 615 // Those are the trailing <string>* allowed in the syntax. |
| 616 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, insertionIndex, *li
st); | 616 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, insertionIndex, *li
st); |
| 617 return list.release(); | 617 return list.release(); |
| 618 } | 618 } |
| 619 | 619 |
| 620 static PassRefPtrWillBeRawPtr<CSSValue> valueForGridPosition(const GridPosition&
position) | 620 static RawPtr<CSSValue> valueForGridPosition(const GridPosition& position) |
| 621 { | 621 { |
| 622 if (position.isAuto()) | 622 if (position.isAuto()) |
| 623 return cssValuePool().createIdentifierValue(CSSValueAuto); | 623 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 624 | 624 |
| 625 if (position.isNamedGridArea()) | 625 if (position.isNamedGridArea()) |
| 626 return CSSCustomIdentValue::create(position.namedGridLine()); | 626 return CSSCustomIdentValue::create(position.namedGridLine()); |
| 627 | 627 |
| 628 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 628 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 629 if (position.isSpan()) { | 629 if (position.isSpan()) { |
| 630 list->append(cssValuePool().createIdentifierValue(CSSValueSpan)); | 630 list->append(cssValuePool().createIdentifierValue(CSSValueSpan)); |
| 631 list->append(cssValuePool().createValue(position.spanPosition(), CSSPrim
itiveValue::UnitType::Number)); | 631 list->append(cssValuePool().createValue(position.spanPosition(), CSSPrim
itiveValue::UnitType::Number)); |
| 632 } else { | 632 } else { |
| 633 list->append(cssValuePool().createValue(position.integerPosition(), CSSP
rimitiveValue::UnitType::Number)); | 633 list->append(cssValuePool().createValue(position.integerPosition(), CSSP
rimitiveValue::UnitType::Number)); |
| 634 } | 634 } |
| 635 | 635 |
| 636 if (!position.namedGridLine().isNull()) | 636 if (!position.namedGridLine().isNull()) |
| 637 list->append(CSSCustomIdentValue::create(position.namedGridLine())); | 637 list->append(CSSCustomIdentValue::create(position.namedGridLine())); |
| 638 return list; | 638 return list; |
| 639 } | 639 } |
| 640 | 640 |
| 641 static LayoutRect sizingBox(const LayoutObject* layoutObject) | 641 static LayoutRect sizingBox(const LayoutObject* layoutObject) |
| 642 { | 642 { |
| 643 if (!layoutObject->isBox()) | 643 if (!layoutObject->isBox()) |
| 644 return LayoutRect(); | 644 return LayoutRect(); |
| 645 | 645 |
| 646 const LayoutBox* box = toLayoutBox(layoutObject); | 646 const LayoutBox* box = toLayoutBox(layoutObject); |
| 647 return box->style()->boxSizing() == BoxSizingBorderBox ? box->borderBoxRect(
) : box->computedCSSContentBoxRect(); | 647 return box->style()->boxSizing() == BoxSizingBorderBox ? box->borderBoxRect(
) : box->computedCSSContentBoxRect(); |
| 648 } | 648 } |
| 649 | 649 |
| 650 static PassRefPtrWillBeRawPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int
textDecoration) | 650 static RawPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecoration) |
| 651 { | 651 { |
| 652 // Blink value is ignored. | 652 // Blink value is ignored. |
| 653 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 653 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 654 if (textDecoration & TextDecorationUnderline) | 654 if (textDecoration & TextDecorationUnderline) |
| 655 list->append(cssValuePool().createIdentifierValue(CSSValueUnderline)); | 655 list->append(cssValuePool().createIdentifierValue(CSSValueUnderline)); |
| 656 if (textDecoration & TextDecorationOverline) | 656 if (textDecoration & TextDecorationOverline) |
| 657 list->append(cssValuePool().createIdentifierValue(CSSValueOverline)); | 657 list->append(cssValuePool().createIdentifierValue(CSSValueOverline)); |
| 658 if (textDecoration & TextDecorationLineThrough) | 658 if (textDecoration & TextDecorationLineThrough) |
| 659 list->append(cssValuePool().createIdentifierValue(CSSValueLineThrough)); | 659 list->append(cssValuePool().createIdentifierValue(CSSValueLineThrough)); |
| 660 | 660 |
| 661 if (!list->length()) | 661 if (!list->length()) |
| 662 return cssValuePool().createIdentifierValue(CSSValueNone); | 662 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 663 return list.release(); | 663 return list.release(); |
| 664 } | 664 } |
| 665 | 665 |
| 666 static PassRefPtrWillBeRawPtr<CSSValue> valueForTextDecorationStyle(TextDecorati
onStyle textDecorationStyle) | 666 static RawPtr<CSSValue> valueForTextDecorationStyle(TextDecorationStyle textDeco
rationStyle) |
| 667 { | 667 { |
| 668 switch (textDecorationStyle) { | 668 switch (textDecorationStyle) { |
| 669 case TextDecorationStyleSolid: | 669 case TextDecorationStyleSolid: |
| 670 return cssValuePool().createIdentifierValue(CSSValueSolid); | 670 return cssValuePool().createIdentifierValue(CSSValueSolid); |
| 671 case TextDecorationStyleDouble: | 671 case TextDecorationStyleDouble: |
| 672 return cssValuePool().createIdentifierValue(CSSValueDouble); | 672 return cssValuePool().createIdentifierValue(CSSValueDouble); |
| 673 case TextDecorationStyleDotted: | 673 case TextDecorationStyleDotted: |
| 674 return cssValuePool().createIdentifierValue(CSSValueDotted); | 674 return cssValuePool().createIdentifierValue(CSSValueDotted); |
| 675 case TextDecorationStyleDashed: | 675 case TextDecorationStyleDashed: |
| 676 return cssValuePool().createIdentifierValue(CSSValueDashed); | 676 return cssValuePool().createIdentifierValue(CSSValueDashed); |
| 677 case TextDecorationStyleWavy: | 677 case TextDecorationStyleWavy: |
| 678 return cssValuePool().createIdentifierValue(CSSValueWavy); | 678 return cssValuePool().createIdentifierValue(CSSValueWavy); |
| 679 } | 679 } |
| 680 | 680 |
| 681 ASSERT_NOT_REACHED(); | 681 ASSERT_NOT_REACHED(); |
| 682 return cssValuePool().createExplicitInitialValue(); | 682 return cssValuePool().createExplicitInitialValue(); |
| 683 } | 683 } |
| 684 | 684 |
| 685 static PassRefPtrWillBeRawPtr<CSSValue> touchActionFlagsToCSSValue(TouchAction t
ouchAction) | 685 static RawPtr<CSSValue> touchActionFlagsToCSSValue(TouchAction touchAction) |
| 686 { | 686 { |
| 687 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 687 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 688 if (touchAction == TouchActionAuto) { | 688 if (touchAction == TouchActionAuto) { |
| 689 list->append(cssValuePool().createIdentifierValue(CSSValueAuto)); | 689 list->append(cssValuePool().createIdentifierValue(CSSValueAuto)); |
| 690 } else if (touchAction == TouchActionNone) { | 690 } else if (touchAction == TouchActionNone) { |
| 691 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); | 691 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); |
| 692 } else if (touchAction == TouchActionManipulation) { | 692 } else if (touchAction == TouchActionManipulation) { |
| 693 list->append(cssValuePool().createIdentifierValue(CSSValueManipulation))
; | 693 list->append(cssValuePool().createIdentifierValue(CSSValueManipulation))
; |
| 694 } else { | 694 } else { |
| 695 if ((touchAction & TouchActionPanX) == TouchActionPanX) | 695 if ((touchAction & TouchActionPanX) == TouchActionPanX) |
| 696 list->append(cssValuePool().createIdentifierValue(CSSValuePanX)); | 696 list->append(cssValuePool().createIdentifierValue(CSSValuePanX)); |
| 697 else if (touchAction & TouchActionPanLeft) | 697 else if (touchAction & TouchActionPanLeft) |
| 698 list->append(cssValuePool().createIdentifierValue(CSSValuePanLeft)); | 698 list->append(cssValuePool().createIdentifierValue(CSSValuePanLeft)); |
| 699 else if (touchAction & TouchActionPanRight) | 699 else if (touchAction & TouchActionPanRight) |
| 700 list->append(cssValuePool().createIdentifierValue(CSSValuePanRight))
; | 700 list->append(cssValuePool().createIdentifierValue(CSSValuePanRight))
; |
| 701 | 701 |
| 702 if ((touchAction & TouchActionPanY) == TouchActionPanY) | 702 if ((touchAction & TouchActionPanY) == TouchActionPanY) |
| 703 list->append(cssValuePool().createIdentifierValue(CSSValuePanY)); | 703 list->append(cssValuePool().createIdentifierValue(CSSValuePanY)); |
| 704 else if (touchAction & TouchActionPanUp) | 704 else if (touchAction & TouchActionPanUp) |
| 705 list->append(cssValuePool().createIdentifierValue(CSSValuePanUp)); | 705 list->append(cssValuePool().createIdentifierValue(CSSValuePanUp)); |
| 706 else if (touchAction & TouchActionPanDown) | 706 else if (touchAction & TouchActionPanDown) |
| 707 list->append(cssValuePool().createIdentifierValue(CSSValuePanDown)); | 707 list->append(cssValuePool().createIdentifierValue(CSSValuePanDown)); |
| 708 } | 708 } |
| 709 ASSERT(list->length()); | 709 ASSERT(list->length()); |
| 710 return list.release(); | 710 return list.release(); |
| 711 } | 711 } |
| 712 | 712 |
| 713 static PassRefPtrWillBeRawPtr<CSSValue> valueForWillChange(const Vector<CSSPrope
rtyID>& willChangeProperties, bool willChangeContents, bool willChangeScrollPosi
tion) | 713 static RawPtr<CSSValue> valueForWillChange(const Vector<CSSPropertyID>& willChan
geProperties, bool willChangeContents, bool willChangeScrollPosition) |
| 714 { | 714 { |
| 715 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 715 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 716 if (willChangeContents) | 716 if (willChangeContents) |
| 717 list->append(cssValuePool().createIdentifierValue(CSSValueContents)); | 717 list->append(cssValuePool().createIdentifierValue(CSSValueContents)); |
| 718 if (willChangeScrollPosition) | 718 if (willChangeScrollPosition) |
| 719 list->append(cssValuePool().createIdentifierValue(CSSValueScrollPosition
)); | 719 list->append(cssValuePool().createIdentifierValue(CSSValueScrollPosition
)); |
| 720 for (size_t i = 0; i < willChangeProperties.size(); ++i) | 720 for (size_t i = 0; i < willChangeProperties.size(); ++i) |
| 721 list->append(cssValuePool().createIdentifierValue(willChangeProperties[i
])); | 721 list->append(cssValuePool().createIdentifierValue(willChangeProperties[i
])); |
| 722 if (!list->length()) | 722 if (!list->length()) |
| 723 list->append(cssValuePool().createIdentifierValue(CSSValueAuto)); | 723 list->append(cssValuePool().createIdentifierValue(CSSValueAuto)); |
| 724 return list.release(); | 724 return list.release(); |
| 725 } | 725 } |
| 726 | 726 |
| 727 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationDelay(const CSSTimingDa
ta* timingData) | 727 static RawPtr<CSSValue> valueForAnimationDelay(const CSSTimingData* timingData) |
| 728 { | 728 { |
| 729 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 729 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 730 if (timingData) { | 730 if (timingData) { |
| 731 for (size_t i = 0; i < timingData->delayList().size(); ++i) | 731 for (size_t i = 0; i < timingData->delayList().size(); ++i) |
| 732 list->append(cssValuePool().createValue(timingData->delayList()[i],
CSSPrimitiveValue::UnitType::Seconds)); | 732 list->append(cssValuePool().createValue(timingData->delayList()[i],
CSSPrimitiveValue::UnitType::Seconds)); |
| 733 } else { | 733 } else { |
| 734 list->append(cssValuePool().createValue(CSSTimingData::initialDelay(), C
SSPrimitiveValue::UnitType::Seconds)); | 734 list->append(cssValuePool().createValue(CSSTimingData::initialDelay(), C
SSPrimitiveValue::UnitType::Seconds)); |
| 735 } | 735 } |
| 736 return list.release(); | 736 return list.release(); |
| 737 } | 737 } |
| 738 | 738 |
| 739 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationDirection(Timing::Playb
ackDirection direction) | 739 static RawPtr<CSSValue> valueForAnimationDirection(Timing::PlaybackDirection dir
ection) |
| 740 { | 740 { |
| 741 switch (direction) { | 741 switch (direction) { |
| 742 case Timing::PlaybackDirectionNormal: | 742 case Timing::PlaybackDirectionNormal: |
| 743 return cssValuePool().createIdentifierValue(CSSValueNormal); | 743 return cssValuePool().createIdentifierValue(CSSValueNormal); |
| 744 case Timing::PlaybackDirectionAlternate: | 744 case Timing::PlaybackDirectionAlternate: |
| 745 return cssValuePool().createIdentifierValue(CSSValueAlternate); | 745 return cssValuePool().createIdentifierValue(CSSValueAlternate); |
| 746 case Timing::PlaybackDirectionReverse: | 746 case Timing::PlaybackDirectionReverse: |
| 747 return cssValuePool().createIdentifierValue(CSSValueReverse); | 747 return cssValuePool().createIdentifierValue(CSSValueReverse); |
| 748 case Timing::PlaybackDirectionAlternateReverse: | 748 case Timing::PlaybackDirectionAlternateReverse: |
| 749 return cssValuePool().createIdentifierValue(CSSValueAlternateReverse); | 749 return cssValuePool().createIdentifierValue(CSSValueAlternateReverse); |
| 750 default: | 750 default: |
| 751 ASSERT_NOT_REACHED(); | 751 ASSERT_NOT_REACHED(); |
| 752 return nullptr; | 752 return nullptr; |
| 753 } | 753 } |
| 754 } | 754 } |
| 755 | 755 |
| 756 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationDuration(const CSSTimin
gData* timingData) | 756 static RawPtr<CSSValue> valueForAnimationDuration(const CSSTimingData* timingDat
a) |
| 757 { | 757 { |
| 758 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 758 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 759 if (timingData) { | 759 if (timingData) { |
| 760 for (size_t i = 0; i < timingData->durationList().size(); ++i) | 760 for (size_t i = 0; i < timingData->durationList().size(); ++i) |
| 761 list->append(cssValuePool().createValue(timingData->durationList()[i
], CSSPrimitiveValue::UnitType::Seconds)); | 761 list->append(cssValuePool().createValue(timingData->durationList()[i
], CSSPrimitiveValue::UnitType::Seconds)); |
| 762 } else { | 762 } else { |
| 763 list->append(cssValuePool().createValue(CSSTimingData::initialDuration()
, CSSPrimitiveValue::UnitType::Seconds)); | 763 list->append(cssValuePool().createValue(CSSTimingData::initialDuration()
, CSSPrimitiveValue::UnitType::Seconds)); |
| 764 } | 764 } |
| 765 return list.release(); | 765 return list.release(); |
| 766 } | 766 } |
| 767 | 767 |
| 768 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationFillMode(Timing::FillMo
de fillMode) | 768 static RawPtr<CSSValue> valueForAnimationFillMode(Timing::FillMode fillMode) |
| 769 { | 769 { |
| 770 switch (fillMode) { | 770 switch (fillMode) { |
| 771 case Timing::FillModeNone: | 771 case Timing::FillModeNone: |
| 772 return cssValuePool().createIdentifierValue(CSSValueNone); | 772 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 773 case Timing::FillModeForwards: | 773 case Timing::FillModeForwards: |
| 774 return cssValuePool().createIdentifierValue(CSSValueForwards); | 774 return cssValuePool().createIdentifierValue(CSSValueForwards); |
| 775 case Timing::FillModeBackwards: | 775 case Timing::FillModeBackwards: |
| 776 return cssValuePool().createIdentifierValue(CSSValueBackwards); | 776 return cssValuePool().createIdentifierValue(CSSValueBackwards); |
| 777 case Timing::FillModeBoth: | 777 case Timing::FillModeBoth: |
| 778 return cssValuePool().createIdentifierValue(CSSValueBoth); | 778 return cssValuePool().createIdentifierValue(CSSValueBoth); |
| 779 default: | 779 default: |
| 780 ASSERT_NOT_REACHED(); | 780 ASSERT_NOT_REACHED(); |
| 781 return nullptr; | 781 return nullptr; |
| 782 } | 782 } |
| 783 } | 783 } |
| 784 | 784 |
| 785 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationIterationCount(double i
terationCount) | 785 static RawPtr<CSSValue> valueForAnimationIterationCount(double iterationCount) |
| 786 { | 786 { |
| 787 if (iterationCount == std::numeric_limits<double>::infinity()) | 787 if (iterationCount == std::numeric_limits<double>::infinity()) |
| 788 return cssValuePool().createIdentifierValue(CSSValueInfinite); | 788 return cssValuePool().createIdentifierValue(CSSValueInfinite); |
| 789 return cssValuePool().createValue(iterationCount, CSSPrimitiveValue::UnitTyp
e::Number); | 789 return cssValuePool().createValue(iterationCount, CSSPrimitiveValue::UnitTyp
e::Number); |
| 790 } | 790 } |
| 791 | 791 |
| 792 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationPlayState(EAnimPlayStat
e playState) | 792 static RawPtr<CSSValue> valueForAnimationPlayState(EAnimPlayState playState) |
| 793 { | 793 { |
| 794 if (playState == AnimPlayStatePlaying) | 794 if (playState == AnimPlayStatePlaying) |
| 795 return cssValuePool().createIdentifierValue(CSSValueRunning); | 795 return cssValuePool().createIdentifierValue(CSSValueRunning); |
| 796 ASSERT(playState == AnimPlayStatePaused); | 796 ASSERT(playState == AnimPlayStatePaused); |
| 797 return cssValuePool().createIdentifierValue(CSSValuePaused); | 797 return cssValuePool().createIdentifierValue(CSSValuePaused); |
| 798 } | 798 } |
| 799 | 799 |
| 800 static PassRefPtrWillBeRawPtr<CSSValue> createTimingFunctionValue(const TimingFu
nction* timingFunction) | 800 static RawPtr<CSSValue> createTimingFunctionValue(const TimingFunction* timingFu
nction) |
| 801 { | 801 { |
| 802 switch (timingFunction->type()) { | 802 switch (timingFunction->type()) { |
| 803 case TimingFunction::kCubicBezierFunction: | 803 case TimingFunction::kCubicBezierFunction: |
| 804 { | 804 { |
| 805 const CubicBezierTimingFunction* bezierTimingFunction = toCubicBezie
rTimingFunction(timingFunction); | 805 const CubicBezierTimingFunction* bezierTimingFunction = toCubicBezie
rTimingFunction(timingFunction); |
| 806 if (bezierTimingFunction->subType() != CubicBezierTimingFunction::Cu
stom) { | 806 if (bezierTimingFunction->subType() != CubicBezierTimingFunction::Cu
stom) { |
| 807 CSSValueID valueId = CSSValueInvalid; | 807 CSSValueID valueId = CSSValueInvalid; |
| 808 switch (bezierTimingFunction->subType()) { | 808 switch (bezierTimingFunction->subType()) { |
| 809 case CubicBezierTimingFunction::Ease: | 809 case CubicBezierTimingFunction::Ease: |
| 810 valueId = CSSValueEase; | 810 valueId = CSSValueEase; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 838 return CSSStepsTimingFunctionValue::create(steps, position); | 838 return CSSStepsTimingFunctionValue::create(steps, position); |
| 839 CSSValueID valueId = position == StepsTimingFunction::Start ? CSSVal
ueStepStart : CSSValueStepEnd; | 839 CSSValueID valueId = position == StepsTimingFunction::Start ? CSSVal
ueStepStart : CSSValueStepEnd; |
| 840 return cssValuePool().createIdentifierValue(valueId); | 840 return cssValuePool().createIdentifierValue(valueId); |
| 841 } | 841 } |
| 842 | 842 |
| 843 default: | 843 default: |
| 844 return cssValuePool().createIdentifierValue(CSSValueLinear); | 844 return cssValuePool().createIdentifierValue(CSSValueLinear); |
| 845 } | 845 } |
| 846 } | 846 } |
| 847 | 847 |
| 848 static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationTimingFunction(const CS
STimingData* timingData) | 848 static RawPtr<CSSValue> valueForAnimationTimingFunction(const CSSTimingData* tim
ingData) |
| 849 { | 849 { |
| 850 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 850 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 851 if (timingData) { | 851 if (timingData) { |
| 852 for (size_t i = 0; i < timingData->timingFunctionList().size(); ++i) | 852 for (size_t i = 0; i < timingData->timingFunctionList().size(); ++i) |
| 853 list->append(createTimingFunctionValue(timingData->timingFunctionLis
t()[i].get())); | 853 list->append(createTimingFunctionValue(timingData->timingFunctionLis
t()[i].get())); |
| 854 } else { | 854 } else { |
| 855 list->append(createTimingFunctionValue(CSSTimingData::initialTimingFunct
ion().get())); | 855 list->append(createTimingFunctionValue(CSSTimingData::initialTimingFunct
ion().get())); |
| 856 } | 856 } |
| 857 return list.release(); | 857 return list.release(); |
| 858 } | 858 } |
| 859 | 859 |
| 860 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForBorderRadiusCorner(LengthSi
ze radius, const ComputedStyle& style) | 860 static RawPtr<CSSValueList> valuesForBorderRadiusCorner(LengthSize radius, const
ComputedStyle& style) |
| 861 { | 861 { |
| 862 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 862 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 863 if (radius.width().type() == Percent) | 863 if (radius.width().type() == Percent) |
| 864 list->append(cssValuePool().createValue(radius.width().percent(), CSSPri
mitiveValue::UnitType::Percentage)); | 864 list->append(cssValuePool().createValue(radius.width().percent(), CSSPri
mitiveValue::UnitType::Percentage)); |
| 865 else | 865 else |
| 866 list->append(zoomAdjustedPixelValueForLength(radius.width(), style)); | 866 list->append(zoomAdjustedPixelValueForLength(radius.width(), style)); |
| 867 if (radius.height().type() == Percent) | 867 if (radius.height().type() == Percent) |
| 868 list->append(cssValuePool().createValue(radius.height().percent(), CSSPr
imitiveValue::UnitType::Percentage)); | 868 list->append(cssValuePool().createValue(radius.height().percent(), CSSPr
imitiveValue::UnitType::Percentage)); |
| 869 else | 869 else |
| 870 list->append(zoomAdjustedPixelValueForLength(radius.height(), style)); | 870 list->append(zoomAdjustedPixelValueForLength(radius.height(), style)); |
| 871 return list.release(); | 871 return list.release(); |
| 872 } | 872 } |
| 873 | 873 |
| 874 static PassRefPtrWillBeRawPtr<CSSValue> valueForBorderRadiusCorner(LengthSize ra
dius, const ComputedStyle& style) | 874 static RawPtr<CSSValue> valueForBorderRadiusCorner(LengthSize radius, const Comp
utedStyle& style) |
| 875 { | 875 { |
| 876 RefPtrWillBeRawPtr<CSSValueList> list = valuesForBorderRadiusCorner(radius,
style); | 876 RawPtr<CSSValueList> list = valuesForBorderRadiusCorner(radius, style); |
| 877 if (list->item(0)->equals(*list->item(1))) | 877 if (list->item(0)->equals(*list->item(1))) |
| 878 return list->item(0); | 878 return list->item(0); |
| 879 return list.release(); | 879 return list.release(); |
| 880 } | 880 } |
| 881 | 881 |
| 882 static PassRefPtrWillBeRawPtr<CSSFunctionValue> valueForMatrixTransform(const Tr
ansformationMatrix& transform, const ComputedStyle& style) | 882 static RawPtr<CSSFunctionValue> valueForMatrixTransform(const TransformationMatr
ix& transform, const ComputedStyle& style) |
| 883 { | 883 { |
| 884 RefPtrWillBeRawPtr<CSSFunctionValue> transformValue = nullptr; | 884 RawPtr<CSSFunctionValue> transformValue = nullptr; |
| 885 if (transform.isAffine()) { | 885 if (transform.isAffine()) { |
| 886 transformValue = CSSFunctionValue::create(CSSValueMatrix); | 886 transformValue = CSSFunctionValue::create(CSSValueMatrix); |
| 887 | 887 |
| 888 transformValue->append(cssValuePool().createValue(transform.a(), CSSPrim
itiveValue::UnitType::Number)); | 888 transformValue->append(cssValuePool().createValue(transform.a(), CSSPrim
itiveValue::UnitType::Number)); |
| 889 transformValue->append(cssValuePool().createValue(transform.b(), CSSPrim
itiveValue::UnitType::Number)); | 889 transformValue->append(cssValuePool().createValue(transform.b(), CSSPrim
itiveValue::UnitType::Number)); |
| 890 transformValue->append(cssValuePool().createValue(transform.c(), CSSPrim
itiveValue::UnitType::Number)); | 890 transformValue->append(cssValuePool().createValue(transform.c(), CSSPrim
itiveValue::UnitType::Number)); |
| 891 transformValue->append(cssValuePool().createValue(transform.d(), CSSPrim
itiveValue::UnitType::Number)); | 891 transformValue->append(cssValuePool().createValue(transform.d(), CSSPrim
itiveValue::UnitType::Number)); |
| 892 transformValue->append(zoomAdjustedNumberValue(transform.e(), style)); | 892 transformValue->append(zoomAdjustedNumberValue(transform.e(), style)); |
| 893 transformValue->append(zoomAdjustedNumberValue(transform.f(), style)); | 893 transformValue->append(zoomAdjustedNumberValue(transform.f(), style)); |
| 894 } else { | 894 } else { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 911 | 911 |
| 912 transformValue->append(zoomAdjustedNumberValue(transform.m41(), style)); | 912 transformValue->append(zoomAdjustedNumberValue(transform.m41(), style)); |
| 913 transformValue->append(zoomAdjustedNumberValue(transform.m42(), style)); | 913 transformValue->append(zoomAdjustedNumberValue(transform.m42(), style)); |
| 914 transformValue->append(zoomAdjustedNumberValue(transform.m43(), style)); | 914 transformValue->append(zoomAdjustedNumberValue(transform.m43(), style)); |
| 915 transformValue->append(cssValuePool().createValue(transform.m44(), CSSPr
imitiveValue::UnitType::Number)); | 915 transformValue->append(cssValuePool().createValue(transform.m44(), CSSPr
imitiveValue::UnitType::Number)); |
| 916 } | 916 } |
| 917 | 917 |
| 918 return transformValue.release(); | 918 return transformValue.release(); |
| 919 } | 919 } |
| 920 | 920 |
| 921 static PassRefPtrWillBeRawPtr<CSSValue> computedTransform(const LayoutObject* la
youtObject, const ComputedStyle& style) | 921 static RawPtr<CSSValue> computedTransform(const LayoutObject* layoutObject, cons
t ComputedStyle& style) |
| 922 { | 922 { |
| 923 if (!layoutObject || !style.hasTransform()) | 923 if (!layoutObject || !style.hasTransform()) |
| 924 return cssValuePool().createIdentifierValue(CSSValueNone); | 924 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 925 | 925 |
| 926 IntRect box; | 926 IntRect box; |
| 927 if (layoutObject->isBox()) | 927 if (layoutObject->isBox()) |
| 928 box = pixelSnappedIntRect(toLayoutBox(layoutObject)->borderBoxRect()); | 928 box = pixelSnappedIntRect(toLayoutBox(layoutObject)->borderBoxRect()); |
| 929 | 929 |
| 930 TransformationMatrix transform; | 930 TransformationMatrix transform; |
| 931 style.applyTransform(transform, LayoutSize(box.size()), ComputedStyle::Exclu
deTransformOrigin, ComputedStyle::ExcludeMotionPath, ComputedStyle::ExcludeIndep
endentTransformProperties); | 931 style.applyTransform(transform, LayoutSize(box.size()), ComputedStyle::Exclu
deTransformOrigin, ComputedStyle::ExcludeMotionPath, ComputedStyle::ExcludeIndep
endentTransformProperties); |
| 932 | 932 |
| 933 // FIXME: Need to print out individual functions (https://bugs.webkit.org/sh
ow_bug.cgi?id=23924) | 933 // FIXME: Need to print out individual functions (https://bugs.webkit.org/sh
ow_bug.cgi?id=23924) |
| 934 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 934 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 935 list->append(valueForMatrixTransform(transform, style)); | 935 list->append(valueForMatrixTransform(transform, style)); |
| 936 | 936 |
| 937 return list.release(); | 937 return list.release(); |
| 938 } | 938 } |
| 939 | 939 |
| 940 static PassRefPtrWillBeRawPtr<CSSValue> createTransitionPropertyValue(const CSST
ransitionData::TransitionProperty& property) | 940 static RawPtr<CSSValue> createTransitionPropertyValue(const CSSTransitionData::T
ransitionProperty& property) |
| 941 { | 941 { |
| 942 if (property.propertyType == CSSTransitionData::TransitionNone) | 942 if (property.propertyType == CSSTransitionData::TransitionNone) |
| 943 return cssValuePool().createIdentifierValue(CSSValueNone); | 943 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 944 if (property.propertyType == CSSTransitionData::TransitionUnknownProperty) | 944 if (property.propertyType == CSSTransitionData::TransitionUnknownProperty) |
| 945 return CSSCustomIdentValue::create(property.propertyString); | 945 return CSSCustomIdentValue::create(property.propertyString); |
| 946 ASSERT(property.propertyType == CSSTransitionData::TransitionKnownProperty); | 946 ASSERT(property.propertyType == CSSTransitionData::TransitionKnownProperty); |
| 947 return CSSCustomIdentValue::create(getPropertyNameString(property.unresolved
Property)); | 947 return CSSCustomIdentValue::create(getPropertyNameString(property.unresolved
Property)); |
| 948 } | 948 } |
| 949 | 949 |
| 950 static PassRefPtrWillBeRawPtr<CSSValue> valueForTransitionProperty(const CSSTran
sitionData* transitionData) | 950 static RawPtr<CSSValue> valueForTransitionProperty(const CSSTransitionData* tran
sitionData) |
| 951 { | 951 { |
| 952 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 952 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 953 if (transitionData) { | 953 if (transitionData) { |
| 954 for (size_t i = 0; i < transitionData->propertyList().size(); ++i) | 954 for (size_t i = 0; i < transitionData->propertyList().size(); ++i) |
| 955 list->append(createTransitionPropertyValue(transitionData->propertyL
ist()[i])); | 955 list->append(createTransitionPropertyValue(transitionData->propertyL
ist()[i])); |
| 956 } else { | 956 } else { |
| 957 list->append(cssValuePool().createIdentifierValue(CSSValueAll)); | 957 list->append(cssValuePool().createIdentifierValue(CSSValueAll)); |
| 958 } | 958 } |
| 959 return list.release(); | 959 return list.release(); |
| 960 } | 960 } |
| 961 | 961 |
| 962 CSSValueID valueForQuoteType(const QuoteType quoteType) | 962 CSSValueID valueForQuoteType(const QuoteType quoteType) |
| 963 { | 963 { |
| 964 switch (quoteType) { | 964 switch (quoteType) { |
| 965 case NO_OPEN_QUOTE: | 965 case NO_OPEN_QUOTE: |
| 966 return CSSValueNoOpenQuote; | 966 return CSSValueNoOpenQuote; |
| 967 case NO_CLOSE_QUOTE: | 967 case NO_CLOSE_QUOTE: |
| 968 return CSSValueNoCloseQuote; | 968 return CSSValueNoCloseQuote; |
| 969 case CLOSE_QUOTE: | 969 case CLOSE_QUOTE: |
| 970 return CSSValueCloseQuote; | 970 return CSSValueCloseQuote; |
| 971 case OPEN_QUOTE: | 971 case OPEN_QUOTE: |
| 972 return CSSValueOpenQuote; | 972 return CSSValueOpenQuote; |
| 973 } | 973 } |
| 974 ASSERT_NOT_REACHED(); | 974 ASSERT_NOT_REACHED(); |
| 975 return CSSValueInvalid; | 975 return CSSValueInvalid; |
| 976 } | 976 } |
| 977 | 977 |
| 978 static PassRefPtrWillBeRawPtr<CSSValue> valueForContentData(const ComputedStyle&
style) | 978 static RawPtr<CSSValue> valueForContentData(const ComputedStyle& style) |
| 979 { | 979 { |
| 980 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 980 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 981 for (const ContentData* contentData = style.contentData(); contentData; cont
entData = contentData->next()) { | 981 for (const ContentData* contentData = style.contentData(); contentData; cont
entData = contentData->next()) { |
| 982 if (contentData->isCounter()) { | 982 if (contentData->isCounter()) { |
| 983 const CounterContent* counter = toCounterContentData(contentData)->c
ounter(); | 983 const CounterContent* counter = toCounterContentData(contentData)->c
ounter(); |
| 984 ASSERT(counter); | 984 ASSERT(counter); |
| 985 RefPtrWillBeRawPtr<CSSCustomIdentValue> identifier = CSSCustomIdentV
alue::create(counter->identifier()); | 985 RawPtr<CSSCustomIdentValue> identifier = CSSCustomIdentValue::create
(counter->identifier()); |
| 986 RefPtrWillBeRawPtr<CSSCustomIdentValue> separator = CSSCustomIdentVa
lue::create(counter->separator()); | 986 RawPtr<CSSCustomIdentValue> separator = CSSCustomIdentValue::create(
counter->separator()); |
| 987 CSSValueID listStyleIdent = CSSValueNone; | 987 CSSValueID listStyleIdent = CSSValueNone; |
| 988 if (counter->listStyle() != NoneListStyle) | 988 if (counter->listStyle() != NoneListStyle) |
| 989 listStyleIdent = static_cast<CSSValueID>(CSSValueDisc + counter-
>listStyle()); | 989 listStyleIdent = static_cast<CSSValueID>(CSSValueDisc + counter-
>listStyle()); |
| 990 RefPtrWillBeRawPtr<CSSPrimitiveValue> listStyle = cssValuePool().cre
ateIdentifierValue(listStyleIdent); | 990 RawPtr<CSSPrimitiveValue> listStyle = cssValuePool().createIdentifie
rValue(listStyleIdent); |
| 991 list->append(CSSCounterValue::create(identifier.release(), listStyle
.release(), separator.release())); | 991 list->append(CSSCounterValue::create(identifier.release(), listStyle
.release(), separator.release())); |
| 992 } else if (contentData->isImage()) { | 992 } else if (contentData->isImage()) { |
| 993 const StyleImage* image = toImageContentData(contentData)->image(); | 993 const StyleImage* image = toImageContentData(contentData)->image(); |
| 994 ASSERT(image); | 994 ASSERT(image); |
| 995 list->append(image->computedCSSValue()); | 995 list->append(image->computedCSSValue()); |
| 996 } else if (contentData->isText()) { | 996 } else if (contentData->isText()) { |
| 997 list->append(CSSStringValue::create(toTextContentData(contentData)->
text())); | 997 list->append(CSSStringValue::create(toTextContentData(contentData)->
text())); |
| 998 } else if (contentData->isQuote()) { | 998 } else if (contentData->isQuote()) { |
| 999 const QuoteType quoteType = toQuoteContentData(contentData)->quote()
; | 999 const QuoteType quoteType = toQuoteContentData(contentData)->quote()
; |
| 1000 list->append(cssValuePool().createIdentifierValue(valueForQuoteType(
quoteType))); | 1000 list->append(cssValuePool().createIdentifierValue(valueForQuoteType(
quoteType))); |
| 1001 } else { | 1001 } else { |
| 1002 ASSERT_NOT_REACHED(); | 1002 ASSERT_NOT_REACHED(); |
| 1003 } | 1003 } |
| 1004 } | 1004 } |
| 1005 return list.release(); | 1005 return list.release(); |
| 1006 } | 1006 } |
| 1007 | 1007 |
| 1008 static PassRefPtrWillBeRawPtr<CSSValue> valueForCounterDirectives(const Computed
Style& style, CSSPropertyID propertyID) | 1008 static RawPtr<CSSValue> valueForCounterDirectives(const ComputedStyle& style, CS
SPropertyID propertyID) |
| 1009 { | 1009 { |
| 1010 const CounterDirectiveMap* map = style.counterDirectives(); | 1010 const CounterDirectiveMap* map = style.counterDirectives(); |
| 1011 if (!map) | 1011 if (!map) |
| 1012 return cssValuePool().createIdentifierValue(CSSValueNone); | 1012 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1013 | 1013 |
| 1014 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 1014 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 1015 for (const auto& item : *map) { | 1015 for (const auto& item : *map) { |
| 1016 bool isValidCounterValue = propertyID == CSSPropertyCounterIncrement ? i
tem.value.isIncrement() : item.value.isReset(); | 1016 bool isValidCounterValue = propertyID == CSSPropertyCounterIncrement ? i
tem.value.isIncrement() : item.value.isReset(); |
| 1017 if (!isValidCounterValue) | 1017 if (!isValidCounterValue) |
| 1018 continue; | 1018 continue; |
| 1019 | 1019 |
| 1020 list->append(CSSCustomIdentValue::create(item.key)); | 1020 list->append(CSSCustomIdentValue::create(item.key)); |
| 1021 short number = propertyID == CSSPropertyCounterIncrement ? item.value.in
crementValue() : item.value.resetValue(); | 1021 short number = propertyID == CSSPropertyCounterIncrement ? item.value.in
crementValue() : item.value.resetValue(); |
| 1022 list->append(cssValuePool().createValue((double)number, CSSPrimitiveValu
e::UnitType::Integer)); | 1022 list->append(cssValuePool().createValue((double)number, CSSPrimitiveValu
e::UnitType::Integer)); |
| 1023 } | 1023 } |
| 1024 | 1024 |
| 1025 if (!list->length()) | 1025 if (!list->length()) |
| 1026 return cssValuePool().createIdentifierValue(CSSValueNone); | 1026 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1027 | 1027 |
| 1028 return list.release(); | 1028 return list.release(); |
| 1029 } | 1029 } |
| 1030 | 1030 |
| 1031 static PassRefPtrWillBeRawPtr<CSSValue> valueForShape(const ComputedStyle& style
, ShapeValue* shapeValue) | 1031 static RawPtr<CSSValue> valueForShape(const ComputedStyle& style, ShapeValue* sh
apeValue) |
| 1032 { | 1032 { |
| 1033 if (!shapeValue) | 1033 if (!shapeValue) |
| 1034 return cssValuePool().createIdentifierValue(CSSValueNone); | 1034 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1035 if (shapeValue->type() == ShapeValue::Box) | 1035 if (shapeValue->type() == ShapeValue::Box) |
| 1036 return cssValuePool().createValue(shapeValue->cssBox()); | 1036 return cssValuePool().createValue(shapeValue->cssBox()); |
| 1037 if (shapeValue->type() == ShapeValue::Image) { | 1037 if (shapeValue->type() == ShapeValue::Image) { |
| 1038 if (shapeValue->image()) | 1038 if (shapeValue->image()) |
| 1039 return shapeValue->image()->computedCSSValue(); | 1039 return shapeValue->image()->computedCSSValue(); |
| 1040 return cssValuePool().createIdentifierValue(CSSValueNone); | 1040 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1041 } | 1041 } |
| 1042 | 1042 |
| 1043 ASSERT(shapeValue->type() == ShapeValue::Shape); | 1043 ASSERT(shapeValue->type() == ShapeValue::Shape); |
| 1044 | 1044 |
| 1045 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 1045 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 1046 list->append(valueForBasicShape(style, shapeValue->shape())); | 1046 list->append(valueForBasicShape(style, shapeValue->shape())); |
| 1047 if (shapeValue->cssBox() != BoxMissing) | 1047 if (shapeValue->cssBox() != BoxMissing) |
| 1048 list->append(cssValuePool().createValue(shapeValue->cssBox())); | 1048 list->append(cssValuePool().createValue(shapeValue->cssBox())); |
| 1049 return list.release(); | 1049 return list.release(); |
| 1050 } | 1050 } |
| 1051 | 1051 |
| 1052 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForSidesShorthand(const StyleP
ropertyShorthand& shorthand, const ComputedStyle& style, const LayoutObject* lay
outObject, Node* styledNode, bool allowVisitedStyle) | 1052 static RawPtr<CSSValueList> valuesForSidesShorthand(const StylePropertyShorthand
& shorthand, const ComputedStyle& style, const LayoutObject* layoutObject, Node*
styledNode, bool allowVisitedStyle) |
| 1053 { | 1053 { |
| 1054 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 1054 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 1055 // Assume the properties are in the usual order top, right, bottom, left. | 1055 // Assume the properties are in the usual order top, right, bottom, left. |
| 1056 RefPtrWillBeRawPtr<CSSValue> topValue = ComputedStyleCSSValueMapping::get(sh
orthand.properties()[0], style, layoutObject, styledNode, allowVisitedStyle); | 1056 RawPtr<CSSValue> topValue = ComputedStyleCSSValueMapping::get(shorthand.prop
erties()[0], style, layoutObject, styledNode, allowVisitedStyle); |
| 1057 RefPtrWillBeRawPtr<CSSValue> rightValue = ComputedStyleCSSValueMapping::get(
shorthand.properties()[1], style, layoutObject, styledNode, allowVisitedStyle); | 1057 RawPtr<CSSValue> rightValue = ComputedStyleCSSValueMapping::get(shorthand.pr
operties()[1], style, layoutObject, styledNode, allowVisitedStyle); |
| 1058 RefPtrWillBeRawPtr<CSSValue> bottomValue = ComputedStyleCSSValueMapping::get
(shorthand.properties()[2], style, layoutObject, styledNode, allowVisitedStyle); | 1058 RawPtr<CSSValue> bottomValue = ComputedStyleCSSValueMapping::get(shorthand.p
roperties()[2], style, layoutObject, styledNode, allowVisitedStyle); |
| 1059 RefPtrWillBeRawPtr<CSSValue> leftValue = ComputedStyleCSSValueMapping::get(s
horthand.properties()[3], style, layoutObject, styledNode, allowVisitedStyle); | 1059 RawPtr<CSSValue> leftValue = ComputedStyleCSSValueMapping::get(shorthand.pro
perties()[3], style, layoutObject, styledNode, allowVisitedStyle); |
| 1060 | 1060 |
| 1061 // All 4 properties must be specified. | 1061 // All 4 properties must be specified. |
| 1062 if (!topValue || !rightValue || !bottomValue || !leftValue) | 1062 if (!topValue || !rightValue || !bottomValue || !leftValue) |
| 1063 return nullptr; | 1063 return nullptr; |
| 1064 | 1064 |
| 1065 bool showLeft = !compareCSSValuePtr(rightValue, leftValue); | 1065 bool showLeft = !compareCSSValuePtr(rightValue, leftValue); |
| 1066 bool showBottom = !compareCSSValuePtr(topValue, bottomValue) || showLeft; | 1066 bool showBottom = !compareCSSValuePtr(topValue, bottomValue) || showLeft; |
| 1067 bool showRight = !compareCSSValuePtr(topValue, rightValue) || showBottom; | 1067 bool showRight = !compareCSSValuePtr(topValue, rightValue) || showBottom; |
| 1068 | 1068 |
| 1069 list->append(topValue.release()); | 1069 list->append(topValue.release()); |
| 1070 if (showRight) | 1070 if (showRight) |
| 1071 list->append(rightValue.release()); | 1071 list->append(rightValue.release()); |
| 1072 if (showBottom) | 1072 if (showBottom) |
| 1073 list->append(bottomValue.release()); | 1073 list->append(bottomValue.release()); |
| 1074 if (showLeft) | 1074 if (showLeft) |
| 1075 list->append(leftValue.release()); | 1075 list->append(leftValue.release()); |
| 1076 | 1076 |
| 1077 return list.release(); | 1077 return list.release(); |
| 1078 } | 1078 } |
| 1079 | 1079 |
| 1080 static PassRefPtrWillBeRawPtr<CSSValueList> valueForBorderRadiusShorthand(const
ComputedStyle& style) | 1080 static RawPtr<CSSValueList> valueForBorderRadiusShorthand(const ComputedStyle& s
tyle) |
| 1081 { | 1081 { |
| 1082 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated()
; | 1082 RawPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); |
| 1083 | 1083 |
| 1084 bool showHorizontalBottomLeft = style.borderTopRightRadius().width() != styl
e.borderBottomLeftRadius().width(); | 1084 bool showHorizontalBottomLeft = style.borderTopRightRadius().width() != styl
e.borderBottomLeftRadius().width(); |
| 1085 bool showHorizontalBottomRight = showHorizontalBottomLeft || (style.borderBo
ttomRightRadius().width() != style.borderTopLeftRadius().width()); | 1085 bool showHorizontalBottomRight = showHorizontalBottomLeft || (style.borderBo
ttomRightRadius().width() != style.borderTopLeftRadius().width()); |
| 1086 bool showHorizontalTopRight = showHorizontalBottomRight || (style.borderTopR
ightRadius().width() != style.borderTopLeftRadius().width()); | 1086 bool showHorizontalTopRight = showHorizontalBottomRight || (style.borderTopR
ightRadius().width() != style.borderTopLeftRadius().width()); |
| 1087 | 1087 |
| 1088 bool showVerticalBottomLeft = style.borderTopRightRadius().height() != style
.borderBottomLeftRadius().height(); | 1088 bool showVerticalBottomLeft = style.borderTopRightRadius().height() != style
.borderBottomLeftRadius().height(); |
| 1089 bool showVerticalBottomRight = showVerticalBottomLeft || (style.borderBottom
RightRadius().height() != style.borderTopLeftRadius().height()); | 1089 bool showVerticalBottomRight = showVerticalBottomLeft || (style.borderBottom
RightRadius().height() != style.borderTopLeftRadius().height()); |
| 1090 bool showVerticalTopRight = showVerticalBottomRight || (style.borderTopRight
Radius().height() != style.borderTopLeftRadius().height()); | 1090 bool showVerticalTopRight = showVerticalBottomRight || (style.borderTopRight
Radius().height() != style.borderTopLeftRadius().height()); |
| 1091 | 1091 |
| 1092 RefPtrWillBeRawPtr<CSSValueList> topLeftRadius = valuesForBorderRadiusCorner
(style.borderTopLeftRadius(), style); | 1092 RawPtr<CSSValueList> topLeftRadius = valuesForBorderRadiusCorner(style.borde
rTopLeftRadius(), style); |
| 1093 RefPtrWillBeRawPtr<CSSValueList> topRightRadius = valuesForBorderRadiusCorne
r(style.borderTopRightRadius(), style); | 1093 RawPtr<CSSValueList> topRightRadius = valuesForBorderRadiusCorner(style.bord
erTopRightRadius(), style); |
| 1094 RefPtrWillBeRawPtr<CSSValueList> bottomRightRadius = valuesForBorderRadiusCo
rner(style.borderBottomRightRadius(), style); | 1094 RawPtr<CSSValueList> bottomRightRadius = valuesForBorderRadiusCorner(style.b
orderBottomRightRadius(), style); |
| 1095 RefPtrWillBeRawPtr<CSSValueList> bottomLeftRadius = valuesForBorderRadiusCor
ner(style.borderBottomLeftRadius(), style); | 1095 RawPtr<CSSValueList> bottomLeftRadius = valuesForBorderRadiusCorner(style.bo
rderBottomLeftRadius(), style); |
| 1096 | 1096 |
| 1097 RefPtrWillBeRawPtr<CSSValueList> horizontalRadii = CSSValueList::createSpace
Separated(); | 1097 RawPtr<CSSValueList> horizontalRadii = CSSValueList::createSpaceSeparated(); |
| 1098 horizontalRadii->append(topLeftRadius->item(0)); | 1098 horizontalRadii->append(topLeftRadius->item(0)); |
| 1099 if (showHorizontalTopRight) | 1099 if (showHorizontalTopRight) |
| 1100 horizontalRadii->append(topRightRadius->item(0)); | 1100 horizontalRadii->append(topRightRadius->item(0)); |
| 1101 if (showHorizontalBottomRight) | 1101 if (showHorizontalBottomRight) |
| 1102 horizontalRadii->append(bottomRightRadius->item(0)); | 1102 horizontalRadii->append(bottomRightRadius->item(0)); |
| 1103 if (showHorizontalBottomLeft) | 1103 if (showHorizontalBottomLeft) |
| 1104 horizontalRadii->append(bottomLeftRadius->item(0)); | 1104 horizontalRadii->append(bottomLeftRadius->item(0)); |
| 1105 | 1105 |
| 1106 list->append(horizontalRadii.release()); | 1106 list->append(horizontalRadii.release()); |
| 1107 | 1107 |
| 1108 RefPtrWillBeRawPtr<CSSValueList> verticalRadii = CSSValueList::createSpaceSe
parated(); | 1108 RawPtr<CSSValueList> verticalRadii = CSSValueList::createSpaceSeparated(); |
| 1109 verticalRadii->append(topLeftRadius->item(1)); | 1109 verticalRadii->append(topLeftRadius->item(1)); |
| 1110 if (showVerticalTopRight) | 1110 if (showVerticalTopRight) |
| 1111 verticalRadii->append(topRightRadius->item(1)); | 1111 verticalRadii->append(topRightRadius->item(1)); |
| 1112 if (showVerticalBottomRight) | 1112 if (showVerticalBottomRight) |
| 1113 verticalRadii->append(bottomRightRadius->item(1)); | 1113 verticalRadii->append(bottomRightRadius->item(1)); |
| 1114 if (showVerticalBottomLeft) | 1114 if (showVerticalBottomLeft) |
| 1115 verticalRadii->append(bottomLeftRadius->item(1)); | 1115 verticalRadii->append(bottomLeftRadius->item(1)); |
| 1116 | 1116 |
| 1117 if (!verticalRadii->equals(*toCSSValueList(list->item(0)))) | 1117 if (!verticalRadii->equals(*toCSSValueList(list->item(0)))) |
| 1118 list->append(verticalRadii.release()); | 1118 list->append(verticalRadii.release()); |
| 1119 | 1119 |
| 1120 return list.release(); | 1120 return list.release(); |
| 1121 } | 1121 } |
| 1122 | 1122 |
| 1123 static PassRefPtrWillBeRawPtr<CSSValue> strokeDashArrayToCSSValueList(const SVGD
ashArray& dashes, const ComputedStyle& style) | 1123 static RawPtr<CSSValue> strokeDashArrayToCSSValueList(const SVGDashArray& dashes
, const ComputedStyle& style) |
| 1124 { | 1124 { |
| 1125 if (dashes.isEmpty()) | 1125 if (dashes.isEmpty()) |
| 1126 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | 1126 return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
| 1127 | 1127 |
| 1128 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 1128 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 1129 for (const Length& dashLength : dashes.vector()) | 1129 for (const Length& dashLength : dashes.vector()) |
| 1130 list->append(zoomAdjustedPixelValueForLength(dashLength, style)); | 1130 list->append(zoomAdjustedPixelValueForLength(dashLength, style)); |
| 1131 | 1131 |
| 1132 return list.release(); | 1132 return list.release(); |
| 1133 } | 1133 } |
| 1134 | 1134 |
| 1135 static PassRefPtrWillBeRawPtr<CSSValue> paintOrderToCSSValueList(const SVGComput
edStyle& svgStyle) | 1135 static RawPtr<CSSValue> paintOrderToCSSValueList(const SVGComputedStyle& svgStyl
e) |
| 1136 { | 1136 { |
| 1137 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 1137 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 1138 for (int i = 0; i < 3; i++) { | 1138 for (int i = 0; i < 3; i++) { |
| 1139 EPaintOrderType paintOrderType = svgStyle.paintOrderType(i); | 1139 EPaintOrderType paintOrderType = svgStyle.paintOrderType(i); |
| 1140 switch (paintOrderType) { | 1140 switch (paintOrderType) { |
| 1141 case PT_FILL: | 1141 case PT_FILL: |
| 1142 case PT_STROKE: | 1142 case PT_STROKE: |
| 1143 case PT_MARKERS: | 1143 case PT_MARKERS: |
| 1144 list->append(CSSPrimitiveValue::create(paintOrderType)); | 1144 list->append(CSSPrimitiveValue::create(paintOrderType)); |
| 1145 break; | 1145 break; |
| 1146 case PT_NONE: | 1146 case PT_NONE: |
| 1147 default: | 1147 default: |
| 1148 ASSERT_NOT_REACHED(); | 1148 ASSERT_NOT_REACHED(); |
| 1149 break; | 1149 break; |
| 1150 } | 1150 } |
| 1151 } | 1151 } |
| 1152 | 1152 |
| 1153 return list.release(); | 1153 return list.release(); |
| 1154 } | 1154 } |
| 1155 | 1155 |
| 1156 static PassRefPtrWillBeRawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintTy
pe paintType, const String& url, const Color& color, const Color& currentColor) | 1156 static RawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintType paintType, co
nst String& url, const Color& color, const Color& currentColor) |
| 1157 { | 1157 { |
| 1158 if (paintType >= SVG_PAINTTYPE_URI_NONE) { | 1158 if (paintType >= SVG_PAINTTYPE_URI_NONE) { |
| 1159 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSepar
ated(); | 1159 RawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated(); |
| 1160 values->append(CSSURIValue::create(url)); | 1160 values->append(CSSURIValue::create(url)); |
| 1161 if (paintType == SVG_PAINTTYPE_URI_NONE) | 1161 if (paintType == SVG_PAINTTYPE_URI_NONE) |
| 1162 values->append(CSSPrimitiveValue::createIdentifier(CSSValueNone)); | 1162 values->append(CSSPrimitiveValue::createIdentifier(CSSValueNone)); |
| 1163 else if (paintType == SVG_PAINTTYPE_URI_CURRENTCOLOR) | 1163 else if (paintType == SVG_PAINTTYPE_URI_CURRENTCOLOR) |
| 1164 values->append(CSSColorValue::create(currentColor.rgb())); | 1164 values->append(CSSColorValue::create(currentColor.rgb())); |
| 1165 else if (paintType == SVG_PAINTTYPE_URI_RGBCOLOR) | 1165 else if (paintType == SVG_PAINTTYPE_URI_RGBCOLOR) |
| 1166 values->append(CSSColorValue::create(color.rgb())); | 1166 values->append(CSSColorValue::create(color.rgb())); |
| 1167 return values.release(); | 1167 return values.release(); |
| 1168 } | 1168 } |
| 1169 if (paintType == SVG_PAINTTYPE_NONE) | 1169 if (paintType == SVG_PAINTTYPE_NONE) |
| 1170 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | 1170 return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
| 1171 if (paintType == SVG_PAINTTYPE_CURRENTCOLOR) | 1171 if (paintType == SVG_PAINTTYPE_CURRENTCOLOR) |
| 1172 return CSSColorValue::create(currentColor.rgb()); | 1172 return CSSColorValue::create(currentColor.rgb()); |
| 1173 | 1173 |
| 1174 return CSSColorValue::create(color.rgb()); | 1174 return CSSColorValue::create(color.rgb()); |
| 1175 } | 1175 } |
| 1176 | 1176 |
| 1177 static inline String serializeAsFragmentIdentifier(const AtomicString& resource) | 1177 static inline String serializeAsFragmentIdentifier(const AtomicString& resource) |
| 1178 { | 1178 { |
| 1179 return "#" + resource; | 1179 return "#" + resource; |
| 1180 } | 1180 } |
| 1181 | 1181 |
| 1182 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowDat
a(const ShadowData& shadow, const ComputedStyle& style, bool useSpread) | 1182 RawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowData(const ShadowDa
ta& shadow, const ComputedStyle& style, bool useSpread) |
| 1183 { | 1183 { |
| 1184 RefPtrWillBeRawPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(shadow.x(),
style); | 1184 RawPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(shadow.x(), style); |
| 1185 RefPtrWillBeRawPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(shadow.y(),
style); | 1185 RawPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(shadow.y(), style); |
| 1186 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(shadow.b
lur(), style); | 1186 RawPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(shadow.blur(), style
); |
| 1187 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = useSpread ? zoomAdjustedPixel
Value(shadow.spread(), style) : PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullpt
r); | 1187 RawPtr<CSSPrimitiveValue> spread = useSpread ? zoomAdjustedPixelValue(shadow
.spread(), style) : RawPtr<CSSPrimitiveValue>(nullptr); |
| 1188 RefPtrWillBeRawPtr<CSSPrimitiveValue> shadowStyle = shadow.style() == Normal
? PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullptr) : cssValuePool().createIde
ntifierValue(CSSValueInset); | 1188 RawPtr<CSSPrimitiveValue> shadowStyle = shadow.style() == Normal ? RawPtr<CS
SPrimitiveValue>(nullptr) : cssValuePool().createIdentifierValue(CSSValueInset); |
| 1189 RefPtrWillBeRawPtr<CSSValue> color = currentColorOrValidColor(style, shadow.
color()); | 1189 RawPtr<CSSValue> color = currentColorOrValidColor(style, shadow.color()); |
| 1190 return CSSShadowValue::create(x.release(), y.release(), blur.release(), spre
ad.release(), shadowStyle.release(), color.release()); | 1190 return CSSShadowValue::create(x.release(), y.release(), blur.release(), spre
ad.release(), shadowStyle.release(), color.release()); |
| 1191 } | 1191 } |
| 1192 | 1192 |
| 1193 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowLis
t(const ShadowList* shadowList, const ComputedStyle& style, bool useSpread) | 1193 RawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowList(const ShadowLi
st* shadowList, const ComputedStyle& style, bool useSpread) |
| 1194 { | 1194 { |
| 1195 if (!shadowList) | 1195 if (!shadowList) |
| 1196 return cssValuePool().createIdentifierValue(CSSValueNone); | 1196 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1197 | 1197 |
| 1198 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 1198 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 1199 size_t shadowCount = shadowList->shadows().size(); | 1199 size_t shadowCount = shadowList->shadows().size(); |
| 1200 for (size_t i = 0; i < shadowCount; ++i) | 1200 for (size_t i = 0; i < shadowCount; ++i) |
| 1201 list->append(valueForShadowData(shadowList->shadows()[i], style, useSpre
ad)); | 1201 list->append(valueForShadowData(shadowList->shadows()[i], style, useSpre
ad)); |
| 1202 return list.release(); | 1202 return list.release(); |
| 1203 } | 1203 } |
| 1204 | 1204 |
| 1205 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForFilter(co
nst ComputedStyle& style, const FilterOperations& filterOperations) | 1205 RawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForFilter(const ComputedStyl
e& style, const FilterOperations& filterOperations) |
| 1206 { | 1206 { |
| 1207 if (filterOperations.operations().isEmpty()) | 1207 if (filterOperations.operations().isEmpty()) |
| 1208 return cssValuePool().createIdentifierValue(CSSValueNone); | 1208 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1209 | 1209 |
| 1210 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 1210 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 1211 | 1211 |
| 1212 RefPtrWillBeRawPtr<CSSFunctionValue> filterValue = nullptr; | 1212 RawPtr<CSSFunctionValue> filterValue = nullptr; |
| 1213 | 1213 |
| 1214 for (const auto& operation : filterOperations.operations()) { | 1214 for (const auto& operation : filterOperations.operations()) { |
| 1215 FilterOperation* filterOperation = operation.get(); | 1215 FilterOperation* filterOperation = operation.get(); |
| 1216 switch (filterOperation->type()) { | 1216 switch (filterOperation->type()) { |
| 1217 case FilterOperation::REFERENCE: | 1217 case FilterOperation::REFERENCE: |
| 1218 filterValue = CSSFunctionValue::create(CSSValueUrl); | 1218 filterValue = CSSFunctionValue::create(CSSValueUrl); |
| 1219 filterValue->append(CSSStringValue::create(toReferenceFilterOperatio
n(filterOperation)->url())); | 1219 filterValue->append(CSSStringValue::create(toReferenceFilterOperatio
n(filterOperation)->url())); |
| 1220 break; | 1220 break; |
| 1221 case FilterOperation::GRAYSCALE: | 1221 case FilterOperation::GRAYSCALE: |
| 1222 filterValue = CSSFunctionValue::create(CSSValueGrayscale); | 1222 filterValue = CSSFunctionValue::create(CSSValueGrayscale); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1265 default: | 1265 default: |
| 1266 ASSERT_NOT_REACHED(); | 1266 ASSERT_NOT_REACHED(); |
| 1267 break; | 1267 break; |
| 1268 } | 1268 } |
| 1269 list->append(filterValue.release()); | 1269 list->append(filterValue.release()); |
| 1270 } | 1270 } |
| 1271 | 1271 |
| 1272 return list.release(); | 1272 return list.release(); |
| 1273 } | 1273 } |
| 1274 | 1274 |
| 1275 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForFont(cons
t ComputedStyle& style) | 1275 RawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForFont(const ComputedStyle&
style) |
| 1276 { | 1276 { |
| 1277 // Add a slash between size and line-height. | 1277 // Add a slash between size and line-height. |
| 1278 RefPtrWillBeRawPtr<CSSValueList> sizeAndLineHeight = CSSValueList::createSla
shSeparated(); | 1278 RawPtr<CSSValueList> sizeAndLineHeight = CSSValueList::createSlashSeparated(
); |
| 1279 sizeAndLineHeight->append(valueForFontSize(style)); | 1279 sizeAndLineHeight->append(valueForFontSize(style)); |
| 1280 sizeAndLineHeight->append(valueForLineHeight(style)); | 1280 sizeAndLineHeight->append(valueForLineHeight(style)); |
| 1281 | 1281 |
| 1282 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 1282 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 1283 list->append(valueForFontStyle(style)); | 1283 list->append(valueForFontStyle(style)); |
| 1284 list->append(valueForFontVariant(style)); | 1284 list->append(valueForFontVariant(style)); |
| 1285 list->append(valueForFontWeight(style)); | 1285 list->append(valueForFontWeight(style)); |
| 1286 list->append(valueForFontStretch(style)); | 1286 list->append(valueForFontStretch(style)); |
| 1287 list->append(sizeAndLineHeight.release()); | 1287 list->append(sizeAndLineHeight.release()); |
| 1288 list->append(valueForFontFamily(style)); | 1288 list->append(valueForFontFamily(style)); |
| 1289 | 1289 |
| 1290 return list.release(); | 1290 return list.release(); |
| 1291 } | 1291 } |
| 1292 | 1292 |
| 1293 static PassRefPtrWillBeRawPtr<CSSValue> valueForScrollSnapDestination(const Leng
thPoint& destination, const ComputedStyle& style) | 1293 static RawPtr<CSSValue> valueForScrollSnapDestination(const LengthPoint& destina
tion, const ComputedStyle& style) |
| 1294 { | 1294 { |
| 1295 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 1295 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 1296 list->append(zoomAdjustedPixelValueForLength(destination.x(), style)); | 1296 list->append(zoomAdjustedPixelValueForLength(destination.x(), style)); |
| 1297 list->append(zoomAdjustedPixelValueForLength(destination.y(), style)); | 1297 list->append(zoomAdjustedPixelValueForLength(destination.y(), style)); |
| 1298 return list.release(); | 1298 return list.release(); |
| 1299 } | 1299 } |
| 1300 | 1300 |
| 1301 static PassRefPtrWillBeRawPtr<CSSValue> valueForScrollSnapPoints(const ScrollSna
pPoints& points, const ComputedStyle& style) | 1301 static RawPtr<CSSValue> valueForScrollSnapPoints(const ScrollSnapPoints& points,
const ComputedStyle& style) |
| 1302 { | 1302 { |
| 1303 if (points.hasRepeat) { | 1303 if (points.hasRepeat) { |
| 1304 RefPtrWillBeRawPtr<CSSFunctionValue> repeat = CSSFunctionValue::create(C
SSValueRepeat); | 1304 RawPtr<CSSFunctionValue> repeat = CSSFunctionValue::create(CSSValueRepea
t); |
| 1305 repeat->append(zoomAdjustedPixelValueForLength(points.repeatOffset, styl
e)); | 1305 repeat->append(zoomAdjustedPixelValueForLength(points.repeatOffset, styl
e)); |
| 1306 return repeat.release(); | 1306 return repeat.release(); |
| 1307 } | 1307 } |
| 1308 | 1308 |
| 1309 return cssValuePool().createIdentifierValue(CSSValueNone); | 1309 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1310 } | 1310 } |
| 1311 | 1311 |
| 1312 static PassRefPtrWillBeRawPtr<CSSValue> valueForScrollSnapCoordinate(const Vecto
r<LengthPoint>& coordinates, const ComputedStyle& style) | 1312 static RawPtr<CSSValue> valueForScrollSnapCoordinate(const Vector<LengthPoint>&
coordinates, const ComputedStyle& style) |
| 1313 { | 1313 { |
| 1314 if (coordinates.isEmpty()) | 1314 if (coordinates.isEmpty()) |
| 1315 return cssValuePool().createIdentifierValue(CSSValueNone); | 1315 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1316 | 1316 |
| 1317 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated()
; | 1317 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 1318 | 1318 |
| 1319 for (auto& coordinate : coordinates) { | 1319 for (auto& coordinate : coordinates) { |
| 1320 auto pair = CSSValueList::createSpaceSeparated(); | 1320 auto pair = CSSValueList::createSpaceSeparated(); |
| 1321 pair->append(zoomAdjustedPixelValueForLength(coordinate.x(), style)); | 1321 pair->append(zoomAdjustedPixelValueForLength(coordinate.x(), style)); |
| 1322 pair->append(zoomAdjustedPixelValueForLength(coordinate.y(), style)); | 1322 pair->append(zoomAdjustedPixelValueForLength(coordinate.y(), style)); |
| 1323 list->append(pair); | 1323 list->append(pair); |
| 1324 } | 1324 } |
| 1325 | 1325 |
| 1326 return list.release(); | 1326 return list.release(); |
| 1327 } | 1327 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1355 return BreakAuto; | 1355 return BreakAuto; |
| 1356 case BreakColumn: | 1356 case BreakColumn: |
| 1357 return BreakAlways; | 1357 return BreakAlways; |
| 1358 case BreakAvoidColumn: | 1358 case BreakAvoidColumn: |
| 1359 return BreakAvoid; | 1359 return BreakAvoid; |
| 1360 default: | 1360 default: |
| 1361 return genericBreakValue; | 1361 return genericBreakValue; |
| 1362 } | 1362 } |
| 1363 } | 1363 } |
| 1364 | 1364 |
| 1365 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::get(const AtomicS
tring customPropertyName, const ComputedStyle& style) | 1365 RawPtr<CSSValue> ComputedStyleCSSValueMapping::get(const AtomicString customProp
ertyName, const ComputedStyle& style) |
| 1366 { | 1366 { |
| 1367 StyleVariableData* variables = style.variables(); | 1367 StyleVariableData* variables = style.variables(); |
| 1368 if (!variables) | 1368 if (!variables) |
| 1369 return nullptr; | 1369 return nullptr; |
| 1370 | 1370 |
| 1371 CSSVariableData* data = variables->getVariable(customPropertyName); | 1371 CSSVariableData* data = variables->getVariable(customPropertyName); |
| 1372 if (!data) | 1372 if (!data) |
| 1373 return nullptr; | 1373 return nullptr; |
| 1374 | 1374 |
| 1375 return CSSCustomPropertyDeclaration::create(customPropertyName, data); | 1375 return CSSCustomPropertyDeclaration::create(customPropertyName, data); |
| 1376 } | 1376 } |
| 1377 | 1377 |
| 1378 const HashMap<AtomicString, RefPtr<CSSVariableData>>* ComputedStyleCSSValueMappi
ng::getVariables(const ComputedStyle& style) | 1378 const HashMap<AtomicString, RefPtr<CSSVariableData>>* ComputedStyleCSSValueMappi
ng::getVariables(const ComputedStyle& style) |
| 1379 { | 1379 { |
| 1380 StyleVariableData* variables = style.variables(); | 1380 StyleVariableData* variables = style.variables(); |
| 1381 if (variables) | 1381 if (variables) |
| 1382 return variables->getVariables(); | 1382 return variables->getVariables(); |
| 1383 return nullptr; | 1383 return nullptr; |
| 1384 } | 1384 } |
| 1385 | 1385 |
| 1386 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::get(CSSPropertyID
propertyID, const ComputedStyle& style, const LayoutObject* layoutObject, Node*
styledNode, bool allowVisitedStyle) | 1386 RawPtr<CSSValue> ComputedStyleCSSValueMapping::get(CSSPropertyID propertyID, con
st ComputedStyle& style, const LayoutObject* layoutObject, Node* styledNode, boo
l allowVisitedStyle) |
| 1387 { | 1387 { |
| 1388 const SVGComputedStyle& svgStyle = style.svgStyle(); | 1388 const SVGComputedStyle& svgStyle = style.svgStyle(); |
| 1389 propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style.di
rection(), style.getWritingMode()); | 1389 propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style.di
rection(), style.getWritingMode()); |
| 1390 switch (propertyID) { | 1390 switch (propertyID) { |
| 1391 case CSSPropertyInvalid: | 1391 case CSSPropertyInvalid: |
| 1392 return nullptr; | 1392 return nullptr; |
| 1393 | 1393 |
| 1394 case CSSPropertyBackgroundColor: | 1394 case CSSPropertyBackgroundColor: |
| 1395 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited
DependentColor(CSSPropertyBackgroundColor).rgb()) : currentColorOrValidColor(sty
le, style.backgroundColor()); | 1395 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited
DependentColor(CSSPropertyBackgroundColor).rgb()) : currentColorOrValidColor(sty
le, style.backgroundColor()); |
| 1396 case CSSPropertyBackgroundImage: | 1396 case CSSPropertyBackgroundImage: |
| 1397 case CSSPropertyWebkitMaskImage: { | 1397 case CSSPropertyWebkitMaskImage: { |
| 1398 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); | 1398 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 1399 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskImage ?
&style.maskLayers() : &style.backgroundLayers(); | 1399 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskImage ?
&style.maskLayers() : &style.backgroundLayers(); |
| 1400 for (; currLayer; currLayer = currLayer->next()) { | 1400 for (; currLayer; currLayer = currLayer->next()) { |
| 1401 if (currLayer->image()) | 1401 if (currLayer->image()) |
| 1402 list->append(currLayer->image()->computedCSSValue()); | 1402 list->append(currLayer->image()->computedCSSValue()); |
| 1403 else | 1403 else |
| 1404 list->append(cssValuePool().createIdentifierValue(CSSValueNone))
; | 1404 list->append(cssValuePool().createIdentifierValue(CSSValueNone))
; |
| 1405 } | 1405 } |
| 1406 return list.release(); | 1406 return list.release(); |
| 1407 } | 1407 } |
| 1408 case CSSPropertyBackgroundSize: | 1408 case CSSPropertyBackgroundSize: |
| 1409 case CSSPropertyWebkitMaskSize: { | 1409 case CSSPropertyWebkitMaskSize: { |
| 1410 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); | 1410 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 1411 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskSize ? &
style.maskLayers() : &style.backgroundLayers(); | 1411 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskSize ? &
style.maskLayers() : &style.backgroundLayers(); |
| 1412 for (; currLayer; currLayer = currLayer->next()) | 1412 for (; currLayer; currLayer = currLayer->next()) |
| 1413 list->append(valueForFillSize(currLayer->size(), style)); | 1413 list->append(valueForFillSize(currLayer->size(), style)); |
| 1414 return list.release(); | 1414 return list.release(); |
| 1415 } | 1415 } |
| 1416 case CSSPropertyBackgroundRepeat: | 1416 case CSSPropertyBackgroundRepeat: |
| 1417 case CSSPropertyWebkitMaskRepeat: { | 1417 case CSSPropertyWebkitMaskRepeat: { |
| 1418 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); | 1418 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 1419 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskRepeat ?
&style.maskLayers() : &style.backgroundLayers(); | 1419 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskRepeat ?
&style.maskLayers() : &style.backgroundLayers(); |
| 1420 for (; currLayer; currLayer = currLayer->next()) | 1420 for (; currLayer; currLayer = currLayer->next()) |
| 1421 list->append(valueForFillRepeat(currLayer->repeatX(), currLayer->rep
eatY())); | 1421 list->append(valueForFillRepeat(currLayer->repeatX(), currLayer->rep
eatY())); |
| 1422 return list.release(); | 1422 return list.release(); |
| 1423 } | 1423 } |
| 1424 case CSSPropertyMaskSourceType: { | 1424 case CSSPropertyMaskSourceType: { |
| 1425 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); | 1425 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 1426 for (const FillLayer* currLayer = &style.maskLayers(); currLayer; currLa
yer = currLayer->next()) | 1426 for (const FillLayer* currLayer = &style.maskLayers(); currLayer; currLa
yer = currLayer->next()) |
| 1427 list->append(valueForFillSourceType(currLayer->maskSourceType())); | 1427 list->append(valueForFillSourceType(currLayer->maskSourceType())); |
| 1428 return list.release(); | 1428 return list.release(); |
| 1429 } | 1429 } |
| 1430 case CSSPropertyWebkitMaskComposite: { | 1430 case CSSPropertyWebkitMaskComposite: { |
| 1431 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); | 1431 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 1432 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskComposit
e ? &style.maskLayers() : &style.backgroundLayers(); | 1432 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskComposit
e ? &style.maskLayers() : &style.backgroundLayers(); |
| 1433 for (; currLayer; currLayer = currLayer->next()) | 1433 for (; currLayer; currLayer = currLayer->next()) |
| 1434 list->append(cssValuePool().createValue(currLayer->composite())); | 1434 list->append(cssValuePool().createValue(currLayer->composite())); |
| 1435 return list.release(); | 1435 return list.release(); |
| 1436 } | 1436 } |
| 1437 case CSSPropertyBackgroundAttachment: { | 1437 case CSSPropertyBackgroundAttachment: { |
| 1438 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); | 1438 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 1439 for (const FillLayer* currLayer = &style.backgroundLayers(); currLayer;
currLayer = currLayer->next()) | 1439 for (const FillLayer* currLayer = &style.backgroundLayers(); currLayer;
currLayer = currLayer->next()) |
| 1440 list->append(cssValuePool().createValue(currLayer->attachment())); | 1440 list->append(cssValuePool().createValue(currLayer->attachment())); |
| 1441 return list.release(); | 1441 return list.release(); |
| 1442 } | 1442 } |
| 1443 case CSSPropertyBackgroundClip: | 1443 case CSSPropertyBackgroundClip: |
| 1444 case CSSPropertyBackgroundOrigin: | 1444 case CSSPropertyBackgroundOrigin: |
| 1445 case CSSPropertyWebkitBackgroundClip: | 1445 case CSSPropertyWebkitBackgroundClip: |
| 1446 case CSSPropertyWebkitBackgroundOrigin: | 1446 case CSSPropertyWebkitBackgroundOrigin: |
| 1447 case CSSPropertyWebkitMaskClip: | 1447 case CSSPropertyWebkitMaskClip: |
| 1448 case CSSPropertyWebkitMaskOrigin: { | 1448 case CSSPropertyWebkitMaskOrigin: { |
| 1449 bool isClip = propertyID == CSSPropertyBackgroundClip || propertyID == C
SSPropertyWebkitBackgroundClip || propertyID == CSSPropertyWebkitMaskClip; | 1449 bool isClip = propertyID == CSSPropertyBackgroundClip || propertyID == C
SSPropertyWebkitBackgroundClip || propertyID == CSSPropertyWebkitMaskClip; |
| 1450 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); | 1450 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 1451 const FillLayer* currLayer = (propertyID == CSSPropertyWebkitMaskClip ||
propertyID == CSSPropertyWebkitMaskOrigin) ? &style.maskLayers() : &style.backg
roundLayers(); | 1451 const FillLayer* currLayer = (propertyID == CSSPropertyWebkitMaskClip ||
propertyID == CSSPropertyWebkitMaskOrigin) ? &style.maskLayers() : &style.backg
roundLayers(); |
| 1452 for (; currLayer; currLayer = currLayer->next()) { | 1452 for (; currLayer; currLayer = currLayer->next()) { |
| 1453 EFillBox box = isClip ? currLayer->clip() : currLayer->origin(); | 1453 EFillBox box = isClip ? currLayer->clip() : currLayer->origin(); |
| 1454 list->append(cssValuePool().createValue(box)); | 1454 list->append(cssValuePool().createValue(box)); |
| 1455 } | 1455 } |
| 1456 return list.release(); | 1456 return list.release(); |
| 1457 } | 1457 } |
| 1458 case CSSPropertyBackgroundPosition: | 1458 case CSSPropertyBackgroundPosition: |
| 1459 case CSSPropertyWebkitMaskPosition: { | 1459 case CSSPropertyWebkitMaskPosition: { |
| 1460 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); | 1460 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 1461 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition
? &style.maskLayers() : &style.backgroundLayers(); | 1461 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition
? &style.maskLayers() : &style.backgroundLayers(); |
| 1462 for (; currLayer; currLayer = currLayer->next()) | 1462 for (; currLayer; currLayer = currLayer->next()) |
| 1463 list->append(createPositionListForLayer(propertyID, *currLayer, styl
e)); | 1463 list->append(createPositionListForLayer(propertyID, *currLayer, styl
e)); |
| 1464 return list.release(); | 1464 return list.release(); |
| 1465 } | 1465 } |
| 1466 case CSSPropertyBackgroundPositionX: | 1466 case CSSPropertyBackgroundPositionX: |
| 1467 case CSSPropertyWebkitMaskPositionX: { | 1467 case CSSPropertyWebkitMaskPositionX: { |
| 1468 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); | 1468 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 1469 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition
X ? &style.maskLayers() : &style.backgroundLayers(); | 1469 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition
X ? &style.maskLayers() : &style.backgroundLayers(); |
| 1470 for (; currLayer; currLayer = currLayer->next()) | 1470 for (; currLayer; currLayer = currLayer->next()) |
| 1471 list->append(zoomAdjustedPixelValueForLength(currLayer->xPosition(),
style)); | 1471 list->append(zoomAdjustedPixelValueForLength(currLayer->xPosition(),
style)); |
| 1472 return list.release(); | 1472 return list.release(); |
| 1473 } | 1473 } |
| 1474 case CSSPropertyBackgroundPositionY: | 1474 case CSSPropertyBackgroundPositionY: |
| 1475 case CSSPropertyWebkitMaskPositionY: { | 1475 case CSSPropertyWebkitMaskPositionY: { |
| 1476 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); | 1476 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 1477 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition
Y ? &style.maskLayers() : &style.backgroundLayers(); | 1477 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition
Y ? &style.maskLayers() : &style.backgroundLayers(); |
| 1478 for (; currLayer; currLayer = currLayer->next()) | 1478 for (; currLayer; currLayer = currLayer->next()) |
| 1479 list->append(zoomAdjustedPixelValueForLength(currLayer->yPosition(),
style)); | 1479 list->append(zoomAdjustedPixelValueForLength(currLayer->yPosition(),
style)); |
| 1480 return list.release(); | 1480 return list.release(); |
| 1481 } | 1481 } |
| 1482 case CSSPropertyBorderCollapse: | 1482 case CSSPropertyBorderCollapse: |
| 1483 if (style.borderCollapse()) | 1483 if (style.borderCollapse()) |
| 1484 return cssValuePool().createIdentifierValue(CSSValueCollapse); | 1484 return cssValuePool().createIdentifierValue(CSSValueCollapse); |
| 1485 return cssValuePool().createIdentifierValue(CSSValueSeparate); | 1485 return cssValuePool().createIdentifierValue(CSSValueSeparate); |
| 1486 case CSSPropertyBorderSpacing: { | 1486 case CSSPropertyBorderSpacing: { |
| 1487 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat
ed(); | 1487 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 1488 list->append(zoomAdjustedPixelValue(style.horizontalBorderSpacing(), sty
le)); | 1488 list->append(zoomAdjustedPixelValue(style.horizontalBorderSpacing(), sty
le)); |
| 1489 list->append(zoomAdjustedPixelValue(style.verticalBorderSpacing(), style
)); | 1489 list->append(zoomAdjustedPixelValue(style.verticalBorderSpacing(), style
)); |
| 1490 return list.release(); | 1490 return list.release(); |
| 1491 } | 1491 } |
| 1492 case CSSPropertyWebkitBorderHorizontalSpacing: | 1492 case CSSPropertyWebkitBorderHorizontalSpacing: |
| 1493 return zoomAdjustedPixelValue(style.horizontalBorderSpacing(), style); | 1493 return zoomAdjustedPixelValue(style.horizontalBorderSpacing(), style); |
| 1494 case CSSPropertyWebkitBorderVerticalSpacing: | 1494 case CSSPropertyWebkitBorderVerticalSpacing: |
| 1495 return zoomAdjustedPixelValue(style.verticalBorderSpacing(), style); | 1495 return zoomAdjustedPixelValue(style.verticalBorderSpacing(), style); |
| 1496 case CSSPropertyBorderImageSource: | 1496 case CSSPropertyBorderImageSource: |
| 1497 if (style.borderImageSource()) | 1497 if (style.borderImageSource()) |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1581 case CSSPropertyWebkitColumnBreakInside: | 1581 case CSSPropertyWebkitColumnBreakInside: |
| 1582 return cssValuePool().createValue(mapToColumnBreakValue(style.breakInsid
e())); | 1582 return cssValuePool().createValue(mapToColumnBreakValue(style.breakInsid
e())); |
| 1583 case CSSPropertyColumnWidth: | 1583 case CSSPropertyColumnWidth: |
| 1584 if (style.hasAutoColumnWidth()) | 1584 if (style.hasAutoColumnWidth()) |
| 1585 return cssValuePool().createIdentifierValue(CSSValueAuto); | 1585 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 1586 return zoomAdjustedPixelValue(style.columnWidth(), style); | 1586 return zoomAdjustedPixelValue(style.columnWidth(), style); |
| 1587 case CSSPropertyTabSize: | 1587 case CSSPropertyTabSize: |
| 1588 return cssValuePool().createValue( | 1588 return cssValuePool().createValue( |
| 1589 style.getTabSize().getPixelSize(1.0), style.getTabSize().isSpaces()
? CSSPrimitiveValue::UnitType::Number : CSSPrimitiveValue::UnitType::Pixels); | 1589 style.getTabSize().getPixelSize(1.0), style.getTabSize().isSpaces()
? CSSPrimitiveValue::UnitType::Number : CSSPrimitiveValue::UnitType::Pixels); |
| 1590 case CSSPropertyCursor: { | 1590 case CSSPropertyCursor: { |
| 1591 RefPtrWillBeRawPtr<CSSValueList> list = nullptr; | 1591 RawPtr<CSSValueList> list = nullptr; |
| 1592 CursorList* cursors = style.cursors(); | 1592 CursorList* cursors = style.cursors(); |
| 1593 if (cursors && cursors->size() > 0) { | 1593 if (cursors && cursors->size() > 0) { |
| 1594 list = CSSValueList::createCommaSeparated(); | 1594 list = CSSValueList::createCommaSeparated(); |
| 1595 for (unsigned i = 0; i < cursors->size(); ++i) { | 1595 for (unsigned i = 0; i < cursors->size(); ++i) { |
| 1596 if (StyleImage* image = cursors->at(i).image()) | 1596 if (StyleImage* image = cursors->at(i).image()) |
| 1597 list->append(image->computedCSSValue()); | 1597 list->append(image->computedCSSValue()); |
| 1598 } | 1598 } |
| 1599 } | 1599 } |
| 1600 RefPtrWillBeRawPtr<CSSValue> value = cssValuePool().createValue(style.cu
rsor()); | 1600 RawPtr<CSSValue> value = cssValuePool().createValue(style.cursor()); |
| 1601 if (list) { | 1601 if (list) { |
| 1602 list->append(value.release()); | 1602 list->append(value.release()); |
| 1603 return list.release(); | 1603 return list.release(); |
| 1604 } | 1604 } |
| 1605 return value.release(); | 1605 return value.release(); |
| 1606 } | 1606 } |
| 1607 case CSSPropertyDirection: | 1607 case CSSPropertyDirection: |
| 1608 return cssValuePool().createValue(style.direction()); | 1608 return cssValuePool().createValue(style.direction()); |
| 1609 case CSSPropertyDisplay: | 1609 case CSSPropertyDisplay: |
| 1610 return cssValuePool().createValue(style.display()); | 1610 return cssValuePool().createValue(style.display()); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1660 case CSSPropertyFontStyle: | 1660 case CSSPropertyFontStyle: |
| 1661 return valueForFontStyle(style); | 1661 return valueForFontStyle(style); |
| 1662 case CSSPropertyFontVariant: | 1662 case CSSPropertyFontVariant: |
| 1663 return valueForFontVariant(style); | 1663 return valueForFontVariant(style); |
| 1664 case CSSPropertyFontWeight: | 1664 case CSSPropertyFontWeight: |
| 1665 return valueForFontWeight(style); | 1665 return valueForFontWeight(style); |
| 1666 case CSSPropertyFontFeatureSettings: { | 1666 case CSSPropertyFontFeatureSettings: { |
| 1667 const FontFeatureSettings* featureSettings = style.getFontDescription().
featureSettings(); | 1667 const FontFeatureSettings* featureSettings = style.getFontDescription().
featureSettings(); |
| 1668 if (!featureSettings || !featureSettings->size()) | 1668 if (!featureSettings || !featureSettings->size()) |
| 1669 return cssValuePool().createIdentifierValue(CSSValueNormal); | 1669 return cssValuePool().createIdentifierValue(CSSValueNormal); |
| 1670 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); | 1670 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 1671 for (unsigned i = 0; i < featureSettings->size(); ++i) { | 1671 for (unsigned i = 0; i < featureSettings->size(); ++i) { |
| 1672 const FontFeature& feature = featureSettings->at(i); | 1672 const FontFeature& feature = featureSettings->at(i); |
| 1673 RefPtrWillBeRawPtr<CSSFontFeatureValue> featureValue = CSSFontFeatur
eValue::create(feature.tag(), feature.value()); | 1673 RawPtr<CSSFontFeatureValue> featureValue = CSSFontFeatureValue::crea
te(feature.tag(), feature.value()); |
| 1674 list->append(featureValue.release()); | 1674 list->append(featureValue.release()); |
| 1675 } | 1675 } |
| 1676 return list.release(); | 1676 return list.release(); |
| 1677 } | 1677 } |
| 1678 case CSSPropertyGridAutoFlow: { | 1678 case CSSPropertyGridAutoFlow: { |
| 1679 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat
ed(); | 1679 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 1680 switch (style.getGridAutoFlow()) { | 1680 switch (style.getGridAutoFlow()) { |
| 1681 case AutoFlowRow: | 1681 case AutoFlowRow: |
| 1682 case AutoFlowRowDense: | 1682 case AutoFlowRowDense: |
| 1683 list->append(cssValuePool().createIdentifierValue(CSSValueRow)); | 1683 list->append(cssValuePool().createIdentifierValue(CSSValueRow)); |
| 1684 break; | 1684 break; |
| 1685 case AutoFlowColumn: | 1685 case AutoFlowColumn: |
| 1686 case AutoFlowColumnDense: | 1686 case AutoFlowColumnDense: |
| 1687 list->append(cssValuePool().createIdentifierValue(CSSValueColumn)); | 1687 list->append(cssValuePool().createIdentifierValue(CSSValueColumn)); |
| 1688 break; | 1688 break; |
| 1689 default: | 1689 default: |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1935 case CSSPropertyPageBreakInside: | 1935 case CSSPropertyPageBreakInside: |
| 1936 return cssValuePool().createValue(mapToPageBreakValue(style.breakInside(
))); | 1936 return cssValuePool().createValue(mapToPageBreakValue(style.breakInside(
))); |
| 1937 case CSSPropertyPosition: | 1937 case CSSPropertyPosition: |
| 1938 return cssValuePool().createValue(style.position()); | 1938 return cssValuePool().createValue(style.position()); |
| 1939 case CSSPropertyQuotes: | 1939 case CSSPropertyQuotes: |
| 1940 if (!style.quotes()) { | 1940 if (!style.quotes()) { |
| 1941 // TODO(ramya.v): We should return the quote values that we're actua
lly using. | 1941 // TODO(ramya.v): We should return the quote values that we're actua
lly using. |
| 1942 return nullptr; | 1942 return nullptr; |
| 1943 } | 1943 } |
| 1944 if (style.quotes()->size()) { | 1944 if (style.quotes()->size()) { |
| 1945 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSep
arated(); | 1945 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 1946 for (int i = 0; i < style.quotes()->size(); i++) { | 1946 for (int i = 0; i < style.quotes()->size(); i++) { |
| 1947 list->append(CSSStringValue::create(style.quotes()->getOpenQuote
(i))); | 1947 list->append(CSSStringValue::create(style.quotes()->getOpenQuote
(i))); |
| 1948 list->append(CSSStringValue::create(style.quotes()->getCloseQuot
e(i))); | 1948 list->append(CSSStringValue::create(style.quotes()->getCloseQuot
e(i))); |
| 1949 } | 1949 } |
| 1950 return list.release(); | 1950 return list.release(); |
| 1951 } | 1951 } |
| 1952 return cssValuePool().createIdentifierValue(CSSValueNone); | 1952 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1953 case CSSPropertyRight: | 1953 case CSSPropertyRight: |
| 1954 return valueForPositionOffset(style, CSSPropertyRight, layoutObject); | 1954 return valueForPositionOffset(style, CSSPropertyRight, layoutObject); |
| 1955 case CSSPropertyWebkitRubyPosition: | 1955 case CSSPropertyWebkitRubyPosition: |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1991 case TextEmphasisMarkCustom: | 1991 case TextEmphasisMarkCustom: |
| 1992 return CSSStringValue::create(style.textEmphasisCustomMark()); | 1992 return CSSStringValue::create(style.textEmphasisCustomMark()); |
| 1993 case TextEmphasisMarkAuto: | 1993 case TextEmphasisMarkAuto: |
| 1994 ASSERT_NOT_REACHED(); | 1994 ASSERT_NOT_REACHED(); |
| 1995 // Fall through | 1995 // Fall through |
| 1996 case TextEmphasisMarkDot: | 1996 case TextEmphasisMarkDot: |
| 1997 case TextEmphasisMarkCircle: | 1997 case TextEmphasisMarkCircle: |
| 1998 case TextEmphasisMarkDoubleCircle: | 1998 case TextEmphasisMarkDoubleCircle: |
| 1999 case TextEmphasisMarkTriangle: | 1999 case TextEmphasisMarkTriangle: |
| 2000 case TextEmphasisMarkSesame: { | 2000 case TextEmphasisMarkSesame: { |
| 2001 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSep
arated(); | 2001 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 2002 list->append(cssValuePool().createValue(style.getTextEmphasisFill())
); | 2002 list->append(cssValuePool().createValue(style.getTextEmphasisFill())
); |
| 2003 list->append(cssValuePool().createValue(style.getTextEmphasisMark())
); | 2003 list->append(cssValuePool().createValue(style.getTextEmphasisMark())
); |
| 2004 return list.release(); | 2004 return list.release(); |
| 2005 } | 2005 } |
| 2006 } | 2006 } |
| 2007 case CSSPropertyTextIndent: { | 2007 case CSSPropertyTextIndent: { |
| 2008 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat
ed(); | 2008 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 2009 list->append(zoomAdjustedPixelValueForLength(style.textIndent(), style))
; | 2009 list->append(zoomAdjustedPixelValueForLength(style.textIndent(), style))
; |
| 2010 if (RuntimeEnabledFeatures::css3TextEnabled() && (style.getTextIndentLin
e() == TextIndentEachLine || style.getTextIndentType() == TextIndentHanging)) { | 2010 if (RuntimeEnabledFeatures::css3TextEnabled() && (style.getTextIndentLin
e() == TextIndentEachLine || style.getTextIndentType() == TextIndentHanging)) { |
| 2011 if (style.getTextIndentLine() == TextIndentEachLine) | 2011 if (style.getTextIndentLine() == TextIndentEachLine) |
| 2012 list->append(cssValuePool().createIdentifierValue(CSSValueEachLi
ne)); | 2012 list->append(cssValuePool().createIdentifierValue(CSSValueEachLi
ne)); |
| 2013 if (style.getTextIndentType() == TextIndentHanging) | 2013 if (style.getTextIndentType() == TextIndentHanging) |
| 2014 list->append(cssValuePool().createIdentifierValue(CSSValueHangin
g)); | 2014 list->append(cssValuePool().createIdentifierValue(CSSValueHangin
g)); |
| 2015 } | 2015 } |
| 2016 return list.release(); | 2016 return list.release(); |
| 2017 } | 2017 } |
| 2018 case CSSPropertyTextShadow: | 2018 case CSSPropertyTextShadow: |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2095 return cssValuePool().createValue(style.getFontDescription().fontSmoothi
ng()); | 2095 return cssValuePool().createValue(style.getFontDescription().fontSmoothi
ng()); |
| 2096 case CSSPropertyFontVariantLigatures: { | 2096 case CSSPropertyFontVariantLigatures: { |
| 2097 FontDescription::LigaturesState commonLigaturesState = style.getFontDesc
ription().commonLigaturesState(); | 2097 FontDescription::LigaturesState commonLigaturesState = style.getFontDesc
ription().commonLigaturesState(); |
| 2098 FontDescription::LigaturesState discretionaryLigaturesState = style.getF
ontDescription().discretionaryLigaturesState(); | 2098 FontDescription::LigaturesState discretionaryLigaturesState = style.getF
ontDescription().discretionaryLigaturesState(); |
| 2099 FontDescription::LigaturesState historicalLigaturesState = style.getFont
Description().historicalLigaturesState(); | 2099 FontDescription::LigaturesState historicalLigaturesState = style.getFont
Description().historicalLigaturesState(); |
| 2100 FontDescription::LigaturesState contextualLigaturesState = style.getFont
Description().contextualLigaturesState(); | 2100 FontDescription::LigaturesState contextualLigaturesState = style.getFont
Description().contextualLigaturesState(); |
| 2101 if (commonLigaturesState == FontDescription::NormalLigaturesState && dis
cretionaryLigaturesState == FontDescription::NormalLigaturesState | 2101 if (commonLigaturesState == FontDescription::NormalLigaturesState && dis
cretionaryLigaturesState == FontDescription::NormalLigaturesState |
| 2102 && historicalLigaturesState == FontDescription::NormalLigaturesState
&& contextualLigaturesState == FontDescription::NormalLigaturesState) | 2102 && historicalLigaturesState == FontDescription::NormalLigaturesState
&& contextualLigaturesState == FontDescription::NormalLigaturesState) |
| 2103 return cssValuePool().createIdentifierValue(CSSValueNormal); | 2103 return cssValuePool().createIdentifierValue(CSSValueNormal); |
| 2104 | 2104 |
| 2105 RefPtrWillBeRawPtr<CSSValueList> valueList = CSSValueList::createSpaceSe
parated(); | 2105 RawPtr<CSSValueList> valueList = CSSValueList::createSpaceSeparated(); |
| 2106 if (commonLigaturesState != FontDescription::NormalLigaturesState) | 2106 if (commonLigaturesState != FontDescription::NormalLigaturesState) |
| 2107 valueList->append(cssValuePool().createIdentifierValue(commonLigatur
esState == FontDescription::DisabledLigaturesState ? CSSValueNoCommonLigatures :
CSSValueCommonLigatures)); | 2107 valueList->append(cssValuePool().createIdentifierValue(commonLigatur
esState == FontDescription::DisabledLigaturesState ? CSSValueNoCommonLigatures :
CSSValueCommonLigatures)); |
| 2108 if (discretionaryLigaturesState != FontDescription::NormalLigaturesState
) | 2108 if (discretionaryLigaturesState != FontDescription::NormalLigaturesState
) |
| 2109 valueList->append(cssValuePool().createIdentifierValue(discretionary
LigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoDiscretion
aryLigatures : CSSValueDiscretionaryLigatures)); | 2109 valueList->append(cssValuePool().createIdentifierValue(discretionary
LigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoDiscretion
aryLigatures : CSSValueDiscretionaryLigatures)); |
| 2110 if (historicalLigaturesState != FontDescription::NormalLigaturesState) | 2110 if (historicalLigaturesState != FontDescription::NormalLigaturesState) |
| 2111 valueList->append(cssValuePool().createIdentifierValue(historicalLig
aturesState == FontDescription::DisabledLigaturesState ? CSSValueNoHistoricalLig
atures : CSSValueHistoricalLigatures)); | 2111 valueList->append(cssValuePool().createIdentifierValue(historicalLig
aturesState == FontDescription::DisabledLigaturesState ? CSSValueNoHistoricalLig
atures : CSSValueHistoricalLigatures)); |
| 2112 if (contextualLigaturesState != FontDescription::NormalLigaturesState) | 2112 if (contextualLigaturesState != FontDescription::NormalLigaturesState) |
| 2113 valueList->append(cssValuePool().createIdentifierValue(contextualLig
aturesState == FontDescription::DisabledLigaturesState ? CSSValueNoContextual :
CSSValueContextual)); | 2113 valueList->append(cssValuePool().createIdentifierValue(contextualLig
aturesState == FontDescription::DisabledLigaturesState ? CSSValueNoContextual :
CSSValueContextual)); |
| 2114 return valueList; | 2114 return valueList; |
| 2115 } | 2115 } |
| 2116 case CSSPropertyZIndex: | 2116 case CSSPropertyZIndex: |
| 2117 if (style.hasAutoZIndex()) | 2117 if (style.hasAutoZIndex()) |
| 2118 return cssValuePool().createIdentifierValue(CSSValueAuto); | 2118 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 2119 return cssValuePool().createValue(style.zIndex(), CSSPrimitiveValue::Uni
tType::Integer); | 2119 return cssValuePool().createValue(style.zIndex(), CSSPrimitiveValue::Uni
tType::Integer); |
| 2120 case CSSPropertyZoom: | 2120 case CSSPropertyZoom: |
| 2121 return cssValuePool().createValue(style.zoom(), CSSPrimitiveValue::UnitT
ype::Number); | 2121 return cssValuePool().createValue(style.zoom(), CSSPrimitiveValue::UnitT
ype::Number); |
| 2122 case CSSPropertyBoxSizing: | 2122 case CSSPropertyBoxSizing: |
| 2123 if (style.boxSizing() == BoxSizingContentBox) | 2123 if (style.boxSizing() == BoxSizingContentBox) |
| 2124 return cssValuePool().createIdentifierValue(CSSValueContentBox); | 2124 return cssValuePool().createIdentifierValue(CSSValueContentBox); |
| 2125 return cssValuePool().createIdentifierValue(CSSValueBorderBox); | 2125 return cssValuePool().createIdentifierValue(CSSValueBorderBox); |
| 2126 case CSSPropertyWebkitAppRegion: | 2126 case CSSPropertyWebkitAppRegion: |
| 2127 return cssValuePool().createIdentifierValue(style.getDraggableRegionMode
() == DraggableRegionDrag ? CSSValueDrag : CSSValueNoDrag); | 2127 return cssValuePool().createIdentifierValue(style.getDraggableRegionMode
() == DraggableRegionDrag ? CSSValueDrag : CSSValueNoDrag); |
| 2128 case CSSPropertyAnimationDelay: | 2128 case CSSPropertyAnimationDelay: |
| 2129 return valueForAnimationDelay(style.animations()); | 2129 return valueForAnimationDelay(style.animations()); |
| 2130 case CSSPropertyAnimationDirection: { | 2130 case CSSPropertyAnimationDirection: { |
| 2131 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); | 2131 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 2132 const CSSAnimationData* animationData = style.animations(); | 2132 const CSSAnimationData* animationData = style.animations(); |
| 2133 if (animationData) { | 2133 if (animationData) { |
| 2134 for (size_t i = 0; i < animationData->directionList().size(); ++i) | 2134 for (size_t i = 0; i < animationData->directionList().size(); ++i) |
| 2135 list->append(valueForAnimationDirection(animationData->direction
List()[i])); | 2135 list->append(valueForAnimationDirection(animationData->direction
List()[i])); |
| 2136 } else { | 2136 } else { |
| 2137 list->append(cssValuePool().createIdentifierValue(CSSValueNormal)); | 2137 list->append(cssValuePool().createIdentifierValue(CSSValueNormal)); |
| 2138 } | 2138 } |
| 2139 return list.release(); | 2139 return list.release(); |
| 2140 } | 2140 } |
| 2141 case CSSPropertyAnimationDuration: | 2141 case CSSPropertyAnimationDuration: |
| 2142 return valueForAnimationDuration(style.animations()); | 2142 return valueForAnimationDuration(style.animations()); |
| 2143 case CSSPropertyAnimationFillMode: { | 2143 case CSSPropertyAnimationFillMode: { |
| 2144 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); | 2144 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 2145 const CSSAnimationData* animationData = style.animations(); | 2145 const CSSAnimationData* animationData = style.animations(); |
| 2146 if (animationData) { | 2146 if (animationData) { |
| 2147 for (size_t i = 0; i < animationData->fillModeList().size(); ++i) | 2147 for (size_t i = 0; i < animationData->fillModeList().size(); ++i) |
| 2148 list->append(valueForAnimationFillMode(animationData->fillModeLi
st()[i])); | 2148 list->append(valueForAnimationFillMode(animationData->fillModeLi
st()[i])); |
| 2149 } else { | 2149 } else { |
| 2150 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); | 2150 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); |
| 2151 } | 2151 } |
| 2152 return list.release(); | 2152 return list.release(); |
| 2153 } | 2153 } |
| 2154 case CSSPropertyAnimationIterationCount: { | 2154 case CSSPropertyAnimationIterationCount: { |
| 2155 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); | 2155 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 2156 const CSSAnimationData* animationData = style.animations(); | 2156 const CSSAnimationData* animationData = style.animations(); |
| 2157 if (animationData) { | 2157 if (animationData) { |
| 2158 for (size_t i = 0; i < animationData->iterationCountList().size(); +
+i) | 2158 for (size_t i = 0; i < animationData->iterationCountList().size(); +
+i) |
| 2159 list->append(valueForAnimationIterationCount(animationData->iter
ationCountList()[i])); | 2159 list->append(valueForAnimationIterationCount(animationData->iter
ationCountList()[i])); |
| 2160 } else { | 2160 } else { |
| 2161 list->append(cssValuePool().createValue(CSSAnimationData::initialIte
rationCount(), CSSPrimitiveValue::UnitType::Number)); | 2161 list->append(cssValuePool().createValue(CSSAnimationData::initialIte
rationCount(), CSSPrimitiveValue::UnitType::Number)); |
| 2162 } | 2162 } |
| 2163 return list.release(); | 2163 return list.release(); |
| 2164 } | 2164 } |
| 2165 case CSSPropertyAnimationName: { | 2165 case CSSPropertyAnimationName: { |
| 2166 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); | 2166 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 2167 const CSSAnimationData* animationData = style.animations(); | 2167 const CSSAnimationData* animationData = style.animations(); |
| 2168 if (animationData) { | 2168 if (animationData) { |
| 2169 for (size_t i = 0; i < animationData->nameList().size(); ++i) | 2169 for (size_t i = 0; i < animationData->nameList().size(); ++i) |
| 2170 list->append(CSSCustomIdentValue::create(animationData->nameList
()[i])); | 2170 list->append(CSSCustomIdentValue::create(animationData->nameList
()[i])); |
| 2171 } else { | 2171 } else { |
| 2172 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); | 2172 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); |
| 2173 } | 2173 } |
| 2174 return list.release(); | 2174 return list.release(); |
| 2175 } | 2175 } |
| 2176 case CSSPropertyAnimationPlayState: { | 2176 case CSSPropertyAnimationPlayState: { |
| 2177 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); | 2177 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 2178 const CSSAnimationData* animationData = style.animations(); | 2178 const CSSAnimationData* animationData = style.animations(); |
| 2179 if (animationData) { | 2179 if (animationData) { |
| 2180 for (size_t i = 0; i < animationData->playStateList().size(); ++i) | 2180 for (size_t i = 0; i < animationData->playStateList().size(); ++i) |
| 2181 list->append(valueForAnimationPlayState(animationData->playState
List()[i])); | 2181 list->append(valueForAnimationPlayState(animationData->playState
List()[i])); |
| 2182 } else { | 2182 } else { |
| 2183 list->append(cssValuePool().createIdentifierValue(CSSValueRunning)); | 2183 list->append(cssValuePool().createIdentifierValue(CSSValueRunning)); |
| 2184 } | 2184 } |
| 2185 return list.release(); | 2185 return list.release(); |
| 2186 } | 2186 } |
| 2187 case CSSPropertyAnimationTimingFunction: | 2187 case CSSPropertyAnimationTimingFunction: |
| 2188 return valueForAnimationTimingFunction(style.animations()); | 2188 return valueForAnimationTimingFunction(style.animations()); |
| 2189 case CSSPropertyAnimation: { | 2189 case CSSPropertyAnimation: { |
| 2190 const CSSAnimationData* animationData = style.animations(); | 2190 const CSSAnimationData* animationData = style.animations(); |
| 2191 if (animationData) { | 2191 if (animationData) { |
| 2192 RefPtrWillBeRawPtr<CSSValueList> animationsList = CSSValueList::crea
teCommaSeparated(); | 2192 RawPtr<CSSValueList> animationsList = CSSValueList::createCommaSepar
ated(); |
| 2193 for (size_t i = 0; i < animationData->nameList().size(); ++i) { | 2193 for (size_t i = 0; i < animationData->nameList().size(); ++i) { |
| 2194 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpac
eSeparated(); | 2194 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
| 2195 list->append(CSSCustomIdentValue::create(animationData->nameList
()[i])); | 2195 list->append(CSSCustomIdentValue::create(animationData->nameList
()[i])); |
| 2196 list->append(cssValuePool().createValue(CSSTimingData::getRepeat
ed(animationData->durationList(), i), CSSPrimitiveValue::UnitType::Seconds)); | 2196 list->append(cssValuePool().createValue(CSSTimingData::getRepeat
ed(animationData->durationList(), i), CSSPrimitiveValue::UnitType::Seconds)); |
| 2197 list->append(createTimingFunctionValue(CSSTimingData::getRepeate
d(animationData->timingFunctionList(), i).get())); | 2197 list->append(createTimingFunctionValue(CSSTimingData::getRepeate
d(animationData->timingFunctionList(), i).get())); |
| 2198 list->append(cssValuePool().createValue(CSSTimingData::getRepeat
ed(animationData->delayList(), i), CSSPrimitiveValue::UnitType::Seconds)); | 2198 list->append(cssValuePool().createValue(CSSTimingData::getRepeat
ed(animationData->delayList(), i), CSSPrimitiveValue::UnitType::Seconds)); |
| 2199 list->append(valueForAnimationIterationCount(CSSTimingData::getR
epeated(animationData->iterationCountList(), i))); | 2199 list->append(valueForAnimationIterationCount(CSSTimingData::getR
epeated(animationData->iterationCountList(), i))); |
| 2200 list->append(valueForAnimationDirection(CSSTimingData::getRepeat
ed(animationData->directionList(), i))); | 2200 list->append(valueForAnimationDirection(CSSTimingData::getRepeat
ed(animationData->directionList(), i))); |
| 2201 list->append(valueForAnimationFillMode(CSSTimingData::getRepeate
d(animationData->fillModeList(), i))); | 2201 list->append(valueForAnimationFillMode(CSSTimingData::getRepeate
d(animationData->fillModeList(), i))); |
| 2202 list->append(valueForAnimationPlayState(CSSTimingData::getRepeat
ed(animationData->playStateList(), i))); | 2202 list->append(valueForAnimationPlayState(CSSTimingData::getRepeat
ed(animationData->playStateList(), i))); |
| 2203 animationsList->append(list); | 2203 animationsList->append(list); |
| 2204 } | 2204 } |
| 2205 return animationsList.release(); | 2205 return animationsList.release(); |
| 2206 } | 2206 } |
| 2207 | 2207 |
| 2208 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat
ed(); | 2208 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 2209 // animation-name default value. | 2209 // animation-name default value. |
| 2210 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); | 2210 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); |
| 2211 list->append(cssValuePool().createValue(CSSAnimationData::initialDuratio
n(), CSSPrimitiveValue::UnitType::Seconds)); | 2211 list->append(cssValuePool().createValue(CSSAnimationData::initialDuratio
n(), CSSPrimitiveValue::UnitType::Seconds)); |
| 2212 list->append(createTimingFunctionValue(CSSAnimationData::initialTimingFu
nction().get())); | 2212 list->append(createTimingFunctionValue(CSSAnimationData::initialTimingFu
nction().get())); |
| 2213 list->append(cssValuePool().createValue(CSSAnimationData::initialDelay()
, CSSPrimitiveValue::UnitType::Seconds)); | 2213 list->append(cssValuePool().createValue(CSSAnimationData::initialDelay()
, CSSPrimitiveValue::UnitType::Seconds)); |
| 2214 list->append(cssValuePool().createValue(CSSAnimationData::initialIterati
onCount(), CSSPrimitiveValue::UnitType::Number)); | 2214 list->append(cssValuePool().createValue(CSSAnimationData::initialIterati
onCount(), CSSPrimitiveValue::UnitType::Number)); |
| 2215 list->append(valueForAnimationDirection(CSSAnimationData::initialDirecti
on())); | 2215 list->append(valueForAnimationDirection(CSSAnimationData::initialDirecti
on())); |
| 2216 list->append(valueForAnimationFillMode(CSSAnimationData::initialFillMode
())); | 2216 list->append(valueForAnimationFillMode(CSSAnimationData::initialFillMode
())); |
| 2217 // Initial animation-play-state. | 2217 // Initial animation-play-state. |
| 2218 list->append(cssValuePool().createIdentifierValue(CSSValueRunning)); | 2218 list->append(cssValuePool().createIdentifierValue(CSSValueRunning)); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2253 case CSSPropertyWebkitMarginAfterCollapse: | 2253 case CSSPropertyWebkitMarginAfterCollapse: |
| 2254 return cssValuePool().createValue(style.marginAfterCollapse()); | 2254 return cssValuePool().createValue(style.marginAfterCollapse()); |
| 2255 case CSSPropertyWebkitMarginTopCollapse: | 2255 case CSSPropertyWebkitMarginTopCollapse: |
| 2256 case CSSPropertyWebkitMarginBeforeCollapse: | 2256 case CSSPropertyWebkitMarginBeforeCollapse: |
| 2257 return cssValuePool().createValue(style.marginBeforeCollapse()); | 2257 return cssValuePool().createValue(style.marginBeforeCollapse()); |
| 2258 case CSSPropertyPerspective: | 2258 case CSSPropertyPerspective: |
| 2259 if (!style.hasPerspective()) | 2259 if (!style.hasPerspective()) |
| 2260 return cssValuePool().createIdentifierValue(CSSValueNone); | 2260 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 2261 return zoomAdjustedPixelValue(style.perspective(), style); | 2261 return zoomAdjustedPixelValue(style.perspective(), style); |
| 2262 case CSSPropertyPerspectiveOrigin: { | 2262 case CSSPropertyPerspectiveOrigin: { |
| 2263 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat
ed(); | 2263 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 2264 if (layoutObject) { | 2264 if (layoutObject) { |
| 2265 LayoutRect box; | 2265 LayoutRect box; |
| 2266 if (layoutObject->isBox()) | 2266 if (layoutObject->isBox()) |
| 2267 box = toLayoutBox(layoutObject)->borderBoxRect(); | 2267 box = toLayoutBox(layoutObject)->borderBoxRect(); |
| 2268 | 2268 |
| 2269 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.pers
pectiveOriginX(), box.width()), style)); | 2269 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.pers
pectiveOriginX(), box.width()), style)); |
| 2270 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.pers
pectiveOriginY(), box.height()), style)); | 2270 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.pers
pectiveOriginY(), box.height()), style)); |
| 2271 } else { | 2271 } else { |
| 2272 list->append(zoomAdjustedPixelValueForLength(style.perspectiveOrigin
X(), style)); | 2272 list->append(zoomAdjustedPixelValueForLength(style.perspectiveOrigin
X(), style)); |
| 2273 list->append(zoomAdjustedPixelValueForLength(style.perspectiveOrigin
Y(), style)); | 2273 list->append(zoomAdjustedPixelValueForLength(style.perspectiveOrigin
Y(), style)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2286 return valueForBorderRadiusCorner(style.borderBottomLeftRadius(), style)
; | 2286 return valueForBorderRadiusCorner(style.borderBottomLeftRadius(), style)
; |
| 2287 case CSSPropertyBorderBottomRightRadius: | 2287 case CSSPropertyBorderBottomRightRadius: |
| 2288 return valueForBorderRadiusCorner(style.borderBottomRightRadius(), style
); | 2288 return valueForBorderRadiusCorner(style.borderBottomRightRadius(), style
); |
| 2289 case CSSPropertyBorderTopLeftRadius: | 2289 case CSSPropertyBorderTopLeftRadius: |
| 2290 return valueForBorderRadiusCorner(style.borderTopLeftRadius(), style); | 2290 return valueForBorderRadiusCorner(style.borderTopLeftRadius(), style); |
| 2291 case CSSPropertyBorderTopRightRadius: | 2291 case CSSPropertyBorderTopRightRadius: |
| 2292 return valueForBorderRadiusCorner(style.borderTopRightRadius(), style); | 2292 return valueForBorderRadiusCorner(style.borderTopRightRadius(), style); |
| 2293 case CSSPropertyClip: { | 2293 case CSSPropertyClip: { |
| 2294 if (style.hasAutoClip()) | 2294 if (style.hasAutoClip()) |
| 2295 return cssValuePool().createIdentifierValue(CSSValueAuto); | 2295 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 2296 RefPtrWillBeRawPtr<CSSPrimitiveValue> top = style.clip().top().isAuto() | 2296 RawPtr<CSSPrimitiveValue> top = style.clip().top().isAuto() |
| 2297 ? cssValuePool().createIdentifierValue(CSSValueAuto) | 2297 ? cssValuePool().createIdentifierValue(CSSValueAuto) |
| 2298 : zoomAdjustedPixelValue(style.clip().top().value(), style); | 2298 : zoomAdjustedPixelValue(style.clip().top().value(), style); |
| 2299 RefPtrWillBeRawPtr<CSSPrimitiveValue> right = style.clip().right().isAut
o() | 2299 RawPtr<CSSPrimitiveValue> right = style.clip().right().isAuto() |
| 2300 ? cssValuePool().createIdentifierValue(CSSValueAuto) | 2300 ? cssValuePool().createIdentifierValue(CSSValueAuto) |
| 2301 : zoomAdjustedPixelValue(style.clip().right().value(), style); | 2301 : zoomAdjustedPixelValue(style.clip().right().value(), style); |
| 2302 RefPtrWillBeRawPtr<CSSPrimitiveValue> bottom = style.clip().bottom().isA
uto() | 2302 RawPtr<CSSPrimitiveValue> bottom = style.clip().bottom().isAuto() |
| 2303 ? cssValuePool().createIdentifierValue(CSSValueAuto) | 2303 ? cssValuePool().createIdentifierValue(CSSValueAuto) |
| 2304 : zoomAdjustedPixelValue(style.clip().bottom().value(), style); | 2304 : zoomAdjustedPixelValue(style.clip().bottom().value(), style); |
| 2305 RefPtrWillBeRawPtr<CSSPrimitiveValue> left = style.clip().left().isAuto(
) | 2305 RawPtr<CSSPrimitiveValue> left = style.clip().left().isAuto() |
| 2306 ? cssValuePool().createIdentifierValue(CSSValueAuto) | 2306 ? cssValuePool().createIdentifierValue(CSSValueAuto) |
| 2307 : zoomAdjustedPixelValue(style.clip().left().value(), style); | 2307 : zoomAdjustedPixelValue(style.clip().left().value(), style); |
| 2308 return CSSQuadValue::create(top.release(), right.release(), bottom.relea
se(), left.release(), CSSQuadValue::SerializeAsRect); | 2308 return CSSQuadValue::create(top.release(), right.release(), bottom.relea
se(), left.release(), CSSQuadValue::SerializeAsRect); |
| 2309 } | 2309 } |
| 2310 case CSSPropertySpeak: | 2310 case CSSPropertySpeak: |
| 2311 return cssValuePool().createValue(style.speak()); | 2311 return cssValuePool().createValue(style.speak()); |
| 2312 case CSSPropertyTransform: | 2312 case CSSPropertyTransform: |
| 2313 return computedTransform(layoutObject, style); | 2313 return computedTransform(layoutObject, style); |
| 2314 case CSSPropertyTransformOrigin: { | 2314 case CSSPropertyTransformOrigin: { |
| 2315 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat
ed(); | 2315 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 2316 if (layoutObject) { | 2316 if (layoutObject) { |
| 2317 LayoutRect box; | 2317 LayoutRect box; |
| 2318 if (layoutObject->isBox()) | 2318 if (layoutObject->isBox()) |
| 2319 box = toLayoutBox(layoutObject)->borderBoxRect(); | 2319 box = toLayoutBox(layoutObject)->borderBoxRect(); |
| 2320 | 2320 |
| 2321 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.tran
sformOriginX(), box.width()), style)); | 2321 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.tran
sformOriginX(), box.width()), style)); |
| 2322 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.tran
sformOriginY(), box.height()), style)); | 2322 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.tran
sformOriginY(), box.height()), style)); |
| 2323 if (style.transformOriginZ() != 0) | 2323 if (style.transformOriginZ() != 0) |
| 2324 list->append(zoomAdjustedPixelValue(style.transformOriginZ(), st
yle)); | 2324 list->append(zoomAdjustedPixelValue(style.transformOriginZ(), st
yle)); |
| 2325 } else { | 2325 } else { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2336 return valueForAnimationDelay(style.transitions()); | 2336 return valueForAnimationDelay(style.transitions()); |
| 2337 case CSSPropertyTransitionDuration: | 2337 case CSSPropertyTransitionDuration: |
| 2338 return valueForAnimationDuration(style.transitions()); | 2338 return valueForAnimationDuration(style.transitions()); |
| 2339 case CSSPropertyTransitionProperty: | 2339 case CSSPropertyTransitionProperty: |
| 2340 return valueForTransitionProperty(style.transitions()); | 2340 return valueForTransitionProperty(style.transitions()); |
| 2341 case CSSPropertyTransitionTimingFunction: | 2341 case CSSPropertyTransitionTimingFunction: |
| 2342 return valueForAnimationTimingFunction(style.transitions()); | 2342 return valueForAnimationTimingFunction(style.transitions()); |
| 2343 case CSSPropertyTransition: { | 2343 case CSSPropertyTransition: { |
| 2344 const CSSTransitionData* transitionData = style.transitions(); | 2344 const CSSTransitionData* transitionData = style.transitions(); |
| 2345 if (transitionData) { | 2345 if (transitionData) { |
| 2346 RefPtrWillBeRawPtr<CSSValueList> transitionsList = CSSValueList::cre
ateCommaSeparated(); | 2346 RawPtr<CSSValueList> transitionsList = CSSValueList::createCommaSepa
rated(); |
| 2347 for (size_t i = 0; i < transitionData->propertyList().size(); ++i) { | 2347 for (size_t i = 0; i < transitionData->propertyList().size(); ++i) { |
| 2348 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpac
eSeparated(); | 2348 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
| 2349 list->append(createTransitionPropertyValue(transitionData->prope
rtyList()[i])); | 2349 list->append(createTransitionPropertyValue(transitionData->prope
rtyList()[i])); |
| 2350 list->append(cssValuePool().createValue(CSSTimingData::getRepeat
ed(transitionData->durationList(), i), CSSPrimitiveValue::UnitType::Seconds)); | 2350 list->append(cssValuePool().createValue(CSSTimingData::getRepeat
ed(transitionData->durationList(), i), CSSPrimitiveValue::UnitType::Seconds)); |
| 2351 list->append(createTimingFunctionValue(CSSTimingData::getRepeate
d(transitionData->timingFunctionList(), i).get())); | 2351 list->append(createTimingFunctionValue(CSSTimingData::getRepeate
d(transitionData->timingFunctionList(), i).get())); |
| 2352 list->append(cssValuePool().createValue(CSSTimingData::getRepeat
ed(transitionData->delayList(), i), CSSPrimitiveValue::UnitType::Seconds)); | 2352 list->append(cssValuePool().createValue(CSSTimingData::getRepeat
ed(transitionData->delayList(), i), CSSPrimitiveValue::UnitType::Seconds)); |
| 2353 transitionsList->append(list); | 2353 transitionsList->append(list); |
| 2354 } | 2354 } |
| 2355 return transitionsList.release(); | 2355 return transitionsList.release(); |
| 2356 } | 2356 } |
| 2357 | 2357 |
| 2358 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat
ed(); | 2358 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 2359 // transition-property default value. | 2359 // transition-property default value. |
| 2360 list->append(cssValuePool().createIdentifierValue(CSSValueAll)); | 2360 list->append(cssValuePool().createIdentifierValue(CSSValueAll)); |
| 2361 list->append(cssValuePool().createValue(CSSTransitionData::initialDurati
on(), CSSPrimitiveValue::UnitType::Seconds)); | 2361 list->append(cssValuePool().createValue(CSSTransitionData::initialDurati
on(), CSSPrimitiveValue::UnitType::Seconds)); |
| 2362 list->append(createTimingFunctionValue(CSSTransitionData::initialTimingF
unction().get())); | 2362 list->append(createTimingFunctionValue(CSSTransitionData::initialTimingF
unction().get())); |
| 2363 list->append(cssValuePool().createValue(CSSTransitionData::initialDelay(
), CSSPrimitiveValue::UnitType::Seconds)); | 2363 list->append(cssValuePool().createValue(CSSTransitionData::initialDelay(
), CSSPrimitiveValue::UnitType::Seconds)); |
| 2364 return list.release(); | 2364 return list.release(); |
| 2365 } | 2365 } |
| 2366 case CSSPropertyPointerEvents: | 2366 case CSSPropertyPointerEvents: |
| 2367 return cssValuePool().createValue(style.pointerEvents()); | 2367 return cssValuePool().createValue(style.pointerEvents()); |
| 2368 case CSSPropertyWritingMode: | 2368 case CSSPropertyWritingMode: |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2399 case CSSPropertyShapeOutside: | 2399 case CSSPropertyShapeOutside: |
| 2400 return valueForShape(style, style.shapeOutside()); | 2400 return valueForShape(style, style.shapeOutside()); |
| 2401 case CSSPropertyWebkitFilter: | 2401 case CSSPropertyWebkitFilter: |
| 2402 return valueForFilter(style, style.filter()); | 2402 return valueForFilter(style, style.filter()); |
| 2403 case CSSPropertyBackdropFilter: | 2403 case CSSPropertyBackdropFilter: |
| 2404 return valueForFilter(style, style.backdropFilter()); | 2404 return valueForFilter(style, style.backdropFilter()); |
| 2405 case CSSPropertyMixBlendMode: | 2405 case CSSPropertyMixBlendMode: |
| 2406 return cssValuePool().createValue(style.blendMode()); | 2406 return cssValuePool().createValue(style.blendMode()); |
| 2407 | 2407 |
| 2408 case CSSPropertyBackgroundBlendMode: { | 2408 case CSSPropertyBackgroundBlendMode: { |
| 2409 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparat
ed(); | 2409 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 2410 for (const FillLayer* currLayer = &style.backgroundLayers(); currLayer;
currLayer = currLayer->next()) | 2410 for (const FillLayer* currLayer = &style.backgroundLayers(); currLayer;
currLayer = currLayer->next()) |
| 2411 list->append(cssValuePool().createValue(currLayer->blendMode())); | 2411 list->append(cssValuePool().createValue(currLayer->blendMode())); |
| 2412 return list.release(); | 2412 return list.release(); |
| 2413 } | 2413 } |
| 2414 case CSSPropertyBackground: | 2414 case CSSPropertyBackground: |
| 2415 return valuesForBackgroundShorthand(style, layoutObject, styledNode, all
owVisitedStyle); | 2415 return valuesForBackgroundShorthand(style, layoutObject, styledNode, all
owVisitedStyle); |
| 2416 case CSSPropertyBorder: { | 2416 case CSSPropertyBorder: { |
| 2417 RefPtrWillBeRawPtr<CSSValue> value = get(CSSPropertyBorderTop, style, la
youtObject, styledNode, allowVisitedStyle); | 2417 RawPtr<CSSValue> value = get(CSSPropertyBorderTop, style, layoutObject,
styledNode, allowVisitedStyle); |
| 2418 const CSSPropertyID properties[] = { | 2418 const CSSPropertyID properties[] = { |
| 2419 CSSPropertyBorderRight, | 2419 CSSPropertyBorderRight, |
| 2420 CSSPropertyBorderBottom, | 2420 CSSPropertyBorderBottom, |
| 2421 CSSPropertyBorderLeft | 2421 CSSPropertyBorderLeft |
| 2422 }; | 2422 }; |
| 2423 for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) { | 2423 for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) { |
| 2424 if (!compareCSSValuePtr<CSSValue>(value, get(properties[i], style, l
ayoutObject, styledNode, allowVisitedStyle))) | 2424 if (!compareCSSValuePtr<CSSValue>(value, get(properties[i], style, l
ayoutObject, styledNode, allowVisitedStyle))) |
| 2425 return nullptr; | 2425 return nullptr; |
| 2426 } | 2426 } |
| 2427 return value.release(); | 2427 return value.release(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2466 | 2466 |
| 2467 case CSSPropertyMotionPath: | 2467 case CSSPropertyMotionPath: |
| 2468 if (const StylePath* styleMotionPath = style.motionPath()) | 2468 if (const StylePath* styleMotionPath = style.motionPath()) |
| 2469 return styleMotionPath->computedCSSValue(); | 2469 return styleMotionPath->computedCSSValue(); |
| 2470 return cssValuePool().createIdentifierValue(CSSValueNone); | 2470 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 2471 | 2471 |
| 2472 case CSSPropertyMotionOffset: | 2472 case CSSPropertyMotionOffset: |
| 2473 return zoomAdjustedPixelValueForLength(style.motionOffset(), style); | 2473 return zoomAdjustedPixelValueForLength(style.motionOffset(), style); |
| 2474 | 2474 |
| 2475 case CSSPropertyMotionRotation: { | 2475 case CSSPropertyMotionRotation: { |
| 2476 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat
ed(); | 2476 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 2477 if (style.motionRotation().type == MotionRotationAuto) | 2477 if (style.motionRotation().type == MotionRotationAuto) |
| 2478 list->append(cssValuePool().createIdentifierValue(CSSValueAuto)); | 2478 list->append(cssValuePool().createIdentifierValue(CSSValueAuto)); |
| 2479 list->append(cssValuePool().createValue(style.motionRotation().angle, CS
SPrimitiveValue::UnitType::Degrees)); | 2479 list->append(cssValuePool().createValue(style.motionRotation().angle, CS
SPrimitiveValue::UnitType::Degrees)); |
| 2480 return list.release(); | 2480 return list.release(); |
| 2481 } | 2481 } |
| 2482 | 2482 |
| 2483 // Unimplemented CSS 3 properties (including CSS3 shorthand properties). | 2483 // Unimplemented CSS 3 properties (including CSS3 shorthand properties). |
| 2484 case CSSPropertyWebkitTextEmphasis: | 2484 case CSSPropertyWebkitTextEmphasis: |
| 2485 return nullptr; | 2485 return nullptr; |
| 2486 | 2486 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2669 case CSSPropertyScrollSnapPointsY: | 2669 case CSSPropertyScrollSnapPointsY: |
| 2670 return valueForScrollSnapPoints(style.scrollSnapPointsY(), style); | 2670 return valueForScrollSnapPoints(style.scrollSnapPointsY(), style); |
| 2671 case CSSPropertyScrollSnapCoordinate: | 2671 case CSSPropertyScrollSnapCoordinate: |
| 2672 return valueForScrollSnapCoordinate(style.scrollSnapCoordinate(), style)
; | 2672 return valueForScrollSnapCoordinate(style.scrollSnapCoordinate(), style)
; |
| 2673 case CSSPropertyScrollSnapDestination: | 2673 case CSSPropertyScrollSnapDestination: |
| 2674 return valueForScrollSnapDestination(style.scrollSnapDestination(), styl
e); | 2674 return valueForScrollSnapDestination(style.scrollSnapDestination(), styl
e); |
| 2675 case CSSPropertyTranslate: { | 2675 case CSSPropertyTranslate: { |
| 2676 if (!style.translate()) | 2676 if (!style.translate()) |
| 2677 return cssValuePool().createValue(0, CSSPrimitiveValue::UnitType::Pi
xels); | 2677 return cssValuePool().createValue(0, CSSPrimitiveValue::UnitType::Pi
xels); |
| 2678 | 2678 |
| 2679 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat
ed(); | 2679 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 2680 if (layoutObject && layoutObject->isBox()) { | 2680 if (layoutObject && layoutObject->isBox()) { |
| 2681 LayoutRect box = toLayoutBox(layoutObject)->borderBoxRect(); | 2681 LayoutRect box = toLayoutBox(layoutObject)->borderBoxRect(); |
| 2682 list->append(zoomAdjustedPixelValue(floatValueForLength(style.transl
ate()->x(), box.width().toFloat()), style)); | 2682 list->append(zoomAdjustedPixelValue(floatValueForLength(style.transl
ate()->x(), box.width().toFloat()), style)); |
| 2683 | 2683 |
| 2684 if (!style.translate()->y().isZero() || style.translate()->z() != 0) | 2684 if (!style.translate()->y().isZero() || style.translate()->z() != 0) |
| 2685 list->append(zoomAdjustedPixelValue(floatValueForLength(style.tr
anslate()->y(), box.height().toFloat()), style)); | 2685 list->append(zoomAdjustedPixelValue(floatValueForLength(style.tr
anslate()->y(), box.height().toFloat()), style)); |
| 2686 | 2686 |
| 2687 } else { | 2687 } else { |
| 2688 // No box to resolve the percentage values | 2688 // No box to resolve the percentage values |
| 2689 list->append(zoomAdjustedPixelValueForLength(style.translate()->x(),
style)); | 2689 list->append(zoomAdjustedPixelValueForLength(style.translate()->x(),
style)); |
| 2690 | 2690 |
| 2691 if (!style.translate()->y().isZero() || style.translate()->z() != 0) | 2691 if (!style.translate()->y().isZero() || style.translate()->z() != 0) |
| 2692 list->append(zoomAdjustedPixelValueForLength(style.translate()->
y(), style)); | 2692 list->append(zoomAdjustedPixelValueForLength(style.translate()->
y(), style)); |
| 2693 } | 2693 } |
| 2694 | 2694 |
| 2695 if (style.translate()->z() != 0) | 2695 if (style.translate()->z() != 0) |
| 2696 list->append(zoomAdjustedPixelValue(style.translate()->z(), style)); | 2696 list->append(zoomAdjustedPixelValue(style.translate()->z(), style)); |
| 2697 | 2697 |
| 2698 return list.release(); | 2698 return list.release(); |
| 2699 } | 2699 } |
| 2700 case CSSPropertyRotate: { | 2700 case CSSPropertyRotate: { |
| 2701 if (!style.rotate()) | 2701 if (!style.rotate()) |
| 2702 return cssValuePool().createValue(0, CSSPrimitiveValue::UnitType::De
grees); | 2702 return cssValuePool().createValue(0, CSSPrimitiveValue::UnitType::De
grees); |
| 2703 | 2703 |
| 2704 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat
ed(); | 2704 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 2705 list->append(cssValuePool().createValue(style.rotate()->angle(), CSSPrim
itiveValue::UnitType::Degrees)); | 2705 list->append(cssValuePool().createValue(style.rotate()->angle(), CSSPrim
itiveValue::UnitType::Degrees)); |
| 2706 if (style.rotate()->x() != 0 || style.rotate()->y() != 0 || style.rotate
()->z() != 1) { | 2706 if (style.rotate()->x() != 0 || style.rotate()->y() != 0 || style.rotate
()->z() != 1) { |
| 2707 list->append(cssValuePool().createValue(style.rotate()->x(), CSSPrim
itiveValue::UnitType::Number)); | 2707 list->append(cssValuePool().createValue(style.rotate()->x(), CSSPrim
itiveValue::UnitType::Number)); |
| 2708 list->append(cssValuePool().createValue(style.rotate()->y(), CSSPrim
itiveValue::UnitType::Number)); | 2708 list->append(cssValuePool().createValue(style.rotate()->y(), CSSPrim
itiveValue::UnitType::Number)); |
| 2709 list->append(cssValuePool().createValue(style.rotate()->z(), CSSPrim
itiveValue::UnitType::Number)); | 2709 list->append(cssValuePool().createValue(style.rotate()->z(), CSSPrim
itiveValue::UnitType::Number)); |
| 2710 } | 2710 } |
| 2711 return list.release(); | 2711 return list.release(); |
| 2712 } | 2712 } |
| 2713 case CSSPropertyScale: { | 2713 case CSSPropertyScale: { |
| 2714 if (!style.scale()) | 2714 if (!style.scale()) |
| 2715 return cssValuePool().createValue(1, CSSPrimitiveValue::UnitType::Nu
mber); | 2715 return cssValuePool().createValue(1, CSSPrimitiveValue::UnitType::Nu
mber); |
| 2716 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat
ed(); | 2716 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 2717 list->append(cssValuePool().createValue(style.scale()->x(), CSSPrimitive
Value::UnitType::Number)); | 2717 list->append(cssValuePool().createValue(style.scale()->x(), CSSPrimitive
Value::UnitType::Number)); |
| 2718 if (style.scale()->y() == 1 && style.scale()->z() == 1) | 2718 if (style.scale()->y() == 1 && style.scale()->z() == 1) |
| 2719 return list.release(); | 2719 return list.release(); |
| 2720 list->append(cssValuePool().createValue(style.scale()->y(), CSSPrimitive
Value::UnitType::Number)); | 2720 list->append(cssValuePool().createValue(style.scale()->y(), CSSPrimitive
Value::UnitType::Number)); |
| 2721 if (style.scale()->z() != 1) | 2721 if (style.scale()->z() != 1) |
| 2722 list->append(cssValuePool().createValue(style.scale()->z(), CSSPrimi
tiveValue::UnitType::Number)); | 2722 list->append(cssValuePool().createValue(style.scale()->z(), CSSPrimi
tiveValue::UnitType::Number)); |
| 2723 return list.release(); | 2723 return list.release(); |
| 2724 } | 2724 } |
| 2725 case CSSPropertyContain: { | 2725 case CSSPropertyContain: { |
| 2726 if (!style.contain()) | 2726 if (!style.contain()) |
| 2727 return cssValuePool().createIdentifierValue(CSSValueNone); | 2727 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 2728 if (style.contain() == ContainsStrict) | 2728 if (style.contain() == ContainsStrict) |
| 2729 return cssValuePool().createIdentifierValue(CSSValueStrict); | 2729 return cssValuePool().createIdentifierValue(CSSValueStrict); |
| 2730 | 2730 |
| 2731 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat
ed(); | 2731 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 2732 if (style.containsStyle()) | 2732 if (style.containsStyle()) |
| 2733 list->append(cssValuePool().createIdentifierValue(CSSValueStyle)); | 2733 list->append(cssValuePool().createIdentifierValue(CSSValueStyle)); |
| 2734 if (style.contain() & ContainsLayout) | 2734 if (style.contain() & ContainsLayout) |
| 2735 list->append(cssValuePool().createIdentifierValue(CSSValueLayout)); | 2735 list->append(cssValuePool().createIdentifierValue(CSSValueLayout)); |
| 2736 if (style.containsPaint()) | 2736 if (style.containsPaint()) |
| 2737 list->append(cssValuePool().createIdentifierValue(CSSValuePaint)); | 2737 list->append(cssValuePool().createIdentifierValue(CSSValuePaint)); |
| 2738 ASSERT(list->length()); | 2738 ASSERT(list->length()); |
| 2739 return list.release(); | 2739 return list.release(); |
| 2740 } | 2740 } |
| 2741 case CSSPropertySnapHeight: { | 2741 case CSSPropertySnapHeight: { |
| 2742 if (!style.snapHeightUnit()) | 2742 if (!style.snapHeightUnit()) |
| 2743 return cssValuePool().createValue(0, CSSPrimitiveValue::UnitType::Pi
xels); | 2743 return cssValuePool().createValue(0, CSSPrimitiveValue::UnitType::Pi
xels); |
| 2744 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat
ed(); | 2744 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 2745 list->append(cssValuePool().createValue(style.snapHeightUnit(), CSSPrimi
tiveValue::UnitType::Pixels)); | 2745 list->append(cssValuePool().createValue(style.snapHeightUnit(), CSSPrimi
tiveValue::UnitType::Pixels)); |
| 2746 if (style.snapHeightPosition()) | 2746 if (style.snapHeightPosition()) |
| 2747 list->append(cssValuePool().createValue(style.snapHeightPosition(),
CSSPrimitiveValue::UnitType::Integer)); | 2747 list->append(cssValuePool().createValue(style.snapHeightPosition(),
CSSPrimitiveValue::UnitType::Integer)); |
| 2748 return list.release(); | 2748 return list.release(); |
| 2749 } | 2749 } |
| 2750 case CSSPropertyVariable: | 2750 case CSSPropertyVariable: |
| 2751 // Variables are retrieved via get(AtomicString). | 2751 // Variables are retrieved via get(AtomicString). |
| 2752 ASSERT_NOT_REACHED(); | 2752 ASSERT_NOT_REACHED(); |
| 2753 return nullptr; | 2753 return nullptr; |
| 2754 case CSSPropertyAll: | 2754 case CSSPropertyAll: |
| 2755 return nullptr; | 2755 return nullptr; |
| 2756 default: | 2756 default: |
| 2757 break; | 2757 break; |
| 2758 } | 2758 } |
| 2759 ASSERT_NOT_REACHED(); | 2759 ASSERT_NOT_REACHED(); |
| 2760 return nullptr; | 2760 return nullptr; |
| 2761 } | 2761 } |
| 2762 | 2762 |
| 2763 } // namespace blink | 2763 } // namespace blink |
| OLD | NEW |