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

Changeset 240372 in webkit


Ignore:
Timestamp:
Jan 23, 2019, 5:20:56 PM (8 years ago)
Author:
Alan Coon
Message:

Cherry-pick r239971. rdar://problem/47458229

Only run the node comparison code in FrameSelection::respondToNodeModification() for range selections
​https://bugs.webkit.org/show_bug.cgi?id=193416

Reviewed by Wenson Hsieh.

The code inside the m_selection.firstRange() clause needs to only run for non-collapsed selections, and
it shows up on Speedometer profiles so optimize to only run this code if we have a selection range.

  • editing/FrameSelection.cpp: (WebCore::FrameSelection::respondToNodeModification):

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

Location:
branches/safari-607-branch/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-607-branch/Source/WebCore/ChangeLog

    r240286 r240372  
     12019-01-23  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r239971. rdar://problem/47458229
     4
     5    Only run the node comparison code in FrameSelection::respondToNodeModification() for range selections
     6    https://bugs.webkit.org/show_bug.cgi?id=193416
     7   
     8    Reviewed by Wenson Hsieh.
     9   
     10    The code inside the m_selection.firstRange() clause needs to only run for non-collapsed selections, and
     11    it shows up on Speedometer profiles so optimize to only run this code if we have a selection range.
     12   
     13    * editing/FrameSelection.cpp:
     14    (WebCore::FrameSelection::respondToNodeModification):
     15   
     16   
     17    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239971 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     18
     19    2019-01-14  Simon Fraser  <simon.fraser@apple.com>
     20
     21            Only run the node comparison code in FrameSelection::respondToNodeModification() for range selections
     22            https://bugs.webkit.org/show_bug.cgi?id=193416
     23
     24            Reviewed by Wenson Hsieh.
     25
     26            The code inside the m_selection.firstRange() clause needs to only run for non-collapsed selections, and
     27            it shows up on Speedometer profiles so optimize to only run this code if we have a selection range.
     28
     29            * editing/FrameSelection.cpp:
     30            (WebCore::FrameSelection::respondToNodeModification):
     31
    1322019-01-22  Alan Coon  <alancoon@apple.com>
    233
  • branches/safari-607-branch/Source/WebCore/editing/FrameSelection.cpp

    r238522 r240372  
    514514        else
    515515            m_selection.setWithoutValidation(m_selection.end(), m_selection.start());
    516     } else if (RefPtr<Range> range = m_selection.firstRange()) {
    517         auto compareNodeResult = range->compareNode(node);
    518         if (!compareNodeResult.hasException()) {
    519             auto compareResult = compareNodeResult.releaseReturnValue();
    520             if (compareResult == Range::NODE_BEFORE_AND_AFTER || compareResult == Range::NODE_INSIDE) {
    521                 // If we did nothing here, when this node's renderer was destroyed, the rect that it
    522                 // occupied would be invalidated, but, selection gaps that change as a result of
    523                 // the removal wouldn't be invalidated.
    524                 // FIXME: Don't do so much unnecessary invalidation.
    525                 clearRenderTreeSelection = true;
     516    } else if (isRange()) {
     517        if (RefPtr<Range> range = m_selection.firstRange()) {
     518            auto compareNodeResult = range->compareNode(node);
     519            if (!compareNodeResult.hasException()) {
     520                auto compareResult = compareNodeResult.releaseReturnValue();
     521                if (compareResult == Range::NODE_BEFORE_AND_AFTER || compareResult == Range::NODE_INSIDE) {
     522                    // If we did nothing here, when this node's renderer was destroyed, the rect that it
     523                    // occupied would be invalidated, but, selection gaps that change as a result of
     524                    // the removal wouldn't be invalidated.
     525                    // FIXME: Don't do so much unnecessary invalidation.
     526                    clearRenderTreeSelection = true;
     527                }
    526528            }
    527529        }
Note: See TracChangeset for help on using the changeset viewer.