Merge m-c to tracemonkey.

This commit is contained in:
Robert Sayre 2008-11-16 02:44:21 -05:00
commit c11b0ef40f
36 changed files with 733 additions and 112 deletions

View File

@ -265,7 +265,7 @@
<menuitem id="context-saveframe"
label="&saveFrameCmd.label;"
accesskey="&saveFrameCmd.accesskey;"
oncommand="saveDocument(gContextMenu.target.ownerDocument);"/>
oncommand="gContextMenu.saveFrame();"/>
<menuseparator/>
<menuitem id="context-printframe"
label="&printFrameCmd.label;"

View File

@ -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);

View File

@ -271,6 +271,9 @@
</tooltip>
<toolbox id="navigator-toolbox" class="toolbox-top" mode="icons"
ondragover="gBrowser._onDragOver(event); event.stopPropagation();"
ondrop="gBrowser._onDrop(event); event.stopPropagation();"
ondragleave="gBrowser._onDragLeave(event); event.stopPropagation();"
defaultmode="icons">
<!-- Menu -->
<toolbar type="menubar" id="toolbar-menubar" class="chromeclass-menubar" customizable="true"

View File

@ -50,6 +50,8 @@
%tabBrowserDTD;
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
<!ENTITY % placesDTD SYSTEM "chrome://browser/locale/places/places.dtd">
%placesDTD;
]>
<bindings id="tabBrowserBindings"
@ -66,7 +68,10 @@
<xul:stringbundle anonid="tbstringbundle" src="chrome://browser/locale/tabbrowser.properties"/>
<xul:tabbox anonid="tabbox" flex="1" eventnode="document" xbl:inherits="handleCtrlPageUpDown"
onselect="if (!('updateCurrentBrowser' in this.parentNode) || event.target.localName != 'tabpanels') return; this.parentNode.updateCurrentBrowser();">
<xul:hbox class="tab-drop-indicator-bar" collapsed="true" chromedir="&locale.dir;">
<xul:hbox class="tab-drop-indicator-bar" collapsed="true" chromedir="&locale.dir;"
ondragover="this.parentNode.parentNode._onDragOver(event); event.stopPropagation();"
ondragleave="this.parentNode.parentNode._onDragLeave(event); event.stopPropagation();"
ondrop="this.parentNode.parentNode._onDrop(event); event.stopPropagation();">
<xul:hbox class="tab-drop-indicator" mousethrough="always"/>
</xul:hbox>
<xul:hbox class="tabbrowser-strip" collapsed="true" tooltip="_child" context="_child"
@ -74,6 +79,7 @@
ondragstart="this.parentNode.parentNode._onDragStart(event); event.stopPropagation();"
ondragover="this.parentNode.parentNode._onDragOver(event); event.stopPropagation();"
ondrop="this.parentNode.parentNode._onDrop(event); event.stopPropagation();"
ondragend="this.parentNode.parentNode._onDragEnd(event); event.stopPropagation();"
ondragleave="this.parentNode.parentNode._onDragLeave(event); event.stopPropagation();">
<xul:tooltip onpopupshowing="return this.parentNode.parentNode.parentNode.createTooltip(event);"/>
<xul:menupopup anonid="tabContextMenu" onpopupshowing="this.parentNode.parentNode.parentNode.updatePopupMenu(this);">
@ -92,6 +98,11 @@
oncommand="var tabbrowser = this.parentNode.parentNode.parentNode.parentNode;
tabbrowser.removeAllTabsBut(tabbrowser.mContextTab);"/>
<xul:menuseparator/>
<xul:menuitem id="context_openTabInWindow" label="&cmd.open_window.label;"
tbattr="tabbrowser-multiple"
oncommand="var tabbrowser = this.parentNode.parentNode.parentNode.parentNode;
tabbrowser._replaceTabWithWindow(tabbrowser.mContextTab);"/>
<xul:menuseparator/>
<xul:menuitem id="context_bookmarkTab"
label="&bookmarkThisTab.label;"
accesskey="&bookmarkThisTab.accesskey;"
@ -693,10 +704,11 @@
</method>
<method name="updateCurrentBrowser">
<parameter name="aForceUpdate"/>
<body>
<![CDATA[
var newBrowser = this.getBrowserAtIndex(this.mTabContainer.selectedIndex);
if (this.mCurrentBrowser == newBrowser)
if (this.mCurrentBrowser == newBrowser && !aForceUpdate)
return;
if (this.mCurrentBrowser) {
@ -1609,6 +1621,13 @@
ourBrowser.webProgress.addProgressListener(filter,
Components.interfaces.nsIWebProgress.NOTIFY_ALL);
this.setTabTitle(aOurTab);
// If the tab was already selected (this happpens in the scenraio of
// _replaceTabWithWindow), notify onLoactionChange, etc.
if (aOurTab == this.selectedTab)
this.updateCurrentBrowser(true);
]]>
</body>
</method>
@ -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", '<a href="' + spec + '">' + aEvent.target.label + '</a>', 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);
}
]]>
</body>
@ -1806,10 +1820,23 @@
["text/x-moz-url", "text/uri-list", "text/plain", "application/x-moz-file"]
]]></field>
<field name="_cachedTargetInToolbox">null</field>
<method name="_setEffectAllowedForDataTransfer">
<parameter name="aEvent"/>
<body>
<![CDATA[
// Find out if the we're dragged over the toolbox
var target = aEvent.target;
var isInToolbox = target == this._cachedTargetInToolbox;
while (target && !isInToolbox) {
if (target == gNavToolbox) {
isInToolbox = true;
this._cachedTargetInToolbox = target;
}
else
target = target.parentNode;
}
var dt = aEvent.dataTransfer;
// Disallow dropping multiple items
if (dt.mozItemCount > 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 @@
</body>
</method>
<method name="_onDragEnd">
<parameter name="aEvent"/>
<body>
<![CDATA[
if (this.mTabs.length == 1)
return;
var dt = aEvent.dataTransfer;
if (dt.dropEffect == "none") {
var draggedTab = dt.mozGetDataAt("application/x-moz-tabbrowser-tab", 0);
this._replaceTabWithWindow(draggedTab);
}
]]>
</body>
</method>
<method name="_replaceTabWithWindow">
<parameter name="aTab"/>
<body>
<![CDATA[
// tell a new window to take the "dropped" tab
var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
getService(Ci.nsIWindowWatcher);
ww.openWindow(window,
getBrowserURL(),
null,
"chrome,dialog=no,all",
aTab);
]]>
</body>
</method>
<method name="_onDragLeave">
<parameter name="aEvent"/>
<body>
<![CDATA[
this.mDragTime = 0;
var dropEffect = aEvent.dataTransfer.dropEffect;
if (dropEffect == "move" || dropEffect == "copy") {
var target = aEvent.relatedTarget;
while (target && target != this.mStrip)
target = target.parentNode;
if (target)
return;
}
// This does not work at all (see bug 458613)
var target = aEvent.relatedTarget;
while (target && (target != this && target != gNavToolbox))
target = target.parentNode;
if (target)
return;
this.mTabDropIndicatorBar.collapsed = true;
]]>
</body>

View File

@ -1032,6 +1032,7 @@
var ip = this.insertionPoint;
if (!ip || !PlacesControllerDragHelper.canDrop(ip)) {
ib.removeAttribute("dragging");
PlacesControllerDragHelper.currentDataTransfer = null;
return;
}
@ -1103,8 +1104,10 @@
]]></handler>
<handler event="drop"><![CDATA[
// Cache the dataTransfer
PlacesControllerDragHelper.currentDataTransfer = event.dataTransfer;
// If the data-transfer isn't cached, it's not ours
// This happens when dropping tabs
if (event.dataTransfer != PlacesControllerDragHelper.currentDataTransfer)
return;
var dropPoint = this._getDropPoint(event);
if (!dropPoint)

View File

@ -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 + "|");
}
}
}

View File

@ -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)

View File

@ -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 <zeniko@gmail.com>.
* 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);
}

View File

@ -0,0 +1,10 @@
<!-- Testcase originally by <moz_bug_r_a4@yahoo.com> -->
<!DOCTYPE html>
<title>Test for bug 463206</title>
<iframe src="data:text/html,<iframe></iframe><iframe%20src='data:text/html,<input%2520id=%2522in1%2522>'></iframe>"></iframe>
<iframe src="data:text/html,<input%20id='out1'><input%20id='out2'><iframe%20src='data:text/html,<input%2520id=%2522in1%2522>'>"></iframe>
<input id="out1">
<input name="1|#out2">

View File

@ -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-%

View File

@ -18,6 +18,9 @@
<body>
<p>ABC</p>
<p>A</p>
<p>B</p>
<p>C</p>
</body>
</html>

View File

@ -16,11 +16,19 @@
src: url(../fonts/markB.ttf);
}
@font-face {
font-family: "MarkD";
src: url(../fonts/markD.ttf);
}
</style>
</head>
<body>
<p><span style="font-family: MarkA">A</span><span style="font-family: MarkB">B</span>C</p>
<p style="font-family: MarkD">DDC</p>
<p style="font-family: MarkA">A</p>
<p style="font-family: MarkB">B</p>
<p style="font-family: MarkA">C</p>
</body>
</html>

View File

@ -23,6 +23,9 @@
<body>
<p>ABC</p>
<p>A</p>
<p>B</p>
<p>C</p>
</body>
</html>

View File

@ -11,16 +11,13 @@
src: url(../fonts/markA.ttf);
}
@font-face {
font-family: "Mark2B";
src: url(../fonts/mark2B.ttf);
}
body { font-family: "MarkA"; }
</style>
</head>
<body>
<p><span style="font-family: MarkA">A</span><span style="font-family: Mark2B">B</span>C</p>
<p>ABC</p>
</body>
</html>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
@font-face {
font-family: "MarkXMark2Y";
src: url(../fonts/markXmark2Y.ttf);
}
body { font-family: "MarkXMark2Y"; }
</style>
</head>
<body>
<p>XYC</p>
</body>
</html>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
@font-face {
font-family: "MarkXMark2Y";
src: url(../fonts/markXmark2Y.ttf);
}
body { font-family: "MarkXMark2Y"; }
</style>
</head>
<body>
<p>XYC</p>
</body>
</html>

View File

@ -11,17 +11,19 @@ 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") 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
# 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
fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") random-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) == multiple-in-family-1.html multiple-in-family-1-ref.html
HTTP(..) == order-1.html order-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") 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

View File

@ -7,17 +7,17 @@
<style type="text/css">
@font-face {
font-family: "MarkA";
src: url(../fonts/markA.ttf);
font-family: "MarkD";
src: url(../fonts/markD.ttf);
}
body { font-family: "MarkA"; }
body { font-family: "MarkD"; }
</style>
</head>
<body>
<p>ABC</p>
<p>DBC</p>
</body>
</html>

View File

@ -7,20 +7,17 @@
<style type="text/css">
@font-face {
font-family: "MarkA";
src: url(../fonts/markA.ttf);
font-family: "MarkD";
src: url(../fonts/markD.ttf);
}
@font-face {
font-family: "Mark2B";
src: url(../fonts/mark2B.ttf);
}
body { font-family: MarkD; }
</style>
</head>
<body>
<p><span style="font-family: MarkA">A</span><span style="font-family: Mark2B">B</span>C</p>
<p>DBC</p>
</body>
</html>

View File

@ -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"; }

View File

@ -0,0 +1,23 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
@font-face {
font-family: "Mark2D";
src: url(../fonts/mark2D.ttf);
}
body { font-family: "Mark2D"; }
</style>
</head>
<body>
<p>DBC</p>
</body>
</html>

View File

@ -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"; }

View File

@ -0,0 +1,23 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
@font-face {
font-family: "Mark2D";
src: url(../fonts/mark2D.ttf);
}
body { font-family: "Mark2D"; }
</style>
</head>
<body>
<p>DBC</p>
</body>
</html>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
@font-face {
font-family: "One";
src: url(../fonts/markA.ttf) format("unknown"), url(../fonts/mark2A.ttf) format("truetype");
}
body { font-family: "One"; }
</style>
</head>
<body>
<p>ABC</p>
</body>
</html>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
@font-face {
font-family: "MarkD";
src: url(../fonts/markD.ttf);
}
body { font-family: MarkD; }
</style>
</head>
<body>
<p>DBC</p>
</body>
</html>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
@font-face {
font-family: "One";
src: url(../fonts/markA.ttf) format("unknown", "truetype"), url(../fonts/mark2A.ttf) format("truetype");
}
body { font-family: "One"; }
</style>
</head>
<body>
<p>ABC</p>
</body>
</html>

View File

@ -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")

Binary file not shown.

View File

@ -98,6 +98,9 @@ nsSVGGeometryFrame::GetStrokeWidth()
nsresult
nsSVGGeometryFrame::GetStrokeDashArray(gfxFloat **aDashes, PRUint32 *aCount)
{
nsSVGElement *ctx = static_cast<nsSVGElement*>
(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<nsSVGElement*>(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<nsSVGElement*>
(GetType() == nsGkAtoms::svgGlyphFrame ?
mContent->GetParent() : mContent);
return
nsSVGUtils::CoordToFloat(PresContext(),
static_cast<nsSVGElement*>(mContent),
ctx,
GetStyleSVG()->mStrokeDashoffset);
}

View File

@ -293,7 +293,7 @@ function show_differences(cb) {
<label><input type="radio" name="which" value="1" onchange="show_image(2)" />Image 2</label>
<label><input type="checkbox" onchange="show_differences(this)" />Circle differences</label>
</form>
<svg style="position: absolute; left: 300px; top: 50px;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="800px" height="1000px" viewbox="0 0 800 1000" id="svg">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="800px" height="1000px" viewbox="0 0 800 1000" id="svg">
<defs>
<filter id="showDifferences" x="0%" y="0%" width="100%" height="100%">
<feImage id="feimage1" result="img1" xlink:href="#image1" />

View File

@ -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();

View File

@ -227,22 +227,31 @@ const kSaveAsType_Text = 2; // Save document, converting to plain text.
* - Creates a 'Persist' object (which will perform the saving in the
* background) and then starts it.
*
* @param aURL The String representation of the URL of the document being saved
* @param aDocument The document to be saved
* @param aDefaultFileName The caller-provided suggested filename if we don't
* @param aURL
* The String representation of the URL of the document being saved
* @param aDocument
* The document to be saved
* @param aDefaultFileName
* The caller-provided suggested filename if we don't
* find a better one
* @param aContentDisposition The caller-provided content-disposition header
* to use.
* @param aContentType The caller-provided content-type to use
* @param aShouldBypassCache If true, the document will always be refetched
* from the server
* @param aFilePickerTitleKey Alternate title for the file picker
* @param aChosenData If non-null this contains an instance of object AutoChosen
* (see below) which holds pre-determined data so that the user does not
* need to be prompted for a target filename.
* @param aReferrer the referrer URI object (not URL string) to use, or null
if no referrer should be sent.
* @param aSkipPrompt If true, the file will be saved to the default download folder.
* @param aContentDisposition
* The caller-provided content-disposition header to use.
* @param aContentType
* The caller-provided content-type to use
* @param aShouldBypassCache
* If true, the document will always be refetched from the server
* @param aFilePickerTitleKey
* Alternate title for the file picker
* @param aChosenData
* If non-null this contains an instance of object AutoChosen (see below)
* which holds pre-determined data so that the user does not need to be
* prompted for a target filename.
* @param aReferrer
* the referrer URI object (not URL string) to use, or null
* if no referrer should be sent.
* @param aSkipPrompt [optional]
* If set to true, we will attempt to save the file to the
* default downloads folder without prompting.
*/
function internalSave(aURL, aDocument, aDefaultFileName, aContentDisposition,
aContentType, aShouldBypassCache, aFilePickerTitleKey,
@ -448,7 +457,7 @@ function initFileInfo(aFI, aURL, aURLCharset, aDocument,
}
}
function getTargetFile(aFpP, aSkipPrompt)
function getTargetFile(aFpP, /* optional */ aSkipPrompt)
{
const prefSvcContractID = "@mozilla.org/preferences-service;1";
const prefSvcIID = Components.interfaces.nsIPrefService;

View File

@ -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

View File

@ -62,6 +62,32 @@
#include "nsXPCOMStrings.h"
#include "nscore.h"
#include "prtypes.h"
#include "nsDirectoryServiceDefs.h"
// XXX Duped from profile/src/nsProfile.cpp.
#include <stdlib.h>
#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;i<bufLen;i++) {
*buf++ = table[rand()%TABLE_SIZE];
}
*buf = 0;
}
// XXX
// XXX for older version of PSDK where IAsyncOperation and related stuff is not available
// but this should be removed when parocles config is updated
@ -447,7 +473,7 @@ BOOL nsDataObj::FormatsMatch(const FORMATETC& source, const FORMATETC& target) c
STDMETHODIMP nsDataObj::GetData(LPFORMATETC pFE, LPSTGMEDIUM pSTM)
{
PRNTDEBUG("nsDataObj::GetData\n");
PRNTDEBUG3(" format: %d Text: %d\n", pFE->cfFormat, 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<nsCString*>(mDataFlavors.SafeElementAt(dfInx));
dfInx++;
if (df && df->EqualsLiteral(kNativeImageMime)) {
found = PR_TRUE;
break;
}
}
if (!found)
return E_FAIL;
nsresult rv;
PRUint32 len = 0;
nsCOMPtr<nsISupports> genericDataWrapper;
mTransferable->GetTransferData(kNativeImageMime, getter_AddRefs(genericDataWrapper), &len);
nsCOMPtr<nsIImage> 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<nsISupportsInterfacePointer> 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<nsIFile> 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<nsIOutputStream> 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);
}
//-----------------------------------------------------

View File

@ -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<nsILocalFile> mCachedTempFile;
nsCOMPtr<nsIFile> mCachedTempFile;
BOOL mIsAsyncMode;
BOOL mIsInOperation;

View File

@ -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