Title: [169199] trunk
Revision
169199
Author
[email protected]
Date
2014-05-22 06:05:20 -0700 (Thu, 22 May 2014)

Log Message

Text markers don't paint on simple lines
https://bugs.webkit.org/show_bug.cgi?id=133177

Reviewed by Anders Carlsson.

Source/WebCore: 
        
Marker painting code does not yet support simple lines.

Tests: fast/text/mark-matches-rendering-simple-lines.html
       fast/text/mark-matches-rendering.html

* dom/DocumentMarkerController.cpp:
(WebCore::DocumentMarkerController::addMarker):
        
    Force text blocks with markers to use line boxes.

* testing/Internals.cpp:
(WebCore::Internals::setMarkedTextMatchesAreHighlighted):
        
    Expose this so we can make reftests for marker rendering.

* testing/Internals.h:
* testing/Internals.idl:

LayoutTests: 

* fast/text/mark-matches-rendering-expected.html: Added.
* fast/text/mark-matches-rendering-simple-lines-expected.html: Added.
* fast/text/mark-matches-rendering-simple-lines.html: Added.
* fast/text/mark-matches-rendering.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (169198 => 169199)


--- trunk/LayoutTests/ChangeLog	2014-05-22 12:16:49 UTC (rev 169198)
+++ trunk/LayoutTests/ChangeLog	2014-05-22 13:05:20 UTC (rev 169199)
@@ -1,3 +1,15 @@
+2014-05-22  Antti Koivisto  <[email protected]>
+
+        Text markers don't paint on simple lines
+        https://bugs.webkit.org/show_bug.cgi?id=133177
+
+        Reviewed by Anders Carlsson.
+
+        * fast/text/mark-matches-rendering-expected.html: Added.
+        * fast/text/mark-matches-rendering-simple-lines-expected.html: Added.
+        * fast/text/mark-matches-rendering-simple-lines.html: Added.
+        * fast/text/mark-matches-rendering.html: Added.
+
 2014-05-22  Javier Fernandez  <[email protected]>
 
         [CSS Grid Layout] Split the grid-item-margin-auto-columns-rows.html test.

Added: trunk/LayoutTests/fast/text/mark-matches-rendering-expected.html (0 => 169199)


--- trunk/LayoutTests/fast/text/mark-matches-rendering-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/mark-matches-rendering-expected.html	2014-05-22 13:05:20 UTC (rev 169199)
@@ -0,0 +1,3 @@
+<p style="display:inline-block; background-color:yellow">
+Quo usque tandem abutere, Catilina, patientia nostra?
+</p>

Added: trunk/LayoutTests/fast/text/mark-matches-rendering-simple-lines-expected.html (0 => 169199)


--- trunk/LayoutTests/fast/text/mark-matches-rendering-simple-lines-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/mark-matches-rendering-simple-lines-expected.html	2014-05-22 13:05:20 UTC (rev 169199)
@@ -0,0 +1,13 @@
+<script>
+if (window.internals)
+    internals.settings.setSimpleLineLayoutEnabled(false);
+</script>
+<p>
+Quo usque tandem abutere, Catilina, patientia nostra?
+</p>
+<script>
+if (window.internals) {
+    internals.setMarkedTextMatchesAreHighlighted(true);
+    internals.countMatchesForText("ti", 0, "mark");
+}
+</script>

Added: trunk/LayoutTests/fast/text/mark-matches-rendering-simple-lines.html (0 => 169199)


--- trunk/LayoutTests/fast/text/mark-matches-rendering-simple-lines.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/mark-matches-rendering-simple-lines.html	2014-05-22 13:05:20 UTC (rev 169199)
@@ -0,0 +1,9 @@
+<p>
+Quo usque tandem abutere, Catilina, patientia nostra?
+</p>
+<script>
+if (window.internals) {
+    internals.setMarkedTextMatchesAreHighlighted(true);
+    internals.countMatchesForText("ti", 0, "mark");
+}
+</script>

Added: trunk/LayoutTests/fast/text/mark-matches-rendering.html (0 => 169199)


--- trunk/LayoutTests/fast/text/mark-matches-rendering.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/mark-matches-rendering.html	2014-05-22 13:05:20 UTC (rev 169199)
@@ -0,0 +1,9 @@
+<p style="display:inline-block; background-color:red">
+Quo usque tandem abutere, Catilina, patientia nostra?
+</p>
+<script>
+if (window.internals) {
+    internals.setMarkedTextMatchesAreHighlighted(true);
+    internals.countMatchesForText("Quo usque tandem abutere, Catilina, patientia nostra?", 0, "mark");
+}
+</script>

Modified: trunk/Source/WebCore/ChangeLog (169198 => 169199)


--- trunk/Source/WebCore/ChangeLog	2014-05-22 12:16:49 UTC (rev 169198)
+++ trunk/Source/WebCore/ChangeLog	2014-05-22 13:05:20 UTC (rev 169199)
@@ -1,3 +1,28 @@
+2014-05-22  Antti Koivisto  <[email protected]>
+
+        Text markers don't paint on simple lines
+        https://bugs.webkit.org/show_bug.cgi?id=133177
+
+        Reviewed by Anders Carlsson.
+        
+        Marker painting code does not yet support simple lines.
+
+        Tests: fast/text/mark-matches-rendering-simple-lines.html
+               fast/text/mark-matches-rendering.html
+
+        * dom/DocumentMarkerController.cpp:
+        (WebCore::DocumentMarkerController::addMarker):
+        
+            Force text blocks with markers to use line boxes.
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::setMarkedTextMatchesAreHighlighted):
+        
+            Expose this so we can make reftests for marker rendering.
+
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2014-05-22  Manuel Rego Casasnovas  <[email protected]>
 
         [CSS Grid Layout] Guard RenderObject::isRenderGrid() method

Modified: trunk/Source/WebCore/dom/DocumentMarkerController.cpp (169198 => 169199)


--- trunk/Source/WebCore/dom/DocumentMarkerController.cpp	2014-05-22 12:16:49 UTC (rev 169198)
+++ trunk/Source/WebCore/dom/DocumentMarkerController.cpp	2014-05-22 13:05:20 UTC (rev 169199)
@@ -29,7 +29,8 @@
 
 #include "NodeTraversal.h"
 #include "Range.h"
-#include "RenderObject.h"
+#include "RenderBlockFlow.h"
+#include "RenderText.h"
 #include "RenderedDocumentMarker.h"
 #include "TextIterator.h"
 #include <stdio.h>
@@ -166,6 +167,14 @@
     if (newMarker.endOffset() == newMarker.startOffset())
         return;
 
+    if (auto* renderer = node->renderer()) {
+        // FIXME: Factor the marker painting code out of InlineTextBox and teach simple line layout to use it.
+        if (renderer->isText())
+            toRenderText(*renderer).ensureLineBoxes();
+        else if (renderer->isRenderBlockFlow())
+            toRenderBlockFlow(*renderer).ensureLineBoxes();
+    }
+
     m_possiblyExistingMarkerTypes.add(newMarker.type());
 
     std::unique_ptr<MarkerList>& list = m_markers.add(node, nullptr).iterator->value;

Modified: trunk/Source/WebCore/testing/Internals.cpp (169198 => 169199)


--- trunk/Source/WebCore/testing/Internals.cpp	2014-05-22 12:16:49 UTC (rev 169198)
+++ trunk/Source/WebCore/testing/Internals.cpp	2014-05-22 13:05:20 UTC (rev 169199)
@@ -801,6 +801,16 @@
     range->ownerDocument().markers().addTextMatchMarker(range, isActive);
 }
 
+void Internals::setMarkedTextMatchesAreHighlighted(bool flag, ExceptionCode& ec)
+{
+    Document* document = contextDocument();
+    if (!document || !document->frame()) {
+        ec = INVALID_ACCESS_ERR;
+        return;
+    }
+    document->frame()->editor().setMarkedTextMatchesAreHighlighted(flag);
+}
+
 void Internals::setScrollViewPosition(long x, long y, ExceptionCode& ec)
 {
     Document* document = contextDocument();

Modified: trunk/Source/WebCore/testing/Internals.h (169198 => 169199)


--- trunk/Source/WebCore/testing/Internals.h	2014-05-22 12:16:49 UTC (rev 169198)
+++ trunk/Source/WebCore/testing/Internals.h	2014-05-22 13:05:20 UTC (rev 169199)
@@ -130,6 +130,7 @@
     PassRefPtr<Range> markerRangeForNode(Node*, const String& markerType, unsigned index, ExceptionCode&);
     String markerDescriptionForNode(Node*, const String& markerType, unsigned index, ExceptionCode&);
     void addTextMatchMarker(const Range*, bool isActive);
+    void setMarkedTextMatchesAreHighlighted(bool, ExceptionCode&);
 
     void setScrollViewPosition(long x, long y, ExceptionCode&);
     void setPagination(const String& mode, int gap, ExceptionCode& ec) { setPagination(mode, gap, 0, ec); }

Modified: trunk/Source/WebCore/testing/Internals.idl (169198 => 169199)


--- trunk/Source/WebCore/testing/Internals.idl	2014-05-22 12:16:49 UTC (rev 169198)
+++ trunk/Source/WebCore/testing/Internals.idl	2014-05-22 13:05:20 UTC (rev 169199)
@@ -81,6 +81,7 @@
     [RaisesException] Range markerRangeForNode(Node node, DOMString markerType, unsigned long index);
     [RaisesException] DOMString markerDescriptionForNode(Node node, DOMString markerType, unsigned long index);
     void addTextMatchMarker(Range range, boolean isActive);
+    [RaisesException] void setMarkedTextMatchesAreHighlighted(boolean flag);
 
     [RaisesException] void setScrollViewPosition(long x, long y);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to