Bug 26778 - Inspector: Duplicate Computation in Autocompletion
Summary: Inspector: Duplicate Computation in Autocompletion
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-27 19:49 PDT by Joseph Pecoraro
Modified: 2009-07-14 05:53 PDT (History)
2 users (show)

See Also:


Attachments
Removed Duplicate Computation (1.83 KB, patch)
2009-06-27 19:55 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff
Removed Duplicate Computation (1.89 KB, patch)
2009-06-27 19:57 PDT, Joseph Pecoraro
mjs: review+
Details | Formatted Diff | Diff
Removed Duplicate Computation (patch from root) (1.93 KB, patch)
2009-07-06 14:06 PDT, Joseph Pecoraro
joepeck: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2009-06-27 19:49:10 PDT
It looks like there is an unnecessary duplicated computation of a text range in the TextPrompt's autocompletion feature.

Lines 152 and 162 are identical.  The result from 152 is passed into the function and available at the point 162 does the same calculation:
http://trac.webkit.org/browser/trunk/WebCore/inspector/front-end/TextPrompt.js?rev=45315#L150
Comment 1 Joseph Pecoraro 2009-06-27 19:55:17 PDT
Created attachment 31984 [details]
Removed Duplicate Computation

This removed the computation from inside the called function.  Alternatively the computation could be removed from the calling function (line 152) and the parameter removed.
Comment 2 Joseph Pecoraro 2009-06-27 19:57:32 PDT
Created attachment 31985 [details]
Removed Duplicate Computation

Better ChangeLog (link to the bug).
Comment 3 Maciej Stachowiak 2009-07-05 04:26:47 PDT
Comment on attachment 31985 [details]
Removed Duplicate Computation

Looks good to me. I am surprised at the duplication but it certainly looks like the passed in originalWordPrefixRange is computed in an identical way, and can't have changed by the time _completionsReady is reached.
Comment 4 Eric Seidel (no email) 2009-07-06 13:45:28 PDT
The patch is from within WebCore, so bugzilla-tool fails to apply it.   https://bugs.webkit.org/show_bug.cgi?id=26999
Comment 5 Joseph Pecoraro 2009-07-06 13:59:50 PDT
I did the same as my last patch, which seemed to apply fine:
https://bugs.webkit.org/show_bug.cgi?id=26489

Is this due to the Bugzilla upgrade?  Should I go to the root and run "svn-create-patch" instead?
Comment 6 Eric Seidel (no email) 2009-07-06 14:01:24 PDT
It will apply fine. :)  I just can't do it from bugzilla-tool, because bugzilla-tool assumes patches are made from the root.  Someone can manually land this no problem.
Comment 7 Joseph Pecoraro 2009-07-06 14:06:27 PDT
Created attachment 32316 [details]
Removed Duplicate Computation (patch from root)

Removed Duplicate Computation - svn-create-patch made from the root directory.
Comment 8 Brent Fulgham 2009-07-12 20:56:05 PDT
Landed in http://trac.webkit.org/changeset/45784.
Comment 9 Joseph Pecoraro 2009-07-14 05:53:29 PDT
Since the patch landed I removed the (patch from root) from the review queue.  Cheers.