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

Unified Diff: third_party/WebKit/Source/core/dom/Element.cpp

Issue 1516723003: [Element / Autofill] Add boundsInViewportFloat() to fix <input> popup misalignment. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/frame/FrameView.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Element.cpp
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp
index 61151db94f3a35cfa29ca5a83bcc15397100f908..e6c91e7e1e9da57f2f52fe616126c056ade0a3ed 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -1013,15 +1013,9 @@ bool Element::hasNonEmptyLayoutSize() const
return false;
}
-IntRect Element::boundsInViewport()
+bool Element::getBoundingQuads(Vector<FloatQuad>& quads)
{
- document().updateLayoutIgnorePendingStylesheets();
-
- FrameView* view = document().view();
- if (!view)
- return IntRect();
-
- Vector<FloatQuad> quads;
+ assert(quads.isEmpty());
if (isSVGElement() && layoutObject()) {
// Get the bounding rectangle from the SVG model.
if (toSVGElement(this)->isSVGGraphicsElement())
@@ -1031,8 +1025,19 @@ IntRect Element::boundsInViewport()
if (layoutBoxModelObject())
layoutBoxModelObject()->absoluteQuads(quads);
}
+ return !quads.isEmpty();
+}
- if (quads.isEmpty())
+IntRect Element::boundsInViewport()
+{
+ document().updateLayoutIgnorePendingStylesheets();
+
+ FrameView* view = document().view();
+ if (!view)
+ return IntRect();
+
+ Vector<FloatQuad> quads;
+ if (!getBoundingQuads(quads))
return IntRect();
IntRect result = quads[0].enclosingBoundingBox();
@@ -1042,6 +1047,25 @@ IntRect Element::boundsInViewport()
return view->contentsToViewport(result);
}
+FloatRect Element::boundsInViewportFloat()
bokan 2015/12/10 14:48:39 Perhaps we should just make boundsInViewport retur
huangs 2015/12/10 16:16:14 Replied in main comment.
+{
+ document().updateLayoutIgnorePendingStylesheets();
+
+ FrameView* view = document().view();
+ if (!view)
+ return FloatRect();
+
+ Vector<FloatQuad> quads;
+ if (!getBoundingQuads(quads))
+ return FloatRect();
+
+ FloatRect result = quads[0].boundingBox();
+ for (size_t i = 1; i < quads.size(); ++i)
+ result.unite(quads[i].boundingBox());
+
+ return view->contentsToViewport(result);
+}
+
ClientRectList* Element::getClientRects()
{
document().updateLayoutIgnorePendingStylesheets();
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/frame/FrameView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698