| 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 15 matching lines...) Expand all Loading... |
| 26 if (view()) | 26 if (view()) |
| 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 // FIXME: Once viewport_metrics are initialized properly on child views, |
| 37 // The GetRoot() call should be removed. |
| 38 const float devicePixelRatio = |
| 39 contentView->GetRoot()->viewport_metrics().device_pixel_ratio; |
| 40 |
| 36 IntRect bounds = absoluteContentBox(); | 41 IntRect bounds = absoluteContentBox(); |
| 37 mojo::Rect mojoBounds; | 42 mojo::Rect mojoBounds; |
| 38 mojoBounds.x = bounds.x(); | 43 mojoBounds.x = bounds.x() * devicePixelRatio; |
| 39 mojoBounds.y = bounds.y(); | 44 mojoBounds.y = bounds.y() * devicePixelRatio; |
| 40 mojoBounds.width = bounds.width(); | 45 mojoBounds.width = bounds.width() * devicePixelRatio; |
| 41 mojoBounds.height = bounds.height(); | 46 mojoBounds.height = bounds.height() * devicePixelRatio; |
| 42 contentView->SetBounds(mojoBounds); | 47 contentView->SetBounds(mojoBounds); |
| 43 } | 48 } |
| 44 | 49 |
| 45 void RenderIFrame::paintReplaced(PaintInfo& paintInfo, | 50 void RenderIFrame::paintReplaced(PaintInfo& paintInfo, |
| 46 const LayoutPoint& paintOffset) | 51 const LayoutPoint& paintOffset) |
| 47 { | 52 { |
| 48 // Draw a gray background. This should be painted over by the actual | 53 // Draw a gray background. This should be painted over by the actual |
| 49 // content. | 54 // content. |
| 50 // TODO(mpcomplete): figure out what we should actually do here. | 55 // TODO(mpcomplete): figure out what we should actually do here. |
| 51 GraphicsContext* context = paintInfo.context; | 56 GraphicsContext* context = paintInfo.context; |
| 52 | 57 |
| 53 IntRect paintRect = pixelSnappedIntRect(LayoutRect( | 58 IntRect paintRect = pixelSnappedIntRect(LayoutRect( |
| 54 paintOffset.x(), paintOffset.y(), contentWidth(), contentHeight())); | 59 paintOffset.x(), paintOffset.y(), contentWidth(), contentHeight())); |
| 55 context->setStrokeStyle(SolidStroke); | 60 context->setStrokeStyle(SolidStroke); |
| 56 context->setStrokeColor(Color::lightGray); | 61 context->setStrokeColor(Color::lightGray); |
| 57 context->setFillColor(Color::darkGray); | 62 context->setFillColor(Color::darkGray); |
| 58 context->drawRect(paintRect); | 63 context->drawRect(paintRect); |
| 59 } | 64 } |
| 60 | 65 |
| 61 } // namespace blink | 66 } // namespace blink |
| OLD | NEW |