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

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

Issue 876433002: Remove even more @keyframes related code. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "sky/engine/core/css/CSSTimingFunctionValue.h" 54 #include "sky/engine/core/css/CSSTimingFunctionValue.h"
55 #include "sky/engine/core/css/CSSTransformValue.h" 55 #include "sky/engine/core/css/CSSTransformValue.h"
56 #include "sky/engine/core/css/CSSUnicodeRangeValue.h" 56 #include "sky/engine/core/css/CSSUnicodeRangeValue.h"
57 #include "sky/engine/core/css/CSSValueList.h" 57 #include "sky/engine/core/css/CSSValueList.h"
58 #include "sky/engine/core/css/CSSValuePool.h" 58 #include "sky/engine/core/css/CSSValuePool.h"
59 #include "sky/engine/core/css/HashTools.h" 59 #include "sky/engine/core/css/HashTools.h"
60 #include "sky/engine/core/css/Pair.h" 60 #include "sky/engine/core/css/Pair.h"
61 #include "sky/engine/core/css/Rect.h" 61 #include "sky/engine/core/css/Rect.h"
62 #include "sky/engine/core/css/StylePropertySet.h" 62 #include "sky/engine/core/css/StylePropertySet.h"
63 #include "sky/engine/core/css/StyleRule.h" 63 #include "sky/engine/core/css/StyleRule.h"
64 #include "sky/engine/core/css/StyleKeyframe.h"
65 #include "sky/engine/core/css/StyleRuleKeyframes.h"
66 #include "sky/engine/core/css/StyleSheetContents.h" 64 #include "sky/engine/core/css/StyleSheetContents.h"
67 #include "sky/engine/core/css/parser/CSSParserIdioms.h" 65 #include "sky/engine/core/css/parser/CSSParserIdioms.h"
68 #include "sky/engine/core/dom/Document.h" 66 #include "sky/engine/core/dom/Document.h"
69 #include "sky/engine/core/frame/FrameConsole.h" 67 #include "sky/engine/core/frame/FrameConsole.h"
70 #include "sky/engine/core/frame/FrameHost.h" 68 #include "sky/engine/core/frame/FrameHost.h"
71 #include "sky/engine/core/frame/LocalFrame.h" 69 #include "sky/engine/core/frame/LocalFrame.h"
72 #include "sky/engine/core/frame/Settings.h" 70 #include "sky/engine/core/frame/Settings.h"
73 #include "sky/engine/core/html/parser/HTMLParserIdioms.h" 71 #include "sky/engine/core/html/parser/HTMLParserIdioms.h"
74 #include "sky/engine/core/inspector/ConsoleMessage.h" 72 #include "sky/engine/core/inspector/ConsoleMessage.h"
75 #include "sky/engine/core/rendering/RenderTheme.h" 73 #include "sky/engine/core/rendering/RenderTheme.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 152
155 PassRefPtr<StyleRuleBase> BisonCSSParser::parseRule(StyleSheetContents* sheet, c onst String& string) 153 PassRefPtr<StyleRuleBase> BisonCSSParser::parseRule(StyleSheetContents* sheet, c onst String& string)
156 { 154 {
157 setStyleSheet(sheet); 155 setStyleSheet(sheet);
158 m_allowNamespaceDeclarations = false; 156 m_allowNamespaceDeclarations = false;
159 setupParser("@-internal-rule ", string, ""); 157 setupParser("@-internal-rule ", string, "");
160 cssyyparse(this); 158 cssyyparse(this);
161 return m_rule.release(); 159 return m_rule.release();
162 } 160 }
163 161
164 PassRefPtr<StyleKeyframe> BisonCSSParser::parseKeyframeRule(StyleSheetContents* sheet, const String& string)
165 {
166 setStyleSheet(sheet);
167 setupParser("@-internal-keyframe-rule ", string, "");
168 cssyyparse(this);
169 return m_keyframe.release();
170 }
171
172 PassOwnPtr<Vector<double> > BisonCSSParser::parseKeyframeKeyList(const String& s tring)
173 {
174 setupParser("@-internal-keyframe-key-list ", string, "");
175 cssyyparse(this);
176 ASSERT(m_valueList);
177 return StyleKeyframe::createKeyList(m_valueList.get());
178 }
179
180 bool BisonCSSParser::parseSupportsCondition(const String& string) 162 bool BisonCSSParser::parseSupportsCondition(const String& string)
181 { 163 {
182 m_supportsCondition = false; 164 m_supportsCondition = false;
183 setupParser("@-internal-supports-condition ", string, ""); 165 setupParser("@-internal-supports-condition ", string, "");
184 cssyyparse(this); 166 cssyyparse(this);
185 return m_supportsCondition; 167 return m_supportsCondition;
186 } 168 }
187 169
188 static inline bool isColorPropertyID(CSSPropertyID propertyId) 170 static inline bool isColorPropertyID(CSSPropertyID propertyId)
189 { 171 {
(...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 CSSParserValue& BisonCSSParser::sinkFloatingValue(CSSParserValue& value) 1323 CSSParserValue& BisonCSSParser::sinkFloatingValue(CSSParserValue& value)
1342 { 1324 {
1343 if (value.unit == CSSParserValue::Function) { 1325 if (value.unit == CSSParserValue::Function) {
1344 size_t index = m_floatingFunctions.reverseFind(value.function); 1326 size_t index = m_floatingFunctions.reverseFind(value.function);
1345 ASSERT(index != kNotFound); 1327 ASSERT(index != kNotFound);
1346 m_floatingFunctions.remove(index); 1328 m_floatingFunctions.remove(index);
1347 } 1329 }
1348 return value; 1330 return value;
1349 } 1331 }
1350 1332
1351 Vector<RefPtr<StyleKeyframe> >* BisonCSSParser::createFloatingKeyframeVector()
1352 {
1353 m_floatingKeyframeVector = adoptPtr(new Vector<RefPtr<StyleKeyframe> >());
1354 return m_floatingKeyframeVector.get();
1355 }
1356
1357 PassOwnPtr<Vector<RefPtr<StyleKeyframe> > > BisonCSSParser::sinkFloatingKeyframe Vector(Vector<RefPtr<StyleKeyframe> >* keyframeVector)
1358 {
1359 ASSERT_UNUSED(keyframeVector, m_floatingKeyframeVector == keyframeVector);
1360 return m_floatingKeyframeVector.release();
1361 }
1362
1363 StyleRuleBase* BisonCSSParser::createSupportsRule(bool conditionIsSupported, Rul eList* rules) 1333 StyleRuleBase* BisonCSSParser::createSupportsRule(bool conditionIsSupported, Rul eList* rules)
1364 { 1334 {
1365 m_allowImportRules = m_allowNamespaceDeclarations = false; 1335 m_allowImportRules = m_allowNamespaceDeclarations = false;
1366 1336
1367 RefPtr<CSSRuleSourceData> data = popSupportsRuleData(); 1337 RefPtr<CSSRuleSourceData> data = popSupportsRuleData();
1368 RefPtr<StyleRuleSupports> rule = nullptr; 1338 RefPtr<StyleRuleSupports> rule = nullptr;
1369 String conditionText; 1339 String conditionText;
1370 unsigned conditionOffset = data->ruleHeaderRange.start + 9; 1340 unsigned conditionOffset = data->ruleHeaderRange.start + 9;
1371 unsigned conditionLength = data->ruleHeaderRange.length() - 9; 1341 unsigned conditionLength = data->ruleHeaderRange.length() - 9;
1372 1342
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 if (m_tokenizer.is8BitSource()) 1447 if (m_tokenizer.is8BitSource())
1478 location.token.init(m_tokenizer.m_dataStart8.get() + m_ruleHeaderStartOf fset, 0); 1448 location.token.init(m_tokenizer.m_dataStart8.get() + m_ruleHeaderStartOf fset, 0);
1479 else 1449 else
1480 location.token.init(m_tokenizer.m_dataStart16.get() + m_ruleHeaderStartO ffset, 0); 1450 location.token.init(m_tokenizer.m_dataStart16.get() + m_ruleHeaderStartO ffset, 0);
1481 1451
1482 reportError(location, m_ruleHeaderType == CSSRuleSourceData::STYLE_RULE ? In validSelectorCSSError : InvalidRuleCSSError); 1452 reportError(location, m_ruleHeaderType == CSSRuleSourceData::STYLE_RULE ? In validSelectorCSSError : InvalidRuleCSSError);
1483 1453
1484 endRuleHeader(); 1454 endRuleHeader();
1485 } 1455 }
1486 1456
1487 StyleRuleKeyframes* BisonCSSParser::createKeyframesRule(const String& name, Pass OwnPtr<Vector<RefPtr<StyleKeyframe> > > popKeyframes, bool isPrefixed)
1488 {
1489 OwnPtr<Vector<RefPtr<StyleKeyframe> > > keyframes = popKeyframes;
1490 m_allowImportRules = m_allowNamespaceDeclarations = false;
1491 RefPtr<StyleRuleKeyframes> rule = StyleRuleKeyframes::create();
1492 for (size_t i = 0; i < keyframes->size(); ++i)
1493 rule->parserAppendKeyframe(keyframes->at(i));
1494 rule->setName(name);
1495 rule->setVendorPrefixed(isPrefixed);
1496 StyleRuleKeyframes* rulePtr = rule.get();
1497 m_parsedRules.append(rule.release());
1498 return rulePtr;
1499 }
1500
1501 StyleRuleBase* BisonCSSParser::createStyleRule(Vector<OwnPtr<CSSParserSelector> >* selectors) 1457 StyleRuleBase* BisonCSSParser::createStyleRule(Vector<OwnPtr<CSSParserSelector> >* selectors)
1502 { 1458 {
1503 StyleRule* result = 0; 1459 StyleRule* result = 0;
1504 if (selectors) { 1460 if (selectors) {
1505 m_allowImportRules = m_allowNamespaceDeclarations = false; 1461 m_allowImportRules = m_allowNamespaceDeclarations = false;
1506 RefPtr<StyleRule> rule = StyleRule::create(); 1462 RefPtr<StyleRule> rule = StyleRule::create();
1507 rule->parserAdoptSelectorVector(*selectors); 1463 rule->parserAdoptSelectorVector(*selectors);
1508 rule->setProperties(createStylePropertySet()); 1464 rule->setProperties(createStylePropertySet());
1509 result = rule.get(); 1465 result = rule.get();
1510 m_parsedRules.append(rule.release()); 1466 m_parsedRules.append(rule.release());
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 { 1522 {
1567 m_numParsedPropertiesBeforeMarginBox = m_parsedProperties.size(); 1523 m_numParsedPropertiesBeforeMarginBox = m_parsedProperties.size();
1568 } 1524 }
1569 1525
1570 void BisonCSSParser::endDeclarationsForMarginBox() 1526 void BisonCSSParser::endDeclarationsForMarginBox()
1571 { 1527 {
1572 rollbackLastProperties(m_parsedProperties.size() - m_numParsedPropertiesBefo reMarginBox); 1528 rollbackLastProperties(m_parsedProperties.size() - m_numParsedPropertiesBefo reMarginBox);
1573 m_numParsedPropertiesBeforeMarginBox = INVALID_NUM_PARSED_PROPERTIES; 1529 m_numParsedPropertiesBeforeMarginBox = INVALID_NUM_PARSED_PROPERTIES;
1574 } 1530 }
1575 1531
1576 StyleKeyframe* BisonCSSParser::createKeyframe(CSSParserValueList* keys)
1577 {
1578 OwnPtr<Vector<double> > keyVector = StyleKeyframe::createKeyList(keys);
1579 if (keyVector->isEmpty())
1580 return 0;
1581
1582 RefPtr<StyleKeyframe> keyframe = StyleKeyframe::create();
1583 keyframe->setKeys(keyVector.release());
1584 keyframe->setProperties(createStylePropertySet());
1585
1586 clearProperties();
1587
1588 StyleKeyframe* keyframePtr = keyframe.get();
1589 m_parsedKeyframes.append(keyframe.release());
1590 return keyframePtr;
1591 }
1592
1593 void BisonCSSParser::startRule() 1532 void BisonCSSParser::startRule()
1594 { 1533 {
1595 if (!m_observer) 1534 if (!m_observer)
1596 return; 1535 return;
1597 1536
1598 ASSERT(m_ruleHasHeader); 1537 ASSERT(m_ruleHasHeader);
1599 m_ruleHasHeader = false; 1538 m_ruleHasHeader = false;
1600 } 1539 }
1601 1540
1602 void BisonCSSParser::endRule(bool valid) 1541 void BisonCSSParser::endRule(bool valid)
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1662 m_observer->endProperty(isPropertyParsed, m_tokenizer.safeUserStringToke nOffset(), errorType); 1601 m_observer->endProperty(isPropertyParsed, m_tokenizer.safeUserStringToke nOffset(), errorType);
1663 } 1602 }
1664 1603
1665 void BisonCSSParser::startEndUnknownRule() 1604 void BisonCSSParser::startEndUnknownRule()
1666 { 1605 {
1667 if (m_observer) 1606 if (m_observer)
1668 m_observer->startEndUnknownRule(); 1607 m_observer->startEndUnknownRule();
1669 } 1608 }
1670 1609
1671 } 1610 }
OLDNEW
« no previous file with comments | « sky/engine/core/css/parser/BisonCSSParser.h ('k') | sky/engine/core/css/resolver/StyleResolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698