<?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>79719</bug_id>
          
          <creation_ts>2012-02-27 17:09:06 -0800</creation_ts>
          <short_desc>Hover State + Custom Attributes Fail</short_desc>
          <delta_ts>2012-03-06 14:38:50 -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>CSS</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>79774</dup_id>
          
          <bug_file_loc>http://jsbin.com/akulos</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jeffrey Way">jeffrey</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>davidbarr</cc>
    
    <cc>kling</cc>
    
    <cc>koivisto</cc>
    
    <cc>shanestephens</cc>
    
    <cc>shezbaig.wk</cc>
    
    <cc>simon.fraser</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>566148</commentid>
    <comment_count>0</comment_count>
    <who name="Jeffrey Way">jeffrey</who>
    <bug_when>2012-02-27 17:09:06 -0800</bug_when>
    <thetext>1. Visit this demo: http://jsbin.com/akulos
2. Hover over the boxer image. It should add a red outline -- img[data-type=&quot;thing&quot;]:hover { outline: 5px solid red; }. 

Tested in Webkit nightly, but still doesn&apos;t work. If you select the element from dev tools, that somehow triggers it into working.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>571912</commentid>
    <comment_count>1</comment_count>
    <who name="Shezan Baig">shezbaig.wk</who>
    <bug_when>2012-03-06 09:37:39 -0800</bug_when>
    <thetext>Hi, is anyone already investigating this issue?  I took a quick look and the bug happens because the last two images share the same RenderStyle as the first image.  In CSSStyleSelector::styleForElement, allowSharing is true, and locateSharedStyle() returns the RenderStyle for the first image (which doesn&apos;t have the hover rule).

A couple of ways to fix this I can think of:

1. add a check in CSSStyleSelector::canShareStyleWithElement, which looks at the attributes of m_element and returns false if CSSStyleSelector::hasSelectorForAttribute returns true for any of the attributes

2. add a flag in MatchOptions (something like &apos;ignoreHoverOrActiveState&apos;), and set this flag to true inside matchesRuleSet (which, right now, is only used from locateSharedStyle).  This flag will make SelectorChecker::checkOneSelector ignore the state of element-&gt;hovered() and element-&gt;active() when evaluating PseudoHover and PseudoActive.

(1) is definitely simpler, but would result in many false positives, which will reduce the likelihood of sharing styles.  (2) is a little more complex but more &quot;correct&quot;.  Also, right now I&apos;m only considering &apos;hover&apos; and &apos;active&apos; states, but theoretically we should be able to specify more states to ignore in MatchOptions (e.g. focus etc)

I was wondering if anybody was already working on this before I start hacking.  Also, I&apos;m looking for feedback on these 2 approaches (and also if there are any other possible approaches).

Thanks, -shez-</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>572128</commentid>
    <comment_count>2</comment_count>
    <who name="Shezan Baig">shezbaig.wk</who>
    <bug_when>2012-03-06 13:57:46 -0800</bug_when>
    <thetext>I&apos;m starting to realize that (1) is the better fix, as it will also fix https://bugs.webkit.org/show_bug.cgi?id=79774, which seems somewhat related to this bug.  David, do you want to make this a dup of that bug?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>572144</commentid>
    <comment_count>3</comment_count>
    <who name="Shezan Baig">shezbaig.wk</who>
    <bug_when>2012-03-06 14:11:54 -0800</bug_when>
    <thetext>correction: option (1) should be at the end of CSSStyleSelector::locateSharedStyle, not CSSStyleSelector::canShareStyleWithElement</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>572156</commentid>
    <comment_count>4</comment_count>
    <who name="David Barr">davidbarr</who>
    <bug_when>2012-03-06 14:38:50 -0800</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 79774 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>