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

Unified Diff: third_party/WebKit/Source/platform/Widget.cpp

Issue 1516723003: [Element / Autofill] Add boundsInViewportFloat() to fix <input> popup misalignment. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refator to use boundsInViewportFloat() eventually, but keep boundsInViewportInt(). Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/Widget.cpp
diff --git a/third_party/WebKit/Source/platform/Widget.cpp b/third_party/WebKit/Source/platform/Widget.cpp
index b2f9160f5b51893476552c9b31416dc9fdc713f5..2717891ea18c1c977ff8aaa566220bf3bbcf733d 100644
--- a/third_party/WebKit/Source/platform/Widget.cpp
+++ b/third_party/WebKit/Source/platform/Widget.cpp
@@ -88,6 +88,15 @@ IntRect Widget::convertToRootFrame(const IntRect& localRect) const
return localRect;
}
+FloatRect Widget::convertToRootFrame(const FloatRect& localRect) const
+{
+ if (const Widget* parentWidget = parent()) {
+ FloatRect parentRect = convertToContainingWidget(localRect);
+ return parentWidget->convertToRootFrame(parentRect);
+ }
+ return localRect;
+}
+
IntPoint Widget::convertFromRootFrame(const IntPoint& pointInRootFrame) const
{
if (const Widget* parentWidget = parent()) {
@@ -146,6 +155,16 @@ IntRect Widget::convertFromContainingWidget(const IntRect& parentRect) const
return parentRect;
}
+FloatRect Widget::convertToContainingWidget(const FloatRect& localRect) const
+{
+ if (const Widget* parentWidget = parent()) {
+ FloatRect parentRect(localRect);
+ parentRect.setLocation(parentWidget->convertChildToSelf(this, localRect.location()));
+ return parentRect;
+ }
+ return localRect;
+}
+
IntPoint Widget::convertToContainingWidget(const IntPoint& localPoint) const
{
if (const Widget* parentWidget = parent())
@@ -172,4 +191,9 @@ IntPoint Widget::convertSelfToChild(const Widget*, const IntPoint& point) const
return point;
}
+FloatPoint Widget::convertChildToSelf(const Widget*, const FloatPoint& point) const
+{
+ return point;
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/Widget.h ('k') | third_party/WebKit/Source/platform/scroll/ScrollableArea.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698