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

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

Issue 1866343002: Measure usage of image/media/plugin/text documents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
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)
106 { 106 {
107 UseCounter::count(document, UseCounter::ImageDocument);
108 } 107 }
109 108
110 void appendBytes(const char*, size_t) override; 109 void appendBytes(const char*, size_t) override;
111 virtual void finish(); 110 virtual void finish();
112 }; 111 };
113 112
114 // -------- 113 // --------
115 114
116 static float pageZoomFactor(const Document* document) 115 static float pageZoomFactor(const Document* document)
117 { 116 {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 ImageDocument::ImageDocument(const DocumentInit& initializer) 186 ImageDocument::ImageDocument(const DocumentInit& initializer)
188 : HTMLDocument(initializer, ImageDocumentClass) 187 : HTMLDocument(initializer, ImageDocumentClass)
189 , m_imageElement(nullptr) 188 , m_imageElement(nullptr)
190 , m_imageSizeIsKnown(false) 189 , m_imageSizeIsKnown(false)
191 , m_didShrinkImage(false) 190 , m_didShrinkImage(false)
192 , m_shouldShrinkImage(shouldShrinkToFit()) 191 , m_shouldShrinkImage(shouldShrinkToFit())
193 , m_shrinkToFitMode(frame()->settings()->viewportEnabled() ? Viewport : Desk top) 192 , m_shrinkToFitMode(frame()->settings()->viewportEnabled() ? Viewport : Desk top)
194 { 193 {
195 setCompatibilityMode(QuirksMode); 194 setCompatibilityMode(QuirksMode);
196 lockCompatibilityMode(); 195 lockCompatibilityMode();
196 UseCounter::count(*this, UseCounter::ImageDocument);
197 if (ownerElement())
198 UseCounter::count(*this, UseCounter::ImageDocumentInFrame);
197 } 199 }
198 200
199 DocumentParser* ImageDocument::createParser() 201 DocumentParser* ImageDocument::createParser()
200 { 202 {
201 return ImageDocumentParser::create(this); 203 return ImageDocumentParser::create(this);
202 } 204 }
203 205
204 void ImageDocument::createDocumentStructure() 206 void ImageDocument::createDocumentStructure()
205 { 207 {
206 HTMLHtmlElement* rootElement = HTMLHtmlElement::create(*this); 208 HTMLHtmlElement* rootElement = HTMLHtmlElement::create(*this);
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 } 443 }
442 444
443 bool ImageEventListener::operator==(const EventListener& listener) const 445 bool ImageEventListener::operator==(const EventListener& listener) const
444 { 446 {
445 if (const ImageEventListener* imageEventListener = ImageEventListener::cast( &listener)) 447 if (const ImageEventListener* imageEventListener = ImageEventListener::cast( &listener))
446 return m_doc == imageEventListener->m_doc; 448 return m_doc == imageEventListener->m_doc;
447 return false; 449 return false;
448 } 450 }
449 451
450 } // namespace blink 452 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLViewSourceDocument.cpp ('k') | third_party/WebKit/Source/core/html/MediaDocument.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698