Diff
Modified: trunk/Source/WebCore/ChangeLog (287446 => 287447)
--- trunk/Source/WebCore/ChangeLog 2021-12-26 18:47:26 UTC (rev 287446)
+++ trunk/Source/WebCore/ChangeLog 2021-12-26 19:24:52 UTC (rev 287447)
@@ -1,3 +1,33 @@
+2021-12-26 Alan Bujtas <[email protected]>
+
+ [IFC][Integration] Update text renderer's needsVisualReordering bit
+ https://bugs.webkit.org/show_bug.cgi?id=234688
+
+ Reviewed by Antti Koivisto.
+
+ This is similar to legacy line layout where the RenderText's needsVisualReordering is
+ updated as the (bidi) text box is being placed on the line.
+ Here we update this bit right after the line layout, when we finished constructing the display boxes.
+
+ * layout/formattingContexts/inline/InlineItemsBuilder.cpp:
+ (WebCore::Layout::InlineItemsBuilder::handleTextContent):
+ * layout/integration/LayoutIntegrationBoxTree.cpp:
+ (WebCore::LayoutIntegration::BoxTree::buildTree):
+ * layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
+ (WebCore::LayoutIntegration::InlineContentBuilder::InlineContentBuilder):
+ (WebCore::LayoutIntegration::InlineContentBuilder::build const):
+ * layout/integration/LayoutIntegrationInlineContentBuilder.h:
+ * layout/layouttree/LayoutInlineTextBox.cpp:
+ (WebCore::Layout::InlineTextBox::InlineTextBox):
+ (WebCore::Layout::m_canUseSimplifiedContentMeasuring):
+ (WebCore::Layout::m_containsBidiText): Deleted.
+ * layout/layouttree/LayoutInlineTextBox.h:
+ (WebCore::Layout::InlineTextBox::canUseSimplifiedContentMeasuring const):
+ (WebCore::Layout::InlineTextBox::containsBidiText const): Deleted. No need to cache this value on the layout box
+ InlineTextItems more or less have the same lifecycle as their associated layout boxes.
+ * layout/layouttree/LayoutTreeBuilder.cpp:
+ (WebCore::Layout::TreeBuilder::createTextBox):
+
2021-12-26 Tim Nguyen <[email protected]>
Update writing-mode property values in CSSProperties.json
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp (287446 => 287447)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp 2021-12-26 18:47:26 UTC (rev 287446)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp 2021-12-26 19:24:52 UTC (rev 287447)
@@ -452,7 +452,7 @@
if (!contentLength)
return inlineItems.append(InlineTextItem::createEmptyItem(inlineTextBox));
- m_needsVisualReordering = m_needsVisualReordering || inlineTextBox.containsBidiText();
+ m_needsVisualReordering = m_needsVisualReordering || TextUtil::containsStrongDirectionalityText(text);
auto& style = inlineTextBox.style();
auto shouldPreserveSpacesAndTabs = TextUtil::shouldPreserveSpacesAndTabs(inlineTextBox);
auto shouldPreserveNewline = TextUtil::shouldPreserveNewline(inlineTextBox);
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp (287446 => 287447)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp 2021-12-26 18:47:26 UTC (rev 287446)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp 2021-12-26 19:24:52 UTC (rev 287447)
@@ -97,11 +97,8 @@
auto& textRenderer = downcast<RenderText>(childRenderer);
auto style = RenderStyle::createAnonymousStyleWithDisplay(textRenderer.style(), DisplayType::Inline);
auto text = style.textSecurity() == TextSecurity::None ? textRenderer.text() : RenderBlock::updateSecurityDiscCharacters(style, textRenderer.text());
- auto containsBidiText = Layout::TextUtil::containsStrongDirectionalityText(text);
- if (containsBidiText)
- textRenderer.setNeedsVisualReordering();
auto useSimplifiedTextMeasuring = textRenderer.canUseSimplifiedTextMeasuring() && (!firstLineStyle || firstLineStyle->fontCascade() == style.fontCascade());
- return makeUnique<Layout::InlineTextBox>(text, useSimplifiedTextMeasuring, containsBidiText, WTFMove(style), WTFMove(firstLineStyle));
+ return makeUnique<Layout::InlineTextBox>(text, useSimplifiedTextMeasuring, WTFMove(style), WTFMove(firstLineStyle));
}
auto style = RenderStyle::clone(childRenderer.style());
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp (287446 => 287447)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp 2021-12-26 18:47:26 UTC (rev 287446)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp 2021-12-26 19:24:52 UTC (rev 287447)
@@ -57,7 +57,7 @@
return lineContentWidth + endPadding;
}
-InlineContentBuilder::InlineContentBuilder(const RenderBlockFlow& blockFlow, const BoxTree& boxTree)
+InlineContentBuilder::InlineContentBuilder(const RenderBlockFlow& blockFlow, BoxTree& boxTree)
: m_blockFlow(blockFlow)
, m_boxTree(boxTree)
{
@@ -67,6 +67,18 @@
{
// FIXME: This might need a different approach with partial layout where the layout code needs to know about the boxes.
inlineContent.boxes = WTFMove(inlineFormattingState.boxes());
+
+ auto updateIfTextRenderersNeedVisualReordering = [&] {
+ // FIXME: We may want to have a global, "is this a bidi paragraph" flag to avoid this loop for non-rtl, non-bidi content.
+ for (auto& displayBox : inlineContent.boxes) {
+ auto& layoutBox = displayBox.layoutBox();
+ if (!is<Layout::InlineTextBox>(layoutBox))
+ continue;
+ if (displayBox.bidiLevel() != UBIDI_DEFAULT_LTR)
+ downcast<RenderText>(m_boxTree.rendererForLayoutBox(layoutBox)).setNeedsVisualReordering();
+ }
+ };
+ updateIfTextRenderersNeedVisualReordering();
createDisplayLines(inlineFormattingState, inlineContent);
}
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.h (287446 => 287447)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.h 2021-12-26 18:47:26 UTC (rev 287446)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.h 2021-12-26 19:24:52 UTC (rev 287447)
@@ -41,7 +41,7 @@
class InlineContentBuilder {
public:
- InlineContentBuilder(const RenderBlockFlow&, const BoxTree&);
+ InlineContentBuilder(const RenderBlockFlow&, BoxTree&);
void build(Layout::InlineFormattingState&, InlineContent&) const;
@@ -49,7 +49,7 @@
void createDisplayLines(Layout::InlineFormattingState&, InlineContent&) const;
const RenderBlockFlow& m_blockFlow;
- const BoxTree& m_boxTree;
+ BoxTree& m_boxTree;
};
}
Modified: trunk/Source/WebCore/layout/layouttree/LayoutInlineTextBox.cpp (287446 => 287447)
--- trunk/Source/WebCore/layout/layouttree/LayoutInlineTextBox.cpp 2021-12-26 18:47:26 UTC (rev 287446)
+++ trunk/Source/WebCore/layout/layouttree/LayoutInlineTextBox.cpp 2021-12-26 19:24:52 UTC (rev 287447)
@@ -36,11 +36,10 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(InlineTextBox);
-InlineTextBox::InlineTextBox(String content, bool canUseSimplifiedContentMeasuring, bool containsBidiText, RenderStyle&& style, std::unique_ptr<RenderStyle>&& firstLineStyle)
+InlineTextBox::InlineTextBox(String content, bool canUseSimplifiedContentMeasuring, RenderStyle&& style, std::unique_ptr<RenderStyle>&& firstLineStyle)
: Box({ }, WTFMove(style), WTFMove(firstLineStyle), Box::InlineTextBoxFlag)
, m_content(content)
, m_canUseSimplifiedContentMeasuring(canUseSimplifiedContentMeasuring)
- , m_containsBidiText(containsBidiText)
{
setIsAnonymous();
}
Modified: trunk/Source/WebCore/layout/layouttree/LayoutInlineTextBox.h (287446 => 287447)
--- trunk/Source/WebCore/layout/layouttree/LayoutInlineTextBox.h 2021-12-26 18:47:26 UTC (rev 287446)
+++ trunk/Source/WebCore/layout/layouttree/LayoutInlineTextBox.h 2021-12-26 19:24:52 UTC (rev 287447)
@@ -37,18 +37,16 @@
class InlineTextBox : public Box {
WTF_MAKE_ISO_ALLOCATED(InlineTextBox);
public:
- InlineTextBox(String, bool canUseSimplifiedContentMeasuring, bool containsBidiText, RenderStyle&&, std::unique_ptr<RenderStyle>&& firstLineStyle = nullptr);
+ InlineTextBox(String, bool canUseSimplifiedContentMeasuring, RenderStyle&&, std::unique_ptr<RenderStyle>&& firstLineStyle = nullptr);
virtual ~InlineTextBox() = default;
String content() const { return m_content; }
// FIXME: This should not be a box's property.
bool canUseSimplifiedContentMeasuring() const { return m_canUseSimplifiedContentMeasuring; }
- bool containsBidiText() const { return m_containsBidiText; }
private:
String m_content;
bool m_canUseSimplifiedContentMeasuring { false };
- bool m_containsBidiText { false };
};
}
Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (287446 => 287447)
--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp 2021-12-26 18:47:26 UTC (rev 287446)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp 2021-12-26 19:24:52 UTC (rev 287447)
@@ -134,7 +134,7 @@
std::unique_ptr<Box> TreeBuilder::createTextBox(String text, bool canUseSimplifiedTextMeasuring, RenderStyle&& style)
{
- return makeUnique<InlineTextBox>(text, canUseSimplifiedTextMeasuring, TextUtil::containsStrongDirectionalityText(text), WTFMove(style));
+ return makeUnique<InlineTextBox>(text, canUseSimplifiedTextMeasuring, WTFMove(style));
}
std::unique_ptr<Box> TreeBuilder::createLineBreakBox(bool isOptional, RenderStyle&& style)