| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 namespace blink { | 48 namespace blink { |
| 49 | 49 |
| 50 static inline FrameView* mainFrameView(Page* page) | 50 static inline FrameView* mainFrameView(Page* page) |
| 51 { | 51 { |
| 52 if (!page) | 52 if (!page) |
| 53 return 0; | 53 return 0; |
| 54 // FIXME: Can we remove this check? | 54 // FIXME: Can we remove this check? |
| 55 if (!page->mainFrame()) | 55 if (!page->mainFrame()) |
| 56 return 0; | 56 return 0; |
| 57 return page->mainFrame()->view(); | 57 if (!page->mainFrame()->isLocalFrame()) |
| 58 return 0; |
| 59 return toLocalFrame(page->mainFrame())->view(); |
| 58 } | 60 } |
| 59 | 61 |
| 60 void PageWidgetDelegate::animate(Page* page, double monotonicFrameBeginTime) | 62 void PageWidgetDelegate::animate(Page* page, double monotonicFrameBeginTime) |
| 61 { | 63 { |
| 62 RefPtr<FrameView> view = mainFrameView(page); | 64 RefPtr<FrameView> view = mainFrameView(page); |
| 63 if (!view) | 65 if (!view) |
| 64 return; | 66 return; |
| 65 page->autoscrollController().animate(monotonicFrameBeginTime); | 67 page->autoscrollController().animate(monotonicFrameBeginTime); |
| 66 page->animator().serviceScriptedAnimations(monotonicFrameBeginTime); | 68 page->animator().serviceScriptedAnimations(monotonicFrameBeginTime); |
| 67 } | 69 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 78 if (rect.isEmpty()) | 80 if (rect.isEmpty()) |
| 79 return; | 81 return; |
| 80 GraphicsContext gc(canvas); | 82 GraphicsContext gc(canvas); |
| 81 gc.setCertainlyOpaque(background == Opaque); | 83 gc.setCertainlyOpaque(background == Opaque); |
| 82 gc.applyDeviceScaleFactor(page->deviceScaleFactor()); | 84 gc.applyDeviceScaleFactor(page->deviceScaleFactor()); |
| 83 gc.setUseHighResMarkers(page->deviceScaleFactor() > 1.5f); | 85 gc.setUseHighResMarkers(page->deviceScaleFactor() > 1.5f); |
| 84 IntRect dirtyRect(rect); | 86 IntRect dirtyRect(rect); |
| 85 gc.save(); // Needed to save the canvas, not the GraphicsContext. | 87 gc.save(); // Needed to save the canvas, not the GraphicsContext. |
| 86 FrameView* view = mainFrameView(page); | 88 FrameView* view = mainFrameView(page); |
| 87 // FIXME: Can we remove the mainFrame()->document() check? | 89 // FIXME: Can we remove the mainFrame()->document() check? |
| 88 if (view && page->mainFrame()->document()) { | 90 if (view && toLocalFrame(page->mainFrame())->document()) { |
| 89 gc.clip(dirtyRect); | 91 gc.clip(dirtyRect); |
| 90 view->paint(&gc, dirtyRect); | 92 view->paint(&gc, dirtyRect); |
| 91 if (overlays) | 93 if (overlays) |
| 92 overlays->paintWebFrame(gc); | 94 overlays->paintWebFrame(gc); |
| 93 } else { | 95 } else { |
| 94 gc.fillRect(dirtyRect, Color::white); | 96 gc.fillRect(dirtyRect, Color::white); |
| 95 } | 97 } |
| 96 gc.restore(); | 98 gc.restore(); |
| 97 } | 99 } |
| 98 | 100 |
| 99 bool PageWidgetDelegate::handleInputEvent(Page* page, PageWidgetEventHandler& ha
ndler, const WebInputEvent& event) | 101 bool PageWidgetDelegate::handleInputEvent(Page* page, PageWidgetEventHandler& ha
ndler, const WebInputEvent& event) |
| 100 { | 102 { |
| 101 LocalFrame* frame = page ? page->mainFrame() : 0; | 103 LocalFrame* frame = page && page->mainFrame()->isLocalFrame() ? toLocalFrame
(page->mainFrame()) : 0; |
| 102 switch (event.type) { | 104 switch (event.type) { |
| 103 | 105 |
| 104 // FIXME: WebKit seems to always return false on mouse events processing | 106 // FIXME: WebKit seems to always return false on mouse events processing |
| 105 // methods. For now we'll assume it has processed them (as we are only | 107 // methods. For now we'll assume it has processed them (as we are only |
| 106 // interested in whether keyboard events are processed). | 108 // interested in whether keyboard events are processed). |
| 107 case WebInputEvent::MouseMove: | 109 case WebInputEvent::MouseMove: |
| 108 if (!frame || !frame->view()) | 110 if (!frame || !frame->view()) |
| 109 return true; | 111 return true; |
| 110 handler.handleMouseMove(*frame, *static_cast<const WebMouseEvent*>(&even
t)); | 112 handler.handleMouseMove(*frame, *static_cast<const WebMouseEvent*>(&even
t)); |
| 111 return true; | 113 return true; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 { | 204 { |
| 203 return mainFrame.eventHandler().handleWheelEvent(PlatformWheelEventBuilder(m
ainFrame.view(), event)); | 205 return mainFrame.eventHandler().handleWheelEvent(PlatformWheelEventBuilder(m
ainFrame.view(), event)); |
| 204 } | 206 } |
| 205 | 207 |
| 206 bool PageWidgetEventHandler::handleTouchEvent(LocalFrame& mainFrame, const WebTo
uchEvent& event) | 208 bool PageWidgetEventHandler::handleTouchEvent(LocalFrame& mainFrame, const WebTo
uchEvent& event) |
| 207 { | 209 { |
| 208 return mainFrame.eventHandler().handleTouchEvent(PlatformTouchEventBuilder(m
ainFrame.view(), event)); | 210 return mainFrame.eventHandler().handleTouchEvent(PlatformTouchEventBuilder(m
ainFrame.view(), event)); |
| 209 } | 211 } |
| 210 | 212 |
| 211 } | 213 } |
| OLD | NEW |