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

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

Issue 322803004: Make all CSSSelector data members private (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix win dbg build error Created 6 years, 6 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.cpp ('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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 bool isDirectAdjacentSelector() const { return m_relation == DirectAdjac ent; } 285 bool isDirectAdjacentSelector() const { return m_relation == DirectAdjac ent; }
286 bool isSiblingSelector() const; 286 bool isSiblingSelector() const;
287 bool isAttributeSelector() const; 287 bool isAttributeSelector() const;
288 bool isContentPseudoElement() const; 288 bool isContentPseudoElement() const;
289 bool isShadowPseudoElement() const; 289 bool isShadowPseudoElement() const;
290 bool isHostPseudoClass() const; 290 bool isHostPseudoClass() const;
291 291
292 // FIXME: selectors with no tagHistory() get a relation() of Descendant (and sometimes even SubSelector). It should instead be 292 // FIXME: selectors with no tagHistory() get a relation() of Descendant (and sometimes even SubSelector). It should instead be
293 // None. 293 // None.
294 Relation relation() const { return static_cast<Relation>(m_relation); } 294 Relation relation() const { return static_cast<Relation>(m_relation); }
295 void setRelation(Relation relation)
296 {
297 m_relation = relation;
298 ASSERT(static_cast<Relation>(m_relation) == relation); // using a bi tfield.
esprehn 2014/06/12 00:52:19 <3, I've been bitten by this before.
299 }
300
301 Match match() const { return static_cast<Match>(m_match); }
302 void setMatch(Match match)
303 {
304 m_match = match;
305 ASSERT(static_cast<Match>(m_match) == match); // using a bitfield.
306 }
295 307
296 bool isLastInSelectorList() const { return m_isLastInSelectorList; } 308 bool isLastInSelectorList() const { return m_isLastInSelectorList; }
297 void setLastInSelectorList() { m_isLastInSelectorList = true; } 309 void setLastInSelectorList() { m_isLastInSelectorList = true; }
298 bool isLastInTagHistory() const { return m_isLastInTagHistory; } 310 bool isLastInTagHistory() const { return m_isLastInTagHistory; }
299 void setNotLastInTagHistory() { m_isLastInTagHistory = false; } 311 void setNotLastInTagHistory() { m_isLastInTagHistory = false; }
300 312
301 // http://dev.w3.org/csswg/selectors4/#compound 313 // http://dev.w3.org/csswg/selectors4/#compound
302 bool isCompound() const; 314 bool isCompound() const;
303 315
304 bool isForPage() const { return m_isForPage; } 316 bool isForPage() const { return m_isForPage; }
305 void setForPage() { m_isForPage = true; } 317 void setForPage() { m_isForPage = true; }
306 318
307 bool relationIsAffectedByPseudoContent() const { return m_relationIsAffe ctedByPseudoContent; } 319 bool relationIsAffectedByPseudoContent() const { return m_relationIsAffe ctedByPseudoContent; }
308 void setRelationIsAffectedByPseudoContent() { m_relationIsAffectedByPseu doContent = true; } 320 void setRelationIsAffectedByPseudoContent() { m_relationIsAffectedByPseu doContent = true; }
309 321
322 private:
310 unsigned m_relation : 3; // enum Relation 323 unsigned m_relation : 3; // enum Relation
311 mutable unsigned m_match : 4; // enum Match 324 mutable unsigned m_match : 4; // enum Match
312 mutable unsigned m_pseudoType : 8; // PseudoType 325 mutable unsigned m_pseudoType : 8; // PseudoType
313
314 private:
315 mutable unsigned m_parsedNth : 1; // Used for :nth-* 326 mutable unsigned m_parsedNth : 1; // Used for :nth-*
316 unsigned m_isLastInSelectorList : 1; 327 unsigned m_isLastInSelectorList : 1;
317 unsigned m_isLastInTagHistory : 1; 328 unsigned m_isLastInTagHistory : 1;
318 unsigned m_hasRareData : 1; 329 unsigned m_hasRareData : 1;
319 unsigned m_isForPage : 1; 330 unsigned m_isForPage : 1;
320 unsigned m_tagIsForNamespaceRule : 1; 331 unsigned m_tagIsForNamespaceRule : 1;
321 unsigned m_relationIsAffectedByPseudoContent : 1; 332 unsigned m_relationIsAffectedByPseudoContent : 1;
322 333
323 unsigned specificityForOneSelector() const; 334 unsigned specificityForOneSelector() const;
324 unsigned specificityForPage() const; 335 unsigned specificityForPage() const;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 if (m_hasRareData) 518 if (m_hasRareData)
508 return m_data.m_rareData->m_value; 519 return m_data.m_rareData->m_value;
509 // AtomicString is really just a StringImpl* so the cast below is safe. 520 // AtomicString is really just a StringImpl* so the cast below is safe.
510 // FIXME: Perhaps call sites could be changed to accept StringImpl? 521 // FIXME: Perhaps call sites could be changed to accept StringImpl?
511 return *reinterpret_cast<const AtomicString*>(&m_data.m_value); 522 return *reinterpret_cast<const AtomicString*>(&m_data.m_value);
512 } 523 }
513 524
514 } // namespace WebCore 525 } // namespace WebCore
515 526
516 #endif // CSSSelector_h 527 #endif // CSSSelector_h
OLDNEW
« no previous file with comments | « Source/core/css/CSSParserValues.cpp ('k') | Source/core/css/CSSSelector.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698