| 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 26 matching lines...) Expand all Loading... |
| 37 #include "core/layout/LayoutScrollbarPart.h" | 37 #include "core/layout/LayoutScrollbarPart.h" |
| 38 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" | 38 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" |
| 39 #include "core/page/Page.h" | 39 #include "core/page/Page.h" |
| 40 #include "core/paint/DeprecatedPaintLayer.h" | 40 #include "core/paint/DeprecatedPaintLayer.h" |
| 41 #include "core/paint/ViewPainter.h" | 41 #include "core/paint/ViewPainter.h" |
| 42 #include "core/svg/SVGDocumentExtensions.h" | 42 #include "core/svg/SVGDocumentExtensions.h" |
| 43 #include "platform/TraceEvent.h" | 43 #include "platform/TraceEvent.h" |
| 44 #include "platform/TracedValue.h" | 44 #include "platform/TracedValue.h" |
| 45 #include "platform/geometry/FloatQuad.h" | 45 #include "platform/geometry/FloatQuad.h" |
| 46 #include "platform/geometry/TransformState.h" | 46 #include "platform/geometry/TransformState.h" |
| 47 #include "platform/graphics/GraphicsLayer.h" | |
| 48 #include "platform/graphics/paint/DisplayItemList.h" | 47 #include "platform/graphics/paint/DisplayItemList.h" |
| 49 #include <inttypes.h> | 48 #include <inttypes.h> |
| 50 | 49 |
| 51 namespace blink { | 50 namespace blink { |
| 52 | 51 |
| 53 LayoutView::LayoutView(Document* document) | 52 LayoutView::LayoutView(Document* document) |
| 54 : LayoutBlockFlow(document) | 53 : LayoutBlockFlow(document) |
| 55 , m_frameView(document->view()) | 54 , m_frameView(document->view()) |
| 56 , m_selectionStart(nullptr) | 55 , m_selectionStart(nullptr) |
| 57 , m_selectionEnd(nullptr) | 56 , m_selectionEnd(nullptr) |
| 58 , m_selectionStartPos(-1) | 57 , m_selectionStartPos(-1) |
| 59 , m_selectionEndPos(-1) | 58 , m_selectionEndPos(-1) |
| 60 , m_pageLogicalHeight(0) | 59 , m_pageLogicalHeight(0) |
| 61 , m_pageLogicalHeightChanged(false) | 60 , m_pageLogicalHeightChanged(false) |
| 62 , m_layoutState(nullptr) | 61 , m_layoutState(nullptr) |
| 63 , m_layoutQuoteHead(nullptr) | 62 , m_layoutQuoteHead(nullptr) |
| 64 , m_layoutCounterCount(0) | 63 , m_layoutCounterCount(0) |
| 65 , m_hitTestCount(0) | 64 , m_hitTestCount(0) |
| 66 , m_hitTestCacheHits(0) | |
| 67 , m_pendingSelection(PendingSelection::create()) | 65 , m_pendingSelection(PendingSelection::create()) |
| 68 { | 66 { |
| 69 // init LayoutObject attributes | 67 // init LayoutObject attributes |
| 70 setInline(false); | 68 setInline(false); |
| 71 | 69 |
| 72 m_minPreferredLogicalWidth = 0; | 70 m_minPreferredLogicalWidth = 0; |
| 73 m_maxPreferredLogicalWidth = 0; | 71 m_maxPreferredLogicalWidth = 0; |
| 74 | 72 |
| 75 setPreferredLogicalWidthsDirty(MarkOnlyThis); | 73 setPreferredLogicalWidthsDirty(MarkOnlyThis); |
| 76 | 74 |
| 77 setPositionState(AbsolutePosition); // to 0,0 :) | 75 setPositionState(AbsolutePosition); // to 0,0 :) |
| 78 } | 76 } |
| 79 | 77 |
| 80 LayoutView::~LayoutView() | 78 LayoutView::~LayoutView() |
| 81 { | 79 { |
| 82 } | 80 } |
| 83 | 81 |
| 84 bool LayoutView::hitTest(HitTestResult& result) | 82 bool LayoutView::hitTest(HitTestResult& result) |
| 85 { | 83 { |
| 84 return hitTest(result.hitTestRequest(), result.hitTestLocation(), result); |
| 85 } |
| 86 |
| 87 bool LayoutView::hitTest(const HitTestRequest& request, const HitTestLocation& l
ocation, HitTestResult& result) |
| 88 { |
| 86 TRACE_EVENT_BEGIN0("blink,devtools.timeline", "HitTest"); | 89 TRACE_EVENT_BEGIN0("blink,devtools.timeline", "HitTest"); |
| 87 m_hitTestCount++; | 90 m_hitTestCount++; |
| 88 | 91 |
| 89 ASSERT(!result.hitTestLocation().isRectBasedTest() || result.hitTestRequest(
).listBased()); | 92 ASSERT(!location.isRectBasedTest() || request.listBased()); |
| 90 | 93 |
| 91 // We have to recursively update layout/style here because otherwise, when t
he hit test recurses | 94 // 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 | 95 // 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. | 96 // that are higher up in the call stack, leading to crashes. |
| 94 // Note that Document::updateLayout calls its parent's updateLayout. | 97 // 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. | 98 // FIXME: It should be the caller's responsibility to ensure an up-to-date l
ayout. |
| 96 frameView()->updateLayoutAndStyleForPainting(); | 99 frameView()->updateLayoutAndStyleForPainting(); |
| 97 commitPendingSelection(); | 100 commitPendingSelection(); |
| 98 | 101 |
| 99 uint64_t domTreeVersion = document().domTreeVersion(); | 102 bool hitLayer = layer()->hitTest(request, location, result); |
| 100 HitTestResult cacheResult = result; | |
| 101 bool cacheHit = m_hitTestCache.lookupCachedResult(cacheResult, domTreeVersio
n); | |
| 102 bool hitLayer = layer()->hitTest(result); | |
| 103 | 103 |
| 104 // FrameView scrollbars are not the same as Layer scrollbars tested by Layer
::hitTestOverflowControls, | 104 // 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 | 105 // 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. | 106 // 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()); | 107 IntPoint framePoint = frameView()->contentsToFrame(location.roundedPoint()); |
| 108 if (Scrollbar* frameScrollbar = frameView()->scrollbarAtFramePoint(framePoin
t)) | 108 if (Scrollbar* frameScrollbar = frameView()->scrollbarAtFramePoint(framePoin
t)) |
| 109 result.setScrollbar(frameScrollbar); | 109 result.setScrollbar(frameScrollbar); |
| 110 | 110 |
| 111 if (cacheHit) { | 111 TRACE_EVENT_END1("blink,devtools.timeline", "HitTest", "endData", InspectorH
itTestEvent::endData(request, location, result)); |
| 112 m_hitTestCacheHits++; | |
| 113 m_hitTestCache.verifyCachedResult(result, cacheResult); | |
| 114 } | |
| 115 | |
| 116 if (hitLayer) { | |
| 117 m_hitTestCache.addCachedResult(result, domTreeVersion); | |
| 118 | |
| 119 if (layer()->graphicsLayerBacking()) { | |
| 120 layer()->graphicsLayerBacking()->platformLayer()->setHitTestCacheRec
t(enclosingIntRect(result.validityRect())); | |
| 121 } | |
| 122 } | |
| 123 | |
| 124 TRACE_EVENT_END1("blink,devtools.timeline", "HitTest", "endData", InspectorH
itTestEvent::endData(result.hitTestRequest(), result.hitTestLocation(), result))
; | |
| 125 return hitLayer; | 112 return hitLayer; |
| 126 } | 113 } |
| 127 | 114 |
| 128 void LayoutView::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit, Logi
calExtentComputedValues& computedValues) const | 115 void LayoutView::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit, Logi
calExtentComputedValues& computedValues) const |
| 129 { | 116 { |
| 130 computedValues.m_extent = (!shouldUsePrintingLayout() && m_frameView) ? Layo
utUnit(viewLogicalHeightForBoxSizing()) : logicalHeight; | 117 computedValues.m_extent = (!shouldUsePrintingLayout() && m_frameView) ? Layo
utUnit(viewLogicalHeightForBoxSizing()) : logicalHeight; |
| 131 } | 118 } |
| 132 | 119 |
| 133 void LayoutView::updateLogicalWidth() | 120 void LayoutView::updateLogicalWidth() |
| 134 { | 121 { |
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 return viewHeight(IncludeScrollbars) / scale; | 950 return viewHeight(IncludeScrollbars) / scale; |
| 964 } | 951 } |
| 965 | 952 |
| 966 void LayoutView::willBeDestroyed() | 953 void LayoutView::willBeDestroyed() |
| 967 { | 954 { |
| 968 LayoutBlockFlow::willBeDestroyed(); | 955 LayoutBlockFlow::willBeDestroyed(); |
| 969 m_compositor.clear(); | 956 m_compositor.clear(); |
| 970 } | 957 } |
| 971 | 958 |
| 972 } // namespace blink | 959 } // namespace blink |
| OLD | NEW |