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