Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: sky/engine/core/frame/FrameView.cpp

Issue 684063002: Remove more frame-level scrolling machinery. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 : m_frame(frame) 72 : m_frame(frame)
73 , m_hasPendingLayout(false) 73 , m_hasPendingLayout(false)
74 , m_layoutSubtreeRoot(0) 74 , m_layoutSubtreeRoot(0)
75 , m_inSynchronousPostLayout(false) 75 , m_inSynchronousPostLayout(false)
76 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired) 76 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired)
77 , m_isTransparent(false) 77 , m_isTransparent(false)
78 , m_baseBackgroundColor(Color::white) 78 , m_baseBackgroundColor(Color::white)
79 , m_mediaType("screen") 79 , m_mediaType("screen")
80 , m_overflowStatusDirty(true) 80 , m_overflowStatusDirty(true)
81 , m_viewportRenderer(0) 81 , m_viewportRenderer(0)
82 , m_wasScrolledByUser(false)
83 , m_inProgrammaticScroll(false)
84 , m_isTrackingPaintInvalidations(false) 82 , m_isTrackingPaintInvalidations(false)
85 , m_hasSoftwareFilters(false) 83 , m_hasSoftwareFilters(false)
86 , m_visibleContentScaleFactor(1) 84 , m_visibleContentScaleFactor(1)
87 , m_inputEventsScaleFactorForEmulation(1) 85 , m_inputEventsScaleFactorForEmulation(1)
88 , m_layoutSizeFixedToFrameSize(true) 86 , m_layoutSizeFixedToFrameSize(true)
89 { 87 {
90 ASSERT(m_frame); 88 ASSERT(m_frame);
91 init(); 89 init();
92 } 90 }
93 91
(...skipping 27 matching lines...) Expand all
121 m_doFullPaintInvalidation = false; 119 m_doFullPaintInvalidation = false;
122 m_layoutSchedulingEnabled = true; 120 m_layoutSchedulingEnabled = true;
123 m_inPerformLayout = false; 121 m_inPerformLayout = false;
124 m_canInvalidatePaintDuringPerformLayout = false; 122 m_canInvalidatePaintDuringPerformLayout = false;
125 m_inSynchronousPostLayout = false; 123 m_inSynchronousPostLayout = false;
126 m_layoutCount = 0; 124 m_layoutCount = 0;
127 m_nestedLayoutCount = 0; 125 m_nestedLayoutCount = 0;
128 m_postLayoutTasksTimer.stop(); 126 m_postLayoutTasksTimer.stop();
129 m_firstLayout = true; 127 m_firstLayout = true;
130 m_firstLayoutCallbackPending = false; 128 m_firstLayoutCallbackPending = false;
131 m_wasScrolledByUser = false;
132 m_lastViewportSize = IntSize(); 129 m_lastViewportSize = IntSize();
133 m_lastZoomFactor = 1.0f; 130 m_lastZoomFactor = 1.0f;
134 m_isTrackingPaintInvalidations = false; 131 m_isTrackingPaintInvalidations = false;
135 m_trackedPaintInvalidationRects.clear(); 132 m_trackedPaintInvalidationRects.clear();
136 m_lastPaintTime = 0; 133 m_lastPaintTime = 0;
137 m_paintBehavior = PaintBehaviorNormal; 134 m_paintBehavior = PaintBehaviorNormal;
138 m_isPainting = false; 135 m_isPainting = false;
139 } 136 }
140 137
141 void FrameView::init() 138 void FrameView::init()
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 339
343 if (isInPerformLayout() || !m_frame->document()->isActive()) 340 if (isInPerformLayout() || !m_frame->document()->isActive())
344 return; 341 return;
345 342
346 TRACE_EVENT0("blink", "FrameView::layout"); 343 TRACE_EVENT0("blink", "FrameView::layout");
347 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout"); 344 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout");
348 345
349 // Protect the view from being deleted during layout (in recalcStyle) 346 // Protect the view from being deleted during layout (in recalcStyle)
350 RefPtr<FrameView> protector(this); 347 RefPtr<FrameView> protector(this);
351 348
352 // Every scroll that happens during layout is programmatic.
353 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru e);
354
355 m_hasPendingLayout = false; 349 m_hasPendingLayout = false;
356 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo utClean); 350 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo utClean);
357 351
358 RELEASE_ASSERT(!isPainting()); 352 RELEASE_ASSERT(!isPainting());
359 353
360 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout", "beginData", InspectorLayoutEvent::beginData(this)); 354 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout", "beginData", InspectorLayoutEvent::beginData(this));
361 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", "stack", InspectorCallStackEvent::currentCallStack()); 355 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", "stack", InspectorCallStackEvent::currentCallStack());
362 356
363 if (!allowSubtree && isSubtreeLayout()) { 357 if (!allowSubtree && isSubtreeLayout()) {
364 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); 358 m_layoutSubtreeRoot->markContainingBlocksForLayout(false);
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 // addition of the base background color is not 885 // addition of the base background color is not
892 // technically part of the document background, but it 886 // technically part of the document background, but it
893 // otherwise poses problems when the aggregate is not 887 // otherwise poses problems when the aggregate is not
894 // fully opaque. 888 // fully opaque.
895 if (htmlElement && htmlElement->renderer()) 889 if (htmlElement && htmlElement->renderer())
896 result = result.blend(htmlElement->renderer()->style()->colorIncludingFa llback(CSSPropertyBackgroundColor)); 890 result = result.blend(htmlElement->renderer()->style()->colorIncludingFa llback(CSSPropertyBackgroundColor));
897 891
898 return result; 892 return result;
899 } 893 }
900 894
901 bool FrameView::wasScrolledByUser() const
902 {
903 return m_wasScrolledByUser;
904 }
905
906 void FrameView::setWasScrolledByUser(bool wasScrolledByUser)
907 {
908 if (m_inProgrammaticScroll)
909 return;
910 m_wasScrolledByUser = wasScrolledByUser;
911 }
912
913 void FrameView::paintContents(GraphicsContext* p, const IntRect& rect) 895 void FrameView::paintContents(GraphicsContext* p, const IntRect& rect)
914 { 896 {
915 Document* document = m_frame->document(); 897 Document* document = m_frame->document();
916 898
917 #ifndef NDEBUG 899 #ifndef NDEBUG
918 bool fillWithRed; 900 bool fillWithRed;
919 if (isTransparent()) 901 if (isTransparent())
920 fillWithRed = false; // Transparent, don't fill with red. 902 fillWithRed = false; // Transparent, don't fill with red.
921 else if (m_paintBehavior & PaintBehaviorSelectionOnly) 903 else if (m_paintBehavior & PaintBehaviorSelectionOnly)
922 fillWithRed = false; // Selections are transparent, don't fill with red. 904 fillWithRed = false; // Selections are transparent, don't fill with red.
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 IntPoint FrameView::convertFromRenderer(const RenderObject& renderer, const IntP oint& rendererPoint) const 1060 IntPoint FrameView::convertFromRenderer(const RenderObject& renderer, const IntP oint& rendererPoint) const
1079 { 1061 {
1080 return roundedIntPoint(renderer.localToAbsolute(rendererPoint, UseTransforms )); 1062 return roundedIntPoint(renderer.localToAbsolute(rendererPoint, UseTransforms ));
1081 } 1063 }
1082 1064
1083 IntPoint FrameView::convertToRenderer(const RenderObject& renderer, const IntPoi nt& viewPoint) const 1065 IntPoint FrameView::convertToRenderer(const RenderObject& renderer, const IntPoi nt& viewPoint) const
1084 { 1066 {
1085 return roundedIntPoint(renderer.absoluteToLocal(viewPoint, UseTransforms)); 1067 return roundedIntPoint(renderer.absoluteToLocal(viewPoint, UseTransforms));
1086 } 1068 }
1087 1069
1088 IntRect FrameView::convertToContainingView(const IntRect& localRect) const
1089 {
1090 return localRect;
1091 }
1092
1093 IntRect FrameView::convertFromContainingView(const IntRect& parentRect) const
1094 {
1095 return parentRect;
1096 }
1097
1098 IntPoint FrameView::convertToContainingView(const IntPoint& localPoint) const
1099 {
1100 return localPoint;
1101 }
1102
1103 IntPoint FrameView::convertFromContainingView(const IntPoint& parentPoint) const
1104 {
1105 return parentPoint;
1106 }
1107
1108 void FrameView::setTracksPaintInvalidations(bool trackPaintInvalidations) 1070 void FrameView::setTracksPaintInvalidations(bool trackPaintInvalidations)
1109 { 1071 {
1110 if (trackPaintInvalidations == m_isTrackingPaintInvalidations) 1072 if (trackPaintInvalidations == m_isTrackingPaintInvalidations)
1111 return; 1073 return;
1112 1074
1113 // FIXME(sky): simplify 1075 // FIXME(sky): simplify
1114 if (RenderView* renderView = m_frame->contentRenderer()) 1076 if (RenderView* renderView = m_frame->contentRenderer())
1115 renderView->compositor()->setTracksPaintInvalidations(trackPaintInvalida tions); 1077 renderView->compositor()->setTracksPaintInvalidations(trackPaintInvalida tions);
1116 1078
1117 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), 1079 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"),
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 void FrameView::setLayoutSizeInternal(const IntSize& size) 1169 void FrameView::setLayoutSizeInternal(const IntSize& size)
1208 { 1170 {
1209 if (m_layoutSize == size) 1171 if (m_layoutSize == size)
1210 return; 1172 return;
1211 1173
1212 m_layoutSize = size; 1174 m_layoutSize = size;
1213 contentsResized(); 1175 contentsResized();
1214 } 1176 }
1215 1177
1216 } // namespace blink 1178 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698