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

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

Issue 1321943002: Support for CSSOM CSSNamespaceRule interface (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated as per review comments Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/css/CSSNamespaceRule.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSGroupingRule.cpp
diff --git a/Source/core/css/CSSGroupingRule.cpp b/Source/core/css/CSSGroupingRule.cpp
index 24f7147f6407a066f6618ece6732a452f8215773..f0b932981fa4ca93ae0dbdf528a0c98eea3766f7 100644
--- a/Source/core/css/CSSGroupingRule.cpp
+++ b/Source/core/css/CSSGroupingRule.cpp
@@ -71,13 +71,16 @@ unsigned CSSGroupingRule::insertRule(const String& ruleString, unsigned index, E
CSSStyleSheet* styleSheet = parentStyleSheet();
CSSParserContext context(parserContext(), UseCounter::getFrom(styleSheet));
RefPtrWillBeRawPtr<StyleRuleBase> newRule = CSSParser::parseRule(context, styleSheet ? styleSheet->contents() : nullptr, ruleString);
- // FIXME: @namespace rules have special handling in the CSSOM spec, but it
- // mostly doesn't make sense since we don't support CSSNamespaceRule
- if (!newRule || newRule->isNamespaceRule()) {
+ if (!newRule) {
exceptionState.throwDOMException(SyntaxError, "the rule '" + ruleString + "' is invalid and cannot be parsed.");
return 0;
}
+ if (newRule->isNamespaceRule()) {
+ exceptionState.throwDOMException(HierarchyRequestError, "'@namespace' rules cannot be inserted inside a group rule.");
+ return 0;
+ }
+
if (newRule->isImportRule()) {
// FIXME: an HierarchyRequestError should also be thrown for a nested @media rule. They are
// currently not getting parsed, resulting in a SyntaxError to get raised above.
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/css/CSSNamespaceRule.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698