| OLD | NEW |
| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #include "sky/engine/core/css/CSSPropertySourceData.h" | 50 #include "sky/engine/core/css/CSSPropertySourceData.h" |
| 51 #include "sky/engine/core/css/CSSSelector.h" | 51 #include "sky/engine/core/css/CSSSelector.h" |
| 52 #include "sky/engine/core/css/CSSShadowValue.h" | 52 #include "sky/engine/core/css/CSSShadowValue.h" |
| 53 #include "sky/engine/core/css/CSSStyleSheet.h" | 53 #include "sky/engine/core/css/CSSStyleSheet.h" |
| 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/MediaList.h" | |
| 61 #include "sky/engine/core/css/MediaQueryExp.h" | |
| 62 #include "sky/engine/core/css/Pair.h" | 60 #include "sky/engine/core/css/Pair.h" |
| 63 #include "sky/engine/core/css/Rect.h" | 61 #include "sky/engine/core/css/Rect.h" |
| 64 #include "sky/engine/core/css/StylePropertySet.h" | 62 #include "sky/engine/core/css/StylePropertySet.h" |
| 65 #include "sky/engine/core/css/StyleRule.h" | 63 #include "sky/engine/core/css/StyleRule.h" |
| 66 #include "sky/engine/core/css/StyleKeyframe.h" | 64 #include "sky/engine/core/css/StyleKeyframe.h" |
| 67 #include "sky/engine/core/css/StyleRuleKeyframes.h" | 65 #include "sky/engine/core/css/StyleRuleKeyframes.h" |
| 68 #include "sky/engine/core/css/StyleSheetContents.h" | 66 #include "sky/engine/core/css/StyleSheetContents.h" |
| 69 #include "sky/engine/core/css/parser/CSSParserIdioms.h" | 67 #include "sky/engine/core/css/parser/CSSParserIdioms.h" |
| 70 #include "sky/engine/core/dom/Document.h" | 68 #include "sky/engine/core/dom/Document.h" |
| 71 #include "sky/engine/core/frame/FrameConsole.h" | 69 #include "sky/engine/core/frame/FrameConsole.h" |
| (...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 declaration->addParsedProperties(m_parsedProperties); | 969 declaration->addParsedProperties(m_parsedProperties); |
| 972 clearProperties(); | 970 clearProperties(); |
| 973 } | 971 } |
| 974 | 972 |
| 975 if (m_observer) | 973 if (m_observer) |
| 976 m_observer->endRuleBody(string.length(), false); | 974 m_observer->endRuleBody(string.length(), false); |
| 977 | 975 |
| 978 return ok; | 976 return ok; |
| 979 } | 977 } |
| 980 | 978 |
| 981 PassRefPtr<MediaQuerySet> BisonCSSParser::parseMediaQueryList(const String& stri
ng) | |
| 982 { | |
| 983 ASSERT(!m_mediaList); | |
| 984 | |
| 985 // can't use { because tokenizer state switches from mediaquery to initial s
tate when it sees { token. | |
| 986 // instead insert one " " (which is caught by maybe_space in CSSGrammar.y) | |
| 987 setupParser("@-internal-medialist ", string, ""); | |
| 988 cssyyparse(this); | |
| 989 | |
| 990 ASSERT(m_mediaList); | |
| 991 return m_mediaList.release(); | |
| 992 } | |
| 993 | |
| 994 bool BisonCSSParser::parseAttributeMatchType(CSSSelector::AttributeMatchType& ma
tchType, const String& string) | 979 bool BisonCSSParser::parseAttributeMatchType(CSSSelector::AttributeMatchType& ma
tchType, const String& string) |
| 995 { | 980 { |
| 996 if (!RuntimeEnabledFeatures::cssAttributeCaseSensitivityEnabled() && !isUASh
eetBehavior(m_context.mode())) | 981 if (!RuntimeEnabledFeatures::cssAttributeCaseSensitivityEnabled() && !isUASh
eetBehavior(m_context.mode())) |
| 997 return false; | 982 return false; |
| 998 if (string == "i") { | 983 if (string == "i") { |
| 999 matchType = CSSSelector::CaseInsensitive; | 984 matchType = CSSSelector::CaseInsensitive; |
| 1000 return true; | 985 return true; |
| 1001 } | 986 } |
| 1002 return false; | 987 return false; |
| 1003 } | 988 } |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1367 CSSParserValue& BisonCSSParser::sinkFloatingValue(CSSParserValue& value) | 1352 CSSParserValue& BisonCSSParser::sinkFloatingValue(CSSParserValue& value) |
| 1368 { | 1353 { |
| 1369 if (value.unit == CSSParserValue::Function) { | 1354 if (value.unit == CSSParserValue::Function) { |
| 1370 size_t index = m_floatingFunctions.reverseFind(value.function); | 1355 size_t index = m_floatingFunctions.reverseFind(value.function); |
| 1371 ASSERT(index != kNotFound); | 1356 ASSERT(index != kNotFound); |
| 1372 m_floatingFunctions.remove(index); | 1357 m_floatingFunctions.remove(index); |
| 1373 } | 1358 } |
| 1374 return value; | 1359 return value; |
| 1375 } | 1360 } |
| 1376 | 1361 |
| 1377 MediaQueryExp* BisonCSSParser::createFloatingMediaQueryExp(const AtomicString& m
ediaFeature, CSSParserValueList* values) | |
| 1378 { | |
| 1379 m_floatingMediaQueryExp = MediaQueryExp::createIfValid(mediaFeature, values)
; | |
| 1380 return m_floatingMediaQueryExp.get(); | |
| 1381 } | |
| 1382 | |
| 1383 PassOwnPtr<MediaQueryExp> BisonCSSParser::sinkFloatingMediaQueryExp(MediaQueryEx
p* expression) | |
| 1384 { | |
| 1385 ASSERT_UNUSED(expression, expression == m_floatingMediaQueryExp); | |
| 1386 return m_floatingMediaQueryExp.release(); | |
| 1387 } | |
| 1388 | |
| 1389 Vector<OwnPtr<MediaQueryExp> >* BisonCSSParser::createFloatingMediaQueryExpList(
) | |
| 1390 { | |
| 1391 m_floatingMediaQueryExpList = adoptPtr(new Vector<OwnPtr<MediaQueryExp> >); | |
| 1392 return m_floatingMediaQueryExpList.get(); | |
| 1393 } | |
| 1394 | |
| 1395 PassOwnPtr<Vector<OwnPtr<MediaQueryExp> > > BisonCSSParser::sinkFloatingMediaQue
ryExpList(Vector<OwnPtr<MediaQueryExp> >* list) | |
| 1396 { | |
| 1397 ASSERT_UNUSED(list, list == m_floatingMediaQueryExpList); | |
| 1398 return m_floatingMediaQueryExpList.release(); | |
| 1399 } | |
| 1400 | |
| 1401 MediaQuery* BisonCSSParser::createFloatingMediaQuery(MediaQuery::Restrictor rest
rictor, const AtomicString& mediaType, PassOwnPtr<Vector<OwnPtr<MediaQueryExp> >
> expressions) | |
| 1402 { | |
| 1403 m_floatingMediaQuery = adoptPtr(new MediaQuery(restrictor, mediaType, expres
sions)); | |
| 1404 return m_floatingMediaQuery.get(); | |
| 1405 } | |
| 1406 | |
| 1407 MediaQuery* BisonCSSParser::createFloatingMediaQuery(PassOwnPtr<Vector<OwnPtr<Me
diaQueryExp> > > expressions) | |
| 1408 { | |
| 1409 return createFloatingMediaQuery(MediaQuery::None, AtomicString("all", Atomic
String::ConstructFromLiteral), expressions); | |
| 1410 } | |
| 1411 | |
| 1412 MediaQuery* BisonCSSParser::createFloatingNotAllQuery() | |
| 1413 { | |
| 1414 return createFloatingMediaQuery(MediaQuery::Not, AtomicString("all", AtomicS
tring::ConstructFromLiteral), sinkFloatingMediaQueryExpList(createFloatingMediaQ
ueryExpList())); | |
| 1415 } | |
| 1416 | |
| 1417 PassOwnPtr<MediaQuery> BisonCSSParser::sinkFloatingMediaQuery(MediaQuery* query) | |
| 1418 { | |
| 1419 ASSERT_UNUSED(query, query == m_floatingMediaQuery); | |
| 1420 return m_floatingMediaQuery.release(); | |
| 1421 } | |
| 1422 | |
| 1423 Vector<RefPtr<StyleKeyframe> >* BisonCSSParser::createFloatingKeyframeVector() | 1362 Vector<RefPtr<StyleKeyframe> >* BisonCSSParser::createFloatingKeyframeVector() |
| 1424 { | 1363 { |
| 1425 m_floatingKeyframeVector = adoptPtr(new Vector<RefPtr<StyleKeyframe> >()); | 1364 m_floatingKeyframeVector = adoptPtr(new Vector<RefPtr<StyleKeyframe> >()); |
| 1426 return m_floatingKeyframeVector.get(); | 1365 return m_floatingKeyframeVector.get(); |
| 1427 } | 1366 } |
| 1428 | 1367 |
| 1429 PassOwnPtr<Vector<RefPtr<StyleKeyframe> > > BisonCSSParser::sinkFloatingKeyframe
Vector(Vector<RefPtr<StyleKeyframe> >* keyframeVector) | 1368 PassOwnPtr<Vector<RefPtr<StyleKeyframe> > > BisonCSSParser::sinkFloatingKeyframe
Vector(Vector<RefPtr<StyleKeyframe> >* keyframeVector) |
| 1430 { | 1369 { |
| 1431 ASSERT_UNUSED(keyframeVector, m_floatingKeyframeVector == keyframeVector); | 1370 ASSERT_UNUSED(keyframeVector, m_floatingKeyframeVector == keyframeVector); |
| 1432 return m_floatingKeyframeVector.release(); | 1371 return m_floatingKeyframeVector.release(); |
| 1433 } | 1372 } |
| 1434 | 1373 |
| 1435 MediaQuerySet* BisonCSSParser::createMediaQuerySet() | |
| 1436 { | |
| 1437 RefPtr<MediaQuerySet> queries = MediaQuerySet::create(); | |
| 1438 MediaQuerySet* result = queries.get(); | |
| 1439 m_parsedMediaQuerySets.append(queries.release()); | |
| 1440 return result; | |
| 1441 } | |
| 1442 | |
| 1443 StyleRuleBase* BisonCSSParser::createMediaRule(MediaQuerySet* media, RuleList* r
ules) | |
| 1444 { | |
| 1445 m_allowImportRules = m_allowNamespaceDeclarations = false; | |
| 1446 RefPtr<StyleRuleMedia> rule = nullptr; | |
| 1447 if (rules) { | |
| 1448 rule = StyleRuleMedia::create(media ? media : MediaQuerySet::create().ge
t(), *rules); | |
| 1449 } else { | |
| 1450 RuleList emptyRules; | |
| 1451 rule = StyleRuleMedia::create(media ? media : MediaQuerySet::create().ge
t(), emptyRules); | |
| 1452 } | |
| 1453 StyleRuleMedia* result = rule.get(); | |
| 1454 m_parsedRules.append(rule.release()); | |
| 1455 return result; | |
| 1456 } | |
| 1457 | |
| 1458 StyleRuleBase* BisonCSSParser::createSupportsRule(bool conditionIsSupported, Rul
eList* rules) | 1374 StyleRuleBase* BisonCSSParser::createSupportsRule(bool conditionIsSupported, Rul
eList* rules) |
| 1459 { | 1375 { |
| 1460 m_allowImportRules = m_allowNamespaceDeclarations = false; | 1376 m_allowImportRules = m_allowNamespaceDeclarations = false; |
| 1461 | 1377 |
| 1462 RefPtr<CSSRuleSourceData> data = popSupportsRuleData(); | 1378 RefPtr<CSSRuleSourceData> data = popSupportsRuleData(); |
| 1463 RefPtr<StyleRuleSupports> rule = nullptr; | 1379 RefPtr<StyleRuleSupports> rule = nullptr; |
| 1464 String conditionText; | 1380 String conditionText; |
| 1465 unsigned conditionOffset = data->ruleHeaderRange.start + 9; | 1381 unsigned conditionOffset = data->ruleHeaderRange.start + 9; |
| 1466 unsigned conditionLength = data->ruleHeaderRange.length() - 9; | 1382 unsigned conditionLength = data->ruleHeaderRange.length() - 9; |
| 1467 | 1383 |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1784 m_observer->endProperty(isImportantFound, isPropertyParsed, m_tokenizer.
safeUserStringTokenOffset(), errorType); | 1700 m_observer->endProperty(isImportantFound, isPropertyParsed, m_tokenizer.
safeUserStringTokenOffset(), errorType); |
| 1785 } | 1701 } |
| 1786 | 1702 |
| 1787 void BisonCSSParser::startEndUnknownRule() | 1703 void BisonCSSParser::startEndUnknownRule() |
| 1788 { | 1704 { |
| 1789 if (m_observer) | 1705 if (m_observer) |
| 1790 m_observer->startEndUnknownRule(); | 1706 m_observer->startEndUnknownRule(); |
| 1791 } | 1707 } |
| 1792 | 1708 |
| 1793 } | 1709 } |
| OLD | NEW |