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

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

Issue 1142283004: Implement a Hit Test Cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove stray file Created 5 years, 6 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,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 * 19 *
20 */ 20 */
21 21
22 #ifndef LayoutView_h 22 #ifndef LayoutView_h
23 #define LayoutView_h 23 #define LayoutView_h
24 24
25 #include "core/CoreExport.h" 25 #include "core/CoreExport.h"
26 #include "core/dom/Position.h" 26 #include "core/dom/Position.h"
27 #include "core/frame/FrameView.h" 27 #include "core/frame/FrameView.h"
28 #include "core/layout/HitTestCache.h"
29 #include "core/layout/HitTestResult.h"
28 #include "core/layout/LayoutBlockFlow.h" 30 #include "core/layout/LayoutBlockFlow.h"
29 #include "core/layout/LayoutState.h" 31 #include "core/layout/LayoutState.h"
30 #include "core/layout/PaintInvalidationState.h" 32 #include "core/layout/PaintInvalidationState.h"
31 #include "core/layout/PendingSelection.h" 33 #include "core/layout/PendingSelection.h"
32 #include "platform/PODFreeListArena.h" 34 #include "platform/PODFreeListArena.h"
33 #include "platform/RuntimeEnabledFeatures.h" 35 #include "platform/RuntimeEnabledFeatures.h"
34 #include "platform/heap/Handle.h" 36 #include "platform/heap/Handle.h"
35 #include "platform/scroll/ScrollableArea.h" 37 #include "platform/scroll/ScrollableArea.h"
36 #include "wtf/OwnPtr.h" 38 #include "wtf/OwnPtr.h"
37 39
38 namespace blink { 40 namespace blink {
39 41
40 class DeprecatedPaintLayerCompositor; 42 class DeprecatedPaintLayerCompositor;
41 class LayoutQuote; 43 class LayoutQuote;
42 44
43 // 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.
44 // 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
45 // 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 )
46 // relative to the document (and so isn't necessarily in view). 48 // relative to the document (and so isn't necessarily in view).
47 class CORE_EXPORT LayoutView final : public LayoutBlockFlow { 49 class CORE_EXPORT LayoutView final : public LayoutBlockFlow {
48 public: 50 public:
49 explicit LayoutView(Document*); 51 explicit LayoutView(Document*);
50 virtual ~LayoutView(); 52 virtual ~LayoutView();
51 void willBeDestroyed() override; 53 void willBeDestroyed() override;
52 54
53 bool hitTest(HitTestResult&); 55 bool hitTest(HitTestResult&);
54 bool hitTest(const HitTestRequest&, const HitTestLocation&, HitTestResult&);
55 56
56 // Returns the total count of calls to HitTest, for testing. 57 // Returns the total count of calls to HitTest, for testing.
57 unsigned hitTestCount() const { return m_hitTestCount; } 58 unsigned hitTestCount() const { return m_hitTestCount; }
59 unsigned hitTestCacheHits() const { return m_hitTestCacheHits; }
60
61 void clearHitTestCache() { m_hitTestCache.clear(); }
58 62
59 virtual const char* name() const override { return "LayoutView"; } 63 virtual const char* name() const override { return "LayoutView"; }
60 64
61 virtual bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectLayoutView || LayoutBlockFlow::isOfType(type); } 65 virtual bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectLayoutView || LayoutBlockFlow::isOfType(type); }
62 66
63 virtual DeprecatedPaintLayerType layerTypeRequired() const override { return NormalDeprecatedPaintLayer; } 67 virtual DeprecatedPaintLayerType layerTypeRequired() const override { return NormalDeprecatedPaintLayer; }
64 68
65 virtual bool isChildAllowed(LayoutObject*, const ComputedStyle&) const overr ide; 69 virtual bool isChildAllowed(LayoutObject*, const ComputedStyle&) const overr ide;
66 70
67 virtual void layout() override; 71 virtual void layout() override;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 LayoutUnit m_pageLogicalHeight; 208 LayoutUnit m_pageLogicalHeight;
205 bool m_pageLogicalHeightChanged; 209 bool m_pageLogicalHeightChanged;
206 LayoutState* m_layoutState; 210 LayoutState* m_layoutState;
207 OwnPtr<DeprecatedPaintLayerCompositor> m_compositor; 211 OwnPtr<DeprecatedPaintLayerCompositor> m_compositor;
208 RefPtr<IntervalArena> m_intervalArena; 212 RefPtr<IntervalArena> m_intervalArena;
209 213
210 LayoutQuote* m_layoutQuoteHead; 214 LayoutQuote* m_layoutQuoteHead;
211 unsigned m_layoutCounterCount; 215 unsigned m_layoutCounterCount;
212 216
213 unsigned m_hitTestCount; 217 unsigned m_hitTestCount;
218 unsigned m_hitTestCacheHits;
219 HitTestCache m_hitTestCache;
sof 2015/06/09 18:59:18 Oilpan-wise, to make this work on LayoutView, it n
dtapuska 2015/06/09 19:39:15 In the posted version: The pointers inside the Hit
214 220
215 OwnPtrWillBePersistent<PendingSelection> m_pendingSelection; 221 OwnPtrWillBePersistent<PendingSelection> m_pendingSelection;
216 }; 222 };
217 223
218 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutView, isLayoutView()); 224 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutView, isLayoutView());
219 225
220 // Suspends the LayoutState cached offset and clipRect optimization. Used under transforms 226 // Suspends the LayoutState cached offset and clipRect optimization. Used under transforms
221 // that cannot be represented by LayoutState (common in SVG) and when manipulati ng the layout 227 // that cannot be represented by LayoutState (common in SVG) and when manipulati ng the layout
222 // tree during layout in ways that can trigger paint invalidation of a non-child (e.g. when a list item 228 // tree during layout in ways that can trigger paint invalidation of a non-child (e.g. when a list item
223 // moves its list marker around). Note that even when disabled, LayoutState is s till used to 229 // moves its list marker around). Note that even when disabled, LayoutState is s till used to
(...skipping 15 matching lines...) Expand all
239 m_paintInvalidationState->m_cachedOffsetsEnabled = true; 245 m_paintInvalidationState->m_cachedOffsetsEnabled = true;
240 } 246 }
241 private: 247 private:
242 const PaintInvalidationState* m_paintInvalidationState; 248 const PaintInvalidationState* m_paintInvalidationState;
243 bool m_didDisable; 249 bool m_didDisable;
244 }; 250 };
245 251
246 } // namespace blink 252 } // namespace blink
247 253
248 #endif // LayoutView_h 254 #endif // LayoutView_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698