Bug 44229 - Range, EAnnotateForInterchange, and EAbsoluteURLs should be member variables of MarkupAccumulator
Summary: Range, EAnnotateForInterchange, and EAbsoluteURLs should be member variables ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Enhancement
Assignee: Ryosuke Niwa
URL:
Keywords:
Depends on: 43936
Blocks: 44288
  Show dependency treegraph
 
Reported: 2010-08-18 20:31 PDT by Ryosuke Niwa
Modified: 2010-08-19 12:50 PDT (History)
5 users (show)

See Also:


Attachments
cleanup (18.55 KB, patch)
2010-08-18 20:51 PDT, Ryosuke Niwa
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2010-08-18 20:31:57 PDT
We currently pass Range, EAnnotateForInterchange, and EAbsoluteURLs variables through various member functions of MarkupAccumulator.  But we should make all three member variables of MarkupAccumulator so that we don't pass around them needlessly.
Comment 1 Ryosuke Niwa 2010-08-18 20:51:30 PDT
Created attachment 64807 [details]
cleanup
Comment 2 Darin Adler 2010-08-19 00:49:13 PDT
Comment on attachment 64807 [details]
cleanup

> +    inline bool shouldResolveURLs() { return m_shouldResolveURLs == AbsoluteURLs; }
> +    inline bool shouldAnnotate() { return m_shouldAnnotate == AnnotateForInterchange; }

No need for the inline keyword here. All function bodies in a class definition are treated as if marked within line.

> +    const Range* m_range;

Since you're doing all the const, this could be const Range* const to make it clear that the range pointer is also constant. Not that I think the const is all that helpful.

r=me
Comment 3 Ryosuke Niwa 2010-08-19 10:13:50 PDT
(In reply to comment #2)
> (From update of attachment 64807 [details])
> > +    inline bool shouldResolveURLs() { return m_shouldResolveURLs == AbsoluteURLs; }
> > +    inline bool shouldAnnotate() { return m_shouldAnnotate == AnnotateForInterchange; }
> 
> No need for the inline keyword here. All function bodies in a class definition are treated as if marked within line.

Will remove inline keyword.

> > +    const Range* m_range;
> 
> Since you're doing all the const, this could be const Range* const to make it clear that the range pointer is also constant. Not that I think the const is all that helpful.

Will add const to m_nodes and m_range.  Having const signifies the fact m_range isn't supposed to change and neither is the Range object pointed by m_range.  IMHO, it helps people reading the code because we then don't have to worry about the possibility of m_range being used as a shared state between member functions.
Comment 4 Ryosuke Niwa 2010-08-19 10:16:22 PDT
Committed r65680: <http://trac.webkit.org/changeset/65680>