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

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 validity rect as per Elliott's request 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
« no previous file with comments | « Source/core/layout/LayoutPart.cpp ('k') | Source/core/layout/LayoutView.cpp » ('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) 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 LayoutUnit m_pageLogicalHeight; 210 LayoutUnit m_pageLogicalHeight;
207 bool m_pageLogicalHeightChanged; 211 bool m_pageLogicalHeightChanged;
208 LayoutState* m_layoutState; 212 LayoutState* m_layoutState;
209 OwnPtr<DeprecatedPaintLayerCompositor> m_compositor; 213 OwnPtr<DeprecatedPaintLayerCompositor> m_compositor;
210 RefPtr<IntervalArena> m_intervalArena; 214 RefPtr<IntervalArena> m_intervalArena;
211 215
212 LayoutQuote* m_layoutQuoteHead; 216 LayoutQuote* m_layoutQuoteHead;
213 unsigned m_layoutCounterCount; 217 unsigned m_layoutCounterCount;
214 218
215 unsigned m_hitTestCount; 219 unsigned m_hitTestCount;
220 unsigned m_hitTestCacheHits;
221 OwnPtrWillBePersistent<HitTestCache> m_hitTestCache;
216 222
217 OwnPtrWillBePersistent<PendingSelection> m_pendingSelection; 223 OwnPtrWillBePersistent<PendingSelection> m_pendingSelection;
218 }; 224 };
219 225
220 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutView, isLayoutView()); 226 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutView, isLayoutView());
221 227
222 // Suspends the LayoutState cached offset and clipRect optimization. Used under transforms 228 // Suspends the LayoutState cached offset and clipRect optimization. Used under transforms
223 // that cannot be represented by LayoutState (common in SVG) and when manipulati ng the layout 229 // that cannot be represented by LayoutState (common in SVG) and when manipulati ng the layout
224 // tree during layout in ways that can trigger paint invalidation of a non-child (e.g. when a list item 230 // tree during layout in ways that can trigger paint invalidation of a non-child (e.g. when a list item
225 // moves its list marker around). Note that even when disabled, LayoutState is s till used to 231 // moves its list marker around). Note that even when disabled, LayoutState is s till used to
(...skipping 15 matching lines...) Expand all
241 m_paintInvalidationState->m_cachedOffsetsEnabled = true; 247 m_paintInvalidationState->m_cachedOffsetsEnabled = true;
242 } 248 }
243 private: 249 private:
244 const PaintInvalidationState* m_paintInvalidationState; 250 const PaintInvalidationState* m_paintInvalidationState;
245 bool m_didDisable; 251 bool m_didDisable;
246 }; 252 };
247 253
248 } // namespace blink 254 } // namespace blink
249 255
250 #endif // LayoutView_h 256 #endif // LayoutView_h
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutPart.cpp ('k') | Source/core/layout/LayoutView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698