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

Side by Side Diff: Source/web/PageWidgetDelegate.cpp

Issue 1162603005: Most tests are failing on all the android perfbots. The logs look like a crash. Example: (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 24 matching lines...) Expand all
35 #include "core/frame/LocalFrame.h" 35 #include "core/frame/LocalFrame.h"
36 #include "core/layout/LayoutView.h" 36 #include "core/layout/LayoutView.h"
37 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" 37 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
38 #include "core/page/AutoscrollController.h" 38 #include "core/page/AutoscrollController.h"
39 #include "core/page/EventHandler.h" 39 #include "core/page/EventHandler.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/DisplayItemListContextRecorder.h"
45 #include "platform/graphics/paint/DrawingRecorder.h" 46 #include "platform/graphics/paint/DrawingRecorder.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/PageOverlayList.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 void PageWidgetDelegate::paint(Page& page, PageOverlayList* overlays, WebCanvas* canvas, 69 void PageWidgetDelegate::paint(Page& page, PageOverlayList* overlays, WebCanvas* canvas,
70 const WebRect& rect, LocalFrame& root) 70 const WebRect& rect, LocalFrame& root)
71 { 71 {
72 if (rect.isEmpty()) 72 if (rect.isEmpty())
73 return; 73 return;
74 74
75 IntRect intRect(rect); 75 OwnPtr<GraphicsContext> context = GraphicsContext::deprecatedCreateWithCanva s(canvas);
76 SkPictureBuilder builder(intRect); 76 {
77 GraphicsContext* context = &builder.context(); 77 DisplayItemListContextRecorder contextRecorder(*context);
78 GraphicsContext& paintContext = contextRecorder.context();
78 79
79 // FIXME: device scale factor settings are layering violations and should no t 80 // FIXME: device scale factor settings are layering violations and shoul d not
80 // be used within Blink paint code. 81 // be used within Blink paint code.
81 float scaleFactor = page.deviceScaleFactor(); 82 float scaleFactor = page.deviceScaleFactor();
82 context->setDeviceScaleFactor(scaleFactor); 83 paintContext.setDeviceScaleFactor(scaleFactor);
83 84
84 AffineTransform scale; 85 AffineTransform scale;
85 scale.scale(scaleFactor); 86 scale.scale(scaleFactor);
86 87 TransformRecorder scaleRecorder(paintContext, root, scale);
87 {
88 TransformRecorder scaleRecorder(*context, root, scale);
89 88
90 IntRect dirtyRect(rect); 89 IntRect dirtyRect(rect);
91 FrameView* view = root.view(); 90 FrameView* view = root.view();
92 if (view) { 91 if (view) {
93 ClipRecorder clipRecorder(*context, root, DisplayItem::PageWidgetDel egateClip, LayoutRect(dirtyRect)); 92 ClipRecorder clipRecorder(paintContext, root, DisplayItem::PageWidge tDelegateClip, LayoutRect(dirtyRect));
94 93
95 view->paint(context, dirtyRect); 94 view->paint(&paintContext, dirtyRect);
96 if (overlays) 95 if (overlays)
97 overlays->paintWebFrame(*context); 96 overlays->paintWebFrame(paintContext);
98 } else { 97 } else {
99 DrawingRecorder drawingRecorder(*context, root, DisplayItem::PageWid getDelegateBackgroundFallback, dirtyRect); 98 DrawingRecorder drawingRecorder(paintContext, root, DisplayItem::Pag eWidgetDelegateBackgroundFallback, dirtyRect);
100 if (!drawingRecorder.canUseCachedDrawing()) 99 if (!drawingRecorder.canUseCachedDrawing())
101 context->fillRect(dirtyRect, Color::white); 100 paintContext.fillRect(dirtyRect, Color::white);
102 } 101 }
103 } 102 }
104 builder.endRecording()->playback(canvas);
105 } 103 }
106 104
107 bool PageWidgetDelegate::handleInputEvent(PageWidgetEventHandler& handler, const WebInputEvent& event, LocalFrame* root) 105 bool PageWidgetDelegate::handleInputEvent(PageWidgetEventHandler& handler, const WebInputEvent& event, LocalFrame* root)
108 { 106 {
109 switch (event.type) { 107 switch (event.type) {
110 108
111 // FIXME: WebKit seems to always return false on mouse events processing 109 // FIXME: WebKit seems to always return false on mouse events processing
112 // methods. For now we'll assume it has processed them (as we are only 110 // methods. For now we'll assume it has processed them (as we are only
113 // interested in whether keyboard events are processed). 111 // interested in whether keyboard events are processed).
114 // FIXME: Why do we return true when there is no root or the root is 112 // 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
207 { 205 {
208 return mainFrame.eventHandler().handleWheelEvent(PlatformWheelEventBuilder(m ainFrame.view(), event)); 206 return mainFrame.eventHandler().handleWheelEvent(PlatformWheelEventBuilder(m ainFrame.view(), event));
209 } 207 }
210 208
211 bool PageWidgetEventHandler::handleTouchEvent(LocalFrame& mainFrame, const WebTo uchEvent& event) 209 bool PageWidgetEventHandler::handleTouchEvent(LocalFrame& mainFrame, const WebTo uchEvent& event)
212 { 210 {
213 return mainFrame.eventHandler().handleTouchEvent(PlatformTouchEventBuilder(m ainFrame.view(), event)); 211 return mainFrame.eventHandler().handleTouchEvent(PlatformTouchEventBuilder(m ainFrame.view(), event));
214 } 212 }
215 213
216 } // namespace blink 214 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698