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

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

Issue 1954533002: Implement wouldTaintOrigin and expose createPattern for OCRC2D on main thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: OCRC2D pattern is working fine in GPU; remove Failure mark in TestExpectations Created 4 years, 7 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) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 return ContextTypeCount; 53 return ContextTypeCount;
54 } 54 }
55 55
56 CanvasRenderingContext::ContextType CanvasRenderingContext::resolveContextTypeAl iases(CanvasRenderingContext::ContextType type) 56 CanvasRenderingContext::ContextType CanvasRenderingContext::resolveContextTypeAl iases(CanvasRenderingContext::ContextType type)
57 { 57 {
58 if (type == ContextExperimentalWebgl) 58 if (type == ContextExperimentalWebgl)
59 return ContextWebgl; 59 return ContextWebgl;
60 return type; 60 return type;
61 } 61 }
62 62
63 bool CanvasRenderingContext::wouldTaintOrigin(CanvasImageSource* imageSource) 63 bool CanvasRenderingContext::wouldTaintOrigin(CanvasImageSource* imageSource, Se curityOrigin* destinationSecurityOrigin)
64 { 64 {
65 const KURL& sourceURL = imageSource->sourceURL(); 65 const KURL& sourceURL = imageSource->sourceURL();
66 bool hasURL = (sourceURL.isValid() && !sourceURL.isAboutBlankURL()); 66 bool hasURL = (sourceURL.isValid() && !sourceURL.isAboutBlankURL());
67 67
68 if (hasURL) { 68 if (hasURL) {
69 if (sourceURL.protocolIsData() || m_cleanURLs.contains(sourceURL.getStri ng())) 69 if (sourceURL.protocolIsData() || m_cleanURLs.contains(sourceURL.getStri ng()))
70 return false; 70 return false;
71 if (m_dirtyURLs.contains(sourceURL.getString())) 71 if (m_dirtyURLs.contains(sourceURL.getString()))
72 return true; 72 return true;
73 } 73 }
74 74
75 bool taintOrigin = imageSource->wouldTaintOrigin(canvas()->getSecurityOrigin ()); 75 ASSERT(!canvas() == !!destinationSecurityOrigin); // Must have one or the ot her
76 bool taintOrigin = imageSource->wouldTaintOrigin(destinationSecurityOrigin ? destinationSecurityOrigin : canvas()->getSecurityOrigin());
76 77
77 if (hasURL) { 78 if (hasURL) {
78 if (taintOrigin) 79 if (taintOrigin)
79 m_dirtyURLs.add(sourceURL.getString()); 80 m_dirtyURLs.add(sourceURL.getString());
80 else 81 else
81 m_cleanURLs.add(sourceURL.getString()); 82 m_cleanURLs.add(sourceURL.getString());
82 } 83 }
83 return taintOrigin; 84 return taintOrigin;
84 } 85 }
85 86
86 DEFINE_TRACE(CanvasRenderingContext) 87 DEFINE_TRACE(CanvasRenderingContext)
87 { 88 {
88 visitor->trace(m_canvas); 89 visitor->trace(m_canvas);
89 visitor->trace(m_offscreenCanvas); 90 visitor->trace(m_offscreenCanvas);
90 } 91 }
91 92
92 } // namespace blink 93 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698