| OLD | NEW |
| 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 11 matching lines...) Expand all Loading... |
| 22 #include "sky/engine/core/css/StyleSheetContents.h" | 22 #include "sky/engine/core/css/StyleSheetContents.h" |
| 23 | 23 |
| 24 #include "sky/engine/core/css/CSSStyleSheet.h" | 24 #include "sky/engine/core/css/CSSStyleSheet.h" |
| 25 #include "sky/engine/core/css/MediaList.h" | 25 #include "sky/engine/core/css/MediaList.h" |
| 26 #include "sky/engine/core/css/StylePropertySet.h" | 26 #include "sky/engine/core/css/StylePropertySet.h" |
| 27 #include "sky/engine/core/css/StyleRule.h" | 27 #include "sky/engine/core/css/StyleRule.h" |
| 28 #include "sky/engine/core/css/parser/BisonCSSParser.h" | 28 #include "sky/engine/core/css/parser/BisonCSSParser.h" |
| 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" | |
| 33 #include "sky/engine/platform/TraceEvent.h" | 32 #include "sky/engine/platform/TraceEvent.h" |
| 34 #include "sky/engine/wtf/Deque.h" | 33 #include "sky/engine/wtf/Deque.h" |
| 35 | 34 |
| 36 namespace blink { | 35 namespace blink { |
| 37 | 36 |
| 38 StyleSheetContents::StyleSheetContents(Document* document, const CSSParserContex
t& context) | 37 StyleSheetContents::StyleSheetContents(Document* document, const CSSParserContex
t& context) |
| 39 : m_parserContext(context) | 38 : m_parserContext(context) |
| 40 , m_document(document) | 39 , m_document(document) |
| 41 { | 40 { |
| 42 } | 41 } |
| 43 | 42 |
| 44 StyleSheetContents::~StyleSheetContents() | 43 StyleSheetContents::~StyleSheetContents() |
| 45 { | 44 { |
| 46 // TODO(esprehn): Why is this here? The rules will be cleared immediately | 45 // TODO(esprehn): Why is this here? The rules will be cleared immediately |
| 47 // after this destructor runs anyway. | 46 // after this destructor runs anyway. |
| 48 m_childRules.clear(); | 47 m_childRules.clear(); |
| 49 | 48 |
| 50 if (m_document && m_document->isActive()) | 49 if (m_document && m_document->isActive()) |
| 51 m_document->styleEngine()->removeSheet(this); | 50 m_document->styleEngine()->removeSheet(this); |
| 52 } | 51 } |
| 53 | 52 |
| 54 void StyleSheetContents::parserAppendRule(PassRefPtr<StyleRuleBase> rule) | 53 void StyleSheetContents::parserAppendRule(PassRefPtr<StyleRuleBase> rule) |
| 55 { | 54 { |
| 56 m_childRules.append(rule); | 55 m_childRules.append(rule); |
| 57 } | 56 } |
| 58 | 57 |
| 59 bool StyleSheetContents::parseString(const String& sheetText) | 58 bool StyleSheetContents::parseString(const String& sheetText) |
| 60 { | 59 { |
| 61 CSSParserContext context(parserContext(), UseCounter::getFrom(this)); | 60 CSSParserContext context(parserContext()); |
| 62 BisonCSSParser p(context); | 61 BisonCSSParser p(context); |
| 63 p.parseSheet(this, sheetText); | 62 p.parseSheet(this, sheetText); |
| 64 return true; | 63 return true; |
| 65 } | 64 } |
| 66 | 65 |
| 67 void StyleSheetContents::shrinkToFit() | 66 void StyleSheetContents::shrinkToFit() |
| 68 { | 67 { |
| 69 m_childRules.shrinkToFit(); | 68 m_childRules.shrinkToFit(); |
| 70 } | 69 } |
| 71 | 70 |
| 72 RuleSet& StyleSheetContents::ensureRuleSet() | 71 RuleSet& StyleSheetContents::ensureRuleSet() |
| 73 { | 72 { |
| 74 if (!m_ruleSet) { | 73 if (!m_ruleSet) { |
| 75 m_ruleSet = RuleSet::create(); | 74 m_ruleSet = RuleSet::create(); |
| 76 m_ruleSet->addRulesFromSheet(this); | 75 m_ruleSet->addRulesFromSheet(this); |
| 77 } | 76 } |
| 78 return *m_ruleSet.get(); | 77 return *m_ruleSet.get(); |
| 79 } | 78 } |
| 80 | 79 |
| 81 } | 80 } |
| OLD | NEW |