Changeset 66577 in webkit


Ignore:
Timestamp:
Aug 31, 2010 10:59:26 PM (14 years ago)
Author:
hyatt@apple.com
Message:

WebCore: https://bugs.webkit.org/show_bug.cgi?id=44863, disentangle style recalc from layout, so that
the former can occur in more places without having to do the latter.

Reviewed by Sam Weinig.

  • WebCore.exp.in:
  • page/FocusController.cpp:

(WebCore::FocusController::setActive):

  • page/Frame.cpp:

(WebCore::Frame::Frame):

  • page/Frame.h:
  • page/FrameView.cpp:

(WebCore::FrameView::enterCompositingMode):
(WebCore::FrameView::layout):
(WebCore::FrameView::needsLayout):
(WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive):

  • page/FrameView.h:
  • page/Page.cpp:

(WebCore::Page::scheduleForcedStyleRecalcForAllPages):

  • page/Page.h:
  • page/Settings.cpp:

(WebCore::setNeedsRecalcStyleInAllFrames):
(WebCore::setLoadsImagesAutomaticallyInAllFrames):
(WebCore::Settings::setStandardFontFamily):
(WebCore::Settings::setFixedFontFamily):
(WebCore::Settings::setSerifFontFamily):
(WebCore::Settings::setSansSerifFontFamily):
(WebCore::Settings::setCursiveFontFamily):
(WebCore::Settings::setFantasyFontFamily):
(WebCore::Settings::setMinimumFontSize):
(WebCore::Settings::setMinimumLogicalFontSize):
(WebCore::Settings::setDefaultFontSize):
(WebCore::Settings::setDefaultFixedFontSize):
(WebCore::Settings::setLoadsImagesAutomatically):
(WebCore::Settings::setTextAreasAreResizable):
(WebCore::Settings::setAuthorAndUserStylesEnabled):
(WebCore::Settings::setFontRenderingMode):
(WebCore::Settings::setZoomMode):
(WebCore::Settings::setAcceleratedCompositingEnabled):
(WebCore::Settings::setShowDebugBorders):
(WebCore::Settings::setShowRepaintCounter):

  • rendering/RenderTheme.cpp:

(WebCore::RenderTheme::platformColorsDidChange):

WebKit/chromium: https://bugs.webkit.org/show_bug.cgi?id=44863, disentangle style recalc from layout, so that
the former can occur in more places without having to do the latter.

Reviewed by Sam Weinig.

  • src/WebFrameImpl.cpp:

(WebKit::WebFrameImpl::layout):

WebKit/efl: https://bugs.webkit.org/show_bug.cgi?id=44863, disentangle style recalc from layout, so that
the former can occur in more places without having to do the latter.

Reviewed by Sam Weinig.

  • ewk/ewk_view.cpp:

(ewk_view_layout_if_needed_recursive):

WebKit/gtk: https://bugs.webkit.org/show_bug.cgi?id=44863, disentangle style recalc from layout, so that
the former can occur in more places without having to do the latter.

Reviewed by Sam Weinig.

  • webkit/webkitwebview.cpp:

(webkit_web_view_expose_event):

WebKit/mac: https://bugs.webkit.org/show_bug.cgi?id=44863, disentangle style recalc from layout, so that
the former can occur in more places without having to do the latter.

Reviewed by Sam Weinig.

Eliminate Mac-specific code for style re-application and recursive layout/style updating in
favor of the cross-platform code that all the other ports use.

  • Carbon/HIWebView.mm:

(Draw):

  • WebCoreSupport/WebFrameLoaderClient.mm:

(WebFrameLoaderClient::forceLayout):

  • WebView/WebHTMLView.mm:

(-[WebHTMLView _propagateDirtyRectsToOpaqueAncestors]):
(-[WebHTMLView viewWillDraw]):
(-[WebHTMLView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]):
(-[WebHTMLView _recursiveDisplayAllDirtyWithLockFocus:visRect:]):
(-[WebHTMLView _recursive:displayRectIgnoringOpacity:inContext:topView:]):
(-[WebHTMLView reapplyStyles]):
(-[WebHTMLView layoutToMinimumPageWidth:height:maximumPageWidth:adjustingViewSize:]):
(-[WebHTMLView setNeedsToApplyStyles:]):
(-[WebHTMLView _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize:paginateScreenContent:]):
(-[WebHTMLView _layoutIfNeeded]):
(-[WebHTMLView _web_updateLayoutAndStyleIfNeededRecursive]):

  • WebView/WebHTMLViewInternal.h:
  • WebView/WebView.mm:

(-[WebView _viewWillDrawInternal]):

WebKit/qt: https://bugs.webkit.org/show_bug.cgi?id=44863, disentangle style recalc from layout, so that
the former can occur in more places without having to do the latter.

Reviewed by Sam Weinig.

  • Api/qwebelement.cpp:

(QWebElement::render):

  • Api/qwebframe.cpp:

(QWebFramePrivate::renderRelativeCoords):

WebKit/win: https://bugs.webkit.org/show_bug.cgi?id=44863, disentangle style recalc from layout, so that
the former can occur in more places without having to do the latter.

Reviewed by Sam Weinig.

  • WebFrame.cpp:

(WebFrame::paintDocumentRectToContext):

  • WebView.cpp:

(WebView::updateBackingStore):

WebKit/wx: https://bugs.webkit.org/show_bug.cgi?id=44863, disentangle style recalc from layout, so that
the former can occur in more places without having to do the latter.

Reviewed by Sam Weinig.

  • WebView.cpp:

(wxWebView::OnPaint):

WebKit2: https://bugs.webkit.org/show_bug.cgi?id=44863

Reviewed by Sam Weinig.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::layoutIfNeeded):

Location:
trunk
Files:
33 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r66574 r66577  
     12010-08-31  Dave Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=44863, disentangle style recalc from layout, so that
     6        the former can occur in more places without having to do the latter.
     7
     8        * WebCore.exp.in:
     9        * page/FocusController.cpp:
     10        (WebCore::FocusController::setActive):
     11        * page/Frame.cpp:
     12        (WebCore::Frame::Frame):
     13        * page/Frame.h:
     14        * page/FrameView.cpp:
     15        (WebCore::FrameView::enterCompositingMode):
     16        (WebCore::FrameView::layout):
     17        (WebCore::FrameView::needsLayout):
     18        (WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive):
     19        * page/FrameView.h:
     20        * page/Page.cpp:
     21        (WebCore::Page::scheduleForcedStyleRecalcForAllPages):
     22        * page/Page.h:
     23        * page/Settings.cpp:
     24        (WebCore::setNeedsRecalcStyleInAllFrames):
     25        (WebCore::setLoadsImagesAutomaticallyInAllFrames):
     26        (WebCore::Settings::setStandardFontFamily):
     27        (WebCore::Settings::setFixedFontFamily):
     28        (WebCore::Settings::setSerifFontFamily):
     29        (WebCore::Settings::setSansSerifFontFamily):
     30        (WebCore::Settings::setCursiveFontFamily):
     31        (WebCore::Settings::setFantasyFontFamily):
     32        (WebCore::Settings::setMinimumFontSize):
     33        (WebCore::Settings::setMinimumLogicalFontSize):
     34        (WebCore::Settings::setDefaultFontSize):
     35        (WebCore::Settings::setDefaultFixedFontSize):
     36        (WebCore::Settings::setLoadsImagesAutomatically):
     37        (WebCore::Settings::setTextAreasAreResizable):
     38        (WebCore::Settings::setAuthorAndUserStylesEnabled):
     39        (WebCore::Settings::setFontRenderingMode):
     40        (WebCore::Settings::setZoomMode):
     41        (WebCore::Settings::setAcceleratedCompositingEnabled):
     42        (WebCore::Settings::setShowDebugBorders):
     43        (WebCore::Settings::setShowRepaintCounter):
     44        * rendering/RenderTheme.cpp:
     45        (WebCore::RenderTheme::platformColorsDidChange):
     46
    1472010-08-31  Jeremy Moskovich  <jeremy@chromium.org>
    248
  • trunk/WebCore/WebCore.exp.in

    r66550 r66577  
    579579__ZN7WebCore5Frame10createViewERKNS_7IntSizeERKNS_5ColorEbS3_bNS_13ScrollbarModeEbS7_b
    580580__ZN7WebCore5Frame10findStringERKN3WTF6StringEbbbb
    581 __ZN7WebCore5Frame13reapplyStylesEv
    582581__ZN7WebCore5Frame14frameForWidgetEPKNS_6WidgetE
    583582__ZN7WebCore5Frame15revealSelectionERKNS_15ScrollAlignmentEb
     
    677676__ZN7WebCore8Document27removeMediaCanStartListenerEPNS_21MediaCanStartListenerE
    678677__ZN7WebCore8Document36updateLayoutIgnorePendingStylesheetsEv
     678__ZN7WebCore8Document25scheduleForcedStyleRecalcEv
     679__ZN7WebCore8Document20styleSelectorChangedENS_23StyleSelectorUpdateFlagE
    679680__ZN7WebCore8Document4headEv
    680681__ZN7WebCore8FormData6createEPKvm
     
    770771__ZN7WebCore9FrameView21flushDeferredRepaintsEv
    771772__ZN7WebCore9FrameView22setBaseBackgroundColorENS_5ColorE
    772 __ZN7WebCore9FrameView23layoutIfNeededRecursiveEv
    773773__ZN7WebCore9FrameView23updateCanHaveScrollbarsEv
     774__ZN7WebCore9FrameView37updateLayoutAndStyleIfNeededRecursiveEv
    774775__ZN7WebCore9FrameView24forceLayoutForPaginationERKNS_9FloatSizeEfNS_5Frame19AdjustViewSizeOrNotE
    775776__ZN7WebCore9FrameView29setShouldUpdateWhileOffscreenEb
  • trunk/WebCore/page/FocusController.cpp

    r66284 r66577  
    645645    if (FrameView* view = m_page->mainFrame()->view()) {
    646646        if (!view->platformWidget()) {
    647             view->layoutIfNeededRecursive();
     647            view->updateLayoutAndStyleIfNeededRecursive();
    648648            view->updateControlTints();
    649649        }
  • trunk/WebCore/page/Frame.cpp

    r66544 r66577  
    147147    , m_highlightTextMatches(false)
    148148    , m_inViewSourceMode(false)
    149     , m_needsReapplyStyles(false)
    150149    , m_isDisconnected(false)
    151150    , m_excludeFromTextSearch(false)
     
    631630}
    632631
    633 void Frame::setNeedsReapplyStyles()
    634 {
    635     // When the frame is not showing web content, it doesn't make sense to apply styles.
    636     // If we tried, we'd end up doing things with the document, but the document, if one
    637     // exists, is not currently shown and should be in the page cache.
    638     if (!m_loader.client()->hasHTMLView())
    639         return;
    640 
    641     if (m_needsReapplyStyles)
    642         return;
    643 
    644     m_needsReapplyStyles = true;
    645 
    646     // FrameView's "layout" timer includes reapplyStyles, so despite its
    647     // name, it's what we want to call here.
    648     if (view())
    649         view()->scheduleRelayout();
    650 }
    651 
    652 void Frame::reapplyStyles()
    653 {
    654     m_needsReapplyStyles = false;
    655 
    656     // FIXME: This call doesn't really make sense in a function called reapplyStyles.
    657     // We should probably eventually move it into its own function.
    658     m_doc->docLoader()->setAutoLoadImages(m_page && m_page->settings()->loadsImagesAutomatically());
    659 
    660     // FIXME: It's not entirely clear why the following is needed.
    661     // The document automatically does this as required when you set the style sheet.
    662     // But we had problems when this code was removed. Details are in
    663     // <http://bugs.webkit.org/show_bug.cgi?id=8079>.
    664     m_doc->styleSelectorChanged(RecalcStyleImmediately);
    665 }
    666 
    667632void Frame::injectUserScripts(UserScriptInjectionTime injectionTime)
    668633{
  • trunk/WebCore/page/Frame.h

    r66544 r66577  
    165165        static void clearTimers(FrameView*, Document*);
    166166
    167         void setNeedsReapplyStyles();
    168         bool needsReapplyStyles() const;
    169         void reapplyStyles();
    170 
    171167        String documentTypeString() const;
    172168
     
    329325        bool m_highlightTextMatches;
    330326        bool m_inViewSourceMode;
    331         bool m_needsReapplyStyles;
    332327        bool m_isDisconnected;
    333328        bool m_excludeFromTextSearch;
     
    398393    }
    399394
    400     inline bool Frame::needsReapplyStyles() const
    401     {
    402         return m_needsReapplyStyles;
    403     }
    404 
    405395    inline CSSMutableStyleDeclaration* Frame::typingStyle() const
    406396    {
  • trunk/WebCore/page/FrameView.cpp

    r66555 r66577  
    524524{
    525525#if USE(ACCELERATED_COMPOSITING)
    526     if (RenderView* view = m_frame->contentRenderer())
     526    if (RenderView* view = m_frame->contentRenderer()) {
    527527        view->compositor()->enableCompositingMode();
     528        if (!needsLayout())
     529            view->compositor()->scheduleCompositingLayerUpdate();
     530    }
    528531#endif
    529532}
     
    659662    // Always ensure our style info is up-to-date.  This can happen in situations where
    660663    // the layout beats any sort of style recalc update that needs to occur.
    661     if (m_frame->needsReapplyStyles())
    662         m_frame->reapplyStyles();
    663     else
    664         document->updateStyleIfNeeded();
     664    document->updateStyleIfNeeded();
    665665   
    666666    bool subtree = m_layoutRoot;
     
    14451445        return false;
    14461446    RenderView* root = m_frame->contentRenderer();
    1447     Document* document = m_frame->document();
    14481447    return layoutPending()
    14491448        || (root && root->needsLayout())
    14501449        || m_layoutRoot
    1451         || (document && document->childNeedsStyleRecalc()) // can occur when using WebKit ObjC interface
    1452         || m_frame->needsReapplyStyles()
    14531450        || (m_deferSetNeedsLayouts && m_setNeedsLayoutWasDeferred);
    14541451}
     
    20172014}
    20182015
    2019 void FrameView::layoutIfNeededRecursive()
     2016void FrameView::updateLayoutAndStyleIfNeededRecursive()
    20202017{
    20212018    // We have to crawl our entire tree looking for any FrameViews that need
     
    20282025    // when it lays out.
    20292026
     2027    m_frame->document()->updateStyleIfNeeded();
     2028
    20302029    if (needsLayout())
    20312030        layout();
     
    20362035        Widget* widget = (*current).get();
    20372036        if (widget->isFrameView())
    2038             static_cast<FrameView*>(widget)->layoutIfNeededRecursive();
    2039     }
    2040 
    2041     // layoutIfNeededRecursive is called when we need to make sure layout is up-to-date before
     2037            static_cast<FrameView*>(widget)->updateLayoutAndStyleIfNeededRecursive();
     2038    }
     2039
     2040    // updateLayoutAndStyleIfNeededRecursive is called when we need to make sure style and layout are up-to-date before
    20422041    // painting, so we need to flush out any deferred repaints too.
    20432042    flushDeferredRepaints();
  • trunk/WebCore/page/FrameView.h

    r66555 r66577  
    194194    static double currentPaintTimeStamp() { return sCurrentPaintTimeStamp; } // returns 0 if not painting
    195195   
    196     void layoutIfNeededRecursive();
     196    void updateLayoutAndStyleIfNeededRecursive();
    197197    void flushDeferredRepaints();
    198198
  • trunk/WebCore/page/Page.cpp

    r66544 r66577  
    407407}
    408408
    409 void Page::setNeedsReapplyStyles()
     409void Page::scheduleForcedStyleRecalcForAllPages()
    410410{
    411411    if (!allPages)
     
    414414    for (HashSet<Page*>::iterator it = allPages->begin(); it != end; ++it)
    415415        for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext())
    416             frame->setNeedsReapplyStyles();
     416            frame->document()->scheduleForcedStyleRecalc();
    417417}
    418418
  • trunk/WebCore/page/Page.h

    r64845 r66577  
    9292    class Page : public Noncopyable {
    9393    public:
    94         static void setNeedsReapplyStyles();
     94        static void scheduleForcedStyleRecalcForAllPages();
    9595
    9696        // It is up to the platform to ensure that non-null clients are provided where required.
  • trunk/WebCore/page/Settings.cpp

    r66570 r66577  
    2929#include "BackForwardList.h"
    3030#include "Database.h"
     31#include "DocLoader.h"
    3132#include "Frame.h"
    3233#include "FrameTree.h"
     
    4243namespace WebCore {
    4344
    44 static void setNeedsReapplyStylesInAllFrames(Page* page)
     45static void setNeedsRecalcStyleInAllFrames(Page* page)
    4546{
    4647    for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
    47         frame->setNeedsReapplyStyles();
     48        frame->document()->styleSelectorChanged(DeferRecalcStyle);
     49}
     50
     51static void setLoadsImagesAutomaticallyInAllFrames(Page* page)
     52{
     53    for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
     54        frame->document()->docLoader()->setAutoLoadImages(page->settings()->loadsImagesAutomatically());
    4855}
    4956
     
    152159
    153160    m_standardFontFamily = standardFontFamily;
    154     setNeedsReapplyStylesInAllFrames(m_page);
     161    setNeedsRecalcStyleInAllFrames(m_page);
    155162}
    156163
     
    161168       
    162169    m_fixedFontFamily = fixedFontFamily;
    163     setNeedsReapplyStylesInAllFrames(m_page);
     170    setNeedsRecalcStyleInAllFrames(m_page);
    164171}
    165172
     
    170177       
    171178    m_serifFontFamily = serifFontFamily;
    172     setNeedsReapplyStylesInAllFrames(m_page);
     179    setNeedsRecalcStyleInAllFrames(m_page);
    173180}
    174181
     
    179186       
    180187    m_sansSerifFontFamily = sansSerifFontFamily;
    181     setNeedsReapplyStylesInAllFrames(m_page);
     188    setNeedsRecalcStyleInAllFrames(m_page);
    182189}
    183190
     
    188195       
    189196    m_cursiveFontFamily = cursiveFontFamily;
    190     setNeedsReapplyStylesInAllFrames(m_page);
     197    setNeedsRecalcStyleInAllFrames(m_page);
    191198}
    192199
     
    197204       
    198205    m_fantasyFontFamily = fantasyFontFamily;
    199     setNeedsReapplyStylesInAllFrames(m_page);
     206    setNeedsRecalcStyleInAllFrames(m_page);
    200207}
    201208
     
    206213
    207214    m_minimumFontSize = minimumFontSize;
    208     setNeedsReapplyStylesInAllFrames(m_page);
     215    setNeedsRecalcStyleInAllFrames(m_page);
    209216}
    210217
     
    215222
    216223    m_minimumLogicalFontSize = minimumLogicalFontSize;
    217     setNeedsReapplyStylesInAllFrames(m_page);
     224    setNeedsRecalcStyleInAllFrames(m_page);
    218225}
    219226
     
    224231
    225232    m_defaultFontSize = defaultFontSize;
    226     setNeedsReapplyStylesInAllFrames(m_page);
     233    setNeedsRecalcStyleInAllFrames(m_page);
    227234}
    228235
     
    233240
    234241    m_defaultFixedFontSize = defaultFontSize;
    235     setNeedsReapplyStylesInAllFrames(m_page);
     242    setNeedsRecalcStyleInAllFrames(m_page);
    236243}
    237244
     
    239246{
    240247    m_loadsImagesAutomatically = loadsImagesAutomatically;
     248    setLoadsImagesAutomaticallyInAllFrames(m_page);
    241249}
    242250
     
    343351
    344352    m_textAreasAreResizable = textAreasAreResizable;
    345     setNeedsReapplyStylesInAllFrames(m_page);
     353    setNeedsRecalcStyleInAllFrames(m_page);
    346354}
    347355
     
    443451
    444452    m_authorAndUserStylesEnabled = authorAndUserStylesEnabled;
    445     setNeedsReapplyStylesInAllFrames(m_page);
     453    setNeedsRecalcStyleInAllFrames(m_page);
    446454}
    447455
     
    451459        return;
    452460    m_fontRenderingMode = mode;
    453     setNeedsReapplyStylesInAllFrames(m_page);
     461    setNeedsRecalcStyleInAllFrames(m_page);
    454462}
    455463
     
    510518   
    511519    m_zoomMode = mode;
    512     setNeedsReapplyStylesInAllFrames(m_page);
     520    setNeedsRecalcStyleInAllFrames(m_page);
    513521}
    514522
     
    561569       
    562570    m_acceleratedCompositingEnabled = enabled;
    563     setNeedsReapplyStylesInAllFrames(m_page);
     571    setNeedsRecalcStyleInAllFrames(m_page);
    564572}
    565573
     
    570578       
    571579    m_showDebugBorders = enabled;
    572     setNeedsReapplyStylesInAllFrames(m_page);
     580    setNeedsRecalcStyleInAllFrames(m_page);
    573581}
    574582
     
    579587       
    580588    m_showRepaintCounter = enabled;
    581     setNeedsReapplyStylesInAllFrames(m_page);
     589    setNeedsRecalcStyleInAllFrames(m_page);
    582590}
    583591
  • trunk/WebCore/rendering/RenderTheme.cpp

    r64634 r66577  
    10401040    m_inactiveListBoxSelectionForegroundColor = Color();
    10411041
    1042     Page::setNeedsReapplyStyles();
     1042    Page::scheduleForcedStyleRecalcForAllPages();
    10431043}
    10441044
  • trunk/WebKit/chromium/ChangeLog

    r66576 r66577  
     12010-08-31  Dave Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=44863, disentangle style recalc from layout, so that
     6        the former can occur in more places without having to do the latter.
     7
     8        * src/WebFrameImpl.cpp:
     9        (WebKit::WebFrameImpl::layout):
     10
    1112010-08-31  Kent Tamura  <tkent@chromium.org>
    212
  • trunk/WebKit/chromium/src/WebFrameImpl.cpp

    r66180 r66577  
    18171817    FrameView* view = m_frame->view();
    18181818    if (view)
    1819         view->layoutIfNeededRecursive();
     1819        view->updateLayoutAndStyleIfNeededRecursive();
    18201820}
    18211821
  • trunk/WebKit/efl/ChangeLog

    r66544 r66577  
     12010-08-31  Dave Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=44863, disentangle style recalc from layout, so that
     6        the former can occur in more places without having to do the latter.
     7
     8        * ewk/ewk_view.cpp:
     9        (ewk_view_layout_if_needed_recursive):
     10
    1112010-08-31  Sam Weinig  <sam@webkit.org>
    212
  • trunk/WebKit/efl/ewk/ewk_view.cpp

    r66377 r66577  
    28512851        return;
    28522852    }
    2853     v->layoutIfNeededRecursive();
     2853    v->updateLayoutAndStyleIfNeededRecursive();
    28542854}
    28552855
  • trunk/WebKit/gtk/ChangeLog

    r66531 r66577  
     12010-08-31  Dave Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=44863, disentangle style recalc from layout, so that
     6        the former can occur in more places without having to do the latter.
     7
     8        * webkit/webkitwebview.cpp:
     9        (webkit_web_view_expose_event):
     10
    1112010-08-31  Martin Robinson  <mrobinson@igalia.com>
    212
  • trunk/WebKit/gtk/webkit/webkitwebview.cpp

    r66520 r66577  
    520520    Frame* frame = core(webView)->mainFrame();
    521521    if (frame->contentRenderer() && frame->view()) {
    522         frame->view()->layoutIfNeededRecursive();
     522        frame->view()->updateLayoutAndStyleIfNeededRecursive();
    523523
    524524        cairo_t* cr = gdk_cairo_create(event->window);
  • trunk/WebKit/mac/Carbon/HIWebView.mm

    r66441 r66577  
    357357    NSView <WebDocumentView> *documentView = [[[inView->fWebView mainFrame] frameView] documentView];
    358358    if ([documentView isKindOfClass:[WebHTMLView class]])
    359         [(WebHTMLView *)documentView _web_layoutIfNeededRecursive];
     359        [(WebHTMLView *)documentView _web_updateLayoutAndStyleIfNeededRecursive];
    360360
    361361    if ( inView->fIsComposited )
  • trunk/WebKit/mac/ChangeLog

    r66544 r66577  
     12010-08-31  Dave Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=44863, disentangle style recalc from layout, so that
     6        the former can occur in more places without having to do the latter.
     7
     8        Eliminate Mac-specific code for style re-application and recursive layout/style updating in
     9        favor of the cross-platform code that all the other ports use.
     10
     11        * Carbon/HIWebView.mm:
     12        (Draw):
     13        * WebCoreSupport/WebFrameLoaderClient.mm:
     14        (WebFrameLoaderClient::forceLayout):
     15        * WebView/WebHTMLView.mm:
     16        (-[WebHTMLView _propagateDirtyRectsToOpaqueAncestors]):
     17        (-[WebHTMLView viewWillDraw]):
     18        (-[WebHTMLView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]):
     19        (-[WebHTMLView _recursiveDisplayAllDirtyWithLockFocus:visRect:]):
     20        (-[WebHTMLView _recursive:displayRectIgnoringOpacity:inContext:topView:]):
     21        (-[WebHTMLView reapplyStyles]):
     22        (-[WebHTMLView layoutToMinimumPageWidth:height:maximumPageWidth:adjustingViewSize:]):
     23        (-[WebHTMLView setNeedsToApplyStyles:]):
     24        (-[WebHTMLView _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize:paginateScreenContent:]):
     25        (-[WebHTMLView _layoutIfNeeded]):
     26        (-[WebHTMLView _web_updateLayoutAndStyleIfNeededRecursive]):
     27        * WebView/WebHTMLViewInternal.h:
     28        * WebView/WebView.mm:
     29        (-[WebView _viewWillDrawInternal]):
     30
    1312010-08-31  Sam Weinig  <sam@webkit.org>
    232
  • trunk/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm

    r66437 r66577  
    242242{
    243243    NSView <WebDocumentView> *view = [m_webFrame->_private->webFrameView documentView];
    244     if ([view isKindOfClass:[WebHTMLView class]])
    245         [(WebHTMLView *)view setNeedsToApplyStyles:YES];
    246244    [view setNeedsLayout:YES];
    247245    [view layout];
  • trunk/WebKit/mac/WebView/WebHTMLView.mm

    r66544 r66577  
    444444@public
    445445    BOOL closed;
    446     BOOL needsToApplyStyles;
    447446    BOOL ignoringMouseDraggedEvents;
    448447    BOOL printing;
     
    12911290{
    12921291    if (![[self _webView] drawsBackground])
    1293         [self _web_layoutIfNeededRecursive];
     1292        [self _web_updateLayoutAndStyleIfNeededRecursive];
    12941293    [super _propagateDirtyRectsToOpaqueAncestors];
    12951294}
     
    13031302    // once the FIXME in _isTopHTMLView is fixed.
    13041303    if (_private->dataSource && [self _isTopHTMLView])
    1305         [self _web_layoutIfNeededRecursive];
     1304        [self _web_updateLayoutAndStyleIfNeededRecursive];
    13061305    [super viewWillDraw];
    13071306}
     
    13211320#ifndef BUILDING_ON_TIGER
    13221321        else
    1323             [self _web_layoutIfNeededRecursive];
     1322            [self _web_updateLayoutAndStyleIfNeededRecursive];
    13241323#endif
    13251324    } else if (wasInPrintingMode)
     
    13371336        if (rectCount) {
    13381337            LOG_ERROR("View needs layout. Either -viewWillDraw wasn't called or layout was invalidated during the display operation. Performing layout now.");
    1339             [self _web_layoutIfNeededRecursive];
     1338            [self _web_updateLayoutAndStyleIfNeededRecursive];
    13401339        }
    13411340    }
    13421341#else
    13431342    // Because Tiger does not have viewWillDraw we need to do layout here.
    1344     [self _web_layoutIfNeededRecursive];
     1343    [self _web_updateLayoutAndStyleIfNeededRecursive];
    13451344    [_subviews makeObjectsPerformSelector:@selector(_propagateDirtyRectsToOpaqueAncestors)];
    13461345#endif
     
    13741373#ifndef BUILDING_ON_TIGER
    13751374            else
    1376                 [self _web_layoutIfNeededRecursive];
     1375                [self _web_updateLayoutAndStyleIfNeededRecursive];
    13771376#endif
    13781377        } else if (wasInPrintingMode)
     
    13841383        NSRect boundsBeforeLayout = [self bounds];
    13851384        if (!NSIsEmptyRect(visRect))
    1386             [self _web_layoutIfNeededRecursive];
     1385            [self _web_updateLayoutAndStyleIfNeededRecursive];
    13871386
    13881387        // If layout changes the view's bounds, then we need to recompute the visRect.
     
    14171416#ifdef BUILDING_ON_TIGER
    14181417    // Because Tiger does not have viewWillDraw we need to do layout here.
    1419     [self _web_layoutIfNeededRecursive];
     1418    [self _web_updateLayoutAndStyleIfNeededRecursive];
    14201419#endif
    14211420
     
    31183117- (void)reapplyStyles
    31193118{
    3120     if (!_private->needsToApplyStyles)
    3121         return;
    3122    
    31233119#ifdef LOG_TIMES
    31243120    double start = CFAbsoluteTimeGetCurrent();
    31253121#endif
    31263122
    3127     if (Frame* coreFrame = core([self _frame])) {
    3128         if (FrameView* coreView = coreFrame->view())
    3129             coreView->setMediaType(_private->printing ? "print" : "screen");
    3130         if (Document* document = coreFrame->document()) {
    3131             document->setPaginatedForScreen(_private->paginateScreenContent);
    3132             document->setPrinting(_private->printing);
    3133         }
    3134         coreFrame->reapplyStyles();
    3135     }
     3123    if (Frame* coreFrame = core([self _frame]))
     3124        coreFrame->document()->styleSelectorChanged(RecalcStyleImmediately);
    31363125   
    31373126#ifdef LOG_TIMES       
     
    31393128    LOG(Timing, "%s apply style seconds = %f", [self URL], thisTime);
    31403129#endif
    3141 
    3142     _private->needsToApplyStyles = NO;
    31433130}
    31443131
     
    31463133// minPageWidth==0 implies a non-printing layout
    31473134- (void)layoutToMinimumPageWidth:(float)minPageWidth height:(float)minPageHeight maximumPageWidth:(float)maxPageWidth adjustingViewSize:(BOOL)adjustViewSize
    3148 {
    3149     [self reapplyStyles];
    3150    
     3135{   
    31513136    if (![self _needsLayout])
    31523137        return;
     
    33093294{
    33103295    LOG(View, "%@ setNeedsToApplyStyles:%@", self, flag ? @"YES" : @"NO");
    3311     _private->needsToApplyStyles = flag;
     3296    if (!flag)
     3297        return; // There's no way to say you don't need a style recalc.
     3298    if (Frame* frame = core([self _frame])) {
     3299        if (frame->document() && frame->document()->inPageCache())
     3300            return;
     3301        frame->document()->scheduleForcedStyleRecalc();
     3302    }
    33123303}
    33133304
     
    38843875    if (!printing && !paginateScreenContent)
    38853876        _private->avoidingPrintOrphan = NO;
    3886     [self setNeedsToApplyStyles:YES];
     3877   
     3878    Frame* coreFrame = core([self _frame]);
     3879    if (coreFrame) {
     3880        if (FrameView* coreView = coreFrame->view())
     3881            coreView->setMediaType(_private->printing ? "print" : "screen");
     3882        if (Document* document = coreFrame->document()) {
     3883            document->setPaginatedForScreen(_private->paginateScreenContent);
     3884            document->setPrinting(_private->printing);
     3885            document->styleSelectorChanged(RecalcStyleImmediately);
     3886        }
     3887    }
     3888
    38873889    [self setNeedsLayout:YES];
    38883890    [self layoutToMinimumPageWidth:minPageWidth height:minPageHeight maximumPageWidth:maxPageWidth adjustingViewSize:adjustViewSize];
     
    55085510    ASSERT(!_private->subviewsSetAside);
    55095511
    5510     if (_private->needsToApplyStyles || [self _needsLayout])
     5512    if ([self _needsLayout])
    55115513        [self layout];
    55125514}
    55135515
    5514 - (void)_web_layoutIfNeededRecursive
    5515 {
    5516     [self _layoutIfNeeded];
    5517 
    5518 #ifndef NDEBUG
    5519     _private->enumeratingSubviews = YES;
    5520 #endif
    5521 
    5522     NSMutableArray *descendantWebHTMLViews = [[NSMutableArray alloc] init];
    5523 
    5524     [self _web_addDescendantWebHTMLViewsToArray:descendantWebHTMLViews];
    5525 
    5526     unsigned count = [descendantWebHTMLViews count];
    5527     for (unsigned i = 0; i < count; ++i)
    5528         [[descendantWebHTMLViews objectAtIndex:i] _layoutIfNeeded];
    5529 
    5530     [descendantWebHTMLViews release];
    5531 
    5532 #ifndef NDEBUG
    5533     _private->enumeratingSubviews = NO;
    5534 #endif
     5516- (void)_web_updateLayoutAndStyleIfNeededRecursive
     5517{
     5518    WebFrame *webFrame = [self _frame];
     5519    Frame* coreFrame = core(webFrame);
     5520    if (coreFrame && coreFrame->view())
     5521        coreFrame->view()->updateLayoutAndStyleIfNeededRecursive();
    55355522}
    55365523
  • trunk/WebKit/mac/WebView/WebHTMLViewInternal.h

    r47349 r66577  
    6060- (WebCore::CachedImage*)promisedDragTIFFDataSource;
    6161- (void)setPromisedDragTIFFDataSource:(WebCore::CachedImage*)source;
    62 - (void)_web_layoutIfNeededRecursive;
     62- (void)_web_updateLayoutAndStyleIfNeededRecursive;
    6363- (void)_destroyAllWebPlugins;
    6464- (BOOL)_needsLayout;
  • trunk/WebKit/mac/WebView/WebView.mm

    r66544 r66577  
    843843    Frame* frame = [self _mainCoreFrame];
    844844    if (frame && frame->view())
    845         frame->view()->layoutIfNeededRecursive();
     845        frame->view()->updateLayoutAndStyleIfNeededRecursive();
    846846}
    847847
  • trunk/WebKit/qt/Api/qwebelement.cpp

    r66057 r66577  
    14471447    FrameView* view = frame->view();
    14481448
    1449     view->layoutIfNeededRecursive();
     1449    view->updateLayoutAndStyleIfNeededRecursive();
    14501450
    14511451    IntRect rect = e->getRect();
  • trunk/WebKit/qt/Api/qwebframe.cpp

    r65999 r66577  
    287287
    288288    WebCore::FrameView* view = frame->view();
    289     view->layoutIfNeededRecursive();
     289    view->updateLayoutAndStyleIfNeededRecursive();
    290290
    291291    for (int i = 0; i < vector.size(); ++i) {
  • trunk/WebKit/qt/ChangeLog

    r66565 r66577  
     12010-08-31  Dave Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=44863, disentangle style recalc from layout, so that
     6        the former can occur in more places without having to do the latter.
     7
     8        * Api/qwebelement.cpp:
     9        (QWebElement::render):
     10        * Api/qwebframe.cpp:
     11        (QWebFramePrivate::renderRelativeCoords):
     12
    1132010-08-31  Benjamin Poulain  <benjamin.poulain@nokia.com>
    214
  • trunk/WebKit/win/ChangeLog

    r66438 r66577  
     12010-08-31  Dave Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=44863, disentangle style recalc from layout, so that
     6        the former can occur in more places without having to do the latter.
     7
     8        * WebFrame.cpp:
     9        (WebFrame::paintDocumentRectToContext):
     10        * WebView.cpp:
     11        (WebView::updateBackingStore):
     12
    1132010-08-30  Adam Roben  <aroben@apple.com>
    214
  • trunk/WebKit/win/WebFrame.cpp

    r65787 r66577  
    341341
    342342    // We can't paint with a layout still pending.
    343     view->layoutIfNeededRecursive();
     343    view->updateLayoutAndStyleIfNeededRecursive();
    344344
    345345    HDC dc = reinterpret_cast<HDC>(static_cast<ULONG64>(deviceContext));
  • trunk/WebKit/win/WebView.cpp

    r65952 r66577  
    911911        if (Frame* coreFrame = core(m_mainFrame))
    912912            if (FrameView* view = coreFrame->view())
    913                 view->layoutIfNeededRecursive();
     913                view->updateLayoutAndStyleIfNeededRecursive();
    914914
    915915        Vector<IntRect> paintRects;
  • trunk/WebKit/wx/ChangeLog

    r66314 r66577  
     12010-08-31  Dave Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=44863, disentangle style recalc from layout, so that
     6        the former can occur in more places without having to do the latter.
     7
     8        * WebView.cpp:
     9        (wxWebView::OnPaint):
     10
    1112010-08-28  Kevin Ollivier  <kevino@theolliviers.com>
    212
  • trunk/WebKit/wx/WebView.cpp

    r66314 r66577  
    685685#endif
    686686            if (frame->contentRenderer()) {
    687                 frame->view()->layoutIfNeededRecursive();
     687                frame->view()->updateLayoutAndStyleIfNeededRecursive();
    688688                frame->view()->paint(&gc, paintRect);
    689689            }
  • trunk/WebKit2/ChangeLog

    r66558 r66577  
     12010-08-31  Dave Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=44863
     6
     7        * WebProcess/WebPage/WebPage.cpp:
     8        (WebKit::WebPage::layoutIfNeeded):
     9
    1102010-08-31  Jon Honeycutt  <jhoneycutt@apple.com>
    211
  • trunk/WebKit2/WebProcess/WebPage/WebPage.cpp

    r66551 r66577  
    278278{
    279279    if (m_mainFrame->coreFrame()->view())
    280         m_mainFrame->coreFrame()->view()->layoutIfNeededRecursive();
     280        m_mainFrame->coreFrame()->view()->updateLayoutAndStyleIfNeededRecursive();
    281281}
    282282
Note: See TracChangeset for help on using the changeset viewer.