diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 11f2f159604c..ebfcfa8cf135 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -2476,6 +2476,12 @@ nsDocShell::GetChildAt(PRInt32 aIndex, nsIDocShellTreeItem ** aChild) NS_WARN_IF_FALSE(aIndex >=0 && aIndex < mChildList.Count(), "index of child element is out of range!"); + if (aIndex < 0) { + printf("Don't be so negative!"); + } + else if (aIndex >= mChildList.Count()) { + printf("Don't be so unrealistic!"); + } nsIDocumentLoader* child = SafeChildAt(aIndex); NS_ENSURE_TRUE(child, NS_ERROR_UNEXPECTED); @@ -8345,16 +8351,8 @@ nsDocShell::SetCanvasHasFocus(PRBool aCanvasHasFocus) frame = frame->GetParent(); if (frame) { nsICanvasFrame* canvasFrame; - if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsICanvasFrame), (void**)&canvasFrame))) { - canvasFrame->SetHasFocus(aCanvasHasFocus); - - nsIViewManager* vm = presShell->GetViewManager(); - if (vm) { - vm->UpdateAllViews(NS_VMREFRESH_NO_SYNC); - } - - return NS_OK; - } + if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsICanvasFrame), (void**)&canvasFrame))) + return canvasFrame->SetHasFocus(aCanvasHasFocus); } } return NS_ERROR_FAILURE; diff --git a/layout/generic/nsHTMLFrame.cpp b/layout/generic/nsHTMLFrame.cpp index 9dddae091d41..a4288734d6f2 100644 --- a/layout/generic/nsHTMLFrame.cpp +++ b/layout/generic/nsHTMLFrame.cpp @@ -127,7 +127,7 @@ public: NS_IMETHOD ScrollPositionDidChange(nsIScrollableView* aScrollable, nscoord aX, nscoord aY); // nsICanvasFrame - NS_IMETHOD SetHasFocus(PRBool aHasFocus) { mDoPaintFocus = aHasFocus; return NS_OK; } + NS_IMETHOD SetHasFocus(PRBool aHasFocus); /** * Get the "type" of the frame @@ -263,6 +263,19 @@ CanvasFrame::ScrollPositionDidChange(nsIScrollableView* aScrollable, nscoord aX, return NS_OK; } +NS_IMETHODIMP +CanvasFrame::SetHasFocus(PRBool aHasFocus) +{ + if (mDoPaintFocus != aHasFocus) { + mDoPaintFocus = aHasFocus; + nsIViewManager* vm = GetPresContext()->PresShell()->GetViewManager(); + if (vm) { + vm->UpdateAllViews(NS_VMREFRESH_NO_SYNC); + } + } + return NS_OK; +} + NS_IMETHODIMP CanvasFrame::AppendFrames(nsIAtom* aListName, nsIFrame* aFrameList)