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

Side by Side Diff: Source/core/css/parser/CSSParserValues.cpp

Issue 1094213002: Refactored compound selector parsing methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addresses review issues Created 5 years, 8 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
« no previous file with comments | « Source/core/css/parser/CSSParserValues.h ('k') | Source/core/css/parser/CSSSelectorParser.h » ('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) 2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 for (unsigned i = 0; i < valueList.size(); ++i) 276 for (unsigned i = 0; i < valueList.size(); ++i)
277 m_values.append(*(valueList.valueAt(i))); 277 m_values.append(*(valueList.valueAt(i)));
278 valueList.clearAndLeakValues(); 278 valueList.clearAndLeakValues();
279 } 279 }
280 280
281 CSSParserSelector::CSSParserSelector() 281 CSSParserSelector::CSSParserSelector()
282 : m_selector(adoptPtr(new CSSSelector())) 282 : m_selector(adoptPtr(new CSSSelector()))
283 { 283 {
284 } 284 }
285 285
286 CSSParserSelector::CSSParserSelector(const QualifiedName& tagQName) 286 CSSParserSelector::CSSParserSelector(const QualifiedName& tagQName, bool isImpli cit)
287 : m_selector(adoptPtr(new CSSSelector(tagQName))) 287 : m_selector(adoptPtr(new CSSSelector(tagQName, isImplicit)))
288 { 288 {
289 } 289 }
290 290
291 CSSParserSelector::~CSSParserSelector() 291 CSSParserSelector::~CSSParserSelector()
292 { 292 {
293 if (!m_tagHistory) 293 if (!m_tagHistory)
294 return; 294 return;
295 Vector<OwnPtr<CSSParserSelector>, 16> toDelete; 295 Vector<OwnPtr<CSSParserSelector>, 16> toDelete;
296 OwnPtr<CSSParserSelector> selector = m_tagHistory.release(); 296 OwnPtr<CSSParserSelector> selector = m_tagHistory.release();
297 while (true) { 297 while (true) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 346
347 void CSSParserSelector::appendTagHistory(CSSSelector::Relation relation, PassOwn Ptr<CSSParserSelector> selector) 347 void CSSParserSelector::appendTagHistory(CSSSelector::Relation relation, PassOwn Ptr<CSSParserSelector> selector)
348 { 348 {
349 CSSParserSelector* end = this; 349 CSSParserSelector* end = this;
350 while (end->tagHistory()) 350 while (end->tagHistory())
351 end = end->tagHistory(); 351 end = end->tagHistory();
352 end->setRelation(relation); 352 end->setRelation(relation);
353 end->setTagHistory(selector); 353 end->setTagHistory(selector);
354 } 354 }
355 355
356 void CSSParserSelector::prependTagSelector(const QualifiedName& tagQName, bool t agIsForNamespaceRule) 356 void CSSParserSelector::prependTagSelector(const QualifiedName& tagQName, bool i sImplicit)
357 { 357 {
358 OwnPtr<CSSParserSelector> second = adoptPtr(new CSSParserSelector); 358 OwnPtr<CSSParserSelector> second = CSSParserSelector::create();
359 second->m_selector = m_selector.release(); 359 second->m_selector = m_selector.release();
360 second->m_tagHistory = m_tagHistory.release(); 360 second->m_tagHistory = m_tagHistory.release();
361 m_tagHistory = second.release(); 361 m_tagHistory = second.release();
362 m_selector = adoptPtr(new CSSSelector(tagQName, tagIsForNamespaceRule)); 362 m_selector = adoptPtr(new CSSSelector(tagQName, isImplicit));
363 } 363 }
364 364
365 bool CSSParserSelector::hasHostPseudoSelector() const 365 bool CSSParserSelector::hasHostPseudoSelector() const
366 { 366 {
367 for (CSSParserSelector* selector = const_cast<CSSParserSelector*>(this); sel ector; selector = selector->tagHistory()) { 367 for (CSSParserSelector* selector = const_cast<CSSParserSelector*>(this); sel ector; selector = selector->tagHistory()) {
368 if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseud oType() == CSSSelector::PseudoHostContext) 368 if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseud oType() == CSSSelector::PseudoHostContext)
369 return true; 369 return true;
370 } 370 }
371 return false; 371 return false;
372 } 372 }
373 373
374 } // namespace blink 374 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSParserValues.h ('k') | Source/core/css/parser/CSSSelectorParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698