mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge cvs-trunk-mirror -> mozilla-central
--HG-- rename : js/src/js.c => js/src/js.cpp rename : js/src/jsarray.c => js/src/jsarray.cpp rename : js/src/jsbool.c => js/src/jsbool.cpp rename : js/src/jsdate.c => js/src/jsdate.cpp rename : js/src/jsexn.c => js/src/jsexn.cpp rename : js/src/jsfun.c => js/src/jsfun.cpp rename : js/src/jsinterp.c => js/src/jsinterp.cpp rename : js/src/jsiter.c => js/src/jsiter.cpp rename : js/src/jsmath.c => js/src/jsmath.cpp rename : js/src/jsnum.c => js/src/jsnum.cpp rename : js/src/jsobj.c => js/src/jsobj.cpp rename : js/src/jsparse.c => js/src/jsparse.cpp rename : js/src/jsregexp.c => js/src/jsregexp.cpp rename : js/src/jsscript.c => js/src/jsscript.cpp rename : js/src/jsstr.c => js/src/jsstr.cpp rename : js/src/jsxml.c => js/src/jsxml.cpp rename : js/src/prmjtime.c => js/src/prmjtime.cpp
This commit is contained in:
commit
0553a0887d
@ -58,6 +58,7 @@ TIERS += base
|
||||
tier_base_dirs = \
|
||||
config \
|
||||
build \
|
||||
probes \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk
|
||||
|
@ -83,7 +83,6 @@ EXTRA_DSO_LIBS = \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(MOZ_FIX_LINK_PATHS) \
|
||||
$(LIBS_DIR) \
|
||||
$(EXTRA_DSO_LIBS) \
|
||||
$(MOZ_UNICHARUTIL_LIBS) \
|
||||
|
@ -56,7 +56,7 @@ interface nsIDOMDOMStringList;
|
||||
*
|
||||
* @status UNDER_REVIEW
|
||||
*/
|
||||
[scriptable, uuid(56c34b1a-d390-44f4-89c3-6935c0e4e3fa)]
|
||||
[scriptable, uuid(244e4c67-a1d3-44f2-9cab-cdaa31b68046)]
|
||||
interface nsIAccessibleRetrieval : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -165,6 +165,14 @@ interface nsIAccessibleRetrieval : nsISupports
|
||||
* @return - accessible event type presented as human readable string
|
||||
*/
|
||||
AString getStringEventType(in unsigned long aEventType);
|
||||
|
||||
/**
|
||||
* Get the type of accessible relation as a string.
|
||||
*
|
||||
* @param aRelationType - the accessible relation type constant
|
||||
* @return - accessible relation type presented as human readable string
|
||||
*/
|
||||
AString getStringRelationType(in unsigned long aRelationType);
|
||||
};
|
||||
|
||||
|
||||
|
@ -68,6 +68,7 @@ static const char sAccessibilityKey [] =
|
||||
static guint (* gail_add_global_event_listener) (GSignalEmissionHook listener,
|
||||
const gchar *event_type);
|
||||
static void (* gail_remove_global_event_listener) (guint remove_listener);
|
||||
static void (* gail_remove_key_event_listener) (guint remove_listener);
|
||||
static AtkObject * (*gail_get_root) (void);
|
||||
|
||||
/* maiutil */
|
||||
@ -230,6 +231,7 @@ mai_util_class_init(MaiUtilClass *klass)
|
||||
// save gail function pointer
|
||||
gail_add_global_event_listener = atk_class->add_global_event_listener;
|
||||
gail_remove_global_event_listener = atk_class->remove_global_event_listener;
|
||||
gail_remove_key_event_listener = atk_class->remove_key_event_listener;
|
||||
gail_get_root = atk_class->get_root;
|
||||
|
||||
atk_class->add_global_event_listener =
|
||||
@ -307,6 +309,12 @@ mai_util_remove_global_event_listener(guint remove_listener)
|
||||
}
|
||||
}
|
||||
else {
|
||||
// atk-bridge is initialized with gail (e.g. yelp)
|
||||
// try gail_remove_global_event_listener
|
||||
if (gail_remove_global_event_listener) {
|
||||
return gail_remove_global_event_listener(remove_listener);
|
||||
}
|
||||
|
||||
g_warning("No listener with the specified listener id %d",
|
||||
remove_listener);
|
||||
}
|
||||
@ -412,6 +420,12 @@ mai_util_add_key_event_listener (AtkKeySnoopFunc listener,
|
||||
static void
|
||||
mai_util_remove_key_event_listener (guint remove_listener)
|
||||
{
|
||||
if (!key_listener_list) {
|
||||
// atk-bridge is initialized with gail (e.g. yelp)
|
||||
// try gail_remove_key_event_listener
|
||||
return gail_remove_key_event_listener(remove_listener);
|
||||
}
|
||||
|
||||
g_hash_table_remove(key_listener_list, GUINT_TO_POINTER (remove_listener));
|
||||
if (g_hash_table_size(key_listener_list) == 0) {
|
||||
gtk_key_snooper_remove(key_snooper_id);
|
||||
|
@ -225,16 +225,18 @@ nsAccessNode::GetApplicationAccessible()
|
||||
if (!gApplicationAccessible)
|
||||
return nsnull;
|
||||
|
||||
// Addref on create. Will Release in ShutdownXPAccessibility()
|
||||
NS_ADDREF(gApplicationAccessible);
|
||||
|
||||
nsresult rv = gApplicationAccessible->Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(gApplicationAccessible);
|
||||
gApplicationAccessible = nsnull;
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
NS_ADDREF(gApplicationAccessible);
|
||||
NS_ADDREF(gApplicationAccessible); // Addref because we're a getter
|
||||
return gApplicationAccessible;
|
||||
}
|
||||
|
||||
@ -297,10 +299,13 @@ void nsAccessNode::ShutdownXPAccessibility()
|
||||
NS_IF_RELEASE(sAccService);
|
||||
|
||||
nsApplicationAccessibleWrap::Unload();
|
||||
NS_IF_RELEASE(gApplicationAccessible);
|
||||
|
||||
ClearCache(gGlobalDocAccessibleCache);
|
||||
|
||||
// Release gApplicationAccessible after everything else is shutdown
|
||||
// so we don't accidently create it again while tearing down root accessibles
|
||||
NS_IF_RELEASE(gApplicationAccessible);
|
||||
gApplicationAccessible = nsnull;
|
||||
|
||||
gIsAccessibilityActive = PR_FALSE;
|
||||
NotifyA11yInitOrShutdown();
|
||||
}
|
||||
|
@ -1056,6 +1056,21 @@ nsAccessibilityService::GetStringEventType(PRUint32 aEventType,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIAccessibleRetrieval::getStringRelationType()
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::GetStringRelationType(PRUint32 aRelationType,
|
||||
nsAString& aString)
|
||||
{
|
||||
if (aRelationType >= NS_ARRAY_LENGTH(kRelationTypeNames)) {
|
||||
aString.AssignLiteral("unknown");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
CopyUTF8toUTF16(kRelationTypeNames[aRelationType], aString);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* GetAccessibleFor - get an nsIAccessible from a DOM node
|
||||
*/
|
||||
|
@ -355,4 +355,29 @@ static const char kEventTypeNames[][40] = {
|
||||
"reorder" // EVENT_REORDER
|
||||
};
|
||||
|
||||
/**
|
||||
* Map nsIAccessibleRelation constants to strings. Used by
|
||||
* nsIAccessibleRetrieval::getStringRelationType() method.
|
||||
*/
|
||||
static const char kRelationTypeNames[][20] = {
|
||||
"unknown", // RELATION_NUL
|
||||
"controlled by", // RELATION_CONTROLLED_BY
|
||||
"controller for", // RELATION_CONTROLLER_FOR
|
||||
"label for", // RELATION_LABEL_FOR
|
||||
"labelled by", // RELATION_LABELLED_BY
|
||||
"member of", // RELATION_MEMBER_OF
|
||||
"node child of", // RELATION_NODE_CHILD_OF
|
||||
"flows to", // RELATION_FLOWS_TO
|
||||
"flows from", // RELATION_FLOWS_FROM
|
||||
"subwindow of", // RELATION_SUBWINDOW_OF
|
||||
"embeds", // RELATION_EMBEDS
|
||||
"embedded by", // RELATION_EMBEDDED_BY
|
||||
"popup for", // RELATION_POPUP_FOR
|
||||
"parent window of", // RELATION_PARENT_WINDOW_OF
|
||||
"described by", // RELATION_DESCRIBED_BY
|
||||
"description for", // RELATION_DESCRIPTION_FOR
|
||||
"default button" // RELATION_DEFAULT_BUTTON
|
||||
};
|
||||
|
||||
#endif /* __nsIAccessibilityService_h__ */
|
||||
|
||||
|
@ -1725,7 +1725,7 @@ nsresult nsAccessible::GetTextFromRelationID(EAriaProperty aIDProperty, nsString
|
||||
{
|
||||
// Get DHTML name from content subtree pointed to by ID attribute
|
||||
aName.Truncate();
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIContent> content = GetRoleContent(mDOMNode);
|
||||
NS_ASSERTION(content, "Called from shutdown accessible");
|
||||
|
||||
nsAutoString ids;
|
||||
@ -1734,8 +1734,7 @@ nsresult nsAccessible::GetTextFromRelationID(EAriaProperty aIDProperty, nsString
|
||||
}
|
||||
ids.CompressWhitespace(PR_TRUE, PR_TRUE);
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
mDOMNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(content->GetOwnerDoc());
|
||||
NS_ENSURE_TRUE(domDoc, NS_ERROR_FAILURE);
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
@ -2021,56 +2020,57 @@ nsAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
|
||||
|
||||
nsCOMPtr<nsIContent> content = GetRoleContent(mDOMNode);
|
||||
nsAutoString id;
|
||||
nsAutoString oldValueUnused;
|
||||
if (content && nsAccUtils::GetID(content, id)) {
|
||||
nsAutoString oldValueUnused;
|
||||
attributes->SetStringProperty(NS_LITERAL_CSTRING("id"), id, oldValueUnused);
|
||||
// XXX In the future we may need to expose the dynamic content role inheritance chain
|
||||
// through this attribute
|
||||
nsAutoString xmlRole;
|
||||
if (GetARIARole(content, xmlRole)) {
|
||||
attributes->SetStringProperty(NS_LITERAL_CSTRING("xml-roles"), xmlRole, oldValueUnused);
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure to keep these two arrays in sync
|
||||
PRUint32 ariaPropTypes = nsAccUtils::GetAriaPropTypes(content, mWeakShell);
|
||||
char *ariaPropertyString[] = { "live", "channel", "atomic", "relevant", "datatype", "level",
|
||||
"posinset", "setsize", "sort", "grab", "dropeffect"};
|
||||
EAriaProperty ariaPropertyEnum[] = { eAria_live, eAria_channel, eAria_atomic, eAria_relevant,
|
||||
eAria_datatype, eAria_level, eAria_posinset, eAria_setsize,
|
||||
eAria_sort, eAria_grab, eAria_dropeffect};
|
||||
NS_ASSERTION(NS_ARRAY_LENGTH(ariaPropertyString) == NS_ARRAY_LENGTH(ariaPropertyEnum),
|
||||
"ARIA attributes and object property name arrays out of sync");
|
||||
for (PRUint32 index = 0; index < NS_ARRAY_LENGTH(ariaPropertyString); index ++) {
|
||||
nsAutoString value;
|
||||
if (nsAccUtils::GetAriaProperty(content, mWeakShell, ariaPropertyEnum[index], value, ariaPropTypes)) {
|
||||
ToLowerCase(value);
|
||||
attributes->SetStringProperty(nsDependentCString(ariaPropertyString[index]), value, oldValueUnused);
|
||||
}
|
||||
}
|
||||
// XXX In the future we may need to expose the dynamic content role inheritance chain
|
||||
// through this attribute
|
||||
nsAutoString xmlRole;
|
||||
if (GetARIARole(content, xmlRole)) {
|
||||
attributes->SetStringProperty(NS_LITERAL_CSTRING("xml-roles"), xmlRole, oldValueUnused);
|
||||
}
|
||||
|
||||
// Get container-foo computed live region properties based on the closest container with
|
||||
// the live region attribute
|
||||
nsAutoString atomic, live, relevant, channel, busy;
|
||||
while (content) {
|
||||
if (relevant.IsEmpty() &&
|
||||
nsAccUtils::GetAriaProperty(content, mWeakShell, eAria_relevant, relevant, ariaPropTypes))
|
||||
attributes->SetStringProperty(NS_LITERAL_CSTRING("container-relevant"), relevant, oldValueUnused);
|
||||
if (live.IsEmpty() &&
|
||||
nsAccUtils::GetAriaProperty(content, mWeakShell, eAria_live, live, ariaPropTypes))
|
||||
attributes->SetStringProperty(NS_LITERAL_CSTRING("container-live"), live, oldValueUnused);
|
||||
if (channel.IsEmpty() &&
|
||||
nsAccUtils::GetAriaProperty(content, mWeakShell, eAria_channel, channel, ariaPropTypes))
|
||||
attributes->SetStringProperty(NS_LITERAL_CSTRING("container-channel"), channel, oldValueUnused);
|
||||
if (atomic.IsEmpty() &&
|
||||
nsAccUtils::GetAriaProperty(content, mWeakShell, eAria_atomic, atomic, ariaPropTypes))
|
||||
attributes->SetStringProperty(NS_LITERAL_CSTRING("container-atomic"), atomic, oldValueUnused);
|
||||
if (busy.IsEmpty() &&
|
||||
nsAccUtils::GetAriaProperty(content, mWeakShell, eAria_busy, busy, ariaPropTypes))
|
||||
attributes->SetStringProperty(NS_LITERAL_CSTRING("container-busy"), busy, oldValueUnused);
|
||||
content = content->GetParent();
|
||||
// Make sure to keep these two arrays in sync
|
||||
PRUint32 ariaPropTypes = nsAccUtils::GetAriaPropTypes(content, mWeakShell);
|
||||
char *ariaPropertyString[] = { "live", "channel", "atomic", "relevant", "datatype", "level",
|
||||
"posinset", "setsize", "sort", "grab", "dropeffect"};
|
||||
EAriaProperty ariaPropertyEnum[] = { eAria_live, eAria_channel, eAria_atomic, eAria_relevant,
|
||||
eAria_datatype, eAria_level, eAria_posinset, eAria_setsize,
|
||||
eAria_sort, eAria_grab, eAria_dropeffect};
|
||||
NS_ASSERTION(NS_ARRAY_LENGTH(ariaPropertyString) == NS_ARRAY_LENGTH(ariaPropertyEnum),
|
||||
"ARIA attributes and object property name arrays out of sync");
|
||||
for (PRUint32 index = 0; index < NS_ARRAY_LENGTH(ariaPropertyString); index ++) {
|
||||
nsAutoString value;
|
||||
if (nsAccUtils::GetAriaProperty(content, mWeakShell, ariaPropertyEnum[index], value, ariaPropTypes)) {
|
||||
ToLowerCase(value);
|
||||
attributes->SetStringProperty(nsDependentCString(ariaPropertyString[index]), value, oldValueUnused);
|
||||
}
|
||||
}
|
||||
|
||||
// Get container-foo computed live region properties based on the closest container with
|
||||
// the live region attribute
|
||||
nsAutoString atomic, live, relevant, channel, busy;
|
||||
while (content) {
|
||||
if (relevant.IsEmpty() &&
|
||||
nsAccUtils::GetAriaProperty(content, mWeakShell, eAria_relevant, relevant, ariaPropTypes))
|
||||
attributes->SetStringProperty(NS_LITERAL_CSTRING("container-relevant"), relevant, oldValueUnused);
|
||||
if (live.IsEmpty() &&
|
||||
nsAccUtils::GetAriaProperty(content, mWeakShell, eAria_live, live, ariaPropTypes))
|
||||
attributes->SetStringProperty(NS_LITERAL_CSTRING("container-live"), live, oldValueUnused);
|
||||
if (channel.IsEmpty() &&
|
||||
nsAccUtils::GetAriaProperty(content, mWeakShell, eAria_channel, channel, ariaPropTypes))
|
||||
attributes->SetStringProperty(NS_LITERAL_CSTRING("container-channel"), channel, oldValueUnused);
|
||||
if (atomic.IsEmpty() &&
|
||||
nsAccUtils::GetAriaProperty(content, mWeakShell, eAria_atomic, atomic, ariaPropTypes))
|
||||
attributes->SetStringProperty(NS_LITERAL_CSTRING("container-atomic"), atomic, oldValueUnused);
|
||||
if (busy.IsEmpty() &&
|
||||
nsAccUtils::GetAriaProperty(content, mWeakShell, eAria_busy, busy, ariaPropTypes))
|
||||
attributes->SetStringProperty(NS_LITERAL_CSTRING("container-busy"), busy, oldValueUnused);
|
||||
content = content->GetParent();
|
||||
}
|
||||
|
||||
if (!nsAccUtils::HasAccGroupAttrs(attributes)) {
|
||||
// The role of an accessible can be pointed by ARIA attribute but ARIA
|
||||
// posinset, level, setsize may be skipped. Therefore we calculate here
|
||||
|
@ -245,8 +245,8 @@ nsCaretAccessible::GetCaretRect(nsIWidget **aOutWidget)
|
||||
nsCOMPtr<nsIPresShell> presShell = mRootAccessible->GetPresShellFor(lastNodeWithCaret);
|
||||
NS_ENSURE_TRUE(presShell, caretRect);
|
||||
|
||||
nsICaret *caret;
|
||||
presShell->GetCaret(&caret);
|
||||
nsCOMPtr<nsICaret> caret;
|
||||
presShell->GetCaret(getter_AddRefs(caret));
|
||||
NS_ENSURE_TRUE(caret, caretRect);
|
||||
|
||||
PRBool isCollapsed;
|
||||
|
@ -224,7 +224,9 @@ NS_IMETHODIMP nsDocAccessible::GetValue(nsAString& aValue)
|
||||
NS_IMETHODIMP
|
||||
nsDocAccessible::GetDescription(nsAString& aDescription)
|
||||
{
|
||||
aDescription.Truncate();
|
||||
nsAutoString description;
|
||||
GetTextFromRelationID(eAria_describedby, description);
|
||||
aDescription = description;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -684,8 +686,9 @@ nsresult nsDocAccessible::AddEventListeners()
|
||||
nsCOMPtr<nsIDocShellTreeItem> rootTreeItem;
|
||||
docShellTreeItem->GetRootTreeItem(getter_AddRefs(rootTreeItem));
|
||||
if (rootTreeItem) {
|
||||
GetDocAccessibleFor(rootTreeItem, PR_TRUE); // Ensure root accessible is created;
|
||||
nsRefPtr<nsRootAccessible> rootAccessible = GetRootAccessible();
|
||||
nsCOMPtr<nsIAccessibleDocument> rootAccDoc =
|
||||
GetDocAccessibleFor(rootTreeItem, PR_TRUE); // Ensure root accessible is created;
|
||||
nsRefPtr<nsRootAccessible> rootAccessible = GetRootAccessible(); // Then get it as ref ptr
|
||||
NS_ENSURE_TRUE(rootAccessible, NS_ERROR_FAILURE);
|
||||
nsRefPtr<nsCaretAccessible> caretAccessible = rootAccessible->GetCaretAccessible();
|
||||
if (caretAccessible) {
|
||||
|
@ -917,15 +917,16 @@ nsRootAccessible::Init()
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::Shutdown()
|
||||
{
|
||||
// Called manually or by nsAccessNode::LastRelease()
|
||||
if (!mWeakShell) {
|
||||
return NS_OK; // Already shutdown
|
||||
}
|
||||
|
||||
nsRefPtr<nsApplicationAccessibleWrap> root = GetApplicationAccessible();
|
||||
NS_ENSURE_STATE(root);
|
||||
|
||||
root->RemoveRootAccessible(this);
|
||||
|
||||
// Called manually or by nsAccessNode::LastRelease()
|
||||
if (!mWeakShell) {
|
||||
return NS_OK; // Already shutdown
|
||||
}
|
||||
mCurrentARIAMenubar = nsnull;
|
||||
|
||||
if (mFireFocusTimer) {
|
||||
|
@ -1067,6 +1067,15 @@ nsHyperTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttribute
|
||||
nsAccUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::level,
|
||||
strHeadLevel);
|
||||
}
|
||||
|
||||
// Indicate when the current object uses block-level formatting
|
||||
// via formatting: block
|
||||
nsIFrame *frame = GetFrame();
|
||||
if (frame && frame->GetType() == nsAccessibilityAtoms::blockFrame) {
|
||||
nsAutoString oldValueUnused;
|
||||
aAttributes->SetStringProperty(NS_LITERAL_CSTRING("formatting"), NS_LITERAL_STRING("block"),
|
||||
oldValueUnused);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ config/Makefile
|
||||
config/autoconf.mk
|
||||
config/mkdepend/Makefile
|
||||
config/doxygen.cfg
|
||||
probes/Makefile
|
||||
extensions/Makefile
|
||||
"
|
||||
|
||||
|
@ -576,3 +576,6 @@ pref("browser.places.importBookmarksHTML", true);
|
||||
|
||||
// Show infobar on chromeless windows
|
||||
pref("browser.warn_chromeless_window.infobar", false);
|
||||
|
||||
// if false, will add the "Places" folder to the personal toolbar
|
||||
pref("browser.places.createdDefaultQueries", false);
|
||||
|
@ -75,14 +75,12 @@ var ContentPrefSink = {
|
||||
// Initialization & Destruction
|
||||
|
||||
init: function ContentPrefSink_init() {
|
||||
gBrowser.addProgressListener(this, Ci.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
|
||||
gBrowser.addEventListener("DOMContentLoaded", this, false);
|
||||
// XXX Should we also listen for pageshow and/or load?
|
||||
},
|
||||
|
||||
destroy: function ContentPrefSink_destroy() {
|
||||
gBrowser.removeEventListener("DOMContentLoaded", this, false);
|
||||
gBrowser.removeProgressListener(this);
|
||||
|
||||
// Delete references to XPCOM components to make sure we don't leak them
|
||||
// (although we haven't observed leakage in tests). Also delete references
|
||||
@ -99,25 +97,6 @@ var ContentPrefSink = {
|
||||
//**************************************************************************//
|
||||
// Event Handlers
|
||||
|
||||
// nsIWebProgressListener
|
||||
|
||||
onLocationChange: function ContentPrefSink_onLocationChange(progress, request, uri) {
|
||||
// Catch exceptions until bug 376222 gets fixed so that we don't hork
|
||||
// other progress listeners if our code throws an exception.
|
||||
try {
|
||||
this._handleLocationChanged(uri);
|
||||
}
|
||||
catch(ex) {
|
||||
Components.utils.reportError(ex);
|
||||
}
|
||||
},
|
||||
onStateChange: function ContentPrefSink_onStateChange(progress, request, flags, status) {},
|
||||
onProgressChange: function ContentPrefSink_onProgressChange(progress, request, curSelfProgress,
|
||||
maxSelfProgress, curTotalProgress,
|
||||
maxTotalProgress) {},
|
||||
onStatusChange: function ContentPrefSink_onStatusChange(progress, request, status, message) {},
|
||||
onSecurityChange: function ContentPrefSink_onSecurityChange(progress, request, state) {},
|
||||
|
||||
// nsIDOMEventListener
|
||||
|
||||
handleEvent: function ContentPrefSink_handleEvent(event) {
|
||||
@ -125,7 +104,7 @@ var ContentPrefSink = {
|
||||
this._handleDOMContentLoaded(event);
|
||||
},
|
||||
|
||||
_handleLocationChanged: function ContentPrefSink__handleLocationChanged(uri) {
|
||||
handleLocationChanged: function ContentPrefSink_handleLocationChanged(uri) {
|
||||
if (!uri)
|
||||
return;
|
||||
|
||||
|
@ -375,7 +375,7 @@
|
||||
ondragexit="PlacesMenuDNDController.onDragExit(event);">
|
||||
<menupopup id="bookmarksMenuPopup"
|
||||
type="places" asyncinit="true"
|
||||
place="place:folder=2&group=3&expandQueries=1"
|
||||
place="place:folder=2&expandQueries=1"
|
||||
context="placesContext"
|
||||
openInTabs="children"
|
||||
oncommand="BookmarksEventHandler.onCommand(event);"
|
||||
|
@ -314,6 +314,117 @@ function initBookmarksToolbar() {
|
||||
PlacesUtils.getQueryStringForFolder(PlacesUtils.bookmarks.toolbarFolder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the special "Places" folder (with some special queries) to the personal toolbar folder
|
||||
*/
|
||||
function initPlacesDefaultQueries() {
|
||||
var createdDefaultQueries = false;
|
||||
try {
|
||||
createdDefaultQueries = gPrefService.getBoolPref("browser.places.createdDefaultQueries");
|
||||
} catch(ex) {}
|
||||
|
||||
if (createdDefaultQueries)
|
||||
return;
|
||||
|
||||
var bmsvc = PlacesUtils.bookmarks;
|
||||
var callback = {
|
||||
runBatched: function() {
|
||||
var placesFolderTitle =
|
||||
PlacesUtils.getString("placesFolderTitle");
|
||||
var recentlyCreatedBookmarksTitle =
|
||||
PlacesUtils.getString("recentlyCreatedBookmarksTitle");
|
||||
var recentlyVisitedBookmarksTitle =
|
||||
PlacesUtils.getString("recentlyVisitedBookmarksTitle");
|
||||
var mostVisitedBookmarksTitle =
|
||||
PlacesUtils.getString("mostVisitedBookmarksTitle");
|
||||
var recentlyUsedTagsTitle =
|
||||
PlacesUtils.getString("recentlyUsedTagsTitle");
|
||||
var mostUsedTagsTitle =
|
||||
PlacesUtils.getString("mostUsedTagsTitle");
|
||||
var mostVisitedSitesTitle =
|
||||
PlacesUtils.getString("mostVisitedSitesTitle");
|
||||
|
||||
var bookmarksRoot = PlacesUtils.bookmarksRootId;
|
||||
var unfiledRoot = PlacesUtils.unfiledRootId;
|
||||
var tagRoot = PlacesUtils.tagRootId;
|
||||
var defaultIndex = bmsvc.DEFAULT_INDEX;
|
||||
|
||||
// index = 0, make it the first folder
|
||||
var placesFolder = bmsvc.createFolder(bmsvc.toolbarFolder,
|
||||
placesFolderTitle,
|
||||
0);
|
||||
|
||||
// XXX should this be a pref? see bug #399268
|
||||
var maxResults = 10;
|
||||
|
||||
// exclude queries so that user created "saved searches"
|
||||
// and these queries (added automatically) are excluded
|
||||
var recentlyCreatedBookmarksItem = bmsvc.insertBookmark(placesFolder,
|
||||
IO.newURI("place:folder=" + bookmarksRoot + "&folder=" + unfiledRoot +
|
||||
"&queryType=" + Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS +
|
||||
"&sort=" +
|
||||
Ci.nsINavHistoryQueryOptions.SORT_BY_DATEADDED_DESCENDING +
|
||||
"&excludeItemIfParentHasAnnotation=livemark%2FfeedURI" +
|
||||
"&maxResults=" + maxResults +
|
||||
"&excludeQueries=1"),
|
||||
defaultIndex, recentlyCreatedBookmarksTitle);
|
||||
|
||||
var recentlyVisitedBookmarksItem = bmsvc.insertBookmark(placesFolder,
|
||||
IO.newURI("place:folder=" + bookmarksRoot + "&folder=" + unfiledRoot +
|
||||
"&queryType=" + Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS +
|
||||
"&sort=" + Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING +
|
||||
"&minVisits=1&maxResults=" + maxResults),
|
||||
defaultIndex, recentlyVisitedBookmarksTitle);
|
||||
|
||||
var mostVisitedBookmarksItem = bmsvc.insertBookmark(placesFolder,
|
||||
IO.newURI("place:folder=" + bookmarksRoot + "&folder=" + unfiledRoot +
|
||||
"&queryType=" + Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS +
|
||||
"&sort=" +
|
||||
Ci.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_DESCENDING +
|
||||
"&minVisits=1&maxResults=" + maxResults),
|
||||
defaultIndex, mostVisitedBookmarksTitle);
|
||||
|
||||
var recentlyUsedTagsItem = bmsvc.insertBookmark(placesFolder,
|
||||
IO.newURI("place:folder=" + tagRoot +
|
||||
"&group=" + Ci.nsINavHistoryQueryOptions.GROUP_BY_FOLDER +
|
||||
"&queryType=" + Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS +
|
||||
"&applyOptionsToContainers=1" +
|
||||
"&sort=" +
|
||||
Ci.nsINavHistoryQueryOptions.SORT_BY_DATEADDED_DESCENDING +
|
||||
"&resolveNullBookmarkTitles=1" +
|
||||
"&maxResults=" + maxResults),
|
||||
defaultIndex, recentlyUsedTagsTitle);
|
||||
|
||||
var mostUsedTagsItem = bmsvc.insertBookmark(placesFolder,
|
||||
IO.newURI("place:folder=" + tagRoot +
|
||||
"&group=" + Ci.nsINavHistoryQueryOptions.GROUP_BY_FOLDER +
|
||||
"&queryType=" + Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS +
|
||||
"&applyOptionsToContainers=1" +
|
||||
"&sort=" + Ci.nsINavHistoryQueryOptions.SORT_BY_COUNT_DESCENDING +
|
||||
"&resolveNullBookmarkTitles=1" +
|
||||
"&maxResults=" + maxResults),
|
||||
defaultIndex, mostUsedTagsTitle);
|
||||
|
||||
var mostVisitedSitesItem = bmsvc.insertBookmark(placesFolder,
|
||||
IO.newURI("place:queryType=" +
|
||||
Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY +
|
||||
"&sort=" +
|
||||
Ci.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_DESCENDING +
|
||||
"&maxResults=" + maxResults),
|
||||
defaultIndex, mostVisitedSitesTitle);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
bmsvc.runInBatchMode(callback, null);
|
||||
} finally {
|
||||
// We need to persist this preference change, since we want to
|
||||
// check it at next app start even if the browser exits abruptly
|
||||
gPrefService.setBoolPref("browser.places.createdDefaultQueries", true);
|
||||
gPrefService.savePrefFile(null);
|
||||
}
|
||||
}
|
||||
|
||||
const gSessionHistoryObserver = {
|
||||
observe: function(subject, topic, data)
|
||||
{
|
||||
@ -959,6 +1070,7 @@ function delayedStartup()
|
||||
sidebar.setAttribute("src", sidebarBox.getAttribute("src"));
|
||||
}
|
||||
|
||||
initPlacesDefaultQueries();
|
||||
initBookmarksToolbar();
|
||||
PlacesUtils.bookmarks.addObserver(gBookmarksObserver, false);
|
||||
PlacesStarButton.init();
|
||||
@ -1215,6 +1327,9 @@ function nonBrowserWindowDelayedStartup()
|
||||
gPrefService = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch2);
|
||||
|
||||
// initialise the offline listener
|
||||
BrowserOffline.init();
|
||||
|
||||
// Set up Sanitize Item
|
||||
gSanitizeListener = new SanitizeListener();
|
||||
}
|
||||
@ -1223,6 +1338,8 @@ function nonBrowserWindowShutdown()
|
||||
{
|
||||
if (gSanitizeListener)
|
||||
gSanitizeListener.shutdown();
|
||||
|
||||
BrowserOffline.uninit();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -2663,18 +2780,14 @@ const DOMLinkHandler = {
|
||||
if (!gPrefService.getBoolPref("browser.chrome.site_icons"))
|
||||
break;
|
||||
|
||||
try {
|
||||
var contentPolicy = Cc["@mozilla.org/layout/content-policy;1"].
|
||||
getService(Ci.nsIContentPolicy);
|
||||
} catch(e) {
|
||||
break; // Refuse to load if we can't do a security check.
|
||||
}
|
||||
|
||||
var targetDoc = link.ownerDocument;
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var uri = ios.newURI(link.href, targetDoc.characterSet, null);
|
||||
|
||||
if (gBrowser.isFailedIcon(uri))
|
||||
break;
|
||||
|
||||
// Verify that the load of this icon is legal.
|
||||
// error pages can load their favicon, to be on the safe side,
|
||||
// only allow chrome:// favicons
|
||||
@ -2691,6 +2804,13 @@ const DOMLinkHandler = {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
var contentPolicy = Cc["@mozilla.org/layout/content-policy;1"].
|
||||
getService(Ci.nsIContentPolicy);
|
||||
} catch(e) {
|
||||
break; // Refuse to load if we can't do a security check.
|
||||
}
|
||||
|
||||
// Security says okay, now ask content policy
|
||||
if (contentPolicy.shouldLoad(Ci.nsIContentPolicy.TYPE_IMAGE,
|
||||
uri, targetDoc.documentURIObject,
|
||||
@ -3301,22 +3421,9 @@ nsBrowserStatusHandler.prototype =
|
||||
|
||||
onLinkIconAvailable : function(aBrowser)
|
||||
{
|
||||
if (gProxyFavIcon &&
|
||||
gBrowser.mCurrentBrowser == aBrowser &&
|
||||
if (gProxyFavIcon && gBrowser.mCurrentBrowser == aBrowser &&
|
||||
gBrowser.userTypedValue === null)
|
||||
{
|
||||
// update the favicon in the URL bar
|
||||
PageProxySetIcon(aBrowser.mIconURL);
|
||||
}
|
||||
|
||||
// Save this favicon in the favicon service
|
||||
if (aBrowser.mIconURL) {
|
||||
var faviconService = Components.classes["@mozilla.org/browser/favicon-service;1"]
|
||||
.getService(Components.interfaces.nsIFaviconService);
|
||||
var uri = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService).newURI(aBrowser.mIconURL, null, null);
|
||||
faviconService.setAndLoadFaviconForPage(aBrowser.currentURI, uri, false);
|
||||
}
|
||||
PageProxySetIcon(aBrowser.mIconURL); // update the favicon in the URL bar
|
||||
},
|
||||
|
||||
onProgressChange : function (aWebProgress, aRequest,
|
||||
@ -3583,6 +3690,15 @@ nsBrowserStatusHandler.prototype =
|
||||
}
|
||||
else
|
||||
this.asyncUpdateUI();
|
||||
|
||||
// Catch exceptions until bug 376222 gets fixed so we don't hork
|
||||
// other progress listeners if this call throws an exception.
|
||||
try {
|
||||
ContentPrefSink.handleLocationChanged(aLocationURI);
|
||||
}
|
||||
catch(ex) {
|
||||
Components.utils.reportError(ex);
|
||||
}
|
||||
},
|
||||
|
||||
asyncUpdateUI : function () {
|
||||
|
@ -241,8 +241,7 @@
|
||||
ondraggesture="PageProxyDragGesture(event);"
|
||||
onload="this.parentNode.selectedIndex = 1;
|
||||
event.stopPropagation();"
|
||||
onerror="gBrowser.addToMissedIconCache(this.src);
|
||||
this.removeAttribute('src');
|
||||
onerror="this.removeAttribute('src');
|
||||
this.parentNode.selectedIndex = 0;"
|
||||
tooltiptext="&proxyIcon.tooltip;"/>
|
||||
</deck>
|
||||
|
@ -140,7 +140,10 @@ Sanitizer.prototype = {
|
||||
// Clear last URL of the Open Web Location dialog
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch2);
|
||||
prefs.clearUserPref("general.open_location.last_url");
|
||||
try {
|
||||
prefs.clearUserPref("general.open_location.last_url");
|
||||
}
|
||||
catch (e) { }
|
||||
},
|
||||
|
||||
get canClear()
|
||||
|
@ -119,8 +119,7 @@
|
||||
node = node.parentNode;
|
||||
node.removeCurrentTab();">
|
||||
<xul:tab selected="true" validate="never"
|
||||
onerror="this.parentNode.parentNode.parentNode.parentNode.addToMissedIconCache(this.getAttribute('image'));
|
||||
this.removeAttribute('image');"
|
||||
onerror="this.removeAttribute('image');"
|
||||
maxwidth="250" width="0" minwidth="100" flex="100"
|
||||
class="tabbrowser-tab" label="&untitledTab;" crop="end"/>
|
||||
</xul:tabs>
|
||||
@ -144,6 +143,10 @@
|
||||
Components.classes["@mozilla.org/docshell/urifixup;1"]
|
||||
.getService(Components.interfaces.nsIURIFixup);
|
||||
</field>
|
||||
<field name="mFaviconService" readonly="true">
|
||||
Components.classes["@mozilla.org/browser/favicon-service;1"]
|
||||
.getService(Components.interfaces.nsIFaviconService);
|
||||
</field>
|
||||
<field name="mTabBox" readonly="true">
|
||||
document.getAnonymousElementByAttribute(this, "anonid", "tabbox");
|
||||
</field>
|
||||
@ -189,9 +192,6 @@
|
||||
<field name="mIsBusy">
|
||||
false
|
||||
</field>
|
||||
<field name="mMissedIconCache">
|
||||
null
|
||||
</field>
|
||||
<field name="mContextTab">
|
||||
null
|
||||
</field>
|
||||
@ -493,6 +493,16 @@
|
||||
var browser = this.getBrowserForTab(aTab);
|
||||
browser.mIconURL = aURI;
|
||||
|
||||
if (aURI) {
|
||||
if (!(aURI instanceof Components.interfaces.nsIURI)) {
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
aURI = ios.newURI(aURI, null, null);
|
||||
}
|
||||
this.mFaviconService.setAndLoadFaviconForPage(browser.currentURI,
|
||||
aURI, false);
|
||||
}
|
||||
|
||||
this.updateIcon(aTab);
|
||||
|
||||
for (var i = 0; i < this.mProgressListeners.length; i++) {
|
||||
@ -552,61 +562,24 @@
|
||||
}
|
||||
else if (this.shouldLoadFavIcon(browser.currentURI)) {
|
||||
var url = browser.currentURI.prePath + "/favicon.ico";
|
||||
if (!this.isIconKnownMissing(url))
|
||||
if (!this.isFailedIcon(url))
|
||||
this.setIcon(aTab, url);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="addToMissedIconCache">
|
||||
<method name="isFailedIcon">
|
||||
<parameter name="aURI"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var entry = this.openCacheEntry(aURI, Components.interfaces.nsICache.ACCESS_READ_WRITE);
|
||||
if (!entry)
|
||||
return;
|
||||
|
||||
if (entry.accessGranted == Components.interfaces.nsICache.ACCESS_WRITE)
|
||||
// It's a new entry. Just write a bit of metadata in to the entry.
|
||||
entry.setMetaDataElement("Icon", "Missed");
|
||||
entry.markValid();
|
||||
entry.close();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="openCacheEntry">
|
||||
<parameter name="key"/>
|
||||
<parameter name="access"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
try {
|
||||
if (!this.mMissedIconCache) {
|
||||
var cacheService = Components.classes['@mozilla.org/network/cache-service;1'].getService(Components.interfaces.nsICacheService);
|
||||
this.mMissedIconCache = cacheService.createSession("MissedIconCache", Components.interfaces.nsICache.STORE_ANYWHERE, true);
|
||||
if (!this.mMissedIconCache)
|
||||
return null;
|
||||
}
|
||||
return this.mMissedIconCache.openCacheEntry(key, access, true);
|
||||
if (!(aURI instanceof Components.interfaces.nsIURI)) {
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
aURI = ios.newURI(aURI, null, null);
|
||||
}
|
||||
catch (e) {
|
||||
return null;
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="isIconKnownMissing">
|
||||
<parameter name="key"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var e = this.openCacheEntry(key, Components.interfaces.nsICache.ACCESS_READ);
|
||||
if (e) {
|
||||
e.close();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return this.mFaviconService.isFailedFavicon(aURI);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
@ -1132,7 +1105,7 @@
|
||||
t.width = 0;
|
||||
t.setAttribute("flex", "100");
|
||||
t.setAttribute("validate", "never");
|
||||
t.setAttribute("onerror", "this.parentNode.parentNode.parentNode.parentNode.addToMissedIconCache(this.getAttribute('image')); this.removeAttribute('image');");
|
||||
t.setAttribute("onerror", "this.removeAttribute('image');");
|
||||
t.className = "tabbrowser-tab";
|
||||
|
||||
this.mTabContainer.appendChild(t);
|
||||
|
@ -164,7 +164,7 @@
|
||||
persist="height"
|
||||
onselect="BookmarkPropertiesPanel.onFolderTreeSelect();"
|
||||
showRoot="true"
|
||||
place="place:folder=2&group=3&excludeItems=1&excludeQueries=1&excludeReadOnlyFolders=1"
|
||||
place="place:folder=2&excludeItems=1&excludeQueries=1&excludeReadOnlyFolders=1"
|
||||
hidecolumnpicker="true">
|
||||
<treecols>
|
||||
<treecol id="title" flex="1" primary="true" hideheader="true"/>
|
||||
|
@ -40,7 +40,7 @@
|
||||
const NHRVO = Ci.nsINavHistoryResultViewObserver;
|
||||
|
||||
// XXXmano: we should move most/all of these constants to PlacesUtils
|
||||
const ORGANIZER_ROOT_BOOKMARKS = "place:folder=2&group=3&excludeItems=1&queryType=1";
|
||||
const ORGANIZER_ROOT_BOOKMARKS = "place:folder=2&excludeItems=1&queryType=1";
|
||||
const ORGANIZER_SUBSCRIPTIONS_QUERY = "place:annotation=livemark%2FfeedURI";
|
||||
|
||||
// No change to the view, preserve current selection
|
||||
|
@ -406,7 +406,7 @@ var gEditItemOverlay = {
|
||||
// hide the tag selector if it was previously visible
|
||||
var tagsSelector = this._element("tagsSelector");
|
||||
if (!tagsSelector.collapsed)
|
||||
this._toggleTagsSelector();
|
||||
this.toggleTagsSelector();
|
||||
}
|
||||
|
||||
if (this._observersAdded) {
|
||||
|
@ -144,7 +144,7 @@
|
||||
collapsed="true"
|
||||
onselect="gEditItemOverlay.onFolderTreeSelect();"
|
||||
showRoot="true"
|
||||
place="place:folder=2&group=3&excludeItems=1&excludeQueries=1&excludeReadOnlyFolders=1"
|
||||
place="place:folder=2&excludeItems=1&excludeQueries=1&excludeReadOnlyFolders=1"
|
||||
hidecolumnpicker="true"
|
||||
observes="paneElementsBroadcaster">
|
||||
<treecols>
|
||||
|
@ -47,20 +47,6 @@
|
||||
<binding id="places-menupopup"
|
||||
extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
<implementation>
|
||||
<constructor><![CDATA[
|
||||
#if 0
|
||||
// Support an asyncinit attribute that causes the view to populate
|
||||
// itself only after the window has been shown. This is to ensure we
|
||||
// do not regress browser window show time (Ts/Txul)
|
||||
if (this.hasAttribute("asyncinit")) {
|
||||
var self = this;
|
||||
//setTimeout(function() { self._init(); }, 0);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
this._init();
|
||||
]]></constructor>
|
||||
|
||||
<destructor><![CDATA[
|
||||
this._resultNode = null;
|
||||
if (this._result) {
|
||||
@ -69,8 +55,12 @@
|
||||
}
|
||||
]]></destructor>
|
||||
|
||||
<method name="_init">
|
||||
<field name="_initialized">false</field>
|
||||
<method name="_ensureInitialized">
|
||||
<body><![CDATA[
|
||||
if (this._initialized)
|
||||
return;
|
||||
|
||||
this._controller = new PlacesController(this);
|
||||
this.controllers.appendController(this._controller);
|
||||
|
||||
@ -80,6 +70,7 @@
|
||||
// Do the initial build.
|
||||
this.place = this.place;
|
||||
}
|
||||
this._initialized = true;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
@ -89,18 +80,19 @@
|
||||
|
||||
<field name="_built">false</field>
|
||||
|
||||
<field name="_ignoreInvalidateContainer">false</field>
|
||||
|
||||
<method name="onPopupShowing">
|
||||
<body><![CDATA[
|
||||
if (!this._resultNode)
|
||||
this._init();
|
||||
this._ensureInitialized();
|
||||
|
||||
if (!this._resultNode.containerOpen)
|
||||
this._resultNode.containerOpen = true;
|
||||
if (!this._built)
|
||||
this._rebuild();
|
||||
if (!this._resultNode.containerOpen)
|
||||
this._resultNode.containerOpen = true;
|
||||
if (!this._built)
|
||||
this._rebuild();
|
||||
|
||||
if (this.popupShowingCallback)
|
||||
this.popupShowingCallback();
|
||||
if (this.popupShowingCallback)
|
||||
this.popupShowingCallback();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
@ -167,10 +159,13 @@
|
||||
|
||||
// If static items at the beginning were found, remove all items between
|
||||
// them and the static content at the end.
|
||||
for (var i = 0; i < items.length; ++i) {
|
||||
items[i].parentNode.removeChild(items[i]);
|
||||
if (this._endMarker > 0)
|
||||
--this._endMarker;
|
||||
for (var i = 0; i < items.length; ++i) {
|
||||
// skip the empty menu item
|
||||
if (this._emptyMenuItem != items[i]) {
|
||||
items[i].parentNode.removeChild(items[i]);
|
||||
if (this._endMarker > 0)
|
||||
--this._endMarker;
|
||||
}
|
||||
}
|
||||
|
||||
// If no static items were found at the beginning, remove all items before
|
||||
@ -178,9 +173,12 @@
|
||||
if (this._startMarker == -1) {
|
||||
var end = (this._endMarker == -1) ? this.childNodes.length - 1 : this._endMarker - 1;
|
||||
for (var i = end; i >=0; i--) {
|
||||
this.removeChild(this.childNodes[i]);
|
||||
if (this._endMarker > 0)
|
||||
--this._endMarker;
|
||||
// skip the empty menu item
|
||||
if (this._emptyMenuItem != this.childNodes[i]) {
|
||||
this.removeChild(this.childNodes[i]);
|
||||
if (this._endMarker > 0)
|
||||
--this._endMarker;
|
||||
}
|
||||
}
|
||||
}
|
||||
//LOG("KIDS = " + this.childNodes.length);
|
||||
@ -254,7 +252,7 @@
|
||||
popup._containerNodesMap = this._containerNodesMap;
|
||||
this._containerNodesMap.push({ resultNode: child, domNode: popup });
|
||||
}
|
||||
|
||||
|
||||
if (element) {
|
||||
element.node = child;
|
||||
element.node.viewIndex = 0;
|
||||
@ -484,8 +482,19 @@
|
||||
containerClosed: function PMV_containerClosed(aNode) {
|
||||
this.invalidateContainer(aNode);
|
||||
},
|
||||
|
||||
get ignoreInvalidateContainer() {
|
||||
return this._self._ignoreInvalidateContainer;
|
||||
},
|
||||
|
||||
set ignoreInvalidateContainer(val) {
|
||||
return this._self._ignoreInvalidateContainer = val;
|
||||
},
|
||||
|
||||
invalidateContainer: function PMV_invalidateContainer(aContainer) {
|
||||
if (this._self_ignoreInvalidateContainer)
|
||||
return;
|
||||
|
||||
if (!this._self._built)
|
||||
return;
|
||||
|
||||
@ -917,6 +926,7 @@
|
||||
<method name="buildContextMenu">
|
||||
<parameter name="aPopup"/>
|
||||
<body><![CDATA[
|
||||
this._ensureInitialized();
|
||||
this.focus();
|
||||
return this.controller.buildContextMenu(aPopup);
|
||||
]]></body>
|
||||
|
@ -69,7 +69,7 @@
|
||||
type="places"
|
||||
showRoot="true"
|
||||
seltype="single"
|
||||
place="place:folder=2&group=3&excludeItems=1&excludeReadOnlyFolders=1"
|
||||
place="place:folder=2&excludeItems=1&excludeReadOnlyFolders=1"
|
||||
hidecolumnpicker="true">
|
||||
<treecols>
|
||||
<treecol id="title" flex="1" primary="true" hideheader="true"/>
|
||||
|
@ -352,7 +352,7 @@
|
||||
class="placesTree"
|
||||
type="places"
|
||||
showRoot="true"
|
||||
place="place:folder=2&group=3&excludeItems=1&queryType=1"
|
||||
place="place:folder=2&excludeItems=1&queryType=1"
|
||||
hidecolumnpicker="true" context="placesContext"
|
||||
onselect="PlacesOrganizer.onPlaceSelected(true);"
|
||||
onclick="PlacesOrganizer.onTreeClick(event);"
|
||||
|
@ -138,7 +138,9 @@
|
||||
<field name="_openedMenuButton">null</field>
|
||||
|
||||
<field name="_result">null</field>
|
||||
|
||||
|
||||
<field name="_ignoreInvalidateContainer">false</field>
|
||||
|
||||
<!-- nsIPlacesView -->
|
||||
<method name="getResult">
|
||||
<body><![CDATA[
|
||||
@ -576,7 +578,18 @@
|
||||
this.invalidateContainer(aNode);
|
||||
},
|
||||
|
||||
get ignoreInvalidateContainer() {
|
||||
return this._self._ignoreInvalidateContainer;
|
||||
},
|
||||
|
||||
set ignoreInvalidateContainer(val) {
|
||||
return this._self._ignoreInvalidateContainer = val;
|
||||
},
|
||||
|
||||
invalidateContainer: function TV_V_invalidateContainer(aContainer) {
|
||||
if (this._self._ignoreInvalidateContainer)
|
||||
return;
|
||||
|
||||
function isChildOf(node, container) {
|
||||
var parent = node.parent;
|
||||
while (parent) {
|
||||
|
@ -765,92 +765,6 @@
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!--
|
||||
Gets the nsINavHistoryResultNode adjacent to the specified InsertionPoint.
|
||||
@param insertionPoint
|
||||
The InsertionPoint where items are being inserted
|
||||
@returns a nsINavHistoryResultNode that is adjacent to the specified
|
||||
InsertionPoint
|
||||
-->
|
||||
<method name="_getInsertionNode">
|
||||
<parameter name="insertionPoint"/>
|
||||
<body><![CDATA[
|
||||
// The InsertionPoint defines a place within the view hierarchy where
|
||||
// items may be inserted. This function returns the node adjacent to
|
||||
// that point. In order to get the right node, we must enumerate the
|
||||
// contents of the containing folder, but we cannot construct a new
|
||||
// query for this, because if we do so the node will be a member of
|
||||
// another result node (that constructed by |getFolderContents| say,
|
||||
// instead of the displayed tree view). So we need to walk the
|
||||
// children of the result to find the right folder.
|
||||
function findFolder(aItemId, aContainer) {
|
||||
var wasOpen = aContainer.containerOpen;
|
||||
aContainer.containerOpen = true;
|
||||
var cc = aContainer.childCount;
|
||||
var foundNode = null;
|
||||
for (var i = 0; i < cc; ++i) {
|
||||
var node = aContainer.getChild(i);
|
||||
if (PlacesUtils.nodeIsFolder(node)) {
|
||||
if (node.itemId == aItemId) {
|
||||
foundNode = node;
|
||||
break;
|
||||
}
|
||||
foundNode = findFolder(aItemId, node);
|
||||
if (foundNode)
|
||||
break;
|
||||
}
|
||||
}
|
||||
aContainer.containerOpen = wasOpen;
|
||||
return foundNode;
|
||||
}
|
||||
var folder = null;
|
||||
var root = asContainer(this.getResultNode());
|
||||
if (PlacesUtils.nodeIsFolder(root) &&
|
||||
root.itemId == insertionPoint.itemId)
|
||||
folder = root;
|
||||
else
|
||||
folder = findFolder(insertionPoint.itemId, root);
|
||||
|
||||
// Since we find the folder manually, using findFolder instead of
|
||||
// PlacesUtils.getFolderContents, the folder is not opened for
|
||||
// us. We need to do that ourselves (and remember if it was closed,
|
||||
// so that we can close it again later).
|
||||
var folderWasOpen = folder.containerOpen;
|
||||
folder.containerOpen = true;
|
||||
|
||||
var index = insertionPoint.index;
|
||||
if (insertionPoint.index == -1 || insertionPoint.index >= folder.childCount)
|
||||
index = folder.childCount - 1;
|
||||
NS_ASSERT(index < folder.childCount,
|
||||
"index out of range: " + index + " > " + folder);
|
||||
var insertionNode = index > -1 ? folder.getChild(index) : null;
|
||||
|
||||
// Now close the folder again, if it was before.
|
||||
folder.containerOpen = folderWasOpen;
|
||||
|
||||
return insertionNode;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!--
|
||||
Gets the tree-index of the node adjacent to the specified InsertionPoint
|
||||
@param insertionPoint
|
||||
The InsertionPoint where items are being inserted
|
||||
@returns the tree-index of the node adjacent to the specified InsertionPoint
|
||||
-->
|
||||
<method name="_getInsertionIndex">
|
||||
<parameter name="insertionPoint"/>
|
||||
<body><![CDATA[
|
||||
var node = this._getInsertionNode(insertionPoint);
|
||||
// This is the insertion index of the pivot.
|
||||
if (node)
|
||||
return this.getResultView().treeIndexForNode(node);
|
||||
else if (insertionPoint.orientation == NHRVO.DROP_ON)
|
||||
return Ci.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE;
|
||||
return -1;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<field name="_viewObserver"><![CDATA[({
|
||||
_self: this,
|
||||
|
||||
|
@ -210,7 +210,6 @@ var OptionsFilter = {
|
||||
var defaultHistoryOptions = history.getNewQueryOptions();
|
||||
defaultHistoryOptions.sortingMode = NHQO.SORT_BY_DATE_DESCENDING;
|
||||
var defaultBookmarksOptions = history.getNewQueryOptions();
|
||||
defaultBookmarksOptions.setGroupingMode([NHQO.GROUP_BY_FOLDER], 1);
|
||||
var defaultSubscriptionsOptions = history.getNewQueryOptions();
|
||||
|
||||
this.historyHandler =
|
||||
|
@ -300,7 +300,7 @@ PlacesTreeView.prototype = {
|
||||
// The root node is invisible if showRoot is not set. Otherwise aContainer
|
||||
// must be visible
|
||||
if (this._showRoot || aContainer != this._result.root) {
|
||||
if (aContainer.viewIndex < 0 &&
|
||||
if (aContainer.viewIndex < 0 ||
|
||||
aContainer.viewIndex > this._visibleElements.length)
|
||||
throw "Trying to expand a node that is not visible";
|
||||
|
||||
@ -372,7 +372,17 @@ PlacesTreeView.prototype = {
|
||||
// now, open any containers that were persisted
|
||||
for (var i = 0; i < toOpenElements.length; i++) {
|
||||
var item = asContainer(toOpenElements[i]);
|
||||
item.containerOpen = !item.containerOpen;
|
||||
var parent = item.parent;
|
||||
// avoid recursively opening containers
|
||||
while (parent) {
|
||||
if (parent.uri == item.uri)
|
||||
break;
|
||||
parent = parent.parent;
|
||||
}
|
||||
// if we don't have a parent, we made it all the way to the root
|
||||
// and didn't find a match, so we can open our item
|
||||
if (!parent)
|
||||
item.containerOpen = !item.containerOpen;
|
||||
}
|
||||
|
||||
// restore selection
|
||||
@ -726,7 +736,18 @@ PlacesTreeView.prototype = {
|
||||
this.invalidateContainer(aItem);
|
||||
},
|
||||
|
||||
invalidateContainer: function PTV_invalidateContainer(aItem) {
|
||||
get ignoreInvalidateContainer() {
|
||||
return this._ignoreInvalidateContainer;
|
||||
},
|
||||
|
||||
set ignoreInvalidateContainer(val) {
|
||||
return this._ignoreInvalidateContainer = val;
|
||||
},
|
||||
|
||||
invalidateContainer: function PTV_invalidateContainer(aItem) {
|
||||
if (this._ignoreInvalidateContainer)
|
||||
return;
|
||||
|
||||
NS_ASSERT(this._result, "Got a notification but have no result!");
|
||||
if (!this._tree)
|
||||
return; // nothing to do, container is not visible
|
||||
@ -1219,6 +1240,7 @@ PlacesTreeView.prototype = {
|
||||
newSort = NHQO.SORT_BY_ANNOTATION_ASCENDING;
|
||||
newSortingAnnotation = DESCRIPTION_ANNO;
|
||||
}
|
||||
|
||||
break;
|
||||
case this.COLUMN_TYPE_DATEADDED:
|
||||
if (oldSort == NHQO.SORT_BY_DATEADDED_ASCENDING)
|
||||
@ -1282,4 +1304,5 @@ function PlacesTreeView(aShowRoot) {
|
||||
this._visibleElements = [];
|
||||
this._observers = [];
|
||||
this._showRoot = aShowRoot;
|
||||
this._ignoreInvalidateContainer = false;
|
||||
}
|
||||
|
@ -887,7 +887,6 @@ var PlacesUtils = {
|
||||
var query = this.history.getNewQuery();
|
||||
query.setFolders([aFolderId], 1);
|
||||
var options = this.history.getNewQueryOptions();
|
||||
options.setGroupingMode([Ci.nsINavHistoryQueryOptions.GROUP_BY_FOLDER], 1);
|
||||
options.excludeItems = aExcludeItems;
|
||||
options.expandQueries = aExpandQueries;
|
||||
|
||||
@ -1415,7 +1414,6 @@ var PlacesUtils = {
|
||||
*/
|
||||
getQueryStringForFolder: function PU_getQueryStringForFolder(aFolderId) {
|
||||
var options = this.history.getNewQueryOptions();
|
||||
options.setGroupingMode([Ci.nsINavHistoryQueryOptions.GROUP_BY_FOLDER], 1);
|
||||
var query = this.history.getNewQuery();
|
||||
query.setFolders([aFolderId], 1);
|
||||
return this.history.queriesToQueryString([query], 1, options);
|
||||
|
@ -128,15 +128,6 @@ var gAdvancedPane = {
|
||||
return checkbox.checked ? (this._storedSpellCheck == 2 ? 2 : 1) : 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* Shows a dialog in which the preferred language for web content may be set.
|
||||
*/
|
||||
showLanguages: function ()
|
||||
{
|
||||
document.documentElement.openSubDialog("chrome://browser/content/preferences/languages.xul",
|
||||
"", null);
|
||||
},
|
||||
|
||||
// NETWORK TAB
|
||||
|
||||
/*
|
||||
|
@ -169,19 +169,6 @@
|
||||
preference="layout.spellcheckDefault"/>
|
||||
</groupbox>
|
||||
|
||||
<!-- Languages -->
|
||||
<groupbox id="languagesGroup">
|
||||
<caption label="&languages.label;"/>
|
||||
|
||||
<hbox id="languagesBox" align="center">
|
||||
<description flex="1" control="chooseLanguage">&chooseLanguage.label;</description>
|
||||
<button id="chooseLanguage"
|
||||
label="&chooseButton.label;"
|
||||
accesskey="&chooseButton.accesskey;"
|
||||
oncommand="gAdvancedPane.showLanguages();"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
|
||||
</tabpanel>
|
||||
|
||||
<!-- Network -->
|
||||
|
@ -153,6 +153,31 @@ function getLocalHandlerApp(aFile) {
|
||||
return localHandlerApp;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration of items in a JS array.
|
||||
*
|
||||
* FIXME: use ArrayConverter once it lands (bug 380839).
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
function ArrayEnumerator(aItems) {
|
||||
this._index = 0;
|
||||
this._contents = aItems;
|
||||
}
|
||||
|
||||
ArrayEnumerator.prototype = {
|
||||
_index: 0,
|
||||
_contents: [],
|
||||
|
||||
hasMoreElements: function() {
|
||||
return this._index < this._contents.length;
|
||||
},
|
||||
|
||||
getNext: function() {
|
||||
return this._contents[this._index++];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//****************************************************************************//
|
||||
// HandlerInfoWrapper
|
||||
@ -236,8 +261,7 @@ HandlerInfoWrapper.prototype = {
|
||||
// Make sure the preferred handler is in the set of possible handlers.
|
||||
if (aNewValue) {
|
||||
var found = false;
|
||||
var possibleApps = this.possibleApplicationHandlers.
|
||||
QueryInterface(Ci.nsIArray).enumerate();
|
||||
var possibleApps = this.possibleApplicationHandlers.enumerate();
|
||||
while (possibleApps.hasMoreElements() && !found)
|
||||
found = possibleApps.getNext().equals(aNewValue);
|
||||
if (!found)
|
||||
@ -263,21 +287,19 @@ HandlerInfoWrapper.prototype = {
|
||||
if (this.plugin && !this.isDisabledPluginType)
|
||||
return kActionUsePlugin;
|
||||
|
||||
// XXX nsIMIMEService::getFromTypeAndExtension returns handler infos
|
||||
// whose default action is saveToDisk; should we do that here too?
|
||||
// And will there ever be handler info objects with no preferred action?
|
||||
if (!this.wrappedHandlerInfo.preferredAction) {
|
||||
if (gApplicationsPane.isValidHandlerApp(this.preferredApplicationHandler))
|
||||
return Ci.nsIHandlerInfo.useHelperApp;
|
||||
else
|
||||
return Ci.nsIHandlerInfo.useSystemDefault;
|
||||
}
|
||||
|
||||
// If the action is to use a helper app, but we don't have a preferred
|
||||
// helper app, switch to using the system default.
|
||||
// handler app, then switch to using the system default, if any; otherwise
|
||||
// fall back to saving to disk, which is the default action in nsMIMEInfo.
|
||||
// Note: "save to disk" is an invalid value for protocol info objects,
|
||||
// but the alwaysAskBeforeHandling getter will detect that situation
|
||||
// and always return true in that case to override this invalid value.
|
||||
if (this.wrappedHandlerInfo.preferredAction == Ci.nsIHandlerInfo.useHelperApp &&
|
||||
!gApplicationsPane.isValidHandlerApp(this.preferredApplicationHandler))
|
||||
return Ci.nsIHandlerInfo.useSystemDefault;
|
||||
!gApplicationsPane.isValidHandlerApp(this.preferredApplicationHandler)) {
|
||||
if (this.wrappedHandlerInfo.hasDefaultHandler)
|
||||
return Ci.nsIHandlerInfo.useSystemDefault;
|
||||
else
|
||||
return Ci.nsIHandlerInfo.saveToDisk;
|
||||
}
|
||||
|
||||
return this.wrappedHandlerInfo.preferredAction;
|
||||
},
|
||||
@ -301,6 +323,16 @@ HandlerInfoWrapper.prototype = {
|
||||
if (this.plugin && this.handledOnlyByPlugin)
|
||||
return false;
|
||||
|
||||
// If this is a protocol type and the preferred action is "save to disk",
|
||||
// which is invalid for such types, then return true here to override that
|
||||
// action. This could happen when the preferred action is to use a helper
|
||||
// app, but the preferredApplicationHandler is invalid, and there isn't
|
||||
// a default handler, so the preferredAction getter returns save to disk
|
||||
// instead.
|
||||
if (!(this.wrappedHandlerInfo instanceof Ci.nsIMIMEInfo) &&
|
||||
this.preferredAction == Ci.nsIHandlerInfo.saveToDisk)
|
||||
return true;
|
||||
|
||||
return this.wrappedHandlerInfo.alwaysAskBeforeHandling;
|
||||
},
|
||||
|
||||
@ -520,28 +552,55 @@ var feedHandlerInfo = {
|
||||
}
|
||||
},
|
||||
|
||||
get possibleApplicationHandlers() {
|
||||
var handlerApps = Cc["@mozilla.org/array;1"].
|
||||
createInstance(Ci.nsIMutableArray);
|
||||
_possibleApplicationHandlers: null,
|
||||
|
||||
// Add the "selected" local application, if there is one and it's different
|
||||
// from the default handler for the OS. Unlike for other types, there can
|
||||
// be only one of these at a time for the feed type, since feed preferences
|
||||
// only store a single local app.
|
||||
get possibleApplicationHandlers() {
|
||||
if (this._possibleApplicationHandlers)
|
||||
return this._possibleApplicationHandlers;
|
||||
|
||||
// A minimal implementation of nsIMutableArray. It only supports the two
|
||||
// methods its callers invoke, namely appendElement and nsIArray::enumerate.
|
||||
this._possibleApplicationHandlers = {
|
||||
_inner: [],
|
||||
|
||||
QueryInterface: function(aIID) {
|
||||
if (aIID.equals(Ci.nsIMutableArray) ||
|
||||
aIID.equals(Ci.nsIArray) ||
|
||||
aIID.equals(Ci.nsISupports))
|
||||
return this;
|
||||
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
|
||||
enumerate: function() {
|
||||
return new ArrayEnumerator(this._inner);
|
||||
},
|
||||
|
||||
appendElement: function(aHandlerApp, aWeak) {
|
||||
this._inner.push(aHandlerApp);
|
||||
}
|
||||
};
|
||||
|
||||
// Add the selected local app if it's different from the OS default handler.
|
||||
// Unlike for other types, we can store only one local app at a time for the
|
||||
// feed type, since we store it in a preference that historically stores
|
||||
// only a single path. But we display all the local apps the user chooses
|
||||
// while the prefpane is open, only dropping the list when the user closes
|
||||
// the prefpane, for maximum usability and consistency with other types.
|
||||
var preferredAppFile = this.element(PREF_FEED_SELECTED_APP).value;
|
||||
if (preferredAppFile && preferredAppFile.exists()) {
|
||||
if (preferredAppFile) {
|
||||
let preferredApp = getLocalHandlerApp(preferredAppFile);
|
||||
let defaultApp = this._defaultApplicationHandler;
|
||||
if (!defaultApp || !defaultApp.equals(preferredApp))
|
||||
handlerApps.appendElement(preferredApp, false);
|
||||
this._possibleApplicationHandlers.appendElement(preferredApp, false);
|
||||
}
|
||||
|
||||
// Add the registered web handlers. There can be any number of these.
|
||||
var webHandlers = this._converterSvc.getContentHandlers(this.type, {});
|
||||
for each (let webHandler in webHandlers)
|
||||
handlerApps.appendElement(webHandler, false);
|
||||
this._possibleApplicationHandlers.appendElement(webHandler, false);
|
||||
|
||||
return handlerApps;
|
||||
return this._possibleApplicationHandlers;
|
||||
},
|
||||
|
||||
__defaultApplicationHandler: undefined,
|
||||
@ -668,12 +727,6 @@ var feedHandlerInfo = {
|
||||
},
|
||||
|
||||
|
||||
//**************************************************************************//
|
||||
// Plugin Handling
|
||||
|
||||
handledOnlyByPlugin: false,
|
||||
|
||||
|
||||
//**************************************************************************//
|
||||
// Storage
|
||||
|
||||
@ -706,6 +759,21 @@ var gApplicationsPane = {
|
||||
// The set of types the app knows how to handle. A hash of HandlerInfoWrapper
|
||||
// objects, indexed by type.
|
||||
_handledTypes: {},
|
||||
|
||||
// The list of types we can show, sorted by the sort column/direction.
|
||||
// An array of HandlerInfoWrapper objects. We build this list when we first
|
||||
// load the data and then rebuild it when users change a pref that affects
|
||||
// what types we can show or change the sort column/direction.
|
||||
// Note: this isn't necessarily the list of types we *will* show; if the user
|
||||
// provides a filter string, we'll only show the subset of types in this list
|
||||
// that match that string.
|
||||
_visibleTypes: [],
|
||||
|
||||
// A count of the number of times each visible type description appears.
|
||||
// We use these counts to determine whether or not to annotate descriptions
|
||||
// with their types to distinguish duplicate descriptions from each other.
|
||||
// A hash of integer counts, indexed by string description.
|
||||
_visibleTypeDescriptionCount: {},
|
||||
|
||||
|
||||
//**************************************************************************//
|
||||
@ -760,7 +828,7 @@ var gApplicationsPane = {
|
||||
window.addEventListener("unload", this, false);
|
||||
|
||||
// Figure out how we should be sorting the list. We persist sort settings
|
||||
// across sessions, so we can't assume the default sort column and direction.
|
||||
// across sessions, so we can't assume the default sort column/direction.
|
||||
// XXX should we be using the XUL sort service instead?
|
||||
if (document.getElementById("typeColumn").hasAttribute("sortDirection"))
|
||||
this._sortColumn = document.getElementById("typeColumn");
|
||||
@ -776,7 +844,9 @@ var gApplicationsPane = {
|
||||
// XXX Shouldn't we perhaps just set a max-height on the richlistbox?
|
||||
var _delayedPaneLoad = function(self) {
|
||||
self._loadData();
|
||||
self.rebuildView();
|
||||
self._rebuildVisibleTypes();
|
||||
self._sortVisibleTypes();
|
||||
self._rebuildView();
|
||||
}
|
||||
setTimeout(_delayedPaneLoad, 0, this);
|
||||
},
|
||||
@ -811,8 +881,19 @@ var gApplicationsPane = {
|
||||
observe: function (aSubject, aTopic, aData) {
|
||||
// Rebuild the list when there are changes to preferences that influence
|
||||
// whether or not to show certain entries in the list.
|
||||
if (aTopic == "nsPref:changed")
|
||||
this.rebuildView();
|
||||
if (aTopic == "nsPref:changed") {
|
||||
// These two prefs alter the list of visible types, so we have to rebuild
|
||||
// that list when they change.
|
||||
if (aData == PREF_SHOW_PLUGINS_IN_LIST ||
|
||||
aData == PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS) {
|
||||
this._rebuildVisibleTypes();
|
||||
this._sortVisibleTypes();
|
||||
}
|
||||
|
||||
// All the prefs we observe can affect what we display, so we rebuild
|
||||
// the view when any of them changes.
|
||||
this._rebuildView();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -837,6 +918,7 @@ var gApplicationsPane = {
|
||||
|
||||
_loadFeedHandler: function() {
|
||||
this._handledTypes[TYPE_MAYBE_FEED] = feedHandlerInfo;
|
||||
feedHandlerInfo.handledOnlyByPlugin = false;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -864,19 +946,19 @@ var gApplicationsPane = {
|
||||
let plugin = navigator.plugins[i];
|
||||
for (let j = 0; j < plugin.length; ++j) {
|
||||
let type = plugin[j].type;
|
||||
let handlerInfoWrapper;
|
||||
|
||||
if (typeof this._handledTypes[type] == "undefined") {
|
||||
let handlerInfoWrapper;
|
||||
if (type in this._handledTypes)
|
||||
handlerInfoWrapper = this._handledTypes[type];
|
||||
else {
|
||||
let wrappedHandlerInfo =
|
||||
this._mimeSvc.getFromTypeAndExtension(type, null);
|
||||
handlerInfoWrapper = new HandlerInfoWrapper(type, wrappedHandlerInfo);
|
||||
handlerInfoWrapper.handledOnlyByPlugin = true;
|
||||
this._handledTypes[type] = handlerInfoWrapper;
|
||||
}
|
||||
else
|
||||
handlerInfoWrapper = this._handledTypes[type];
|
||||
|
||||
handlerInfoWrapper.plugin = plugin;
|
||||
handlerInfoWrapper.handledOnlyByPlugin = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -887,17 +969,17 @@ var gApplicationsPane = {
|
||||
_loadApplicationHandlers: function() {
|
||||
var wrappedHandlerInfos = this._handlerSvc.enumerate();
|
||||
while (wrappedHandlerInfos.hasMoreElements()) {
|
||||
let wrappedHandlerInfo = wrappedHandlerInfos.getNext().
|
||||
QueryInterface(Ci.nsIHandlerInfo);
|
||||
let wrappedHandlerInfo =
|
||||
wrappedHandlerInfos.getNext().QueryInterface(Ci.nsIHandlerInfo);
|
||||
let type = wrappedHandlerInfo.type;
|
||||
let handlerInfoWrapper;
|
||||
|
||||
if (typeof this._handledTypes[type] == "undefined") {
|
||||
let handlerInfoWrapper;
|
||||
if (type in this._handledTypes)
|
||||
handlerInfoWrapper = this._handledTypes[type];
|
||||
else {
|
||||
handlerInfoWrapper = new HandlerInfoWrapper(type, wrappedHandlerInfo);
|
||||
this._handledTypes[type] = handlerInfoWrapper;
|
||||
}
|
||||
else
|
||||
handlerInfoWrapper = this._handledTypes[type];
|
||||
|
||||
handlerInfoWrapper.handledOnlyByPlugin = false;
|
||||
}
|
||||
@ -907,35 +989,12 @@ var gApplicationsPane = {
|
||||
//**************************************************************************//
|
||||
// View Construction
|
||||
|
||||
rebuildView: function() {
|
||||
// Clear the list of entries.
|
||||
while (this._list.childNodes.length > 1)
|
||||
this._list.removeChild(this._list.lastChild);
|
||||
|
||||
var visibleTypes = this._getVisibleTypes();
|
||||
|
||||
if (this._sortColumn)
|
||||
this._sortTypes(visibleTypes);
|
||||
|
||||
for each (let visibleType in visibleTypes) {
|
||||
let item = document.createElement("richlistitem");
|
||||
item.setAttribute("type", visibleType.type);
|
||||
item.setAttribute("typeDescription", visibleType.description);
|
||||
if (visibleType.smallIcon)
|
||||
item.setAttribute("typeIcon", visibleType.smallIcon);
|
||||
item.setAttribute("actionDescription",
|
||||
this._describePreferredAction(visibleType));
|
||||
item.setAttribute("actionIcon",
|
||||
this._getIconURLForPreferredAction(visibleType));
|
||||
this._list.appendChild(item);
|
||||
}
|
||||
|
||||
this._selectLastSelectedType();
|
||||
},
|
||||
|
||||
_getVisibleTypes: function() {
|
||||
var visibleTypes = [];
|
||||
_rebuildVisibleTypes: function() {
|
||||
// Reset the list of visible types and the visible type description counts.
|
||||
this._visibleTypes = [];
|
||||
this._visibleTypeDescriptionCount = {};
|
||||
|
||||
// Get the preferences that help determine what types to show.
|
||||
var showPlugins = this._prefSvc.getBoolPref(PREF_SHOW_PLUGINS_IN_LIST);
|
||||
var hideTypesWithoutExtensions =
|
||||
this._prefSvc.getBoolPref(PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS);
|
||||
@ -958,23 +1017,68 @@ var gApplicationsPane = {
|
||||
if (handlerInfo.handledOnlyByPlugin && !showPlugins)
|
||||
continue;
|
||||
|
||||
// If the user is filtering the list, then only show matching types.
|
||||
if (this._filter.value && !this._matchesFilter(handlerInfo))
|
||||
continue;
|
||||
|
||||
// We couldn't find any reason to exclude the type, so include it.
|
||||
visibleTypes.push(handlerInfo);
|
||||
this._visibleTypes.push(handlerInfo);
|
||||
|
||||
if (handlerInfo.description in this._visibleTypeDescriptionCount)
|
||||
this._visibleTypeDescriptionCount[handlerInfo.description]++;
|
||||
else
|
||||
this._visibleTypeDescriptionCount[handlerInfo.description] = 1;
|
||||
}
|
||||
},
|
||||
|
||||
_rebuildView: function() {
|
||||
// Clear the list of entries.
|
||||
while (this._list.childNodes.length > 1)
|
||||
this._list.removeChild(this._list.lastChild);
|
||||
|
||||
var visibleTypes = this._visibleTypes;
|
||||
|
||||
// If the user is filtering the list, then only show matching types.
|
||||
if (this._filter.value)
|
||||
visibleTypes = visibleTypes.filter(this._matchesFilter, this);
|
||||
|
||||
for each (let visibleType in visibleTypes) {
|
||||
let item = document.createElement("richlistitem");
|
||||
item.setAttribute("type", visibleType.type);
|
||||
item.setAttribute("typeDescription", this._describeType(visibleType));
|
||||
if (visibleType.smallIcon)
|
||||
item.setAttribute("typeIcon", visibleType.smallIcon);
|
||||
item.setAttribute("actionDescription",
|
||||
this._describePreferredAction(visibleType));
|
||||
item.setAttribute("actionIcon",
|
||||
this._getIconURLForPreferredAction(visibleType));
|
||||
this._list.appendChild(item);
|
||||
}
|
||||
|
||||
return visibleTypes;
|
||||
this._selectLastSelectedType();
|
||||
},
|
||||
|
||||
_matchesFilter: function(aType) {
|
||||
var filterValue = this._filter.value.toLowerCase();
|
||||
return aType.description.toLowerCase().indexOf(filterValue) != -1 ||
|
||||
return this._describeType(aType).toLowerCase().indexOf(filterValue) != -1 ||
|
||||
this._describePreferredAction(aType).toLowerCase().indexOf(filterValue) != -1;
|
||||
},
|
||||
|
||||
/**
|
||||
* Describe, in a human-readable fashion, the type represented by the given
|
||||
* handler info object. Normally this is just the description provided by
|
||||
* the info object, but if more than one object presents the same description,
|
||||
* then we annotate the duplicate descriptions with the type itself to help
|
||||
* users distinguish between those types.
|
||||
*
|
||||
* @param aHandlerInfo {nsIHandlerInfo} the type being described
|
||||
* @returns {string} a description of the type
|
||||
*/
|
||||
_describeType: function(aHandlerInfo) {
|
||||
if (this._visibleTypeDescriptionCount[aHandlerInfo.description] > 1)
|
||||
return this._prefsBundle.getFormattedString("typeDescriptionWithType",
|
||||
[aHandlerInfo.description,
|
||||
aHandlerInfo.type]);
|
||||
|
||||
return aHandlerInfo.description;
|
||||
},
|
||||
|
||||
/**
|
||||
* Describe, in a human-readable fashion, the preferred action to take on
|
||||
* the type represented by the given handler info object.
|
||||
@ -985,6 +1089,7 @@ var gApplicationsPane = {
|
||||
*
|
||||
* @param aHandlerInfo {nsIHandlerInfo} the type whose preferred action
|
||||
* is being described
|
||||
* @returns {string} a description of the action
|
||||
*/
|
||||
_describePreferredAction: function(aHandlerInfo) {
|
||||
// alwaysAskBeforeHandling overrides the preferred action, so if that flag
|
||||
@ -1069,9 +1174,7 @@ var gApplicationsPane = {
|
||||
return false;
|
||||
|
||||
if (aHandlerApp instanceof Ci.nsILocalHandlerApp)
|
||||
return aHandlerApp.executable &&
|
||||
aHandlerApp.executable.exists() &&
|
||||
aHandlerApp.executable.isExecutable();
|
||||
return this._isValidHandlerExecutable(aHandlerApp.executable);
|
||||
|
||||
if (aHandlerApp instanceof Ci.nsIWebHandlerApp)
|
||||
return aHandlerApp.uriTemplate;
|
||||
@ -1082,6 +1185,24 @@ var gApplicationsPane = {
|
||||
return false;
|
||||
},
|
||||
|
||||
_isValidHandlerExecutable: function(aExecutable) {
|
||||
return aExecutable &&
|
||||
aExecutable.exists() &&
|
||||
aExecutable.isExecutable() &&
|
||||
// XXXben - we need to compare this with the running instance executable
|
||||
// just don't know how to do that via script...
|
||||
// XXXmano TBD: can probably add this to nsIShellService
|
||||
#ifdef XP_WIN
|
||||
#expand aExecutable.leafName != "__MOZ_APP_NAME__.exe";
|
||||
#else
|
||||
#ifdef XP_MACOSX
|
||||
#expand aExecutable.leafName != "__MOZ_APP_DISPLAYNAME__.app";
|
||||
#else
|
||||
#expand aExecutable.leafName != "__MOZ_APP_NAME__-bin";
|
||||
#endif
|
||||
#endif
|
||||
},
|
||||
|
||||
/**
|
||||
* Rebuild the actions menu for the selected entry. Gets called by
|
||||
* the richlistitem constructor when an entry in the list gets selected.
|
||||
@ -1091,7 +1212,7 @@ var gApplicationsPane = {
|
||||
var handlerInfo = this._handledTypes[typeItem.type];
|
||||
var menu =
|
||||
document.getAnonymousElementByAttribute(typeItem, "class", "actionsMenu");
|
||||
var menuPopup = menu.firstChild;
|
||||
var menuPopup = menu.menupopup;
|
||||
|
||||
// Clear out existing items.
|
||||
while (menuPopup.hasChildNodes())
|
||||
@ -1139,8 +1260,7 @@ var gApplicationsPane = {
|
||||
|
||||
// Create menu items for possible handlers.
|
||||
let preferredApp = handlerInfo.preferredApplicationHandler;
|
||||
let possibleApps = handlerInfo.possibleApplicationHandlers.
|
||||
QueryInterface(Ci.nsIArray).enumerate();
|
||||
let possibleApps = handlerInfo.possibleApplicationHandlers.enumerate();
|
||||
var possibleAppMenuItems = [];
|
||||
while (possibleApps.hasMoreElements()) {
|
||||
let possibleApp = possibleApps.getNext();
|
||||
@ -1248,23 +1368,24 @@ var gApplicationsPane = {
|
||||
else
|
||||
column.setAttribute("sortDirection", "ascending");
|
||||
|
||||
this.rebuildView();
|
||||
this._sortVisibleTypes();
|
||||
this._rebuildView();
|
||||
},
|
||||
|
||||
/**
|
||||
* Given an array of HandlerInfoWrapper objects, sort them according to
|
||||
* the current sort order. Used by rebuildView to sort the set of visible
|
||||
* types before building the list from them.
|
||||
* Sort the list of visible types by the current sort column/direction.
|
||||
*/
|
||||
_sortTypes: function(aTypes) {
|
||||
_sortVisibleTypes: function() {
|
||||
if (!this._sortColumn)
|
||||
return;
|
||||
|
||||
var t = this;
|
||||
|
||||
function sortByType(a, b) {
|
||||
return a.description.toLowerCase().localeCompare(b.description.toLowerCase());
|
||||
return t._describeType(a).toLowerCase().
|
||||
localeCompare(t._describeType(b).toLowerCase());
|
||||
}
|
||||
|
||||
var t = this;
|
||||
function sortByAction(a, b) {
|
||||
return t._describePreferredAction(a).toLowerCase().
|
||||
localeCompare(t._describePreferredAction(b).toLowerCase());
|
||||
@ -1272,15 +1393,15 @@ var gApplicationsPane = {
|
||||
|
||||
switch (this._sortColumn.getAttribute("value")) {
|
||||
case "type":
|
||||
aTypes.sort(sortByType);
|
||||
this._visibleTypes.sort(sortByType);
|
||||
break;
|
||||
case "action":
|
||||
aTypes.sort(sortByAction);
|
||||
this._visibleTypes.sort(sortByAction);
|
||||
break;
|
||||
}
|
||||
|
||||
if (this._sortColumn.getAttribute("sortDirection") == "descending")
|
||||
aTypes.reverse();
|
||||
this._visibleTypes.reverse();
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1292,7 +1413,7 @@ var gApplicationsPane = {
|
||||
return;
|
||||
}
|
||||
|
||||
this.rebuildView();
|
||||
this._rebuildView();
|
||||
|
||||
document.getElementById("clearFilter").disabled = false;
|
||||
},
|
||||
@ -1313,7 +1434,7 @@ var gApplicationsPane = {
|
||||
|
||||
clearFilter: function() {
|
||||
this._filter.value = "";
|
||||
this.rebuildView();
|
||||
this._rebuildView();
|
||||
|
||||
this._filter.focus();
|
||||
document.getElementById("clearFilter").disabled = true;
|
||||
@ -1328,16 +1449,15 @@ var gApplicationsPane = {
|
||||
//**************************************************************************//
|
||||
// Changes
|
||||
|
||||
onSelectAction: function(event) {
|
||||
var actionItem = event.originalTarget;
|
||||
onSelectAction: function(aActionItem) {
|
||||
var typeItem = this._list.selectedItem;
|
||||
var handlerInfo = this._handledTypes[typeItem.type];
|
||||
|
||||
if (actionItem.hasAttribute("alwaysAsk")) {
|
||||
if (aActionItem.hasAttribute("alwaysAsk")) {
|
||||
handlerInfo.alwaysAskBeforeHandling = true;
|
||||
}
|
||||
else if (actionItem.hasAttribute("action")) {
|
||||
let action = parseInt(actionItem.getAttribute("action"));
|
||||
else if (aActionItem.hasAttribute("action")) {
|
||||
let action = parseInt(aActionItem.getAttribute("action"));
|
||||
|
||||
// Set the plugin state if we're enabling or disabling a plugin.
|
||||
if (action == kActionUsePlugin)
|
||||
@ -1352,7 +1472,7 @@ var gApplicationsPane = {
|
||||
// of possible apps still include the preferred app in the list of apps
|
||||
// the user can choose to handle the type.
|
||||
if (action == Ci.nsIHandlerInfo.useHelperApp)
|
||||
handlerInfo.preferredApplicationHandler = actionItem.handlerApp;
|
||||
handlerInfo.preferredApplicationHandler = aActionItem.handlerApp;
|
||||
|
||||
// Set the "always ask" flag.
|
||||
handlerInfo.alwaysAskBeforeHandling = false;
|
||||
@ -1363,6 +1483,10 @@ var gApplicationsPane = {
|
||||
|
||||
handlerInfo.store();
|
||||
|
||||
// Make sure the handler info object is flagged to indicate that there is
|
||||
// now some user configuration for the type.
|
||||
handlerInfo.handledOnlyByPlugin = false;
|
||||
|
||||
// Update the action label and image to reflect the new preferred action.
|
||||
typeItem.setAttribute("actionDescription",
|
||||
this._describePreferredAction(handlerInfo));
|
||||
@ -1380,39 +1504,42 @@ var gApplicationsPane = {
|
||||
fp.init(window, winTitle, Ci.nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(Ci.nsIFilePicker.filterApps);
|
||||
|
||||
if (fp.show() == Ci.nsIFilePicker.returnOK && fp.file) {
|
||||
// XXXben - we need to compare this with the running instance executable
|
||||
// just don't know how to do that via script...
|
||||
// XXXmano TBD: can probably add this to nsIShellService
|
||||
#ifdef XP_WIN
|
||||
#expand if (fp.file.leafName == "__MOZ_APP_NAME__.exe")
|
||||
#else
|
||||
#ifdef XP_MACOSX
|
||||
#expand if (fp.file.leafName == "__MOZ_APP_DISPLAYNAME__.app")
|
||||
#else
|
||||
#expand if (fp.file.leafName == "__MOZ_APP_NAME__-bin")
|
||||
#endif
|
||||
#endif
|
||||
{ this.rebuildActionsMenu(); return; }
|
||||
var handlerApp;
|
||||
|
||||
let handlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"].
|
||||
createInstance(Ci.nsIHandlerApp);
|
||||
// Prompt the user to pick an app. If they pick one, and it's a valid
|
||||
// selection, then add it to the list of possible handlers.
|
||||
if (fp.show() == Ci.nsIFilePicker.returnOK && fp.file &&
|
||||
this._isValidHandlerExecutable(fp.file)) {
|
||||
handlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"].
|
||||
createInstance(Ci.nsILocalHandlerApp);
|
||||
handlerApp.name = getDisplayNameForFile(fp.file);
|
||||
handlerApp.QueryInterface(Ci.nsILocalHandlerApp);
|
||||
handlerApp.executable = fp.file;
|
||||
|
||||
var handlerInfo = this._handledTypes[this._list.selectedItem.type];
|
||||
|
||||
handlerInfo.preferredApplicationHandler = handlerApp;
|
||||
handlerInfo.preferredAction = Ci.nsIHandlerInfo.useHelperApp;
|
||||
|
||||
handlerInfo.store();
|
||||
// Add the app to the type's list of possible handlers.
|
||||
let handlerInfo = this._handledTypes[this._list.selectedItem.type];
|
||||
handlerInfo.possibleApplicationHandlers.appendElement(handlerApp, false);
|
||||
}
|
||||
|
||||
// We rebuild the actions menu whether the user picked an app or canceled.
|
||||
// Rebuild the actions menu whether the user picked an app or canceled.
|
||||
// If they picked an app, we want to add the app to the menu and select it.
|
||||
// If they canceled, we want to go back to their previous selection.
|
||||
this.rebuildActionsMenu();
|
||||
|
||||
// If the user picked a new app from the menu, select it.
|
||||
if (handlerApp) {
|
||||
let typeItem = this._list.selectedItem;
|
||||
let actionsMenu =
|
||||
document.getAnonymousElementByAttribute(typeItem, "class", "actionsMenu");
|
||||
let menuItems = actionsMenu.menupopup.childNodes;
|
||||
for (let i = 0; i < menuItems.length; i++) {
|
||||
let menuItem = menuItems[i];
|
||||
if (menuItem.handlerApp && menuItem.handlerApp.equals(handlerApp)) {
|
||||
actionsMenu.selectedIndex = i;
|
||||
this.onSelectAction(menuItem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Mark which item in the list was last selected so we can reselect it
|
||||
|
@ -262,6 +262,16 @@ var gContentPane = {
|
||||
{
|
||||
document.documentElement.openSubDialog("chrome://browser/content/preferences/colors.xul",
|
||||
"", null);
|
||||
}
|
||||
},
|
||||
|
||||
// LANGUAGES
|
||||
|
||||
/**
|
||||
* Shows a dialog in which the preferred language for web content may be set.
|
||||
*/
|
||||
showLanguages: function ()
|
||||
{
|
||||
document.documentElement.openSubDialog("chrome://browser/content/preferences/languages.xul",
|
||||
"", null);
|
||||
}
|
||||
};
|
||||
|
@ -202,6 +202,19 @@
|
||||
</grid>
|
||||
</groupbox>
|
||||
|
||||
<!-- Languages -->
|
||||
<groupbox id="languagesGroup">
|
||||
<caption label="&languages.label;"/>
|
||||
|
||||
<hbox id="languagesBox" align="center">
|
||||
<description flex="1" control="chooseLanguage">&chooseLanguage.label;</description>
|
||||
<button id="chooseLanguage"
|
||||
label="&chooseButton.label;"
|
||||
accesskey="&chooseButton.accesskey;"
|
||||
oncommand="gContentPane.showLanguages();"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
|
||||
</prefpane>
|
||||
|
||||
</overlay>
|
||||
|
@ -84,7 +84,7 @@
|
||||
</xul:hbox>
|
||||
<xul:hbox flex="1">
|
||||
<xul:menulist class="actionsMenu" flex="1" crop="end" selectedIndex="1"
|
||||
oncommand="gApplicationsPane.onSelectAction(event)">
|
||||
oncommand="gApplicationsPane.onSelectAction(event.originalTarget)">
|
||||
<xul:menupopup/>
|
||||
</xul:menulist>
|
||||
</xul:hbox>
|
||||
|
@ -59,10 +59,13 @@
|
||||
name="pref.privacy.disable_button.view_passwords_exceptions"
|
||||
type="bool"/>
|
||||
|
||||
<!-- Add-ons, phishing -->
|
||||
<!-- Add-ons, malware, phishing -->
|
||||
<preference id="xpinstall.whitelist.required"
|
||||
name="xpinstall.whitelist.required"
|
||||
type="bool"/>
|
||||
<preference id="browser.safebrowsing.malware.enabled"
|
||||
name="browser.safebrowsing.malware.enabled"
|
||||
type="bool"/>
|
||||
<preference id="browser.safebrowsing.enabled"
|
||||
name="browser.safebrowsing.enabled"
|
||||
type="bool"
|
||||
@ -99,7 +102,10 @@
|
||||
</hbox>
|
||||
|
||||
<separator class="thin"/>
|
||||
|
||||
<checkbox id="tellMaybeAttackSite"
|
||||
label="&tellMaybeAttackSite.label;"
|
||||
accesskey="&tellMaybeAttackSite.accesskey;"
|
||||
preference="browser.safebrowsing.malware.enabled" />
|
||||
<checkbox id="tellMaybeForgery"
|
||||
label="&tellMaybeForgery.label;"
|
||||
accesskey="&tellMaybeForgery.accesskey;"
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
<tree id="bookmarks" flex="1" type="places"
|
||||
style="height: 15em;"
|
||||
place="place:folder=2&group=3&excludeQueries=1"
|
||||
place="place:folder=2&excludeQueries=1"
|
||||
hidecolumnpicker="true"
|
||||
seltype="single"
|
||||
ondblclick="SelectBookmarkDialog.onItemDblClick();"
|
||||
|
@ -805,8 +805,8 @@ SessionStoreService.prototype = {
|
||||
tabs.push(browser.parentNode.__SS_data);
|
||||
continue;
|
||||
}
|
||||
|
||||
var history = null;
|
||||
|
||||
try {
|
||||
history = browser.sessionHistory;
|
||||
}
|
||||
@ -828,22 +828,28 @@ SessionStoreService.prototype = {
|
||||
tabData.entries[0] = { url: browser.currentURI.spec };
|
||||
tabData.index = 1;
|
||||
}
|
||||
|
||||
tabData.zoom = browser.markupDocumentViewer.textZoom;
|
||||
|
||||
var disallow = CAPABILITIES.filter(function(aCapability) {
|
||||
return !browser.docShell["allow" + aCapability];
|
||||
});
|
||||
tabData.disallow = disallow.join(",");
|
||||
var disallow = [];
|
||||
for (let i = 0; i < CAPABILITIES.length; i++) {
|
||||
if (!browser.docShell["allow" + CAPABILITIES[i]])
|
||||
disallow.push(CAPABILITIES[i]);
|
||||
}
|
||||
if (disallow.length != 0)
|
||||
tabData.disallow = disallow.join(",");
|
||||
|
||||
var _this = this;
|
||||
var xulattr = Array.filter(tabbrowser.mTabs[i].attributes, function(aAttr) {
|
||||
return (_this.xulAttributes.indexOf(aAttr.name) > -1);
|
||||
}).map(function(aAttr) {
|
||||
return aAttr.name + "=" + encodeURI(aAttr.value);
|
||||
});
|
||||
tabData.xultab = xulattr.join(" ");
|
||||
if (this.xulAttributes.length != 0) {
|
||||
var xulattr = Array.filter(tabbrowser.mTabs[i].attributes, function(aAttr) {
|
||||
return (this.xulAttributes.indexOf(aAttr.name) > -1);
|
||||
}, this).map(function(aAttr) {
|
||||
return aAttr.name + "=" + encodeURI(aAttr.value);
|
||||
});
|
||||
tabData.xultab = xulattr.join(" ");
|
||||
}
|
||||
|
||||
tabData.extData = tabbrowser.mTabs[i].__SS_extdata || null;
|
||||
if (tabbrowser.mTabs[i].__SS_extdata)
|
||||
tabData.extData = tabbrowser.mTabs[i].__SS_extdata;
|
||||
|
||||
tabs.push(tabData);
|
||||
|
||||
@ -861,7 +867,7 @@ SessionStoreService.prototype = {
|
||||
* @returns object
|
||||
*/
|
||||
_serializeHistoryEntry: function sss_serializeHistoryEntry(aEntry) {
|
||||
var entry = { url: aEntry.URI.spec, children: [] };
|
||||
var entry = { url: aEntry.URI.spec };
|
||||
|
||||
if (aEntry.title && aEntry.title != entry.url) {
|
||||
entry.title = aEntry.title;
|
||||
@ -874,18 +880,21 @@ SessionStoreService.prototype = {
|
||||
}
|
||||
|
||||
var cacheKey = aEntry.cacheKey;
|
||||
if (cacheKey && cacheKey instanceof Ci.nsISupportsPRUint32) {
|
||||
if (cacheKey && cacheKey instanceof Ci.nsISupportsPRUint32 &&
|
||||
cacheKey.data != 0) {
|
||||
// XXXbz would be better to have cache keys implement
|
||||
// nsISerializable or something.
|
||||
entry.cacheKey = cacheKey.data;
|
||||
}
|
||||
entry.ID = aEntry.ID;
|
||||
|
||||
entry.contentType = aEntry.contentType;
|
||||
if (aEntry.contentType)
|
||||
entry.contentType = aEntry.contentType;
|
||||
|
||||
var x = {}, y = {};
|
||||
aEntry.getScrollPosition(x, y);
|
||||
entry.scroll = x.value + "," + y.value;
|
||||
if (x.value != 0 || y.value != 0)
|
||||
entry.scroll = x.value + "," + y.value;
|
||||
|
||||
try {
|
||||
var prefPostdata = this._prefBranch.getIntPref("sessionstore.postdata");
|
||||
@ -939,13 +948,16 @@ SessionStoreService.prototype = {
|
||||
return entry;
|
||||
}
|
||||
|
||||
for (var i = 0; i < aEntry.childCount; i++) {
|
||||
var child = aEntry.GetChildAt(i);
|
||||
if (child) {
|
||||
entry.children.push(this._serializeHistoryEntry(child));
|
||||
}
|
||||
else { // to maintain the correct frame order, insert a dummy entry
|
||||
entry.children.push({ url: "about:blank" });
|
||||
if (aEntry.childCount > 0) {
|
||||
entry.children = [];
|
||||
for (var i = 0; i < aEntry.childCount; i++) {
|
||||
var child = aEntry.GetChildAt(i);
|
||||
if (child) {
|
||||
entry.children.push(this._serializeHistoryEntry(child));
|
||||
}
|
||||
else { // to maintain the correct frame order, insert a dummy entry
|
||||
entry.children.push({ url: "about:blank" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1049,7 +1061,8 @@ SessionStoreService.prototype = {
|
||||
if (aBrowser.currentURI.spec == "about:config") {
|
||||
text = ["#textbox=" + encodeURI(aBrowser.contentDocument.getElementById("textbox").wrappedJSObject.value)];
|
||||
}
|
||||
tabData.text = text.join(" ");
|
||||
if (text.length != 0)
|
||||
tabData.text = text.join(" ");
|
||||
|
||||
updateRecursively(aBrowser.contentWindow, tabData.entries[tabData.index - 1]);
|
||||
}
|
||||
@ -1139,14 +1152,29 @@ SessionStoreService.prototype = {
|
||||
var winData = this._windows[aWindow.__SSi];
|
||||
|
||||
WINDOW_ATTRIBUTES.forEach(function(aAttr) {
|
||||
winData[aAttr] = this._getWindowDimension(aWindow, aAttr);
|
||||
var value = this._getWindowDimension(aWindow, aAttr);
|
||||
switch (aAttr) {
|
||||
case "screenX":
|
||||
case "screenY":
|
||||
if (value != 0)
|
||||
winData[aAttr] = value;
|
||||
break;
|
||||
default:
|
||||
winData[aAttr] = value;
|
||||
}
|
||||
}, this);
|
||||
|
||||
winData.hidden = WINDOW_HIDEABLE_FEATURES.filter(function(aItem) {
|
||||
return aWindow[aItem] && !aWindow[aItem].visible;
|
||||
}).join(",");
|
||||
|
||||
winData.sidebar = aWindow.document.getElementById("sidebar-box").getAttribute("sidebarcommand");
|
||||
var hidden = [];
|
||||
WINDOW_HIDEABLE_FEATURES.forEach(function(aItem) {
|
||||
if (aWindow[aItem] && !aWindow[aItem].visible)
|
||||
hidden.push(aItem);
|
||||
});
|
||||
if (hidden.length != 0)
|
||||
winData.hidden = hidden.join(",");
|
||||
|
||||
var sidebar = aWindow.document.getElementById("sidebar-box").getAttribute("sidebarcommand");
|
||||
if (sidebar)
|
||||
winData.sidebar = sidebar;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1468,9 +1496,11 @@ SessionStoreService.prototype = {
|
||||
getService(Ci.nsIIOService);
|
||||
shEntry.setURI(ioService.newURI(aEntry.url, null, null));
|
||||
shEntry.setTitle(aEntry.title || aEntry.url);
|
||||
shEntry.setIsSubFrame(aEntry.subframe || false);
|
||||
if (aEntry.subframe)
|
||||
shEntry.setIsSubFrame(aEntry.subframe || false);
|
||||
shEntry.loadType = Ci.nsIDocShellLoadInfo.loadHistory;
|
||||
shEntry.contentType = aEntry.contentType;
|
||||
if (aEntry.contentType)
|
||||
shEntry.contentType = aEntry.contentType;
|
||||
|
||||
if (aEntry.cacheKey) {
|
||||
var cacheKey = Cc["@mozilla.org/supports-PRUint32;1"].
|
||||
@ -1478,6 +1508,7 @@ SessionStoreService.prototype = {
|
||||
cacheKey.data = aEntry.cacheKey;
|
||||
shEntry.cacheKey = cacheKey;
|
||||
}
|
||||
|
||||
if (aEntry.ID) {
|
||||
// get a new unique ID for this frame (since the one from the last
|
||||
// start might already be in use)
|
||||
@ -1490,9 +1521,11 @@ SessionStoreService.prototype = {
|
||||
shEntry.ID = id;
|
||||
}
|
||||
|
||||
var scrollPos = (aEntry.scroll || "0,0").split(",");
|
||||
scrollPos = [parseInt(scrollPos[0]) || 0, parseInt(scrollPos[1]) || 0];
|
||||
shEntry.setScrollPosition(scrollPos[0], scrollPos[1]);
|
||||
if (aEntry.scroll) {
|
||||
var scrollPos = (aEntry.scroll || "0,0").split(",");
|
||||
scrollPos = [parseInt(scrollPos[0]) || 0, parseInt(scrollPos[1]) || 0];
|
||||
shEntry.setScrollPosition(scrollPos[0], scrollPos[1]);
|
||||
}
|
||||
|
||||
var postdata;
|
||||
if (aEntry.postdata_b64) { // Firefox 3
|
||||
|
@ -34,12 +34,15 @@ bin\js3250.dll
|
||||
bin\plc4.dll
|
||||
bin\plds4.dll
|
||||
bin\xpcom.dll
|
||||
bin\nspr4.dll
|
||||
#ifdef MOZ_ENABLE_LIBXUL
|
||||
bin\xul.dll
|
||||
#else
|
||||
bin\xpcom_core.dll
|
||||
bin\xpistub.dll
|
||||
bin\nspr4.dll
|
||||
bin\xul.dll
|
||||
bin\components\xpinstal.dll
|
||||
bin\components\jar50.dll
|
||||
#endif
|
||||
bin\Microsoft.VC80.CRT.manifest
|
||||
bin\msvcm80.dll
|
||||
bin\msvcp80.dll
|
||||
@ -121,7 +124,9 @@ bin\components\imgicon.xpt
|
||||
bin\components\intl.xpt
|
||||
bin\components\jar.xpt
|
||||
bin\components\jsconsole-clhandler.js
|
||||
#ifndef MOZ_ENABLE_LIBXUL
|
||||
bin\components\jsd3250.dll
|
||||
#endif
|
||||
bin\components\jsdservice.xpt
|
||||
bin\components\layout_base.xpt
|
||||
bin\components\layout_printing.xpt
|
||||
@ -154,28 +159,24 @@ bin\components\plugin.xpt
|
||||
bin\components\pref.xpt
|
||||
bin\components\prefetch.xpt
|
||||
bin\components\profile.xpt
|
||||
bin\components\progressDlg.xpt
|
||||
bin\components\proxyObject.xpt
|
||||
bin\components\rdf.xpt
|
||||
bin\components\satchel.xpt
|
||||
bin\components\saxparser.xpt
|
||||
bin\components\shistory.xpt
|
||||
bin\components\signonviewer.xpt
|
||||
bin\components\storage.xpt
|
||||
bin\components\toolkitprofile.xpt
|
||||
bin\components\txtsvc.xpt
|
||||
bin\components\txmgr.xpt
|
||||
#ifdef MOZ_USE_NATIVE_UCONV
|
||||
bin\components\ucnative.xpt
|
||||
#endif
|
||||
bin\components\uconv.xpt
|
||||
bin\components\unicharutil.xpt
|
||||
bin\components\uriloader.xpt
|
||||
bin\components\wallet.xpt
|
||||
bin\components\walleteditor.xpt
|
||||
bin\components\walletpreview.xpt
|
||||
bin\components\webBrowser_core.xpt
|
||||
bin\components\webbrowserpersist.xpt
|
||||
bin\components\webshell_idls.xpt
|
||||
bin\components\websrvcs.xpt
|
||||
bin\components\widget.xpt
|
||||
bin\components\windowds.xpt
|
||||
bin\components\windowwatcher.xpt
|
||||
@ -203,7 +204,6 @@ bin\components\nsBrowserContentHandler.js
|
||||
bin\components\nsBrowserGlue.js
|
||||
bin\components\nsSetDefaultBrowser.js
|
||||
bin\components\nsTryToClose.js
|
||||
bin\components\nsDictionary.js
|
||||
bin\components\nsHelperAppDlg.js
|
||||
bin\components\nsDownloadManagerUI.js
|
||||
bin\components\nsProxyAutoConfig.js
|
||||
|
@ -167,18 +167,13 @@
|
||||
<!ENTITY viewSidebarMenu.label "Sidebar">
|
||||
<!ENTITY viewSidebarMenu.accesskey "e">
|
||||
<!ENTITY viewCustomizeToolbar.label "Customize...">
|
||||
<!ENTITY viewCustomizeToolbar.accesskey "C">
|
||||
<!ENTITY viewCustomizeToolbar.accesskey "C">
|
||||
|
||||
<!-- XXX historyMenu entities are used with or without places (bug 336058) -->
|
||||
<!ENTITY historyMenu.label "History">
|
||||
<!ENTITY historyMenu.accesskey "s">
|
||||
<!ENTITY historyUndoMenu.label "Recently Closed Tabs">
|
||||
|
||||
<!-- XXX places only -->
|
||||
<!ENTITY historyHomeCmd.label "Home">
|
||||
<!-- XXX remove below if places sticks -->
|
||||
<!ENTITY goHomeCmd.label "Home">
|
||||
<!-- XXX remove above if places sticks -->
|
||||
<!ENTITY historyShowSidebarCmd.label "Show in Sidebar">
|
||||
|
||||
<!ENTITY openCmd.commandkey "l">
|
||||
|
@ -209,5 +209,4 @@
|
||||
<!ENTITY detailsPane.more.label "More">
|
||||
<!ENTITY detailsPane.less.label "Less">
|
||||
<!ENTITY detailsPane.noPreviewAvailable.label "Preview">
|
||||
<!ENTITY detailsPane.selectAnItemText.description
|
||||
"Select an item to view and edit its properties">
|
||||
<!ENTITY detailsPane.selectAnItemText.description "Select an item to view and edit its properties">
|
||||
|
@ -97,3 +97,11 @@ saveSearch.defaultText=New Query
|
||||
detailsPane.noItems=No items
|
||||
detailsPane.oneItem=One item
|
||||
detailsPane.multipleItems=%S items
|
||||
|
||||
placesFolderTitle=Places
|
||||
recentlyCreatedBookmarksTitle=Recently Starred Pages
|
||||
recentlyVisitedBookmarksTitle=Recently Visited Starred Pages
|
||||
mostVisitedBookmarksTitle=Most Visited Starred Pages
|
||||
recentlyUsedTagsTitle=Recently Used Tags
|
||||
mostUsedTagsTitle=Most Used Tags
|
||||
mostVisitedSitesTitle=Most Visited Pages
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!-- Note: due to bug 143065, the only remaining accesskeys available to be used
|
||||
in the Advanced pane are: "j", "q", "z" -->
|
||||
in the Advanced pane are: "j", "o", "q", "z" -->
|
||||
|
||||
<!ENTITY generalTab.label "General">
|
||||
|
||||
@ -21,13 +21,6 @@
|
||||
<!ENTITY checkSpelling.label "Check my spelling as I type">
|
||||
<!ENTITY checkSpelling.accesskey "t">
|
||||
|
||||
<!ENTITY languages.label "Languages">
|
||||
|
||||
<!ENTITY chooseLanguage.label "Choose your preferred language for displaying pages">
|
||||
<!ENTITY chooseButton.label "Choose...">
|
||||
<!ENTITY chooseButton.accesskey "o">
|
||||
|
||||
|
||||
<!ENTITY networkTab.label "Network">
|
||||
|
||||
<!ENTITY connection.label "Connection">
|
||||
|
@ -29,3 +29,9 @@
|
||||
|
||||
<!ENTITY colors.label "Colors...">
|
||||
<!ENTITY colors.accesskey "C">
|
||||
|
||||
|
||||
<!ENTITY languages.label "Languages">
|
||||
<!ENTITY chooseLanguage.label "Choose your preferred language for displaying pages">
|
||||
<!ENTITY chooseButton.label "Choose...">
|
||||
<!ENTITY chooseButton.accesskey "o">
|
||||
|
@ -61,6 +61,11 @@ pluginName=%S (in %S)
|
||||
previewInApp=Preview in %S
|
||||
liveBookmarksInApp=Live Bookmarks in %S
|
||||
|
||||
# LOCALIZATION NOTE (typeDescriptionWithType):
|
||||
# %1$S = type description (for example "Portable Document Format")
|
||||
# %2$S = type (for example "application/pdf")
|
||||
typeDescriptionWithType=%S (%S)
|
||||
|
||||
|
||||
#### Cookie Viewer
|
||||
|
||||
|
@ -1,13 +1,16 @@
|
||||
<!ENTITY warnAddonInstall.label "Warn me when sites try to install add-ons">
|
||||
<!ENTITY warnAddonInstall.accesskey "W">
|
||||
|
||||
<!-- LOCALIZATION NOTE (tellMaybeForgery.label):
|
||||
The methods by which forged (phished) sites will be detected by phishing
|
||||
providers will vary from human review to machine-based heuristics to a
|
||||
combination of both, so it's important that this string and
|
||||
<!-- LOCALIZATION NOTE (tellMaybeForgery.label, tellMaybeAttackSite.label):
|
||||
The methods by which forged (phished) and attack sites will be detected by
|
||||
phishing providers will vary from human review to machine-based heuristics to a
|
||||
combination of both, so it's important that these strings and
|
||||
useDownloadedList.label convey the meaning "suspected" (and not something like
|
||||
"known").
|
||||
-->
|
||||
<!ENTITY tellMaybeAttackSite.label "Tell me if the site I'm visiting is a suspected attack site">
|
||||
<!ENTITY tellMaybeAttackSite.accesskey "k">
|
||||
|
||||
<!ENTITY tellMaybeForgery.label "Tell me if the site I'm visiting is a suspected forgery">
|
||||
<!ENTITY tellMaybeForgery.accesskey "T">
|
||||
|
||||
|
@ -279,6 +279,18 @@ Contributors:
|
||||
author. Disabling this &pref.singular; will force all sites to use your
|
||||
default colors instead.</p>
|
||||
|
||||
<h3 id="languages">Languages</h3>
|
||||
<p>Some web pages are offered in more than one language. Click the
|
||||
<em>Choose...</em> button to specify your preferred language or
|
||||
languages.</p>
|
||||
|
||||
<p><strong>Languages Dialog</strong><br/>
|
||||
To add a language, click <em>Select a language to add...</em>, choose the
|
||||
language, and click the <em>Add</em> button. Remove a language by
|
||||
selecting it in the list of active languages and clicking the
|
||||
<em>Remove</em> button. You can also reorder languages using the <em>Move
|
||||
Up</em> and <em>Move Down</em> buttons to determine the most preferred one
|
||||
in case a page is provided in multiple languages .</p>
|
||||
|
||||
<h2 id="applications_options">Applications &pref.pluralCaps;</h2>
|
||||
|
||||
@ -536,19 +548,6 @@ Contributors:
|
||||
then use the provided <span class="menuPath">Languages</span> menu to
|
||||
download a dictionary.</p>
|
||||
|
||||
<h4 id="languages">Languages</h4>
|
||||
<p>Some web pages are offered in more than one language. Click the
|
||||
<em>Choose...</em> button to specify your preferred language or
|
||||
languages.</p>
|
||||
|
||||
<p><strong>Languages Dialog</strong><br/>
|
||||
To add a language, click <em>Select a language to add...</em>, choose the
|
||||
language, and click the <em>Add</em> button. Remove a language by
|
||||
selecting it in the list of active languages and clicking the
|
||||
<em>Remove</em> button. You can also reorder languages using the <em>Move
|
||||
Up</em> and <em>Move Down</em> buttons to determine the most preferred one
|
||||
in case a page is provided in multiple languages .</p>
|
||||
|
||||
<h3 id="advanced_network">Network tab</h3>
|
||||
|
||||
<h4 id="connection_settings">Connection</h4>
|
||||
@ -652,16 +651,19 @@ Contributors:
|
||||
sites.</p>
|
||||
|
||||
<h4 id="certificates">Certificates</h4>
|
||||
<p>Certificates help perform encryption and decryption of connections to
|
||||
<a href="glossary.xhtml#secure_site">secure sites</a>.</p>
|
||||
<p><a href="glossary.xhtml#certificate">Certificates</a> help perform
|
||||
encryption and decryption of connections to <a
|
||||
href="glossary.xhtml#secure_site">secure sites</a>.</p>
|
||||
|
||||
<p><em>When a web site requires a certificate:</em><br/>
|
||||
When a web site requests a secure connection, &brandShortName; will by
|
||||
default automatically use an appropriate certificate. If you wish to
|
||||
manually choose a certificate (for example, if you wish to use a certain
|
||||
type of encryption instead of what is automatically selected), select the
|
||||
&pref.singular; <em>Ask me every time</em> and you'll be in complete
|
||||
control of what certificates you use while browsing.</p>
|
||||
Some servers ask you to identify yourself with a personal certificate. In
|
||||
order to do so, they ask &brandShortName; to generate one for you. When
|
||||
you visit the site in the future, &brandShortName; selects the certificate
|
||||
without asking you by default. If you wish to manually choose a
|
||||
certificate (for example, if you have multiple certificates stored for
|
||||
multiple web sites), select the <em>Ask me every time</em> &pref.singular;
|
||||
and you'll be in complete control of what certificates are being sent to
|
||||
web sites while browsing.</p>
|
||||
|
||||
<p><em>View Certificates</em><br/>
|
||||
Click this button to view stored certificates, import new certificates,
|
||||
@ -673,12 +675,14 @@ Contributors:
|
||||
<em>Revocation Lists</em> button to manage the CRLs installed on your
|
||||
computer.</p>
|
||||
|
||||
<p><em>Verification</em><br/>
|
||||
&brandShortName; verify the validity of your certificates using OCSP
|
||||
(Online Certificate Status Protocol) every time they are viewed or used.
|
||||
&brandShortName; does not use OCSP by default, but if you want to enable
|
||||
it, you can do so here. You will most likely only need to change this if
|
||||
your Internet environment requires it.</p>
|
||||
<p><em>Validation</em><br/>
|
||||
&brandShortName; may ask an OCSP (Online Certificate Status Protocol)
|
||||
server to confirm that a certificate is still valid. By default,
|
||||
&brandShortName; validates a certificate if the certificate provides an
|
||||
OCSP server. Alternately, you can choose an OCSP server against which to
|
||||
validate all certificates. Click the <em>Validation</em> button to manage
|
||||
these &pref.plural;. You will most likely only need to change this if your
|
||||
Internet environment requires it.</p>
|
||||
|
||||
<p><em>Security Devices</em><br/>
|
||||
Security devices can encrypt and decrypt connections and store
|
||||
@ -686,7 +690,7 @@ Contributors:
|
||||
than the one in &brandShortName;, click the <em>Security Devices</em>
|
||||
button.</p>
|
||||
|
||||
<div class="contentsBox"><em>07 October 2007</em></div>
|
||||
<div class="contentsBox"><em>09 October 2007</em></div>
|
||||
<p>Copyright © ©right.years; Contributors to the Mozilla Help Viewer Project.</p>
|
||||
|
||||
</body>
|
||||
|
@ -136,6 +136,14 @@ Sanitizer.prototype = {
|
||||
os.notifyObservers(null, "browser:purge-session-history", "");
|
||||
}
|
||||
catch (e) { }
|
||||
|
||||
// Clear last URL of the Open Web Location dialog
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch2);
|
||||
try {
|
||||
prefs.clearUserPref("general.open_location.last_url");
|
||||
}
|
||||
catch (e) { }
|
||||
},
|
||||
|
||||
get canClear()
|
||||
|
@ -70,6 +70,10 @@
|
||||
list-style-image: url("chrome://global/skin/tree/folder.png");
|
||||
}
|
||||
|
||||
.query-item[container] {
|
||||
list-style-image: url("chrome://browser/skin/places/query.png");
|
||||
}
|
||||
|
||||
toolbarbutton.bookmark-item:hover
|
||||
{
|
||||
background: url("chrome://global/skin/toolbar/toolbarbutton-customhover-left.png") no-repeat left center;
|
||||
|
@ -242,6 +242,12 @@ menuitem.bookmark-item {
|
||||
-moz-image-region: rect(16px, 32px, 32px, 16px) !important;
|
||||
}
|
||||
|
||||
/* ::::: query items ::::: */
|
||||
|
||||
.query-item[container] {
|
||||
list-style-image: url("chrome://browser/skin/places/query.png");
|
||||
}
|
||||
|
||||
/* ::::: primary toolbar buttons ::::: */
|
||||
|
||||
.toolbarbutton-1 {
|
||||
|
@ -1,3 +1,15 @@
|
||||
/* Sidebars */
|
||||
|
||||
page > .placesTree > treechildren::-moz-tree-cell(leaf) ,
|
||||
page > .placesTree > treechildren::-moz-tree-image(leaf) {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
page > .placesTree > treechildren::-moz-tree-cell-text(leaf, hover) {
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* Toolbar */
|
||||
#placesToolbar {
|
||||
border: none;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
NSPR_CO_TAG = 'NSPR_HEAD_20070820'
|
||||
NSS_CO_TAG = 'NSS_3_12_ALPHA1B'
|
||||
NSPR_CO_TAG = 'NSPR_HEAD_20071009'
|
||||
NSS_CO_TAG = 'NSS_3_12_ALPHA_2'
|
||||
|
||||
NSPR_DIRS = ('nsprpub',)
|
||||
NSS_DIRS = ('dbm',
|
||||
|
@ -76,6 +76,8 @@ else
|
||||
LIBXUL_DIST = $(DIST)
|
||||
endif
|
||||
|
||||
XULRUNNER_STUB_NAME = @XULRUNNER_STUB_NAME@
|
||||
|
||||
MOZ_CHROME_FILE_FORMAT = @MOZ_CHROME_FILE_FORMAT@
|
||||
|
||||
MOZ_WIDGET_TOOLKIT = @MOZ_WIDGET_TOOLKIT@
|
||||
@ -587,6 +589,7 @@ GCC_VERSION = @GCC_VERSION@
|
||||
XCODEBUILD_VERSION= @XCODEBUILD_VERSION@
|
||||
HAS_XCODE_2_1 = @HAS_XCODE_2_1@
|
||||
UNIVERSAL_BINARY= @UNIVERSAL_BINARY@
|
||||
HAVE_DTRACE= @HAVE_DTRACE@
|
||||
|
||||
VISIBILITY_FLAGS = @VISIBILITY_FLAGS@
|
||||
WRAP_SYSTEM_INCLUDES = @WRAP_SYSTEM_INCLUDES@
|
||||
|
@ -531,7 +531,7 @@ endif
|
||||
|
||||
CFLAGS = $(OS_CFLAGS)
|
||||
CXXFLAGS = $(OS_CXXFLAGS)
|
||||
LDFLAGS = $(OS_LDFLAGS)
|
||||
LDFLAGS = $(OS_LDFLAGS) $(MOZ_FIX_LINK_PATHS)
|
||||
|
||||
# Allow each module to override the *default* optimization settings
|
||||
# by setting MODULE_OPTIMIZE_FLAGS if the developer has not given
|
||||
|
@ -307,6 +307,8 @@ endif
|
||||
|
||||
ALL_TRASH = \
|
||||
$(GARBAGE) $(TARGETS) $(OBJS) $(PROGOBJS) LOGS TAGS a.out \
|
||||
$(OBJS:.$(OBJ_SUFFIX)=.s) $(OBJS:.$(OBJ_SUFFIX)=.ii) \
|
||||
$(OBJS:.$(OBJ_SUFFIX)=.i) \
|
||||
$(HOST_PROGOBJS) $(HOST_OBJS) $(IMPORT_LIBRARY) $(DEF_FILE)\
|
||||
$(EXE_DEF_FILE) so_locations _gen _stubs $(wildcard *.res) $(wildcard *.RES) \
|
||||
$(wildcard *.pdb) $(CODFILE) $(MAPFILE) $(IMPORT_LIBRARY) \
|
||||
@ -981,6 +983,12 @@ endif
|
||||
SUB_LOBJS = $(shell for lib in $(SHARED_LIBRARY_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;)
|
||||
endif
|
||||
endif
|
||||
ifdef MOZILLA_PROBE_LIBS
|
||||
PROBE_LOBJS = $(shell for lib in $(MOZILLA_PROBE_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;)
|
||||
endif
|
||||
ifdef DTRACE_PROBE_OBJ
|
||||
EXTRA_DEPS += $(DTRACE_PROBE_OBJ)
|
||||
endif
|
||||
|
||||
$(LIBRARY): $(OBJS) $(LOBJS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DEPS) Makefile Makefile.in
|
||||
rm -f $@
|
||||
@ -1070,7 +1078,26 @@ ifdef SHARED_LIBRARY_LIBS
|
||||
@for lib in $(SHARED_LIBRARY_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
|
||||
endif # SHARED_LIBRARY_LIBS
|
||||
endif # NO_LD_ARCHIVE_FLAGS
|
||||
$(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
|
||||
ifdef NEED_DTRACE_PROBE_OBJ
|
||||
@rm -f $(PROBE_LOBJS)
|
||||
@for lib in $(MOZILLA_PROBE_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
|
||||
dtrace -G -C -32 -s $(MOZILLA_DTRACE_SRC) -o $(NEED_DTRACE_PROBE_OBJ) $(PROBE_LOBJS)
|
||||
@for lib in $(MOZILLA_PROBE_LIBS); do \
|
||||
ofiles=`$(AR_LIST) $${lib}`; \
|
||||
$(AR_DELETE) $${lib} $$ofiles; \
|
||||
done
|
||||
$(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(NEED_DTRACE_PROBE_OBJ) $(PROBE_LOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
|
||||
@rm -f $(PROBE_LOBJS)
|
||||
@rm -f $(NEED_DTRACE_PROBE_OBJ)
|
||||
@for lib in $(MOZILLA_PROBE_LIBS); do \
|
||||
if [ -L $${lib} ]; then rm -f `readlink $${lib}`; fi; \
|
||||
done
|
||||
@rm -f $(MOZILLA_PROBE_LIBS)
|
||||
|
||||
else
|
||||
$(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(DTRACE_PROBE_OBJ) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
|
||||
endif # NEED_DTRACE_PROBE_OBJ
|
||||
|
||||
ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
|
||||
ifdef MSMANIFEST_TOOL
|
||||
ifdef EMBED_MANIFEST_AT
|
||||
@ -1189,6 +1216,7 @@ host_%.$(OBJ_SUFFIX): %.mm Makefile Makefile.in
|
||||
moc_%.cpp: %.h Makefile Makefile.in
|
||||
$(MOC) $< $(OUTOPTION)$@
|
||||
|
||||
ifdef ASFILES
|
||||
# The AS_DASH_C_FLAG is needed cause not all assemblers (Solaris) accept
|
||||
# a '-c' flag.
|
||||
%.$(OBJ_SUFFIX): %.$(ASM_SUFFIX) Makefile Makefile.in
|
||||
@ -1197,6 +1225,7 @@ ifeq ($(MOZ_OS2_TOOLS),VACPP)
|
||||
else
|
||||
$(AS) -o $@ $(ASFLAGS) $(AS_DASH_C_FLAG) $(_VPATH_SRCS)
|
||||
endif
|
||||
endif
|
||||
|
||||
%.$(OBJ_SUFFIX): %.S Makefile Makefile.in
|
||||
$(AS) -o $@ $(ASFLAGS) -c $<
|
||||
@ -1989,7 +2018,6 @@ endif
|
||||
# hundreds of built-in suffix rules for stuff we don't need.
|
||||
#
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .out .a .ln .o .c .cc .C .cpp .y .l .s .S .h .sh .i .pl .class .java .html .pp .mk .in .$(OBJ_SUFFIX) .m .mm .idl $(BIN_SUFFIX)
|
||||
|
||||
#
|
||||
# Fake targets. Always run these rules, even if a file/directory with that
|
||||
|
@ -138,6 +138,9 @@ cstdio
|
||||
cstdlib
|
||||
cstring
|
||||
ctype.h
|
||||
curl/curl.h
|
||||
curl/easy.h
|
||||
curl/types.h
|
||||
curses.h
|
||||
cxxabi.h
|
||||
DateTimeUtils.h
|
||||
|
30
configure.in
30
configure.in
@ -889,7 +889,7 @@ MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
|
||||
MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
|
||||
DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core'
|
||||
MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin'
|
||||
XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin $(MOZ_FIX_LINK_PATHS) -lxpcom'
|
||||
XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom'
|
||||
LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
|
||||
XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
|
||||
XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
|
||||
@ -2807,6 +2807,19 @@ AC_CHECK_HEADER(new, [NEW_H=new])
|
||||
AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
|
||||
AC_LANG_C
|
||||
|
||||
AC_ARG_ENABLE(dtrace,
|
||||
build with dtrace support if available (default=no),
|
||||
[enable_dtrace="yes"],)
|
||||
if test "x$enable_dtrace" = "xyes"; then
|
||||
AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
|
||||
if test -n "$HAVE_DTRACE"; then
|
||||
AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
|
||||
else
|
||||
AC_MSG_ERROR([dtrace enabled but sys/std.h not found]);
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(HAVE_DTRACE)
|
||||
|
||||
case $target in
|
||||
*-aix4.3*|*-aix5*)
|
||||
;;
|
||||
@ -4351,6 +4364,21 @@ AC_SUBST(MOZ_EMBEDDING_LEVEL_DEFAULT)
|
||||
AC_SUBST(MOZ_EMBEDDING_LEVEL_BASIC)
|
||||
AC_SUBST(MOZ_EMBEDDING_LEVEL_MINIMAL)
|
||||
|
||||
MOZ_ARG_WITH_STRING(xulrunner-stub-name,
|
||||
[ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
|
||||
XULRUNNER_STUB_NAME=$withval)
|
||||
|
||||
if test -z "$XULRUNNER_STUB_NAME"; then
|
||||
case "$target_os" in
|
||||
darwin*)
|
||||
XULRUNNER_STUB_NAME=xulrunner
|
||||
;;
|
||||
*)
|
||||
XULRUNNER_STUB_NAME=xulrunner-stub
|
||||
esac
|
||||
fi
|
||||
AC_SUBST(XULRUNNER_STUB_NAME)
|
||||
|
||||
if test -z "$MOZ_BUILD_APP"; then
|
||||
AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
|
||||
else
|
||||
|
@ -1098,6 +1098,13 @@ public:
|
||||
nsIURI *aLinkURI, const nsString& aTargetSpec,
|
||||
PRBool aClick, PRBool aIsUserTriggered);
|
||||
|
||||
/**
|
||||
* Return true if aContent or one of its ancestors in the
|
||||
* bindingParent chain is native anonymous.
|
||||
*/
|
||||
static PRBool IsNativeAnonymous(nsIContent* aContent);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
static PRBool InitializeEventTable();
|
||||
|
@ -51,7 +51,6 @@ class nsPresContext;
|
||||
class nsVoidArray;
|
||||
class nsIDOMEvent;
|
||||
class nsIContent;
|
||||
class nsISupportsArray;
|
||||
class nsIEventListenerManager;
|
||||
class nsIURI;
|
||||
class nsICSSStyleRule;
|
||||
|
@ -77,7 +77,6 @@ class nsIPrincipal;
|
||||
class nsIDOMDocument;
|
||||
class nsIDOMDocumentType;
|
||||
class nsIObserver;
|
||||
class nsISupportsArray;
|
||||
class nsScriptLoader;
|
||||
class nsIContentSink;
|
||||
class nsIScriptEventManager;
|
||||
|
@ -98,8 +98,10 @@ enum {
|
||||
NODE_MAY_HAVE_CLASS = 0x00000400U,
|
||||
NODE_MAY_HAVE_STYLE = 0x00000800U,
|
||||
|
||||
NODE_IS_INSERTION_PARENT = 0x00001000U,
|
||||
|
||||
// Four bits for the script-type ID
|
||||
NODE_SCRIPT_TYPE_OFFSET = 12,
|
||||
NODE_SCRIPT_TYPE_OFFSET = 13,
|
||||
|
||||
NODE_SCRIPT_TYPE_SIZE = 4,
|
||||
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include "nsRange.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMText.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
@ -3685,3 +3685,23 @@ nsContentUtils::TriggerLink(nsIContent *aContent, nsPresContext *aPresContext,
|
||||
handler->OnLinkClick(aContent, aLinkURI, aTargetSpec.get());
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsContentUtils::IsNativeAnonymous(nsIContent* aContent)
|
||||
{
|
||||
while (aContent) {
|
||||
nsIContent* bindingParent = aContent->GetBindingParent();
|
||||
if (bindingParent == aContent) {
|
||||
NS_ASSERTION(bindingParent->IsNativeAnonymous() ||
|
||||
bindingParent->IsNodeOfType(nsINode::eXUL),
|
||||
"Bogus binding parent?");
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
NS_ASSERTION(!aContent->IsNativeAnonymous(),
|
||||
"Native anonymous node with wrong binding parent");
|
||||
aContent = bindingParent;
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -69,7 +69,6 @@
|
||||
#include "nsIContent.h"
|
||||
#include "nsIEnumerator.h"
|
||||
#include "nsISelectionPrivate.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIParserService.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
@ -1156,12 +1156,17 @@ nsCanvasRenderingContext2D::ClearRect(float x, float y, float w, float h)
|
||||
if (!FloatValidate(x,y,w,h))
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
|
||||
cairo_path_t *old_path = cairo_copy_path (mCairo);
|
||||
cairo_save (mCairo);
|
||||
cairo_set_operator (mCairo, CAIRO_OPERATOR_CLEAR);
|
||||
cairo_new_path (mCairo);
|
||||
cairo_rectangle (mCairo, x, y, w, h);
|
||||
cairo_fill (mCairo);
|
||||
cairo_restore (mCairo);
|
||||
cairo_new_path (mCairo);
|
||||
if (old_path->status == CAIRO_STATUS_SUCCESS && old_path->num_data != 0)
|
||||
cairo_append_path (mCairo, old_path);
|
||||
cairo_path_destroy (old_path);
|
||||
|
||||
return Redraw();
|
||||
}
|
||||
@ -1172,11 +1177,16 @@ nsCanvasRenderingContext2D::FillRect(float x, float y, float w, float h)
|
||||
if (!FloatValidate(x,y,w,h))
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
|
||||
cairo_path_t *old_path = cairo_copy_path (mCairo);
|
||||
cairo_new_path (mCairo);
|
||||
cairo_rectangle (mCairo, x, y, w, h);
|
||||
|
||||
ApplyStyle(STYLE_FILL);
|
||||
cairo_fill (mCairo);
|
||||
cairo_new_path (mCairo);
|
||||
if (old_path->status == CAIRO_STATUS_SUCCESS && old_path->num_data != 0)
|
||||
cairo_append_path (mCairo, old_path);
|
||||
cairo_path_destroy (old_path);
|
||||
|
||||
return Redraw();
|
||||
}
|
||||
@ -1187,11 +1197,16 @@ nsCanvasRenderingContext2D::StrokeRect(float x, float y, float w, float h)
|
||||
if (!FloatValidate(x,y,w,h))
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
|
||||
cairo_path_t *old_path = cairo_copy_path (mCairo);
|
||||
cairo_new_path (mCairo);
|
||||
cairo_rectangle (mCairo, x, y, w, h);
|
||||
|
||||
ApplyStyle(STYLE_STROKE);
|
||||
cairo_stroke (mCairo);
|
||||
cairo_new_path (mCairo);
|
||||
if (old_path->status == CAIRO_STATUS_SUCCESS && old_path->num_data != 0)
|
||||
cairo_append_path (mCairo, old_path);
|
||||
cairo_path_destroy (old_path);
|
||||
|
||||
return Redraw();
|
||||
}
|
||||
@ -1868,7 +1883,8 @@ nsCanvasRenderingContext2D::DrawImage()
|
||||
|
||||
cairo_surface_t *imgSurf = nsnull;
|
||||
cairo_matrix_t surfMat;
|
||||
cairo_pattern_t* pat;
|
||||
cairo_pattern_t *pat;
|
||||
cairo_path_t *old_path;
|
||||
PRUint8 *imgData = nsnull;
|
||||
PRInt32 imgWidth, imgHeight;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
@ -1942,6 +1958,7 @@ nsCanvasRenderingContext2D::DrawImage()
|
||||
pat = cairo_pattern_create_for_surface(imgSurf);
|
||||
cairo_pattern_set_matrix(pat, &surfMat);
|
||||
|
||||
old_path = cairo_copy_path(mCairo);
|
||||
cairo_save(mCairo);
|
||||
cairo_translate(mCairo, dx, dy);
|
||||
cairo_new_path(mCairo);
|
||||
@ -1966,6 +1983,11 @@ nsCanvasRenderingContext2D::DrawImage()
|
||||
|
||||
cairo_pattern_destroy(pat);
|
||||
|
||||
cairo_new_path(mCairo);
|
||||
if (old_path->status == CAIRO_STATUS_SUCCESS && old_path->num_data != 0)
|
||||
cairo_append_path(mCairo, old_path);
|
||||
cairo_path_destroy(old_path);
|
||||
|
||||
FINISH:
|
||||
if (imgSurf)
|
||||
cairo_surface_destroy(imgSurf);
|
||||
@ -2123,7 +2145,7 @@ nsCanvasRenderingContext2D::CairoSurfaceFromElement(nsIDOMElement *imgElt,
|
||||
|
||||
PRUint32 status;
|
||||
imgRequest->GetImageStatus(&status);
|
||||
if (status != imgIRequest::STATUS_LOAD_COMPLETE)
|
||||
if ((status & imgIRequest::STATUS_LOAD_COMPLETE) == 0)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
@ -2592,6 +2614,7 @@ nsCanvasRenderingContext2D::PutImageData()
|
||||
imgsurf = cairo_image_surface_create_for_data (imageBuffer.get(),
|
||||
CAIRO_FORMAT_ARGB32,
|
||||
w, h, w*4);
|
||||
cairo_path_t *old_path = cairo_copy_path (mCairo);
|
||||
cairo_save (mCairo);
|
||||
cairo_identity_matrix (mCairo);
|
||||
cairo_translate (mCairo, x, y);
|
||||
@ -2601,6 +2624,10 @@ nsCanvasRenderingContext2D::PutImageData()
|
||||
cairo_set_operator (mCairo, CAIRO_OPERATOR_SOURCE);
|
||||
cairo_fill (mCairo);
|
||||
cairo_restore (mCairo);
|
||||
cairo_new_path (mCairo);
|
||||
if (old_path->status == CAIRO_STATUS_SUCCESS && old_path->num_data != 0)
|
||||
cairo_append_path (mCairo, old_path);
|
||||
cairo_path_destroy (old_path);
|
||||
|
||||
cairo_surface_destroy (imgsurf);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
|
||||
class nsString;
|
||||
class nsVoidArray;
|
||||
class nsStringArray;
|
||||
|
||||
// {0ae53c0f-8ea2-4916-bedc-717443c3e185}
|
||||
#define NS_FORMPROCESSOR_CID \
|
||||
@ -59,9 +59,11 @@ class nsVoidArray;
|
||||
|
||||
#define NS_FORMPROCESSOR_CONTRACTID "@mozilla.org/layout/form-processor;1"
|
||||
|
||||
// 4ff86376-6982-4f64-a683-a6ae4984afd7
|
||||
// 6d4ea1aa-a6b2-43bd-a19d-3f0f26750df3
|
||||
#define NS_IFORMPROCESSOR_IID \
|
||||
{ 0x4ff86376, 0x6982, 0x4f64, { 0xa6, 0x83, 0xa6, 0xae, 0x49, 0x84, 0xaf, 0xd7 } }
|
||||
{ 0x6d4ea1aa, 0xa6b2, 0x43bd, \
|
||||
{ 0xa1, 0x9d, 0x3f, 0x0f, 0x26, 0x75, 0x0d, 0xf3 } }
|
||||
|
||||
|
||||
|
||||
|
||||
@ -101,7 +103,7 @@ public:
|
||||
*/
|
||||
|
||||
NS_IMETHOD ProvideContent(const nsAString& aFormType,
|
||||
nsVoidArray& aContent,
|
||||
nsStringArray& aContent,
|
||||
nsAString& aAttribute) = 0;
|
||||
|
||||
};
|
||||
|
@ -52,7 +52,6 @@ class nsIDOMNodeList;
|
||||
class nsIFrame;
|
||||
class nsMappedAttributes;
|
||||
class nsIStyleRule;
|
||||
class nsISupportsArray;
|
||||
class nsChildContentList;
|
||||
class nsDOMCSSDeclaration;
|
||||
class nsIDOMCSSStyleDeclaration;
|
||||
|
@ -52,7 +52,6 @@
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIMarkupDocumentViewer.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsRuleData.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
@ -71,7 +71,6 @@ CPPSRCS = \
|
||||
nsDOMSVGEvent.cpp \
|
||||
nsSVGAElement.cpp \
|
||||
nsSVGAngle.cpp \
|
||||
nsSVGAnimatedAngle.cpp \
|
||||
nsSVGAnimatedLengthList.cpp \
|
||||
nsSVGAnimatedNumberList.cpp \
|
||||
nsSVGAnimatedRect.cpp \
|
||||
|
@ -36,273 +36,170 @@
|
||||
|
||||
#include "nsSVGAngle.h"
|
||||
#include "prdtoa.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsSVGValue.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsTextFormatter.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIDOMSVGNumber.h"
|
||||
#include "nsISVGValueUtils.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include <math.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsSVGAngle class
|
||||
|
||||
class nsSVGAngle : public nsIDOMSVGAngle,
|
||||
public nsSVGValue,
|
||||
public nsISVGValueObserver
|
||||
class DOMSVGAngle : public nsIDOMSVGAngle
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewSVGAngle(nsIDOMSVGAngle** result,
|
||||
float value,
|
||||
PRUint16 unit);
|
||||
|
||||
friend nsresult NS_NewSVGAngle(nsIDOMSVGAngle** result,
|
||||
const nsAString &value);
|
||||
|
||||
nsSVGAngle(float value, PRUint16 unit);
|
||||
nsSVGAngle();
|
||||
|
||||
public:
|
||||
// nsISupports interface:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMSVGAngle interface:
|
||||
NS_DECL_NSIDOMSVGANGLE
|
||||
DOMSVGAngle()
|
||||
{ mVal.Init(); }
|
||||
|
||||
NS_IMETHOD GetUnitType(PRUint16* aResult)
|
||||
{ *aResult = mVal.mSpecifiedUnitType; return NS_OK; }
|
||||
|
||||
// nsISVGValue interface:
|
||||
NS_IMETHOD SetValueString(const nsAString& aValue);
|
||||
NS_IMETHOD GetValueString(nsAString& aValue);
|
||||
|
||||
// nsISVGValueObserver interface:
|
||||
NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable,
|
||||
modificationType aModType);
|
||||
NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable,
|
||||
modificationType aModType);
|
||||
NS_IMETHOD GetValue(float* aResult)
|
||||
{ *aResult = mVal.GetBaseValue(); return NS_OK; }
|
||||
NS_IMETHOD SetValue(float aValue)
|
||||
{ mVal.SetBaseValue(aValue, nsnull); return NS_OK; }
|
||||
|
||||
// nsISupportsWeakReference
|
||||
// implementation inherited from nsSupportsWeakReference
|
||||
|
||||
protected:
|
||||
// implementation helpers:
|
||||
void GetUnitString(nsAString& unit);
|
||||
PRUint16 GetUnitTypeForString(const char* unitStr);
|
||||
PRBool IsValidUnitType(PRUint16 unit);
|
||||
NS_IMETHOD GetValueInSpecifiedUnits(float* aResult)
|
||||
{ *aResult = mVal.mBaseVal; return NS_OK; }
|
||||
NS_IMETHOD SetValueInSpecifiedUnits(float aValue)
|
||||
{ mVal.mBaseVal = aValue; return NS_OK; }
|
||||
|
||||
float mValueInSpecifiedUnits;
|
||||
PRUint8 mSpecifiedUnitType;
|
||||
NS_IMETHOD SetValueAsString(const nsAString& aValue)
|
||||
{ return mVal.SetBaseValueString(aValue, nsnull, PR_FALSE); }
|
||||
NS_IMETHOD GetValueAsString(nsAString& aValue)
|
||||
{ mVal.GetBaseValueString(aValue); return NS_OK; }
|
||||
|
||||
NS_IMETHOD NewValueSpecifiedUnits(PRUint16 unitType,
|
||||
float valueInSpecifiedUnits)
|
||||
{ mVal.NewValueSpecifiedUnits(unitType, valueInSpecifiedUnits, nsnull);
|
||||
return NS_OK; }
|
||||
|
||||
NS_IMETHOD ConvertToSpecifiedUnits(PRUint16 unitType)
|
||||
{ mVal.ConvertToSpecifiedUnits(unitType, nsnull); return NS_OK; }
|
||||
|
||||
private:
|
||||
nsSVGAngle mVal;
|
||||
};
|
||||
|
||||
NS_IMPL_ADDREF(nsSVGAngle::DOMBaseVal)
|
||||
NS_IMPL_RELEASE(nsSVGAngle::DOMBaseVal)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
NS_IMPL_ADDREF(nsSVGAngle::DOMAnimVal)
|
||||
NS_IMPL_RELEASE(nsSVGAngle::DOMAnimVal)
|
||||
|
||||
nsresult
|
||||
NS_NewSVGAngle(nsIDOMSVGAngle** result,
|
||||
float value,
|
||||
PRUint16 unit)
|
||||
{
|
||||
nsSVGAngle *pl = new nsSVGAngle(value, unit);
|
||||
NS_ENSURE_TRUE(pl, NS_ERROR_OUT_OF_MEMORY);
|
||||
NS_ADDREF(pl);
|
||||
*result = pl;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMPL_ADDREF(nsSVGAngle::DOMAnimatedAngle)
|
||||
NS_IMPL_RELEASE(nsSVGAngle::DOMAnimatedAngle)
|
||||
|
||||
nsresult
|
||||
NS_NewSVGAngle(nsIDOMSVGAngle** result,
|
||||
const nsAString &value)
|
||||
{
|
||||
*result = nsnull;
|
||||
nsSVGAngle *pl = new nsSVGAngle();
|
||||
NS_ENSURE_TRUE(pl, NS_ERROR_OUT_OF_MEMORY);
|
||||
NS_ADDREF(pl);
|
||||
if (NS_FAILED(pl->SetValueAsString(value))) {
|
||||
NS_RELEASE(pl);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
*result = pl;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMPL_ADDREF(DOMSVGAngle)
|
||||
NS_IMPL_RELEASE(DOMSVGAngle)
|
||||
|
||||
|
||||
nsSVGAngle::nsSVGAngle(float value,
|
||||
PRUint16 unit)
|
||||
: mValueInSpecifiedUnits(value)
|
||||
{
|
||||
NS_ASSERTION(unit == SVG_ANGLETYPE_UNKNOWN || IsValidUnitType(unit), "unknown unit");
|
||||
mSpecifiedUnitType = unit;
|
||||
}
|
||||
|
||||
nsSVGAngle::nsSVGAngle()
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods:
|
||||
|
||||
NS_IMPL_ADDREF(nsSVGAngle)
|
||||
NS_IMPL_RELEASE(nsSVGAngle)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGAngle)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGAngle::DOMBaseVal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAngle)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAngle)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGValue methods:
|
||||
NS_IMETHODIMP
|
||||
nsSVGAngle::SetValueString(const nsAString& aValue)
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGAngle::DOMAnimVal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAngle)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAngle)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGAngle::DOMAnimatedAngle)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedAngle)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAnimatedAngle)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(DOMSVGAngle)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAngle)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAngle)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
static nsIAtom** const unitMap[] =
|
||||
{
|
||||
return SetValueAsString(aValue);
|
||||
nsnull, /* SVG_ANGLETYPE_UNKNOWN */
|
||||
nsnull, /* SVG_ANGLETYPE_UNSPECIFIED */
|
||||
&nsGkAtoms::deg,
|
||||
&nsGkAtoms::rad,
|
||||
&nsGkAtoms::grad
|
||||
};
|
||||
|
||||
/* Helper functions */
|
||||
|
||||
static PRBool
|
||||
IsValidUnitType(PRUint16 unit)
|
||||
{
|
||||
if (unit > nsIDOMSVGAngle::SVG_ANGLETYPE_UNKNOWN &&
|
||||
unit <= nsIDOMSVGAngle::SVG_ANGLETYPE_GRAD)
|
||||
return PR_TRUE;
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAngle::GetValueString(nsAString& aValue)
|
||||
static void
|
||||
GetUnitString(nsAString& unit, PRUint16 unitType)
|
||||
{
|
||||
return GetValueAsString(aValue);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGValueObserver methods
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAngle::WillModifySVGObservable(nsISVGValue* observable,
|
||||
modificationType aModType)
|
||||
{
|
||||
WillModify(aModType);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAngle::DidModifySVGObservable(nsISVGValue* observable,
|
||||
modificationType aModType)
|
||||
{
|
||||
DidModify(aModType);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGAngle methods:
|
||||
|
||||
/* readonly attribute unsigned short unitType; */
|
||||
NS_IMETHODIMP
|
||||
nsSVGAngle::GetUnitType(PRUint16 *aUnitType)
|
||||
{
|
||||
*aUnitType = mSpecifiedUnitType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute float value; */
|
||||
NS_IMETHODIMP
|
||||
nsSVGAngle::GetValue(float *aValue)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
switch (mSpecifiedUnitType) {
|
||||
case SVG_ANGLETYPE_UNSPECIFIED:
|
||||
case SVG_ANGLETYPE_DEG:
|
||||
*aValue = float((mValueInSpecifiedUnits * M_PI) / 180.0);
|
||||
break;
|
||||
case SVG_ANGLETYPE_RAD:
|
||||
*aValue = mValueInSpecifiedUnits;
|
||||
break;
|
||||
case SVG_ANGLETYPE_GRAD:
|
||||
*aValue = float((mValueInSpecifiedUnits * M_PI) / 100.0);
|
||||
break;
|
||||
default:
|
||||
rv = NS_ERROR_FAILURE;
|
||||
break;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAngle::SetValue(float aValue)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
switch (mSpecifiedUnitType) {
|
||||
case SVG_ANGLETYPE_UNSPECIFIED:
|
||||
case SVG_ANGLETYPE_DEG:
|
||||
rv = SetValueInSpecifiedUnits(float((aValue * 180.0) / M_PI));
|
||||
break;
|
||||
case SVG_ANGLETYPE_RAD:
|
||||
rv = SetValueInSpecifiedUnits(aValue);
|
||||
break;
|
||||
case SVG_ANGLETYPE_GRAD:
|
||||
rv = SetValueInSpecifiedUnits(float((aValue * 100.0) / M_PI));
|
||||
break;
|
||||
default:
|
||||
rv = NS_ERROR_FAILURE;
|
||||
break;
|
||||
if (IsValidUnitType(unitType)) {
|
||||
if (unitMap[unitType]) {
|
||||
(*unitMap[unitType])->ToString(unit);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
return rv;
|
||||
NS_NOTREACHED("Unknown unit type");
|
||||
return;
|
||||
}
|
||||
|
||||
/* attribute float valueInSpecifiedUnits; */
|
||||
NS_IMETHODIMP
|
||||
nsSVGAngle::GetValueInSpecifiedUnits(float *aValueInSpecifiedUnits)
|
||||
static PRUint16
|
||||
GetUnitTypeForString(const char* unitStr)
|
||||
{
|
||||
*aValueInSpecifiedUnits = mValueInSpecifiedUnits;
|
||||
return NS_OK;
|
||||
if (!unitStr || *unitStr == '\0')
|
||||
return nsIDOMSVGAngle::SVG_ANGLETYPE_UNSPECIFIED;
|
||||
|
||||
nsCOMPtr<nsIAtom> unitAtom = do_GetAtom(unitStr);
|
||||
|
||||
for (int i = 0 ; i < NS_ARRAY_LENGTH(unitMap) ; i++) {
|
||||
if (unitMap[i] && *unitMap[i] == unitAtom) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return nsIDOMSVGAngle::SVG_ANGLETYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAngle::SetValueInSpecifiedUnits(float aValueInSpecifiedUnits)
|
||||
{
|
||||
WillModify();
|
||||
mValueInSpecifiedUnits = aValueInSpecifiedUnits;
|
||||
DidModify();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute DOMString valueAsString; */
|
||||
NS_IMETHODIMP
|
||||
nsSVGAngle::GetValueAsString(nsAString & aValueAsString)
|
||||
static void
|
||||
GetValueString(nsAString &aValueAsString, float aValue, PRUint16 aUnitType)
|
||||
{
|
||||
PRUnichar buf[24];
|
||||
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar),
|
||||
NS_LITERAL_STRING("%g").get(),
|
||||
(double)mValueInSpecifiedUnits);
|
||||
(double)aValue);
|
||||
aValueAsString.Assign(buf);
|
||||
|
||||
|
||||
nsAutoString unitString;
|
||||
GetUnitString(unitString);
|
||||
GetUnitString(unitString, aUnitType);
|
||||
aValueAsString.Append(unitString);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAngle::SetValueAsString(const nsAString & aValueAsString)
|
||||
static nsresult
|
||||
GetValueFromString(const nsAString &aValueAsString,
|
||||
float *aValue,
|
||||
PRUint16 *aUnitType)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
char *str = ToNewCString(aValueAsString);
|
||||
if (!str)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
char* number = str;
|
||||
while (*number && isspace(*number))
|
||||
++number;
|
||||
|
||||
if (*number) {
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
if (*str) {
|
||||
char *rest;
|
||||
double value = PR_strtod(number, &rest);
|
||||
if (rest!=number) {
|
||||
PRUint16 unitType = GetUnitTypeForString(nsCRT::strtok(rest, "\x20\x9\xD\xA", &rest));
|
||||
rv = NewValueSpecifiedUnits(unitType, (float)value);
|
||||
}
|
||||
else { // parse error
|
||||
// no number
|
||||
rv = NS_ERROR_FAILURE;
|
||||
*aValue = static_cast<float>(PR_strtod(str, &rest));
|
||||
if (rest != str) {
|
||||
*aUnitType = GetUnitTypeForString(nsCRT::strtok(rest,
|
||||
"\x20\x9\xD\xA",
|
||||
&rest));
|
||||
if (IsValidUnitType(*aUnitType)) {
|
||||
rv = NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -311,85 +208,142 @@ nsSVGAngle::SetValueAsString(const nsAString & aValueAsString)
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* void newValueSpecifiedUnits (in unsigned short unitType, in float valueInSpecifiedUnits); */
|
||||
NS_IMETHODIMP
|
||||
nsSVGAngle::NewValueSpecifiedUnits(PRUint16 unitType, float valueInSpecifiedUnits)
|
||||
float
|
||||
nsSVGAngle::GetUnitScaleFactor() const
|
||||
{
|
||||
if (!IsValidUnitType(unitType)) return NS_ERROR_FAILURE;
|
||||
|
||||
WillModify();
|
||||
mValueInSpecifiedUnits = valueInSpecifiedUnits;
|
||||
mSpecifiedUnitType = unitType;
|
||||
DidModify();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void convertToSpecifiedUnits (in unsigned short unitType); */
|
||||
NS_IMETHODIMP
|
||||
nsSVGAngle::ConvertToSpecifiedUnits(PRUint16 unitType)
|
||||
{
|
||||
if (!IsValidUnitType(unitType)) return NS_ERROR_FAILURE;
|
||||
|
||||
float valueInUserUnits;
|
||||
GetValue(&valueInUserUnits);
|
||||
mSpecifiedUnitType = unitType;
|
||||
SetValue(valueInUserUnits);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation helpers:
|
||||
|
||||
|
||||
void nsSVGAngle::GetUnitString(nsAString& unit)
|
||||
{
|
||||
nsIAtom* UnitAtom = nsnull;
|
||||
|
||||
switch (mSpecifiedUnitType) {
|
||||
case SVG_ANGLETYPE_UNSPECIFIED:
|
||||
UnitAtom = nsnull;
|
||||
break;
|
||||
case SVG_ANGLETYPE_DEG:
|
||||
UnitAtom = nsGkAtoms::deg;
|
||||
break;
|
||||
case SVG_ANGLETYPE_GRAD:
|
||||
UnitAtom = nsGkAtoms::grad;
|
||||
break;
|
||||
case SVG_ANGLETYPE_RAD:
|
||||
UnitAtom = nsGkAtoms::rad;
|
||||
break;
|
||||
case nsIDOMSVGAngle::SVG_ANGLETYPE_UNSPECIFIED:
|
||||
case nsIDOMSVGAngle::SVG_ANGLETYPE_DEG:
|
||||
return static_cast<float>(180.0 / M_PI);
|
||||
case nsIDOMSVGAngle::SVG_ANGLETYPE_RAD:
|
||||
return 1;
|
||||
case nsIDOMSVGAngle::SVG_ANGLETYPE_GRAD:
|
||||
return static_cast<float>(100.0 / M_PI);
|
||||
default:
|
||||
NS_ASSERTION(PR_FALSE, "unknown unit");
|
||||
break;
|
||||
NS_NOTREACHED("Unknown unit type");
|
||||
return 0;
|
||||
}
|
||||
if (!UnitAtom) return;
|
||||
|
||||
UnitAtom->ToString(unit);
|
||||
}
|
||||
|
||||
PRUint16 nsSVGAngle::GetUnitTypeForString(const char* unitStr)
|
||||
void
|
||||
nsSVGAngle::SetBaseValueInSpecifiedUnits(float aValue,
|
||||
nsSVGElement *aSVGElement)
|
||||
{
|
||||
if (!unitStr || *unitStr=='\0') return SVG_ANGLETYPE_UNSPECIFIED;
|
||||
|
||||
nsCOMPtr<nsIAtom> unitAtom = do_GetAtom(unitStr);
|
||||
|
||||
if (unitAtom == nsGkAtoms::deg)
|
||||
return SVG_ANGLETYPE_DEG;
|
||||
else if (unitAtom == nsGkAtoms::grad)
|
||||
return SVG_ANGLETYPE_GRAD;
|
||||
else if (unitAtom == nsGkAtoms::rad)
|
||||
return SVG_ANGLETYPE_RAD;
|
||||
|
||||
return SVG_ANGLETYPE_UNKNOWN;
|
||||
mBaseVal = aValue;
|
||||
aSVGElement->DidChangeAngle(mAttrEnum, PR_TRUE);
|
||||
}
|
||||
|
||||
PRBool nsSVGAngle::IsValidUnitType(PRUint16 unit)
|
||||
void
|
||||
nsSVGAngle::ConvertToSpecifiedUnits(PRUint16 unitType,
|
||||
nsSVGElement *aSVGElement)
|
||||
{
|
||||
if (unit > SVG_ANGLETYPE_UNKNOWN && unit <= SVG_ANGLETYPE_GRAD)
|
||||
return PR_TRUE;
|
||||
if (!IsValidUnitType(unitType))
|
||||
return;
|
||||
|
||||
return PR_FALSE;
|
||||
float valueInUserUnits = mBaseVal / GetUnitScaleFactor();
|
||||
mSpecifiedUnitType = PRUint8(unitType);
|
||||
SetBaseValue(valueInUserUnits, aSVGElement);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGAngle::NewValueSpecifiedUnits(PRUint16 unitType,
|
||||
float valueInSpecifiedUnits,
|
||||
nsSVGElement *aSVGElement)
|
||||
{
|
||||
if (!IsValidUnitType(unitType))
|
||||
return;
|
||||
|
||||
mBaseVal = mAnimVal = valueInSpecifiedUnits;
|
||||
mSpecifiedUnitType = PRUint8(unitType);
|
||||
if (aSVGElement) {
|
||||
aSVGElement->DidChangeAngle(mAttrEnum, PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGAngle::ToDOMBaseVal(nsIDOMSVGAngle **aResult, nsSVGElement *aSVGElement)
|
||||
{
|
||||
*aResult = new DOMBaseVal(this, aSVGElement);
|
||||
if (!*aResult)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGAngle::ToDOMAnimVal(nsIDOMSVGAngle **aResult, nsSVGElement *aSVGElement)
|
||||
{
|
||||
*aResult = new DOMAnimVal(this, aSVGElement);
|
||||
if (!*aResult)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* Implementation */
|
||||
|
||||
nsresult
|
||||
nsSVGAngle::SetBaseValueString(const nsAString &aValueAsString,
|
||||
nsSVGElement *aSVGElement,
|
||||
PRBool aDoSetAttr)
|
||||
{
|
||||
float value;
|
||||
PRUint16 unitType;
|
||||
|
||||
nsresult rv = GetValueFromString(aValueAsString, &value, &unitType);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mBaseVal = mAnimVal = value;
|
||||
mSpecifiedUnitType = PRUint8(unitType);
|
||||
if (aSVGElement) {
|
||||
aSVGElement->DidChangeAngle(mAttrEnum, aDoSetAttr);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGAngle::GetBaseValueString(nsAString & aValueAsString)
|
||||
{
|
||||
GetValueString(aValueAsString, mBaseVal, mSpecifiedUnitType);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGAngle::GetAnimValueString(nsAString & aValueAsString)
|
||||
{
|
||||
GetValueString(aValueAsString, mAnimVal, mSpecifiedUnitType);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGAngle::SetBaseValue(float aValue, nsSVGElement *aSVGElement)
|
||||
{
|
||||
mAnimVal = mBaseVal = aValue * GetUnitScaleFactor();
|
||||
if (aSVGElement) {
|
||||
aSVGElement->DidChangeAngle(mAttrEnum, PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGAngle::ToDOMAnimatedAngle(nsIDOMSVGAnimatedAngle **aResult,
|
||||
nsSVGElement *aSVGElement)
|
||||
{
|
||||
*aResult = new DOMAnimatedAngle(this, aSVGElement);
|
||||
if (!*aResult)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewDOMSVGAngle(nsIDOMSVGAngle** aResult)
|
||||
{
|
||||
*aResult = new DOMSVGAngle;
|
||||
if (!*aResult)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -38,15 +38,153 @@
|
||||
#define __NS_SVGANGLE_H__
|
||||
|
||||
#include "nsIDOMSVGAngle.h"
|
||||
#include "nsAString.h"
|
||||
#include "nsIDOMSVGAnimatedAngle.h"
|
||||
#include "nsSVGElement.h"
|
||||
#include "nsDOMError.h"
|
||||
|
||||
class nsSVGAngle
|
||||
{
|
||||
friend class DOMSVGAngle;
|
||||
|
||||
public:
|
||||
void Init(PRUint8 aAttrEnum = 0xff,
|
||||
float aValue = 0,
|
||||
PRUint8 aUnitType = nsIDOMSVGAngle::SVG_ANGLETYPE_UNSPECIFIED) {
|
||||
mAnimVal = mBaseVal = aValue;
|
||||
mSpecifiedUnitType = aUnitType;
|
||||
mAttrEnum = aAttrEnum;
|
||||
}
|
||||
|
||||
nsresult SetBaseValueString(const nsAString& aValue,
|
||||
nsSVGElement *aSVGElement,
|
||||
PRBool aDoSetAttr);
|
||||
void GetBaseValueString(nsAString& aValue);
|
||||
void GetAnimValueString(nsAString& aValue);
|
||||
|
||||
float GetBaseValue() const
|
||||
{ return mBaseVal / GetUnitScaleFactor(); }
|
||||
float GetAnimValue() const
|
||||
{ return mAnimVal / GetUnitScaleFactor(); }
|
||||
|
||||
void SetBaseValue(float aValue, nsSVGElement *aSVGElement);
|
||||
|
||||
PRUint8 GetSpecifiedUnitType() const { return mSpecifiedUnitType; }
|
||||
float GetAnimValInSpecifiedUnits() const { return mAnimVal; }
|
||||
float GetBaseValInSpecifiedUnits() const { return mBaseVal; }
|
||||
|
||||
static nsresult ToDOMSVGAngle(nsIDOMSVGAngle **aResult);
|
||||
nsresult ToDOMAnimatedAngle(nsIDOMSVGAnimatedAngle **aResult,
|
||||
nsSVGElement* aSVGElement);
|
||||
|
||||
private:
|
||||
|
||||
float mAnimVal;
|
||||
float mBaseVal;
|
||||
PRUint8 mSpecifiedUnitType;
|
||||
PRUint8 mAttrEnum; // element specified tracking for attribute
|
||||
|
||||
float GetUnitScaleFactor() const;
|
||||
void SetBaseValueInSpecifiedUnits(float aValue, nsSVGElement *aSVGElement);
|
||||
void NewValueSpecifiedUnits(PRUint16 aUnitType, float aValue,
|
||||
nsSVGElement *aSVGElement);
|
||||
void ConvertToSpecifiedUnits(PRUint16 aUnitType, nsSVGElement *aSVGElement);
|
||||
nsresult ToDOMBaseVal(nsIDOMSVGAngle **aResult, nsSVGElement* aSVGElement);
|
||||
nsresult ToDOMAnimVal(nsIDOMSVGAngle **aResult, nsSVGElement* aSVGElement);
|
||||
|
||||
struct DOMBaseVal : public nsIDOMSVGAngle
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
DOMBaseVal(nsSVGAngle* aVal, nsSVGElement *aSVGElement)
|
||||
: mVal(aVal), mSVGElement(aSVGElement) {}
|
||||
|
||||
nsSVGAngle* mVal; // kept alive because it belongs to mSVGElement
|
||||
nsRefPtr<nsSVGElement> mSVGElement;
|
||||
|
||||
NS_IMETHOD GetUnitType(PRUint16* aResult)
|
||||
{ *aResult = mVal->mSpecifiedUnitType; return NS_OK; }
|
||||
|
||||
NS_IMETHOD GetValue(float* aResult)
|
||||
{ *aResult = mVal->GetBaseValue(); return NS_OK; }
|
||||
NS_IMETHOD SetValue(float aValue)
|
||||
{ mVal->SetBaseValue(aValue, mSVGElement); return NS_OK; }
|
||||
|
||||
NS_IMETHOD GetValueInSpecifiedUnits(float* aResult)
|
||||
{ *aResult = mVal->mBaseVal; return NS_OK; }
|
||||
NS_IMETHOD SetValueInSpecifiedUnits(float aValue)
|
||||
{ mVal->SetBaseValueInSpecifiedUnits(aValue, mSVGElement);
|
||||
return NS_OK; }
|
||||
|
||||
NS_IMETHOD SetValueAsString(const nsAString& aValue)
|
||||
{ return mVal->SetBaseValueString(aValue, mSVGElement, PR_TRUE); }
|
||||
NS_IMETHOD GetValueAsString(nsAString& aValue)
|
||||
{ mVal->GetBaseValueString(aValue); return NS_OK; }
|
||||
|
||||
NS_IMETHOD NewValueSpecifiedUnits(PRUint16 unitType,
|
||||
float valueInSpecifiedUnits)
|
||||
{ mVal->NewValueSpecifiedUnits(unitType, valueInSpecifiedUnits,
|
||||
mSVGElement);
|
||||
return NS_OK; }
|
||||
|
||||
NS_IMETHOD ConvertToSpecifiedUnits(PRUint16 unitType)
|
||||
{ mVal->ConvertToSpecifiedUnits(unitType, mSVGElement); return NS_OK; }
|
||||
};
|
||||
|
||||
struct DOMAnimVal : public nsIDOMSVGAngle
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
DOMAnimVal(nsSVGAngle* aVal, nsSVGElement *aSVGElement)
|
||||
: mVal(aVal), mSVGElement(aSVGElement) {}
|
||||
|
||||
nsSVGAngle* mVal; // kept alive because it belongs to mSVGElement
|
||||
nsRefPtr<nsSVGElement> mSVGElement;
|
||||
|
||||
NS_IMETHOD GetUnitType(PRUint16* aResult)
|
||||
{ *aResult = mVal->mSpecifiedUnitType; return NS_OK; }
|
||||
|
||||
NS_IMETHOD GetValue(float* aResult)
|
||||
{ *aResult = mVal->GetAnimValue(); return NS_OK; }
|
||||
NS_IMETHOD SetValue(float aValue)
|
||||
{ return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
|
||||
|
||||
NS_IMETHOD GetValueInSpecifiedUnits(float* aResult)
|
||||
{ *aResult = mVal->mAnimVal; return NS_OK; }
|
||||
NS_IMETHOD SetValueInSpecifiedUnits(float aValue)
|
||||
{ return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
|
||||
|
||||
NS_IMETHOD SetValueAsString(const nsAString& aValue)
|
||||
{ return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
|
||||
NS_IMETHOD GetValueAsString(nsAString& aValue)
|
||||
{ mVal->GetAnimValueString(aValue); return NS_OK; }
|
||||
|
||||
NS_IMETHOD NewValueSpecifiedUnits(PRUint16 unitType,
|
||||
float valueInSpecifiedUnits)
|
||||
{ return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
|
||||
|
||||
NS_IMETHOD ConvertToSpecifiedUnits(PRUint16 unitType)
|
||||
{ return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
|
||||
};
|
||||
|
||||
struct DOMAnimatedAngle : public nsIDOMSVGAnimatedAngle
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
DOMAnimatedAngle(nsSVGAngle* aVal, nsSVGElement *aSVGElement)
|
||||
: mVal(aVal), mSVGElement(aSVGElement) {}
|
||||
|
||||
nsSVGAngle* mVal; // kept alive because it belongs to content
|
||||
nsRefPtr<nsSVGElement> mSVGElement;
|
||||
|
||||
NS_IMETHOD GetBaseVal(nsIDOMSVGAngle **aBaseVal)
|
||||
{ return mVal->ToDOMBaseVal(aBaseVal, mSVGElement); }
|
||||
|
||||
NS_IMETHOD GetAnimVal(nsIDOMSVGAngle **aAnimVal)
|
||||
{ return mVal->ToDOMAnimVal(aAnimVal, mSVGElement); }
|
||||
};
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewSVGAngle(nsIDOMSVGAngle** result,
|
||||
float value=0.0f,
|
||||
PRUint16 unit=nsIDOMSVGAngle::SVG_ANGLETYPE_UNSPECIFIED);
|
||||
|
||||
nsresult
|
||||
NS_NewSVGAngle(nsIDOMSVGAngle** result,
|
||||
const nsAString &value);
|
||||
NS_NewDOMSVGAngle(nsIDOMSVGAngle** result);
|
||||
|
||||
#endif //__NS_SVGANGLE_H__
|
||||
|
@ -1,201 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Mozilla SVG project.
|
||||
*
|
||||
* The Initial Developer of the Original Code is IBM Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsSVGValue.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsSVGAnimatedAngle.h"
|
||||
#include "nsSVGLength.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsSVGAnimatedAngle
|
||||
|
||||
class nsSVGAnimatedAngle : public nsIDOMSVGAnimatedAngle,
|
||||
public nsSVGValue,
|
||||
public nsISVGValueObserver
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewSVGAnimatedAngle(nsIDOMSVGAnimatedAngle** result,
|
||||
nsIDOMSVGAngle* baseVal);
|
||||
nsSVGAnimatedAngle();
|
||||
~nsSVGAnimatedAngle();
|
||||
void Init(nsIDOMSVGAngle* baseVal);
|
||||
|
||||
public:
|
||||
// nsISupports interface:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMSVGAnimatedAngle interface:
|
||||
NS_DECL_NSIDOMSVGANIMATEDANGLE
|
||||
|
||||
// remainder of nsISVGValue interface:
|
||||
NS_IMETHOD SetValueString(const nsAString& aValue);
|
||||
NS_IMETHOD GetValueString(nsAString& aValue);
|
||||
|
||||
// nsISVGValueObserver
|
||||
NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable,
|
||||
modificationType aModType);
|
||||
NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable,
|
||||
modificationType aModType);
|
||||
|
||||
// nsISupportsWeakReference
|
||||
// implementation inherited from nsSupportsWeakReference
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIDOMSVGAngle> mBaseVal;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
||||
nsSVGAnimatedAngle::nsSVGAnimatedAngle()
|
||||
{
|
||||
}
|
||||
|
||||
nsSVGAnimatedAngle::~nsSVGAnimatedAngle()
|
||||
{
|
||||
if (!mBaseVal) return;
|
||||
nsCOMPtr<nsISVGValue> val = do_QueryInterface(mBaseVal);
|
||||
if (!val) return;
|
||||
val->RemoveObserver(this);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGAnimatedAngle::Init(nsIDOMSVGAngle* baseVal)
|
||||
{
|
||||
mBaseVal = baseVal;
|
||||
if (!mBaseVal) return;
|
||||
nsCOMPtr<nsISVGValue> val = do_QueryInterface(mBaseVal);
|
||||
NS_ASSERTION(val, "baseval needs to implement nsISVGValue interface");
|
||||
if (!val) return;
|
||||
val->AddObserver(this);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods:
|
||||
|
||||
NS_IMPL_ADDREF(nsSVGAnimatedAngle)
|
||||
NS_IMPL_RELEASE(nsSVGAnimatedAngle)
|
||||
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGAnimatedAngle)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedAngle)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAnimatedAngle)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGValue methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedAngle::SetValueString(const nsAString& aValue)
|
||||
{
|
||||
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mBaseVal);
|
||||
return value->SetValueString(aValue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedAngle::GetValueString(nsAString& aValue)
|
||||
{
|
||||
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mBaseVal);
|
||||
return value->GetValueString(aValue);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGAnimatedAngle methods:
|
||||
|
||||
/* readonly attribute nsIDOMSVGAngle baseVal; */
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedAngle::GetBaseVal(nsIDOMSVGAngle * *aBaseVal)
|
||||
{
|
||||
*aBaseVal = mBaseVal;
|
||||
NS_ADDREF(*aBaseVal);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAngle animVal; */
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedAngle::GetAnimVal(nsIDOMSVGAngle * *aAnimVal)
|
||||
{
|
||||
*aAnimVal = mBaseVal;
|
||||
NS_ADDREF(*aAnimVal);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGValueObserver methods
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedAngle::WillModifySVGObservable(nsISVGValue* observable,
|
||||
modificationType aModType)
|
||||
{
|
||||
WillModify(aModType);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedAngle::DidModifySVGObservable (nsISVGValue* observable,
|
||||
modificationType aModType)
|
||||
{
|
||||
DidModify(aModType);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Exported creation functions
|
||||
|
||||
nsresult
|
||||
NS_NewSVGAnimatedAngle(nsIDOMSVGAnimatedAngle** aResult,
|
||||
nsIDOMSVGAngle* baseVal)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
|
||||
nsSVGAnimatedAngle* animatedLength = new nsSVGAnimatedAngle();
|
||||
if(!animatedLength) return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(animatedLength);
|
||||
|
||||
animatedLength->Init(baseVal);
|
||||
|
||||
*aResult = (nsIDOMSVGAnimatedAngle*) animatedLength;
|
||||
|
||||
return NS_OK;
|
||||
}
|
@ -68,14 +68,10 @@
|
||||
#include "nsSVGLength2.h"
|
||||
#include "nsSVGNumber2.h"
|
||||
#include "nsSVGInteger.h"
|
||||
#include "nsSVGAngle.h"
|
||||
#include "nsSVGBoolean.h"
|
||||
#include "nsSVGEnum.h"
|
||||
#include "nsIDOMSVGUnitTypes.h"
|
||||
#include "nsIDOMSVGAngle.h"
|
||||
#include "nsIDOMSVGAnimatedAngle.h"
|
||||
#include "nsIDOMSVGAnimatedBoolean.h"
|
||||
#include "nsIDOMSVGAnimatedInteger.h"
|
||||
#include "nsIDOMSVGLength.h"
|
||||
#include "nsIDOMSVGLengthList.h"
|
||||
#include "nsIDOMSVGAnimatedLengthList.h"
|
||||
#include "nsIDOMSVGNumberList.h"
|
||||
@ -131,6 +127,14 @@ nsSVGElement::Init()
|
||||
integerInfo.mIntegers[i].Init(i, integerInfo.mIntegerInfo[i].mDefaultValue);
|
||||
}
|
||||
|
||||
AngleAttributesInfo angleInfo = GetAngleInfo();
|
||||
|
||||
for (i = 0; i < angleInfo.mAngleCount; i++) {
|
||||
angleInfo.mAngles[i].Init(i,
|
||||
angleInfo.mAngleInfo[i].mDefaultValue,
|
||||
angleInfo.mAngleInfo[i].mDefaultUnitType);
|
||||
}
|
||||
|
||||
BooleanAttributesInfo booleanInfo = GetBooleanInfo();
|
||||
|
||||
for (i = 0; i < booleanInfo.mBooleanCount; i++) {
|
||||
@ -259,7 +263,9 @@ nsSVGElement::ParseAttribute(PRInt32 aNamespaceID,
|
||||
|
||||
// Check for nsSVGLength2 attribute
|
||||
LengthAttributesInfo lengthInfo = GetLengthInfo();
|
||||
for (PRUint32 i = 0; i < lengthInfo.mLengthCount && !foundMatch; i++) {
|
||||
|
||||
PRUint32 i;
|
||||
for (i = 0; i < lengthInfo.mLengthCount && !foundMatch; i++) {
|
||||
if (aAttribute == *lengthInfo.mLengthInfo[i].mName) {
|
||||
rv = lengthInfo.mLengths[i].SetBaseValueString(aValue, this, PR_FALSE);
|
||||
foundMatch = PR_TRUE;
|
||||
@ -268,7 +274,7 @@ nsSVGElement::ParseAttribute(PRInt32 aNamespaceID,
|
||||
|
||||
// Check for nsSVGNumber2 attribute
|
||||
NumberAttributesInfo numberInfo = GetNumberInfo();
|
||||
for (PRUint32 i = 0; i < numberInfo.mNumberCount && !foundMatch; i++) {
|
||||
for (i = 0; i < numberInfo.mNumberCount && !foundMatch; i++) {
|
||||
if (aAttribute == *numberInfo.mNumberInfo[i].mName) {
|
||||
rv = numberInfo.mNumbers[i].SetBaseValueString(aValue, this, PR_FALSE);
|
||||
foundMatch = PR_TRUE;
|
||||
@ -277,16 +283,25 @@ nsSVGElement::ParseAttribute(PRInt32 aNamespaceID,
|
||||
|
||||
// Check for nsSVGInteger attribute
|
||||
IntegerAttributesInfo integerInfo = GetIntegerInfo();
|
||||
for (PRUint32 i = 0; i < integerInfo.mIntegerCount && !foundMatch; i++) {
|
||||
for (i = 0; i < integerInfo.mIntegerCount && !foundMatch; i++) {
|
||||
if (aAttribute == *integerInfo.mIntegerInfo[i].mName) {
|
||||
rv = integerInfo.mIntegers[i].SetBaseValueString(aValue, this, PR_FALSE);
|
||||
foundMatch = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for nsSVGAngle attribute
|
||||
AngleAttributesInfo angleInfo = GetAngleInfo();
|
||||
for (i = 0; i < angleInfo.mAngleCount && !foundMatch; i++) {
|
||||
if (aAttribute == *angleInfo.mAngleInfo[i].mName) {
|
||||
rv = angleInfo.mAngles[i].SetBaseValueString(aValue, this, PR_FALSE);
|
||||
foundMatch = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for nsSVGBoolean attribute
|
||||
BooleanAttributesInfo booleanInfo = GetBooleanInfo();
|
||||
for (PRUint32 i = 0; i < booleanInfo.mBooleanCount && !foundMatch; i++) {
|
||||
for (i = 0; i < booleanInfo.mBooleanCount && !foundMatch; i++) {
|
||||
if (aAttribute == *booleanInfo.mBooleanInfo[i].mName) {
|
||||
rv = booleanInfo.mBooleans[i].SetBaseValueString(aValue, this, PR_FALSE);
|
||||
foundMatch = PR_TRUE;
|
||||
@ -295,7 +310,7 @@ nsSVGElement::ParseAttribute(PRInt32 aNamespaceID,
|
||||
|
||||
// Check for nsSVGEnum attribute
|
||||
EnumAttributesInfo enumInfo = GetEnumInfo();
|
||||
for (PRUint32 i = 0; i < enumInfo.mEnumCount && !foundMatch; i++) {
|
||||
for (i = 0; i < enumInfo.mEnumCount && !foundMatch; i++) {
|
||||
if (aAttribute == *enumInfo.mEnumInfo[i].mName) {
|
||||
rv = enumInfo.mEnums[i].SetBaseValueString(aValue, this, PR_FALSE);
|
||||
foundMatch = PR_TRUE;
|
||||
@ -366,6 +381,18 @@ nsSVGElement::UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||
}
|
||||
}
|
||||
|
||||
// Check if this is an angle attribute going away
|
||||
AngleAttributesInfo angleInfo = GetAngleInfo();
|
||||
|
||||
for (i = 0; i < angleInfo.mAngleCount; i++) {
|
||||
if (aName == *angleInfo.mAngleInfo[i].mName) {
|
||||
angleInfo.mAngles[i].Init(i,
|
||||
angleInfo.mAngleInfo[i].mDefaultValue,
|
||||
angleInfo.mAngleInfo[i].mDefaultUnitType);
|
||||
DidChangeAngle(i, PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if this is a boolean attribute going away
|
||||
BooleanAttributesInfo boolInfo = GetBooleanInfo();
|
||||
|
||||
@ -390,11 +417,6 @@ nsSVGElement::UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||
nsCOMPtr<nsISVGValue> svg_value = GetMappedAttribute(aNamespaceID, aName);
|
||||
|
||||
if (svg_value) {
|
||||
#ifdef DEBUG_tor
|
||||
nsCOMPtr<nsIDOMSVGAnimatedAngle> a = do_QueryInterface(svg_value);
|
||||
NS_ASSERTION(!a, "must provide element processing for unset angle");
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIDOMSVGAnimatedRect> r = do_QueryInterface(svg_value);
|
||||
if (r) {
|
||||
nsCOMPtr<nsIDOMSVGRect> rect;
|
||||
@ -1063,6 +1085,32 @@ nsSVGElement::GetAnimatedIntegerValues(PRInt32 *aFirst, ...)
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
nsSVGElement::AngleAttributesInfo
|
||||
nsSVGElement::GetAngleInfo()
|
||||
{
|
||||
return AngleAttributesInfo(nsnull, nsnull, 0);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGElement::DidChangeAngle(PRUint8 aAttrEnum, PRBool aDoSetAttr)
|
||||
{
|
||||
if (!aDoSetAttr)
|
||||
return;
|
||||
|
||||
AngleAttributesInfo info = GetAngleInfo();
|
||||
|
||||
NS_ASSERTION(info.mAngleCount > 0,
|
||||
"DidChangeAngle on element with no angle attribs");
|
||||
|
||||
NS_ASSERTION(aAttrEnum < info.mAngleCount, "aAttrEnum out of range");
|
||||
|
||||
nsAutoString newStr;
|
||||
info.mAngles[aAttrEnum].GetBaseValueString(newStr);
|
||||
|
||||
SetAttr(kNameSpaceID_None, *info.mAngleInfo[aAttrEnum].mName,
|
||||
newStr, PR_TRUE);
|
||||
}
|
||||
|
||||
nsSVGElement::BooleanAttributesInfo
|
||||
nsSVGElement::GetBooleanInfo()
|
||||
{
|
||||
@ -1078,7 +1126,7 @@ nsSVGElement::DidChangeBoolean(PRUint8 aAttrEnum, PRBool aDoSetAttr)
|
||||
BooleanAttributesInfo info = GetBooleanInfo();
|
||||
|
||||
NS_ASSERTION(info.mBooleanCount > 0,
|
||||
"DidChangeInteger on element with no boolean attribs");
|
||||
"DidChangeBoolean on element with no boolean attribs");
|
||||
|
||||
NS_ASSERTION(aAttrEnum < info.mBooleanCount, "aAttrEnum out of range");
|
||||
|
||||
|
@ -58,6 +58,7 @@ class nsSVGSVGElement;
|
||||
class nsSVGLength2;
|
||||
class nsSVGNumber2;
|
||||
class nsSVGInteger;
|
||||
class nsSVGAngle;
|
||||
class nsSVGBoolean;
|
||||
class nsSVGEnum;
|
||||
struct nsSVGEnumMapping;
|
||||
@ -121,6 +122,7 @@ public:
|
||||
virtual void DidChangeLength(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||
virtual void DidChangeNumber(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||
virtual void DidChangeInteger(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||
virtual void DidChangeAngle(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||
virtual void DidChangeBoolean(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||
virtual void DidChangeEnum(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||
|
||||
@ -151,7 +153,7 @@ protected:
|
||||
struct LengthInfo {
|
||||
nsIAtom** mName;
|
||||
float mDefaultValue;
|
||||
PRUint16 mDefaultUnitType;
|
||||
PRUint8 mDefaultUnitType;
|
||||
PRUint8 mCtxType;
|
||||
};
|
||||
|
||||
@ -201,6 +203,24 @@ protected:
|
||||
{}
|
||||
};
|
||||
|
||||
struct AngleInfo {
|
||||
nsIAtom** mName;
|
||||
float mDefaultValue;
|
||||
PRUint8 mDefaultUnitType;
|
||||
};
|
||||
|
||||
struct AngleAttributesInfo {
|
||||
nsSVGAngle* mAngles;
|
||||
AngleInfo* mAngleInfo;
|
||||
PRUint32 mAngleCount;
|
||||
|
||||
AngleAttributesInfo(nsSVGAngle *aAngles,
|
||||
AngleInfo *aAngleInfo,
|
||||
PRUint32 aAngleCount) :
|
||||
mAngles(aAngles), mAngleInfo(aAngleInfo), mAngleCount(aAngleCount)
|
||||
{}
|
||||
};
|
||||
|
||||
struct BooleanInfo {
|
||||
nsIAtom** mName;
|
||||
PRPackedBool mDefaultValue;
|
||||
@ -241,15 +261,16 @@ protected:
|
||||
virtual LengthAttributesInfo GetLengthInfo();
|
||||
virtual NumberAttributesInfo GetNumberInfo();
|
||||
virtual IntegerAttributesInfo GetIntegerInfo();
|
||||
virtual AngleAttributesInfo GetAngleInfo();
|
||||
virtual BooleanAttributesInfo GetBooleanInfo();
|
||||
virtual EnumAttributesInfo GetEnumInfo();
|
||||
|
||||
static nsSVGEnumMapping sSVGUnitTypesMap[];
|
||||
|
||||
static nsresult ReportAttributeParseFailure(nsIDocument* aDocument,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue);
|
||||
|
||||
static nsSVGEnumMapping sSVGUnitTypesMap[];
|
||||
|
||||
nsCOMPtr<nsICSSStyleRule> mContentStyleRule;
|
||||
nsAttrAndChildArray mMappedAttributes;
|
||||
|
||||
|
@ -104,7 +104,7 @@ nsSVGEnum::SetBaseValue(PRUint16 aValue,
|
||||
|
||||
while (tmp && tmp->mKey) {
|
||||
if (tmp->mVal == aValue) {
|
||||
mAnimVal = mBaseVal = static_cast<PRUint8>(aValue);
|
||||
mAnimVal = mBaseVal = PRUint8(aValue);
|
||||
aSVGElement->DidChangeEnum(mAttrEnum, aDoSetAttr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -50,9 +50,11 @@ struct nsSVGEnumMapping {
|
||||
|
||||
class nsSVGEnum
|
||||
{
|
||||
friend class nsSVGMarkerElement;
|
||||
|
||||
public:
|
||||
void Init(PRUint8 aAttrEnum, PRUint16 aValue) {
|
||||
mAnimVal = mBaseVal = static_cast<PRUint8>(aValue);
|
||||
mAnimVal = mBaseVal = PRUint8(aValue);
|
||||
mAttrEnum = aAttrEnum;
|
||||
}
|
||||
|
||||
@ -81,6 +83,10 @@ private:
|
||||
|
||||
nsSVGEnumMapping *GetMapping(nsSVGElement *aSVGElement);
|
||||
|
||||
nsresult SetBaseValue(PRUint16 aValue)
|
||||
{ mAnimVal = mBaseVal = PRUint8(aValue);
|
||||
return NS_OK; }
|
||||
|
||||
struct DOMAnimatedEnum : public nsIDOMSVGAnimatedEnumeration
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
@ -1078,7 +1078,7 @@ nsSVGFEBlendElement::Filter(nsSVGFilterInstance *instance)
|
||||
NS_IMETHODIMP
|
||||
nsSVGFEBlendElement::GetRequirements(PRUint32 *aRequirements)
|
||||
{
|
||||
*aRequirements = CheckStandardNames(mIn1);
|
||||
*aRequirements = CheckStandardNames(mIn1) | CheckStandardNames(mIn2);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1343,7 +1343,7 @@ nsSVGFEColorMatrixElement::Filter(nsSVGFilterInstance *instance)
|
||||
|
||||
colorMatrix[10] = 0.213f - 0.213f * s;
|
||||
colorMatrix[11] = 0.715f - 0.715f * s;
|
||||
colorMatrix[12] = 0.715f - 0.715f * s;
|
||||
colorMatrix[12] = 0.072f + 0.928f * s;
|
||||
|
||||
break;
|
||||
|
||||
@ -1694,7 +1694,7 @@ nsSVGFECompositeElement::Filter(nsSVGFilterInstance *instance)
|
||||
NS_IMETHODIMP
|
||||
nsSVGFECompositeElement::GetRequirements(PRUint32 *aRequirements)
|
||||
{
|
||||
*aRequirements = CheckStandardNames(mIn1);
|
||||
*aRequirements = CheckStandardNames(mIn1) | CheckStandardNames(mIn2);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -35,10 +35,7 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsSVGAnimatedAngle.h"
|
||||
#include "nsSVGAnimatedRect.h"
|
||||
#include "nsSVGLength.h"
|
||||
#include "nsSVGAngle.h"
|
||||
#include "nsSVGRect.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsISVGValueUtils.h"
|
||||
@ -71,6 +68,11 @@ nsSVGElement::EnumInfo nsSVGMarkerElement::sEnumInfo[1] =
|
||||
}
|
||||
};
|
||||
|
||||
nsSVGElement::AngleInfo nsSVGMarkerElement::sAngleInfo[1] =
|
||||
{
|
||||
{ &nsGkAtoms::orient, 0, nsIDOMSVGAngle::SVG_ANGLETYPE_UNSPECIFIED }
|
||||
};
|
||||
|
||||
NS_IMPL_NS_NEW_SVG_ELEMENT(Marker)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@ -107,15 +109,6 @@ nsSVGMarkerElement::Init()
|
||||
// DOM property: orientType
|
||||
mOrientType.Init(ORIENTTYPE, SVG_MARKER_ORIENT_ANGLE);
|
||||
|
||||
// DOM property: orientAngle
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGAngle> angle;
|
||||
rv = NS_NewSVGAngle(getter_AddRefs(angle), 0.0f);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = NS_NewSVGAnimatedAngle(getter_AddRefs(mOrientAngle), angle);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
// Create mapped properties:
|
||||
|
||||
// DOM property: viewBox
|
||||
@ -213,15 +206,14 @@ NS_IMETHODIMP nsSVGMarkerElement::GetOrientType(nsIDOMSVGAnimatedEnumeration * *
|
||||
/* readonly attribute nsIDOMSVGAnimatedLength orientAngle; */
|
||||
NS_IMETHODIMP nsSVGMarkerElement::GetOrientAngle(nsIDOMSVGAnimatedAngle * *aOrientAngle)
|
||||
{
|
||||
*aOrientAngle = mOrientAngle;
|
||||
NS_IF_ADDREF(*aOrientAngle);
|
||||
return NS_OK;
|
||||
return mAngleAttributes[ORIENT].ToDOMAnimatedAngle(aOrientAngle, this);
|
||||
}
|
||||
|
||||
/* void setOrientToAuto (); */
|
||||
NS_IMETHODIMP nsSVGMarkerElement::SetOrientToAuto()
|
||||
{
|
||||
mOrientType.SetBaseValue(SVG_MARKER_ORIENT_AUTO, this, PR_TRUE);
|
||||
SetAttr(kNameSpaceID_None, nsGkAtoms::orient, nsnull,
|
||||
NS_LITERAL_STRING("auto"), PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -231,13 +223,9 @@ NS_IMETHODIMP nsSVGMarkerElement::SetOrientToAngle(nsIDOMSVGAngle *angle)
|
||||
if (!angle)
|
||||
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
|
||||
|
||||
nsIDOMSVGAngle *a;
|
||||
mOrientAngle->GetBaseVal(&a);
|
||||
float f;
|
||||
angle->GetValue(&f);
|
||||
a->SetValue(f);
|
||||
|
||||
mOrientType.SetBaseValue(SVG_MARKER_ORIENT_ANGLE, this, PR_TRUE);
|
||||
mAngleAttributes[ORIENT].SetBaseValue(f, this);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -281,15 +269,10 @@ PRBool
|
||||
nsSVGMarkerElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
nsAString &aResult) const
|
||||
{
|
||||
if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::orient) {
|
||||
if (mOrientType.GetBaseValue() == SVG_MARKER_ORIENT_AUTO) {
|
||||
aResult.AssignLiteral("auto");
|
||||
} else {
|
||||
nsCOMPtr<nsIDOMSVGAngle> a;
|
||||
mOrientAngle->GetBaseVal(getter_AddRefs(a));
|
||||
nsCOMPtr<nsISVGValue> value = do_QueryInterface(a);
|
||||
value->GetValueString(aResult);
|
||||
}
|
||||
if (aNameSpaceID == kNameSpaceID_None &&
|
||||
aName == nsGkAtoms::orient &&
|
||||
mOrientType.GetBaseValue() == SVG_MARKER_ORIENT_AUTO) {
|
||||
aResult.AssignLiteral("auto");
|
||||
return PR_TRUE;
|
||||
}
|
||||
return nsSVGMarkerElementBase::GetAttr(aNameSpaceID, aName, aResult);
|
||||
@ -301,15 +284,9 @@ nsSVGMarkerElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
PRBool aNotify)
|
||||
{
|
||||
if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::orient) {
|
||||
if (aValue.EqualsLiteral("auto")) {
|
||||
mOrientType.SetBaseValue(SVG_MARKER_ORIENT_AUTO, this, PR_FALSE);
|
||||
} else {
|
||||
mOrientType.SetBaseValue(SVG_MARKER_ORIENT_ANGLE, this, PR_FALSE);
|
||||
nsCOMPtr<nsIDOMSVGAngle> a;
|
||||
mOrientAngle->GetBaseVal(getter_AddRefs(a));
|
||||
nsCOMPtr<nsISVGValue> value = do_QueryInterface(a);
|
||||
value->SetValueString(aValue);
|
||||
}
|
||||
mOrientType.SetBaseValue(aValue.EqualsLiteral("auto") ?
|
||||
SVG_MARKER_ORIENT_AUTO :
|
||||
SVG_MARKER_ORIENT_ANGLE);
|
||||
}
|
||||
|
||||
return nsSVGMarkerElementBase::SetAttr(aNameSpaceID, aName,
|
||||
@ -328,15 +305,10 @@ nsSVGMarkerElement::UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||
vb->SetY(0);
|
||||
vb->SetWidth(mLengthAttributes[MARKERWIDTH].GetAnimValue(mCoordCtx));
|
||||
vb->SetHeight(mLengthAttributes[MARKERHEIGHT].GetAnimValue(mCoordCtx));
|
||||
return nsGenericElement::UnsetAttr(aNamespaceID, aName, aNotify);
|
||||
} else if (aName == nsGkAtoms::orient) {
|
||||
mOrientType.SetBaseValue(SVG_MARKER_ORIENT_ANGLE, this, PR_FALSE);
|
||||
nsIDOMSVGAngle *angle;
|
||||
mOrientAngle->GetBaseVal(&angle);
|
||||
angle->NewValueSpecifiedUnits(nsIDOMSVGAngle::SVG_ANGLETYPE_UNSPECIFIED,
|
||||
0.0f);
|
||||
mOrientType.SetBaseValue(SVG_MARKER_ORIENT_ANGLE);
|
||||
}
|
||||
|
||||
return nsGenericElement::UnsetAttr(aNamespaceID, aName, aNotify);
|
||||
}
|
||||
|
||||
return nsSVGMarkerElementBase::UnsetAttr(aNamespaceID, aName, aNotify);
|
||||
@ -361,31 +333,6 @@ nsSVGMarkerElement::DidChangeLength(PRUint8 aAttrEnum, PRBool aDoSetAttr)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGMarkerElement::DidChangeEnum(PRUint8 aAttrEnum, PRBool aDoSetAttr)
|
||||
{
|
||||
if (!aDoSetAttr)
|
||||
return;
|
||||
|
||||
if (aAttrEnum == ORIENTTYPE) {
|
||||
if (mOrientType.GetBaseValue() == SVG_MARKER_ORIENT_AUTO) {
|
||||
nsSVGMarkerElementBase::SetAttr(kNameSpaceID_None, nsGkAtoms::orient,
|
||||
NS_LITERAL_STRING("auto"), PR_TRUE);
|
||||
} else {
|
||||
nsAutoString value;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::orient, value);
|
||||
if (value.EqualsLiteral("auto")) {
|
||||
// type is being set to non-auto - remove an "auto" valued
|
||||
// attribute if it's set, otherwise leave the angle specified.
|
||||
UnsetAttr(kNameSpaceID_None, nsGkAtoms::orient, PR_TRUE);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
nsSVGMarkerElementBase::DidChangeEnum(aAttrEnum, aDoSetAttr);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGMarkerElement::SetParentCoordCtxProvider(nsSVGSVGElement *aContext)
|
||||
{
|
||||
@ -407,6 +354,13 @@ nsSVGMarkerElement::GetLengthInfo()
|
||||
NS_ARRAY_LENGTH(sLengthInfo));
|
||||
}
|
||||
|
||||
nsSVGElement::AngleAttributesInfo
|
||||
nsSVGMarkerElement::GetAngleInfo()
|
||||
{
|
||||
return AngleAttributesInfo(mAngleAttributes, sAngleInfo,
|
||||
NS_ARRAY_LENGTH(sAngleInfo));
|
||||
}
|
||||
|
||||
nsSVGElement::EnumAttributesInfo
|
||||
nsSVGMarkerElement::GetEnumInfo()
|
||||
{
|
||||
@ -427,10 +381,8 @@ nsSVGMarkerElement::GetMarkerTransform(float aStrokeWidth,
|
||||
SVG_MARKERUNITS_STROKEWIDTH)
|
||||
scale = aStrokeWidth;
|
||||
|
||||
if (mOrientType.GetBaseValue() != SVG_MARKER_ORIENT_AUTO) {
|
||||
nsCOMPtr<nsIDOMSVGAngle> a;
|
||||
mOrientAngle->GetAnimVal(getter_AddRefs(a));
|
||||
a->GetValue(&aAngle);
|
||||
if (mOrientType.GetAnimValue() != SVG_MARKER_ORIENT_AUTO) {
|
||||
aAngle = mAngleAttributes[ORIENT].GetAnimValue();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMSVGMatrix> matrix;
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "nsIDOMSVGFitToViewBox.h"
|
||||
#include "nsSVGLength2.h"
|
||||
#include "nsSVGEnum.h"
|
||||
#include "nsSVGAngle.h"
|
||||
|
||||
typedef nsSVGGraphicElement nsSVGMarkerElementBase;
|
||||
|
||||
@ -86,7 +87,6 @@ public:
|
||||
|
||||
// nsSVGElement specializations:
|
||||
virtual void DidChangeLength(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||
virtual void DidChangeEnum(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||
|
||||
// public helpers
|
||||
nsresult GetMarkerTransform(float aStrokeWidth,
|
||||
@ -101,6 +101,7 @@ protected:
|
||||
void SetParentCoordCtxProvider(nsSVGSVGElement *aContext);
|
||||
|
||||
virtual LengthAttributesInfo GetLengthInfo();
|
||||
virtual AngleAttributesInfo GetAngleInfo();
|
||||
virtual EnumAttributesInfo GetEnumInfo();
|
||||
|
||||
enum { REFX, REFY, MARKERWIDTH, MARKERHEIGHT };
|
||||
@ -112,9 +113,12 @@ protected:
|
||||
static nsSVGEnumMapping sUnitsMap[];
|
||||
static EnumInfo sEnumInfo[1];
|
||||
|
||||
enum { ORIENT };
|
||||
nsSVGAngle mAngleAttributes[1];
|
||||
static AngleInfo sAngleInfo[1];
|
||||
|
||||
// derived properties (from 'orient') handled separately
|
||||
nsSVGEnum mOrientType;
|
||||
nsCOMPtr<nsIDOMSVGAnimatedAngle> mOrientAngle;
|
||||
|
||||
nsSVGSVGElement *mCoordCtx;
|
||||
nsCOMPtr<nsIDOMSVGAnimatedRect> mViewBox;
|
||||
|
@ -567,7 +567,7 @@ nsSVGSVGElement::CreateSVGLength(nsIDOMSVGLength **_retval)
|
||||
NS_IMETHODIMP
|
||||
nsSVGSVGElement::CreateSVGAngle(nsIDOMSVGAngle **_retval)
|
||||
{
|
||||
return NS_NewSVGAngle(_retval);
|
||||
return NS_NewDOMSVGAngle(_retval);
|
||||
}
|
||||
|
||||
/* nsIDOMSVGPoint createSVGPoint (); */
|
||||
|
@ -108,8 +108,10 @@ nsSVGValue::AddObserver(nsISVGValueObserver* observer)
|
||||
// stroke and fill. Safe, as on a style change we remove both, as
|
||||
// the change notification isn't fine grained, and re-add as
|
||||
// appropriate.
|
||||
if (mObservers.IndexOf((void*)wr) >= 0)
|
||||
if (mObservers.IndexOf((void*)wr) >= 0) {
|
||||
NS_RELEASE(wr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mObservers.AppendElement((void*)wr);
|
||||
return NS_OK;
|
||||
|
@ -87,6 +87,10 @@
|
||||
// = nsAnonymousContentList
|
||||
// ==================================================================
|
||||
|
||||
#define NS_ANONYMOUS_CONTENT_LIST_IID \
|
||||
{ 0xa29df1f8, 0xaeca, 0x4356, \
|
||||
{ 0xa8, 0xc2, 0xa7, 0x24, 0xa2, 0x11, 0x73, 0xac } }
|
||||
|
||||
class nsAnonymousContentList : public nsIDOMNodeList
|
||||
{
|
||||
public:
|
||||
@ -102,11 +106,14 @@ public:
|
||||
|
||||
nsXBLInsertionPoint* GetInsertionPointAt(PRInt32 i) { return static_cast<nsXBLInsertionPoint*>(mElements->ElementAt(i)); }
|
||||
void RemoveInsertionPointAt(PRInt32 i) { mElements->RemoveElementAt(i); }
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ANONYMOUS_CONTENT_LIST_IID)
|
||||
private:
|
||||
nsInsertionPointList* mElements;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsAnonymousContentList,
|
||||
NS_ANONYMOUS_CONTENT_LIST_IID)
|
||||
|
||||
nsAnonymousContentList::nsAnonymousContentList(nsInsertionPointList* aElements)
|
||||
: mElements(aElements)
|
||||
{
|
||||
@ -129,6 +136,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsAnonymousContentList)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsAnonymousContentList)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNodeList)
|
||||
NS_INTERFACE_MAP_ENTRY(nsAnonymousContentList)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(NodeList)
|
||||
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsAnonymousContentList)
|
||||
@ -299,8 +307,17 @@ SetOrRemoveObject(PLDHashTable& table, nsIContent* aKey, nsISupports* aValue)
|
||||
}
|
||||
|
||||
// no value, so remove the key from the table
|
||||
if (table.ops)
|
||||
RemoveObjectEntry(table, aKey);
|
||||
if (table.ops) {
|
||||
ObjectEntry* entry =
|
||||
static_cast<ObjectEntry*>
|
||||
(PL_DHashTableOperate(&table, aKey, PL_DHASH_LOOKUP));
|
||||
if (entry && PL_DHASH_ENTRY_IS_BUSY(entry)) {
|
||||
// Keep key and value alive while removing the entry.
|
||||
nsCOMPtr<nsISupports> key = entry->GetKey();
|
||||
nsCOMPtr<nsISupports> value = entry->GetValue();
|
||||
RemoveObjectEntry(table, aKey);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -402,12 +419,60 @@ nsBindingManager::~nsBindingManager(void)
|
||||
PL_DHashTableFinish(&mContentListTable);
|
||||
if (mAnonymousNodesTable.ops)
|
||||
PL_DHashTableFinish(&mAnonymousNodesTable);
|
||||
NS_ASSERTION(!mInsertionParentTable.ops || !mInsertionParentTable.entryCount,
|
||||
"Insertion parent table isn't empty!");
|
||||
if (mInsertionParentTable.ops)
|
||||
PL_DHashTableFinish(&mInsertionParentTable);
|
||||
if (mWrapperTable.ops)
|
||||
PL_DHashTableFinish(&mWrapperTable);
|
||||
}
|
||||
|
||||
PLDHashOperator
|
||||
PR_CALLBACK RemoveInsertionParentCB(PLDHashTable* aTable, PLDHashEntryHdr* aEntry,
|
||||
PRUint32 aNumber, void* aArg)
|
||||
{
|
||||
return (static_cast<ObjectEntry*>(aEntry)->GetValue() ==
|
||||
static_cast<nsISupports*>(aArg)) ? PL_DHASH_REMOVE : PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
static void
|
||||
RemoveInsertionParentForNodeList(nsIDOMNodeList* aList, nsIContent* aParent)
|
||||
{
|
||||
nsCOMPtr<nsAnonymousContentList> list = do_QueryInterface(aList);
|
||||
if (list) {
|
||||
PRInt32 count = list->GetInsertionPointCount();
|
||||
for (PRInt32 i = 0; i < count; ++i) {
|
||||
nsRefPtr<nsXBLInsertionPoint> currPoint = list->GetInsertionPointAt(i);
|
||||
nsCOMPtr<nsIContent> defContent = currPoint->GetDefaultContent();
|
||||
if (defContent) {
|
||||
defContent->UnbindFromTree();
|
||||
}
|
||||
#ifdef DEBUG
|
||||
nsCOMPtr<nsIContent> parent = currPoint->GetInsertionParent();
|
||||
NS_ASSERTION(!parent || parent == aParent, "Wrong insertion parent!");
|
||||
#endif
|
||||
currPoint->ClearInsertionParent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsBindingManager::RemoveInsertionParent(nsIContent* aParent)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNodeList> contentlist;
|
||||
GetContentListFor(aParent, getter_AddRefs(contentlist));
|
||||
RemoveInsertionParentForNodeList(contentlist, aParent);
|
||||
|
||||
nsCOMPtr<nsIDOMNodeList> anonnodes;
|
||||
GetAnonymousNodesFor(aParent, getter_AddRefs(anonnodes));
|
||||
RemoveInsertionParentForNodeList(anonnodes, aParent);
|
||||
|
||||
if (mInsertionParentTable.ops) {
|
||||
PL_DHashTableEnumerate(&mInsertionParentTable, RemoveInsertionParentCB,
|
||||
static_cast<nsISupports*>(aParent));
|
||||
}
|
||||
}
|
||||
|
||||
nsXBLBinding*
|
||||
nsBindingManager::GetBinding(nsIContent* aContent)
|
||||
{
|
||||
@ -433,8 +498,18 @@ nsBindingManager::SetBinding(nsIContent* aContent, nsXBLBinding* aBinding)
|
||||
// constructor twice (if aBinding inherits from it) or firing its constructor
|
||||
// after aContent has been deleted (if aBinding is null and the content node
|
||||
// dies before we process mAttachedStack).
|
||||
nsXBLBinding* oldBinding = mBindingTable.GetWeak(aContent);
|
||||
nsRefPtr<nsXBLBinding> oldBinding = GetBinding(aContent);
|
||||
if (oldBinding) {
|
||||
if (aContent->HasFlag(NODE_IS_INSERTION_PARENT)) {
|
||||
nsRefPtr<nsXBLBinding> parentBinding =
|
||||
GetBinding(aContent->GetBindingParent());
|
||||
// Clear insertion parent only if we don't have a parent binding which
|
||||
// marked content to be an insertion parent. See also ChangeDocumentFor().
|
||||
if (!parentBinding || !parentBinding->HasInsertionParent(aContent)) {
|
||||
RemoveInsertionParent(aContent);
|
||||
aContent->UnsetFlags(NODE_IS_INSERTION_PARENT);
|
||||
}
|
||||
}
|
||||
mAttachedStack.RemoveElement(oldBinding);
|
||||
}
|
||||
|
||||
@ -471,6 +546,8 @@ nsBindingManager::GetInsertionParent(nsIContent* aContent)
|
||||
nsresult
|
||||
nsBindingManager::SetInsertionParent(nsIContent* aContent, nsIContent* aParent)
|
||||
{
|
||||
NS_ASSERTION(!aParent || aParent->HasFlag(NODE_IS_INSERTION_PARENT),
|
||||
"Insertion parent should have NODE_IS_INSERTION_PARENT flag!");
|
||||
return SetOrRemoveObject(mInsertionParentTable, aContent, aParent);
|
||||
}
|
||||
|
||||
@ -505,6 +582,19 @@ nsBindingManager::ChangeDocumentFor(nsIContent* aContent, nsIDocument* aOldDocum
|
||||
// Hold a ref to the binding so it won't die when we remove it from our
|
||||
// table.
|
||||
nsRefPtr<nsXBLBinding> binding = GetBinding(aContent);
|
||||
if (aContent->HasFlag(NODE_IS_INSERTION_PARENT)) {
|
||||
nsRefPtr<nsXBLBinding> parentBinding = GetBinding(aContent->GetBindingParent());
|
||||
if (parentBinding) {
|
||||
parentBinding->RemoveInsertionParent(aContent);
|
||||
// Clear insertion parent only if we don't have a binding which
|
||||
// marked content to be an insertion parent. See also SetBinding().
|
||||
if (!binding || !binding->HasInsertionParent(aContent)) {
|
||||
RemoveInsertionParent(aContent);
|
||||
aContent->UnsetFlags(NODE_IS_INSERTION_PARENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (binding) {
|
||||
binding->ChangeDocument(aOldDocument, aNewDocument);
|
||||
SetBinding(aContent, nsnull);
|
||||
|
@ -235,6 +235,7 @@ protected:
|
||||
|
||||
// MEMBER VARIABLES
|
||||
protected:
|
||||
void RemoveInsertionParent(nsIContent* aParent);
|
||||
// A mapping from nsIContent* to the nsXBLBinding* that is
|
||||
// installed on that element.
|
||||
nsRefPtrHashtable<nsISupportsHashKey,nsXBLBinding> mBindingTable;
|
||||
|
@ -442,6 +442,10 @@ BuildContentLists(nsISupports* aKey,
|
||||
// Figure out the relevant content node.
|
||||
nsXBLInsertionPoint* currPoint = aData->ElementAt(0);
|
||||
nsCOMPtr<nsIContent> parent = currPoint->GetInsertionParent();
|
||||
if (!parent) {
|
||||
data->mRv = NS_ERROR_FAILURE;
|
||||
return PL_DHASH_STOP;
|
||||
}
|
||||
PRInt32 currIndex = currPoint->GetInsertionIndex();
|
||||
|
||||
nsCOMPtr<nsIDOMNodeList> nodeList;
|
||||
@ -526,6 +530,10 @@ RealizeDefaultContent(nsISupports* aKey,
|
||||
// actual default content (through cloning).
|
||||
// Clone this insertion point element.
|
||||
nsCOMPtr<nsIContent> insParent = currPoint->GetInsertionParent();
|
||||
if (!insParent) {
|
||||
data->mRv = NS_ERROR_FAILURE;
|
||||
return PL_DHASH_STOP;
|
||||
}
|
||||
nsIDocument *document = insParent->GetOwnerDoc();
|
||||
if (!document) {
|
||||
data->mRv = NS_ERROR_FAILURE;
|
||||
@ -1326,6 +1334,47 @@ nsXBLBinding::AllowScripts()
|
||||
return NS_SUCCEEDED(rv) && canExecute;
|
||||
}
|
||||
|
||||
void
|
||||
nsXBLBinding::RemoveInsertionParent(nsIContent* aParent)
|
||||
{
|
||||
if (mNextBinding) {
|
||||
mNextBinding->RemoveInsertionParent(aParent);
|
||||
}
|
||||
if (mInsertionPointTable) {
|
||||
nsInsertionPointList* list = nsnull;
|
||||
mInsertionPointTable->Get(aParent, &list);
|
||||
if (list) {
|
||||
PRInt32 count = list->Length();
|
||||
for (PRInt32 i = 0; i < count; ++i) {
|
||||
nsRefPtr<nsXBLInsertionPoint> currPoint = list->ElementAt(i);
|
||||
nsCOMPtr<nsIContent> defContent = currPoint->GetDefaultContent();
|
||||
if (defContent) {
|
||||
defContent->UnbindFromTree();
|
||||
}
|
||||
#ifdef DEBUG
|
||||
nsCOMPtr<nsIContent> parent = currPoint->GetInsertionParent();
|
||||
NS_ASSERTION(!parent || parent == aParent, "Wrong insertion parent!");
|
||||
#endif
|
||||
currPoint->ClearInsertionParent();
|
||||
}
|
||||
mInsertionPointTable->Remove(aParent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsXBLBinding::HasInsertionParent(nsIContent* aParent)
|
||||
{
|
||||
if (mInsertionPointTable) {
|
||||
nsInsertionPointList* list = nsnull;
|
||||
mInsertionPointTable->Get(aParent, &list);
|
||||
if (list) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
return mNextBinding ? mNextBinding->HasInsertionParent(aParent) : PR_FALSE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXBLBinding::GetInsertionPointsFor(nsIContent* aParent,
|
||||
nsInsertionPointList** aResult)
|
||||
@ -1349,6 +1398,9 @@ nsXBLBinding::GetInsertionPointsFor(nsIContent* aParent,
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
if (aParent) {
|
||||
aParent->SetFlags(NODE_IS_INSERTION_PARENT);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -164,6 +164,9 @@ public:
|
||||
|
||||
PRBool AllowScripts(); // XXX make const
|
||||
|
||||
void RemoveInsertionParent(nsIContent* aParent);
|
||||
PRBool HasInsertionParent(nsIContent* aParent);
|
||||
|
||||
// MEMBER VARIABLES
|
||||
protected:
|
||||
nsAutoRefCnt mRefCnt;
|
||||
|
@ -63,6 +63,8 @@ public:
|
||||
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsXBLInsertionPoint)
|
||||
|
||||
already_AddRefed<nsIContent> GetInsertionParent();
|
||||
void ClearInsertionParent() { mParentElement = nsnull; }
|
||||
|
||||
PRInt32 GetInsertionIndex() { return mIndex; }
|
||||
|
||||
void SetDefaultContent(nsIContent* aDefaultContent) { mDefaultContent = aDefaultContent; }
|
||||
|
@ -55,7 +55,6 @@
|
||||
class nsIAtom;
|
||||
class nsIDocument;
|
||||
class nsIScriptContext;
|
||||
class nsISupportsArray;
|
||||
class nsSupportsHashtable;
|
||||
class nsIXBLService;
|
||||
class nsFixedSizeAllocator;
|
||||
|
@ -41,7 +41,6 @@
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsICSSLoaderObserver.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIStyleRuleProcessor.h"
|
||||
#include "nsCOMArray.h"
|
||||
|
||||
|
@ -51,6 +51,7 @@ _TEST_FILES = \
|
||||
test_bug366770.html \
|
||||
test_bug371724.xhtml \
|
||||
test_bug372769.xhtml \
|
||||
test_bug378866.xhtml \
|
||||
test_bug397934.xhtml \
|
||||
$(NULL)
|
||||
|
||||
|
58
content/xbl/test/test_bug378866.xhtml
Normal file
58
content/xbl/test/test_bug378866.xhtml
Normal file
@ -0,0 +1,58 @@
|
||||
<?xml version="1.0"?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=378866
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 378866</title>
|
||||
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<bindings xmlns="http://www.mozilla.org/xbl" xmlns:html="http://www.w3.org/1999/xhtml">
|
||||
<binding id="b1">
|
||||
<content><html:span><html:span>
|
||||
<children/>
|
||||
</html:span></html:span></content>
|
||||
</binding>
|
||||
</bindings>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=378866">Mozilla Bug 378866</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
<span id="grandparent" style="-moz-binding: url(#b1);">
|
||||
<span id="parent">
|
||||
<span id="child"/>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
<![CDATA[
|
||||
|
||||
/** Test for Bug 378866 **/
|
||||
|
||||
function runTest() {
|
||||
var anon = document.getAnonymousNodes(document.getElementById('grandparent'));
|
||||
var child = document.getElementById('child');
|
||||
var insertionPoint = anon[0].childNodes[0];
|
||||
insertionPoint.parentNode.removeChild(insertionPoint);
|
||||
child.appendChild(insertionPoint);
|
||||
|
||||
var e = document.createEvent("Event");
|
||||
e.initEvent("foo", true, true);
|
||||
child.dispatchEvent(e);
|
||||
ok(true, "Moving insertion point shouldn't cause problems in event dispatching");
|
||||
addLoadEvent(SimpleTest.finish);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(runTest);
|
||||
|
||||
]]>
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -39,7 +39,6 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIXMLContentBuilder.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsIContent.h"
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsElementMap.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
@ -49,7 +49,6 @@
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsIControllers.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsISecurityCheckedComponent.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
|
@ -52,7 +52,6 @@
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMXULCommandDispatcher.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIXULDocument.h"
|
||||
|
@ -37,7 +37,6 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsContentTestNode.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIRDFResource.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
@ -50,6 +50,7 @@ include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TEST_FILES = \
|
||||
test_bug344861.html \
|
||||
test_bug384014.html \
|
||||
test_bug387979.html \
|
||||
$(NULL)
|
||||
|
||||
|
42
docshell/test/test_bug384014.html
Normal file
42
docshell/test/test_bug384014.html
Normal file
@ -0,0 +1,42 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=384014
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 384014</title>
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=384014">Mozilla Bug 384014</a>
|
||||
<p id="display">
|
||||
<iframe id="f" src="javascript:try { window.x = 'PASS'; s = 'PASS' } catch(e) { s = 'FAIL' } s;"></iframe>
|
||||
</p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 384014 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function runTest() {
|
||||
$("f").onload = function () {
|
||||
is($("f").contentDocument.documentElement.textContent, "PASS",
|
||||
"We fail");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
$("f").contentWindow.location.reload();
|
||||
}
|
||||
|
||||
addLoadEvent(runTest);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user