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

Side by Side Diff: third_party/WebKit/Source/core/fetch/ImageResource.cpp

Issue 2114213002: Fix loading placeholders for Lo-Fi (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 } 515 }
516 516
517 if (m_image->animationPolicy() != newPolicy) { 517 if (m_image->animationPolicy() != newPolicy) {
518 m_image->resetAnimation(); 518 m_image->resetAnimation();
519 m_image->setAnimationPolicy(newPolicy); 519 m_image->setAnimationPolicy(newPolicy);
520 } 520 }
521 } 521 }
522 522
523 void ImageResource::reloadIfLoFi(ResourceFetcher* fetcher) 523 void ImageResource::reloadIfLoFi(ResourceFetcher* fetcher)
524 { 524 {
525 if (!m_response.httpHeaderField("chrome-proxy").contains("q=low")) 525 if (m_resourceRequest.loFiState() != WebURLRequest::LoFiOn)
526 return;
527 if (isLoaded() && !m_response.httpHeaderField("chrome-proxy").contains("q=lo w"))
526 return; 528 return;
527 m_resourceRequest.setCachePolicy(WebCachePolicy::BypassingCache); 529 m_resourceRequest.setCachePolicy(WebCachePolicy::BypassingCache);
528 m_resourceRequest.setLoFiState(WebURLRequest::LoFiOff); 530 m_resourceRequest.setLoFiState(WebURLRequest::LoFiOff);
529 if (isLoading()) 531 if (isLoading())
530 m_loader->cancel(); 532 m_loader->cancel();
531 else 533 clear();
532 updateImageAndClearBuffer(); 534 m_data.clear();
535 notifyObservers();
533 setStatus(NotStarted); 536 setStatus(NotStarted);
534 fetcher->startLoad(this); 537 fetcher->startLoad(this);
535 } 538 }
536 539
537 void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect ) 540 void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect )
538 { 541 {
539 if (!image || image != m_image) 542 if (!image || image != m_image)
540 return; 543 return;
541 notifyObservers(&rect); 544 notifyObservers(&rect);
542 } 545 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 if (response().wasFetchedViaServiceWorker()) 578 if (response().wasFetchedViaServiceWorker())
576 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque; 579 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque;
577 if (!getImage()->currentFrameHasSingleSecurityOrigin()) 580 if (!getImage()->currentFrameHasSingleSecurityOrigin())
578 return false; 581 return false;
579 if (passesAccessControlCheck(securityOrigin)) 582 if (passesAccessControlCheck(securityOrigin))
580 return true; 583 return true;
581 return !securityOrigin->taintsCanvas(response().url()); 584 return !securityOrigin->taintsCanvas(response().url());
582 } 585 }
583 586
584 } // namespace blink 587 } // namespace blink
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698