Changeset 126164 in webkit


Ignore:
Timestamp:
Aug 21, 2012 9:43:56 AM (12 years ago)
Author:
mitz@apple.com
Message:

<rdar://problem/12104508> TextIterator takes O(n2) 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.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r126162 r126164  
     12012-08-21  Dan Bernstein  <mitz@apple.com>
     2
     3        <rdar://problem/12104508> TextIterator takes O(n^2) to iterate over n empty blocks
     4        https://bugs.webkit.org/show_bug.cgi?id=94429
     5
     6        Reviewed by Sam Weinig.
     7
     8        No new tests, because behavior is unchanged.
     9
     10        * editing/TextIterator.cpp:
     11        (WebCore::TextIterator::shouldRepresentNodeOffsetZero): Enhanced the check for nodes that
     12        cannot contain VisiblePosition to also check for zero-height blocks.
     13
    1142012-08-21  'Pavel Feldman'  <pfeldman@chromium.org>
    215
  • trunk/Source/WebCore/editing/TextIterator.cpp

    r121933 r126164  
    11/*
    2  * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
    33 * Copyright (C) 2005 Alexey Proskuryakov.
    44 *
     
    894894    // Additionally, if the range we are iterating over contains huge sections of unrendered content,
    895895    // we would create VisiblePositions on every call to this function without this check.
    896     if (!m_node->renderer() || m_node->renderer()->style()->visibility() != VISIBLE)
     896    if (!m_node->renderer() || m_node->renderer()->style()->visibility() != VISIBLE
     897        || (m_node->renderer()->isBlockFlow() && !toRenderBlock(m_node->renderer())->height() && !m_node->hasTagName(bodyTag)))
    897898        return false;
    898    
     899
    899900    // The startPos.isNotNull() check is needed because the start could be before the body,
    900901    // and in that case we'll get null. We don't want to put in newlines at the start in that case.
Note: See TracChangeset for help on using the changeset viewer.