Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ScrollbarTheme.cpp

Issue 2650403006: Remove PlatformMouseEvent and use WebMouseEvent instead (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2011 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "platform/scroll/ScrollbarTheme.h" 26 #include "platform/scroll/ScrollbarTheme.h"
27 27
28 #include "platform/PlatformMouseEvent.h"
29 #include "platform/RuntimeEnabledFeatures.h" 28 #include "platform/RuntimeEnabledFeatures.h"
30 #include "platform/graphics/Color.h" 29 #include "platform/graphics/Color.h"
31 #include "platform/graphics/GraphicsContext.h" 30 #include "platform/graphics/GraphicsContext.h"
32 #include "platform/graphics/GraphicsContextStateSaver.h" 31 #include "platform/graphics/GraphicsContextStateSaver.h"
33 #include "platform/graphics/paint/CompositingRecorder.h" 32 #include "platform/graphics/paint/CompositingRecorder.h"
34 #include "platform/graphics/paint/CullRect.h" 33 #include "platform/graphics/paint/CullRect.h"
35 #include "platform/graphics/paint/DrawingDisplayItem.h" 34 #include "platform/graphics/paint/DrawingDisplayItem.h"
36 #include "platform/graphics/paint/DrawingRecorder.h" 35 #include "platform/graphics/paint/DrawingRecorder.h"
37 #include "platform/graphics/paint/PaintController.h" 36 #include "platform/graphics/paint/PaintController.h"
38 #include "platform/scroll/Scrollbar.h" 37 #include "platform/scroll/Scrollbar.h"
39 #include "platform/scroll/ScrollbarThemeMock.h" 38 #include "platform/scroll/ScrollbarThemeMock.h"
40 #include "platform/scroll/ScrollbarThemeOverlayMock.h" 39 #include "platform/scroll/ScrollbarThemeOverlayMock.h"
41 #include "public/platform/Platform.h" 40 #include "public/platform/Platform.h"
41 #include "public/platform/WebMouseEvent.h"
42 #include "public/platform/WebPoint.h" 42 #include "public/platform/WebPoint.h"
43 #include "public/platform/WebRect.h" 43 #include "public/platform/WebRect.h"
44 #include "public/platform/WebScrollbarBehavior.h" 44 #include "public/platform/WebScrollbarBehavior.h"
45 #include "wtf/Optional.h" 45 #include "wtf/Optional.h"
46 46
47 #if !OS(MACOSX) 47 #if !OS(MACOSX)
48 #include "public/platform/WebThemeEngine.h" 48 #include "public/platform/WebThemeEngine.h"
49 #endif 49 #endif
50 50
51 namespace blink { 51 namespace blink {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 #if OS(MACOSX) 212 #if OS(MACOSX)
213 context.fillRect(cornerRect, Color::white); 213 context.fillRect(cornerRect, Color::white);
214 #else 214 #else
215 Platform::current()->themeEngine()->paint( 215 Platform::current()->themeEngine()->paint(
216 context.canvas(), WebThemeEngine::PartScrollbarCorner, 216 context.canvas(), WebThemeEngine::PartScrollbarCorner,
217 WebThemeEngine::StateNormal, WebRect(cornerRect), 0); 217 WebThemeEngine::StateNormal, WebRect(cornerRect), 0);
218 #endif 218 #endif
219 } 219 }
220 220
221 bool ScrollbarTheme::shouldCenterOnThumb(const ScrollbarThemeClient& scrollbar, 221 bool ScrollbarTheme::shouldCenterOnThumb(const ScrollbarThemeClient& scrollbar,
222 const PlatformMouseEvent& evt) { 222 const WebMouseEvent& evt) {
223 return Platform::current()->scrollbarBehavior()->shouldCenterOnThumb( 223 return Platform::current()->scrollbarBehavior()->shouldCenterOnThumb(
224 evt.pointerProperties().button, evt.shiftKey(), evt.altKey()); 224 evt.button, evt.modifiers() & WebInputEvent::ShiftKey,
225 evt.modifiers() & WebInputEvent::AltKey);
225 } 226 }
226 227
227 void ScrollbarTheme::paintTickmarks(GraphicsContext& context, 228 void ScrollbarTheme::paintTickmarks(GraphicsContext& context,
228 const Scrollbar& scrollbar, 229 const Scrollbar& scrollbar,
229 const IntRect& rect) { 230 const IntRect& rect) {
230 // Android paints tickmarks in the browser at FindResultBar.java. 231 // Android paints tickmarks in the browser at FindResultBar.java.
231 #if !OS(ANDROID) 232 #if !OS(ANDROID)
232 if (scrollbar.orientation() != VerticalScrollbar) 233 if (scrollbar.orientation() != VerticalScrollbar)
233 return; 234 return;
234 235
(...skipping 28 matching lines...) Expand all
263 264
264 FloatRect tickStroke(rect.x() + tickmarkBorderWidth(), yPos + 1, 265 FloatRect tickStroke(rect.x() + tickmarkBorderWidth(), yPos + 1,
265 rect.width() - 2 * tickmarkBorderWidth(), 1); 266 rect.width() - 2 * tickmarkBorderWidth(), 1);
266 context.fillRect(tickStroke, Color(0xFF, 0xDD, 0x00, 0xFF)); 267 context.fillRect(tickStroke, Color(0xFF, 0xDD, 0x00, 0xFF));
267 } 268 }
268 #endif 269 #endif
269 } 270 }
270 271
271 bool ScrollbarTheme::shouldSnapBackToDragOrigin( 272 bool ScrollbarTheme::shouldSnapBackToDragOrigin(
272 const ScrollbarThemeClient& scrollbar, 273 const ScrollbarThemeClient& scrollbar,
273 const PlatformMouseEvent& evt) { 274 const WebMouseEvent& evt) {
274 IntPoint mousePosition = scrollbar.convertFromRootFrame(evt.position()); 275 IntPoint mousePosition = scrollbar.convertFromRootFrame(
276 flooredIntPoint(evt.positionInRootFrame()));
275 mousePosition.move(scrollbar.x(), scrollbar.y()); 277 mousePosition.move(scrollbar.x(), scrollbar.y());
276 return Platform::current()->scrollbarBehavior()->shouldSnapBackToDragOrigin( 278 return Platform::current()->scrollbarBehavior()->shouldSnapBackToDragOrigin(
277 mousePosition, trackRect(scrollbar), 279 mousePosition, trackRect(scrollbar),
278 scrollbar.orientation() == HorizontalScrollbar); 280 scrollbar.orientation() == HorizontalScrollbar);
279 } 281 }
280 282
281 double ScrollbarTheme::overlayScrollbarFadeOutDelaySeconds() const { 283 double ScrollbarTheme::overlayScrollbarFadeOutDelaySeconds() const {
282 // On Mac, fading is controlled by the painting code in ScrollAnimatorMac. 284 // On Mac, fading is controlled by the painting code in ScrollAnimatorMac.
283 return 0.0; 285 return 0.0;
284 } 286 }
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 return DisplayItem::kScrollbarBackTrack; 438 return DisplayItem::kScrollbarBackTrack;
437 case ForwardTrackPart: 439 case ForwardTrackPart:
438 return DisplayItem::kScrollbarForwardTrack; 440 return DisplayItem::kScrollbarForwardTrack;
439 default: 441 default:
440 ASSERT_NOT_REACHED(); 442 ASSERT_NOT_REACHED();
441 return DisplayItem::kScrollbarBackTrack; 443 return DisplayItem::kScrollbarBackTrack;
442 } 444 }
443 } 445 }
444 446
445 } // namespace blink 447 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698