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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 #include "platform/graphics/GraphicsLayerDebugInfo.h" | 101 #include "platform/graphics/GraphicsLayerDebugInfo.h" |
102 #include "platform/graphics/paint/CullRect.h" | 102 #include "platform/graphics/paint/CullRect.h" |
103 #include "platform/graphics/paint/PaintController.h" | 103 #include "platform/graphics/paint/PaintController.h" |
104 #include "platform/scheduler/CancellableTaskFactory.h" | 104 #include "platform/scheduler/CancellableTaskFactory.h" |
105 #include "platform/scroll/ScrollAnimatorBase.h" | 105 #include "platform/scroll/ScrollAnimatorBase.h" |
106 #include "platform/scroll/ScrollbarTheme.h" | 106 #include "platform/scroll/ScrollbarTheme.h" |
107 #include "platform/text/TextStream.h" | 107 #include "platform/text/TextStream.h" |
108 #include "public/platform/WebDisplayItemList.h" | 108 #include "public/platform/WebDisplayItemList.h" |
109 #include "public/platform/WebFrameScheduler.h" | 109 #include "public/platform/WebFrameScheduler.h" |
110 #include "wtf/CurrentTime.h" | 110 #include "wtf/CurrentTime.h" |
111 #include "wtf/PtrUtil.h" | |
112 #include "wtf/StdLibExtras.h" | 111 #include "wtf/StdLibExtras.h" |
113 #include "wtf/TemporaryChange.h" | 112 #include "wtf/TemporaryChange.h" |
114 #include <memory> | |
115 | 113 |
116 namespace blink { | 114 namespace blink { |
117 | 115 |
118 using namespace HTMLNames; | 116 using namespace HTMLNames; |
119 | 117 |
120 // The maximum number of updateWidgets iterations that should be done before ret
urning. | 118 // The maximum number of updateWidgets iterations that should be done before ret
urning. |
121 static const unsigned maxUpdateWidgetsIterations = 2; | 119 static const unsigned maxUpdateWidgetsIterations = 2; |
122 static const double resourcePriorityUpdateDelayAfterScroll = 0.250; | 120 static const double resourcePriorityUpdateDelayAfterScroll = 0.250; |
123 | 121 |
124 static bool s_initialTrackAllPaintInvalidations = false; | 122 static bool s_initialTrackAllPaintInvalidations = false; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 m_layoutSchedulingEnabled = true; | 213 m_layoutSchedulingEnabled = true; |
216 m_inSynchronousPostLayout = false; | 214 m_inSynchronousPostLayout = false; |
217 m_layoutCount = 0; | 215 m_layoutCount = 0; |
218 m_nestedLayoutCount = 0; | 216 m_nestedLayoutCount = 0; |
219 m_postLayoutTasksTimer.stop(); | 217 m_postLayoutTasksTimer.stop(); |
220 m_updateWidgetsTimer.stop(); | 218 m_updateWidgetsTimer.stop(); |
221 m_firstLayout = true; | 219 m_firstLayout = true; |
222 m_safeToPropagateScrollToParent = true; | 220 m_safeToPropagateScrollToParent = true; |
223 m_lastViewportSize = IntSize(); | 221 m_lastViewportSize = IntSize(); |
224 m_lastZoomFactor = 1.0f; | 222 m_lastZoomFactor = 1.0f; |
225 m_trackedObjectPaintInvalidations = wrapUnique(s_initialTrackAllPaintInvalid
ations ? new Vector<ObjectPaintInvalidation> : nullptr); | 223 m_trackedObjectPaintInvalidations = adoptPtr(s_initialTrackAllPaintInvalidat
ions ? new Vector<ObjectPaintInvalidation> : nullptr); |
226 m_visuallyNonEmptyCharacterCount = 0; | 224 m_visuallyNonEmptyCharacterCount = 0; |
227 m_visuallyNonEmptyPixelCount = 0; | 225 m_visuallyNonEmptyPixelCount = 0; |
228 m_isVisuallyNonEmpty = false; | 226 m_isVisuallyNonEmpty = false; |
229 clearFragmentAnchor(); | 227 clearFragmentAnchor(); |
230 m_viewportConstrainedObjects.reset(); | 228 m_viewportConstrainedObjects.reset(); |
231 m_layoutSubtreeRootList.clear(); | 229 m_layoutSubtreeRootList.clear(); |
232 m_orthogonalWritingModeRootList.clear(); | 230 m_orthogonalWritingModeRootList.clear(); |
233 } | 231 } |
234 | 232 |
235 // Call function for each non-throttled frame view in pre tree order. | 233 // Call function for each non-throttled frame view in pre tree order. |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 | 828 |
831 void FrameView::prepareLayoutAnalyzer() | 829 void FrameView::prepareLayoutAnalyzer() |
832 { | 830 { |
833 bool isTracing = false; | 831 bool isTracing = false; |
834 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("blink.debug.la
yout"), &isTracing); | 832 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("blink.debug.la
yout"), &isTracing); |
835 if (!isTracing) { | 833 if (!isTracing) { |
836 m_analyzer.reset(); | 834 m_analyzer.reset(); |
837 return; | 835 return; |
838 } | 836 } |
839 if (!m_analyzer) | 837 if (!m_analyzer) |
840 m_analyzer = wrapUnique(new LayoutAnalyzer()); | 838 m_analyzer = adoptPtr(new LayoutAnalyzer()); |
841 m_analyzer->reset(); | 839 m_analyzer->reset(); |
842 } | 840 } |
843 | 841 |
844 std::unique_ptr<TracedValue> FrameView::analyzerCounters() | 842 PassOwnPtr<TracedValue> FrameView::analyzerCounters() |
845 { | 843 { |
846 if (!m_analyzer) | 844 if (!m_analyzer) |
847 return TracedValue::create(); | 845 return TracedValue::create(); |
848 std::unique_ptr<TracedValue> value = m_analyzer->toTracedValue(); | 846 OwnPtr<TracedValue> value = m_analyzer->toTracedValue(); |
849 value->setString("host", layoutViewItem().document().location()->host()); | 847 value->setString("host", layoutViewItem().document().location()->host()); |
850 value->setString("frame", String::format("0x%" PRIxPTR, reinterpret_cast<uin
tptr_t>(m_frame.get()))); | 848 value->setString("frame", String::format("0x%" PRIxPTR, reinterpret_cast<uin
tptr_t>(m_frame.get()))); |
851 value->setInteger("contentsHeightAfterLayout", layoutViewItem().documentRect
().height()); | 849 value->setInteger("contentsHeightAfterLayout", layoutViewItem().documentRect
().height()); |
852 value->setInteger("visibleHeight", visibleHeight()); | 850 value->setInteger("visibleHeight", visibleHeight()); |
853 value->setInteger("approximateBlankCharacterCount", FontFaceSet::approximate
BlankCharacterCount(*m_frame->document())); | 851 value->setInteger("approximateBlankCharacterCount", FontFaceSet::approximate
BlankCharacterCount(*m_frame->document())); |
854 return value; | 852 return value; |
855 } | 853 } |
856 | 854 |
857 #define PERFORM_LAYOUT_TRACE_CATEGORIES "blink,benchmark," TRACE_DISABLED_BY_DEF
AULT("blink.debug.layout") | 855 #define PERFORM_LAYOUT_TRACE_CATEGORIES "blink,benchmark," TRACE_DISABLED_BY_DEF
AULT("blink.debug.layout") |
858 | 856 |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 ASSERT(m_backgroundAttachmentFixedObjects.contains(object)); | 1300 ASSERT(m_backgroundAttachmentFixedObjects.contains(object)); |
1303 | 1301 |
1304 m_backgroundAttachmentFixedObjects.remove(object); | 1302 m_backgroundAttachmentFixedObjects.remove(object); |
1305 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(
)) | 1303 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(
)) |
1306 scrollingCoordinator->frameViewHasBackgroundAttachmentFixedObjectsDidCha
nge(this); | 1304 scrollingCoordinator->frameViewHasBackgroundAttachmentFixedObjectsDidCha
nge(this); |
1307 } | 1305 } |
1308 | 1306 |
1309 void FrameView::addViewportConstrainedObject(LayoutObject* object) | 1307 void FrameView::addViewportConstrainedObject(LayoutObject* object) |
1310 { | 1308 { |
1311 if (!m_viewportConstrainedObjects) | 1309 if (!m_viewportConstrainedObjects) |
1312 m_viewportConstrainedObjects = wrapUnique(new ViewportConstrainedObjectS
et); | 1310 m_viewportConstrainedObjects = adoptPtr(new ViewportConstrainedObjectSet
); |
1313 | 1311 |
1314 if (!m_viewportConstrainedObjects->contains(object)) { | 1312 if (!m_viewportConstrainedObjects->contains(object)) { |
1315 m_viewportConstrainedObjects->add(object); | 1313 m_viewportConstrainedObjects->add(object); |
1316 | 1314 |
1317 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) | 1315 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) |
1318 scrollingCoordinator->frameViewFixedObjectsDidChange(this); | 1316 scrollingCoordinator->frameViewFixedObjectsDidChange(this); |
1319 } | 1317 } |
1320 } | 1318 } |
1321 | 1319 |
1322 void FrameView::removeViewportConstrainedObject(LayoutObject* object) | 1320 void FrameView::removeViewportConstrainedObject(LayoutObject* object) |
(...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2938 | 2936 |
2939 void FrameView::setTracksPaintInvalidations(bool trackPaintInvalidations) | 2937 void FrameView::setTracksPaintInvalidations(bool trackPaintInvalidations) |
2940 { | 2938 { |
2941 if (trackPaintInvalidations == isTrackingPaintInvalidations()) | 2939 if (trackPaintInvalidations == isTrackingPaintInvalidations()) |
2942 return; | 2940 return; |
2943 | 2941 |
2944 for (Frame* frame = m_frame->tree().top(); frame; frame = frame->tree().trav
erseNext()) { | 2942 for (Frame* frame = m_frame->tree().top(); frame; frame = frame->tree().trav
erseNext()) { |
2945 if (!frame->isLocalFrame()) | 2943 if (!frame->isLocalFrame()) |
2946 continue; | 2944 continue; |
2947 if (LayoutViewItem layoutView = toLocalFrame(frame)->contentLayoutItem()
) { | 2945 if (LayoutViewItem layoutView = toLocalFrame(frame)->contentLayoutItem()
) { |
2948 layoutView.frameView()->m_trackedObjectPaintInvalidations = wrapUniq
ue(trackPaintInvalidations ? new Vector<ObjectPaintInvalidation> : nullptr); | 2946 layoutView.frameView()->m_trackedObjectPaintInvalidations = adoptPtr
(trackPaintInvalidations ? new Vector<ObjectPaintInvalidation> : nullptr); |
2949 layoutView.compositor()->setTracksPaintInvalidations(trackPaintInval
idations); | 2947 layoutView.compositor()->setTracksPaintInvalidations(trackPaintInval
idations); |
2950 } | 2948 } |
2951 } | 2949 } |
2952 | 2950 |
2953 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), | 2951 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), |
2954 "FrameView::setTracksPaintInvalidations", TRACE_EVENT_SCOPE_GLOBAL, "ena
bled", trackPaintInvalidations); | 2952 "FrameView::setTracksPaintInvalidations", TRACE_EVENT_SCOPE_GLOBAL, "ena
bled", trackPaintInvalidations); |
2955 } | 2953 } |
2956 | 2954 |
2957 void FrameView::trackObjectPaintInvalidation(const DisplayItemClient& client, Pa
intInvalidationReason reason) | 2955 void FrameView::trackObjectPaintInvalidation(const DisplayItemClient& client, Pa
intInvalidationReason reason) |
2958 { | 2956 { |
(...skipping 15 matching lines...) Expand all Loading... |
2974 itemJSON->setString("object", item.name); | 2972 itemJSON->setString("object", item.name); |
2975 itemJSON->setString("reason", paintInvalidationReasonToString(item.reaso
n)); | 2973 itemJSON->setString("reason", paintInvalidationReasonToString(item.reaso
n)); |
2976 result->pushObject(itemJSON); | 2974 result->pushObject(itemJSON); |
2977 } | 2975 } |
2978 return result; | 2976 return result; |
2979 } | 2977 } |
2980 | 2978 |
2981 void FrameView::addResizerArea(LayoutBox& resizerBox) | 2979 void FrameView::addResizerArea(LayoutBox& resizerBox) |
2982 { | 2980 { |
2983 if (!m_resizerAreas) | 2981 if (!m_resizerAreas) |
2984 m_resizerAreas = wrapUnique(new ResizerAreaSet); | 2982 m_resizerAreas = adoptPtr(new ResizerAreaSet); |
2985 m_resizerAreas->add(&resizerBox); | 2983 m_resizerAreas->add(&resizerBox); |
2986 } | 2984 } |
2987 | 2985 |
2988 void FrameView::removeResizerArea(LayoutBox& resizerBox) | 2986 void FrameView::removeResizerArea(LayoutBox& resizerBox) |
2989 { | 2987 { |
2990 if (!m_resizerAreas) | 2988 if (!m_resizerAreas) |
2991 return; | 2989 return; |
2992 | 2990 |
2993 ResizerAreaSet::iterator it = m_resizerAreas->find(&resizerBox); | 2991 ResizerAreaSet::iterator it = m_resizerAreas->find(&resizerBox); |
2994 if (it != m_resizerAreas->end()) | 2992 if (it != m_resizerAreas->end()) |
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4177 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot
tling); | 4175 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot
tling); |
4178 } | 4176 } |
4179 | 4177 |
4180 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const | 4178 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const |
4181 { | 4179 { |
4182 ASSERT(!layoutViewItem().isNull()); | 4180 ASSERT(!layoutViewItem().isNull()); |
4183 return *layoutView(); | 4181 return *layoutView(); |
4184 } | 4182 } |
4185 | 4183 |
4186 } // namespace blink | 4184 } // namespace blink |
OLD | NEW |