Merge last green changeset on m-c to mozilla-inbound

This commit is contained in:
Matt Brubeck 2011-08-08 14:21:41 -07:00
Родитель 07b3728d4c 33158c2a8c
Коммит 75b08bec62
98 изменённых файлов: 970 добавлений и 2975 удалений

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

@ -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"/>

Двоичные данные
browser/themes/pinstripe/browser/Toolbar-lion.png Normal file

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

После

Ширина:  |  Высота:  |  Размер: 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

Двоичные данные
browser/themes/pinstripe/browser/keyhole-circle-lion.png Normal file

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

После

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

Двоичные данные
browser/themes/pinstripe/browser/keyhole-circle.png Normal file

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

После

Ширина:  |  Высота:  |  Размер: 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;
}

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

До

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

После

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

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

До

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

После

Ширина:  |  Высота:  |  Размер: 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;

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

@ -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 \

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

@ -5189,7 +5189,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));
@ -5197,7 +5197,7 @@ GetChildFrame(nsGlobalWindow *win, jsid id)
nsIDOMWindow *frame = nsnull;
if (frames) {
frames->Item(JSID_TO_INT(id), &frame);
frames->Item(index, &frame);
}
return frame;
@ -5234,16 +5234,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.
@ -6504,19 +6502,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) {
@ -7907,8 +7903,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;
}
@ -8934,12 +8931,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;
}
@ -9482,7 +9474,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;
@ -9832,24 +9824,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;
}
@ -9871,24 +9853,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 &){};

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

@ -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!");

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

@ -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);

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

@ -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"

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

@ -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)

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

@ -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);
}

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

@ -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

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

@ -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');

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

@ -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;

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

@ -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);

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

@ -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

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

@ -0,0 +1,6 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="window676387-1-ref"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<hbox><button id="button" label="SUCCESS"/></hbox>
</window>

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

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="window676387-1"
class="reftest-wait"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="var button = document.getElementById('button');
var r = button.getBoundingClientRect();
if (document.elementFromPoint(r.right, r.top) == button.parentNode)
button.label = 'SUCCESS';
document.documentElement.className = '';">
<hbox><button id="button" label="FAIL"/></hbox>
</window>

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

@ -78,3 +78,5 @@ skip-if(!winWidget) == scroll-thumb-minimum-size-notheme.html scroll-thumb-minim
# animated progress bars.
skip-if(cocoaWidget) skip-if(winWidget) == progress-overflow.html progress-overflow-ref.html
skip-if(cocoaWidget) skip-if(winWidget) != progress-overflow-small.html progress-nobar.html
== 676387-1.xul 676387-1-ref.xul

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

@ -66,6 +66,7 @@
#define APPLICATION_ECMASCRIPT "application/ecmascript"
#define APPLICATION_JAVASCRIPT "application/javascript"
#define APPLICATION_XJAVASCRIPT "application/x-javascript"
#define APPLICATION_JSON "application/json"
#define APPLICATION_NETSCAPE_REVOCATION "application/x-netscape-revocation"
#define APPLICATION_NS_PROXY_AUTOCONFIG "application/x-ns-proxy-autoconfig"
#define APPLICATION_NS_JAVASCRIPT_AUTOCONFIG "application/x-javascript-config"

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

@ -860,7 +860,7 @@ HttpChannelChild::OnRedirectVerifyCallback(nsresult result)
if (newHttpChannel) {
// Must not be called until after redirect observers called.
newHttpChannel->SetOriginalURI(mRedirectOriginalURI);
newHttpChannel->SetOriginalURI(mOriginalURI);
}
RequestHeaderTuples emptyHeaders;

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

@ -159,7 +159,6 @@ protected:
private:
RequestHeaderTuples mRequestHeaders;
nsCOMPtr<nsIChildChannel> mRedirectChannelChild;
nsCOMPtr<nsIURI> mRedirectOriginalURI;
nsCOMPtr<nsISupports> mSecurityInfo;
PRPackedBool mIsFromCache;

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

@ -1357,6 +1357,7 @@ DetermineParseMode(const nsString& aBuffer, nsDTDMode& aParseMode,
aMimeType.EqualsLiteral(TEXT_CSS) ||
aMimeType.EqualsLiteral(APPLICATION_JAVASCRIPT) ||
aMimeType.EqualsLiteral(APPLICATION_XJAVASCRIPT) ||
aMimeType.EqualsLiteral(APPLICATION_JSON) ||
aMimeType.EqualsLiteral(TEXT_ECMASCRIPT) ||
aMimeType.EqualsLiteral(APPLICATION_ECMASCRIPT) ||
aMimeType.EqualsLiteral(TEXT_JAVASCRIPT)) {

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

@ -0,0 +1,29 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=667533
-->
<head>
<title>Test for Bug 667533</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=667533">Mozilla Bug 667533</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
function loaded(iframe) {
is(iframe.contentWindow.location.href, iframe.src, "should load correct URL");
is(iframe.contentDocument.body.textContent, '{"<p>Hello</p>": null}', "application/json should be treated as text");
SimpleTest.finish();
}
</script>
<iframe src="data:application/json,{&quot;<p>Hello</p>&quot;:%20null}" onload="loaded(this);"></iframe>
</body>
</html>

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

@ -55,6 +55,11 @@
#include "nsILoginManager.h"
#include "nsIMutationObserver.h"
// X.h defines KeyPress
#ifdef KeyPress
#undef KeyPress
#endif
class nsFormHistory;
class nsFormFillController : public nsIFormFillController,

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

@ -66,7 +66,7 @@
xbl:inherits="disabled,crop,image,label,accesskey,command,
align,dir,pack,orient"/>
<xul:dropmarker type="menu-button" class="toolbarbutton-menubutton-dropmarker"
xbl:inherits="align,dir,pack,orient,disabled,label"/>
xbl:inherits="align,dir,pack,orient,disabled,label,open"/>
</content>
</binding>

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

@ -152,6 +152,7 @@ OS_LIBS += \
-framework SystemConfiguration \
-framework QuickTime \
-framework IOKit \
-F/System/Library/PrivateFrameworks -framework CoreUI \
$(TK_LIBS) \
$(NULL)
endif

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

@ -203,24 +203,9 @@ toolbarseparator {
#Console\:clear {
-moz-box-orient: vertical;
-moz-box-align: center;
-moz-appearance: toolbarbutton;
font: menu;
text-shadow: @loweredShadow@;
margin: 4px 0 9px;
padding: 0 4px;
border: 1px solid @toolbarbuttonBorderColor@;
border-radius: @toolbarbuttonCornerRadius@;
box-shadow: @loweredShadow@;
background: @toolbarbuttonBackground@;
background-origin: border-box;
}
#Console\:clear:active:hover {
background: @toolbarbuttonPressedBackgroundColor@;
text-shadow: @loweredShadow@;
box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@;
}
#Console\:clear:-moz-window-inactive {
border-color: @toolbarbuttonInactiveBorderColor@;
background-image: @toolbarbuttonInactiveBackgroundImage@;
padding: 0 1px;
}

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

@ -24,12 +24,7 @@
%define sidebarItemInactiveBorderTop 1px solid #979797
%define sidebarItemInactiveBackground -moz-linear-gradient(top, #B4B4B4, #8A8A8A) repeat-x
%define toolbarbuttonBorderColor rgba(59, 59, 59, 0.9)
%define toolbarbuttonCornerRadius 3px
%define toolbarbuttonBackground -moz-linear-gradient(top, #FFF, #ADADAD) repeat-x
%define toolbarbuttonFocusedBorderColorAqua rgba(102, 122, 155, 0.9)
%define toolbarbuttonFocusedBorderColorGraphite rgba(59, 59, 59, 0.7)
%define toolbarbuttonPressedInnerShadow inset rgba(0, 0, 0, 0.3) 0 -6px 10px, inset #000 0 1px 3px, inset rgba(0, 0, 0, 0.2) 0 1px 3px
%define toolbarbuttonPressedBackgroundColor #B5B5B5
%define toolbarbuttonInactiveBorderColor rgba(146, 146, 146, 0.84)
%define toolbarbuttonInactiveBackgroundImage -moz-linear-gradient(top, #FFF, #CCC)

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

@ -86,13 +86,15 @@ toolbarbutton[checked="true"] {
border: none !important;
background-color: transparent !important;
list-style-image: url("chrome://global/skin/arrow/arrow-dn.png");
padding: 0 0 0 2px;
padding: 0;
-moz-padding-start: 2px;
width: auto;
}
.toolbarbutton-menu-dropmarker[disabled="true"] {
list-style-image: url("chrome://global/skin/arrow/arrow-dn-dis.png");
padding: 0 0 0 2px !important;
padding: 0;
-moz-padding-start: 2px;
}
/* ::::: toolbarbutton menu-button ::::: */
@ -122,7 +124,7 @@ toolbarbutton[type="menu-button"][disabled="true"]:hover:active {
/* .......... dropmarker .......... */
.toolbarbutton-menubutton-dropmarker {
-moz-appearance: none !important;
-moz-appearance: none;
border: none;
background-color: transparent !important;
list-style-image: url("chrome://global/skin/arrow/arrow-dn.png");

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

@ -46,10 +46,6 @@
}
#viewGroup {
background-color: rgba(0, 0, 0, 0.55);
padding: 1px;
border-radius: @toolbarbuttonCornerRadius@;
box-shadow: @loweredShadow@;
margin: 4px 0 9px;
}
@ -57,74 +53,16 @@
#viewGroup > toolbarbutton {
-moz-box-orient: vertical;
-moz-box-align: center;
-moz-appearance: none;
-moz-appearance: toolbarbutton;
font: menu;
text-shadow: @loweredShadow@;
margin: 0;
padding: 0 4px;
border: none;
border-left: 1px solid rgba(0, 0, 0, 0.8);
background: @toolbarbuttonBackground@;
}
#viewGroup > radio:active:hover,
#viewGroup > toolbarbutton:active:hover {
background: @toolbarbuttonPressedBackgroundColor@;
text-shadow: @loweredShadow@;
box-shadow: @toolbarbuttonPressedInnerShadow@;
padding: 0 1px;
height: 22px;
}
#viewGroup > radio[selected=true],
#viewGroup > toolbarbutton[checked=true] {
color: #FFF !important;
text-shadow: rgba(0, 0, 0, 0.4) 0 1px;
background: #606060;
box-shadow: inset #2A2A2A 0 3px 3.5px;
}
#viewGroup > radio[selected=true]:active:hover,
#viewGroup > toolbarbutton[checked=true]:active:hover {
background-color: #4E4E4E;
box-shadow: inset #1c1c1c 0 3px 3.5px;
}
#viewGroup:-moz-window-inactive {
background-color: rgba(0, 0, 0, 0.25);
}
#viewGroup > radio:-moz-window-inactive,
#viewGroup > toolbarbutton:-moz-window-inactive {
border-color: rgba(0, 0, 0, 0.4);
background-image: @toolbarbuttonInactiveBackgroundImage@;
}
#viewGroup > radio[selected=true]:-moz-window-inactive,
#viewGroup > toolbarbutton[checked=true]:-moz-window-inactive {
background: #8E8E8E;
box-shadow: inset rgba(0, 0, 0, 0.5) 0 3px 3.5px;
}
#viewGroup > radio:-moz-locale-dir(ltr):first-child,
#viewGroup > radio:-moz-locale-dir(ltr)[first-visible],
#viewGroup > radio:-moz-locale-dir(rtl):last-child,
#viewGroup > radio:-moz-locale-dir(rtl)[last-visible],
#viewGroup > toolbarbutton:-moz-locale-dir(ltr):first-child,
#viewGroup > toolbarbutton:-moz-locale-dir(ltr)[first-visible],
#viewGroup > toolbarbutton:-moz-locale-dir(rtl):last-child,
#viewGroup > toolbarbutton:-moz-locale-dir(rtl)[last-visible] {
border-top-left-radius: 2px;
border-bottom-left-radius: 2px;
border-left: none !important;
}
#viewGroup > radio:-moz-locale-dir(ltr):last-child,
#viewGroup > radio:-moz-locale-dir(ltr)[last-visible],
#viewGroup > radio:-moz-locale-dir(rtl):first-child,
#viewGroup > radio:-moz-locale-dir(rtl)[first-visible],
#viewGroup > toolbarbutton:-moz-locale-dir(ltr):last-child,
#viewGroup > toolbarbutton:-moz-locale-dir(ltr)[last-visible],
#viewGroup > toolbarbutton:-moz-locale-dir(rtl):first-child,
#viewGroup > toolbarbutton:-moz-locale-dir(rtl)[first-visible] {
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
}

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

@ -111,35 +111,9 @@ richlistitem[type="download"] button {
}
#clearListButton {
-moz-appearance: none;
-moz-appearance: toolbarbutton;
min-height: 18px;
min-width: 0;
margin: 0 6px;
padding: 0 2px;
text-shadow: @loweredShadow@;
border: 1px solid @toolbarbuttonBorderColor@;
border-radius: @toolbarbuttonCornerRadius@;
box-shadow: @loweredShadow@;
background: @toolbarbuttonBackground@;
background-origin: border-box;
}
#clearListButton:hover:active:not([disabled="true"]) {
background: @toolbarbuttonPressedBackgroundColor@;
text-shadow: @loweredShadow@;
box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@;
}
#clearListButton:-moz-focusring {
border-color: @toolbarbuttonFocusedBorderColorAqua@;
box-shadow: @focusRingShadow@;
}
#clearListButton:-moz-system-metric(mac-graphite-theme):-moz-focusring {
border-color: @toolbarbuttonFocusedBorderColorGraphite@;
}
#clearListButton:-moz-window-inactive {
border-color: @toolbarbuttonInactiveBorderColor@;
background-image: @toolbarbuttonInactiveBackgroundImage@;
}

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

@ -39,36 +39,11 @@ wizardpage {
}
.wizard-buttons button {
-moz-appearance: none;
-moz-appearance: toolbarbutton;
min-height: 22px;
margin: 0 6px;
padding: 0 2px;
padding: 0;
text-shadow: @loweredShadow@;
border: 1px solid @toolbarbuttonBorderColor@;
border-radius: @toolbarbuttonCornerRadius@;
box-shadow: @loweredShadow@;
background: @toolbarbuttonBackground@;
background-origin: border-box;
}
.wizard-buttons button:hover:active:not([disabled="true"]) {
background: @toolbarbuttonPressedBackgroundColor@;
text-shadow: @loweredShadow@;
box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@;
}
.wizard-buttons button:-moz-focusring {
border-color: @toolbarbuttonFocusedBorderColorAqua@;
box-shadow: @focusRingShadow@;
}
.wizard-buttons button:-moz-system-metric(mac-graphite-theme):-moz-focusring {
border-color: @toolbarbuttonFocusedBorderColorGraphite@;
}
.wizard-buttons button:-moz-window-inactive {
border-color: @toolbarbuttonInactiveBorderColor@;
background-image: @toolbarbuttonInactiveBackgroundImage@;
}
.loadingBox {

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

@ -143,4 +143,5 @@ LOCAL_INCLUDES = \
LDFLAGS += \
-framework QuickTime \
-framework IOKit \
-F/System/Library/PrivateFrameworks -framework CoreUI \
$(NULL)

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

@ -294,16 +294,16 @@ public:
static void MouseMoved(NSEvent* aEvent);
static void OnDestroyView(ChildView* aView);
static void OnDestroyWindow(NSWindow* aWindow);
static BOOL WindowAcceptsEvent(NSWindow* aWindow, NSEvent* aEvent,
ChildView* aView, BOOL isClickThrough = NO);
static void MouseExitedWindow(NSEvent* aEvent);
static void MouseEnteredWindow(NSEvent* aEvent);
static void ReEvaluateMouseEnterState(NSEvent* aEvent = nil);
static ChildView* ViewForEvent(NSEvent* aEvent);
static ChildView* sLastMouseEventView;
private:
static NSWindow* WindowForEvent(NSEvent* aEvent);
static NSWindow* sWindowUnderMouse;
};
//-------------------------------------------------------------------------

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

@ -112,14 +112,6 @@ extern "C" {
CG_EXTERN void CGContextResetCTM(CGContextRef);
CG_EXTERN void CGContextSetCTM(CGContextRef, CGAffineTransform);
CG_EXTERN void CGContextResetClip(CGContextRef);
// CGSPrivate.h
typedef NSInteger CGSConnection;
typedef NSInteger CGSWindow;
extern CGSConnection _CGSDefaultConnection();
extern CGError CGSGetScreenRectForWindow(const CGSConnection cid, CGSWindow wid, CGRect *outRect);
extern CGError CGSGetWindowLevel(const CGSConnection cid, CGSWindow wid, CGWindowLevel *level);
extern CGError CGSGetWindowAlpha(const CGSConnection cid, const CGSWindow wid, float* alpha);
}
// defined in nsMenuBarX.mm
@ -133,6 +125,7 @@ PRBool gChildViewMethodsSwizzled = PR_FALSE;
extern nsISupportsArray *gDraggedTransferables;
ChildView* ChildViewMouseTracker::sLastMouseEventView = nil;
NSWindow* ChildViewMouseTracker::sWindowUnderMouse = nil;
#ifdef INVALIDATE_DEBUGGING
static void blinkRect(Rect* r);
@ -1236,6 +1229,24 @@ nsresult nsChildView::SynthesizeNativeMouseEvent(nsIntPoint aPoint,
if (!event)
return NS_ERROR_FAILURE;
if ([[mView window] isKindOfClass:[BaseWindow class]]) {
// Tracking area events don't end up in their tracking areas when sent
// through [NSApp sendEvent:], so pass them directly to the right methods.
BaseWindow* window = (BaseWindow*)[mView window];
if (aNativeMessage == NSMouseEntered) {
[window mouseEntered:event];
return NS_OK;
}
if (aNativeMessage == NSMouseExited) {
[window mouseExited:event];
return NS_OK;
}
if (aNativeMessage == NSMouseMoved) {
[window mouseMoved:event];
return NS_OK;
}
}
[NSApp sendEvent:event];
return NS_OK;
@ -3234,11 +3245,6 @@ NSEvent* gLastDragMouseDownEvent = nil;
mGeckoChild->DispatchEvent(&event, status);
}
- (void)mouseMoved:(NSEvent*)aEvent
{
ChildViewMouseTracker::MouseMoved(aEvent);
}
- (void)handleMouseMoved:(NSEvent*)theEvent
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
@ -4756,8 +4762,33 @@ NSEvent* gLastDragMouseDownEvent = nil;
void
ChildViewMouseTracker::OnDestroyView(ChildView* aView)
{
if (sLastMouseEventView == aView)
if (sLastMouseEventView == aView) {
sLastMouseEventView = nil;
}
}
void
ChildViewMouseTracker::OnDestroyWindow(NSWindow* aWindow)
{
if (sWindowUnderMouse == aWindow) {
sWindowUnderMouse = nil;
}
}
void
ChildViewMouseTracker::MouseEnteredWindow(NSEvent* aEvent)
{
sWindowUnderMouse = [aEvent window];
ReEvaluateMouseEnterState(aEvent);
}
void
ChildViewMouseTracker::MouseExitedWindow(NSEvent* aEvent)
{
if (sWindowUnderMouse == [aEvent window]) {
sWindowUnderMouse = nil;
ReEvaluateMouseEnterState(aEvent);
}
}
void
@ -4781,20 +4812,19 @@ ChildViewMouseTracker::ReEvaluateMouseEnterState(NSEvent* aEvent)
void
ChildViewMouseTracker::MouseMoved(NSEvent* aEvent)
{
ReEvaluateMouseEnterState(aEvent);
MouseEnteredWindow(aEvent);
[sLastMouseEventView handleMouseMoved:aEvent];
}
ChildView*
ChildViewMouseTracker::ViewForEvent(NSEvent* aEvent)
{
NSWindow* window = WindowForEvent(aEvent);
NSWindow* window = sWindowUnderMouse;
if (!window)
return nil;
NSPoint windowEventLocation = nsCocoaUtils::EventLocationForWindow(aEvent, window);
NSView* view = [[[window contentView] superview] hitTest:windowEventLocation];
NS_ASSERTION(view, "How can the mouse be over a window but not over a view in that window?");
if (![view isKindOfClass:[ChildView class]])
return nil;
@ -4805,102 +4835,6 @@ ChildViewMouseTracker::ViewForEvent(NSEvent* aEvent)
return WindowAcceptsEvent(window, aEvent, childView) ? childView : nil;
}
static CGWindowLevel kDockWindowLevel = 0;
static CGWindowLevel kPopupWindowLevel = 0;
static BOOL WindowNumberIsUnderPoint(NSInteger aWindowNumber, NSPoint aPoint) {
NSWindow* window = [NSApp windowWithWindowNumber:aWindowNumber];
if (window) {
// This is one of our own windows.
return NSMouseInRect(aPoint, [window frame], NO);
}
CGSConnection cid = _CGSDefaultConnection();
if (!kDockWindowLevel) {
// These constants are in fact function calls, so cache them.
kDockWindowLevel = kCGDockWindowLevel;
kPopupWindowLevel = kCGPopUpMenuWindowLevel;
}
// Some things put transparent windows on top of everything. Ignore them.
CGWindowLevel level;
if ((kCGErrorSuccess == CGSGetWindowLevel(cid, aWindowNumber, &level)) &&
(level == kDockWindowLevel || // Transparent layer, spanning the whole screen
level > kPopupWindowLevel)) // Snapz Pro X while recording a screencast
return false;
// Ignore transparent windows.
float alpha;
if ((kCGErrorSuccess == CGSGetWindowAlpha(cid, aWindowNumber, &alpha)) &&
alpha < 0.1f)
return false;
CGRect rect;
if (kCGErrorSuccess != CGSGetScreenRectForWindow(cid, aWindowNumber, &rect))
return false;
CGPoint point = { aPoint.x, nsCocoaUtils::FlippedScreenY(aPoint.y) };
return CGRectContainsPoint(rect, point);
}
// Find the window number of the window under the given point, regardless of
// which app the window belongs to. Returns 0 if no window was found.
static NSInteger WindowNumberAtPoint(NSPoint aPoint) {
// We'd like to use the new windowNumberAtPoint API on 10.6 but we can't rely
// on it being up-to-date. For example, if we've just opened a window,
// windowNumberAtPoint might not know about it yet, so we'd send events to the
// wrong window. See bug 557986.
// So we'll have to find the right window manually by iterating over all
// windows on the screen and testing whether the mouse is inside the window's
// rect. We do this using private CGS functions.
// Another way of doing it would be to use tracking rects, but those are
// view-controlled, so they need to be reset whenever an NSView changes its
// size or position, which is expensive. See bug 300904 comment 20.
// A problem with using the CGS functions is that we only look at the windows'
// rects, not at the transparency of the actual pixel the mouse is over. This
// means that we won't treat transparent pixels as transparent to mouse
// events, which is a disadvantage over using tracking rects and leads to the
// crummy window level workarounds in WindowNumberIsUnderPoint.
// But speed is more important.
// Get the window list.
NSInteger windowCount;
NSCountWindows(&windowCount);
NSInteger* windowList = (NSInteger*)malloc(sizeof(NSInteger) * windowCount);
if (!windowList)
return nil;
// The list we get back here is in order from front to back.
NSWindowList(windowCount, windowList);
for (NSInteger i = 0; i < windowCount; i++) {
NSInteger windowNumber = windowList[i];
if (WindowNumberIsUnderPoint(windowNumber, aPoint)) {
free(windowList);
return windowNumber;
}
}
free(windowList);
return 0;
}
// Find Gecko window under the mouse. Returns nil if the mouse isn't over
// any of our windows.
NSWindow*
ChildViewMouseTracker::WindowForEvent(NSEvent* anEvent)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NSPoint screenPoint = nsCocoaUtils::ScreenLocationForEvent(anEvent);
NSInteger windowNumber = WindowNumberAtPoint(screenPoint);
// This will return nil if windowNumber belongs to a window that we don't own.
return [NSApp windowWithWindowNumber:windowNumber];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
BOOL
ChildViewMouseTracker::WindowAcceptsEvent(NSWindow* aWindow, NSEvent* aEvent,
ChildView* aView, BOOL aIsClickThrough)

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

@ -81,6 +81,8 @@ typedef struct _nsCocoaWindowList {
// is ridiculously slow, so we cache it in the toplevel window for all
// descendants to use.
float mDPI;
NSTrackingArea* mTrackingArea;
}
- (void)importState:(NSDictionary*)aState;
@ -94,6 +96,12 @@ typedef struct _nsCocoaWindowList {
- (void)invalidateShadow;
- (float)getDPI;
- (void)mouseEntered:(NSEvent*)aEvent;
- (void)mouseExited:(NSEvent*)aEvent;
- (void)mouseMoved:(NSEvent*)aEvent;
- (void)updateTrackingArea;
- (NSView*)trackingAreaView;
@end
@interface NSWindow (Undocumented)
@ -293,8 +301,6 @@ public:
NS_IMETHOD BeginSecureKeyboardInput();
NS_IMETHOD EndSecureKeyboardInput();
static void UnifiedShading(void* aInfo, const CGFloat* aIn, CGFloat* aOut);
void SetPopupWindowLevel();
PRBool IsChildInFailingLeftClickThrough(NSView *aChild);

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

@ -642,7 +642,6 @@ NS_IMETHODIMP nsCocoaWindow::Show(PRBool bState)
parentIsSheet) {
piParentWidget->GetSheetWindowParent(&topNonSheetWindow);
[NSApp endSheet:nativeParentWindow];
[nativeParentWindow setAcceptsMouseMovedEvents:NO];
}
nsCocoaWindow* sheetShown = nsnull;
@ -657,7 +656,6 @@ NS_IMETHODIMP nsCocoaWindow::Show(PRBool bState)
// Only set contextInfo if our parent isn't a sheet.
NSWindow* contextInfo = parentIsSheet ? nil : mSheetWindowParent;
[TopLevelWindowData deactivateInWindow:mSheetWindowParent];
[mWindow setAcceptsMouseMovedEvents:YES];
[NSApp beginSheet:mWindow
modalForWindow:mSheetWindowParent
modalDelegate:mDelegate
@ -684,7 +682,6 @@ NS_IMETHODIMP nsCocoaWindow::Show(PRBool bState)
NSInteger windowNumber = [mWindow windowNumber];
[mWindow _setWindowNumber:-1];
[mWindow _setWindowNumber:windowNumber];
[mWindow setAcceptsMouseMovedEvents:YES];
// For reasons that aren't yet clear, calls to [NSWindow orderFront:] or
// [NSWindow makeKeyAndOrderFront:] can sometimes trigger "Error (1000)
// creating CGSWindow", which in turn triggers an internal inconsistency
@ -716,7 +713,6 @@ NS_IMETHODIMP nsCocoaWindow::Show(PRBool bState)
ordered:NSWindowAbove];
}
else {
[mWindow setAcceptsMouseMovedEvents:YES];
NS_OBJC_BEGIN_TRY_LOGONLY_BLOCK;
[mWindow makeKeyAndOrderFront:nil];
NS_OBJC_END_TRY_LOGONLY_BLOCK;
@ -743,8 +739,6 @@ NS_IMETHODIMP nsCocoaWindow::Show(PRBool bState)
// hide the sheet
[NSApp endSheet:mWindow];
[mWindow setAcceptsMouseMovedEvents:NO];
[TopLevelWindowData deactivateInWindow:mWindow];
nsCocoaWindow* siblingSheetToShow = nsnull;
@ -774,7 +768,6 @@ NS_IMETHODIMP nsCocoaWindow::Show(PRBool bState)
// If there are no sibling sheets, but the parent is a sheet, restore
// it. It wasn't sent any deactivate events when it was hidden, so
// don't call through Show, just let the OS put it back up.
[nativeParentWindow setAcceptsMouseMovedEvents:YES];
[NSApp beginSheet:nativeParentWindow
modalForWindow:sheetParent
modalDelegate:[nativeParentWindow delegate]
@ -787,7 +780,6 @@ NS_IMETHODIMP nsCocoaWindow::Show(PRBool bState)
NS_OBJC_BEGIN_TRY_LOGONLY_BLOCK;
[sheetParent makeKeyAndOrderFront:nil];
NS_OBJC_END_TRY_LOGONLY_BLOCK;
[sheetParent setAcceptsMouseMovedEvents:YES];
}
SendSetZLevelEvent();
}
@ -813,10 +805,6 @@ NS_IMETHODIMP nsCocoaWindow::Show(PRBool bState)
if (mWindowType == eWindowType_popup)
[NSApp _removeWindowFromCache:mWindow];
// it's very important to turn off mouse moved events when hiding a window, otherwise
// the windows' tracking rects will interfere with each other. (bug 356528)
[mWindow setAcceptsMouseMovedEvents:NO];
// If our popup window is a non-native context menu, tell the OS (and
// other programs) that a menu has closed.
if ([mWindow isKindOfClass:[PopupWindow class]] &&
@ -1417,7 +1405,6 @@ NS_IMETHODIMP nsCocoaWindow::SetFocus(PRBool aState)
mPopupContentView->SetFocus(aState);
}
else if (aState && ([mWindow isVisible] || [mWindow isMiniaturized])) {
[mWindow setAcceptsMouseMovedEvents:YES];
[mWindow makeKeyAndOrderFront:nil];
SendSetZLevelEvent();
}
@ -1649,26 +1636,6 @@ NS_IMETHODIMP nsCocoaWindow::EndSecureKeyboardInput()
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
// Callback used by the default titlebar and toolbar shading.
// *aIn == 0 at the top of the titlebar/toolbar, *aIn == 1 at the bottom
/* static */ void
nsCocoaWindow::UnifiedShading(void* aInfo, const CGFloat* aIn, CGFloat* aOut)
{
UnifiedGradientInfo* info = (UnifiedGradientInfo*)aInfo;
// The gradient percentage at the bottom of the titlebar / top of the toolbar
float start = info->titlebarHeight / (info->titlebarHeight + info->toolbarHeight - 1);
const float startGrey = NativeGreyColorAsFloat(headerStartGrey, info->windowIsMain);
const float endGrey = NativeGreyColorAsFloat(headerEndGrey, info->windowIsMain);
// *aIn is the gradient percentage of the titlebar or toolbar gradient,
// a is the gradient percentage of the whole unified gradient.
float a = info->drawTitlebar ? *aIn * start : start + *aIn * (1 - start);
float result = (1.0f - a) * startGrey + a * endGrey;
aOut[0] = result;
aOut[1] = result;
aOut[2] = result;
aOut[3] = 1.0f;
}
void nsCocoaWindow::SetPopupWindowLevel()
{
// Floating popups are at the floating level and hide when the window is
@ -1786,6 +1753,9 @@ PRBool nsCocoaWindow::ShouldFocusPlugin()
- (void)windowDidResize:(NSNotification *)aNotification
{
BaseWindow* window = [aNotification object];
[window updateTrackingArea];
if (!mGeckoWindow)
return;
@ -1993,6 +1963,11 @@ GetDPI(NSWindow* aWindow)
return (heightPx / scaleFactor) / (heightMM / MM_PER_INCH_FLOAT);
}
@interface BaseWindow(Private)
- (void)removeTrackingArea;
- (void)cursorUpdated:(NSEvent*)aEvent;
@end
@implementation BaseWindow
- (id)initWithContentRect:(NSRect)aContentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)aBufferingType defer:(BOOL)aFlag
@ -2004,6 +1979,8 @@ GetDPI(NSWindow* aWindow)
mInactiveTitlebarColor = nil;
mScheduledShadowInvalidation = NO;
mDPI = GetDPI(self);
mTrackingArea = nil;
[self updateTrackingArea];
return self;
}
@ -2012,6 +1989,8 @@ GetDPI(NSWindow* aWindow)
{
[mActiveTitlebarColor release];
[mInactiveTitlebarColor release];
[self removeTrackingArea];
ChildViewMouseTracker::OnDestroyWindow(self);
[super dealloc];
}
@ -2097,6 +2076,55 @@ static const NSString* kStateShowsToolbarButton = @"showsToolbarButton";
return mDPI;
}
- (NSView*)trackingAreaView
{
NSView* contentView = [self contentView];
return [contentView superview] ? [contentView superview] : contentView;
}
- (void)removeTrackingArea
{
if (mTrackingArea) {
[[self trackingAreaView] removeTrackingArea:mTrackingArea];
[mTrackingArea release];
mTrackingArea = nil;
}
}
- (void)updateTrackingArea
{
[self removeTrackingArea];
NSView* view = [self trackingAreaView];
const NSTrackingAreaOptions options =
NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingActiveAlways;
mTrackingArea = [[NSTrackingArea alloc] initWithRect:[view bounds]
options:options
owner:self
userInfo:nil];
[view addTrackingArea:mTrackingArea];
}
- (void)mouseEntered:(NSEvent*)aEvent
{
ChildViewMouseTracker::MouseEnteredWindow(aEvent);
}
- (void)mouseExited:(NSEvent*)aEvent
{
ChildViewMouseTracker::MouseExitedWindow(aEvent);
}
- (void)mouseMoved:(NSEvent*)aEvent
{
ChildViewMouseTracker::MouseMoved(aEvent);
}
- (void)cursorUpdated:(NSEvent*)aEvent
{
// Nothing to do here, but NSTrackingArea wants us to implement this method.
}
- (BOOL)respondsToSelector:(SEL)aSelector
{
// Claim the window doesn't respond to this so that the system
@ -2377,93 +2405,79 @@ static const NSString* kStateShowsToolbarButton = @"showsToolbarButton";
return self;
}
// Our pattern width is 1 pixel. CoreGraphics can cache and tile for us.
static const float sPatternWidth = 1.0f;
static void
DrawTitlebarGradient(CGContextRef aContext, float aTitlebarHeight,
float aTitlebarOrigin, float aToolbarHeight, BOOL aIsMain)
DrawNativeTitlebar(CGContextRef aContext, CGRect aTitlebarRect,
float aToolbarHeight, BOOL aIsMain)
{
// Create and draw a CGShading that uses nsCocoaWindow::UnifiedShading() as its callback.
CGFunctionCallbacks callbacks = {0, nsCocoaWindow::UnifiedShading, NULL};
UnifiedGradientInfo info = { aTitlebarHeight, aToolbarHeight, aIsMain, YES };
CGFunctionRef function = CGFunctionCreate(&info, 1, NULL, 4, NULL, &callbacks);
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGShadingRef shading = CGShadingCreateAxial(colorSpace,
CGPointMake(0.0f, aTitlebarOrigin + aTitlebarHeight),
CGPointMake(0.0f, aTitlebarOrigin),
function, NO, NO);
CGColorSpaceRelease(colorSpace);
CGFunctionRelease(function);
CGContextDrawShading(aContext, shading);
CGShadingRelease(shading);
// Draw the one pixel border at the bottom of the titlebar.
if (aToolbarHeight == 0) {
CGRect borderRect = CGRectMake(0.0f, aTitlebarOrigin, sPatternWidth, 1.0f);
DrawNativeGreyColorInRect(aContext, headerBorderGrey, borderRect, aIsMain);
}
int unifiedHeight = aTitlebarRect.size.height + aToolbarHeight;
CUIDraw([NSWindow coreUIRenderer], aTitlebarRect, aContext,
(CFDictionaryRef)[NSDictionary dictionaryWithObjectsAndKeys:
@"kCUIWidgetWindowFrame", @"widget",
@"regularwin", @"windowtype",
(aIsMain ? @"normal" : @"inactive"), @"state",
[NSNumber numberWithInt:unifiedHeight], @"kCUIWindowFrameUnifiedTitleBarHeightKey",
[NSNumber numberWithBool:YES], @"kCUIWindowFrameDrawTitleSeparatorKey",
nil],
nil);
// At some window widths the call to CUIDraw doesn't draw the top pixel strip.
// We don't want to have a flickering transparent line, so we overdraw it.
CGContextSetRGBFillColor(aContext, 0.95, 0.95, 0.95, 1);
CGContextFillRect(aContext, CGRectMake(0, CGRectGetMaxY(aTitlebarRect) - 1,
aTitlebarRect.size.width, 1));
}
// Pattern draw callback for standard titlebar gradients and solid titlebar colors
static void
RepeatedPatternDrawCallback(void* aInfo, CGContextRef aContext)
TitlebarDrawCallback(void* aInfo, CGContextRef aContext)
{
ToolbarWindow *window = (ToolbarWindow*)aInfo;
// Remember: this context is NOT flipped, so the origin is in the bottom left.
float titlebarWidth = [window frame].size.width;
float titlebarHeight = [window titlebarHeight];
float titlebarOrigin = [window frame].size.height - titlebarHeight;
NSRect titlebarRect = NSMakeRect(0, titlebarOrigin, titlebarWidth, titlebarHeight);
[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:aContext flipped:NO]];
BOOL isMain = [window isMainWindow];
NSColor *titlebarColor = [window titlebarColorForActiveWindow:isMain];
if (!titlebarColor) {
// If the titlebar color is nil, draw the default titlebar shading.
DrawTitlebarGradient(aContext, titlebarHeight, titlebarOrigin,
[window unifiedToolbarHeight], isMain);
} else {
// If the titlebar color is not nil, just set and draw it normally.
[titlebarColor set];
NSRectFill(NSMakeRect(0.0f, titlebarOrigin, sPatternWidth, titlebarHeight));
}
if ([window drawsContentsIntoWindowFrame]) {
NSView* view = [[[window contentView] subviews] lastObject];
if (!view || ![view isKindOfClass:[ChildView class]])
return;
// Draw the background color of the window everywhere but where the titlebar is.
[[window windowBackgroundColor] set];
NSRectFill(NSMakeRect(0.0f, 0.0f, 1.0f, titlebarOrigin));
// Gecko drawing assumes flippedness, but the current context isn't flipped
// (because we're painting into the window's border view, which is not a
// ChildView, so it isn't flpped).
// So we need to set a flip transform.
CGContextScaleCTM(aContext, 1.0f, -1.0f);
CGContextTranslateCTM(aContext, 0.0f, -[window frame].size.height);
NSRect flippedTitlebarRect = NSMakeRect(0, 0, titlebarWidth, titlebarHeight);
[(ChildView*)view drawRect:flippedTitlebarRect inTitlebarContext:aContext];
} else {
BOOL isMain = [window isMainWindow];
NSColor *titlebarColor = [window titlebarColorForActiveWindow:isMain];
if (!titlebarColor) {
// If the titlebar color is nil, draw the default titlebar shading.
DrawNativeTitlebar(aContext, NSRectToCGRect(titlebarRect),
[window unifiedToolbarHeight], isMain);
} else {
// If the titlebar color is not nil, just set and draw it normally.
[titlebarColor set];
NSRectFill(titlebarRect);
}
}
[NSGraphicsContext restoreGraphicsState];
}
// Pattern draw callback for "drawsContentsIntoWindowFrame" windows
static void
ContentPatternDrawCallback(void* aInfo, CGContextRef aContext)
{
ToolbarWindow *window = (ToolbarWindow*)aInfo;
NSView* view = [[[window contentView] subviews] lastObject];
if (!view || ![view isKindOfClass:[ChildView class]])
return;
// Gecko drawing assumes flippedness, but the current context isn't flipped
// (because we're painting into the window's border view, which is not a
// ChildView, so it isn't flpped).
// So we need to set a flip transform.
CGContextScaleCTM(aContext, 1.0f, -1.0f);
CGContextTranslateCTM(aContext, 0.0f, -[window frame].size.height);
NSRect titlebarRect = NSMakeRect(0, 0, [window frame].size.width, [window titlebarHeight]);
[(ChildView*)view drawRect:titlebarRect inTitlebarContext:aContext];
}
- (void)setFill
{
CGPatternDrawPatternCallback cb = [mWindow drawsContentsIntoWindowFrame] ?
&ContentPatternDrawCallback : &RepeatedPatternDrawCallback;
float patternWidth = [mWindow drawsContentsIntoWindowFrame] ? [mWindow frame].size.width : sPatternWidth;
float patternWidth = [mWindow frame].size.width;
CGPatternCallbacks callbacks = {0, cb, NULL};
CGPatternCallbacks callbacks = {0, &TitlebarDrawCallback, NULL};
CGPatternRef pattern = CGPatternCreate(mWindow, CGRectMake(0.0f, 0.0f, patternWidth, [mWindow frame].size.height),
CGAffineTransformIdentity, patternWidth, [mWindow frame].size.height,
kCGPatternTilingConstantSpacing, true, &callbacks);
@ -2493,87 +2507,6 @@ ContentPatternDrawCallback(void* aInfo, CGContextRef aContext)
@implementation PopupWindow
// The OS treats our custom popup windows very strangely -- many mouse events
// sent to them never reach their target NSView objects. (That these windows
// are borderless and of level NSPopUpMenuWindowLevel may have something to do
// with it.) The best solution is to pre-empt the OS, as follows. (All
// events for a given NSWindow object go through its sendEvent: method.)
- (void)sendEvent:(NSEvent *)anEvent
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
NSView *target = nil;
NSView *contentView = nil;
NSEventType type = [anEvent type];
NSPoint windowLocation = NSZeroPoint;
switch (type) {
case NSScrollWheel:
case NSLeftMouseDown:
case NSLeftMouseUp:
case NSRightMouseDown:
case NSRightMouseUp:
case NSOtherMouseDown:
case NSOtherMouseUp:
case NSMouseMoved:
case NSLeftMouseDragged:
case NSRightMouseDragged:
case NSOtherMouseDragged:
if ((contentView = [self contentView])) {
// Since [anEvent window] might not be us, we can't use [anEvent locationInWindow].
windowLocation = nsCocoaUtils::EventLocationForWindow(anEvent, self);
target = [contentView hitTest:[contentView convertPoint:windowLocation fromView:nil]];
// If the hit test failed, the event is targeted here but is not over the window.
// Send it to our content view.
if (!target)
target = contentView;
}
break;
default:
break;
}
if (target) {
switch (type) {
case NSScrollWheel:
[target scrollWheel:anEvent];
break;
case NSLeftMouseUp:
[target mouseUp:anEvent];
break;
case NSRightMouseDown:
[target rightMouseDown:anEvent];
break;
case NSRightMouseUp:
[target rightMouseUp:anEvent];
break;
case NSOtherMouseDown:
[target otherMouseDown:anEvent];
break;
case NSOtherMouseUp:
[target otherMouseUp:anEvent];
break;
case NSMouseMoved:
[target mouseMoved:anEvent];
break;
case NSLeftMouseDragged:
[target mouseDragged:anEvent];
break;
case NSRightMouseDragged:
[target rightMouseDragged:anEvent];
break;
case NSOtherMouseDragged:
[target otherMouseDragged:anEvent];
break;
default:
[super sendEvent:anEvent];
break;
}
} else {
[super sendEvent:anEvent];
}
NS_OBJC_END_TRY_ABORT_BLOCK;
}
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask
backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation
{

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

@ -247,7 +247,7 @@ nsresult nsLookAndFeel::NativeGetColor(const nsColorID aID, nscolor &aColor)
break;
case eColor__moz_mac_chrome_active:
case eColor__moz_mac_chrome_inactive: {
int grey = NativeGreyColorAsInt(headerEndGrey, (aID == eColor__moz_mac_chrome_active));
int grey = NativeGreyColorAsInt(toolbarFillGrey, (aID == eColor__moz_mac_chrome_active));
aColor = NS_RGB(grey, grey, grey);
}
break;

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

@ -51,6 +51,7 @@
@class CellDrawView;
@class NSProgressBarCell;
class nsDeviceContext;
struct SegmentedControlRenderSettings;
class nsNativeThemeCocoa : private nsNativeTheme,
public nsITheme
@ -96,6 +97,9 @@ protected:
nsresult GetSystemColor(PRUint8 aWidgetType, nsILookAndFeel::nsColorID& aColorID);
nsIntMargin RTLAwareMargin(const nsIntMargin& aMargin, nsIFrame* aFrame);
nsIFrame* SeparatorResponsibility(nsIFrame* aBefore, nsIFrame* aAfter);
CGRect SeparatorAdjustedRect(CGRect aRect, nsIFrame* aLeft,
nsIFrame* aCurrent, nsIFrame* aRight);
// Helpers for progressbar.
double GetProgressValue(nsIFrame* aFrame);
@ -108,8 +112,9 @@ protected:
void DrawProgress(CGContextRef context, const HIRect& inBoxRect,
PRBool inIsIndeterminate, PRBool inIsHorizontal,
double inValue, double inMaxValue, nsIFrame* aFrame);
void DrawTab(CGContextRef context, HIRect inBoxRect, nsEventStates inState,
nsIFrame* aFrame);
void DrawSegment(CGContextRef cgContext, const HIRect& inBoxRect,
nsEventStates inState, nsIFrame* aFrame,
const SegmentedControlRenderSettings& aSettings);
void DrawTabPanel(CGContextRef context, const HIRect& inBoxRect, nsIFrame* aFrame);
void DrawScale(CGContextRef context, const HIRect& inBoxRect,
nsEventStates inState, PRBool inDirection,

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

@ -289,6 +289,16 @@ static NSControlSize CocoaSizeForEnum(PRInt32 enumControlSize) {
return NSRegularControlSize;
}
static NSString* CUIControlSizeForCocoaSize(NSControlSize aControlSize)
{
if (aControlSize == NSRegularControlSize)
return @"regular";
else if (aControlSize == NSSmallControlSize)
return @"small";
else
return @"mini";
}
static void InflateControlRect(NSRect* rect, NSControlSize cocoaControlSize, const float marginSet[][3][4])
{
if (!marginSet)
@ -338,6 +348,15 @@ static BOOL FrameIsInActiveWindow(nsIFrame* aFrame)
return [win isMainWindow] && ![win attachedSheet];
}
// Toolbar controls and content controls respond to different window
// activeness states.
static BOOL IsActive(nsIFrame* aFrame, BOOL aIsToolbarControl)
{
if (aIsToolbarControl)
return [NativeWindowForFrame(aFrame) isMainWindow] || ![NSView focusView];
return FrameIsInActiveWindow(aFrame);
}
NS_IMPL_ISUPPORTS_INHERITED1(nsNativeThemeCocoa, nsNativeTheme, nsITheme)
@ -574,7 +593,7 @@ struct CellRenderSettings {
* tolerance - The tolerance as passed to DrawCellWithSnapping.
* NOTE: returns NSRegularControlSize if all values in 'sizes' are zero.
*/
static NSControlSize FindControlSize(CGFloat size, CGFloat* sizes, CGFloat tolerance)
static NSControlSize FindControlSize(CGFloat size, const CGFloat* sizes, CGFloat tolerance)
{
for (PRUint32 i = miniControlSize; i <= regularControlSize; ++i) {
if (sizes[i] == 0) {
@ -1344,86 +1363,107 @@ nsNativeThemeCocoa::DrawScale(CGContextRef cgContext, const HIRect& inBoxRect,
NS_OBJC_END_TRY_ABORT_BLOCK;
}
#define NATURAL_MINI_TAB_BUTTON_HEIGHT 17
#define NATURAL_SMALL_TAB_BUTTON_HEIGHT 20
#define NATURAL_REGULAR_TAB_BUTTON_HEIGHT 23
nsIFrame*
nsNativeThemeCocoa::SeparatorResponsibility(nsIFrame* aBefore, nsIFrame* aAfter)
{
// Usually a separator is drawn by the segment to the right of the
// separator, but pressed and selected segments have higher priority.
if (!aBefore || !aAfter)
return nsnull;
if (IsSelectedButton(aAfter))
return aAfter;
if (IsSelectedButton(aBefore) || IsPressedButton(aBefore))
return aBefore;
return aAfter;
}
CGRect
nsNativeThemeCocoa::SeparatorAdjustedRect(CGRect aRect, nsIFrame* aLeft,
nsIFrame* aCurrent, nsIFrame* aRight)
{
// A separator between two segments should always be located in the leftmost
// pixel column of the segment to the right of the separator, regardless of
// who ends up drawing it.
// CoreUI draws the separators inside the drawing rect.
if (aLeft && SeparatorResponsibility(aLeft, aCurrent) == aLeft) {
// The left button draws the separator, so we need to make room for it.
aRect.origin.x += 1;
aRect.size.width -= 1;
}
if (SeparatorResponsibility(aCurrent, aRight) == aCurrent) {
// We draw the right separator, so we need to extend the draw rect into the
// segment to our right.
aRect.size.width += 1;
}
return aRect;
}
static NSString* ToolbarButtonPosition(BOOL aIsFirst, BOOL aIsLast)
{
if (aIsFirst) {
if (aIsLast)
return @"kCUISegmentPositionOnly";
return @"kCUISegmentPositionFirst";
}
if (aIsLast)
return @"kCUISegmentPositionLast";
return @"kCUISegmentPositionMiddle";
}
struct SegmentedControlRenderSettings {
const CGFloat* heights;
const NSString* widgetName;
const BOOL ignoresPressedWhenSelected;
const BOOL isToolbarControl;
};
static const CGFloat tabHeights[3] = { 17, 20, 23 };
static const SegmentedControlRenderSettings tabRenderSettings = {
tabHeights, @"tab", YES, NO
};
static const CGFloat toolbarButtonHeights[3] = { 15, 18, 22 };
static const SegmentedControlRenderSettings toolbarButtonRenderSettings = {
toolbarButtonHeights, @"kCUIWidgetButtonSegmentedSCurve", NO, YES
};
void
nsNativeThemeCocoa::DrawTab(CGContextRef cgContext, HIRect inBoxRect,
nsEventStates inState, nsIFrame* aFrame)
nsNativeThemeCocoa::DrawSegment(CGContextRef cgContext, const HIRect& inBoxRect,
nsEventStates inState, nsIFrame* aFrame,
const SegmentedControlRenderSettings& aSettings)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
HIThemeTabDrawInfo tdi;
tdi.version = 1;
tdi.kind = kHIThemeTabKindNormal;
PRBool isSelected = IsSelectedTab(aFrame);
PRBool isDisabled = IsDisabled(aFrame, inState);
if (isSelected) {
if (isDisabled)
tdi.style = kThemeTabFrontUnavailable;
else
tdi.style = FrameIsInActiveWindow(aFrame) ? kThemeTabFront : kThemeTabFrontInactive;
} else {
if (isDisabled)
tdi.style = kThemeTabNonFrontUnavailable;
else if (inState.HasAllStates(NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_HOVER))
tdi.style = kThemeTabNonFrontPressed;
else
tdi.style = FrameIsInActiveWindow(aFrame) ? kThemeTabNonFront : kThemeTabNonFrontInactive;
BOOL isActive = IsActive(aFrame, aSettings.isToolbarControl);
BOOL isFocused = inState.HasState(NS_EVENT_STATE_FOCUS);
BOOL isSelected = IsSelectedButton(aFrame);
BOOL isPressed = IsPressedButton(aFrame);
if (isSelected && aSettings.ignoresPressedWhenSelected) {
isPressed = NO;
}
tdi.direction = kThemeTabNorth;
tdi.size = kHIThemeTabSizeNormal;
if (inBoxRect.size.height < NATURAL_REGULAR_TAB_BUTTON_HEIGHT)
tdi.size = kHIThemeTabSizeSmall;
if (inBoxRect.size.height < NATURAL_SMALL_TAB_BUTTON_HEIGHT)
tdi.size = kHIThemeTabSizeMini;
BOOL isRTL = IsFrameRTL(aFrame);
nsIFrame* left = GetAdjacentSiblingFrameWithSameAppearance(aFrame, isRTL);
nsIFrame* right = GetAdjacentSiblingFrameWithSameAppearance(aFrame, !isRTL);
CGRect drawRect = SeparatorAdjustedRect(inBoxRect, left, aFrame, right);
BOOL drawLeftSeparator = SeparatorResponsibility(left, aFrame) == aFrame;
BOOL drawRightSeparator = SeparatorResponsibility(aFrame, right) == aFrame;
NSControlSize controlSize = FindControlSize(drawRect.size.height, aSettings.heights, 4.0f);
PRBool isRTL = IsFrameRTL(aFrame);
PRBool isFirst = isRTL ? IsLastTab(aFrame) : IsFirstTab(aFrame);
PRBool isLast = isRTL ? IsFirstTab(aFrame) : IsLastTab(aFrame);
if (isFirst && isLast)
tdi.position = kHIThemeTabPositionOnly;
else if (isFirst)
tdi.position = kHIThemeTabPositionFirst;
else if (isLast)
tdi.position = kHIThemeTabPositionLast;
else
tdi.position = kHIThemeTabPositionMiddle;
// Tab separator management:
// Normal tabs only draw their left separator, in the leftmost pixel row of
// their frame. Selected tabs additionally draw their right separator, outside
// of their frame. To prevent overlapping, the tab to the right of the
// selected tab shouldn't draw its left separator.
tdi.adornment = kHIThemeTabAdornmentNone;
if (isRTL ? IsBeforeSelectedTab(aFrame) : IsAfterSelectedTab(aFrame)) {
// On Leopard, the tab's left edge must be shifted 1px to the right.
// On Tiger, this happens automatically when no leading separator is drawn.
inBoxRect.origin.x += 1;
inBoxRect.size.width -= 1;
}
else {
tdi.adornment = kHIThemeTabAdornmentLeadingSeparator;
}
if (isSelected && !isLast) {
tdi.adornment |= kHIThemeTabAdornmentTrailingSeparator;
// On Tiger, the right separator is drawn outside of the frame.
// On Leopard, the right edge must be shifted 1px to the right.
inBoxRect.size.width += 1;
}
if (inState.HasState(NS_EVENT_STATE_FOCUS))
tdi.adornment |= kThemeAdornmentFocus;
HIThemeDrawTab(&inBoxRect, &tdi, cgContext, HITHEME_ORIENTATION, NULL);
NS_OBJC_END_TRY_ABORT_BLOCK;
CUIDraw([NSWindow coreUIRenderer], drawRect, cgContext,
(CFDictionaryRef)[NSDictionary dictionaryWithObjectsAndKeys:
aSettings.widgetName, @"widget",
ToolbarButtonPosition(!left, !right), @"kCUIPositionKey",
[NSNumber numberWithBool:drawLeftSeparator], @"kCUISegmentLeadingSeparatorKey",
[NSNumber numberWithBool:drawRightSeparator], @"kCUISegmentTrailingSeparatorKey",
[NSNumber numberWithBool:isSelected], @"value",
(isPressed ? @"pressed" : (isActive ? @"normal" : @"inactive")), @"state",
[NSNumber numberWithBool:isFocused], @"focus",
CUIControlSizeForCocoaSize(controlSize), @"size",
[NSNumber numberWithBool:YES], @"is.flipped",
@"up", @"direction",
nil],
nil);
}
static inline UInt8
@ -1596,73 +1636,30 @@ nsNativeThemeCocoa::DrawUnifiedToolbar(CGContextRef cgContext, const HIRect& inB
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
float titlebarHeight = [(ToolbarWindow*)aWindow titlebarHeight];
float unifiedHeight = titlebarHeight + inBoxRect.size.height;
BOOL isMain = [aWindow isMainWindow] || ![NSView focusView];
// Draw the gradient
UnifiedGradientInfo info = { titlebarHeight, inBoxRect.size.height, isMain, NO };
struct CGFunctionCallbacks callbacks = { 0, nsCocoaWindow::UnifiedShading, NULL };
CGFunctionRef function = CGFunctionCreate(&info, 1, NULL, 4, NULL, &callbacks);
float srcY = inBoxRect.origin.y;
float dstY = srcY + inBoxRect.size.height - 1;
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGShadingRef shading = CGShadingCreateAxial(colorSpace,
CGPointMake(0, srcY),
CGPointMake(0, dstY), function,
NO, NO);
CGColorSpaceRelease(colorSpace);
CGFunctionRelease(function);
CGContextSaveGState(cgContext);
CGContextClipToRect(cgContext, inBoxRect);
CGContextDrawShading(cgContext, shading);
CGShadingRelease(shading);
// Draw the border at the bottom of the toolbar.
CGRect borderRect = CGRectMake(inBoxRect.origin.x, inBoxRect.origin.y +
inBoxRect.size.height - 1.0f,
inBoxRect.size.width, 1.0f);
DrawNativeGreyColorInRect(cgContext, headerBorderGrey, borderRect, isMain);
CGRect drawRect = CGRectOffset(inBoxRect, 0, -titlebarHeight);
CUIDraw([NSWindow coreUIRenderer], drawRect, cgContext,
(CFDictionaryRef)[NSDictionary dictionaryWithObjectsAndKeys:
@"kCUIWidgetWindowFrame", @"widget",
@"regularwin", @"windowtype",
(isMain ? @"normal" : @"inactive"), @"state",
[NSNumber numberWithInt:unifiedHeight], @"kCUIWindowFrameUnifiedTitleBarHeightKey",
[NSNumber numberWithBool:YES], @"kCUIWindowFrameDrawTitleSeparatorKey",
[NSNumber numberWithBool:YES], @"is.flipped",
nil],
nil);
CGContextRestoreGState(cgContext);
NS_OBJC_END_TRY_ABORT_BLOCK;
}
struct GreyGradientInfo {
float startGrey;
float endGrey;
};
static void GreyGradientCallback(void* aInfo, const CGFloat* aIn, CGFloat* aOut)
{
GreyGradientInfo* info = static_cast<GreyGradientInfo*>(aInfo);
CGFloat result = (1.0f - *aIn) * info->startGrey + *aIn * info->endGrey;
aOut[0] = result;
aOut[1] = result;
aOut[2] = result;
aOut[3] = 1.0f;
}
static void DrawGreyGradient(CGContextRef cgContext, const HIRect& rect,
float startGrey, float endGrey)
{
if (rect.size.height <= 0.0f)
return;
GreyGradientInfo info = { startGrey, endGrey };
struct CGFunctionCallbacks callbacks = { 0, GreyGradientCallback, NULL };
CGFunctionRef function = CGFunctionCreate(&info, 1, NULL, 4, NULL, &callbacks);
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGShadingRef shading = CGShadingCreateAxial(colorSpace,
CGPointMake(0, CGRectGetMinY(rect)),
CGPointMake(0, CGRectGetMaxY(rect)),
function, false, false);
CGColorSpaceRelease(colorSpace);
CGFunctionRelease(function);
CGContextSaveGState(cgContext);
CGContextClipToRect(cgContext, rect);
CGContextDrawShading(cgContext, shading);
CGContextRestoreGState(cgContext);
CGShadingRelease(shading);
}
void
nsNativeThemeCocoa::DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRect,
nsIFrame *aFrame)
@ -1672,20 +1669,28 @@ nsNativeThemeCocoa::DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRec
if (inBoxRect.size.height < 2.0f)
return;
BOOL isMain = [NativeWindowForFrame(aFrame) isMainWindow] || ![NSView focusView];
CGContextSaveGState(cgContext);
CGContextClipToRect(cgContext, inBoxRect);
// Draw the borders at the top of the statusbar.
CGRect rect = CGRectMake(inBoxRect.origin.x, inBoxRect.origin.y,
inBoxRect.size.width, 1.0f);
DrawNativeGreyColorInRect(cgContext, statusbarFirstTopBorderGrey, rect, isMain);
rect.origin.y += 1.0f;
DrawNativeGreyColorInRect(cgContext, statusbarSecondTopBorderGrey, rect, isMain);
// kCUIWidgetWindowFrame draws a complete window frame with both title bar
// and bottom bar. We only want the bottom bar, so we extend the draw rect
// upwards to make space for the title bar, and then we clip it away.
CGRect drawRect = inBoxRect;
const int extendUpwards = 40;
drawRect.origin.y -= extendUpwards;
drawRect.size.height += extendUpwards;
CUIDraw([NSWindow coreUIRenderer], drawRect, cgContext,
(CFDictionaryRef)[NSDictionary dictionaryWithObjectsAndKeys:
@"kCUIWidgetWindowFrame", @"widget",
@"regularwin", @"windowtype",
(IsActive(aFrame, YES) ? @"normal" : @"inactive"), @"state",
[NSNumber numberWithInt:inBoxRect.size.height], @"kCUIWindowFrameBottomBarHeightKey",
[NSNumber numberWithBool:YES], @"kCUIWindowFrameDrawBottomBarSeparatorKey",
[NSNumber numberWithBool:YES], @"is.flipped",
nil],
nil);
// Draw the gradient.
DrawGreyGradient(cgContext, CGRectMake(inBoxRect.origin.x, inBoxRect.origin.y + 2.0f,
inBoxRect.size.width, inBoxRect.size.height - 2.0f),
NativeGreyColorAsFloat(statusbarGradientStartGrey, isMain),
NativeGreyColorAsFloat(statusbarGradientEndGrey, isMain));
CGContextRestoreGState(cgContext);
NS_OBJC_END_TRY_ABORT_BLOCK;
}
@ -1893,9 +1898,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
break;
case NS_THEME_TOOLBAR_BUTTON:
DrawButton(cgContext, kThemePushButton, macRect,
IsDefaultButton(aFrame), kThemeButtonOn, kThemeAdornmentNone,
eventState, aFrame);
DrawSegment(cgContext, macRect, eventState, aFrame, toolbarButtonRenderSettings);
break;
case NS_THEME_TOOLBAR_SEPARATOR: {
@ -1921,12 +1924,12 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
// background
drawRect.origin.y += drawRect.size.height;
drawRect.size.height = macRect.size.height - 2.0f;
DrawNativeGreyColorInRect(cgContext, headerEndGrey, drawRect, isMain);
DrawNativeGreyColorInRect(cgContext, toolbarFillGrey, drawRect, isMain);
// bottom border
drawRect.origin.y += drawRect.size.height;
drawRect.size.height = 1.0f;
DrawNativeGreyColorInRect(cgContext, headerBorderGrey, drawRect, isMain);
DrawNativeGreyColorInRect(cgContext, toolbarBottomBorderGrey, drawRect, isMain);
}
break;
@ -2142,7 +2145,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
break;
case NS_THEME_TAB:
DrawTab(cgContext, macRect, eventState, aFrame);
DrawSegment(cgContext, macRect, eventState, aFrame, tabRenderSettings);
break;
case NS_THEME_TAB_PANELS:
@ -2195,6 +2198,12 @@ nsNativeThemeCocoa::GetWidgetBorder(nsDeviceContext* aContext,
break;
}
case NS_THEME_TOOLBAR_BUTTON:
{
aResult->SizeTo(4, 1, 4, 1);
break;
}
case NS_THEME_CHECKBOX:
case NS_THEME_RADIO:
{
@ -2311,6 +2320,7 @@ nsNativeThemeCocoa::GetWidgetOverflow(nsDeviceContext* aContext, nsIFrame* aFram
{
switch (aWidgetType) {
case NS_THEME_BUTTON:
case NS_THEME_TOOLBAR_BUTTON:
case NS_THEME_TEXTFIELD:
case NS_THEME_TEXTFIELD_MULTILINE:
case NS_THEME_SEARCHFIELD:
@ -2361,6 +2371,12 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsRenderingContext* aContext,
break;
}
case NS_THEME_TOOLBAR_BUTTON:
{
aResult->SizeTo(0, toolbarButtonHeights[miniControlSize]);
break;
}
case NS_THEME_SPINNER:
{
SInt32 buttonHeight = 0, buttonWidth = 0;
@ -2421,7 +2437,7 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsRenderingContext* aContext,
case NS_THEME_TAB:
{
aResult->SizeTo(0, NATURAL_MINI_TAB_BUTTON_HEIGHT);
aResult->SizeTo(0, tabHeights[miniControlSize]);
break;
}
@ -2544,7 +2560,6 @@ nsNativeThemeCocoa::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
case NS_THEME_TOOLBOX:
case NS_THEME_TOOLBAR:
case NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR:
case NS_THEME_TOOLBAR_BUTTON:
case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL:
case NS_THEME_STATUSBAR:
@ -2630,6 +2645,7 @@ nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* a
case NS_THEME_GROUPBOX:
case NS_THEME_BUTTON:
case NS_THEME_BUTTON_BEVEL:
case NS_THEME_TOOLBAR_BUTTON:
case NS_THEME_SPINNER:
case NS_THEME_TOOLBAR:
case NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR:

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

@ -41,48 +41,51 @@
#include "nsToolkit.h"
#import <Cocoa/Cocoa.h>
extern "C" {
typedef CFTypeRef CUIRendererRef;
void CUIDraw(CUIRendererRef r, CGRect rect, CGContextRef ctx, CFDictionaryRef options, CFDictionaryRef* result);
}
@interface NSWindow(CoreUIRendererPrivate)
+ (CUIRendererRef)coreUIRenderer;
@end
enum ColorName {
headerStartGrey,
headerEndGrey,
headerBorderGrey,
toolbarTopBorderGrey,
statusbarFirstTopBorderGrey,
statusbarSecondTopBorderGrey,
statusbarGradientStartGrey,
statusbarGradientEndGrey
toolbarFillGrey,
toolbarBottomBorderGrey,
};
static const int sLeopardThemeColors[][2] = {
/* { active window, inactive window } */
// titlebar and toolbar:
{ 0xC5, 0xE9 }, // start grey
{ 0x96, 0xCA }, // end grey
{ 0x42, 0x89 }, // bottom separator line
// toolbar:
{ 0xC0, 0xE2 }, // top separator line
// statusbar:
{ 0x42, 0x86 }, // first top border
{ 0xD8, 0xEE }, // second top border
{ 0xBD, 0xE4 }, // gradient start
{ 0x96, 0xCF } // gradient end
{ 0x96, 0xCA }, // fill color
{ 0x42, 0x89 }, // bottom separator line
};
static const int sSnowLeopardThemeColors[][2] = {
/* { active window, inactive window } */
// titlebar and toolbar:
{ 0xD1, 0xEE }, // start grey
{ 0xA7, 0xD8 }, // end grey
{ 0x51, 0x99 }, // bottom separator line
// toolbar:
{ 0xD0, 0xF1 }, // top separator line
// statusbar:
{ 0x51, 0x99 }, // first top border
{ 0xE8, 0xF6 }, // second top border
{ 0xCB, 0xEA }, // gradient start
{ 0xA7, 0xDE } // gradient end
{ 0xA7, 0xD8 }, // fill color
{ 0x51, 0x99 }, // bottom separator line
};
static const int sLionThemeColors[][2] = {
/* { active window, inactive window } */
// toolbar:
{ 0xD0, 0xF0 }, // top separator line
{ 0xB2, 0xE1 }, // fill color
{ 0x59, 0x87 }, // bottom separator line
};
__attribute__((unused))
static int NativeGreyColorAsInt(ColorName name, BOOL isMain)
{
if (nsToolkit::OnLionOrLater())
return sLionThemeColors[name][isMain ? 0 : 1];
if (nsToolkit::OnSnowLeopardOrLater())
return sSnowLeopardThemeColors[name][isMain ? 0 : 1];

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

@ -83,7 +83,6 @@ protected:
CFRunLoopSourceRef mSleepWakeNotificationRLS;
io_object_t mPowerNotifier;
EventHandlerRef mEventMonitorHandler;
CFMachPortRef mEventTapPort;
CFRunLoopSourceRef mEventTapRLS;
};

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

@ -87,7 +87,6 @@ static PRUintn gToolkitTLSIndex = 0;
nsToolkit::nsToolkit()
: mInited(false)
, mSleepWakeNotificationRLS(nsnull)
, mEventMonitorHandler(nsnull)
, mEventTapPort(nsnull)
, mEventTapRLS(nsnull)
{
@ -202,18 +201,6 @@ nsToolkit::RemoveSleepWakeNotifcations()
NS_OBJC_END_TRY_ABORT_BLOCK;
}
// This is the callback used in RegisterForAllProcessMouseEvents.
static OSStatus EventMonitorHandler(EventHandlerCallRef aCaller, EventRef aEvent, void* aRefcon)
{
// Up to Mac OS 10.4 (or when building with the 10.4 SDK), installing a Carbon
// event handler like this one caused the OS to post the equivalent Cocoa
// events to [NSApp sendEvent:]. When using the 10.5 SDK, this doesn't happen
// any more, so we need to do it manually.
[NSApp sendEvent:[NSEvent eventWithEventRef:aEvent]];
return eventNotHandledErr;
}
// Converts aPoint from the CoreGraphics "global display coordinate" system
// (which includes all displays/screens and has a top-left origin) to its
// (presumed) Cocoa counterpart (assumed to be the same as the "screen
@ -275,12 +262,6 @@ nsToolkit::RegisterForAllProcessMouseEvents()
return;
#endif /* MOZ_USE_NATIVE_POPUP_WINDOWS */
if (!mEventMonitorHandler) {
EventTypeSpec kEvents[] = {{kEventClassMouse, kEventMouseMoved}};
InstallEventHandler(GetEventMonitorTarget(), EventMonitorHandler,
GetEventTypeCount(kEvents), kEvents, 0,
&mEventMonitorHandler);
}
if (!mEventTapRLS) {
// Using an event tap for mouseDown events (instead of installing a
// handler for them on the EventMonitor target) works around an Apple
@ -320,10 +301,6 @@ nsToolkit::UnregisterAllProcessMouseEventHandlers()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
if (mEventMonitorHandler) {
RemoveEventHandler(mEventMonitorHandler);
mEventMonitorHandler = nsnull;
}
if (mEventTapRLS) {
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), mEventTapRLS,
kCFRunLoopDefaultMode);

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

@ -207,6 +207,18 @@ nsNativeTheme::IsButtonTypeMenu(nsIFrame* aFrame)
NS_LITERAL_STRING("menu"), eCaseMatters);
}
PRBool
nsNativeTheme::IsPressedButton(nsIFrame* aFrame)
{
nsEventStates eventState = GetContentState(aFrame, NS_THEME_TOOLBAR_BUTTON);
if (IsDisabled(aFrame, eventState))
return PR_FALSE;
return IsOpenButton(aFrame) ||
eventState.HasAllStates(NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_HOVER);
}
PRBool
nsNativeTheme::GetIndeterminate(nsIFrame* aFrame)
{
@ -409,19 +421,6 @@ nsNativeTheme::IsFirstTab(nsIFrame* aFrame)
return PR_FALSE;
}
PRBool
nsNativeTheme::IsLastTab(nsIFrame* aFrame)
{
if (!aFrame)
return PR_FALSE;
while ((aFrame = aFrame->GetNextSibling())) {
if (aFrame->GetRect().width > 0 && aFrame->GetContent()->Tag() == nsWidgetAtoms::tab)
return PR_FALSE;
}
return PR_TRUE;
}
PRBool
nsNativeTheme::IsHorizontal(nsIFrame* aFrame)
{
@ -589,3 +588,25 @@ nsNativeTheme::Notify(nsITimer* aTimer)
mAnimatedContentTimeout = PR_UINT32_MAX;
return NS_OK;
}
nsIFrame*
nsNativeTheme::GetAdjacentSiblingFrameWithSameAppearance(nsIFrame* aFrame,
PRBool aNextSibling)
{
if (!aFrame)
return nsnull;
// Find the next visible sibling.
nsIFrame* sibling = aFrame;
do {
sibling = aNextSibling ? sibling->GetNextSibling() : sibling->GetPrevSibling();
} while (sibling && sibling->GetRect().width == 0);
// Check same appearance and adjacency.
if (!sibling ||
sibling->GetStyleDisplay()->mAppearance != aFrame->GetStyleDisplay()->mAppearance ||
(sibling->GetRect().XMost() != aFrame->GetRect().x &&
aFrame->GetRect().XMost() != sibling->GetRect().x))
return nsnull;
return sibling;
}

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

@ -145,10 +145,17 @@ class nsNativeTheme : public nsITimerCallback
return CheckBooleanAttr(aFrame, nsWidgetAtoms::checked);
}
PRBool IsSelectedButton(nsIFrame* aFrame) {
return CheckBooleanAttr(aFrame, nsWidgetAtoms::checked) ||
CheckBooleanAttr(aFrame, nsWidgetAtoms::selected);
}
PRBool IsOpenButton(nsIFrame* aFrame) {
return CheckBooleanAttr(aFrame, nsWidgetAtoms::open);
}
PRBool IsPressedButton(nsIFrame* aFrame);
// treeheadercell:
TreeSortDirection GetTreeSortDirection(nsIFrame* aFrame);
PRBool IsLastTreeHeaderCell(nsIFrame* aFrame);
@ -156,7 +163,6 @@ class nsNativeTheme : public nsITimerCallback
// tab:
PRBool IsBottomTab(nsIFrame* aFrame);
PRBool IsFirstTab(nsIFrame* aFrame);
PRBool IsLastTab(nsIFrame* aFrame);
PRBool IsHorizontal(nsIFrame* aFrame);
@ -187,6 +193,9 @@ class nsNativeTheme : public nsITimerCallback
PRBool QueueAnimatedContentForRefresh(nsIContent* aContent,
PRUint32 aMinimumFrameRate);
nsIFrame* GetAdjacentSiblingFrameWithSameAppearance(nsIFrame* aFrame,
PRBool aNextSibling);
private:
PRUint32 mAnimatedContentTimeout;
nsCOMPtr<nsITimer> mAnimatedContentTimer;

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

@ -72,12 +72,14 @@
}
function onTestsFinished() {
clearTimeout(gAfterLoopExecution);
observe(window, eventMonitor, false);
observe(gRightWindow, eventMonitor, false);
observe(gPopup, eventMonitor, false);
gRightWindow.close();
var openerSimpleTest = window.opener.wrappedJSObject.SimpleTest;
window.close();
window.opener.wrappedJSObject.SimpleTest.finish();
openerSimpleTest.finish();
}
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
@ -128,6 +130,8 @@
var gExpectedEvents = [];
var gRightWindow = null, gPopup = null;
var gCurrentMouseX = 0, gCurrentMouseY = 0;
var gAfterLoopExecution = 0;
function testMouse(x, y, msg, elem, win, exp, flags, callback) {
clearExpectedEvents();
@ -137,14 +141,16 @@
gExpectedEvents.push(expEv);
});
printDebug("sending event: " + x + ", " + y + " (" + msg + ")\n");
gCurrentMouseX = x;
gCurrentMouseY = y;
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var utils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
utils.sendNativeMouseEvent(x, y, msg, flags || 0, elem);
SimpleTest.executeSoon(function () {
gAfterLoopExecution = setTimeout(function () {
clearExpectedEvents();
callback();
});
}, 0);
}
function eventListenOnce(elem, name, callback) {
@ -182,10 +188,15 @@
}
function processEvent(e) {
if (e.screenX != gCurrentMouseX || e.screenY != gCurrentMouseY) {
todo(false, "Oh no! Received a stray event from a confused tracking area. Aborting test.");
onTestsFinished();
return;
}
var expectedEvent = gExpectedEvents.shift();
if (!expectedEvent) {
ok(false, "received event I didn't expect: " + eventToString(e));
return true;
return;
}
if (e.type != expectedEvent.type) {
// Didn't get expectedEvent.
@ -306,6 +317,10 @@
{ type: "mouseup", target: rightElem },
{ type: "click", target: rightElem },
]],
// Move the mouse back over the left window, which is inactive.
[150, 170, NSMouseMoved, null, left, [
{ type: "mouseout", target: rightElem },
]],
// Now we're being sneaky. The left window is inactive, but *right*-clicks to it
// should still get through. Test that.
// Ideally we'd be bracketing that event with over and out events, too, but it
@ -327,7 +342,6 @@
// Still, mouseout and mouseover events should fire.
function raiseLeftWindow(callback) {
clearExpectedEvents();
gExpectedEvents.push({ screenX: 150, screenY: 170, type: "mouseout", target: rightElem });
gExpectedEvents.push({ screenX: 150, screenY: 170, type: "mouseover", target: leftElem });
focusAndThen(left, function () { SimpleTest.executeSoon(callback); });
},
@ -391,25 +405,20 @@
// Install the tooltip, but don't show it yet.
function setTooltip(callback) {
rightElem.setAttribute("tooltip", "tip");
callback();
},
// Move the mouse to trigger the appearance of the tooltip.
[410, 180, NSMouseMoved, null, right, [
{ type: "mousemove", target: rightElem },
]],
// Wait for the tooltip to appear.
function (callback) {
gExpectedEvents.push({ screenX: 410, screenY: 180, type: "mousemove", target: rightElem });
eventListenOnce(rightElem, "popupshown", callback);
gCurrentMouseX = 410;
gCurrentMouseY = 180;
var utils = right.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
utils.sendNativeMouseEvent(410, 180, NSMouseMoved, 0, null);
},
// Now the tooltip is visible.
// Move the mouse a little to the right, but send the event to the tooltip's
// widget, even though the mouse is not over the tooltip, because that's what
// Mac OS X does.
[411, 180, NSMouseMoved, tooltip, right, [
// Move the mouse a little to the right.
[411, 180, NSMouseMoved, null, right, [
{ type: "mousemove", target: rightElem },
]],
// Move another pixel. This time send the event to the right widget.
// However, that must not make a difference.
// Move another pixel.
[412, 180, NSMouseMoved, null, right, [
{ type: "mousemove", target: rightElem },
]],
@ -434,22 +443,21 @@
// Now we move the mouse over the part where the panel rect intersects the
// right window's rect. Since the panel is under the window, all the events
// should target the right window.
// Try with sending to three different targets.
[390, 170, NSMouseMoved, null, right, [
{ type: "mousemove", target: rightElem },
]],
[390, 171, NSMouseMoved, null, left, [
[390, 171, NSMouseMoved, null, right, [
{ type: "mousemove", target: rightElem },
]],
[391, 171, NSMouseMoved, panel, left, [
[391, 171, NSMouseMoved, null, right, [
{ type: "mousemove", target: rightElem },
]],
// Now move off the right window, so that the mouse is directly over the
// panel.
[260, 170, NSMouseMoved, null, left, [
[260, 170, NSMouseMoved, panel, left, [
{ type: "mouseout", target: rightElem },
]],
[260, 171, NSMouseMoved, null, left, [
[260, 171, NSMouseMoved, panel, left, [
]],
[261, 171, NSMouseMoved, panel, left, [
]],
@ -464,11 +472,11 @@
},
// Now mouse events should get through to the panel (which is now over the
// right window).
[387, 170, NSMouseMoved, null, right, [
[387, 170, NSMouseMoved, panel, left, [
{ type: "mouseover", target: panel },
{ type: "mousemove", target: panel },
]],
[387, 171, NSMouseMoved, null, left, [
[387, 171, NSMouseMoved, panel, left, [
{ type: "mousemove", target: panel },
]],
[388, 171, NSMouseMoved, panel, left, [
@ -486,12 +494,12 @@
// Last test for this part: Hit testing in the Canyon of Nowhere -
// the pixel row directly south of the panel, over the left window.
// Before bug 515003 we wrongly thought the mouse wasn't over any window.
[173, 200, NSMouseMoved, panel, left, [
[173, 200, NSMouseMoved, null, left, [
{ type: "mouseout", target: panel },
{ type: "mouseover", target: leftElem },
{ type: "mousemove", target: leftElem },
]],
[173, 201, NSMouseMoved, panel, left, [
[173, 201, NSMouseMoved, null, left, [
{ type: "mousemove", target: leftElem },
]],
@ -567,32 +575,28 @@
{ type: "mouseup", target: rightElem },
{ type: "click", target: rightElem },
]],
// Now we're being sneaky. The left window is inactive, but *right*-clicks to it
// should still get through. Test that.
// Ideally we'd be bracketing that event with over and out events, too, but it
// probably doesn't matter too much.
// Move the mouse back over the left window, which is inactive.
[150, 170, NSMouseMoved, null, left, [
{ type: "mouseout", target: rightElem },
{ type: "mouseover", target: leftElem },
{ type: "mousemove", target: leftElem },
]],
// Right-click it.
[150, 170, NSRightMouseDown, null, left, [
{ type: "mouseover", target: leftElem, shouldFireButDoesnt: true },
{ type: "mousedown", target: leftElem },
{ type: "mouseout", target: leftElem, shouldFireButDoesnt: true },
]],
// Let go of the mouse.
[150, 170, NSRightMouseUp, null, left, [
{ type: "mouseover", target: leftElem, shouldFireButDoesnt: true },
{ type: "mouseup", target: leftElem },
{ type: "click", target: leftElem },
{ type: "mouseout", target: leftElem, shouldFireButDoesnt: true },
]],
// Right clicking hasn't focused it, so the window is still inactive.
// Let's focus it; this time without the mouse, for variaton's sake.
// Still, mouseout and mouseover events should fire.
function raiseLeftWindow(callback) {
clearExpectedEvents();
gExpectedEvents.push({ screenX: 150, screenY: 170, type: "mouseout", target: rightElem });
gExpectedEvents.push({ screenX: 150, screenY: 170, type: "mouseover", target: leftElem });
focusAndThen(left, function () { SimpleTest.executeSoon(callback); });
},
// It's active, so it should respond to mousemove events now.
// It's active and should still respond to mousemove events.
[150, 170, NSMouseMoved, null, left, [
{ type: "mousemove", target: leftElem },
]],
@ -653,27 +657,22 @@
// Time for our next trick: a tooltip!
// Install the tooltip, but don't show it yet.
function setTooltip(callback) {
function setTooltip2(callback) {
rightElem.setAttribute("tooltip", "tip");
callback();
},
// Move the mouse to trigger the appearance of the tooltip.
[410, 180, NSMouseMoved, null, right, [
{ type: "mousemove", target: rightElem },
]],
// Wait for the tooltip to appear.
function (callback) {
gExpectedEvents.push({ screenX: 410, screenY: 180, type: "mousemove", target: rightElem });
eventListenOnce(rightElem, "popupshown", callback);
gCurrentMouseX = 410;
gCurrentMouseY = 180;
var utils = right.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
utils.sendNativeMouseEvent(410, 180, NSMouseMoved, 0, null);
},
// Now the tooltip is visible.
// Move the mouse a little to the right, but send the event to the tooltip's
// widget, even though the mouse is not over the tooltip, because that's what
// Mac OS X does.
[411, 180, NSMouseMoved, tooltip, right, [
// Move the mouse a little to the right.
[411, 180, NSMouseMoved, null, right, [
{ type: "mousemove", target: rightElem },
]],
// Move another pixel. This time send the event to the right widget.
// However, that must not make a difference.
// Move another pixel.
[412, 180, NSMouseMoved, null, right, [
{ type: "mousemove", target: rightElem },
]],
@ -698,24 +697,23 @@
// Now we move the mouse over the part where the panel rect intersects the
// right window's rect. Since the panel is under the window, all the events
// should target the right window.
// Try with sending to three different targets.
[390, 170, NSMouseMoved, null, right, [
{ type: "mousemove", target: rightElem },
]],
[390, 171, NSMouseMoved, null, left, [
[390, 171, NSMouseMoved, null, right, [
{ type: "mousemove", target: rightElem },
]],
[391, 171, NSMouseMoved, panel, left, [
[391, 171, NSMouseMoved, null, right, [
{ type: "mousemove", target: rightElem },
]],
// Now move off the right window, so that the mouse is directly over the
// panel.
[260, 170, NSMouseMoved, null, left, [
[260, 170, NSMouseMoved, panel, left, [
{ type: "mouseout", target: rightElem },
{ type: "mouseover", target: panel },
{ type: "mousemove", target: panel },
]],
[260, 171, NSMouseMoved, null, left, [
[260, 171, NSMouseMoved, panel, left, [
{ type: "mousemove", target: panel },
]],
[261, 171, NSMouseMoved, panel, left, [
@ -733,10 +731,10 @@
function raiseLeftWindowTakeTwo(callback) {
focusAndThen(left, callback);
},
[387, 170, NSMouseMoved, null, right, [
[387, 170, NSMouseMoved, panel, left, [
{ type: "mousemove", target: panel },
]],
[387, 171, NSMouseMoved, null, left, [
[387, 171, NSMouseMoved, panel, left, [
{ type: "mousemove", target: panel },
]],
[388, 171, NSMouseMoved, panel, left, [
@ -754,12 +752,12 @@
// Last test for today: Hit testing in the Canyon of Nowhere -
// the pixel row directly south of the panel, over the left window.
// Before bug 515003 we wrongly thought the mouse wasn't over any window.
[173, 200, NSMouseMoved, panel, left, [
[173, 200, NSMouseMoved, null, left, [
{ type: "mouseout", target: panel },
{ type: "mouseover", target: leftElem },
{ type: "mousemove", target: leftElem },
]],
[173, 201, NSMouseMoved, panel, left, [
[173, 201, NSMouseMoved, null, left, [
{ type: "mousemove", target: leftElem },
]],
];

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

@ -56,7 +56,6 @@
#include "nsPIDOMWindow.h"
#include "nsIDOMEventTarget.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMFocusListener.h"
#include "nsIWebNavigation.h"
#include "nsIWindowWatcher.h"