Chromium Code Reviews| 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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1009 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle Resources()); | 1008 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle Resources()); |
| 1010 | 1009 |
| 1011 document().didAccessStyleResolver(); | 1010 document().didAccessStyleResolver(); |
| 1012 | 1011 |
| 1013 // Now return the style. | 1012 // Now return the style. |
| 1014 return state.takeStyle(); | 1013 return state.takeStyle(); |
| 1015 } | 1014 } |
| 1016 | 1015 |
| 1017 void StyleResolver::collectViewportRules() | 1016 void StyleResolver::collectViewportRules() |
| 1018 { | 1017 { |
| 1019 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled()); | 1018 collectViewportRules(CSSDefaultStyleSheets::defaultStyle, UserAgentOrigin); |
| 1020 | 1019 |
| 1021 collectViewportRules(CSSDefaultStyleSheets::defaultStyle); | 1020 if (document().isMobileDocument()) |
|
kenneth.r.christiansen
2013/09/04 11:39:01
This replaces the hack in Document.cpp
| |
| 1021 collectViewportRules(CSSDefaultStyleSheets::xhtmlMobileProfileStyle(), U serAgentOrigin); | |
| 1022 | |
| 1022 if (m_ruleSets.userStyle()) | 1023 if (m_ruleSets.userStyle()) |
| 1023 collectViewportRules(m_ruleSets.userStyle()); | 1024 collectViewportRules(m_ruleSets.userStyle(), UserAgentOrigin); |
| 1024 | 1025 |
| 1025 if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverFor Document()) | 1026 if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverFor Document()) |
| 1026 scopedResolver->collectViewportRulesTo(this); | 1027 scopedResolver->collectViewportRulesTo(this); |
| 1027 | 1028 |
| 1028 viewportStyleResolver()->resolve(); | 1029 viewportStyleResolver()->resolve(); |
| 1029 } | 1030 } |
| 1030 | 1031 |
| 1031 void StyleResolver::collectViewportRules(RuleSet* rules) | 1032 void StyleResolver::collectViewportRules(RuleSet* rules, ViewportOrigin origin) |
| 1032 { | 1033 { |
| 1033 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled()); | |
| 1034 | |
| 1035 rules->compactRulesIfNeeded(); | 1034 rules->compactRulesIfNeeded(); |
| 1036 | 1035 |
| 1037 const Vector<StyleRuleViewport*>& viewportRules = rules->viewportRules(); | 1036 const Vector<StyleRuleViewport*>& viewportRules = rules->viewportRules(); |
| 1037 if (origin == AuthorOrigin && viewportRules.size()) | |
| 1038 viewportStyleResolver()->setHasAuthorStyle(); | |
| 1038 for (size_t i = 0; i < viewportRules.size(); ++i) | 1039 for (size_t i = 0; i < viewportRules.size(); ++i) |
| 1039 viewportStyleResolver()->addViewportRule(viewportRules[i]); | 1040 viewportStyleResolver()->addViewportRule(viewportRules[i]); |
| 1040 } | 1041 } |
| 1041 | 1042 |
| 1042 PassRefPtr<RenderStyle> StyleResolver::defaultStyleForElement() | 1043 PassRefPtr<RenderStyle> StyleResolver::defaultStyleForElement() |
| 1043 { | 1044 { |
| 1044 StyleResolverState state(document(), 0); | 1045 StyleResolverState state(document(), 0); |
| 1045 state.setStyle(RenderStyle::create()); | 1046 state.setStyle(RenderStyle::create()); |
| 1046 state.fontBuilder().initForStyleResolve(document(), state.style(), state.use SVGZoomRules()); | 1047 state.fontBuilder().initForStyleResolve(document(), state.style(), state.use SVGZoomRules()); |
| 1047 state.style()->setLineHeight(RenderStyle::initialLineHeight()); | 1048 state.style()->setLineHeight(RenderStyle::initialLineHeight()); |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1553 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa che); | 1554 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa che); |
| 1554 | 1555 |
| 1555 fprintf(stderr, "Total:\n"); | 1556 fprintf(stderr, "Total:\n"); |
| 1556 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing, | 1557 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing, |
| 1557 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch edPropertiesEnteredIntoCache); | 1558 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch edPropertiesEnteredIntoCache); |
| 1558 fprintf(stderr, "----------------------------------------------------------- ---------------------\n"); | 1559 fprintf(stderr, "----------------------------------------------------------- ---------------------\n"); |
| 1559 } | 1560 } |
| 1560 #endif | 1561 #endif |
| 1561 | 1562 |
| 1562 } // namespace WebCore | 1563 } // namespace WebCore |
| OLD | NEW |