OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 #include "core/page/scrolling/ScrollingCoordinator.h" | 80 #include "core/page/scrolling/ScrollingCoordinator.h" |
81 #include "core/paint/FramePainter.h" | 81 #include "core/paint/FramePainter.h" |
82 #include "core/paint/PaintLayer.h" | 82 #include "core/paint/PaintLayer.h" |
83 #include "core/paint/PrePaintTreeWalk.h" | 83 #include "core/paint/PrePaintTreeWalk.h" |
84 #include "core/plugins/PluginView.h" | 84 #include "core/plugins/PluginView.h" |
85 #include "core/style/ComputedStyle.h" | 85 #include "core/style/ComputedStyle.h" |
86 #include "core/svg/SVGDocumentExtensions.h" | 86 #include "core/svg/SVGDocumentExtensions.h" |
87 #include "core/svg/SVGSVGElement.h" | 87 #include "core/svg/SVGSVGElement.h" |
88 #include "platform/Histogram.h" | 88 #include "platform/Histogram.h" |
89 #include "platform/HostWindow.h" | 89 #include "platform/HostWindow.h" |
90 #include "platform/JSONValues.h" | |
90 #include "platform/RuntimeEnabledFeatures.h" | 91 #include "platform/RuntimeEnabledFeatures.h" |
91 #include "platform/ScriptForbiddenScope.h" | 92 #include "platform/ScriptForbiddenScope.h" |
92 #include "platform/TraceEvent.h" | 93 #include "platform/TraceEvent.h" |
93 #include "platform/TracedValue.h" | 94 #include "platform/TracedValue.h" |
94 #include "platform/fonts/FontCache.h" | 95 #include "platform/fonts/FontCache.h" |
95 #include "platform/geometry/DoubleRect.h" | 96 #include "platform/geometry/DoubleRect.h" |
96 #include "platform/geometry/FloatRect.h" | 97 #include "platform/geometry/FloatRect.h" |
97 #include "platform/geometry/LayoutRect.h" | 98 #include "platform/geometry/LayoutRect.h" |
98 #include "platform/graphics/GraphicsContext.h" | 99 #include "platform/graphics/GraphicsContext.h" |
99 #include "platform/graphics/GraphicsLayer.h" | 100 #include "platform/graphics/GraphicsLayer.h" |
(...skipping 26 matching lines...) Expand all Loading... | |
126 , m_canHaveScrollbars(true) | 127 , m_canHaveScrollbars(true) |
127 , m_hasPendingLayout(false) | 128 , m_hasPendingLayout(false) |
128 , m_inSynchronousPostLayout(false) | 129 , m_inSynchronousPostLayout(false) |
129 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired) | 130 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired) |
130 , m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired) | 131 , m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired) |
131 , m_renderThrottlingObserverNotificationFactory(CancellableTaskFactory::crea te(this, &FrameView::notifyRenderThrottlingObservers)) | 132 , m_renderThrottlingObserverNotificationFactory(CancellableTaskFactory::crea te(this, &FrameView::notifyRenderThrottlingObservers)) |
132 , m_isTransparent(false) | 133 , m_isTransparent(false) |
133 , m_baseBackgroundColor(Color::white) | 134 , m_baseBackgroundColor(Color::white) |
134 , m_mediaType(MediaTypeNames::screen) | 135 , m_mediaType(MediaTypeNames::screen) |
135 , m_safeToPropagateScrollToParent(true) | 136 , m_safeToPropagateScrollToParent(true) |
136 , m_isTrackingPaintInvalidations(false) | |
137 , m_scrollCorner(nullptr) | 137 , m_scrollCorner(nullptr) |
138 , m_stickyPositionObjectCount(0) | 138 , m_stickyPositionObjectCount(0) |
139 , m_inputEventsScaleFactorForEmulation(1) | 139 , m_inputEventsScaleFactorForEmulation(1) |
140 , m_layoutSizeFixedToFrameSize(true) | 140 , m_layoutSizeFixedToFrameSize(true) |
141 , m_didScrollTimer(this, &FrameView::didScrollTimerFired) | 141 , m_didScrollTimer(this, &FrameView::didScrollTimerFired) |
142 , m_topControlsViewportAdjustment(0) | 142 , m_topControlsViewportAdjustment(0) |
143 , m_needsUpdateWidgetGeometries(false) | 143 , m_needsUpdateWidgetGeometries(false) |
144 , m_needsUpdateViewportIntersection(true) | 144 , m_needsUpdateViewportIntersection(true) |
145 , m_needsUpdateViewportIntersectionInSubtree(true) | 145 , m_needsUpdateViewportIntersectionInSubtree(true) |
146 #if ENABLE(ASSERT) | 146 #if ENABLE(ASSERT) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 m_layoutSchedulingEnabled = true; | 212 m_layoutSchedulingEnabled = true; |
213 m_inSynchronousPostLayout = false; | 213 m_inSynchronousPostLayout = false; |
214 m_layoutCount = 0; | 214 m_layoutCount = 0; |
215 m_nestedLayoutCount = 0; | 215 m_nestedLayoutCount = 0; |
216 m_postLayoutTasksTimer.stop(); | 216 m_postLayoutTasksTimer.stop(); |
217 m_updateWidgetsTimer.stop(); | 217 m_updateWidgetsTimer.stop(); |
218 m_firstLayout = true; | 218 m_firstLayout = true; |
219 m_safeToPropagateScrollToParent = true; | 219 m_safeToPropagateScrollToParent = true; |
220 m_lastViewportSize = IntSize(); | 220 m_lastViewportSize = IntSize(); |
221 m_lastZoomFactor = 1.0f; | 221 m_lastZoomFactor = 1.0f; |
222 m_isTrackingPaintInvalidations = s_initialTrackAllPaintInvalidations; | 222 m_trackedObjectPaintInvalidations = adoptPtr(s_initialTrackAllPaintInvalidat ions ? new Vector<ObjectPaintInvalidation> : nullptr); |
223 m_visuallyNonEmptyCharacterCount = 0; | 223 m_visuallyNonEmptyCharacterCount = 0; |
224 m_visuallyNonEmptyPixelCount = 0; | 224 m_visuallyNonEmptyPixelCount = 0; |
225 m_isVisuallyNonEmpty = false; | 225 m_isVisuallyNonEmpty = false; |
226 clearFragmentAnchor(); | 226 clearFragmentAnchor(); |
227 m_viewportConstrainedObjects.reset(); | 227 m_viewportConstrainedObjects.reset(); |
228 m_layoutSubtreeRootList.clear(); | 228 m_layoutSubtreeRootList.clear(); |
229 m_orthogonalWritingModeRootList.clear(); | 229 m_orthogonalWritingModeRootList.clear(); |
230 } | 230 } |
231 | 231 |
232 // Call function for each non-throttled frame view in pre tree order. | 232 // Call function for each non-throttled frame view in pre tree order. |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
375 | 375 |
376 LayoutPart* layoutObject = m_frame->ownerLayoutObject(); | 376 LayoutPart* layoutObject = m_frame->ownerLayoutObject(); |
377 if (!layoutObject) | 377 if (!layoutObject) |
378 return; | 378 return; |
379 | 379 |
380 IntRect paintInvalidationRect = rect; | 380 IntRect paintInvalidationRect = rect; |
381 paintInvalidationRect.move(layoutObject->borderLeft() + layoutObject->paddin gLeft(), | 381 paintInvalidationRect.move(layoutObject->borderLeft() + layoutObject->paddin gLeft(), |
382 layoutObject->borderTop() + layoutObject->paddingTop()); | 382 layoutObject->borderTop() + layoutObject->paddingTop()); |
383 // FIXME: We should not allow paint invalidation out of paint invalidation s tate. crbug.com/457415 | 383 // FIXME: We should not allow paint invalidation out of paint invalidation s tate. crbug.com/457415 |
384 DisablePaintInvalidationStateAsserts paintInvalidationAssertDisabler; | 384 DisablePaintInvalidationStateAsserts paintInvalidationAssertDisabler; |
385 layoutObject->invalidatePaintRectangleNotInvalidatingDisplayItemClients(Layo utRect(paintInvalidationRect)); | 385 layoutObject->invalidatePaintRectangle(LayoutRect(paintInvalidationRect)); |
chrishtr
2016/06/17 07:06:49
Why is it ok to change this to start invalidating
Xianzhu
2016/06/17 18:39:31
It also was OK before but was avoided because inva
| |
386 } | 386 } |
387 | 387 |
388 void FrameView::setFrameRect(const IntRect& newRect) | 388 void FrameView::setFrameRect(const IntRect& newRect) |
389 { | 389 { |
390 IntRect oldRect = frameRect(); | 390 IntRect oldRect = frameRect(); |
391 if (newRect == oldRect) | 391 if (newRect == oldRect) |
392 return; | 392 return; |
393 | 393 |
394 Widget::setFrameRect(newRect); | 394 Widget::setFrameRect(newRect); |
395 | 395 |
(...skipping 2524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2920 return parentPoint; | 2920 return parentPoint; |
2921 } | 2921 } |
2922 | 2922 |
2923 void FrameView::setInitialTracksPaintInvalidationsForTesting(bool trackPaintInva lidations) | 2923 void FrameView::setInitialTracksPaintInvalidationsForTesting(bool trackPaintInva lidations) |
2924 { | 2924 { |
2925 s_initialTrackAllPaintInvalidations = trackPaintInvalidations; | 2925 s_initialTrackAllPaintInvalidations = trackPaintInvalidations; |
2926 } | 2926 } |
2927 | 2927 |
2928 void FrameView::setTracksPaintInvalidations(bool trackPaintInvalidations) | 2928 void FrameView::setTracksPaintInvalidations(bool trackPaintInvalidations) |
2929 { | 2929 { |
2930 if (trackPaintInvalidations == m_isTrackingPaintInvalidations) | 2930 if (trackPaintInvalidations == isTrackingPaintInvalidations()) |
2931 return; | 2931 return; |
2932 | 2932 |
2933 for (Frame* frame = m_frame->tree().top(); frame; frame = frame->tree().trav erseNext()) { | 2933 for (Frame* frame = m_frame->tree().top(); frame; frame = frame->tree().trav erseNext()) { |
2934 if (!frame->isLocalFrame()) | 2934 if (!frame->isLocalFrame()) |
2935 continue; | 2935 continue; |
2936 if (LayoutViewItem layoutView = toLocalFrame(frame)->contentLayoutItem() ) { | 2936 if (LayoutViewItem layoutView = toLocalFrame(frame)->contentLayoutItem() ) { |
2937 layoutView.frameView()->m_isTrackingPaintInvalidations = trackPaintI nvalidations; | 2937 layoutView.frameView()->m_trackedObjectPaintInvalidations = adoptPtr (trackPaintInvalidations ? new Vector<ObjectPaintInvalidation> : nullptr); |
2938 layoutView.compositor()->setTracksPaintInvalidations(trackPaintInval idations); | 2938 layoutView.compositor()->setTracksPaintInvalidations(trackPaintInval idations); |
2939 } | 2939 } |
2940 } | 2940 } |
2941 | 2941 |
2942 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), | 2942 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), |
2943 "FrameView::setTracksPaintInvalidations", TRACE_EVENT_SCOPE_GLOBAL, "ena bled", trackPaintInvalidations); | 2943 "FrameView::setTracksPaintInvalidations", TRACE_EVENT_SCOPE_GLOBAL, "ena bled", trackPaintInvalidations); |
2944 } | |
2944 | 2945 |
2945 m_isTrackingPaintInvalidations = trackPaintInvalidations; | 2946 void FrameView::trackObjectPaintInvalidation(const DisplayItemClient& client, Pa intInvalidationReason reason) |
2947 { | |
2948 if (!m_trackedObjectPaintInvalidations) | |
2949 return; | |
2950 | |
2951 ObjectPaintInvalidation invalidation = { client.debugName(), reason }; | |
2952 m_trackedObjectPaintInvalidations->append(invalidation); | |
2953 } | |
2954 | |
2955 PassRefPtr<JSONArray> FrameView::trackedObjectPaintInvalidationsAsJSON() const | |
2956 { | |
2957 if (!m_trackedObjectPaintInvalidations || m_trackedObjectPaintInvalidations- >isEmpty()) | |
2958 return nullptr; | |
2959 | |
2960 RefPtr<JSONArray> result = JSONArray::create(); | |
2961 for (const auto& item : *m_trackedObjectPaintInvalidations) { | |
2962 RefPtr<JSONObject> itemJSON = JSONObject::create(); | |
2963 itemJSON->setString("object", item.name); | |
2964 itemJSON->setString("reason", paintInvalidationReasonToString(item.reaso n)); | |
2965 result->pushObject(itemJSON); | |
2966 } | |
2967 return result; | |
2946 } | 2968 } |
2947 | 2969 |
2948 void FrameView::addResizerArea(LayoutBox& resizerBox) | 2970 void FrameView::addResizerArea(LayoutBox& resizerBox) |
2949 { | 2971 { |
2950 if (!m_resizerAreas) | 2972 if (!m_resizerAreas) |
2951 m_resizerAreas = adoptPtr(new ResizerAreaSet); | 2973 m_resizerAreas = adoptPtr(new ResizerAreaSet); |
2952 m_resizerAreas->add(&resizerBox); | 2974 m_resizerAreas->add(&resizerBox); |
2953 } | 2975 } |
2954 | 2976 |
2955 void FrameView::removeResizerArea(LayoutBox& resizerBox) | 2977 void FrameView::removeResizerArea(LayoutBox& resizerBox) |
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4144 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); | 4166 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); |
4145 } | 4167 } |
4146 | 4168 |
4147 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const | 4169 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const |
4148 { | 4170 { |
4149 ASSERT(!layoutViewItem().isNull()); | 4171 ASSERT(!layoutViewItem().isNull()); |
4150 return *layoutView(); | 4172 return *layoutView(); |
4151 } | 4173 } |
4152 | 4174 |
4153 } // namespace blink | 4175 } // namespace blink |
OLD | NEW |