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

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

Issue 181823002: Have Document::getCSSCanvasElement() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Document.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4693 matching lines...) Expand 10 before | Expand all | Expand 10 after
4704 4704
4705 void Document::detachRange(Range* range) 4705 void Document::detachRange(Range* range)
4706 { 4706 {
4707 // We don't ASSERT m_ranges.contains(range) to allow us to call this 4707 // We don't ASSERT m_ranges.contains(range) to allow us to call this
4708 // unconditionally to fix: https://bugs.webkit.org/show_bug.cgi?id=26044 4708 // unconditionally to fix: https://bugs.webkit.org/show_bug.cgi?id=26044
4709 m_ranges.remove(range); 4709 m_ranges.remove(range);
4710 } 4710 }
4711 4711
4712 CanvasRenderingContext* Document::getCSSCanvasContext(const String& type, const String& name, int width, int height) 4712 CanvasRenderingContext* Document::getCSSCanvasContext(const String& type, const String& name, int width, int height)
4713 { 4713 {
4714 HTMLCanvasElement* element = getCSSCanvasElement(name); 4714 HTMLCanvasElement& element = getCSSCanvasElement(name);
4715 if (!element) 4715 element.setSize(IntSize(width, height));
4716 return 0; 4716 return element.getContext(type);
4717 element->setSize(IntSize(width, height));
4718 return element->getContext(type);
4719 } 4717 }
4720 4718
4721 HTMLCanvasElement* Document::getCSSCanvasElement(const String& name) 4719 HTMLCanvasElement& Document::getCSSCanvasElement(const String& name)
4722 { 4720 {
4723 RefPtr<HTMLCanvasElement>& element = m_cssCanvasElements.add(name, nullptr). storedValue->value; 4721 RefPtr<HTMLCanvasElement>& element = m_cssCanvasElements.add(name, nullptr). storedValue->value;
4724 if (!element) { 4722 if (!element) {
4725 element = HTMLCanvasElement::create(*this); 4723 element = HTMLCanvasElement::create(*this);
4726 element->setAccelerationDisabled(true); 4724 element->setAccelerationDisabled(true);
4727 } 4725 }
4728 return element.get(); 4726 return *element;
4729 } 4727 }
4730 4728
4731 void Document::initDNSPrefetch() 4729 void Document::initDNSPrefetch()
4732 { 4730 {
4733 Settings* settings = this->settings(); 4731 Settings* settings = this->settings();
4734 4732
4735 m_haveExplicitlyDisabledDNSPrefetch = false; 4733 m_haveExplicitlyDisabledDNSPrefetch = false;
4736 m_isDNSPrefetchEnabled = settings && settings->dnsPrefetchingEnabled() && se curityOrigin()->protocol() == "http"; 4734 m_isDNSPrefetchEnabled = settings && settings->dnsPrefetchingEnabled() && se curityOrigin()->protocol() == "http";
4737 4735
4738 // Inherit DNS prefetch opt-out from parent frame 4736 // Inherit DNS prefetch opt-out from parent frame
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
5438 void Document::defaultEventHandler(Event* event) 5436 void Document::defaultEventHandler(Event* event)
5439 { 5437 {
5440 if (frame() && frame()->remotePlatformLayer()) { 5438 if (frame() && frame()->remotePlatformLayer()) {
5441 frame()->chromeClient().forwardInputEvent(this, event); 5439 frame()->chromeClient().forwardInputEvent(this, event);
5442 return; 5440 return;
5443 } 5441 }
5444 Node::defaultEventHandler(event); 5442 Node::defaultEventHandler(event);
5445 } 5443 }
5446 5444
5447 } // namespace WebCore 5445 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698