| 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, 2013 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 #include "core/dom/shadow/ShadowRoot.h" | 79 #include "core/dom/shadow/ShadowRoot.h" |
| 80 #include "core/frame/FrameView.h" | 80 #include "core/frame/FrameView.h" |
| 81 #include "core/frame/LocalFrame.h" | 81 #include "core/frame/LocalFrame.h" |
| 82 #include "core/frame/Settings.h" | 82 #include "core/frame/Settings.h" |
| 83 #include "core/frame/UseCounter.h" | 83 #include "core/frame/UseCounter.h" |
| 84 #include "core/html/HTMLIFrameElement.h" | 84 #include "core/html/HTMLIFrameElement.h" |
| 85 #include "core/html/HTMLSlotElement.h" | 85 #include "core/html/HTMLSlotElement.h" |
| 86 #include "core/inspector/InspectorInstrumentation.h" | 86 #include "core/inspector/InspectorInstrumentation.h" |
| 87 #include "core/layout/GeneratedChildren.h" | 87 #include "core/layout/GeneratedChildren.h" |
| 88 #include "core/layout/api/LayoutViewItem.h" | 88 #include "core/layout/api/LayoutViewItem.h" |
| 89 #include "core/style/StyleVariableData.h" | 89 #include "core/style/StyleInheritedVariables.h" |
| 90 #include "core/svg/SVGDocumentExtensions.h" | 90 #include "core/svg/SVGDocumentExtensions.h" |
| 91 #include "core/svg/SVGElement.h" | 91 #include "core/svg/SVGElement.h" |
| 92 #include "platform/RuntimeEnabledFeatures.h" | 92 #include "platform/RuntimeEnabledFeatures.h" |
| 93 #include "wtf/StdLibExtras.h" | 93 #include "wtf/StdLibExtras.h" |
| 94 | 94 |
| 95 namespace { | 95 namespace { |
| 96 | 96 |
| 97 using namespace blink; | 97 using namespace blink; |
| 98 | 98 |
| 99 void setAnimationUpdateIfNeeded(StyleResolverState& state, Element& element) | 99 void setAnimationUpdateIfNeeded(StyleResolverState& state, Element& element) |
| 100 { | 100 { |
| 101 // If any changes to CSS Animations were detected, stash the update away for
application after the | 101 // If any changes to CSS Animations were detected, stash the update away for
application after the |
| 102 // layout object is updated if we're in the appropriate scope. | 102 // layout object is updated if we're in the appropriate scope. |
| 103 if (!state.animationUpdate().isEmpty()) | 103 if (!state.animationUpdate().isEmpty()) |
| 104 element.ensureElementAnimations().cssAnimations().setPendingUpdate(state
.animationUpdate()); | 104 element.ensureElementAnimations().cssAnimations().setPendingUpdate(state
.animationUpdate()); |
| 105 } | 105 } |
| 106 | 106 |
| 107 // Returns whether any @apply rule sets a custom property | 107 // Returns whether any @apply rule sets a custom property |
| 108 bool cacheCustomPropertiesForApplyAtRules(StyleResolverState& state, const Match
edPropertiesRange& range) | 108 bool cacheCustomPropertiesForApplyAtRules(StyleResolverState& state, const Match
edPropertiesRange& range) |
| 109 { | 109 { |
| 110 bool ruleSetsCustomProperty = false; | 110 bool ruleSetsCustomProperty = false; |
| 111 if (!state.style()->variables()) | 111 // TODO(timloh): @apply should also work with properties registered as non-i
nherited. |
| 112 if (!state.style()->inheritedVariables()) |
| 112 return false; | 113 return false; |
| 113 for (const auto& matchedProperties : range) { | 114 for (const auto& matchedProperties : range) { |
| 114 const StylePropertySet& properties = *matchedProperties.properties; | 115 const StylePropertySet& properties = *matchedProperties.properties; |
| 115 unsigned propertyCount = properties.propertyCount(); | 116 unsigned propertyCount = properties.propertyCount(); |
| 116 for (unsigned i = 0; i < propertyCount; ++i) { | 117 for (unsigned i = 0; i < propertyCount; ++i) { |
| 117 StylePropertySet::PropertyReference current = properties.propertyAt(
i); | 118 StylePropertySet::PropertyReference current = properties.propertyAt(
i); |
| 118 if (current.id() != CSSPropertyApplyAtRule) | 119 if (current.id() != CSSPropertyApplyAtRule) |
| 119 continue; | 120 continue; |
| 120 AtomicString name(toCSSCustomIdentValue(current.value()).value()); | 121 AtomicString name(toCSSCustomIdentValue(current.value()).value()); |
| 121 CSSVariableData* variableData = state.style()->variables()->getVaria
ble(name); | 122 CSSVariableData* variableData = state.style()->inheritedVariables()-
>getVariable(name); |
| 122 if (!variableData) | 123 if (!variableData) |
| 123 continue; | 124 continue; |
| 124 StylePropertySet* customPropertySet = variableData->propertySet(); | 125 StylePropertySet* customPropertySet = variableData->propertySet(); |
| 125 if (!customPropertySet) | 126 if (!customPropertySet) |
| 126 continue; | 127 continue; |
| 127 if (customPropertySet->findPropertyIndex(CSSPropertyVariable) != -1) | 128 if (customPropertySet->findPropertyIndex(CSSPropertyVariable) != -1) |
| 128 ruleSetsCustomProperty = true; | 129 ruleSetsCustomProperty = true; |
| 129 state.setCustomPropertySetForApplyAtRule(name, customPropertySet); | 130 state.setCustomPropertySetForApplyAtRule(name, customPropertySet); |
| 130 } | 131 } |
| 131 } | 132 } |
| (...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1427 continue; | 1428 continue; |
| 1428 | 1429 |
| 1429 StyleBuilder::applyProperty(propertyId, state, allValue); | 1430 StyleBuilder::applyProperty(propertyId, state, allValue); |
| 1430 } | 1431 } |
| 1431 } | 1432 } |
| 1432 | 1433 |
| 1433 template <CSSPropertyPriority priority> | 1434 template <CSSPropertyPriority priority> |
| 1434 void StyleResolver::applyPropertiesForApplyAtRule(StyleResolverState& state, con
st CSSValue& value, bool isImportant, PropertyWhitelistType propertyWhitelistTyp
e) | 1435 void StyleResolver::applyPropertiesForApplyAtRule(StyleResolverState& state, con
st CSSValue& value, bool isImportant, PropertyWhitelistType propertyWhitelistTyp
e) |
| 1435 { | 1436 { |
| 1436 state.style()->setHasVariableReferenceFromNonInheritedProperty(); | 1437 state.style()->setHasVariableReferenceFromNonInheritedProperty(); |
| 1437 if (!state.style()->variables()) | 1438 if (!state.style()->inheritedVariables()) |
| 1438 return; | 1439 return; |
| 1439 const String& name = toCSSCustomIdentValue(value).value(); | 1440 const String& name = toCSSCustomIdentValue(value).value(); |
| 1440 const StylePropertySet* propertySet = state.customPropertySetForApplyAtRule(
name); | 1441 const StylePropertySet* propertySet = state.customPropertySetForApplyAtRule(
name); |
| 1441 bool inheritedOnly = false; | 1442 bool inheritedOnly = false; |
| 1442 if (propertySet) | 1443 if (propertySet) |
| 1443 applyProperties<priority>(state, propertySet, isImportant, inheritedOnly
, propertyWhitelistType); | 1444 applyProperties<priority>(state, propertySet, isImportant, inheritedOnly
, propertyWhitelistType); |
| 1444 } | 1445 } |
| 1445 | 1446 |
| 1446 template <CSSPropertyPriority priority> | 1447 template <CSSPropertyPriority priority> |
| 1447 void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper
tySet* properties, bool isImportant, bool inheritedOnly, PropertyWhitelistType p
ropertyWhitelistType) | 1448 void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper
tySet* properties, bool isImportant, bool inheritedOnly, PropertyWhitelistType p
ropertyWhitelistType) |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1744 visitor->trace(m_siblingRuleSet); | 1745 visitor->trace(m_siblingRuleSet); |
| 1745 visitor->trace(m_uncommonAttributeRuleSet); | 1746 visitor->trace(m_uncommonAttributeRuleSet); |
| 1746 visitor->trace(m_watchedSelectorsRules); | 1747 visitor->trace(m_watchedSelectorsRules); |
| 1747 visitor->trace(m_treeBoundaryCrossingScopes); | 1748 visitor->trace(m_treeBoundaryCrossingScopes); |
| 1748 visitor->trace(m_styleSharingLists); | 1749 visitor->trace(m_styleSharingLists); |
| 1749 visitor->trace(m_pendingStyleSheets); | 1750 visitor->trace(m_pendingStyleSheets); |
| 1750 visitor->trace(m_document); | 1751 visitor->trace(m_document); |
| 1751 } | 1752 } |
| 1752 | 1753 |
| 1753 } // namespace blink | 1754 } // namespace blink |
| OLD | NEW |