OLD | NEW |
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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 lockCompatibilityMode(); | 159 lockCompatibilityMode(); |
160 } | 160 } |
161 | 161 |
162 PassRefPtr<DocumentParser> ImageDocument::createParser() | 162 PassRefPtr<DocumentParser> ImageDocument::createParser() |
163 { | 163 { |
164 return ImageDocumentParser::create(this); | 164 return ImageDocumentParser::create(this); |
165 } | 165 } |
166 | 166 |
167 void ImageDocument::createDocumentStructure() | 167 void ImageDocument::createDocumentStructure() |
168 { | 168 { |
169 RefPtr<HTMLHtmlElement> rootElement = HTMLHtmlElement::create(this); | 169 RefPtr<HTMLHtmlElement> rootElement = HTMLHtmlElement::create(*this); |
170 appendChild(rootElement); | 170 appendChild(rootElement); |
171 rootElement->insertedByParser(); | 171 rootElement->insertedByParser(); |
172 | 172 |
173 if (frame() && frame()->loader()) | 173 if (frame() && frame()->loader()) |
174 frame()->loader()->dispatchDocumentElementAvailable(); | 174 frame()->loader()->dispatchDocumentElementAvailable(); |
175 | 175 |
176 RefPtr<HTMLHeadElement> head = HTMLHeadElement::create(this); | 176 RefPtr<HTMLHeadElement> head = HTMLHeadElement::create(*this); |
177 RefPtr<HTMLMetaElement> meta = HTMLMetaElement::create(this); | 177 RefPtr<HTMLMetaElement> meta = HTMLMetaElement::create(*this); |
178 meta->setAttribute(nameAttr, "viewport"); | 178 meta->setAttribute(nameAttr, "viewport"); |
179 meta->setAttribute(contentAttr, "width=device-width"); | 179 meta->setAttribute(contentAttr, "width=device-width"); |
180 head->appendChild(meta); | 180 head->appendChild(meta); |
181 | 181 |
182 RefPtr<HTMLBodyElement> body = HTMLBodyElement::create(this); | 182 RefPtr<HTMLBodyElement> body = HTMLBodyElement::create(*this); |
183 body->setAttribute(styleAttr, "margin: 0px;"); | 183 body->setAttribute(styleAttr, "margin: 0px;"); |
184 | 184 |
185 m_imageElement = HTMLImageElement::create(this); | 185 m_imageElement = HTMLImageElement::create(*this); |
186 m_imageElement->setAttribute(styleAttr, "-webkit-user-select: none"); | 186 m_imageElement->setAttribute(styleAttr, "-webkit-user-select: none"); |
187 m_imageElement->setLoadManually(true); | 187 m_imageElement->setLoadManually(true); |
188 m_imageElement->setSrc(url().string()); | 188 m_imageElement->setSrc(url().string()); |
189 body->appendChild(m_imageElement.get()); | 189 body->appendChild(m_imageElement.get()); |
190 | 190 |
191 if (shouldShrinkToFit()) { | 191 if (shouldShrinkToFit()) { |
192 // Add event listeners | 192 // Add event listeners |
193 RefPtr<EventListener> listener = ImageEventListener::create(this); | 193 RefPtr<EventListener> listener = ImageEventListener::create(this); |
194 if (DOMWindow* domWindow = this->domWindow()) | 194 if (DOMWindow* domWindow = this->domWindow()) |
195 domWindow->addEventListener("resize", listener, false); | 195 domWindow->addEventListener("resize", listener, false); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 } | 370 } |
371 | 371 |
372 bool ImageEventListener::operator==(const EventListener& listener) | 372 bool ImageEventListener::operator==(const EventListener& listener) |
373 { | 373 { |
374 if (const ImageEventListener* imageEventListener = ImageEventListener::cast(
&listener)) | 374 if (const ImageEventListener* imageEventListener = ImageEventListener::cast(
&listener)) |
375 return m_doc == imageEventListener->m_doc; | 375 return m_doc == imageEventListener->m_doc; |
376 return false; | 376 return false; |
377 } | 377 } |
378 | 378 |
379 } | 379 } |
OLD | NEW |