OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 13 matching lines...) Expand all Loading... | |
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #include "core/html/HTMLCanvasElement.h" | 28 #include "core/html/HTMLCanvasElement.h" |
29 | 29 |
30 #include "bindings/core/v8/ExceptionMessages.h" | 30 #include "bindings/core/v8/ExceptionMessages.h" |
31 #include "bindings/core/v8/ExceptionState.h" | 31 #include "bindings/core/v8/ExceptionState.h" |
32 #include "bindings/core/v8/ScriptController.h" | 32 #include "bindings/core/v8/ScriptController.h" |
33 #include "core/HTMLNames.h" | 33 #include "core/HTMLNames.h" |
34 #include "core/InputTypeNames.h" | |
34 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
36 #include "core/dom/Element.h" | |
37 #include "core/dom/ElementTraversal.h" | |
35 #include "core/dom/ExceptionCode.h" | 38 #include "core/dom/ExceptionCode.h" |
36 #include "core/fileapi/File.h" | 39 #include "core/fileapi/File.h" |
37 #include "core/frame/ImageBitmap.h" | 40 #include "core/frame/ImageBitmap.h" |
38 #include "core/frame/LocalFrame.h" | 41 #include "core/frame/LocalFrame.h" |
39 #include "core/frame/Settings.h" | 42 #include "core/frame/Settings.h" |
43 #include "core/html/HTMLImageElement.h" | |
44 #include "core/html/HTMLInputElement.h" | |
45 #include "core/html/HTMLSelectElement.h" | |
40 #include "core/html/ImageData.h" | 46 #include "core/html/ImageData.h" |
41 #include "core/html/canvas/CanvasAsyncBlobCreator.h" | 47 #include "core/html/canvas/CanvasAsyncBlobCreator.h" |
42 #include "core/html/canvas/CanvasContextCreationAttributes.h" | 48 #include "core/html/canvas/CanvasContextCreationAttributes.h" |
43 #include "core/html/canvas/CanvasFontCache.h" | 49 #include "core/html/canvas/CanvasFontCache.h" |
44 #include "core/html/canvas/CanvasRenderingContext.h" | 50 #include "core/html/canvas/CanvasRenderingContext.h" |
45 #include "core/html/canvas/CanvasRenderingContextFactory.h" | 51 #include "core/html/canvas/CanvasRenderingContextFactory.h" |
46 #include "core/imagebitmap/ImageBitmapOptions.h" | 52 #include "core/imagebitmap/ImageBitmapOptions.h" |
47 #include "core/layout/LayoutHTMLCanvas.h" | 53 #include "core/layout/LayoutHTMLCanvas.h" |
48 #include "core/paint/PaintLayer.h" | 54 #include "core/paint/PaintLayer.h" |
49 #include "platform/Histogram.h" | 55 #include "platform/Histogram.h" |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1024 return ScriptPromise(); | 1030 return ScriptPromise(); |
1025 } | 1031 } |
1026 return ImageBitmapSource::fulfillImageBitmap(scriptState, isPaintable() ? Im ageBitmap::create(this, IntRect(sx, sy, sw, sh), options) : nullptr); | 1032 return ImageBitmapSource::fulfillImageBitmap(scriptState, isPaintable() ? Im ageBitmap::create(this, IntRect(sx, sy, sw, sh), options) : nullptr); |
1027 } | 1033 } |
1028 | 1034 |
1029 bool HTMLCanvasElement::isOpaque() const | 1035 bool HTMLCanvasElement::isOpaque() const |
1030 { | 1036 { |
1031 return m_context && !m_context->hasAlpha(); | 1037 return m_context && !m_context->hasAlpha(); |
1032 } | 1038 } |
1033 | 1039 |
1040 bool HTMLCanvasElement::isSupportedInteractiveCanvasFallback(const Element& elem ent) | |
1041 { | |
1042 if (!element.isDescendantOf(this)) | |
1043 return false; | |
1044 | |
1045 if (element.hasTagName(HTMLNames::aTag)) | |
Justin Novosad
2016/02/12 15:10:45
You should use the helpers (isHTMLAnchorElement) i
zino
2016/02/12 16:40:34
Done.
| |
1046 return !Traversal<HTMLImageElement>::firstWithin(element); | |
Justin Novosad
2016/02/12 15:10:45
Please add a comment to explain this.
zino
2016/02/12 16:40:34
Done.
| |
1047 | |
1048 if (element.hasTagName(HTMLNames::buttonTag)) | |
Justin Novosad
2016/02/12 15:10:45
Could be "else if". Same thing for "if" statements
zino
2016/02/12 16:40:34
As far as I know, we don't use "else if" in Blink.
| |
1049 return true; | |
1050 | |
1051 if (element.hasTagName(HTMLNames::inputTag)) { | |
1052 const HTMLInputElement& inputElement = toHTMLInputElement(element); | |
1053 if (inputElement.type() == InputTypeNames::checkbox || inputElement.type () == InputTypeNames::radio | |
1054 || (inputElement.isTextButton() && !inputElement.isImage())) | |
Justin Novosad
2016/02/12 15:10:45
Why do you need to check !inputElement.isImage()?
zino
2016/02/12 16:40:34
Done.
| |
1055 return true; | |
1056 } | |
1057 | |
1058 if (element.hasTagName(HTMLNames::selectTag)) { | |
1059 const HTMLSelectElement& selectElement = toHTMLSelectElement(element); | |
1060 if (selectElement.multiple() || selectElement.size() > 1) | |
1061 return true; | |
1062 } | |
1063 | |
1064 if (isHTMLOptionElement(element) && element.parentNode() && isHTMLSelectElem ent(*element.parentNode())) { | |
1065 const HTMLSelectElement& selectElement = toHTMLSelectElement(*element.pa rentNode()); | |
1066 if (selectElement.multiple() || selectElement.size() > 1) | |
Justin Novosad
2016/02/12 15:10:45
Add a comment to explain this condition.
zino
2016/02/12 16:40:34
Done.
| |
1067 return true; | |
1068 } | |
1069 | |
1070 if (element.fastHasAttribute(HTMLNames::tabindexAttr)) | |
1071 return true; | |
1072 | |
1073 if (element.hasTagName(HTMLNames::tableTag) | |
1074 || element.hasTagName(HTMLNames::captionTag) | |
1075 || element.hasTagName(HTMLNames::theadTag) | |
1076 || element.hasTagName(HTMLNames::tbodyTag) | |
1077 || element.hasTagName(HTMLNames::tfootTag) | |
1078 || element.hasTagName(HTMLNames::trTag) | |
1079 || element.hasTagName(HTMLNames::tdTag) | |
1080 || element.hasTagName(HTMLNames::thTag)) | |
1081 return true; | |
1082 | |
1083 return false; | |
1084 } | |
1085 | |
1034 } // namespace blink | 1086 } // namespace blink |
OLD | NEW |