mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 987718 - Part 1: Add FirstAndLastRectCollector to nsLayoutUtils; r=roc
This commit is contained in:
parent
45fd37cea2
commit
3aa22d4895
@ -3231,6 +3231,20 @@ void nsLayoutUtils::RectListBuilder::AddRect(const nsRect& aRect) {
|
||||
mRectList->Append(rect);
|
||||
}
|
||||
|
||||
nsLayoutUtils::FirstAndLastRectCollector::FirstAndLastRectCollector()
|
||||
: mSeenFirstRect(false)
|
||||
{
|
||||
}
|
||||
|
||||
void nsLayoutUtils::FirstAndLastRectCollector::AddRect(const nsRect& aRect) {
|
||||
if (!mSeenFirstRect) {
|
||||
mSeenFirstRect = true;
|
||||
mFirstRect = aRect;
|
||||
}
|
||||
|
||||
mLastRect = aRect;
|
||||
}
|
||||
|
||||
nsIFrame* nsLayoutUtils::GetContainingBlockForClientRect(nsIFrame* aFrame)
|
||||
{
|
||||
return aFrame->PresContext()->PresShell()->GetRootFrame();
|
||||
|
@ -1009,6 +1009,21 @@ public:
|
||||
virtual void AddRect(const nsRect& aRect);
|
||||
};
|
||||
|
||||
/**
|
||||
* SelectionCaret draws carets base on range. The carets are at begin
|
||||
* and end position of range's client rects. This class help us to
|
||||
* collect first and last rect for drawing carets.
|
||||
*/
|
||||
struct FirstAndLastRectCollector : public RectCallback {
|
||||
nsRect mFirstRect;
|
||||
nsRect mLastRect;
|
||||
bool mSeenFirstRect;
|
||||
|
||||
FirstAndLastRectCollector();
|
||||
|
||||
virtual void AddRect(const nsRect& aRect);
|
||||
};
|
||||
|
||||
static nsIFrame* GetContainingBlockForClientRect(nsIFrame* aFrame);
|
||||
|
||||
enum {
|
||||
|
Loading…
Reference in New Issue
Block a user