Commit 60d628f6 authored by bdakin@apple.com's avatar bdakin@apple.com

Need a new layout milestone to notify bundle clients when the header has been

flushed
https://bugs.webkit.org/show_bug.cgi?id=114706
-and corresponding-
<rdar://problem/13657284>

Reviewed by Simon Fraser.

Source/WebCore: 

New LayoutMilestone is DidFirstFlushForHeaderLayer.
* page/LayoutMilestones.h:
        
New API to allow removing a LayoutMilestone.
* WebCore.exp.in:
* page/Page.cpp:
(WebCore::Page::removeLayoutMilestones):
* page/Page.h:
(Page):

New boolean member variable m_headerLayerAwaitingFirstFlush keeps track of whether 
we need to send the DidFirstFlushForHeaderLayer milestone.
* rendering/RenderLayerCompositor.h:
(RenderLayerCompositor):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::RenderLayerCompositor):

Send the milestone if appropriate.
(WebCore::RenderLayerCompositor::flushPendingLayerChanges):

 Set m_headerLayerAwaitingFirstFlush to true for a newly created layer.
(WebCore::RenderLayerCompositor::updateLayerForHeader):

Source/WebKit2: 

Make this new LayoutMilestone private at the API layer. 
* Shared/API/c/WKPageLoadTypes.h:
* Shared/API/c/WKPageLoadTypesPrivate.h: Added.

Handle the new milestone.
* Shared/API/c/WKSharedAPICast.h:
(WebKit::toWKLayoutMilestones):
(WebKit::toLayoutMilestones):

New file to make the milestone private.
* WebKit2.xcodeproj/project.pbxproj:

Add or remove the DidFirstFlushForHeaderLayer millstone based on whether we just 
added or removed a header.
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::setHeaderLayerWithHeight):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148564 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 04cf1839
2013-04-16 Beth Dakin <bdakin@apple.com>
Need a new layout milestone to notify bundle clients when the header has been
flushed
https://bugs.webkit.org/show_bug.cgi?id=114706
-and corresponding-
<rdar://problem/13657284>
Reviewed by Simon Fraser.
New LayoutMilestone is DidFirstFlushForHeaderLayer.
* page/LayoutMilestones.h:
New API to allow removing a LayoutMilestone.
* WebCore.exp.in:
* page/Page.cpp:
(WebCore::Page::removeLayoutMilestones):
* page/Page.h:
(Page):
New boolean member variable m_headerLayerAwaitingFirstFlush keeps track of whether
we need to send the DidFirstFlushForHeaderLayer milestone.
* rendering/RenderLayerCompositor.h:
(RenderLayerCompositor):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::RenderLayerCompositor):
Send the milestone if appropriate.
(WebCore::RenderLayerCompositor::flushPendingLayerChanges):
Set m_headerLayerAwaitingFirstFlush to true for a newly created layer.
(WebCore::RenderLayerCompositor::updateLayerForHeader):
2013-04-16 Tim Horton <timothy_horton@apple.com>
PlugIn Snapshotting: Crashes refreshing non-main-frame PDFPlugins
......@@ -835,6 +835,7 @@ __ZN7WebCore4Page20unmarkAllTextMatchesEv
__ZN7WebCore4Page21markAllMatchesForTextERKN3WTF6StringEjbj
__ZN7WebCore4Page22allVisitedStateChangedEPNS_9PageGroupE
__ZN7WebCore4Page22nonFastScrollableRectsEPKNS_5FrameE
__ZN7WebCore4Page22removeLayoutMilestonesEj
__ZN7WebCore4Page22setRubberBandsAtBottomEb
__ZN7WebCore4Page23clearUndoRedoOperationsEv
__ZN7WebCore4Page24findStringMatchingRangesERKN3WTF6StringEjiPNS1_6VectorINS1_6RefPtrINS_5RangeEEELm0ENS1_15CrashOnOverflowEEERi
......
......@@ -31,7 +31,8 @@ namespace WebCore {
enum LayoutMilestoneFlag {
DidFirstLayout = 1 << 0,
DidFirstVisuallyNonEmptyLayout = 1 << 1,
DidHitRelevantRepaintedObjectsAreaThreshold = 1 << 2
DidHitRelevantRepaintedObjectsAreaThreshold = 1 << 2,
DidFirstFlushForHeaderLayer = 1 << 3
};
typedef unsigned LayoutMilestones;
......
......@@ -1274,6 +1274,11 @@ void Page::addLayoutMilestones(LayoutMilestones milestones)
m_layoutMilestones |= milestones;
}
void Page::removeLayoutMilestones(LayoutMilestones milestones)
{
m_layoutMilestones &= ~milestones;
}
// These are magical constants that might be tweaked over time.
static double gMinimumPaintedAreaRatio = 0.1;
static double gMaximumUnpaintedAreaRatio = 0.04;
......
......@@ -352,6 +352,7 @@ public:
PlatformDisplayID displayID() const { return m_displayID; }
void addLayoutMilestones(LayoutMilestones);
void removeLayoutMilestones(LayoutMilestones);
LayoutMilestones layoutMilestones() const { return m_layoutMilestones; }
bool isCountingRelevantRepaintedObjects() const;
......
......@@ -217,6 +217,7 @@ 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)
......@@ -375,6 +376,16 @@ void RenderLayerCompositor::flushPendingLayerChanges(bool isFlushRoot)
ASSERT(m_flushingLayers);
m_flushingLayers = false;
if (m_headerLayerAwaitingFirstFlush) {
m_headerLayerAwaitingFirstFlush = false;
if (Page* page = this->page()) {
if (page->layoutMilestones() & DidFirstFlushForHeaderLayer) {
if (Frame* frame = page->mainFrame())
frame->loader()->didLayout(DidFirstFlushForHeaderLayer);
}
}
}
if (!m_viewportConstrainedLayersNeedingUpdate.isEmpty()) {
HashSet<RenderLayer*>::const_iterator end = m_viewportConstrainedLayersNeedingUpdate.end();
for (HashSet<RenderLayer*>::const_iterator it = m_viewportConstrainedLayersNeedingUpdate.begin(); it != end; ++it)
......@@ -2514,6 +2525,7 @@ GraphicsLayer* RenderLayerCompositor::updateLayerForHeader(bool wantsLayer)
m_layerForHeader->setName("header");
#endif
m_scrollLayer->addChildBelow(m_layerForHeader.get(), m_rootContentLayer.get());
m_headerLayerAwaitingFirstFlush = true;
}
m_layerForHeader->setPosition(FloatPoint(0, 0));
......
......@@ -453,6 +453,7 @@ private:
bool m_layerFlushThrottlingEnabled;
bool m_layerFlushThrottlingTemporarilyDisabledForInteraction;
bool m_hasPendingLayerFlush;
bool m_headerLayerAwaitingFirstFlush;
#if !LOG_DISABLED
int m_rootLayerUpdateCount;
......
2013-04-16 Beth Dakin <bdakin@apple.com>
Need a new layout milestone to notify bundle clients when the header has been
flushed
https://bugs.webkit.org/show_bug.cgi?id=114706
-and corresponding-
<rdar://problem/13657284>
Reviewed by Simon Fraser.
Make this new LayoutMilestone private at the API layer.
* Shared/API/c/WKPageLoadTypes.h:
* Shared/API/c/WKPageLoadTypesPrivate.h: Added.
Handle the new milestone.
* Shared/API/c/WKSharedAPICast.h:
(WebKit::toWKLayoutMilestones):
(WebKit::toLayoutMilestones):
New file to make the milestone private.
* WebKit2.xcodeproj/project.pbxproj:
Add or remove the DidFirstFlushForHeaderLayer millstone based on whether we just
added or removed a header.
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::setHeaderLayerWithHeight):
2013-04-16 Ryosuke Niwa <rniwa@webkit.org>
Another EFL build fix.
......@@ -51,7 +51,8 @@ typedef uint32_t WKSameDocumentNavigationType;
enum {
kWKDidFirstLayout = 1 << 0,
kWKDidFirstVisuallyNonEmptyLayout = 1 << 1,
kWKDidHitRelevantRepaintedObjectsAreaThreshold = 1 << 2
kWKDidHitRelevantRepaintedObjectsAreaThreshold = 1 << 2,
kWKReserved = 1 << 3 // Note that the fourth member of this enum is actually private and defined in WKPageLoadTypesPrivate.h
};
typedef uint32_t WKLayoutMilestones;
......
/*
* Copyright (C) 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WKPageLoadTypesPrivate_h
#define WKPageLoadTypesPrivate_h
#ifdef __cplusplus
extern "C" {
#endif
// This is an extension of the WKLayoutMilestones enum defined in WKPageLoadTypes.h
enum {
kWKDidFirstFlushForHeaderLayer = 1 << 3
};
#ifdef __cplusplus
}
#endif
#endif /* WKPageLoadTypesPrivate_h */
......@@ -35,6 +35,7 @@
#include "WKGeometry.h"
#include "WKImage.h"
#include "WKPageLoadTypes.h"
#include "WKPageLoadTypesPrivate.h"
#include "WKPageVisibilityTypes.h"
#include "WebError.h"
#include "WebEvent.h"
......@@ -799,6 +800,8 @@ inline WKLayoutMilestones toWKLayoutMilestones(WebCore::LayoutMilestones milesto
wkMilestones |= kWKDidFirstVisuallyNonEmptyLayout;
if (milestones & WebCore::DidHitRelevantRepaintedObjectsAreaThreshold)
wkMilestones |= kWKDidHitRelevantRepaintedObjectsAreaThreshold;
if (milestones & WebCore::DidFirstFlushForHeaderLayer)
wkMilestones |= kWKDidFirstFlushForHeaderLayer;
return wkMilestones;
}
......@@ -813,6 +816,8 @@ inline WebCore::LayoutMilestones toLayoutMilestones(WKLayoutMilestones wkMilesto
milestones |= WebCore::DidFirstVisuallyNonEmptyLayout;
if (wkMilestones & kWKDidHitRelevantRepaintedObjectsAreaThreshold)
milestones |= WebCore::DidHitRelevantRepaintedObjectsAreaThreshold;
if (wkMilestones & kWKDidFirstFlushForHeaderLayer)
milestones |= WebCore::DidFirstFlushForHeaderLayer;
return milestones;
}
......
......@@ -587,6 +587,7 @@
9394AE441702B25B00344232 /* WKBundlePagePrivateMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 9394AE421702B25B00344232 /* WKBundlePagePrivateMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
9394AE451702B25B00344232 /* WKBundlePagePrivateMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9394AE431702B25B00344232 /* WKBundlePagePrivateMac.mm */; };
939AE7661316E99C00AE06A6 /* WebCoreArgumentCoders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 939AE7651316E99C00AE06A6 /* WebCoreArgumentCoders.cpp */; };
93BDEB01171DD7AF00BFEE1B /* WKPageLoadTypesPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 93BDEB00171DD7AF00BFEE1B /* WKPageLoadTypesPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
93FC67BD12D3CCF200A60610 /* DecoderAdapter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93FC679D12D3CC7400A60610 /* DecoderAdapter.cpp */; };
93FC67BE12D3CCF200A60610 /* DecoderAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 93FC679E12D3CC7400A60610 /* DecoderAdapter.h */; };
93FC67BF12D3CCF200A60610 /* EncoderAdapter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93FC679F12D3CC7400A60610 /* EncoderAdapter.cpp */; };
......@@ -2012,6 +2013,7 @@
9394AE421702B25B00344232 /* WKBundlePagePrivateMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundlePagePrivateMac.h; sourceTree = "<group>"; };
9394AE431702B25B00344232 /* WKBundlePagePrivateMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKBundlePagePrivateMac.mm; sourceTree = "<group>"; };
939AE7651316E99C00AE06A6 /* WebCoreArgumentCoders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCoreArgumentCoders.cpp; sourceTree = "<group>"; };
93BDEB00171DD7AF00BFEE1B /* WKPageLoadTypesPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageLoadTypesPrivate.h; sourceTree = "<group>"; };
93FC679D12D3CC7400A60610 /* DecoderAdapter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DecoderAdapter.cpp; sourceTree = "<group>"; };
93FC679E12D3CC7400A60610 /* DecoderAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DecoderAdapter.h; sourceTree = "<group>"; };
93FC679F12D3CC7400A60610 /* EncoderAdapter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EncoderAdapter.cpp; sourceTree = "<group>"; };
......@@ -4829,6 +4831,7 @@
BC4075E5124FF0270068F20A /* WKNumber.cpp */,
BC4075E6124FF0270068F20A /* WKNumber.h */,
BC2D021812AC426C00E732A3 /* WKPageLoadTypes.h */,
93BDEB00171DD7AF00BFEE1B /* WKPageLoadTypesPrivate.h */,
A5EFD38B16B0E88C00B2F0E8 /* WKPageVisibilityTypes.h */,
37948406150C4B9600E52CE9 /* WKRenderLayer.cpp */,
37948407150C4B9600E52CE9 /* WKRenderLayer.h */,
......@@ -5219,6 +5222,7 @@
BCA8C6A911E3BA5F00812FB7 /* InjectedBundlePageLoaderClient.h in Headers */,
BC8147A912F64CDA007B2C32 /* InjectedBundlePagePolicyClient.h in Headers */,
BCA8C6B011E3C08700812FB7 /* InjectedBundlePageUIClient.h in Headers */,
93BDEB01171DD7AF00BFEE1B /* WKPageLoadTypesPrivate.h in Headers */,
BC33E0D112408E8600360F3F /* InjectedBundleRangeHandle.h in Headers */,
BC14DF77120B5B7900826C0C /* InjectedBundleScriptWorld.h in Headers */,
BCB0B0DE12305A8C00B1341E /* InjectedBundleUserMessageCoders.h in Headers */,
......
......@@ -837,8 +837,12 @@ void WebPage::setHeaderLayerWithHeight(CALayer *layer, int height)
m_headerLayer = layer;
GraphicsLayer* parentLayer = frameView->setWantsLayerForHeader(m_headerLayer);
if (!parentLayer)
if (!parentLayer) {
m_page->removeLayoutMilestones(DidFirstFlushForHeaderLayer);
return;
}
m_page->addLayoutMilestones(DidFirstFlushForHeaderLayer);
m_headerLayer.get().bounds = CGRectMake(0, 0, parentLayer->size().width(), parentLayer->size().height());
[parentLayer->platformLayer() addSublayer:m_headerLayer.get()];
......
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