Chromium Code Reviews| Index: Source/core/editing/PositionWithAffinity.cpp |
| diff --git a/Source/core/editing/PositionWithAffinity.cpp b/Source/core/editing/PositionWithAffinity.cpp |
| index 668c408b2f6810f9070bb40f3bfa3a69c9de4815..4f380394e07e4294837db3775c0dd80e1dc5d631 100644 |
| --- a/Source/core/editing/PositionWithAffinity.cpp |
| +++ b/Source/core/editing/PositionWithAffinity.cpp |
| @@ -4,6 +4,7 @@ |
| #include "config.h" |
| #include "core/editing/PositionWithAffinity.h" |
| +#include "core/rendering/InlineBox.h" |
| namespace blink { |
| @@ -22,6 +23,28 @@ PositionWithAffinity::~PositionWithAffinity() |
| { |
| } |
| +LayoutRect PositionWithAffinity::localCaretRect(RenderObject*& renderer) const |
|
yosin_UTC9
2014/07/29 07:00:20
It seems we can return just renderer and computing
yoichio
2014/07/29 08:05:17
calling localCaretRect uses local variables |inlin
|
| +{ |
| + if (m_position.isNull()) { |
| + renderer = 0; |
|
yosin_UTC9
2014/07/29 07:00:20
nit: Let's use |nullptr|.
yoichio
2014/07/29 08:05:17
Done.
|
| + return IntRect(); |
| + } |
| + Node* node = m_position.anchorNode(); |
| + |
| + renderer = node->renderer(); |
| + if (!renderer) |
| + return LayoutRect(); |
| + |
| + InlineBox* inlineBox; |
| + int caretOffset; |
| + m_position.getInlineBoxAndOffset(m_affinity, inlineBox, caretOffset); |
| + |
| + if (inlineBox) |
| + renderer = &inlineBox->renderer(); |
| + |
| + return renderer->localCaretRect(inlineBox, caretOffset); |
| +} |
| + |
| void PositionWithAffinity::trace(Visitor* visitor) |
| { |
| visitor->trace(m_position); |