зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1237813. Refactor nsLayoutUtils::FindScrollableFrameFor to use GetScrollFrameFromContent. r=botond
This commit is contained in:
Родитель
9162bd85e1
Коммит
50fcf29623
|
@ -751,6 +751,25 @@ nsLayoutUtils::FindContentFor(ViewID aId)
|
|||
}
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
GetScrollFrameFromContent(nsIContent* aContent)
|
||||
{
|
||||
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||
if (aContent->OwnerDoc()->GetRootElement() == aContent) {
|
||||
nsIPresShell* presShell = frame ? frame->PresContext()->PresShell() : nullptr;
|
||||
if (!presShell) {
|
||||
presShell = aContent->OwnerDoc()->GetShell();
|
||||
}
|
||||
// We want the scroll frame, the root scroll frame differs from all
|
||||
// others in that the primary frame is not the scroll frame.
|
||||
nsIFrame* rootScrollFrame = presShell ? presShell->GetRootScrollFrame() : nullptr;
|
||||
if (rootScrollFrame) {
|
||||
frame = rootScrollFrame;
|
||||
}
|
||||
}
|
||||
return frame;
|
||||
}
|
||||
|
||||
nsIScrollableFrame*
|
||||
nsLayoutUtils::FindScrollableFrameFor(ViewID aId)
|
||||
{
|
||||
|
@ -759,13 +778,8 @@ nsLayoutUtils::FindScrollableFrameFor(ViewID aId)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
nsIFrame* scrolledFrame = content->GetPrimaryFrame();
|
||||
if (scrolledFrame && content->OwnerDoc()->GetRootElement() == content) {
|
||||
// The content is the root element of a subdocument, so return the root scrollable
|
||||
// for the subdocument.
|
||||
scrolledFrame = scrolledFrame->PresContext()->PresShell()->GetRootScrollFrame();
|
||||
}
|
||||
return scrolledFrame ? scrolledFrame->GetScrollTargetFrame() : nullptr;
|
||||
nsIFrame* scrollFrame = GetScrollFrameFromContent(content);
|
||||
return scrollFrame ? scrollFrame->GetScrollTargetFrame() : nullptr;
|
||||
}
|
||||
|
||||
static nsRect
|
||||
|
@ -862,25 +876,6 @@ GetDisplayPortFromRectData(nsIContent* aContent,
|
|||
return ApplyRectMultiplier(aRectData->mRect, aMultiplier);
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
GetScrollFrameFromContent(nsIContent* aContent)
|
||||
{
|
||||
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||
if (aContent->OwnerDoc()->GetRootElement() == aContent) {
|
||||
nsIPresShell* presShell = frame ? frame->PresContext()->PresShell() : nullptr;
|
||||
if (!presShell) {
|
||||
presShell = aContent->OwnerDoc()->GetShell();
|
||||
}
|
||||
// We want the scroll frame, the root scroll frame differs from all
|
||||
// others in that the primary frame is not the scroll frame.
|
||||
nsIFrame* rootScrollFrame = presShell ? presShell->GetRootScrollFrame() : nullptr;
|
||||
if (rootScrollFrame) {
|
||||
frame = rootScrollFrame;
|
||||
}
|
||||
}
|
||||
return frame;
|
||||
}
|
||||
|
||||
static nsRect
|
||||
GetDisplayPortFromMarginsData(nsIContent* aContent,
|
||||
DisplayPortMarginsPropertyData* aMarginsData,
|
||||
|
|
Загрузка…
Ссылка в новой задаче