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

Unified Diff: Source/core/css/parser/CSSParserValues.h

Issue 1188513005: Move CSSParserString out of CSSParserValues.h (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Change includes to use CSSParserString.h Created 5 years, 6 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/parser/CSSParserToken.h ('k') | Source/core/css/parser/CSSTokenizer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/parser/CSSParserValues.h
diff --git a/Source/core/css/parser/CSSParserValues.h b/Source/core/css/parser/CSSParserValues.h
index 675fdfdd474499e367e672cf34097c9726a8951a..0b760f1c510c1c80821ddb17d9dfcf286d1e92d8 100644
--- a/Source/core/css/parser/CSSParserValues.h
+++ b/Source/core/css/parser/CSSParserValues.h
@@ -25,88 +25,13 @@
#include "core/css/CSSPrimitiveValue.h"
#include "core/css/CSSSelector.h"
#include "core/css/CSSValueList.h"
-#include "wtf/text/AtomicString.h"
-#include "wtf/text/WTFString.h"
+#include "core/css/parser/CSSParserString.h"
namespace blink {
class QualifiedName;
class CSSParserTokenRange;
-struct CSSParserString {
- void init(const LChar* characters, unsigned length)
- {
- m_data.characters8 = characters;
- m_length = length;
- m_is8Bit = true;
- }
-
- void init(const UChar* characters, unsigned length)
- {
- m_data.characters16 = characters;
- m_length = length;
- m_is8Bit = false;
- }
-
- void initRaw(const void* charactersRaw, unsigned length, bool is8Bit)
- {
- m_data.charactersRaw = charactersRaw;
- m_length = length;
- m_is8Bit = is8Bit;
- }
-
- void init(const String& string)
- {
- m_length = string.length();
- if (string.isNull()) {
- m_data.characters8 = 0;
- m_is8Bit = true;
- return;
- }
- if (string.is8Bit()) {
- m_data.characters8 = const_cast<LChar*>(string.characters8());
- m_is8Bit = true;
- } else {
- m_data.characters16 = const_cast<UChar*>(string.characters16());
- m_is8Bit = false;
- }
- }
-
- bool is8Bit() const { return m_is8Bit; }
- const LChar* characters8() const { ASSERT(is8Bit()); return m_data.characters8; }
- const UChar* characters16() const { ASSERT(!is8Bit()); return m_data.characters16; }
-
- unsigned length() const { return m_length; }
-
- UChar operator[](unsigned i) const
- {
- ASSERT_WITH_SECURITY_IMPLICATION(i < m_length);
- if (is8Bit())
- return m_data.characters8[i];
- return m_data.characters16[i];
- }
-
- bool equalIgnoringCase(const char* str) const
- {
- bool match = is8Bit() ? WTF::equalIgnoringCase(str, characters8(), length()) : WTF::equalIgnoringCase(str, characters16(), length());
- if (!match)
- return false;
- ASSERT(strlen(str) >= length());
- return str[length()] == '\0';
- }
-
- operator String() const { return is8Bit() ? String(m_data.characters8, m_length) : StringImpl::create8BitIfPossible(m_data.characters16, m_length); }
- operator AtomicString() const { return is8Bit() ? AtomicString(m_data.characters8, m_length) : AtomicString(m_data.characters16, m_length); }
-
- union {
- const LChar* characters8;
- const UChar* characters16;
- const void* charactersRaw;
- } m_data;
- unsigned m_length;
- bool m_is8Bit;
-};
-
struct CSSParserFunction;
class CSSParserValueList;
« no previous file with comments | « Source/core/css/parser/CSSParserToken.h ('k') | Source/core/css/parser/CSSTokenizer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698