| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 #include "core/css/CSSValueList.h" | 52 #include "core/css/CSSValueList.h" |
| 53 #include "core/css/CSSValuePool.h" | 53 #include "core/css/CSSValuePool.h" |
| 54 #include "core/css/ElementRuleCollector.h" | 54 #include "core/css/ElementRuleCollector.h" |
| 55 #include "core/css/FontFace.h" | 55 #include "core/css/FontFace.h" |
| 56 #include "core/css/MediaQueryEvaluator.h" | 56 #include "core/css/MediaQueryEvaluator.h" |
| 57 #include "core/css/PageRuleCollector.h" | 57 #include "core/css/PageRuleCollector.h" |
| 58 #include "core/css/StylePropertySet.h" | 58 #include "core/css/StylePropertySet.h" |
| 59 #include "core/css/StyleRuleImport.h" | 59 #include "core/css/StyleRuleImport.h" |
| 60 #include "core/css/StyleSheetContents.h" | 60 #include "core/css/StyleSheetContents.h" |
| 61 #include "core/css/resolver/AnimatedStyleBuilder.h" | 61 #include "core/css/resolver/AnimatedStyleBuilder.h" |
| 62 #include "core/css/resolver/CSSVariableResolver.h" |
| 62 #include "core/css/resolver/MatchResult.h" | 63 #include "core/css/resolver/MatchResult.h" |
| 63 #include "core/css/resolver/MediaQueryResult.h" | 64 #include "core/css/resolver/MediaQueryResult.h" |
| 64 #include "core/css/resolver/ScopedStyleResolver.h" | 65 #include "core/css/resolver/ScopedStyleResolver.h" |
| 65 #include "core/css/resolver/SharedStyleFinder.h" | 66 #include "core/css/resolver/SharedStyleFinder.h" |
| 66 #include "core/css/resolver/StyleAdjuster.h" | 67 #include "core/css/resolver/StyleAdjuster.h" |
| 67 #include "core/css/resolver/StyleResolverParentScope.h" | 68 #include "core/css/resolver/StyleResolverParentScope.h" |
| 68 #include "core/css/resolver/StyleResolverState.h" | 69 #include "core/css/resolver/StyleResolverState.h" |
| 69 #include "core/css/resolver/StyleResolverStats.h" | 70 #include "core/css/resolver/StyleResolverStats.h" |
| 70 #include "core/css/resolver/ViewportStyleResolver.h" | 71 #include "core/css/resolver/ViewportStyleResolver.h" |
| 71 #include "core/dom/CSSSelectorWatch.h" | 72 #include "core/dom/CSSSelectorWatch.h" |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 document().textLinkColors().setTextColor(state.style()->color()); | 639 document().textLinkColors().setTextColor(state.style()->color()); |
| 639 | 640 |
| 640 setAnimationUpdateIfNeeded(state, *element); | 641 setAnimationUpdateIfNeeded(state, *element); |
| 641 | 642 |
| 642 if (state.style()->hasViewportUnits()) | 643 if (state.style()->hasViewportUnits()) |
| 643 document().setHasViewportUnits(); | 644 document().setHasViewportUnits(); |
| 644 | 645 |
| 645 if (state.style()->hasRemUnits()) | 646 if (state.style()->hasRemUnits()) |
| 646 document().styleEngine().setUsesRemUnit(true); | 647 document().styleEngine().setUsesRemUnit(true); |
| 647 | 648 |
| 649 if (state.style()->variables()) |
| 650 document().styleEngine().setUsesVariables(true); |
| 651 |
| 648 // Now return the style. | 652 // Now return the style. |
| 649 return state.takeStyle(); | 653 return state.takeStyle(); |
| 650 } | 654 } |
| 651 | 655 |
| 652 // This function is used by the WebAnimations JavaScript API method animate(). | 656 // This function is used by the WebAnimations JavaScript API method animate(). |
| 653 // FIXME: Remove this when animate() switches away from resolution-dependent par
sing. | 657 // FIXME: Remove this when animate() switches away from resolution-dependent par
sing. |
| 654 PassRefPtrWillBeRawPtr<AnimatableValue> StyleResolver::createAnimatableValueSnap
shot(Element& element, const ComputedStyle* baseStyle, CSSPropertyID property, C
SSValue* value) | 658 PassRefPtrWillBeRawPtr<AnimatableValue> StyleResolver::createAnimatableValueSnap
shot(Element& element, const ComputedStyle* baseStyle, CSSPropertyID property, C
SSValue* value) |
| 655 { | 659 { |
| 656 StyleResolverState state(element.document(), &element); | 660 StyleResolverState state(element.document(), &element); |
| 657 state.setStyle(baseStyle ? ComputedStyle::clone(*baseStyle) : ComputedStyle:
:create()); | 661 state.setStyle(baseStyle ? ComputedStyle::clone(*baseStyle) : ComputedStyle:
:create()); |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 || !settings->textTrackTextSize().isEmpty()) | 1165 || !settings->textTrackTextSize().isEmpty()) |
| 1162 return true; | 1166 return true; |
| 1163 return false; | 1167 return false; |
| 1164 } | 1168 } |
| 1165 | 1169 |
| 1166 // This method expands the 'all' shorthand property to longhand properties | 1170 // This method expands the 'all' shorthand property to longhand properties |
| 1167 // and applies the expanded longhand properties. | 1171 // and applies the expanded longhand properties. |
| 1168 template <CSSPropertyPriority priority> | 1172 template <CSSPropertyPriority priority> |
| 1169 void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue* allVal
ue, bool inheritedOnly) | 1173 void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue* allVal
ue, bool inheritedOnly) |
| 1170 { | 1174 { |
| 1175 // The 'all' property doesn't apply to variables: |
| 1176 // https://drafts.csswg.org/css-variables/#defining-variables |
| 1177 if (priority == ResolveVariables) |
| 1178 return; |
| 1179 |
| 1171 unsigned startCSSProperty = CSSPropertyPriorityData<priority>::first(); | 1180 unsigned startCSSProperty = CSSPropertyPriorityData<priority>::first(); |
| 1172 unsigned endCSSProperty = CSSPropertyPriorityData<priority>::last(); | 1181 unsigned endCSSProperty = CSSPropertyPriorityData<priority>::last(); |
| 1173 | 1182 |
| 1174 for (unsigned i = startCSSProperty; i <= endCSSProperty; ++i) { | 1183 for (unsigned i = startCSSProperty; i <= endCSSProperty; ++i) { |
| 1175 CSSPropertyID propertyId = static_cast<CSSPropertyID>(i); | 1184 CSSPropertyID propertyId = static_cast<CSSPropertyID>(i); |
| 1176 | 1185 |
| 1177 // StyleBuilder does not allow any expanded shorthands. | 1186 // StyleBuilder does not allow any expanded shorthands. |
| 1178 if (isShorthandProperty(propertyId)) | 1187 if (isShorthandProperty(propertyId)) |
| 1179 continue; | 1188 continue; |
| 1180 | 1189 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 // Unfortunately the link status is treated like an inherited proper
ty. We need to explicitly restore it. | 1314 // Unfortunately the link status is treated like an inherited proper
ty. We need to explicitly restore it. |
| 1306 state.style()->setInsideLink(linkStatus); | 1315 state.style()->setInsideLink(linkStatus); |
| 1307 | 1316 |
| 1308 updateFont(state); | 1317 updateFont(state); |
| 1309 | 1318 |
| 1310 return; | 1319 return; |
| 1311 } | 1320 } |
| 1312 applyInheritedOnly = true; | 1321 applyInheritedOnly = true; |
| 1313 } | 1322 } |
| 1314 | 1323 |
| 1324 // TODO(leviw): We need the proper bit for tracking whether we need to do th
is work. |
| 1325 if (RuntimeEnabledFeatures::cssVariablesEnabled()) { |
| 1326 applyMatchedProperties<ResolveVariables>(state, matchResult, false, matc
hResult.beginAuthor(), matchResult.endAuthor(), applyInheritedOnly); |
| 1327 applyMatchedProperties<ResolveVariables>(state, matchResult, true, match
Result.beginAuthor(), matchResult.endAuthor(), applyInheritedOnly); |
| 1328 // TODO(leviw): stop recalculating every time |
| 1329 CSSVariableResolver::resolveVariableDefinitions(state); |
| 1330 } |
| 1331 |
| 1315 // Now we have all of the matched rules in the appropriate order. Walk the r
ules and apply | 1332 // Now we have all of the matched rules in the appropriate order. Walk the r
ules and apply |
| 1316 // high-priority properties first, i.e., those properties that other propert
ies depend on. | 1333 // high-priority properties first, i.e., those properties that other propert
ies depend on. |
| 1317 // The order is (1) high-priority not important, (2) high-priority important
, (3) normal not important | 1334 // The order is (1) high-priority not important, (2) high-priority important
, (3) normal not important |
| 1318 // and (4) normal important. | 1335 // and (4) normal important. |
| 1319 applyMatchedProperties<HighPropertyPriority>(state, matchResult, false, matc
hResult.begin(), matchResult.end(), applyInheritedOnly); | 1336 applyMatchedProperties<HighPropertyPriority>(state, matchResult, false, matc
hResult.begin(), matchResult.end(), applyInheritedOnly); |
| 1320 applyMatchedProperties<HighPropertyPriority>(state, matchResult, true, match
Result.beginAuthor(), matchResult.endAuthor(), applyInheritedOnly); | 1337 applyMatchedProperties<HighPropertyPriority>(state, matchResult, true, match
Result.beginAuthor(), matchResult.endAuthor(), applyInheritedOnly); |
| 1321 applyMatchedProperties<HighPropertyPriority>(state, matchResult, true, match
Result.beginUA(), matchResult.endUA(), applyInheritedOnly); | 1338 applyMatchedProperties<HighPropertyPriority>(state, matchResult, true, match
Result.beginUA(), matchResult.endUA(), applyInheritedOnly); |
| 1322 | 1339 |
| 1323 if (UNLIKELY(isSVGForeignObjectElement(element))) { | 1340 if (UNLIKELY(isSVGForeignObjectElement(element))) { |
| 1324 // LayoutSVGRoot handles zooming for the whole SVG subtree, so foreignOb
ject content should not be scaled again. | 1341 // LayoutSVGRoot handles zooming for the whole SVG subtree, so foreignOb
ject content should not be scaled again. |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1447 visitor->trace(m_watchedSelectorsRules); | 1464 visitor->trace(m_watchedSelectorsRules); |
| 1448 visitor->trace(m_treeBoundaryCrossingRules); | 1465 visitor->trace(m_treeBoundaryCrossingRules); |
| 1449 visitor->trace(m_styleResourceLoader); | 1466 visitor->trace(m_styleResourceLoader); |
| 1450 visitor->trace(m_styleSharingLists); | 1467 visitor->trace(m_styleSharingLists); |
| 1451 visitor->trace(m_pendingStyleSheets); | 1468 visitor->trace(m_pendingStyleSheets); |
| 1452 visitor->trace(m_document); | 1469 visitor->trace(m_document); |
| 1453 #endif | 1470 #endif |
| 1454 } | 1471 } |
| 1455 | 1472 |
| 1456 } // namespace blink | 1473 } // namespace blink |
| OLD | NEW |