WebCore: https://bugs.webkit.org/show_bug.cgi?id=44863, disentangle style recalc...
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Sep 2010 05:59:26 +0000 (05:59 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Sep 2010 05:59:26 +0000 (05:59 +0000)
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):

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

33 files changed:
WebCore/ChangeLog
WebCore/WebCore.exp.in
WebCore/page/FocusController.cpp
WebCore/page/Frame.cpp
WebCore/page/Frame.h
WebCore/page/FrameView.cpp
WebCore/page/FrameView.h
WebCore/page/Page.cpp
WebCore/page/Page.h
WebCore/page/Settings.cpp
WebCore/rendering/RenderTheme.cpp
WebKit/chromium/ChangeLog
WebKit/chromium/src/WebFrameImpl.cpp
WebKit/efl/ChangeLog
WebKit/efl/ewk/ewk_view.cpp
WebKit/gtk/ChangeLog
WebKit/gtk/webkit/webkitwebview.cpp
WebKit/mac/Carbon/HIWebView.mm
WebKit/mac/ChangeLog
WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
WebKit/mac/WebView/WebHTMLView.mm
WebKit/mac/WebView/WebHTMLViewInternal.h
WebKit/mac/WebView/WebView.mm
WebKit/qt/Api/qwebelement.cpp
WebKit/qt/Api/qwebframe.cpp
WebKit/qt/ChangeLog
WebKit/win/ChangeLog
WebKit/win/WebFrame.cpp
WebKit/win/WebView.cpp
WebKit/wx/ChangeLog
WebKit/wx/WebView.cpp
WebKit2/ChangeLog
WebKit2/WebProcess/WebPage/WebPage.cpp

index bfd0bb5..87b5b7d 100644 (file)
@@ -1,3 +1,49 @@
+2010-08-31  Dave Hyatt  <hyatt@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        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.
+
+        * 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):
+
 2010-08-31  Jeremy Moskovich  <jeremy@chromium.org>
 
         Reviewed by Dimitri Glazkov.
index 36fe403..8ad0cb5 100644 (file)
@@ -578,7 +578,6 @@ __ZN7WebCore5Cache13getStatisticsEv
 __ZN7WebCore5Cache13setCapacitiesEjjj
 __ZN7WebCore5Frame10createViewERKNS_7IntSizeERKNS_5ColorEbS3_bNS_13ScrollbarModeEbS7_b
 __ZN7WebCore5Frame10findStringERKN3WTF6StringEbbbb
-__ZN7WebCore5Frame13reapplyStylesEv
 __ZN7WebCore5Frame14frameForWidgetEPKNS_6WidgetE
 __ZN7WebCore5Frame15revealSelectionERKNS_15ScrollAlignmentEb
 __ZN7WebCore5Frame19countMatchesForTextERKN3WTF6StringEbjb
@@ -676,6 +675,8 @@ __ZN7WebCore8Document24setShouldCreateRenderersEb
 __ZN7WebCore8Document26pageSizeAndMarginsInPixelsEiRNS_7IntSizeERiS3_S3_S3_
 __ZN7WebCore8Document27removeMediaCanStartListenerEPNS_21MediaCanStartListenerE
 __ZN7WebCore8Document36updateLayoutIgnorePendingStylesheetsEv
+__ZN7WebCore8Document25scheduleForcedStyleRecalcEv
+__ZN7WebCore8Document20styleSelectorChangedENS_23StyleSelectorUpdateFlagE
 __ZN7WebCore8Document4headEv
 __ZN7WebCore8FormData6createEPKvm
 __ZN7WebCore8FormDataD1Ev
@@ -769,8 +770,8 @@ __ZN7WebCore9FrameView18updateControlTintsEv
 __ZN7WebCore9FrameView20enterCompositingModeEv
 __ZN7WebCore9FrameView21flushDeferredRepaintsEv
 __ZN7WebCore9FrameView22setBaseBackgroundColorENS_5ColorE
-__ZN7WebCore9FrameView23layoutIfNeededRecursiveEv
 __ZN7WebCore9FrameView23updateCanHaveScrollbarsEv
+__ZN7WebCore9FrameView37updateLayoutAndStyleIfNeededRecursiveEv
 __ZN7WebCore9FrameView24forceLayoutForPaginationERKNS_9FloatSizeEfNS_5Frame19AdjustViewSizeOrNotE
 __ZN7WebCore9FrameView29setShouldUpdateWhileOffscreenEb
 __ZN7WebCore9FrameView29syncCompositingStateRecursiveEv
index 84942ce..a87d6a6 100644 (file)
@@ -644,7 +644,7 @@ void FocusController::setActive(bool active)
 
     if (FrameView* view = m_page->mainFrame()->view()) {
         if (!view->platformWidget()) {
-            view->layoutIfNeededRecursive();
+            view->updateLayoutAndStyleIfNeededRecursive();
             view->updateControlTints();
         }
     }
index 3f2a5f5..4628cd5 100644 (file)
@@ -146,7 +146,6 @@ inline Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoader
 #endif
     , m_highlightTextMatches(false)
     , m_inViewSourceMode(false)
-    , m_needsReapplyStyles(false)
     , m_isDisconnected(false)
     , m_excludeFromTextSearch(false)
 {
@@ -630,40 +629,6 @@ void Frame::setPrinting(bool printing, const FloatSize& pageSize, float maximumS
         child->setPrinting(printing, pageSize, maximumShrinkRatio, shouldAdjustViewSize);
 }
 
-void Frame::setNeedsReapplyStyles()
-{
-    // When the frame is not showing web content, it doesn't make sense to apply styles.
-    // If we tried, we'd end up doing things with the document, but the document, if one
-    // exists, is not currently shown and should be in the page cache.
-    if (!m_loader.client()->hasHTMLView())
-        return;
-
-    if (m_needsReapplyStyles)
-        return;
-
-    m_needsReapplyStyles = true;
-
-    // FrameView's "layout" timer includes reapplyStyles, so despite its
-    // name, it's what we want to call here.
-    if (view())
-        view()->scheduleRelayout();
-}
-
-void Frame::reapplyStyles()
-{
-    m_needsReapplyStyles = false;
-
-    // FIXME: This call doesn't really make sense in a function called reapplyStyles.
-    // We should probably eventually move it into its own function.
-    m_doc->docLoader()->setAutoLoadImages(m_page && m_page->settings()->loadsImagesAutomatically());
-
-    // FIXME: It's not entirely clear why the following is needed.
-    // The document automatically does this as required when you set the style sheet.
-    // But we had problems when this code was removed. Details are in
-    // <http://bugs.webkit.org/show_bug.cgi?id=8079>.
-    m_doc->styleSelectorChanged(RecalcStyleImmediately);
-}
-
 void Frame::injectUserScripts(UserScriptInjectionTime injectionTime)
 {
     if (!m_page)
index 198e2e7..eb3cdba 100644 (file)
@@ -164,10 +164,6 @@ namespace WebCore {
         void clearTimers();
         static void clearTimers(FrameView*, Document*);
 
-        void setNeedsReapplyStyles();
-        bool needsReapplyStyles() const;
-        void reapplyStyles();
-
         String documentTypeString() const;
 
         // This method -- and the corresponding list of former DOM windows --
@@ -328,7 +324,6 @@ namespace WebCore {
 
         bool m_highlightTextMatches;
         bool m_inViewSourceMode;
-        bool m_needsReapplyStyles;
         bool m_isDisconnected;
         bool m_excludeFromTextSearch;
 
@@ -397,11 +392,6 @@ namespace WebCore {
         m_mark = s;
     }
 
-    inline bool Frame::needsReapplyStyles() const
-    {
-        return m_needsReapplyStyles;
-    }
-
     inline CSSMutableStyleDeclaration* Frame::typingStyle() const
     {
         return m_typingStyle.get();
index cada64c..d6b55c1 100644 (file)
@@ -523,8 +523,11 @@ bool FrameView::hasCompositedContent() const
 void FrameView::enterCompositingMode()
 {
 #if USE(ACCELERATED_COMPOSITING)
-    if (RenderView* view = m_frame->contentRenderer())
+    if (RenderView* view = m_frame->contentRenderer()) {
         view->compositor()->enableCompositingMode();
+        if (!needsLayout())
+            view->compositor()->scheduleCompositingLayerUpdate();
+    }
 #endif
 }
 
@@ -658,10 +661,7 @@ void FrameView::layout(bool allowSubtree)
 
     // Always ensure our style info is up-to-date.  This can happen in situations where
     // the layout beats any sort of style recalc update that needs to occur.
-    if (m_frame->needsReapplyStyles())
-        m_frame->reapplyStyles();
-    else
-        document->updateStyleIfNeeded();
+    document->updateStyleIfNeeded();
     
     bool subtree = m_layoutRoot;
 
@@ -1444,12 +1444,9 @@ bool FrameView::needsLayout() const
     if (!m_frame)
         return false;
     RenderView* root = m_frame->contentRenderer();
-    Document* document = m_frame->document();
     return layoutPending()
         || (root && root->needsLayout())
         || m_layoutRoot
-        || (document && document->childNeedsStyleRecalc()) // can occur when using WebKit ObjC interface
-        || m_frame->needsReapplyStyles()
         || (m_deferSetNeedsLayouts && m_setNeedsLayoutWasDeferred);
 }
 
@@ -2016,7 +2013,7 @@ void FrameView::setNodeToDraw(Node* node)
     m_nodeToDraw = node;
 }
 
-void FrameView::layoutIfNeededRecursive()
+void FrameView::updateLayoutAndStyleIfNeededRecursive()
 {
     // We have to crawl our entire tree looking for any FrameViews that need
     // layout and make sure they are up to date.
@@ -2027,6 +2024,8 @@ void FrameView::layoutIfNeededRecursive()
     // region but then become included later by the second frame adding rects to the dirty region
     // when it lays out.
 
+    m_frame->document()->updateStyleIfNeeded();
+
     if (needsLayout())
         layout();
 
@@ -2035,10 +2034,10 @@ void FrameView::layoutIfNeededRecursive()
     for (HashSet<RefPtr<Widget> >::const_iterator current = viewChildren->begin(); current != end; ++current) {
         Widget* widget = (*current).get();
         if (widget->isFrameView())
-            static_cast<FrameView*>(widget)->layoutIfNeededRecursive();
+            static_cast<FrameView*>(widget)->updateLayoutAndStyleIfNeededRecursive();
     }
 
-    // layoutIfNeededRecursive is called when we need to make sure layout is up-to-date before
+    // updateLayoutAndStyleIfNeededRecursive is called when we need to make sure style and layout are up-to-date before
     // painting, so we need to flush out any deferred repaints too.
     flushDeferredRepaints();
 }
index 11b5bac..463020a 100644 (file)
@@ -193,7 +193,7 @@ public:
 
     static double currentPaintTimeStamp() { return sCurrentPaintTimeStamp; } // returns 0 if not painting
     
-    void layoutIfNeededRecursive();
+    void updateLayoutAndStyleIfNeededRecursive();
     void flushDeferredRepaints();
 
     void setIsVisuallyNonEmpty() { m_isVisuallyNonEmpty = true; }
index bb6fa50..c407cd1 100644 (file)
@@ -406,14 +406,14 @@ void Page::initGroup()
     m_group = m_singlePageGroup.get();
 }
 
-void Page::setNeedsReapplyStyles()
+void Page::scheduleForcedStyleRecalcForAllPages()
 {
     if (!allPages)
         return;
     HashSet<Page*>::iterator end = allPages->end();
     for (HashSet<Page*>::iterator it = allPages->begin(); it != end; ++it)
         for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext())
-            frame->setNeedsReapplyStyles();
+            frame->document()->scheduleForcedStyleRecalc();
 }
 
 void Page::refreshPlugins(bool reload)
index d9e9255..8f01faa 100644 (file)
@@ -91,7 +91,7 @@ namespace WebCore {
 
     class Page : public Noncopyable {
     public:
-        static void setNeedsReapplyStyles();
+        static void scheduleForcedStyleRecalcForAllPages();
 
         // It is up to the platform to ensure that non-null clients are provided where required.
         struct PageClients {
index 36bcce2..6c70fae 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "BackForwardList.h"
 #include "Database.h"
+#include "DocLoader.h"
 #include "Frame.h"
 #include "FrameTree.h"
 #include "FrameView.h"
@@ -41,10 +42,16 @@ using namespace std;
 
 namespace WebCore {
 
-static void setNeedsReapplyStylesInAllFrames(Page* page)
+static void setNeedsRecalcStyleInAllFrames(Page* page)
 {
     for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
-        frame->setNeedsReapplyStyles();
+        frame->document()->styleSelectorChanged(DeferRecalcStyle);
+}
+
+static void setLoadsImagesAutomaticallyInAllFrames(Page* page)
+{
+    for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
+        frame->document()->docLoader()->setAutoLoadImages(page->settings()->loadsImagesAutomatically());
 }
 
 #if USE(SAFARI_THEME)
@@ -151,7 +158,7 @@ void Settings::setStandardFontFamily(const AtomicString& standardFontFamily)
         return;
 
     m_standardFontFamily = standardFontFamily;
-    setNeedsReapplyStylesInAllFrames(m_page);
+    setNeedsRecalcStyleInAllFrames(m_page);
 }
 
 void Settings::setFixedFontFamily(const AtomicString& fixedFontFamily)
@@ -160,7 +167,7 @@ void Settings::setFixedFontFamily(const AtomicString& fixedFontFamily)
         return;
         
     m_fixedFontFamily = fixedFontFamily;
-    setNeedsReapplyStylesInAllFrames(m_page);
+    setNeedsRecalcStyleInAllFrames(m_page);
 }
 
 void Settings::setSerifFontFamily(const AtomicString& serifFontFamily)
@@ -169,7 +176,7 @@ void Settings::setSerifFontFamily(const AtomicString& serifFontFamily)
         return;
         
     m_serifFontFamily = serifFontFamily;
-    setNeedsReapplyStylesInAllFrames(m_page);
+    setNeedsRecalcStyleInAllFrames(m_page);
 }
 
 void Settings::setSansSerifFontFamily(const AtomicString& sansSerifFontFamily)
@@ -178,7 +185,7 @@ void Settings::setSansSerifFontFamily(const AtomicString& sansSerifFontFamily)
         return;
         
     m_sansSerifFontFamily = sansSerifFontFamily; 
-    setNeedsReapplyStylesInAllFrames(m_page);
+    setNeedsRecalcStyleInAllFrames(m_page);
 }
 
 void Settings::setCursiveFontFamily(const AtomicString& cursiveFontFamily)
@@ -187,7 +194,7 @@ void Settings::setCursiveFontFamily(const AtomicString& cursiveFontFamily)
         return;
         
     m_cursiveFontFamily = cursiveFontFamily;
-    setNeedsReapplyStylesInAllFrames(m_page);
+    setNeedsRecalcStyleInAllFrames(m_page);
 }
 
 void Settings::setFantasyFontFamily(const AtomicString& fantasyFontFamily)
@@ -196,7 +203,7 @@ void Settings::setFantasyFontFamily(const AtomicString& fantasyFontFamily)
         return;
         
     m_fantasyFontFamily = fantasyFontFamily;
-    setNeedsReapplyStylesInAllFrames(m_page);
+    setNeedsRecalcStyleInAllFrames(m_page);
 }
 
 void Settings::setMinimumFontSize(int minimumFontSize)
@@ -205,7 +212,7 @@ void Settings::setMinimumFontSize(int minimumFontSize)
         return;
 
     m_minimumFontSize = minimumFontSize;
-    setNeedsReapplyStylesInAllFrames(m_page);
+    setNeedsRecalcStyleInAllFrames(m_page);
 }
 
 void Settings::setMinimumLogicalFontSize(int minimumLogicalFontSize)
@@ -214,7 +221,7 @@ void Settings::setMinimumLogicalFontSize(int minimumLogicalFontSize)
         return;
 
     m_minimumLogicalFontSize = minimumLogicalFontSize;
-    setNeedsReapplyStylesInAllFrames(m_page);
+    setNeedsRecalcStyleInAllFrames(m_page);
 }
 
 void Settings::setDefaultFontSize(int defaultFontSize)
@@ -223,7 +230,7 @@ void Settings::setDefaultFontSize(int defaultFontSize)
         return;
 
     m_defaultFontSize = defaultFontSize;
-    setNeedsReapplyStylesInAllFrames(m_page);
+    setNeedsRecalcStyleInAllFrames(m_page);
 }
 
 void Settings::setDefaultFixedFontSize(int defaultFontSize)
@@ -232,12 +239,13 @@ void Settings::setDefaultFixedFontSize(int defaultFontSize)
         return;
 
     m_defaultFixedFontSize = defaultFontSize;
-    setNeedsReapplyStylesInAllFrames(m_page);
+    setNeedsRecalcStyleInAllFrames(m_page);
 }
 
 void Settings::setLoadsImagesAutomatically(bool loadsImagesAutomatically)
 {
     m_loadsImagesAutomatically = loadsImagesAutomatically;
+    setLoadsImagesAutomaticallyInAllFrames(m_page);
 }
 
 void Settings::setJavaScriptEnabled(bool isJavaScriptEnabled)
@@ -342,7 +350,7 @@ void Settings::setTextAreasAreResizable(bool textAreasAreResizable)
         return;
 
     m_textAreasAreResizable = textAreasAreResizable;
-    setNeedsReapplyStylesInAllFrames(m_page);
+    setNeedsRecalcStyleInAllFrames(m_page);
 }
 
 void Settings::setEditableLinkBehavior(EditableLinkBehavior editableLinkBehavior)
@@ -442,7 +450,7 @@ void Settings::setAuthorAndUserStylesEnabled(bool authorAndUserStylesEnabled)
         return;
 
     m_authorAndUserStylesEnabled = authorAndUserStylesEnabled;
-    setNeedsReapplyStylesInAllFrames(m_page);
+    setNeedsRecalcStyleInAllFrames(m_page);
 }
 
 void Settings::setFontRenderingMode(FontRenderingMode mode)
@@ -450,7 +458,7 @@ void Settings::setFontRenderingMode(FontRenderingMode mode)
     if (fontRenderingMode() == mode)
         return;
     m_fontRenderingMode = mode;
-    setNeedsReapplyStylesInAllFrames(m_page);
+    setNeedsRecalcStyleInAllFrames(m_page);
 }
 
 FontRenderingMode Settings::fontRenderingMode() const
@@ -509,7 +517,7 @@ void Settings::setZoomMode(ZoomMode mode)
         return;
     
     m_zoomMode = mode;
-    setNeedsReapplyStylesInAllFrames(m_page);
+    setNeedsRecalcStyleInAllFrames(m_page);
 }
 
 void Settings::setEnforceCSSMIMETypeInNoQuirksMode(bool enforceCSSMIMETypeInNoQuirksMode)
@@ -560,7 +568,7 @@ void Settings::setAcceleratedCompositingEnabled(bool enabled)
         return;
         
     m_acceleratedCompositingEnabled = enabled;
-    setNeedsReapplyStylesInAllFrames(m_page);
+    setNeedsRecalcStyleInAllFrames(m_page);
 }
 
 void Settings::setShowDebugBorders(bool enabled)
@@ -569,7 +577,7 @@ void Settings::setShowDebugBorders(bool enabled)
         return;
         
     m_showDebugBorders = enabled;
-    setNeedsReapplyStylesInAllFrames(m_page);
+    setNeedsRecalcStyleInAllFrames(m_page);
 }
 
 void Settings::setShowRepaintCounter(bool enabled)
@@ -578,7 +586,7 @@ void Settings::setShowRepaintCounter(bool enabled)
         return;
         
     m_showRepaintCounter = enabled;
-    setNeedsReapplyStylesInAllFrames(m_page);
+    setNeedsRecalcStyleInAllFrames(m_page);
 }
 
 void Settings::setExperimentalNotificationsEnabled(bool enabled)
index 4d9f47b..6a21514 100644 (file)
@@ -1039,7 +1039,7 @@ void RenderTheme::platformColorsDidChange()
     m_activeListBoxSelectionBackgroundColor = Color();
     m_inactiveListBoxSelectionForegroundColor = Color();
 
-    Page::setNeedsReapplyStyles();
+    Page::scheduleForcedStyleRecalcForAllPages();
 }
 
 Color RenderTheme::systemColor(int cssValueId) const
index c68b9ab..483d181 100644 (file)
@@ -1,3 +1,13 @@
+2010-08-31  Dave Hyatt  <hyatt@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        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.
+
+        * src/WebFrameImpl.cpp:
+        (WebKit::WebFrameImpl::layout):
+
 2010-08-31  Kent Tamura  <tkent@chromium.org>
 
         Reviewed by Dimitri Glazkov.
index 4af7aa2..eb0db7e 100644 (file)
@@ -1816,7 +1816,7 @@ void WebFrameImpl::layout()
     // layout this frame
     FrameView* view = m_frame->view();
     if (view)
-        view->layoutIfNeededRecursive();
+        view->updateLayoutAndStyleIfNeededRecursive();
 }
 
 void WebFrameImpl::paintWithContext(GraphicsContext& gc, const WebRect& rect)
index 538d464..bafa48d 100644 (file)
@@ -1,3 +1,13 @@
+2010-08-31  Dave Hyatt  <hyatt@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        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.
+
+        * ewk/ewk_view.cpp:
+        (ewk_view_layout_if_needed_recursive):
+
 2010-08-31  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Darin Adler.
index 7092d8c..ea54167 100644 (file)
@@ -2850,7 +2850,7 @@ void ewk_view_layout_if_needed_recursive(Ewk_View_Private_Data* priv)
         ERR("no main frame view");
         return;
     }
-    v->layoutIfNeededRecursive();
+    v->updateLayoutAndStyleIfNeededRecursive();
 }
 
 void ewk_view_scrolls_process(Ewk_View_Smart_Data* sd)
index 3a0d780..8098b7f 100644 (file)
@@ -1,3 +1,13 @@
+2010-08-31  Dave Hyatt  <hyatt@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        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.
+
+        * webkit/webkitwebview.cpp:
+        (webkit_web_view_expose_event):
+
 2010-08-31  Martin Robinson  <mrobinson@igalia.com>
 
         Reviewed by Gustavo Noronha Silva.
index 9d71a34..98f8e4e 100644 (file)
@@ -519,7 +519,7 @@ static gboolean webkit_web_view_expose_event(GtkWidget* widget, GdkEventExpose*
 
     Frame* frame = core(webView)->mainFrame();
     if (frame->contentRenderer() && frame->view()) {
-        frame->view()->layoutIfNeededRecursive();
+        frame->view()->updateLayoutAndStyleIfNeededRecursive();
 
         cairo_t* cr = gdk_cairo_create(event->window);
         GraphicsContext ctx(cr);
index dc3ca31..e0fbc2f 100644 (file)
@@ -356,7 +356,7 @@ Draw( HIWebView* inView, RgnHandle limitRgn, CGContextRef inContext )
 
     NSView <WebDocumentView> *documentView = [[[inView->fWebView mainFrame] frameView] documentView];
     if ([documentView isKindOfClass:[WebHTMLView class]])
-        [(WebHTMLView *)documentView _web_layoutIfNeededRecursive];
+        [(WebHTMLView *)documentView _web_updateLayoutAndStyleIfNeededRecursive];
 
     if ( inView->fIsComposited )
         [inView->fWebView displayIfNeededInRect: *(NSRect*)&hiRect];
index 1bfdb6d..1eb0da1 100644 (file)
@@ -1,3 +1,33 @@
+2010-08-31  Dave Hyatt  <hyatt@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        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.
+
+        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]):
+
 2010-08-31  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Darin Adler.
index dcd569d..3f7c471 100644 (file)
@@ -241,8 +241,6 @@ bool WebFrameLoaderClient::hasHTMLView() const
 void WebFrameLoaderClient::forceLayout()
 {
     NSView <WebDocumentView> *view = [m_webFrame->_private->webFrameView documentView];
-    if ([view isKindOfClass:[WebHTMLView class]])
-        [(WebHTMLView *)view setNeedsToApplyStyles:YES];
     [view setNeedsLayout:YES];
     [view layout];
 }
index 8edff95..34745a1 100644 (file)
@@ -443,7 +443,6 @@ struct WebHTMLViewInterpretKeyEventsParameters {
 @interface WebHTMLViewPrivate : NSObject {
 @public
     BOOL closed;
-    BOOL needsToApplyStyles;
     BOOL ignoringMouseDraggedEvents;
     BOOL printing;
     BOOL avoidingPrintOrphan;
@@ -1290,7 +1289,7 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
 - (void)_propagateDirtyRectsToOpaqueAncestors
 {
     if (![[self _webView] drawsBackground])
-        [self _web_layoutIfNeededRecursive];
+        [self _web_updateLayoutAndStyleIfNeededRecursive];
     [super _propagateDirtyRectsToOpaqueAncestors];
 }
 
@@ -1302,7 +1301,7 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
     // So check if the dataSource is nil before calling [self _isTopHTMLView], this can be removed
     // once the FIXME in _isTopHTMLView is fixed.
     if (_private->dataSource && [self _isTopHTMLView])
-        [self _web_layoutIfNeededRecursive];
+        [self _web_updateLayoutAndStyleIfNeededRecursive];
     [super viewWillDraw];
 }
 
@@ -1320,7 +1319,7 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
             [self _web_setPrintingModeRecursive];
 #ifndef BUILDING_ON_TIGER
         else
-            [self _web_layoutIfNeededRecursive];
+            [self _web_updateLayoutAndStyleIfNeededRecursive];
 #endif
     } else if (wasInPrintingMode)
         [self _web_clearPrintingModeRecursive];
@@ -1336,12 +1335,12 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
         [self getRectsBeingDrawn:0 count:&rectCount];
         if (rectCount) {
             LOG_ERROR("View needs layout. Either -viewWillDraw wasn't called or layout was invalidated during the display operation. Performing layout now.");
-            [self _web_layoutIfNeededRecursive];
+            [self _web_updateLayoutAndStyleIfNeededRecursive];
         }
     }
 #else
     // Because Tiger does not have viewWillDraw we need to do layout here.
-    [self _web_layoutIfNeededRecursive];
+    [self _web_updateLayoutAndStyleIfNeededRecursive];
     [_subviews makeObjectsPerformSelector:@selector(_propagateDirtyRectsToOpaqueAncestors)];
 #endif
 
@@ -1373,7 +1372,7 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
                 [self _web_setPrintingModeRecursive];
 #ifndef BUILDING_ON_TIGER
             else
-                [self _web_layoutIfNeededRecursive];
+                [self _web_updateLayoutAndStyleIfNeededRecursive];
 #endif
         } else if (wasInPrintingMode)
             [self _web_clearPrintingModeRecursive];
@@ -1383,7 +1382,7 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
         // Because Tiger does not have viewWillDraw we need to do layout here.
         NSRect boundsBeforeLayout = [self bounds];
         if (!NSIsEmptyRect(visRect))
-            [self _web_layoutIfNeededRecursive];
+            [self _web_updateLayoutAndStyleIfNeededRecursive];
 
         // If layout changes the view's bounds, then we need to recompute the visRect.
         // That's because the visRect passed to us was based on the bounds at the time
@@ -1416,7 +1415,7 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
 {
 #ifdef BUILDING_ON_TIGER 
     // Because Tiger does not have viewWillDraw we need to do layout here.
-    [self _web_layoutIfNeededRecursive];
+    [self _web_updateLayoutAndStyleIfNeededRecursive];
 #endif
 
     [self _setAsideSubviews];
@@ -3117,37 +3116,23 @@ WEBCORE_COMMAND(yankAndSelect)
 
 - (void)reapplyStyles
 {
-    if (!_private->needsToApplyStyles)
-        return;
-    
 #ifdef LOG_TIMES
     double start = CFAbsoluteTimeGetCurrent();
 #endif
 
-    if (Frame* coreFrame = core([self _frame])) {
-        if (FrameView* coreView = coreFrame->view())
-            coreView->setMediaType(_private->printing ? "print" : "screen");
-        if (Document* document = coreFrame->document()) {
-            document->setPaginatedForScreen(_private->paginateScreenContent);
-            document->setPrinting(_private->printing);
-        }
-        coreFrame->reapplyStyles();
-    }
+    if (Frame* coreFrame = core([self _frame]))
+        coreFrame->document()->styleSelectorChanged(RecalcStyleImmediately);
     
 #ifdef LOG_TIMES        
     double thisTime = CFAbsoluteTimeGetCurrent() - start;
     LOG(Timing, "%s apply style seconds = %f", [self URL], thisTime);
 #endif
-
-    _private->needsToApplyStyles = NO;
 }
 
 // Do a layout, but set up a new fixed width for the purposes of doing printing layout.
 // minPageWidth==0 implies a non-printing layout
 - (void)layoutToMinimumPageWidth:(float)minPageWidth height:(float)minPageHeight maximumPageWidth:(float)maxPageWidth adjustingViewSize:(BOOL)adjustViewSize
-{
-    [self reapplyStyles];
-    
+{    
     if (![self _needsLayout])
         return;
 
@@ -3308,7 +3293,13 @@ WEBCORE_COMMAND(yankAndSelect)
 - (void)setNeedsToApplyStyles: (BOOL)flag
 {
     LOG(View, "%@ setNeedsToApplyStyles:%@", self, flag ? @"YES" : @"NO");
-    _private->needsToApplyStyles = flag;
+    if (!flag)
+        return; // There's no way to say you don't need a style recalc.
+    if (Frame* frame = core([self _frame])) {
+        if (frame->document() && frame->document()->inPageCache())
+            return;
+        frame->document()->scheduleForcedStyleRecalc();
+    }
 }
 
 - (void)drawSingleRect:(NSRect)rect
@@ -3883,7 +3874,18 @@ static BOOL isInPasswordField(Frame* coreFrame)
     _private->paginateScreenContent = paginateScreenContent;
     if (!printing && !paginateScreenContent)
         _private->avoidingPrintOrphan = NO;
-    [self setNeedsToApplyStyles:YES];
+    
+    Frame* coreFrame = core([self _frame]);
+    if (coreFrame) {
+        if (FrameView* coreView = coreFrame->view())
+            coreView->setMediaType(_private->printing ? "print" : "screen");
+        if (Document* document = coreFrame->document()) {
+            document->setPaginatedForScreen(_private->paginateScreenContent);
+            document->setPrinting(_private->printing);
+            document->styleSelectorChanged(RecalcStyleImmediately);
+        }
+    }
+
     [self setNeedsLayout:YES];
     [self layoutToMinimumPageWidth:minPageWidth height:minPageHeight maximumPageWidth:maxPageWidth adjustingViewSize:adjustViewSize];
     if (!printing) {
@@ -5507,31 +5509,16 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point)
 {
     ASSERT(!_private->subviewsSetAside);
 
-    if (_private->needsToApplyStyles || [self _needsLayout])
+    if ([self _needsLayout])
         [self layout];
 }
 
-- (void)_web_layoutIfNeededRecursive
+- (void)_web_updateLayoutAndStyleIfNeededRecursive
 {
-    [self _layoutIfNeeded];
-
-#ifndef NDEBUG
-    _private->enumeratingSubviews = YES;
-#endif
-
-    NSMutableArray *descendantWebHTMLViews = [[NSMutableArray alloc] init];
-
-    [self _web_addDescendantWebHTMLViewsToArray:descendantWebHTMLViews];
-
-    unsigned count = [descendantWebHTMLViews count];
-    for (unsigned i = 0; i < count; ++i)
-        [[descendantWebHTMLViews objectAtIndex:i] _layoutIfNeeded];
-
-    [descendantWebHTMLViews release];
-
-#ifndef NDEBUG
-    _private->enumeratingSubviews = NO;
-#endif
+    WebFrame *webFrame = [self _frame];
+    Frame* coreFrame = core(webFrame);
+    if (coreFrame && coreFrame->view())
+        coreFrame->view()->updateLayoutAndStyleIfNeededRecursive();
 }
 
 - (void) _destroyAllWebPlugins
index 3f1f50d..2d9e2a9 100644 (file)
@@ -59,7 +59,7 @@ namespace WebCore {
 #endif
 - (WebCore::CachedImage*)promisedDragTIFFDataSource;
 - (void)setPromisedDragTIFFDataSource:(WebCore::CachedImage*)source;
-- (void)_web_layoutIfNeededRecursive;
+- (void)_web_updateLayoutAndStyleIfNeededRecursive;
 - (void)_destroyAllWebPlugins;
 - (BOOL)_needsLayout;
 
index b4f17e4..f2e76c1 100644 (file)
@@ -842,7 +842,7 @@ static bool shouldEnableLoadDeferring()
 {
     Frame* frame = [self _mainCoreFrame];
     if (frame && frame->view())
-        frame->view()->layoutIfNeededRecursive();
+        frame->view()->updateLayoutAndStyleIfNeededRecursive();
 }
 
 #endif
index 83ee451..f7b1188 100644 (file)
@@ -1446,7 +1446,7 @@ void QWebElement::render(QPainter* painter)
 
     FrameView* view = frame->view();
 
-    view->layoutIfNeededRecursive();
+    view->updateLayoutAndStyleIfNeededRecursive();
 
     IntRect rect = e->getRect();
 
index 1b0c2df..81eabfc 100644 (file)
@@ -286,7 +286,7 @@ void QWebFramePrivate::renderRelativeCoords(GraphicsContext* context, QWebFrame:
     QPainter* painter = context->platformContext();
 
     WebCore::FrameView* view = frame->view();
-    view->layoutIfNeededRecursive();
+    view->updateLayoutAndStyleIfNeededRecursive();
 
     for (int i = 0; i < vector.size(); ++i) {
         const QRect& clipRect = vector.at(i);
index ea56348..284c29b 100644 (file)
@@ -1,3 +1,15 @@
+2010-08-31  Dave Hyatt  <hyatt@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        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.
+
+        * Api/qwebelement.cpp:
+        (QWebElement::render):
+        * Api/qwebframe.cpp:
+        (QWebFramePrivate::renderRelativeCoords):
+
 2010-08-31  Benjamin Poulain  <benjamin.poulain@nokia.com>
 
         Reviewed by Kenneth Rohde Christiansen.
index afbb125..a1bfc4b 100644 (file)
@@ -1,3 +1,15 @@
+2010-08-31  Dave Hyatt  <hyatt@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        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.
+
+        * WebFrame.cpp:
+        (WebFrame::paintDocumentRectToContext):
+        * WebView.cpp:
+        (WebView::updateBackingStore):
+
 2010-08-30  Adam Roben  <aroben@apple.com>
 
         Fix crash on launch on Windows due to changing IWebFramePrivate's
index d0cd1e8..b1ab81c 100644 (file)
@@ -340,7 +340,7 @@ HRESULT STDMETHODCALLTYPE WebFrame::paintDocumentRectToContext(
         return E_FAIL;
 
     // We can't paint with a layout still pending.
-    view->layoutIfNeededRecursive();
+    view->updateLayoutAndStyleIfNeededRecursive();
 
     HDC dc = reinterpret_cast<HDC>(static_cast<ULONG64>(deviceContext));
     GraphicsContext gc(dc);
index c682e91..2daea11 100644 (file)
@@ -910,7 +910,7 @@ void WebView::updateBackingStore(FrameView* frameView, HDC dc, bool backingStore
         // Do a layout first so that everything we render to the backing store is always current.
         if (Frame* coreFrame = core(m_mainFrame))
             if (FrameView* view = coreFrame->view())
-                view->layoutIfNeededRecursive();
+                view->updateLayoutAndStyleIfNeededRecursive();
 
         Vector<IntRect> paintRects;
         if (!backingStoreCompletelyDirty && m_backingStoreDirtyRegion) {
index c111602..757981f 100644 (file)
@@ -1,3 +1,13 @@
+2010-08-31  Dave Hyatt  <hyatt@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        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.
+
+        * WebView.cpp:
+        (wxWebView::OnPaint):
+
 2010-08-28  Kevin Ollivier  <kevino@theolliviers.com>
 
         [wx] Build fix after parseMode -> compatibilityMode rename.
index d0be9cb..5980236 100644 (file)
@@ -684,7 +684,7 @@ void wxWebView::OnPaint(wxPaintEvent& event)
             WebCore::GraphicsContext gc(&dc);
 #endif
             if (frame->contentRenderer()) {
-                frame->view()->layoutIfNeededRecursive();
+                frame->view()->updateLayoutAndStyleIfNeededRecursive();
                 frame->view()->paint(&gc, paintRect);
             }
         }
index d6df3e1..8c5f505 100644 (file)
@@ -1,3 +1,12 @@
+2010-08-31  Dave Hyatt  <hyatt@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        https://bugs.webkit.org/show_bug.cgi?id=44863
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::layoutIfNeeded):
+
 2010-08-31  Jon Honeycutt  <jhoneycutt@apple.com>
 
         Fix some copy/paste errors.
index 7f6fdc6..dbd54d0 100644 (file)
@@ -277,7 +277,7 @@ void WebPage::goToBackForwardItem(uint64_t backForwardItemID)
 void WebPage::layoutIfNeeded()
 {
     if (m_mainFrame->coreFrame()->view())
-        m_mainFrame->coreFrame()->view()->layoutIfNeededRecursive();
+        m_mainFrame->coreFrame()->view()->updateLayoutAndStyleIfNeededRecursive();
 }
 
 void WebPage::setSize(const WebCore::IntSize& viewSize)