OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 , m_selectionEnd(nullptr) | 57 , m_selectionEnd(nullptr) |
58 , m_selectionStartPos(-1) | 58 , m_selectionStartPos(-1) |
59 , m_selectionEndPos(-1) | 59 , m_selectionEndPos(-1) |
60 , m_pageLogicalHeight(0) | 60 , m_pageLogicalHeight(0) |
61 , m_pageLogicalHeightChanged(false) | 61 , m_pageLogicalHeightChanged(false) |
62 , m_layoutState(nullptr) | 62 , m_layoutState(nullptr) |
63 , m_layoutQuoteHead(nullptr) | 63 , m_layoutQuoteHead(nullptr) |
64 , m_layoutCounterCount(0) | 64 , m_layoutCounterCount(0) |
65 , m_hitTestCount(0) | 65 , m_hitTestCount(0) |
66 , m_hitTestCacheHits(0) | 66 , m_hitTestCacheHits(0) |
| 67 , m_hitTestCache(HitTestCache::create()) |
67 , m_pendingSelection(PendingSelection::create()) | 68 , m_pendingSelection(PendingSelection::create()) |
68 { | 69 { |
69 // init LayoutObject attributes | 70 // init LayoutObject attributes |
70 setInline(false); | 71 setInline(false); |
71 | 72 |
72 m_minPreferredLogicalWidth = 0; | 73 m_minPreferredLogicalWidth = 0; |
73 m_maxPreferredLogicalWidth = 0; | 74 m_maxPreferredLogicalWidth = 0; |
74 | 75 |
75 setPreferredLogicalWidthsDirty(MarkOnlyThis); | 76 setPreferredLogicalWidthsDirty(MarkOnlyThis); |
76 | 77 |
(...skipping 14 matching lines...) Expand all Loading... |
91 // We have to recursively update layout/style here because otherwise, when t
he hit test recurses | 92 // We have to recursively update layout/style here because otherwise, when t
he hit test recurses |
92 // into a child document, it could trigger a layout on the parent document,
which can destroy DeprecatedPaintLayer | 93 // into a child document, it could trigger a layout on the parent document,
which can destroy DeprecatedPaintLayer |
93 // that are higher up in the call stack, leading to crashes. | 94 // that are higher up in the call stack, leading to crashes. |
94 // Note that Document::updateLayout calls its parent's updateLayout. | 95 // Note that Document::updateLayout calls its parent's updateLayout. |
95 // FIXME: It should be the caller's responsibility to ensure an up-to-date l
ayout. | 96 // FIXME: It should be the caller's responsibility to ensure an up-to-date l
ayout. |
96 frameView()->updateLayoutAndStyleForPainting(); | 97 frameView()->updateLayoutAndStyleForPainting(); |
97 commitPendingSelection(); | 98 commitPendingSelection(); |
98 | 99 |
99 uint64_t domTreeVersion = document().domTreeVersion(); | 100 uint64_t domTreeVersion = document().domTreeVersion(); |
100 HitTestResult cacheResult = result; | 101 HitTestResult cacheResult = result; |
101 bool cacheHit = m_hitTestCache.lookupCachedResult(cacheResult, domTreeVersio
n); | 102 bool cacheHit = m_hitTestCache->lookupCachedResult(cacheResult, domTreeVersi
on); |
102 bool hitLayer = layer()->hitTest(result); | 103 bool hitLayer = layer()->hitTest(result); |
103 | 104 |
104 // FrameView scrollbars are not the same as Layer scrollbars tested by Layer
::hitTestOverflowControls, | 105 // FrameView scrollbars are not the same as Layer scrollbars tested by Layer
::hitTestOverflowControls, |
105 // so we need to test FrameView scrollbars separately here. Note that it's i
mportant we do this after | 106 // so we need to test FrameView scrollbars separately here. Note that it's i
mportant we do this after |
106 // the hit test above, because that may overwrite the entire HitTestResult w
hen it finds a hit. | 107 // the hit test above, because that may overwrite the entire HitTestResult w
hen it finds a hit. |
107 IntPoint framePoint = frameView()->contentsToFrame(result.hitTestLocation().
roundedPoint()); | 108 IntPoint framePoint = frameView()->contentsToFrame(result.hitTestLocation().
roundedPoint()); |
108 if (Scrollbar* frameScrollbar = frameView()->scrollbarAtFramePoint(framePoin
t)) | 109 if (Scrollbar* frameScrollbar = frameView()->scrollbarAtFramePoint(framePoin
t)) |
109 result.setScrollbar(frameScrollbar); | 110 result.setScrollbar(frameScrollbar); |
110 | 111 |
111 if (cacheHit) { | 112 if (cacheHit) { |
112 m_hitTestCacheHits++; | 113 m_hitTestCacheHits++; |
113 m_hitTestCache.verifyCachedResult(result, cacheResult); | 114 m_hitTestCache->verifyCachedResult(result, cacheResult); |
114 } | 115 } |
115 | 116 |
116 if (hitLayer) { | 117 if (hitLayer) { |
117 m_hitTestCache.addCachedResult(result, domTreeVersion); | 118 m_hitTestCache->addCachedResult(result, domTreeVersion); |
118 | 119 |
119 if (layer()->graphicsLayerBacking()) { | 120 if (layer()->graphicsLayerBacking()) { |
120 layer()->graphicsLayerBacking()->platformLayer()->setHitTestCacheRec
t(enclosingIntRect(result.validityRect())); | 121 layer()->graphicsLayerBacking()->platformLayer()->setHitTestCacheRec
t(enclosingIntRect(result.validityRect())); |
121 } | 122 } |
122 } | 123 } |
123 | 124 |
124 TRACE_EVENT_END1("blink,devtools.timeline", "HitTest", "endData", InspectorH
itTestEvent::endData(result.hitTestRequest(), result.hitTestLocation(), result))
; | 125 TRACE_EVENT_END1("blink,devtools.timeline", "HitTest", "endData", InspectorH
itTestEvent::endData(result.hitTestRequest(), result.hitTestLocation(), result))
; |
125 return hitLayer; | 126 return hitLayer; |
126 } | 127 } |
127 | 128 |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 return viewHeight(IncludeScrollbars) / scale; | 964 return viewHeight(IncludeScrollbars) / scale; |
964 } | 965 } |
965 | 966 |
966 void LayoutView::willBeDestroyed() | 967 void LayoutView::willBeDestroyed() |
967 { | 968 { |
968 LayoutBlockFlow::willBeDestroyed(); | 969 LayoutBlockFlow::willBeDestroyed(); |
969 m_compositor.clear(); | 970 m_compositor.clear(); |
970 } | 971 } |
971 | 972 |
972 } // namespace blink | 973 } // namespace blink |
OLD | NEW |