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

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: check for presence of settings using DCHECK + sync. 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 DCHECK(box().frame()->settings());
1055 if (box().frame()->settings()->hideScrollbars())
1056 hasScrollbar = false;
1057
1054 if (hasScrollbar == hasHorizontalScrollbar()) 1058 if (hasScrollbar == hasHorizontalScrollbar())
1055 return; 1059 return;
1056 1060
1057 setScrollbarNeedsPaintInvalidation(HorizontalScrollbar); 1061 setScrollbarNeedsPaintInvalidation(HorizontalScrollbar);
1058 1062
1059 m_scrollbarManager.setHasHorizontalScrollbar(hasScrollbar); 1063 m_scrollbarManager.setHasHorizontalScrollbar(hasScrollbar);
1060 1064
1061 updateScrollOrigin(); 1065 updateScrollOrigin();
1062 1066
1063 // Destroying or creating one bar can cause our scrollbar corner to come and go. We need to update the opposite scrollbar's style. 1067 // 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()) 1068 if (hasHorizontalScrollbar())
1065 horizontalScrollbar()->styleChanged(); 1069 horizontalScrollbar()->styleChanged();
1066 if (hasVerticalScrollbar()) 1070 if (hasVerticalScrollbar())
1067 verticalScrollbar()->styleChanged(); 1071 verticalScrollbar()->styleChanged();
1068 1072
1069 setScrollCornerNeedsPaintInvalidation(); 1073 setScrollCornerNeedsPaintInvalidation();
1070 1074
1071 // Force an update since we know the scrollbars have changed things. 1075 // Force an update since we know the scrollbars have changed things.
1072 if (box().document().hasAnnotatedRegions()) 1076 if (box().document().hasAnnotatedRegions())
1073 box().document().setAnnotatedRegionsDirty(true); 1077 box().document().setAnnotatedRegionsDirty(true);
1074 } 1078 }
1075 1079
1076 void PaintLayerScrollableArea::setHasVerticalScrollbar(bool hasScrollbar) 1080 void PaintLayerScrollableArea::setHasVerticalScrollbar(bool hasScrollbar)
1077 { 1081 {
1078 if (FreezeScrollbarsScope::scrollbarsAreFrozen()) 1082 if (FreezeScrollbarsScope::scrollbarsAreFrozen())
1079 return; 1083 return;
1080 1084
1085 DCHECK(box().frame()->settings());
1086 if (box().frame()->settings()->hideScrollbars())
1087 hasScrollbar = false;
1088
1081 if (hasScrollbar == hasVerticalScrollbar()) 1089 if (hasScrollbar == hasVerticalScrollbar())
1082 return; 1090 return;
1083 1091
1084 setScrollbarNeedsPaintInvalidation(VerticalScrollbar); 1092 setScrollbarNeedsPaintInvalidation(VerticalScrollbar);
1085 1093
1086 m_scrollbarManager.setHasVerticalScrollbar(hasScrollbar); 1094 m_scrollbarManager.setHasVerticalScrollbar(hasScrollbar);
1087 1095
1088 updateScrollOrigin(); 1096 updateScrollOrigin();
1089 1097
1090 // Destroying or creating one bar can cause our scrollbar corner to come and go. We need to update the opposite scrollbar's style. 1098 // 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 1776
1769 void PaintLayerScrollableArea::DelayScrollPositionClampScope::clampScrollableAre as() 1777 void PaintLayerScrollableArea::DelayScrollPositionClampScope::clampScrollableAre as()
1770 { 1778 {
1771 for (auto& scrollableArea : *s_needsClamp) 1779 for (auto& scrollableArea : *s_needsClamp)
1772 scrollableArea->clampScrollPositionsAfterLayout(); 1780 scrollableArea->clampScrollPositionsAfterLayout();
1773 delete s_needsClamp; 1781 delete s_needsClamp;
1774 s_needsClamp = nullptr; 1782 s_needsClamp = nullptr;
1775 } 1783 }
1776 1784
1777 } // namespace blink 1785 } // 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