зеркало из https://github.com/mozilla/pjs.git
merge with bug 476209
This commit is contained in:
Коммит
7b19fa7219
1
.hgtags
1
.hgtags
|
@ -28,3 +28,4 @@ d7d64f68423b68a671f623f123e90057ebc49dac UPDATE_PACKAGING_R6
|
|||
8df5a90281cd4d75835e4b7696da200555eed15f GECKO_1_9_1_BASE
|
||||
8a601ed6bc4c7b3d1e35aa9e81f257512d984bd5 FENNEC_A2
|
||||
d7d64f68423b68a671f623f123e90057ebc49dac UPDATE_PACKAGING_R7
|
||||
fb32f6e1859c07846a01b4478a7b1678019e0b45 UPDATE_PACKAGING_R7
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(F4ABBC2F-0F28-47DC-A9E9-F7A1719AB2BE)]
|
||||
[scriptable, uuid(42a1e1dc-58cf-419d-bff0-ed3314c70016)]
|
||||
interface nsIAccessibleValue : nsISupports
|
||||
{
|
||||
readonly attribute double maximumValue;
|
||||
|
|
|
@ -70,7 +70,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] =
|
|||
},
|
||||
{
|
||||
"alertdialog",
|
||||
nsIAccessibleRole::ROLE_ALERT,
|
||||
nsIAccessibleRole::ROLE_DIALOG,
|
||||
eNoValue,
|
||||
eNoAction,
|
||||
kNoReqStates,
|
||||
|
|
|
@ -33,7 +33,10 @@ const nsIAccessibleValue = Components.interfaces.nsIAccessibleValue;
|
|||
|
||||
const nsIObserverService = Components.interfaces.nsIObserverService;
|
||||
|
||||
const nsIDOMDocument = Components.interfaces.nsIDOMDocument;
|
||||
const nsIDOMNode = Components.interfaces.nsIDOMNode;
|
||||
const nsIDOMWindow = Components.interfaces.nsIDOMWindow;
|
||||
|
||||
const nsIPropertyElement = Components.interfaces.nsIPropertyElement;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -9,34 +9,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=441737
|
|||
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/nsIAccessible_states.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
const nsIAccessibleRetrieval = Components.interfaces.nsIAccessibleRetrieval;
|
||||
const nsIAccessibleRole = Components.interfaces.nsIAccessibleRole;
|
||||
const nsIAccessibleDocument = Components.interfaces.nsIAccessibleDocument;
|
||||
const nsIDOMDocument = Components.interfaces.nsIDOMDocument;
|
||||
const nsIDOMWindow = Components.interfaces.nsIDOMWindow;
|
||||
|
||||
// needed state flag
|
||||
const state_focusable =
|
||||
Components.interfaces.nsIAccessibleStates.STATE_FOCUSABLE;
|
||||
const state_readonly =
|
||||
Components.interfaces.nsIAccessibleStates.STATE_READONLY;
|
||||
|
||||
var gAccRetrieval = null;
|
||||
|
||||
function doTest()
|
||||
{
|
||||
gAccRetrieval = Components.classes["@mozilla.org/accessibleRetrieval;1"].
|
||||
getService(nsIAccessibleRetrieval);
|
||||
|
||||
// Get accessible for body tag.
|
||||
var docAcc = null;
|
||||
try {
|
||||
docAcc = gAccRetrieval.getAccessibleFor(document).
|
||||
QueryInterface(nsIAccessibleDocument);
|
||||
} catch(e) {}
|
||||
ok(docAcc, "No accessible with interface for document!");
|
||||
|
||||
var docAcc = getAccessible(document, [nsIAccessibleDocument]);
|
||||
if (docAcc) {
|
||||
// nsIAccessible
|
||||
is(docAcc.name, "nsIAccessibleDocument chrome tests",
|
||||
|
@ -45,11 +27,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=441737
|
|||
"Wrong role for document!");
|
||||
|
||||
// check if it is focusable, read-only.
|
||||
var state = {}, extraState = {}
|
||||
docAcc.getState(state, extraState);
|
||||
var desiredStates = (state_focusable | state_readonly);
|
||||
is(state.value & desiredStates, desiredStates,
|
||||
"Wrong state bits for document!");
|
||||
testStates(docAcc, (STATE_READONLY | STATE_FOCUSABLE));
|
||||
|
||||
// No actions wanted on doc
|
||||
is(docAcc.numActions, 0, "Wrong number of actions for document!");
|
||||
|
|
|
@ -149,6 +149,36 @@
|
|||
"activate", // ActionName
|
||||
"Activate"); // ActionDescription
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Search textbox without search button, searches as you type and filters
|
||||
// a separate control.
|
||||
testThis("search-box", // ID
|
||||
"Search History:", // name
|
||||
"", // value
|
||||
"", // description
|
||||
ROLE_ENTRY, // role
|
||||
(STATE_FOCUSABLE), // state
|
||||
(EXT_STATE_SUPPORTS_AUTOCOMPLETION), // extState
|
||||
(0), // absentState
|
||||
1, // numActions
|
||||
"activate", // ActionName
|
||||
"Activate"); // ActionDescription
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Search textbox with search button, does not support autoCompletion.
|
||||
testThis("searchfield", // ID
|
||||
"Search all add-ons", // name
|
||||
"", // value
|
||||
"", // description
|
||||
ROLE_ENTRY, // role
|
||||
(STATE_FOCUSABLE), // state
|
||||
(0), // extState
|
||||
(0), // absentState
|
||||
1, // numActions
|
||||
"activate", // ActionName
|
||||
"Activate"); // ActionDescription
|
||||
testStates("searchfield", 0, 0, 0, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
@ -208,5 +238,13 @@
|
|||
<textbox multiline="true" id="readonly_textarea" readonly="true" cols="80"
|
||||
rows="5" value="You cannot change me, either."/>
|
||||
</vbox>
|
||||
<hbox>
|
||||
<label value="Search History:" accesskey="S"
|
||||
control="search-box"/>
|
||||
<textbox id="search-box" flex="1" type="search" cocoa-size="small"
|
||||
results="historyTree"/>
|
||||
</hbox>
|
||||
<textbox id="searchfield" emptytext="Search all add-ons"
|
||||
type="search" searchbutton="true" cocoa-size="small"/>
|
||||
</vbox>
|
||||
</window>
|
||||
|
|
|
@ -4919,9 +4919,10 @@ var contentAreaDNDObserver = {
|
|||
if (dragData instanceof XULElement && dragData.localName == "tab" &&
|
||||
dragData.ownerDocument.defaultView == window) {
|
||||
// Detach only if the mouse pointer was released a little
|
||||
// bit down in the content area (to be precise, by tab-height)
|
||||
// bit down in the content area (to be precise, by half the height
|
||||
// of a tab)
|
||||
if (aEvent.screenY > gBrowser.mPanelContainer.boxObject.screenY +
|
||||
dragData.boxObject.height) {
|
||||
dragData.boxObject.height / 2) {
|
||||
gBrowser.replaceTabWithWindow(dragData);
|
||||
aEvent.dataTransfer.dropEffect = "move";
|
||||
return;
|
||||
|
|
|
@ -342,13 +342,24 @@ Sanitizer.prototype = {
|
|||
siteSettings: {
|
||||
clear: function ()
|
||||
{
|
||||
// Clear site-specific permissions like "Allow this site to open popups"
|
||||
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
|
||||
.getService(Components.interfaces.nsIPermissionManager);
|
||||
pm.removeAll();
|
||||
|
||||
// Clear site-specific settings like page-zoom level
|
||||
var cps = Components.classes["@mozilla.org/content-pref/service;1"]
|
||||
.getService(Components.interfaces.nsIContentPrefService);
|
||||
cps.removeGroupedPrefs();
|
||||
|
||||
// Clear "Never remember passwords for this site", which is not handled by
|
||||
// the permission manager
|
||||
var pwmgr = Components.classes["@mozilla.org/login-manager;1"]
|
||||
.getService(Components.interfaces.nsILoginManager);
|
||||
var hosts = pwmgr.getAllDisabledHosts({})
|
||||
for each (var host in hosts) {
|
||||
pwmgr.setLoginSavingEnabled(host, true);
|
||||
}
|
||||
},
|
||||
|
||||
get canClear()
|
||||
|
|
|
@ -1921,6 +1921,8 @@
|
|||
dt.setDragImage(canvas, 0, 0);
|
||||
aEvent.stopPropagation();
|
||||
}
|
||||
|
||||
this._dragLeftWindow = false;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
|
|
@ -88,6 +88,7 @@ _BROWSER_FILES = browser_bug321000.js \
|
|||
browser_bug422590.js \
|
||||
browser_sanitize-sitepermissions.js \
|
||||
browser_bug356571.js \
|
||||
browser_sanitize-passwordDisabledHosts.js \
|
||||
$(NULL)
|
||||
|
||||
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
// Bug 474792 - Clear "Never remember passwords for this site" when
|
||||
// clearing site-specific settings in Clear Recent History dialog
|
||||
|
||||
Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader)
|
||||
.loadSubScript("chrome://browser/content/sanitize.js");
|
||||
|
||||
function test() {
|
||||
|
||||
var pwmgr = Components.classes["@mozilla.org/login-manager;1"]
|
||||
.getService(Components.interfaces.nsILoginManager);
|
||||
|
||||
// Add a disabled host
|
||||
pwmgr.setLoginSavingEnabled("http://example.com", false);
|
||||
|
||||
// Sanity check
|
||||
is(pwmgr.getLoginSavingEnabled("http://example.com"), false,
|
||||
"example.com should be disabled for password saving since we haven't cleared that yet.");
|
||||
|
||||
// Set up the sanitizer to just clear siteSettings
|
||||
let s = new Sanitizer();
|
||||
s.ignoreTimespan = false;
|
||||
s.prefDomain = "privacy.cpd.";
|
||||
var itemPrefs = Cc["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefService)
|
||||
.getBranch(s.prefDomain);
|
||||
itemPrefs.setBoolPref("history", false);
|
||||
itemPrefs.setBoolPref("downloads", false);
|
||||
itemPrefs.setBoolPref("cache", false);
|
||||
itemPrefs.setBoolPref("cookies", false);
|
||||
itemPrefs.setBoolPref("formdata", false);
|
||||
itemPrefs.setBoolPref("offlineApps", false);
|
||||
itemPrefs.setBoolPref("passwords", false);
|
||||
itemPrefs.setBoolPref("sessions", false);
|
||||
itemPrefs.setBoolPref("siteSettings", true);
|
||||
|
||||
// Clear it
|
||||
s.sanitize();
|
||||
|
||||
// Make sure it's gone
|
||||
is(pwmgr.getLoginSavingEnabled("http://example.com"), true,
|
||||
"example.com should be enabled for password saving again now that we've cleared.");
|
||||
}
|
|
@ -478,6 +478,18 @@ var nsBrowserContentHandler = {
|
|||
cmdLine.preventDefault = true;
|
||||
}
|
||||
|
||||
var fileParam = cmdLine.handleFlagWithParam("file", false);
|
||||
if (fileParam) {
|
||||
var file = cmdLine.resolveFile(fileParam);
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var uri = ios.newFileURI(file);
|
||||
openWindow(null, this.chromeURL, "_blank",
|
||||
"chrome,dialog=no,all" + this.getFeatures(cmdLine),
|
||||
uri.spec);
|
||||
cmdLine.preventDefault = true;
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
// Handle "? searchterm" for Windows Vista start menu integration
|
||||
for (var i = cmdLine.length - 1; i >= 0; --i) {
|
||||
|
|
|
@ -352,9 +352,6 @@ var BookmarkPropertiesPanel = {
|
|||
if (!this._element("tagsRow").collapsed) {
|
||||
this._element("tagsSelectorRow")
|
||||
.addEventListener("DOMAttrModified", this, false);
|
||||
// Set on document to get the event before an autocomplete popup could
|
||||
// be hidden on Enter.
|
||||
document.addEventListener("keypress", this, true);
|
||||
}
|
||||
if (!this._element("folderRow").collapsed) {
|
||||
this._element("folderTreeRow")
|
||||
|
@ -373,29 +370,43 @@ var BookmarkPropertiesPanel = {
|
|||
.addEventListener("input", this, false);
|
||||
}
|
||||
|
||||
// Set on document to get the event before an autocomplete popup could
|
||||
// be hidden on Enter.
|
||||
document.addEventListener("keypress", this, true);
|
||||
|
||||
window.sizeToContent();
|
||||
},
|
||||
|
||||
// nsIDOMEventListener
|
||||
_elementsHeight: [],
|
||||
handleEvent: function BPP_handleEvent(aEvent) {
|
||||
var target = aEvent.target;
|
||||
switch (aEvent.type) {
|
||||
case "keypress":
|
||||
if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN &&
|
||||
aEvent.target.localName != "tree" &&
|
||||
aEvent.target.className != "expander-up" &&
|
||||
aEvent.target.className != "expander-down" &&
|
||||
!aEvent.target.popupOpen) {
|
||||
// Accept the dialog unless the folder tree or an expander are focused
|
||||
// or an autocomplete popup is open.
|
||||
document.documentElement.acceptDialog();
|
||||
function canAcceptDialog(aElement) {
|
||||
// on Enter we accept the dialog unless:
|
||||
// - the folder tree is focused
|
||||
// - an expander is focused
|
||||
// - an autocomplete (eg. tags) popup is open
|
||||
// - a menulist is open
|
||||
// - a multiline textbox is focused
|
||||
return aElement.localName != "tree" &&
|
||||
aElement.className != "expander-up" &&
|
||||
aElement.className != "expander-down" &&
|
||||
!aElement.popupOpen &&
|
||||
!aElement.open &&
|
||||
!(aElement.localName == "textbox" &&
|
||||
aElement.getAttribute("multiline") == "true");
|
||||
}
|
||||
if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN &&
|
||||
canAcceptDialog(target))
|
||||
document.documentElement.acceptDialog();
|
||||
break;
|
||||
|
||||
case "input":
|
||||
if (aEvent.target.id == "editBMPanel_locationField" ||
|
||||
aEvent.target.id == "editBMPanel_feedLocationField" ||
|
||||
aEvent.target.id == "editBMPanel_siteLocationField") {
|
||||
if (target.id == "editBMPanel_locationField" ||
|
||||
target.id == "editBMPanel_feedLocationField" ||
|
||||
target.id == "editBMPanel_siteLocationField") {
|
||||
// Check uri fields to enable accept button if input is valid
|
||||
document.documentElement
|
||||
.getButton("accept").disabled = !this._inputIsValid();
|
||||
|
@ -405,17 +416,16 @@ var BookmarkPropertiesPanel = {
|
|||
case "DOMAttrModified":
|
||||
// this is called when collapsing a node, but also its direct children,
|
||||
// we only need to resize when the original node changes.
|
||||
if ((aEvent.target.id == "editBMPanel_tagsSelectorRow" ||
|
||||
aEvent.target.id == "editBMPanel_folderTreeRow") &&
|
||||
if ((target.id == "editBMPanel_tagsSelectorRow" ||
|
||||
target.id == "editBMPanel_folderTreeRow") &&
|
||||
aEvent.attrName == "collapsed" &&
|
||||
aEvent.target == aEvent.originalTarget) {
|
||||
var element = aEvent.target;
|
||||
var id = element.id;
|
||||
target == aEvent.originalTarget) {
|
||||
var id = target.id;
|
||||
var newHeight = window.outerHeight;
|
||||
if (aEvent.newValue) // is collapsed
|
||||
newHeight -= this._elementsHeight[id];
|
||||
else {
|
||||
this._elementsHeight[id] = element.boxObject.height;
|
||||
this._elementsHeight[id] = target.boxObject.height;
|
||||
newHeight += this._elementsHeight[id];
|
||||
}
|
||||
|
||||
|
@ -680,37 +690,5 @@ var BookmarkPropertiesPanel = {
|
|||
|
||||
PlacesUIUtils.ptm.doTransaction(txn);
|
||||
this._itemId = PlacesUtils.bookmarks.getIdForItemAt(container, index);
|
||||
},
|
||||
|
||||
_getFolderIdFromMenuList:
|
||||
function BPP__getFolderIdFromMenuList() {
|
||||
var selectedItem = this._element("folderPicker").selectedItem;
|
||||
NS_ASSERT("folderId" in selectedItem,
|
||||
"Invalid menuitem in the folders-menulist");
|
||||
return selectedItem.folderId;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the corresponding menu-item in the folder-menu-list for a bookmarks
|
||||
* folder if such an item exists. Otherwise, this creates a menu-item for the
|
||||
* folder. If the items-count limit (see MAX_FOLDERS_IN_MENU_LIST) is reached,
|
||||
* the new item replaces the last menu-item.
|
||||
* @param aFolderId
|
||||
* The identifier of the bookmarks folder.
|
||||
*/
|
||||
_getFolderMenuItem:
|
||||
function BPP__getFolderMenuItem(aFolderId) {
|
||||
var menupopup = this._folderMenuList.menupopup;
|
||||
|
||||
for (var i = 0; i < menupopup.childNodes.length; i++) {
|
||||
if (menupopup.childNodes[i].folderId == aFolderId)
|
||||
return menupopup.childNodes[i];
|
||||
}
|
||||
|
||||
// 2 special folders + separator + folder-items-count limit
|
||||
if (menupopup.childNodes.length == 3 + MAX_FOLDER_ITEM_IN_MENU_LIST)
|
||||
menupopup.removeChild(menupopup.lastChild);
|
||||
|
||||
return this._appendFolderItemToMenupopup(menupopup, aFolderId);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
<hbox align="center">
|
||||
<label value="&search.label;" accesskey="&search.accesskey;" control="search-box"/>
|
||||
<textbox id="search-box" flex="1" type="search" cocoa-size="small"
|
||||
aria-controls="bookmarks-view"
|
||||
oncommand="searchBookmarks(this.value);"/>
|
||||
</hbox>
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@
|
|||
<label value="&find.label;" accesskey="&find.accesskey;"
|
||||
control="search-box"/>
|
||||
<textbox id="search-box" flex="1" type="search" cocoa-size="small"
|
||||
aria-controls="historyTree"
|
||||
oncommand="searchHistory(this.value);"/>
|
||||
<button id="viewButton" style="min-width:0px !important;" type="menu"
|
||||
label="&view.label;" accesskey="&view.accesskey;" selectedsort="day"
|
||||
|
|
|
@ -200,12 +200,19 @@ var PlacesOrganizer = {
|
|||
* true if the search box should also be reset, false if it should
|
||||
* be left alone.
|
||||
*/
|
||||
_cachedLeftPaneSelectedNode: null,
|
||||
onPlaceSelected: function PO_onPlaceSelected(resetSearchBox) {
|
||||
// Don't change the right-hand pane contents when there's no selection
|
||||
if (!this._places.hasSelection)
|
||||
return;
|
||||
|
||||
var node = this._places.selectedNode;
|
||||
// When we invalidate a container we use suppressSelectionEvent, when it is
|
||||
// unset a select event is fired, in many cases the selection did not really
|
||||
// change, so we should check for it, and return early in such a case.
|
||||
if (node == this._cachedLeftPaneSelectedNode)
|
||||
return;
|
||||
this._cachedLeftPaneSelectedNode = node;
|
||||
var queries = asQuery(node).getQueries({});
|
||||
|
||||
// Items are only excluded on the left pane
|
||||
|
@ -332,7 +339,7 @@ var PlacesOrganizer = {
|
|||
this._places.selectPlaceURI(aContainer.uri);
|
||||
},
|
||||
|
||||
openSelectedNode: function PU_openSelectedNode(aEvent) {
|
||||
openSelectedNode: function PO_openSelectedNode(aEvent) {
|
||||
PlacesUIUtils.openNodeWithEvent(this._content.selectedNode, aEvent);
|
||||
},
|
||||
|
||||
|
|
|
@ -389,6 +389,7 @@
|
|||
<textbox id="searchFilter"
|
||||
clickSelectsAll="true"
|
||||
type="search"
|
||||
aria-controls="placeContent"
|
||||
oncommand="PlacesSearchBox.search(this.value);"
|
||||
collection="bookmarks">
|
||||
</textbox>
|
||||
|
|
|
@ -585,6 +585,9 @@
|
|||
// Array of nodes found by findNodes which are to be selected
|
||||
var nodes = [];
|
||||
|
||||
// Array of nodes found by findNodes which should be opened
|
||||
var nodesToOpen = [];
|
||||
|
||||
// A set of URIs of container-nodes that were previously searched,
|
||||
// and thus shouldn't be searched again. This is empty at the initial
|
||||
// start of the recursion and gets filled in as the recursion
|
||||
|
@ -639,12 +642,18 @@
|
|||
|
||||
// If we didn't find any additional matches in this node's
|
||||
// subtree, revert the node to its previous openness.
|
||||
if (!foundOne)
|
||||
node.containerOpen = previousOpenness;
|
||||
if (foundOne)
|
||||
nodesToOpen.unshift(node);
|
||||
node.containerOpen = previousOpenness;
|
||||
return foundOne;
|
||||
}
|
||||
|
||||
// Null the viewer while looking for nodes
|
||||
var result = this.getResult();
|
||||
var oldViewer = result.viewer;
|
||||
result.viewer = null;
|
||||
findNodes(this.getResultNode());
|
||||
result.viewer = oldViewer;
|
||||
|
||||
// For all the nodes we've found, highlight the corresponding
|
||||
// index in the tree.
|
||||
|
@ -652,7 +661,11 @@
|
|||
var selection = this.view.selection;
|
||||
selection.selectEventsSuppressed = true;
|
||||
selection.clearSelection();
|
||||
for (var i=0; i < nodes.length; i++) {
|
||||
// Open nodes containing found items
|
||||
for (var i = 0; i < nodesToOpen.length; i++) {
|
||||
nodesToOpen[i].containerOpen = true;
|
||||
}
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
var index = resultview.treeIndexForNode(nodes[i]);
|
||||
selection.rangedSelect(index, index, true);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,8 @@ _BROWSER_TEST_FILES = \
|
|||
browser_423515.js \
|
||||
browser_457473_no_copy_guid.js \
|
||||
browser_sort_in_library.js \
|
||||
browser_library_open_leak.js \
|
||||
browser_library_open_leak.js \
|
||||
browser_library_panel_leak.js \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_BROWSER_TEST_FILES)
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||
/* ***** 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 Places test code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Corp.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Marco Bonardo <mak77@bonardo.net> (Original Author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
/**
|
||||
* Bug 433231 - Places Library leaks the nsGlobalWindow when closed with a
|
||||
* history entry selected.
|
||||
* https://bugzilla.mozilla.org/show_bug.cgi?id=433231
|
||||
*
|
||||
* STRs: Open Library, select an history entry in History, close Library.
|
||||
* ISSUE: We were adding a bookmarks observer when editing a bookmark, when
|
||||
* selecting an history entry the panel was not un-initialized, and
|
||||
* since an histroy entry does not have an itemId, the observer was
|
||||
* never removed.
|
||||
*/
|
||||
|
||||
const TEST_URI = "http://www.mozilla.org/";
|
||||
|
||||
let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
|
||||
getService(Ci.nsIWindowWatcher);
|
||||
|
||||
let windowObserver = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
if (aTopic === "domwindowopened") {
|
||||
ww.unregisterNotification(this);
|
||||
let organizer = aSubject.QueryInterface(Ci.nsIDOMWindow);
|
||||
organizer.addEventListener("load", function onLoad(event) {
|
||||
organizer.removeEventListener("load", onLoad, false);
|
||||
executeSoon(function () {
|
||||
let contentTree = organizer.document.getElementById("placeContent");
|
||||
isnot(contentTree, null, "Sanity check: placeContent tree should exist");
|
||||
isnot(organizer.PlacesOrganizer, null, "Sanity check: PlacesOrganizer should exist");
|
||||
isnot(organizer.gEditItemOverlay, null, "Sanity check: gEditItemOverlay should exist");
|
||||
isnot(organizer.gEditItemOverlay.itemId, -1, "Editing a bookmark");
|
||||
// Select History in the left pane.
|
||||
organizer.PlacesOrganizer.selectLeftPaneQuery('History');
|
||||
// Select the first history entry.
|
||||
let selection = contentTree.view.selection;
|
||||
selection.clearSelection();
|
||||
selection.rangedSelect(0, 0, true);
|
||||
// Check the panel is editing the history entry.
|
||||
is(organizer.gEditItemOverlay.itemId, -1, "Editing an history entry");
|
||||
// Close Library window.
|
||||
organizer.close();
|
||||
// Clean up history.
|
||||
PlacesUtils.history.QueryInterface(Ci.nsIBrowserHistory).removeAllPages();
|
||||
finish();
|
||||
});
|
||||
}, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
// Add an history entry.
|
||||
ok(PlacesUtils, "checking PlacesUtils, running in chrome context?");
|
||||
PlacesUtils.history.addVisit(PlacesUtils._uri(TEST_URI), Date.now() * 1000,
|
||||
null, PlacesUtils.history.TRANSITION_TYPED,
|
||||
false, 0);
|
||||
|
||||
ww.registerNotification(windowObserver);
|
||||
ww.openWindow(null,
|
||||
"chrome://browser/content/places/places.xul",
|
||||
"",
|
||||
"chrome,toolbar=yes,dialog=no,resizable",
|
||||
null);
|
||||
}
|
|
@ -114,6 +114,7 @@
|
|||
<textbox id="filter" flex="1"
|
||||
type="search"
|
||||
emptytext="&filter.emptytext;"
|
||||
aria-controls="handlersView"
|
||||
oncommand="gApplicationsPane.filter();"/>
|
||||
</hbox>
|
||||
|
||||
|
|
|
@ -66,7 +66,9 @@
|
|||
<vbox flex="1" class="contentPane">
|
||||
<hbox align="center">
|
||||
<label accesskey="&filter.accesskey;" control="filter">&filter.label;</label>
|
||||
<textbox type="search" id="filter" flex="1" oncommand="gCookiesWindow.filter();"/>
|
||||
<textbox type="search" id="filter" flex="1"
|
||||
aria-controls="cookiesList"
|
||||
oncommand="gCookiesWindow.filter();"/>
|
||||
</hbox>
|
||||
<separator class="thin"/>
|
||||
<label control="cookiesList" id="cookiesIntro" value="&cookiesonsystem.label;"/>
|
||||
|
|
|
@ -312,12 +312,12 @@ Section "-Application" APP_IDX
|
|||
${UpdateProtocolHandlers}
|
||||
|
||||
ClearErrors
|
||||
WriteRegStr HKLM "Software\Mozilla\InstallerTest" "InstallerTest" "Test"
|
||||
WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test"
|
||||
${If} ${Errors}
|
||||
StrCpy $TmpVal "HKCU" ; used primarily for logging
|
||||
${Else}
|
||||
SetShellVarContext all ; Set SHCTX to HKLM
|
||||
DeleteRegKey HKLM "Software\Mozilla\InstallerTest"
|
||||
DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest"
|
||||
StrCpy $TmpVal "HKLM" ; used primarily for logging
|
||||
${RegCleanMain} "Software\Mozilla"
|
||||
${RegCleanUninstall}
|
||||
|
|
|
@ -46,19 +46,32 @@
|
|||
${UpdateProtocolHandlers}
|
||||
|
||||
ClearErrors
|
||||
WriteRegStr HKLM "Software\Mozilla\InstallerTest" "InstallerTest" "Test"
|
||||
WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test"
|
||||
${If} ${Errors}
|
||||
StrCpy $TmpVal "HKCU" ; used primarily for logging
|
||||
${Else}
|
||||
SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM)
|
||||
DeleteRegKey HKLM "Software\Mozilla\InstallerTest"
|
||||
DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest"
|
||||
StrCpy $TmpVal "HKLM" ; used primarily for logging
|
||||
${RegCleanMain} "Software\Mozilla"
|
||||
${RegCleanUninstall}
|
||||
${SetStartMenuInternet}
|
||||
${FixShellIconHandler}
|
||||
${SetUninstallKeys}
|
||||
${UpdateProtocolHandlers}
|
||||
${FixShellIconHandler}
|
||||
|
||||
; Only update the Clients\StartMenuInternet registry key values if they
|
||||
; don't exist or this installation is the same as the one set in those keys.
|
||||
${StrFilter} "${FileMainEXE}" "+" "" "" $1
|
||||
ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$1\DefaultIcon" ""
|
||||
${GetPathFromString} "$0" $0
|
||||
${GetParent} "$0" $0
|
||||
${If} ${FileExists} "$0"
|
||||
${GetLongPath} "$0" $0
|
||||
${EndIf}
|
||||
${If} "$0" == "$INSTDIR"
|
||||
${SetStartMenuInternet}
|
||||
${EndIf}
|
||||
|
||||
${SetUninstallKeys}
|
||||
|
||||
ReadRegStr $0 HKLM "Software\mozilla.org\Mozilla" "CurrentVersion"
|
||||
${If} "$0" != "${GREVersion}"
|
||||
|
|
|
@ -221,12 +221,12 @@ Section "Uninstall"
|
|||
${un.DeleteShortcuts}
|
||||
|
||||
ClearErrors
|
||||
WriteRegStr HKLM "Software\Mozilla\InstallerTest" "InstallerTest" "Test"
|
||||
WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test"
|
||||
${If} ${Errors}
|
||||
StrCpy $TmpVal "HKCU" ; used primarily for logging
|
||||
${Else}
|
||||
SetShellVarContext all ; Set SHCTX to HKLM
|
||||
DeleteRegKey HKLM "Software\Mozilla\InstallerTest"
|
||||
DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest"
|
||||
StrCpy $TmpVal "HKLM" ; used primarily for logging
|
||||
${un.RegCleanMain} "Software\Mozilla"
|
||||
${un.RegCleanUninstall}
|
||||
|
|
|
@ -186,6 +186,7 @@ MOZ_FIX_LINK_PATHS=@MOZ_FIX_LINK_PATHS@
|
|||
|
||||
XPCOM_FROZEN_LDOPTS=@XPCOM_FROZEN_LDOPTS@
|
||||
XPCOM_LIBS=@XPCOM_LIBS@
|
||||
LIBXUL_LIBS=@LIBXUL_LIBS@
|
||||
MOZ_TIMELINE=@MOZ_TIMELINE@
|
||||
|
||||
ENABLE_STRIP = @ENABLE_STRIP@
|
||||
|
|
16
configure.in
16
configure.in
|
@ -2455,9 +2455,9 @@ dnl the qsort routine under solaris is faulty
|
|||
# $ORIGIN/.. is for shared libraries under components/ to locate shared
|
||||
# libraries one level up (e.g. libnspr4.so)
|
||||
LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
|
||||
LIBS="-lCrun -lCstd $LIBS"
|
||||
MOZ_MEMORY=1
|
||||
if test -z "$GNU_CC"; then
|
||||
LIBS="-lCrun -lCstd $LIBS"
|
||||
NS_USE_NATIVE=1
|
||||
MOZ_FIX_LINK_PATHS=
|
||||
AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
|
||||
|
@ -7254,6 +7254,8 @@ if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
|
|||
AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
|
||||
fi
|
||||
|
||||
AC_SUBST(LIBXUL_LIBS)
|
||||
|
||||
if test -n "$MOZ_ENABLE_LIBXUL"; then
|
||||
XPCOM_LIBS="$LIBXUL_LIBS"
|
||||
AC_DEFINE(MOZ_ENABLE_LIBXUL)
|
||||
|
@ -8282,11 +8284,14 @@ rm conftest.sh
|
|||
|
||||
echo $MAKEFILES > unallmakefiles
|
||||
|
||||
mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
|
||||
|
||||
AC_OUTPUT($MAKEFILES)
|
||||
|
||||
dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
|
||||
if test "$CAIRO_FEATURES_H"; then
|
||||
if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
|
||||
echo "$CAIRO_FEATURES_H is unchanged"
|
||||
mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
|
||||
else
|
||||
rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
|
||||
|
@ -8367,3 +8372,12 @@ AC_OUTPUT_SUBDIRS(js/src)
|
|||
ac_configure_args="$_SUBDIR_CONFIG_ARGS"
|
||||
|
||||
fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
|
||||
|
||||
dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
|
||||
dnl Needs to be at the end to respect possible changes from NSPR configure
|
||||
if cmp -b config/autoconf.mk config/autoconf.mk.orig; then
|
||||
echo "config/autoconf.mk is unchanged"
|
||||
mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
|
||||
else
|
||||
rm -f config/autoconf.mk.orig 2> /dev/null
|
||||
fi
|
||||
|
|
|
@ -751,6 +751,21 @@ nsObjectLoadingContent::EnsureInstantiation(nsIPluginInstance** aInstance)
|
|||
}
|
||||
|
||||
nsIFrame *nsiframe = do_QueryFrame(frame);
|
||||
|
||||
if (nsiframe->GetStateBits() & NS_FRAME_FIRST_REFLOW) {
|
||||
// A frame for this plugin element already exists now, but it has
|
||||
// not been reflown yet. Force a reflow now so that we don't end
|
||||
// up initializing a plugin before knowing its size. Also re-fetch
|
||||
// the frame, as flushing can cause the frame to be deleted.
|
||||
frame = GetExistingFrame(eFlushLayout);
|
||||
|
||||
if (!frame) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsiframe = do_QueryFrame(frame);
|
||||
}
|
||||
|
||||
nsWeakFrame weakFrame(nsiframe);
|
||||
|
||||
// We may have a plugin instance already; if so, do nothing
|
||||
|
|
|
@ -72,7 +72,6 @@ CPPSRCS = \
|
|||
nsSVGAngle.cpp \
|
||||
nsSVGAnimatedLengthList.cpp \
|
||||
nsSVGAnimatedNumberList.cpp \
|
||||
nsSVGAnimatedRect.cpp \
|
||||
nsSVGAnimatedTransformList.cpp \
|
||||
nsSVGBoolean.cpp \
|
||||
nsSVGCircleElement.cpp \
|
||||
|
@ -136,6 +135,7 @@ CPPSRCS = \
|
|||
nsSVGTransformListParser.cpp \
|
||||
nsSVGUseElement.cpp \
|
||||
nsSVGValue.cpp \
|
||||
nsSVGViewBox.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_SMIL
|
||||
|
|
|
@ -1,202 +0,0 @@
|
|||
/* -*- 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 the Mozilla SVG project.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Crocodile Clips Ltd..
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 ***** */
|
||||
|
||||
#include "nsSVGAnimatedRect.h"
|
||||
#include "nsSVGRect.h"
|
||||
#include "nsSVGValue.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsSVGAnimatedRect
|
||||
|
||||
class nsSVGAnimatedRect : public nsIDOMSVGAnimatedRect,
|
||||
public nsSVGValue,
|
||||
public nsISVGValueObserver
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewSVGAnimatedRect(nsIDOMSVGAnimatedRect** result,
|
||||
nsIDOMSVGRect* baseVal);
|
||||
|
||||
nsSVGAnimatedRect();
|
||||
~nsSVGAnimatedRect();
|
||||
void Init(nsIDOMSVGRect* baseVal);
|
||||
|
||||
public:
|
||||
// nsISupports interface:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMSVGAnimatedRect interface:
|
||||
NS_DECL_NSIDOMSVGANIMATEDRECT
|
||||
|
||||
// remainder of nsISVGValue interface:
|
||||
NS_IMETHOD SetValueString(const nsAString& aValue);
|
||||
NS_IMETHOD GetValueString(nsAString& aValue);
|
||||
|
||||
// nsISVGValueObserver
|
||||
NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable,
|
||||
modificationType aModType);
|
||||
NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable,
|
||||
modificationType aModType);
|
||||
|
||||
// nsISupportsWeakReference
|
||||
// implementation inherited from nsSupportsWeakReference
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIDOMSVGRect> mBaseVal;
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
||||
nsSVGAnimatedRect::nsSVGAnimatedRect()
|
||||
{
|
||||
}
|
||||
|
||||
nsSVGAnimatedRect::~nsSVGAnimatedRect()
|
||||
{
|
||||
if (!mBaseVal) return;
|
||||
nsCOMPtr<nsISVGValue> val = do_QueryInterface(mBaseVal);
|
||||
if (!val) return;
|
||||
val->RemoveObserver(this);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGAnimatedRect::Init(nsIDOMSVGRect* baseVal)
|
||||
{
|
||||
mBaseVal = baseVal;
|
||||
if (!mBaseVal) return;
|
||||
nsCOMPtr<nsISVGValue> val = do_QueryInterface(mBaseVal);
|
||||
if (!val) return;
|
||||
val->AddObserver(this);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods:
|
||||
|
||||
NS_IMPL_ADDREF(nsSVGAnimatedRect)
|
||||
NS_IMPL_RELEASE(nsSVGAnimatedRect)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGAnimatedRect)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedRect)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAnimatedRect)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGValue methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedRect::SetValueString(const nsAString& aValue)
|
||||
{
|
||||
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mBaseVal);
|
||||
return value->SetValueString(aValue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedRect::GetValueString(nsAString& aValue)
|
||||
{
|
||||
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mBaseVal);
|
||||
return value->GetValueString(aValue);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGAnimatedRect methods:
|
||||
|
||||
/* readonly attribute nsIDOMSVGRect baseVal; */
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedRect::GetBaseVal(nsIDOMSVGRect * *aBaseVal)
|
||||
{
|
||||
*aBaseVal = mBaseVal;
|
||||
NS_ADDREF(*aBaseVal);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGRect animVal; */
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedRect::GetAnimVal(nsIDOMSVGRect * *aAnimVal)
|
||||
{
|
||||
*aAnimVal = mBaseVal;
|
||||
NS_ADDREF(*aAnimVal);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGValueObserver methods
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedRect::WillModifySVGObservable(nsISVGValue* observable,
|
||||
modificationType aModType)
|
||||
{
|
||||
WillModify(aModType);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedRect::DidModifySVGObservable (nsISVGValue* observable,
|
||||
modificationType aModType)
|
||||
{
|
||||
DidModify(aModType);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Exported creation functions:
|
||||
|
||||
nsresult
|
||||
NS_NewSVGAnimatedRect(nsIDOMSVGAnimatedRect** result,
|
||||
nsIDOMSVGRect* baseVal)
|
||||
{
|
||||
*result = nsnull;
|
||||
|
||||
nsSVGAnimatedRect* animatedRect = new nsSVGAnimatedRect();
|
||||
if(!animatedRect) return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(animatedRect);
|
||||
|
||||
animatedRect->Init(baseVal);
|
||||
|
||||
*result = (nsIDOMSVGAnimatedRect*) animatedRect;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
/* -*- 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 the Mozilla SVG project.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Crocodile Clips Ltd..
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 ***** */
|
||||
|
||||
#ifndef __NS_SVGANIMATEDRECT_H__
|
||||
#define __NS_SVGANIMATEDRECT_H__
|
||||
|
||||
#include "nsIDOMSVGAnimatedRect.h"
|
||||
#include "nsIDOMSVGRect.h"
|
||||
|
||||
nsresult
|
||||
NS_NewSVGAnimatedRect(nsIDOMSVGAnimatedRect** result,
|
||||
nsIDOMSVGRect* baseVal);
|
||||
|
||||
#endif //__NS_SVGANIMATEDRECT_H__
|
|
@ -73,6 +73,7 @@
|
|||
#include "nsSVGAngle.h"
|
||||
#include "nsSVGBoolean.h"
|
||||
#include "nsSVGEnum.h"
|
||||
#include "nsSVGViewBox.h"
|
||||
#include "nsSVGString.h"
|
||||
#include "nsIDOMSVGUnitTypes.h"
|
||||
#include "nsIDOMSVGLengthList.h"
|
||||
|
@ -150,6 +151,12 @@ nsSVGElement::Init()
|
|||
enumInfo.Reset(i);
|
||||
}
|
||||
|
||||
nsSVGViewBox *viewBox = GetViewBox();
|
||||
|
||||
if (viewBox) {
|
||||
viewBox->Init();
|
||||
}
|
||||
|
||||
nsSVGPreserveAspectRatio *preserveAspectRatio =
|
||||
GetPreserveAspectRatio();
|
||||
|
||||
|
@ -443,16 +450,28 @@ nsSVGElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
}
|
||||
}
|
||||
|
||||
if (!foundMatch && aAttribute == nsGkAtoms::preserveAspectRatio) {
|
||||
// Check for nsSVGPreserveAspectRatio attribute
|
||||
nsSVGPreserveAspectRatio *preserveAspectRatio =
|
||||
GetPreserveAspectRatio();
|
||||
if (preserveAspectRatio) {
|
||||
rv = preserveAspectRatio->SetBaseValueString(aValue, this, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
preserveAspectRatio->Init();
|
||||
if (!foundMatch) {
|
||||
// Check for nsSVGViewBox attribute
|
||||
if (aAttribute == nsGkAtoms::viewBox) {
|
||||
nsSVGViewBox* viewBox = GetViewBox();
|
||||
if (viewBox) {
|
||||
rv = viewBox->SetBaseValueString(aValue, this, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
viewBox->Init();
|
||||
}
|
||||
foundMatch = PR_TRUE;
|
||||
}
|
||||
// Check for nsSVGPreserveAspectRatio attribute
|
||||
} else if (aAttribute == nsGkAtoms::preserveAspectRatio) {
|
||||
nsSVGPreserveAspectRatio *preserveAspectRatio =
|
||||
GetPreserveAspectRatio();
|
||||
if (preserveAspectRatio) {
|
||||
rv = preserveAspectRatio->SetBaseValueString(aValue, this, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
preserveAspectRatio->Init();
|
||||
}
|
||||
foundMatch = PR_TRUE;
|
||||
}
|
||||
foundMatch = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -599,15 +618,25 @@ nsSVGElement::UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
|||
}
|
||||
}
|
||||
|
||||
if (!foundMatch && aName == nsGkAtoms::preserveAspectRatio) {
|
||||
if (!foundMatch) {
|
||||
// Check if this is a nsViewBox attribute going away
|
||||
if (aName == nsGkAtoms::viewBox) {
|
||||
nsSVGViewBox* viewBox = GetViewBox();
|
||||
if (viewBox) {
|
||||
viewBox->Init();
|
||||
DidChangeViewBox(PR_FALSE);
|
||||
foundMatch = PR_TRUE;
|
||||
}
|
||||
// Check if this is a preserveAspectRatio attribute going away
|
||||
nsSVGPreserveAspectRatio *preserveAspectRatio =
|
||||
GetPreserveAspectRatio();
|
||||
} else if (aName == nsGkAtoms::preserveAspectRatio) {
|
||||
nsSVGPreserveAspectRatio *preserveAspectRatio =
|
||||
GetPreserveAspectRatio();
|
||||
|
||||
if (preserveAspectRatio) {
|
||||
preserveAspectRatio->Init();
|
||||
DidChangePreserveAspectRatio(PR_FALSE);
|
||||
foundMatch = PR_TRUE;
|
||||
if (preserveAspectRatio) {
|
||||
preserveAspectRatio->Init();
|
||||
DidChangePreserveAspectRatio(PR_FALSE);
|
||||
foundMatch = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -644,12 +673,6 @@ nsSVGElement::UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
|||
void
|
||||
nsSVGElement::ResetOldStyleBaseType(nsISVGValue *svg_value)
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGAnimatedRect> r = do_QueryInterface(svg_value);
|
||||
if (r) {
|
||||
nsCOMPtr<nsIDOMSVGRect> rect;
|
||||
r->GetBaseVal(getter_AddRefs(rect));
|
||||
static_cast<nsSVGRect*>(rect.get())->Clear();
|
||||
}
|
||||
nsCOMPtr<nsIDOMSVGAnimatedLengthList> ll = do_QueryInterface(svg_value);
|
||||
if (ll) {
|
||||
nsCOMPtr<nsIDOMSVGLengthList> lengthlist;
|
||||
|
@ -1471,6 +1494,28 @@ nsSVGElement::DidChangeEnum(PRUint8 aAttrEnum, PRBool aDoSetAttr)
|
|||
newStr, PR_TRUE);
|
||||
}
|
||||
|
||||
nsSVGViewBox *
|
||||
nsSVGElement::GetViewBox()
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGElement::DidChangeViewBox(PRBool aDoSetAttr)
|
||||
{
|
||||
if (!aDoSetAttr)
|
||||
return;
|
||||
|
||||
nsSVGViewBox *viewBox = GetViewBox();
|
||||
|
||||
NS_ASSERTION(viewBox, "DidChangeViewBox on element with no viewBox attrib");
|
||||
|
||||
nsAutoString newStr;
|
||||
viewBox->GetBaseValueString(newStr);
|
||||
|
||||
SetAttr(kNameSpaceID_None, nsGkAtoms::viewBox, newStr, PR_TRUE);
|
||||
}
|
||||
|
||||
nsSVGPreserveAspectRatio *
|
||||
nsSVGElement::GetPreserveAspectRatio()
|
||||
{
|
||||
|
|
|
@ -67,6 +67,7 @@ class nsSVGAngle;
|
|||
class nsSVGBoolean;
|
||||
class nsSVGEnum;
|
||||
struct nsSVGEnumMapping;
|
||||
class nsSVGViewBox;
|
||||
class nsSVGPreserveAspectRatio;
|
||||
class nsSVGString;
|
||||
|
||||
|
@ -144,6 +145,7 @@ public:
|
|||
virtual void DidChangeAngle(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||
virtual void DidChangeBoolean(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||
virtual void DidChangeEnum(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||
virtual void DidChangeViewBox(PRBool aDoSetAttr);
|
||||
virtual void DidChangePreserveAspectRatio(PRBool aDoSetAttr);
|
||||
virtual void DidChangeString(PRUint8 aAttrEnum) {}
|
||||
|
||||
|
@ -330,8 +332,9 @@ protected:
|
|||
virtual AngleAttributesInfo GetAngleInfo();
|
||||
virtual BooleanAttributesInfo GetBooleanInfo();
|
||||
virtual EnumAttributesInfo GetEnumInfo();
|
||||
// We assume all preserveAspectRatios are alike so we don't
|
||||
// need to wrap the class
|
||||
// We assume all viewboxes and preserveAspectRatios are alike
|
||||
// so we don't need to wrap the class
|
||||
virtual nsSVGViewBox *GetViewBox();
|
||||
virtual nsSVGPreserveAspectRatio *GetPreserveAspectRatio();
|
||||
virtual StringAttributesInfo GetStringInfo();
|
||||
|
||||
|
|
|
@ -50,14 +50,12 @@
|
|||
#include "nsISVGValueUtils.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIDOMSVGAnimatedRect.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsSVGLength class
|
||||
|
||||
class nsSVGLength : public nsISVGLength,
|
||||
public nsSVGValue,
|
||||
public nsISVGValueObserver
|
||||
public nsSVGValue
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewSVGLength(nsISVGLength** result,
|
||||
|
@ -69,7 +67,6 @@ protected:
|
|||
|
||||
nsSVGLength(float value, PRUint16 unit);
|
||||
nsSVGLength();
|
||||
virtual ~nsSVGLength();
|
||||
|
||||
public:
|
||||
// nsISupports interface:
|
||||
|
@ -85,12 +82,6 @@ public:
|
|||
NS_IMETHOD SetValueString(const nsAString& aValue);
|
||||
NS_IMETHOD GetValueString(nsAString& aValue);
|
||||
|
||||
// nsISVGValueObserver interface:
|
||||
NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable,
|
||||
modificationType aModType);
|
||||
NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable,
|
||||
modificationType aModType);
|
||||
|
||||
// nsISupportsWeakReference
|
||||
// implementation inherited from nsSupportsWeakReference
|
||||
|
||||
|
@ -101,11 +92,6 @@ protected:
|
|||
float EmLength();
|
||||
float ExLength();
|
||||
PRBool IsValidUnitType(PRUint16 unit);
|
||||
void MaybeAddAsObserver();
|
||||
void MaybeRemoveAsObserver();
|
||||
|
||||
// helper - returns a rect if we need to observe it (percentage length)
|
||||
already_AddRefed<nsIDOMSVGRect> MaybeGetCtxRect();
|
||||
|
||||
nsWeakPtr mElement; // owning element - weakptr to avoid reference loop
|
||||
float mValueInSpecifiedUnits;
|
||||
|
@ -154,18 +140,12 @@ nsSVGLength::nsSVGLength(float value,
|
|||
mSpecifiedUnitType(unit),
|
||||
mCtxType(0)
|
||||
{
|
||||
// we don't have a context yet, so we don't call MaybeAddAsObserver()
|
||||
}
|
||||
|
||||
nsSVGLength::nsSVGLength()
|
||||
{
|
||||
}
|
||||
|
||||
nsSVGLength::~nsSVGLength()
|
||||
{
|
||||
MaybeRemoveAsObserver();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods:
|
||||
|
||||
|
@ -174,10 +154,8 @@ NS_IMPL_RELEASE(nsSVGLength)
|
|||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGLength)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISVGLength)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGLength)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGLength)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
@ -197,25 +175,6 @@ nsSVGLength::GetValueString(nsAString& aValue)
|
|||
return GetValueAsString(aValue);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGValueObserver methods
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGLength::WillModifySVGObservable(nsISVGValue* observable,
|
||||
modificationType aModType)
|
||||
{
|
||||
WillModify(aModType);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGLength::DidModifySVGObservable(nsISVGValue* observable,
|
||||
modificationType aModType)
|
||||
{
|
||||
DidModify(aModType);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGLength methods:
|
||||
|
||||
|
@ -464,15 +423,9 @@ nsSVGLength::NewValueSpecifiedUnits(PRUint16 unitType, float valueInSpecifiedUni
|
|||
if (!IsValidUnitType(unitType))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRBool observer_change = (unitType != mSpecifiedUnitType);
|
||||
|
||||
WillModify();
|
||||
if (observer_change)
|
||||
MaybeRemoveAsObserver();
|
||||
mValueInSpecifiedUnits = valueInSpecifiedUnits;
|
||||
mSpecifiedUnitType = unitType;
|
||||
if (observer_change)
|
||||
MaybeAddAsObserver();
|
||||
DidModify();
|
||||
|
||||
return NS_OK;
|
||||
|
@ -485,17 +438,11 @@ nsSVGLength::ConvertToSpecifiedUnits(PRUint16 unitType)
|
|||
if (!IsValidUnitType(unitType))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRBool observer_change = (unitType != mSpecifiedUnitType);
|
||||
|
||||
WillModify();
|
||||
if (observer_change)
|
||||
MaybeRemoveAsObserver();
|
||||
float valueInUserUnits;
|
||||
GetValue(&valueInUserUnits);
|
||||
mSpecifiedUnitType = unitType;
|
||||
SetValue(valueInUserUnits);
|
||||
if (observer_change)
|
||||
MaybeAddAsObserver();
|
||||
DidModify();
|
||||
|
||||
return NS_OK;
|
||||
|
@ -506,24 +453,9 @@ nsSVGLength::ConvertToSpecifiedUnits(PRUint16 unitType)
|
|||
NS_IMETHODIMP
|
||||
nsSVGLength::SetContext(nsIWeakReference *aContext, PRUint8 aCtxType)
|
||||
{
|
||||
/* Unless our unit type is SVG_LENGTHTYPE_NUMBER or SVG_LENGTHTYPE_PX, our
|
||||
user unit value is determined by our context and we must notify our
|
||||
observers that we have changed. */
|
||||
|
||||
if (mSpecifiedUnitType != SVG_LENGTHTYPE_NUMBER &&
|
||||
mSpecifiedUnitType != SVG_LENGTHTYPE_PX) {
|
||||
WillModify(mod_context);
|
||||
MaybeRemoveAsObserver();
|
||||
}
|
||||
|
||||
mElement = aContext;
|
||||
mCtxType = aCtxType;
|
||||
|
||||
if (mSpecifiedUnitType != SVG_LENGTHTYPE_NUMBER &&
|
||||
mSpecifiedUnitType != SVG_LENGTHTYPE_PX) {
|
||||
MaybeAddAsObserver();
|
||||
DidModify(mod_context);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -597,32 +529,3 @@ PRBool nsSVGLength::IsValidUnitType(PRUint16 unit)
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGRect> nsSVGLength::MaybeGetCtxRect()
|
||||
{
|
||||
if ((mSpecifiedUnitType == SVG_LENGTHTYPE_PERCENTAGE) && mElement) {
|
||||
nsCOMPtr<nsIContent> element = do_QueryReferent(mElement);
|
||||
if (element) {
|
||||
nsSVGSVGElement *ctx =
|
||||
static_cast<nsSVGElement*>(element.get())->GetCtx();
|
||||
if (ctx)
|
||||
return ctx->GetCtxRect();
|
||||
}
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
void nsSVGLength::MaybeAddAsObserver()
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGRect> rect = MaybeGetCtxRect();
|
||||
if (rect)
|
||||
NS_ADD_SVGVALUE_OBSERVER(rect);
|
||||
}
|
||||
|
||||
void nsSVGLength::MaybeRemoveAsObserver()
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGRect> rect = MaybeGetCtxRect();
|
||||
if (rect)
|
||||
NS_REMOVE_SVGVALUE_OBSERVER(rect);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,8 +35,6 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsSVGAnimatedRect.h"
|
||||
#include "nsSVGRect.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsISVGValueUtils.h"
|
||||
#include "nsSVGPreserveAspectRatio.h"
|
||||
|
@ -135,28 +133,6 @@ nsSVGMarkerElement::nsSVGMarkerElement(nsINodeInfo *aNodeInfo)
|
|||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGMarkerElement::Init()
|
||||
{
|
||||
nsresult rv = nsSVGMarkerElementBase::Init();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// Create mapped properties:
|
||||
|
||||
// DOM property: viewBox
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGRect> viewbox;
|
||||
rv = NS_NewSVGRect(getter_AddRefs(viewbox));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = NS_NewSVGAnimatedRect(getter_AddRefs(mViewBox), viewbox);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = AddMappedSVGValue(nsGkAtoms::viewBox, mViewBox);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
||||
|
@ -168,9 +144,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGMarkerElement)
|
|||
/* readonly attribute nsIDOMSVGAnimatedRect viewBox; */
|
||||
NS_IMETHODIMP nsSVGMarkerElement::GetViewBox(nsIDOMSVGAnimatedRect * *aViewBox)
|
||||
{
|
||||
*aViewBox = mViewBox;
|
||||
NS_ADDREF(*aViewBox);
|
||||
return NS_OK;
|
||||
return mViewBox.ToDOMAnimatedRect(aViewBox, this);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedPreserveAspectRatio preserveAspectRatio; */
|
||||
|
@ -247,17 +221,6 @@ NS_IMETHODIMP nsSVGMarkerElement::SetOrientToAngle(nsIDOMSVGAngle *angle)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGValueObserver methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGMarkerElement::DidModifySVGObservable(nsISVGValue* observable,
|
||||
nsISVGValue::modificationType aModType)
|
||||
{
|
||||
mViewBoxToViewportTransform = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIContent methods
|
||||
|
||||
|
@ -318,12 +281,9 @@ nsSVGMarkerElement::UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
|||
{
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aName == nsGkAtoms::viewBox && mCoordCtx) {
|
||||
nsCOMPtr<nsIDOMSVGRect> vb;
|
||||
mViewBox->GetAnimVal(getter_AddRefs(vb));
|
||||
vb->SetX(0);
|
||||
vb->SetY(0);
|
||||
vb->SetWidth(mLengthAttributes[MARKERWIDTH].GetAnimValue(mCoordCtx));
|
||||
vb->SetHeight(mLengthAttributes[MARKERHEIGHT].GetAnimValue(mCoordCtx));
|
||||
mViewBox.SetBaseValue(0, 0, mLengthAttributes[MARKERWIDTH].GetAnimValue(mCoordCtx),
|
||||
mLengthAttributes[MARKERHEIGHT].GetAnimValue(mCoordCtx),
|
||||
this, PR_FALSE);
|
||||
return nsGenericElement::UnsetAttr(aNamespaceID, aName, aNotify);
|
||||
} else if (aName == nsGkAtoms::orient) {
|
||||
mOrientType.SetBaseValue(SVG_MARKER_ORIENT_ANGLE);
|
||||
|
@ -345,13 +305,20 @@ nsSVGMarkerElement::DidChangeLength(PRUint8 aAttrEnum, PRBool aDoSetAttr)
|
|||
|
||||
if (mCoordCtx && !HasAttr(kNameSpaceID_None, nsGkAtoms::viewBox) &&
|
||||
(aAttrEnum == MARKERWIDTH || aAttrEnum == MARKERHEIGHT)) {
|
||||
nsCOMPtr<nsIDOMSVGRect> vb;
|
||||
mViewBox->GetAnimVal(getter_AddRefs(vb));
|
||||
vb->SetWidth(mLengthAttributes[MARKERWIDTH].GetAnimValue(mCoordCtx));
|
||||
vb->SetHeight(mLengthAttributes[MARKERHEIGHT].GetAnimValue(mCoordCtx));
|
||||
mViewBox.SetBaseValue(0, 0, mLengthAttributes[MARKERWIDTH].GetAnimValue(mCoordCtx),
|
||||
mLengthAttributes[MARKERHEIGHT].GetAnimValue(mCoordCtx),
|
||||
this, PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGMarkerElement::DidChangeViewBox(PRBool aDoSetAttr)
|
||||
{
|
||||
nsSVGMarkerElementBase::DidChangeViewBox(aDoSetAttr);
|
||||
|
||||
mViewBoxToViewportTransform = nsnull;
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGMarkerElement::DidChangePreserveAspectRatio(PRBool aDoSetAttr)
|
||||
{
|
||||
|
@ -367,10 +334,9 @@ nsSVGMarkerElement::SetParentCoordCtxProvider(nsSVGSVGElement *aContext)
|
|||
mViewBoxToViewportTransform = nsnull;
|
||||
|
||||
if (mCoordCtx && !HasAttr(kNameSpaceID_None, nsGkAtoms::viewBox)) {
|
||||
nsCOMPtr<nsIDOMSVGRect> vb;
|
||||
mViewBox->GetAnimVal(getter_AddRefs(vb));
|
||||
vb->SetWidth(mLengthAttributes[MARKERWIDTH].GetAnimValue(mCoordCtx));
|
||||
vb->SetHeight(mLengthAttributes[MARKERHEIGHT].GetAnimValue(mCoordCtx));
|
||||
mViewBox.SetBaseValue(0, 0, mLengthAttributes[MARKERWIDTH].GetAnimValue(mCoordCtx),
|
||||
mLengthAttributes[MARKERHEIGHT].GetAnimValue(mCoordCtx),
|
||||
this, PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -395,6 +361,12 @@ nsSVGMarkerElement::GetEnumInfo()
|
|||
NS_ARRAY_LENGTH(sEnumInfo));
|
||||
}
|
||||
|
||||
nsSVGViewBox *
|
||||
nsSVGMarkerElement::GetViewBox()
|
||||
{
|
||||
return &mViewBox;
|
||||
}
|
||||
|
||||
nsSVGPreserveAspectRatio *
|
||||
nsSVGMarkerElement::GetPreserveAspectRatio()
|
||||
{
|
||||
|
@ -439,30 +411,20 @@ nsSVGMarkerElement::GetViewboxToViewportTransform(nsIDOMSVGMatrix **_retval)
|
|||
mLengthAttributes[MARKERWIDTH].GetAnimValue(mCoordCtx);
|
||||
float viewportHeight =
|
||||
mLengthAttributes[MARKERHEIGHT].GetAnimValue(mCoordCtx);
|
||||
|
||||
float viewboxX, viewboxY, viewboxWidth, viewboxHeight;
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGRect> vb;
|
||||
mViewBox->GetAnimVal(getter_AddRefs(vb));
|
||||
NS_ASSERTION(vb, "could not get viewbox");
|
||||
vb->GetX(&viewboxX);
|
||||
vb->GetY(&viewboxY);
|
||||
vb->GetWidth(&viewboxWidth);
|
||||
vb->GetHeight(&viewboxHeight);
|
||||
}
|
||||
if (viewboxWidth <= 0.0f || viewboxHeight <= 0.0f) {
|
||||
|
||||
const nsSVGViewBoxRect& viewbox = mViewBox.GetAnimValue();
|
||||
|
||||
if (viewbox.width <= 0.0f || viewbox.height <= 0.0f) {
|
||||
return NS_ERROR_FAILURE; // invalid - don't paint element
|
||||
}
|
||||
|
||||
float refX =
|
||||
mLengthAttributes[REFX].GetAnimValue(mCoordCtx);
|
||||
float refY =
|
||||
mLengthAttributes[REFY].GetAnimValue(mCoordCtx);
|
||||
float refX = mLengthAttributes[REFX].GetAnimValue(mCoordCtx);
|
||||
float refY = mLengthAttributes[REFY].GetAnimValue(mCoordCtx);
|
||||
|
||||
nsCOMPtr<nsIDOMSVGMatrix> vb2vp =
|
||||
nsSVGUtils::GetViewBoxTransform(viewportWidth, viewportHeight,
|
||||
viewboxX, viewboxY,
|
||||
viewboxWidth, viewboxHeight,
|
||||
viewbox.x, viewbox.y,
|
||||
viewbox.width, viewbox.height,
|
||||
mPreserveAspectRatio,
|
||||
PR_TRUE);
|
||||
NS_ENSURE_TRUE(vb2vp, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "nsSVGLength2.h"
|
||||
#include "nsSVGEnum.h"
|
||||
#include "nsSVGAngle.h"
|
||||
#include "nsSVGViewBox.h"
|
||||
#include "nsSVGPreserveAspectRatio.h"
|
||||
|
||||
class nsSVGOrientType
|
||||
|
@ -103,7 +104,6 @@ protected:
|
|||
friend nsresult NS_NewSVGMarkerElement(nsIContent **aResult,
|
||||
nsINodeInfo *aNodeInfo);
|
||||
nsSVGMarkerElement(nsINodeInfo* aNodeInfo);
|
||||
nsresult Init();
|
||||
|
||||
public:
|
||||
// interfaces:
|
||||
|
@ -117,10 +117,6 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT(nsSVGElement::)
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGElement::)
|
||||
|
||||
// nsISVGValueObserver
|
||||
NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable,
|
||||
nsISVGValue::modificationType aModType);
|
||||
|
||||
// nsIContent interface
|
||||
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
|
||||
|
@ -131,6 +127,7 @@ public:
|
|||
|
||||
// nsSVGElement specializations:
|
||||
virtual void DidChangeLength(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||
virtual void DidChangeViewBox(PRBool aDoSetAttr);
|
||||
virtual void DidChangePreserveAspectRatio(PRBool aDoSetAttr);
|
||||
|
||||
// public helpers
|
||||
|
@ -152,6 +149,7 @@ protected:
|
|||
virtual LengthAttributesInfo GetLengthInfo();
|
||||
virtual AngleAttributesInfo GetAngleInfo();
|
||||
virtual EnumAttributesInfo GetEnumInfo();
|
||||
virtual nsSVGViewBox *GetViewBox();
|
||||
virtual nsSVGPreserveAspectRatio *GetPreserveAspectRatio();
|
||||
|
||||
enum { REFX, REFY, MARKERWIDTH, MARKERHEIGHT };
|
||||
|
@ -167,13 +165,13 @@ protected:
|
|||
nsSVGAngle mAngleAttributes[1];
|
||||
static AngleInfo sAngleInfo[1];
|
||||
|
||||
nsSVGViewBox mViewBox;
|
||||
nsSVGPreserveAspectRatio mPreserveAspectRatio;
|
||||
|
||||
// derived properties (from 'orient') handled separately
|
||||
nsSVGOrientType mOrientType;
|
||||
|
||||
nsSVGSVGElement *mCoordCtx;
|
||||
nsCOMPtr<nsIDOMSVGAnimatedRect> mViewBox;
|
||||
nsCOMPtr<nsIDOMSVGMatrix> mViewBoxToViewportTransform;
|
||||
};
|
||||
|
||||
|
|
|
@ -40,8 +40,6 @@
|
|||
#include "nsSVGAnimatedTransformList.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsSVGAnimatedRect.h"
|
||||
#include "nsSVGRect.h"
|
||||
#include "nsSVGMatrix.h"
|
||||
#include "nsSVGPatternElement.h"
|
||||
#include "nsIFrame.h"
|
||||
|
@ -117,19 +115,6 @@ nsSVGPatternElement::Init()
|
|||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
// nsIDOMSVGFitToViewBox properties
|
||||
|
||||
// DOM property: viewBox
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGRect> viewbox;
|
||||
rv = NS_NewSVGRect(getter_AddRefs(viewbox));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = NS_NewSVGAnimatedRect(getter_AddRefs(mViewBox), viewbox);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = AddMappedSVGValue(nsGkAtoms::viewBox, mViewBox);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -144,9 +129,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGPatternElement)
|
|||
/* readonly attribute nsIDOMSVGAnimatedRect viewBox; */
|
||||
NS_IMETHODIMP nsSVGPatternElement::GetViewBox(nsIDOMSVGAnimatedRect * *aViewBox)
|
||||
{
|
||||
*aViewBox = mViewBox;
|
||||
NS_ADDREF(*aViewBox);
|
||||
return NS_OK;
|
||||
return mViewBox.ToDOMAnimatedRect(aViewBox, this);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedPreserveAspectRatio preserveAspectRatio; */
|
||||
|
@ -253,6 +236,12 @@ nsSVGPatternElement::GetEnumInfo()
|
|||
NS_ARRAY_LENGTH(sEnumInfo));
|
||||
}
|
||||
|
||||
nsSVGViewBox *
|
||||
nsSVGPatternElement::GetViewBox()
|
||||
{
|
||||
return &mViewBox;
|
||||
}
|
||||
|
||||
nsSVGPreserveAspectRatio *
|
||||
nsSVGPatternElement::GetPreserveAspectRatio()
|
||||
{
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "nsSVGLength2.h"
|
||||
#include "nsSVGEnum.h"
|
||||
#include "nsSVGString.h"
|
||||
#include "nsSVGViewBox.h"
|
||||
#include "nsSVGPreserveAspectRatio.h"
|
||||
|
||||
//--------------------- Patterns ------------------------
|
||||
|
@ -93,6 +94,7 @@ protected:
|
|||
|
||||
virtual LengthAttributesInfo GetLengthInfo();
|
||||
virtual EnumAttributesInfo GetEnumInfo();
|
||||
virtual nsSVGViewBox *GetViewBox();
|
||||
virtual nsSVGPreserveAspectRatio *GetPreserveAspectRatio();
|
||||
virtual StringAttributesInfo GetStringInfo();
|
||||
|
||||
|
@ -113,7 +115,7 @@ protected:
|
|||
static StringInfo sStringInfo[1];
|
||||
|
||||
// nsIDOMSVGFitToViewbox properties
|
||||
nsCOMPtr<nsIDOMSVGAnimatedRect> mViewBox;
|
||||
nsSVGViewBox mViewBox;
|
||||
nsSVGPreserveAspectRatio mPreserveAspectRatio;
|
||||
};
|
||||
|
||||
|
|
|
@ -56,12 +56,6 @@ nsSVGRect::nsSVGRect(float x, float y, float w, float h)
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGRect::Clear()
|
||||
{
|
||||
mX = mY = mWidth = mHeight = 0.0f;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods:
|
||||
|
||||
|
@ -69,66 +63,11 @@ NS_IMPL_ADDREF(nsSVGRect)
|
|||
NS_IMPL_RELEASE(nsSVGRect)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGRect)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGRect)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGRect)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGValue methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGRect::SetValueString(const nsAString& aValue)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
char* str = ToNewCString(aValue);
|
||||
|
||||
char* rest = str;
|
||||
char* token;
|
||||
const char* delimiters = ",\x20\x9\xD\xA";
|
||||
|
||||
double vals[4];
|
||||
int i;
|
||||
for (i=0;i<4;++i) {
|
||||
if (!(token = nsCRT::strtok(rest, delimiters, &rest))) break; // parse error
|
||||
|
||||
char *end;
|
||||
vals[i] = PR_strtod(token, &end);
|
||||
if (*end != '\0') break; // parse error
|
||||
}
|
||||
if (i!=4 || (nsCRT::strtok(rest, delimiters, &rest)!=0)) {
|
||||
// there was a parse error.
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
else {
|
||||
WillModify();
|
||||
mX = float(vals[0]);
|
||||
mY = float(vals[1]);
|
||||
mWidth = float(vals[2]);
|
||||
mHeight = float(vals[3]);
|
||||
DidModify();
|
||||
}
|
||||
|
||||
nsMemory::Free(str);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGRect::GetValueString(nsAString& aValue)
|
||||
{
|
||||
PRUnichar buf[200];
|
||||
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar),
|
||||
NS_LITERAL_STRING("%g %g %g %g").get(),
|
||||
(double)mX, (double)mY,
|
||||
(double)mWidth, (double)mHeight);
|
||||
aValue.Assign(buf);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGRect methods:
|
||||
|
||||
|
@ -141,9 +80,7 @@ NS_IMETHODIMP nsSVGRect::GetX(float *aX)
|
|||
NS_IMETHODIMP nsSVGRect::SetX(float aX)
|
||||
{
|
||||
NS_ENSURE_FINITE(aX, NS_ERROR_ILLEGAL_VALUE);
|
||||
WillModify();
|
||||
mX = aX;
|
||||
DidModify();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -156,9 +93,7 @@ NS_IMETHODIMP nsSVGRect::GetY(float *aY)
|
|||
NS_IMETHODIMP nsSVGRect::SetY(float aY)
|
||||
{
|
||||
NS_ENSURE_FINITE(aY, NS_ERROR_ILLEGAL_VALUE);
|
||||
WillModify();
|
||||
mY = aY;
|
||||
DidModify();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -171,9 +106,7 @@ NS_IMETHODIMP nsSVGRect::GetWidth(float *aWidth)
|
|||
NS_IMETHODIMP nsSVGRect::SetWidth(float aWidth)
|
||||
{
|
||||
NS_ENSURE_FINITE(aWidth, NS_ERROR_ILLEGAL_VALUE);
|
||||
WillModify();
|
||||
mWidth = aWidth;
|
||||
DidModify();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -186,36 +119,12 @@ NS_IMETHODIMP nsSVGRect::GetHeight(float *aHeight)
|
|||
NS_IMETHODIMP nsSVGRect::SetHeight(float aHeight)
|
||||
{
|
||||
NS_ENSURE_FINITE(aHeight, NS_ERROR_ILLEGAL_VALUE);
|
||||
WillModify();
|
||||
mHeight = aHeight;
|
||||
DidModify();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Implement a readonly version of SVGRect
|
||||
//
|
||||
// We need this because attributes of some SVG interfaces *and* the objects the
|
||||
// attributes refer to (including SVGRects) are supposed to be readonly
|
||||
|
||||
class nsSVGReadonlyRect : public nsSVGRect
|
||||
{
|
||||
public:
|
||||
nsSVGReadonlyRect(float x, float y, float width, float height)
|
||||
: nsSVGRect(x, y, width, height)
|
||||
{
|
||||
}
|
||||
|
||||
// override setters to make the whole object readonly
|
||||
NS_IMETHODIMP SetX(float) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
|
||||
NS_IMETHODIMP SetY(float) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
|
||||
NS_IMETHODIMP SetWidth(float) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
|
||||
NS_IMETHODIMP SetHeight(float) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
|
||||
NS_IMETHODIMP SetValueString(const nsAString&) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Exported creation functions:
|
||||
|
||||
|
@ -237,13 +146,3 @@ NS_NewSVGRect(nsIDOMSVGRect** result, const gfxRect& rect)
|
|||
rect.Width(), rect.Height());
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewSVGReadonlyRect(nsIDOMSVGRect** result, float x, float y,
|
||||
float width, float height)
|
||||
{
|
||||
*result = new nsSVGReadonlyRect(x, y, width, height);
|
||||
if (!*result) return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,16 +52,10 @@ NS_NewSVGRect(nsIDOMSVGRect** result,
|
|||
nsresult
|
||||
NS_NewSVGRect(nsIDOMSVGRect** result, const gfxRect& rect);
|
||||
|
||||
nsresult
|
||||
NS_NewSVGReadonlyRect(nsIDOMSVGRect** result,
|
||||
float x=0.0f, float y=0.0f,
|
||||
float width=0.0f, float height=0.0f);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsSVGRect class
|
||||
|
||||
class nsSVGRect : public nsIDOMSVGRect,
|
||||
public nsSVGValue
|
||||
class nsSVGRect : public nsIDOMSVGRect
|
||||
{
|
||||
public:
|
||||
nsSVGRect(float x=0.0f, float y=0.0f, float w=0.0f, float h=0.0f);
|
||||
|
@ -72,12 +66,6 @@ public:
|
|||
// nsIDOMSVGRect interface:
|
||||
NS_DECL_NSIDOMSVGRECT
|
||||
|
||||
// nsISVGValue interface:
|
||||
NS_IMETHOD SetValueString(const nsAString& aValue);
|
||||
NS_IMETHOD GetValueString(nsAString& aValue);
|
||||
|
||||
void Clear();
|
||||
|
||||
protected:
|
||||
float mX, mY, mWidth, mHeight;
|
||||
};
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "nsContentUtils.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsSVGAnimatedRect.h"
|
||||
#include "nsSVGMatrix.h"
|
||||
#include "nsSVGPoint.h"
|
||||
#include "nsSVGTransform.h"
|
||||
|
@ -56,7 +55,6 @@
|
|||
#include "nsISVGSVGFrame.h" //XXX
|
||||
#include "nsSVGNumber.h"
|
||||
#include "nsSVGRect.h"
|
||||
#include "nsSVGPreserveAspectRatio.h"
|
||||
#include "nsISVGValueUtils.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsISVGChildFrame.h"
|
||||
|
@ -154,33 +152,12 @@ nsSVGSVGElement::nsSVGSVGElement(nsINodeInfo* aNodeInfo, PRBool aFromParser)
|
|||
{
|
||||
}
|
||||
|
||||
nsSVGSVGElement::~nsSVGSVGElement()
|
||||
{
|
||||
if (mViewBox) {
|
||||
NS_REMOVE_SVGVALUE_OBSERVER(mViewBox);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsSVGSVGElement::Init()
|
||||
{
|
||||
nsresult rv = nsSVGSVGElementBase::Init();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// nsIDOMSVGFitToViewBox attributes ------:
|
||||
|
||||
// DOM property: viewBox , #IMPLIED attrib: viewBox
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGRect> viewbox;
|
||||
rv = NS_NewSVGRect(getter_AddRefs(viewbox));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = NS_NewSVGAnimatedRect(getter_AddRefs(mViewBox), viewbox);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = AddMappedSVGValue(nsGkAtoms::viewBox, mViewBox);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
// DOM property: currentScale
|
||||
{
|
||||
rv = NS_NewSVGNumber(getter_AddRefs(mCurrentScale), 1.0f);
|
||||
|
@ -728,9 +705,7 @@ nsSVGSVGElement::GetElementById(const nsAString & elementId, nsIDOMElement **_re
|
|||
NS_IMETHODIMP
|
||||
nsSVGSVGElement::GetViewBox(nsIDOMSVGAnimatedRect * *aViewBox)
|
||||
{
|
||||
*aViewBox = mViewBox;
|
||||
NS_ADDREF(*aViewBox);
|
||||
return NS_OK;
|
||||
return mViewBox.ToDOMAnimatedRect(aViewBox, this);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedPreserveAspectRatio preserveAspectRatio; */
|
||||
|
@ -1196,36 +1171,6 @@ nsSVGSVGElement::IsAttributeMapped(const nsIAtom* name) const
|
|||
nsSVGSVGElementBase::IsAttributeMapped(name);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGSVGElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
const nsAString* aValue, PRBool aNotify)
|
||||
{
|
||||
nsSVGSVGElementBase::AfterSetAttr(aNameSpaceID, aName, aValue, aNotify);
|
||||
|
||||
// We need to do this here because the calling
|
||||
// InvalidateTransformNotifyFrame in DidModifySVGObservable would
|
||||
// happen too early, before HasAttr(viewBox) returns true (important
|
||||
// in the case of adding a viewBox)
|
||||
if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::viewBox) {
|
||||
InvalidateTransformNotifyFrame();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGSVGElement::UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||
PRBool aNotify)
|
||||
{
|
||||
nsSVGSVGElementBase::UnsetAttr(aNamespaceID, aName, aNotify);
|
||||
|
||||
if (aNamespaceID == kNameSpaceID_None && aName == nsGkAtoms::viewBox) {
|
||||
InvalidateTransformNotifyFrame();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIContent methods:
|
||||
|
||||
|
@ -1291,8 +1236,7 @@ nsSVGSVGElement::DidModifySVGObservable (nsISVGValue* observable,
|
|||
else {
|
||||
return NS_OK; // we don't care about currentScale changes on non-root
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
nsCOMPtr<nsIDOMSVGPoint> p = do_QueryInterface(observable);
|
||||
if (p && p==mCurrentTranslate) {
|
||||
if (mDispatchEvent && IsRoot()) {
|
||||
|
@ -1307,11 +1251,7 @@ nsSVGSVGElement::DidModifySVGObservable (nsISVGValue* observable,
|
|||
}
|
||||
}
|
||||
|
||||
// Deal with viewBox in AfterSetAttr (see comment there for reason)
|
||||
nsCOMPtr<nsIDOMSVGAnimatedRect> r = do_QueryInterface(observable);
|
||||
if (r != mViewBox) {
|
||||
InvalidateTransformNotifyFrame();
|
||||
}
|
||||
InvalidateTransformNotifyFrame();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1351,29 +1291,23 @@ nsSVGSVGElement::GetViewboxToViewportTransform(nsIDOMSVGMatrix **_retval)
|
|||
viewportHeight = mLengthAttributes[HEIGHT].GetAnimValue(ctx);
|
||||
}
|
||||
|
||||
float viewboxX, viewboxY, viewboxWidth, viewboxHeight;
|
||||
nsSVGViewBoxRect viewbox;
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::viewBox)) {
|
||||
nsCOMPtr<nsIDOMSVGRect> vb;
|
||||
mViewBox->GetAnimVal(getter_AddRefs(vb));
|
||||
NS_ASSERTION(vb, "could not get viewbox");
|
||||
vb->GetX(&viewboxX);
|
||||
vb->GetY(&viewboxY);
|
||||
vb->GetWidth(&viewboxWidth);
|
||||
vb->GetHeight(&viewboxHeight);
|
||||
viewbox = mViewBox.GetAnimValue();
|
||||
} else {
|
||||
viewboxX = viewboxY = 0.0f;
|
||||
viewboxWidth = viewportWidth;
|
||||
viewboxHeight = viewportHeight;
|
||||
viewbox.x = viewbox.y = 0.0f;
|
||||
viewbox.width = viewportWidth;
|
||||
viewbox.height = viewportHeight;
|
||||
}
|
||||
|
||||
if (viewboxWidth <= 0.0f || viewboxHeight <= 0.0f) {
|
||||
if (viewbox.width <= 0.0f || viewbox.height <= 0.0f) {
|
||||
return NS_ERROR_FAILURE; // invalid - don't paint element
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMSVGMatrix> xform =
|
||||
nsSVGUtils::GetViewBoxTransform(viewportWidth, viewportHeight,
|
||||
viewboxX, viewboxY,
|
||||
viewboxWidth, viewboxHeight,
|
||||
viewbox.x, viewbox.y,
|
||||
viewbox.width, viewbox.height,
|
||||
mPreserveAspectRatio);
|
||||
xform.swap(*_retval);
|
||||
|
||||
|
@ -1522,45 +1456,15 @@ nsSVGSVGElement::InvalidateTransformNotifyFrame()
|
|||
//----------------------------------------------------------------------
|
||||
// nsSVGSVGElement
|
||||
|
||||
already_AddRefed<nsIDOMSVGRect>
|
||||
nsSVGSVGElement::GetCtxRect()
|
||||
{
|
||||
float w, h;
|
||||
nsCOMPtr<nsIDOMSVGRect> vb;
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::viewBox)) {
|
||||
mViewBox->GetAnimVal(getter_AddRefs(vb));
|
||||
vb->GetWidth(&w);
|
||||
vb->GetHeight(&h);
|
||||
} else {
|
||||
nsSVGSVGElement *ctx = GetCtx();
|
||||
if (ctx) {
|
||||
w = mLengthAttributes[WIDTH].GetAnimValue(ctx);
|
||||
h = mLengthAttributes[HEIGHT].GetAnimValue(ctx);
|
||||
} else {
|
||||
w = mViewportWidth;
|
||||
h = mViewportHeight;
|
||||
}
|
||||
}
|
||||
|
||||
if (!vb || w < 0.0f || h < 0.0f) {
|
||||
NS_NewSVGRect(getter_AddRefs(vb), 0, 0, PR_MAX(w, 0.0f), PR_MAX(h, 0.0f));
|
||||
}
|
||||
|
||||
nsIDOMSVGRect *retval = nsnull;
|
||||
vb.swap(retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
float
|
||||
nsSVGSVGElement::GetLength(PRUint8 aCtxType)
|
||||
{
|
||||
float h, w;
|
||||
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::viewBox)) {
|
||||
nsCOMPtr<nsIDOMSVGRect> vb;
|
||||
mViewBox->GetAnimVal(getter_AddRefs(vb));
|
||||
vb->GetHeight(&h);
|
||||
vb->GetWidth(&w);
|
||||
const nsSVGViewBoxRect& viewbox = mViewBox.GetAnimValue();
|
||||
w = viewbox.width;
|
||||
h = viewbox.height;
|
||||
} else {
|
||||
nsSVGSVGElement *ctx = GetCtx();
|
||||
if (ctx) {
|
||||
|
@ -1572,12 +1476,8 @@ nsSVGSVGElement::GetLength(PRUint8 aCtxType)
|
|||
}
|
||||
}
|
||||
|
||||
if (w < 0.0f) {
|
||||
w = 0.0f;
|
||||
}
|
||||
if (h < 0.0f) {
|
||||
h = 0.0f;
|
||||
}
|
||||
w = PR_MAX(w, 0.0f);
|
||||
h = PR_MAX(h, 0.0f);
|
||||
|
||||
switch (aCtxType) {
|
||||
case nsSVGUtils::X:
|
||||
|
@ -1632,6 +1532,20 @@ nsSVGSVGElement::GetEnumInfo()
|
|||
NS_ARRAY_LENGTH(sEnumInfo));
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGSVGElement::DidChangeViewBox(PRBool aDoSetAttr)
|
||||
{
|
||||
nsSVGSVGElementBase::DidChangeViewBox(aDoSetAttr);
|
||||
|
||||
InvalidateTransformNotifyFrame();
|
||||
}
|
||||
|
||||
nsSVGViewBox *
|
||||
nsSVGSVGElement::GetViewBox()
|
||||
{
|
||||
return &mViewBox;
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGSVGElement::DidChangePreserveAspectRatio(PRBool aDoSetAttr)
|
||||
{
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include "nsIDOMSVGMatrix.h"
|
||||
#include "nsSVGLength2.h"
|
||||
#include "nsSVGEnum.h"
|
||||
#include "nsSVGViewBox.h"
|
||||
#include "nsSVGPreserveAspectRatio.h"
|
||||
|
||||
#ifdef MOZ_SMIL
|
||||
|
@ -87,7 +88,6 @@ protected:
|
|||
nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser);
|
||||
nsSVGSVGElement(nsINodeInfo* aNodeInfo, PRBool aFromParser);
|
||||
virtual ~nsSVGSVGElement();
|
||||
nsresult Init();
|
||||
|
||||
public:
|
||||
|
@ -145,11 +145,6 @@ public:
|
|||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
|
||||
#endif // MOZ_SMIL
|
||||
|
||||
virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
const nsAString* aValue, PRBool aNotify);
|
||||
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||
PRBool aNotify);
|
||||
|
||||
// nsISVGValueObserver
|
||||
NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable,
|
||||
nsISVGValue::modificationType aModType);
|
||||
|
@ -159,23 +154,23 @@ public:
|
|||
// nsSVGElement specializations:
|
||||
virtual void DidChangeLength(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||
virtual void DidChangeEnum(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||
virtual void DidChangeViewBox(PRBool aDoSetAttr);
|
||||
virtual void DidChangePreserveAspectRatio(PRBool aDoSetAttr);
|
||||
|
||||
// nsSVGSVGElement methods:
|
||||
float GetLength(PRUint8 mCtxType);
|
||||
float GetMMPerPx(PRUint8 mCtxType = 0);
|
||||
already_AddRefed<nsIDOMSVGRect> GetCtxRect();
|
||||
|
||||
// public helpers:
|
||||
nsresult GetViewboxToViewportTransform(nsIDOMSVGMatrix **_retval);
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
svgFloatSize GetViewportSize() {
|
||||
svgFloatSize GetViewportSize() const {
|
||||
return svgFloatSize(mViewportWidth, mViewportHeight);
|
||||
}
|
||||
|
||||
void SetViewportSize(svgFloatSize& aSize) {
|
||||
void SetViewportSize(const svgFloatSize& aSize) {
|
||||
mViewportWidth = aSize.width;
|
||||
mViewportHeight = aSize.height;
|
||||
}
|
||||
|
@ -231,12 +226,13 @@ protected:
|
|||
static nsSVGEnumMapping sZoomAndPanMap[];
|
||||
static EnumInfo sEnumInfo[1];
|
||||
|
||||
virtual nsSVGViewBox *GetViewBox();
|
||||
virtual nsSVGPreserveAspectRatio *GetPreserveAspectRatio();
|
||||
|
||||
nsSVGViewBox mViewBox;
|
||||
nsSVGPreserveAspectRatio mPreserveAspectRatio;
|
||||
|
||||
nsSVGSVGElement *mCoordCtx;
|
||||
nsCOMPtr<nsIDOMSVGAnimatedRect> mViewBox;
|
||||
|
||||
// The size of the rectangular SVG viewport into which we render. This is
|
||||
// not (necessarily) the same as the content area. See:
|
||||
|
|
|
@ -36,12 +36,9 @@
|
|||
|
||||
#include "nsIDOMSVGSymbolElement.h"
|
||||
#include "nsSVGStylableElement.h"
|
||||
#include "nsSVGViewBox.h"
|
||||
#include "nsSVGPreserveAspectRatio.h"
|
||||
#include "nsIDOMSVGRect.h"
|
||||
#include "nsIDOMSVGLength.h"
|
||||
#include "nsIDOMSVGFitToViewBox.h"
|
||||
#include "nsSVGRect.h"
|
||||
#include "nsSVGAnimatedRect.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
||||
typedef nsSVGStylableElement nsSVGSymbolElementBase;
|
||||
|
@ -54,7 +51,6 @@ protected:
|
|||
friend nsresult NS_NewSVGSymbolElement(nsIContent **aResult,
|
||||
nsINodeInfo *aNodeInfo);
|
||||
nsSVGSymbolElement(nsINodeInfo* aNodeInfo);
|
||||
nsresult Init();
|
||||
|
||||
public:
|
||||
// interfaces:
|
||||
|
@ -74,9 +70,10 @@ public:
|
|||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
protected:
|
||||
virtual nsSVGViewBox *GetViewBox();
|
||||
virtual nsSVGPreserveAspectRatio *GetPreserveAspectRatio();
|
||||
|
||||
nsCOMPtr<nsIDOMSVGAnimatedRect> mViewBox;
|
||||
nsSVGViewBox mViewBox;
|
||||
nsSVGPreserveAspectRatio mPreserveAspectRatio;
|
||||
};
|
||||
|
||||
|
@ -104,27 +101,6 @@ nsSVGSymbolElement::nsSVGSymbolElement(nsINodeInfo *aNodeInfo)
|
|||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsSVGSymbolElement::Init()
|
||||
{
|
||||
nsresult rv = nsSVGSymbolElementBase::Init();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
|
||||
// DOM property: viewBox
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGRect> viewbox;
|
||||
rv = NS_NewSVGRect(getter_AddRefs(viewbox));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = NS_NewSVGAnimatedRect(getter_AddRefs(mViewBox), viewbox);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = AddMappedSVGValue(nsGkAtoms::viewBox, mViewBox);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
||||
|
@ -136,9 +112,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGSymbolElement)
|
|||
/* readonly attribute nsIDOMSVGAnimatedRect viewBox; */
|
||||
NS_IMETHODIMP nsSVGSymbolElement::GetViewBox(nsIDOMSVGAnimatedRect * *aViewBox)
|
||||
{
|
||||
*aViewBox = mViewBox;
|
||||
NS_ADDREF(*aViewBox);
|
||||
return NS_OK;
|
||||
return mViewBox.ToDOMAnimatedRect(aViewBox, this);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedPreserveAspectRatio preserveAspectRatio; */
|
||||
|
@ -176,6 +150,12 @@ nsSVGSymbolElement::IsAttributeMapped(const nsIAtom* name) const
|
|||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
nsSVGViewBox *
|
||||
nsSVGSymbolElement::GetViewBox()
|
||||
{
|
||||
return &mViewBox;
|
||||
}
|
||||
|
||||
nsSVGPreserveAspectRatio *
|
||||
nsSVGSymbolElement::GetPreserveAspectRatio()
|
||||
{
|
||||
|
|
|
@ -0,0 +1,223 @@
|
|||
/* -*- 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 Mozilla SVG Project code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Jonathan Watt.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jonathan Watt <jonathan.watt@strath.ac.uk> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 ***** */
|
||||
|
||||
#include "nsSVGViewBox.h"
|
||||
#include "prdtoa.h"
|
||||
#include "nsTextFormatter.h"
|
||||
|
||||
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGViewBox::DOMBaseVal, mSVGElement)
|
||||
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGViewBox::DOMAnimVal, mSVGElement)
|
||||
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGViewBox::DOMAnimatedRect, mSVGElement)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGViewBox::DOMBaseVal)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGViewBox::DOMBaseVal)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGViewBox::DOMAnimVal)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGViewBox::DOMAnimVal)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGViewBox::DOMAnimatedRect)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGViewBox::DOMAnimatedRect)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGViewBox::DOMBaseVal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGRect)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGRect)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGViewBox::DOMAnimVal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGRect)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGRect)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGViewBox::DOMAnimatedRect)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedRect)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAnimatedRect)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
/* Implementation */
|
||||
|
||||
void
|
||||
nsSVGViewBox::Init()
|
||||
{
|
||||
mBaseVal = nsSVGViewBoxRect();
|
||||
mAnimVal = nsnull;
|
||||
}
|
||||
|
||||
const nsSVGViewBoxRect&
|
||||
nsSVGViewBox::GetAnimValue() const
|
||||
{
|
||||
if (mAnimVal)
|
||||
return *mAnimVal;
|
||||
|
||||
return mBaseVal;
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGViewBox::SetBaseValue(float aX, float aY, float aWidth, float aHeight,
|
||||
nsSVGElement *aSVGElement, PRBool aDoSetAttr)
|
||||
{
|
||||
mAnimVal = nsnull;
|
||||
mBaseVal.x = aX;
|
||||
mBaseVal.y = aY;
|
||||
mBaseVal.width = aWidth;
|
||||
mBaseVal.height = aHeight;
|
||||
|
||||
aSVGElement->DidChangeViewBox(aDoSetAttr);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGViewBox::SetBaseValueString(const nsAString& aValue,
|
||||
nsSVGElement *aSVGElement,
|
||||
PRBool aDoSetAttr)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
char *str = ToNewUTF8String(aValue);
|
||||
|
||||
char *rest = str;
|
||||
char *token;
|
||||
const char *delimiters = ",\x20\x9\xD\xA";
|
||||
|
||||
float vals[4];
|
||||
int i;
|
||||
for (i=0;i<4;++i) {
|
||||
if (!(token = nsCRT::strtok(rest, delimiters, &rest))) break; // parse error
|
||||
|
||||
char *end;
|
||||
vals[i] = (float)PR_strtod(token, &end);
|
||||
if (*end != '\0') break; // parse error
|
||||
}
|
||||
if (i!=4 || (nsCRT::strtok(rest, delimiters, &rest)!=0)) {
|
||||
// there was a parse error.
|
||||
rv = NS_ERROR_FAILURE;
|
||||
} else {
|
||||
mAnimVal = nsnull;
|
||||
mBaseVal.x = vals[0];
|
||||
mBaseVal.y = vals[1];
|
||||
mBaseVal.width = vals[2];
|
||||
mBaseVal.height = vals[3];
|
||||
}
|
||||
|
||||
nsMemory::Free(str);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGViewBox::GetBaseValueString(nsAString& aValue) const
|
||||
{
|
||||
PRUnichar buf[200];
|
||||
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar),
|
||||
NS_LITERAL_STRING("%g %g %g %g").get(),
|
||||
(double)mBaseVal.x, (double)mBaseVal.y,
|
||||
(double)mBaseVal.width, (double)mBaseVal.height);
|
||||
aValue.Assign(buf);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGViewBox::ToDOMAnimatedRect(nsIDOMSVGAnimatedRect **aResult,
|
||||
nsSVGElement* aSVGElement)
|
||||
{
|
||||
*aResult = new DOMAnimatedRect(this, aSVGElement);
|
||||
NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGViewBox::DOMAnimatedRect::GetBaseVal(nsIDOMSVGRect **aResult)
|
||||
{
|
||||
*aResult = new nsSVGViewBox::DOMBaseVal(mVal, mSVGElement);
|
||||
NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGViewBox::DOMAnimatedRect::GetAnimVal(nsIDOMSVGRect **aResult)
|
||||
{
|
||||
*aResult = new nsSVGViewBox::DOMAnimVal(mVal, mSVGElement);
|
||||
NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGViewBox::DOMBaseVal::SetX(float aX)
|
||||
{
|
||||
nsSVGViewBoxRect rect = mVal->GetBaseValue();
|
||||
rect.x = aX;
|
||||
mVal->SetBaseValue(rect.x, rect.y, rect.width, rect.height,
|
||||
mSVGElement, PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGViewBox::DOMBaseVal::SetY(float aY)
|
||||
{
|
||||
nsSVGViewBoxRect rect = mVal->GetBaseValue();
|
||||
rect.y = aY;
|
||||
mVal->SetBaseValue(rect.x, rect.y, rect.width, rect.height,
|
||||
mSVGElement, PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGViewBox::DOMBaseVal::SetWidth(float aWidth)
|
||||
{
|
||||
nsSVGViewBoxRect rect = mVal->GetBaseValue();
|
||||
rect.width = aWidth;
|
||||
mVal->SetBaseValue(rect.x, rect.y, rect.width, rect.height,
|
||||
mSVGElement, PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGViewBox::DOMBaseVal::SetHeight(float aHeight)
|
||||
{
|
||||
nsSVGViewBoxRect rect = mVal->GetBaseValue();
|
||||
rect.height = aHeight;
|
||||
mVal->SetBaseValue(rect.x, rect.y, rect.width, rect.height,
|
||||
mSVGElement, PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
/* -*- 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 Mozilla SVG Project code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Jonathan Watt.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jonathan Watt <jonathan.watt@strath.ac.uk> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 ***** */
|
||||
|
||||
#ifndef __NS_SVGVIEWBOX_H__
|
||||
#define __NS_SVGVIEWBOX_H__
|
||||
|
||||
#include "nsIDOMSVGRect.h"
|
||||
#include "nsIDOMSVGAnimatedRect.h"
|
||||
#include "nsSVGElement.h"
|
||||
#include "nsDOMError.h"
|
||||
|
||||
struct nsSVGViewBoxRect
|
||||
{
|
||||
float x, y;
|
||||
float width, height;
|
||||
|
||||
nsSVGViewBoxRect() : x(0), y(0), width(0), height(0) {}
|
||||
nsSVGViewBoxRect(float aX, float aY, float aWidth, float aHeight) :
|
||||
x(aX), y(aY), width(aWidth), height(aHeight) {}
|
||||
};
|
||||
|
||||
class nsSVGViewBox
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
void Init();
|
||||
|
||||
const nsSVGViewBoxRect& GetBaseValue() const
|
||||
{ return mBaseVal; }
|
||||
void SetBaseValue(float aX, float aY, float aWidth, float aHeight,
|
||||
nsSVGElement *aSVGElement, PRBool aDoSetAttr);
|
||||
|
||||
const nsSVGViewBoxRect& GetAnimValue() const;
|
||||
|
||||
nsresult SetBaseValueString(const nsAString& aValue,
|
||||
nsSVGElement *aSVGElement,
|
||||
PRBool aDoSetAttr);
|
||||
void GetBaseValueString(nsAString& aValue) const;
|
||||
|
||||
nsresult ToDOMAnimatedRect(nsIDOMSVGAnimatedRect **aResult,
|
||||
nsSVGElement *aSVGElement);
|
||||
|
||||
private:
|
||||
|
||||
nsSVGViewBoxRect mBaseVal;
|
||||
nsAutoPtr<nsSVGViewBoxRect> mAnimVal;
|
||||
|
||||
struct DOMBaseVal : public nsIDOMSVGRect
|
||||
{
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(DOMBaseVal)
|
||||
|
||||
DOMBaseVal(nsSVGViewBox *aVal, nsSVGElement *aSVGElement)
|
||||
: mVal(aVal), mSVGElement(aSVGElement) {}
|
||||
|
||||
nsSVGViewBox* mVal; // kept alive because it belongs to content
|
||||
nsRefPtr<nsSVGElement> mSVGElement;
|
||||
|
||||
NS_IMETHOD GetX(float *aX)
|
||||
{ *aX = mVal->GetBaseValue().x; return NS_OK; }
|
||||
NS_IMETHOD GetY(float *aY)
|
||||
{ *aY = mVal->GetBaseValue().y; return NS_OK; }
|
||||
NS_IMETHOD GetWidth(float *aWidth)
|
||||
{ *aWidth = mVal->GetBaseValue().width; return NS_OK; }
|
||||
NS_IMETHOD GetHeight(float *aHeight)
|
||||
{ *aHeight = mVal->GetBaseValue().height; return NS_OK; }
|
||||
|
||||
NS_IMETHOD SetX(float aX);
|
||||
NS_IMETHOD SetY(float aY);
|
||||
NS_IMETHOD SetWidth(float aWidth);
|
||||
NS_IMETHOD SetHeight(float aHeight);
|
||||
};
|
||||
|
||||
struct DOMAnimVal : public nsIDOMSVGRect
|
||||
{
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimVal)
|
||||
|
||||
DOMAnimVal(nsSVGViewBox *aVal, nsSVGElement *aSVGElement)
|
||||
: mVal(aVal), mSVGElement(aSVGElement) {}
|
||||
|
||||
nsSVGViewBox* mVal; // kept alive because it belongs to content
|
||||
nsRefPtr<nsSVGElement> mSVGElement;
|
||||
|
||||
NS_IMETHOD GetX(float *aX)
|
||||
{ *aX = mVal->GetAnimValue().x; return NS_OK; }
|
||||
NS_IMETHOD GetY(float *aY)
|
||||
{ *aY = mVal->GetAnimValue().y; return NS_OK; }
|
||||
NS_IMETHOD GetWidth(float *aWidth)
|
||||
{ *aWidth = mVal->GetAnimValue().width; return NS_OK; }
|
||||
NS_IMETHOD GetHeight(float *aHeight)
|
||||
{ *aHeight = mVal->GetAnimValue().height; return NS_OK; }
|
||||
|
||||
NS_IMETHOD SetX(float aX)
|
||||
{ return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
|
||||
NS_IMETHOD SetY(float aY)
|
||||
{ return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
|
||||
NS_IMETHOD SetWidth(float aWidth)
|
||||
{ return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
|
||||
NS_IMETHOD SetHeight(float aHeight)
|
||||
{ return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
|
||||
};
|
||||
|
||||
struct DOMAnimatedRect : public nsIDOMSVGAnimatedRect
|
||||
{
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedRect)
|
||||
|
||||
DOMAnimatedRect(nsSVGViewBox *aVal, nsSVGElement *aSVGElement)
|
||||
: mVal(aVal), mSVGElement(aSVGElement) {}
|
||||
|
||||
nsSVGViewBox* mVal; // kept alive because it belongs to content
|
||||
nsRefPtr<nsSVGElement> mSVGElement;
|
||||
|
||||
NS_IMETHOD GetBaseVal(nsIDOMSVGRect **aResult);
|
||||
NS_IMETHOD GetAnimVal(nsIDOMSVGRect **aResult);
|
||||
};
|
||||
};
|
||||
|
||||
#endif // __NS_SVGVIEWBOX_H__
|
|
@ -142,6 +142,44 @@ function runTests()
|
|||
is(basePreserveAspectRatio.meetOrSlice, 2, "preserveAspectRatio.meetOrSlice baseVal");
|
||||
is(animPreserveAspectRatio.meetOrSlice, 2, "preserveAspectRatio.meetOrSlice animVal");
|
||||
|
||||
// viewBox attribute
|
||||
var baseViewBox = marker.viewBox.baseVal;
|
||||
var animViewBox = marker.viewBox.animVal;
|
||||
is(baseViewBox.x, 0, "viewBox baseVal");
|
||||
is(animViewBox.x, 0, "viewBox baseVal");
|
||||
is(baseViewBox.y, 0, "viewBox baseVal");
|
||||
is(animViewBox.y, 0, "viewBox baseVal");
|
||||
is(baseViewBox.width, 0, "viewBox baseVal");
|
||||
is(animViewBox.width, 0, "viewBox baseVal");
|
||||
is(baseViewBox.height, 0, "viewBox baseVal");
|
||||
is(animViewBox.height, 0, "viewBox baseVal");
|
||||
baseViewBox.x = 10;
|
||||
baseViewBox.y = 11;
|
||||
baseViewBox.width = 12;
|
||||
baseViewBox.height = 13;
|
||||
is(marker.getAttribute("viewBox"), "10 11 12 13", "viewBox attribute");
|
||||
|
||||
marker.setAttribute("viewBox", "1 2 3 4");
|
||||
is(marker.viewBox.baseVal.x, 1, "viewBox.x baseVal");
|
||||
is(marker.viewBox.animVal.x, 1, "viewBox.x animVal");
|
||||
is(marker.viewBox.baseVal.y, 2, "viewbox.y baseVal");
|
||||
is(marker.viewBox.animVal.y, 2, "viewbox.y animVal");
|
||||
is(marker.viewBox.baseVal.width, 3, "viewbox.width baseVal");
|
||||
is(marker.viewBox.animVal.width, 3, "viewbox.width animVal");
|
||||
is(marker.viewBox.baseVal.height, 4, "viewbox.heigth baseVal");
|
||||
is(marker.viewBox.animVal.height, 4, "viewbox.heigth animVal");
|
||||
marker.viewBox.baseVal.x = 5;
|
||||
is(marker.viewBox.animVal.x, 5, "viewBox.x animVal");
|
||||
marker.viewBox.baseVal.y = 6;
|
||||
is(marker.viewBox.animVal.y, 6, "viewBox.y animVal");
|
||||
marker.viewBox.baseVal.width = 7;
|
||||
is(marker.viewBox.animVal.width, 7, "viewBox.width animVal");
|
||||
marker.viewBox.baseVal.height = 8;
|
||||
is(marker.viewBox.animVal.height, 8, "viewBox.height animVal");
|
||||
is(marker.getAttribute("viewBox"), "5 6 7 8", "viewBox attribute");
|
||||
marker.removeAttribute("viewBox");
|
||||
is(marker.hasAttribute("viewBox"), false, "viewBox hasAttribute");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -425,7 +425,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsBindingManager)
|
|||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSTARRAY_MEMBER(mAttachedStack,
|
||||
nsXBLBinding)
|
||||
// No need to traverse mProcessAttachedQueueEvent, since it'll just
|
||||
// fire at some point.
|
||||
// fire at some point or become revoke and drop its ref to us.
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsBindingManager)
|
||||
|
@ -965,8 +965,7 @@ void
|
|||
nsBindingManager::PostProcessAttachedQueueEvent()
|
||||
{
|
||||
mProcessAttachedQueueEvent =
|
||||
new nsRunnableMethod<nsBindingManager>(
|
||||
this, &nsBindingManager::DoProcessAttachedQueue);
|
||||
NS_NEW_RUNNABLE_METHOD(nsBindingManager, this, DoProcessAttachedQueue);
|
||||
nsresult rv = NS_DispatchToCurrentThread(mProcessAttachedQueueEvent);
|
||||
if (NS_SUCCEEDED(rv) && mDocument) {
|
||||
mDocument->BlockOnload();
|
||||
|
@ -1555,6 +1554,9 @@ nsBindingManager::DropDocumentReference()
|
|||
{
|
||||
// Make sure to not run any more XBL constructors
|
||||
mProcessingAttachedStack = PR_TRUE;
|
||||
if (mProcessAttachedQueueEvent) {
|
||||
mProcessAttachedQueueEvent->Revoke();
|
||||
}
|
||||
mDocument = nsnull;
|
||||
}
|
||||
|
||||
|
|
|
@ -306,7 +306,7 @@ protected:
|
|||
|
||||
// Our posted event to process the attached queue, if any
|
||||
friend class nsRunnableMethod<nsBindingManager>;
|
||||
nsCOMPtr<nsIRunnable> mProcessAttachedQueueEvent;
|
||||
nsRefPtr< nsRunnableMethod<nsBindingManager> > mProcessAttachedQueueEvent;
|
||||
|
||||
// Our document. This is a weak ref; the document owns us
|
||||
nsIDocument* mDocument;
|
||||
|
|
|
@ -37,8 +37,6 @@
|
|||
MimeNotCss=The stylesheet %1$S was not loaded because its MIME type, "%2$S", is not "text/css".
|
||||
MimeNotCssWarn=The stylesheet %1$S was loaded as CSS even though its MIME type, "%2$S", is not "text/css".
|
||||
|
||||
UseOfGetPropertyCSSValueWarning=Use of getPropertyCSSValue() is deprecated. To upgrade your code, use getPropertyValue() instead.
|
||||
|
||||
PEUnexpEOF2=Unexpected end of file while searching for %1$S.
|
||||
PEParseRuleWSOnly=Whitespace-only string given to be parsed as rule.
|
||||
PEDeclDropped=Declaration dropped.
|
||||
|
|
|
@ -85,7 +85,7 @@ EmbedPrompter::EmbedPrompter(void)
|
|||
mUserField(NULL),
|
||||
mPassField(NULL),
|
||||
mTextField(NULL),
|
||||
mOptionMenu(NULL),
|
||||
mComboBox(NULL),
|
||||
mCheckBox(NULL)
|
||||
{
|
||||
}
|
||||
|
@ -217,18 +217,12 @@ EmbedPrompter::Create(PromptType aType, GtkWindow* aParentWindow)
|
|||
|
||||
// Add a dropdown menu
|
||||
if (aType == TYPE_SELECT) {
|
||||
// Build up a GtkMenu containing the items
|
||||
GtkWidget* menu = gtk_menu_new();
|
||||
// Build up a GtkComboBox containing the items
|
||||
GtkWidget* mComboBox = gtk_combo_box_new_text();
|
||||
for (PRUint32 i = 0; i < mItemCount; ++i) {
|
||||
GtkWidget* item = gtk_menu_item_new_with_label(mItemList[i].get());
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
|
||||
gtk_combo_box_append_text(GTK_COMBO_BOX(mComboBox), mItemList[i].get());
|
||||
}
|
||||
|
||||
// Now create an OptionMenu and set this as the menu
|
||||
mOptionMenu = gtk_option_menu_new();
|
||||
|
||||
gtk_option_menu_set_menu(GTK_OPTION_MENU(mOptionMenu), menu);
|
||||
gtk_box_pack_start(GTK_BOX(contentsVBox), mOptionMenu, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(contentsVBox), mComboBox, FALSE, FALSE, 0);
|
||||
}
|
||||
|
||||
if (aType == TYPE_UNIVERSAL) {
|
||||
|
@ -403,6 +397,15 @@ EmbedPrompter::SaveDialogValues()
|
|||
if (mTextField)
|
||||
mTextValue.Assign(gtk_entry_get_text(GTK_ENTRY(mTextField)));
|
||||
|
||||
if (mOptionMenu)
|
||||
mSelectedItem = gtk_option_menu_get_history(GTK_OPTION_MENU(mOptionMenu));
|
||||
if (mComboBox)
|
||||
{
|
||||
gchar *str = gtk_combo_box_get_active_text(GTK_COMBO_BOX(mComboBox));
|
||||
for (PRUint32 i = 0; i < mItemCount; ++i) {
|
||||
if(mItemList[i].Equals(str))
|
||||
{
|
||||
mSelectedItem = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,6 +108,6 @@ private:
|
|||
GtkWidget *mUserField;
|
||||
GtkWidget *mPassField;
|
||||
GtkWidget *mTextField;
|
||||
GtkWidget *mOptionMenu;
|
||||
GtkWidget *mComboBox;
|
||||
GtkWidget *mCheckBox;
|
||||
};
|
||||
|
|
|
@ -82,10 +82,10 @@ extern "C" {
|
|||
#endif /* XPCOM_GLUE */
|
||||
|
||||
#define GTK_TYPE_MOZ_EMBED (gtk_moz_embed_get_type())
|
||||
#define GTK_MOZ_EMBED(obj) GTK_CHECK_CAST((obj), GTK_TYPE_MOZ_EMBED, GtkMozEmbed)
|
||||
#define GTK_MOZ_EMBED_CLASS(klass) GTK_CHECK_CLASS_CAST((klass), GTK_TYPE_MOZ_EMBED, GtkMozEmbedClass)
|
||||
#define GTK_IS_MOZ_EMBED(obj) GTK_CHECK_TYPE((obj), GTK_TYPE_MOZ_EMBED)
|
||||
#define GTK_IS_MOZ_EMBED_CLASS(klass) GTK_CHECK_CLASS_TYPE((klass), GTK_TYPE_MOZ_EMBED)
|
||||
#define GTK_MOZ_EMBED(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_MOZ_EMBED, GtkMozEmbed)
|
||||
#define GTK_MOZ_EMBED_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_MOZ_EMBED, GtkMozEmbedClass)
|
||||
#define GTK_IS_MOZ_EMBED(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_MOZ_EMBED)
|
||||
#define GTK_IS_MOZ_EMBED_CLASS(klass) G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_MOZ_EMBED)
|
||||
|
||||
typedef struct _GtkMozEmbed GtkMozEmbed;
|
||||
typedef struct _GtkMozEmbedClass GtkMozEmbedClass;
|
||||
|
|
|
@ -146,7 +146,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
widget_class = GTK_WIDGET_CLASS(klass);
|
||||
object_class = GTK_OBJECT_CLASS(klass);
|
||||
|
||||
embed_parent_class = (GtkBinClass *)gtk_type_class(gtk_bin_get_type());
|
||||
embed_parent_class = (GtkBinClass *)g_type_class_peek(gtk_bin_get_type());
|
||||
|
||||
widget_class->realize = gtk_moz_embed_realize;
|
||||
widget_class->unrealize = gtk_moz_embed_unrealize;
|
||||
|
@ -168,7 +168,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, link_message),
|
||||
NULL, NULL,
|
||||
gtk_marshal_NONE__NONE,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
moz_embed_signals[JS_STATUS] =
|
||||
g_signal_new("js_status",
|
||||
|
@ -176,7 +176,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, js_status),
|
||||
NULL, NULL,
|
||||
gtk_marshal_NONE__NONE,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
moz_embed_signals[LOCATION] =
|
||||
g_signal_new("location",
|
||||
|
@ -184,7 +184,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, location),
|
||||
NULL, NULL,
|
||||
gtk_marshal_NONE__NONE,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
moz_embed_signals[TITLE] =
|
||||
g_signal_new("title",
|
||||
|
@ -192,7 +192,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, title),
|
||||
NULL, NULL,
|
||||
gtk_marshal_NONE__NONE,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
moz_embed_signals[PROGRESS] =
|
||||
g_signal_new("progress",
|
||||
|
@ -200,7 +200,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, progress),
|
||||
NULL, NULL,
|
||||
gtk_marshal_NONE__INT_INT,
|
||||
gtkmozembed_VOID__INT_INT,
|
||||
G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
|
||||
moz_embed_signals[PROGRESS_ALL] =
|
||||
g_signal_new("progress_all",
|
||||
|
@ -236,7 +236,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, net_start),
|
||||
NULL, NULL,
|
||||
gtk_marshal_NONE__NONE,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
moz_embed_signals[NET_STOP] =
|
||||
g_signal_new("net_stop",
|
||||
|
@ -244,7 +244,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, net_stop),
|
||||
NULL, NULL,
|
||||
gtk_marshal_NONE__NONE,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
moz_embed_signals[NEW_WINDOW] =
|
||||
g_signal_new("new_window",
|
||||
|
@ -252,7 +252,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, new_window),
|
||||
NULL, NULL,
|
||||
gtk_marshal_NONE__POINTER_UINT,
|
||||
gtkmozembed_VOID__POINTER_UINT,
|
||||
G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_UINT);
|
||||
moz_embed_signals[VISIBILITY] =
|
||||
g_signal_new("visibility",
|
||||
|
@ -260,7 +260,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, visibility),
|
||||
NULL, NULL,
|
||||
gtk_marshal_NONE__BOOL,
|
||||
g_cclosure_marshal_VOID__BOOLEAN,
|
||||
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
|
||||
moz_embed_signals[DESTROY_BROWSER] =
|
||||
g_signal_new("destroy_browser",
|
||||
|
@ -268,7 +268,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, destroy_brsr),
|
||||
NULL, NULL,
|
||||
gtk_marshal_NONE__NONE,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
moz_embed_signals[OPEN_URI] =
|
||||
g_signal_new("open_uri",
|
||||
|
@ -285,7 +285,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, size_to),
|
||||
NULL, NULL,
|
||||
gtk_marshal_NONE__INT_INT,
|
||||
gtkmozembed_VOID__INT_INT,
|
||||
G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
|
||||
moz_embed_signals[DOM_KEY_DOWN] =
|
||||
g_signal_new("dom_key_down",
|
||||
|
@ -293,7 +293,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_key_down),
|
||||
NULL, NULL,
|
||||
gtk_marshal_BOOL__POINTER,
|
||||
gtkmozembed_BOOL__POINTER,
|
||||
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
|
||||
moz_embed_signals[DOM_KEY_PRESS] =
|
||||
g_signal_new("dom_key_press",
|
||||
|
@ -301,7 +301,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_key_press),
|
||||
NULL, NULL,
|
||||
gtk_marshal_BOOL__POINTER,
|
||||
gtkmozembed_BOOL__POINTER,
|
||||
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
|
||||
moz_embed_signals[DOM_KEY_UP] =
|
||||
g_signal_new("dom_key_up",
|
||||
|
@ -309,7 +309,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_key_up),
|
||||
NULL, NULL,
|
||||
gtk_marshal_BOOL__POINTER,
|
||||
gtkmozembed_BOOL__POINTER,
|
||||
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
|
||||
moz_embed_signals[DOM_MOUSE_DOWN] =
|
||||
g_signal_new("dom_mouse_down",
|
||||
|
@ -317,7 +317,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_mouse_down),
|
||||
NULL, NULL,
|
||||
gtk_marshal_BOOL__POINTER,
|
||||
gtkmozembed_BOOL__POINTER,
|
||||
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
|
||||
moz_embed_signals[DOM_MOUSE_UP] =
|
||||
g_signal_new("dom_mouse_up",
|
||||
|
@ -325,7 +325,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_mouse_up),
|
||||
NULL, NULL,
|
||||
gtk_marshal_BOOL__POINTER,
|
||||
gtkmozembed_BOOL__POINTER,
|
||||
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
|
||||
moz_embed_signals[DOM_MOUSE_CLICK] =
|
||||
g_signal_new("dom_mouse_click",
|
||||
|
@ -333,7 +333,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_mouse_click),
|
||||
NULL, NULL,
|
||||
gtk_marshal_BOOL__POINTER,
|
||||
gtkmozembed_BOOL__POINTER,
|
||||
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
|
||||
moz_embed_signals[DOM_MOUSE_DBL_CLICK] =
|
||||
g_signal_new("dom_mouse_dbl_click",
|
||||
|
@ -341,7 +341,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_mouse_dbl_click),
|
||||
NULL, NULL,
|
||||
gtk_marshal_BOOL__POINTER,
|
||||
gtkmozembed_BOOL__POINTER,
|
||||
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
|
||||
moz_embed_signals[DOM_MOUSE_OVER] =
|
||||
g_signal_new("dom_mouse_over",
|
||||
|
@ -349,7 +349,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_mouse_over),
|
||||
NULL, NULL,
|
||||
gtk_marshal_BOOL__POINTER,
|
||||
gtkmozembed_BOOL__POINTER,
|
||||
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
|
||||
moz_embed_signals[DOM_MOUSE_OUT] =
|
||||
g_signal_new("dom_mouse_out",
|
||||
|
@ -357,7 +357,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_mouse_out),
|
||||
NULL, NULL,
|
||||
gtk_marshal_BOOL__POINTER,
|
||||
gtkmozembed_BOOL__POINTER,
|
||||
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
|
||||
moz_embed_signals[SECURITY_CHANGE] =
|
||||
g_signal_new("security_change",
|
||||
|
@ -365,7 +365,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, security_change),
|
||||
NULL, NULL,
|
||||
gtk_marshal_NONE__POINTER_UINT,
|
||||
gtkmozembed_VOID__POINTER_UINT,
|
||||
G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_UINT);
|
||||
moz_embed_signals[STATUS_CHANGE] =
|
||||
g_signal_new("status_change",
|
||||
|
@ -382,7 +382,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_activate),
|
||||
NULL, NULL,
|
||||
gtk_marshal_BOOL__POINTER,
|
||||
gtkmozembed_BOOL__POINTER,
|
||||
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
|
||||
moz_embed_signals[DOM_FOCUS_IN] =
|
||||
g_signal_new("dom_focus_in",
|
||||
|
@ -390,7 +390,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_focus_in),
|
||||
NULL, NULL,
|
||||
gtk_marshal_BOOL__POINTER,
|
||||
gtkmozembed_BOOL__POINTER,
|
||||
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
|
||||
moz_embed_signals[DOM_FOCUS_OUT] =
|
||||
g_signal_new("dom_focus_out",
|
||||
|
@ -398,7 +398,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_focus_out),
|
||||
NULL, NULL,
|
||||
gtk_marshal_BOOL__POINTER,
|
||||
gtkmozembed_BOOL__POINTER,
|
||||
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
|
||||
}
|
||||
|
||||
|
@ -501,12 +501,12 @@ gtk_moz_embed_realize(GtkWidget *widget)
|
|||
GtkWidget *child_widget = GTK_BIN(widget)->child;
|
||||
g_signal_connect_object(G_OBJECT(child_widget),
|
||||
"focus_out_event",
|
||||
GTK_SIGNAL_FUNC(handle_child_focus_out),
|
||||
G_CALLBACK(handle_child_focus_out),
|
||||
embed,
|
||||
G_CONNECT_AFTER);
|
||||
g_signal_connect_object(G_OBJECT(child_widget),
|
||||
"focus_in_event",
|
||||
GTK_SIGNAL_FUNC(handle_child_focus_in),
|
||||
G_CALLBACK(handle_child_focus_in),
|
||||
embed,
|
||||
G_CONNECT_AFTER);
|
||||
}
|
||||
|
@ -1089,7 +1089,7 @@ gtk_moz_embed_single_class_init(GtkMozEmbedSingleClass *klass)
|
|||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET(GtkMozEmbedSingleClass, new_window_orphan),
|
||||
NULL, NULL,
|
||||
gtk_marshal_NONE__POINTER_UINT,
|
||||
gtkmozembed_VOID__POINTER_UINT,
|
||||
G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_UINT);
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ INT:STRING,STRING,UINT,STRING,STRING,STRING,STRING,POINTER
|
|||
INT:VOID
|
||||
STRING:STRING,STRING
|
||||
VOID:BOOL
|
||||
VOID:INT,INT
|
||||
VOID:INT,INT,BOOL
|
||||
VOID:INT,STRING
|
||||
VOID:INT,STRING,STRING
|
||||
|
@ -26,6 +27,8 @@ VOID:STRING,STRING,STRING,ULONG,INT
|
|||
VOID:STRING,STRING,STRING,POINTER
|
||||
VOID:UINT,INT,INT,STRING,STRING,STRING,STRING
|
||||
VOID:ULONG,ULONG,ULONG
|
||||
VOID:POINTER,UINT
|
||||
BOOL:POINTER,UINT
|
||||
BOOL:POINTER
|
||||
VOID:POINTER
|
||||
BOOL:STRING,STRING,POINTER
|
||||
|
|
|
@ -242,7 +242,7 @@ main(int argc, char **argv)
|
|||
TestGtkBrowser *browser = new_gtk_browser(GTK_MOZ_EMBED_FLAG_DEFAULTCHROME);
|
||||
|
||||
// set our minimum size
|
||||
gtk_widget_set_usize(browser->mozEmbed, 400, 400);
|
||||
gtk_widget_set_size_request(browser->mozEmbed, 400, 400);
|
||||
|
||||
set_browser_visibility(browser, TRUE);
|
||||
|
||||
|
@ -260,8 +260,8 @@ main(int argc, char **argv)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(single), "new_window_orphan",
|
||||
GTK_SIGNAL_FUNC(new_window_orphan_cb), NULL);
|
||||
g_signal_connect(GTK_OBJECT(single), "new_window_orphan",
|
||||
G_CALLBACK(new_window_orphan_cb), NULL);
|
||||
|
||||
gtk_moz_embed_push_startup();
|
||||
gtk_main();
|
||||
|
@ -328,31 +328,32 @@ new_gtk_browser(guint32 chromeMask)
|
|||
|
||||
browser->fileOpenNewBrowser =
|
||||
gtk_menu_item_new_with_label("Open New Browser");
|
||||
gtk_menu_append(GTK_MENU(browser->fileMenu),
|
||||
browser->fileOpenNewBrowser);
|
||||
gtk_menu_shell_append((GtkMenuShell *)GTK_MENU(browser->fileMenu),
|
||||
browser->fileOpenNewBrowser);
|
||||
|
||||
browser->fileStream =
|
||||
gtk_menu_item_new_with_label("Test Stream");
|
||||
gtk_menu_append(GTK_MENU(browser->fileMenu),
|
||||
browser->fileStream);
|
||||
gtk_menu_shell_append((GtkMenuShell *)GTK_MENU(browser->fileMenu),
|
||||
browser->fileStream);
|
||||
|
||||
browser->fileMemory =
|
||||
gtk_menu_item_new_with_label("Release Memory");
|
||||
gtk_menu_append(GTK_MENU(browser->fileMenu),
|
||||
browser->fileMemory);
|
||||
gtk_menu_shell_append((GtkMenuShell *)GTK_MENU(browser->fileMenu),
|
||||
browser->fileMemory);
|
||||
|
||||
browser->fileClose =
|
||||
gtk_menu_item_new_with_label("Close");
|
||||
gtk_menu_append(GTK_MENU(browser->fileMenu),
|
||||
browser->fileClose);
|
||||
gtk_menu_shell_append((GtkMenuShell *)GTK_MENU(browser->fileMenu),
|
||||
browser->fileClose);
|
||||
|
||||
browser->fileQuit =
|
||||
gtk_menu_item_new_with_label("Quit");
|
||||
gtk_menu_append(GTK_MENU(browser->fileMenu),
|
||||
browser->fileQuit);
|
||||
gtk_menu_shell_append((GtkMenuShell *)GTK_MENU(browser->fileMenu),
|
||||
browser->fileQuit);
|
||||
|
||||
// append it
|
||||
gtk_menu_bar_append(GTK_MENU_BAR(browser->menuBar), browser->fileMenuItem);
|
||||
gtk_menu_shell_append((GtkMenuShell *)GTK_MENU_BAR(browser->menuBar),
|
||||
browser->fileMenuItem);
|
||||
|
||||
// add it to the vbox
|
||||
gtk_box_pack_start(GTK_BOX(browser->topLevelVBox),
|
||||
|
@ -387,7 +388,7 @@ new_gtk_browser(guint32 chromeMask)
|
|||
"Go Back",
|
||||
"Go Back",
|
||||
0, // XXX replace with icon
|
||||
GTK_SIGNAL_FUNC(back_clicked_cb),
|
||||
G_CALLBACK(back_clicked_cb),
|
||||
browser);
|
||||
// new stop button
|
||||
browser->stopButton =
|
||||
|
@ -396,7 +397,7 @@ new_gtk_browser(guint32 chromeMask)
|
|||
"Stop",
|
||||
"Stop",
|
||||
0, // XXX replace with icon
|
||||
GTK_SIGNAL_FUNC(stop_clicked_cb),
|
||||
G_CALLBACK(stop_clicked_cb),
|
||||
browser);
|
||||
// new forward button
|
||||
browser->forwardButton =
|
||||
|
@ -405,7 +406,7 @@ new_gtk_browser(guint32 chromeMask)
|
|||
"Forward",
|
||||
"Forward",
|
||||
0, // XXX replace with icon
|
||||
GTK_SIGNAL_FUNC(forward_clicked_cb),
|
||||
G_CALLBACK(forward_clicked_cb),
|
||||
browser);
|
||||
// new reload button
|
||||
browser->reloadButton =
|
||||
|
@ -414,7 +415,7 @@ new_gtk_browser(guint32 chromeMask)
|
|||
"Reload",
|
||||
"Reload",
|
||||
0, // XXX replace with icon
|
||||
GTK_SIGNAL_FUNC(reload_clicked_cb),
|
||||
G_CALLBACK(reload_clicked_cb),
|
||||
browser);
|
||||
// create the url text entry
|
||||
browser->urlEntry = gtk_entry_new();
|
||||
|
@ -449,7 +450,7 @@ new_gtk_browser(guint32 chromeMask)
|
|||
// create our status area and the alignment object that will keep it
|
||||
// from expanding
|
||||
browser->statusAlign = gtk_alignment_new(0, 0, 1, 1);
|
||||
gtk_widget_set_usize(browser->statusAlign, 1, -1);
|
||||
gtk_widget_set_size_request(browser->statusAlign, 1, -1);
|
||||
// create the status bar
|
||||
browser->statusBar = gtk_statusbar_new();
|
||||
gtk_container_add(GTK_CONTAINER(browser->statusAlign), browser->statusBar);
|
||||
|
@ -465,103 +466,103 @@ new_gtk_browser(guint32 chromeMask)
|
|||
gtk_widget_set_sensitive(browser->reloadButton, FALSE);
|
||||
|
||||
// catch the destruction of the toplevel window
|
||||
gtk_signal_connect(GTK_OBJECT(browser->topLevelWindow), "delete_event",
|
||||
GTK_SIGNAL_FUNC(delete_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->topLevelWindow), "delete_event",
|
||||
G_CALLBACK(delete_cb), browser);
|
||||
|
||||
// hook up the activate signal to the right callback
|
||||
gtk_signal_connect(GTK_OBJECT(browser->urlEntry), "activate",
|
||||
GTK_SIGNAL_FUNC(url_activate_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->urlEntry), "activate",
|
||||
G_CALLBACK(url_activate_cb), browser);
|
||||
|
||||
// hook up to the open new browser activation
|
||||
gtk_signal_connect(GTK_OBJECT(browser->fileOpenNewBrowser), "activate",
|
||||
GTK_SIGNAL_FUNC(menu_open_new_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->fileOpenNewBrowser), "activate",
|
||||
G_CALLBACK(menu_open_new_cb), browser);
|
||||
// hook up to the stream test
|
||||
gtk_signal_connect(GTK_OBJECT(browser->fileStream), "activate",
|
||||
GTK_SIGNAL_FUNC(menu_stream_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->fileStream), "activate",
|
||||
G_CALLBACK(menu_stream_cb), browser);
|
||||
// hook up the memory pressure release function
|
||||
gtk_signal_connect(GTK_OBJECT(browser->fileMemory), "activate",
|
||||
GTK_SIGNAL_FUNC(menu_memory_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->fileMemory), "activate",
|
||||
G_CALLBACK(menu_memory_cb), browser);
|
||||
// close this window
|
||||
gtk_signal_connect(GTK_OBJECT(browser->fileClose), "activate",
|
||||
GTK_SIGNAL_FUNC(menu_close_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->fileClose), "activate",
|
||||
G_CALLBACK(menu_close_cb), browser);
|
||||
// quit the application
|
||||
gtk_signal_connect(GTK_OBJECT(browser->fileQuit), "activate",
|
||||
GTK_SIGNAL_FUNC(menu_quit_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->fileQuit), "activate",
|
||||
G_CALLBACK(menu_quit_cb), browser);
|
||||
|
||||
// hook up the location change to update the urlEntry
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "location",
|
||||
GTK_SIGNAL_FUNC(location_changed_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "location",
|
||||
G_CALLBACK(location_changed_cb), browser);
|
||||
// hook up the title change to update the window title
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "title",
|
||||
GTK_SIGNAL_FUNC(title_changed_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "title",
|
||||
G_CALLBACK(title_changed_cb), browser);
|
||||
// hook up the start and stop signals
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_start",
|
||||
GTK_SIGNAL_FUNC(load_started_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_stop",
|
||||
GTK_SIGNAL_FUNC(load_finished_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_start",
|
||||
G_CALLBACK(load_started_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_stop",
|
||||
G_CALLBACK(load_finished_cb), browser);
|
||||
// hook up to the change in network status
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_state",
|
||||
GTK_SIGNAL_FUNC(net_state_change_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_state_all",
|
||||
GTK_SIGNAL_FUNC(net_state_change_all_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_state",
|
||||
G_CALLBACK(net_state_change_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_state_all",
|
||||
G_CALLBACK(net_state_change_all_cb), browser);
|
||||
// hookup to changes in progress
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "progress",
|
||||
GTK_SIGNAL_FUNC(progress_change_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "progress_all",
|
||||
GTK_SIGNAL_FUNC(progress_change_all_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "progress",
|
||||
G_CALLBACK(progress_change_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "progress_all",
|
||||
G_CALLBACK(progress_change_all_cb), browser);
|
||||
// hookup to changes in over-link message
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "link_message",
|
||||
GTK_SIGNAL_FUNC(link_message_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "link_message",
|
||||
G_CALLBACK(link_message_cb), browser);
|
||||
// hookup to changes in js status message
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "js_status",
|
||||
GTK_SIGNAL_FUNC(js_status_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "js_status",
|
||||
G_CALLBACK(js_status_cb), browser);
|
||||
// hookup to see whenever a new window is requested
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "new_window",
|
||||
GTK_SIGNAL_FUNC(new_window_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "new_window",
|
||||
G_CALLBACK(new_window_cb), browser);
|
||||
// hookup to any requested visibility changes
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "visibility",
|
||||
GTK_SIGNAL_FUNC(visibility_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "visibility",
|
||||
G_CALLBACK(visibility_cb), browser);
|
||||
// hookup to the signal that says that the browser requested to be
|
||||
// destroyed
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "destroy_browser",
|
||||
GTK_SIGNAL_FUNC(destroy_brsr_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "destroy_browser",
|
||||
G_CALLBACK(destroy_brsr_cb), browser);
|
||||
// hookup to the signal that is called when someone clicks on a link
|
||||
// to load a new uri
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "open_uri",
|
||||
GTK_SIGNAL_FUNC(open_uri_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "open_uri",
|
||||
G_CALLBACK(open_uri_cb), browser);
|
||||
// this signal is emitted when there's a request to change the
|
||||
// containing browser window to a certain height, like with width
|
||||
// and height args for a window.open in javascript
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "size_to",
|
||||
GTK_SIGNAL_FUNC(size_to_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "size_to",
|
||||
G_CALLBACK(size_to_cb), browser);
|
||||
// key event signals
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_key_down",
|
||||
GTK_SIGNAL_FUNC(dom_key_down_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_key_press",
|
||||
GTK_SIGNAL_FUNC(dom_key_press_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_key_up",
|
||||
GTK_SIGNAL_FUNC(dom_key_up_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_down",
|
||||
GTK_SIGNAL_FUNC(dom_mouse_down_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_up",
|
||||
GTK_SIGNAL_FUNC(dom_mouse_up_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_click",
|
||||
GTK_SIGNAL_FUNC(dom_mouse_click_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_dbl_click",
|
||||
GTK_SIGNAL_FUNC(dom_mouse_dbl_click_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_over",
|
||||
GTK_SIGNAL_FUNC(dom_mouse_over_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_out",
|
||||
GTK_SIGNAL_FUNC(dom_mouse_out_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_activate",
|
||||
GTK_SIGNAL_FUNC(dom_activate_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_focus_in",
|
||||
GTK_SIGNAL_FUNC(dom_focus_in_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_focus_out",
|
||||
GTK_SIGNAL_FUNC(dom_focus_out_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_key_down",
|
||||
G_CALLBACK(dom_key_down_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_key_press",
|
||||
G_CALLBACK(dom_key_press_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_key_up",
|
||||
G_CALLBACK(dom_key_up_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_down",
|
||||
G_CALLBACK(dom_mouse_down_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_up",
|
||||
G_CALLBACK(dom_mouse_up_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_click",
|
||||
G_CALLBACK(dom_mouse_click_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_dbl_click",
|
||||
G_CALLBACK(dom_mouse_dbl_click_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_over",
|
||||
G_CALLBACK(dom_mouse_over_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_out",
|
||||
G_CALLBACK(dom_mouse_out_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_activate",
|
||||
G_CALLBACK(dom_activate_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_focus_in",
|
||||
G_CALLBACK(dom_focus_in_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_focus_out",
|
||||
G_CALLBACK(dom_focus_out_cb), browser);
|
||||
// hookup to when the window is destroyed
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "destroy",
|
||||
GTK_SIGNAL_FUNC(destroy_cb), browser);
|
||||
g_signal_connect(GTK_OBJECT(browser->mozEmbed), "destroy",
|
||||
G_CALLBACK(destroy_cb), browser);
|
||||
|
||||
// set the chrome type so it's stored in the object
|
||||
gtk_moz_embed_set_chrome_mask(GTK_MOZ_EMBED(browser->mozEmbed),
|
||||
|
@ -666,7 +667,7 @@ menu_open_new_cb (GtkMenuItem *menuitem, TestGtkBrowser *browser)
|
|||
g_print("opening new browser.\n");
|
||||
TestGtkBrowser *newBrowser =
|
||||
new_gtk_browser(GTK_MOZ_EMBED_FLAG_DEFAULTCHROME);
|
||||
gtk_widget_set_usize(newBrowser->mozEmbed, 400, 400);
|
||||
gtk_widget_set_size_request(newBrowser->mozEmbed, 400, 400);
|
||||
set_browser_visibility(newBrowser, TRUE);
|
||||
}
|
||||
|
||||
|
@ -754,9 +755,9 @@ destroy_cb (GtkWidget *widget, TestGtkBrowser *browser)
|
|||
browser_list = g_list_remove_link(browser_list, tmp_list);
|
||||
if (browser->tempMessage)
|
||||
g_free(browser->tempMessage);
|
||||
gtk_idle_add(idle_pop, NULL);
|
||||
g_idle_add(idle_pop, NULL);
|
||||
if (num_browsers == 0)
|
||||
gtk_idle_add (idle_quit, NULL);
|
||||
g_idle_add (idle_quit, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -819,7 +820,7 @@ load_finished_cb (GtkMozEmbed *embed, TestGtkBrowser *browser)
|
|||
browser->bytesLoaded = 0;
|
||||
browser->maxBytesLoaded = 0;
|
||||
update_status_bar_text(browser);
|
||||
gtk_progress_set_percentage(GTK_PROGRESS(browser->progressBar), 0);
|
||||
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(browser->progressBar), 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -872,7 +873,6 @@ void progress_change_cb (GtkMozEmbed *embed, gint cur, gint max,
|
|||
// avoid those pesky divide by zero errors
|
||||
if (max < 1)
|
||||
{
|
||||
gtk_progress_set_activity_mode(GTK_PROGRESS(browser->progressBar), FALSE);
|
||||
browser->loadPercent = 0;
|
||||
browser->bytesLoaded = cur;
|
||||
browser->maxBytesLoaded = 0;
|
||||
|
@ -887,7 +887,8 @@ void progress_change_cb (GtkMozEmbed *embed, gint cur, gint max,
|
|||
else
|
||||
browser->loadPercent = (cur * 100) / max;
|
||||
update_status_bar_text(browser);
|
||||
gtk_progress_set_percentage(GTK_PROGRESS(browser->progressBar), browser->loadPercent / 100.0);
|
||||
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(browser->progressBar),
|
||||
browser->loadPercent / 100.0);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -933,7 +934,7 @@ new_window_cb (GtkMozEmbed *embed, GtkMozEmbed **newEmbed, guint chromemask, Tes
|
|||
g_print("new_window_cb\n");
|
||||
g_print("embed is %p chromemask is %d\n", (void *)embed, chromemask);
|
||||
TestGtkBrowser *newBrowser = new_gtk_browser(chromemask);
|
||||
gtk_widget_set_usize(newBrowser->mozEmbed, 400, 400);
|
||||
gtk_widget_set_size_request(newBrowser->mozEmbed, 400, 400);
|
||||
*newEmbed = GTK_MOZ_EMBED(newBrowser->mozEmbed);
|
||||
g_print("new browser is %p\n", (void *)*newEmbed);
|
||||
}
|
||||
|
@ -969,7 +970,7 @@ size_to_cb (GtkMozEmbed *embed, gint width, gint height,
|
|||
TestGtkBrowser *browser)
|
||||
{
|
||||
g_print("*** size_to_cb %d %d\n", width, height);
|
||||
gtk_widget_set_usize(browser->mozEmbed, width, height);
|
||||
gtk_widget_set_size_request(browser->mozEmbed, width, height);
|
||||
}
|
||||
|
||||
gint dom_key_down_cb (GtkMozEmbed *embed, nsIDOMKeyEvent *event,
|
||||
|
|
|
@ -138,10 +138,10 @@ main(int argc, char **argv)
|
|||
|
||||
window = gtk_plug_new(xid);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(window), "destroy",
|
||||
GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
|
||||
g_signal_connect(GTK_OBJECT(window), "destroy",
|
||||
G_CALLBACK(gtk_main_quit), NULL);
|
||||
|
||||
gtk_container_border_width(GTK_CONTAINER(window), 0);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(window), 0);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add(GTK_CONTAINER(window), vbox);
|
||||
|
@ -159,12 +159,11 @@ main(int argc, char **argv)
|
|||
gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0);
|
||||
gtk_widget_show(button);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
||||
GTK_SIGNAL_FUNC(load_page), NULL);
|
||||
g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(load_page), NULL);
|
||||
|
||||
embed = gtk_moz_embed_new();
|
||||
gtk_box_pack_start(GTK_BOX(vbox), embed, TRUE, TRUE, 0);
|
||||
gtk_widget_set_usize(embed, 200, 200);
|
||||
gtk_widget_set_size_request(embed, 200, 200);
|
||||
gtk_widget_show(embed);
|
||||
|
||||
gtk_widget_show(window);
|
||||
|
|
|
@ -55,8 +55,8 @@ int main(int argc, char *argv[])
|
|||
"Once you switch to mozembed page "
|
||||
"you never see this message.");
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(mozembed), "destroy",
|
||||
GTK_SIGNAL_FUNC(gtk_main_quit),
|
||||
g_signal_connect(GTK_OBJECT(mozembed), "destroy",
|
||||
G_CALLBACK(gtk_main_quit),
|
||||
NULL);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(window), container);
|
||||
|
@ -72,7 +72,7 @@ NULL);
|
|||
|
||||
|
||||
|
||||
gtk_widget_set_usize(window, 400, 300);
|
||||
gtk_widget_set_size_request(window, 400, 300);
|
||||
gtk_widget_show(mozembed);
|
||||
gtk_widget_show(label);
|
||||
gtk_widget_show_all(window);
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -56,8 +57,8 @@ main(int argc, char **argv)
|
|||
|
||||
toplevel_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(toplevel_window), "destroy",
|
||||
(GtkSignalFunc) gtk_exit, NULL);
|
||||
g_signal_connect(GTK_OBJECT(toplevel_window), "destroy",
|
||||
G_CALLBACK(exit), NULL);
|
||||
|
||||
vbox = gtk_vbox_new(FALSE, 0);
|
||||
gtk_container_add(GTK_CONTAINER(toplevel_window), vbox);
|
||||
|
@ -68,8 +69,8 @@ main(int argc, char **argv)
|
|||
gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show(button);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
||||
GTK_SIGNAL_FUNC(insert_mozilla), NULL);
|
||||
g_signal_connect(GTK_OBJECT(button), "clicked",
|
||||
G_CALLBACK(insert_mozilla), NULL);
|
||||
|
||||
gtk_widget_show(toplevel_window);
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ interface nsIArray;
|
|||
|
||||
[ptr] native jsvalptr(jsval);
|
||||
|
||||
[uuid(3aaad312-e09d-4010-a013-78ef653dac99)]
|
||||
[uuid(8624594a-28d7-4bc3-8d12-b1c2b9eefd90)]
|
||||
|
||||
interface nsPIWindowWatcher : nsISupports
|
||||
{
|
||||
|
|
|
@ -1271,8 +1271,13 @@ _cairo_gstate_set_font_matrix (cairo_gstate_t *gstate,
|
|||
if (memcmp (matrix, &gstate->font_matrix, sizeof (cairo_matrix_t)) == 0)
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
|
||||
if (! _cairo_matrix_is_invertible (matrix))
|
||||
return _cairo_error (CAIRO_STATUS_INVALID_MATRIX);
|
||||
if (! _cairo_matrix_is_invertible (matrix)) {
|
||||
/* rank 0 matrices are ok even though they are not invertible */
|
||||
if (!(matrix->xx == 0. && matrix->xy == 0. &&
|
||||
matrix->yx == 0. && matrix->yy == 0.)) {
|
||||
return _cairo_error (CAIRO_STATUS_INVALID_MATRIX);
|
||||
}
|
||||
}
|
||||
|
||||
_cairo_gstate_unset_scaled_font (gstate);
|
||||
|
||||
|
|
|
@ -154,17 +154,17 @@ nsSystemFontsGTK2::nsSystemFontsGTK2()
|
|||
GtkWidget *accel_label = gtk_accel_label_new("M");
|
||||
GtkWidget *menuitem = gtk_menu_item_new();
|
||||
GtkWidget *menu = gtk_menu_new();
|
||||
gtk_object_ref(GTK_OBJECT(menu));
|
||||
gtk_object_sink(GTK_OBJECT(menu));
|
||||
g_object_ref(GTK_OBJECT(menu));
|
||||
g_object_ref_sink(GTK_OBJECT(menu));
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(menuitem), accel_label);
|
||||
gtk_menu_append(GTK_MENU(menu), menuitem);
|
||||
gtk_menu_shell_append((GtkMenuShell *)GTK_MENU(menu), menuitem);
|
||||
|
||||
gtk_widget_ensure_style(accel_label);
|
||||
|
||||
GetSystemFontInfo(accel_label, &mMenuFontName, &mMenuFontStyle);
|
||||
|
||||
gtk_widget_unref(menu);
|
||||
g_object_unref(menu);
|
||||
|
||||
// mButtonFont
|
||||
parent = gtk_fixed_new();
|
||||
|
|
|
@ -702,7 +702,7 @@ gfxPlatformGtk::SetGdkDrawable(gfxASurface *target,
|
|||
if (target->CairoStatus())
|
||||
return;
|
||||
|
||||
gdk_drawable_ref(drawable);
|
||||
g_object_ref(drawable);
|
||||
|
||||
cairo_surface_set_user_data (target->CairoSurface(),
|
||||
&cairo_gdk_drawable_key,
|
||||
|
|
|
@ -360,19 +360,6 @@ DEFINES += -DEXPORT_JS_API
|
|||
|
||||
INCLUDES += -I$(srcdir)
|
||||
|
||||
# MSVC '-Gy' cc flag and '/OPT:REF' linker flag cause JS_GetArgument and
|
||||
# JS_GetLocalVariable to be folded to the same address by the linker,
|
||||
# leading to a crash on startup. See bug 151066. So, in optimized builds,
|
||||
# add the /OPT:NOICF flag, which turns off 'identical COMDAT folding'.
|
||||
#
|
||||
# N.B.: 'identical COMDAT folding' that folds functions whose addresses
|
||||
# are taken violates the ISO C and C++ standards.
|
||||
ifndef MOZ_DEBUG
|
||||
ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
|
||||
LDFLAGS += -OPT:NOICF
|
||||
endif
|
||||
endif
|
||||
|
||||
GARBAGE += jscpucfg.o jsautocfg.h jsautocfg.tmp jscpucfg
|
||||
|
||||
ifneq (,$(CROSS_COMPILE)$(filter-out WINNT,$(OS_ARCH)))
|
||||
|
@ -600,7 +587,7 @@ SDK_BINARY = js-config
|
|||
install:: $(INSTALLED_HEADERS)
|
||||
$(SYSINSTALL) $^ $(includedir)/$(MODULE)
|
||||
|
||||
install:: $(SCRIPTS) $(PROGRAM)
|
||||
install:: $(SCRIPTS)
|
||||
$(SYSINSTALL) $^ $(bindir)
|
||||
|
||||
install:: $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
|
||||
|
@ -643,10 +630,24 @@ $(CURDIR)/javascript-trace.h: $(srcdir)/javascript-trace.d
|
|||
$(addsuffix .$(OBJ_SUFFIX),jsdtracef jsinterp jsobj): $(CURDIR)/javascript-trace.h
|
||||
endif
|
||||
|
||||
imacro_asm.js: imacro_asm.js.in
|
||||
$(CC) -c -x c -E -P -I$(srcdir) $? > $@
|
||||
ifdef GNU_CC
|
||||
imacro_asm.js: imacro_asm.js.in jsopcode.tbl
|
||||
$(CC) -c -x c -E -P -I$(srcdir) $< > $@
|
||||
|
||||
GARBAGE += imacro_asm.js
|
||||
GARBAGE += imacros.c.out imacro_asm.js
|
||||
|
||||
%.c.out: %.jsasm $(PROGRAM) imacro_asm.js
|
||||
./$(PROGRAM) imacro_asm.js $< > $@
|
||||
ifndef CROSS_COMPILE
|
||||
# Obsolete comment: if you replace update-imacros with libs, this would apply
|
||||
# but then parallel gmake would sometimes try to run $(DIST)/bin/js before it
|
||||
# had been built and installed. Want a fix for this, de-automating for now.
|
||||
|
||||
# Build imacros.c.out after descending into DIRS and building the js shell.
|
||||
# This may result in an updated imacros.c.out file that requires a re-build
|
||||
# to stabilize.
|
||||
update-imacros:: imacros.c.out
|
||||
@cmp -s imacros.c.out $(srcdir)/$< || cp imacros.c.out $(srcdir)
|
||||
|
||||
%.c.out: %.jsasm imacro_asm.js
|
||||
$(DIST)/bin/js imacro_asm.js $< > $@
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -2271,8 +2271,8 @@ dnl the qsort routine under solaris is faulty
|
|||
# $ORIGIN/.. is for shared libraries under components/ to locate shared
|
||||
# libraries one level up (e.g. libnspr4.so)
|
||||
LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
|
||||
LIBS="-lCrun -lCstd $LIBS"
|
||||
if test -z "$GNU_CC"; then
|
||||
LIBS="-lCrun -lCstd $LIBS"
|
||||
NS_USE_NATIVE=1
|
||||
MOZ_FIX_LINK_PATHS=
|
||||
AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
|
||||
|
@ -5299,8 +5299,18 @@ rm conftest.sh
|
|||
|
||||
echo $MAKEFILES > unallmakefiles
|
||||
|
||||
mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
|
||||
|
||||
AC_OUTPUT($MAKEFILES)
|
||||
|
||||
dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
|
||||
if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
|
||||
echo "config/autoconf.mk is unchanged"
|
||||
mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
|
||||
else
|
||||
rm -f config/autoconf.mk.orig 2> /dev/null
|
||||
fi
|
||||
|
||||
# Produce the js-config script at configure time; see the comments for
|
||||
# 'js-config' in Makefile.in.
|
||||
AC_MSG_RESULT(invoking make to create js-config script)
|
||||
|
|
|
@ -124,16 +124,6 @@ function immediate(op) {
|
|||
throw new Error(info.jsop + " format not yet implemented");
|
||||
}
|
||||
|
||||
const line_regexp_parts = [
|
||||
"^(?:(\\w+):)?",
|
||||
"\\s*(\\.?\\w+)",
|
||||
"(?:\\s+(\\w+|\\([^)]*\\)))?",
|
||||
"(?:\\s+([\\w-]+|\\([^)]*\\)))?",
|
||||
"(?:\\s*(?:#.*))?$"
|
||||
];
|
||||
|
||||
const line_regexp = new RegExp(line_regexp_parts.join(""));
|
||||
|
||||
/*
|
||||
* Syntax (spaces are significant only to delimit tokens):
|
||||
*
|
||||
|
@ -153,11 +143,21 @@ const line_regexp = new RegExp(line_regexp_parts.join(""));
|
|||
* .imacro must nest in .igroup, neither nests in itself. See imacros.jsasm for
|
||||
* examples.
|
||||
*/
|
||||
const line_regexp_parts = [
|
||||
"^(?:(\\w+):)?", // optional label at start of line
|
||||
"\\s*(\\.?\\w+)", // optional spaces, (pseudo-)opcode
|
||||
"(?:\\s+(\\w+|\\([^)]*\\)))?", // optional first immediate operand
|
||||
"(?:\\s+([\\w-]+|\\([^)]*\\)))?", // optional second immediate operand
|
||||
"(?:\\s*(?:#.*))?$" // optional spaces and comment
|
||||
];
|
||||
|
||||
const line_regexp = new RegExp(line_regexp_parts.join(""));
|
||||
|
||||
function assemble(filename) {
|
||||
let igroup = null, imacro = null;
|
||||
let opcode2extra = [];
|
||||
|
||||
print("/* GENERATED BY imacro_asm.js from " + filename + " -- DO NOT EDIT!!! */");
|
||||
print("/* GENERATED BY imacro_asm.js -- DO NOT EDIT!!! */");
|
||||
|
||||
let s = snarf(filename);
|
||||
let a = s.split('\n');
|
||||
|
@ -295,11 +295,11 @@ function assemble(filename) {
|
|||
if (info.oplen == -1)
|
||||
throw new Error("unimplemented opcode " + opname);
|
||||
|
||||
if (label) {
|
||||
if (!imacro)
|
||||
throw new Error("label " + label + " outside of .imacro");
|
||||
if (!imacro)
|
||||
throw new Error("opcode " + opname + " outside of .imacro");
|
||||
|
||||
if (label)
|
||||
imacro.labeldefs[label] = imacro.offset;
|
||||
}
|
||||
|
||||
let op = {offset: imacro.offset, info: info, imm1: imm1, imm2: imm2};
|
||||
if (info.flags.indexOf("JOF_JUMP") >= 0) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* GENERATED BY imacro_asm.js from imacros.jsasm -- DO NOT EDIT!!! */
|
||||
/* GENERATED BY imacro_asm.js -- DO NOT EDIT!!! */
|
||||
static struct {
|
||||
jsbytecode any_obj[37];
|
||||
jsbytecode obj_any[39];
|
||||
|
@ -709,7 +709,7 @@ uint8 js_opcode2extra[JSOP_LIMIT] = {
|
|||
0, /* JSOP_GETPROP */
|
||||
0, /* JSOP_SETPROP */
|
||||
2, /* JSOP_GETELEM */
|
||||
2, /* JSOP_SETELEM */
|
||||
3, /* JSOP_SETELEM */
|
||||
0, /* JSOP_CALLNAME */
|
||||
0, /* JSOP_CALL */
|
||||
0, /* JSOP_NAME */
|
||||
|
@ -731,7 +731,7 @@ uint8 js_opcode2extra[JSOP_LIMIT] = {
|
|||
3, /* JSOP_ITER */
|
||||
2, /* JSOP_NEXTITER */
|
||||
0, /* JSOP_ENDITER */
|
||||
7, /* JSOP_APPLY */
|
||||
8, /* JSOP_APPLY */
|
||||
0, /* JSOP_SWAP */
|
||||
0, /* JSOP_OBJECT */
|
||||
0, /* JSOP_POP */
|
||||
|
@ -745,7 +745,7 @@ uint8 js_opcode2extra[JSOP_LIMIT] = {
|
|||
0, /* JSOP_NEWINIT */
|
||||
0, /* JSOP_ENDINIT */
|
||||
0, /* JSOP_INITPROP */
|
||||
2, /* JSOP_INITELEM */
|
||||
3, /* JSOP_INITELEM */
|
||||
0, /* JSOP_DEFSHARP */
|
||||
0, /* JSOP_USESHARP */
|
||||
0, /* JSOP_INCARG */
|
||||
|
|
|
@ -833,8 +833,6 @@ array_defineProperty(JSContext *cx, JSObject *obj, jsid id, jsval value,
|
|||
if (!isIndex || attrs != JSPROP_ENUMERATE) {
|
||||
if (!ENSURE_SLOW_ARRAY(cx, obj))
|
||||
return JS_FALSE;
|
||||
if (isIndex && STOBJ_IS_DELEGATE(obj))
|
||||
cx->runtime->anyArrayProtoHasElement = JS_TRUE;
|
||||
return js_DefineProperty(cx, obj, id, value, getter, setter, attrs, propp);
|
||||
}
|
||||
|
||||
|
@ -1544,8 +1542,10 @@ static JSString* FASTCALL
|
|||
Array_p_join(JSContext* cx, JSObject* obj, JSString *str)
|
||||
{
|
||||
jsval v;
|
||||
if (!array_join_sub(cx, obj, TO_STRING, str, &v))
|
||||
if (!array_join_sub(cx, obj, TO_STRING, str, &v)) {
|
||||
cx->builtinStatus |= JSBUILTIN_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
JS_ASSERT(JSVAL_IS_STRING(v));
|
||||
return JSVAL_TO_STRING(v);
|
||||
}
|
||||
|
@ -2146,7 +2146,8 @@ Array_p_push1(JSContext* cx, JSObject* obj, jsval v)
|
|||
: array_push_slowly(cx, obj, 1, &v, &v)) {
|
||||
return v;
|
||||
}
|
||||
return JSVAL_ERROR_COOKIE;
|
||||
cx->builtinStatus |= JSBUILTIN_ERROR;
|
||||
return JSVAL_VOID;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2213,12 +2214,13 @@ static jsval FASTCALL
|
|||
Array_p_pop(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
jsval v;
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj)
|
||||
if (OBJ_IS_DENSE_ARRAY(cx, obj)
|
||||
? array_pop_dense(cx, obj, &v)
|
||||
: array_pop_slowly(cx, obj, &v)) {
|
||||
return v;
|
||||
}
|
||||
return JSVAL_ERROR_COOKIE;
|
||||
cx->builtinStatus |= JSBUILTIN_ERROR;
|
||||
return JSVAL_VOID;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -49,8 +49,8 @@
|
|||
#undef THIS
|
||||
#endif
|
||||
|
||||
enum JSTNErrType { INFALLIBLE, FAIL_NULL, FAIL_NEG, FAIL_VOID, FAIL_JSVAL };
|
||||
enum { JSTN_ERRTYPE_MASK = 7, JSTN_MORE = 8 };
|
||||
enum JSTNErrType { INFALLIBLE, FAIL_STATUS, FAIL_NULL, FAIL_NEG, FAIL_VOID, FAIL_COOKIE };
|
||||
enum { JSTN_ERRTYPE_MASK = 0x07, JSTN_UNBOX_AFTER = 0x08, JSTN_MORE = 0x10 };
|
||||
|
||||
#define JSTN_ERRTYPE(jstn) ((jstn)->flags & JSTN_ERRTYPE_MASK)
|
||||
|
||||
|
@ -85,7 +85,7 @@ struct JSTraceableNative {
|
|||
const nanojit::CallInfo *builtin;
|
||||
const char *prefix;
|
||||
const char *argtypes;
|
||||
uintN flags; /* JSTN_MORE | JSTNErrType */
|
||||
uintN flags; /* JSTNErrType | JSTN_UNBOX_AFTER | JSTN_MORE */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -120,13 +120,41 @@ struct JSTraceableNative {
|
|||
* Types with -- for the two string fields are not permitted as argument types
|
||||
* in JS_DEFINE_TRCINFO.
|
||||
*
|
||||
* If a traceable native can fail, the values that indicate failure are part of
|
||||
* the return type:
|
||||
* JSVAL_FAIL: JSVAL_ERROR_COOKIE
|
||||
* BOOL_FAIL: JSVAL_TO_BOOLEAN(JSVAL_VOID)
|
||||
* INT32_FAIL: any negative value
|
||||
* STRING_FAIL: NULL
|
||||
* OBJECT_FAIL_NULL: NULL
|
||||
* There are three kinds of traceable-native error handling.
|
||||
*
|
||||
* - If a traceable native's return type ends with _FAIL, it always runs to
|
||||
* completion. It can either succeed or fail with an error or exception;
|
||||
* on success, it may or may not stay on trace. There may be side effects
|
||||
* in any case. If the call succeeds but bails off trace, we resume in the
|
||||
* interpreter at the next opcode.
|
||||
*
|
||||
* _FAIL builtins indicate failure or bailing off trace by setting bits in
|
||||
* cx->builtinStatus.
|
||||
*
|
||||
* - If a traceable native's return type contains _RETRY, it can either
|
||||
* succeed, fail with a JS exception, or tell the caller to bail off trace
|
||||
* and retry the call from the interpreter. The last case happens if the
|
||||
* builtin discovers that it can't do its job without examining the JS
|
||||
* stack, reentering the interpreter, accessing properties of the global
|
||||
* object, etc.
|
||||
*
|
||||
* The builtin must detect the need to retry before committing any side
|
||||
* effects. If a builtin can't do this, it must use a _FAIL return type
|
||||
* instead of _RETRY.
|
||||
*
|
||||
* _RETRY builtins indicate failure with a special return value that
|
||||
* depends on the return type:
|
||||
*
|
||||
* BOOL_RETRY: JSVAL_TO_BOOLEAN(JSVAL_VOID)
|
||||
* INT32_RETRY: any negative value
|
||||
* STRING_RETRY: NULL
|
||||
* OBJECT_RETRY_NULL: NULL
|
||||
* JSVAL_RETRY: JSVAL_ERROR_COOKIE
|
||||
*
|
||||
* _RETRY function calls are faster than _FAIL calls. Each _RETRY call
|
||||
* saves a write to cx->bailExit and a read from cx->builtinStatus.
|
||||
*
|
||||
* - All other traceable natives are infallible (e.g. Date.now, Math.log).
|
||||
*
|
||||
* Special builtins known to the tracer can have their own idiosyncratic
|
||||
* error codes.
|
||||
|
@ -142,29 +170,35 @@ struct JSTraceableNative {
|
|||
* effects.
|
||||
*/
|
||||
#define _JS_CTYPE(ctype, size, pch, ach, flags) (ctype, size, pch, ach, flags)
|
||||
#define _JS_CTYPE_CONTEXT _JS_CTYPE(JSContext *, _JS_PTR,"C", "", INFALLIBLE)
|
||||
#define _JS_CTYPE_RUNTIME _JS_CTYPE(JSRuntime *, _JS_PTR,"R", "", INFALLIBLE)
|
||||
#define _JS_CTYPE_THIS _JS_CTYPE(JSObject *, _JS_PTR,"T", "", INFALLIBLE)
|
||||
#define _JS_CTYPE_THIS_DOUBLE _JS_CTYPE(jsdouble, _JS_F64,"D", "", INFALLIBLE)
|
||||
#define _JS_CTYPE_THIS_STRING _JS_CTYPE(JSString *, _JS_PTR,"S", "", INFALLIBLE)
|
||||
#define _JS_CTYPE_PC _JS_CTYPE(jsbytecode *, _JS_PTR,"P", "", INFALLIBLE)
|
||||
#define _JS_CTYPE_JSVAL _JS_CTYPE(jsval, _JS_PTR, "","v", INFALLIBLE)
|
||||
#define _JS_CTYPE_JSVAL_FAIL _JS_CTYPE(jsval, _JS_PTR, --, --, FAIL_JSVAL)
|
||||
#define _JS_CTYPE_BOOL _JS_CTYPE(JSBool, _JS_I32, "","i", INFALLIBLE)
|
||||
#define _JS_CTYPE_BOOL_FAIL _JS_CTYPE(int32, _JS_I32, --, --, FAIL_VOID)
|
||||
#define _JS_CTYPE_INT32 _JS_CTYPE(int32, _JS_I32, "","i", INFALLIBLE)
|
||||
#define _JS_CTYPE_INT32_FAIL _JS_CTYPE(int32, _JS_I32, --, --, FAIL_NEG)
|
||||
#define _JS_CTYPE_UINT32 _JS_CTYPE(uint32, _JS_I32, --, --, INFALLIBLE)
|
||||
#define _JS_CTYPE_DOUBLE _JS_CTYPE(jsdouble, _JS_F64, "","d", INFALLIBLE)
|
||||
#define _JS_CTYPE_STRING _JS_CTYPE(JSString *, _JS_PTR, "","s", INFALLIBLE)
|
||||
#define _JS_CTYPE_STRING_FAIL _JS_CTYPE(JSString *, _JS_PTR, --, --, FAIL_NULL)
|
||||
#define _JS_CTYPE_OBJECT _JS_CTYPE(JSObject *, _JS_PTR, "","o", INFALLIBLE)
|
||||
#define _JS_CTYPE_OBJECT_FAIL_NULL _JS_CTYPE(JSObject *, _JS_PTR, --, --, FAIL_NULL)
|
||||
#define _JS_CTYPE_REGEXP _JS_CTYPE(JSObject *, _JS_PTR, "","r", INFALLIBLE)
|
||||
#define _JS_CTYPE_SCOPEPROP _JS_CTYPE(JSScopeProperty *, _JS_PTR, --, --, INFALLIBLE)
|
||||
#define _JS_CTYPE_SIDEEXIT _JS_CTYPE(SideExit *, _JS_PTR, --, --, INFALLIBLE)
|
||||
#define _JS_CTYPE_INTERPSTATE _JS_CTYPE(InterpState *, _JS_PTR, --, --, INFALLIBLE)
|
||||
#define _JS_CTYPE_FRAGMENT _JS_CTYPE(nanojit::Fragment *, _JS_PTR, --, --, INFALLIBLE)
|
||||
#define _JS_JSVAL_CTYPE(size, pch, ach, flags) (jsval, size, pch, ach, (flags | JSTN_UNBOX_AFTER))
|
||||
|
||||
#define _JS_CTYPE_CONTEXT _JS_CTYPE(JSContext *, _JS_PTR,"C", "", INFALLIBLE)
|
||||
#define _JS_CTYPE_RUNTIME _JS_CTYPE(JSRuntime *, _JS_PTR,"R", "", INFALLIBLE)
|
||||
#define _JS_CTYPE_THIS _JS_CTYPE(JSObject *, _JS_PTR,"T", "", INFALLIBLE)
|
||||
#define _JS_CTYPE_THIS_DOUBLE _JS_CTYPE(jsdouble, _JS_F64,"D", "", INFALLIBLE)
|
||||
#define _JS_CTYPE_THIS_STRING _JS_CTYPE(JSString *, _JS_PTR,"S", "", INFALLIBLE)
|
||||
#define _JS_CTYPE_PC _JS_CTYPE(jsbytecode *, _JS_PTR,"P", "", INFALLIBLE)
|
||||
#define _JS_CTYPE_JSVAL _JS_JSVAL_CTYPE( _JS_PTR, "","v", INFALLIBLE)
|
||||
#define _JS_CTYPE_JSVAL_RETRY _JS_JSVAL_CTYPE( _JS_PTR, --, --, FAIL_COOKIE)
|
||||
#define _JS_CTYPE_JSVAL_FAIL _JS_JSVAL_CTYPE( _JS_PTR, --, --, FAIL_STATUS)
|
||||
#define _JS_CTYPE_BOOL _JS_CTYPE(JSBool, _JS_I32, "","i", INFALLIBLE)
|
||||
#define _JS_CTYPE_BOOL_RETRY _JS_CTYPE(int32, _JS_I32, --, --, FAIL_VOID)
|
||||
#define _JS_CTYPE_BOOL_FAIL _JS_CTYPE(int32, _JS_I32, --, --, FAIL_STATUS)
|
||||
#define _JS_CTYPE_INT32 _JS_CTYPE(int32, _JS_I32, "","i", INFALLIBLE)
|
||||
#define _JS_CTYPE_INT32_RETRY _JS_CTYPE(int32, _JS_I32, --, --, FAIL_NEG)
|
||||
#define _JS_CTYPE_UINT32 _JS_CTYPE(uint32, _JS_I32, --, --, INFALLIBLE)
|
||||
#define _JS_CTYPE_DOUBLE _JS_CTYPE(jsdouble, _JS_F64, "","d", INFALLIBLE)
|
||||
#define _JS_CTYPE_STRING _JS_CTYPE(JSString *, _JS_PTR, "","s", INFALLIBLE)
|
||||
#define _JS_CTYPE_STRING_RETRY _JS_CTYPE(JSString *, _JS_PTR, --, --, FAIL_NULL)
|
||||
#define _JS_CTYPE_STRING_FAIL _JS_CTYPE(JSString *, _JS_PTR, --, --, FAIL_STATUS)
|
||||
#define _JS_CTYPE_OBJECT _JS_CTYPE(JSObject *, _JS_PTR, "","o", INFALLIBLE)
|
||||
#define _JS_CTYPE_OBJECT_RETRY_NULL _JS_CTYPE(JSObject *, _JS_PTR, --, --, FAIL_NULL)
|
||||
#define _JS_CTYPE_OBJECT_FAIL _JS_CTYPE(JSObject *, _JS_PTR, --, --, FAIL_STATUS)
|
||||
#define _JS_CTYPE_REGEXP _JS_CTYPE(JSObject *, _JS_PTR, "","r", INFALLIBLE)
|
||||
#define _JS_CTYPE_SCOPEPROP _JS_CTYPE(JSScopeProperty *, _JS_PTR, --, --, INFALLIBLE)
|
||||
#define _JS_CTYPE_SIDEEXIT _JS_CTYPE(SideExit *, _JS_PTR, --, --, INFALLIBLE)
|
||||
#define _JS_CTYPE_INTERPSTATE _JS_CTYPE(InterpState *, _JS_PTR, --, --, INFALLIBLE)
|
||||
#define _JS_CTYPE_FRAGMENT _JS_CTYPE(nanojit::Fragment *, _JS_PTR, --, --, INFALLIBLE)
|
||||
|
||||
#define _JS_EXPAND(tokens) tokens
|
||||
|
||||
|
|
|
@ -93,6 +93,9 @@ typedef struct JSGSNCache {
|
|||
#define JS_CLEAR_GSN_CACHE(cx) GSN_CACHE_CLEAR(&JS_GSN_CACHE(cx))
|
||||
#define JS_METER_GSN_CACHE(cx,cnt) GSN_CACHE_METER(&JS_GSN_CACHE(cx), cnt)
|
||||
|
||||
typedef struct InterpState InterpState;
|
||||
typedef struct VMSideExit VMSideExit;
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace nanojit {
|
||||
class Fragment;
|
||||
|
@ -128,8 +131,27 @@ typedef struct JSTraceMonitor {
|
|||
* both interpreter activation and last-ditch garbage collection when up
|
||||
* against our runtime's memory limits. This flag also suppresses calls to
|
||||
* JS_ReportOutOfMemory when failing due to runtime limits.
|
||||
*
|
||||
* !onTrace && !recorder: not on trace.
|
||||
* onTrace && recorder: recording a trace.
|
||||
* onTrace && !recorder: executing a trace.
|
||||
* !onTrace && recorder && !prohibitRecording:
|
||||
* not on trace; deep-aborted while recording.
|
||||
* !onTrace && recorder && prohibitRecording:
|
||||
* not on trace; deep-bailed in SpiderMonkey code called from a
|
||||
* trace. JITted code is on the stack.
|
||||
*/
|
||||
JSBool onTrace;
|
||||
JSPackedBool onTrace;
|
||||
|
||||
/*
|
||||
* Do not start recording after a deep bail. That would free JITted code
|
||||
* pages that we will later return to.
|
||||
*/
|
||||
JSPackedBool prohibitRecording;
|
||||
|
||||
/* See reservedObjects below. */
|
||||
JSPackedBool useReservedObjects;
|
||||
|
||||
CLS(nanojit::LirBuffer) lirbuf;
|
||||
CLS(nanojit::Fragmento) fragmento;
|
||||
CLS(TraceRecorder) recorder;
|
||||
|
@ -145,7 +167,6 @@ typedef struct JSTraceMonitor {
|
|||
* The JIT uses this to ensure that leaving a trace tree can't fail.
|
||||
*/
|
||||
JSObject *reservedObjects;
|
||||
JSBool useReservedObjects;
|
||||
|
||||
/* Fragmento for the regular expression compiler. This is logically
|
||||
* a distinct compiler but needs to be managed in exactly the same
|
||||
|
@ -157,6 +178,8 @@ typedef struct JSTraceMonitor {
|
|||
CLS(TraceRecorder) abortStack;
|
||||
} JSTraceMonitor;
|
||||
|
||||
typedef struct InterpStruct InterpStruct;
|
||||
|
||||
#ifdef JS_TRACER
|
||||
# define JS_ON_TRACE(cx) (JS_TRACE_MONITOR(cx).onTrace)
|
||||
#else
|
||||
|
@ -260,6 +283,14 @@ typedef enum JSRuntimeState {
|
|||
JSRTS_LANDING
|
||||
} JSRuntimeState;
|
||||
|
||||
#ifdef JS_TRACER
|
||||
typedef enum JSBuiltinStatus {
|
||||
JSBUILTIN_OK = 0,
|
||||
JSBUILTIN_BAILED = 1,
|
||||
JSBUILTIN_ERROR = 2
|
||||
} JSBuiltinStatus;
|
||||
#endif
|
||||
|
||||
typedef enum JSBuiltinFunctionId {
|
||||
JSBUILTIN_ObjectToIterator,
|
||||
JSBUILTIN_CallIteratorNext,
|
||||
|
@ -980,8 +1011,31 @@ struct JSContext {
|
|||
|
||||
/* Stored here to avoid passing it around as a parameter. */
|
||||
uintN resolveFlags;
|
||||
|
||||
/* Current bytecode location (or NULL if no hint was supplied). */
|
||||
jsbytecode *pcHint;
|
||||
|
||||
#ifdef JS_TRACER
|
||||
/*
|
||||
* State for the current tree execution. bailExit is valid if the tree has
|
||||
* called back into native code via a _FAIL builtin and has not yet bailed,
|
||||
* else garbage (NULL in debug builds).
|
||||
*/
|
||||
InterpState *interpState;
|
||||
VMSideExit *bailExit;
|
||||
|
||||
/*
|
||||
* Used by _FAIL builtins; see jsbuiltins.h. The builtin sets the
|
||||
* JSBUILTIN_BAILED bit if it bails off trace and the JSBUILTIN_ERROR bit
|
||||
* if an error or exception occurred. Cleared on side exit.
|
||||
*/
|
||||
uint32 builtinStatus;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define BEGIN_PC_HINT(pc) (cx->pcHint = (pc))
|
||||
#define END_PC_HINT() (cx->pcHint = NULL)
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
# define JS_THREAD_ID(cx) ((cx)->thread ? (cx)->thread->id : 0)
|
||||
#endif
|
||||
|
|
|
@ -2031,7 +2031,7 @@ static JSFunctionSpec date_static_methods[] = {
|
|||
};
|
||||
|
||||
JS_DEFINE_TRCINFO_1(date_valueOf,
|
||||
(3, (static, JSVAL_FAIL, date_valueOf_tn, CONTEXT, THIS, STRING, 0, 0)))
|
||||
(3, (static, JSVAL_RETRY, date_valueOf_tn, CONTEXT, THIS, STRING, 0, 0)))
|
||||
|
||||
static JSFunctionSpec date_methods[] = {
|
||||
JS_FN("getTime", date_getTime, 0,0),
|
||||
|
|
|
@ -1242,36 +1242,29 @@ JS_EvaluateUCInStackFrame(JSContext *cx, JSStackFrame *fp,
|
|||
jsval *rval)
|
||||
{
|
||||
JSObject *scobj;
|
||||
JSScript *script, *oldscript;
|
||||
JSStackFrame **disp, *displaySave;
|
||||
JSScript *script;
|
||||
JSBool ok;
|
||||
|
||||
scobj = JS_GetFrameScopeChain(cx, fp);
|
||||
if (!scobj)
|
||||
return JS_FALSE;
|
||||
|
||||
oldscript = fp->script;
|
||||
/*
|
||||
* NB: This function breaks the assumption that the compiler can see all
|
||||
* calls and properly compute a static depth. In order to get around this,
|
||||
* we use a static depth that will cause us not to attempt to optimize
|
||||
* variable references made by this frame.
|
||||
*/
|
||||
script = js_CompileScript(cx, scobj, fp, JS_StackFramePrincipals(cx, fp),
|
||||
TCF_COMPILE_N_GO |
|
||||
TCF_PUT_STATIC_DEPTH(oldscript->staticDepth + 1),
|
||||
TCF_PUT_STATIC_DEPTH(JS_DISPLAY_SIZE),
|
||||
chars, length, NULL,
|
||||
filename, lineno);
|
||||
if (!script)
|
||||
return JS_FALSE;
|
||||
|
||||
/* Ensure that the display is up to date for this particular stack frame. */
|
||||
if (oldscript->staticDepth < JS_DISPLAY_SIZE) {
|
||||
disp = &cx->display[oldscript->staticDepth];
|
||||
displaySave = *disp;
|
||||
*disp = fp;
|
||||
} else {
|
||||
disp = NULL;
|
||||
displaySave = NULL;
|
||||
}
|
||||
ok = js_Execute(cx, scobj, script, fp, JSFRAME_DEBUGGER | JSFRAME_EVAL,
|
||||
rval);
|
||||
if (disp)
|
||||
*disp = displaySave;
|
||||
js_DestroyScript(cx, script);
|
||||
return ok;
|
||||
}
|
||||
|
|
|
@ -1705,7 +1705,6 @@ EmitIndexOp(JSContext *cx, JSOp op, uintN index, JSCodeGenerator *cg)
|
|||
return JS_FALSE; \
|
||||
JS_END_MACRO
|
||||
|
||||
|
||||
static JSBool
|
||||
EmitAtomOp(JSContext *cx, JSParseNode *pn, JSOp op, JSCodeGenerator *cg)
|
||||
{
|
||||
|
@ -1892,7 +1891,7 @@ BindNameToSlot(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
|||
* Optimize access to function's arguments and variable and the
|
||||
* arguments object.
|
||||
*/
|
||||
if (PN_OP(pn) != JSOP_NAME || cg->staticDepth > JS_DISPLAY_SIZE)
|
||||
if (PN_OP(pn) != JSOP_NAME || cg->staticDepth >= JS_DISPLAY_SIZE)
|
||||
goto arguments_check;
|
||||
localKind = js_LookupLocal(cx, caller->fun, atom, &index);
|
||||
if (localKind == JSLOCAL_NONE)
|
||||
|
@ -2339,12 +2338,41 @@ EmitXMLName(JSContext *cx, JSParseNode *pn, JSOp op, JSCodeGenerator *cg)
|
|||
}
|
||||
#endif
|
||||
|
||||
static JSBool
|
||||
EmitSpecialPropOp(JSContext *cx, JSParseNode *pn, JSOp op, JSCodeGenerator *cg)
|
||||
{
|
||||
/*
|
||||
* Special case for obj.__proto__, obj.__parent__, obj.__count__ to
|
||||
* deoptimize away from fast paths in the interpreter and trace recorder,
|
||||
* which skip dense array instances by going up to Array.prototype before
|
||||
* looking up the property name.
|
||||
*/
|
||||
JSAtomListElement *ale = js_IndexAtom(cx, pn->pn_atom, &cg->atomList);
|
||||
if (!ale)
|
||||
return JS_FALSE;
|
||||
if (!EmitIndexOp(cx, JSOP_QNAMEPART, ALE_INDEX(ale), cg))
|
||||
return JS_FALSE;
|
||||
if (js_Emit1(cx, cg, op) < 0)
|
||||
return JS_FALSE;
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
EmitPropOp(JSContext *cx, JSParseNode *pn, JSOp op, JSCodeGenerator *cg,
|
||||
JSBool callContext)
|
||||
{
|
||||
JSParseNode *pn2, *pndot, *pnup, *pndown;
|
||||
ptrdiff_t top;
|
||||
|
||||
/* Special case deoptimization on __proto__, __count__ and __parent__. */
|
||||
if (pn->pn_arity == PN_NAME &&
|
||||
(pn->pn_atom == cx->runtime->atomState.protoAtom ||
|
||||
pn->pn_atom == cx->runtime->atomState.countAtom ||
|
||||
pn->pn_atom == cx->runtime->atomState.parentAtom)) {
|
||||
if (pn->pn_expr && !js_EmitTree(cx, cg, pn->pn_expr))
|
||||
return JS_FALSE;
|
||||
return EmitSpecialPropOp(cx, pn, callContext ? JSOP_CALLELEM : JSOP_GETELEM, cg);
|
||||
}
|
||||
|
||||
pn2 = pn->pn_expr;
|
||||
if (callContext) {
|
||||
|
@ -2425,8 +2453,20 @@ EmitPropOp(JSContext *cx, JSParseNode *pn, JSOp op, JSCodeGenerator *cg,
|
|||
CG_OFFSET(cg) - pndown->pn_offset) < 0) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
if (!EmitAtomOp(cx, pndot, PN_OP(pndot), cg))
|
||||
|
||||
/*
|
||||
* Special case deoptimization on __proto__, __count__ and
|
||||
* __parent__, as above.
|
||||
*/
|
||||
if (pndot->pn_arity == PN_NAME &&
|
||||
(pndot->pn_atom == cx->runtime->atomState.protoAtom ||
|
||||
pndot->pn_atom == cx->runtime->atomState.countAtom ||
|
||||
pndot->pn_atom == cx->runtime->atomState.parentAtom)) {
|
||||
if (!EmitSpecialPropOp(cx, pndot, JSOP_GETELEM, cg))
|
||||
return JS_FALSE;
|
||||
} else if (!EmitAtomOp(cx, pndot, PN_OP(pndot), cg)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
/* Reverse the pn_expr link again. */
|
||||
pnup = pndot->pn_expr;
|
||||
|
@ -5338,6 +5378,11 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
|||
if (pn2->pn_atom == cx->runtime->atomState.lengthAtom) {
|
||||
if (js_Emit1(cx, cg, JSOP_LENGTH) < 0)
|
||||
return JS_FALSE;
|
||||
} else if (pn2->pn_atom == cx->runtime->atomState.protoAtom) {
|
||||
if (!EmitIndexOp(cx, JSOP_QNAMEPART, atomIndex, cg))
|
||||
return JS_FALSE;
|
||||
if (js_Emit1(cx, cg, JSOP_GETELEM) < 0)
|
||||
return JS_FALSE;
|
||||
} else {
|
||||
EMIT_INDEX_OP(JSOP_GETPROP, atomIndex);
|
||||
}
|
||||
|
|
|
@ -3457,8 +3457,8 @@ js_GC(JSContext *cx, JSGCInvocationKind gckind)
|
|||
#ifdef JS_TRACER
|
||||
if (JS_ON_TRACE(cx))
|
||||
goto out;
|
||||
VOUCH_HAVE_STACK();
|
||||
#endif
|
||||
VOUCH_HAVE_STACK();
|
||||
|
||||
/* Reset malloc counter. */
|
||||
rt->gcMallocBytes = 0;
|
||||
|
|
|
@ -1372,7 +1372,7 @@ bad:
|
|||
goto out2;
|
||||
}
|
||||
|
||||
JS_REQUIRES_STACK JSBool
|
||||
JSBool
|
||||
js_InternalInvoke(JSContext *cx, JSObject *obj, jsval fval, uintN flags,
|
||||
uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
|
@ -1380,6 +1380,7 @@ js_InternalInvoke(JSContext *cx, JSObject *obj, jsval fval, uintN flags,
|
|||
void *mark;
|
||||
JSBool ok;
|
||||
|
||||
js_LeaveTrace(cx);
|
||||
invokevp = js_AllocStack(cx, 2 + argc, &mark);
|
||||
if (!invokevp)
|
||||
return JS_FALSE;
|
||||
|
@ -1601,63 +1602,84 @@ js_CheckRedeclaration(JSContext *cx, JSObject *obj, jsid id, uintN attrs,
|
|||
jsval value;
|
||||
const char *type, *name;
|
||||
|
||||
/*
|
||||
* Both objp and propp must be either null or given. When given, *propp
|
||||
* must be null. This way we avoid an extra "if (propp) *propp = NULL" for
|
||||
* the common case of a non-existing property.
|
||||
*/
|
||||
JS_ASSERT(!objp == !propp);
|
||||
JS_ASSERT_IF(propp, !*propp);
|
||||
|
||||
/* The JSPROP_INITIALIZER case below may generate a warning. Since we must
|
||||
* drop the property before reporting it, we insists on !propp to avoid
|
||||
* looking up the property again after the reporting is done.
|
||||
*/
|
||||
JS_ASSERT_IF(attrs & JSPROP_INITIALIZER, attrs == JSPROP_INITIALIZER);
|
||||
JS_ASSERT_IF(attrs == JSPROP_INITIALIZER, !propp);
|
||||
|
||||
if (!OBJ_LOOKUP_PROPERTY(cx, obj, id, &obj2, &prop))
|
||||
return JS_FALSE;
|
||||
if (propp) {
|
||||
*objp = obj2;
|
||||
*propp = prop;
|
||||
}
|
||||
if (!prop)
|
||||
return JS_TRUE;
|
||||
|
||||
/*
|
||||
* Use prop as a speedup hint to OBJ_GET_ATTRIBUTES, but drop it on error.
|
||||
* An assertion at label bad: will insist that it is null.
|
||||
*/
|
||||
/* Use prop as a speedup hint to OBJ_GET_ATTRIBUTES. */
|
||||
if (!OBJ_GET_ATTRIBUTES(cx, obj2, id, prop, &oldAttrs)) {
|
||||
OBJ_DROP_PROPERTY(cx, obj2, prop);
|
||||
#ifdef DEBUG
|
||||
prop = NULL;
|
||||
#endif
|
||||
goto bad;
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* From here, return true, or else goto bad on failure to null out params.
|
||||
* If our caller doesn't want prop, drop it (we don't need it any longer).
|
||||
*/
|
||||
if (!propp) {
|
||||
OBJ_DROP_PROPERTY(cx, obj2, prop);
|
||||
prop = NULL;
|
||||
} else {
|
||||
*objp = obj2;
|
||||
*propp = prop;
|
||||
}
|
||||
|
||||
if (attrs == JSPROP_INITIALIZER) {
|
||||
/* Allow the new object to override properties. */
|
||||
if (obj2 != obj)
|
||||
return JS_TRUE;
|
||||
|
||||
/* The property must be dropped already. */
|
||||
JS_ASSERT(!prop);
|
||||
report = JSREPORT_WARNING | JSREPORT_STRICT;
|
||||
} else {
|
||||
/* We allow redeclaring some non-readonly properties. */
|
||||
if (((oldAttrs | attrs) & JSPROP_READONLY) == 0) {
|
||||
/*
|
||||
* Allow redeclaration of variables and functions, but insist that
|
||||
* the new value is not a getter if the old value was, ditto for
|
||||
* setters -- unless prop is impermanent (in which case anyone
|
||||
* could delete it and redefine it, willy-nilly).
|
||||
*/
|
||||
/* Allow redeclaration of variables and functions. */
|
||||
if (!(attrs & (JSPROP_GETTER | JSPROP_SETTER)))
|
||||
return JS_TRUE;
|
||||
|
||||
/*
|
||||
* Allow adding a getter only if a property already has a setter
|
||||
* but no getter and similarly for adding a setter. That is, we
|
||||
* allow only the following transitions:
|
||||
*
|
||||
* no-property --> getter --> getter + setter
|
||||
* no-property --> setter --> getter + setter
|
||||
*/
|
||||
if ((~(oldAttrs ^ attrs) & (JSPROP_GETTER | JSPROP_SETTER)) == 0)
|
||||
return JS_TRUE;
|
||||
|
||||
/*
|
||||
* Allow redeclaration of an impermanent property (in which case
|
||||
* anyone could delete it and redefine it, willy-nilly).
|
||||
*/
|
||||
if (!(oldAttrs & JSPROP_PERMANENT))
|
||||
return JS_TRUE;
|
||||
}
|
||||
if (prop)
|
||||
OBJ_DROP_PROPERTY(cx, obj2, prop);
|
||||
|
||||
report = JSREPORT_ERROR;
|
||||
isFunction = (oldAttrs & (JSPROP_GETTER | JSPROP_SETTER)) != 0;
|
||||
if (!isFunction) {
|
||||
if (!OBJ_GET_PROPERTY(cx, obj, id, &value))
|
||||
goto bad;
|
||||
return JS_FALSE;
|
||||
isFunction = VALUE_IS_FUNCTION(cx, value);
|
||||
}
|
||||
}
|
||||
|
@ -1675,19 +1697,11 @@ js_CheckRedeclaration(JSContext *cx, JSObject *obj, jsid id, uintN attrs,
|
|||
: js_var_str;
|
||||
name = js_ValueToPrintableString(cx, ID_TO_VALUE(id));
|
||||
if (!name)
|
||||
goto bad;
|
||||
return JS_FALSE;
|
||||
return JS_ReportErrorFlagsAndNumber(cx, report,
|
||||
js_GetErrorMessage, NULL,
|
||||
JSMSG_REDECLARED_VAR,
|
||||
type, name);
|
||||
|
||||
bad:
|
||||
if (propp) {
|
||||
*objp = NULL;
|
||||
*propp = NULL;
|
||||
}
|
||||
JS_ASSERT(!prop);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -5655,6 +5669,7 @@ js_Interpret(JSContext *cx)
|
|||
|
||||
/* Lookup id in order to check for redeclaration problems. */
|
||||
id = ATOM_TO_JSID(atom);
|
||||
prop = NULL;
|
||||
if (!js_CheckRedeclaration(cx, obj, id, attrs, &obj2, &prop))
|
||||
goto error;
|
||||
|
||||
|
@ -5677,11 +5692,11 @@ js_Interpret(JSContext *cx)
|
|||
*/
|
||||
if (!fp->fun &&
|
||||
index < GlobalVarCount(fp) &&
|
||||
(attrs & JSPROP_PERMANENT) &&
|
||||
obj2 == obj &&
|
||||
OBJ_IS_NATIVE(obj)) {
|
||||
sprop = (JSScopeProperty *) prop;
|
||||
if (SPROP_HAS_VALID_SLOT(sprop, OBJ_SCOPE(obj)) &&
|
||||
if ((sprop->attrs & JSPROP_PERMANENT) &&
|
||||
SPROP_HAS_VALID_SLOT(sprop, OBJ_SCOPE(obj)) &&
|
||||
SPROP_HAS_STUB_GETTER(sprop) &&
|
||||
SPROP_HAS_STUB_SETTER(sprop)) {
|
||||
/*
|
||||
|
@ -6877,6 +6892,9 @@ js_Interpret(JSContext *cx)
|
|||
#endif /* !JS_THREADED_INTERP */
|
||||
|
||||
error:
|
||||
// Reset current pc location hinting.
|
||||
cx->pcHint = NULL;
|
||||
|
||||
if (fp->imacpc && cx->throwing) {
|
||||
// To keep things simple, we hard-code imacro exception handlers here.
|
||||
if (*fp->imacpc == JSOP_NEXTITER) {
|
||||
|
|
|
@ -327,10 +327,20 @@ js_SetProtoOrParent(JSContext *cx, JSObject *obj, uint32 slot, JSObject *pobj)
|
|||
return JS_FALSE;
|
||||
}
|
||||
|
||||
// Maintain the "any Array prototype has indexed properties hazard" flag.
|
||||
/*
|
||||
* Maintain the "any Array prototype has indexed properties hazard" flag by
|
||||
* conservatively setting it. We simply don't know what pobj has in the way
|
||||
* of indexed properties, either directly or along its prototype chain, and
|
||||
* we won't expend effort here to find out. We do know that if obj is not
|
||||
* an array or a prototype (delegate), then we're ok. And, of course, pobj
|
||||
* must be non-null.
|
||||
*
|
||||
* This pessimistic approach could be improved, but setting __proto__ is
|
||||
* quite rare and arguably deserving of deoptimization.
|
||||
*/
|
||||
if (slot == JSSLOT_PROTO &&
|
||||
OBJ_IS_ARRAY(cx, pobj) &&
|
||||
pobj->fslots[JSSLOT_ARRAY_LENGTH] != 0) {
|
||||
pobj &&
|
||||
(OBJ_IS_ARRAY(cx, obj) || OBJ_IS_DELEGATE(cx, obj))) {
|
||||
rt->anyArrayProtoHasElement = JS_TRUE;
|
||||
}
|
||||
return JS_TRUE;
|
||||
|
@ -1682,10 +1692,12 @@ Object_p_hasOwnProperty(JSContext* cx, JSObject* obj, JSString *str)
|
|||
jsid id;
|
||||
jsval v;
|
||||
|
||||
if (!js_ValueToStringId(cx, STRING_TO_JSVAL(str), &id))
|
||||
return JSVAL_TO_BOOLEAN(JSVAL_VOID);
|
||||
if (!js_HasOwnProperty(cx, obj->map->ops->lookupProperty, obj, id, &v))
|
||||
if (!js_ValueToStringId(cx, STRING_TO_JSVAL(str), &id) ||
|
||||
!js_HasOwnProperty(cx, obj->map->ops->lookupProperty, obj, id, &v)) {
|
||||
cx->builtinStatus |= JSBUILTIN_ERROR;
|
||||
return JSVAL_TO_BOOLEAN(JSVAL_VOID);
|
||||
}
|
||||
|
||||
JS_ASSERT(JSVAL_IS_BOOLEAN(v));
|
||||
return JSVAL_TO_BOOLEAN(v);
|
||||
}
|
||||
|
@ -1725,8 +1737,12 @@ Object_p_propertyIsEnumerable(JSContext* cx, JSObject* obj, JSString *str)
|
|||
{
|
||||
jsid id = ATOM_TO_JSID(STRING_TO_JSVAL(str));
|
||||
jsval v;
|
||||
if (!js_PropertyIsEnumerable(cx, obj, id, &v))
|
||||
|
||||
if (!js_PropertyIsEnumerable(cx, obj, id, &v)) {
|
||||
cx->builtinStatus |= JSBUILTIN_ERROR;
|
||||
return JSVAL_TO_BOOLEAN(JSVAL_VOID);
|
||||
}
|
||||
|
||||
JS_ASSERT(JSVAL_IS_BOOLEAN(v));
|
||||
return JSVAL_TO_BOOLEAN(v);
|
||||
}
|
||||
|
@ -1932,11 +1948,11 @@ const char js_lookupSetter_str[] = "__lookupSetter__";
|
|||
#endif
|
||||
|
||||
JS_DEFINE_TRCINFO_1(obj_valueOf,
|
||||
(3, (static, JSVAL, Object_p_valueOf, CONTEXT, THIS, STRING, 0, 0)))
|
||||
(3, (static, JSVAL, Object_p_valueOf, CONTEXT, THIS, STRING, 0, 0)))
|
||||
JS_DEFINE_TRCINFO_1(obj_hasOwnProperty,
|
||||
(3, (static, BOOL_FAIL, Object_p_hasOwnProperty, CONTEXT, THIS, STRING, 0, 0)))
|
||||
(3, (static, BOOL_FAIL, Object_p_hasOwnProperty, CONTEXT, THIS, STRING, 0, 0)))
|
||||
JS_DEFINE_TRCINFO_1(obj_propertyIsEnumerable,
|
||||
(3, (static, BOOL_FAIL, Object_p_propertyIsEnumerable, CONTEXT, THIS, STRING, 0, 0)))
|
||||
(3, (static, BOOL_FAIL, Object_p_propertyIsEnumerable, CONTEXT, THIS, STRING, 0, 0)))
|
||||
|
||||
static JSFunctionSpec object_methods[] = {
|
||||
#if JS_HAS_TOSOURCE
|
||||
|
@ -3389,6 +3405,9 @@ js_DefineProperty(JSContext *cx, JSObject *obj, jsid id, jsval value,
|
|||
* nominal initial value of a slot-full property, while GC safety wants that
|
||||
* value to be stored before the call-out through the hook. Optimize to do
|
||||
* both while saving cycles for classes that stub their addProperty hook.
|
||||
*
|
||||
* As in js_SetProtoOrParent (see above), we maintain the "any Array prototype
|
||||
* has indexed properties hazard" flag by conservatively setting it.
|
||||
*/
|
||||
#define ADD_PROPERTY_HELPER(cx,clasp,obj,scope,sprop,vp,cleanup) \
|
||||
JS_BEGIN_MACRO \
|
||||
|
@ -3402,6 +3421,8 @@ js_DefineProperty(JSContext *cx, JSObject *obj, jsid id, jsval value,
|
|||
LOCKED_OBJ_WRITE_BARRIER(cx, obj, (sprop)->slot, *(vp)); \
|
||||
} \
|
||||
} \
|
||||
if (STOBJ_IS_DELEGATE(obj) && JSID_IS_INT(sprop->id)) \
|
||||
cx->runtime->anyArrayProtoHasElement = JS_TRUE; \
|
||||
JS_END_MACRO
|
||||
|
||||
JSBool
|
||||
|
@ -3896,6 +3917,29 @@ js_NativeSet(JSContext *cx, JSObject *obj, JSScopeProperty *sprop, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find out where we currently are in the code. If no hint was supplied,
|
||||
* de-optimize and consult the stack frame.
|
||||
*/
|
||||
static jsbytecode*
|
||||
js_GetCurrentBytecodePC(JSContext* cx)
|
||||
{
|
||||
jsbytecode *pc = cx->pcHint;
|
||||
if (!pc || !JS_ON_TRACE(cx)) {
|
||||
JSStackFrame* fp = js_GetTopStackFrame(cx);
|
||||
if (fp && fp->regs) {
|
||||
pc = fp->regs->pc;
|
||||
// FIXME: Set pc to imacpc when recording JSOP_CALL inside the
|
||||
// JSOP_GETELEM imacro (bug 476559).
|
||||
if (*pc == JSOP_CALL && fp->imacpc && *fp->imacpc == JSOP_GETELEM)
|
||||
pc = fp->imacpc;
|
||||
} else {
|
||||
pc = NULL;
|
||||
}
|
||||
}
|
||||
return pc;
|
||||
}
|
||||
|
||||
JSBool
|
||||
js_GetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
|
||||
JSPropCacheEntry **entryp)
|
||||
|
@ -3904,7 +3948,6 @@ js_GetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
|
|||
int protoIndex;
|
||||
JSObject *obj2;
|
||||
JSProperty *prop;
|
||||
JSStackFrame *fp;
|
||||
JSScopeProperty *sprop;
|
||||
|
||||
JS_ASSERT_IF(entryp, !JS_ON_TRACE(cx));
|
||||
|
@ -3918,8 +3961,6 @@ js_GetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
|
|||
if (protoIndex < 0)
|
||||
return JS_FALSE;
|
||||
if (!prop) {
|
||||
jsbytecode *pc;
|
||||
|
||||
*vp = JSVAL_VOID;
|
||||
|
||||
if (!OBJ_GET_CLASS(cx, obj)->getProperty(cx, obj, ID_TO_VALUE(id), vp))
|
||||
|
@ -3934,11 +3975,11 @@ js_GetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
|
|||
* Give a strict warning if foo.bar is evaluated by a script for an
|
||||
* object foo with no property named 'bar'.
|
||||
*/
|
||||
if (JSVAL_IS_VOID(*vp) && (fp = js_GetTopStackFrame(cx)) && fp->regs) {
|
||||
jsbytecode *pc;
|
||||
if (JSVAL_IS_VOID(*vp) && ((pc = js_GetCurrentBytecodePC(cx)) != NULL)) {
|
||||
JSOp op;
|
||||
uintN flags;
|
||||
|
||||
pc = fp->regs->pc;
|
||||
op = (JSOp) *pc;
|
||||
if (op == JSOP_GETXPROP) {
|
||||
flags = JSREPORT_ERROR;
|
||||
|
@ -3956,7 +3997,6 @@ js_GetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
|
|||
return JS_TRUE;
|
||||
|
||||
/* Kludge to allow (typeof foo == "undefined") tests. */
|
||||
JS_ASSERT(fp->script);
|
||||
pc += js_CodeSpec[op].length;
|
||||
if (Detecting(cx, pc))
|
||||
return JS_TRUE;
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
#include "jsregexp.h"
|
||||
#include "jsscan.h"
|
||||
#include "jsscope.h"
|
||||
#include "jsstaticcheck.h"
|
||||
#include "jsstr.h"
|
||||
|
||||
#ifdef JS_TRACER
|
||||
|
@ -3832,14 +3833,17 @@ MatchRegExp(REGlobalData *gData, REMatchState *x)
|
|||
gData->skipped = (ptrdiff_t) x->cp;
|
||||
|
||||
#ifdef JS_JIT_SPEW
|
||||
{
|
||||
JSStackFrame *caller = js_GetScriptedCaller(gData->cx, NULL);
|
||||
debug_only_v(printf("entering REGEXP trace at %s:%u@%u, code: %p\n",
|
||||
caller ? caller->script->filename : "<unknown>",
|
||||
caller ? js_FramePCToLineNumber(gData->cx, caller) : 0,
|
||||
caller ? FramePCOffset(caller) : 0,
|
||||
(void *) native););
|
||||
}
|
||||
debug_only_v({
|
||||
VOUCH_DOES_NOT_REQUIRE_STACK();
|
||||
JSStackFrame *caller = (JS_ON_TRACE(gData->cx))
|
||||
? NULL
|
||||
: js_GetScriptedCaller(gData->cx, NULL);
|
||||
printf("entering REGEXP trace at %s:%u@%u, code: %p\n",
|
||||
caller ? caller->script->filename : "<unknown>",
|
||||
caller ? js_FramePCToLineNumber(gData->cx, caller) : 0,
|
||||
caller ? FramePCOffset(caller) : 0,
|
||||
(void *) native);
|
||||
})
|
||||
#endif
|
||||
|
||||
#if defined(JS_NO_FASTCALL) && defined(NANOJIT_IA32)
|
||||
|
@ -4819,7 +4823,7 @@ Regexp_p_test(JSContext* cx, JSObject* regexp, JSString* str)
|
|||
}
|
||||
|
||||
JS_DEFINE_TRCINFO_1(regexp_test,
|
||||
(3, (static, BOOL_FAIL, Regexp_p_test, CONTEXT, THIS, STRING, 1, 1)))
|
||||
(3, (static, BOOL_RETRY, Regexp_p_test, CONTEXT, THIS, STRING, 1, 1)))
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1344,8 +1344,6 @@ match_or_replace(JSContext *cx,
|
|||
destroy(cx, data);
|
||||
}
|
||||
} else {
|
||||
jsval savedObject = JSVAL_NULL;
|
||||
|
||||
if (GET_MODE(data->flags) == MODE_REPLACE) {
|
||||
test = JS_TRUE;
|
||||
} else {
|
||||
|
@ -1353,10 +1351,7 @@ match_or_replace(JSContext *cx,
|
|||
* MODE_MATCH implies str_match is being called from a script or a
|
||||
* scripted function. If the caller cares only about testing null
|
||||
* vs. non-null return value, optimize away the array object that
|
||||
* would normally be returned in *vp. Instead return an arbitrary
|
||||
* object (not JSVAL_TRUE, for type map integrity; see bug 453564).
|
||||
* The caller provides the object in *vp and is responsible for
|
||||
* rooting it elsewhere.
|
||||
* would normally be returned in *vp.
|
||||
*
|
||||
* Assume a full array result is required, then prove otherwise.
|
||||
*/
|
||||
|
@ -1370,16 +1365,12 @@ match_or_replace(JSContext *cx,
|
|||
case JSOP_IFEQX:
|
||||
case JSOP_IFNEX:
|
||||
test = JS_TRUE;
|
||||
savedObject = *vp;
|
||||
JS_ASSERT(!JSVAL_IS_PRIMITIVE(savedObject));
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
}
|
||||
}
|
||||
ok = js_ExecuteRegExp(cx, re, str, &index, test, vp);
|
||||
if (ok && !JSVAL_IS_NULL(savedObject) && *vp == JSVAL_TRUE)
|
||||
*vp = savedObject;
|
||||
}
|
||||
|
||||
DROP_REGEXP(cx, re);
|
||||
|
@ -1454,9 +1445,6 @@ str_match(JSContext *cx, uintN argc, jsval *vp)
|
|||
|
||||
for (fp = js_GetTopStackFrame(cx); fp && !fp->regs; fp = fp->down)
|
||||
JS_ASSERT(!fp->script);
|
||||
|
||||
/* Root the object in vp[0]. See comment in match_or_replace. */
|
||||
JSAutoTempValueRooter tvr(cx, vp[0]);
|
||||
return StringMatchHelper(cx, argc, vp, fp ? fp->regs->pc : NULL);
|
||||
}
|
||||
|
||||
|
@ -1464,22 +1452,22 @@ str_match(JSContext *cx, uintN argc, jsval *vp)
|
|||
static jsval FASTCALL
|
||||
String_p_match(JSContext* cx, JSString* str, jsbytecode *pc, JSObject* regexp)
|
||||
{
|
||||
/* arbitrary object in vp[0] */
|
||||
jsval vp[3] = { OBJECT_TO_JSVAL(regexp), STRING_TO_JSVAL(str), OBJECT_TO_JSVAL(regexp) };
|
||||
if (!StringMatchHelper(cx, 1, vp, pc))
|
||||
return JSVAL_ERROR_COOKIE;
|
||||
JS_ASSERT(JSVAL_IS_OBJECT(vp[0]));
|
||||
jsval vp[3] = { JSVAL_NULL, STRING_TO_JSVAL(str), OBJECT_TO_JSVAL(regexp) };
|
||||
if (!StringMatchHelper(cx, 1, vp, pc)) {
|
||||
cx->builtinStatus |= JSBUILTIN_ERROR;
|
||||
return JSVAL_VOID;
|
||||
}
|
||||
return vp[0];
|
||||
}
|
||||
|
||||
static jsval FASTCALL
|
||||
String_p_match_obj(JSContext* cx, JSObject* str, jsbytecode *pc, JSObject* regexp)
|
||||
{
|
||||
/* arbitrary object in vp[0] */
|
||||
jsval vp[3] = { OBJECT_TO_JSVAL(regexp), OBJECT_TO_JSVAL(str), OBJECT_TO_JSVAL(regexp) };
|
||||
if (!StringMatchHelper(cx, 1, vp, pc))
|
||||
return JSVAL_ERROR_COOKIE;
|
||||
JS_ASSERT(JSVAL_IS_OBJECT(vp[0]));
|
||||
jsval vp[3] = { JSVAL_NULL, OBJECT_TO_JSVAL(str), OBJECT_TO_JSVAL(regexp) };
|
||||
if (!StringMatchHelper(cx, 1, vp, pc)) {
|
||||
cx->builtinStatus |= JSBUILTIN_ERROR;
|
||||
return JSVAL_VOID;
|
||||
}
|
||||
return vp[0];
|
||||
}
|
||||
#endif
|
||||
|
@ -2500,32 +2488,32 @@ JS_DEFINE_CALLINFO_2(extern, BOOL, js_EqualStrings, STRING, STRING,
|
|||
JS_DEFINE_CALLINFO_2(extern, INT32, js_CompareStrings, STRING, STRING, 1, 1)
|
||||
|
||||
JS_DEFINE_TRCINFO_1(str_toString,
|
||||
(2, (extern, STRING_FAIL, String_p_toString, CONTEXT, THIS, 1, 1)))
|
||||
(2, (extern, STRING_FAIL, String_p_toString, CONTEXT, THIS, 1, 1)))
|
||||
JS_DEFINE_TRCINFO_2(str_substring,
|
||||
(4, (static, STRING_FAIL, String_p_substring, CONTEXT, THIS_STRING, INT32, INT32, 1, 1)),
|
||||
(3, (static, STRING_FAIL, String_p_substring_1, CONTEXT, THIS_STRING, INT32, 1, 1)))
|
||||
(4, (static, STRING_RETRY, String_p_substring, CONTEXT, THIS_STRING, INT32, INT32, 1, 1)),
|
||||
(3, (static, STRING_RETRY, String_p_substring_1, CONTEXT, THIS_STRING, INT32, 1, 1)))
|
||||
JS_DEFINE_TRCINFO_1(str_charAt,
|
||||
(3, (extern, STRING_FAIL, js_String_getelem, CONTEXT, THIS_STRING, INT32, 1, 1)))
|
||||
(3, (extern, STRING_RETRY, js_String_getelem, CONTEXT, THIS_STRING, INT32, 1, 1)))
|
||||
JS_DEFINE_TRCINFO_1(str_charCodeAt,
|
||||
(2, (extern, INT32_FAIL, js_String_p_charCodeAt, THIS_STRING, INT32, 1, 1)))
|
||||
(2, (extern, INT32_RETRY, js_String_p_charCodeAt, THIS_STRING, INT32, 1, 1)))
|
||||
JS_DEFINE_TRCINFO_4(str_concat,
|
||||
(3, (static, STRING_FAIL, String_p_concat_1int, CONTEXT, THIS_STRING, INT32, 1, 1)),
|
||||
(3, (extern, STRING_FAIL, js_ConcatStrings, CONTEXT, THIS_STRING, STRING, 1, 1)),
|
||||
(4, (static, STRING_FAIL, String_p_concat_2str, CONTEXT, THIS_STRING, STRING, STRING, 1, 1)),
|
||||
(5, (static, STRING_FAIL, String_p_concat_3str, CONTEXT, THIS_STRING, STRING, STRING, STRING, 1, 1)))
|
||||
(3, (static, STRING_RETRY, String_p_concat_1int, CONTEXT, THIS_STRING, INT32, 1, 1)),
|
||||
(3, (extern, STRING_RETRY, js_ConcatStrings, CONTEXT, THIS_STRING, STRING, 1, 1)),
|
||||
(4, (static, STRING_RETRY, String_p_concat_2str, CONTEXT, THIS_STRING, STRING, STRING, 1, 1)),
|
||||
(5, (static, STRING_RETRY, String_p_concat_3str, CONTEXT, THIS_STRING, STRING, STRING, STRING, 1, 1)))
|
||||
JS_DEFINE_TRCINFO_2(str_match,
|
||||
(4, (static, JSVAL_FAIL, String_p_match, CONTEXT, THIS_STRING, PC, REGEXP, 1, 1)),
|
||||
(4, (static, JSVAL_FAIL, String_p_match_obj, CONTEXT, THIS, PC, REGEXP, 1, 1)))
|
||||
(4, (static, JSVAL_FAIL, String_p_match, CONTEXT, THIS_STRING, PC, REGEXP, 1, 1)),
|
||||
(4, (static, JSVAL_FAIL, String_p_match_obj, CONTEXT, THIS, PC, REGEXP, 1, 1)))
|
||||
JS_DEFINE_TRCINFO_3(str_replace,
|
||||
(4, (static, STRING_FAIL, String_p_replace_str, CONTEXT, THIS_STRING, REGEXP, STRING, 1, 1)),
|
||||
(4, (static, STRING_FAIL, String_p_replace_str2, CONTEXT, THIS_STRING, STRING, STRING, 1, 1)),
|
||||
(5, (static, STRING_FAIL, String_p_replace_str3, CONTEXT, THIS_STRING, STRING, STRING, STRING, 1, 1)))
|
||||
(4, (static, STRING_RETRY, String_p_replace_str, CONTEXT, THIS_STRING, REGEXP, STRING, 1, 1)),
|
||||
(4, (static, STRING_RETRY, String_p_replace_str2, CONTEXT, THIS_STRING, STRING, STRING, 1, 1)),
|
||||
(5, (static, STRING_RETRY, String_p_replace_str3, CONTEXT, THIS_STRING, STRING, STRING, STRING, 1, 1)))
|
||||
JS_DEFINE_TRCINFO_1(str_split,
|
||||
(3, (static, OBJECT_FAIL_NULL, String_p_split, CONTEXT, THIS_STRING, STRING, 0, 0)))
|
||||
(3, (static, OBJECT_RETRY_NULL, String_p_split, CONTEXT, THIS_STRING, STRING, 0, 0)))
|
||||
JS_DEFINE_TRCINFO_1(str_toLowerCase,
|
||||
(2, (extern, STRING_FAIL, js_toLowerCase, CONTEXT, THIS_STRING, 1, 1)))
|
||||
(2, (extern, STRING_RETRY, js_toLowerCase, CONTEXT, THIS_STRING, 1, 1)))
|
||||
JS_DEFINE_TRCINFO_1(str_toUpperCase,
|
||||
(2, (extern, STRING_FAIL, js_toUpperCase, CONTEXT, THIS_STRING, 1, 1)))
|
||||
(2, (extern, STRING_RETRY, js_toUpperCase, CONTEXT, THIS_STRING, 1, 1)))
|
||||
|
||||
#define GENERIC JSFUN_GENERIC_NATIVE
|
||||
#define PRIMITIVE JSFUN_THISP_PRIMITIVE
|
||||
|
@ -2662,7 +2650,7 @@ String_fromCharCode(JSContext* cx, int32 i)
|
|||
#endif
|
||||
|
||||
JS_DEFINE_TRCINFO_1(str_fromCharCode,
|
||||
(2, (static, STRING_FAIL, String_fromCharCode, CONTEXT, INT32, 1, 1)))
|
||||
(2, (static, STRING_RETRY, String_fromCharCode, CONTEXT, INT32, 1, 1)))
|
||||
|
||||
static JSFunctionSpec string_static_methods[] = {
|
||||
JS_TN("fromCharCode", str_fromCharCode, 1, 0, str_fromCharCode_trcinfo),
|
||||
|
|
|
@ -1218,7 +1218,7 @@ TraceRecorder::TraceRecorder(JSContext* cx, VMSideExit* _anchor, Fragment* _frag
|
|||
lirbuf->sp = addName(lir->insLoad(LIR_ldp, lirbuf->state, (int)offsetof(InterpState, sp)), "sp");
|
||||
lirbuf->rp = addName(lir->insLoad(LIR_ldp, lirbuf->state, offsetof(InterpState, rp)), "rp");
|
||||
cx_ins = addName(lir->insLoad(LIR_ldp, lirbuf->state, offsetof(InterpState, cx)), "cx");
|
||||
gp_ins = addName(lir->insLoad(LIR_ldp, lirbuf->state, offsetof(InterpState, gp)), "gp");
|
||||
gp_ins = addName(lir->insLoad(LIR_ldp, lirbuf->state, offsetof(InterpState, global)), "gp");
|
||||
eos_ins = addName(lir->insLoad(LIR_ldp, lirbuf->state, offsetof(InterpState, eos)), "eos");
|
||||
eor_ins = addName(lir->insLoad(LIR_ldp, lirbuf->state, offsetof(InterpState, eor)), "eor");
|
||||
globalObj_ins = addName(lir->insLoad(LIR_ldp, lirbuf->state, offsetof(InterpState, globalObj)), "globalObj");
|
||||
|
@ -1592,6 +1592,7 @@ NativeToValue(JSContext* cx, jsval& v, uint8 type, double* slot)
|
|||
JS_ASSERT(type == JSVAL_OBJECT);
|
||||
v = OBJECT_TO_JSVAL(*(JSObject**)slot);
|
||||
JS_ASSERT(JSVAL_TAG(v) == JSVAL_OBJECT); /* if this fails the pointer was not aligned */
|
||||
JS_ASSERT(v != JSVAL_ERROR_COOKIE); /* don't leak JSVAL_ERROR_COOKIE */
|
||||
debug_only_v(printf("object<%p:%s> ", JSVAL_TO_OBJECT(v),
|
||||
JSVAL_IS_NULL(v)
|
||||
? "null"
|
||||
|
@ -2097,7 +2098,7 @@ TraceRecorder::snapshot(ExitType exitType)
|
|||
|
||||
/* WARNING: don't return before restoring the original pc if (resumeAfter). */
|
||||
bool resumeAfter = (pendingTraceableNative &&
|
||||
JSTN_ERRTYPE(pendingTraceableNative) == FAIL_JSVAL);
|
||||
JSTN_ERRTYPE(pendingTraceableNative) == FAIL_STATUS);
|
||||
if (resumeAfter) {
|
||||
JS_ASSERT(*pc == JSOP_CALL || *pc == JSOP_APPLY);
|
||||
pc += cs.length;
|
||||
|
@ -2129,7 +2130,8 @@ TraceRecorder::snapshot(ExitType exitType)
|
|||
/* If we are capturing the stack state on a specific instruction, the value on
|
||||
the top of the stack is a boxed value. */
|
||||
if (resumeAfter) {
|
||||
typemap[stackSlots - 1] = JSVAL_BOXED;
|
||||
if (pendingTraceableNative->flags & JSTN_UNBOX_AFTER)
|
||||
typemap[stackSlots - 1] = JSVAL_BOXED;
|
||||
|
||||
/* Now restore the the original pc (after which early returns are ok). */
|
||||
MUST_FLOW_LABEL(restore_pc);
|
||||
|
@ -3008,7 +3010,7 @@ js_CheckGlobalObjectShape(JSContext* cx, JSTraceMonitor* tm, JSObject* globalObj
|
|||
|
||||
GlobalState &state = tm->globalStates[i];
|
||||
|
||||
if (state.globalShape == -1) {
|
||||
if (state.globalShape == (uint32) -1) {
|
||||
state.globalShape = globalShape;
|
||||
JS_ASSERT(state.globalSlots);
|
||||
JS_ASSERT(state.globalSlots->length() == 0);
|
||||
|
@ -3038,6 +3040,9 @@ js_StartRecorder(JSContext* cx, VMSideExit* anchor, Fragment* f, TreeInfo* ti,
|
|||
JSTraceMonitor* tm = &JS_TRACE_MONITOR(cx);
|
||||
JS_ASSERT(f->root != f || !cx->fp->imacpc);
|
||||
|
||||
if (JS_TRACE_MONITOR(cx).prohibitRecording)
|
||||
return false;
|
||||
|
||||
/* start recording if no exception during construction */
|
||||
tm->recorder = new (&gc) TraceRecorder(cx, anchor, f, ti,
|
||||
stackSlots, ngslots, typeMap,
|
||||
|
@ -3854,81 +3859,93 @@ js_FindVMCompatiblePeer(JSContext* cx, Fragment* f)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
LeaveTree(InterpState&, VMSideExit* lr);
|
||||
|
||||
/**
|
||||
* Executes a tree.
|
||||
*/
|
||||
static VMSideExit*
|
||||
js_ExecuteTree(JSContext* cx, Fragment* f, uintN& inlineCallCount,
|
||||
static JS_REQUIRES_STACK VMSideExit*
|
||||
js_ExecuteTree(JSContext* cx, Fragment* f, uintN& inlineCallCount,
|
||||
VMSideExit** innermostNestedGuardp)
|
||||
{
|
||||
JS_ASSERT(f->code() && f->vmprivate);
|
||||
JS_ASSERT(cx->builtinStatus == 0);
|
||||
|
||||
JSTraceMonitor* tm = &JS_TRACE_MONITOR(cx);
|
||||
JSObject* globalObj = JS_GetGlobalForObject(cx, cx->fp->scopeChain);
|
||||
TreeInfo* ti = (TreeInfo*)f->vmprivate;
|
||||
unsigned ngslots = ti->globalSlots->length();
|
||||
uint16* gslots = ti->globalSlots->data();
|
||||
unsigned globalFrameSize = STOBJ_NSLOTS(globalObj);
|
||||
double* global = (double*)alloca((globalFrameSize+1) * sizeof(double));
|
||||
double stack_buffer[MAX_NATIVE_STACK_SLOTS];
|
||||
double* stack = stack_buffer;
|
||||
|
||||
InterpState state;
|
||||
|
||||
state.cx = cx;
|
||||
state.globalObj = globalObj;
|
||||
state.inlineCallCountp = &inlineCallCount;
|
||||
state.innermostNestedGuardp = innermostNestedGuardp;
|
||||
state.outermostTree = ti;
|
||||
state.lastTreeExitGuard = NULL;
|
||||
state.lastTreeCallGuard = NULL;
|
||||
state.rpAtLastTreeCall = NULL;
|
||||
|
||||
/* Make sure the global object is sane. */
|
||||
JS_ASSERT(!ngslots || (OBJ_SHAPE(JS_GetGlobalForObject(cx, cx->fp->scopeChain)) == ti->globalShape));
|
||||
JS_ASSERT(!ngslots || (OBJ_SHAPE(JS_GetGlobalForObject(cx, cx->fp->scopeChain)) == ti->globalShape));
|
||||
/* Make sure our caller replenished the double pool. */
|
||||
JS_ASSERT(tm->reservedDoublePoolPtr >= tm->reservedDoublePool + MAX_NATIVE_STACK_SLOTS);
|
||||
|
||||
/* Reserve objects and stack space now, to make leaving the tree infallible. */
|
||||
void *reserve;
|
||||
void *stackMark = JS_ARENA_MARK(&cx->stackPool);
|
||||
if (!js_ReserveObjects(cx, MAX_CALL_STACK_ENTRIES))
|
||||
return NULL;
|
||||
|
||||
/* Setup the native global frame. */
|
||||
unsigned globalFrameSize = STOBJ_NSLOTS(globalObj);
|
||||
state.global = (double*)alloca((globalFrameSize+1) * sizeof(double));
|
||||
|
||||
/* Setup the native stack frame. */
|
||||
double stack_buffer[MAX_NATIVE_STACK_SLOTS];
|
||||
state.stackBase = stack_buffer;
|
||||
double* entry_sp = &stack_buffer[ti->nativeStackBase/sizeof(double)];
|
||||
state.sp = entry_sp;
|
||||
state.eos = state.sp + MAX_NATIVE_STACK_SLOTS;
|
||||
|
||||
/* Setup the native call stack frame. */
|
||||
FrameInfo* callstack_buffer[MAX_CALL_STACK_ENTRIES];
|
||||
state.callstackBase = callstack_buffer;
|
||||
state.rp = callstack_buffer;
|
||||
state.eor = callstack_buffer + MAX_CALL_STACK_ENTRIES;
|
||||
|
||||
void *reserve;
|
||||
state.stackMark = JS_ARENA_MARK(&cx->stackPool);
|
||||
JS_ARENA_ALLOCATE(reserve, &cx->stackPool, MAX_INTERP_STACK_BYTES);
|
||||
if (!reserve)
|
||||
return NULL;
|
||||
|
||||
#ifdef DEBUG
|
||||
bool jsframe_pop_blocks_set_on_entry = bool(cx->fp->flags & JSFRAME_POP_BLOCKS);
|
||||
state.jsframe_pop_blocks_set_on_entry = bool(cx->fp->flags & JSFRAME_POP_BLOCKS);
|
||||
memset(stack_buffer, 0xCD, sizeof(stack_buffer));
|
||||
memset(global, 0xCD, (globalFrameSize+1)*sizeof(double));
|
||||
#endif
|
||||
memset(state.global, 0xCD, (globalFrameSize+1)*sizeof(double));
|
||||
#endif
|
||||
|
||||
debug_only(*(uint64*)&global[globalFrameSize] = 0xdeadbeefdeadbeefLL;)
|
||||
debug_only(*(uint64*)&state.global[globalFrameSize] = 0xdeadbeefdeadbeefLL;)
|
||||
debug_only_v(printf("entering trace at %s:%u@%u, native stack slots: %u code: %p\n",
|
||||
cx->fp->script->filename,
|
||||
js_FramePCToLineNumber(cx, cx->fp),
|
||||
FramePCOffset(cx->fp),
|
||||
ti->maxNativeStackSlots,
|
||||
f->code());)
|
||||
|
||||
|
||||
JS_ASSERT(ti->nGlobalTypes() == ngslots);
|
||||
|
||||
if (ngslots)
|
||||
BuildNativeGlobalFrame(cx, ngslots, gslots, ti->globalTypeMap(), global);
|
||||
BuildNativeStackFrame(cx, 0/*callDepth*/, ti->typeMap.data(), stack);
|
||||
|
||||
double* entry_sp = &stack[ti->nativeStackBase/sizeof(double)];
|
||||
FrameInfo* callstack_buffer[MAX_CALL_STACK_ENTRIES];
|
||||
FrameInfo** callstack = callstack_buffer;
|
||||
if (ngslots)
|
||||
BuildNativeGlobalFrame(cx, ngslots, gslots, ti->globalTypeMap(), state.global);
|
||||
BuildNativeStackFrame(cx, 0/*callDepth*/, ti->typeMap.data(), stack_buffer);
|
||||
|
||||
InterpState state;
|
||||
state.sp = (void*)entry_sp;
|
||||
state.eos = ((double*)state.sp) + MAX_NATIVE_STACK_SLOTS;
|
||||
state.rp = callstack;
|
||||
state.eor = callstack + MAX_CALL_STACK_ENTRIES;
|
||||
state.gp = global;
|
||||
state.cx = cx;
|
||||
state.globalObj = globalObj;
|
||||
state.lastTreeExitGuard = NULL;
|
||||
state.lastTreeCallGuard = NULL;
|
||||
state.rpAtLastTreeCall = NULL;
|
||||
union { NIns *code; GuardRecord* (FASTCALL *func)(InterpState*, Fragment*); } u;
|
||||
u.code = f->code();
|
||||
|
||||
#ifdef JS_JIT_SPEW
|
||||
#if defined(NANOJIT_IA32) || (defined(NANOJIT_AMD64) && defined(__GNUC__))
|
||||
uint64 start = rdtsc();
|
||||
#endif
|
||||
#ifdef EXECUTE_TREE_TIMER
|
||||
state.startTime = rdtsc();
|
||||
#endif
|
||||
|
||||
/* Set a flag that indicates to the runtime system that we are running in native code
|
||||
|
@ -3937,7 +3954,8 @@ js_ExecuteTree(JSContext* cx, Fragment* f, uintN& inlineCallCount,
|
|||
and eventually triggers the GC. */
|
||||
JS_ASSERT(!tm->onTrace);
|
||||
tm->onTrace = true;
|
||||
|
||||
cx->interpState = &state;
|
||||
|
||||
debug_only(fflush(NULL);)
|
||||
GuardRecord* rec;
|
||||
#if defined(JS_NO_FASTCALL) && defined(NANOJIT_IA32)
|
||||
|
@ -3950,8 +3968,19 @@ js_ExecuteTree(JSContext* cx, Fragment* f, uintN& inlineCallCount,
|
|||
AUDIT(traceTriggered);
|
||||
|
||||
JS_ASSERT(lr->exitType != LOOP_EXIT || !lr->calldepth);
|
||||
|
||||
tm->onTrace = false;
|
||||
LeaveTree(state, lr);
|
||||
return state.innermost;
|
||||
}
|
||||
|
||||
static JS_FORCES_STACK void
|
||||
LeaveTree(InterpState& state, VMSideExit* lr)
|
||||
{
|
||||
VOUCH_DOES_NOT_REQUIRE_STACK();
|
||||
|
||||
JSContext* cx = state.cx;
|
||||
FrameInfo** callstack = state.callstackBase;
|
||||
double* stack = state.stackBase;
|
||||
|
||||
/* Except if we find that this is a nested bailout, the guard the call returned is the
|
||||
one we have to use to adjust pc and sp. */
|
||||
|
@ -3984,15 +4013,56 @@ js_ExecuteTree(JSContext* cx, Fragment* f, uintN& inlineCallCount,
|
|||
rp = (FrameInfo**)state.rpAtLastTreeCall;
|
||||
}
|
||||
innermost = state.lastTreeExitGuard;
|
||||
if (innermostNestedGuardp)
|
||||
*innermostNestedGuardp = nested;
|
||||
if (state.innermostNestedGuardp)
|
||||
*state.innermostNestedGuardp = nested;
|
||||
JS_ASSERT(nested);
|
||||
JS_ASSERT(nested->exitType == NESTED_EXIT);
|
||||
JS_ASSERT(state.lastTreeExitGuard);
|
||||
JS_ASSERT(state.lastTreeExitGuard->exitType != NESTED_EXIT);
|
||||
}
|
||||
|
||||
JS_ARENA_RELEASE(&cx->stackPool, stackMark);
|
||||
int32_t bs = cx->builtinStatus;
|
||||
cx->builtinStatus = 0;
|
||||
bool bailed = innermost->exitType == STATUS_EXIT && (bs & JSBUILTIN_BAILED);
|
||||
if (bailed)
|
||||
JS_TRACE_MONITOR(cx).prohibitRecording = false;
|
||||
if (bailed && !(bs & JSBUILTIN_ERROR)) {
|
||||
/*
|
||||
* Deep-bail case.
|
||||
*
|
||||
* A _FAIL native already called LeaveTree. We already reconstructed
|
||||
* the interpreter stack, in pre-call state, with pc pointing to the
|
||||
* CALL/APPLY op, for correctness. Then we continued in native code.
|
||||
* The native succeeded (no exception or error). After it returned, the
|
||||
* trace stored the return value (at the top of the native stack) and
|
||||
* then immediately flunked the guard on cx->builtinStatus.
|
||||
*
|
||||
* Now LeaveTree has been called again from the tail of
|
||||
* js_ExecuteTree. We are about to return to the interpreter. Adjust
|
||||
* the top stack frame to resume on the next op.
|
||||
*/
|
||||
JS_ASSERT(*cx->fp->regs->pc == JSOP_CALL || *cx->fp->regs->pc == JSOP_APPLY);
|
||||
uintN argc = GET_ARGC(cx->fp->regs->pc);
|
||||
cx->fp->regs->pc += JSOP_CALL_LENGTH;
|
||||
cx->fp->regs->sp -= argc + 1;
|
||||
JS_ASSERT_IF(!cx->fp->imacpc,
|
||||
cx->fp->slots + cx->fp->script->nfixed +
|
||||
js_ReconstructStackDepth(cx, cx->fp->script, cx->fp->regs->pc) ==
|
||||
cx->fp->regs->sp);
|
||||
|
||||
/*
|
||||
* The return value was not available when we reconstructed the stack,
|
||||
* but we have it now. Box it.
|
||||
*/
|
||||
uint8* typeMap = getStackTypeMap(innermost);
|
||||
NativeToValue(cx,
|
||||
cx->fp->regs->sp[-1],
|
||||
typeMap[innermost->numStackSlots - 1],
|
||||
(jsdouble *) state.sp + innermost->sp_adj / sizeof(jsdouble) - 1);
|
||||
return;
|
||||
}
|
||||
|
||||
JS_ARENA_RELEASE(&cx->stackPool, state.stackMark);
|
||||
while (callstack < rp) {
|
||||
/* Synthesize a stack frame and write out the values in it using the type map pointer
|
||||
on the native call stack. */
|
||||
|
@ -4008,7 +4078,7 @@ js_ExecuteTree(JSContext* cx, Fragment* f, uintN& inlineCallCount,
|
|||
#endif
|
||||
/* Keep track of the additional frames we put on the interpreter stack and the native
|
||||
stack slots we consumed. */
|
||||
++inlineCallCount;
|
||||
++*state.inlineCallCountp;
|
||||
++callstack;
|
||||
stack += slots;
|
||||
}
|
||||
|
@ -4020,8 +4090,8 @@ js_ExecuteTree(JSContext* cx, Fragment* f, uintN& inlineCallCount,
|
|||
unsigned calldepth_slots = 0;
|
||||
for (unsigned n = 0; n < calldepth; ++n) {
|
||||
calldepth_slots += js_SynthesizeFrame(cx, *callstack[n]);
|
||||
++inlineCallCount;
|
||||
#ifdef DEBUG
|
||||
++*state.inlineCallCountp;
|
||||
#ifdef DEBUG
|
||||
JSStackFrame* fp = cx->fp;
|
||||
debug_only_v(printf("synthesized shallow frame for %s:%u@%u\n",
|
||||
fp->script->filename, js_FramePCToLineNumber(cx, fp),
|
||||
|
@ -4036,7 +4106,7 @@ js_ExecuteTree(JSContext* cx, Fragment* f, uintN& inlineCallCount,
|
|||
JSStackFrame* fp = cx->fp;
|
||||
|
||||
JS_ASSERT_IF(fp->flags & JSFRAME_POP_BLOCKS,
|
||||
calldepth == 0 && jsframe_pop_blocks_set_on_entry);
|
||||
calldepth == 0 && state.jsframe_pop_blocks_set_on_entry);
|
||||
fp->blockChain = innermost->block;
|
||||
|
||||
/* If we are not exiting from an inlined frame the state->sp is spbase, otherwise spbase
|
||||
|
@ -4047,8 +4117,8 @@ js_ExecuteTree(JSContext* cx, Fragment* f, uintN& inlineCallCount,
|
|||
fp->slots + fp->script->nfixed +
|
||||
js_ReconstructStackDepth(cx, fp->script, fp->regs->pc) == fp->regs->sp);
|
||||
|
||||
#if defined(JS_JIT_SPEW) && (defined(NANOJIT_IA32) || (defined(NANOJIT_AMD64) && defined(__GNUC__)))
|
||||
uint64 cycles = rdtsc() - start;
|
||||
#ifdef EXECUTE_TREE_TIMER
|
||||
uint64 cycles = rdtsc() - state.startTime;
|
||||
#elif defined(JS_JIT_SPEW)
|
||||
uint64 cycles = 0;
|
||||
#endif
|
||||
|
@ -4069,19 +4139,21 @@ js_ExecuteTree(JSContext* cx, Fragment* f, uintN& inlineCallCount,
|
|||
which we don't have any type information available in the side exit. We merge in this
|
||||
information from the entry type-map. See also comment in the constructor of TraceRecorder
|
||||
why this is always safe to do. */
|
||||
TreeInfo* outermostTree = state.outermostTree;
|
||||
uint16* gslots = outermostTree->globalSlots->data();
|
||||
unsigned ngslots = outermostTree->globalSlots->length();
|
||||
JS_ASSERT(ngslots == outermostTree->nGlobalTypes());
|
||||
unsigned exit_gslots = innermost->numGlobalSlots;
|
||||
JS_ASSERT(ngslots == ti->nGlobalTypes());
|
||||
JS_ASSERT(ngslots >= exit_gslots);
|
||||
JS_ASSERT(exit_gslots <= ngslots);
|
||||
uint8* globalTypeMap = getGlobalTypeMap(innermost);
|
||||
if (exit_gslots < ngslots)
|
||||
mergeTypeMaps(&globalTypeMap, &exit_gslots, ti->globalTypeMap(), ngslots,
|
||||
mergeTypeMaps(&globalTypeMap, &exit_gslots, outermostTree->globalTypeMap(), ngslots,
|
||||
(uint8*)alloca(sizeof(uint8) * ngslots));
|
||||
JS_ASSERT(exit_gslots == ti->nGlobalTypes());
|
||||
JS_ASSERT(exit_gslots == outermostTree->globalSlots->length());
|
||||
|
||||
/* write back interned globals */
|
||||
FlushNativeGlobalFrame(cx, exit_gslots, gslots, globalTypeMap, global);
|
||||
JS_ASSERT_IF(ngslots != 0, globalFrameSize == STOBJ_NSLOTS(globalObj));
|
||||
JS_ASSERT(*(uint64*)&global[globalFrameSize] == 0xdeadbeefdeadbeefLL);
|
||||
FlushNativeGlobalFrame(cx, exit_gslots, gslots, globalTypeMap, state.global);
|
||||
JS_ASSERT(*(uint64*)&state.global[STOBJ_NSLOTS(state.globalObj)] == 0xdeadbeefdeadbeefLL);
|
||||
|
||||
/* write back native stack frame */
|
||||
#ifdef DEBUG
|
||||
|
@ -4106,7 +4178,7 @@ js_ExecuteTree(JSContext* cx, Fragment* f, uintN& inlineCallCount,
|
|||
AUDIT(timeoutIntoInterpreter);
|
||||
#endif
|
||||
|
||||
return innermost;
|
||||
state.innermost = innermost;
|
||||
}
|
||||
|
||||
JS_REQUIRES_STACK bool
|
||||
|
@ -4533,8 +4605,7 @@ js_FlushJITCache(JSContext* cx)
|
|||
fragmento->clearFrags();
|
||||
#ifdef DEBUG
|
||||
JS_ASSERT(fragmento->labels);
|
||||
delete fragmento->labels;
|
||||
fragmento->labels = new (&gc) LabelMap(core, NULL);
|
||||
fragmento->labels->clear();
|
||||
#endif
|
||||
tm->lirbuf->rewind();
|
||||
memset(tm->vmfragments, 0, sizeof(tm->vmfragments));
|
||||
|
@ -4550,14 +4621,16 @@ JS_FORCES_STACK JSStackFrame *
|
|||
js_GetTopStackFrame(JSContext *cx)
|
||||
{
|
||||
if (JS_ON_TRACE(cx)) {
|
||||
/*
|
||||
* TODO: If executing a tree, synthesize stack frames and bail off
|
||||
* trace. See bug 462027.
|
||||
*/
|
||||
debug_only_v(printf("Internal error: getting top stack frame on trace.\n"));
|
||||
#ifdef DEBUG_jason
|
||||
JS_ASSERT(0);
|
||||
/* It's a bug if a non-FAIL_STATUS builtin gets here. */
|
||||
JS_ASSERT(cx->bailExit);
|
||||
|
||||
JS_TRACE_MONITOR(cx).onTrace = false;
|
||||
JS_TRACE_MONITOR(cx).prohibitRecording = true;
|
||||
LeaveTree(*cx->interpState, cx->bailExit);
|
||||
#ifdef DEBUG
|
||||
cx->bailExit = NULL;
|
||||
#endif
|
||||
cx->builtinStatus |= JSBUILTIN_BAILED;
|
||||
}
|
||||
return cx->fp;
|
||||
}
|
||||
|
@ -6513,7 +6586,12 @@ TraceRecorder::functionCall(bool constructing, uintN argc)
|
|||
} else if (argtype == 'R') {
|
||||
*argp = INS_CONSTPTR(cx->runtime);
|
||||
} else if (argtype == 'P') {
|
||||
*argp = INS_CONSTPTR(pc);
|
||||
// FIXME: Set pc to imacpc when recording JSOP_CALL inside the
|
||||
// JSOP_GETELEM imacro (bug 476559).
|
||||
if (*pc == JSOP_CALL && fp->imacpc && *fp->imacpc == JSOP_GETELEM)
|
||||
*argp = INS_CONSTPTR(fp->imacpc);
|
||||
else
|
||||
*argp = INS_CONSTPTR(pc);
|
||||
} else if (argtype == 'D') { /* this, as a number */
|
||||
if (!isNumber(tval))
|
||||
goto next_specialization;
|
||||
|
@ -6593,6 +6671,21 @@ success:
|
|||
JS_ASSERT(args[0] != (LIns *)0xcdcdcdcd);
|
||||
#endif
|
||||
|
||||
if (JSTN_ERRTYPE(known) == FAIL_STATUS) {
|
||||
// This needs to capture the pre-call state of the stack. So do not set
|
||||
// pendingTraceableNative before taking this snapshot.
|
||||
JS_ASSERT(!pendingTraceableNative);
|
||||
|
||||
// Take snapshot for deep LeaveTree and store it in cx->bailExit.
|
||||
LIns* rec_ins = snapshot(DEEP_BAIL_EXIT);
|
||||
GuardRecord* rec = (GuardRecord *) rec_ins->payload();
|
||||
JS_ASSERT(rec->exit);
|
||||
lir->insStorei(INS_CONSTPTR(rec->exit), cx_ins, offsetof(JSContext, bailExit));
|
||||
|
||||
// Tell nanojit not to discard or defer stack writes before this call.
|
||||
lir->insGuard(LIR_xbarrier, rec_ins, rec_ins);
|
||||
}
|
||||
|
||||
LIns* res_ins = lir->insCall(known->builtin, args);
|
||||
if (!constructing)
|
||||
rval_ins = res_ins;
|
||||
|
@ -6611,6 +6704,9 @@ success:
|
|||
case FAIL_VOID:
|
||||
guard(false, lir->ins2i(LIR_eq, res_ins, JSVAL_TO_BOOLEAN(JSVAL_VOID)), OOM_EXIT);
|
||||
break;
|
||||
case FAIL_COOKIE:
|
||||
guard(false, lir->ins2(LIR_eq, res_ins, INS_CONST(JSVAL_ERROR_COOKIE)), OOM_EXIT);
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
set(&fval, res_ins);
|
||||
|
@ -6876,7 +6972,7 @@ GetProperty(JSContext *cx, uintN argc, jsval *vp)
|
|||
jsval *argv;
|
||||
jsid id;
|
||||
|
||||
JS_ASSERT(argc == 1);
|
||||
JS_ASSERT(!JS_ON_TRACE(cx) && cx->fp->imacpc && argc == 1);
|
||||
argv = JS_ARGV(cx, vp);
|
||||
JS_ASSERT(JSVAL_IS_STRING(argv[0]));
|
||||
if (!js_ValueToStringId(cx, argv[0], &id))
|
||||
|
@ -6886,15 +6982,18 @@ GetProperty(JSContext *cx, uintN argc, jsval *vp)
|
|||
}
|
||||
|
||||
static jsval FASTCALL
|
||||
GetProperty_tn(JSContext *cx, JSObject *obj, JSString *name)
|
||||
GetProperty_tn(JSContext *cx, jsbytecode *pc, JSObject *obj, JSString *name)
|
||||
{
|
||||
jsid id;
|
||||
jsval v;
|
||||
|
||||
if (!js_ValueToStringId(cx, STRING_TO_JSVAL(name), &id) ||
|
||||
!OBJ_GET_PROPERTY(cx, obj, id, &v)) {
|
||||
return JSVAL_ERROR_COOKIE;
|
||||
}
|
||||
BEGIN_PC_HINT(pc);
|
||||
if (!js_ValueToStringId(cx, STRING_TO_JSVAL(name), &id) ||
|
||||
!OBJ_GET_PROPERTY(cx, obj, id, &v)) {
|
||||
cx->builtinStatus |= JSBUILTIN_ERROR;
|
||||
v = JSVAL_ERROR_COOKIE;
|
||||
}
|
||||
END_PC_HINT();
|
||||
return v;
|
||||
}
|
||||
|
||||
|
@ -6904,7 +7003,7 @@ GetElement(JSContext *cx, uintN argc, jsval *vp)
|
|||
jsval *argv;
|
||||
jsid id;
|
||||
|
||||
JS_ASSERT(argc == 1);
|
||||
JS_ASSERT(!JS_ON_TRACE(cx) && cx->fp->imacpc && argc == 1);
|
||||
argv = JS_ARGV(cx, vp);
|
||||
JS_ASSERT(JSVAL_IS_NUMBER(argv[0]));
|
||||
if (!JS_ValueToId(cx, argv[0], &id))
|
||||
|
@ -6914,22 +7013,28 @@ GetElement(JSContext *cx, uintN argc, jsval *vp)
|
|||
}
|
||||
|
||||
static jsval FASTCALL
|
||||
GetElement_tn(JSContext* cx, JSObject* obj, int32 index)
|
||||
GetElement_tn(JSContext* cx, jsbytecode *pc, JSObject* obj, int32 index)
|
||||
{
|
||||
jsval v;
|
||||
jsid id;
|
||||
|
||||
if (!js_Int32ToId(cx, index, &id))
|
||||
return JSVAL_ERROR_COOKIE;
|
||||
if (!OBJ_GET_PROPERTY(cx, obj, id, &v))
|
||||
if (!js_Int32ToId(cx, index, &id)) {
|
||||
cx->builtinStatus |= JSBUILTIN_ERROR;
|
||||
return JSVAL_ERROR_COOKIE;
|
||||
}
|
||||
BEGIN_PC_HINT(pc);
|
||||
if (!OBJ_GET_PROPERTY(cx, obj, id, &v)) {
|
||||
cx->builtinStatus |= JSBUILTIN_ERROR;
|
||||
v = JSVAL_ERROR_COOKIE;
|
||||
}
|
||||
END_PC_HINT();
|
||||
return v;
|
||||
}
|
||||
|
||||
JS_DEFINE_TRCINFO_1(GetProperty,
|
||||
(3, (static, JSVAL_FAIL, GetProperty_tn, CONTEXT, THIS, STRING, 0, 0)))
|
||||
(4, (static, JSVAL_FAIL, GetProperty_tn, CONTEXT, PC, THIS, STRING, 0, 0)))
|
||||
JS_DEFINE_TRCINFO_1(GetElement,
|
||||
(3, (extern, JSVAL_FAIL, GetElement_tn, CONTEXT, THIS, INT32, 0, 0)))
|
||||
(4, (extern, JSVAL_FAIL, GetElement_tn, CONTEXT, PC, THIS, INT32, 0, 0)))
|
||||
|
||||
JS_REQUIRES_STACK bool
|
||||
TraceRecorder::record_JSOP_GETELEM()
|
||||
|
@ -7029,9 +7134,9 @@ SetProperty_tn(JSContext* cx, JSObject* obj, JSString* idstr, jsval v)
|
|||
|
||||
if (!js_ValueToStringId(cx, STRING_TO_JSVAL(idstr), &id) ||
|
||||
!OBJ_SET_PROPERTY(cx, obj, id, &v)) {
|
||||
return JSVAL_TO_BOOLEAN(JSVAL_VOID);
|
||||
cx->builtinStatus |= JSBUILTIN_ERROR;
|
||||
}
|
||||
return JSVAL_TRUE;
|
||||
return JSVAL_TO_BOOLEAN(JSVAL_VOID);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -7058,8 +7163,8 @@ SetElement_tn(JSContext* cx, JSObject* obj, int32 index, jsval v)
|
|||
jsid id;
|
||||
|
||||
if (!js_Int32ToId(cx, index, &id) || !OBJ_SET_PROPERTY(cx, obj, id, &v))
|
||||
return JSVAL_TO_BOOLEAN(JSVAL_VOID);
|
||||
return JSVAL_TRUE;
|
||||
cx->builtinStatus |= JSBUILTIN_ERROR;
|
||||
return JSVAL_TO_BOOLEAN(JSVAL_VOID);
|
||||
}
|
||||
|
||||
JS_DEFINE_TRCINFO_1(SetProperty,
|
||||
|
@ -7359,18 +7464,31 @@ JS_REQUIRES_STACK bool
|
|||
TraceRecorder::record_FastNativeCallComplete()
|
||||
{
|
||||
JS_ASSERT(pendingTraceableNative);
|
||||
|
||||
|
||||
/* At this point the generated code has already called the native function
|
||||
and we can no longer fail back to the original pc location (JSOP_CALL)
|
||||
because that would cause the interpreter to re-execute the native
|
||||
function, which might have side effects.
|
||||
|
||||
Instead, snapshot(), which is invoked from unbox_jsval(), will see that
|
||||
we are currently parked on a traceable native's JSOP_CALL instruction,
|
||||
and it will advance the pc to restore by the length of the current
|
||||
opcode, and indicate in the type map that the element on top of the
|
||||
stack is a boxed value which doesn't need to be boxed if the type guard
|
||||
generated by unbox_jsval() fails. */
|
||||
Instead, snapshot(), which is invoked from unbox_jsval() below, will see
|
||||
that we are currently parked on a traceable native's JSOP_CALL
|
||||
instruction, and it will advance the pc to restore by the length of the
|
||||
current opcode. If the native's return type is jsval, snapshot() will
|
||||
also indicate in the type map that the element on top of the stack is a
|
||||
boxed value which doesn't need to be boxed if the type guard generated
|
||||
by unbox_jsval() fails. */
|
||||
|
||||
if (JSTN_ERRTYPE(pendingTraceableNative) == FAIL_STATUS) {
|
||||
#ifdef DEBUG
|
||||
// Keep cx->bailExit null when it's invalid.
|
||||
lir->insStorei(INS_CONSTPTR(NULL), cx_ins, (int) offsetof(JSContext, bailExit));
|
||||
#endif
|
||||
guard(true,
|
||||
lir->ins_eq0(
|
||||
lir->insLoad(LIR_ld, cx_ins, (int) offsetof(JSContext, builtinStatus))),
|
||||
STATUS_EXIT);
|
||||
}
|
||||
|
||||
JS_ASSERT(*cx->fp->regs->pc == JSOP_CALL ||
|
||||
*cx->fp->regs->pc == JSOP_APPLY);
|
||||
|
||||
|
@ -7378,16 +7496,13 @@ TraceRecorder::record_FastNativeCallComplete()
|
|||
LIns* v_ins = get(&v);
|
||||
|
||||
bool ok = true;
|
||||
switch (JSTN_ERRTYPE(pendingTraceableNative)) {
|
||||
case FAIL_JSVAL:
|
||||
if (pendingTraceableNative->flags & JSTN_UNBOX_AFTER) {
|
||||
unbox_jsval(v, v_ins);
|
||||
set(&v, v_ins);
|
||||
break;
|
||||
case FAIL_NEG:
|
||||
} else if (JSTN_ERRTYPE(pendingTraceableNative) == FAIL_NEG) {
|
||||
/* Already added i2f in functionCall. */
|
||||
JS_ASSERT(JSVAL_IS_NUMBER(v));
|
||||
break;
|
||||
default:
|
||||
} else {
|
||||
/* Convert the result to double if the builtin returns int32. */
|
||||
if (JSVAL_IS_NUMBER(v) &&
|
||||
(pendingTraceableNative->builtin->_argtypes & 3) == nanojit::ARGSIZE_LO) {
|
||||
|
@ -8476,7 +8591,7 @@ TraceRecorder::record_JSOP_ANYNAME()
|
|||
JS_REQUIRES_STACK bool
|
||||
TraceRecorder::record_JSOP_QNAMEPART()
|
||||
{
|
||||
return false;
|
||||
return record_JSOP_STRING();
|
||||
}
|
||||
|
||||
JS_REQUIRES_STACK bool
|
||||
|
@ -8954,11 +9069,22 @@ ObjectToIterator(JSContext *cx, uintN argc, jsval *vp)
|
|||
}
|
||||
|
||||
static JSObject* FASTCALL
|
||||
ObjectToIterator_tn(JSContext* cx, JSObject *obj, int32 flags)
|
||||
ObjectToIterator_tn(JSContext* cx, jsbytecode* pc, JSObject *obj, int32 flags)
|
||||
{
|
||||
jsval v = OBJECT_TO_JSVAL(obj);
|
||||
if (!js_ValueToIterator(cx, flags, &v))
|
||||
|
||||
BEGIN_PC_HINT(pc);
|
||||
bool ok = js_ValueToIterator(cx, flags, &v);
|
||||
END_PC_HINT();
|
||||
|
||||
if (!ok) {
|
||||
cx->builtinStatus |= JSBUILTIN_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
if (OBJ_GET_CLASS(cx, JSVAL_TO_OBJECT(v)) == &js_GeneratorClass) {
|
||||
js_LeaveTrace(cx);
|
||||
return NULL;
|
||||
}
|
||||
return JSVAL_TO_OBJECT(v);
|
||||
}
|
||||
|
||||
|
@ -8969,18 +9095,25 @@ CallIteratorNext(JSContext *cx, uintN argc, jsval *vp)
|
|||
}
|
||||
|
||||
static jsval FASTCALL
|
||||
CallIteratorNext_tn(JSContext* cx, JSObject* iterobj)
|
||||
CallIteratorNext_tn(JSContext* cx, jsbytecode* pc, JSObject* iterobj)
|
||||
{
|
||||
jsval v;
|
||||
if (!js_CallIteratorNext(cx, iterobj, &v))
|
||||
|
||||
BEGIN_PC_HINT(pc);
|
||||
bool ok = js_CallIteratorNext(cx, iterobj, &v);
|
||||
END_PC_HINT();
|
||||
|
||||
if (!ok) {
|
||||
cx->builtinStatus |= JSBUILTIN_ERROR;
|
||||
return JSVAL_ERROR_COOKIE;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
JS_DEFINE_TRCINFO_1(ObjectToIterator,
|
||||
(3, (static, OBJECT_FAIL_NULL, ObjectToIterator_tn, CONTEXT, THIS, INT32, 0, 0)))
|
||||
(4, (static, OBJECT_FAIL, ObjectToIterator_tn, CONTEXT, PC, THIS, INT32, 0, 0)))
|
||||
JS_DEFINE_TRCINFO_1(CallIteratorNext,
|
||||
(2, (static, JSVAL_FAIL, CallIteratorNext_tn, CONTEXT, THIS, 0, 0)))
|
||||
(3, (static, JSVAL_FAIL, CallIteratorNext_tn, CONTEXT, PC, THIS, 0, 0)))
|
||||
|
||||
static const struct BuiltinFunctionInfo {
|
||||
JSTraceableNative *tn;
|
||||
|
@ -9068,7 +9201,7 @@ TraceRecorder::record_JSOP_LENGTH()
|
|||
jsval& l = stackval(-1);
|
||||
if (JSVAL_IS_PRIMITIVE(l)) {
|
||||
if (!JSVAL_IS_STRING(l))
|
||||
ABORT_TRACE("non-string primitives unsupported");
|
||||
ABORT_TRACE("non-string primitive JSOP_LENGTH unsupported");
|
||||
LIns* str_ins = get(&l);
|
||||
LIns* len_ins = lir->insLoad(LIR_ldp, str_ins, (int)offsetof(JSString, length));
|
||||
|
||||
|
|
|
@ -213,7 +213,9 @@ enum ExitType {
|
|||
OOM_EXIT,
|
||||
OVERFLOW_EXIT,
|
||||
UNSTABLE_LOOP_EXIT,
|
||||
TIMEOUT_EXIT
|
||||
TIMEOUT_EXIT,
|
||||
DEEP_BAIL_EXIT,
|
||||
STATUS_EXIT
|
||||
};
|
||||
|
||||
struct VMSideExit : public nanojit::SideExit
|
||||
|
@ -244,20 +246,18 @@ static inline uint8* getFullTypeMap(nanojit::SideExit* exit)
|
|||
return getStackTypeMap(exit);
|
||||
}
|
||||
|
||||
struct InterpState
|
||||
{
|
||||
void* sp; /* native stack pointer, stack[0] is spbase[0] */
|
||||
void* rp; /* call stack pointer */
|
||||
void* gp; /* global frame pointer */
|
||||
JSContext *cx; /* current VM context handle */
|
||||
void* eos; /* first unusable word after the native stack */
|
||||
void* eor; /* first unusable word after the call stack */
|
||||
VMSideExit* lastTreeExitGuard; /* guard we exited on during a tree call */
|
||||
VMSideExit* lastTreeCallGuard; /* guard we want to grow from if the tree
|
||||
call exit guard mismatched */
|
||||
void* rpAtLastTreeCall; /* value of rp at innermost tree call guard */
|
||||
JSObject* globalObj; /* pointer to the global object */
|
||||
};
|
||||
struct FrameInfo {
|
||||
JSObject* callee; // callee function object
|
||||
JSObject* block; // caller block chain head
|
||||
intptr_t ip_adj; // caller script-based pc index and imacro pc
|
||||
union {
|
||||
struct {
|
||||
uint16 spdist; // distance from fp->slots to fp->regs->sp at JSOP_CALL
|
||||
uint16 argc; // actual argument count, may be < fun->nargs
|
||||
} s;
|
||||
uint32 word; // for spdist/argc LIR store in record_JSOP_CALL
|
||||
};
|
||||
};
|
||||
|
||||
struct UnstableExit
|
||||
{
|
||||
|
@ -309,18 +309,37 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
struct FrameInfo {
|
||||
JSObject* callee; // callee function object
|
||||
JSObject* block; // caller block chain head
|
||||
intptr_t ip_adj; // caller script-based pc index and imacro pc
|
||||
union {
|
||||
struct {
|
||||
uint16 spdist; // distance from fp->slots to fp->regs->sp at JSOP_CALL
|
||||
uint16 argc; // actual argument count, may be < fun->nargs
|
||||
} s;
|
||||
uint32 word; // for spdist/argc LIR store in record_JSOP_CALL
|
||||
};
|
||||
};
|
||||
#if defined(JS_JIT_SPEW) && (defined(NANOJIT_IA32) || (defined(NANOJIT_AMD64) && defined(__GNUC__)))
|
||||
# define EXECUTE_TREE_TIMER
|
||||
#endif
|
||||
|
||||
struct InterpState
|
||||
{
|
||||
double *sp; // native stack pointer, stack[0] is spbase[0]
|
||||
void *rp; // call stack pointer
|
||||
double *global; // global frame pointer
|
||||
JSContext *cx; // current VM context handle
|
||||
double *eos; // first unusable word after the native stack
|
||||
void *eor; // first unusable word after the call stack
|
||||
VMSideExit* lastTreeExitGuard; // guard we exited on during a tree call
|
||||
VMSideExit* lastTreeCallGuard; // guard we want to grow from if the tree
|
||||
// call exit guard mismatched
|
||||
void* rpAtLastTreeCall; // value of rp at innermost tree call guard
|
||||
TreeInfo* outermostTree; // the outermost tree we initially invoked
|
||||
JSObject* globalObj; // pointer to the global object
|
||||
double* stackBase; // native stack base
|
||||
FrameInfo** callstackBase; // call stack base
|
||||
uintN* inlineCallCountp; // inline call count counter
|
||||
VMSideExit** innermostNestedGuardp;
|
||||
void* stackMark;
|
||||
VMSideExit* innermost;
|
||||
#ifdef EXECUTE_TREE_TIMER
|
||||
uint64 startTime;
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
bool jsframe_pop_blocks_set_on_entry;
|
||||
#endif
|
||||
};
|
||||
|
||||
enum JSMonitorRecordingStatus {
|
||||
JSMRS_CONTINUE,
|
||||
|
|
|
@ -2206,9 +2206,13 @@ namespace nanojit
|
|||
{}
|
||||
|
||||
LabelMap::~LabelMap()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
void LabelMap::clear()
|
||||
{
|
||||
Entry *e;
|
||||
|
||||
while ((e = names.removeLast()) != NULL) {
|
||||
core->freeString(e->name);
|
||||
NJ_DELETE(e);
|
||||
|
|
|
@ -490,6 +490,7 @@ namespace nanojit
|
|||
const char *dup(const char *);
|
||||
const char *format(const void *p);
|
||||
void promoteAll(const void *newbase);
|
||||
void clear();
|
||||
};
|
||||
|
||||
class LirNameMap MMGC_SUBCLASS_DECL
|
||||
|
|
|
@ -976,8 +976,10 @@ static jsval JS_FASTCALL
|
|||
Print_tn(JSContext *cx, JSString *str)
|
||||
{
|
||||
char *bytes = JS_EncodeString(cx, str);
|
||||
if (!bytes)
|
||||
return JSVAL_ERROR_COOKIE;
|
||||
if (!bytes) {
|
||||
cx->builtinStatus |= JSBUILTIN_ERROR;
|
||||
return JSVAL_VOID;
|
||||
}
|
||||
fprintf(gOutFile, "%s\n", bytes);
|
||||
JS_free(cx, bytes);
|
||||
fflush(gOutFile);
|
||||
|
|
|
@ -13,6 +13,12 @@ const RECORDLOOP = HOTLOOP;
|
|||
// The loop count at which we run the trace
|
||||
const RUNLOOP = HOTLOOP + 1;
|
||||
|
||||
var gDoMandelbrotTest = true;
|
||||
if ("gSkipSlowTests" in this && gSkipSlowTests) {
|
||||
print("** Skipping slow tests");
|
||||
gDoMandelbrotTest = false;
|
||||
}
|
||||
|
||||
var testName = null;
|
||||
if ("arguments" in this && arguments.length > 0)
|
||||
testName = arguments[0];
|
||||
|
@ -2094,6 +2100,84 @@ function testArrayPushPop() {
|
|||
testArrayPushPop.expected = "55,45";
|
||||
test(testArrayPushPop);
|
||||
|
||||
function testSlowArrayPop() {
|
||||
var a = [];
|
||||
for (var i = 0; i < RUNLOOP; i++)
|
||||
a[i] = [0];
|
||||
a[RUNLOOP-1].__defineGetter__("0", function () { return 'xyzzy'; });
|
||||
|
||||
var last;
|
||||
for (var i = 0; i < RUNLOOP; i++)
|
||||
last = a[i].pop(); // reenters interpreter in getter
|
||||
return last;
|
||||
}
|
||||
testSlowArrayPop.expected = 'xyzzy';
|
||||
test(testSlowArrayPop);
|
||||
|
||||
// Same thing but it needs to reconstruct multiple stack frames (so,
|
||||
// multiple functions called inside the loop)
|
||||
function testSlowArrayPopMultiFrame() {
|
||||
var a = [];
|
||||
for (var i = 0; i < RUNLOOP; i++)
|
||||
a[i] = [0];
|
||||
a[RUNLOOP-1].__defineGetter__("0", function () { return 23; });
|
||||
|
||||
function child(a, i) {
|
||||
return a[i].pop(); // reenters interpreter in getter
|
||||
}
|
||||
function parent(a, i) {
|
||||
return child(a, i);
|
||||
}
|
||||
function gramps(a, i) {
|
||||
return parent(a, i);
|
||||
}
|
||||
|
||||
var last;
|
||||
for (var i = 0; i < RUNLOOP; i++)
|
||||
last = gramps(a, i);
|
||||
return last;
|
||||
}
|
||||
testSlowArrayPopMultiFrame.expected = 23;
|
||||
test(testSlowArrayPopMultiFrame);
|
||||
|
||||
// Same thing but nested trees, each reconstructing one or more stack frames
|
||||
// (so, several functions with loops, such that the loops end up being
|
||||
// nested though they are not lexically nested)
|
||||
|
||||
function testSlowArrayPopNestedTrees() {
|
||||
var a = [];
|
||||
for (var i = 0; i < RUNLOOP; i++)
|
||||
a[i] = [0];
|
||||
a[RUNLOOP-1].__defineGetter__("0", function () { return 3.14159 });
|
||||
|
||||
function child(a, i, j, k) {
|
||||
var last = 2.71828;
|
||||
for (var l = 0; l < RUNLOOP; l++)
|
||||
if (i == RUNLOOP-1 && j == RUNLOOP-1 && k == RUNLOOP-1)
|
||||
last = a[l].pop(); // reenters interpreter in getter
|
||||
return last;
|
||||
}
|
||||
function parent(a, i, j) {
|
||||
var last;
|
||||
for (var k = 0; k < RUNLOOP; k++)
|
||||
last = child(a, i, j, k);
|
||||
return last;
|
||||
}
|
||||
function gramps(a, i) {
|
||||
var last;
|
||||
for (var j = 0; j < RUNLOOP; j++)
|
||||
last = parent(a, i, j);
|
||||
return last;
|
||||
}
|
||||
|
||||
var last;
|
||||
for (var i = 0; i < RUNLOOP; i++)
|
||||
last = gramps(a, i);
|
||||
return last;
|
||||
}
|
||||
testSlowArrayPopNestedTrees.expected = 3.14159;
|
||||
test(testSlowArrayPopNestedTrees);
|
||||
|
||||
function testResumeOp() {
|
||||
var a = [1,"2",3,"4",5,"6",7,"8",9,"10",11,"12",13,"14",15,"16"];
|
||||
var x = "";
|
||||
|
@ -4144,7 +4228,6 @@ function testInterpreterReentry5() {
|
|||
}
|
||||
test(testInterpreterReentry5);
|
||||
|
||||
/* // These tests should pass but currently crash, pending bug 462027.
|
||||
function testInterpreterReentry6() {
|
||||
var obj = {a:1, b:1, c:1, d:1, set e(x) { this._e = x; }};
|
||||
for (var p in obj)
|
||||
|
@ -4166,7 +4249,13 @@ function testInterpreterReentry7() {
|
|||
}
|
||||
testInterpreterReentry7.expected = "grue bleen";
|
||||
test(testInterpreterReentry7);
|
||||
*/
|
||||
|
||||
// Bug 462027 comment 54.
|
||||
function testInterpreterReentery8() {
|
||||
var e = <x><y/></x>;
|
||||
for (var j = 0; j < 4; ++j) { +[e]; }
|
||||
}
|
||||
test(testInterpreterReentery8);
|
||||
|
||||
/*****************************************************************************
|
||||
* *
|
||||
|
@ -4201,6 +4290,7 @@ load("math-trace-tests.js");
|
|||
// XXXbz I would dearly like to wrap it up into a function to avoid polluting
|
||||
// the global scope, but the function ends up heavyweight, and then we lose on
|
||||
// the jit.
|
||||
if (gDoMandelbrotTest) {
|
||||
load("mandelbrot-results.js");
|
||||
//function testMandelbrotAll() {
|
||||
// Configuration options that affect which codepaths we follow.
|
||||
|
@ -4444,6 +4534,7 @@ load("mandelbrot-results.js");
|
|||
test(createMandelSet);
|
||||
//}
|
||||
//testMandelbrotAll();
|
||||
} /* if (gDoMandelbrotTest) */
|
||||
// END MANDELBROT STUFF
|
||||
|
||||
/*****************************************************************************
|
||||
|
|
|
@ -52,7 +52,9 @@ endif
|
|||
|
||||
DIRS += src
|
||||
|
||||
ifndef BUILD_STATIC_LIBS
|
||||
TOOL_DIRS += shell
|
||||
endif
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
TOOL_DIRS += tests
|
||||
|
|
|
@ -986,6 +986,8 @@ mozJSComponentLoader::StartFastLoad(nsIFastLoadService *flSvc)
|
|||
kFastLoadWriteDelay,
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
} else {
|
||||
// Note, that since CloseFastLoad nulls out mFastLoadTimer,
|
||||
// SetDelay() will only be called on a timer that hasn't fired.
|
||||
rv = mFastLoadTimer->SetDelay(kFastLoadWriteDelay);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ REQUIRES = xpconnect \
|
|||
xpcom \
|
||||
js \
|
||||
caps \
|
||||
xulapp \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = xpcshell.cpp
|
||||
|
@ -60,8 +61,8 @@ endif
|
|||
|
||||
LIBS = \
|
||||
$(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
|
||||
$(LIBXUL_LIBS) \
|
||||
$(MOZ_JS_LIBS) \
|
||||
$(XPCOM_LIBS) \
|
||||
$(NSPR_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -45,8 +45,10 @@
|
|||
/* XPConnect JavaScript interactive shell. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsIXPCScriptable.h"
|
||||
#include "nsIInterfaceInfo.h"
|
||||
|
@ -57,12 +59,16 @@
|
|||
#include "nsIComponentRegistrar.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsIDirectoryService.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "jsapi.h"
|
||||
#include "jsdbgapi.h"
|
||||
#include "jsprf.h"
|
||||
#include "nscore.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsIJSRuntimeService.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
@ -91,6 +97,22 @@
|
|||
|
||||
#include "nsIJSContextStack.h"
|
||||
|
||||
class XPCShellDirProvider : public nsIDirectoryServiceProvider
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDIRECTORYSERVICEPROVIDER
|
||||
|
||||
XPCShellDirProvider() { }
|
||||
~XPCShellDirProvider() { }
|
||||
|
||||
PRBool SetGREDir(const char *dir);
|
||||
void ClearGREDir() { mGREDir = nsnull; }
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsILocalFile> mGREDir;
|
||||
};
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
|
@ -183,7 +205,11 @@ GetLocationProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
nsCOMPtr<nsIXPConnectJSObjectHolder> locationHolder;
|
||||
JSObject *locationObj = NULL;
|
||||
|
||||
location->Normalize();
|
||||
PRBool symlink;
|
||||
// don't normalize symlinks, because that's kind of confusing
|
||||
if (NS_SUCCEEDED(location->IsSymlink(&symlink)) &&
|
||||
!symlink)
|
||||
location->Normalize();
|
||||
rv = xpc->WrapNative(cx, obj, location,
|
||||
NS_GET_IID(nsILocalFile),
|
||||
getter_AddRefs(locationHolder));
|
||||
|
@ -915,7 +941,7 @@ static int
|
|||
usage(void)
|
||||
{
|
||||
fprintf(gErrFile, "%s\n", JS_GetImplementationVersion());
|
||||
fprintf(gErrFile, "usage: xpcshell [-PswWxCij] [-v version] [-f scriptfile] [-e script] [scriptfile] [scriptarg...]\n");
|
||||
fprintf(gErrFile, "usage: xpcshell [-g gredir] [-PswWxCij] [-v version] [-f scriptfile] [-e script] [scriptfile] [scriptarg...]\n");
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
@ -1544,9 +1570,39 @@ main(int argc, char **argv, char **envp)
|
|||
gErrFile = stderr;
|
||||
gOutFile = stdout;
|
||||
gInFile = stdin;
|
||||
|
||||
NS_LogInit();
|
||||
|
||||
nsCOMPtr<nsILocalFile> appFile;
|
||||
rv = XRE_GetBinaryPath(argv[0], getter_AddRefs(appFile));
|
||||
if (NS_FAILED(rv)) {
|
||||
printf("Couldn't figure application file.\n");
|
||||
return 1;
|
||||
}
|
||||
nsCOMPtr<nsIFile> appDir;
|
||||
rv = appFile->GetParent(getter_AddRefs(appDir));
|
||||
if (NS_FAILED(rv)) {
|
||||
printf("Couldn't get application directory.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
XPCShellDirProvider dirprovider;
|
||||
|
||||
if (argc > 1 && !strcmp(argv[1], "-g")) {
|
||||
if (argc < 3)
|
||||
return usage();
|
||||
|
||||
if (!dirprovider.SetGREDir(argv[2])) {
|
||||
printf("SetGREDir failed.\n");
|
||||
return 1;
|
||||
}
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
}
|
||||
|
||||
{
|
||||
nsCOMPtr<nsIServiceManager> servMan;
|
||||
rv = NS_InitXPCOM2(getter_AddRefs(servMan), nsnull, nsnull);
|
||||
rv = NS_InitXPCOM2(getter_AddRefs(servMan), appDir, &dirprovider);
|
||||
if (NS_FAILED(rv)) {
|
||||
printf("NS_InitXPCOM failed!\n");
|
||||
return 1;
|
||||
|
@ -1712,9 +1768,49 @@ main(int argc, char **argv, char **envp)
|
|||
bogus = nsnull;
|
||||
#endif
|
||||
|
||||
appDir = nsnull;
|
||||
appFile = nsnull;
|
||||
dirprovider.ClearGREDir();
|
||||
|
||||
NS_LogTerm();
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
FinishAutoreleasePool();
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
PRBool
|
||||
XPCShellDirProvider::SetGREDir(const char *dir)
|
||||
{
|
||||
nsresult rv = XRE_GetFileFromPath(dir, getter_AddRefs(mGREDir));
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsrefcnt)
|
||||
XPCShellDirProvider::AddRef()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsrefcnt)
|
||||
XPCShellDirProvider::Release()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
NS_IMPL_QUERY_INTERFACE1(XPCShellDirProvider, nsIDirectoryServiceProvider)
|
||||
|
||||
NS_IMETHODIMP
|
||||
XPCShellDirProvider::GetFile(const char *prop, PRBool *persistent,
|
||||
nsIFile* *result)
|
||||
{
|
||||
if (mGREDir && !strcmp(prop, NS_GRE_DIR)) {
|
||||
*persistent = PR_TRUE;
|
||||
NS_ADDREF(*result = mGREDir);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
|
@ -257,7 +257,7 @@ AdvanceLineIteratorToFrame(nsIFrame* aFrame,
|
|||
* Overview of the implementation of Resolve():
|
||||
*
|
||||
* Walk through the descendants of aBlockFrame and build:
|
||||
* * mLogicalArray: an nsVoidArray of nsIFrame* pointers in logical order
|
||||
* * mLogicalFrames: an nsTArray of nsIFrame* pointers in logical order
|
||||
* * mBuffer: an nsAutoString containing a representation of
|
||||
* the content of the frames.
|
||||
* In the case of text frames, this is the actual text context of the
|
||||
|
@ -274,7 +274,7 @@ AdvanceLineIteratorToFrame(nsIFrame* aFrame,
|
|||
* nsBidi::CountRuns().
|
||||
*
|
||||
* Finally, walk these runs in logical order using nsBidi::GetLogicalRun() and
|
||||
* correlate them with the frames indexed in mLogicalArray, setting the
|
||||
* correlate them with the frames indexed in mLogicalFrames, setting the
|
||||
* baseLevel, embeddingLevel, and charType properties according to the results
|
||||
* returned by the Bidi engine and CalculateCharType().
|
||||
*
|
||||
|
@ -361,7 +361,7 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame,
|
|||
PRInt32 fragmentLength = 0;
|
||||
PRInt32 temp;
|
||||
PRInt32 frameIndex = -1;
|
||||
PRInt32 frameCount = mLogicalFrames.Count();
|
||||
PRInt32 frameCount = mLogicalFrames.Length();
|
||||
PRInt32 contentOffset = 0; // offset within current frame
|
||||
PRInt32 lineOffset = 0; // offset within mBuffer
|
||||
PRInt32 logicalLimit = 0;
|
||||
|
@ -392,7 +392,7 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame,
|
|||
}
|
||||
contentOffset = 0;
|
||||
|
||||
frame = (nsIFrame*) (mLogicalFrames[frameIndex]);
|
||||
frame = mLogicalFrames[frameIndex];
|
||||
frameType = frame->GetType();
|
||||
lineNeedsUpdate = PR_TRUE;
|
||||
if (nsGkAtoms::textFrame == frameType) {
|
||||
|
@ -516,7 +516,7 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame,
|
|||
return mSuccess;
|
||||
}
|
||||
|
||||
// Should this frame be treated as a leaf (e.g. when building mLogicalArray)?
|
||||
// Should this frame be treated as a leaf (e.g. when building mLogicalFrames)?
|
||||
PRBool IsBidiLeaf(nsIFrame* aFrame) {
|
||||
nsIFrame* kid = aFrame->GetFirstChild(nsnull);
|
||||
return !kid
|
||||
|
@ -594,7 +594,7 @@ nsBidiPresUtils::InitLogicalArray(nsIFrame* aCurrentFrame)
|
|||
*/
|
||||
nsIContent* content = frame->GetContent();
|
||||
if (content) {
|
||||
mContentToFrameIndex.Put(content, mLogicalFrames.Count());
|
||||
mContentToFrameIndex.Put(content, mLogicalFrames.Length());
|
||||
}
|
||||
mLogicalFrames.AppendElement(frame);
|
||||
}
|
||||
|
@ -623,10 +623,10 @@ nsBidiPresUtils::CreateBlockBuffer()
|
|||
nsIFrame* frame;
|
||||
nsIContent* prevContent = nsnull;
|
||||
PRUint32 i;
|
||||
PRUint32 count = mLogicalFrames.Count();
|
||||
PRUint32 count = mLogicalFrames.Length();
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
frame = (nsIFrame*) (mLogicalFrames[i]);
|
||||
frame = mLogicalFrames[i];
|
||||
nsIAtom* frameType = frame->GetType();
|
||||
|
||||
if (nsGkAtoms::textFrame == frameType) {
|
||||
|
@ -686,7 +686,7 @@ nsBidiPresUtils::Reorder(PRBool& aReordered, PRBool& aHasRTLFrames)
|
|||
{
|
||||
aReordered = PR_FALSE;
|
||||
aHasRTLFrames = PR_FALSE;
|
||||
PRInt32 count = mLogicalFrames.Count();
|
||||
PRInt32 count = mLogicalFrames.Length();
|
||||
|
||||
if (mArraySize < count) {
|
||||
mArraySize = count << 1;
|
||||
|
@ -711,7 +711,7 @@ nsBidiPresUtils::Reorder(PRBool& aReordered, PRBool& aHasRTLFrames)
|
|||
PRInt32 i;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
frame = (nsIFrame*) (mLogicalFrames[i]);
|
||||
frame = mLogicalFrames[i];
|
||||
mLevels[i] = GetFrameEmbeddingLevel(frame);
|
||||
if (mLevels[i] & 1) {
|
||||
aHasRTLFrames = PR_TRUE;
|
||||
|
@ -885,15 +885,15 @@ nsBidiPresUtils::RepositionFrame(nsIFrame* aFrame,
|
|||
// If aIsOddLevel is true, so we need to traverse the child list
|
||||
// in reverse order, to make it O(n) we store the list locally and
|
||||
// iterate the list reversely
|
||||
nsVoidArray childList;
|
||||
nsTArray<nsIFrame*> childList;
|
||||
nsIFrame *frame = aFrame->GetFirstChild(nsnull);
|
||||
if (frame && aIsOddLevel) {
|
||||
childList.AppendElement(nsnull);
|
||||
childList.AppendElement((nsIFrame*)nsnull);
|
||||
while (frame) {
|
||||
childList.AppendElement(frame);
|
||||
frame = frame->GetNextSibling();
|
||||
}
|
||||
frame = (nsIFrame*)childList[childList.Count() - 1];
|
||||
frame = childList[childList.Length() - 1];
|
||||
}
|
||||
|
||||
// Reposition the child frames
|
||||
|
@ -905,7 +905,7 @@ nsBidiPresUtils::RepositionFrame(nsIFrame* aFrame,
|
|||
aContinuationStates);
|
||||
index++;
|
||||
frame = aIsOddLevel ?
|
||||
(nsIFrame*)childList[childList.Count() - index - 1] :
|
||||
childList[childList.Length() - index - 1] :
|
||||
frame->GetNextSibling();
|
||||
}
|
||||
|
||||
|
@ -959,7 +959,7 @@ nsBidiPresUtils::RepositionInlineFrames(nsIFrame* aFirstChild) const
|
|||
|
||||
nscoord left = aFirstChild->GetPosition().x - leftSpace;
|
||||
nsIFrame* frame;
|
||||
PRInt32 count = mVisualFrames.Count();
|
||||
PRInt32 count = mVisualFrames.Length();
|
||||
PRInt32 index;
|
||||
nsContinuationStates continuationStates;
|
||||
|
||||
|
@ -968,13 +968,12 @@ nsBidiPresUtils::RepositionInlineFrames(nsIFrame* aFirstChild) const
|
|||
// Initialize continuation states to (nsnull, 0) for
|
||||
// each frame on the line.
|
||||
for (index = 0; index < count; index++) {
|
||||
InitContinuationStates((nsIFrame*)mVisualFrames[index],
|
||||
&continuationStates);
|
||||
InitContinuationStates(mVisualFrames[index], &continuationStates);
|
||||
}
|
||||
|
||||
// Reposition frames in visual order
|
||||
for (index = 0; index < count; index++) {
|
||||
frame = (nsIFrame*) (mVisualFrames[index]);
|
||||
frame = mVisualFrames[index];
|
||||
RepositionFrame(frame,
|
||||
(mLevels[mIndexMap[index]] & 1),
|
||||
left,
|
||||
|
@ -1004,13 +1003,13 @@ nsBidiPresUtils::CheckLineOrder(nsIFrame* aFirstFrameOnLine,
|
|||
PRBool isReordered;
|
||||
PRBool hasRTLFrames;
|
||||
Reorder(isReordered, hasRTLFrames);
|
||||
PRInt32 count = mLogicalFrames.Count();
|
||||
PRInt32 count = mLogicalFrames.Length();
|
||||
|
||||
if (aFirstVisual) {
|
||||
*aFirstVisual = (nsIFrame*)mVisualFrames[0];
|
||||
*aFirstVisual = mVisualFrames[0];
|
||||
}
|
||||
if (aLastVisual) {
|
||||
*aLastVisual = (nsIFrame*)mVisualFrames[count-1];
|
||||
*aLastVisual = mVisualFrames[count-1];
|
||||
}
|
||||
|
||||
// If there's an RTL frame, assume the line is reordered
|
||||
|
@ -1027,14 +1026,14 @@ nsBidiPresUtils::GetFrameToRightOf(const nsIFrame* aFrame,
|
|||
PRBool isReordered;
|
||||
PRBool hasRTLFrames;
|
||||
Reorder(isReordered, hasRTLFrames);
|
||||
PRInt32 count = mVisualFrames.Count();
|
||||
PRInt32 count = mVisualFrames.Length();
|
||||
|
||||
if (aFrame == nsnull)
|
||||
return (nsIFrame*)mVisualFrames[0];
|
||||
return mVisualFrames[0];
|
||||
|
||||
for (PRInt32 i = 0; i < count - 1; i++) {
|
||||
if ((nsIFrame*)mVisualFrames[i] == aFrame) {
|
||||
return (nsIFrame*)mVisualFrames[i+1];
|
||||
if (mVisualFrames[i] == aFrame) {
|
||||
return mVisualFrames[i+1];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1051,14 +1050,14 @@ nsBidiPresUtils::GetFrameToLeftOf(const nsIFrame* aFrame,
|
|||
PRBool isReordered;
|
||||
PRBool hasRTLFrames;
|
||||
Reorder(isReordered, hasRTLFrames);
|
||||
PRInt32 count = mVisualFrames.Count();
|
||||
PRInt32 count = mVisualFrames.Length();
|
||||
|
||||
if (aFrame == nsnull)
|
||||
return (nsIFrame*)mVisualFrames[count-1];
|
||||
return mVisualFrames[count-1];
|
||||
|
||||
for (PRInt32 i = 1; i < count; i++) {
|
||||
if ((nsIFrame*)mVisualFrames[i] == aFrame) {
|
||||
return (nsIFrame*)mVisualFrames[i-1];
|
||||
if (mVisualFrames[i] == aFrame) {
|
||||
return mVisualFrames[i-1];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1084,8 +1083,8 @@ nsBidiPresUtils::EnsureBidiContinuation(nsIFrame* aFrame,
|
|||
nsCharType charType = (nsCharType)NS_PTR_TO_INT32(aFrame->GetProperty(nsGkAtoms::charType));
|
||||
|
||||
// Skip fluid continuations
|
||||
while (aFrameIndex + 1 < mLogicalFrames.Count()) {
|
||||
nsIFrame* frame = (nsIFrame*)mLogicalFrames[aFrameIndex + 1];
|
||||
while (aFrameIndex + 1 < PRInt32(mLogicalFrames.Length())) {
|
||||
nsIFrame* frame = mLogicalFrames[aFrameIndex + 1];
|
||||
if (frame->GetPrevInFlow() != aFrame) {
|
||||
// If we found a non-fluid continuation, use it
|
||||
if (frame->GetPrevContinuation() == aFrame) {
|
||||
|
@ -1134,7 +1133,7 @@ nsBidiPresUtils::RemoveBidiContinuation(nsIFrame* aFrame,
|
|||
NS_ASSERTION(NS_SUCCEEDED(rv), "charType attribute missing from aFrame");
|
||||
|
||||
for (PRInt32 index = aFirstIndex + 1; index <= aLastIndex; index++) {
|
||||
nsIFrame* frame = (nsIFrame*) mLogicalFrames[index];
|
||||
nsIFrame* frame = mLogicalFrames[index];
|
||||
if (nsGkAtoms::directionalFrame == frame->GetType()) {
|
||||
frame->Destroy();
|
||||
++aOffset;
|
||||
|
@ -1428,7 +1427,7 @@ nsresult nsBidiPresUtils::ProcessText(const PRUnichar* aText,
|
|||
|
||||
nsAutoString runVisualText;
|
||||
runVisualText.Assign(aText + start, subRunLength);
|
||||
if (runVisualText.Length() < subRunLength)
|
||||
if (PRInt32(runVisualText.Length()) < subRunLength)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
FormatUnicodeText(aPresContext, runVisualText.BeginWriting(), subRunLength,
|
||||
(nsCharType)charType, level & 1);
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#ifndef nsBidiPresUtils_h___
|
||||
#define nsBidiPresUtils_h___
|
||||
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsBidi.h"
|
||||
#include "nsBidiUtils.h"
|
||||
|
@ -488,8 +488,8 @@ private:
|
|||
void StripBidiControlCharacters(PRUnichar* aText,
|
||||
PRInt32& aTextLength) const;
|
||||
nsAutoString mBuffer;
|
||||
nsVoidArray mLogicalFrames;
|
||||
nsVoidArray mVisualFrames;
|
||||
nsTArray<nsIFrame*> mLogicalFrames;
|
||||
nsTArray<nsIFrame*> mVisualFrames;
|
||||
nsDataHashtable<nsISupportsHashKey, PRInt32> mContentToFrameIndex;
|
||||
PRInt32 mArraySize;
|
||||
PRInt32* mIndexMap;
|
||||
|
|
|
@ -123,6 +123,7 @@
|
|||
#include "nsStyleUtil.h"
|
||||
#include "nsIFocusEventSuppressor.h"
|
||||
#include "nsBox.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
#include "nsIRootBox.h"
|
||||
|
@ -4979,6 +4980,7 @@ const nsCSSFrameConstructor::FrameConstructionData*
|
|||
nsCSSFrameConstructor::FindHTMLData(nsIContent* aContent,
|
||||
nsIAtom* aTag,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIFrame* aParentFrame,
|
||||
nsStyleContext* aStyleContext)
|
||||
{
|
||||
// Ignore the tag if it's not HTML content and if it doesn't extend (via XBL)
|
||||
|
@ -4989,6 +4991,24 @@ nsCSSFrameConstructor::FindHTMLData(nsIContent* aContent,
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
NS_ASSERTION(!aParentFrame ||
|
||||
aParentFrame->GetStyleContext()->GetPseudoType() !=
|
||||
nsCSSAnonBoxes::fieldsetContent ||
|
||||
aParentFrame->GetParent()->GetType() == nsGkAtoms::fieldSetFrame,
|
||||
"Unexpected parent for fieldset content anon box");
|
||||
if (aTag == nsGkAtoms::legend &&
|
||||
(!aParentFrame ||
|
||||
(aParentFrame->GetType() != nsGkAtoms::fieldSetFrame &&
|
||||
aParentFrame->GetStyleContext()->GetPseudoType() !=
|
||||
nsCSSAnonBoxes::fieldsetContent))) {
|
||||
// <legend> is only special inside fieldset frames
|
||||
// XXXbz it would be nice if we could just decide this based on the parent
|
||||
// tag, and hence just use a SIMPLE_TAG_CHAIN for legend below, but the
|
||||
// fact that with XBL we could end up with this legend element in some
|
||||
// totally weird insertion point makes that chancy, I think.
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
static const FrameConstructionDataByTag sHTMLData[] = {
|
||||
SIMPLE_TAG_CHAIN(img, nsCSSFrameConstructor::FindImgData),
|
||||
SIMPLE_TAG_CHAIN(mozgeneratedcontentimage,
|
||||
|
@ -5047,8 +5067,6 @@ nsCSSFrameConstructor::FindImgControlData(nsIContent* aContent,
|
|||
return &sImgControlData;
|
||||
}
|
||||
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
|
||||
/* static */
|
||||
const nsCSSFrameConstructor::FrameConstructionData*
|
||||
nsCSSFrameConstructor::FindInputData(nsIContent* aContent,
|
||||
|
@ -5074,41 +5092,8 @@ nsCSSFrameConstructor::FindInputData(nsIContent* aContent,
|
|||
|
||||
nsCOMPtr<nsIFormControl> control = do_QueryInterface(aContent);
|
||||
NS_ASSERTION(control, "input doesn't implement nsIFormControl?");
|
||||
|
||||
if (!control) { // Speculative parsing is screwing up somehow, dammit
|
||||
printf("TinderboxPrint: FOUND BOGUS INPUT\n");
|
||||
printf("Passed in content pointer is: %p\n", (void*)aContent);
|
||||
if (aContent) {
|
||||
printf("Passed in content has namespace: %d\n",
|
||||
aContent->GetNameSpaceID());
|
||||
const char* localName = nsnull;
|
||||
aContent->Tag()->GetUTF8String(&localName);
|
||||
printf("Passed in content has localName: %s\n", localName);
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> elm = do_QueryInterface(aContent);
|
||||
printf("Passed in content QI to nsIDOMHTMLInputElement is: %p\n",
|
||||
(void*)elm.get());
|
||||
|
||||
nsCOMPtr<nsIClassInfo> classInfo = do_QueryInterface(aContent);
|
||||
printf("Passed in content QI to nsIClassInfo is: %p\n",
|
||||
(void*)classInfo.get());
|
||||
|
||||
if (classInfo) {
|
||||
nsXPIDLCString desc;
|
||||
classInfo->GetClassDescription(getter_Copies(desc));
|
||||
printf("Passed in classinfo description is: %s\n", desc.get());
|
||||
PRUint32 ifaceCount = 0;
|
||||
nsIID** iidArray = nsnull;
|
||||
classInfo->GetInterfaces(&ifaceCount, &iidArray);
|
||||
for (PRUint32 i = 0; i < ifaceCount; ++i) {
|
||||
char buf[NSID_LENGTH];
|
||||
iidArray[i]->ToProvidedString(buf);
|
||||
printf("Classinfo knows about interface: %s\n", buf);
|
||||
}
|
||||
NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(ifaceCount, iidArray);
|
||||
}
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
if (!control) {
|
||||
printf("BOGUS INPUT DETECTED IN FRAME CONSTRUCTION (about to crash).\n");
|
||||
}
|
||||
|
||||
return FindDataByInt(control->GetType(), aContent, aStyleContext,
|
||||
|
@ -6758,7 +6743,8 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsFrameConstructorState& aState,
|
|||
if (isText) {
|
||||
data = FindTextData(aParentFrame);
|
||||
} else {
|
||||
data = FindHTMLData(aContent, aTag, aNameSpaceID, styleContext);
|
||||
data = FindHTMLData(aContent, aTag, aNameSpaceID, aParentFrame,
|
||||
styleContext);
|
||||
if (!data) {
|
||||
data = FindXULTagData(aContent, aTag, aNameSpaceID, styleContext);
|
||||
}
|
||||
|
@ -7925,12 +7911,20 @@ nsCSSFrameConstructor::ContentInserted(nsIContent* aContainer,
|
|||
// this case. If someone wants to use an index below, they should make
|
||||
// sure to use the right index (aIndexInContainer vs iter.position()) with
|
||||
// the right parent node.
|
||||
} else {
|
||||
// Do things the fast way if we can.
|
||||
} else if (aIndexInContainer != -1) {
|
||||
// Do things the fast way if we can. The check for -1 is because editor is
|
||||
// severely broken and calls us directly for native anonymous nodes that it
|
||||
// creates.
|
||||
iter.seek(aIndexInContainer);
|
||||
NS_ASSERTION(*iter == aChild, "Someone screwed up the indexing");
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
else {
|
||||
NS_WARNING("Someone passed native anonymous content directly into frame "
|
||||
"construction. Stop doing that!");
|
||||
}
|
||||
#endif
|
||||
|
||||
nsIFrame* prevSibling = FindPreviousSibling(first, iter);
|
||||
|
||||
PRBool isAppend = PR_FALSE;
|
||||
|
@ -8207,16 +8201,16 @@ nsCSSFrameConstructor::ReinsertContent(nsIContent* aContainer,
|
|||
}
|
||||
|
||||
static void
|
||||
DoDeletingFrameSubtree(nsFrameManager* aFrameManager,
|
||||
nsVoidArray& aDestroyQueue,
|
||||
nsIFrame* aRemovedFrame,
|
||||
nsIFrame* aFrame);
|
||||
DoDeletingFrameSubtree(nsFrameManager* aFrameManager,
|
||||
nsTArray<nsIFrame*>& aDestroyQueue,
|
||||
nsIFrame* aRemovedFrame,
|
||||
nsIFrame* aFrame);
|
||||
|
||||
static void
|
||||
DoDeletingOverflowContainers(nsFrameManager* aFrameManager,
|
||||
nsVoidArray& aDestroyQueue,
|
||||
nsIFrame* aRemovedFrame,
|
||||
nsIFrame* aFrame)
|
||||
DoDeletingOverflowContainers(nsFrameManager* aFrameManager,
|
||||
nsTArray<nsIFrame*>& aDestroyQueue,
|
||||
nsIFrame* aRemovedFrame,
|
||||
nsIFrame* aFrame)
|
||||
{
|
||||
// The invariant that "continuing frames should be found as part of the
|
||||
// walk over the top-most frame's continuing frames" does not hold for
|
||||
|
@ -8257,10 +8251,10 @@ DoDeletingOverflowContainers(nsFrameManager* aFrameManager,
|
|||
* this changes
|
||||
*/
|
||||
static void
|
||||
DoDeletingFrameSubtree(nsFrameManager* aFrameManager,
|
||||
nsVoidArray& aDestroyQueue,
|
||||
nsIFrame* aRemovedFrame,
|
||||
nsIFrame* aFrame)
|
||||
DoDeletingFrameSubtree(nsFrameManager* aFrameManager,
|
||||
nsTArray<nsIFrame*>& aDestroyQueue,
|
||||
nsIFrame* aRemovedFrame,
|
||||
nsIFrame* aFrame)
|
||||
{
|
||||
#undef RECURSE
|
||||
#define RECURSE(top, child) \
|
||||
|
@ -8341,7 +8335,7 @@ DeletingFrameSubtree(nsFrameManager* aFrameManager,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAutoVoidArray destroyQueue;
|
||||
nsAutoTArray<nsIFrame*, 8> destroyQueue;
|
||||
|
||||
// If it's a "special" block-in-inline frame, then we can't really deal.
|
||||
// That really shouldn't be happening.
|
||||
|
@ -8365,8 +8359,8 @@ DeletingFrameSubtree(nsFrameManager* aFrameManager,
|
|||
|
||||
// Now destroy any out-of-flow frames that have been enqueued for
|
||||
// destruction.
|
||||
for (PRInt32 i = destroyQueue.Count() - 1; i >= 0; --i) {
|
||||
nsIFrame* outOfFlowFrame = static_cast<nsIFrame*>(destroyQueue[i]);
|
||||
for (PRInt32 i = destroyQueue.Length() - 1; i >= 0; --i) {
|
||||
nsIFrame* outOfFlowFrame = destroyQueue[i];
|
||||
|
||||
// Ask the out-of-flow's parent to delete the out-of-flow
|
||||
// frame from the right list.
|
||||
|
|
|
@ -61,7 +61,6 @@ class nsStyleContext;
|
|||
struct nsStyleContent;
|
||||
struct nsStyleDisplay;
|
||||
class nsIPresShell;
|
||||
class nsVoidArray;
|
||||
class nsFrameManager;
|
||||
class nsIDOMHTMLSelectElement;
|
||||
class nsPresContext;
|
||||
|
@ -792,6 +791,7 @@ private:
|
|||
static const FrameConstructionData* FindHTMLData(nsIContent* aContent,
|
||||
nsIAtom* aTag,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIFrame* aParentFrame,
|
||||
nsStyleContext* aStyleContext);
|
||||
// HTML data-finding helper functions
|
||||
static const FrameConstructionData*
|
||||
|
|
|
@ -950,7 +950,7 @@ FindCanvasBackground(nsIFrame* aForFrame, nsIFrame* aRootElementFrame,
|
|||
// being loaded.
|
||||
*aBackground = aForFrame->GetStyleBackground();
|
||||
}
|
||||
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "nsCounterManager.h"
|
||||
#include "nsBulletFrame.h" // legacy location for list style type to text code
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
PRBool
|
||||
nsCounterUseNode::InitTextFrame(nsGenConList* aList,
|
||||
|
@ -98,7 +99,7 @@ nsCounterUseNode::GetText(nsString& aResult)
|
|||
{
|
||||
aResult.Truncate();
|
||||
|
||||
nsAutoVoidArray stack;
|
||||
nsAutoTArray<nsCounterNode*, 8> stack;
|
||||
stack.AppendElement(static_cast<nsCounterNode*>(this));
|
||||
|
||||
if (mAllCounters && mScopeStart)
|
||||
|
@ -110,8 +111,8 @@ nsCounterUseNode::GetText(nsString& aResult)
|
|||
if (mAllCounters)
|
||||
separator = mCounterStyle->Item(1).GetStringBufferValue();
|
||||
|
||||
for (PRInt32 i = stack.Count() - 1;; --i) {
|
||||
nsCounterNode *n = static_cast<nsCounterNode*>(stack[i]);
|
||||
for (PRUint32 i = stack.Length() - 1;; --i) {
|
||||
nsCounterNode *n = stack[i];
|
||||
nsBulletFrame::AppendCounterText(style, n->mValueAfter, aResult);
|
||||
if (i == 0)
|
||||
break;
|
||||
|
|
|
@ -79,6 +79,7 @@
|
|||
#include "gfxMatrix.h"
|
||||
#include "gfxTypes.h"
|
||||
#include "gfxUserFontSet.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
#include "nsSVGUtils.h"
|
||||
|
@ -1586,7 +1587,7 @@ nsLayoutUtils::GetClosestCommonAncestorViaPlaceholders(nsIFrame* aFrame1,
|
|||
}
|
||||
nsFrameManager* frameManager = presContext->PresShell()->FrameManager();
|
||||
|
||||
nsAutoVoidArray frame1Ancestors;
|
||||
nsAutoTArray<nsIFrame*, 8> frame1Ancestors;
|
||||
nsIFrame* f1;
|
||||
for (f1 = aFrame1; f1 && f1 != aKnownCommonAncestorHint;
|
||||
f1 = GetParentOrPlaceholderFor(frameManager, f1)) {
|
||||
|
@ -1598,7 +1599,7 @@ nsLayoutUtils::GetClosestCommonAncestorViaPlaceholders(nsIFrame* aFrame1,
|
|||
aKnownCommonAncestorHint = nsnull;
|
||||
}
|
||||
|
||||
nsAutoVoidArray frame2Ancestors;
|
||||
nsAutoTArray<nsIFrame*, 8> frame2Ancestors;
|
||||
nsIFrame* f2;
|
||||
for (f2 = aFrame2; f2 && f2 != aKnownCommonAncestorHint;
|
||||
f2 = GetParentOrPlaceholderFor(frameManager, f2)) {
|
||||
|
@ -1615,10 +1616,10 @@ nsLayoutUtils::GetClosestCommonAncestorViaPlaceholders(nsIFrame* aFrame1,
|
|||
// the root frame. We need to walk from the end (i.e., the top of the
|
||||
// frame (sub)tree) down to aFrame1/aFrame2 looking for the first difference.
|
||||
nsIFrame* lastCommonFrame = aKnownCommonAncestorHint;
|
||||
PRInt32 last1 = frame1Ancestors.Count() - 1;
|
||||
PRInt32 last2 = frame2Ancestors.Count() - 1;
|
||||
PRInt32 last1 = frame1Ancestors.Length() - 1;
|
||||
PRInt32 last2 = frame2Ancestors.Length() - 1;
|
||||
while (last1 >= 0 && last2 >= 0) {
|
||||
nsIFrame* frame1 = static_cast<nsIFrame*>(frame1Ancestors.ElementAt(last1));
|
||||
nsIFrame* frame1 = frame1Ancestors.ElementAt(last1);
|
||||
if (frame1 != frame2Ancestors.ElementAt(last2))
|
||||
break;
|
||||
lastCommonFrame = frame1;
|
||||
|
@ -3055,6 +3056,15 @@ nsLayoutUtils::GetFrameTransparency(nsIFrame* aFrame) {
|
|||
|
||||
if (aFrame->GetStyleDisplay()->mAppearance == NS_THEME_WIN_GLASS)
|
||||
return eTransparencyGlass;
|
||||
|
||||
// We need an uninitialized window to be treated as opaque because
|
||||
// doing otherwise breaks window display effects on some platforms,
|
||||
// specifically Vista. (bug 450322)
|
||||
if (aFrame->GetType() == nsGkAtoms::viewportFrame &&
|
||||
!aFrame->GetFirstChild(nsnull)) {
|
||||
return eTransparencyOpaque;
|
||||
}
|
||||
|
||||
PRBool isCanvas;
|
||||
const nsStyleBackground* bg;
|
||||
if (!nsCSSRendering::FindBackground(aFrame->PresContext(), aFrame, &bg, &isCanvas))
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
#include "prmem.h"
|
||||
#include "prprf.h"
|
||||
#include "prinrval.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsIViewObserver.h"
|
||||
|
@ -1123,7 +1123,7 @@ protected:
|
|||
PRUint32 mUpdateCount;
|
||||
#endif
|
||||
// reflow roots that need to be reflowed, as both a queue and a hashtable
|
||||
nsVoidArray mDirtyRoots;
|
||||
nsTArray<nsIFrame*> mDirtyRoots;
|
||||
|
||||
PRPackedBool mDocumentLoading;
|
||||
PRPackedBool mIsReflowing;
|
||||
|
@ -1133,7 +1133,7 @@ protected:
|
|||
|
||||
nsIFrame* mCurrentEventFrame;
|
||||
nsCOMPtr<nsIContent> mCurrentEventContent;
|
||||
nsVoidArray mCurrentEventFrameStack;
|
||||
nsTArray<nsIFrame*> mCurrentEventFrameStack;
|
||||
nsCOMArray<nsIContent> mCurrentEventContentStack;
|
||||
|
||||
nsCOMPtr<nsIContent> mLastAnchorScrolledTo;
|
||||
|
@ -1664,9 +1664,9 @@ PresShell::Destroy()
|
|||
|
||||
mCurrentEventFrame = nsnull;
|
||||
|
||||
PRInt32 i, count = mCurrentEventFrameStack.Count();
|
||||
PRInt32 i, count = mCurrentEventFrameStack.Length();
|
||||
for (i = 0; i < count; i++) {
|
||||
mCurrentEventFrameStack.ReplaceElementAt(nsnull, i);
|
||||
mCurrentEventFrameStack[i] = nsnull;
|
||||
}
|
||||
|
||||
if (mViewManager) {
|
||||
|
@ -2440,14 +2440,14 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
|
|||
if (rootFrame) {
|
||||
// Note: Because the frame just got created, it has the NS_FRAME_IS_DIRTY
|
||||
// bit set. Unset it so that FrameNeedsReflow() will work right.
|
||||
NS_ASSERTION(mDirtyRoots.IndexOf(rootFrame) == -1,
|
||||
NS_ASSERTION(!mDirtyRoots.Contains(rootFrame),
|
||||
"Why is the root in mDirtyRoots already?");
|
||||
|
||||
rootFrame->RemoveStateBits(NS_FRAME_IS_DIRTY |
|
||||
NS_FRAME_HAS_DIRTY_CHILDREN);
|
||||
FrameNeedsReflow(rootFrame, eResize, NS_FRAME_IS_DIRTY);
|
||||
|
||||
NS_ASSERTION(mDirtyRoots.IndexOf(rootFrame) != -1,
|
||||
NS_ASSERTION(mDirtyRoots.Contains(rootFrame),
|
||||
"Should be in mDirtyRoots now");
|
||||
NS_ASSERTION(mReflowEvent.IsPending(), "Why no reflow event pending?");
|
||||
}
|
||||
|
@ -2604,7 +2604,7 @@ PresShell::NotifyDestroyingFrame(nsIFrame* aFrame)
|
|||
if (!mIgnoreFrameDestruction) {
|
||||
mFrameConstructor->NotifyDestroyingFrame(aFrame);
|
||||
|
||||
for (PRInt32 idx = mDirtyRoots.Count(); idx; ) {
|
||||
for (PRInt32 idx = mDirtyRoots.Length(); idx; ) {
|
||||
--idx;
|
||||
if (mDirtyRoots[idx] == aFrame) {
|
||||
mDirtyRoots.RemoveElementAt(idx);
|
||||
|
@ -3103,7 +3103,7 @@ PresShell::VerifyHasDirtyRootAncestor(nsIFrame* aFrame)
|
|||
while (aFrame && (aFrame->GetStateBits() & NS_FRAME_HAS_DIRTY_CHILDREN)) {
|
||||
if (((aFrame->GetStateBits() & NS_FRAME_REFLOW_ROOT) ||
|
||||
!aFrame->GetParent()) &&
|
||||
mDirtyRoots.IndexOf(aFrame) != -1) {
|
||||
mDirtyRoots.Contains(aFrame)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3121,6 +3121,9 @@ PresShell::FrameNeedsReflow(nsIFrame *aFrame, IntrinsicDirty aIntrinsicDirty,
|
|||
NS_PRECONDITION(aBitToAdd == NS_FRAME_IS_DIRTY ||
|
||||
aBitToAdd == NS_FRAME_HAS_DIRTY_CHILDREN,
|
||||
"Unexpected bits being added");
|
||||
NS_PRECONDITION(aIntrinsicDirty != eStyleChange ||
|
||||
aBitToAdd == NS_FRAME_IS_DIRTY,
|
||||
"bits don't correspond to style change reason");
|
||||
|
||||
NS_ASSERTION(!mIsReflowing, "can't mark frame dirty during reflow");
|
||||
|
||||
|
@ -3151,88 +3154,106 @@ PresShell::FrameNeedsReflow(nsIFrame *aFrame, IntrinsicDirty aIntrinsicDirty,
|
|||
}
|
||||
#endif
|
||||
|
||||
// Grab |wasDirty| now so we can go ahead and update the bits on aFrame.
|
||||
PRBool wasDirty = NS_SUBTREE_DIRTY(aFrame);
|
||||
aFrame->AddStateBits(aBitToAdd);
|
||||
nsAutoTArray<nsIFrame*, 4> subtrees;
|
||||
subtrees.AppendElement(aFrame);
|
||||
|
||||
// Now if aFrame is a reflow root we can cut off this reflow at it if the bit
|
||||
// being added is NS_FRAME_HAS_DIRTY_CHILDREN.
|
||||
PRBool targetFrameDirty = (aBitToAdd == NS_FRAME_IS_DIRTY);
|
||||
do {
|
||||
nsIFrame *subtreeRoot = subtrees.ElementAt(subtrees.Length() - 1);
|
||||
subtrees.RemoveElementAt(subtrees.Length() - 1);
|
||||
|
||||
// Grab |wasDirty| now so we can go ahead and update the bits on
|
||||
// subtreeRoot.
|
||||
PRBool wasDirty = NS_SUBTREE_DIRTY(subtreeRoot);
|
||||
subtreeRoot->AddStateBits(aBitToAdd);
|
||||
|
||||
// Now if subtreeRoot is a reflow root we can cut off this reflow at it if
|
||||
// the bit being added is NS_FRAME_HAS_DIRTY_CHILDREN.
|
||||
PRBool targetFrameDirty = (aBitToAdd == NS_FRAME_IS_DIRTY);
|
||||
|
||||
#define FRAME_IS_REFLOW_ROOT(_f) \
|
||||
((_f->GetStateBits() & NS_FRAME_REFLOW_ROOT) && \
|
||||
(_f != aFrame || !targetFrameDirty))
|
||||
(_f != subtreeRoot || !targetFrameDirty))
|
||||
|
||||
|
||||
// Mark the intrinsic widths as dirty on the frame, all of its ancestors,
|
||||
// and all of its descendants, if needed:
|
||||
// Mark the intrinsic widths as dirty on the frame, all of its ancestors,
|
||||
// and all of its descendants, if needed:
|
||||
|
||||
if (aIntrinsicDirty != eResize) {
|
||||
// Mark argument and all ancestors dirty. (Unless we hit a reflow root that
|
||||
// should contain the reflow. That root could be aFrame itself if it's not
|
||||
// dirty, or it could be some ancestor of aFrame.)
|
||||
for (nsIFrame *a = aFrame;
|
||||
a && !FRAME_IS_REFLOW_ROOT(a);
|
||||
a = a->GetParent())
|
||||
a->MarkIntrinsicWidthsDirty();
|
||||
}
|
||||
if (aIntrinsicDirty != eResize) {
|
||||
// Mark argument and all ancestors dirty. (Unless we hit a reflow
|
||||
// root that should contain the reflow. That root could be
|
||||
// subtreeRoot itself if it's not dirty, or it could be some
|
||||
// ancestor of subtreeRoot.)
|
||||
for (nsIFrame *a = subtreeRoot;
|
||||
a && !FRAME_IS_REFLOW_ROOT(a);
|
||||
a = a->GetParent())
|
||||
a->MarkIntrinsicWidthsDirty();
|
||||
}
|
||||
|
||||
if (aIntrinsicDirty == eStyleChange) {
|
||||
// Mark all descendants dirty (using an nsVoidArray stack rather than
|
||||
// recursion).
|
||||
nsVoidArray stack;
|
||||
stack.AppendElement(aFrame);
|
||||
if (aIntrinsicDirty == eStyleChange) {
|
||||
// Mark all descendants dirty (using an nsTArray stack rather than
|
||||
// recursion).
|
||||
nsAutoTArray<nsIFrame*, 32> stack;
|
||||
stack.AppendElement(subtreeRoot);
|
||||
|
||||
while (stack.Count() != 0) {
|
||||
nsIFrame *f =
|
||||
static_cast<nsIFrame*>(stack.FastElementAt(stack.Count() - 1));
|
||||
stack.RemoveElementAt(stack.Count() - 1);
|
||||
|
||||
PRInt32 childListIndex = 0;
|
||||
nsIAtom *childListName;
|
||||
do {
|
||||
childListName = f->GetAdditionalChildListName(childListIndex++);
|
||||
for (nsIFrame *kid = f->GetFirstChild(childListName); kid;
|
||||
kid = kid->GetNextSibling()) {
|
||||
kid->MarkIntrinsicWidthsDirty();
|
||||
stack.AppendElement(kid);
|
||||
nsIFrame *f = stack.ElementAt(stack.Length() - 1);
|
||||
stack.RemoveElementAt(stack.Length() - 1);
|
||||
|
||||
if (f->GetType() == nsGkAtoms::placeholderFrame) {
|
||||
nsIFrame *oof = nsPlaceholderFrame::GetRealFrameForPlaceholder(f);
|
||||
if (!nsLayoutUtils::IsProperAncestorFrame(subtreeRoot, oof)) {
|
||||
// We have another distinct subtree we need to mark.
|
||||
subtrees.AppendElement(oof);
|
||||
}
|
||||
}
|
||||
} while (childListName);
|
||||
}
|
||||
}
|
||||
|
||||
// Set NS_FRAME_HAS_DIRTY_CHILDREN bits (via nsIFrame::ChildIsDirty) up the
|
||||
// tree until we reach either a frame that's already dirty or a reflow root.
|
||||
nsIFrame *f = aFrame;
|
||||
for (;;) {
|
||||
if (FRAME_IS_REFLOW_ROOT(f) || !f->GetParent()) {
|
||||
// we've hit a reflow root or the root frame
|
||||
if (!wasDirty) {
|
||||
mDirtyRoots.AppendElement(f);
|
||||
}
|
||||
PRInt32 childListIndex = 0;
|
||||
nsIAtom *childListName;
|
||||
do {
|
||||
childListName = f->GetAdditionalChildListName(childListIndex++);
|
||||
for (nsIFrame *kid = f->GetFirstChild(childListName); kid;
|
||||
kid = kid->GetNextSibling()) {
|
||||
kid->MarkIntrinsicWidthsDirty();
|
||||
stack.AppendElement(kid);
|
||||
}
|
||||
} while (childListName);
|
||||
} while (stack.Length() != 0);
|
||||
}
|
||||
|
||||
// Set NS_FRAME_HAS_DIRTY_CHILDREN bits (via nsIFrame::ChildIsDirty)
|
||||
// up the tree until we reach either a frame that's already dirty or
|
||||
// a reflow root.
|
||||
nsIFrame *f = subtreeRoot;
|
||||
for (;;) {
|
||||
if (FRAME_IS_REFLOW_ROOT(f) || !f->GetParent()) {
|
||||
// we've hit a reflow root or the root frame
|
||||
if (!wasDirty) {
|
||||
mDirtyRoots.AppendElement(f);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else {
|
||||
VerifyHasDirtyRootAncestor(f);
|
||||
}
|
||||
#endif
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
nsIFrame *child = f;
|
||||
f = f->GetParent();
|
||||
wasDirty = NS_SUBTREE_DIRTY(f);
|
||||
f->ChildIsDirty(child);
|
||||
NS_ASSERTION(f->GetStateBits() & NS_FRAME_HAS_DIRTY_CHILDREN,
|
||||
"ChildIsDirty didn't do its job");
|
||||
if (wasDirty) {
|
||||
// This frame was already marked dirty.
|
||||
#ifdef DEBUG
|
||||
else {
|
||||
VerifyHasDirtyRootAncestor(f);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
nsIFrame *child = f;
|
||||
f = f->GetParent();
|
||||
wasDirty = NS_SUBTREE_DIRTY(f);
|
||||
f->ChildIsDirty(child);
|
||||
NS_ASSERTION(f->GetStateBits() & NS_FRAME_HAS_DIRTY_CHILDREN,
|
||||
"ChildIsDirty didn't do its job");
|
||||
if (wasDirty) {
|
||||
// This frame was already marked dirty.
|
||||
#ifdef DEBUG
|
||||
VerifyHasDirtyRootAncestor(f);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (subtrees.Length() != 0);
|
||||
|
||||
PostReflowEvent();
|
||||
|
||||
|
@ -3358,13 +3379,13 @@ PresShell::ClearFrameRefs(nsIFrame* aFrame)
|
|||
}
|
||||
#endif
|
||||
|
||||
for (int i=0; i<mCurrentEventFrameStack.Count(); i++) {
|
||||
if (aFrame == (nsIFrame*)mCurrentEventFrameStack.ElementAt(i)) {
|
||||
for (unsigned int i=0; i < mCurrentEventFrameStack.Length(); i++) {
|
||||
if (aFrame == mCurrentEventFrameStack.ElementAt(i)) {
|
||||
//One of our stack frames was deleted. Get its content so that when we
|
||||
//pop it we can still get its new frame from its content
|
||||
nsIContent *currentEventContent = aFrame->GetContent();
|
||||
mCurrentEventContentStack.ReplaceObjectAt(currentEventContent, i);
|
||||
mCurrentEventFrameStack.ReplaceElementAt(nsnull, i);
|
||||
mCurrentEventFrameStack[i] = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4303,7 +4324,7 @@ PresShell::UnsuppressPainting()
|
|||
// the reflows and get all the frames where we want them
|
||||
// before actually unlocking the painting. Otherwise
|
||||
// go ahead and unlock now.
|
||||
if (mDirtyRoots.Count() > 0)
|
||||
if (mDirtyRoots.Length() > 0)
|
||||
mShouldUnsuppressPainting = PR_TRUE;
|
||||
else
|
||||
UnsuppressAndInvalidate();
|
||||
|
@ -5431,7 +5452,7 @@ void
|
|||
PresShell::PushCurrentEventInfo(nsIFrame* aFrame, nsIContent* aContent)
|
||||
{
|
||||
if (mCurrentEventFrame || mCurrentEventContent) {
|
||||
mCurrentEventFrameStack.InsertElementAt((void*)mCurrentEventFrame, 0);
|
||||
mCurrentEventFrameStack.InsertElementAt(0, mCurrentEventFrame);
|
||||
mCurrentEventContentStack.InsertObjectAt(mCurrentEventContent, 0);
|
||||
}
|
||||
mCurrentEventFrame = aFrame;
|
||||
|
@ -5444,8 +5465,8 @@ PresShell::PopCurrentEventInfo()
|
|||
mCurrentEventFrame = nsnull;
|
||||
mCurrentEventContent = nsnull;
|
||||
|
||||
if (0 != mCurrentEventFrameStack.Count()) {
|
||||
mCurrentEventFrame = (nsIFrame*)mCurrentEventFrameStack.ElementAt(0);
|
||||
if (0 != mCurrentEventFrameStack.Length()) {
|
||||
mCurrentEventFrame = mCurrentEventFrameStack.ElementAt(0);
|
||||
mCurrentEventFrameStack.RemoveElementAt(0);
|
||||
mCurrentEventContent = mCurrentEventContentStack.ObjectAt(0);
|
||||
mCurrentEventContentStack.RemoveObjectAt(0);
|
||||
|
@ -6503,7 +6524,7 @@ void
|
|||
PresShell::PostReflowEvent()
|
||||
{
|
||||
if (mReflowEvent.IsPending() || mIsDestroying || mIsReflowing ||
|
||||
mDirtyRoots.Count() == 0)
|
||||
mDirtyRoots.Length() == 0)
|
||||
return;
|
||||
|
||||
nsRefPtr<ReflowEvent> ev = new ReflowEvent(this);
|
||||
|
@ -6659,7 +6680,7 @@ PresShell::DoVerifyReflow()
|
|||
ok ? "ok" : "failed");
|
||||
}
|
||||
|
||||
if (0 != mDirtyRoots.Count()) {
|
||||
if (0 != mDirtyRoots.Length()) {
|
||||
printf("XXX yikes! reflow commands queued during verify-reflow\n");
|
||||
}
|
||||
}
|
||||
|
@ -6672,7 +6693,7 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible)
|
|||
MOZ_TIMER_DEBUGLOG(("Start: Reflow: PresShell::ProcessReflowCommands(), this=%p\n", this));
|
||||
MOZ_TIMER_START(mReflowWatch);
|
||||
|
||||
if (0 != mDirtyRoots.Count()) {
|
||||
if (0 != mDirtyRoots.Length()) {
|
||||
|
||||
#ifdef DEBUG
|
||||
if (VERIFY_REFLOW_DUMP_COMMANDS & gVerifyReflowFlags) {
|
||||
|
@ -6695,8 +6716,8 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible)
|
|||
|
||||
do {
|
||||
// Send an incremental reflow notification to the target frame.
|
||||
PRInt32 idx = mDirtyRoots.Count() - 1;
|
||||
nsIFrame *target = static_cast<nsIFrame*>(mDirtyRoots[idx]);
|
||||
PRInt32 idx = mDirtyRoots.Length() - 1;
|
||||
nsIFrame *target = mDirtyRoots[idx];
|
||||
mDirtyRoots.RemoveElementAt(idx);
|
||||
|
||||
if (!NS_SUBTREE_DIRTY(target)) {
|
||||
|
@ -6710,7 +6731,7 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible)
|
|||
|
||||
// Keep going until we're out of reflow commands, or we've run
|
||||
// past our deadline.
|
||||
} while (mDirtyRoots.Count() &&
|
||||
} while (mDirtyRoots.Length() &&
|
||||
(!aInterruptible || PR_IntervalNow() < deadline));
|
||||
|
||||
// XXXwaterson for interruptible reflow, examine the tree and
|
||||
|
@ -6739,7 +6760,7 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible)
|
|||
// after DidDoReflow(), since that method can change whether there are
|
||||
// dirty roots around by flushing, and there's no point in posting a
|
||||
// reflow event just to have the flush revoke it.
|
||||
if (mDirtyRoots.Count())
|
||||
if (mDirtyRoots.Length())
|
||||
PostReflowEvent();
|
||||
}
|
||||
}
|
||||
|
@ -6748,7 +6769,7 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible)
|
|||
MOZ_TIMER_STOP(mReflowWatch);
|
||||
|
||||
if (!mIsDestroying && mShouldUnsuppressPainting &&
|
||||
mDirtyRoots.Count() == 0) {
|
||||
mDirtyRoots.Length() == 0) {
|
||||
// We only unlock if we're out of reflows. It's pointless
|
||||
// to unlock if reflows are still pending, since reflows
|
||||
// are just going to thrash the frames around some more. By
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
class nsPresContext;
|
||||
class nsString;
|
||||
class nsIContent;
|
||||
class nsVoidArray;
|
||||
class nsCSSFrameConstructor;
|
||||
|
||||
/**
|
||||
|
|
|
@ -63,9 +63,6 @@ class nsIDOMHTMLOptionsCollection;
|
|||
class nsIDOMHTMLOptionElement;
|
||||
class nsIComboboxControlFrame;
|
||||
class nsPresContext;
|
||||
class nsVoidArray;
|
||||
|
||||
class nsVoidArray;
|
||||
class nsListEventListener;
|
||||
|
||||
/**
|
||||
|
|
|
@ -6715,7 +6715,7 @@ nsBlockFrame::CheckFloats(nsBlockReflowState& aState)
|
|||
PRBool anyLineDirty = PR_FALSE;
|
||||
|
||||
// Check that the float list is what we would have built
|
||||
nsAutoVoidArray lineFloats;
|
||||
nsAutoTArray<nsIFrame*, 8> lineFloats;
|
||||
for (line_iterator line = begin_lines(), line_end = end_lines();
|
||||
line != line_end; ++line) {
|
||||
if (line->HasFloats()) {
|
||||
|
@ -6731,25 +6731,25 @@ nsBlockFrame::CheckFloats(nsBlockReflowState& aState)
|
|||
}
|
||||
}
|
||||
|
||||
nsAutoVoidArray storedFloats;
|
||||
nsAutoTArray<nsIFrame*, 8> storedFloats;
|
||||
PRBool equal = PR_TRUE;
|
||||
PRInt32 i = 0;
|
||||
PRUint32 i = 0;
|
||||
for (nsIFrame* f = mFloats.FirstChild(); f; f = f->GetNextSibling()) {
|
||||
storedFloats.AppendElement(f);
|
||||
if (i < lineFloats.Count() && lineFloats.ElementAt(i) != f) {
|
||||
if (i < lineFloats.Length() && lineFloats.ElementAt(i) != f) {
|
||||
equal = PR_FALSE;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
if ((!equal || lineFloats.Count() != storedFloats.Count()) && !anyLineDirty) {
|
||||
if ((!equal || lineFloats.Length() != storedFloats.Length()) && !anyLineDirty) {
|
||||
NS_WARNING("nsBlockFrame::CheckFloats: Explicit float list is out of sync with float cache");
|
||||
#if defined(DEBUG_roc)
|
||||
nsIFrameDebug::RootFrameList(PresContext(), stdout, 0);
|
||||
for (i = 0; i < lineFloats.Count(); ++i) {
|
||||
for (i = 0; i < lineFloats.Length(); ++i) {
|
||||
printf("Line float: %p\n", lineFloats.ElementAt(i));
|
||||
}
|
||||
for (i = 0; i < storedFloats.Count(); ++i) {
|
||||
for (i = 0; i < storedFloats.Length(); ++i) {
|
||||
printf("Stored float: %p\n", storedFloats.ElementAt(i));
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -353,6 +353,9 @@ nsBlockReflowState::GetAvailableSpace(nscoord aY, PRBool aRelaxHeightConstraint)
|
|||
mContentArea.width,
|
||||
&hasFloats);
|
||||
mBandHasFloats = hasFloats;
|
||||
// Keep the width >= 0 for compatibility with nsSpaceManager.
|
||||
if (mAvailSpaceRect.width < 0)
|
||||
mAvailSpaceRect.width = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (nsBlockFrame::gNoisyReflow) {
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче