Bug 126103

Summary: StyleResolver::pseudoStyleForElement don't call initElement(0) before return and cause anchor element in a incorrect visited status
Product: WebKit Reporter: xiexuehui <xxhforest>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Minor    
Priority: P4    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
add a test html file containing the post example none

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