Index: Source/core/page/PageAnimator.cpp |
diff --git a/Source/core/page/PageAnimator.cpp b/Source/core/page/PageAnimator.cpp |
index 8bca069bd0b727cada442ae55655b1278ca97414..c2255481bb51838a961950b138e3f22151e50ae0 100644 |
--- a/Source/core/page/PageAnimator.cpp |
+++ b/Source/core/page/PageAnimator.cpp |
@@ -20,6 +20,7 @@ PageAnimator::PageAnimator(Page* page) |
: m_page(page) |
, m_animationFramePending(false) |
, m_servicingAnimations(false) |
+ , m_updatingLayoutAndStyleForPainting(false) |
{ |
} |
@@ -44,10 +45,29 @@ void PageAnimator::serviceScriptedAnimations(double monotonicAnimationStartTime) |
void PageAnimator::scheduleVisualUpdate() |
{ |
- if (m_animationFramePending || m_servicingAnimations) |
+ // FIXME: also include m_animationFramePending here. It is currently not there due to crbug.com/353756. |
+ if (m_servicingAnimations || m_updatingLayoutAndStyleForPainting) |
return; |
m_page->chrome().scheduleAnimation(); |
- ASSERT(m_animationFramePending); |
+} |
+ |
+void PageAnimator::updateLayoutAndStyleForPainting() |
+{ |
+ RefPtr<FrameView> view = m_page->mainFrame()->view(); |
+ |
+ TemporaryChange<bool> servicing(m_updatingLayoutAndStyleForPainting, true); |
+ |
+ // In order for our child HWNDs (NativeWindowWidgets) to update properly, |
+ // they need to be told that we are updating the screen. The problem is that |
+ // the native widgets need to recalculate their clip region and not overlap |
+ // any of our non-native widgets. To force the resizing, call |
+ // setFrameRect(). This will be a quick operation for most frames, but the |
+ // NativeWindowWidgets will update a proper clipping region. |
+ view->setFrameRect(view->frameRect()); |
+ |
+ // setFrameRect may have the side-effect of causing existing page layout to |
+ // be invalidated, so layout needs to be called last. |
+ view->updateLayoutAndStyleForPainting(); |
} |
} |