Chromium Code Reviews| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 // this node to change it's preferred width because it maintains aspect rati o. | 139 // this node to change it's preferred width because it maintains aspect rati o. |
| 140 return hasRelativeLogicalHeight() && style()->logicalWidth().isAuto() && !ha sAutoHeightOrContainingBlockWithAutoHeight(); | 140 return hasRelativeLogicalHeight() && style()->logicalWidth().isAuto() && !ha sAutoHeightOrContainingBlockWithAutoHeight(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 static inline bool layoutObjectHasAspectRatio(const LayoutObject* layoutObject) | 143 static inline bool layoutObjectHasAspectRatio(const LayoutObject* layoutObject) |
| 144 { | 144 { |
| 145 ASSERT(layoutObject); | 145 ASSERT(layoutObject); |
| 146 return layoutObject->isImage() || layoutObject->isCanvas() || layoutObject-> isVideo(); | 146 return layoutObject->isImage() || layoutObject->isCanvas() || layoutObject-> isVideo(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void LayoutReplaced::computeAspectRatioInformationForLayoutBox(LayoutBox* conten tLayoutObject, FloatSize& constrainedSize, double& intrinsicRatio) const | 149 void LayoutReplaced::computeIntrinsicSizingInfoForLayoutBox(LayoutBox* contentLa youtObject, IntrinsicSizingInfo& intrinsicSizingInfo) const |
| 150 { | 150 { |
| 151 FloatSize intrinsicSize; | |
| 152 if (contentLayoutObject) { | 151 if (contentLayoutObject) { |
| 153 contentLayoutObject->computeIntrinsicRatioInformation(intrinsicSize, int rinsicRatio); | 152 contentLayoutObject->computeIntrinsicSizingInfo(intrinsicSizingInfo); |
| 154 | 153 |
| 155 // Handle zoom & vertical writing modes here, as the embedded document d oesn't know about them. | 154 // Handle zoom & vertical writing modes here, as the embedded document d oesn't know about them. |
| 156 intrinsicSize.scale(style()->effectiveZoom()); | 155 intrinsicSizingInfo.size.scale(style()->effectiveZoom()); |
| 157 if (isLayoutImage()) | 156 if (isLayoutImage()) |
| 158 intrinsicSize.scale(toLayoutImage(this)->imageDevicePixelRatio()); | 157 intrinsicSizingInfo.size.scale(toLayoutImage(this)->imageDevicePixel Ratio()); |
| 159 | 158 |
| 160 // Update our intrinsic size to match what the content layoutObject has computed, so that when we | 159 // Update our intrinsic size to match what the content layoutObject has computed, so that when we |
| 161 // constrain the size below, the correct intrinsic size will be obtained for comparison against | 160 // constrain the size below, the correct intrinsic size will be obtained for comparison against |
| 162 // min and max widths. | 161 // min and max widths. |
| 163 if (intrinsicRatio && !intrinsicSize.isEmpty()) | 162 if (intrinsicSizingInfo.aspectRatio && !intrinsicSizingInfo.size.isEmpty ()) |
| 164 m_intrinsicSize = LayoutSize(intrinsicSize); | 163 m_intrinsicSize = LayoutSize(intrinsicSizingInfo.size); |
| 165 | 164 |
| 166 if (!isHorizontalWritingMode()) { | 165 if (!isHorizontalWritingMode()) { |
| 167 if (intrinsicRatio) | 166 if (intrinsicSizingInfo.aspectRatio) |
| 168 intrinsicRatio = 1 / intrinsicRatio; | 167 intrinsicSizingInfo.aspectRatio = 1 / intrinsicSizingInfo.aspect Ratio; |
| 169 intrinsicSize = intrinsicSize.transposedSize(); | 168 intrinsicSizingInfo.size = intrinsicSizingInfo.size.transposedSize() ; |
| 170 } | 169 } |
| 171 } else { | 170 } else { |
| 172 computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio); | 171 computeIntrinsicSizingInfo(intrinsicSizingInfo); |
| 173 if (intrinsicRatio && !intrinsicSize.isEmpty()) | 172 if (intrinsicSizingInfo.aspectRatio && !intrinsicSizingInfo.size.isEmpty ()) |
| 174 m_intrinsicSize = LayoutSize(isHorizontalWritingMode() ? intrinsicSi ze : intrinsicSize.transposedSize()); | 173 m_intrinsicSize = LayoutSize(isHorizontalWritingMode() ? intrinsicSi zingInfo.size : intrinsicSizingInfo.size.transposedSize()); |
| 175 } | |
| 176 | |
| 177 // Now constrain the intrinsic size along each axis according to minimum and maximum width/heights along the | |
| 178 // opposite axis. So for example a maximum width that shrinks our width will result in the height we compute here | |
| 179 // having to shrink in order to preserve the aspect ratio. Because we comput e these values independently along | |
| 180 // each axis, the final returned size may in fact not preserve the aspect ra tio. | |
| 181 // FIXME: In the long term, it might be better to just return this code more to the way it used to be before this | |
| 182 // function was added, since all it has done is make the code more unclear. | |
| 183 constrainedSize = intrinsicSize; | |
| 184 if (intrinsicRatio && !intrinsicSize.isEmpty() && style()->logicalWidth().is Auto() && style()->logicalHeight().isAuto()) { | |
| 185 // We can't multiply or divide by 'intrinsicRatio' here, it breaks tests , like fast/images/zoomed-img-size.html, which | |
| 186 // can only be fixed once subpixel precision is available for things lik e intrinsicWidth/Height - which include zoom! | |
| 187 constrainedSize.setWidth(LayoutBox::computeReplacedLogicalHeight() * int rinsicSize.width() / intrinsicSize.height()); | |
| 188 constrainedSize.setHeight(LayoutBox::computeReplacedLogicalWidth() * int rinsicSize.height() / intrinsicSize.width()); | |
| 189 } | 174 } |
| 190 } | 175 } |
| 191 | 176 |
| 177 FloatSize LayoutReplaced::constrainIntrinsicSizeToMinMax(IntrinsicSizingInfo& in trinsicSizingInfo) const | |
|
fs
2016/02/09 18:37:30
Nit: const IntrinsicSizingInfo&?
davve
2016/02/10 10:10:32
Done.
| |
| 178 { | |
| 179 // Constrain the intrinsic size along each axis according to minimum and max imum width/heights along the opposite | |
| 180 // axis. So for example a maximum width that shrinks our width will result i n the height we compute here having | |
| 181 // to shrink in order to preserve the aspect ratio. Because we compute these values independently along each | |
| 182 // axis, the final returned size may in fact not preserve the aspect ratio. | |
| 183 FloatSize constrainedSize = intrinsicSizingInfo.size; | |
| 184 if (intrinsicSizingInfo.aspectRatio && !intrinsicSizingInfo.size.isEmpty() & & style()->logicalWidth().isAuto() && style()->logicalHeight().isAuto()) { | |
| 185 // We can't multiply or divide by 'intrinsicSizingInfo.aspectRatio' here , it breaks tests, like fast/images/zoomed-img-size.html, which | |
| 186 // can only be fixed once subpixel precision is available for things lik e intrinsicWidth/Height - which include zoom! | |
| 187 constrainedSize.setWidth(LayoutBox::computeReplacedLogicalHeight() * int rinsicSizingInfo.size.width() / intrinsicSizingInfo.size.height()); | |
| 188 constrainedSize.setHeight(LayoutBox::computeReplacedLogicalWidth() * int rinsicSizingInfo.size.height() / intrinsicSizingInfo.size.width()); | |
| 189 } | |
| 190 return constrainedSize; | |
| 191 } | |
| 192 | |
| 192 void LayoutReplaced::computePositionedLogicalWidth(LogicalExtentComputedValues& computedValues) const | 193 void LayoutReplaced::computePositionedLogicalWidth(LogicalExtentComputedValues& computedValues) const |
| 193 { | 194 { |
| 194 // The following is based off of the W3C Working Draft from April 11, 2006 o f | 195 // The following is based off of the W3C Working Draft from April 11, 2006 o f |
| 195 // CSS 2.1: Section 10.3.8 "Absolutely positioned, replaced elements" | 196 // CSS 2.1: Section 10.3.8 "Absolutely positioned, replaced elements" |
| 196 // <http://www.w3.org/TR/2005/WD-CSS21-20050613/visudet.html#abs-replaced-wi dth> | 197 // <http://www.w3.org/TR/2005/WD-CSS21-20050613/visudet.html#abs-replaced-wi dth> |
| 197 // (block-style-comments in this function correspond to text from the spec a nd | 198 // (block-style-comments in this function correspond to text from the spec a nd |
| 198 // the numbers correspond to numbers in spec) | 199 // the numbers correspond to numbers in spec) |
| 199 | 200 |
| 200 // We don't use containingBlock(), since we may be positioned by an enclosin g | 201 // We don't use containingBlock(), since we may be positioned by an enclosin g |
| 201 // relative positioned inline. | 202 // relative positioned inline. |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 522 ASSERT_NOT_REACHED(); | 523 ASSERT_NOT_REACHED(); |
| 523 } | 524 } |
| 524 | 525 |
| 525 LayoutUnit xOffset = minimumValueForLength(style()->objectPosition().x(), co ntentRect.width() - finalRect.width()); | 526 LayoutUnit xOffset = minimumValueForLength(style()->objectPosition().x(), co ntentRect.width() - finalRect.width()); |
| 526 LayoutUnit yOffset = minimumValueForLength(style()->objectPosition().y(), co ntentRect.height() - finalRect.height()); | 527 LayoutUnit yOffset = minimumValueForLength(style()->objectPosition().y(), co ntentRect.height() - finalRect.height()); |
| 527 finalRect.move(xOffset, yOffset); | 528 finalRect.move(xOffset, yOffset); |
| 528 | 529 |
| 529 return finalRect; | 530 return finalRect; |
| 530 } | 531 } |
| 531 | 532 |
| 532 void LayoutReplaced::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio) const | 533 void LayoutReplaced::computeIntrinsicSizingInfo(IntrinsicSizingInfo& intrinsicSi zingInfo) const |
| 533 { | 534 { |
| 534 // If there's an embeddedContentBox() of a remote, referenced document avail able, this code-path should never be used. | 535 // If there's an embeddedContentBox() of a remote, referenced document avail able, this code-path should never be used. |
| 535 ASSERT(!embeddedContentBox()); | 536 ASSERT(!embeddedContentBox()); |
| 536 intrinsicSize = FloatSize(intrinsicLogicalWidth().toFloat(), intrinsicLogica lHeight().toFloat()); | 537 intrinsicSizingInfo.size = FloatSize(intrinsicLogicalWidth().toFloat(), intr insicLogicalHeight().toFloat()); |
| 537 | 538 |
| 538 // Figure out if we need to compute an intrinsic ratio. | 539 // Figure out if we need to compute an intrinsic ratio. |
| 539 if (intrinsicSize.isEmpty() || !layoutObjectHasAspectRatio(this)) | 540 if (intrinsicSizingInfo.size.isEmpty() || !layoutObjectHasAspectRatio(this)) |
| 540 return; | 541 return; |
| 541 | 542 |
| 542 intrinsicRatio = intrinsicSize.width() / intrinsicSize.height(); | 543 intrinsicSizingInfo.aspectRatio = intrinsicSizingInfo.size.width() / intrins icSizingInfo.size.height(); |
| 543 } | 544 } |
| 544 | 545 |
| 545 static bool hasIntrinsicWidthForLayoutBox(LayoutBox* layoutObject) | 546 static bool hasIntrinsicWidthForLayoutBox(LayoutBox* layoutObject) |
| 546 { | 547 { |
| 547 if (layoutObject && layoutObject->isSVGRoot()) { | 548 if (layoutObject && layoutObject->isSVGRoot()) { |
| 548 SVGSVGElement* svg = toSVGSVGElement(layoutObject->node()); | 549 SVGSVGElement* svg = toSVGSVGElement(layoutObject->node()); |
| 549 ASSERT(svg); | 550 ASSERT(svg); |
| 550 return svg->hasIntrinsicWidth(); | 551 return svg->hasIntrinsicWidth(); |
| 551 } | 552 } |
| 552 | 553 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 565 } | 566 } |
| 566 | 567 |
| 567 LayoutUnit LayoutReplaced::computeReplacedLogicalWidth(ShouldComputePreferred sh ouldComputePreferred) const | 568 LayoutUnit LayoutReplaced::computeReplacedLogicalWidth(ShouldComputePreferred sh ouldComputePreferred) const |
| 568 { | 569 { |
| 569 if (style()->logicalWidth().isSpecified() || style()->logicalWidth().isIntri nsic()) | 570 if (style()->logicalWidth().isSpecified() || style()->logicalWidth().isIntri nsic()) |
| 570 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedL ogicalWidthUsing(MainOrPreferredSize, style()->logicalWidth()), shouldComputePre ferred); | 571 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedL ogicalWidthUsing(MainOrPreferredSize, style()->logicalWidth()), shouldComputePre ferred); |
| 571 | 572 |
| 572 LayoutBox* contentLayoutObject = embeddedContentBox(); | 573 LayoutBox* contentLayoutObject = embeddedContentBox(); |
| 573 | 574 |
| 574 // 10.3.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html #inline-replaced-width | 575 // 10.3.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html #inline-replaced-width |
| 575 double intrinsicRatio = 0; | 576 IntrinsicSizingInfo intrinsicSizingInfo; |
| 576 FloatSize constrainedSize; | 577 computeIntrinsicSizingInfoForLayoutBox(contentLayoutObject, intrinsicSizingI nfo); |
| 577 computeAspectRatioInformationForLayoutBox(contentLayoutObject, constrainedSi ze, intrinsicRatio); | 578 FloatSize constrainedSize = constrainIntrinsicSizeToMinMax(intrinsicSizingIn fo); |
| 578 | 579 |
| 579 if (style()->logicalWidth().isAuto()) { | 580 if (style()->logicalWidth().isAuto()) { |
| 580 bool computedHeightIsAuto = hasAutoHeightOrContainingBlockWithAutoHeight (); | 581 bool computedHeightIsAuto = hasAutoHeightOrContainingBlockWithAutoHeight (); |
| 581 // TODO(shanmuga.m@samsung.com): hasIntrinsicWidth/Height information sh ould be obtained | 582 // TODO(shanmuga.m@samsung.com): hasIntrinsicWidth/Height information sh ould be obtained |
| 582 // from LayoutBox::computeIntrinsicRatioInformation(). | 583 // from LayoutBox::computeIntrinsicSizingInfo(). |
| 583 bool hasIntrinsicWidth = constrainedSize.width() > 0 || hasIntrinsicWidt hForLayoutBox(contentLayoutObject); | 584 bool hasIntrinsicWidth = constrainedSize.width() > 0 || hasIntrinsicWidt hForLayoutBox(contentLayoutObject); |
| 584 | 585 |
| 585 // 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'. | 586 // 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'. |
| 586 if (computedHeightIsAuto && hasIntrinsicWidth) | 587 if (computedHeightIsAuto && hasIntrinsicWidth) |
| 587 return computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit(c onstrainedSize.width()), shouldComputePreferred); | 588 return computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit(c onstrainedSize.width()), shouldComputePreferred); |
| 588 | 589 |
| 589 bool hasIntrinsicHeight = constrainedSize.height() > 0 || hasIntrinsicHe ightForLayoutBox(contentLayoutObject); | 590 bool hasIntrinsicHeight = constrainedSize.height() > 0 || hasIntrinsicHe ightForLayoutBox(contentLayoutObject); |
| 590 | 591 |
| 591 if (intrinsicRatio) { | 592 if (intrinsicSizingInfo.aspectRatio) { |
| 592 // 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; | 593 // 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; |
| 593 // 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 | 594 // 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 |
| 594 // of 'width' is: (used height) * (intrinsic ratio) | 595 // of 'width' is: (used height) * (intrinsic ratio) |
| 595 if (intrinsicRatio && ((computedHeightIsAuto && !hasIntrinsicWidth & & hasIntrinsicHeight) || !computedHeightIsAuto)) { | 596 if (intrinsicSizingInfo.aspectRatio && ((computedHeightIsAuto && !ha sIntrinsicWidth && hasIntrinsicHeight) || !computedHeightIsAuto)) { |
| 596 LayoutUnit logicalHeight = computeReplacedLogicalHeight(); | 597 LayoutUnit logicalHeight = computeReplacedLogicalHeight(); |
| 597 return computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUn it(logicalHeight * intrinsicRatio), shouldComputePreferred); | 598 return computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUn it(logicalHeight * intrinsicSizingInfo.aspectRatio), shouldComputePreferred); |
| 598 } | 599 } |
| 599 | 600 |
| 600 // If 'height' and 'width' both have computed values of 'auto' and t he element has an intrinsic ratio but no intrinsic height or width, then the use d value of | 601 // If 'height' and 'width' both have computed values of 'auto' and t he element has an intrinsic ratio but no intrinsic height or width, then the use d value of |
| 601 // 'width' is undefined in CSS 2.1. However, it is suggested that, i f the containing block's width does not itself depend on the replaced element's width, then | 602 // 'width' is undefined in CSS 2.1. However, it is suggested that, i f the containing block's width does not itself depend on the replaced element's width, then |
| 602 // the used value of 'width' is calculated from the constraint equat ion used for block-level, non-replaced elements in normal flow. | 603 // the used value of 'width' is calculated from the constraint equat ion used for block-level, non-replaced elements in normal flow. |
| 603 if (computedHeightIsAuto && !hasIntrinsicWidth && !hasIntrinsicHeigh t) { | 604 if (computedHeightIsAuto && !hasIntrinsicWidth && !hasIntrinsicHeigh t) { |
| 604 if (shouldComputePreferred == ComputePreferred) | 605 if (shouldComputePreferred == ComputePreferred) |
| 605 return computeReplacedLogicalWidthRespectingMinMaxWidth(Layo utUnit(), ComputePreferred); | 606 return computeReplacedLogicalWidthRespectingMinMaxWidth(Layo utUnit(), ComputePreferred); |
| 606 // The aforementioned 'constraint equation' used for block-level , non-replaced elements in normal flow: | 607 // The aforementioned 'constraint equation' used for block-level , non-replaced elements in normal flow: |
| 607 // 'margin-left' + 'border-left-width' + 'padding-left' + 'width ' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containin g block | 608 // 'margin-left' + 'border-left-width' + 'padding-left' + 'width ' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containin g block |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 631 | 632 |
| 632 LayoutUnit LayoutReplaced::computeReplacedLogicalHeight() const | 633 LayoutUnit LayoutReplaced::computeReplacedLogicalHeight() const |
| 633 { | 634 { |
| 634 // 10.5 Content height: the 'height' property: http://www.w3.org/TR/CSS21/vi sudet.html#propdef-height | 635 // 10.5 Content height: the 'height' property: http://www.w3.org/TR/CSS21/vi sudet.html#propdef-height |
| 635 if (hasReplacedLogicalHeight()) | 636 if (hasReplacedLogicalHeight()) |
| 636 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplace dLogicalHeightUsing(MainOrPreferredSize, style()->logicalHeight())); | 637 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplace dLogicalHeightUsing(MainOrPreferredSize, style()->logicalHeight())); |
| 637 | 638 |
| 638 LayoutBox* contentLayoutObject = embeddedContentBox(); | 639 LayoutBox* contentLayoutObject = embeddedContentBox(); |
| 639 | 640 |
| 640 // 10.6.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html #inline-replaced-height | 641 // 10.6.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html #inline-replaced-height |
| 641 double intrinsicRatio = 0; | 642 IntrinsicSizingInfo intrinsicSizingInfo; |
| 642 FloatSize constrainedSize; | 643 computeIntrinsicSizingInfoForLayoutBox(contentLayoutObject, intrinsicSizingI nfo); |
| 643 computeAspectRatioInformationForLayoutBox(contentLayoutObject, constrainedSi ze, intrinsicRatio); | 644 FloatSize constrainedSize = constrainIntrinsicSizeToMinMax(intrinsicSizingIn fo); |
| 644 | 645 |
| 645 bool widthIsAuto = style()->logicalWidth().isAuto(); | 646 bool widthIsAuto = style()->logicalWidth().isAuto(); |
| 646 // TODO(shanmuga.m@samsung.com): hasIntrinsicWidth/Height information should be obtained | 647 // TODO(shanmuga.m@samsung.com): hasIntrinsicWidth/Height information should be obtained |
| 647 // from LayoutBox::computeIntrinsicRatioInformation(). | 648 // from LayoutBox::computeIntrinsicSizingInfo(). |
| 648 bool hasIntrinsicHeight = constrainedSize.height() > 0 || hasIntrinsicHeight ForLayoutBox(contentLayoutObject); | 649 bool hasIntrinsicHeight = constrainedSize.height() > 0 || hasIntrinsicHeight ForLayoutBox(contentLayoutObject); |
| 649 | 650 |
| 650 // 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'. | 651 // 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'. |
| 651 if (widthIsAuto && hasIntrinsicHeight) | 652 if (widthIsAuto && hasIntrinsicHeight) |
| 652 return computeReplacedLogicalHeightRespectingMinMaxHeight(constrainedSiz e.height()); | 653 return computeReplacedLogicalHeightRespectingMinMaxHeight(constrainedSiz e.height()); |
| 653 | 654 |
| 654 // Otherwise, if 'height' has a computed value of 'auto', and the element ha s an intrinsic ratio then the used value of 'height' is: | 655 // Otherwise, if 'height' has a computed value of 'auto', and the element ha s an intrinsic ratio then the used value of 'height' is: |
| 655 // (used width) / (intrinsic ratio) | 656 // (used width) / (intrinsic ratio) |
| 656 if (intrinsicRatio) | 657 if (intrinsicSizingInfo.aspectRatio) |
| 657 return computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit(ava ilableLogicalWidth() / intrinsicRatio)); | 658 return computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit(ava ilableLogicalWidth() / intrinsicSizingInfo.aspectRatio)); |
| 658 | 659 |
| 659 // 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'. | 660 // 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'. |
| 660 if (hasIntrinsicHeight) | 661 if (hasIntrinsicHeight) |
| 661 return computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit(con strainedSize.height())); | 662 return computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit(con strainedSize.height())); |
| 662 | 663 |
| 663 // Otherwise, if 'height' has a computed value of 'auto', but none of the co nditions above are met, then the used value of 'height' must be set to the heigh t | 664 // Otherwise, if 'height' has a computed value of 'auto', but none of the co nditions above are met, then the used value of 'height' must be set to the heigh t |
| 664 // of the largest rectangle that has a 2:1 ratio, has a height not greater t han 150px, and has a width not greater than the device width. | 665 // of the largest rectangle that has a 2:1 ratio, has a height not greater t han 150px, and has a width not greater than the device width. |
| 665 return computeReplacedLogicalHeightRespectingMinMaxHeight(intrinsicLogicalHe ight()); | 666 return computeReplacedLogicalHeightRespectingMinMaxHeight(intrinsicLogicalHe ight()); |
| 666 } | 667 } |
| 667 | 668 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 773 // We only include the space below the baseline in our layer's cached paint invalidation rect if the | 774 // We only include the space below the baseline in our layer's cached paint invalidation rect if the |
| 774 // image is selected. Since the selection state has changed update the rect. | 775 // image is selected. Since the selection state has changed update the rect. |
| 775 if (hasLayer()) | 776 if (hasLayer()) |
| 776 setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(containe rForPaintInvalidation())); | 777 setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(containe rForPaintInvalidation())); |
| 777 | 778 |
| 778 if (canUpdateSelectionOnRootLineBoxes()) | 779 if (canUpdateSelectionOnRootLineBoxes()) |
| 779 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone ); | 780 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone ); |
| 780 } | 781 } |
| 781 | 782 |
| 782 } // namespace blink | 783 } // namespace blink |
| OLD | NEW |