Fix FrameView::scrollElementToRect to take already scrolled amount into consideration.

https://bugs.webkit.org/show_bug.cgi?id=69220

Patch by Sadrul Habib Chowdhury <sadrul@chromium.org> on 2011-10-04
Reviewed by Simon Fraser.

Source/WebCore:

* page/FrameView.cpp:
(WebCore::FrameView::scrollElementToRect):

LayoutTests:

* fast/dom/scroll-element-to-rect.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96672 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d29926bb
2011-10-04 Sadrul Habib Chowdhury <sadrul@chromium.org>
Fix FrameView::scrollElementToRect to take already scrolled amount into consideration.
https://bugs.webkit.org/show_bug.cgi?id=69220
Reviewed by Simon Fraser.
* fast/dom/scroll-element-to-rect.html:
2011-10-04 David Barr <davidbarr@chromium.org>
Update test expectations after http://trac.webkit.org/changeset/96449
......@@ -9,8 +9,10 @@
<script src="../js/resources/js-test-pre.js"></script>
<script>
var box = document.getElementById('textbox');
if (window.internals)
if (window.internals) {
window.internals.scrollElementToRect(box, 0, 100, 300, 300);
window.internals.scrollElementToRect(box, 0, 0, 300, 300);
}
var rect = box.getBoundingClientRect();
var computedLeft = Math.floor((300 - rect.width) / 2);
......
2011-10-04 Sadrul Habib Chowdhury <sadrul@chromium.org>
Fix FrameView::scrollElementToRect to take already scrolled amount into consideration.
https://bugs.webkit.org/show_bug.cgi?id=69220
Reviewed by Simon Fraser.
* page/FrameView.cpp:
(WebCore::FrameView::scrollElementToRect):
2011-10-04 Anders Carlsson <andersca@apple.com>
Ignore the warning about using 'override'.
......@@ -1641,7 +1641,7 @@ void FrameView::scrollElementToRect(Element* element, const IntRect& rect)
LayoutRect bounds = element->getRect();
int centeringOffsetX = (rect.width() - bounds.width()) / 2;
int centeringOffsetY = (rect.height() - bounds.height()) / 2;
scrollBy(IntSize(bounds.x() - centeringOffsetX - rect.x(), bounds.y() - centeringOffsetY - rect.y()));
setScrollPosition(LayoutPoint(bounds.x() - centeringOffsetX - rect.x(), bounds.y() - centeringOffsetY - rect.y()));
}
void FrameView::setScrollPosition(const LayoutPoint& scrollPoint)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment