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

Side by Side Diff: third_party/WebKit/Source/core/html/ImageDocument.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include <limits> 50 #include <limits>
51 51
52 using namespace std; 52 using namespace std;
53 53
54 namespace blink { 54 namespace blink {
55 55
56 using namespace HTMLNames; 56 using namespace HTMLNames;
57 57
58 class ImageEventListener : public EventListener { 58 class ImageEventListener : public EventListener {
59 public: 59 public:
60 static PassRefPtrWillBeRawPtr<ImageEventListener> create(ImageDocument* docu ment) 60 static RawPtr<ImageEventListener> create(ImageDocument* document)
61 { 61 {
62 return adoptRefWillBeNoop(new ImageEventListener(document)); 62 return new ImageEventListener(document);
63 } 63 }
64 static const ImageEventListener* cast(const EventListener* listener) 64 static const ImageEventListener* cast(const EventListener* listener)
65 { 65 {
66 return listener->type() == ImageEventListenerType 66 return listener->type() == ImageEventListenerType
67 ? static_cast<const ImageEventListener*>(listener) 67 ? static_cast<const ImageEventListener*>(listener)
68 : 0; 68 : 0;
69 } 69 }
70 70
71 bool operator==(const EventListener& other) const override; 71 bool operator==(const EventListener& other) const override;
72 72
73 DEFINE_INLINE_VIRTUAL_TRACE() 73 DEFINE_INLINE_VIRTUAL_TRACE()
74 { 74 {
75 visitor->trace(m_doc); 75 visitor->trace(m_doc);
76 EventListener::trace(visitor); 76 EventListener::trace(visitor);
77 } 77 }
78 78
79 private: 79 private:
80 ImageEventListener(ImageDocument* document) 80 ImageEventListener(ImageDocument* document)
81 : EventListener(ImageEventListenerType) 81 : EventListener(ImageEventListenerType)
82 , m_doc(document) 82 , m_doc(document)
83 { 83 {
84 } 84 }
85 85
86 virtual void handleEvent(ExecutionContext*, Event*); 86 virtual void handleEvent(ExecutionContext*, Event*);
87 87
88 RawPtrWillBeMember<ImageDocument> m_doc; 88 Member<ImageDocument> m_doc;
89 }; 89 };
90 90
91 class ImageDocumentParser : public RawDataDocumentParser { 91 class ImageDocumentParser : public RawDataDocumentParser {
92 public: 92 public:
93 static PassRefPtrWillBeRawPtr<ImageDocumentParser> create(ImageDocument* doc ument) 93 static RawPtr<ImageDocumentParser> create(ImageDocument* document)
94 { 94 {
95 return adoptRefWillBeNoop(new ImageDocumentParser(document)); 95 return new ImageDocumentParser(document);
96 } 96 }
97 97
98 ImageDocument* document() const 98 ImageDocument* document() const
99 { 99 {
100 return toImageDocument(RawDataDocumentParser::document()); 100 return toImageDocument(RawDataDocumentParser::document());
101 } 101 }
102 102
103 private: 103 private:
104 ImageDocumentParser(ImageDocument* document) 104 ImageDocumentParser(ImageDocument* document)
105 : RawDataDocumentParser(document) 105 : RawDataDocumentParser(document)
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 , m_imageElement(nullptr) 189 , m_imageElement(nullptr)
190 , m_imageSizeIsKnown(false) 190 , m_imageSizeIsKnown(false)
191 , m_didShrinkImage(false) 191 , m_didShrinkImage(false)
192 , m_shouldShrinkImage(shouldShrinkToFit()) 192 , m_shouldShrinkImage(shouldShrinkToFit())
193 , m_shrinkToFitMode(frame()->settings()->viewportEnabled() ? Viewport : Desk top) 193 , m_shrinkToFitMode(frame()->settings()->viewportEnabled() ? Viewport : Desk top)
194 { 194 {
195 setCompatibilityMode(QuirksMode); 195 setCompatibilityMode(QuirksMode);
196 lockCompatibilityMode(); 196 lockCompatibilityMode();
197 } 197 }
198 198
199 PassRefPtrWillBeRawPtr<DocumentParser> ImageDocument::createParser() 199 RawPtr<DocumentParser> ImageDocument::createParser()
200 { 200 {
201 return ImageDocumentParser::create(this); 201 return ImageDocumentParser::create(this);
202 } 202 }
203 203
204 void ImageDocument::createDocumentStructure() 204 void ImageDocument::createDocumentStructure()
205 { 205 {
206 RefPtrWillBeRawPtr<HTMLHtmlElement> rootElement = HTMLHtmlElement::create(*t his); 206 RawPtr<HTMLHtmlElement> rootElement = HTMLHtmlElement::create(*this);
207 appendChild(rootElement); 207 appendChild(rootElement);
208 rootElement->insertedByParser(); 208 rootElement->insertedByParser();
209 209
210 frame()->loader().dispatchDocumentElementAvailable(); 210 frame()->loader().dispatchDocumentElementAvailable();
211 frame()->loader().runScriptsAtDocumentElementAvailable(); 211 frame()->loader().runScriptsAtDocumentElementAvailable();
212 if (isStopped()) 212 if (isStopped())
213 return; // runScriptsAtDocumentElementAvailable can detach the frame. 213 return; // runScriptsAtDocumentElementAvailable can detach the frame.
214 214
215 RefPtrWillBeRawPtr<HTMLHeadElement> head = HTMLHeadElement::create(*this); 215 RawPtr<HTMLHeadElement> head = HTMLHeadElement::create(*this);
216 RefPtrWillBeRawPtr<HTMLMetaElement> meta = HTMLMetaElement::create(*this); 216 RawPtr<HTMLMetaElement> meta = HTMLMetaElement::create(*this);
217 meta->setAttribute(nameAttr, "viewport"); 217 meta->setAttribute(nameAttr, "viewport");
218 meta->setAttribute(contentAttr, "width=device-width, minimum-scale=0.1"); 218 meta->setAttribute(contentAttr, "width=device-width, minimum-scale=0.1");
219 head->appendChild(meta); 219 head->appendChild(meta);
220 220
221 RefPtrWillBeRawPtr<HTMLBodyElement> body = HTMLBodyElement::create(*this); 221 RawPtr<HTMLBodyElement> body = HTMLBodyElement::create(*this);
222 body->setAttribute(styleAttr, "margin: 0px;"); 222 body->setAttribute(styleAttr, "margin: 0px;");
223 223
224 frame()->loader().client()->dispatchWillInsertBody(); 224 frame()->loader().client()->dispatchWillInsertBody();
225 225
226 m_imageElement = HTMLImageElement::create(*this); 226 m_imageElement = HTMLImageElement::create(*this);
227 m_imageElement->setAttribute(styleAttr, "-webkit-user-select: none"); 227 m_imageElement->setAttribute(styleAttr, "-webkit-user-select: none");
228 m_imageElement->setLoadingImageDocument(); 228 m_imageElement->setLoadingImageDocument();
229 m_imageElement->setSrc(url().getString()); 229 m_imageElement->setSrc(url().getString());
230 body->appendChild(m_imageElement.get()); 230 body->appendChild(m_imageElement.get());
231 if (loader() && m_imageElement->cachedImage()) 231 if (loader() && m_imageElement->cachedImage())
232 m_imageElement->cachedImage()->responseReceived(loader()->response(), nu llptr); 232 m_imageElement->cachedImage()->responseReceived(loader()->response(), nu llptr);
233 233
234 if (shouldShrinkToFit()) { 234 if (shouldShrinkToFit()) {
235 // Add event listeners 235 // Add event listeners
236 RefPtrWillBeRawPtr<EventListener> listener = ImageEventListener::create( this); 236 RawPtr<EventListener> listener = ImageEventListener::create(this);
237 if (LocalDOMWindow* domWindow = this->domWindow()) 237 if (LocalDOMWindow* domWindow = this->domWindow())
238 domWindow->addEventListener("resize", listener, false); 238 domWindow->addEventListener("resize", listener, false);
239 if (m_shrinkToFitMode == Desktop) 239 if (m_shrinkToFitMode == Desktop)
240 m_imageElement->addEventListener("click", listener.release(), false) ; 240 m_imageElement->addEventListener("click", listener.release(), false) ;
241 } 241 }
242 242
243 rootElement->appendChild(head); 243 rootElement->appendChild(head);
244 rootElement->appendChild(body); 244 rootElement->appendChild(body);
245 } 245 }
246 246
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 } 449 }
450 450
451 bool ImageEventListener::operator==(const EventListener& listener) const 451 bool ImageEventListener::operator==(const EventListener& listener) const
452 { 452 {
453 if (const ImageEventListener* imageEventListener = ImageEventListener::cast( &listener)) 453 if (const ImageEventListener* imageEventListener = ImageEventListener::cast( &listener))
454 return m_doc == imageEventListener->m_doc; 454 return m_doc == imageEventListener->m_doc;
455 return false; 455 return false;
456 } 456 }
457 457
458 } // namespace blink 458 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/ImageDocument.h ('k') | third_party/WebKit/Source/core/html/LabelableElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698