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

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

Issue 210713002: Implement ::shadow pseudo element and replace /shadow/ with ::shadow. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed patch conflict Created 6 years, 9 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/CSSParserValues.h ('k') | Source/core/css/CSSSelector.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 * 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 End, // css3: E[foo$="bar"] 121 End, // css3: E[foo$="bar"]
122 PagePseudoClass // ?? 122 PagePseudoClass // ??
123 }; 123 };
124 124
125 enum Relation { 125 enum Relation {
126 Descendant = 0, // "Space" combinator 126 Descendant = 0, // "Space" combinator
127 Child, // > combinator 127 Child, // > combinator
128 DirectAdjacent, // + combinator 128 DirectAdjacent, // + combinator
129 IndirectAdjacent, // ~ combinator 129 IndirectAdjacent, // ~ combinator
130 SubSelector, // "No space" combinator 130 SubSelector, // "No space" combinator
131 ShadowPseudo, // Special case of shadow DOM pseudo elements 131 ShadowPseudo, // Special case of shadow DOM pseudo elements / shadow pseudo element
132 // FIXME: implement named combinator (i.e. named relation) and 132 ShadowDeep // /shadow-deep/ combinator
133 // replace the following /shadow/ and /shadow-deep/ with the impleme ntation.
134 Shadow, // /shadow/ combinator
135 ShadowDeep, // /shadow-deep/ combinator
136 }; 133 };
137 134
138 enum PseudoType { 135 enum PseudoType {
139 PseudoNotParsed = 0, 136 PseudoNotParsed = 0,
140 PseudoUnknown, 137 PseudoUnknown,
141 PseudoEmpty, 138 PseudoEmpty,
142 PseudoFirstChild, 139 PseudoFirstChild,
143 PseudoFirstOfType, 140 PseudoFirstOfType,
144 PseudoLastChild, 141 PseudoLastChild,
145 PseudoLastOfType, 142 PseudoLastOfType,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 PseudoInRange, 207 PseudoInRange,
211 PseudoOutOfRange, 208 PseudoOutOfRange,
212 PseudoUserAgentCustomElement, 209 PseudoUserAgentCustomElement,
213 PseudoWebKitCustomElement, 210 PseudoWebKitCustomElement,
214 PseudoCue, 211 PseudoCue,
215 PseudoFutureCue, 212 PseudoFutureCue,
216 PseudoPastCue, 213 PseudoPastCue,
217 PseudoUnresolved, 214 PseudoUnresolved,
218 PseudoContent, 215 PseudoContent,
219 PseudoHost, 216 PseudoHost,
220 PseudoHostContext 217 PseudoHostContext,
218 PseudoShadow
221 }; 219 };
222 220
223 enum MarginBoxType { 221 enum MarginBoxType {
224 TopLeftCornerMarginBox, 222 TopLeftCornerMarginBox,
225 TopLeftMarginBox, 223 TopLeftMarginBox,
226 TopCenterMarginBox, 224 TopCenterMarginBox,
227 TopRightMarginBox, 225 TopRightMarginBox,
228 TopRightCornerMarginBox, 226 TopRightCornerMarginBox,
229 BottomLeftCornerMarginBox, 227 BottomLeftCornerMarginBox,
230 BottomLeftMarginBox, 228 BottomLeftMarginBox,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 bool parseNth() const; 278 bool parseNth() const;
281 bool matchNth(int count) const; 279 bool matchNth(int count) const;
282 280
283 bool matchesPseudoElement() const; 281 bool matchesPseudoElement() const;
284 bool isUnknownPseudoElement() const; 282 bool isUnknownPseudoElement() const;
285 bool isCustomPseudoElement() const; 283 bool isCustomPseudoElement() const;
286 bool isDirectAdjacentSelector() const { return m_relation == DirectAdjac ent; } 284 bool isDirectAdjacentSelector() const { return m_relation == DirectAdjac ent; }
287 bool isSiblingSelector() const; 285 bool isSiblingSelector() const;
288 bool isAttributeSelector() const; 286 bool isAttributeSelector() const;
289 bool isContentPseudoElement() const; 287 bool isContentPseudoElement() const;
288 bool isShadowPseudoElement() const;
290 bool isHostPseudoClass() const; 289 bool isHostPseudoClass() const;
291 290
292 // FIXME: selectors with no tagHistory() get a relation() of Descendant. It should instead be 291 // FIXME: selectors with no tagHistory() get a relation() of Descendant. It should instead be
293 // None. 292 // None.
294 Relation relation() const { return static_cast<Relation>(m_relation); } 293 Relation relation() const { return static_cast<Relation>(m_relation); }
295 294
296 bool isLastInSelectorList() const { return m_isLastInSelectorList; } 295 bool isLastInSelectorList() const { return m_isLastInSelectorList; }
297 void setLastInSelectorList() { m_isLastInSelectorList = true; } 296 void setLastInSelectorList() { m_isLastInSelectorList = true; }
298 bool isLastInTagHistory() const { return m_isLastInTagHistory; } 297 bool isLastInTagHistory() const { return m_isLastInTagHistory; }
299 void setNotLastInTagHistory() { m_isLastInTagHistory = false; } 298 void setNotLastInTagHistory() { m_isLastInTagHistory = false; }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 || m_match == CSSSelector::Contain 409 || m_match == CSSSelector::Contain
411 || m_match == CSSSelector::Begin 410 || m_match == CSSSelector::Begin
412 || m_match == CSSSelector::End; 411 || m_match == CSSSelector::End;
413 } 412 }
414 413
415 inline bool CSSSelector::isContentPseudoElement() const 414 inline bool CSSSelector::isContentPseudoElement() const
416 { 415 {
417 return m_match == PseudoElement && pseudoType() == PseudoContent; 416 return m_match == PseudoElement && pseudoType() == PseudoContent;
418 } 417 }
419 418
419 inline bool CSSSelector::isShadowPseudoElement() const
420 {
421 return m_match == PseudoElement && pseudoType() == PseudoShadow;
422 }
423
420 inline void CSSSelector::setValue(const AtomicString& value) 424 inline void CSSSelector::setValue(const AtomicString& value)
421 { 425 {
422 ASSERT(m_match != Tag); 426 ASSERT(m_match != Tag);
423 ASSERT(m_pseudoType == PseudoNotParsed); 427 ASSERT(m_pseudoType == PseudoNotParsed);
424 // Need to do ref counting manually for the union. 428 // Need to do ref counting manually for the union.
425 if (m_hasRareData) { 429 if (m_hasRareData) {
426 m_data.m_rareData->m_value = value; 430 m_data.m_rareData->m_value = value;
427 return; 431 return;
428 } 432 }
429 if (m_data.m_value) 433 if (m_data.m_value)
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 if (m_hasRareData) 512 if (m_hasRareData)
509 return m_data.m_rareData->m_value; 513 return m_data.m_rareData->m_value;
510 // AtomicString is really just a StringImpl* so the cast below is safe. 514 // AtomicString is really just a StringImpl* so the cast below is safe.
511 // FIXME: Perhaps call sites could be changed to accept StringImpl? 515 // FIXME: Perhaps call sites could be changed to accept StringImpl?
512 return *reinterpret_cast<const AtomicString*>(&m_data.m_value); 516 return *reinterpret_cast<const AtomicString*>(&m_data.m_value);
513 } 517 }
514 518
515 } // namespace WebCore 519 } // namespace WebCore
516 520
517 #endif // CSSSelector_h 521 #endif // CSSSelector_h
OLDNEW
« no previous file with comments | « Source/core/css/CSSParserValues.h ('k') | Source/core/css/CSSSelector.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698