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

Side by Side Diff: Source/core/css/CSSPrimitiveValue.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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2012 Apple Inc. All rights reserv ed. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2012 Apple Inc. All rights reserv ed.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 case CSSPrimitiveValue::CSS_FR: 88 case CSSPrimitiveValue::CSS_FR:
89 return true; 89 return true;
90 case CSSPrimitiveValue::CSS_ATTR: 90 case CSSPrimitiveValue::CSS_ATTR:
91 case CSSPrimitiveValue::CSS_COUNTER: 91 case CSSPrimitiveValue::CSS_COUNTER:
92 case CSSPrimitiveValue::CSS_COUNTER_NAME: 92 case CSSPrimitiveValue::CSS_COUNTER_NAME:
93 case CSSPrimitiveValue::CSS_IDENT: 93 case CSSPrimitiveValue::CSS_IDENT:
94 case CSSPrimitiveValue::CSS_PROPERTY_ID: 94 case CSSPrimitiveValue::CSS_PROPERTY_ID:
95 case CSSPrimitiveValue::CSS_VALUE_ID: 95 case CSSPrimitiveValue::CSS_VALUE_ID:
96 case CSSPrimitiveValue::CSS_PAIR: 96 case CSSPrimitiveValue::CSS_PAIR:
97 case CSSPrimitiveValue::CSS_PARSER_HEXCOLOR: 97 case CSSPrimitiveValue::CSS_PARSER_HEXCOLOR:
98 case CSSPrimitiveValue::CSS_PARSER_IDSEL:
98 case CSSPrimitiveValue::CSS_RECT: 99 case CSSPrimitiveValue::CSS_RECT:
99 case CSSPrimitiveValue::CSS_QUAD: 100 case CSSPrimitiveValue::CSS_QUAD:
100 case CSSPrimitiveValue::CSS_RGBCOLOR: 101 case CSSPrimitiveValue::CSS_RGBCOLOR:
101 case CSSPrimitiveValue::CSS_SHAPE: 102 case CSSPrimitiveValue::CSS_SHAPE:
102 case CSSPrimitiveValue::CSS_STRING: 103 case CSSPrimitiveValue::CSS_STRING:
103 case CSSPrimitiveValue::CSS_UNICODE_RANGE: 104 case CSSPrimitiveValue::CSS_UNICODE_RANGE:
104 case CSSPrimitiveValue::CSS_UNKNOWN: 105 case CSSPrimitiveValue::CSS_UNKNOWN:
105 case CSSPrimitiveValue::CSS_URI: 106 case CSSPrimitiveValue::CSS_URI:
106 return false; 107 return false;
107 } 108 }
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 } 437 }
437 438
438 void CSSPrimitiveValue::cleanup() 439 void CSSPrimitiveValue::cleanup()
439 { 440 {
440 switch (static_cast<UnitType>(m_primitiveUnitType)) { 441 switch (static_cast<UnitType>(m_primitiveUnitType)) {
441 case CSS_STRING: 442 case CSS_STRING:
442 case CSS_URI: 443 case CSS_URI:
443 case CSS_ATTR: 444 case CSS_ATTR:
444 case CSS_COUNTER_NAME: 445 case CSS_COUNTER_NAME:
445 case CSS_PARSER_HEXCOLOR: 446 case CSS_PARSER_HEXCOLOR:
447 case CSS_PARSER_IDSEL:
446 if (m_value.string) 448 if (m_value.string)
447 m_value.string->deref(); 449 m_value.string->deref();
448 break; 450 break;
449 case CSS_COUNTER: 451 case CSS_COUNTER:
450 // We must not call deref() when oilpan is enabled because m_value.count er is traced. 452 // We must not call deref() when oilpan is enabled because m_value.count er is traced.
451 #if !ENABLE(OILPAN) 453 #if !ENABLE(OILPAN)
452 m_value.counter->deref(); 454 m_value.counter->deref();
453 #endif 455 #endif
454 break; 456 break;
455 case CSS_RECT: 457 case CSS_RECT:
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 case CSS_URI: 1108 case CSS_URI:
1107 case CSS_VALUE_ID: 1109 case CSS_VALUE_ID:
1108 case CSS_PROPERTY_ID: 1110 case CSS_PROPERTY_ID:
1109 case CSS_ATTR: 1111 case CSS_ATTR:
1110 case CSS_COUNTER_NAME: 1112 case CSS_COUNTER_NAME:
1111 case CSS_COUNTER: 1113 case CSS_COUNTER:
1112 case CSS_RECT: 1114 case CSS_RECT:
1113 case CSS_QUAD: 1115 case CSS_QUAD:
1114 case CSS_RGBCOLOR: 1116 case CSS_RGBCOLOR:
1115 case CSS_PARSER_HEXCOLOR: 1117 case CSS_PARSER_HEXCOLOR:
1118 case CSS_PARSER_IDSEL:
1116 case CSS_PAIR: 1119 case CSS_PAIR:
1117 case CSS_CALC: 1120 case CSS_CALC:
1118 case CSS_SHAPE: 1121 case CSS_SHAPE:
1119 case CSS_IDENT: 1122 case CSS_IDENT:
1120 case CSS_UNICODE_RANGE: 1123 case CSS_UNICODE_RANGE:
1121 case CSS_CALC_PERCENTAGE_WITH_NUMBER: 1124 case CSS_CALC_PERCENTAGE_WITH_NUMBER:
1122 case CSS_CALC_PERCENTAGE_WITH_LENGTH: 1125 case CSS_CALC_PERCENTAGE_WITH_LENGTH:
1123 break; 1126 break;
1124 }; 1127 };
1125 ASSERT_NOT_REACHED(); 1128 ASSERT_NOT_REACHED();
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 RGBA32 rgbColor = m_value.rgbcolor; 1236 RGBA32 rgbColor = m_value.rgbcolor;
1234 if (m_primitiveUnitType == CSS_PARSER_HEXCOLOR) 1237 if (m_primitiveUnitType == CSS_PARSER_HEXCOLOR)
1235 Color::parseHexColor(m_value.string, rgbColor); 1238 Color::parseHexColor(m_value.string, rgbColor);
1236 Color color(rgbColor); 1239 Color color(rgbColor);
1237 text = color.serializedAsCSSComponentValue(); 1240 text = color.serializedAsCSSComponentValue();
1238 break; 1241 break;
1239 } 1242 }
1240 case CSS_PAIR: 1243 case CSS_PAIR:
1241 text = getPairValue()->cssText(); 1244 text = getPairValue()->cssText();
1242 break; 1245 break;
1246 case CSS_PARSER_IDSEL:
1247 text = "#" + String(m_value.string);
1248 break;
1243 case CSS_CALC: 1249 case CSS_CALC:
1244 text = m_value.calc->cssText(); 1250 text = m_value.calc->cssText();
1245 break; 1251 break;
1246 case CSS_SHAPE: 1252 case CSS_SHAPE:
1247 text = m_value.shape->cssText(); 1253 text = m_value.shape->cssText();
1248 break; 1254 break;
1249 } 1255 }
1250 1256
1251 ASSERT(!cssTextCache().contains(this)); 1257 ASSERT(!cssTextCache().contains(this));
1252 cssTextCache().set(this, text); 1258 cssTextCache().set(this, text);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 break; 1327 break;
1322 case CSS_VALUE_ID: 1328 case CSS_VALUE_ID:
1323 result = CSSPrimitiveValue::createIdentifier(m_value.valueID); 1329 result = CSSPrimitiveValue::createIdentifier(m_value.valueID);
1324 break; 1330 break;
1325 case CSS_RGBCOLOR: 1331 case CSS_RGBCOLOR:
1326 result = CSSPrimitiveValue::createColor(m_value.rgbcolor); 1332 result = CSSPrimitiveValue::createColor(m_value.rgbcolor);
1327 break; 1333 break;
1328 case CSS_DIMENSION: 1334 case CSS_DIMENSION:
1329 case CSS_UNKNOWN: 1335 case CSS_UNKNOWN:
1330 case CSS_PARSER_HEXCOLOR: 1336 case CSS_PARSER_HEXCOLOR:
1337 case CSS_PARSER_IDSEL:
1331 ASSERT_NOT_REACHED(); 1338 ASSERT_NOT_REACHED();
1332 break; 1339 break;
1333 } 1340 }
1334 if (result) 1341 if (result)
1335 result->setCSSOMSafe(); 1342 result->setCSSOMSafe();
1336 1343
1337 return result; 1344 return result;
1338 } 1345 }
1339 1346
1340 bool CSSPrimitiveValue::equals(const CSSPrimitiveValue& other) const 1347 bool CSSPrimitiveValue::equals(const CSSPrimitiveValue& other) const
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 return m_value.num == other.m_value.num; 1383 return m_value.num == other.m_value.num;
1377 case CSS_PROPERTY_ID: 1384 case CSS_PROPERTY_ID:
1378 return propertyName(m_value.propertyID) == propertyName(other.m_value.pr opertyID); 1385 return propertyName(m_value.propertyID) == propertyName(other.m_value.pr opertyID);
1379 case CSS_VALUE_ID: 1386 case CSS_VALUE_ID:
1380 return valueName(m_value.valueID) == valueName(other.m_value.valueID); 1387 return valueName(m_value.valueID) == valueName(other.m_value.valueID);
1381 case CSS_STRING: 1388 case CSS_STRING:
1382 case CSS_URI: 1389 case CSS_URI:
1383 case CSS_ATTR: 1390 case CSS_ATTR:
1384 case CSS_COUNTER_NAME: 1391 case CSS_COUNTER_NAME:
1385 case CSS_PARSER_HEXCOLOR: 1392 case CSS_PARSER_HEXCOLOR:
1393 case CSS_PARSER_IDSEL:
1386 return equal(m_value.string, other.m_value.string); 1394 return equal(m_value.string, other.m_value.string);
1387 case CSS_COUNTER: 1395 case CSS_COUNTER:
1388 return m_value.counter && other.m_value.counter && m_value.counter->equa ls(*other.m_value.counter); 1396 return m_value.counter && other.m_value.counter && m_value.counter->equa ls(*other.m_value.counter);
1389 case CSS_RECT: 1397 case CSS_RECT:
1390 return m_value.rect && other.m_value.rect && m_value.rect->equals(*other .m_value.rect); 1398 return m_value.rect && other.m_value.rect && m_value.rect->equals(*other .m_value.rect);
1391 case CSS_QUAD: 1399 case CSS_QUAD:
1392 return m_value.quad && other.m_value.quad && m_value.quad->equals(*other .m_value.quad); 1400 return m_value.quad && other.m_value.quad && m_value.quad->equals(*other .m_value.quad);
1393 case CSS_RGBCOLOR: 1401 case CSS_RGBCOLOR:
1394 return m_value.rgbcolor == other.m_value.rgbcolor; 1402 return m_value.rgbcolor == other.m_value.rgbcolor;
1395 case CSS_PAIR: 1403 case CSS_PAIR:
(...skipping 29 matching lines...) Expand all
1425 visitor->trace(m_value.shape); 1433 visitor->trace(m_value.shape);
1426 break; 1434 break;
1427 default: 1435 default:
1428 break; 1436 break;
1429 } 1437 }
1430 #endif 1438 #endif
1431 CSSValue::traceAfterDispatch(visitor); 1439 CSSValue::traceAfterDispatch(visitor);
1432 } 1440 }
1433 1441
1434 } // namespace blink 1442 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698