Title: [126164] trunk/Source/WebCore
Revision
126164
Author
[email protected]
Date
2012-08-21 09:43:56 -0700 (Tue, 21 Aug 2012)

Log Message

<rdar://problem/12104508> TextIterator takes O(n^2) to iterate over n empty blocks
https://bugs.webkit.org/show_bug.cgi?id=94429

Reviewed by Sam Weinig.

No new tests, because behavior is unchanged.

* editing/TextIterator.cpp:
(WebCore::TextIterator::shouldRepresentNodeOffsetZero): Enhanced the check for nodes that
cannot contain VisiblePosition to also check for zero-height blocks.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (126163 => 126164)


--- trunk/Source/WebCore/ChangeLog	2012-08-21 16:40:12 UTC (rev 126163)
+++ trunk/Source/WebCore/ChangeLog	2012-08-21 16:43:56 UTC (rev 126164)
@@ -1,3 +1,16 @@
+2012-08-21  Dan Bernstein  <[email protected]>
+
+        <rdar://problem/12104508> TextIterator takes O(n^2) to iterate over n empty blocks
+        https://bugs.webkit.org/show_bug.cgi?id=94429
+
+        Reviewed by Sam Weinig.
+
+        No new tests, because behavior is unchanged.
+
+        * editing/TextIterator.cpp:
+        (WebCore::TextIterator::shouldRepresentNodeOffsetZero): Enhanced the check for nodes that
+        cannot contain VisiblePosition to also check for zero-height blocks.
+
 2012-08-21  'Pavel Feldman'  <[email protected]>
 
         Web Inspector: break on exceptions decoration was lost, restoring.

Modified: trunk/Source/WebCore/editing/TextIterator.cpp (126163 => 126164)


--- trunk/Source/WebCore/editing/TextIterator.cpp	2012-08-21 16:40:12 UTC (rev 126163)
+++ trunk/Source/WebCore/editing/TextIterator.cpp	2012-08-21 16:43:56 UTC (rev 126164)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
  * Copyright (C) 2005 Alexey Proskuryakov.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -893,9 +893,10 @@
     // If this node is unrendered or invisible the VisiblePosition checks below won't have much meaning.
     // Additionally, if the range we are iterating over contains huge sections of unrendered content, 
     // we would create VisiblePositions on every call to this function without this check.
-    if (!m_node->renderer() || m_node->renderer()->style()->visibility() != VISIBLE)
+    if (!m_node->renderer() || m_node->renderer()->style()->visibility() != VISIBLE
+        || (m_node->renderer()->isBlockFlow() && !toRenderBlock(m_node->renderer())->height() && !m_node->hasTagName(bodyTag)))
         return false;
-    
+
     // The startPos.isNotNull() check is needed because the start could be before the body,
     // and in that case we'll get null. We don't want to put in newlines at the start in that case.
     // The currPos.isNotNull() check is needed because positions in non-HTML content
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to