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

Side by Side Diff: Source/core/html/HTMLPlugInElement.cpp

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 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/html/HTMLParamElement.cpp ('k') | Source/core/html/HTMLPlugInImageElement.cpp » ('j') | 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) 2000 Stefan Schimanski (1Stein@gmx.de) 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de)
5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 if (Widget* widget = renderer->widget()) 86 if (Widget* widget = renderer->widget())
87 widget->eventListenersRemoved(); 87 widget->eventListenersRemoved();
88 } 88 }
89 } 89 }
90 90
91 void HTMLPlugInElement::detach(const AttachContext& context) 91 void HTMLPlugInElement::detach(const AttachContext& context)
92 { 92 {
93 m_instance.clear(); 93 m_instance.clear();
94 94
95 if (m_isCapturingMouseEvents) { 95 if (m_isCapturingMouseEvents) {
96 if (Frame* frame = document()->frame()) 96 if (Frame* frame = document().frame())
97 frame->eventHandler()->setCapturingMouseEventsNode(0); 97 frame->eventHandler()->setCapturingMouseEventsNode(0);
98 m_isCapturingMouseEvents = false; 98 m_isCapturingMouseEvents = false;
99 } 99 }
100 100
101 if (m_NPObject) { 101 if (m_NPObject) {
102 _NPN_ReleaseObject(m_NPObject); 102 _NPN_ReleaseObject(m_NPObject);
103 m_NPObject = 0; 103 m_NPObject = 0;
104 } 104 }
105 105
106 HTMLFrameOwnerElement::detach(context); 106 HTMLFrameOwnerElement::detach(context);
107 } 107 }
108 108
109 void HTMLPlugInElement::resetInstance() 109 void HTMLPlugInElement::resetInstance()
110 { 110 {
111 m_instance.clear(); 111 m_instance.clear();
112 } 112 }
113 113
114 PassScriptInstance HTMLPlugInElement::getInstance() 114 PassScriptInstance HTMLPlugInElement::getInstance()
115 { 115 {
116 Frame* frame = document()->frame(); 116 Frame* frame = document().frame();
117 if (!frame) 117 if (!frame)
118 return 0; 118 return 0;
119 119
120 // If the host dynamically turns off JavaScript (or Java) we will still retu rn 120 // If the host dynamically turns off JavaScript (or Java) we will still retu rn
121 // the cached allocated Bindings::Instance. Not supporting this edge-case i s OK. 121 // the cached allocated Bindings::Instance. Not supporting this edge-case i s OK.
122 if (m_instance) 122 if (m_instance)
123 return m_instance; 123 return m_instance;
124 124
125 if (Widget* widget = pluginWidget()) 125 if (Widget* widget = pluginWidget())
126 m_instance = frame->script()->createScriptInstanceForWidget(widget); 126 m_instance = frame->script()->createScriptInstanceForWidget(widget);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 if (!widget) 204 if (!widget)
205 return; 205 return;
206 widget->handleEvent(event); 206 widget->handleEvent(event);
207 if (event->defaultHandled()) 207 if (event->defaultHandled())
208 return; 208 return;
209 HTMLFrameOwnerElement::defaultEventHandler(event); 209 HTMLFrameOwnerElement::defaultEventHandler(event);
210 } 210 }
211 211
212 RenderWidget* HTMLPlugInElement::renderWidgetForJSBindings() const 212 RenderWidget* HTMLPlugInElement::renderWidgetForJSBindings() const
213 { 213 {
214 document()->updateLayoutIgnorePendingStylesheets(); 214 document().updateLayoutIgnorePendingStylesheets();
215 return existingRenderWidget(); 215 return existingRenderWidget();
216 } 216 }
217 217
218 bool HTMLPlugInElement::isKeyboardFocusable() const 218 bool HTMLPlugInElement::isKeyboardFocusable() const
219 { 219 {
220 if (!document()->page()) 220 if (!document().page())
221 return false; 221 return false;
222 222
223 const PluginView* plugin = pluginWidget() && pluginWidget()->isPluginView() ? static_cast<const PluginView*>(pluginWidget()) : 0; 223 const PluginView* plugin = pluginWidget() && pluginWidget()->isPluginView() ? static_cast<const PluginView*>(pluginWidget()) : 0;
224 if (plugin) 224 if (plugin)
225 return plugin->supportsKeyboardFocus(); 225 return plugin->supportsKeyboardFocus();
226 226
227 return false; 227 return false;
228 } 228 }
229 229
230 bool HTMLPlugInElement::isPluginElement() const 230 bool HTMLPlugInElement::isPluginElement() const
231 { 231 {
232 return true; 232 return true;
233 } 233 }
234 234
235 bool HTMLPlugInElement::rendererIsFocusable() const 235 bool HTMLPlugInElement::rendererIsFocusable() const
236 { 236 {
237 if (HTMLFrameOwnerElement::supportsFocus() && HTMLFrameOwnerElement::rendere rIsFocusable()) 237 if (HTMLFrameOwnerElement::supportsFocus() && HTMLFrameOwnerElement::rendere rIsFocusable())
238 return true; 238 return true;
239 239
240 if (useFallbackContent() || !renderer() || !renderer()->isEmbeddedObject()) 240 if (useFallbackContent() || !renderer() || !renderer()->isEmbeddedObject())
241 return false; 241 return false;
242 return !toRenderEmbeddedObject(renderer())->showsUnavailablePluginIndicator( ); 242 return !toRenderEmbeddedObject(renderer())->showsUnavailablePluginIndicator( );
243 } 243 }
244 244
245 NPObject* HTMLPlugInElement::getNPObject() 245 NPObject* HTMLPlugInElement::getNPObject()
246 { 246 {
247 ASSERT(document()->frame()); 247 ASSERT(document().frame());
248 if (!m_NPObject) 248 if (!m_NPObject)
249 m_NPObject = document()->frame()->script()->createScriptObjectForPluginE lement(this); 249 m_NPObject = document().frame()->script()->createScriptObjectForPluginEl ement(this);
250 return m_NPObject; 250 return m_NPObject;
251 } 251 }
252 252
253 } 253 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLParamElement.cpp ('k') | Source/core/html/HTMLPlugInImageElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698