Bug 5759 - Links to anchors jump to wrong place (horizontally)
Summary: Links to anchors jump to wrong place (horizontally)
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P1 Normal
Assignee: Adele Peterson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-16 09:58 PST by Christopher Stevenson
Modified: 2005-11-16 16:31 PST (History)
1 user (show)

See Also:


Attachments
testcase html page (2.54 KB, text/html)
2005-11-16 09:59 PST, Christopher Stevenson
no flags Details
Patch to fix anchor scrolling problem (2.47 KB, patch)
2005-11-16 14:38 PST, Adele Peterson
no flags Details | Formatted Diff | Diff
new patch for anchor scrolling (2.61 KB, patch)
2005-11-16 15:16 PST, Adele Peterson
adele: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Stevenson 2005-11-16 09:58:42 PST
When Webkit jumps horizontally to an anchor it displays the begining of it in the top right and not the top 
left of the browser (despite the code having a work-around which is sound for IE PC).

Test case page at :

http://www.aplacecalledcommon.co.uk/testcase/index.html
Comment 1 Christopher Stevenson 2005-11-16 09:59:52 PST
Created attachment 4698 [details]
testcase html page
Comment 2 mitz 2005-11-16 12:06:19 PST
Confirmed on TOT. I think this is a regression from after bug 4964 was fixed. The testcase for that bug is 
broken as well on TOT.
Comment 3 mitz 2005-11-16 12:10:12 PST
P1 since it's a regression from WebKit-416.11
Comment 4 Vicki Murley 2005-11-16 13:05:23 PST
Adele, looks like <rdar://problem/4318167> REGRESSION: content doesn't scroll far enough to the left 
after clicking links at aplacecalledcommon.co.uk is back!
Comment 5 Vicki Murley 2005-11-16 13:22:45 PST
In Radar as <rdar://problem/4346132>
Comment 6 Adele Peterson 2005-11-16 14:38:19 PST
Created attachment 4704 [details]
Patch to fix anchor scrolling problem

This patch fixes two bugs.  First, in getRect- if the width or the height was
0, then we would set both the width and height to -1.  This is clearly wrong. 
Second, in scrollRectToVisible - if we were trying to do the minimum amount of
scrolling, and a rect was off-screen to the right, we scroll to line up the
right edge of the rect, to the right edge of the window.  This doesn't work
right if the node's rect is bigger than the window.  So now we check for that,
and align to the left side in that case.
Comment 7 David Harrison 2005-11-16 14:57:26 PST
Looks good except don't you still want to return an empty rect rather than one with a negative width or 
height?

if ( xEnd < xPos || yEnd < yPos )
    return QRect( QPoint( xPos, yPos ), QSize() );
Comment 8 Adele Peterson 2005-11-16 15:00:51 PST
excellent point Dave!  I'll attach a new patch
Comment 9 Adele Peterson 2005-11-16 15:02:16 PST
well...if the width is negative, don't we want to only set that to 0?  and not the height also in case the 
height is positive?
Comment 10 Adele Peterson 2005-11-16 15:16:54 PST
Created attachment 4705 [details]
new patch for anchor scrolling
Comment 11 Adele Peterson 2005-11-16 16:14:54 PST
Comment on attachment 4705 [details]
new patch for anchor scrolling

Dave Harrison reviewed this