Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: Source/core/css/CSSSelector.cpp

Issue 15657003: Make a '::distributed' pseudo element the first-ever client who can accept a relative selector. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Introduce m_relationIsForShadowDistributed Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/css/CSSSelector.h ('k') | Source/core/css/CSSSelectorList.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 * 2001 Andreas Schlapbach (schlpbch@iam.unibe.ch) 4 * 2001 Andreas Schlapbach (schlpbch@iam.unibe.ch)
5 * 2001-2003 Dirk Mueller (mueller@kde.org) 5 * 2001-2003 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2002, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2002, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2008 David Smith (catfish.man@gmail.com) 7 * Copyright (C) 2008 David Smith (catfish.man@gmail.com)
8 * Copyright (C) 2010 Google Inc. All rights reserved. 8 * Copyright (C) 2010 Google Inc. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 } 677 }
678 } 678 }
679 if (cs->relation() != CSSSelector::SubSelector || !cs->tagHistory()) 679 if (cs->relation() != CSSSelector::SubSelector || !cs->tagHistory())
680 break; 680 break;
681 cs = cs->tagHistory(); 681 cs = cs->tagHistory();
682 } 682 }
683 683
684 if (const CSSSelector* tagHistory = cs->tagHistory()) { 684 if (const CSSSelector* tagHistory = cs->tagHistory()) {
685 switch (cs->relation()) { 685 switch (cs->relation()) {
686 case CSSSelector::Descendant: 686 case CSSSelector::Descendant:
687 if (cs->relationIsForShadowDistributed())
688 return tagHistory->selectorText("::-webkit-distributed(" + str.t oString() + rightSide + ")");
687 return tagHistory->selectorText(" " + str.toString() + rightSide); 689 return tagHistory->selectorText(" " + str.toString() + rightSide);
688 case CSSSelector::Child: 690 case CSSSelector::Child:
691 if (cs->relationIsForShadowDistributed())
692 return tagHistory->selectorText("::-webkit-distributed(> " + str .toString() + rightSide + ")");
689 return tagHistory->selectorText(" > " + str.toString() + rightSide); 693 return tagHistory->selectorText(" > " + str.toString() + rightSide);
690 case CSSSelector::DirectAdjacent: 694 case CSSSelector::DirectAdjacent:
691 return tagHistory->selectorText(" + " + str.toString() + rightSide); 695 return tagHistory->selectorText(" + " + str.toString() + rightSide);
692 case CSSSelector::IndirectAdjacent: 696 case CSSSelector::IndirectAdjacent:
693 return tagHistory->selectorText(" ~ " + str.toString() + rightSide); 697 return tagHistory->selectorText(" ~ " + str.toString() + rightSide);
694 case CSSSelector::SubSelector: 698 case CSSSelector::SubSelector:
695 ASSERT_NOT_REACHED(); 699 ASSERT_NOT_REACHED();
696 case CSSSelector::ShadowPseudo: 700 case CSSSelector::ShadowPseudo:
697 return tagHistory->selectorText(str.toString() + rightSide); 701 return tagHistory->selectorText(str.toString() + rightSide);
698 case CSSSelector::ShadowDistributed:
699 return tagHistory->selectorText("::-webkit-distributed(" + str.toStr ing() + rightSide + ")");
700 } 702 }
701 } 703 }
702 return str.toString() + rightSide; 704 return str.toString() + rightSide;
703 } 705 }
704 706
705 void CSSSelector::setAttribute(const QualifiedName& value) 707 void CSSSelector::setAttribute(const QualifiedName& value)
706 { 708 {
707 createRareData(); 709 createRareData();
708 m_data.m_rareData->m_attribute = value; 710 m_data.m_rareData->m_attribute = value;
709 } 711 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 return false; 806 return false;
805 return (count - m_b) % m_a == 0; 807 return (count - m_b) % m_a == 0;
806 } else { 808 } else {
807 if (count > m_b) 809 if (count > m_b)
808 return false; 810 return false;
809 return (m_b - count) % (-m_a) == 0; 811 return (m_b - count) % (-m_a) == 0;
810 } 812 }
811 } 813 }
812 814
813 } // namespace WebCore 815 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/CSSSelector.h ('k') | Source/core/css/CSSSelectorList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698