Diff
Modified: trunk/Source/WebCore/ChangeLog (237784 => 237785)
--- trunk/Source/WebCore/ChangeLog 2018-11-04 16:04:19 UTC (rev 237784)
+++ trunk/Source/WebCore/ChangeLog 2018-11-04 16:38:36 UTC (rev 237785)
@@ -1,5 +1,41 @@
2018-11-04 Zalan Bujtas <za...@apple.com>
+ [iOS] Issue initial paint soon after the visuallyNonEmpty milestone is fired.
+ https://bugs.webkit.org/show_bug.cgi?id=191078
+ <rdar://problem/45736178>
+
+ Reviewed by Antti Koivisto.
+
+ 1. Improve visuallyNonEmpty milestone confidence level.
+ Ignore whitespace and non visible text content.
+ Parsing the main document should not necessarily fire the milestone. Check if there's any pending scripts/css/font loading.
+ Check if the html/body is actually visible.
+
+ 2. Issue initial paint soon after the milestone fires.
+ Use a 0ms timer to flush the initial paint.
+ Throttle additional flushes for 500ms (remove the non-initial 1.5 throttling)
+
+ 3. Suspend optional style recalcs and layouts while painting is being throttled.
+ When parsing yields we initiate a 0ms style recalc/layout timer.
+ These optional layouts produce content that we have no intention to paint.
+
+ * dom/Document.cpp:
+ (WebCore::Document::scheduleStyleRecalc):
+ (WebCore::Document::shouldScheduleLayout):
+ * page/ChromeClient.h:
+ * page/FrameView.cpp:
+ (WebCore::FrameView::resetLayoutMilestones):
+ (WebCore::FrameView::qualifiesAsVisuallyNonEmpty const):
+ (WebCore::FrameView::updateSignificantRenderedTextMilestoneIfNeeded):
+ (WebCore::FrameView::updateIsVisuallyNonEmpty):
+ * page/FrameView.h:
+ (WebCore::FrameView::incrementVisuallyNonEmptyCharacterCount): Ignore whitespace characters. Some pages start with plenty of whitespace only content.
+ * platform/graphics/FontCascade.h:
+ * rendering/RenderText.cpp: Check whether the text is actually visible at this point.
+ (WebCore::RenderText::RenderText):
+
+2018-11-04 Zalan Bujtas <za...@apple.com>
+
[LFC][BFC] Add support for percentage height in quirks mode.
https://bugs.webkit.org/show_bug.cgi?id=191232
Modified: trunk/Source/WebCore/dom/Document.cpp (237784 => 237785)
--- trunk/Source/WebCore/dom/Document.cpp 2018-11-04 16:04:19 UTC (rev 237784)
+++ trunk/Source/WebCore/dom/Document.cpp 2018-11-04 16:38:36 UTC (rev 237785)
@@ -1807,7 +1807,9 @@
// FIXME: Why on earth is this here? This is clearly misplaced.
invalidateAccessKeyMap();
- m_styleRecalcTimer.startOneShot(0_s);
+ auto throttleStyleRecalc = !m_pendingStyleRecalcShouldForce && page() && page()->chrome().client().layerFlushThrottlingIsActive();
+ const auto styleRecalcDelay = 50_ms;
+ m_styleRecalcTimer.startOneShot(throttleStyleRecalc ? styleRecalcDelay : 0_s);
InspectorInstrumentation::didScheduleStyleRecalculation(*this);
}
@@ -3031,6 +3033,8 @@
return false;
if (styleScope().hasPendingSheetsBeforeBody())
return false;
+ if (page() && page()->chrome().client().layerFlushThrottlingIsActive())
+ return false;
return true;
}
Modified: trunk/Source/WebCore/page/ChromeClient.h (237784 => 237785)
--- trunk/Source/WebCore/page/ChromeClient.h 2018-11-04 16:04:19 UTC (rev 237784)
+++ trunk/Source/WebCore/page/ChromeClient.h 2018-11-04 16:38:36 UTC (rev 237785)
@@ -333,6 +333,7 @@
// Returns true if layer tree updates are disabled.
virtual bool layerTreeStateIsFrozen() const { return false; }
+ virtual bool layerFlushThrottlingIsActive() const { return false; }
virtual bool adjustLayerFlushThrottling(LayerFlushThrottleState::Flags) { return false; }
Modified: trunk/Source/WebCore/page/FrameView.cpp (237784 => 237785)
--- trunk/Source/WebCore/page/FrameView.cpp 2018-11-04 16:04:19 UTC (rev 237784)
+++ trunk/Source/WebCore/page/FrameView.cpp 2018-11-04 16:38:36 UTC (rev 237785)
@@ -37,6 +37,7 @@
#include "DOMWindow.h"
#include "DebugPageOverlays.h"
#include "DeprecatedGlobalSettings.h"
+#include "DocumentLoader.h"
#include "DocumentMarkerController.h"
#include "EventHandler.h"
#include "EventNames.h"
@@ -57,6 +58,7 @@
#include "HTMLIFrameElement.h"
#include "HTMLNames.h"
#include "HTMLObjectElement.h"
+#include "HTMLParserIdioms.h"
#include "HTMLPlugInImageElement.h"
#include "ImageDocument.h"
#include "InspectorClient.h"
@@ -87,6 +89,7 @@
#include "RuntimeEnabledFeatures.h"
#include "SVGDocument.h"
#include "SVGSVGElement.h"
+#include "ScriptRunner.h"
#include "ScriptedAnimationController.h"
#include "ScrollAnimator.h"
#include "ScrollingCoordinator.h"
@@ -297,7 +300,7 @@
m_renderedSignificantAmountOfText = false;
m_visuallyNonEmptyCharacterCount = 0;
m_visuallyNonEmptyPixelCount = 0;
- m_renderTextCountForVisuallyNonEmptyCharacters = 0;
+ m_textRendererCountForVisuallyNonEmptyCharacters = 0;
}
void FrameView::removeFromAXObjectCache()
@@ -4349,6 +4352,31 @@
ASSERT(!needsLayout());
}
+void FrameView::incrementVisuallyNonEmptyCharacterCount(const String& inlineText)
+{
+ if (m_isVisuallyNonEmpty && m_renderedSignificantAmountOfText)
+ return;
+
+ ++m_textRendererCountForVisuallyNonEmptyCharacters;
+
+ auto nonWhitespaceLength = [](auto& inlineText) {
+ auto length = inlineText.length();
+ for (unsigned i = 0; i < inlineText.length(); ++i) {
+ if (isNotHTMLSpace(inlineText[i]))
+ continue;
+ --length;
+ }
+ return length;
+ };
+ m_visuallyNonEmptyCharacterCount += nonWhitespaceLength(inlineText);
+
+ if (!m_isVisuallyNonEmpty && m_visuallyNonEmptyCharacterCount > visualCharacterThreshold)
+ updateIsVisuallyNonEmpty();
+
+ if (!m_renderedSignificantAmountOfText)
+ updateSignificantRenderedTextMilestoneIfNeeded();
+}
+
static bool elementOverflowRectIsLargerThanThreshold(const Element& element)
{
// Require the document to grow a bit.
@@ -4367,14 +4395,24 @@
if (!documentElement || !documentElement->renderer())
return false;
- // Ensure that we always get marked visually non-empty eventually.
- if (!frame().document()->parsing() && frame().loader().stateMachine().committedFirstRealDocumentLoad())
- return true;
-
// FIXME: We should also ignore renderers with non-final style.
if (frame().document()->styleScope().hasPendingSheetsBeforeBody())
return false;
+ auto isVisible = [](const Element* element) {
+ if (!element || !element->renderer())
+ return false;
+ if (!element->renderer()->opacity())
+ return false;
+ return element->renderer()->style().visibility() == Visibility::Visible;
+ };
+
+ if (!isVisible(documentElement))
+ return false;
+
+ if (!isVisible(frame().document()->body()))
+ return false;
+
if (!elementOverflowRectIsLargerThanThreshold(*documentElement))
return false;
@@ -4381,9 +4419,39 @@
// The first few hundred characters rarely contain the interesting content of the page.
if (m_visuallyNonEmptyCharacterCount > visualCharacterThreshold)
return true;
+
// Use a threshold value to prevent very small amounts of visible content from triggering didFirstVisuallyNonEmptyLayout
if (m_visuallyNonEmptyPixelCount > visualPixelThreshold)
return true;
+
+ auto isMoreContentExpected = [&]() {
+ // Pending css/_javascript_/font loading/processing means we should wait a little longer.
+ auto hasPendingScriptExecution = frame().document()->scriptRunner() && frame().document()->scriptRunner()->hasPendingScripts();
+ if (hasPendingScriptExecution)
+ return true;
+
+ auto* documentLoader = frame().loader().documentLoader();
+ if (!documentLoader)
+ return false;
+
+ auto& resourceLoader = documentLoader->cachedResourceLoader();
+ if (!resourceLoader.requestCount())
+ return false;
+
+ auto& resources = resourceLoader.allCachedResources();
+ for (auto& resource : resources) {
+ if (resource.value->isLoaded())
+ continue;
+ if (resource.value->type() == CachedResource::Type::CSSStyleSheet || resource.value->type() == CachedResource::Type::Script || resource.value->type() == CachedResource::Type::FontResource)
+ return true;
+ }
+ return false;
+ };
+
+ // Finished parsing the main document and we still don't yet have enough content. Check if we might be getting some more.
+ if (frame().loader().stateMachine().committedFirstRealDocumentLoad() && !frame().document()->parsing())
+ return isMoreContentExpected();
+
return false;
}
@@ -4406,7 +4474,7 @@
if (m_visuallyNonEmptyCharacterCount < characterThreshold)
return;
- if (!m_renderTextCountForVisuallyNonEmptyCharacters || m_visuallyNonEmptyCharacterCount / static_cast<float>(m_renderTextCountForVisuallyNonEmptyCharacters) < meanLength)
+ if (!m_textRendererCountForVisuallyNonEmptyCharacters || m_visuallyNonEmptyCharacterCount / static_cast<float>(m_textRendererCountForVisuallyNonEmptyCharacters) < meanLength)
return;
m_renderedSignificantAmountOfText = true;
Modified: trunk/Source/WebCore/page/FrameView.h (237784 => 237785)
--- trunk/Source/WebCore/page/FrameView.h 2018-11-04 16:04:19 UTC (rev 237784)
+++ trunk/Source/WebCore/page/FrameView.h 2018-11-04 16:38:36 UTC (rev 237785)
@@ -393,7 +393,7 @@
WEBCORE_EXPORT void updateLayoutAndStyleIfNeededRecursive();
- void incrementVisuallyNonEmptyCharacterCount(unsigned);
+ void incrementVisuallyNonEmptyCharacterCount(const String&);
void incrementVisuallyNonEmptyPixelCount(const IntSize&);
void updateIsVisuallyNonEmpty();
void updateSignificantRenderedTextMilestoneIfNeeded();
@@ -870,7 +870,7 @@
bool m_isVisuallyNonEmpty;
bool m_firstVisuallyNonEmptyLayoutCallbackPending;
- unsigned m_renderTextCountForVisuallyNonEmptyCharacters;
+ unsigned m_textRendererCountForVisuallyNonEmptyCharacters { 0 };
bool m_renderedSignificantAmountOfText;
bool m_significantRenderedTextMilestonePending;
@@ -937,18 +937,6 @@
FrameViewLayoutContext m_layoutContext;
};
-inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count)
-{
- if (m_isVisuallyNonEmpty && m_renderedSignificantAmountOfText)
- return;
- m_visuallyNonEmptyCharacterCount += count;
- ++m_renderTextCountForVisuallyNonEmptyCharacters;
- if (!m_isVisuallyNonEmpty && m_visuallyNonEmptyCharacterCount > visualCharacterThreshold)
- updateIsVisuallyNonEmpty();
- if (!m_renderedSignificantAmountOfText)
- updateSignificantRenderedTextMilestoneIfNeeded();
-}
-
inline void FrameView::incrementVisuallyNonEmptyPixelCount(const IntSize& size)
{
if (m_isVisuallyNonEmpty)
Modified: trunk/Source/WebCore/platform/graphics/FontCascade.h (237784 => 237785)
--- trunk/Source/WebCore/platform/graphics/FontCascade.h 2018-11-04 16:04:19 UTC (rev 237784)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.h 2018-11-04 16:38:36 UTC (rev 237785)
@@ -269,9 +269,9 @@
bool useBackslashAsYenSymbol() const { return m_useBackslashAsYenSymbol; }
FontCascadeFonts* fonts() const { return m_fonts.get(); }
+ bool isLoadingCustomFonts() const;
private:
- bool isLoadingCustomFonts() const;
bool advancedTextRenderingMode() const
{
Modified: trunk/Source/WebCore/rendering/RenderText.cpp (237784 => 237785)
--- trunk/Source/WebCore/rendering/RenderText.cpp 2018-11-04 16:04:19 UTC (rev 237784)
+++ trunk/Source/WebCore/rendering/RenderText.cpp 2018-11-04 16:38:36 UTC (rev 237785)
@@ -199,7 +199,16 @@
ASSERT(!m_text.isNull());
setIsText();
m_canUseSimpleFontCodePath = computeCanUseSimpleFontCodePath();
- view().frameView().incrementVisuallyNonEmptyCharacterCount(text.impl()->length());
+
+ // FIXME: Find out how to increment the visually non empty character count when the font becomes available.
+ auto isTextVisible = false;
+ if (auto* parentElement = node.parentElement()) {
+ auto* style = parentElement->renderer() ? &parentElement->renderer()->style() : nullptr;
+ isTextVisible = style && style->visibility() == Visibility::Visible && !style->fontCascade().isLoadingCustomFonts();
+ }
+
+ if (isTextVisible)
+ view().frameView().incrementVisuallyNonEmptyCharacterCount(text);
}
RenderText::RenderText(Text& textNode, const String& text)
Modified: trunk/Source/WebKit/ChangeLog (237784 => 237785)
--- trunk/Source/WebKit/ChangeLog 2018-11-04 16:04:19 UTC (rev 237784)
+++ trunk/Source/WebKit/ChangeLog 2018-11-04 16:38:36 UTC (rev 237785)
@@ -1,3 +1,30 @@
+2018-11-04 Zalan Bujtas <za...@apple.com>
+
+ [iOS] Issue initial paint soon after the visuallyNonEmpty milestone is fired.
+ https://bugs.webkit.org/show_bug.cgi?id=191078
+ <rdar://problem/45736178>
+
+ Reviewed by Antti Koivisto.
+
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::WebChromeClient::layerFlushThrottlingIsActive const):
+ * WebProcess/WebCoreSupport/WebChromeClient.h:
+ * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
+ (WebKit::AcceleratedDrawingArea::scheduleInitialDeferredPaint):
+ * WebProcess/WebPage/AcceleratedDrawingArea.h:
+ * WebProcess/WebPage/DrawingArea.h:
+ (WebKit::DrawingArea::layerFlushThrottlingIsActive const):
+ * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
+ * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
+ (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
+ (WebKit::RemoteLayerTreeDrawingArea::setLayerTreeStateIsFrozen):
+ (WebKit::RemoteLayerTreeDrawingArea::initialDeferredPaint):
+ (WebKit::RemoteLayerTreeDrawingArea::scheduleInitialDeferredPaint):
+ (WebKit::RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlush):
+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+ (WebKit::TiledCoreAnimationDrawingArea::scheduleInitialDeferredPaint):
+
2018-11-04 Eric Carlson <eric.carl...@apple.com>
[MediaStream] User should not be prompted again after denying getDisplayMedia request
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (237784 => 237785)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp 2018-11-04 16:04:19 UTC (rev 237784)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp 2018-11-04 16:38:36 UTC (rev 237785)
@@ -931,6 +931,14 @@
return false;
}
+bool WebChromeClient::layerFlushThrottlingIsActive() const
+{
+ if (m_page.drawingArea())
+ return m_page.drawingArea()->layerFlushThrottlingIsActive();
+
+ return false;
+}
+
#if ENABLE(ASYNC_SCROLLING)
RefPtr<ScrollingCoordinator> WebChromeClient::createScrollingCoordinator(Page& page) const
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (237784 => 237785)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h 2018-11-04 16:04:19 UTC (rev 237784)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h 2018-11-04 16:38:36 UTC (rev 237785)
@@ -242,6 +242,7 @@
}
bool layerTreeStateIsFrozen() const final;
+ bool layerFlushThrottlingIsActive() const final;
#if ENABLE(ASYNC_SCROLLING)
RefPtr<WebCore::ScrollingCoordinator> createScrollingCoordinator(WebCore::Page&) const final;
Modified: trunk/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.cpp (237784 => 237785)
--- trunk/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.cpp 2018-11-04 16:04:19 UTC (rev 237784)
+++ trunk/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.cpp 2018-11-04 16:38:36 UTC (rev 237785)
@@ -223,6 +223,10 @@
m_layerTreeHost->scheduleLayerFlush();
}
+void AcceleratedDrawingArea::scheduleInitialDeferredPaint()
+{
+}
+
void AcceleratedDrawingArea::scheduleCompositingLayerFlushImmediately()
{
scheduleCompositingLayerFlush();
Modified: trunk/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h (237784 => 237785)
--- trunk/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h 2018-11-04 16:04:19 UTC (rev 237784)
+++ trunk/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h 2018-11-04 16:38:36 UTC (rev 237785)
@@ -56,6 +56,7 @@
WebCore::GraphicsLayerFactory* graphicsLayerFactory() override;
void setRootCompositingLayer(WebCore::GraphicsLayer*) override;
+ void scheduleInitialDeferredPaint() override;
void scheduleCompositingLayerFlush() override;
void scheduleCompositingLayerFlushImmediately() override;
Modified: trunk/Source/WebKit/WebProcess/WebPage/DrawingArea.h (237784 => 237785)
--- trunk/Source/WebKit/WebProcess/WebPage/DrawingArea.h 2018-11-04 16:04:19 UTC (rev 237784)
+++ trunk/Source/WebKit/WebProcess/WebPage/DrawingArea.h 2018-11-04 16:38:36 UTC (rev 237785)
@@ -84,6 +84,7 @@
virtual bool forceRepaintAsync(CallbackID) { return false; }
virtual void setLayerTreeStateIsFrozen(bool) { }
virtual bool layerTreeStateIsFrozen() const { return false; }
+ virtual bool layerFlushThrottlingIsActive() const { return false; }
virtual LayerTreeHost* layerTreeHost() const { return 0; }
virtual void setPaintingEnabled(bool) { }
@@ -111,6 +112,7 @@
virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() { return nullptr; }
virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) = 0;
virtual void scheduleCompositingLayerFlush() = 0;
+ virtual void scheduleInitialDeferredPaint() = 0;
virtual void scheduleCompositingLayerFlushImmediately() = 0;
#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h (237784 => 237785)
--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h 2018-11-04 16:04:19 UTC (rev 237784)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h 2018-11-04 16:38:36 UTC (rev 237785)
@@ -63,6 +63,7 @@
WebCore::GraphicsLayerFactory* graphicsLayerFactory() override;
void setRootCompositingLayer(WebCore::GraphicsLayer*) override;
+ void scheduleInitialDeferredPaint() override;
void scheduleCompositingLayerFlush() override;
void scheduleCompositingLayerFlushImmediately() override;
void attachViewOverlayGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*) override;
@@ -79,6 +80,8 @@
bool supportsAsyncScrolling() override { return true; }
void setLayerTreeStateIsFrozen(bool) override;
+ bool layerTreeStateIsFrozen() const override { return m_isFlushingSuspended; }
+ bool layerFlushThrottlingIsActive() const override { return m_initialDeferredPaintTimer.isActive() || (m_isThrottlingLayerFlushes && m_layerFlushTimer.isActive()); }
void forceRepaint() override;
bool forceRepaintAsync(CallbackID) override { return false; }
@@ -111,6 +114,7 @@
void updateScrolledExposedRect();
void updateRootLayers();
+ void flushInitialDeferredPaint();
void flushLayers();
WebCore::TiledBacking* mainFrameTiledBacking() const;
@@ -144,12 +148,12 @@
std::optional<WebCore::FloatRect> m_viewExposedRect;
std::optional<WebCore::FloatRect> m_scrolledViewExposedRect;
+ WebCore::Timer m_initialDeferredPaintTimer;
WebCore::Timer m_layerFlushTimer;
bool m_isFlushingSuspended { false };
bool m_hasDeferredFlush { false };
bool m_isThrottlingLayerFlushes { false };
bool m_isLayerFlushThrottlingTemporarilyDisabledForInteraction { false };
- bool m_isInitialThrottledLayerFlush { false };
bool m_waitingForBackingStoreSwap { false };
bool m_hadFlushDeferredWhileWaitingForBackingStoreSwap { false };
Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm (237784 => 237785)
--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm 2018-11-04 16:04:19 UTC (rev 237784)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm 2018-11-04 16:38:36 UTC (rev 237785)
@@ -57,6 +57,7 @@
: DrawingArea(DrawingAreaTypeRemoteLayerTree, webPage)
, m_remoteLayerTreeContext(std::make_unique<RemoteLayerTreeContext>(webPage))
, m_rootLayer(GraphicsLayer::create(graphicsLayerFactory(), *this))
+ , m_initialDeferredPaintTimer(*this, &RemoteLayerTreeDrawingArea::flushInitialDeferredPaint)
, m_layerFlushTimer(*this, &RemoteLayerTreeDrawingArea::flushLayers)
{
webPage.corePage()->settings().setForceCompositingMode(true);
@@ -185,7 +186,7 @@
if (!m_isFlushingSuspended && m_hasDeferredFlush) {
m_hasDeferredFlush = false;
- scheduleCompositingLayerFlush();
+ scheduleInitialDeferredPaint();
}
}
@@ -273,6 +274,23 @@
m_layerFlushTimer.startOneShot(0_s);
}
+void RemoteLayerTreeDrawingArea::flushInitialDeferredPaint()
+{
+ flushLayers();
+
+ if (!m_isThrottlingLayerFlushes)
+ return;
+
+ scheduleCompositingLayerFlush();
+}
+
+void RemoteLayerTreeDrawingArea::scheduleInitialDeferredPaint()
+{
+ ASSERT(!m_isFlushingSuspended);
+ ASSERT(!m_layerFlushTimer.isActive());
+ m_initialDeferredPaintTimer.startOneShot(0_s);
+}
+
void RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlush()
{
if (m_isFlushingSuspended) {
@@ -286,15 +304,11 @@
return;
}
- if (m_layerFlushTimer.isActive())
+ if (m_initialDeferredPaintTimer.isActive() || m_layerFlushTimer.isActive())
return;
- const Seconds initialFlushDelay = 500_ms;
- const Seconds flushDelay = 1500_ms;
- Seconds throttleDelay = m_isThrottlingLayerFlushes ? (m_isInitialThrottledLayerFlush ? initialFlushDelay : flushDelay) : 0_s;
- m_isInitialThrottledLayerFlush = false;
-
- m_layerFlushTimer.startOneShot(throttleDelay);
+ const auto flushDelay = 500_ms;
+ m_layerFlushTimer.startOneShot(m_isThrottlingLayerFlushes ? flushDelay : 0_s);
}
bool RemoteLayerTreeDrawingArea::adjustLayerFlushThrottling(WebCore::LayerFlushThrottleState::Flags flags)
@@ -305,9 +319,6 @@
bool wasThrottlingLayerFlushes = m_isThrottlingLayerFlushes;
m_isThrottlingLayerFlushes = flags & WebCore::LayerFlushThrottleState::Enabled;
- if (!wasThrottlingLayerFlushes && m_isThrottlingLayerFlushes)
- m_isInitialThrottledLayerFlush = true;
-
// Re-schedule the flush if we stopped throttling.
if (wasThrottlingLayerFlushes && !m_isThrottlingLayerFlushes && m_layerFlushTimer.isActive()) {
m_layerFlushTimer.stop();
Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h (237784 => 237785)
--- trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h 2018-11-04 16:04:19 UTC (rev 237784)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h 2018-11-04 16:38:36 UTC (rev 237785)
@@ -65,6 +65,7 @@
void setLayerTreeStateIsFrozen(bool) override;
bool layerTreeStateIsFrozen() const override;
void setRootCompositingLayer(WebCore::GraphicsLayer*) override;
+ void scheduleInitialDeferredPaint() override;
void scheduleCompositingLayerFlush() override;
void scheduleCompositingLayerFlushImmediately() override;
Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (237784 => 237785)
--- trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm 2018-11-04 16:04:19 UTC (rev 237784)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm 2018-11-04 16:38:36 UTC (rev 237785)
@@ -185,6 +185,10 @@
return m_layerTreeStateIsFrozen;
}
+void TiledCoreAnimationDrawingArea::scheduleInitialDeferredPaint()
+{
+}
+
void TiledCoreAnimationDrawingArea::scheduleCompositingLayerFlush()
{
if (m_layerTreeStateIsFrozen)