Disallow accelerated rendering for ginormous 2D canvases.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Feb 2017 13:55:41 +0000 (13:55 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Feb 2017 13:55:41 +0000 (13:55 +0000)
commit1dd3b04f7e4e23345fe7ea3c78f9acddec131a8b
treed1618803d3f66f459ba9113ed12689a7a41d592f
parentd9874c7e3fc3f825845d795fff04efd2db99de49
Disallow accelerated rendering for ginormous 2D canvases.
<https://webkit.org/b/167968>
<rdar://problem/30119483>

Reviewed by Antti Koivisto.

Source/WebCore:

Add a "maximumAccelerated2dCanvasSize" setting that defaults to 5120x2880
which is the 5K resolution for 16:9.

Also added a way to include the "accelerates drawing" flag in layer tree dumps.

Test: compositing/canvas/accelerated-canvas-compositing-size-limit.html

* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::shouldAccelerate):
* page/Frame.h:
* page/Settings.in:
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::dumpProperties):
* platform/graphics/GraphicsLayerClient.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::layerTreeAsText):
* testing/Internals.cpp:
(WebCore::toLayerTreeFlags):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

Add a simple test that documents the fact that we no longer accelerate canvases
larger than 5120x2880.

* compositing/canvas/accelerated-canvas-compositing-size-limit-expected.txt: Added.
* compositing/canvas/accelerated-canvas-compositing-size-limit.html: Added.
* platform/ios-simulator/compositing/canvas/accelerated-canvas-compositing-size-limit-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211949 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
LayoutTests/ChangeLog
LayoutTests/compositing/canvas/accelerated-canvas-compositing-size-limit-expected.txt [new file with mode: 0644]
LayoutTests/compositing/canvas/accelerated-canvas-compositing-size-limit.html [new file with mode: 0644]
LayoutTests/platform/ios-simulator/compositing/canvas/accelerated-canvas-compositing-size-limit-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLCanvasElement.cpp
Source/WebCore/page/Frame.h
Source/WebCore/page/Settings.in
Source/WebCore/platform/graphics/GraphicsLayer.cpp
Source/WebCore/platform/graphics/GraphicsLayerClient.h
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl