Title: [282811] trunk
Revision
282811
Author
[email protected]
Date
2021-09-21 06:46:16 -0700 (Tue, 21 Sep 2021)

Log Message

[LFC][Integration] Enable markers and highlights
https://bugs.webkit.org/show_bug.cgi?id=230542

Reviewed by Alan Bujtas.

Source/WebCore:

Layout and paint highlights and markers without switching to legacy line layout.

* Modules/highlight/Highlight.cpp:
(WebCore::repaintRange):
* dom/DocumentMarkerController.cpp:
(WebCore::DocumentMarkerController::addMarker):
* editing/Editor.cpp:
(WebCore::Editor::setComposition):
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::printReason):
(WebCore::LayoutIntegration::canUseForChild):
(WebCore::LayoutIntegration::canUseForLineLayoutWithReason):
* layout/integration/LayoutIntegrationCoverage.h:
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::paint):

LayoutTests:

* platform/mac/editing/mac/spelling/delete-autocorrected-word-2-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (282810 => 282811)


--- trunk/LayoutTests/ChangeLog	2021-09-21 11:00:15 UTC (rev 282810)
+++ trunk/LayoutTests/ChangeLog	2021-09-21 13:46:16 UTC (rev 282811)
@@ -1,3 +1,12 @@
+2021-09-21  Antti Koivisto  <[email protected]>
+
+        [LFC][Integration] Enable markers and highlights
+        https://bugs.webkit.org/show_bug.cgi?id=230542
+
+        Reviewed by Alan Bujtas.
+
+        * platform/mac/editing/mac/spelling/delete-autocorrected-word-2-expected.txt:
+
 2021-09-21  Myles C. Maxfield  <[email protected]>
 
         Maplike infrastructure ASSERT()s if the first operation is a delete of a existing values

Modified: trunk/LayoutTests/platform/mac/editing/mac/spelling/delete-autocorrected-word-2-expected.txt (282810 => 282811)


--- trunk/LayoutTests/platform/mac/editing/mac/spelling/delete-autocorrected-word-2-expected.txt	2021-09-21 11:00:15 UTC (rev 282810)
+++ trunk/LayoutTests/platform/mac/editing/mac/spelling/delete-autocorrected-word-2-expected.txt	2021-09-21 13:46:16 UTC (rev 282811)
@@ -69,6 +69,5 @@
   RenderTextControl {TEXTAREA} at (2,2) size 581x136 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     RenderBlock {DIV} at (3,3) size 575x13
       RenderText {#text} at (0,0) size 65x13
-        text run at (0,0) width 62: "the mesage"
-        text run at (61,0) width 4: " "
+        text run at (0,0) width 65: "the mesage "
 caret: position 11 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 5 {TEXTAREA} of body

Modified: trunk/Source/WebCore/ChangeLog (282810 => 282811)


--- trunk/Source/WebCore/ChangeLog	2021-09-21 11:00:15 UTC (rev 282810)
+++ trunk/Source/WebCore/ChangeLog	2021-09-21 13:46:16 UTC (rev 282811)
@@ -1,3 +1,26 @@
+2021-09-21  Antti Koivisto  <[email protected]>
+
+        [LFC][Integration] Enable markers and highlights
+        https://bugs.webkit.org/show_bug.cgi?id=230542
+
+        Reviewed by Alan Bujtas.
+
+        Layout and paint highlights and markers without switching to legacy line layout.
+
+        * Modules/highlight/Highlight.cpp:
+        (WebCore::repaintRange):
+        * dom/DocumentMarkerController.cpp:
+        (WebCore::DocumentMarkerController::addMarker):
+        * editing/Editor.cpp:
+        (WebCore::Editor::setComposition):
+        * layout/integration/LayoutIntegrationCoverage.cpp:
+        (WebCore::LayoutIntegration::printReason):
+        (WebCore::LayoutIntegration::canUseForChild):
+        (WebCore::LayoutIntegration::canUseForLineLayoutWithReason):
+        * layout/integration/LayoutIntegrationCoverage.h:
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::LineLayout::paint):
+
 2021-09-21  Commit Queue  <[email protected]>
 
         Unreviewed, reverting r282807.

Modified: trunk/Source/WebCore/Modules/highlight/Highlight.cpp (282810 => 282811)


--- trunk/Source/WebCore/Modules/highlight/Highlight.cpp	2021-09-21 11:00:15 UTC (rev 282810)
+++ trunk/Source/WebCore/Modules/highlight/Highlight.cpp	2021-09-21 13:46:16 UTC (rev 282811)
@@ -37,10 +37,6 @@
 #include "StyleProperties.h"
 #include <wtf/Ref.h>
 
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-#include "LayoutIntegrationLineLayout.h"
-#endif
-
 namespace WebCore {
 
 Highlight::Highlight(Ref<StaticRange>&& range)
@@ -67,13 +63,8 @@
     if (is_gt(treeOrder<ComposedTree>(range.start, range.end)))
         std::swap(sortedRange.start, sortedRange.end);
     for (auto& node : intersectingNodes(sortedRange)) {
-        if (auto renderer = node.renderer()) {
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-            if (auto lineLayout = LayoutIntegration::LineLayout::containing(*renderer))
-                lineLayout->flow().ensureLineBoxes();
-#endif
+        if (auto renderer = node.renderer())
             renderer->repaint();
-        }
     }
 }
 

Modified: trunk/Source/WebCore/dom/DocumentMarkerController.cpp (282810 => 282811)


--- trunk/Source/WebCore/dom/DocumentMarkerController.cpp	2021-09-21 11:00:15 UTC (rev 282810)
+++ trunk/Source/WebCore/dom/DocumentMarkerController.cpp	2021-09-21 13:46:16 UTC (rev 282811)
@@ -30,7 +30,6 @@
 #include "Chrome.h"
 #include "ChromeClient.h"
 #include "Frame.h"
-#include "LayoutIntegrationLineLayout.h"
 #include "NodeTraversal.h"
 #include "Page.h"
 #include "RenderBlockFlow.h"
@@ -253,14 +252,6 @@
     if (newMarker.endOffset() == newMarker.startOffset())
         return;
 
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-    if (auto* renderer = node.renderer()) {
-        // FIXME: Factor the marker painting code out of LegacyInlineTextBox and teach simple line layout to use it.
-        if (auto* lineLayout = LayoutIntegration::LineLayout::containing(*renderer))
-            lineLayout->flow().ensureLineBoxes();
-    }
-#endif
-
     m_possiblyExistingMarkerTypes.add(newMarker.type());
 
     auto& list = m_markers.add(&node, nullptr).iterator->value;

Modified: trunk/Source/WebCore/editing/Editor.cpp (282810 => 282811)


--- trunk/Source/WebCore/editing/Editor.cpp	2021-09-21 11:00:15 UTC (rev 282810)
+++ trunk/Source/WebCore/editing/Editor.cpp	2021-09-21 13:46:16 UTC (rev 282811)
@@ -133,10 +133,6 @@
 #include "PromisedAttachmentInfo.h"
 #endif
 
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-#include "LayoutIntegrationLineLayout.h"
-#endif
-
 namespace WebCore {
 
 static bool dispatchBeforeInputEvent(Element& element, const AtomString& inputType, const String& data = { }, RefPtr<DataTransfer>&& dataTransfer = nullptr, const Vector<RefPtr<StaticRange>>& targetRanges = { }, Event::IsCancelable cancelable = Event::IsCancelable::Yes)
@@ -2157,13 +2153,8 @@
                 highlight.endOffset += baseOffset;
             }
 
-            if (auto renderer = baseNode->renderer()) {
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-                if (auto lineLayout = LayoutIntegration::LineLayout::containing(*renderer))
-                    lineLayout->flow().ensureLineBoxes();
-#endif
+            if (auto renderer = baseNode->renderer())
                 renderer->repaint();
-            }
 
             unsigned start = std::min(baseOffset + selectionStart, extentOffset);
             unsigned end = std::min(std::max(start, baseOffset + selectionEnd), extentOffset);

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp (282810 => 282811)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp	2021-09-21 11:00:15 UTC (rev 282810)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp	2021-09-21 13:46:16 UTC (rev 282811)
@@ -26,9 +26,7 @@
 #include "config.h"
 #include "LayoutIntegrationCoverage.h"
 
-#include "DocumentMarkerController.h"
 #include "HTMLTextFormControlElement.h"
-#include "HighlightRegister.h"
 #include "InlineIterator.h"
 #include "Logging.h"
 #include "RenderBlockFlow.h"
@@ -207,12 +205,6 @@
     case AvoidanceReason::MultiColumnFlowIsFloating:
         stream << "column with floating objects";
         break;
-    case AvoidanceReason::FlowIncludesDocumentMarkers:
-        stream << "text includes document markers";
-        break;
-    case AvoidanceReason::FlowIncludesHighlights:
-        stream << "text includes highlights";
-        break;
     case AvoidanceReason::FlowHasJustifiedNonBreakingSpace:
         stream << "justified text has non-breaking-space character";
         break;
@@ -517,15 +509,14 @@
 static OptionSet<AvoidanceReason> canUseForChild(const RenderBlockFlow& flow, const RenderObject& child, IncludeReasons includeReasons)
 {
     OptionSet<AvoidanceReason> reasons;
-    if (is<RenderCounter>(child))
-        SET_REASON_AND_RETURN_IF_NEEDED(FlowTextIsRenderCounter, reasons, includeReasons);
+
     if (is<RenderText>(child)) {
-        const auto& renderText = downcast<RenderText>(child);
-        if (renderText.textNode() && !renderText.document().markers().markersFor(*renderText.textNode()).isEmpty())
-            SET_REASON_AND_RETURN_IF_NEEDED(FlowIncludesDocumentMarkers, reasons, includeReasons);
+        if (is<RenderCounter>(child))
+            SET_REASON_AND_RETURN_IF_NEEDED(FlowTextIsRenderCounter, reasons, includeReasons);
+
         return reasons;
     }
-    
+
     if (flow.containsFloats()) {
         // Non-text content may stretch the line and we don't yet have support for dynamic float avoiding (as the line grows).
         SET_REASON_AND_RETURN_IF_NEEDED(FlowHasUnsupportedFloat, reasons, includeReasons);
@@ -688,12 +679,6 @@
     // Printing does pagination without a flow thread.
     if (flow.document().paginated())
         SET_REASON_AND_RETURN_IF_NEEDED(FlowIsPaginated, reasons, includeReasons);
-    if (flow.document().highlightRegisterIfExists() && !flow.document().highlightRegisterIfExists()->map().isEmpty())
-        SET_REASON_AND_RETURN_IF_NEEDED(FlowIncludesHighlights, reasons, includeReasons);
-#if ENABLE(APP_HIGHLIGHTS)
-    if (flow.document().appHighlightRegisterIfExists() && !flow.document().appHighlightRegisterIfExists()->map().isEmpty())
-        SET_REASON_AND_RETURN_IF_NEEDED(FlowIncludesHighlights, reasons, includeReasons);
-#endif
     if (flow.firstLineBlock())
         SET_REASON_AND_RETURN_IF_NEEDED(FlowHasPseudoFirstLine, reasons, includeReasons);
     if (flow.isAnonymousBlock() && flow.parent()->style().textOverflow() == TextOverflow::Ellipsis)

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h (282810 => 282811)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h	2021-09-21 11:00:15 UTC (rev 282810)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h	2021-09-21 13:46:16 UTC (rev 282811)
@@ -88,8 +88,8 @@
     MultiColumnFlowHasColumnSpanner              = 1LLU  << 48,
     MultiColumnFlowVerticalAlign                 = 1LLU  << 49,
     MultiColumnFlowIsFloating                    = 1LLU  << 50,
-    FlowIncludesDocumentMarkers                  = 1LLU  << 51,
-    FlowIncludesHighlights                       = 1LLU  << 52,
+    // Unused                                    = 1LLU  << 51,
+    // Unused                                    = 1LLU  << 52,
     FlowHasJustifiedNonBreakingSpace             = 1LLU  << 53,
     UnsupportedFieldset                          = 1LLU  << 54,
     ChildBoxIsFloatingOrPositioned               = 1LLU  << 55,

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (282810 => 282811)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2021-09-21 11:00:15 UTC (rev 282810)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2021-09-21 13:46:16 UTC (rev 282811)
@@ -492,7 +492,7 @@
     if (!m_inlineContent)
         return;
 
-    if (paintInfo.phase != PaintPhase::Foreground && paintInfo.phase != PaintPhase::EventRegion && paintInfo.phase != PaintPhase::TextClip)
+    if (paintInfo.phase != PaintPhase::Foreground && paintInfo.phase != PaintPhase::EventRegion && paintInfo.phase != PaintPhase::TextClip && paintInfo.phase != PaintPhase::Selection)
         return;
 
     auto paintRect = paintInfo.rect;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to