Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (282900 => 282901)
--- trunk/Source/WebCore/CMakeLists.txt 2021-09-23 01:16:01 UTC (rev 282900)
+++ trunk/Source/WebCore/CMakeLists.txt 2021-09-23 01:48:46 UTC (rev 282901)
@@ -113,6 +113,7 @@
"${WEBCORE_DIR}/layout/formattingContexts/flex"
"${WEBCORE_DIR}/layout/floats"
"${WEBCORE_DIR}/layout/formattingContexts/inline"
+ "${WEBCORE_DIR}/layout/formattingContexts/inline/display"
"${WEBCORE_DIR}/layout/formattingContexts/inline/invalidation"
"${WEBCORE_DIR}/layout/formattingContexts/inline/text"
"${WEBCORE_DIR}/layout/integration"
Modified: trunk/Source/WebCore/ChangeLog (282900 => 282901)
--- trunk/Source/WebCore/ChangeLog 2021-09-23 01:16:01 UTC (rev 282900)
+++ trunk/Source/WebCore/ChangeLog 2021-09-23 01:48:46 UTC (rev 282901)
@@ -1,3 +1,62 @@
+2021-09-22 Alan Bujtas <za...@apple.com>
+
+ [LFC][IFC] Move LineGeometry and LineRun files under /inline/display
+ https://bugs.webkit.org/show_bug.cgi?id=230632
+
+ Reviewed by Antti Koivisto.
+
+ This is in preparation for moving these classes out of the "layout namespace".
+
+ * CMakeLists.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * layout/formattingContexts/inline/display/InlineLineGeometry.h: Renamed from Source/WebCore/layout/formattingContexts/inline/InlineLineGeometry.h.
+ (WebCore::Layout::LineGeometry::lineBoxLogicalRect const):
+ (WebCore::Layout::LineGeometry::scrollableOverflow const):
+ (WebCore::Layout::LineGeometry::enclosingTopAndBottom const):
+ (WebCore::Layout::LineGeometry::baseline const):
+ (WebCore::Layout::LineGeometry::contentLogicalLeft const):
+ (WebCore::Layout::LineGeometry::contentLogicalWidth const):
+ (WebCore::Layout::LineGeometry::moveVertically):
+ (WebCore::Layout::LineGeometry::LineGeometry):
+ * layout/formattingContexts/inline/display/InlineLineRun.h: Renamed from Source/WebCore/layout/formattingContexts/inline/InlineLineRun.h.
+ (WebCore::Layout::Run::Text::start const):
+ (WebCore::Layout::Run::Text::end const):
+ (WebCore::Layout::Run::Text::length const):
+ (WebCore::Layout::Run::Text::originalContent const):
+ (WebCore::Layout::Run::Text::renderedContent const):
+ (WebCore::Layout::Run::Text::hasHyphen const):
+ (WebCore::Layout::Run::isText const):
+ (WebCore::Layout::Run::isSoftLineBreak const):
+ (WebCore::Layout::Run::isLineBreakBox const):
+ (WebCore::Layout::Run::isLineBreak const):
+ (WebCore::Layout::Run::isAtomicInlineLevelBox const):
+ (WebCore::Layout::Run::isInlineBox const):
+ (WebCore::Layout::Run::isNonRootInlineBox const):
+ (WebCore::Layout::Run::isRootInlineBox const):
+ (WebCore::Layout::Run::isGenericInlineLevelBox const):
+ (WebCore::Layout::Run::isInlineLevelBox const):
+ (WebCore::Layout::Run::isNonRootInlineLevelBox const):
+ (WebCore::Layout::Run::type const):
+ (WebCore::Layout::Run::hasContent const):
+ (WebCore::Layout::Run::logicalRect const):
+ (WebCore::Layout::Run::inkOverflow const):
+ (WebCore::Layout::Run::logicalTop const):
+ (WebCore::Layout::Run::logicalBottom const):
+ (WebCore::Layout::Run::logicalLeft const):
+ (WebCore::Layout::Run::logicalRight const):
+ (WebCore::Layout::Run::logicalWidth const):
+ (WebCore::Layout::Run::logicalHeight const):
+ (WebCore::Layout::Run::moveVertically):
+ (WebCore::Layout::Run::adjustInkOverflow):
+ (WebCore::Layout::Run::text):
+ (WebCore::Layout::Run::text const):
+ (WebCore::Layout::Run::expansion const):
+ (WebCore::Layout::Run::layoutBox const):
+ (WebCore::Layout::Run::style const):
+ (WebCore::Layout::Run::lineIndex const):
+ (WebCore::Layout::Run::Run):
+ (WebCore::Layout::Run::Text::Text):
+
2021-09-22 Joonghun Park <jh718.p...@samsung.com>
Fix the behavior that setting text field input's value content attribute to the same value moves caret to the end of the input.
Modified: trunk/Source/WebCore/Headers.cmake (282900 => 282901)
--- trunk/Source/WebCore/Headers.cmake 2021-09-23 01:16:01 UTC (rev 282900)
+++ trunk/Source/WebCore/Headers.cmake 2021-09-23 01:48:46 UTC (rev 282901)
@@ -784,7 +784,7 @@
layout/LayoutUnits.h
layout/MarginTypes.h
- layout/formattingContexts/inline/InlineLineRun.h
+ layout/formattingContexts/inline/display/InlineLineRun.h
layout/formattingContexts/inline/InlineRect.h
layout/integration/LayoutIntegrationInlineContent.h
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (282900 => 282901)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-09-23 01:16:01 UTC (rev 282900)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-09-23 01:48:46 UTC (rev 282901)
@@ -18268,6 +18268,7 @@
115CFA9A208BC140001E6991 /* inline */ = {
isa = PBXGroup;
children = (
+ 11A1E6FB26FBB6CE00435D36 /* display */,
111FA1C326F0F2E6003B8F16 /* invalidation */,
6FE7DDDD20EC6E8B008B5B4E /* text */,
6FE198132178397B00446F08 /* InlineContentBreaker.cpp */,
@@ -18295,8 +18296,6 @@
6F6EE74126D44EE200374CDA /* InlineLineBoxVerticalAligner.h */,
6F25B200220A85AB0000011B /* InlineLineBuilder.cpp */,
6F26EB46234004A5006906E2 /* InlineLineBuilder.h */,
- 6F91420F25152137004E4FEA /* InlineLineGeometry.h */,
- 6FC3F9452516756600A49BEA /* InlineLineRun.h */,
6F40DA812513033A00EC04B7 /* InlineRect.h */,
6F360E4E23999420001512A7 /* InlineSoftLineBreakItem.h */,
6F1CC1DC225F8B4100720AD2 /* InlineTextItem.cpp */,
@@ -18305,6 +18304,15 @@
path = inline;
sourceTree = "<group>";
};
+ 11A1E6FB26FBB6CE00435D36 /* display */ = {
+ isa = PBXGroup;
+ children = (
+ 6F91420F25152137004E4FEA /* InlineLineGeometry.h */,
+ 6FC3F9452516756600A49BEA /* InlineLineRun.h */,
+ );
+ path = display;
+ sourceTree = "<group>";
+ };
1221E0581C02B409006A1A00 /* Animation */ = {
isa = PBXGroup;
children = (
Deleted: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineGeometry.h (282900 => 282901)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineGeometry.h 2021-09-23 01:16:01 UTC (rev 282900)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineGeometry.h 2021-09-23 01:48:46 UTC (rev 282901)
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2020 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 "InlineRect.h"
-
-namespace WebCore {
-namespace Layout {
-
-class LineGeometry {
- WTF_MAKE_FAST_ALLOCATED;
-public:
- struct EnclosingTopAndBottom {
- // This values encloses the root inline box and any other inline level box's border box.
- InlineLayoutUnit top { 0 };
- InlineLayoutUnit bottom { 0 };
- };
- LineGeometry(const InlineRect& lineBoxLogicalRect, const InlineRect& scrollableOverflow, EnclosingTopAndBottom, InlineLayoutUnit aligmentBaseline, InlineLayoutUnit contentLogicalLeft, InlineLayoutUnit contentLogicalWidth);
-
- const InlineRect& lineBoxLogicalRect() const { return m_lineBoxLogicalRect; }
- const InlineRect& scrollableOverflow() const { return m_scrollableOverflow; }
-
- EnclosingTopAndBottom enclosingTopAndBottom() const { return m_enclosingTopAndBottom; }
-
- InlineLayoutUnit baseline() const { return m_aligmentBaseline; }
-
- InlineLayoutUnit contentLogicalLeft() const { return m_contentLogicalLeft; }
- InlineLayoutUnit contentLogicalWidth() const { return m_contentLogicalWidth; }
-
- void moveVertically(InlineLayoutUnit offset) { m_lineBoxLogicalRect.moveVertically(offset); }
-
-private:
- // This is line box geometry (see https://www.w3.org/TR/css-inline-3/#line-box).
- InlineRect m_lineBoxLogicalRect;
- InlineRect m_scrollableOverflow;
- // Enclosing top and bottom includes all inline level boxes (border box) vertically.
- // While the line box usually enclose them as well, its vertical geometry is based on
- // the layout bounds of the inline level boxes which may be different when line-height is present.
- EnclosingTopAndBottom m_enclosingTopAndBottom;
- InlineLayoutUnit m_aligmentBaseline { 0 };
- InlineLayoutUnit m_contentLogicalLeft { 0 };
- InlineLayoutUnit m_contentLogicalWidth { 0 };
-};
-
-inline LineGeometry::LineGeometry(const InlineRect& lineBoxLogicalRect, const InlineRect& scrollableOverflow, EnclosingTopAndBottom enclosingTopAndBottom, InlineLayoutUnit aligmentBaseline, InlineLayoutUnit contentLogicalLeft, InlineLayoutUnit contentLogicalWidth)
- : m_lineBoxLogicalRect(lineBoxLogicalRect)
- , m_scrollableOverflow(scrollableOverflow)
- , m_enclosingTopAndBottom(enclosingTopAndBottom)
- , m_aligmentBaseline(aligmentBaseline)
- , m_contentLogicalLeft(contentLogicalLeft)
- , m_contentLogicalWidth(contentLogicalWidth)
-{
-}
-
-}
-}
-
-#endif
Deleted: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineRun.h (282900 => 282901)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineRun.h 2021-09-23 01:16:01 UTC (rev 282900)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineRun.h 2021-09-23 01:48:46 UTC (rev 282901)
@@ -1,149 +0,0 @@
-/*
- * Copyright (C) 2020 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 "InlineRect.h"
-#include "LayoutBox.h"
-#include "TextFlags.h"
-
-namespace WebCore {
-namespace Layout {
-
-struct Run {
- WTF_MAKE_STRUCT_FAST_ALLOCATED;
- struct Text {
- WTF_MAKE_STRUCT_FAST_ALLOCATED;
- public:
- Text(size_t position, size_t length, const String& originalContent, String adjustedContentToRender = String(), bool hasHyphen = false);
-
- size_t start() const { return m_start; }
- size_t end() const { return start() + length(); }
- size_t length() const { return m_length; }
- StringView originalContent() const { return StringView(m_originalContent).substring(m_start, m_length); }
- StringView renderedContent() const { return m_adjustedContentToRender.isNull() ? originalContent() : m_adjustedContentToRender; }
-
- bool hasHyphen() const { return m_hasHyphen; }
-
- private:
- size_t m_start { 0 };
- size_t m_length { 0 };
- bool m_hasHyphen { false };
- String m_originalContent;
- String m_adjustedContentToRender;
- };
-
- enum class Type {
- Text,
- SoftLineBreak,
- LineBreakBox,
- AtomicInlineLevelBox,
- NonRootInlineBox,
- RootInlineBox,
- GenericInlineLevelBox
- };
- struct Expansion;
- Run(size_t lineIndex, Type, const Box&, const InlineRect&, const InlineRect& inkOverflow, Expansion, std::optional<Text> = std::nullopt, bool hasContent = true);
-
- bool isText() const { return m_type == Type::Text; }
- bool isSoftLineBreak() const { return m_type == Type::SoftLineBreak; }
- bool isLineBreakBox() const { return m_type == Type::LineBreakBox; }
- bool isLineBreak() const { return isSoftLineBreak() || isLineBreakBox(); }
- bool isAtomicInlineLevelBox() const { return m_type == Type::AtomicInlineLevelBox; }
- bool isInlineBox() const { return isNonRootInlineBox() || isRootInlineBox(); }
- bool isNonRootInlineBox() const { return m_type == Type::NonRootInlineBox; }
- bool isRootInlineBox() const { return m_type == Type::RootInlineBox; }
- bool isGenericInlineLevelBox() const { return m_type == Type::GenericInlineLevelBox; }
- bool isInlineLevelBox() const { return isAtomicInlineLevelBox() || isLineBreakBox() || isInlineBox() || isGenericInlineLevelBox(); }
- bool isNonRootInlineLevelBox() const { return isInlineLevelBox() && !isRootInlineBox(); }
- Type type() const { return m_type; }
-
- bool hasContent() const { return m_hasContent; }
-
- const InlineRect& logicalRect() const { return m_logicalRect; }
- const InlineRect& inkOverflow() const { return m_inkOverflow; }
-
- InlineLayoutUnit logicalTop() const { return logicalRect().top(); }
- InlineLayoutUnit logicalBottom() const { return logicalRect().bottom(); }
- InlineLayoutUnit logicalLeft() const { return logicalRect().left(); }
- InlineLayoutUnit logicalRight() const { return logicalRect().right(); }
-
- InlineLayoutUnit logicalWidth() const { return logicalRect().width(); }
- InlineLayoutUnit logicalHeight() const { return logicalRect().height(); }
-
- void moveVertically(InlineLayoutUnit offset) { m_logicalRect.moveVertically(offset); }
- void adjustInkOverflow(const InlineRect& childBorderBox) { return m_inkOverflow.expandToContain(childBorderBox); }
-
- std::optional<Text>& text() { return m_text; }
- const std::optional<Text>& text() const { return m_text; }
-
- struct Expansion {
- ExpansionBehavior behavior { DefaultExpansion };
- InlineLayoutUnit horizontalExpansion { 0 };
- };
- Expansion expansion() const { return m_expansion; }
-
- const Box& layoutBox() const { return *m_layoutBox; }
- const RenderStyle& style() const { return layoutBox().style(); }
-
- size_t lineIndex() const { return m_lineIndex; }
-
-private:
- const size_t m_lineIndex { 0 };
- const Type m_type { Type::GenericInlineLevelBox };
- WeakPtr<const Layout::Box> m_layoutBox;
- InlineRect m_logicalRect;
- InlineRect m_inkOverflow;
- bool m_hasContent { true };
- Expansion m_expansion;
- std::optional<Text> m_text;
-};
-
-inline Run::Run(size_t lineIndex, Type type, const Layout::Box& layoutBox, const InlineRect& logicalRect, const InlineRect& inkOverflow, Expansion expansion, std::optional<Text> text, bool hasContent)
- : m_lineIndex(lineIndex)
- , m_type(type)
- , m_layoutBox(makeWeakPtr(layoutBox))
- , m_logicalRect(logicalRect)
- , m_inkOverflow(inkOverflow)
- , m_hasContent(hasContent)
- , m_expansion(expansion)
- , m_text(text)
-{
-}
-
-inline Run::Text::Text(size_t start, size_t length, const String& originalContent, String adjustedContentToRender, bool hasHyphen)
- : m_start(start)
- , m_length(length)
- , m_hasHyphen(hasHyphen)
- , m_originalContent(originalContent)
- , m_adjustedContentToRender(adjustedContentToRender)
-{
-}
-
-}
-}
-#endif
Copied: trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineLineGeometry.h (from rev 282900, trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineGeometry.h) (0 => 282901)
--- trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineLineGeometry.h (rev 0)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineLineGeometry.h 2021-09-23 01:48:46 UTC (rev 282901)
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2020 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 "InlineRect.h"
+
+namespace WebCore {
+namespace Layout {
+
+class LineGeometry {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ struct EnclosingTopAndBottom {
+ // This values encloses the root inline box and any other inline level box's border box.
+ InlineLayoutUnit top { 0 };
+ InlineLayoutUnit bottom { 0 };
+ };
+ LineGeometry(const InlineRect& lineBoxLogicalRect, const InlineRect& scrollableOverflow, EnclosingTopAndBottom, InlineLayoutUnit aligmentBaseline, InlineLayoutUnit contentLogicalLeft, InlineLayoutUnit contentLogicalWidth);
+
+ const InlineRect& lineBoxLogicalRect() const { return m_lineBoxLogicalRect; }
+ const InlineRect& scrollableOverflow() const { return m_scrollableOverflow; }
+
+ EnclosingTopAndBottom enclosingTopAndBottom() const { return m_enclosingTopAndBottom; }
+
+ InlineLayoutUnit baseline() const { return m_aligmentBaseline; }
+
+ InlineLayoutUnit contentLogicalLeft() const { return m_contentLogicalLeft; }
+ InlineLayoutUnit contentLogicalWidth() const { return m_contentLogicalWidth; }
+
+ void moveVertically(InlineLayoutUnit offset) { m_lineBoxLogicalRect.moveVertically(offset); }
+
+private:
+ // This is line box geometry (see https://www.w3.org/TR/css-inline-3/#line-box).
+ InlineRect m_lineBoxLogicalRect;
+ InlineRect m_scrollableOverflow;
+ // Enclosing top and bottom includes all inline level boxes (border box) vertically.
+ // While the line box usually enclose them as well, its vertical geometry is based on
+ // the layout bounds of the inline level boxes which may be different when line-height is present.
+ EnclosingTopAndBottom m_enclosingTopAndBottom;
+ InlineLayoutUnit m_aligmentBaseline { 0 };
+ InlineLayoutUnit m_contentLogicalLeft { 0 };
+ InlineLayoutUnit m_contentLogicalWidth { 0 };
+};
+
+inline LineGeometry::LineGeometry(const InlineRect& lineBoxLogicalRect, const InlineRect& scrollableOverflow, EnclosingTopAndBottom enclosingTopAndBottom, InlineLayoutUnit aligmentBaseline, InlineLayoutUnit contentLogicalLeft, InlineLayoutUnit contentLogicalWidth)
+ : m_lineBoxLogicalRect(lineBoxLogicalRect)
+ , m_scrollableOverflow(scrollableOverflow)
+ , m_enclosingTopAndBottom(enclosingTopAndBottom)
+ , m_aligmentBaseline(aligmentBaseline)
+ , m_contentLogicalLeft(contentLogicalLeft)
+ , m_contentLogicalWidth(contentLogicalWidth)
+{
+}
+
+}
+}
+
+#endif
Copied: trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineLineRun.h (from rev 282900, trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineRun.h) (0 => 282901)
--- trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineLineRun.h (rev 0)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineLineRun.h 2021-09-23 01:48:46 UTC (rev 282901)
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2020 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 "InlineRect.h"
+#include "LayoutBox.h"
+#include "TextFlags.h"
+
+namespace WebCore {
+namespace Layout {
+
+struct Run {
+ WTF_MAKE_STRUCT_FAST_ALLOCATED;
+ struct Text {
+ WTF_MAKE_STRUCT_FAST_ALLOCATED;
+ public:
+ Text(size_t position, size_t length, const String& originalContent, String adjustedContentToRender = String(), bool hasHyphen = false);
+
+ size_t start() const { return m_start; }
+ size_t end() const { return start() + length(); }
+ size_t length() const { return m_length; }
+ StringView originalContent() const { return StringView(m_originalContent).substring(m_start, m_length); }
+ StringView renderedContent() const { return m_adjustedContentToRender.isNull() ? originalContent() : m_adjustedContentToRender; }
+
+ bool hasHyphen() const { return m_hasHyphen; }
+
+ private:
+ size_t m_start { 0 };
+ size_t m_length { 0 };
+ bool m_hasHyphen { false };
+ String m_originalContent;
+ String m_adjustedContentToRender;
+ };
+
+ enum class Type {
+ Text,
+ SoftLineBreak,
+ LineBreakBox,
+ AtomicInlineLevelBox,
+ NonRootInlineBox,
+ RootInlineBox,
+ GenericInlineLevelBox
+ };
+ struct Expansion;
+ Run(size_t lineIndex, Type, const Box&, const InlineRect&, const InlineRect& inkOverflow, Expansion, std::optional<Text> = std::nullopt, bool hasContent = true);
+
+ bool isText() const { return m_type == Type::Text; }
+ bool isSoftLineBreak() const { return m_type == Type::SoftLineBreak; }
+ bool isLineBreakBox() const { return m_type == Type::LineBreakBox; }
+ bool isLineBreak() const { return isSoftLineBreak() || isLineBreakBox(); }
+ bool isAtomicInlineLevelBox() const { return m_type == Type::AtomicInlineLevelBox; }
+ bool isInlineBox() const { return isNonRootInlineBox() || isRootInlineBox(); }
+ bool isNonRootInlineBox() const { return m_type == Type::NonRootInlineBox; }
+ bool isRootInlineBox() const { return m_type == Type::RootInlineBox; }
+ bool isGenericInlineLevelBox() const { return m_type == Type::GenericInlineLevelBox; }
+ bool isInlineLevelBox() const { return isAtomicInlineLevelBox() || isLineBreakBox() || isInlineBox() || isGenericInlineLevelBox(); }
+ bool isNonRootInlineLevelBox() const { return isInlineLevelBox() && !isRootInlineBox(); }
+ Type type() const { return m_type; }
+
+ bool hasContent() const { return m_hasContent; }
+
+ const InlineRect& logicalRect() const { return m_logicalRect; }
+ const InlineRect& inkOverflow() const { return m_inkOverflow; }
+
+ InlineLayoutUnit logicalTop() const { return logicalRect().top(); }
+ InlineLayoutUnit logicalBottom() const { return logicalRect().bottom(); }
+ InlineLayoutUnit logicalLeft() const { return logicalRect().left(); }
+ InlineLayoutUnit logicalRight() const { return logicalRect().right(); }
+
+ InlineLayoutUnit logicalWidth() const { return logicalRect().width(); }
+ InlineLayoutUnit logicalHeight() const { return logicalRect().height(); }
+
+ void moveVertically(InlineLayoutUnit offset) { m_logicalRect.moveVertically(offset); }
+ void adjustInkOverflow(const InlineRect& childBorderBox) { return m_inkOverflow.expandToContain(childBorderBox); }
+
+ std::optional<Text>& text() { return m_text; }
+ const std::optional<Text>& text() const { return m_text; }
+
+ struct Expansion {
+ ExpansionBehavior behavior { DefaultExpansion };
+ InlineLayoutUnit horizontalExpansion { 0 };
+ };
+ Expansion expansion() const { return m_expansion; }
+
+ const Box& layoutBox() const { return *m_layoutBox; }
+ const RenderStyle& style() const { return layoutBox().style(); }
+
+ size_t lineIndex() const { return m_lineIndex; }
+
+private:
+ const size_t m_lineIndex { 0 };
+ const Type m_type { Type::GenericInlineLevelBox };
+ WeakPtr<const Layout::Box> m_layoutBox;
+ InlineRect m_logicalRect;
+ InlineRect m_inkOverflow;
+ bool m_hasContent { true };
+ Expansion m_expansion;
+ std::optional<Text> m_text;
+};
+
+inline Run::Run(size_t lineIndex, Type type, const Layout::Box& layoutBox, const InlineRect& logicalRect, const InlineRect& inkOverflow, Expansion expansion, std::optional<Text> text, bool hasContent)
+ : m_lineIndex(lineIndex)
+ , m_type(type)
+ , m_layoutBox(makeWeakPtr(layoutBox))
+ , m_logicalRect(logicalRect)
+ , m_inkOverflow(inkOverflow)
+ , m_hasContent(hasContent)
+ , m_expansion(expansion)
+ , m_text(text)
+{
+}
+
+inline Run::Text::Text(size_t start, size_t length, const String& originalContent, String adjustedContentToRender, bool hasHyphen)
+ : m_start(start)
+ , m_length(length)
+ , m_hasHyphen(hasHyphen)
+ , m_originalContent(originalContent)
+ , m_adjustedContentToRender(adjustedContentToRender)
+{
+}
+
+}
+}
+#endif