| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 { | 94 { |
| 95 RefPtr<FontFace> fontFace = FontFace::create(document, fontFaceRule); | 95 RefPtr<FontFace> fontFace = FontFace::create(document, fontFaceRule); |
| 96 if (fontFace) | 96 if (fontFace) |
| 97 cssFontSelector->fontFaceCache()->add(cssFontSelector, fontFaceRule, fon
tFace); | 97 cssFontSelector->fontFaceCache()->add(cssFontSelector, fontFaceRule, fon
tFace); |
| 98 } | 98 } |
| 99 | 99 |
| 100 static RuleSet& defaultStyles() | 100 static RuleSet& defaultStyles() |
| 101 { | 101 { |
| 102 DEFINE_STATIC_LOCAL(RefPtr<StyleSheetContents>, styleSheet, ()); | 102 DEFINE_STATIC_LOCAL(RefPtr<StyleSheetContents>, styleSheet, ()); |
| 103 DEFINE_STATIC_LOCAL(OwnPtr<RuleSet>, ruleSet, ()); | 103 DEFINE_STATIC_LOCAL(OwnPtr<RuleSet>, ruleSet, ()); |
| 104 DEFINE_STATIC_LOCAL(const MediaQueryEvaluator, screenEval, ("screen")); | |
| 105 | 104 |
| 106 if (ruleSet) | 105 if (ruleSet) |
| 107 return *ruleSet; | 106 return *ruleSet; |
| 108 | 107 |
| 109 String cssText = | 108 String cssText = |
| 110 "link, import, meta, script, style, template, title {\n" | 109 "link, import, meta, script, style, template, title {\n" |
| 111 " display: none;\n" | 110 " display: none;\n" |
| 112 "}\n" | 111 "}\n" |
| 113 "a {\n" | 112 "a {\n" |
| 114 " color: blue;\n" | 113 " color: blue;\n" |
| 115 " display: inline;\n" | 114 " display: inline;\n" |
| 116 " text-decoration: underline;\n" | 115 " text-decoration: underline;\n" |
| 117 "}\n"; | 116 "}\n"; |
| 118 | 117 |
| 119 | 118 |
| 120 styleSheet = StyleSheetContents::create(CSSParserContext(0)); | 119 styleSheet = StyleSheetContents::create(CSSParserContext(0)); |
| 121 styleSheet->parseString(cssText); | 120 styleSheet->parseString(cssText); |
| 122 | 121 |
| 123 ruleSet = RuleSet::create(); | 122 ruleSet = RuleSet::create(); |
| 124 ruleSet->addRulesFromSheet(styleSheet.get(), screenEval); | 123 ruleSet->addRulesFromSheet(styleSheet.get()); |
| 125 | 124 |
| 126 return *ruleSet; | 125 return *ruleSet; |
| 127 } | 126 } |
| 128 | 127 |
| 129 StyleResolver::StyleResolver(Document& document) | 128 StyleResolver::StyleResolver(Document& document) |
| 130 : m_document(document) | 129 : m_document(document) |
| 131 , m_needCollectFeatures(false) | 130 , m_needCollectFeatures(false) |
| 132 , m_printMediaType(false) | 131 , m_printMediaType(false) |
| 133 , m_styleResourceLoader(document.fetcher()) | 132 , m_styleResourceLoader(document.fetcher()) |
| 134 , m_styleSharingDepth(0) | 133 , m_styleSharingDepth(0) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 163 if (cssSheet->mediaQueries() && !m_medium->eval(cssSheet->mediaQueries(), &m
_viewportDependentMediaQueryResults)) | 162 if (cssSheet->mediaQueries() && !m_medium->eval(cssSheet->mediaQueries(), &m
_viewportDependentMediaQueryResults)) |
| 164 return; | 163 return; |
| 165 | 164 |
| 166 Node* ownerNode = cssSheet->ownerNode(); | 165 Node* ownerNode = cssSheet->ownerNode(); |
| 167 if (!ownerNode) | 166 if (!ownerNode) |
| 168 return; | 167 return; |
| 169 | 168 |
| 170 TreeScope& treeScope = ownerNode->treeScope(); | 169 TreeScope& treeScope = ownerNode->treeScope(); |
| 171 ScopedStyleResolver& resolver = treeScope.ensureScopedStyleResolver(); | 170 ScopedStyleResolver& resolver = treeScope.ensureScopedStyleResolver(); |
| 172 document().styleEngine()->addScopedStyleResolver(&resolver); | 171 document().styleEngine()->addScopedStyleResolver(&resolver); |
| 173 resolver.addRulesFromSheet(cssSheet, *m_medium, this); | 172 resolver.addRulesFromSheet(cssSheet, this); |
| 174 } | 173 } |
| 175 | 174 |
| 176 void StyleResolver::appendPendingAuthorStyleSheets() | 175 void StyleResolver::appendPendingAuthorStyleSheets() |
| 177 { | 176 { |
| 178 for (ListHashSet<RawPtr<CSSStyleSheet>, 16>::iterator it = m_pendingStyleShe
ets.begin(); it != m_pendingStyleSheets.end(); ++it) | 177 for (ListHashSet<RawPtr<CSSStyleSheet>, 16>::iterator it = m_pendingStyleShe
ets.begin(); it != m_pendingStyleSheets.end(); ++it) |
| 179 appendCSSStyleSheet(*it); | 178 appendCSSStyleSheet(*it); |
| 180 | 179 |
| 181 m_pendingStyleSheets.clear(); | 180 m_pendingStyleSheets.clear(); |
| 182 finishAppendAuthorStyleSheets(); | 181 finishAppendAuthorStyleSheets(); |
| 183 } | 182 } |
| (...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 bool StyleResolver::mediaQueryAffectedByViewportChange() const | 935 bool StyleResolver::mediaQueryAffectedByViewportChange() const |
| 937 { | 936 { |
| 938 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { | 937 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { |
| 939 if (m_medium->eval(m_viewportDependentMediaQueryResults[i]->expression()
) != m_viewportDependentMediaQueryResults[i]->result()) | 938 if (m_medium->eval(m_viewportDependentMediaQueryResults[i]->expression()
) != m_viewportDependentMediaQueryResults[i]->result()) |
| 940 return true; | 939 return true; |
| 941 } | 940 } |
| 942 return false; | 941 return false; |
| 943 } | 942 } |
| 944 | 943 |
| 945 } // namespace blink | 944 } // namespace blink |
| OLD | NEW |