<?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>105642</bug_id>
          
          <creation_ts>2012-12-21 10:44:49 -0800</creation_ts>
          <short_desc>Dubious cast from TextTrackCueBox to HTMLDivElement.</short_desc>
          <delta_ts>2013-01-25 12:46:56 -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>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Trivial</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>106608</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Thomas Sepez">tsepez</reporter>
          <assigned_to name="Victor Carbune">vcarbune</assigned_to>
          <cc>buildbot</cc>
    
    <cc>eric.carlson</cc>
    
    <cc>japhet</cc>
    
    <cc>mjs</cc>
    
    <cc>ojan.autocc</cc>
    
    <cc>rniwa</cc>
    
    <cc>tony</cc>
    
    <cc>vcarbune</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>796373</commentid>
    <comment_count>0</comment_count>
    <who name="Thomas Sepez">tsepez</who>
    <bug_when>2012-12-21 10:44:49 -0800</bug_when>
    <thetext>In TextTrackCueBox::TextTrackCueBox(), there is an initialization of the form : HTMLElement(divTag, document).
Under V8, Initializing an element using divTag gives V8HTMLElementWrapperFactory the right to invoke createHTMLDivElementWrapper() upon the element.
createHTMLDivElementWrapper() invokes static_cast&lt;HTMLDivElement*&gt;(element).

Note however, the TextTrackCueBox inherits from HTMLElement, not HTMLDivElement, so the cast is wrong.  Presently, this does no harm at the machine code level, since HTMLDivElement doesn&apos;t modify the layout of the underlying memory.  But something could change, and then you won&apos;t be ok.

The fix would be to change to the proper base class in TextTrackCueBox.cpp.   Looking at https://bugs.webkit.org/show_bug.cgi?id=79751, this was initially the design but went off the rails at comment 34,
when rather than resolving the underlying issue, this bug was introduced as part of a workaround.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>796393</commentid>
    <comment_count>1</comment_count>
    <who name="Victor Carbune">vcarbune</who>
    <bug_when>2012-12-21 11:19:18 -0800</bug_when>
    <thetext>Thanks for pointing this out.

(In reply to comment #0)
&gt; The fix would be to change to the proper base class in TextTrackCueBox.cpp.   Looking at https://bugs.webkit.org/show_bug.cgi?id=79751, this was initially the design but went off the rails at comment 34,
&gt; when rather than resolving the underlying issue, this bug was introduced as part of a workaround.
I remember what was the issue that determined me to this.

Most of the .mm config files in WebView included HTMLElement, but not
HTMLDivElement and therefore I wasn&apos;t completely sure it&apos;s appropriate to
simply include HTMLDivElement because of WebVTT.

So would it be appropriate to actually do just do this directly?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>816695</commentid>
    <comment_count>2</comment_count>
      <attachid>184771</attachid>
    <who name="Victor Carbune">vcarbune</who>
    <bug_when>2013-01-25 10:01:44 -0800</bug_when>
    <thetext>Created attachment 184771
Trivial fix

Checking what the build-bots have to say</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>816737</commentid>
    <comment_count>3</comment_count>
      <attachid>184771</attachid>
    <who name="Build Bot">buildbot</who>
    <bug_when>2013-01-25 10:45:24 -0800</bug_when>
    <thetext>Comment on attachment 184771
Trivial fix

Attachment 184771 did not pass mac-wk2-ews (mac-wk2):
Output: http://queues.webkit.org/results/16118457</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>816742</commentid>
    <comment_count>4</comment_count>
      <attachid>184771</attachid>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-01-25 10:47:43 -0800</bug_when>
    <thetext>Comment on attachment 184771
Trivial fix

View in context: https://bugs.webkit.org/attachment.cgi?id=184771&amp;action=review

&gt; Source/WebCore/ChangeLog:8
&gt; +        Trivial change.

Please explain why we&apos;re making this change. r- due to the lack of explanation.

&gt; Source/WebCore/html/track/TextTrackCue.cpp:99
&gt; -    : HTMLElement(divTag, document)
&gt; +    : HTMLDivElement(divTag, document)

Why are we making this change? Does the spec say we should do this? If not, why should we do this?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>816769</commentid>
    <comment_count>5</comment_count>
    <who name="Victor Carbune">vcarbune</who>
    <bug_when>2013-01-25 11:07:57 -0800</bug_when>
    <thetext>(In reply to comment #4)
&gt; (From update of attachment 184771 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=184771&amp;action=review
&gt; 
&gt; &gt; Source/WebCore/ChangeLog:8
&gt; &gt; +        Trivial change.
&gt; 
&gt; Please explain why we&apos;re making this change. r- due to the lack of explanation.
As I mentioned in the comment, I wanted to see whether the build crashes on Mac
(I&apos;m sorry for not marking r- after seeing the output)

&gt; &gt; Source/WebCore/html/track/TextTrackCue.cpp:99
&gt; &gt; -    : HTMLElement(divTag, document)
&gt; &gt; +    : HTMLDivElement(divTag, document)
&gt; 
&gt; Why are we making this change? Does the spec say we should do this? If not, why should we do this?

This is not a behavior change - as pointed in the first comment of this bug,
it&apos;s wrong to use the divTag and inherit from HTMLElement instead of 
HTMLDivElement.

Cues are reusing for rendering as much as possible existing HTML elements
(such as this div), except for the last step when multiple such boxes (divs) 
overlap.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>816821</commentid>
    <comment_count>6</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-01-25 12:04:35 -0800</bug_when>
    <thetext>(In reply to comment #5)
&gt; (In reply to comment #4)
&gt; &gt; (From update of attachment 184771 [details] [details])
&gt; &gt; View in context: https://bugs.webkit.org/attachment.cgi?id=184771&amp;action=review
&gt; &gt; 
&gt; &gt; &gt; Source/WebCore/ChangeLog:8
&gt; &gt; &gt; +        Trivial change.
&gt; &gt; 
&gt; &gt; Please explain why we&apos;re making this change. r- due to the lack of explanation.
&gt; As I mentioned in the comment, I wanted to see whether the build crashes on Mac
&gt; (I&apos;m sorry for not marking r- after seeing the output)

Please don&apos;t set r- if you&apos;re not a reviewer. Instead, simply remove the flag if you don&apos;t want reviewers to review the patch.

&gt; &gt; &gt; Source/WebCore/html/track/TextTrackCue.cpp:99
&gt; &gt; &gt; -    : HTMLElement(divTag, document)
&gt; &gt; &gt; +    : HTMLDivElement(divTag, document)
&gt; &gt; 
&gt; &gt; Why are we making this change? Does the spec say we should do this? If not, why should we do this?
&gt; 
&gt; This is not a behavior change - as pointed in the first comment of this bug,
&gt; it&apos;s wrong to use the divTag and inherit from HTMLElement instead of 
&gt; HTMLDivElement.

That&apos;s certainly not true, right? We were creating a wrong wrapper in V8. That&apos;s certainly visible to JavaScript is clearly an observable bug as I understand it. e.g. prototype chain. We need a test.

&gt; Cues are reusing for rendering as much as possible existing HTML elements
&gt; (such as this div), except for the last step when multiple such boxes (divs) 
&gt; overlap.

I&apos;m not convinced that the right fix is to change the parent class to HTMLDivElement. I suspect the problem is that we&apos;re using divTag. We should probably be creating some other QualifiedName and use that instead.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>816850</commentid>
    <comment_count>7</comment_count>
    <who name="Victor Carbune">vcarbune</who>
    <bug_when>2013-01-25 12:46:56 -0800</bug_when>
    <thetext>(In reply to comment #6)
&gt; (In reply to comment #5)
&gt; &gt; (In reply to comment #4)
&gt; &gt; &gt; (From update of attachment 184771 [details] [details] [details])
&gt; &gt; &gt; View in context: https://bugs.webkit.org/attachment.cgi?id=184771&amp;action=review
&gt; &gt; &gt; 
&gt; &gt; &gt; &gt; Source/WebCore/ChangeLog:8
&gt; &gt; &gt; &gt; +        Trivial change.
&gt; &gt; &gt; 
&gt; &gt; &gt; Please explain why we&apos;re making this change. r- due to the lack of explanation.
&gt; &gt; As I mentioned in the comment, I wanted to see whether the build crashes on Mac
&gt; &gt; (I&apos;m sorry for not marking r- after seeing the output)
&gt; 
&gt; Please don&apos;t set r- if you&apos;re not a reviewer. Instead, simply remove the flag if you don&apos;t want reviewers to review the patch.
&gt; 
&gt; &gt; &gt; &gt; Source/WebCore/html/track/TextTrackCue.cpp:99
&gt; &gt; &gt; &gt; -    : HTMLElement(divTag, document)
&gt; &gt; &gt; &gt; +    : HTMLDivElement(divTag, document)
&gt; &gt; &gt; 
&gt; &gt; &gt; Why are we making this change? Does the spec say we should do this? If not, why should we do this?
&gt; &gt; 
&gt; &gt; This is not a behavior change - as pointed in the first comment of this bug,
&gt; &gt; it&apos;s wrong to use the divTag and inherit from HTMLElement instead of 
&gt; &gt; HTMLDivElement.
&gt; 
&gt; That&apos;s certainly not true, right? We were creating a wrong wrapper in V8. That&apos;s certainly visible to JavaScript is clearly an observable bug as I understand it. e.g. prototype chain. We need a test.

I meant purely from the final outcome regarding cue rendering. It doesn&apos;t 
change how they are displayed.

The TextTrackCueBox is used only internally and your observation is valid, indeed.
 
&gt; &gt; Cues are reusing for rendering as much as possible existing HTML elements
&gt; &gt; (such as this div), except for the last step when multiple such boxes (divs) 
&gt; &gt; overlap.
&gt; 
&gt; I&apos;m not convinced that the right fix is to change the parent class to HTMLDivElement. I suspect the problem is that we&apos;re using divTag. We should probably be creating some other QualifiedName and use that instead.

Makes sense, if even more custom logic appears on top of elements that have the
divTag (and would rely on a specific memory layout).</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>184771</attachid>
            <date>2013-01-25 10:01:44 -0800</date>
            <delta_ts>2013-01-25 10:47:43 -0800</delta_ts>
            <desc>Trivial fix</desc>
            <filename>bug-105642-20130125195834.patch</filename>
            <type>text/plain</type>
            <size>2121</size>
            <attacher name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MDY0NAotLS0gYS9Tb3VyY2UvV2ViQ29yZS9odG1sL3RyYWNrL1RleHRUcmFja0N1ZS5oCisr
KyBiL1NvdXJjZS9XZWJDb3JlL2h0bWwvdHJhY2svVGV4dFRyYWNrQ3VlLmgKQEAgLTM1LDcgKzM1
LDcgQEAKICNpZiBFTkFCTEUoVklERU9fVFJBQ0spCiAKICNpbmNsdWRlICJFdmVudFRhcmdldC5o
IgotI2luY2x1ZGUgIkhUTUxFbGVtZW50LmgiCisjaW5jbHVkZSAiSFRNTERpdkVsZW1lbnQuaCIK
ICNpbmNsdWRlICJUZXh0VHJhY2suaCIKICNpbmNsdWRlIDx3dGYvUGFzc093blB0ci5oPgogI2lu
Y2x1ZGUgPHd0Zi9SZWZDb3VudGVkLmg+CkBAIC01MCw3ICs1MCw3IEBAIGNsYXNzIFRleHRUcmFj
a0N1ZTsKIAogLy8gLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQogCi1jbGFzcyBUZXh0VHJh
Y2tDdWVCb3ggOiBwdWJsaWMgSFRNTEVsZW1lbnQgeworY2xhc3MgVGV4dFRyYWNrQ3VlQm94IDog
cHVibGljIEhUTUxEaXZFbGVtZW50IHsKIHB1YmxpYzoKICAgICBzdGF0aWMgUGFzc1JlZlB0cjxU
ZXh0VHJhY2tDdWVCb3g+IGNyZWF0ZShEb2N1bWVudCogZG9jdW1lbnQsIFRleHRUcmFja0N1ZSog
Y3VlKQogICAgIHsK
</data>
<flag name="review"
          id="203604"
          type_id="1"
          status="-"
          setter="rniwa"
    />
    <flag name="commit-queue"
          id="203615"
          type_id="3"
          status="-"
          setter="buildbot"
    />
          </attachment>
      

    </bug>

</bugzilla>