Changeset 52494 in webkit


Ignore:
Timestamp:
Dec 22, 2009 11:26:29 AM (14 years ago)
Author:
Darin Adler
Message:

Reentrancy problem with selection in some edge cases.
https://bugs.webkit.org/show_bug.cgi?id=32842
rdar://problem/7449974

Reviewed by Sam Weinig.

WebCore:

Test: fast/forms/selection-layout-reentry-strange-case.html

Move the selection display update process done in the
selectionLayoutChanged function into the layout timer
instead of doing it immediately when selection changes occur.

  • editing/SelectionController.cpp:

(WebCore::SelectionController::SelectionController):
Initialize m_needsDisplayUpdate to false.
(WebCore::SelectionController::setSelection): Call
the new setNeedsDisplayUpdate function instead of the old
badly named Frame::selectionLayoutChanged function.
(WebCore::SelectionController::setNeedsDisplayUpdate):
Set m_needsDisplayUpdate. If it is just becoming true, then
call FrameView::scheduleRelayout.

  • editing/SelectionController.h: Added setNeedsDisplayUpdate,

needsDisplayUpdate, and m_needsDisplayUpdate.

  • page/Frame.cpp:

(WebCore::Frame::setCaretVisible): Call setNeedsDisplayUpdate.
(WebCore::Frame::selectionLayoutChanged): Call
setNeedsDisplayUpdate to set it to false, since this is the
function that performs "selection display update". Later I want
to rename this function.

  • page/FrameView.cpp:

(WebCore::FrameView::needsLayout): Add a new clause, since
we need a call to layout if needsDisplayUpdate is true.

LayoutTests:

  • fast/forms/selection-layout-reentry-strange-case-expected.txt: Added.
  • fast/forms/selection-layout-reentry-strange-case.html: Added.
  • platform/mac/accessibility/frame-with-title-expected.txt: Updated since

the number of layouts is now different.

Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r52485 r52494  
     12009-12-21  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Reentrancy problem with selection in some edge cases.
     6        https://bugs.webkit.org/show_bug.cgi?id=32842
     7        rdar://problem/7449974
     8
     9        * fast/forms/selection-layout-reentry-strange-case-expected.txt: Added.
     10        * fast/forms/selection-layout-reentry-strange-case.html: Added.
     11
     12        * platform/mac/accessibility/frame-with-title-expected.txt: Updated since
     13        the number of layouts is now different.
     14
    1152009-12-21  Csaba Osztrogonác  <ossy@webkit.org>
    216
  • trunk/LayoutTests/platform/mac/accessibility/frame-with-title-expected.txt

    r42465 r52494  
    2222AXLinkUIElements: <array of size 0>
    2323AXLoaded: 1
    24 AXLayoutCount: 3
     24AXLayoutCount: 4
    2525AXURL: about:blank
    2626
     
    4949AXLinkUIElements: <array of size 0>
    5050AXLoaded: 1
    51 AXLayoutCount: 4
     51AXLayoutCount: 5
    5252AXURL: about:blank
    5353
  • trunk/WebCore/ChangeLog

    r52492 r52494  
     12009-12-21  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Reentrancy problem with selection in some edge cases.
     6        https://bugs.webkit.org/show_bug.cgi?id=32842
     7        rdar://problem/7449974
     8
     9        Test: fast/forms/selection-layout-reentry-strange-case.html
     10
     11        Move the selection display update process done in the
     12        selectionLayoutChanged function into the layout timer
     13        instead of doing it immediately when selection changes occur.
     14
     15        * editing/SelectionController.cpp:
     16        (WebCore::SelectionController::SelectionController):
     17        Initialize m_needsDisplayUpdate to false.
     18        (WebCore::SelectionController::setSelection): Call
     19        the new setNeedsDisplayUpdate function instead of the old
     20        badly named Frame::selectionLayoutChanged function.
     21        (WebCore::SelectionController::setNeedsDisplayUpdate):
     22        Set m_needsDisplayUpdate. If it is just becoming true, then
     23        call FrameView::scheduleRelayout.
     24
     25        * editing/SelectionController.h: Added setNeedsDisplayUpdate,
     26        needsDisplayUpdate, and m_needsDisplayUpdate.
     27
     28        * page/Frame.cpp:
     29        (WebCore::Frame::setCaretVisible): Call setNeedsDisplayUpdate.
     30        (WebCore::Frame::selectionLayoutChanged): Call
     31        setNeedsDisplayUpdate to set it to false, since this is the
     32        function that performs "selection display update". Later I want
     33        to rename this function.
     34
     35        * page/FrameView.cpp:
     36        (WebCore::FrameView::needsLayout): Add a new clause, since
     37        we need a call to layout if needsDisplayUpdate is true.
     38
    1392009-12-22  Kwang Yul Seo  <skyul@company100.net>
    240
  • trunk/WebCore/editing/SelectionController.cpp

    r52451 r52494  
    11/*
    2  * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2004, 2008, 2009 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    7171    , m_isCaretBlinkingSuspended(false)
    7272    , m_focused(frame && frame->page() && frame->page()->focusController()->focusedFrame() == frame)
     73    , m_needsDisplayUpdate(false)
    7374{
    7475}
     
    146147        m_frame->setFocusedNodeIfNeeded();
    147148   
    148     m_frame->selectionLayoutChanged();
     149    setNeedsDisplayUpdate();
     150
    149151    // Always clear the x position used for vertical arrow navigation.
    150152    // It will be restored by the vertical arrow navigation code if necessary.
     
    13021304}
    13031305
     1306void SelectionController::setNeedsDisplayUpdate(bool needsUpdate)
     1307{
     1308    if (m_needsDisplayUpdate == needsUpdate)
     1309        return;
     1310    m_needsDisplayUpdate = needsUpdate;
     1311
     1312    if (!m_needsDisplayUpdate)
     1313        return;
     1314    FrameView* view = m_frame->view();
     1315    if (!view)
     1316        return;
     1317    view->scheduleRelayout();
     1318}
     1319
    13041320#ifndef NDEBUG
    13051321
  • trunk/WebCore/editing/SelectionController.h

    r52451 r52494  
    11/*
    2  * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2004, 2009 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    125125    void pageActivationChanged();
    126126
     127    // Selection display machinery
     128    void setNeedsDisplayUpdate(bool = true);
     129    bool needsDisplayUpdate() const { return m_needsDisplayUpdate; }
     130
    127131#ifndef NDEBUG
    128132    void formatForDebugger(char* buffer, unsigned length) const;
     
    175179    bool m_isCaretBlinkingSuspended : 1;
    176180    bool m_focused : 1;
    177 
     181    bool m_needsDisplayUpdate : 1;
    178182};
    179183
  • trunk/WebCore/page/Frame.cpp

    r52314 r52494  
    564564    clearCaretRectIfNeeded();
    565565    m_caretVisible = flag;
    566     selectionLayoutChanged();
     566    selection()->setNeedsDisplayUpdate();
    567567}
    568568
     
    631631void Frame::selectionLayoutChanged()
    632632{
     633    selection()->setNeedsDisplayUpdate(false);
     634
    633635    bool caretRectChanged = selection()->recomputeCaretRect();
    634636
  • trunk/WebCore/page/FrameView.cpp

    r52314 r52494  
    11991199        || (document && document->childNeedsStyleRecalc()) // can occur when using WebKit ObjC interface
    12001200        || m_frame->needsReapplyStyles()
    1201         || (m_deferSetNeedsLayouts && m_setNeedsLayoutWasDeferred);
     1201        || (m_deferSetNeedsLayouts && m_setNeedsLayoutWasDeferred)
     1202        || m_frame->selection()->needsDisplayUpdate();
    12021203}
    12031204
Note: See TracChangeset for help on using the changeset viewer.