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

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

Issue 1215103007: Remove remaining HTML elements (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « sky/engine/core/rendering/RenderIFrame.h ('k') | sky/engine/core/rendering/RenderImage.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5
6 #include "sky/engine/core/rendering/RenderIFrame.h"
7
8 #include "sky/engine/core/editing/FrameSelection.h"
9 #include "sky/engine/core/html/HTMLIFrameElement.h"
10 #include "sky/engine/core/loader/FrameLoaderClient.h"
11 #include "sky/engine/core/rendering/PaintInfo.h"
12 #include "sky/engine/core/rendering/RenderView.h"
13 #include "sky/engine/platform/geometry/LayoutPoint.h"
14
15 namespace blink {
16
17 RenderIFrame::RenderIFrame(HTMLIFrameElement* iframe)
18 : RenderReplaced(iframe)
19 {
20 view()->addIFrame(this);
21 }
22
23 RenderIFrame::~RenderIFrame()
24 {
25 if (view())
26 view()->removeIFrame(this);
27 }
28
29 void RenderIFrame::updateWidgetBounds()
30 {
31 mojo::View* contentView = toHTMLIFrameElement(node())->contentView();
32 if (!contentView)
33 return;
34
35 // FIXME: Once viewport_metrics are initialized properly on child views,
36 // The GetRoot() call should be removed.
37 const float devicePixelRatio =
38 contentView->GetRoot()->viewport_metrics().device_pixel_ratio;
39
40 IntRect bounds = absoluteContentBox();
41 mojo::Rect mojoBounds;
42 mojoBounds.x = bounds.x() * devicePixelRatio;
43 mojoBounds.y = bounds.y() * devicePixelRatio;
44 mojoBounds.width = bounds.width() * devicePixelRatio;
45 mojoBounds.height = bounds.height() * devicePixelRatio;
46 contentView->SetBounds(mojoBounds);
47 }
48
49 void RenderIFrame::paintReplaced(PaintInfo& paintInfo,
50 const LayoutPoint& paintOffset)
51 {
52 // Draw a gray background. This should be painted over by the actual
53 // content.
54 // TODO(mpcomplete): figure out what we should actually do here.
55 GraphicsContext* context = paintInfo.context;
56
57 IntRect paintRect = pixelSnappedIntRect(LayoutRect(
58 paintOffset.x(), paintOffset.y(), contentWidth(), contentHeight()));
59 context->setStrokeStyle(SolidStroke);
60 context->setStrokeColor(Color::lightGray);
61 context->setFillColor(Color::darkGray);
62 context->drawRect(paintRect);
63 }
64
65 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderIFrame.h ('k') | sky/engine/core/rendering/RenderImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698