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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 void setArgument(const AtomicString&); | 283 void setArgument(const AtomicString&); |
284 void setSelectorList(PassOwnPtr<CSSSelectorList>); | 284 void setSelectorList(PassOwnPtr<CSSSelectorList>); |
285 void setMatchUserAgentOnly(); | 285 void setMatchUserAgentOnly(); |
286 | 286 |
287 bool parseNth() const; | 287 bool parseNth() const; |
288 bool matchNth(int count) const; | 288 bool matchNth(int count) const; |
289 | 289 |
290 bool matchesPseudoElement() const; | 290 bool matchesPseudoElement() const; |
291 bool isCustomPseudoElement() const; | 291 bool isCustomPseudoElement() const; |
292 bool isDirectAdjacentSelector() const { return m_relation == DirectAdjac
ent; } | 292 bool isDirectAdjacentSelector() const { return m_relation == DirectAdjac
ent; } |
| 293 bool isAdjacentSelector() const { return m_relation == DirectAdjacent ||
m_relation == IndirectAdjacent; } |
293 bool isSiblingSelector() const; | 294 bool isSiblingSelector() const; |
294 bool isAttributeSelector() const; | 295 bool isAttributeSelector() const; |
295 bool isContentPseudoElement() const; | 296 bool isContentPseudoElement() const; |
296 bool isShadowPseudoElement() const; | 297 bool isShadowPseudoElement() const; |
297 bool isHostPseudoClass() const; | 298 bool isHostPseudoClass() const; |
298 | 299 bool isShadowSelector() const { return m_relation == ShadowPseudo || m_r
elation == ShadowDeep; } |
| 300 bool isTreeBoundaryCrossing() const; |
| 301 bool isInsertionPointCrossing() const; |
299 // FIXME: selectors with no tagHistory() get a relation() of Descendant
(and sometimes even SubSelector). It should instead be | 302 // FIXME: selectors with no tagHistory() get a relation() of Descendant
(and sometimes even SubSelector). It should instead be |
300 // None. | 303 // None. |
301 Relation relation() const { return static_cast<Relation>(m_relation); } | 304 Relation relation() const { return static_cast<Relation>(m_relation); } |
302 void setRelation(Relation relation) | 305 void setRelation(Relation relation) |
303 { | 306 { |
304 m_relation = relation; | 307 m_relation = relation; |
305 ASSERT(static_cast<Relation>(m_relation) == relation); // using a bi
tfield. | 308 ASSERT(static_cast<Relation>(m_relation) == relation); // using a bi
tfield. |
306 } | 309 } |
307 | 310 |
308 Match match() const { return static_cast<Match>(m_match); } | 311 Match match() const { return static_cast<Match>(m_match); } |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 inline bool CSSSelector::isContentPseudoElement() const | 441 inline bool CSSSelector::isContentPseudoElement() const |
439 { | 442 { |
440 return m_match == PseudoElement && pseudoType() == PseudoContent; | 443 return m_match == PseudoElement && pseudoType() == PseudoContent; |
441 } | 444 } |
442 | 445 |
443 inline bool CSSSelector::isShadowPseudoElement() const | 446 inline bool CSSSelector::isShadowPseudoElement() const |
444 { | 447 { |
445 return m_match == PseudoElement && pseudoType() == PseudoShadow; | 448 return m_match == PseudoElement && pseudoType() == PseudoShadow; |
446 } | 449 } |
447 | 450 |
| 451 inline bool CSSSelector::isTreeBoundaryCrossing() const |
| 452 { |
| 453 return m_match == PseudoClass && (pseudoType() == PseudoHost || pseudoType()
== PseudoHostContext); |
| 454 } |
| 455 |
| 456 inline bool CSSSelector::isInsertionPointCrossing() const |
| 457 { |
| 458 return (m_match == PseudoClass && pseudoType() == PseudoHostContext) |
| 459 || (m_match == PseudoElement && pseudoType() == PseudoContent); |
| 460 } |
| 461 |
448 inline void CSSSelector::setValue(const AtomicString& value) | 462 inline void CSSSelector::setValue(const AtomicString& value) |
449 { | 463 { |
450 ASSERT(m_match != Tag); | 464 ASSERT(m_match != Tag); |
451 ASSERT(m_pseudoType == PseudoNotParsed); | 465 ASSERT(m_pseudoType == PseudoNotParsed); |
452 // Need to do ref counting manually for the union. | 466 // Need to do ref counting manually for the union. |
453 if (m_hasRareData) { | 467 if (m_hasRareData) { |
454 m_data.m_rareData->m_value = value; | 468 m_data.m_rareData->m_value = value; |
455 return; | 469 return; |
456 } | 470 } |
457 if (m_data.m_value) | 471 if (m_data.m_value) |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 if (m_hasRareData) | 550 if (m_hasRareData) |
537 return m_data.m_rareData->m_value; | 551 return m_data.m_rareData->m_value; |
538 // AtomicString is really just a StringImpl* so the cast below is safe. | 552 // AtomicString is really just a StringImpl* so the cast below is safe. |
539 // FIXME: Perhaps call sites could be changed to accept StringImpl? | 553 // FIXME: Perhaps call sites could be changed to accept StringImpl? |
540 return *reinterpret_cast<const AtomicString*>(&m_data.m_value); | 554 return *reinterpret_cast<const AtomicString*>(&m_data.m_value); |
541 } | 555 } |
542 | 556 |
543 } // namespace blink | 557 } // namespace blink |
544 | 558 |
545 #endif // CSSSelector_h | 559 #endif // CSSSelector_h |
OLD | NEW |