Bug 621253: Transfer a document's zoom levels to its external resources when they're created. r=bz a=blocking-final+

This commit is contained in:
Daniel Holbert 2011-01-17 21:18:52 -08:00
Родитель f2cc5a0073
Коммит 02c7528ae9
5 изменённых файлов: 70 добавлений и 0 удалений

Просмотреть файл

@ -855,6 +855,33 @@ nsExternalResourceMap::ShowViewers()
mMap.EnumerateRead(ExternalResourceShower, nsnull);
}
void
TransferZoomLevels(nsIDocument* aFromDoc,
nsIDocument* aToDoc)
{
NS_ABORT_IF_FALSE(aFromDoc && aToDoc,
"transferring zoom levels from/to null doc");
nsIPresShell* fromShell = aFromDoc->GetShell();
if (!fromShell)
return;
nsPresContext* fromCtxt = fromShell->GetPresContext();
if (!fromCtxt)
return;
nsIPresShell* toShell = aToDoc->GetShell();
if (!toShell)
return;
nsPresContext* toCtxt = toShell->GetPresContext();
if (!toCtxt)
return;
toCtxt->SetFullZoom(fromCtxt->GetFullZoom());
toCtxt->SetTextZoom(fromCtxt->TextZoom());
}
nsresult
nsExternalResourceMap::AddExternalResource(nsIURI* aURI,
nsIDocumentViewer* aViewer,
@ -912,6 +939,9 @@ nsExternalResourceMap::AddExternalResource(nsIURI* aURI,
newResource->mDocument = doc;
newResource->mViewer = aViewer;
newResource->mLoadGroup = aLoadGroup;
if (doc) {
TransferZoomLevels(aDisplayDocument, doc);
}
}
const nsTArray< nsCOMPtr<nsIObserver> > & obs = load->Observers();

Просмотреть файл

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg">
<filter id="greyscale">
<feColorMatrix values="0.5 0.5 0.5 0 0
0.5 0.5 0.5 0 0
0.5 0.5 0.5 0 0
0 0 0 1 0"/>
</filter>
</svg>

После

Ширина:  |  Высота:  |  Размер: 292 B

Просмотреть файл

@ -0,0 +1,20 @@
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml"
reftest-zoom="0.5">
<body style="margin: 0px">
<svg xmlns="http://www.w3.org/2000/svg" style="display: block; height: 0px">
<defs>
<filter id="greyscale">
<feColorMatrix values="0.5 0.5 0.5 0 0
0.5 0.5 0.5 0 0
0.5 0.5 0.5 0 0
0 0 0 1 0"/>
</filter>
</defs>
</svg>
<div style="filter: url(#greyscale);
background: lime;
height: 100px; width: 100px">
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml"
reftest-zoom="0.5">
<body style="margin: 0px">
<div style="filter: url(621253-1-helper.svg#greyscale);
background: lime;
height: 100px; width: 100px">
</div>
</body>
</html>

Просмотреть файл

@ -1562,6 +1562,7 @@ HTTP(..) == 615121-1.html 615121-1-ref.html
HTTP(..) != 615121-2.html 615121-2-notref.html
== 617242-1.html 617242-1-ref.html
!= 618071.html 618071-notref.html
== 621253-1.xhtml 621253-1-ref.xhtml
HTTP(..) == 619511-1.html 619511-1-ref.html
random-if(winWidget) == 621918-1.svg 621918-1-ref.svg # 1-pixel diacritic positioning discrepancy in rotated text (may depend on platform fonts)
HTTP(..) == 621918-2.svg 621918-2-ref.svg # http(..) for filters.svg, used to mask antialiasing issues where glyphs touch