Diff
Modified: trunk/Source/WebCore/ChangeLog (277547 => 277548)
--- trunk/Source/WebCore/ChangeLog 2021-05-15 20:46:56 UTC (rev 277547)
+++ trunk/Source/WebCore/ChangeLog 2021-05-15 21:11:40 UTC (rev 277548)
@@ -1,3 +1,35 @@
+2021-05-15 Alan Bujtas <[email protected]>
+
+ [LFC] Move base formatting quirks to its own class
+ https://bugs.webkit.org/show_bug.cgi?id=225757
+
+ Reviewed by Antti Koivisto.
+
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * layout/formattingContexts/FormattingContext.cpp:
+ (WebCore::Layout::FormattingContext::quirks const):
+ * layout/formattingContexts/FormattingContext.h:
+ (WebCore::Layout::FormattingContext::formattingState):
+ (WebCore::Layout::FormattingContext::Quirks::layoutState const): Deleted.
+ (WebCore::Layout::FormattingContext::Quirks::layoutState): Deleted.
+ (WebCore::Layout::FormattingContext::Quirks::formattingContext const): Deleted.
+ (WebCore::Layout::FormattingContext::quirks const): Deleted.
+ (WebCore::Layout::FormattingContext::Quirks::Quirks): Deleted.
+ * layout/formattingContexts/FormattingContextQuirks.cpp: Removed.
+ * layout/formattingContexts/block/BlockFormattingQuirks.cpp:
+ (WebCore::Layout::BlockFormattingQuirks::BlockFormattingQuirks):
+ * layout/formattingContexts/block/BlockFormattingQuirks.h:
+ (WebCore::Layout::BlockFormattingQuirks::formattingContext const):
+ * layout/formattingContexts/inline/InlineFormattingQuirks.cpp:
+ (WebCore::Layout::InlineFormattingQuirks::InlineFormattingQuirks):
+ * layout/formattingContexts/inline/InlineFormattingQuirks.h:
+ (WebCore::Layout::InlineFormattingQuirks::formattingContext const):
+ * layout/formattingContexts/table/TableFormattingQuirks.cpp:
+ (WebCore::Layout::TableFormattingQuirks::TableFormattingQuirks):
+ * layout/formattingContexts/table/TableFormattingQuirks.h:
+ (WebCore::Layout::TableFormattingQuirks::formattingContext const):
+
2021-05-15 Said Abou-Hallawa <[email protected]>
Implement CanvasRenderingContext2D.createConicGradient
Modified: trunk/Source/WebCore/Sources.txt (277547 => 277548)
--- trunk/Source/WebCore/Sources.txt 2021-05-15 20:46:56 UTC (rev 277547)
+++ trunk/Source/WebCore/Sources.txt 2021-05-15 21:11:40 UTC (rev 277548)
@@ -1511,7 +1511,7 @@
inspector/agents/worker/WorkerRuntimeAgent.cpp
layout/formattingContexts/FormattingContext.cpp
layout/formattingContexts/FormattingContextGeometry.cpp
-layout/formattingContexts/FormattingContextQuirks.cpp
+layout/formattingContexts/FormattingQuirks.cpp
layout/FormattingState.cpp
layout/LayoutContext.cpp
layout/LayoutPhase.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (277547 => 277548)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-05-15 20:46:56 UTC (rev 277547)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-05-15 21:11:40 UTC (rev 277548)
@@ -2136,6 +2136,7 @@
6F3FBA982556E313003530FD /* LayoutIntegrationInlineContentBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F3FBA972556E312003530FD /* LayoutIntegrationInlineContentBuilder.h */; settings = {ATTRIBUTES = (Private, ); }; };
6F40DA822513033A00EC04B7 /* InlineRect.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F40DA812513033A00EC04B7 /* InlineRect.h */; settings = {ATTRIBUTES = (Private, ); }; };
6F49C3E726479B3C0051953D /* TableFormattingQuirks.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F49C3E626479B3B0051953D /* TableFormattingQuirks.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 6F56B44726479E6200AAE257 /* FormattingQuirks.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F56B44626479E6100AAE257 /* FormattingQuirks.h */; settings = {ATTRIBUTES = (Private, ); }; };
6F6383F62427AF4A00DABA53 /* LayoutInitialContainingBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F6383F42427AF4900DABA53 /* LayoutInitialContainingBlock.h */; settings = {ATTRIBUTES = (Private, ); }; };
6F6DF36F264722EA0093E834 /* BlockMarginCollapse.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F6DF36E264722EA0093E834 /* BlockMarginCollapse.h */; settings = {ATTRIBUTES = (Private, ); }; };
6F7CA3C6208C2957002F29AB /* LayoutState.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F7CA3C4208C2956002F29AB /* LayoutState.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -9967,6 +9968,7 @@
6F40DA812513033A00EC04B7 /* InlineRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineRect.h; sourceTree = "<group>"; };
6F49C3E626479B3B0051953D /* TableFormattingQuirks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableFormattingQuirks.h; sourceTree = "<group>"; };
6F4A5BD522F9F16B00A80F25 /* LayoutPhase.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutPhase.cpp; sourceTree = "<group>"; };
+ 6F56B44626479E6100AAE257 /* FormattingQuirks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormattingQuirks.h; sourceTree = "<group>"; };
6F5B7EAA2300A79E0067D9C3 /* TableGrid.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TableGrid.cpp; sourceTree = "<group>"; };
6F6383F42427AF4900DABA53 /* LayoutInitialContainingBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutInitialContainingBlock.h; sourceTree = "<group>"; };
6F6638D4249E268B001925FC /* TableWrapperBlockFormattingQuirks.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TableWrapperBlockFormattingQuirks.cpp; sourceTree = "<group>"; };
@@ -9979,7 +9981,7 @@
6F7CA3C5208C2956002F29AB /* LayoutState.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutState.cpp; sourceTree = "<group>"; };
6F7CA3C8208C2B2E002F29AB /* InlineFormattingContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InlineFormattingContext.h; sourceTree = "<group>"; };
6F7CA3C9208C2B2E002F29AB /* InlineFormattingContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InlineFormattingContext.cpp; sourceTree = "<group>"; };
- 6F8F460121B03BB40041AC3A /* FormattingContextQuirks.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FormattingContextQuirks.cpp; sourceTree = "<group>"; };
+ 6F8F460121B03BB40041AC3A /* FormattingQuirks.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FormattingQuirks.cpp; sourceTree = "<group>"; };
6F8F460321B03BC60041AC3A /* BlockFormattingQuirks.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = BlockFormattingQuirks.cpp; sourceTree = "<group>"; };
6F91420F25152137004E4FEA /* InlineLineGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineLineGeometry.h; sourceTree = "<group>"; };
6F95DE4B237B889B00E517E1 /* InvalidationContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InvalidationContext.h; sourceTree = "<group>"; };
@@ -22634,7 +22636,8 @@
115CFA69208AF7D0001E6991 /* FormattingContext.cpp */,
115CFA68208AF7D0001E6991 /* FormattingContext.h */,
6FBB860520B464B600DAD938 /* FormattingContextGeometry.cpp */,
- 6F8F460121B03BB40041AC3A /* FormattingContextQuirks.cpp */,
+ 6F8F460121B03BB40041AC3A /* FormattingQuirks.cpp */,
+ 6F56B44626479E6100AAE257 /* FormattingQuirks.h */,
);
path = formattingContexts;
sourceTree = "<group>";
@@ -32537,6 +32540,7 @@
D05CED2A0A40BB2C00C5AF38 /* FormatBlockCommand.h in Headers */,
7CE6CBFB187F370700D46BF5 /* FormatConverter.h in Headers */,
115CFA6A208AF7D0001E6991 /* FormattingContext.h in Headers */,
+ 6F56B44726479E6200AAE257 /* FormattingQuirks.h in Headers */,
115CFA76208AFE30001E6991 /* FormattingState.h in Headers */,
F50664F8157F52DC00AC226F /* FormController.h in Headers */,
514C76700CE923A1007EF3CD /* FormData.h in Headers */,
Modified: trunk/Source/WebCore/layout/formattingContexts/FormattingContext.cpp (277547 => 277548)
--- trunk/Source/WebCore/layout/formattingContexts/FormattingContext.cpp 2021-05-15 20:46:56 UTC (rev 277547)
+++ trunk/Source/WebCore/layout/formattingContexts/FormattingContext.cpp 2021-05-15 21:11:40 UTC (rev 277548)
@@ -28,6 +28,7 @@
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+#include "FormattingQuirks.h"
#include "FormattingState.h"
#include "InvalidationState.h"
#include "LayoutBox.h"
@@ -270,6 +271,11 @@
}
}
+FormattingQuirks FormattingContext::quirks() const
+{
+ return FormattingQuirks(*this);
+}
+
#ifndef NDEBUG
void FormattingContext::validateGeometryConstraintsAfterLayout() const
{
Modified: trunk/Source/WebCore/layout/formattingContexts/FormattingContext.h (277547 => 277548)
--- trunk/Source/WebCore/layout/formattingContexts/FormattingContext.h 2021-05-15 20:46:56 UTC (rev 277547)
+++ trunk/Source/WebCore/layout/formattingContexts/FormattingContext.h 2021-05-15 21:11:40 UTC (rev 277548)
@@ -49,6 +49,7 @@
struct ContentWidthAndMargin;
struct Edges;
class FormattingState;
+class FormattingQuirks;
struct HorizontalGeometry;
class InvalidationState;
class LayoutState;
@@ -110,32 +111,8 @@
LayoutState& layoutState() const;
const FormattingState& formattingState() const { return m_formattingState; }
- class Quirks {
- public:
- Quirks(const FormattingContext&);
+ FormattingQuirks quirks() const;
- LayoutUnit heightValueOfNearestContainingBlockWithFixedHeight(const Box&);
-
- protected:
- const LayoutState& layoutState() const { return m_formattingContext.layoutState(); }
- LayoutState& layoutState() { return m_formattingContext.layoutState(); }
- const FormattingContext& formattingContext() const { return m_formattingContext; }
-
- const FormattingContext& m_formattingContext;
- };
- FormattingContext::Quirks quirks() const { return Quirks(*this); }
-
-protected:
- using LayoutQueue = Vector<const Box*>;
-
- FormattingState& formattingState() { return m_formattingState; }
-
- void computeBorderAndPadding(const Box&, const HorizontalConstraints&);
-
-#ifndef NDEBUG
- virtual void validateGeometryConstraintsAfterLayout() const;
-#endif
-
// This class implements generic positioning and sizing.
class Geometry {
public:
@@ -211,6 +188,17 @@
};
FormattingContext::Geometry geometry() const { return Geometry(*this); }
+protected:
+ using LayoutQueue = Vector<const Box*>;
+
+ FormattingState& formattingState() { return m_formattingState; }
+
+ void computeBorderAndPadding(const Box&, const HorizontalConstraints&);
+
+#ifndef NDEBUG
+ virtual void validateGeometryConstraintsAfterLayout() const;
+#endif
+
private:
void collectOutOfFlowDescendantsIfNeeded();
void computeOutOfFlowVerticalGeometry(const Box&, const ConstraintsForOutOfFlowContent&);
@@ -225,11 +213,6 @@
{
}
-inline FormattingContext::Quirks::Quirks(const FormattingContext& formattingContext)
- : m_formattingContext(formattingContext)
-{
-}
-
inline void FormattingContext::IntrinsicWidthConstraints::expand(LayoutUnit horizontalValue)
{
minimum += horizontalValue;
Deleted: trunk/Source/WebCore/layout/formattingContexts/FormattingContextQuirks.cpp (277547 => 277548)
--- trunk/Source/WebCore/layout/formattingContexts/FormattingContextQuirks.cpp 2021-05-15 20:46:56 UTC (rev 277547)
+++ trunk/Source/WebCore/layout/formattingContexts/FormattingContextQuirks.cpp 2021-05-15 21:11:40 UTC (rev 277548)
@@ -1,75 +0,0 @@
-/*
- * 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.
- */
-
-#include "config.h"
-#include "FormattingContext.h"
-
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-
-#include "LayoutBox.h"
-#include "LayoutBoxGeometry.h"
-#include "LayoutInitialContainingBlock.h"
-
-namespace WebCore {
-namespace Layout {
-
-LayoutUnit FormattingContext::Quirks::heightValueOfNearestContainingBlockWithFixedHeight(const Box& layoutBox)
-{
- // In quirks mode, we go and travers the containing block chain to find a block level box with fixed height value, even if it means leaving
- // the current formatting context. FIXME: surely we need to do some tricks here when block direction support is added.
- auto& formattingContext = this->formattingContext();
- auto* containingBlock = &layoutBox.containingBlock();
- LayoutUnit bodyAndDocumentVerticalMarginPaddingAndBorder;
- while (containingBlock) {
- auto containingBlockHeight = containingBlock->style().logicalHeight();
- if (containingBlockHeight.isFixed())
- return LayoutUnit(containingBlockHeight.value() - bodyAndDocumentVerticalMarginPaddingAndBorder);
-
- // If the only fixed value box we find is the ICB, then ignore the body and the document (vertical) margin, padding and border. So much quirkiness.
- // -and it's totally insane because now we freely travel across formatting context boundaries and computed margins are nonexistent.
- if (containingBlock->isBodyBox() || containingBlock->isDocumentBox()) {
-
- auto geometry = formattingContext.geometry();
- auto horizontalConstraints = geometry.constraintsForInFlowContent(containingBlock->containingBlock(), FormattingContext::EscapeReason::FindFixedHeightAncestorQuirk).horizontal;
- auto verticalMargin = geometry.computedVerticalMargin(*containingBlock, horizontalConstraints);
-
- auto& boxGeometry = formattingContext.geometryForBox(*containingBlock, FormattingContext::EscapeReason::FindFixedHeightAncestorQuirk);
- auto verticalPadding = boxGeometry.paddingTop().valueOr(0) + boxGeometry.paddingBottom().valueOr(0);
- auto verticalBorder = boxGeometry.borderTop() + boxGeometry.borderBottom();
- bodyAndDocumentVerticalMarginPaddingAndBorder += verticalMargin.before.valueOr(0) + verticalMargin.after.valueOr(0) + verticalPadding + verticalBorder;
- }
-
- if (is<InitialContainingBlock>(*containingBlock))
- break;
- containingBlock = &containingBlock->containingBlock();
- }
- // Initial containing block has to have a height.
- return formattingContext.geometryForBox(layoutBox.initialContainingBlock(), FormattingContext::EscapeReason::FindFixedHeightAncestorQuirk).contentBox().height() - bodyAndDocumentVerticalMarginPaddingAndBorder;
-}
-
-}
-}
-
-#endif
Copied: trunk/Source/WebCore/layout/formattingContexts/FormattingQuirks.cpp (from rev 277547, trunk/Source/WebCore/layout/formattingContexts/FormattingContextQuirks.cpp) (0 => 277548)
--- trunk/Source/WebCore/layout/formattingContexts/FormattingQuirks.cpp (rev 0)
+++ trunk/Source/WebCore/layout/formattingContexts/FormattingQuirks.cpp 2021-05-15 21:11:40 UTC (rev 277548)
@@ -0,0 +1,80 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "FormattingQuirks.h"
+
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+
+#include "LayoutBox.h"
+#include "LayoutBoxGeometry.h"
+#include "LayoutInitialContainingBlock.h"
+
+namespace WebCore {
+namespace Layout {
+
+FormattingQuirks::FormattingQuirks(const FormattingContext& formattingContext)
+ : m_formattingContext(formattingContext)
+{
+}
+
+LayoutUnit FormattingQuirks::heightValueOfNearestContainingBlockWithFixedHeight(const Box& layoutBox)
+{
+ // In quirks mode, we go and travers the containing block chain to find a block level box with fixed height value, even if it means leaving
+ // the current formatting context. FIXME: surely we need to do some tricks here when block direction support is added.
+ auto& formattingContext = this->formattingContext();
+ auto* containingBlock = &layoutBox.containingBlock();
+ LayoutUnit bodyAndDocumentVerticalMarginPaddingAndBorder;
+ while (containingBlock) {
+ auto containingBlockHeight = containingBlock->style().logicalHeight();
+ if (containingBlockHeight.isFixed())
+ return LayoutUnit(containingBlockHeight.value() - bodyAndDocumentVerticalMarginPaddingAndBorder);
+
+ // If the only fixed value box we find is the ICB, then ignore the body and the document (vertical) margin, padding and border. So much quirkiness.
+ // -and it's totally insane because now we freely travel across formatting context boundaries and computed margins are nonexistent.
+ if (containingBlock->isBodyBox() || containingBlock->isDocumentBox()) {
+
+ auto geometry = formattingContext.geometry();
+ auto horizontalConstraints = geometry.constraintsForInFlowContent(containingBlock->containingBlock(), FormattingContext::EscapeReason::FindFixedHeightAncestorQuirk).horizontal;
+ auto verticalMargin = geometry.computedVerticalMargin(*containingBlock, horizontalConstraints);
+
+ auto& boxGeometry = formattingContext.geometryForBox(*containingBlock, FormattingContext::EscapeReason::FindFixedHeightAncestorQuirk);
+ auto verticalPadding = boxGeometry.paddingTop().valueOr(0) + boxGeometry.paddingBottom().valueOr(0);
+ auto verticalBorder = boxGeometry.borderTop() + boxGeometry.borderBottom();
+ bodyAndDocumentVerticalMarginPaddingAndBorder += verticalMargin.before.valueOr(0) + verticalMargin.after.valueOr(0) + verticalPadding + verticalBorder;
+ }
+
+ if (is<InitialContainingBlock>(*containingBlock))
+ break;
+ containingBlock = &containingBlock->containingBlock();
+ }
+ // Initial containing block has to have a height.
+ return formattingContext.geometryForBox(layoutBox.initialContainingBlock(), FormattingContext::EscapeReason::FindFixedHeightAncestorQuirk).contentBox().height() - bodyAndDocumentVerticalMarginPaddingAndBorder;
+}
+
+}
+}
+
+#endif
Copied: trunk/Source/WebCore/layout/formattingContexts/FormattingQuirks.h (from rev 277547, trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingQuirks.h) (0 => 277548)
--- trunk/Source/WebCore/layout/formattingContexts/FormattingQuirks.h (rev 0)
+++ trunk/Source/WebCore/layout/formattingContexts/FormattingQuirks.h 2021-05-15 21:11:40 UTC (rev 277548)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2021 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 "FormattingContext.h"
+
+namespace WebCore {
+namespace Layout {
+
+class FormattingQuirks {
+public:
+ FormattingQuirks(const FormattingContext&);
+
+ LayoutUnit heightValueOfNearestContainingBlockWithFixedHeight(const Box&);
+
+protected:
+ const LayoutState& layoutState() const { return m_formattingContext.layoutState(); }
+ LayoutState& layoutState() { return m_formattingContext.layoutState(); }
+ const FormattingContext& formattingContext() const { return m_formattingContext; }
+
+ const FormattingContext& m_formattingContext;
+};
+
+}
+}
+
+#endif
Modified: trunk/Source/WebCore/layout/formattingContexts/block/BlockFormattingQuirks.cpp (277547 => 277548)
--- trunk/Source/WebCore/layout/formattingContexts/block/BlockFormattingQuirks.cpp 2021-05-15 20:46:56 UTC (rev 277547)
+++ trunk/Source/WebCore/layout/formattingContexts/block/BlockFormattingQuirks.cpp 2021-05-15 21:11:40 UTC (rev 277548)
@@ -44,7 +44,7 @@
}
BlockFormattingQuirks::BlockFormattingQuirks(const BlockFormattingContext& blockFormattingContext)
- : FormattingContext::Quirks(blockFormattingContext)
+ : FormattingQuirks(blockFormattingContext)
{
}
Modified: trunk/Source/WebCore/layout/formattingContexts/block/BlockFormattingQuirks.h (277547 => 277548)
--- trunk/Source/WebCore/layout/formattingContexts/block/BlockFormattingQuirks.h 2021-05-15 20:46:56 UTC (rev 277547)
+++ trunk/Source/WebCore/layout/formattingContexts/block/BlockFormattingQuirks.h 2021-05-15 21:11:40 UTC (rev 277548)
@@ -27,12 +27,12 @@
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-#include "BlockFormattingContext.h"
+#include "FormattingQuirks.h"
namespace WebCore {
namespace Layout {
-class BlockFormattingQuirks : public FormattingContext::Quirks {
+class BlockFormattingQuirks : public FormattingQuirks {
public:
BlockFormattingQuirks(const BlockFormattingContext&);
@@ -44,7 +44,7 @@
bool shouldCollapseMarginAfterWithParentMarginAfter(const Box&) const;
protected:
- const BlockFormattingContext& formattingContext() const { return downcast<BlockFormattingContext>(FormattingContext::Quirks::formattingContext()); }
+ const BlockFormattingContext& formattingContext() const { return downcast<BlockFormattingContext>(FormattingQuirks::formattingContext()); }
BlockFormattingContext::Geometry geometry() const { return formattingContext().geometry(); }
};
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingQuirks.cpp (277547 => 277548)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingQuirks.cpp 2021-05-15 20:46:56 UTC (rev 277547)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingQuirks.cpp 2021-05-15 21:11:40 UTC (rev 277548)
@@ -34,7 +34,7 @@
namespace Layout {
InlineFormattingQuirks::InlineFormattingQuirks(const InlineFormattingContext& inlineFormattingContext)
- : FormattingContext::Quirks(inlineFormattingContext)
+ : FormattingQuirks(inlineFormattingContext)
{
}
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingQuirks.h (277547 => 277548)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingQuirks.h 2021-05-15 20:46:56 UTC (rev 277547)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingQuirks.h 2021-05-15 21:11:40 UTC (rev 277548)
@@ -27,12 +27,12 @@
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-#include "FormattingContext.h"
+#include "FormattingQuirks.h"
namespace WebCore {
namespace Layout {
-class InlineFormattingQuirks : public FormattingContext::Quirks {
+class InlineFormattingQuirks : public FormattingQuirks {
public:
InlineLayoutUnit initialLineHeight() const;
bool hasSoftWrapOpportunityAtImage() const;
@@ -42,7 +42,7 @@
friend class InlineFormattingContext;
InlineFormattingQuirks(const InlineFormattingContext&);
- const InlineFormattingContext& formattingContext() const { return downcast<InlineFormattingContext>(FormattingContext::Quirks::formattingContext()); }
+ const InlineFormattingContext& formattingContext() const { return downcast<InlineFormattingContext>(FormattingQuirks::formattingContext()); }
};
Modified: trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingQuirks.cpp (277547 => 277548)
--- trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingQuirks.cpp 2021-05-15 20:46:56 UTC (rev 277547)
+++ trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingQuirks.cpp 2021-05-15 21:11:40 UTC (rev 277548)
@@ -36,7 +36,7 @@
namespace Layout {
TableFormattingQuirks::TableFormattingQuirks(const TableFormattingContext& tableFormattingContext)
- : FormattingContext::Quirks(tableFormattingContext)
+ : FormattingQuirks(tableFormattingContext)
{
}
Modified: trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingQuirks.h (277547 => 277548)
--- trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingQuirks.h 2021-05-15 20:46:56 UTC (rev 277547)
+++ trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingQuirks.h 2021-05-15 21:11:40 UTC (rev 277548)
@@ -27,12 +27,12 @@
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-#include "FormattingContext.h"
+#include "FormattingQuirks.h"
namespace WebCore {
namespace Layout {
-class TableFormattingQuirks : public FormattingContext::Quirks {
+class TableFormattingQuirks : public FormattingQuirks {
public:
TableFormattingQuirks(const TableFormattingContext&);
@@ -39,7 +39,7 @@
bool shouldIgnoreChildContentVerticalMargin(const ContainerBox&) const;
private:
- const TableFormattingContext& formattingContext() const { return downcast<TableFormattingContext>(FormattingContext::Quirks::formattingContext()); }
+ const TableFormattingContext& formattingContext() const { return downcast<TableFormattingContext>(FormattingQuirks::formattingContext()); }
TableFormattingContext::Geometry geometry() const { return formattingContext().geometry(); }
};