Skip to content

Commit

Permalink
Store replaced element's aspect ratio into its own struct.
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=248096
rdar://102525236

Reviewed by Alan Baradlay.

When replaced element's compute their aspect ratio, the value is stored
inside of a double This value is computed fairly deep in the
computeIntrinsicRatioInformation call stack and then is propagated back
up to where it will be used. This has been causing some slight
issues with precision when making other changes to replaced element
sizing code that uses the aspect ratio.

To help with this, this patch changes how the aspect ratio is stored by
instead storing each dimension that corresponds with the aspect ratio
into a FloatSize. This variable is then propagated back up the same call
stack the same way and then the caller can determine how they want to
use the aspect ratio (compute into a double or use the individual
dimensions).

For this patch there is no functional change because we will store the
value in a double regardless. However, we do seem to progress on a test
(fast/replaced/width100percent-image). The new sizes match how other
browsers are sizing the image. This is likely due to the change in
RenderReplaced::computeIntrinsicRatioInformation. The old version was
computing the intrinsicRatio by dividing two floats. The new version
is storing the dimensions in FloatSize, but the aspect ratio is being
computed by casting one of the values in the operation to a double.
aspectRatioDouble was added into FloatSize to help with this.

This patch also introduces aspectRatioLogicalWidth and
aspectRatioLogicalHeight inside RenderStyle. These methods will return
the correct width/height depending on the writing mode.

* LayoutTests/platform/gtk/fast/replaced/width100percent-image-expected.txt:
* LayoutTests/platform/ios/fast/replaced/width100percent-image-expected.txt:
* LayoutTests/platform/mac/fast/replaced/width100percent-image-expected.txt:
* Source/WebCore/platform/graphics/FloatSize.h:
(WebCore::FloatSize::aspectRatioDouble const):
* Source/WebCore/rendering/RenderBox.h:
(WebCore::RenderBox::computeIntrinsicRatioInformation const):
* Source/WebCore/rendering/RenderImage.cpp:
(WebCore::RenderImage::computeIntrinsicRatioInformation const):
* Source/WebCore/rendering/RenderImage.h:
* Source/WebCore/rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeAspectRatioInformationForRenderBox const):
(WebCore::RenderReplaced::computeIntrinsicAspectRatio const):
(WebCore::RenderReplaced::computeIntrinsicRatioInformation const):
(WebCore::RenderReplaced::computeReplacedLogicalWidth const):
(WebCore::resolveHeightForRatio):
(WebCore::RenderReplaced::computeReplacedLogicalHeight const):
* Source/WebCore/rendering/RenderReplaced.h:
* Source/WebCore/rendering/style/RenderStyle.h:
(WebCore::RenderStyle::aspectRatioLogicalWidth const):
(WebCore::RenderStyle::aspectRatioLogicalHeight const):
* Source/WebCore/rendering/svg/LegacyRenderSVGRoot.cpp:
(WebCore::LegacyRenderSVGRoot::computeIntrinsicRatioInformation const):
* Source/WebCore/rendering/svg/LegacyRenderSVGRoot.h:
* Source/WebCore/rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::computeIntrinsicRatioInformation const):
* Source/WebCore/rendering/svg/RenderSVGRoot.h:

Canonical link: https://commits.webkit.org/257430@main
  • Loading branch information
sammygill committed Dec 6, 2022
1 parent a0488d1 commit 90b0d80
Show file tree
Hide file tree
Showing 14 changed files with 69 additions and 56 deletions.
Expand Up @@ -28,10 +28,10 @@ layer at (0,0) size 800x600
RenderTableRow {TR} at (0,1) size 784x277
RenderTableCell {TD} at (1,1) size 216x277 [r=0 c=0 rs=1 cs=1]
RenderImage {IMG} at (1,1) size 214x275
RenderTableCell {TD} at (217,1) size 217x277 [r=0 c=1 rs=1 cs=1]
RenderTableCell {TD} at (218,1) size 216x277 [r=0 c=1 rs=1 cs=1]
RenderImage {IMG} at (1,1) size 214x275
RenderTableCell {TD} at (434,1) size 217x277 [r=0 c=2 rs=1 cs=1]
RenderTableCell {TD} at (435,1) size 216x277 [r=0 c=2 rs=1 cs=1]
RenderImage {IMG} at (1,1) size 214x275
RenderTableCell {TD} at (651,129) size 132x21 [r=0 c=3 rs=1 cs=1]
RenderTableCell {TD} at (652,129) size 131x21 [r=0 c=3 rs=1 cs=1]
RenderText {#text} at (1,0) size 4x19
text run at (1,1) width 4: " "
Expand Up @@ -28,10 +28,10 @@ layer at (0,0) size 800x600
RenderTableRow {TR} at (0,1) size 784x277
RenderTableCell {TD} at (1,1) size 216x277 [r=0 c=0 rs=1 cs=1]
RenderImage {IMG} at (1,1) size 214x275
RenderTableCell {TD} at (217,1) size 217x277 [r=0 c=1 rs=1 cs=1]
RenderTableCell {TD} at (218,1) size 216x277 [r=0 c=1 rs=1 cs=1]
RenderImage {IMG} at (1,1) size 214x275
RenderTableCell {TD} at (434,1) size 217x277 [r=0 c=2 rs=1 cs=1]
RenderTableCell {TD} at (435,1) size 216x277 [r=0 c=2 rs=1 cs=1]
RenderImage {IMG} at (1,1) size 214x275
RenderTableCell {TD} at (651,128) size 132x23 [r=0 c=3 rs=1 cs=1]
RenderTableCell {TD} at (652,128) size 131x23 [r=0 c=3 rs=1 cs=1]
RenderText {#text} at (1,0) size 4x21
text run at (1,1) width 4: " "
Expand Up @@ -28,10 +28,10 @@ layer at (0,0) size 800x600
RenderTableRow {TR} at (0,1) size 784x277
RenderTableCell {TD} at (1,1) size 216x277 [r=0 c=0 rs=1 cs=1]
RenderImage {IMG} at (1,1) size 214x275
RenderTableCell {TD} at (217,1) size 217x277 [r=0 c=1 rs=1 cs=1]
RenderTableCell {TD} at (218,1) size 216x277 [r=0 c=1 rs=1 cs=1]
RenderImage {IMG} at (1,1) size 214x275
RenderTableCell {TD} at (434,1) size 217x277 [r=0 c=2 rs=1 cs=1]
RenderTableCell {TD} at (435,1) size 216x277 [r=0 c=2 rs=1 cs=1]
RenderImage {IMG} at (1,1) size 214x275
RenderTableCell {TD} at (651,129) size 132x21 [r=0 c=3 rs=1 cs=1]
RenderTableCell {TD} at (652,129) size 131x21 [r=0 c=3 rs=1 cs=1]
RenderText {#text} at (1,0) size 4x20
text run at (1,1) width 4: " "
1 change: 1 addition & 0 deletions Source/WebCore/platform/graphics/FloatSize.h
Expand Up @@ -78,6 +78,7 @@ class FloatSize {
bool isExpressibleAsIntSize() const;

float aspectRatio() const { return m_width / m_height; }
double aspectRatioDouble() const { return m_width / static_cast<double>(m_height); }

void expand(float width, float height)
{
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/RenderBox.h
Expand Up @@ -617,7 +617,7 @@ override;
bool hasVisualOverflow() const { return m_overflow && !borderBoxRect().contains(m_overflow->visualOverflowRect()); }

virtual bool needsPreferredWidthsRecalculation() const;
virtual void computeIntrinsicRatioInformation(FloatSize& /* intrinsicSize */, double& /* intrinsicRatio */) const { }
virtual void computeIntrinsicRatioInformation(FloatSize& /* intrinsicSize */, FloatSize& /* intrinsicRatio */) const { }

ScrollPosition scrollPosition() const;
LayoutSize cachedSizeForOverflowClip() const;
Expand Down
6 changes: 3 additions & 3 deletions Source/WebCore/rendering/RenderImage.cpp
Expand Up @@ -858,7 +858,7 @@ void RenderImage::layoutShadowContent(const LayoutSize& oldSize)
clearChildNeedsLayout();
}

void RenderImage::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio) const
void RenderImage::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, FloatSize& intrinsicRatio) const
{
ASSERT(!shouldApplySizeContainment());
RenderReplaced::computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio);
Expand All @@ -877,9 +877,9 @@ void RenderImage::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, dou
if (shouldDisplayBrokenImageIcon()) {
if (settings().aspectRatioOfImgFromWidthAndHeightEnabled()
&& style().aspectRatioType() == AspectRatioType::AutoAndRatio && !isShowingAltText())
intrinsicRatio = style().logicalAspectRatio();
intrinsicRatio = FloatSize::narrowPrecision(style().aspectRatioLogicalWidth(), style().aspectRatioLogicalHeight());
else
intrinsicRatio = 1;
intrinsicRatio = { 1.0, 1.0 };
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/RenderImage.h
Expand Up @@ -89,7 +89,7 @@ class RenderImage : public RenderReplaced {

bool needsPreferredWidthsRecalculation() const final;
RenderBox* embeddedContentBox() const final;
void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio) const final;
void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, FloatSize& intrinsicRatio) const final;
bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, unsigned maxDepthToTest) const override;

void styleWillChange(StyleDifference, const RenderStyle& newStyle) override;
Expand Down
52 changes: 26 additions & 26 deletions Source/WebCore/rendering/RenderReplaced.cpp
Expand Up @@ -395,16 +395,16 @@ static bool isVideoWithDefaultObjectSize(const RenderReplaced* maybeVideo)
return false;
}

void RenderReplaced::computeAspectRatioInformationForRenderBox(RenderBox* contentRenderer, FloatSize& constrainedSize, double& intrinsicRatio) const
void RenderReplaced::computeAspectRatioInformationForRenderBox(RenderBox* contentRenderer, FloatSize& constrainedSize, FloatSize& intrinsicRatio) const
{
FloatSize intrinsicSize;
if (shouldApplySizeContainment())
RenderReplaced::computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio);
else if (contentRenderer) {
contentRenderer->computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio);

if (style().aspectRatioType() == AspectRatioType::Ratio || (style().aspectRatioType() == AspectRatioType::AutoAndRatio && !intrinsicRatio))
intrinsicRatio = style().aspectRatioWidth() / style().aspectRatioHeight();
if (style().aspectRatioType() == AspectRatioType::Ratio || (style().aspectRatioType() == AspectRatioType::AutoAndRatio && intrinsicRatio.isEmpty()))
intrinsicRatio = FloatSize::narrowPrecision(style().aspectRatioWidth(), style().aspectRatioHeight());

// Handle zoom & vertical writing modes here, as the embedded document doesn't know about them.
intrinsicSize.scale(style().effectiveZoom());
Expand All @@ -415,17 +415,17 @@ void RenderReplaced::computeAspectRatioInformationForRenderBox(RenderBox* conten
// Update our intrinsic size to match what the content renderer has computed, so that when we
// constrain the size below, the correct intrinsic size will be obtained for comparison against
// min and max widths.
if (intrinsicRatio && !intrinsicSize.isZero())
if (!intrinsicRatio.isEmpty() && !intrinsicSize.isZero())
m_intrinsicSize = LayoutSize(intrinsicSize);

if (!isHorizontalWritingMode()) {
if (intrinsicRatio)
intrinsicRatio = 1 / intrinsicRatio;
if (!intrinsicRatio.isEmpty())
intrinsicRatio = intrinsicRatio.transposedSize();
intrinsicSize = intrinsicSize.transposedSize();
}
} else {
computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio);
if (intrinsicRatio && !intrinsicSize.isZero())
if (!intrinsicRatio.isEmpty() && !intrinsicSize.isZero())
m_intrinsicSize = LayoutSize(isHorizontalWritingMode() ? intrinsicSize : intrinsicSize.transposedSize());
}

Expand All @@ -436,11 +436,11 @@ void RenderReplaced::computeAspectRatioInformationForRenderBox(RenderBox* conten
// FIXME: In the long term, it might be better to just return this code more to the way it used to be before this
// function was added, since all it has done is make the code more unclear.
constrainedSize = intrinsicSize;
if (intrinsicRatio && !intrinsicSize.isEmpty() && style().logicalWidth().isAuto() && style().logicalHeight().isAuto()) {
if (!intrinsicRatio.isEmpty() && !intrinsicSize.isEmpty() && style().logicalWidth().isAuto() && style().logicalHeight().isAuto()) {
if (isVideoWithDefaultObjectSize(this)) {
LayoutUnit width = RenderBox::computeReplacedLogicalWidth();
constrainedSize.setWidth(width);
LayoutUnit height = blockSizeFromAspectRatio(horizontalBorderAndPaddingExtent(), verticalBorderAndPaddingExtent(), intrinsicRatio, BoxSizing::ContentBox, adjustBorderBoxLogicalWidthForBoxSizing(width, LengthType::Fixed));
LayoutUnit height = blockSizeFromAspectRatio(horizontalBorderAndPaddingExtent(), verticalBorderAndPaddingExtent(), intrinsicRatio.width() / intrinsicRatio.height(), BoxSizing::ContentBox, adjustBorderBoxLogicalWidthForBoxSizing(width, LengthType::Fixed));
constrainedSize.setHeight(height.round() - verticalBorderAndPaddingExtent());
} else {
// We can't multiply or divide by 'intrinsicRatio' here, it breaks tests, like fast/images/zoomed-img-size.html, which
Expand Down Expand Up @@ -487,10 +487,10 @@ LayoutRect RenderReplaced::replacedContentRect(const LayoutSize& intrinsicSize)

double RenderReplaced::computeIntrinsicAspectRatio() const
{
double intrinsicRatio;
FloatSize intrinsicRatio;
FloatSize intrinsicSize;
computeAspectRatioInformationForRenderBox(embeddedContentBox(), intrinsicSize, intrinsicRatio);
return intrinsicRatio;
return intrinsicRatio.aspectRatioDouble();
}

RoundedRect RenderReplaced::roundedContentBoxRect() const
Expand All @@ -500,14 +500,14 @@ RoundedRect RenderReplaced::roundedContentBoxRect() const
borderLeft() + paddingLeft(), borderRight() + paddingRight());
}

void RenderReplaced::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio) const
void RenderReplaced::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, FloatSize& intrinsicRatio) const
{
// If there's an embeddedContentBox() of a remote, referenced document available, this code-path should never be used.
ASSERT(!embeddedContentBox() || shouldApplySizeContainment());
intrinsicSize = FloatSize(intrinsicLogicalWidth(), intrinsicLogicalHeight());

if (style().hasAspectRatio()) {
intrinsicRatio = style().logicalAspectRatio();
intrinsicRatio = FloatSize::narrowPrecision(style().aspectRatioLogicalWidth(), style().aspectRatioLogicalHeight());
if (style().aspectRatioType() == AspectRatioType::Ratio || isVideoWithDefaultObjectSize(this))
return;
}
Expand All @@ -519,7 +519,7 @@ void RenderReplaced::computeIntrinsicRatioInformation(FloatSize& intrinsicSize,
if (intrinsicSize.isEmpty() || shouldApplySizeContainment())
return;

intrinsicRatio = intrinsicSize.width() / intrinsicSize.height();
intrinsicRatio = { intrinsicSize.width(), intrinsicSize.height() };
}

LayoutUnit RenderReplaced::computeConstrainedLogicalWidth(ShouldComputePreferred shouldComputePreferred) const
Expand Down Expand Up @@ -571,7 +571,7 @@ LayoutUnit RenderReplaced::computeReplacedLogicalWidth(ShouldComputePreferred sh
RenderBox* contentRenderer = embeddedContentBox();

// 10.3.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-width
double intrinsicRatio = 0;
FloatSize intrinsicRatio;
FloatSize constrainedSize;
computeAspectRatioInformationForRenderBox(contentRenderer, constrainedSize, intrinsicRatio);

Expand All @@ -583,22 +583,22 @@ LayoutUnit RenderReplaced::computeReplacedLogicalWidth(ShouldComputePreferred sh
// For flex or grid items where the logical height has been overriden then we should use that size to compute the replaced width as long as the flex or
// grid item has an intrinsic size. It is possible (indeed, common) for an SVG graphic to have an intrinsic aspect ratio but not to have an intrinsic
// width or height. There are also elements with intrinsic sizes but without intrinsic ratio (like an iframe).
if (intrinsicRatio && (isFlexItem() || isGridItem()) && hasOverridingLogicalHeight() && hasIntrinsicSize(contentRenderer, hasIntrinsicWidth, hasIntrinsicHeight))
return computeReplacedLogicalWidthRespectingMinMaxWidth(overridingContentLogicalHeight() * intrinsicRatio, shouldComputePreferred);
if (!intrinsicRatio.isEmpty() && (isFlexItem() || isGridItem()) && hasOverridingLogicalHeight() && hasIntrinsicSize(contentRenderer, hasIntrinsicWidth, hasIntrinsicHeight))
return computeReplacedLogicalWidthRespectingMinMaxWidth(overridingContentLogicalHeight() * intrinsicRatio.aspectRatioDouble(), shouldComputePreferred);

// If 'height' and 'width' both have computed values of 'auto' and the element also has an intrinsic width, then that intrinsic width is the used value of 'width'.
if (computedHeightIsAuto && hasIntrinsicWidth)
return computeReplacedLogicalWidthRespectingMinMaxWidth(constrainedSize.width(), shouldComputePreferred);

if (!isAspectRatioDegenerate(intrinsicRatio)) {
if (!intrinsicRatio.isEmpty()) {
// If 'height' and 'width' both have computed values of 'auto' and the element has no intrinsic width, but does have an intrinsic height and intrinsic ratio;
// or if 'width' has a computed value of 'auto', 'height' has some other computed value, and the element does have an intrinsic ratio; then the used value
// of 'width' is: (used height) * (intrinsic ratio)
if (!computedHeightIsAuto || (!hasIntrinsicWidth && hasIntrinsicHeight)) {
LayoutUnit estimatedUsedWidth = hasIntrinsicWidth ? LayoutUnit(constrainedSize.width()) : computeConstrainedLogicalWidth(shouldComputePreferred);
LayoutUnit logicalHeight = computeReplacedLogicalHeight(std::optional<LayoutUnit>(estimatedUsedWidth));
BoxSizing boxSizing = style().hasAspectRatio() ? style().boxSizingForAspectRatio() : BoxSizing::ContentBox;
return computeReplacedLogicalWidthRespectingMinMaxWidth(resolveWidthForRatio(borderAndPaddingLogicalHeight(), borderAndPaddingLogicalWidth(), logicalHeight, intrinsicRatio, boxSizing), shouldComputePreferred);
return computeReplacedLogicalWidthRespectingMinMaxWidth(resolveWidthForRatio(borderAndPaddingLogicalHeight(), borderAndPaddingLogicalWidth(), logicalHeight, intrinsicRatio.aspectRatioDouble(), boxSizing), shouldComputePreferred);
}

// If 'height' and 'width' both have computed values of 'auto' and the
Expand Down Expand Up @@ -629,8 +629,8 @@ LayoutUnit RenderReplaced::computeReplacedLogicalWidth(ShouldComputePreferred sh
static inline LayoutUnit resolveHeightForRatio(LayoutUnit borderAndPaddingLogicalWidth, LayoutUnit borderAndPaddingLogicalHeight, LayoutUnit logicalWidth, double aspectRatio, BoxSizing boxSizing)
{
if (boxSizing == BoxSizing::BorderBox)
return LayoutUnit((logicalWidth + borderAndPaddingLogicalWidth) / aspectRatio) - borderAndPaddingLogicalHeight;
return LayoutUnit(logicalWidth / aspectRatio);
return LayoutUnit((logicalWidth + borderAndPaddingLogicalWidth) * aspectRatio) - borderAndPaddingLogicalHeight;
return LayoutUnit(logicalWidth * aspectRatio);
}

LayoutUnit RenderReplaced::computeReplacedLogicalHeight(std::optional<LayoutUnit> estimatedUsedWidth) const
Expand All @@ -642,7 +642,7 @@ LayoutUnit RenderReplaced::computeReplacedLogicalHeight(std::optional<LayoutUnit
RenderBox* contentRenderer = embeddedContentBox();

// 10.6.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-height
double intrinsicRatio = 0;
FloatSize intrinsicRatio;
FloatSize constrainedSize;
computeAspectRatioInformationForRenderBox(contentRenderer, constrainedSize, intrinsicRatio);

Expand All @@ -651,21 +651,21 @@ LayoutUnit RenderReplaced::computeReplacedLogicalHeight(std::optional<LayoutUnit
bool hasIntrinsicWidth = constrainedSize.width() > 0;

// See computeReplacedLogicalHeight() for a similar check for heights.
if (intrinsicRatio && (isFlexItem() || isGridItem()) && hasOverridingLogicalWidth() && hasIntrinsicSize(contentRenderer, hasIntrinsicWidth, hasIntrinsicHeight))
return computeReplacedLogicalHeightRespectingMinMaxHeight(overridingContentLogicalWidth() / intrinsicRatio);
if (!intrinsicRatio.isEmpty() && (isFlexItem() || isGridItem()) && hasOverridingLogicalWidth() && hasIntrinsicSize(contentRenderer, hasIntrinsicWidth, hasIntrinsicHeight))
return computeReplacedLogicalHeightRespectingMinMaxHeight(overridingContentLogicalWidth() * intrinsicRatio.transposedSize().aspectRatioDouble());

// If 'height' and 'width' both have computed values of 'auto' and the element also has an intrinsic height, then that intrinsic height is the used value of 'height'.
if (widthIsAuto && hasIntrinsicHeight)
return computeReplacedLogicalHeightRespectingMinMaxHeight(constrainedSize.height());

// Otherwise, if 'height' has a computed value of 'auto', and the element has an intrinsic ratio then the used value of 'height' is:
// (used width) / (intrinsic ratio)
if (intrinsicRatio) {
if (!intrinsicRatio.isEmpty()) {
LayoutUnit usedWidth = estimatedUsedWidth ? estimatedUsedWidth.value() : availableLogicalWidth();
BoxSizing boxSizing = BoxSizing::ContentBox;
if (style().hasAspectRatio())
boxSizing = style().boxSizingForAspectRatio();
return computeReplacedLogicalHeightRespectingMinMaxHeight(resolveHeightForRatio(borderAndPaddingLogicalWidth(), borderAndPaddingLogicalHeight(), usedWidth, intrinsicRatio, boxSizing));
return computeReplacedLogicalHeightRespectingMinMaxHeight(resolveHeightForRatio(borderAndPaddingLogicalWidth(), borderAndPaddingLogicalHeight(), usedWidth, intrinsicRatio.transposedSize().aspectRatioDouble(), boxSizing));
}

// Otherwise, if 'height' has a computed value of 'auto', and the element has an intrinsic height, then that intrinsic height is the used value of 'height'.
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/rendering/RenderReplaced.h
Expand Up @@ -58,7 +58,7 @@ class RenderReplaced : public RenderBox {

double computeIntrinsicAspectRatio() const;

void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio) const override;
void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, FloatSize& intrinsicRatio) const override;

protected:
RenderReplaced(Element&, RenderStyle&&);
Expand Down Expand Up @@ -104,7 +104,7 @@ class RenderReplaced : public RenderBox {
bool canBeSelectionLeaf() const override { return true; }

LayoutRect selectionRectForRepaint(const RenderLayerModelObject* repaintContainer, bool clipToVisibleContent = true) final;
void computeAspectRatioInformationForRenderBox(RenderBox*, FloatSize& constrainedSize, double& intrinsicRatio) const;
void computeAspectRatioInformationForRenderBox(RenderBox*, FloatSize& constrainedSize, FloatSize& intrinsicRatio) const;

virtual bool shouldDrawSelectionTint() const;

Expand Down
12 changes: 12 additions & 0 deletions Source/WebCore/rendering/style/RenderStyle.h
Expand Up @@ -527,6 +527,18 @@ class RenderStyle {
AspectRatioType aspectRatioType() const { return static_cast<AspectRatioType>(m_rareNonInheritedData->aspectRatioType); }
double aspectRatioWidth() const { return m_rareNonInheritedData->aspectRatioWidth; }
double aspectRatioHeight() const { return m_rareNonInheritedData->aspectRatioHeight; }
double aspectRatioLogicalWidth() const
{
if (isHorizontalWritingMode())
return aspectRatioWidth();
return aspectRatioHeight();
}
double aspectRatioLogicalHeight() const
{
if (isHorizontalWritingMode())
return aspectRatioHeight();
return aspectRatioWidth();
}
double logicalAspectRatio() const
{
ASSERT(aspectRatioType() != AspectRatioType::Auto);
Expand Down

0 comments on commit 90b0d80

Please sign in to comment.