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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutImage.cpp

Issue 2754653002: Cleanup anonymous text objects that pass the document as a node. (Closed)
Patch Set: Cleanup anonymous text objects that pass the document as a node. Created 3 years, 9 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
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 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com)
6 * (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 6 * (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011 Apple Inc. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011 Apple Inc.
8 * All rights reserved. 8 * All rights reserved.
9 * Copyright (C) 2010 Google Inc. All rights reserved. 9 * Copyright (C) 2010 Google Inc. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved.
(...skipping 11 matching lines...) Expand all
22 * You should have received a copy of the GNU Library General Public License 22 * You should have received a copy of the GNU Library General Public License
23 * along with this library; see the file COPYING.LIB. If not, write to 23 * along with this library; see the file COPYING.LIB. If not, write to
24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 * Boston, MA 02110-1301, USA. 25 * Boston, MA 02110-1301, USA.
26 * 26 *
27 */ 27 */
28 28
29 #include "core/layout/LayoutImage.h" 29 #include "core/layout/LayoutImage.h"
30 30
31 #include "core/HTMLNames.h" 31 #include "core/HTMLNames.h"
32 #include "core/dom/PseudoElement.h"
32 #include "core/frame/FrameView.h" 33 #include "core/frame/FrameView.h"
33 #include "core/frame/LocalFrame.h" 34 #include "core/frame/LocalFrame.h"
34 #include "core/frame/UseCounter.h" 35 #include "core/frame/UseCounter.h"
35 #include "core/html/HTMLAreaElement.h" 36 #include "core/html/HTMLAreaElement.h"
36 #include "core/html/HTMLImageElement.h" 37 #include "core/html/HTMLImageElement.h"
37 #include "core/layout/HitTestResult.h" 38 #include "core/layout/HitTestResult.h"
38 #include "core/layout/LayoutView.h" 39 #include "core/layout/LayoutView.h"
39 #include "core/loader/resource/ImageResourceContent.h" 40 #include "core/loader/resource/ImageResourceContent.h"
40 #include "core/paint/ImagePainter.h" 41 #include "core/paint/ImagePainter.h"
41 #include "core/svg/graphics/SVGImage.h" 42 #include "core/svg/graphics/SVGImage.h"
42 43
43 namespace blink { 44 namespace blink {
44 45
45 using namespace HTMLNames; 46 using namespace HTMLNames;
46 47
47 LayoutImage::LayoutImage(Element* element) 48 LayoutImage::LayoutImage(Element* element)
48 : LayoutReplaced(element, LayoutSize()), 49 : LayoutReplaced(element, LayoutSize()),
49 m_didIncrementVisuallyNonEmptyPixelCount(false), 50 m_didIncrementVisuallyNonEmptyPixelCount(false),
50 m_isGeneratedContent(false), 51 m_isGeneratedContent(false),
51 m_imageDevicePixelRatio(1.0f) {} 52 m_imageDevicePixelRatio(1.0f) {}
52 53
53 LayoutImage* LayoutImage::createAnonymous(Document* document) { 54 LayoutImage* LayoutImage::createAnonymous(PseudoElement& pseudo) {
54 LayoutImage* image = new LayoutImage(nullptr); 55 LayoutImage* image = new LayoutImage(nullptr);
55 image->setDocumentForAnonymous(document); 56 image->setDocumentForAnonymous(&pseudo.document());
56 return image; 57 return image;
57 } 58 }
58 59
59 LayoutImage::~LayoutImage() {} 60 LayoutImage::~LayoutImage() {}
60 61
61 void LayoutImage::willBeDestroyed() { 62 void LayoutImage::willBeDestroyed() {
62 ASSERT(m_imageResource); 63 ASSERT(m_imageResource);
63 m_imageResource->shutdown(); 64 m_imageResource->shutdown();
64 LayoutReplaced::willBeDestroyed(); 65 LayoutReplaced::willBeDestroyed();
65 } 66 }
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 324
324 ImageResourceContent* cachedImage = m_imageResource->cachedImage(); 325 ImageResourceContent* cachedImage = m_imageResource->cachedImage();
325 if (cachedImage && cachedImage->getImage() && 326 if (cachedImage && cachedImage->getImage() &&
326 cachedImage->getImage()->isSVGImage()) 327 cachedImage->getImage()->isSVGImage())
327 return toSVGImage(cachedImage->getImage())->embeddedReplacedContent(); 328 return toSVGImage(cachedImage->getImage())->embeddedReplacedContent();
328 329
329 return nullptr; 330 return nullptr;
330 } 331 }
331 332
332 } // namespace blink 333 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutImage.h ('k') | third_party/WebKit/Source/core/layout/LayoutMenuList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698