| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 // Make the coordinates relative to the container enclosing bounding box. | 89 // Make the coordinates relative to the container enclosing bounding box. |
| 90 // Since we work with rects enclosing quad unions this is still | 90 // Since we work with rects enclosing quad unions this is still |
| 91 // transform-friendly. | 91 // transform-friendly. |
| 92 FloatRect normalizedRect = absoluteRect; | 92 FloatRect normalizedRect = absoluteRect; |
| 93 normalizedRect.moveBy(-containerRect.location()); | 93 normalizedRect.moveBy(-containerRect.location()); |
| 94 | 94 |
| 95 // Fixed positions do not make sense in this coordinate system, but need to | 95 // Fixed positions do not make sense in this coordinate system, but need to |
| 96 // leave consistent tickmarks. So, use their position when the view is not | 96 // leave consistent tickmarks. So, use their position when the view is not |
| 97 // scrolled, like an absolute position. | 97 // scrolled, like an absolute position. |
| 98 if (layoutObject->style()->position() == FixedPosition && | 98 if (layoutObject->style()->position() == EPosition::kFixed && |
| 99 container->isLayoutView()) { | 99 container->isLayoutView()) { |
| 100 normalizedRect.move( | 100 normalizedRect.move( |
| 101 -toLayoutView(container)->frameView()->getScrollOffset()); | 101 -toLayoutView(container)->frameView()->getScrollOffset()); |
| 102 } | 102 } |
| 103 | 103 |
| 104 normalizedRect.scale(1 / containerRect.width(), 1 / containerRect.height()); | 104 normalizedRect.scale(1 / containerRect.width(), 1 / containerRect.height()); |
| 105 return normalizedRect; | 105 return normalizedRect; |
| 106 } | 106 } |
| 107 | 107 |
| 108 FloatRect findInPageRectFromAbsoluteRect(const FloatRect& inputRect, | 108 FloatRect findInPageRectFromAbsoluteRect(const FloatRect& inputRect, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 FloatRect findInPageRectFromRange(Range* range) { | 146 FloatRect findInPageRectFromRange(Range* range) { |
| 147 if (!range || !range->firstNode()) | 147 if (!range || !range->firstNode()) |
| 148 return FloatRect(); | 148 return FloatRect(); |
| 149 | 149 |
| 150 return findInPageRectFromAbsoluteRect( | 150 return findInPageRectFromAbsoluteRect( |
| 151 LayoutObject::absoluteBoundingBoxRectForRange(range), | 151 LayoutObject::absoluteBoundingBoxRectForRange(range), |
| 152 range->firstNode()->layoutObject()); | 152 range->firstNode()->layoutObject()); |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace blink | 155 } // namespace blink |
| OLD | NEW |