Diff
Modified: trunk/Source/WebCore/ChangeLog (234144 => 234145)
--- trunk/Source/WebCore/ChangeLog 2018-07-24 14:40:47 UTC (rev 234144)
+++ trunk/Source/WebCore/ChangeLog 2018-07-24 14:47:55 UTC (rev 234145)
@@ -1,3 +1,48 @@
+2018-07-24 Zalan Bujtas <[email protected]>
+
+ [LFC] Move geometry data structures to a dedicated file
+ https://bugs.webkit.org/show_bug.cgi?id=187939
+
+ Reviewed by Antti Koivisto.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * layout/FormattingContext.h:
+ (WebCore::Layout::FormattingContext::Geometry::Position::operator LayoutPoint const): Deleted.
+ * layout/FormattingContextGeometry.cpp:
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
+ (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin):
+ (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
+ (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
+ (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
+ (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
+ (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
+ (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
+ (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
+ (WebCore::Layout::FormattingContext::Geometry::computedBorder):
+ (WebCore::Layout::FormattingContext::Geometry::computedPadding):
+ (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue):
+ (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue):
+ * layout/blockformatting/BlockFormattingContext.h:
+ * layout/blockformatting/BlockFormattingContextGeometry.cpp:
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
+ (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition):
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
+ * layout/displaytree/DisplayBox.h:
+ (WebCore::Display::Box::setHorizontalMargin):
+ (WebCore::Display::Box::setVerticalMargin):
+ (WebCore::Display::Box::setVerticalNonCollapsedMargin):
+ (WebCore::Display::Box::setBorder):
+ (WebCore::Display::Box::setPadding):
+
2018-07-24 Thibault Saunier <[email protected]>
[GStreamer] Implement bitrate modulation support in GStreamer based libwebrtc Encoders
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (234144 => 234145)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-07-24 14:40:47 UTC (rev 234144)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-07-24 14:47:55 UTC (rev 234145)
@@ -8916,6 +8916,7 @@
6F0830DF20B46951008A945B /* BlockFormattingContextGeometry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = BlockFormattingContextGeometry.cpp; sourceTree = "<group>"; };
6F222B741AB52D640094651A /* WebGLVertexArrayObjectBase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGLVertexArrayObjectBase.h; sourceTree = "<group>"; };
6F222B751AB52D8A0094651A /* WebGLVertexArrayObjectBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGLVertexArrayObjectBase.cpp; sourceTree = "<group>"; };
+ 6F73918C2106CEDD006AF262 /* LayoutUnits.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutUnits.h; sourceTree = "<group>"; };
6F7CA3C4208C2956002F29AB /* LayoutContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutContext.h; sourceTree = "<group>"; };
6F7CA3C5208C2956002F29AB /* LayoutContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutContext.cpp; sourceTree = "<group>"; };
6F7CA3C8208C2B2E002F29AB /* InlineFormattingContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InlineFormattingContext.h; sourceTree = "<group>"; };
@@ -15738,6 +15739,7 @@
115F7805209CBCBD00739C13 /* Invalidation.h */,
6F7CA3C5208C2956002F29AB /* LayoutContext.cpp */,
6F7CA3C4208C2956002F29AB /* LayoutContext.h */,
+ 6F73918C2106CEDD006AF262 /* LayoutUnits.h */,
11FF02D520BA3C810083F25B /* Verification.cpp */,
);
path = layout;
Modified: trunk/Source/WebCore/layout/FormattingContext.h (234144 => 234145)
--- trunk/Source/WebCore/layout/FormattingContext.h 2018-07-24 14:40:47 UTC (rev 234144)
+++ trunk/Source/WebCore/layout/FormattingContext.h 2018-07-24 14:47:55 UTC (rev 234145)
@@ -85,36 +85,6 @@
// This class implements generic positioning and sizing.
class Geometry {
public:
- struct Position {
- // FIXME: Use LayoutUnit<Horizontal> to avoid top/left vs. x/y confusion.
- LayoutUnit x; // left
- LayoutUnit y; // top
- operator LayoutPoint() const { return { x, y }; }
- };
-
- struct WidthAndMargin {
- LayoutUnit width;
- Display::Box::HorizontalEdges margin;
- };
-
- struct HeightAndMargin {
- LayoutUnit height;
- Display::Box::VerticalEdges margin;
- std::optional<Display::Box::VerticalEdges> collapsedMargin;
- };
-
- struct HorizontalGeometry {
- LayoutUnit left;
- LayoutUnit right;
- WidthAndMargin widthAndMargin;
- };
-
- struct VerticalGeometry {
- LayoutUnit top;
- LayoutUnit bottom;
- HeightAndMargin heightAndMargin;
- };
-
static VerticalGeometry outOfFlowVerticalGeometry(LayoutContext&, const Box&);
static HorizontalGeometry outOfFlowHorizontalGeometry(LayoutContext&, const FormattingContext&, const Box&);
@@ -125,11 +95,11 @@
static WidthAndMargin inlineReplacedWidthAndMargin(LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedMarginLeft = { },
std::optional<LayoutUnit> precomputedMarginRight = { });
- static Display::Box::Edges computedBorder(LayoutContext&, const Box&);
- static std::optional<Display::Box::Edges> computedPadding(LayoutContext&, const Box&);
+ static Edges computedBorder(LayoutContext&, const Box&);
+ static std::optional<Edges> computedPadding(LayoutContext&, const Box&);
- static Display::Box::HorizontalEdges computedNonCollapsedHorizontalMarginValue(const LayoutContext&, const Box&);
- static Display::Box::VerticalEdges computedNonCollapsedVerticalMarginValue(const LayoutContext&, const Box&);
+ static HorizontalEdges computedNonCollapsedHorizontalMarginValue(const LayoutContext&, const Box&);
+ static VerticalEdges computedNonCollapsedVerticalMarginValue(const LayoutContext&, const Box&);
static std::optional<LayoutUnit> computedValueIfNotAuto(const Length& geometryProperty, LayoutUnit containingBlockWidth);
static std::optional<LayoutUnit> fixedValue(const Length& geometryProperty);
Modified: trunk/Source/WebCore/layout/FormattingContextGeometry.cpp (234144 => 234145)
--- trunk/Source/WebCore/layout/FormattingContextGeometry.cpp 2018-07-24 14:40:47 UTC (rev 234144)
+++ trunk/Source/WebCore/layout/FormattingContextGeometry.cpp 2018-07-24 14:47:55 UTC (rev 234145)
@@ -145,7 +145,7 @@
return std::min(std::max(instrinsicWidthConstraints.minimum, availableWidth), instrinsicWidthConstraints.maximum);
}
-FormattingContext::Geometry::VerticalGeometry FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry(LayoutContext& layoutContext, const Box& layoutBox)
+VerticalGeometry FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry(LayoutContext& layoutContext, const Box& layoutBox)
{
ASSERT(layoutBox.isOutOfFlowPositioned() && !layoutBox.replaced());
@@ -261,7 +261,7 @@
return { *top, *bottom, { *height, { *marginTop, *marginBottom }, { } } };
}
-FormattingContext::Geometry::HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry(LayoutContext& layoutContext, const FormattingContext& formattingContext, const Box& layoutBox)
+HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry(LayoutContext& layoutContext, const FormattingContext& formattingContext, const Box& layoutBox)
{
ASSERT(layoutBox.isOutOfFlowPositioned() && !layoutBox.replaced());
@@ -405,7 +405,7 @@
return { *left, *right, { *width, { *marginLeft, *marginRight } } };
}
-FormattingContext::Geometry::VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry(LayoutContext& layoutContext, const Box& layoutBox)
+VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry(LayoutContext& layoutContext, const Box& layoutBox)
{
ASSERT(layoutBox.isOutOfFlowPositioned() && layoutBox.replaced());
@@ -474,7 +474,7 @@
return { *top, *bottom, { height, { *marginTop, *marginBottom }, { } } };
}
-FormattingContext::Geometry::HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry(LayoutContext& layoutContext, const Box& layoutBox)
+HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry(LayoutContext& layoutContext, const Box& layoutBox)
{
ASSERT(layoutBox.isOutOfFlowPositioned() && layoutBox.replaced());
@@ -570,7 +570,7 @@
return { *left, *right, { width, { *marginLeft, *marginRight } } };
}
-FormattingContext::Geometry::HeightAndMargin FormattingContext::Geometry::floatingNonReplacedHeightAndMargin(LayoutContext& layoutContext, const Box& layoutBox)
+HeightAndMargin FormattingContext::Geometry::floatingNonReplacedHeightAndMargin(LayoutContext& layoutContext, const Box& layoutBox)
{
ASSERT(layoutBox.isFloatingPositioned() && !layoutBox.replaced());
@@ -601,10 +601,10 @@
height = contentHeightForFormattingContextRoot(layoutContext, layoutBox);
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> floating non-replaced -> height(" << *height << "px) margin(" << *marginTop << "px, " << *marginBottom << "px) -> layoutBox(" << &layoutBox << ")");
- return FormattingContext::Geometry::HeightAndMargin { *height, { *marginTop, *marginBottom }, { } };
+ return HeightAndMargin { *height, { *marginTop, *marginBottom }, { } };
}
-FormattingContext::Geometry::WidthAndMargin FormattingContext::Geometry::floatingNonReplacedWidthAndMargin(LayoutContext& layoutContext, const FormattingContext& formattingContext, const Box& layoutBox)
+WidthAndMargin FormattingContext::Geometry::floatingNonReplacedWidthAndMargin(LayoutContext& layoutContext, const FormattingContext& formattingContext, const Box& layoutBox)
{
ASSERT(layoutBox.isFloatingPositioned() && !layoutBox.replaced());
@@ -624,10 +624,10 @@
width = shrinkToFitWidth(layoutContext, formattingContext, layoutBox);
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> floating non-replaced -> width(" << *width << "px) margin(" << margin.left << "px, " << margin.right << "px) -> layoutBox(" << &layoutBox << ")");
- return FormattingContext::Geometry::WidthAndMargin { *width, margin };
+ return WidthAndMargin { *width, margin };
}
-FormattingContext::Geometry::HeightAndMargin FormattingContext::Geometry::floatingReplacedHeightAndMargin(LayoutContext& layoutContext, const Box& layoutBox)
+HeightAndMargin FormattingContext::Geometry::floatingReplacedHeightAndMargin(LayoutContext& layoutContext, const Box& layoutBox)
{
ASSERT(layoutBox.isFloatingPositioned() && layoutBox.replaced());
@@ -637,7 +637,7 @@
return inlineReplacedHeightAndMargin(layoutContext, layoutBox);
}
-FormattingContext::Geometry::WidthAndMargin FormattingContext::Geometry::floatingReplacedWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox)
+WidthAndMargin FormattingContext::Geometry::floatingReplacedWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox)
{
ASSERT(layoutBox.isFloatingPositioned() && layoutBox.replaced());
@@ -651,7 +651,7 @@
return inlineReplacedWidthAndMargin(layoutContext, layoutBox, margin.left, margin.right);
}
-FormattingContext::Geometry::VerticalGeometry FormattingContext::Geometry::outOfFlowVerticalGeometry(LayoutContext& layoutContext, const Box& layoutBox)
+VerticalGeometry FormattingContext::Geometry::outOfFlowVerticalGeometry(LayoutContext& layoutContext, const Box& layoutBox)
{
ASSERT(layoutBox.isOutOfFlowPositioned());
@@ -660,7 +660,7 @@
return outOfFlowReplacedVerticalGeometry(layoutContext, layoutBox);
}
-FormattingContext::Geometry::HorizontalGeometry FormattingContext::Geometry::outOfFlowHorizontalGeometry(LayoutContext& layoutContext, const FormattingContext& formattingContext, const Box& layoutBox)
+HorizontalGeometry FormattingContext::Geometry::outOfFlowHorizontalGeometry(LayoutContext& layoutContext, const FormattingContext& formattingContext, const Box& layoutBox)
{
ASSERT(layoutBox.isOutOfFlowPositioned());
@@ -669,7 +669,7 @@
return outOfFlowReplacedHorizontalGeometry(layoutContext, layoutBox);
}
-FormattingContext::Geometry::HeightAndMargin FormattingContext::Geometry::floatingHeightAndMargin(LayoutContext& layoutContext, const Box& layoutBox)
+HeightAndMargin FormattingContext::Geometry::floatingHeightAndMargin(LayoutContext& layoutContext, const Box& layoutBox)
{
ASSERT(layoutBox.isFloatingPositioned());
@@ -678,7 +678,7 @@
return floatingReplacedHeightAndMargin(layoutContext, layoutBox);
}
-FormattingContext::Geometry::WidthAndMargin FormattingContext::Geometry::floatingWidthAndMargin(LayoutContext& layoutContext, const FormattingContext& formattingContext, const Box& layoutBox)
+WidthAndMargin FormattingContext::Geometry::floatingWidthAndMargin(LayoutContext& layoutContext, const FormattingContext& formattingContext, const Box& layoutBox)
{
ASSERT(layoutBox.isFloatingPositioned());
@@ -687,7 +687,7 @@
return floatingReplacedWidthAndMargin(layoutContext, layoutBox);
}
-FormattingContext::Geometry::HeightAndMargin FormattingContext::Geometry::inlineReplacedHeightAndMargin(LayoutContext& layoutContext, const Box& layoutBox)
+HeightAndMargin FormattingContext::Geometry::inlineReplacedHeightAndMargin(LayoutContext& layoutContext, const Box& layoutBox)
{
ASSERT((layoutBox.isOutOfFlowPositioned() || layoutBox.isFloatingPositioned() || layoutBox.isInFlow()) && layoutBox.replaced());
@@ -733,7 +733,7 @@
return { *height, margin, { } };
}
-FormattingContext::Geometry::WidthAndMargin FormattingContext::Geometry::inlineReplacedWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox,
+WidthAndMargin FormattingContext::Geometry::inlineReplacedWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox,
std::optional<LayoutUnit> precomputedMarginLeft, std::optional<LayoutUnit> precomputedMarginRight)
{
ASSERT((layoutBox.isOutOfFlowPositioned() || layoutBox.isFloatingPositioned() || layoutBox.isInFlow()) && layoutBox.replaced());
@@ -809,7 +809,7 @@
return { *width, { marginLeft, marginRight } };
}
-Display::Box::Edges FormattingContext::Geometry::computedBorder(LayoutContext&, const Box& layoutBox)
+Edges FormattingContext::Geometry::computedBorder(LayoutContext&, const Box& layoutBox)
{
auto& style = layoutBox.style();
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Border] -> layoutBox: " << &layoutBox);
@@ -819,7 +819,7 @@
};
}
-std::optional<Display::Box::Edges> FormattingContext::Geometry::computedPadding(LayoutContext& layoutContext, const Box& layoutBox)
+std::optional<Edges> FormattingContext::Geometry::computedPadding(LayoutContext& layoutContext, const Box& layoutBox)
{
if (!layoutBox.isPaddingApplicable())
return std::nullopt;
@@ -827,13 +827,13 @@
auto& style = layoutBox.style();
auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock())->contentBoxWidth();
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Padding] -> layoutBox: " << &layoutBox);
- return Display::Box::Edges {
+ return Edges {
{ valueForLength(style.paddingLeft(), containingBlockWidth), valueForLength(style.paddingRight(), containingBlockWidth) },
{ valueForLength(style.paddingTop(), containingBlockWidth), valueForLength(style.paddingBottom(), containingBlockWidth) }
};
}
-Display::Box::HorizontalEdges FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue(const LayoutContext& layoutContext, const Box& layoutBox)
+HorizontalEdges FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue(const LayoutContext& layoutContext, const Box& layoutBox)
{
auto& style = layoutBox.style();
auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock())->contentBoxWidth();
@@ -845,7 +845,7 @@
return { marginLeft, marginRight };
}
-Display::Box::VerticalEdges FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue(const LayoutContext& layoutContext, const Box& layoutBox)
+VerticalEdges FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue(const LayoutContext& layoutContext, const Box& layoutBox)
{
auto& style = layoutBox.style();
auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock())->contentBoxWidth();
Added: trunk/Source/WebCore/layout/LayoutUnits.h (0 => 234145)
--- trunk/Source/WebCore/layout/LayoutUnits.h (rev 0)
+++ trunk/Source/WebCore/layout/LayoutUnits.h 2018-07-24 14:47:55 UTC (rev 234145)
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+#pragma once
+
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+
+#include "LayoutUnit.h"
+#include "LayoutPoint.h"
+#include "LayoutRect.h"
+
+namespace WebCore {
+namespace Layout {
+
+struct Position {
+ // FIXME: Use LayoutUnit<Horizontal> to avoid top/left vs. x/y confusion.
+ LayoutUnit x; // left
+ LayoutUnit y; // top
+ operator LayoutPoint() const { return { x, y }; }
+};
+
+// Margin, border, padding
+struct HorizontalEdges {
+ LayoutUnit left;
+ LayoutUnit right;
+};
+
+struct VerticalEdges {
+ LayoutUnit top;
+ LayoutUnit bottom;
+};
+
+struct Edges {
+ HorizontalEdges horizontal;
+ VerticalEdges vertical;
+};
+
+struct WidthAndMargin {
+ LayoutUnit width;
+ HorizontalEdges margin;
+};
+
+struct HeightAndMargin {
+ LayoutUnit height;
+ VerticalEdges margin;
+ std::optional<VerticalEdges> collapsedMargin;
+};
+
+struct HorizontalGeometry {
+ LayoutUnit left;
+ LayoutUnit right;
+ WidthAndMargin widthAndMargin;
+};
+
+struct VerticalGeometry {
+ LayoutUnit top;
+ LayoutUnit bottom;
+ HeightAndMargin heightAndMargin;
+};
+
+}
+}
+#endif
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h (234144 => 234145)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h 2018-07-24 14:40:47 UTC (rev 234144)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h 2018-07-24 14:47:55 UTC (rev 234145)
@@ -64,20 +64,20 @@
// This class implements positioning and sizing for boxes participating in a block formatting context.
class Geometry {
public:
- static FormattingContext::Geometry::HeightAndMargin inFlowHeightAndMargin(LayoutContext&, const Box&);
- static FormattingContext::Geometry::WidthAndMargin inFlowWidthAndMargin(LayoutContext&, const Box&);
+ static HeightAndMargin inFlowHeightAndMargin(LayoutContext&, const Box&);
+ static WidthAndMargin inFlowWidthAndMargin(LayoutContext&, const Box&);
- static FormattingContext::Geometry::Position staticPosition(LayoutContext&, const Box&);
- static FormattingContext::Geometry::Position inFlowPositionedPosition(LayoutContext&, const Box&);
+ static Position staticPosition(LayoutContext&, const Box&);
+ static Position inFlowPositionedPosition(LayoutContext&, const Box&);
static bool instrinsicWidthConstraintsNeedChildrenWidth(const Box&);
static FormattingContext::InstrinsicWidthConstraints instrinsicWidthConstraints(LayoutContext&, const Box&);
private:
- static FormattingContext::Geometry::HeightAndMargin inFlowNonReplacedHeightAndMargin(LayoutContext&, const Box&);
- static FormattingContext::Geometry::WidthAndMargin inFlowNonReplacedWidthAndMargin(LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedWidth = std::nullopt);
- static FormattingContext::Geometry::WidthAndMargin inFlowReplacedWidthAndMargin(LayoutContext&, const Box&);
- static FormattingContext::Geometry::Position staticPositionForOutOfFlowPositioned(const LayoutContext&, const Box&);
+ static HeightAndMargin inFlowNonReplacedHeightAndMargin(LayoutContext&, const Box&);
+ static WidthAndMargin inFlowNonReplacedWidthAndMargin(LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedWidth = std::nullopt);
+ static WidthAndMargin inFlowReplacedWidthAndMargin(LayoutContext&, const Box&);
+ static Position staticPositionForOutOfFlowPositioned(const LayoutContext&, const Box&);
};
// This class implements margin collapsing for block formatting context.
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp (234144 => 234145)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp 2018-07-24 14:40:47 UTC (rev 234144)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp 2018-07-24 14:47:55 UTC (rev 234145)
@@ -57,11 +57,11 @@
return *containingBlock;
}
-FormattingContext::Geometry::HeightAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin(LayoutContext& layoutContext, const Box& layoutBox)
+HeightAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin(LayoutContext& layoutContext, const Box& layoutBox)
{
ASSERT(layoutBox.isInFlow() && !layoutBox.replaced());
- auto compute = [&]() -> FormattingContext::Geometry::HeightAndMargin {
+ auto compute = [&]() -> HeightAndMargin {
// 10.6.3 Block-level non-replaced elements in normal flow when 'overflow' computes to 'visible'
//
@@ -80,9 +80,9 @@
auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock())->contentBoxWidth();
auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox);
- Display::Box::VerticalEdges nonCollapsedMargin = { FormattingContext::Geometry::computedValueIfNotAuto(style.marginTop(), containingBlockWidth).value_or(0),
+ VerticalEdges nonCollapsedMargin = { FormattingContext::Geometry::computedValueIfNotAuto(style.marginTop(), containingBlockWidth).value_or(0),
FormattingContext::Geometry::computedValueIfNotAuto(style.marginBottom(), containingBlockWidth).value_or(0) };
- Display::Box::VerticalEdges collapsedMargin = { MarginCollapse::marginTop(layoutContext, layoutBox), MarginCollapse::marginBottom(layoutContext, layoutBox) };
+ VerticalEdges collapsedMargin = { MarginCollapse::marginTop(layoutContext, layoutBox), MarginCollapse::marginBottom(layoutContext, layoutBox) };
auto borderAndPaddingTop = displayBox.borderTop() + displayBox.paddingTop();
if (!style.logicalHeight().isAuto())
@@ -136,7 +136,7 @@
return heightAndMargin;
}
-FormattingContext::Geometry::WidthAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox,
+WidthAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox,
std::optional<LayoutUnit> precomputedWidth)
{
ASSERT(layoutBox.isInFlow() && !layoutBox.replaced());
@@ -219,7 +219,7 @@
ASSERT(marginLeft);
ASSERT(marginRight);
- return FormattingContext::Geometry::WidthAndMargin { *width, { *marginLeft, *marginRight } };
+ return WidthAndMargin { *width, { *marginLeft, *marginRight } };
};
auto widthAndMargin = compute();
@@ -238,7 +238,7 @@
return widthAndMargin;
}
-FormattingContext::Geometry::WidthAndMargin BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox)
+WidthAndMargin BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox)
{
ASSERT(layoutBox.isInFlow() && layoutBox.replaced());
@@ -256,7 +256,7 @@
return { width, margin };
}
-FormattingContext::Geometry::Position BlockFormattingContext::Geometry::staticPosition(LayoutContext& layoutContext, const Box& layoutBox)
+Position BlockFormattingContext::Geometry::staticPosition(LayoutContext& layoutContext, const Box& layoutBox)
{
// https://www.w3.org/TR/CSS22/visuren.html#block-formatting
// In a block formatting context, boxes are laid out one after the other, vertically, beginning at the top of a containing block.
@@ -277,7 +277,7 @@
return { left, top };
}
-FormattingContext::Geometry::Position BlockFormattingContext::Geometry::inFlowPositionedPosition(LayoutContext& layoutContext, const Box& layoutBox)
+Position BlockFormattingContext::Geometry::inFlowPositionedPosition(LayoutContext& layoutContext, const Box& layoutBox)
{
ASSERT(layoutBox.isInFlowPositioned());
@@ -354,7 +354,7 @@
return { newLeftPosition, newTopPosition };
}
-FormattingContext::Geometry::HeightAndMargin BlockFormattingContext::Geometry::inFlowHeightAndMargin(LayoutContext& layoutContext, const Box& layoutBox)
+HeightAndMargin BlockFormattingContext::Geometry::inFlowHeightAndMargin(LayoutContext& layoutContext, const Box& layoutBox)
{
ASSERT(layoutBox.isInFlow());
@@ -365,7 +365,7 @@
return FormattingContext::Geometry::inlineReplacedHeightAndMargin(layoutContext, layoutBox);
}
-FormattingContext::Geometry::WidthAndMargin BlockFormattingContext::Geometry::inFlowWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox)
+WidthAndMargin BlockFormattingContext::Geometry::inFlowWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox)
{
ASSERT(layoutBox.isInFlow());
Modified: trunk/Source/WebCore/layout/displaytree/DisplayBox.h (234144 => 234145)
--- trunk/Source/WebCore/layout/displaytree/DisplayBox.h 2018-07-24 14:40:47 UTC (rev 234144)
+++ trunk/Source/WebCore/layout/displaytree/DisplayBox.h 2018-07-24 14:47:55 UTC (rev 234145)
@@ -27,9 +27,7 @@
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-#include "LayoutPoint.h"
-#include "LayoutRect.h"
-#include "LayoutUnit.h"
+#include "LayoutUnits.h"
#include "RenderStyleConstants.h"
#include <wtf/IsoMalloc.h>
@@ -176,28 +174,13 @@
void setContentBoxHeight(LayoutUnit);
void setContentBoxWidth(LayoutUnit);
- struct HorizontalEdges {
- LayoutUnit left;
- LayoutUnit right;
- };
+ void setHorizontalMargin(Layout::HorizontalEdges);
+ void setVerticalMargin(Layout::VerticalEdges);
+ void setVerticalNonCollapsedMargin(Layout::VerticalEdges);
- struct VerticalEdges {
- LayoutUnit top;
- LayoutUnit bottom;
- };
+ void setBorder(Layout::Edges);
+ void setPadding(Layout::Edges);
- struct Edges {
- HorizontalEdges horizontal;
- VerticalEdges vertical;
- };
-
- void setHorizontalMargin(HorizontalEdges);
- void setVerticalMargin(VerticalEdges);
- void setVerticalNonCollapsedMargin(VerticalEdges);
-
- void setBorder(Edges);
- void setPadding(Edges);
-
#if !ASSERT_DISABLED
void invalidateMargin();
void invalidateBorder() { m_hasValidBorder = false; }
@@ -220,11 +203,11 @@
LayoutUnit m_contentWidth;
LayoutUnit m_contentHeight;
- Edges m_margin;
- VerticalEdges m_verticalNonCollapsedMargin;
+ Layout::Edges m_margin;
+ Layout::VerticalEdges m_verticalNonCollapsedMargin;
- Edges m_border;
- Edges m_padding;
+ Layout::Edges m_border;
+ Layout::Edges m_padding;
#if !ASSERT_DISABLED
bool m_hasValidHorizontalMargin { false };
@@ -454,7 +437,7 @@
return m_contentWidth;
}
-inline void Box::setHorizontalMargin(HorizontalEdges margin)
+inline void Box::setHorizontalMargin(Layout::HorizontalEdges margin)
{
#if !ASSERT_DISABLED
setHasValidHorizontalMargin();
@@ -462,7 +445,7 @@
m_margin.horizontal = margin;
}
-inline void Box::setVerticalMargin(VerticalEdges margin)
+inline void Box::setVerticalMargin(Layout::VerticalEdges margin)
{
#if !ASSERT_DISABLED
setHasValidVerticalMargin();
@@ -470,7 +453,7 @@
m_margin.vertical = margin;
}
-inline void Box::setVerticalNonCollapsedMargin(VerticalEdges margin)
+inline void Box::setVerticalNonCollapsedMargin(Layout::VerticalEdges margin)
{
#if !ASSERT_DISABLED
setHasValidVerticalNonCollapsedMargin();
@@ -478,7 +461,7 @@
m_verticalNonCollapsedMargin = margin;
}
-inline void Box::setBorder(Edges border)
+inline void Box::setBorder(Layout::Edges border)
{
#if !ASSERT_DISABLED
setHasValidBorder();
@@ -486,7 +469,7 @@
m_border = border;
}
-inline void Box::setPadding(Edges padding)
+inline void Box::setPadding(Layout::Edges padding)
{
#if !ASSERT_DISABLED
setHasValidPadding();