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 4290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4301 parent->m_needsUpdateViewportIntersectionInSubtree = true; | 4301 parent->m_needsUpdateViewportIntersectionInSubtree = true; |
4302 } | 4302 } |
4303 | 4303 |
4304 void FrameView::updateViewportIntersectionIfNeeded() { | 4304 void FrameView::updateViewportIntersectionIfNeeded() { |
4305 if (!m_needsUpdateViewportIntersection) | 4305 if (!m_needsUpdateViewportIntersection) |
4306 return; | 4306 return; |
4307 m_needsUpdateViewportIntersection = false; | 4307 m_needsUpdateViewportIntersection = false; |
4308 m_viewportIntersectionValid = true; | 4308 m_viewportIntersectionValid = true; |
4309 FrameView* parent = parentFrameView(); | 4309 FrameView* parent = parentFrameView(); |
4310 if (!parent) { | 4310 if (!parent) { |
| 4311 HTMLFrameOwnerElement* element = frame().deprecatedLocalOwner(); |
| 4312 if (!element) |
| 4313 frame().document()->maybeRecordLoadReason(WouldLoadOutOfProcess); |
| 4314 // Having no layout object means the frame is not drawn. |
| 4315 else if (!element->layoutObject()) |
| 4316 frame().document()->maybeRecordLoadReason(WouldLoadDisplayNone); |
4311 m_viewportIntersection = frameRect(); | 4317 m_viewportIntersection = frameRect(); |
4312 return; | 4318 return; |
4313 } | 4319 } |
4314 ASSERT(!parent->m_needsUpdateViewportIntersection); | 4320 ASSERT(!parent->m_needsUpdateViewportIntersection); |
4315 | 4321 |
| 4322 bool parentLoaded = parent->frame().document()->wouldLoadReason() > Created; |
| 4323 // If the parent wasn't loaded, the children won't be either. |
| 4324 if (parentLoaded) { |
| 4325 if (frameRect().isEmpty()) |
| 4326 frame().document()->maybeRecordLoadReason(WouldLoadZeroByZero); |
| 4327 else if (frameRect().maxY() < 0) |
| 4328 frame().document()->maybeRecordLoadReason(WouldLoadAbove); |
| 4329 else if (frameRect().maxX() < 0) |
| 4330 frame().document()->maybeRecordLoadReason(WouldLoadLeft); |
| 4331 } |
| 4332 |
4316 // If our parent is hidden, then we are too. | 4333 // If our parent is hidden, then we are too. |
4317 if (parent->m_viewportIntersection.isEmpty()) { | 4334 if (parent->m_viewportIntersection.isEmpty()) { |
4318 m_viewportIntersection = parent->m_viewportIntersection; | 4335 m_viewportIntersection = parent->m_viewportIntersection; |
4319 return; | 4336 return; |
4320 } | 4337 } |
4321 | 4338 |
4322 // Transform our bounds into the root frame's content coordinate space, | 4339 // Transform our bounds into the root frame's content coordinate space, |
4323 // making sure we have valid layout data in our parent document. If our | 4340 // making sure we have valid layout data in our parent document. If our |
4324 // parent is throttled, we'll use possible stale layout information and | 4341 // parent is throttled, we'll use possible stale layout information and |
4325 // rely on the fact that another lifecycle update will be scheduled once | 4342 // rely on the fact that another lifecycle update will be scheduled once |
4326 // our parent becomes unthrottled. | 4343 // our parent becomes unthrottled. |
4327 ASSERT(parent->lifecycle().state() >= DocumentLifecycle::LayoutClean || | 4344 ASSERT(parent->lifecycle().state() >= DocumentLifecycle::LayoutClean || |
4328 parent->shouldThrottleRendering()); | 4345 parent->shouldThrottleRendering()); |
4329 m_viewportIntersection = parent->contentsToRootFrame(frameRect()); | 4346 m_viewportIntersection = parent->contentsToRootFrame(frameRect()); |
4330 | 4347 |
4331 // TODO(skyostil): Expand the viewport to make it less likely to see stale | 4348 // TODO(skyostil): Expand the viewport to make it less likely to see stale |
4332 // content while scrolling. | 4349 // content while scrolling. |
4333 IntRect viewport = parent->m_viewportIntersection; | 4350 IntRect viewport = parent->m_viewportIntersection; |
4334 m_viewportIntersection.intersect(viewport); | 4351 m_viewportIntersection.intersect(viewport); |
| 4352 |
| 4353 if (parentLoaded && !m_viewportIntersection.isEmpty()) |
| 4354 frame().document()->maybeRecordLoadReason(WouldLoadVisible); |
4335 } | 4355 } |
4336 | 4356 |
4337 void FrameView::updateViewportIntersectionsForSubtree( | 4357 void FrameView::updateViewportIntersectionsForSubtree( |
4338 DocumentLifecycle::LifecycleState targetState) { | 4358 DocumentLifecycle::LifecycleState targetState) { |
4339 bool hadValidIntersection = m_viewportIntersectionValid; | 4359 bool hadValidIntersection = m_viewportIntersectionValid; |
4340 bool hadEmptyIntersection = m_viewportIntersection.isEmpty(); | 4360 bool hadEmptyIntersection = m_viewportIntersection.isEmpty(); |
4341 updateViewportIntersectionIfNeeded(); | 4361 updateViewportIntersectionIfNeeded(); |
4342 | 4362 |
4343 // Notify javascript IntersectionObservers | 4363 // Notify javascript IntersectionObservers |
4344 if (targetState == DocumentLifecycle::PaintClean && | 4364 if (targetState == DocumentLifecycle::PaintClean && |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4410 | 4430 |
4411 void FrameView::notifyRenderThrottlingObservers() { | 4431 void FrameView::notifyRenderThrottlingObservers() { |
4412 TRACE_EVENT0("blink", "FrameView::notifyRenderThrottlingObservers"); | 4432 TRACE_EVENT0("blink", "FrameView::notifyRenderThrottlingObservers"); |
4413 DCHECK(!isInPerformLayout()); | 4433 DCHECK(!isInPerformLayout()); |
4414 DCHECK(frame().document()); | 4434 DCHECK(frame().document()); |
4415 DCHECK(!frame().document()->inStyleRecalc()); | 4435 DCHECK(!frame().document()->inStyleRecalc()); |
4416 bool wasThrottled = canThrottleRendering(); | 4436 bool wasThrottled = canThrottleRendering(); |
4417 | 4437 |
4418 updateThrottlingStatus(); | 4438 updateThrottlingStatus(); |
4419 | 4439 |
4420 frame().document()->onVisibilityMaybeChanged(!m_hiddenForThrottling); | |
4421 | |
4422 bool becameThrottled = !wasThrottled && canThrottleRendering(); | 4440 bool becameThrottled = !wasThrottled && canThrottleRendering(); |
4423 bool becameUnthrottled = wasThrottled && !canThrottleRendering(); | 4441 bool becameUnthrottled = wasThrottled && !canThrottleRendering(); |
4424 ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(); | 4442 ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(); |
4425 if (becameThrottled) { | 4443 if (becameThrottled) { |
4426 // If this FrameView became throttled, we must make sure all of its | 4444 // If this FrameView became throttled, we must make sure all of its |
4427 // children become throttled at the same time. Otherwise we might | 4445 // children become throttled at the same time. Otherwise we might |
4428 // attempt to paint one of the children with an out-of-date layout | 4446 // attempt to paint one of the children with an out-of-date layout |
4429 // before |notifyRenderThrottlingObservers| has made it throttled. | 4447 // before |notifyRenderThrottlingObservers| has made it throttled. |
4430 forAllNonThrottledFrameViews([](FrameView& frameView) { | 4448 forAllNonThrottledFrameViews([](FrameView& frameView) { |
4431 frameView.m_subtreeThrottled = true; | 4449 frameView.m_subtreeThrottled = true; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4489 DCHECK(m_frame->isMainFrame()); | 4507 DCHECK(m_frame->isMainFrame()); |
4490 return m_initialViewportSize.width(); | 4508 return m_initialViewportSize.width(); |
4491 } | 4509 } |
4492 | 4510 |
4493 int FrameView::initialViewportHeight() const { | 4511 int FrameView::initialViewportHeight() const { |
4494 DCHECK(m_frame->isMainFrame()); | 4512 DCHECK(m_frame->isMainFrame()); |
4495 return m_initialViewportSize.height(); | 4513 return m_initialViewportSize.height(); |
4496 } | 4514 } |
4497 | 4515 |
4498 } // namespace blink | 4516 } // namespace blink |
OLD | NEW |