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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 if (data.positionType() == LegacyPosition) | 441 if (data.positionType() == LegacyPosition) |
442 result->append(*CSSPrimitiveValue::createIdentifier(CSSValueLegacy)); | 442 result->append(*CSSPrimitiveValue::createIdentifier(CSSValueLegacy)); |
443 // To avoid needing to copy the RareNonInheritedData, we repurpose the 'auto
' flag to not just mean 'auto' prior to running the StyleAdjuster but also mean
'normal' after running it. | 443 // To avoid needing to copy the RareNonInheritedData, we repurpose the 'auto
' flag to not just mean 'auto' prior to running the StyleAdjuster but also mean
'normal' after running it. |
444 result->append(*CSSPrimitiveValue::create(data.position() == ItemPositionAut
o ? ComputedStyle::initialDefaultAlignment().position() : data.position())); | 444 result->append(*CSSPrimitiveValue::create(data.position() == ItemPositionAut
o ? ComputedStyle::initialDefaultAlignment().position() : data.position())); |
445 if (data.position() >= ItemPositionCenter && data.overflow() != OverflowAlig
nmentDefault) | 445 if (data.position() >= ItemPositionCenter && data.overflow() != OverflowAlig
nmentDefault) |
446 result->append(*CSSPrimitiveValue::create(data.overflow())); | 446 result->append(*CSSPrimitiveValue::create(data.overflow())); |
447 ASSERT(result->length() <= 2); | 447 ASSERT(result->length() <= 2); |
448 return result; | 448 return result; |
449 } | 449 } |
450 | 450 |
| 451 static CSSValue* valueForOffsetPath(const StylePath* styleMotionPath) |
| 452 { |
| 453 if (styleMotionPath) |
| 454 return styleMotionPath->computedCSSValue(); |
| 455 return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
| 456 } |
| 457 |
| 458 static CSSValue* valueForOffsetRotation(const StyleOffsetRotation& offsetRotatio
n) |
| 459 { |
| 460 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 461 if (offsetRotation.type == OffsetRotationAuto) |
| 462 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueAuto)); |
| 463 list->append(*CSSPrimitiveValue::create(offsetRotation.angle, CSSPrimitiveVa
lue::UnitType::Degrees)); |
| 464 return list; |
| 465 } |
| 466 |
451 static CSSValueList* valuesForGridShorthand(const StylePropertyShorthand& shorth
and, const ComputedStyle& style, const LayoutObject* layoutObject, Node* styledN
ode, bool allowVisitedStyle) | 467 static CSSValueList* valuesForGridShorthand(const StylePropertyShorthand& shorth
and, const ComputedStyle& style, const LayoutObject* layoutObject, Node* styledN
ode, bool allowVisitedStyle) |
452 { | 468 { |
453 CSSValueList* list = CSSValueList::createSlashSeparated(); | 469 CSSValueList* list = CSSValueList::createSlashSeparated(); |
454 for (size_t i = 0; i < shorthand.length(); ++i) { | 470 for (size_t i = 0; i < shorthand.length(); ++i) { |
455 const CSSValue* value = ComputedStyleCSSValueMapping::get(shorthand.prop
erties()[i], style, layoutObject, styledNode, allowVisitedStyle); | 471 const CSSValue* value = ComputedStyleCSSValueMapping::get(shorthand.prop
erties()[i], style, layoutObject, styledNode, allowVisitedStyle); |
456 ASSERT(value); | 472 ASSERT(value); |
457 list->append(*value); | 473 list->append(*value); |
458 } | 474 } |
459 return list; | 475 return list; |
460 } | 476 } |
(...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1564 list->append(*capsValue); | 1580 list->append(*capsValue); |
1565 | 1581 |
1566 list->append(*valueForFontWeight(style)); | 1582 list->append(*valueForFontWeight(style)); |
1567 list->append(*valueForFontStretch(style)); | 1583 list->append(*valueForFontStretch(style)); |
1568 list->append(*sizeAndLineHeight); | 1584 list->append(*sizeAndLineHeight); |
1569 list->append(*valueForFontFamily(style)); | 1585 list->append(*valueForFontFamily(style)); |
1570 | 1586 |
1571 return list; | 1587 return list; |
1572 } | 1588 } |
1573 | 1589 |
| 1590 CSSValue* ComputedStyleCSSValueMapping::valueForOffset(const ComputedStyle& styl
e) |
| 1591 { |
| 1592 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| 1593 if (style.offsetPosition() != ComputedStyle::initialOffsetPosition()) |
| 1594 list->append(*valueForPosition(style.offsetPosition(), style)); |
| 1595 |
| 1596 list->append(*valueForOffsetPath(style.offsetPath())); |
| 1597 list->append(*zoomAdjustedPixelValueForLength(style.offsetDistance(), style)
); |
| 1598 list->append(*valueForOffsetRotation(style.offsetRotation())); |
| 1599 |
| 1600 if (style.offsetAnchor() == ComputedStyle::initialOffsetAnchor()) |
| 1601 return list; |
| 1602 |
| 1603 CSSValueList* outerList = CSSValueList::createSlashSeparated(); |
| 1604 outerList->append(*list); |
| 1605 outerList->append(*valueForPosition(style.offsetAnchor(), style)); |
| 1606 return outerList; |
| 1607 } |
| 1608 |
1574 static CSSValue* valueForScrollSnapDestination(const LengthPoint& destination, c
onst ComputedStyle& style) | 1609 static CSSValue* valueForScrollSnapDestination(const LengthPoint& destination, c
onst ComputedStyle& style) |
1575 { | 1610 { |
1576 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 1611 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
1577 list->append(*zoomAdjustedPixelValueForLength(destination.x(), style)); | 1612 list->append(*zoomAdjustedPixelValueForLength(destination.x(), style)); |
1578 list->append(*zoomAdjustedPixelValueForLength(destination.y(), style)); | 1613 list->append(*zoomAdjustedPixelValueForLength(destination.y(), style)); |
1579 return list; | 1614 return list; |
1580 } | 1615 } |
1581 | 1616 |
1582 static CSSValue* valueForScrollSnapPoints(const ScrollSnapPoints& points, const
ComputedStyle& style) | 1617 static CSSValue* valueForScrollSnapPoints(const ScrollSnapPoints& points, const
ComputedStyle& style) |
1583 { | 1618 { |
(...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2733 return valuesForSidesShorthand(paddingShorthand(), style, layoutObject,
styledNode, allowVisitedStyle); | 2768 return valuesForSidesShorthand(paddingShorthand(), style, layoutObject,
styledNode, allowVisitedStyle); |
2734 // Individual properties not part of the spec. | 2769 // Individual properties not part of the spec. |
2735 case CSSPropertyBackgroundRepeatX: | 2770 case CSSPropertyBackgroundRepeatX: |
2736 case CSSPropertyBackgroundRepeatY: | 2771 case CSSPropertyBackgroundRepeatY: |
2737 return nullptr; | 2772 return nullptr; |
2738 | 2773 |
2739 case CSSPropertyMotion: | 2774 case CSSPropertyMotion: |
2740 return valuesForShorthandProperty(motionShorthand(), style, layoutObject
, styledNode, allowVisitedStyle); | 2775 return valuesForShorthandProperty(motionShorthand(), style, layoutObject
, styledNode, allowVisitedStyle); |
2741 | 2776 |
2742 case CSSPropertyOffset: | 2777 case CSSPropertyOffset: |
2743 return valuesForShorthandProperty(offsetShorthand(), style, layoutObject
, styledNode, allowVisitedStyle); | 2778 return valueForOffset(style); |
2744 | 2779 |
2745 case CSSPropertyOffsetAnchor: | 2780 case CSSPropertyOffsetAnchor: |
2746 return valueForPosition(style.offsetAnchor(), style); | 2781 return valueForPosition(style.offsetAnchor(), style); |
2747 | 2782 |
2748 case CSSPropertyOffsetPosition: | 2783 case CSSPropertyOffsetPosition: |
2749 return valueForPosition(style.offsetPosition(), style); | 2784 return valueForPosition(style.offsetPosition(), style); |
2750 | 2785 |
2751 case CSSPropertyOffsetPath: | 2786 case CSSPropertyOffsetPath: |
2752 if (const StylePath* styleMotionPath = style.offsetPath()) | 2787 return valueForOffsetPath(style.offsetPath()); |
2753 return styleMotionPath->computedCSSValue(); | |
2754 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | |
2755 | 2788 |
2756 case CSSPropertyOffsetDistance: | 2789 case CSSPropertyOffsetDistance: |
2757 return zoomAdjustedPixelValueForLength(style.offsetDistance(), style); | 2790 return zoomAdjustedPixelValueForLength(style.offsetDistance(), style); |
2758 | 2791 |
2759 case CSSPropertyOffsetRotation: { | 2792 case CSSPropertyOffsetRotation: |
2760 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 2793 return valueForOffsetRotation(style.offsetRotation()); |
2761 if (style.offsetRotation().type == OffsetRotationAuto) | |
2762 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueAuto)); | |
2763 list->append(*CSSPrimitiveValue::create(style.offsetRotation().angle, CS
SPrimitiveValue::UnitType::Degrees)); | |
2764 return list; | |
2765 } | |
2766 | 2794 |
2767 // Unimplemented CSS 3 properties (including CSS3 shorthand properties). | 2795 // Unimplemented CSS 3 properties (including CSS3 shorthand properties). |
2768 case CSSPropertyWebkitTextEmphasis: | 2796 case CSSPropertyWebkitTextEmphasis: |
2769 return nullptr; | 2797 return nullptr; |
2770 | 2798 |
2771 // Directional properties are resolved by resolveDirectionAwareProperty() be
fore the switch. | 2799 // Directional properties are resolved by resolveDirectionAwareProperty() be
fore the switch. |
2772 case CSSPropertyWebkitBorderEnd: | 2800 case CSSPropertyWebkitBorderEnd: |
2773 case CSSPropertyWebkitBorderEndColor: | 2801 case CSSPropertyWebkitBorderEndColor: |
2774 case CSSPropertyWebkitBorderEndStyle: | 2802 case CSSPropertyWebkitBorderEndStyle: |
2775 case CSSPropertyWebkitBorderEndWidth: | 2803 case CSSPropertyWebkitBorderEndWidth: |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3034 case CSSPropertyAll: | 3062 case CSSPropertyAll: |
3035 return nullptr; | 3063 return nullptr; |
3036 default: | 3064 default: |
3037 break; | 3065 break; |
3038 } | 3066 } |
3039 ASSERT_NOT_REACHED(); | 3067 ASSERT_NOT_REACHED(); |
3040 return nullptr; | 3068 return nullptr; |
3041 } | 3069 } |
3042 | 3070 |
3043 } // namespace blink | 3071 } // namespace blink |
OLD | NEW |