Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: third_party/WebKit/Source/core/editing/VisibleUnits.cpp

Issue 2775663008: LayoutObject::absoluteBoundingBoxRectForRange() should take EphemeralRange (Closed)
Patch Set: Y Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/VisibleUnits.cpp
diff --git a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
index 79c58d5dec8115e276f266d62685a090e5609cfb..ac5f6cf6f5f5fe51c4bedc92584d7cf0dfed3410 100644
--- a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
+++ b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
@@ -4004,4 +4004,36 @@ VisiblePositionInFlatTree previousPositionOf(
visiblePosition.deepEquivalent(), rule);
}
+template <typename Strategy>
+void textQuads(Vector<FloatQuad>& quad,
Xiaocheng 2017/03/28 21:29:34 nit: Please make this function |static| and rename
yosin_UTC9 2017/03/29 02:31:40 Could you change this function at "Range.cpp" with
tanvir 2017/03/30 19:11:05 Done.
tanvir 2017/03/30 19:11:05 I did not understand this comment from Range.cpp c
+ const EphemeralRangeTemplate<Strategy>& range) {
+ const PositionTemplate<Strategy> startPosition = range.startPosition();
+ const PositionTemplate<Strategy> endPosition = range.endPosition();
+ Node* startContainer = startPosition.computeContainerNode();
+ DCHECK(startContainer);
+ Node* endContainer = endPosition.computeContainerNode();
+ DCHECK(endContainer);
+
+ for (Node& node : range.nodes()) {
+ LayoutObject* layoutObject = node.layoutObject();
+ if (!layoutObject || !layoutObject->isText())
+ continue;
+ LayoutText* layoutText = toLayoutText(layoutObject);
+ unsigned startOffset =
+ node == startContainer ? startPosition.offsetInContainerNode() : 0;
+ unsigned endOffset = node == endContainer
+ ? endPosition.offsetInContainerNode()
+ : std::numeric_limits<unsigned>::max();
+ layoutText->absoluteQuadsForRange(quad, startOffset, endOffset);
+ }
+}
+
+void textQuad(Vector<FloatQuad>& quad, const EphemeralRange& range) {
+ textQuads(quad, range);
+}
+
+void textQuad(Vector<FloatQuad>& quad, const EphemeralRangeInFlatTree& range) {
+ textQuads(quad, range);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698