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

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

Issue 2339873002: Replace hide-scrollbars flag with a web setting. (Closed)
Patch Set: Add missing plumbing of hide_scrollbars preference. Created 4 years, 3 months 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) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@gmail.com> 9 * Christian Biesinger <cbiesinger@gmail.com>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 } 1044 }
1045 1045
1046 return hasAnyScrollbar && ((shouldUseCustom != hasCustom) || (shouldUseCusto m && didCustomScrollbarOwnerChanged)); 1046 return hasAnyScrollbar && ((shouldUseCustom != hasCustom) || (shouldUseCusto m && didCustomScrollbarOwnerChanged));
1047 } 1047 }
1048 1048
1049 void PaintLayerScrollableArea::setHasHorizontalScrollbar(bool hasScrollbar) 1049 void PaintLayerScrollableArea::setHasHorizontalScrollbar(bool hasScrollbar)
1050 { 1050 {
1051 if (FreezeScrollbarsScope::scrollbarsAreFrozen()) 1051 if (FreezeScrollbarsScope::scrollbarsAreFrozen())
1052 return; 1052 return;
1053 1053
1054 if (box().frame()->settings() && box().frame()->settings()->hideScrollbars() )
dcheng 2016/09/19 10:04:47 Is this null check of settings() required? We do c
skobes 2016/09/19 18:37:22 The question is whether Frame::m_host can ever be
skobes 2016/09/19 19:31:20 Ok, let's change the null checks to DCHECKs.
Eric Seckler 2016/09/22 12:41:56 Done. I also changed this in FrameView, assuming i
1055 hasScrollbar = false;
1056
1054 if (hasScrollbar == hasHorizontalScrollbar()) 1057 if (hasScrollbar == hasHorizontalScrollbar())
1055 return; 1058 return;
1056 1059
1057 setScrollbarNeedsPaintInvalidation(HorizontalScrollbar); 1060 setScrollbarNeedsPaintInvalidation(HorizontalScrollbar);
1058 1061
1059 m_scrollbarManager.setHasHorizontalScrollbar(hasScrollbar); 1062 m_scrollbarManager.setHasHorizontalScrollbar(hasScrollbar);
1060 1063
1061 updateScrollOrigin(); 1064 updateScrollOrigin();
1062 1065
1063 // Destroying or creating one bar can cause our scrollbar corner to come and go. We need to update the opposite scrollbar's style. 1066 // Destroying or creating one bar can cause our scrollbar corner to come and go. We need to update the opposite scrollbar's style.
1064 if (hasHorizontalScrollbar()) 1067 if (hasHorizontalScrollbar())
1065 horizontalScrollbar()->styleChanged(); 1068 horizontalScrollbar()->styleChanged();
1066 if (hasVerticalScrollbar()) 1069 if (hasVerticalScrollbar())
1067 verticalScrollbar()->styleChanged(); 1070 verticalScrollbar()->styleChanged();
1068 1071
1069 setScrollCornerNeedsPaintInvalidation(); 1072 setScrollCornerNeedsPaintInvalidation();
1070 1073
1071 // Force an update since we know the scrollbars have changed things. 1074 // Force an update since we know the scrollbars have changed things.
1072 if (box().document().hasAnnotatedRegions()) 1075 if (box().document().hasAnnotatedRegions())
1073 box().document().setAnnotatedRegionsDirty(true); 1076 box().document().setAnnotatedRegionsDirty(true);
1074 } 1077 }
1075 1078
1076 void PaintLayerScrollableArea::setHasVerticalScrollbar(bool hasScrollbar) 1079 void PaintLayerScrollableArea::setHasVerticalScrollbar(bool hasScrollbar)
1077 { 1080 {
1078 if (FreezeScrollbarsScope::scrollbarsAreFrozen()) 1081 if (FreezeScrollbarsScope::scrollbarsAreFrozen())
1079 return; 1082 return;
1080 1083
1084 if (box().frame()->settings() && box().frame()->settings()->hideScrollbars() )
1085 hasScrollbar = false;
1086
1081 if (hasScrollbar == hasVerticalScrollbar()) 1087 if (hasScrollbar == hasVerticalScrollbar())
1082 return; 1088 return;
1083 1089
1084 setScrollbarNeedsPaintInvalidation(VerticalScrollbar); 1090 setScrollbarNeedsPaintInvalidation(VerticalScrollbar);
1085 1091
1086 m_scrollbarManager.setHasVerticalScrollbar(hasScrollbar); 1092 m_scrollbarManager.setHasVerticalScrollbar(hasScrollbar);
1087 1093
1088 updateScrollOrigin(); 1094 updateScrollOrigin();
1089 1095
1090 // Destroying or creating one bar can cause our scrollbar corner to come and go. We need to update the opposite scrollbar's style. 1096 // Destroying or creating one bar can cause our scrollbar corner to come and go. We need to update the opposite scrollbar's style.
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 1774
1769 void PaintLayerScrollableArea::DelayScrollPositionClampScope::clampScrollableAre as() 1775 void PaintLayerScrollableArea::DelayScrollPositionClampScope::clampScrollableAre as()
1770 { 1776 {
1771 for (auto& scrollableArea : *s_needsClamp) 1777 for (auto& scrollableArea : *s_needsClamp)
1772 scrollableArea->clampScrollPositionsAfterLayout(); 1778 scrollableArea->clampScrollPositionsAfterLayout();
1773 delete s_needsClamp; 1779 delete s_needsClamp;
1774 s_needsClamp = nullptr; 1780 s_needsClamp = nullptr;
1775 } 1781 }
1776 1782
1777 } // namespace blink 1783 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/VisualViewport.cpp ('k') | third_party/WebKit/Source/core/testing/InternalSettings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698