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

Unified Diff: Source/core/html/HTMLPlugInImageElement.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, 4 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/html/HTMLPlugInElement.cpp ('k') | Source/core/html/HTMLProgressElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLPlugInImageElement.cpp
diff --git a/Source/core/html/HTMLPlugInImageElement.cpp b/Source/core/html/HTMLPlugInImageElement.cpp
index b1ed56dd00410e8456aca2499dace407cf11c5e3..69dc7740bf14cdec1803b1e69e826555ecbb9cc1 100644
--- a/Source/core/html/HTMLPlugInImageElement.cpp
+++ b/Source/core/html/HTMLPlugInImageElement.cpp
@@ -88,8 +88,8 @@ bool HTMLPlugInImageElement::isImageType()
if (m_serviceType.isEmpty() && protocolIs(m_url, "data"))
m_serviceType = mimeTypeFromDataURL(m_url);
- if (Frame* frame = document()->frame()) {
- KURL completedURL = document()->completeURL(m_url);
+ if (Frame* frame = document().frame()) {
+ KURL completedURL = document().completeURL(m_url);
return frame->loader()->client()->objectContentType(completedURL, m_serviceType, shouldPreferPlugInsForImages()) == ObjectContentImage;
}
@@ -100,26 +100,25 @@ bool HTMLPlugInImageElement::isImageType()
// depending on <param> values.
bool HTMLPlugInImageElement::allowedToLoadFrameURL(const String& url)
{
- KURL completeURL = document()->completeURL(url);
+ KURL completeURL = document().completeURL(url);
if (contentFrame() && protocolIsJavaScript(completeURL)
- && !document()->securityOrigin()->canAccess(contentDocument()->securityOrigin()))
+ && !document().securityOrigin()->canAccess(contentDocument()->securityOrigin()))
return false;
- return document()->frame()->isURLAllowed(completeURL);
+ return document().frame()->isURLAllowed(completeURL);
}
// We don't use m_url, or m_serviceType as they may not be the final values
// that <object> uses depending on <param> values.
bool HTMLPlugInImageElement::wouldLoadAsNetscapePlugin(const String& url, const String& serviceType)
{
- ASSERT(document());
- ASSERT(document()->frame());
+ ASSERT(document().frame());
KURL completedURL;
if (!url.isEmpty())
- completedURL = document()->completeURL(url);
+ completedURL = document().completeURL(url);
- FrameLoader* frameLoader = document()->frame()->loader();
+ FrameLoader* frameLoader = document().frame()->loader();
ASSERT(frameLoader);
if (frameLoader->client()->objectContentType(completedURL, serviceType, shouldPreferPlugInsForImages()) == ObjectContentNetscapePlugin)
return true;
@@ -181,7 +180,7 @@ void HTMLPlugInImageElement::detach(const AttachContext& context)
void HTMLPlugInImageElement::updateWidgetIfNecessary()
{
- document()->updateStyleIfNeeded();
+ document().updateStyleIfNeeded();
if (!needsWidgetUpdate() || useFallbackContent() || isImageType())
return;
@@ -226,7 +225,7 @@ bool HTMLPlugInImageElement::requestObject(const String& url, const String& mime
if (!renderer)
return false;
- KURL completedURL = document()->completeURL(url);
+ KURL completedURL = document().completeURL(url);
bool useFallback;
if (shouldUsePlugin(completedURL, mimeType, renderer->hasFallbackContent(), useFallback)) {
@@ -242,7 +241,7 @@ bool HTMLPlugInImageElement::requestObject(const String& url, const String& mime
bool HTMLPlugInImageElement::loadPlugin(const KURL& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback)
{
- Frame* frame = document()->frame();
+ Frame* frame = document().frame();
if (!frame->loader()->allowPlugins(AboutToInstantiatePlugin))
return false;
@@ -261,7 +260,7 @@ bool HTMLPlugInImageElement::loadPlugin(const KURL& url, const String& mimeType,
m_loadedUrl = url;
IntSize contentSize = roundedIntSize(LayoutSize(renderer->contentWidth(), renderer->contentHeight()));
- bool loadManually = document()->isPluginDocument() && !frame->loader()->containsPlugins() && toPluginDocument(document())->shouldLoadPluginManually();
+ bool loadManually = document().isPluginDocument() && !frame->loader()->containsPlugins() && toPluginDocument(&document())->shouldLoadPluginManually();
RefPtr<Widget> widget = frame->loader()->client()->createPlugin(contentSize, this, url, paramNames, paramValues, mimeType, loadManually);
if (!widget) {
@@ -280,14 +279,14 @@ bool HTMLPlugInImageElement::shouldUsePlugin(const KURL& url, const String& mime
{
// Allow other plug-ins to win over QuickTime because if the user has installed a plug-in that
// can handle TIFF (which QuickTime can also handle) they probably intended to override QT.
- if (document()->frame()->page() && (mimeType == "image/tiff" || mimeType == "image/tif" || mimeType == "image/x-tiff")) {
- const PluginData* pluginData = document()->frame()->page()->pluginData();
+ if (document().frame()->page() && (mimeType == "image/tiff" || mimeType == "image/tif" || mimeType == "image/x-tiff")) {
+ const PluginData* pluginData = document().frame()->page()->pluginData();
String pluginName = pluginData ? pluginData->pluginNameForMimeType(mimeType) : String();
if (!pluginName.isEmpty() && !pluginName.contains("QuickTime", false))
return true;
}
- ObjectContentType objectType = document()->frame()->loader()->client()->objectContentType(url, mimeType, shouldPreferPlugInsForImages());
+ ObjectContentType objectType = document().frame()->loader()->client()->objectContentType(url, mimeType, shouldPreferPlugInsForImages());
// If an object's content can't be handled and it has no fallback, let
// it be handled as a plugin to show the broken plugin icon.
useFallback = objectType == ObjectContentNone && hasFallback;
@@ -297,7 +296,7 @@ bool HTMLPlugInImageElement::shouldUsePlugin(const KURL& url, const String& mime
bool HTMLPlugInImageElement::pluginIsLoadable(const KURL& url, const String& mimeType)
{
- Frame* frame = document()->frame();
+ Frame* frame = document().frame();
Settings* settings = frame->settings();
if (!settings)
return false;
@@ -307,24 +306,24 @@ bool HTMLPlugInImageElement::pluginIsLoadable(const KURL& url, const String& mim
return false;
}
- if (document()->isSandboxed(SandboxPlugins))
+ if (document().isSandboxed(SandboxPlugins))
return false;
- if (!document()->securityOrigin()->canDisplay(url)) {
+ if (!document().securityOrigin()->canDisplay(url)) {
FrameLoader::reportLocalLoadFailed(frame, url.string());
return false;
}
- String declaredMimeType = document()->isPluginDocument() && document()->ownerElement() ?
- document()->ownerElement()->fastGetAttribute(HTMLNames::typeAttr) :
+ String declaredMimeType = document().isPluginDocument() && document().ownerElement() ?
+ document().ownerElement()->fastGetAttribute(HTMLNames::typeAttr) :
fastGetAttribute(HTMLNames::typeAttr);
- if (!document()->contentSecurityPolicy()->allowObjectFromSource(url)
- || !document()->contentSecurityPolicy()->allowPluginType(mimeType, declaredMimeType, url)) {
+ if (!document().contentSecurityPolicy()->allowObjectFromSource(url)
+ || !document().contentSecurityPolicy()->allowPluginType(mimeType, declaredMimeType, url)) {
renderEmbeddedObject()->setPluginUnavailabilityReason(RenderEmbeddedObject::PluginBlockedByContentSecurityPolicy);
return false;
}
- if (frame->loader() && !frame->loader()->mixedContentChecker()->canRunInsecureContent(document()->securityOrigin(), url))
+ if (frame->loader() && !frame->loader()->mixedContentChecker()->canRunInsecureContent(document().securityOrigin(), url))
return false;
return true;
}
« no previous file with comments | « Source/core/html/HTMLPlugInElement.cpp ('k') | Source/core/html/HTMLProgressElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698