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

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

Issue 17450016: Implementation of CSS3 nav-up/down/left/right properties from CSS3 UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed compilation error in mac and crash in linux/window that were reported by trybots. Created 6 years, 2 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 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 validPrimitive = true; 1060 validPrimitive = true;
1061 else { 1061 else {
1062 RefPtrWillBeRawPtr<CSSValue> val = parseFilter(); 1062 RefPtrWillBeRawPtr<CSSValue> val = parseFilter();
1063 if (val) { 1063 if (val) {
1064 addProperty(propId, val, important); 1064 addProperty(propId, val, important);
1065 return true; 1065 return true;
1066 } 1066 }
1067 return false; 1067 return false;
1068 } 1068 }
1069 break; 1069 break;
1070 case CSSPropertyNavDown: // auto | <id> [ current | root | <target-name> ] | inherit
1071 case CSSPropertyNavLeft:
1072 case CSSPropertyNavRight:
1073 case CSSPropertyNavUp:
1074 if (id == CSSValueAuto) {
1075 validPrimitive = true;
1076 } else if (value) {
Timothy Loh 2014/10/01 13:14:54 value is never null here. I would move this logic
1077 if (value->unit != CSSPrimitiveValue::CSS_PARSER_IDSEL && value->uni t != CSSPrimitiveValue::CSS_PARSER_HEXCOLOR)
1078 return false;
1079 String selectorText = "#";
1080 selectorText.append(value->string);
1081
1082 RefPtrWillBeRawPtr<CSSPrimitiveValue> idSel = cssValuePool().createV alue(selectorText, CSSPrimitiveValue::CSS_STRING);
1083 value = m_valueList->next();
1084 RefPtrWillBeRawPtr<CSSPrimitiveValue> target;
1085 if (value) {
1086 if (value->unit == CSSPrimitiveValue::CSS_IDENT) {
1087 target = parseValidPrimitive(value->id, value);
Timothy Loh 2014/10/01 13:14:53 Don't you want to check if the id is CSSValueCurre
1088 } else if (value->unit == CSSPrimitiveValue::CSS_STRING) {
1089 if (value->string.startsWithIgnoringCase("_"))
1090 return false;
1091 target = cssValuePool().createValue(value->string, CSSPrimit iveValue::CSS_STRING);
1092 }
Timothy Loh 2014/10/01 13:14:53 You'll want to call m_valueList->next() here to in
1093 } else {
1094 target = cssValuePool().createValue(CSSValueCurrent);
1095 }
1096
1097 RefPtrWillBeRawPtr<CSSValueList> propertyValue = CSSValueList::creat eSpaceSeparated();
1098 propertyValue->append(idSel);
1099 propertyValue->append(target);
1100 addProperty(propId, propertyValue, important);
Timothy Loh 2014/10/01 13:14:54 Don't addProperty, just break after setting parsed
1101 return true;
1102 }
1103 break;
1070 case CSSPropertyFlex: { 1104 case CSSPropertyFlex: {
1071 ShorthandScope scope(this, propId); 1105 ShorthandScope scope(this, propId);
1072 if (id == CSSValueNone) { 1106 if (id == CSSValueNone) {
1073 addProperty(CSSPropertyFlexGrow, cssValuePool().createValue(0, CSSPr imitiveValue::CSS_NUMBER), important); 1107 addProperty(CSSPropertyFlexGrow, cssValuePool().createValue(0, CSSPr imitiveValue::CSS_NUMBER), important);
1074 addProperty(CSSPropertyFlexShrink, cssValuePool().createValue(0, CSS PrimitiveValue::CSS_NUMBER), important); 1108 addProperty(CSSPropertyFlexShrink, cssValuePool().createValue(0, CSS PrimitiveValue::CSS_NUMBER), important);
1075 addProperty(CSSPropertyFlexBasis, cssValuePool().createIdentifierVal ue(CSSValueAuto), important); 1109 addProperty(CSSPropertyFlexBasis, cssValuePool().createIdentifierVal ue(CSSValueAuto), important);
1076 return true; 1110 return true;
1077 } 1111 }
1078 return parseFlex(m_valueList, important); 1112 return parseFlex(m_valueList, important);
1079 } 1113 }
(...skipping 7094 matching lines...) Expand 10 before | Expand all | Expand 10 after
8174 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); 8208 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
8175 if (!seenStroke) 8209 if (!seenStroke)
8176 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); 8210 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) );
8177 if (!seenMarkers) 8211 if (!seenMarkers)
8178 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); 8212 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers ));
8179 8213
8180 return parsedValues.release(); 8214 return parsedValues.release();
8181 } 8215 }
8182 8216
8183 } // namespace blink 8217 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698