diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
commit | cfd86b747d32ac22246a1aa908eaa720c63a88c1 (patch) | |
tree | 24d68c6f61c464ecba1e05670b80390ea3b0e50c /Source/WebCore/page/FrameView.cpp | |
parent | 69d7c744c9de19d152dbe2d8e46eb7dfd4511d1a (diff) | |
download | qtwebkit-cfd86b747d32ac22246a1aa908eaa720c63a88c1.tar.gz |
Imported WebKit commit 20271caf2e2c016d5cef40184cddeefeac4f1876 (http://svn.webkit.org/repository/webkit/trunk@133733)
New snapshot that contains all previous fixes as well as build fix for latest QtMultimedia API changes.
Diffstat (limited to 'Source/WebCore/page/FrameView.cpp')
-rw-r--r-- | Source/WebCore/page/FrameView.cpp | 112 |
1 files changed, 85 insertions, 27 deletions
diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp index 2d312a31a..29b075cd3 100644 --- a/Source/WebCore/page/FrameView.cpp +++ b/Source/WebCore/page/FrameView.cpp @@ -67,6 +67,7 @@ #include "Settings.h" #include "StyleResolver.h" #include "TextResourceDecoder.h" +#include "TextStream.h" #include <wtf/CurrentTime.h> #include <wtf/TemporaryChange.h> @@ -266,6 +267,7 @@ void FrameView::reset() m_doFullRepaint = true; m_layoutSchedulingEnabled = true; m_inLayout = false; + m_doingPreLayoutStyleUpdate = false; m_inSynchronousPostLayout = false; m_layoutCount = 0; m_nestedLayoutCount = 0; @@ -706,6 +708,10 @@ void FrameView::updateCompositingLayersAfterStyleChange() if (!root) return; + // If we expect to update compositing after an incipient layout, don't do so here. + if (m_doingPreLayoutStyleUpdate || layoutPending() || root->needsLayout()) + return; + // This call will make sure the cached hasAcceleratedCompositing is updated from the pref root->compositor()->cacheAcceleratedCompositingFlags(); root->compositor()->updateCompositingLayers(CompositingUpdateAfterStyleChange); @@ -931,11 +937,6 @@ bool FrameView::isSoftwareRenderable() const void FrameView::didMoveOnscreen() { -#if USE(ACCELERATED_COMPOSITING) - if (TiledBacking* tiledBacking = this->tiledBacking()) - tiledBacking->setIsInWindow(true); -#endif - if (RenderView* root = rootRenderer(this)) root->didMoveOnscreen(); contentAreaDidShow(); @@ -943,11 +944,6 @@ void FrameView::didMoveOnscreen() void FrameView::willMoveOffscreen() { -#if USE(ACCELERATED_COMPOSITING) - if (TiledBacking* tiledBacking = this->tiledBacking()) - tiledBacking->setIsInWindow(false); -#endif - if (RenderView* root = rootRenderer(this)) root->willMoveOffscreen(); contentAreaDidHide(); @@ -1074,6 +1070,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. + TemporaryChange<bool> changeDoingPreLayoutStyleUpdate(m_doingPreLayoutStyleUpdate, true); document->updateStyleIfNeeded(); subtree = m_layoutRoot; @@ -1854,13 +1851,44 @@ void FrameView::repaintFixedElementsAfterScrolling() } } +bool FrameView::shouldUpdateFixedElementsAfterScrolling() +{ +#if ENABLE(THREADED_SCROLLING) + Page* page = m_frame->page(); + if (!page) + return true; + + // If the scrolling thread is updating the fixed elements, then the FrameView should not update them as well. + if (page->mainFrame() != m_frame) + return true; + + ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator(); + if (!scrollingCoordinator) + return true; + + if (!scrollingCoordinator->supportsFixedPositionLayers()) + return true; + + if (scrollingCoordinator->shouldUpdateScrollLayerPositionOnMainThread()) + return true; + + if (inProgrammaticScroll()) + return true; + + return false; +#endif + return true; +} + void FrameView::updateFixedElementsAfterScrolling() { #if USE(ACCELERATED_COMPOSITING) + if (!shouldUpdateFixedElementsAfterScrolling()) + return; + if (m_nestedLayoutCount <= 1 && hasViewportConstrainedObjects()) { - if (RenderView* root = rootRenderer(this)) { + if (RenderView* root = rootRenderer(this)) root->compositor()->updateCompositingLayers(CompositingUpdateOnScroll); - } } #endif } @@ -2500,13 +2528,9 @@ void FrameView::performPostLayoutTasks() } #if USE(ACCELERATED_COMPOSITING) - if (TiledBacking* tiledBacking = this->tiledBacking()) { - if (page) { - if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator()) { - bool shouldLimitTileCoverage = !canHaveScrollbars() || scrollingCoordinator->shouldUpdateScrollLayerPositionOnMainThread(); - tiledBacking->setTileCoverage(shouldLimitTileCoverage ? TiledBacking::CoverageForVisibleArea : TiledBacking::CoverageForScrolling); - } - } + if (RenderView* root = rootRenderer(this)) { + if (root->usesCompositing()) + root->compositor()->frameViewDidLayout(); } #endif @@ -3173,7 +3197,7 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect) if (!frame()) return; - InspectorInstrumentationCookie cookie = InspectorInstrumentation::willPaint(m_frame.get(), p, rect); + InspectorInstrumentationCookie cookie = InspectorInstrumentation::willPaint(m_frame.get()); Document* document = m_frame->document(); @@ -3196,10 +3220,6 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect) p->fillRect(rect, Color(0xFF, 0, 0), ColorSpaceDeviceRGB); #endif - bool isTopLevelPainter = !sCurrentPaintTimeStamp; - if (isTopLevelPainter) - sCurrentPaintTimeStamp = currentTime(); - RenderView* root = rootRenderer(this); if (!root) { LOG_ERROR("called FrameView::paint with nil renderer"); @@ -3210,6 +3230,10 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect) if (needsLayout()) return; + bool isTopLevelPainter = !sCurrentPaintTimeStamp; + if (isTopLevelPainter) + sCurrentPaintTimeStamp = currentTime(); + FontCachePurgePreventer fontCachePurgePreventer; #if USE(ACCELERATED_COMPOSITING) @@ -3242,6 +3266,10 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect) RenderObject* eltRenderer = m_nodeToDraw ? m_nodeToDraw->renderer() : 0; RenderLayer* rootLayer = root->layer(); +#ifndef NDEBUG + RenderObject::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(rootLayer->renderer()); +#endif + rootLayer->paint(p, rect, m_paintBehavior, eltRenderer); if (rootLayer->containsDirtyOverlayScrollbars()) @@ -3264,7 +3292,7 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect) if (isTopLevelPainter) sCurrentPaintTimeStamp = 0; - InspectorInstrumentation::didPaint(cookie); + InspectorInstrumentation::didPaint(cookie, p, rect); } void FrameView::setPaintBehavior(PaintBehavior behavior) @@ -3649,11 +3677,41 @@ void FrameView::setTracksRepaints(bool trackRepaints) { if (trackRepaints == m_isTrackingRepaints) return; - - m_trackedRepaintRects.clear(); + +#if USE(ACCELERATED_COMPOSITING) + for (Frame* frame = m_frame->tree()->top(); frame; frame = frame->tree()->traverseNext()) { + if (RenderView* renderView = frame->contentRenderer()) + renderView->compositor()->setTracksRepaints(trackRepaints); + } +#endif + + resetTrackedRepaints(); m_isTrackingRepaints = trackRepaints; } +void FrameView::resetTrackedRepaints() +{ + m_trackedRepaintRects.clear(); +#if USE(ACCELERATED_COMPOSITING) + if (RenderView* root = rootRenderer(this)) { + RenderLayerCompositor* compositor = root->compositor(); + compositor->resetTrackedRepaintRects(); + } +#endif +} + +String FrameView::trackedRepaintRectsAsText() const +{ + TextStream ts; + if (!m_trackedRepaintRects.isEmpty()) { + ts << "(repaint rects\n"; + for (size_t i = 0; i < m_trackedRepaintRects.size(); ++i) + ts << " (rect " << m_trackedRepaintRects[i].x() << " " << m_trackedRepaintRects[i].y() << " " << m_trackedRepaintRects[i].width() << " " << m_trackedRepaintRects[i].height() << ")\n"; + ts << ")\n"; + } + return ts.release(); +} + void FrameView::addScrollableArea(ScrollableArea* scrollableArea) { if (!m_scrollableAreas) |