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