| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "core/css/CSSParserValues.h" | 22 #include "core/css/CSSParserValues.h" |
| 23 | 23 |
| 24 #include "core/css/CSSFunctionValue.h" | 24 #include "core/css/CSSFunctionValue.h" |
| 25 #include "core/css/CSSSelectorList.h" | 25 #include "core/css/CSSSelectorList.h" |
| 26 #include "core/html/parser/HTMLParserIdioms.h" | 26 #include "core/html/parser/HTMLParserIdioms.h" |
| 27 | 27 |
| 28 namespace WebCore { | 28 namespace WebCore { |
| 29 | 29 |
| 30 using namespace WTF; | 30 using namespace WTF; |
| 31 | 31 |
| 32 AtomicString CSSParserString::atomicSubstring(unsigned position, unsigned length
) const | |
| 33 { | |
| 34 ASSERT(m_length >= position + length); | |
| 35 | |
| 36 if (is8Bit()) | |
| 37 return AtomicString(characters8() + position, length); | |
| 38 return AtomicString(characters16() + position, length); | |
| 39 } | |
| 40 | |
| 41 void CSSParserString::trimTrailingWhitespace() | |
| 42 { | |
| 43 if (is8Bit()) { | |
| 44 while (m_length > 0 && isHTMLSpace<LChar>(m_data.characters8[m_length -
1])) | |
| 45 --m_length; | |
| 46 } else { | |
| 47 while (m_length > 0 && isHTMLSpace<UChar>(m_data.characters16[m_length -
1])) | |
| 48 --m_length; | |
| 49 } | |
| 50 } | |
| 51 | |
| 52 CSSParserValueList::~CSSParserValueList() | 32 CSSParserValueList::~CSSParserValueList() |
| 53 { | 33 { |
| 54 size_t numValues = m_values.size(); | 34 size_t numValues = m_values.size(); |
| 55 for (size_t i = 0; i < numValues; i++) { | 35 for (size_t i = 0; i < numValues; i++) { |
| 56 if (m_values[i].unit == CSSParserValue::Function) | 36 if (m_values[i].unit == CSSParserValue::Function) |
| 57 delete m_values[i].function; | 37 delete m_values[i].function; |
| 58 else if (m_values[i].unit == CSSParserValue::ValueList) | 38 else if (m_values[i].unit == CSSParserValue::ValueList) |
| 59 delete m_values[i].valueList; | 39 delete m_values[i].valueList; |
| 60 } | 40 } |
| 61 } | 41 } |
| 62 | 42 |
| 63 void CSSParserValueList::addValue(const CSSParserValue& v) | 43 void CSSParserValueList::addValue(const CSSParserValue& v) |
| 64 { | 44 { |
| 65 m_values.append(v); | 45 m_values.append(v); |
| 66 } | 46 } |
| 67 | 47 |
| 68 void CSSParserValueList::insertValueAt(unsigned i, const CSSParserValue& v) | 48 void CSSParserValueList::insertValueAt(unsigned i, const CSSParserValue& v) |
| 69 { | 49 { |
| 70 m_values.insert(i, v); | 50 m_values.insert(i, v); |
| 71 } | 51 } |
| 72 | 52 |
| 73 void CSSParserValueList::deleteValueAt(unsigned i) | |
| 74 { | |
| 75 m_values.remove(i); | |
| 76 } | |
| 77 | |
| 78 void CSSParserValueList::stealValues(CSSParserValueList& valueList) | 53 void CSSParserValueList::stealValues(CSSParserValueList& valueList) |
| 79 { | 54 { |
| 80 for (unsigned i = 0; i < valueList.size(); ++i) | 55 for (unsigned i = 0; i < valueList.size(); ++i) |
| 81 m_values.append(*(valueList.valueAt(i))); | 56 m_values.append(*(valueList.valueAt(i))); |
| 82 valueList.clear(); | 57 valueList.clear(); |
| 83 } | 58 } |
| 84 | 59 |
| 85 PassRefPtrWillBeRawPtr<CSSValue> CSSParserValue::createCSSValue() | 60 PassRefPtrWillBeRawPtr<CSSValue> CSSParserValue::createCSSValue() |
| 86 { | 61 { |
| 87 if (id) | 62 if (id) |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 { | 220 { |
| 246 CSSParserSelector* selector = const_cast<CSSParserSelector*>(this); | 221 CSSParserSelector* selector = const_cast<CSSParserSelector*>(this); |
| 247 do { | 222 do { |
| 248 if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseud
oType() == CSSSelector::PseudoHostContext) | 223 if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseud
oType() == CSSSelector::PseudoHostContext) |
| 249 return true; | 224 return true; |
| 250 } while ((selector = selector->tagHistory())); | 225 } while ((selector = selector->tagHistory())); |
| 251 return false; | 226 return false; |
| 252 } | 227 } |
| 253 | 228 |
| 254 } // namespace WebCore | 229 } // namespace WebCore |
| OLD | NEW |