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

Side by Side Diff: third_party/WebKit/Source/web/FindInPageCoordinates.cpp

Issue 2775663008: LayoutObject::absoluteBoundingBoxRectForRange() should take EphemeralRange (Closed)
Patch Set: Y 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 DCHECK(layoutObject->isLayoutView()); 136 DCHECK(layoutObject->isLayoutView());
137 137
138 // Jump to the layoutObject owning the frame, if any. 138 // Jump to the layoutObject owning the frame, if any.
139 layoutObject = 139 layoutObject =
140 layoutObject->frame() ? layoutObject->frame()->ownerLayoutObject() : 0; 140 layoutObject->frame() ? layoutObject->frame()->ownerLayoutObject() : 0;
141 } 141 }
142 142
143 return normalizedRect; 143 return normalizedRect;
144 } 144 }
145 145
146 FloatRect findInPageRectFromRange(Range* range) { 146 FloatRect findInPageRectFromRange(EphemeralRange& range) {
147 if (!range || !range->firstNode()) 147 if (range.isNull())
148 return FloatRect();
149
150 const LayoutObject* baseLayoutObject =
151 range.startPosition().nodeAsRangeFirstNode()->layoutObject();
Xiaocheng 2017/03/28 21:29:34 Should have null ptr check for range.startPosition
tanvir 2017/03/30 19:11:06 Done.
152 if (!baseLayoutObject)
148 return FloatRect(); 153 return FloatRect();
149 154
150 return findInPageRectFromAbsoluteRect( 155 return findInPageRectFromAbsoluteRect(
151 LayoutObject::absoluteBoundingBoxRectForRange(range), 156 LayoutObject::absoluteBoundingBoxRectForRange(range), baseLayoutObject);
152 range->firstNode()->layoutObject());
153 } 157 }
154 158
155 } // namespace blink 159 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698