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

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

Issue 2426793002: Aura overlay scrollbars adjust color for dark backgrounds (Closed)
Patch Set: update Created 4 years, 2 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 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 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 // overlay style might need to be changed to have contrast against the 962 // overlay style might need to be changed to have contrast against the
963 // background. 963 // background.
964 Color oldBackground; 964 Color oldBackground;
965 if (oldStyle) { 965 if (oldStyle) {
966 oldBackground = oldStyle->visitedDependentColor(CSSPropertyBackgroundColor); 966 oldBackground = oldStyle->visitedDependentColor(CSSPropertyBackgroundColor);
967 } 967 }
968 Color newBackground = 968 Color newBackground =
969 box().style()->visitedDependentColor(CSSPropertyBackgroundColor); 969 box().style()->visitedDependentColor(CSSPropertyBackgroundColor);
970 970
971 if (newBackground != oldBackground) { 971 if (newBackground != oldBackground) {
972 recalculateScrollbarOverlayStyle(newBackground); 972 recalculateScrollbarOverlayStyle(newBackground, m_layer.isTransparent());
973 } 973 }
974 } 974 }
975 975
976 bool PaintLayerScrollableArea::updateAfterCompositingChange() { 976 bool PaintLayerScrollableArea::updateAfterCompositingChange() {
977 layer()->updateScrollingStateAfterCompositingChange(); 977 layer()->updateScrollingStateAfterCompositingChange();
978 const bool layersChanged = m_topmostScrollChild != m_nextTopmostScrollChild; 978 const bool layersChanged = m_topmostScrollChild != m_nextTopmostScrollChild;
979 m_topmostScrollChild = m_nextTopmostScrollChild; 979 m_topmostScrollChild = m_nextTopmostScrollChild;
980 m_nextTopmostScrollChild = nullptr; 980 m_nextTopmostScrollChild = nullptr;
981 return layersChanged; 981 return layersChanged;
982 } 982 }
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 LayoutScrollbarPart::createAnonymous(&box().document(), this); 1266 LayoutScrollbarPart::createAnonymous(&box().document(), this);
1267 m_scrollCorner->setDangerousOneWayParent(&box()); 1267 m_scrollCorner->setDangerousOneWayParent(&box());
1268 } 1268 }
1269 m_scrollCorner->setStyleWithWritingModeOfParent(corner.release()); 1269 m_scrollCorner->setStyleWithWritingModeOfParent(corner.release());
1270 } else if (m_scrollCorner) { 1270 } else if (m_scrollCorner) {
1271 m_scrollCorner->destroy(); 1271 m_scrollCorner->destroy();
1272 m_scrollCorner = nullptr; 1272 m_scrollCorner = nullptr;
1273 } 1273 }
1274 } 1274 }
1275 1275
1276 ScrollbarOverlayStyle PaintLayerScrollableArea::getScrollbarOverlayStyle()
1277 const {
1278 ScrollbarOverlayStyle style = ScrollableArea::getScrollbarOverlayStyle();
1279
1280 if (style == ScrollbarOverlayStyleDefault) {
bokan 2016/10/18 19:55:25 ScrollableArea has a layoutBox() method that retur
1281 PaintLayer* layer = &this->m_layer;
1282 while (layer->isTransparent() && layer->parent())
1283 layer = layer->parent();
1284
1285 if (layer->layoutBox() && layer->layoutBox()->style()) {
1286 Color color = layer->layoutBox()->style()->visitedDependentColor(
1287 CSSPropertyBackgroundColor);
1288 style = calculateScrollbarOverlayStyle(color);
1289 }
1290 }
1291
1292 return style;
1293 }
1294
1276 bool PaintLayerScrollableArea::hitTestOverflowControls( 1295 bool PaintLayerScrollableArea::hitTestOverflowControls(
1277 HitTestResult& result, 1296 HitTestResult& result,
1278 const IntPoint& localPoint) { 1297 const IntPoint& localPoint) {
1279 if (!hasScrollbar() && !box().canResize()) 1298 if (!hasScrollbar() && !box().canResize())
1280 return false; 1299 return false;
1281 1300
1282 IntRect resizeControlRect; 1301 IntRect resizeControlRect;
1283 if (box().style()->resize() != RESIZE_NONE) { 1302 if (box().style()->resize() != RESIZE_NONE) {
1284 resizeControlRect = 1303 resizeControlRect =
1285 resizerCornerRect(box().pixelSnappedBorderBoxRect(), ResizerForPointer); 1304 resizerCornerRect(box().pixelSnappedBorderBoxRect(), ResizerForPointer);
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
1978 1997
1979 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: 1998 void PaintLayerScrollableArea::DelayScrollOffsetClampScope::
1980 clampScrollableAreas() { 1999 clampScrollableAreas() {
1981 for (auto& scrollableArea : *s_needsClamp) 2000 for (auto& scrollableArea : *s_needsClamp)
1982 scrollableArea->clampScrollOffsetsAfterLayout(); 2001 scrollableArea->clampScrollOffsetsAfterLayout();
1983 delete s_needsClamp; 2002 delete s_needsClamp;
1984 s_needsClamp = nullptr; 2003 s_needsClamp = nullptr;
1985 } 2004 }
1986 2005
1987 } // namespace blink 2006 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698