OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "PageWidgetDelegate.h" | 32 #include "PageWidgetDelegate.h" |
33 | 33 |
34 #include "PageOverlayList.h" | 34 #include "PageOverlayList.h" |
35 #include "WebInputEvent.h" | 35 #include "WebInputEvent.h" |
36 #include "WebInputEventConversion.h" | 36 #include "WebInputEventConversion.h" |
37 #include "core/page/EventHandler.h" | 37 #include "core/page/EventHandler.h" |
38 #include "core/page/Frame.h" | 38 #include "core/page/Frame.h" |
39 #include "core/page/FrameView.h" | 39 #include "core/page/FrameView.h" |
40 #include "painting/GraphicsContextBuilder.h" | 40 #include "core/platform/graphics/GraphicsContext.h" |
41 #include <wtf/CurrentTime.h> | 41 #include <wtf/CurrentTime.h> |
42 | 42 |
43 using namespace WebCore; | 43 using namespace WebCore; |
44 | 44 |
45 namespace WebKit { | 45 namespace WebKit { |
46 | 46 |
47 static inline FrameView* mainFrameView(Page* page) | 47 static inline FrameView* mainFrameView(Page* page) |
48 { | 48 { |
49 if (!page) | 49 if (!page) |
50 return 0; | 50 return 0; |
(...skipping 26 matching lines...) Expand all Loading... |
77 | 77 |
78 // setFrameRect may have the side-effect of causing existing page layout to | 78 // setFrameRect may have the side-effect of causing existing page layout to |
79 // be invalidated, so layout needs to be called last. | 79 // be invalidated, so layout needs to be called last. |
80 view->updateLayoutAndStyleIfNeededRecursive(); | 80 view->updateLayoutAndStyleIfNeededRecursive(); |
81 } | 81 } |
82 | 82 |
83 void PageWidgetDelegate::paint(Page* page, PageOverlayList* overlays, WebCanvas*
canvas, const WebRect& rect, CanvasBackground background) | 83 void PageWidgetDelegate::paint(Page* page, PageOverlayList* overlays, WebCanvas*
canvas, const WebRect& rect, CanvasBackground background) |
84 { | 84 { |
85 if (rect.isEmpty()) | 85 if (rect.isEmpty()) |
86 return; | 86 return; |
87 GraphicsContextBuilder builder(canvas); | 87 GraphicsContext gc(canvas); |
88 GraphicsContext& gc = builder.context(); | |
89 gc.setShouldSmoothFonts(background == Opaque); | 88 gc.setShouldSmoothFonts(background == Opaque); |
90 gc.applyDeviceScaleFactor(page->deviceScaleFactor()); | 89 gc.applyDeviceScaleFactor(page->deviceScaleFactor()); |
91 gc.setUseHighResMarkers(page->deviceScaleFactor() > 1.5f); | 90 gc.setUseHighResMarkers(page->deviceScaleFactor() > 1.5f); |
92 IntRect dirtyRect(rect); | 91 IntRect dirtyRect(rect); |
93 gc.save(); | 92 gc.save(); |
94 FrameView* view = mainFrameView(page); | 93 FrameView* view = mainFrameView(page); |
95 // FIXME: Can we remove the mainFrame()->document() check? | 94 // FIXME: Can we remove the mainFrame()->document() check? |
96 if (view && page->mainFrame()->document()) { | 95 if (view && page->mainFrame()->document()) { |
97 gc.clip(dirtyRect); | 96 gc.clip(dirtyRect); |
98 view->paint(&gc, dirtyRect); | 97 view->paint(&gc, dirtyRect); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 { | 210 { |
212 return mainFrame.eventHandler()->handleWheelEvent(PlatformWheelEventBuilder(
mainFrame.view(), event)); | 211 return mainFrame.eventHandler()->handleWheelEvent(PlatformWheelEventBuilder(
mainFrame.view(), event)); |
213 } | 212 } |
214 | 213 |
215 bool PageWidgetEventHandler::handleTouchEvent(Frame& mainFrame, const WebTouchEv
ent& event) | 214 bool PageWidgetEventHandler::handleTouchEvent(Frame& mainFrame, const WebTouchEv
ent& event) |
216 { | 215 { |
217 return mainFrame.eventHandler()->handleTouchEvent(PlatformTouchEventBuilder(
mainFrame.view(), event)); | 216 return mainFrame.eventHandler()->handleTouchEvent(PlatformTouchEventBuilder(
mainFrame.view(), event)); |
218 } | 217 } |
219 | 218 |
220 } | 219 } |
OLD | NEW |