Changeset 51065 in webkit
- Timestamp:
- Nov 16, 2009 9:50:52 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r51063 r51065 1 2009-11-16 Robin Dunn <robin@alldunn.com> 2 3 Reviewed by Kevin Ollivier. 4 5 Make sure wx scrollbar drawing code factors in transforms when switching backends, 6 fix calcs for scrollbar length, and tweak the Mac scrollbar tracking rects. 7 8 https://bugs.webkit.org/show_bug.cgi?id=31570 9 10 * platform/wx/ScrollbarThemeWx.cpp: 11 (WebCore::ScrollbarThemeWx::minimumThumbLength): 12 (WebCore::ScrollbarThemeWx::splitTrack): 13 (WebCore::ScrollbarThemeWx::forwardButtonRect): 14 * platform/wx/ScrollbarThemeWx.h: 15 * platform/wx/wxcode/gtk/scrollbar_render.cpp: 16 (wxRenderer_DrawScrollbar): 17 * platform/wx/wxcode/scrollbar_render.h: 18 (calcThumbStartAndLength): 19 * platform/wx/wxcode/win/scrollbar_render.cpp: 20 (wxRenderer_DrawScrollbar): 21 1 22 2009-11-16 Kent Tamura <tkent@chromium.org> 2 23 -
trunk/WebCore/platform/wx/ScrollbarThemeWx.cpp
r48511 r51065 29 29 #include "HostWindow.h" 30 30 #include "NotImplemented.h" 31 #include "PlatformMouseEvent.h" 31 32 #include "Scrollbar.h" 32 33 #include "ScrollbarClient.h" … … 71 72 } 72 73 74 int ScrollbarThemeWx::minimumThumbLength(Scrollbar* scrollbar) 75 { 76 return 20; 77 } 78 73 79 IntSize ScrollbarThemeWx::buttonSize(Scrollbar*) 74 80 { … … 80 86 } 81 87 88 void ScrollbarThemeWx::splitTrack(Scrollbar* scrollbar, const IntRect& unconstrainedTrackRect, IntRect& beforeThumbRect, IntRect& thumbRect, IntRect& afterThumbRect) 89 { 90 ScrollbarThemeComposite::splitTrack(scrollbar, unconstrainedTrackRect, beforeThumbRect, thumbRect, afterThumbRect); 91 #ifdef __WXMAC__ 92 // on Mac, there are a few pixels drawn above the actual track and so adjust 93 // the hit testing rects accordingly 94 int trackStart = 10; 95 if (scrollbar->orientation() == HorizontalScrollbar) { 96 thumbRect.setX(thumbRect.x() + trackStart); 97 afterThumbRect.setX(afterThumbRect.x() - trackStart); 98 } else { 99 thumbRect.setY(thumbRect.y() + trackStart); 100 afterThumbRect.setY(afterThumbRect.y() - trackStart); 101 } 102 #endif 103 } 82 104 83 105 IntRect ScrollbarThemeWx::backButtonRect(Scrollbar* scrollbar, ScrollbarPart part, bool) … … 112 134 int x, y; 113 135 if (scrollbar->orientation() == HorizontalScrollbar) { 136 #ifdef __WXMAC__ 137 size.setWidth(size.width() + cMacButtonOverlap); 138 #endif 114 139 x = scrollbar->x() + scrollbar->width() - size.width(); 115 140 y = scrollbar->y(); 116 141 } else { 117 142 x = scrollbar->x(); 143 #ifdef __WXMAC__ 144 size.setHeight(size.height() + cMacButtonOverlap); 145 #endif 118 146 y = scrollbar->y() + scrollbar->height() - size.height(); 119 147 } -
trunk/WebCore/platform/wx/ScrollbarThemeWx.h
r48029 r51065 49 49 virtual IntRect forwardButtonRect(Scrollbar*, ScrollbarPart, bool painting = false); 50 50 virtual IntRect trackRect(Scrollbar*, bool painting = false); 51 52 virtual void splitTrack(Scrollbar*, const IntRect& track, IntRect& startTrack, IntRect& thumb, IntRect& endTrack); 53 54 virtual int minimumThumbLength(Scrollbar*); 51 55 }; 52 56 -
trunk/WebCore/platform/wx/wxcode/gtk/scrollbar_render.cpp
r48472 r51065 117 117 dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height); 118 118 119 // when going from Cairo -> Gdk, any Cairo context transformations are lost 120 // so we need to alter the coordinates to reflect their transformed point. 121 double xtrans = 0; 122 double ytrans = 0; 123 124 wxGCDC* gcdc = wxDynamicCast(&dc, wxGCDC); 125 wxGraphicsContext* gc = gcdc->GetGraphicsContext(); 126 gc->GetTransform().TransformPoint(&xtrans, &ytrans); 127 119 128 wxRendererNative& renderer = wxRendererNative::Get(); 120 int x = rect.x ;121 int y = rect.y ;129 int x = rect.x + (int)xtrans; 130 int y = rect.y + (int)ytrans; 122 131 123 132 int buttonLength = 16; … … 139 148 int thumbStart = 0; 140 149 int thumbLength = 0; 141 calcThumbStartAndLength(physicalLength, max + step, current, step, &thumbStart, &thumbLength);150 calcThumbStartAndLength(physicalLength, max, current, step, &thumbStart, &thumbLength); 142 151 143 152 if (horiz) { 144 buttonRect.x = thumbStart + buttonLength; 153 buttonRect.x = x + thumbStart + buttonLength; 154 buttonRect.y = y; 145 155 buttonRect.width = thumbLength; 146 156 } else { 147 buttonRect.y = thumbStart + buttonLength; 157 buttonRect.x = x; 158 buttonRect.y = y + thumbStart + buttonLength; 148 159 buttonRect.height = thumbLength; 149 160 } -
trunk/WebCore/platform/wx/wxcode/scrollbar_render.h
r48029 r51065 51 51 int max, int step, int flags=0); 52 52 53 inline void calcThumbStartAndLength(int physicalLength, int virtualLength, int current,53 inline void calcThumbStartAndLength(int physicalLength, int max, int current, 54 54 int step, int *thumbStart, int *thumbLength) 55 55 { 56 float proportion = (float)physicalLength / virtualLength; 57 float scale = (float)virtualLength / physicalLength; 58 int thumbSize = proportion * physicalLength; 59 int currentPos = current / scale; 60 56 float proportion = ((float)physicalLength - 8)/ (max + step); 57 float thumbSize = proportion * (float)physicalLength; 58 if (thumbSize < 20) 59 thumbSize = 20; 60 61 float thumbPos = ((float)current / (float)max) * ((float)physicalLength - thumbSize); 61 62 if (thumbStart) 62 *thumbStart = currentPos;63 *thumbStart = thumbPos; 63 64 64 65 if (thumbLength) -
trunk/WebCore/platform/wx/wxcode/win/scrollbar_render.cpp
r48029 r51065 31 31 32 32 #include <wx/dc.h> 33 #include <wx/dcgraph.h> 34 #include <wx/graphics.h> 33 35 #include <wx/renderer.h> 34 36 #include <wx/window.h> … … 132 134 133 135 int xpState = TS_NORMAL; 136 wxRect transRect = rect; 137 138 #if USE(WXGC) 139 // when going from GdiPlus -> Gdi, any GdiPlus transformations are lost 140 // so we need to alter the coordinates to reflect their transformed point. 141 double xtrans = 0; 142 double ytrans = 0; 143 144 wxGCDC* gcdc = wxDynamicCast(&dc, wxGCDC); 145 wxGraphicsContext* gc = gcdc->GetGraphicsContext(); 146 gc->GetTransform().TransformPoint(&xtrans, &ytrans); 147 148 transRect.x += (int)xtrans; 149 transRect.y += (int)ytrans; 150 #endif 151 134 152 RECT r; 135 wxCopyRectToRECT( rect, r);153 wxCopyRectToRECT(transRect, r); 136 154 137 155 // Unlike Mac, on MSW you draw the scrollbar piece by piece. … … 164 182 int thumbStart = 0; 165 183 int thumbLength = 0; 166 calcThumbStartAndLength(physicalLength, max + step,184 calcThumbStartAndLength(physicalLength, max, 167 185 current, step, &thumbStart, &thumbLength); 168 186 buttonRect = r; 169 187 if (horiz) { 170 buttonRect.left = thumbStart + buttonSize;188 buttonRect.left = buttonRect.left + thumbStart + buttonSize; 171 189 buttonRect.right = buttonRect.left + thumbLength; 172 190 } else { 173 buttonRect.top = thumbStart + buttonSize;191 buttonRect.top = buttonRect.top + thumbStart + buttonSize; 174 192 buttonRect.bottom = buttonRect.top + thumbLength; 175 193 }
Note: See TracChangeset
for help on using the changeset viewer.