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

Side by Side Diff: Source/core/css/parser/BisonCSSParser-in.cpp

Issue 170283019: Change various helper classes to transition types to get CSSValue entirely onto the gc heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed incorrect persistent found by the clang oilpan plugin 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. 9 * Copyright (C) 2012 Intel Corporation. All rights reserved.
10 * 10 *
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 declaration->addParsedProperties(m_parsedProperties); 1282 declaration->addParsedProperties(m_parsedProperties);
1283 clearProperties(); 1283 clearProperties();
1284 } 1284 }
1285 1285
1286 if (m_observer) 1286 if (m_observer)
1287 m_observer->endRuleBody(string.length(), false); 1287 m_observer->endRuleBody(string.length(), false);
1288 1288
1289 return ok; 1289 return ok;
1290 } 1290 }
1291 1291
1292 PassRefPtr<MediaQuerySet> BisonCSSParser::parseMediaQueryList(const String& stri ng) 1292 PassRefPtrWillBeRawPtr<MediaQuerySet> BisonCSSParser::parseMediaQueryList(const String& string)
1293 { 1293 {
1294 ASSERT(!m_mediaList); 1294 ASSERT(!m_mediaList);
1295 1295
1296 // can't use { because tokenizer state switches from mediaquery to initial s tate when it sees { token. 1296 // can't use { because tokenizer state switches from mediaquery to initial s tate when it sees { token.
1297 // instead insert one " " (which is caught by maybe_space in CSSGrammar.y) 1297 // instead insert one " " (which is caught by maybe_space in CSSGrammar.y)
1298 setupParser("@-internal-medialist ", string, ""); 1298 setupParser("@-internal-medialist ", string, "");
1299 cssyyparse(this); 1299 cssyyparse(this);
1300 1300
1301 ASSERT(m_mediaList); 1301 ASSERT(m_mediaList);
1302 return m_mediaList.release(); 1302 return m_mediaList.release();
(...skipping 8077 matching lines...) Expand 10 before | Expand all | Expand 10 after
9380 } 9380 }
9381 return value; 9381 return value;
9382 } 9382 }
9383 9383
9384 MediaQueryExp* BisonCSSParser::createFloatingMediaQueryExp(const AtomicString& m ediaFeature, CSSParserValueList* values) 9384 MediaQueryExp* BisonCSSParser::createFloatingMediaQueryExp(const AtomicString& m ediaFeature, CSSParserValueList* values)
9385 { 9385 {
9386 m_floatingMediaQueryExp = MediaQueryExp::create(mediaFeature, values); 9386 m_floatingMediaQueryExp = MediaQueryExp::create(mediaFeature, values);
9387 return m_floatingMediaQueryExp.get(); 9387 return m_floatingMediaQueryExp.get();
9388 } 9388 }
9389 9389
9390 PassOwnPtr<MediaQueryExp> BisonCSSParser::sinkFloatingMediaQueryExp(MediaQueryEx p* expression) 9390 PassOwnPtrWillBeRawPtr<MediaQueryExp> BisonCSSParser::sinkFloatingMediaQueryExp( MediaQueryExp* expression)
9391 { 9391 {
9392 ASSERT_UNUSED(expression, expression == m_floatingMediaQueryExp); 9392 ASSERT_UNUSED(expression, expression == m_floatingMediaQueryExp);
9393 return m_floatingMediaQueryExp.release(); 9393 return m_floatingMediaQueryExp.release();
9394 } 9394 }
9395 9395
9396 Vector<OwnPtr<MediaQueryExp> >* BisonCSSParser::createFloatingMediaQueryExpList( ) 9396 WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp> >* BisonCSSParser::createFloa tingMediaQueryExpList()
9397 { 9397 {
9398 m_floatingMediaQueryExpList = adoptPtr(new Vector<OwnPtr<MediaQueryExp> >); 9398 m_floatingMediaQueryExpList = adoptPtrWillBeNoop(new WillBeHeapVector<OwnPtr WillBeMember<MediaQueryExp> >);
9399 return m_floatingMediaQueryExpList.get(); 9399 return m_floatingMediaQueryExpList.get();
9400 } 9400 }
9401 9401
9402 PassOwnPtr<Vector<OwnPtr<MediaQueryExp> > > BisonCSSParser::sinkFloatingMediaQue ryExpList(Vector<OwnPtr<MediaQueryExp> >* list) 9402 PassOwnPtrWillBeRawPtr<WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp> > > Bi sonCSSParser::sinkFloatingMediaQueryExpList(WillBeHeapVector<OwnPtrWillBeMember< MediaQueryExp> >* list)
9403 { 9403 {
9404 ASSERT_UNUSED(list, list == m_floatingMediaQueryExpList); 9404 ASSERT_UNUSED(list, list == m_floatingMediaQueryExpList);
9405 return m_floatingMediaQueryExpList.release(); 9405 return m_floatingMediaQueryExpList.release();
9406 } 9406 }
9407 9407
9408 MediaQuery* BisonCSSParser::createFloatingMediaQuery(MediaQuery::Restrictor rest rictor, const AtomicString& mediaType, PassOwnPtr<Vector<OwnPtr<MediaQueryExp> > > expressions) 9408 MediaQuery* BisonCSSParser::createFloatingMediaQuery(MediaQuery::Restrictor rest rictor, const AtomicString& mediaType, PassOwnPtrWillBeRawPtr<WillBeHeapVector<O wnPtrWillBeMember<MediaQueryExp> > > expressions)
9409 { 9409 {
9410 m_floatingMediaQuery = adoptPtr(new MediaQuery(restrictor, mediaType, expres sions)); 9410 m_floatingMediaQuery = adoptPtrWillBeNoop(new MediaQuery(restrictor, mediaTy pe, expressions));
9411 return m_floatingMediaQuery.get(); 9411 return m_floatingMediaQuery.get();
9412 } 9412 }
9413 9413
9414 MediaQuery* BisonCSSParser::createFloatingMediaQuery(PassOwnPtr<Vector<OwnPtr<Me diaQueryExp> > > expressions) 9414 MediaQuery* BisonCSSParser::createFloatingMediaQuery(PassOwnPtrWillBeRawPtr<Will BeHeapVector<OwnPtrWillBeMember<MediaQueryExp> > > expressions)
9415 { 9415 {
9416 return createFloatingMediaQuery(MediaQuery::None, AtomicString("all", Atomic String::ConstructFromLiteral), expressions); 9416 return createFloatingMediaQuery(MediaQuery::None, AtomicString("all", Atomic String::ConstructFromLiteral), expressions);
9417 } 9417 }
9418 9418
9419 MediaQuery* BisonCSSParser::createFloatingNotAllQuery() 9419 MediaQuery* BisonCSSParser::createFloatingNotAllQuery()
9420 { 9420 {
9421 return createFloatingMediaQuery(MediaQuery::Not, AtomicString("all", AtomicS tring::ConstructFromLiteral), sinkFloatingMediaQueryExpList(createFloatingMediaQ ueryExpList())); 9421 return createFloatingMediaQuery(MediaQuery::Not, AtomicString("all", AtomicS tring::ConstructFromLiteral), sinkFloatingMediaQueryExpList(createFloatingMediaQ ueryExpList()));
9422 } 9422 }
9423 9423
9424 PassOwnPtr<MediaQuery> BisonCSSParser::sinkFloatingMediaQuery(MediaQuery* query) 9424 PassOwnPtrWillBeRawPtr<MediaQuery> BisonCSSParser::sinkFloatingMediaQuery(MediaQ uery* query)
9425 { 9425 {
9426 ASSERT_UNUSED(query, query == m_floatingMediaQuery); 9426 ASSERT_UNUSED(query, query == m_floatingMediaQuery);
9427 return m_floatingMediaQuery.release(); 9427 return m_floatingMediaQuery.release();
9428 } 9428 }
9429 9429
9430 Vector<RefPtr<StyleKeyframe> >* BisonCSSParser::createFloatingKeyframeVector() 9430 Vector<RefPtr<StyleKeyframe> >* BisonCSSParser::createFloatingKeyframeVector()
9431 { 9431 {
9432 m_floatingKeyframeVector = adoptPtr(new Vector<RefPtr<StyleKeyframe> >()); 9432 m_floatingKeyframeVector = adoptPtr(new Vector<RefPtr<StyleKeyframe> >());
9433 return m_floatingKeyframeVector.get(); 9433 return m_floatingKeyframeVector.get();
9434 } 9434 }
9435 9435
9436 PassOwnPtr<Vector<RefPtr<StyleKeyframe> > > BisonCSSParser::sinkFloatingKeyframe Vector(Vector<RefPtr<StyleKeyframe> >* keyframeVector) 9436 PassOwnPtr<Vector<RefPtr<StyleKeyframe> > > BisonCSSParser::sinkFloatingKeyframe Vector(Vector<RefPtr<StyleKeyframe> >* keyframeVector)
9437 { 9437 {
9438 ASSERT_UNUSED(keyframeVector, m_floatingKeyframeVector == keyframeVector); 9438 ASSERT_UNUSED(keyframeVector, m_floatingKeyframeVector == keyframeVector);
9439 return m_floatingKeyframeVector.release(); 9439 return m_floatingKeyframeVector.release();
9440 } 9440 }
9441 9441
9442 MediaQuerySet* BisonCSSParser::createMediaQuerySet() 9442 MediaQuerySet* BisonCSSParser::createMediaQuerySet()
9443 { 9443 {
9444 RefPtr<MediaQuerySet> queries = MediaQuerySet::create(); 9444 RefPtrWillBeRawPtr<MediaQuerySet> queries = MediaQuerySet::create();
9445 MediaQuerySet* result = queries.get(); 9445 MediaQuerySet* result = queries.get();
9446 m_parsedMediaQuerySets.append(queries.release()); 9446 m_parsedMediaQuerySets.append(queries.release());
9447 return result; 9447 return result;
9448 } 9448 }
9449 9449
9450 StyleRuleBase* BisonCSSParser::createImportRule(const CSSParserString& url, Medi aQuerySet* media) 9450 StyleRuleBase* BisonCSSParser::createImportRule(const CSSParserString& url, Medi aQuerySet* media)
9451 { 9451 {
9452 if (!media || !m_allowImportRules) 9452 if (!media || !m_allowImportRules)
9453 return 0; 9453 return 0;
9454 RefPtrWillBeRawPtr<StyleRuleImport> rule = StyleRuleImport::create(url, medi a); 9454 RefPtrWillBeRawPtr<StyleRuleImport> rule = StyleRuleImport::create(url, medi a);
9455 StyleRuleImport* result = rule.get(); 9455 StyleRuleImport* result = rule.get();
9456 m_parsedRules.append(rule.release()); 9456 m_parsedRules.append(rule.release());
9457 return result; 9457 return result;
9458 } 9458 }
9459 9459
9460 StyleRuleBase* BisonCSSParser::createMediaRule(MediaQuerySet* media, RuleList* r ules) 9460 StyleRuleBase* BisonCSSParser::createMediaRule(MediaQuerySet* media, RuleList* r ules)
9461 { 9461 {
9462 m_allowImportRules = m_allowNamespaceDeclarations = false; 9462 m_allowImportRules = m_allowNamespaceDeclarations = false;
9463 RefPtrWillBeRawPtr<StyleRuleMedia> rule; 9463 RefPtrWillBeRawPtr<StyleRuleMedia> rule;
9464 if (rules) { 9464 if (rules) {
9465 rule = StyleRuleMedia::create(media ? media : MediaQuerySet::create(), * rules); 9465 rule = StyleRuleMedia::create(media ? media : MediaQuerySet::create().ge t(), *rules);
9466 } else { 9466 } else {
9467 RuleList emptyRules; 9467 RuleList emptyRules;
9468 rule = StyleRuleMedia::create(media ? media : MediaQuerySet::create(), e mptyRules); 9468 rule = StyleRuleMedia::create(media ? media : MediaQuerySet::create().ge t(), emptyRules);
9469 } 9469 }
9470 StyleRuleMedia* result = rule.get(); 9470 StyleRuleMedia* result = rule.get();
9471 m_parsedRules.append(rule.release()); 9471 m_parsedRules.append(rule.release());
9472 return result; 9472 return result;
9473 } 9473 }
9474 9474
9475 StyleRuleBase* BisonCSSParser::createSupportsRule(bool conditionIsSupported, Rul eList* rules) 9475 StyleRuleBase* BisonCSSParser::createSupportsRule(bool conditionIsSupported, Rul eList* rules)
9476 { 9476 {
9477 m_allowImportRules = m_allowNamespaceDeclarations = false; 9477 m_allowImportRules = m_allowNamespaceDeclarations = false;
9478 9478
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
10162 { 10162 {
10163 // The tokenizer checks for the construct of an+b. 10163 // The tokenizer checks for the construct of an+b.
10164 // However, since the {ident} rule precedes the {nth} rule, some of those 10164 // However, since the {ident} rule precedes the {nth} rule, some of those
10165 // tokens are identified as string literal. Furthermore we need to accept 10165 // tokens are identified as string literal. Furthermore we need to accept
10166 // "odd" and "even" which does not match to an+b. 10166 // "odd" and "even" which does not match to an+b.
10167 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") 10167 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even")
10168 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); 10168 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n");
10169 } 10169 }
10170 10170
10171 } 10171 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698