| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) |
| 3 * 1999 Waldo Bastian (bastian@kde.org) | 3 * 1999 Waldo Bastian (bastian@kde.org) |
| 4 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights
reserved. | 4 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights
reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 void setValue(const AtomicString&, bool matchLowerCase); | 246 void setValue(const AtomicString&, bool matchLowerCase); |
| 247 void setAttribute(const QualifiedName&, AttributeMatchType); | 247 void setAttribute(const QualifiedName&, AttributeMatchType); |
| 248 void setArgument(const AtomicString&); | 248 void setArgument(const AtomicString&); |
| 249 void setSelectorList(PassOwnPtr<CSSSelectorList>); | 249 void setSelectorList(PassOwnPtr<CSSSelectorList>); |
| 250 | 250 |
| 251 void setNth(int a, int b); | 251 void setNth(int a, int b); |
| 252 bool matchNth(int count) const; | 252 bool matchNth(int count) const; |
| 253 | 253 |
| 254 bool isAdjacentSelector() const { return m_relation == DirectAdjacent || m_r
elation == IndirectAdjacent; } | 254 bool isAdjacentSelector() const { return m_relation == DirectAdjacent || m_r
elation == IndirectAdjacent; } |
| 255 bool isShadowSelector() const { return m_relation == ShadowPseudo || m_relat
ion == ShadowDeep; } | 255 bool isShadowSelector() const { return m_relation == ShadowPseudo || m_relat
ion == ShadowDeep; } |
| 256 bool isSiblingPseudo() const; | |
| 257 bool isAttributeSelector() const { return m_match >= FirstAttributeSelectorM
atch; } | 256 bool isAttributeSelector() const { return m_match >= FirstAttributeSelectorM
atch; } |
| 258 bool isHostPseudoClass() const { return m_pseudoType == PseudoHost || m_pseu
doType == PseudoHostContext; } | 257 bool isHostPseudoClass() const { return m_pseudoType == PseudoHost || m_pseu
doType == PseudoHostContext; } |
| 259 bool isInsertionPointCrossing() const { return m_pseudoType == PseudoHostCon
text || m_pseudoType == PseudoContent || m_pseudoType == PseudoSlotted; } | 258 bool isInsertionPointCrossing() const { return m_pseudoType == PseudoHostCon
text || m_pseudoType == PseudoContent || m_pseudoType == PseudoSlotted; } |
| 260 | 259 |
| 261 Relation relation() const { return static_cast<Relation>(m_relation); } | 260 Relation relation() const { return static_cast<Relation>(m_relation); } |
| 262 void setRelation(Relation relation) | 261 void setRelation(Relation relation) |
| 263 { | 262 { |
| 264 m_relation = relation; | 263 m_relation = relation; |
| 265 ASSERT(static_cast<Relation>(m_relation) == relation); // using a bitfie
ld. | 264 ASSERT(static_cast<Relation>(m_relation) == relation); // using a bitfie
ld. |
| 266 } | 265 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 return m_data.m_rareData->m_attribute; | 357 return m_data.m_rareData->m_attribute; |
| 359 } | 358 } |
| 360 | 359 |
| 361 inline CSSSelector::AttributeMatchType CSSSelector::attributeMatchType() const | 360 inline CSSSelector::AttributeMatchType CSSSelector::attributeMatchType() const |
| 362 { | 361 { |
| 363 ASSERT(isAttributeSelector()); | 362 ASSERT(isAttributeSelector()); |
| 364 ASSERT(m_hasRareData); | 363 ASSERT(m_hasRareData); |
| 365 return m_data.m_rareData->m_bits.m_attributeMatchType; | 364 return m_data.m_rareData->m_bits.m_attributeMatchType; |
| 366 } | 365 } |
| 367 | 366 |
| 368 inline bool CSSSelector::isSiblingPseudo() const | |
| 369 { | |
| 370 PseudoType type = pseudoType(); | |
| 371 return type == PseudoEmpty | |
| 372 || type == PseudoFirstChild | |
| 373 || type == PseudoFirstOfType | |
| 374 || type == PseudoLastChild | |
| 375 || type == PseudoLastOfType | |
| 376 || type == PseudoOnlyChild | |
| 377 || type == PseudoOnlyOfType | |
| 378 || type == PseudoNthChild | |
| 379 || type == PseudoNthOfType | |
| 380 || type == PseudoNthLastChild | |
| 381 || type == PseudoNthLastOfType; | |
| 382 } | |
| 383 | |
| 384 inline bool CSSSelector::isASCIILower(const AtomicString& value) | 367 inline bool CSSSelector::isASCIILower(const AtomicString& value) |
| 385 { | 368 { |
| 386 for (size_t i = 0; i < value.length(); ++i) { | 369 for (size_t i = 0; i < value.length(); ++i) { |
| 387 if (isASCIIUpper(value[i])) | 370 if (isASCIIUpper(value[i])) |
| 388 return false; | 371 return false; |
| 389 } | 372 } |
| 390 return true; | 373 return true; |
| 391 } | 374 } |
| 392 | 375 |
| 393 inline void CSSSelector::setValue(const AtomicString& value, bool matchLowerCase
= false) | 376 inline void CSSSelector::setValue(const AtomicString& value, bool matchLowerCase
= false) |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 if (m_hasRareData) | 474 if (m_hasRareData) |
| 492 return m_data.m_rareData->m_serializingValue; | 475 return m_data.m_rareData->m_serializingValue; |
| 493 // AtomicString is really just a StringImpl* so the cast below is safe. | 476 // AtomicString is really just a StringImpl* so the cast below is safe. |
| 494 // FIXME: Perhaps call sites could be changed to accept StringImpl? | 477 // FIXME: Perhaps call sites could be changed to accept StringImpl? |
| 495 return *reinterpret_cast<const AtomicString*>(&m_data.m_value); | 478 return *reinterpret_cast<const AtomicString*>(&m_data.m_value); |
| 496 } | 479 } |
| 497 | 480 |
| 498 } // namespace blink | 481 } // namespace blink |
| 499 | 482 |
| 500 #endif // CSSSelector_h | 483 #endif // CSSSelector_h |
| OLD | NEW |