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

Side by Side Diff: Source/core/dom/Document.cpp

Issue 795833004: Use dictionaries for context creation attributes. Eliminate custom bindings. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years 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 | Annotate | Revision Log
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 #include "core/html/HTMLIFrameElement.h" 138 #include "core/html/HTMLIFrameElement.h"
139 #include "core/html/HTMLInputElement.h" 139 #include "core/html/HTMLInputElement.h"
140 #include "core/html/HTMLLinkElement.h" 140 #include "core/html/HTMLLinkElement.h"
141 #include "core/html/HTMLMetaElement.h" 141 #include "core/html/HTMLMetaElement.h"
142 #include "core/html/HTMLScriptElement.h" 142 #include "core/html/HTMLScriptElement.h"
143 #include "core/html/HTMLStyleElement.h" 143 #include "core/html/HTMLStyleElement.h"
144 #include "core/html/HTMLTemplateElement.h" 144 #include "core/html/HTMLTemplateElement.h"
145 #include "core/html/HTMLTitleElement.h" 145 #include "core/html/HTMLTitleElement.h"
146 #include "core/html/PluginDocument.h" 146 #include "core/html/PluginDocument.h"
147 #include "core/html/WindowNameCollection.h" 147 #include "core/html/WindowNameCollection.h"
148 #include "core/html/canvas/CanvasContextCreationAttributes.h"
148 #include "core/html/canvas/CanvasRenderingContext.h" 149 #include "core/html/canvas/CanvasRenderingContext.h"
149 #include "core/html/canvas/CanvasRenderingContext2D.h" 150 #include "core/html/canvas/CanvasRenderingContext2D.h"
150 #include "core/html/canvas/WebGLRenderingContext.h" 151 #include "core/html/canvas/WebGLRenderingContext.h"
151 #include "core/html/forms/FormController.h" 152 #include "core/html/forms/FormController.h"
152 #include "core/html/imports/HTMLImportLoader.h" 153 #include "core/html/imports/HTMLImportLoader.h"
153 #include "core/html/imports/HTMLImportsController.h" 154 #include "core/html/imports/HTMLImportsController.h"
154 #include "core/html/parser/HTMLDocumentParser.h" 155 #include "core/html/parser/HTMLDocumentParser.h"
155 #include "core/html/parser/HTMLParserIdioms.h" 156 #include "core/html/parser/HTMLParserIdioms.h"
156 #include "core/html/parser/NestingLevelIncrementer.h" 157 #include "core/html/parser/NestingLevelIncrementer.h"
157 #include "core/html/parser/TextResourceDecoder.h" 158 #include "core/html/parser/TextResourceDecoder.h"
(...skipping 4777 matching lines...) Expand 10 before | Expand all | Expand 10 after
4935 { 4936 {
4936 // We don't ASSERT m_ranges.contains(range) to allow us to call this 4937 // We don't ASSERT m_ranges.contains(range) to allow us to call this
4937 // unconditionally to fix: https://bugs.webkit.org/show_bug.cgi?id=26044 4938 // unconditionally to fix: https://bugs.webkit.org/show_bug.cgi?id=26044
4938 m_ranges.remove(range); 4939 m_ranges.remove(range);
4939 } 4940 }
4940 4941
4941 void Document::getCSSCanvasContext(const String& type, const String& name, int w idth, int height, CanvasRenderingContext2DOrWebGLRenderingContext& returnValue) 4942 void Document::getCSSCanvasContext(const String& type, const String& name, int w idth, int height, CanvasRenderingContext2DOrWebGLRenderingContext& returnValue)
4942 { 4943 {
4943 HTMLCanvasElement& element = getCSSCanvasElement(name); 4944 HTMLCanvasElement& element = getCSSCanvasElement(name);
4944 element.setSize(IntSize(width, height)); 4945 element.setSize(IntSize(width, height));
4945 CanvasRenderingContext* context = element.getContext(type); 4946 element.getContext(type, CanvasContextCreationAttributes(), returnValue);
4946 if (!context)
4947 return;
4948
4949 if (context->is2d()) {
4950 returnValue.setCanvasRenderingContext2D(toCanvasRenderingContext2D(conte xt));
4951 } else if (context->is3d()) {
4952 returnValue.setWebGLRenderingContext(toWebGLRenderingContext(context));
4953 }
4954 } 4947 }
4955 4948
4956 HTMLCanvasElement& Document::getCSSCanvasElement(const String& name) 4949 HTMLCanvasElement& Document::getCSSCanvasElement(const String& name)
4957 { 4950 {
4958 RefPtrWillBeMember<HTMLCanvasElement>& element = m_cssCanvasElements.add(nam e, nullptr).storedValue->value; 4951 RefPtrWillBeMember<HTMLCanvasElement>& element = m_cssCanvasElements.add(nam e, nullptr).storedValue->value;
4959 if (!element) { 4952 if (!element) {
4960 element = HTMLCanvasElement::create(*this); 4953 element = HTMLCanvasElement::create(*this);
4961 element->setAccelerationDisabled(true); 4954 element->setAccelerationDisabled(true);
4962 } 4955 }
4963 return *element; 4956 return *element;
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
5847 #ifndef NDEBUG 5840 #ifndef NDEBUG
5848 using namespace blink; 5841 using namespace blink;
5849 void showLiveDocumentInstances() 5842 void showLiveDocumentInstances()
5850 { 5843 {
5851 WeakDocumentSet& set = liveDocumentSet(); 5844 WeakDocumentSet& set = liveDocumentSet();
5852 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5845 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5853 for (Document* document : set) 5846 for (Document* document : set)
5854 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5847 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5855 } 5848 }
5856 #endif 5849 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698