| 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. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. |
| 6 * All rights reserved. | 6 * All rights reserved. |
| 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 10 * (http://www.torchmobile.com/) | 10 * (http://www.torchmobile.com/) |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 #include "core/css/resolver/AnimatedStyleBuilder.h" | 65 #include "core/css/resolver/AnimatedStyleBuilder.h" |
| 66 #include "core/css/resolver/CSSVariableResolver.h" | 66 #include "core/css/resolver/CSSVariableResolver.h" |
| 67 #include "core/css/resolver/MatchResult.h" | 67 #include "core/css/resolver/MatchResult.h" |
| 68 #include "core/css/resolver/MediaQueryResult.h" | 68 #include "core/css/resolver/MediaQueryResult.h" |
| 69 #include "core/css/resolver/ScopedStyleResolver.h" | 69 #include "core/css/resolver/ScopedStyleResolver.h" |
| 70 #include "core/css/resolver/SelectorFilterParentScope.h" | 70 #include "core/css/resolver/SelectorFilterParentScope.h" |
| 71 #include "core/css/resolver/SharedStyleFinder.h" | 71 #include "core/css/resolver/SharedStyleFinder.h" |
| 72 #include "core/css/resolver/StyleAdjuster.h" | 72 #include "core/css/resolver/StyleAdjuster.h" |
| 73 #include "core/css/resolver/StyleResolverState.h" | 73 #include "core/css/resolver/StyleResolverState.h" |
| 74 #include "core/css/resolver/StyleResolverStats.h" | 74 #include "core/css/resolver/StyleResolverStats.h" |
| 75 #include "core/css/resolver/ViewportStyleResolver.h" | |
| 76 #include "core/dom/CSSSelectorWatch.h" | 75 #include "core/dom/CSSSelectorWatch.h" |
| 77 #include "core/dom/FirstLetterPseudoElement.h" | 76 #include "core/dom/FirstLetterPseudoElement.h" |
| 78 #include "core/dom/NodeComputedStyle.h" | 77 #include "core/dom/NodeComputedStyle.h" |
| 79 #include "core/dom/StyleEngine.h" | 78 #include "core/dom/StyleEngine.h" |
| 80 #include "core/dom/Text.h" | 79 #include "core/dom/Text.h" |
| 81 #include "core/dom/shadow/ElementShadow.h" | 80 #include "core/dom/shadow/ElementShadow.h" |
| 82 #include "core/dom/shadow/ShadowRoot.h" | 81 #include "core/dom/shadow/ShadowRoot.h" |
| 83 #include "core/frame/FrameView.h" | 82 #include "core/frame/FrameView.h" |
| 84 #include "core/frame/LocalFrame.h" | 83 #include "core/frame/LocalFrame.h" |
| 85 #include "core/frame/Settings.h" | 84 #include "core/frame/Settings.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 shadowRoot = shadowRoot->olderShadowRoot()) { | 174 shadowRoot = shadowRoot->olderShadowRoot()) { |
| 176 if (shadowRoot->numberOfStyles() > 0) { | 175 if (shadowRoot->numberOfStyles() > 0) { |
| 177 if (ScopedStyleResolver* resolver = shadowRoot->scopedStyleResolver()) | 176 if (ScopedStyleResolver* resolver = shadowRoot->scopedStyleResolver()) |
| 178 resolvers.append(resolver); | 177 resolvers.append(resolver); |
| 179 } | 178 } |
| 180 } | 179 } |
| 181 } | 180 } |
| 182 | 181 |
| 183 StyleResolver::StyleResolver(Document& document) | 182 StyleResolver::StyleResolver(Document& document) |
| 184 : m_document(document), | 183 : m_document(document), |
| 185 m_viewportStyleResolver(ViewportStyleResolver::create(document)), | |
| 186 m_needCollectFeatures(false), | 184 m_needCollectFeatures(false), |
| 187 m_printMediaType(false), | 185 m_printMediaType(false), |
| 188 m_styleSharingDepth(0) { | 186 m_styleSharingDepth(0) { |
| 189 FrameView* view = document.view(); | 187 FrameView* view = document.view(); |
| 190 if (view) { | 188 if (view) { |
| 191 m_medium = new MediaQueryEvaluator(&view->frame()); | 189 m_medium = new MediaQueryEvaluator(&view->frame()); |
| 192 m_printMediaType = | 190 m_printMediaType = |
| 193 equalIgnoringCase(view->mediaType(), MediaTypeNames::print); | 191 equalIgnoringCase(view->mediaType(), MediaTypeNames::print); |
| 194 } else { | 192 } else { |
| 195 m_medium = new MediaQueryEvaluator("all"); | 193 m_medium = new MediaQueryEvaluator("all"); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 } | 282 } |
| 285 | 283 |
| 286 void StyleResolver::finishAppendAuthorStyleSheets() { | 284 void StyleResolver::finishAppendAuthorStyleSheets() { |
| 287 collectFeatures(); | 285 collectFeatures(); |
| 288 | 286 |
| 289 if (!document().layoutViewItem().isNull() && | 287 if (!document().layoutViewItem().isNull() && |
| 290 document().layoutViewItem().style()) | 288 document().layoutViewItem().style()) |
| 291 document().layoutViewItem().style()->font().update( | 289 document().layoutViewItem().style()->font().update( |
| 292 document().styleEngine().fontSelector()); | 290 document().styleEngine().fontSelector()); |
| 293 | 291 |
| 294 m_viewportStyleResolver->collectViewportRules(); | |
| 295 | |
| 296 document().styleEngine().resetCSSFeatureFlags(m_features); | 292 document().styleEngine().resetCSSFeatureFlags(m_features); |
| 297 } | 293 } |
| 298 | 294 |
| 299 void StyleResolver::resetRuleFeatures() { | 295 void StyleResolver::resetRuleFeatures() { |
| 300 // Need to recreate RuleFeatureSet. | 296 // Need to recreate RuleFeatureSet. |
| 301 m_features.clear(); | 297 m_features.clear(); |
| 302 m_siblingRuleSet.clear(); | 298 m_siblingRuleSet.clear(); |
| 303 m_uncommonAttributeRuleSet.clear(); | 299 m_uncommonAttributeRuleSet.clear(); |
| 304 m_needCollectFeatures = true; | 300 m_needCollectFeatures = true; |
| 305 } | 301 } |
| (...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1670 const MatchedProperties* properties, | 1666 const MatchedProperties* properties, |
| 1671 unsigned size) { | 1667 unsigned size) { |
| 1672 return StringHasher::hashMemory(properties, sizeof(MatchedProperties) * size); | 1668 return StringHasher::hashMemory(properties, sizeof(MatchedProperties) * size); |
| 1673 } | 1669 } |
| 1674 | 1670 |
| 1675 void StyleResolver::invalidateMatchedPropertiesCache() { | 1671 void StyleResolver::invalidateMatchedPropertiesCache() { |
| 1676 m_matchedPropertiesCache.clear(); | 1672 m_matchedPropertiesCache.clear(); |
| 1677 } | 1673 } |
| 1678 | 1674 |
| 1679 void StyleResolver::notifyResizeForViewportUnits() { | 1675 void StyleResolver::notifyResizeForViewportUnits() { |
| 1680 m_viewportStyleResolver->collectViewportRules(); | |
| 1681 m_matchedPropertiesCache.clearViewportDependent(); | 1676 m_matchedPropertiesCache.clearViewportDependent(); |
| 1682 } | 1677 } |
| 1683 | 1678 |
| 1684 void StyleResolver::applyMatchedProperties(StyleResolverState& state, | 1679 void StyleResolver::applyMatchedProperties(StyleResolverState& state, |
| 1685 const MatchResult& matchResult) { | 1680 const MatchResult& matchResult) { |
| 1686 const Element* element = state.element(); | 1681 const Element* element = state.element(); |
| 1687 ASSERT(element); | 1682 ASSERT(element); |
| 1688 | 1683 |
| 1689 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), matchedPropertyApply, | 1684 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), matchedPropertyApply, |
| 1690 1); | 1685 1); |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1937 } | 1932 } |
| 1938 return false; | 1933 return false; |
| 1939 } | 1934 } |
| 1940 | 1935 |
| 1941 DEFINE_TRACE(StyleResolver) { | 1936 DEFINE_TRACE(StyleResolver) { |
| 1942 visitor->trace(m_matchedPropertiesCache); | 1937 visitor->trace(m_matchedPropertiesCache); |
| 1943 visitor->trace(m_medium); | 1938 visitor->trace(m_medium); |
| 1944 visitor->trace(m_viewportDependentMediaQueryResults); | 1939 visitor->trace(m_viewportDependentMediaQueryResults); |
| 1945 visitor->trace(m_deviceDependentMediaQueryResults); | 1940 visitor->trace(m_deviceDependentMediaQueryResults); |
| 1946 visitor->trace(m_selectorFilter); | 1941 visitor->trace(m_selectorFilter); |
| 1947 visitor->trace(m_viewportStyleResolver); | |
| 1948 visitor->trace(m_features); | 1942 visitor->trace(m_features); |
| 1949 visitor->trace(m_siblingRuleSet); | 1943 visitor->trace(m_siblingRuleSet); |
| 1950 visitor->trace(m_uncommonAttributeRuleSet); | 1944 visitor->trace(m_uncommonAttributeRuleSet); |
| 1951 visitor->trace(m_watchedSelectorsRules); | 1945 visitor->trace(m_watchedSelectorsRules); |
| 1952 visitor->trace(m_treeBoundaryCrossingScopes); | 1946 visitor->trace(m_treeBoundaryCrossingScopes); |
| 1953 visitor->trace(m_styleSharingLists); | 1947 visitor->trace(m_styleSharingLists); |
| 1954 visitor->trace(m_pendingStyleSheets); | 1948 visitor->trace(m_pendingStyleSheets); |
| 1955 visitor->trace(m_document); | 1949 visitor->trace(m_document); |
| 1956 } | 1950 } |
| 1957 | 1951 |
| 1958 } // namespace blink | 1952 } // namespace blink |
| OLD | NEW |