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

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: Created 6 years, 10 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 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 declaration->addParsedProperties(m_parsedProperties); 1288 declaration->addParsedProperties(m_parsedProperties);
1289 clearProperties(); 1289 clearProperties();
1290 } 1290 }
1291 1291
1292 if (m_observer) 1292 if (m_observer)
1293 m_observer->endRuleBody(string.length(), false); 1293 m_observer->endRuleBody(string.length(), false);
1294 1294
1295 return ok; 1295 return ok;
1296 } 1296 }
1297 1297
1298 PassRefPtr<MediaQuerySet> BisonCSSParser::parseMediaQueryList(const String& stri ng) 1298 PassRefPtrWillBeRawPtr<MediaQuerySet> BisonCSSParser::parseMediaQueryList(const String& string)
1299 { 1299 {
1300 ASSERT(!m_mediaList); 1300 ASSERT(!m_mediaList);
1301 1301
1302 // can't use { because tokenizer state switches from mediaquery to initial s tate when it sees { token. 1302 // can't use { because tokenizer state switches from mediaquery to initial s tate when it sees { token.
1303 // instead insert one " " (which is caught by maybe_space in CSSGrammar.y) 1303 // instead insert one " " (which is caught by maybe_space in CSSGrammar.y)
1304 setupParser("@-internal-medialist ", string, ""); 1304 setupParser("@-internal-medialist ", string, "");
1305 cssyyparse(this); 1305 cssyyparse(this);
1306 1306
1307 ASSERT(m_mediaList); 1307 ASSERT(m_mediaList);
1308 return m_mediaList.release(); 1308 return m_mediaList.release();
(...skipping 8072 matching lines...) Expand 10 before | Expand all | Expand 10 after
9381 } 9381 }
9382 return value; 9382 return value;
9383 } 9383 }
9384 9384
9385 MediaQueryExp* BisonCSSParser::createFloatingMediaQueryExp(const AtomicString& m ediaFeature, CSSParserValueList* values) 9385 MediaQueryExp* BisonCSSParser::createFloatingMediaQueryExp(const AtomicString& m ediaFeature, CSSParserValueList* values)
9386 { 9386 {
9387 m_floatingMediaQueryExp = MediaQueryExp::create(mediaFeature, values); 9387 m_floatingMediaQueryExp = MediaQueryExp::create(mediaFeature, values);
9388 return m_floatingMediaQueryExp.get(); 9388 return m_floatingMediaQueryExp.get();
9389 } 9389 }
9390 9390
9391 PassOwnPtr<MediaQueryExp> BisonCSSParser::sinkFloatingMediaQueryExp(MediaQueryEx p* expression) 9391 PassOwnPtrWillBeRawPtr<MediaQueryExp> BisonCSSParser::sinkFloatingMediaQueryExp( MediaQueryExp* expression)
9392 { 9392 {
9393 ASSERT_UNUSED(expression, expression == m_floatingMediaQueryExp); 9393 ASSERT_UNUSED(expression, expression == m_floatingMediaQueryExp);
9394 return m_floatingMediaQueryExp.release(); 9394 return m_floatingMediaQueryExp.release();
9395 } 9395 }
9396 9396
9397 Vector<OwnPtr<MediaQueryExp> >* BisonCSSParser::createFloatingMediaQueryExpList( ) 9397 WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp> >* BisonCSSParser::createFloa tingMediaQueryExpList()
9398 { 9398 {
9399 m_floatingMediaQueryExpList = adoptPtr(new Vector<OwnPtr<MediaQueryExp> >); 9399 m_floatingMediaQueryExpList = adoptPtrWillBeNoop(new WillBeHeapVector<OwnPtr WillBeMember<MediaQueryExp> >);
9400 return m_floatingMediaQueryExpList.get(); 9400 return m_floatingMediaQueryExpList.get();
9401 } 9401 }
9402 9402
9403 PassOwnPtr<Vector<OwnPtr<MediaQueryExp> > > BisonCSSParser::sinkFloatingMediaQue ryExpList(Vector<OwnPtr<MediaQueryExp> >* list) 9403 PassOwnPtrWillBeRawPtr<WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp> > > Bi sonCSSParser::sinkFloatingMediaQueryExpList(WillBeHeapVector<OwnPtrWillBeMember< MediaQueryExp> >* list)
9404 { 9404 {
9405 ASSERT_UNUSED(list, list == m_floatingMediaQueryExpList); 9405 ASSERT_UNUSED(list, list == m_floatingMediaQueryExpList);
9406 return m_floatingMediaQueryExpList.release(); 9406 return m_floatingMediaQueryExpList.release();
9407 } 9407 }
9408 9408
9409 MediaQuery* BisonCSSParser::createFloatingMediaQuery(MediaQuery::Restrictor rest rictor, const AtomicString& mediaType, PassOwnPtr<Vector<OwnPtr<MediaQueryExp> > > expressions) 9409 MediaQuery* BisonCSSParser::createFloatingMediaQuery(MediaQuery::Restrictor rest rictor, const AtomicString& mediaType, PassOwnPtrWillBeRawPtr<WillBeHeapVector<O wnPtrWillBeMember<MediaQueryExp> > > expressions)
9410 { 9410 {
9411 m_floatingMediaQuery = adoptPtr(new MediaQuery(restrictor, mediaType, expres sions)); 9411 m_floatingMediaQuery = adoptPtrWillBeNoop(new MediaQuery(restrictor, mediaTy pe, expressions));
9412 return m_floatingMediaQuery.get(); 9412 return m_floatingMediaQuery.get();
9413 } 9413 }
9414 9414
9415 MediaQuery* BisonCSSParser::createFloatingMediaQuery(PassOwnPtr<Vector<OwnPtr<Me diaQueryExp> > > expressions) 9415 MediaQuery* BisonCSSParser::createFloatingMediaQuery(PassOwnPtrWillBeRawPtr<Will BeHeapVector<OwnPtrWillBeMember<MediaQueryExp> > > expressions)
9416 { 9416 {
9417 return createFloatingMediaQuery(MediaQuery::None, AtomicString("all", Atomic String::ConstructFromLiteral), expressions); 9417 return createFloatingMediaQuery(MediaQuery::None, AtomicString("all", Atomic String::ConstructFromLiteral), expressions);
9418 } 9418 }
9419 9419
9420 MediaQuery* BisonCSSParser::createFloatingNotAllQuery() 9420 MediaQuery* BisonCSSParser::createFloatingNotAllQuery()
9421 { 9421 {
9422 return createFloatingMediaQuery(MediaQuery::Not, AtomicString("all", AtomicS tring::ConstructFromLiteral), sinkFloatingMediaQueryExpList(createFloatingMediaQ ueryExpList())); 9422 return createFloatingMediaQuery(MediaQuery::Not, AtomicString("all", AtomicS tring::ConstructFromLiteral), sinkFloatingMediaQueryExpList(createFloatingMediaQ ueryExpList()));
9423 } 9423 }
9424 9424
9425 PassOwnPtr<MediaQuery> BisonCSSParser::sinkFloatingMediaQuery(MediaQuery* query) 9425 PassOwnPtrWillBeRawPtr<MediaQuery> BisonCSSParser::sinkFloatingMediaQuery(MediaQ uery* query)
9426 { 9426 {
9427 ASSERT_UNUSED(query, query == m_floatingMediaQuery); 9427 ASSERT_UNUSED(query, query == m_floatingMediaQuery);
9428 return m_floatingMediaQuery.release(); 9428 return m_floatingMediaQuery.release();
9429 } 9429 }
9430 9430
9431 Vector<RefPtr<StyleKeyframe> >* BisonCSSParser::createFloatingKeyframeVector() 9431 Vector<RefPtr<StyleKeyframe> >* BisonCSSParser::createFloatingKeyframeVector()
9432 { 9432 {
9433 m_floatingKeyframeVector = adoptPtr(new Vector<RefPtr<StyleKeyframe> >()); 9433 m_floatingKeyframeVector = adoptPtr(new Vector<RefPtr<StyleKeyframe> >());
9434 return m_floatingKeyframeVector.get(); 9434 return m_floatingKeyframeVector.get();
9435 } 9435 }
9436 9436
9437 PassOwnPtr<Vector<RefPtr<StyleKeyframe> > > BisonCSSParser::sinkFloatingKeyframe Vector(Vector<RefPtr<StyleKeyframe> >* keyframeVector) 9437 PassOwnPtr<Vector<RefPtr<StyleKeyframe> > > BisonCSSParser::sinkFloatingKeyframe Vector(Vector<RefPtr<StyleKeyframe> >* keyframeVector)
9438 { 9438 {
9439 ASSERT_UNUSED(keyframeVector, m_floatingKeyframeVector == keyframeVector); 9439 ASSERT_UNUSED(keyframeVector, m_floatingKeyframeVector == keyframeVector);
9440 return m_floatingKeyframeVector.release(); 9440 return m_floatingKeyframeVector.release();
9441 } 9441 }
9442 9442
9443 MediaQuerySet* BisonCSSParser::createMediaQuerySet() 9443 MediaQuerySet* BisonCSSParser::createMediaQuerySet()
9444 { 9444 {
9445 RefPtr<MediaQuerySet> queries = MediaQuerySet::create(); 9445 RefPtrWillBeRawPtr<MediaQuerySet> queries = MediaQuerySet::create();
9446 MediaQuerySet* result = queries.get(); 9446 MediaQuerySet* result = queries.get();
9447 m_parsedMediaQuerySets.append(queries.release()); 9447 m_parsedMediaQuerySets.append(queries.release());
9448 return result; 9448 return result;
9449 } 9449 }
9450 9450
9451 StyleRuleBase* BisonCSSParser::createImportRule(const CSSParserString& url, Medi aQuerySet* media) 9451 StyleRuleBase* BisonCSSParser::createImportRule(const CSSParserString& url, Medi aQuerySet* media)
9452 { 9452 {
9453 if (!media || !m_allowImportRules) 9453 if (!media || !m_allowImportRules)
9454 return 0; 9454 return 0;
9455 RefPtr<StyleRuleImport> rule = StyleRuleImport::create(url, media); 9455 RefPtr<StyleRuleImport> rule = StyleRuleImport::create(url, media);
9456 StyleRuleImport* result = rule.get(); 9456 StyleRuleImport* result = rule.get();
9457 m_parsedRules.append(rule.release()); 9457 m_parsedRules.append(rule.release());
9458 return result; 9458 return result;
9459 } 9459 }
9460 9460
9461 StyleRuleBase* BisonCSSParser::createMediaRule(MediaQuerySet* media, RuleList* r ules) 9461 StyleRuleBase* BisonCSSParser::createMediaRule(MediaQuerySet* media, RuleList* r ules)
9462 { 9462 {
9463 m_allowImportRules = m_allowNamespaceDeclarations = false; 9463 m_allowImportRules = m_allowNamespaceDeclarations = false;
9464 RefPtr<StyleRuleMedia> rule; 9464 RefPtr<StyleRuleMedia> rule;
9465 if (rules) { 9465 if (rules) {
9466 rule = StyleRuleMedia::create(media ? media : MediaQuerySet::create(), * rules); 9466 rule = StyleRuleMedia::create(media ? media : MediaQuerySet::create().ge t(), *rules);
9467 } else { 9467 } else {
9468 RuleList emptyRules; 9468 RuleList emptyRules;
9469 rule = StyleRuleMedia::create(media ? media : MediaQuerySet::create(), e mptyRules); 9469 rule = StyleRuleMedia::create(media ? media : MediaQuerySet::create().ge t(), emptyRules);
9470 } 9470 }
9471 StyleRuleMedia* result = rule.get(); 9471 StyleRuleMedia* result = rule.get();
9472 m_parsedRules.append(rule.release()); 9472 m_parsedRules.append(rule.release());
9473 return result; 9473 return result;
9474 } 9474 }
9475 9475
9476 StyleRuleBase* BisonCSSParser::createSupportsRule(bool conditionIsSupported, Rul eList* rules) 9476 StyleRuleBase* BisonCSSParser::createSupportsRule(bool conditionIsSupported, Rul eList* rules)
9477 { 9477 {
9478 m_allowImportRules = m_allowNamespaceDeclarations = false; 9478 m_allowImportRules = m_allowNamespaceDeclarations = false;
9479 9479
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
10163 { 10163 {
10164 // The tokenizer checks for the construct of an+b. 10164 // The tokenizer checks for the construct of an+b.
10165 // However, since the {ident} rule precedes the {nth} rule, some of those 10165 // However, since the {ident} rule precedes the {nth} rule, some of those
10166 // tokens are identified as string literal. Furthermore we need to accept 10166 // tokens are identified as string literal. Furthermore we need to accept
10167 // "odd" and "even" which does not match to an+b. 10167 // "odd" and "even" which does not match to an+b.
10168 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") 10168 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even")
10169 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); 10169 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n");
10170 } 10170 }
10171 10171
10172 } 10172 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698