WebCore:
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Jan 2009 04:47:05 +0000 (04:47 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Jan 2009 04:47:05 +0000 (04:47 +0000)
2009-01-01  Darin Adler  <darin@apple.com>

        Reviewed by Dan Bernstein.

        Bug 23071: REGRESSION (r39536): New test failures after committing patch in bug 23051 (ICU search)
        https://bugs.webkit.org/show_bug.cgi?id=23071

        Also fix some things that Dan suggested during review of the ICU search patch that I forgot
        the first time around.

        * editing/TextIterator.cpp: Use ICU search on all platforms that use ICU, now that
        we've double checked it works everywhere, removing HAVE_ICU_SEARCH entirely.
        Removed unused m_atBreak data member from the non-ICU code path.
        (WebCore::TextIterator::TextIterator): Move null check up.
        (WebCore::TextIterator::handleTextBox): Fix mistake that made the iterator include
        collapsed whitespace. This was left over from an earlier version of the patch.
        (WebCore::SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator):
        Move null check up.

LayoutTests:

2009-01-01  Darin Adler  <darin@apple.com>

        Reviewed by Dan Bernstein.

        Turn on the regression test for ICU search on Mac OS X Tiger too.
        It was already on for Windows (by accident, failing), but now WebCore has been changed
        so it should work fine on all platforms using ICU, which includes both of those.

        * platform/mac-tiger/editing/execCommand: Removed.
        * platform/mac-tiger/editing/execCommand/findString-diacriticals-expected.txt: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@39541 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/mac-tiger/editing/execCommand/findString-diacriticals-expected.txt [deleted file]
WebCore/ChangeLog
WebCore/editing/TextIterator.cpp

index 7a728bedc1430bf7211f0c5f7d04698461391e91..15814773da73c05a293a1fb07cdc6591f93cfb45 100644 (file)
@@ -1,3 +1,14 @@
+2009-01-01  Darin Adler  <darin@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Turn on the regression test for ICU search on Mac OS X Tiger too.
+        It was already on for Windows (by accident, failing), but now WebCore has been changed
+        so it should work fine on all platforms using ICU, which includes both of those.
+
+        * platform/mac-tiger/editing/execCommand: Removed.
+        * platform/mac-tiger/editing/execCommand/findString-diacriticals-expected.txt: Removed.
+
 2009-01-01  Simon Fraser  <simon.fraser@apple.com>
 
         Reviewed by Darin Adler, Oliver Hunt
diff --git a/LayoutTests/platform/mac-tiger/editing/execCommand/findString-diacriticals-expected.txt b/LayoutTests/platform/mac-tiger/editing/execCommand/findString-diacriticals-expected.txt
deleted file mode 100644 (file)
index 231dfe7..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-Test for https://bugs.webkit.org/show_bug.cgi?id=23051 web page searching should use ICU's search so it can ignore diacritical differences.
-
-The word "sélect" should be selected.
-
-FAIL
index 411a25858b23a065086178b51afad6f5d00152ca..7261e704bb68be8fa0bdc39a29297440e1f7eab7 100644 (file)
@@ -1,3 +1,22 @@
+2009-01-01  Darin Adler  <darin@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Bug 23071: REGRESSION (r39536): New test failures after committing patch in bug 23051 (ICU search)
+        https://bugs.webkit.org/show_bug.cgi?id=23071
+
+        Also fix some things that Dan suggested during review of the ICU search patch that I forgot
+        the first time around.
+
+        * editing/TextIterator.cpp: Use ICU search on all platforms that use ICU, now that
+        we've double checked it works everywhere, removing HAVE_ICU_SEARCH entirely.
+        Removed unused m_atBreak data member from the non-ICU code path.
+        (WebCore::TextIterator::TextIterator): Move null check up.
+        (WebCore::TextIterator::handleTextBox): Fix mistake that made the iterator include
+        collapsed whitespace. This was left over from an earlier version of the patch.
+        (WebCore::SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator):
+        Move null check up.
+
 2009-01-01  Simon Fraser  <simon.fraser@apple.com>
 
         Reviewed by Darin Adler, Oliver Hunt
index fa641742672a34be78c810249a83a4e4b3d5f813..a5a225e68ba46e673a364c015b8368e07ee35ea0 100644 (file)
 #include "RenderTextControl.h"
 #include "visible_units.h"
 
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER)
-#define HAVE_ICU_SEARCH 1
-#endif
-
-#if HAVE(ICU_SEARCH)
+#if USE(ICU_UNICODE)
 #include <unicode/usearch.h>
 #endif
 
-using namespace std;
 using namespace WTF::Unicode;
+using namespace std;
 
 namespace WebCore {
 
@@ -73,7 +69,7 @@ public:
     size_t search(size_t& startOffset);
     bool atBreak() const;
 
-#if HAVE(ICU_SEARCH)
+#if USE(ICU_UNICODE)
 
 private:
     String m_target;
@@ -95,8 +91,6 @@ private:
     bool m_isBufferFull;
     size_t m_cursor;
 
-    bool m_atBreak;
-
 #endif
 };
 
@@ -129,11 +123,11 @@ TextIterator::TextIterator(const Range* r, bool emitCharactersBetweenAllVisibleP
 
     // get and validate the range endpoints
     Node* startContainer = r->startContainer();
+    if (!startContainer)
+        return;
     int startOffset = r->startOffset();
     Node* endContainer = r->endContainer();
     int endOffset = r->endOffset();
-    if (!startContainer)
-        return;
 
     // Callers should be handing us well-formed ranges. If we discover that this isn't
     // the case, we could consider changing this assertion to an early return.
@@ -355,7 +349,7 @@ void TextIterator::handleTextBox()
                 unsigned spaceRunStart = runStart - 1;
                 while (spaceRunStart > 0 && str[spaceRunStart - 1] == ' ')
                     --spaceRunStart;
-                emitText(m_node, spaceRunStart, runStart);
+                emitText(m_node, spaceRunStart, spaceRunStart + 1);
             } else
                 emitCharacter(' ', m_node, 0, runStart, runStart);
             return;
@@ -783,11 +777,11 @@ SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator(const Range *r)
         return;
 
     Node* startNode = r->startContainer();
+    if (!startNode)
+        return;
     Node* endNode = r->endContainer();
     int startOffset = r->startOffset();
     int endOffset = r->endOffset();
-    if (!startNode)
-        return;
 
     if (!startNode->offsetInCharacters()) {
         if (startOffset >= 0 && startOffset < static_cast<int>(startNode->childNodeCount())) {
@@ -1178,7 +1172,7 @@ const UChar* WordAwareIterator::characters() const
 
 // --------
 
-#if HAVE(ICU_SEARCH)
+#if USE(ICU_UNICODE)
 
 static const size_t minimumSearchBufferSize = 8192;
 
@@ -1321,7 +1315,7 @@ inline size_t SearchBuffer::search(size_t& start)
     return usearch_getMatchedLength(searcher);
 }
 
-#else
+#else // !ICU_UNICODE
 
 inline SearchBuffer::SearchBuffer(const String& target, bool isCaseSensitive)
     : m_target(isCaseSensitive ? target : target.foldCase())
@@ -1412,7 +1406,7 @@ size_t SearchBuffer::length() const
     return length;
 }
 
-#endif
+#endif // !ICU_UNICODE
 
 // --------