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

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

Issue 1330633003: Intersection Observer first draft Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Include new files as well. Created 5 years, 3 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
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/layout/LayoutObject.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 16 matching lines...) Expand all
27 #include "config.h" 27 #include "config.h"
28 #include "core/frame/FrameView.h" 28 #include "core/frame/FrameView.h"
29 29
30 #include "core/HTMLNames.h" 30 #include "core/HTMLNames.h"
31 #include "core/MediaTypeNames.h" 31 #include "core/MediaTypeNames.h"
32 #include "core/compositing/DisplayListCompositingBuilder.h" 32 #include "core/compositing/DisplayListCompositingBuilder.h"
33 #include "core/css/FontFaceSet.h" 33 #include "core/css/FontFaceSet.h"
34 #include "core/css/resolver/StyleResolver.h" 34 #include "core/css/resolver/StyleResolver.h"
35 #include "core/dom/AXObjectCache.h" 35 #include "core/dom/AXObjectCache.h"
36 #include "core/dom/Fullscreen.h" 36 #include "core/dom/Fullscreen.h"
37 #include "core/dom/IntersectionObserver.h"
37 #include "core/editing/EditingUtilities.h" 38 #include "core/editing/EditingUtilities.h"
38 #include "core/editing/FrameSelection.h" 39 #include "core/editing/FrameSelection.h"
39 #include "core/editing/RenderedPosition.h" 40 #include "core/editing/RenderedPosition.h"
40 #include "core/editing/markers/DocumentMarkerController.h" 41 #include "core/editing/markers/DocumentMarkerController.h"
41 #include "core/fetch/ResourceFetcher.h" 42 #include "core/fetch/ResourceFetcher.h"
42 #include "core/fetch/ResourceLoadPriorityOptimizer.h" 43 #include "core/fetch/ResourceLoadPriorityOptimizer.h"
43 #include "core/frame/FrameHost.h" 44 #include "core/frame/FrameHost.h"
44 #include "core/frame/LocalFrame.h" 45 #include "core/frame/LocalFrame.h"
45 #include "core/frame/Settings.h" 46 #include "core/frame/Settings.h"
46 #include "core/html/HTMLFrameElement.h" 47 #include "core/html/HTMLFrameElement.h"
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 1110
1110 #if ENABLE(ASSERT) 1111 #if ENABLE(ASSERT)
1111 layoutView()->assertSubtreeClearedPaintInvalidationState(); 1112 layoutView()->assertSubtreeClearedPaintInvalidationState();
1112 #endif 1113 #endif
1113 1114
1114 if (m_frame->selection().isCaretBoundsDirty()) 1115 if (m_frame->selection().isCaretBoundsDirty())
1115 m_frame->selection().invalidateCaretRect(); 1116 m_frame->selection().invalidateCaretRect();
1116 1117
1117 m_doFullPaintInvalidation = false; 1118 m_doFullPaintInvalidation = false;
1118 lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean); 1119 lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean);
1120
1121 if (RuntimeEnabledFeatures::intersectionObserverEnabled()) {
1122 computeIntersectionObservations(paintInvalidationState);
1123 }
1124 }
1125
1126 void FrameView::computeIntersectionObservations(PaintInvalidationState& paintInv alidationState)
1127 {
1128 ASSERT(layoutView());
1129 LayoutView& rootForPaintInvalidation = *layoutView();
1130
1131 if (FrameView* parent = parentFrameView()) {
liberato (no reviews please) 2015/09/04 15:07:46 how will you handle different containing views ("v
MikeB 2015/09/04 17:59:33 I think viewportModifierLength is being dropped. I
1132 m_clippedBounds = IntRect(frameRect().location(), paintInvalidationState .clipRect().pixelSnappedSize());
1133 m_clippedBounds = parent->contentsToRootFrame(m_clippedBounds);
1134 m_clippedBounds.intersect(parent->contentsToRootFrame(parent->m_clippedB ounds));
1135 if (!m_clippedBounds.isEmpty()) {
1136 m_clippedBounds = rootFrameToContents(m_clippedBounds);
1137 }
1138 } else {
1139 m_clippedBounds = pixelSnappedIntRect(paintInvalidationState.clipRect()) ;
liberato (no reviews please) 2015/09/04 15:07:46 is this correct if one zooms? i believe so.
MikeB 2015/09/04 17:59:34 Good question. I can test!
1140 }
1141
1142 FloatRect viewport(m_clippedBounds);
1143 for (auto& obj : rootForPaintInvalidation.intersectionObserverTargets()) {
liberato (no reviews please) 2015/09/04 15:07:46 independently of the above comment about moving th
MikeB 2015/09/04 17:59:33 Fair point.
1144 Node* node = obj.key->node();
liberato (no reviews please) 2015/09/04 15:07:46 for clarity, "LayoutObject* layoutObect = obj.key"
1145 if (!node || !node->isElementNode())
1146 continue;
1147 FloatRect bounds = obj.key->absoluteBoundingBoxFloatRect();
1148 bounds.intersect(viewport);
1149 const FloatRect& oldBounds = obj.value;
1150 if (oldBounds == bounds)
1151 continue;
1152 obj.value = bounds;
1153 Element* element = toElement(node);
1154 Vector<FloatRect> quads;
1155 quads.append(bounds);
liberato (no reviews please) 2015/09/04 15:07:46 this brings up a question i had about the doc. i'
MikeB 2015/09/04 17:59:33 According to the guys who drafted that particular
1156 for (auto& observer : element->intersectionObservers()) {
1157 observer->enqueueIntersectionObserverEntry(IntersectionObserverEntry ::create(0, quads, viewport, element));
1158 }
1159 }
1119 } 1160 }
1120 1161
1121 DocumentLifecycle& FrameView::lifecycle() const 1162 DocumentLifecycle& FrameView::lifecycle() const
1122 { 1163 {
1123 return m_frame->document()->lifecycle(); 1164 return m_frame->document()->lifecycle();
1124 } 1165 }
1125 1166
1126 LayoutBox* FrameView::embeddedContentBox() const 1167 LayoutBox* FrameView::embeddedContentBox() const
1127 { 1168 {
1128 LayoutView* layoutView = this->layoutView(); 1169 LayoutView* layoutView = this->layoutView();
(...skipping 2834 matching lines...) Expand 10 before | Expand all | Expand 10 after
3963 4004
3964 if (!graphicsLayer) 4005 if (!graphicsLayer)
3965 return; 4006 return;
3966 4007
3967 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL ayoutObject(), paintInvalidationContainer, viewRect); 4008 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL ayoutObject(), paintInvalidationContainer, viewRect);
3968 4009
3969 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing IntRect(viewRect))); 4010 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing IntRect(viewRect)));
3970 } 4011 }
3971 4012
3972 } // namespace blink 4013 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/layout/LayoutObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698