mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1067728 - Part 1.1 - Move IsRectVisibleInScrollFrames to nsLayoutUtils. f=mtseng, r=roc
This commit is contained in:
parent
6a76eb960c
commit
ce2cdc6f5d
@ -458,7 +458,7 @@ TouchCaret::IsDisplayable()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IsRectVisibleInScrollFrames(focusFrame, focusRect)) {
|
||||
if (!nsLayoutUtils::IsRectVisibleInScrollFrames(focusFrame, focusRect)) {
|
||||
TOUCHCARET_LOG("Caret does not show in the scrollable frame!");
|
||||
return false;
|
||||
}
|
||||
@ -494,34 +494,6 @@ TouchCaret::GetTouchCaretPosition()
|
||||
return pos;
|
||||
}
|
||||
|
||||
bool
|
||||
TouchCaret::IsRectVisibleInScrollFrames(nsIFrame* aFrame, const nsRect& aRect)
|
||||
{
|
||||
nsIFrame* closestScrollFrame =
|
||||
nsLayoutUtils::GetClosestFrameOfType(aFrame, nsGkAtoms::scrollFrame);
|
||||
|
||||
while (closestScrollFrame) {
|
||||
nsIScrollableFrame* sf = do_QueryFrame(closestScrollFrame);
|
||||
nsRect scrollPortRect = sf->GetScrollPortRect();
|
||||
|
||||
nsRect rectRelativeToScrollFrame = aRect;
|
||||
nsLayoutUtils::TransformRect(aFrame, closestScrollFrame,
|
||||
rectRelativeToScrollFrame);
|
||||
|
||||
// Check whether aRect is visible in the scroll frame or not.
|
||||
if (!scrollPortRect.Intersects(rectRelativeToScrollFrame)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get next ancestor scroll frame.
|
||||
closestScrollFrame =
|
||||
nsLayoutUtils::GetClosestFrameOfType(closestScrollFrame->GetParent(),
|
||||
nsGkAtoms::scrollFrame);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
nsPoint
|
||||
TouchCaret::ClampPositionToScrollFrame(const nsPoint& aPosition)
|
||||
{
|
||||
|
@ -117,13 +117,6 @@ private:
|
||||
*/
|
||||
nsPoint GetTouchCaretPosition();
|
||||
|
||||
/**
|
||||
* Check whether aRect is visible in the boundary of the scroll frames
|
||||
* boundary.
|
||||
*/
|
||||
static bool IsRectVisibleInScrollFrames(nsIFrame* aFrame,
|
||||
const nsRect& aRect);
|
||||
|
||||
/**
|
||||
* Clamp the position of the touch caret to the scroll frame boundary.
|
||||
* The returned point is relative to the canvas frame.
|
||||
|
@ -2452,6 +2452,34 @@ nsLayoutUtils::ContainsPoint(const nsRect& aRect, const nsPoint& aPoint,
|
||||
return rect.Contains(aPoint);
|
||||
}
|
||||
|
||||
bool
|
||||
nsLayoutUtils::IsRectVisibleInScrollFrames(nsIFrame* aFrame, const nsRect& aRect)
|
||||
{
|
||||
nsIFrame* closestScrollFrame =
|
||||
nsLayoutUtils::GetClosestFrameOfType(aFrame, nsGkAtoms::scrollFrame);
|
||||
|
||||
while (closestScrollFrame) {
|
||||
nsIScrollableFrame* sf = do_QueryFrame(closestScrollFrame);
|
||||
nsRect scrollPortRect = sf->GetScrollPortRect();
|
||||
|
||||
nsRect rectRelativeToScrollFrame = aRect;
|
||||
nsLayoutUtils::TransformRect(aFrame, closestScrollFrame,
|
||||
rectRelativeToScrollFrame);
|
||||
|
||||
// Check whether aRect is visible in the scroll frame or not.
|
||||
if (!scrollPortRect.Intersects(rectRelativeToScrollFrame)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get next ancestor scroll frame.
|
||||
closestScrollFrame =
|
||||
nsLayoutUtils::GetClosestFrameOfType(closestScrollFrame->GetParent(),
|
||||
nsGkAtoms::scrollFrame);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
nsLayoutUtils::GetLayerTransformForFrame(nsIFrame* aFrame,
|
||||
Matrix4x4* aTransform)
|
||||
|
@ -841,6 +841,13 @@ public:
|
||||
static bool ContainsPoint(const nsRect& aRect, const nsPoint& aPoint,
|
||||
nscoord aInflateSize);
|
||||
|
||||
/**
|
||||
* Check whether aRect is visible in the boundary of the scroll frames
|
||||
* boundary.
|
||||
*/
|
||||
static bool IsRectVisibleInScrollFrames(nsIFrame* aFrame,
|
||||
const nsRect& aRect);
|
||||
|
||||
/**
|
||||
* Return true if a "layer transform" could be computed for aFrame,
|
||||
* and optionally return the computed transform. The returned
|
||||
|
Loading…
Reference in New Issue
Block a user