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

Side by Side Diff: third_party/WebKit/Source/core/loader/ImageLoader.cpp

Issue 2423683002: Add Blink support for showing image placeholders using range requests. (Closed)
Patch Set: Addressed comments and fixed bugs Created 4 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
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 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights 4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights
5 * reserved. 5 * reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 } 306 }
307 307
308 if (isHTMLPictureElement(element()->parentNode()) || 308 if (isHTMLPictureElement(element()->parentNode()) ||
309 !element()->fastGetAttribute(HTMLNames::srcsetAttr).isNull()) 309 !element()->fastGetAttribute(HTMLNames::srcsetAttr).isNull())
310 resourceRequest.setRequestContext(WebURLRequest::RequestContextImageSet); 310 resourceRequest.setRequestContext(WebURLRequest::RequestContextImageSet);
311 FetchRequest request(resourceRequest, element()->localName(), 311 FetchRequest request(resourceRequest, element()->localName(),
312 resourceLoaderOptions); 312 resourceLoaderOptions);
313 configureRequest(request, bypassBehavior, *m_element, 313 configureRequest(request, bypassBehavior, *m_element,
314 document.clientHintsPreferences()); 314 document.clientHintsPreferences());
315 315
316 request.setPlaceholderImageRequestType(
317 updateBehavior != UpdateForcedReload && document.settings() &&
318 document.settings()->fetchImagePlaceholders()
319 ? FetchRequest::AllowPlaceholder
320 : FetchRequest::DisallowPlaceholder);
321
316 newImage = ImageResource::fetch(request, document.fetcher()); 322 newImage = ImageResource::fetch(request, document.fetcher());
317 323
318 if (!newImage && !pageIsBeingDismissed(&document)) { 324 if (!newImage && !pageIsBeingDismissed(&document)) {
319 crossSiteOrCSPViolationOccurred(imageSourceURL); 325 crossSiteOrCSPViolationOccurred(imageSourceURL);
320 dispatchErrorEvent(); 326 dispatchErrorEvent();
321 } else { 327 } else {
322 clearFailedLoadURL(); 328 clearFailedLoadURL();
323 } 329 }
324 } else { 330 } else {
325 if (!imageSourceURL.isNull()) { 331 if (!imageSourceURL.isNull()) {
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 } 641 }
636 642
637 void ImageLoader::elementDidMoveToNewDocument() { 643 void ImageLoader::elementDidMoveToNewDocument() {
638 if (m_loadDelayCounter) 644 if (m_loadDelayCounter)
639 m_loadDelayCounter->documentChanged(m_element->document()); 645 m_loadDelayCounter->documentChanged(m_element->document());
640 clearFailedLoadURL(); 646 clearFailedLoadURL();
641 setImage(0); 647 setImage(0);
642 } 648 }
643 649
644 } // namespace blink 650 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698