Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2431473003: Intersection Observer support for OOPIF (Closed)
Patch Set: Enabled test, fixed bugs Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 29 matching lines...) Expand all
40 #include "core/editing/RenderedPosition.h" 40 #include "core/editing/RenderedPosition.h"
41 #include "core/editing/markers/DocumentMarkerController.h" 41 #include "core/editing/markers/DocumentMarkerController.h"
42 #include "core/events/ErrorEvent.h" 42 #include "core/events/ErrorEvent.h"
43 #include "core/fetch/ResourceFetcher.h" 43 #include "core/fetch/ResourceFetcher.h"
44 #include "core/frame/BrowserControls.h" 44 #include "core/frame/BrowserControls.h"
45 #include "core/frame/EventHandlerRegistry.h" 45 #include "core/frame/EventHandlerRegistry.h"
46 #include "core/frame/FrameHost.h" 46 #include "core/frame/FrameHost.h"
47 #include "core/frame/LocalFrame.h" 47 #include "core/frame/LocalFrame.h"
48 #include "core/frame/Location.h" 48 #include "core/frame/Location.h"
49 #include "core/frame/PageScaleConstraintsSet.h" 49 #include "core/frame/PageScaleConstraintsSet.h"
50 #include "core/frame/RemoteFrame.h"
51 #include "core/frame/RemoteFrameView.h"
50 #include "core/frame/Settings.h" 52 #include "core/frame/Settings.h"
51 #include "core/frame/VisualViewport.h" 53 #include "core/frame/VisualViewport.h"
52 #include "core/html/HTMLFrameElement.h" 54 #include "core/html/HTMLFrameElement.h"
53 #include "core/html/HTMLPlugInElement.h" 55 #include "core/html/HTMLPlugInElement.h"
54 #include "core/html/HTMLTextFormControlElement.h" 56 #include "core/html/HTMLTextFormControlElement.h"
55 #include "core/html/parser/TextResourceDecoder.h" 57 #include "core/html/parser/TextResourceDecoder.h"
56 #include "core/input/EventHandler.h" 58 #include "core/input/EventHandler.h"
57 #include "core/inspector/InspectorInstrumentation.h" 59 #include "core/inspector/InspectorInstrumentation.h"
58 #include "core/inspector/InspectorTraceEvents.h" 60 #include "core/inspector/InspectorTraceEvents.h"
59 #include "core/layout/LayoutAnalyzer.h" 61 #include "core/layout/LayoutAnalyzer.h"
(...skipping 4272 matching lines...) Expand 10 before | Expand all | Expand 10 after
4332 parent->m_needsUpdateViewportIntersectionInSubtree = true; 4334 parent->m_needsUpdateViewportIntersectionInSubtree = true;
4333 } 4335 }
4334 4336
4335 void FrameView::updateViewportIntersectionIfNeeded() { 4337 void FrameView::updateViewportIntersectionIfNeeded() {
4336 if (!m_needsUpdateViewportIntersection) 4338 if (!m_needsUpdateViewportIntersection)
4337 return; 4339 return;
4338 m_needsUpdateViewportIntersection = false; 4340 m_needsUpdateViewportIntersection = false;
4339 m_viewportIntersectionValid = true; 4341 m_viewportIntersectionValid = true;
4340 FrameView* parent = parentFrameView(); 4342 FrameView* parent = parentFrameView();
4341 if (!parent) { 4343 if (!parent) {
4344 // TODO(kenrb): For an OOPIF, we could use m_remoteViewportIntersection
4345 // to compute m_viewportIntersection, but there needs to be a way to
4346 // convert to the root frame's coordinate space when there are remote
4347 // frame ancestors in the tree.
4342 HTMLFrameOwnerElement* element = frame().deprecatedLocalOwner(); 4348 HTMLFrameOwnerElement* element = frame().deprecatedLocalOwner();
4343 if (!element) 4349 if (!element)
4344 frame().document()->maybeRecordLoadReason(WouldLoadOutOfProcess); 4350 frame().document()->maybeRecordLoadReason(WouldLoadOutOfProcess);
4345 // Having no layout object means the frame is not drawn. 4351 // Having no layout object means the frame is not drawn.
4346 else if (!element->layoutObject()) 4352 else if (!element->layoutObject())
4347 frame().document()->maybeRecordLoadReason(WouldLoadDisplayNone); 4353 frame().document()->maybeRecordLoadReason(WouldLoadDisplayNone);
4348 m_viewportIntersection = frameRect(); 4354 m_viewportIntersection = frameRect();
4349 return; 4355 return;
4350 } 4356 }
4351 ASSERT(!parent->m_needsUpdateViewportIntersection); 4357 ASSERT(!parent->m_needsUpdateViewportIntersection);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
4409 m_frame->frameScheduler()->unthrottledTaskRunner()->postTask( 4415 m_frame->frameScheduler()->unthrottledTaskRunner()->postTask(
4410 BLINK_FROM_HERE, 4416 BLINK_FROM_HERE,
4411 m_renderThrottlingObserverNotificationFactory->cancelAndCreate()); 4417 m_renderThrottlingObserverNotificationFactory->cancelAndCreate());
4412 4418
4413 if (!m_needsUpdateViewportIntersectionInSubtree) 4419 if (!m_needsUpdateViewportIntersectionInSubtree)
4414 return; 4420 return;
4415 m_needsUpdateViewportIntersectionInSubtree = false; 4421 m_needsUpdateViewportIntersectionInSubtree = false;
4416 4422
4417 for (Frame* child = m_frame->tree().firstChild(); child; 4423 for (Frame* child = m_frame->tree().firstChild(); child;
4418 child = child->tree().nextSibling()) { 4424 child = child->tree().nextSibling()) {
4419 if (!child->isLocalFrame()) 4425 if (child->isRemoteFrame() && toRemoteFrame(child)->view())
4420 continue; 4426 toRemoteFrame(child)->view()->updateRemoteViewportIntersection();
4421 if (FrameView* view = toLocalFrame(child)->view()) 4427 else if (FrameView* view = toLocalFrame(child)->view())
4422 view->updateViewportIntersectionsForSubtree(targetState); 4428 view->updateViewportIntersectionsForSubtree(targetState);
4423 } 4429 }
4424 } 4430 }
4425 4431
4432 IntRect FrameView::viewportIntersection() {
4433 if (m_viewportIntersectionValid)
4434 return m_viewportIntersection;
4435 return IntRect();
4436 }
4437
4426 void FrameView::updateThrottlingStatus() { 4438 void FrameView::updateThrottlingStatus() {
4427 // Only offscreen frames can be throttled. Note that we disallow throttling 4439 // Only offscreen frames can be throttled. Note that we disallow throttling
4428 // of 0x0 frames because some sites use them to drive UI logic. 4440 // of 0x0 frames because some sites use them to drive UI logic.
4429 DCHECK(m_viewportIntersectionValid); 4441 DCHECK(m_viewportIntersectionValid);
4430 m_hiddenForThrottling = 4442 m_hiddenForThrottling =
4431 m_viewportIntersection.isEmpty() && !frameRect().isEmpty(); 4443 m_viewportIntersection.isEmpty() && !frameRect().isEmpty();
4432 4444
4433 // We only throttle the rendering pipeline in cross-origin frames. This is 4445 // We only throttle the rendering pipeline in cross-origin frames. This is
4434 // to avoid a situation where an ancestor frame directly depends on the 4446 // to avoid a situation where an ancestor frame directly depends on the
4435 // pipeline timing of a descendant and breaks as a result of throttling. 4447 // pipeline timing of a descendant and breaks as a result of throttling.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
4539 int FrameView::initialViewportWidth() const { 4551 int FrameView::initialViewportWidth() const {
4540 DCHECK(m_frame->isMainFrame()); 4552 DCHECK(m_frame->isMainFrame());
4541 return m_initialViewportSize.width(); 4553 return m_initialViewportSize.width();
4542 } 4554 }
4543 4555
4544 int FrameView::initialViewportHeight() const { 4556 int FrameView::initialViewportHeight() const {
4545 DCHECK(m_frame->isMainFrame()); 4557 DCHECK(m_frame->isMainFrame());
4546 return m_initialViewportSize.height(); 4558 return m_initialViewportSize.height();
4547 } 4559 }
4548 4560
4561 void FrameView::setViewportIntersectionFromParent(
4562 const IntRect& viewportIntersection) {
4563 m_remoteViewportIntersection = viewportIntersection;
4564 setNeedsUpdateViewportIntersection();
4565 updateAllLifecyclePhases();
kenrb 2016/11/07 18:48:49 Is this call okay? I was finding that the test was
szager1 2016/11/16 18:57:58 This is not kosher. I think you just want to: if
kenrb 2016/11/21 19:37:35 Done.
4566 }
4567
4568 IntRect FrameView::remoteViewportIntersection() {
4569 IntRect intersection(m_remoteViewportIntersection);
4570 intersection.move(scrollOffsetInt());
4571 return intersection;
4572 }
4573
4549 } // namespace blink 4574 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | third_party/WebKit/Source/core/frame/RemoteFrame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698