Add basic support for getting a ImageBitmapRenderingContext
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Oct 2017 21:29:01 +0000 (21:29 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Oct 2017 21:29:01 +0000 (21:29 +0000)
commitae95e0b155d77306981bee23cbfe5987b9e397e4
tree9b1924888b3d442e38e74e46565a99f067f54222
parentb4a5017acc844960bc1266eea423a6ef4e2e38df
Add basic support for getting a ImageBitmapRenderingContext
https://bugs.webkit.org/show_bug.cgi?id=177983

Patch by Sam Weinig <sam@webkit.org> on 2017-10-06
Reviewed by Dean Jackson.

Source/WebCore:

Add initial support for ImageBitmapRenderingContext.

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:

    Add new files.

* dom/Document.cpp:
* dom/Document.h:
* dom/Document.idl:

    Add ImageBitmapRenderingContext to RenderingContext variant so it wil be able to
    be used with Document.getCSSCanvasContext.

* html/HTMLCanvasElement.h:
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::setHeight):
(WebCore::HTMLCanvasElement::setWidth):

    Throw an exception if the context is in the placeholder mode (which we
    signify via a special PlaceholderRenderingContext) as speced. This can't
    currently be hit, as setting a placeholder requires offscreen canvas
    support, coming soon.

(WebCore::HTMLCanvasElement::getContext):

    Re-work to match the spec's matrix of options, adding in support
    for 'bitmaprenderer'/ ImageBitmapRenderingContext type as well as
    the placeholder mode.

(WebCore::HTMLCanvasElement::createContext2d):
(WebCore::HTMLCanvasElement::getContext2d):
(WebCore::HTMLCanvasElement::isWebGLType):
(WebCore::HTMLCanvasElement::createContextWebGL):
(WebCore::HTMLCanvasElement::getContextWebGL):
(WebCore::HTMLCanvasElement::createContextWebGPU):
(WebCore::HTMLCanvasElement::getContextWebGPU):
(WebCore::HTMLCanvasElement::isBitmapRendererType):
(WebCore::HTMLCanvasElement::createContextBitmapRenderer):
(WebCore::HTMLCanvasElement::getContextBitmapRenderer):

    Split creation out of the get functions so it can be called
    by getContext, where we know if the canvas is null or not.

* html/HTMLCanvasElement.idl:

    Add ImageBitmapRenderingContext to RenderingContext variant so it wil be able to
    be used with HTMLCanvasElement.getContext.

* html/canvas/CanvasRenderingContext.h:
(WebCore::CanvasRenderingContext::isBitmapRenderer const):
(WebCore::CanvasRenderingContext::isPlaceholder const):

    Add predicates for ImageBitmapRenderingContext and
    PlaceholderRenderingContext.

* html/canvas/ImageBitmapRenderingContext.cpp: Added.
(WebCore::ImageBitmapRenderingContext::ImageBitmapRenderingContext):
* html/canvas/ImageBitmapRenderingContext.h: Added.
* html/canvas/ImageBitmapRenderingContext.idl: Added.
* html/canvas/PlaceholderRenderingContext.cpp: Added.
(WebCore::PlaceholderRenderingContext::PlaceholderRenderingContext):
* html/canvas/PlaceholderRenderingContext.h: Added.

    Add stubbed out implementations for the new contexts.

LayoutTests:

* js/dom/global-constructors-attributes-expected.txt:
* platform/gtk/js/dom/global-constructors-attributes-expected.txt:
* platform/mac-elcapitan-wk2/js/dom/global-constructors-attributes-expected.txt:
* platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt:
* platform/mac-sierra-wk1/js/dom/global-constructors-attributes-expected.txt:
* platform/mac-sierra/js/dom/global-constructors-attributes-expected.txt:
* platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt:
* platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt:
* platform/mac/js/dom/global-constructors-attributes-expected.txt:
* platform/win/js/dom/global-constructors-attributes-expected.txt:
* platform/wpe/js/dom/global-constructors-attributes-expected.txt:

    Update test results.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222997 268f45cc-cd09-0410-ab3c-d52691b4dbfc
28 files changed:
LayoutTests/ChangeLog
LayoutTests/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac-elcapitan-wk2/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac-sierra-wk1/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac-sierra/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/win/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/wpe/js/dom/global-constructors-attributes-expected.txt
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/Document.idl
Source/WebCore/html/HTMLCanvasElement.cpp
Source/WebCore/html/HTMLCanvasElement.h
Source/WebCore/html/HTMLCanvasElement.idl
Source/WebCore/html/canvas/CanvasRenderingContext.h
Source/WebCore/html/canvas/ImageBitmapRenderingContext.cpp [new file with mode: 0644]
Source/WebCore/html/canvas/ImageBitmapRenderingContext.h [new file with mode: 0644]
Source/WebCore/html/canvas/ImageBitmapRenderingContext.idl [new file with mode: 0644]
Source/WebCore/html/canvas/PlaceholderRenderingContext.cpp [new file with mode: 0644]
Source/WebCore/html/canvas/PlaceholderRenderingContext.h [new file with mode: 0644]