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

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

Issue 1253403005: Implement CSS.escape (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix final test Created 5 years, 5 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/css/DOMWindowCSS.h ('k') | Source/core/css/parser/CSSParserToken.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/DOMWindowCSS.cpp
diff --git a/Source/core/css/DOMWindowCSS.cpp b/Source/core/css/DOMWindowCSS.cpp
index b4548f3cfc50c34898acff32b542465732437a67..ccb50f294fd3d671407d98152c94601fa81d32b6 100644
--- a/Source/core/css/DOMWindowCSS.cpp
+++ b/Source/core/css/DOMWindowCSS.cpp
@@ -30,9 +30,13 @@
#include "config.h"
#include "core/css/DOMWindowCSS.h"
+#include "bindings/core/v8/ExceptionState.h"
+#include "core/css/CSSMarkup.h"
#include "core/css/CSSPropertyMetadata.h"
#include "core/css/StylePropertySet.h"
#include "core/css/parser/CSSParser.h"
+#include "core/dom/ExceptionCode.h"
+#include "wtf/text/StringBuilder.h"
#include "wtf/text/WTFString.h"
namespace blink {
@@ -54,4 +58,14 @@ bool DOMWindowCSS::supports(const String& conditionText)
return CSSParser::parseSupportsCondition(conditionText);
}
+String DOMWindowCSS::escape(const String& ident, ExceptionState& exceptionState)
+{
+ StringBuilder builder;
+ if (!serializeIdentifier(ident, builder)) {
+ exceptionState.throwDOMException(InvalidCharacterError, "The string contains an invalid character.");
+ return String();
+ }
+ return builder.toString();
+}
+
}
« no previous file with comments | « Source/core/css/DOMWindowCSS.h ('k') | Source/core/css/parser/CSSParserToken.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698