OLD | NEW |
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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // width that shrinks our width will result in the height we compute here | 183 // width that shrinks our width will result in the height we compute here |
184 // having to shrink in order to preserve the aspect ratio. Because we compute | 184 // having to shrink in order to preserve the aspect ratio. Because we compute |
185 // these values independently along each axis, the final returned size may in | 185 // these values independently along each axis, the final returned size may in |
186 // fact not preserve the aspect ratio. | 186 // fact not preserve the aspect ratio. |
187 // TODO(davve): Investigate using only the intrinsic aspect ratio here. | 187 // TODO(davve): Investigate using only the intrinsic aspect ratio here. |
188 FloatSize constrainedSize = intrinsicSizingInfo.size; | 188 FloatSize constrainedSize = intrinsicSizingInfo.size; |
189 if (!intrinsicSizingInfo.aspectRatio.isEmpty() && | 189 if (!intrinsicSizingInfo.aspectRatio.isEmpty() && |
190 !intrinsicSizingInfo.size.isEmpty() && style()->logicalWidth().isAuto() && | 190 !intrinsicSizingInfo.size.isEmpty() && style()->logicalWidth().isAuto() && |
191 style()->logicalHeight().isAuto()) { | 191 style()->logicalHeight().isAuto()) { |
192 // We can't multiply or divide by 'intrinsicSizingInfo.aspectRatio' here, it | 192 // We can't multiply or divide by 'intrinsicSizingInfo.aspectRatio' here, it |
193 // breaks tests, like fast/images/zoomed-img-size.html, which | 193 // breaks tests, like images/zoomed-img-size.html, which |
194 // can only be fixed once subpixel precision is available for things like | 194 // can only be fixed once subpixel precision is available for things like |
195 // intrinsicWidth/Height - which include zoom! | 195 // intrinsicWidth/Height - which include zoom! |
196 constrainedSize.setWidth(LayoutBox::computeReplacedLogicalHeight() * | 196 constrainedSize.setWidth(LayoutBox::computeReplacedLogicalHeight() * |
197 intrinsicSizingInfo.size.width() / | 197 intrinsicSizingInfo.size.width() / |
198 intrinsicSizingInfo.size.height()); | 198 intrinsicSizingInfo.size.height()); |
199 constrainedSize.setHeight(LayoutBox::computeReplacedLogicalWidth() * | 199 constrainedSize.setHeight(LayoutBox::computeReplacedLogicalWidth() * |
200 intrinsicSizingInfo.size.height() / | 200 intrinsicSizingInfo.size.height() / |
201 intrinsicSizingInfo.size.width()); | 201 intrinsicSizingInfo.size.width()); |
202 } | 202 } |
203 return constrainedSize; | 203 return constrainedSize; |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone); | 938 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone); |
939 } | 939 } |
940 | 940 |
941 void LayoutReplaced::IntrinsicSizingInfo::transpose() { | 941 void LayoutReplaced::IntrinsicSizingInfo::transpose() { |
942 size = size.transposedSize(); | 942 size = size.transposedSize(); |
943 aspectRatio = aspectRatio.transposedSize(); | 943 aspectRatio = aspectRatio.transposedSize(); |
944 std::swap(hasWidth, hasHeight); | 944 std::swap(hasWidth, hasHeight); |
945 } | 945 } |
946 | 946 |
947 } // namespace blink | 947 } // namespace blink |
OLD | NEW |