OLD | NEW |
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 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 case CSS_QUAD: | 1018 case CSS_QUAD: |
1019 text = getQuadValue()->cssText(); | 1019 text = getQuadValue()->cssText(); |
1020 break; | 1020 break; |
1021 case CSS_RGBCOLOR: | 1021 case CSS_RGBCOLOR: |
1022 case CSS_PARSER_HEXCOLOR: { | 1022 case CSS_PARSER_HEXCOLOR: { |
1023 RGBA32 rgbColor = m_value.rgbcolor; | 1023 RGBA32 rgbColor = m_value.rgbcolor; |
1024 if (m_primitiveUnitType == CSS_PARSER_HEXCOLOR) | 1024 if (m_primitiveUnitType == CSS_PARSER_HEXCOLOR) |
1025 Color::parseHexColor(m_value.string, rgbColor); | 1025 Color::parseHexColor(m_value.string, rgbColor); |
1026 Color color(rgbColor); | 1026 Color color(rgbColor); |
1027 | 1027 |
1028 Vector<LChar> result; | 1028 StringBuilder result; |
1029 result.reserveInitialCapacity(32); | 1029 result.reserveCapacity(32); |
1030 bool colorHasAlpha = color.hasAlpha(); | 1030 bool colorHasAlpha = color.hasAlpha(); |
1031 if (colorHasAlpha) | 1031 if (colorHasAlpha) |
1032 result.append("rgba(", 5); | 1032 result.append("rgba(", 5); |
1033 else | 1033 else |
1034 result.append("rgb(", 4); | 1034 result.append("rgb(", 4); |
1035 | 1035 |
1036 appendNumber(result, static_cast<unsigned char>(color.red())); | 1036 result.appendNumber(static_cast<unsigned char>(color.red())); |
1037 result.append(", ", 2); | 1037 result.append(", ", 2); |
1038 | 1038 |
1039 appendNumber(result, static_cast<unsigned char>(color.green())); | 1039 result.appendNumber(static_cast<unsigned char>(color.green())); |
1040 result.append(", ", 2); | 1040 result.append(", ", 2); |
1041 | 1041 |
1042 appendNumber(result, static_cast<unsigned char>(color.blue())); | 1042 result.appendNumber(static_cast<unsigned char>(color.blue())); |
1043 if (colorHasAlpha) { | 1043 if (colorHasAlpha) { |
1044 result.append(", ", 2); | 1044 result.append(", ", 2); |
1045 | 1045 |
1046 NumberToStringBuffer buffer; | 1046 NumberToStringBuffer buffer; |
1047 const char* alphaString = numberToFixedPrecisionString(color.alp
ha() / 255.0f, 6, buffer, true); | 1047 const char* alphaString = numberToFixedPrecisionString(color.alp
ha() / 255.0f, 6, buffer, true); |
1048 result.append(alphaString, strlen(alphaString)); | 1048 result.append(alphaString, strlen(alphaString)); |
1049 } | 1049 } |
1050 | 1050 |
1051 result.append(')'); | 1051 result.append(')'); |
1052 text = String::adopt(result); | 1052 text = result.toString(); |
1053 break; | 1053 break; |
1054 } | 1054 } |
1055 case CSS_PAIR: | 1055 case CSS_PAIR: |
1056 text = getPairValue()->cssText(); | 1056 text = getPairValue()->cssText(); |
1057 break; | 1057 break; |
1058 case CSS_PARSER_OPERATOR: { | 1058 case CSS_PARSER_OPERATOR: { |
1059 char c = static_cast<char>(m_value.parserOperator); | 1059 char c = static_cast<char>(m_value.parserOperator); |
1060 text = String(&c, 1U); | 1060 text = String(&c, 1U); |
1061 break; | 1061 break; |
1062 } | 1062 } |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1301 return m_value.valueID == other.m_value.valueID; | 1301 return m_value.valueID == other.m_value.valueID; |
1302 case CSS_CALC: | 1302 case CSS_CALC: |
1303 return m_value.calc && other.m_value.calc && m_value.calc->equals(*other
.m_value.calc); | 1303 return m_value.calc && other.m_value.calc && m_value.calc->equals(*other
.m_value.calc); |
1304 case CSS_SHAPE: | 1304 case CSS_SHAPE: |
1305 return m_value.shape && other.m_value.shape && m_value.shape->equals(*ot
her.m_value.shape); | 1305 return m_value.shape && other.m_value.shape && m_value.shape->equals(*ot
her.m_value.shape); |
1306 } | 1306 } |
1307 return false; | 1307 return false; |
1308 } | 1308 } |
1309 | 1309 |
1310 } // namespace WebCore | 1310 } // namespace WebCore |
OLD | NEW |