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

Side by Side Diff: Source/core/layout/LayoutView.h

Issue 1329853004: Include viewport visibility checks for autoplay experiment. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@autoplay_step1
Patch Set: rebased. 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2006 Apple Computer, Inc. 3 * Copyright (C) 2006 Apple Computer, Inc.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 22 matching lines...) Expand all
33 #include "platform/PODFreeListArena.h" 33 #include "platform/PODFreeListArena.h"
34 #include "platform/RuntimeEnabledFeatures.h" 34 #include "platform/RuntimeEnabledFeatures.h"
35 #include "platform/heap/Handle.h" 35 #include "platform/heap/Handle.h"
36 #include "platform/scroll/ScrollableArea.h" 36 #include "platform/scroll/ScrollableArea.h"
37 #include "wtf/OwnPtr.h" 37 #include "wtf/OwnPtr.h"
38 38
39 namespace blink { 39 namespace blink {
40 40
41 class DeprecatedPaintLayerCompositor; 41 class DeprecatedPaintLayerCompositor;
42 class LayoutQuote; 42 class LayoutQuote;
43 class LayoutMedia;
43 44
44 // The root of the layout tree, corresponding to the CSS initial containing bloc k. 45 // The root of the layout tree, corresponding to the CSS initial containing bloc k.
45 // It's dimensions match that of the logical viewport (which may be different fr om 46 // It's dimensions match that of the logical viewport (which may be different fr om
46 // the visible viewport in fixed-layout mode), and it is always at position (0,0 ) 47 // the visible viewport in fixed-layout mode), and it is always at position (0,0 )
47 // relative to the document (and so isn't necessarily in view). 48 // relative to the document (and so isn't necessarily in view).
48 class CORE_EXPORT LayoutView final : public LayoutBlockFlow { 49 class CORE_EXPORT LayoutView final : public LayoutBlockFlow {
49 public: 50 public:
50 explicit LayoutView(Document*); 51 explicit LayoutView(Document*);
51 ~LayoutView() override; 52 ~LayoutView() override;
52 void willBeDestroyed() override; 53 void willBeDestroyed() override;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 void pushLayoutState(LayoutState& layoutState) { m_layoutState = &layoutStat e; } 180 void pushLayoutState(LayoutState& layoutState) { m_layoutState = &layoutStat e; }
180 void popLayoutState() { ASSERT(m_layoutState); m_layoutState = m_layoutState ->next(); } 181 void popLayoutState() { ASSERT(m_layoutState); m_layoutState = m_layoutState ->next(); }
181 void invalidateTreeIfNeeded(PaintInvalidationState&) final; 182 void invalidateTreeIfNeeded(PaintInvalidationState&) final;
182 183
183 LayoutRect visualOverflowRect() const override; 184 LayoutRect visualOverflowRect() const override;
184 185
185 // Invalidates paint for the entire view, including composited descendants, but not including child frames. 186 // Invalidates paint for the entire view, including composited descendants, but not including child frames.
186 // It is very likely you do not want to call this method. 187 // It is very likely you do not want to call this method.
187 void setShouldDoFullPaintInvalidationForViewAndAllDescendants(); 188 void setShouldDoFullPaintInvalidationForViewAndAllDescendants();
188 189
190 // Some LayoutMedias want to know about their viewport visibility for
191 // crbug.com/487345,402044 . This facility will be removed once those
192 // experiments complete.
193 void registerMediaForPositionChangeNotification(LayoutMedia*);
194 void unregisterMediaForPositionChangeNotification(LayoutMedia*);
195 // Notify all registered LayoutMedias that their position on-screen might
196 // have changed.
197 void sendMediaPositionChangeNotifications();
198
189 private: 199 private:
190 void mapLocalToContainer(const LayoutBoxModelObject* paintInvalidationContai ner, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed = nullptr, const PaintInvalidationState* = nullptr) const override; 200 void mapLocalToContainer(const LayoutBoxModelObject* paintInvalidationContai ner, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed = nullptr, const PaintInvalidationState* = nullptr) const override;
191 201
192 const LayoutObject* pushMappingToContainer(const LayoutBoxModelObject* ances torToStopAt, LayoutGeometryMap&) const override; 202 const LayoutObject* pushMappingToContainer(const LayoutBoxModelObject* ances torToStopAt, LayoutGeometryMap&) const override;
193 void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) const ove rride; 203 void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) const ove rride;
194 void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOf fset) const override; 204 void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOf fset) const override;
195 205
196 void layoutContent(); 206 void layoutContent();
197 #if ENABLE(ASSERT) 207 #if ENABLE(ASSERT)
198 void checkLayoutState(); 208 void checkLayoutState();
(...skipping 20 matching lines...) Expand all
219 LayoutState* m_layoutState; 229 LayoutState* m_layoutState;
220 OwnPtr<DeprecatedPaintLayerCompositor> m_compositor; 230 OwnPtr<DeprecatedPaintLayerCompositor> m_compositor;
221 RefPtr<IntervalArena> m_intervalArena; 231 RefPtr<IntervalArena> m_intervalArena;
222 232
223 LayoutQuote* m_layoutQuoteHead; 233 LayoutQuote* m_layoutQuoteHead;
224 unsigned m_layoutCounterCount; 234 unsigned m_layoutCounterCount;
225 235
226 unsigned m_hitTestCount; 236 unsigned m_hitTestCount;
227 unsigned m_hitTestCacheHits; 237 unsigned m_hitTestCacheHits;
228 OwnPtrWillBePersistent<HitTestCache> m_hitTestCache; 238 OwnPtrWillBePersistent<HitTestCache> m_hitTestCache;
239
240 Vector<LayoutMedia*> m_mediaForPositionNotification;
229 }; 241 };
230 242
231 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutView, isLayoutView()); 243 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutView, isLayoutView());
232 244
233 // Suspends the PaintInvalidationState cached offset and clipRect optimization. Used under transforms 245 // Suspends the PaintInvalidationState cached offset and clipRect optimization. Used under transforms
234 // that cannot be represented by PaintInvalidationState (common in SVG) and when paint invalidation 246 // that cannot be represented by PaintInvalidationState (common in SVG) and when paint invalidation
235 // containers don't follow the common tree-walk algorithm (e.g. when an absolute positioned descendant 247 // containers don't follow the common tree-walk algorithm (e.g. when an absolute positioned descendant
236 // is nested under a relatively positioned inline-block child). 248 // is nested under a relatively positioned inline-block child).
237 class ForceHorriblySlowRectMapping { 249 class ForceHorriblySlowRectMapping {
238 STACK_ALLOCATED(); 250 STACK_ALLOCATED();
(...skipping 13 matching lines...) Expand all
252 m_paintInvalidationState->m_cachedOffsetsEnabled = true; 264 m_paintInvalidationState->m_cachedOffsetsEnabled = true;
253 } 265 }
254 private: 266 private:
255 const PaintInvalidationState* m_paintInvalidationState; 267 const PaintInvalidationState* m_paintInvalidationState;
256 bool m_didDisable; 268 bool m_didDisable;
257 }; 269 };
258 270
259 } // namespace blink 271 } // namespace blink
260 272
261 #endif // LayoutView_h 273 #endif // LayoutView_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698