| 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 | 4 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights |
| 5 * reserved. | 5 * reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 void SetNotLastInTagHistory() { is_last_in_tag_history_ = false; } | 325 void SetNotLastInTagHistory() { is_last_in_tag_history_ = false; } |
| 326 | 326 |
| 327 // http://dev.w3.org/csswg/selectors4/#compound | 327 // http://dev.w3.org/csswg/selectors4/#compound |
| 328 bool IsCompound() const; | 328 bool IsCompound() const; |
| 329 | 329 |
| 330 enum LinkMatchMask { | 330 enum LinkMatchMask { |
| 331 kMatchLink = 1, | 331 kMatchLink = 1, |
| 332 kMatchVisited = 2, | 332 kMatchVisited = 2, |
| 333 kMatchAll = kMatchLink | kMatchVisited | 333 kMatchAll = kMatchLink | kMatchVisited |
| 334 }; | 334 }; |
| 335 unsigned ComputeLinkMatchType() const; | 335 void UpdateLinkMatchType(); |
| 336 unsigned linkMatchType() const { return link_match_type_; } |
| 336 | 337 |
| 337 bool IsForPage() const { return is_for_page_; } | 338 bool IsForPage() const { return is_for_page_; } |
| 338 void SetForPage() { is_for_page_ = true; } | 339 void SetForPage() { is_for_page_ = true; } |
| 339 | 340 |
| 340 bool RelationIsAffectedByPseudoContent() const { | 341 bool RelationIsAffectedByPseudoContent() const { |
| 341 return relation_is_affected_by_pseudo_content_; | 342 return relation_is_affected_by_pseudo_content_; |
| 342 } | 343 } |
| 343 void SetRelationIsAffectedByPseudoContent() { | 344 void SetRelationIsAffectedByPseudoContent() { |
| 344 relation_is_affected_by_pseudo_content_ = true; | 345 relation_is_affected_by_pseudo_content_ = true; |
| 345 } | 346 } |
| 346 | 347 |
| 347 bool MatchesPseudoElement() const; | 348 bool MatchesPseudoElement() const; |
| 348 | 349 |
| 349 bool HasContentPseudo() const; | 350 bool HasContentPseudo() const; |
| 350 bool HasSlottedPseudo() const; | 351 bool HasSlottedPseudo() const; |
| 351 bool HasDeepCombinatorOrShadowPseudo() const; | 352 bool HasDeepCombinatorOrShadowPseudo() const; |
| 352 bool NeedsUpdatedDistribution() const; | 353 bool NeedsUpdatedDistribution() const; |
| 353 | 354 |
| 354 private: | 355 private: |
| 355 unsigned relation_ : 4; // enum RelationType | 356 unsigned relation_ : 4; // enum RelationType |
| 356 unsigned match_ : 4; // enum MatchType | 357 unsigned match_ : 4; // enum MatchType |
| 357 unsigned pseudo_type_ : 8; // enum PseudoType | 358 unsigned pseudo_type_ : 8; // enum PseudoType |
| 358 unsigned is_last_in_selector_list_ : 1; | 359 unsigned is_last_in_selector_list_ : 1; |
| 359 unsigned is_last_in_tag_history_ : 1; | 360 unsigned is_last_in_tag_history_ : 1; |
| 360 unsigned has_rare_data_ : 1; | 361 unsigned has_rare_data_ : 1; |
| 361 unsigned is_for_page_ : 1; | 362 unsigned is_for_page_ : 1; |
| 362 unsigned tag_is_implicit_ : 1; | 363 unsigned tag_is_implicit_ : 1; |
| 363 unsigned relation_is_affected_by_pseudo_content_ : 1; | 364 unsigned relation_is_affected_by_pseudo_content_ : 1; |
| 365 unsigned link_match_type_ : 2; // enum LinkMatchMask |
| 364 | 366 |
| 365 void SetPseudoType(PseudoType pseudo_type) { | 367 void SetPseudoType(PseudoType pseudo_type) { |
| 366 pseudo_type_ = pseudo_type; | 368 pseudo_type_ = pseudo_type; |
| 367 DCHECK_EQ(static_cast<PseudoType>(pseudo_type_), | 369 DCHECK_EQ(static_cast<PseudoType>(pseudo_type_), |
| 368 pseudo_type); // using a bitfield. | 370 pseudo_type); // using a bitfield. |
| 369 } | 371 } |
| 370 | 372 |
| 371 unsigned SpecificityForOneSelector() const; | 373 unsigned SpecificityForOneSelector() const; |
| 372 unsigned SpecificityForPage() const; | 374 unsigned SpecificityForPage() const; |
| 373 const CSSSelector* SerializeCompound(StringBuilder&) const; | 375 const CSSSelector* SerializeCompound(StringBuilder&) const; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 | 456 |
| 455 inline CSSSelector::CSSSelector() | 457 inline CSSSelector::CSSSelector() |
| 456 : relation_(kSubSelector), | 458 : relation_(kSubSelector), |
| 457 match_(kUnknown), | 459 match_(kUnknown), |
| 458 pseudo_type_(kPseudoUnknown), | 460 pseudo_type_(kPseudoUnknown), |
| 459 is_last_in_selector_list_(false), | 461 is_last_in_selector_list_(false), |
| 460 is_last_in_tag_history_(true), | 462 is_last_in_tag_history_(true), |
| 461 has_rare_data_(false), | 463 has_rare_data_(false), |
| 462 is_for_page_(false), | 464 is_for_page_(false), |
| 463 tag_is_implicit_(false), | 465 tag_is_implicit_(false), |
| 464 relation_is_affected_by_pseudo_content_(false) {} | 466 relation_is_affected_by_pseudo_content_(false), |
| 467 link_match_type_(kMatchAll) {} |
| 465 | 468 |
| 466 inline CSSSelector::CSSSelector(const QualifiedName& tag_q_name, | 469 inline CSSSelector::CSSSelector(const QualifiedName& tag_q_name, |
| 467 bool tag_is_implicit) | 470 bool tag_is_implicit) |
| 468 : relation_(kSubSelector), | 471 : relation_(kSubSelector), |
| 469 match_(kTag), | 472 match_(kTag), |
| 470 pseudo_type_(kPseudoUnknown), | 473 pseudo_type_(kPseudoUnknown), |
| 471 is_last_in_selector_list_(false), | 474 is_last_in_selector_list_(false), |
| 472 is_last_in_tag_history_(true), | 475 is_last_in_tag_history_(true), |
| 473 has_rare_data_(false), | 476 has_rare_data_(false), |
| 474 is_for_page_(false), | 477 is_for_page_(false), |
| 475 tag_is_implicit_(tag_is_implicit), | 478 tag_is_implicit_(tag_is_implicit), |
| 476 relation_is_affected_by_pseudo_content_(false) { | 479 relation_is_affected_by_pseudo_content_(false), |
| 480 link_match_type_(kMatchAll) { |
| 477 data_.tag_q_name_ = tag_q_name.Impl(); | 481 data_.tag_q_name_ = tag_q_name.Impl(); |
| 478 data_.tag_q_name_->Ref(); | 482 data_.tag_q_name_->Ref(); |
| 479 } | 483 } |
| 480 | 484 |
| 481 inline CSSSelector::CSSSelector(const CSSSelector& o) | 485 inline CSSSelector::CSSSelector(const CSSSelector& o) |
| 482 : relation_(o.relation_), | 486 : relation_(o.relation_), |
| 483 match_(o.match_), | 487 match_(o.match_), |
| 484 pseudo_type_(o.pseudo_type_), | 488 pseudo_type_(o.pseudo_type_), |
| 485 is_last_in_selector_list_(o.is_last_in_selector_list_), | 489 is_last_in_selector_list_(o.is_last_in_selector_list_), |
| 486 is_last_in_tag_history_(o.is_last_in_tag_history_), | 490 is_last_in_tag_history_(o.is_last_in_tag_history_), |
| 487 has_rare_data_(o.has_rare_data_), | 491 has_rare_data_(o.has_rare_data_), |
| 488 is_for_page_(o.is_for_page_), | 492 is_for_page_(o.is_for_page_), |
| 489 tag_is_implicit_(o.tag_is_implicit_), | 493 tag_is_implicit_(o.tag_is_implicit_), |
| 490 relation_is_affected_by_pseudo_content_( | 494 relation_is_affected_by_pseudo_content_( |
| 491 o.relation_is_affected_by_pseudo_content_) { | 495 o.relation_is_affected_by_pseudo_content_), |
| 496 link_match_type_(kMatchAll) { |
| 492 if (o.match_ == kTag) { | 497 if (o.match_ == kTag) { |
| 493 data_.tag_q_name_ = o.data_.tag_q_name_; | 498 data_.tag_q_name_ = o.data_.tag_q_name_; |
| 494 data_.tag_q_name_->Ref(); | 499 data_.tag_q_name_->Ref(); |
| 495 } else if (o.has_rare_data_) { | 500 } else if (o.has_rare_data_) { |
| 496 data_.rare_data_ = o.data_.rare_data_; | 501 data_.rare_data_ = o.data_.rare_data_; |
| 497 data_.rare_data_->Ref(); | 502 data_.rare_data_->Ref(); |
| 498 } else if (o.data_.value_) { | 503 } else if (o.data_.value_) { |
| 499 data_.value_ = o.data_.value_; | 504 data_.value_ = o.data_.value_; |
| 500 data_.value_->Ref(); | 505 data_.value_->Ref(); |
| 501 } | 506 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 } | 545 } |
| 541 | 546 |
| 542 inline bool CSSSelector::IsIdClassOrAttributeSelector() const { | 547 inline bool CSSSelector::IsIdClassOrAttributeSelector() const { |
| 543 return IsAttributeSelector() || Match() == CSSSelector::kId || | 548 return IsAttributeSelector() || Match() == CSSSelector::kId || |
| 544 Match() == CSSSelector::kClass; | 549 Match() == CSSSelector::kClass; |
| 545 } | 550 } |
| 546 | 551 |
| 547 } // namespace blink | 552 } // namespace blink |
| 548 | 553 |
| 549 #endif // CSSSelector_h | 554 #endif // CSSSelector_h |
| OLD | NEW |