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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 #include "core/css/CSSValueList.h" | 54 #include "core/css/CSSValueList.h" |
55 #include "core/css/CSSValuePool.h" | 55 #include "core/css/CSSValuePool.h" |
56 #include "core/css/ElementRuleCollector.h" | 56 #include "core/css/ElementRuleCollector.h" |
57 #include "core/css/FontFace.h" | 57 #include "core/css/FontFace.h" |
58 #include "core/css/MediaQueryEvaluator.h" | 58 #include "core/css/MediaQueryEvaluator.h" |
59 #include "core/css/PageRuleCollector.h" | 59 #include "core/css/PageRuleCollector.h" |
60 #include "core/css/StylePropertySet.h" | 60 #include "core/css/StylePropertySet.h" |
61 #include "core/css/StyleRuleImport.h" | 61 #include "core/css/StyleRuleImport.h" |
62 #include "core/css/StyleSheetContents.h" | 62 #include "core/css/StyleSheetContents.h" |
63 #include "core/css/resolver/AnimatedStyleBuilder.h" | 63 #include "core/css/resolver/AnimatedStyleBuilder.h" |
64 #include "core/css/resolver/CSSVariableResolver.h" | |
65 #include "core/css/resolver/MatchResult.h" | 64 #include "core/css/resolver/MatchResult.h" |
66 #include "core/css/resolver/MediaQueryResult.h" | 65 #include "core/css/resolver/MediaQueryResult.h" |
67 #include "core/css/resolver/ScopedStyleResolver.h" | 66 #include "core/css/resolver/ScopedStyleResolver.h" |
68 #include "core/css/resolver/SharedStyleFinder.h" | 67 #include "core/css/resolver/SharedStyleFinder.h" |
69 #include "core/css/resolver/StyleAdjuster.h" | 68 #include "core/css/resolver/StyleAdjuster.h" |
70 #include "core/css/resolver/StyleResolverParentScope.h" | 69 #include "core/css/resolver/StyleResolverParentScope.h" |
71 #include "core/css/resolver/StyleResolverState.h" | 70 #include "core/css/resolver/StyleResolverState.h" |
72 #include "core/css/resolver/StyleResolverStats.h" | 71 #include "core/css/resolver/StyleResolverStats.h" |
73 #include "core/css/resolver/ViewportStyleResolver.h" | 72 #include "core/css/resolver/ViewportStyleResolver.h" |
74 #include "core/dom/CSSSelectorWatch.h" | 73 #include "core/dom/CSSSelectorWatch.h" |
(...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 | 1223 |
1225 ASSERT_NOT_REACHED(); | 1224 ASSERT_NOT_REACHED(); |
1226 return true; | 1225 return true; |
1227 } | 1226 } |
1228 | 1227 |
1229 // This method expands the 'all' shorthand property to longhand properties | 1228 // This method expands the 'all' shorthand property to longhand properties |
1230 // and applies the expanded longhand properties. | 1229 // and applies the expanded longhand properties. |
1231 template <CSSPropertyPriority priority> | 1230 template <CSSPropertyPriority priority> |
1232 void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue* allVal
ue, bool inheritedOnly, PropertyWhitelistType propertyWhitelistType) | 1231 void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue* allVal
ue, bool inheritedOnly, PropertyWhitelistType propertyWhitelistType) |
1233 { | 1232 { |
1234 // The 'all' property doesn't apply to variables: | |
1235 // https://drafts.csswg.org/css-variables/#defining-variables | |
1236 if (priority == ResolveVariables) | |
1237 return; | |
1238 | |
1239 unsigned startCSSProperty = CSSPropertyPriorityData<priority>::first(); | 1233 unsigned startCSSProperty = CSSPropertyPriorityData<priority>::first(); |
1240 unsigned endCSSProperty = CSSPropertyPriorityData<priority>::last(); | 1234 unsigned endCSSProperty = CSSPropertyPriorityData<priority>::last(); |
1241 | 1235 |
1242 for (unsigned i = startCSSProperty; i <= endCSSProperty; ++i) { | 1236 for (unsigned i = startCSSProperty; i <= endCSSProperty; ++i) { |
1243 CSSPropertyID propertyId = static_cast<CSSPropertyID>(i); | 1237 CSSPropertyID propertyId = static_cast<CSSPropertyID>(i); |
1244 | 1238 |
1245 // StyleBuilder does not allow any expanded shorthands. | 1239 // StyleBuilder does not allow any expanded shorthands. |
1246 if (isShorthandProperty(propertyId)) | 1240 if (isShorthandProperty(propertyId)) |
1247 continue; | 1241 continue; |
1248 | 1242 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1368 // Unfortunately the link status is treated like an inherited proper
ty. We need to explicitly restore it. | 1362 // Unfortunately the link status is treated like an inherited proper
ty. We need to explicitly restore it. |
1369 state.style()->setInsideLink(linkStatus); | 1363 state.style()->setInsideLink(linkStatus); |
1370 | 1364 |
1371 updateFont(state); | 1365 updateFont(state); |
1372 | 1366 |
1373 return; | 1367 return; |
1374 } | 1368 } |
1375 applyInheritedOnly = true; | 1369 applyInheritedOnly = true; |
1376 } | 1370 } |
1377 | 1371 |
1378 // TODO(leviw): We need the proper bit for tracking whether we need to do th
is work. | |
1379 if (RuntimeEnabledFeatures::cssVariablesEnabled()) { | |
1380 applyMatchedProperties<ResolveVariables>(state, matchResult.authorRules(
), false, applyInheritedOnly); | |
1381 applyMatchedProperties<ResolveVariables>(state, matchResult.authorRules(
), true, applyInheritedOnly); | |
1382 // TODO(leviw): stop recalculating every time | |
1383 CSSVariableResolver::resolveVariableDefinitions(state.style()->variables
()); | |
1384 } | |
1385 | |
1386 // Now we have all of the matched rules in the appropriate order. Walk the r
ules and apply | 1372 // Now we have all of the matched rules in the appropriate order. Walk the r
ules and apply |
1387 // high-priority properties first, i.e., those properties that other propert
ies depend on. | 1373 // high-priority properties first, i.e., those properties that other propert
ies depend on. |
1388 // The order is (1) high-priority not important, (2) high-priority important
, (3) normal not important | 1374 // The order is (1) high-priority not important, (2) high-priority important
, (3) normal not important |
1389 // and (4) normal important. | 1375 // and (4) normal important. |
1390 applyMatchedProperties<HighPropertyPriority>(state, matchResult.allRules(),
false, applyInheritedOnly); | 1376 applyMatchedProperties<HighPropertyPriority>(state, matchResult.allRules(),
false, applyInheritedOnly); |
1391 for (auto range : ImportantAuthorRanges(matchResult)) | 1377 for (auto range : ImportantAuthorRanges(matchResult)) |
1392 applyMatchedProperties<HighPropertyPriority>(state, range, true, applyIn
heritedOnly); | 1378 applyMatchedProperties<HighPropertyPriority>(state, range, true, applyIn
heritedOnly); |
1393 applyMatchedProperties<HighPropertyPriority>(state, matchResult.uaRules(), t
rue, applyInheritedOnly); | 1379 applyMatchedProperties<HighPropertyPriority>(state, matchResult.uaRules(), t
rue, applyInheritedOnly); |
1394 | 1380 |
1395 if (UNLIKELY(isSVGForeignObjectElement(element))) { | 1381 if (UNLIKELY(isSVGForeignObjectElement(element))) { |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1553 visitor->trace(m_watchedSelectorsRules); | 1539 visitor->trace(m_watchedSelectorsRules); |
1554 visitor->trace(m_treeBoundaryCrossingScopes); | 1540 visitor->trace(m_treeBoundaryCrossingScopes); |
1555 visitor->trace(m_styleResourceLoader); | 1541 visitor->trace(m_styleResourceLoader); |
1556 visitor->trace(m_styleSharingLists); | 1542 visitor->trace(m_styleSharingLists); |
1557 visitor->trace(m_pendingStyleSheets); | 1543 visitor->trace(m_pendingStyleSheets); |
1558 visitor->trace(m_document); | 1544 visitor->trace(m_document); |
1559 #endif | 1545 #endif |
1560 } | 1546 } |
1561 | 1547 |
1562 } // namespace blink | 1548 } // namespace blink |
OLD | NEW |