зеркало из https://github.com/mozilla/gecko-dev.git
Bug 240276. Make <scrollbox> be implemented as a regular scrollframe rathern than a scrollboxframe. This will help us remove scrollboxframe. r+sr=dbaron
This commit is contained in:
Родитель
e5f3e4d347
Коммит
f3fe4fa48c
|
@ -5345,11 +5345,6 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||
rv = NS_NewPopupSetFrame(aPresShell, &newFrame);
|
||||
((nsPopupSetFrame*) newFrame)->SetFrameConstructor(this);
|
||||
}
|
||||
else if (aTag == nsXULAtoms::scrollbox) {
|
||||
rv = NS_NewScrollBoxFrame(aPresShell, &newFrame);
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
}
|
||||
else if (aTag == nsXULAtoms::iframe || aTag == nsXULAtoms::editor ||
|
||||
aTag == nsXULAtoms::browser) {
|
||||
isReplaced = PR_TRUE;
|
||||
|
|
|
@ -5345,11 +5345,6 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||
rv = NS_NewPopupSetFrame(aPresShell, &newFrame);
|
||||
((nsPopupSetFrame*) newFrame)->SetFrameConstructor(this);
|
||||
}
|
||||
else if (aTag == nsXULAtoms::scrollbox) {
|
||||
rv = NS_NewScrollBoxFrame(aPresShell, &newFrame);
|
||||
processChildren = PR_TRUE;
|
||||
isReplaced = PR_TRUE;
|
||||
}
|
||||
else if (aTag == nsXULAtoms::iframe || aTag == nsXULAtoms::editor ||
|
||||
aTag == nsXULAtoms::browser) {
|
||||
isReplaced = PR_TRUE;
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "nsIPresContext.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsIBox.h"
|
||||
|
||||
|
||||
|
@ -109,25 +110,46 @@ NS_IMETHODIMP nsScrollBoxObject::ScrollByLine(PRInt32 dlines)
|
|||
return scrollableView->ScrollByLines(0, dlines);
|
||||
}
|
||||
|
||||
// XUL <scrollbox> elements have a single box child element.
|
||||
// Get a pointer to that box.
|
||||
// Note that now that the <scrollbox> is just a regular box
|
||||
// with 'overflow:hidden', the boxobject's frame is an nsXULScrollFrame,
|
||||
// the <scrollbox>'s box frame is the scrollframe's "scrolled frame", and
|
||||
// the <scrollbox>'s child box is a child of that.
|
||||
static nsIBox* GetScrolledBox(nsBoxObject* aScrollBox) {
|
||||
nsIFrame* frame = aScrollBox->GetFrame();
|
||||
if (!frame)
|
||||
return nsnull;
|
||||
nsIScrollableFrame* scrollFrame;
|
||||
if (NS_FAILED(CallQueryInterface(frame, &scrollFrame))) {
|
||||
NS_WARNING("nsIScrollBoxObject attached to something that's not a scroll frame!");
|
||||
return nsnull;
|
||||
}
|
||||
nsIFrame* scrolledFrame;
|
||||
if (NS_FAILED(scrollFrame->GetScrolledFrame(frame->GetPresContext(), scrolledFrame)))
|
||||
return nsnull;
|
||||
nsIBox* scrollBox;
|
||||
if (NS_FAILED(CallQueryInterface(scrolledFrame, &scrollBox)))
|
||||
return nsnull;
|
||||
nsIBox* scrolledBox;
|
||||
if (NS_FAILED(scrollBox->GetChildBox(&scrolledBox)))
|
||||
return nsnull;
|
||||
return scrolledBox;
|
||||
}
|
||||
|
||||
/* void scrollByIndex (in long dindexes); */
|
||||
NS_IMETHODIMP nsScrollBoxObject::ScrollByIndex(PRInt32 dindexes)
|
||||
{
|
||||
nsIScrollableView* scrollableView = GetScrollableView();
|
||||
if (!scrollableView)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// get our box
|
||||
nsIFrame* frame = GetFrame();
|
||||
nsIBox* box;
|
||||
CallQueryInterface(frame, &box);
|
||||
nsIBox* scrolledBox = GetScrolledBox(this);
|
||||
if (!scrolledBox)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsRect rect;
|
||||
nsIBox* scrolledBox;
|
||||
nsIBox* child;
|
||||
|
||||
// get the scrolled box
|
||||
box->GetChildBox(&scrolledBox);
|
||||
|
||||
// now get the scrolled boxes first child.
|
||||
scrolledBox->GetChildBox(&child);
|
||||
|
||||
|
@ -217,16 +239,14 @@ NS_IMETHODIMP nsScrollBoxObject::ScrollToElement(nsIDOMElement *child)
|
|||
float pixelsToTwips = 0.0;
|
||||
pixelsToTwips = context->PixelsToTwips();
|
||||
|
||||
// get our box
|
||||
nsIFrame* frame = GetFrame();
|
||||
nsIBox *box;
|
||||
CallQueryInterface(frame, &box);
|
||||
nsIBox* scrolledBox = GetScrolledBox(this);
|
||||
if (!scrolledBox)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsRect rect, crect;
|
||||
nsIBox* scrolledBox;
|
||||
nsCOMPtr<nsIDOMXULElement> childDOMXULElement (do_QueryInterface(child));
|
||||
nsIBoxObject * childBoxObject;
|
||||
childDOMXULElement->GetBoxObject(&childBoxObject);
|
||||
childDOMXULElement->GetBoxObject(&childBoxObject);
|
||||
|
||||
PRInt32 x,y;
|
||||
childBoxObject->GetX(&x);
|
||||
|
@ -235,9 +255,6 @@ NS_IMETHODIMP nsScrollBoxObject::ScrollToElement(nsIDOMElement *child)
|
|||
rect.x = NSToIntRound(x * pixelsToTwips);
|
||||
rect.y = NSToIntRound(y * pixelsToTwips);
|
||||
|
||||
// get the scrolled box
|
||||
box->GetChildBox(&scrolledBox);
|
||||
|
||||
// TODO: make sure the child is inside the box
|
||||
|
||||
// get our current info
|
||||
|
@ -297,13 +314,11 @@ NS_IMETHODIMP nsScrollBoxObject::EnsureElementIsVisible(nsIDOMElement *child)
|
|||
float pixelsToTwips = 0.0;
|
||||
pixelsToTwips = context->PixelsToTwips();
|
||||
|
||||
// get our box
|
||||
nsIFrame* frame = GetFrame();
|
||||
nsIBox* box;
|
||||
CallQueryInterface(frame, &box);
|
||||
nsIBox* scrolledBox = GetScrolledBox(this);
|
||||
if (!scrolledBox)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsRect rect, crect;
|
||||
nsIBox* scrolledBox;
|
||||
nsCOMPtr<nsIDOMXULElement> childDOMXULElement (do_QueryInterface(child));
|
||||
nsIBoxObject * childBoxObject;
|
||||
childDOMXULElement->GetBoxObject(&childBoxObject);
|
||||
|
@ -319,9 +334,6 @@ NS_IMETHODIMP nsScrollBoxObject::EnsureElementIsVisible(nsIDOMElement *child)
|
|||
rect.width = NSToIntRound(width * pixelsToTwips);
|
||||
rect.height = NSToIntRound(height * pixelsToTwips);
|
||||
|
||||
// get the scrolled box
|
||||
box->GetChildBox(&scrolledBox);
|
||||
|
||||
// TODO: make sure the child is inside the box
|
||||
|
||||
// get our current info
|
||||
|
@ -378,12 +390,15 @@ nsScrollBoxObject::GetScrollableView()
|
|||
if (!frame)
|
||||
return nsnull;
|
||||
|
||||
nsIScrollableView* scrollingView;
|
||||
if (NS_SUCCEEDED(CallQueryInterface(frame->GetView(), &scrollingView))) {
|
||||
return scrollingView;
|
||||
}
|
||||
nsIScrollableFrame* scrollFrame;
|
||||
if (NS_FAILED(CallQueryInterface(frame, &scrollFrame)))
|
||||
return nsnull;
|
||||
|
||||
return nsnull;
|
||||
nsIScrollableView* scrollingView;
|
||||
if (NS_FAILED(scrollFrame->GetScrollableView(frame->GetPresContext(), &scrollingView)))
|
||||
return nsnull;
|
||||
|
||||
return scrollingView;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -838,6 +838,7 @@ scrollbar[value="hidden"] {
|
|||
|
||||
scrollbox {
|
||||
-moz-binding: url("chrome://global/content/bindings/scrollbox.xml#scrollbox");
|
||||
overflow:hidden ! important;
|
||||
}
|
||||
|
||||
arrowscrollbox {
|
||||
|
|
|
@ -731,6 +731,8 @@ scrollbar[value="hidden"] {
|
|||
|
||||
scrollbox {
|
||||
-moz-binding: url("chrome://global/content/bindings/scrollbox.xml#scrollbox");
|
||||
/* This makes it scrollable! */
|
||||
overflow:hidden ! important;
|
||||
}
|
||||
|
||||
arrowscrollbox {
|
||||
|
|
Загрузка…
Ссылка в новой задаче