Bug 126103 - StyleResolver::pseudoStyleForElement don't call initElement(0) before return and cause anchor element in a incorrect visited status
Summary: StyleResolver::pseudoStyleForElement don't call initElement(0) before return ...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P4 Minor
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-20 18:22 PST by xiexuehui
Modified: 2013-12-20 18:32 PST (History)
0 users

See Also:


Attachments
add a test html file containing the post example (148 bytes, text/html)
2013-12-20 18:26 PST, xiexuehui
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description xiexuehui 2013-12-20 18:22:58 PST
1, Summary
this may cause EInsideLink status of RenderStyle generated by StyleResolver::styleForElement be incorrect

2, Simple Example
<head>
    <style>
        a:after {
            content:""
        }
    </style>
</head>
<body>
<a id="test" href="#test" style="overflow:hidden">
    click me
</a>

3, Steps
1) open the above simple example in a mobile browser
2) click the anchor element in the above example

4, Issue
the anchor element will not be marked as visited

5, Conclusion
At first, WebCore recieve a touch event, and StyleResolver::pseudoStyleForElement was triggered.
Before pseudoStyleForElement return, initElement(0) is not called, so the anchor element is cached 
in StyleResolver
Then, WebCore receive a  mouse click event, so it is added to visited link list in PageGroup, and its
RenderStyle is recalculate. StyleResolver::styleForElement is call to give the RenderStyle, but initElement(element)
will do nothing, because the element is cached. so the anchor element's visited status will not be detected, and m_elementLinkState
will not be set to InsideVisitedLink.
finially the anchor element will not be marked as visited

6, Expect
call initElement(0) before StyleResolver::pseudoStyleForElement return to clear cache to element
Comment 1 xiexuehui 2013-12-20 18:26:59 PST
Created attachment 219823 [details]
add a test html file containing the post example