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

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

Issue 896233002: Fix render bounds of iframes on devices with a pixel ratio != 1. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « 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 // 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 "sky/engine/config.h" 5 #include "sky/engine/config.h"
6 6
7 #include "sky/engine/core/rendering/RenderIFrame.h" 7 #include "sky/engine/core/rendering/RenderIFrame.h"
8 8
9 #include "sky/engine/core/editing/FrameSelection.h" 9 #include "sky/engine/core/editing/FrameSelection.h"
10 #include "sky/engine/core/html/HTMLIFrameElement.h" 10 #include "sky/engine/core/html/HTMLIFrameElement.h"
(...skipping 16 matching lines...) Expand all
27 view()->removeIFrame(this); 27 view()->removeIFrame(this);
28 } 28 }
29 29
30 void RenderIFrame::updateWidgetBounds() 30 void RenderIFrame::updateWidgetBounds()
31 { 31 {
32 mojo::View* contentView = toHTMLIFrameElement(node())->contentView(); 32 mojo::View* contentView = toHTMLIFrameElement(node())->contentView();
33 if (!contentView) 33 if (!contentView)
34 return; 34 return;
35 35
36 IntRect bounds = absoluteContentBox(); 36 IntRect bounds = absoluteContentBox();
37 const float scaleFactor =
abarth-chromium 2015/02/04 16:41:11 scaleFactor -> devicePixelRatio
tonyg 2015/02/04 16:56:37 Done.
38 contentView->GetRoot()->viewport_metrics().device_pixel_ratio;
37 mojo::Rect mojoBounds; 39 mojo::Rect mojoBounds;
38 mojoBounds.x = bounds.x(); 40 mojoBounds.x = bounds.x() * scaleFactor;
39 mojoBounds.y = bounds.y(); 41 mojoBounds.y = bounds.y() * scaleFactor;
40 mojoBounds.width = bounds.width(); 42 mojoBounds.width = bounds.width() * scaleFactor;
41 mojoBounds.height = bounds.height(); 43 mojoBounds.height = bounds.height() * scaleFactor;
42 contentView->SetBounds(mojoBounds); 44 contentView->SetBounds(mojoBounds);
43 } 45 }
44 46
45 void RenderIFrame::paintReplaced(PaintInfo& paintInfo, 47 void RenderIFrame::paintReplaced(PaintInfo& paintInfo,
46 const LayoutPoint& paintOffset) 48 const LayoutPoint& paintOffset)
47 { 49 {
48 // Draw a gray background. This should be painted over by the actual 50 // Draw a gray background. This should be painted over by the actual
49 // content. 51 // content.
50 // TODO(mpcomplete): figure out what we should actually do here. 52 // TODO(mpcomplete): figure out what we should actually do here.
51 GraphicsContext* context = paintInfo.context; 53 GraphicsContext* context = paintInfo.context;
52 54
53 IntRect paintRect = pixelSnappedIntRect(LayoutRect( 55 IntRect paintRect = pixelSnappedIntRect(LayoutRect(
54 paintOffset.x(), paintOffset.y(), contentWidth(), contentHeight())); 56 paintOffset.x(), paintOffset.y(), contentWidth(), contentHeight()));
55 context->setStrokeStyle(SolidStroke); 57 context->setStrokeStyle(SolidStroke);
56 context->setStrokeColor(Color::lightGray); 58 context->setStrokeColor(Color::lightGray);
57 context->setFillColor(Color::darkGray); 59 context->setFillColor(Color::darkGray);
58 context->drawRect(paintRect); 60 context->drawRect(paintRect);
59 } 61 }
60 62
61 } // namespace blink 63 } // 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