Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(648)

Unified Diff: Source/core/dom/Document.cpp

Issue 177983005: Remove CanvasRenderingContext from the web exposed objects (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Document.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index e331d107e98cfc07a8680bb64feed70f1fb9491e..2c7c5c3a74ef8ed6918a08682dd8d1943972bcf6 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -135,6 +135,9 @@
#include "core/html/HTMLTemplateElement.h"
#include "core/html/HTMLTitleElement.h"
#include "core/html/PluginDocument.h"
+#include "core/html/canvas/CanvasRenderingContext.h"
+#include "core/html/canvas/CanvasRenderingContext2D.h"
+#include "core/html/canvas/WebGLRenderingContext.h"
#include "core/html/forms/FormController.h"
#include "core/html/imports/HTMLImport.h"
#include "core/html/parser/HTMLDocumentParser.h"
@@ -4708,11 +4711,21 @@ void Document::detachRange(Range* range)
m_ranges.remove(range);
}
-CanvasRenderingContext* Document::getCSSCanvasContext(const String& type, const String& name, int width, int height)
+void Document::getCSSCanvasContext(const String& type, const String& name, int width, int height, bool& is2d, RefPtr<CanvasRenderingContext2D>& context2d, bool& is3d, RefPtr<WebGLRenderingContext>& context3d)
{
HTMLCanvasElement& element = getCSSCanvasElement(name);
element.setSize(IntSize(width, height));
- return element.getContext(type);
+ CanvasRenderingContext* context = element.getContext(type);
+ if (!context)
+ return;
+
+ if (context->is2d()) {
+ is2d = true;
+ context2d = toCanvasRenderingContext2D(context);
+ } else if (context->is3d()) {
+ is3d = true;
+ context3d = toWebGLRenderingContext(context);
+ }
}
HTMLCanvasElement& Document::getCSSCanvasElement(const String& name)
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Document.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698