summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/palemoon/base/content/browser.js4
-rw-r--r--application/palemoon/base/content/tabbrowser.xml11
-rw-r--r--gfx/layers/client/ContentClient.cpp15
-rw-r--r--gfx/thebes/gfxSVGGlyphs.cpp38
-rw-r--r--layout/reftests/text-svgglyphs/reftest.list1
-rw-r--r--layout/reftests/text-svgglyphs/resources/svg-gz.ttfbin0 -> 113804 bytes
-rw-r--r--layout/reftests/text-svgglyphs/svg-glyph-compressed-ref.html15
-rw-r--r--layout/reftests/text-svgglyphs/svg-glyph-compressed.html15
8 files changed, 96 insertions, 3 deletions
diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js
index cc362d23f..16b7c0019 100644
--- a/application/palemoon/base/content/browser.js
+++ b/application/palemoon/base/content/browser.js
@@ -4481,13 +4481,15 @@ nsBrowserAccess.prototype = {
}
let loadInBackground = gPrefService.getBoolPref("browser.tabs.loadDivertedInBackground");
+ let openerWindow = (aContext & Ci.nsIBrowserDOMWindow.OPEN_NO_OPENER) ? null : aOpener;
let tab = win.gBrowser.loadOneTab(aURI ? aURI.spec : "about:blank", {
triggeringPrincipal: triggeringPrincipal,
referrerURI: referrer,
referrerPolicy: referrerPolicy,
fromExternal: isExternal,
- inBackground: loadInBackground});
+ inBackground: loadInBackground,
+ opener: openerWindow });
let browser = win.gBrowser.getBrowserForTab(tab);
if (gPrefService.getBoolPref("browser.tabs.noWindowActivationOnExternal")) {
diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml
index aa1a89200..b5edd54b7 100644
--- a/application/palemoon/base/content/tabbrowser.xml
+++ b/application/palemoon/base/content/tabbrowser.xml
@@ -1337,6 +1337,7 @@
var aFromExternal;
var aRelatedToCurrent;
var aOriginPrincipal;
+ var aOpener;
if (arguments.length == 2 &&
typeof arguments[1] == "object" &&
!(arguments[1] instanceof Ci.nsIURI)) {
@@ -1351,6 +1352,7 @@
aFromExternal = params.fromExternal;
aRelatedToCurrent = params.relatedToCurrent;
aOriginPrincipal = params.originPrincipal;
+ aOpener = params.opener;
}
var bgLoad = (aLoadInBackground != null) ? aLoadInBackground :
@@ -1366,7 +1368,8 @@
allowThirdPartyFixup: aAllowThirdPartyFixup,
fromExternal: aFromExternal,
originPrincipal: aOriginPrincipal,
- relatedToCurrent: aRelatedToCurrent});
+ relatedToCurrent: aRelatedToCurrent,
+ opener: aOpener });
if (!bgLoad)
this.selectedTab = tab;
@@ -1489,6 +1492,7 @@
var aSkipAnimation;
var aOriginPrincipal;
var aSkipBackgroundNotify;
+ var aOpener;
if (arguments.length == 2 &&
typeof arguments[1] == "object" &&
!(arguments[1] instanceof Ci.nsIURI)) {
@@ -1504,6 +1508,7 @@
aRelatedToCurrent = params.relatedToCurrent;
aSkipAnimation = params.skipAnimation;
aOriginPrincipal = params.originPrincipal;
+ aOpener = params.opener;
aSkipBackgroundNotify = params.skipBackgroundNotify;
}
@@ -1578,6 +1583,10 @@
b.setAttribute("showresizer", "true");
}
+ if (aOpener) {
+ b.QueryInterface(Ci.nsIFrameLoaderOwner).presetOpenerWindow(aOpener);
+ }
+
if (this.hasAttribute("autocompletepopup"))
b.setAttribute("autocompletepopup", this.getAttribute("autocompletepopup"));
b.setAttribute("autoscrollpopup", this._autoScrollPopup.id);
diff --git a/gfx/layers/client/ContentClient.cpp b/gfx/layers/client/ContentClient.cpp
index 3373230a9..50e159a23 100644
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -78,8 +78,21 @@ ContentClient::CreateContentClient(CompositableForwarder* aForwarder)
// We can't use double buffering when using image content with
// Xrender support on Linux, as ContentHostDoubleBuffered is not
// suited for direct uploads to the server.
+ // FIXME: Even though the comment above suggests that double buffering
+ // is supposed to be disabled when Xrender support is being enabled
+ // (and used), it really wasn't. Historically,
+ // UseImageOffscreenSurfaces() was always false in GTK2 builds, thus
+ // triggering the check, regardless of UseXRender().
+ // Some time later, offscreen surfaces were always enabled, but the
+ // Xrender functionality broke due to not using Xlib-based surfaces.
+ // Using Xlib-based surfaces compatible with Xrender operations seems
+ // to lead to weird graphical artifacts (bars and stripes) on some
+ // hardware (Intel-based?) when displaying quickly-changing content,
+ // so contrary to the statement above we'd better enable double
+ // buffering - which also seems to not have any negative performance
+ // impact.
if (!gfxPlatformGtk::GetPlatform()->UseImageOffscreenSurfaces() ||
- !gfxVars::UseXRender())
+ gfxVars::UseXRender())
#endif
{
useDoubleBuffering = (LayerManagerComposite::SupportsDirectTexturing() &&
diff --git a/gfx/thebes/gfxSVGGlyphs.cpp b/gfx/thebes/gfxSVGGlyphs.cpp
index a7615eca8..23f68f590 100644
--- a/gfx/thebes/gfxSVGGlyphs.cpp
+++ b/gfx/thebes/gfxSVGGlyphs.cpp
@@ -31,6 +31,7 @@
#include "nsSMILAnimationController.h"
#include "gfxContext.h"
#include "harfbuzz/hb.h"
+#include "zlib.h"
#include "mozilla/dom/ImageTracker.h"
#define SVG_CONTENT_TYPE NS_LITERAL_CSTRING("image/svg+xml")
@@ -285,7 +286,44 @@ gfxSVGGlyphsDocument::gfxSVGGlyphsDocument(const uint8_t *aBuffer,
gfxSVGGlyphs *aSVGGlyphs)
: mOwner(aSVGGlyphs)
{
+ if (aBufLen >= 14 && aBuffer[0] == 31 && aBuffer[1] == 139) {
+ // It's a gzip-compressed document; decompress it before parsing.
+ // The original length (modulo 2^32) is found in the last 4 bytes
+ // of the data, stored in little-endian format. We read it as
+ // individual bytes to avoid possible alignment issues.
+ // (Note that if the original length was >2^32, then origLen here
+ // will be incorrect; but then the inflate() call will not return
+ // Z_STREAM_END and we'll bail out safely.)
+ size_t origLen = (size_t(aBuffer[aBufLen - 1]) << 24) +
+ (size_t(aBuffer[aBufLen - 2]) << 16) +
+ (size_t(aBuffer[aBufLen - 3]) << 8) +
+ size_t(aBuffer[aBufLen - 4]);
+ AutoTArray<uint8_t, 4096> outBuf;
+ if (outBuf.SetLength(origLen, mozilla::fallible)) {
+ z_stream s = {0};
+ s.next_in = const_cast<Byte*>(aBuffer);
+ s.avail_in = aBufLen;
+ s.next_out = outBuf.Elements();
+ s.avail_out = outBuf.Length();
+ // The magic number 16 here is the zlib flag to expect gzip format,
+ // see http://www.zlib.net/manual.html#Advanced
+ if (Z_OK == inflateInit2(&s, 16 + MAX_WBITS)) {
+ int result = inflate(&s, Z_FINISH);
+ if (Z_STREAM_END == result) {
+ MOZ_ASSERT(size_t(s.next_out - outBuf.Elements()) == origLen);
+ ParseDocument(outBuf.Elements(), outBuf.Length());
+ } else {
+ NS_WARNING("Failed to decompress SVG glyphs document");
+ }
+ inflateEnd(&s);
+ }
+ } else {
+ NS_WARNING("Failed to allocate memory for SVG glyphs document");
+ }
+ } else {
ParseDocument(aBuffer, aBufLen);
+ }
+
if (!mDocument) {
NS_WARNING("Could not parse SVG glyphs document");
return;
diff --git a/layout/reftests/text-svgglyphs/reftest.list b/layout/reftests/text-svgglyphs/reftest.list
index 6f328ab73..7ff341f42 100644
--- a/layout/reftests/text-svgglyphs/reftest.list
+++ b/layout/reftests/text-svgglyphs/reftest.list
@@ -21,3 +21,4 @@ pref(gfx.font_rendering.opentype_svg.enabled,true) fails == svg-glyph-mask.sv
pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-paint-server.svg svg-glyph-paint-server-ref.svg
pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-transform.svg svg-glyph-transform-ref.svg
pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-extents.html svg-glyph-extents-ref.html
+pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-compressed.html svg-glyph-compressed-ref.html
diff --git a/layout/reftests/text-svgglyphs/resources/svg-gz.ttf b/layout/reftests/text-svgglyphs/resources/svg-gz.ttf
new file mode 100644
index 000000000..3a9660224
--- /dev/null
+++ b/layout/reftests/text-svgglyphs/resources/svg-gz.ttf
Binary files differ
diff --git a/layout/reftests/text-svgglyphs/svg-glyph-compressed-ref.html b/layout/reftests/text-svgglyphs/svg-glyph-compressed-ref.html
new file mode 100644
index 000000000..9bbfeb748
--- /dev/null
+++ b/layout/reftests/text-svgglyphs/svg-glyph-compressed-ref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html><head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Test for compressed SVG glyphs</title>
+<style>
+ @font-face {
+ font-family: test;
+ src: url(resources/svg.woff); /* uses uncompressed SVG documents */
+ }
+ html { width: 400px; height: 400px; background-color: white; }
+ body { margin: 0; }
+ div { font: 200px test; color: fuchsia; line-height: 1; stroke: none; }
+</style>
+</head><body><div>abcdefg</div>
+<div>LMNOPQR</div>
+</body></html> \ No newline at end of file
diff --git a/layout/reftests/text-svgglyphs/svg-glyph-compressed.html b/layout/reftests/text-svgglyphs/svg-glyph-compressed.html
new file mode 100644
index 000000000..e8123bba6
--- /dev/null
+++ b/layout/reftests/text-svgglyphs/svg-glyph-compressed.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html><head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Test for compressed SVG glyphs</title>
+<style>
+ @font-face {
+ font-family: test;
+ src: url(resources/svg-gz.ttf); /* copy of svg.woff using gzip-compressed SVG documents */
+ }
+ html { width: 400px; height: 400px; background-color: white; }
+ body { margin: 0; }
+ div { font: 200px test; color: fuchsia; line-height: 1; stroke: none; }
+</style>
+</head><body><div>abcdefg</div>
+<div>LMNOPQR</div>
+</body></html> \ No newline at end of file