[GTK] Progress bar is broken on recent GTK+
authorchangseok.oh@collabora.com <changseok.oh@collabora.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Oct 2015 07:32:14 +0000 (07:32 +0000)
committerchangseok.oh@collabora.com <changseok.oh@collabora.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Oct 2015 07:32:14 +0000 (07:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=149831

Reviewed by Carlos Garcia Campos.

Source/WebCore:

The gtk progress bar has been broken after bumping up to Gtk+-3.16. This is because
the way of rendering progress bar changed after gtk+-3.13.7. See more
https://mail.gnome.org/archives/commits-list/2014-August/msg03865.html
gtk_render_activity is no longer valid to paint a progress bar on a newer gtk+.
It should be done with gtk_render_background and gtk_render_frame.

Test: fast/dom/HTMLProgressElement/native-progress-bar.html

* rendering/RenderThemeGtk.cpp:
(WebCore::RenderThemeGtk::paintProgressBar):

LayoutTests:

* fast/dom/HTMLProgressElement/native-progress-bar.html: Added.
* platform/gtk/fast/dom/HTMLProgressElement/native-progress-bar-expected.png: Added.
* platform/gtk/fast/dom/HTMLProgressElement/native-progress-bar-expected.txt: Added.
* platform/mac/fast/dom/HTMLProgressElement/native-progress-bar-expected.png: Added.
* platform/mac/fast/dom/HTMLProgressElement/native-progress-bar-expected.txt: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/dom/HTMLProgressElement/native-progress-bar.html [new file with mode: 0644]
LayoutTests/platform/gtk/fast/dom/HTMLProgressElement/native-progress-bar-expected.png [new file with mode: 0644]
LayoutTests/platform/gtk/fast/dom/HTMLProgressElement/native-progress-bar-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/dom/HTMLProgressElement/native-progress-bar-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/dom/HTMLProgressElement/native-progress-bar-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderThemeGtk.cpp

index fa9d5e3..02d3464 100644 (file)
@@ -1,3 +1,16 @@
+2015-10-07  ChangSeok Oh  <changseok.oh@collabora.com>
+
+        [GTK] Progress bar is broken on recent GTK+
+        https://bugs.webkit.org/show_bug.cgi?id=149831
+
+        Reviewed by Carlos Garcia Campos.
+
+        * fast/dom/HTMLProgressElement/native-progress-bar.html: Added.
+        * platform/gtk/fast/dom/HTMLProgressElement/native-progress-bar-expected.png: Added.
+        * platform/gtk/fast/dom/HTMLProgressElement/native-progress-bar-expected.txt: Added.
+        * platform/mac/fast/dom/HTMLProgressElement/native-progress-bar-expected.png: Added.
+        * platform/mac/fast/dom/HTMLProgressElement/native-progress-bar-expected.txt: Added.
+
 2015-10-06  Jon Honeycutt  <jhoneycutt@apple.com>
 
         Unreviewed iOS test gardening after r190629.
diff --git a/LayoutTests/fast/dom/HTMLProgressElement/native-progress-bar.html b/LayoutTests/fast/dom/HTMLProgressElement/native-progress-bar.html
new file mode 100644 (file)
index 0000000..c899915
--- /dev/null
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<p>Test passes if following bars are filled 30% with a color.<p>
+<progress value="30" max="100"></progress><br>
+<progress value="30" max="100" style="-webkit-appearance:none;"></progress>
diff --git a/LayoutTests/platform/gtk/fast/dom/HTMLProgressElement/native-progress-bar-expected.png b/LayoutTests/platform/gtk/fast/dom/HTMLProgressElement/native-progress-bar-expected.png
new file mode 100644 (file)
index 0000000..cf76d8d
Binary files /dev/null and b/LayoutTests/platform/gtk/fast/dom/HTMLProgressElement/native-progress-bar-expected.png differ
diff --git a/LayoutTests/platform/gtk/fast/dom/HTMLProgressElement/native-progress-bar-expected.txt b/LayoutTests/platform/gtk/fast/dom/HTMLProgressElement/native-progress-bar-expected.txt
new file mode 100644 (file)
index 0000000..d0f1443
--- /dev/null
@@ -0,0 +1,16 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x99
+  RenderBlock {HTML} at (0,0) size 800x99
+    RenderBody {BODY} at (8,16) size 784x67
+      RenderBlock {P} at (0,0) size 784x17
+        RenderText {#text} at (0,0) size 354x17
+          text run at (0,0) width 354: "Test passes if following bars are filled 30% with a color."
+      RenderBlock {P} at (0,33) size 784x34
+        RenderProgress {PROGRESS} at (0,1) size 160x17
+        RenderBR {BR} at (160,0) size 0x17
+        RenderBlock {PROGRESS} at (0,18) size 160x17
+          RenderProgress {DIV} at (0,0) size 160x16
+            RenderBlock {DIV} at (0,0) size 160x16 [bgcolor=#808080]
+              RenderBlock {DIV} at (0,0) size 48x16 [bgcolor=#008000]
+        RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/dom/HTMLProgressElement/native-progress-bar-expected.png b/LayoutTests/platform/mac/fast/dom/HTMLProgressElement/native-progress-bar-expected.png
new file mode 100644 (file)
index 0000000..a2cbdc3
Binary files /dev/null and b/LayoutTests/platform/mac/fast/dom/HTMLProgressElement/native-progress-bar-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/dom/HTMLProgressElement/native-progress-bar-expected.txt b/LayoutTests/platform/mac/fast/dom/HTMLProgressElement/native-progress-bar-expected.txt
new file mode 100644 (file)
index 0000000..e29d398
--- /dev/null
@@ -0,0 +1,16 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x105
+  RenderBlock {HTML} at (0,0) size 800x105
+    RenderBody {BODY} at (8,16) size 784x73
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 360x18
+          text run at (0,0) width 360: "Test passes if following bars are filled 30% with a color."
+      RenderBlock {P} at (0,34) size 784x39
+        RenderProgress {PROGRESS} at (0,-1) size 160x22
+        RenderBR {BR} at (160,3) size 0x18
+        RenderBlock {PROGRESS} at (0,22) size 160x17
+          RenderProgress {DIV} at (0,0) size 160x16
+            RenderBlock {DIV} at (0,0) size 160x16 [bgcolor=#808080]
+              RenderBlock {DIV} at (0,0) size 48x16 [bgcolor=#008000]
+        RenderText {#text} at (0,0) size 0x0
index 0038048..47b4ff8 100644 (file)
@@ -1,3 +1,21 @@
+2015-10-07  ChangSeok Oh  <changseok.oh@collabora.com>
+
+        [GTK] Progress bar is broken on recent GTK+
+        https://bugs.webkit.org/show_bug.cgi?id=149831
+
+        Reviewed by Carlos Garcia Campos.
+
+        The gtk progress bar has been broken after bumping up to Gtk+-3.16. This is because
+        the way of rendering progress bar changed after gtk+-3.13.7. See more
+        https://mail.gnome.org/archives/commits-list/2014-August/msg03865.html
+        gtk_render_activity is no longer valid to paint a progress bar on a newer gtk+.
+        It should be done with gtk_render_background and gtk_render_frame.
+
+        Test: fast/dom/HTMLProgressElement/native-progress-bar.html
+
+        * rendering/RenderThemeGtk.cpp:
+        (WebCore::RenderThemeGtk::paintProgressBar):
+
 2015-10-06  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         [GTK] Add autocleanups
index 163039f..7a2ae9b 100644 (file)
@@ -1192,8 +1192,14 @@ bool RenderThemeGtk::paintProgressBar(const RenderObject& renderObject, const Pa
         rect.height() - (padding.top + padding.bottom));
     progressRect = RenderThemeGtk::calculateProgressRect(renderObject, progressRect);
 
-    if (!progressRect.isEmpty())
+    if (!progressRect.isEmpty()) {
+#if GTK_CHECK_VERSION(3, 13, 7)
+        gtk_render_background(context, paintInfo.context().platformContext()->cr(), progressRect.x(), progressRect.y(), progressRect.width(), progressRect.height());
+        gtk_render_frame(context, paintInfo.context().platformContext()->cr(), progressRect.x(), progressRect.y(), progressRect.width(), progressRect.height());
+#else
         gtk_render_activity(context, paintInfo.context().platformContext()->cr(), progressRect.x(), progressRect.y(), progressRect.width(), progressRect.height());
+#endif
+    }
 
     gtk_style_context_restore(context);
     return false;