Chromium Code Reviews| 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 4293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4304 parent->m_needsUpdateViewportIntersectionInSubtree = true; | 4304 parent->m_needsUpdateViewportIntersectionInSubtree = true; |
| 4305 } | 4305 } |
| 4306 | 4306 |
| 4307 void FrameView::updateViewportIntersectionIfNeeded() { | 4307 void FrameView::updateViewportIntersectionIfNeeded() { |
| 4308 if (!m_needsUpdateViewportIntersection) | 4308 if (!m_needsUpdateViewportIntersection) |
| 4309 return; | 4309 return; |
| 4310 m_needsUpdateViewportIntersection = false; | 4310 m_needsUpdateViewportIntersection = false; |
| 4311 m_viewportIntersectionValid = true; | 4311 m_viewportIntersectionValid = true; |
| 4312 FrameView* parent = parentFrameView(); | 4312 FrameView* parent = parentFrameView(); |
| 4313 if (!parent) { | 4313 if (!parent) { |
| 4314 HTMLFrameOwnerElement* element = frame().deprecatedLocalOwner(); | |
| 4315 // Determining visibility uses the owner element's LayoutObject, | |
|
dgrogan
2016/10/18 22:11:45
I used this comment without thinking about it, but
| |
| 4316 // which is not currently possible if the parent is | |
| 4317 // remote. | |
| 4318 if (!element) | |
| 4319 frame().document()->wouldLoadBecause(WouldLoadOutOfProcess); | |
| 4320 // Having no layout object means the frame is not drawn. | |
| 4321 else if (!element->layoutObject()) | |
| 4322 frame().document()->wouldLoadBecause(WouldLoadDisplayNone); | |
| 4314 m_viewportIntersection = frameRect(); | 4323 m_viewportIntersection = frameRect(); |
| 4315 return; | 4324 return; |
| 4316 } | 4325 } |
| 4317 ASSERT(!parent->m_needsUpdateViewportIntersection); | 4326 ASSERT(!parent->m_needsUpdateViewportIntersection); |
| 4318 | 4327 |
| 4328 bool parentLoaded = parent->frame().document()->wouldLoadReason() > Created; | |
| 4329 // If the parent wasn't loaded, the children won't be either. | |
| 4330 if (parentLoaded) { | |
| 4331 if (frameRect().isEmpty()) | |
| 4332 frame().document()->wouldLoadBecause(WouldLoadZeroByZero); | |
| 4333 else if (frameRect().maxY() < 0) | |
| 4334 frame().document()->wouldLoadBecause(WouldLoadAbove); | |
| 4335 else if (frameRect().maxX() < 0) | |
| 4336 frame().document()->wouldLoadBecause(WouldLoadLeft); | |
| 4337 } | |
| 4338 | |
| 4319 // If our parent is hidden, then we are too. | 4339 // If our parent is hidden, then we are too. |
| 4320 if (parent->m_viewportIntersection.isEmpty()) { | 4340 if (parent->m_viewportIntersection.isEmpty()) { |
| 4321 m_viewportIntersection = parent->m_viewportIntersection; | 4341 m_viewportIntersection = parent->m_viewportIntersection; |
| 4322 return; | 4342 return; |
| 4323 } | 4343 } |
| 4324 | 4344 |
| 4325 // Transform our bounds into the root frame's content coordinate space, | 4345 // Transform our bounds into the root frame's content coordinate space, |
| 4326 // making sure we have valid layout data in our parent document. If our | 4346 // making sure we have valid layout data in our parent document. If our |
| 4327 // parent is throttled, we'll use possible stale layout information and | 4347 // parent is throttled, we'll use possible stale layout information and |
| 4328 // rely on the fact that another lifecycle update will be scheduled once | 4348 // rely on the fact that another lifecycle update will be scheduled once |
| 4329 // our parent becomes unthrottled. | 4349 // our parent becomes unthrottled. |
| 4330 ASSERT(parent->lifecycle().state() >= DocumentLifecycle::LayoutClean || | 4350 ASSERT(parent->lifecycle().state() >= DocumentLifecycle::LayoutClean || |
| 4331 parent->shouldThrottleRendering()); | 4351 parent->shouldThrottleRendering()); |
| 4332 m_viewportIntersection = parent->contentsToRootFrame(frameRect()); | 4352 m_viewportIntersection = parent->contentsToRootFrame(frameRect()); |
| 4333 | 4353 |
| 4334 // TODO(skyostil): Expand the viewport to make it less likely to see stale | 4354 // TODO(skyostil): Expand the viewport to make it less likely to see stale |
| 4335 // content while scrolling. | 4355 // content while scrolling. |
| 4336 IntRect viewport = parent->m_viewportIntersection; | 4356 IntRect viewport = parent->m_viewportIntersection; |
| 4337 m_viewportIntersection.intersect(viewport); | 4357 m_viewportIntersection.intersect(viewport); |
| 4358 | |
| 4359 if (parentLoaded && !m_viewportIntersection.isEmpty()) | |
| 4360 frame().document()->wouldLoadBecause(WouldLoadVisible); | |
| 4338 } | 4361 } |
| 4339 | 4362 |
| 4340 void FrameView::updateViewportIntersectionsForSubtree( | 4363 void FrameView::updateViewportIntersectionsForSubtree( |
| 4341 DocumentLifecycle::LifecycleState targetState) { | 4364 DocumentLifecycle::LifecycleState targetState) { |
| 4342 bool hadValidIntersection = m_viewportIntersectionValid; | 4365 bool hadValidIntersection = m_viewportIntersectionValid; |
| 4343 bool hadEmptyIntersection = m_viewportIntersection.isEmpty(); | 4366 bool hadEmptyIntersection = m_viewportIntersection.isEmpty(); |
| 4344 updateViewportIntersectionIfNeeded(); | 4367 updateViewportIntersectionIfNeeded(); |
| 4345 | 4368 |
| 4346 // Notify javascript IntersectionObservers | 4369 // Notify javascript IntersectionObservers |
| 4347 if (targetState == DocumentLifecycle::PaintClean && | 4370 if (targetState == DocumentLifecycle::PaintClean && |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4413 | 4436 |
| 4414 void FrameView::notifyRenderThrottlingObservers() { | 4437 void FrameView::notifyRenderThrottlingObservers() { |
| 4415 TRACE_EVENT0("blink", "FrameView::notifyRenderThrottlingObservers"); | 4438 TRACE_EVENT0("blink", "FrameView::notifyRenderThrottlingObservers"); |
| 4416 DCHECK(!isInPerformLayout()); | 4439 DCHECK(!isInPerformLayout()); |
| 4417 DCHECK(frame().document()); | 4440 DCHECK(frame().document()); |
| 4418 DCHECK(!frame().document()->inStyleRecalc()); | 4441 DCHECK(!frame().document()->inStyleRecalc()); |
| 4419 bool wasThrottled = canThrottleRendering(); | 4442 bool wasThrottled = canThrottleRendering(); |
| 4420 | 4443 |
| 4421 updateThrottlingStatus(); | 4444 updateThrottlingStatus(); |
| 4422 | 4445 |
| 4423 frame().document()->onVisibilityMaybeChanged(!m_hiddenForThrottling); | |
| 4424 | |
| 4425 bool becameThrottled = !wasThrottled && canThrottleRendering(); | 4446 bool becameThrottled = !wasThrottled && canThrottleRendering(); |
| 4426 bool becameUnthrottled = wasThrottled && !canThrottleRendering(); | 4447 bool becameUnthrottled = wasThrottled && !canThrottleRendering(); |
| 4427 ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(); | 4448 ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(); |
| 4428 if (becameThrottled) { | 4449 if (becameThrottled) { |
| 4429 // If this FrameView became throttled, we must make sure all of its | 4450 // If this FrameView became throttled, we must make sure all of its |
| 4430 // children become throttled at the same time. Otherwise we might | 4451 // children become throttled at the same time. Otherwise we might |
| 4431 // attempt to paint one of the children with an out-of-date layout | 4452 // attempt to paint one of the children with an out-of-date layout |
| 4432 // before |notifyRenderThrottlingObservers| has made it throttled. | 4453 // before |notifyRenderThrottlingObservers| has made it throttled. |
| 4433 forAllNonThrottledFrameViews([](FrameView& frameView) { | 4454 forAllNonThrottledFrameViews([](FrameView& frameView) { |
| 4434 frameView.m_subtreeThrottled = true; | 4455 frameView.m_subtreeThrottled = true; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4473 } | 4494 } |
| 4474 | 4495 |
| 4475 bool FrameView::canThrottleRendering() const { | 4496 bool FrameView::canThrottleRendering() const { |
| 4476 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) | 4497 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) |
| 4477 return false; | 4498 return false; |
| 4478 return m_subtreeThrottled || | 4499 return m_subtreeThrottled || |
| 4479 (m_hiddenForThrottling && m_crossOriginForThrottling); | 4500 (m_hiddenForThrottling && m_crossOriginForThrottling); |
| 4480 } | 4501 } |
| 4481 | 4502 |
| 4482 } // namespace blink | 4503 } // namespace blink |
| OLD | NEW |