Title: [125098] trunk/Source/WebKit2
- Revision
- 125098
- Author
- ander...@apple.com
- Date
- 2012-08-08 15:12:39 -0700 (Wed, 08 Aug 2012)
Log Message
Make isTransparentSilverlightBackgroundValue handle all the possible transparent colors
https://bugs.webkit.org/show_bug.cgi?id=93532
Reviewed by Simon Fraser.
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::isTransparentSilverlightBackgroundValue):
Check for all the possible transparent colors and assume that the color is opaque otherwise.
(WebKit::NetscapePlugin::initialize):
Pass the lowercase string to isTransparentSilverlightBackgroundValue.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (125097 => 125098)
--- trunk/Source/WebKit2/ChangeLog 2012-08-08 22:10:05 UTC (rev 125097)
+++ trunk/Source/WebKit2/ChangeLog 2012-08-08 22:12:39 UTC (rev 125098)
@@ -1,3 +1,17 @@
+2012-08-08 Anders Carlsson <ander...@apple.com>
+
+ Make isTransparentSilverlightBackgroundValue handle all the possible transparent colors
+ https://bugs.webkit.org/show_bug.cgi?id=93532
+
+ Reviewed by Simon Fraser.
+
+ * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+ (WebKit::isTransparentSilverlightBackgroundValue):
+ Check for all the possible transparent colors and assume that the color is opaque otherwise.
+
+ (WebKit::NetscapePlugin::initialize):
+ Pass the lowercase string to isTransparentSilverlightBackgroundValue.
+
2012-08-08 Beth Dakin <bda...@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=92275
Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp (125097 => 125098)
--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp 2012-08-08 22:10:05 UTC (rev 125097)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp 2012-08-08 22:12:39 UTC (rev 125098)
@@ -549,14 +549,34 @@
}
#if PLUGIN_ARCHITECTURE(MAC)
-static bool isTransparentSilverlightBackgroundValue(const String& backgroundValue)
+static bool isTransparentSilverlightBackgroundValue(const String& lowercaseBackgroundValue)
{
- // FIXME: We should handle all the cases from http://msdn.microsoft.com/en-us/library/cc838148(VS.95).aspx here
- // instead of just hard-coding black.
- if (backgroundValue == "#000000")
- return false;
+ // This checks if the background color value is transparent, according to
+ // the forumat documented at http://msdn.microsoft.com/en-us/library/cc838148(VS.95).aspx
+ if (lowercaseBackgroundValue.startsWith('#')) {
+ if (lowercaseBackgroundValue.length() == 5 && lowercaseBackgroundValue[1] != 'f') {
+ // An 8-bit RGB value with alpha transparency, in the form #ARGB.
+ return true;
+ }
- return true;
+ if (lowercaseBackgroundValue.length() == 9 && !(lowercaseBackgroundValue[1] == 'f' && lowercaseBackgroundValue[2] == 'f')) {
+ // A 16-bit RGB value with alpha transparency, in the form #AARRGGBB.
+ return true;
+ }
+ } else if (lowercaseBackgroundValue.startsWith("sc#")) {
+ Vector<String> components;
+ lowercaseBackgroundValue.substring(3).split(",", components);
+
+ // An ScRGB value with alpha transparency, in the form sc#A,R,G,B.
+ if (components.size() == 4) {
+ if (components[0].toDouble() < 1)
+ return true;
+ }
+ } else if (lowercaseBackgroundValue == "transparent")
+ return true;
+
+ // This is an opaque color.
+ return false;
}
#endif
@@ -596,7 +616,7 @@
if (m_pluginModule->pluginQuirks().contains(PluginQuirks::MakeOpaqueUnlessTransparentSilverlightBackgroundAttributeExists)) {
for (size_t i = 0; i < parameters.names.size(); ++i) {
if (equalIgnoringCase(parameters.names[i], "background")) {
- setIsTransparent(isTransparentSilverlightBackgroundValue(parameters.values[i]));
+ setIsTransparent(isTransparentSilverlightBackgroundValue(parameters.values[i].lower()));
break;
}
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes