зеркало из https://github.com/mozilla/gecko-dev.git
Bug 860579. Make FindContentInDocument use the frame tree as much as possible. r=mattwoodrow
This commit is contained in:
Родитель
33f0379521
Коммит
a3114aa95b
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
function addFrame(contents)
|
||||
{
|
||||
var frame = document.createElement("iframe");
|
||||
frame.src = "data:text/html," + contents;
|
||||
document.body.appendChild(frame);
|
||||
}
|
||||
function boom()
|
||||
{
|
||||
addFrame("1");
|
||||
document.documentElement.offsetHeight;
|
||||
addFrame("2");
|
||||
document.body.style.display = "table-caption";
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="boom();"></body>
|
||||
</html>
|
|
@ -391,5 +391,6 @@ load 770381-1.html
|
|||
load 795646.html
|
||||
load 813372-1.html
|
||||
load 836990-1.html
|
||||
load 860579-1.html
|
||||
pref(layers.force-active,true) load 859526-1.html
|
||||
pref(layers.force-active,true) load 859630-1.html
|
||||
|
|
|
@ -1396,28 +1396,15 @@ static void Sort(nsDisplayList* aList, int32_t aCount, nsDisplayList::SortLEQ aC
|
|||
}
|
||||
|
||||
static nsIContent* FindContentInDocument(nsDisplayItem* aItem, nsIDocument* aDoc) {
|
||||
nsIFrame* frame = aItem->GetUnderlyingFrame();
|
||||
nsIContent* c = frame->GetContent();
|
||||
for (;;) {
|
||||
nsIDocument* d;
|
||||
if (c) {
|
||||
d = c->OwnerDoc();
|
||||
} else {
|
||||
d = frame->PresContext()->Document();
|
||||
}
|
||||
if (d == aDoc) {
|
||||
return c;
|
||||
}
|
||||
nsIDocument* parentDoc = d->GetParentDocument();
|
||||
if (!parentDoc) {
|
||||
return nullptr;
|
||||
}
|
||||
c = parentDoc->FindContentForSubDocument(d);
|
||||
if (!c) {
|
||||
NS_ERROR("No content for subdocument?");
|
||||
return nullptr;
|
||||
nsIFrame* f = aItem->GetUnderlyingFrame();
|
||||
while (f) {
|
||||
nsPresContext* pc = f->PresContext();
|
||||
if (pc->Document() == aDoc) {
|
||||
return f->GetContent();
|
||||
}
|
||||
f = nsLayoutUtils::GetCrossDocParentFrame(pc->PresShell()->GetRootFrame());
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static bool IsContentLEQ(nsDisplayItem* aItem1, nsDisplayItem* aItem2,
|
||||
|
|
Загрузка…
Ссылка в новой задаче