Re: [webkit-dev] Please do NOT call Position::Position(node, offset) or Position::node()
I thought this will add unnecessary noise to svn log but I changed my mind because I find it really hard to locate all call sites of Position::node(). https://bugs.webkit.org/show_bug.cgi?id=54622 https://bugs.webkit.org/show_bug.cgi?id=54622- Ryosuke On Thu, Jan 20, 2011 at 11:17 AM, Adam Barth aba...@webkit.org wrote: One approach we've used in other code is to put the word deprecated in the name of the function in question. That makes these issues very visible in code reviews. For a constructor, you can require an enum value with depreciated in its name. Adam On Wed, Jan 19, 2011 at 6:11 PM, Ryosuke Niwa rn...@webkit.org wrote: Hi everyone, Please DO NOT instantiate a Position object by Position::Position(PassRefPtrNode anchorNode, int offset) or call Position::node(). The above constructor creates a legacy editing position, which we're trying to get rid of [1]. Please use Position(PassRefPtrNode anchorNode, int offset, AnchorType) with PositionIsOffsetInAnchor or call one of helper functions in Position.h such as positionBeforeNode, and positionAfterNode. Position::node() is a deprecated function [2]. Please call either one of containerNode(), computeNodeAfterPosition(), or computeNodeBeforePosition() instead. Ping me on IRC (rniwa) or email me if you have any questions. [1] Bug 52099 - [Meta] Get rid of legacy editing position [2] Most callers of node() intend to obtain the node that contains the position. However, when a position is before or after a node (i.e. anchor type is PositionIsBeforeNode or PositionIsAfterNode), node() returns the position's anchor node that resides either after or before the position and does NOT contain the position. Conversely, when a position is offset in a node, node() returns the container node that is neither before nor after the node. If a caller of node() is aware of these differences and has a different logic for each type, then it should be calling anchorNode() instead. Best regards, Ryosuke Niwa Software Engineer Google Inc. ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
[webkit-dev] Please do NOT call Position::Position(node, offset) or Position::node()
Hi everyone, Please DO NOT instantiate a Position object by Position::Position(PassRefPtr Node anchorNode, int offset) or call Position::node(). The above constructor creates a legacy editing position, which we're trying to get rid of [1]. Please use Position(PassRefPtrNode anchorNode, int offset, AnchorType) with PositionIsOffsetInAnchor or call one of helper functions in Position.h such as positionBeforeNode, and positionAfterNode. Position::node() is a deprecated function [2]. Please call either one of containerNode(), computeNodeAfterPosition(), or computeNodeBeforePosition() instead. Ping me on IRC (rniwa) or email me rn...@webkit.org if you have any questions. [1] Bug 52099 - [Meta] Get rid of legacy editing positionhttps://bugs.webkit.org/show_bug.cgi?id=52099 [2] Most callers of node() intend to obtain the node that contains the position. However, when a position is before or after a node (i.e. anchor type is PositionIsBeforeNode or PositionIsAfterNode), node() returns the position's anchor node that resides either after or before the position and does NOT contain the position. Conversely, when a position is offset in a node, node() returns the container node that is neither before nor after the node. If a caller of node() is aware of these differences and has a different logic for each type, then it should be calling anchorNode() instead. Best regards, Ryosuke Niwa Software Engineer Google Inc. ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] Please do NOT call Position::Position(node, offset) or Position::node()
One approach we've used in other code is to put the word deprecated in the name of the function in question. That makes these issues very visible in code reviews. For a constructor, you can require an enum value with depreciated in its name. Adam On Wed, Jan 19, 2011 at 6:11 PM, Ryosuke Niwa rn...@webkit.org wrote: Hi everyone, Please DO NOT instantiate a Position object by Position::Position(PassRefPtrNode anchorNode, int offset) or call Position::node(). The above constructor creates a legacy editing position, which we're trying to get rid of [1]. Please use Position(PassRefPtrNode anchorNode, int offset, AnchorType) with PositionIsOffsetInAnchor or call one of helper functions in Position.h such as positionBeforeNode, and positionAfterNode. Position::node() is a deprecated function [2]. Please call either one of containerNode(), computeNodeAfterPosition(), or computeNodeBeforePosition() instead. Ping me on IRC (rniwa) or email me if you have any questions. [1] Bug 52099 - [Meta] Get rid of legacy editing position [2] Most callers of node() intend to obtain the node that contains the position. However, when a position is before or after a node (i.e. anchor type is PositionIsBeforeNode or PositionIsAfterNode), node() returns the position's anchor node that resides either after or before the position and does NOT contain the position. Conversely, when a position is offset in a node, node() returns the container node that is neither before nor after the node. If a caller of node() is aware of these differences and has a different logic for each type, then it should be calling anchorNode() instead. Best regards, Ryosuke Niwa Software Engineer Google Inc. ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev