Title: [291528] trunk/Source/WebCore
Revision
291528
Author
[email protected]
Date
2022-03-19 08:39:53 -0700 (Sat, 19 Mar 2022)

Log Message

[IFC][Integration] Move selection specific code from InlineIterator::Line to LineSelection
https://bugs.webkit.org/show_bug.cgi?id=238083

Reviewed by Antti Koivisto.

* layout/integration/InlineIteratorLine.cpp:
(WebCore::InlineIterator::Line::enclosingTopAdjustedForPrecedingBlock const): Deleted.
(WebCore::InlineIterator::Line::selectionState const): Deleted.
* layout/integration/InlineIteratorLine.h:
(WebCore::InlineIterator::Line::enclosingLogicalRect const): Deleted.
(WebCore::InlineIterator::Line::enclosingPhysicalRect const): Deleted.
* layout/integration/LineSelection.h:
(WebCore::LineSelection::logicalRect):
(WebCore::LineSelection::physicalRect):
(WebCore::LineSelection::logicalTopAdjustedForPrecedingBlock):
(WebCore::LineSelection::selectionState):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (291527 => 291528)


--- trunk/Source/WebCore/ChangeLog	2022-03-19 13:23:57 UTC (rev 291527)
+++ trunk/Source/WebCore/ChangeLog	2022-03-19 15:39:53 UTC (rev 291528)
@@ -1,3 +1,22 @@
+2022-03-19  Alan Bujtas  <[email protected]>
+
+        [IFC][Integration] Move selection specific code from InlineIterator::Line to LineSelection
+        https://bugs.webkit.org/show_bug.cgi?id=238083
+
+        Reviewed by Antti Koivisto.
+
+        * layout/integration/InlineIteratorLine.cpp:
+        (WebCore::InlineIterator::Line::enclosingTopAdjustedForPrecedingBlock const): Deleted.
+        (WebCore::InlineIterator::Line::selectionState const): Deleted.
+        * layout/integration/InlineIteratorLine.h:
+        (WebCore::InlineIterator::Line::enclosingLogicalRect const): Deleted.
+        (WebCore::InlineIterator::Line::enclosingPhysicalRect const): Deleted.
+        * layout/integration/LineSelection.h:
+        (WebCore::LineSelection::logicalRect):
+        (WebCore::LineSelection::physicalRect):
+        (WebCore::LineSelection::logicalTopAdjustedForPrecedingBlock):
+        (WebCore::LineSelection::selectionState):
+
 2022-03-19  Antoine Quint  <[email protected]>
 
         Dialog element only animates once

Modified: trunk/Source/WebCore/layout/integration/InlineIteratorLine.cpp (291527 => 291528)


--- trunk/Source/WebCore/layout/integration/InlineIteratorLine.cpp	2022-03-19 13:23:57 UTC (rev 291527)
+++ trunk/Source/WebCore/layout/integration/InlineIteratorLine.cpp	2022-03-19 15:39:53 UTC (rev 291528)
@@ -162,41 +162,6 @@
     return !containingBlock().style().isFlippedBlocksWritingMode() ? std::max(top(), enclosingTopForHitTesting()) : std::min(bottom(), enclosingBottom());
 }
 
-LayoutUnit Line::enclosingTopAdjustedForPrecedingBlock() const
-{
-    return containingBlock().adjustEnclosingTopForPrecedingBlock(enclosingTopAdjustedForPrecedingLine());
 }
-
-RenderObject::HighlightState Line::selectionState() const
-{
-    auto& block = containingBlock();
-    if (block.selectionState() == RenderObject::HighlightState::None)
-        return RenderObject::HighlightState::None;
-
-    auto lineState = RenderObject::HighlightState::None;
-    for (auto box = firstLeafBox(); box; box.traverseNextOnLine()) {
-        auto boxState = box->selectionState();
-        if (lineState == RenderObject::HighlightState::None)
-            lineState = boxState;
-        else if (lineState == RenderObject::HighlightState::Start) {
-            if (boxState == RenderObject::HighlightState::End || boxState == RenderObject::HighlightState::None)
-                lineState = RenderObject::HighlightState::Both;
-        } else if (lineState == RenderObject::HighlightState::Inside) {
-            if (boxState == RenderObject::HighlightState::Start || boxState == RenderObject::HighlightState::End)
-                lineState = boxState;
-            else if (boxState == RenderObject::HighlightState::None)
-                lineState = RenderObject::HighlightState::End;
-        } else if (lineState == RenderObject::HighlightState::End) {
-            if (boxState == RenderObject::HighlightState::Start)
-                lineState = RenderObject::HighlightState::Both;
-        }
-
-        if (lineState == RenderObject::HighlightState::Both)
-            break;
-    }
-    return lineState;
 }
 
-}
-}
-

Modified: trunk/Source/WebCore/layout/integration/InlineIteratorLine.h (291527 => 291528)


--- trunk/Source/WebCore/layout/integration/InlineIteratorLine.h	2022-03-19 13:23:57 UTC (rev 291527)
+++ trunk/Source/WebCore/layout/integration/InlineIteratorLine.h	2022-03-19 15:39:53 UTC (rev 291528)
@@ -96,15 +96,8 @@
     friend class WebCore::LineSelection;
 
     LayoutUnit enclosingBottom() const;
-
-    LayoutRect enclosingLogicalRect() const;
-    LayoutRect enclosingPhysicalRect() const;
-
     LayoutUnit enclosingTopAdjustedForPrecedingLine() const;
-    LayoutUnit enclosingTopAdjustedForPrecedingBlock() const;
 
-    RenderObject::HighlightState selectionState() const;
-
     PathVariant m_pathVariant;
 };
 
@@ -195,20 +188,6 @@
     });
 }
 
-inline LayoutRect Line::enclosingLogicalRect() const
-{
-    return { LayoutPoint { contentLogicalLeft(), enclosingTopAdjustedForPrecedingLine() }, LayoutPoint { contentLogicalRight(), enclosingBottom() } };
-}
-
-inline LayoutRect Line::enclosingPhysicalRect() const
-{
-    auto physicalRect = enclosingLogicalRect();
-    if (!isHorizontal())
-        physicalRect = physicalRect.transposedRect();
-    containingBlock().flipForWritingMode(physicalRect);
-    return physicalRect;
-}
-
 inline float Line::contentLogicalLeft() const
 {
     return WTF::switchOn(m_pathVariant, [](const auto& path) {

Modified: trunk/Source/WebCore/layout/integration/LineSelection.h (291527 => 291528)


--- trunk/Source/WebCore/layout/integration/LineSelection.h	2022-03-19 13:23:57 UTC (rev 291527)
+++ trunk/Source/WebCore/layout/integration/LineSelection.h	2022-03-19 15:39:53 UTC (rev 291528)
@@ -26,6 +26,7 @@
 #pragma once
 
 #include "InlineIteratorLine.h"
+#include "RenderBlockFlow.h"
 
 namespace WebCore {
 
@@ -34,12 +35,56 @@
     static LayoutUnit logicalTop(const InlineIterator::Line& line) { return line.enclosingTopAdjustedForPrecedingLine(); }
     static LayoutUnit logicalBottom(const InlineIterator::Line& line) { return line.enclosingBottom(); }
 
-    static LayoutRect logicalRect(const InlineIterator::Line& line) { return line.enclosingLogicalRect(); }
-    static LayoutRect physicalRect(const InlineIterator::Line& line) { return line.enclosingPhysicalRect(); }
+    static LayoutRect logicalRect(const InlineIterator::Line& line)
+    {
+        return { LayoutPoint { line.contentLogicalLeft(), line.enclosingTopAdjustedForPrecedingLine() }, LayoutPoint { line.contentLogicalRight(), line.enclosingBottom() } };
+    }
 
-    static LayoutUnit logicalTopAdjustedForPrecedingBlock(const InlineIterator::Line& line) { return line.enclosingTopAdjustedForPrecedingBlock(); }
+    static LayoutRect physicalRect(const InlineIterator::Line& line)
+    {
+        auto physicalRect = logicalRect(line);
+        if (!line.isHorizontal())
+            physicalRect = physicalRect.transposedRect();
+        line.containingBlock().flipForWritingMode(physicalRect);
+        return physicalRect;
+    }
 
-    static RenderObject::HighlightState selectionState(const InlineIterator::Line& line) { return line.selectionState(); }
+    static LayoutUnit logicalTopAdjustedForPrecedingBlock(const InlineIterator::Line& line)
+    {
+        // FIXME: Move adjustEnclosingTopForPrecedingBlock from RenderBlockFlow to here.
+        return line.containingBlock().adjustEnclosingTopForPrecedingBlock(line.enclosingTopAdjustedForPrecedingLine());
+    }
+
+    static RenderObject::HighlightState selectionState(const InlineIterator::Line& line)
+    {
+        auto& block = line.containingBlock();
+        if (block.selectionState() == RenderObject::HighlightState::None)
+            return RenderObject::HighlightState::None;
+
+        auto lineState = RenderObject::HighlightState::None;
+        for (auto box = line.firstLeafBox(); box; box.traverseNextOnLine()) {
+            auto boxState = box->selectionState();
+            if (lineState == RenderObject::HighlightState::None)
+                lineState = boxState;
+            else if (lineState == RenderObject::HighlightState::Start) {
+                if (boxState == RenderObject::HighlightState::End || boxState == RenderObject::HighlightState::None)
+                    lineState = RenderObject::HighlightState::Both;
+            } else if (lineState == RenderObject::HighlightState::Inside) {
+                if (boxState == RenderObject::HighlightState::Start || boxState == RenderObject::HighlightState::End)
+                    lineState = boxState;
+                else if (boxState == RenderObject::HighlightState::None)
+                    lineState = RenderObject::HighlightState::End;
+            } else if (lineState == RenderObject::HighlightState::End) {
+                if (boxState == RenderObject::HighlightState::Start)
+                    lineState = RenderObject::HighlightState::Both;
+            }
+
+            if (lineState == RenderObject::HighlightState::Both)
+                break;
+        }
+        return lineState;
+    }
+
 };
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to