Title: [275402] trunk/Source/WebCore
- Revision
- 275402
- Author
- [email protected]
- Date
- 2021-04-01 21:02:04 -0700 (Thu, 01 Apr 2021)
Log Message
Expand on shouldComputeLogicalWidthFromAspectRatioAndInsets return logic
https://bugs.webkit.org/show_bug.cgi?id=224057
Reviewed by Rob Buis.
In this patch we also start checking against logicalWidth/height instead of just width/height.
* rendering/RenderBox.cpp:
(WebCore::shouldComputeLogicalWidthFromAspectRatioAndInsets):
(WebCore::RenderBox::shouldComputeLogicalHeightFromAspectRatio const):
(WebCore::RenderBox::shouldComputeLogicalWidthFromAspectRatio const):
(WebCore::RenderBox::shouldComputeLogicalWidthFromAspectRatioAndInsets const): Deleted.
* rendering/RenderBox.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (275401 => 275402)
--- trunk/Source/WebCore/ChangeLog 2021-04-02 03:19:40 UTC (rev 275401)
+++ trunk/Source/WebCore/ChangeLog 2021-04-02 04:02:04 UTC (rev 275402)
@@ -1,3 +1,19 @@
+2021-04-01 Zalan Bujtas <[email protected]>
+
+ Expand on shouldComputeLogicalWidthFromAspectRatioAndInsets return logic
+ https://bugs.webkit.org/show_bug.cgi?id=224057
+
+ Reviewed by Rob Buis.
+
+ In this patch we also start checking against logicalWidth/height instead of just width/height.
+
+ * rendering/RenderBox.cpp:
+ (WebCore::shouldComputeLogicalWidthFromAspectRatioAndInsets):
+ (WebCore::RenderBox::shouldComputeLogicalHeightFromAspectRatio const):
+ (WebCore::RenderBox::shouldComputeLogicalWidthFromAspectRatio const):
+ (WebCore::RenderBox::shouldComputeLogicalWidthFromAspectRatioAndInsets const): Deleted.
+ * rendering/RenderBox.h:
+
2021-04-01 Alex Christensen <[email protected]>
REGRESSION(r272469) QuickLook previews broken in some places on macOS
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (275401 => 275402)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2021-04-02 03:19:40 UTC (rev 275401)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2021-04-02 04:02:04 UTC (rev 275402)
@@ -5100,12 +5100,35 @@
return !style().hasAspectRatio() || isTablePart();
}
+static inline bool shouldComputeLogicalWidthFromAspectRatioAndInsets(const RenderBox& renderer)
+{
+ if (!renderer.isOutOfFlowPositioned())
+ return false;
+
+ auto& style = renderer.style();
+ if (!style.logicalWidth().isAuto()) {
+ // Not applicable for aspect ratio computation.
+ return false;
+ }
+ // When both left and right are set, the out-of-flow positioned box is horizontally constrained and aspect ratio for the logical width is not applicable.
+ auto hasConstrainedWidth = !style.logicalLeft().isAuto() && !style.logicalRight().isAuto();
+ if (hasConstrainedWidth)
+ return false;
+
+ // When both top and bottom are set, the out-of-flow positioned box is vertically constrained and it can be used as if it had a non-auto height value.
+ auto hasConstrainedHeight = !style.logicalTop().isAuto() && !style.logicalBottom().isAuto();
+ if (!hasConstrainedHeight)
+ return false;
+ // FIXME: This could probably be omitted and let the callers handle the height check (as they seem to be doing anyway).
+ return style.logicalHeight().isAuto();
+}
+
bool RenderBox::shouldComputeLogicalHeightFromAspectRatio() const
{
if (shouldIgnoreAspectRatio())
return false;
- if (shouldComputeLogicalWidthFromAspectRatioAndInsets())
+ if (shouldComputeLogicalWidthFromAspectRatioAndInsets(*this))
return false;
auto h = style().logicalHeight();
@@ -5120,16 +5143,9 @@
auto isResolvablePercentageHeight = [&] {
return style().logicalHeight().isPercentOrCalculated() && (isOutOfFlowPositioned() || percentageLogicalHeightIsResolvable());
};
- return hasOverridingLogicalHeight() || shouldComputeLogicalWidthFromAspectRatioAndInsets() || style().logicalHeight().isFixed() || isResolvablePercentageHeight();
+ return hasOverridingLogicalHeight() || shouldComputeLogicalWidthFromAspectRatioAndInsets(*this) || style().logicalHeight().isFixed() || isResolvablePercentageHeight();
}
-bool RenderBox::shouldComputeLogicalWidthFromAspectRatioAndInsets() const
-{
- if (!isOutOfFlowPositioned())
- return false;
- return style().width().isAuto() && style().height().isAuto() && !style().logicalTop().isAuto() && !style().logicalBottom().isAuto() && (style().logicalLeft().isAuto() || style().logicalRight().isAuto());
-}
-
LayoutUnit RenderBox::computeLogicalWidthFromAspectRatio(RenderFragmentContainer* fragment) const
{
ASSERT(shouldComputeLogicalWidthFromAspectRatio());
Modified: trunk/Source/WebCore/rendering/RenderBox.h (275401 => 275402)
--- trunk/Source/WebCore/rendering/RenderBox.h 2021-04-02 03:19:40 UTC (rev 275401)
+++ trunk/Source/WebCore/rendering/RenderBox.h 2021-04-02 04:02:04 UTC (rev 275402)
@@ -703,7 +703,6 @@
bool shouldIgnoreAspectRatio() const;
bool shouldComputeLogicalWidthFromAspectRatio() const;
- bool shouldComputeLogicalWidthFromAspectRatioAndInsets() const;
LayoutUnit computeLogicalWidthFromAspectRatio(RenderFragmentContainer* = nullptr) const;
std::pair<LayoutUnit, LayoutUnit> computeMinMaxLogicalWidthFromAspectRatio() const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes