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

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: Created 5 years, 7 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/HitTestResult.h"
28 #include "core/layout/LayoutBlockFlow.h" 29 #include "core/layout/LayoutBlockFlow.h"
29 #include "core/layout/LayoutState.h" 30 #include "core/layout/LayoutState.h"
30 #include "core/layout/PaintInvalidationState.h" 31 #include "core/layout/PaintInvalidationState.h"
31 #include "core/layout/PendingSelection.h" 32 #include "core/layout/PendingSelection.h"
32 #include "platform/PODFreeListArena.h" 33 #include "platform/PODFreeListArena.h"
33 #include "platform/RuntimeEnabledFeatures.h" 34 #include "platform/RuntimeEnabledFeatures.h"
34 #include "platform/heap/Handle.h" 35 #include "platform/heap/Handle.h"
35 #include "platform/scroll/ScrollableArea.h" 36 #include "platform/scroll/ScrollableArea.h"
36 #include "wtf/OwnPtr.h" 37 #include "wtf/OwnPtr.h"
37 38
38 namespace blink { 39 namespace blink {
39 40
40 class DeprecatedPaintLayerCompositor; 41 class DeprecatedPaintLayerCompositor;
41 class LayoutQuote; 42 class LayoutQuote;
42 43
43 // The root of the layout tree, corresponding to the CSS initial containing bloc k. 44 // 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 45 // 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 ) 46 // 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). 47 // relative to the document (and so isn't necessarily in view).
47 class CORE_EXPORT LayoutView final : public LayoutBlockFlow { 48 class CORE_EXPORT LayoutView final : public LayoutBlockFlow {
48 public: 49 public:
49 explicit LayoutView(Document*); 50 explicit LayoutView(Document*);
50 virtual ~LayoutView(); 51 virtual ~LayoutView();
51 void willBeDestroyed() override; 52 void willBeDestroyed() override;
52 53
53 bool hitTest(HitTestResult&); 54 bool hitTest(HitTestResult&);
54 bool hitTest(const HitTestRequest&, const HitTestLocation&, HitTestResult&);
55 55
56 // Returns the total count of calls to HitTest, for testing. 56 // Returns the total count of calls to HitTest, for testing.
57 unsigned hitTestCount() const { return m_hitTestCount; } 57 unsigned hitTestCount() const { return m_hitTestCount; }
58 58
59 void clearHitTestCache();
60
59 virtual const char* name() const override { return "LayoutView"; } 61 virtual const char* name() const override { return "LayoutView"; }
60 62
61 virtual bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectLayoutView || LayoutBlockFlow::isOfType(type); } 63 virtual bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectLayoutView || LayoutBlockFlow::isOfType(type); }
62 64
63 virtual DeprecatedPaintLayerType layerTypeRequired() const override { return NormalDeprecatedPaintLayer; } 65 virtual DeprecatedPaintLayerType layerTypeRequired() const override { return NormalDeprecatedPaintLayer; }
64 66
65 virtual bool isChildAllowed(LayoutObject*, const ComputedStyle&) const overr ide; 67 virtual bool isChildAllowed(LayoutObject*, const ComputedStyle&) const overr ide;
66 68
67 virtual void layout() override; 69 virtual void layout() override;
68 virtual void updateLogicalWidth() override; 70 virtual void updateLogicalWidth() override;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedO ffset) const override; 118 virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedO ffset) const override;
117 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const overrid e; 119 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const overrid e;
118 120
119 virtual LayoutRect viewRect() const override; 121 virtual LayoutRect viewRect() const override;
120 122
121 bool shouldDoFullPaintInvalidationForNextLayout() const; 123 bool shouldDoFullPaintInvalidationForNextLayout() const;
122 bool doingFullPaintInvalidation() const { return m_frameView->needsFullPaint Invalidation(); } 124 bool doingFullPaintInvalidation() const { return m_frameView->needsFullPaint Invalidation(); }
123 125
124 LayoutState* layoutState() const { return m_layoutState; } 126 LayoutState* layoutState() const { return m_layoutState; }
125 127
126 virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&) overrid e; 128 virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&, const L ayoutRect&) override;
127 129
128 LayoutUnit pageLogicalHeight() const { return m_pageLogicalHeight; } 130 LayoutUnit pageLogicalHeight() const { return m_pageLogicalHeight; }
129 void setPageLogicalHeight(LayoutUnit height) 131 void setPageLogicalHeight(LayoutUnit height)
130 { 132 {
131 if (m_pageLogicalHeight != height) { 133 if (m_pageLogicalHeight != height) {
132 m_pageLogicalHeight = height; 134 m_pageLogicalHeight = height;
133 m_pageLogicalHeightChanged = true; 135 m_pageLogicalHeightChanged = true;
134 } 136 }
135 } 137 }
136 bool pageLogicalHeightChanged() const { return m_pageLogicalHeightChanged; } 138 bool pageLogicalHeightChanged() const { return m_pageLogicalHeightChanged; }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 LayoutUnit m_pageLogicalHeight; 201 LayoutUnit m_pageLogicalHeight;
200 bool m_pageLogicalHeightChanged; 202 bool m_pageLogicalHeightChanged;
201 LayoutState* m_layoutState; 203 LayoutState* m_layoutState;
202 OwnPtr<DeprecatedPaintLayerCompositor> m_compositor; 204 OwnPtr<DeprecatedPaintLayerCompositor> m_compositor;
203 RefPtr<IntervalArena> m_intervalArena; 205 RefPtr<IntervalArena> m_intervalArena;
204 206
205 LayoutQuote* m_layoutQuoteHead; 207 LayoutQuote* m_layoutQuoteHead;
206 unsigned m_layoutCounterCount; 208 unsigned m_layoutCounterCount;
207 209
208 unsigned m_hitTestCount; 210 unsigned m_hitTestCount;
211 unsigned m_hitTestCacheHits;
212 HitTestResult m_hitTestCacheResult;
213 int m_hitTestCacheLayoutCount;
209 214
210 OwnPtrWillBePersistent<PendingSelection> m_pendingSelection; 215 OwnPtrWillBePersistent<PendingSelection> m_pendingSelection;
211 }; 216 };
212 217
213 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutView, isLayoutView()); 218 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutView, isLayoutView());
214 219
215 // Suspends the LayoutState cached offset and clipRect optimization. Used under transforms 220 // Suspends the LayoutState cached offset and clipRect optimization. Used under transforms
216 // that cannot be represented by LayoutState (common in SVG) and when manipulati ng the layout 221 // that cannot be represented by LayoutState (common in SVG) and when manipulati ng the layout
217 // tree during layout in ways that can trigger paint invalidation of a non-child (e.g. when a list item 222 // tree during layout in ways that can trigger paint invalidation of a non-child (e.g. when a list item
218 // moves its list marker around). Note that even when disabled, LayoutState is s till used to 223 // moves its list marker around). Note that even when disabled, LayoutState is s till used to
(...skipping 15 matching lines...) Expand all
234 m_paintInvalidationState->m_cachedOffsetsEnabled = true; 239 m_paintInvalidationState->m_cachedOffsetsEnabled = true;
235 } 240 }
236 private: 241 private:
237 const PaintInvalidationState* m_paintInvalidationState; 242 const PaintInvalidationState* m_paintInvalidationState;
238 bool m_didDisable; 243 bool m_didDisable;
239 }; 244 };
240 245
241 } // namespace blink 246 } // namespace blink
242 247
243 #endif // LayoutView_h 248 #endif // LayoutView_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698