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/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: fix compilation error Created 4 years, 11 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, 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 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 return ScriptPromise(); 692 return ScriptPromise();
693 } 693 }
694 if (cachedImage()->image()->isSVGImage()) { 694 if (cachedImage()->image()->isSVGImage()) {
695 exceptionState.throwDOMException(InvalidStateError, "The image element c ontains an SVG image, which is unsupported."); 695 exceptionState.throwDOMException(InvalidStateError, "The image element c ontains an SVG image, which is unsupported.");
696 return ScriptPromise(); 696 return ScriptPromise();
697 } 697 }
698 if (!sw || !sh) { 698 if (!sw || !sh) {
699 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s provided is 0.", sw ? "height" : "width")); 699 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s provided is 0.", sw ? "height" : "width"));
700 return ScriptPromise(); 700 return ScriptPromise();
701 } 701 }
702 if (!cachedImage()->image()->currentFrameHasSingleSecurityOrigin()) { 702 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat e(this, IntRect(sx, sy, sw, sh), eventTarget.toDOMWindow()->document()));
703 exceptionState.throwSecurityError("The source image contains image data from multiple origins.");
704 return ScriptPromise();
705 }
706 Document* document = eventTarget.toDOMWindow()->document();
707 if (!cachedImage()->passesAccessControlCheck(document->securityOrigin()) && document->securityOrigin()->taintsCanvas(src())) {
708 exceptionState.throwSecurityError("Cross-origin access to the source ima ge is denied.");
709 return ScriptPromise();
710 }
711 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat e(this, IntRect(sx, sy, sw, sh)));
712 } 703 }
713 704
714 void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior be havior) 705 void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior be havior)
715 { 706 {
716 if (!document().isActive()) 707 if (!document().isActive())
717 return; 708 return;
718 709
719 bool foundURL = false; 710 bool foundURL = false;
720 ImageCandidate candidate = findBestFitImageFromPictureParent(); 711 ImageCandidate candidate = findBestFitImageFromPictureParent();
721 if (!candidate.isEmpty()) { 712 if (!candidate.isEmpty()) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 { 805 {
815 ImageResource* image = cachedImage(); 806 ImageResource* image = cachedImage();
816 if (!image) 807 if (!image)
817 return IntSize(); 808 return IntSize();
818 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat ion(layoutObject()), 1.0f); 809 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat ion(layoutObject()), 1.0f);
819 ASSERT(lSize.fraction().isZero()); 810 ASSERT(lSize.fraction().isZero());
820 return IntSize(lSize.width(), lSize.height()); 811 return IntSize(lSize.width(), lSize.height());
821 } 812 }
822 813
823 } 814 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp ('k') | third_party/WebKit/Source/core/html/HTMLVideoElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698