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

Unified Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 1394193003: Invalidate background-attachment:fixed on scroll. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/frame/FrameView.cpp
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
index abb627ea2e9225dea5c999b9a37b733cd1791744..1b3cd2a5dd2f9400a1ee47e3e36d814aea918f32 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -115,7 +115,6 @@ FrameView::FrameView(LocalFrame* frame)
: m_frame(frame)
, m_displayMode(WebDisplayModeBrowser)
, m_canHaveScrollbars(true)
- , m_slowRepaintObjectCount(0)
, m_hasPendingLayout(false)
, m_inSynchronousPostLayout(false)
, m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired)
@@ -1194,22 +1193,22 @@ bool FrameView::contentsInCompositedLayer() const
return layoutView && layoutView->compositingState() == PaintsIntoOwnBacking;
}
-void FrameView::addSlowRepaintObject()
+void FrameView::addBackgroundAttachmentFixedObject(LayoutObject* object)
{
- if (!m_slowRepaintObjectCount++) {
- if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
- scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(this);
- }
+ ASSERT(!m_backgroundAttachmentFixedObjects.contains(object));
+
+ m_backgroundAttachmentFixedObjects.add(object);
+ if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+ scrollingCoordinator->frameViewHasBackgroundAttachmentFixedObjectsDidChange(this);
}
-void FrameView::removeSlowRepaintObject()
+void FrameView::removeBackgroundAttachmentFixedObject(LayoutObject* object)
{
- ASSERT(m_slowRepaintObjectCount > 0);
- m_slowRepaintObjectCount--;
- if (!m_slowRepaintObjectCount) {
- if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
- scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(this);
- }
+ ASSERT(m_backgroundAttachmentFixedObjects.contains(object));
+
+ m_backgroundAttachmentFixedObjects.remove(object);
+ if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+ scrollingCoordinator->frameViewHasBackgroundAttachmentFixedObjectsDidChange(this);
}
void FrameView::addViewportConstrainedObject(LayoutObject* object)
@@ -1281,6 +1280,12 @@ void FrameView::scrollContentsIfNeededRecursive()
}
}
+void FrameView::invalidateBackgroundAttachmentFixedObjects()
+{
+ for (const auto& layoutObject : m_backgroundAttachmentFixedObjects)
+ layoutObject->setShouldDoFullPaintInvalidation();
+}
+
bool FrameView::invalidateViewportConstrainedObjects()
{
for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) {
@@ -1314,9 +1319,11 @@ bool FrameView::invalidateViewportConstrainedObjects()
bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta)
{
- if (!contentsInCompositedLayer() || hasSlowRepaintObjects())
+ if (!contentsInCompositedLayer())
return false;
+ invalidateBackgroundAttachmentFixedObjects();
+
if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty()) {
InspectorInstrumentation::didUpdateLayout(m_frame.get());
return true;

Powered by Google App Engine
This is Rietveld 408576698