OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> | 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> |
3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. |
4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 if (allDataReceived) { | 465 if (allDataReceived) { |
466 // SVGImage will fire events (and the default C++ handlers run) but does
n't | 466 // SVGImage will fire events (and the default C++ handlers run) but does
n't |
467 // actually allow script to run so it's fine to call into it. We allow t
his | 467 // actually allow script to run so it's fine to call into it. We allow t
his |
468 // since it means an SVG data url can synchronously load like other imag
e | 468 // since it means an SVG data url can synchronously load like other imag
e |
469 // types. | 469 // types. |
470 EventDispatchForbiddenScope::AllowUserAgentEvents allowUserAgentEvents; | 470 EventDispatchForbiddenScope::AllowUserAgentEvents allowUserAgentEvents; |
471 | 471 |
472 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<FrameLoaderClient>, dummyFram
eLoaderClient, (EmptyFrameLoaderClient::create())); | 472 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<FrameLoaderClient>, dummyFram
eLoaderClient, (EmptyFrameLoaderClient::create())); |
473 | 473 |
474 if (m_page) { | 474 if (m_page) { |
475 toLocalFrame(m_page->mainFrame())->loader().load(FrameLoadRequest(0,
blankURL(), SubstituteData(data(), AtomicString("image/svg+xml", AtomicString::
ConstructFromLiteral), | 475 toLocalFrame(m_page->mainFrame())->loader().load(FrameLoadRequest(0,
blankURL(), SubstituteData(data(), AtomicString("image/svg+xml"), |
476 AtomicString("UTF-8", AtomicString::ConstructFromLiteral), KURL(
), ForceSynchronousLoad))); | 476 AtomicString("UTF-8"), KURL(), ForceSynchronousLoad))); |
477 return true; | 477 return true; |
478 } | 478 } |
479 | 479 |
480 Page::PageClients pageClients; | 480 Page::PageClients pageClients; |
481 fillWithEmptyClients(pageClients); | 481 fillWithEmptyClients(pageClients); |
482 m_chromeClient = SVGImageChromeClient::create(this); | 482 m_chromeClient = SVGImageChromeClient::create(this); |
483 pageClients.chromeClient = m_chromeClient.get(); | 483 pageClients.chromeClient = m_chromeClient.get(); |
484 | 484 |
485 // FIXME: If this SVG ends up loading itself, we might leak the world. | 485 // FIXME: If this SVG ends up loading itself, we might leak the world. |
486 // The Cache code does not know about ImageResources holding Frames and | 486 // The Cache code does not know about ImageResources holding Frames and |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 FrameLoader& loader = frame->loader(); | 520 FrameLoader& loader = frame->loader(); |
521 loader.forceSandboxFlags(SandboxAll); | 521 loader.forceSandboxFlags(SandboxAll); |
522 | 522 |
523 frame->view()->setScrollbarsSuppressed(true); | 523 frame->view()->setScrollbarsSuppressed(true); |
524 frame->view()->setCanHaveScrollbars(false); // SVG Images will always sy
nthesize a viewBox, if it's not available, and thus never see scrollbars. | 524 frame->view()->setCanHaveScrollbars(false); // SVG Images will always sy
nthesize a viewBox, if it's not available, and thus never see scrollbars. |
525 frame->view()->setTransparent(true); // SVG Images are transparent. | 525 frame->view()->setTransparent(true); // SVG Images are transparent. |
526 | 526 |
527 m_page = page.release(); | 527 m_page = page.release(); |
528 | 528 |
529 TRACE_EVENT0("blink", "SVGImage::dataChanged::load"); | 529 TRACE_EVENT0("blink", "SVGImage::dataChanged::load"); |
530 loader.load(FrameLoadRequest(0, blankURL(), SubstituteData(data(), Atomi
cString("image/svg+xml", AtomicString::ConstructFromLiteral), | 530 loader.load(FrameLoadRequest(0, blankURL(), SubstituteData(data(), Atomi
cString("image/svg+xml"), |
531 AtomicString("UTF-8", AtomicString::ConstructFromLiteral), KURL(), F
orceSynchronousLoad))); | 531 AtomicString("UTF-8"), KURL(), ForceSynchronousLoad))); |
532 | 532 |
533 // Set the concrete object size before a container size is available. | 533 // Set the concrete object size before a container size is available. |
534 m_intrinsicSize = roundedIntSize(concreteObjectSize(FloatSize(300, 150))
); | 534 m_intrinsicSize = roundedIntSize(concreteObjectSize(FloatSize(300, 150))
); |
535 } | 535 } |
536 | 536 |
537 return m_page; | 537 return m_page; |
538 } | 538 } |
539 | 539 |
540 String SVGImage::filenameExtension() const | 540 String SVGImage::filenameExtension() const |
541 { | 541 { |
542 return "svg"; | 542 return "svg"; |
543 } | 543 } |
544 | 544 |
545 } // namespace blink | 545 } // namespace blink |
OLD | NEW |