| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
| 9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
| 10 * disclaimer. | 10 * disclaimer. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 result.append(')'); | 62 result.append(')'); |
| 63 if (box.length()) { | 63 if (box.length()) { |
| 64 result.appendLiteral(separator); | 64 result.appendLiteral(separator); |
| 65 result.append(box); | 65 result.append(box); |
| 66 } | 66 } |
| 67 return result.toString(); | 67 return result.toString(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 static String serializePositionOffset(const Pair& offset, const Pair& other) | 70 static String serializePositionOffset(const Pair& offset, const Pair& other) |
| 71 { | 71 { |
| 72 if ((toCSSPrimitiveValue(*offset.first()).getValueID() == CSSValueLeft && to
CSSPrimitiveValue(*other.first()).getValueID() == CSSValueTop) | 72 if ((offset.first().getValueID() == CSSValueLeft && other.first().getValueID
() == CSSValueTop) |
| 73 || (toCSSPrimitiveValue(*offset.first()).getValueID() == CSSValueTop &&
toCSSPrimitiveValue(*other.first()).getValueID() == CSSValueLeft)) | 73 || (offset.first().getValueID() == CSSValueTop && other.first().getValue
ID() == CSSValueLeft)) |
| 74 return offset.second()->cssText(); | 74 return offset.second().cssText(); |
| 75 return offset.cssText(); | 75 return offset.cssText(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 static CSSPrimitiveValue buildSerializablePositionOffset(NullableCSSValue offset
, CSSValueID defaultSide) | 78 static CSSPrimitiveValue buildSerializablePositionOffset(const NullableCSSValue&
offset, CSSValueID defaultSide) |
| 79 { | 79 { |
| 80 CSSValueID side = defaultSide; | 80 CSSValueID side = defaultSide; |
| 81 NullableCSSValue amount; | 81 NullableCSSValue amount; |
| 82 | 82 |
| 83 if (!offset) { | 83 if (!offset) { |
| 84 side = CSSValueCenter; | 84 side = CSSValueCenter; |
| 85 } else if (toCSSPrimitiveValue(*offset).isValueID()) { | 85 } else if (toCSSPrimitiveValue(*offset).isValueID()) { |
| 86 side = toCSSPrimitiveValue(*offset).getValueID(); | 86 side = toCSSPrimitiveValue(*offset).getValueID(); |
| 87 } else if (Pair* pair = toCSSPrimitiveValue(*offset).getPairValue()) { | 87 } else if (Pair* pair = toCSSPrimitiveValue(*offset).getPairValue()) { |
| 88 side = toCSSPrimitiveValue(*pair->first()).getValueID(); | 88 side = pair->first().getValueID(); |
| 89 amount = pair->second(); | 89 amount = pair->second(); |
| 90 } else { | 90 } else { |
| 91 amount = offset; | 91 amount = offset; |
| 92 } | 92 } |
| 93 | 93 |
| 94 if (side == CSSValueCenter) { | 94 if (side == CSSValueCenter) { |
| 95 side = defaultSide; | 95 side = defaultSide; |
| 96 amount = cssValuePool().createValue(50, CSSPrimitiveValue::CSS_PERCENTAG
E); | 96 amount = cssValuePool().createValue(50, CSSPrimitiveValue::CSS_PERCENTAG
E); |
| 97 } else if ((side == CSSValueRight || side == CSSValueBottom) | 97 } else if ((side == CSSValueRight || side == CSSValueBottom) |
| 98 && toCSSPrimitiveValue(*amount).isPercentage()) { | 98 && toCSSPrimitiveValue(*amount).isPercentage()) { |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 result.append(verticalRadii[i]); | 371 result.append(verticalRadii[i]); |
| 372 } | 372 } |
| 373 } | 373 } |
| 374 } | 374 } |
| 375 } | 375 } |
| 376 result.append(')'); | 376 result.append(')'); |
| 377 | 377 |
| 378 return result.toString(); | 378 return result.toString(); |
| 379 } | 379 } |
| 380 | 380 |
| 381 static inline void updateCornerRadiusWidthAndHeight(NullableCSSValue corner, Str
ing& width, String& height) | 381 static inline void updateCornerRadiusWidthAndHeight(const NullableCSSValue& corn
er, String& width, String& height) |
| 382 { | 382 { |
| 383 if (!corner) | 383 if (!corner) |
| 384 return; | 384 return; |
| 385 | 385 |
| 386 Pair* radius = toCSSPrimitiveValue(*corner).getPairValue(); | 386 Pair* radius = toCSSPrimitiveValue(*corner).getPairValue(); |
| 387 width = radius->first() ? radius->first()->cssText() : String("0"); | 387 width = radius->first().cssText(); |
| 388 if (radius->second()) | 388 height = radius->second().cssText(); |
| 389 height = radius->second()->cssText(); | |
| 390 } | 389 } |
| 391 | 390 |
| 392 String CSSBasicShapeInset::cssText() const | 391 String CSSBasicShapeInset::cssText() const |
| 393 { | 392 { |
| 394 String topLeftRadiusWidth; | 393 String topLeftRadiusWidth; |
| 395 String topLeftRadiusHeight; | 394 String topLeftRadiusHeight; |
| 396 String topRightRadiusWidth; | 395 String topRightRadiusWidth; |
| 397 String topRightRadiusHeight; | 396 String topRightRadiusHeight; |
| 398 String bottomRightRadiusWidth; | 397 String bottomRightRadiusWidth; |
| 399 String bottomRightRadiusHeight; | 398 String bottomRightRadiusHeight; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 visitor->trace(m_left); | 442 visitor->trace(m_left); |
| 444 visitor->trace(m_topLeftRadius); | 443 visitor->trace(m_topLeftRadius); |
| 445 visitor->trace(m_topRightRadius); | 444 visitor->trace(m_topRightRadius); |
| 446 visitor->trace(m_bottomRightRadius); | 445 visitor->trace(m_bottomRightRadius); |
| 447 visitor->trace(m_bottomLeftRadius); | 446 visitor->trace(m_bottomLeftRadius); |
| 448 CSSBasicShape::trace(visitor); | 447 CSSBasicShape::trace(visitor); |
| 449 } | 448 } |
| 450 | 449 |
| 451 } // namespace blink | 450 } // namespace blink |
| 452 | 451 |
| OLD | NEW |