Commit 46a76ae0 authored by yoichio@chromium.org's avatar yoichio@chromium.org

[CodeHealth][Editing] Refactor EphemeralRange::isNull/isNotNull impl.

Replace null with isNull in comment because 'null' means nullptr typically.
We prefer not to use double negation so reverse impl in isNull and isNotNull.
It gets straightforward.

BUG=

Review URL: https://codereview.chromium.org/1318913004

git-svn-id: svn://svn.chromium.org/blink/trunk@201297 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 2c9429b7
...@@ -117,13 +117,6 @@ bool EphemeralRangeTemplate<Strategy>::isCollapsed() const ...@@ -117,13 +117,6 @@ bool EphemeralRangeTemplate<Strategy>::isCollapsed() const
return m_startPosition == m_endPosition; return m_startPosition == m_endPosition;
} }
template <typename Strategy>
bool EphemeralRangeTemplate<Strategy>::isNotNull() const
{
ASSERT(isValid());
return m_startPosition.isNotNull();
}
template <typename Strategy> template <typename Strategy>
EphemeralRangeTemplate<Strategy> EphemeralRangeTemplate<Strategy>::rangeOfContents(const Node& node) EphemeralRangeTemplate<Strategy> EphemeralRangeTemplate<Strategy>::rangeOfContents(const Node& node)
{ {
......
...@@ -40,9 +40,9 @@ class CORE_TEMPLATE_CLASS_EXPORT EphemeralRangeTemplate final { ...@@ -40,9 +40,9 @@ class CORE_TEMPLATE_CLASS_EXPORT EphemeralRangeTemplate final {
public: public:
EphemeralRangeTemplate(const PositionAlgorithm<Strategy>& start, const PositionAlgorithm<Strategy>& end); EphemeralRangeTemplate(const PositionAlgorithm<Strategy>& start, const PositionAlgorithm<Strategy>& end);
EphemeralRangeTemplate(const EphemeralRangeTemplate& other); EphemeralRangeTemplate(const EphemeralRangeTemplate& other);
// |position| should be null or in-document. // |position| should be |Position::isNull()| or in-document.
explicit EphemeralRangeTemplate(const PositionAlgorithm<Strategy>& /* position */); explicit EphemeralRangeTemplate(const PositionAlgorithm<Strategy>& /* position */);
// When |range| is nullptr, |EphemeralRangeTemplate| is null. // When |range| is nullptr, |EphemeralRangeTemplate| is |isNull()|.
explicit EphemeralRangeTemplate(const Range* /* range */); explicit EphemeralRangeTemplate(const Range* /* range */);
EphemeralRangeTemplate(); EphemeralRangeTemplate();
~EphemeralRangeTemplate(); ~EphemeralRangeTemplate();
...@@ -58,8 +58,12 @@ public: ...@@ -58,8 +58,12 @@ public:
// Returns true if |m_startPositoin| == |m_endPosition| or |isNull()|. // Returns true if |m_startPositoin| == |m_endPosition| or |isNull()|.
bool isCollapsed() const; bool isCollapsed() const;
bool isNull() const { return !isNotNull(); } bool isNull() const
bool isNotNull() const; {
ASSERT(isValid());
return m_startPosition.isNull();
}
bool isNotNull() const { return !isNull(); }
DEFINE_INLINE_TRACE() DEFINE_INLINE_TRACE()
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment