Merged m-c
This commit is contained in:
@@ -139,7 +139,7 @@ public:
|
||||
/**
|
||||
* Invalidate the accessible tree when DOM tree or frame tree is changed.
|
||||
*
|
||||
* @param aPresShell [in] the presShell where changes occured
|
||||
* @param aPresShell [in] the presShell where changes occurred
|
||||
* @param aContent [in] the affected DOM content
|
||||
* @param aChangeType [in] the change type (see constants declared above)
|
||||
*/
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
object. For that XBL binding of element should implement the interface.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(3f7f9194-c625-4a85-8148-6d92d34897fa)]
|
||||
[scriptable, uuid(89fb8270-4f25-11df-9879-0800200c9a66)]
|
||||
interface nsIAccessibleProvider : nsISupports
|
||||
{
|
||||
/**
|
||||
@@ -126,7 +126,7 @@ interface nsIAccessibleProvider : nsISupports
|
||||
/** Used for label element */
|
||||
const long XFormsLabel = 0x00002001;
|
||||
/** Used for output element */
|
||||
const long XFormsOuput = 0x00002002;
|
||||
const long XFormsOutput = 0x00002002;
|
||||
/** Used for trigger and submit elements */
|
||||
const long XFormsTrigger = 0x00002003;
|
||||
/** Used for input and textarea elements */
|
||||
|
||||
@@ -195,6 +195,7 @@ ACCESSIBILITY_ATOM(selected, "selected")
|
||||
ACCESSIBILITY_ATOM(summary, "summary")
|
||||
ACCESSIBILITY_ATOM(tabindex, "tabindex")
|
||||
ACCESSIBILITY_ATOM(title, "title")
|
||||
ACCESSIBILITY_ATOM(toolbarname, "toolbarname")
|
||||
ACCESSIBILITY_ATOM(tooltiptext, "tooltiptext")
|
||||
ACCESSIBILITY_ATOM(type, "type")
|
||||
ACCESSIBILITY_ATOM(usemap, "usemap")
|
||||
|
||||
@@ -1971,7 +1971,7 @@ nsAccessibilityService::CreateAccessibleByType(nsIDOMNode *aNode,
|
||||
case nsIAccessibleProvider::XFormsLabel:
|
||||
accessible = new nsXFormsLabelAccessible(aNode, aWeakShell);
|
||||
break;
|
||||
case nsIAccessibleProvider::XFormsOuput:
|
||||
case nsIAccessibleProvider::XFormsOutput:
|
||||
accessible = new nsXFormsOutputAccessible(aNode, aWeakShell);
|
||||
break;
|
||||
case nsIAccessibleProvider::XFormsTrigger:
|
||||
|
||||
@@ -2042,7 +2042,7 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
||||
nsAccEvent::eCoalesceFromSameSubtree,
|
||||
isAsynch);
|
||||
|
||||
// Check to see change occured in an ARIA menu, and fire
|
||||
// Check to see change occurred in an ARIA menu, and fire
|
||||
// an EVENT_MENUPOPUP_START if it did.
|
||||
nsRoleMapEntry *roleMapEntry = nsAccUtils::GetRoleMapEntry(childNode);
|
||||
if (roleMapEntry && roleMapEntry->role == nsIAccessibleRole::ROLE_MENUPOPUP) {
|
||||
@@ -2051,7 +2051,7 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
||||
isAsynch);
|
||||
}
|
||||
|
||||
// Check to see if change occured inside an alert, and fire an EVENT_ALERT if it did
|
||||
// Check to see if change occurred inside an alert, and fire an EVENT_ALERT if it did
|
||||
nsIContent *ancestor = aChild;
|
||||
while (PR_TRUE) {
|
||||
if (roleMapEntry && roleMapEntry->role == nsIAccessibleRole::ROLE_ALERT) {
|
||||
|
||||
@@ -1007,7 +1007,7 @@ nsresult nsHyperTextAccessible::GetTextHelper(EGetTextType aType, nsAccessibleTe
|
||||
}
|
||||
else {
|
||||
// Start moving forward from the start so that we don't get
|
||||
// 2 words/lines if the offset occured on whitespace boundary
|
||||
// 2 words/lines if the offset occurred on whitespace boundary
|
||||
// Careful, startOffset and endOffset are passed by reference to GetPosAndText() and changed
|
||||
// For BOUNDARY_LINE_END, make sure we start of this line
|
||||
startOffset = endOffset = finalStartOffset + (aBoundaryType == BOUNDARY_LINE_END);
|
||||
|
||||
@@ -1738,7 +1738,7 @@ PRInt32 nsAccessibleWrap::GetChildIDFor(nsIAccessible* aAccessible)
|
||||
{
|
||||
// A child ID of the window is required, when we use NotifyWinEvent,
|
||||
// so that the 3rd party application can call back and get the IAccessible
|
||||
// the event occured on.
|
||||
// the event occurred on.
|
||||
|
||||
void *uniqueID = nsnull;
|
||||
nsCOMPtr<nsIAccessNode> accessNode(do_QueryInterface(aAccessible));
|
||||
|
||||
@@ -834,6 +834,20 @@ nsXULToolbarAccessible::GetRoleInternal(PRUint32 *aRole)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULToolbarAccessible::GetNameInternal(nsAString& aName)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = nsCoreUtils::GetRoleContent(mDOMNode);
|
||||
nsAutoString name;
|
||||
if (content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::toolbarname,
|
||||
name)) {
|
||||
name.CompressWhitespace();
|
||||
aName = name;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* XUL Toolbar Separator
|
||||
*/
|
||||
|
||||
@@ -202,6 +202,7 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
};
|
||||
|
||||
class nsXULToolbarSeparatorAccessible : public nsLeafAccessible
|
||||
|
||||
@@ -58,6 +58,7 @@ const ROLE_TABLE = nsIAccessibleRole.ROLE_TABLE;
|
||||
const ROLE_TEXT_CONTAINER = nsIAccessibleRole.ROLE_TEXT_CONTAINER;
|
||||
const ROLE_TEXT_LEAF = nsIAccessibleRole.ROLE_TEXT_LEAF;
|
||||
const ROLE_TOGGLE_BUTTON = nsIAccessibleRole.ROLE_TOGGLE_BUTTON;
|
||||
const ROLE_TOOLBAR = nsIAccessibleRole.ROLE_TOOLBAR;
|
||||
const ROLE_TOOLTIP = nsIAccessibleRole.ROLE_TOOLTIP;
|
||||
const ROLE_TREE_TABLE = nsIAccessibleRole.ROLE_TREE_TABLE;
|
||||
const ROLE_WHITESPACE = nsIAccessibleRole.ROLE_WHITESPACE;
|
||||
|
||||
@@ -128,10 +128,10 @@
|
||||
<label for="input_labelled">label</label>
|
||||
<input type="button" id="input_labelled" value="1" title="title"/>
|
||||
|
||||
<!-- name from @value, prefered to @title -->
|
||||
<!-- name from @value, preferred to @title -->
|
||||
<input type="button" id="input_value0" title="title" value="1"/>
|
||||
|
||||
<!-- name from @value, prefered to @alt -->
|
||||
<!-- name from @value, preferred to @alt -->
|
||||
<input type="button" id="input_value" value="1" alt="alt"/>
|
||||
|
||||
<!-- name from @alt, preferred to @src -->
|
||||
|
||||
@@ -48,6 +48,36 @@
|
||||
|
||||
testAccessibleTree("radiogroup", accTree);
|
||||
|
||||
// toolbar
|
||||
accTree = {
|
||||
role: ROLE_TOOLBAR,
|
||||
name: "My toolbar",
|
||||
children: [
|
||||
{
|
||||
role: ROLE_PUSHBUTTON,
|
||||
name: "hello",
|
||||
children: [ ]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
testAccessibleTree("toolbar", accTree);
|
||||
|
||||
// toolbar
|
||||
accTree = {
|
||||
role: ROLE_TOOLBAR,
|
||||
name: "My second toolbar",
|
||||
children: [
|
||||
{
|
||||
role: ROLE_PUSHBUTTON,
|
||||
name: "hello",
|
||||
children: [ ]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
testAccessibleTree("toolbar2", accTree);
|
||||
|
||||
SimpleTest.finish()
|
||||
}
|
||||
|
||||
@@ -76,6 +106,12 @@
|
||||
<radio label="radio1"/>
|
||||
<radio label="radio2"/>
|
||||
</radiogroup>
|
||||
<toolbar id="toolbar" toolbarname="My toolbar">
|
||||
<toolbarbutton id="button1" label="hello"/>
|
||||
</toolbar>
|
||||
<toolbar id="toolbar2" toolbarname="2nd" aria-label="My second toolbar">
|
||||
<toolbarbutton id="button2" label="hello"/>
|
||||
</toolbar>
|
||||
</vbox>
|
||||
</hbox>
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ehsan Akhgari <ehsan.akhgari@gmail.com>
|
||||
# Rob Campbell <rcampbell@mozilla.com>
|
||||
#
|
||||
# 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
|
||||
@@ -598,6 +599,12 @@
|
||||
accesskey="&addons.accesskey;"
|
||||
command="Tools:Addons"/>
|
||||
<menuseparator id="devToolsSeparator"/>
|
||||
<menuitem id="menu_pageinspect"
|
||||
type="checkbox"
|
||||
label="&inspectMenu.label;"
|
||||
accesskey="&inspectMenu.accesskey;"
|
||||
key="&inspectMenu.commandkey;"
|
||||
command="Tools:Inspect"/>
|
||||
<menuitem id="javascriptConsole"
|
||||
label="&errorConsoleCmd.label;"
|
||||
accesskey="&errorConsoleCmd.accesskey;"
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
# Blake Ross <blakeross@telocity.com>
|
||||
# Shawn Wilsher <me@shawnwilsher.com>
|
||||
# Ehsan Akhgari <ehsan.akhgari@gmail.com>
|
||||
# Rob Campbell <rcampbell@mozilla.com>
|
||||
#
|
||||
# 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
|
||||
@@ -124,6 +125,7 @@
|
||||
|
||||
<command id="Tools:Search" oncommand="BrowserSearch.webSearch();"/>
|
||||
<command id="Tools:Downloads" oncommand="BrowserDownloadsUI();"/>
|
||||
<command id="Tools:Inspect" oncommand="InspectorUI.toggleInspectorUI();"/>
|
||||
<command id="Tools:Addons" oncommand="BrowserOpenAddonsMgr();"/>
|
||||
<command id="Tools:Sanitize"
|
||||
oncommand="Cc['@mozilla.org/browser/browserglue;1'].getService(Ci.nsIBrowserGlue).sanitize(window);"/>
|
||||
@@ -205,8 +207,6 @@
|
||||
# system setting to use emacs emulation, and we should respect it. Focus-Search-Box
|
||||
# is a fundamental keybinding and we are maintaining a XP binding so that it is easy
|
||||
# for people to switch to Linux.
|
||||
#
|
||||
# Do *not* tamper with these values without talking to ben@mozilla.org
|
||||
#
|
||||
<key id="key_search" key="&searchFocus.commandkey;" command="Tools:Search" modifiers="accel"/>
|
||||
#ifdef XP_MACOSX
|
||||
@@ -222,6 +222,7 @@
|
||||
<key id="key_openDownloads" key="&downloads.commandkey;" command="Tools:Downloads" modifiers="accel"/>
|
||||
#endif
|
||||
<key id="key_errorConsole" key="&errorConsoleCmd.commandkey;" oncommand="toJavaScriptConsole();" modifiers="accel,shift"/>
|
||||
<key id="key_inspect" key="&inspectMenu.commandkey;" command="Tools:Inspect" modifiers="accel,shift"/>
|
||||
<key id="openFileKb" key="&openFileCmd.commandkey;" command="Browser:OpenFile" modifiers="accel"/>
|
||||
<key id="key_savePage" key="&savePageCmd.commandkey;" command="Browser:SavePage" modifiers="accel"/>
|
||||
<key id="printKb" key="&printCmd.commandkey;" command="cmd_print" modifiers="accel"/>
|
||||
|
||||
@@ -256,3 +256,10 @@ window[chromehidden~="toolbar"] toolbar:not(.toolbar-primary):not(.chromeclass-m
|
||||
-moz-binding: url("chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton-image");
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Inspector / Highlighter */
|
||||
|
||||
#highlighter-panel {
|
||||
-moz-appearance: none;
|
||||
-moz-window-shadow: none;
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
# Dietrich Ayala <dietrich@mozilla.com>
|
||||
# Gavin Sharp <gavin@gavinsharp.com>
|
||||
# Justin Dolske <dolske@mozilla.com>
|
||||
# Rob Campbell <rcampbell@mozilla.com>
|
||||
#
|
||||
# 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
|
||||
@@ -128,6 +129,7 @@ let gInitialPages = [
|
||||
];
|
||||
|
||||
#include browser-fullZoom.js
|
||||
#include inspector.js
|
||||
#include browser-places.js
|
||||
#include browser-tabPreviews.js
|
||||
|
||||
@@ -5779,7 +5781,8 @@ function AddKeywordForSearchField() {
|
||||
|
||||
type = el.type.toLowerCase();
|
||||
|
||||
if ((type == "text" || type == "hidden" || type == "textarea") ||
|
||||
if (((el instanceof HTMLInputElement && el.mozIsTextField(true)) ||
|
||||
type == "hidden" || type == "textarea") ||
|
||||
((type == "checkbox" || type == "radio") && el.checked)) {
|
||||
formData.push(escapeNameValuePair(el.name, el.value, isURLEncoded));
|
||||
} else if (el instanceof HTMLSelectElement && el.selectedIndex >= 0) {
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
# Dão Gottwald <dao@mozilla.com>
|
||||
# Ehsan Akhgari <ehsan.akhgari@gmail.com>
|
||||
# Robert Strong <robert.bugzilla@gmail.com>
|
||||
# Rob Campbell <rcampbell@mozilla.com>
|
||||
#
|
||||
# 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
|
||||
@@ -218,6 +219,35 @@
|
||||
</hbox>
|
||||
</panel>
|
||||
|
||||
<panel id="highlighter-panel"
|
||||
hidden="true"
|
||||
ignorekeys="true"
|
||||
noautofocus="true"
|
||||
noautohide="true"
|
||||
onclick="InspectorUI.stopInspecting();"
|
||||
onmousemove="InspectorUI.highlighter.handleMouseMove(event);"/>
|
||||
|
||||
<panel id="inspector-panel"
|
||||
orient="vertical"
|
||||
hidden="true"
|
||||
ignorekeys="true"
|
||||
noautofocus="true"
|
||||
noautohide="true"
|
||||
level="top"
|
||||
aria-labelledby="inspectPagePanelTitle">
|
||||
<tree id="inspector-tree" class="plain" seltype="single" treelines="true"
|
||||
onselect="InspectorUI.onTreeSelected()" flex="1">
|
||||
<treecols>
|
||||
<treecol id="colNodeName" label="nodeName" primary="true"
|
||||
persist="width,hidden,ordinal" flex="1"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol id="colNodeValue" label="nodeValue"
|
||||
persist="width,hidden,ordinal" flex="1"/>
|
||||
</treecols>
|
||||
<treechildren id="inspector-tree-body"/>
|
||||
</tree>
|
||||
</panel>
|
||||
|
||||
<popup id="toolbar-context-menu"
|
||||
onpopupshowing="onViewToolbarsPopupShowing(event);">
|
||||
<menuseparator/>
|
||||
@@ -592,6 +622,7 @@
|
||||
customizable="true"
|
||||
mode="icons" lockmode="true"
|
||||
iconsize="small" defaulticonsize="small" lockiconsize="true"
|
||||
aria-label="&tabsToolbar.label;"
|
||||
context="toolbar-context-menu"
|
||||
defaultset="tabbrowser-tabs,new-tab-button,alltabs-button,tabs-closebutton"
|
||||
collapsed="true">
|
||||
@@ -690,11 +721,13 @@
|
||||
label="&pasteCmd.label;"
|
||||
command="cmd_paste"
|
||||
tooltiptext="&pasteButton.tooltip;"/>
|
||||
|
||||
<toolbarbutton id="fullscreen-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
|
||||
observes="View:FullScreen"
|
||||
type="checkbox"
|
||||
label="&fullScreenCmd.label;"
|
||||
tooltiptext="&fullScreenButton.tooltip;"/>
|
||||
|
||||
</toolbarpalette>
|
||||
</toolbox>
|
||||
|
||||
|
||||
758
browser/base/content/inspector.js
Normal file
758
browser/base/content/inspector.js
Normal file
@@ -0,0 +1,758 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
#ifdef 0
|
||||
/* ***** 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 Inspector Module.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Rob Campbell <rcampbell@mozilla.com> (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 ***** */
|
||||
#endif
|
||||
|
||||
const INSPECTOR_INVISIBLE_ELEMENTS = {
|
||||
"head": true,
|
||||
"base": true,
|
||||
"basefont": true,
|
||||
"isindex": true,
|
||||
"link": true,
|
||||
"meta": true,
|
||||
"script": true,
|
||||
"style": true,
|
||||
"title": true,
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//// PanelHighlighter
|
||||
|
||||
/**
|
||||
* A highlighter mechanism using xul panels.
|
||||
*
|
||||
* @param aBrowser
|
||||
* The XUL browser object for the content window being highlighted.
|
||||
* @param aColor
|
||||
* A string containing an RGB color for the panel background.
|
||||
* @param aBorderSize
|
||||
* A number representing the border thickness of the panel.
|
||||
* @param anOpacity
|
||||
* A number representing the alpha value of the panel background.
|
||||
*/
|
||||
function PanelHighlighter(aBrowser, aColor, aBorderSize, anOpacity)
|
||||
{
|
||||
this.panel = document.getElementById("highlighter-panel");
|
||||
this.panel.hidden = false;
|
||||
this.browser = aBrowser;
|
||||
this.win = this.browser.contentWindow;
|
||||
this.backgroundColor = aColor;
|
||||
this.border = aBorderSize;
|
||||
this.opacity = anOpacity;
|
||||
this.updatePanelStyles();
|
||||
}
|
||||
|
||||
PanelHighlighter.prototype = {
|
||||
|
||||
/**
|
||||
* Update the panel's style object with current settings.
|
||||
* TODO see bugXXXXXX, https://wiki.mozilla.org/Firefox/Projects/Inspector#0.7
|
||||
* and, https://wiki.mozilla.org/Firefox/Projects/Inspector#1.0.
|
||||
*/
|
||||
updatePanelStyles: function PanelHighlighter_updatePanelStyles()
|
||||
{
|
||||
let style = this.panel.style;
|
||||
style.backgroundColor = this.backgroundColor;
|
||||
style.border = "solid blue " + this.border + "px";
|
||||
style.MozBorderRadius = "4px";
|
||||
style.opacity = this.opacity;
|
||||
},
|
||||
|
||||
/**
|
||||
* Highlight this.node, unhilighting first if necessary.
|
||||
*
|
||||
* @param scroll
|
||||
* Boolean determining whether to scroll or not.
|
||||
*/
|
||||
highlight: function PanelHighlighter_highlight(scroll)
|
||||
{
|
||||
// node is not set or node is not highlightable, bail
|
||||
if (!this.isNodeHighlightable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.unhighlight();
|
||||
|
||||
let rect = this.node.getBoundingClientRect();
|
||||
|
||||
if (scroll) {
|
||||
this.node.scrollIntoView();
|
||||
}
|
||||
|
||||
if (this.viewContainsRect(rect)) {
|
||||
// TODO check for offscreen boundaries, bug565301
|
||||
this.panel.openPopup(this.node, "overlap", 0, 0, false, false);
|
||||
this.panel.sizeTo(rect.width, rect.height);
|
||||
} else {
|
||||
this.highlightVisibleRegion(rect);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Highlight the given node.
|
||||
*
|
||||
* @param element
|
||||
* a DOM element to be highlighted
|
||||
* @param params
|
||||
* extra parameters object
|
||||
*/
|
||||
highlightNode: function PanelHighlighter_highlightNode(element, params)
|
||||
{
|
||||
this.node = element;
|
||||
this.highlight(params && params.scroll);
|
||||
},
|
||||
|
||||
/**
|
||||
* Highlight the visible region of the region described by aRect, if any.
|
||||
*
|
||||
* @param aRect
|
||||
* @returns boolean
|
||||
* was a region highlighted?
|
||||
*/
|
||||
highlightVisibleRegion: function PanelHighlighter_highlightVisibleRegion(aRect)
|
||||
{
|
||||
let offsetX = 0;
|
||||
let offsetY = 0;
|
||||
let width = 0;
|
||||
let height = 0;
|
||||
let visibleWidth = this.win.innerWidth;
|
||||
let visibleHeight = this.win.innerHeight;
|
||||
|
||||
// If any of these edges are out-of-bounds, the node's rectangle is
|
||||
// completely out-of-view and we can return.
|
||||
if (aRect.top > visibleHeight || aRect.left > visibleWidth ||
|
||||
aRect.bottom < 0 || aRect.right < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Calculate node offsets, if values are negative, then start the offsets
|
||||
// at their absolute values from node origin. The delta should be the edge
|
||||
// of view.
|
||||
offsetX = aRect.left < 0 ? Math.abs(aRect.left) : 0;
|
||||
offsetY = aRect.top < 0 ? Math.abs(aRect.top) : 0;
|
||||
|
||||
// Calculate actual node width, taking into account the available visible
|
||||
// width and then subtracting the offset for the final dimension.
|
||||
width = aRect.right > visibleWidth ? visibleWidth - aRect.left :
|
||||
aRect.width;
|
||||
width -= offsetX;
|
||||
|
||||
// Calculate actual node height using the same formula as above for width.
|
||||
height = aRect.bottom > visibleHeight ? visibleHeight - aRect.top :
|
||||
aRect.height;
|
||||
height -= offsetY;
|
||||
|
||||
// If width and height are non-negative, open the highlighter popup over the
|
||||
// node and sizeTo width and height.
|
||||
if (width > 0 && height > 0) {
|
||||
this.panel.openPopup(this.node, "overlap", offsetX, offsetY, false,
|
||||
false);
|
||||
this.panel.sizeTo(width, height);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Close the highlighter panel.
|
||||
*/
|
||||
unhighlight: function PanelHighlighter_unhighlight()
|
||||
{
|
||||
if (this.isHighlighting) {
|
||||
this.panel.hidePopup();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Is the highlighter panel open?
|
||||
*
|
||||
* @returns boolean
|
||||
*/
|
||||
get isHighlighting()
|
||||
{
|
||||
return this.panel.state == "open";
|
||||
},
|
||||
|
||||
/**
|
||||
* Return the midpoint of a line from pointA to pointB.
|
||||
*
|
||||
* @param pointA
|
||||
* An object with x and y properties.
|
||||
* @param pointB
|
||||
* An object with x and y properties.
|
||||
* @returns aPoint
|
||||
* An object with x and y properties.
|
||||
*/
|
||||
midPoint: function PanelHighlighter_midPoint(pointA, pointB)
|
||||
{
|
||||
let pointC = { };
|
||||
pointC.x = (pointB.x - pointA.x) / 2 + pointA.x;
|
||||
pointC.y = (pointB.y - pointA.y) / 2 + pointA.y;
|
||||
return pointC;
|
||||
},
|
||||
|
||||
/**
|
||||
* Return the node under the highlighter rectangle. Useful for testing.
|
||||
* Calculation based on midpoint of diagonal from top left to bottom right
|
||||
* of panel.
|
||||
*
|
||||
* @returns a DOM node or null if none
|
||||
*/
|
||||
get highlitNode()
|
||||
{
|
||||
// No highlighter panel? Bail.
|
||||
if (!this.isHighlighting) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let browserRect = this.browser.getBoundingClientRect();
|
||||
let clientRect = this.panel.getBoundingClientRect();
|
||||
|
||||
// Calculate top left point offset minus browser chrome.
|
||||
let a = {
|
||||
x: clientRect.left - browserRect.left,
|
||||
y: clientRect.top - browserRect.top
|
||||
};
|
||||
|
||||
// Calculate bottom right point minus browser chrome.
|
||||
let b = {
|
||||
x: clientRect.right - browserRect.left,
|
||||
y: clientRect.bottom - browserRect.top
|
||||
};
|
||||
|
||||
// Get midpoint of diagonal line.
|
||||
let midpoint = this.midPoint(a, b);
|
||||
|
||||
return this.win.document.elementFromPoint(midpoint.x, midpoint.y);
|
||||
},
|
||||
|
||||
/**
|
||||
* Is this.node highlightable?
|
||||
*
|
||||
* @returns boolean
|
||||
*/
|
||||
isNodeHighlightable: function PanelHighlighter_isNodeHighlightable()
|
||||
{
|
||||
if (!this.node) {
|
||||
return false;
|
||||
}
|
||||
let nodeName = this.node.nodeName.toLowerCase();
|
||||
if (nodeName[0] == '#') {
|
||||
return false;
|
||||
}
|
||||
return !INSPECTOR_INVISIBLE_ELEMENTS[nodeName];
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if the given viewport-relative rect is within the visible area
|
||||
* of the window.
|
||||
*
|
||||
* @param aRect
|
||||
* a CSS rectangle object
|
||||
* @returns boolean
|
||||
*/
|
||||
viewContainsRect: function PanelHighlighter_viewContainsRect(aRect)
|
||||
{
|
||||
let visibleWidth = this.win.innerWidth;
|
||||
let visibleHeight = this.win.innerHeight;
|
||||
|
||||
return ((0 <= aRect.left) && (aRect.right <= visibleWidth) &&
|
||||
(0 <= aRect.top) && (aRect.bottom <= visibleHeight))
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//// Event Handling
|
||||
|
||||
/**
|
||||
* Handle mousemoves in panel when InspectorUI.inspecting is true.
|
||||
*
|
||||
* @param event
|
||||
* The MouseEvent triggering the method.
|
||||
*/
|
||||
handleMouseMove: function PanelHighlighter_handleMouseMove(event)
|
||||
{
|
||||
if (!InspectorUI.inspecting) {
|
||||
return;
|
||||
}
|
||||
let browserRect = this.browser.getBoundingClientRect();
|
||||
let element = this.win.document.elementFromPoint(event.clientX -
|
||||
browserRect.left, event.clientY - browserRect.top);
|
||||
if (element && element != this.node) {
|
||||
InspectorUI.inspectNode(element);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//// InspectorTreeView
|
||||
|
||||
/**
|
||||
* TreeView object to manage the view of the DOM tree. Wraps and provides an
|
||||
* interface to an inIDOMView object
|
||||
*
|
||||
* @param aWindow
|
||||
* a top-level window object
|
||||
*/
|
||||
function InspectorTreeView(aWindow)
|
||||
{
|
||||
this.tree = document.getElementById("inspector-tree");
|
||||
this.treeBody = document.getElementById("inspector-tree-body");
|
||||
this.view = Cc["@mozilla.org/inspector/dom-view;1"]
|
||||
.createInstance(Ci.inIDOMView);
|
||||
this.view.showSubDocuments = true;
|
||||
this.view.whatToShow = NodeFilter.SHOW_ALL;
|
||||
this.tree.view = this.view;
|
||||
this.contentWindow = aWindow;
|
||||
this.view.rootNode = aWindow.document;
|
||||
this.view.rebuild();
|
||||
}
|
||||
|
||||
InspectorTreeView.prototype = {
|
||||
get editable() { return false; },
|
||||
get selection() { return this.view.selection; },
|
||||
|
||||
/**
|
||||
* Destroy the view.
|
||||
*/
|
||||
destroy: function ITV_destroy()
|
||||
{
|
||||
this.tree.view = null;
|
||||
this.view = null;
|
||||
this.tree = null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the cell text at a given row and column.
|
||||
*
|
||||
* @param aRow
|
||||
* The row index of the desired cell.
|
||||
* @param aCol
|
||||
* The column index of the desired cell.
|
||||
* @returns string
|
||||
*/
|
||||
getCellText: function ITV_getCellText(aRow, aCol)
|
||||
{
|
||||
return this.view.getCellText(aRow, aCol);
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the index of the selected row.
|
||||
*
|
||||
* @returns number
|
||||
*/
|
||||
get selectionIndex()
|
||||
{
|
||||
return this.selection.currentIndex;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the corresponding node for the currently-selected row in the tree.
|
||||
*
|
||||
* @returns DOMNode
|
||||
*/
|
||||
get selectedNode()
|
||||
{
|
||||
let rowIndex = this.selectionIndex;
|
||||
return this.view.getNodeFromRowIndex(rowIndex);
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the selected row in the table to the specified index.
|
||||
*
|
||||
* @param anIndex
|
||||
* The index to set the selection to.
|
||||
*/
|
||||
set selectedRow(anIndex)
|
||||
{
|
||||
this.view.selection.select(anIndex);
|
||||
this.tree.treeBoxObject.ensureRowIsVisible(anIndex);
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the selected node to the specified document node.
|
||||
*
|
||||
* @param aNode
|
||||
* The document node to select in the tree.
|
||||
*/
|
||||
set selectedNode(aNode)
|
||||
{
|
||||
let rowIndex = this.view.getRowIndexFromNode(aNode);
|
||||
if (rowIndex > -1) {
|
||||
this.selectedRow = rowIndex;
|
||||
} else {
|
||||
this.selectElementInTree(aNode);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Select the given node in the tree, searching for and expanding rows
|
||||
* as-needed.
|
||||
*
|
||||
* @param aNode
|
||||
* The document node to select in the three.
|
||||
* @returns boolean
|
||||
* Whether a node was selected or not if not found.
|
||||
*/
|
||||
selectElementInTree: function ITV_selectElementInTree(aNode)
|
||||
{
|
||||
if (!aNode) {
|
||||
this.view.selection.select(null);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Keep searching until a pre-created ancestor is found, then
|
||||
// open each ancestor until the found element is created.
|
||||
let domUtils = Cc["@mozilla.org/inspector/dom-utils;1"].
|
||||
getService(Ci.inIDOMUtils);
|
||||
let line = [];
|
||||
let parent = aNode;
|
||||
let index = null;
|
||||
|
||||
while (parent) {
|
||||
index = this.view.getRowIndexFromNode(parent);
|
||||
line.push(parent);
|
||||
if (index < 0) {
|
||||
// Row for this node hasn't been created yet.
|
||||
parent = domUtils.getParentForNode(parent,
|
||||
this.view.showAnonymousContent);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// We have all the ancestors, now open them one-by-one from the top
|
||||
// to bottom.
|
||||
let lastIndex;
|
||||
let view = this.tree.treeBoxObject.view;
|
||||
|
||||
for (let i = line.length - 1; i >= 0; i--) {
|
||||
index = this.view.getRowIndexFromNode(line[i]);
|
||||
if (index < 0) {
|
||||
// Can't find the row, so stop trying to descend.
|
||||
break;
|
||||
}
|
||||
if (i > 0 && !view.isContainerOpen(index)) {
|
||||
view.toggleOpenState(index);
|
||||
}
|
||||
lastIndex = index;
|
||||
}
|
||||
|
||||
if (lastIndex >= 0) {
|
||||
this.selectedRow = lastIndex;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//// InspectorUI
|
||||
|
||||
/**
|
||||
* Main controller class for the Inspector.
|
||||
*/
|
||||
var InspectorUI = {
|
||||
browser: null,
|
||||
_showTreePanel: true,
|
||||
_showStylePanel: false,
|
||||
_showDOMPanel: false,
|
||||
highlightColor: "#EEEE66",
|
||||
highlightThickness: 4,
|
||||
highlightOpacity: 0.4,
|
||||
selectEventsSuppressed: false,
|
||||
inspecting: false,
|
||||
|
||||
/**
|
||||
* Toggle the inspector interface elements on or off.
|
||||
*
|
||||
* @param event
|
||||
* The event that requested the UI change. Toolbar button or menu.
|
||||
*/
|
||||
toggleInspectorUI: function InspectorUI_toggleInspectorUI()
|
||||
{
|
||||
let toolsInspectCmd = document.getElementById("Tools:Inspect");
|
||||
if (this.isPanelOpen) {
|
||||
this.closeInspectorUI();
|
||||
toolsInspectCmd.setAttribute("checked", "false");
|
||||
} else {
|
||||
this.openInspectorUI();
|
||||
toolsInspectCmd.setAttribute("checked", "true");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Is the tree panel open?
|
||||
*
|
||||
* @returns boolean
|
||||
*/
|
||||
get isPanelOpen()
|
||||
{
|
||||
return this.treePanel && this.treePanel.state == "open";
|
||||
},
|
||||
|
||||
/**
|
||||
* Open the inspector's tree panel and initialize it.
|
||||
*/
|
||||
openTreePanel: function InspectorUI_openTreePanel()
|
||||
{
|
||||
if (!this.treePanel) {
|
||||
this.treePanel = document.getElementById("inspector-panel");
|
||||
this.treePanel.hidden = false;
|
||||
}
|
||||
if (!this.isPanelOpen) {
|
||||
const panelWidthRatio = 7 / 8;
|
||||
const panelHeightRatio = 1 / 5;
|
||||
let bar = document.getElementById("status-bar");
|
||||
this.treePanel.openPopup(bar, "overlap", 120, -120, false, false);
|
||||
this.treePanel.sizeTo(this.win.outerWidth * panelWidthRatio,
|
||||
this.win.outerHeight * panelHeightRatio);
|
||||
this.tree = document.getElementById("inspector-tree");
|
||||
this.createDocumentModel();
|
||||
}
|
||||
},
|
||||
|
||||
openStylePanel: function InspectorUI_openStylePanel()
|
||||
{
|
||||
// # todo
|
||||
},
|
||||
|
||||
openDOMPanel: function InspectorUI_openDOMPanel()
|
||||
{
|
||||
// # todo
|
||||
},
|
||||
|
||||
/**
|
||||
* Open inspector UI. tree, style and DOM panels if enabled. Add listeners for
|
||||
* document scrolling and tabContainer.TabSelect.
|
||||
*/
|
||||
openInspectorUI: function InspectorUI_openInspectorUI()
|
||||
{
|
||||
// initialization
|
||||
this.browser = gBrowser.selectedBrowser;
|
||||
this.win = this.browser.contentWindow;
|
||||
|
||||
// open inspector UI
|
||||
if (this._showTreePanel) {
|
||||
this.openTreePanel();
|
||||
}
|
||||
if (this._showStylePanel) {
|
||||
this.openStylePanel();
|
||||
}
|
||||
if (this._showDOMPanel) {
|
||||
this.openDOMPanel();
|
||||
}
|
||||
this.initializeHighlighter();
|
||||
this.startInspecting();
|
||||
this.win.document.addEventListener("scroll", this, false);
|
||||
gBrowser.tabContainer.addEventListener("TabSelect", this, false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Initialize highlighter.
|
||||
*/
|
||||
initializeHighlighter: function InspectorUI_initializeHighlighter()
|
||||
{
|
||||
this.highlighter = new PanelHighlighter(this.browser, this.highlightColor,
|
||||
this.highlightThickness, this.highlightOpacity);
|
||||
},
|
||||
|
||||
/**
|
||||
* Close inspector UI and associated panels. Unhighlight and stop inspecting.
|
||||
* Remove event listeners for document scrolling and
|
||||
* tabContainer.TabSelect.
|
||||
*/
|
||||
closeInspectorUI: function InspectorUI_closeInspectorUI()
|
||||
{
|
||||
this.win.document.removeEventListener("scroll", this, false);
|
||||
gBrowser.tabContainer.removeEventListener("TabSelect", this, false);
|
||||
this.stopInspecting();
|
||||
if (this.highlighter && this.highlighter.isHighlighting) {
|
||||
this.highlighter.unhighlight();
|
||||
}
|
||||
if (this.isPanelOpen) {
|
||||
this.treePanel.hidePopup();
|
||||
this.treeView.destroy();
|
||||
}
|
||||
this.browser = this.win = null; // null out references to browser and window
|
||||
},
|
||||
|
||||
/**
|
||||
* Begin inspecting webpage, attach page event listeners, activate
|
||||
* highlighter event listeners.
|
||||
*/
|
||||
startInspecting: function InspectorUI_startInspecting()
|
||||
{
|
||||
this.attachPageListeners();
|
||||
this.inspecting = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Stop inspecting webpage, detach page listeners, disable highlighter
|
||||
* event listeners.
|
||||
*/
|
||||
stopInspecting: function InspectorUI_stopInspecting()
|
||||
{
|
||||
if (!this.inspecting)
|
||||
return;
|
||||
this.detachPageListeners();
|
||||
this.inspecting = false;
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//// Model Creation Methods
|
||||
|
||||
/**
|
||||
* Create treeView object from content window.
|
||||
*/
|
||||
createDocumentModel: function InspectorUI_createDocumentModel()
|
||||
{
|
||||
this.treeView = new InspectorTreeView(this.win);
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//// Event Handling
|
||||
|
||||
/**
|
||||
* Main callback handler for events.
|
||||
*
|
||||
* @param event
|
||||
* The event to be handled.
|
||||
*/
|
||||
handleEvent: function InspectorUI_handleEvent(event)
|
||||
{
|
||||
switch (event.type) {
|
||||
case "TabSelect":
|
||||
this.closeInspectorUI();
|
||||
break;
|
||||
case "keypress":
|
||||
switch (event.keyCode) {
|
||||
case KeyEvent.DOM_VK_RETURN:
|
||||
case KeyEvent.DOM_VK_ESCAPE:
|
||||
this.stopInspecting();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "mousemove":
|
||||
let element = this.win.document.elementFromPoint(event.clientX,
|
||||
event.clientY);
|
||||
if (element && element != this.node) {
|
||||
this.inspectNode(element);
|
||||
}
|
||||
break;
|
||||
case "click":
|
||||
this.stopInspecting();
|
||||
break;
|
||||
case "scroll":
|
||||
this.highlighter.highlight();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Event fired when a tree row is selected in the tree panel.
|
||||
*/
|
||||
onTreeSelected: function InspectorUI_onTreeSelected()
|
||||
{
|
||||
if (this.selectEventsSuppressed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let treeView = this.treeView;
|
||||
let node = treeView.selectedNode;
|
||||
this.highlighter.highlightNode(node); // # todo scrolling causes issues
|
||||
this.stopInspecting();
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Attach event listeners to content window and child windows to enable
|
||||
* highlighting and click to stop inspection.
|
||||
*/
|
||||
attachPageListeners: function InspectorUI_attachPageListeners()
|
||||
{
|
||||
this.win.addEventListener("keypress", this, true);
|
||||
this.browser.addEventListener("mousemove", this, true);
|
||||
this.browser.addEventListener("click", this, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Detach event listeners from content window and child windows
|
||||
* to disable highlighting.
|
||||
*/
|
||||
detachPageListeners: function InspectorUI_detachPageListeners()
|
||||
{
|
||||
this.win.removeEventListener("keypress", this, true);
|
||||
this.browser.removeEventListener("mousemove", this, true);
|
||||
this.browser.removeEventListener("click", this, true);
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//// Utility Methods
|
||||
|
||||
/**
|
||||
* inspect the given node, highlighting it on the page and selecting the
|
||||
* correct row in the tree panel
|
||||
*
|
||||
* @param element
|
||||
* the element in the document to inspect
|
||||
*/
|
||||
inspectNode: function InspectorUI_inspectNode(element)
|
||||
{
|
||||
this.highlighter.highlightNode(element);
|
||||
this.selectEventsSuppressed = true;
|
||||
this.treeView.selectedNode = element;
|
||||
this.selectEventsSuppressed = false;
|
||||
},
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//// Utility functions
|
||||
|
||||
/**
|
||||
* debug logging facility
|
||||
* @param msg
|
||||
* text message to send to the log
|
||||
*/
|
||||
_log: function LOG(msg)
|
||||
{
|
||||
Services.console.logStringMessage(msg);
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1331,8 +1331,7 @@ nsContextMenu.prototype = {
|
||||
// This is used to disable the context menu for form controls.
|
||||
isTargetAFormControl: function(aNode) {
|
||||
if (aNode instanceof HTMLInputElement)
|
||||
return (aNode.type != "text" && aNode.type != "password" &&
|
||||
aNode.type != "image");
|
||||
return (!aNode.mozIsTextField(false) && aNode.type != "image");
|
||||
|
||||
return (aNode instanceof HTMLButtonElement) ||
|
||||
(aNode instanceof HTMLSelectElement) ||
|
||||
@@ -1342,7 +1341,7 @@ nsContextMenu.prototype = {
|
||||
|
||||
isTargetATextBox: function(node) {
|
||||
if (node instanceof HTMLInputElement)
|
||||
return (node.type == "text" || node.type == "password")
|
||||
return node.mozIsTextField(false);
|
||||
|
||||
return (node instanceof HTMLTextAreaElement);
|
||||
},
|
||||
|
||||
@@ -2170,65 +2170,33 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if ('altKey' in aEvent && aEvent.altKey)
|
||||
if (aEvent.altKey)
|
||||
return;
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
if ('metaKey' in aEvent && aEvent.metaKey) {
|
||||
if (!aEvent.metaKey)
|
||||
return;
|
||||
|
||||
var offset = 1;
|
||||
switch (aEvent.charCode) {
|
||||
case '}'.charCodeAt(0):
|
||||
offset *= -1;
|
||||
offset = -1;
|
||||
case '{'.charCodeAt(0):
|
||||
if (window.getComputedStyle(this, null).direction == "ltr")
|
||||
offset *= -1;
|
||||
|
||||
this.tabContainer.advanceSelectedTab(offset, true);
|
||||
aEvent.stopPropagation();
|
||||
aEvent.preventDefault();
|
||||
return;
|
||||
}
|
||||
if ('shiftKey' in aEvent && aEvent.shiftKey)
|
||||
return;
|
||||
#else
|
||||
if (('ctrlKey' in aEvent && aEvent.ctrlKey) &&
|
||||
!('shiftKey' in aEvent && aEvent.shiftKey) &&
|
||||
!('metaKey' in aEvent && aEvent.metaKey)) {
|
||||
if (aEvent.keyCode == KeyEvent.DOM_VK_F4 &&
|
||||
if (aEvent.ctrlKey && !aEvent.shiftKey && !aEvent.metaKey &&
|
||||
aEvent.keyCode == KeyEvent.DOM_VK_F4 &&
|
||||
this.mTabBox.handleCtrlPageUpDown) {
|
||||
this.removeCurrentTab();
|
||||
|
||||
aEvent.stopPropagation();
|
||||
aEvent.preventDefault();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (aEvent.target.parentNode == this.tabContainer) {
|
||||
switch (aEvent.keyCode) {
|
||||
case KeyEvent.DOM_VK_UP:
|
||||
this.moveTabBackward();
|
||||
break;
|
||||
case KeyEvent.DOM_VK_DOWN:
|
||||
this.moveTabForward();
|
||||
break;
|
||||
case KeyEvent.DOM_VK_RIGHT:
|
||||
case KeyEvent.DOM_VK_LEFT:
|
||||
this.moveTabOver(aEvent);
|
||||
break;
|
||||
case KeyEvent.DOM_VK_HOME:
|
||||
this.moveTabToStart();
|
||||
break;
|
||||
case KeyEvent.DOM_VK_END:
|
||||
this.moveTabToEnd();
|
||||
break;
|
||||
default:
|
||||
// Stop the keypress event for the above keyboard
|
||||
// shortcuts only.
|
||||
return;
|
||||
}
|
||||
aEvent.stopPropagation();
|
||||
aEvent.preventDefault();
|
||||
}
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
@@ -2791,6 +2759,41 @@
|
||||
event.stopPropagation();
|
||||
]]></handler>
|
||||
|
||||
<handler event="keypress"><![CDATA[
|
||||
if (event.altKey || event.shiftKey ||
|
||||
#ifdef XP_MACOSX
|
||||
!event.metaKey)
|
||||
#else
|
||||
!event.ctrlKey || event.metaKey)
|
||||
#endif
|
||||
return;
|
||||
|
||||
switch (event.keyCode) {
|
||||
case KeyEvent.DOM_VK_UP:
|
||||
this.tabbrowser.moveTabBackward();
|
||||
break;
|
||||
case KeyEvent.DOM_VK_DOWN:
|
||||
this.tabbrowser.moveTabForward();
|
||||
break;
|
||||
case KeyEvent.DOM_VK_RIGHT:
|
||||
case KeyEvent.DOM_VK_LEFT:
|
||||
this.tabbrowser.moveTabOver(event);
|
||||
break;
|
||||
case KeyEvent.DOM_VK_HOME:
|
||||
this.tabbrowser.moveTabToStart();
|
||||
break;
|
||||
case KeyEvent.DOM_VK_END:
|
||||
this.tabbrowser.moveTabToEnd();
|
||||
break;
|
||||
default:
|
||||
// Stop the keypress event for the above keyboard
|
||||
// shortcuts only.
|
||||
return;
|
||||
}
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
]]></handler>
|
||||
|
||||
<handler event="dragstart"><![CDATA[
|
||||
var tab = this._getDragTargetTab(event);
|
||||
if (!tab)
|
||||
|
||||
@@ -125,6 +125,9 @@ _BROWSER_FILES = \
|
||||
browser_drag.js \
|
||||
browser_gestureSupport.js \
|
||||
browser_getshortcutoruri.js \
|
||||
browser_inspector_initialization.js \
|
||||
browser_inspector_treeSelection.js \
|
||||
browser_inspector_highlighter.js \
|
||||
browser_overflowScroll.js \
|
||||
browser_pageInfo.js \
|
||||
browser_page_style_menu.js \
|
||||
|
||||
123
browser/base/content/test/browser_inspector_highlighter.js
Normal file
123
browser/base/content/test/browser_inspector_highlighter.js
Normal file
@@ -0,0 +1,123 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* ***** 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 Inspector Highlighter Tests.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Rob Campbell <rcampbell@mozilla.com>
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
let doc;
|
||||
let h1;
|
||||
|
||||
function createDocument()
|
||||
{
|
||||
let div = doc.createElement("div");
|
||||
let h1 = doc.createElement("h1");
|
||||
let p1 = doc.createElement("p");
|
||||
let p2 = doc.createElement("p");
|
||||
let div2 = doc.createElement("div");
|
||||
let p3 = doc.createElement("p");
|
||||
doc.title = "Inspector Tree Selection Test";
|
||||
h1.textContent = "Inspector Tree Selection Test";
|
||||
p1.textContent = "This is some example text";
|
||||
p2.textContent = "Lorem ipsum dolor sit amet, consectetur adipisicing " +
|
||||
"elit, sed do eiusmod tempor incididunt ut labore et dolore magna " +
|
||||
"aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco " +
|
||||
"laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure " +
|
||||
"dolor in reprehenderit in voluptate velit esse cillum dolore eu " +
|
||||
"fugiat nulla pariatur. Excepteur sint occaecat cupidatat non " +
|
||||
"proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
|
||||
p3.textContent = "Lorem ipsum dolor sit amet, consectetur adipisicing " +
|
||||
"elit, sed do eiusmod tempor incididunt ut labore et dolore magna " +
|
||||
"aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco " +
|
||||
"laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure " +
|
||||
"dolor in reprehenderit in voluptate velit esse cillum dolore eu " +
|
||||
"fugiat nulla pariatur. Excepteur sint occaecat cupidatat non " +
|
||||
"proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
|
||||
div.appendChild(h1);
|
||||
div.appendChild(p1);
|
||||
div.appendChild(p2);
|
||||
div2.appendChild(p3);
|
||||
doc.body.appendChild(div);
|
||||
doc.body.appendChild(div2);
|
||||
setupHighlighterTests();
|
||||
}
|
||||
|
||||
function setupHighlighterTests()
|
||||
{
|
||||
h1 = doc.querySelectorAll("h1")[0];
|
||||
ok(h1, "we have the header node");
|
||||
document.addEventListener("popupshown", runSelectionTests, false);
|
||||
InspectorUI.toggleInspectorUI();
|
||||
}
|
||||
|
||||
function runSelectionTests(evt)
|
||||
{
|
||||
if (evt.target.id != "inspector-panel")
|
||||
return true;
|
||||
document.removeEventListener("popupshown", runSelectionTests, false);
|
||||
document.addEventListener("popupshown", performTestComparisons, false);
|
||||
EventUtils.synthesizeMouse(h1, 2, 2, {type: "mousemove"}, content);
|
||||
}
|
||||
|
||||
function performTestComparisons(evt)
|
||||
{
|
||||
if (evt.target.id != "highlighter-panel")
|
||||
return true;
|
||||
document.removeEventListener("popupshown", performTestComparisons, false);
|
||||
is(h1, InspectorUI.treeView.selectedNode, "selection matches node");
|
||||
ok(InspectorUI.highlighter.isHighlighting, "panel is highlighting");
|
||||
is(InspectorUI.highlighter.highlitNode, h1, "highlighter matches selection");
|
||||
executeSoon(finishUp);
|
||||
}
|
||||
|
||||
function finishUp() {
|
||||
InspectorUI.closeInspectorUI();
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
||||
|
||||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
doc = content.document;
|
||||
waitForFocus(createDocument, content);
|
||||
}, true);
|
||||
|
||||
content.location = "data:text/html,basic tests for inspector";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* ***** 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 Inspector Initializationa and Shutdown Tests.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Rob Campbell <rcampbell@mozilla.com>
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
let doc;
|
||||
|
||||
function startInspectorTests()
|
||||
{
|
||||
ok(InspectorUI, "InspectorUI variable exists");
|
||||
document.addEventListener("popupshown", runInspectorTests, false);
|
||||
InspectorUI.toggleInspectorUI();
|
||||
}
|
||||
|
||||
function runInspectorTests(evt)
|
||||
{
|
||||
if (evt.target.id != "inspector-panel")
|
||||
return true;
|
||||
document.removeEventListener("popupshown", runInspectorTests, false);
|
||||
document.addEventListener("popuphidden", finishInspectorTests, false);
|
||||
ok(InspectorUI.inspecting, "Inspector is highlighting");
|
||||
ok(InspectorUI.isPanelOpen, "Inspector Tree Panel is open");
|
||||
todo(InspectorUI.isStylePanelOpen, "Inspector Style Panel is open");
|
||||
todo(InspectorUI.isDOMPanelOpen, "Inspector DOM Panel is open");
|
||||
InspectorUI.toggleInspectorUI();
|
||||
}
|
||||
|
||||
function finishInspectorTests(evt)
|
||||
{
|
||||
if (evt.target.id != "inspector-panel")
|
||||
return true;
|
||||
document.removeEventListener("popuphidden", finishInspectorTests, false);
|
||||
ok(!InspectorUI.isDOMPanelOpen, "Inspector DOM Panel is closed");
|
||||
ok(!InspectorUI.isStylePanelOpen, "Inspector Style Panel is closed");
|
||||
ok(!InspectorUI.isPanelOpen, "Inspector Tree Panel is closed");
|
||||
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
||||
|
||||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
doc = content.document;
|
||||
waitForFocus(startInspectorTests, content);
|
||||
}, true);
|
||||
|
||||
content.location = "data:text/html,basic tests for inspector";
|
||||
}
|
||||
|
||||
114
browser/base/content/test/browser_inspector_treeSelection.js
Normal file
114
browser/base/content/test/browser_inspector_treeSelection.js
Normal file
@@ -0,0 +1,114 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* ***** 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 Inspector Tree Selection Tests.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Rob Campbell <rcampbell@mozilla.com>
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
let doc;
|
||||
let h1;
|
||||
|
||||
function createDocument()
|
||||
{
|
||||
let div = doc.createElement("div");
|
||||
let h1 = doc.createElement("h1");
|
||||
let p1 = doc.createElement("p");
|
||||
let p2 = doc.createElement("p");
|
||||
doc.title = "Inspector Tree Selection Test";
|
||||
h1.textContent = "Inspector Tree Selection Test";
|
||||
p1.textContent = "This is some example text";
|
||||
p2.textContent = "Lorem ipsum dolor sit amet, consectetur adipisicing " +
|
||||
"elit, sed do eiusmod tempor incididunt ut labore et dolore magna " +
|
||||
"aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco " +
|
||||
"laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure " +
|
||||
"dolor in reprehenderit in voluptate velit esse cillum dolore eu " +
|
||||
"fugiat nulla pariatur. Excepteur sint occaecat cupidatat non " +
|
||||
"proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
|
||||
div.appendChild(h1);
|
||||
div.appendChild(p1);
|
||||
div.appendChild(p2);
|
||||
// doc.body.addEventListener("DOMSubtreeModified", , false);
|
||||
doc.body.appendChild(div);
|
||||
setupSelectionTests();
|
||||
}
|
||||
|
||||
function setupSelectionTests()
|
||||
{
|
||||
h1 = doc.querySelectorAll("h1")[0];
|
||||
ok(h1, "we have the header node");
|
||||
document.addEventListener("popupshown", runSelectionTests, false);
|
||||
InspectorUI.openInspectorUI();
|
||||
}
|
||||
|
||||
function runSelectionTests(evt)
|
||||
{
|
||||
if (evt.target.id != "inspector-panel")
|
||||
return true;
|
||||
document.removeEventListener("popupshown", runSelectionTests, false);
|
||||
InspectorUI.stopInspecting();
|
||||
document.addEventListener("popupshown", performTestComparisons, false);
|
||||
InspectorUI.treeView.selectedNode = h1;
|
||||
}
|
||||
|
||||
function performTestComparisons(evt)
|
||||
{
|
||||
if (evt.target.id != "highlighter-panel")
|
||||
return true;
|
||||
document.removeEventListener("popupshown", performTestComparisons, false);
|
||||
is(h1, InspectorUI.treeView.selectedNode, "selection matches node");
|
||||
ok(InspectorUI.highlighter.isHighlighting, "panel is highlighting");
|
||||
is(h1, InspectorUI.highlighter.highlitNode, "highlighter highlighting correct node");
|
||||
finishUp();
|
||||
}
|
||||
|
||||
function finishUp() {
|
||||
InspectorUI.closeInspectorUI();
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
||||
|
||||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
doc = content.document;
|
||||
waitForFocus(createDocument, content);
|
||||
}, true);
|
||||
|
||||
content.location = "data:text/html,basic tests for inspector";
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ FeedConverter.prototype = {
|
||||
// to always use this stream converter, even when an auto-action is
|
||||
// specified, not the basic one provided by WebContentConverter. This
|
||||
// converter needs to consume all of the data and parse it, and based on
|
||||
// that determination make a judgement about type.
|
||||
// that determination make a judgment about type.
|
||||
//
|
||||
// Since there are no content types for this content, and I'm not going to
|
||||
// invent any, the upshot is that while a user can set an auto-handler for
|
||||
|
||||
@@ -152,7 +152,6 @@ gTests.push({
|
||||
});
|
||||
|
||||
function checkInfoBoxSelected(PO) {
|
||||
PO._places.focus();
|
||||
is(getAndCheckElmtById("detailsDeck").selectedIndex, 1,
|
||||
"Selected element in detailsDeck is infoBox.");
|
||||
}
|
||||
@@ -226,7 +225,10 @@ function windowObserver(aSubject, aTopic, aData) {
|
||||
gLibrary = aSubject.QueryInterface(Ci.nsIDOMWindow);
|
||||
gLibrary.addEventListener("load", function onLoad(event) {
|
||||
gLibrary.removeEventListener("load", onLoad, false);
|
||||
executeSoon(nextTest);
|
||||
executeSoon(function() {
|
||||
gLibrary.PlacesOrganizer._places.focus();
|
||||
waitForFocus(nextTest, gLibrary);
|
||||
});
|
||||
}, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,13 @@ function windowObserver(aSubject, aTopic, aData) {
|
||||
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");
|
||||
|
||||
if (!organizer.gEditItemOverlay._initialized){
|
||||
// The overlay is initialized on focus, we wait for it to be fully operational.
|
||||
setTimeout(arguments.callee, 10);
|
||||
return;
|
||||
}
|
||||
|
||||
isnot(organizer.gEditItemOverlay.itemId, -1, "Editing a bookmark");
|
||||
// Select History in the left pane.
|
||||
organizer.PlacesOrganizer.selectLeftPaneQuery('History');
|
||||
|
||||
@@ -160,9 +160,14 @@ function onListClick(aEvent) {
|
||||
var row = {}, col = {};
|
||||
treeView.treeBox.getCellAt(aEvent.clientX, aEvent.clientY, row, col, {});
|
||||
if (col.value) {
|
||||
// restore this specific tab in the same window for double clicking or middle clicking
|
||||
// or Ctrl+clicking on a tab's title - note: ctrl clicking doesn't work on Mac
|
||||
if ((aEvent.button == 1 || aEvent.button == 0 && aEvent.detail == 2 || aEvent.ctrlKey) &&
|
||||
// Restore this specific tab in the same window for middle/double/accel clicking
|
||||
// on a tab's title.
|
||||
#ifdef XP_MACOSX
|
||||
let accelKey = aEvent.metaKey;
|
||||
#else
|
||||
let accelKey = aEvent.ctrlKey;
|
||||
#endif
|
||||
if ((aEvent.button == 1 || aEvent.button == 0 && aEvent.detail == 2 || accelKey) &&
|
||||
col.value.id == "title" &&
|
||||
!treeView.isContainer(row.value))
|
||||
restoreSingleTab(row.value, aEvent.shiftKey);
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
<link rel="stylesheet" href="chrome://browser/skin/aboutSessionRestore.css" type="text/css" media="all"/>
|
||||
<link rel="icon" type="image/png" href="chrome://global/skin/icons/warning-16.png"/>
|
||||
|
||||
<script type="application/javascript" src="chrome://browser/content/aboutSessionRestore.js"/>
|
||||
<script type="application/javascript;version=1.8" src="chrome://browser/content/aboutSessionRestore.js"/>
|
||||
</head>
|
||||
|
||||
<body dir="&locale.dir;">
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
browser.jar:
|
||||
* content/browser/aboutSessionRestore.xhtml (content/aboutSessionRestore.xhtml)
|
||||
content/browser/aboutSessionRestore.js (content/aboutSessionRestore.js)
|
||||
* content/browser/aboutSessionRestore.js (content/aboutSessionRestore.js)
|
||||
|
||||
@@ -159,6 +159,10 @@
|
||||
<!ENTITY errorConsoleCmd.accesskey "C">
|
||||
<!ENTITY errorConsoleCmd.commandkey "j">
|
||||
|
||||
<!ENTITY inspectMenu.label "Inspect">
|
||||
<!ENTITY inspectMenu.accesskey "I">
|
||||
<!ENTITY inspectMenu.commandkey "I">
|
||||
|
||||
<!ENTITY fileMenu.label "File">
|
||||
<!ENTITY fileMenu.accesskey "F">
|
||||
<!ENTITY newNavigatorCmd.label "New Window">
|
||||
@@ -475,3 +479,6 @@ just addresses the organization to follow, e.g. "This site is run by " -->
|
||||
<!ENTITY downloadMonitor2.tooltip "Click to open downloads window">
|
||||
|
||||
<!ENTITY allTabs.filter.emptyText "Search Tabs">
|
||||
<!-- Name for the tabs toolbar as spoken by screen readers.
|
||||
The word "toolbar" is appended automatically and should not be contained below! -->
|
||||
<!ENTITY tabsToolbar.label "Browser tabs">
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
<!ENTITY edit.accesskey "E">
|
||||
<!ENTITY views.label "Views">
|
||||
<!ENTITY views.accesskey "V">
|
||||
<!ENTITY view.toolbar.label "Toolbar">
|
||||
<!ENTITY view.toolbar.accesskey "o">
|
||||
<!ENTITY view.columns.label "Show Columns">
|
||||
<!ENTITY view.columns.accesskey "C">
|
||||
<!ENTITY view.sort.label "Sort">
|
||||
@@ -43,28 +41,6 @@
|
||||
<!ENTITY cmd.restoreFromFile.label "Choose File…">
|
||||
<!ENTITY cmd.restoreFromFile.accesskey "C">
|
||||
|
||||
<!ENTITY cmd.select_all.label "Select All">
|
||||
<!ENTITY cmd.select_all.accesskey "A">
|
||||
<!ENTITY cmd.select_all.key "a">
|
||||
|
||||
<!ENTITY cmd.edit_cut.label "Cut">
|
||||
<!ENTITY cmd.edit_cut.accesskey "t">
|
||||
<!ENTITY cmd.edit_cut.key "x">
|
||||
<!ENTITY cmd.edit_copy.label "Copy">
|
||||
<!ENTITY cmd.edit_copy.accesskey "C">
|
||||
<!ENTITY cmd.edit_copy.key "c">
|
||||
<!ENTITY cmd.edit_paste.label "Paste">
|
||||
<!ENTITY cmd.edit_paste.accesskey "P">
|
||||
<!ENTITY cmd.edit_paste.key "v">
|
||||
<!ENTITY cmd.edit_delete.label "Delete">
|
||||
<!ENTITY cmd.edit_delete.accesskey "D">
|
||||
<!ENTITY cmd.edit_undo.label "Undo">
|
||||
<!ENTITY cmd.edit_undo.accesskey "U">
|
||||
<!ENTITY cmd.edit_undo.key "z">
|
||||
<!ENTITY cmd.edit_redo.label "Redo">
|
||||
<!ENTITY cmd.edit_redo.accesskey "R">
|
||||
<!ENTITY cmd.edit_redo.key "y">
|
||||
|
||||
<!ENTITY cmd.bookmarkLink.label "Bookmark This Page…">
|
||||
<!ENTITY cmd.bookmarkLink.accesskey "B">
|
||||
<!ENTITY cmd.delete.label "Delete This Page">
|
||||
@@ -84,17 +60,12 @@
|
||||
<!ENTITY cmd.properties.label "Properties">
|
||||
<!ENTITY cmd.properties.accesskey "i">
|
||||
|
||||
<!ENTITY cmd.rename.label "Rename">
|
||||
<!ENTITY cmd.rename.accesskey "R">
|
||||
|
||||
<!ENTITY cmd.sortby_name.label "Sort By Name">
|
||||
<!ENTITY cmd.sortby_name.accesskey "S">
|
||||
<!ENTITY cmd.context_sortby_name.accesskey "r">
|
||||
|
||||
<!ENTITY cmd.new_bookmark.label "New Bookmark…">
|
||||
<!ENTITY cmd.new_bookmark.accesskey "B">
|
||||
<!ENTITY cmd.new_livemark.label "New Live Bookmark…">
|
||||
<!ENTITY cmd.new_livemark.accesskey "L">
|
||||
<!ENTITY cmd.new_folder.label "New Folder…">
|
||||
<!ENTITY cmd.new_folder.accesskey "o">
|
||||
<!ENTITY cmd.context_new_folder.accesskey "F">
|
||||
@@ -134,9 +105,6 @@
|
||||
|
||||
<!ENTITY cmd.find.key "f">
|
||||
|
||||
<!ENTITY feed.subscribe.label "Feed">
|
||||
<!ENTITY feed.subscribe.tooltip "Subscribe">
|
||||
|
||||
<!ENTITY maintenance.label "Import and Backup">
|
||||
<!ENTITY maintenance.accesskey "I">
|
||||
|
||||
|
||||
@@ -1,25 +1,15 @@
|
||||
deleteHost=Delete all from %S
|
||||
deleteDomain=Delete entire domain %S
|
||||
deleteHostNoSelection=Delete host
|
||||
deleteDomainNoSelection=Delete domain
|
||||
|
||||
load-js-data-url-error=For security reasons, javascript or data urls cannot be loaded from the history window or sidebar.
|
||||
noTitle=(no title)
|
||||
|
||||
bookmarksMenuEmptyFolder=(Empty)
|
||||
|
||||
# LOCALIZATION NOTE (bookmarksBackupFilename) :
|
||||
# %S will be replaced by the current date in ISO 8601 format, YYYY-MM-DD.
|
||||
# The resulting string will be suggested as a filename, so make sure that you're
|
||||
# only using characters legal for file names. Consider falling back to the
|
||||
# en-US value if you have to use non-ascii characters.
|
||||
bookmarksBackupFilename=Bookmarks %S.html
|
||||
bookmarksBackupFilenameJSON=Bookmarks %S.json
|
||||
bookmarksBackupTitle=Bookmarks backup filename
|
||||
|
||||
bookmarksRestoreAlertTitle=Revert Bookmarks
|
||||
bookmarksRestoreAlert=This will replace all of your current bookmarks with the backup. Are you sure?
|
||||
bookmarksRestoreAlertTags=This will replace all of your current bookmarks and tags with the backup. Are you sure?
|
||||
bookmarksRestoreTitle=Select a bookmarks backup
|
||||
bookmarksRestoreFilterName=JSON
|
||||
bookmarksRestoreFilterExtension=*.json
|
||||
@@ -30,16 +20,8 @@ bookmarksRestoreParseError=Unable to process the backup file.
|
||||
bookmarksLivemarkLoading=Live Bookmark loading…
|
||||
bookmarksLivemarkFailed=Live Bookmark feed failed to load.
|
||||
|
||||
headerTextPrefix1=Showing
|
||||
headerTextPrefix2=Search Results for
|
||||
headerTextPrefix3=Advanced Search
|
||||
|
||||
menuOpenLivemarkOrigin.label=Open "%S"
|
||||
|
||||
livemarkReload=Reload
|
||||
livemarkReloadAll=Reload All Live Bookmarks
|
||||
livemarkReloadOne=Reload %S
|
||||
|
||||
sortByName=Sort '%S' by Name
|
||||
sortByNameGeneric=Sort by Name
|
||||
view.sortBy.name.label=Sort by Name
|
||||
@@ -71,8 +53,6 @@ tabs.openWarningMultipleBranded=You are about to open %S tabs. This might slow
|
||||
tabs.openButtonMultiple=Open tabs
|
||||
tabs.openWarningPromptMeBranded=Warn me when opening multiple tabs might slow down %S
|
||||
|
||||
status_foldercount = %S object(s)
|
||||
|
||||
SelectImport=Import Bookmarks File
|
||||
EnterExport=Export Bookmarks File
|
||||
|
||||
@@ -84,7 +64,6 @@ detailsPane.noItems=No items
|
||||
detailsPane.oneItem=One item
|
||||
detailsPane.multipleItems=%S items
|
||||
|
||||
smartBookmarksFolderTitle=Smart Bookmarks
|
||||
mostVisitedTitle=Most Visited
|
||||
recentlyBookmarkedTitle=Recently Bookmarked
|
||||
recentTagsTitle=Recent Tags
|
||||
|
||||
@@ -67,6 +67,15 @@ treechildren::-moz-tree-image(partial) {
|
||||
list-style-image: url("chrome://global/skin/checkbox/cbox-check-dis.gif");
|
||||
}
|
||||
|
||||
/* undo odd row highlighting from tree.css */
|
||||
treechildren::-moz-tree-row(odd) {
|
||||
background-color: transparent;
|
||||
}
|
||||
treechildren::-moz-tree-row(odd, selected, focus) {
|
||||
background-color: Highlight;
|
||||
}
|
||||
|
||||
/* highlight "windows" instead */
|
||||
treechildren::-moz-tree-row(alternate) {
|
||||
background-color: -moz-oddtreerow;
|
||||
}
|
||||
|
||||
@@ -2044,3 +2044,4 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
|
||||
.allTabs-preview:focus > * > .allTabs-preview-inner {
|
||||
-moz-box-shadow: @focusRingShadow@;
|
||||
}
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ main ()
|
||||
echo "***"
|
||||
echo "*** rpm --erase --nodeps gtk gtk-devel" ],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means GLIB was incorrectly installed"
|
||||
echo "*** exact error that occurred. This usually means GLIB was incorrectly installed"
|
||||
echo "*** or that you have moved GLIB since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
|
||||
@@ -181,7 +181,7 @@ main ()
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means libIDL was incorrectly installed"
|
||||
echo "*** exact error that occurred. This usually means libIDL was incorrectly installed"
|
||||
echo "*** or that you have moved libIDL since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the libIDL-config script: $LIBIDL_CONFIG" ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
|
||||
@@ -1289,7 +1289,7 @@ Transparency is important even if you don't know enough about
|
||||
programming or security to determine whether the program
|
||||
contains any flaws. The very fact that it can be examined
|
||||
by anybody allows those with the required expertise to pass
|
||||
judgement, and you can form your own conclusions based on
|
||||
judgment, and you can form your own conclusions based on
|
||||
their analysis.
|
||||
</p>
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ moz_test_binary()
|
||||
##########################################################################
|
||||
moz_get_debugger()
|
||||
{
|
||||
debuggers="ddd gdb dbx bdb"
|
||||
debuggers="ddd gdb dbx bdb native-gdb"
|
||||
debugger="notfound"
|
||||
done="no"
|
||||
for d in $debuggers
|
||||
@@ -169,6 +169,10 @@ moz_debug_program()
|
||||
# If you are not using ddd, gdb and know of a way to convey the arguments
|
||||
# over to the prog then add that here- Gagan Saksena 03/15/00
|
||||
case `basename $debugger` in
|
||||
native-gdb) echo "$debugger $moz_debugger_args --args $prog" ${1+"$@"}
|
||||
exec "$debugger" $moz_debugger_args --args "$prog" ${1+"$@"}
|
||||
exitcode=$?
|
||||
;;
|
||||
gdb) echo "$debugger $moz_debugger_args --args $prog" ${1+"$@"}
|
||||
exec "$debugger" $moz_debugger_args --args "$prog" ${1+"$@"}
|
||||
exitcode=$?
|
||||
|
||||
@@ -316,7 +316,7 @@ interface nsIScriptSecurityManager : nsIXPCSecurityManager
|
||||
* If no scripted code is running "above" (or called from) fp, then
|
||||
* instead of looking at cx->globalObject, we will return |principal|.
|
||||
* This function only affects |cx|. If someone pushes another context onto
|
||||
* the context stack, then it supercedes this call.
|
||||
* the context stack, then it supersedes this call.
|
||||
* NOTE: If |fp| is non-null popContextPrincipal must be called before fp
|
||||
* has finished executing.
|
||||
*
|
||||
|
||||
@@ -45,38 +45,87 @@
|
||||
|
||||
#include "prio.h"
|
||||
#include "prprf.h"
|
||||
#if defined(XP_WIN)
|
||||
#include <windows.h>
|
||||
#elif defined(XP_MACOSX)
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#elif defined(MOZ_WIDGET_GTK2)
|
||||
#include <gtk/gtk.h>
|
||||
#endif
|
||||
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsArrayEnumerator.h"
|
||||
#include "nsStringEnumerator.h"
|
||||
#include "nsEnumeratorUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsEscape.h"
|
||||
#include "nsInt64.h"
|
||||
#include "nsLayoutCID.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsXPCOMCIDInternal.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nsTextFormatter.h"
|
||||
|
||||
#include "nsICSSStyleSheet.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsICommandLine.h"
|
||||
#include "nsCSSStyleSheet.h"
|
||||
#include "nsIConsoleService.h"
|
||||
#include "nsIDirectoryService.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocumentObserver.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMLocation.h"
|
||||
#include "nsIDOMWindowCollection.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIFileChannel.h"
|
||||
#include "nsIFileURL.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIJARProtocolHandler.h"
|
||||
#include "nsIJARURI.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsILocaleService.h"
|
||||
#include "nsILookAndFeel.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefBranch2.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIProtocolHandler.h"
|
||||
#include "nsIResProtocolHandler.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsIStyleSheet.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIVersionComparator.h"
|
||||
#include "nsIWindowMediator.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsIXULAppInfo.h"
|
||||
#include "nsIXULRuntime.h"
|
||||
|
||||
#define UILOCALE_CMD_LINE_ARG "UILocale"
|
||||
|
||||
#define MATCH_OS_LOCALE_PREF "intl.locale.matchOS"
|
||||
#define SELECTED_LOCALE_PREF "general.useragent.locale"
|
||||
#define SELECTED_SKIN_PREF "general.skins.selectedSkin"
|
||||
|
||||
static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
|
||||
|
||||
nsChromeRegistry* nsChromeRegistry::gChromeRegistry;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void
|
||||
nsChromeRegistry::LogMessage(const char* aMsg, ...)
|
||||
static void
|
||||
LogMessage(const char* aMsg, ...)
|
||||
{
|
||||
nsCOMPtr<nsIConsoleService> console
|
||||
(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
|
||||
@@ -94,8 +143,8 @@ nsChromeRegistry::LogMessage(const char* aMsg, ...)
|
||||
PR_smprintf_free(formatted);
|
||||
}
|
||||
|
||||
void
|
||||
nsChromeRegistry::LogMessageWithContext(nsIURI* aURL, PRUint32 aLineNumber, PRUint32 flags,
|
||||
static void
|
||||
LogMessageWithContext(nsIURI* aURL, PRUint32 aLineNumber, PRUint32 flags,
|
||||
const char* aMsg, ...)
|
||||
{
|
||||
nsresult rv;
|
||||
@@ -131,6 +180,238 @@ nsChromeRegistry::LogMessageWithContext(nsIURI* aURL, PRUint32 aLineNumber, PRUi
|
||||
console->LogMessage(error);
|
||||
}
|
||||
|
||||
// We use a "best-fit" algorithm for matching locales and themes.
|
||||
// 1) the exact selected locale/theme
|
||||
// 2) (locales only) same language, different country
|
||||
// e.g. en-GB is the selected locale, only en-US is available
|
||||
// 3) any available locale/theme
|
||||
|
||||
/**
|
||||
* Match the language-part of two lang-COUNTRY codes, hopefully but
|
||||
* not guaranteed to be in the form ab-CD or abz-CD. "ab" should also
|
||||
* work, any other garbage-in will produce undefined results as long
|
||||
* as it does not crash.
|
||||
*/
|
||||
static PRBool
|
||||
LanguagesMatch(const nsACString& a, const nsACString& b)
|
||||
{
|
||||
if (a.Length() < 2 || b.Length() < 2)
|
||||
return PR_FALSE;
|
||||
|
||||
nsACString::const_iterator as, ae, bs, be;
|
||||
a.BeginReading(as);
|
||||
a.EndReading(ae);
|
||||
b.BeginReading(bs);
|
||||
b.EndReading(be);
|
||||
|
||||
while (*as == *bs) {
|
||||
if (*as == '-')
|
||||
return PR_TRUE;
|
||||
|
||||
++as; ++bs;
|
||||
|
||||
// reached the end
|
||||
if (as == ae && bs == be)
|
||||
return PR_TRUE;
|
||||
|
||||
// "a" is short
|
||||
if (as == ae)
|
||||
return (*bs == '-');
|
||||
|
||||
// "b" is short
|
||||
if (bs == be)
|
||||
return (*as == '-');
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
CanLoadResource(nsIURI* aResourceURI)
|
||||
{
|
||||
PRBool isLocalResource = PR_FALSE;
|
||||
(void)NS_URIChainHasFlags(aResourceURI,
|
||||
nsIProtocolHandler::URI_IS_LOCAL_RESOURCE,
|
||||
&isLocalResource);
|
||||
return isLocalResource;
|
||||
}
|
||||
|
||||
nsChromeRegistry::ProviderEntry*
|
||||
nsChromeRegistry::nsProviderArray::GetProvider(const nsACString& aPreferred, MatchType aType)
|
||||
{
|
||||
PRInt32 i = mArray.Count();
|
||||
if (!i)
|
||||
return nsnull;
|
||||
|
||||
ProviderEntry* found = nsnull; // Only set if we find a partial-match locale
|
||||
ProviderEntry* entry;
|
||||
|
||||
while (i--) {
|
||||
entry = reinterpret_cast<ProviderEntry*>(mArray[i]);
|
||||
if (aPreferred.Equals(entry->provider))
|
||||
return entry;
|
||||
|
||||
if (aType != LOCALE)
|
||||
continue;
|
||||
|
||||
if (LanguagesMatch(aPreferred, entry->provider)) {
|
||||
found = entry;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!found && entry->provider.EqualsLiteral("en-US"))
|
||||
found = entry;
|
||||
}
|
||||
|
||||
if (!found && aType != EXACT)
|
||||
return entry;
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
nsIURI*
|
||||
nsChromeRegistry::nsProviderArray::GetBase(const nsACString& aPreferred, MatchType aType)
|
||||
{
|
||||
ProviderEntry* provider = GetProvider(aPreferred, aType);
|
||||
|
||||
if (!provider)
|
||||
return nsnull;
|
||||
|
||||
return provider->baseURI;
|
||||
}
|
||||
|
||||
const nsACString&
|
||||
nsChromeRegistry::nsProviderArray::GetSelected(const nsACString& aPreferred, MatchType aType)
|
||||
{
|
||||
ProviderEntry* entry = GetProvider(aPreferred, aType);
|
||||
|
||||
if (entry)
|
||||
return entry->provider;
|
||||
|
||||
return EmptyCString();
|
||||
}
|
||||
|
||||
void
|
||||
nsChromeRegistry::nsProviderArray::SetBase(const nsACString& aProvider, nsIURI* aBaseURL)
|
||||
{
|
||||
ProviderEntry* provider = GetProvider(aProvider, EXACT);
|
||||
|
||||
if (provider) {
|
||||
provider->baseURI = aBaseURL;
|
||||
return;
|
||||
}
|
||||
|
||||
// no existing entries, add a new one
|
||||
provider = new ProviderEntry(aProvider, aBaseURL);
|
||||
if (!provider)
|
||||
return; // It's safe to silently fail on OOM
|
||||
|
||||
mArray.AppendElement(provider);
|
||||
}
|
||||
|
||||
void
|
||||
nsChromeRegistry::nsProviderArray::EnumerateToArray(nsTArray<nsCString> *a)
|
||||
{
|
||||
PRInt32 i = mArray.Count();
|
||||
while (i--) {
|
||||
ProviderEntry *entry = reinterpret_cast<ProviderEntry*>(mArray[i]);
|
||||
a->AppendElement(entry->provider);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsChromeRegistry::nsProviderArray::Clear()
|
||||
{
|
||||
PRInt32 i = mArray.Count();
|
||||
while (i--) {
|
||||
ProviderEntry* entry = reinterpret_cast<ProviderEntry*>(mArray[i]);
|
||||
delete entry;
|
||||
}
|
||||
|
||||
mArray.Clear();
|
||||
}
|
||||
|
||||
nsChromeRegistry::PackageEntry::PackageEntry(const nsACString& aPackage) :
|
||||
package(aPackage), flags(0)
|
||||
{
|
||||
}
|
||||
|
||||
PLHashNumber
|
||||
nsChromeRegistry::HashKey(PLDHashTable *table, const void *key)
|
||||
{
|
||||
const nsACString& str = *reinterpret_cast<const nsACString*>(key);
|
||||
return HashString(str);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsChromeRegistry::MatchKey(PLDHashTable *table, const PLDHashEntryHdr *entry,
|
||||
const void *key)
|
||||
{
|
||||
const nsACString& str = *reinterpret_cast<const nsACString*>(key);
|
||||
const PackageEntry* pentry = static_cast<const PackageEntry*>(entry);
|
||||
return str.Equals(pentry->package);
|
||||
}
|
||||
|
||||
void
|
||||
nsChromeRegistry::ClearEntry(PLDHashTable *table, PLDHashEntryHdr *entry)
|
||||
{
|
||||
PackageEntry* pentry = static_cast<PackageEntry*>(entry);
|
||||
pentry->~PackageEntry();
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsChromeRegistry::InitEntry(PLDHashTable *table, PLDHashEntryHdr *entry,
|
||||
const void *key)
|
||||
{
|
||||
const nsACString& str = *reinterpret_cast<const nsACString*>(key);
|
||||
|
||||
new (entry) PackageEntry(str);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
const PLDHashTableOps
|
||||
nsChromeRegistry::kTableOps = {
|
||||
PL_DHashAllocTable,
|
||||
PL_DHashFreeTable,
|
||||
HashKey,
|
||||
MatchKey,
|
||||
PL_DHashMoveEntryStub,
|
||||
ClearEntry,
|
||||
PL_DHashFinalizeStub,
|
||||
InitEntry
|
||||
};
|
||||
|
||||
void
|
||||
nsChromeRegistry::OverlayListEntry::AddURI(nsIURI* aURI)
|
||||
{
|
||||
PRInt32 i = mArray.Count();
|
||||
while (i--) {
|
||||
PRBool equals;
|
||||
if (NS_SUCCEEDED(aURI->Equals(mArray[i], &equals)) && equals)
|
||||
return;
|
||||
}
|
||||
|
||||
mArray.AppendObject(aURI);
|
||||
}
|
||||
|
||||
void
|
||||
nsChromeRegistry::OverlayListHash::Add(nsIURI* aBase, nsIURI* aOverlay)
|
||||
{
|
||||
OverlayListEntry* entry = mTable.PutEntry(aBase);
|
||||
if (entry)
|
||||
entry->AddURI(aOverlay);
|
||||
}
|
||||
|
||||
const nsCOMArray<nsIURI>*
|
||||
nsChromeRegistry::OverlayListHash::GetArray(nsIURI* aBase)
|
||||
{
|
||||
OverlayListEntry* entry = mTable.GetEntry(aBase);
|
||||
if (!entry)
|
||||
return nsnull;
|
||||
|
||||
return &entry->mArray;
|
||||
}
|
||||
|
||||
nsChromeRegistry::~nsChromeRegistry()
|
||||
{
|
||||
gChromeRegistry = nsnull;
|
||||
@@ -484,13 +765,11 @@ nsresult nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow)
|
||||
for (PRInt32 l = 0; l < agentSheets.Count(); ++l) {
|
||||
nsIStyleSheet *sheet = agentSheets[l];
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = sheet->GetSheetURI(getter_AddRefs(uri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIURI> uri = sheet->GetSheetURI();
|
||||
|
||||
if (IsChromeURI(uri)) {
|
||||
// Reload the sheet.
|
||||
nsCOMPtr<nsICSSStyleSheet> newSheet;
|
||||
nsRefPtr<nsCSSStyleSheet> newSheet;
|
||||
rv = document->LoadChromeSheetSync(uri, PR_TRUE,
|
||||
getter_AddRefs(newSheet));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
@@ -529,12 +808,12 @@ nsresult nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow)
|
||||
// Iterate over our old sheets and kick off a sync load of the new
|
||||
// sheet if and only if it's a chrome URL.
|
||||
for (i = 0; i < count; i++) {
|
||||
nsCOMPtr<nsICSSStyleSheet> sheet = do_QueryInterface(oldSheets[i]);
|
||||
nsRefPtr<nsCSSStyleSheet> sheet = do_QueryObject(oldSheets[i]);
|
||||
nsIURI* uri = sheet ? sheet->GetOriginalURI() : nsnull;
|
||||
|
||||
if (uri && IsChromeURI(uri)) {
|
||||
// Reload the sheet.
|
||||
nsCOMPtr<nsICSSStyleSheet> newSheet;
|
||||
nsRefPtr<nsCSSStyleSheet> newSheet;
|
||||
// XXX what about chrome sheets that have a title or are disabled? This
|
||||
// only works by sheer dumb luck.
|
||||
document->LoadChromeSheetSync(uri, PR_FALSE, getter_AddRefs(newSheet));
|
||||
|
||||
@@ -139,12 +139,14 @@ GARBAGE_DIRS += system_wrappers
|
||||
endif
|
||||
|
||||
ifdef WRAP_STL_INCLUDES
|
||||
ifdef GCC_VERSION
|
||||
ifdef GNU_CXX
|
||||
stl_compiler = gcc
|
||||
else
|
||||
ifdef _MSC_VER
|
||||
stl_compiler = msvc
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef stl_compiler
|
||||
stl-wrappers-sentinel: $(srcdir)/make-stl-wrappers.py $(srcdir)/$(stl_compiler)-stl-wrapper.template.h $(srcdir)/stl-headers $(GLOBAL_DEPS)
|
||||
|
||||
@@ -261,7 +261,7 @@ class DuplicateError(ConfigObjError):
|
||||
|
||||
class ConfigspecError(ConfigObjError):
|
||||
"""
|
||||
An error occured whilst parsing a configspec.
|
||||
An error occurred whilst parsing a configspec.
|
||||
"""
|
||||
|
||||
class InterpolationError(ConfigObjError):
|
||||
@@ -1600,7 +1600,7 @@ class ConfigObj(Section):
|
||||
Handle an error according to the error settings.
|
||||
|
||||
Either raise the error or store it.
|
||||
The error will have occured at ``cur_index``
|
||||
The error will have occurred at ``cur_index``
|
||||
"""
|
||||
line = infile[cur_index]
|
||||
cur_index += 1
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# This command, fast-update.pl, does a (fast) cvs update of the current
|
||||
# directory. It is fast because the cvs up command is only run on those
|
||||
# directories / sub-directories where changes have occured since the
|
||||
# directories / sub-directories where changes have occurred since the
|
||||
# last fast-update.
|
||||
#
|
||||
# The last update time is stored in a ".fast-update" file in the current
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#Compares with: foo1.class foo2.class (if -d specified, checks in 'dir',
|
||||
# otherwise assumes .class files in same directory as .java files)
|
||||
#Returns: list of input arguments which are newer than corresponding class
|
||||
#files (non-existant class files are considered to be real old :-)
|
||||
#files (non-existent class files are considered to be real old :-)
|
||||
#
|
||||
|
||||
$found = 1;
|
||||
|
||||
@@ -2254,6 +2254,7 @@ ia64*-hpux*)
|
||||
XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
|
||||
DLL_PREFIX=
|
||||
IMPORT_LIB_SUFFIX=dll.a
|
||||
GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
|
||||
else
|
||||
TARGET_COMPILER_ABI=msvc
|
||||
HOST_CC='$(CC)'
|
||||
@@ -2287,6 +2288,7 @@ ia64*-hpux*)
|
||||
_DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
|
||||
CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
|
||||
CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
|
||||
CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
|
||||
LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
|
||||
MOZ_DEBUG_FLAGS='-Zi'
|
||||
MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
|
||||
|
||||
27
content/base/crashtests/565125-1.html
Normal file
27
content/base/crashtests/565125-1.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
|
||||
function boom()
|
||||
{
|
||||
var a = document.createTextNode(" ");
|
||||
(document.documentElement).appendChild(a);
|
||||
var b = document.createElement("span");
|
||||
(document.documentElement).appendChild(b);
|
||||
var c = document.createTextNode(" ");
|
||||
(document.documentElement).appendChild(c);
|
||||
var r = document.createRange();
|
||||
r.setStart(a, 0);
|
||||
r.setEnd(c, 0);
|
||||
try {
|
||||
r.surroundContents(document.documentElement);
|
||||
} catch(e) {
|
||||
}
|
||||
document.documentElement.appendChild(b);
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="boom();"></body>
|
||||
</html>
|
||||
@@ -65,3 +65,4 @@ load 552651.html
|
||||
load 558973.html
|
||||
load 564079-1.html
|
||||
load 564114.html
|
||||
load 565125-1.html
|
||||
|
||||
@@ -70,7 +70,7 @@ class nsIDocShell;
|
||||
class nsStyleSet;
|
||||
class nsIStyleSheet;
|
||||
class nsIStyleRule;
|
||||
class nsICSSStyleSheet;
|
||||
class nsCSSStyleSheet;
|
||||
class nsIViewManager;
|
||||
class nsIScriptGlobalObject;
|
||||
class nsIDOMEvent;
|
||||
@@ -116,8 +116,8 @@ class Element;
|
||||
} // namespace mozilla
|
||||
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0xa979dabe, 0x75de, 0x4c2d, \
|
||||
{ 0x8b, 0x83, 0x17, 0xb2, 0xde, 0x9d, 0x9d, 0x37 } }
|
||||
{ 0x625fe492, 0x0344, 0x406c, \
|
||||
{ 0xaf, 0x7f, 0x55, 0xfe, 0xa2, 0x6b, 0x3d, 0x20 } }
|
||||
|
||||
// Flag for AddStyleSheet().
|
||||
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
|
||||
@@ -1285,7 +1285,7 @@ public:
|
||||
* DO NOT USE FOR UNTRUSTED CONTENT.
|
||||
*/
|
||||
virtual nsresult LoadChromeSheetSync(nsIURI* aURI, PRBool aIsAgentSheet,
|
||||
nsICSSStyleSheet** aSheet) = 0;
|
||||
nsCSSStyleSheet** aSheet) = 0;
|
||||
|
||||
/**
|
||||
* Returns true if the locale used for the document specifies a direction of
|
||||
|
||||
@@ -68,7 +68,7 @@ static const PRInt32 kNameSpaceID_None = 0;
|
||||
{ 0xac, 0x95, 0x9e, 0x10, 0x24, 0x30, 0x88, 0xd6 } }
|
||||
|
||||
/**
|
||||
* The Name Space Manager tracks the associtation between a NameSpace
|
||||
* The Name Space Manager tracks the association between a NameSpace
|
||||
* URI and the PRInt32 runtime id. Mappings between NameSpaces and
|
||||
* NameSpace prefixes are managed by nsINameSpaces.
|
||||
*
|
||||
|
||||
@@ -194,13 +194,13 @@ inline nsINode* NODE_FROM(C& aContent, D& aDocument)
|
||||
* Class used to detect unexpected mutations. To use the class create an
|
||||
* nsMutationGuard on the stack before unexpected mutations could occur.
|
||||
* You can then at any time call Mutated to check if any unexpected mutations
|
||||
* have occured.
|
||||
* have occurred.
|
||||
*
|
||||
* When a guard is instantiated sMutationCount is set to 300. It is then
|
||||
* decremented by every mutation (capped at 0). This means that we can only
|
||||
* detect 300 mutations during the lifetime of a single guard, however that
|
||||
* should be more then we ever care about as we usually only care if more then
|
||||
* one mutation has occured.
|
||||
* one mutation has occurred.
|
||||
*
|
||||
* When the guard goes out of scope it will adjust sMutationCount so that over
|
||||
* the lifetime of the guard the guard itself has not affected sMutationCount,
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if any unexpected mutations have occured. You can pass in
|
||||
* Returns true if any unexpected mutations have occurred. You can pass in
|
||||
* an 8-bit ignore count to ignore a number of expected mutations.
|
||||
*/
|
||||
PRBool Mutated(PRUint8 aIgnoreCount)
|
||||
@@ -715,12 +715,12 @@ public:
|
||||
*/
|
||||
void AddMutationObserver(nsIMutationObserver* aMutationObserver)
|
||||
{
|
||||
nsSlots* slots = GetSlots();
|
||||
if (slots) {
|
||||
NS_ASSERTION(slots->mMutationObservers.IndexOf(aMutationObserver) ==
|
||||
nsSlots* s = GetSlots();
|
||||
if (s) {
|
||||
NS_ASSERTION(s->mMutationObservers.IndexOf(aMutationObserver) ==
|
||||
nsTArray_base::NoIndex,
|
||||
"Observer already in the list");
|
||||
slots->mMutationObservers.AppendElement(aMutationObserver);
|
||||
s->mMutationObservers.AppendElement(aMutationObserver);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -730,9 +730,9 @@ public:
|
||||
*/
|
||||
void AddMutationObserverUnlessExists(nsIMutationObserver* aMutationObserver)
|
||||
{
|
||||
nsSlots* slots = GetSlots();
|
||||
if (slots) {
|
||||
slots->mMutationObservers.AppendElementUnlessExists(aMutationObserver);
|
||||
nsSlots* s = GetSlots();
|
||||
if (s) {
|
||||
s->mMutationObservers.AppendElementUnlessExists(aMutationObserver);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -741,9 +741,9 @@ public:
|
||||
*/
|
||||
void RemoveMutationObserver(nsIMutationObserver* aMutationObserver)
|
||||
{
|
||||
nsSlots* slots = GetExistingSlots();
|
||||
if (slots) {
|
||||
slots->mMutationObservers.RemoveElement(aMutationObserver);
|
||||
nsSlots* s = GetExistingSlots();
|
||||
if (s) {
|
||||
s->mMutationObservers.RemoveElement(aMutationObserver);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -666,6 +666,18 @@ nsAttrAndChildArray::Clear()
|
||||
// making this PR_FALSE so tree teardown doesn't end up being
|
||||
// O(N*D) (number of nodes times average depth of tree).
|
||||
child->UnbindFromTree(PR_FALSE); // XXX is it better to let the owner do this?
|
||||
// Make sure to unlink our kids from each other, since someone
|
||||
// else could stil be holding references to some of them.
|
||||
|
||||
// XXXbz We probably can't push this assignment down into the |aNullParent|
|
||||
// case of UnbindFromTree because we still need the assignment in
|
||||
// RemoveChildAt. In particular, ContentRemoved fires between
|
||||
// RemoveChildAt and UnbindFromTree, and in ContentRemoved the sibling
|
||||
// chain needs to be correct. Though maybe we could set the prev and next
|
||||
// to point to each other but keep the kid being removed pointing to them
|
||||
// through ContentRemoved so consumers can find where it used to be in the
|
||||
// list?
|
||||
child->mPreviousSibling = child->mNextSibling = nsnull;
|
||||
NS_RELEASE(child);
|
||||
}
|
||||
|
||||
|
||||
@@ -268,19 +268,16 @@ CSPService::OnChannelRedirect(nsIChannel *oldChannel,
|
||||
#endif
|
||||
|
||||
// if ShouldLoad doesn't accept the load, cancel the request
|
||||
if (aDecision != 1) {
|
||||
newChannel->Cancel(NS_BINDING_FAILED);
|
||||
}
|
||||
if (aDecision != 1)
|
||||
return NS_BINDING_FAILED;
|
||||
|
||||
else {
|
||||
// the redirect is permitted, so propagate the Content Security Policy
|
||||
// and load type to the redirecting channel
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIWritablePropertyBag2> props = do_QueryInterface(newChannel, &rv);
|
||||
if (props)
|
||||
props->SetPropertyAsInterface(NS_CHANNEL_PROP_CHANNEL_POLICY,
|
||||
nsCOMPtr<nsIWritablePropertyBag2> props2 = do_QueryInterface(newChannel, &rv);
|
||||
if (props2)
|
||||
props2->SetPropertyAsInterface(NS_CHANNEL_PROP_CHANNEL_POLICY,
|
||||
channelPolicy);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
* aDragSelection - [out] set to true to indicate that a selection is being
|
||||
* dragged, rather than a specific node
|
||||
* aDragNode - [out] the link, image or area being dragged, or null if the
|
||||
* drag occured on another element.
|
||||
* drag occurred on another element.
|
||||
*/
|
||||
static nsresult GetDragData(nsIDOMWindow* aWindow,
|
||||
nsIContent* aTarget,
|
||||
|
||||
@@ -323,7 +323,7 @@ nsContentSink::Init(nsIDocument* aDoc,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentSink::StyleSheetLoaded(nsICSSStyleSheet* aSheet,
|
||||
nsContentSink::StyleSheetLoaded(nsCSSStyleSheet* aSheet,
|
||||
PRBool aWasAlternate,
|
||||
nsresult aStatus)
|
||||
{
|
||||
|
||||
@@ -127,7 +127,7 @@ class nsContentSink : public nsICSSLoaderObserver,
|
||||
NS_DECL_NSITIMERCALLBACK
|
||||
|
||||
// nsICSSLoaderObserver
|
||||
NS_IMETHOD StyleSheetLoaded(nsICSSStyleSheet* aSheet, PRBool aWasAlternate,
|
||||
NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet* aSheet, PRBool aWasAlternate,
|
||||
nsresult aStatus);
|
||||
|
||||
virtual nsresult ProcessMETATag(nsIContent* aContent);
|
||||
|
||||
@@ -4577,7 +4577,7 @@ nsContentUtils::ProcessViewportInfo(nsIDocument *aDocument,
|
||||
while ((tip != end) && IS_SEPARATOR(*tip))
|
||||
++tip;
|
||||
|
||||
/* Read through and find tokens seperated by separators. */
|
||||
/* Read through and find tokens separated by separators. */
|
||||
while (tip != end) {
|
||||
|
||||
/* Synchronize tip and tail. */
|
||||
@@ -5704,7 +5704,9 @@ nsContentUtils::ReparentClonedObjectToScope(JSContext* cx,
|
||||
while (!objectData.IsEmpty()) {
|
||||
ReparentObjectData& data = objectData[objectData.Length() - 1];
|
||||
|
||||
if (!data.ids && !data.index) {
|
||||
if (!data.ids) {
|
||||
NS_ASSERTION(!data.index, "Shouldn't have index here");
|
||||
|
||||
// Typed arrays are special and don't need to be enumerated.
|
||||
if (js_IsTypedArray(data.obj)) {
|
||||
if (!js_ReparentTypedArrayToScope(cx, data.obj, scope)) {
|
||||
|
||||
@@ -1983,9 +1983,7 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
||||
nsIStyleSheet* sheet = mStyleSheets[indx];
|
||||
sheet->SetOwningDocument(nsnull);
|
||||
|
||||
PRBool applicable;
|
||||
sheet->GetApplicable(applicable);
|
||||
if (applicable) {
|
||||
if (sheet->GetApplicable()) {
|
||||
RemoveStyleSheetFromStyleSets(sheet);
|
||||
}
|
||||
|
||||
@@ -1997,9 +1995,7 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
||||
nsIStyleSheet* sheet = mCatalogSheets[indx];
|
||||
sheet->SetOwningDocument(nsnull);
|
||||
|
||||
PRBool applicable;
|
||||
sheet->GetApplicable(applicable);
|
||||
if (applicable) {
|
||||
if (sheet->GetApplicable()) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
shell->StyleSet()->RemoveStyleSheet(nsStyleSet::eAgentSheet, sheet);
|
||||
@@ -2092,18 +2088,14 @@ nsDocument::FillStyleSet(nsStyleSet* aStyleSet)
|
||||
PRInt32 i;
|
||||
for (i = mStyleSheets.Count() - 1; i >= 0; --i) {
|
||||
nsIStyleSheet* sheet = mStyleSheets[i];
|
||||
PRBool sheetApplicable;
|
||||
sheet->GetApplicable(sheetApplicable);
|
||||
if (sheetApplicable) {
|
||||
if (sheet->GetApplicable()) {
|
||||
aStyleSet->AddDocStyleSheet(sheet, this);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = mCatalogSheets.Count() - 1; i >= 0; --i) {
|
||||
nsIStyleSheet* sheet = mCatalogSheets[i];
|
||||
PRBool sheetApplicable;
|
||||
sheet->GetApplicable(sheetApplicable);
|
||||
if (sheetApplicable) {
|
||||
if (sheet->GetApplicable()) {
|
||||
aStyleSet->AppendStyleSheet(nsStyleSet::eAgentSheet, sheet);
|
||||
}
|
||||
}
|
||||
@@ -3374,10 +3366,7 @@ nsDocument::AddStyleSheet(nsIStyleSheet* aSheet)
|
||||
mStyleSheets.AppendObject(aSheet);
|
||||
aSheet->SetOwningDocument(this);
|
||||
|
||||
PRBool applicable;
|
||||
aSheet->GetApplicable(applicable);
|
||||
|
||||
if (applicable) {
|
||||
if (aSheet->GetApplicable()) {
|
||||
AddStyleSheetToStyleSets(aSheet);
|
||||
}
|
||||
|
||||
@@ -3405,9 +3394,7 @@ nsDocument::RemoveStyleSheet(nsIStyleSheet* aSheet)
|
||||
}
|
||||
|
||||
if (!mIsGoingAway) {
|
||||
PRBool applicable = PR_TRUE;
|
||||
aSheet->GetApplicable(applicable);
|
||||
if (applicable) {
|
||||
if (aSheet->GetApplicable()) {
|
||||
RemoveStyleSheetFromStyleSets(aSheet);
|
||||
}
|
||||
|
||||
@@ -3443,9 +3430,7 @@ nsDocument::UpdateStyleSheets(nsCOMArray<nsIStyleSheet>& aOldSheets,
|
||||
if (newSheet) {
|
||||
mStyleSheets.InsertObjectAt(newSheet, oldIndex);
|
||||
newSheet->SetOwningDocument(this);
|
||||
PRBool applicable = PR_TRUE;
|
||||
newSheet->GetApplicable(applicable);
|
||||
if (applicable) {
|
||||
if (newSheet->GetApplicable()) {
|
||||
AddStyleSheetToStyleSets(newSheet);
|
||||
}
|
||||
|
||||
@@ -3464,10 +3449,7 @@ nsDocument::InsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex)
|
||||
|
||||
aSheet->SetOwningDocument(this);
|
||||
|
||||
PRBool applicable;
|
||||
aSheet->GetApplicable(applicable);
|
||||
|
||||
if (applicable) {
|
||||
if (aSheet->GetApplicable()) {
|
||||
AddStyleSheetToStyleSets(aSheet);
|
||||
}
|
||||
|
||||
@@ -3520,10 +3502,7 @@ nsDocument::AddCatalogStyleSheet(nsIStyleSheet* aSheet)
|
||||
mCatalogSheets.AppendObject(aSheet);
|
||||
aSheet->SetOwningDocument(this);
|
||||
|
||||
PRBool applicable;
|
||||
aSheet->GetApplicable(applicable);
|
||||
|
||||
if (applicable) {
|
||||
if (aSheet->GetApplicable()) {
|
||||
// This is like |AddStyleSheetToStyleSets|, but for an agent sheet.
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
if (shell) {
|
||||
@@ -3544,8 +3523,7 @@ nsDocument::EnsureCatalogStyleSheet(const char *aStyleSheetURI)
|
||||
nsIStyleSheet* sheet = GetCatalogStyleSheetAt(i);
|
||||
NS_ASSERTION(sheet, "unexpected null stylesheet in the document");
|
||||
if (sheet) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
sheet->GetSheetURI(getter_AddRefs(uri));
|
||||
nsCOMPtr<nsIURI> uri = sheet->GetSheetURI();
|
||||
nsCAutoString uriStr;
|
||||
uri->GetSpec(uriStr);
|
||||
if (uriStr.Equals(aStyleSheetURI))
|
||||
@@ -3556,7 +3534,7 @@ nsDocument::EnsureCatalogStyleSheet(const char *aStyleSheetURI)
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
NS_NewURI(getter_AddRefs(uri), aStyleSheetURI);
|
||||
if (uri) {
|
||||
nsCOMPtr<nsICSSStyleSheet> sheet;
|
||||
nsRefPtr<nsCSSStyleSheet> sheet;
|
||||
cssLoader->LoadSheetSync(uri, PR_TRUE, PR_TRUE, getter_AddRefs(sheet));
|
||||
if (sheet) {
|
||||
BeginUpdate(UPDATE_STYLE);
|
||||
@@ -6225,17 +6203,22 @@ nsDocument::CreateEventGroup(nsIDOMEventGroup **aInstancePtrResult)
|
||||
void
|
||||
nsDocument::FlushPendingNotifications(mozFlushType aType)
|
||||
{
|
||||
if (mParser || mWeakSink) {
|
||||
nsCOMPtr<nsIContentSink> sink;
|
||||
if (mParser) {
|
||||
sink = mParser->GetContentSink();
|
||||
} else {
|
||||
sink = do_QueryReferent(mWeakSink);
|
||||
if (!sink) {
|
||||
mWeakSink = nsnull;
|
||||
}
|
||||
}
|
||||
// Determine if it is safe to flush the sink notifications
|
||||
// by determining if it safe to flush all the presshells.
|
||||
if (sink && (aType == Flush_Content || IsSafeToFlush())) {
|
||||
sink->FlushPendingNotifications(aType);
|
||||
}
|
||||
}
|
||||
|
||||
// Should we be flushing pending binding constructors in here?
|
||||
|
||||
@@ -7585,7 +7568,7 @@ namespace {
|
||||
class StubCSSLoaderObserver : public nsICSSLoaderObserver {
|
||||
public:
|
||||
NS_IMETHOD
|
||||
StyleSheetLoaded(nsICSSStyleSheet*, PRBool, nsresult)
|
||||
StyleSheetLoaded(nsCSSStyleSheet*, PRBool, nsresult)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -7609,7 +7592,7 @@ nsDocument::PreloadStyle(nsIURI* uri, const nsAString& charset)
|
||||
|
||||
nsresult
|
||||
nsDocument::LoadChromeSheetSync(nsIURI* uri, PRBool isAgentSheet,
|
||||
nsICSSStyleSheet** sheet)
|
||||
nsCSSStyleSheet** sheet)
|
||||
{
|
||||
return CSSLoader()->LoadSheetSync(uri, isAgentSheet, isAgentSheet, sheet);
|
||||
}
|
||||
@@ -7745,15 +7728,11 @@ nsIDocument::CreateStaticClone(nsISupports* aCloneContainer)
|
||||
clonedDoc->mOriginalDocument = this;
|
||||
PRInt32 sheetsCount = GetNumberOfStyleSheets();
|
||||
for (PRInt32 i = 0; i < sheetsCount; ++i) {
|
||||
nsCOMPtr<nsICSSStyleSheet> sheet =
|
||||
do_QueryInterface(GetStyleSheetAt(i));
|
||||
nsRefPtr<nsCSSStyleSheet> sheet = do_QueryObject(GetStyleSheetAt(i));
|
||||
if (sheet) {
|
||||
PRBool applicable = PR_TRUE;
|
||||
sheet->GetApplicable(applicable);
|
||||
if (applicable) {
|
||||
nsCOMPtr<nsICSSStyleSheet> clonedSheet;
|
||||
sheet->Clone(nsnull, nsnull, clonedDoc, nsnull,
|
||||
getter_AddRefs(clonedSheet));
|
||||
if (sheet->GetApplicable()) {
|
||||
nsRefPtr<nsCSSStyleSheet> clonedSheet =
|
||||
sheet->Clone(nsnull, nsnull, clonedDoc, nsnull);
|
||||
NS_WARN_IF_FALSE(clonedSheet, "Cloning a stylesheet didn't work!");
|
||||
if (clonedSheet) {
|
||||
clonedDoc->AddStyleSheet(clonedSheet);
|
||||
@@ -7764,15 +7743,12 @@ nsIDocument::CreateStaticClone(nsISupports* aCloneContainer)
|
||||
|
||||
sheetsCount = GetNumberOfCatalogStyleSheets();
|
||||
for (PRInt32 i = 0; i < sheetsCount; ++i) {
|
||||
nsCOMPtr<nsICSSStyleSheet> sheet =
|
||||
do_QueryInterface(GetCatalogStyleSheetAt(i));
|
||||
nsRefPtr<nsCSSStyleSheet> sheet =
|
||||
do_QueryObject(GetCatalogStyleSheetAt(i));
|
||||
if (sheet) {
|
||||
PRBool applicable = PR_TRUE;
|
||||
sheet->GetApplicable(applicable);
|
||||
if (applicable) {
|
||||
nsCOMPtr<nsICSSStyleSheet> clonedSheet;
|
||||
sheet->Clone(nsnull, nsnull, clonedDoc, nsnull,
|
||||
getter_AddRefs(clonedSheet));
|
||||
if (sheet->GetApplicable()) {
|
||||
nsRefPtr<nsCSSStyleSheet> clonedSheet =
|
||||
sheet->Clone(nsnull, nsnull, clonedDoc, nsnull);
|
||||
NS_WARN_IF_FALSE(clonedSheet, "Cloning a stylesheet didn't work!");
|
||||
if (clonedSheet) {
|
||||
clonedDoc->AddCatalogStyleSheet(clonedSheet);
|
||||
|
||||
@@ -919,7 +919,7 @@ public:
|
||||
virtual void PreloadStyle(nsIURI* uri, const nsAString& charset);
|
||||
|
||||
virtual nsresult LoadChromeSheetSync(nsIURI* uri, PRBool isAgentSheet,
|
||||
nsICSSStyleSheet** sheet);
|
||||
nsCSSStyleSheet** sheet);
|
||||
|
||||
virtual nsISupports* GetCurrentContentSink();
|
||||
|
||||
|
||||
@@ -104,7 +104,6 @@
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsICSSStyleSheet.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIView.h"
|
||||
|
||||
|
||||
@@ -5072,7 +5072,7 @@ nsGenericElement::List(FILE* out, PRInt32 aIndent,
|
||||
ListAttributes(out);
|
||||
|
||||
fprintf(out, " intrinsicstate=[%08x]", IntrinsicState());
|
||||
fprintf(out, " flags=[%08x]", GetFlags());
|
||||
fprintf(out, " flags=[%08x]", static_cast<unsigned int>(GetFlags()));
|
||||
fprintf(out, " primaryframe=%p", static_cast<void*>(GetPrimaryFrame()));
|
||||
fprintf(out, " refcount=%d<", mRefCnt.get());
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
#include "nsIContent.h"
|
||||
#include "nsCSSLoader.h"
|
||||
#include "nsICSSStyleSheet.h"
|
||||
#include "nsCSSStyleSheet.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMComment.h"
|
||||
#include "nsIDOMNode.h"
|
||||
@@ -77,13 +77,13 @@ nsStyleLinkElement::~nsStyleLinkElement()
|
||||
NS_IMETHODIMP
|
||||
nsStyleLinkElement::SetStyleSheet(nsIStyleSheet* aStyleSheet)
|
||||
{
|
||||
nsCOMPtr<nsICSSStyleSheet> cssSheet = do_QueryInterface(mStyleSheet);
|
||||
nsRefPtr<nsCSSStyleSheet> cssSheet = do_QueryObject(mStyleSheet);
|
||||
if (cssSheet) {
|
||||
cssSheet->SetOwningNode(nsnull);
|
||||
}
|
||||
|
||||
mStyleSheet = aStyleSheet;
|
||||
cssSheet = do_QueryInterface(mStyleSheet);
|
||||
cssSheet = do_QueryObject(mStyleSheet);
|
||||
if (cssSheet) {
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
CallQueryInterface(this,
|
||||
@@ -248,9 +248,7 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument *aOldDocument,
|
||||
nsCOMPtr<nsIURI> uri = GetStyleSheetURL(&isInline);
|
||||
|
||||
if (!aForceUpdate && mStyleSheet && !isInline && uri) {
|
||||
nsCOMPtr<nsIURI> oldURI;
|
||||
|
||||
mStyleSheet->GetSheetURI(getter_AddRefs(oldURI));
|
||||
nsCOMPtr<nsIURI> oldURI = mStyleSheet->GetSheetURI();
|
||||
if (oldURI) {
|
||||
PRBool equal;
|
||||
nsresult rv = oldURI->Equals(uri, &equal);
|
||||
|
||||
@@ -236,7 +236,7 @@ nsTextNode::List(FILE* out, PRInt32 aIndent) const
|
||||
|
||||
fprintf(out, "Text@%p", static_cast<const void*>(this));
|
||||
fprintf(out, " intrinsicstate=[%08x]", IntrinsicState());
|
||||
fprintf(out, " flags=[%08x]", GetFlags());
|
||||
fprintf(out, " flags=[%08x]", static_cast<unsigned int>(GetFlags()));
|
||||
fprintf(out, " primaryframe=%p", static_cast<void*>(GetPrimaryFrame()));
|
||||
fprintf(out, " refcount=%d<", mRefCnt.get());
|
||||
|
||||
|
||||
@@ -665,7 +665,7 @@
|
||||
t( "ID Selector w/ Element", "body#body", ["body"], false );
|
||||
t( "ID Selector w/ Element", "ul#first", [] );
|
||||
t( "ID selector with existing ID descendant", "#firstp #simon1", ["simon1"] );
|
||||
t( "ID selector with non-existant descendant", "#firstp #foobar", [] );
|
||||
t( "ID selector with non-existent descendant", "#firstp #foobar", [] );
|
||||
|
||||
t( "ID selector using UTF8", "#台北Táiběi", ["台北Táiběi"] );
|
||||
t( "Multiple ID selectors using UTF8", "#台北Táiběi, #台北", ["台北Táiběi","台北"] );
|
||||
@@ -686,7 +686,7 @@
|
||||
t( "All Children of ID", "#foo > *", ["sndp", "en", "sap"] );
|
||||
t( "All Children of ID with no children", "#firstUL > *", [] );
|
||||
|
||||
t( "ID selector with non-existant ancestor", "#asdfasdf #foobar", [] ); // bug #986
|
||||
t( "ID selector with non-existent ancestor", "#asdfasdf #foobar", [] ); // bug #986
|
||||
|
||||
//t( "body div#form", [], "ID selector within the context of another element" );
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ var testExpectedResults = { "font-src": true,
|
||||
};
|
||||
|
||||
// takes the name of the test, the URL that was tested, and whether the
|
||||
// load occured
|
||||
// load occurred
|
||||
var testResult = function(testName, url, result) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
log(" testName: "+testName+", result: "+result+", expected: "+testExpectedResults[testName]+"\n");
|
||||
|
||||
@@ -874,14 +874,6 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
|
||||
newEvent = dragEvent;
|
||||
break;
|
||||
}
|
||||
case NS_MENU_EVENT:
|
||||
{
|
||||
newEvent = new nsMenuEvent(PR_FALSE, msg, nsnull);
|
||||
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
static_cast<nsMenuEvent*>(newEvent)->mCommand =
|
||||
static_cast<nsMenuEvent*>(mEvent)->mCommand;
|
||||
break;
|
||||
}
|
||||
case NS_SCRIPT_ERROR_EVENT:
|
||||
{
|
||||
newEvent = new nsScriptErrorEvent(PR_FALSE, msg);
|
||||
|
||||
@@ -188,8 +188,7 @@ GetScrollableLineHeight(nsIFrame* aTargetFrame);
|
||||
static inline PRBool
|
||||
IsMouseEventReal(nsEvent* aEvent)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(aEvent->eventStructType == NS_MOUSE_EVENT,
|
||||
"Not a mouse event");
|
||||
NS_ABORT_IF_FALSE(NS_IS_MOUSE_EVENT_STRUCT(aEvent), "Not a mouse event");
|
||||
// Return true if not synthesized.
|
||||
return static_cast<nsMouseEvent*>(aEvent)->reason == nsMouseEvent::eReal;
|
||||
}
|
||||
@@ -1738,6 +1737,7 @@ nsEventStateManager::FireContextClick()
|
||||
PRInt32 type = formCtrl->GetType();
|
||||
|
||||
allowedToDispatch = (type == NS_FORM_INPUT_TEXT ||
|
||||
type == NS_FORM_INPUT_TEL ||
|
||||
type == NS_FORM_INPUT_PASSWORD ||
|
||||
type == NS_FORM_INPUT_FILE ||
|
||||
type == NS_FORM_TEXTAREA);
|
||||
@@ -2047,7 +2047,7 @@ nsEventStateManager::DetermineDragTarget(nsPresContext* aPresContext,
|
||||
if (NS_SUCCEEDED(dsti->GetItemType(&type)) &&
|
||||
type != nsIDocShellTreeItem::typeChrome) {
|
||||
// mGestureDownContent is the node where the mousedown event for the drag
|
||||
// occured, and aSelectionTarget is the node to use when a selection is used
|
||||
// occurred, and aSelectionTarget is the node to use when a selection is used
|
||||
nsresult rv =
|
||||
nsContentAreaDragDrop::GetDragData(window, mGestureDownContent,
|
||||
aSelectionTarget, mGestureDownAlt,
|
||||
|
||||
@@ -32,7 +32,7 @@ function runTests()
|
||||
|
||||
function afterDragTests()
|
||||
{
|
||||
// the dragstart should have occured due to moving the mouse. gDataTransfer
|
||||
// the dragstart should have occurred due to moving the mouse. gDataTransfer
|
||||
// caches the dataTransfer that was used, however it should now be empty and
|
||||
// be read only.
|
||||
ok(gDataTransfer instanceof DataTransfer, "DataTransfer after dragstart event");
|
||||
@@ -157,7 +157,7 @@ function test_DataTransfer(dt)
|
||||
|
||||
is(dt.mozUserCancelled, false, "userCancelled");
|
||||
|
||||
// because an exception occured, the data should not have been added
|
||||
// because an exception occurred, the data should not have been added
|
||||
is(dt.mozItemCount, 0, "empty setDataAt index too high itemCount");
|
||||
dt.getData("text/plain", "", "empty setDataAt index too high getData");
|
||||
|
||||
|
||||
@@ -58,15 +58,16 @@ class nsFormSubmission;
|
||||
#define NS_FORM_INPUT_PASSWORD 11
|
||||
#define NS_FORM_INPUT_RADIO 12
|
||||
#define NS_FORM_INPUT_SUBMIT 13
|
||||
#define NS_FORM_INPUT_TEXT 14
|
||||
#define NS_FORM_LABEL 15
|
||||
#define NS_FORM_OPTION 16
|
||||
#define NS_FORM_OPTGROUP 17
|
||||
#define NS_FORM_OUTPUT 18
|
||||
#define NS_FORM_LEGEND 19
|
||||
#define NS_FORM_SELECT 20
|
||||
#define NS_FORM_TEXTAREA 21
|
||||
#define NS_FORM_OBJECT 22
|
||||
#define NS_FORM_INPUT_TEL 14
|
||||
#define NS_FORM_INPUT_TEXT 15
|
||||
#define NS_FORM_LABEL 16
|
||||
#define NS_FORM_OPTION 17
|
||||
#define NS_FORM_OPTGROUP 18
|
||||
#define NS_FORM_OUTPUT 19
|
||||
#define NS_FORM_LEGEND 20
|
||||
#define NS_FORM_SELECT 21
|
||||
#define NS_FORM_TEXTAREA 22
|
||||
#define NS_FORM_OBJECT 23
|
||||
|
||||
#define NS_IFORMCONTROL_IID \
|
||||
{ 0x52dc1f0d, 0x1683, 0x4dd7, \
|
||||
@@ -158,6 +159,20 @@ public:
|
||||
* @return Whether this is a submit control.
|
||||
*/
|
||||
virtual PRBool IsSubmitControl() const = 0;
|
||||
|
||||
/**
|
||||
* Returns true if this is a control which has a text field.
|
||||
* @param aExcludePassword to have NS_FORM_INPUT_PASSWORD returning false.
|
||||
* @return Whether this is a text control.
|
||||
*/
|
||||
virtual PRBool IsTextControl(PRBool aExcludePassword) const = 0;
|
||||
|
||||
/**
|
||||
* Returns true if this is a control which has a single line text field.
|
||||
* @param aExcludePassword to have NS_FORM_INPUT_PASSWORD returning false.
|
||||
* @return Whether this is a single line text control.
|
||||
*/
|
||||
virtual PRBool IsSingleLineTextControl(PRBool aExcludePassword) const = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIFormControl, NS_IFORMCONTROL_IID)
|
||||
|
||||
@@ -808,12 +808,13 @@ nsGenericHTMLElement::GetSpellcheck(PRBool* aSpellcheck)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Is this anything other than a single-line plaintext input?
|
||||
// Is this anything other than an input text?
|
||||
// Other inputs are not spellchecked.
|
||||
if (controlType != NS_FORM_INPUT_TEXT) {
|
||||
return NS_OK; // Not spellchecked by default
|
||||
}
|
||||
|
||||
// Does the user want single-line inputs spellchecked by default?
|
||||
// Does the user want input text spellchecked by default?
|
||||
// NOTE: Do not reflect a pref value of 0 back to the DOM getter.
|
||||
// The web page should not know if the user has disabled spellchecking.
|
||||
// We'll catch this in the editor itself.
|
||||
@@ -1614,8 +1615,7 @@ nsGenericHTMLFormElement::UpdateEditableFormControlState()
|
||||
}
|
||||
|
||||
PRInt32 formType = GetType();
|
||||
if (formType != NS_FORM_INPUT_PASSWORD && formType != NS_FORM_INPUT_TEXT &&
|
||||
formType != NS_FORM_TEXTAREA) {
|
||||
if (!IsTextControl(PR_FALSE)) {
|
||||
SetEditableFlag(PR_FALSE);
|
||||
return;
|
||||
}
|
||||
@@ -2611,6 +2611,23 @@ nsGenericHTMLFormElement::IsSubmitControl() const
|
||||
type == NS_FORM_INPUT_IMAGE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsGenericHTMLFormElement::IsTextControl(PRBool aExcludePassword) const
|
||||
{
|
||||
PRInt32 type = GetType();
|
||||
return nsGenericHTMLFormElement::IsSingleLineTextControl(aExcludePassword) ||
|
||||
type == NS_FORM_TEXTAREA;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsGenericHTMLFormElement::IsSingleLineTextControl(PRBool aExcludePassword) const
|
||||
{
|
||||
PRInt32 type = GetType();
|
||||
return type == NS_FORM_INPUT_TEXT ||
|
||||
type == NS_FORM_INPUT_TEL ||
|
||||
(!aExcludePassword && type == NS_FORM_INPUT_PASSWORD);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsGenericHTMLFormElement::IntrinsicState() const
|
||||
{
|
||||
|
||||
@@ -789,6 +789,10 @@ public:
|
||||
|
||||
virtual PRBool IsSubmitControl() const;
|
||||
|
||||
PRBool IsTextControl(PRBool aExcludePassword) const;
|
||||
|
||||
PRBool IsSingleLineTextControl(PRBool aExcludePassword) const;
|
||||
|
||||
// nsIContent
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
|
||||
@@ -187,6 +187,7 @@ ShouldBeInElements(nsIFormControl* aFormControl)
|
||||
case NS_FORM_INPUT_RADIO :
|
||||
case NS_FORM_INPUT_SUBMIT :
|
||||
case NS_FORM_INPUT_TEXT :
|
||||
case NS_FORM_INPUT_TEL :
|
||||
case NS_FORM_SELECT :
|
||||
case NS_FORM_TEXTAREA :
|
||||
case NS_FORM_FIELDSET :
|
||||
@@ -1470,8 +1471,7 @@ nsHTMLFormElement::HasSingleTextControl() const
|
||||
PRUint32 numTextControlsFound = 0;
|
||||
PRUint32 length = mControls->mElements.Length();
|
||||
for (PRUint32 i = 0; i < length && numTextControlsFound < 2; ++i) {
|
||||
PRInt32 type = mControls->mElements[i]->GetType();
|
||||
if (type == NS_FORM_INPUT_TEXT || type == NS_FORM_INPUT_PASSWORD) {
|
||||
if (mControls->mElements[i]->IsSingleLineTextControl(PR_FALSE)) {
|
||||
numTextControlsFound++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ public:
|
||||
nsresult RemoveElement(nsGenericHTMLFormElement* aElement, PRBool aNotify);
|
||||
|
||||
/**
|
||||
* Remove an element from the lookup table mainted by the form.
|
||||
* Remove an element from the lookup table maintained by the form.
|
||||
* We can't fold this method into RemoveElement() because when
|
||||
* RemoveElement() is called it doesn't know if the element is
|
||||
* removed because the id attribute has changed, or bacause the
|
||||
@@ -210,7 +210,7 @@ public:
|
||||
nsresult AddElement(nsGenericHTMLFormElement* aElement, PRBool aNotify);
|
||||
|
||||
/**
|
||||
* Add an element to the lookup table mainted by the form.
|
||||
* Add an element to the lookup table maintained by the form.
|
||||
*
|
||||
* We can't fold this method into AddElement() because when
|
||||
* AddElement() is called, the form control has no
|
||||
|
||||
@@ -163,12 +163,13 @@ static const nsAttrValue::EnumTable kInputTypeTable[] = {
|
||||
{ "password", NS_FORM_INPUT_PASSWORD },
|
||||
{ "radio", NS_FORM_INPUT_RADIO },
|
||||
{ "submit", NS_FORM_INPUT_SUBMIT },
|
||||
{ "tel", NS_FORM_INPUT_TEL },
|
||||
{ "text", NS_FORM_INPUT_TEXT },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
// Default type is 'text'.
|
||||
static const nsAttrValue::EnumTable* kInputDefaultType = &kInputTypeTable[9];
|
||||
static const nsAttrValue::EnumTable* kInputDefaultType = &kInputTypeTable[10];
|
||||
|
||||
#define NS_INPUT_ELEMENT_STATE_IID \
|
||||
{ /* dc3b3d14-23e2-4479-b513-7b369343e3a0 */ \
|
||||
@@ -562,6 +563,7 @@ nsHTMLInputElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
|
||||
switch (mType) {
|
||||
case NS_FORM_INPUT_TEXT:
|
||||
case NS_FORM_INPUT_PASSWORD:
|
||||
case NS_FORM_INPUT_TEL:
|
||||
if (GET_BOOLBIT(mBitField, BF_VALUE_CHANGED)) {
|
||||
// We don't have our default value anymore. Set our value on
|
||||
// the clone.
|
||||
@@ -661,6 +663,7 @@ nsHTMLInputElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
!GET_BOOLBIT(mBitField, BF_VALUE_CHANGED) &&
|
||||
(mType == NS_FORM_INPUT_TEXT ||
|
||||
mType == NS_FORM_INPUT_PASSWORD ||
|
||||
mType == NS_FORM_INPUT_TEL ||
|
||||
mType == NS_FORM_INPUT_FILE)) {
|
||||
Reset();
|
||||
}
|
||||
@@ -696,11 +699,12 @@ nsHTMLInputElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
mType = kInputDefaultType->value;
|
||||
}
|
||||
|
||||
// If we are changing type from File/Text/Passwd to other input types
|
||||
// we need save the mValue into value attribute
|
||||
// If we are changing type from File/Text/Tel/Passwd
|
||||
// to other input types we need save the mValue into value attribute
|
||||
if (mValue &&
|
||||
mType != NS_FORM_INPUT_TEXT &&
|
||||
mType != NS_FORM_INPUT_PASSWORD &&
|
||||
mType != NS_FORM_INPUT_TEL &&
|
||||
mType != NS_FORM_INPUT_FILE) {
|
||||
SetAttr(kNameSpaceID_None, nsGkAtoms::value,
|
||||
NS_ConvertUTF8toUTF16(mValue), PR_FALSE);
|
||||
@@ -745,10 +749,10 @@ nsHTMLInputElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
}
|
||||
}
|
||||
|
||||
// If readonly is changed for text and password we need to handle
|
||||
// If readonly is changed for single line text controls, we need to handle
|
||||
// :read-only / :read-write
|
||||
if (aNotify && aName == nsGkAtoms::readonly &&
|
||||
(mType == NS_FORM_INPUT_TEXT || mType == NS_FORM_INPUT_PASSWORD)) {
|
||||
IsSingleLineTextControl(PR_FALSE)) {
|
||||
UpdateEditableState();
|
||||
|
||||
nsIDocument* document = GetCurrentDoc();
|
||||
@@ -875,7 +879,7 @@ nsHTMLInputElement::SetSize(PRUint32 aValue)
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInputElement::GetValue(nsAString& aValue)
|
||||
{
|
||||
if (mType == NS_FORM_INPUT_TEXT || mType == NS_FORM_INPUT_PASSWORD) {
|
||||
if (IsSingleLineTextControl(PR_FALSE)) {
|
||||
// No need to flush here, if there's no frame created for this
|
||||
// input yet, there won't be a value in it (that we don't already
|
||||
// have) even if we force it to be created
|
||||
@@ -1012,6 +1016,14 @@ nsHTMLInputElement::MozSetFileNameArray(const PRUnichar **aFileNames, PRUint32 a
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInputElement::MozIsTextField(PRBool aExcludePassword, PRBool* aResult)
|
||||
{
|
||||
*aResult = IsSingleLineTextControl(aExcludePassword);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInputElement::SetUserInput(const nsAString& aValue)
|
||||
{
|
||||
@@ -1142,8 +1154,7 @@ nsHTMLInputElement::SetValueInternal(const nsAString& aValue,
|
||||
NS_PRECONDITION(mType != NS_FORM_INPUT_FILE,
|
||||
"Don't call SetValueInternal for file inputs");
|
||||
|
||||
if (mType == NS_FORM_INPUT_TEXT || mType == NS_FORM_INPUT_PASSWORD) {
|
||||
|
||||
if (IsSingleLineTextControl(PR_FALSE)) {
|
||||
nsIFormControlFrame* formControlFrame = aFrame;
|
||||
if (!formControlFrame) {
|
||||
// No need to flush here, if there's no frame at this point we
|
||||
@@ -1477,7 +1488,7 @@ nsHTMLInputElement::Focus()
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInputElement::Select()
|
||||
{
|
||||
if (mType != NS_FORM_INPUT_PASSWORD && mType != NS_FORM_INPUT_TEXT) {
|
||||
if (!IsSingleLineTextControl(PR_FALSE)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1766,7 +1777,7 @@ nsHTMLInputElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
if (aVisitor.mEvent->flags & NS_EVENT_FLAG_NO_CONTENT_DISPATCH) {
|
||||
aVisitor.mItemFlags |= NS_NO_CONTENT_DISPATCH;
|
||||
}
|
||||
if ((mType == NS_FORM_INPUT_TEXT || mType == NS_FORM_INPUT_PASSWORD) &&
|
||||
if (IsSingleLineTextControl(PR_FALSE) &&
|
||||
aVisitor.mEvent->message == NS_MOUSE_CLICK &&
|
||||
aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT &&
|
||||
static_cast<nsMouseEvent*>(aVisitor.mEvent)->button ==
|
||||
@@ -1846,7 +1857,7 @@ nsHTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
// the click event handling, and allow cancellation of DOMActivate to cancel
|
||||
// the click.
|
||||
if (aVisitor.mEventStatus != nsEventStatus_eConsumeNoDefault &&
|
||||
mType != NS_FORM_INPUT_TEXT &&
|
||||
!IsSingleLineTextControl(PR_TRUE) &&
|
||||
NS_IS_MOUSE_LEFT_CLICK(aVisitor.mEvent)) {
|
||||
nsUIEvent actEvent(NS_IS_TRUSTED_EVENT(aVisitor.mEvent), NS_UI_ACTIVATE, 1);
|
||||
|
||||
@@ -1937,7 +1948,7 @@ nsHTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
// keyboard or a navigation, the platform allows it, and it wasn't
|
||||
// just because we raised a window.
|
||||
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
if (fm && (mType == NS_FORM_INPUT_TEXT || mType == NS_FORM_INPUT_PASSWORD) &&
|
||||
if (fm && IsSingleLineTextControl(PR_FALSE) &&
|
||||
!(static_cast<nsFocusEvent *>(aVisitor.mEvent))->fromRaise &&
|
||||
SelectTextFieldOnFocus()) {
|
||||
nsIDocument* document = GetCurrentDoc();
|
||||
@@ -2054,6 +2065,7 @@ nsHTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
keyEvent->keyCode == NS_VK_ENTER) &&
|
||||
(mType == NS_FORM_INPUT_TEXT ||
|
||||
mType == NS_FORM_INPUT_PASSWORD ||
|
||||
mType == NS_FORM_INPUT_TEL ||
|
||||
mType == NS_FORM_INPUT_FILE)) {
|
||||
|
||||
PRBool isButton = PR_FALSE;
|
||||
@@ -2329,8 +2341,7 @@ nsHTMLInputElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||
} else if (aAttribute == nsGkAtoms::value) {
|
||||
NS_UpdateHint(retval, NS_STYLE_HINT_REFLOW);
|
||||
} else if (aAttribute == nsGkAtoms::size &&
|
||||
(mType == NS_FORM_INPUT_TEXT ||
|
||||
mType == NS_FORM_INPUT_PASSWORD)) {
|
||||
IsSingleLineTextControl(PR_FALSE)) {
|
||||
NS_UpdateHint(retval, NS_STYLE_HINT_REFLOW);
|
||||
}
|
||||
return retval;
|
||||
@@ -2370,7 +2381,7 @@ nsHTMLInputElement::GetControllers(nsIControllers** aResult)
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
//XXX: what about type "file"?
|
||||
if (mType == NS_FORM_INPUT_TEXT || mType == NS_FORM_INPUT_PASSWORD)
|
||||
if (IsSingleLineTextControl(PR_FALSE))
|
||||
{
|
||||
if (!mControllers)
|
||||
{
|
||||
@@ -2565,6 +2576,7 @@ nsHTMLInputElement::Reset()
|
||||
}
|
||||
case NS_FORM_INPUT_PASSWORD:
|
||||
case NS_FORM_INPUT_TEXT:
|
||||
case NS_FORM_INPUT_TEL:
|
||||
{
|
||||
// If the frame is there, we have to set the value so that it will show
|
||||
// up.
|
||||
@@ -2702,7 +2714,7 @@ nsHTMLInputElement::SubmitNamesValues(nsFormSubmission* aFormSubmission,
|
||||
rv = aFormSubmission->AddNameValuePair(name,
|
||||
NS_ConvertASCIItoUTF16(charset));
|
||||
}
|
||||
else if (mType == NS_FORM_INPUT_TEXT &&
|
||||
else if (IsSingleLineTextControl(PR_TRUE) &&
|
||||
name.EqualsLiteral("isindex") &&
|
||||
aFormSubmission->SupportsIsindexSubmission()) {
|
||||
rv = aFormSubmission->AddIsindex(value);
|
||||
@@ -2747,6 +2759,7 @@ nsHTMLInputElement::SaveState()
|
||||
case NS_FORM_INPUT_PASSWORD:
|
||||
break;
|
||||
case NS_FORM_INPUT_TEXT:
|
||||
case NS_FORM_INPUT_TEL:
|
||||
case NS_FORM_INPUT_HIDDEN:
|
||||
{
|
||||
if (GET_BOOLBIT(mBitField, BF_VALUE_CHANGED)) {
|
||||
@@ -2880,6 +2893,7 @@ nsHTMLInputElement::RestoreState(nsPresState* aState)
|
||||
}
|
||||
|
||||
case NS_FORM_INPUT_TEXT:
|
||||
case NS_FORM_INPUT_TEL:
|
||||
case NS_FORM_INPUT_HIDDEN:
|
||||
{
|
||||
SetValueInternal(inputState->GetValue(), nsnull, PR_FALSE);
|
||||
@@ -3031,7 +3045,7 @@ nsHTMLInputElement::IsHTMLFocusable(PRBool *aIsFocusable, PRInt32 *aTabIndex)
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
if (mType == NS_FORM_INPUT_TEXT || mType == NS_FORM_INPUT_PASSWORD) {
|
||||
if (IsSingleLineTextControl(PR_FALSE)) {
|
||||
*aIsFocusable = PR_TRUE;
|
||||
return PR_FALSE;
|
||||
}
|
||||
@@ -3059,7 +3073,7 @@ nsHTMLInputElement::IsHTMLFocusable(PRBool *aIsFocusable, PRInt32 *aTabIndex)
|
||||
}
|
||||
|
||||
// We need to set tabindex to -1 if we're not tabbable
|
||||
if (mType != NS_FORM_INPUT_TEXT && mType != NS_FORM_INPUT_PASSWORD &&
|
||||
if (!IsSingleLineTextControl(PR_FALSE) &&
|
||||
!(sTabFocusModel & eTabFocus_formElementsMask)) {
|
||||
*aTabIndex = -1;
|
||||
}
|
||||
|
||||
@@ -106,6 +106,13 @@ public:
|
||||
PRBool aNotify);
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Get the fieldset content element that contains this legend.
|
||||
* Returns null if there is no fieldset containing this legend.
|
||||
*/
|
||||
nsIContent* GetFieldSet();
|
||||
};
|
||||
|
||||
|
||||
@@ -145,7 +152,11 @@ NS_IMPL_ELEMENT_CLONE(nsHTMLLegendElement)
|
||||
NS_IMETHODIMP
|
||||
nsHTMLLegendElement::GetForm(nsIDOMHTMLFormElement** aForm)
|
||||
{
|
||||
return nsGenericHTMLFormElement::GetForm(aForm);
|
||||
*aForm = nsnull;
|
||||
|
||||
nsCOMPtr<nsIFormControl> fieldsetControl = do_QueryInterface(GetFieldSet());
|
||||
|
||||
return fieldsetControl ? fieldsetControl->GetForm(aForm) : NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -162,6 +173,18 @@ static const nsAttrValue::EnumTable kAlignTable[] = {
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
nsIContent*
|
||||
nsHTMLLegendElement::GetFieldSet()
|
||||
{
|
||||
nsIContent* parent = GetParent();
|
||||
|
||||
if (parent && parent->IsHTML() && parent->Tag() == nsGkAtoms::fieldset) {
|
||||
return parent;
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHTMLLegendElement::ParseAttribute(PRInt32 aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
|
||||
@@ -739,7 +739,7 @@ nsresult nsHTMLMediaElement::LoadResource(nsIURI* aURI)
|
||||
}
|
||||
|
||||
// Else the channel must be open and starting to download. If it encounters
|
||||
// a non-catestrophic failure, it will set a new task to continue loading
|
||||
// a non-catastrophic failure, it will set a new task to continue loading
|
||||
// another candidate.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -60,6 +60,9 @@ _TEST_FILES = test_bug589.html \
|
||||
bug100533_load.html \
|
||||
bug100533_iframe.html \
|
||||
test_bug100533.html \
|
||||
image.png \
|
||||
test_bug109445.html \
|
||||
test_bug109445.xhtml \
|
||||
test_bug143220.html \
|
||||
test_bug237071.html \
|
||||
bug242709_iframe.html \
|
||||
@@ -162,6 +165,8 @@ _TEST_FILES = test_bug589.html \
|
||||
test_bug559284.html \
|
||||
test_bug551670.html \
|
||||
test_bug346485.html \
|
||||
test_bug555567.html \
|
||||
test_bug557620.html \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
|
||||
BIN
content/html/content/test/image.png
Normal file
BIN
content/html/content/test/image.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 268 B |
56
content/html/content/test/test_bug109445.html
Normal file
56
content/html/content/test/test_bug109445.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=109445
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 109445</title>
|
||||
<script src="/MochiKit/packed.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=109445">Mozilla Bug 109445</a>
|
||||
<p id="display">
|
||||
<map name=a>
|
||||
<area shape=rect coords=25,25,75,75 href=#x>
|
||||
</map>
|
||||
<map id=b>
|
||||
<area shape=rect coords=25,25,75,75 href=#y>
|
||||
</map>
|
||||
<map name=a>
|
||||
<area shape=rect coords=25,25,75,75 href=#FAIL>
|
||||
</map>
|
||||
<map id=b>
|
||||
<area shape=rect coords=25,25,75,75 href=#FAIL>
|
||||
</map>
|
||||
|
||||
<img usemap=#a src=image.png>
|
||||
<img usemap=#b src=image.png>
|
||||
</p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 109445 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
var images = document.getElementsByTagName("img");
|
||||
var second = false;
|
||||
onhashchange = function() {
|
||||
if (!second) {
|
||||
second = true;
|
||||
is(location.hash, "#x", "First map");
|
||||
SimpleTest.waitForFocus(function() synthesizeMouse(images[1], 50, 50, {}));
|
||||
} else {
|
||||
is(location.hash, "#y", "Second map");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
};
|
||||
SimpleTest.waitForFocus(function() synthesizeMouse(images[0], 50, 50, {}));
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
56
content/html/content/test/test_bug109445.xhtml
Normal file
56
content/html/content/test/test_bug109445.xhtml
Normal file
@@ -0,0 +1,56 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=109445
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 109445</title>
|
||||
<script src="/MochiKit/packed.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=109445">Mozilla Bug 109445</a>
|
||||
<p id="display">
|
||||
<map name="a">
|
||||
<area shape="rect" coords="25,25,75,75" href="#x"/>
|
||||
</map>
|
||||
<map id="b">
|
||||
<area shape="rect" coords="25,25,75,75" href="#y"/>
|
||||
</map>
|
||||
<map name="a">
|
||||
<area shape="rect" coords="25,25,75,75" href="#FAIL"/>
|
||||
</map>
|
||||
<map id="b">
|
||||
<area shape="rect" coords="25,25,75,75" href="#FAIL"/>
|
||||
</map>
|
||||
|
||||
<img usemap="#a" src="image.png"/>
|
||||
<img usemap="#b" src="image.png"/>
|
||||
</p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 109445 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
var images = document.getElementsByTagName("img");
|
||||
var second = false;
|
||||
onhashchange = function() {
|
||||
if (!second) {
|
||||
second = true;
|
||||
is(location.hash, "#x", "First map");
|
||||
SimpleTest.waitForFocus(function() synthesizeMouse(images[1], 50, 50, {}));
|
||||
} else {
|
||||
is(location.hash, "#y", "Second map");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
};
|
||||
SimpleTest.waitForFocus(function() synthesizeMouse(images[0], 50, 50, {}));
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -91,6 +91,7 @@ checkType(document.getElementById('i1'), document.getElementById('i2'), 'text',
|
||||
checkType(document.getElementById('i1'), document.getElementById('i2'), 'text', 'password', wrongType);
|
||||
checkType(document.getElementById('i1'), document.getElementById('i2'), 'text', 'radio', wrongType);
|
||||
checkType(document.getElementById('i1'), document.getElementById('i2'), 'text', 'submit', wrongType);
|
||||
checkType(document.getElementById('i1'), document.getElementById('i2'), 'text', 'tel', wrongType);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
||||
50
content/html/content/test/test_bug555567.html
Normal file
50
content/html/content/test/test_bug555567.html
Normal file
@@ -0,0 +1,50 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=555567
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 555567</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=555567">Mozilla Bug 555567</a>
|
||||
<div id='content' style="display: none">
|
||||
<form>
|
||||
<fieldset>
|
||||
<legend id="a"></legend>
|
||||
</fieldset>
|
||||
<legend id="b"></legend>
|
||||
</form>
|
||||
<legend id="c"></legend>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<p id="display"></p>
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 555567 **/
|
||||
|
||||
// This test works only with html5 parser.
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
|
||||
if (prefs.getBoolPref("html5.enable")) {
|
||||
var a = document.getElementById('a');
|
||||
var b = document.getElementById('b');
|
||||
var c = document.getElementById('c');
|
||||
|
||||
isnot(a.form, null,
|
||||
"First legend element should have a not null form IDL attribute");
|
||||
is(b.form, null,
|
||||
"Second legend element should have a null form IDL attribute");
|
||||
is(c.form, null,
|
||||
"Third legend element should have a null form IDL attribute");
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
33
content/html/content/test/test_bug557620.html
Normal file
33
content/html/content/test/test_bug557620.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=557620
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 557620</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=557620">Mozilla Bug 557620</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<input type="tel" id='i'>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 557620 **/
|
||||
|
||||
// More checks are done in test_bug551670.html.
|
||||
|
||||
var tel = document.getElementById('i');
|
||||
is(tel.type, 'tel', "input with type='tel' should return 'tel'");
|
||||
|
||||
ok(tel.mozIsTextField, "tel input type is a text field");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1204,17 +1204,18 @@ nsHTMLDocument::GetImageMap(const nsAString& aMapName)
|
||||
PRBool match;
|
||||
nsresult rv;
|
||||
|
||||
if (!IsHTML()) {
|
||||
rv = map->GetId(name);
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
||||
match = name.Equals(aMapName);
|
||||
} else {
|
||||
if (!match) {
|
||||
rv = map->GetName(name);
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
||||
match = name.Equals(aMapName, nsCaseInsensitiveStringComparator());
|
||||
}
|
||||
|
||||
if (match && NS_SUCCEEDED(rv)) {
|
||||
if (match) {
|
||||
// Quirk: if the first matching map is empty, remember it, but keep
|
||||
// searching for a non-empty one, only use it if none was found (bug 264624).
|
||||
if (mCompatMode == eCompatibility_NavQuirks) {
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
* Contributor(s):
|
||||
* Vlad Sukhoy <vladimir.sukhoy@gmail.com> (original developer)
|
||||
* Daniel Kraft <d@domob.eu> (nsMathMLElement patch, attachment 262925)
|
||||
* Frederic Wang <fred.wang@free.fr>
|
||||
*
|
||||
* 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
|
||||
@@ -122,9 +123,7 @@ nsMathMLElement::ParseAttribute(PRInt32 aNamespaceID,
|
||||
static nsGenericElement::MappedAttributeEntry sTokenStyles[] = {
|
||||
{ &nsGkAtoms::mathsize_ },
|
||||
{ &nsGkAtoms::fontsize_ },
|
||||
{ &nsGkAtoms::mathcolor_ },
|
||||
{ &nsGkAtoms::color },
|
||||
{ &nsGkAtoms::mathbackground_ },
|
||||
{ &nsGkAtoms::fontfamily_ },
|
||||
{ nsnull }
|
||||
};
|
||||
@@ -137,27 +136,67 @@ static nsGenericElement::MappedAttributeEntry sEnvironmentStyles[] = {
|
||||
{ nsnull }
|
||||
};
|
||||
|
||||
static nsGenericElement::MappedAttributeEntry sCommonPresStyles[] = {
|
||||
{ &nsGkAtoms::mathcolor_ },
|
||||
{ &nsGkAtoms::mathbackground_ },
|
||||
{ nsnull }
|
||||
};
|
||||
|
||||
PRBool
|
||||
nsMathMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
{
|
||||
static const MappedAttributeEntry* const tokenMap[] = {
|
||||
sTokenStyles
|
||||
sTokenStyles,
|
||||
sCommonPresStyles
|
||||
};
|
||||
static const MappedAttributeEntry* const mstyleMap[] = {
|
||||
sTokenStyles,
|
||||
sEnvironmentStyles
|
||||
sEnvironmentStyles,
|
||||
sCommonPresStyles
|
||||
};
|
||||
static const MappedAttributeEntry* const commonPresMap[] = {
|
||||
sCommonPresStyles
|
||||
};
|
||||
|
||||
// We don't support mglyph (yet).
|
||||
nsIAtom* tag = Tag();
|
||||
if (tag == nsGkAtoms::ms_ || tag == nsGkAtoms::mi_ ||
|
||||
tag == nsGkAtoms::mn_ || tag == nsGkAtoms::mo_ ||
|
||||
tag == nsGkAtoms::mtext_)
|
||||
tag == nsGkAtoms::mtext_ || tag == nsGkAtoms::mspace_)
|
||||
return FindAttributeDependence(aAttribute, tokenMap,
|
||||
NS_ARRAY_LENGTH(tokenMap));
|
||||
if (tag == nsGkAtoms::mstyle_)
|
||||
return FindAttributeDependence(aAttribute, mstyleMap,
|
||||
NS_ARRAY_LENGTH(mstyleMap));
|
||||
|
||||
if (tag == nsGkAtoms::maction_ ||
|
||||
tag == nsGkAtoms::maligngroup_ ||
|
||||
tag == nsGkAtoms::malignmark_ ||
|
||||
tag == nsGkAtoms::math ||
|
||||
tag == nsGkAtoms::menclose_ ||
|
||||
tag == nsGkAtoms::merror_ ||
|
||||
tag == nsGkAtoms::mfenced_ ||
|
||||
tag == nsGkAtoms::mfrac_ ||
|
||||
tag == nsGkAtoms::mover_ ||
|
||||
tag == nsGkAtoms::mpadded_ ||
|
||||
tag == nsGkAtoms::mphantom_ ||
|
||||
tag == nsGkAtoms::mprescripts_ ||
|
||||
tag == nsGkAtoms::mroot_ ||
|
||||
tag == nsGkAtoms::mrow_ ||
|
||||
tag == nsGkAtoms::msqrt_ ||
|
||||
tag == nsGkAtoms::msub_ ||
|
||||
tag == nsGkAtoms::msubsup_ ||
|
||||
tag == nsGkAtoms::msup_ ||
|
||||
tag == nsGkAtoms::mtable_ ||
|
||||
tag == nsGkAtoms::mtd_ ||
|
||||
tag == nsGkAtoms::mtr_ ||
|
||||
tag == nsGkAtoms::munder_ ||
|
||||
tag == nsGkAtoms::munderover_ ||
|
||||
tag == nsGkAtoms::none) {
|
||||
return FindAttributeDependence(aAttribute, commonPresMap,
|
||||
NS_ARRAY_LENGTH(commonPresMap));
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,10 @@ extern PRLogModuleInfo* gBuiltinDecoderLog;
|
||||
// less than LOW_VIDEO_FRAMES frames.
|
||||
static const PRUint32 LOW_AUDIO_MS = 100;
|
||||
|
||||
// If more than this many ms of decoded audio is queued, we'll hold off
|
||||
// decoding more audio.
|
||||
const unsigned AMPLE_AUDIO_MS = 2000;
|
||||
|
||||
// If we have fewer than LOW_VIDEO_FRAMES decoded frames, and
|
||||
// we're not "pumping video", we'll skip the video up to the next keyframe
|
||||
// which is at or after the current playback position.
|
||||
@@ -128,6 +132,20 @@ nsBuiltinDecoderStateMachine::~nsBuiltinDecoderStateMachine()
|
||||
MOZ_COUNT_DTOR(nsBuiltinDecoderStateMachine);
|
||||
}
|
||||
|
||||
PRBool nsBuiltinDecoderStateMachine::HasFutureAudio() const {
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
return HasAudio() &&
|
||||
!mAudioCompleted &&
|
||||
(mReader->mAudioQueue.GetSize() > 0 ||
|
||||
mAudioEndTime - mCurrentFrameTime + mStartTime > LOW_AUDIO_MS);
|
||||
}
|
||||
|
||||
PRBool nsBuiltinDecoderStateMachine::HaveNextFrameData() const {
|
||||
return ((!HasAudio() || mReader->mAudioQueue.AtEndOfStream()) &&
|
||||
mReader->mVideoQueue.GetSize() > 0) ||
|
||||
HasFutureAudio();
|
||||
}
|
||||
|
||||
void nsBuiltinDecoderStateMachine::DecodeLoop()
|
||||
{
|
||||
NS_ASSERTION(OnDecodeThread(), "Should be on decode thread.");
|
||||
@@ -164,10 +182,6 @@ void nsBuiltinDecoderStateMachine::DecodeLoop()
|
||||
// is falling behind.
|
||||
const unsigned audioPumpThresholdMs = 250;
|
||||
|
||||
// If more than this many ms of decoded audio is queued, we'll hold off
|
||||
// decoding more audio.
|
||||
const unsigned audioWaitThresholdMs = 2000;
|
||||
|
||||
// Main decode loop.
|
||||
while (videoPlaying || audioPlaying) {
|
||||
PRBool audioWait = !audioPlaying;
|
||||
@@ -206,23 +220,24 @@ void nsBuiltinDecoderStateMachine::DecodeLoop()
|
||||
skipToNextKeyframe = PR_TRUE;
|
||||
}
|
||||
|
||||
PRInt64 initialDownloadPosition = 0;
|
||||
PRInt64 currentTime = 0;
|
||||
{
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
initialDownloadPosition =
|
||||
mDecoder->GetCurrentStream()->GetCachedDataEnd(mDecoder->mDecoderPosition);
|
||||
currentTime = mCurrentFrameTime + mStartTime;
|
||||
}
|
||||
|
||||
// Determine how much audio data is decoded ahead of the current playback
|
||||
// position.
|
||||
int audioQueueSize = mReader->mAudioQueue.GetSize();
|
||||
PRInt64 audioDecoded = mReader->mAudioQueue.Duration();
|
||||
PRInt64 initialDownloadPosition = 0;
|
||||
PRInt64 currentTime = 0;
|
||||
PRInt64 audioDecoded = 0;
|
||||
{
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
currentTime = mCurrentFrameTime + mStartTime;
|
||||
audioDecoded = mReader->mAudioQueue.Duration() +
|
||||
mAudioEndTime - currentTime;
|
||||
initialDownloadPosition =
|
||||
mDecoder->GetCurrentStream()->GetCachedDataEnd(mDecoder->mDecoderPosition);
|
||||
}
|
||||
|
||||
// Don't decode any audio if the audio decode is way ahead, or if we're
|
||||
// skipping to the next video keyframe and the audio is marginally ahead.
|
||||
if (audioDecoded > audioWaitThresholdMs ||
|
||||
if (audioDecoded > AMPLE_AUDIO_MS ||
|
||||
(skipToNextKeyframe && audioDecoded > audioPumpThresholdMs)) {
|
||||
audioWait = PR_TRUE;
|
||||
}
|
||||
@@ -365,6 +380,7 @@ void nsBuiltinDecoderStateMachine::AudioLoop()
|
||||
LOG(PR_LOG_DEBUG, ("First audio sample has timestamp %lldms", mAudioStartTime));
|
||||
}
|
||||
|
||||
PRInt64 audioEndTime = -1;
|
||||
{
|
||||
MonitorAutoEnter audioMon(mAudioMonitor);
|
||||
if (mAudioStream) {
|
||||
@@ -379,7 +395,7 @@ void nsBuiltinDecoderStateMachine::AudioLoop()
|
||||
mAudioStream->Write(sound->mAudioData,
|
||||
sound->AudioDataLength(),
|
||||
PR_TRUE);
|
||||
mAudioEndTime = sound->mTime + sound->mDuration;
|
||||
audioEndTime = sound->mTime + sound->mDuration;
|
||||
mDecoder->UpdatePlaybackOffset(sound->mOffset);
|
||||
} else {
|
||||
mReader->mAudioQueue.PushFront(sound);
|
||||
@@ -389,7 +405,32 @@ void nsBuiltinDecoderStateMachine::AudioLoop()
|
||||
}
|
||||
sound = nsnull;
|
||||
|
||||
if (mReader->mAudioQueue.AtEndOfStream()) {
|
||||
{
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
if (audioEndTime != -1) {
|
||||
mAudioEndTime = audioEndTime;
|
||||
}
|
||||
PRInt64 audioAhead = mAudioEndTime - mCurrentFrameTime - mStartTime;
|
||||
if (audioAhead > AMPLE_AUDIO_MS) {
|
||||
// We've pushed enough audio onto the hardware that we've queued up a
|
||||
// significant amount ahead of the playback position. The decode
|
||||
// thread will be going to sleep, so we won't get any new samples
|
||||
// anyway, so sleep until we need to push to the hardware again.
|
||||
Wait(AMPLE_AUDIO_MS / 2);
|
||||
// Kick the decode thread; since above we only do a NotifyAll when
|
||||
// we pop an audio chunk of the queue, the decoder won't wake up if
|
||||
// we've got no more decoded chunks to push to the hardware. We can
|
||||
// hit this condition if the last sample in the stream doesn't have
|
||||
// it's EOS flag set, and the decode thread sleeps just after decoding
|
||||
// that packet, but before realising there's no more packets.
|
||||
mon.NotifyAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mReader->mAudioQueue.AtEndOfStream() &&
|
||||
mState != DECODER_STATE_SHUTDOWN &&
|
||||
!mStopDecodeThreads)
|
||||
{
|
||||
// Last sample pushed to audio hardware, wait for the audio to finish,
|
||||
// before the audio thread terminates.
|
||||
MonitorAutoEnter audioMon(mAudioMonitor);
|
||||
@@ -398,10 +439,13 @@ void nsBuiltinDecoderStateMachine::AudioLoop()
|
||||
}
|
||||
LOG(PR_LOG_DEBUG, ("%p Reached audio stream end.", mDecoder));
|
||||
}
|
||||
}
|
||||
{
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
mAudioCompleted = PR_TRUE;
|
||||
UpdateReadyState();
|
||||
// Kick the decode and state machine threads; they may be sleeping waiting
|
||||
// for this to finish.
|
||||
mDecoder->GetMonitor().NotifyAll();
|
||||
}
|
||||
LOG(PR_LOG_DEBUG, ("Audio stream finished playing, audio thread exit"));
|
||||
}
|
||||
@@ -939,13 +983,14 @@ nsresult nsBuiltinDecoderStateMachine::Run()
|
||||
continue;
|
||||
}
|
||||
|
||||
// Play the remaining media.
|
||||
while (mState == DECODER_STATE_COMPLETED &&
|
||||
(mReader->mVideoQueue.GetSize() > 0 ||
|
||||
(HasAudio() && !mAudioCompleted)))
|
||||
{
|
||||
// Play the remaining media. We want to run AdvanceFrame() at least
|
||||
// once to ensure the current playback position is advanced to the
|
||||
// end of the media, and so that we update the readyState.
|
||||
do {
|
||||
AdvanceFrame();
|
||||
}
|
||||
} while (mState == DECODER_STATE_COMPLETED &&
|
||||
(mReader->mVideoQueue.GetSize() > 0 ||
|
||||
(HasAudio() && !mAudioCompleted)));
|
||||
|
||||
if (mAudioStream) {
|
||||
// Close the audop stream so that next time audio is used a new stream
|
||||
|
||||
@@ -193,12 +193,7 @@ public:
|
||||
}
|
||||
|
||||
// Should be called by main thread.
|
||||
PRBool HaveNextFrameData() const {
|
||||
PRUint32 audioQueueSize = mReader->mAudioQueue.GetSize();
|
||||
return (mReader->mVideoQueue.GetSize() > 0 &&
|
||||
(!HasAudio() || audioQueueSize > 0)) ||
|
||||
audioQueueSize > 0;
|
||||
}
|
||||
PRBool HaveNextFrameData() const;
|
||||
|
||||
// Must be called with the decode monitor held.
|
||||
PRBool IsBuffering() const {
|
||||
@@ -240,6 +235,10 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
// Returns PR_TRUE when there's decoded audio waiting to play.
|
||||
// The decoder monitor must be held.
|
||||
PRBool HasFutureAudio() const;
|
||||
|
||||
// Waits on the decoder Monitor for aMs. If the decoder monitor is awoken
|
||||
// by a Notify() call, we'll continue waiting, unless we've moved into
|
||||
// shutdown state. This enables us to ensure that we wait for a specified
|
||||
|
||||
@@ -1003,7 +1003,7 @@ nsresult nsOggReader::Seek(PRInt64 aTarget, PRInt64 aStartTime, PRInt64 aEndTime
|
||||
// keyframe. It's usually faster to just download this extra data, rather
|
||||
// tham perform two bisections to find the seek target's keyframe. We
|
||||
// don't do this offsetting when seeking in a buffered ranges (above),
|
||||
// as the extra decoding causes a noticable speed hit when all the data
|
||||
// as the extra decoding causes a noticeable speed hit when all the data
|
||||
// is buffered.
|
||||
PRInt64 keyframeOffsetMs = 0;
|
||||
if (HasVideo() && mTheoraState) {
|
||||
|
||||
@@ -41,7 +41,7 @@ var gTests = [
|
||||
// Test 6
|
||||
url: "http://example.org:8000/tests/content/media/test/320x240.ogv",
|
||||
result: "error",
|
||||
description: "Won't load from differnet port on same domain"
|
||||
description: "Won't load from different port on same domain"
|
||||
},{
|
||||
// Test 7
|
||||
url: "http://example.org:8000/tests/content/media/test/320x240.allow-origin.ogv",
|
||||
|
||||
@@ -37,8 +37,9 @@ var gPlayTests = [
|
||||
// file with list chunk
|
||||
{ name:"r16000_u8_c1_list.wav", type:"audio/x-wav", duration:4.2 },
|
||||
|
||||
// Ogg stream with eof marker
|
||||
// Ogg stream without eof marker
|
||||
{ name:"bug461281.ogg", type:"application/ogg" },
|
||||
|
||||
// oggz-chop stream
|
||||
{ name:"bug482461.ogv", type:"video/ogg", duration:4.34 },
|
||||
// With first frame a "duplicate" (empty) frame.
|
||||
|
||||
@@ -316,7 +316,7 @@ nsXBLContentSink::HandleEndElement(const PRUnichar *aName)
|
||||
if (nameSpaceID == kNameSpaceID_XBL) {
|
||||
if (mState == eXBL_Error) {
|
||||
// Check whether we've opened this tag before; we may not have if
|
||||
// it was a real XBL tag before the error occured.
|
||||
// it was a real XBL tag before the error occurred.
|
||||
if (!GetCurrentContent()->NodeInfo()->Equals(localName,
|
||||
nameSpaceID)) {
|
||||
// OK, this tag was never opened as far as the XML sink is
|
||||
|
||||
@@ -55,7 +55,7 @@ typedef enum {
|
||||
eXBL_InResources, /* Inside a <resources> */
|
||||
eXBL_InImplementation, /* Inside a <implementation> */
|
||||
eXBL_InHandlers, /* Inside a <handlers> */
|
||||
eXBL_Error /* An error has occured. Suspend binding construction */
|
||||
eXBL_Error /* An error has occurred. Suspend binding construction */
|
||||
} XBLPrimaryState;
|
||||
|
||||
/*
|
||||
|
||||
@@ -1046,7 +1046,7 @@ nsXBLPrototypeBinding::GetRuleProcessor()
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsCOMArray<nsICSSStyleSheet>*
|
||||
nsXBLPrototypeResources::sheet_array_type*
|
||||
nsXBLPrototypeBinding::GetStyleSheets()
|
||||
{
|
||||
if (mResources) {
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
#include "nsXBLPrototypeResources.h"
|
||||
#include "nsXBLPrototypeHandler.h"
|
||||
#include "nsXBLProtoImplMethod.h"
|
||||
#include "nsICSSStyleSheet.h"
|
||||
#include "nsICSSLoaderObserver.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIContent.h"
|
||||
@@ -60,6 +59,7 @@ class nsIXBLService;
|
||||
class nsFixedSizeAllocator;
|
||||
class nsXBLProtoImplField;
|
||||
class nsXBLBinding;
|
||||
class nsCSSStyleSheet;
|
||||
|
||||
// *********************************************************************/
|
||||
// The XBLPrototypeBinding class
|
||||
@@ -149,12 +149,12 @@ public:
|
||||
void SetInitialAttributes(nsIContent* aBoundElement, nsIContent* aAnonymousContent);
|
||||
|
||||
nsIStyleRuleProcessor* GetRuleProcessor();
|
||||
nsCOMArray<nsICSSStyleSheet>* GetStyleSheets();
|
||||
nsXBLPrototypeResources::sheet_array_type* GetStyleSheets();
|
||||
|
||||
PRBool HasInsertionPoints() { return mInsertionPointTable != nsnull; }
|
||||
|
||||
PRBool HasStyleSheets() {
|
||||
return mResources && mResources->mStyleSheetList.Count() > 0;
|
||||
return mResources && mResources->mStyleSheetList.Length() > 0;
|
||||
}
|
||||
|
||||
nsresult FlushSkinSheets();
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsICSSStyleSheet.h"
|
||||
#include "nsIStyleRuleProcessor.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIContent.h"
|
||||
@@ -103,7 +102,7 @@ static PRBool IsChromeURI(nsIURI* aURI)
|
||||
nsresult
|
||||
nsXBLPrototypeResources::FlushSkinSheets()
|
||||
{
|
||||
if (mStyleSheetList.Count() == 0)
|
||||
if (mStyleSheetList.Length() == 0)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
@@ -115,18 +114,16 @@ nsXBLPrototypeResources::FlushSkinSheets()
|
||||
// they'll still be in the chrome cache.
|
||||
mRuleProcessor = nsnull;
|
||||
|
||||
nsCOMArray<nsICSSStyleSheet> oldSheets(mStyleSheetList);
|
||||
sheet_array_type oldSheets(mStyleSheetList);
|
||||
mStyleSheetList.Clear();
|
||||
|
||||
PRInt32 i;
|
||||
PRInt32 count = oldSheets.Count();
|
||||
for (i = 0; i < count; i++) {
|
||||
nsICSSStyleSheet* oldSheet = oldSheets[i];
|
||||
for (sheet_array_type::size_type i = 0, count = oldSheets.Length();
|
||||
i < count; ++i) {
|
||||
nsCSSStyleSheet* oldSheet = oldSheets[i];
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
oldSheet->GetSheetURI(getter_AddRefs(uri));
|
||||
nsCOMPtr<nsIURI> uri = oldSheet->GetSheetURI();
|
||||
|
||||
nsCOMPtr<nsICSSStyleSheet> newSheet;
|
||||
nsRefPtr<nsCSSStyleSheet> newSheet;
|
||||
if (IsChromeURI(uri)) {
|
||||
if (NS_FAILED(cssLoader->LoadSheetSync(uri, getter_AddRefs(newSheet))))
|
||||
continue;
|
||||
@@ -135,7 +132,7 @@ nsXBLPrototypeResources::FlushSkinSheets()
|
||||
newSheet = oldSheet;
|
||||
}
|
||||
|
||||
mStyleSheetList.AppendObject(newSheet);
|
||||
mStyleSheetList.AppendElement(newSheet);
|
||||
}
|
||||
mRuleProcessor = new nsCSSRuleProcessor(mStyleSheetList,
|
||||
nsStyleSet::eDocSheet);
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsICSSLoaderObserver.h"
|
||||
#include "nsIStyleRuleProcessor.h"
|
||||
#include "nsCOMArray.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsIAtom;
|
||||
@@ -51,7 +50,7 @@ class nsIScriptContext;
|
||||
class nsSupportsHashtable;
|
||||
class nsXBLResourceLoader;
|
||||
class nsXBLPrototypeBinding;
|
||||
class nsICSSStyleSheet;
|
||||
class nsCSSStyleSheet;
|
||||
|
||||
// *********************************************************************/
|
||||
// The XBLPrototypeResources class
|
||||
@@ -69,7 +68,8 @@ public:
|
||||
|
||||
// MEMBER VARIABLES
|
||||
nsXBLResourceLoader* mLoader; // A loader object. Exists only long enough to load resources, and then it dies.
|
||||
nsCOMArray<nsICSSStyleSheet> mStyleSheetList; // A list of loaded stylesheets for this binding.
|
||||
typedef nsTArray<nsRefPtr<nsCSSStyleSheet> > sheet_array_type;
|
||||
sheet_array_type mStyleSheetList; // A list of loaded stylesheets for this binding.
|
||||
|
||||
// The list of stylesheets converted to a rule processor.
|
||||
nsCOMPtr<nsIStyleRuleProcessor> mRuleProcessor;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsICSSStyleSheet.h"
|
||||
#include "nsCSSStyleSheet.h"
|
||||
#include "nsIStyleRuleProcessor.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIContent.h"
|
||||
@@ -153,7 +153,7 @@ nsXBLResourceLoader::LoadResources(PRBool* aResult)
|
||||
CheckLoadURIWithPrincipal(docPrincipal, url,
|
||||
nsIScriptSecurityManager::ALLOW_CHROME);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsICSSStyleSheet> sheet;
|
||||
nsRefPtr<nsCSSStyleSheet> sheet;
|
||||
rv = cssLoader->LoadSheetSync(url, getter_AddRefs(sheet));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Load failed!!!");
|
||||
if (NS_SUCCEEDED(rv))
|
||||
@@ -182,7 +182,7 @@ nsXBLResourceLoader::LoadResources(PRBool* aResult)
|
||||
|
||||
// nsICSSLoaderObserver
|
||||
NS_IMETHODIMP
|
||||
nsXBLResourceLoader::StyleSheetLoaded(nsICSSStyleSheet* aSheet,
|
||||
nsXBLResourceLoader::StyleSheetLoaded(nsCSSStyleSheet* aSheet,
|
||||
PRBool aWasAlternate,
|
||||
nsresult aStatus)
|
||||
{
|
||||
@@ -191,7 +191,7 @@ nsXBLResourceLoader::StyleSheetLoaded(nsICSSStyleSheet* aSheet,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mResources->mStyleSheetList.AppendObject(aSheet);
|
||||
mResources->mStyleSheetList.AppendElement(aSheet);
|
||||
|
||||
if (!mInLoadResourcesFunc)
|
||||
mPendingSheets--;
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsXBLResourceLoader)
|
||||
|
||||
// nsICSSLoaderObserver
|
||||
NS_IMETHOD StyleSheetLoaded(nsICSSStyleSheet* aSheet, PRBool aWasAlternate,
|
||||
NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet* aSheet, PRBool aWasAlternate,
|
||||
nsresult aStatus);
|
||||
|
||||
void LoadResources(PRBool* aResult);
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
#include "nsDOMDocumentType.h"
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsICSSStyleSheet.h"
|
||||
#include "nsCSSStyleSheet.h"
|
||||
#include "nsCSSLoader.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsContentUtils.h"
|
||||
@@ -462,7 +462,7 @@ nsXMLContentSink::OnTransformDone(nsresult aResult,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXMLContentSink::StyleSheetLoaded(nsICSSStyleSheet* aSheet,
|
||||
nsXMLContentSink::StyleSheetLoaded(nsCSSStyleSheet* aSheet,
|
||||
PRBool aWasAlternate,
|
||||
nsresult aStatus)
|
||||
{
|
||||
@@ -1257,7 +1257,7 @@ nsXMLContentSink::HandleDoctypeDecl(const nsAString & aSubset,
|
||||
// exit codes, error are not fatal here, just that the stylesheet won't apply
|
||||
nsCOMPtr<nsIURI> uri(do_QueryInterface(aCatalogData));
|
||||
if (uri) {
|
||||
nsCOMPtr<nsICSSStyleSheet> sheet;
|
||||
nsRefPtr<nsCSSStyleSheet> sheet;
|
||||
mCSSLoader->LoadSheetSync(uri, PR_TRUE, PR_TRUE, getter_AddRefs(sheet));
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
NS_IMETHOD OnTransformDone(nsresult aResult, nsIDocument *aResultDocument);
|
||||
|
||||
// nsICSSLoaderObserver
|
||||
NS_IMETHOD StyleSheetLoaded(nsICSSStyleSheet* aSheet, PRBool aWasAlternate,
|
||||
NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet* aSheet, PRBool aWasAlternate,
|
||||
nsresult aStatus);
|
||||
static PRBool ParsePIData(const nsString &aData, nsString &aHref,
|
||||
nsString &aTitle, nsString &aMedia,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user