| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved. |
| 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 // An empty string doesn't apply a color. (One containing only whitespace do
es, which is why this check occurs before stripping.) | 920 // An empty string doesn't apply a color. (One containing only whitespace do
es, which is why this check occurs before stripping.) |
| 921 if (attributeValue.isEmpty()) | 921 if (attributeValue.isEmpty()) |
| 922 return; | 922 return; |
| 923 | 923 |
| 924 String colorString = attributeValue.stripWhiteSpace(); | 924 String colorString = attributeValue.stripWhiteSpace(); |
| 925 | 925 |
| 926 // "transparent" doesn't apply a color either. | 926 // "transparent" doesn't apply a color either. |
| 927 if (equalIgnoringCase(colorString, "transparent")) | 927 if (equalIgnoringCase(colorString, "transparent")) |
| 928 return; | 928 return; |
| 929 | 929 |
| 930 // If the string is a named CSS color or a 3/6-digit hex color, use that. | 930 Color color; |
| 931 Color parsedColor; | |
| 932 if (!parsedColor.setFromString(colorString)) | |
| 933 parsedColor.setRGB(parseColorStringWithCrazyLegacyRules(colorString)); | |
| 934 | 931 |
| 935 style->setProperty(propertyID, cssValuePool().createColorValue(parsedColor.r
gb())); | 932 // If the string is a 3/6-digit hex color or a named CSS color, use that. Ap
ply legacy rules otherwise. Note color.setFromString() |
| 933 // accepts 4/8-digit hex colors, so restrict its use with length checks here
to support legacy HTML attribute colors. |
| 934 |
| 935 bool success = false; |
| 936 if ((colorString.length() == 4 || colorString.length() == 7) && colorString[
0] == '#') |
| 937 success = color.setFromString(colorString); |
| 938 if (!success) |
| 939 success = color.setNamedColor(colorString); |
| 940 if (!success) |
| 941 color.setRGB(parseColorStringWithCrazyLegacyRules(colorString)); |
| 942 |
| 943 style->setProperty(propertyID, cssValuePool().createColorValue(color.rgb()))
; |
| 936 } | 944 } |
| 937 | 945 |
| 938 bool HTMLElement::isInteractiveContent() const | 946 bool HTMLElement::isInteractiveContent() const |
| 939 { | 947 { |
| 940 return false; | 948 return false; |
| 941 } | 949 } |
| 942 | 950 |
| 943 HTMLMenuElement* HTMLElement::assignedContextMenu() const | 951 HTMLMenuElement* HTMLElement::assignedContextMenu() const |
| 944 { | 952 { |
| 945 if (HTMLMenuElement* menu = contextMenu()) | 953 if (HTMLMenuElement* menu = contextMenu()) |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 #ifndef NDEBUG | 1047 #ifndef NDEBUG |
| 1040 | 1048 |
| 1041 // For use in the debugger | 1049 // For use in the debugger |
| 1042 void dumpInnerHTML(blink::HTMLElement*); | 1050 void dumpInnerHTML(blink::HTMLElement*); |
| 1043 | 1051 |
| 1044 void dumpInnerHTML(blink::HTMLElement* element) | 1052 void dumpInnerHTML(blink::HTMLElement* element) |
| 1045 { | 1053 { |
| 1046 printf("%s\n", element->innerHTML().ascii().data()); | 1054 printf("%s\n", element->innerHTML().ascii().data()); |
| 1047 } | 1055 } |
| 1048 #endif | 1056 #endif |
| OLD | NEW |