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