Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 |
| OLD | NEW |