Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: Source/core/css/resolver/StyleResolver.cpp

Issue 25257003: Empty @viewport should not override legacy viewport. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle Resources()); 1057 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle Resources());
1058 1058
1059 document().didAccessStyleResolver(); 1059 document().didAccessStyleResolver();
1060 1060
1061 // Now return the style. 1061 // Now return the style.
1062 return state.takeStyle(); 1062 return state.takeStyle();
1063 } 1063 }
1064 1064
1065 void StyleResolver::collectViewportRules() 1065 void StyleResolver::collectViewportRules()
1066 { 1066 {
1067 collectViewportRules(CSSDefaultStyleSheets::defaultStyle, UserAgentOrigin); 1067 viewportStyleResolver()->collectViewportRules(CSSDefaultStyleSheets::default Style, ViewportStyleResolver::UserAgentOrigin);
1068 1068
1069 if (document().isMobileDocument()) 1069 if (document().isMobileDocument())
1070 collectViewportRules(CSSDefaultStyleSheets::xhtmlMobileProfileStyle(), U serAgentOrigin); 1070 viewportStyleResolver()->collectViewportRules(CSSDefaultStyleSheets::xht mlMobileProfileStyle(), ViewportStyleResolver::UserAgentOrigin);
1071 1071
1072 if (m_ruleSets.userStyle()) 1072 if (m_ruleSets.userStyle())
1073 collectViewportRules(m_ruleSets.userStyle(), UserAgentOrigin); 1073 viewportStyleResolver()->collectViewportRules(m_ruleSets.userStyle(), Vi ewportStyleResolver::UserAgentOrigin);
1074 1074
1075 if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverFor Document()) 1075 if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverFor Document())
1076 scopedResolver->collectViewportRulesTo(this); 1076 scopedResolver->collectViewportRulesTo(this);
1077 1077
1078 viewportStyleResolver()->resolve(); 1078 viewportStyleResolver()->resolve();
1079 } 1079 }
1080 1080
1081 void StyleResolver::collectViewportRules(RuleSet* rules, ViewportOrigin origin)
1082 {
1083 rules->compactRulesIfNeeded();
1084
1085 const Vector<StyleRuleViewport*>& viewportRules = rules->viewportRules();
1086 if (origin == AuthorOrigin && viewportRules.size())
1087 viewportStyleResolver()->setHasAuthorStyle();
1088 for (size_t i = 0; i < viewportRules.size(); ++i)
1089 viewportStyleResolver()->addViewportRule(viewportRules[i]);
1090 }
1091
1092 PassRefPtr<RenderStyle> StyleResolver::defaultStyleForElement() 1081 PassRefPtr<RenderStyle> StyleResolver::defaultStyleForElement()
1093 { 1082 {
1094 StyleResolverState state(document(), 0); 1083 StyleResolverState state(document(), 0);
1095 state.setStyle(RenderStyle::create()); 1084 state.setStyle(RenderStyle::create());
1096 state.fontBuilder().initForStyleResolve(document(), state.style(), state.use SVGZoomRules()); 1085 state.fontBuilder().initForStyleResolve(document(), state.style(), state.use SVGZoomRules());
1097 state.style()->setLineHeight(RenderStyle::initialLineHeight()); 1086 state.style()->setLineHeight(RenderStyle::initialLineHeight());
1098 state.setLineHeightValue(0); 1087 state.setLineHeightValue(0);
1099 state.fontBuilder().setInitial(state.style()->effectiveZoom()); 1088 state.fontBuilder().setInitial(state.style()->effectiveZoom());
1100 state.style()->font().update(fontSelector()); 1089 state.style()->font().update(fontSelector());
1101 return state.takeStyle(); 1090 return state.takeStyle();
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa che); 1594 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa che);
1606 1595
1607 fprintf(stderr, "Total:\n"); 1596 fprintf(stderr, "Total:\n");
1608 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing, 1597 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing,
1609 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch edPropertiesEnteredIntoCache); 1598 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch edPropertiesEnteredIntoCache);
1610 fprintf(stderr, "----------------------------------------------------------- ---------------------\n"); 1599 fprintf(stderr, "----------------------------------------------------------- ---------------------\n");
1611 } 1600 }
1612 #endif 1601 #endif
1613 1602
1614 } // namespace WebCore 1603 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698