[webkit-changes] cvs commit: WebCore/khtml/html html_formimpl.cpp

Adele adele at opensource.apple.com
Thu Dec 15 15:40:38 PST 2005


adele       05/12/15 15:40:38

  Modified:    .        ChangeLog
               .        ChangeLog
               khtml/html html_formimpl.cpp
  Added:       fast/forms option-index-expected.checksum
                        option-index-expected.png option-index-expected.txt
                        option-index.html
  Log:
  LayoutTests:
  
          Test for <rdar://problem/4258232> Crash in HTMLOptionElementImpl::index when option element has no corresponding select - http://www.mattkruse.com/javascript/datadumper/
  
          * fast/forms/option-index-expected.checksum: Added.
          * fast/forms/option-index-expected.png: Added.
          * fast/forms/option-index-expected.txt: Added.
          * fast/forms/option-index.html: Added.
  
  WebCore:
  
          Reviewed by John.
  
          - Fix for <rdar://problem/4258232> Crash in HTMLOptionElementImpl::index when option element has no corresponding select - http://www.mattkruse.com/javascript/datadumper/
  
          Test: fast/forms/option-index.html
  
          * khtml/html/html_formimpl.cpp:
          (DOM::HTMLOptionElementImpl::index): nil check for select element.
  
  Revision  Changes    Path
  1.156     +9 -0      LayoutTests/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/LayoutTests/ChangeLog,v
  retrieving revision 1.155
  retrieving revision 1.156
  diff -u -r1.155 -r1.156
  --- ChangeLog	15 Dec 2005 21:06:49 -0000	1.155
  +++ ChangeLog	15 Dec 2005 23:40:33 -0000	1.156
  @@ -1,5 +1,14 @@
   2005-12-15  Adele Peterson  <adele at apple.com>
   
  +        Test for <rdar://problem/4258232> Crash in HTMLOptionElementImpl::index when option element has no corresponding select - http://www.mattkruse.com/javascript/datadumper/
  +
  +        * fast/forms/option-index-expected.checksum: Added.
  +        * fast/forms/option-index-expected.png: Added.
  +        * fast/forms/option-index-expected.txt: Added.
  +        * fast/forms/option-index.html: Added.
  +
  +2005-12-15  Adele Peterson  <adele at apple.com>
  +
           Test for <rdar://problem/4381360>, http://bugzilla.opendarwin.org/show_bug.cgi?id=6100
           REGRESSION: Focus ring on contenteditable div outlines text in overflow area instead of div (6100)
   
  
  
  
  1.1                  LayoutTests/fast/forms/option-index-expected.checksum
  
  Index: option-index-expected.checksum
  ===================================================================
  d1361aa991e964d08cafb8f223de4891
  
  
  1.1                  LayoutTests/fast/forms/option-index-expected.png
  
  	<<Binary file>>
  
  
  1.1                  LayoutTests/fast/forms/option-index-expected.txt
  
  Index: option-index-expected.txt
  ===================================================================
  layer at (0,0) size 800x600
    RenderCanvas at (0,0) size 800x600
  layer at (0,0) size 800x600
    RenderBlock {HTML} at (0,0) size 800x600
      RenderBody {BODY} at (8,8) size 784x584
        RenderBlock (anonymous) at (0,0) size 784x36
          RenderText {TEXT} at (0,0) size 741x36
            text run at (0,0) width 741: "This test makes sure we don't crash when trying to get the index of an option element that has no corresponding select"
            text run at (0,18) width 53: "element."
        RenderBlock {DIV} at (0,36) size 784x36
          RenderText {TEXT} at (0,0) size 82x18
            text run at (0,0) width 82: "Test Passed. "
          RenderBR {BR} at (0,0) size 0x0
          RenderText {TEXT} at (0,18) size 370x18
            text run at (0,18) width 370: "Index for option element with no corresponding select is: 0"
  
  
  
  1.1                  LayoutTests/fast/forms/option-index.html
  
  Index: option-index.html
  ===================================================================
  <html>
  <head>	
  <script>
  function Crash() {
      var x = new Option('t','v');
      document.getElementById('result').innerHTML = "Test Passed. <BR/> Index for option element with no corresponding select is: " + x.index;
  }
  </script>
  </head>
  <body onload="Crash()">
  This test makes sure we don't crash when trying to get the index of an option element that has no corresponding select element.
  <div id="result">Test Failed</div>
  </body>
  </html>
  
  
  1.538     +11 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.537
  retrieving revision 1.538
  diff -u -r1.537 -r1.538
  --- ChangeLog	15 Dec 2005 22:31:03 -0000	1.537
  +++ ChangeLog	15 Dec 2005 23:40:34 -0000	1.538
  @@ -1,3 +1,14 @@
  +2005-12-15  Adele Peterson  <adele at apple.com>
  +
  +        Reviewed by John.
  +
  +        - Fix for <rdar://problem/4258232> Crash in HTMLOptionElementImpl::index when option element has no corresponding select - http://www.mattkruse.com/javascript/datadumper/
  +
  +        Test: fast/forms/option-index.html
  +
  +        * khtml/html/html_formimpl.cpp:
  +        (DOM::HTMLOptionElementImpl::index): nil check for select element.
  +
   2005-12-15  Eric Seidel  <eseidel at apple.com>
   
           Reviewed by darin.
  
  
  
  1.211     +11 -8     WebCore/khtml/html/html_formimpl.cpp
  
  Index: html_formimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_formimpl.cpp,v
  retrieving revision 1.210
  retrieving revision 1.211
  diff -u -r1.210 -r1.211
  --- html_formimpl.cpp	15 Dec 2005 22:31:38 -0000	1.210
  +++ html_formimpl.cpp	15 Dec 2005 23:40:37 -0000	1.211
  @@ -3202,14 +3202,17 @@
   {
       // Let's do this dynamically. Might be a bit slow, but we're sure
       // we won't forget to update a member variable in some cases...
  -    QMemArray<HTMLElementImpl*> items = getSelect()->listItems();
  -    int l = items.count();
  -    int optionIndex = 0;
  -    for(int i = 0; i < l; i++) {
  -        if (items[i]->hasLocalName(optionTag)) {
  -            if (static_cast<HTMLOptionElementImpl*>(items[i]) == this)
  -                return optionIndex;
  -            optionIndex++;
  +    HTMLSelectElementImpl *select = getSelect();
  +    if (select) {
  +        QMemArray<HTMLElementImpl*> items = select->listItems();
  +        int l = items.count();
  +        int optionIndex = 0;
  +        for(int i = 0; i < l; i++) {
  +            if (items[i]->hasLocalName(optionTag)) {
  +                if (static_cast<HTMLOptionElementImpl*>(items[i]) == this)
  +                    return optionIndex;
  +                optionIndex++;
  +            }
           }
       }
       kdWarning() << "HTMLOptionElementImpl::index(): option not found!" << endl;
  
  
  



More information about the webkit-changes mailing list