<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>126103</bug_id>
          
          <creation_ts>2013-12-20 18:22:58 -0800</creation_ts>
          <short_desc>StyleResolver::pseudoStyleForElement don&apos;t call initElement(0) before return and cause anchor element in a incorrect visited status</short_desc>
          <delta_ts>2013-12-20 18:32:26 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P4</priority>
          <bug_severity>Minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="xiexuehui">xxhforest</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>962153</commentid>
    <comment_count>0</comment_count>
    <who name="xiexuehui">xxhforest</who>
    <bug_when>2013-12-20 18:22:58 -0800</bug_when>
    <thetext>1, Summary
this may cause EInsideLink status of RenderStyle generated by StyleResolver::styleForElement be incorrect

2, Simple Example
&lt;head&gt;
    &lt;style&gt;
        a:after {
            content:&quot;&quot;
        }
    &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;a id=&quot;test&quot; href=&quot;#test&quot; style=&quot;overflow:hidden&quot;&gt;
    click me
&lt;/a&gt;

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&apos;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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>962155</commentid>
    <comment_count>1</comment_count>
      <attachid>219823</attachid>
    <who name="xiexuehui">xxhforest</who>
    <bug_when>2013-12-20 18:26:59 -0800</bug_when>
    <thetext>Created attachment 219823
add a test html file containing the post example</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>219823</attachid>
            <date>2013-12-20 18:26:59 -0800</date>
            <delta_ts>2013-12-20 18:26:59 -0800</delta_ts>
            <desc>add a test html file containing the post example</desc>
            <filename>test.html</filename>
            <type>text/html</type>
            <size>148</size>
            <attacher name="xiexuehui">xxhforest</attacher>
            
              <data encoding="base64">77u/PGhlYWQ+CiAgICA8c3R5bGU+CiAgICAgICAgYTphZnRlciB7CiAgICAgICAgICAgIGNvbnRl
bnQ6IiIKICAgICAgICB9CiAgICA8L3N0eWxlPgo8L2hlYWQ+Cjxib2R5Pgo8YSBpZD0idGVzdCIg
aHJlZj0iI3Rlc3QiPgogICAgaGVsbG8gd29yZAo8L2E+Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>