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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutReplaced.cpp

Issue 2683793007: Keep the aspect ratio of child with percentage max-height when the size of its container changes (Closed)
Patch Set: Updated LayoutReplaced::needsPreferredWidthsRecalculation Created 3 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 | « third_party/WebKit/LayoutTests/fast/replaced/aspect-ratio-of-replaced-child-with-max-height-expected.txt ('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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 if (style()->logicalHeight().isIntrinsic()) 125 if (style()->logicalHeight().isIntrinsic())
126 return true; 126 return true;
127 127
128 return false; 128 return false;
129 } 129 }
130 130
131 bool LayoutReplaced::needsPreferredWidthsRecalculation() const { 131 bool LayoutReplaced::needsPreferredWidthsRecalculation() const {
132 // If the height is a percentage and the width is auto, then the 132 // If the height is a percentage and the width is auto, then the
133 // containingBlocks's height changing can cause this node to change it's 133 // containingBlocks's height changing can cause this node to change it's
134 // preferred width because it maintains aspect ratio. 134 // preferred width because it maintains aspect ratio.
135 return hasRelativeLogicalHeight() && style()->logicalWidth().isAuto() && 135 return hasRelativeLogicalHeight() && style()->logicalWidth().isAuto();
136 !hasAutoHeightOrContainingBlockWithAutoHeight();
137 } 136 }
138 137
139 static inline bool layoutObjectHasAspectRatio( 138 static inline bool layoutObjectHasAspectRatio(
140 const LayoutObject* layoutObject) { 139 const LayoutObject* layoutObject) {
141 ASSERT(layoutObject); 140 ASSERT(layoutObject);
142 return layoutObject->isImage() || layoutObject->isCanvas() || 141 return layoutObject->isImage() || layoutObject->isCanvas() ||
143 layoutObject->isVideo(); 142 layoutObject->isVideo();
144 } 143 }
145 144
146 void LayoutReplaced::computeIntrinsicSizingInfoForReplacedContent( 145 void LayoutReplaced::computeIntrinsicSizingInfoForReplacedContent(
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone); 937 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone);
939 } 938 }
940 939
941 void LayoutReplaced::IntrinsicSizingInfo::transpose() { 940 void LayoutReplaced::IntrinsicSizingInfo::transpose() {
942 size = size.transposedSize(); 941 size = size.transposedSize();
943 aspectRatio = aspectRatio.transposedSize(); 942 aspectRatio = aspectRatio.transposedSize();
944 std::swap(hasWidth, hasHeight); 943 std::swap(hasWidth, hasHeight);
945 } 944 }
946 945
947 } // namespace blink 946 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/replaced/aspect-ratio-of-replaced-child-with-max-height-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698