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

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

Issue 2776103002: Make RenderedRectsForMarkers() to ignore disconnected nodes. (Closed)
Patch Set: test 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 Vector<IntRect> computeTextRects(
yosin_UTC9 2017/04/06 04:26:04 In this patch, please do this change in "Range.cpp
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 Vector<IntRect> rects;
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->absoluteRectsForRange(rects, startOffset, endOffset);
4072 }
4073 return rects;
4074 }
4075
4076 IntRect computeBoundingBox(const EphemeralRange& range) {
4077 IntRect result;
4078 for (const IntRect& rect : computeTextRects(range))
4079 result.unite(rect);
4080 return result;
4081 }
4082
4083 IntRect computeBoundingBox(const EphemeralRangeInFlatTree& range) {
4084 IntRect result;
4085 for (const IntRect& rect : computeTextRects(range))
4086 result.unite(rect);
4087 return result;
4088 }
4089
4051 } // namespace blink 4090 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698