https://bugs.webkit.org/show_bug.cgi?id=68815
Source/WebCore:
Reviewed by Dan Bernstein.
FrameView::scrollElementToRect() was incorrectly using Element::boundsInWindowSpace(),
which is window-relative (not web view-relative), and has flipped coordinates
in WebKit1.
Change to use Node::getRect() which is what the author intended.
* dom/Element.h:
* page/FrameView.cpp:
(WebCore::FrameView::scrollElementToRect):
LayoutTests:
Reviewed by Dan Bernstein.
Fix these tests to not throw errors when window.internals is not available.
* fast/dom/scroll-element-to-rect-centered.html:
* fast/dom/scroll-element-to-rect.html:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96278
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-09-28 Simon Fraser <simon.fraser@apple.com>
+
+ fast/dom/scroll-element-to-rect.html fails on WK1 Mac port
+ https://bugs.webkit.org/show_bug.cgi?id=68815
+
+ Reviewed by Dan Bernstein.
+
+ Fix these tests to not throw errors when window.internals is not available.
+
+ * fast/dom/scroll-element-to-rect-centered.html:
+ * fast/dom/scroll-element-to-rect.html:
+
2011-09-28 Ryosuke Niwa <rniwa@webkit.org>
Qt rebsaeline after r96257. It seems like the difference is coming from the font used in select element.
</body>
<script src="../js/resources/js-test-pre.js"></script>
<script>
- if (window.internals) {
- var box = document.getElementById('textbox');
+ var box = document.getElementById('textbox');
+ if (window.internals)
window.internals.scrollElementToRect(box, 50, 30, 200, 250);
- }
+
var rect = box.getBoundingClientRect();
var computedLeft = 50 + Math.floor((200 - rect.width) / 2);
var computedTop = 30 + Math.floor((250 - rect.height) / 2);
</body>
<script src="../js/resources/js-test-pre.js"></script>
<script>
- if (window.internals) {
- var box = document.getElementById('textbox');
+ var box = document.getElementById('textbox');
+ if (window.internals)
window.internals.scrollElementToRect(box, 0, 0, 300, 300);
- }
+
var rect = box.getBoundingClientRect();
var computedLeft = Math.floor((300 - rect.width) / 2);
var computedTop = Math.floor((300 - rect.height) / 2);
+2011-09-28 Simon Fraser <simon.fraser@apple.com>
+
+ fast/dom/scroll-element-to-rect.html fails on WK1 Mac port
+ https://bugs.webkit.org/show_bug.cgi?id=68815
+
+ Reviewed by Dan Bernstein.
+
+ FrameView::scrollElementToRect() was incorrectly using Element::boundsInWindowSpace(),
+ which is window-relative (not web view-relative), and has flipped coordinates
+ in WebKit1.
+
+ Change to use Node::getRect() which is what the author intended.
+
+ * dom/Element.h:
+ * page/FrameView.cpp:
+ (WebCore::FrameView::scrollElementToRect):
+
2011-09-28 Peter Beverloo <peter@chromium.org>
Don't clamp cubic-bezier timing functions between 0 and 1
virtual int scrollWidth();
virtual int scrollHeight();
+ // Note that the 'window space' has a flipped coordinate system on some platforms.
LayoutRect boundsInWindowSpace();
PassRefPtr<ClientRectList> getClientRects();
{
m_frame->document()->updateLayoutIgnorePendingStylesheets();
- LayoutRect bounds = element->boundsInWindowSpace();
+ 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()));