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

Side by Side Diff: Source/core/css/CSSPrimitiveValue.cpp

Issue 114373004: Remove the SVGColor and SVGPaint DOM interfaces (were deprecated). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: text diff fix Created 7 years 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
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/svg/SVGAnimatedType.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 break; 1039 break;
1040 case CSS_QUAD: 1040 case CSS_QUAD:
1041 text = getQuadValue()->cssText(); 1041 text = getQuadValue()->cssText();
1042 break; 1042 break;
1043 case CSS_RGBCOLOR: 1043 case CSS_RGBCOLOR:
1044 case CSS_PARSER_HEXCOLOR: { 1044 case CSS_PARSER_HEXCOLOR: {
1045 RGBA32 rgbColor = m_value.rgbcolor; 1045 RGBA32 rgbColor = m_value.rgbcolor;
1046 if (m_primitiveUnitType == CSS_PARSER_HEXCOLOR) 1046 if (m_primitiveUnitType == CSS_PARSER_HEXCOLOR)
1047 Color::parseHexColor(m_value.string, rgbColor); 1047 Color::parseHexColor(m_value.string, rgbColor);
1048 Color color(rgbColor); 1048 Color color(rgbColor);
1049 1049 text = color.serializedAsCSSComponentValue();
1050 StringBuilder result;
1051 result.reserveCapacity(32);
1052 bool colorHasAlpha = color.hasAlpha();
1053 if (colorHasAlpha)
1054 result.append("rgba(", 5);
1055 else
1056 result.append("rgb(", 4);
1057
1058 result.appendNumber(static_cast<unsigned char>(color.red()));
1059 result.append(", ", 2);
1060
1061 result.appendNumber(static_cast<unsigned char>(color.green()));
1062 result.append(", ", 2);
1063
1064 result.appendNumber(static_cast<unsigned char>(color.blue()));
1065 if (colorHasAlpha) {
1066 result.append(", ", 2);
1067
1068 NumberToStringBuffer buffer;
1069 const char* alphaString = numberToFixedPrecisionString(color.alp ha() / 255.0f, 6, buffer, true);
1070 result.append(alphaString, strlen(alphaString));
1071 }
1072
1073 result.append(')');
1074 text = result.toString();
1075 break; 1050 break;
1076 } 1051 }
1077 case CSS_FR: 1052 case CSS_FR:
1078 text = formatNumber(m_value.num, "fr"); 1053 text = formatNumber(m_value.num, "fr");
1079 break; 1054 break;
1080 case CSS_PAIR: 1055 case CSS_PAIR:
1081 text = getPairValue()->cssText(); 1056 text = getPairValue()->cssText();
1082 break; 1057 break;
1083 case CSS_PARSER_OPERATOR: { 1058 case CSS_PARSER_OPERATOR: {
1084 char c = static_cast<char>(m_value.parserOperator); 1059 char c = static_cast<char>(m_value.parserOperator);
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 return m_value.parserOperator == other.m_value.parserOperator; 1306 return m_value.parserOperator == other.m_value.parserOperator;
1332 case CSS_CALC: 1307 case CSS_CALC:
1333 return m_value.calc && other.m_value.calc && m_value.calc->equals(*other .m_value.calc); 1308 return m_value.calc && other.m_value.calc && m_value.calc->equals(*other .m_value.calc);
1334 case CSS_SHAPE: 1309 case CSS_SHAPE:
1335 return m_value.shape && other.m_value.shape && m_value.shape->equals(*ot her.m_value.shape); 1310 return m_value.shape && other.m_value.shape && m_value.shape->equals(*ot her.m_value.shape);
1336 } 1311 }
1337 return false; 1312 return false;
1338 } 1313 }
1339 1314
1340 } // namespace WebCore 1315 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/svg/SVGAnimatedType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698