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
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index b7d2ada..ac4241e 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,36 @@
+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
diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in
index f0d7e7c..f4c7500 100644
--- a/Source/WebCore/WebCore.exp.in
+++ b/Source/WebCore/WebCore.exp.in
@@ -835,6 +835,7 @@
__ZN7WebCore4Page21markAllMatchesForTextERKN3WTF6StringEjbj
__ZN7WebCore4Page22allVisitedStateChangedEPNS_9PageGroupE
__ZN7WebCore4Page22nonFastScrollableRectsEPKNS_5FrameE
+__ZN7WebCore4Page22removeLayoutMilestonesEj
__ZN7WebCore4Page22setRubberBandsAtBottomEb
__ZN7WebCore4Page23clearUndoRedoOperationsEv
__ZN7WebCore4Page24findStringMatchingRangesERKN3WTF6StringEjiPNS1_6VectorINS1_6RefPtrINS_5RangeEEELm0ENS1_15CrashOnOverflowEEERi
diff --git a/Source/WebCore/page/LayoutMilestones.h b/Source/WebCore/page/LayoutMilestones.h
index dbfcf14..42ddc00 100644
--- a/Source/WebCore/page/LayoutMilestones.h
+++ b/Source/WebCore/page/LayoutMilestones.h
@@ -31,7 +31,8 @@
enum LayoutMilestoneFlag {
DidFirstLayout = 1 << 0,
DidFirstVisuallyNonEmptyLayout = 1 << 1,
- DidHitRelevantRepaintedObjectsAreaThreshold = 1 << 2
+ DidHitRelevantRepaintedObjectsAreaThreshold = 1 << 2,
+ DidFirstFlushForHeaderLayer = 1 << 3
};
typedef unsigned LayoutMilestones;
diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp
index 75a5065..e3a356c 100644
--- a/Source/WebCore/page/Page.cpp
+++ b/Source/WebCore/page/Page.cpp
@@ -1274,6 +1274,11 @@
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;
diff --git a/Source/WebCore/page/Page.h b/Source/WebCore/page/Page.h
index 7a26269..bd533e3 100644
--- a/Source/WebCore/page/Page.h
+++ b/Source/WebCore/page/Page.h
@@ -352,6 +352,7 @@
PlatformDisplayID displayID() const { return m_displayID; }
void addLayoutMilestones(LayoutMilestones);
+ void removeLayoutMilestones(LayoutMilestones);
LayoutMilestones layoutMilestones() const { return m_layoutMilestones; }
bool isCountingRelevantRepaintedObjects() const;
diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp
index e02be21..cda592c 100644
--- a/Source/WebCore/rendering/RenderLayerCompositor.cpp
+++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp
@@ -217,6 +217,7 @@
, 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 @@
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 @@
m_layerForHeader->setName("header");
#endif
m_scrollLayer->addChildBelow(m_layerForHeader.get(), m_rootContentLayer.get());
+ m_headerLayerAwaitingFirstFlush = true;
}
m_layerForHeader->setPosition(FloatPoint(0, 0));
diff --git a/Source/WebCore/rendering/RenderLayerCompositor.h b/Source/WebCore/rendering/RenderLayerCompositor.h
index 25a1d19..e9292e6 100644
--- a/Source/WebCore/rendering/RenderLayerCompositor.h
+++ b/Source/WebCore/rendering/RenderLayerCompositor.h
@@ -453,6 +453,7 @@
bool m_layerFlushThrottlingEnabled;
bool m_layerFlushThrottlingTemporarilyDisabledForInteraction;
bool m_hasPendingLayerFlush;
+ bool m_headerLayerAwaitingFirstFlush;
#if !LOG_DISABLED
int m_rootLayerUpdateCount;
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index e4cb30b..51c4b0c 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,30 @@
+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.
diff --git a/Source/WebKit2/Shared/API/c/WKPageLoadTypes.h b/Source/WebKit2/Shared/API/c/WKPageLoadTypes.h
index 67500b4..9e33f4a 100644
--- a/Source/WebKit2/Shared/API/c/WKPageLoadTypes.h
+++ b/Source/WebKit2/Shared/API/c/WKPageLoadTypes.h
@@ -51,7 +51,8 @@
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;
diff --git a/Source/WebKit2/Shared/API/c/WKPageLoadTypesPrivate.h b/Source/WebKit2/Shared/API/c/WKPageLoadTypesPrivate.h
new file mode 100644
index 0000000..64e71ec
--- /dev/null
+++ b/Source/WebKit2/Shared/API/c/WKPageLoadTypesPrivate.h
@@ -0,0 +1,42 @@
+/*
+ * 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 */
diff --git a/Source/WebKit2/Shared/API/c/WKSharedAPICast.h b/Source/WebKit2/Shared/API/c/WKSharedAPICast.h
index 9ce34ff..280314c 100644
--- a/Source/WebKit2/Shared/API/c/WKSharedAPICast.h
+++ b/Source/WebKit2/Shared/API/c/WKSharedAPICast.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 @@
wkMilestones |= kWKDidFirstVisuallyNonEmptyLayout;
if (milestones & WebCore::DidHitRelevantRepaintedObjectsAreaThreshold)
wkMilestones |= kWKDidHitRelevantRepaintedObjectsAreaThreshold;
+ if (milestones & WebCore::DidFirstFlushForHeaderLayer)
+ wkMilestones |= kWKDidFirstFlushForHeaderLayer;
return wkMilestones;
}
@@ -813,6 +816,8 @@
milestones |= WebCore::DidFirstVisuallyNonEmptyLayout;
if (wkMilestones & kWKDidHitRelevantRepaintedObjectsAreaThreshold)
milestones |= WebCore::DidHitRelevantRepaintedObjectsAreaThreshold;
+ if (wkMilestones & kWKDidFirstFlushForHeaderLayer)
+ milestones |= WebCore::DidFirstFlushForHeaderLayer;
return milestones;
}
diff --git a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
index 18127f4..8fad3d8 100644
--- a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -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 */,
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
index 5a451ec..44c9273 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
@@ -837,8 +837,12 @@
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()];