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

Side by Side Diff: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp

Issue 1919813002: Implementation of CSS3 nav-up/down/left/right properties from CSS3 UI Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/css/parser/CSSPropertyParser.h" 5 #include "core/css/parser/CSSPropertyParser.h"
6 6
7 #include "core/StylePropertyShorthand.h" 7 #include "core/StylePropertyShorthand.h"
8 #include "core/css/CSSBasicShapeValues.h" 8 #include "core/css/CSSBasicShapeValues.h"
9 #include "core/css/CSSBorderImage.h" 9 #include "core/css/CSSBorderImage.h"
10 #include "core/css/CSSContentDistributionValue.h" 10 #include "core/css/CSSContentDistributionValue.h"
(...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 angle = consumeAngle(range); 1402 angle = consumeAngle(range);
1403 1403
1404 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); 1404 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1405 if (keyword) 1405 if (keyword)
1406 list->append(keyword.release()); 1406 list->append(keyword.release());
1407 if (angle) 1407 if (angle)
1408 list->append(angle.release()); 1408 list->append(angle.release());
1409 return list.release(); 1409 return list.release();
1410 } 1410 }
1411 1411
1412 // auto | <id> [ current | root | <target-name> ] | inherit
1413 static RawPtr<CSSValue> consumeNavigation(CSSParserTokenRange& range)
1414 {
1415 CSSValueID id = range.peek().id();
1416 if (id == CSSValueAuto)
fs 2016/05/18 15:55:05 range.peek().id() == ...
1417 return consumeIdent(range);
1418
1419 String selectorText = "";
fs 2016/05/18 15:55:05 Don't need to initialize this, it'll be overwritte
1420 CSSParserTokenType type = range.peek().type();
1421 if (type == HashToken) {
fs 2016/05/18 15:55:04 Should only accept HashToken here or?
1422 selectorText.append(range.consumeIncludingWhitespace().value());
1423 } else if (type == StringToken) {
1424 selectorText.append(range.consumeIncludingWhitespace().value());
1425 } else {
1426 return nullptr;
1427 }
1428
1429 type = range.peek().type();
1430 RawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
1431 RawPtr<CSSValue> idSel = CSSStringValue::create(selectorText);
fs 2016/05/18 15:55:05 idSelector
1432 list->append(idSel.release());
1433
1434 RawPtr<CSSValue> target;
1435 if (type == IdentToken) {
1436 target = consumeIdent<CSSValueRoot, CSSValueCurrent>(range);
1437 } else if (type == StringToken) {
1438 String targetText = range.consumeIncludingWhitespace().value();
1439 if (targetText.startsWith("_"))
fs 2016/05/18 15:55:05 The way I'm reading the spec, this should not be a
1440 return nullptr;
1441 target = CSSStringValue::create(targetText);
1442 } else if (type == EOFToken) {
fs 2016/05/18 15:55:04 Maybe check range.atEnd() instead.
1443 target = cssValuePool().createIdentifierValue(CSSValueCurrent);
1444 } else {
1445 return nullptr;
1446 }
1447 list->append(target);
1448
1449 return list.release();
1450 }
1451
1412 static RawPtr<CSSValue> consumeTextEmphasisStyle(CSSParserTokenRange& range) 1452 static RawPtr<CSSValue> consumeTextEmphasisStyle(CSSParserTokenRange& range)
1413 { 1453 {
1414 CSSValueID id = range.peek().id(); 1454 CSSValueID id = range.peek().id();
1415 if (id == CSSValueNone) 1455 if (id == CSSValueNone)
1416 return consumeIdent(range); 1456 return consumeIdent(range);
1417 1457
1418 if (RawPtr<CSSValue> textEmphasisStyle = consumeString(range)) 1458 if (RawPtr<CSSValue> textEmphasisStyle = consumeString(range))
1419 return textEmphasisStyle.release(); 1459 return textEmphasisStyle.release();
1420 1460
1421 RawPtr<CSSPrimitiveValue> fill = consumeIdent<CSSValueFilled, CSSValueOpen>( range); 1461 RawPtr<CSSPrimitiveValue> fill = consumeIdent<CSSValueFilled, CSSValueOpen>( range);
(...skipping 2018 matching lines...) Expand 10 before | Expand all | Expand 10 after
3440 case CSSPropertyWebkitTextDecorationsInEffect: 3480 case CSSPropertyWebkitTextDecorationsInEffect:
3441 case CSSPropertyTextDecorationLine: 3481 case CSSPropertyTextDecorationLine:
3442 return consumeTextDecorationLine(m_range); 3482 return consumeTextDecorationLine(m_range);
3443 case CSSPropertyD: 3483 case CSSPropertyD:
3444 case CSSPropertyMotionPath: 3484 case CSSPropertyMotionPath:
3445 return consumePathOrNone(m_range); 3485 return consumePathOrNone(m_range);
3446 case CSSPropertyMotionOffset: 3486 case CSSPropertyMotionOffset:
3447 return consumeLengthOrPercent(m_range, m_context.mode(), ValueRangeAll); 3487 return consumeLengthOrPercent(m_range, m_context.mode(), ValueRangeAll);
3448 case CSSPropertyMotionRotation: 3488 case CSSPropertyMotionRotation:
3449 return consumeMotionRotation(m_range); 3489 return consumeMotionRotation(m_range);
3490 case CSSPropertyNavDown:
3491 case CSSPropertyNavLeft:
3492 case CSSPropertyNavRight:
3493 case CSSPropertyNavUp:
3494 return consumeNavigation(m_range);
3450 case CSSPropertyWebkitTextEmphasisStyle: 3495 case CSSPropertyWebkitTextEmphasisStyle:
3451 return consumeTextEmphasisStyle(m_range); 3496 return consumeTextEmphasisStyle(m_range);
3452 case CSSPropertyOutlineColor: 3497 case CSSPropertyOutlineColor:
3453 return consumeOutlineColor(m_range, m_context.mode()); 3498 return consumeOutlineColor(m_range, m_context.mode());
3454 case CSSPropertyOutlineOffset: 3499 case CSSPropertyOutlineOffset:
3455 return consumeLength(m_range, m_context.mode(), ValueRangeAll); 3500 return consumeLength(m_range, m_context.mode(), ValueRangeAll);
3456 case CSSPropertyOutlineWidth: 3501 case CSSPropertyOutlineWidth:
3457 return consumeLineWidth(m_range, m_context.mode(), UnitlessQuirk::Forbid ); 3502 return consumeLineWidth(m_range, m_context.mode(), UnitlessQuirk::Forbid );
3458 case CSSPropertyTransform: 3503 case CSSPropertyTransform:
3459 return consumeTransform(m_range, m_context.mode(), unresolvedProperty == CSSPropertyAliasWebkitTransform); 3504 return consumeTransform(m_range, m_context.mode(), unresolvedProperty == CSSPropertyAliasWebkitTransform);
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after
4624 m_currentShorthand = oldShorthand; 4669 m_currentShorthand = oldShorthand;
4625 CSSParserValueList valueList(m_range); 4670 CSSParserValueList valueList(m_range);
4626 if (!valueList.size()) 4671 if (!valueList.size())
4627 return false; 4672 return false;
4628 m_valueList = &valueList; 4673 m_valueList = &valueList;
4629 return legacyParseShorthand(unresolvedProperty, important); 4674 return legacyParseShorthand(unresolvedProperty, important);
4630 } 4675 }
4631 } 4676 }
4632 4677
4633 } // namespace blink 4678 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698