⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 155378 in webkit


Ignore:
Timestamp:
Sep 9, 2013, 1:28:39 PM (13 years ago)
Author:
rniwa@webkit.org
Message:

Internals should always cause a layout before calling into TextIterator
https://bugs.webkit.org/show_bug.cgi?id=120891

Reviewed by Antti Koivisto.

Source/WebCore:

Inspired by https://chromium.googlesource.com/chromium/blink/+/5fee5da7b04a710171c79bd6e87eca3533188e45.

Force a layout in the constructors of TextIterator, and SimplifiedBackwardsTextIterator and remove
superfluous calls to updateLayout() in other places.

As much as I hate for a constructor to have a side effect like this, I couldn't think of a better place
to update the layout. Unfortunately, we're slowly moving away from manually createing TextIterator and
wrapping them in a static function.

  • editing/TextIterator.cpp:

(WebCore::TextIterator::TextIterator):
(WebCore::SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator):
(WebCore::TextIterator::rangeFromLocationAndLength):
(WebCore::findPlainText):

LayoutTests:

Progression.

  • platform/mac/editing/input/caret-primary-bidi-expected.txt:
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r155369 r155378  
     12013-09-06  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Internals should always cause a layout before calling into TextIterator
     4        https://bugs.webkit.org/show_bug.cgi?id=120891
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Progression.
     9
     10        * platform/mac/editing/input/caret-primary-bidi-expected.txt:
     11
    1122013-09-09  Mark Lam  <mark.lam@apple.com>
    213
  • trunk/LayoutTests/platform/mac/editing/input/caret-primary-bidi-expected.txt

    r153060 r155378  
    1 0: 124,508,0,28
     10: 8,564,0,28
    221: 21,564,0,28
    332: 36,564,0,28
  • trunk/Source/WebCore/ChangeLog

    r155377 r155378  
     12013-09-06  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Internals should always cause a layout before calling into TextIterator
     4        https://bugs.webkit.org/show_bug.cgi?id=120891
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Inspired by https://chromium.googlesource.com/chromium/blink/+/5fee5da7b04a710171c79bd6e87eca3533188e45.
     9
     10        Force a layout in the constructors of TextIterator, and SimplifiedBackwardsTextIterator and remove
     11        superfluous calls to updateLayout() in other places.
     12
     13        As much as I hate for a constructor to have a side effect like this, I couldn't think of a better place
     14        to update the layout. Unfortunately, we're slowly moving away from manually createing TextIterator and
     15        wrapping them in a static function.
     16
     17        * editing/TextIterator.cpp:
     18        (WebCore::TextIterator::TextIterator):
     19        (WebCore::SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator):
     20        (WebCore::TextIterator::rangeFromLocationAndLength):
     21        (WebCore::findPlainText):
     22
    1232013-09-09  David Hyatt  <hyatt@apple.com>
    224
  • trunk/Source/WebCore/editing/TextIterator.cpp

    r155366 r155378  
    293293    if (!r)
    294294        return;
     295
     296    r->ownerDocument().updateLayoutIgnorePendingStylesheets();
    295297
    296298    // get and validate the range endpoints
     
    11181120    if (!r)
    11191121        return;
     1122
     1123    r->ownerDocument().updateLayoutIgnorePendingStylesheets();
    11201124
    11211125    Node* startNode = r->startContainer();
     
    24282432            // position for emitted '\n's.
    24292433            if (len == 1 && it.characterAt(0) == '\n') {
    2430                 scope->document().updateLayoutIgnorePendingStylesheets();
    24312434                it.advance();
    24322435                if (!it.atEnd()) {
     
    25942597PassRefPtr<Range> findPlainText(const Range* range, const String& target, FindOptions options)
    25952598{
    2596     // CharacterIterator requires renderers to be up-to-date
    2597     range->ownerDocument().updateLayout();
    2598 
    25992599    // First, find the text.
    26002600    size_t matchStart;
Note: See TracChangeset for help on using the changeset viewer.