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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2339653003: Enable the scroll of empty elements by setting the rect's size to 1. (Closed)
Patch Set: Rebase and format 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
index 72e6a3c10617a0eaf403e76936f53357afc908c2..8528d71253edfe1745b63b60d47b2ffeede3521e 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -565,8 +565,14 @@ void LayoutBox::scrollRectToVisible(const LayoutRect& rect, const ScrollAlignmen
// Presumably the same issue as in setScrollTop. See crbug.com/343132.
DisableCompositingQueryAsserts disabler;
+ LayoutRect rectToScroll = rect;
+ if (rectToScroll.width() <= 0)
+ rectToScroll.setWidth(LayoutUnit(1));
+ if (rectToScroll.height() <= 0)
+ rectToScroll.setHeight(LayoutUnit(1));
+
LayoutBox* parentBox = nullptr;
- LayoutRect newRect = rect;
+ LayoutRect newRect = rectToScroll;
bool restrictedByLineClamp = false;
if (parent()) {
@@ -577,7 +583,7 @@ void LayoutBox::scrollRectToVisible(const LayoutRect& rect, const ScrollAlignmen
if (hasOverflowClip() && !restrictedByLineClamp) {
// Don't scroll to reveal an overflow layer that is restricted by the -webkit-line-clamp property.
// This will prevent us from revealing text hidden by the slider in Safari RSS.
- newRect = getScrollableArea()->scrollIntoView(rect, alignX, alignY, scrollType);
+ newRect = getScrollableArea()->scrollIntoView(rectToScroll, alignX, alignY, scrollType);
if (newRect.isEmpty())
return;
} else if (!parentBox && canBeProgramaticallyScrolled()) {
@@ -585,15 +591,15 @@ void LayoutBox::scrollRectToVisible(const LayoutRect& rect, const ScrollAlignmen
HTMLFrameOwnerElement* ownerElement = document().localOwner();
if (!isDisallowedAutoscroll(ownerElement, frameView)) {
if (makeVisibleInVisualViewport) {
- frameView->getScrollableArea()->scrollIntoView(rect, alignX, alignY, scrollType);
+ frameView->getScrollableArea()->scrollIntoView(rectToScroll, alignX, alignY, scrollType);
} else {
- frameView->layoutViewportScrollableArea()->scrollIntoView(rect, alignX, alignY, scrollType);
+ frameView->layoutViewportScrollableArea()->scrollIntoView(rectToScroll, alignX, alignY, scrollType);
}
if (ownerElement && ownerElement->layoutObject()) {
if (frameView->safeToPropagateScrollToParent()) {
parentBox = ownerElement->layoutObject()->enclosingBox();
LayoutView* parentView = ownerElement->layoutObject()->view();
- newRect = enclosingLayoutRect(view()->localToAncestorQuad(FloatRect(rect), parentView, UseTransforms | TraverseDocumentBoundaries).boundingBox());
+ newRect = enclosingLayoutRect(view()->localToAncestorQuad(FloatRect(rectToScroll), parentView, UseTransforms | TraverseDocumentBoundaries).boundingBox());
} else {
parentBox = nullptr;
}

Powered by Google App Engine
This is Rietveld 408576698