WebCore:
authorharrison <harrison@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Sep 2007 17:23:22 +0000 (17:23 +0000)
committerharrison <harrison@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Sep 2007 17:23:22 +0000 (17:23 +0000)
        Reviewed by Darin.

        <rdar://problem/5486974> REGRESSION(r25373): 1/4 second to doubleclick word in GMail when using Kotoeri IM, also slow in other IMs (15163)

        Updated tests:
        * fast/dom/Window/window-xy-properties-expected.txt:
        * fast/dom/plugin-attributes-enumeration-expected.txt:
        * fast/events/onerror-bubbling-expected.txt:
        * fast/events/related-target-expected.txt:
        * fast/forms/select-namedItem-expected.txt:
        * fast/table/incomplete-table-in-fragment-2-expected.txt:
        * fast/table/incomplete-table-in-fragment-hang-expected.txt:
        * fast/table/large-rowspan-crash-expected.txt:
        * plugins/embed-attributes-setting-expected.txt:

        * editing/TextIterator.cpp:
        (WebCore::TextIterator::shouldRepresentNodeOffsetZero):
        Avoid VisiblePosition check if the current node is a descendant
        of the start container and the start offset was 0. In that case
        we already had enough context to correctly decide whether to emit
        a newline after a preceding block. We chose not to emit
        (m_haveEmitted is false), so don't second guess that.

        (WebCore::TextIterator::exitNode):
        Changed some comments.

LayoutTests:

        Reviewed by Darin.

        Updated for:
        <rdar://problem/5486974> REGRESSION(r25373): 1/4 second to doubleclick word in GMail when using Kotoeri IM, also slow in other IMs (15163)

        NOTE: This reverts the test result changes I made for rdar://5472125, back to not emitting
        a newline for collapsed block or hr at start of range.

        * fast/dom/Window/window-xy-properties-expected.txt:
        * fast/dom/plugin-attributes-enumeration-expected.txt:
        * fast/events/onerror-bubbling-expected.txt:
        * fast/events/related-target-expected.txt:
        * fast/forms/select-namedItem-expected.txt:
        * fast/table/incomplete-table-in-fragment-2-expected.txt:
        * fast/table/incomplete-table-in-fragment-hang-expected.txt:
        * fast/table/large-rowspan-crash-expected.txt:
        * plugins/embed-attributes-setting-expected.txt:

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

12 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/Window/window-xy-properties-expected.txt
LayoutTests/fast/dom/plugin-attributes-enumeration-expected.txt
LayoutTests/fast/events/onerror-bubbling-expected.txt
LayoutTests/fast/events/related-target-expected.txt
LayoutTests/fast/forms/select-namedItem-expected.txt
LayoutTests/fast/table/incomplete-table-in-fragment-2-expected.txt
LayoutTests/fast/table/incomplete-table-in-fragment-hang-expected.txt
LayoutTests/fast/table/large-rowspan-crash-expected.txt
LayoutTests/plugins/embed-attributes-setting-expected.txt
WebCore/ChangeLog
WebCore/editing/TextIterator.cpp

index 175970a..1ac8605 100644 (file)
@@ -1,3 +1,23 @@
+2007-09-18  David Harrison  <harrison@apple.com>
+
+        Reviewed by Darin.
+
+        Updated for:
+        <rdar://problem/5486974> REGRESSION(r25373): 1/4 second to doubleclick word in GMail when using Kotoeri IM, also slow in other IMs (15163)
+
+        NOTE: This reverts the test result changes I made for rdar://5472125, back to not emitting
+        a newline for collapsed block or hr at start of range.
+                
+        * fast/dom/Window/window-xy-properties-expected.txt:
+        * fast/dom/plugin-attributes-enumeration-expected.txt:
+        * fast/events/onerror-bubbling-expected.txt:
+        * fast/events/related-target-expected.txt:
+        * fast/forms/select-namedItem-expected.txt:
+        * fast/table/incomplete-table-in-fragment-2-expected.txt:
+        * fast/table/incomplete-table-in-fragment-hang-expected.txt:
+        * fast/table/large-rowspan-crash-expected.txt:
+        * plugins/embed-attributes-setting-expected.txt:
+
 2007-09-17  Antti Koivisto  <antti@apple.com>
 
         Reviewed by Darin.
index da95a0a..aedae17 100644 (file)
@@ -1,4 +1,3 @@
-
 This test checks that the relatedTarget property is set on mouse out and mouse over events.
 
 To perform the test, move the mouse into the red box, and then drag it out of the red box into the blue box.
index 6dbd6c6..a4403a4 100644 (file)
@@ -1,4 +1,3 @@
-
 Test error handling for incomplete tables inside a document fragment. These should not crash or hang. 
 
 <tbody></tbody>
index 7739297..3817327 100644 (file)
@@ -1,4 +1,3 @@
-
 Test error handling for incomplete tables inside a document fragment. These should not crash or hang. 
 
 <tbody></tbody><table></table>
index 1b3017a..9da3aee 100644 (file)
@@ -1,4 +1,3 @@
-
 [Embed is element specified in markup]
 PASS: embed.getAttribute('align') should be 1 and is.
 PASS: embed.getAttribute('height') should be 1 and is.
index d022fba..7531872 100644 (file)
@@ -1,3 +1,31 @@
+2007-09-18  David Harrison  <harrison@apple.com>
+
+        Reviewed by Darin.
+
+        <rdar://problem/5486974> REGRESSION(r25373): 1/4 second to doubleclick word in GMail when using Kotoeri IM, also slow in other IMs (15163)
+
+        Updated tests:
+        * fast/dom/Window/window-xy-properties-expected.txt:
+        * fast/dom/plugin-attributes-enumeration-expected.txt:
+        * fast/events/onerror-bubbling-expected.txt:
+        * fast/events/related-target-expected.txt:
+        * fast/forms/select-namedItem-expected.txt:
+        * fast/table/incomplete-table-in-fragment-2-expected.txt:
+        * fast/table/incomplete-table-in-fragment-hang-expected.txt:
+        * fast/table/large-rowspan-crash-expected.txt:
+        * plugins/embed-attributes-setting-expected.txt:
+
+        * editing/TextIterator.cpp:
+        (WebCore::TextIterator::shouldRepresentNodeOffsetZero):
+        Avoid VisiblePosition check if the current node is a descendant
+        of the start container and the start offset was 0. In that case
+        we already had enough context to correctly decide whether to emit
+        a newline after a preceding block. We chose not to emit
+        (m_haveEmitted is false), so don't second guess that.
+            
+        (WebCore::TextIterator::exitNode):
+        Changed some comments.
+
 2007-09-17  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Darin Adler.
index 2eaf40b..6ccc7a4 100644 (file)
@@ -520,14 +520,27 @@ bool TextIterator::shouldRepresentNodeOffsetZero()
     // make quicker checks to possibly avoid that. Another check that we could make is
     // is whether the inline vs block flow changed since the previous visible element.
     // I think we're already in a special enough case that that won't be needed, tho.
-    // The currPos.isNotNull() check is needed because positions in non-html content
-    // (like svg) do not have visible positions, and we don't want to emit for them either.
+
+    // If we are at the start, obviously no newline is needed.
     if (m_node == m_startContainer)
         return false;
     
+    // If we are outside the start container's subtree, assume we need a newline.
+    // FIXME: m_startContainer could be an inline block
     if (!m_node->isDescendantOf(m_startContainer))
         return true;
+
+    // If we started as m_startContainer offset 0 and the current node is a descendant of
+    // the start container, we already had enough context to correctly decide whether to
+    // emit a newline after a preceding block. We chose not to emit (m_haveEmitted is false),
+    // so don't second guess that now.
+    // NOTE: Is this really correct when m_node is not a leftmost descendant? Probably
+    // immaterial since we likely would have already emitted something by now.
+    if (m_startOffset == 0)
+        return false;
     
+    // The currPos.isNotNull() check is needed because positions in non-html content
+    // (like svg) do not have visible positions, and we don't want to emit for them either.
     VisiblePosition startPos = VisiblePosition(m_startContainer, m_startOffset, DOWNSTREAM);
     VisiblePosition currPos = VisiblePosition(m_node, 0, DOWNSTREAM);
     return currPos.isNotNull() && !inSameLine(startPos, currPos);
@@ -567,6 +580,9 @@ bool TextIterator::handleNonTextNode()
 void TextIterator::exitNode()
 {
     // prevent emitting a newline when exiting a collapsed block at beginning of the range
+    // FIXME: !m_haveEmitted does not necessarily mean there was a collapsed block... it could
+    // have been an hr (e.g.). Also, a collapsed block could have height (e.g. a table) and
+    // therefore look like a blank line.
     if (!m_haveEmitted)
         return;
         
@@ -575,7 +591,8 @@ void TextIterator::exitNode()
     // emitted character is positioned visually.
     Node* baseNode = m_node->lastChild() ? m_node->lastChild() : m_node;
     // FIXME: This shouldn't require the m_lastTextNode to be true, but we can't change that without making
-    // the logic in _web_attributedStringFromRange match.  We'll get that for free when we switch to use TextIterator in _web_attributedStringFromRange.
+    // the logic in _web_attributedStringFromRange match.  We'll get that for free when we switch to use
+    // TextIterator in _web_attributedStringFromRange.
     // See <rdar://problem/5428427> for an example of how this mismatch will cause problems.
     if (m_lastTextNode && shouldEmitNewlineAfterNode(m_node)) {
         // use extra newline to represent margin bottom, as needed