зеркало из https://github.com/mozilla/pjs.git
Fix for bug # 35011. window.onscroll and element.onscroll don't fire. r=joki sr=jst
This commit is contained in:
Родитель
dfc697974b
Коммит
a92780468c
|
@ -71,7 +71,7 @@
|
||||||
|
|
||||||
#include "nsIPrintPreviewContext.h"
|
#include "nsIPrintPreviewContext.h"
|
||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
|
#include "nsGUIEvent.h"
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
class nsGfxScrollFrameInner : public nsIDocumentObserver,
|
class nsGfxScrollFrameInner : public nsIDocumentObserver,
|
||||||
|
@ -890,6 +890,8 @@ nsGfxScrollFrameInner::AttributeChanged(nsIDocument *aDocument,
|
||||||
hframe->GetContent(getter_AddRefs(hcontent));
|
hframe->GetContent(getter_AddRefs(hcontent));
|
||||||
vframe->GetContent(getter_AddRefs(vcontent));
|
vframe->GetContent(getter_AddRefs(vcontent));
|
||||||
|
|
||||||
|
nsIFrame * targetFrame = nsnull;
|
||||||
|
nsCOMPtr<nsIContent> targetContent;
|
||||||
if (hcontent.get() == aContent || vcontent.get() == aContent)
|
if (hcontent.get() == aContent || vcontent.get() == aContent)
|
||||||
{
|
{
|
||||||
nscoord x = 0;
|
nscoord x = 0;
|
||||||
|
@ -902,6 +904,8 @@ nsGfxScrollFrameInner::AttributeChanged(nsIDocument *aDocument,
|
||||||
|
|
||||||
// convert it to an integer
|
// convert it to an integer
|
||||||
x = value.ToInteger(&error);
|
x = value.ToInteger(&error);
|
||||||
|
targetFrame = hframe;
|
||||||
|
targetContent = hcontent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_CONTENT_ATTR_HAS_VALUE == vcontent->GetAttr(kNameSpaceID_None, nsXULAtoms::curpos, value))
|
if (NS_CONTENT_ATTR_HAS_VALUE == vcontent->GetAttr(kNameSpaceID_None, nsXULAtoms::curpos, value))
|
||||||
|
@ -910,8 +914,23 @@ nsGfxScrollFrameInner::AttributeChanged(nsIDocument *aDocument,
|
||||||
|
|
||||||
// convert it to an integer
|
// convert it to an integer
|
||||||
y = value.ToInteger(&error);
|
y = value.ToInteger(&error);
|
||||||
|
targetFrame = vframe;
|
||||||
|
targetContent = vcontent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsScrollbarEvent event;
|
||||||
|
event.eventStructType = NS_SCROLLBAR_EVENT;
|
||||||
|
event.message = NS_SCROLL_EVENT;
|
||||||
|
event.flags = 0;
|
||||||
|
nsEventStatus status = nsEventStatus_eIgnore;
|
||||||
|
nsCOMPtr<nsIPresShell> presShell;
|
||||||
|
mOuter->mPresContext->GetShell(getter_AddRefs(presShell));
|
||||||
|
|
||||||
|
// Fire the onScroll event.
|
||||||
|
if (presShell && targetFrame && targetContent)
|
||||||
|
presShell->HandleEventWithTarget(&event, targetFrame, targetContent,
|
||||||
|
NS_EVENT_FLAG_INIT, &status);
|
||||||
|
|
||||||
nsIScrollableView* s = GetScrollableView(mOuter->mPresContext);
|
nsIScrollableView* s = GetScrollableView(mOuter->mPresContext);
|
||||||
s->RemoveScrollPositionListener(this);
|
s->RemoveScrollPositionListener(this);
|
||||||
ScrollbarChanged(mOuter->mPresContext, x*mOnePixel, y*mOnePixel);
|
ScrollbarChanged(mOuter->mPresContext, x*mOnePixel, y*mOnePixel);
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
|
|
||||||
#include "nsIPrintPreviewContext.h"
|
#include "nsIPrintPreviewContext.h"
|
||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
|
#include "nsGUIEvent.h"
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
class nsGfxScrollFrameInner : public nsIDocumentObserver,
|
class nsGfxScrollFrameInner : public nsIDocumentObserver,
|
||||||
|
@ -890,6 +890,8 @@ nsGfxScrollFrameInner::AttributeChanged(nsIDocument *aDocument,
|
||||||
hframe->GetContent(getter_AddRefs(hcontent));
|
hframe->GetContent(getter_AddRefs(hcontent));
|
||||||
vframe->GetContent(getter_AddRefs(vcontent));
|
vframe->GetContent(getter_AddRefs(vcontent));
|
||||||
|
|
||||||
|
nsIFrame * targetFrame = nsnull;
|
||||||
|
nsCOMPtr<nsIContent> targetContent;
|
||||||
if (hcontent.get() == aContent || vcontent.get() == aContent)
|
if (hcontent.get() == aContent || vcontent.get() == aContent)
|
||||||
{
|
{
|
||||||
nscoord x = 0;
|
nscoord x = 0;
|
||||||
|
@ -902,6 +904,8 @@ nsGfxScrollFrameInner::AttributeChanged(nsIDocument *aDocument,
|
||||||
|
|
||||||
// convert it to an integer
|
// convert it to an integer
|
||||||
x = value.ToInteger(&error);
|
x = value.ToInteger(&error);
|
||||||
|
targetFrame = hframe;
|
||||||
|
targetContent = hcontent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_CONTENT_ATTR_HAS_VALUE == vcontent->GetAttr(kNameSpaceID_None, nsXULAtoms::curpos, value))
|
if (NS_CONTENT_ATTR_HAS_VALUE == vcontent->GetAttr(kNameSpaceID_None, nsXULAtoms::curpos, value))
|
||||||
|
@ -910,8 +914,23 @@ nsGfxScrollFrameInner::AttributeChanged(nsIDocument *aDocument,
|
||||||
|
|
||||||
// convert it to an integer
|
// convert it to an integer
|
||||||
y = value.ToInteger(&error);
|
y = value.ToInteger(&error);
|
||||||
|
targetFrame = vframe;
|
||||||
|
targetContent = vcontent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsScrollbarEvent event;
|
||||||
|
event.eventStructType = NS_SCROLLBAR_EVENT;
|
||||||
|
event.message = NS_SCROLL_EVENT;
|
||||||
|
event.flags = 0;
|
||||||
|
nsEventStatus status = nsEventStatus_eIgnore;
|
||||||
|
nsCOMPtr<nsIPresShell> presShell;
|
||||||
|
mOuter->mPresContext->GetShell(getter_AddRefs(presShell));
|
||||||
|
|
||||||
|
// Fire the onScroll event.
|
||||||
|
if (presShell && targetFrame && targetContent)
|
||||||
|
presShell->HandleEventWithTarget(&event, targetFrame, targetContent,
|
||||||
|
NS_EVENT_FLAG_INIT, &status);
|
||||||
|
|
||||||
nsIScrollableView* s = GetScrollableView(mOuter->mPresContext);
|
nsIScrollableView* s = GetScrollableView(mOuter->mPresContext);
|
||||||
s->RemoveScrollPositionListener(this);
|
s->RemoveScrollPositionListener(this);
|
||||||
ScrollbarChanged(mOuter->mPresContext, x*mOnePixel, y*mOnePixel);
|
ScrollbarChanged(mOuter->mPresContext, x*mOnePixel, y*mOnePixel);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче