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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp

Issue 2523533002: Call scrollbarsChanged in PLSA::updateAfterStyleChange. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
6 * 6 *
7 * Other contributors: 7 * Other contributors:
8 * Robert O'Callahan <roc+@cs.cmu.edu> 8 * Robert O'Callahan <roc+@cs.cmu.edu>
9 * David Baron <dbaron@fas.harvard.edu> 9 * David Baron <dbaron@fas.harvard.edu>
10 * Christian Biesinger <cbiesinger@gmail.com> 10 * Christian Biesinger <cbiesinger@gmail.com>
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 bool needsHorizontalScrollbar; 919 bool needsHorizontalScrollbar;
920 bool needsVerticalScrollbar; 920 bool needsVerticalScrollbar;
921 // We add auto scrollbars only during layout to prevent spurious activations. 921 // We add auto scrollbars only during layout to prevent spurious activations.
922 computeScrollbarExistence(needsHorizontalScrollbar, needsVerticalScrollbar, 922 computeScrollbarExistence(needsHorizontalScrollbar, needsVerticalScrollbar,
923 ForbidAddingAutoBars); 923 ForbidAddingAutoBars);
924 924
925 // Avoid some unnecessary computation if there were and will be no scrollbars. 925 // Avoid some unnecessary computation if there were and will be no scrollbars.
926 if (!hasScrollbar() && !needsHorizontalScrollbar && !needsVerticalScrollbar) 926 if (!hasScrollbar() && !needsHorizontalScrollbar && !needsVerticalScrollbar)
927 return; 927 return;
928 928
929 setHasHorizontalScrollbar(needsHorizontalScrollbar); 929 bool horizontalScrollbarChanged =
930 setHasVerticalScrollbar(needsVerticalScrollbar); 930 setHasHorizontalScrollbar(needsHorizontalScrollbar);
931 bool verticalScrollbarChanged =
932 setHasVerticalScrollbar(needsVerticalScrollbar);
933
934 if (horizontalScrollbarChanged || verticalScrollbarChanged) {
935 toLayoutBlock(box()).scrollbarsChanged(horizontalScrollbarChanged,
atotic 2016/11/21 22:09:06 box() can return null. Looking at existing code, i
skobes 2016/11/21 22:18:51 It returns a reference, so it cannot be null.
936 verticalScrollbarChanged);
937 }
931 938
932 // With overflow: scroll, scrollbars are always visible but may be disabled. 939 // With overflow: scroll, scrollbars are always visible but may be disabled.
933 // When switching to another value, we need to re-enable them (see bug 11985). 940 // When switching to another value, we need to re-enable them (see bug 11985).
934 if (hasHorizontalScrollbar() && oldStyle && 941 if (hasHorizontalScrollbar() && oldStyle &&
935 oldStyle->overflowX() == OverflowScroll && 942 oldStyle->overflowX() == OverflowScroll &&
936 box().style()->overflowX() != OverflowScroll) { 943 box().style()->overflowX() != OverflowScroll) {
937 horizontalScrollbar()->setEnabled(true); 944 horizontalScrollbar()->setEnabled(true);
938 } 945 }
939 946
940 if (hasVerticalScrollbar() && oldStyle && 947 if (hasVerticalScrollbar() && oldStyle &&
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 frameView->calculateScrollbarModes(hMode, vMode); 1174 frameView->calculateScrollbarModes(hMode, vMode);
1168 if (hMode == ScrollbarAlwaysOn) 1175 if (hMode == ScrollbarAlwaysOn)
1169 needsHorizontalScrollbar = true; 1176 needsHorizontalScrollbar = true;
1170 if (vMode == ScrollbarAlwaysOn) 1177 if (vMode == ScrollbarAlwaysOn)
1171 needsVerticalScrollbar = true; 1178 needsVerticalScrollbar = true;
1172 } 1179 }
1173 } 1180 }
1174 } 1181 }
1175 } 1182 }
1176 1183
1177 void PaintLayerScrollableArea::setHasHorizontalScrollbar(bool hasScrollbar) { 1184 bool PaintLayerScrollableArea::setHasHorizontalScrollbar(bool hasScrollbar) {
1178 if (FreezeScrollbarsScope::scrollbarsAreFrozen()) 1185 if (FreezeScrollbarsScope::scrollbarsAreFrozen())
1179 return; 1186 return false;
1180 1187
1181 if (hasScrollbar == hasHorizontalScrollbar()) 1188 if (hasScrollbar == hasHorizontalScrollbar())
1182 return; 1189 return false;
1183 1190
1184 setScrollbarNeedsPaintInvalidation(HorizontalScrollbar); 1191 setScrollbarNeedsPaintInvalidation(HorizontalScrollbar);
1185 1192
1186 m_scrollbarManager.setHasHorizontalScrollbar(hasScrollbar); 1193 m_scrollbarManager.setHasHorizontalScrollbar(hasScrollbar);
1187 1194
1188 updateScrollOrigin(); 1195 updateScrollOrigin();
1189 1196
1190 // Destroying or creating one bar can cause our scrollbar corner to come and 1197 // Destroying or creating one bar can cause our scrollbar corner to come and
1191 // go. We need to update the opposite scrollbar's style. 1198 // go. We need to update the opposite scrollbar's style.
1192 if (hasHorizontalScrollbar()) 1199 if (hasHorizontalScrollbar())
1193 horizontalScrollbar()->styleChanged(); 1200 horizontalScrollbar()->styleChanged();
1194 if (hasVerticalScrollbar()) 1201 if (hasVerticalScrollbar())
1195 verticalScrollbar()->styleChanged(); 1202 verticalScrollbar()->styleChanged();
1196 1203
1197 setScrollCornerNeedsPaintInvalidation(); 1204 setScrollCornerNeedsPaintInvalidation();
1198 1205
1199 // Force an update since we know the scrollbars have changed things. 1206 // Force an update since we know the scrollbars have changed things.
1200 if (box().document().hasAnnotatedRegions()) 1207 if (box().document().hasAnnotatedRegions())
1201 box().document().setAnnotatedRegionsDirty(true); 1208 box().document().setAnnotatedRegionsDirty(true);
1209 return true;
1202 } 1210 }
1203 1211
1204 void PaintLayerScrollableArea::setHasVerticalScrollbar(bool hasScrollbar) { 1212 bool PaintLayerScrollableArea::setHasVerticalScrollbar(bool hasScrollbar) {
1205 if (FreezeScrollbarsScope::scrollbarsAreFrozen()) 1213 if (FreezeScrollbarsScope::scrollbarsAreFrozen())
1206 return; 1214 return false;
1207 1215
1208 if (hasScrollbar == hasVerticalScrollbar()) 1216 if (hasScrollbar == hasVerticalScrollbar())
1209 return; 1217 return false;
1210 1218
1211 setScrollbarNeedsPaintInvalidation(VerticalScrollbar); 1219 setScrollbarNeedsPaintInvalidation(VerticalScrollbar);
1212 1220
1213 m_scrollbarManager.setHasVerticalScrollbar(hasScrollbar); 1221 m_scrollbarManager.setHasVerticalScrollbar(hasScrollbar);
1214 1222
1215 updateScrollOrigin(); 1223 updateScrollOrigin();
1216 1224
1217 // Destroying or creating one bar can cause our scrollbar corner to come and 1225 // Destroying or creating one bar can cause our scrollbar corner to come and
1218 // go. We need to update the opposite scrollbar's style. 1226 // go. We need to update the opposite scrollbar's style.
1219 if (hasHorizontalScrollbar()) 1227 if (hasHorizontalScrollbar())
1220 horizontalScrollbar()->styleChanged(); 1228 horizontalScrollbar()->styleChanged();
1221 if (hasVerticalScrollbar()) 1229 if (hasVerticalScrollbar())
1222 verticalScrollbar()->styleChanged(); 1230 verticalScrollbar()->styleChanged();
1223 1231
1224 setScrollCornerNeedsPaintInvalidation(); 1232 setScrollCornerNeedsPaintInvalidation();
1225 1233
1226 // Force an update since we know the scrollbars have changed things. 1234 // Force an update since we know the scrollbars have changed things.
1227 if (box().document().hasAnnotatedRegions()) 1235 if (box().document().hasAnnotatedRegions())
1228 box().document().setAnnotatedRegionsDirty(true); 1236 box().document().setAnnotatedRegionsDirty(true);
1237 return true;
1229 } 1238 }
1230 1239
1231 int PaintLayerScrollableArea::verticalScrollbarWidth( 1240 int PaintLayerScrollableArea::verticalScrollbarWidth(
1232 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior) const { 1241 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior) const {
1233 if (!hasVerticalScrollbar()) 1242 if (!hasVerticalScrollbar())
1234 return 0; 1243 return 0;
1235 if (verticalScrollbar()->isOverlayScrollbar() && 1244 if (verticalScrollbar()->isOverlayScrollbar() &&
1236 (overlayScrollbarClipBehavior == IgnoreOverlayScrollbarSize || 1245 (overlayScrollbarClipBehavior == IgnoreOverlayScrollbarSize ||
1237 !verticalScrollbar()->shouldParticipateInHitTesting())) 1246 !verticalScrollbar()->shouldParticipateInHitTesting()))
1238 return 0; 1247 return 0;
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
2002 2011
2003 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: 2012 void PaintLayerScrollableArea::DelayScrollOffsetClampScope::
2004 clampScrollableAreas() { 2013 clampScrollableAreas() {
2005 for (auto& scrollableArea : *s_needsClamp) 2014 for (auto& scrollableArea : *s_needsClamp)
2006 scrollableArea->clampScrollOffsetsAfterLayout(); 2015 scrollableArea->clampScrollOffsetsAfterLayout();
2007 delete s_needsClamp; 2016 delete s_needsClamp;
2008 s_needsClamp = nullptr; 2017 s_needsClamp = nullptr;
2009 } 2018 }
2010 2019
2011 } // namespace blink 2020 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698