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 3986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3997 } | 3997 } |
3998 | 3998 |
3999 VisiblePositionInFlatTree previousPositionOf( | 3999 VisiblePositionInFlatTree previousPositionOf( |
4000 const VisiblePositionInFlatTree& visiblePosition, | 4000 const VisiblePositionInFlatTree& visiblePosition, |
4001 EditingBoundaryCrossingRule rule) { | 4001 EditingBoundaryCrossingRule rule) { |
4002 DCHECK(visiblePosition.isValid()) << visiblePosition; | 4002 DCHECK(visiblePosition.isValid()) << visiblePosition; |
4003 return previousPositionOfAlgorithm<EditingInFlatTreeStrategy>( | 4003 return previousPositionOfAlgorithm<EditingInFlatTreeStrategy>( |
4004 visiblePosition.deepEquivalent(), rule); | 4004 visiblePosition.deepEquivalent(), rule); |
4005 } | 4005 } |
4006 | 4006 |
4007 template <typename Strategy> | |
4008 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
| |
4009 const EphemeralRangeTemplate<Strategy>& range) { | |
4010 const PositionTemplate<Strategy> startPosition = range.startPosition(); | |
4011 const PositionTemplate<Strategy> endPosition = range.endPosition(); | |
4012 Node* startContainer = startPosition.computeContainerNode(); | |
4013 DCHECK(startContainer); | |
4014 Node* endContainer = endPosition.computeContainerNode(); | |
4015 DCHECK(endContainer); | |
4016 | |
4017 for (Node& node : range.nodes()) { | |
4018 LayoutObject* layoutObject = node.layoutObject(); | |
4019 if (!layoutObject || !layoutObject->isText()) | |
4020 continue; | |
4021 LayoutText* layoutText = toLayoutText(layoutObject); | |
4022 unsigned startOffset = | |
4023 node == startContainer ? startPosition.offsetInContainerNode() : 0; | |
4024 unsigned endOffset = node == endContainer | |
4025 ? endPosition.offsetInContainerNode() | |
4026 : std::numeric_limits<unsigned>::max(); | |
4027 layoutText->absoluteQuadsForRange(quad, startOffset, endOffset); | |
4028 } | |
4029 } | |
4030 | |
4031 void textQuad(Vector<FloatQuad>& quad, const EphemeralRange& range) { | |
4032 textQuads(quad, range); | |
4033 } | |
4034 | |
4035 void textQuad(Vector<FloatQuad>& quad, const EphemeralRangeInFlatTree& range) { | |
4036 textQuads(quad, range); | |
4037 } | |
4038 | |
4007 } // namespace blink | 4039 } // namespace blink |
OLD | NEW |