| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 IntPoint Widget::convertFromRootFrame(const IntPoint& pointInRootFrame) const { | 76 IntPoint Widget::convertFromRootFrame(const IntPoint& pointInRootFrame) const { |
| 77 if (const Widget* parentWidget = parent()) { | 77 if (const Widget* parentWidget = parent()) { |
| 78 IntPoint parentPoint = parentWidget->convertFromRootFrame(pointInRootFrame); | 78 IntPoint parentPoint = parentWidget->convertFromRootFrame(pointInRootFrame); |
| 79 return convertFromContainingWidget(parentPoint); | 79 return convertFromContainingWidget(parentPoint); |
| 80 } | 80 } |
| 81 return pointInRootFrame; | 81 return pointInRootFrame; |
| 82 } | 82 } |
| 83 | 83 |
| 84 FloatPoint Widget::convertFromRootFrame( | 84 FloatPoint Widget::convertFromRootFrame( |
| 85 const FloatPoint& pointInRootFrame) const { | 85 const FloatPoint& pointInRootFrame) const { |
| 86 // Widgets / windows are required to be IntPoint aligned, but we may need to c
onvert | 86 // Widgets / windows are required to be IntPoint aligned, but we may need to |
| 87 // FloatPoint values within them (eg. for event co-ordinates). | 87 // convert FloatPoint values within them (eg. for event co-ordinates). |
| 88 IntPoint flooredPoint = flooredIntPoint(pointInRootFrame); | 88 IntPoint flooredPoint = flooredIntPoint(pointInRootFrame); |
| 89 FloatPoint parentPoint = this->convertFromRootFrame(flooredPoint); | 89 FloatPoint parentPoint = this->convertFromRootFrame(flooredPoint); |
| 90 FloatSize windowFraction = pointInRootFrame - flooredPoint; | 90 FloatSize windowFraction = pointInRootFrame - flooredPoint; |
| 91 // Use linear interpolation handle any fractional value (eg. for iframes subje
ct to a transform | 91 // Use linear interpolation handle any fractional value (eg. for iframes |
| 92 // beyond just a simple translation). | 92 // subject to a transform beyond just a simple translation). |
| 93 // FIXME: Add FloatPoint variants of all co-ordinate space conversion APIs. | 93 // FIXME: Add FloatPoint variants of all co-ordinate space conversion APIs. |
| 94 if (!windowFraction.isEmpty()) { | 94 if (!windowFraction.isEmpty()) { |
| 95 const int kFactor = 1000; | 95 const int kFactor = 1000; |
| 96 IntPoint parentLineEnd = this->convertFromRootFrame( | 96 IntPoint parentLineEnd = this->convertFromRootFrame( |
| 97 flooredPoint + roundedIntSize(windowFraction.scaledBy(kFactor))); | 97 flooredPoint + roundedIntSize(windowFraction.scaledBy(kFactor))); |
| 98 FloatSize parentFraction = | 98 FloatSize parentFraction = |
| 99 (parentLineEnd - parentPoint).scaledBy(1.0f / kFactor); | 99 (parentLineEnd - parentPoint).scaledBy(1.0f / kFactor); |
| 100 parentPoint.move(parentFraction); | 100 parentPoint.move(parentFraction); |
| 101 } | 101 } |
| 102 return parentPoint; | 102 return parentPoint; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 const IntPoint& point) const { | 150 const IntPoint& point) const { |
| 151 return point; | 151 return point; |
| 152 } | 152 } |
| 153 | 153 |
| 154 IntPoint Widget::convertSelfToChild(const Widget*, | 154 IntPoint Widget::convertSelfToChild(const Widget*, |
| 155 const IntPoint& point) const { | 155 const IntPoint& point) const { |
| 156 return point; | 156 return point; |
| 157 } | 157 } |
| 158 | 158 |
| 159 } // namespace blink | 159 } // namespace blink |
| OLD | NEW |