[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

robert at webkit.org robert at webkit.org
Wed Dec 22 15:32:39 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit a80830dd26f8dcf2a9b3f6c713a1cafc9b29397e
Author: robert at webkit.org <robert at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Nov 7 15:25:52 2010 +0000

    2010-11-07  Robert Hogan  <robert at webkit.org>
    
            Reviewed by Andreas Kling.
    
            [qt] screenDepthPerComponent returns the wrong value
    
            Return best estimate of the number of bits per color
            rather than screen depth.
    
            Add a layout test to sanity check screenDepthPerComponent.
    
            https://bugs.webkit.org/show_bug.cgi?id=20289
    
            * fast/css/media-rule-screenDepthPerComponent-expected.txt: Added.
            * fast/css/media-rule-screenDepthPerComponent.html: Added.
    2010-11-07  Robert Hogan  <robert at webkit.org>
    
            Reviewed by Andreas Kling.
    
            [qt] screenDepthPerComponent returns the wrong value
    
            Return best estimate of the number of bits per color
            rather than screen depth.
    
            Add a layout test to sanity check screenDepthPerComponent.
    
            https://bugs.webkit.org/show_bug.cgi?id=20289
    
            Test: fast/css/media-rule-screenDepthPerComponent.html
    
            * platform/qt/PlatformScreenQt.cpp:
            (WebCore::screenDepthPerComponent):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71483 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 15b4931..f0b31e0 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,19 @@
+2010-11-07  Robert Hogan  <robert at webkit.org>
+
+        Reviewed by Andreas Kling.
+
+        [qt] screenDepthPerComponent returns the wrong value
+
+        Return best estimate of the number of bits per color
+        rather than screen depth.
+
+        Add a layout test to sanity check screenDepthPerComponent.
+
+        https://bugs.webkit.org/show_bug.cgi?id=20289
+
+        * fast/css/media-rule-screenDepthPerComponent-expected.txt: Added.
+        * fast/css/media-rule-screenDepthPerComponent.html: Added.
+
 2010-11-07  Andreas Kling  <kling at webkit.org>
 
         Unreviewed, rebaselining failures on Leopard and Snow Leopard after r71481.
diff --git a/LayoutTests/fast/css/media-rule-screenDepthPerComponent-expected.txt b/LayoutTests/fast/css/media-rule-screenDepthPerComponent-expected.txt
new file mode 100644
index 0000000..530cd24
--- /dev/null
+++ b/LayoutTests/fast/css/media-rule-screenDepthPerComponent-expected.txt
@@ -0,0 +1,5 @@
+https://bugs.webkit.org/show_bug.cgi?id=20289
+
+Sanity check screenDepthPerComponent to ensure it is returning the number of bits per color rather than the screen depth (e.g. 24).
+Should be rgb(0, 0, 0): rgb(0, 0, 0)
+Should be rgb(0, 128, 0): rgb(0, 128, 0)
diff --git a/LayoutTests/fast/css/media-rule-screenDepthPerComponent.html b/LayoutTests/fast/css/media-rule-screenDepthPerComponent.html
new file mode 100644
index 0000000..41a1339
--- /dev/null
+++ b/LayoutTests/fast/css/media-rule-screenDepthPerComponent.html
@@ -0,0 +1,27 @@
+<html>
+    <head>
+        <style id="style1">
+            @media all and (min-color: 24) { .insane { color: green; } }
+            @media all and (min-color: 2) { .sane { color: green; } }
+        </style>
+        <script>
+            function runTest() {
+                if (window.layoutTestController)
+                    layoutTestController.dumpAsText();
+
+                try {
+                    document.getElementById('result').innerHTML += window.getComputedStyle(document.getElementById('result')).getPropertyValue("color");
+                    document.getElementById('result2').innerHTML += window.getComputedStyle(document.getElementById('result2')).getPropertyValue("color");
+                } catch (e) {
+                    document.getElementById('result').innerHTML = 'EXCEPTION';
+                }
+            }
+        </script>
+    </head>
+    <body onload="runTest();">
+        <p> https://bugs.webkit.org/show_bug.cgi?id=20289 </p>
+        Sanity check screenDepthPerComponent to ensure it is returning the number of bits per color rather than the screen depth (e.g. 24).
+        <div class="insane" id="result">Should be rgb(0, 0, 0): </div>
+        <div class="sane" id="result2">Should be rgb(0, 128, 0): </div>
+    </body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e8f0e69..4891390 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2010-11-07  Robert Hogan  <robert at webkit.org>
+
+        Reviewed by Andreas Kling.
+
+        [qt] screenDepthPerComponent returns the wrong value
+
+        Return best estimate of the number of bits per color
+        rather than screen depth.
+
+        Add a layout test to sanity check screenDepthPerComponent.
+
+        https://bugs.webkit.org/show_bug.cgi?id=20289
+
+        Test: fast/css/media-rule-screenDepthPerComponent.html
+
+        * platform/qt/PlatformScreenQt.cpp:
+        (WebCore::screenDepthPerComponent):
+
 2010-11-07  Chang Shu  <chang.shu at nokia.com>
 
         Reviewed by Antonio Gomes.
diff --git a/WebCore/platform/qt/PlatformScreenQt.cpp b/WebCore/platform/qt/PlatformScreenQt.cpp
index 8221760..db34e21 100644
--- a/WebCore/platform/qt/PlatformScreenQt.cpp
+++ b/WebCore/platform/qt/PlatformScreenQt.cpp
@@ -58,16 +58,30 @@ int screenDepth(Widget* w)
 
 int screenDepthPerComponent(Widget* w)
 {
+    int depth = QApplication::desktop()->screen(0)->depth();
     if (w) {
         QWebPageClient* client = w->root()->hostWindow()->platformPageClient();
 
         if (client) {
             QWidget* view = client->ownerWidget();
             if (view)
-                return view->depth();
+                depth = view->depth();
         }
     }
-    return QApplication::desktop()->screen(0)->depth();
+    // An interface to establish the actual number of bits per color
+    // doesn't exist in Qt, or probably at all, so use common-sense
+    // values for each screen depth and assume RGB/RGBA where appropriate.
+    // Per http://www.w3.org/TR/css3-mediaqueries/#color, 'If different color
+    // components are represented by different number of bits, the smallest
+    // number is used.'
+    switch (depth) {
+    case 8:
+        return 2;
+    case 32:
+        return 8;
+    default:
+        return qRound(depth / 3);
+    }
 }
 
 bool screenIsMonochrome(Widget* w)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list