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

Side by Side Diff: third_party/WebKit/Source/core/dom/Element.cpp

Issue 1463723003: Return VisualViewport coords in boundsInViewportSpace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 988
989 bool Element::hasNonEmptyLayoutSize() const 989 bool Element::hasNonEmptyLayoutSize() const
990 { 990 {
991 document().updateLayoutIgnorePendingStylesheets(); 991 document().updateLayoutIgnorePendingStylesheets();
992 992
993 if (LayoutBoxModelObject* box = layoutBoxModelObject()) 993 if (LayoutBoxModelObject* box = layoutBoxModelObject())
994 return box->hasNonEmptyLayoutSize(); 994 return box->hasNonEmptyLayoutSize();
995 return false; 995 return false;
996 } 996 }
997 997
998 IntRect Element::boundsInViewportSpace() 998 IntRect Element::boundsInViewport()
999 { 999 {
1000 document().updateLayoutIgnorePendingStylesheets(); 1000 document().updateLayoutIgnorePendingStylesheets();
1001 1001
1002 FrameView* view = document().view(); 1002 FrameView* view = document().view();
1003 if (!view) 1003 if (!view)
1004 return IntRect(); 1004 return IntRect();
1005 1005
1006 Vector<FloatQuad> quads; 1006 Vector<FloatQuad> quads;
1007 if (isSVGElement() && layoutObject()) { 1007 if (isSVGElement() && layoutObject()) {
1008 // Get the bounding rectangle from the SVG model. 1008 // Get the bounding rectangle from the SVG model.
1009 if (toSVGElement(this)->isSVGGraphicsElement()) 1009 if (toSVGElement(this)->isSVGGraphicsElement())
1010 quads.append(layoutObject()->localToAbsoluteQuad(layoutObject()->obj ectBoundingBox())); 1010 quads.append(layoutObject()->localToAbsoluteQuad(layoutObject()->obj ectBoundingBox()));
1011 } else { 1011 } else {
1012 // Get the bounding rectangle from the box model. 1012 // Get the bounding rectangle from the box model.
1013 if (layoutBoxModelObject()) 1013 if (layoutBoxModelObject())
1014 layoutBoxModelObject()->absoluteQuads(quads); 1014 layoutBoxModelObject()->absoluteQuads(quads);
1015 } 1015 }
1016 1016
1017 if (quads.isEmpty()) 1017 if (quads.isEmpty())
1018 return IntRect(); 1018 return IntRect();
1019 1019
1020 IntRect result = quads[0].enclosingBoundingBox(); 1020 IntRect result = quads[0].enclosingBoundingBox();
1021 for (size_t i = 1; i < quads.size(); ++i) 1021 for (size_t i = 1; i < quads.size(); ++i)
1022 result.unite(quads[i].enclosingBoundingBox()); 1022 result.unite(quads[i].enclosingBoundingBox());
1023 1023
1024 return view->soonToBeRemovedContentsToUnscaledViewport(result); 1024 return view->contentsToViewport(result);
1025 } 1025 }
1026 1026
1027 ClientRectList* Element::getClientRects() 1027 ClientRectList* Element::getClientRects()
1028 { 1028 {
1029 document().updateLayoutIgnorePendingStylesheets(); 1029 document().updateLayoutIgnorePendingStylesheets();
1030 1030
1031 LayoutObject* elementLayoutObject = layoutObject(); 1031 LayoutObject* elementLayoutObject = layoutObject();
1032 if (!elementLayoutObject || (!elementLayoutObject->isBoxModelObject() && !el ementLayoutObject->isBR())) 1032 if (!elementLayoutObject || (!elementLayoutObject->isBoxModelObject() && !el ementLayoutObject->isBR()))
1033 return ClientRectList::create(); 1033 return ClientRectList::create();
1034 1034
(...skipping 2581 matching lines...) Expand 10 before | Expand all | Expand 10 after
3616 { 3616 {
3617 #if ENABLE(OILPAN) 3617 #if ENABLE(OILPAN)
3618 if (hasRareData()) 3618 if (hasRareData())
3619 visitor->trace(elementRareData()); 3619 visitor->trace(elementRareData());
3620 visitor->trace(m_elementData); 3620 visitor->trace(m_elementData);
3621 #endif 3621 #endif
3622 ContainerNode::trace(visitor); 3622 ContainerNode::trace(visitor);
3623 } 3623 }
3624 3624
3625 } // namespace blink 3625 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/input/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698