| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
| 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r
ights reserved. |
| 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 187 |
| 188 if (value->isPrimitiveValue() && (toCSSPrimitiveValue(value)->getValueID() =
= CSSValueContain || toCSSPrimitiveValue(value)->getValueID() == CSSValueCover))
{ | 188 if (value->isPrimitiveValue() && (toCSSPrimitiveValue(value)->getValueID() =
= CSSValueContain || toCSSPrimitiveValue(value)->getValueID() == CSSValueCover))
{ |
| 189 layer->setSizeLength(b); | 189 layer->setSizeLength(b); |
| 190 return; | 190 return; |
| 191 } | 191 } |
| 192 | 192 |
| 193 Length firstLength; | 193 Length firstLength; |
| 194 Length secondLength; | 194 Length secondLength; |
| 195 | 195 |
| 196 if (value->isValuePair()) { | 196 if (value->isValuePair()) { |
| 197 const CSSValuePair* pair = toCSSValuePair(value); | 197 CSSValuePair* pair = toCSSValuePair(value); |
| 198 firstLength = StyleBuilderConverter::convertLengthOrAuto(state, pair->fi
rst()); | 198 firstLength = StyleBuilderConverter::convertLengthOrAuto(state, &pair->f
irst()); |
| 199 secondLength = StyleBuilderConverter::convertLengthOrAuto(state, pair->s
econd()); | 199 secondLength = StyleBuilderConverter::convertLengthOrAuto(state, &pair->
second()); |
| 200 } else { | 200 } else { |
| 201 ASSERT(value->isPrimitiveValue()); | 201 ASSERT(value->isPrimitiveValue()); |
| 202 firstLength = StyleBuilderConverter::convertLengthOrAuto(state, value); | 202 firstLength = StyleBuilderConverter::convertLengthOrAuto(state, value); |
| 203 secondLength = Length(); | 203 secondLength = Length(); |
| 204 } | 204 } |
| 205 | 205 |
| 206 b.setWidth(firstLength); | 206 b.setWidth(firstLength); |
| 207 b.setHeight(secondLength); | 207 b.setHeight(secondLength); |
| 208 layer->setSizeLength(b); | 208 layer->setSizeLength(b); |
| 209 } | 209 } |
| 210 | 210 |
| 211 void CSSToStyleMap::mapFillXPosition(StyleResolverState& state, FillLayer* layer
, CSSValue* value) | 211 void CSSToStyleMap::mapFillXPosition(StyleResolverState& state, FillLayer* layer
, CSSValue* value) |
| 212 { | 212 { |
| 213 if (value->isInitialValue()) { | 213 if (value->isInitialValue()) { |
| 214 layer->setXPosition(FillLayer::initialFillXPosition(layer->type())); | 214 layer->setXPosition(FillLayer::initialFillXPosition(layer->type())); |
| 215 return; | 215 return; |
| 216 } | 216 } |
| 217 | 217 |
| 218 if (!value->isPrimitiveValue() && !value->isValuePair()) | 218 if (!value->isPrimitiveValue() && !value->isValuePair()) |
| 219 return; | 219 return; |
| 220 | 220 |
| 221 CSSPrimitiveValue* primitiveValue; | 221 Length length; |
| 222 if (value->isValuePair()) | 222 if (value->isValuePair()) |
| 223 primitiveValue = toCSSPrimitiveValue(toCSSValuePair(value)->second()); | 223 length = toCSSPrimitiveValue(toCSSValuePair(value)->second()).convertToL
ength(state.cssToLengthConversionData()); |
| 224 else | 224 else |
| 225 primitiveValue = toCSSPrimitiveValue(value); | 225 length = toCSSPrimitiveValue(value)->convertToLength(state.cssToLengthCo
nversionData()); |
| 226 | |
| 227 Length length = primitiveValue->convertToLength(state.cssToLengthConversionD
ata()); | |
| 228 | 226 |
| 229 layer->setXPosition(length); | 227 layer->setXPosition(length); |
| 230 if (value->isValuePair()) | 228 if (value->isValuePair()) |
| 231 layer->setBackgroundXOrigin(*toCSSPrimitiveValue(toCSSValuePair(value)->
first())); | 229 layer->setBackgroundXOrigin(toCSSPrimitiveValue(toCSSValuePair(value)->f
irst())); |
| 232 } | 230 } |
| 233 | 231 |
| 234 void CSSToStyleMap::mapFillYPosition(StyleResolverState& state, FillLayer* layer
, CSSValue* value) | 232 void CSSToStyleMap::mapFillYPosition(StyleResolverState& state, FillLayer* layer
, CSSValue* value) |
| 235 { | 233 { |
| 236 if (value->isInitialValue()) { | 234 if (value->isInitialValue()) { |
| 237 layer->setYPosition(FillLayer::initialFillYPosition(layer->type())); | 235 layer->setYPosition(FillLayer::initialFillYPosition(layer->type())); |
| 238 return; | 236 return; |
| 239 } | 237 } |
| 240 | 238 |
| 241 if (!value->isPrimitiveValue() && !value->isValuePair()) | 239 if (!value->isPrimitiveValue() && !value->isValuePair()) |
| 242 return; | 240 return; |
| 243 | 241 |
| 244 CSSPrimitiveValue* primitiveValue; | 242 CSSPrimitiveValue* primitiveValue; |
| 245 if (value->isValuePair()) | 243 if (value->isValuePair()) |
| 246 primitiveValue = toCSSPrimitiveValue(toCSSValuePair(value)->second()); | 244 primitiveValue = &toCSSPrimitiveValue(toCSSValuePair(value)->second()); |
| 247 else | 245 else |
| 248 primitiveValue = toCSSPrimitiveValue(value); | 246 primitiveValue = toCSSPrimitiveValue(value); |
| 249 | 247 |
| 250 Length length = primitiveValue->convertToLength(state.cssToLengthConversionD
ata()); | 248 Length length = primitiveValue->convertToLength(state.cssToLengthConversionD
ata()); |
| 251 | 249 |
| 252 layer->setYPosition(length); | 250 layer->setYPosition(length); |
| 253 if (value->isValuePair()) | 251 if (value->isValuePair()) |
| 254 layer->setBackgroundYOrigin(*toCSSPrimitiveValue(toCSSValuePair(value)->
first())); | 252 layer->setBackgroundYOrigin(toCSSPrimitiveValue(toCSSValuePair(value)->f
irst())); |
| 255 } | 253 } |
| 256 | 254 |
| 257 void CSSToStyleMap::mapFillMaskSourceType(StyleResolverState&, FillLayer* layer,
CSSValue* value) | 255 void CSSToStyleMap::mapFillMaskSourceType(StyleResolverState&, FillLayer* layer,
CSSValue* value) |
| 258 { | 256 { |
| 259 EMaskSourceType type = FillLayer::initialFillMaskSourceType(layer->type()); | 257 EMaskSourceType type = FillLayer::initialFillMaskSourceType(layer->type()); |
| 260 if (value->isInitialValue()) { | 258 if (value->isInitialValue()) { |
| 261 layer->setMaskSourceType(type); | 259 layer->setMaskSourceType(type); |
| 262 return; | 260 return; |
| 263 } | 261 } |
| 264 | 262 |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 toBorderImageLength(*slices->right(), state.cssToLengthConversionData())
, | 540 toBorderImageLength(*slices->right(), state.cssToLengthConversionData())
, |
| 543 toBorderImageLength(*slices->bottom(), state.cssToLengthConversionData()
), | 541 toBorderImageLength(*slices->bottom(), state.cssToLengthConversionData()
), |
| 544 toBorderImageLength(*slices->left(), state.cssToLengthConversionData()))
; | 542 toBorderImageLength(*slices->left(), state.cssToLengthConversionData()))
; |
| 545 } | 543 } |
| 546 | 544 |
| 547 void CSSToStyleMap::mapNinePieceImageRepeat(StyleResolverState&, CSSValue* value
, NinePieceImage& image) | 545 void CSSToStyleMap::mapNinePieceImageRepeat(StyleResolverState&, CSSValue* value
, NinePieceImage& image) |
| 548 { | 546 { |
| 549 if (!value || !value->isValuePair()) | 547 if (!value || !value->isValuePair()) |
| 550 return; | 548 return; |
| 551 | 549 |
| 552 const CSSValuePair* pair = toCSSValuePair(value); | 550 const CSSValuePair& pair = toCSSValuePair(*value); |
| 553 if (!pair || !pair->first() || !pair->second()) | 551 CSSValueID firstIdentifier = toCSSPrimitiveValue(pair.first()).getValueID(); |
| 554 return; | 552 CSSValueID secondIdentifier = toCSSPrimitiveValue(pair.second()).getValueID(
); |
| 555 | |
| 556 CSSValueID firstIdentifier = toCSSPrimitiveValue(pair->first())->getValueID(
); | |
| 557 CSSValueID secondIdentifier = toCSSPrimitiveValue(pair->second())->getValueI
D(); | |
| 558 | 553 |
| 559 ENinePieceImageRule horizontalRule; | 554 ENinePieceImageRule horizontalRule; |
| 560 switch (firstIdentifier) { | 555 switch (firstIdentifier) { |
| 561 case CSSValueStretch: | 556 case CSSValueStretch: |
| 562 horizontalRule = StretchImageRule; | 557 horizontalRule = StretchImageRule; |
| 563 break; | 558 break; |
| 564 case CSSValueRound: | 559 case CSSValueRound: |
| 565 horizontalRule = RoundImageRule; | 560 horizontalRule = RoundImageRule; |
| 566 break; | 561 break; |
| 567 case CSSValueSpace: | 562 case CSSValueSpace: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 585 verticalRule = SpaceImageRule; | 580 verticalRule = SpaceImageRule; |
| 586 break; | 581 break; |
| 587 default: // CSSValueRepeat | 582 default: // CSSValueRepeat |
| 588 verticalRule = RepeatImageRule; | 583 verticalRule = RepeatImageRule; |
| 589 break; | 584 break; |
| 590 } | 585 } |
| 591 image.setVerticalRule(verticalRule); | 586 image.setVerticalRule(verticalRule); |
| 592 } | 587 } |
| 593 | 588 |
| 594 }; | 589 }; |
| OLD | NEW |