Diff
Modified: trunk/Source/WebCore/ChangeLog (194824 => 194825)
--- trunk/Source/WebCore/ChangeLog 2016-01-10 04:15:59 UTC (rev 194824)
+++ trunk/Source/WebCore/ChangeLog 2016-01-10 06:39:43 UTC (rev 194825)
@@ -1,3 +1,54 @@
+2016-01-09 Simon Fraser <simon.fra...@apple.com>
+
+ Hook up display-list drawing in GraphicsLayerCA
+ https://bugs.webkit.org/show_bug.cgi?id=152946
+
+ Reviewed by Zalan Bujtas.
+
+ Have GraphicsLayerCA hold a DisplayList. If enabled, do a display-list record
+ in GraphicsLayerCA::recursiveCommitChanges(), and a playback in GraphicsLayerCA::platformCALayerPaintContents().
+
+ GraphicsLayerCA needs to maintain a m_hasEverPainted flag to know to do a full record
+ at first paint (when there are no dirty rects).
+
+ Plumb 'isUsingDisplayListDrawing' through to TileGrid via PlatformCALayer{Client}
+ so that we can decorate the tile paint counters with an outline.
+
+ Have RenderLayerCompositor push the displayListDrawingEnabled state down through
+ RenderLayerBackings to GraphicsLayers.
+
+ Convert RenderLayerCompositor to use initializers.
+
+ * platform/graphics/GraphicsLayer.cpp:
+ (WebCore::GraphicsLayer::GraphicsLayer):
+ * platform/graphics/GraphicsLayer.h:
+ (WebCore::GraphicsLayer::usesDisplayListDrawing):
+ (WebCore::GraphicsLayer::setUsesDisplayListDrawing):
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::GraphicsLayerCA):
+ (WebCore::GraphicsLayerCA::setUsesDisplayListDrawing):
+ (WebCore::GraphicsLayerCA::recursiveCommitChanges):
+ (WebCore::GraphicsLayerCA::platformCALayerPaintContents):
+ (WebCore::GraphicsLayerCA::updateDrawsContent):
+ (WebCore::GraphicsLayerCA::dumpAdditionalProperties):
+ * platform/graphics/ca/GraphicsLayerCA.h:
+ * platform/graphics/ca/PlatformCALayer.cpp:
+ (WebCore::PlatformCALayer::drawRepaintIndicator):
+ * platform/graphics/ca/PlatformCALayerClient.h:
+ (WebCore::PlatformCALayerClient::isUsingDisplayListDrawing):
+ * platform/graphics/ca/TileGrid.cpp:
+ (WebCore::TileGrid::platformCALayerShowRepaintCounter):
+ (WebCore::TileGrid::isUsingDisplayListDrawing):
+ * platform/graphics/ca/TileGrid.h:
+ * platform/graphics/displaylists/DisplayList.h: Sadly need to include DisplayListItems.h
+ to get things to compile. I wasn't able to avoid this even when making functions non-inline.
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::createGraphicsLayer):
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::RenderLayerCompositor):
+ (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags):
+ * rendering/RenderLayerCompositor.h:
+
2016-01-09 Zalan Bujtas <za...@apple.com>
REGRESSION (r194426): First email field is not autofilled on amazon.com
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (194824 => 194825)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2016-01-10 04:15:59 UTC (rev 194824)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2016-01-10 06:39:43 UTC (rev 194825)
@@ -122,6 +122,7 @@
, m_drawsContent(false)
, m_contentsVisible(true)
, m_acceleratesDrawing(false)
+ , m_usesDisplayListDrawing(false)
, m_appliesPageScale(false)
, m_showDebugBorder(false)
, m_showRepaintCounter(false)
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (194824 => 194825)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2016-01-10 04:15:59 UTC (rev 194824)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2016-01-10 06:39:43 UTC (rev 194825)
@@ -345,6 +345,9 @@
bool acceleratesDrawing() const { return m_acceleratesDrawing; }
virtual void setAcceleratesDrawing(bool b) { m_acceleratesDrawing = b; }
+ bool usesDisplayListDrawing() const { return m_usesDisplayListDrawing; }
+ virtual void setUsesDisplayListDrawing(bool b) { m_usesDisplayListDrawing = b; }
+
bool needsBackdrop() const { return !m_backdropFilters.isEmpty(); }
// The color used to paint the layer background. Pass an invalid color to remove it.
@@ -606,6 +609,7 @@
bool m_drawsContent : 1;
bool m_contentsVisible : 1;
bool m_acceleratesDrawing : 1;
+ bool m_usesDisplayListDrawing : 1;
bool m_appliesPageScale : 1; // Set for the layer which has the page scale applied to it.
bool m_showDebugBorder : 1;
bool m_showRepaintCounter : 1;
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (194824 => 194825)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2016-01-10 04:15:59 UTC (rev 194824)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2016-01-10 06:39:43 UTC (rev 194825)
@@ -28,6 +28,8 @@
#include "GraphicsLayerCA.h"
#include "Animation.h"
+#include "DisplayListRecorder.h"
+#include "DisplayListReplayer.h"
#include "FloatConversion.h"
#include "FloatRect.h"
#include "GraphicsLayerFactory.h"
@@ -360,6 +362,7 @@
, m_usingBackdropLayerType(false)
, m_isViewportConstrained(false)
, m_intersectsCoverageRect(false)
+ , m_hasEverPainted(false)
{
}
@@ -666,6 +669,14 @@
noteLayerPropertyChanged(AcceleratesDrawingChanged);
}
+void GraphicsLayerCA::setUsesDisplayListDrawing(bool usesDisplayListDrawing)
+{
+ if (usesDisplayListDrawing == m_usesDisplayListDrawing)
+ return;
+
+ GraphicsLayer::setUsesDisplayListDrawing(usesDisplayListDrawing);
+}
+
void GraphicsLayerCA::setBackgroundColor(const Color& color)
{
if (m_backgroundColor == color)
@@ -1384,6 +1395,7 @@
if (GraphicsLayerCA* maskLayer = downcast<GraphicsLayerCA>(m_maskLayer))
maskLayer->commitLayerChangesAfterSublayers(childCommitState);
+ bool hadDirtyRects = m_uncommittedChanges & DirtyRectsChanged;
commitLayerChangesAfterSublayers(childCommitState);
if (affectedByTransformAnimation && m_layer->layerType() == PlatformCALayer::LayerTypeTiledBackingLayer)
@@ -1391,6 +1403,24 @@
if (hadChanges)
client().didCommitChangesForLayer(this);
+
+ if (usesDisplayListDrawing() && m_drawsContent && (!m_hasEverPainted || hadDirtyRects)) {
+#ifdef LOG_RECORDING_TIME
+ double startTime = currentTime();
+#endif
+ m_displayList = std::make_unique<DisplayList::DisplayList>();
+
+ FloatRect initialClip(boundsOrigin(), size());
+
+ GraphicsContext context;
+ DisplayList::Recorder recorder(context, *m_displayList, initialClip, AffineTransform());
+ context.setDisplayListRecorder(&recorder);
+ paintGraphicsLayerContents(context, FloatRect(FloatPoint(), size()));
+#ifdef LOG_RECORDING_TIME
+ double duration = currentTime() - startTime;
+ WTFLogAlways("Recording took %.5fms", duration * 1000.0);
+#endif
+ }
}
void GraphicsLayerCA::platformCALayerCustomSublayersChanged(PlatformCALayer*)
@@ -1410,6 +1440,12 @@
void GraphicsLayerCA::platformCALayerPaintContents(PlatformCALayer*, GraphicsContext& context, const FloatRect& clip)
{
+ m_hasEverPainted = true;
+ if (m_displayList) {
+ DisplayList::Replayer replayer(context, *m_displayList);
+ replayer.replay(clip);
+ return;
+ }
paintGraphicsLayerContents(context, clip);
}
@@ -2021,9 +2057,10 @@
void GraphicsLayerCA::updateDrawsContent()
{
- if (m_drawsContent)
+ if (m_drawsContent) {
m_layer->setNeedsDisplay();
- else {
+ m_hasEverPainted = false;
+ } else {
m_layer->setContents(0);
if (m_layerClones) {
LayerMap::const_iterator end = m_layerClones->end();
@@ -3309,6 +3346,13 @@
dumpInnerLayer(textStream, "contents shape mask layer", m_contentsShapeMaskLayer.get(), indent, behavior);
dumpInnerLayer(textStream, "backdrop layer", m_backdropLayer.get(), indent, behavior);
}
+
+ if (behavior & LayerTreeAsTextDebug) {
+ writeIndent(textStream, indent + 1);
+ textStream << "(acceleratetes drawing " << m_acceleratesDrawing << ")\n";
+ writeIndent(textStream, indent + 1);
+ textStream << "(uses display-list drawing " << m_usesDisplayListDrawing << ")\n";
+ }
}
void GraphicsLayerCA::setDebugBorder(const Color& color, float borderWidth)
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (194824 => 194825)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2016-01-10 04:15:59 UTC (rev 194824)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2016-01-10 06:39:43 UTC (rev 194825)
@@ -41,6 +41,10 @@
namespace WebCore {
+namespace DisplayList {
+class DisplayList;
+}
+
class FloatRoundedRect;
class Image;
class TransformState;
@@ -86,6 +90,7 @@
WEBCORE_EXPORT virtual void setDrawsContent(bool) override;
WEBCORE_EXPORT virtual void setContentsVisible(bool) override;
WEBCORE_EXPORT virtual void setAcceleratesDrawing(bool) override;
+ WEBCORE_EXPORT virtual void setUsesDisplayListDrawing(bool) override;
WEBCORE_EXPORT virtual void setBackgroundColor(const Color&) override;
@@ -198,6 +203,7 @@
WEBCORE_EXPORT virtual IntSize platformCALayerTileSize() const override;
virtual bool isCommittingChanges() const override { return m_isCommittingChanges; }
+ virtual bool isUsingDisplayListDrawing(PlatformCALayer*) const override { return m_usesDisplayListDrawing; }
WEBCORE_EXPORT virtual void setIsViewportConstrained(bool) override;
virtual bool isViewportConstrained() const override { return m_isViewportConstrained; }
@@ -521,6 +527,7 @@
bool m_usingBackdropLayerType : 1;
bool m_isViewportConstrained : 1;
bool m_intersectsCoverageRect : 1;
+ bool m_hasEverPainted : 1;
Color m_contentsSolidColor;
@@ -568,6 +575,8 @@
AnimationsMap m_runningAnimations;
Vector<FloatRect> m_dirtyRects;
+
+ std::unique_ptr<DisplayList::DisplayList> m_displayList;
FloatSize m_pixelAlignmentOffset;
Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp (194824 => 194825)
--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp 2016-01-10 04:15:59 UTC (rev 194824)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp 2016-01-10 06:39:43 UTC (rev 194825)
@@ -27,6 +27,7 @@
#include "PlatformCALayer.h"
#include "LayerPool.h"
+#include "PlatformCALayerClient.h"
#include "TextStream.h"
#include <wtf/StringExtras.h>
@@ -84,6 +85,12 @@
CGContextSetRGBFillColor(context, 1, 0, 0, 1);
else
CGContextSetRGBFillColor(context, 1, 1, 1, 1);
+
+ if (platformCALayer->owner()->isUsingDisplayListDrawing(platformCALayer)) {
+ CGContextSetRGBStrokeColor(context, 0, 0, 0, 0.65);
+ CGContextSetLineWidth(context, 2);
+ CGContextStrokeRect(context, indicatorBox);
+ }
platformCALayer->drawTextAtPoint(context, indicatorBox.origin.x + 5, indicatorBox.origin.y + 22, CGSizeMake(1, -1), 22, text, strlen(text));
Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h (194824 => 194825)
--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h 2016-01-10 04:15:59 UTC (rev 194824)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h 2016-01-10 06:39:43 UTC (rev 194825)
@@ -64,6 +64,8 @@
virtual bool isCommittingChanges() const { return false; }
+ virtual bool isUsingDisplayListDrawing(PlatformCALayer*) const { return false; }
+
protected:
virtual ~PlatformCALayerClient() {}
};
Modified: trunk/Source/WebCore/platform/graphics/ca/TileGrid.cpp (194824 => 194825)
--- trunk/Source/WebCore/platform/graphics/ca/TileGrid.cpp 2016-01-10 04:15:59 UTC (rev 194824)
+++ trunk/Source/WebCore/platform/graphics/ca/TileGrid.cpp 2016-01-10 06:39:43 UTC (rev 194825)
@@ -693,9 +693,14 @@
bool TileGrid::platformCALayerShowRepaintCounter(PlatformCALayer*) const
{
- return m_controller.rootLayer().owner()->platformCALayerShowRepaintCounter(0);
+ return m_controller.rootLayer().owner()->platformCALayerShowRepaintCounter(nullptr);
}
+bool TileGrid::isUsingDisplayListDrawing(PlatformCALayer*) const
+{
+ return m_controller.rootLayer().owner()->isUsingDisplayListDrawing(nullptr);
+}
+
bool TileGrid::platformCALayerContentsOpaque() const
{
return m_controller.tilesAreOpaque();
Modified: trunk/Source/WebCore/platform/graphics/ca/TileGrid.h (194824 => 194825)
--- trunk/Source/WebCore/platform/graphics/ca/TileGrid.h 2016-01-10 04:15:59 UTC (rev 194824)
+++ trunk/Source/WebCore/platform/graphics/ca/TileGrid.h 2016-01-10 06:39:43 UTC (rev 194825)
@@ -143,6 +143,7 @@
virtual bool platformCALayerContentsOpaque() const override;
virtual bool platformCALayerDrawsContent() const override { return true; }
virtual float platformCALayerDeviceScaleFactor() const override;
+ virtual bool isUsingDisplayListDrawing(PlatformCALayer*) const override;
TileController& m_controller;
Ref<PlatformCALayer> m_containerLayer;
Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.h (194824 => 194825)
--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.h 2016-01-10 04:15:59 UTC (rev 194824)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.h 2016-01-10 06:39:43 UTC (rev 194825)
@@ -26,6 +26,7 @@
#ifndef DisplayList_h
#define DisplayList_h
+#include "DisplayListItems.h"
#include <wtf/FastMalloc.h>
#include <wtf/Noncopyable.h>
#include <wtf/text/WTFString.h>
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (194824 => 194825)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2016-01-10 04:15:59 UTC (rev 194824)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2016-01-10 06:39:43 UTC (rev 194825)
@@ -176,7 +176,8 @@
#endif
#if PLATFORM(COCOA) && USE(CA)
graphicsLayer->setAcceleratesDrawing(compositor().acceleratedDrawingEnabled());
-#endif
+ graphicsLayer->setUsesDisplayListDrawing(compositor().displayListDrawingEnabled());
+#endif
return graphicsLayer;
}
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (194824 => 194825)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2016-01-10 04:15:59 UTC (rev 194824)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2016-01-10 06:39:43 UTC (rev 194825)
@@ -273,26 +273,8 @@
RenderLayerCompositor::RenderLayerCompositor(RenderView& renderView)
: m_renderView(renderView)
, m_updateCompositingLayersTimer(*this, &RenderLayerCompositor::updateCompositingLayersTimerFired)
- , m_hasAcceleratedCompositing(true)
- , m_compositingTriggers(static_cast<ChromeClient::CompositingTriggerFlags>(ChromeClient::AllTriggers))
- , m_showDebugBorders(false)
- , m_showRepaintCounter(false)
- , m_acceleratedDrawingEnabled(false)
- , m_reevaluateCompositingAfterLayout(false)
- , m_compositing(false)
- , m_compositingLayersNeedRebuild(false)
- , m_flushingLayers(false)
- , m_shouldFlushOnReattach(false)
- , m_forceCompositingMode(false)
- , m_inPostLayoutUpdate(false)
- , m_subframeScrollLayersNeedReattach(false)
- , m_isTrackingRepaints(false)
- , m_rootLayerAttachment(RootLayerUnattached)
- , m_layerFlushTimer(*this, &RenderLayerCompositor::layerFlushTimerFired)
- , m_layerFlushThrottlingEnabled(false)
- , m_layerFlushThrottlingTemporarilyDisabledForInteraction(false)
- , m_hasPendingLayerFlush(false)
, m_paintRelatedMilestonesTimer(*this, &RenderLayerCompositor::paintRelatedMilestonesTimerFired)
+ , m_layerFlushTimer(*this, &RenderLayerCompositor::layerFlushTimerFired)
{
}
@@ -324,6 +306,7 @@
bool showRepaintCounter = false;
bool forceCompositingMode = false;
bool acceleratedDrawingEnabled = false;
+ bool displayListDrawingEnabled = false;
const Settings& settings = m_renderView.frameView().frame().settings();
hasAcceleratedCompositing = settings.acceleratedCompositingEnabled();
@@ -345,7 +328,8 @@
forceCompositingMode = requiresCompositingForScrollableFrame();
acceleratedDrawingEnabled = settings.acceleratedDrawingEnabled();
-
+ displayListDrawingEnabled = settings.displayListDrawingEnabled();
+
if (hasAcceleratedCompositing != m_hasAcceleratedCompositing || showDebugBorders != m_showDebugBorders || showRepaintCounter != m_showRepaintCounter || forceCompositingMode != m_forceCompositingMode)
setCompositingLayersNeedRebuild();
@@ -355,6 +339,7 @@
m_showRepaintCounter = showRepaintCounter;
m_forceCompositingMode = forceCompositingMode;
m_acceleratedDrawingEnabled = acceleratedDrawingEnabled;
+ m_displayListDrawingEnabled = displayListDrawingEnabled;
if (debugBordersChanged) {
if (m_layerForHorizontalScrollbar)
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (194824 => 194825)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2016-01-10 04:15:59 UTC (rev 194824)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2016-01-10 06:39:43 UTC (rev 194825)
@@ -260,6 +260,7 @@
void layerTiledBackingUsageChanged(const GraphicsLayer*, bool /*usingTiledBacking*/);
bool acceleratedDrawingEnabled() const { return m_acceleratedDrawingEnabled; }
+ bool displayListDrawingEnabled() const { return m_displayListDrawingEnabled; }
void deviceOrPageScaleFactorChanged();
@@ -489,33 +490,34 @@
std::unique_ptr<GraphicsLayer> m_rootContentLayer;
Timer m_updateCompositingLayersTimer;
- bool m_hasAcceleratedCompositing;
- ChromeClient::CompositingTriggerFlags m_compositingTriggers;
+ ChromeClient::CompositingTriggerFlags m_compositingTriggers { static_cast<ChromeClient::CompositingTriggerFlags>(ChromeClient::AllTriggers) };
+ bool m_hasAcceleratedCompositing { true };
- bool m_showDebugBorders;
- bool m_showRepaintCounter;
- bool m_acceleratedDrawingEnabled;
+ bool m_showDebugBorders { false };
+ bool m_showRepaintCounter { false };
+ bool m_acceleratedDrawingEnabled { false };
+ bool m_displayListDrawingEnabled { false };
// When true, we have to wait until layout has happened before we can decide whether to enter compositing mode,
// because only then do we know the final size of plugins and iframes.
- mutable bool m_reevaluateCompositingAfterLayout;
+ mutable bool m_reevaluateCompositingAfterLayout { false };
- bool m_compositing;
- bool m_compositingLayersNeedRebuild;
- bool m_flushingLayers;
- bool m_shouldFlushOnReattach;
- bool m_forceCompositingMode;
- bool m_inPostLayoutUpdate; // true when it's OK to trust layout information (e.g. layer sizes and positions)
- bool m_subframeScrollLayersNeedReattach;
+ bool m_compositing { false };
+ bool m_compositingLayersNeedRebuild { false };
+ bool m_flushingLayers { false };
+ bool m_shouldFlushOnReattach { false };
+ bool m_forceCompositingMode { false };
+ bool m_inPostLayoutUpdate { false }; // true when it's OK to trust layout information (e.g. layer sizes and positions)
+ bool m_subframeScrollLayersNeedReattach { false };
- bool m_isTrackingRepaints; // Used for testing.
+ bool m_isTrackingRepaints { false }; // Used for testing.
int m_compositedLayerCount { 0 };
unsigned m_layersWithTiledBackingCount { 0 };
unsigned m_layerFlushCount { 0 };
unsigned m_compositingUpdateCount { 0 };
- RootLayerAttachment m_rootLayerAttachment;
+ RootLayerAttachment m_rootLayerAttachment { RootLayerUnattached };
// Enclosing clipping layer for iframe content
std::unique_ptr<GraphicsLayer> m_clipLayer;
@@ -546,15 +548,15 @@
std::unique_ptr<GraphicsLayerUpdater> m_layerUpdater; // Updates tiled layer visible area periodically while animations are running.
+ Timer m_paintRelatedMilestonesTimer;
Timer m_layerFlushTimer;
- bool m_layerFlushThrottlingEnabled;
- bool m_layerFlushThrottlingTemporarilyDisabledForInteraction;
- bool m_hasPendingLayerFlush;
+
+ bool m_layerFlushThrottlingEnabled { false };
+ bool m_layerFlushThrottlingTemporarilyDisabledForInteraction { false };
+ bool m_hasPendingLayerFlush { false };
bool m_layerNeedsCompositingUpdate { false };
bool m_viewBackgroundIsTransparent { false };
- Timer m_paintRelatedMilestonesTimer;
-
#if !LOG_DISABLED
int m_rootLayerUpdateCount { 0 };
int m_obligateCompositedLayerCount { 0 }; // count of layer that have to be composited.