| 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 28 matching lines...) Expand all Loading... |
| 39 #include "core/page/AutoscrollController.h" | 39 #include "core/page/AutoscrollController.h" |
| 40 #include "core/page/Page.h" | 40 #include "core/page/Page.h" |
| 41 #include "core/paint/TransformRecorder.h" | 41 #include "core/paint/TransformRecorder.h" |
| 42 #include "platform/Logging.h" | 42 #include "platform/Logging.h" |
| 43 #include "platform/graphics/GraphicsContext.h" | 43 #include "platform/graphics/GraphicsContext.h" |
| 44 #include "platform/graphics/paint/ClipRecorder.h" | 44 #include "platform/graphics/paint/ClipRecorder.h" |
| 45 #include "platform/graphics/paint/DrawingRecorder.h" | 45 #include "platform/graphics/paint/DrawingRecorder.h" |
| 46 #include "platform/graphics/paint/SkPictureBuilder.h" | 46 #include "platform/graphics/paint/SkPictureBuilder.h" |
| 47 #include "platform/transforms/AffineTransform.h" | 47 #include "platform/transforms/AffineTransform.h" |
| 48 #include "public/web/WebInputEvent.h" | 48 #include "public/web/WebInputEvent.h" |
| 49 #include "web/PageOverlayList.h" | 49 #include "web/PageOverlay.h" |
| 50 #include "web/WebInputEventConversion.h" | 50 #include "web/WebInputEventConversion.h" |
| 51 #include "wtf/CurrentTime.h" | 51 #include "wtf/CurrentTime.h" |
| 52 | 52 |
| 53 namespace blink { | 53 namespace blink { |
| 54 | 54 |
| 55 void PageWidgetDelegate::animate(Page& page, double monotonicFrameBeginTime, Loc
alFrame& root) | 55 void PageWidgetDelegate::animate(Page& page, double monotonicFrameBeginTime, Loc
alFrame& root) |
| 56 { | 56 { |
| 57 RefPtrWillBeRawPtr<FrameView> view = root.view(); | 57 RefPtrWillBeRawPtr<FrameView> view = root.view(); |
| 58 if (!view) | 58 if (!view) |
| 59 return; | 59 return; |
| 60 page.autoscrollController().animate(monotonicFrameBeginTime); | 60 page.autoscrollController().animate(monotonicFrameBeginTime); |
| 61 page.animator().serviceScriptedAnimations(monotonicFrameBeginTime); | 61 page.animator().serviceScriptedAnimations(monotonicFrameBeginTime); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void PageWidgetDelegate::layout(Page& page, LocalFrame& root) | 64 void PageWidgetDelegate::layout(Page& page, LocalFrame& root) |
| 65 { | 65 { |
| 66 page.animator().updateLayoutAndStyleForPainting(&root); | 66 page.animator().updateLayoutAndStyleForPainting(&root); |
| 67 } | 67 } |
| 68 | 68 |
| 69 static void paintInternal(Page& page, PageOverlayList* overlays, WebCanvas* canv
as, | 69 static void paintInternal(Page& page, PageOverlay* overlay, WebCanvas* canvas, |
| 70 const WebRect& rect, LocalFrame& root, const GlobalPaintFlags globalPaintFla
gs) | 70 const WebRect& rect, LocalFrame& root, const GlobalPaintFlags globalPaintFla
gs) |
| 71 { | 71 { |
| 72 if (rect.isEmpty()) | 72 if (rect.isEmpty()) |
| 73 return; | 73 return; |
| 74 | 74 |
| 75 IntRect intRect(rect); | 75 IntRect intRect(rect); |
| 76 SkPictureBuilder pictureBuilder(intRect); | 76 SkPictureBuilder pictureBuilder(intRect); |
| 77 { | 77 { |
| 78 GraphicsContext& paintContext = pictureBuilder.context(); | 78 GraphicsContext& paintContext = pictureBuilder.context(); |
| 79 | 79 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 90 FrameView* view = root.view(); | 90 FrameView* view = root.view(); |
| 91 if (view) { | 91 if (view) { |
| 92 ClipRecorder clipRecorder(paintContext, root, DisplayItem::PageWidge
tDelegateClip, LayoutRect(dirtyRect)); | 92 ClipRecorder clipRecorder(paintContext, root, DisplayItem::PageWidge
tDelegateClip, LayoutRect(dirtyRect)); |
| 93 | 93 |
| 94 // TODO(jchaffraix): Remove this scaffolding code once we have migra
ted all the code to GlobalPaintFlags. | 94 // TODO(jchaffraix): Remove this scaffolding code once we have migra
ted all the code to GlobalPaintFlags. |
| 95 PaintBehavior oldPaintBehavior = view->paintBehavior(); | 95 PaintBehavior oldPaintBehavior = view->paintBehavior(); |
| 96 if (globalPaintFlags & GlobalPaintFlattenCompositingLayers) | 96 if (globalPaintFlags & GlobalPaintFlattenCompositingLayers) |
| 97 view->setPaintBehavior(oldPaintBehavior | PaintBehaviorFlattenCo
mpositingLayers); | 97 view->setPaintBehavior(oldPaintBehavior | PaintBehaviorFlattenCo
mpositingLayers); |
| 98 | 98 |
| 99 view->paint(&paintContext, globalPaintFlags, dirtyRect); | 99 view->paint(&paintContext, globalPaintFlags, dirtyRect); |
| 100 if (overlays) | 100 if (overlay) |
| 101 overlays->paintWebFrame(paintContext); | 101 overlay->paintWebFrame(paintContext); |
| 102 | 102 |
| 103 view->setPaintBehavior(oldPaintBehavior); | 103 view->setPaintBehavior(oldPaintBehavior); |
| 104 } else if (!DrawingRecorder::useCachedDrawingIfPossible(paintContext, ro
ot, DisplayItem::PageWidgetDelegateBackgroundFallback)) { | 104 } else if (!DrawingRecorder::useCachedDrawingIfPossible(paintContext, ro
ot, DisplayItem::PageWidgetDelegateBackgroundFallback)) { |
| 105 DrawingRecorder drawingRecorder(paintContext, root, DisplayItem::Pag
eWidgetDelegateBackgroundFallback, dirtyRect); | 105 DrawingRecorder drawingRecorder(paintContext, root, DisplayItem::Pag
eWidgetDelegateBackgroundFallback, dirtyRect); |
| 106 paintContext.fillRect(dirtyRect, Color::white); | 106 paintContext.fillRect(dirtyRect, Color::white); |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 pictureBuilder.endRecording()->playback(canvas); | 109 pictureBuilder.endRecording()->playback(canvas); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void PageWidgetDelegate::paint(Page& page, PageOverlayList* overlays, WebCanvas*
canvas, | 112 void PageWidgetDelegate::paint(Page& page, PageOverlay* overlay, WebCanvas* canv
as, |
| 113 const WebRect& rect, LocalFrame& root) | 113 const WebRect& rect, LocalFrame& root) |
| 114 { | 114 { |
| 115 paintInternal(page, overlays, canvas, rect, root, GlobalPaintNormalPhase); | 115 paintInternal(page, overlay, canvas, rect, root, GlobalPaintNormalPhase); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void PageWidgetDelegate::paintIgnoringCompositing(Page& page, PageOverlayList* o
verlays, WebCanvas* canvas, | 118 void PageWidgetDelegate::paintIgnoringCompositing(Page& page, PageOverlay* overl
ay, WebCanvas* canvas, |
| 119 const WebRect& rect, LocalFrame& root) | 119 const WebRect& rect, LocalFrame& root) |
| 120 { | 120 { |
| 121 paintInternal(page, overlays, canvas, rect, root, GlobalPaintFlattenComposit
ingLayers); | 121 paintInternal(page, overlay, canvas, rect, root, GlobalPaintFlattenCompositi
ngLayers); |
| 122 } | 122 } |
| 123 | 123 |
| 124 bool PageWidgetDelegate::handleInputEvent(PageWidgetEventHandler& handler, const
WebInputEvent& event, LocalFrame* root) | 124 bool PageWidgetDelegate::handleInputEvent(PageWidgetEventHandler& handler, const
WebInputEvent& event, LocalFrame* root) |
| 125 { | 125 { |
| 126 switch (event.type) { | 126 switch (event.type) { |
| 127 | 127 |
| 128 // FIXME: WebKit seems to always return false on mouse events processing | 128 // FIXME: WebKit seems to always return false on mouse events processing |
| 129 // methods. For now we'll assume it has processed them (as we are only | 129 // methods. For now we'll assume it has processed them (as we are only |
| 130 // interested in whether keyboard events are processed). | 130 // interested in whether keyboard events are processed). |
| 131 // FIXME: Why do we return true when there is no root or the root is | 131 // FIXME: Why do we return true when there is no root or the root is |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 { | 224 { |
| 225 return mainFrame.eventHandler().handleWheelEvent(PlatformWheelEventBuilder(m
ainFrame.view(), event)); | 225 return mainFrame.eventHandler().handleWheelEvent(PlatformWheelEventBuilder(m
ainFrame.view(), event)); |
| 226 } | 226 } |
| 227 | 227 |
| 228 bool PageWidgetEventHandler::handleTouchEvent(LocalFrame& mainFrame, const WebTo
uchEvent& event) | 228 bool PageWidgetEventHandler::handleTouchEvent(LocalFrame& mainFrame, const WebTo
uchEvent& event) |
| 229 { | 229 { |
| 230 return mainFrame.eventHandler().handleTouchEvent(PlatformTouchEventBuilder(m
ainFrame.view(), event)); | 230 return mainFrame.eventHandler().handleTouchEvent(PlatformTouchEventBuilder(m
ainFrame.view(), event)); |
| 231 } | 231 } |
| 232 | 232 |
| 233 } // namespace blink | 233 } // namespace blink |
| OLD | NEW |