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 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 AffineTransform HTMLCanvasElement::baseTransform() const | 930 AffineTransform HTMLCanvasElement::baseTransform() const |
931 { | 931 { |
932 ASSERT(hasImageBuffer() && !m_didFailToCreateImageBuffer); | 932 ASSERT(hasImageBuffer() && !m_didFailToCreateImageBuffer); |
933 return m_imageBuffer->baseTransform(); | 933 return m_imageBuffer->baseTransform(); |
934 } | 934 } |
935 | 935 |
936 void HTMLCanvasElement::didChangeVisibilityState(PageVisibilityState visibility) | 936 void HTMLCanvasElement::didChangeVisibilityState(PageVisibilityState visibility) |
937 { | 937 { |
938 if (!m_context) | 938 if (!m_context) |
939 return; | 939 return; |
| 940 |
940 bool hidden = visibility != PageVisibilityStateVisible; | 941 bool hidden = visibility != PageVisibilityStateVisible; |
941 m_context->setIsHidden(hidden); | 942 m_context->setIsHidden(hidden); |
942 if (hidden) { | 943 if (hidden) { |
943 clearCopiedImage(); | 944 clearCopiedImage(); |
944 if (is3D()) { | 945 if (is3D()) { |
945 discardImageBuffer(); | 946 discardImageBuffer(); |
946 } | 947 } |
947 } | 948 } |
948 } | 949 } |
949 | 950 |
| 951 void HTMLCanvasElement::willDetachDocument() |
| 952 { |
| 953 if (m_context) |
| 954 m_context->stop(); |
| 955 } |
| 956 |
950 void HTMLCanvasElement::styleDidChange(const ComputedStyle* oldStyle, const Comp
utedStyle& newStyle) | 957 void HTMLCanvasElement::styleDidChange(const ComputedStyle* oldStyle, const Comp
utedStyle& newStyle) |
951 { | 958 { |
952 if (m_context) | 959 if (m_context) |
953 m_context->styleDidChange(oldStyle, newStyle); | 960 m_context->styleDidChange(oldStyle, newStyle); |
954 } | 961 } |
955 | 962 |
956 void HTMLCanvasElement::didMoveToNewDocument(Document& oldDocument) | 963 void HTMLCanvasElement::didMoveToNewDocument(Document& oldDocument) |
957 { | 964 { |
958 setObservedDocument(document()); | 965 setObservedDocument(document()); |
959 if (m_context) | |
960 m_context->didMoveToNewDocument(&document()); | |
961 HTMLElement::didMoveToNewDocument(oldDocument); | 966 HTMLElement::didMoveToNewDocument(oldDocument); |
962 } | 967 } |
963 | 968 |
964 PassRefPtr<Image> HTMLCanvasElement::getSourceImageForCanvas(SourceImageStatus*
status, AccelerationHint hint) const | 969 PassRefPtr<Image> HTMLCanvasElement::getSourceImageForCanvas(SourceImageStatus*
status, AccelerationHint hint) const |
965 { | 970 { |
966 if (!width() || !height()) { | 971 if (!width() || !height()) { |
967 *status = ZeroSizeCanvasSourceImageStatus; | 972 *status = ZeroSizeCanvasSourceImageStatus; |
968 return nullptr; | 973 return nullptr; |
969 } | 974 } |
970 | 975 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 } | 1021 } |
1017 return ImageBitmapSource::fulfillImageBitmap(scriptState, isPaintable() ? Im
ageBitmap::create(this, IntRect(sx, sy, sw, sh), options) : nullptr); | 1022 return ImageBitmapSource::fulfillImageBitmap(scriptState, isPaintable() ? Im
ageBitmap::create(this, IntRect(sx, sy, sw, sh), options) : nullptr); |
1018 } | 1023 } |
1019 | 1024 |
1020 bool HTMLCanvasElement::isOpaque() const | 1025 bool HTMLCanvasElement::isOpaque() const |
1021 { | 1026 { |
1022 return m_context && !m_context->hasAlpha(); | 1027 return m_context && !m_context->hasAlpha(); |
1023 } | 1028 } |
1024 | 1029 |
1025 } // namespace blink | 1030 } // namespace blink |
OLD | NEW |