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

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

Issue 126443005: Use TreeScope::completeURL and baseURL instead of the Document versions (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased again, passes tests Created 6 years, 11 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/HTMLObjectElement.cpp ('k') | Source/core/html/HTMLScriptElement.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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 m_NPObject = document().frame()->script().createScriptObjectForPluginEle ment(this); 346 m_NPObject = document().frame()->script().createScriptObjectForPluginEle ment(this);
347 return m_NPObject; 347 return m_NPObject;
348 } 348 }
349 349
350 bool HTMLPlugInElement::isImageType() 350 bool HTMLPlugInElement::isImageType()
351 { 351 {
352 if (m_serviceType.isEmpty() && protocolIs(m_url, "data")) 352 if (m_serviceType.isEmpty() && protocolIs(m_url, "data"))
353 m_serviceType = mimeTypeFromDataURL(m_url); 353 m_serviceType = mimeTypeFromDataURL(m_url);
354 354
355 if (Frame* frame = document().frame()) { 355 if (Frame* frame = document().frame()) {
356 KURL completedURL = document().completeURL(m_url); 356 KURL completedURL = treeScope().completeURL(m_url);
357 return frame->loader().client()->objectContentType(completedURL, m_servi ceType, shouldPreferPlugInsForImages()) == ObjectContentImage; 357 return frame->loader().client()->objectContentType(completedURL, m_servi ceType, shouldPreferPlugInsForImages()) == ObjectContentImage;
358 } 358 }
359 359
360 return Image::supportsType(m_serviceType); 360 return Image::supportsType(m_serviceType);
361 } 361 }
362 362
363 const String HTMLPlugInElement::loadedMimeType() const 363 const String HTMLPlugInElement::loadedMimeType() const
364 { 364 {
365 String mimeType = m_serviceType; 365 String mimeType = m_serviceType;
366 if (mimeType.isEmpty()) 366 if (mimeType.isEmpty())
367 mimeType = mimeTypeFromURL(m_loadedUrl); 367 mimeType = mimeTypeFromURL(m_loadedUrl);
368 return mimeType; 368 return mimeType;
369 } 369 }
370 370
371 RenderEmbeddedObject* HTMLPlugInElement::renderEmbeddedObject() const 371 RenderEmbeddedObject* HTMLPlugInElement::renderEmbeddedObject() const
372 { 372 {
373 // HTMLObjectElement and HTMLEmbedElement may return arbitrary renderers 373 // HTMLObjectElement and HTMLEmbedElement may return arbitrary renderers
374 // when using fallback content. 374 // when using fallback content.
375 if (!renderer() || !renderer()->isEmbeddedObject()) 375 if (!renderer() || !renderer()->isEmbeddedObject())
376 return 0; 376 return 0;
377 return toRenderEmbeddedObject(renderer()); 377 return toRenderEmbeddedObject(renderer());
378 } 378 }
379 379
380 // We don't use m_url, as it may not be the final URL that the object loads, 380 // We don't use m_url, as it may not be the final URL that the object loads,
381 // depending on <param> values. 381 // depending on <param> values.
382 bool HTMLPlugInElement::allowedToLoadFrameURL(const String& url) 382 bool HTMLPlugInElement::allowedToLoadFrameURL(const String& url)
383 { 383 {
384 KURL completeURL = document().completeURL(url); 384 KURL completeURL = treeScope().completeURL(url);
385 if (contentFrame() && protocolIsJavaScript(completeURL) 385 if (contentFrame() && protocolIsJavaScript(completeURL)
386 && !document().securityOrigin()->canAccess(contentDocument()->securityOr igin())) 386 && !document().securityOrigin()->canAccess(contentDocument()->securityOr igin()))
387 return false; 387 return false;
388 return document().frame()->isURLAllowed(completeURL); 388 return document().frame()->isURLAllowed(completeURL);
389 } 389 }
390 390
391 // We don't use m_url, or m_serviceType as they may not be the final values 391 // We don't use m_url, or m_serviceType as they may not be the final values
392 // that <object> uses depending on <param> values. 392 // that <object> uses depending on <param> values.
393 bool HTMLPlugInElement::wouldLoadAsNetscapePlugin(const String& url, const Strin g& serviceType) 393 bool HTMLPlugInElement::wouldLoadAsNetscapePlugin(const String& url, const Strin g& serviceType)
394 { 394 {
395 ASSERT(document().frame()); 395 ASSERT(document().frame());
396 KURL completedURL; 396 KURL completedURL;
397 if (!url.isEmpty()) 397 if (!url.isEmpty())
398 completedURL = document().completeURL(url); 398 completedURL = treeScope().completeURL(url);
399 return document().frame()->loader().client()->objectContentType(completedURL , serviceType, shouldPreferPlugInsForImages()) == ObjectContentNetscapePlugin; 399 return document().frame()->loader().client()->objectContentType(completedURL , serviceType, shouldPreferPlugInsForImages()) == ObjectContentNetscapePlugin;
400 } 400 }
401 401
402 bool HTMLPlugInElement::requestObject(const String& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues) 402 bool HTMLPlugInElement::requestObject(const String& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues)
403 { 403 {
404 if (url.isEmpty() && mimeType.isEmpty()) 404 if (url.isEmpty() && mimeType.isEmpty())
405 return false; 405 return false;
406 406
407 // FIXME: None of this code should use renderers! 407 // FIXME: None of this code should use renderers!
408 RenderEmbeddedObject* renderer = renderEmbeddedObject(); 408 RenderEmbeddedObject* renderer = renderEmbeddedObject();
409 ASSERT(renderer); 409 ASSERT(renderer);
410 if (!renderer) 410 if (!renderer)
411 return false; 411 return false;
412 412
413 KURL completedURL = document().completeURL(url); 413 KURL completedURL = treeScope().completeURL(url);
414 if (!pluginIsLoadable(completedURL, mimeType)) 414 if (!pluginIsLoadable(completedURL, mimeType))
415 return false; 415 return false;
416 416
417 bool useFallback; 417 bool useFallback;
418 if (shouldUsePlugin(completedURL, mimeType, renderer->hasFallbackContent(), useFallback)) 418 if (shouldUsePlugin(completedURL, mimeType, renderer->hasFallbackContent(), useFallback))
419 return loadPlugin(completedURL, mimeType, paramNames, paramValues, useFa llback); 419 return loadPlugin(completedURL, mimeType, paramNames, paramValues, useFa llback);
420 420
421 // If the plug-in element already contains a subframe, 421 // If the plug-in element already contains a subframe,
422 // loadOrRedirectSubframe will re-use it. Otherwise, it will create a new 422 // loadOrRedirectSubframe will re-use it. Otherwise, it will create a new
423 // frame and set it as the RenderPart's widget, causing what was previously 423 // frame and set it as the RenderPart's widget, causing what was previously
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 if (root.isOldestAuthorShadowRoot()) 525 if (root.isOldestAuthorShadowRoot())
526 lazyReattachIfAttached(); 526 lazyReattachIfAttached();
527 } 527 }
528 528
529 bool HTMLPlugInElement::useFallbackContent() const 529 bool HTMLPlugInElement::useFallbackContent() const
530 { 530 {
531 return hasAuthorShadowRoot(); 531 return hasAuthorShadowRoot();
532 } 532 }
533 533
534 } 534 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLObjectElement.cpp ('k') | Source/core/html/HTMLScriptElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698