OLD | NEW |
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 Loading... |
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(const EphemeralRange& range) { |
147 if (!range || !range->firstNode()) | 147 if (range.isNull() || !range.startPosition().nodeAsRangeFirstNode()) |
| 148 return FloatRect(); |
| 149 |
| 150 const LayoutObject* baseLayoutObject = |
| 151 range.startPosition().nodeAsRangeFirstNode()->layoutObject(); |
| 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 |
OLD | NEW |