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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
275 | 275 |
276 // 10.3.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html #inline-replaced-width | 276 // 10.3.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html #inline-replaced-width |
277 double intrinsicRatio = 0; | 277 double intrinsicRatio = 0; |
278 FloatSize constrainedSize; | 278 FloatSize constrainedSize; |
279 computeAspectRatioInformationForLayoutBox(contentLayoutObject, constrainedSi ze, intrinsicRatio); | 279 computeAspectRatioInformationForLayoutBox(contentLayoutObject, constrainedSi ze, intrinsicRatio); |
280 | 280 |
281 if (style()->logicalWidth().isAuto()) { | 281 if (style()->logicalWidth().isAuto()) { |
282 bool computedHeightIsAuto = hasAutoHeightOrContainingBlockWithAutoHeight (); | 282 bool computedHeightIsAuto = hasAutoHeightOrContainingBlockWithAutoHeight (); |
283 bool hasIntrinsicWidth = constrainedSize.width() > 0; | 283 bool hasIntrinsicWidth = constrainedSize.width() > 0; |
284 | 284 |
285 if (!hasIntrinsicWidth && contentLayoutObject) | |
286 hasIntrinsicWidth = contentLayoutObject->style()->logicalWidth().isF ixed(); | |
davve
2016/01/18 15:52:48
You rely on the (logical) intrinsic width being co
Shanmuga Pandi
2016/01/20 06:09:34
Instead of LogicalWidth()/Height(), getting hasInt
| |
287 | |
285 // If 'height' and 'width' both have computed values of 'auto' and the e lement also has an intrinsic width, then that intrinsic width is the used value of 'width'. | 288 // If 'height' and 'width' both have computed values of 'auto' and the e lement also has an intrinsic width, then that intrinsic width is the used value of 'width'. |
286 if (computedHeightIsAuto && hasIntrinsicWidth) | 289 if (computedHeightIsAuto && hasIntrinsicWidth) |
287 return computeReplacedLogicalWidthRespectingMinMaxWidth(constrainedS ize.width(), shouldComputePreferred); | 290 return computeReplacedLogicalWidthRespectingMinMaxWidth(constrainedS ize.width(), shouldComputePreferred); |
288 | 291 |
289 bool hasIntrinsicHeight = constrainedSize.height() > 0; | 292 bool hasIntrinsicHeight = constrainedSize.height() > 0; |
290 if (intrinsicRatio) { | 293 if (intrinsicRatio) { |
291 // If 'height' and 'width' both have computed values of 'auto' and t he element has no intrinsic width, but does have an intrinsic height and intrins ic ratio; | 294 // If 'height' and 'width' both have computed values of 'auto' and t he element has no intrinsic width, but does have an intrinsic height and intrins ic ratio; |
292 // or if 'width' has a computed value of 'auto', 'height' has some o ther computed value, and the element does have an intrinsic ratio; then the used value | 295 // or if 'width' has a computed value of 'auto', 'height' has some o ther computed value, and the element does have an intrinsic ratio; then the used value |
293 // of 'width' is: (used height) * (intrinsic ratio) | 296 // of 'width' is: (used height) * (intrinsic ratio) |
294 if (intrinsicRatio && ((computedHeightIsAuto && !hasIntrinsicWidth & & hasIntrinsicHeight) || !computedHeightIsAuto)) { | 297 if (intrinsicRatio && ((computedHeightIsAuto && !hasIntrinsicWidth & & hasIntrinsicHeight) || !computedHeightIsAuto)) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
337 LayoutBox* contentLayoutObject = embeddedContentBox(); | 340 LayoutBox* contentLayoutObject = embeddedContentBox(); |
338 | 341 |
339 // 10.6.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html #inline-replaced-height | 342 // 10.6.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html #inline-replaced-height |
340 double intrinsicRatio = 0; | 343 double intrinsicRatio = 0; |
341 FloatSize constrainedSize; | 344 FloatSize constrainedSize; |
342 computeAspectRatioInformationForLayoutBox(contentLayoutObject, constrainedSi ze, intrinsicRatio); | 345 computeAspectRatioInformationForLayoutBox(contentLayoutObject, constrainedSi ze, intrinsicRatio); |
343 | 346 |
344 bool widthIsAuto = style()->logicalWidth().isAuto(); | 347 bool widthIsAuto = style()->logicalWidth().isAuto(); |
345 bool hasIntrinsicHeight = constrainedSize.height() > 0; | 348 bool hasIntrinsicHeight = constrainedSize.height() > 0; |
346 | 349 |
350 if (!hasIntrinsicHeight && contentLayoutObject) | |
351 hasIntrinsicHeight = contentLayoutObject->style()->logicalHeight().isFix ed(); | |
352 | |
347 // If 'height' and 'width' both have computed values of 'auto' and the eleme nt also has an intrinsic height, then that intrinsic height is the used value of 'height'. | 353 // If 'height' and 'width' both have computed values of 'auto' and the eleme nt also has an intrinsic height, then that intrinsic height is the used value of 'height'. |
348 if (widthIsAuto && hasIntrinsicHeight) | 354 if (widthIsAuto && hasIntrinsicHeight) |
349 return computeReplacedLogicalHeightRespectingMinMaxHeight(constrainedSiz e.height()); | 355 return computeReplacedLogicalHeightRespectingMinMaxHeight(constrainedSiz e.height()); |
350 | 356 |
351 // Otherwise, if 'height' has a computed value of 'auto', and the element ha s an intrinsic ratio then the used value of 'height' is: | 357 // Otherwise, if 'height' has a computed value of 'auto', and the element ha s an intrinsic ratio then the used value of 'height' is: |
352 // (used width) / (intrinsic ratio) | 358 // (used width) / (intrinsic ratio) |
353 if (intrinsicRatio) | 359 if (intrinsicRatio) |
354 return computeReplacedLogicalHeightRespectingMinMaxHeight(availableLogic alWidth() / intrinsicRatio); | 360 return computeReplacedLogicalHeightRespectingMinMaxHeight(availableLogic alWidth() / intrinsicRatio); |
355 | 361 |
356 // Otherwise, if 'height' has a computed value of 'auto', and the element ha s an intrinsic height, then that intrinsic height is the used value of 'height'. | 362 // Otherwise, if 'height' has a computed value of 'auto', and the element ha s an intrinsic height, then that intrinsic height is the used value of 'height'. |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
470 // We only include the space below the baseline in our layer's cached paint invalidation rect if the | 476 // We only include the space below the baseline in our layer's cached paint invalidation rect if the |
471 // image is selected. Since the selection state has changed update the rect. | 477 // image is selected. Since the selection state has changed update the rect. |
472 if (hasLayer()) | 478 if (hasLayer()) |
473 setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(containe rForPaintInvalidation())); | 479 setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(containe rForPaintInvalidation())); |
474 | 480 |
475 if (canUpdateSelectionOnRootLineBoxes()) | 481 if (canUpdateSelectionOnRootLineBoxes()) |
476 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone ); | 482 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone ); |
477 } | 483 } |
478 | 484 |
479 } | 485 } |
OLD | NEW |