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 // Frames have no layout object approximately iff they are display:none. | |
4316 // And out-of-process frames are the only other frames that have no parent. | |
dgrogan
2016/10/13 01:06:22
Do you know if the line4316 comment is correct? Wh
| |
4317 if (element && !element->layoutObject()) | |
4318 frame().document()->wouldLoadBecause(WouldLoadDisplayNone); | |
4319 else | |
dcheng
2016/10/13 23:00:43
Right now, this will record WouldLoadOutOfProcess
dgrogan
2016/10/14 21:45:08
If an iframe's parent is in-process we wouldn't en
dcheng
2016/10/14 23:40:30
Ah, I misread this originally. So I would expect p
| |
4320 frame().document()->wouldLoadBecause(WouldLoadOutOfProcess); | |
4314 m_viewportIntersection = frameRect(); | 4321 m_viewportIntersection = frameRect(); |
4315 return; | 4322 return; |
4316 } | 4323 } |
4317 ASSERT(!parent->m_needsUpdateViewportIntersection); | 4324 ASSERT(!parent->m_needsUpdateViewportIntersection); |
4318 | 4325 |
4326 bool parentLoaded = parent->frame().document()->wouldLoadReason() > Created; | |
dgrogan
2016/10/13 01:06:22
I suspect ">" makes the meaning clearer at first g
| |
4327 // If the parent wasn't loaded, the children won't be either. | |
4328 if (parentLoaded) { | |
4329 if (frameRect().isEmpty()) | |
4330 frame().document()->wouldLoadBecause(WouldLoadZeroByZero); | |
4331 else if (frameRect().maxY() < 0) | |
4332 frame().document()->wouldLoadBecause(WouldLoadAbove); | |
4333 else if (frameRect().maxX() < 0) | |
4334 frame().document()->wouldLoadBecause(WouldLoadLeft); | |
4335 } | |
4336 | |
4319 // If our parent is hidden, then we are too. | 4337 // If our parent is hidden, then we are too. |
4320 if (parent->m_viewportIntersection.isEmpty()) { | 4338 if (parent->m_viewportIntersection.isEmpty()) { |
4321 m_viewportIntersection = parent->m_viewportIntersection; | 4339 m_viewportIntersection = parent->m_viewportIntersection; |
4322 return; | 4340 return; |
4323 } | 4341 } |
4324 | 4342 |
4325 // Transform our bounds into the root frame's content coordinate space, | 4343 // 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 | 4344 // 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 | 4345 // parent is throttled, we'll use possible stale layout information and |
4328 // rely on the fact that another lifecycle update will be scheduled once | 4346 // rely on the fact that another lifecycle update will be scheduled once |
4329 // our parent becomes unthrottled. | 4347 // our parent becomes unthrottled. |
4330 ASSERT(parent->lifecycle().state() >= DocumentLifecycle::LayoutClean || | 4348 ASSERT(parent->lifecycle().state() >= DocumentLifecycle::LayoutClean || |
4331 parent->shouldThrottleRendering()); | 4349 parent->shouldThrottleRendering()); |
4332 m_viewportIntersection = parent->contentsToRootFrame(frameRect()); | 4350 m_viewportIntersection = parent->contentsToRootFrame(frameRect()); |
4333 | 4351 |
4334 // TODO(skyostil): Expand the viewport to make it less likely to see stale | 4352 // TODO(skyostil): Expand the viewport to make it less likely to see stale |
4335 // content while scrolling. | 4353 // content while scrolling. |
4336 IntRect viewport = parent->m_viewportIntersection; | 4354 IntRect viewport = parent->m_viewportIntersection; |
4337 m_viewportIntersection.intersect(viewport); | 4355 m_viewportIntersection.intersect(viewport); |
4356 | |
4357 if (parentLoaded && !m_viewportIntersection.isEmpty()) | |
4358 frame().document()->wouldLoadBecause(WouldLoadVisible); | |
4338 } | 4359 } |
4339 | 4360 |
4340 void FrameView::updateViewportIntersectionsForSubtree( | 4361 void FrameView::updateViewportIntersectionsForSubtree( |
4341 DocumentLifecycle::LifecycleState targetState) { | 4362 DocumentLifecycle::LifecycleState targetState) { |
4342 bool hadValidIntersection = m_viewportIntersectionValid; | 4363 bool hadValidIntersection = m_viewportIntersectionValid; |
4343 bool hadEmptyIntersection = m_viewportIntersection.isEmpty(); | 4364 bool hadEmptyIntersection = m_viewportIntersection.isEmpty(); |
4344 updateViewportIntersectionIfNeeded(); | 4365 updateViewportIntersectionIfNeeded(); |
4345 | 4366 |
4346 // Notify javascript IntersectionObservers | 4367 // Notify javascript IntersectionObservers |
4347 if (targetState == DocumentLifecycle::PaintClean && | 4368 if (targetState == DocumentLifecycle::PaintClean && |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4413 | 4434 |
4414 void FrameView::notifyRenderThrottlingObservers() { | 4435 void FrameView::notifyRenderThrottlingObservers() { |
4415 TRACE_EVENT0("blink", "FrameView::notifyRenderThrottlingObservers"); | 4436 TRACE_EVENT0("blink", "FrameView::notifyRenderThrottlingObservers"); |
4416 DCHECK(!isInPerformLayout()); | 4437 DCHECK(!isInPerformLayout()); |
4417 DCHECK(frame().document()); | 4438 DCHECK(frame().document()); |
4418 DCHECK(!frame().document()->inStyleRecalc()); | 4439 DCHECK(!frame().document()->inStyleRecalc()); |
4419 bool wasThrottled = canThrottleRendering(); | 4440 bool wasThrottled = canThrottleRendering(); |
4420 | 4441 |
4421 updateThrottlingStatus(); | 4442 updateThrottlingStatus(); |
4422 | 4443 |
4423 frame().document()->onVisibilityMaybeChanged(!m_hiddenForThrottling); | |
4424 | |
4425 bool becameThrottled = !wasThrottled && canThrottleRendering(); | 4444 bool becameThrottled = !wasThrottled && canThrottleRendering(); |
4426 bool becameUnthrottled = wasThrottled && !canThrottleRendering(); | 4445 bool becameUnthrottled = wasThrottled && !canThrottleRendering(); |
4427 ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(); | 4446 ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(); |
4428 if (becameThrottled) { | 4447 if (becameThrottled) { |
4429 // If this FrameView became throttled, we must make sure all of its | 4448 // If this FrameView became throttled, we must make sure all of its |
4430 // children become throttled at the same time. Otherwise we might | 4449 // children become throttled at the same time. Otherwise we might |
4431 // attempt to paint one of the children with an out-of-date layout | 4450 // attempt to paint one of the children with an out-of-date layout |
4432 // before |notifyRenderThrottlingObservers| has made it throttled. | 4451 // before |notifyRenderThrottlingObservers| has made it throttled. |
4433 forAllNonThrottledFrameViews([](FrameView& frameView) { | 4452 forAllNonThrottledFrameViews([](FrameView& frameView) { |
4434 frameView.m_subtreeThrottled = true; | 4453 frameView.m_subtreeThrottled = true; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4473 } | 4492 } |
4474 | 4493 |
4475 bool FrameView::canThrottleRendering() const { | 4494 bool FrameView::canThrottleRendering() const { |
4476 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) | 4495 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) |
4477 return false; | 4496 return false; |
4478 return m_subtreeThrottled || | 4497 return m_subtreeThrottled || |
4479 (m_hiddenForThrottling && m_crossOriginForThrottling); | 4498 (m_hiddenForThrottling && m_crossOriginForThrottling); |
4480 } | 4499 } |
4481 | 4500 |
4482 } // namespace blink | 4501 } // namespace blink |
OLD | NEW |