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

Side by Side 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: rename all SlowRepaint to BackgroundAttachmentFixed. rebaseline test. 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // The maximum number of updateWidgets iterations that should be done before ret urning. 107 // The maximum number of updateWidgets iterations that should be done before ret urning.
108 static const unsigned maxUpdateWidgetsIterations = 2; 108 static const unsigned maxUpdateWidgetsIterations = 2;
109 static const double resourcePriorityUpdateDelayAfterScroll = 0.250; 109 static const double resourcePriorityUpdateDelayAfterScroll = 0.250;
110 110
111 static bool s_initialTrackAllPaintInvalidations = false; 111 static bool s_initialTrackAllPaintInvalidations = false;
112 112
113 FrameView::FrameView(LocalFrame* frame) 113 FrameView::FrameView(LocalFrame* frame)
114 : m_frame(frame) 114 : m_frame(frame)
115 , m_displayMode(WebDisplayModeBrowser) 115 , m_displayMode(WebDisplayModeBrowser)
116 , m_canHaveScrollbars(true) 116 , m_canHaveScrollbars(true)
117 , m_slowRepaintObjectCount(0)
118 , m_hasPendingLayout(false) 117 , m_hasPendingLayout(false)
119 , m_inSynchronousPostLayout(false) 118 , m_inSynchronousPostLayout(false)
120 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired) 119 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired)
121 , m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired) 120 , m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired)
122 , m_isTransparent(false) 121 , m_isTransparent(false)
123 , m_baseBackgroundColor(Color::white) 122 , m_baseBackgroundColor(Color::white)
124 , m_mediaType(MediaTypeNames::screen) 123 , m_mediaType(MediaTypeNames::screen)
125 , m_safeToPropagateScrollToParent(true) 124 , m_safeToPropagateScrollToParent(true)
126 , m_isTrackingPaintInvalidations(false) 125 , m_isTrackingPaintInvalidations(false)
127 , m_scrollCorner(nullptr) 126 , m_scrollCorner(nullptr)
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 m_mediaTypeWhenNotPrinting = nullAtom; 1196 m_mediaTypeWhenNotPrinting = nullAtom;
1198 } 1197 }
1199 } 1198 }
1200 1199
1201 bool FrameView::contentsInCompositedLayer() const 1200 bool FrameView::contentsInCompositedLayer() const
1202 { 1201 {
1203 LayoutView* layoutView = this->layoutView(); 1202 LayoutView* layoutView = this->layoutView();
1204 return layoutView && layoutView->compositingState() == PaintsIntoOwnBacking; 1203 return layoutView && layoutView->compositingState() == PaintsIntoOwnBacking;
1205 } 1204 }
1206 1205
1207 void FrameView::addSlowRepaintObject() 1206 void FrameView::addBackgroundAttachmentFixedObject(LayoutObject* object)
1208 { 1207 {
1209 if (!m_slowRepaintObjectCount++) { 1208 ASSERT(!m_backgroundAttachmentFixedObjects.contains(object));
1210 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina tor()) 1209
1211 scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(this); 1210 m_backgroundAttachmentFixedObjects.add(object);
1212 } 1211 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( ))
1212 scrollingCoordinator->frameViewHasBackgroundAttachmentFixedObjectsDidCha nge(this);
1213 } 1213 }
1214 1214
1215 void FrameView::removeSlowRepaintObject() 1215 void FrameView::removeBackgroundAttachmentFixedObject(LayoutObject* object)
1216 { 1216 {
1217 ASSERT(m_slowRepaintObjectCount > 0); 1217 ASSERT(m_backgroundAttachmentFixedObjects.contains(object));
1218 m_slowRepaintObjectCount--; 1218
1219 if (!m_slowRepaintObjectCount) { 1219 m_backgroundAttachmentFixedObjects.remove(object);
1220 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina tor()) 1220 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( ))
1221 scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(this); 1221 scrollingCoordinator->frameViewHasBackgroundAttachmentFixedObjectsDidCha nge(this);
1222 }
1223 } 1222 }
1224 1223
1225 void FrameView::addViewportConstrainedObject(LayoutObject* object) 1224 void FrameView::addViewportConstrainedObject(LayoutObject* object)
1226 { 1225 {
1227 if (!m_viewportConstrainedObjects) 1226 if (!m_viewportConstrainedObjects)
1228 m_viewportConstrainedObjects = adoptPtr(new ViewportConstrainedObjectSet ); 1227 m_viewportConstrainedObjects = adoptPtr(new ViewportConstrainedObjectSet );
1229 1228
1230 if (!m_viewportConstrainedObjects->contains(object)) { 1229 if (!m_viewportConstrainedObjects->contains(object)) {
1231 m_viewportConstrainedObjects->add(object); 1230 m_viewportConstrainedObjects->add(object);
1232 1231
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 return page && page->visibilityState() != PageVisibilityStateHidden && page- >focusController().isActive() && page->settings().deviceSupportsMouse(); 1278 return page && page->visibilityState() != PageVisibilityStateHidden && page- >focusController().isActive() && page->settings().deviceSupportsMouse();
1280 } 1279 }
1281 1280
1282 void FrameView::scrollContentsIfNeededRecursive() 1281 void FrameView::scrollContentsIfNeededRecursive()
1283 { 1282 {
1284 forAllFrameViews([](FrameView& frameView) { 1283 forAllFrameViews([](FrameView& frameView) {
1285 frameView.scrollContentsIfNeeded(); 1284 frameView.scrollContentsIfNeeded();
1286 }); 1285 });
1287 } 1286 }
1288 1287
1288 void FrameView::invalidateBackgroundAttachmentFixedObjects()
1289 {
1290 for (const auto& layoutObject : m_backgroundAttachmentFixedObjects)
1291 layoutObject->setShouldDoFullPaintInvalidation();
1292 }
1293
1289 bool FrameView::invalidateViewportConstrainedObjects() 1294 bool FrameView::invalidateViewportConstrainedObjects()
1290 { 1295 {
1291 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) { 1296 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) {
1292 LayoutObject* layoutObject = viewportConstrainedObject; 1297 LayoutObject* layoutObject = viewportConstrainedObject;
1293 ASSERT(layoutObject->style()->hasViewportConstrainedPosition()); 1298 ASSERT(layoutObject->style()->hasViewportConstrainedPosition());
1294 ASSERT(layoutObject->hasLayer()); 1299 ASSERT(layoutObject->hasLayer());
1295 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer(); 1300 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
1296 1301
1297 if (layer->isPaintInvalidationContainer()) 1302 if (layer->isPaintInvalidationContainer())
1298 continue; 1303 continue;
(...skipping 13 matching lines...) Expand all
1312 "data", 1317 "data",
1313 InspectorScrollInvalidationTrackingEvent::data(*layoutObject)); 1318 InspectorScrollInvalidationTrackingEvent::data(*layoutObject));
1314 1319
1315 layoutObject->setShouldDoFullPaintInvalidationIncludingNonCompositingDes cendants(); 1320 layoutObject->setShouldDoFullPaintInvalidationIncludingNonCompositingDes cendants();
1316 } 1321 }
1317 return true; 1322 return true;
1318 } 1323 }
1319 1324
1320 bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta) 1325 bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta)
1321 { 1326 {
1322 if (!contentsInCompositedLayer() || hasSlowRepaintObjects()) 1327 if (!contentsInCompositedLayer())
1323 return false; 1328 return false;
1324 1329
1330 invalidateBackgroundAttachmentFixedObjects();
1331
1325 if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty() ) { 1332 if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty() ) {
1326 InspectorInstrumentation::didUpdateLayout(m_frame.get()); 1333 InspectorInstrumentation::didUpdateLayout(m_frame.get());
1327 return true; 1334 return true;
1328 } 1335 }
1329 1336
1330 if (!invalidateViewportConstrainedObjects()) 1337 if (!invalidateViewportConstrainedObjects())
1331 return false; 1338 return false;
1332 1339
1333 InspectorInstrumentation::didUpdateLayout(m_frame.get()); 1340 InspectorInstrumentation::didUpdateLayout(m_frame.get());
1334 return true; 1341 return true;
(...skipping 2600 matching lines...) Expand 10 before | Expand all | Expand 10 after
3935 3942
3936 if (!graphicsLayer) 3943 if (!graphicsLayer)
3937 return; 3944 return;
3938 3945
3939 PaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentLayoutObjec t(), paintInvalidationContainer, viewRect); 3946 PaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentLayoutObjec t(), paintInvalidationContainer, viewRect);
3940 3947
3941 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing IntRect(viewRect))); 3948 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing IntRect(viewRect)));
3942 } 3949 }
3943 3950
3944 } // namespace blink 3951 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | third_party/WebKit/Source/core/layout/LayoutBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698