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

Side by Side Diff: third_party/WebKit/Source/core/editing/VisibleUnits.cpp

Issue 2775663008: LayoutObject::absoluteBoundingBoxRectForRange() should take EphemeralRange (Closed)
Patch Set: Split Patch:1(TextQuads at VisibleUnits) Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 4030 matching lines...) Expand 10 before | Expand all | Expand 10 after
4041 } 4041 }
4042 4042
4043 Position skipWhitespace(const Position& position) { 4043 Position skipWhitespace(const Position& position) {
4044 return skipWhitespaceAlgorithm(position); 4044 return skipWhitespaceAlgorithm(position);
4045 } 4045 }
4046 4046
4047 PositionInFlatTree skipWhitespace(const PositionInFlatTree& position) { 4047 PositionInFlatTree skipWhitespace(const PositionInFlatTree& position) {
4048 return skipWhitespaceAlgorithm(position); 4048 return skipWhitespaceAlgorithm(position);
4049 } 4049 }
4050 4050
4051 template <typename Strategy>
4052 static void textQuadAlgorithm(Vector<FloatQuad>* quads,
yosin_UTC9 2017/04/04 01:25:22 Please change |Range::textQuads()| instead of copy
4053 const EphemeralRangeTemplate<Strategy>& range) {
4054 const PositionTemplate<Strategy> startPosition = range.startPosition();
4055 const PositionTemplate<Strategy> endPosition = range.endPosition();
4056 Node* startContainer = startPosition.computeContainerNode();
4057 DCHECK(startContainer);
4058 Node* endContainer = endPosition.computeContainerNode();
4059 DCHECK(endContainer);
4060
4061 for (Node& node : range.nodes()) {
4062 LayoutObject* layoutObject = node.layoutObject();
4063 if (!layoutObject || !layoutObject->isText())
4064 continue;
4065 LayoutText* layoutText = toLayoutText(layoutObject);
4066 unsigned startOffset =
4067 node == startContainer ? startPosition.offsetInContainerNode() : 0;
4068 unsigned endOffset = node == endContainer
4069 ? endPosition.offsetInContainerNode()
4070 : std::numeric_limits<unsigned>::max();
4071 layoutText->absoluteQuadsForRange(*quads, startOffset, endOffset);
4072 }
4073 }
4074
4075 void textQuads(Vector<FloatQuad>* quads, const EphemeralRange& range) {
4076 textQuadAlgorithm(quads, range);
4077 }
4078
4079 void textQuads(Vector<FloatQuad>* quads,
4080 const EphemeralRangeInFlatTree& range) {
4081 textQuadAlgorithm(quads, range);
4082 }
4083
4051 } // namespace blink 4084 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698