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

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

Issue 2431473003: Intersection Observer support for OOPIF (Closed)
Patch Set: Created 4 years, 2 months 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 28 matching lines...) Expand all
39 #include "core/editing/FrameSelection.h" 39 #include "core/editing/FrameSelection.h"
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/EventHandlerRegistry.h" 44 #include "core/frame/EventHandlerRegistry.h"
45 #include "core/frame/FrameHost.h" 45 #include "core/frame/FrameHost.h"
46 #include "core/frame/LocalFrame.h" 46 #include "core/frame/LocalFrame.h"
47 #include "core/frame/Location.h" 47 #include "core/frame/Location.h"
48 #include "core/frame/PageScaleConstraintsSet.h" 48 #include "core/frame/PageScaleConstraintsSet.h"
49 #include "core/frame/RemoteFrame.h"
50 #include "core/frame/RemoteFrameView.h"
49 #include "core/frame/Settings.h" 51 #include "core/frame/Settings.h"
50 #include "core/frame/TopControls.h" 52 #include "core/frame/TopControls.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"
(...skipping 4246 matching lines...) Expand 10 before | Expand all | Expand 10 after
4305 parent->m_needsUpdateViewportIntersectionInSubtree = true; 4307 parent->m_needsUpdateViewportIntersectionInSubtree = true;
4306 } 4308 }
4307 4309
4308 void FrameView::updateViewportIntersectionIfNeeded() { 4310 void FrameView::updateViewportIntersectionIfNeeded() {
4309 if (!m_needsUpdateViewportIntersection) 4311 if (!m_needsUpdateViewportIntersection)
4310 return; 4312 return;
4311 m_needsUpdateViewportIntersection = false; 4313 m_needsUpdateViewportIntersection = false;
4312 m_viewportIntersectionValid = true; 4314 m_viewportIntersectionValid = true;
4313 FrameView* parent = parentFrameView(); 4315 FrameView* parent = parentFrameView();
4314 if (!parent) { 4316 if (!parent) {
4315 m_viewportIntersection = frameRect(); 4317 Frame* parent = m_frame->tree().parent();
4318 if (parent && parent->isRemoteFrame())
4319 m_viewportIntersection = m_remoteViewportIntersection;
4320 else
4321 m_viewportIntersection = frameRect();
4316 return; 4322 return;
4317 } 4323 }
4318 ASSERT(!parent->m_needsUpdateViewportIntersection); 4324 ASSERT(!parent->m_needsUpdateViewportIntersection);
4319 4325
4320 // If our parent is hidden, then we are too. 4326 // If our parent is hidden, then we are too.
4321 if (parent->m_viewportIntersection.isEmpty()) { 4327 if (parent->m_viewportIntersection.isEmpty()) {
4322 m_viewportIntersection = parent->m_viewportIntersection; 4328 m_viewportIntersection = parent->m_viewportIntersection;
4323 return; 4329 return;
4324 } 4330 }
4325 4331
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
4360 m_frame->frameScheduler()->unthrottledTaskRunner()->postTask( 4366 m_frame->frameScheduler()->unthrottledTaskRunner()->postTask(
4361 BLINK_FROM_HERE, 4367 BLINK_FROM_HERE,
4362 m_renderThrottlingObserverNotificationFactory->cancelAndCreate()); 4368 m_renderThrottlingObserverNotificationFactory->cancelAndCreate());
4363 4369
4364 if (!m_needsUpdateViewportIntersectionInSubtree) 4370 if (!m_needsUpdateViewportIntersectionInSubtree)
4365 return; 4371 return;
4366 m_needsUpdateViewportIntersectionInSubtree = false; 4372 m_needsUpdateViewportIntersectionInSubtree = false;
4367 4373
4368 for (Frame* child = m_frame->tree().firstChild(); child; 4374 for (Frame* child = m_frame->tree().firstChild(); child;
4369 child = child->tree().nextSibling()) { 4375 child = child->tree().nextSibling()) {
4370 if (!child->isLocalFrame()) 4376 if (child->isRemoteFrame() && toRemoteFrame(child)->view())
4371 continue; 4377 toRemoteFrame(child)->view()->updateRemoteViewportIntersection();
4372 if (FrameView* view = toLocalFrame(child)->view()) 4378 else if (FrameView* view = toLocalFrame(child)->view())
4373 view->updateViewportIntersectionsForSubtree(targetState); 4379 view->updateViewportIntersectionsForSubtree(targetState);
4374 } 4380 }
4375 } 4381 }
4376 4382
4383 IntRect FrameView::viewportIntersection() {
4384 if (m_viewportIntersectionValid)
4385 return m_viewportIntersection;
4386 return IntRect();
4387 }
4388
4377 void FrameView::updateThrottlingStatus() { 4389 void FrameView::updateThrottlingStatus() {
4378 // Only offscreen frames can be throttled. Note that we disallow throttling 4390 // Only offscreen frames can be throttled. Note that we disallow throttling
4379 // of 0x0 frames because some sites use them to drive UI logic. 4391 // of 0x0 frames because some sites use them to drive UI logic.
4380 DCHECK(m_viewportIntersectionValid); 4392 DCHECK(m_viewportIntersectionValid);
4381 m_hiddenForThrottling = 4393 m_hiddenForThrottling =
4382 m_viewportIntersection.isEmpty() && !frameRect().isEmpty(); 4394 m_viewportIntersection.isEmpty() && !frameRect().isEmpty();
4383 4395
4384 // We only throttle the rendering pipeline in cross-origin frames. This is 4396 // We only throttle the rendering pipeline in cross-origin frames. This is
4385 // to avoid a situation where an ancestor frame directly depends on the 4397 // to avoid a situation where an ancestor frame directly depends on the
4386 // pipeline timing of a descendant and breaks as a result of throttling. 4398 // pipeline timing of a descendant and breaks as a result of throttling.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
4473 return canThrottleRendering() && lifecycle().throttlingAllowed(); 4485 return canThrottleRendering() && lifecycle().throttlingAllowed();
4474 } 4486 }
4475 4487
4476 bool FrameView::canThrottleRendering() const { 4488 bool FrameView::canThrottleRendering() const {
4477 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) 4489 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled())
4478 return false; 4490 return false;
4479 return m_subtreeThrottled || 4491 return m_subtreeThrottled ||
4480 (m_hiddenForThrottling && m_crossOriginForThrottling); 4492 (m_hiddenForThrottling && m_crossOriginForThrottling);
4481 } 4493 }
4482 4494
4495 void FrameView::setViewportIntersectionFromParent(
4496 const IntRect& viewportIntersection,
4497 const IntPoint& rootOffset) {
4498 m_remoteViewportIntersection = viewportIntersection;
4499 m_remoteRootOffset = rootOffset;
4500 m_needsUpdateViewportIntersection = true;
4501 }
4502
4503 IntRect FrameView::remoteViewportIntersection() {
4504 IntRect intersection = m_remoteViewportIntersection;
4505 intersection.moveBy(-m_remoteRootOffset);
4506 return intersection;
4507 }
4508
4483 } // namespace blink 4509 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698