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

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

Issue 2904433002: Use only LayoutText::AbsoluteQuadsForRange() in VisibleUnit::ComputeTextBounds() (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d9581dfe9ccafa1515a22fd2f92a319d8b7395f4..11f7fd63a214b48ed849d83e73dd61abfbc12e30 100644
--- a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
+++ b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
@@ -4105,22 +4105,8 @@ PositionInFlatTree SkipWhitespace(const PositionInFlatTree& position) {
return SkipWhitespaceAlgorithm(position);
}
-static void CollectAbsoluteBoundsForRange(unsigned start,
- unsigned end,
- const LayoutText& layout_text,
- Vector<IntRect>& rects) {
- layout_text.AbsoluteRectsForRange(rects, start, end);
-}
-
-static void CollectAbsoluteBoundsForRange(unsigned start,
- unsigned end,
- const LayoutText& layout_text,
- Vector<FloatQuad>& quads) {
- layout_text.AbsoluteQuadsForRange(quads, start, end);
-}
-
-template <typename RectType, typename Strategy>
-static Vector<RectType> ComputeTextBounds(
+template <typename Strategy>
+static Vector<FloatQuad> ComputeTextBounds(
const EphemeralRangeTemplate<Strategy>& range) {
const PositionTemplate<Strategy>& start_position = range.StartPosition();
const PositionTemplate<Strategy>& end_position = range.EndPosition();
@@ -4129,7 +4115,7 @@ static Vector<RectType> ComputeTextBounds(
Node* const end_container = end_position.ComputeContainerNode();
DCHECK(end_container);
- Vector<RectType> result;
+ Vector<FloatQuad> result;
for (const Node& node : range.Nodes()) {
LayoutObject* const layout_object = node.GetLayoutObject();
if (!layout_object || !layout_object->IsText())
@@ -4140,32 +4126,30 @@ static Vector<RectType> ComputeTextBounds(
unsigned end_offset = node == end_container
? end_position.OffsetInContainerNode()
: std::numeric_limits<unsigned>::max();
- CollectAbsoluteBoundsForRange(start_offset, end_offset, *layout_text,
- result);
+ layout_text->AbsoluteQuadsForRange(result, start_offset, end_offset);
}
return result;
}
template <typename Strategy>
-static IntRect ComputeTextRectTemplate(
+static FloatRect ComputeTextRectTemplate(
const EphemeralRangeTemplate<Strategy>& range) {
- IntRect result;
- const Vector<IntRect>& rects = ComputeTextBounds<IntRect, Strategy>(range);
- for (const IntRect& rect : rects)
- result.Unite(rect);
+ FloatRect result;
+ for (auto rect : ComputeTextBounds<Strategy>(range))
+ result.Unite(rect.BoundingBox());
return result;
}
IntRect ComputeTextRect(const EphemeralRange& range) {
- return ComputeTextRectTemplate(range);
+ return EnclosingIntRect(ComputeTextRectTemplate(range));
}
IntRect ComputeTextRect(const EphemeralRangeInFlatTree& range) {
- return ComputeTextRectTemplate(range);
+ return EnclosingIntRect(ComputeTextRectTemplate(range));
}
Vector<FloatQuad> ComputeTextQuads(const EphemeralRange& range) {
- return ComputeTextBounds<FloatQuad>(range);
+ return ComputeTextBounds(range);
}
} // namespace blink
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698