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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 return FloatRect(); | 84 return FloatRect(); |
85 | 85 |
86 // Make the coordinates relative to the container enclosing bounding box. | 86 // Make the coordinates relative to the container enclosing bounding box. |
87 // Since we work with rects enclosing quad unions this is still transform-frie ndly. | 87 // Since we work with rects enclosing quad unions this is still transform-frie ndly. |
88 FloatRect normalizedRect = absoluteRect; | 88 FloatRect normalizedRect = absoluteRect; |
89 normalizedRect.moveBy(-containerRect.location()); | 89 normalizedRect.moveBy(-containerRect.location()); |
90 | 90 |
91 // Fixed positions do not make sense in this coordinate system, but need to le ave consistent tickmarks. | 91 // Fixed positions do not make sense in this coordinate system, but need to le ave consistent tickmarks. |
92 // So, use their position when the view is not scrolled, like an absolute posi tion. | 92 // So, use their position when the view is not scrolled, like an absolute posi tion. |
93 if (layoutObject->style()->position() == FixedPosition && | 93 if (layoutObject->style()->position() == FixedPosition && |
94 container->isLayoutView()) | 94 container->isLayoutView()) { |
95 normalizedRect.moveBy( | 95 normalizedRect.moveBy( |
bokan
2016/10/02 19:47:51
move()
szager1
2016/10/05 07:43:36
Done.
| |
96 -toLayoutView(container)->frameView()->scrollPosition()); | 96 -FloatPoint(toLayoutView(container)->frameView()->scrollOffset())); |
97 } | |
97 | 98 |
98 normalizedRect.scale(1 / containerRect.width(), 1 / containerRect.height()); | 99 normalizedRect.scale(1 / containerRect.width(), 1 / containerRect.height()); |
99 return normalizedRect; | 100 return normalizedRect; |
100 } | 101 } |
101 | 102 |
102 FloatRect findInPageRectFromAbsoluteRect(const FloatRect& inputRect, | 103 FloatRect findInPageRectFromAbsoluteRect(const FloatRect& inputRect, |
103 const LayoutObject* baseLayoutObject) { | 104 const LayoutObject* baseLayoutObject) { |
104 if (!baseLayoutObject || inputRect.isEmpty()) | 105 if (!baseLayoutObject || inputRect.isEmpty()) |
105 return FloatRect(); | 106 return FloatRect(); |
106 | 107 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 FloatRect findInPageRectFromRange(Range* range) { | 140 FloatRect findInPageRectFromRange(Range* range) { |
140 if (!range || !range->firstNode()) | 141 if (!range || !range->firstNode()) |
141 return FloatRect(); | 142 return FloatRect(); |
142 | 143 |
143 return findInPageRectFromAbsoluteRect( | 144 return findInPageRectFromAbsoluteRect( |
144 LayoutObject::absoluteBoundingBoxRectForRange(range), | 145 LayoutObject::absoluteBoundingBoxRectForRange(range), |
145 range->firstNode()->layoutObject()); | 146 range->firstNode()->layoutObject()); |
146 } | 147 } |
147 | 148 |
148 } // namespace blink | 149 } // namespace blink |
OLD | NEW |