Diff
Modified: trunk/Source/WebCore/ChangeLog (250049 => 250050)
--- trunk/Source/WebCore/ChangeLog 2019-09-18 19:39:53 UTC (rev 250049)
+++ trunk/Source/WebCore/ChangeLog 2019-09-18 19:56:14 UTC (rev 250050)
@@ -1,3 +1,61 @@
+2019-09-18 Zalan Bujtas <[email protected]>
+
+ [LFC] Introduce UsedHorizontalValues::Constraints
+ https://bugs.webkit.org/show_bug.cgi?id=201919
+ <rdar://problem/55481927>
+
+ Reviewed by Antti Koivisto.
+
+ UsedHorizontalValues::Constraints holds the constraint values for a particular box geometry computation (currently it only has the horizontal width constraint)
+
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * layout/FormattingContext.cpp:
+ (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry):
+ (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry):
+ (WebCore::Layout::FormattingContext::computeBorderAndPadding):
+ * layout/FormattingContextGeometry.cpp:
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry const):
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry const):
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry const):
+ (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
+ (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin const):
+ (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin const):
+ (WebCore::Layout::FormattingContext::Geometry::inFlowPositionedPositionOffset const):
+ (WebCore::Layout::FormattingContext::Geometry::computedPadding const):
+ (WebCore::Layout::FormattingContext::Geometry::computedHorizontalMargin const):
+ (WebCore::Layout::FormattingContext::Geometry::computedVerticalMargin const):
+ * layout/FormattingContextQuirks.cpp:
+ (WebCore::Layout::FormattingContext::Quirks::heightValueOfNearestContainingBlockWithFixedHeight):
+ * layout/LayoutUnits.h:
+ (WebCore::Layout::UsedHorizontalValues::Constraints::Constraints):
+ (WebCore::Layout::UsedHorizontalValues::UsedHorizontalValues):
+ * layout/blockformatting/BlockFormattingContext.cpp:
+ (WebCore::Layout::BlockFormattingContext::placeInFlowPositionedChildren):
+ (WebCore::Layout::BlockFormattingContext::computeEstimatedVerticalPosition):
+ (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin):
+ (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
+ * layout/blockformatting/BlockFormattingContextGeometry.cpp:
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin const):
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
+ * layout/blockformatting/BlockFormattingContextQuirks.cpp:
+ (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):
+ * layout/blockformatting/BlockMarginCollapse.cpp:
+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeValues):
+ * layout/floats/FloatingContext.h:
+ * layout/inlineformatting/InlineFormattingContext.cpp:
+ (WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
+ (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints):
+ (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingRoot):
+ (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin):
+ * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
+ (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
+ * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
+ (WebCore::Layout::InlineFormattingContext::InlineLayout::createDisplayRuns const):
+ * layout/tableformatting/TableFormattingContext.cpp:
+ (WebCore::Layout::TableFormattingContext::computePreferredWidthForColumns):
+
2019-09-18 Andy Estes <[email protected]>
[Apple Pay] Tell websites why a session was cancelled
Modified: trunk/Source/WebCore/Sources.txt (250049 => 250050)
--- trunk/Source/WebCore/Sources.txt 2019-09-18 19:39:53 UTC (rev 250049)
+++ trunk/Source/WebCore/Sources.txt 2019-09-18 19:56:14 UTC (rev 250050)
@@ -1396,6 +1396,7 @@
layout/FormattingState.cpp
layout/LayoutPhase.cpp
layout/LayoutState.cpp
+layout/LayoutUnits.cpp
layout/Verification.cpp
layout/blockformatting/BlockFormattingContext.cpp
layout/blockformatting/BlockFormattingContextGeometry.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (250049 => 250050)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-09-18 19:39:53 UTC (rev 250049)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-09-18 19:56:14 UTC (rev 250050)
@@ -5813,6 +5813,7 @@
113409D8203E038000C66915 /* RenderTreeBuilderContinuation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderTreeBuilderContinuation.h; sourceTree = "<group>"; };
113D0B4F1F9FDD2B00F611BB /* FrameViewLayoutContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FrameViewLayoutContext.cpp; sourceTree = "<group>"; };
113D0B501F9FDD2B00F611BB /* FrameViewLayoutContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FrameViewLayoutContext.h; sourceTree = "<group>"; };
+ 115CA83023328B1E00FD3B08 /* LayoutUnits.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutUnits.cpp; sourceTree = "<group>"; };
115CFA68208AF7D0001E6991 /* FormattingContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FormattingContext.h; sourceTree = "<group>"; };
115CFA69208AF7D0001E6991 /* FormattingContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FormattingContext.cpp; sourceTree = "<group>"; };
115CFA6C208AFAB6001E6991 /* BlockFormattingContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BlockFormattingContext.h; sourceTree = "<group>"; };
@@ -16409,6 +16410,7 @@
6FEFE81D22F9D22A00114927 /* LayoutPhase.h */,
6F7CA3C5208C2956002F29AB /* LayoutState.cpp */,
6F7CA3C4208C2956002F29AB /* LayoutState.h */,
+ 115CA83023328B1E00FD3B08 /* LayoutUnits.cpp */,
6F73918C2106CEDD006AF262 /* LayoutUnits.h */,
6FE7AA2621C37B6300296DCD /* MarginTypes.h */,
11FF02D520BA3C810083F25B /* Verification.cpp */,
Modified: trunk/Source/WebCore/layout/FormattingContext.cpp (250049 => 250050)
--- trunk/Source/WebCore/layout/FormattingContext.cpp 2019-09-18 19:39:53 UTC (rev 250049)
+++ trunk/Source/WebCore/layout/FormattingContext.cpp 2019-09-18 19:56:14 UTC (rev 250050)
@@ -70,7 +70,7 @@
auto containingBlockHeight = geometryForBox(*layoutBox.containingBlock()).paddingBoxHeight();
auto compute = [&](Optional<LayoutUnit> usedWidth) {
- auto usedHorizontalValues = UsedHorizontalValues { containingBlockWidth, usedWidth, { } };
+ auto usedHorizontalValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { containingBlockWidth }, usedWidth, { } };
auto usedVerticalValues = UsedVerticalValues { containingBlockHeight, { } };
return geometry().outOfFlowHorizontalGeometry(layoutBox, usedHorizontalValues, usedVerticalValues);
};
@@ -105,7 +105,7 @@
auto containingBlockWidth = containingBlockGeometry.paddingBoxHeight();
auto usedVerticalValuesForHeight = UsedVerticalValues { containingBlockHeight, { } };
- auto usedHorizontalValues = UsedHorizontalValues { containingBlockWidth };
+ auto usedHorizontalValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { containingBlockWidth } };
auto verticalGeometry = compute(usedHorizontalValues, usedVerticalValuesForHeight);
if (auto maxHeight = geometry().computedMaxHeight(layoutBox, containingBlockHeight)) {
@@ -133,7 +133,7 @@
void FormattingContext::computeBorderAndPadding(const Box& layoutBox, Optional<UsedHorizontalValues> usedHorizontalValues)
{
if (!usedHorizontalValues)
- usedHorizontalValues = UsedHorizontalValues { geometryForBox(*layoutBox.containingBlock()).contentBoxWidth() };
+ usedHorizontalValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { geometryForBox(*layoutBox.containingBlock()) } };
auto& displayBox = formattingState().displayBox(layoutBox);
displayBox.setBorder(geometry().computedBorder(layoutBox));
displayBox.setPadding(geometry().computedPadding(layoutBox, *usedHorizontalValues));
Modified: trunk/Source/WebCore/layout/FormattingContextGeometry.cpp (250049 => 250050)
--- trunk/Source/WebCore/layout/FormattingContextGeometry.cpp 2019-09-18 19:39:53 UTC (rev 250049)
+++ trunk/Source/WebCore/layout/FormattingContextGeometry.cpp 2019-09-18 19:56:14 UTC (rev 250050)
@@ -300,7 +300,7 @@
auto& style = layoutBox.style();
auto& boxGeometry = formattingContext.geometryForBox(layoutBox);
auto containingBlockHeight = *usedVerticalValues.containingBlockHeight;
- auto containingBlockWidth = usedHorizontalValues.containingBlockWidth;
+ auto containingBlockWidth = usedHorizontalValues.constraints.width;
auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth);
auto bottom = computedValueIfNotAuto(style.logicalBottom(), containingBlockWidth);
@@ -423,7 +423,7 @@
auto& formattingContext = this->formattingContext();
auto& style = layoutBox.style();
auto& boxGeometry = formattingContext.geometryForBox(layoutBox);
- auto containingBlockWidth = usedHorizontalValues.containingBlockWidth;
+ auto containingBlockWidth = usedHorizontalValues.constraints.width;
auto isLeftToRightDirection = layoutBox.containingBlock()->style().isLeftToRightDirection();
auto left = computedValueIfNotAuto(style.logicalLeft(), containingBlockWidth);
@@ -557,7 +557,7 @@
auto& style = layoutBox.style();
auto& boxGeometry = formattingContext.geometryForBox(layoutBox);
auto containingBlockHeight = *usedVerticalValues.containingBlockHeight;
- auto containingBlockWidth = usedHorizontalValues.containingBlockWidth;
+ auto containingBlockWidth = usedHorizontalValues.constraints.width;
auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth);
auto bottom = computedValueIfNotAuto(style.logicalBottom(), containingBlockWidth);
@@ -641,7 +641,7 @@
auto& formattingContext = this->formattingContext();
auto& style = layoutBox.style();
auto& boxGeometry = formattingContext.geometryForBox(layoutBox);
- auto containingBlockWidth = usedHorizontalValues.containingBlockWidth;
+ auto containingBlockWidth = usedHorizontalValues.constraints.width;
auto isLeftToRightDirection = layoutBox.containingBlock()->style().isLeftToRightDirection();
auto left = computedValueIfNotAuto(style.logicalLeft(), containingBlockWidth);
@@ -769,9 +769,9 @@
// #1
auto usedHorizontallMargin = UsedHorizontalMargin { computedHorizontalMargin.start.valueOr(0), computedHorizontalMargin.end.valueOr(0) };
// #2
- auto width = computedValueIfNotAuto(usedHorizontalValues.width ? Length { usedHorizontalValues.width.value(), Fixed } : layoutBox.style().logicalWidth(), usedHorizontalValues.containingBlockWidth);
+ auto width = computedValueIfNotAuto(usedHorizontalValues.width ? Length { usedHorizontalValues.width.value(), Fixed } : layoutBox.style().logicalWidth(), usedHorizontalValues.constraints.width);
if (!width)
- width = shrinkToFitWidth(layoutBox, usedHorizontalValues.containingBlockWidth);
+ width = shrinkToFitWidth(layoutBox, usedHorizontalValues.constraints.width);
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> floating non-replaced -> width(" << *width << "px) margin(" << usedHorizontallMargin.start << "px, " << usedHorizontallMargin.end << "px) -> layoutBox(" << &layoutBox << ")");
return WidthAndMargin { *width, usedHorizontallMargin, computedHorizontalMargin };
@@ -798,8 +798,8 @@
auto computedHorizontalMargin = Geometry::computedHorizontalMargin(layoutBox, usedHorizontalValues);
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> floating replaced -> redirected to inline replaced");
- return inlineReplacedWidthAndMargin(layoutBox, UsedHorizontalValues { usedHorizontalValues.containingBlockWidth,
- usedHorizontalValues.width, UsedHorizontalMargin { computedHorizontalMargin.start.valueOr(0), computedHorizontalMargin.end.valueOr(0) } });
+ usedHorizontalValues.margin = UsedHorizontalMargin { computedHorizontalMargin.start.valueOr(0), computedHorizontalMargin.end.valueOr(0) };
+ return inlineReplacedWidthAndMargin(layoutBox, usedHorizontalValues);
}
VerticalGeometry FormattingContext::Geometry::outOfFlowVerticalGeometry(const Box& layoutBox, UsedHorizontalValues usedHorizontalValues, UsedVerticalValues usedVerticalValues) const
@@ -908,7 +908,7 @@
// If 300px is too wide to fit the device, UAs should use the width of the largest rectangle that has a 2:1 ratio and fits the device instead.
auto& style = layoutBox.style();
- auto containingBlockWidth = usedHorizontalValues.containingBlockWidth;
+ auto containingBlockWidth = usedHorizontalValues.constraints.width;
auto computedHorizontalMargin = Geometry::computedHorizontalMargin(layoutBox, usedHorizontalValues);
auto usedMarginStart = [&] {
@@ -969,7 +969,7 @@
// 3. If neither is 'auto', 'bottom' is ignored (i.e., the used value of 'bottom' will be minus the value of 'top').
auto& style = layoutBox.style();
- auto containingBlockWidth = usedHorizontalValues.containingBlockWidth;
+ auto containingBlockWidth = usedHorizontalValues.constraints.width;
auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth);
auto bottom = computedValueIfNotAuto(style.logicalBottom(), containingBlockWidth);
@@ -1046,7 +1046,7 @@
return WTF::nullopt;
auto& style = layoutBox.style();
- auto containingBlockWidth = usedHorizontalValues.containingBlockWidth;
+ auto containingBlockWidth = usedHorizontalValues.constraints.width;
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Padding] -> layoutBox: " << &layoutBox);
return Edges {
{ valueForLength(style.paddingLeft(), containingBlockWidth), valueForLength(style.paddingRight(), containingBlockWidth) },
@@ -1057,7 +1057,7 @@
ComputedHorizontalMargin FormattingContext::Geometry::computedHorizontalMargin(const Box& layoutBox, UsedHorizontalValues usedHorizontalValues) const
{
auto& style = layoutBox.style();
- auto containingBlockWidth = usedHorizontalValues.containingBlockWidth;
+ auto containingBlockWidth = usedHorizontalValues.constraints.width;
return { computedValueIfNotAuto(style.marginStart(), containingBlockWidth), computedValueIfNotAuto(style.marginEnd(), containingBlockWidth) };
}
@@ -1064,7 +1064,7 @@
ComputedVerticalMargin FormattingContext::Geometry::computedVerticalMargin(const Box& layoutBox, UsedHorizontalValues usedHorizontalValues) const
{
auto& style = layoutBox.style();
- auto containingBlockWidth = usedHorizontalValues.containingBlockWidth;
+ auto containingBlockWidth = usedHorizontalValues.constraints.width;
return { computedValueIfNotAuto(style.marginBefore(), containingBlockWidth), computedValueIfNotAuto(style.marginAfter(), containingBlockWidth) };
}
Modified: trunk/Source/WebCore/layout/FormattingContextQuirks.cpp (250049 => 250050)
--- trunk/Source/WebCore/layout/FormattingContextQuirks.cpp 2019-09-18 19:39:53 UTC (rev 250049)
+++ trunk/Source/WebCore/layout/FormattingContextQuirks.cpp 2019-09-18 19:56:14 UTC (rev 250050)
@@ -52,7 +52,7 @@
if (containingBlock->isBodyBox() || containingBlock->isDocumentBox()) {
auto& boxGeometry = formattingContext.geometryForBox(*containingBlock, FormattingContext::EscapeType::AccessAncestorFormattingContext);
- auto usedValues = UsedHorizontalValues { formattingContext.geometryForBox(*containingBlock->containingBlock(), FormattingContext::EscapeType::AccessAncestorFormattingContext).contentBoxWidth() };
+ auto usedValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { formattingContext.geometryForBox(*containingBlock->containingBlock(), FormattingContext::EscapeType::AccessAncestorFormattingContext) } };
auto verticalMargin = formattingContext.geometry().computedVerticalMargin(*containingBlock, usedValues);
auto verticalPadding = boxGeometry.paddingTop().valueOr(0) + boxGeometry.paddingBottom().valueOr(0);
auto verticalBorder = boxGeometry.borderTop() + boxGeometry.borderBottom();
Added: trunk/Source/WebCore/layout/LayoutUnits.cpp (0 => 250050)
--- trunk/Source/WebCore/layout/LayoutUnits.cpp (rev 0)
+++ trunk/Source/WebCore/layout/LayoutUnits.cpp 2019-09-18 19:56:14 UTC (rev 250050)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "LayoutUnits.h"
+
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+
+#include "DisplayBox.h"
+
+namespace WebCore {
+namespace Layout {
+
+UsedHorizontalValues::Constraints::Constraints(const Display::Box& containingBlockGeometry)
+ : width(containingBlockGeometry.contentBoxWidth())
+{
+}
+
+}
+}
+#endif
Modified: trunk/Source/WebCore/layout/LayoutUnits.h (250049 => 250050)
--- trunk/Source/WebCore/layout/LayoutUnits.h 2019-09-18 19:39:53 UTC (rev 250049)
+++ trunk/Source/WebCore/layout/LayoutUnits.h 2019-09-18 19:56:14 UTC (rev 250050)
@@ -34,6 +34,11 @@
#include <wtf/Optional.h>
namespace WebCore {
+
+namespace Display {
+class Box;
+}
+
namespace Layout {
struct Position {
@@ -138,19 +143,29 @@
};
struct UsedHorizontalValues {
- explicit UsedHorizontalValues(LayoutUnit containingBlockWidth)
- : containingBlockWidth(containingBlockWidth)
+ struct Constraints {
+ explicit Constraints(const Display::Box& containingBlockGeometry);
+ explicit Constraints(LayoutUnit horizontalConstraint)
+ : width(horizontalConstraint)
{
}
- explicit UsedHorizontalValues(LayoutUnit containingBlockWidth, Optional<LayoutUnit> width, Optional<UsedHorizontalMargin> margin)
- : containingBlockWidth(containingBlockWidth)
+ LayoutUnit width;
+ };
+
+ explicit UsedHorizontalValues(Constraints constraints)
+ : constraints(constraints)
+ {
+ }
+
+ explicit UsedHorizontalValues(Constraints constraints, Optional<LayoutUnit> width, Optional<UsedHorizontalMargin> margin)
+ : constraints(constraints)
, width(width)
, margin(margin)
- {
- }
+ {
+ }
- LayoutUnit containingBlockWidth;
+ Constraints constraints;
Optional<LayoutUnit> width;
Optional<UsedHorizontalMargin> margin;
};
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (250049 => 250050)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2019-09-18 19:39:53 UTC (rev 250049)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2019-09-18 19:56:14 UTC (rev 250050)
@@ -33,6 +33,7 @@
#include "FloatingContext.h"
#include "FloatingState.h"
#include "LayoutBox.h"
+#include "LayoutChildIterator.h"
#include "LayoutContainer.h"
#include "LayoutState.h"
#include "Logging.h"
@@ -193,7 +194,7 @@
continue;
auto computeInFlowPositionedPosition = [&] {
- auto usedHorizontalValues = UsedHorizontalValues { geometryForBox(*childBox.containingBlock()).contentBoxWidth() };
+ auto usedHorizontalValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { geometryForBox(*childBox.containingBlock()) } };
auto positionOffset = geometry().inFlowPositionedPositionOffset(childBox, usedHorizontalValues);
auto& displayBox = formattingState().displayBox(childBox);
@@ -231,7 +232,7 @@
void BlockFormattingContext::computeEstimatedVerticalPosition(const Box& layoutBox)
{
- auto usedHorizontalValues = UsedHorizontalValues { geometryForBox(*layoutBox.containingBlock()).contentBoxWidth() };
+ auto usedHorizontalValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { geometryForBox(*layoutBox.containingBlock()) } };
auto computedVerticalMargin = geometry().computedVerticalMargin(layoutBox, usedHorizontalValues);
auto usedNonCollapsedMargin = UsedVerticalMargin::NonCollapsedValues { computedVerticalMargin.before.valueOr(0), computedVerticalMargin.after.valueOr(0) };
auto estimatedMarginBefore = marginCollapse().estimatedMarginBefore(layoutBox, usedNonCollapsedMargin);
@@ -356,7 +357,7 @@
availableWidth = geometryForBox(*layoutBox.containingBlock()).contentBoxWidth();
auto compute = [&](Optional<LayoutUnit> usedWidth) -> WidthAndMargin {
- auto usedValues = UsedHorizontalValues { availableWidth, usedWidth, { } };
+ auto usedValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { availableWidth }, usedWidth, { } };
if (layoutBox.isInFlow())
return geometry().inFlowWidthAndMargin(layoutBox, usedValues);
@@ -390,7 +391,7 @@
{
auto compute = [&](auto usedVerticalValues) -> HeightAndMargin {
- auto usedHorizontalValues = UsedHorizontalValues { geometryForBox(*layoutBox.containingBlock()).contentBoxWidth() };
+ auto usedHorizontalValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { geometryForBox(*layoutBox.containingBlock()) } };
if (layoutBox.isInFlow())
return geometry().inFlowHeightAndMargin(layoutBox, usedHorizontalValues, usedVerticalValues);
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp (250049 => 250050)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp 2019-09-18 19:39:53 UTC (rev 250049)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp 2019-09-18 19:56:14 UTC (rev 250050)
@@ -136,7 +136,7 @@
// edges of the containing block.
auto& style = layoutBox.style();
- auto containingBlockWidth = usedHorizontalValues.containingBlockWidth;
+ auto containingBlockWidth = usedHorizontalValues.constraints.width;
auto& boxGeometry = formattingContext().geometryForBox(layoutBox);
auto width = computedValueIfNotAuto(usedHorizontalValues.width ? Length { usedHorizontalValues.width.value(), Fixed } : style.logicalWidth(), containingBlockWidth);
@@ -278,7 +278,7 @@
return heightAndMargin;
}
-WidthAndMargin BlockFormattingContext::Geometry::inFlowWidthAndMargin(const Box& layoutBox, UsedHorizontalValues usedValues)
+WidthAndMargin BlockFormattingContext::Geometry::inFlowWidthAndMargin(const Box& layoutBox, UsedHorizontalValues usedHorizontalValues)
{
ASSERT(layoutBox.isInFlow());
@@ -286,11 +286,11 @@
if (layoutBox.establishesTableFormattingContext()) {
// This is a special table "fit-content size" behavior handling. Not in the spec though.
// Table returns its final width as min/max. Use this final width value to computed horizontal margins etc.
- usedValues.width = shrinkToFitWidth(layoutBox, usedValues.containingBlockWidth);
+ usedHorizontalValues.width = shrinkToFitWidth(layoutBox, usedHorizontalValues.constraints.width);
}
- return inFlowNonReplacedWidthAndMargin(layoutBox, usedValues);
+ return inFlowNonReplacedWidthAndMargin(layoutBox, usedHorizontalValues);
}
- return inFlowReplacedWidthAndMargin(layoutBox, usedValues);
+ return inFlowReplacedWidthAndMargin(layoutBox, usedHorizontalValues);
}
FormattingContext::IntrinsicWidthConstraints BlockFormattingContext::Geometry::intrinsicWidthConstraints(const Box& layoutBox)
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp (250049 => 250050)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp 2019-09-18 19:39:53 UTC (rev 250049)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp 2019-09-18 19:56:14 UTC (rev 250050)
@@ -69,8 +69,8 @@
auto& documentBox = layoutBox.isDocumentBox() ? layoutBox : *layoutBox.parent();
auto& documentBoxGeometry = formattingContext.geometryForBox(documentBox);
- auto& initialContainingBlocGeometry = formattingContext.geometryForBox(initialContainingBlock(layoutBox));
- auto strechedHeight = initialContainingBlocGeometry.contentBoxHeight();
+ auto& initialContainingBlockGeometry = formattingContext.geometryForBox(initialContainingBlock(layoutBox));
+ auto strechedHeight = initialContainingBlockGeometry.contentBoxHeight();
strechedHeight -= documentBoxGeometry.verticalBorder() + documentBoxGeometry.verticalPadding().valueOr(0);
LayoutUnit totalVerticalMargin;
@@ -82,7 +82,7 @@
// Here is the quirky part for body box:
// Stretch the body using the initial containing block's height and shrink it with document box's margin/border/padding.
// This looks extremely odd when html has non-auto height.
- auto documentBoxVerticalMargin = formattingContext.geometry().computedVerticalMargin(documentBox, UsedHorizontalValues { initialContainingBlocGeometry.contentBoxWidth() });
+ auto documentBoxVerticalMargin = formattingContext.geometry().computedVerticalMargin(documentBox, UsedHorizontalValues { UsedHorizontalValues::Constraints { initialContainingBlockGeometry } });
strechedHeight -= (documentBoxVerticalMargin.before.valueOr(0) + documentBoxVerticalMargin.after.valueOr(0));
auto& bodyBoxGeometry = formattingContext.geometryForBox(layoutBox);
Modified: trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp (250049 => 250050)
--- trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp 2019-09-18 19:39:53 UTC (rev 250049)
+++ trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp 2019-09-18 19:56:14 UTC (rev 250050)
@@ -519,7 +519,7 @@
return marginType == MarginType::Before ? positiveAndNegativeVerticalMargin.before : positiveAndNegativeVerticalMargin.after;
}
// This is the estimate path. We don't yet have positive/negative margin computed.
- auto usedValues = UsedHorizontalValues { formattingContext().geometryForBox(*layoutBox.containingBlock()).contentBoxWidth() };
+ auto usedValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { formattingContext().geometryForBox(*layoutBox.containingBlock()) } };
auto computedVerticalMargin = formattingContext().geometry().computedVerticalMargin(layoutBox, usedValues);
auto nonCollapsedMargin = UsedVerticalMargin::NonCollapsedValues { computedVerticalMargin.before.valueOr(0), computedVerticalMargin.after.valueOr(0) };
Modified: trunk/Source/WebCore/layout/floats/FloatingContext.h (250049 => 250050)
--- trunk/Source/WebCore/layout/floats/FloatingContext.h 2019-09-18 19:39:53 UTC (rev 250049)
+++ trunk/Source/WebCore/layout/floats/FloatingContext.h 2019-09-18 19:56:14 UTC (rev 250050)
@@ -30,7 +30,6 @@
#include "FloatingState.h"
#include "FormattingContext.h"
#include "LayoutContainer.h"
-#include "LayoutUnits.h"
#include <wtf/IsoMalloc.h>
namespace WebCore {
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (250049 => 250050)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp 2019-09-18 19:39:53 UTC (rev 250049)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp 2019-09-18 19:56:14 UTC (rev 250050)
@@ -68,8 +68,7 @@
return;
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Start] -> inline formatting context -> formatting root(" << &root() << ")");
- auto availableWidth = geometryForBox(root()).contentBoxWidth();
- auto usedValues = UsedHorizontalValues { availableWidth };
+ auto usedValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { geometryForBox(root()) } };
auto* layoutBox = root().firstInFlowOrFloatingChild();
// Compute width/height for non-text content and margin/border/padding for inline containers.
while (layoutBox) {
@@ -91,7 +90,7 @@
formattingState().inlineRuns().clear();
collectInlineContent();
- InlineLayout(*this).layout(formattingState().inlineItems(), availableWidth);
+ InlineLayout(*this).layout(formattingState().inlineItems(), usedValues.constraints.width);
LOG_WITH_STREAM(FormattingContextLayout, stream << "[End] -> inline formatting context -> formatting root(" << &root() << ")");
}
@@ -107,7 +106,7 @@
}
Vector<const Box*> formattingContextRootList;
- auto usedValues = UsedHorizontalValues { LayoutUnit { } };
+ auto usedValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { LayoutUnit { } } };
auto* layoutBox = root().firstInFlowOrFloatingChild();
while (layoutBox) {
if (layoutBox->establishesFormattingContext()) {
@@ -168,7 +167,7 @@
{
ASSERT(formattingRoot.establishesFormattingContext());
- auto usedValues = UsedHorizontalValues { LayoutUnit { } };
+ auto usedValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { LayoutUnit { } } };
computeBorderAndPadding(formattingRoot, usedValues);
computeHorizontalMargin(formattingRoot, usedValues);
@@ -211,7 +210,7 @@
void InlineFormattingContext::computeHeightAndMargin(const Box& layoutBox)
{
HeightAndMargin heightAndMargin;
- auto usedHorizontalValues = UsedHorizontalValues { geometryForBox(*layoutBox.containingBlock()).contentBoxWidth() };
+ auto usedHorizontalValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { geometryForBox(*layoutBox.containingBlock()) } };
if (layoutBox.isFloatingPositioned())
heightAndMargin = geometry().floatingHeightAndMargin(layoutBox, usedHorizontalValues, { });
else if (layoutBox.isInlineBlockBox())
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp (250049 => 250050)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp 2019-09-18 19:39:53 UTC (rev 250049)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp 2019-09-18 19:56:14 UTC (rev 250050)
@@ -53,9 +53,9 @@
// If 'width' is 'auto', the used value is the shrink-to-fit width as for floating elements.
// A computed value of 'auto' for 'margin-left' or 'margin-right' becomes a used value of '0'.
// #1
- auto width = computedValueIfNotAuto(formattingContextRoot.style().logicalWidth(), usedHorizontalValues.containingBlockWidth);
+ auto width = computedValueIfNotAuto(formattingContextRoot.style().logicalWidth(), usedHorizontalValues.constraints.width);
if (!width)
- width = shrinkToFitWidth(formattingContextRoot, usedHorizontalValues.containingBlockWidth);
+ width = shrinkToFitWidth(formattingContextRoot, usedHorizontalValues.constraints.width);
// #2
auto computedHorizontalMargin = Geometry::computedHorizontalMargin(formattingContextRoot, usedHorizontalValues);
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp (250049 => 250050)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp 2019-09-18 19:39:53 UTC (rev 250049)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp 2019-09-18 19:56:14 UTC (rev 250050)
@@ -404,11 +404,12 @@
continue;
}
+ auto usedHorizontalValues = UsedHorizontalValues { UsedHorizontalValues::Constraints { formattingContext.geometryForBox(*layoutBox.containingBlock()) } };
// Inline level box (replaced or inline-block)
if (lineRun->isBox()) {
auto topLeft = logicalRect.topLeft();
if (layoutBox.isInFlowPositioned())
- topLeft += geometry.inFlowPositionedPositionOffset(layoutBox, UsedHorizontalValues { formattingContext.geometryForBox(*layoutBox.containingBlock()).contentBoxWidth() });
+ topLeft += geometry.inFlowPositionedPositionOffset(layoutBox, usedHorizontalValues);
displayBox.setTopLeft(topLeft);
lineBoxRect.expandHorizontally(logicalRect.width());
formattingState.addInlineRun(makeUnique<Display::Run>(logicalRect));
@@ -425,7 +426,7 @@
// Inline level container end (</span>)
if (lineRun->isContainerEnd()) {
if (layoutBox.isInFlowPositioned()) {
- auto inflowOffset = geometry.inFlowPositionedPositionOffset(layoutBox, UsedHorizontalValues { formattingContext.geometryForBox(*layoutBox.containingBlock()).contentBoxWidth() });
+ auto inflowOffset = geometry.inFlowPositionedPositionOffset(layoutBox, usedHorizontalValues);
displayBox.moveHorizontally(inflowOffset.width());
displayBox.moveVertically(inflowOffset.height());
}
Modified: trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp (250049 => 250050)
--- trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp 2019-09-18 19:39:53 UTC (rev 250049)
+++ trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp 2019-09-18 19:56:14 UTC (rev 250050)
@@ -199,7 +199,7 @@
intrinsicWidth = layoutState().createFormattingContext(downcast<Container>(tableCellBox))->computedIntrinsicWidthConstraints();
intrinsicWidth = geometry().constrainByMinMaxWidth(tableCellBox, *intrinsicWidth);
auto border = geometry().computedBorder(tableCellBox);
- auto padding = *geometry().computedPadding(tableCellBox, UsedHorizontalValues({ }));
+ auto padding = *geometry().computedPadding(tableCellBox, UsedHorizontalValues { UsedHorizontalValues::Constraints { LayoutUnit { } } });
intrinsicWidth->expand(border.horizontal.width() + padding.horizontal.width());
formattingState.setIntrinsicWidthConstraintsForBox(tableCellBox, *intrinsicWidth);