Title: [267962] trunk/Source/WebCore
Revision
267962
Author
an...@apple.com
Date
2020-10-05 07:39:03 -0700 (Mon, 05 Oct 2020)

Log Message

[LFC][Integration] Avoid ensureLineBoxes for some call sites of inlineBoxAndOffset
https://bugs.webkit.org/show_bug.cgi?id=217225

Reviewed by Zalan Bujtas.

Separate inlineRunAndOffset from inlineBoxAndOffset.
The formet returns iterator while the later forces the legacy path.

Use inlineRunAndOffset in a few places.

* dom/Position.cpp:
(WebCore::Position::rendersInDifferentPosition const):
(WebCore::Position::inlineRunAndOffset const):
(WebCore::Position::inlineBoxAndOffset const):
(WebCore::Position::ensureLineBoxes const):
(WebCore::InlineBoxAndOffset::InlineBoxAndOffset): Deleted.
* dom/Position.h:
(WebCore::InlineBoxAndOffset::InlineBoxAndOffset):
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::directionOfSelection):
* editing/VisiblePosition.h:
(WebCore::VisiblePosition::inlineRunAndOffset const):
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForFontAndText):
* layout/integration/LayoutIntegrationRunIterator.h:
(WebCore::LayoutIntegration::Run::onSameLine const):
* layout/integration/LayoutIntegrationRunIteratorLegacyPath.h:
(WebCore::LayoutIntegration::LegacyPath::onSameLine const):
(WebCore::LayoutIntegration::LegacyPath::atEnd const):
* layout/integration/LayoutIntegrationRunIteratorModernPath.h:
(WebCore::LayoutIntegration::ModernPath::onSameLine const):
(WebCore::LayoutIntegration::ModernPath::atEnd const):
* platform/DragImage.cpp:
* rendering/RenderTextLineBoxes.h:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (267961 => 267962)


--- trunk/Source/WebCore/ChangeLog	2020-10-05 14:35:00 UTC (rev 267961)
+++ trunk/Source/WebCore/ChangeLog	2020-10-05 14:39:03 UTC (rev 267962)
@@ -1,3 +1,40 @@
+2020-10-05  Antti Koivisto  <an...@apple.com>
+
+        [LFC][Integration] Avoid ensureLineBoxes for some call sites of inlineBoxAndOffset
+        https://bugs.webkit.org/show_bug.cgi?id=217225
+
+        Reviewed by Zalan Bujtas.
+
+        Separate inlineRunAndOffset from inlineBoxAndOffset.
+        The formet returns iterator while the later forces the legacy path.
+
+        Use inlineRunAndOffset in a few places.
+
+        * dom/Position.cpp:
+        (WebCore::Position::rendersInDifferentPosition const):
+        (WebCore::Position::inlineRunAndOffset const):
+        (WebCore::Position::inlineBoxAndOffset const):
+        (WebCore::Position::ensureLineBoxes const):
+        (WebCore::InlineBoxAndOffset::InlineBoxAndOffset): Deleted.
+        * dom/Position.h:
+        (WebCore::InlineBoxAndOffset::InlineBoxAndOffset):
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::directionOfSelection):
+        * editing/VisiblePosition.h:
+        (WebCore::VisiblePosition::inlineRunAndOffset const):
+        * layout/integration/LayoutIntegrationCoverage.cpp:
+        (WebCore::LayoutIntegration::canUseForFontAndText):
+        * layout/integration/LayoutIntegrationRunIterator.h:
+        (WebCore::LayoutIntegration::Run::onSameLine const):
+        * layout/integration/LayoutIntegrationRunIteratorLegacyPath.h:
+        (WebCore::LayoutIntegration::LegacyPath::onSameLine const):
+        (WebCore::LayoutIntegration::LegacyPath::atEnd const):
+        * layout/integration/LayoutIntegrationRunIteratorModernPath.h:
+        (WebCore::LayoutIntegration::ModernPath::onSameLine const):
+        (WebCore::LayoutIntegration::ModernPath::atEnd const):
+        * platform/DragImage.cpp:
+        * rendering/RenderTextLineBoxes.h:
+
 2020-10-05  Rob Buis  <rb...@igalia.com>
 
         Make xhr.response more conforming to the specification

Modified: trunk/Source/WebCore/Headers.cmake (267961 => 267962)


--- trunk/Source/WebCore/Headers.cmake	2020-10-05 14:35:00 UTC (rev 267961)
+++ trunk/Source/WebCore/Headers.cmake	2020-10-05 14:39:03 UTC (rev 267962)
@@ -526,6 +526,7 @@
     editing/FontShadow.h
     editing/FrameSelection.h
     editing/HTMLInterchange.h
+    editing/InlineRunAndOffset.h
     editing/SelectionRectGatherer.h
     editing/SerializedAttachmentData.h
     editing/SmartReplace.h

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (267961 => 267962)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-10-05 14:35:00 UTC (rev 267961)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-10-05 14:39:03 UTC (rev 267962)
@@ -5078,6 +5078,7 @@
 		E4C3B1FA0F0E4161009693F6 /* LegacyTileCache.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C3B1F90F0E4161009693F6 /* LegacyTileCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E4C91A0E1802343100A17F6D /* TextPaintStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C91A0D1802343100A17F6D /* TextPaintStyle.h */; };
 		E4C91A16180999F100A17F6D /* RenderTextLineBoxes.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C91A15180999F100A17F6D /* RenderTextLineBoxes.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		E4D33F3B252AEECD00837D05 /* InlineRunAndOffset.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D33F39252AEECC00837D05 /* InlineRunAndOffset.h */; };
 		E4D58EB517B4DBDC00CBDCA8 /* StyleResolveForDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D58EB317B4DBDC00CBDCA8 /* StyleResolveForDocument.h */; };
 		E4D58EB917B4ED8900CBDCA8 /* StyleFontSizeFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D58EB717B4ED8900CBDCA8 /* StyleFontSizeFunctions.h */; };
 		E4D58EBB17B8F12800CBDCA8 /* ElementTraversal.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D58EBA17B8F12800CBDCA8 /* ElementTraversal.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -16062,6 +16063,7 @@
 		E4C91A0F1802343900A17F6D /* TextPaintStyle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextPaintStyle.cpp; sourceTree = "<group>"; };
 		E4C91A15180999F100A17F6D /* RenderTextLineBoxes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderTextLineBoxes.h; sourceTree = "<group>"; };
 		E4C91A17180999FB00A17F6D /* RenderTextLineBoxes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTextLineBoxes.cpp; sourceTree = "<group>"; };
+		E4D33F39252AEECC00837D05 /* InlineRunAndOffset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineRunAndOffset.h; sourceTree = "<group>"; };
 		E4D58EB217B4DBDC00CBDCA8 /* StyleResolveForDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleResolveForDocument.cpp; sourceTree = "<group>"; };
 		E4D58EB317B4DBDC00CBDCA8 /* StyleResolveForDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleResolveForDocument.h; sourceTree = "<group>"; };
 		E4D58EB617B4ED8900CBDCA8 /* StyleFontSizeFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleFontSizeFunctions.cpp; sourceTree = "<group>"; };
@@ -22631,6 +22633,7 @@
 				93309D97099E64910056E581 /* HTMLInterchange.h */,
 				DB23C2C90A508D29002489EB /* IndentOutdentCommand.cpp */,
 				DB23C2CA0A508D29002489EB /* IndentOutdentCommand.h */,
+				E4D33F39252AEECC00837D05 /* InlineRunAndOffset.h */,
 				93309D9A099E64910056E581 /* InsertIntoTextNodeCommand.cpp */,
 				93309D9B099E64910056E581 /* InsertIntoTextNodeCommand.h */,
 				93309D9C099E64910056E581 /* InsertLineBreakCommand.cpp */,
@@ -34754,6 +34757,7 @@
 				E1EE8B992413195000E794D6 /* XRInputSourcesChangeEvent.h in Headers */,
 				E12A9F4A248A99E2003F06C8 /* XRInteractionMode.h in Headers */,
 				E1EE8B842413191F00E794D6 /* XRReferenceSpaceEvent.h in Headers */,
+				E4D33F3B252AEECD00837D05 /* InlineRunAndOffset.h in Headers */,
 				E1EE8B772413191F00E794D6 /* XRReferenceSpaceType.h in Headers */,
 				E1EE8B792413191F00E794D6 /* XRRenderStateInit.h in Headers */,
 				E1EE8B8D2413195000E794D6 /* XRSessionEvent.h in Headers */,

Modified: trunk/Source/WebCore/dom/Position.cpp (267961 => 267962)


--- trunk/Source/WebCore/dom/Position.cpp	2020-10-05 14:35:00 UTC (rev 267961)
+++ trunk/Source/WebCore/dom/Position.cpp	2020-10-05 14:39:03 UTC (rev 267962)
@@ -37,6 +37,7 @@
 #include "HTMLTableElement.h"
 #include "InlineElementBox.h"
 #include "InlineIterator.h"
+#include "InlineRunAndOffset.h"
 #include "InlineTextBox.h"
 #include "LayoutIntegrationRunIterator.h"
 #include "Logging.h"
@@ -101,9 +102,9 @@
     return nullptr;
 }
 
-InlineBoxAndOffset::InlineBoxAndOffset(LayoutIntegration::RunIterator run, unsigned offset)
-    : box(run ? run->legacyInlineBox() : nullptr)
-    , offset(offset)
+InlineBoxAndOffset::InlineBoxAndOffset(InlineRunAndOffset runAndOffset)
+    : box(runAndOffset.run ? runAndOffset.run->legacyInlineBox() : nullptr)
+    , offset(runAndOffset.offset)
 {
 }
 
@@ -1071,21 +1072,21 @@
     if (renderer == positionRenderer && thisRenderedOffset == positionRenderedOffset)
         return false;
 
-    auto b1 = inlineBoxAndOffset(Affinity::Downstream).box;
-    auto b2 = position.inlineBoxAndOffset(Affinity::Downstream).box;
+    auto run1 = inlineRunAndOffset(Affinity::Downstream).run;
+    auto run2 = position.inlineRunAndOffset(Affinity::Downstream).run;
 
-    LOG(Editing, "renderer:               %p [%p]\n", renderer, b1);
+    LOG(Editing, "renderer:               %p\n", renderer);
     LOG(Editing, "thisRenderedOffset:         %d\n", thisRenderedOffset);
-    LOG(Editing, "posRenderer:            %p [%p]\n", positionRenderer, b2);
+    LOG(Editing, "posRenderer:            %p\n", positionRenderer);
     LOG(Editing, "posRenderedOffset:      %d\n", positionRenderedOffset);
     LOG(Editing, "node min/max:           %d:%d\n", caretMinOffset(*deprecatedNode()), caretMaxOffset(*deprecatedNode()));
     LOG(Editing, "pos node min/max:       %d:%d\n", caretMinOffset(*position.deprecatedNode()), caretMaxOffset(*position.deprecatedNode()));
     LOG(Editing, "----------------------------------------------------------------------\n");
 
-    if (!b1 || !b2)
+    if (!run1 || !run2)
         return false;
 
-    if (&b1->root() != &b2->root())
+    if (!run1->onSameLine(*run2))
         return true;
 
     if (nextRenderedEditable(deprecatedNode()) == position.deprecatedNode()
@@ -1140,9 +1141,9 @@
     return { };
 }
 
-InlineBoxAndOffset Position::inlineBoxAndOffset(Affinity affinity) const
+InlineRunAndOffset Position::inlineRunAndOffset(Affinity affinity) const
 {
-    return inlineBoxAndOffset(affinity, primaryDirection());
+    return inlineRunAndOffset(affinity, primaryDirection());
 }
 
 static bool isNonTextLeafChild(RenderObject& object)
@@ -1191,7 +1192,7 @@
     return position;
 }
 
-InlineBoxAndOffset Position::inlineBoxAndOffset(Affinity affinity, TextDirection primaryDirection) const
+InlineRunAndOffset Position::inlineRunAndOffset(Affinity affinity, TextDirection primaryDirection) const
 {
     auto caretOffset = static_cast<unsigned>(deprecatedEditingOffset());
 
@@ -1206,12 +1207,10 @@
 
     if (renderer->isBR()) {
         auto& lineBreakRenderer = downcast<RenderLineBreak>(*renderer);
-        lineBreakRenderer.ensureLineBoxes();
         if (!caretOffset)
             run = LayoutIntegration::runFor(lineBreakRenderer);
     } else if (is<RenderText>(*renderer)) {
         auto& textRenderer = downcast<RenderText>(*renderer);
-        textRenderer.ensureLineBoxes();
 
         auto textRun = LayoutIntegration::firstTextRunFor(textRenderer);
         LayoutIntegration::TextRunIterator candidate;
@@ -1261,7 +1260,7 @@
                     return { { }, caretOffset };
             }
 
-            return equivalent.inlineBoxAndOffset(Affinity::Upstream, primaryDirection);
+            return equivalent.inlineRunAndOffset(Affinity::Upstream, primaryDirection);
         }
         if (is<RenderBox>(*renderer)) {
             run = LayoutIntegration::runFor(downcast<RenderBox>(*renderer));
@@ -1369,6 +1368,35 @@
     return { run, caretOffset };
 }
 
+InlineBoxAndOffset Position::inlineBoxAndOffset(Affinity affinity) const
+{
+    return inlineBoxAndOffset(affinity, primaryDirection());
+}
+
+InlineBoxAndOffset Position::inlineBoxAndOffset(Affinity affinity, TextDirection primaryDirection) const
+{
+    ensureLineBoxes();
+
+    return { inlineRunAndOffset(affinity, primaryDirection) };
+}
+
+void Position::ensureLineBoxes() const
+{
+    auto node = deprecatedNode();
+    if (!node)
+        return;
+    auto renderer = node->renderer();
+    if (!renderer)
+        return;
+
+    if (renderer->isBR()) {
+        downcast<RenderLineBreak>(*renderer).ensureLineBoxes();
+        return;
+    }
+    if (is<RenderText>(*renderer))
+        downcast<RenderText>(*renderer).ensureLineBoxes();
+}
+
 TextDirection Position::primaryDirection() const
 {
     if (!m_anchorNode || !m_anchorNode->renderer())

Modified: trunk/Source/WebCore/dom/Position.h (267961 => 267962)


--- trunk/Source/WebCore/dom/Position.h	2020-10-05 14:35:00 UTC (rev 267961)
+++ trunk/Source/WebCore/dom/Position.h	2020-10-05 14:39:03 UTC (rev 267962)
@@ -43,10 +43,6 @@
 struct BoundaryPoint;
 struct SimpleRange;
 
-namespace LayoutIntegration {
-class RunIterator;
-}
-
 enum PositionMoveType {
     CodePoint,       // Move by a single code point.
     Character,       // Move to the next Unicode character break.
@@ -53,8 +49,10 @@
     BackwardDeletion // Subject to platform conventions.
 };
 
+struct InlineRunAndOffset;
+
 struct InlineBoxAndOffset {
-    InlineBoxAndOffset(LayoutIntegration::RunIterator, unsigned offset);
+    InlineBoxAndOffset(InlineRunAndOffset);
 
     InlineBox* box { nullptr };
     int offset { 0 };
@@ -178,6 +176,9 @@
     bool isRenderedCharacter() const;
     bool rendersInDifferentPosition(const Position&) const;
 
+    InlineRunAndOffset inlineRunAndOffset(Affinity) const;
+    InlineRunAndOffset inlineRunAndOffset(Affinity, TextDirection primaryDirection) const;
+
     InlineBoxAndOffset inlineBoxAndOffset(Affinity) const;
     InlineBoxAndOffset inlineBoxAndOffset(Affinity, TextDirection primaryDirection) const;
 
@@ -219,6 +220,8 @@
     Position previousCharacterPosition(Affinity) const;
     Position nextCharacterPosition(Affinity) const;
 
+    void ensureLineBoxes() const;
+
     static AnchorType anchorTypeForLegacyEditingPosition(Node* anchorNode, unsigned offset);
 
     RefPtr<Node> m_anchorNode;

Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (267961 => 267962)


--- trunk/Source/WebCore/editing/FrameSelection.cpp	2020-10-05 14:35:00 UTC (rev 267961)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp	2020-10-05 14:39:03 UTC (rev 267962)
@@ -52,6 +52,7 @@
 #include "HTMLSelectElement.h"
 #include "HitTestRequest.h"
 #include "HitTestResult.h"
+#include "InlineRunAndOffset.h"
 #include "InlineTextBox.h"
 #include "Logging.h"
 #include "Page.h"
@@ -637,10 +638,10 @@
     // can cause layout, which has the potential to invalidate lineboxes.
     auto startPosition = m_selection.visibleStart();
     auto endPosition = m_selection.visibleEnd();
-    auto startBox = startPosition.inlineBoxAndOffset().box;
-    auto endBox = endPosition.inlineBoxAndOffset().box;
-    if (startBox && endBox && startBox->direction() == endBox->direction())
-        return startBox->direction();
+    auto startRun = startPosition.inlineRunAndOffset().run;
+    auto endRun = endPosition.inlineRunAndOffset().run;
+    if (startRun && endRun && startRun->direction() == endRun->direction())
+        return startRun->direction();
     return directionOfEnclosingBlock();
 }
 

Added: trunk/Source/WebCore/editing/InlineRunAndOffset.h (0 => 267962)


--- trunk/Source/WebCore/editing/InlineRunAndOffset.h	                        (rev 0)
+++ trunk/Source/WebCore/editing/InlineRunAndOffset.h	2020-10-05 14:39:03 UTC (rev 267962)
@@ -0,0 +1,37 @@
+/*
+ * 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
+
+#include "LayoutIntegrationRunIterator.h"
+
+namespace WebCore {
+
+struct InlineRunAndOffset {
+    LayoutIntegration::RunIterator run { };
+    unsigned offset { 0 };
+};
+
+}

Modified: trunk/Source/WebCore/editing/VisiblePosition.cpp (267961 => 267962)


--- trunk/Source/WebCore/editing/VisiblePosition.cpp	2020-10-05 14:35:00 UTC (rev 267961)
+++ trunk/Source/WebCore/editing/VisiblePosition.cpp	2020-10-05 14:39:03 UTC (rev 267962)
@@ -34,6 +34,7 @@
 #include "HTMLElement.h"
 #include "HTMLHtmlElement.h"
 #include "HTMLNames.h"
+#include "InlineRunAndOffset.h"
 #include "InlineTextBox.h"
 #include "Logging.h"
 #include "Range.h"
@@ -621,6 +622,16 @@
     return ch;
 }
 
+InlineRunAndOffset VisiblePosition::inlineRunAndOffset() const
+{
+    return m_deepPosition.inlineRunAndOffset(m_affinity);
+}
+
+InlineRunAndOffset VisiblePosition::inlineRunAndOffset(TextDirection primaryDirection) const
+{
+    return m_deepPosition.inlineRunAndOffset(m_affinity, primaryDirection);
+}
+
 auto VisiblePosition::localCaretRect() const -> LocalCaretRect
 {
     auto node = m_deepPosition.anchorNode();

Modified: trunk/Source/WebCore/editing/VisiblePosition.h (267961 => 267962)


--- trunk/Source/WebCore/editing/VisiblePosition.h	2020-10-05 14:35:00 UTC (rev 267961)
+++ trunk/Source/WebCore/editing/VisiblePosition.h	2020-10-05 14:39:03 UTC (rev 267962)
@@ -67,6 +67,9 @@
     // FIXME: This does not handle [table, 0] correctly.
     Element* rootEditableElement() const { return m_deepPosition.isNotNull() ? m_deepPosition.deprecatedNode()->rootEditableElement() : 0; }
 
+    InlineRunAndOffset inlineRunAndOffset() const;
+    InlineRunAndOffset inlineRunAndOffset(TextDirection primaryDirection) const;
+
     InlineBoxAndOffset inlineBoxAndOffset() const;
     InlineBoxAndOffset inlineBoxAndOffset(TextDirection primaryDirection) const;
 

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp (267961 => 267962)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp	2020-10-05 14:35:00 UTC (rev 267961)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp	2020-10-05 14:39:03 UTC (rev 267962)
@@ -177,7 +177,7 @@
             // No need to check the code path at this point. We already know it can't be simple.
             SET_REASON_AND_RETURN_IF_NEEDED(FlowHasComplexFontCodePath, reasons, includeReasons);
         } else {
-            TextRun run(String(textRenderer.text()));
+            WebCore::TextRun run(String(textRenderer.text()));
             run.setCharacterScanForCodePath(false);
             if (style.fontCascade().codePath(run) != FontCascade::Simple)
                 SET_REASON_AND_RETURN_IF_NEEDED(FlowHasComplexFontCodePath, reasons, includeReasons);

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.h (267961 => 267962)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.h	2020-10-05 14:35:00 UTC (rev 267961)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.h	2020-10-05 14:39:03 UTC (rev 267962)
@@ -73,6 +73,8 @@
     TextDirection direction() const { return bidiLevel() % 2 ? TextDirection::RTL : TextDirection::LTR; }
     bool isLeftToRightDirection() const { return direction() == TextDirection::LTR; }
 
+    bool onSameLine(const Run&) const;
+
     // For intermediate porting steps only.
     InlineBox* legacyInlineBox() const;
 
@@ -269,6 +271,16 @@
     });
 }
 
+inline bool Run::onSameLine(const Run& other) const
+{
+    if (m_pathVariant.index() != other.m_pathVariant.index())
+        return false;
+
+    return WTF::switchOn(m_pathVariant, [&](const auto& path) {
+        return path.onSameLine(WTF::get<std::decay_t<decltype(path)>>(other.m_pathVariant));
+    });
+}
+
 inline InlineBox* Run::legacyInlineBox() const
 {
     return WTF::switchOn(m_pathVariant, [](auto& path) {

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorLegacyPath.h (267961 => 267962)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorLegacyPath.h	2020-10-05 14:35:00 UTC (rev 267961)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorLegacyPath.h	2020-10-05 14:39:03 UTC (rev 267962)
@@ -91,8 +91,9 @@
     }
 
     bool operator==(const LegacyPath& other) const { return m_inlineBox == other.m_inlineBox; }
+    bool onSameLine(const LegacyPath& other) const { return &m_inlineBox->root() == &other.m_inlineBox->root(); }
+
     bool atEnd() const { return !m_inlineBox; }
-
     void setAtEnd() { m_inlineBox = nullptr; }
 
     InlineBox* legacyInlineBox() const { return const_cast<InlineBox*>(m_inlineBox); }

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h (267961 => 267962)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h	2020-10-05 14:35:00 UTC (rev 267961)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h	2020-10-05 14:39:03 UTC (rev 267962)
@@ -144,8 +144,9 @@
     }
 
     bool operator==(const ModernPath& other) const { return m_inlineContent == other.m_inlineContent && m_runIndex == other.m_runIndex; }
+    bool onSameLine(const ModernPath& other) const { return run().lineIndex() == other.run().lineIndex(); }
+
     bool atEnd() const { return m_runIndex == runs().size() || !run().hasUnderlyingLayout(); }
-
     void setAtEnd() { m_runIndex = runs().size(); }
 
     InlineBox* legacyInlineBox() const

Modified: trunk/Source/WebCore/platform/DragImage.cpp (267961 => 267962)


--- trunk/Source/WebCore/platform/DragImage.cpp	2020-10-05 14:35:00 UTC (rev 267961)
+++ trunk/Source/WebCore/platform/DragImage.cpp	2020-10-05 14:39:03 UTC (rev 267962)
@@ -31,6 +31,7 @@
 #include "FrameView.h"
 #include "ImageBuffer.h"
 #include "NotImplemented.h"
+#include "Position.h"
 #include "RenderElement.h"
 #include "RenderView.h"
 #include "SimpleRange.h"

Modified: trunk/Source/WebCore/rendering/RenderTextLineBoxes.h (267961 => 267962)


--- trunk/Source/WebCore/rendering/RenderTextLineBoxes.h	2020-10-05 14:35:00 UTC (rev 267961)
+++ trunk/Source/WebCore/rendering/RenderTextLineBoxes.h	2020-10-05 14:39:03 UTC (rev 267962)
@@ -27,7 +27,6 @@
 
 #include "LayoutRect.h"
 #include "RenderObject.h"
-#include "VisiblePosition.h"
 
 namespace WebCore {
 
@@ -34,6 +33,7 @@
 class InlineTextBox;
 class RenderStyle;
 class RenderText;
+class VisiblePosition;
 
 class RenderTextLineBoxes {
 public:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to