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

Side by Side Diff: sky/engine/core/rendering/RenderRemote.cpp

Issue 682413006: Add a separate call to initialize the bounds for a sky <iframe> element. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: indent Created 6 years, 1 month 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
« no previous file with comments | « sky/engine/core/rendering/RenderRemote.h ('k') | sky/engine/public/web/WebFrameClient.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 6
7 #include "core/rendering/RenderRemote.h" 7 #include "core/rendering/RenderRemote.h"
8 8
9 #include "core/editing/FrameSelection.h" 9 #include "core/editing/FrameSelection.h"
10 #include "core/html/HTMLIFrameElement.h" 10 #include "core/html/HTMLIFrameElement.h"
11 #include "core/loader/FrameLoaderClient.h"
11 #include "core/rendering/PaintInfo.h" 12 #include "core/rendering/PaintInfo.h"
12 #include "platform/geometry/LayoutPoint.h" 13 #include "platform/geometry/LayoutPoint.h"
13 14
14 namespace blink { 15 namespace blink {
15 16
16 RenderRemote::RenderRemote(HTMLIFrameElement* view) 17 RenderRemote::RenderRemote(HTMLIFrameElement* iframe)
17 : RenderReplaced(view) 18 : RenderReplaced(iframe)
18 { 19 {
19 } 20 }
20 21
21 RenderRemote::~RenderRemote() 22 RenderRemote::~RenderRemote()
22 { 23 {
23 } 24 }
24 25
26 void RenderRemote::layout()
27 {
28 RenderReplaced::layout();
29
30 // TODO(mpcomplete): This will generate extra SetBounds calls in some cases
31 // because some layout modules involve multiple passes (e.g., flexbox).
32 // Instead, we'll need to defer the work to later in the pipeline.
33 mojo::View* contentView = toHTMLIFrameElement(node())->contentView();
34 if (!contentView)
35 return;
36
37 IntRect bounds = pixelSnappedIntRect(frameRect());
38 mojo::Rect mojo_bounds;
39 mojo_bounds.x = bounds.x();
40 mojo_bounds.y = bounds.y();
41 mojo_bounds.width = bounds.width();
42 mojo_bounds.height = bounds.height();
43 contentView->SetBounds(mojo_bounds);
44 }
45
25 void RenderRemote::paintReplaced(PaintInfo& paintInfo, 46 void RenderRemote::paintReplaced(PaintInfo& paintInfo,
26 const LayoutPoint& paintOffset) { 47 const LayoutPoint& paintOffset)
48 {
27 // Draw a gray background. This should be painted over by the actual 49 // Draw a gray background. This should be painted over by the actual
28 // content. 50 // content.
29 // TODO(mpcomplete): figure out what we should actually do here. 51 // TODO(mpcomplete): figure out what we should actually do here.
30 GraphicsContext* context = paintInfo.context; 52 GraphicsContext* context = paintInfo.context;
31 53
32 IntRect paintRect = pixelSnappedIntRect(LayoutRect( 54 IntRect paintRect = pixelSnappedIntRect(LayoutRect(
33 paintOffset.x(), paintOffset.y(), contentWidth(), contentHeight())); 55 paintOffset.x(), paintOffset.y(), contentWidth(), contentHeight()));
34 context->setStrokeStyle(SolidStroke); 56 context->setStrokeStyle(SolidStroke);
35 context->setStrokeColor(Color::lightGray); 57 context->setStrokeColor(Color::lightGray);
36 context->setFillColor(Color::darkGray); 58 context->setFillColor(Color::darkGray);
37 context->drawRect(paintRect); 59 context->drawRect(paintRect);
38 } 60 }
39 61
40 } // namespace blink 62 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderRemote.h ('k') | sky/engine/public/web/WebFrameClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698