| 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 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 } | 592 } |
| 593 } | 593 } |
| 594 } | 594 } |
| 595 | 595 |
| 596 void HTMLCanvasElement::didMoveToNewDocument(Document& oldDocument) | 596 void HTMLCanvasElement::didMoveToNewDocument(Document& oldDocument) |
| 597 { | 597 { |
| 598 setObservedDocument(document()); | 598 setObservedDocument(document()); |
| 599 HTMLElement::didMoveToNewDocument(oldDocument); | 599 HTMLElement::didMoveToNewDocument(oldDocument); |
| 600 } | 600 } |
| 601 | 601 |
| 602 PassRefPtr<Image> HTMLCanvasElement::getSourceImageForCanvas(SourceImageMode mod
e, SourceImageStatus* status) const |
| 603 { |
| 604 if (!width() || !height()) { |
| 605 *status = ZeroSizeCanvasSourceImageStatus; |
| 606 return nullptr; |
| 607 } |
| 608 |
| 609 if (!buffer()) { |
| 610 *status = InvalidSourceImageStatus; |
| 611 return nullptr; |
| 612 } |
| 613 |
| 614 if (mode == CopySourceImageIfVolatile) { |
| 615 *status = NormalSourceImageStatus; |
| 616 return copiedImage(); |
| 617 } |
| 618 |
| 619 if (m_context && m_context->is3d()) { |
| 620 m_context->paintRenderingResultsToCanvas(); |
| 621 *status = ExternalSourceImageStatus; |
| 622 } else { |
| 623 *status = NormalSourceImageStatus; |
| 624 } |
| 625 return m_imageBuffer->copyImage(DontCopyBackingStore, Unscaled); |
| 602 } | 626 } |
| 627 |
| 628 bool HTMLCanvasElement::wouldTaintOrigin(SecurityOrigin*) const |
| 629 { |
| 630 return !originClean(); |
| 631 } |
| 632 |
| 633 FloatSize HTMLCanvasElement::sourceSize() const |
| 634 { |
| 635 return FloatSize(width(), height()); |
| 636 } |
| 637 |
| 638 } |
| OLD | NEW |