Merge from cvs-trunk-mirror to mozilla-central. No conflict resolution necessary.

--HG--
rename : js/src/jsinterp.c => js/src/jsinterp.cpp
rename : js/src/jsopcode.c => js/src/jsopcode.cpp
This commit is contained in:
Benjamin Smedberg 2008-05-01 09:50:06 -04:00
Родитель c16ad95d1f 8ba096b728
Коммит 190945f4df
57 изменённых файлов: 655 добавлений и 67 удалений

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

@ -943,8 +943,10 @@ PlacesTreeView.prototype = {
// treat non-expandable queries as non-containers
if (PlacesUtils.nodeIsQuery(node)) {
asQuery(node);
return node.queryOptions.expandQueries;
var parent = node.parent;
if(PlacesUtils.nodeIsQuery(parent) ||
PlacesUtils.nodeIsFolder(parent))
return asQuery(parent).queryOptions.expandQueries;
}
return true;
}

Двоичный файл не отображается.

До

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

После

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

Двоичный файл не отображается.

До

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

После

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

Двоичные данные
browser/themes/winstripe/browser/Toolbar.png

Двоичный файл не отображается.

До

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

После

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

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

@ -25,7 +25,6 @@ classic.jar:
skin/classic/browser/Go-arrow.png (Go-arrow.png)
skin/classic/browser/Go-arrow-rtl.png (Go-arrow-rtl.png)
* skin/classic/browser/searchbar.css (searchbar.css)
skin/classic/browser/Search-close.png (Search-close.png)
skin/classic/browser/Search-glass.png (Search-glass.png)
skin/classic/browser/Search-glass-rtl.png (Search-glass-rtl.png)
skin/classic/browser/Search-addengines.png
@ -112,7 +111,6 @@ classic.jar:
skin/classic/aero/browser/Go-arrow.png (Go-arrow-aero.png)
skin/classic/aero/browser/Go-arrow-rtl.png (Go-arrow-rtl-aero.png)
* skin/classic/aero/browser/searchbar.css (searchbar.css)
skin/classic/aero/browser/Search-close.png (Search-close-aero.png)
skin/classic/aero/browser/Search-glass.png (Search-glass-aero.png)
skin/classic/aero/browser/Search-glass-rtl.png (Search-glass-rtl-aero.png)
skin/classic/aero/browser/Search-addengines.png

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

@ -1075,11 +1075,8 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
nsCAutoString overrideType;
if ((caps & eOverrideServerType) &&
(!aTypeHint.IsEmpty() ||
((!aTypeHint.IsEmpty() && IsSupportedPlugin(aTypeHint)) ||
(aURI && IsPluginEnabledByExtension(aURI, overrideType)))) {
NS_ASSERTION(aTypeHint.IsEmpty() ^ overrideType.IsEmpty(),
"Exactly one of aTypeHint and overrideType should be empty!");
ObjectType newType;
if (overrideType.IsEmpty()) {
newType = GetTypeOfContent(aTypeHint);

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

@ -113,6 +113,7 @@ _TEST_FILES = test_bug589.html \
test_bug406596.html \
test_bug421640.html \
test_bug430351.html \
test_bug430392.html \
$(NULL)
libs:: $(_TEST_FILES)

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

@ -0,0 +1,53 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=430392
-->
<head>
<title>Test for Bug 430392</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=430392">Mozilla Bug 430392</a>
<p id="display"></p>
<div id="content">
<div contenteditable="true" id="edit">
<span contenteditable="false">A</span> ;
<span contenteditable="false">B</span> ;
<span contenteditable="false">C</span>
</div>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 430392 **/
function test() {
var edit = document.getElementById("edit");
var html = edit.innerHTML;
document.getElementById("edit").focus();
synthesizeKey("VK_RIGHT", {});
synthesizeKey("VK_RIGHT", {});
synthesizeKey("VK_RETURN", {});
synthesizeKey("VK_RETURN", {});
synthesizeKey("VK_BACK_SPACE", {});
synthesizeKey("VK_BACK_SPACE", {});
is(edit.innerHTML, html,
"adding and then deleting returns should not change text");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(test);
addLoadEvent(SimpleTest.finish);
</script>
</pre>
</body>
</html>

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

@ -128,19 +128,6 @@
{
var err = getErrorCode();
if (err == "nssBadCert") {
// Remove the "Try again" button for security exceptions, since it's
// almost certainly useless.
document.getElementById("errorTryAgain").style.display = "none";
document.getElementById("errorPageContainer").setAttribute("class", "certerror");
}
else {
// Remove the override block for non-certificate errors. CSS-hiding
// isn't good enough here, because of bug 39098
var secOverride = document.getElementById("securityOverrideDiv");
secOverride.parentNode.removeChild(secOverride);
}
// if it's an unknown error or there's no title or description
// defined, get the generic message
var errTitle = document.getElementById("et_" + err);
@ -190,6 +177,20 @@
favicon.setAttribute("href", "chrome://global/skin/icons/" + className + "_favicon.png");
faviconParent.appendChild(favicon);
}
if (err == "nssBadCert") {
// Remove the "Try again" button for security exceptions, since it's
// almost certainly useless.
document.getElementById("errorTryAgain").style.display = "none";
document.getElementById("errorPageContainer").setAttribute("class", "certerror");
addDomainErrorLink();
}
else {
// Remove the override block for non-certificate errors. CSS-hiding
// isn't good enough here, because of bug 39098
var secOverride = document.getElementById("securityOverrideDiv");
secOverride.parentNode.removeChild(secOverride);
}
}
function showSecuritySection() {
@ -197,6 +198,56 @@
document.getElementById('securityOverrideContent').style.display = '';
document.getElementById('securityOverrideLink').style.display = 'none';
}
/* In the case of SSL error pages about domain mismatch, see if
we can hyperlink the user to the correct site. We don't want
to do this generically since it allows MitM attacks to redirect
users to a site under attacker control, but in certain cases
it is safe (and helpful!) to do so. Bug 402210
*/
function addDomainErrorLink() {
// Rather than textContent, we need to treat description as HTML
var sd = document.getElementById("errorShortDescText");
if (sd)
sd.innerHTML = getDescription();
var link = document.getElementById('cert_domain_link');
if (!link)
return;
var okHost = link.getAttribute("title");
var thisHost = document.location.hostname;
var proto = document.location.protocol;
/* case #1:
* example.com uses an invalid security certificate.
*
* The certificate is only valid for www.example.com
*
* Make sure to include the "." ahead of thisHost so that
* a MitM attack on paypal.com doesn't hyperlink to "notpaypal.com"
*
* We'd normally just use a RegExp here except that we lack a
* library function to escape them properly (bug 248062), and
* domain names are famous for having '.' characters in them,
* which would allow spurious and possibly hostile matches.
*/
if (endsWith(okHost, "." + thisHost))
link.href = proto + okHost;
/* case #2:
* browser.garage.maemo.org uses an invalid security certificate.
*
* The certificate is only valid for garage.maemo.org
*/
if (endsWith(thisHost, "." + okHost))
link.href = proto + okHost;
}
function endsWith(haystack, needle) {
return haystack.slice(-needle.length) == needle;
}
]]></script>
</head>

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

@ -66,6 +66,7 @@ _TEST_FILES = \
test_bug413310.html \
bug413310-subframe.html \
bug413310-post.sjs \
test_bug402210.html \
$(NULL)
libs:: $(_TEST_FILES)

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

@ -50,6 +50,7 @@ _TEST_FILES = \
test_bug278916.html \
test_bug279495.html \
test_bug386782.html \
test_bug430723.html \
test_child.html \
test_grandchild.html \
test_sibling-off-domain.html \

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

@ -0,0 +1,114 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=430723
-->
<head>
<title>Test for Bug 430723</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=430723">Mozilla Bug 430723</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
//<![CDATA[
/** Test for Bug 430723 **/
var gTallRedBoxURI = "data:text/html;charset=utf-8;base64,PGh0bWw%2BPGhlYWQ%2BPHNjcmlwdD53aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigncGFnZXNob3cnLCBmdW5jdGlvbigpe29wZW5lci5uZXh0VGVzdCgpO30sIGZhbHNlKTs8L3NjcmlwdD48L2hlYWQ%2BPGJvZHk%2BPGRpdiBzdHlsZT0icG9zaXRpb246YWJzb2x1dGU7IGxlZnQ6MHB4OyB0b3A6MHB4OyB3aWR0aDo1MCU7IGhlaWdodDoxNTAlOyBiYWNrZ3JvdW5kLWNvbG9yOnJlZCI%2BPHA%2BVGhpcyBpcyBhIHZlcnkgdGFsbCByZWQgYm94LjwvcD48L2Rpdj48L2JvZHk%2BPC9odG1sPg%3D%3D";
// <html><head>
// < script > window.addEventListener("pageshow", function(){opener.nextTest();}, false); < /script >
// </head><body>
// <div style="position:absolute; left:0px; top:0px; width:50%; height:150%; background-color:red">
// <p>This is a very tall red box.</p>
// </div></body></html>
var gTallBlueBoxURI = "data:text/html;charset=utf-8;base64,PGh0bWw%2BPGhlYWQ%2BPHNjcmlwdD53aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigncGFnZXNob3cnLCBmdW5jdGlvbigpe29wZW5lci5uZXh0VGVzdCgpO30sIGZhbHNlKTs8L3NjcmlwdD48L2hlYWQ%2BPGJvZHk%2BPGRpdiBzdHlsZT0icG9zaXRpb246YWJzb2x1dGU7IGxlZnQ6MHB4OyB0b3A6MHB4OyB3aWR0aDo1MCU7IGhlaWdodDoxNTAlOyBiYWNrZ3JvdW5kLWNvbG9yOmJsdWUiPjxwPlRoaXMgaXMgYSB2ZXJ5IHRhbGwgYmx1ZSBib3guPC9wPjwvZGl2PjwvYm9keT48L2h0bWw%2B";
// <html><head>
// < script > window.addEventListener("pageshow", function(){opener.nextTest();}, false); < /script >
// </head><body>
// <div style="position:absolute; left:0px; top:0px; width:50%; height:150%; background-color:blue">
// <p>This is a very tall blue box.</p>
// </div></body></html>
window.onload = runTest;
var testWindow;
var testNum = 0;
function runTest() {
testWindow = window.open(gTallRedBoxURI, "testWindow", "width=300,height=300,location=yes,scrollbars=yes");
}
var nextTest =function() {
testNum++;
switch (testNum) {
case 1: setTimeout(step1, 0); break;
case 2: setTimeout(step2, 0); break;
case 3: setTimeout(step3, 0); break;
};
}
var step1 =function() {
window.is(testWindow.location, gTallRedBoxURI, "Ensure red page loaded.");
// Navigate down and up.
is(testWindow.document.body.scrollTop, 0,
"Page1: Ensure we scrollpane is at the top before we start scrolling.");
sendKey('DOWN', testWindow);
sendKey('UP', testWindow);
is(testWindow.document.body.scrollTop, 0,
"Page1: Ensure we can scroll down and up, back to the top.");
// Nav to blue box page. This should fire step2.
testWindow.location = gTallBlueBoxURI;
}
var step2 =function() {
window.is(testWindow.location, gTallBlueBoxURI, "Ensure blue page loaded.");
// Scroll around a bit.
is(testWindow.document.body.scrollTop, 0,
"Page2: Ensure we scrollpane is at the top before we start scrolling.");
sendKey('DOWN', testWindow);
sendKey('DOWN', testWindow);
sendKey('DOWN', testWindow);
isnot(testWindow.document.body.scrollTop, 0,
"Page2: Ensure we could scrol.");
// Navigate backwards. This should fire step3.
testWindow.history.back();
}
var step3 =function() {
window.is(testWindow.location, gTallRedBoxURI,
"Ensure red page restored from history.");
// Check we can still scroll with the keys.
is(testWindow.document.body.scrollTop, 0,
"Page1Again: Ensure scroll pane at top before we scroll.");
sendKey('DOWN', testWindow);
isnot(testWindow.document.body.scrollTop, 0,
"Page2Again: Ensure we can still scroll.");
testWindow.close();
window.SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
//]]>
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,51 @@
<!DOCTYPE HTML>
<html>
<!--
While working on bug 402210, it came up that the code was doing
a.href = proto + host
which technically produces "https:host" instead of "https://host" and
that the code was relying on href's setting having fixup behaviour
for this kind of thing.
If we rely on it, we might as well test for it, even if it isn't the
problem 402210 was meant to fix.
https://bugzilla.mozilla.org/show_bug.cgi?id=402210
-->
<head>
<title>Test for Bug 402210</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=402210">Mozilla Bug 402210</a>
<p id="display">
<a id="testlink">Test Link</a>
</p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
function runTest() {
$("testlink").href = "https:example.com";
is($("testlink").href, "https://example.com/", "Setting href on an anchor tag should fixup missing slashes after https protocol");
$("testlink").href = "ftp:example.com";
is($("testlink").href, "ftp://example.com/", "Setting href on an anchor tag should fixup missing slashes after non-http protocol");
SimpleTest.finish();
}
addLoadEvent(runTest);
</script>
</pre>
</body>
</html>

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

@ -1394,6 +1394,9 @@ nsEditingSession::RestoreAnimationMode(nsIDOMWindow *aWindow)
nsresult
nsEditingSession::DetachFromWindow(nsIDOMWindow* aWindow)
{
if (!mDoneSetup)
return NS_OK;
NS_ASSERTION(mEditorFlags != 0, "mEditorFlags should not be 0");
NS_ASSERTION(mStateMaintainer, "mStateMaintainer should exist.");
@ -1421,6 +1424,9 @@ nsEditingSession::DetachFromWindow(nsIDOMWindow* aWindow)
nsresult
nsEditingSession::ReattachToWindow(nsIDOMWindow* aWindow)
{
if (!mDoneSetup)
return NS_OK;
NS_ASSERTION(mEditorFlags != 0, "mEditorFlags should still be valid...");
NS_ASSERTION(mStateMaintainer, "mStateMaintainer should exist.");

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

@ -4600,7 +4600,8 @@ nsHTMLEditor::CollapseAdjacentTextNodes(nsIDOMRange *aInRange)
// get the prev sibling of the right node, and see if it's leftTextNode
nsCOMPtr<nsIDOMNode> prevSibOfRightNode;
result = GetPriorHTMLSibling(rightTextNode, address_of(prevSibOfRightNode));
result =
rightTextNode->GetPreviousSibling(getter_AddRefs(prevSibOfRightNode));
if (NS_FAILED(result)) return result;
if (prevSibOfRightNode && (prevSibOfRightNode == leftTextNode))
{

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

@ -114,7 +114,7 @@ nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrin
nsCOMPtr<nsIPrintDialogService> dlgPrint(do_GetService(
NS_PRINTDIALOGSERVICE_CONTRACTID));
if (dlgPrint)
return dlgPrint->Show(printSettings);
return dlgPrint->Show(parent, printSettings);
// Show the built-in dialog instead
ParamBlock block;
@ -189,7 +189,7 @@ nsPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *p
nsCOMPtr<nsIPrintDialogService> dlgPrint(do_GetService(
NS_PRINTDIALOGSERVICE_CONTRACTID));
if (dlgPrint)
return dlgPrint->ShowPageSetup(printSettings);
return dlgPrint->ShowPageSetup(parent, printSettings);
ParamBlock block;
nsresult rv = block.Init();

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

@ -80,14 +80,21 @@ public:
// Ex: Mac OS X 10.4.x ==> 0x104x
PRInt32 OSXVersion();
// lower threshold on font anti-aliasing
PRUint32 GetAntiAliasingThreshold() { return mFontAntiAliasingThreshold; }
private:
void gfxPlatformMac::AppendCJKPrefLangs(eFontPrefLang aPrefLangs[], PRUint32 &aLen,
eFontPrefLang aCharLang, eFontPrefLang aPageLang);
virtual cmsHPROFILE GetPlatformCMSOutputProfile();
// read in the pref value for the lower threshold on font anti-aliasing
static PRUint32 ReadAntiAliasingThreshold();
nsTArray<PRUint32> mCJKPrefLangs;
PRInt32 mOSXVersion;
PRUint32 mFontAntiAliasingThreshold;
};
#endif /* GFX_PLATFORM_MAC_H */

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

@ -140,6 +140,13 @@ gfxAtsuiFont::gfxAtsuiFont(MacOSFontEntry *aFontEntry,
}
cairo_font_options_t *fontOptions = cairo_font_options_create();
// turn off font anti-aliasing based on user pref setting
if (mAdjustedSize <= (float) gfxPlatformMac::GetPlatform()->GetAntiAliasingThreshold()) {
cairo_font_options_set_antialias(fontOptions, CAIRO_ANTIALIAS_NONE);
//printf("font: %s, size: %f, disabling anti-aliasing\n", NS_ConvertUTF16toUTF8(mName).get(), mAdjustedSize);
}
mScaledFont = cairo_scaled_font_create(mFontFace, &sizeMatrix, &ctm, fontOptions);
cairo_font_options_destroy(fontOptions);
NS_ASSERTION(cairo_scaled_font_status(mScaledFont) == CAIRO_STATUS_SUCCESS,

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

@ -65,6 +65,7 @@ gfxPlatformMac::gfxPlatformMac()
glitz_agl_init();
#endif
mOSXVersion = 0;
mFontAntiAliasingThreshold = ReadAntiAliasingThreshold();
}
already_AddRefed<gfxASurface>
@ -336,6 +337,39 @@ gfxPlatformMac::AppendCJKPrefLangs(eFontPrefLang aPrefLangs[], PRUint32 &aLen, e
}
PRUint32
gfxPlatformMac::ReadAntiAliasingThreshold()
{
PRUint32 threshold = 0; // default == no threshold
// first read prefs flag to determine whether to use the setting or not
PRBool useAntiAliasingThreshold = PR_FALSE;
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs) {
PRBool enabled;
nsresult rv =
prefs->GetBoolPref("gfx.use_text_smoothing_setting", &enabled);
if (NS_SUCCEEDED(rv)) {
useAntiAliasingThreshold = enabled;
}
}
// if the pref setting is disabled, return 0 which effectively disables this feature
if (!useAntiAliasingThreshold)
return threshold;
// value set via Appearance pref panel, "Turn off text smoothing for font sizes xxx and smaller"
CFNumberRef prefValue = (CFNumberRef)CFPreferencesCopyAppValue(CFSTR("AppleAntiAliasingThreshold"), kCFPreferencesCurrentApplication);
if (prefValue) {
if (!CFNumberGetValue(prefValue, kCFNumberIntType, &threshold)) {
threshold = 0;
}
CFRelease(prefValue);
}
return threshold;
}
cmsHPROFILE
gfxPlatformMac::GetPlatformCMSOutputProfile()

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

@ -1163,9 +1163,9 @@ have_fun:
rootedArgsFlag = JSFRAME_ROOTED_ARGV;
if (nslots != 0) {
/*
* The extra slots required by the function must be continues with the
* arguments. Thus, when the last arena does not have room to fit
* nslots right after sp and AllocateAfterSP fails, we have to copy
* The extra slots required by the function continue with argument
* slots. Thus, when the last stack pool arena does not have room to
* fit nslots right after sp and AllocateAfterSP fails, we have to copy
* [vp..vp+2+argc) slots and clear rootedArgsFlag to root the copy.
*/
if (!AllocateAfterSP(cx, sp, nslots)) {

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

@ -1844,6 +1844,22 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)
op = JSOP_CALL;
break;
#endif
case JSOP_GETTHISPROP:
/*
* NB: JSOP_GETTHISPROP can't fail due to |this|
* being null or undefined at runtime (beware that
* this may change for ES4). Therefore any error
* resulting from this op must be due to the value
* of the property accessed via |this|, so do not
* rewrite op to JSOP_THIS.
*
* The next three cases should not change op if
* js_DecompileValueGenerator was called from the
* the property getter. They should rewrite only
* if the base object in the arg/var/local is null
* or undefined. FIXME: bug 431569.
*/
break;
case JSOP_GETARGPROP:
op = JSOP_GETARG;
break;
@ -1854,12 +1870,6 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)
op = JSOP_GETLOCAL;
break;
default:
/*
* NB: JSOP_GETTHISPROP can't happen here, as
* there is no way (yet, watch out for proposed
* ES4/JS2 strict mode) for this to be null or
* undefined at runtime.
*/
LOCAL_ASSERT(0);
}
}

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

@ -148,4 +148,9 @@ new TestCase( SECTION,
Math.PI/360,
Math.acos(0.9999619230642));
new TestCase( SECTION,
"Math.acos(-3.0)",
Number.NaN,
Math.acos(-3.0));
test();

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

@ -0,0 +1,93 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** 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 JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2006
* 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 ***** */
var gTestfile = '15.4.5.1-01.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = "(none)";
var summary = '15.4.5.1 - array.length coverage';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
var a = [];
expect = 'RangeError: invalid array length';
actual = '';
try
{
a.length = -1;
}
catch(ex)
{
actual = ex + '';
}
reportCompare(expect, actual, summary);
actual = '';
try
{
a.length = 12345678901234567890;
}
catch(ex)
{
actual = ex + '';
}
reportCompare(expect, actual, summary);
actual = '';
try
{
a.length = 'a';
}
catch(ex)
{
actual = ex + '';
}
reportCompare(expect, actual, summary);
exitFunc ('test');
}

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

@ -549,6 +549,19 @@ nsPageFrame::PaintPageContent(nsIRenderingContext& aRenderingContext,
// Make sure we don't draw where we aren't supposed to draw, especially
// when printing selection
nsRect clipRect(nsPoint(0, 0), pageContentFrame->GetSize());
// Note: this computation matches how we compute maxSize.height
// in nsPageFrame::Reflow
nscoord expectedPageContentHeight =
NSToCoordCeil((GetSize().height - mPD->mReflowMargin.TopBottom()) / scale);
if (clipRect.height > expectedPageContentHeight) {
// We're doing print-selection, with one long page-content frame.
// Clip to the appropriate page-content slice for the current page.
NS_ASSERTION(mPageNum > 0, "page num should be positive");
clipRect.y = expectedPageContentHeight * (mPageNum - 1);
clipRect.height = expectedPageContentHeight;
NS_ASSERTION(clipRect.y < pageContentFrame->GetSize().height,
"Should be clipping to region inside the page content bounds");
}
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
const nsStyleBorder* border = GetStyleBorder();

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

@ -2232,9 +2232,7 @@ nsPrintEngine::DoPrint(nsPrintObject * aPO)
nscoord pageWidth, pageHeight;
mPrt->mPrintDC->GetDeviceSurfaceDimensions(pageWidth, pageHeight);
pageHeight -= totalMargin.top + totalMargin.bottom;
// XXXdholbert does this num-pages calculation need to take
// aPO->mZoomRatio into consideration?
PRInt32 totalPages = NSToIntCeil(float(selectionHgt) / float(pageHeight));
PRInt32 totalPages = NSToIntCeil(float(selectionHgt) * aPO->mZoomRatio / float(pageHeight));
pageSequence->SetTotalNumPages(totalPages);
}
}

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

@ -51,7 +51,7 @@ const NS_SCRIPTSECURITYMANAGER_CONTRACTID =
const NS_REFTESTHELPER_CONTRACTID =
"@mozilla.org/reftest-helper;1";
const LOAD_FAILURE_TIMEOUT = 150000; // ms
const LOAD_FAILURE_TIMEOUT = 10000; // ms
var gBrowser;
var gCanvas1, gCanvas2;

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

@ -172,6 +172,9 @@ pref("accessibility.typeaheadfind.soundURL", "beep");
pref("accessibility.typeaheadfind.enablesound", true);
pref("accessibility.typeaheadfind.prefillwithselection", true);
// use Mac OS X Appearance panel text smoothing setting when rendering text, disabled by default
pref("gfx.use_text_smoothing_setting", false);
pref("browser.history_expire_days", 9);
// loading and rendering of framesets and iframes

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

@ -2035,6 +2035,26 @@ _construct(NPP npp, NPObject* npobj, const NPVariant *args,
return npobj->_class->construct(npobj, args, argCount, result);
}
#ifdef MOZ_MEMORY_WINDOWS
extern "C" size_t malloc_usable_size(const void *ptr);
BOOL
InHeap(HANDLE hHeap, LPVOID lpMem)
{
BOOL success = FALSE;
PROCESS_HEAP_ENTRY he;
he.lpData = NULL;
while (HeapWalk(hHeap, &he) != 0) {
if (he.lpData == lpMem) {
success = TRUE;
break;
}
}
HeapUnlock(hHeap);
return success;
}
#endif
void NP_CALLBACK
_releasevariantvalue(NPVariant* variant)
{
@ -2052,9 +2072,28 @@ _releasevariantvalue(NPVariant* variant)
{
const NPString *s = &NPVARIANT_TO_STRING(*variant);
if (s->utf8characters)
if (s->utf8characters) {
#ifdef MOZ_MEMORY_WINDOWS
if (malloc_usable_size((void *)s->utf8characters) != 0) {
PR_Free((void *)s->utf8characters);
} else {
void *p = (void *)s->utf8characters;
DWORD nheaps = 0;
nsAutoTArray<HANDLE, 50> heaps;
nheaps = GetProcessHeaps(0, heaps.Elements());
heaps.AppendElements(nheaps);
GetProcessHeaps(nheaps, heaps.Elements());
for (DWORD i = 0; i < nheaps; i++) {
if (InHeap(heaps[i], p)) {
HeapFree(heaps[i], 0, p);
break;
}
}
}
#else
PR_Free((void *)s->utf8characters);
#endif
}
break;
}
case NPVariantType_Object:

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

@ -349,7 +349,8 @@ certErrorTrust_ExpiredIssuer=The certificate is not trusted because the issuer c
certErrorTrust_Untrusted=The certificate does not come from a trusted source.
certErrorMismatch=The certificate is not valid for the name %S.
certErrorMismatchSingle2=The certificate is only valid for %S.
# LOCALIZATION NOTE (certErrorMismatchSingle2): Do not translate <a id="cert_domain_link" title="%1$S">%1$S</a>
certErrorMismatchSingle2=The certificate is only valid for <a id="cert_domain_link" title="%1$S">%1$S</a>
certErrorMismatchMultiple=The certificate is only valid for the following names:
certErrorMismatchNoNames=The certificate is not valid for any server names.

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

@ -16,7 +16,8 @@ var Microformats = {
* @param name The name of the microformat (required)
* @param rootElement The DOM element at which to start searching (required)
* @param options Literal object with the following options:
* recurseFrames - Whether or not to search child frames
* recurseExternalFrames - Whether or not to search child frames
* that reference external pages (with a src attribute)
* for microformats (optional - defaults to true)
* showHidden - Whether or not to add hidden microformat
* (optional - defaults to false)
@ -48,8 +49,8 @@ var Microformats = {
var defaultView = rootElement.defaultView || rootElement.ownerDocument.defaultView;
var rootDocument = rootElement.ownerDocument || rootElement;
/* If recurseFrames is undefined or true, look through all child frames for microformats */
if (!options || !options.hasOwnProperty("recurseFrames") || options.recurseFrames) {
/* If recurseExternalFrames is undefined or true, look through all child frames for microformats */
if (!options || !options.hasOwnProperty("recurseExternalFrames") || options.recurseExternalFrames) {
if (defaultView && defaultView.frames.length > 0) {
for (let i=0; i < defaultView.frames.length; i++) {
if (isAncestor(rootDocument, defaultView.frames[i].frameElement)) {
@ -118,7 +119,8 @@ var Microformats = {
* @param name The name of the microformat (required)
* @param rootElement The DOM element at which to start searching (required)
* @param options Literal object with the following options:
* recurseFrames - Whether or not to search child frames
* recurseExternalFrames - Whether or not to search child frames
* that reference external pages (with a src attribute)
* for microformats (optional - defaults to true)
* showHidden - Whether or not to add hidden microformat
* (optional - defaults to false)

Двоичные данные
toolkit/themes/winstripe/global/dirListing/local-aero.png Normal file

Двоичный файл не отображается.

После

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

Двоичный файл не отображается.

До

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

После

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

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

До

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

После

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

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

До

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

После

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

Двоичный файл не отображается.

До

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

После

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

Двоичный файл не отображается.

До

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

После

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

Двоичные данные
toolkit/themes/winstripe/global/icons/closeSidebarWhite-aero.png Normal file

Двоичный файл не отображается.

После

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

Двоичные данные
toolkit/themes/winstripe/global/icons/closeSidebarWhite.png Normal file

Двоичный файл не отображается.

После

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

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

@ -89,6 +89,7 @@ classic.jar:
skin/classic/global/icons/Close.gif (icons/Close.gif)
skin/classic/global/icons/close.png (icons/close.png)
skin/classic/global/icons/closeSidebar.png (icons/closeSidebar.png)
skin/classic/global/icons/closeSidebarWhite.png (icons/closeSidebarWhite.png)
skin/classic/global/icons/collapse.png (icons/collapse.png)
skin/classic/global/icons/Error.png (icons/Error.png)
skin/classic/global/icons/error-16.png (icons/error-16.png)
@ -128,6 +129,7 @@ classic.jar:
skin/classic/global/icons/questionBarIcon-16.png (icons/questionBarIcon-16.png)
skin/classic/global/icons/questionGhosted-64.png (icons/questionGhosted-64.png)
skin/classic/global/icons/Restore.gif (icons/Restore.gif)
skin/classic/global/icons/Search-close.png (icons/Search-close.png)
skin/classic/global/icons/sslWarning.png (icons/sslWarning.png)
skin/classic/global/icons/Warning.png (icons/Warning.png)
skin/classic/global/icons/warning-large.png (icons/warning-large.png)
@ -238,7 +240,7 @@ classic.jar:
skin/classic/aero/global/console/console-error-dash.gif (console/console-error-dash.gif)
* skin/classic/aero/global/dirListing/dirListing.css (dirListing/dirListing.css)
skin/classic/aero/global/dirListing/folder.png (dirListing/folder-aero.png)
skin/classic/aero/global/dirListing/local.png (dirListing/local.png)
skin/classic/aero/global/dirListing/local.png (dirListing/local-aero.png)
skin/classic/aero/global/dirListing/remote.png (dirListing/remote-aero.png)
skin/classic/aero/global/dirListing/up.png (dirListing/up-aero.png)
skin/classic/aero/global/Filepicker.png (filepicker/Filepicker.png)
@ -248,6 +250,7 @@ classic.jar:
skin/classic/aero/global/icons/Close.gif (icons/Close.gif)
skin/classic/aero/global/icons/close.png (icons/close-aero.png)
skin/classic/aero/global/icons/closeSidebar.png (icons/closeSidebar-aero.png)
skin/classic/aero/global/icons/closeSidebarWhite.png (icons/closeSidebarWhite-aero.png)
skin/classic/aero/global/icons/collapse.png (icons/collapse.png)
skin/classic/aero/global/icons/Error.png (icons/Error-aero.png)
skin/classic/aero/global/icons/error-16.png (icons/error-16-aero.png)
@ -287,6 +290,7 @@ classic.jar:
skin/classic/aero/global/icons/questionBarIcon-16.png (icons/questionBarIcon-16-aero.png)
skin/classic/aero/global/icons/questionGhosted-64.png (icons/questionGhosted-64-aero.png)
skin/classic/aero/global/icons/Restore.gif (icons/Restore.gif)
skin/classic/aero/global/icons/Search-close.png (icons/Search-close-aero.png)
skin/classic/aero/global/icons/sslWarning.png (icons/sslWarning-aero.png)
skin/classic/aero/global/icons/Warning.png (icons/Warning-aero.png)
skin/classic/aero/global/icons/warning-large.png (icons/warning-large-aero.png)
@ -314,9 +318,13 @@ classic.jar:
skin/classic/aero/global/tree/sort-asc.gif (tree/sort-asc.gif)
skin/classic/aero/global/tree/sort-dsc.gif (tree/sort-dsc.gif)
skin/classic/aero/global/tree/twisty-clsd.png (tree/twisty-clsd-aero.png)
skin/classic/aero/global/tree/twisty-clsd-rtl.png (tree/twisty-clsd-rtl-aero.png)
skin/classic/aero/global/tree/twisty-clsd-hover.png (tree/twisty-clsd-hover-aero.png)
skin/classic/aero/global/tree/twisty-clsd-hover-rtl.png (tree/twisty-clsd-hover-rtl-aero.png)
skin/classic/aero/global/tree/twisty-open.png (tree/twisty-open-aero.png)
skin/classic/aero/global/tree/twisty-open-rtl.png (tree/twisty-open-rtl-aero.png)
skin/classic/aero/global/tree/twisty-open-hover.png (tree/twisty-open-hover-aero.png)
skin/classic/aero/global/tree/twisty-open-hover-rtl.png (tree/twisty-open-hover-rtl-aero.png)
skin/classic/aero/global/throbber/Throbber-small.gif (throbber/Throbber-small.gif)
skin/classic/aero/global/throbber/Throbber-small.png (throbber/Throbber-small.png)
#endif

Двоичный файл не отображается.

До

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

После

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

Двоичный файл не отображается.

До

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

После

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

Двоичный файл не отображается.

После

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

Двоичные данные
toolkit/themes/winstripe/global/tree/twisty-clsd-rtl-aero.png Normal file

Двоичный файл не отображается.

После

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

Двоичный файл не отображается.

После

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

Двоичные данные
toolkit/themes/winstripe/global/tree/twisty-open-rtl-aero.png Normal file

Двоичный файл не отображается.

После

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

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

@ -29,6 +29,7 @@ classic.jar:
#endif
skin/classic/mozapps/plugins/missingPlugin.css (plugins/missingPlugin.css)
skin/classic/mozapps/plugins/pluginGeneric.png (plugins/pluginGeneric.png)
skin/classic/mozapps/plugins/pluginGeneric-16.png (plugins/pluginGeneric-16.png)
skin/classic/mozapps/plugins/pluginInstallerWizard.css (plugins/pluginInstallerWizard.css)
skin/classic/mozapps/profile/profileicon.png (profile/profileicon.png)
skin/classic/mozapps/profile/profileSelection.css (profile/profileSelection.css)
@ -74,6 +75,7 @@ classic.jar:
#endif
skin/classic/aero/mozapps/plugins/missingPlugin.css (plugins/missingPlugin.css)
skin/classic/aero/mozapps/plugins/pluginGeneric.png (plugins/pluginGeneric-aero.png)
skin/classic/aero/mozapps/plugins/pluginGeneric-16.png (plugins/pluginGeneric-16-aero.png)
skin/classic/aero/mozapps/plugins/pluginInstallerWizard.css (plugins/pluginInstallerWizard.css)
skin/classic/aero/mozapps/profile/profileicon.png (profile/profileicon-aero.png)
skin/classic/aero/mozapps/profile/profileSelection.css (profile/profileSelection.css)

Двоичный файл не отображается.

До

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

После

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

Двоичный файл не отображается.

До

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

После

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

Двоичные данные
toolkit/themes/winstripe/mozapps/plugins/pluginGeneric-16-aero.png Normal file

Двоичный файл не отображается.

После

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

Двоичные данные
toolkit/themes/winstripe/mozapps/plugins/pluginGeneric-16.png Normal file

Двоичный файл не отображается.

После

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

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

@ -40,6 +40,7 @@
#include "nsISupports.h"
class nsIDOMWindow;
class nsIPrintSettings;
/*
@ -67,6 +68,7 @@ public:
/**
* Show the print dialog.
* @param aParent A DOM window the dialog will be parented to.
* @param aSettings On entry, this contains initial settings for the
* print dialog. On return, if the print operation should
* proceed then this contains settings for the print
@ -75,17 +77,19 @@ public:
* @return NS_ERROR_ABORT if the user indicated not to proceed
* @return a suitable error for failures to show the print dialog.
*/
NS_IMETHOD Show(nsIPrintSettings *aSettings) = 0;
NS_IMETHOD Show(nsIDOMWindow *aParent, nsIPrintSettings *aSettings) = 0;
/**
* Show the page setup dialog. Note that there is no way to tell whether the user clicked OK or Cancel on the
* dialog.
* Show the page setup dialog. Note that there is no way to tell whether the
* user clicked OK or Cancel on the dialog.
* @param aParent A DOM window the dialog will be parented to.
* @param aSettings On entry, this contains initial settings for the
* page setup dialog. On return, this contains new default page setup options.
* page setup dialog. On return, this contains new default
* page setup options.
* @return NS_OK if everything is OK.
* @return a suitable error for failures to show the page setup dialog.
*/
NS_IMETHOD ShowPageSetup(nsIPrintSettings *aSettings) = 0;
NS_IMETHOD ShowPageSetup(nsIDOMWindow *aParent, nsIPrintSettings *aSettings) = 0;
};

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

@ -59,6 +59,7 @@ REQUIRES = xpcom \
gfx \
pref \
dom \
docshell \
necko \
uconv \
intl \

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

@ -138,6 +138,8 @@ DECL_FUNC_PTR(gtk_image_new);
DECL_FUNC_PTR(gtk_misc_set_padding);
DECL_FUNC_PTR(gtk_file_chooser_set_local_only);
// XXXdholbert -- this function is duplicated in nsPrintDialogGTK.cpp
// and needs to be unified in some generic utility class.
static GtkWindow *
get_gtk_window_for_nsiwidget(nsIWidget *widget)
{

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

@ -52,11 +52,77 @@
#include "nsNetUtil.h"
#include "nsIStringBundle.h"
#include "nsIPrintSettingsService.h"
#include "nsIDOMWindow.h"
#include "nsPIDOMWindow.h"
#include "nsIBaseWindow.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShell.h"
static const char header_footer_tags[][4] = {"", "&T", "&U", "&D", "&P", "&PT"};
#define CUSTOM_VALUE_INDEX NS_ARRAY_LENGTH(header_footer_tags)
// XXXdholbert Duplicated from widget/src/xpwidgets/nsBaseFilePicker.cpp
// Needs to be unified in some generic utility class.
static nsIWidget *
DOMWindowToWidget(nsIDOMWindow *dw)
{
nsCOMPtr<nsIWidget> widget;
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(dw);
if (window) {
nsCOMPtr<nsIBaseWindow> baseWin(do_QueryInterface(window->GetDocShell()));
while (!widget && baseWin) {
baseWin->GetParentWidget(getter_AddRefs(widget));
if (!widget) {
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(baseWin));
if (!docShellAsItem)
return nsnull;
nsCOMPtr<nsIDocShellTreeItem> parent;
docShellAsItem->GetSameTypeParent(getter_AddRefs(parent));
window = do_GetInterface(parent);
if (!window)
return nsnull;
baseWin = do_QueryInterface(window->GetDocShell());
}
}
}
// This will return a pointer that we're about to release, but
// that's ok since the docshell (nsIBaseWindow) holds the widget
// alive.
return widget.get();
}
// XXXdholbert Duplicated from widget/src/gtk2/nsFilePicker.cpp
// Needs to be unified in some generic utility class.
static GtkWindow *
get_gtk_window_for_nsiwidget(nsIWidget *widget)
{
// Get native GdkWindow
GdkWindow *gdk_win = GDK_WINDOW(widget->GetNativeData(NS_NATIVE_WIDGET));
if (!gdk_win)
return NULL;
// Get the container
gpointer user_data = NULL;
gdk_window_get_user_data(gdk_win, &user_data);
if (!user_data)
return NULL;
// Make sure its really a container
MozContainer *parent_container = MOZ_CONTAINER(user_data);
if (!parent_container)
return NULL;
// Get its toplevel
return GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(parent_container)));
}
static void
ShowCustomDialog(GtkComboBox *changed_box, gpointer user_data)
{
@ -120,7 +186,7 @@ ShowCustomDialog(GtkComboBox *changed_box, gpointer user_data)
class nsPrintDialogWidgetGTK {
public:
nsPrintDialogWidgetGTK(nsIPrintSettings *aPrintSettings);
nsPrintDialogWidgetGTK(nsIDOMWindow *aParent, nsIPrintSettings *aPrintSettings);
~nsPrintDialogWidgetGTK() { gtk_widget_destroy(dialog); }
NS_ConvertUTF16toUTF8 GetUTF8FromBundle(const char* aKey);
const gint Run();
@ -154,12 +220,15 @@ class nsPrintDialogWidgetGTK {
void ExportHeaderFooter(nsIPrintSettings *aNS);
};
nsPrintDialogWidgetGTK::nsPrintDialogWidgetGTK(nsIPrintSettings *aSettings)
nsPrintDialogWidgetGTK::nsPrintDialogWidgetGTK(nsIDOMWindow *aParent, nsIPrintSettings *aSettings)
{
GtkWindow* gtkParent = get_gtk_window_for_nsiwidget(DOMWindowToWidget(aParent));
NS_ASSERTION(gtkParent, "Need a GTK window for dialog to be modal.");
nsCOMPtr<nsIStringBundleService> bundleSvc = do_GetService(NS_STRINGBUNDLE_CONTRACTID);
bundleSvc->CreateBundle("chrome://global/locale/gnomeprintdialog.properties", getter_AddRefs(printBundle));
dialog = gtk_print_unix_dialog_new(GetUTF8FromBundle("printTitle").get(), NULL);
dialog = gtk_print_unix_dialog_new(GetUTF8FromBundle("printTitle").get(), gtkParent);
gtk_print_unix_dialog_set_manual_capabilities(GTK_PRINT_UNIX_DIALOG(dialog),
GtkPrintCapabilities(
@ -495,11 +564,12 @@ nsPrintDialogServiceGTK::Init()
}
NS_IMETHODIMP
nsPrintDialogServiceGTK::Show(nsIPrintSettings *aSettings)
nsPrintDialogServiceGTK::Show(nsIDOMWindow *aParent, nsIPrintSettings *aSettings)
{
NS_PRECONDITION(aParent, "aParent must not be null");
NS_PRECONDITION(aSettings, "aSettings must not be null");
nsPrintDialogWidgetGTK printDialog(aSettings);
nsPrintDialogWidgetGTK printDialog(aParent, aSettings);
nsresult rv = printDialog.ImportSettings(aSettings);
NS_ENSURE_SUCCESS(rv, rv);
@ -528,11 +598,16 @@ nsPrintDialogServiceGTK::Show(nsIPrintSettings *aSettings)
}
NS_IMETHODIMP
nsPrintDialogServiceGTK::ShowPageSetup(nsIPrintSettings *aNSSettings)
nsPrintDialogServiceGTK::ShowPageSetup(nsIDOMWindow *aParent,
nsIPrintSettings *aNSSettings)
{
NS_PRECONDITION(aParent, "aParent must not be null");
NS_PRECONDITION(aNSSettings, "aSettings must not be null");
NS_ENSURE_TRUE(aNSSettings, NS_ERROR_FAILURE);
GtkWindow* gtkParent = get_gtk_window_for_nsiwidget(DOMWindowToWidget(aParent));
NS_ASSERTION(gtkParent, "Need a GTK window for dialog to be modal.");
nsCOMPtr<nsPrintSettingsGTK> aNSSettingsGTK(do_QueryInterface(aNSSettings));
if (!aNSSettingsGTK)
return NS_ERROR_FAILURE;
@ -552,7 +627,7 @@ nsPrintDialogServiceGTK::ShowPageSetup(nsIPrintSettings *aNSSettings)
GtkPrintSettings* gtkSettings = aNSSettingsGTK->GetGtkPrintSettings();
GtkPageSetup* oldPageSetup = aNSSettingsGTK->GetGtkPageSetup();
GtkPageSetup* newPageSetup = gtk_print_run_page_setup_dialog(NULL, oldPageSetup, gtkSettings);
GtkPageSetup* newPageSetup = gtk_print_run_page_setup_dialog(gtkParent, oldPageSetup, gtkSettings);
aNSSettingsGTK->SetGtkPageSetup(newPageSetup);

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

@ -51,8 +51,9 @@ public:
NS_DECL_ISUPPORTS
NS_IMETHODIMP Init();
NS_IMETHODIMP Show(nsIPrintSettings *aSettings);
NS_IMETHODIMP ShowPageSetup(nsIPrintSettings *aSettings);
NS_IMETHODIMP Show(nsIDOMWindow *aParent, nsIPrintSettings *aSettings);
NS_IMETHODIMP ShowPageSetup(nsIDOMWindow *aParent,
nsIPrintSettings *aSettings);
};
#endif

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

@ -2286,13 +2286,13 @@ nsWindow::DispatchCommandEvent(nsIAtom* aCommand)
}
static PRUint32
GetCharCodeFor(const GdkEventKey *aEvent, GdkModifierType aShiftState,
GetCharCodeFor(const GdkEventKey *aEvent, guint aShiftState,
gint aGroup)
{
guint keyval;
if (gdk_keymap_translate_keyboard_state(NULL,
aEvent->hardware_keycode,
aShiftState, aGroup,
if (gdk_keymap_translate_keyboard_state(NULL, aEvent->hardware_keycode,
GdkModifierType(aShiftState),
aGroup,
&keyval, NULL, NULL, NULL)) {
GdkEventKey tmpEvent = *aEvent;
tmpEvent.state = guint(aShiftState);
@ -2416,6 +2416,9 @@ nsWindow::OnKeyPressEvent(GtkWidget *aWidget, GdkEventKey *aEvent)
gint level = GetKeyLevel(aEvent);
if ((event.isControl || event.isAlt || event.isMeta) &&
(level == 0 || level == 1)) {
guint baseState =
aEvent->state & ~(GDK_SHIFT_MASK | GDK_CONTROL_MASK |
GDK_MOD1_MASK | GDK_MOD4_MASK);
// We shold send both shifted char and unshifted char,
// all keyboard layout users can use all keys.
// Don't change event.charCode. On some keyboard layouts,
@ -2423,11 +2426,12 @@ nsWindow::OnKeyPressEvent(GtkWidget *aWidget, GdkEventKey *aEvent)
nsAlternativeCharCode altCharCodes(0, 0);
// unshifted charcode of current keyboard layout.
altCharCodes.mUnshiftedCharCode =
GetCharCodeFor(aEvent, GdkModifierType(0), aEvent->group);
GetCharCodeFor(aEvent, baseState, aEvent->group);
PRBool isLatin = (altCharCodes.mUnshiftedCharCode <= 0xFF);
// shifted charcode of current keyboard layout.
altCharCodes.mShiftedCharCode =
GetCharCodeFor(aEvent, GDK_SHIFT_MASK, aEvent->group);
GetCharCodeFor(aEvent, baseState | GDK_SHIFT_MASK,
aEvent->group);
isLatin = isLatin && (altCharCodes.mShiftedCharCode <= 0xFF);
if (altCharCodes.mUnshiftedCharCode ||
altCharCodes.mShiftedCharCode) {
@ -2454,11 +2458,12 @@ nsWindow::OnKeyPressEvent(GtkWidget *aWidget, GdkEventKey *aEvent)
if (minGroup >= 0) {
// unshifted charcode of found keyboard layout.
PRUint32 ch =
GetCharCodeFor(aEvent, GdkModifierType(0), minGroup);
GetCharCodeFor(aEvent, baseState, minGroup);
altCharCodes.mUnshiftedCharCode =
IsBasicLatinLetterOrNumeral(ch) ? ch : 0;
// shifted charcode of found keyboard layout.
ch = GetCharCodeFor(aEvent, GDK_SHIFT_MASK, minGroup);
ch = GetCharCodeFor(aEvent, baseState | GDK_SHIFT_MASK,
minGroup);
altCharCodes.mShiftedCharCode =
IsBasicLatinLetterOrNumeral(ch) ? ch : 0;
if (altCharCodes.mUnshiftedCharCode ||

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

@ -69,6 +69,8 @@ nsBaseFilePicker::~nsBaseFilePicker()
}
// XXXdholbert -- this function is duplicated in nsPrintDialogGTK.cpp
// and needs to be unified in some generic utility class.
nsIWidget *nsBaseFilePicker::DOMWindowToWidget(nsIDOMWindow *dw)
{
nsCOMPtr<nsIWidget> widget;