 Chromium Code Reviews
 Chromium Code Reviews Issue 2775663008:
  LayoutObject::absoluteBoundingBoxRectForRange() should take EphemeralRange  (Closed)
    
  
    Issue 2775663008:
  LayoutObject::absoluteBoundingBoxRectForRange() should take EphemeralRange  (Closed) 
  | OLD | NEW | 
|---|---|
| 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 Loading... | |
| 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 Vector<FloatQuad> textQuadAlgorithm( | |
| 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 Vector<FloatQuad> quad; | |
| 4062 for (Node& node : range.nodes()) { | |
| 4063 LayoutObject* layoutObject = node.layoutObject(); | |
| 4064 if (!layoutObject || !layoutObject->isText()) | |
| 4065 continue; | |
| 4066 LayoutText* layoutText = toLayoutText(layoutObject); | |
| 4067 unsigned startOffset = | |
| 4068 node == startContainer ? startPosition.offsetInContainerNode() : 0; | |
| 4069 unsigned endOffset = node == endContainer | |
| 4070 ? endPosition.offsetInContainerNode() | |
| 4071 : std::numeric_limits<unsigned>::max(); | |
| 4072 layoutText->absoluteQuadsForRange(quad, startOffset, endOffset); | |
| 4073 } | |
| 4074 return quad; | |
| 4075 } | |
| 4076 | |
| 4077 Vector<FloatQuad> textQuad(const EphemeralRange& range) { | |
| 
Xiaocheng
2017/03/30 18:46:19
nit: s/textQuad/textQuads/
 | |
| 4078 return textQuadAlgorithm(range); | |
| 4079 } | |
| 4080 | |
| 4081 Vector<FloatQuad> textQuad(const EphemeralRangeInFlatTree& range) { | |
| 
Xiaocheng
2017/03/30 18:46:19
nit: nit: s/textQuad/textQuads/
 | |
| 4082 return textQuadAlgorithm(range); | |
| 4083 } | |
| 4084 | |
| 4051 } // namespace blink | 4085 } // namespace blink | 
| OLD | NEW |