| 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 RawPtr<CSSPrimitiveValue> zoomAdjustedPixelValue(double value, con
st ComputedStyle& style) | 68 inline static CSSPrimitiveValue* zoomAdjustedPixelValue(double value, const Comp
utedStyle& 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 RawPtr<CSSPrimitiveValue> zoomAdjustedNumberValue(double value, co
nst ComputedStyle& style) | 73 inline static CSSPrimitiveValue* zoomAdjustedNumberValue(double value, const Com
putedStyle& 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 RawPtr<CSSPrimitiveValue> zoomAdjustedPixelValueForLength(const Length& l
ength, const ComputedStyle& style) | 78 static CSSPrimitiveValue* zoomAdjustedPixelValueForLength(const Length& length,
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 RawPtr<CSSPrimitiveValue> pixelValueForUnzoomedLength(const UnzoomedLengt
h& unzoomedLength, const ComputedStyle& style) | 85 static CSSPrimitiveValue* pixelValueForUnzoomedLength(const UnzoomedLength& unzo
omedLength, 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 RawPtr<CSSValueList> createPositionListForLayer(CSSPropertyID propertyID,
const FillLayer& layer, const ComputedStyle& style) | 93 static CSSValueList* createPositionListForLayer(CSSPropertyID propertyID, const
FillLayer& layer, const ComputedStyle& style) |
| 94 { | 94 { |
| 95 RawPtr<CSSValueList> positionList = CSSValueList::createSpaceSeparated(); | 95 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; |
| 107 } | 107 } |
| 108 | 108 |
| 109 RawPtr<CSSValue> ComputedStyleCSSValueMapping::currentColorOrValidColor(const Co
mputedStyle& style, const StyleColor& color) | 109 CSSValue* ComputedStyleCSSValueMapping::currentColorOrValidColor(const ComputedS
tyle& 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 RawPtr<CSSValue> valueForFillSize(const FillSize& fillSize, const Compute
dStyle& style) | 115 static CSSValue* valueForFillSize(const FillSize& fillSize, const ComputedStyle&
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 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 126 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; |
| 130 } | 130 } |
| 131 | 131 |
| 132 static RawPtr<CSSValue> valueForFillRepeat(EFillRepeat xRepeat, EFillRepeat yRep
eat) | 132 static CSSValue* valueForFillRepeat(EFillRepeat xRepeat, EFillRepeat yRepeat) |
| 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 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 143 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; |
| 147 } | 147 } |
| 148 | 148 |
| 149 static RawPtr<CSSValue> valueForFillSourceType(EMaskSourceType type) | 149 static 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 RawPtr<CSSValue> valueForPositionOffset(const ComputedStyle& style, CSSPr
opertyID propertyID, const LayoutObject* layoutObject) | 163 static CSSValue* valueForPositionOffset(const ComputedStyle& style, CSSPropertyI
D propertyID, const LayoutObject* layoutObject) |
| 164 { | 164 { |
| 165 Length offset, opposite; | 165 Length offset, opposite; |
| 166 switch (propertyID) { | 166 switch (propertyID) { |
| 167 case CSSPropertyLeft: | 167 case CSSPropertyLeft: |
| 168 offset = style.left(); | 168 offset = style.left(); |
| 169 opposite = style.right(); | 169 opposite = style.right(); |
| 170 break; | 170 break; |
| 171 case CSSPropertyRight: | 171 case CSSPropertyRight: |
| 172 offset = style.right(); | 172 offset = style.right(); |
| 173 opposite = style.left(); | 173 opposite = style.left(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 return zoomAdjustedPixelValue(position, style); | 243 return zoomAdjustedPixelValue(position, style); |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 | 246 |
| 247 if (offset.isAuto()) | 247 if (offset.isAuto()) |
| 248 return cssValuePool().createIdentifierValue(CSSValueAuto); | 248 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 249 | 249 |
| 250 return zoomAdjustedPixelValueForLength(offset, style); | 250 return zoomAdjustedPixelValueForLength(offset, style); |
| 251 } | 251 } |
| 252 | 252 |
| 253 static RawPtr<CSSBorderImageSliceValue> valueForNinePieceImageSlice(const NinePi
eceImage& image) | 253 static CSSBorderImageSliceValue* valueForNinePieceImageSlice(const NinePieceImag
e& image) |
| 254 { | 254 { |
| 255 // Create the slices. | 255 // Create the slices. |
| 256 RawPtr<CSSPrimitiveValue> top = nullptr; | 256 CSSPrimitiveValue* top = nullptr; |
| 257 RawPtr<CSSPrimitiveValue> right = nullptr; | 257 CSSPrimitiveValue* right = nullptr; |
| 258 RawPtr<CSSPrimitiveValue> bottom = nullptr; | 258 CSSPrimitiveValue* bottom = nullptr; |
| 259 RawPtr<CSSPrimitiveValue> left = nullptr; | 259 CSSPrimitiveValue* left = nullptr; |
| 260 | 260 |
| 261 // TODO(alancutter): Make this code aware of calc lengths. | 261 // TODO(alancutter): Make this code aware of calc lengths. |
| 262 if (image.imageSlices().top().hasPercent()) | 262 if (image.imageSlices().top().hasPercent()) |
| 263 top = cssValuePool().createValue(image.imageSlices().top().value(), CSSP
rimitiveValue::UnitType::Percentage); | 263 top = cssValuePool().createValue(image.imageSlices().top().value(), CSSP
rimitiveValue::UnitType::Percentage); |
| 264 else | 264 else |
| 265 top = cssValuePool().createValue(image.imageSlices().top().value(), CSSP
rimitiveValue::UnitType::Number); | 265 top = cssValuePool().createValue(image.imageSlices().top().value(), CSSP
rimitiveValue::UnitType::Number); |
| 266 | 266 |
| 267 if (image.imageSlices().right() == image.imageSlices().top() && image.imageS
lices().bottom() == image.imageSlices().top() | 267 if (image.imageSlices().right() == image.imageSlices().top() && image.imageS
lices().bottom() == image.imageSlices().top() |
| 268 && image.imageSlices().left() == image.imageSlices().top()) { | 268 && image.imageSlices().left() == image.imageSlices().top()) { |
| 269 right = top; | 269 right = top; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 288 left = right; | 288 left = right; |
| 289 } else { | 289 } else { |
| 290 if (image.imageSlices().left().hasPercent()) | 290 if (image.imageSlices().left().hasPercent()) |
| 291 left = cssValuePool().createValue(image.imageSlices().left()
.value(), CSSPrimitiveValue::UnitType::Percentage); | 291 left = cssValuePool().createValue(image.imageSlices().left()
.value(), CSSPrimitiveValue::UnitType::Percentage); |
| 292 else | 292 else |
| 293 left = cssValuePool().createValue(image.imageSlices().left()
.value(), CSSPrimitiveValue::UnitType::Number); | 293 left = cssValuePool().createValue(image.imageSlices().left()
.value(), CSSPrimitiveValue::UnitType::Number); |
| 294 } | 294 } |
| 295 } | 295 } |
| 296 } | 296 } |
| 297 | 297 |
| 298 return CSSBorderImageSliceValue::create(CSSQuadValue::create(top.release(),
right.release(), bottom.release(), left.release(), CSSQuadValue::SerializeAsQuad
), image.fill()); | 298 return CSSBorderImageSliceValue::create(CSSQuadValue::create(top, right, bot
tom, left, CSSQuadValue::SerializeAsQuad), image.fill()); |
| 299 } | 299 } |
| 300 | 300 |
| 301 static RawPtr<CSSQuadValue> valueForNinePieceImageQuad(const BorderImageLengthBo
x& box, const ComputedStyle& style) | 301 static CSSQuadValue* valueForNinePieceImageQuad(const BorderImageLengthBox& box,
const ComputedStyle& style) |
| 302 { | 302 { |
| 303 // Create the slices. | 303 // Create the slices. |
| 304 RawPtr<CSSPrimitiveValue> top = nullptr; | 304 CSSPrimitiveValue* top = nullptr; |
| 305 RawPtr<CSSPrimitiveValue> right = nullptr; | 305 CSSPrimitiveValue* right = nullptr; |
| 306 RawPtr<CSSPrimitiveValue> bottom = nullptr; | 306 CSSPrimitiveValue* bottom = nullptr; |
| 307 RawPtr<CSSPrimitiveValue> left = nullptr; | 307 CSSPrimitiveValue* left = nullptr; |
| 308 | 308 |
| 309 if (box.top().isNumber()) | 309 if (box.top().isNumber()) |
| 310 top = cssValuePool().createValue(box.top().number(), CSSPrimitiveValue::
UnitType::Number); | 310 top = cssValuePool().createValue(box.top().number(), CSSPrimitiveValue::
UnitType::Number); |
| 311 else | 311 else |
| 312 top = cssValuePool().createValue(box.top().length(), style); | 312 top = cssValuePool().createValue(box.top().length(), style); |
| 313 | 313 |
| 314 if (box.right() == box.top() && box.bottom() == box.top() && box.left() == b
ox.top()) { | 314 if (box.right() == box.top() && box.bottom() == box.top() && box.left() == b
ox.top()) { |
| 315 right = top; | 315 right = top; |
| 316 bottom = top; | 316 bottom = top; |
| 317 left = top; | 317 left = top; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 334 left = right; | 334 left = right; |
| 335 } else { | 335 } else { |
| 336 if (box.left().isNumber()) | 336 if (box.left().isNumber()) |
| 337 left = cssValuePool().createValue(box.left().number(), CSSPr
imitiveValue::UnitType::Number); | 337 left = cssValuePool().createValue(box.left().number(), CSSPr
imitiveValue::UnitType::Number); |
| 338 else | 338 else |
| 339 left = cssValuePool().createValue(box.left().length(), style
); | 339 left = cssValuePool().createValue(box.left().length(), style
); |
| 340 } | 340 } |
| 341 } | 341 } |
| 342 } | 342 } |
| 343 | 343 |
| 344 return CSSQuadValue::create(top.release(), right.release(), bottom.release()
, left.release(), CSSQuadValue::SerializeAsQuad); | 344 return CSSQuadValue::create(top, right, bottom, left, CSSQuadValue::Serializ
eAsQuad); |
| 345 } | 345 } |
| 346 | 346 |
| 347 static CSSValueID valueForRepeatRule(int rule) | 347 static CSSValueID valueForRepeatRule(int rule) |
| 348 { | 348 { |
| 349 switch (rule) { | 349 switch (rule) { |
| 350 case RepeatImageRule: | 350 case RepeatImageRule: |
| 351 return CSSValueRepeat; | 351 return CSSValueRepeat; |
| 352 case RoundImageRule: | 352 case RoundImageRule: |
| 353 return CSSValueRound; | 353 return CSSValueRound; |
| 354 case SpaceImageRule: | 354 case SpaceImageRule: |
| 355 return CSSValueSpace; | 355 return CSSValueSpace; |
| 356 default: | 356 default: |
| 357 return CSSValueStretch; | 357 return CSSValueStretch; |
| 358 } | 358 } |
| 359 } | 359 } |
| 360 | 360 |
| 361 static RawPtr<CSSValue> valueForNinePieceImageRepeat(const NinePieceImage& image
) | 361 static CSSValue* valueForNinePieceImageRepeat(const NinePieceImage& image) |
| 362 { | 362 { |
| 363 RawPtr<CSSPrimitiveValue> horizontalRepeat = nullptr; | 363 CSSPrimitiveValue* horizontalRepeat = nullptr; |
| 364 RawPtr<CSSPrimitiveValue> verticalRepeat = nullptr; | 364 CSSPrimitiveValue* verticalRepeat = nullptr; |
| 365 | 365 |
| 366 horizontalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(i
mage.horizontalRule())); | 366 horizontalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(i
mage.horizontalRule())); |
| 367 if (image.horizontalRule() == image.verticalRule()) | 367 if (image.horizontalRule() == image.verticalRule()) |
| 368 verticalRepeat = horizontalRepeat; | 368 verticalRepeat = horizontalRepeat; |
| 369 else | 369 else |
| 370 verticalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule
(image.verticalRule())); | 370 verticalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule
(image.verticalRule())); |
| 371 return CSSValuePair::create(horizontalRepeat.release(), verticalRepeat.relea
se(), CSSValuePair::DropIdenticalValues); | 371 return CSSValuePair::create(horizontalRepeat, verticalRepeat, CSSValuePair::
DropIdenticalValues); |
| 372 } | 372 } |
| 373 | 373 |
| 374 static RawPtr<CSSValue> valueForNinePieceImage(const NinePieceImage& image, cons
t ComputedStyle& style) | 374 static CSSValue* valueForNinePieceImage(const NinePieceImage& image, const Compu
tedStyle& style) |
| 375 { | 375 { |
| 376 if (!image.hasImage()) | 376 if (!image.hasImage()) |
| 377 return cssValuePool().createIdentifierValue(CSSValueNone); | 377 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 378 | 378 |
| 379 // Image first. | 379 // Image first. |
| 380 RawPtr<CSSValue> imageValue = nullptr; | 380 CSSValue* imageValue = nullptr; |
| 381 if (image.image()) | 381 if (image.image()) |
| 382 imageValue = image.image()->computedCSSValue(); | 382 imageValue = image.image()->computedCSSValue(); |
| 383 | 383 |
| 384 // Create the image slice. | 384 // Create the image slice. |
| 385 RawPtr<CSSBorderImageSliceValue> imageSlices = valueForNinePieceImageSlice(i
mage); | 385 CSSBorderImageSliceValue* imageSlices = valueForNinePieceImageSlice(image); |
| 386 | 386 |
| 387 // Create the border area slices. | 387 // Create the border area slices. |
| 388 RawPtr<CSSValue> borderSlices = valueForNinePieceImageQuad(image.borderSlice
s(), style); | 388 CSSValue* borderSlices = valueForNinePieceImageQuad(image.borderSlices(), st
yle); |
| 389 | 389 |
| 390 // Create the border outset. | 390 // Create the border outset. |
| 391 RawPtr<CSSValue> outset = valueForNinePieceImageQuad(image.outset(), style); | 391 CSSValue* outset = valueForNinePieceImageQuad(image.outset(), style); |
| 392 | 392 |
| 393 // Create the repeat rules. | 393 // Create the repeat rules. |
| 394 RawPtr<CSSValue> repeat = valueForNinePieceImageRepeat(image); | 394 CSSValue* repeat = valueForNinePieceImageRepeat(image); |
| 395 | 395 |
| 396 return createBorderImageValue(imageValue.release(), imageSlices.release(), b
orderSlices.release(), outset.release(), repeat.release()); | 396 return createBorderImageValue(imageValue, imageSlices, borderSlices, outset,
repeat); |
| 397 } | 397 } |
| 398 | 398 |
| 399 static RawPtr<CSSValue> valueForReflection(const StyleReflection* reflection, co
nst ComputedStyle& style) | 399 static CSSValue* valueForReflection(const StyleReflection* reflection, const Com
putedStyle& style) |
| 400 { | 400 { |
| 401 if (!reflection) | 401 if (!reflection) |
| 402 return cssValuePool().createIdentifierValue(CSSValueNone); | 402 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 403 | 403 |
| 404 RawPtr<CSSPrimitiveValue> offset = nullptr; | 404 CSSPrimitiveValue* offset = nullptr; |
| 405 // TODO(alancutter): Make this work correctly for calc lengths. | 405 // TODO(alancutter): Make this work correctly for calc lengths. |
| 406 if (reflection->offset().hasPercent()) | 406 if (reflection->offset().hasPercent()) |
| 407 offset = cssValuePool().createValue(reflection->offset().percent(), CSSP
rimitiveValue::UnitType::Percentage); | 407 offset = cssValuePool().createValue(reflection->offset().percent(), CSSP
rimitiveValue::UnitType::Percentage); |
| 408 else | 408 else |
| 409 offset = zoomAdjustedPixelValue(reflection->offset().value(), style); | 409 offset = zoomAdjustedPixelValue(reflection->offset().value(), style); |
| 410 | 410 |
| 411 RawPtr<CSSPrimitiveValue> direction = nullptr; | 411 CSSPrimitiveValue* direction = nullptr; |
| 412 switch (reflection->direction()) { | 412 switch (reflection->direction()) { |
| 413 case ReflectionBelow: | 413 case ReflectionBelow: |
| 414 direction = cssValuePool().createIdentifierValue(CSSValueBelow); | 414 direction = cssValuePool().createIdentifierValue(CSSValueBelow); |
| 415 break; | 415 break; |
| 416 case ReflectionAbove: | 416 case ReflectionAbove: |
| 417 direction = cssValuePool().createIdentifierValue(CSSValueAbove); | 417 direction = cssValuePool().createIdentifierValue(CSSValueAbove); |
| 418 break; | 418 break; |
| 419 case ReflectionLeft: | 419 case ReflectionLeft: |
| 420 direction = cssValuePool().createIdentifierValue(CSSValueLeft); | 420 direction = cssValuePool().createIdentifierValue(CSSValueLeft); |
| 421 break; | 421 break; |
| 422 case ReflectionRight: | 422 case ReflectionRight: |
| 423 direction = cssValuePool().createIdentifierValue(CSSValueRight); | 423 direction = cssValuePool().createIdentifierValue(CSSValueRight); |
| 424 break; | 424 break; |
| 425 } | 425 } |
| 426 | 426 |
| 427 return CSSReflectValue::create(direction.release(), offset.release(), valueF
orNinePieceImage(reflection->mask(), style)); | 427 return CSSReflectValue::create(direction, offset, valueForNinePieceImage(ref
lection->mask(), style)); |
| 428 } | 428 } |
| 429 | 429 |
| 430 static ItemPosition resolveAlignmentAuto(ItemPosition position, const ComputedSt
yle* style) | 430 static ItemPosition resolveAlignmentAuto(ItemPosition position, const ComputedSt
yle* style) |
| 431 { | 431 { |
| 432 if (position != ItemPositionAuto) | 432 if (position != ItemPositionAuto) |
| 433 return position; | 433 return position; |
| 434 | 434 |
| 435 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) | 435 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) |
| 436 return ItemPositionStretch; | 436 return ItemPositionStretch; |
| 437 | 437 |
| 438 return isFlexOrGrid(style) ? ItemPositionStretch : ItemPositionStart; | 438 return isFlexOrGrid(style) ? ItemPositionStretch : ItemPositionStart; |
| 439 } | 439 } |
| 440 | 440 |
| 441 static RawPtr<CSSValueList> valueForItemPositionWithOverflowAlignment(ItemPositi
on itemPosition, OverflowAlignment overflowAlignment, ItemPositionType positionT
ype) | 441 static CSSValueList* valueForItemPositionWithOverflowAlignment(ItemPosition item
Position, OverflowAlignment overflowAlignment, ItemPositionType positionType) |
| 442 { | 442 { |
| 443 RawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated(); | 443 CSSValueList* result = CSSValueList::createSpaceSeparated(); |
| 444 if (positionType == LegacyPosition) | 444 if (positionType == LegacyPosition) |
| 445 result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy)); | 445 result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy)); |
| 446 result->append(CSSPrimitiveValue::create(itemPosition)); | 446 result->append(CSSPrimitiveValue::create(itemPosition)); |
| 447 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign
mentDefault) | 447 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign
mentDefault) |
| 448 result->append(CSSPrimitiveValue::create(overflowAlignment)); | 448 result->append(CSSPrimitiveValue::create(overflowAlignment)); |
| 449 ASSERT(result->length() <= 2); | 449 ASSERT(result->length() <= 2); |
| 450 return result.release(); | 450 return result; |
| 451 } | 451 } |
| 452 | 452 |
| 453 static RawPtr<CSSValueList> valuesForGridShorthand(const StylePropertyShorthand&
shorthand, const ComputedStyle& style, const LayoutObject* layoutObject, Node*
styledNode, bool allowVisitedStyle) | 453 static CSSValueList* valuesForGridShorthand(const StylePropertyShorthand& shorth
and, const ComputedStyle& style, const LayoutObject* layoutObject, Node* styledN
ode, bool allowVisitedStyle) |
| 454 { | 454 { |
| 455 RawPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); | 455 CSSValueList* list = CSSValueList::createSlashSeparated(); |
| 456 for (size_t i = 0; i < shorthand.length(); ++i) { | 456 for (size_t i = 0; i < shorthand.length(); ++i) { |
| 457 RawPtr<CSSValue> value = ComputedStyleCSSValueMapping::get(shorthand.pro
perties()[i], style, layoutObject, styledNode, allowVisitedStyle); | 457 CSSValue* value = ComputedStyleCSSValueMapping::get(shorthand.properties
()[i], style, layoutObject, styledNode, allowVisitedStyle); |
| 458 ASSERT(value); | |
| 459 list->append(value.release()); | |
| 460 } | |
| 461 return list.release(); | |
| 462 } | |
| 463 | |
| 464 static RawPtr<CSSValueList> valuesForShorthandProperty(const StylePropertyShorth
and& shorthand, const ComputedStyle& style, const LayoutObject* layoutObject, No
de* styledNode, bool allowVisitedStyle) | |
| 465 { | |
| 466 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | |
| 467 for (size_t i = 0; i < shorthand.length(); ++i) { | |
| 468 RawPtr<CSSValue> value = ComputedStyleCSSValueMapping::get(shorthand.pro
perties()[i], style, layoutObject, styledNode, allowVisitedStyle); | |
| 469 ASSERT(value); | 458 ASSERT(value); |
| 470 list->append(value); | 459 list->append(value); |
| 471 } | 460 } |
| 472 return list.release(); | 461 return list; |
| 473 } | 462 } |
| 474 | 463 |
| 475 static RawPtr<CSSValueList> valuesForBackgroundShorthand(const ComputedStyle& st
yle, const LayoutObject* layoutObject, Node* styledNode, bool allowVisitedStyle) | 464 static CSSValueList* valuesForShorthandProperty(const StylePropertyShorthand& sh
orthand, const ComputedStyle& style, const LayoutObject* layoutObject, Node* sty
ledNode, bool allowVisitedStyle) |
| 476 { | 465 { |
| 477 RawPtr<CSSValueList> ret = CSSValueList::createCommaSeparated(); | 466 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 467 for (size_t i = 0; i < shorthand.length(); ++i) { |
| 468 CSSValue* value = ComputedStyleCSSValueMapping::get(shorthand.properties
()[i], style, layoutObject, styledNode, allowVisitedStyle); |
| 469 ASSERT(value); |
| 470 list->append(value); |
| 471 } |
| 472 return list; |
| 473 } |
| 474 |
| 475 static CSSValueList* valuesForBackgroundShorthand(const ComputedStyle& style, co
nst LayoutObject* layoutObject, Node* styledNode, bool allowVisitedStyle) |
| 476 { |
| 477 CSSValueList* ret = CSSValueList::createCommaSeparated(); |
| 478 const FillLayer* currLayer = &style.backgroundLayers(); | 478 const FillLayer* currLayer = &style.backgroundLayers(); |
| 479 for (; currLayer; currLayer = currLayer->next()) { | 479 for (; currLayer; currLayer = currLayer->next()) { |
| 480 RawPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); | 480 CSSValueList* list = CSSValueList::createSlashSeparated(); |
| 481 RawPtr<CSSValueList> beforeSlash = CSSValueList::createSpaceSeparated(); | 481 CSSValueList* beforeSlash = CSSValueList::createSpaceSeparated(); |
| 482 if (!currLayer->next()) { // color only for final layer | 482 if (!currLayer->next()) { // color only for final layer |
| 483 RawPtr<CSSValue> value = ComputedStyleCSSValueMapping::get(CSSProper
tyBackgroundColor, style, layoutObject, styledNode, allowVisitedStyle); | 483 CSSValue* value = ComputedStyleCSSValueMapping::get(CSSPropertyBackg
roundColor, style, layoutObject, styledNode, allowVisitedStyle); |
| 484 ASSERT(value); | 484 ASSERT(value); |
| 485 beforeSlash->append(value); | 485 beforeSlash->append(value); |
| 486 } | 486 } |
| 487 beforeSlash->append(currLayer->image() ? currLayer->image()->computedCSS
Value() : cssValuePool().createIdentifierValue(CSSValueNone)); | 487 beforeSlash->append(currLayer->image() ? currLayer->image()->computedCSS
Value() : cssValuePool().createIdentifierValue(CSSValueNone)); |
| 488 beforeSlash->append(valueForFillRepeat(currLayer->repeatX(), currLayer->
repeatY())); | 488 beforeSlash->append(valueForFillRepeat(currLayer->repeatX(), currLayer->
repeatY())); |
| 489 beforeSlash->append(cssValuePool().createValue(currLayer->attachment()))
; | 489 beforeSlash->append(cssValuePool().createValue(currLayer->attachment()))
; |
| 490 beforeSlash->append(createPositionListForLayer(CSSPropertyBackgroundPosi
tion, *currLayer, style)); | 490 beforeSlash->append(createPositionListForLayer(CSSPropertyBackgroundPosi
tion, *currLayer, style)); |
| 491 list->append(beforeSlash); | 491 list->append(beforeSlash); |
| 492 RawPtr<CSSValueList> afterSlash = CSSValueList::createSpaceSeparated(); | 492 CSSValueList* afterSlash = CSSValueList::createSpaceSeparated(); |
| 493 afterSlash->append(valueForFillSize(currLayer->size(), style)); | 493 afterSlash->append(valueForFillSize(currLayer->size(), style)); |
| 494 afterSlash->append(cssValuePool().createValue(currLayer->origin())); | 494 afterSlash->append(cssValuePool().createValue(currLayer->origin())); |
| 495 afterSlash->append(cssValuePool().createValue(currLayer->clip())); | 495 afterSlash->append(cssValuePool().createValue(currLayer->clip())); |
| 496 list->append(afterSlash); | 496 list->append(afterSlash); |
| 497 ret->append(list); | 497 ret->append(list); |
| 498 } | 498 } |
| 499 return ret.release(); | 499 return ret; |
| 500 } | 500 } |
| 501 | 501 |
| 502 static RawPtr<CSSValueList> valueForContentPositionAndDistributionWithOverflowAl
ignment(const StyleContentAlignmentData& data) | 502 static CSSValueList* valueForContentPositionAndDistributionWithOverflowAlignment
(const StyleContentAlignmentData& data) |
| 503 { | 503 { |
| 504 RawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated(); | 504 CSSValueList* result = CSSValueList::createSpaceSeparated(); |
| 505 if (data.distribution() != ContentDistributionDefault) | 505 if (data.distribution() != ContentDistributionDefault) |
| 506 result->append(CSSPrimitiveValue::create(data.distribution())); | 506 result->append(CSSPrimitiveValue::create(data.distribution())); |
| 507 if (data.distribution() == ContentDistributionDefault || data.position() !=
ContentPositionNormal) | 507 if (data.distribution() == ContentDistributionDefault || data.position() !=
ContentPositionNormal) |
| 508 result->append(CSSPrimitiveValue::create(data.position())); | 508 result->append(CSSPrimitiveValue::create(data.position())); |
| 509 if ((data.position() >= ContentPositionCenter || data.distribution() != Cont
entDistributionDefault) && data.overflow() != OverflowAlignmentDefault) | 509 if ((data.position() >= ContentPositionCenter || data.distribution() != Cont
entDistributionDefault) && data.overflow() != OverflowAlignmentDefault) |
| 510 result->append(CSSPrimitiveValue::create(data.overflow())); | 510 result->append(CSSPrimitiveValue::create(data.overflow())); |
| 511 ASSERT(result->length() > 0); | 511 ASSERT(result->length() > 0); |
| 512 ASSERT(result->length() <= 3); | 512 ASSERT(result->length() <= 3); |
| 513 return result.release(); | 513 return result; |
| 514 } | 514 } |
| 515 | 515 |
| 516 static RawPtr<CSSPrimitiveValue> valueForLineHeight(const ComputedStyle& style) | 516 static CSSPrimitiveValue* valueForLineHeight(const ComputedStyle& style) |
| 517 { | 517 { |
| 518 Length length = style.lineHeight(); | 518 Length length = style.lineHeight(); |
| 519 if (length.isNegative()) | 519 if (length.isNegative()) |
| 520 return cssValuePool().createIdentifierValue(CSSValueNormal); | 520 return cssValuePool().createIdentifierValue(CSSValueNormal); |
| 521 | 521 |
| 522 return zoomAdjustedPixelValue(floatValueForLength(length, style.getFontDescr
iption().computedSize()), style); | 522 return zoomAdjustedPixelValue(floatValueForLength(length, style.getFontDescr
iption().computedSize()), style); |
| 523 } | 523 } |
| 524 | 524 |
| 525 static CSSValueID identifierForFamily(const AtomicString& family) | 525 static CSSValueID identifierForFamily(const AtomicString& family) |
| 526 { | 526 { |
| 527 if (family == FontFamilyNames::webkit_cursive) | 527 if (family == FontFamilyNames::webkit_cursive) |
| 528 return CSSValueCursive; | 528 return CSSValueCursive; |
| 529 if (family == FontFamilyNames::webkit_fantasy) | 529 if (family == FontFamilyNames::webkit_fantasy) |
| 530 return CSSValueFantasy; | 530 return CSSValueFantasy; |
| 531 if (family == FontFamilyNames::webkit_monospace) | 531 if (family == FontFamilyNames::webkit_monospace) |
| 532 return CSSValueMonospace; | 532 return CSSValueMonospace; |
| 533 if (family == FontFamilyNames::webkit_pictograph) | 533 if (family == FontFamilyNames::webkit_pictograph) |
| 534 return CSSValueWebkitPictograph; | 534 return CSSValueWebkitPictograph; |
| 535 if (family == FontFamilyNames::webkit_sans_serif) | 535 if (family == FontFamilyNames::webkit_sans_serif) |
| 536 return CSSValueSansSerif; | 536 return CSSValueSansSerif; |
| 537 if (family == FontFamilyNames::webkit_serif) | 537 if (family == FontFamilyNames::webkit_serif) |
| 538 return CSSValueSerif; | 538 return CSSValueSerif; |
| 539 return CSSValueInvalid; | 539 return CSSValueInvalid; |
| 540 } | 540 } |
| 541 | 541 |
| 542 static RawPtr<CSSValue> valueForFamily(const AtomicString& family) | 542 static CSSValue* valueForFamily(const AtomicString& family) |
| 543 { | 543 { |
| 544 if (CSSValueID familyIdentifier = identifierForFamily(family)) | 544 if (CSSValueID familyIdentifier = identifierForFamily(family)) |
| 545 return cssValuePool().createIdentifierValue(familyIdentifier); | 545 return cssValuePool().createIdentifierValue(familyIdentifier); |
| 546 return cssValuePool().createFontFamilyValue(family.getString()); | 546 return cssValuePool().createFontFamilyValue(family.getString()); |
| 547 } | 547 } |
| 548 | 548 |
| 549 static RawPtr<CSSValueList> valueForFontFamily(const ComputedStyle& style) | 549 static CSSValueList* valueForFontFamily(const ComputedStyle& style) |
| 550 { | 550 { |
| 551 const FontFamily& firstFamily = style.getFontDescription().family(); | 551 const FontFamily& firstFamily = style.getFontDescription().family(); |
| 552 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 552 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 553 for (const FontFamily* family = &firstFamily; family; family = family->next(
)) | 553 for (const FontFamily* family = &firstFamily; family; family = family->next(
)) |
| 554 list->append(valueForFamily(family->family())); | 554 list->append(valueForFamily(family->family())); |
| 555 return list.release(); | 555 return list; |
| 556 } | 556 } |
| 557 | 557 |
| 558 static RawPtr<CSSPrimitiveValue> valueForFontSize(const ComputedStyle& style) | 558 static CSSPrimitiveValue* valueForFontSize(const ComputedStyle& style) |
| 559 { | 559 { |
| 560 return zoomAdjustedPixelValue(style.getFontDescription().computedSize(), sty
le); | 560 return zoomAdjustedPixelValue(style.getFontDescription().computedSize(), sty
le); |
| 561 } | 561 } |
| 562 | 562 |
| 563 static RawPtr<CSSPrimitiveValue> valueForFontStretch(const ComputedStyle& style) | 563 static CSSPrimitiveValue* valueForFontStretch(const ComputedStyle& style) |
| 564 { | 564 { |
| 565 return cssValuePool().createValue(style.getFontDescription().stretch()); | 565 return cssValuePool().createValue(style.getFontDescription().stretch()); |
| 566 } | 566 } |
| 567 | 567 |
| 568 static RawPtr<CSSPrimitiveValue> valueForFontStyle(const ComputedStyle& style) | 568 static CSSPrimitiveValue* valueForFontStyle(const ComputedStyle& style) |
| 569 { | 569 { |
| 570 return cssValuePool().createValue(style.getFontDescription().style()); | 570 return cssValuePool().createValue(style.getFontDescription().style()); |
| 571 } | 571 } |
| 572 | 572 |
| 573 static RawPtr<CSSPrimitiveValue> valueForFontVariant(const ComputedStyle& style) | 573 static CSSPrimitiveValue* valueForFontVariant(const ComputedStyle& style) |
| 574 { | 574 { |
| 575 return cssValuePool().createValue(style.getFontDescription().variant()); | 575 return cssValuePool().createValue(style.getFontDescription().variant()); |
| 576 } | 576 } |
| 577 | 577 |
| 578 static RawPtr<CSSPrimitiveValue> valueForFontWeight(const ComputedStyle& style) | 578 static CSSPrimitiveValue* valueForFontWeight(const ComputedStyle& style) |
| 579 { | 579 { |
| 580 return cssValuePool().createValue(style.getFontDescription().weight()); | 580 return cssValuePool().createValue(style.getFontDescription().weight()); |
| 581 } | 581 } |
| 582 | 582 |
| 583 static RawPtr<CSSValue> specifiedValueForGridTrackBreadth(const GridLength& trac
kBreadth, const ComputedStyle& style) | 583 static CSSValue* specifiedValueForGridTrackBreadth(const GridLength& trackBreadt
h, const ComputedStyle& style) |
| 584 { | 584 { |
| 585 if (!trackBreadth.isLength()) | 585 if (!trackBreadth.isLength()) |
| 586 return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue
::UnitType::Fraction); | 586 return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue
::UnitType::Fraction); |
| 587 | 587 |
| 588 const Length& trackBreadthLength = trackBreadth.length(); | 588 const Length& trackBreadthLength = trackBreadth.length(); |
| 589 if (trackBreadthLength.isAuto()) | 589 if (trackBreadthLength.isAuto()) |
| 590 return cssValuePool().createIdentifierValue(CSSValueAuto); | 590 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 591 return zoomAdjustedPixelValueForLength(trackBreadthLength, style); | 591 return zoomAdjustedPixelValueForLength(trackBreadthLength, style); |
| 592 } | 592 } |
| 593 | 593 |
| 594 static RawPtr<CSSValue> specifiedValueForGridTrackSize(const GridTrackSize& trac
kSize, const ComputedStyle& style) | 594 static CSSValue* specifiedValueForGridTrackSize(const GridTrackSize& trackSize,
const ComputedStyle& style) |
| 595 { | 595 { |
| 596 switch (trackSize.type()) { | 596 switch (trackSize.type()) { |
| 597 case LengthTrackSizing: | 597 case LengthTrackSizing: |
| 598 return specifiedValueForGridTrackBreadth(trackSize.length(), style); | 598 return specifiedValueForGridTrackBreadth(trackSize.length(), style); |
| 599 case MinMaxTrackSizing: | 599 case MinMaxTrackSizing: |
| 600 RawPtr<CSSFunctionValue> minMaxTrackBreadths = CSSFunctionValue::create(
CSSValueMinmax); | 600 CSSFunctionValue* minMaxTrackBreadths = CSSFunctionValue::create(CSSValu
eMinmax); |
| 601 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.
minTrackBreadth(), style)); | 601 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.
minTrackBreadth(), style)); |
| 602 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.
maxTrackBreadth(), style)); | 602 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.
maxTrackBreadth(), style)); |
| 603 return minMaxTrackBreadths.release(); | 603 return minMaxTrackBreadths; |
| 604 } | 604 } |
| 605 ASSERT_NOT_REACHED(); | 605 ASSERT_NOT_REACHED(); |
| 606 return nullptr; | 606 return nullptr; |
| 607 } | 607 } |
| 608 | 608 |
| 609 static void addValuesForNamedGridLinesAtIndex(const OrderedNamedGridLines& order
edNamedGridLines, size_t i, CSSValueList& list) | 609 static void addValuesForNamedGridLinesAtIndex(const OrderedNamedGridLines& order
edNamedGridLines, size_t i, CSSValueList& list) |
| 610 { | 610 { |
| 611 const Vector<String>& namedGridLines = orderedNamedGridLines.get(i); | 611 const Vector<String>& namedGridLines = orderedNamedGridLines.get(i); |
| 612 if (namedGridLines.isEmpty()) | 612 if (namedGridLines.isEmpty()) |
| 613 return; | 613 return; |
| 614 | 614 |
| 615 RawPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue::create(); | 615 CSSGridLineNamesValue* lineNames = CSSGridLineNamesValue::create(); |
| 616 for (size_t j = 0; j < namedGridLines.size(); ++j) | 616 for (size_t j = 0; j < namedGridLines.size(); ++j) |
| 617 lineNames->append(CSSCustomIdentValue::create(namedGridLines[j])); | 617 lineNames->append(CSSCustomIdentValue::create(namedGridLines[j])); |
| 618 list.append(lineNames.release()); | 618 list.append(lineNames); |
| 619 } | 619 } |
| 620 | 620 |
| 621 static RawPtr<CSSValue> valueForGridTrackList(GridTrackSizingDirection direction
, const LayoutObject* layoutObject, const ComputedStyle& style) | 621 static CSSValue* valueForGridTrackList(GridTrackSizingDirection direction, const
LayoutObject* layoutObject, const ComputedStyle& style) |
| 622 { | 622 { |
| 623 bool isRowAxis = direction == ForColumns; | 623 bool isRowAxis = direction == ForColumns; |
| 624 const Vector<GridTrackSize>& trackSizes = isRowAxis ? style.gridTemplateColu
mns() : style.gridTemplateRows(); | 624 const Vector<GridTrackSize>& trackSizes = isRowAxis ? style.gridTemplateColu
mns() : style.gridTemplateRows(); |
| 625 const Vector<GridTrackSize>& autoRepeatTrackSizes = isRowAxis ? style.gridAu
toRepeatColumns() : style.gridAutoRepeatRows(); | 625 const Vector<GridTrackSize>& autoRepeatTrackSizes = isRowAxis ? style.gridAu
toRepeatColumns() : style.gridAutoRepeatRows(); |
| 626 const OrderedNamedGridLines& orderedNamedGridLines = isRowAxis ? style.order
edNamedGridColumnLines() : style.orderedNamedGridRowLines(); | 626 const OrderedNamedGridLines& orderedNamedGridLines = isRowAxis ? style.order
edNamedGridColumnLines() : style.orderedNamedGridRowLines(); |
| 627 | 627 |
| 628 bool isLayoutGrid = layoutObject && layoutObject->isLayoutGrid(); | 628 bool isLayoutGrid = layoutObject && layoutObject->isLayoutGrid(); |
| 629 | 629 |
| 630 // Handle the 'none' case. | 630 // Handle the 'none' case. |
| 631 bool trackListIsEmpty = trackSizes.isEmpty() && autoRepeatTrackSizes.isEmpty
(); | 631 bool trackListIsEmpty = trackSizes.isEmpty() && autoRepeatTrackSizes.isEmpty
(); |
| 632 if (isLayoutGrid && trackListIsEmpty) { | 632 if (isLayoutGrid && trackListIsEmpty) { |
| 633 // For grids we should consider every listed track, whether implicitly o
r explicitly created. If we don't have | 633 // For grids we should consider every listed track, whether implicitly o
r explicitly created. If we don't have |
| 634 // any explicit track and there are no children then there are no implic
it tracks. We cannot simply check the | 634 // any explicit track and there are no children then there are no implic
it tracks. We cannot simply check the |
| 635 // number of rows/columns in our internal grid representation because it
's always at least 1x1 (see r143331). | 635 // number of rows/columns in our internal grid representation because it
's always at least 1x1 (see r143331). |
| 636 trackListIsEmpty = !toLayoutBlock(layoutObject)->firstChild(); | 636 trackListIsEmpty = !toLayoutBlock(layoutObject)->firstChild(); |
| 637 } | 637 } |
| 638 | 638 |
| 639 if (trackListIsEmpty) { | 639 if (trackListIsEmpty) { |
| 640 ASSERT(orderedNamedGridLines.isEmpty()); | 640 ASSERT(orderedNamedGridLines.isEmpty()); |
| 641 return cssValuePool().createIdentifierValue(CSSValueNone); | 641 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 642 } | 642 } |
| 643 | 643 |
| 644 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 644 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 645 size_t insertionIndex; | 645 size_t insertionIndex; |
| 646 if (isLayoutGrid) { | 646 if (isLayoutGrid) { |
| 647 const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? toL
ayoutGrid(layoutObject)->columnPositions() : toLayoutGrid(layoutObject)->rowPosi
tions(); | 647 const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? toL
ayoutGrid(layoutObject)->columnPositions() : toLayoutGrid(layoutObject)->rowPosi
tions(); |
| 648 // There are at least #tracks + 1 grid lines (trackPositions). Apart fro
m that, the grid container can generate implicit grid tracks, | 648 // There are at least #tracks + 1 grid lines (trackPositions). Apart fro
m that, the grid container can generate implicit grid tracks, |
| 649 // so we'll have more trackPositions than trackSizes as the latter only
contain the explicit grid. | 649 // so we'll have more trackPositions than trackSizes as the latter only
contain the explicit grid. |
| 650 ASSERT(trackPositions.size() - 1 >= trackSizes.size()); | 650 ASSERT(trackPositions.size() - 1 >= trackSizes.size()); |
| 651 | 651 |
| 652 size_t i; | 652 size_t i; |
| 653 LayoutUnit gutterSize = toLayoutGrid(layoutObject)->guttersSize(directio
n, 2); | 653 LayoutUnit gutterSize = toLayoutGrid(layoutObject)->guttersSize(directio
n, 2); |
| 654 for (i = 0; i < trackPositions.size() - 2; ++i) { | 654 for (i = 0; i < trackPositions.size() - 2; ++i) { |
| 655 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); | 655 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); |
| 656 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPos
itions[i] - gutterSize, style)); | 656 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPos
itions[i] - gutterSize, style)); |
| 657 } | 657 } |
| 658 // Last track line does not have any gutter. | 658 // Last track line does not have any gutter. |
| 659 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); | 659 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); |
| 660 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPositio
ns[i], style)); | 660 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPositio
ns[i], style)); |
| 661 insertionIndex = trackPositions.size() - 1; | 661 insertionIndex = trackPositions.size() - 1; |
| 662 } else { | 662 } else { |
| 663 for (size_t i = 0; i < trackSizes.size(); ++i) { | 663 for (size_t i = 0; i < trackSizes.size(); ++i) { |
| 664 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); | 664 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); |
| 665 list->append(specifiedValueForGridTrackSize(trackSizes[i], style)); | 665 list->append(specifiedValueForGridTrackSize(trackSizes[i], style)); |
| 666 } | 666 } |
| 667 insertionIndex = trackSizes.size(); | 667 insertionIndex = trackSizes.size(); |
| 668 } | 668 } |
| 669 // Those are the trailing <string>* allowed in the syntax. | 669 // Those are the trailing <string>* allowed in the syntax. |
| 670 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, insertionIndex, *li
st); | 670 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, insertionIndex, *li
st); |
| 671 return list.release(); | 671 return list; |
| 672 } | 672 } |
| 673 | 673 |
| 674 static RawPtr<CSSValue> valueForGridPosition(const GridPosition& position) | 674 static CSSValue* valueForGridPosition(const GridPosition& position) |
| 675 { | 675 { |
| 676 if (position.isAuto()) | 676 if (position.isAuto()) |
| 677 return cssValuePool().createIdentifierValue(CSSValueAuto); | 677 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 678 | 678 |
| 679 if (position.isNamedGridArea()) | 679 if (position.isNamedGridArea()) |
| 680 return CSSCustomIdentValue::create(position.namedGridLine()); | 680 return CSSCustomIdentValue::create(position.namedGridLine()); |
| 681 | 681 |
| 682 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 682 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 683 if (position.isSpan()) { | 683 if (position.isSpan()) { |
| 684 list->append(cssValuePool().createIdentifierValue(CSSValueSpan)); | 684 list->append(cssValuePool().createIdentifierValue(CSSValueSpan)); |
| 685 list->append(cssValuePool().createValue(position.spanPosition(), CSSPrim
itiveValue::UnitType::Number)); | 685 list->append(cssValuePool().createValue(position.spanPosition(), CSSPrim
itiveValue::UnitType::Number)); |
| 686 } else { | 686 } else { |
| 687 list->append(cssValuePool().createValue(position.integerPosition(), CSSP
rimitiveValue::UnitType::Number)); | 687 list->append(cssValuePool().createValue(position.integerPosition(), CSSP
rimitiveValue::UnitType::Number)); |
| 688 } | 688 } |
| 689 | 689 |
| 690 if (!position.namedGridLine().isNull()) | 690 if (!position.namedGridLine().isNull()) |
| 691 list->append(CSSCustomIdentValue::create(position.namedGridLine())); | 691 list->append(CSSCustomIdentValue::create(position.namedGridLine())); |
| 692 return list; | 692 return list; |
| 693 } | 693 } |
| 694 | 694 |
| 695 static LayoutRect sizingBox(const LayoutObject* layoutObject) | 695 static LayoutRect sizingBox(const LayoutObject* layoutObject) |
| 696 { | 696 { |
| 697 if (!layoutObject->isBox()) | 697 if (!layoutObject->isBox()) |
| 698 return LayoutRect(); | 698 return LayoutRect(); |
| 699 | 699 |
| 700 const LayoutBox* box = toLayoutBox(layoutObject); | 700 const LayoutBox* box = toLayoutBox(layoutObject); |
| 701 return box->style()->boxSizing() == BoxSizingBorderBox ? box->borderBoxRect(
) : box->computedCSSContentBoxRect(); | 701 return box->style()->boxSizing() == BoxSizingBorderBox ? box->borderBoxRect(
) : box->computedCSSContentBoxRect(); |
| 702 } | 702 } |
| 703 | 703 |
| 704 static RawPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecoration) | 704 static CSSValue* renderTextDecorationFlagsToCSSValue(int textDecoration) |
| 705 { | 705 { |
| 706 // Blink value is ignored. | 706 // Blink value is ignored. |
| 707 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 707 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 708 if (textDecoration & TextDecorationUnderline) | 708 if (textDecoration & TextDecorationUnderline) |
| 709 list->append(cssValuePool().createIdentifierValue(CSSValueUnderline)); | 709 list->append(cssValuePool().createIdentifierValue(CSSValueUnderline)); |
| 710 if (textDecoration & TextDecorationOverline) | 710 if (textDecoration & TextDecorationOverline) |
| 711 list->append(cssValuePool().createIdentifierValue(CSSValueOverline)); | 711 list->append(cssValuePool().createIdentifierValue(CSSValueOverline)); |
| 712 if (textDecoration & TextDecorationLineThrough) | 712 if (textDecoration & TextDecorationLineThrough) |
| 713 list->append(cssValuePool().createIdentifierValue(CSSValueLineThrough)); | 713 list->append(cssValuePool().createIdentifierValue(CSSValueLineThrough)); |
| 714 | 714 |
| 715 if (!list->length()) | 715 if (!list->length()) |
| 716 return cssValuePool().createIdentifierValue(CSSValueNone); | 716 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 717 return list.release(); | 717 return list; |
| 718 } | 718 } |
| 719 | 719 |
| 720 static RawPtr<CSSValue> valueForTextDecorationStyle(TextDecorationStyle textDeco
rationStyle) | 720 static CSSValue* valueForTextDecorationStyle(TextDecorationStyle textDecorationS
tyle) |
| 721 { | 721 { |
| 722 switch (textDecorationStyle) { | 722 switch (textDecorationStyle) { |
| 723 case TextDecorationStyleSolid: | 723 case TextDecorationStyleSolid: |
| 724 return cssValuePool().createIdentifierValue(CSSValueSolid); | 724 return cssValuePool().createIdentifierValue(CSSValueSolid); |
| 725 case TextDecorationStyleDouble: | 725 case TextDecorationStyleDouble: |
| 726 return cssValuePool().createIdentifierValue(CSSValueDouble); | 726 return cssValuePool().createIdentifierValue(CSSValueDouble); |
| 727 case TextDecorationStyleDotted: | 727 case TextDecorationStyleDotted: |
| 728 return cssValuePool().createIdentifierValue(CSSValueDotted); | 728 return cssValuePool().createIdentifierValue(CSSValueDotted); |
| 729 case TextDecorationStyleDashed: | 729 case TextDecorationStyleDashed: |
| 730 return cssValuePool().createIdentifierValue(CSSValueDashed); | 730 return cssValuePool().createIdentifierValue(CSSValueDashed); |
| 731 case TextDecorationStyleWavy: | 731 case TextDecorationStyleWavy: |
| 732 return cssValuePool().createIdentifierValue(CSSValueWavy); | 732 return cssValuePool().createIdentifierValue(CSSValueWavy); |
| 733 } | 733 } |
| 734 | 734 |
| 735 ASSERT_NOT_REACHED(); | 735 ASSERT_NOT_REACHED(); |
| 736 return cssValuePool().createExplicitInitialValue(); | 736 return cssValuePool().createExplicitInitialValue(); |
| 737 } | 737 } |
| 738 | 738 |
| 739 static RawPtr<CSSValue> touchActionFlagsToCSSValue(TouchAction touchAction) | 739 static CSSValue* touchActionFlagsToCSSValue(TouchAction touchAction) |
| 740 { | 740 { |
| 741 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 741 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 742 if (touchAction == TouchActionAuto) { | 742 if (touchAction == TouchActionAuto) { |
| 743 list->append(cssValuePool().createIdentifierValue(CSSValueAuto)); | 743 list->append(cssValuePool().createIdentifierValue(CSSValueAuto)); |
| 744 } else if (touchAction == TouchActionNone) { | 744 } else if (touchAction == TouchActionNone) { |
| 745 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); | 745 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); |
| 746 } else if (touchAction == TouchActionManipulation) { | 746 } else if (touchAction == TouchActionManipulation) { |
| 747 list->append(cssValuePool().createIdentifierValue(CSSValueManipulation))
; | 747 list->append(cssValuePool().createIdentifierValue(CSSValueManipulation))
; |
| 748 } else { | 748 } else { |
| 749 if ((touchAction & TouchActionPanX) == TouchActionPanX) | 749 if ((touchAction & TouchActionPanX) == TouchActionPanX) |
| 750 list->append(cssValuePool().createIdentifierValue(CSSValuePanX)); | 750 list->append(cssValuePool().createIdentifierValue(CSSValuePanX)); |
| 751 else if (touchAction & TouchActionPanLeft) | 751 else if (touchAction & TouchActionPanLeft) |
| 752 list->append(cssValuePool().createIdentifierValue(CSSValuePanLeft)); | 752 list->append(cssValuePool().createIdentifierValue(CSSValuePanLeft)); |
| 753 else if (touchAction & TouchActionPanRight) | 753 else if (touchAction & TouchActionPanRight) |
| 754 list->append(cssValuePool().createIdentifierValue(CSSValuePanRight))
; | 754 list->append(cssValuePool().createIdentifierValue(CSSValuePanRight))
; |
| 755 | 755 |
| 756 if ((touchAction & TouchActionPanY) == TouchActionPanY) | 756 if ((touchAction & TouchActionPanY) == TouchActionPanY) |
| 757 list->append(cssValuePool().createIdentifierValue(CSSValuePanY)); | 757 list->append(cssValuePool().createIdentifierValue(CSSValuePanY)); |
| 758 else if (touchAction & TouchActionPanUp) | 758 else if (touchAction & TouchActionPanUp) |
| 759 list->append(cssValuePool().createIdentifierValue(CSSValuePanUp)); | 759 list->append(cssValuePool().createIdentifierValue(CSSValuePanUp)); |
| 760 else if (touchAction & TouchActionPanDown) | 760 else if (touchAction & TouchActionPanDown) |
| 761 list->append(cssValuePool().createIdentifierValue(CSSValuePanDown)); | 761 list->append(cssValuePool().createIdentifierValue(CSSValuePanDown)); |
| 762 } | 762 } |
| 763 ASSERT(list->length()); | 763 ASSERT(list->length()); |
| 764 return list.release(); | 764 return list; |
| 765 } | 765 } |
| 766 | 766 |
| 767 static RawPtr<CSSValue> valueForWillChange(const Vector<CSSPropertyID>& willChan
geProperties, bool willChangeContents, bool willChangeScrollPosition) | 767 static CSSValue* valueForWillChange(const Vector<CSSPropertyID>& willChangePrope
rties, bool willChangeContents, bool willChangeScrollPosition) |
| 768 { | 768 { |
| 769 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 769 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 770 if (willChangeContents) | 770 if (willChangeContents) |
| 771 list->append(cssValuePool().createIdentifierValue(CSSValueContents)); | 771 list->append(cssValuePool().createIdentifierValue(CSSValueContents)); |
| 772 if (willChangeScrollPosition) | 772 if (willChangeScrollPosition) |
| 773 list->append(cssValuePool().createIdentifierValue(CSSValueScrollPosition
)); | 773 list->append(cssValuePool().createIdentifierValue(CSSValueScrollPosition
)); |
| 774 for (size_t i = 0; i < willChangeProperties.size(); ++i) | 774 for (size_t i = 0; i < willChangeProperties.size(); ++i) |
| 775 list->append(cssValuePool().createIdentifierValue(willChangeProperties[i
])); | 775 list->append(cssValuePool().createIdentifierValue(willChangeProperties[i
])); |
| 776 if (!list->length()) | 776 if (!list->length()) |
| 777 list->append(cssValuePool().createIdentifierValue(CSSValueAuto)); | 777 list->append(cssValuePool().createIdentifierValue(CSSValueAuto)); |
| 778 return list.release(); | 778 return list; |
| 779 } | 779 } |
| 780 | 780 |
| 781 static RawPtr<CSSValue> valueForAnimationDelay(const CSSTimingData* timingData) | 781 static CSSValue* valueForAnimationDelay(const CSSTimingData* timingData) |
| 782 { | 782 { |
| 783 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 783 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 784 if (timingData) { | 784 if (timingData) { |
| 785 for (size_t i = 0; i < timingData->delayList().size(); ++i) | 785 for (size_t i = 0; i < timingData->delayList().size(); ++i) |
| 786 list->append(cssValuePool().createValue(timingData->delayList()[i],
CSSPrimitiveValue::UnitType::Seconds)); | 786 list->append(cssValuePool().createValue(timingData->delayList()[i],
CSSPrimitiveValue::UnitType::Seconds)); |
| 787 } else { | 787 } else { |
| 788 list->append(cssValuePool().createValue(CSSTimingData::initialDelay(), C
SSPrimitiveValue::UnitType::Seconds)); | 788 list->append(cssValuePool().createValue(CSSTimingData::initialDelay(), C
SSPrimitiveValue::UnitType::Seconds)); |
| 789 } | 789 } |
| 790 return list.release(); | 790 return list; |
| 791 } | 791 } |
| 792 | 792 |
| 793 static RawPtr<CSSValue> valueForAnimationDirection(Timing::PlaybackDirection dir
ection) | 793 static CSSValue* valueForAnimationDirection(Timing::PlaybackDirection direction) |
| 794 { | 794 { |
| 795 switch (direction) { | 795 switch (direction) { |
| 796 case Timing::PlaybackDirectionNormal: | 796 case Timing::PlaybackDirectionNormal: |
| 797 return cssValuePool().createIdentifierValue(CSSValueNormal); | 797 return cssValuePool().createIdentifierValue(CSSValueNormal); |
| 798 case Timing::PlaybackDirectionAlternate: | 798 case Timing::PlaybackDirectionAlternate: |
| 799 return cssValuePool().createIdentifierValue(CSSValueAlternate); | 799 return cssValuePool().createIdentifierValue(CSSValueAlternate); |
| 800 case Timing::PlaybackDirectionReverse: | 800 case Timing::PlaybackDirectionReverse: |
| 801 return cssValuePool().createIdentifierValue(CSSValueReverse); | 801 return cssValuePool().createIdentifierValue(CSSValueReverse); |
| 802 case Timing::PlaybackDirectionAlternateReverse: | 802 case Timing::PlaybackDirectionAlternateReverse: |
| 803 return cssValuePool().createIdentifierValue(CSSValueAlternateReverse); | 803 return cssValuePool().createIdentifierValue(CSSValueAlternateReverse); |
| 804 default: | 804 default: |
| 805 ASSERT_NOT_REACHED(); | 805 ASSERT_NOT_REACHED(); |
| 806 return nullptr; | 806 return nullptr; |
| 807 } | 807 } |
| 808 } | 808 } |
| 809 | 809 |
| 810 static RawPtr<CSSValue> valueForAnimationDuration(const CSSTimingData* timingDat
a) | 810 static CSSValue* valueForAnimationDuration(const CSSTimingData* timingData) |
| 811 { | 811 { |
| 812 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 812 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 813 if (timingData) { | 813 if (timingData) { |
| 814 for (size_t i = 0; i < timingData->durationList().size(); ++i) | 814 for (size_t i = 0; i < timingData->durationList().size(); ++i) |
| 815 list->append(cssValuePool().createValue(timingData->durationList()[i
], CSSPrimitiveValue::UnitType::Seconds)); | 815 list->append(cssValuePool().createValue(timingData->durationList()[i
], CSSPrimitiveValue::UnitType::Seconds)); |
| 816 } else { | 816 } else { |
| 817 list->append(cssValuePool().createValue(CSSTimingData::initialDuration()
, CSSPrimitiveValue::UnitType::Seconds)); | 817 list->append(cssValuePool().createValue(CSSTimingData::initialDuration()
, CSSPrimitiveValue::UnitType::Seconds)); |
| 818 } | 818 } |
| 819 return list.release(); | 819 return list; |
| 820 } | 820 } |
| 821 | 821 |
| 822 static RawPtr<CSSValue> valueForAnimationFillMode(Timing::FillMode fillMode) | 822 static CSSValue* valueForAnimationFillMode(Timing::FillMode fillMode) |
| 823 { | 823 { |
| 824 switch (fillMode) { | 824 switch (fillMode) { |
| 825 case Timing::FillModeNone: | 825 case Timing::FillModeNone: |
| 826 return cssValuePool().createIdentifierValue(CSSValueNone); | 826 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 827 case Timing::FillModeForwards: | 827 case Timing::FillModeForwards: |
| 828 return cssValuePool().createIdentifierValue(CSSValueForwards); | 828 return cssValuePool().createIdentifierValue(CSSValueForwards); |
| 829 case Timing::FillModeBackwards: | 829 case Timing::FillModeBackwards: |
| 830 return cssValuePool().createIdentifierValue(CSSValueBackwards); | 830 return cssValuePool().createIdentifierValue(CSSValueBackwards); |
| 831 case Timing::FillModeBoth: | 831 case Timing::FillModeBoth: |
| 832 return cssValuePool().createIdentifierValue(CSSValueBoth); | 832 return cssValuePool().createIdentifierValue(CSSValueBoth); |
| 833 default: | 833 default: |
| 834 ASSERT_NOT_REACHED(); | 834 ASSERT_NOT_REACHED(); |
| 835 return nullptr; | 835 return nullptr; |
| 836 } | 836 } |
| 837 } | 837 } |
| 838 | 838 |
| 839 static RawPtr<CSSValue> valueForAnimationIterationCount(double iterationCount) | 839 static CSSValue* valueForAnimationIterationCount(double iterationCount) |
| 840 { | 840 { |
| 841 if (iterationCount == std::numeric_limits<double>::infinity()) | 841 if (iterationCount == std::numeric_limits<double>::infinity()) |
| 842 return cssValuePool().createIdentifierValue(CSSValueInfinite); | 842 return cssValuePool().createIdentifierValue(CSSValueInfinite); |
| 843 return cssValuePool().createValue(iterationCount, CSSPrimitiveValue::UnitTyp
e::Number); | 843 return cssValuePool().createValue(iterationCount, CSSPrimitiveValue::UnitTyp
e::Number); |
| 844 } | 844 } |
| 845 | 845 |
| 846 static RawPtr<CSSValue> valueForAnimationPlayState(EAnimPlayState playState) | 846 static CSSValue* valueForAnimationPlayState(EAnimPlayState playState) |
| 847 { | 847 { |
| 848 if (playState == AnimPlayStatePlaying) | 848 if (playState == AnimPlayStatePlaying) |
| 849 return cssValuePool().createIdentifierValue(CSSValueRunning); | 849 return cssValuePool().createIdentifierValue(CSSValueRunning); |
| 850 ASSERT(playState == AnimPlayStatePaused); | 850 ASSERT(playState == AnimPlayStatePaused); |
| 851 return cssValuePool().createIdentifierValue(CSSValuePaused); | 851 return cssValuePool().createIdentifierValue(CSSValuePaused); |
| 852 } | 852 } |
| 853 | 853 |
| 854 static RawPtr<CSSValue> createTimingFunctionValue(const TimingFunction* timingFu
nction) | 854 static CSSValue* createTimingFunctionValue(const TimingFunction* timingFunction) |
| 855 { | 855 { |
| 856 switch (timingFunction->type()) { | 856 switch (timingFunction->type()) { |
| 857 case TimingFunction::kCubicBezierFunction: | 857 case TimingFunction::kCubicBezierFunction: |
| 858 { | 858 { |
| 859 const CubicBezierTimingFunction* bezierTimingFunction = toCubicBezie
rTimingFunction(timingFunction); | 859 const CubicBezierTimingFunction* bezierTimingFunction = toCubicBezie
rTimingFunction(timingFunction); |
| 860 if (bezierTimingFunction->subType() != CubicBezierTimingFunction::Cu
stom) { | 860 if (bezierTimingFunction->subType() != CubicBezierTimingFunction::Cu
stom) { |
| 861 CSSValueID valueId = CSSValueInvalid; | 861 CSSValueID valueId = CSSValueInvalid; |
| 862 switch (bezierTimingFunction->subType()) { | 862 switch (bezierTimingFunction->subType()) { |
| 863 case CubicBezierTimingFunction::Ease: | 863 case CubicBezierTimingFunction::Ease: |
| 864 valueId = CSSValueEase; | 864 valueId = CSSValueEase; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 892 return CSSStepsTimingFunctionValue::create(steps, position); | 892 return CSSStepsTimingFunctionValue::create(steps, position); |
| 893 CSSValueID valueId = position == StepsTimingFunction::Start ? CSSVal
ueStepStart : CSSValueStepEnd; | 893 CSSValueID valueId = position == StepsTimingFunction::Start ? CSSVal
ueStepStart : CSSValueStepEnd; |
| 894 return cssValuePool().createIdentifierValue(valueId); | 894 return cssValuePool().createIdentifierValue(valueId); |
| 895 } | 895 } |
| 896 | 896 |
| 897 default: | 897 default: |
| 898 return cssValuePool().createIdentifierValue(CSSValueLinear); | 898 return cssValuePool().createIdentifierValue(CSSValueLinear); |
| 899 } | 899 } |
| 900 } | 900 } |
| 901 | 901 |
| 902 static RawPtr<CSSValue> valueForAnimationTimingFunction(const CSSTimingData* tim
ingData) | 902 static CSSValue* valueForAnimationTimingFunction(const CSSTimingData* timingData
) |
| 903 { | 903 { |
| 904 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 904 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 905 if (timingData) { | 905 if (timingData) { |
| 906 for (size_t i = 0; i < timingData->timingFunctionList().size(); ++i) | 906 for (size_t i = 0; i < timingData->timingFunctionList().size(); ++i) |
| 907 list->append(createTimingFunctionValue(timingData->timingFunctionLis
t()[i].get())); | 907 list->append(createTimingFunctionValue(timingData->timingFunctionLis
t()[i].get())); |
| 908 } else { | 908 } else { |
| 909 list->append(createTimingFunctionValue(CSSTimingData::initialTimingFunct
ion().get())); | 909 list->append(createTimingFunctionValue(CSSTimingData::initialTimingFunct
ion().get())); |
| 910 } | 910 } |
| 911 return list.release(); | 911 return list; |
| 912 } | 912 } |
| 913 | 913 |
| 914 static RawPtr<CSSValueList> valuesForBorderRadiusCorner(LengthSize radius, const
ComputedStyle& style) | 914 static CSSValueList* valuesForBorderRadiusCorner(LengthSize radius, const Comput
edStyle& style) |
| 915 { | 915 { |
| 916 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 916 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 917 if (radius.width().type() == Percent) | 917 if (radius.width().type() == Percent) |
| 918 list->append(cssValuePool().createValue(radius.width().percent(), CSSPri
mitiveValue::UnitType::Percentage)); | 918 list->append(cssValuePool().createValue(radius.width().percent(), CSSPri
mitiveValue::UnitType::Percentage)); |
| 919 else | 919 else |
| 920 list->append(zoomAdjustedPixelValueForLength(radius.width(), style)); | 920 list->append(zoomAdjustedPixelValueForLength(radius.width(), style)); |
| 921 if (radius.height().type() == Percent) | 921 if (radius.height().type() == Percent) |
| 922 list->append(cssValuePool().createValue(radius.height().percent(), CSSPr
imitiveValue::UnitType::Percentage)); | 922 list->append(cssValuePool().createValue(radius.height().percent(), CSSPr
imitiveValue::UnitType::Percentage)); |
| 923 else | 923 else |
| 924 list->append(zoomAdjustedPixelValueForLength(radius.height(), style)); | 924 list->append(zoomAdjustedPixelValueForLength(radius.height(), style)); |
| 925 return list.release(); | 925 return list; |
| 926 } | 926 } |
| 927 | 927 |
| 928 static RawPtr<CSSValue> valueForBorderRadiusCorner(LengthSize radius, const Comp
utedStyle& style) | 928 static CSSValue* valueForBorderRadiusCorner(LengthSize radius, const ComputedSty
le& style) |
| 929 { | 929 { |
| 930 RawPtr<CSSValueList> list = valuesForBorderRadiusCorner(radius, style); | 930 CSSValueList* list = valuesForBorderRadiusCorner(radius, style); |
| 931 if (list->item(0)->equals(*list->item(1))) | 931 if (list->item(0)->equals(*list->item(1))) |
| 932 return list->item(0); | 932 return list->item(0); |
| 933 return list.release(); | 933 return list; |
| 934 } | 934 } |
| 935 | 935 |
| 936 static RawPtr<CSSFunctionValue> valueForMatrixTransform(const TransformationMatr
ix& transform, const ComputedStyle& style) | 936 static CSSFunctionValue* valueForMatrixTransform(const TransformationMatrix& tra
nsform, const ComputedStyle& style) |
| 937 { | 937 { |
| 938 RawPtr<CSSFunctionValue> transformValue = nullptr; | 938 CSSFunctionValue* transformValue = nullptr; |
| 939 if (transform.isAffine()) { | 939 if (transform.isAffine()) { |
| 940 transformValue = CSSFunctionValue::create(CSSValueMatrix); | 940 transformValue = CSSFunctionValue::create(CSSValueMatrix); |
| 941 | 941 |
| 942 transformValue->append(cssValuePool().createValue(transform.a(), CSSPrim
itiveValue::UnitType::Number)); | 942 transformValue->append(cssValuePool().createValue(transform.a(), CSSPrim
itiveValue::UnitType::Number)); |
| 943 transformValue->append(cssValuePool().createValue(transform.b(), CSSPrim
itiveValue::UnitType::Number)); | 943 transformValue->append(cssValuePool().createValue(transform.b(), CSSPrim
itiveValue::UnitType::Number)); |
| 944 transformValue->append(cssValuePool().createValue(transform.c(), CSSPrim
itiveValue::UnitType::Number)); | 944 transformValue->append(cssValuePool().createValue(transform.c(), CSSPrim
itiveValue::UnitType::Number)); |
| 945 transformValue->append(cssValuePool().createValue(transform.d(), CSSPrim
itiveValue::UnitType::Number)); | 945 transformValue->append(cssValuePool().createValue(transform.d(), CSSPrim
itiveValue::UnitType::Number)); |
| 946 transformValue->append(zoomAdjustedNumberValue(transform.e(), style)); | 946 transformValue->append(zoomAdjustedNumberValue(transform.e(), style)); |
| 947 transformValue->append(zoomAdjustedNumberValue(transform.f(), style)); | 947 transformValue->append(zoomAdjustedNumberValue(transform.f(), style)); |
| 948 } else { | 948 } else { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 962 transformValue->append(cssValuePool().createValue(transform.m32(), CSSPr
imitiveValue::UnitType::Number)); | 962 transformValue->append(cssValuePool().createValue(transform.m32(), CSSPr
imitiveValue::UnitType::Number)); |
| 963 transformValue->append(cssValuePool().createValue(transform.m33(), CSSPr
imitiveValue::UnitType::Number)); | 963 transformValue->append(cssValuePool().createValue(transform.m33(), CSSPr
imitiveValue::UnitType::Number)); |
| 964 transformValue->append(cssValuePool().createValue(transform.m34(), CSSPr
imitiveValue::UnitType::Number)); | 964 transformValue->append(cssValuePool().createValue(transform.m34(), CSSPr
imitiveValue::UnitType::Number)); |
| 965 | 965 |
| 966 transformValue->append(zoomAdjustedNumberValue(transform.m41(), style)); | 966 transformValue->append(zoomAdjustedNumberValue(transform.m41(), style)); |
| 967 transformValue->append(zoomAdjustedNumberValue(transform.m42(), style)); | 967 transformValue->append(zoomAdjustedNumberValue(transform.m42(), style)); |
| 968 transformValue->append(zoomAdjustedNumberValue(transform.m43(), style)); | 968 transformValue->append(zoomAdjustedNumberValue(transform.m43(), style)); |
| 969 transformValue->append(cssValuePool().createValue(transform.m44(), CSSPr
imitiveValue::UnitType::Number)); | 969 transformValue->append(cssValuePool().createValue(transform.m44(), CSSPr
imitiveValue::UnitType::Number)); |
| 970 } | 970 } |
| 971 | 971 |
| 972 return transformValue.release(); | 972 return transformValue; |
| 973 } | 973 } |
| 974 | 974 |
| 975 static RawPtr<CSSValue> computedTransform(const LayoutObject* layoutObject, cons
t ComputedStyle& style) | 975 static CSSValue* computedTransform(const LayoutObject* layoutObject, const Compu
tedStyle& style) |
| 976 { | 976 { |
| 977 if (!layoutObject || !style.hasTransform()) | 977 if (!layoutObject || !style.hasTransform()) |
| 978 return cssValuePool().createIdentifierValue(CSSValueNone); | 978 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 979 | 979 |
| 980 IntRect box; | 980 IntRect box; |
| 981 if (layoutObject->isBox()) | 981 if (layoutObject->isBox()) |
| 982 box = pixelSnappedIntRect(toLayoutBox(layoutObject)->borderBoxRect()); | 982 box = pixelSnappedIntRect(toLayoutBox(layoutObject)->borderBoxRect()); |
| 983 | 983 |
| 984 TransformationMatrix transform; | 984 TransformationMatrix transform; |
| 985 style.applyTransform(transform, LayoutSize(box.size()), ComputedStyle::Exclu
deTransformOrigin, ComputedStyle::ExcludeMotionPath, ComputedStyle::ExcludeIndep
endentTransformProperties); | 985 style.applyTransform(transform, LayoutSize(box.size()), ComputedStyle::Exclu
deTransformOrigin, ComputedStyle::ExcludeMotionPath, ComputedStyle::ExcludeIndep
endentTransformProperties); |
| 986 | 986 |
| 987 // FIXME: Need to print out individual functions (https://bugs.webkit.org/sh
ow_bug.cgi?id=23924) | 987 // FIXME: Need to print out individual functions (https://bugs.webkit.org/sh
ow_bug.cgi?id=23924) |
| 988 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 988 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 989 list->append(valueForMatrixTransform(transform, style)); | 989 list->append(valueForMatrixTransform(transform, style)); |
| 990 | 990 |
| 991 return list.release(); | 991 return list; |
| 992 } | 992 } |
| 993 | 993 |
| 994 static RawPtr<CSSValue> createTransitionPropertyValue(const CSSTransitionData::T
ransitionProperty& property) | 994 static CSSValue* createTransitionPropertyValue(const CSSTransitionData::Transiti
onProperty& property) |
| 995 { | 995 { |
| 996 if (property.propertyType == CSSTransitionData::TransitionNone) | 996 if (property.propertyType == CSSTransitionData::TransitionNone) |
| 997 return cssValuePool().createIdentifierValue(CSSValueNone); | 997 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 998 if (property.propertyType == CSSTransitionData::TransitionUnknownProperty) | 998 if (property.propertyType == CSSTransitionData::TransitionUnknownProperty) |
| 999 return CSSCustomIdentValue::create(property.propertyString); | 999 return CSSCustomIdentValue::create(property.propertyString); |
| 1000 ASSERT(property.propertyType == CSSTransitionData::TransitionKnownProperty); | 1000 ASSERT(property.propertyType == CSSTransitionData::TransitionKnownProperty); |
| 1001 return CSSCustomIdentValue::create(getPropertyNameString(property.unresolved
Property)); | 1001 return CSSCustomIdentValue::create(getPropertyNameString(property.unresolved
Property)); |
| 1002 } | 1002 } |
| 1003 | 1003 |
| 1004 static RawPtr<CSSValue> valueForTransitionProperty(const CSSTransitionData* tran
sitionData) | 1004 static CSSValue* valueForTransitionProperty(const CSSTransitionData* transitionD
ata) |
| 1005 { | 1005 { |
| 1006 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 1006 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 1007 if (transitionData) { | 1007 if (transitionData) { |
| 1008 for (size_t i = 0; i < transitionData->propertyList().size(); ++i) | 1008 for (size_t i = 0; i < transitionData->propertyList().size(); ++i) |
| 1009 list->append(createTransitionPropertyValue(transitionData->propertyL
ist()[i])); | 1009 list->append(createTransitionPropertyValue(transitionData->propertyL
ist()[i])); |
| 1010 } else { | 1010 } else { |
| 1011 list->append(cssValuePool().createIdentifierValue(CSSValueAll)); | 1011 list->append(cssValuePool().createIdentifierValue(CSSValueAll)); |
| 1012 } | 1012 } |
| 1013 return list.release(); | 1013 return list; |
| 1014 } | 1014 } |
| 1015 | 1015 |
| 1016 CSSValueID valueForQuoteType(const QuoteType quoteType) | 1016 CSSValueID valueForQuoteType(const QuoteType quoteType) |
| 1017 { | 1017 { |
| 1018 switch (quoteType) { | 1018 switch (quoteType) { |
| 1019 case NO_OPEN_QUOTE: | 1019 case NO_OPEN_QUOTE: |
| 1020 return CSSValueNoOpenQuote; | 1020 return CSSValueNoOpenQuote; |
| 1021 case NO_CLOSE_QUOTE: | 1021 case NO_CLOSE_QUOTE: |
| 1022 return CSSValueNoCloseQuote; | 1022 return CSSValueNoCloseQuote; |
| 1023 case CLOSE_QUOTE: | 1023 case CLOSE_QUOTE: |
| 1024 return CSSValueCloseQuote; | 1024 return CSSValueCloseQuote; |
| 1025 case OPEN_QUOTE: | 1025 case OPEN_QUOTE: |
| 1026 return CSSValueOpenQuote; | 1026 return CSSValueOpenQuote; |
| 1027 } | 1027 } |
| 1028 ASSERT_NOT_REACHED(); | 1028 ASSERT_NOT_REACHED(); |
| 1029 return CSSValueInvalid; | 1029 return CSSValueInvalid; |
| 1030 } | 1030 } |
| 1031 | 1031 |
| 1032 static RawPtr<CSSValue> valueForContentData(const ComputedStyle& style) | 1032 static CSSValue* valueForContentData(const ComputedStyle& style) |
| 1033 { | 1033 { |
| 1034 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 1034 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 1035 for (const ContentData* contentData = style.contentData(); contentData; cont
entData = contentData->next()) { | 1035 for (const ContentData* contentData = style.contentData(); contentData; cont
entData = contentData->next()) { |
| 1036 if (contentData->isCounter()) { | 1036 if (contentData->isCounter()) { |
| 1037 const CounterContent* counter = toCounterContentData(contentData)->c
ounter(); | 1037 const CounterContent* counter = toCounterContentData(contentData)->c
ounter(); |
| 1038 ASSERT(counter); | 1038 ASSERT(counter); |
| 1039 RawPtr<CSSCustomIdentValue> identifier = CSSCustomIdentValue::create
(counter->identifier()); | 1039 CSSCustomIdentValue* identifier = CSSCustomIdentValue::create(counte
r->identifier()); |
| 1040 RawPtr<CSSCustomIdentValue> separator = CSSCustomIdentValue::create(
counter->separator()); | 1040 CSSCustomIdentValue* separator = CSSCustomIdentValue::create(counter
->separator()); |
| 1041 CSSValueID listStyleIdent = CSSValueNone; | 1041 CSSValueID listStyleIdent = CSSValueNone; |
| 1042 if (counter->listStyle() != NoneListStyle) | 1042 if (counter->listStyle() != NoneListStyle) |
| 1043 listStyleIdent = static_cast<CSSValueID>(CSSValueDisc + counter-
>listStyle()); | 1043 listStyleIdent = static_cast<CSSValueID>(CSSValueDisc + counter-
>listStyle()); |
| 1044 RawPtr<CSSPrimitiveValue> listStyle = cssValuePool().createIdentifie
rValue(listStyleIdent); | 1044 CSSPrimitiveValue* listStyle = cssValuePool().createIdentifierValue(
listStyleIdent); |
| 1045 list->append(CSSCounterValue::create(identifier.release(), listStyle
.release(), separator.release())); | 1045 list->append(CSSCounterValue::create(identifier, listStyle, separato
r)); |
| 1046 } else if (contentData->isImage()) { | 1046 } else if (contentData->isImage()) { |
| 1047 const StyleImage* image = toImageContentData(contentData)->image(); | 1047 const StyleImage* image = toImageContentData(contentData)->image(); |
| 1048 ASSERT(image); | 1048 ASSERT(image); |
| 1049 list->append(image->computedCSSValue()); | 1049 list->append(image->computedCSSValue()); |
| 1050 } else if (contentData->isText()) { | 1050 } else if (contentData->isText()) { |
| 1051 list->append(CSSStringValue::create(toTextContentData(contentData)->
text())); | 1051 list->append(CSSStringValue::create(toTextContentData(contentData)->
text())); |
| 1052 } else if (contentData->isQuote()) { | 1052 } else if (contentData->isQuote()) { |
| 1053 const QuoteType quoteType = toQuoteContentData(contentData)->quote()
; | 1053 const QuoteType quoteType = toQuoteContentData(contentData)->quote()
; |
| 1054 list->append(cssValuePool().createIdentifierValue(valueForQuoteType(
quoteType))); | 1054 list->append(cssValuePool().createIdentifierValue(valueForQuoteType(
quoteType))); |
| 1055 } else { | 1055 } else { |
| 1056 ASSERT_NOT_REACHED(); | 1056 ASSERT_NOT_REACHED(); |
| 1057 } | 1057 } |
| 1058 } | 1058 } |
| 1059 return list.release(); | 1059 return list; |
| 1060 } | 1060 } |
| 1061 | 1061 |
| 1062 static RawPtr<CSSValue> valueForCounterDirectives(const ComputedStyle& style, CS
SPropertyID propertyID) | 1062 static CSSValue* valueForCounterDirectives(const ComputedStyle& style, CSSProper
tyID propertyID) |
| 1063 { | 1063 { |
| 1064 const CounterDirectiveMap* map = style.counterDirectives(); | 1064 const CounterDirectiveMap* map = style.counterDirectives(); |
| 1065 if (!map) | 1065 if (!map) |
| 1066 return cssValuePool().createIdentifierValue(CSSValueNone); | 1066 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1067 | 1067 |
| 1068 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 1068 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 1069 for (const auto& item : *map) { | 1069 for (const auto& item : *map) { |
| 1070 bool isValidCounterValue = propertyID == CSSPropertyCounterIncrement ? i
tem.value.isIncrement() : item.value.isReset(); | 1070 bool isValidCounterValue = propertyID == CSSPropertyCounterIncrement ? i
tem.value.isIncrement() : item.value.isReset(); |
| 1071 if (!isValidCounterValue) | 1071 if (!isValidCounterValue) |
| 1072 continue; | 1072 continue; |
| 1073 | 1073 |
| 1074 list->append(CSSCustomIdentValue::create(item.key)); | 1074 list->append(CSSCustomIdentValue::create(item.key)); |
| 1075 short number = propertyID == CSSPropertyCounterIncrement ? item.value.in
crementValue() : item.value.resetValue(); | 1075 short number = propertyID == CSSPropertyCounterIncrement ? item.value.in
crementValue() : item.value.resetValue(); |
| 1076 list->append(cssValuePool().createValue((double)number, CSSPrimitiveValu
e::UnitType::Integer)); | 1076 list->append(cssValuePool().createValue((double)number, CSSPrimitiveValu
e::UnitType::Integer)); |
| 1077 } | 1077 } |
| 1078 | 1078 |
| 1079 if (!list->length()) | 1079 if (!list->length()) |
| 1080 return cssValuePool().createIdentifierValue(CSSValueNone); | 1080 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1081 | 1081 |
| 1082 return list.release(); | 1082 return list; |
| 1083 } | 1083 } |
| 1084 | 1084 |
| 1085 static RawPtr<CSSValue> valueForShape(const ComputedStyle& style, ShapeValue* sh
apeValue) | 1085 static CSSValue* valueForShape(const ComputedStyle& style, ShapeValue* shapeValu
e) |
| 1086 { | 1086 { |
| 1087 if (!shapeValue) | 1087 if (!shapeValue) |
| 1088 return cssValuePool().createIdentifierValue(CSSValueNone); | 1088 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1089 if (shapeValue->type() == ShapeValue::Box) | 1089 if (shapeValue->type() == ShapeValue::Box) |
| 1090 return cssValuePool().createValue(shapeValue->cssBox()); | 1090 return cssValuePool().createValue(shapeValue->cssBox()); |
| 1091 if (shapeValue->type() == ShapeValue::Image) { | 1091 if (shapeValue->type() == ShapeValue::Image) { |
| 1092 if (shapeValue->image()) | 1092 if (shapeValue->image()) |
| 1093 return shapeValue->image()->computedCSSValue(); | 1093 return shapeValue->image()->computedCSSValue(); |
| 1094 return cssValuePool().createIdentifierValue(CSSValueNone); | 1094 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1095 } | 1095 } |
| 1096 | 1096 |
| 1097 ASSERT(shapeValue->type() == ShapeValue::Shape); | 1097 ASSERT(shapeValue->type() == ShapeValue::Shape); |
| 1098 | 1098 |
| 1099 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 1099 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 1100 list->append(valueForBasicShape(style, shapeValue->shape())); | 1100 list->append(valueForBasicShape(style, shapeValue->shape())); |
| 1101 if (shapeValue->cssBox() != BoxMissing) | 1101 if (shapeValue->cssBox() != BoxMissing) |
| 1102 list->append(cssValuePool().createValue(shapeValue->cssBox())); | 1102 list->append(cssValuePool().createValue(shapeValue->cssBox())); |
| 1103 return list.release(); | 1103 return list; |
| 1104 } | 1104 } |
| 1105 | 1105 |
| 1106 static RawPtr<CSSValueList> valuesForSidesShorthand(const StylePropertyShorthand
& shorthand, const ComputedStyle& style, const LayoutObject* layoutObject, Node*
styledNode, bool allowVisitedStyle) | 1106 static CSSValueList* valuesForSidesShorthand(const StylePropertyShorthand& short
hand, const ComputedStyle& style, const LayoutObject* layoutObject, Node* styled
Node, bool allowVisitedStyle) |
| 1107 { | 1107 { |
| 1108 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 1108 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 1109 // Assume the properties are in the usual order top, right, bottom, left. | 1109 // Assume the properties are in the usual order top, right, bottom, left. |
| 1110 RawPtr<CSSValue> topValue = ComputedStyleCSSValueMapping::get(shorthand.prop
erties()[0], style, layoutObject, styledNode, allowVisitedStyle); | 1110 CSSValue* topValue = ComputedStyleCSSValueMapping::get(shorthand.properties(
)[0], style, layoutObject, styledNode, allowVisitedStyle); |
| 1111 RawPtr<CSSValue> rightValue = ComputedStyleCSSValueMapping::get(shorthand.pr
operties()[1], style, layoutObject, styledNode, allowVisitedStyle); | 1111 CSSValue* rightValue = ComputedStyleCSSValueMapping::get(shorthand.propertie
s()[1], style, layoutObject, styledNode, allowVisitedStyle); |
| 1112 RawPtr<CSSValue> bottomValue = ComputedStyleCSSValueMapping::get(shorthand.p
roperties()[2], style, layoutObject, styledNode, allowVisitedStyle); | 1112 CSSValue* bottomValue = ComputedStyleCSSValueMapping::get(shorthand.properti
es()[2], style, layoutObject, styledNode, allowVisitedStyle); |
| 1113 RawPtr<CSSValue> leftValue = ComputedStyleCSSValueMapping::get(shorthand.pro
perties()[3], style, layoutObject, styledNode, allowVisitedStyle); | 1113 CSSValue* leftValue = ComputedStyleCSSValueMapping::get(shorthand.properties
()[3], style, layoutObject, styledNode, allowVisitedStyle); |
| 1114 | 1114 |
| 1115 // All 4 properties must be specified. | 1115 // All 4 properties must be specified. |
| 1116 if (!topValue || !rightValue || !bottomValue || !leftValue) | 1116 if (!topValue || !rightValue || !bottomValue || !leftValue) |
| 1117 return nullptr; | 1117 return nullptr; |
| 1118 | 1118 |
| 1119 bool showLeft = !compareCSSValuePtr(rightValue, leftValue); | 1119 bool showLeft = !compareCSSValuePtr(rightValue, leftValue); |
| 1120 bool showBottom = !compareCSSValuePtr(topValue, bottomValue) || showLeft; | 1120 bool showBottom = !compareCSSValuePtr(topValue, bottomValue) || showLeft; |
| 1121 bool showRight = !compareCSSValuePtr(topValue, rightValue) || showBottom; | 1121 bool showRight = !compareCSSValuePtr(topValue, rightValue) || showBottom; |
| 1122 | 1122 |
| 1123 list->append(topValue.release()); | 1123 list->append(topValue); |
| 1124 if (showRight) | 1124 if (showRight) |
| 1125 list->append(rightValue.release()); | 1125 list->append(rightValue); |
| 1126 if (showBottom) | 1126 if (showBottom) |
| 1127 list->append(bottomValue.release()); | 1127 list->append(bottomValue); |
| 1128 if (showLeft) | 1128 if (showLeft) |
| 1129 list->append(leftValue.release()); | 1129 list->append(leftValue); |
| 1130 | 1130 |
| 1131 return list.release(); | 1131 return list; |
| 1132 } | 1132 } |
| 1133 | 1133 |
| 1134 static RawPtr<CSSValueList> valueForBorderRadiusShorthand(const ComputedStyle& s
tyle) | 1134 static CSSValueList* valueForBorderRadiusShorthand(const ComputedStyle& style) |
| 1135 { | 1135 { |
| 1136 RawPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); | 1136 CSSValueList* list = CSSValueList::createSlashSeparated(); |
| 1137 | 1137 |
| 1138 bool showHorizontalBottomLeft = style.borderTopRightRadius().width() != styl
e.borderBottomLeftRadius().width(); | 1138 bool showHorizontalBottomLeft = style.borderTopRightRadius().width() != styl
e.borderBottomLeftRadius().width(); |
| 1139 bool showHorizontalBottomRight = showHorizontalBottomLeft || (style.borderBo
ttomRightRadius().width() != style.borderTopLeftRadius().width()); | 1139 bool showHorizontalBottomRight = showHorizontalBottomLeft || (style.borderBo
ttomRightRadius().width() != style.borderTopLeftRadius().width()); |
| 1140 bool showHorizontalTopRight = showHorizontalBottomRight || (style.borderTopR
ightRadius().width() != style.borderTopLeftRadius().width()); | 1140 bool showHorizontalTopRight = showHorizontalBottomRight || (style.borderTopR
ightRadius().width() != style.borderTopLeftRadius().width()); |
| 1141 | 1141 |
| 1142 bool showVerticalBottomLeft = style.borderTopRightRadius().height() != style
.borderBottomLeftRadius().height(); | 1142 bool showVerticalBottomLeft = style.borderTopRightRadius().height() != style
.borderBottomLeftRadius().height(); |
| 1143 bool showVerticalBottomRight = showVerticalBottomLeft || (style.borderBottom
RightRadius().height() != style.borderTopLeftRadius().height()); | 1143 bool showVerticalBottomRight = showVerticalBottomLeft || (style.borderBottom
RightRadius().height() != style.borderTopLeftRadius().height()); |
| 1144 bool showVerticalTopRight = showVerticalBottomRight || (style.borderTopRight
Radius().height() != style.borderTopLeftRadius().height()); | 1144 bool showVerticalTopRight = showVerticalBottomRight || (style.borderTopRight
Radius().height() != style.borderTopLeftRadius().height()); |
| 1145 | 1145 |
| 1146 RawPtr<CSSValueList> topLeftRadius = valuesForBorderRadiusCorner(style.borde
rTopLeftRadius(), style); | 1146 CSSValueList* topLeftRadius = valuesForBorderRadiusCorner(style.borderTopLef
tRadius(), style); |
| 1147 RawPtr<CSSValueList> topRightRadius = valuesForBorderRadiusCorner(style.bord
erTopRightRadius(), style); | 1147 CSSValueList* topRightRadius = valuesForBorderRadiusCorner(style.borderTopRi
ghtRadius(), style); |
| 1148 RawPtr<CSSValueList> bottomRightRadius = valuesForBorderRadiusCorner(style.b
orderBottomRightRadius(), style); | 1148 CSSValueList* bottomRightRadius = valuesForBorderRadiusCorner(style.borderBo
ttomRightRadius(), style); |
| 1149 RawPtr<CSSValueList> bottomLeftRadius = valuesForBorderRadiusCorner(style.bo
rderBottomLeftRadius(), style); | 1149 CSSValueList* bottomLeftRadius = valuesForBorderRadiusCorner(style.borderBot
tomLeftRadius(), style); |
| 1150 | 1150 |
| 1151 RawPtr<CSSValueList> horizontalRadii = CSSValueList::createSpaceSeparated(); | 1151 CSSValueList* horizontalRadii = CSSValueList::createSpaceSeparated(); |
| 1152 horizontalRadii->append(topLeftRadius->item(0)); | 1152 horizontalRadii->append(topLeftRadius->item(0)); |
| 1153 if (showHorizontalTopRight) | 1153 if (showHorizontalTopRight) |
| 1154 horizontalRadii->append(topRightRadius->item(0)); | 1154 horizontalRadii->append(topRightRadius->item(0)); |
| 1155 if (showHorizontalBottomRight) | 1155 if (showHorizontalBottomRight) |
| 1156 horizontalRadii->append(bottomRightRadius->item(0)); | 1156 horizontalRadii->append(bottomRightRadius->item(0)); |
| 1157 if (showHorizontalBottomLeft) | 1157 if (showHorizontalBottomLeft) |
| 1158 horizontalRadii->append(bottomLeftRadius->item(0)); | 1158 horizontalRadii->append(bottomLeftRadius->item(0)); |
| 1159 | 1159 |
| 1160 list->append(horizontalRadii.release()); | 1160 list->append(horizontalRadii); |
| 1161 | 1161 |
| 1162 RawPtr<CSSValueList> verticalRadii = CSSValueList::createSpaceSeparated(); | 1162 CSSValueList* verticalRadii = CSSValueList::createSpaceSeparated(); |
| 1163 verticalRadii->append(topLeftRadius->item(1)); | 1163 verticalRadii->append(topLeftRadius->item(1)); |
| 1164 if (showVerticalTopRight) | 1164 if (showVerticalTopRight) |
| 1165 verticalRadii->append(topRightRadius->item(1)); | 1165 verticalRadii->append(topRightRadius->item(1)); |
| 1166 if (showVerticalBottomRight) | 1166 if (showVerticalBottomRight) |
| 1167 verticalRadii->append(bottomRightRadius->item(1)); | 1167 verticalRadii->append(bottomRightRadius->item(1)); |
| 1168 if (showVerticalBottomLeft) | 1168 if (showVerticalBottomLeft) |
| 1169 verticalRadii->append(bottomLeftRadius->item(1)); | 1169 verticalRadii->append(bottomLeftRadius->item(1)); |
| 1170 | 1170 |
| 1171 if (!verticalRadii->equals(*toCSSValueList(list->item(0)))) | 1171 if (!verticalRadii->equals(*toCSSValueList(list->item(0)))) |
| 1172 list->append(verticalRadii.release()); | 1172 list->append(verticalRadii); |
| 1173 | 1173 |
| 1174 return list.release(); | 1174 return list; |
| 1175 } | 1175 } |
| 1176 | 1176 |
| 1177 static RawPtr<CSSValue> strokeDashArrayToCSSValueList(const SVGDashArray& dashes
, const ComputedStyle& style) | 1177 static CSSValue* strokeDashArrayToCSSValueList(const SVGDashArray& dashes, const
ComputedStyle& style) |
| 1178 { | 1178 { |
| 1179 if (dashes.isEmpty()) | 1179 if (dashes.isEmpty()) |
| 1180 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | 1180 return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
| 1181 | 1181 |
| 1182 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 1182 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 1183 for (const Length& dashLength : dashes.vector()) | 1183 for (const Length& dashLength : dashes.vector()) |
| 1184 list->append(zoomAdjustedPixelValueForLength(dashLength, style)); | 1184 list->append(zoomAdjustedPixelValueForLength(dashLength, style)); |
| 1185 | 1185 |
| 1186 return list.release(); | 1186 return list; |
| 1187 } | 1187 } |
| 1188 | 1188 |
| 1189 static RawPtr<CSSValue> paintOrderToCSSValueList(const SVGComputedStyle& svgStyl
e) | 1189 static CSSValue* paintOrderToCSSValueList(const SVGComputedStyle& svgStyle) |
| 1190 { | 1190 { |
| 1191 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 1191 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 1192 for (int i = 0; i < 3; i++) { | 1192 for (int i = 0; i < 3; i++) { |
| 1193 EPaintOrderType paintOrderType = svgStyle.paintOrderType(i); | 1193 EPaintOrderType paintOrderType = svgStyle.paintOrderType(i); |
| 1194 switch (paintOrderType) { | 1194 switch (paintOrderType) { |
| 1195 case PT_FILL: | 1195 case PT_FILL: |
| 1196 case PT_STROKE: | 1196 case PT_STROKE: |
| 1197 case PT_MARKERS: | 1197 case PT_MARKERS: |
| 1198 list->append(CSSPrimitiveValue::create(paintOrderType)); | 1198 list->append(CSSPrimitiveValue::create(paintOrderType)); |
| 1199 break; | 1199 break; |
| 1200 case PT_NONE: | 1200 case PT_NONE: |
| 1201 default: | 1201 default: |
| 1202 ASSERT_NOT_REACHED(); | 1202 ASSERT_NOT_REACHED(); |
| 1203 break; | 1203 break; |
| 1204 } | 1204 } |
| 1205 } | 1205 } |
| 1206 | 1206 |
| 1207 return list.release(); | 1207 return list; |
| 1208 } | 1208 } |
| 1209 | 1209 |
| 1210 static RawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintType paintType, co
nst String& url, const Color& color, const Color& currentColor) | 1210 static CSSValue* adjustSVGPaintForCurrentColor(SVGPaintType paintType, const Str
ing& url, const Color& color, const Color& currentColor) |
| 1211 { | 1211 { |
| 1212 if (paintType >= SVG_PAINTTYPE_URI_NONE) { | 1212 if (paintType >= SVG_PAINTTYPE_URI_NONE) { |
| 1213 RawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated(); | 1213 CSSValueList* values = CSSValueList::createSpaceSeparated(); |
| 1214 values->append(CSSURIValue::create(url)); | 1214 values->append(CSSURIValue::create(url)); |
| 1215 if (paintType == SVG_PAINTTYPE_URI_NONE) | 1215 if (paintType == SVG_PAINTTYPE_URI_NONE) |
| 1216 values->append(CSSPrimitiveValue::createIdentifier(CSSValueNone)); | 1216 values->append(CSSPrimitiveValue::createIdentifier(CSSValueNone)); |
| 1217 else if (paintType == SVG_PAINTTYPE_URI_CURRENTCOLOR) | 1217 else if (paintType == SVG_PAINTTYPE_URI_CURRENTCOLOR) |
| 1218 values->append(CSSColorValue::create(currentColor.rgb())); | 1218 values->append(CSSColorValue::create(currentColor.rgb())); |
| 1219 else if (paintType == SVG_PAINTTYPE_URI_RGBCOLOR) | 1219 else if (paintType == SVG_PAINTTYPE_URI_RGBCOLOR) |
| 1220 values->append(CSSColorValue::create(color.rgb())); | 1220 values->append(CSSColorValue::create(color.rgb())); |
| 1221 return values.release(); | 1221 return values; |
| 1222 } | 1222 } |
| 1223 if (paintType == SVG_PAINTTYPE_NONE) | 1223 if (paintType == SVG_PAINTTYPE_NONE) |
| 1224 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | 1224 return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
| 1225 if (paintType == SVG_PAINTTYPE_CURRENTCOLOR) | 1225 if (paintType == SVG_PAINTTYPE_CURRENTCOLOR) |
| 1226 return CSSColorValue::create(currentColor.rgb()); | 1226 return CSSColorValue::create(currentColor.rgb()); |
| 1227 | 1227 |
| 1228 return CSSColorValue::create(color.rgb()); | 1228 return CSSColorValue::create(color.rgb()); |
| 1229 } | 1229 } |
| 1230 | 1230 |
| 1231 static inline String serializeAsFragmentIdentifier(const AtomicString& resource) | 1231 static inline String serializeAsFragmentIdentifier(const AtomicString& resource) |
| 1232 { | 1232 { |
| 1233 return "#" + resource; | 1233 return "#" + resource; |
| 1234 } | 1234 } |
| 1235 | 1235 |
| 1236 RawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowData(const ShadowDa
ta& shadow, const ComputedStyle& style, bool useSpread) | 1236 CSSValue* ComputedStyleCSSValueMapping::valueForShadowData(const ShadowData& sha
dow, const ComputedStyle& style, bool useSpread) |
| 1237 { | 1237 { |
| 1238 RawPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(shadow.x(), style); | 1238 CSSPrimitiveValue* x = zoomAdjustedPixelValue(shadow.x(), style); |
| 1239 RawPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(shadow.y(), style); | 1239 CSSPrimitiveValue* y = zoomAdjustedPixelValue(shadow.y(), style); |
| 1240 RawPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(shadow.blur(), style
); | 1240 CSSPrimitiveValue* blur = zoomAdjustedPixelValue(shadow.blur(), style); |
| 1241 RawPtr<CSSPrimitiveValue> spread = useSpread ? zoomAdjustedPixelValue(shadow
.spread(), style) : RawPtr<CSSPrimitiveValue>(nullptr); | 1241 CSSPrimitiveValue* spread = useSpread ? zoomAdjustedPixelValue(shadow.spread
(), style) : nullptr; |
| 1242 RawPtr<CSSPrimitiveValue> shadowStyle = shadow.style() == Normal ? RawPtr<CS
SPrimitiveValue>(nullptr) : cssValuePool().createIdentifierValue(CSSValueInset); | 1242 CSSPrimitiveValue* shadowStyle = shadow.style() == Normal ? nullptr : cssVal
uePool().createIdentifierValue(CSSValueInset); |
| 1243 RawPtr<CSSValue> color = currentColorOrValidColor(style, shadow.color()); | 1243 CSSValue* color = currentColorOrValidColor(style, shadow.color()); |
| 1244 return CSSShadowValue::create(x.release(), y.release(), blur.release(), spre
ad.release(), shadowStyle.release(), color.release()); | 1244 return CSSShadowValue::create(x, y, blur, spread, shadowStyle, color); |
| 1245 } | 1245 } |
| 1246 | 1246 |
| 1247 RawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowList(const ShadowLi
st* shadowList, const ComputedStyle& style, bool useSpread) | 1247 CSSValue* ComputedStyleCSSValueMapping::valueForShadowList(const ShadowList* sha
dowList, const ComputedStyle& style, bool useSpread) |
| 1248 { | 1248 { |
| 1249 if (!shadowList) | 1249 if (!shadowList) |
| 1250 return cssValuePool().createIdentifierValue(CSSValueNone); | 1250 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1251 | 1251 |
| 1252 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 1252 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 1253 size_t shadowCount = shadowList->shadows().size(); | 1253 size_t shadowCount = shadowList->shadows().size(); |
| 1254 for (size_t i = 0; i < shadowCount; ++i) | 1254 for (size_t i = 0; i < shadowCount; ++i) |
| 1255 list->append(valueForShadowData(shadowList->shadows()[i], style, useSpre
ad)); | 1255 list->append(valueForShadowData(shadowList->shadows()[i], style, useSpre
ad)); |
| 1256 return list.release(); | 1256 return list; |
| 1257 } | 1257 } |
| 1258 | 1258 |
| 1259 RawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForFilter(const ComputedStyl
e& style, const FilterOperations& filterOperations) | 1259 CSSValue* ComputedStyleCSSValueMapping::valueForFilter(const ComputedStyle& styl
e, const FilterOperations& filterOperations) |
| 1260 { | 1260 { |
| 1261 if (filterOperations.operations().isEmpty()) | 1261 if (filterOperations.operations().isEmpty()) |
| 1262 return cssValuePool().createIdentifierValue(CSSValueNone); | 1262 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1263 | 1263 |
| 1264 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 1264 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 1265 | 1265 |
| 1266 RawPtr<CSSFunctionValue> filterValue = nullptr; | 1266 CSSFunctionValue* filterValue = nullptr; |
| 1267 | 1267 |
| 1268 for (const auto& operation : filterOperations.operations()) { | 1268 for (const auto& operation : filterOperations.operations()) { |
| 1269 FilterOperation* filterOperation = operation.get(); | 1269 FilterOperation* filterOperation = operation.get(); |
| 1270 switch (filterOperation->type()) { | 1270 switch (filterOperation->type()) { |
| 1271 case FilterOperation::REFERENCE: | 1271 case FilterOperation::REFERENCE: |
| 1272 filterValue = CSSFunctionValue::create(CSSValueUrl); | 1272 filterValue = CSSFunctionValue::create(CSSValueUrl); |
| 1273 filterValue->append(CSSStringValue::create(toReferenceFilterOperatio
n(filterOperation)->url())); | 1273 filterValue->append(CSSStringValue::create(toReferenceFilterOperatio
n(filterOperation)->url())); |
| 1274 break; | 1274 break; |
| 1275 case FilterOperation::GRAYSCALE: | 1275 case FilterOperation::GRAYSCALE: |
| 1276 filterValue = CSSFunctionValue::create(CSSValueGrayscale); | 1276 filterValue = CSSFunctionValue::create(CSSValueGrayscale); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 filterValue = CSSFunctionValue::create(CSSValueDropShadow); | 1313 filterValue = CSSFunctionValue::create(CSSValueDropShadow); |
| 1314 // We want our computed style to look like that of a text shadow (ha
s neither spread nor inset style). | 1314 // We want our computed style to look like that of a text shadow (ha
s neither spread nor inset style). |
| 1315 ShadowData shadow(dropShadowOperation->location(), dropShadowOperati
on->stdDeviation(), 0, Normal, StyleColor(dropShadowOperation->getColor())); | 1315 ShadowData shadow(dropShadowOperation->location(), dropShadowOperati
on->stdDeviation(), 0, Normal, StyleColor(dropShadowOperation->getColor())); |
| 1316 filterValue->append(valueForShadowData(shadow, style, false)); | 1316 filterValue->append(valueForShadowData(shadow, style, false)); |
| 1317 break; | 1317 break; |
| 1318 } | 1318 } |
| 1319 default: | 1319 default: |
| 1320 ASSERT_NOT_REACHED(); | 1320 ASSERT_NOT_REACHED(); |
| 1321 break; | 1321 break; |
| 1322 } | 1322 } |
| 1323 list->append(filterValue.release()); | 1323 list->append(filterValue); |
| 1324 } | 1324 } |
| 1325 | 1325 |
| 1326 return list.release(); | 1326 return list; |
| 1327 } | 1327 } |
| 1328 | 1328 |
| 1329 RawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForFont(const ComputedStyle&
style) | 1329 CSSValue* ComputedStyleCSSValueMapping::valueForFont(const ComputedStyle& style) |
| 1330 { | 1330 { |
| 1331 // Add a slash between size and line-height. | 1331 // Add a slash between size and line-height. |
| 1332 RawPtr<CSSValueList> sizeAndLineHeight = CSSValueList::createSlashSeparated(
); | 1332 CSSValueList* sizeAndLineHeight = CSSValueList::createSlashSeparated(); |
| 1333 sizeAndLineHeight->append(valueForFontSize(style)); | 1333 sizeAndLineHeight->append(valueForFontSize(style)); |
| 1334 sizeAndLineHeight->append(valueForLineHeight(style)); | 1334 sizeAndLineHeight->append(valueForLineHeight(style)); |
| 1335 | 1335 |
| 1336 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 1336 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 1337 list->append(valueForFontStyle(style)); | 1337 list->append(valueForFontStyle(style)); |
| 1338 list->append(valueForFontVariant(style)); | 1338 list->append(valueForFontVariant(style)); |
| 1339 list->append(valueForFontWeight(style)); | 1339 list->append(valueForFontWeight(style)); |
| 1340 list->append(valueForFontStretch(style)); | 1340 list->append(valueForFontStretch(style)); |
| 1341 list->append(sizeAndLineHeight.release()); | 1341 list->append(sizeAndLineHeight); |
| 1342 list->append(valueForFontFamily(style)); | 1342 list->append(valueForFontFamily(style)); |
| 1343 | 1343 |
| 1344 return list.release(); | 1344 return list; |
| 1345 } | 1345 } |
| 1346 | 1346 |
| 1347 static RawPtr<CSSValue> valueForScrollSnapDestination(const LengthPoint& destina
tion, const ComputedStyle& style) | 1347 static CSSValue* valueForScrollSnapDestination(const LengthPoint& destination, c
onst ComputedStyle& style) |
| 1348 { | 1348 { |
| 1349 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 1349 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 1350 list->append(zoomAdjustedPixelValueForLength(destination.x(), style)); | 1350 list->append(zoomAdjustedPixelValueForLength(destination.x(), style)); |
| 1351 list->append(zoomAdjustedPixelValueForLength(destination.y(), style)); | 1351 list->append(zoomAdjustedPixelValueForLength(destination.y(), style)); |
| 1352 return list.release(); | 1352 return list; |
| 1353 } | 1353 } |
| 1354 | 1354 |
| 1355 static RawPtr<CSSValue> valueForScrollSnapPoints(const ScrollSnapPoints& points,
const ComputedStyle& style) | 1355 static CSSValue* valueForScrollSnapPoints(const ScrollSnapPoints& points, const
ComputedStyle& style) |
| 1356 { | 1356 { |
| 1357 if (points.hasRepeat) { | 1357 if (points.hasRepeat) { |
| 1358 RawPtr<CSSFunctionValue> repeat = CSSFunctionValue::create(CSSValueRepea
t); | 1358 CSSFunctionValue* repeat = CSSFunctionValue::create(CSSValueRepeat); |
| 1359 repeat->append(zoomAdjustedPixelValueForLength(points.repeatOffset, styl
e)); | 1359 repeat->append(zoomAdjustedPixelValueForLength(points.repeatOffset, styl
e)); |
| 1360 return repeat.release(); | 1360 return repeat; |
| 1361 } | 1361 } |
| 1362 | 1362 |
| 1363 return cssValuePool().createIdentifierValue(CSSValueNone); | 1363 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1364 } | 1364 } |
| 1365 | 1365 |
| 1366 static RawPtr<CSSValue> valueForScrollSnapCoordinate(const Vector<LengthPoint>&
coordinates, const ComputedStyle& style) | 1366 static CSSValue* valueForScrollSnapCoordinate(const Vector<LengthPoint>& coordin
ates, const ComputedStyle& style) |
| 1367 { | 1367 { |
| 1368 if (coordinates.isEmpty()) | 1368 if (coordinates.isEmpty()) |
| 1369 return cssValuePool().createIdentifierValue(CSSValueNone); | 1369 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1370 | 1370 |
| 1371 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 1371 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 1372 | 1372 |
| 1373 for (auto& coordinate : coordinates) { | 1373 for (auto& coordinate : coordinates) { |
| 1374 auto pair = CSSValueList::createSpaceSeparated(); | 1374 auto pair = CSSValueList::createSpaceSeparated(); |
| 1375 pair->append(zoomAdjustedPixelValueForLength(coordinate.x(), style)); | 1375 pair->append(zoomAdjustedPixelValueForLength(coordinate.x(), style)); |
| 1376 pair->append(zoomAdjustedPixelValueForLength(coordinate.y(), style)); | 1376 pair->append(zoomAdjustedPixelValueForLength(coordinate.y(), style)); |
| 1377 list->append(pair); | 1377 list->append(pair); |
| 1378 } | 1378 } |
| 1379 | 1379 |
| 1380 return list.release(); | 1380 return list; |
| 1381 } | 1381 } |
| 1382 | 1382 |
| 1383 static EBreak mapToPageBreakValue(EBreak genericBreakValue) | 1383 static EBreak mapToPageBreakValue(EBreak genericBreakValue) |
| 1384 { | 1384 { |
| 1385 switch (genericBreakValue) { | 1385 switch (genericBreakValue) { |
| 1386 case BreakAvoidColumn: | 1386 case BreakAvoidColumn: |
| 1387 case BreakColumn: | 1387 case BreakColumn: |
| 1388 case BreakRecto: | 1388 case BreakRecto: |
| 1389 case BreakVerso: | 1389 case BreakVerso: |
| 1390 return BreakAuto; | 1390 return BreakAuto; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1409 return BreakAuto; | 1409 return BreakAuto; |
| 1410 case BreakColumn: | 1410 case BreakColumn: |
| 1411 return BreakAlways; | 1411 return BreakAlways; |
| 1412 case BreakAvoidColumn: | 1412 case BreakAvoidColumn: |
| 1413 return BreakAvoid; | 1413 return BreakAvoid; |
| 1414 default: | 1414 default: |
| 1415 return genericBreakValue; | 1415 return genericBreakValue; |
| 1416 } | 1416 } |
| 1417 } | 1417 } |
| 1418 | 1418 |
| 1419 RawPtr<CSSValue> ComputedStyleCSSValueMapping::get(const AtomicString customProp
ertyName, const ComputedStyle& style) | 1419 CSSValue* ComputedStyleCSSValueMapping::get(const AtomicString customPropertyNam
e, const ComputedStyle& style) |
| 1420 { | 1420 { |
| 1421 StyleVariableData* variables = style.variables(); | 1421 StyleVariableData* variables = style.variables(); |
| 1422 if (!variables) | 1422 if (!variables) |
| 1423 return nullptr; | 1423 return nullptr; |
| 1424 | 1424 |
| 1425 CSSVariableData* data = variables->getVariable(customPropertyName); | 1425 CSSVariableData* data = variables->getVariable(customPropertyName); |
| 1426 if (!data) | 1426 if (!data) |
| 1427 return nullptr; | 1427 return nullptr; |
| 1428 | 1428 |
| 1429 return CSSCustomPropertyDeclaration::create(customPropertyName, data); | 1429 return CSSCustomPropertyDeclaration::create(customPropertyName, data); |
| 1430 } | 1430 } |
| 1431 | 1431 |
| 1432 const HashMap<AtomicString, RefPtr<CSSVariableData>>* ComputedStyleCSSValueMappi
ng::getVariables(const ComputedStyle& style) | 1432 const HashMap<AtomicString, RefPtr<CSSVariableData>>* ComputedStyleCSSValueMappi
ng::getVariables(const ComputedStyle& style) |
| 1433 { | 1433 { |
| 1434 StyleVariableData* variables = style.variables(); | 1434 StyleVariableData* variables = style.variables(); |
| 1435 if (variables) | 1435 if (variables) |
| 1436 return variables->getVariables(); | 1436 return variables->getVariables(); |
| 1437 return nullptr; | 1437 return nullptr; |
| 1438 } | 1438 } |
| 1439 | 1439 |
| 1440 RawPtr<CSSValue> ComputedStyleCSSValueMapping::get(CSSPropertyID propertyID, con
st ComputedStyle& style, const LayoutObject* layoutObject, Node* styledNode, boo
l allowVisitedStyle) | 1440 CSSValue* ComputedStyleCSSValueMapping::get(CSSPropertyID propertyID, const Comp
utedStyle& style, const LayoutObject* layoutObject, Node* styledNode, bool allow
VisitedStyle) |
| 1441 { | 1441 { |
| 1442 const SVGComputedStyle& svgStyle = style.svgStyle(); | 1442 const SVGComputedStyle& svgStyle = style.svgStyle(); |
| 1443 propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style.di
rection(), style.getWritingMode()); | 1443 propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style.di
rection(), style.getWritingMode()); |
| 1444 switch (propertyID) { | 1444 switch (propertyID) { |
| 1445 case CSSPropertyInvalid: | 1445 case CSSPropertyInvalid: |
| 1446 return nullptr; | 1446 return nullptr; |
| 1447 | 1447 |
| 1448 case CSSPropertyBackgroundColor: | 1448 case CSSPropertyBackgroundColor: |
| 1449 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited
DependentColor(CSSPropertyBackgroundColor).rgb()) : currentColorOrValidColor(sty
le, style.backgroundColor()); | 1449 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited
DependentColor(CSSPropertyBackgroundColor).rgb()) : currentColorOrValidColor(sty
le, style.backgroundColor()); |
| 1450 case CSSPropertyBackgroundImage: | 1450 case CSSPropertyBackgroundImage: |
| 1451 case CSSPropertyWebkitMaskImage: { | 1451 case CSSPropertyWebkitMaskImage: { |
| 1452 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 1452 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 1453 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskImage ?
&style.maskLayers() : &style.backgroundLayers(); | 1453 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskImage ?
&style.maskLayers() : &style.backgroundLayers(); |
| 1454 for (; currLayer; currLayer = currLayer->next()) { | 1454 for (; currLayer; currLayer = currLayer->next()) { |
| 1455 if (currLayer->image()) | 1455 if (currLayer->image()) |
| 1456 list->append(currLayer->image()->computedCSSValue()); | 1456 list->append(currLayer->image()->computedCSSValue()); |
| 1457 else | 1457 else |
| 1458 list->append(cssValuePool().createIdentifierValue(CSSValueNone))
; | 1458 list->append(cssValuePool().createIdentifierValue(CSSValueNone))
; |
| 1459 } | 1459 } |
| 1460 return list.release(); | 1460 return list; |
| 1461 } | 1461 } |
| 1462 case CSSPropertyBackgroundSize: | 1462 case CSSPropertyBackgroundSize: |
| 1463 case CSSPropertyWebkitMaskSize: { | 1463 case CSSPropertyWebkitMaskSize: { |
| 1464 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 1464 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 1465 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskSize ? &
style.maskLayers() : &style.backgroundLayers(); | 1465 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskSize ? &
style.maskLayers() : &style.backgroundLayers(); |
| 1466 for (; currLayer; currLayer = currLayer->next()) | 1466 for (; currLayer; currLayer = currLayer->next()) |
| 1467 list->append(valueForFillSize(currLayer->size(), style)); | 1467 list->append(valueForFillSize(currLayer->size(), style)); |
| 1468 return list.release(); | 1468 return list; |
| 1469 } | 1469 } |
| 1470 case CSSPropertyBackgroundRepeat: | 1470 case CSSPropertyBackgroundRepeat: |
| 1471 case CSSPropertyWebkitMaskRepeat: { | 1471 case CSSPropertyWebkitMaskRepeat: { |
| 1472 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 1472 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 1473 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskRepeat ?
&style.maskLayers() : &style.backgroundLayers(); | 1473 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskRepeat ?
&style.maskLayers() : &style.backgroundLayers(); |
| 1474 for (; currLayer; currLayer = currLayer->next()) | 1474 for (; currLayer; currLayer = currLayer->next()) |
| 1475 list->append(valueForFillRepeat(currLayer->repeatX(), currLayer->rep
eatY())); | 1475 list->append(valueForFillRepeat(currLayer->repeatX(), currLayer->rep
eatY())); |
| 1476 return list.release(); | 1476 return list; |
| 1477 } | 1477 } |
| 1478 case CSSPropertyMaskSourceType: { | 1478 case CSSPropertyMaskSourceType: { |
| 1479 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 1479 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 1480 for (const FillLayer* currLayer = &style.maskLayers(); currLayer; currLa
yer = currLayer->next()) | 1480 for (const FillLayer* currLayer = &style.maskLayers(); currLayer; currLa
yer = currLayer->next()) |
| 1481 list->append(valueForFillSourceType(currLayer->maskSourceType())); | 1481 list->append(valueForFillSourceType(currLayer->maskSourceType())); |
| 1482 return list.release(); | 1482 return list; |
| 1483 } | 1483 } |
| 1484 case CSSPropertyWebkitMaskComposite: { | 1484 case CSSPropertyWebkitMaskComposite: { |
| 1485 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 1485 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 1486 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskComposit
e ? &style.maskLayers() : &style.backgroundLayers(); | 1486 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskComposit
e ? &style.maskLayers() : &style.backgroundLayers(); |
| 1487 for (; currLayer; currLayer = currLayer->next()) | 1487 for (; currLayer; currLayer = currLayer->next()) |
| 1488 list->append(cssValuePool().createValue(currLayer->composite())); | 1488 list->append(cssValuePool().createValue(currLayer->composite())); |
| 1489 return list.release(); | 1489 return list; |
| 1490 } | 1490 } |
| 1491 case CSSPropertyBackgroundAttachment: { | 1491 case CSSPropertyBackgroundAttachment: { |
| 1492 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 1492 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 1493 for (const FillLayer* currLayer = &style.backgroundLayers(); currLayer;
currLayer = currLayer->next()) | 1493 for (const FillLayer* currLayer = &style.backgroundLayers(); currLayer;
currLayer = currLayer->next()) |
| 1494 list->append(cssValuePool().createValue(currLayer->attachment())); | 1494 list->append(cssValuePool().createValue(currLayer->attachment())); |
| 1495 return list.release(); | 1495 return list; |
| 1496 } | 1496 } |
| 1497 case CSSPropertyBackgroundClip: | 1497 case CSSPropertyBackgroundClip: |
| 1498 case CSSPropertyBackgroundOrigin: | 1498 case CSSPropertyBackgroundOrigin: |
| 1499 case CSSPropertyWebkitBackgroundClip: | 1499 case CSSPropertyWebkitBackgroundClip: |
| 1500 case CSSPropertyWebkitBackgroundOrigin: | 1500 case CSSPropertyWebkitBackgroundOrigin: |
| 1501 case CSSPropertyWebkitMaskClip: | 1501 case CSSPropertyWebkitMaskClip: |
| 1502 case CSSPropertyWebkitMaskOrigin: { | 1502 case CSSPropertyWebkitMaskOrigin: { |
| 1503 bool isClip = propertyID == CSSPropertyBackgroundClip || propertyID == C
SSPropertyWebkitBackgroundClip || propertyID == CSSPropertyWebkitMaskClip; | 1503 bool isClip = propertyID == CSSPropertyBackgroundClip || propertyID == C
SSPropertyWebkitBackgroundClip || propertyID == CSSPropertyWebkitMaskClip; |
| 1504 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 1504 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 1505 const FillLayer* currLayer = (propertyID == CSSPropertyWebkitMaskClip ||
propertyID == CSSPropertyWebkitMaskOrigin) ? &style.maskLayers() : &style.backg
roundLayers(); | 1505 const FillLayer* currLayer = (propertyID == CSSPropertyWebkitMaskClip ||
propertyID == CSSPropertyWebkitMaskOrigin) ? &style.maskLayers() : &style.backg
roundLayers(); |
| 1506 for (; currLayer; currLayer = currLayer->next()) { | 1506 for (; currLayer; currLayer = currLayer->next()) { |
| 1507 EFillBox box = isClip ? currLayer->clip() : currLayer->origin(); | 1507 EFillBox box = isClip ? currLayer->clip() : currLayer->origin(); |
| 1508 list->append(cssValuePool().createValue(box)); | 1508 list->append(cssValuePool().createValue(box)); |
| 1509 } | 1509 } |
| 1510 return list.release(); | 1510 return list; |
| 1511 } | 1511 } |
| 1512 case CSSPropertyBackgroundPosition: | 1512 case CSSPropertyBackgroundPosition: |
| 1513 case CSSPropertyWebkitMaskPosition: { | 1513 case CSSPropertyWebkitMaskPosition: { |
| 1514 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 1514 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 1515 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition
? &style.maskLayers() : &style.backgroundLayers(); | 1515 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition
? &style.maskLayers() : &style.backgroundLayers(); |
| 1516 for (; currLayer; currLayer = currLayer->next()) | 1516 for (; currLayer; currLayer = currLayer->next()) |
| 1517 list->append(createPositionListForLayer(propertyID, *currLayer, styl
e)); | 1517 list->append(createPositionListForLayer(propertyID, *currLayer, styl
e)); |
| 1518 return list.release(); | 1518 return list; |
| 1519 } | 1519 } |
| 1520 case CSSPropertyBackgroundPositionX: | 1520 case CSSPropertyBackgroundPositionX: |
| 1521 case CSSPropertyWebkitMaskPositionX: { | 1521 case CSSPropertyWebkitMaskPositionX: { |
| 1522 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 1522 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 1523 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition
X ? &style.maskLayers() : &style.backgroundLayers(); | 1523 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition
X ? &style.maskLayers() : &style.backgroundLayers(); |
| 1524 for (; currLayer; currLayer = currLayer->next()) | 1524 for (; currLayer; currLayer = currLayer->next()) |
| 1525 list->append(zoomAdjustedPixelValueForLength(currLayer->xPosition(),
style)); | 1525 list->append(zoomAdjustedPixelValueForLength(currLayer->xPosition(),
style)); |
| 1526 return list.release(); | 1526 return list; |
| 1527 } | 1527 } |
| 1528 case CSSPropertyBackgroundPositionY: | 1528 case CSSPropertyBackgroundPositionY: |
| 1529 case CSSPropertyWebkitMaskPositionY: { | 1529 case CSSPropertyWebkitMaskPositionY: { |
| 1530 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 1530 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 1531 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition
Y ? &style.maskLayers() : &style.backgroundLayers(); | 1531 const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskPosition
Y ? &style.maskLayers() : &style.backgroundLayers(); |
| 1532 for (; currLayer; currLayer = currLayer->next()) | 1532 for (; currLayer; currLayer = currLayer->next()) |
| 1533 list->append(zoomAdjustedPixelValueForLength(currLayer->yPosition(),
style)); | 1533 list->append(zoomAdjustedPixelValueForLength(currLayer->yPosition(),
style)); |
| 1534 return list.release(); | 1534 return list; |
| 1535 } | 1535 } |
| 1536 case CSSPropertyBorderCollapse: | 1536 case CSSPropertyBorderCollapse: |
| 1537 if (style.borderCollapse()) | 1537 if (style.borderCollapse()) |
| 1538 return cssValuePool().createIdentifierValue(CSSValueCollapse); | 1538 return cssValuePool().createIdentifierValue(CSSValueCollapse); |
| 1539 return cssValuePool().createIdentifierValue(CSSValueSeparate); | 1539 return cssValuePool().createIdentifierValue(CSSValueSeparate); |
| 1540 case CSSPropertyBorderSpacing: { | 1540 case CSSPropertyBorderSpacing: { |
| 1541 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 1541 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 1542 list->append(zoomAdjustedPixelValue(style.horizontalBorderSpacing(), sty
le)); | 1542 list->append(zoomAdjustedPixelValue(style.horizontalBorderSpacing(), sty
le)); |
| 1543 list->append(zoomAdjustedPixelValue(style.verticalBorderSpacing(), style
)); | 1543 list->append(zoomAdjustedPixelValue(style.verticalBorderSpacing(), style
)); |
| 1544 return list.release(); | 1544 return list; |
| 1545 } | 1545 } |
| 1546 case CSSPropertyWebkitBorderHorizontalSpacing: | 1546 case CSSPropertyWebkitBorderHorizontalSpacing: |
| 1547 return zoomAdjustedPixelValue(style.horizontalBorderSpacing(), style); | 1547 return zoomAdjustedPixelValue(style.horizontalBorderSpacing(), style); |
| 1548 case CSSPropertyWebkitBorderVerticalSpacing: | 1548 case CSSPropertyWebkitBorderVerticalSpacing: |
| 1549 return zoomAdjustedPixelValue(style.verticalBorderSpacing(), style); | 1549 return zoomAdjustedPixelValue(style.verticalBorderSpacing(), style); |
| 1550 case CSSPropertyBorderImageSource: | 1550 case CSSPropertyBorderImageSource: |
| 1551 if (style.borderImageSource()) | 1551 if (style.borderImageSource()) |
| 1552 return style.borderImageSource()->computedCSSValue(); | 1552 return style.borderImageSource()->computedCSSValue(); |
| 1553 return cssValuePool().createIdentifierValue(CSSValueNone); | 1553 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1554 case CSSPropertyBorderTopColor: | 1554 case CSSPropertyBorderTopColor: |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1635 case CSSPropertyWebkitColumnBreakInside: | 1635 case CSSPropertyWebkitColumnBreakInside: |
| 1636 return cssValuePool().createValue(mapToColumnBreakValue(style.breakInsid
e())); | 1636 return cssValuePool().createValue(mapToColumnBreakValue(style.breakInsid
e())); |
| 1637 case CSSPropertyColumnWidth: | 1637 case CSSPropertyColumnWidth: |
| 1638 if (style.hasAutoColumnWidth()) | 1638 if (style.hasAutoColumnWidth()) |
| 1639 return cssValuePool().createIdentifierValue(CSSValueAuto); | 1639 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 1640 return zoomAdjustedPixelValue(style.columnWidth(), style); | 1640 return zoomAdjustedPixelValue(style.columnWidth(), style); |
| 1641 case CSSPropertyTabSize: | 1641 case CSSPropertyTabSize: |
| 1642 return cssValuePool().createValue( | 1642 return cssValuePool().createValue( |
| 1643 style.getTabSize().getPixelSize(1.0), style.getTabSize().isSpaces()
? CSSPrimitiveValue::UnitType::Number : CSSPrimitiveValue::UnitType::Pixels); | 1643 style.getTabSize().getPixelSize(1.0), style.getTabSize().isSpaces()
? CSSPrimitiveValue::UnitType::Number : CSSPrimitiveValue::UnitType::Pixels); |
| 1644 case CSSPropertyCursor: { | 1644 case CSSPropertyCursor: { |
| 1645 RawPtr<CSSValueList> list = nullptr; | 1645 CSSValueList* list = nullptr; |
| 1646 CursorList* cursors = style.cursors(); | 1646 CursorList* cursors = style.cursors(); |
| 1647 if (cursors && cursors->size() > 0) { | 1647 if (cursors && cursors->size() > 0) { |
| 1648 list = CSSValueList::createCommaSeparated(); | 1648 list = CSSValueList::createCommaSeparated(); |
| 1649 for (unsigned i = 0; i < cursors->size(); ++i) { | 1649 for (unsigned i = 0; i < cursors->size(); ++i) { |
| 1650 if (StyleImage* image = cursors->at(i).image()) | 1650 if (StyleImage* image = cursors->at(i).image()) |
| 1651 list->append(image->computedCSSValue()); | 1651 list->append(image->computedCSSValue()); |
| 1652 } | 1652 } |
| 1653 } | 1653 } |
| 1654 RawPtr<CSSValue> value = cssValuePool().createValue(style.cursor()); | 1654 CSSValue* value = cssValuePool().createValue(style.cursor()); |
| 1655 if (list) { | 1655 if (list) { |
| 1656 list->append(value.release()); | 1656 list->append(value); |
| 1657 return list.release(); | 1657 return list; |
| 1658 } | 1658 } |
| 1659 return value.release(); | 1659 return value; |
| 1660 } | 1660 } |
| 1661 case CSSPropertyDirection: | 1661 case CSSPropertyDirection: |
| 1662 return cssValuePool().createValue(style.direction()); | 1662 return cssValuePool().createValue(style.direction()); |
| 1663 case CSSPropertyDisplay: | 1663 case CSSPropertyDisplay: |
| 1664 return cssValuePool().createValue(style.display()); | 1664 return cssValuePool().createValue(style.display()); |
| 1665 case CSSPropertyEmptyCells: | 1665 case CSSPropertyEmptyCells: |
| 1666 return cssValuePool().createValue(style.emptyCells()); | 1666 return cssValuePool().createValue(style.emptyCells()); |
| 1667 case CSSPropertyAlignContent: | 1667 case CSSPropertyAlignContent: |
| 1668 return valueForContentPositionAndDistributionWithOverflowAlignment(style
.alignContent()); | 1668 return valueForContentPositionAndDistributionWithOverflowAlignment(style
.alignContent()); |
| 1669 case CSSPropertyAlignItems: | 1669 case CSSPropertyAlignItems: |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1714 case CSSPropertyFontStyle: | 1714 case CSSPropertyFontStyle: |
| 1715 return valueForFontStyle(style); | 1715 return valueForFontStyle(style); |
| 1716 case CSSPropertyFontVariant: | 1716 case CSSPropertyFontVariant: |
| 1717 return valueForFontVariant(style); | 1717 return valueForFontVariant(style); |
| 1718 case CSSPropertyFontWeight: | 1718 case CSSPropertyFontWeight: |
| 1719 return valueForFontWeight(style); | 1719 return valueForFontWeight(style); |
| 1720 case CSSPropertyFontFeatureSettings: { | 1720 case CSSPropertyFontFeatureSettings: { |
| 1721 const FontFeatureSettings* featureSettings = style.getFontDescription().
featureSettings(); | 1721 const FontFeatureSettings* featureSettings = style.getFontDescription().
featureSettings(); |
| 1722 if (!featureSettings || !featureSettings->size()) | 1722 if (!featureSettings || !featureSettings->size()) |
| 1723 return cssValuePool().createIdentifierValue(CSSValueNormal); | 1723 return cssValuePool().createIdentifierValue(CSSValueNormal); |
| 1724 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 1724 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 1725 for (unsigned i = 0; i < featureSettings->size(); ++i) { | 1725 for (unsigned i = 0; i < featureSettings->size(); ++i) { |
| 1726 const FontFeature& feature = featureSettings->at(i); | 1726 const FontFeature& feature = featureSettings->at(i); |
| 1727 RawPtr<CSSFontFeatureValue> featureValue = CSSFontFeatureValue::crea
te(feature.tag(), feature.value()); | 1727 CSSFontFeatureValue* featureValue = CSSFontFeatureValue::create(feat
ure.tag(), feature.value()); |
| 1728 list->append(featureValue.release()); | 1728 list->append(featureValue); |
| 1729 } | 1729 } |
| 1730 return list.release(); | 1730 return list; |
| 1731 } | 1731 } |
| 1732 case CSSPropertyGridAutoFlow: { | 1732 case CSSPropertyGridAutoFlow: { |
| 1733 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 1733 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 1734 switch (style.getGridAutoFlow()) { | 1734 switch (style.getGridAutoFlow()) { |
| 1735 case AutoFlowRow: | 1735 case AutoFlowRow: |
| 1736 case AutoFlowRowDense: | 1736 case AutoFlowRowDense: |
| 1737 list->append(cssValuePool().createIdentifierValue(CSSValueRow)); | 1737 list->append(cssValuePool().createIdentifierValue(CSSValueRow)); |
| 1738 break; | 1738 break; |
| 1739 case AutoFlowColumn: | 1739 case AutoFlowColumn: |
| 1740 case AutoFlowColumnDense: | 1740 case AutoFlowColumnDense: |
| 1741 list->append(cssValuePool().createIdentifierValue(CSSValueColumn)); | 1741 list->append(cssValuePool().createIdentifierValue(CSSValueColumn)); |
| 1742 break; | 1742 break; |
| 1743 default: | 1743 default: |
| 1744 ASSERT_NOT_REACHED(); | 1744 ASSERT_NOT_REACHED(); |
| 1745 } | 1745 } |
| 1746 | 1746 |
| 1747 switch (style.getGridAutoFlow()) { | 1747 switch (style.getGridAutoFlow()) { |
| 1748 case AutoFlowRowDense: | 1748 case AutoFlowRowDense: |
| 1749 case AutoFlowColumnDense: | 1749 case AutoFlowColumnDense: |
| 1750 list->append(cssValuePool().createIdentifierValue(CSSValueDense)); | 1750 list->append(cssValuePool().createIdentifierValue(CSSValueDense)); |
| 1751 break; | 1751 break; |
| 1752 default: | 1752 default: |
| 1753 // Do nothing. | 1753 // Do nothing. |
| 1754 break; | 1754 break; |
| 1755 } | 1755 } |
| 1756 | 1756 |
| 1757 return list.release(); | 1757 return list; |
| 1758 } | 1758 } |
| 1759 // Specs mention that getComputedStyle() should return the used value of the
property instead of the computed | 1759 // Specs mention that getComputedStyle() should return the used value of the
property instead of the computed |
| 1760 // one for grid-definition-{rows|columns} but not for the grid-auto-{rows|co
lumns} as things like | 1760 // one for grid-definition-{rows|columns} but not for the grid-auto-{rows|co
lumns} as things like |
| 1761 // grid-auto-columns: 2fr; cannot be resolved to a value in pixels as the '2
fr' means very different things | 1761 // grid-auto-columns: 2fr; cannot be resolved to a value in pixels as the '2
fr' means very different things |
| 1762 // depending on the size of the explicit grid or the number of implicit trac
ks added to the grid. See | 1762 // depending on the size of the explicit grid or the number of implicit trac
ks added to the grid. See |
| 1763 // http://lists.w3.org/Archives/Public/www-style/2013Nov/0014.html | 1763 // http://lists.w3.org/Archives/Public/www-style/2013Nov/0014.html |
| 1764 case CSSPropertyGridAutoColumns: | 1764 case CSSPropertyGridAutoColumns: |
| 1765 return specifiedValueForGridTrackSize(style.gridAutoColumns(), style); | 1765 return specifiedValueForGridTrackSize(style.gridAutoColumns(), style); |
| 1766 case CSSPropertyGridAutoRows: | 1766 case CSSPropertyGridAutoRows: |
| 1767 return specifiedValueForGridTrackSize(style.gridAutoRows(), style); | 1767 return specifiedValueForGridTrackSize(style.gridAutoRows(), style); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1989 case CSSPropertyPageBreakInside: | 1989 case CSSPropertyPageBreakInside: |
| 1990 return cssValuePool().createValue(mapToPageBreakValue(style.breakInside(
))); | 1990 return cssValuePool().createValue(mapToPageBreakValue(style.breakInside(
))); |
| 1991 case CSSPropertyPosition: | 1991 case CSSPropertyPosition: |
| 1992 return cssValuePool().createValue(style.position()); | 1992 return cssValuePool().createValue(style.position()); |
| 1993 case CSSPropertyQuotes: | 1993 case CSSPropertyQuotes: |
| 1994 if (!style.quotes()) { | 1994 if (!style.quotes()) { |
| 1995 // TODO(ramya.v): We should return the quote values that we're actua
lly using. | 1995 // TODO(ramya.v): We should return the quote values that we're actua
lly using. |
| 1996 return nullptr; | 1996 return nullptr; |
| 1997 } | 1997 } |
| 1998 if (style.quotes()->size()) { | 1998 if (style.quotes()->size()) { |
| 1999 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 1999 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 2000 for (int i = 0; i < style.quotes()->size(); i++) { | 2000 for (int i = 0; i < style.quotes()->size(); i++) { |
| 2001 list->append(CSSStringValue::create(style.quotes()->getOpenQuote
(i))); | 2001 list->append(CSSStringValue::create(style.quotes()->getOpenQuote
(i))); |
| 2002 list->append(CSSStringValue::create(style.quotes()->getCloseQuot
e(i))); | 2002 list->append(CSSStringValue::create(style.quotes()->getCloseQuot
e(i))); |
| 2003 } | 2003 } |
| 2004 return list.release(); | 2004 return list; |
| 2005 } | 2005 } |
| 2006 return cssValuePool().createIdentifierValue(CSSValueNone); | 2006 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 2007 case CSSPropertyRight: | 2007 case CSSPropertyRight: |
| 2008 return valueForPositionOffset(style, CSSPropertyRight, layoutObject); | 2008 return valueForPositionOffset(style, CSSPropertyRight, layoutObject); |
| 2009 case CSSPropertyWebkitRubyPosition: | 2009 case CSSPropertyWebkitRubyPosition: |
| 2010 return cssValuePool().createValue(style.getRubyPosition()); | 2010 return cssValuePool().createValue(style.getRubyPosition()); |
| 2011 case CSSPropertyScrollBehavior: | 2011 case CSSPropertyScrollBehavior: |
| 2012 return cssValuePool().createValue(style.getScrollBehavior()); | 2012 return cssValuePool().createValue(style.getScrollBehavior()); |
| 2013 case CSSPropertyTableLayout: | 2013 case CSSPropertyTableLayout: |
| 2014 return cssValuePool().createValue(style.tableLayout()); | 2014 return cssValuePool().createValue(style.tableLayout()); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2045 case TextEmphasisMarkCustom: | 2045 case TextEmphasisMarkCustom: |
| 2046 return CSSStringValue::create(style.textEmphasisCustomMark()); | 2046 return CSSStringValue::create(style.textEmphasisCustomMark()); |
| 2047 case TextEmphasisMarkAuto: | 2047 case TextEmphasisMarkAuto: |
| 2048 ASSERT_NOT_REACHED(); | 2048 ASSERT_NOT_REACHED(); |
| 2049 // Fall through | 2049 // Fall through |
| 2050 case TextEmphasisMarkDot: | 2050 case TextEmphasisMarkDot: |
| 2051 case TextEmphasisMarkCircle: | 2051 case TextEmphasisMarkCircle: |
| 2052 case TextEmphasisMarkDoubleCircle: | 2052 case TextEmphasisMarkDoubleCircle: |
| 2053 case TextEmphasisMarkTriangle: | 2053 case TextEmphasisMarkTriangle: |
| 2054 case TextEmphasisMarkSesame: { | 2054 case TextEmphasisMarkSesame: { |
| 2055 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 2055 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 2056 list->append(cssValuePool().createValue(style.getTextEmphasisFill())
); | 2056 list->append(cssValuePool().createValue(style.getTextEmphasisFill())
); |
| 2057 list->append(cssValuePool().createValue(style.getTextEmphasisMark())
); | 2057 list->append(cssValuePool().createValue(style.getTextEmphasisMark())
); |
| 2058 return list.release(); | 2058 return list; |
| 2059 } | 2059 } |
| 2060 } | 2060 } |
| 2061 case CSSPropertyTextIndent: { | 2061 case CSSPropertyTextIndent: { |
| 2062 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 2062 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 2063 list->append(zoomAdjustedPixelValueForLength(style.textIndent(), style))
; | 2063 list->append(zoomAdjustedPixelValueForLength(style.textIndent(), style))
; |
| 2064 if (RuntimeEnabledFeatures::css3TextEnabled() && (style.getTextIndentLin
e() == TextIndentEachLine || style.getTextIndentType() == TextIndentHanging)) { | 2064 if (RuntimeEnabledFeatures::css3TextEnabled() && (style.getTextIndentLin
e() == TextIndentEachLine || style.getTextIndentType() == TextIndentHanging)) { |
| 2065 if (style.getTextIndentLine() == TextIndentEachLine) | 2065 if (style.getTextIndentLine() == TextIndentEachLine) |
| 2066 list->append(cssValuePool().createIdentifierValue(CSSValueEachLi
ne)); | 2066 list->append(cssValuePool().createIdentifierValue(CSSValueEachLi
ne)); |
| 2067 if (style.getTextIndentType() == TextIndentHanging) | 2067 if (style.getTextIndentType() == TextIndentHanging) |
| 2068 list->append(cssValuePool().createIdentifierValue(CSSValueHangin
g)); | 2068 list->append(cssValuePool().createIdentifierValue(CSSValueHangin
g)); |
| 2069 } | 2069 } |
| 2070 return list.release(); | 2070 return list; |
| 2071 } | 2071 } |
| 2072 case CSSPropertyTextShadow: | 2072 case CSSPropertyTextShadow: |
| 2073 return valueForShadowList(style.textShadow(), style, false); | 2073 return valueForShadowList(style.textShadow(), style, false); |
| 2074 case CSSPropertyTextRendering: | 2074 case CSSPropertyTextRendering: |
| 2075 return cssValuePool().createValue(style.getFontDescription().textRenderi
ng()); | 2075 return cssValuePool().createValue(style.getFontDescription().textRenderi
ng()); |
| 2076 case CSSPropertyTextOverflow: | 2076 case CSSPropertyTextOverflow: |
| 2077 if (style.getTextOverflow()) | 2077 if (style.getTextOverflow()) |
| 2078 return cssValuePool().createIdentifierValue(CSSValueEllipsis); | 2078 return cssValuePool().createIdentifierValue(CSSValueEllipsis); |
| 2079 return cssValuePool().createIdentifierValue(CSSValueClip); | 2079 return cssValuePool().createIdentifierValue(CSSValueClip); |
| 2080 case CSSPropertyWebkitTextSecurity: | 2080 case CSSPropertyWebkitTextSecurity: |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2149 return cssValuePool().createValue(style.getFontDescription().fontSmoothi
ng()); | 2149 return cssValuePool().createValue(style.getFontDescription().fontSmoothi
ng()); |
| 2150 case CSSPropertyFontVariantLigatures: { | 2150 case CSSPropertyFontVariantLigatures: { |
| 2151 FontDescription::LigaturesState commonLigaturesState = style.getFontDesc
ription().commonLigaturesState(); | 2151 FontDescription::LigaturesState commonLigaturesState = style.getFontDesc
ription().commonLigaturesState(); |
| 2152 FontDescription::LigaturesState discretionaryLigaturesState = style.getF
ontDescription().discretionaryLigaturesState(); | 2152 FontDescription::LigaturesState discretionaryLigaturesState = style.getF
ontDescription().discretionaryLigaturesState(); |
| 2153 FontDescription::LigaturesState historicalLigaturesState = style.getFont
Description().historicalLigaturesState(); | 2153 FontDescription::LigaturesState historicalLigaturesState = style.getFont
Description().historicalLigaturesState(); |
| 2154 FontDescription::LigaturesState contextualLigaturesState = style.getFont
Description().contextualLigaturesState(); | 2154 FontDescription::LigaturesState contextualLigaturesState = style.getFont
Description().contextualLigaturesState(); |
| 2155 if (commonLigaturesState == FontDescription::NormalLigaturesState && dis
cretionaryLigaturesState == FontDescription::NormalLigaturesState | 2155 if (commonLigaturesState == FontDescription::NormalLigaturesState && dis
cretionaryLigaturesState == FontDescription::NormalLigaturesState |
| 2156 && historicalLigaturesState == FontDescription::NormalLigaturesState
&& contextualLigaturesState == FontDescription::NormalLigaturesState) | 2156 && historicalLigaturesState == FontDescription::NormalLigaturesState
&& contextualLigaturesState == FontDescription::NormalLigaturesState) |
| 2157 return cssValuePool().createIdentifierValue(CSSValueNormal); | 2157 return cssValuePool().createIdentifierValue(CSSValueNormal); |
| 2158 | 2158 |
| 2159 RawPtr<CSSValueList> valueList = CSSValueList::createSpaceSeparated(); | 2159 CSSValueList* valueList = CSSValueList::createSpaceSeparated(); |
| 2160 if (commonLigaturesState != FontDescription::NormalLigaturesState) | 2160 if (commonLigaturesState != FontDescription::NormalLigaturesState) |
| 2161 valueList->append(cssValuePool().createIdentifierValue(commonLigatur
esState == FontDescription::DisabledLigaturesState ? CSSValueNoCommonLigatures :
CSSValueCommonLigatures)); | 2161 valueList->append(cssValuePool().createIdentifierValue(commonLigatur
esState == FontDescription::DisabledLigaturesState ? CSSValueNoCommonLigatures :
CSSValueCommonLigatures)); |
| 2162 if (discretionaryLigaturesState != FontDescription::NormalLigaturesState
) | 2162 if (discretionaryLigaturesState != FontDescription::NormalLigaturesState
) |
| 2163 valueList->append(cssValuePool().createIdentifierValue(discretionary
LigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoDiscretion
aryLigatures : CSSValueDiscretionaryLigatures)); | 2163 valueList->append(cssValuePool().createIdentifierValue(discretionary
LigaturesState == FontDescription::DisabledLigaturesState ? CSSValueNoDiscretion
aryLigatures : CSSValueDiscretionaryLigatures)); |
| 2164 if (historicalLigaturesState != FontDescription::NormalLigaturesState) | 2164 if (historicalLigaturesState != FontDescription::NormalLigaturesState) |
| 2165 valueList->append(cssValuePool().createIdentifierValue(historicalLig
aturesState == FontDescription::DisabledLigaturesState ? CSSValueNoHistoricalLig
atures : CSSValueHistoricalLigatures)); | 2165 valueList->append(cssValuePool().createIdentifierValue(historicalLig
aturesState == FontDescription::DisabledLigaturesState ? CSSValueNoHistoricalLig
atures : CSSValueHistoricalLigatures)); |
| 2166 if (contextualLigaturesState != FontDescription::NormalLigaturesState) | 2166 if (contextualLigaturesState != FontDescription::NormalLigaturesState) |
| 2167 valueList->append(cssValuePool().createIdentifierValue(contextualLig
aturesState == FontDescription::DisabledLigaturesState ? CSSValueNoContextual :
CSSValueContextual)); | 2167 valueList->append(cssValuePool().createIdentifierValue(contextualLig
aturesState == FontDescription::DisabledLigaturesState ? CSSValueNoContextual :
CSSValueContextual)); |
| 2168 return valueList; | 2168 return valueList; |
| 2169 } | 2169 } |
| 2170 case CSSPropertyZIndex: | 2170 case CSSPropertyZIndex: |
| 2171 if (style.hasAutoZIndex()) | 2171 if (style.hasAutoZIndex()) |
| 2172 return cssValuePool().createIdentifierValue(CSSValueAuto); | 2172 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 2173 return cssValuePool().createValue(style.zIndex(), CSSPrimitiveValue::Uni
tType::Integer); | 2173 return cssValuePool().createValue(style.zIndex(), CSSPrimitiveValue::Uni
tType::Integer); |
| 2174 case CSSPropertyZoom: | 2174 case CSSPropertyZoom: |
| 2175 return cssValuePool().createValue(style.zoom(), CSSPrimitiveValue::UnitT
ype::Number); | 2175 return cssValuePool().createValue(style.zoom(), CSSPrimitiveValue::UnitT
ype::Number); |
| 2176 case CSSPropertyBoxSizing: | 2176 case CSSPropertyBoxSizing: |
| 2177 if (style.boxSizing() == BoxSizingContentBox) | 2177 if (style.boxSizing() == BoxSizingContentBox) |
| 2178 return cssValuePool().createIdentifierValue(CSSValueContentBox); | 2178 return cssValuePool().createIdentifierValue(CSSValueContentBox); |
| 2179 return cssValuePool().createIdentifierValue(CSSValueBorderBox); | 2179 return cssValuePool().createIdentifierValue(CSSValueBorderBox); |
| 2180 case CSSPropertyWebkitAppRegion: | 2180 case CSSPropertyWebkitAppRegion: |
| 2181 return cssValuePool().createIdentifierValue(style.getDraggableRegionMode
() == DraggableRegionDrag ? CSSValueDrag : CSSValueNoDrag); | 2181 return cssValuePool().createIdentifierValue(style.getDraggableRegionMode
() == DraggableRegionDrag ? CSSValueDrag : CSSValueNoDrag); |
| 2182 case CSSPropertyAnimationDelay: | 2182 case CSSPropertyAnimationDelay: |
| 2183 return valueForAnimationDelay(style.animations()); | 2183 return valueForAnimationDelay(style.animations()); |
| 2184 case CSSPropertyAnimationDirection: { | 2184 case CSSPropertyAnimationDirection: { |
| 2185 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 2185 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 2186 const CSSAnimationData* animationData = style.animations(); | 2186 const CSSAnimationData* animationData = style.animations(); |
| 2187 if (animationData) { | 2187 if (animationData) { |
| 2188 for (size_t i = 0; i < animationData->directionList().size(); ++i) | 2188 for (size_t i = 0; i < animationData->directionList().size(); ++i) |
| 2189 list->append(valueForAnimationDirection(animationData->direction
List()[i])); | 2189 list->append(valueForAnimationDirection(animationData->direction
List()[i])); |
| 2190 } else { | 2190 } else { |
| 2191 list->append(cssValuePool().createIdentifierValue(CSSValueNormal)); | 2191 list->append(cssValuePool().createIdentifierValue(CSSValueNormal)); |
| 2192 } | 2192 } |
| 2193 return list.release(); | 2193 return list; |
| 2194 } | 2194 } |
| 2195 case CSSPropertyAnimationDuration: | 2195 case CSSPropertyAnimationDuration: |
| 2196 return valueForAnimationDuration(style.animations()); | 2196 return valueForAnimationDuration(style.animations()); |
| 2197 case CSSPropertyAnimationFillMode: { | 2197 case CSSPropertyAnimationFillMode: { |
| 2198 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 2198 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 2199 const CSSAnimationData* animationData = style.animations(); | 2199 const CSSAnimationData* animationData = style.animations(); |
| 2200 if (animationData) { | 2200 if (animationData) { |
| 2201 for (size_t i = 0; i < animationData->fillModeList().size(); ++i) | 2201 for (size_t i = 0; i < animationData->fillModeList().size(); ++i) |
| 2202 list->append(valueForAnimationFillMode(animationData->fillModeLi
st()[i])); | 2202 list->append(valueForAnimationFillMode(animationData->fillModeLi
st()[i])); |
| 2203 } else { | 2203 } else { |
| 2204 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); | 2204 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); |
| 2205 } | 2205 } |
| 2206 return list.release(); | 2206 return list; |
| 2207 } | 2207 } |
| 2208 case CSSPropertyAnimationIterationCount: { | 2208 case CSSPropertyAnimationIterationCount: { |
| 2209 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 2209 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 2210 const CSSAnimationData* animationData = style.animations(); | 2210 const CSSAnimationData* animationData = style.animations(); |
| 2211 if (animationData) { | 2211 if (animationData) { |
| 2212 for (size_t i = 0; i < animationData->iterationCountList().size(); +
+i) | 2212 for (size_t i = 0; i < animationData->iterationCountList().size(); +
+i) |
| 2213 list->append(valueForAnimationIterationCount(animationData->iter
ationCountList()[i])); | 2213 list->append(valueForAnimationIterationCount(animationData->iter
ationCountList()[i])); |
| 2214 } else { | 2214 } else { |
| 2215 list->append(cssValuePool().createValue(CSSAnimationData::initialIte
rationCount(), CSSPrimitiveValue::UnitType::Number)); | 2215 list->append(cssValuePool().createValue(CSSAnimationData::initialIte
rationCount(), CSSPrimitiveValue::UnitType::Number)); |
| 2216 } | 2216 } |
| 2217 return list.release(); | 2217 return list; |
| 2218 } | 2218 } |
| 2219 case CSSPropertyAnimationName: { | 2219 case CSSPropertyAnimationName: { |
| 2220 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 2220 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 2221 const CSSAnimationData* animationData = style.animations(); | 2221 const CSSAnimationData* animationData = style.animations(); |
| 2222 if (animationData) { | 2222 if (animationData) { |
| 2223 for (size_t i = 0; i < animationData->nameList().size(); ++i) | 2223 for (size_t i = 0; i < animationData->nameList().size(); ++i) |
| 2224 list->append(CSSCustomIdentValue::create(animationData->nameList
()[i])); | 2224 list->append(CSSCustomIdentValue::create(animationData->nameList
()[i])); |
| 2225 } else { | 2225 } else { |
| 2226 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); | 2226 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); |
| 2227 } | 2227 } |
| 2228 return list.release(); | 2228 return list; |
| 2229 } | 2229 } |
| 2230 case CSSPropertyAnimationPlayState: { | 2230 case CSSPropertyAnimationPlayState: { |
| 2231 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 2231 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 2232 const CSSAnimationData* animationData = style.animations(); | 2232 const CSSAnimationData* animationData = style.animations(); |
| 2233 if (animationData) { | 2233 if (animationData) { |
| 2234 for (size_t i = 0; i < animationData->playStateList().size(); ++i) | 2234 for (size_t i = 0; i < animationData->playStateList().size(); ++i) |
| 2235 list->append(valueForAnimationPlayState(animationData->playState
List()[i])); | 2235 list->append(valueForAnimationPlayState(animationData->playState
List()[i])); |
| 2236 } else { | 2236 } else { |
| 2237 list->append(cssValuePool().createIdentifierValue(CSSValueRunning)); | 2237 list->append(cssValuePool().createIdentifierValue(CSSValueRunning)); |
| 2238 } | 2238 } |
| 2239 return list.release(); | 2239 return list; |
| 2240 } | 2240 } |
| 2241 case CSSPropertyAnimationTimingFunction: | 2241 case CSSPropertyAnimationTimingFunction: |
| 2242 return valueForAnimationTimingFunction(style.animations()); | 2242 return valueForAnimationTimingFunction(style.animations()); |
| 2243 case CSSPropertyAnimation: { | 2243 case CSSPropertyAnimation: { |
| 2244 const CSSAnimationData* animationData = style.animations(); | 2244 const CSSAnimationData* animationData = style.animations(); |
| 2245 if (animationData) { | 2245 if (animationData) { |
| 2246 RawPtr<CSSValueList> animationsList = CSSValueList::createCommaSepar
ated(); | 2246 CSSValueList* animationsList = CSSValueList::createCommaSeparated(); |
| 2247 for (size_t i = 0; i < animationData->nameList().size(); ++i) { | 2247 for (size_t i = 0; i < animationData->nameList().size(); ++i) { |
| 2248 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 2248 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 2249 list->append(CSSCustomIdentValue::create(animationData->nameList
()[i])); | 2249 list->append(CSSCustomIdentValue::create(animationData->nameList
()[i])); |
| 2250 list->append(cssValuePool().createValue(CSSTimingData::getRepeat
ed(animationData->durationList(), i), CSSPrimitiveValue::UnitType::Seconds)); | 2250 list->append(cssValuePool().createValue(CSSTimingData::getRepeat
ed(animationData->durationList(), i), CSSPrimitiveValue::UnitType::Seconds)); |
| 2251 list->append(createTimingFunctionValue(CSSTimingData::getRepeate
d(animationData->timingFunctionList(), i).get())); | 2251 list->append(createTimingFunctionValue(CSSTimingData::getRepeate
d(animationData->timingFunctionList(), i).get())); |
| 2252 list->append(cssValuePool().createValue(CSSTimingData::getRepeat
ed(animationData->delayList(), i), CSSPrimitiveValue::UnitType::Seconds)); | 2252 list->append(cssValuePool().createValue(CSSTimingData::getRepeat
ed(animationData->delayList(), i), CSSPrimitiveValue::UnitType::Seconds)); |
| 2253 list->append(valueForAnimationIterationCount(CSSTimingData::getR
epeated(animationData->iterationCountList(), i))); | 2253 list->append(valueForAnimationIterationCount(CSSTimingData::getR
epeated(animationData->iterationCountList(), i))); |
| 2254 list->append(valueForAnimationDirection(CSSTimingData::getRepeat
ed(animationData->directionList(), i))); | 2254 list->append(valueForAnimationDirection(CSSTimingData::getRepeat
ed(animationData->directionList(), i))); |
| 2255 list->append(valueForAnimationFillMode(CSSTimingData::getRepeate
d(animationData->fillModeList(), i))); | 2255 list->append(valueForAnimationFillMode(CSSTimingData::getRepeate
d(animationData->fillModeList(), i))); |
| 2256 list->append(valueForAnimationPlayState(CSSTimingData::getRepeat
ed(animationData->playStateList(), i))); | 2256 list->append(valueForAnimationPlayState(CSSTimingData::getRepeat
ed(animationData->playStateList(), i))); |
| 2257 animationsList->append(list); | 2257 animationsList->append(list); |
| 2258 } | 2258 } |
| 2259 return animationsList.release(); | 2259 return animationsList; |
| 2260 } | 2260 } |
| 2261 | 2261 |
| 2262 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 2262 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 2263 // animation-name default value. | 2263 // animation-name default value. |
| 2264 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); | 2264 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); |
| 2265 list->append(cssValuePool().createValue(CSSAnimationData::initialDuratio
n(), CSSPrimitiveValue::UnitType::Seconds)); | 2265 list->append(cssValuePool().createValue(CSSAnimationData::initialDuratio
n(), CSSPrimitiveValue::UnitType::Seconds)); |
| 2266 list->append(createTimingFunctionValue(CSSAnimationData::initialTimingFu
nction().get())); | 2266 list->append(createTimingFunctionValue(CSSAnimationData::initialTimingFu
nction().get())); |
| 2267 list->append(cssValuePool().createValue(CSSAnimationData::initialDelay()
, CSSPrimitiveValue::UnitType::Seconds)); | 2267 list->append(cssValuePool().createValue(CSSAnimationData::initialDelay()
, CSSPrimitiveValue::UnitType::Seconds)); |
| 2268 list->append(cssValuePool().createValue(CSSAnimationData::initialIterati
onCount(), CSSPrimitiveValue::UnitType::Number)); | 2268 list->append(cssValuePool().createValue(CSSAnimationData::initialIterati
onCount(), CSSPrimitiveValue::UnitType::Number)); |
| 2269 list->append(valueForAnimationDirection(CSSAnimationData::initialDirecti
on())); | 2269 list->append(valueForAnimationDirection(CSSAnimationData::initialDirecti
on())); |
| 2270 list->append(valueForAnimationFillMode(CSSAnimationData::initialFillMode
())); | 2270 list->append(valueForAnimationFillMode(CSSAnimationData::initialFillMode
())); |
| 2271 // Initial animation-play-state. | 2271 // Initial animation-play-state. |
| 2272 list->append(cssValuePool().createIdentifierValue(CSSValueRunning)); | 2272 list->append(cssValuePool().createIdentifierValue(CSSValueRunning)); |
| 2273 return list.release(); | 2273 return list; |
| 2274 } | 2274 } |
| 2275 case CSSPropertyWebkitAppearance: | 2275 case CSSPropertyWebkitAppearance: |
| 2276 return cssValuePool().createValue(style.appearance()); | 2276 return cssValuePool().createValue(style.appearance()); |
| 2277 case CSSPropertyBackfaceVisibility: | 2277 case CSSPropertyBackfaceVisibility: |
| 2278 return cssValuePool().createIdentifierValue((style.backfaceVisibility()
== BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible); | 2278 return cssValuePool().createIdentifierValue((style.backfaceVisibility()
== BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible); |
| 2279 case CSSPropertyWebkitBorderImage: | 2279 case CSSPropertyWebkitBorderImage: |
| 2280 return valueForNinePieceImage(style.borderImage(), style); | 2280 return valueForNinePieceImage(style.borderImage(), style); |
| 2281 case CSSPropertyBorderImageOutset: | 2281 case CSSPropertyBorderImageOutset: |
| 2282 return valueForNinePieceImageQuad(style.borderImage().outset(), style); | 2282 return valueForNinePieceImageQuad(style.borderImage().outset(), style); |
| 2283 case CSSPropertyBorderImageRepeat: | 2283 case CSSPropertyBorderImageRepeat: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2307 case CSSPropertyWebkitMarginAfterCollapse: | 2307 case CSSPropertyWebkitMarginAfterCollapse: |
| 2308 return cssValuePool().createValue(style.marginAfterCollapse()); | 2308 return cssValuePool().createValue(style.marginAfterCollapse()); |
| 2309 case CSSPropertyWebkitMarginTopCollapse: | 2309 case CSSPropertyWebkitMarginTopCollapse: |
| 2310 case CSSPropertyWebkitMarginBeforeCollapse: | 2310 case CSSPropertyWebkitMarginBeforeCollapse: |
| 2311 return cssValuePool().createValue(style.marginBeforeCollapse()); | 2311 return cssValuePool().createValue(style.marginBeforeCollapse()); |
| 2312 case CSSPropertyPerspective: | 2312 case CSSPropertyPerspective: |
| 2313 if (!style.hasPerspective()) | 2313 if (!style.hasPerspective()) |
| 2314 return cssValuePool().createIdentifierValue(CSSValueNone); | 2314 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 2315 return zoomAdjustedPixelValue(style.perspective(), style); | 2315 return zoomAdjustedPixelValue(style.perspective(), style); |
| 2316 case CSSPropertyPerspectiveOrigin: { | 2316 case CSSPropertyPerspectiveOrigin: { |
| 2317 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 2317 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 2318 if (layoutObject) { | 2318 if (layoutObject) { |
| 2319 LayoutRect box; | 2319 LayoutRect box; |
| 2320 if (layoutObject->isBox()) | 2320 if (layoutObject->isBox()) |
| 2321 box = toLayoutBox(layoutObject)->borderBoxRect(); | 2321 box = toLayoutBox(layoutObject)->borderBoxRect(); |
| 2322 | 2322 |
| 2323 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.pers
pectiveOriginX(), box.width()), style)); | 2323 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.pers
pectiveOriginX(), box.width()), style)); |
| 2324 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.pers
pectiveOriginY(), box.height()), style)); | 2324 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.pers
pectiveOriginY(), box.height()), style)); |
| 2325 } else { | 2325 } else { |
| 2326 list->append(zoomAdjustedPixelValueForLength(style.perspectiveOrigin
X(), style)); | 2326 list->append(zoomAdjustedPixelValueForLength(style.perspectiveOrigin
X(), style)); |
| 2327 list->append(zoomAdjustedPixelValueForLength(style.perspectiveOrigin
Y(), style)); | 2327 list->append(zoomAdjustedPixelValueForLength(style.perspectiveOrigin
Y(), style)); |
| 2328 } | 2328 } |
| 2329 return list.release(); | 2329 return list; |
| 2330 } | 2330 } |
| 2331 case CSSPropertyWebkitRtlOrdering: | 2331 case CSSPropertyWebkitRtlOrdering: |
| 2332 return cssValuePool().createIdentifierValue(style.rtlOrdering() ? CSSVal
ueVisual : CSSValueLogical); | 2332 return cssValuePool().createIdentifierValue(style.rtlOrdering() ? CSSVal
ueVisual : CSSValueLogical); |
| 2333 case CSSPropertyWebkitTapHighlightColor: | 2333 case CSSPropertyWebkitTapHighlightColor: |
| 2334 return currentColorOrValidColor(style, style.tapHighlightColor()); | 2334 return currentColorOrValidColor(style, style.tapHighlightColor()); |
| 2335 case CSSPropertyWebkitUserDrag: | 2335 case CSSPropertyWebkitUserDrag: |
| 2336 return cssValuePool().createValue(style.userDrag()); | 2336 return cssValuePool().createValue(style.userDrag()); |
| 2337 case CSSPropertyWebkitUserSelect: | 2337 case CSSPropertyWebkitUserSelect: |
| 2338 return cssValuePool().createValue(style.userSelect()); | 2338 return cssValuePool().createValue(style.userSelect()); |
| 2339 case CSSPropertyBorderBottomLeftRadius: | 2339 case CSSPropertyBorderBottomLeftRadius: |
| 2340 return valueForBorderRadiusCorner(style.borderBottomLeftRadius(), style)
; | 2340 return valueForBorderRadiusCorner(style.borderBottomLeftRadius(), style)
; |
| 2341 case CSSPropertyBorderBottomRightRadius: | 2341 case CSSPropertyBorderBottomRightRadius: |
| 2342 return valueForBorderRadiusCorner(style.borderBottomRightRadius(), style
); | 2342 return valueForBorderRadiusCorner(style.borderBottomRightRadius(), style
); |
| 2343 case CSSPropertyBorderTopLeftRadius: | 2343 case CSSPropertyBorderTopLeftRadius: |
| 2344 return valueForBorderRadiusCorner(style.borderTopLeftRadius(), style); | 2344 return valueForBorderRadiusCorner(style.borderTopLeftRadius(), style); |
| 2345 case CSSPropertyBorderTopRightRadius: | 2345 case CSSPropertyBorderTopRightRadius: |
| 2346 return valueForBorderRadiusCorner(style.borderTopRightRadius(), style); | 2346 return valueForBorderRadiusCorner(style.borderTopRightRadius(), style); |
| 2347 case CSSPropertyClip: { | 2347 case CSSPropertyClip: { |
| 2348 if (style.hasAutoClip()) | 2348 if (style.hasAutoClip()) |
| 2349 return cssValuePool().createIdentifierValue(CSSValueAuto); | 2349 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 2350 RawPtr<CSSPrimitiveValue> top = style.clip().top().isAuto() | 2350 CSSPrimitiveValue* top = style.clip().top().isAuto() |
| 2351 ? cssValuePool().createIdentifierValue(CSSValueAuto) | 2351 ? cssValuePool().createIdentifierValue(CSSValueAuto) |
| 2352 : zoomAdjustedPixelValue(style.clip().top().value(), style); | 2352 : zoomAdjustedPixelValue(style.clip().top().value(), style); |
| 2353 RawPtr<CSSPrimitiveValue> right = style.clip().right().isAuto() | 2353 CSSPrimitiveValue* right = style.clip().right().isAuto() |
| 2354 ? cssValuePool().createIdentifierValue(CSSValueAuto) | 2354 ? cssValuePool().createIdentifierValue(CSSValueAuto) |
| 2355 : zoomAdjustedPixelValue(style.clip().right().value(), style); | 2355 : zoomAdjustedPixelValue(style.clip().right().value(), style); |
| 2356 RawPtr<CSSPrimitiveValue> bottom = style.clip().bottom().isAuto() | 2356 CSSPrimitiveValue* bottom = style.clip().bottom().isAuto() |
| 2357 ? cssValuePool().createIdentifierValue(CSSValueAuto) | 2357 ? cssValuePool().createIdentifierValue(CSSValueAuto) |
| 2358 : zoomAdjustedPixelValue(style.clip().bottom().value(), style); | 2358 : zoomAdjustedPixelValue(style.clip().bottom().value(), style); |
| 2359 RawPtr<CSSPrimitiveValue> left = style.clip().left().isAuto() | 2359 CSSPrimitiveValue* left = style.clip().left().isAuto() |
| 2360 ? cssValuePool().createIdentifierValue(CSSValueAuto) | 2360 ? cssValuePool().createIdentifierValue(CSSValueAuto) |
| 2361 : zoomAdjustedPixelValue(style.clip().left().value(), style); | 2361 : zoomAdjustedPixelValue(style.clip().left().value(), style); |
| 2362 return CSSQuadValue::create(top.release(), right.release(), bottom.relea
se(), left.release(), CSSQuadValue::SerializeAsRect); | 2362 return CSSQuadValue::create(top, right, bottom, left, CSSQuadValue::Seri
alizeAsRect); |
| 2363 } | 2363 } |
| 2364 case CSSPropertySpeak: | 2364 case CSSPropertySpeak: |
| 2365 return cssValuePool().createValue(style.speak()); | 2365 return cssValuePool().createValue(style.speak()); |
| 2366 case CSSPropertyTransform: | 2366 case CSSPropertyTransform: |
| 2367 return computedTransform(layoutObject, style); | 2367 return computedTransform(layoutObject, style); |
| 2368 case CSSPropertyTransformOrigin: { | 2368 case CSSPropertyTransformOrigin: { |
| 2369 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 2369 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 2370 if (layoutObject) { | 2370 if (layoutObject) { |
| 2371 LayoutRect box; | 2371 LayoutRect box; |
| 2372 if (layoutObject->isBox()) | 2372 if (layoutObject->isBox()) |
| 2373 box = toLayoutBox(layoutObject)->borderBoxRect(); | 2373 box = toLayoutBox(layoutObject)->borderBoxRect(); |
| 2374 | 2374 |
| 2375 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.tran
sformOriginX(), box.width()), style)); | 2375 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.tran
sformOriginX(), box.width()), style)); |
| 2376 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.tran
sformOriginY(), box.height()), style)); | 2376 list->append(zoomAdjustedPixelValue(minimumValueForLength(style.tran
sformOriginY(), box.height()), style)); |
| 2377 if (style.transformOriginZ() != 0) | 2377 if (style.transformOriginZ() != 0) |
| 2378 list->append(zoomAdjustedPixelValue(style.transformOriginZ(), st
yle)); | 2378 list->append(zoomAdjustedPixelValue(style.transformOriginZ(), st
yle)); |
| 2379 } else { | 2379 } else { |
| 2380 list->append(zoomAdjustedPixelValueForLength(style.transformOriginX(
), style)); | 2380 list->append(zoomAdjustedPixelValueForLength(style.transformOriginX(
), style)); |
| 2381 list->append(zoomAdjustedPixelValueForLength(style.transformOriginY(
), style)); | 2381 list->append(zoomAdjustedPixelValueForLength(style.transformOriginY(
), style)); |
| 2382 if (style.transformOriginZ() != 0) | 2382 if (style.transformOriginZ() != 0) |
| 2383 list->append(zoomAdjustedPixelValue(style.transformOriginZ(), st
yle)); | 2383 list->append(zoomAdjustedPixelValue(style.transformOriginZ(), st
yle)); |
| 2384 } | 2384 } |
| 2385 return list.release(); | 2385 return list; |
| 2386 } | 2386 } |
| 2387 case CSSPropertyTransformStyle: | 2387 case CSSPropertyTransformStyle: |
| 2388 return cssValuePool().createIdentifierValue((style.transformStyle3D() ==
TransformStyle3DPreserve3D) ? CSSValuePreserve3d : CSSValueFlat); | 2388 return cssValuePool().createIdentifierValue((style.transformStyle3D() ==
TransformStyle3DPreserve3D) ? CSSValuePreserve3d : CSSValueFlat); |
| 2389 case CSSPropertyTransitionDelay: | 2389 case CSSPropertyTransitionDelay: |
| 2390 return valueForAnimationDelay(style.transitions()); | 2390 return valueForAnimationDelay(style.transitions()); |
| 2391 case CSSPropertyTransitionDuration: | 2391 case CSSPropertyTransitionDuration: |
| 2392 return valueForAnimationDuration(style.transitions()); | 2392 return valueForAnimationDuration(style.transitions()); |
| 2393 case CSSPropertyTransitionProperty: | 2393 case CSSPropertyTransitionProperty: |
| 2394 return valueForTransitionProperty(style.transitions()); | 2394 return valueForTransitionProperty(style.transitions()); |
| 2395 case CSSPropertyTransitionTimingFunction: | 2395 case CSSPropertyTransitionTimingFunction: |
| 2396 return valueForAnimationTimingFunction(style.transitions()); | 2396 return valueForAnimationTimingFunction(style.transitions()); |
| 2397 case CSSPropertyTransition: { | 2397 case CSSPropertyTransition: { |
| 2398 const CSSTransitionData* transitionData = style.transitions(); | 2398 const CSSTransitionData* transitionData = style.transitions(); |
| 2399 if (transitionData) { | 2399 if (transitionData) { |
| 2400 RawPtr<CSSValueList> transitionsList = CSSValueList::createCommaSepa
rated(); | 2400 CSSValueList* transitionsList = CSSValueList::createCommaSeparated()
; |
| 2401 for (size_t i = 0; i < transitionData->propertyList().size(); ++i) { | 2401 for (size_t i = 0; i < transitionData->propertyList().size(); ++i) { |
| 2402 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | 2402 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 2403 list->append(createTransitionPropertyValue(transitionData->prope
rtyList()[i])); | 2403 list->append(createTransitionPropertyValue(transitionData->prope
rtyList()[i])); |
| 2404 list->append(cssValuePool().createValue(CSSTimingData::getRepeat
ed(transitionData->durationList(), i), CSSPrimitiveValue::UnitType::Seconds)); | 2404 list->append(cssValuePool().createValue(CSSTimingData::getRepeat
ed(transitionData->durationList(), i), CSSPrimitiveValue::UnitType::Seconds)); |
| 2405 list->append(createTimingFunctionValue(CSSTimingData::getRepeate
d(transitionData->timingFunctionList(), i).get())); | 2405 list->append(createTimingFunctionValue(CSSTimingData::getRepeate
d(transitionData->timingFunctionList(), i).get())); |
| 2406 list->append(cssValuePool().createValue(CSSTimingData::getRepeat
ed(transitionData->delayList(), i), CSSPrimitiveValue::UnitType::Seconds)); | 2406 list->append(cssValuePool().createValue(CSSTimingData::getRepeat
ed(transitionData->delayList(), i), CSSPrimitiveValue::UnitType::Seconds)); |
| 2407 transitionsList->append(list); | 2407 transitionsList->append(list); |
| 2408 } | 2408 } |
| 2409 return transitionsList.release(); | 2409 return transitionsList; |
| 2410 } | 2410 } |
| 2411 | 2411 |
| 2412 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 2412 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 2413 // transition-property default value. | 2413 // transition-property default value. |
| 2414 list->append(cssValuePool().createIdentifierValue(CSSValueAll)); | 2414 list->append(cssValuePool().createIdentifierValue(CSSValueAll)); |
| 2415 list->append(cssValuePool().createValue(CSSTransitionData::initialDurati
on(), CSSPrimitiveValue::UnitType::Seconds)); | 2415 list->append(cssValuePool().createValue(CSSTransitionData::initialDurati
on(), CSSPrimitiveValue::UnitType::Seconds)); |
| 2416 list->append(createTimingFunctionValue(CSSTransitionData::initialTimingF
unction().get())); | 2416 list->append(createTimingFunctionValue(CSSTransitionData::initialTimingF
unction().get())); |
| 2417 list->append(cssValuePool().createValue(CSSTransitionData::initialDelay(
), CSSPrimitiveValue::UnitType::Seconds)); | 2417 list->append(cssValuePool().createValue(CSSTransitionData::initialDelay(
), CSSPrimitiveValue::UnitType::Seconds)); |
| 2418 return list.release(); | 2418 return list; |
| 2419 } | 2419 } |
| 2420 case CSSPropertyPointerEvents: | 2420 case CSSPropertyPointerEvents: |
| 2421 return cssValuePool().createValue(style.pointerEvents()); | 2421 return cssValuePool().createValue(style.pointerEvents()); |
| 2422 case CSSPropertyWritingMode: | 2422 case CSSPropertyWritingMode: |
| 2423 case CSSPropertyWebkitWritingMode: | 2423 case CSSPropertyWebkitWritingMode: |
| 2424 return cssValuePool().createValue(style.getWritingMode()); | 2424 return cssValuePool().createValue(style.getWritingMode()); |
| 2425 case CSSPropertyWebkitTextCombine: | 2425 case CSSPropertyWebkitTextCombine: |
| 2426 if (style.getTextCombine() == TextCombineAll) | 2426 if (style.getTextCombine() == TextCombineAll) |
| 2427 return CSSPrimitiveValue::createIdentifier(CSSValueHorizontal); | 2427 return CSSPrimitiveValue::createIdentifier(CSSValueHorizontal); |
| 2428 case CSSPropertyTextCombineUpright: | 2428 case CSSPropertyTextCombineUpright: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2457 case CSSPropertyShapeOutside: | 2457 case CSSPropertyShapeOutside: |
| 2458 return valueForShape(style, style.shapeOutside()); | 2458 return valueForShape(style, style.shapeOutside()); |
| 2459 case CSSPropertyWebkitFilter: | 2459 case CSSPropertyWebkitFilter: |
| 2460 return valueForFilter(style, style.filter()); | 2460 return valueForFilter(style, style.filter()); |
| 2461 case CSSPropertyBackdropFilter: | 2461 case CSSPropertyBackdropFilter: |
| 2462 return valueForFilter(style, style.backdropFilter()); | 2462 return valueForFilter(style, style.backdropFilter()); |
| 2463 case CSSPropertyMixBlendMode: | 2463 case CSSPropertyMixBlendMode: |
| 2464 return cssValuePool().createValue(style.blendMode()); | 2464 return cssValuePool().createValue(style.blendMode()); |
| 2465 | 2465 |
| 2466 case CSSPropertyBackgroundBlendMode: { | 2466 case CSSPropertyBackgroundBlendMode: { |
| 2467 RawPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 2467 CSSValueList* list = CSSValueList::createCommaSeparated(); |
| 2468 for (const FillLayer* currLayer = &style.backgroundLayers(); currLayer;
currLayer = currLayer->next()) | 2468 for (const FillLayer* currLayer = &style.backgroundLayers(); currLayer;
currLayer = currLayer->next()) |
| 2469 list->append(cssValuePool().createValue(currLayer->blendMode())); | 2469 list->append(cssValuePool().createValue(currLayer->blendMode())); |
| 2470 return list.release(); | 2470 return list; |
| 2471 } | 2471 } |
| 2472 case CSSPropertyBackground: | 2472 case CSSPropertyBackground: |
| 2473 return valuesForBackgroundShorthand(style, layoutObject, styledNode, all
owVisitedStyle); | 2473 return valuesForBackgroundShorthand(style, layoutObject, styledNode, all
owVisitedStyle); |
| 2474 case CSSPropertyBorder: { | 2474 case CSSPropertyBorder: { |
| 2475 RawPtr<CSSValue> value = get(CSSPropertyBorderTop, style, layoutObject,
styledNode, allowVisitedStyle); | 2475 CSSValue* value = get(CSSPropertyBorderTop, style, layoutObject, styledN
ode, allowVisitedStyle); |
| 2476 const CSSPropertyID properties[] = { | 2476 const CSSPropertyID properties[] = { |
| 2477 CSSPropertyBorderRight, | 2477 CSSPropertyBorderRight, |
| 2478 CSSPropertyBorderBottom, | 2478 CSSPropertyBorderBottom, |
| 2479 CSSPropertyBorderLeft | 2479 CSSPropertyBorderLeft |
| 2480 }; | 2480 }; |
| 2481 for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) { | 2481 for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) { |
| 2482 if (!compareCSSValuePtr<CSSValue>(value, get(properties[i], style, l
ayoutObject, styledNode, allowVisitedStyle))) | 2482 if (!compareCSSValuePtr<CSSValue>(value, get(properties[i], style, l
ayoutObject, styledNode, allowVisitedStyle))) |
| 2483 return nullptr; | 2483 return nullptr; |
| 2484 } | 2484 } |
| 2485 return value.release(); | 2485 return value; |
| 2486 } | 2486 } |
| 2487 case CSSPropertyBorderBottom: | 2487 case CSSPropertyBorderBottom: |
| 2488 return valuesForShorthandProperty(borderBottomShorthand(), style, layout
Object, styledNode, allowVisitedStyle); | 2488 return valuesForShorthandProperty(borderBottomShorthand(), style, layout
Object, styledNode, allowVisitedStyle); |
| 2489 case CSSPropertyBorderColor: | 2489 case CSSPropertyBorderColor: |
| 2490 return valuesForSidesShorthand(borderColorShorthand(), style, layoutObje
ct, styledNode, allowVisitedStyle); | 2490 return valuesForSidesShorthand(borderColorShorthand(), style, layoutObje
ct, styledNode, allowVisitedStyle); |
| 2491 case CSSPropertyBorderLeft: | 2491 case CSSPropertyBorderLeft: |
| 2492 return valuesForShorthandProperty(borderLeftShorthand(), style, layoutOb
ject, styledNode, allowVisitedStyle); | 2492 return valuesForShorthandProperty(borderLeftShorthand(), style, layoutOb
ject, styledNode, allowVisitedStyle); |
| 2493 case CSSPropertyBorderImage: | 2493 case CSSPropertyBorderImage: |
| 2494 return valueForNinePieceImage(style.borderImage(), style); | 2494 return valueForNinePieceImage(style.borderImage(), style); |
| 2495 case CSSPropertyBorderRadius: | 2495 case CSSPropertyBorderRadius: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2524 | 2524 |
| 2525 case CSSPropertyMotionPath: | 2525 case CSSPropertyMotionPath: |
| 2526 if (const StylePath* styleMotionPath = style.motionPath()) | 2526 if (const StylePath* styleMotionPath = style.motionPath()) |
| 2527 return styleMotionPath->computedCSSValue(); | 2527 return styleMotionPath->computedCSSValue(); |
| 2528 return cssValuePool().createIdentifierValue(CSSValueNone); | 2528 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 2529 | 2529 |
| 2530 case CSSPropertyMotionOffset: | 2530 case CSSPropertyMotionOffset: |
| 2531 return zoomAdjustedPixelValueForLength(style.motionOffset(), style); | 2531 return zoomAdjustedPixelValueForLength(style.motionOffset(), style); |
| 2532 | 2532 |
| 2533 case CSSPropertyMotionRotation: { | 2533 case CSSPropertyMotionRotation: { |
| 2534 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 2534 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 2535 if (style.motionRotation().type == MotionRotationAuto) | 2535 if (style.motionRotation().type == MotionRotationAuto) |
| 2536 list->append(cssValuePool().createIdentifierValue(CSSValueAuto)); | 2536 list->append(cssValuePool().createIdentifierValue(CSSValueAuto)); |
| 2537 list->append(cssValuePool().createValue(style.motionRotation().angle, CS
SPrimitiveValue::UnitType::Degrees)); | 2537 list->append(cssValuePool().createValue(style.motionRotation().angle, CS
SPrimitiveValue::UnitType::Degrees)); |
| 2538 return list.release(); | 2538 return list; |
| 2539 } | 2539 } |
| 2540 | 2540 |
| 2541 // Unimplemented CSS 3 properties (including CSS3 shorthand properties). | 2541 // Unimplemented CSS 3 properties (including CSS3 shorthand properties). |
| 2542 case CSSPropertyWebkitTextEmphasis: | 2542 case CSSPropertyWebkitTextEmphasis: |
| 2543 return nullptr; | 2543 return nullptr; |
| 2544 | 2544 |
| 2545 // Directional properties are resolved by resolveDirectionAwareProperty() be
fore the switch. | 2545 // Directional properties are resolved by resolveDirectionAwareProperty() be
fore the switch. |
| 2546 case CSSPropertyWebkitBorderEnd: | 2546 case CSSPropertyWebkitBorderEnd: |
| 2547 case CSSPropertyWebkitBorderEndColor: | 2547 case CSSPropertyWebkitBorderEndColor: |
| 2548 case CSSPropertyWebkitBorderEndStyle: | 2548 case CSSPropertyWebkitBorderEndStyle: |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2727 case CSSPropertyScrollSnapPointsY: | 2727 case CSSPropertyScrollSnapPointsY: |
| 2728 return valueForScrollSnapPoints(style.scrollSnapPointsY(), style); | 2728 return valueForScrollSnapPoints(style.scrollSnapPointsY(), style); |
| 2729 case CSSPropertyScrollSnapCoordinate: | 2729 case CSSPropertyScrollSnapCoordinate: |
| 2730 return valueForScrollSnapCoordinate(style.scrollSnapCoordinate(), style)
; | 2730 return valueForScrollSnapCoordinate(style.scrollSnapCoordinate(), style)
; |
| 2731 case CSSPropertyScrollSnapDestination: | 2731 case CSSPropertyScrollSnapDestination: |
| 2732 return valueForScrollSnapDestination(style.scrollSnapDestination(), styl
e); | 2732 return valueForScrollSnapDestination(style.scrollSnapDestination(), styl
e); |
| 2733 case CSSPropertyTranslate: { | 2733 case CSSPropertyTranslate: { |
| 2734 if (!style.translate()) | 2734 if (!style.translate()) |
| 2735 return cssValuePool().createValue(0, CSSPrimitiveValue::UnitType::Pi
xels); | 2735 return cssValuePool().createValue(0, CSSPrimitiveValue::UnitType::Pi
xels); |
| 2736 | 2736 |
| 2737 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 2737 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 2738 if (layoutObject && layoutObject->isBox()) { | 2738 if (layoutObject && layoutObject->isBox()) { |
| 2739 LayoutRect box = toLayoutBox(layoutObject)->borderBoxRect(); | 2739 LayoutRect box = toLayoutBox(layoutObject)->borderBoxRect(); |
| 2740 list->append(zoomAdjustedPixelValue(floatValueForLength(style.transl
ate()->x(), box.width().toFloat()), style)); | 2740 list->append(zoomAdjustedPixelValue(floatValueForLength(style.transl
ate()->x(), box.width().toFloat()), style)); |
| 2741 | 2741 |
| 2742 if (!style.translate()->y().isZero() || style.translate()->z() != 0) | 2742 if (!style.translate()->y().isZero() || style.translate()->z() != 0) |
| 2743 list->append(zoomAdjustedPixelValue(floatValueForLength(style.tr
anslate()->y(), box.height().toFloat()), style)); | 2743 list->append(zoomAdjustedPixelValue(floatValueForLength(style.tr
anslate()->y(), box.height().toFloat()), style)); |
| 2744 | 2744 |
| 2745 } else { | 2745 } else { |
| 2746 // No box to resolve the percentage values | 2746 // No box to resolve the percentage values |
| 2747 list->append(zoomAdjustedPixelValueForLength(style.translate()->x(),
style)); | 2747 list->append(zoomAdjustedPixelValueForLength(style.translate()->x(),
style)); |
| 2748 | 2748 |
| 2749 if (!style.translate()->y().isZero() || style.translate()->z() != 0) | 2749 if (!style.translate()->y().isZero() || style.translate()->z() != 0) |
| 2750 list->append(zoomAdjustedPixelValueForLength(style.translate()->
y(), style)); | 2750 list->append(zoomAdjustedPixelValueForLength(style.translate()->
y(), style)); |
| 2751 } | 2751 } |
| 2752 | 2752 |
| 2753 if (style.translate()->z() != 0) | 2753 if (style.translate()->z() != 0) |
| 2754 list->append(zoomAdjustedPixelValue(style.translate()->z(), style)); | 2754 list->append(zoomAdjustedPixelValue(style.translate()->z(), style)); |
| 2755 | 2755 |
| 2756 return list.release(); | 2756 return list; |
| 2757 } | 2757 } |
| 2758 case CSSPropertyRotate: { | 2758 case CSSPropertyRotate: { |
| 2759 if (!style.rotate()) | 2759 if (!style.rotate()) |
| 2760 return cssValuePool().createValue(0, CSSPrimitiveValue::UnitType::De
grees); | 2760 return cssValuePool().createValue(0, CSSPrimitiveValue::UnitType::De
grees); |
| 2761 | 2761 |
| 2762 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 2762 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 2763 list->append(cssValuePool().createValue(style.rotate()->angle(), CSSPrim
itiveValue::UnitType::Degrees)); | 2763 list->append(cssValuePool().createValue(style.rotate()->angle(), CSSPrim
itiveValue::UnitType::Degrees)); |
| 2764 if (style.rotate()->x() != 0 || style.rotate()->y() != 0 || style.rotate
()->z() != 1) { | 2764 if (style.rotate()->x() != 0 || style.rotate()->y() != 0 || style.rotate
()->z() != 1) { |
| 2765 list->append(cssValuePool().createValue(style.rotate()->x(), CSSPrim
itiveValue::UnitType::Number)); | 2765 list->append(cssValuePool().createValue(style.rotate()->x(), CSSPrim
itiveValue::UnitType::Number)); |
| 2766 list->append(cssValuePool().createValue(style.rotate()->y(), CSSPrim
itiveValue::UnitType::Number)); | 2766 list->append(cssValuePool().createValue(style.rotate()->y(), CSSPrim
itiveValue::UnitType::Number)); |
| 2767 list->append(cssValuePool().createValue(style.rotate()->z(), CSSPrim
itiveValue::UnitType::Number)); | 2767 list->append(cssValuePool().createValue(style.rotate()->z(), CSSPrim
itiveValue::UnitType::Number)); |
| 2768 } | 2768 } |
| 2769 return list.release(); | 2769 return list; |
| 2770 } | 2770 } |
| 2771 case CSSPropertyScale: { | 2771 case CSSPropertyScale: { |
| 2772 if (!style.scale()) | 2772 if (!style.scale()) |
| 2773 return cssValuePool().createValue(1, CSSPrimitiveValue::UnitType::Nu
mber); | 2773 return cssValuePool().createValue(1, CSSPrimitiveValue::UnitType::Nu
mber); |
| 2774 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 2774 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 2775 list->append(cssValuePool().createValue(style.scale()->x(), CSSPrimitive
Value::UnitType::Number)); | 2775 list->append(cssValuePool().createValue(style.scale()->x(), CSSPrimitive
Value::UnitType::Number)); |
| 2776 if (style.scale()->y() == 1 && style.scale()->z() == 1) | 2776 if (style.scale()->y() == 1 && style.scale()->z() == 1) |
| 2777 return list.release(); | 2777 return list; |
| 2778 list->append(cssValuePool().createValue(style.scale()->y(), CSSPrimitive
Value::UnitType::Number)); | 2778 list->append(cssValuePool().createValue(style.scale()->y(), CSSPrimitive
Value::UnitType::Number)); |
| 2779 if (style.scale()->z() != 1) | 2779 if (style.scale()->z() != 1) |
| 2780 list->append(cssValuePool().createValue(style.scale()->z(), CSSPrimi
tiveValue::UnitType::Number)); | 2780 list->append(cssValuePool().createValue(style.scale()->z(), CSSPrimi
tiveValue::UnitType::Number)); |
| 2781 return list.release(); | 2781 return list; |
| 2782 } | 2782 } |
| 2783 case CSSPropertyContain: { | 2783 case CSSPropertyContain: { |
| 2784 if (!style.contain()) | 2784 if (!style.contain()) |
| 2785 return cssValuePool().createIdentifierValue(CSSValueNone); | 2785 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 2786 if (style.contain() == ContainsStrict) | 2786 if (style.contain() == ContainsStrict) |
| 2787 return cssValuePool().createIdentifierValue(CSSValueStrict); | 2787 return cssValuePool().createIdentifierValue(CSSValueStrict); |
| 2788 | 2788 |
| 2789 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 2789 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 2790 if (style.containsStyle()) | 2790 if (style.containsStyle()) |
| 2791 list->append(cssValuePool().createIdentifierValue(CSSValueStyle)); | 2791 list->append(cssValuePool().createIdentifierValue(CSSValueStyle)); |
| 2792 if (style.contain() & ContainsLayout) | 2792 if (style.contain() & ContainsLayout) |
| 2793 list->append(cssValuePool().createIdentifierValue(CSSValueLayout)); | 2793 list->append(cssValuePool().createIdentifierValue(CSSValueLayout)); |
| 2794 if (style.containsPaint()) | 2794 if (style.containsPaint()) |
| 2795 list->append(cssValuePool().createIdentifierValue(CSSValuePaint)); | 2795 list->append(cssValuePool().createIdentifierValue(CSSValuePaint)); |
| 2796 ASSERT(list->length()); | 2796 ASSERT(list->length()); |
| 2797 return list.release(); | 2797 return list; |
| 2798 } | 2798 } |
| 2799 case CSSPropertySnapHeight: { | 2799 case CSSPropertySnapHeight: { |
| 2800 if (!style.snapHeightUnit()) | 2800 if (!style.snapHeightUnit()) |
| 2801 return cssValuePool().createValue(0, CSSPrimitiveValue::UnitType::Pi
xels); | 2801 return cssValuePool().createValue(0, CSSPrimitiveValue::UnitType::Pi
xels); |
| 2802 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 2802 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 2803 list->append(cssValuePool().createValue(style.snapHeightUnit(), CSSPrimi
tiveValue::UnitType::Pixels)); | 2803 list->append(cssValuePool().createValue(style.snapHeightUnit(), CSSPrimi
tiveValue::UnitType::Pixels)); |
| 2804 if (style.snapHeightPosition()) | 2804 if (style.snapHeightPosition()) |
| 2805 list->append(cssValuePool().createValue(style.snapHeightPosition(),
CSSPrimitiveValue::UnitType::Integer)); | 2805 list->append(cssValuePool().createValue(style.snapHeightPosition(),
CSSPrimitiveValue::UnitType::Integer)); |
| 2806 return list.release(); | 2806 return list; |
| 2807 } | 2807 } |
| 2808 case CSSPropertyVariable: | 2808 case CSSPropertyVariable: |
| 2809 // Variables are retrieved via get(AtomicString). | 2809 // Variables are retrieved via get(AtomicString). |
| 2810 ASSERT_NOT_REACHED(); | 2810 ASSERT_NOT_REACHED(); |
| 2811 return nullptr; | 2811 return nullptr; |
| 2812 case CSSPropertyAll: | 2812 case CSSPropertyAll: |
| 2813 return nullptr; | 2813 return nullptr; |
| 2814 default: | 2814 default: |
| 2815 break; | 2815 break; |
| 2816 } | 2816 } |
| 2817 ASSERT_NOT_REACHED(); | 2817 ASSERT_NOT_REACHED(); |
| 2818 return nullptr; | 2818 return nullptr; |
| 2819 } | 2819 } |
| 2820 | 2820 |
| 2821 } // namespace blink | 2821 } // namespace blink |
| OLD | NEW |