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

Side by Side 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, 9 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 #include "core/html/HTMLIFrameElement.h" 128 #include "core/html/HTMLIFrameElement.h"
129 #include "core/html/HTMLInputElement.h" 129 #include "core/html/HTMLInputElement.h"
130 #include "core/html/HTMLLinkElement.h" 130 #include "core/html/HTMLLinkElement.h"
131 #include "core/html/HTMLMetaElement.h" 131 #include "core/html/HTMLMetaElement.h"
132 #include "core/html/HTMLNameCollection.h" 132 #include "core/html/HTMLNameCollection.h"
133 #include "core/html/HTMLScriptElement.h" 133 #include "core/html/HTMLScriptElement.h"
134 #include "core/html/HTMLStyleElement.h" 134 #include "core/html/HTMLStyleElement.h"
135 #include "core/html/HTMLTemplateElement.h" 135 #include "core/html/HTMLTemplateElement.h"
136 #include "core/html/HTMLTitleElement.h" 136 #include "core/html/HTMLTitleElement.h"
137 #include "core/html/PluginDocument.h" 137 #include "core/html/PluginDocument.h"
138 #include "core/html/canvas/CanvasRenderingContext.h"
139 #include "core/html/canvas/CanvasRenderingContext2D.h"
140 #include "core/html/canvas/WebGLRenderingContext.h"
138 #include "core/html/forms/FormController.h" 141 #include "core/html/forms/FormController.h"
139 #include "core/html/imports/HTMLImport.h" 142 #include "core/html/imports/HTMLImport.h"
140 #include "core/html/parser/HTMLDocumentParser.h" 143 #include "core/html/parser/HTMLDocumentParser.h"
141 #include "core/html/parser/HTMLParserIdioms.h" 144 #include "core/html/parser/HTMLParserIdioms.h"
142 #include "core/html/parser/NestingLevelIncrementer.h" 145 #include "core/html/parser/NestingLevelIncrementer.h"
143 #include "core/html/parser/TextResourceDecoder.h" 146 #include "core/html/parser/TextResourceDecoder.h"
144 #include "core/inspector/InspectorCounters.h" 147 #include "core/inspector/InspectorCounters.h"
145 #include "core/inspector/InspectorInstrumentation.h" 148 #include "core/inspector/InspectorInstrumentation.h"
146 #include "core/inspector/ScriptCallStack.h" 149 #include "core/inspector/ScriptCallStack.h"
147 #include "core/loader/CookieJar.h" 150 #include "core/loader/CookieJar.h"
(...skipping 4552 matching lines...) Expand 10 before | Expand all | Expand 10 after
4700 m_ranges.add(range); 4703 m_ranges.add(range);
4701 } 4704 }
4702 4705
4703 void Document::detachRange(Range* range) 4706 void Document::detachRange(Range* range)
4704 { 4707 {
4705 // We don't ASSERT m_ranges.contains(range) to allow us to call this 4708 // We don't ASSERT m_ranges.contains(range) to allow us to call this
4706 // unconditionally to fix: https://bugs.webkit.org/show_bug.cgi?id=26044 4709 // unconditionally to fix: https://bugs.webkit.org/show_bug.cgi?id=26044
4707 m_ranges.remove(range); 4710 m_ranges.remove(range);
4708 } 4711 }
4709 4712
4710 CanvasRenderingContext* Document::getCSSCanvasContext(const String& type, const String& name, int width, int height) 4713 void Document::getCSSCanvasContext(const String& type, const String& name, int w idth, int height, bool& is2d, RefPtr<CanvasRenderingContext2D>& context2d, bool& is3d, RefPtr<WebGLRenderingContext>& context3d)
4711 { 4714 {
4712 HTMLCanvasElement& element = getCSSCanvasElement(name); 4715 HTMLCanvasElement& element = getCSSCanvasElement(name);
4713 element.setSize(IntSize(width, height)); 4716 element.setSize(IntSize(width, height));
4714 return element.getContext(type); 4717 CanvasRenderingContext* context = element.getContext(type);
4718 if (!context)
4719 return;
4720
4721 if (context->is2d()) {
4722 is2d = true;
4723 context2d = toCanvasRenderingContext2D(context);
4724 } else if (context->is3d()) {
4725 is3d = true;
4726 context3d = toWebGLRenderingContext(context);
Stephen White 2014/02/28 23:36:40 Wow.. I'd never even thought of trying WebGL as a
4727 }
4715 } 4728 }
4716 4729
4717 HTMLCanvasElement& Document::getCSSCanvasElement(const String& name) 4730 HTMLCanvasElement& Document::getCSSCanvasElement(const String& name)
4718 { 4731 {
4719 RefPtr<HTMLCanvasElement>& element = m_cssCanvasElements.add(name, nullptr). storedValue->value; 4732 RefPtr<HTMLCanvasElement>& element = m_cssCanvasElements.add(name, nullptr). storedValue->value;
4720 if (!element) { 4733 if (!element) {
4721 element = HTMLCanvasElement::create(*this); 4734 element = HTMLCanvasElement::create(*this);
4722 element->setAccelerationDisabled(true); 4735 element->setAccelerationDisabled(true);
4723 } 4736 }
4724 return *element; 4737 return *element;
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
5434 void Document::defaultEventHandler(Event* event) 5447 void Document::defaultEventHandler(Event* event)
5435 { 5448 {
5436 if (frame() && frame()->remotePlatformLayer()) { 5449 if (frame() && frame()->remotePlatformLayer()) {
5437 frame()->chromeClient().forwardInputEvent(this, event); 5450 frame()->chromeClient().forwardInputEvent(this, event);
5438 return; 5451 return;
5439 } 5452 }
5440 Node::defaultEventHandler(event); 5453 Node::defaultEventHandler(event);
5441 } 5454 }
5442 5455
5443 } // namespace WebCore 5456 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698