Merge the latest green changeset on mozilla-inbound to mozilla-central
@ -49,8 +49,7 @@
|
||||
#include "nsHashtable.h"
|
||||
#include "nsCaretAccessible.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
#include "nsIDOMFormListener.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
|
||||
#define NS_ROOTACCESSIBLE_IMPL_CID \
|
||||
{ /* eaba2cf0-21b1-4e2b-b711-d3a89dcd5e1a */ \
|
||||
|
@ -1009,7 +1009,7 @@
|
||||
<svg:svg height="0">
|
||||
<svg:mask id="pinstripe-keyhole-forward-mask" maskContentUnits="objectBoundingBox">
|
||||
<svg:rect x="0" y="0" width="1" height="1" fill="white"/>
|
||||
<svg:circle cx="-0.46" cy="0.48" r="0.65"/>
|
||||
<svg:circle cx="-0.41" cy="0.5" r="0.65"/>
|
||||
</svg:mask>
|
||||
<svg:mask id="pinstripe-tab-ontop-left-curve-mask" maskContentUnits="userSpaceOnUse">
|
||||
<svg:circle cx="9" cy="3" r="3" fill="white"/>
|
||||
|
@ -226,6 +226,7 @@ greprefs/all.js
|
||||
greprefs/security-prefs.js
|
||||
greprefs/xpinstall.js
|
||||
install.rdf
|
||||
modules/ISO8601DateUtils.jsm
|
||||
modules/JSON.jsm
|
||||
mozilla-runtime@BIN_SUFFIX@
|
||||
old-homepage-default.properties
|
||||
@ -941,7 +942,6 @@ xpicleanup@BIN_SUFFIX@
|
||||
modules/Geometry.jsm
|
||||
modules/HUDService.jsm
|
||||
modules/InlineSpellChecker.jsm
|
||||
modules/ISO8601DateUtils.jsm
|
||||
modules/LightweightThemeConsumer.jsm
|
||||
modules/LightweightThemeManager.jsm
|
||||
modules/Microformats.js
|
||||
|
BIN
browser/themes/pinstripe/browser/Toolbar-lion.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
@ -88,8 +88,8 @@
|
||||
|
||||
#PersonalToolbar {
|
||||
-moz-appearance: none;
|
||||
margin-top: -1px; /* overlay the bottom border of the toolbar above us */
|
||||
padding-top: 0 !important;
|
||||
margin-top: -2px; /* overlay the bottom border of the toolbar above us */
|
||||
padding-top: 1px !important;
|
||||
background-color: -moz-mac-chrome-active;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.57);
|
||||
}
|
||||
@ -293,21 +293,22 @@ toolbarbutton.bookmark-item > menupopup {
|
||||
.toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker,
|
||||
#restore-button {
|
||||
-moz-box-orient: vertical;
|
||||
padding: 0 3px;
|
||||
-moz-appearance: toolbarbutton;
|
||||
height: 22px;
|
||||
border: 1px solid @toolbarbuttonBorderColor@;
|
||||
border-radius: @toolbarbuttonCornerRadius@;
|
||||
box-shadow: 0 1px rgba(255, 255, 255, 0.2);
|
||||
background: @toolbarbuttonBackground@;
|
||||
background-origin: border-box;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.toolbarbutton-1:not([type="menu-button"]):-moz-lwtheme,
|
||||
.toolbarbutton-1 > .toolbarbutton-menubutton-button:-moz-lwtheme,
|
||||
.toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker:-moz-lwtheme,
|
||||
#restore-button:-moz-lwtheme {
|
||||
border-color: rgba(0, 0, 0, 0.4);
|
||||
background-image: -moz-linear-gradient(rgba(255,255,255,0.5), rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.2));
|
||||
-moz-appearance: none;
|
||||
padding: 0 3px;
|
||||
border: 1px solid rgba(0, 0, 0, 0.4);
|
||||
border-radius: @toolbarbuttonCornerRadius@;
|
||||
background: -moz-linear-gradient(rgba(255,255,255,0.5), rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.2)) repeat-x;
|
||||
background-origin: border-box;
|
||||
box-shadow: inset 0 1px rgba(255,255,255,0.3), 0 1px rgba(255,255,255,0.2);
|
||||
}
|
||||
|
||||
@ -337,6 +338,7 @@ toolbar:not([mode="icons"]) .toolbarbutton-1:not([type="menu-button"]),
|
||||
toolbar:not([mode="icons"]) .toolbarbutton-1 > .toolbarbutton-menubutton-button,
|
||||
toolbar:not([mode="icons"]) .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker,
|
||||
toolbar:not([mode="icons"]) #restore-button {
|
||||
-moz-appearance: none;
|
||||
padding: 0;
|
||||
height: auto;
|
||||
border: none;
|
||||
@ -408,16 +410,6 @@ toolbar:not([mode="icons"]) .toolbarbutton-1:not([open="true"]) > .toolbarbutton
|
||||
margin: 2px 0 0;
|
||||
}
|
||||
|
||||
toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not([disabled="true"]):active:hover:not(:-moz-lwtheme),
|
||||
toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"])[open="true"]:not(:-moz-lwtheme),
|
||||
toolbar[mode="icons"] .toolbarbutton-1:not([disabled="true"]) > .toolbarbutton-menubutton-button:active:hover:not(:-moz-lwtheme),
|
||||
toolbar[mode="icons"] .toolbarbutton-1[open="true"] > .toolbarbutton-menubutton-dropmarker:not(:-moz-lwtheme),
|
||||
toolbar[mode="icons"] #restore-button:not([disabled="true"]):active:hover:not(:-moz-lwtheme) {
|
||||
background: @toolbarbuttonPressedBackgroundColor@;
|
||||
text-shadow: @loweredShadow@;
|
||||
box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@;
|
||||
}
|
||||
|
||||
toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not([disabled="true"]):active:hover:-moz-lwtheme,
|
||||
toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"])[open="true"]:-moz-lwtheme,
|
||||
toolbar[mode="icons"] .toolbarbutton-1:not([disabled="true"]) > .toolbarbutton-menubutton-button:active:hover:-moz-lwtheme,
|
||||
@ -428,39 +420,16 @@ toolbar[mode="icons"] #restore-button:not([disabled="true"]):active:hover:-moz-l
|
||||
box-shadow: inset 0 2px 5px rgba(0,0,0,0.6), 0 1px rgba(255,255,255,0.2);
|
||||
}
|
||||
|
||||
toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not(#fullscreen-button)[checked="true"]:not(:-moz-lwtheme) {
|
||||
background: #606060;
|
||||
box-shadow: inset #2A2A2A 0 3px 3.5px, @loweredShadow@;
|
||||
}
|
||||
|
||||
toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not(#fullscreen-button)[checked="true"]:-moz-lwtheme {
|
||||
background-color: rgba(0,0,0,0.4);
|
||||
box-shadow: inset 0 2px 5px rgba(0,0,0,0.7), 0 1px rgba(255,255,255,0.2);
|
||||
}
|
||||
|
||||
toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not(#fullscreen-button)[checked="true"]:not([disabled="true"]):active:hover:not(:-moz-lwtheme) {
|
||||
background: #4E4E4E;
|
||||
box-shadow: inset #1c1c1c 0 3px 3.5px;
|
||||
}
|
||||
|
||||
toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not(#fullscreen-button)[checked="true"]:not([disabled="true"]):active:hover:-moz-lwtheme {
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.8), 0 1px rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):-moz-window-inactive:not(:-moz-lwtheme),
|
||||
toolbar[mode="icons"] .toolbarbutton-1 > .toolbarbutton-menubutton-button:-moz-window-inactive:not(:-moz-lwtheme),
|
||||
toolbar[mode="icons"] .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker:-moz-window-inactive:not(:-moz-lwtheme),
|
||||
toolbar[mode="icons"] #restore-button:-moz-window-inactive:not(:-moz-lwtheme) {
|
||||
border-color: @toolbarbuttonInactiveBorderColor@;
|
||||
background-image: @toolbarbuttonInactiveBackgroundImage@;
|
||||
}
|
||||
|
||||
toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not(#fullscreen-button)[checked="true"]:-moz-window-inactive {
|
||||
background: #8E8E8E;
|
||||
box-shadow: inset rgba(0, 0, 0, 0.5) 0 3px 3.5px, @loweredShadow@;
|
||||
}
|
||||
|
||||
toolbar[mode="icons"] .toolbarbutton-1 > menupopup {
|
||||
margin-top: 1px;
|
||||
}
|
||||
@ -477,17 +446,28 @@ toolbar[mode="icons"] .toolbarbutton-1 > menupopup {
|
||||
}
|
||||
|
||||
#back-button,
|
||||
toolbar:not([mode="icons"]) #forward-button:-moz-locale-dir(rtl) {
|
||||
#forward-button:-moz-locale-dir(rtl),
|
||||
toolbar[mode="icons"] #back-button:-moz-locale-dir(rtl):-moz-lwtheme {
|
||||
-moz-image-region: rect(0, 40px, 20px, 20px);
|
||||
}
|
||||
|
||||
#forward-button,
|
||||
toolbar:not([mode="icons"]) #back-button:-moz-locale-dir(rtl) {
|
||||
#back-button:-moz-locale-dir(rtl),
|
||||
#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button:-moz-locale-dir(rtl),
|
||||
toolbar[mode="icons"] #forward-button:-moz-locale-dir(rtl):-moz-lwtheme {
|
||||
-moz-image-region: rect(0, 60px, 20px, 40px);
|
||||
}
|
||||
|
||||
#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button:-moz-locale-dir(rtl),
|
||||
#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button:-moz-locale-dir(rtl),
|
||||
toolbar[mode="icons"] #back-button:-moz-locale-dir(rtl):-moz-lwtheme,
|
||||
toolbar[mode="icons"] #forward-button:-moz-locale-dir(rtl):-moz-lwtheme {
|
||||
-moz-transform: scaleX(-1);
|
||||
}
|
||||
|
||||
#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button {
|
||||
-moz-margin-end: -5px;
|
||||
-moz-appearance: none;
|
||||
-moz-margin-end: -7px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
-moz-image-region: rect(0, 20px, 20px, 0);
|
||||
@ -497,31 +477,45 @@ toolbar:not([mode="icons"]) #back-button:-moz-locale-dir(rtl) {
|
||||
border-radius: 10000px;
|
||||
}
|
||||
|
||||
toolbar[mode="icons"] #back-button:-moz-locale-dir(rtl),
|
||||
toolbar[mode="icons"] #forward-button:-moz-locale-dir(rtl) {
|
||||
-moz-transform: scaleX(-1);
|
||||
#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button:not(:-moz-lwtheme) {
|
||||
height: 31px;
|
||||
padding: 4px 5px 5px 3px;
|
||||
margin-bottom: -1px;
|
||||
background: url(chrome://browser/skin/keyhole-circle.png) 0 0 no-repeat;
|
||||
}
|
||||
|
||||
#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button:-moz-window-inactive:not(:-moz-lwtheme) {
|
||||
background-position: -60px 0;
|
||||
}
|
||||
|
||||
#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button:not([disabled="true"]):active:hover:not(:-moz-lwtheme),
|
||||
#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button[open="true"]:not(:-moz-lwtheme) {
|
||||
background-position: -30px 0;
|
||||
}
|
||||
|
||||
toolbar[mode="icons"] #forward-button {
|
||||
-moz-margin-start: 0;
|
||||
}
|
||||
|
||||
#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button {
|
||||
/* 1px to the right */
|
||||
padding-left: 4px;
|
||||
padding-right: 2px;
|
||||
#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button > .toolbarbutton-icon {
|
||||
/* shift the icon away from the back button */
|
||||
margin-left: 3px;
|
||||
margin-right: -1px;
|
||||
}
|
||||
|
||||
#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button:-moz-lwtheme {
|
||||
#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button {
|
||||
mask: url(chrome://browser/content/browser.xul#pinstripe-keyhole-forward-mask);
|
||||
}
|
||||
|
||||
#navigator-toolbox[iconsize="small"][mode="icons"] > #nav-bar #forward-button {
|
||||
width: 27px;
|
||||
}
|
||||
|
||||
#navigator-toolbox[iconsize="small"][mode="icons"] > #nav-bar #forward-button:-moz-lwtheme {
|
||||
padding-left: 2px;
|
||||
}
|
||||
|
||||
toolbar[mode="icons"] #forward-button {
|
||||
toolbar[mode="icons"] #forward-button:-moz-lwtheme {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
@ -529,6 +523,9 @@ toolbar[mode="icons"] #forward-button {
|
||||
#navigator-toolbox[iconsize="small"][mode="icons"] > #nav-bar #back-button {
|
||||
-moz-margin-end: 0;
|
||||
width: 26px;
|
||||
}
|
||||
|
||||
#navigator-toolbox[iconsize="small"][mode="icons"] > #nav-bar #back-button:-moz-lwtheme {
|
||||
padding-right: 2px;
|
||||
border-right-width: 0;
|
||||
border-top-right-radius: 0;
|
||||
@ -1776,34 +1773,35 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
|
||||
#TabsToolbar:not(:-moz-lwtheme) {
|
||||
background-color: -moz-mac-chrome-active;
|
||||
}
|
||||
|
||||
#TabsToolbar:not(:-moz-lwtheme):-moz-window-inactive {
|
||||
background-color: -moz-mac-chrome-inactive;
|
||||
}
|
||||
|
||||
#TabsToolbar[tabsontop="false"] {
|
||||
margin-top: -1px;
|
||||
margin-top: -2px;
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
/* For tabs-on-top, only fill the bottom 2px with the chrome background
|
||||
* color, so that the borders in tabbar-top-bg-*.png can mix with it.
|
||||
* In the top 24px the unified toolbar (from the ::before above) will show.
|
||||
*/
|
||||
#TabsToolbar[tabsontop="true"]:not(:-moz-lwtheme) {
|
||||
padding-bottom: 2px;
|
||||
background-image: url(chrome://browser/skin/tabbrowser/tabbar-top-bg-active.png) ;
|
||||
background: url(chrome://browser/skin/tabbrowser/tabbar-top-bg-active.png),
|
||||
-moz-linear-gradient(bottom, -moz-mac-chrome-active 2px, transparent 2px);
|
||||
}
|
||||
|
||||
#TabsToolbar[tabsontop="true"]:not(:-moz-lwtheme):-moz-window-inactive {
|
||||
background-image: url(chrome://browser/skin/tabbrowser/tabbar-top-bg-inactive.png);
|
||||
background: url(chrome://browser/skin/tabbrowser/tabbar-top-bg-inactive.png),
|
||||
-moz-linear-gradient(bottom, -moz-mac-chrome-inactive 2px, transparent 2px);
|
||||
}
|
||||
|
||||
/* In tabs-on-bottom mode, fill the whole toolbar with the chrome
|
||||
* background color.
|
||||
*/
|
||||
#TabsToolbar[tabsontop="false"]:not(:-moz-lwtheme) {
|
||||
background-image: url(chrome://browser/skin/tabbrowser/tabbar-bottom-bg-active.png);
|
||||
background: url(chrome://browser/skin/tabbrowser/tabbar-bottom-bg-active.png) -moz-mac-chrome-active;
|
||||
}
|
||||
|
||||
#TabsToolbar[tabsontop="false"]:not(:-moz-lwtheme):-moz-window-inactive {
|
||||
background-image: url(chrome://browser/skin/tabbrowser/tabbar-bottom-bg-inactive.png);
|
||||
background: url(chrome://browser/skin/tabbrowser/tabbar-bottom-bg-inactive.png) -moz-mac-chrome-inactive;
|
||||
}
|
||||
|
||||
#tabbrowser-tabs {
|
||||
@ -1955,11 +1953,12 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
|
||||
:-moz-any(#TabsToolbar, #addon-bar) .toolbarbutton-1,
|
||||
:-moz-any(#TabsToolbar, #addon-bar) .toolbarbutton-1 > .toolbarbutton-menubutton-button,
|
||||
:-moz-any(#TabsToolbar, #addon-bar) .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
-moz-appearance: none;
|
||||
/* !important flags needed because of bug 561154: */
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
border: none !important;
|
||||
border-radius: 0 !important;
|
||||
background: none !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ browser.jar:
|
||||
skin/classic/browser/section_collapsed-rtl.png
|
||||
skin/classic/browser/section_expanded.png
|
||||
skin/classic/browser/Secure-Glyph-White.png
|
||||
skin/classic/browser/keyhole-circle.png
|
||||
skin/classic/browser/Toolbar.png
|
||||
skin/classic/browser/toolbarbutton-dropmarker.png
|
||||
skin/classic/browser/urlbar-arrow.png
|
||||
@ -134,3 +135,8 @@ browser.jar:
|
||||
skin/classic/browser/syncCommon.css
|
||||
skin/classic/browser/syncQuota.css
|
||||
#endif
|
||||
skin/classic/browser/lion/keyhole-circle.png (keyhole-circle-lion.png)
|
||||
skin/classic/browser/lion/Toolbar.png (Toolbar-lion.png)
|
||||
|
||||
% override chrome://browser/skin/keyhole-circle.png chrome://browser/skin/lion/keyhole-circle.png os=Darwin osversion>=10.7
|
||||
% override chrome://browser/skin/Toolbar.png chrome://browser/skin/lion/Toolbar.png os=Darwin osversion>=10.7
|
||||
|
BIN
browser/themes/pinstripe/browser/keyhole-circle-lion.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
browser/themes/pinstripe/browser/keyhole-circle.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
@ -80,33 +80,9 @@
|
||||
#placesToolbar > toolbarbutton {
|
||||
list-style-image: url("chrome://browser/skin/places/toolbar.png");
|
||||
margin: 4px 4px 5px;
|
||||
padding: 1px 3px;
|
||||
border: 1px solid @toolbarbuttonBorderColor@;
|
||||
border-radius: @toolbarbuttonCornerRadius@;
|
||||
box-shadow: @loweredShadow@;
|
||||
background: @toolbarbuttonBackground@;
|
||||
background-origin: border-box;
|
||||
}
|
||||
|
||||
#placesToolbar > toolbarbutton:not([disabled="true"]):active:hover,
|
||||
#placesToolbar > toolbarbutton[open="true"] {
|
||||
background: @toolbarbuttonPressedBackgroundColor@;
|
||||
text-shadow: @loweredShadow@;
|
||||
box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@;
|
||||
}
|
||||
|
||||
#placesToolbar > toolbarbutton:-moz-focusring {
|
||||
border-color: @toolbarbuttonFocusedBorderColorAqua@;
|
||||
box-shadow: @focusRingShadow@;
|
||||
}
|
||||
|
||||
#placesToolbar > toolbarbutton:-moz-system-metric(mac-graphite-theme):-moz-focusring {
|
||||
border-color: @toolbarbuttonFocusedBorderColorGraphite@;
|
||||
}
|
||||
|
||||
#placesToolbar > toolbarbutton:-moz-window-inactive {
|
||||
border-color: @toolbarbuttonInactiveBorderColor@;
|
||||
background-image: @toolbarbuttonInactiveBackgroundImage@;
|
||||
padding: 0;
|
||||
height: 22px;
|
||||
-moz-appearance: toolbarbutton;
|
||||
}
|
||||
|
||||
#placesToolbar > toolbarbutton[disabled="true"] > .toolbarbutton-icon {
|
||||
@ -136,17 +112,12 @@
|
||||
#back-button:-moz-locale-dir(ltr),
|
||||
#forward-button:-moz-locale-dir(rtl) {
|
||||
-moz-image-region: rect(0px, 16px, 16px, 0px);
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
margin-right: 0;
|
||||
border-right: 0;
|
||||
}
|
||||
|
||||
#forward-button:-moz-locale-dir(ltr),
|
||||
#back-button:-moz-locale-dir(rtl) {
|
||||
-moz-image-region: rect(0px, 32px, 16px, 16px);
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 291 B After Width: | Height: | Size: 121 B |
Before Width: | Height: | Size: 394 B After Width: | Height: | Size: 118 B |
@ -249,7 +249,7 @@ nsFrameMessageManager::SendSyncMessage()
|
||||
NS_ENSURE_TRUE(dataArray, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
for (PRUint32 i = 0; i < len; ++i) {
|
||||
if (!retval[i].Length())
|
||||
if (retval[i].IsEmpty())
|
||||
continue;
|
||||
|
||||
jsval ret = JSVAL_VOID;
|
||||
|
@ -1127,26 +1127,6 @@ nsINode::DispatchDOMEvent(nsEvent* aEvent,
|
||||
aPresContext, aEventStatus);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsINode::AddEventListenerByIID(nsIDOMEventListener *aListener,
|
||||
const nsIID& aIID)
|
||||
{
|
||||
nsEventListenerManager* elm = GetListenerManager(PR_TRUE);
|
||||
NS_ENSURE_STATE(elm);
|
||||
return elm->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsINode::RemoveEventListenerByIID(nsIDOMEventListener *aListener,
|
||||
const nsIID& aIID)
|
||||
{
|
||||
nsEventListenerManager* elm = GetListenerManager(PR_FALSE);
|
||||
if (elm) {
|
||||
elm->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsEventListenerManager*
|
||||
nsINode::GetListenerManager(PRBool aCreateIfNotFound)
|
||||
{
|
||||
|
@ -162,7 +162,7 @@ JSValToDashArray(JSContext* cx, const jsval& patternArray,
|
||||
}
|
||||
|
||||
bool haveNonzeroElement = false;
|
||||
for (jsint i = 0; i < jsint(length); ++i) {
|
||||
for (uint32 i = 0; i < length; ++i) {
|
||||
jsval elt;
|
||||
double d;
|
||||
if (!JS_GetElement(cx, obj, i, &elt)) {
|
||||
|
@ -206,26 +206,6 @@ nsDOMEventTargetHelper::GetListenerManager(PRBool aCreateIfNotFound)
|
||||
return mListenerManager;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMEventTargetHelper::AddEventListenerByIID(nsIDOMEventListener *aListener,
|
||||
const nsIID& aIID)
|
||||
{
|
||||
nsEventListenerManager* elm = GetListenerManager(PR_TRUE);
|
||||
NS_ENSURE_STATE(elm);
|
||||
return elm->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMEventTargetHelper::RemoveEventListenerByIID(nsIDOMEventListener *aListener,
|
||||
const nsIID& aIID)
|
||||
{
|
||||
nsEventListenerManager* elm = GetListenerManager(PR_FALSE);
|
||||
if (elm) {
|
||||
elm->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIScriptContext*
|
||||
nsDOMEventTargetHelper::GetContextForEventHandlers(nsresult* aRv)
|
||||
{
|
||||
|
@ -42,16 +42,6 @@
|
||||
#include "nsCaret.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIDOMMouseListener.h"
|
||||
#include "nsIDOMMouseMotionListener.h"
|
||||
#include "nsIDOMContextMenuListener.h"
|
||||
#include "nsIDOMKeyListener.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
#include "nsIDOMFormListener.h"
|
||||
#include "nsIDOMLoadListener.h"
|
||||
#include "nsIDOMTextListener.h"
|
||||
#include "nsIDOMCompositionListener.h"
|
||||
#include "nsIDOMUIListener.h"
|
||||
#include "nsITextControlFrame.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
@ -95,13 +85,9 @@
|
||||
using namespace mozilla::dom;
|
||||
|
||||
#define EVENT_TYPE_EQUALS( ls, type, userType ) \
|
||||
(ls->mEventType && ls->mEventType == type && \
|
||||
(ls->mEventType == type && \
|
||||
(ls->mEventType != NS_USER_DEFINED_EVENT || ls->mTypeAtom == userType))
|
||||
|
||||
#define EVENT_TYPE_DATA_EQUALS( type1, type2 ) \
|
||||
(type1 && type2 && type1->iid && type2->iid && \
|
||||
type1->iid->Equals(*(type2->iid)))
|
||||
|
||||
static NS_DEFINE_CID(kDOMScriptObjectFactoryCID,
|
||||
NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
|
||||
|
||||
@ -138,137 +124,6 @@ MutationBitForEventType(PRUint32 aEventType)
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef
|
||||
NS_STDCALL_FUNCPROTO(nsresult,
|
||||
GenericHandler,
|
||||
nsIDOMEventListener, HandleEvent,
|
||||
(nsIDOMEvent*));
|
||||
|
||||
/*
|
||||
* Things here are not as they appear. Namely, |ifaceListener| below is
|
||||
* not really a pointer to the nsIDOMEventListener interface, and aMethod is
|
||||
* not really a pointer-to-member for nsIDOMEventListener. They both
|
||||
* actually refer to the event-type-specific listener interface. The casting
|
||||
* magic allows us to use a single dispatch method. This relies on the
|
||||
* assumption that nsIDOMEventListener and the event type listener interfaces
|
||||
* have the same object layout and will therefore have compatible
|
||||
* pointer-to-member implementations.
|
||||
*/
|
||||
|
||||
static nsresult DispatchToInterface(nsIDOMEvent* aEvent,
|
||||
nsIDOMEventListener* aListener,
|
||||
GenericHandler aMethod,
|
||||
const nsIID& aIID)
|
||||
{
|
||||
nsIDOMEventListener* ifaceListener = nsnull;
|
||||
nsresult rv = NS_OK;
|
||||
aListener->QueryInterface(aIID, (void**) &ifaceListener);
|
||||
NS_WARN_IF_FALSE(ifaceListener,
|
||||
"DispatchToInterface couldn't QI to the right interface");
|
||||
if (ifaceListener) {
|
||||
rv = (ifaceListener->*aMethod)(aEvent);
|
||||
NS_RELEASE(ifaceListener);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
struct EventDispatchData
|
||||
{
|
||||
PRUint32 message;
|
||||
GenericHandler method;
|
||||
};
|
||||
|
||||
struct EventTypeData
|
||||
{
|
||||
const EventDispatchData* events;
|
||||
int numEvents;
|
||||
const nsIID* iid;
|
||||
};
|
||||
|
||||
#define HANDLER(x) reinterpret_cast<GenericHandler>(x)
|
||||
|
||||
static const EventDispatchData sMouseEvents[] = {
|
||||
{ NS_MOUSE_BUTTON_DOWN, HANDLER(&nsIDOMMouseListener::MouseDown) },
|
||||
{ NS_MOUSE_BUTTON_UP, HANDLER(&nsIDOMMouseListener::MouseUp) },
|
||||
{ NS_MOUSE_CLICK, HANDLER(&nsIDOMMouseListener::MouseClick) },
|
||||
{ NS_MOUSE_DOUBLECLICK, HANDLER(&nsIDOMMouseListener::MouseDblClick) },
|
||||
{ NS_MOUSE_ENTER_SYNTH, HANDLER(&nsIDOMMouseListener::MouseOver) },
|
||||
{ NS_MOUSE_EXIT_SYNTH, HANDLER(&nsIDOMMouseListener::MouseOut) }
|
||||
};
|
||||
|
||||
static const EventDispatchData sMouseMotionEvents[] = {
|
||||
{ NS_MOUSE_MOVE, HANDLER(&nsIDOMMouseMotionListener::MouseMove) }
|
||||
};
|
||||
|
||||
static const EventDispatchData sContextMenuEvents[] = {
|
||||
{ NS_CONTEXTMENU, HANDLER(&nsIDOMContextMenuListener::ContextMenu) }
|
||||
};
|
||||
|
||||
static const EventDispatchData sCompositionEvents[] = {
|
||||
{ NS_COMPOSITION_START,
|
||||
HANDLER(&nsIDOMCompositionListener::HandleStartComposition) },
|
||||
{ NS_COMPOSITION_END,
|
||||
HANDLER(&nsIDOMCompositionListener::HandleEndComposition) }
|
||||
};
|
||||
|
||||
static const EventDispatchData sTextEvents[] = {
|
||||
{ NS_TEXT_TEXT, HANDLER(&nsIDOMTextListener::HandleText) }
|
||||
};
|
||||
|
||||
static const EventDispatchData sKeyEvents[] = {
|
||||
{ NS_KEY_UP, HANDLER(&nsIDOMKeyListener::KeyUp) },
|
||||
{ NS_KEY_DOWN, HANDLER(&nsIDOMKeyListener::KeyDown) },
|
||||
{ NS_KEY_PRESS, HANDLER(&nsIDOMKeyListener::KeyPress) }
|
||||
};
|
||||
|
||||
static const EventDispatchData sFocusEvents[] = {
|
||||
{ NS_FOCUS_CONTENT, HANDLER(&nsIDOMFocusListener::Focus) },
|
||||
{ NS_BLUR_CONTENT, HANDLER(&nsIDOMFocusListener::Blur) }
|
||||
};
|
||||
|
||||
static const EventDispatchData sFormEvents[] = {
|
||||
{ NS_FORM_SUBMIT, HANDLER(&nsIDOMFormListener::Submit) },
|
||||
{ NS_FORM_RESET, HANDLER(&nsIDOMFormListener::Reset) },
|
||||
{ NS_FORM_CHANGE, HANDLER(&nsIDOMFormListener::Change) },
|
||||
{ NS_FORM_SELECTED, HANDLER(&nsIDOMFormListener::Select) },
|
||||
{ NS_FORM_INPUT, HANDLER(&nsIDOMFormListener::Input) }
|
||||
};
|
||||
|
||||
static const EventDispatchData sLoadEvents[] = {
|
||||
{ NS_LOAD, HANDLER(&nsIDOMLoadListener::Load) },
|
||||
{ NS_PAGE_UNLOAD, HANDLER(&nsIDOMLoadListener::Unload) },
|
||||
{ NS_LOAD_ERROR, HANDLER(&nsIDOMLoadListener::Error) },
|
||||
{ NS_BEFORE_PAGE_UNLOAD, HANDLER(&nsIDOMLoadListener::BeforeUnload) }
|
||||
};
|
||||
|
||||
static const EventDispatchData sUIEvents[] = {
|
||||
{ NS_UI_ACTIVATE, HANDLER(&nsIDOMUIListener::Activate) },
|
||||
{ NS_UI_FOCUSIN, HANDLER(&nsIDOMUIListener::FocusIn) },
|
||||
{ NS_UI_FOCUSOUT, HANDLER(&nsIDOMUIListener::FocusOut) }
|
||||
};
|
||||
|
||||
#define IMPL_EVENTTYPEDATA(type) \
|
||||
{ \
|
||||
s##type##Events, \
|
||||
NS_ARRAY_LENGTH(s##type##Events), \
|
||||
&NS_GET_IID(nsIDOM##type##Listener) \
|
||||
}
|
||||
|
||||
// IMPORTANT: indices match up with eEventArrayType_ enum values
|
||||
|
||||
static const EventTypeData sEventTypes[] = {
|
||||
IMPL_EVENTTYPEDATA(Mouse),
|
||||
IMPL_EVENTTYPEDATA(MouseMotion),
|
||||
IMPL_EVENTTYPEDATA(ContextMenu),
|
||||
IMPL_EVENTTYPEDATA(Key),
|
||||
IMPL_EVENTTYPEDATA(Load),
|
||||
IMPL_EVENTTYPEDATA(Focus),
|
||||
IMPL_EVENTTYPEDATA(Form),
|
||||
IMPL_EVENTTYPEDATA(Text),
|
||||
IMPL_EVENTTYPEDATA(Composition),
|
||||
IMPL_EVENTTYPEDATA(UI)
|
||||
};
|
||||
|
||||
PRUint32 nsEventListenerManager::sCreatedCount = 0;
|
||||
|
||||
nsEventListenerManager::nsEventListenerManager(nsISupports* aTarget) :
|
||||
@ -333,33 +188,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_NATIVE(nsEventListenerManager)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
|
||||
const EventTypeData*
|
||||
nsEventListenerManager::GetTypeDataForIID(const nsIID& aIID)
|
||||
{
|
||||
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(sEventTypes); ++i) {
|
||||
if (aIID.Equals(*(sEventTypes[i].iid))) {
|
||||
return &sEventTypes[i];
|
||||
}
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
const EventTypeData*
|
||||
nsEventListenerManager::GetTypeDataForEventName(nsIAtom* aName)
|
||||
{
|
||||
PRUint32 event = nsContentUtils::GetEventId(aName);
|
||||
if (event != NS_USER_DEFINED_EVENT) {
|
||||
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(sEventTypes); ++i) {
|
||||
for (PRInt32 j = 0; j < sEventTypes[i].numEvents; ++j) {
|
||||
if (event == sEventTypes[i].events[j].message) {
|
||||
return &sEventTypes[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsPIDOMWindow*
|
||||
nsEventListenerManager::GetInnerWindowForTarget()
|
||||
{
|
||||
@ -385,38 +213,19 @@ nsresult
|
||||
nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener,
|
||||
PRUint32 aType,
|
||||
nsIAtom* aTypeAtom,
|
||||
const EventTypeData* aTypeData,
|
||||
PRInt32 aFlags)
|
||||
{
|
||||
NS_ENSURE_TRUE(aListener, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(aType || aTypeData, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(aType, NS_ERROR_FAILURE);
|
||||
|
||||
nsRefPtr<nsIDOMEventListener> kungFuDeathGrip = aListener;
|
||||
|
||||
if (!aTypeData) {
|
||||
// If we don't have type data, we can try to QI listener to the right
|
||||
// interface and set mTypeData only if QI succeeds. This way we can save
|
||||
// calls to DispatchToInterface (in HandleEvent) in those cases when QI
|
||||
// would fail.
|
||||
// @see also DispatchToInterface()
|
||||
const EventTypeData* td = GetTypeDataForEventName(aTypeAtom);
|
||||
if (td && td->iid) {
|
||||
nsIDOMEventListener* ifaceListener = nsnull;
|
||||
aListener->QueryInterface(*(td->iid), (void**) &ifaceListener);
|
||||
if (ifaceListener) {
|
||||
aTypeData = td;
|
||||
NS_RELEASE(ifaceListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsListenerStruct* ls;
|
||||
PRUint32 count = mListeners.Length();
|
||||
for (PRUint32 i = 0; i < count; i++) {
|
||||
ls = &mListeners.ElementAt(i);
|
||||
if (ls->mListener == aListener && ls->mFlags == aFlags &&
|
||||
(EVENT_TYPE_EQUALS(ls, aType, aTypeAtom) ||
|
||||
EVENT_TYPE_DATA_EQUALS(aTypeData, ls->mTypeData))) {
|
||||
EVENT_TYPE_EQUALS(ls, aType, aTypeAtom)) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
@ -430,7 +239,6 @@ nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener,
|
||||
ls->mTypeAtom = aTypeAtom;
|
||||
ls->mFlags = aFlags;
|
||||
ls->mHandlerIsString = PR_FALSE;
|
||||
ls->mTypeData = aTypeData;
|
||||
|
||||
if (aFlags & NS_EVENT_FLAG_SYSTEM_EVENT) {
|
||||
mMayHaveSystemGroupListeners = PR_TRUE;
|
||||
@ -491,10 +299,9 @@ void
|
||||
nsEventListenerManager::RemoveEventListener(nsIDOMEventListener *aListener,
|
||||
PRUint32 aType,
|
||||
nsIAtom* aUserType,
|
||||
const EventTypeData* aTypeData,
|
||||
PRInt32 aFlags)
|
||||
{
|
||||
if (!aListener || !(aType || aTypeData)) {
|
||||
if (!aListener || !aType) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -506,9 +313,7 @@ nsEventListenerManager::RemoveEventListener(nsIDOMEventListener *aListener,
|
||||
ls = &mListeners.ElementAt(i);
|
||||
if (ls->mListener == aListener &&
|
||||
((ls->mFlags & ~NS_PRIV_EVENT_UNTRUSTED_PERMITTED) == aFlags) &&
|
||||
(EVENT_TYPE_EQUALS(ls, aType, aUserType) ||
|
||||
(!(ls->mEventType) &&
|
||||
EVENT_TYPE_DATA_EQUALS(ls->mTypeData, aTypeData)))) {
|
||||
EVENT_TYPE_EQUALS(ls, aType, aUserType)) {
|
||||
nsRefPtr<nsEventListenerManager> kungFuDeathGrip = this;
|
||||
mListeners.RemoveElementAt(i);
|
||||
mNoListenerForEvent = NS_EVENT_TYPE_NULL;
|
||||
@ -518,33 +323,15 @@ nsEventListenerManager::RemoveEventListener(nsIDOMEventListener *aListener,
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsEventListenerManager::AddEventListenerByIID(nsIDOMEventListener *aListener,
|
||||
const nsIID& aIID,
|
||||
PRInt32 aFlags)
|
||||
static inline PRBool
|
||||
ListenerCanHandle(nsListenerStruct* aLs, nsEvent* aEvent)
|
||||
{
|
||||
return AddEventListener(aListener, NS_EVENT_TYPE_NULL, nsnull,
|
||||
GetTypeDataForIID(aIID), aFlags);
|
||||
}
|
||||
|
||||
void
|
||||
nsEventListenerManager::RemoveEventListenerByIID(nsIDOMEventListener *aListener,
|
||||
const nsIID& aIID,
|
||||
PRInt32 aFlags)
|
||||
{
|
||||
RemoveEventListener(aListener, NS_EVENT_TYPE_NULL, nsnull,
|
||||
GetTypeDataForIID(aIID), aFlags);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsEventListenerManager::ListenerCanHandle(nsListenerStruct* aLs,
|
||||
nsEvent* aEvent)
|
||||
{
|
||||
if (aEvent->message == NS_USER_DEFINED_EVENT) {
|
||||
// We don't want to check aLs->mEventType here, bug 276846.
|
||||
return (aEvent->userType && aLs->mTypeAtom == aEvent->userType);
|
||||
}
|
||||
return (aLs->mEventType == aEvent->message);
|
||||
// This is slightly different from EVENT_TYPE_EQUALS in that it returns
|
||||
// true even when aEvent->message == NS_USER_DEFINED_EVENT and
|
||||
// aLs=>mEventType != NS_USER_DEFINED_EVENT as long as the atoms are the same
|
||||
return aEvent->message == NS_USER_DEFINED_EVENT ?
|
||||
(aLs->mTypeAtom == aEvent->userType) :
|
||||
(aLs->mEventType == aEvent->message);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -554,7 +341,7 @@ nsEventListenerManager::AddEventListenerByType(nsIDOMEventListener *aListener,
|
||||
{
|
||||
nsCOMPtr<nsIAtom> atom = do_GetAtom(NS_LITERAL_STRING("on") + aType);
|
||||
PRUint32 type = nsContentUtils::GetEventId(atom);
|
||||
return AddEventListener(aListener, type, atom, nsnull, aFlags);
|
||||
return AddEventListener(aListener, type, atom, aFlags);
|
||||
}
|
||||
|
||||
void
|
||||
@ -564,7 +351,7 @@ nsEventListenerManager::RemoveEventListenerByType(nsIDOMEventListener *aListener
|
||||
{
|
||||
nsCOMPtr<nsIAtom> atom = do_GetAtom(NS_LITERAL_STRING("on") + aType);
|
||||
PRUint32 type = nsContentUtils::GetEventId(atom);
|
||||
RemoveEventListener(aListener, type, atom, nsnull, aFlags);
|
||||
RemoveEventListener(aListener, type, atom, aFlags);
|
||||
}
|
||||
|
||||
nsListenerStruct*
|
||||
@ -603,7 +390,7 @@ nsEventListenerManager::SetJSEventListener(nsIScriptContext *aContext,
|
||||
rv = NS_NewJSEventListener(aContext, aScopeObject, mTarget, aName,
|
||||
getter_AddRefs(scriptListener));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
AddEventListener(scriptListener, eventType, aName, nsnull,
|
||||
AddEventListener(scriptListener, eventType, aName,
|
||||
NS_EVENT_FLAG_BUBBLE | NS_PRIV_EVENT_FLAG_SCRIPT);
|
||||
|
||||
ls = FindJSEventListener(eventType, aName);
|
||||
@ -1078,10 +865,6 @@ nsEventListenerManager::HandleEventSubType(nsListenerStruct* aListenerStruct,
|
||||
return result;
|
||||
}
|
||||
|
||||
static PRUint32 sLatestEventType = 0;
|
||||
static const EventTypeData* sLatestEventTypeData = nsnull;
|
||||
static const EventDispatchData* sLatestEventDispData = nsnull;
|
||||
|
||||
/**
|
||||
* Causes a check for event listeners and processing by them if they exist.
|
||||
* @param an event listener
|
||||
@ -1101,79 +884,39 @@ nsEventListenerManager::HandleEventInternal(nsPresContext* aPresContext,
|
||||
aEvent->flags |= NS_EVENT_FLAG_NO_DEFAULT;
|
||||
}
|
||||
|
||||
const EventTypeData* typeData = nsnull;
|
||||
const EventDispatchData* dispData = nsnull;
|
||||
if (aEvent->message != NS_USER_DEFINED_EVENT) {
|
||||
// Check if this is the same type of event as what a listener manager
|
||||
// handled last time.
|
||||
if (aEvent->message == sLatestEventType) {
|
||||
typeData = sLatestEventTypeData;
|
||||
dispData = sLatestEventDispData;
|
||||
goto found;
|
||||
}
|
||||
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(sEventTypes); ++i) {
|
||||
typeData = &sEventTypes[i];
|
||||
for (PRInt32 j = 0; j < typeData->numEvents; ++j) {
|
||||
dispData = &(typeData->events[j]);
|
||||
if (aEvent->message == dispData->message) {
|
||||
sLatestEventType = aEvent->message;
|
||||
sLatestEventTypeData = typeData;
|
||||
sLatestEventDispData = dispData;
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
typeData = nsnull;
|
||||
dispData = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
found:
|
||||
|
||||
nsAutoTObserverArray<nsListenerStruct, 2>::EndLimitedIterator iter(mListeners);
|
||||
nsAutoPopupStatePusher popupStatePusher(nsDOMEvent::GetEventPopupControlState(aEvent));
|
||||
PRBool hasListener = PR_FALSE;
|
||||
while (iter.HasMore()) {
|
||||
nsListenerStruct* ls = &iter.GetNext();
|
||||
PRBool useTypeInterface =
|
||||
EVENT_TYPE_DATA_EQUALS(ls->mTypeData, typeData);
|
||||
PRBool useGenericInterface =
|
||||
(!useTypeInterface && ListenerCanHandle(ls, aEvent));
|
||||
// Don't fire the listener if it's been removed.
|
||||
// Check that the phase is same in event and event listener.
|
||||
// Handle only trusted events, except when listener permits untrusted events.
|
||||
if (useTypeInterface || useGenericInterface) {
|
||||
if (ls->mListener) {
|
||||
hasListener = PR_TRUE;
|
||||
// XXX The (mFlags & aFlags) test here seems fragile. Shouldn't we
|
||||
// specifically only test the capture/bubble flags.
|
||||
if ((ls->mFlags & aFlags & ~NS_EVENT_FLAG_SYSTEM_EVENT) &&
|
||||
(ls->mFlags & NS_EVENT_FLAG_SYSTEM_EVENT) ==
|
||||
(aFlags & NS_EVENT_FLAG_SYSTEM_EVENT) &&
|
||||
(NS_IS_TRUSTED_EVENT(aEvent) ||
|
||||
ls->mFlags & NS_PRIV_EVENT_UNTRUSTED_PERMITTED)) {
|
||||
if (!*aDOMEvent) {
|
||||
nsEventDispatcher::CreateEvent(aPresContext, aEvent,
|
||||
EmptyString(), aDOMEvent);
|
||||
}
|
||||
if (*aDOMEvent) {
|
||||
if (ListenerCanHandle(ls, aEvent)) {
|
||||
hasListener = PR_TRUE;
|
||||
// XXX The (mFlags & aFlags) test here seems fragile. Shouldn't we
|
||||
// specifically only test the capture/bubble flags.
|
||||
if ((ls->mFlags & aFlags & ~NS_EVENT_FLAG_SYSTEM_EVENT) &&
|
||||
(ls->mFlags & NS_EVENT_FLAG_SYSTEM_EVENT) ==
|
||||
(aFlags & NS_EVENT_FLAG_SYSTEM_EVENT) &&
|
||||
(NS_IS_TRUSTED_EVENT(aEvent) ||
|
||||
ls->mFlags & NS_PRIV_EVENT_UNTRUSTED_PERMITTED)) {
|
||||
if (!*aDOMEvent) {
|
||||
nsEventDispatcher::CreateEvent(aPresContext, aEvent,
|
||||
EmptyString(), aDOMEvent);
|
||||
}
|
||||
if (*aDOMEvent) {
|
||||
if (!aEvent->currentTarget) {
|
||||
aEvent->currentTarget = aCurrentTarget->GetTargetForDOMEvent();
|
||||
if (!aEvent->currentTarget) {
|
||||
aEvent->currentTarget = aCurrentTarget->GetTargetForDOMEvent();
|
||||
if (!aEvent->currentTarget) {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
nsRefPtr<nsIDOMEventListener> kungFuDeathGrip = ls->mListener;
|
||||
if (useTypeInterface) {
|
||||
aPusher->Pop();
|
||||
DispatchToInterface(*aDOMEvent, ls->mListener,
|
||||
dispData->method, *typeData->iid);
|
||||
} else if (useGenericInterface &&
|
||||
aPusher->RePush(aCurrentTarget)) {
|
||||
if (NS_FAILED(HandleEventSubType(ls, ls->mListener, *aDOMEvent,
|
||||
aCurrentTarget, aFlags,
|
||||
aPusher))) {
|
||||
aEvent->flags |= NS_EVENT_FLAG_EXCEPTION_THROWN;
|
||||
}
|
||||
}
|
||||
nsRefPtr<nsIDOMEventListener> kungFuDeathGrip = ls->mListener;
|
||||
if (aPusher->RePush(aCurrentTarget)) {
|
||||
if (NS_FAILED(HandleEventSubType(ls, ls->mListener, *aDOMEvent,
|
||||
aCurrentTarget, aFlags,
|
||||
aPusher))) {
|
||||
aEvent->flags |= NS_EVENT_FLAG_EXCEPTION_THROWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1267,30 +1010,11 @@ PRBool
|
||||
nsEventListenerManager::HasListenersFor(const nsAString& aEventName)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> atom = do_GetAtom(NS_LITERAL_STRING("on") + aEventName);
|
||||
PRUint32 type = nsContentUtils::GetEventId(atom);
|
||||
|
||||
const EventTypeData* typeData = nsnull;
|
||||
const EventDispatchData* dispData = nsnull;
|
||||
if (type != NS_USER_DEFINED_EVENT) {
|
||||
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(sEventTypes); ++i) {
|
||||
typeData = &sEventTypes[i];
|
||||
for (PRInt32 j = 0; j < typeData->numEvents; ++j) {
|
||||
dispData = &(typeData->events[j]);
|
||||
if (type == dispData->message) {
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
typeData = nsnull;
|
||||
dispData = nsnull;
|
||||
}
|
||||
}
|
||||
found:
|
||||
|
||||
PRUint32 count = mListeners.Length();
|
||||
for (PRUint32 i = 0; i < count; ++i) {
|
||||
nsListenerStruct* ls = &mListeners.ElementAt(i);
|
||||
if (ls->mTypeAtom == atom ||
|
||||
EVENT_TYPE_DATA_EQUALS(ls->mTypeData, typeData)) {
|
||||
if (ls->mTypeAtom == atom) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
@ -1329,43 +1053,13 @@ nsEventListenerManager::GetListenerInfo(nsCOMArray<nsIEventListenerInfo>* aList)
|
||||
PR_TRUE);
|
||||
}
|
||||
}
|
||||
if (ls.mTypeData) {
|
||||
// Handle special event listener interfaces, like nsIDOMFocusListener.
|
||||
for (PRInt32 j = 0; j < ls.mTypeData->numEvents; ++j) {
|
||||
const EventDispatchData* dispData = &(ls.mTypeData->events[j]);
|
||||
const char* eventName = nsDOMEvent::GetEventName(dispData->message);
|
||||
if (eventName) {
|
||||
NS_ConvertASCIItoUTF16 eventType(eventName);
|
||||
nsRefPtr<nsEventListenerInfo> info =
|
||||
new nsEventListenerInfo(eventType, ls.mListener, capturing,
|
||||
allowsUntrusted, systemGroup);
|
||||
NS_ENSURE_TRUE(info, NS_ERROR_OUT_OF_MEMORY);
|
||||
aList->AppendObject(info);
|
||||
}
|
||||
}
|
||||
} else if (ls.mEventType == NS_USER_DEFINED_EVENT) {
|
||||
// Handle user defined event types.
|
||||
if (ls.mTypeAtom) {
|
||||
const nsDependentSubstring& eventType =
|
||||
Substring(nsDependentAtomString(ls.mTypeAtom), 2);
|
||||
nsRefPtr<nsEventListenerInfo> info =
|
||||
new nsEventListenerInfo(eventType, ls.mListener, capturing,
|
||||
allowsUntrusted, systemGroup);
|
||||
NS_ENSURE_TRUE(info, NS_ERROR_OUT_OF_MEMORY);
|
||||
aList->AppendObject(info);
|
||||
}
|
||||
} else {
|
||||
// Handle normal events.
|
||||
const char* eventName = nsDOMEvent::GetEventName(ls.mEventType);
|
||||
if (eventName) {
|
||||
NS_ConvertASCIItoUTF16 eventType(eventName);
|
||||
nsRefPtr<nsEventListenerInfo> info =
|
||||
new nsEventListenerInfo(eventType, ls.mListener, capturing,
|
||||
allowsUntrusted, systemGroup);
|
||||
NS_ENSURE_TRUE(info, NS_ERROR_OUT_OF_MEMORY);
|
||||
aList->AppendObject(info);
|
||||
}
|
||||
}
|
||||
const nsDependentSubstring& eventType =
|
||||
Substring(nsDependentAtomString(ls.mTypeAtom), 2);
|
||||
nsRefPtr<nsEventListenerInfo> info =
|
||||
new nsEventListenerInfo(eventType, ls.mListener, capturing,
|
||||
allowsUntrusted, systemGroup);
|
||||
NS_ENSURE_TRUE(info, NS_ERROR_OUT_OF_MEMORY);
|
||||
aList->AppendObject(info);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1377,9 +1071,7 @@ nsEventListenerManager::HasUnloadListeners()
|
||||
for (PRUint32 i = 0; i < count; ++i) {
|
||||
nsListenerStruct* ls = &mListeners.ElementAt(i);
|
||||
if (ls->mEventType == NS_PAGE_UNLOAD ||
|
||||
ls->mEventType == NS_BEFORE_PAGE_UNLOAD ||
|
||||
(ls->mTypeData && ls->mTypeData->iid &&
|
||||
ls->mTypeData->iid->Equals(NS_GET_IID(nsIDOMLoadListener)))) {
|
||||
ls->mEventType == NS_BEFORE_PAGE_UNLOAD) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,6 @@ typedef struct {
|
||||
nsCOMPtr<nsIAtom> mTypeAtom;
|
||||
PRUint16 mFlags;
|
||||
PRBool mHandlerIsString;
|
||||
const EventTypeData* mTypeData;
|
||||
} nsListenerStruct;
|
||||
|
||||
/*
|
||||
@ -97,10 +96,6 @@ public:
|
||||
* Sets events listeners of all types.
|
||||
* @param an event listener
|
||||
*/
|
||||
nsresult AddEventListenerByIID(nsIDOMEventListener *aListener,
|
||||
const nsIID& aIID, PRInt32 aFlags);
|
||||
void RemoveEventListenerByIID(nsIDOMEventListener *aListener,
|
||||
const nsIID& aIID, PRInt32 aFlags);
|
||||
nsresult AddEventListenerByType(nsIDOMEventListener *aListener,
|
||||
const nsAString& type,
|
||||
PRInt32 aFlags);
|
||||
@ -218,17 +213,14 @@ protected:
|
||||
nsresult AddEventListener(nsIDOMEventListener *aListener,
|
||||
PRUint32 aType,
|
||||
nsIAtom* aTypeAtom,
|
||||
const EventTypeData* aTypeData,
|
||||
PRInt32 aFlags);
|
||||
void RemoveEventListener(nsIDOMEventListener *aListener,
|
||||
PRUint32 aType,
|
||||
nsIAtom* aUserType,
|
||||
const EventTypeData* aTypeData,
|
||||
PRInt32 aFlags);
|
||||
void RemoveAllListeners();
|
||||
const EventTypeData* GetTypeDataForIID(const nsIID& aIID);
|
||||
const EventTypeData* GetTypeDataForEventName(nsIAtom* aName);
|
||||
PRBool ListenerCanHandle(nsListenerStruct* aLs, nsEvent* aEvent);
|
||||
nsPIDOMWindow* GetInnerWindowForTarget();
|
||||
|
||||
PRUint32 mMayHavePaintEventListener : 1;
|
||||
|
@ -36,6 +36,8 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsTextEditorState.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIView.h"
|
||||
@ -65,8 +67,6 @@
|
||||
#include "nsTextEditRules.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
|
||||
#include "nsTextEditorState.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
static NS_DEFINE_CID(kTextEditorCID, NS_TEXTEDITOR_CID);
|
||||
|
@ -40,6 +40,7 @@
|
||||
#define nsTextEditorState_h__
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsITextControlElement.h"
|
||||
#include "nsITextControlFrame.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
@ -73,13 +73,7 @@
|
||||
|
||||
// Event listeners
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIDOMMouseListener.h"
|
||||
#include "nsIDOMMouseMotionListener.h"
|
||||
#include "nsIDOMLoadListener.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
#include "nsIDOMKeyListener.h"
|
||||
#include "nsIDOMFormListener.h"
|
||||
#include "nsIDOMContextMenuListener.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsAttrName.h"
|
||||
|
||||
#include "nsGkAtoms.h"
|
||||
|
@ -66,13 +66,6 @@
|
||||
#include "nsIDOMAttr.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMMouseListener.h"
|
||||
#include "nsIDOMMouseMotionListener.h"
|
||||
#include "nsIDOMLoadListener.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
#include "nsIDOMKeyListener.h"
|
||||
#include "nsIDOMFormListener.h"
|
||||
#include "nsIDOMContextMenuListener.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMXULCommandDispatcher.h"
|
||||
|
@ -48,7 +48,6 @@
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMXULCommandDispatcher.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsString.h"
|
||||
|
@ -71,7 +71,6 @@ DIRS += interfaces/smil
|
||||
endif
|
||||
|
||||
DIRS += \
|
||||
public/coreEvents \
|
||||
base \
|
||||
src \
|
||||
locales \
|
||||
|
@ -5197,7 +5197,7 @@ nsWindowSH::InstallGlobalScopePolluter(JSContext *cx, JSObject *obj,
|
||||
|
||||
static
|
||||
already_AddRefed<nsIDOMWindow>
|
||||
GetChildFrame(nsGlobalWindow *win, jsid id)
|
||||
GetChildFrame(nsGlobalWindow *win, PRUint32 index)
|
||||
{
|
||||
nsCOMPtr<nsIDOMWindowCollection> frames;
|
||||
win->GetFrames(getter_AddRefs(frames));
|
||||
@ -5205,7 +5205,7 @@ GetChildFrame(nsGlobalWindow *win, jsid id)
|
||||
nsIDOMWindow *frame = nsnull;
|
||||
|
||||
if (frames) {
|
||||
frames->Item(JSID_TO_INT(id), &frame);
|
||||
frames->Item(index, &frame);
|
||||
}
|
||||
|
||||
return frame;
|
||||
@ -5242,16 +5242,14 @@ nsWindowSH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
// whacky, that's because this method is *extremely* performace
|
||||
// critical. Don't touch this unless you know what you're doing.
|
||||
|
||||
if (JSID_IS_INT(id)) {
|
||||
if (JSID_IS_INT(id) && JSID_TO_INT(id) >= 0) {
|
||||
// If we're accessing a numeric property we'll treat that as if
|
||||
// window.frames[n] is accessed (since window.frames === window),
|
||||
// if window.frames[n] is a child frame, wrap the frame and return
|
||||
// it without doing a security check.
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> frame = GetChildFrame(win, id);
|
||||
PRUint32 index = PRUint32(JSID_TO_INT(id));
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (frame) {
|
||||
if (nsCOMPtr<nsIDOMWindow> frame = GetChildFrame(win, index)) {
|
||||
// A numeric property accessed and the numeric property is a
|
||||
// child frame, wrap the child frame without doing a security
|
||||
// check and return.
|
||||
@ -6512,19 +6510,17 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
nsGlobalWindow *win = nsGlobalWindow::FromWrapper(wrapper);
|
||||
|
||||
if (!JSID_IS_STRING(id)) {
|
||||
if (JSID_IS_INT(id) && !(flags & JSRESOLVE_ASSIGNING)) {
|
||||
if (JSID_IS_INT(id) && JSID_TO_INT(id) >= 0 && !(flags & JSRESOLVE_ASSIGNING)) {
|
||||
// If we're resolving a numeric property, treat that as if
|
||||
// window.frames[n] is resolved (since window.frames ===
|
||||
// window), if window.frames[n] is a child frame, define a
|
||||
// property for this index.
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> frame = GetChildFrame(win, id);
|
||||
|
||||
if (frame) {
|
||||
PRUint32 index = PRUint32(JSID_TO_INT(id));
|
||||
if (nsCOMPtr<nsIDOMWindow> frame = GetChildFrame(win, index)) {
|
||||
// A numeric property accessed and the numeric property is a
|
||||
// child frame. Define a property for this index.
|
||||
|
||||
*_retval = ::JS_DefineElement(cx, obj, JSID_TO_INT(id), JSVAL_VOID,
|
||||
*_retval = ::JS_DefineElement(cx, obj, index, JSVAL_VOID,
|
||||
nsnull, nsnull, JSPROP_SHARED);
|
||||
|
||||
if (*_retval) {
|
||||
@ -7916,8 +7912,9 @@ nsGenericArraySH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
nsresult rv = GetLength(wrapper, cx, obj, &length);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if ((PRUint32)n < length) {
|
||||
*_retval = ::JS_DefineElement(cx, obj, n, JSVAL_VOID, nsnull, nsnull,
|
||||
PRUint32 index = PRUint32(n);
|
||||
if (index < length) {
|
||||
*_retval = ::JS_DefineElement(cx, obj, index, JSVAL_VOID, nsnull, nsnull,
|
||||
JSPROP_ENUMERATE | JSPROP_SHARED);
|
||||
*objp = obj;
|
||||
}
|
||||
@ -8943,12 +8940,7 @@ nsHTMLDocumentSH::DocumentAllNewResolve(JSContext *cx, JSObject *obj, jsid id,
|
||||
JSBool ok = JS_TRUE;
|
||||
|
||||
if (v != JSVAL_VOID) {
|
||||
if (JSID_IS_STRING(id)) {
|
||||
ok = ::JS_DefinePropertyById(cx, obj, id, v, nsnull, nsnull, 0);
|
||||
} else {
|
||||
ok = ::JS_DefineElement(cx, obj, JSID_TO_INT(id), v, nsnull, nsnull, 0);
|
||||
}
|
||||
|
||||
ok = ::JS_DefinePropertyById(cx, obj, id, v, nsnull, nsnull, 0);
|
||||
*objp = obj;
|
||||
}
|
||||
|
||||
@ -9491,7 +9483,7 @@ nsHTMLSelectElementSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext
|
||||
nsISupports *node = options->GetNodeAt(n);
|
||||
if (node) {
|
||||
*objp = obj;
|
||||
*_retval = JS_DefineElement(cx, obj, n, JSVAL_VOID, nsnull, nsnull,
|
||||
*_retval = JS_DefineElement(cx, obj, PRUint32(n), JSVAL_VOID, nsnull, nsnull,
|
||||
JSPROP_ENUMERATE | JSPROP_SHARED);
|
||||
|
||||
return NS_OK;
|
||||
@ -9841,24 +9833,14 @@ nsHTMLPluginObjElementSH::GetProperty(nsIXPConnectWrappedNative *wrapper,
|
||||
JSBool found = PR_FALSE;
|
||||
|
||||
if (!ObjectIsNativeWrapper(cx, obj)) {
|
||||
if (JSID_IS_STRING(id)) {
|
||||
*_retval = ::JS_HasPropertyById(cx, pi_obj, id, &found);
|
||||
} else {
|
||||
*_retval = ::JS_HasElement(cx, pi_obj, JSID_TO_INT(id), &found);
|
||||
}
|
||||
|
||||
*_retval = ::JS_HasPropertyById(cx, pi_obj, id, &found);
|
||||
if (!*_retval) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
if (JSID_IS_STRING(id)) {
|
||||
*_retval = ::JS_GetPropertyById(cx, pi_obj, id, vp);
|
||||
} else {
|
||||
*_retval = ::JS_GetElement(cx, pi_obj, JSID_TO_INT(id), vp);
|
||||
}
|
||||
|
||||
*_retval = ::JS_GetPropertyById(cx, pi_obj, id, vp);
|
||||
return *_retval ? NS_SUCCESS_I_DID_SOMETHING : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@ -9880,24 +9862,14 @@ nsHTMLPluginObjElementSH::SetProperty(nsIXPConnectWrappedNative *wrapper,
|
||||
JSBool found = PR_FALSE;
|
||||
|
||||
if (!ObjectIsNativeWrapper(cx, obj)) {
|
||||
if (JSID_IS_STRING(id)) {
|
||||
*_retval = ::JS_HasPropertyById(cx, pi_obj, id, &found);
|
||||
} else {
|
||||
*_retval = ::JS_HasElement(cx, pi_obj, JSID_TO_INT(id), &found);
|
||||
}
|
||||
|
||||
*_retval = ::JS_HasPropertyById(cx, pi_obj, id, &found);
|
||||
if (!*_retval) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
if (JSID_IS_STRING(id)) {
|
||||
*_retval = ::JS_SetPropertyById(cx, pi_obj, id, vp);
|
||||
} else {
|
||||
*_retval = ::JS_SetElement(cx, pi_obj, JSID_TO_INT(id), vp);
|
||||
}
|
||||
|
||||
*_retval = ::JS_SetPropertyById(cx, pi_obj, id, vp);
|
||||
return *_retval ? NS_SUCCESS_I_DID_SOMETHING : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -91,6 +91,17 @@ nsDOMNavigationTiming::TimeStampToDOM(mozilla::TimeStamp aStamp,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMNavigationTiming::TimeStampToDOMOrFetchStart(mozilla::TimeStamp aStamp,
|
||||
DOMTimeMilliSec* aResult)
|
||||
{
|
||||
if (!aStamp.IsNull()) {
|
||||
return TimeStampToDOM(aStamp, aResult);
|
||||
} else {
|
||||
return GetFetchStart(aResult);
|
||||
}
|
||||
}
|
||||
|
||||
DOMTimeMilliSec nsDOMNavigationTiming::DurationFromStart(){
|
||||
DOMTimeMilliSec result;
|
||||
TimeStampToDOM(mozilla::TimeStamp::Now(), &result);
|
||||
|
@ -92,6 +92,8 @@ public:
|
||||
void NotifyDOMContentLoadedStart(nsIURI* aURI);
|
||||
void NotifyDOMContentLoadedEnd(nsIURI* aURI);
|
||||
nsresult TimeStampToDOM(mozilla::TimeStamp aStamp, DOMTimeMilliSec* aResult);
|
||||
nsresult TimeStampToDOMOrFetchStart(mozilla::TimeStamp aStamp,
|
||||
DOMTimeMilliSec* aResult);
|
||||
|
||||
private:
|
||||
nsDOMNavigationTiming(const nsDOMNavigationTiming &){};
|
||||
|
@ -5952,7 +5952,7 @@ class PostMessageEvent : public nsRunnable
|
||||
private:
|
||||
nsRefPtr<nsGlobalWindow> mSource;
|
||||
nsString mCallerOrigin;
|
||||
uint64* mMessage;
|
||||
JSUint64* mMessage;
|
||||
size_t mMessageLen;
|
||||
nsRefPtr<nsGlobalWindow> mTargetWindow;
|
||||
nsCOMPtr<nsIURI> mProvidedOrigin;
|
||||
@ -7259,30 +7259,6 @@ nsGlobalWindow::AddEventListener(const nsAString& aType,
|
||||
aWantsUntrusted);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGlobalWindow::AddEventListenerByIID(nsIDOMEventListener* aListener,
|
||||
const nsIID& aIID)
|
||||
{
|
||||
nsEventListenerManager* manager = GetListenerManager(PR_TRUE);
|
||||
NS_ENSURE_STATE(manager);
|
||||
return manager->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGlobalWindow::RemoveEventListenerByIID(nsIDOMEventListener* aListener,
|
||||
const nsIID& aIID)
|
||||
{
|
||||
FORWARD_TO_INNER(RemoveEventListenerByIID, (aListener, aIID),
|
||||
NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
if (mListenerManager) {
|
||||
mListenerManager->RemoveEventListenerByIID(aListener, aIID,
|
||||
NS_EVENT_FLAG_BUBBLE);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsEventListenerManager*
|
||||
nsGlobalWindow::GetListenerManager(PRBool aCreateIfNotFound)
|
||||
{
|
||||
|
@ -114,7 +114,7 @@ nsPerformanceTiming::GetDomainLookupStart(DOMTimeMilliSec* aTime)
|
||||
}
|
||||
mozilla::TimeStamp stamp;
|
||||
mChannel->GetDomainLookupStart(&stamp);
|
||||
return mDOMTiming->TimeStampToDOM(stamp, aTime);
|
||||
return mDOMTiming->TimeStampToDOMOrFetchStart(stamp, aTime);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -125,7 +125,7 @@ nsPerformanceTiming::GetDomainLookupEnd(DOMTimeMilliSec* aTime)
|
||||
}
|
||||
mozilla::TimeStamp stamp;
|
||||
mChannel->GetDomainLookupEnd(&stamp);
|
||||
return mDOMTiming->TimeStampToDOM(stamp, aTime);
|
||||
return mDOMTiming->TimeStampToDOMOrFetchStart(stamp, aTime);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -136,7 +136,7 @@ nsPerformanceTiming::GetConnectStart(DOMTimeMilliSec* aTime)
|
||||
}
|
||||
mozilla::TimeStamp stamp;
|
||||
mChannel->GetConnectStart(&stamp);
|
||||
return mDOMTiming->TimeStampToDOM(stamp, aTime);
|
||||
return mDOMTiming->TimeStampToDOMOrFetchStart(stamp, aTime);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -147,7 +147,7 @@ nsPerformanceTiming::GetConnectEnd(DOMTimeMilliSec* aTime)
|
||||
}
|
||||
mozilla::TimeStamp stamp;
|
||||
mChannel->GetConnectEnd(&stamp);
|
||||
return mDOMTiming->TimeStampToDOM(stamp, aTime);
|
||||
return mDOMTiming->TimeStampToDOMOrFetchStart(stamp, aTime);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -158,7 +158,7 @@ nsPerformanceTiming::GetRequestStart(DOMTimeMilliSec* aTime)
|
||||
}
|
||||
mozilla::TimeStamp stamp;
|
||||
mChannel->GetRequestStart(&stamp);
|
||||
return mDOMTiming->TimeStampToDOM(stamp, aTime);
|
||||
return mDOMTiming->TimeStampToDOMOrFetchStart(stamp, aTime);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -174,7 +174,7 @@ nsPerformanceTiming::GetResponseStart(DOMTimeMilliSec* aTime)
|
||||
if (stamp.IsNull() || (!cacheStamp.IsNull() && cacheStamp < stamp)) {
|
||||
stamp = cacheStamp;
|
||||
}
|
||||
return mDOMTiming->TimeStampToDOM(stamp, aTime);
|
||||
return mDOMTiming->TimeStampToDOMOrFetchStart(stamp, aTime);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -190,7 +190,7 @@ nsPerformanceTiming::GetResponseEnd(DOMTimeMilliSec* aTime)
|
||||
if (stamp.IsNull() || (!cacheStamp.IsNull() && cacheStamp < stamp)) {
|
||||
stamp = cacheStamp;
|
||||
}
|
||||
return mDOMTiming->TimeStampToDOM(stamp, aTime);
|
||||
return mDOMTiming->TimeStampToDOMOrFetchStart(stamp, aTime);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -149,24 +149,6 @@ nsWindowRoot::AddEventListener(const nsAString& aType,
|
||||
return elm->AddEventListener(aType, aListener, aUseCapture, aWantsUntrusted);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsWindowRoot::AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID)
|
||||
{
|
||||
nsEventListenerManager* manager = GetListenerManager(PR_TRUE);
|
||||
NS_ENSURE_STATE(manager);
|
||||
return manager->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsWindowRoot::RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID)
|
||||
{
|
||||
nsEventListenerManager* manager = GetListenerManager(PR_TRUE);
|
||||
if (manager) {
|
||||
manager->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsEventListenerManager*
|
||||
nsWindowRoot::GetListenerManager(PRBool aCreateIfNotFound)
|
||||
{
|
||||
|
@ -98,8 +98,7 @@ ConvertCloneBuffersToArrayInternal(
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
jsint count = jsint(aBuffers.Length());
|
||||
for (jsint index = 0; index < count; index++) {
|
||||
for (uint32 index = 0, count = aBuffers.Length(); index < count; index++) {
|
||||
JSAutoStructuredCloneBuffer& buffer = aBuffers[index];
|
||||
|
||||
jsval val;
|
||||
|
@ -924,8 +924,7 @@ GetAllKeysHelper::GetSuccessResult(JSContext* aCx,
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
jsint count = jsint(keys.Length());
|
||||
for (jsint index = 0; index < count; index++) {
|
||||
for (uint32 index = 0, count = keys.Length(); index < count; index++) {
|
||||
const Key& key = keys[index];
|
||||
NS_ASSERTION(!key.IsUnset(), "Bad key!");
|
||||
|
||||
|
@ -835,7 +835,7 @@ IDBObjectStore::GetStructuredCloneDataFromStatement(
|
||||
nsresult rv = aStatement->GetSharedBlob(aIndex, &dataLength, &data);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
return aBuffer.copy(reinterpret_cast<const uint64 *>(data), dataLength) ?
|
||||
return aBuffer.copy(reinterpret_cast<const uint64_t *>(data), dataLength) ?
|
||||
NS_OK :
|
||||
NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
@ -253,19 +253,6 @@ interface nsIDOMEventTarget : nsISupports
|
||||
[notxpcom, nostdcall]
|
||||
nsEventListenerManagerPtr GetListenerManager(in boolean aMayCreate);
|
||||
|
||||
/**
|
||||
* Add an event listener for nsIID.
|
||||
*/
|
||||
[noscript, nostdcall]
|
||||
void AddEventListenerByIID(in nsIDOMEventListener aListener,
|
||||
in nsIIDRef aIID);
|
||||
/**
|
||||
* Remove event listener for nsIID.
|
||||
*/
|
||||
[noscript, nostdcall]
|
||||
void RemoveEventListenerByIID(in nsIDOMEventListener aListener,
|
||||
in nsIIDRef aIID);
|
||||
|
||||
/**
|
||||
* Get the script context in which the event handlers should be run.
|
||||
* May return null.
|
||||
|
@ -70,7 +70,6 @@ using mozilla::DefaultXDisplay;
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsSize.h"
|
||||
#include "nsIDOMContextMenuListener.h"
|
||||
#include "nsDisplayList.h"
|
||||
#include "ImageLayers.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
@ -124,23 +123,18 @@ using namespace mozilla;
|
||||
// special class for handeling DOM context menu events because for
|
||||
// some reason it starves other mouse events if implemented on the
|
||||
// same class
|
||||
class nsPluginDOMContextMenuListener : public nsIDOMContextMenuListener
|
||||
class nsPluginDOMContextMenuListener : public nsIDOMEventListener
|
||||
{
|
||||
public:
|
||||
nsPluginDOMContextMenuListener();
|
||||
virtual ~nsPluginDOMContextMenuListener();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDOMEVENTLISTENER
|
||||
|
||||
NS_IMETHOD ContextMenu(nsIDOMEvent* aContextMenuEvent);
|
||||
|
||||
nsresult Init(nsIContent* aContent);
|
||||
nsresult Destroy(nsIContent* aContent);
|
||||
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
nsEventStatus ProcessEvent(const nsGUIEvent& anEvent)
|
||||
{
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
@ -385,19 +379,10 @@ nsPluginInstanceOwner::~nsPluginInstanceOwner()
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsPluginInstanceOwner)
|
||||
NS_IMPL_RELEASE(nsPluginInstanceOwner)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsPluginInstanceOwner)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIPluginInstanceOwner)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIPluginTagInfo)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseMotionListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMKeyListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMFocusListener)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEventListener, nsIDOMMouseListener)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPluginInstanceOwner)
|
||||
NS_INTERFACE_MAP_END
|
||||
NS_IMPL_ISUPPORTS3(nsPluginInstanceOwner,
|
||||
nsIPluginInstanceOwner,
|
||||
nsIPluginTagInfo,
|
||||
nsIDOMEventListener)
|
||||
|
||||
nsresult
|
||||
nsPluginInstanceOwner::SetInstance(nsNPAPIPluginInstance *aInstance)
|
||||
@ -1673,19 +1658,6 @@ void nsPluginInstanceOwner::ScrollPositionDidChange(nscoord aX, nscoord aY)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*=============== nsIDOMFocusListener ======================*/
|
||||
nsresult nsPluginInstanceOwner::Focus(nsIDOMEvent * aFocusEvent)
|
||||
{
|
||||
mContentFocused = PR_TRUE;
|
||||
return DispatchFocusToPlugin(aFocusEvent);
|
||||
}
|
||||
|
||||
nsresult nsPluginInstanceOwner::Blur(nsIDOMEvent * aFocusEvent)
|
||||
{
|
||||
mContentFocused = PR_FALSE;
|
||||
return DispatchFocusToPlugin(aFocusEvent);
|
||||
}
|
||||
|
||||
nsresult nsPluginInstanceOwner::DispatchFocusToPlugin(nsIDOMEvent* aFocusEvent)
|
||||
{
|
||||
#ifndef XP_MACOSX
|
||||
@ -1715,18 +1687,6 @@ nsresult nsPluginInstanceOwner::DispatchFocusToPlugin(nsIDOMEvent* aFocusEvent)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/*=============== nsIKeyListener ======================*/
|
||||
nsresult nsPluginInstanceOwner::KeyDown(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
return DispatchKeyToPlugin(aKeyEvent);
|
||||
}
|
||||
|
||||
nsresult nsPluginInstanceOwner::KeyUp(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
return DispatchKeyToPlugin(aKeyEvent);
|
||||
}
|
||||
|
||||
nsresult nsPluginInstanceOwner::KeyPress(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
#ifdef XP_MACOSX
|
||||
@ -1738,11 +1698,10 @@ nsresult nsPluginInstanceOwner::KeyPress(nsIDOMEvent* aKeyEvent)
|
||||
nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(aKeyEvent));
|
||||
if (privateEvent) {
|
||||
nsEvent *theEvent = privateEvent->GetInternalNSEvent();
|
||||
const nsGUIEvent *guiEvent = (nsGUIEvent*)theEvent;
|
||||
const EventRecord *ev = (EventRecord*)(guiEvent->pluginEvent);
|
||||
if (guiEvent &&
|
||||
guiEvent->message == NS_KEY_PRESS &&
|
||||
ev &&
|
||||
const EventRecord *ev;
|
||||
if (theEvent &&
|
||||
theEvent->message == NS_KEY_PRESS &&
|
||||
(ev = (EventRecord*)(((nsGUIEvent*)theEvent)->pluginEvent)) &&
|
||||
ev->what == keyDown)
|
||||
return aKeyEvent->PreventDefault(); // consume event
|
||||
}
|
||||
@ -1789,9 +1748,9 @@ nsresult nsPluginInstanceOwner::DispatchKeyToPlugin(nsIDOMEvent* aKeyEvent)
|
||||
if (mInstance) {
|
||||
nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(aKeyEvent));
|
||||
if (privateEvent) {
|
||||
nsKeyEvent *keyEvent = (nsKeyEvent *) privateEvent->GetInternalNSEvent();
|
||||
if (keyEvent) {
|
||||
nsEventStatus rv = ProcessEvent(*keyEvent);
|
||||
nsEvent *event = privateEvent->GetInternalNSEvent();
|
||||
if (event && event->eventStructType == NS_KEY_EVENT) {
|
||||
nsEventStatus rv = ProcessEvent(*static_cast<nsGUIEvent*>(event));
|
||||
if (nsEventStatus_eConsumeNoDefault == rv) {
|
||||
aKeyEvent->PreventDefault();
|
||||
aKeyEvent->StopPropagation();
|
||||
@ -1805,39 +1764,6 @@ nsresult nsPluginInstanceOwner::DispatchKeyToPlugin(nsIDOMEvent* aKeyEvent)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*=============== nsIDOMMouseMotionListener ======================*/
|
||||
|
||||
nsresult
|
||||
nsPluginInstanceOwner::MouseMove(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
#if !defined(XP_MACOSX)
|
||||
if (!mPluginWindow || (mPluginWindow->type == NPWindowTypeWindow))
|
||||
return aMouseEvent->PreventDefault(); // consume event
|
||||
// continue only for cases without child window
|
||||
#endif
|
||||
|
||||
// don't send mouse events if we are hidden
|
||||
if (!mWidgetVisible)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(aMouseEvent));
|
||||
if (privateEvent) {
|
||||
nsMouseEvent* mouseEvent = (nsMouseEvent *) privateEvent->GetInternalNSEvent();
|
||||
if (mouseEvent) {
|
||||
nsEventStatus rv = ProcessEvent(*mouseEvent);
|
||||
if (nsEventStatus_eConsumeNoDefault == rv) {
|
||||
return aMouseEvent->PreventDefault(); // consume event
|
||||
}
|
||||
}
|
||||
else NS_ASSERTION(PR_FALSE, "nsPluginInstanceOwner::MouseMove failed, mouseEvent null");
|
||||
}
|
||||
else NS_ASSERTION(PR_FALSE, "nsPluginInstanceOwner::MouseMove failed, privateEvent null");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*=============== nsIDOMMouseListener ======================*/
|
||||
|
||||
nsresult
|
||||
nsPluginInstanceOwner::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
@ -1861,9 +1787,9 @@ nsPluginInstanceOwner::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
|
||||
nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(aMouseEvent));
|
||||
if (privateEvent) {
|
||||
nsMouseEvent* mouseEvent = (nsMouseEvent *) privateEvent->GetInternalNSEvent();
|
||||
if (mouseEvent) {
|
||||
nsEventStatus rv = ProcessEvent(*mouseEvent);
|
||||
nsEvent* event = privateEvent->GetInternalNSEvent();
|
||||
if (event && event->eventStructType == NS_MOUSE_EVENT) {
|
||||
nsEventStatus rv = ProcessEvent(*static_cast<nsGUIEvent*>(event));
|
||||
if (nsEventStatus_eConsumeNoDefault == rv) {
|
||||
return aMouseEvent->PreventDefault(); // consume event
|
||||
}
|
||||
@ -1875,44 +1801,6 @@ nsPluginInstanceOwner::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPluginInstanceOwner::MouseUp(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
// Don't send a mouse-up event to the plugin if it isn't focused. This can
|
||||
// happen if the previous mouse-down was sent to a DOM element above the
|
||||
// plugin, the mouse is still above the plugin, and the mouse-down event
|
||||
// caused the element to disappear. See bug 627649.
|
||||
if (!mContentFocused) {
|
||||
aMouseEvent->PreventDefault();
|
||||
return NS_OK;
|
||||
}
|
||||
return DispatchMouseToPlugin(aMouseEvent);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPluginInstanceOwner::MouseClick(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
return DispatchMouseToPlugin(aMouseEvent);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPluginInstanceOwner::MouseDblClick(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
return DispatchMouseToPlugin(aMouseEvent);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPluginInstanceOwner::MouseOver(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
return DispatchMouseToPlugin(aMouseEvent);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPluginInstanceOwner::MouseOut(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
return DispatchMouseToPlugin(aMouseEvent);
|
||||
}
|
||||
|
||||
nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
#if !defined(XP_MACOSX)
|
||||
@ -1926,9 +1814,9 @@ nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent)
|
||||
|
||||
nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(aMouseEvent));
|
||||
if (privateEvent) {
|
||||
nsMouseEvent* mouseEvent = (nsMouseEvent *) privateEvent->GetInternalNSEvent();
|
||||
if (mouseEvent) {
|
||||
nsEventStatus rv = ProcessEvent(*mouseEvent);
|
||||
nsEvent* event = privateEvent->GetInternalNSEvent();
|
||||
if (event && event->eventStructType == NS_MOUSE_EVENT) {
|
||||
nsEventStatus rv = ProcessEvent(*static_cast<nsGUIEvent*>(event));
|
||||
if (nsEventStatus_eConsumeNoDefault == rv) {
|
||||
aMouseEvent->PreventDefault();
|
||||
aMouseEvent->StopPropagation();
|
||||
@ -1944,10 +1832,49 @@ nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent)
|
||||
nsresult
|
||||
nsPluginInstanceOwner::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (mInstance) {
|
||||
nsAutoString eventType;
|
||||
aEvent->GetType(eventType);
|
||||
if (eventType.EqualsLiteral("focus")) {
|
||||
mContentFocused = PR_TRUE;
|
||||
return DispatchFocusToPlugin(aEvent);
|
||||
}
|
||||
if (eventType.EqualsLiteral("blur")) {
|
||||
mContentFocused = PR_FALSE;
|
||||
return DispatchFocusToPlugin(aEvent);
|
||||
}
|
||||
if (eventType.EqualsLiteral("mousedown")) {
|
||||
return MouseDown(aEvent);
|
||||
}
|
||||
if (eventType.EqualsLiteral("mouseup")) {
|
||||
// Don't send a mouse-up event to the plugin if it isn't focused. This can
|
||||
// happen if the previous mouse-down was sent to a DOM element above the
|
||||
// plugin, the mouse is still above the plugin, and the mouse-down event
|
||||
// caused the element to disappear. See bug 627649.
|
||||
if (!mContentFocused) {
|
||||
aEvent->PreventDefault();
|
||||
return NS_OK;
|
||||
}
|
||||
return DispatchMouseToPlugin(aEvent);
|
||||
}
|
||||
if (eventType.EqualsLiteral("mousemove") ||
|
||||
eventType.EqualsLiteral("click") ||
|
||||
eventType.EqualsLiteral("dblclick") ||
|
||||
eventType.EqualsLiteral("mouseover") ||
|
||||
eventType.EqualsLiteral("mouseout")) {
|
||||
return DispatchMouseToPlugin(aEvent);
|
||||
}
|
||||
if (eventType.EqualsLiteral("keydown") ||
|
||||
eventType.EqualsLiteral("keyup")) {
|
||||
return DispatchKeyToPlugin(aEvent);
|
||||
}
|
||||
if (eventType.EqualsLiteral("keypress")) {
|
||||
return KeyPress(aEvent);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMDragEvent> dragEvent(do_QueryInterface(aEvent));
|
||||
if (dragEvent && mInstance) {
|
||||
nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(aEvent));
|
||||
nsCOMPtr<nsIDOMDragEvent> dragEvent(do_QueryInterface(aEvent));
|
||||
if (privateEvent && dragEvent) {
|
||||
if (privateEvent) {
|
||||
nsEvent* ievent = privateEvent->GetInternalNSEvent();
|
||||
if (ievent && NS_IS_TRUSTED_EVENT(ievent) &&
|
||||
(ievent->message == NS_DRAGDROP_ENTER || ievent->message == NS_DRAGDROP_OVER)) {
|
||||
@ -2506,38 +2433,28 @@ nsPluginInstanceOwner::Destroy()
|
||||
mCXMenuListener = nsnull;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(mContent));
|
||||
if (target) {
|
||||
|
||||
nsCOMPtr<nsIDOMEventListener> listener;
|
||||
QueryInterface(NS_GET_IID(nsIDOMEventListener), getter_AddRefs(listener));
|
||||
|
||||
// Unregister focus event listener
|
||||
mContent->RemoveEventListenerByIID(listener, NS_GET_IID(nsIDOMFocusListener));
|
||||
|
||||
// Unregister mouse event listener
|
||||
mContent->RemoveEventListenerByIID(listener, NS_GET_IID(nsIDOMMouseListener));
|
||||
|
||||
// now for the mouse motion listener
|
||||
mContent->RemoveEventListenerByIID(listener, NS_GET_IID(nsIDOMMouseMotionListener));
|
||||
|
||||
// Unregister key event listener;
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("keypress"), listener, PR_TRUE);
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("keydown"), listener, PR_TRUE);
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("keyup"), listener, PR_TRUE);
|
||||
|
||||
// Unregister drag event listener;
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("drop"), listener, PR_TRUE);
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("dragdrop"), listener, PR_TRUE);
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("drag"), listener, PR_TRUE);
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("dragenter"), listener, PR_TRUE);
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("dragover"), listener, PR_TRUE);
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("dragexit"), listener, PR_TRUE);
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("dragleave"), listener, PR_TRUE);
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("dragstart"), listener, PR_TRUE);
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("draggesture"), listener, PR_TRUE);
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("dragend"), listener, PR_TRUE);
|
||||
}
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("focus"), this, PR_FALSE);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("blur"), this, PR_FALSE);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("mouseup"), this, PR_FALSE);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("mousedown"), this, PR_FALSE);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("mousemove"), this, PR_FALSE);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("click"), this, PR_FALSE);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("dblclick"), this, PR_FALSE);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("mouseover"), this, PR_FALSE);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("mouseout"), this, PR_FALSE);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("keypress"), this, PR_TRUE);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("keydown"), this, PR_TRUE);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("keyup"), this, PR_TRUE);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("drop"), this, PR_TRUE);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("dragdrop"), this, PR_TRUE);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("drag"), this, PR_TRUE);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("dragenter"), this, PR_TRUE);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("dragover"), this, PR_TRUE);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("dragleave"), this, PR_TRUE);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("dragexit"), this, PR_TRUE);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("dragstart"), this, PR_TRUE);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("draggesture"), this, PR_TRUE);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("dragend"), this, PR_TRUE);
|
||||
|
||||
if (mWidget) {
|
||||
nsCOMPtr<nsIPluginWidget> pluginWidget = do_QueryInterface(mWidget);
|
||||
@ -2967,38 +2884,37 @@ nsresult nsPluginInstanceOwner::Init(nsPresContext* aPresContext,
|
||||
mCXMenuListener->Init(aContent);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(mContent));
|
||||
if (target) {
|
||||
|
||||
nsCOMPtr<nsIDOMEventListener> listener;
|
||||
QueryInterface(NS_GET_IID(nsIDOMEventListener), getter_AddRefs(listener));
|
||||
|
||||
// Register focus listener
|
||||
mContent->AddEventListenerByIID(listener, NS_GET_IID(nsIDOMFocusListener));
|
||||
|
||||
// Register mouse listener
|
||||
mContent->AddEventListenerByIID(listener, NS_GET_IID(nsIDOMMouseListener));
|
||||
|
||||
// now do the mouse motion listener
|
||||
mContent->AddEventListenerByIID(listener, NS_GET_IID(nsIDOMMouseMotionListener));
|
||||
|
||||
// Register key listener
|
||||
target->AddEventListener(NS_LITERAL_STRING("keypress"), listener, PR_TRUE);
|
||||
target->AddEventListener(NS_LITERAL_STRING("keydown"), listener, PR_TRUE);
|
||||
target->AddEventListener(NS_LITERAL_STRING("keyup"), listener, PR_TRUE);
|
||||
|
||||
// Register drag listener
|
||||
target->AddEventListener(NS_LITERAL_STRING("drop"), listener, PR_TRUE);
|
||||
target->AddEventListener(NS_LITERAL_STRING("dragdrop"), listener, PR_TRUE);
|
||||
target->AddEventListener(NS_LITERAL_STRING("drag"), listener, PR_TRUE);
|
||||
target->AddEventListener(NS_LITERAL_STRING("dragenter"), listener, PR_TRUE);
|
||||
target->AddEventListener(NS_LITERAL_STRING("dragover"), listener, PR_TRUE);
|
||||
target->AddEventListener(NS_LITERAL_STRING("dragleave"), listener, PR_TRUE);
|
||||
target->AddEventListener(NS_LITERAL_STRING("dragexit"), listener, PR_TRUE);
|
||||
target->AddEventListener(NS_LITERAL_STRING("dragstart"), listener, PR_TRUE);
|
||||
target->AddEventListener(NS_LITERAL_STRING("draggesture"), listener, PR_TRUE);
|
||||
target->AddEventListener(NS_LITERAL_STRING("dragend"), listener, PR_TRUE);
|
||||
}
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("focus"), this, PR_FALSE,
|
||||
PR_FALSE);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("blur"), this, PR_FALSE,
|
||||
PR_FALSE);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("mouseup"), this, PR_FALSE,
|
||||
PR_FALSE);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("mousedown"), this, PR_FALSE,
|
||||
PR_FALSE);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("mousemove"), this, PR_FALSE,
|
||||
PR_FALSE);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("click"), this, PR_FALSE,
|
||||
PR_FALSE);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("dblclick"), this, PR_FALSE,
|
||||
PR_FALSE);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("mouseover"), this, PR_FALSE,
|
||||
PR_FALSE);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("mouseout"), this, PR_FALSE,
|
||||
PR_FALSE);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("keypress"), this, PR_TRUE);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("keydown"), this, PR_TRUE);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("keyup"), this, PR_TRUE);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("drop"), this, PR_TRUE);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("dragdrop"), this, PR_TRUE);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("drag"), this, PR_TRUE);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("dragenter"), this, PR_TRUE);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("dragover"), this, PR_TRUE);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("dragleave"), this, PR_TRUE);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("dragexit"), this, PR_TRUE);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("dragstart"), this, PR_TRUE);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("draggesture"), this, PR_TRUE);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("dragend"), this, PR_TRUE);
|
||||
|
||||
// Register scroll position listeners
|
||||
// We need to register a scroll position listener on every scrollable
|
||||
@ -3393,14 +3309,13 @@ nsPluginDOMContextMenuListener::~nsPluginDOMContextMenuListener()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsPluginDOMContextMenuListener,
|
||||
nsIDOMContextMenuListener,
|
||||
NS_IMPL_ISUPPORTS1(nsPluginDOMContextMenuListener,
|
||||
nsIDOMEventListener)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPluginDOMContextMenuListener::ContextMenu(nsIDOMEvent* aContextMenuEvent)
|
||||
nsPluginDOMContextMenuListener::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
aContextMenuEvent->PreventDefault(); // consume event
|
||||
aEvent->PreventDefault(); // consume event
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -52,15 +52,17 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIPluginInstanceOwner.h"
|
||||
#include "nsIPluginTagInfo.h"
|
||||
#include "nsIDOMMouseListener.h"
|
||||
#include "nsIDOMMouseMotionListener.h"
|
||||
#include "nsIDOMKeyListener.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIScrollPositionListener.h"
|
||||
#include "nsPluginHost.h"
|
||||
#include "nsPluginNativeWindow.h"
|
||||
#include "gfxRect.h"
|
||||
|
||||
// X.h defines KeyPress
|
||||
#ifdef KeyPress
|
||||
#undef KeyPress
|
||||
#endif
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#include "nsCoreAnimationSupport.h"
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
@ -90,12 +92,14 @@ class gfxXlibSurface;
|
||||
#include <os2.h>
|
||||
#endif
|
||||
|
||||
// X.h defines KeyPress
|
||||
#ifdef KeyPress
|
||||
#undef KeyPress
|
||||
#endif
|
||||
|
||||
class nsPluginInstanceOwner : public nsIPluginInstanceOwner,
|
||||
public nsIPluginTagInfo,
|
||||
public nsIDOMMouseListener,
|
||||
public nsIDOMMouseMotionListener,
|
||||
public nsIDOMKeyListener,
|
||||
public nsIDOMFocusListener,
|
||||
public nsIDOMEventListener,
|
||||
public nsIScrollPositionListener
|
||||
{
|
||||
public:
|
||||
@ -119,28 +123,12 @@ public:
|
||||
//nsIPluginTagInfo interface
|
||||
NS_DECL_NSIPLUGINTAGINFO
|
||||
|
||||
// nsIDOMMouseListener interfaces
|
||||
NS_IMETHOD MouseDown(nsIDOMEvent* aMouseEvent);
|
||||
NS_IMETHOD MouseUp(nsIDOMEvent* aMouseEvent);
|
||||
NS_IMETHOD MouseClick(nsIDOMEvent* aMouseEvent);
|
||||
NS_IMETHOD MouseDblClick(nsIDOMEvent* aMouseEvent);
|
||||
NS_IMETHOD MouseOver(nsIDOMEvent* aMouseEvent);
|
||||
NS_IMETHOD MouseOut(nsIDOMEvent* aMouseEvent);
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
|
||||
|
||||
// nsIDOMMouseMotionListener interfaces
|
||||
NS_IMETHOD MouseMove(nsIDOMEvent* aMouseEvent);
|
||||
NS_IMETHOD DragMove(nsIDOMEvent* aMouseEvent) { return NS_OK; }
|
||||
|
||||
// nsIDOMKeyListener interfaces
|
||||
NS_IMETHOD KeyDown(nsIDOMEvent* aKeyEvent);
|
||||
NS_IMETHOD KeyUp(nsIDOMEvent* aKeyEvent);
|
||||
NS_IMETHOD KeyPress(nsIDOMEvent* aKeyEvent);
|
||||
|
||||
// nsIDOMFocusListener interfaces
|
||||
NS_IMETHOD Focus(nsIDOMEvent * aFocusEvent);
|
||||
NS_IMETHOD Blur(nsIDOMEvent * aFocusEvent);
|
||||
// nsIDOMEventListener interfaces
|
||||
NS_DECL_NSIDOMEVENTLISTENER
|
||||
|
||||
nsresult MouseDown(nsIDOMEvent* aKeyEvent);
|
||||
nsresult KeyPress(nsIDOMEvent* aKeyEvent);
|
||||
|
||||
nsresult Destroy();
|
||||
|
||||
void PrepareToStop(PRBool aDelayedStop);
|
||||
|
@ -1,61 +0,0 @@
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# 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 *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = dom
|
||||
|
||||
EXPORTS = \
|
||||
nsIDOMFocusListener.h \
|
||||
nsIDOMFormListener.h \
|
||||
nsIDOMKeyListener.h \
|
||||
nsIDOMLoadListener.h \
|
||||
nsIDOMMouseListener.h \
|
||||
nsIDOMMouseMotionListener.h \
|
||||
nsIDOMTextListener.h \
|
||||
nsIDOMCompositionListener.h \
|
||||
nsIDOMContextMenuListener.h \
|
||||
nsIDOMUIListener.h \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -1,66 +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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* 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 ***** */
|
||||
|
||||
#ifndef nsIDOMCompositionListener_h__
|
||||
#define nsIDOMCompositionListener_h__
|
||||
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
|
||||
/*
|
||||
* Key pressed / released / typed listener interface.
|
||||
*/
|
||||
// {47F158C0-C534-43a1-8415-8B17706E2FBC}
|
||||
#define NS_IDOMCOMPOSITIONLISTENER_IID \
|
||||
{ 0x47f158c0, 0xc534, 0x43a1, \
|
||||
{ 0x84, 0x15, 0x8b, 0x17, 0x70, 0x6e, 0x2f, 0xbc } }
|
||||
|
||||
|
||||
class nsIDOMCompositionListener : public nsIDOMEventListener {
|
||||
|
||||
public:
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMCOMPOSITIONLISTENER_IID)
|
||||
|
||||
NS_IMETHOD HandleStartComposition(nsIDOMEvent* aCompositionEvent) = 0;
|
||||
NS_IMETHOD HandleEndComposition(nsIDOMEvent* aCompositionEvent) = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMCompositionListener,
|
||||
NS_IDOMCOMPOSITIONLISTENER_IID)
|
||||
|
||||
#endif // nsIDOMCompositionListener_h__
|
@ -1,70 +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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* 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 ***** */
|
||||
|
||||
|
||||
#ifndef nsIDOMContextMenuListener_h__
|
||||
#define nsIDOMContextMenuListener_h__
|
||||
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
|
||||
/*
|
||||
* Context menu event listener
|
||||
*
|
||||
*/
|
||||
#define NS_IDOMCONTEXTMENULISTENER_IID \
|
||||
{ /* 162b3480-ded6-11d1-bd85-00805f8ae3f7 */ \
|
||||
0x162b3480, 0xded6, 0x11d1, \
|
||||
{0xbd, 0x85, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf7} }
|
||||
|
||||
class nsIDOMContextMenuListener : public nsIDOMEventListener {
|
||||
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMCONTEXTMENULISTENER_IID)
|
||||
/**
|
||||
* Processes a context menu event
|
||||
* @param aContextMenuEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
NS_IMETHOD ContextMenu(nsIDOMEvent* aContextMenuEvent) = 0;
|
||||
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMContextMenuListener,
|
||||
NS_IDOMCONTEXTMENULISTENER_IID)
|
||||
|
||||
#endif // nsIDOMContextMenuListener_h__
|
@ -1,77 +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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* 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 ***** */
|
||||
|
||||
|
||||
#ifndef nsIDOMFocusListener_h__
|
||||
#define nsIDOMFocusListener_h__
|
||||
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
|
||||
/*
|
||||
* Mouse up/down/move event listener
|
||||
*
|
||||
*/
|
||||
#define NS_IDOMFOCUSLISTENER_IID \
|
||||
{ /* 80974670-ded6-11d1-bd85-00805f8ae3f4 */ \
|
||||
0x80974670, 0xded6, 0x11d1, \
|
||||
{0xbd, 0x85, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} }
|
||||
|
||||
class nsIDOMFocusListener : public nsIDOMEventListener
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMFOCUSLISTENER_IID)
|
||||
|
||||
/**
|
||||
* Processes a focus event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
NS_IMETHOD Focus(nsIDOMEvent* aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a blur event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
NS_IMETHOD Blur(nsIDOMEvent* aEvent) = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMFocusListener, NS_IDOMFOCUSLISTENER_IID)
|
||||
|
||||
#endif // nsIDOMFocusListener_h__
|
@ -1,97 +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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* 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 ***** */
|
||||
|
||||
|
||||
#ifndef nsIDOMFormListener_h__
|
||||
#define nsIDOMFormListener_h__
|
||||
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
|
||||
/*
|
||||
* Form submit/reset listener
|
||||
*
|
||||
*/
|
||||
#define NS_IDOMFORMLISTENER_IID \
|
||||
{ /* 566c3f80-28ab-11d2-bd89-00805f8ae3f4 */ \
|
||||
0x566c3f80, 0x28ab, 0x11d2, \
|
||||
{0xbd, 0x89, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} }
|
||||
|
||||
class nsIDOMFormListener : public nsIDOMEventListener {
|
||||
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMFORMLISTENER_IID)
|
||||
/**
|
||||
* Processes a form submit event
|
||||
* @param aEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
NS_IMETHOD Submit(nsIDOMEvent* aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a form reset event
|
||||
* @param aEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
NS_IMETHOD Reset(nsIDOMEvent* aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a form change event
|
||||
* @param aEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
NS_IMETHOD Change(nsIDOMEvent* aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a form select event
|
||||
* @param aEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
NS_IMETHOD Select(nsIDOMEvent* aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a form input event
|
||||
* @param aEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
NS_IMETHOD Input(nsIDOMEvent* aEvent) = 0;
|
||||
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMFormListener, NS_IDOMFORMLISTENER_IID)
|
||||
|
||||
#endif // nsIDOMFormListener_h__
|
@ -1,89 +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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* 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 ***** */
|
||||
|
||||
#ifndef nsIDOMKeyListener_h__
|
||||
#define nsIDOMKeyListener_h__
|
||||
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
|
||||
// X.h defines KeyPress
|
||||
#ifdef KeyPress
|
||||
#undef KeyPress
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Key pressed / released / typed listener interface.
|
||||
*/
|
||||
#define NS_IDOMKEYLISTENER_IID \
|
||||
{ /* 35f0d080-da38-11d1-bd85-00805f8ae3f4 */ \
|
||||
0x35f0d080, 0xda38, 0x11d1, \
|
||||
{0xbd, 0x85, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} }
|
||||
|
||||
class nsIDOMKeyListener : public nsIDOMEventListener {
|
||||
|
||||
public:
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMKEYLISTENER_IID)
|
||||
|
||||
/**
|
||||
* Processes a key pressed event
|
||||
* @param aKeyEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
NS_IMETHOD KeyDown(nsIDOMEvent* aKeyEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a key release event
|
||||
* @param aKeyEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
NS_IMETHOD KeyUp(nsIDOMEvent* aKeyEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a key typed event
|
||||
* @param aKeyEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD KeyPress(nsIDOMEvent* aKeyEvent) = 0;
|
||||
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMKeyListener, NS_IDOMKEYLISTENER_IID)
|
||||
|
||||
#endif // nsIDOMKeyListener_h__
|
@ -1,98 +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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* 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 ***** */
|
||||
|
||||
|
||||
#ifndef nsIDOMLoadListener_h__
|
||||
#define nsIDOMLoadListener_h__
|
||||
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
|
||||
/*
|
||||
* Document load related event listener
|
||||
*
|
||||
*/
|
||||
#define NS_IDOMLOADLISTENER_IID \
|
||||
{ /* d1810238-14f8-4cab-9b96-96bedb9de7be */ \
|
||||
0xd1810238, 0x14f8, 0x4cab, \
|
||||
{0x9b, 0x96, 0x96, 0xbe, 0xdb, 0x9d, 0xe7, 0xbe} }
|
||||
|
||||
class nsIDOMLoadListener : public nsIDOMEventListener {
|
||||
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMLOADLISTENER_IID)
|
||||
/**
|
||||
* Processes a page or image load event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
NS_IMETHOD Load(nsIDOMEvent* aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a page beforeUnload event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
NS_IMETHOD BeforeUnload(nsIDOMEvent* aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a page unload event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
NS_IMETHOD Unload(nsIDOMEvent* aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a load abort event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Abort(nsIDOMEvent* aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes an load error event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
NS_IMETHOD Error(nsIDOMEvent* aEvent) = 0;
|
||||
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMLoadListener, NS_IDOMLOADLISTENER_IID)
|
||||
|
||||
#endif // nsIDOMLoadListener_h__
|
@ -1,108 +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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* 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 ***** */
|
||||
|
||||
|
||||
#ifndef nsIDOMMouseListener_h__
|
||||
#define nsIDOMMouseListener_h__
|
||||
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
|
||||
/*
|
||||
* Mouse up/down/move event listener
|
||||
*
|
||||
*/
|
||||
#define NS_IDOMMOUSELISTENER_IID \
|
||||
{ /* ccd7fa30-da37-11d1-bd85-00805f8ae3f4 */ \
|
||||
0xccd7fa30, 0xda37, 0x11d1, \
|
||||
{0xbd, 0x85, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} }
|
||||
|
||||
class nsIDOMMouseListener : public nsIDOMEventListener {
|
||||
|
||||
public:
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMMOUSELISTENER_IID)
|
||||
|
||||
/**
|
||||
* Processes a mouse down event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
NS_IMETHOD MouseDown(nsIDOMEvent* aMouseEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a mouse up event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
NS_IMETHOD MouseUp(nsIDOMEvent* aMouseEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a mouse click event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD MouseClick(nsIDOMEvent* aMouseEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a mouse click event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD MouseDblClick(nsIDOMEvent* aMouseEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a mouse enter event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
NS_IMETHOD MouseOver(nsIDOMEvent* aMouseEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a mouse leave event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
NS_IMETHOD MouseOut(nsIDOMEvent* aMouseEvent) = 0;
|
||||
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMMouseListener, NS_IDOMMOUSELISTENER_IID)
|
||||
|
||||
#endif // nsIDOMMouseListener_h__
|
@ -1,77 +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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* 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 ***** */
|
||||
|
||||
|
||||
#ifndef nsIDOMMouseMotionListener_h__
|
||||
#define nsIDOMMouseMotionListener_h__
|
||||
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
|
||||
/*
|
||||
* Mouse motion event listener
|
||||
*
|
||||
*/
|
||||
#define NS_IDOMMOUSEMOTIONLISTENER_IID \
|
||||
{ /* 162b3480-ded6-11d1-bd85-00805f8ae3f4 */ \
|
||||
0x162b3480, 0xded6, 0x11d1, \
|
||||
{0xbd, 0x85, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} }
|
||||
|
||||
class nsIDOMMouseMotionListener : public nsIDOMEventListener {
|
||||
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMMOUSEMOTIONLISTENER_IID)
|
||||
/**
|
||||
* Processes a mouse move event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
NS_IMETHOD MouseMove(nsIDOMEvent* aMouseEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a drag move event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
NS_IMETHOD DragMove(nsIDOMEvent* aMouseEvent) = 0;
|
||||
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMMouseMotionListener,
|
||||
NS_IDOMMOUSEMOTIONLISTENER_IID)
|
||||
|
||||
#endif // nsIDOMMouseMotionListener_h__
|
@ -1,64 +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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* 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 ***** */
|
||||
|
||||
#ifndef nsIDOMTextListener_h__
|
||||
#define nsIDOMTextListener_h__
|
||||
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
|
||||
/*
|
||||
* Key pressed / released / typed listener interface.
|
||||
*/
|
||||
// {C6296E81-D823-11d2-9E7F-0060089FE59B}
|
||||
#define NS_IDOMTEXTLISTENER_IID \
|
||||
{ 0xc6296e81, 0xd823, 0x11d2, { 0x9e, 0x7f, 0x0, 0x60, 0x8, 0x9f, 0xe5, 0x9b } }
|
||||
|
||||
|
||||
class nsIDOMTextListener : public nsIDOMEventListener
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMTEXTLISTENER_IID)
|
||||
|
||||
NS_IMETHOD HandleText(nsIDOMEvent* aTextEvent) = 0;
|
||||
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMTextListener, NS_IDOMTEXTLISTENER_IID)
|
||||
|
||||
#endif // nsIDOMTextListener_h__
|
@ -1,63 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* IBM Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2003
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Brian Ryner <bryner@brianryner.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsIDOMUIListener_h__
|
||||
#define nsIDOMUIListener_h__
|
||||
|
||||
#include "nsIDOMEventListener.h"
|
||||
|
||||
class nsIDOMEvent;
|
||||
|
||||
/*
|
||||
* UI event listener interface.
|
||||
*/
|
||||
// {5cb5527a-512f-4163-9393-ca95ceddbc13}
|
||||
#define NS_IDOMUILISTENER_IID \
|
||||
{ 0x5cb5527a, 0x512f, 0x4163, { 0x93, 0x93, 0xca, 0x95, 0xce, 0xdd, 0xbc, 0x13 } }
|
||||
|
||||
class nsIDOMUIListener : public nsIDOMEventListener {
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMUILISTENER_IID)
|
||||
|
||||
NS_IMETHOD Activate(nsIDOMEvent* aEvent) = 0;
|
||||
NS_IMETHOD FocusIn(nsIDOMEvent* aEvent) = 0;
|
||||
NS_IMETHOD FocusOut(nsIDOMEvent* aEvent) = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMUIListener, NS_IDOMUILISTENER_IID)
|
||||
|
||||
#endif // nsIDOMUIListener_h__
|
@ -40,7 +40,7 @@
|
||||
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIJSEventListener.h"
|
||||
#include "nsIDOMMouseListener.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "jsapi.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAtom.h"
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "nsDOMStorage.h"
|
||||
#include "nsDOMStorageDBWrapper.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIVariant.h"
|
||||
#include "nsIEffectiveTLDService.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
@ -354,15 +355,22 @@ nsDOMStorageDBWrapper::CreateDomainScopeDBKey(nsIURI* aUri, nsACString& aKey)
|
||||
if (domainScope.IsEmpty()) {
|
||||
// About pages have an empty host but a valid path. Since they are handled
|
||||
// internally by our own redirector, we can trust them and use path as key.
|
||||
PRBool isAboutUrl = PR_FALSE;
|
||||
if ((NS_SUCCEEDED(aUri->SchemeIs("about", &isAboutUrl)) && isAboutUrl) ||
|
||||
(NS_SUCCEEDED(aUri->SchemeIs("moz-safe-about", &isAboutUrl)) && isAboutUrl)) {
|
||||
// if file:/// protocol, let's make the exact directory the domain
|
||||
PRBool isScheme = PR_FALSE;
|
||||
if ((NS_SUCCEEDED(aUri->SchemeIs("about", &isScheme)) && isScheme) ||
|
||||
(NS_SUCCEEDED(aUri->SchemeIs("moz-safe-about", &isScheme)) && isScheme)) {
|
||||
rv = aUri->GetPath(domainScope);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// While the host is always canonicalized to lowercase, the path is not,
|
||||
// thus need to force the casing.
|
||||
ToLowerCase(domainScope);
|
||||
}
|
||||
else if (NS_SUCCEEDED(aUri->SchemeIs("file", &isScheme)) && isScheme) {
|
||||
nsCOMPtr<nsIURL> url = do_QueryInterface(aUri, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = url->GetDirectory(domainScope);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
|
||||
rv = CreateDomainScopeDBKey(domainScope, aKey);
|
||||
|
@ -291,16 +291,16 @@ CreateJSContextForWorker(WorkerPrivate* aWorkerPrivate)
|
||||
|
||||
class WorkerMemoryReporter : public nsIMemoryMultiReporter
|
||||
{
|
||||
JSRuntime* mRuntime;
|
||||
WorkerPrivate* mWorkerPrivate;
|
||||
nsCString mPathPrefix;
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
WorkerMemoryReporter(WorkerPrivate* aWorkerPrivate, JSRuntime* aRuntime)
|
||||
: mRuntime(aRuntime)
|
||||
WorkerMemoryReporter(WorkerPrivate* aWorkerPrivate)
|
||||
: mWorkerPrivate(aWorkerPrivate)
|
||||
{
|
||||
NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
|
||||
aWorkerPrivate->AssertIsOnWorkerThread();
|
||||
|
||||
nsCString escapedDomain(aWorkerPrivate->Domain());
|
||||
escapedDomain.ReplaceChar('/', '\\');
|
||||
@ -331,10 +331,8 @@ public:
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
JS_TriggerAllOperationCallbacks(mRuntime);
|
||||
|
||||
IterateData data;
|
||||
if (!CollectCompartmentStatsForRuntime(mRuntime, &data)) {
|
||||
if (!mWorkerPrivate->BlockAndCollectRuntimeStats(&data)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@ -372,16 +370,17 @@ public:
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
JSRuntime* rt = JS_GetRuntime(cx);
|
||||
|
||||
nsRefPtr<WorkerMemoryReporter> reporter =
|
||||
new WorkerMemoryReporter(workerPrivate, rt);
|
||||
new WorkerMemoryReporter(workerPrivate);
|
||||
if (NS_FAILED(NS_RegisterMemoryMultiReporter(reporter))) {
|
||||
NS_WARNING("Failed to register memory reporter!");
|
||||
reporter = nsnull;
|
||||
}
|
||||
|
||||
workerPrivate->DoRunLoop(cx);
|
||||
{
|
||||
JSAutoRequest ar(cx);
|
||||
workerPrivate->DoRunLoop(cx);
|
||||
}
|
||||
|
||||
if (reporter) {
|
||||
if (NS_FAILED(NS_UnregisterMemoryMultiReporter(reporter))) {
|
||||
@ -390,6 +389,8 @@ public:
|
||||
reporter = nsnull;
|
||||
}
|
||||
|
||||
JSRuntime* rt = JS_GetRuntime(cx);
|
||||
|
||||
// XXX Bug 666963 - CTypes can create another JSContext for use with
|
||||
// closures, and then it holds that context in a reserved slot on the CType
|
||||
// prototype object. We have to destroy that context before we can destroy
|
||||
|
@ -64,6 +64,7 @@
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "xpcpublic.h"
|
||||
|
||||
#include "Events.h"
|
||||
#include "Exceptions.h"
|
||||
@ -83,6 +84,7 @@ using mozilla::MutexAutoLock;
|
||||
using mozilla::TimeDuration;
|
||||
using mozilla::TimeStamp;
|
||||
using mozilla::dom::workers::exceptions::ThrowDOMExceptionForCode;
|
||||
using mozilla::xpconnect::memory::IterateData;
|
||||
|
||||
USING_WORKERS_NAMESPACE
|
||||
|
||||
@ -1070,6 +1072,60 @@ public:
|
||||
};
|
||||
#endif
|
||||
|
||||
class CollectRuntimeStatsRunnable : public WorkerControlRunnable
|
||||
{
|
||||
typedef mozilla::Mutex Mutex;
|
||||
typedef mozilla::CondVar CondVar;
|
||||
|
||||
Mutex* mMutex;
|
||||
CondVar* mCondVar;
|
||||
volatile bool* mDoneFlag;
|
||||
IterateData* mData;
|
||||
volatile bool* mSucceeded;
|
||||
|
||||
public:
|
||||
CollectRuntimeStatsRunnable(WorkerPrivate* aWorkerPrivate, Mutex* aMutex,
|
||||
CondVar* aCondVar, volatile bool* aDoneFlag,
|
||||
IterateData* aData, volatile bool* aSucceeded)
|
||||
: WorkerControlRunnable(aWorkerPrivate, WorkerThread, UnchangedBusyCount),
|
||||
mMutex(aMutex), mCondVar(aCondVar), mDoneFlag(aDoneFlag), mData(aData),
|
||||
mSucceeded(aSucceeded)
|
||||
{ }
|
||||
|
||||
bool
|
||||
PreDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
PostDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate,
|
||||
bool aDispatchResult)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
}
|
||||
|
||||
bool
|
||||
WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
|
||||
{
|
||||
JSAutoSuspendRequest asr(aCx);
|
||||
|
||||
*mSucceeded = CollectCompartmentStatsForRuntime(JS_GetRuntime(aCx), mData);
|
||||
|
||||
{
|
||||
MutexAutoLock lock(*mMutex);
|
||||
|
||||
NS_ASSERTION(!*mDoneFlag, "Should be false!");
|
||||
|
||||
*mDoneFlag = true;
|
||||
mCondVar->Notify();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} /* anonymous namespace */
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -2042,8 +2098,6 @@ WorkerPrivate::DoRunLoop(JSContext* aCx)
|
||||
{
|
||||
MutexAutoUnlock unlock(mMutex);
|
||||
|
||||
JSAutoRequest ar(aCx);
|
||||
|
||||
#ifdef EXTRA_GC
|
||||
// Find GC bugs...
|
||||
JS_GC(aCx);
|
||||
@ -2056,8 +2110,6 @@ WorkerPrivate::DoRunLoop(JSContext* aCx)
|
||||
currentStatus = mStatus;
|
||||
}
|
||||
|
||||
JSAutoRequest ar(aCx);
|
||||
|
||||
#ifdef EXTRA_GC
|
||||
// Find GC bugs...
|
||||
JS_GC(aCx);
|
||||
@ -2097,8 +2149,6 @@ WorkerPrivate::OperationCallback(JSContext* aCx)
|
||||
{
|
||||
AssertIsOnWorkerThread();
|
||||
|
||||
JS_YieldRequest(aCx);
|
||||
|
||||
bool mayContinue = true;
|
||||
|
||||
for (;;) {
|
||||
@ -2133,7 +2183,6 @@ WorkerPrivate::OperationCallback(JSContext* aCx)
|
||||
break;
|
||||
}
|
||||
|
||||
JSAutoSuspendRequest asr(aCx);
|
||||
mCondVar.Wait(PR_MillisecondsToInterval(RemainingRunTimeMS()));
|
||||
}
|
||||
}
|
||||
@ -2184,6 +2233,36 @@ WorkerPrivate::ScheduleDeletion(bool aWasPending)
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
WorkerPrivate::BlockAndCollectRuntimeStats(IterateData* aData)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
mMutex.AssertNotCurrentThreadOwns();
|
||||
NS_ASSERTION(aData, "Null data!");
|
||||
|
||||
mozilla::Mutex mutex("BlockAndCollectRuntimeStats mutex");
|
||||
mozilla::CondVar condvar(mutex, "BlockAndCollectRuntimeStats condvar");
|
||||
volatile bool doneFlag = false;
|
||||
volatile bool succeeded = false;
|
||||
|
||||
nsRefPtr<CollectRuntimeStatsRunnable> runnable =
|
||||
new CollectRuntimeStatsRunnable(this, &mutex, &condvar, &doneFlag, aData,
|
||||
&succeeded);
|
||||
if (!runnable->Dispatch(nsnull)) {
|
||||
NS_WARNING("Failed to dispatch runnable!");
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
MutexAutoLock lock(mutex);
|
||||
while (!doneFlag) {
|
||||
condvar.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
return succeeded;
|
||||
}
|
||||
|
||||
bool
|
||||
WorkerPrivate::Dispatch(WorkerRunnable* aEvent, EventQueue* aQueue)
|
||||
{
|
||||
@ -2488,7 +2567,6 @@ WorkerPrivate::RunSyncLoop(JSContext* aCx, PRUint32 aSyncLoopKey)
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
||||
while (!mControlQueue.Pop(event) && !syncQueue->mQueue.Pop(event)) {
|
||||
JSAutoSuspendRequest asr(aCx);
|
||||
mCondVar.Wait();
|
||||
}
|
||||
}
|
||||
|
@ -68,6 +68,16 @@ class nsIURI;
|
||||
class nsPIDOMWindow;
|
||||
class nsITimer;
|
||||
|
||||
namespace mozilla {
|
||||
namespace xpconnect {
|
||||
namespace memory {
|
||||
|
||||
struct IterateData;
|
||||
|
||||
} // namespace memory
|
||||
} // namespace xpconnect
|
||||
} // namespace mozilla
|
||||
|
||||
BEGIN_WORKERS_NAMESPACE
|
||||
|
||||
class WorkerPrivate;
|
||||
@ -640,6 +650,9 @@ public:
|
||||
void
|
||||
ScheduleDeletion(bool aWasPending);
|
||||
|
||||
bool
|
||||
BlockAndCollectRuntimeStats(mozilla::xpconnect::memory::IterateData* aData);
|
||||
|
||||
#ifdef JS_GC_ZEAL
|
||||
void
|
||||
UpdateGCZealInternal(JSContext* aCx, PRUint8 aGCZeal);
|
||||
|
@ -51,8 +51,6 @@
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMKeyListener.h"
|
||||
#include "nsIDOMMouseListener.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsIDOMComment.h"
|
||||
#include "nsISelection.h"
|
||||
|
@ -44,8 +44,6 @@
|
||||
#include "nsHTMLEditUtils.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMAttr.h"
|
||||
#include "nsIDOMKeyListener.h"
|
||||
#include "nsIDOMMouseListener.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsISelectionPrivate.h"
|
||||
|
@ -48,7 +48,6 @@
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMMouseListener.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsISelectionPrivate.h"
|
||||
#include "nsISelectionController.h"
|
||||
|
@ -70,6 +70,7 @@ abstract public class GeckoApp
|
||||
public static final String ACTION_ALERT_CLEAR = "org.mozilla.gecko.ACTION_ALERT_CLEAR";
|
||||
public static final String ACTION_WEBAPP = "org.mozilla.gecko.WEBAPP";
|
||||
public static final String ACTION_DEBUG = "org.mozilla.gecko.DEBUG";
|
||||
public static final String ACTION_BOOKMARK = "org.mozilla.gecko.BOOKMARK";
|
||||
|
||||
public static FrameLayout mainLayout;
|
||||
public static GeckoSurfaceView surfaceView;
|
||||
@ -317,20 +318,25 @@ abstract public class GeckoApp
|
||||
if (checkLaunchState(LaunchState.WaitButton) || launch(intent))
|
||||
return;
|
||||
|
||||
if (Intent.ACTION_VIEW.equals(action)) {
|
||||
if (Intent.ACTION_MAIN.equals(action)) {
|
||||
Log.i("GeckoApp", "Intent : ACTION_MAIN");
|
||||
GeckoAppShell.sendEventToGecko(new GeckoEvent(""));
|
||||
}
|
||||
else if (Intent.ACTION_VIEW.equals(action)) {
|
||||
String uri = intent.getDataString();
|
||||
GeckoAppShell.sendEventToGecko(new GeckoEvent(uri));
|
||||
Log.i("GeckoApp","onNewIntent: "+uri);
|
||||
}
|
||||
else if (Intent.ACTION_MAIN.equals(action)) {
|
||||
Log.i("GeckoApp", "Intent : ACTION_MAIN");
|
||||
GeckoAppShell.sendEventToGecko(new GeckoEvent(""));
|
||||
}
|
||||
else if (ACTION_WEBAPP.equals(action)) {
|
||||
String uri = intent.getStringExtra("args");
|
||||
GeckoAppShell.sendEventToGecko(new GeckoEvent(uri));
|
||||
Log.i("GeckoApp","Intent : WEBAPP - " + uri);
|
||||
}
|
||||
else if (ACTION_BOOKMARK.equals(action)) {
|
||||
String args = intent.getStringExtra("args");
|
||||
GeckoAppShell.sendEventToGecko(new GeckoEvent(args));
|
||||
Log.i("GeckoApp","Intent : BOOKMARK - " + args);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -682,14 +682,20 @@ public class GeckoAppShell
|
||||
}
|
||||
|
||||
// "Installs" an application by creating a shortcut
|
||||
static void installWebApplication(String aURI, String aTitle, String aIconData) {
|
||||
Log.w("GeckoAppJava", "installWebApplication for " + aURI + " [" + aTitle + "]");
|
||||
static void createShortcut(String aTitle, String aURI, String aIconData, String aType) {
|
||||
Log.w("GeckoAppJava", "createShortcut for " + aURI + " [" + aTitle + "]");
|
||||
|
||||
// the intent to be launched by the shortcut
|
||||
Intent shortcutIntent = new Intent("org.mozilla.gecko.WEBAPP");
|
||||
Intent shortcutIntent = new Intent();
|
||||
if (aType == "webapp") {
|
||||
shortcutIntent.setAction("org.mozilla.gecko.WEBAPP");
|
||||
shortcutIntent.putExtra("args", "--webapp=" + aURI);
|
||||
} else {
|
||||
shortcutIntent.setAction("org.mozilla.gecko.BOOKMARK");
|
||||
shortcutIntent.putExtra("args", "--url=" + aURI);
|
||||
}
|
||||
shortcutIntent.setClassName(GeckoApp.mAppContext,
|
||||
GeckoApp.mAppContext.getPackageName() + ".App");
|
||||
shortcutIntent.putExtra("args", "--webapp=" + aURI);
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
|
||||
|
@ -599,6 +599,7 @@ class GeckoSurfaceView
|
||||
// KeyListener returns true if it handled the event for us.
|
||||
if (mIMEState == IME_STATE_DISABLED ||
|
||||
keyCode == KeyEvent.KEYCODE_ENTER ||
|
||||
keyCode == KeyEvent.KEYCODE_DEL ||
|
||||
(event.getFlags() & KeyEvent.FLAG_SOFT_KEYBOARD) != 0 ||
|
||||
!mKeyListener.onKeyDown(this, mEditable, keyCode, event))
|
||||
GeckoAppShell.sendEventToGecko(new GeckoEvent(event));
|
||||
@ -617,6 +618,7 @@ class GeckoSurfaceView
|
||||
}
|
||||
if (mIMEState == IME_STATE_DISABLED ||
|
||||
keyCode == KeyEvent.KEYCODE_ENTER ||
|
||||
keyCode == KeyEvent.KEYCODE_DEL ||
|
||||
(event.getFlags() & KeyEvent.FLAG_SOFT_KEYBOARD) != 0 ||
|
||||
!mKeyListener.onKeyUp(this, mEditable, keyCode, event))
|
||||
GeckoAppShell.sendEventToGecko(new GeckoEvent(event));
|
||||
|
@ -184,7 +184,7 @@ NS_IMETHODIMP nsScriptableRegion::GetRects() {
|
||||
*retvalPtr = OBJECT_TO_JSVAL(destArray);
|
||||
ncc->SetReturnValueWasSet(PR_TRUE);
|
||||
|
||||
int n = 0;
|
||||
uint32 n = 0;
|
||||
nsIntRegionRectIterator iter(mRegion);
|
||||
const nsIntRect *rect;
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
// don't crash
|
||||
gczeal(2)
|
||||
evalcx('split')
|
||||
|
||||
// don't crash
|
||||
gczeal(2);
|
||||
evalcx('lazy');
|
||||
|
@ -3240,9 +3240,13 @@ JS_LookupPropertyById(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_LookupElement(JSContext *cx, JSObject *obj, jsint index, jsval *vp)
|
||||
JS_LookupElement(JSContext *cx, JSObject *obj, uint32 index, jsval *vp)
|
||||
{
|
||||
return JS_LookupPropertyById(cx, obj, INT_TO_JSID(index), vp);
|
||||
CHECK_REQUEST(cx);
|
||||
jsid id;
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return JS_LookupPropertyById(cx, obj, id, vp);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
@ -3294,9 +3298,13 @@ JS_HasPropertyById(JSContext *cx, JSObject *obj, jsid id, JSBool *foundp)
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_HasElement(JSContext *cx, JSObject *obj, jsint index, JSBool *foundp)
|
||||
JS_HasElement(JSContext *cx, JSObject *obj, uint32 index, JSBool *foundp)
|
||||
{
|
||||
return JS_HasPropertyById(cx, obj, INT_TO_JSID(index), foundp);
|
||||
CHECK_REQUEST(cx);
|
||||
jsid id;
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return JS_HasPropertyById(cx, obj, id, foundp);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
@ -3336,9 +3344,13 @@ JS_AlreadyHasOwnPropertyById(JSContext *cx, JSObject *obj, jsid id, JSBool *foun
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_AlreadyHasOwnElement(JSContext *cx, JSObject *obj, jsint index, JSBool *foundp)
|
||||
JS_AlreadyHasOwnElement(JSContext *cx, JSObject *obj, uint32 index, JSBool *foundp)
|
||||
{
|
||||
return JS_AlreadyHasOwnPropertyById(cx, obj, INT_TO_JSID(index), foundp);
|
||||
CHECK_REQUEST(cx);
|
||||
jsid id;
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return JS_AlreadyHasOwnPropertyById(cx, obj, id, foundp);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
@ -3387,10 +3399,14 @@ JS_DefinePropertyById(JSContext *cx, JSObject *obj, jsid id, jsval value,
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_DefineElement(JSContext *cx, JSObject *obj, jsint index, jsval value,
|
||||
JS_DefineElement(JSContext *cx, JSObject *obj, uint32 index, jsval value,
|
||||
JSPropertyOp getter, JSStrictPropertyOp setter, uintN attrs)
|
||||
{
|
||||
return DefinePropertyById(cx, obj, INT_TO_JSID(index), Valueify(value),
|
||||
CHECK_REQUEST(cx);
|
||||
jsid id;
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return DefinePropertyById(cx, obj, id, Valueify(value),
|
||||
Valueify(getter), Valueify(setter), attrs, 0, 0);
|
||||
}
|
||||
|
||||
@ -3698,9 +3714,13 @@ JS_GetPropertyByIdDefault(JSContext *cx, JSObject *obj, jsid id, jsval def, jsva
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_GetElement(JSContext *cx, JSObject *obj, jsint index, jsval *vp)
|
||||
JS_GetElement(JSContext *cx, JSObject *obj, uint32 index, jsval *vp)
|
||||
{
|
||||
return JS_GetPropertyById(cx, obj, INT_TO_JSID(index), vp);
|
||||
CHECK_REQUEST(cx);
|
||||
jsid id;
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return JS_GetPropertyById(cx, obj, id, vp);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
@ -3753,8 +3773,12 @@ JS_SetPropertyById(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_SetElement(JSContext *cx, JSObject *obj, jsint index, jsval *vp)
|
||||
JS_SetElement(JSContext *cx, JSObject *obj, uint32 index, jsval *vp)
|
||||
{
|
||||
CHECK_REQUEST(cx);
|
||||
jsid id;
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return JS_SetPropertyById(cx, obj, INT_TO_JSID(index), vp);
|
||||
}
|
||||
|
||||
@ -3782,9 +3806,13 @@ JS_DeletePropertyById2(JSContext *cx, JSObject *obj, jsid id, jsval *rval)
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_DeleteElement2(JSContext *cx, JSObject *obj, jsint index, jsval *rval)
|
||||
JS_DeleteElement2(JSContext *cx, JSObject *obj, uint32 index, jsval *rval)
|
||||
{
|
||||
return JS_DeletePropertyById2(cx, obj, INT_TO_JSID(index), rval);
|
||||
CHECK_REQUEST(cx);
|
||||
jsid id;
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return JS_DeletePropertyById2(cx, obj, id, rval);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
@ -3809,7 +3837,7 @@ JS_DeletePropertyById(JSContext *cx, JSObject *obj, jsid id)
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_DeleteElement(JSContext *cx, JSObject *obj, jsint index)
|
||||
JS_DeleteElement(JSContext *cx, JSObject *obj, uint32 index)
|
||||
{
|
||||
jsval junk;
|
||||
return JS_DeleteElement2(cx, obj, index, &junk);
|
||||
|
@ -2486,30 +2486,29 @@ extern JS_PUBLIC_API(JSBool)
|
||||
JS_SetArrayLength(JSContext *cx, JSObject *obj, jsuint length);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_DefineElement(JSContext *cx, JSObject *obj, jsint index, jsval value,
|
||||
JS_DefineElement(JSContext *cx, JSObject *obj, uint32 index, jsval value,
|
||||
JSPropertyOp getter, JSStrictPropertyOp setter, uintN attrs);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_AlreadyHasOwnElement(JSContext *cx, JSObject *obj, jsint index,
|
||||
JSBool *foundp);
|
||||
JS_AlreadyHasOwnElement(JSContext *cx, JSObject *obj, uint32 index, JSBool *foundp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_HasElement(JSContext *cx, JSObject *obj, jsint index, JSBool *foundp);
|
||||
JS_HasElement(JSContext *cx, JSObject *obj, uint32 index, JSBool *foundp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_LookupElement(JSContext *cx, JSObject *obj, jsint index, jsval *vp);
|
||||
JS_LookupElement(JSContext *cx, JSObject *obj, uint32 index, jsval *vp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_GetElement(JSContext *cx, JSObject *obj, jsint index, jsval *vp);
|
||||
JS_GetElement(JSContext *cx, JSObject *obj, uint32 index, jsval *vp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_SetElement(JSContext *cx, JSObject *obj, jsint index, jsval *vp);
|
||||
JS_SetElement(JSContext *cx, JSObject *obj, uint32 index, jsval *vp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_DeleteElement(JSContext *cx, JSObject *obj, jsint index);
|
||||
JS_DeleteElement(JSContext *cx, JSObject *obj, uint32 index);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_DeleteElement2(JSContext *cx, JSObject *obj, jsint index, jsval *rval);
|
||||
JS_DeleteElement2(JSContext *cx, JSObject *obj, uint32 index, jsval *rval);
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_ClearScope(JSContext *cx, JSObject *obj);
|
||||
|
@ -2054,7 +2054,7 @@ ethogram_getAllEvents(JSContext *cx, uintN argc, jsval *vp)
|
||||
|
||||
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(rarray));
|
||||
|
||||
for (int i = 0; !p->isEmpty(); i++) {
|
||||
for (uint32 i = 0; !p->isEmpty(); i++) {
|
||||
|
||||
JSObject *x = JS_NewObject(cx, NULL, NULL, NULL);
|
||||
if (x == NULL)
|
||||
|
@ -75,6 +75,8 @@
|
||||
#include "jsxml.h"
|
||||
#endif
|
||||
|
||||
#include "vm/GlobalObject.h"
|
||||
|
||||
#include "jsobjinlines.h"
|
||||
|
||||
#include "vm/Stack-inl.h"
|
||||
@ -1406,32 +1408,81 @@ static JSFunctionSpec generator_methods[] = {
|
||||
|
||||
#endif /* JS_HAS_GENERATORS */
|
||||
|
||||
static bool
|
||||
InitIteratorClass(JSContext *cx, GlobalObject *global)
|
||||
{
|
||||
JSObject *iteratorProto = global->createBlankPrototype(cx, &js_IteratorClass);
|
||||
if (!iteratorProto)
|
||||
return false;
|
||||
|
||||
JSFunction *ctor = global->createConstructor(cx, Iterator, &js_IteratorClass,
|
||||
CLASS_ATOM(cx, Iterator), 2);
|
||||
if (!ctor)
|
||||
return false;
|
||||
|
||||
if (!LinkConstructorAndPrototype(cx, ctor, iteratorProto))
|
||||
return false;
|
||||
|
||||
if (!DefinePropertiesAndBrand(cx, iteratorProto, NULL, iterator_methods))
|
||||
return false;
|
||||
|
||||
return DefineConstructorAndPrototype(cx, global, JSProto_Iterator, ctor, iteratorProto);
|
||||
}
|
||||
|
||||
static bool
|
||||
InitGeneratorClass(JSContext *cx, GlobalObject *global)
|
||||
{
|
||||
#if JS_HAS_GENERATORS
|
||||
JSObject *proto = global->createBlankPrototype(cx, &js_GeneratorClass);
|
||||
if (!proto)
|
||||
return false;
|
||||
|
||||
if (!DefinePropertiesAndBrand(cx, proto, NULL, generator_methods))
|
||||
return false;
|
||||
|
||||
/* This should use a non-JSProtoKey'd slot, but this is easier for now. */
|
||||
return DefineConstructorAndPrototype(cx, global, JSProto_Generator, proto, proto);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static JSObject *
|
||||
InitStopIterationClass(JSContext *cx, GlobalObject *global)
|
||||
{
|
||||
JSObject *proto = global->createBlankPrototype(cx, &js_StopIterationClass);
|
||||
if (!proto || !proto->freeze(cx))
|
||||
return NULL;
|
||||
|
||||
/* This should use a non-JSProtoKey'd slot, but this is easier for now. */
|
||||
if (!DefineConstructorAndPrototype(cx, global, JSProto_StopIteration, proto, proto))
|
||||
return NULL;
|
||||
|
||||
MarkStandardClassInitializedNoProto(global, &js_StopIterationClass);
|
||||
|
||||
return proto;
|
||||
}
|
||||
|
||||
JSObject *
|
||||
js_InitIteratorClasses(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
JSObject *proto, *stop;
|
||||
JS_ASSERT(obj->isNative());
|
||||
|
||||
/* Idempotency required: we initialize several things, possibly lazily. */
|
||||
if (!js_GetClassObject(cx, obj, JSProto_StopIteration, &stop))
|
||||
GlobalObject *global = obj->asGlobal();
|
||||
|
||||
/*
|
||||
* Bail if Iterator has already been initialized. We test for Iterator
|
||||
* rather than for StopIteration because if js_InitIteratorClasses recurs,
|
||||
* as happens when the StopIteration object is frozen, initializing the
|
||||
* Iterator class a second time will assert.
|
||||
*/
|
||||
JSObject *iter;
|
||||
if (!js_GetClassObject(cx, global, JSProto_Iterator, &iter))
|
||||
return NULL;
|
||||
if (stop)
|
||||
return stop;
|
||||
if (iter)
|
||||
return iter;
|
||||
|
||||
proto = js_InitClass(cx, obj, NULL, &js_IteratorClass, Iterator, 2,
|
||||
NULL, iterator_methods, NULL, NULL);
|
||||
if (!proto)
|
||||
if (!InitIteratorClass(cx, global) || !InitGeneratorClass(cx, global))
|
||||
return NULL;
|
||||
|
||||
#if JS_HAS_GENERATORS
|
||||
/* Initialize the generator internals if configured. */
|
||||
if (!js_InitClass(cx, obj, NULL, &js_GeneratorClass, NULL, 0,
|
||||
NULL, generator_methods, NULL, NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
MarkStandardClassInitializedNoProto(obj, &js_StopIterationClass);
|
||||
|
||||
return js_InitClass(cx, obj, NULL, &js_StopIterationClass, NULL, 0,
|
||||
NULL, NULL, NULL, NULL);
|
||||
return InitStopIterationClass(cx, global);
|
||||
}
|
||||
|
@ -4483,6 +4483,9 @@ js_AddNativeProperty(JSContext *cx, JSObject *obj, jsid id,
|
||||
{
|
||||
JS_ASSERT(!(flags & Shape::METHOD));
|
||||
|
||||
/* Convert string indices to integers if appropriate. */
|
||||
id = js_CheckForStringIndex(id);
|
||||
|
||||
/*
|
||||
* Purge the property cache of now-shadowed id in obj's scope chain. Do
|
||||
* this optimistically (assuming no failure below) before locking obj, so
|
||||
@ -4493,8 +4496,6 @@ js_AddNativeProperty(JSContext *cx, JSObject *obj, jsid id,
|
||||
if (!obj->ensureClassReservedSlots(cx))
|
||||
return NULL;
|
||||
|
||||
/* Convert string indices to integers if appropriate. */
|
||||
id = js_CheckForStringIndex(id);
|
||||
return obj->putProperty(cx, id, getter, setter, slot, attrs, flags, shortid);
|
||||
}
|
||||
|
||||
|
@ -1373,7 +1373,7 @@ CopyInitializerObject(JSContext *cx, JSObject *baseobj)
|
||||
|
||||
inline bool
|
||||
DefineConstructorAndPrototype(JSContext *cx, GlobalObject *global,
|
||||
JSProtoKey key, JSFunction *ctor, JSObject *proto)
|
||||
JSProtoKey key, JSObject *ctor, JSObject *proto)
|
||||
{
|
||||
JS_ASSERT(!global->nativeEmpty()); /* reserved slots already allocated */
|
||||
JS_ASSERT(ctor);
|
||||
|
@ -317,6 +317,7 @@ typedef union jsval_layout
|
||||
} s;
|
||||
double asDouble;
|
||||
void *asPtr;
|
||||
jsuword asWord;
|
||||
} jsval_layout;
|
||||
# endif /* JS_BITS_PER_WORD */
|
||||
#else /* defined(IS_LITTLE_ENDIAN) */
|
||||
@ -358,6 +359,7 @@ typedef union jsval_layout
|
||||
} s;
|
||||
double asDouble;
|
||||
void *asPtr;
|
||||
jsuword asWord;
|
||||
} jsval_layout;
|
||||
# endif /* JS_BITS_PER_WORD */
|
||||
#endif /* defined(IS_LITTLE_ENDIAN) */
|
||||
|
@ -295,7 +295,6 @@ JSVAL_EXTRACT_NON_DOUBLE_TAG_IMPL(jsval_layout l)
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
JS_STATIC_ASSERT(offsetof(jsval_layout, s.payload) == 0);
|
||||
JS_STATIC_ASSERT((JSVAL_TYPE_NONFUNOBJ & 0xF) == JSVAL_TYPE_OBJECT);
|
||||
JS_STATIC_ASSERT((JSVAL_TYPE_FUNOBJ & 0xF) == JSVAL_TYPE_OBJECT);
|
||||
#endif
|
||||
@ -744,9 +743,9 @@ class Value
|
||||
|
||||
const jsuword *payloadWord() const {
|
||||
#if JS_BITS_PER_WORD == 32
|
||||
return reinterpret_cast<const jsuword *>(&data.s.payload.word);
|
||||
return &data.s.payload.word;
|
||||
#elif JS_BITS_PER_WORD == 64
|
||||
return reinterpret_cast<const jsuword *>(&data.asBits);
|
||||
return &data.asWord;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -227,9 +227,6 @@ DestroyContext(JSContext *cx, bool withGC);
|
||||
static const JSErrorFormatString *
|
||||
my_GetErrorMessage(void *userRef, const char *locale, const uintN errorNumber);
|
||||
|
||||
static JSObject *
|
||||
split_setup(JSContext *cx, JSBool evalcx);
|
||||
|
||||
#ifdef EDITLINE
|
||||
JS_BEGIN_EXTERN_C
|
||||
JS_EXTERN_API(char) *readline(const char *prompt);
|
||||
@ -2474,7 +2471,7 @@ DumpStack(JSContext *cx, uintN argc, Value *vp)
|
||||
JS_ASSERT(iter.nativeArgs().callee().getFunctionPrivate()->native() == DumpStack);
|
||||
++iter;
|
||||
|
||||
jsint index = 0;
|
||||
uint32 index = 0;
|
||||
for (; !iter.done(); ++index, ++iter) {
|
||||
Value v;
|
||||
if (iter.isScript()) {
|
||||
@ -2701,7 +2698,6 @@ GetPDA(JSContext *cx, uintN argc, jsval *vp)
|
||||
JSBool ok;
|
||||
JSPropertyDescArray pda;
|
||||
JSPropertyDesc *pd;
|
||||
uint32 i;
|
||||
jsval v;
|
||||
|
||||
if (!JS_ValueToObject(cx, argc == 0 ? JSVAL_VOID : vp[2], &vobj))
|
||||
@ -2720,7 +2716,7 @@ GetPDA(JSContext *cx, uintN argc, jsval *vp)
|
||||
if (!ok)
|
||||
return JS_FALSE;
|
||||
pd = pda.array;
|
||||
for (i = 0; i < pda.length; i++, pd++) {
|
||||
for (uint32 i = 0; i < pda.length; i++, pd++) {
|
||||
pdobj = JS_NewObject(cx, NULL, NULL, NULL);
|
||||
if (!pdobj) {
|
||||
ok = JS_FALSE;
|
||||
@ -2834,379 +2830,6 @@ typedef struct ComplexObject {
|
||||
JSObject *outer;
|
||||
} ComplexObject;
|
||||
|
||||
static JSObject *
|
||||
split_create_outer(JSContext *cx);
|
||||
|
||||
static JSObject *
|
||||
split_create_inner(JSContext *cx, JSObject *outer);
|
||||
|
||||
static ComplexObject *
|
||||
split_get_private(JSContext *cx, JSObject *obj);
|
||||
|
||||
static JSBool
|
||||
split_addProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
||||
{
|
||||
ComplexObject *cpx;
|
||||
|
||||
cpx = split_get_private(cx, obj);
|
||||
if (!cpx)
|
||||
return JS_TRUE;
|
||||
if (!cpx->isInner && cpx->inner) {
|
||||
/* Make sure to define this property on the inner object. */
|
||||
return JS_DefinePropertyById(cx, cpx->inner, id, *vp, NULL, NULL, JSPROP_ENUMERATE);
|
||||
}
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
split_getProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
||||
{
|
||||
ComplexObject *cpx;
|
||||
|
||||
cpx = split_get_private(cx, obj);
|
||||
if (!cpx)
|
||||
return JS_TRUE;
|
||||
|
||||
if (JSID_IS_ATOM(id) && JS_FlatStringEqualsAscii(JSID_TO_FLAT_STRING(id), "isInner")) {
|
||||
*vp = BOOLEAN_TO_JSVAL(cpx->isInner);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (!cpx->isInner && cpx->inner) {
|
||||
if (JSID_IS_ATOM(id)) {
|
||||
JSString *str = JSID_TO_STRING(id);
|
||||
|
||||
size_t length;
|
||||
const jschar *chars = JS_GetStringCharsAndLength(cx, str, &length);
|
||||
if (!chars)
|
||||
return false;
|
||||
|
||||
return JS_GetUCProperty(cx, cpx->inner, chars, length, vp);
|
||||
}
|
||||
if (JSID_IS_INT(id))
|
||||
return JS_GetElement(cx, cpx->inner, JSID_TO_INT(id), vp);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
split_setProperty(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
|
||||
{
|
||||
ComplexObject *cpx;
|
||||
|
||||
cpx = split_get_private(cx, obj);
|
||||
if (!cpx)
|
||||
return true;
|
||||
if (!cpx->isInner && cpx->inner) {
|
||||
if (JSID_IS_ATOM(id)) {
|
||||
JSString *str = JSID_TO_STRING(id);
|
||||
|
||||
size_t length;
|
||||
const jschar *chars = JS_GetStringCharsAndLength(cx, str, &length);
|
||||
if (!chars)
|
||||
return false;
|
||||
|
||||
return JS_SetUCProperty(cx, cpx->inner, chars, length, vp);
|
||||
}
|
||||
if (JSID_IS_INT(id))
|
||||
return JS_SetElement(cx, cpx->inner, JSID_TO_INT(id), vp);
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
split_delProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
||||
{
|
||||
ComplexObject *cpx;
|
||||
jsid asId;
|
||||
|
||||
cpx = split_get_private(cx, obj);
|
||||
if (!cpx)
|
||||
return JS_TRUE;
|
||||
if (!cpx->isInner && cpx->inner) {
|
||||
/* Make sure to define this property on the inner object. */
|
||||
if (!JS_ValueToId(cx, *vp, &asId))
|
||||
return JS_FALSE;
|
||||
return cpx->inner->deleteProperty(cx, asId, Valueify(vp), true);
|
||||
}
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
split_enumerate(JSContext *cx, JSObject *obj, JSIterateOp enum_op,
|
||||
jsval *statep, jsid *idp)
|
||||
{
|
||||
ComplexObject *cpx;
|
||||
JSObject *iterator;
|
||||
|
||||
switch (enum_op) {
|
||||
case JSENUMERATE_INIT:
|
||||
case JSENUMERATE_INIT_ALL:
|
||||
cpx = (ComplexObject *) JS_GetPrivate(cx, obj);
|
||||
|
||||
if (!cpx->isInner && cpx->inner)
|
||||
obj = cpx->inner;
|
||||
|
||||
iterator = JS_NewPropertyIterator(cx, obj);
|
||||
if (!iterator)
|
||||
return JS_FALSE;
|
||||
|
||||
*statep = OBJECT_TO_JSVAL(iterator);
|
||||
if (idp)
|
||||
*idp = INT_TO_JSID(0);
|
||||
break;
|
||||
|
||||
case JSENUMERATE_NEXT:
|
||||
iterator = (JSObject*)JSVAL_TO_OBJECT(*statep);
|
||||
if (!JS_NextProperty(cx, iterator, idp))
|
||||
return JS_FALSE;
|
||||
|
||||
if (!JSID_IS_VOID(*idp))
|
||||
break;
|
||||
/* Fall through. */
|
||||
|
||||
case JSENUMERATE_DESTROY:
|
||||
/* Let GC at our iterator object. */
|
||||
*statep = JSVAL_NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
split_resolve(JSContext *cx, JSObject *obj, jsid id, uintN flags, JSObject **objp)
|
||||
{
|
||||
ComplexObject *cpx;
|
||||
|
||||
if (JSID_IS_ATOM(id) && JS_FlatStringEqualsAscii(JSID_TO_FLAT_STRING(id), "isInner")) {
|
||||
*objp = obj;
|
||||
return JS_DefinePropertyById(cx, obj, id, JSVAL_VOID, NULL, NULL, JSPROP_SHARED);
|
||||
}
|
||||
|
||||
cpx = split_get_private(cx, obj);
|
||||
if (!cpx)
|
||||
return JS_TRUE;
|
||||
if (!cpx->isInner && cpx->inner) {
|
||||
JSProperty *prop;
|
||||
return cpx->inner->lookupProperty(cx, id, objp, &prop);
|
||||
}
|
||||
|
||||
#ifdef LAZY_STANDARD_CLASSES
|
||||
if (!(flags & JSRESOLVE_ASSIGNING)) {
|
||||
JSBool resolved;
|
||||
|
||||
if (!JS_ResolveStandardClass(cx, obj, id, &resolved))
|
||||
return JS_FALSE;
|
||||
|
||||
if (resolved) {
|
||||
*objp = obj;
|
||||
return JS_TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* XXX For additional realism, let's resolve some random property here. */
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
split_finalize(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
JS_free(cx, JS_GetPrivate(cx, obj));
|
||||
}
|
||||
|
||||
static void
|
||||
split_trace(JSTracer *trc, JSObject *obj)
|
||||
{
|
||||
ComplexObject *cpx;
|
||||
|
||||
cpx = (ComplexObject *) JS_GetPrivate(trc->context, obj);
|
||||
|
||||
if (!cpx)
|
||||
return; /* The object is not fully constructed. */
|
||||
|
||||
if (!cpx->isInner && cpx->inner) {
|
||||
/* Mark the inner object. */
|
||||
JS_CALL_TRACER(trc, cpx->inner, JSTRACE_OBJECT, "ComplexObject.inner");
|
||||
}
|
||||
|
||||
if (cpx->isInner && cpx->outer) {
|
||||
/* Mark the inner object. */
|
||||
JS_CALL_TRACER(trc, cpx->outer, JSTRACE_OBJECT, "ComplexObject.outer");
|
||||
}
|
||||
}
|
||||
|
||||
static JSObject *
|
||||
split_outerObject(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
ComplexObject *cpx;
|
||||
|
||||
cpx = (ComplexObject *) JS_GetPrivate(cx, obj);
|
||||
return cpx->isInner ? cpx->outer : obj;
|
||||
}
|
||||
|
||||
static JSObject *
|
||||
split_thisObject(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
OBJ_TO_OUTER_OBJECT(cx, obj);
|
||||
if (!obj)
|
||||
return NULL;
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
static JSBool
|
||||
split_equality(JSContext *cx, JSObject *obj, const jsval *v, JSBool *bp);
|
||||
|
||||
static JSObject *
|
||||
split_innerObject(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
ComplexObject *cpx;
|
||||
|
||||
cpx = (ComplexObject *) JS_GetPrivate(cx, obj);
|
||||
if (cpx->frozen) {
|
||||
JS_ASSERT(!cpx->isInner);
|
||||
return obj;
|
||||
}
|
||||
return !cpx->isInner ? cpx->inner : obj;
|
||||
}
|
||||
|
||||
static Class split_global_class = {
|
||||
"split_global",
|
||||
JSCLASS_NEW_RESOLVE | JSCLASS_NEW_ENUMERATE | JSCLASS_HAS_PRIVATE | JSCLASS_GLOBAL_FLAGS,
|
||||
Valueify(split_addProperty),
|
||||
Valueify(split_delProperty),
|
||||
Valueify(split_getProperty),
|
||||
Valueify(split_setProperty),
|
||||
(JSEnumerateOp)split_enumerate,
|
||||
(JSResolveOp)split_resolve,
|
||||
ConvertStub,
|
||||
split_finalize,
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
split_trace,
|
||||
{
|
||||
Valueify(split_equality),
|
||||
split_outerObject,
|
||||
split_innerObject,
|
||||
NULL, /* iteratorObject */
|
||||
NULL, /* wrappedObject */
|
||||
},
|
||||
{
|
||||
NULL, /* lookupProperty */
|
||||
NULL, /* defineProperty */
|
||||
NULL, /* getProperty */
|
||||
NULL, /* setProperty */
|
||||
NULL, /* getAttributes */
|
||||
NULL, /* setAttributes */
|
||||
NULL, /* deleteProperty */
|
||||
NULL, /* enumerate */
|
||||
NULL, /* typeOf */
|
||||
NULL, /* fix */
|
||||
split_thisObject,
|
||||
NULL, /* clear */
|
||||
},
|
||||
};
|
||||
|
||||
static JSBool
|
||||
split_equality(JSContext *cx, JSObject *obj, const jsval *v, JSBool *bp)
|
||||
{
|
||||
*bp = JS_FALSE;
|
||||
if (JSVAL_IS_PRIMITIVE(*v))
|
||||
return JS_TRUE;
|
||||
|
||||
JSObject *obj2 = JSVAL_TO_OBJECT(*v);
|
||||
if (obj2->getClass() != &split_global_class)
|
||||
return JS_TRUE;
|
||||
|
||||
ComplexObject *cpx = (ComplexObject *) JS_GetPrivate(cx, obj2);
|
||||
JS_ASSERT(!cpx->isInner);
|
||||
|
||||
ComplexObject *ourCpx = (ComplexObject *) JS_GetPrivate(cx, obj);
|
||||
JS_ASSERT(!ourCpx->isInner);
|
||||
|
||||
*bp = (cpx == ourCpx);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSObject *
|
||||
split_create_outer(JSContext *cx)
|
||||
{
|
||||
ComplexObject *cpx;
|
||||
JSObject *obj;
|
||||
|
||||
cpx = (ComplexObject *) JS_malloc(cx, sizeof *obj);
|
||||
if (!cpx)
|
||||
return NULL;
|
||||
cpx->isInner = JS_FALSE;
|
||||
cpx->frozen = JS_TRUE;
|
||||
cpx->inner = NULL;
|
||||
cpx->outer = NULL;
|
||||
|
||||
obj = JS_NewGlobalObject(cx, Jsvalify(&split_global_class));
|
||||
if (!obj) {
|
||||
JS_free(cx, cpx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!JS_SetPrivate(cx, obj, cpx)) {
|
||||
JS_free(cx, cpx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static JSObject *
|
||||
split_create_inner(JSContext *cx, JSObject *outer)
|
||||
{
|
||||
ComplexObject *cpx, *outercpx;
|
||||
JSObject *obj;
|
||||
|
||||
JS_ASSERT(outer->getClass() == &split_global_class);
|
||||
|
||||
cpx = (ComplexObject *) JS_malloc(cx, sizeof *cpx);
|
||||
if (!cpx)
|
||||
return NULL;
|
||||
cpx->isInner = JS_TRUE;
|
||||
cpx->frozen = JS_FALSE;
|
||||
cpx->inner = NULL;
|
||||
cpx->outer = outer;
|
||||
|
||||
obj = JS_NewGlobalObject(cx, Jsvalify(&split_global_class));
|
||||
if (!obj || !JS_SetPrivate(cx, obj, cpx)) {
|
||||
JS_free(cx, cpx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
outercpx = (ComplexObject *) JS_GetPrivate(cx, outer);
|
||||
outercpx->inner = obj;
|
||||
outercpx->frozen = JS_FALSE;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static ComplexObject *
|
||||
split_get_private(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
do {
|
||||
if (obj->getClass() == &split_global_class)
|
||||
return (ComplexObject *) JS_GetPrivate(cx, obj);
|
||||
obj = JS_GetParent(cx, obj);
|
||||
} while (obj);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
sandbox_enumerate(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
@ -3254,7 +2877,7 @@ static JSClass sandbox_class = {
|
||||
};
|
||||
|
||||
static JSObject *
|
||||
NewSandbox(JSContext *cx, bool lazy, bool split)
|
||||
NewSandbox(JSContext *cx, bool lazy)
|
||||
{
|
||||
JSObject *obj = JS_NewCompartmentAndGlobalObject(cx, &sandbox_class, NULL);
|
||||
if (!obj)
|
||||
@ -3265,20 +2888,12 @@ NewSandbox(JSContext *cx, bool lazy, bool split)
|
||||
if (!ac.enter(cx, obj))
|
||||
return NULL;
|
||||
|
||||
if (split) {
|
||||
obj = split_setup(cx, JS_TRUE);
|
||||
if (!obj)
|
||||
return NULL;
|
||||
}
|
||||
if (!lazy && !JS_InitStandardClasses(cx, obj))
|
||||
return NULL;
|
||||
|
||||
AutoValueRooter root(cx, BooleanValue(lazy));
|
||||
if (!JS_SetProperty(cx, obj, "lazy", root.jsval_addr()))
|
||||
return NULL;
|
||||
|
||||
if (split)
|
||||
obj = split_outerObject(cx, obj);
|
||||
}
|
||||
|
||||
AutoObjectRooter objroot(cx, obj);
|
||||
@ -3300,21 +2915,16 @@ EvalInContext(JSContext *cx, uintN argc, jsval *vp)
|
||||
if (!src)
|
||||
return false;
|
||||
|
||||
bool split = false, lazy = false;
|
||||
bool lazy = false;
|
||||
if (srclen == 4) {
|
||||
if (src[0] == 'l' && src[1] == 'a' && src[2] == 'z' && src[3] == 'y') {
|
||||
lazy = true;
|
||||
srclen = 0;
|
||||
}
|
||||
} else if (srclen == 5) {
|
||||
if (src[0] == 's' && src[1] == 'p' && src[2] == 'l' && src[3] == 'i' && src[4] == 't') {
|
||||
split = lazy = true;
|
||||
srclen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!sobj) {
|
||||
sobj = NewSandbox(cx, lazy, split);
|
||||
sobj = NewSandbox(cx, lazy);
|
||||
if (!sobj)
|
||||
return false;
|
||||
}
|
||||
@ -3747,7 +3357,7 @@ Scatter(JSContext *cx, uintN argc, jsval *vp)
|
||||
sd.threads[i].fn = JSVAL_NULL;
|
||||
|
||||
ok = JS_AddValueRoot(cx, &sd.threads[i].fn);
|
||||
if (ok && !JS_GetElement(cx, inArr, (jsint) i, &sd.threads[i].fn)) {
|
||||
if (ok && !JS_GetElement(cx, inArr, i, &sd.threads[i].fn)) {
|
||||
JS_RemoveValueRoot(cx, &sd.threads[i].fn);
|
||||
ok = JS_FALSE;
|
||||
}
|
||||
@ -4684,8 +4294,7 @@ static const char *const shell_help_messages[] = {
|
||||
"evalcx(s[, o])\n"
|
||||
" Evaluate s in optional sandbox object o\n"
|
||||
" if (s == '' && !o) return new o with eager standard classes\n"
|
||||
" if (s == 'lazy' && !o) return new o with lazy standard classes\n"
|
||||
" if (s == 'split' && !o) return new split-object o with lazy standard classes",
|
||||
" if (s == 'lazy' && !o) return new o with lazy standard classes",
|
||||
"evalInFrame(n,str,save) Evaluate 'str' in the nth up frame.\n"
|
||||
" If 'save' (default false), save the frame chain",
|
||||
"shapeOf(obj) Get the shape of obj (an implementation detail)",
|
||||
@ -4847,47 +4456,6 @@ Help(JSContext *cx, uintN argc, jsval *vp)
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
static JSObject *
|
||||
split_setup(JSContext *cx, JSBool evalcx)
|
||||
{
|
||||
JSObject *outer, *inner, *arguments;
|
||||
|
||||
outer = split_create_outer(cx);
|
||||
if (!outer)
|
||||
return NULL;
|
||||
AutoObjectRooter root(cx, outer);
|
||||
if (!evalcx)
|
||||
JS_SetGlobalObject(cx, outer);
|
||||
|
||||
inner = split_create_inner(cx, outer);
|
||||
if (!inner)
|
||||
return NULL;
|
||||
|
||||
if (!evalcx) {
|
||||
if (!JS_DefineFunctions(cx, inner, shell_functions) ||
|
||||
!JS_DefineProfilingFunctions(cx, inner)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Create a dummy arguments object. */
|
||||
arguments = JS_NewArrayObject(cx, 0, NULL);
|
||||
if (!arguments ||
|
||||
!JS_DefineProperty(cx, inner, "arguments", OBJECT_TO_JSVAL(arguments),
|
||||
NULL, NULL, 0)) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
JS_ClearScope(cx, outer);
|
||||
|
||||
#ifndef LAZY_STANDARD_CLASSES
|
||||
if (!JS_InitStandardClasses(cx, inner))
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
return inner;
|
||||
}
|
||||
|
||||
/*
|
||||
* Define a JS object called "it". Give it class operations that printf why
|
||||
* they're being called for tutorial purposes.
|
||||
|
@ -24,7 +24,7 @@ function test()
|
||||
|
||||
if ("evalcx" in this) {
|
||||
// shell
|
||||
let s = evalcx("split");
|
||||
let s = evalcx("lazy");
|
||||
s.n = 0;
|
||||
evalcx('this.watch("x", function(){ n++; }); this.x = 4; x = 6', s);
|
||||
actual = s.n;
|
||||
|
@ -75,8 +75,9 @@ script regress-601399.js
|
||||
script regress-602621.js
|
||||
fails-if(!xulRuntime.shell) script regress-607799.js
|
||||
fails-if(!xulRuntime.shell) script regress-607863.js
|
||||
script regress-610026.js
|
||||
script regress-609617.js
|
||||
script regress-610026.js
|
||||
script regress-614714.js
|
||||
script regress-617405-1.js
|
||||
script regress-617405-2.js
|
||||
script regress-618572.js
|
||||
@ -86,8 +87,8 @@ script regress-619003-1.js
|
||||
script regress-619003-2.js
|
||||
skip-if(Android) script regress-620376-1.js
|
||||
script regress-620376-2.js
|
||||
script regress-621814.js
|
||||
script regress-620750.js
|
||||
script regress-621814.js
|
||||
script regress-624199.js
|
||||
script regress-624547.js
|
||||
script regress-624968.js
|
||||
@ -101,14 +102,14 @@ script regress-635195.js
|
||||
script regress-636394.js
|
||||
script regress-636364.js
|
||||
script regress-640075.js
|
||||
script regress-643222.js
|
||||
script regress-646820-1.js
|
||||
script regress-646820-2.js
|
||||
script regress-646820-3.js
|
||||
script regress-643222.js
|
||||
script regress-614714.js
|
||||
script regress-665355.js
|
||||
script regress-667047.js
|
||||
script regress-666599.js
|
||||
script regress-667047.js
|
||||
script regress-673070-1.js
|
||||
script regress-673070-2.js
|
||||
script regress-673070-3.js
|
||||
script regress-675581.js
|
||||
|
7
js/src/tests/js1_8_5/regress/regress-675581.js
Normal file
@ -0,0 +1,7 @@
|
||||
// Any copyright is dedicated to the Public Domain.
|
||||
// http://creativecommons.org/licenses/publicdomain/
|
||||
|
||||
x=<x/>
|
||||
x.(-0 in x)
|
||||
|
||||
reportCompare(0, 0, 'ok');
|
@ -1,176 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Robert Sayre.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Flock Inc. <erwan@flock.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const HOURS_TO_MINUTES = 60;
|
||||
const MINUTES_TO_SECONDS = 60;
|
||||
const SECONDS_TO_MILLISECONDS = 1000;
|
||||
const MINUTES_TO_MILLISECONDS = MINUTES_TO_SECONDS * SECONDS_TO_MILLISECONDS;
|
||||
const HOURS_TO_MILLISECONDS = HOURS_TO_MINUTES * MINUTES_TO_MILLISECONDS;
|
||||
|
||||
var EXPORTED_SYMBOLS = ["ISO8601DateUtils"];
|
||||
|
||||
debug("*** loading ISO8601DateUtils\n");
|
||||
|
||||
var ISO8601DateUtils = {
|
||||
|
||||
/**
|
||||
* XXX Thunderbird's W3C-DTF function
|
||||
*
|
||||
* Converts a W3C-DTF (subset of ISO 8601) date string to a Javascript
|
||||
* date object. W3C-DTF is described in this note:
|
||||
* http://www.w3.org/TR/NOTE-datetime IETF is obtained via the Date
|
||||
* object's toUTCString() method. The object's toString() method is
|
||||
* insufficient because it spells out timezones on Win32
|
||||
* (f.e. "Pacific Standard Time" instead of "PST"), which Mail doesn't
|
||||
* grok. For info, see
|
||||
* http://lxr.mozilla.org/mozilla/source/js/src/jsdate.c#1526.
|
||||
*/
|
||||
parse: function ISO8601_parse(aDateString) {
|
||||
var dateString = aDateString;
|
||||
if (!dateString.match('-')) {
|
||||
// Workaround for server sending
|
||||
// dates such as: 20030530T11:18:50-08:00
|
||||
// instead of: 2003-05-30T11:18:50-08:00
|
||||
var year = dateString.slice(0, 4);
|
||||
var month = dateString.slice(4, 6);
|
||||
var rest = dateString.slice(6, dateString.length);
|
||||
dateString = year + "-" + month + "-" + rest;
|
||||
}
|
||||
|
||||
var parts = dateString.match(/(\d{4})(-(\d{2,3}))?(-(\d{2}))?(T(\d{2}):(\d{2})(:(\d{2})(\.(\d+))?)?(Z|([+-])(\d{2}):(\d{2}))?)?/);
|
||||
|
||||
// Here's an example of a W3C-DTF date string and what .match returns for it.
|
||||
//
|
||||
// date: 2003-05-30T11:18:50.345-08:00
|
||||
// date.match returns array values:
|
||||
//
|
||||
// 0: 2003-05-30T11:18:50-08:00,
|
||||
// 1: 2003,
|
||||
// 2: -05,
|
||||
// 3: 05,
|
||||
// 4: -30,
|
||||
// 5: 30,
|
||||
// 6: T11:18:50-08:00,
|
||||
// 7: 11,
|
||||
// 8: 18,
|
||||
// 9: :50,
|
||||
// 10: 50,
|
||||
// 11: .345,
|
||||
// 12: 345,
|
||||
// 13: -08:00,
|
||||
// 14: -,
|
||||
// 15: 08,
|
||||
// 16: 00
|
||||
|
||||
// Create a Date object from the date parts. Note that the Date
|
||||
// object apparently can't deal with empty string parameters in lieu
|
||||
// of numbers, so optional values (like hours, minutes, seconds, and
|
||||
// milliseconds) must be forced to be numbers.
|
||||
var date = new Date(parts[1], parts[3] - 1, parts[5], parts[7] || 0,
|
||||
parts[8] || 0, parts[10] || 0, parts[12] || 0);
|
||||
|
||||
// We now have a value that the Date object thinks is in the local
|
||||
// timezone but which actually represents the date/time in the
|
||||
// remote timezone (f.e. the value was "10:00 EST", and we have
|
||||
// converted it to "10:00 PST" instead of "07:00 PST"). We need to
|
||||
// correct that. To do so, we're going to add the offset between
|
||||
// the remote timezone and UTC (to convert the value to UTC), then
|
||||
// add the offset between UTC and the local timezone //(to convert
|
||||
// the value to the local timezone).
|
||||
|
||||
// Ironically, W3C-DTF gives us the offset between UTC and the
|
||||
// remote timezone rather than the other way around, while the
|
||||
// getTimezoneOffset() method of a Date object gives us the offset
|
||||
// between the local timezone and UTC rather than the other way
|
||||
// around. Both of these are the additive inverse (i.e. -x for x)
|
||||
// of what we want, so we have to invert them to use them by
|
||||
// multipying by -1 (f.e. if "the offset between UTC and the remote
|
||||
// timezone" is -5 hours, then "the offset between the remote
|
||||
// timezone and UTC" is -5*-1 = 5 hours).
|
||||
|
||||
// Note that if the timezone portion of the date/time string is
|
||||
// absent (which violates W3C-DTF, although ISO 8601 allows it), we
|
||||
// assume the value to be in UTC.
|
||||
|
||||
// The offset between the remote timezone and UTC in milliseconds.
|
||||
var remoteToUTCOffset = 0;
|
||||
if (parts[13] && parts[13] != "Z") {
|
||||
var direction = (parts[14] == "+" ? 1 : -1);
|
||||
if (parts[15])
|
||||
remoteToUTCOffset += direction * parts[15] * HOURS_TO_MILLISECONDS;
|
||||
if (parts[16])
|
||||
remoteToUTCOffset += direction * parts[16] * MINUTES_TO_MILLISECONDS;
|
||||
}
|
||||
remoteToUTCOffset = remoteToUTCOffset * -1; // invert it
|
||||
|
||||
// The offset between UTC and the local timezone in milliseconds.
|
||||
var UTCToLocalOffset = date.getTimezoneOffset() * MINUTES_TO_MILLISECONDS;
|
||||
UTCToLocalOffset = UTCToLocalOffset * -1; // invert it
|
||||
date.setTime(date.getTime() + remoteToUTCOffset + UTCToLocalOffset);
|
||||
|
||||
return date;
|
||||
},
|
||||
|
||||
create: function ISO8601_create(aDate) {
|
||||
function zeropad (s, l) {
|
||||
s = s.toString(); // force it to a string
|
||||
while (s.length < l) {
|
||||
s = '0' + s;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
var myDate;
|
||||
// if d is a number, turn it into a date
|
||||
if (typeof aDate == 'number') {
|
||||
myDate = new Date()
|
||||
myDate.setTime(aDate);
|
||||
} else {
|
||||
myDate = aDate;
|
||||
}
|
||||
|
||||
// YYYY-MM-DDThh:mm:ssZ
|
||||
var result = zeropad(myDate.getUTCFullYear (), 4) +
|
||||
zeropad(myDate.getUTCMonth () + 1, 2) +
|
||||
zeropad(myDate.getUTCDate (), 2) + 'T' +
|
||||
zeropad(myDate.getUTCHours (), 2) + ':' +
|
||||
zeropad(myDate.getUTCMinutes (), 2) + ':' +
|
||||
zeropad(myDate.getUTCSeconds (), 2) + 'Z';
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
@ -49,7 +49,7 @@ LOCAL_INCLUDES += -I$(srcdir)/../src
|
||||
|
||||
CPPSRCS = mozJSComponentLoader.cpp mozJSSubScriptLoader.cpp mozJSLoaderUtils.cpp
|
||||
|
||||
EXTRA_JS_MODULES = XPCOMUtils.jsm ISO8601DateUtils.jsm
|
||||
EXTRA_JS_MODULES = XPCOMUtils.jsm
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
@ -1152,7 +1152,7 @@ ProcessArgs(JSContext *cx, JSObject *obj, char **argv, int argc)
|
||||
{
|
||||
const char rcfilename[] = "xpcshell.js";
|
||||
FILE *rcfile;
|
||||
int i, j, length;
|
||||
int i;
|
||||
JSObject *argsObj;
|
||||
char *filename = NULL;
|
||||
JSBool isInteractive = JS_TRUE;
|
||||
@ -1198,8 +1198,7 @@ ProcessArgs(JSContext *cx, JSObject *obj, char **argv, int argc)
|
||||
return 1;
|
||||
}
|
||||
|
||||
length = argc - i;
|
||||
for (j = 0; j < length; j++) {
|
||||
for (size_t j = 0, length = argc - i; j < length; j++) {
|
||||
JSString *str = JS_NewStringCopyZ(cx, argv[i++]);
|
||||
if (!str)
|
||||
return 1;
|
||||
|
@ -1323,8 +1323,8 @@ CompartmentCallback(JSContext *cx, void *vdata, JSCompartment *compartment)
|
||||
// Append a new CompartmentStats to the vector.
|
||||
IterateData *data = static_cast<IterateData *>(vdata);
|
||||
CompartmentStats compartmentStats(cx, compartment);
|
||||
data->compartmentStatsVector.infallibleAppend(compartmentStats);
|
||||
CompartmentStats *curr = data->compartmentStatsVector.end() - 1;
|
||||
CompartmentStats *curr =
|
||||
data->compartmentStatsVector.AppendElement(compartmentStats);
|
||||
data->currCompartmentStats = curr;
|
||||
|
||||
// Get the compartment-level numbers.
|
||||
@ -1610,8 +1610,7 @@ CollectCompartmentStatsForRuntime(JSRuntime *rt, IterateData *data)
|
||||
{
|
||||
JSAutoRequest ar(cx);
|
||||
|
||||
if (!data->compartmentStatsVector.reserve(rt->compartments.length()))
|
||||
return false;
|
||||
data->compartmentStatsVector.SetCapacity(rt->compartments.length());
|
||||
|
||||
data->gcHeapChunkCleanUnused =
|
||||
PRInt64(JS_GetGCParameter(rt, JSGC_UNUSED_CHUNKS)) *
|
||||
@ -1635,17 +1634,19 @@ CollectCompartmentStatsForRuntime(JSRuntime *rt, IterateData *data)
|
||||
data->gcHeapChunkCleanUnused;
|
||||
data->gcHeapArenaUnused = 0;
|
||||
|
||||
for(CompartmentStats *stats = data->compartmentStatsVector.begin();
|
||||
stats != data->compartmentStatsVector.end();
|
||||
++stats)
|
||||
for(PRUint32 index = 0;
|
||||
index < data->compartmentStatsVector.Length();
|
||||
index++)
|
||||
{
|
||||
CompartmentStats &stats = data->compartmentStatsVector[index];
|
||||
|
||||
data->gcHeapChunkDirtyUnused -=
|
||||
stats->gcHeapArenaHeaders + stats->gcHeapArenaPadding +
|
||||
stats->gcHeapArenaUnused +
|
||||
stats->gcHeapObjects + stats->gcHeapStrings +
|
||||
stats->gcHeapShapes + stats->gcHeapXml;
|
||||
stats.gcHeapArenaHeaders + stats.gcHeapArenaPadding +
|
||||
stats.gcHeapArenaUnused +
|
||||
stats.gcHeapObjects + stats.gcHeapStrings +
|
||||
stats.gcHeapShapes + stats.gcHeapXml;
|
||||
|
||||
data->gcHeapArenaUnused += stats->gcHeapArenaUnused;
|
||||
data->gcHeapArenaUnused += stats.gcHeapArenaUnused;
|
||||
}
|
||||
|
||||
size_t numDirtyChunks = (data->gcHeapChunkTotal -
|
||||
@ -1808,11 +1809,12 @@ ReportJSRuntimeStats(const IterateData &data, const nsACString &pathPrefix,
|
||||
nsIMemoryMultiReporterCallback *callback,
|
||||
nsISupports *closure)
|
||||
{
|
||||
for(const CompartmentStats *stats = data.compartmentStatsVector.begin();
|
||||
stats != data.compartmentStatsVector.end();
|
||||
++stats)
|
||||
for(PRUint32 index = 0;
|
||||
index < data.compartmentStatsVector.Length();
|
||||
index++)
|
||||
{
|
||||
ReportCompartmentStats(*stats, pathPrefix, callback, closure);
|
||||
ReportCompartmentStats(data.compartmentStatsVector[index], pathPrefix,
|
||||
callback, closure);
|
||||
}
|
||||
|
||||
ReportMemoryBytes(pathPrefix + NS_LITERAL_CSTRING("stack"),
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
class nsIPrincipal;
|
||||
|
||||
@ -242,7 +243,7 @@ struct IterateData
|
||||
PRInt64 gcHeapChunkAdmin;
|
||||
PRInt64 gcHeapUnusedPercentage;
|
||||
|
||||
js::Vector<CompartmentStats, 0, js::SystemAllocPolicy> compartmentStatsVector;
|
||||
nsTArray<CompartmentStats> compartmentStatsVector;
|
||||
CompartmentStats *currCompartmentStats;
|
||||
};
|
||||
|
||||
|
@ -108,10 +108,12 @@ public:
|
||||
*/
|
||||
PRBool PrepareImage();
|
||||
/**
|
||||
* @return the image size in appunits. CSS gradient images don't have an
|
||||
* intrinsic size so we have to pass in a default that they will use.
|
||||
* @return the image size in appunits when rendered, after accounting for the
|
||||
* background positioning area, background-size, and the image's intrinsic
|
||||
* dimensions (if any).
|
||||
*/
|
||||
nsSize ComputeSize(const nsSize& aDefault);
|
||||
nsSize ComputeSize(const nsStyleBackground::Size& aLayerSize,
|
||||
const nsSize& aBgPositioningArea);
|
||||
/**
|
||||
* Draws the image to the target rendering context.
|
||||
* @see nsLayoutUtils::DrawImage() for other parameters
|
||||
@ -124,6 +126,29 @@ public:
|
||||
const nsRect& aDirty);
|
||||
|
||||
private:
|
||||
/*
|
||||
* Compute the "unscaled" dimensions of the image in aUnscaled{Width,Height}
|
||||
* and aRatio. Whether the image has a height and width are indicated by
|
||||
* aHaveWidth and aHaveHeight. If the image doesn't have a ratio, aRatio will
|
||||
* be (0, 0).
|
||||
*/
|
||||
void ComputeUnscaledDimensions(const nsSize& aBgPositioningArea,
|
||||
nscoord& aUnscaledWidth, bool& aHaveWidth,
|
||||
nscoord& aUnscaledHeight, bool& aHaveHeight,
|
||||
nsSize& aRatio);
|
||||
|
||||
/*
|
||||
* Using the previously-computed unscaled width and height (if each are
|
||||
* valid, as indicated by aHaveWidth/aHaveHeight), compute the size at which
|
||||
* the image should actually render.
|
||||
*/
|
||||
nsSize
|
||||
ComputeDrawnSize(const nsStyleBackground::Size& aLayerSize,
|
||||
const nsSize& aBgPositioningArea,
|
||||
nscoord aUnscaledWidth, bool aHaveWidth,
|
||||
nscoord aUnscaledHeight, bool aHaveHeight,
|
||||
const nsSize& aIntrinsicRatio);
|
||||
|
||||
nsIFrame* mForFrame;
|
||||
const nsStyleImage* mImage;
|
||||
nsStyleImageType mType;
|
||||
@ -132,7 +157,7 @@ private:
|
||||
nsIFrame* mPaintServerFrame;
|
||||
nsLayoutUtils::SurfaceFromElementResult mImageElementSurface;
|
||||
PRBool mIsReady;
|
||||
nsSize mSize;
|
||||
nsSize mSize; // unscaled size of the image, in app units
|
||||
PRUint32 mFlags;
|
||||
};
|
||||
|
||||
@ -2432,27 +2457,6 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
}
|
||||
}
|
||||
|
||||
static inline float
|
||||
ScaleDimension(const nsStyleBackground::Size::Dimension& aDimension,
|
||||
PRUint8 aType,
|
||||
nscoord aLength, nscoord aAvailLength)
|
||||
{
|
||||
switch (aType) {
|
||||
case nsStyleBackground::Size::eLengthPercentage:
|
||||
// negative values could result from calc()
|
||||
return NS_MAX(double(aDimension.mPercent) * double(aAvailLength) +
|
||||
double(aDimension.mLength),
|
||||
0.0) /
|
||||
double(aLength);
|
||||
default:
|
||||
NS_ABORT_IF_FALSE(PR_FALSE, "bad aDimension.mType");
|
||||
return 1.0f;
|
||||
case nsStyleBackground::Size::eAuto:
|
||||
NS_ABORT_IF_FALSE(PR_FALSE, "aDimension.mType == eAuto isn't handled");
|
||||
return 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
static inline PRBool
|
||||
IsTransformed(nsIFrame* aForFrame, nsIFrame* aTopFrame)
|
||||
{
|
||||
@ -2647,52 +2651,12 @@ PrepareBackgroundLayer(nsPresContext* aPresContext,
|
||||
}
|
||||
}
|
||||
|
||||
nsSize imageSize = state.mImageRenderer.ComputeSize(bgPositioningArea.Size());
|
||||
if (imageSize.width <= 0 || imageSize.height <= 0)
|
||||
return state;
|
||||
|
||||
// Scale the image as specified for background-size and as required for
|
||||
// proper background positioning when background-position is defined with
|
||||
// percentages.
|
||||
float scaleX, scaleY;
|
||||
switch (aLayer.mSize.mWidthType) {
|
||||
case nsStyleBackground::Size::eContain:
|
||||
case nsStyleBackground::Size::eCover: {
|
||||
float scaleFitX = double(bgPositioningArea.width) / imageSize.width;
|
||||
float scaleFitY = double(bgPositioningArea.height) / imageSize.height;
|
||||
if (aLayer.mSize.mWidthType == nsStyleBackground::Size::eCover) {
|
||||
scaleX = scaleY = NS_MAX(scaleFitX, scaleFitY);
|
||||
} else {
|
||||
scaleX = scaleY = NS_MIN(scaleFitX, scaleFitY);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
if (aLayer.mSize.mWidthType == nsStyleBackground::Size::eAuto) {
|
||||
if (aLayer.mSize.mHeightType == nsStyleBackground::Size::eAuto) {
|
||||
scaleX = scaleY = 1.0f;
|
||||
} else {
|
||||
scaleX = scaleY =
|
||||
ScaleDimension(aLayer.mSize.mHeight, aLayer.mSize.mHeightType,
|
||||
imageSize.height, bgPositioningArea.height);
|
||||
}
|
||||
} else {
|
||||
if (aLayer.mSize.mHeightType == nsStyleBackground::Size::eAuto) {
|
||||
scaleX = scaleY =
|
||||
ScaleDimension(aLayer.mSize.mWidth, aLayer.mSize.mWidthType,
|
||||
imageSize.width, bgPositioningArea.width);
|
||||
} else {
|
||||
scaleX = ScaleDimension(aLayer.mSize.mWidth, aLayer.mSize.mWidthType,
|
||||
imageSize.width, bgPositioningArea.width);
|
||||
scaleY = ScaleDimension(aLayer.mSize.mHeight, aLayer.mSize.mHeightType,
|
||||
imageSize.height, bgPositioningArea.height);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
imageSize.width = NSCoordSaturatingNonnegativeMultiply(imageSize.width, scaleX);
|
||||
imageSize.height = NSCoordSaturatingNonnegativeMultiply(imageSize.height, scaleY);
|
||||
nsSize imageSize = state.mImageRenderer.ComputeSize(aLayer.mSize, bgPositioningArea.Size());
|
||||
if (imageSize.width <= 0 || imageSize.height <= 0)
|
||||
return state;
|
||||
|
||||
// Compute the position of the background now that the background's size is
|
||||
// determined.
|
||||
@ -3861,8 +3825,33 @@ ImageRenderer::PrepareImage()
|
||||
return mIsReady;
|
||||
}
|
||||
|
||||
nsSize
|
||||
ImageRenderer::ComputeSize(const nsSize& aDefault)
|
||||
enum FitType { CONTAIN, COVER };
|
||||
|
||||
static nsSize
|
||||
ComputeContainCoverSizeFromRatio(const nsSize& aBgPositioningArea,
|
||||
const nsSize& aRatio, FitType fitType)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(aRatio.width > 0, "width division by zero");
|
||||
NS_ABORT_IF_FALSE(aRatio.height > 0, "height division by zero");
|
||||
|
||||
float scaleX = double(aBgPositioningArea.width) / aRatio.width;
|
||||
float scaleY = double(aBgPositioningArea.height) / aRatio.height;
|
||||
nsSize size;
|
||||
if ((fitType == CONTAIN) == (scaleX < scaleY)) {
|
||||
size.width = aBgPositioningArea.width;
|
||||
size.height = NSCoordSaturatingNonnegativeMultiply(aRatio.height, scaleX);
|
||||
} else {
|
||||
size.width = NSCoordSaturatingNonnegativeMultiply(aRatio.width, scaleY);
|
||||
size.height = aBgPositioningArea.height;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
void
|
||||
ImageRenderer::ComputeUnscaledDimensions(const nsSize& aBgPositioningArea,
|
||||
nscoord& aUnscaledWidth, bool& aHaveWidth,
|
||||
nscoord& aUnscaledHeight, bool& aHaveHeight,
|
||||
nsSize& aRatio)
|
||||
{
|
||||
NS_ASSERTION(mIsReady, "Ensure PrepareImage() has returned true "
|
||||
"before calling me");
|
||||
@ -3871,28 +3860,35 @@ ImageRenderer::ComputeSize(const nsSize& aDefault)
|
||||
case eStyleImageType_Image:
|
||||
{
|
||||
nsIntSize imageIntSize;
|
||||
PRBool gotHeight, gotWidth;
|
||||
nsLayoutUtils::ComputeSizeForDrawing(mImageContainer, imageIntSize,
|
||||
gotWidth, gotHeight);
|
||||
|
||||
mSize.width = gotWidth ?
|
||||
nsPresContext::CSSPixelsToAppUnits(imageIntSize.width) :
|
||||
aDefault.width;
|
||||
|
||||
mSize.height = gotHeight ?
|
||||
nsPresContext::CSSPixelsToAppUnits(imageIntSize.height) :
|
||||
aDefault.height;
|
||||
|
||||
break;
|
||||
aRatio, aHaveWidth, aHaveHeight);
|
||||
if (aHaveWidth) {
|
||||
aUnscaledWidth = nsPresContext::CSSPixelsToAppUnits(imageIntSize.width);
|
||||
}
|
||||
if (aHaveHeight) {
|
||||
aUnscaledHeight = nsPresContext::CSSPixelsToAppUnits(imageIntSize.height);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case eStyleImageType_Gradient:
|
||||
mSize = aDefault;
|
||||
break;
|
||||
// Per <http://dev.w3.org/csswg/css3-images/#gradients>, gradients have no
|
||||
// intrinsic dimensions.
|
||||
aHaveWidth = aHaveHeight = false;
|
||||
aRatio = nsSize(0, 0);
|
||||
return;
|
||||
case eStyleImageType_Element:
|
||||
{
|
||||
// XXX element() should have the width/height of the referenced element,
|
||||
// and that element's ratio, if it matches. If it doesn't match, it
|
||||
// should have no width/height or ratio. See element() in CSS3:
|
||||
// <http://dev.w3.org/csswg/css3-images/#element-reference>.
|
||||
// Make sure to change nsStyleBackground::Size::DependsOnFrameSize
|
||||
// when fixing this!
|
||||
aHaveWidth = aHaveHeight = true;
|
||||
nsSize size;
|
||||
if (mPaintServerFrame) {
|
||||
if (mPaintServerFrame->IsFrameOfType(nsIFrame::eSVG)) {
|
||||
mSize = aDefault;
|
||||
size = aBgPositioningArea;
|
||||
} else {
|
||||
// The intrinsic image size for a generic nsIFrame paint server is
|
||||
// the frame's bbox size rounded to device pixels.
|
||||
@ -3900,25 +3896,216 @@ ImageRenderer::ComputeSize(const nsSize& aDefault)
|
||||
mForFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
nsRect rect =
|
||||
nsSVGIntegrationUtils::GetNonSVGUserSpace(mPaintServerFrame);
|
||||
nsRect size = rect - rect.TopLeft();
|
||||
nsIntRect rounded = size.ToNearestPixels(appUnitsPerDevPixel);
|
||||
mSize = rounded.ToAppUnits(appUnitsPerDevPixel).Size();
|
||||
nsRect rectSize = rect - rect.TopLeft();
|
||||
nsIntRect rounded = rectSize.ToNearestPixels(appUnitsPerDevPixel);
|
||||
size = rounded.ToAppUnits(appUnitsPerDevPixel).Size();
|
||||
}
|
||||
} else {
|
||||
NS_ASSERTION(mImageElementSurface.mSurface, "Surface should be ready.");
|
||||
gfxIntSize size = mImageElementSurface.mSize;
|
||||
mSize.width = nsPresContext::CSSPixelsToAppUnits(size.width);
|
||||
mSize.height = nsPresContext::CSSPixelsToAppUnits(size.height);
|
||||
gfxIntSize surfaceSize = mImageElementSurface.mSize;
|
||||
size.width = nsPresContext::CSSPixelsToAppUnits(surfaceSize.width);
|
||||
size.height = nsPresContext::CSSPixelsToAppUnits(surfaceSize.height);
|
||||
}
|
||||
break;
|
||||
aRatio = size;
|
||||
aUnscaledWidth = size.width;
|
||||
aUnscaledHeight = size.height;
|
||||
return;
|
||||
}
|
||||
case eStyleImageType_Null:
|
||||
default:
|
||||
mSize.SizeTo(0, 0);
|
||||
break;
|
||||
aHaveWidth = aHaveHeight = true;
|
||||
aUnscaledWidth = aUnscaledHeight = 0;
|
||||
aRatio = nsSize(0, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nsSize
|
||||
ImageRenderer::ComputeDrawnSize(const nsStyleBackground::Size& aLayerSize,
|
||||
const nsSize& aBgPositioningArea,
|
||||
nscoord aUnscaledWidth, bool aHaveWidth,
|
||||
nscoord aUnscaledHeight, bool aHaveHeight,
|
||||
const nsSize& aIntrinsicRatio)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(aIntrinsicRatio.width >= 0,
|
||||
"image ratio with nonsense width");
|
||||
NS_ABORT_IF_FALSE(aIntrinsicRatio.height >= 0,
|
||||
"image ratio with nonsense height");
|
||||
|
||||
// Bail early if the image is empty.
|
||||
if ((aHaveWidth && aUnscaledWidth <= 0) ||
|
||||
(aHaveHeight && aUnscaledHeight <= 0)) {
|
||||
return nsSize(0, 0);
|
||||
}
|
||||
|
||||
return mSize;
|
||||
// If the image has an intrinsic ratio but either component of it is zero,
|
||||
// then the image would eventually scale to nothingness, so again we can bail.
|
||||
bool haveRatio = aIntrinsicRatio != nsSize(0, 0);
|
||||
if (haveRatio &&
|
||||
(aIntrinsicRatio.width == 0 || aIntrinsicRatio.height == 0)) {
|
||||
return nsSize(0, 0);
|
||||
}
|
||||
|
||||
// Easiest case: background-size completely specifies the size.
|
||||
if (aLayerSize.mWidthType == nsStyleBackground::Size::eLengthPercentage &&
|
||||
aLayerSize.mHeightType == nsStyleBackground::Size::eLengthPercentage) {
|
||||
return nsSize(aLayerSize.ResolveWidthLengthPercentage(aBgPositioningArea),
|
||||
aLayerSize.ResolveHeightLengthPercentage(aBgPositioningArea));
|
||||
}
|
||||
|
||||
// The harder cases: contain/cover.
|
||||
if (aLayerSize.mWidthType == nsStyleBackground::Size::eContain ||
|
||||
aLayerSize.mWidthType == nsStyleBackground::Size::eCover) {
|
||||
FitType fitType = aLayerSize.mWidthType == nsStyleBackground::Size::eCover
|
||||
? COVER
|
||||
: CONTAIN;
|
||||
if (!haveRatio) {
|
||||
// If we don't have an intrinsic ratio, then proportionally scaling to
|
||||
// either largest-fitting or smallest-covering size means scaling to the
|
||||
// background positioning area's size.
|
||||
return aBgPositioningArea;
|
||||
}
|
||||
|
||||
return ComputeContainCoverSizeFromRatio(aBgPositioningArea, aIntrinsicRatio,
|
||||
fitType);
|
||||
}
|
||||
|
||||
// Harder case: all-auto.
|
||||
if (aLayerSize.mWidthType == nsStyleBackground::Size::eAuto &&
|
||||
aLayerSize.mHeightType == nsStyleBackground::Size::eAuto) {
|
||||
// If the image has all its dimensions, we're done.
|
||||
if (aHaveWidth && aHaveHeight)
|
||||
return nsSize(aUnscaledWidth, aUnscaledHeight);
|
||||
|
||||
// If the image has no dimensions, treat it as if for contain.
|
||||
if (!aHaveWidth && !aHaveHeight) {
|
||||
if (!haveRatio) {
|
||||
// As above, max-contain without a ratio means the whole area.
|
||||
return aBgPositioningArea;
|
||||
}
|
||||
|
||||
// Otherwise determine size using the intrinsic ratio.
|
||||
return ComputeContainCoverSizeFromRatio(aBgPositioningArea,
|
||||
aIntrinsicRatio, CONTAIN);
|
||||
}
|
||||
|
||||
NS_ABORT_IF_FALSE(aHaveWidth != aHaveHeight, "logic error");
|
||||
|
||||
if (haveRatio) {
|
||||
// Resolve missing dimensions using the intrinsic ratio.
|
||||
nsSize size;
|
||||
if (aHaveWidth) {
|
||||
size.width = aUnscaledWidth;
|
||||
size.height =
|
||||
NSCoordSaturatingNonnegativeMultiply(size.width,
|
||||
double(aIntrinsicRatio.height) /
|
||||
aIntrinsicRatio.width);
|
||||
} else {
|
||||
size.height = aUnscaledHeight;
|
||||
size.width =
|
||||
NSCoordSaturatingNonnegativeMultiply(size.height,
|
||||
double(aIntrinsicRatio.width) /
|
||||
aIntrinsicRatio.height);
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
// Without a ratio we must fall back to the relevant dimension of the
|
||||
// area to determine the missing dimension.
|
||||
return aHaveWidth ? nsSize(aUnscaledWidth, aBgPositioningArea.height)
|
||||
: nsSize(aBgPositioningArea.width, aUnscaledHeight);
|
||||
}
|
||||
|
||||
// Hardest case: only one auto. Prepare to negotiate amongst intrinsic
|
||||
// dimensions, intrinsic ratio, *and* a specific background-size!
|
||||
NS_ABORT_IF_FALSE((aLayerSize.mWidthType == nsStyleBackground::Size::eAuto) !=
|
||||
(aLayerSize.mHeightType == nsStyleBackground::Size::eAuto),
|
||||
"logic error");
|
||||
|
||||
bool isAutoWidth = aLayerSize.mWidthType == nsStyleBackground::Size::eAuto;
|
||||
|
||||
if (haveRatio) {
|
||||
// Use the specified dimension, and compute the other from the ratio.
|
||||
NS_ABORT_IF_FALSE(aIntrinsicRatio.width > 0,
|
||||
"ratio width out of sync with width?");
|
||||
NS_ABORT_IF_FALSE(aIntrinsicRatio.height > 0,
|
||||
"ratio height out of sync with width?");
|
||||
nsSize size;
|
||||
if (isAutoWidth) {
|
||||
size.height = aLayerSize.ResolveHeightLengthPercentage(aBgPositioningArea);
|
||||
size.width =
|
||||
NSCoordSaturatingNonnegativeMultiply(size.height,
|
||||
double(aIntrinsicRatio.width) /
|
||||
aIntrinsicRatio.height);
|
||||
} else {
|
||||
size.width = aLayerSize.ResolveWidthLengthPercentage(aBgPositioningArea);
|
||||
size.height =
|
||||
NSCoordSaturatingNonnegativeMultiply(size.width,
|
||||
double(aIntrinsicRatio.height) /
|
||||
aIntrinsicRatio.width);
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
NS_ABORT_IF_FALSE(!(aHaveWidth && aHaveHeight),
|
||||
"if we have width and height, we must have had a ratio");
|
||||
|
||||
// We have a specified dimension and an auto dimension, with no ratio to
|
||||
// preserve. A specified dimension trumps all, so use that. For the other
|
||||
// dimension, resolve auto to the intrinsic dimension (if present) or to 100%.
|
||||
nsSize size;
|
||||
if (isAutoWidth) {
|
||||
size.width = aHaveWidth ? aUnscaledWidth : aBgPositioningArea.width;
|
||||
size.height = aLayerSize.ResolveHeightLengthPercentage(aBgPositioningArea);
|
||||
} else {
|
||||
size.width = aLayerSize.ResolveWidthLengthPercentage(aBgPositioningArea);
|
||||
size.height = aHaveHeight ? aUnscaledHeight : aBgPositioningArea.height;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*
|
||||
* The size returned by this method differs from the value of mSize, which this
|
||||
* method also computes, in that mSize is the image's "preferred" size for this
|
||||
* particular rendering, while the size returned here is the actual rendered
|
||||
* size after accounting for background-size. The preferred size is most often
|
||||
* the image's intrinsic dimensions. But for images with incomplete intrinsic
|
||||
* dimensions, the preferred size varies, depending on the background
|
||||
* positioning area, the specified background-size, and the intrinsic ratio and
|
||||
* dimensions of the image (if it has them).
|
||||
*
|
||||
* This distinction is necessary because the components of a vector image are
|
||||
* specified with respect to its preferred size for a rendering situation, not
|
||||
* to its actual rendered size after background-size is applied. For example,
|
||||
* consider a 4px wide vector image with no height which contains a left-aligned
|
||||
* 2px wide black rectangle with height 100%. If the background-size width is
|
||||
* auto (or 4px), the vector image will render 4px wide, and the black rectangle
|
||||
* will be 2px wide. If the background-size width is 8px, the vector image will
|
||||
* render 8px wide, and the black rectangle will be 4px wide -- *not* 2px wide.
|
||||
* In both cases mSize.width will be 4px; but in the first case the returned
|
||||
* width will be 4px, while in the second case the returned width will be 8px.
|
||||
*/
|
||||
nsSize
|
||||
ImageRenderer::ComputeSize(const nsStyleBackground::Size& aLayerSize,
|
||||
const nsSize& aBgPositioningArea)
|
||||
{
|
||||
bool haveWidth, haveHeight;
|
||||
nsSize ratio;
|
||||
nscoord unscaledWidth, unscaledHeight;
|
||||
ComputeUnscaledDimensions(aBgPositioningArea,
|
||||
unscaledWidth, haveWidth,
|
||||
unscaledHeight, haveHeight,
|
||||
ratio);
|
||||
nsSize drawnSize = ComputeDrawnSize(aLayerSize, aBgPositioningArea,
|
||||
unscaledWidth, haveWidth,
|
||||
unscaledHeight, haveHeight,
|
||||
ratio);
|
||||
mSize.width = haveWidth ? unscaledWidth : drawnSize.width;
|
||||
mSize.height = haveHeight ? unscaledHeight : drawnSize.height;
|
||||
return drawnSize;
|
||||
}
|
||||
|
||||
void
|
||||
@ -3947,7 +4134,9 @@ ImageRenderer::Draw(nsPresContext* aPresContext,
|
||||
PRUint32 drawFlags = (mFlags & FLAG_SYNC_DECODE_IMAGES)
|
||||
? (PRUint32) imgIContainer::FLAG_SYNC_DECODE
|
||||
: (PRUint32) imgIContainer::FLAG_NONE;
|
||||
nsLayoutUtils::DrawImage(&aRenderingContext, mImageContainer,
|
||||
nsLayoutUtils::DrawBackgroundImage(&aRenderingContext, mImageContainer,
|
||||
nsIntSize(nsPresContext::AppUnitsToIntCSSPixels(mSize.width),
|
||||
nsPresContext::AppUnitsToIntCSSPixels(mSize.height)),
|
||||
graphicsFilter,
|
||||
aDest, aFill, aAnchor, aDirty, drawFlags);
|
||||
break;
|
||||
|
@ -1023,12 +1023,15 @@ nsDisplayBackground::HitTest(nsDisplayListBuilder* aBuilder,
|
||||
HitTestState* aState,
|
||||
nsTArray<nsIFrame*> *aOutFrames)
|
||||
{
|
||||
// For theme backgrounds, assume that any point in our bounds is a hit.
|
||||
// We don't know the true hit region of the theme background.
|
||||
if (!mIsThemed &&
|
||||
!RoundedBorderIntersectsRect(mFrame, ToReferenceFrame(), aRect)) {
|
||||
// aRect doesn't intersect our border-radius curve.
|
||||
return;
|
||||
if (mIsThemed) {
|
||||
// For theme backgrounds, assume that any point in our border rect is a hit.
|
||||
if (!nsRect(ToReferenceFrame(), mFrame->GetSize()).Intersects(aRect))
|
||||
return;
|
||||
} else {
|
||||
if (!RoundedBorderIntersectsRect(mFrame, ToReferenceFrame(), aRect)) {
|
||||
// aRect doesn't intersect our border-radius curve.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
aOutFrames->AppendElement(mFrame);
|
||||
|
@ -3569,46 +3569,47 @@ nsLayoutUtils::DrawSingleImage(nsRenderingContext* aRenderingContext,
|
||||
/* static */ void
|
||||
nsLayoutUtils::ComputeSizeForDrawing(imgIContainer *aImage,
|
||||
nsIntSize& aImageSize, /*outparam*/
|
||||
PRBool& aGotWidth, /*outparam*/
|
||||
PRBool& aGotHeight /*outparam*/)
|
||||
nsSize& aIntrinsicRatio, /*outparam*/
|
||||
bool& aGotWidth, /*outparam*/
|
||||
bool& aGotHeight /*outparam*/)
|
||||
{
|
||||
aGotWidth = NS_SUCCEEDED(aImage->GetWidth(&aImageSize.width));
|
||||
aGotHeight = NS_SUCCEEDED(aImage->GetHeight(&aImageSize.height));
|
||||
|
||||
if ((aGotWidth && aGotHeight) || // Trivial success!
|
||||
(!aGotWidth && !aGotHeight)) { // Trivial failure!
|
||||
if (aGotWidth && aGotHeight) {
|
||||
aIntrinsicRatio = nsSize(aImageSize.width, aImageSize.height);
|
||||
return;
|
||||
}
|
||||
|
||||
// If we get here, we succeeded at querying *either* the width *or* the
|
||||
// height, but not both.
|
||||
NS_ASSERTION(aImage->GetType() == imgIContainer::TYPE_VECTOR,
|
||||
"GetWidth and GetHeight should only fail for vector images");
|
||||
|
||||
nsIFrame* rootFrame = aImage->GetRootLayoutFrame();
|
||||
NS_ASSERTION(rootFrame,
|
||||
"We should have a VectorImage, which should have a rootFrame");
|
||||
|
||||
// This falls back on failure, if we somehow end up without a rootFrame.
|
||||
nsSize ratio = rootFrame ? rootFrame->GetIntrinsicRatio() : nsSize(0,0);
|
||||
if (!aGotWidth) { // Have height, missing width
|
||||
if (ratio.height != 0) { // don't divide by zero
|
||||
aImageSize.width = NSToCoordRound(aImageSize.height *
|
||||
float(ratio.width) /
|
||||
float(ratio.height));
|
||||
aGotWidth = PR_TRUE;
|
||||
}
|
||||
} else { // Have width, missing height
|
||||
if (ratio.width != 0) { // don't divide by zero
|
||||
aImageSize.height = NSToCoordRound(aImageSize.width *
|
||||
float(ratio.height) /
|
||||
float(ratio.width));
|
||||
aGotHeight = PR_TRUE;
|
||||
}
|
||||
// If we failed to get width or height, we either have a vector image and
|
||||
// should return its intrinsic ratio, or we hit an error (say, because the
|
||||
// image failed to load or couldn't be decoded) and should return zero size.
|
||||
if (nsIFrame* rootFrame = aImage->GetRootLayoutFrame()) {
|
||||
aIntrinsicRatio = rootFrame->GetIntrinsicRatio();
|
||||
} else {
|
||||
aGotWidth = aGotHeight = true;
|
||||
aImageSize = nsIntSize(0, 0);
|
||||
aIntrinsicRatio = nsSize(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* static */ nsresult
|
||||
nsLayoutUtils::DrawBackgroundImage(nsRenderingContext* aRenderingContext,
|
||||
imgIContainer* aImage,
|
||||
const nsIntSize& aImageSize,
|
||||
GraphicsFilter aGraphicsFilter,
|
||||
const nsRect& aDest,
|
||||
const nsRect& aFill,
|
||||
const nsPoint& aAnchor,
|
||||
const nsRect& aDirty,
|
||||
PRUint32 aImageFlags)
|
||||
{
|
||||
return DrawImageInternal(aRenderingContext, aImage, aGraphicsFilter,
|
||||
aDest, aFill, aAnchor, aDirty,
|
||||
aImageSize, aImageFlags);
|
||||
}
|
||||
|
||||
/* static */ nsresult
|
||||
nsLayoutUtils::DrawImage(nsRenderingContext* aRenderingContext,
|
||||
imgIContainer* aImage,
|
||||
@ -3620,10 +3621,32 @@ nsLayoutUtils::DrawImage(nsRenderingContext* aRenderingContext,
|
||||
PRUint32 aImageFlags)
|
||||
{
|
||||
nsIntSize imageSize;
|
||||
PRBool gotHeight, gotWidth;
|
||||
ComputeSizeForDrawing(aImage, imageSize, gotWidth, gotHeight);
|
||||
nsSize imageRatio;
|
||||
bool gotHeight, gotWidth;
|
||||
ComputeSizeForDrawing(aImage, imageSize, imageRatio, gotWidth, gotHeight);
|
||||
|
||||
// XXX Dimensionless images shouldn't fall back to filled-area size -- the
|
||||
// caller should provide the image size, a la DrawBackgroundImage.
|
||||
if (gotWidth != gotHeight) {
|
||||
if (!gotWidth) {
|
||||
if (imageRatio.height != 0) {
|
||||
imageSize.width =
|
||||
NSCoordSaturatingNonnegativeMultiply(imageSize.height,
|
||||
float(imageRatio.width) /
|
||||
float(imageRatio.height));
|
||||
gotWidth = true;
|
||||
}
|
||||
} else {
|
||||
if (imageRatio.width != 0) {
|
||||
imageSize.height =
|
||||
NSCoordSaturatingNonnegativeMultiply(imageSize.width,
|
||||
float(imageRatio.height) /
|
||||
float(imageRatio.width));
|
||||
gotHeight = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fallback size based on aFill.
|
||||
if (!gotWidth) {
|
||||
imageSize.width = nsPresContext::AppUnitsToIntCSSPixels(aFill.width);
|
||||
}
|
||||
|
@ -1048,6 +1048,38 @@ public:
|
||||
* functions below is the type of the aImage argument.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Draw a background image. The image's dimensions are as specified in aDest;
|
||||
* the image itself is not consulted to determine a size.
|
||||
* See https://wiki.mozilla.org/Gecko:Image_Snapping_and_Rendering
|
||||
* @param aRenderingContext Where to draw the image, set up with an
|
||||
* appropriate scale and transform for drawing in
|
||||
* app units.
|
||||
* @param aImage The image.
|
||||
* @param aImageSize The unscaled size of the image being drawn.
|
||||
* (This might be the image's size if no scaling
|
||||
* occurs, or it might be the image's size if
|
||||
* the image is a vector image being rendered at
|
||||
* that size.)
|
||||
* @param aDest The position and scaled area where one copy of
|
||||
* the image should be drawn.
|
||||
* @param aFill The area to be filled with copies of the
|
||||
* image.
|
||||
* @param aAnchor A point in aFill which we will ensure is
|
||||
* pixel-aligned in the output.
|
||||
* @param aDirty Pixels outside this area may be skipped.
|
||||
* @param aImageFlags Image flags of the imgIContainer::FLAG_* variety
|
||||
*/
|
||||
static nsresult DrawBackgroundImage(nsRenderingContext* aRenderingContext,
|
||||
imgIContainer* aImage,
|
||||
const nsIntSize& aImageSize,
|
||||
GraphicsFilter aGraphicsFilter,
|
||||
const nsRect& aDest,
|
||||
const nsRect& aFill,
|
||||
const nsPoint& aAnchor,
|
||||
const nsRect& aDirty,
|
||||
PRUint32 aImageFlags);
|
||||
|
||||
/**
|
||||
* Draw an image.
|
||||
* See https://wiki.mozilla.org/Gecko:Image_Snapping_and_Rendering
|
||||
@ -1152,7 +1184,9 @@ public:
|
||||
* Given an imgIContainer, this method attempts to obtain an intrinsic
|
||||
* px-valued height & width for it. If the imgIContainer has a non-pixel
|
||||
* value for either height or width, this method tries to generate a pixel
|
||||
* value for that dimension using the intrinsic ratio (if available).
|
||||
* value for that dimension using the intrinsic ratio (if available). The
|
||||
* intrinsic ratio will be assigned to aIntrinsicRatio; if there's no
|
||||
* intrinsic ratio then (0, 0) will be assigned.
|
||||
*
|
||||
* This method will always set aGotWidth and aGotHeight to indicate whether
|
||||
* we were able to successfully obtain (or compute) a value for each
|
||||
@ -1164,8 +1198,9 @@ public:
|
||||
*/
|
||||
static void ComputeSizeForDrawing(imgIContainer* aImage,
|
||||
nsIntSize& aImageSize,
|
||||
PRBool& aGotWidth,
|
||||
PRBool& aGotHeight);
|
||||
nsSize& aIntrinsicRatio,
|
||||
bool& aGotWidth,
|
||||
bool& aGotHeight);
|
||||
|
||||
/**
|
||||
* Given a source area of an image (in appunits) and a destination area
|
||||
|
@ -97,6 +97,7 @@ static const char* const gHTMLTypes[] = {
|
||||
APPLICATION_JAVASCRIPT,
|
||||
APPLICATION_ECMASCRIPT,
|
||||
APPLICATION_XJAVASCRIPT,
|
||||
APPLICATION_JSON,
|
||||
VIEWSOURCE_CONTENT_TYPE,
|
||||
APPLICATION_XHTML_XML,
|
||||
0
|
||||
|
@ -107,6 +107,7 @@ NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
|
||||
{ "Gecko-Content-Viewers", APPLICATION_JAVASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
|
||||
{ "Gecko-Content-Viewers", APPLICATION_ECMASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
|
||||
{ "Gecko-Content-Viewers", APPLICATION_XJAVASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
|
||||
{ "Gecko-Content-Viewers", APPLICATION_JSON, "@mozilla.org/content/document-loader-factory;1" }, \
|
||||
{ "Gecko-Content-Viewers", APPLICATION_XHTML_XML, "@mozilla.org/content/document-loader-factory;1" }, \
|
||||
{ "Gecko-Content-Viewers", TEXT_XML, "@mozilla.org/content/document-loader-factory;1" }, \
|
||||
{ "Gecko-Content-Viewers", APPLICATION_XML, "@mozilla.org/content/document-loader-factory;1" }, \
|
||||
|
@ -89,7 +89,6 @@
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMNSUIEvent.h"
|
||||
|
||||
#include "nsIDOMFocusListener.h" //onchange events
|
||||
#include "nsIDOMCharacterData.h" //for selection setting helper func
|
||||
#include "nsIDOMNodeList.h" //for selection setting helper func
|
||||
#include "nsIDOMRange.h" //for selection setting helper func
|
||||
@ -105,7 +104,6 @@
|
||||
#include "nsIDOMText.h" //for multiline getselection
|
||||
#include "nsNodeInfoManager.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsIDOMKeyListener.h"
|
||||
#include "nsINativeKeyBindings.h"
|
||||
#include "nsIJSContextStack.h"
|
||||
#include "nsFocusManager.h"
|
||||
|
@ -55,7 +55,7 @@
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsIView.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsIDOMKeyListener.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIDOMDragEvent.h"
|
||||
#include "nsPluginHost.h"
|
||||
#include "nsString.h"
|
||||
@ -84,10 +84,6 @@
|
||||
#include "nsIDOMHTMLEmbedElement.h"
|
||||
#include "nsIDOMHTMLAppletElement.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMMouseListener.h"
|
||||
#include "nsIDOMMouseMotionListener.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
#include "nsIDOMContextMenuListener.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
|
@ -101,7 +101,6 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro
|
||||
|
||||
// Focus
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
#include "nsISelectionController.h"
|
||||
|
||||
// Misc
|
||||
|
1
layout/reftests/backgrounds/gradient/reftest.list
Normal file
@ -0,0 +1 @@
|
||||
== scaled-color-stop-position.html scaled-color-stop-position-ref.html
|
@ -0,0 +1,27 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Color stop positioning for scaled gradients as backgrounds reference</title>
|
||||
<style type="text/css">
|
||||
#outer
|
||||
{
|
||||
border: 1px solid black;
|
||||
width: 600px; height: 300px;
|
||||
}
|
||||
#inner
|
||||
{
|
||||
width: 400px; height: 300px;
|
||||
/* 250px stop is halfway along 500px diagonal */
|
||||
background-image: -moz-linear-gradient(top left, lime 0%, teal 250px, black 100%);
|
||||
background-image: linear-gradient(top left, lime 0%, teal 250px, black 100%);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="outer"><div id="inner"></div></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,25 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Color stop positioning for scaled gradients as backgrounds</title>
|
||||
<style type="text/css">
|
||||
#outer
|
||||
{
|
||||
border: 1px solid black;
|
||||
width: 600px; height: 300px;
|
||||
/* 250px stop is halfway along 500px diagonal */
|
||||
background-image: -moz-linear-gradient(top left, lime 0%, teal 250px, black 100%);
|
||||
background-image: linear-gradient(top left, lime 0%, teal 250px, black 100%);
|
||||
background-size: 400px auto;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="outer"></div>
|
||||
</body>
|
||||
</html>
|
@ -1,8 +0,0 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<title>Image with no intrinsic size</title>
|
||||
<rect width="100%" height="100%" fill="lime"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 261 B |
@ -1,3 +1,6 @@
|
||||
include gradient/reftest.list
|
||||
include vector/reftest.list
|
||||
|
||||
== layers-stacking-order.xhtml layers-stacking-order-ref.xhtml
|
||||
== layers-layer-count-cascade-1.xhtml layers-layer-count-1-ref.xhtml
|
||||
== layers-layer-count-inheritance-1.xhtml layers-layer-count-1-ref.xhtml
|
||||
@ -101,13 +104,6 @@ fails-if(Android) == viewport-translucent-color-3.html viewport-translucent-colo
|
||||
# doesn't sample too far astray from the boundaries).
|
||||
fails == background-size-zoom-repeat.html background-size-zoom-repeat-ref.html
|
||||
|
||||
# background-size affects images without intrinsic dimensions specially; we may
|
||||
# not support such image formats right now, but when we do, we want
|
||||
# background-size to be changed accordingly, and hopefully these tests should
|
||||
# start failing when we do.
|
||||
fails == background-size-no-intrinsic-width-image.html background-size-no-intrinsic-width-image-ref.html
|
||||
fails == background-size-no-intrinsic-height-image.html background-size-no-intrinsic-height-image-ref.html
|
||||
|
||||
# -moz-default-background-color and -moz-default-color (bug 591341)
|
||||
== background-moz-default-background-color.html background-moz-default-background-color-ref.html
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Scaled vector image without intrinsic dimensions as background, with rendering dependent on the diagonal</title>
|
||||
<style type="text/css">
|
||||
#outer
|
||||
{
|
||||
width: 256px; height: 768px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
#inner
|
||||
{
|
||||
width: 100px; height: 700px;
|
||||
background-image: url(diagonal-scaled-fixed.svg);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="outer"><div id="inner"></div></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Scaled vector image without intrinsic dimensions as background, with rendering dependent on the diagonal</title>
|
||||
<style type="text/css">
|
||||
#outer
|
||||
{
|
||||
width: 256px; height: 768px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
#inner
|
||||
{
|
||||
width: 100px; height: 700px;
|
||||
background-image: url(diagonal-scaled.svg);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="outer"><div id="inner"></div></div>
|
||||
</body>
|
||||
</html>
|
10
layout/reftests/backgrounds/vector/diagonal-scaled-fixed.svg
Normal file
@ -0,0 +1,10 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="100px" height="700px">
|
||||
<title>Vector image with intrinsic dimensions, reference for diagonal-scaled.svg</title>
|
||||
<rect y="0" width="100px" height="350px" fill="lime"/>
|
||||
<rect y="350px" width="100px" height="350px" fill="aqua"/>
|
||||
<rect y="175px" width="50px" height="350px" fill="fuchsia"/>
|
||||
</svg>
|
After Width: | Height: | Size: 467 B |
21
layout/reftests/backgrounds/vector/diagonal-scaled.svg
Normal file
@ -0,0 +1,21 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<title>Vector image without intrinsic dimensions with percentage stroke-width (proportional to the diagonal)</title>
|
||||
<rect y="0" width="100%" height="50%" fill="lime"/>
|
||||
<rect y="50%" width="100%" height="50%" fill="aqua"/>
|
||||
<!--
|
||||
A percent stroke-width is resolved with respect to:
|
||||
|
||||
d = sqrt(vh**2 + vw**2) / sqrt(2)
|
||||
|
||||
where vh/vw are the image viewport width/height. Because this image has no
|
||||
intrinsic dimensions or ratio, it expands to fill the entire background
|
||||
positioning area, so its width is 100px and its height is 700px. For those
|
||||
carefully-chosen dimensions, d = 500px, so 10% of that creates a 50px-wide
|
||||
rectangle, vertically centered and horizontally left-aligned in the image.
|
||||
-->
|
||||
<line x1="25%" y1="25%" x2="25%" y2="75%" stroke="fuchsia" stroke-width="10%"/>
|
||||
</svg>
|
After Width: | Height: | Size: 982 B |
@ -0,0 +1,10 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 8 0"
|
||||
preserveAspectRatio="none">
|
||||
<title>Image with zero-width ratio, no dimensions</title>
|
||||
<rect y="0" width="100%" height="100%" fill="lime"/>
|
||||
</svg>
|
After Width: | Height: | Size: 336 B |
@ -0,0 +1,11 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
width="8px"
|
||||
viewBox="0 0 8 0"
|
||||
preserveAspectRatio="none">
|
||||
<title>Image with zero-height ratio, width</title>
|
||||
<rect y="0" width="100%" height="100%" fill="lime"/>
|
||||
</svg>
|
After Width: | Height: | Size: 346 B |
@ -0,0 +1,11 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
width="8px"
|
||||
viewBox="0 0 0 8"
|
||||
preserveAspectRatio="none">
|
||||
<title>Image with zero-width ratio, width</title>
|
||||
<rect y="0" width="100%" height="100%" fill="lime"/>
|
||||
</svg>
|
After Width: | Height: | Size: 345 B |
@ -0,0 +1,11 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
width="8px"
|
||||
viewBox="0 0 2147483647 1"
|
||||
preserveAspectRatio="none">
|
||||
<title>Image with non-percent width, omitted height, extreme viewbox</title>
|
||||
<rect y="0" width="100%" height="100%" fill="lime"/>
|
||||
</svg>
|
After Width: | Height: | Size: 381 B |
@ -0,0 +1,11 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
height="8px"
|
||||
viewBox="0 0 1 2147483647"
|
||||
preserveAspectRatio="none">
|
||||
<title>Image with omitted width, non-percent height, extreme viewbox</title>
|
||||
<rect y="0" width="100%" height="100%" fill="lime"/>
|
||||
</svg>
|
After Width: | Height: | Size: 382 B |
19
layout/reftests/backgrounds/vector/empty/ref-tall-empty.html
Normal file
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>tall reference, empty</title>
|
||||
<style type="text/css">
|
||||
div
|
||||
{
|
||||
width: 256px; height: 768px;
|
||||
}
|
||||
#outer
|
||||
{
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="outer"></div>
|
||||
</body>
|
||||
</html>
|