Chromium Code Reviews| Index: third_party/WebKit/Source/core/editing/EphemeralRange.cpp |
| diff --git a/third_party/WebKit/Source/core/editing/EphemeralRange.cpp b/third_party/WebKit/Source/core/editing/EphemeralRange.cpp |
| index 2767484862f96592db1f214fa106e2e365b7abd3..c8c884c98b20a475dcd40bb1a87489e5505fdc13 100644 |
| --- a/third_party/WebKit/Source/core/editing/EphemeralRange.cpp |
| +++ b/third_party/WebKit/Source/core/editing/EphemeralRange.cpp |
| @@ -8,6 +8,8 @@ |
| #include "core/dom/Element.h" |
| #include "core/dom/Range.h" |
| #include "core/dom/Text.h" |
| +#include "core/layout/LayoutObject.h" |
| +#include "core/layout/LayoutText.h" |
| namespace blink { |
| @@ -146,6 +148,28 @@ EphemeralRangeTemplate<Strategy>::rangeOfContents(const Node& node) { |
| PositionTemplate<Strategy>::lastPositionInNode(&const_cast<Node&>(node))); |
| } |
| +template <typename Strategy> |
| +void EphemeralRangeTemplate<Strategy>::textQuads( |
|
Xiaocheng
2017/03/24 18:19:26
I'm shocked by that we currently don't have unit t
yoichio
2017/03/27 05:24:46
We want EphemeralRange to be independent from Layo
tanvir
2017/03/28 13:39:08
Done.
tanvir
2017/03/28 13:39:08
Done.
|
| + Vector<FloatQuad>& quads) const { |
| + Node* startContainer = m_startPosition.computeContainerNode(); |
| + DCHECK(startContainer); |
| + Node* endContainer = m_endPosition.computeContainerNode(); |
| + DCHECK(endContainer); |
| + |
| + for (Node& node : nodes()) { |
| + LayoutObject* r = node.layoutObject(); |
|
yosin_UTC9
2017/03/27 05:43:14
Please avoid to use one letter variable name.
BTW,
tanvir
2017/03/28 13:39:08
Done.
|
| + if (!r || !r->isText()) |
| + continue; |
| + LayoutText* layoutText = toLayoutText(r); |
| + unsigned startOffset = |
| + node == startContainer ? m_startPosition.offsetInContainerNode() : 0; |
| + unsigned endOffset = node == endContainer |
| + ? m_endPosition.offsetInContainerNode() |
| + : std::numeric_limits<unsigned>::max(); |
| + layoutText->absoluteQuadsForRange(quads, startOffset, endOffset); |
| + } |
| +} |
| + |
| #if DCHECK_IS_ON() |
| template <typename Strategy> |
| bool EphemeralRangeTemplate<Strategy>::isValid() const { |