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

Unified Diff: Source/core/css/CSSStyleSheet.cpp

Issue 756313002: Remove CSSCharsetRule (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: tests Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/CSSGroupingRule.cpp ('k') | Source/core/css/StyleRule.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSStyleSheet.cpp
diff --git a/Source/core/css/CSSStyleSheet.cpp b/Source/core/css/CSSStyleSheet.cpp
index 705d3283da8707459b4002a670ea53176e068975..41ae5b877fed1cdf33ac1a0107ae8f102d5640f9 100644
--- a/Source/core/css/CSSStyleSheet.cpp
+++ b/Source/core/css/CSSStyleSheet.cpp
@@ -26,7 +26,6 @@
#include "bindings/core/v8/V8PerIsolateData.h"
#include "core/HTMLNames.h"
#include "core/SVGNames.h"
-#include "core/css/CSSCharsetRule.h"
#include "core/css/CSSImportRule.h"
#include "core/css/CSSRuleList.h"
#include "core/css/MediaList.h"
@@ -252,13 +251,8 @@ CSSRule* CSSStyleSheet::item(unsigned index)
ASSERT(m_childRuleCSSOMWrappers.size() == ruleCount);
RefPtrWillBeMember<CSSRule>& cssRule = m_childRuleCSSOMWrappers[index];
- if (!cssRule) {
- if (index == 0 && m_contents->hasCharsetRule()) {
- ASSERT(!m_contents->ruleAt(0));
- cssRule = CSSCharsetRule::create(this, m_contents->encodingFromCharsetRule());
- } else
- cssRule = m_contents->ruleAt(index)->createCSSOMWrapper(this);
- }
+ if (!cssRule)
+ cssRule = m_contents->ruleAt(index)->createCSSOMWrapper(this);
return cssRule.get();
}
@@ -287,18 +281,7 @@ bool CSSStyleSheet::canAccessRules() const
PassRefPtrWillBeRawPtr<CSSRuleList> CSSStyleSheet::rules()
{
- if (!canAccessRules())
- return nullptr;
- // IE behavior.
- RefPtrWillBeRawPtr<StaticCSSRuleList> nonCharsetRules(StaticCSSRuleList::create());
- unsigned ruleCount = length();
- for (unsigned i = 0; i < ruleCount; ++i) {
- CSSRule* rule = item(i);
- if (rule->type() == CSSRule::CHARSET_RULE)
- continue;
- nonCharsetRules->rules().append(rule);
- }
- return nonCharsetRules.release();
+ return cssRules();
}
unsigned CSSStyleSheet::insertRule(const String& ruleString, unsigned index, ExceptionState& exceptionState)
« no previous file with comments | « Source/core/css/CSSGroupingRule.cpp ('k') | Source/core/css/StyleRule.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698