Bug 920377 part.11 Get rid of nsScrollPortEvent r=roc

This commit is contained in:
Masayuki Nakano
2013-09-27 15:20:56 +09:00
parent 27e96ea5aa
commit 517b713dad
6 changed files with 22 additions and 23 deletions

View File

@@ -619,10 +619,10 @@ nsDOMEvent::DuplicatePrivateData()
} }
case NS_SCROLLPORT_EVENT: case NS_SCROLLPORT_EVENT:
{ {
nsScrollPortEvent* oldScrollPortEvent = InternalScrollPortEvent* oldScrollPortEvent =
static_cast<nsScrollPortEvent*>(mEvent); static_cast<InternalScrollPortEvent*>(mEvent);
nsScrollPortEvent* scrollPortEvent = InternalScrollPortEvent* scrollPortEvent =
new nsScrollPortEvent(false, msg, nullptr); new InternalScrollPortEvent(false, msg, nullptr);
scrollPortEvent->AssignScrollPortEventData(*oldScrollPortEvent, true); scrollPortEvent->AssignScrollPortEventData(*oldScrollPortEvent, true);
newEvent = scrollPortEvent; newEvent = scrollPortEvent;
break; break;

View File

@@ -52,7 +52,8 @@ nsDOMUIEvent::nsDOMUIEvent(mozilla::dom::EventTarget* aOwner,
case NS_SCROLLPORT_EVENT: case NS_SCROLLPORT_EVENT:
{ {
nsScrollPortEvent* scrollEvent = static_cast<nsScrollPortEvent*>(mEvent); InternalScrollPortEvent* scrollEvent =
static_cast<InternalScrollPortEvent*>(mEvent);
mDetail = (int32_t)scrollEvent->orient; mDetail = (int32_t)scrollEvent->orient;
break; break;
} }

View File

@@ -2753,14 +2753,14 @@ nsGfxScrollFrameInner::FireScrollPortEvent()
// DOM event. // DOM event.
bool both = vertChanged && horizChanged && bool both = vertChanged && horizChanged &&
newVerticalOverflow == newHorizontalOverflow; newVerticalOverflow == newHorizontalOverflow;
nsScrollPortEvent::orientType orient; InternalScrollPortEvent::orientType orient;
if (both) { if (both) {
orient = nsScrollPortEvent::both; orient = InternalScrollPortEvent::both;
mHorizontalOverflow = newHorizontalOverflow; mHorizontalOverflow = newHorizontalOverflow;
mVerticalOverflow = newVerticalOverflow; mVerticalOverflow = newVerticalOverflow;
} }
else if (vertChanged) { else if (vertChanged) {
orient = nsScrollPortEvent::vertical; orient = InternalScrollPortEvent::vertical;
mVerticalOverflow = newVerticalOverflow; mVerticalOverflow = newVerticalOverflow;
if (horizChanged) { if (horizChanged) {
// We need to dispatch a separate horizontal DOM event. Do that the next // We need to dispatch a separate horizontal DOM event. Do that the next
@@ -2770,15 +2770,14 @@ nsGfxScrollFrameInner::FireScrollPortEvent()
} }
} }
else { else {
orient = nsScrollPortEvent::horizontal; orient = InternalScrollPortEvent::horizontal;
mHorizontalOverflow = newHorizontalOverflow; mHorizontalOverflow = newHorizontalOverflow;
} }
nsScrollPortEvent event(true, InternalScrollPortEvent event(true,
(orient == nsScrollPortEvent::horizontal ? (orient == InternalScrollPortEvent::horizontal ? mHorizontalOverflow :
mHorizontalOverflow : mVerticalOverflow) ? mVerticalOverflow) ?
NS_SCROLLPORT_OVERFLOW : NS_SCROLLPORT_UNDERFLOW, NS_SCROLLPORT_OVERFLOW : NS_SCROLLPORT_UNDERFLOW, nullptr);
nullptr);
event.orient = orient; event.orient = orient;
return nsEventDispatcher::Dispatch(mOuter->GetContent(), return nsEventDispatcher::Dispatch(mOuter->GetContent(),
mOuter->PresContext(), &event); mOuter->PresContext(), &event);

View File

@@ -926,17 +926,18 @@ nsTreeBodyFrame::CheckOverflow(const ScrollParts& aParts)
nsCOMPtr<nsIContent> content = mContent; nsCOMPtr<nsIContent> content = mContent;
if (verticalOverflowChanged) { if (verticalOverflowChanged) {
nsScrollPortEvent event(true, mVerticalOverflow ? NS_SCROLLPORT_OVERFLOW InternalScrollPortEvent event(true,
: NS_SCROLLPORT_UNDERFLOW, nullptr); mVerticalOverflow ? NS_SCROLLPORT_OVERFLOW : NS_SCROLLPORT_UNDERFLOW,
event.orient = nsScrollPortEvent::vertical; nullptr);
event.orient = InternalScrollPortEvent::vertical;
nsEventDispatcher::Dispatch(content, presContext, &event); nsEventDispatcher::Dispatch(content, presContext, &event);
} }
if (horizontalOverflowChanged) { if (horizontalOverflowChanged) {
nsScrollPortEvent event(true, InternalScrollPortEvent event(true,
mHorizontalOverflow ? NS_SCROLLPORT_OVERFLOW mHorizontalOverflow ? NS_SCROLLPORT_OVERFLOW : NS_SCROLLPORT_UNDERFLOW,
: NS_SCROLLPORT_UNDERFLOW, nullptr); nullptr);
event.orient = nsScrollPortEvent::horizontal; event.orient = InternalScrollPortEvent::horizontal;
nsEventDispatcher::Dispatch(content, presContext, &event); nsEventDispatcher::Dispatch(content, presContext, &event);
} }

View File

@@ -249,6 +249,5 @@ public:
// TODO: Remove following typedefs // TODO: Remove following typedefs
typedef mozilla::InternalScriptErrorEvent nsScriptErrorEvent; typedef mozilla::InternalScriptErrorEvent nsScriptErrorEvent;
typedef mozilla::InternalScrollPortEvent nsScrollPortEvent;
#endif // mozilla_ContentEvents_h__ #endif // mozilla_ContentEvents_h__

View File

@@ -129,6 +129,5 @@ typedef mozilla::WidgetGestureNotifyEvent nsGestureNotifyEvent;
typedef mozilla::WidgetSimpleGestureEvent nsSimpleGestureEvent; typedef mozilla::WidgetSimpleGestureEvent nsSimpleGestureEvent;
typedef mozilla::WidgetTouchEvent nsTouchEvent; typedef mozilla::WidgetTouchEvent nsTouchEvent;
typedef mozilla::InternalScriptErrorEvent nsScriptErrorEvent; typedef mozilla::InternalScriptErrorEvent nsScriptErrorEvent;
typedef mozilla::InternalScrollPortEvent nsScrollPortEvent;
#endif // mozilla_EventForwards_h__ #endif // mozilla_EventForwards_h__