OLD | NEW |
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // The maximum number of updateWidgets iterations that should be done before ret
urning. | 108 // The maximum number of updateWidgets iterations that should be done before ret
urning. |
109 static const unsigned maxUpdateWidgetsIterations = 2; | 109 static const unsigned maxUpdateWidgetsIterations = 2; |
110 static const double resourcePriorityUpdateDelayAfterScroll = 0.250; | 110 static const double resourcePriorityUpdateDelayAfterScroll = 0.250; |
111 | 111 |
112 static bool s_initialTrackAllPaintInvalidations = false; | 112 static bool s_initialTrackAllPaintInvalidations = false; |
113 | 113 |
114 FrameView::FrameView(LocalFrame* frame) | 114 FrameView::FrameView(LocalFrame* frame) |
115 : m_frame(frame) | 115 : m_frame(frame) |
116 , m_displayMode(WebDisplayModeBrowser) | 116 , m_displayMode(WebDisplayModeBrowser) |
117 , m_canHaveScrollbars(true) | 117 , m_canHaveScrollbars(true) |
118 , m_slowRepaintObjectCount(0) | |
119 , m_hasPendingLayout(false) | 118 , m_hasPendingLayout(false) |
120 , m_inSynchronousPostLayout(false) | 119 , m_inSynchronousPostLayout(false) |
121 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired) | 120 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired) |
122 , m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired) | 121 , m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired) |
123 , m_isTransparent(false) | 122 , m_isTransparent(false) |
124 , m_baseBackgroundColor(Color::white) | 123 , m_baseBackgroundColor(Color::white) |
125 , m_mediaType(MediaTypeNames::screen) | 124 , m_mediaType(MediaTypeNames::screen) |
126 , m_safeToPropagateScrollToParent(true) | 125 , m_safeToPropagateScrollToParent(true) |
127 , m_isTrackingPaintInvalidations(false) | 126 , m_isTrackingPaintInvalidations(false) |
128 , m_scrollCorner(nullptr) | 127 , m_scrollCorner(nullptr) |
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 m_mediaTypeWhenNotPrinting = nullAtom; | 1187 m_mediaTypeWhenNotPrinting = nullAtom; |
1189 } | 1188 } |
1190 } | 1189 } |
1191 | 1190 |
1192 bool FrameView::contentsInCompositedLayer() const | 1191 bool FrameView::contentsInCompositedLayer() const |
1193 { | 1192 { |
1194 LayoutView* layoutView = this->layoutView(); | 1193 LayoutView* layoutView = this->layoutView(); |
1195 return layoutView && layoutView->compositingState() == PaintsIntoOwnBacking; | 1194 return layoutView && layoutView->compositingState() == PaintsIntoOwnBacking; |
1196 } | 1195 } |
1197 | 1196 |
1198 void FrameView::addSlowRepaintObject() | 1197 void FrameView::addBackgroundAttachmentFixedObject(LayoutObject* object) |
1199 { | 1198 { |
1200 if (!m_slowRepaintObjectCount++) { | 1199 ASSERT(!m_backgroundAttachmentFixedObjects.contains(object)); |
1201 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) | 1200 |
1202 scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(this); | 1201 m_backgroundAttachmentFixedObjects.add(object); |
1203 } | 1202 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(
)) |
| 1203 scrollingCoordinator->frameViewHasBackgroundAttachmentFixedObjectsDidCha
nge(this); |
1204 } | 1204 } |
1205 | 1205 |
1206 void FrameView::removeSlowRepaintObject() | 1206 void FrameView::removeBackgroundAttachmentFixedObject(LayoutObject* object) |
1207 { | 1207 { |
1208 ASSERT(m_slowRepaintObjectCount > 0); | 1208 ASSERT(m_backgroundAttachmentFixedObjects.contains(object)); |
1209 m_slowRepaintObjectCount--; | 1209 |
1210 if (!m_slowRepaintObjectCount) { | 1210 m_backgroundAttachmentFixedObjects.remove(object); |
1211 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) | 1211 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(
)) |
1212 scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(this); | 1212 scrollingCoordinator->frameViewHasBackgroundAttachmentFixedObjectsDidCha
nge(this); |
1213 } | |
1214 } | 1213 } |
1215 | 1214 |
1216 void FrameView::addViewportConstrainedObject(LayoutObject* object) | 1215 void FrameView::addViewportConstrainedObject(LayoutObject* object) |
1217 { | 1216 { |
1218 if (!m_viewportConstrainedObjects) | 1217 if (!m_viewportConstrainedObjects) |
1219 m_viewportConstrainedObjects = adoptPtr(new ViewportConstrainedObjectSet
); | 1218 m_viewportConstrainedObjects = adoptPtr(new ViewportConstrainedObjectSet
); |
1220 | 1219 |
1221 if (!m_viewportConstrainedObjects->contains(object)) { | 1220 if (!m_viewportConstrainedObjects->contains(object)) { |
1222 m_viewportConstrainedObjects->add(object); | 1221 m_viewportConstrainedObjects->add(object); |
1223 | 1222 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 scrollContentsIfNeeded(); | 1274 scrollContentsIfNeeded(); |
1276 | 1275 |
1277 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree
().nextSibling()) { | 1276 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree
().nextSibling()) { |
1278 if (!child->isLocalFrame()) | 1277 if (!child->isLocalFrame()) |
1279 continue; | 1278 continue; |
1280 if (FrameView* view = toLocalFrame(child)->view()) | 1279 if (FrameView* view = toLocalFrame(child)->view()) |
1281 view->scrollContentsIfNeededRecursive(); | 1280 view->scrollContentsIfNeededRecursive(); |
1282 } | 1281 } |
1283 } | 1282 } |
1284 | 1283 |
| 1284 void FrameView::invalidateBackgroundAttachmentFixedObjects() |
| 1285 { |
| 1286 for (const auto& layoutObject : m_backgroundAttachmentFixedObjects) |
| 1287 layoutObject->setShouldDoFullPaintInvalidation(); |
| 1288 } |
| 1289 |
1285 bool FrameView::invalidateViewportConstrainedObjects() | 1290 bool FrameView::invalidateViewportConstrainedObjects() |
1286 { | 1291 { |
1287 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects)
{ | 1292 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects)
{ |
1288 LayoutObject* layoutObject = viewportConstrainedObject; | 1293 LayoutObject* layoutObject = viewportConstrainedObject; |
1289 ASSERT(layoutObject->style()->hasViewportConstrainedPosition()); | 1294 ASSERT(layoutObject->style()->hasViewportConstrainedPosition()); |
1290 ASSERT(layoutObject->hasLayer()); | 1295 ASSERT(layoutObject->hasLayer()); |
1291 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer(); | 1296 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer(); |
1292 | 1297 |
1293 if (layer->isPaintInvalidationContainer()) | 1298 if (layer->isPaintInvalidationContainer()) |
1294 continue; | 1299 continue; |
(...skipping 13 matching lines...) Expand all Loading... |
1308 "data", | 1313 "data", |
1309 InspectorScrollInvalidationTrackingEvent::data(*layoutObject)); | 1314 InspectorScrollInvalidationTrackingEvent::data(*layoutObject)); |
1310 | 1315 |
1311 layoutObject->setShouldDoFullPaintInvalidationIncludingNonCompositingDes
cendants(); | 1316 layoutObject->setShouldDoFullPaintInvalidationIncludingNonCompositingDes
cendants(); |
1312 } | 1317 } |
1313 return true; | 1318 return true; |
1314 } | 1319 } |
1315 | 1320 |
1316 bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta) | 1321 bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta) |
1317 { | 1322 { |
1318 if (!contentsInCompositedLayer() || hasSlowRepaintObjects()) | 1323 if (!contentsInCompositedLayer()) |
1319 return false; | 1324 return false; |
1320 | 1325 |
| 1326 invalidateBackgroundAttachmentFixedObjects(); |
| 1327 |
1321 if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty()
) { | 1328 if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty()
) { |
1322 InspectorInstrumentation::didUpdateLayout(m_frame.get()); | 1329 InspectorInstrumentation::didUpdateLayout(m_frame.get()); |
1323 return true; | 1330 return true; |
1324 } | 1331 } |
1325 | 1332 |
1326 if (!invalidateViewportConstrainedObjects()) | 1333 if (!invalidateViewportConstrainedObjects()) |
1327 return false; | 1334 return false; |
1328 | 1335 |
1329 InspectorInstrumentation::didUpdateLayout(m_frame.get()); | 1336 InspectorInstrumentation::didUpdateLayout(m_frame.get()); |
1330 return true; | 1337 return true; |
(...skipping 2613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3944 | 3951 |
3945 if (!graphicsLayer) | 3952 if (!graphicsLayer) |
3946 return; | 3953 return; |
3947 | 3954 |
3948 PaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentLayoutObjec
t(), paintInvalidationContainer, viewRect); | 3955 PaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentLayoutObjec
t(), paintInvalidationContainer, viewRect); |
3949 | 3956 |
3950 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web
Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing
IntRect(viewRect))); | 3957 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web
Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing
IntRect(viewRect))); |
3951 } | 3958 } |
3952 | 3959 |
3953 } // namespace blink | 3960 } // namespace blink |
OLD | NEW |