| 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 23 matching lines...) Expand all Loading... |
| 34 #include "core/frame/FrameView.h" | 34 #include "core/frame/FrameView.h" |
| 35 #include "core/frame/LocalFrame.h" | 35 #include "core/frame/LocalFrame.h" |
| 36 #include "core/page/AutoscrollController.h" | 36 #include "core/page/AutoscrollController.h" |
| 37 #include "core/page/EventHandler.h" | 37 #include "core/page/EventHandler.h" |
| 38 #include "core/page/Page.h" | 38 #include "core/page/Page.h" |
| 39 #include "core/rendering/RenderView.h" | 39 #include "core/rendering/RenderView.h" |
| 40 #include "core/rendering/compositing/RenderLayerCompositor.h" | 40 #include "core/rendering/compositing/RenderLayerCompositor.h" |
| 41 #include "platform/Logging.h" | 41 #include "platform/Logging.h" |
| 42 #include "platform/graphics/GraphicsContext.h" | 42 #include "platform/graphics/GraphicsContext.h" |
| 43 #include "public/web/WebInputEvent.h" | 43 #include "public/web/WebInputEvent.h" |
| 44 #include "web/PageOverlayList.h" | |
| 45 #include "web/WebInputEventConversion.h" | 44 #include "web/WebInputEventConversion.h" |
| 46 #include "wtf/CurrentTime.h" | 45 #include "wtf/CurrentTime.h" |
| 47 | 46 |
| 48 namespace blink { | 47 namespace blink { |
| 49 | 48 |
| 50 static inline FrameView* rootFrameView(Page* page, LocalFrame* rootFrame) | 49 static inline FrameView* rootFrameView(Page* page, LocalFrame* rootFrame) |
| 51 { | 50 { |
| 52 if (rootFrame) | 51 if (rootFrame) |
| 53 return rootFrame->view(); | 52 return rootFrame->view(); |
| 54 if (!page) | 53 if (!page) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 73 | 72 |
| 74 if (!rootFrame) { | 73 if (!rootFrame) { |
| 75 if (!page->mainFrame()) | 74 if (!page->mainFrame()) |
| 76 return; | 75 return; |
| 77 rootFrame = page->mainFrame(); | 76 rootFrame = page->mainFrame(); |
| 78 } | 77 } |
| 79 | 78 |
| 80 page->animator().updateLayoutAndStyleForPainting(rootFrame); | 79 page->animator().updateLayoutAndStyleForPainting(rootFrame); |
| 81 } | 80 } |
| 82 | 81 |
| 83 void PageWidgetDelegate::paint(Page* page, PageOverlayList* overlays, WebCanvas*
canvas, const WebRect& rect, CanvasBackground background, LocalFrame* rootFrame
) | 82 void PageWidgetDelegate::paint(Page* page, WebCanvas* canvas, const WebRect& rec
t, CanvasBackground background, LocalFrame* rootFrame) |
| 84 { | 83 { |
| 85 if (rect.isEmpty()) | 84 if (rect.isEmpty()) |
| 86 return; | 85 return; |
| 87 GraphicsContext gc(canvas); | 86 GraphicsContext gc(canvas); |
| 88 gc.setCertainlyOpaque(background == Opaque); | 87 gc.setCertainlyOpaque(background == Opaque); |
| 89 gc.applyDeviceScaleFactor(page->deviceScaleFactor()); | 88 gc.applyDeviceScaleFactor(page->deviceScaleFactor()); |
| 90 gc.setDeviceScaleFactor(page->deviceScaleFactor()); | 89 gc.setDeviceScaleFactor(page->deviceScaleFactor()); |
| 91 IntRect dirtyRect(rect); | 90 IntRect dirtyRect(rect); |
| 92 gc.save(); // Needed to save the canvas, not the GraphicsContext. | 91 gc.save(); // Needed to save the canvas, not the GraphicsContext. |
| 93 FrameView* view = rootFrameView(page, rootFrame); | 92 FrameView* view = rootFrameView(page, rootFrame); |
| 94 if (view) { | 93 if (view) { |
| 95 gc.clip(dirtyRect); | 94 gc.clip(dirtyRect); |
| 96 view->paint(&gc, dirtyRect); | 95 view->paint(&gc, dirtyRect); |
| 97 if (overlays) | |
| 98 overlays->paintWebFrame(gc); | |
| 99 } else { | 96 } else { |
| 100 gc.fillRect(dirtyRect, Color::white); | 97 gc.fillRect(dirtyRect, Color::white); |
| 101 } | 98 } |
| 102 gc.restore(); | 99 gc.restore(); |
| 103 } | 100 } |
| 104 | 101 |
| 105 bool PageWidgetDelegate::handleInputEvent(Page* page, PageWidgetEventHandler& ha
ndler, const WebInputEvent& event, LocalFrame* rootFrame) | 102 bool PageWidgetDelegate::handleInputEvent(Page* page, PageWidgetEventHandler& ha
ndler, const WebInputEvent& event, LocalFrame* rootFrame) |
| 106 { | 103 { |
| 107 LocalFrame* frame = rootFrame; | 104 LocalFrame* frame = rootFrame; |
| 108 if (!frame) | 105 if (!frame) |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 { | 207 { |
| 211 return mainFrame.eventHandler().handleWheelEvent(PlatformWheelEventBuilder(m
ainFrame.view(), event)); | 208 return mainFrame.eventHandler().handleWheelEvent(PlatformWheelEventBuilder(m
ainFrame.view(), event)); |
| 212 } | 209 } |
| 213 | 210 |
| 214 bool PageWidgetEventHandler::handleTouchEvent(LocalFrame& mainFrame, const WebTo
uchEvent& event) | 211 bool PageWidgetEventHandler::handleTouchEvent(LocalFrame& mainFrame, const WebTo
uchEvent& event) |
| 215 { | 212 { |
| 216 return mainFrame.eventHandler().handleTouchEvent(PlatformTouchEventBuilder(m
ainFrame.view(), event)); | 213 return mainFrame.eventHandler().handleTouchEvent(PlatformTouchEventBuilder(m
ainFrame.view(), event)); |
| 217 } | 214 } |
| 218 | 215 |
| 219 } // namespace blink | 216 } // namespace blink |
| OLD | NEW |