Bug 31186 - Cleanup: Rename fields RenderTextControl::m_edited and RenderTextControl::m_userEdited
Summary: Cleanup: Rename fields RenderTextControl::m_edited and RenderTextControl::m_u...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-05 13:44 PST by Daniel Bates
Modified: 2009-11-18 15:46 PST (History)
11 users (show)

See Also:


Attachments
Patch (9.74 KB, patch)
2009-11-11 16:55 PST, Daniel Bates
abarth: commit-queue-
Details | Formatted Diff | Diff
Patch (13.35 KB, patch)
2009-11-15 16:34 PST, Daniel Bates
darin: review-
Details | Formatted Diff | Diff
Patch (11.29 KB, patch)
2009-11-15 17:13 PST, Daniel Bates
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2009-11-05 13:44:52 PST
Following up on Darin's comments in bug #20780.:

We should rename the fields RenderTextControl::m_edited and RenderTextControl::m_userEdited to be more descriptive.
Comment 1 Daniel Bates 2009-11-11 16:55:40 PST
Created attachment 43020 [details]
Patch

No functionality was changed so no tests were included in this patch.

On Darin's suggestion <https://bugs.webkit.org/show_bug.cgi?id=20780#c24>, I chose to rename RenderTextControl::m_edited to wasChangedSinceLastChangeEvent, and RenderTextControl::m_userEdited to m_lastChangeWasUserEdit. I felt these names were consistent (in wording - both use the word "change" to describe the modification to the text control) and best described what these fields are for. It would have been nice if we could have more concise names for these fields, but I could not think of any.

We should probably look into re-factoring the functionality of these methods/cleanup RenderTextControl as outlined in <https://bugs.webkit.org/show_bug.cgi?id=20780#c14>. Then we may have a cleaner API.
Comment 2 Darin Adler 2009-11-12 08:36:04 PST
Comment on attachment 43020 [details]
Patch

> -        // We set m_userEdited to false since this change was not explicty made by the user (say, via typing on the keyboard), see <rdar://problem/5359921>.
> -        m_userEdited = false;
> +        // We set m_lastChangeWasUserEdit to false since this change was not explicty made by the user (say, via typing on the keyboard), see <rdar://problem/5359921>.
> +        m_lastChangeWasUserEdit = false;

It would be nice to fix the spelling of explicitly.

I don't think the "see rdar" comment is really all that useful, even for people at Apple.

I think the comment is no longer needed; the new name of the data member speaks for itself. Or if we really want one, the comment could say, "Set m_lastChangeWasUserEdit to false since this function is only used for programmatic changes, not for user editing."

As you mentioned, we should make other changes here. We don't want people to directly set these with set functions.
Comment 3 Daniel Bates 2009-11-12 10:43:45 PST
I'll just remove the comment when I land this, since the name of the field implies that we are using it to differentiate programmatic changes from user editing.

(In reply to comment #2)
> (From update of attachment 43020 [details])
> > -        // We set m_userEdited to false since this change was not explicty made by the user (say, via typing on the keyboard), see <rdar://problem/5359921>.
> > -        m_userEdited = false;
> > +        // We set m_lastChangeWasUserEdit to false since this change was not explicty made by the user (say, via typing on the keyboard), see <rdar://problem/5359921>.
> > +        m_lastChangeWasUserEdit = false;
> 
> It would be nice to fix the spelling of explicitly.
> 
> I don't think the "see rdar" comment is really all that useful, even for people
> at Apple.
> 
> I think the comment is no longer needed; the new name of the data member speaks
> for itself. Or if we really want one, the comment could say, "Set
> m_lastChangeWasUserEdit to false since this function is only used for
> programmatic changes, not for user editing."
> 
> As you mentioned, we should make other changes here. We don't want people to
> directly set these with set functions.
Comment 4 Adam Barth 2009-11-12 18:19:25 PST
Comment on attachment 43020 [details]
Patch

Dan to edit before landing.
Comment 5 Daniel Bates 2009-11-15 14:56:11 PST
Committed r50999: <http://trac.webkit.org/changeset/50999>
Comment 6 Daniel Bates 2009-11-15 15:16:04 PST
Committed r51000: <http://trac.webkit.org/changeset/51000>
Comment 7 Darin Adler 2009-11-15 15:16:53 PST
Comment on attachment 43020 [details]
Patch

Clearing review flag since Daniel will be doing a new patch that covers the rest of the call sites.
Comment 8 Daniel Bates 2009-11-15 15:17:55 PST
Commit in r50999 but failed to build on the Win build bots. So, rolled it out in r51000.

Will correct the Windows build issues.
Comment 9 Daniel Bates 2009-11-15 16:33:15 PST
Re-opening bug since we need to fix this issue.
Comment 10 Daniel Bates 2009-11-15 16:34:08 PST
Created attachment 43256 [details]
Patch

Makes my Windows build smile :-)
Comment 11 Darin Adler 2009-11-15 16:55:13 PST
Comment on attachment 43256 [details]
Patch

Changing the name of the function in DOMPrivate.idl will break compilation of Safari for Windows, although it doesn't break the compilation of WebKit itself.

I suggest you take the same approach with Windows that you did with Mac OS X. Leave the interface of WebKit for clients outside WebKit with the old name. Change only the names internal to WebKit. So the DOMPrivate.idl name would need to stay the same, as would DOMHTMLClasses.h, and the function names in DOMHTMLClasses.cpp.
Comment 12 Daniel Bates 2009-11-15 17:13:19 PST
Created attachment 43259 [details]
Patch

Updated patch based on Darin's comment.
Comment 13 WebKit Commit Bot 2009-11-18 15:46:17 PST
Comment on attachment 43259 [details]
Patch

Clearing flags on attachment: 43259

Committed r51148: <http://trac.webkit.org/changeset/51148>
Comment 14 WebKit Commit Bot 2009-11-18 15:46:31 PST
All reviewed patches have been landed.  Closing bug.