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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #include "core/css/PropertyRegistry.h" | 56 #include "core/css/PropertyRegistry.h" |
57 #include "core/layout/LayoutBlock.h" | 57 #include "core/layout/LayoutBlock.h" |
58 #include "core/layout/LayoutBox.h" | 58 #include "core/layout/LayoutBox.h" |
59 #include "core/layout/LayoutGrid.h" | 59 #include "core/layout/LayoutGrid.h" |
60 #include "core/layout/LayoutObject.h" | 60 #include "core/layout/LayoutObject.h" |
61 #include "core/style/ComputedStyle.h" | 61 #include "core/style/ComputedStyle.h" |
62 #include "core/style/ContentData.h" | 62 #include "core/style/ContentData.h" |
63 #include "core/style/CursorData.h" | 63 #include "core/style/CursorData.h" |
64 #include "core/style/QuotesData.h" | 64 #include "core/style/QuotesData.h" |
65 #include "core/style/ShadowList.h" | 65 #include "core/style/ShadowList.h" |
66 #include "core/style/StyleVariableData.h" | 66 #include "core/style/StyleInheritedVariables.h" |
| 67 #include "core/style/StyleNonInheritedVariables.h" |
67 #include "platform/LengthFunctions.h" | 68 #include "platform/LengthFunctions.h" |
68 | 69 |
69 namespace blink { | 70 namespace blink { |
70 | 71 |
71 inline static bool isFlexOrGrid(const ComputedStyle* style) | 72 inline static bool isFlexOrGrid(const ComputedStyle* style) |
72 { | 73 { |
73 return style && style->isDisplayFlexibleOrGridBox(); | 74 return style && style->isDisplayFlexibleOrGridBox(); |
74 } | 75 } |
75 | 76 |
76 inline static CSSPrimitiveValue* zoomAdjustedPixelValue(double value, const Comp
utedStyle& style) | 77 inline static CSSPrimitiveValue* zoomAdjustedPixelValue(double value, const Comp
utedStyle& style) |
(...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1638 return BreakAlways; | 1639 return BreakAlways; |
1639 case BreakAvoidColumn: | 1640 case BreakAvoidColumn: |
1640 return BreakAvoid; | 1641 return BreakAvoid; |
1641 default: | 1642 default: |
1642 return genericBreakValue; | 1643 return genericBreakValue; |
1643 } | 1644 } |
1644 } | 1645 } |
1645 | 1646 |
1646 const CSSValue* ComputedStyleCSSValueMapping::get(const AtomicString customPrope
rtyName, const ComputedStyle& style, const PropertyRegistry* registry) | 1647 const CSSValue* ComputedStyleCSSValueMapping::get(const AtomicString customPrope
rtyName, const ComputedStyle& style, const PropertyRegistry* registry) |
1647 { | 1648 { |
1648 StyleVariableData* variables = style.variables(); | |
1649 if (registry) { | 1649 if (registry) { |
1650 const PropertyRegistry::Registration* registration = registry->registrat
ion(customPropertyName); | 1650 const PropertyRegistry::Registration* registration = registry->registrat
ion(customPropertyName); |
1651 if (registration) { | 1651 if (registration) { |
1652 if (variables) { | 1652 const CSSValue* result = nullptr; |
1653 const CSSValue* result = variables->registeredInheritedProperty(
customPropertyName); | 1653 if (registration->inherits()) { |
1654 if (result) | 1654 if (StyleInheritedVariables* variables = style.inheritedVariable
s()) |
1655 return result; | 1655 result = variables->registeredVariable(customPropertyName); |
| 1656 } else { |
| 1657 if (StyleNonInheritedVariables* variables = style.nonInheritedVa
riables()) |
| 1658 result = variables->registeredVariable(customPropertyName); |
1656 } | 1659 } |
| 1660 if (result) |
| 1661 return result; |
1657 return registration->initial(); | 1662 return registration->initial(); |
1658 } | 1663 } |
1659 } | 1664 } |
1660 | 1665 |
| 1666 StyleInheritedVariables* variables = style.inheritedVariables(); |
1661 if (!variables) | 1667 if (!variables) |
1662 return nullptr; | 1668 return nullptr; |
1663 | 1669 |
1664 CSSVariableData* data = variables->getVariable(customPropertyName); | 1670 CSSVariableData* data = variables->getVariable(customPropertyName); |
1665 if (!data) | 1671 if (!data) |
1666 return nullptr; | 1672 return nullptr; |
1667 | 1673 |
1668 return CSSCustomPropertyDeclaration::create(customPropertyName, data); | 1674 return CSSCustomPropertyDeclaration::create(customPropertyName, data); |
1669 } | 1675 } |
1670 | 1676 |
1671 std::unique_ptr<HashMap<AtomicString, RefPtr<CSSVariableData>>> ComputedStyleCSS
ValueMapping::getVariables(const ComputedStyle& style) | 1677 std::unique_ptr<HashMap<AtomicString, RefPtr<CSSVariableData>>> ComputedStyleCSS
ValueMapping::getVariables(const ComputedStyle& style) |
1672 { | 1678 { |
1673 StyleVariableData* variables = style.variables(); | 1679 // TODO(timloh): Also return non-inherited variables |
| 1680 StyleInheritedVariables* variables = style.inheritedVariables(); |
1674 if (variables) | 1681 if (variables) |
1675 return variables->getVariables(); | 1682 return variables->getVariables(); |
1676 return nullptr; | 1683 return nullptr; |
1677 } | 1684 } |
1678 | 1685 |
1679 const CSSValue* ComputedStyleCSSValueMapping::get(CSSPropertyID propertyID, cons
t ComputedStyle& style, const LayoutObject* layoutObject, Node* styledNode, bool
allowVisitedStyle) | 1686 const CSSValue* ComputedStyleCSSValueMapping::get(CSSPropertyID propertyID, cons
t ComputedStyle& style, const LayoutObject* layoutObject, Node* styledNode, bool
allowVisitedStyle) |
1680 { | 1687 { |
1681 const SVGComputedStyle& svgStyle = style.svgStyle(); | 1688 const SVGComputedStyle& svgStyle = style.svgStyle(); |
1682 propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style.di
rection(), style.getWritingMode()); | 1689 propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style.di
rection(), style.getWritingMode()); |
1683 switch (propertyID) { | 1690 switch (propertyID) { |
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3034 case CSSPropertyAll: | 3041 case CSSPropertyAll: |
3035 return nullptr; | 3042 return nullptr; |
3036 default: | 3043 default: |
3037 break; | 3044 break; |
3038 } | 3045 } |
3039 ASSERT_NOT_REACHED(); | 3046 ASSERT_NOT_REACHED(); |
3040 return nullptr; | 3047 return nullptr; |
3041 } | 3048 } |
3042 | 3049 |
3043 } // namespace blink | 3050 } // namespace blink |
OLD | NEW |