[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e
carlosgc at webkit.org
carlosgc at webkit.org
Fri Jan 21 15:13:51 UTC 2011
The following commit has been merged in the debian/experimental branch:
commit 2c84d1f166c2afec760e7483d7d68d964347f8f2
Author: carlosgc at webkit.org <carlosgc at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Jan 10 09:09:42 2011 +0000
2011-01-10 Carlos Garcia Campos <cgarcia at igalia.com>
Reviewed by Martin Robinson.
[GTK] Port progressbar painting to GtkStyleContext
https://bugs.webkit.org/show_bug.cgi?id=52054
Use GtkStyleContext API to paint progressbars when building with
GTK+ 3.x. Also add support for indeterminate progressbars.
No new tests. This should not change functionality.
* platform/gtk/RenderThemeGtk.cpp:
* platform/gtk/RenderThemeGtk2.cpp:
(WebCore::RenderThemeGtk::animationRepeatIntervalForProgressBar):
(WebCore::RenderThemeGtk::animationDurationForProgressBar):
* platform/gtk/RenderThemeGtk3.cpp:
(WebCore::RenderThemeGtk::animationRepeatIntervalForProgressBar):
(WebCore::RenderThemeGtk::animationDurationForProgressBar):
(WebCore::RenderThemeGtk::paintProgressBar):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75364 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 1ba9910..f9ba447 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+2011-01-10 Carlos Garcia Campos <cgarcia at igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Port progressbar painting to GtkStyleContext
+ https://bugs.webkit.org/show_bug.cgi?id=52054
+
+ Use GtkStyleContext API to paint progressbars when building with
+ GTK+ 3.x. Also add support for indeterminate progressbars.
+
+ No new tests. This should not change functionality.
+
+ * platform/gtk/RenderThemeGtk.cpp:
+ * platform/gtk/RenderThemeGtk2.cpp:
+ (WebCore::RenderThemeGtk::animationRepeatIntervalForProgressBar):
+ (WebCore::RenderThemeGtk::animationDurationForProgressBar):
+ * platform/gtk/RenderThemeGtk3.cpp:
+ (WebCore::RenderThemeGtk::animationRepeatIntervalForProgressBar):
+ (WebCore::RenderThemeGtk::animationDurationForProgressBar):
+ (WebCore::RenderThemeGtk::paintProgressBar):
+
2011-01-10 Andreas Kling <kling at webkit.org>
Reviewed by Darin Adler.
diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk.cpp b/Source/WebCore/platform/gtk/RenderThemeGtk.cpp
index c194946..6a4029e 100644
--- a/Source/WebCore/platform/gtk/RenderThemeGtk.cpp
+++ b/Source/WebCore/platform/gtk/RenderThemeGtk.cpp
@@ -575,20 +575,6 @@ bool RenderThemeGtk::paintMediaCurrentTime(RenderObject* renderObject, const Pai
#endif
#if ENABLE(PROGRESS_TAG)
-double RenderThemeGtk::animationRepeatIntervalForProgressBar(RenderProgress*) const
-{
- // FIXME: It doesn't look like there is a good way yet to support animated
- // progress bars with the Mozilla theme drawing code.
- return 0;
-}
-
-double RenderThemeGtk::animationDurationForProgressBar(RenderProgress*) const
-{
- // FIXME: It doesn't look like there is a good way yet to support animated
- // progress bars with the Mozilla theme drawing code.
- return 0;
-}
-
void RenderThemeGtk::adjustProgressBarStyle(CSSStyleSelector*, RenderStyle* style, Element*) const
{
style->setBoxShadow(0);
diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp b/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp
index fd391b7..623b970 100644
--- a/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp
+++ b/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp
@@ -330,6 +330,20 @@ void RenderThemeGtk::adjustSliderThumbSize(RenderObject* o) const
}
#if ENABLE(PROGRESS_TAG)
+double RenderThemeGtk::animationRepeatIntervalForProgressBar(RenderProgress*) const
+{
+ // FIXME: It doesn't look like there is a good way yet to support animated
+ // progress bars with the Mozilla theme drawing code.
+ return 0;
+}
+
+double RenderThemeGtk::animationDurationForProgressBar(RenderProgress*) const
+{
+ // FIXME: It doesn't look like there is a good way yet to support animated
+ // progress bars with the Mozilla theme drawing code.
+ return 0;
+}
+
bool RenderThemeGtk::paintProgressBar(RenderObject* renderObject, const PaintInfo& paintInfo, const IntRect& rect)
{
if (!renderObject->isProgress())
diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp b/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp
index 663404d..0e3011f 100644
--- a/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp
+++ b/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp
@@ -436,31 +436,67 @@ void RenderThemeGtk::adjustSliderThumbSize(RenderObject* renderObject) const
}
#if ENABLE(PROGRESS_TAG)
+// These values have been copied from RenderThemeChromiumSkia.cpp
+static const int progressActivityBlocks = 5;
+static const int progressAnimationFrames = 10;
+static const double progressAnimationInterval = 0.125;
+double RenderThemeGtk::animationRepeatIntervalForProgressBar(RenderProgress*) const
+{
+ return progressAnimationInterval;
+}
+
+double RenderThemeGtk::animationDurationForProgressBar(RenderProgress*) const
+{
+ return progressAnimationInterval * progressAnimationFrames * 2; // "2" for back and forth;
+}
+
bool RenderThemeGtk::paintProgressBar(RenderObject* renderObject, const PaintInfo& paintInfo, const IntRect& rect)
{
if (!renderObject->isProgress())
return true;
- GtkWidget* progressBarWidget = moz_gtk_get_progress_widget();
- if (!progressBarWidget)
- return true;
+ GtkStyleContext* context = getStyleContext(GTK_TYPE_PROGRESS_BAR);
+ gtk_style_context_save(context);
- if (paintRenderObject(MOZ_GTK_PROGRESSBAR, renderObject, paintInfo.context, rect))
- return true;
+ gtk_style_context_add_class(context, GTK_STYLE_CLASS_TROUGH);
+
+ gtk_render_background(context, paintInfo.context->platformContext(), rect.x(), rect.y(), rect.width(), rect.height());
+ gtk_render_frame(context, paintInfo.context->platformContext(), rect.x(), rect.y(), rect.width(), rect.height());
+
+ gtk_style_context_restore(context);
+
+ gtk_style_context_save(context);
+ gtk_style_context_add_class(context, GTK_STYLE_CLASS_PROGRESSBAR);
- IntRect chunkRect(rect);
RenderProgress* renderProgress = toRenderProgress(renderObject);
- GtkStyle* style = gtk_widget_get_style(progressBarWidget);
- chunkRect.setHeight(chunkRect.height() - (2 * style->ythickness));
- chunkRect.setY(chunkRect.y() + style->ythickness);
- chunkRect.setWidth((chunkRect.width() - (2 * style->xthickness)) * renderProgress->position());
- if (renderObject->style()->direction() == RTL)
- chunkRect.setX(rect.x() + rect.width() - chunkRect.width() - style->xthickness);
- else
- chunkRect.setX(chunkRect.x() + style->xthickness);
+ GtkBorder padding;
+ gtk_style_context_get_padding(context, static_cast<GtkStateFlags>(0), &padding);
+ IntRect progressRect(rect.x() + padding.left, rect.y() + padding.top,
+ rect.width() - (padding.left + padding.right),
+ rect.height() - (padding.top + padding.bottom));
+
+ if (renderProgress->isDeterminate()) {
+ progressRect.setWidth(progressRect.width() * renderProgress->position());
+ if (renderObject->style()->direction() == RTL)
+ progressRect.setX(rect.x() + rect.width() - progressRect.width() - padding.right);
+ } else {
+ double animationProgress = renderProgress->animationProgress();
+
+ progressRect.setWidth(max(2, progressRect.width() / progressActivityBlocks));
+ int movableWidth = rect.width() - progressRect.width();
+ if (animationProgress < 0.5)
+ progressRect.setX(progressRect.x() + (animationProgress * 2 * movableWidth));
+ else
+ progressRect.setX(progressRect.x() + ((1.0 - animationProgress) * 2 * movableWidth));
+ }
+
+ if (!progressRect.isEmpty())
+ gtk_render_activity(context, paintInfo.context->platformContext(), progressRect.x(), progressRect.y(), progressRect.width(), progressRect.height());
- return paintRenderObject(MOZ_GTK_PROGRESS_CHUNK, renderObject, paintInfo.context, chunkRect);
+ gtk_style_context_restore(context);
+
+ return false;
}
#endif
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list