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

Side by Side Diff: sky/engine/core/css/StyleSheetContents.cpp

Issue 800083003: Remove hasSyntacticallyValidCSSHeader. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « sky/engine/core/css/StyleSheetContents.h ('k') | sky/engine/core/css/parser/BisonCSSParser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 18 matching lines...) Expand all
29 #include "sky/engine/core/dom/Document.h" 29 #include "sky/engine/core/dom/Document.h"
30 #include "sky/engine/core/dom/Node.h" 30 #include "sky/engine/core/dom/Node.h"
31 #include "sky/engine/core/dom/StyleEngine.h" 31 #include "sky/engine/core/dom/StyleEngine.h"
32 #include "sky/engine/core/frame/UseCounter.h" 32 #include "sky/engine/core/frame/UseCounter.h"
33 #include "sky/engine/platform/TraceEvent.h" 33 #include "sky/engine/platform/TraceEvent.h"
34 #include "sky/engine/wtf/Deque.h" 34 #include "sky/engine/wtf/Deque.h"
35 35
36 namespace blink { 36 namespace blink {
37 37
38 StyleSheetContents::StyleSheetContents(const String& originalURL, const CSSParse rContext& context) 38 StyleSheetContents::StyleSheetContents(const String& originalURL, const CSSParse rContext& context)
39 : m_hasSyntacticallyValidCSSHeader(true) 39 : m_usesRemUnits(false)
40 , m_usesRemUnits(false)
41 , m_hasMediaQueries(false) 40 , m_hasMediaQueries(false)
42 , m_hasSingleOwnerDocument(true) 41 , m_hasSingleOwnerDocument(true)
43 , m_originalURL(originalURL) 42 , m_originalURL(originalURL)
44 , m_parserContext(context) 43 , m_parserContext(context)
45 { 44 {
46 } 45 }
47 46
48 StyleSheetContents::~StyleSheetContents() 47 StyleSheetContents::~StyleSheetContents()
49 { 48 {
50 #if !ENABLE(OILPAN) 49 #if !ENABLE(OILPAN)
51 clearRules(); 50 clearRules();
52 #endif 51 #endif
53 } 52 }
54 53
55 void StyleSheetContents::setHasSyntacticallyValidCSSHeader(bool isValidCss)
56 {
57 if (!isValidCss) {
58 if (Document* document = clientSingleOwnerDocument())
59 removeSheetFromCache(document);
60 }
61 m_hasSyntacticallyValidCSSHeader = isValidCss;
62 }
63
64 bool StyleSheetContents::isCacheable() const 54 bool StyleSheetContents::isCacheable() const
65 { 55 {
66 // FIXME: StyleSheets with media queries can't be cached because their RuleS et 56 // FIXME: StyleSheets with media queries can't be cached because their RuleS et
67 // is processed differently based off the media queries, which might resolve 57 // is processed differently based off the media queries, which might resolve
68 // differently depending on the context of the parent CSSStyleSheet (e.g. 58 // differently depending on the context of the parent CSSStyleSheet (e.g.
69 // if they are in differently sized iframes). Once RuleSets are media query 59 // if they are in differently sized iframes). Once RuleSets are media query
70 // agnostic, we can restore sharing of StyleSheetContents with medea queries . 60 // agnostic, we can restore sharing of StyleSheetContents with medea queries .
71 if (m_hasMediaQueries) 61 if (m_hasMediaQueries)
72 return false; 62 return false;
73 // If the header is valid we are not going to need to check the SecurityOrig in.
74 // FIXME: Valid mime type avoids the check too.
75 if (!m_hasSyntacticallyValidCSSHeader)
76 return false;
77 return true; 63 return true;
78 } 64 }
79 65
80 void StyleSheetContents::parserAppendRule(PassRefPtr<StyleRuleBase> rule) 66 void StyleSheetContents::parserAppendRule(PassRefPtr<StyleRuleBase> rule)
81 { 67 {
82 // Add warning message to inspector if dpi/dpcm values are used for screen m edia. 68 // Add warning message to inspector if dpi/dpcm values are used for screen m edia.
83 if (rule->isMediaRule()) { 69 if (rule->isMediaRule()) {
84 setHasMediaQueries(); 70 setHasMediaQueries();
85 reportMediaQueryWarningIfNeeded(singleOwnerDocument(), toStyleRuleMedia( rule.get())->mediaQueries()); 71 reportMediaQueryWarningIfNeeded(singleOwnerDocument(), toStyleRuleMedia( rule.get())->mediaQueries());
86 } 72 }
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 } 251 }
266 } 252 }
267 253
268 void StyleSheetContents::notifyRemoveFontFaceRule(const StyleRuleFontFace* fontF aceRule) 254 void StyleSheetContents::notifyRemoveFontFaceRule(const StyleRuleFontFace* fontF aceRule)
269 { 255 {
270 removeFontFaceRules(m_loadingClients, fontFaceRule); 256 removeFontFaceRules(m_loadingClients, fontFaceRule);
271 removeFontFaceRules(m_completedClients, fontFaceRule); 257 removeFontFaceRules(m_completedClients, fontFaceRule);
272 } 258 }
273 259
274 } 260 }
OLDNEW
« no previous file with comments | « sky/engine/core/css/StyleSheetContents.h ('k') | sky/engine/core/css/parser/BisonCSSParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698