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

Side by Side Diff: Source/core/html/HTMLCanvasElement.cpp

Issue 1350883002: Fix bug where setting canvas size to 0 was treated as if context was lost (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix layout test Created 5 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/canvas/canvas-lose-restore-googol-size.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 return surface.release(); 685 return surface.release();
686 surfaceFactory = adoptPtr(new UnacceleratedSurfaceFactory()); // recreat e because previous one was released 686 surfaceFactory = adoptPtr(new UnacceleratedSurfaceFactory()); // recreat e because previous one was released
687 } 687 }
688 688
689 return surfaceFactory->createSurface(deviceSize, opacityMode); 689 return surfaceFactory->createSurface(deviceSize, opacityMode);
690 } 690 }
691 691
692 void HTMLCanvasElement::createImageBuffer() 692 void HTMLCanvasElement::createImageBuffer()
693 { 693 {
694 createImageBufferInternal(nullptr); 694 createImageBufferInternal(nullptr);
695 if (m_didFailToCreateImageBuffer && m_context->is2d()) 695 if (m_didFailToCreateImageBuffer && m_context->is2d() && !size().isEmpty())
696 m_context->loseContext(CanvasRenderingContext::SyntheticLostContext); 696 m_context->loseContext(CanvasRenderingContext::SyntheticLostContext);
697 } 697 }
698 698
699 void HTMLCanvasElement::createImageBufferInternal(PassOwnPtr<ImageBufferSurface> externalSurface) 699 void HTMLCanvasElement::createImageBufferInternal(PassOwnPtr<ImageBufferSurface> externalSurface)
700 { 700 {
701 ASSERT(!m_imageBuffer); 701 ASSERT(!m_imageBuffer);
702 702
703 m_didFailToCreateImageBuffer = true; 703 m_didFailToCreateImageBuffer = true;
704 m_imageBufferIsClear = true; 704 m_imageBufferIsClear = true;
705 705
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 { 943 {
944 return FloatSize(width(), height()); 944 return FloatSize(width(), height());
945 } 945 }
946 946
947 bool HTMLCanvasElement::isOpaque() const 947 bool HTMLCanvasElement::isOpaque() const
948 { 948 {
949 return m_context && !m_context->hasAlpha(); 949 return m_context && !m_context->hasAlpha();
950 } 950 }
951 951
952 } // blink 952 } // blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/canvas/canvas-lose-restore-googol-size.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698