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

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: Applied code review suggestions. Also rebased. Created 6 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 /* 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 return true; 88 return true;
89 case CSSPrimitiveValue::CSS_ATTR: 89 case CSSPrimitiveValue::CSS_ATTR:
90 case CSSPrimitiveValue::CSS_COUNTER: 90 case CSSPrimitiveValue::CSS_COUNTER:
91 case CSSPrimitiveValue::CSS_COUNTER_NAME: 91 case CSSPrimitiveValue::CSS_COUNTER_NAME:
92 case CSSPrimitiveValue::CSS_IDENT: 92 case CSSPrimitiveValue::CSS_IDENT:
93 case CSSPrimitiveValue::CSS_PROPERTY_ID: 93 case CSSPrimitiveValue::CSS_PROPERTY_ID:
94 case CSSPrimitiveValue::CSS_VALUE_ID: 94 case CSSPrimitiveValue::CSS_VALUE_ID:
95 case CSSPrimitiveValue::CSS_PAIR: 95 case CSSPrimitiveValue::CSS_PAIR:
96 case CSSPrimitiveValue::CSS_PARSER_HEXCOLOR: 96 case CSSPrimitiveValue::CSS_PARSER_HEXCOLOR:
97 case CSSPrimitiveValue::CSS_PARSER_IDENTIFIER: 97 case CSSPrimitiveValue::CSS_PARSER_IDENTIFIER:
98 case CSSPrimitiveValue::CSS_PARSER_IDSEL:
98 case CSSPrimitiveValue::CSS_PARSER_INTEGER: 99 case CSSPrimitiveValue::CSS_PARSER_INTEGER:
99 case CSSPrimitiveValue::CSS_PARSER_OPERATOR: 100 case CSSPrimitiveValue::CSS_PARSER_OPERATOR:
100 case CSSPrimitiveValue::CSS_RECT: 101 case CSSPrimitiveValue::CSS_RECT:
101 case CSSPrimitiveValue::CSS_QUAD: 102 case CSSPrimitiveValue::CSS_QUAD:
102 case CSSPrimitiveValue::CSS_RGBCOLOR: 103 case CSSPrimitiveValue::CSS_RGBCOLOR:
103 case CSSPrimitiveValue::CSS_SHAPE: 104 case CSSPrimitiveValue::CSS_SHAPE:
104 case CSSPrimitiveValue::CSS_STRING: 105 case CSSPrimitiveValue::CSS_STRING:
105 case CSSPrimitiveValue::CSS_UNICODE_RANGE: 106 case CSSPrimitiveValue::CSS_UNICODE_RANGE:
106 case CSSPrimitiveValue::CSS_UNKNOWN: 107 case CSSPrimitiveValue::CSS_UNKNOWN:
107 case CSSPrimitiveValue::CSS_URI: 108 case CSSPrimitiveValue::CSS_URI:
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 } 461 }
461 462
462 void CSSPrimitiveValue::cleanup() 463 void CSSPrimitiveValue::cleanup()
463 { 464 {
464 switch (static_cast<UnitTypes>(m_primitiveUnitType)) { 465 switch (static_cast<UnitTypes>(m_primitiveUnitType)) {
465 case CSS_STRING: 466 case CSS_STRING:
466 case CSS_URI: 467 case CSS_URI:
467 case CSS_ATTR: 468 case CSS_ATTR:
468 case CSS_COUNTER_NAME: 469 case CSS_COUNTER_NAME:
469 case CSS_PARSER_HEXCOLOR: 470 case CSS_PARSER_HEXCOLOR:
471 case CSS_PARSER_IDSEL:
470 if (m_value.string) 472 if (m_value.string)
471 m_value.string->deref(); 473 m_value.string->deref();
472 break; 474 break;
473 case CSS_COUNTER: 475 case CSS_COUNTER:
474 // We must not call deref() when oilpan is enabled because m_value.count er is traced. 476 // We must not call deref() when oilpan is enabled because m_value.count er is traced.
475 #if !ENABLE(OILPAN) 477 #if !ENABLE(OILPAN)
476 m_value.counter->deref(); 478 m_value.counter->deref();
477 #endif 479 #endif
478 break; 480 break;
479 case CSS_RECT: 481 case CSS_RECT:
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 text = getPairValue()->cssText(); 1214 text = getPairValue()->cssText();
1213 break; 1215 break;
1214 case CSS_PARSER_OPERATOR: { 1216 case CSS_PARSER_OPERATOR: {
1215 char c = static_cast<char>(m_value.parserOperator); 1217 char c = static_cast<char>(m_value.parserOperator);
1216 text = String(&c, 1U); 1218 text = String(&c, 1U);
1217 break; 1219 break;
1218 } 1220 }
1219 case CSS_PARSER_IDENTIFIER: 1221 case CSS_PARSER_IDENTIFIER:
1220 text = quoteCSSStringIfNeeded(m_value.string); 1222 text = quoteCSSStringIfNeeded(m_value.string);
1221 break; 1223 break;
1224 case CSS_PARSER_IDSEL:
1225 text = "#" + String(m_value.string);
1226 break;
1222 case CSS_CALC: 1227 case CSS_CALC:
1223 text = m_value.calc->cssText(); 1228 text = m_value.calc->cssText();
1224 break; 1229 break;
1225 case CSS_SHAPE: 1230 case CSS_SHAPE:
1226 text = m_value.shape->cssText(); 1231 text = m_value.shape->cssText();
1227 break; 1232 break;
1228 case CSS_VW: 1233 case CSS_VW:
1229 text = formatNumber(m_value.num, "vw"); 1234 text = formatNumber(m_value.num, "vw");
1230 break; 1235 break;
1231 case CSS_VH: 1236 case CSS_VH:
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 result = CSSPrimitiveValue::createIdentifier(m_value.valueID); 1320 result = CSSPrimitiveValue::createIdentifier(m_value.valueID);
1316 break; 1321 break;
1317 case CSS_RGBCOLOR: 1322 case CSS_RGBCOLOR:
1318 result = CSSPrimitiveValue::createColor(m_value.rgbcolor); 1323 result = CSSPrimitiveValue::createColor(m_value.rgbcolor);
1319 break; 1324 break;
1320 case CSS_DIMENSION: 1325 case CSS_DIMENSION:
1321 case CSS_UNKNOWN: 1326 case CSS_UNKNOWN:
1322 case CSS_PARSER_OPERATOR: 1327 case CSS_PARSER_OPERATOR:
1323 case CSS_PARSER_IDENTIFIER: 1328 case CSS_PARSER_IDENTIFIER:
1324 case CSS_PARSER_HEXCOLOR: 1329 case CSS_PARSER_HEXCOLOR:
1330 case CSS_PARSER_IDSEL:
1325 ASSERT_NOT_REACHED(); 1331 ASSERT_NOT_REACHED();
1326 break; 1332 break;
1327 } 1333 }
1328 if (result) 1334 if (result)
1329 result->setCSSOMSafe(); 1335 result->setCSSOMSafe();
1330 1336
1331 return result; 1337 return result;
1332 } 1338 }
1333 1339
1334 bool CSSPrimitiveValue::equals(const CSSPrimitiveValue& other) const 1340 bool CSSPrimitiveValue::equals(const CSSPrimitiveValue& other) const
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 case CSS_PROPERTY_ID: 1378 case CSS_PROPERTY_ID:
1373 return propertyName(m_value.propertyID) == propertyName(other.m_value.pr opertyID); 1379 return propertyName(m_value.propertyID) == propertyName(other.m_value.pr opertyID);
1374 case CSS_VALUE_ID: 1380 case CSS_VALUE_ID:
1375 return valueName(m_value.valueID) == valueName(other.m_value.valueID); 1381 return valueName(m_value.valueID) == valueName(other.m_value.valueID);
1376 case CSS_STRING: 1382 case CSS_STRING:
1377 case CSS_URI: 1383 case CSS_URI:
1378 case CSS_ATTR: 1384 case CSS_ATTR:
1379 case CSS_COUNTER_NAME: 1385 case CSS_COUNTER_NAME:
1380 case CSS_PARSER_IDENTIFIER: 1386 case CSS_PARSER_IDENTIFIER:
1381 case CSS_PARSER_HEXCOLOR: 1387 case CSS_PARSER_HEXCOLOR:
1388 case CSS_PARSER_IDSEL:
1382 return equal(m_value.string, other.m_value.string); 1389 return equal(m_value.string, other.m_value.string);
1383 case CSS_COUNTER: 1390 case CSS_COUNTER:
1384 return m_value.counter && other.m_value.counter && m_value.counter->equa ls(*other.m_value.counter); 1391 return m_value.counter && other.m_value.counter && m_value.counter->equa ls(*other.m_value.counter);
1385 case CSS_RECT: 1392 case CSS_RECT:
1386 return m_value.rect && other.m_value.rect && m_value.rect->equals(*other .m_value.rect); 1393 return m_value.rect && other.m_value.rect && m_value.rect->equals(*other .m_value.rect);
1387 case CSS_QUAD: 1394 case CSS_QUAD:
1388 return m_value.quad && other.m_value.quad && m_value.quad->equals(*other .m_value.quad); 1395 return m_value.quad && other.m_value.quad && m_value.quad->equals(*other .m_value.quad);
1389 case CSS_RGBCOLOR: 1396 case CSS_RGBCOLOR:
1390 return m_value.rgbcolor == other.m_value.rgbcolor; 1397 return m_value.rgbcolor == other.m_value.rgbcolor;
1391 case CSS_PAIR: 1398 case CSS_PAIR:
(...skipping 29 matching lines...) Expand all
1421 case CSS_SHAPE: 1428 case CSS_SHAPE:
1422 visitor->trace(m_value.shape); 1429 visitor->trace(m_value.shape);
1423 break; 1430 break;
1424 default: 1431 default:
1425 break; 1432 break;
1426 } 1433 }
1427 CSSValue::traceAfterDispatch(visitor); 1434 CSSValue::traceAfterDispatch(visitor);
1428 } 1435 }
1429 1436
1430 } // namespace WebCore 1437 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698