Chromium Code Reviews| Index: Source/core/html/canvas/CanvasRenderingContext2D.cpp |
| diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
| index 106c93fae5d436049d583a4aae50282c7165b75e..ba0fc0bd83a95fd6bc8ce227e180f643f84964ad 100644 |
| --- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
| +++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
| @@ -90,6 +90,7 @@ CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas, co |
| , m_contextRestorable(true) |
| , m_storageMode(!attrs ? PersistentStorage : attrs->parsedStorage()) |
| , m_tryRestoreContextAttemptCount(0) |
| + , m_clipCount(0) |
| , m_dispatchContextLostEventTimer(this, &CanvasRenderingContext2D::dispatchContextLostEvent) |
| , m_dispatchContextRestoredEventTimer(this, &CanvasRenderingContext2D::dispatchContextRestoredEvent) |
| , m_tryRestoreContextEventTimer(this, &CanvasRenderingContext2D::tryRestoreContextEvent) |
| @@ -231,6 +232,7 @@ void CanvasRenderingContext2D::reset() |
| m_stateStack.resize(1); |
| m_stateStack.first() = adoptPtrWillBeNoop(new State()); |
| m_path.clear(); |
| + m_clipCount = 0; |
| validateStateStack(); |
| } |
| @@ -372,6 +374,8 @@ void CanvasRenderingContext2D::realizeSaves() |
| void CanvasRenderingContext2D::restore() |
| { |
| validateStateStack(); |
| + if (isClipMode()) |
| + --m_clipCount; |
|
Justin Novosad
2014/07/02 15:12:31
I don't think this is correct. There could be mult
|
| if (state().m_unrealizedSaveCount) { |
| // We never realized the save, so just record that it was unnecessary. |
| --m_stateStack.last()->m_unrealizedSaveCount; |
| @@ -1096,6 +1100,7 @@ void CanvasRenderingContext2D::clipInternal(const Path& path, const String& wind |
| realizeSaves(); |
| c->canvasClip(path, parseWinding(windingRuleString)); |
| + ++m_clipCount; |
| } |
| void CanvasRenderingContext2D::clip(const String& windingRuleString) |
| @@ -2385,7 +2390,7 @@ void CanvasRenderingContext2D::addHitRegion(const Dictionary& options, Exception |
| Path specifiedPath = m_path; |
| specifiedPath.transform(state().m_transform); |
| - if (context->isClipMode()) { |
| + if (isClipMode()) { |
| // FIXME: The hit regions should take clipping region into account. |
| // However, we have no way to get the region from canvas state stack by now. |
| // See http://crbug.com/387057 |