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-02-19 16:03:24 -08:00
parent ca9066b91c
commit 627688c181
2 changed files with 45 additions and 0 deletions

View File

@ -5087,12 +5087,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

@ -2216,6 +2216,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.
@ -2225,6 +2234,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).