From 1eeb5c831be898b179500270a3da8f9805793e4a Mon Sep 17 00:00:00 2001 From: Ben Hearsum Date: Fri, 14 Nov 2008 16:26:53 +0000 Subject: [PATCH 01/16] bug 453840: (NPOT en-US Build) make it possible to create l10n files in final place for releases. r=ted,axel --- browser/locales/Makefile.in | 37 +++++++++++++++++------ toolkit/mozapps/installer/package-name.mk | 6 ++-- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/browser/locales/Makefile.in b/browser/locales/Makefile.in index 1fb2905b7c57..32dd6880aa0b 100644 --- a/browser/locales/Makefile.in +++ b/browser/locales/Makefile.in @@ -77,13 +77,19 @@ APP_VERSION := $(shell cat $(srcdir)/../config/version.txt) PWD := $(shell pwd) core_abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1))) +# ZIP_IN is defaulted to be compatible with the files the wget-en-US target +# pulls. You may override ZIP_IN if you provide your own files. You also _must_ +# override ZIP_IN when MOZ_PKG_PRETTYNAMES is defined - the default will not +# work in that case. +ZIP_IN ?= $(_ABS_DIST)/$(PACKAGE) + DEFINES += \ -DAB_CD=$(AB_CD) \ -DMOZ_LANGPACK_EID=langpack-$(AB_CD)@firefox.mozilla.org \ -DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \ -DLOCALE_SRCDIR=$(call core_abspath,$(LOCALE_SRCDIR)) \ - -DPKG_BASENAME=$(PKG_BASENAME) \ - -DPKG_INST_BASENAME=$(PKG_INST_BASENAME) \ + -DPKG_BASENAME="$(PKG_BASENAME)" \ + -DPKG_INST_BASENAME="$(PKG_INST_BASENAME)" \ $(NULL) ifndef MOZ_BRANDING_DIRECTORY @@ -212,7 +218,7 @@ PACKAGER_NO_LIBS = 1 include $(topsrcdir)/toolkit/mozapps/installer/packager.mk include $(call EXPAND_LOCALE_SRCDIR,toolkit/locales)/installer/windows/charset.mk -repackage-win32-installer: WIN32_INSTALLER_OUT=$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe +repackage-win32-installer: WIN32_INSTALLER_OUT="$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe" repackage-win32-installer: $(WIN32_INSTALLER_IN) $(SUBMAKEFILES) @echo "Repackaging $(WIN32_INSTALLER_IN) into $(WIN32_INSTALLER_OUT)." ifdef MOZ_BRANDING_DIRECTORY @@ -220,8 +226,8 @@ ifdef MOZ_BRANDING_DIRECTORY else $(MAKE) -C ../installer/windows export endif - if test ! -d $(dir $(WIN32_INSTALLER_OUT)); then \ - $(NSINSTALL) -D $(dir $(WIN32_INSTALLER_OUT)); \ + if test ! -d $(_ABS_DIST)/$(PKG_INST_PATH); then \ + $(NSINSTALL) -D $(_ABS_DIST)/$(PKG_INST_PATH); \ fi $(RM) -rf l10n-stage $(NSINSTALL) -D l10n-stage @@ -256,8 +262,8 @@ STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_APPNAME) endif $(STAGEDIST): AB_CD:=en-US -$(STAGEDIST): UNPACKAGE=$(_ABS_DIST)/$(PACKAGE) -$(STAGEDIST): $(_ABS_DIST)/$(PACKAGE) +$(STAGEDIST): UNPACKAGE=$(ZIP_IN) +$(STAGEDIST): $(ZIP_IN) # only mac needs to remove the parent of STAGEDIST... ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) if test -d $(DIST)/l10n-stage; then \ @@ -272,6 +278,17 @@ endif $(NSINSTALL) -D $(DIST)/l10n-stage cd $(DIST)/l10n-stage && \ $(UNMAKE_PACKAGE) +ifdef MOZ_PKG_PRETTYNAMES +ifneq (,$(filter WINNT Linux,$(OS_ARCH))) +# Linux and Windows unpack to a directory named after the MOZ_APP_NAME +# they were built with. This is fine when when MOZ_PKG_PRETTYNAMES +# isn't defined, because MOZ_PKG_APPNAME will be the same as MOZ_APP_NAME. +# However, when MOZ_PKG_PRETTYNAMES is passed MOZ_PKG_APPNAME inherits +# from MOZ_PKG_DISPLAYNAME, which is not always the same as MOZ_APP_NAME. + cd $(DIST)/l10n-stage && \ + mv $(MOZ_APP_NAME) $(MOZ_PKG_APPNAME) +endif +endif make clobber-zip AB_CD=en-US clobber-zip: @@ -287,8 +304,8 @@ clobber-zip: unpack: $(STAGEDIST) @echo done unpacking -repackage-zip: ZIP_OUT=$(_ABS_DIST)/$(PACKAGE) -repackage-zip: UNPACKAGE=$(ZIP_IN) +repackage-zip: ZIP_OUT="$(_ABS_DIST)/$(PACKAGE)" +repackage-zip: UNPACKAGE="$(ZIP_IN)" repackage-zip: ifeq (WINNT,$(OS_ARCH)) $(RM) -r $(STAGEDIST)/uninstall @@ -313,7 +330,7 @@ endif endif $(MAKE) clobber-zip AB_CD=$(AB_CD) $(NSINSTALL) -D $(DIST)/$(PKG_PATH) - mv -f $(DIST)/l10n-stage/$(PACKAGE) $(DIST)/$(PACKAGE) + mv -f "$(DIST)/l10n-stage/$(PACKAGE)" "$(DIST)/$(PACKAGE)" repackage-zip-%: ZIP_IN=$(_ABS_DIST)/$(PACKAGE) repackage-zip-%: $(ZIP_IN) $(STAGEDIST) libs-% diff --git a/toolkit/mozapps/installer/package-name.mk b/toolkit/mozapps/installer/package-name.mk index 9c84edc34e7d..f1f5048337ee 100644 --- a/toolkit/mozapps/installer/package-name.mk +++ b/toolkit/mozapps/installer/package-name.mk @@ -115,9 +115,9 @@ MOZ_PKG_APPNAME_LC = $(shell echo $(MOZ_PKG_APPNAME) | tr '[A-Z]' '[a-z]') ifndef MOZ_PKG_LONGVERSION MOZ_PKG_LONGVERSION = $(shell echo $(MOZ_PKG_VERSION) |\ - sed -e 's/a\([0-9][0-9]*\)$/ Alpha \1/' |\ - sed -e 's/b\([0-9][0-9]*\)$/ Beta \1/' |\ - sed -e 's/rc\([0-9][0-9]*\)$/ RC \1/') + sed -e 's/a\([0-9][0-9]*\)$$/ Alpha \1/' |\ + sed -e 's/b\([0-9][0-9]*\)$$/ Beta \1/' |\ + sed -e 's/rc\([0-9][0-9]*\)$$/ RC \1/') endif ifeq (,$(filter-out Darwin OS2, $(OS_ARCH))) # Mac and OS2 From 7edd5ef4ca1ae09f560e7f51fd059ce81c48e9a6 Mon Sep 17 00:00:00 2001 From: Michael Ventnor Date: Fri, 14 Nov 2008 10:42:31 -0800 Subject: [PATCH 02/16] Bug 463938: Fix smooth downscaling for images on Linux. r=vlad a=beltzner --- gfx/src/thebes/nsThebesImage.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gfx/src/thebes/nsThebesImage.cpp b/gfx/src/thebes/nsThebesImage.cpp index e93814f39325..f2d2a77e7861 100644 --- a/gfx/src/thebes/nsThebesImage.cpp +++ b/gfx/src/thebes/nsThebesImage.cpp @@ -635,8 +635,12 @@ nsThebesImage::Draw(gfxContext* aContext, // get blurry edges. CAIRO_EXTEND_PAD would also work here, if // available // - // This effectively disables smooth upscaling for images. - pattern->SetFilter(0); + // This effectively disables smooth upscaling for images. So only set the + // FAST filter on upscaling. We must NEVER use FAST on downscaling otherwise + // very ugly images will result all over chrome and the web. + // xx is x scaling, yy is y scaling. Lower number is higher scale. + if (userSpaceToImageSpace.xx < 1.0 || userSpaceToImageSpace.yy < 1.0) + pattern->SetFilter(0); break; case gfxASurface::SurfaceTypeQuartz: From 58d145b691d698cbf9059ac17f4b0fcf398f5b53 Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Fri, 14 Nov 2008 10:46:56 -0800 Subject: [PATCH 03/16] Bug 420697: Add svgGlyphFrame check to GetStrokeDashoffset and GetStrokeDashArray, making them match GetStrokeWidth. r+sr=roc a=beltzner --- layout/svg/base/src/nsSVGGeometryFrame.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/layout/svg/base/src/nsSVGGeometryFrame.cpp b/layout/svg/base/src/nsSVGGeometryFrame.cpp index dda9aafa6ccb..278d0f564a7b 100644 --- a/layout/svg/base/src/nsSVGGeometryFrame.cpp +++ b/layout/svg/base/src/nsSVGGeometryFrame.cpp @@ -98,6 +98,9 @@ nsSVGGeometryFrame::GetStrokeWidth() nsresult nsSVGGeometryFrame::GetStrokeDashArray(gfxFloat **aDashes, PRUint32 *aCount) { + nsSVGElement *ctx = static_cast + (GetType() == nsGkAtoms::svgGlyphFrame ? + mContent->GetParent() : mContent); *aDashes = nsnull; *aCount = 0; @@ -114,7 +117,7 @@ nsSVGGeometryFrame::GetStrokeDashArray(gfxFloat **aDashes, PRUint32 *aCount) for (PRUint32 i = 0; i < count; i++) { dashes[i] = nsSVGUtils::CoordToFloat(presContext, - static_cast(mContent), + ctx, dasharray[i]); if (dashes[i] < 0.0f) { delete [] dashes; @@ -141,9 +144,13 @@ nsSVGGeometryFrame::GetStrokeDashArray(gfxFloat **aDashes, PRUint32 *aCount) float nsSVGGeometryFrame::GetStrokeDashoffset() { + nsSVGElement *ctx = static_cast + (GetType() == nsGkAtoms::svgGlyphFrame ? + mContent->GetParent() : mContent); + return nsSVGUtils::CoordToFloat(PresContext(), - static_cast(mContent), + ctx, GetStyleSVG()->mStrokeDashoffset); } From 47250a3109629fa5eae62f611a59cd4b020142d9 Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Fri, 14 Nov 2008 13:16:17 -0800 Subject: [PATCH 04/16] Backed out changeset e4690fcf6f7c, due to reftest failures on linux (421885-1.xml and 403181-1.xml) --- gfx/src/thebes/nsThebesImage.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/gfx/src/thebes/nsThebesImage.cpp b/gfx/src/thebes/nsThebesImage.cpp index f2d2a77e7861..e93814f39325 100644 --- a/gfx/src/thebes/nsThebesImage.cpp +++ b/gfx/src/thebes/nsThebesImage.cpp @@ -635,12 +635,8 @@ nsThebesImage::Draw(gfxContext* aContext, // get blurry edges. CAIRO_EXTEND_PAD would also work here, if // available // - // This effectively disables smooth upscaling for images. So only set the - // FAST filter on upscaling. We must NEVER use FAST on downscaling otherwise - // very ugly images will result all over chrome and the web. - // xx is x scaling, yy is y scaling. Lower number is higher scale. - if (userSpaceToImageSpace.xx < 1.0 || userSpaceToImageSpace.yy < 1.0) - pattern->SetFilter(0); + // This effectively disables smooth upscaling for images. + pattern->SetFilter(0); break; case gfxASurface::SurfaceTypeQuartz: From 2cdbbe7481f8721bb901bab5854e54bc9215e61f Mon Sep 17 00:00:00 2001 From: Brendan Eich Date: Fri, 14 Nov 2008 13:23:12 -0800 Subject: [PATCH 05/16] Fix bogus assertion left in bug 463334. --- js/src/jsinterp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/jsinterp.cpp b/js/src/jsinterp.cpp index bc7bbbbf10f1..0484a17ff516 100644 --- a/js/src/jsinterp.cpp +++ b/js/src/jsinterp.cpp @@ -2956,7 +2956,7 @@ js_Interpret(JSContext *cx) JS_ASSERT(op == JSOP_STOP); end_imacro: - JS_ASSERT((uintN)(regs.sp - fp->slots) < script->nslots); + JS_ASSERT((uintN)(regs.sp - fp->slots) <= script->nslots); regs.pc = fp->imacpc + js_CodeSpec[*fp->imacpc].length; fp->imacpc = NULL; atoms = script->atomMap.vector; From 3953a6890fd5a9baf535b65cac13834f3335c09a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20B=C3=BCnzli?= Date: Fri, 14 Nov 2008 14:03:36 -0800 Subject: [PATCH 06/16] bug 463206: SessionStore does not always correctly restore text data; r=dietrich, a1.9.1b2=beltzner --- .../sessionstore/src/nsSessionStore.js | 4 +- .../sessionstore/test/browser/Makefile.in | 2 + .../test/browser/browser_463206.js | 94 +++++++++++++++++++ .../test/browser/browser_463206_sample.html | 10 ++ 4 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 browser/components/sessionstore/test/browser/browser_463206.js create mode 100644 browser/components/sessionstore/test/browser/browser_463206_sample.html diff --git a/browser/components/sessionstore/src/nsSessionStore.js b/browser/components/sessionstore/src/nsSessionStore.js index 2db5de36a3e8..f8d287ffa33d 100644 --- a/browser/components/sessionstore/src/nsSessionStore.js +++ b/browser/components/sessionstore/src/nsSessionStore.js @@ -1957,7 +1957,7 @@ SessionStoreService.prototype = { var textArray = this.__SS_restore_text ? this.__SS_restore_text.split(" ") : []; function restoreTextData(aContent, aPrefix) { textArray.forEach(function(aEntry) { - if (/^((?:\d+\|)*)(#?)([^\s=]+)=(.*)$/.test(aEntry) && (!RegExp.$1 || RegExp.$1 == aPrefix)) { + if (/^((?:\d+\|)*)(#?)([^\s=]+)=(.*)$/.test(aEntry) && RegExp.$1 == aPrefix) { var document = aContent.document; var node = RegExp.$2 ? document.getElementById(RegExp.$3) : document.getElementsByName(RegExp.$3)[0] || null; if (node && "value" in node) { @@ -2023,7 +2023,7 @@ SessionStoreService.prototype = { }); for (var i = 0; i < aContent.frames.length; i++) { if (aData.children && aData.children[i]) { - restoreTextDataAndScrolling(aContent.frames[i], aData.children[i], i + "|" + aPrefix); + restoreTextDataAndScrolling(aContent.frames[i], aData.children[i], aPrefix + i + "|"); } } } diff --git a/browser/components/sessionstore/test/browser/Makefile.in b/browser/components/sessionstore/test/browser/Makefile.in index 410fff11b330..f61b61fb85ef 100644 --- a/browser/components/sessionstore/test/browser/Makefile.in +++ b/browser/components/sessionstore/test/browser/Makefile.in @@ -63,6 +63,8 @@ _BROWSER_TEST_FILES = \ browser_454908_sample.html \ browser_456342.js \ browser_456342_sample.xhtml \ + browser_463206.js \ + browser_463206_sample.html \ $(NULL) libs:: $(_BROWSER_TEST_FILES) diff --git a/browser/components/sessionstore/test/browser/browser_463206.js b/browser/components/sessionstore/test/browser/browser_463206.js new file mode 100644 index 000000000000..a4c66c3935c7 --- /dev/null +++ b/browser/components/sessionstore/test/browser/browser_463206.js @@ -0,0 +1,94 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is sessionstore test code. + * + * The Initial Developer of the Original Code is + * Simon Bünzli . + * Portions created by the Initial Developer are Copyright (C) 2008 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +function test() { + /** Test for Bug 463206 **/ + + waitForExplicitFinish(); + + let testURL = "http://localhost:8888/browser/" + + "browser/components/sessionstore/test/browser/browser_463206_sample.html"; + + var frameCount = 0; + let tab = gBrowser.addTab(testURL); + tab.linkedBrowser.addEventListener("load", function(aEvent) { + // wait for all frames to load completely + if (frameCount++ < 5) + return; + this.removeEventListener("load", arguments.callee, true); + + function typeText(aTextField, aValue) { + aTextField.value = aValue; + + let event = aTextField.ownerDocument.createEvent("UIEvents"); + event.initUIEvent("input", true, true, aTextField.ownerDocument.defaultView, 0); + aTextField.dispatchEvent(event); + } + + let doc = tab.linkedBrowser.contentDocument; + typeText(doc.getElementById("out1"), Date.now()); + typeText(doc.getElementsByName("1|#out2")[0], Math.random()); + typeText(doc.defaultView.frames[0].frames[1].document.getElementById("in1"), new Date()); + + frameCount = 0; + let tab2 = gBrowser.duplicateTab(tab); + tab2.linkedBrowser.addEventListener("load", function(aEvent) { + // wait for all frames to load completely + if (frameCount++ < 5) + return; + + let doc = tab2.linkedBrowser.contentDocument; + let win = tab2.linkedBrowser.contentWindow; + isnot(doc.getElementById("out1").value, + win.frames[1].document.getElementById("out1").value, + "text isn't reused for frames"); + isnot(doc.getElementsByName("1|#out2")[0].value, "", + "text containing | and # is correctly restored"); + is(win.frames[1].document.getElementById("out2").value, "", + "id prefixes can't be faked"); + isnot(win.frames[0].frames[1].document.getElementById("in1").value, "", + "id prefixes aren't mixed up"); + is(win.frames[1].frames[0].document.getElementById("in1").value, "", + "id prefixes aren't mixed up"); + + // clean up + gBrowser.removeTab(tab2); + gBrowser.removeTab(tab); + + finish(); + }, true); + }, true); +} diff --git a/browser/components/sessionstore/test/browser/browser_463206_sample.html b/browser/components/sessionstore/test/browser/browser_463206_sample.html new file mode 100644 index 000000000000..48a841ee6957 --- /dev/null +++ b/browser/components/sessionstore/test/browser/browser_463206_sample.html @@ -0,0 +1,10 @@ + + + +Test for bug 463206 + + + + + + From 2a6876ff605719b2c2d4907fd40851decfd44b35 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Fri, 14 Nov 2008 14:07:45 -0800 Subject: [PATCH 07/16] Remove unwanted style attribute that slipped in from vlad's changes. --- layout/tools/reftest/reftest-analyzer.xhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/tools/reftest/reftest-analyzer.xhtml b/layout/tools/reftest/reftest-analyzer.xhtml index 9133fa0641c6..407158d700f3 100644 --- a/layout/tools/reftest/reftest-analyzer.xhtml +++ b/layout/tools/reftest/reftest-analyzer.xhtml @@ -293,7 +293,7 @@ function show_differences(cb) { - + From 06525abe293195d74151ff09449cd8ab1e274fa5 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Fri, 14 Nov 2008 14:07:45 -0800 Subject: [PATCH 08/16] Adjust expected results based on http://lists.w3.org/Archives/Public/www-style/2008Nov/0190.html and add tests for format(). (Bug 457821) --HG-- rename : layout/reftests/font-face/src-list-1-ref.html => layout/reftests/font-face/order-1-ref.html rename : layout/reftests/font-face/src-list-2-ref.html => layout/reftests/font-face/order-2-ref.html rename : layout/reftests/font-face/src-list-3-ref.html => layout/reftests/font-face/order-3-ref.html --- layout/reftests/font-face/order-1-ref.html | 23 +++++++++++++ .../{src-list-3-ref.html => order-2-ref.html} | 10 +++++- layout/reftests/font-face/order-2.html | 10 +++++- layout/reftests/font-face/order-3-ref.html | 34 +++++++++++++++++++ layout/reftests/font-face/order-3.html | 10 +++++- layout/reftests/font-face/reftest.list | 14 ++++---- layout/reftests/font-face/src-list-1-ref.html | 8 ++--- layout/reftests/font-face/src-list-2-ref.html | 11 +++--- layout/reftests/font-face/src-list-2.html | 2 +- .../font-face/src-list-format-1-ref.html | 23 +++++++++++++ ...src-list-3.html => src-list-format-1.html} | 2 +- .../font-face/src-list-format-2-ref.html | 23 +++++++++++++ .../reftests/font-face/src-list-format-2.html | 23 +++++++++++++ .../font-face/src-list-format-3-ref.html | 23 +++++++++++++ .../reftests/font-face/src-list-format-3.html | 23 +++++++++++++ 15 files changed, 217 insertions(+), 22 deletions(-) create mode 100644 layout/reftests/font-face/order-1-ref.html rename layout/reftests/font-face/{src-list-3-ref.html => order-2-ref.html} (69%) create mode 100644 layout/reftests/font-face/order-3-ref.html create mode 100644 layout/reftests/font-face/src-list-format-1-ref.html rename layout/reftests/font-face/{src-list-3.html => src-list-format-1.html} (76%) create mode 100644 layout/reftests/font-face/src-list-format-2-ref.html create mode 100644 layout/reftests/font-face/src-list-format-2.html create mode 100644 layout/reftests/font-face/src-list-format-3-ref.html create mode 100644 layout/reftests/font-face/src-list-format-3.html diff --git a/layout/reftests/font-face/order-1-ref.html b/layout/reftests/font-face/order-1-ref.html new file mode 100644 index 000000000000..e2fab2c08fd1 --- /dev/null +++ b/layout/reftests/font-face/order-1-ref.html @@ -0,0 +1,23 @@ + + + + + + + + + +

ABC

+ + + diff --git a/layout/reftests/font-face/src-list-3-ref.html b/layout/reftests/font-face/order-2-ref.html similarity index 69% rename from layout/reftests/font-face/src-list-3-ref.html rename to layout/reftests/font-face/order-2-ref.html index 32ae43ce8a8c..05dc87560809 100644 --- a/layout/reftests/font-face/src-list-3-ref.html +++ b/layout/reftests/font-face/order-2-ref.html @@ -16,11 +16,19 @@ src: url(../fonts/mark2B.ttf); } + span.spacer { + /* to ensure the same vertical positioning of the text */ + display: inline-block; + height: 3em; + width: 1em; + vertical-align: baseline; + } + -

ABC

+

ABC

diff --git a/layout/reftests/font-face/order-2.html b/layout/reftests/font-face/order-2.html index b6e6ddbb8008..fa7a94d9d55b 100644 --- a/layout/reftests/font-face/order-2.html +++ b/layout/reftests/font-face/order-2.html @@ -28,11 +28,19 @@ body { font-family: "One"; } + span.spacer { + /* to ensure the same vertical positioning of the text */ + display: inline-block; + height: 3em; + width: 1em; + vertical-align: baseline; + } + -

ABC

+

ABC

diff --git a/layout/reftests/font-face/order-3-ref.html b/layout/reftests/font-face/order-3-ref.html new file mode 100644 index 000000000000..05dc87560809 --- /dev/null +++ b/layout/reftests/font-face/order-3-ref.html @@ -0,0 +1,34 @@ + + + + + + + + + +

ABC

+ + + diff --git a/layout/reftests/font-face/order-3.html b/layout/reftests/font-face/order-3.html index e481792da16b..c1c215d1b3ce 100644 --- a/layout/reftests/font-face/order-3.html +++ b/layout/reftests/font-face/order-3.html @@ -28,11 +28,19 @@ body { font-family: "One"; } + span.spacer { + /* to ensure the same vertical positioning of the text */ + display: inline-block; + height: 3em; + width: 1em; + vertical-align: baseline; + } + -

ABC

+

ABC

diff --git a/layout/reftests/font-face/reftest.list b/layout/reftests/font-face/reftest.list index 2c2df3488373..c19871b59fa2 100644 --- a/layout/reftests/font-face/reftest.list +++ b/layout/reftests/font-face/reftest.list @@ -11,14 +11,16 @@ fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) != name-override-simple-1.html dow fails HTTP(..) == name-override-1.html name-override-1-ref.html HTTP(..) == multiple-descriptor-1.html multiple-descriptor-1-ref.html fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) != multiple-descriptor-1.html multiple-descriptor-1-notref.html -HTTP(..) == src-list-1.html src-list-1-ref.html -fails-if(MOZ_WIDGET_TOOLKIT!="gtk2") HTTP(..) == src-list-2.html src-list-2-ref.html -fails-if(MOZ_WIDGET_TOOLKIT!="gtk2") HTTP(..) == src-list-3.html src-list-3-ref.html +fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == src-list-1.html src-list-1-ref.html +fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == src-list-2.html src-list-2-ref.html +fails HTTP(..) == src-list-format-1.html src-list-format-1-ref.html +fails HTTP(..) == src-list-format-2.html src-list-format-2-ref.html +fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == src-list-format-3.html src-list-format-3-ref.html # FIXME: The behavior here is neither mandated nor specified by the spec, but # it really ought to be. -HTTP(..) == order-1.html src-list-1-ref.html -fails-if(MOZ_WIDGET_TOOLKIT!="gtk2") HTTP(..) == order-2.html src-list-2-ref.html -fails-if(MOZ_WIDGET_TOOLKIT!="gtk2") HTTP(..) == order-3.html src-list-3-ref.html +HTTP(..) == order-1.html order-1-ref.html +fails-if(MOZ_WIDGET_TOOLKIT!="gtk2") HTTP(..) == order-2.html order-2-ref.html +fails-if(MOZ_WIDGET_TOOLKIT!="gtk2") HTTP(..) == order-3.html order-3-ref.html fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") random-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) == multiple-in-family-1.html multiple-in-family-1-ref.html fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") random-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) != multiple-in-family-1.html multiple-in-family-1-notref.html random-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) == prop-order-over-rule-order-1a.html prop-order-over-rule-order-2a.html diff --git a/layout/reftests/font-face/src-list-1-ref.html b/layout/reftests/font-face/src-list-1-ref.html index e2fab2c08fd1..660046dd147f 100644 --- a/layout/reftests/font-face/src-list-1-ref.html +++ b/layout/reftests/font-face/src-list-1-ref.html @@ -7,17 +7,17 @@ -

ABC

+

DBC

diff --git a/layout/reftests/font-face/src-list-2-ref.html b/layout/reftests/font-face/src-list-2-ref.html index 32ae43ce8a8c..02316eaaceaf 100644 --- a/layout/reftests/font-face/src-list-2-ref.html +++ b/layout/reftests/font-face/src-list-2-ref.html @@ -7,20 +7,17 @@ -

ABC

+

DBC

diff --git a/layout/reftests/font-face/src-list-2.html b/layout/reftests/font-face/src-list-2.html index 622765c8278d..5cfb307ae1b8 100644 --- a/layout/reftests/font-face/src-list-2.html +++ b/layout/reftests/font-face/src-list-2.html @@ -8,7 +8,7 @@ @font-face { font-family: "One"; - src: url(../fonts/markA.ttf), url(../fonts/mark2A.ttf), url(../fonts/mark2B.ttf), url(../fonts/markB.ttf); + src: url(../fonts/markA.ttf), url(../fonts/markB.ttf); } body { font-family: "One"; } diff --git a/layout/reftests/font-face/src-list-format-1-ref.html b/layout/reftests/font-face/src-list-format-1-ref.html new file mode 100644 index 000000000000..551d75b35f5f --- /dev/null +++ b/layout/reftests/font-face/src-list-format-1-ref.html @@ -0,0 +1,23 @@ + + + + + + + + + +

DBC

+ + + diff --git a/layout/reftests/font-face/src-list-3.html b/layout/reftests/font-face/src-list-format-1.html similarity index 76% rename from layout/reftests/font-face/src-list-3.html rename to layout/reftests/font-face/src-list-format-1.html index a951f4eefdfc..437847a8d24d 100644 --- a/layout/reftests/font-face/src-list-3.html +++ b/layout/reftests/font-face/src-list-format-1.html @@ -8,7 +8,7 @@ @font-face { font-family: "One"; - src: url(../fonts/markA.ttf), url(../fonts/mark2B.ttf), url(../fonts/mark2A.ttf), url(../fonts/markB.ttf); + src: url(../fonts/markA.ttf) format("unknown"), url(../fonts/mark2A.ttf); } body { font-family: "One"; } diff --git a/layout/reftests/font-face/src-list-format-2-ref.html b/layout/reftests/font-face/src-list-format-2-ref.html new file mode 100644 index 000000000000..551d75b35f5f --- /dev/null +++ b/layout/reftests/font-face/src-list-format-2-ref.html @@ -0,0 +1,23 @@ + + + + + + + + + +

DBC

+ + + diff --git a/layout/reftests/font-face/src-list-format-2.html b/layout/reftests/font-face/src-list-format-2.html new file mode 100644 index 000000000000..2319f10558e9 --- /dev/null +++ b/layout/reftests/font-face/src-list-format-2.html @@ -0,0 +1,23 @@ + + + + + + + + + +

ABC

+ + + diff --git a/layout/reftests/font-face/src-list-format-3-ref.html b/layout/reftests/font-face/src-list-format-3-ref.html new file mode 100644 index 000000000000..02316eaaceaf --- /dev/null +++ b/layout/reftests/font-face/src-list-format-3-ref.html @@ -0,0 +1,23 @@ + + + + + + + + + +

DBC

+ + + diff --git a/layout/reftests/font-face/src-list-format-3.html b/layout/reftests/font-face/src-list-format-3.html new file mode 100644 index 000000000000..00c7678aed83 --- /dev/null +++ b/layout/reftests/font-face/src-list-format-3.html @@ -0,0 +1,23 @@ + + + + + + + + + +

ABC

+ + + From e67249b3e3a9a34e6cedf7740a5cbe704b932912 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Fri, 14 Nov 2008 14:07:45 -0800 Subject: [PATCH 09/16] Better approach to some tests to avoid subpixel spacing differences. (Bug 457821) --- .../multiple-in-family-1-notref.html | 3 +++ .../font-face/multiple-in-family-1-ref.html | 10 ++++++++- .../font-face/multiple-in-family-1.html | 3 +++ layout/reftests/font-face/order-2-ref.html | 19 ++++-------------- layout/reftests/font-face/order-2.html | 10 +-------- layout/reftests/font-face/order-3-ref.html | 19 ++++-------------- layout/reftests/font-face/order-3.html | 10 +-------- layout/reftests/font-face/reftest.list | 6 +++--- layout/reftests/fonts/mark-generate.py | 19 ++++++++++++++++++ layout/reftests/fonts/markXmark2Y.ttf | Bin 0 -> 1648 bytes 10 files changed, 47 insertions(+), 52 deletions(-) create mode 100644 layout/reftests/fonts/markXmark2Y.ttf diff --git a/layout/reftests/font-face/multiple-in-family-1-notref.html b/layout/reftests/font-face/multiple-in-family-1-notref.html index e2fab2c08fd1..ec5e8f4da360 100644 --- a/layout/reftests/font-face/multiple-in-family-1-notref.html +++ b/layout/reftests/font-face/multiple-in-family-1-notref.html @@ -18,6 +18,9 @@

ABC

+

A

+

B

+

C

diff --git a/layout/reftests/font-face/multiple-in-family-1-ref.html b/layout/reftests/font-face/multiple-in-family-1-ref.html index f78c2b3acda6..2e79e70d2502 100644 --- a/layout/reftests/font-face/multiple-in-family-1-ref.html +++ b/layout/reftests/font-face/multiple-in-family-1-ref.html @@ -16,11 +16,19 @@ src: url(../fonts/markB.ttf); } + @font-face { + font-family: "MarkD"; + src: url(../fonts/markD.ttf); + } + -

ABC

+

DDC

+

A

+

B

+

C

diff --git a/layout/reftests/font-face/multiple-in-family-1.html b/layout/reftests/font-face/multiple-in-family-1.html index 43aa47139a40..0bc5bc8d02c3 100644 --- a/layout/reftests/font-face/multiple-in-family-1.html +++ b/layout/reftests/font-face/multiple-in-family-1.html @@ -23,6 +23,9 @@

ABC

+

A

+

B

+

C

diff --git a/layout/reftests/font-face/order-2-ref.html b/layout/reftests/font-face/order-2-ref.html index 05dc87560809..35b31763765d 100644 --- a/layout/reftests/font-face/order-2-ref.html +++ b/layout/reftests/font-face/order-2-ref.html @@ -7,28 +7,17 @@ -

ABC

+

XYC

diff --git a/layout/reftests/font-face/order-2.html b/layout/reftests/font-face/order-2.html index fa7a94d9d55b..b6e6ddbb8008 100644 --- a/layout/reftests/font-face/order-2.html +++ b/layout/reftests/font-face/order-2.html @@ -28,19 +28,11 @@ body { font-family: "One"; } - span.spacer { - /* to ensure the same vertical positioning of the text */ - display: inline-block; - height: 3em; - width: 1em; - vertical-align: baseline; - } - -

ABC

+

ABC

diff --git a/layout/reftests/font-face/order-3-ref.html b/layout/reftests/font-face/order-3-ref.html index 05dc87560809..35b31763765d 100644 --- a/layout/reftests/font-face/order-3-ref.html +++ b/layout/reftests/font-face/order-3-ref.html @@ -7,28 +7,17 @@ -

ABC

+

XYC

diff --git a/layout/reftests/font-face/order-3.html b/layout/reftests/font-face/order-3.html index c1c215d1b3ce..e481792da16b 100644 --- a/layout/reftests/font-face/order-3.html +++ b/layout/reftests/font-face/order-3.html @@ -28,19 +28,11 @@ body { font-family: "One"; } - span.spacer { - /* to ensure the same vertical positioning of the text */ - display: inline-block; - height: 3em; - width: 1em; - vertical-align: baseline; - } - -

ABC

+

ABC

diff --git a/layout/reftests/font-face/reftest.list b/layout/reftests/font-face/reftest.list index c19871b59fa2..150995ed9eb4 100644 --- a/layout/reftests/font-face/reftest.list +++ b/layout/reftests/font-face/reftest.list @@ -19,9 +19,9 @@ fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == src-list-format-3.html src-list # FIXME: The behavior here is neither mandated nor specified by the spec, but # it really ought to be. HTTP(..) == order-1.html order-1-ref.html -fails-if(MOZ_WIDGET_TOOLKIT!="gtk2") HTTP(..) == order-2.html order-2-ref.html -fails-if(MOZ_WIDGET_TOOLKIT!="gtk2") HTTP(..) == order-3.html order-3-ref.html -fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") random-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) == multiple-in-family-1.html multiple-in-family-1-ref.html +fails HTTP(..) == order-2.html order-2-ref.html +fails HTTP(..) == order-3.html order-3-ref.html +fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") random-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) == multiple-in-family-1.html multiple-in-family-1-ref.html fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") random-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) != multiple-in-family-1.html multiple-in-family-1-notref.html random-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) == prop-order-over-rule-order-1a.html prop-order-over-rule-order-2a.html random-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) == prop-order-over-rule-order-1b.html prop-order-over-rule-order-2b.html diff --git a/layout/reftests/fonts/mark-generate.py b/layout/reftests/fonts/mark-generate.py index 50e9ea8380a7..993aad3e90d6 100755 --- a/layout/reftests/fonts/mark-generate.py +++ b/layout/reftests/fonts/mark-generate.py @@ -66,3 +66,22 @@ for codepoint in range(ord("A"), ord("D") + 1): g.width = width f.generate("mark" + mark + charname + ".ttf") + +# And, for references, generate markXmark2Y +f = fontforge.font() +n = "MarkXMark2Y" +f.fontname = n +f.familyname = n +f.fullname = n +f.copyright = "Copyright (c) 2008 Mozilla Corporation" + +g = f.createChar(ord("X"), "X") +g.importOutlines("mark-glyph.svg") +g.width = 1500 + +g = f.createChar(ord("Y"), "Y") +g.importOutlines("mark2-glyph.svg") +g.width = 1800 + +f.generate("markXmark2Y.ttf") + diff --git a/layout/reftests/fonts/markXmark2Y.ttf b/layout/reftests/fonts/markXmark2Y.ttf new file mode 100644 index 0000000000000000000000000000000000000000..7a949e345591f1cef9023cb3d78fbd6a94666a29 GIT binary patch literal 1648 zcmcgsO=uKn7=FI_+l0i%&?r6R@GX{_h;C+AEWvJDZQ4CZSEWkW3+AfdaJbcDd38REd1H-16EONez(SV*jB0Sw|yn ztN-DNvc~buQbK))bx9b!PZa67qmN4k>VE@_Pul)cC%i)s zIGXx{kh!s6y7=_Qrz814F=XDS1h?P+Mfb;axaM3jHpmBHh?I>!#zwe?d6_GtU5O$I z>@_=**cg`CvWcgPWXF(+B+3cYHf*ZCilSePNA)|hiq;04*i(!p&we|-@KFWFP{N$4 z!)eUZyFz7Rqnb#IsVV~Y7Ank8v=U4Dcw(0)6OVCN&>Ss3!soa?Kq(BvANvuVesD-; z{VEVfP5fT5nbs>h{{L>#KE{FQDPW#eNV6^njLWQK3Ym3Cyd%NB5=G;QhOIjmys#(gu%^iAuO;FLOmD<`Cl_N$=_R zZMFUEL-WhOuiIm4dvkN=Uffv8^~8Na;}G-~yZo+wZ1oa;{OqJN>$YoHqa+sso z3(l3~lM{j}3*O-LS|rs<<2=Vg^q)>N2F$k_Wtm}?8b_l%UluslWs$`pcKP;ZhJwG? zDfmIHs&g4vAJs3UK$guO;w$s`Z#mC0p#V!sIdoLMEUzLdqoj!0YOur#XxGhVT-T+f pSAc&jMgKMkzhLGsYrNsOQw+R=ydd5$@m)xA>%FfZiOY-k?Q=y!^9ld} literal 0 HcmV?d00001 From a588e05c36d9079c7d46406aa6d5ed3ddcb14fea Mon Sep 17 00:00:00 2001 From: Jim Mathies Date: Fri, 14 Nov 2008 14:23:02 -0800 Subject: [PATCH 10/16] bug 440911: Add CF_HDROP support back into Windows drag and drop data object (dragging images to some applications, e.g. PhotoShop, fails); r=emaijala, approval1.9.1b2=beltzner --- widget/src/windows/nsDataObj.cpp | 221 ++++++++++++++++++++++++--- widget/src/windows/nsDataObj.h | 3 +- widget/src/windows/nsDragService.cpp | 2 +- 3 files changed, 207 insertions(+), 19 deletions(-) diff --git a/widget/src/windows/nsDataObj.cpp b/widget/src/windows/nsDataObj.cpp index be56e8302e1e..99f0d92f14a3 100644 --- a/widget/src/windows/nsDataObj.cpp +++ b/widget/src/windows/nsDataObj.cpp @@ -62,6 +62,32 @@ #include "nsXPCOMStrings.h" #include "nscore.h" #include "prtypes.h" +#include "nsDirectoryServiceDefs.h" + +// XXX Duped from profile/src/nsProfile.cpp. +#include +#define TABLE_SIZE 36 +static const char table[] = + { 'a','b','c','d','e','f','g','h','i','j', + 'k','l','m','n','o','p','q','r','s','t', + 'u','v','w','x','y','z','0','1','2','3', + '4','5','6','7','8','9' }; +static void +MakeRandomString(char *buf, PRInt32 bufLen) +{ + // turn PR_Now() into milliseconds since epoch + // and salt rand with that. + double fpTime; + LL_L2D(fpTime, PR_Now()); + srand((uint)(fpTime * 1e-6 + 0.5)); // use 1e-6, granularity of PR_Now() on the mac is seconds + + PRInt32 i; + for (i=0;icfFormat, CF_TEXT); + PRNTDEBUG3(" format: %d Text: %d\n", pFE->cfFormat, CF_HDROP); if ( !mTransferable ) return ResultFromScode(DATA_E_FORMATETC); @@ -486,6 +512,11 @@ STDMETHODIMP nsDataObj::GetData(LPFORMATETC pFE, LPSTGMEDIUM pSTM) case CF_UNICODETEXT: return GetText(*df, *pFE, *pSTM); + // Some 3rd party apps that receive drag and drop files from the browser + // window require support for this. + case CF_HDROP: + return GetFile(*pFE, *pSTM); + // Someone is asking for an image case CF_DIB: return GetDib(*df, *pFE, *pSTM); @@ -537,7 +568,7 @@ STDMETHODIMP nsDataObj::GetDataHere(LPFORMATETC pFE, LPSTGMEDIUM pSTM) STDMETHODIMP nsDataObj::QueryGetData(LPFORMATETC pFE) { PRNTDEBUG("nsDataObj::QueryGetData "); - PRNTDEBUG3("format: %d Text: %d\n", pFE->cfFormat, CF_TEXT); + PRNTDEBUG2("format: %d\n", pFE->cfFormat); // Arbitrary system formats LPDATAENTRY pde; @@ -553,7 +584,7 @@ STDMETHODIMP nsDataObj::QueryGetData(LPFORMATETC pFE) return S_OK; } } - + PRNTDEBUG2("***** nsDataObj::QueryGetData - Unknown format %d\n", pFE->cfFormat); return ResultFromScode(E_FAIL); } @@ -1349,6 +1380,173 @@ HRESULT nsDataObj::GetText(const nsACString & aDataFlavor, FORMATETC& aFE, STGME return ResultFromScode(S_OK); } +//----------------------------------------------------- +HRESULT nsDataObj::GetFile(FORMATETC& aFE, STGMEDIUM& aSTG) +{ + HRESULT res = S_OK; + + // We do not support 'application/x-moz-file-promise' since CF_HDROP does not + // allow for delayed rendering of content. We'll need to write the content out emmediately + // and return the path to it. Confirm we have support for 'application/x-moz-nativeimage', + // if not fail. + PRUint32 dfInx = 0; + ULONG count; + FORMATETC fe; + m_enumFE->Reset(); + PRBool found = PR_FALSE; + while (NOERROR == m_enumFE->Next(1, &fe, &count)) { + nsCString * df = reinterpret_cast(mDataFlavors.SafeElementAt(dfInx)); + dfInx++; + if (df && df->EqualsLiteral(kNativeImageMime)) { + found = PR_TRUE; + break; + } + } + + if (!found) + return E_FAIL; + + nsresult rv; + PRUint32 len = 0; + nsCOMPtr genericDataWrapper; + + mTransferable->GetTransferData(kNativeImageMime, getter_AddRefs(genericDataWrapper), &len); + nsCOMPtr image ( do_QueryInterface(genericDataWrapper) ); + + if (!image) { + // In the 0.9.4 timeframe, I had some embedding clients put the nsIImage directly into the + // transferable. Newer code, however, wraps the nsIImage in a nsISupportsInterfacePointer. + // We should be backwards compatibile with code already out in the field. If we can't find + // the image directly out of the transferable, unwrap the image from its wrapper. + nsCOMPtr ptr(do_QueryInterface(genericDataWrapper)); + if (ptr) + ptr->GetData(getter_AddRefs(image)); + } + + if (!image) + return E_FAIL; + + // Use the clipboard helper class to build up a memory bitmap. + nsImageToClipboard converter(image); + HANDLE bits = nsnull; + rv = converter.GetPicture(&bits); // Clipboard routines return a global handle we own. + + if (NS_FAILED(rv) || !bits) + return E_FAIL; + + // We now own these bits! + PRUint32 bitmapSize = GlobalSize(bits); + if (!bitmapSize) { + GlobalFree(bits); + return E_FAIL; + } + + if (mCachedTempFile) { + mCachedTempFile->Remove(PR_FALSE); + mCachedTempFile = NULL; + } + + // Save the bitmap to a temporary location. + nsCOMPtr dropFile; + rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(dropFile)); + if (!dropFile) + return E_FAIL; + + // Filename must be random so as not to confuse apps like Photshop which handle + // multiple drags into a single window. + char buf[13]; + nsCString filename; + MakeRandomString(buf, 8); + memcpy(buf+8, ".bmp", 5); + filename.Append(nsDependentCString(buf, 12)); + dropFile->AppendNative(filename); + rv = dropFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0660); + if (NS_FAILED(rv)) { + GlobalFree(bits); + return E_FAIL; + } + + // Cache the temp file so we can delete it later. + dropFile->Clone(getter_AddRefs(mCachedTempFile)); + + // Write the data to disk. + nsCOMPtr outStream; + rv = NS_NewLocalFileOutputStream(getter_AddRefs(outStream), dropFile); + if (NS_FAILED(rv)) { + GlobalFree(bits); + return E_FAIL; + } + + char * bm = (char *)GlobalLock(bits); + + BITMAPFILEHEADER fileHdr; + BITMAPINFOHEADER *bmpHdr = (BITMAPINFOHEADER*)bm; + + fileHdr.bfType = ((WORD) ('M' << 8) | 'B'); + fileHdr.bfSize = GlobalSize (bits) + sizeof(fileHdr); + fileHdr.bfReserved1 = 0; + fileHdr.bfReserved2 = 0; + fileHdr.bfOffBits = (DWORD) (sizeof(fileHdr) + bmpHdr->biSize); + + PRUint32 writeCount = 0; + if (NS_FAILED(outStream->Write((const char *)&fileHdr, sizeof(fileHdr), &writeCount)) || + NS_FAILED(outStream->Write((const char *)bm, bitmapSize, &writeCount))) + rv = NS_ERROR_FAILURE; + + outStream->Close(); + + GlobalUnlock(bits); + + if (NS_FAILED(rv)) { + GlobalFree(bits); + return E_FAIL; + } + + GlobalFree(bits); + + // Pass the file name back to the drop target so that it can access the file. + nsAutoString path; + rv = mCachedTempFile->GetPath(path); + if (NS_FAILED(rv)) + return E_FAIL; + + // Two null characters are needed to terminate the file name list. + HGLOBAL hGlobalMemory = NULL; + + PRUint32 allocLen = path.Length() + 2; + + aSTG.tymed = TYMED_HGLOBAL; + aSTG.pUnkForRelease = NULL; + + hGlobalMemory = GlobalAlloc(GMEM_MOVEABLE, sizeof(DROPFILES) + allocLen * sizeof(PRUnichar)); + if (!hGlobalMemory) + return E_FAIL; + + DROPFILES* pDropFile = (DROPFILES*)GlobalLock(hGlobalMemory); + + // First, populate the drop file structure. + pDropFile->pFiles = sizeof(DROPFILES); // Offset to start of file name char array. + pDropFile->fNC = 0; + pDropFile->pt.x = 0; + pDropFile->pt.y = 0; + pDropFile->fWide = TRUE; + + // Copy the filename right after the DROPFILES structure. + PRUnichar* dest = (PRUnichar*)(((char*)pDropFile) + pDropFile->pFiles); + memcpy(dest, path.get(), (allocLen - 1) * sizeof(PRUnichar)); // Copies the null character in path as well. + + // Two null characters are needed at the end of the file name. + // Lookup the CF_HDROP shell clipboard format for more info. + // Add the second null character right after the first one. + dest[allocLen - 1] = L'\0'; + + GlobalUnlock(hGlobalMemory); + + aSTG.hGlobal = hGlobalMemory; + + return S_OK; +} + //----------------------------------------------------- HRESULT nsDataObj::GetMetafilePict(FORMATETC&, STGMEDIUM&) { @@ -1408,22 +1606,11 @@ CLSID nsDataObj::GetClassID() const void nsDataObj::AddDataFlavor(const char* aDataFlavor, LPFORMATETC aFE) { // These two lists are the mapping to and from data flavors and FEs. - // Later, OLE will tell us it needs a certain type of FORMATETC (text, + // Later, OLE will tell us it needs a certain type of FORMATETC (text, unicode, etc) // unicode, etc), so we will look up the data flavor that corresponds to // the FE and then ask the transferable for that type of data. - -#ifndef WINCE - // Just ignore the CF_HDROP here - // all file drags are now handled by CFSTR_FileContents format - if (aFE->cfFormat == CF_HDROP) { - return; - } - else -#endif - { - mDataFlavors.AppendElement(new nsCString(aDataFlavor)); - m_enumFE->AddFE(aFE); - } + mDataFlavors.AppendElement(new nsCString(aDataFlavor)); + m_enumFE->AddFE(aFE); } //----------------------------------------------------- diff --git a/widget/src/windows/nsDataObj.h b/widget/src/windows/nsDataObj.h index 4b81f58044bd..033f0a51609b 100644 --- a/widget/src/windows/nsDataObj.h +++ b/widget/src/windows/nsDataObj.h @@ -224,6 +224,7 @@ class nsDataObj : public IDataObject, virtual HRESULT AddSetFormat(FORMATETC& FE); virtual HRESULT AddGetFormat(FORMATETC& FE); + virtual HRESULT GetFile ( FORMATETC& aFE, STGMEDIUM& aSTG ); virtual HRESULT GetText ( const nsACString& aDF, FORMATETC& aFE, STGMEDIUM & aSTG ); virtual HRESULT GetBitmap ( const nsACString& inFlavor, FORMATETC& FE, STGMEDIUM& STM); virtual HRESULT GetDib ( const nsACString& inFlavor, FORMATETC &, STGMEDIUM & aSTG ); @@ -272,7 +273,7 @@ class nsDataObj : public IDataObject, CEnumFormatEtc * m_enumFE; // Ownership Rules: // nsDataObj owns and ref counts CEnumFormatEtc, - nsCOMPtr mCachedTempFile; + nsCOMPtr mCachedTempFile; BOOL mIsAsyncMode; BOOL mIsInOperation; diff --git a/widget/src/windows/nsDragService.cpp b/widget/src/windows/nsDragService.cpp index fbe2e0e17008..03c064c53544 100644 --- a/widget/src/windows/nsDragService.cpp +++ b/widget/src/windows/nsDragService.cpp @@ -308,7 +308,7 @@ nsDragService::StartInvokingDragSession(IDataObject * aDataObj, // do async drag if (SUCCEEDED(aDataObj->QueryInterface(IID_IAsyncOperation, (void**)&pAsyncOp))) - pAsyncOp->SetAsyncMode(TRUE); + pAsyncOp->SetAsyncMode(VARIANT_TRUE); } // Call the native D&D method From a1c7b5aa6bd0470f6747f34863713bc8d169af8a Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Fri, 14 Nov 2008 16:04:26 -0800 Subject: [PATCH 11/16] Mark test as random on Mac, since it just failed on the tinderobx. --- layout/reftests/font-face/reftest.list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/reftests/font-face/reftest.list b/layout/reftests/font-face/reftest.list index 150995ed9eb4..55be42421c28 100644 --- a/layout/reftests/font-face/reftest.list +++ b/layout/reftests/font-face/reftest.list @@ -12,7 +12,7 @@ fails HTTP(..) == name-override-1.html name-override-1-ref.html HTTP(..) == multiple-descriptor-1.html multiple-descriptor-1-ref.html fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) != multiple-descriptor-1.html multiple-descriptor-1-notref.html fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == src-list-1.html src-list-1-ref.html -fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == src-list-2.html src-list-2-ref.html +fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") random-if(MOZ_WIDGET_TOOLKIT=="cocoa") HTTP(..) == src-list-2.html src-list-2-ref.html fails HTTP(..) == src-list-format-1.html src-list-format-1-ref.html fails HTTP(..) == src-list-format-2.html src-list-format-2-ref.html fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == src-list-format-3.html src-list-format-3-ref.html From b85b756fe2aebf38675b29036ec03854b591e49c Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Fri, 14 Nov 2008 16:27:26 -0800 Subject: [PATCH 12/16] OK, this is random on Windows too. --- layout/reftests/font-face/reftest.list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/reftests/font-face/reftest.list b/layout/reftests/font-face/reftest.list index 55be42421c28..0e53a3c75e7c 100644 --- a/layout/reftests/font-face/reftest.list +++ b/layout/reftests/font-face/reftest.list @@ -12,7 +12,7 @@ fails HTTP(..) == name-override-1.html name-override-1-ref.html HTTP(..) == multiple-descriptor-1.html multiple-descriptor-1-ref.html fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) != multiple-descriptor-1.html multiple-descriptor-1-notref.html fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == src-list-1.html src-list-1-ref.html -fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") random-if(MOZ_WIDGET_TOOLKIT=="cocoa") HTTP(..) == src-list-2.html src-list-2-ref.html +fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") random-if(MOZ_WIDGET_TOOLKIT=="cocoa") random-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) == src-list-2.html src-list-2-ref.html # random probably fixed by one of the patches on bug 457821 fails HTTP(..) == src-list-format-1.html src-list-format-1-ref.html fails HTTP(..) == src-list-format-2.html src-list-format-2-ref.html fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == src-list-format-3.html src-list-format-3-ref.html From a2e51a3845c70a42b5a79cd1829a60a8bff25563 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Fri, 14 Nov 2008 18:02:22 -0800 Subject: [PATCH 13/16] Mark yet another test random awaiting the font cache patch in bug 457821. --- layout/reftests/font-face/reftest.list | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layout/reftests/font-face/reftest.list b/layout/reftests/font-face/reftest.list index 0e53a3c75e7c..f9dfb9fdc95f 100644 --- a/layout/reftests/font-face/reftest.list +++ b/layout/reftests/font-face/reftest.list @@ -12,7 +12,7 @@ fails HTTP(..) == name-override-1.html name-override-1-ref.html HTTP(..) == multiple-descriptor-1.html multiple-descriptor-1-ref.html fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) != multiple-descriptor-1.html multiple-descriptor-1-notref.html fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == src-list-1.html src-list-1-ref.html -fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") random-if(MOZ_WIDGET_TOOLKIT=="cocoa") random-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) == src-list-2.html src-list-2-ref.html # random probably fixed by one of the patches on bug 457821 +fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") random-if(MOZ_WIDGET_TOOLKIT=="cocoa") random-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) == src-list-2.html src-list-2-ref.html # random probably fixed by the font cache patch on bug 457821 fails HTTP(..) == src-list-format-1.html src-list-format-1-ref.html fails HTTP(..) == src-list-format-2.html src-list-format-2-ref.html fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == src-list-format-3.html src-list-format-3-ref.html @@ -23,7 +23,7 @@ fails HTTP(..) == order-2.html order-2-ref.html fails HTTP(..) == order-3.html order-3-ref.html fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") random-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) == multiple-in-family-1.html multiple-in-family-1-ref.html fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") random-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) != multiple-in-family-1.html multiple-in-family-1-notref.html -random-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) == prop-order-over-rule-order-1a.html prop-order-over-rule-order-2a.html +random-if(MOZ_WIDGET_TOOLKIT=="windows") random-if(MOZ_WIDGET_TOOLKIT=="cocoa") HTTP(..) == prop-order-over-rule-order-1a.html prop-order-over-rule-order-2a.html # randomness on cocoa should be fixed by the font cache patch on bug 457821 random-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) == prop-order-over-rule-order-1b.html prop-order-over-rule-order-2b.html random-if(MOZ_WIDGET_TOOLKIT=="windows") fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) != prop-order-over-rule-order-1a.html prop-order-over-rule-order-1b.html fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == cross-iframe-1.html cross-iframe-1-ref.html From 3616a9b678e6fd975a0a6801cc36d7ab3abd65e7 Mon Sep 17 00:00:00 2001 From: Steffen Wilberg Date: Sat, 15 Nov 2008 18:32:08 +0100 Subject: [PATCH 14/16] Bug 464361: Add support for back and forward mouse buttons to View Source. r=gavin, a=beltzner --- .../components/viewsource/content/viewSource.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/toolkit/components/viewsource/content/viewSource.js b/toolkit/components/viewsource/content/viewSource.js index 94f375a3d6b2..36046679cfb1 100644 --- a/toolkit/components/viewsource/content/viewSource.js +++ b/toolkit/components/viewsource/content/viewSource.js @@ -256,6 +256,7 @@ function viewSource(url) document.getElementById("menu_highlightSyntax").setAttribute("hidden", "true"); } + window.addEventListener("AppCommand", HandleAppCommandEvent, true); window._content.focus(); return true; @@ -287,6 +288,19 @@ function onUnloadContent() document.getElementById('cmd_goToLine').setAttribute('disabled', 'true'); } +function HandleAppCommandEvent(evt) +{ + evt.stopPropagation(); + switch (evt.command) { + case "Back": + BrowserBack(); + break; + case "Forward": + BrowserForward(); + break; + } +} + function ViewSourceClose() { window.close(); From e1a8e0ad8120786d7f521d90cf93c5ae8dacaa28 Mon Sep 17 00:00:00 2001 From: Asaf Romano Date: Sat, 15 Nov 2008 21:47:53 +0200 Subject: [PATCH 15/16] Bug 225680 - Ability to detach tabs. r=mconnor, enn. a=beltzner. --- browser/base/content/browser.js | 18 ++- browser/base/content/browser.xul | 3 + browser/base/content/tabbrowser.xml | 124 ++++++++++++++---- browser/components/places/content/toolbar.xml | 7 +- 4 files changed, 121 insertions(+), 31 deletions(-) diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index ea744033f46e..9c902c66b665 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -863,7 +863,10 @@ function BrowserStartup() { var uriToLoad = null; // window.arguments[0]: URI to load (string), or an nsISupportsArray of - // nsISupportsStrings to load + // nsISupportsStrings to load, or a xul:tab of + // a tabbrowser, which will be replaced by this + // window (for this case, all other arguments are + // ignored). // [1]: character set (string) // [2]: referrer (nsIURI) // [3]: postData (nsIInputStream) @@ -880,7 +883,7 @@ function BrowserStartup() { appCore.startPageCycler(); #else # only load url passed in when we're not page cycling - if (uriToLoad && !isLoadingBlank) { + if (uriToLoad && !isLoadingBlank) { if (uriToLoad instanceof Ci.nsISupportsArray) { let count = uriToLoad.Count(); let specs = []; @@ -895,6 +898,17 @@ function BrowserStartup() { gBrowser.loadTabs(specs, false, true); } catch (e) {} } + else if (uriToLoad instanceof XULElement) { + // swap the given tab with the default about:blank tab and then close + // the original tab in the other window. + + // Stop the about:blank load + gBrowser.selectedBrowser.stop(); + // make sure it has a docshell + gBrowser.selectedBrowser.docShell; + + gBrowser.swapBrowsersAndCloseOther(gBrowser.selectedTab, uriToLoad); + } else if (window.arguments.length >= 3) { loadURI(uriToLoad, window.arguments[2], window.arguments[3] || null, window.arguments[4] || false); diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index 8b88f393d88c..90a31e3bfa7d 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -271,6 +271,9 @@ %globalDTD; + +%placesDTD; ]> - + @@ -92,6 +98,11 @@ oncommand="var tabbrowser = this.parentNode.parentNode.parentNode.parentNode; tabbrowser.removeAllTabsBut(tabbrowser.mContextTab);"/> + + + @@ -1783,17 +1802,12 @@ if (target.localName == "tab" && aEvent.originalTarget.localName != "toolbarbutton") { var dt = aEvent.dataTransfer; - dt.mozSetDataAt("application/x-moz-node", target, 0); - var URI = this.getBrowserForTab(aEvent.target).currentURI; - if (URI) { - var spec = URI.spec; - dt.mozSetDataAt("text/x-moz-url", spec + "\n" + aEvent.target.label, 0); - dt.mozSetDataAt("text/uri-list", spec + "\n" + aEvent.target.label, 0); - dt.mozSetDataAt("text/plain", spec, 0); - dt.mozSetDataAt("text/html", '' + aEvent.target.label + '', 0); - } else { - dt.mozSetDataAt("text/plain", "about:blank", 0); - } + // We're internetionally not setting any other data-type, otherwise + // applications may override our drop-as-window behavior + dt.mozSetDataAt("application/x-moz-tabbrowser-tab", target, 0); + + var canvas = tabPreviews.capture(target, false); + dt.setDragImage(canvas, 0, 0); } ]]> @@ -1806,10 +1820,23 @@ ["text/x-moz-url", "text/uri-list", "text/plain", "application/x-moz-file"] ]]> + null 1) @@ -1818,8 +1845,8 @@ var types = dt.mozTypesAt(0); var sourceNode = null; // tabs are always added as the first type - if (types[0] == "application/x-moz-node") { - var sourceNode = dt.mozGetDataAt("application/x-moz-node", 0); + if (types[0] == "application/x-moz-tabbrowser-tab") { + var sourceNode = dt.mozGetDataAt("application/x-moz-tabbrowser-tab", 0); if (sourceNode instanceof XULElement && sourceNode.localName == "tab" && (sourceNode.parentNode == this.mTabContainer || @@ -1829,13 +1856,23 @@ (aEvent.screenX >= sourceNode.boxObject.screenX && aEvent.screenX <= (sourceNode.boxObject.screenX + sourceNode.boxObject.width))) { - return dt.effectAllowed = "none"; + return dt.effectAllowed = "none"; } + // Within the toolbox, allow dropping by the height of a tab off + // the tabbar + if (isInToolbox && + aEvent.screenY < sourceNode.boxObject.screenY - + sourceNode.boxObject.height) + return dt.effectAllowed = "none"; return dt.effectAllowed = "copyMove"; } } + // only tab-drags are taken care off within the toolbox + if (!isInToolbox) + return dt.effectAllowed = "none"; + for (var i=0; i < this._supportedLinkDropTypes.length; i++) { if (types.contains(this._supportedLinkDropTypes[i])) { // Here we need to to do this manually @@ -1956,12 +1993,15 @@ var dropEffect = dt.dropEffect; var draggedTab; if (dropEffect != "link") { // copy or move - draggedTab = dt.mozGetDataAt("application/x-moz-node", 0); + draggedTab = dt.mozGetDataAt("application/x-moz-tabbrowser-tab", 0); NS_ASSERT(draggedTab && draggedTab.localName == "tab", "copy or move action without a tab"); } - if (draggedTab && (dropEffect == "copy" || draggedTab.parentNode == this.mTabContainer)) { + this.mTabDropIndicatorBar.collapsed = true; + + if (draggedTab && (dropEffect == "copy" || + draggedTab.parentNode == this.mTabContainer)) { var newIndex = this.getNewIndex(aEvent); if (dropEffect == "copy") { // copy the dropped tab (wherever it's from) @@ -1998,7 +2038,6 @@ // swapBrowsersAndCloseOther, so that the updateCurrentBrowser // it triggers will correctly update our URL bar. this.selectedTab = newTab; - this.setTabTitle(newTab); } else { var url; @@ -2060,20 +2099,51 @@ + + + + + + + + + + + + + + diff --git a/browser/components/places/content/toolbar.xml b/browser/components/places/content/toolbar.xml index 752cc46f98e0..879c85cd9e80 100755 --- a/browser/components/places/content/toolbar.xml +++ b/browser/components/places/content/toolbar.xml @@ -1032,6 +1032,7 @@ var ip = this.insertionPoint; if (!ip || !PlacesControllerDragHelper.canDrop(ip)) { ib.removeAttribute("dragging"); + PlacesControllerDragHelper.currentDataTransfer = null; return; } @@ -1103,8 +1104,10 @@ ]]> Date: Sat, 15 Nov 2008 18:19:10 -0500 Subject: [PATCH 16/16] Bug 463772, Make choice of skipping prompt for getTargetFile obvious (comment changes) Also include minor context-menu fix. r=sdwilsh, a1.9.1b2=beltzner --- browser/base/content/browser-context.inc | 2 +- toolkit/content/contentAreaUtils.js | 41 +++++++++++++++--------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/browser/base/content/browser-context.inc b/browser/base/content/browser-context.inc index 8625500faaa2..ddd1f60ec434 100644 --- a/browser/base/content/browser-context.inc +++ b/browser/base/content/browser-context.inc @@ -265,7 +265,7 @@ + oncommand="gContextMenu.saveFrame();"/>