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

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

Issue 31063004: Have Frame::loader() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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/svg/SVGAElement.cpp ('k') | Source/core/testing/Internals.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) 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 SVGImage::SVGImage(ImageObserver* observer) 55 SVGImage::SVGImage(ImageObserver* observer)
56 : Image(observer) 56 : Image(observer)
57 { 57 {
58 } 58 }
59 59
60 SVGImage::~SVGImage() 60 SVGImage::~SVGImage()
61 { 61 {
62 if (m_page) { 62 if (m_page) {
63 // Store m_page in a local variable, clearing m_page, so that SVGImageCh romeClient knows we're destructed. 63 // Store m_page in a local variable, clearing m_page, so that SVGImageCh romeClient knows we're destructed.
64 OwnPtr<Page> currentPage = m_page.release(); 64 OwnPtr<Page> currentPage = m_page.release();
65 currentPage->mainFrame()->loader()->frameDetached(); // Break both the l oader and view references to the frame 65 currentPage->mainFrame()->loader().frameDetached(); // Break both the lo ader and view references to the frame
66 } 66 }
67 67
68 // Verify that page teardown destroyed the Chrome 68 // Verify that page teardown destroyed the Chrome
69 ASSERT(!m_chromeClient || !m_chromeClient->image()); 69 ASSERT(!m_chromeClient || !m_chromeClient->image());
70 } 70 }
71 71
72 bool SVGImage::isInSVGImage(const Element* element) 72 bool SVGImage::isInSVGImage(const Element* element)
73 { 73 {
74 ASSERT(element); 74 ASSERT(element);
75 75
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 // loaded by a top-level document. 384 // loaded by a top-level document.
385 m_page = adoptPtr(new Page(pageClients)); 385 m_page = adoptPtr(new Page(pageClients));
386 m_page->settings().setMediaEnabled(false); 386 m_page->settings().setMediaEnabled(false);
387 m_page->settings().setScriptEnabled(false); 387 m_page->settings().setScriptEnabled(false);
388 m_page->settings().setPluginsEnabled(false); 388 m_page->settings().setPluginsEnabled(false);
389 m_page->settings().setAcceleratedCompositingEnabled(false); 389 m_page->settings().setAcceleratedCompositingEnabled(false);
390 390
391 RefPtr<Frame> frame = Frame::create(m_page.get(), 0, dummyFrameLoaderCli ent); 391 RefPtr<Frame> frame = Frame::create(m_page.get(), 0, dummyFrameLoaderCli ent);
392 frame->setView(FrameView::create(frame.get())); 392 frame->setView(FrameView::create(frame.get()));
393 frame->init(); 393 frame->init();
394 FrameLoader* loader = frame->loader(); 394 FrameLoader& loader = frame->loader();
395 loader->forceSandboxFlags(SandboxAll); 395 loader.forceSandboxFlags(SandboxAll);
396 396
397 frame->view()->setScrollbarsSuppressed(true); 397 frame->view()->setScrollbarsSuppressed(true);
398 frame->view()->setCanHaveScrollbars(false); // SVG Images will always sy nthesize a viewBox, if it's not available, and thus never see scrollbars. 398 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()->setTransparent(true); // SVG Images are transparent. 399 frame->view()->setTransparent(true); // SVG Images are transparent.
400 400
401 ASSERT(loader->activeDocumentLoader()); // DocumentLoader should have be en created by frame->init(). 401 ASSERT(loader.activeDocumentLoader()); // DocumentLoader should have bee n created by frame->init().
402 DocumentWriter* writer = loader->activeDocumentLoader()->beginWriting("i mage/svg+xml", "UTF-8"); 402 DocumentWriter* writer = loader.activeDocumentLoader()->beginWriting("im age/svg+xml", "UTF-8");
403 writer->addData(data()->data(), data()->size()); 403 writer->addData(data()->data(), data()->size());
404 loader->activeDocumentLoader()->endWriting(writer); 404 loader.activeDocumentLoader()->endWriting(writer);
405 // Set the intrinsic size before a container size is available. 405 // Set the intrinsic size before a container size is available.
406 m_intrinsicSize = containerSize(); 406 m_intrinsicSize = containerSize();
407 } 407 }
408 408
409 return m_page; 409 return m_page;
410 } 410 }
411 411
412 String SVGImage::filenameExtension() const 412 String SVGImage::filenameExtension() const
413 { 413 {
414 return "svg"; 414 return "svg";
415 } 415 }
416 416
417 } 417 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGAElement.cpp ('k') | Source/core/testing/Internals.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698