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

Side by Side Diff: Source/core/svg/graphics/SVGImage.cpp

Issue 120513004: Don't expose DocumentWriter to embedding layer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
OLDNEW
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 13 matching lines...) Expand all
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #include "config.h" 28 #include "config.h"
29 29
30 #include "core/svg/graphics/SVGImage.h" 30 #include "core/svg/graphics/SVGImage.h"
31 31
32 #include "core/dom/NodeTraversal.h" 32 #include "core/dom/NodeTraversal.h"
33 #include "core/dom/shadow/ComposedTreeWalker.h" 33 #include "core/dom/shadow/ComposedTreeWalker.h"
34 #include "core/loader/DocumentLoader.h" 34 #include "core/loader/FrameLoadRequest.h"
35 #include "core/page/Chrome.h" 35 #include "core/page/Chrome.h"
36 #include "core/frame/Frame.h" 36 #include "core/frame/Frame.h"
37 #include "core/frame/FrameView.h" 37 #include "core/frame/FrameView.h"
38 #include "core/frame/Settings.h" 38 #include "core/frame/Settings.h"
39 #include "core/rendering/style/RenderStyle.h" 39 #include "core/rendering/style/RenderStyle.h"
40 #include "core/rendering/svg/RenderSVGRoot.h" 40 #include "core/rendering/svg/RenderSVGRoot.h"
41 #include "core/svg/SVGDocument.h" 41 #include "core/svg/SVGDocument.h"
42 #include "core/svg/SVGFEImageElement.h" 42 #include "core/svg/SVGFEImageElement.h"
43 #include "core/svg/SVGImageElement.h" 43 #include "core/svg/SVGImageElement.h"
44 #include "core/svg/SVGSVGElement.h" 44 #include "core/svg/SVGSVGElement.h"
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 RefPtr<Frame> frame = Frame::create(FrameInit::create(0, &m_page->frameH ost(), dummyFrameLoaderClient)); 392 RefPtr<Frame> frame = Frame::create(FrameInit::create(0, &m_page->frameH ost(), dummyFrameLoaderClient));
393 frame->setView(FrameView::create(frame.get())); 393 frame->setView(FrameView::create(frame.get()));
394 frame->init(); 394 frame->init();
395 FrameLoader& loader = frame->loader(); 395 FrameLoader& loader = frame->loader();
396 loader.forceSandboxFlags(SandboxAll); 396 loader.forceSandboxFlags(SandboxAll);
397 397
398 frame->view()->setScrollbarsSuppressed(true); 398 frame->view()->setScrollbarsSuppressed(true);
399 frame->view()->setCanHaveScrollbars(false); // SVG Images will always sy nthesize a viewBox, if it's not available, and thus never see scrollbars. 399 frame->view()->setCanHaveScrollbars(false); // SVG Images will always sy nthesize a viewBox, if it's not available, and thus never see scrollbars.
400 frame->view()->setTransparent(true); // SVG Images are transparent. 400 frame->view()->setTransparent(true); // SVG Images are transparent.
401 401
402 ASSERT(loader.documentLoader()); // DocumentLoader should have been crea ted by frame->init(). 402 loader.load(FrameLoadRequest(0, blankURL(), SubstituteData(data(), "imag e/svg+xml", "UTF-8", KURL(), ForceSynchronousLoad)));
403 DocumentWriter* writer = loader.documentLoader()->beginWriting("image/sv g+xml", "UTF-8");
404 writer->addData(data()->data(), data()->size());
405 loader.documentLoader()->endWriting(writer);
406 // Set the intrinsic size before a container size is available. 403 // Set the intrinsic size before a container size is available.
407 m_intrinsicSize = containerSize(); 404 m_intrinsicSize = containerSize();
408 } 405 }
409 406
410 return m_page; 407 return m_page;
411 } 408 }
412 409
413 String SVGImage::filenameExtension() const 410 String SVGImage::filenameExtension() const
414 { 411 {
415 return "svg"; 412 return "svg";
416 } 413 }
417 414
418 } 415 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698