LayoutTests:
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Aug 2006 06:13:20 +0000 (06:13 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Aug 2006 06:13:20 +0000 (06:13 +0000)
        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=10158
          REGRESSION: Selection highlight is dark and opaque when solid-color images are used

        Reviewed by Darin.

        * fast/backgrounds/solid-color-context-restore-expected.checksum: Added.
        * fast/backgrounds/solid-color-context-restore-expected.png: Added.
        * fast/backgrounds/solid-color-context-restore-expected.txt: Added.
        * fast/backgrounds/solid-color-context-restore.html: Added.

WebCore:

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=10158
          REGRESSION: Selection highlight is dark and opaque when solid-color images are used

        Reviewed by Darin.

        Pixel test: fast/backgrounds/solid-color-context-restore.html

        * platform/mac/ImageMac.mm:
        (WebCore::Image::draw): Added calls to preserve the graphics context
        around the painting of a solid color image.
        (WebCore::Image::drawTiled): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15733 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/backgrounds/solid-color-context-restore-expected.checksum [new file with mode: 0644]
LayoutTests/fast/backgrounds/solid-color-context-restore-expected.png [new file with mode: 0644]
LayoutTests/fast/backgrounds/solid-color-context-restore-expected.txt [new file with mode: 0644]
LayoutTests/fast/backgrounds/solid-color-context-restore.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/platform/mac/ImageMac.mm

index abff314e5949f1db2d2fbf24549c4a2172314e8f..20adccdd18783cb254c30c07032cf0c5edf8b5ff 100644 (file)
@@ -1,3 +1,15 @@
+2006-07-31  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=10158
+          REGRESSION: Selection highlight is dark and opaque when solid-color images are used
+
+        Reviewed by Darin.
+
+        * fast/backgrounds/solid-color-context-restore-expected.checksum: Added.
+        * fast/backgrounds/solid-color-context-restore-expected.png: Added.
+        * fast/backgrounds/solid-color-context-restore-expected.txt: Added.
+        * fast/backgrounds/solid-color-context-restore.html: Added.
+
 2006-07-31  Darin Adler  <darin@apple.com>
 
         Reviewed by Maciej.
diff --git a/LayoutTests/fast/backgrounds/solid-color-context-restore-expected.checksum b/LayoutTests/fast/backgrounds/solid-color-context-restore-expected.checksum
new file mode 100644 (file)
index 0000000..1408a3f
--- /dev/null
@@ -0,0 +1 @@
+d04a85690ef07ce117313108750cf56e
\ No newline at end of file
diff --git a/LayoutTests/fast/backgrounds/solid-color-context-restore-expected.png b/LayoutTests/fast/backgrounds/solid-color-context-restore-expected.png
new file mode 100644 (file)
index 0000000..382d1f7
Binary files /dev/null and b/LayoutTests/fast/backgrounds/solid-color-context-restore-expected.png differ
diff --git a/LayoutTests/fast/backgrounds/solid-color-context-restore-expected.txt b/LayoutTests/fast/backgrounds/solid-color-context-restore-expected.txt
new file mode 100644 (file)
index 0000000..6501bdc
--- /dev/null
@@ -0,0 +1,16 @@
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 750x18
+          text run at (0,0) width 445: "This tests that the graphics context is restored after painting solid color "
+          text run at (445,0) width 305: "images. The highlight color should be light blue."
+      RenderBlock {HR} at (0,34) size 784x2 [border: (1px inset #000000)]
+      RenderBlock {DIV} at (0,44) size 784x18
+        RenderText {#text} at (0,0) size 21x18
+          text run at (0,0) width 21: "foo"
+selection start: position 9 of child 0 {#text} of child 5 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+selection end:   position 12 of child 0 {#text} of child 5 {DIV} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/fast/backgrounds/solid-color-context-restore.html b/LayoutTests/fast/backgrounds/solid-color-context-restore.html
new file mode 100644 (file)
index 0000000..1c20b17
--- /dev/null
@@ -0,0 +1,23 @@
+<html>
+<head>
+    <style type="text/css">
+        #target { background: url(data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==); }
+    </style>
+</head>
+<body>
+    <p>
+        This tests that the graphics context is restored after painting solid color
+        images. The highlight color should be light blue.
+    </p>
+    <hr>
+    <div id="target">
+        foo
+    </div>
+    <script type="text/javascript">
+        if (window.layoutTestController)
+            layoutTestController.display();
+        target = document.getElementById('target');
+        window.getSelection().setBaseAndExtent(target, 0, target, 1);
+    </script>
+</body>
+</html>
index f447b137c09115cfc94b764f9cb770cd5c6d7544..33fa1d15aa19cd2cef97fbbb5507f456b68edf2f 100644 (file)
@@ -1,3 +1,17 @@
+2006-07-31  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=10158
+          REGRESSION: Selection highlight is dark and opaque when solid-color images are used
+
+        Reviewed by Darin.
+
+        Pixel test: fast/backgrounds/solid-color-context-restore.html
+
+        * platform/mac/ImageMac.mm:
+        (WebCore::Image::draw): Added calls to preserve the graphics context
+        around the painting of a solid color image.
+        (WebCore::Image::drawTiled): Ditto.
+
 2006-07-31  Maciej Stachowiak  <mjs@apple.com>
 
         Rubber-stamped by Tim Hatcher.
index c081c663e16aa65d47427086bf8578058a8c766d..9250d82f7243eea828b34f1d0d3c14f12aa3df17 100644 (file)
@@ -192,8 +192,10 @@ void Image::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const FloatRec
 
     if (m_isSolidColor && m_currentFrame == 0) {
         if (m_solidColor.alpha() > 0) {
+            ctxt->save();
             ctxt->setCompositeOperation(!m_solidColor.hasAlpha() && compositeOp == CompositeSourceOver ? CompositeCopy : compositeOp);
             ctxt->fillRect(ir, m_solidColor);
+            ctxt->restore();
         }
         return;
     }
@@ -277,8 +279,10 @@ void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const Fl
 
     if (m_isSolidColor && m_currentFrame == 0) {
         if (m_solidColor.alpha() > 0) {
+            ctxt->save();
             ctxt->setCompositeOperation(!m_solidColor.hasAlpha() && op == CompositeSourceOver ? CompositeCopy : op);
             ctxt->fillRect(destRect, m_solidColor);
+            ctxt->restore();
         }
         return;
     }
@@ -361,8 +365,10 @@ void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& dstRect, const Flo
 
     if (m_isSolidColor && m_currentFrame == 0) {
         if (m_solidColor.alpha() > 0) {
+            ctxt->save();
             ctxt->setCompositeOperation(!m_solidColor.hasAlpha() && op == CompositeSourceOver ? CompositeCopy : op);
             ctxt->fillRect(dstRect, m_solidColor);
+            ctxt->restore();
         }
         return;
     }