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. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. |
4 * All rights reserved. | 4 * All rights reserved. |
5 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 5 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
7 * Copyright (C) 2011 Sencha, Inc. All rights reserved. | 7 * Copyright (C) 2011 Sencha, Inc. All rights reserved. |
8 * Copyright (C) 2015 Google Inc. All rights reserved. | 8 * Copyright (C) 2015 Google Inc. All rights reserved. |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1595 list->append(*leftValue); | 1595 list->append(*leftValue); |
1596 | 1596 |
1597 return list; | 1597 return list; |
1598 } | 1598 } |
1599 | 1599 |
1600 static CSSValueList* valueForBorderRadiusShorthand(const ComputedStyle& style) { | 1600 static CSSValueList* valueForBorderRadiusShorthand(const ComputedStyle& style) { |
1601 CSSValueList* list = CSSValueList::createSlashSeparated(); | 1601 CSSValueList* list = CSSValueList::createSlashSeparated(); |
1602 | 1602 |
1603 bool showHorizontalBottomLeft = style.borderTopRightRadius().width() != | 1603 bool showHorizontalBottomLeft = style.borderTopRightRadius().width() != |
1604 style.borderBottomLeftRadius().width(); | 1604 style.borderBottomLeftRadius().width(); |
1605 bool showHorizontalBottomRight = | 1605 bool showHorizontalBottomRight = showHorizontalBottomLeft || |
1606 showHorizontalBottomLeft || (style.borderBottomRightRadius().width() != | 1606 (style.borderBottomRightRadius().width() != |
1607 style.borderTopLeftRadius().width()); | |
1608 bool showHorizontalTopRight = | |
1609 showHorizontalBottomRight || (style.borderTopRightRadius().width() != | |
1610 style.borderTopLeftRadius().width()); | 1607 style.borderTopLeftRadius().width()); |
| 1608 bool showHorizontalTopRight = showHorizontalBottomRight || |
| 1609 (style.borderTopRightRadius().width() != |
| 1610 style.borderTopLeftRadius().width()); |
1611 | 1611 |
1612 bool showVerticalBottomLeft = style.borderTopRightRadius().height() != | 1612 bool showVerticalBottomLeft = style.borderTopRightRadius().height() != |
1613 style.borderBottomLeftRadius().height(); | 1613 style.borderBottomLeftRadius().height(); |
1614 bool showVerticalBottomRight = | 1614 bool showVerticalBottomRight = showVerticalBottomLeft || |
1615 showVerticalBottomLeft || (style.borderBottomRightRadius().height() != | 1615 (style.borderBottomRightRadius().height() != |
1616 style.borderTopLeftRadius().height()); | |
1617 bool showVerticalTopRight = | |
1618 showVerticalBottomRight || (style.borderTopRightRadius().height() != | |
1619 style.borderTopLeftRadius().height()); | 1616 style.borderTopLeftRadius().height()); |
| 1617 bool showVerticalTopRight = showVerticalBottomRight || |
| 1618 (style.borderTopRightRadius().height() != |
| 1619 style.borderTopLeftRadius().height()); |
1620 | 1620 |
1621 CSSValueList* topLeftRadius = | 1621 CSSValueList* topLeftRadius = |
1622 valuesForBorderRadiusCorner(style.borderTopLeftRadius(), style); | 1622 valuesForBorderRadiusCorner(style.borderTopLeftRadius(), style); |
1623 CSSValueList* topRightRadius = | 1623 CSSValueList* topRightRadius = |
1624 valuesForBorderRadiusCorner(style.borderTopRightRadius(), style); | 1624 valuesForBorderRadiusCorner(style.borderTopRightRadius(), style); |
1625 CSSValueList* bottomRightRadius = | 1625 CSSValueList* bottomRightRadius = |
1626 valuesForBorderRadiusCorner(style.borderBottomRightRadius(), style); | 1626 valuesForBorderRadiusCorner(style.borderBottomRightRadius(), style); |
1627 CSSValueList* bottomLeftRadius = | 1627 CSSValueList* bottomLeftRadius = |
1628 valuesForBorderRadiusCorner(style.borderBottomLeftRadius(), style); | 1628 valuesForBorderRadiusCorner(style.borderBottomLeftRadius(), style); |
1629 | 1629 |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2224 return valueForReflection(style.boxReflect(), style); | 2224 return valueForReflection(style.boxReflect(), style); |
2225 case CSSPropertyBoxShadow: | 2225 case CSSPropertyBoxShadow: |
2226 return valueForShadowList(style.boxShadow(), style, true); | 2226 return valueForShadowList(style.boxShadow(), style, true); |
2227 case CSSPropertyCaptionSide: | 2227 case CSSPropertyCaptionSide: |
2228 return CSSIdentifierValue::create(style.captionSide()); | 2228 return CSSIdentifierValue::create(style.captionSide()); |
2229 case CSSPropertyCaretColor: | 2229 case CSSPropertyCaretColor: |
2230 return allowVisitedStyle | 2230 return allowVisitedStyle |
2231 ? CSSColorValue::create( | 2231 ? CSSColorValue::create( |
2232 style.visitedDependentColor(CSSPropertyCaretColor).rgb()) | 2232 style.visitedDependentColor(CSSPropertyCaretColor).rgb()) |
2233 : currentColorOrValidColor( | 2233 : currentColorOrValidColor( |
2234 style, style.caretColor().isAutoColor() | 2234 style, |
2235 ? StyleColor::currentColor() | 2235 style.caretColor().isAutoColor() |
2236 : style.caretColor().toStyleColor()); | 2236 ? StyleColor::currentColor() |
| 2237 : style.caretColor().toStyleColor()); |
2237 case CSSPropertyClear: | 2238 case CSSPropertyClear: |
2238 return CSSIdentifierValue::create(style.clear()); | 2239 return CSSIdentifierValue::create(style.clear()); |
2239 case CSSPropertyColor: | 2240 case CSSPropertyColor: |
2240 return CSSColorValue::create( | 2241 return CSSColorValue::create( |
2241 allowVisitedStyle | 2242 allowVisitedStyle |
2242 ? style.visitedDependentColor(CSSPropertyColor).rgb() | 2243 ? style.visitedDependentColor(CSSPropertyColor).rgb() |
2243 : style.color().rgb()); | 2244 : style.color().rgb()); |
2244 case CSSPropertyWebkitPrintColorAdjust: | 2245 case CSSPropertyWebkitPrintColorAdjust: |
2245 return CSSIdentifierValue::create(style.printColorAdjust()); | 2246 return CSSIdentifierValue::create(style.printColorAdjust()); |
2246 case CSSPropertyColumnCount: | 2247 case CSSPropertyColumnCount: |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2555 Length marginRight = style.marginRight(); | 2556 Length marginRight = style.marginRight(); |
2556 if (marginRight.isFixed() || !layoutObject || !layoutObject->isBox()) | 2557 if (marginRight.isFixed() || !layoutObject || !layoutObject->isBox()) |
2557 return zoomAdjustedPixelValueForLength(marginRight, style); | 2558 return zoomAdjustedPixelValueForLength(marginRight, style); |
2558 float value; | 2559 float value; |
2559 if (marginRight.isPercentOrCalc()) { | 2560 if (marginRight.isPercentOrCalc()) { |
2560 // LayoutBox gives a marginRight() that is the distance between the | 2561 // LayoutBox gives a marginRight() that is the distance between the |
2561 // right-edge of the child box and the right-edge of the containing box, | 2562 // right-edge of the child box and the right-edge of the containing box, |
2562 // when display == EDisplay::Block. Let's calculate the absolute value | 2563 // when display == EDisplay::Block. Let's calculate the absolute value |
2563 // of the specified margin-right % instead of relying on LayoutBox's | 2564 // of the specified margin-right % instead of relying on LayoutBox's |
2564 // marginRight() value. | 2565 // marginRight() value. |
2565 value = minimumValueForLength( | 2566 value = |
2566 marginRight, toLayoutBox(layoutObject) | 2567 minimumValueForLength(marginRight, |
2567 ->containingBlockLogicalWidthForContent()) | 2568 toLayoutBox(layoutObject) |
2568 .toFloat(); | 2569 ->containingBlockLogicalWidthForContent()) |
| 2570 .toFloat(); |
2569 } else { | 2571 } else { |
2570 value = toLayoutBox(layoutObject)->marginRight().toFloat(); | 2572 value = toLayoutBox(layoutObject)->marginRight().toFloat(); |
2571 } | 2573 } |
2572 return zoomAdjustedPixelValue(value, style); | 2574 return zoomAdjustedPixelValue(value, style); |
2573 } | 2575 } |
2574 case CSSPropertyMarginBottom: { | 2576 case CSSPropertyMarginBottom: { |
2575 Length marginBottom = style.marginBottom(); | 2577 Length marginBottom = style.marginBottom(); |
2576 if (marginBottom.isFixed() || !layoutObject || !layoutObject->isBox()) | 2578 if (marginBottom.isFixed() || !layoutObject || !layoutObject->isBox()) |
2577 return zoomAdjustedPixelValueForLength(marginBottom, style); | 2579 return zoomAdjustedPixelValueForLength(marginBottom, style); |
2578 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->marginBottom(), | 2580 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->marginBottom(), |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3252 return valuesForBackgroundShorthand(style, layoutObject, styledNode, | 3254 return valuesForBackgroundShorthand(style, layoutObject, styledNode, |
3253 allowVisitedStyle); | 3255 allowVisitedStyle); |
3254 case CSSPropertyBorder: { | 3256 case CSSPropertyBorder: { |
3255 const CSSValue* value = get(CSSPropertyBorderTop, style, layoutObject, | 3257 const CSSValue* value = get(CSSPropertyBorderTop, style, layoutObject, |
3256 styledNode, allowVisitedStyle); | 3258 styledNode, allowVisitedStyle); |
3257 const CSSPropertyID properties[] = {CSSPropertyBorderRight, | 3259 const CSSPropertyID properties[] = {CSSPropertyBorderRight, |
3258 CSSPropertyBorderBottom, | 3260 CSSPropertyBorderBottom, |
3259 CSSPropertyBorderLeft}; | 3261 CSSPropertyBorderLeft}; |
3260 for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) { | 3262 for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) { |
3261 if (!compareCSSValuePtr<CSSValue>( | 3263 if (!compareCSSValuePtr<CSSValue>( |
3262 value, get(properties[i], style, layoutObject, styledNode, | 3264 value, |
3263 allowVisitedStyle))) | 3265 get(properties[i], style, layoutObject, styledNode, |
| 3266 allowVisitedStyle))) |
3264 return nullptr; | 3267 return nullptr; |
3265 } | 3268 } |
3266 return value; | 3269 return value; |
3267 } | 3270 } |
3268 case CSSPropertyBorderBottom: | 3271 case CSSPropertyBorderBottom: |
3269 return valuesForShorthandProperty(borderBottomShorthand(), style, | 3272 return valuesForShorthandProperty(borderBottomShorthand(), style, |
3270 layoutObject, styledNode, | 3273 layoutObject, styledNode, |
3271 allowVisitedStyle); | 3274 allowVisitedStyle); |
3272 case CSSPropertyBorderColor: | 3275 case CSSPropertyBorderColor: |
3273 return valuesForSidesShorthand(borderColorShorthand(), style, | 3276 return valuesForSidesShorthand(borderColorShorthand(), style, |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3665 case CSSPropertyAll: | 3668 case CSSPropertyAll: |
3666 return nullptr; | 3669 return nullptr; |
3667 default: | 3670 default: |
3668 break; | 3671 break; |
3669 } | 3672 } |
3670 ASSERT_NOT_REACHED(); | 3673 ASSERT_NOT_REACHED(); |
3671 return nullptr; | 3674 return nullptr; |
3672 } | 3675 } |
3673 | 3676 |
3674 } // namespace blink | 3677 } // namespace blink |
OLD | NEW |