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

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

Issue 1532473002: Add a origin clean flag in ImageBitmap class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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, 2008, 2010 Apple Inc. All rights reserv ed. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv ed.
5 * Copyright (C) 2010 Google Inc. All rights reserved. 5 * Copyright (C) 2010 Google Inc. All rights 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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 return ScriptPromise(); 693 return ScriptPromise();
694 } 694 }
695 if (cachedImage()->image()->isSVGImage()) { 695 if (cachedImage()->image()->isSVGImage()) {
696 exceptionState.throwDOMException(InvalidStateError, "The image element c ontains an SVG image, which is unsupported."); 696 exceptionState.throwDOMException(InvalidStateError, "The image element c ontains an SVG image, which is unsupported.");
697 return ScriptPromise(); 697 return ScriptPromise();
698 } 698 }
699 if (!sw || !sh) { 699 if (!sw || !sh) {
700 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s provided is 0.", sw ? "height" : "width")); 700 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s provided is 0.", sw ? "height" : "width"));
701 return ScriptPromise(); 701 return ScriptPromise();
702 } 702 }
703 if (!cachedImage()->image()->currentFrameHasSingleSecurityOrigin()) {
704 exceptionState.throwSecurityError("The source image contains image data from multiple origins.");
705 return ScriptPromise();
706 }
707 Document* document = eventTarget.toDOMWindow()->document(); 703 Document* document = eventTarget.toDOMWindow()->document();
708 if (!cachedImage()->passesAccessControlCheck(document->securityOrigin()) && document->securityOrigin()->taintsCanvas(src())) { 704 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat e(this, IntRect(sx, sy, sw, sh),
709 exceptionState.throwSecurityError("Cross-origin access to the source ima ge is denied."); 705 !(!cachedImage()->image()->currentFrameHasSingleSecurityOrigin()
710 return ScriptPromise(); 706 || (!cachedImage()->passesAccessControlCheck(document->securityOrigin()) && document->securityOrigin()->taintsCanvas(src())))));
711 }
712 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat e(this, IntRect(sx, sy, sw, sh)));
713 } 707 }
714 708
715 void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior be havior) 709 void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior be havior)
716 { 710 {
717 if (!document().isActive()) 711 if (!document().isActive())
718 return; 712 return;
719 713
720 bool foundURL = false; 714 bool foundURL = false;
721 ImageCandidate candidate = findBestFitImageFromPictureParent(); 715 ImageCandidate candidate = findBestFitImageFromPictureParent();
722 if (!candidate.isEmpty()) { 716 if (!candidate.isEmpty()) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 { 809 {
816 ImageResource* image = cachedImage(); 810 ImageResource* image = cachedImage();
817 if (!image) 811 if (!image)
818 return IntSize(); 812 return IntSize();
819 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat ion(layoutObject()), 1.0f); 813 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat ion(layoutObject()), 1.0f);
820 ASSERT(lSize.fraction().isZero()); 814 ASSERT(lSize.fraction().isZero());
821 return IntSize(lSize.width(), lSize.height()); 815 return IntSize(lSize.width(), lSize.height());
822 } 816 }
823 817
824 } 818 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698