[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.16-1409-g5afdf4d
kevino at webkit.org
kevino at webkit.org
Thu Dec 3 13:38:07 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit ca9555add5f1850891704706b9e67807892d39eb
Author: kevino at webkit.org <kevino at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Nov 17 05:50:52 2009 +0000
Reviewed by Kevin Ollivier.
Make sure wx scrollbar drawing code factors in transforms when switching backends,
fix calcs for scrollbar length, and tweak the Mac scrollbar tracking rects.
https://bugs.webkit.org/show_bug.cgi?id=31570
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51065 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 02d0a1d..ac38f4b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+2009-11-16 Robin Dunn <robin at alldunn.com>
+
+ Reviewed by Kevin Ollivier.
+
+ Make sure wx scrollbar drawing code factors in transforms when switching backends,
+ fix calcs for scrollbar length, and tweak the Mac scrollbar tracking rects.
+
+ https://bugs.webkit.org/show_bug.cgi?id=31570
+
+ * platform/wx/ScrollbarThemeWx.cpp:
+ (WebCore::ScrollbarThemeWx::minimumThumbLength):
+ (WebCore::ScrollbarThemeWx::splitTrack):
+ (WebCore::ScrollbarThemeWx::forwardButtonRect):
+ * platform/wx/ScrollbarThemeWx.h:
+ * platform/wx/wxcode/gtk/scrollbar_render.cpp:
+ (wxRenderer_DrawScrollbar):
+ * platform/wx/wxcode/scrollbar_render.h:
+ (calcThumbStartAndLength):
+ * platform/wx/wxcode/win/scrollbar_render.cpp:
+ (wxRenderer_DrawScrollbar):
+
2009-11-16 Kent Tamura <tkent at chromium.org>
Reviewed by David Levin.
diff --git a/WebCore/platform/wx/ScrollbarThemeWx.cpp b/WebCore/platform/wx/ScrollbarThemeWx.cpp
index 6904f41..82e4a15 100644
--- a/WebCore/platform/wx/ScrollbarThemeWx.cpp
+++ b/WebCore/platform/wx/ScrollbarThemeWx.cpp
@@ -28,6 +28,7 @@
#include "HostWindow.h"
#include "NotImplemented.h"
+#include "PlatformMouseEvent.h"
#include "Scrollbar.h"
#include "ScrollbarClient.h"
#include "scrollbar_render.h"
@@ -70,6 +71,11 @@ bool ScrollbarThemeWx::hasThumb(Scrollbar* scrollbar)
return thumbLength(scrollbar) > 0;
}
+int ScrollbarThemeWx::minimumThumbLength(Scrollbar* scrollbar)
+{
+ return 20;
+}
+
IntSize ScrollbarThemeWx::buttonSize(Scrollbar*)
{
#ifdef __WXMAC__
@@ -79,6 +85,22 @@ IntSize ScrollbarThemeWx::buttonSize(Scrollbar*)
#endif
}
+void ScrollbarThemeWx::splitTrack(Scrollbar* scrollbar, const IntRect& unconstrainedTrackRect, IntRect& beforeThumbRect, IntRect& thumbRect, IntRect& afterThumbRect)
+{
+ ScrollbarThemeComposite::splitTrack(scrollbar, unconstrainedTrackRect, beforeThumbRect, thumbRect, afterThumbRect);
+#ifdef __WXMAC__
+ // on Mac, there are a few pixels drawn above the actual track and so adjust
+ // the hit testing rects accordingly
+ int trackStart = 10;
+ if (scrollbar->orientation() == HorizontalScrollbar) {
+ thumbRect.setX(thumbRect.x() + trackStart);
+ afterThumbRect.setX(afterThumbRect.x() - trackStart);
+ } else {
+ thumbRect.setY(thumbRect.y() + trackStart);
+ afterThumbRect.setY(afterThumbRect.y() - trackStart);
+ }
+#endif
+}
IntRect ScrollbarThemeWx::backButtonRect(Scrollbar* scrollbar, ScrollbarPart part, bool)
{
@@ -111,10 +133,16 @@ IntRect ScrollbarThemeWx::forwardButtonRect(Scrollbar* scrollbar, ScrollbarPart
IntSize size = buttonSize(scrollbar);
int x, y;
if (scrollbar->orientation() == HorizontalScrollbar) {
+#ifdef __WXMAC__
+ size.setWidth(size.width() + cMacButtonOverlap);
+#endif
x = scrollbar->x() + scrollbar->width() - size.width();
y = scrollbar->y();
} else {
x = scrollbar->x();
+#ifdef __WXMAC__
+ size.setHeight(size.height() + cMacButtonOverlap);
+#endif
y = scrollbar->y() + scrollbar->height() - size.height();
}
return IntRect(x, y, size.width(), size.height());
diff --git a/WebCore/platform/wx/ScrollbarThemeWx.h b/WebCore/platform/wx/ScrollbarThemeWx.h
index 2b3bff0..79b10b3 100644
--- a/WebCore/platform/wx/ScrollbarThemeWx.h
+++ b/WebCore/platform/wx/ScrollbarThemeWx.h
@@ -48,6 +48,10 @@ protected:
virtual IntRect backButtonRect(Scrollbar*, ScrollbarPart, bool painting = false);
virtual IntRect forwardButtonRect(Scrollbar*, ScrollbarPart, bool painting = false);
virtual IntRect trackRect(Scrollbar*, bool painting = false);
+
+ virtual void splitTrack(Scrollbar*, const IntRect& track, IntRect& startTrack, IntRect& thumb, IntRect& endTrack);
+
+ virtual int minimumThumbLength(Scrollbar*);
};
}
diff --git a/WebCore/platform/wx/wxcode/gtk/scrollbar_render.cpp b/WebCore/platform/wx/wxcode/gtk/scrollbar_render.cpp
index f74b076..3b4daa8 100644
--- a/WebCore/platform/wx/wxcode/gtk/scrollbar_render.cpp
+++ b/WebCore/platform/wx/wxcode/gtk/scrollbar_render.cpp
@@ -116,9 +116,18 @@ void wxRenderer_DrawScrollbar(wxWindow* window, wxDC& dc, const wxRect& rect, wx
dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW)));
dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
+ // when going from Cairo -> Gdk, any Cairo context transformations are lost
+ // so we need to alter the coordinates to reflect their transformed point.
+ double xtrans = 0;
+ double ytrans = 0;
+
+ wxGCDC* gcdc = wxDynamicCast(&dc, wxGCDC);
+ wxGraphicsContext* gc = gcdc->GetGraphicsContext();
+ gc->GetTransform().TransformPoint(&xtrans, &ytrans);
+
wxRendererNative& renderer = wxRendererNative::Get();
- int x = rect.x;
- int y = rect.y;
+ int x = rect.x + (int)xtrans;
+ int y = rect.y + (int)ytrans;
int buttonLength = 16;
@@ -138,13 +147,15 @@ void wxRenderer_DrawScrollbar(wxWindow* window, wxDC& dc, const wxRect& rect, wx
physicalLength -= buttonLength*2;
int thumbStart = 0;
int thumbLength = 0;
- calcThumbStartAndLength(physicalLength, max + step, current, step, &thumbStart, &thumbLength);
+ calcThumbStartAndLength(physicalLength, max, current, step, &thumbStart, &thumbLength);
if (horiz) {
- buttonRect.x = thumbStart + buttonLength;
+ buttonRect.x = x + thumbStart + buttonLength;
+ buttonRect.y = y;
buttonRect.width = thumbLength;
} else {
- buttonRect.y = thumbStart + buttonLength;
+ buttonRect.x = x;
+ buttonRect.y = y + thumbStart + buttonLength;
buttonRect.height = thumbLength;
}
diff --git a/WebCore/platform/wx/wxcode/scrollbar_render.h b/WebCore/platform/wx/wxcode/scrollbar_render.h
index 7a0ba1c..5e0ea8e 100644
--- a/WebCore/platform/wx/wxcode/scrollbar_render.h
+++ b/WebCore/platform/wx/wxcode/scrollbar_render.h
@@ -50,16 +50,17 @@ void wxRenderer_DrawScrollbar(wxWindow* window, wxDC& dc,
int current, wxScrollbarPart focusPart, wxScrollbarPart hoverPart,
int max, int step, int flags=0);
-inline void calcThumbStartAndLength(int physicalLength, int virtualLength, int current,
+inline void calcThumbStartAndLength(int physicalLength, int max, int current,
int step, int *thumbStart, int *thumbLength)
{
- float proportion = (float)physicalLength / virtualLength;
- float scale = (float)virtualLength / physicalLength;
- int thumbSize = proportion * physicalLength;
- int currentPos = current / scale;
-
+ float proportion = ((float)physicalLength - 8)/ (max + step);
+ float thumbSize = proportion * (float)physicalLength;
+ if (thumbSize < 20)
+ thumbSize = 20;
+
+ float thumbPos = ((float)current / (float)max) * ((float)physicalLength - thumbSize);
if (thumbStart)
- *thumbStart = currentPos;
+ *thumbStart = thumbPos;
if (thumbLength)
*thumbLength = thumbSize;
diff --git a/WebCore/platform/wx/wxcode/win/scrollbar_render.cpp b/WebCore/platform/wx/wxcode/win/scrollbar_render.cpp
index 4d6bbc0..890db00 100644
--- a/WebCore/platform/wx/wxcode/win/scrollbar_render.cpp
+++ b/WebCore/platform/wx/wxcode/win/scrollbar_render.cpp
@@ -30,6 +30,8 @@
#include <wx/defs.h>
#include <wx/dc.h>
+#include <wx/dcgraph.h>
+#include <wx/graphics.h>
#include <wx/renderer.h>
#include <wx/window.h>
@@ -131,8 +133,24 @@ void wxRenderer_DrawScrollbar(wxWindow* window, wxDC& dc,
part = SP_TRACKENDVERT;
int xpState = TS_NORMAL;
+ wxRect transRect = rect;
+
+#if USE(WXGC)
+ // when going from GdiPlus -> Gdi, any GdiPlus transformations are lost
+ // so we need to alter the coordinates to reflect their transformed point.
+ double xtrans = 0;
+ double ytrans = 0;
+
+ wxGCDC* gcdc = wxDynamicCast(&dc, wxGCDC);
+ wxGraphicsContext* gc = gcdc->GetGraphicsContext();
+ gc->GetTransform().TransformPoint(&xtrans, &ytrans);
+
+ transRect.x += (int)xtrans;
+ transRect.y += (int)ytrans;
+#endif
+
RECT r;
- wxCopyRectToRECT(rect, r);
+ wxCopyRectToRECT(transRect, r);
// Unlike Mac, on MSW you draw the scrollbar piece by piece.
// so we draw the track first, then the buttons
@@ -163,14 +181,14 @@ void wxRenderer_DrawScrollbar(wxWindow* window, wxDC& dc,
physicalLength -= buttonSize*2;
int thumbStart = 0;
int thumbLength = 0;
- calcThumbStartAndLength(physicalLength, max + step,
+ calcThumbStartAndLength(physicalLength, max,
current, step, &thumbStart, &thumbLength);
buttonRect = r;
if (horiz) {
- buttonRect.left = thumbStart + buttonSize;
+ buttonRect.left = buttonRect.left + thumbStart + buttonSize;
buttonRect.right = buttonRect.left + thumbLength;
} else {
- buttonRect.top = thumbStart + buttonSize;
+ buttonRect.top = buttonRect.top + thumbStart + buttonSize;
buttonRect.bottom = buttonRect.top + thumbLength;
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list