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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 } | 643 } |
644 | 644 |
645 AffineTransform HTMLCanvasElement::baseTransform() const | 645 AffineTransform HTMLCanvasElement::baseTransform() const |
646 { | 646 { |
647 ASSERT(hasImageBuffer() && !m_didFailToCreateImageBuffer); | 647 ASSERT(hasImageBuffer() && !m_didFailToCreateImageBuffer); |
648 return m_imageBuffer->baseTransform(); | 648 return m_imageBuffer->baseTransform(); |
649 } | 649 } |
650 | 650 |
651 void HTMLCanvasElement::didChangeVisibilityState(PageVisibilityState visibility) | 651 void HTMLCanvasElement::didChangeVisibilityState(PageVisibilityState visibility) |
652 { | 652 { |
653 if (!m_context) | 653 if (hasImageBuffer()) { |
654 return; | 654 bool hidden = visibility != PageVisibilityStateVisible; |
655 bool hidden = visibility != PageVisibilityStateVisible; | 655 if (hidden) { |
656 m_context->setIsHidden(hidden); | 656 clearCopiedImage(); |
657 if (hidden) { | 657 if (is3D()) { |
658 clearCopiedImage(); | 658 discardImageBuffer(); |
659 if (is3D()) { | 659 } |
660 discardImageBuffer(); | 660 } |
| 661 if (hasImageBuffer()) { |
| 662 m_imageBuffer->setIsHidden(hidden); |
661 } | 663 } |
662 } | 664 } |
663 } | 665 } |
664 | 666 |
665 void HTMLCanvasElement::didMoveToNewDocument(Document& oldDocument) | 667 void HTMLCanvasElement::didMoveToNewDocument(Document& oldDocument) |
666 { | 668 { |
667 setObservedDocument(document()); | 669 setObservedDocument(document()); |
668 HTMLElement::didMoveToNewDocument(oldDocument); | 670 HTMLElement::didMoveToNewDocument(oldDocument); |
669 } | 671 } |
670 | 672 |
(...skipping 27 matching lines...) Expand all Loading... |
698 { | 700 { |
699 return !originClean(); | 701 return !originClean(); |
700 } | 702 } |
701 | 703 |
702 FloatSize HTMLCanvasElement::sourceSize() const | 704 FloatSize HTMLCanvasElement::sourceSize() const |
703 { | 705 { |
704 return FloatSize(width(), height()); | 706 return FloatSize(width(), height()); |
705 } | 707 } |
706 | 708 |
707 } | 709 } |
OLD | NEW |