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

Side by Side Diff: Source/core/rendering/RenderReplaced.cpp

Issue 25105004: Use srcset's resource pixel density to determine intrinsic size (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cleantests
Patch Set: Fixed crash+rebased Created 7 years, 2 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 | « Source/core/rendering/RenderImageResource.cpp ('k') | 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 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 10 matching lines...) Expand all
21 * 21 *
22 */ 22 */
23 23
24 #include "config.h" 24 #include "config.h"
25 #include "core/rendering/RenderReplaced.h" 25 #include "core/rendering/RenderReplaced.h"
26 26
27 #include "RuntimeEnabledFeatures.h" 27 #include "RuntimeEnabledFeatures.h"
28 #include "core/platform/graphics/GraphicsContext.h" 28 #include "core/platform/graphics/GraphicsContext.h"
29 #include "core/rendering/LayoutRepainter.h" 29 #include "core/rendering/LayoutRepainter.h"
30 #include "core/rendering/RenderBlock.h" 30 #include "core/rendering/RenderBlock.h"
31 #include "core/rendering/RenderImage.h"
31 #include "core/rendering/RenderLayer.h" 32 #include "core/rendering/RenderLayer.h"
32 #include "core/rendering/RenderView.h" 33 #include "core/rendering/RenderView.h"
33 34
34 using namespace std; 35 using namespace std;
35 36
36 namespace WebCore { 37 namespace WebCore {
37 38
38 const int cDefaultWidth = 300; 39 const int cDefaultWidth = 300;
39 const int cDefaultHeight = 150; 40 const int cDefaultHeight = 150;
40 41
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 271
271 void RenderReplaced::computeAspectRatioInformationForRenderBox(RenderBox* conten tRenderer, FloatSize& constrainedSize, double& intrinsicRatio, bool& isPercentag eIntrinsicSize) const 272 void RenderReplaced::computeAspectRatioInformationForRenderBox(RenderBox* conten tRenderer, FloatSize& constrainedSize, double& intrinsicRatio, bool& isPercentag eIntrinsicSize) const
272 { 273 {
273 FloatSize intrinsicSize; 274 FloatSize intrinsicSize;
274 if (contentRenderer) { 275 if (contentRenderer) {
275 contentRenderer->computeIntrinsicRatioInformation(intrinsicSize, intrins icRatio, isPercentageIntrinsicSize); 276 contentRenderer->computeIntrinsicRatioInformation(intrinsicSize, intrins icRatio, isPercentageIntrinsicSize);
276 if (intrinsicRatio) 277 if (intrinsicRatio)
277 ASSERT(!isPercentageIntrinsicSize); 278 ASSERT(!isPercentageIntrinsicSize);
278 279
279 // Handle zoom & vertical writing modes here, as the embedded document d oesn't know about them. 280 // Handle zoom & vertical writing modes here, as the embedded document d oesn't know about them.
280 if (!isPercentageIntrinsicSize) 281 if (!isPercentageIntrinsicSize) {
281 intrinsicSize.scale(style()->effectiveZoom()); 282 intrinsicSize.scale(style()->effectiveZoom());
283 if (isRenderImage())
284 intrinsicSize.scale(toRenderImage(this)->imageDevicePixelRatio() );
285 }
282 286
283 if (rendererHasAspectRatio(this) && isPercentageIntrinsicSize) 287 if (rendererHasAspectRatio(this) && isPercentageIntrinsicSize)
284 intrinsicRatio = 1; 288 intrinsicRatio = 1;
285 289
286 // Update our intrinsic size to match what the content renderer has comp uted, so that when we 290 // Update our intrinsic size to match what the content renderer has comp uted, so that when we
287 // constrain the size below, the correct intrinsic size will be obtained for comparison against 291 // constrain the size below, the correct intrinsic size will be obtained for comparison against
288 // min and max widths. 292 // min and max widths.
289 if (intrinsicRatio && !isPercentageIntrinsicSize && !intrinsicSize.isEmp ty()) 293 if (intrinsicRatio && !isPercentageIntrinsicSize && !intrinsicSize.isEmp ty())
290 m_intrinsicSize = LayoutSize(intrinsicSize); 294 m_intrinsicSize = LayoutSize(intrinsicSize);
291 295
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 625
622 if (style()) { 626 if (style()) {
623 if (v) 627 if (v)
624 r.inflate(style()->outlineSize()); 628 r.inflate(style()->outlineSize());
625 } 629 }
626 computeRectForRepaint(repaintContainer, r); 630 computeRectForRepaint(repaintContainer, r);
627 return r; 631 return r;
628 } 632 }
629 633
630 } 634 }
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderImageResource.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698