Diff
Modified: trunk/Source/WebCore/ChangeLog (248199 => 248200)
--- trunk/Source/WebCore/ChangeLog 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Source/WebCore/ChangeLog 2019-08-03 16:09:47 UTC (rev 248200)
@@ -1,5 +1,72 @@
2019-08-03 Zalan Bujtas <[email protected]>
+ [LFC] Remove formatting context type leaf classes
+ https://bugs.webkit.org/show_bug.cgi?id=200224
+ <rdar://problem/53661907>
+
+ Reviewed by Antti Koivisto.
+
+ Let's keep the layout tree formatting context type independent.
+
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * layout/inlineformatting/InlineFormattingContext.cpp:
+ (WebCore::Layout::InlineFormattingContext::layout const):
+ (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
+ (WebCore::Layout::InlineFormattingContext::initializeMarginBorderAndPaddingForGenericInlineBox const):
+ (WebCore::Layout::InlineFormattingContext::collectInlineContent const):
+ * layout/inlineformatting/InlineFormattingContext.h:
+ * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
+ (WebCore::Layout::inlineItemWidth):
+ (WebCore::Layout::LineLayout::placeInlineItem):
+ * layout/inlineformatting/InlineItem.h:
+ * layout/inlineformatting/InlineTextItem.cpp:
+ (WebCore::Layout::InlineTextItem::createAndAppendTextItems):
+ (WebCore::Layout::InlineTextItem::InlineTextItem):
+ (WebCore::Layout::InlineTextItem::split const):
+ * layout/inlineformatting/InlineTextItem.h:
+ (WebCore::Layout::InlineTextItem::inlineBox const): Deleted.
+ * layout/inlineformatting/text/TextUtil.cpp:
+ (WebCore::Layout::TextUtil::width):
+ (WebCore::Layout::TextUtil::split):
+ * layout/inlineformatting/text/TextUtil.h:
+ * layout/layouttree/LayoutBox.cpp:
+ (WebCore::Layout::Box::Box):
+ (WebCore::Layout::Box::~Box):
+ (WebCore::Layout::Box::formattingContextRoot const):
+ (WebCore::Layout::Box::setTextContent):
+ (WebCore::Layout::Box::hasTextContent const):
+ (WebCore::Layout::Box::textContent const):
+ (WebCore::Layout::Box::replaced const):
+ (WebCore::Layout::Box::replaced):
+ (WebCore::Layout::Box::rareDataMap):
+ (WebCore::Layout::Box::rareData const):
+ (WebCore::Layout::Box::ensureRareData):
+ (WebCore::Layout::Box::removeRareData):
+ * layout/layouttree/LayoutBox.h:
+ (WebCore::Layout::Box::isLineBreakBox const):
+ (WebCore::Layout::Box::hasRareData const):
+ (WebCore::Layout::Box::setHasRareData):
+ (WebCore::Layout::Box::isInlineBox const): Deleted.
+ (WebCore::Layout::Box::replaced const): Deleted.
+ (WebCore::Layout::Box::replaced): Deleted.
+ * layout/layouttree/LayoutContainer.h:
+ (WebCore::Layout::Container::firstChild const): Deleted.
+ (WebCore::Layout::Container::lastChild const): Deleted.
+ (WebCore::Layout::Container::hasChild const): Deleted.
+ (WebCore::Layout::Container::hasInFlowChild const): Deleted.
+ (WebCore::Layout::Container::hasInFlowOrFloatingChild const): Deleted.
+ (WebCore::Layout::Container::outOfFlowDescendants const): Deleted.
+ * layout/layouttree/LayoutInlineBox.cpp: Removed.
+ * layout/layouttree/LayoutInlineBox.h: Removed.
+ * layout/layouttree/LayoutLineBreakBox.cpp: Removed.
+ * layout/layouttree/LayoutLineBreakBox.h: Removed.
+ * layout/layouttree/LayoutTreeBuilder.cpp:
+ (WebCore::Layout::TreeBuilder::createLayoutBox):
+ (WebCore::Layout::outputLayoutBox):
+
+2019-08-03 Zalan Bujtas <[email protected]>
+
[LFC] Remove formatting context type container classes.
https://bugs.webkit.org/show_bug.cgi?id=200202
Modified: trunk/Source/WebCore/Sources.txt (248199 => 248200)
--- trunk/Source/WebCore/Sources.txt 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Source/WebCore/Sources.txt 2019-08-03 16:09:47 UTC (rev 248200)
@@ -1411,8 +1411,6 @@
layout/inlineformatting/text/TextUtil.cpp
layout/layouttree/LayoutBox.cpp
layout/layouttree/LayoutContainer.cpp
-layout/layouttree/LayoutInlineBox.cpp
-layout/layouttree/LayoutLineBreakBox.cpp
layout/layouttree/LayoutReplaced.cpp
layout/layouttree/LayoutTreeBuilder.cpp
layout/tableformatting/TableFormattingContext.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (248199 => 248200)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-08-03 16:09:47 UTC (rev 248200)
@@ -397,7 +397,6 @@
119340971FED715500935F1E /* RenderTreeBuilderFormControls.h in Headers */ = {isa = PBXBuildFile; fileRef = 119340951FED715500935F1E /* RenderTreeBuilderFormControls.h */; };
119340A31FEE024000935F1E /* RenderTreeBuilderBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = 119340A11FEE024000935F1E /* RenderTreeBuilderBlock.h */; };
1199FA46208E35A3002358CC /* LayoutContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1199FA44208E35A3002358CC /* LayoutContainer.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 1199FA53208E38D3002358CC /* LayoutInlineBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 1199FA51208E38D3002358CC /* LayoutInlineBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
1199FA5B208E3C7F002358CC /* DisplayBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 1199FA59208E3C7F002358CC /* DisplayBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
11CB2789203BA570004A1DC9 /* RenderTreeBuilderFullScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = 11CB2787203BA570004A1DC9 /* RenderTreeBuilderFullScreen.h */; };
11E067EE1E6246E500162D16 /* SimpleLineLayoutCoverage.h in Headers */ = {isa = PBXBuildFile; fileRef = 11E067ED1E6246E500162D16 /* SimpleLineLayoutCoverage.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -2027,7 +2026,6 @@
6FD9CD54227E21C800E53957 /* DisplayRect.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FD9CD52227E21C800E53957 /* DisplayRect.h */; settings = {ATTRIBUTES = (Private, ); }; };
6FE198172178397C00446F08 /* InlineLineBreaker.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FE198152178397C00446F08 /* InlineLineBreaker.h */; settings = {ATTRIBUTES = (Private, ); }; };
6FE7CFA22177EEF2005B1573 /* InlineItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FE7CFA02177EEF1005B1573 /* InlineItem.h */; };
- 6FE7CFA42177EF10005B1573 /* LayoutLineBreakBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FE7CFA32177EF10005B1573 /* LayoutLineBreakBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
6FFDC442212EFF1700A9CA91 /* FloatAvoider.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FFDC440212EFF1600A9CA91 /* FloatAvoider.h */; settings = {ATTRIBUTES = (Private, ); }; };
709A01FE1E3D0BDD006B0D4C /* ModuleFetchFailureKind.h in Headers */ = {isa = PBXBuildFile; fileRef = 709A01FD1E3D0BCC006B0D4C /* ModuleFetchFailureKind.h */; settings = {ATTRIBUTES = (Private, ); }; };
71025ECD1F99F0CE004A250C /* AnimationTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 71025EC71F99F096004A250C /* AnimationTimeline.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -5838,8 +5836,6 @@
119340A11FEE024000935F1E /* RenderTreeBuilderBlock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderTreeBuilderBlock.h; sourceTree = "<group>"; };
1199FA44208E35A3002358CC /* LayoutContainer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutContainer.h; sourceTree = "<group>"; };
1199FA45208E35A3002358CC /* LayoutContainer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutContainer.cpp; sourceTree = "<group>"; };
- 1199FA51208E38D3002358CC /* LayoutInlineBox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutInlineBox.h; sourceTree = "<group>"; };
- 1199FA52208E38D3002358CC /* LayoutInlineBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutInlineBox.cpp; sourceTree = "<group>"; };
1199FA59208E3C7F002358CC /* DisplayBox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayBox.h; sourceTree = "<group>"; };
1199FA5A208E3C7F002358CC /* DisplayBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayBox.cpp; sourceTree = "<group>"; };
11B042FB20B0E21400828A6B /* LayoutDescendantIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutDescendantIterator.h; sourceTree = "<group>"; };
@@ -9188,8 +9184,6 @@
6FE198152178397C00446F08 /* InlineLineBreaker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineLineBreaker.h; sourceTree = "<group>"; };
6FE7AA2621C37B6300296DCD /* MarginTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MarginTypes.h; sourceTree = "<group>"; };
6FE7CFA02177EEF1005B1573 /* InlineItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineItem.h; sourceTree = "<group>"; };
- 6FE7CFA32177EF10005B1573 /* LayoutLineBreakBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutLineBreakBox.h; sourceTree = "<group>"; };
- 6FE7CFA52177F069005B1573 /* LayoutLineBreakBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutLineBreakBox.cpp; sourceTree = "<group>"; };
6FE9F09222211035004C5082 /* ContentChangeObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentChangeObserver.cpp; sourceTree = "<group>"; };
6FFDC43E212EFF1600A9CA91 /* FloatAvoider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FloatAvoider.cpp; sourceTree = "<group>"; };
6FFDC440212EFF1600A9CA91 /* FloatAvoider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FloatAvoider.h; sourceTree = "<group>"; };
@@ -16376,11 +16370,7 @@
1199FA45208E35A3002358CC /* LayoutContainer.cpp */,
1199FA44208E35A3002358CC /* LayoutContainer.h */,
11B042FB20B0E21400828A6B /* LayoutDescendantIterator.h */,
- 1199FA52208E38D3002358CC /* LayoutInlineBox.cpp */,
- 1199FA51208E38D3002358CC /* LayoutInlineBox.h */,
11100FC72092764C0081AA6C /* LayoutIterator.h */,
- 6FE7CFA52177F069005B1573 /* LayoutLineBreakBox.cpp */,
- 6FE7CFA32177EF10005B1573 /* LayoutLineBreakBox.h */,
111C615720AD1AE1005B82FA /* LayoutReplaced.cpp */,
111C615620AD1AE1005B82FA /* LayoutReplaced.h */,
11100FD5209514DE0081AA6C /* LayoutTreeBuilder.cpp */,
@@ -30550,9 +30540,7 @@
11310CF620BA4A560065A8D0 /* LayoutChildIterator.h in Headers */,
1199FA46208E35A3002358CC /* LayoutContainer.h in Headers */,
11310CF520BA4A4C0065A8D0 /* LayoutDescendantIterator.h in Headers */,
- 1199FA53208E38D3002358CC /* LayoutInlineBox.h in Headers */,
11310CF420BA4A3D0065A8D0 /* LayoutIterator.h in Headers */,
- 6FE7CFA42177EF10005B1573 /* LayoutLineBreakBox.h in Headers */,
931D72F615FE695300C4C07E /* LayoutMilestone.h in Headers */,
141DC051164834B900371E5A /* LayoutPoint.h in Headers */,
141DC053164834B900371E5A /* LayoutRect.h in Headers */,
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp (248199 => 248200)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp 2019-08-03 16:09:47 UTC (rev 248200)
@@ -303,10 +303,9 @@
if (!style.logicalWidth().isAuto())
return { };
- if (layoutBox.isReplaced()) {
- auto& replaced = *layoutBox.replaced();
- if (replaced.hasIntrinsicWidth()) {
- auto replacedWidth = replaced.intrinsicWidth();
+ if (auto* replaced = layoutBox.replaced()) {
+ if (replaced->hasIntrinsicWidth()) {
+ auto replacedWidth = replaced->intrinsicWidth();
return { replacedWidth, replacedWidth };
}
return { };
Modified: trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp (248199 => 248200)
--- trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp 2019-08-03 16:09:47 UTC (rev 248200)
@@ -381,7 +381,7 @@
return false;
// FIXME: Block replaced boxes clearly don't collapse through their margins, but I couldn't find it in the spec yet (and no, it's not a quirk).
- if (layoutBox.isReplaced())
+ if (layoutBox.replaced())
return false;
if (!is<Container>(layoutBox))
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (248199 => 248200)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp 2019-08-03 16:09:47 UTC (rev 248200)
@@ -33,7 +33,6 @@
#include "InlineTextItem.h"
#include "LayoutBox.h"
#include "LayoutContainer.h"
-#include "LayoutInlineBox.h"
#include "LayoutState.h"
#include "Logging.h"
#include "Textutil.h"
@@ -68,8 +67,11 @@
if (!is<Container>(root()))
return;
- LOG_WITH_STREAM(FormattingContextLayout, stream << "[Start] -> inline formatting context -> formatting root(" << &root() << ")");
auto& root = downcast<Container>(this->root());
+ if (!root.hasInFlowOrFloatingChild())
+ return;
+
+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Start] -> inline formatting context -> formatting root(" << &root << ")");
auto availableWidth = layoutState().displayBoxForLayoutBox(root).contentBoxWidth();
auto usedValues = UsedHorizontalValues { availableWidth };
auto* layoutBox = root.firstInFlowOrFloatingChild();
@@ -81,10 +83,10 @@
computeMarginBorderAndPaddingForInlineContainer(downcast<Container>(*layoutBox), usedValues);
else if (layoutBox->isReplaced())
computeWidthAndHeightForReplacedInlineBox(*layoutBox, usedValues);
- else if (is<InlineBox>(*layoutBox))
- initializeMarginBorderAndPaddingForGenericInlineBox(downcast<InlineBox>(*layoutBox));
- else
- ASSERT_NOT_REACHED();
+ else {
+ ASSERT(layoutBox->isInlineLevelBox());
+ initializeMarginBorderAndPaddingForGenericInlineBox(*layoutBox);
+ }
layoutBox = nextInPreOrder(*layoutBox, root);
}
@@ -99,11 +101,15 @@
void InlineFormattingContext::computeIntrinsicWidthConstraints() const
{
+ auto& layoutState = this->layoutState();
+ ASSERT(!layoutState.formattingStateForBox(root()).intrinsicWidthConstraints(root()));
+
ASSERT(is<Container>(root()));
-
- auto& layoutState = this->layoutState();
auto& root = downcast<Container>(this->root());
- ASSERT(!layoutState.formattingStateForBox(root).intrinsicWidthConstraints(root));
+ if (!root.hasInFlowOrFloatingChild()) {
+ layoutState.formattingStateForBox(root).setIntrinsicWidthConstraints(root, Geometry::constrainByMinMaxWidth(root, { 0, 0 }));
+ return;
+ }
Vector<const Box*> formattingContextRootList;
auto usedValues = UsedHorizontalValues { };
@@ -146,11 +152,10 @@
layoutState.formattingStateForBox(root).setIntrinsicWidthConstraints(root, intrinsicWidthConstraints);
}
-void InlineFormattingContext::initializeMarginBorderAndPaddingForGenericInlineBox(const InlineBox& layoutBox) const
+void InlineFormattingContext::initializeMarginBorderAndPaddingForGenericInlineBox(const Box& layoutBox) const
{
- ASSERT(layoutBox.isAnonymous() || is<LineBreakBox>(layoutBox));
- auto& layoutState = this->layoutState();
- auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
+ ASSERT(layoutBox.isAnonymous() || layoutBox.isLineBreakBox());
+ auto& displayBox = layoutState().displayBoxForLayoutBox(layoutBox);
displayBox.setVerticalMargin({ { }, { } });
displayBox.setHorizontalMargin({ });
@@ -264,11 +269,7 @@
void InlineFormattingContext::collectInlineContent() const
{
- if (!is<Container>(root()))
- return;
auto& root = downcast<Container>(this->root());
- if (!root.hasInFlowOrFloatingChild())
- return;
// Traverse the tree and create inline items out of containers and leaf nodes. This essentially turns the tree inline structure into a flat one.
// <span>text<span></span><img></span> -> [ContainerStart][InlineBox][ContainerStart][ContainerEnd][InlineBox][ContainerEnd]
auto& formattingState = this->formattingState();
@@ -295,14 +296,14 @@
// This is the end of an inline container (e.g. </span>).
if (treatAsInlineContainer(layoutBox))
formattingState.addInlineItem(std::make_unique<InlineItem>(layoutBox, InlineItem::Type::ContainerEnd));
- else if (is<LineBreakBox>(layoutBox))
+ else if (layoutBox.isLineBreakBox())
formattingState.addInlineItem(std::make_unique<InlineItem>(layoutBox, InlineItem::Type::HardLineBreak));
else if (layoutBox.isFloatingPositioned())
formattingState.addInlineItem(std::make_unique<InlineItem>(layoutBox, InlineItem::Type::Float));
else {
- ASSERT(is<InlineBox>(layoutBox) || layoutBox.isInlineBlockBox());
- if (is<InlineBox>(layoutBox) && downcast<InlineBox>(layoutBox).hasTextContent())
- InlineTextItem::createAndAppendTextItems(formattingState.inlineItems(), downcast<InlineBox>(layoutBox));
+ ASSERT(layoutBox.isInlineLevelBox());
+ if (layoutBox.hasTextContent())
+ InlineTextItem::createAndAppendTextItems(formattingState.inlineItems(), layoutBox);
else
formattingState.addInlineItem(std::make_unique<InlineItem>(layoutBox, InlineItem::Type::Box));
}
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h (248199 => 248200)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h 2019-08-03 16:09:47 UTC (rev 248200)
@@ -83,7 +83,7 @@
void layoutFormattingContextRoot(const Box&, UsedHorizontalValues) const;
void computeIntrinsicWidthForFloatBox(const Box&) const;
void computeMarginBorderAndPaddingForInlineContainer(const Container&, UsedHorizontalValues) const;
- void initializeMarginBorderAndPaddingForGenericInlineBox(const InlineBox&) const;
+ void initializeMarginBorderAndPaddingForGenericInlineBox(const Box&) const;
void computeIntrinsicWidthForInlineBlock(const Box&) const;
void computeWidthAndHeightForReplacedInlineBox(const Box&, UsedHorizontalValues) const;
void computeHorizontalMargin(const Box&, UsedHorizontalValues) const;
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp (248199 => 248200)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp 2019-08-03 16:09:47 UTC (rev 248200)
@@ -49,7 +49,7 @@
if (is<InlineTextItem>(inlineItem)) {
auto& inlineTextItem = downcast<InlineTextItem>(inlineItem);
auto end = inlineTextItem.isCollapsed() ? inlineTextItem.start() + 1 : inlineTextItem.end();
- return TextUtil::width(inlineTextItem.inlineBox(), inlineTextItem.start(), end, contentLogicalLeft);
+ return TextUtil::width(inlineTextItem.layoutBox(), inlineTextItem.start(), end, contentLogicalLeft);
}
auto& layoutBox = inlineItem.layoutBox();
@@ -59,7 +59,7 @@
if (layoutBox.isFloatingPositioned())
return displayBox.marginBoxWidth();
- if (layoutBox.isReplaced())
+ if (layoutBox.replaced())
return displayBox.width();
if (inlineItem.isContainerStart())
@@ -206,7 +206,7 @@
if (breakingContext.breakingBehavior == LineBreaker::BreakingBehavior::Split) {
ASSERT(inlineItem.isText());
auto& inlineTextItem = downcast<InlineTextItem>(inlineItem);
- auto splitData = TextUtil::split(inlineTextItem.inlineBox(), inlineTextItem.start(), inlineTextItem.length(), itemLogicalWidth, availableWidth, currentLogicalRight);
+ auto splitData = TextUtil::split(inlineTextItem.layoutBox(), inlineTextItem.start(), inlineTextItem.length(), itemLogicalWidth, availableWidth, currentLogicalRight);
// Construct a partial trailing inline item.
ASSERT(!m_trailingPartialInlineTextItem);
m_trailingPartialInlineTextItem = inlineTextItem.split(splitData.start, splitData.length);
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineItem.h (248199 => 248200)
--- trunk/Source/WebCore/layout/inlineformatting/InlineItem.h 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineItem.h 2019-08-03 16:09:47 UTC (rev 248200)
@@ -28,8 +28,6 @@
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
#include "LayoutBox.h"
-#include "LayoutInlineBox.h"
-#include "LayoutLineBreakBox.h"
#include <wtf/WeakPtr.h>
namespace WebCore {
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp (248199 => 248200)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp 2019-08-03 16:09:47 UTC (rev 248200)
@@ -204,7 +204,7 @@
return appendInlineContainerStart(inlineItem, logicalWidth);
if (inlineItem.isContainerEnd())
return appendInlineContainerEnd(inlineItem, logicalWidth);
- if (inlineItem.layoutBox().isReplaced())
+ if (inlineItem.layoutBox().replaced())
return appendReplacedInlineBox(inlineItem, logicalWidth);
appendNonReplacedInlineBox(inlineItem, logicalWidth);
}
@@ -415,7 +415,7 @@
if (layoutBox.isFloatingPositioned())
return displayBox.borderBoxHeight();
- if (layoutBox.isReplaced())
+ if (layoutBox.replaced())
return displayBox.borderBoxHeight();
if (inlineItem.isContainerStart() || inlineItem.isContainerEnd())
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.cpp (248199 => 248200)
--- trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.cpp 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.cpp 2019-08-03 16:09:47 UTC (rev 248200)
@@ -29,7 +29,6 @@
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
#include "BreakLines.h"
-#include "LayoutInlineBox.h"
namespace WebCore {
namespace Layout {
@@ -86,7 +85,7 @@
return textLength - startPosition;
}
-void InlineTextItem::createAndAppendTextItems(InlineItems& inlineContent, const InlineBox& inlineBox)
+void InlineTextItem::createAndAppendTextItems(InlineItems& inlineContent, const Box& inlineBox)
{
auto text = inlineBox.textContent();
if (!text.length())
@@ -118,7 +117,7 @@
}
}
-InlineTextItem::InlineTextItem(const InlineBox& inlineBox, unsigned start, unsigned length, bool isWhitespace, bool isCollapsed)
+InlineTextItem::InlineTextItem(const Box& inlineBox, unsigned start, unsigned length, bool isWhitespace, bool isCollapsed)
: InlineItem(inlineBox, Type::Text)
, m_start(start)
, m_length(length)
@@ -131,7 +130,7 @@
{
RELEASE_ASSERT(splitPosition >= this->start());
RELEASE_ASSERT(splitPosition + length <= end());
- return std::make_unique<InlineTextItem>(inlineBox(), splitPosition, length, isWhitespace(), isCollapsed());
+ return std::make_unique<InlineTextItem>(layoutBox(), splitPosition, length, isWhitespace(), isCollapsed());
}
}
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.h (248199 => 248200)
--- trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.h 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.h 2019-08-03 16:09:47 UTC (rev 248200)
@@ -27,7 +27,6 @@
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-#include "InlineBox.h"
#include "InlineFormattingState.h"
#include "InlineItem.h"
@@ -36,9 +35,9 @@
class InlineTextItem : public InlineItem {
public:
- static void createAndAppendTextItems(InlineItems&, const InlineBox&);
+ static void createAndAppendTextItems(InlineItems&, const Box&);
- InlineTextItem(const InlineBox&, unsigned start, unsigned length, bool isWhitespace, bool isCollapsed);
+ InlineTextItem(const Box&, unsigned start, unsigned length, bool isWhitespace, bool isCollapsed);
unsigned start() const { return m_start; }
unsigned end() const { return start() + length(); }
@@ -47,8 +46,6 @@
bool isWhitespace() const { return m_isWhitespace; }
bool isCollapsed() const { return m_isCollapsed; }
- const InlineBox& inlineBox() const { return downcast<InlineBox>(layoutBox()); }
-
std::unique_ptr<InlineTextItem> split(unsigned splitPosition, unsigned length) const;
private:
Modified: trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp (248199 => 248200)
--- trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp 2019-08-03 16:09:47 UTC (rev 248200)
@@ -39,7 +39,7 @@
return WTF::nullopt;
}
-LayoutUnit TextUtil::width(const InlineBox& inlineBox, unsigned from, unsigned to, LayoutUnit contentLogicalLeft)
+LayoutUnit TextUtil::width(const Box& inlineBox, unsigned from, unsigned to, LayoutUnit contentLogicalLeft)
{
auto& style = inlineBox.style();
auto& font = style.fontCascade();
@@ -97,7 +97,7 @@
return inlineTextItem.isWhitespace() && inlineTextItem.style().collapseWhiteSpace();
}
-TextUtil::SplitData TextUtil::split(const InlineBox& inlineBox, unsigned startPosition, unsigned length, LayoutUnit textWidth, LayoutUnit availableWidth, LayoutUnit contentLogicalLeft)
+TextUtil::SplitData TextUtil::split(const Box& inlineBox, unsigned startPosition, unsigned length, LayoutUnit textWidth, LayoutUnit availableWidth, LayoutUnit contentLogicalLeft)
{
// FIXME This should take hypens into account.
ASSERT(availableWidth >= 0);
Modified: trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.h (248199 => 248200)
--- trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.h 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.h 2019-08-03 16:09:47 UTC (rev 248200)
@@ -32,11 +32,9 @@
namespace WebCore {
namespace Layout {
-class InlineBox;
-
class TextUtil {
public:
- static LayoutUnit width(const InlineBox&, unsigned from, unsigned to, LayoutUnit contentLogicalLeft);
+ static LayoutUnit width(const Box&, unsigned from, unsigned to, LayoutUnit contentLogicalLeft);
static Optional<unsigned> hyphenPositionBefore(const InlineItem&, unsigned from, unsigned length);
static bool isTrimmableContent(const InlineItem&);
struct SplitData {
@@ -44,7 +42,7 @@
unsigned length { 0 };
LayoutUnit logicalWidth;
};
- static SplitData split(const InlineBox&, unsigned startPosition, unsigned length, LayoutUnit textWidth, LayoutUnit availableWidth, LayoutUnit contentLogicalLeft);
+ static SplitData split(const Box&, unsigned startPosition, unsigned length, LayoutUnit textWidth, LayoutUnit availableWidth, LayoutUnit contentLogicalLeft);
private:
static LayoutUnit fixedPitchWidth(String, const RenderStyle&, unsigned from, unsigned to, LayoutUnit contentLogicalLeft);
Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp (248199 => 248200)
--- trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp 2019-08-03 16:09:47 UTC (rev 248200)
@@ -41,9 +41,10 @@
: m_style(WTFMove(style))
, m_elementAttributes(attributes)
, m_baseTypeFlags(baseTypeFlags)
+ , m_hasRareData(false)
{
if (isReplaced())
- m_replaced = std::make_unique<Replaced>(*this);
+ ensureRareData().replaced = std::make_unique<Replaced>(*this);
}
Box::Box(Optional<ElementAttributes> attributes, RenderStyle&& style)
@@ -51,8 +52,15 @@
{
}
+Box::Box(String textContent, RenderStyle&& style)
+ : Box({ }, WTFMove(style), BaseTypeFlag::BoxFlag)
+{
+ setTextContent(textContent);
+}
+
Box::~Box()
{
+ removeRareData();
}
bool Box::establishesFormattingContext() const
@@ -212,7 +220,7 @@
// While the relatively positioned inline container (span) is placed relative to its containing block "outer", it lives in the inline
// formatting context established by "inner".
const Container* ancestor = nullptr;
- if (isInlineBox() && isInFlowPositioned())
+ if (isInlineLevelBox() && isInFlowPositioned())
ancestor = parent();
else
ancestor = containingBlock();
@@ -359,7 +367,65 @@
&& elementType != ElementType::TableColumn;
}
+void Box::setTextContent(String textContent)
+{
+ ASSERT(isInlineLevelBox());
+ ensureRareData().textContent = textContent;
}
+
+bool Box::hasTextContent() const
+{
+ ASSERT(isInlineLevelBox());
+ return hasRareData() && !rareData().textContent.isNull();
}
+String Box::textContent() const
+{
+ ASSERT(hasRareData());
+ ASSERT(isInlineLevelBox());
+ return rareData().textContent;
+}
+
+const Replaced* Box::replaced() const
+{
+ return const_cast<Box*>(this)->replaced();
+}
+
+Replaced* Box::replaced()
+{
+ if (!isReplaced()) {
+ ASSERT(!hasRareData() || !rareData().replaced.get());
+ return nullptr;
+ }
+ ASSERT(hasRareData() && rareData().replaced.get());
+ return rareData().replaced.get();
+}
+
+Box::RareDataMap& Box::rareDataMap()
+{
+ static NeverDestroyed<RareDataMap> map;
+ return map;
+}
+
+const Box::BoxRareData& Box::rareData() const
+{
+ ASSERT(hasRareData());
+ return *rareDataMap().get(this);
+}
+
+Box::BoxRareData& Box::ensureRareData()
+{
+ setHasRareData(true);
+ return *rareDataMap().ensure(this, [] { return std::make_unique<BoxRareData>(); }).iterator->value;
+}
+
+void Box::removeRareData()
+{
+ rareDataMap().remove(this);
+ setHasRareData(false);
+}
+
+}
+}
+
#endif
Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.h (248199 => 248200)
--- trunk/Source/WebCore/layout/layouttree/LayoutBox.h 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.h 2019-08-03 16:09:47 UTC (rev 248200)
@@ -55,6 +55,7 @@
TableFooterGroup,
Image,
IFrame,
+ HardLineBreak,
GenericElement
};
@@ -64,13 +65,12 @@
enum BaseTypeFlag {
BoxFlag = 1 << 0,
- ContainerFlag = 1 << 1,
- InlineBoxFlag = 1 << 3,
- LineBreakBoxFlag = 1 << 5
+ ContainerFlag = 1 << 1
};
typedef unsigned BaseTypeFlags;
Box(Optional<ElementAttributes>, RenderStyle&&);
+ Box(String textContent, RenderStyle&&);
virtual ~Box();
bool establishesFormattingContext() const;
@@ -121,6 +121,7 @@
bool isReplaced() const { return isImage() || isIFrame(); }
bool isIFrame() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::IFrame; }
bool isImage() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::Image; }
+ bool isLineBreakBox() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::HardLineBreak; }
const Container* parent() const { return m_parent; }
const Box* nextSibling() const { return m_nextSibling; }
@@ -134,17 +135,16 @@
bool isBlockContainer() const { return isBlockLevelBox() && isContainer(); }
bool isInlineContainer() const { return isInlineLevelBox() && isContainer(); }
- bool isInlineBox() const { return m_baseTypeFlags & InlineBoxFlag; }
- bool isLineBreakBox() const { return m_baseTypeFlags & LineBreakBoxFlag; }
-
bool isPaddingApplicable() const;
bool isOverflowVisible() const;
const RenderStyle& style() const { return m_style; }
- const Replaced* replaced() const { return m_replaced.get(); }
+ const Replaced* replaced() const;
// FIXME: Temporary until after intrinsic size change is tracked by Replaced.
- Replaced* replaced() { return m_replaced.get(); }
+ Replaced* replaced();
+ bool hasTextContent() const;
+ String textContent() const;
void setParent(Container& parent) { m_parent = &parent; }
void setNextSibling(Box& nextSibling) { m_nextSibling = &nextSibling; }
@@ -154,6 +154,27 @@
Box(Optional<ElementAttributes>, RenderStyle&&, BaseTypeFlags);
private:
+ void setTextContent(String);
+
+ class BoxRareData {
+ WTF_MAKE_FAST_ALLOCATED;
+ public:
+ BoxRareData() = default;
+
+ String textContent;
+ std::unique_ptr<Replaced> replaced;
+ };
+
+ bool hasRareData() const { return m_hasRareData; }
+ void setHasRareData(bool hasRareData) { m_hasRareData = hasRareData; }
+ const BoxRareData& rareData() const;
+ BoxRareData& ensureRareData();
+ void removeRareData();
+
+ typedef HashMap<const Box*, std::unique_ptr<BoxRareData>> RareDataMap;
+
+ static RareDataMap& rareDataMap();
+
RenderStyle m_style;
Optional<ElementAttributes> m_elementAttributes;
@@ -161,9 +182,8 @@
Box* m_previousSibling { nullptr };
Box* m_nextSibling { nullptr };
- std::unique_ptr<Replaced> m_replaced;
-
unsigned m_baseTypeFlags : 6;
+ bool m_hasRareData : 1;
};
}
Modified: trunk/Source/WebCore/layout/layouttree/LayoutContainer.h (248199 => 248200)
--- trunk/Source/WebCore/layout/layouttree/LayoutContainer.h 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Source/WebCore/layout/layouttree/LayoutContainer.h 2019-08-03 16:09:47 UTC (rev 248200)
@@ -37,7 +37,7 @@
namespace Layout {
-class Container : public Box {
+class Container final : public Box {
WTF_MAKE_ISO_ALLOCATED(Container);
public:
Container(Optional<ElementAttributes>, RenderStyle&&, BaseTypeFlags = ContainerFlag);
Deleted: trunk/Source/WebCore/layout/layouttree/LayoutInlineBox.cpp (248199 => 248200)
--- trunk/Source/WebCore/layout/layouttree/LayoutInlineBox.cpp 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Source/WebCore/layout/layouttree/LayoutInlineBox.cpp 2019-08-03 16:09:47 UTC (rev 248200)
@@ -1,47 +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 "LayoutInlineBox.h"
-
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-
-#include "RenderStyle.h"
-#include <wtf/IsoMallocInlines.h>
-
-namespace WebCore {
-namespace Layout {
-
-WTF_MAKE_ISO_ALLOCATED_IMPL(InlineBox);
-
-InlineBox::InlineBox(Optional<ElementAttributes> attributes, RenderStyle&& style, BaseTypeFlags baseTypeFlags)
- : Box(attributes, WTFMove(style), baseTypeFlags | InlineBoxFlag)
-{
-}
-
-}
-}
-
-#endif
Deleted: trunk/Source/WebCore/layout/layouttree/LayoutInlineBox.h (248199 => 248200)
--- trunk/Source/WebCore/layout/layouttree/LayoutInlineBox.h 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Source/WebCore/layout/layouttree/LayoutInlineBox.h 2019-08-03 16:09:47 UTC (rev 248200)
@@ -1,57 +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.
- */
-
-#pragma once
-
-#include "LayoutBox.h"
-#include <wtf/IsoMalloc.h>
-
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-
-namespace WebCore {
-
-class RenderStyle;
-
-namespace Layout {
-
-class InlineBox : public Box {
- WTF_MAKE_ISO_ALLOCATED(InlineBox);
-public:
- InlineBox(Optional<ElementAttributes>, RenderStyle&&, BaseTypeFlags = InlineBoxFlag);
-
- void setTextContent(String text) { m_textContent = text; }
- bool hasTextContent() const { return !m_textContent.isNull(); }
- String textContent() const { return m_textContent; }
-
-private:
- String m_textContent;
-};
-
-}
-}
-
-SPECIALIZE_TYPE_TRAITS_LAYOUT_BOX(InlineBox, isInlineBox())
-
-#endif
Deleted: trunk/Source/WebCore/layout/layouttree/LayoutLineBreakBox.cpp (248199 => 248200)
--- trunk/Source/WebCore/layout/layouttree/LayoutLineBreakBox.cpp 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Source/WebCore/layout/layouttree/LayoutLineBreakBox.cpp 2019-08-03 16:09:47 UTC (rev 248200)
@@ -1,46 +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 "LayoutLineBreakBox.h"
-
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-
-#include "RenderStyle.h"
-#include <wtf/IsoMallocInlines.h>
-
-namespace WebCore {
-namespace Layout {
-
-WTF_MAKE_ISO_ALLOCATED_IMPL(LineBreakBox);
-
-LineBreakBox::LineBreakBox(Optional<ElementAttributes> attributes, RenderStyle&& style)
- : InlineBox(attributes, WTFMove(style), LineBreakBoxFlag)
-{
-}
-
-}
-}
-#endif
Deleted: trunk/Source/WebCore/layout/layouttree/LayoutLineBreakBox.h (248199 => 248200)
--- trunk/Source/WebCore/layout/layouttree/LayoutLineBreakBox.h 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Source/WebCore/layout/layouttree/LayoutLineBreakBox.h 2019-08-03 16:09:47 UTC (rev 248200)
@@ -1,50 +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.
- */
-
-#pragma once
-
-#include "LayoutInlineBox.h"
-#include <wtf/IsoMalloc.h>
-
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-
-namespace WebCore {
-
-class RenderStyle;
-
-namespace Layout {
-
-class LineBreakBox : public InlineBox {
- WTF_MAKE_ISO_ALLOCATED(LineBreakBox);
-public:
- LineBreakBox(Optional<ElementAttributes>, RenderStyle&&);
-};
-
-}
-}
-
-SPECIALIZE_TYPE_TRAITS_LAYOUT_BOX(LineBreakBox, isLineBreakBox())
-
-#endif
Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (248199 => 248200)
--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp 2019-08-03 16:09:47 UTC (rev 248200)
@@ -35,7 +35,6 @@
#include "LayoutChildIterator.h"
#include "LayoutContainer.h"
#include "LayoutDescendantIterator.h"
-#include "LayoutInlineBox.h"
#include "LayoutState.h"
#include "RenderBlock.h"
#include "RenderChildIterator.h"
@@ -123,6 +122,9 @@
return Box::ElementAttributes { Box::ElementType::Image };
if (element->hasTagName(HTMLNames::iframeTag))
return Box::ElementAttributes { Box::ElementType::IFrame };
+ // FIXME wbr should not be considered as hard linebreak.
+ if (element->hasTagName(HTMLNames::brTag) || element->hasTagName(HTMLNames::wbrTag))
+ return Box::ElementAttributes { Box::ElementType::HardLineBreak };
return Box::ElementAttributes { Box::ElementType::GenericElement };
}
return WTF::nullopt;
@@ -132,10 +134,9 @@
if (is<RenderText>(childRenderer)) {
// FIXME: Clearly there must be a helper function for this.
if (parentRenderer.style().display() == DisplayType::Inline)
- childLayoutBox = std::make_unique<InlineBox>(Optional<Box::ElementAttributes>(), RenderStyle::clone(parentRenderer.style()));
+ childLayoutBox = std::make_unique<Box>(downcast<RenderText>(childRenderer).originalText(), RenderStyle::clone(parentRenderer.style()));
else
- childLayoutBox = std::make_unique<InlineBox>(Optional<Box::ElementAttributes>(), RenderStyle::createAnonymousStyleWithDisplay(parentRenderer.style(), DisplayType::Inline));
- downcast<InlineBox>(*childLayoutBox).setTextContent(downcast<RenderText>(childRenderer).originalText());
+ childLayoutBox = std::make_unique<Box>(downcast<RenderText>(childRenderer).originalText(), RenderStyle::createAnonymousStyleWithDisplay(parentRenderer.style(), DisplayType::Inline));
return childLayoutBox;
}
@@ -142,7 +143,7 @@
auto& renderer = downcast<RenderElement>(childRenderer);
auto displayType = renderer.style().display();
if (is<RenderLineBreak>(renderer))
- return std::make_unique<LineBreakBox>(elementAttributes(renderer), RenderStyle::clone(renderer.style()));
+ return std::make_unique<Box>(elementAttributes(renderer), RenderStyle::clone(renderer.style()));
if (is<RenderTable>(renderer)) {
// Construct the principal table wrapper box (and not the table box itself).
@@ -151,7 +152,7 @@
if (displayType == DisplayType::Block)
childLayoutBox = std::make_unique<Box>(elementAttributes(renderer), RenderStyle::clone(renderer.style()));
else
- childLayoutBox = std::make_unique<InlineBox>(elementAttributes(renderer), RenderStyle::clone(renderer.style()));
+ childLayoutBox = std::make_unique<Box>(elementAttributes(renderer), RenderStyle::clone(renderer.style()));
// FIXME: We don't yet support all replaced elements and this is temporary anyway.
if (childLayoutBox->replaced())
childLayoutBox->replaced()->setIntrinsicSize(downcast<RenderReplaced>(renderer).intrinsicSize());
@@ -290,7 +291,7 @@
stream << "IMG replaced inline box";
else if (layoutBox.isAnonymous())
stream << "anonymous inline box";
- else if (is<LineBreakBox>(layoutBox))
+ else if (layoutBox.isLineBreakBox())
stream << "BR line break";
else
stream << "inline box";
@@ -303,8 +304,8 @@
if (displayBox)
stream << " at (" << displayBox->left() << "," << displayBox->top() << ") size " << displayBox->width() << "x" << displayBox->height();
stream << " layout box->(" << &layoutBox << ")";
- if (is<InlineBox>(layoutBox) && downcast<InlineBox>(layoutBox).hasTextContent())
- stream << " text content [\"" << downcast<InlineBox>(layoutBox).textContent().utf8().data() << "\"]";
+ if (layoutBox.isInlineLevelBox() && layoutBox.isAnonymous())
+ stream << " text content [\"" << layoutBox.textContent().utf8().data() << "\"]";
stream.nextLine();
}
Modified: trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt (248199 => 248200)
--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt 2019-08-03 14:01:20 UTC (rev 248199)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt 2019-08-03 16:09:47 UTC (rev 248200)
@@ -940,7 +940,6 @@
fast/text/user-installed-fonts/shadow-postscript-family.html
fast/text/user-installed-fonts/shadow-postscript.html
fast/text/user-installed-fonts/shadow.html
-fast/text/user-installed-fonts/system-ui.html
fast/text/variations/advances.html
fast/text/variations/calc.html
fast/text/variations/case-axis-names.html
@@ -1530,8 +1529,6 @@
css2.1/tables/table-anonymous-objects-122.xht
css3/autoclose-braces-and-parentheses.html
css3/calculated-word-spacing.html
-css3/css3-modsel-36.html
-css3/css3-modsel-37.html
css3/css-variable-definition.html
css3/font-feature-settings-calc.html
css3/font-feature-settings-font-face-rendering.html