Index: Source/core/css/parser/CSSParserSelector.h |
diff --git a/Source/core/css/parser/CSSParserValues.h b/Source/core/css/parser/CSSParserSelector.h |
similarity index 51% |
copy from Source/core/css/parser/CSSParserValues.h |
copy to Source/core/css/parser/CSSParserSelector.h |
index c44e7b12eacab4f4e7463d21e47cc4c5a49da182..7c1a676d55d256cd32133348c5854c045a3b999a 100644 |
--- a/Source/core/css/parser/CSSParserValues.h |
+++ b/Source/core/css/parser/CSSParserSelector.h |
@@ -18,116 +18,13 @@ |
* Boston, MA 02110-1301, USA. |
*/ |
-#ifndef CSSParserValues_h |
-#define CSSParserValues_h |
+#ifndef CSSParserSelector_h |
+#define CSSParserSelector_h |
-#include "core/CSSValueKeywords.h" |
-#include "core/css/CSSPrimitiveValue.h" |
#include "core/css/CSSSelector.h" |
-#include "core/css/CSSValueList.h" |
-#include "core/css/parser/CSSParserString.h" |
-#include "core/css/parser/CSSParserTokenRange.h" |
-#include "wtf/Allocator.h" |
namespace blink { |
-class QualifiedName; |
- |
-struct CSSParserFunction; |
-struct CSSParserCalcFunction; |
-class CSSParserValueList; |
- |
-struct CSSParserValue { |
- ALLOW_ONLY_INLINE_ALLOCATION(); |
- CSSValueID id; |
- bool isInt; |
- union { |
- double fValue; |
- int iValue; |
- CSSParserString string; |
- CSSParserFunction* function; |
- CSSParserCalcFunction* calcFunction; |
- CSSParserValueList* valueList; |
- struct { |
- UChar32 start; |
- UChar32 end; |
- } m_unicodeRange; |
- }; |
- enum { |
- Operator = 0x100000, |
- Function = 0x100001, |
- CalcFunction = 0x100002, |
- ValueList = 0x100003, |
- HexColor = 0x100004, |
- Identifier = 0x100005, |
- // Represents a dimension by a list of two values, a UnitType::Number and an Identifier |
- DimensionList = 0x100006, |
- // Represents a unicode range by a pair of UChar32 values |
- UnicodeRange = 0x100007, |
- }; |
- int m_unit; |
- CSSPrimitiveValue::UnitType unit() const { return static_cast<CSSPrimitiveValue::UnitType>(m_unit); } |
- void setUnit(CSSPrimitiveValue::UnitType unit) { m_unit = static_cast<int>(unit); } |
- |
- inline void setFromNumber(double value, CSSPrimitiveValue::UnitType); |
- inline void setFromOperator(UChar); |
- inline void setFromValueList(PassOwnPtr<CSSParserValueList>); |
-}; |
- |
-class CORE_EXPORT CSSParserValueList { |
- WTF_MAKE_FAST_ALLOCATED(CSSParserValueList); |
-public: |
- CSSParserValueList() |
- : m_current(0) |
- { |
- } |
- CSSParserValueList(CSSParserTokenRange); |
- ~CSSParserValueList(); |
- |
- void addValue(const CSSParserValue&); |
- |
- unsigned size() const { return m_values.size(); } |
- unsigned currentIndex() { return m_current; } |
- CSSParserValue* current() { return m_current < m_values.size() ? &m_values[m_current] : 0; } |
- CSSParserValue* next() { ++m_current; return current(); } |
- CSSParserValue* previous() |
- { |
- if (!m_current) |
- return 0; |
- --m_current; |
- return current(); |
- } |
- void setCurrentIndex(unsigned index) |
- { |
- ASSERT(index < m_values.size()); |
- if (index < m_values.size()) |
- m_current = index; |
- } |
- |
- CSSParserValue* valueAt(unsigned i) { return i < m_values.size() ? &m_values[i] : 0; } |
- |
- void clearAndLeakValues() { m_values.clear(); m_current = 0;} |
- void destroyAndClear(); |
- |
-private: |
- unsigned m_current; |
- Vector<CSSParserValue, 4> m_values; |
-}; |
- |
-struct CSSParserFunction { |
- WTF_MAKE_FAST_ALLOCATED(CSSParserFunction); |
-public: |
- CSSValueID id; |
- OwnPtr<CSSParserValueList> args; |
-}; |
- |
-struct CSSParserCalcFunction { |
- WTF_MAKE_FAST_ALLOCATED(CSSParserCalcFunction); |
-public: |
- CSSParserCalcFunction(CSSParserTokenRange args_) : args(args_) {} |
- CSSParserTokenRange args; |
-}; |
- |
class CSSParserSelector { |
WTF_MAKE_NONCOPYABLE(CSSParserSelector); WTF_MAKE_FAST_ALLOCATED(CSSParserSelector); |
public: |
@@ -184,30 +81,6 @@ inline bool CSSParserSelector::hasShadowPseudo() const |
return m_selector->relation() == CSSSelector::ShadowPseudo; |
} |
-inline void CSSParserValue::setFromNumber(double value, CSSPrimitiveValue::UnitType unit) |
-{ |
- id = CSSValueInvalid; |
- isInt = false; |
- fValue = value; |
- this->setUnit(std::isfinite(value) ? unit : CSSPrimitiveValue::UnitType::Unknown); |
-} |
- |
-inline void CSSParserValue::setFromOperator(UChar c) |
-{ |
- id = CSSValueInvalid; |
- m_unit = Operator; |
- iValue = c; |
- isInt = false; |
-} |
- |
-inline void CSSParserValue::setFromValueList(PassOwnPtr<CSSParserValueList> valueList) |
-{ |
- id = CSSValueInvalid; |
- this->valueList = valueList.leakPtr(); |
- m_unit = ValueList; |
- isInt = false; |
-} |
- |
-} |
+} // namespace blink |
#endif |