| 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 15 matching lines...) Expand all Loading... |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #include "core/svg/graphics/SVGImage.h" | 28 #include "core/svg/graphics/SVGImage.h" |
| 29 | 29 |
| 30 #include "core/animation/DocumentAnimations.h" | 30 #include "core/animation/DocumentAnimations.h" |
| 31 #include "core/animation/DocumentTimeline.h" | 31 #include "core/animation/DocumentTimeline.h" |
| 32 #include "core/dom/NodeTraversal.h" | 32 #include "core/dom/NodeTraversal.h" |
| 33 #include "core/dom/shadow/FlatTreeTraversal.h" | 33 #include "core/dom/shadow/FlatTreeTraversal.h" |
| 34 #include "core/frame/FrameView.h" | 34 #include "core/frame/FrameView.h" |
| 35 #include "core/frame/LocalFrame.h" | 35 #include "core/frame/LocalFrame.h" |
| 36 #include "core/frame/LocalFrameClient.h" |
| 36 #include "core/frame/Settings.h" | 37 #include "core/frame/Settings.h" |
| 37 #include "core/layout/LayoutView.h" | 38 #include "core/layout/LayoutView.h" |
| 38 #include "core/layout/svg/LayoutSVGRoot.h" | 39 #include "core/layout/svg/LayoutSVGRoot.h" |
| 39 #include "core/loader/FrameLoadRequest.h" | 40 #include "core/loader/FrameLoadRequest.h" |
| 40 #include "core/paint/FloatClipRecorder.h" | 41 #include "core/paint/FloatClipRecorder.h" |
| 41 #include "core/paint/TransformRecorder.h" | 42 #include "core/paint/TransformRecorder.h" |
| 42 #include "core/style/ComputedStyle.h" | 43 #include "core/style/ComputedStyle.h" |
| 43 #include "core/svg/SVGDocumentExtensions.h" | 44 #include "core/svg/SVGDocumentExtensions.h" |
| 44 #include "core/svg/SVGFEImageElement.h" | 45 #include "core/svg/SVGFEImageElement.h" |
| 45 #include "core/svg/SVGImageElement.h" | 46 #include "core/svg/SVGImageElement.h" |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 if (!data()->size()) | 573 if (!data()->size()) |
| 573 return SizeAvailable; | 574 return SizeAvailable; |
| 574 | 575 |
| 575 if (allDataReceived) { | 576 if (allDataReceived) { |
| 576 // SVGImage will fire events (and the default C++ handlers run) but doesn't | 577 // SVGImage will fire events (and the default C++ handlers run) but doesn't |
| 577 // actually allow script to run so it's fine to call into it. We allow this | 578 // actually allow script to run so it's fine to call into it. We allow this |
| 578 // since it means an SVG data url can synchronously load like other image | 579 // since it means an SVG data url can synchronously load like other image |
| 579 // types. | 580 // types. |
| 580 EventDispatchForbiddenScope::AllowUserAgentEvents allowUserAgentEvents; | 581 EventDispatchForbiddenScope::AllowUserAgentEvents allowUserAgentEvents; |
| 581 | 582 |
| 582 DEFINE_STATIC_LOCAL(FrameLoaderClient, dummyFrameLoaderClient, | 583 DEFINE_STATIC_LOCAL(LocalFrameClient, dummyLocalFrameClient, |
| 583 (EmptyFrameLoaderClient::create())); | 584 (EmptyLocalFrameClient::create())); |
| 584 | 585 |
| 585 if (m_page) { | 586 if (m_page) { |
| 586 toLocalFrame(m_page->mainFrame()) | 587 toLocalFrame(m_page->mainFrame()) |
| 587 ->loader() | 588 ->loader() |
| 588 .load(FrameLoadRequest( | 589 .load(FrameLoadRequest( |
| 589 0, blankURL(), | 590 0, blankURL(), |
| 590 SubstituteData(data(), AtomicString("image/svg+xml"), | 591 SubstituteData(data(), AtomicString("image/svg+xml"), |
| 591 AtomicString("UTF-8"), KURL(), | 592 AtomicString("UTF-8"), KURL(), |
| 592 ForceSynchronousLoad))); | 593 ForceSynchronousLoad))); |
| 593 return SizeAvailable; | 594 return SizeAvailable; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 page->settings().setDefaultFontSize( | 628 page->settings().setDefaultFontSize( |
| 628 defaultSettings.getDefaultFontSize()); | 629 defaultSettings.getDefaultFontSize()); |
| 629 page->settings().setDefaultFixedFontSize( | 630 page->settings().setDefaultFixedFontSize( |
| 630 defaultSettings.getDefaultFixedFontSize()); | 631 defaultSettings.getDefaultFixedFontSize()); |
| 631 } | 632 } |
| 632 } | 633 } |
| 633 | 634 |
| 634 LocalFrame* frame = nullptr; | 635 LocalFrame* frame = nullptr; |
| 635 { | 636 { |
| 636 TRACE_EVENT0("blink", "SVGImage::dataChanged::createFrame"); | 637 TRACE_EVENT0("blink", "SVGImage::dataChanged::createFrame"); |
| 637 frame = | 638 frame = LocalFrame::create(&dummyLocalFrameClient, &page->frameHost(), 0); |
| 638 LocalFrame::create(&dummyFrameLoaderClient, &page->frameHost(), 0); | |
| 639 frame->setView(FrameView::create(*frame)); | 639 frame->setView(FrameView::create(*frame)); |
| 640 frame->init(); | 640 frame->init(); |
| 641 } | 641 } |
| 642 | 642 |
| 643 FrameLoader& loader = frame->loader(); | 643 FrameLoader& loader = frame->loader(); |
| 644 loader.forceSandboxFlags(SandboxAll); | 644 loader.forceSandboxFlags(SandboxAll); |
| 645 | 645 |
| 646 frame->view()->setScrollbarsSuppressed(true); | 646 frame->view()->setScrollbarsSuppressed(true); |
| 647 // SVG Images will always synthesize a viewBox, if it's not available, and | 647 // SVG Images will always synthesize a viewBox, if it's not available, and |
| 648 // thus never see scrollbars. | 648 // thus never see scrollbars. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 664 } | 664 } |
| 665 | 665 |
| 666 return m_page ? SizeAvailable : SizeUnavailable; | 666 return m_page ? SizeAvailable : SizeUnavailable; |
| 667 } | 667 } |
| 668 | 668 |
| 669 String SVGImage::filenameExtension() const { | 669 String SVGImage::filenameExtension() const { |
| 670 return "svg"; | 670 return "svg"; |
| 671 } | 671 } |
| 672 | 672 |
| 673 } // namespace blink | 673 } // namespace blink |
| OLD | NEW |