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

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: Created 5 years, 1 month 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 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 987
988 bool Element::hasNonEmptyLayoutSize() const 988 bool Element::hasNonEmptyLayoutSize() const
989 { 989 {
990 document().updateLayoutIgnorePendingStylesheets(); 990 document().updateLayoutIgnorePendingStylesheets();
991 991
992 if (LayoutBoxModelObject* box = layoutBoxModelObject()) 992 if (LayoutBoxModelObject* box = layoutBoxModelObject())
993 return box->hasNonEmptyLayoutSize(); 993 return box->hasNonEmptyLayoutSize();
994 return false; 994 return false;
995 } 995 }
996 996
997 IntRect Element::boundsInViewportSpace() 997 IntRect Element::boundsInViewport()
998 { 998 {
999 document().updateLayoutIgnorePendingStylesheets(); 999 document().updateLayoutIgnorePendingStylesheets();
1000 1000
1001 FrameView* view = document().view(); 1001 FrameView* view = document().view();
1002 if (!view) 1002 if (!view)
1003 return IntRect(); 1003 return IntRect();
1004 1004
1005 Vector<FloatQuad> quads; 1005 Vector<FloatQuad> quads;
1006 if (isSVGElement() && layoutObject()) { 1006 if (isSVGElement() && layoutObject()) {
1007 // Get the bounding rectangle from the SVG model. 1007 // Get the bounding rectangle from the SVG model.
1008 if (toSVGElement(this)->isSVGGraphicsElement()) 1008 if (toSVGElement(this)->isSVGGraphicsElement())
1009 quads.append(layoutObject()->localToAbsoluteQuad(layoutObject()->obj ectBoundingBox())); 1009 quads.append(layoutObject()->localToAbsoluteQuad(layoutObject()->obj ectBoundingBox()));
1010 } else { 1010 } else {
1011 // Get the bounding rectangle from the box model. 1011 // Get the bounding rectangle from the box model.
1012 if (layoutBoxModelObject()) 1012 if (layoutBoxModelObject())
1013 layoutBoxModelObject()->absoluteQuads(quads); 1013 layoutBoxModelObject()->absoluteQuads(quads);
1014 } 1014 }
1015 1015
1016 if (quads.isEmpty()) 1016 if (quads.isEmpty())
1017 return IntRect(); 1017 return IntRect();
1018 1018
1019 IntRect result = quads[0].enclosingBoundingBox(); 1019 IntRect result = quads[0].enclosingBoundingBox();
1020 for (size_t i = 1; i < quads.size(); ++i) 1020 for (size_t i = 1; i < quads.size(); ++i)
1021 result.unite(quads[i].enclosingBoundingBox()); 1021 result.unite(quads[i].enclosingBoundingBox());
1022 1022
1023 return view->soonToBeRemovedContentsToUnscaledViewport(result); 1023 return view->contentsToViewport(result);
1024 } 1024 }
1025 1025
1026 ClientRectList* Element::getClientRects() 1026 ClientRectList* Element::getClientRects()
1027 { 1027 {
1028 document().updateLayoutIgnorePendingStylesheets(); 1028 document().updateLayoutIgnorePendingStylesheets();
1029 1029
1030 LayoutObject* elementLayoutObject = layoutObject(); 1030 LayoutObject* elementLayoutObject = layoutObject();
1031 if (!elementLayoutObject || (!elementLayoutObject->isBoxModelObject() && !el ementLayoutObject->isBR())) 1031 if (!elementLayoutObject || (!elementLayoutObject->isBoxModelObject() && !el ementLayoutObject->isBR()))
1032 return ClientRectList::create(); 1032 return ClientRectList::create();
1033 1033
(...skipping 2539 matching lines...) Expand 10 before | Expand all | Expand 10 after
3573 { 3573 {
3574 #if ENABLE(OILPAN) 3574 #if ENABLE(OILPAN)
3575 if (hasRareData()) 3575 if (hasRareData())
3576 visitor->trace(elementRareData()); 3576 visitor->trace(elementRareData());
3577 visitor->trace(m_elementData); 3577 visitor->trace(m_elementData);
3578 #endif 3578 #endif
3579 ContainerNode::trace(visitor); 3579 ContainerNode::trace(visitor);
3580 } 3580 }
3581 3581
3582 } // namespace blink 3582 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698