This commit is contained in:
Olli Pettay 2008-12-03 13:11:34 +02:00
Родитель 78a6e12e83
Коммит bf95afc67c
3 изменённых файлов: 26 добавлений и 20 удалений

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

@ -4624,6 +4624,23 @@ nsTreeBodyFrame::FireInvalidateEvent(PRInt32 aStartRowIdx, PRInt32 aEndRowIdx,
}
#endif
class nsOverflowChecker : public nsRunnable
{
public:
nsOverflowChecker(nsTreeBodyFrame* aFrame) : mFrame(aFrame) {}
NS_IMETHOD Run()
{
if (mFrame.IsAlive()) {
nsTreeBodyFrame* tree = static_cast<nsTreeBodyFrame*>(mFrame.GetFrame());
nsTreeBodyFrame::ScrollParts parts = tree->GetScrollParts();
tree->CheckOverflow(parts);
}
return NS_OK;
}
private:
nsWeakFrame mFrame;
};
PRBool
nsTreeBodyFrame::FullScrollbarsUpdate(PRBool aNeedsFullInvalidation)
{
@ -4636,6 +4653,6 @@ nsTreeBodyFrame::FullScrollbarsUpdate(PRBool aNeedsFullInvalidation)
}
InvalidateScrollbars(parts);
NS_ENSURE_TRUE(weakFrame.IsAlive(), PR_FALSE);
CheckOverflow(parts);
nsContentUtils::AddScriptRunner(new nsOverflowChecker(this));
return weakFrame.IsAlive();
}

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

@ -63,6 +63,8 @@
#include "nsIScrollbarFrame.h"
#include "nsThreadUtils.h"
class nsOverflowChecker;
// An entry in the tree's image cache
struct nsTreeImageCacheEntry
{
@ -189,6 +191,8 @@ public:
nsITreeBoxObject* GetTreeBoxObject() const { return mTreeBoxObject; }
protected:
friend class nsOverflowChecker;
// This method paints a specific column background of the tree.
void PaintColumn(nsTreeColumn* aColumn,
const nsRect& aColumnRect,

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

@ -819,26 +819,11 @@ nsTreeSelection::FireOnSelectHandler()
return NS_ERROR_UNEXPECTED;
nsCOMPtr<nsIDOMElement> elt;
boxObject->GetElement(getter_AddRefs(elt));
NS_ENSURE_STATE(elt);
nsCOMPtr<nsIContent> content(do_QueryInterface(elt));
nsCOMPtr<nsIDocument> document = content->GetDocument();
// we might be firing on a delay, so it's possible in rare cases that
// the document may have been destroyed by the time it fires
if (!document)
return NS_OK;
nsIPresShell *shell = document->GetPrimaryShell();
if (shell) {
// Retrieve the context in which our DOM event will fire.
nsCOMPtr<nsPresContext> aPresContext = shell->GetPresContext();
nsEventStatus status = nsEventStatus_eIgnore;
nsEvent event(PR_TRUE, NS_FORM_SELECTED);
nsEventDispatcher::Dispatch(content, aPresContext, &event, nsnull, &status);
}
nsRefPtr<nsPLDOMEvent> event =
new nsPLDOMEvent(elt, NS_LITERAL_STRING("select"));
event->RunDOMEventWhenSafe();
return NS_OK;
}