| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 | 173 |
| 174 void StyleResolver::finishAppendAuthorStyleSheets() | 174 void StyleResolver::finishAppendAuthorStyleSheets() |
| 175 { | 175 { |
| 176 collectFeatures(); | 176 collectFeatures(); |
| 177 | 177 |
| 178 if (document().renderer() && document().renderer()->style()) | 178 if (document().renderer() && document().renderer()->style()) |
| 179 document().renderer()->style()->font().update(fontSelector()); | 179 document().renderer()->style()->font().update(fontSelector()); |
| 180 | 180 |
| 181 if (RuntimeEnabledFeatures::cssViewportEnabled()) | 181 collectViewportRules(); |
| 182 collectViewportRules(); | |
| 183 } | 182 } |
| 184 | 183 |
| 185 void StyleResolver::resetAuthorStyle(const ContainerNode* scopingNode) | 184 void StyleResolver::resetAuthorStyle(const ContainerNode* scopingNode) |
| 186 { | 185 { |
| 187 ScopedStyleResolver* resolver = scopingNode ? m_styleTree.scopedStyleResolve
rFor(*scopingNode) : m_styleTree.scopedStyleResolverForDocument(); | 186 ScopedStyleResolver* resolver = scopingNode ? m_styleTree.scopedStyleResolve
rFor(*scopingNode) : m_styleTree.scopedStyleResolverForDocument(); |
| 188 if (!resolver) | 187 if (!resolver) |
| 189 return; | 188 return; |
| 190 | 189 |
| 191 m_ruleSets.shadowDistributedRules().reset(scopingNode); | 190 m_ruleSets.shadowDistributedRules().reset(scopingNode); |
| 192 | 191 |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle
Resources()); | 968 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle
Resources()); |
| 970 | 969 |
| 971 document().didAccessStyleResolver(); | 970 document().didAccessStyleResolver(); |
| 972 | 971 |
| 973 // Now return the style. | 972 // Now return the style. |
| 974 return state.takeStyle(); | 973 return state.takeStyle(); |
| 975 } | 974 } |
| 976 | 975 |
| 977 void StyleResolver::collectViewportRules() | 976 void StyleResolver::collectViewportRules() |
| 978 { | 977 { |
| 979 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled()); | 978 collectViewportRules(CSSDefaultStyleSheets::defaultStyle, UserAgentOrigin); |
| 980 | 979 |
| 981 collectViewportRules(CSSDefaultStyleSheets::defaultStyle); | 980 if (document().isMobileDocument()) |
| 981 collectViewportRules(CSSDefaultStyleSheets::xhtmlMobileProfileStyle(), U
serAgentOrigin); |
| 982 |
| 982 if (m_ruleSets.userStyle()) | 983 if (m_ruleSets.userStyle()) |
| 983 collectViewportRules(m_ruleSets.userStyle()); | 984 collectViewportRules(m_ruleSets.userStyle(), UserAgentOrigin); |
| 984 | 985 |
| 985 if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverFor
Document()) | 986 if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverFor
Document()) |
| 986 scopedResolver->collectViewportRulesTo(this); | 987 scopedResolver->collectViewportRulesTo(this); |
| 987 | 988 |
| 988 viewportStyleResolver()->resolve(); | 989 viewportStyleResolver()->resolve(); |
| 989 } | 990 } |
| 990 | 991 |
| 991 void StyleResolver::collectViewportRules(RuleSet* rules) | 992 void StyleResolver::collectViewportRules(RuleSet* rules, ViewportOrigin origin) |
| 992 { | 993 { |
| 993 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled()); | |
| 994 | |
| 995 rules->compactRulesIfNeeded(); | 994 rules->compactRulesIfNeeded(); |
| 996 | 995 |
| 997 const Vector<StyleRuleViewport*>& viewportRules = rules->viewportRules(); | 996 const Vector<StyleRuleViewport*>& viewportRules = rules->viewportRules(); |
| 997 if (origin == AuthorOrigin && viewportRules.size()) |
| 998 viewportStyleResolver()->setHasAuthorStyle(); |
| 998 for (size_t i = 0; i < viewportRules.size(); ++i) | 999 for (size_t i = 0; i < viewportRules.size(); ++i) |
| 999 viewportStyleResolver()->addViewportRule(viewportRules[i]); | 1000 viewportStyleResolver()->addViewportRule(viewportRules[i]); |
| 1000 } | 1001 } |
| 1001 | 1002 |
| 1002 PassRefPtr<RenderStyle> StyleResolver::defaultStyleForElement() | 1003 PassRefPtr<RenderStyle> StyleResolver::defaultStyleForElement() |
| 1003 { | 1004 { |
| 1004 StyleResolverState state(document(), 0); | 1005 StyleResolverState state(document(), 0); |
| 1005 state.setStyle(RenderStyle::create()); | 1006 state.setStyle(RenderStyle::create()); |
| 1006 state.fontBuilder().initForStyleResolve(document(), state.style(), state.use
SVGZoomRules()); | 1007 state.fontBuilder().initForStyleResolve(document(), state.style(), state.use
SVGZoomRules()); |
| 1007 state.style()->setLineHeight(RenderStyle::initialLineHeight()); | 1008 state.style()->setLineHeight(RenderStyle::initialLineHeight()); |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1513 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties
SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa
che); | 1514 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties
SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa
che); |
| 1514 | 1515 |
| 1515 fprintf(stderr, "Total:\n"); | 1516 fprintf(stderr, "Total:\n"); |
| 1516 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS
tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing, | 1517 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS
tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing, |
| 1517 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa
tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch
edPropertiesEnteredIntoCache); | 1518 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa
tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch
edPropertiesEnteredIntoCache); |
| 1518 fprintf(stderr, "-----------------------------------------------------------
---------------------\n"); | 1519 fprintf(stderr, "-----------------------------------------------------------
---------------------\n"); |
| 1519 } | 1520 } |
| 1520 #endif | 1521 #endif |
| 1521 | 1522 |
| 1522 } // namespace WebCore | 1523 } // namespace WebCore |
| OLD | NEW |