<?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>77878</bug_id>
          
          <creation_ts>2012-02-06 08:49:13 -0800</creation_ts>
          <short_desc>[gtk] Accessibility: use find funtion in vector instead of for.</short_desc>
          <delta_ts>2012-02-22 01:28:49 -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>New Bugs</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Frederik Gladhorn">gladhorn</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>mario</cc>
    
    <cc>mrobinson</cc>
    
    <cc>pnormand</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>550033</commentid>
    <comment_count>0</comment_count>
    <who name="Frederik Gladhorn">gladhorn</who>
    <bug_when>2012-02-06 08:49:13 -0800</bug_when>
    <thetext>[gtk] Accessibility: use find funtion in vector instead of for.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>550036</commentid>
    <comment_count>1</comment_count>
      <attachid>125658</attachid>
    <who name="Frederik Gladhorn">gladhorn</who>
    <bug_when>2012-02-06 08:53:55 -0800</bug_when>
    <thetext>Created attachment 125658
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>550827</commentid>
    <comment_count>2</comment_count>
      <attachid>125658</attachid>
    <who name="Mario Sanchez Prada">mario</who>
    <bug_when>2012-02-07 04:16:10 -0800</bug_when>
    <thetext>Comment on attachment 125658
Patch

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

Thanks for the patch, Frederik. Just informally reviewing now. See some comments below...

&gt; Source/WebCore/ChangeLog:9
&gt; +        find function was basically reimplemented here.

No, there was no good reason for implementing that part that way, other than probably not realizing of the find() function being there. 

Anyway, I&apos;m not sure this &quot;but I was wondering why&quot; part is something that should be in the ChangeLog. I would probably leave it as &quot;This is only a minor cleanup, as the find function was basically being reimplemented.&quot; (I&apos;d avoid &quot;here&quot; unless you&apos;re using this sentence below, in the part of changelog where the function name is explicitly listed.

&gt; Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp:399
&gt; +    return parent-&gt;children().find(coreObject);

I&apos;m fine with the change. Just a minor nitpick: WTF::Vector::find() returns notFound (from NotFound.h) instead of plainly returning -1 so, even if it&apos;s actually the same thing in practise, I think it&apos;d be better to replace this with something like this:

    [...]
    size_t indexFound = parent-&gt;children().find(coreObject);
    if (indexFound == WTF::notFound)
      return -1;

    return indexFound;
  }</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>550892</commentid>
    <comment_count>3</comment_count>
      <attachid>125826</attachid>
    <who name="Frederik Gladhorn">gladhorn</who>
    <bug_when>2012-02-07 05:30:29 -0800</bug_when>
    <thetext>Created attachment 125826
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>550893</commentid>
    <comment_count>4</comment_count>
    <who name="Frederik Gladhorn">gladhorn</who>
    <bug_when>2012-02-07 05:30:54 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; (From update of attachment 125658 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=125658&amp;action=review
&gt; 
&gt; Thanks for the patch, Frederik. Just informally reviewing now. See some comments below...
&gt; 
&gt; &gt; Source/WebCore/ChangeLog:9
&gt; &gt; +        find function was basically reimplemented here.
&gt; 
&gt; No, there was no good reason for implementing that part that way, other than probably not realizing of the find() function being there. 
&gt; 
&gt; Anyway, I&apos;m not sure this &quot;but I was wondering why&quot; part is something that should be in the ChangeLog. I would probably leave it as &quot;This is only a minor cleanup, as the find function was basically being reimplemented.&quot; (I&apos;d avoid &quot;here&quot; unless you&apos;re using this sentence below, in the part of changelog where the function name is explicitly listed.

Sure, changelog cleaned up.

&gt; 
&gt; &gt; Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp:399
&gt; &gt; +    return parent-&gt;children().find(coreObject);
&gt; 
&gt; I&apos;m fine with the change. Just a minor nitpick: WTF::Vector::find() returns notFound (from NotFound.h) instead of plainly returning -1 so, even if it&apos;s actually the same thing in practise, I think it&apos;d be better to replace this with something like this:
&gt; 
&gt;     [...]
&gt;     size_t indexFound = parent-&gt;children().find(coreObject);
&gt;     if (indexFound == WTF::notFound)
&gt;       return -1;
&gt; 
&gt;     return indexFound;
&gt;   }
It&apos;s your code ;) I just thought it might be nice to have it a little easier to read. I personally would prefer the one liner, but I guess that&apos;s a matter of taste.
Also mind that I didn&apos;t compile it since I don&apos;t even have the dependencies to build the gtk port.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>550898</commentid>
    <comment_count>5</comment_count>
    <who name="Mario Sanchez Prada">mario</who>
    <bug_when>2012-02-07 05:37:41 -0800</bug_when>
    <thetext>(In reply to comment #4)
&gt; [...]
&gt; It&apos;s your code ;) I just thought it might be nice to have it a little easier to read. I personally would prefer the
&gt; one liner, but I guess that&apos;s a matter of taste. 

Actually it is not :-). That code comes from the former, old and big, AccessibilityObjectWrapperAtk.cpp file that we used to have prior to the refactoring, and that specific implementation is not mind, IIRC, so that&apos;s why it got into this new file without me noticing.

In any case, I appreciate very much this refactoring since it&apos;s definitely easier to read, but still I personally think it would be better to explicitly consider this WTF:notFound value, as it&apos;s done in other places, such as AccessibilityObject.cpp.

&gt; Also mind that I didn&apos;t compile it since I don&apos;t even have the dependencies to build the gtk port.

Well, the EWS says it&apos;s building fine, and the change seems to be pretty harmless :-)

Anyway, I&apos;m not a reviewer yet, so I&apos;m CCing people who is to see if we can get this in.

Thank you!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>560612</commentid>
    <comment_count>6</comment_count>
      <attachid>125826</attachid>
    <who name="Hajime Morrita">morrita</who>
    <bug_when>2012-02-20 21:06:20 -0800</bug_when>
    <thetext>Comment on attachment 125826
Patch

Looks good. And simple enough ;-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>561738</commentid>
    <comment_count>7</comment_count>
      <attachid>125826</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-02-22 01:28:42 -0800</bug_when>
    <thetext>Comment on attachment 125826
Patch

Clearing flags on attachment: 125826

Committed r108463: &lt;http://trac.webkit.org/changeset/108463&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>561739</commentid>
    <comment_count>8</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-02-22 01:28:49 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>125658</attachid>
            <date>2012-02-06 08:53:55 -0800</date>
            <delta_ts>2012-02-07 05:30:20 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-77878-20120206175352.patch</filename>
            <type>text/plain</type>
            <size>1799</size>
            <attacher name="Frederik Gladhorn">gladhorn</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTA2NDk3CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggNzhiNGNhNDljNjgwNThi
OWVhNzQ0ZmUyN2ZiNDc4MzE0YzRmYjY4Y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CiAKIHN0YXRpYyBBdGtBdHRyaWJ1dGVTZXQqIHdlYmtpdEFjY2Vzc2libGVH
ZXRBdHRyaWJ1dGVzKEF0a09iamVjdCogb2JqZWN0KQo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>125826</attachid>
            <date>2012-02-07 05:30:29 -0800</date>
            <delta_ts>2012-02-22 01:28:42 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-77878-20120207143022.patch</filename>
            <type>text/plain</type>
            <size>1793</size>
            <attacher name="Frederik Gladhorn">gladhorn</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTA2NDk3CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggNzhiNGNhNDljNjgwNThi
OWVhNzQ0ZmUyN2ZiNDc4MzE0YzRmYjY4Yi4uMDExZjZmZGFjMDYzZWZiZmY2MGY0YTk2ZmU2MTNj
MTIyNTNmOGQxMCAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDE1IEBACisyMDEyLTAyLTA2ICBGcmVk
ZXJpayBHbGFkaG9ybiAgPGZyZWRlcmlrLmdsYWRob3JuQG5va2lhLmNvbT4KKworICAgICAgICBb
Z3RrXSBBY2Nlc3NpYmlsaXR5OiB1c2UgZmluZCBmdW50aW9uIGluIHZlY3RvciBpbnN0ZWFkIG9m
IGZvci4KKyAgICAgICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTc3
ODc4CisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAgTWlu
b3IgY2xlYW51cCwgdXNlIHRoZSBmaW5k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