Commit 72d30d8b authored by bdakin@apple.com's avatar bdakin@apple.com

Need a LayoutMilestone to fire when we have done our first paint after suppressing

incremental layout
https://bugs.webkit.org/show_bug.cgi?id=115330
-and corresponding-
<rdar://problem/12722365>

Reviewed by Simon Fraser.

Source/WebCore: 

To meet the needs of all of our clients, we really need two milestones. One 
indicating that a layout has happened after setVisualUpdatesAllowed(true), and 
another indicating that painting has happened.

If layout is needed when setVisualUpdatesAllowed(true) is called, we need to 
update it so that we can guarantee the first paint is really happening at this 
time. Also fire the DidFirstLayoutAfterSuppressedIncrementalRendering milestone, 
and call add DidFirstPaintAfterSuppressedIncrementalRendering to the FrameView's 
pending paint milestones. 
up the painting milestone.
* dom/Document.cpp:
(WebCore::Document::setVisualUpdatesAllowed):

FrameView now stores m_milestonesPendingPaint. We'll send and clear them once we 
have painted.
* page/FrameView.cpp:
(WebCore::FrameView::FrameView):
(WebCore::FrameView::paintContents):
(WebCore::FrameView::addPaintPendingMilestones):
(WebCore::FrameView::firePaintRelatedMilestones):
* page/FrameView.h:
(WebCore::FrameView::milestonesPendingPaint):

Two new milestones.
* page/LayoutMilestones.h:
(WebCore):

We don't need m_headerLayerAwaitingFirstFlush anymore since we can use FrameView's 
pending paint milestones instead.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::RenderLayerCompositor):
(WebCore::RenderLayerCompositor::flushPendingLayerChanges):
(WebCore::RenderLayerCompositor::updateLayerForHeader):
* rendering/RenderLayerCompositor.h:
(RenderLayerCompositor):

Source/WebKit2: 

Two new millstones.
* Shared/API/c/WKPageLoadTypes.h:
* Shared/API/c/WKSharedAPICast.h:
(WebKit::toWKLayoutMilestones):
(WebKit::toLayoutMilestones):

This null-check is necessary now since this code ends up running at 
WebFrame::init() time while we're setting up the Document. 
setVisualUpdatesAllowed(true) has always been called as a part of that process, 
and now the updateLayout(), ends up calling this code too, but we don't actually 
have a mainFrame yet since it's still being created.
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::findLargestFrameInFrameSet):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149317 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b3071aad
2013-04-29 Beth Dakin <bdakin@apple.com>
Need a LayoutMilestone to fire when we have done our first paint after suppressing
incremental layout
https://bugs.webkit.org/show_bug.cgi?id=115330
-and corresponding-
<rdar://problem/12722365>
Reviewed by Simon Fraser.
To meet the needs of all of our clients, we really need two milestones. One
indicating that a layout has happened after setVisualUpdatesAllowed(true), and
another indicating that painting has happened.
If layout is needed when setVisualUpdatesAllowed(true) is called, we need to
update it so that we can guarantee the first paint is really happening at this
time. Also fire the DidFirstLayoutAfterSuppressedIncrementalRendering milestone,
and call add DidFirstPaintAfterSuppressedIncrementalRendering to the FrameView's
pending paint milestones.
up the painting milestone.
* dom/Document.cpp:
(WebCore::Document::setVisualUpdatesAllowed):
FrameView now stores m_milestonesPendingPaint. We'll send and clear them once we
have painted.
* page/FrameView.cpp:
(WebCore::FrameView::FrameView):
(WebCore::FrameView::paintContents):
(WebCore::FrameView::addPaintPendingMilestones):
(WebCore::FrameView::firePaintRelatedMilestones):
* page/FrameView.h:
(WebCore::FrameView::milestonesPendingPaint):
Two new milestones.
* page/LayoutMilestones.h:
(WebCore):
We don't need m_headerLayerAwaitingFirstFlush anymore since we can use FrameView's
pending paint milestones instead.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::RenderLayerCompositor):
(WebCore::RenderLayerCompositor::flushPendingLayerChanges):
(WebCore::RenderLayerCompositor::updateLayerForHeader):
* rendering/RenderLayerCompositor.h:
(RenderLayerCompositor):
2013-04-29 David Hyatt <hyatt@apple.com>
[Mac] Links can't be hovered or clicked with overlay scrollbars hidden.
......
......@@ -1289,10 +1289,14 @@ void Document::setVisualUpdatesAllowed(bool visualUpdatesAllowed)
FrameView* frameView = view();
bool needsLayout = frameView && renderer() && (frameView->layoutPending() || renderer()->needsLayout());
if (needsLayout) {
// There might be a layout pending, so make sure we don't update the screen with bogus data.
// The layout will actually update the compositing layers and repaint if needed.
return;
if (needsLayout)
updateLayout();
if (Page* page = this->page()) {
if (frame() == page->mainFrame())
frameView->addPaintPendingMilestones(DidFirstPaintAfterSuppressedIncrementalRendering);
if (page->requestedLayoutMilestones() & DidFirstLayoutAfterSuppressedIncrementalRendering)
frame()->loader()->didLayout(DidFirstLayoutAfterSuppressedIncrementalRendering);
}
#if USE(ACCELERATED_COMPOSITING)
......@@ -1300,8 +1304,8 @@ void Document::setVisualUpdatesAllowed(bool visualUpdatesAllowed)
view()->updateCompositingLayersAfterLayout();
#endif
if (renderer())
renderer()->repaint();
if (RenderView* renderView = this->renderView())
renderView->repaintViewAndCompositedLayers();
}
void Document::visualUpdatesSuppressionTimerFired(Timer<Document>*)
......
......@@ -198,6 +198,7 @@ FrameView::FrameView(Frame* frame)
, m_didRunAutosize(false)
, m_headerHeight(0)
, m_footerHeight(0)
, m_milestonesPendingPaint(0)
#if ENABLE(CSS_FILTERS)
, m_hasSoftwareFilters(false)
#endif
......@@ -3559,6 +3560,7 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect)
sCurrentPaintTimeStamp = 0;
InspectorInstrumentation::didPaint(renderView, p, rect);
firePaintRelatedMilestones();
}
void FrameView::setPaintBehavior(PaintBehavior behavior)
......@@ -4128,4 +4130,36 @@ void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
}
}
void FrameView::addPaintPendingMilestones(LayoutMilestones milestones)
{
m_milestonesPendingPaint |= milestones;
}
void FrameView::firePaintRelatedMilestones()
{
Page* page = m_frame->page();
if (!page)
return;
LayoutMilestones milestonesAchieved = 0;
// Make sure the pending paint milestones have actually been requested before we send them.
if (m_milestonesPendingPaint & DidFirstFlushForHeaderLayer) {
if (page->requestedLayoutMilestones() & DidFirstFlushForHeaderLayer)
milestonesAchieved |= DidFirstFlushForHeaderLayer;
}
if (m_milestonesPendingPaint & DidFirstPaintAfterSuppressedIncrementalRendering) {
if (page->requestedLayoutMilestones() & DidFirstPaintAfterSuppressedIncrementalRendering)
milestonesAchieved |= DidFirstPaintAfterSuppressedIncrementalRendering;
}
m_milestonesPendingPaint = 0;
if (milestonesAchieved) {
if (Frame* frame = page->mainFrame())
frame->loader()->didLayout(milestonesAchieved);
}
}
} // namespace WebCore
......@@ -421,6 +421,10 @@ public:
virtual void willStartLiveResize() OVERRIDE;
virtual void willEndLiveResize() OVERRIDE;
void addPaintPendingMilestones(LayoutMilestones);
void firePaintRelatedMilestones();
LayoutMilestones milestonesPendingPaint() const { return m_milestonesPendingPaint; }
protected:
virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
virtual void scrollContentsSlowPath(const IntRect& updateRect);
......@@ -621,6 +625,8 @@ private:
int m_headerHeight;
int m_footerHeight;
LayoutMilestones m_milestonesPendingPaint;
static double s_normalDeferredRepaintDelay;
static double s_initialDeferredRepaintDelayDuringLoading;
static double s_maxDeferredRepaintDelayDuringLoading;
......
......@@ -28,11 +28,16 @@
namespace WebCore {
// FIXME: Some of these milestones are about layout, and others are about painting.
// We should either re-name them to something more generic, or split them into
// two enums -- one for painting and one for layout.
enum LayoutMilestoneFlag {
DidFirstLayout = 1 << 0,
DidFirstVisuallyNonEmptyLayout = 1 << 1,
DidHitRelevantRepaintedObjectsAreaThreshold = 1 << 2,
DidFirstFlushForHeaderLayer = 1 << 3
DidFirstFlushForHeaderLayer = 1 << 3,
DidFirstLayoutAfterSuppressedIncrementalRendering = 1 << 4,
DidFirstPaintAfterSuppressedIncrementalRendering = 1 << 5
};
typedef unsigned LayoutMilestones;
......
......@@ -214,7 +214,6 @@ RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView)
, m_layerFlushThrottlingEnabled(false)
, m_layerFlushThrottlingTemporarilyDisabledForInteraction(false)
, m_hasPendingLayerFlush(false)
, m_headerLayerAwaitingFirstFlush(false)
#if !LOG_DISABLED
, m_rootLayerUpdateCount(0)
, m_obligateCompositedLayerCount(0)
......@@ -361,8 +360,8 @@ void RenderLayerCompositor::flushPendingLayerChanges(bool isFlushRoot)
ASSERT(!m_flushingLayers);
m_flushingLayers = true;
FrameView* frameView = m_renderView ? m_renderView->frameView() : 0;
if (GraphicsLayer* rootLayer = rootGraphicsLayer()) {
FrameView* frameView = m_renderView ? m_renderView->frameView() : 0;
if (frameView) {
// Having a m_clipLayer indicates that we're doing scrolling via GraphicsLayers.
IntRect visibleRect = m_clipLayer ? IntRect(IntPoint(), frameView->contentsSize()) : frameView->visibleContentRect();
......@@ -373,15 +372,8 @@ void RenderLayerCompositor::flushPendingLayerChanges(bool isFlushRoot)
ASSERT(m_flushingLayers);
m_flushingLayers = false;
if (m_headerLayerAwaitingFirstFlush) {
m_headerLayerAwaitingFirstFlush = false;
if (Page* page = this->page()) {
if (page->requestedLayoutMilestones() & DidFirstFlushForHeaderLayer) {
if (Frame* frame = page->mainFrame())
frame->loader()->didLayout(DidFirstFlushForHeaderLayer);
}
}
}
if (frameView)
frameView->firePaintRelatedMilestones();
if (!m_viewportConstrainedLayersNeedingUpdate.isEmpty()) {
HashSet<RenderLayer*>::const_iterator end = m_viewportConstrainedLayersNeedingUpdate.end();
......@@ -2524,7 +2516,7 @@ GraphicsLayer* RenderLayerCompositor::updateLayerForHeader(bool wantsLayer)
m_layerForHeader->setName("header");
#endif
m_scrollLayer->addChildBelow(m_layerForHeader.get(), m_rootContentLayer.get());
m_headerLayerAwaitingFirstFlush = true;
m_renderView->frameView()->addPaintPendingMilestones(DidFirstFlushForHeaderLayer);
}
m_layerForHeader->setPosition(FloatPoint(0, 0));
......
......@@ -449,7 +449,6 @@ private:
bool m_layerFlushThrottlingEnabled;
bool m_layerFlushThrottlingTemporarilyDisabledForInteraction;
bool m_hasPendingLayerFlush;
bool m_headerLayerAwaitingFirstFlush;
#if !LOG_DISABLED
int m_rootLayerUpdateCount;
......
2013-04-28 Beth Dakin <bdakin@apple.com>
Need a LayoutMilestone to fire when we have done our first paint after suppressing
incremental layout
https://bugs.webkit.org/show_bug.cgi?id=115330
-and corresponding-
<rdar://problem/12722365>
Reviewed by Simon Fraser.
Two new millstones.
* Shared/API/c/WKPageLoadTypes.h:
* Shared/API/c/WKSharedAPICast.h:
(WebKit::toWKLayoutMilestones):
(WebKit::toLayoutMilestones):
This null-check is necessary now since this code ends up running at
WebFrame::init() time while we're setting up the Document.
setVisualUpdatesAllowed(true) has always been called as a part of that process,
and now the updateLayout(), ends up calling this code too, but we don't actually
have a mainFrame yet since it's still being created.
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::findLargestFrameInFrameSet):
2013-04-29 Brady Eidson <beidson@apple.com>
REGRESSION: We see authentication challenge sheets for favicon requests.
......
......@@ -52,7 +52,9 @@ enum {
kWKDidFirstLayout = 1 << 0,
kWKDidFirstVisuallyNonEmptyLayout = 1 << 1,
kWKDidHitRelevantRepaintedObjectsAreaThreshold = 1 << 2,
kWKReserved = 1 << 3 // Note that the fourth member of this enum is actually private and defined in WKPageLoadTypesPrivate.h
kWKReserved = 1 << 3, // Note that the fourth member of this enum is actually private and defined in WKPageLoadTypesPrivate.h
kWKDidFirstLayoutAfterSuppressedIncrementalRendering = 1 << 4,
kWKDidFirstPaintAfterSuppressedIncrementalRendering = 1 << 5
};
typedef uint32_t WKLayoutMilestones;
......
......@@ -802,6 +802,10 @@ inline WKLayoutMilestones toWKLayoutMilestones(WebCore::LayoutMilestones milesto
wkMilestones |= kWKDidHitRelevantRepaintedObjectsAreaThreshold;
if (milestones & WebCore::DidFirstFlushForHeaderLayer)
wkMilestones |= kWKDidFirstFlushForHeaderLayer;
if (milestones & WebCore::DidFirstLayoutAfterSuppressedIncrementalRendering)
wkMilestones |= kWKDidFirstLayoutAfterSuppressedIncrementalRendering;
if (milestones & WebCore::DidFirstPaintAfterSuppressedIncrementalRendering)
wkMilestones |= kWKDidFirstPaintAfterSuppressedIncrementalRendering;
return wkMilestones;
}
......@@ -818,6 +822,10 @@ inline WebCore::LayoutMilestones toLayoutMilestones(WKLayoutMilestones wkMilesto
milestones |= WebCore::DidHitRelevantRepaintedObjectsAreaThreshold;
if (wkMilestones & kWKDidFirstFlushForHeaderLayer)
milestones |= WebCore::DidFirstFlushForHeaderLayer;
if (wkMilestones & kWKDidFirstLayoutAfterSuppressedIncrementalRendering)
milestones |= WebCore::DidFirstLayoutAfterSuppressedIncrementalRendering;
if (wkMilestones & kWKDidFirstPaintAfterSuppressedIncrementalRendering)
milestones |= WebCore::DidFirstPaintAfterSuppressedIncrementalRendering;
return milestones;
}
......
......@@ -84,7 +84,7 @@ static WebFrame* findLargestFrameInFrameSet(WebPage* page)
// Approximate what a user could consider a default target frame for application menu operations.
WebFrame* mainFrame = page->mainWebFrame();
if (!mainFrame->isFrameSet())
if (!mainFrame || !mainFrame->isFrameSet())
return 0;
WebFrame* largestSoFar = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment