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

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

Issue 1826013002: Enable compositing for opaque scrolling content on low DPI screens (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test and TODO for failure mode Created 4 years, 4 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 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 1487
1488 static bool layerNeedsCompositedScrolling(PaintLayerScrollableArea::LCDTextMode mode, const PaintLayer* layer) 1488 static bool layerNeedsCompositedScrolling(PaintLayerScrollableArea::LCDTextMode mode, const PaintLayer* layer)
1489 { 1489 {
1490 if (!layer->scrollsOverflow()) 1490 if (!layer->scrollsOverflow())
1491 return false; 1491 return false;
1492 1492
1493 Node* node = layer->enclosingNode(); 1493 Node* node = layer->enclosingNode();
1494 if (node && node->isElementNode() && (toElement(node)->compositorMutableProp erties() & (CompositorMutableProperty::kScrollTop | CompositorMutableProperty::k ScrollLeft))) 1494 if (node && node->isElementNode() && (toElement(node)->compositorMutableProp erties() & (CompositorMutableProperty::kScrollTop | CompositorMutableProperty::k ScrollLeft)))
1495 return true; 1495 return true;
1496 1496
1497 if (mode == PaintLayerScrollableArea::ConsiderLCDText && !layer->compositor( )->preferCompositingToLCDTextEnabled()) 1497 // TODO(schenney) The color test alone is inadequate. When https://coderevie w.chromium.org/2196583002 lands
1498 // we should use PaintLayer::shouldPaintBackgroundOntoForeground() because w e will not still get
1499 // LCD text unless the conditions there are met. It also unifies logic for s crolling compositing
1500 // decisions.
1501 bool backgroundSupportsLCDText = RuntimeEnabledFeatures::compositeOpaqueScro llersEnabled()
1502 && !layer->layoutObject()->style()->visitedDependentColor(CSSPropertyBac kgroundColor).hasAlpha();
1503 if (mode == PaintLayerScrollableArea::ConsiderLCDText
1504 && !layer->compositor()->preferCompositingToLCDTextEnabled()
1505 && !backgroundSupportsLCDText)
1498 return false; 1506 return false;
1499 1507
1500 return !layer->size().isEmpty() 1508 // TODO(schenney) Tests fail if we do not also exclude layer->layoutObject() ->isFloating() (asserts) and
chrishtr 2016/08/04 16:35:44 isFloating should have been fixed by https://coder
Stephen Chennney 2016/08/04 17:35:25 Yep. Forgot you fixed that.
1501 && !layer->hasDescendantWithClipPath() 1509 // layer->layoutObject()->style()->hasBorderDecoration() (missing background behind dashed borders).
1502 && !layer->hasAncestorWithClipPath() 1510 // Resolve these cases, or not, and update this check with the results.
1503 && !layer->layoutObject()->style()->hasBorderRadius(); 1511 return !(layer->size().isEmpty()
1512 || layer->hasDescendantWithClipPath()
1513 || layer->hasAncestorWithClipPath()
1514 || layer->layoutObject()->style()->hasBorderRadius());
1504 } 1515 }
1505 1516
1506 void PaintLayerScrollableArea::updateNeedsCompositedScrolling(LCDTextMode mode) 1517 void PaintLayerScrollableArea::updateNeedsCompositedScrolling(LCDTextMode mode)
1507 { 1518 {
1508 const bool needsCompositedScrolling = layerNeedsCompositedScrolling(mode, la yer()); 1519 const bool needsCompositedScrolling = layerNeedsCompositedScrolling(mode, la yer());
1509 if (static_cast<bool>(m_needsCompositedScrolling) != needsCompositedScrollin g) { 1520 if (static_cast<bool>(m_needsCompositedScrolling) != needsCompositedScrollin g) {
1510 m_needsCompositedScrolling = needsCompositedScrolling; 1521 m_needsCompositedScrolling = needsCompositedScrolling;
1511 layer()->didUpdateNeedsCompositedScrolling(); 1522 layer()->didUpdateNeedsCompositedScrolling();
1512 } 1523 }
1513 } 1524 }
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1758 1769
1759 void PaintLayerScrollableArea::DelayScrollPositionClampScope::clampScrollableAre as() 1770 void PaintLayerScrollableArea::DelayScrollPositionClampScope::clampScrollableAre as()
1760 { 1771 {
1761 for (auto& scrollableArea : *s_needsClamp) 1772 for (auto& scrollableArea : *s_needsClamp)
1762 scrollableArea->clampScrollPositionsAfterLayout(); 1773 scrollableArea->clampScrollPositionsAfterLayout();
1763 delete s_needsClamp; 1774 delete s_needsClamp;
1764 s_needsClamp = nullptr; 1775 s_needsClamp = nullptr;
1765 } 1776 }
1766 1777
1767 } // namespace blink 1778 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698