Bug 136826 - Rename Node::nodeIndex() to computeNodeIndex() for clarity
Summary: Rename Node::nodeIndex() to computeNodeIndex() for clarity
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-15 09:47 PDT by Chris Dumez
Modified: 2014-09-16 11:29 PDT (History)
4 users (show)

See Also:


Attachments
Patch (28.45 KB, patch)
2014-09-15 10:52 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (29.04 KB, patch)
2014-09-16 09:02 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2014-09-15 09:47:19 PDT
Rename Node::nodeIndex() to computeNodeIndex() to make it clearer that the node index is actually computed and thus calling this method is potentially expensive.
Comment 1 Chris Dumez 2014-09-15 10:52:06 PDT
Created attachment 238132 [details]
Patch
Comment 2 Benjamin Poulain 2014-09-16 00:35:37 PDT
Comment on attachment 238132 [details]
Patch

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

I did not check the surrounding code, no need to change the type when the fix is non obvious.

> Source/WebCore/dom/Range.cpp:603
> +    int nodeIndex = refNode->computeNodeIndex();

int -> unsigned?

> Source/WebCore/editing/ApplyStyleCommand.cpp:1294
> +        int startOffsetAdjustment = startChild->computeNodeIndex();

ditto?

> Source/WebCore/editing/ApplyStyleCommand.cpp:1328
> +        int endOffset = nextChild ? nextChild->computeNodeIndex() : nextElement->countChildNodes();

ditto?

> Source/WebCore/editing/DeleteSelectionCommand.cpp:563
> +                            offset = n->computeNodeIndex() + 1;

ditto?

> Source/WebCore/editing/Editor.cpp:166
> +        startOffset = element->computeNodeIndex();

ditto?

> Source/WebCore/editing/Editor.cpp:171
> +        endOffset = element->computeNodeIndex();

ditto?

> Source/WebCore/editing/TextIterator.cpp:1098
> +        int index = m_positionOffsetBaseNode->computeNodeIndex();

ditto?

> Source/WebCore/html/HTMLTextFormControlElement.cpp:427
> +        offsetInContainer = node->computeNodeIndex() + offset;

ditto?

> Source/WebCore/page/DOMSelection.cpp:367
> +        int offset = shadowAncestor->computeNodeIndex();

ditto?
Comment 3 Chris Dumez 2014-09-16 09:02:55 PDT
Created attachment 238183 [details]
Patch
Comment 4 WebKit Commit Bot 2014-09-16 11:29:04 PDT
Comment on attachment 238183 [details]
Patch

Clearing flags on attachment: 238183

Committed r173665: <http://trac.webkit.org/changeset/173665>
Comment 5 WebKit Commit Bot 2014-09-16 11:29:09 PDT
All reviewed patches have been landed.  Closing bug.