Bug 63895 (Part 1) - Add helper methods for retrieving overflow areas in the frame's local coordinate space. r=dbaron

This commit is contained in:
Seth Fowler 2014-03-10 15:41:14 -07:00
parent e42e0da34f
commit b222d248ef
2 changed files with 45 additions and 0 deletions

View File

@ -5118,12 +5118,39 @@ nsIFrame::GetOverflowAreas() const
nsRect(nsPoint(0, 0), GetSize()));
}
nsOverflowAreas
nsIFrame::GetOverflowAreasRelativeToSelf() const
{
if (IsTransformed()) {
nsOverflowAreas* preTransformOverflows = static_cast<nsOverflowAreas*>
(Properties().Get(PreTransformOverflowAreasProperty()));
if (preTransformOverflows) {
return nsOverflowAreas(preTransformOverflows->VisualOverflow(),
preTransformOverflows->ScrollableOverflow());
}
}
return nsOverflowAreas(GetVisualOverflowRect(),
GetScrollableOverflowRect());
}
nsRect
nsIFrame::GetScrollableOverflowRectRelativeToParent() const
{
return GetScrollableOverflowRect() + mRect.TopLeft();
}
nsRect
nsIFrame::GetScrollableOverflowRectRelativeToSelf() const
{
if (IsTransformed()) {
nsOverflowAreas* preTransformOverflows = static_cast<nsOverflowAreas*>
(Properties().Get(PreTransformOverflowAreasProperty()));
if (preTransformOverflows)
return preTransformOverflows->ScrollableOverflow();
}
return GetScrollableOverflowRect();
}
nsRect
nsIFrame::GetVisualOverflowRectRelativeToSelf() const
{

View File

@ -2280,6 +2280,15 @@ public:
nsOverflowAreas GetOverflowAreas() const;
/**
* Same as GetOverflowAreas, except in this frame's coordinate
* system (before transforms are applied).
*
* @return the overflow areas relative to this frame, before any CSS transforms have
* been applied, i.e. in this frame's coordinate system
*/
nsOverflowAreas GetOverflowAreasRelativeToSelf() const;
/**
* Same as GetScrollableOverflowRect, except relative to the parent
* frame.
@ -2289,6 +2298,15 @@ public:
*/
nsRect GetScrollableOverflowRectRelativeToParent() const;
/**
* Same as GetScrollableOverflowRect, except in this frame's coordinate
* system (before transforms are applied).
*
* @return the rect relative to this frame, before any CSS transforms have
* been applied, i.e. in this frame's coordinate system
*/
nsRect GetScrollableOverflowRectRelativeToSelf() const;
/**
* Like GetVisualOverflowRect, except in this frame's
* coordinate system (before transforms are applied).