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

Unified Diff: Source/core/dom/Element.cpp

Issue 568453002: Removing container's Left & Top border from computed scroll offset bounds. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index dfa59f4f2814ce3975f34f7ea37db485ba2c79ae..9764d5f69351ed1be13c40422b97853cc7b74b05 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -468,6 +468,18 @@ void Element::scrollIntoViewIfNeeded(bool centerIfNeeded)
return;
LayoutRect bounds = boundingBox();
+
+ // Fix start : for crbug.com/295848.
arpitabahuguna 2014/09/11 14:14:59 You don't need this comment line.
+ // The bounding box is computed by considering the y position of element
+ // which includes the parent's top border. But scrolling does not consider
+ // border, so this border top should be removed
pals 2014/09/12 13:40:08 . at the end of the comment.
+ RenderBox* parentBox = renderer()->enclosingScrollableBox();
arpitabahuguna 2014/09/11 14:14:59 Why do you name this parentBox??
+ if (parentBox && parentBox->borderTop() > 0) {
pals 2014/09/12 13:40:08 {} not needed here.
+ bounds.setY(bounds.y().toInt() - parentBox->borderTop());
pals 2014/09/12 13:40:08 I think scrollRectTOVisible expects absolute rect.
+ }
+ parentBox = 0;
arpitabahuguna 2014/09/11 14:14:58 Not required.
+ // Fix end : for crbug.com/295848
arpitabahuguna 2014/09/11 14:14:59 Again, this line is not required.
+
if (centerIfNeeded)
renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeeded);
else
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698