Index: Source/core/html/HTMLCanvasElement.cpp |
diff --git a/Source/core/html/HTMLCanvasElement.cpp b/Source/core/html/HTMLCanvasElement.cpp |
index a8da6d7bd3d426c8ac8151fbf8e95ada0009ebc2..2402c38c720413af67e5f7ef54ead5eb40ff9f05 100644 |
--- a/Source/core/html/HTMLCanvasElement.cpp |
+++ b/Source/core/html/HTMLCanvasElement.cpp |
@@ -195,19 +195,26 @@ void HTMLCanvasElement::didDraw(const FloatRect& rect) |
clearCopiedImage(); |
if (RenderBox* ro = renderBox()) { |
- FloatRect destRect = ro->contentBoxRect(); |
- FloatRect r = mapRect(rect, FloatRect(0, 0, size().width(), size().height()), destRect); |
- r.intersect(destRect); |
+ FloatRect srcRect(0, 0, size().width(), size().height()); |
+ FloatRect r = rect; |
+ r.intersect(srcRect); |
if (r.isEmpty() || m_dirtyRect.contains(r)) |
return; |
- |
m_dirtyRect.unite(r); |
- ro->invalidatePaintRectangle(enclosingIntRect(m_dirtyRect)); |
+ FloatRect mappedDirtyRect = mapRect(r, srcRect, ro->contentBoxRect()); |
Justin Novosad
2014/07/17 15:13:24
The change to this function does not actually fix
|
+ |
+ ro->invalidatePaintRectangle(enclosingIntRect(mappedDirtyRect)); |
} |
notifyObserversCanvasChanged(rect); |
} |
+void HTMLCanvasElement::didPresent() |
+{ |
+ // Canvas was presented externally (without going through paint()) |
+ m_dirtyRect = FloatRect(); |
+} |
+ |
void HTMLCanvasElement::notifyObserversCanvasChanged(const FloatRect& rect) |
{ |
WillBeHeapHashSet<RawPtrWillBeWeakMember<CanvasObserver> >::iterator end = m_observers.end(); |
@@ -220,6 +227,8 @@ void HTMLCanvasElement::reset() |
if (m_ignoreReset) |
return; |
+ m_dirtyRect = FloatRect(); |
+ |
bool ok; |
bool hadImageBuffer = hasImageBuffer(); |