зеркало из https://github.com/mozilla/gecko-dev.git
Bug 655263. Remove views from decks. r=roc
This commit is contained in:
Родитель
e13ceed986
Коммит
406398810f
|
@ -96,7 +96,7 @@ nsDeckFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
||||||
|
|
||||||
// if the index changed hide the old element and make the new element visible
|
// if the index changed hide the old element and make the new element visible
|
||||||
if (aAttribute == nsGkAtoms::selectedIndex) {
|
if (aAttribute == nsGkAtoms::selectedIndex) {
|
||||||
IndexChanged(PresContext());
|
IndexChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -114,68 +114,14 @@ nsDeckFrame::Init(nsIContent* aContent,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
CreateViewsForFrames(const nsFrameList& aFrames)
|
nsDeckFrame::HideBox(nsIBox* aBox)
|
||||||
{
|
{
|
||||||
for (nsFrameList::Enumerator f(aFrames); !f.AtEnd(); f.Next()) {
|
nsIPresShell::ClearMouseCapture(aBox);
|
||||||
nsContainerFrame::CreateViewForFrame(f.get(), true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDeckFrame::SetInitialChildList(ChildListID aListID,
|
|
||||||
nsFrameList& aChildList)
|
|
||||||
{
|
|
||||||
CreateViewsForFrames(aChildList);
|
|
||||||
return nsBoxFrame::SetInitialChildList(aListID, aChildList);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDeckFrame::AppendFrames(ChildListID aListID,
|
|
||||||
nsFrameList& aFrameList)
|
|
||||||
{
|
|
||||||
CreateViewsForFrames(aFrameList);
|
|
||||||
return nsBoxFrame::AppendFrames(aListID, aFrameList);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDeckFrame::InsertFrames(ChildListID aListID,
|
|
||||||
nsIFrame* aPrevFrame,
|
|
||||||
nsFrameList& aFrameList)
|
|
||||||
{
|
|
||||||
CreateViewsForFrames(aFrameList);
|
|
||||||
return nsBoxFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsDeckFrame::HideBox(nsPresContext* aPresContext, nsIBox* aBox)
|
nsDeckFrame::IndexChanged()
|
||||||
{
|
|
||||||
nsIView* view = aBox->GetView();
|
|
||||||
|
|
||||||
if (view) {
|
|
||||||
nsIViewManager* viewManager = view->GetViewManager();
|
|
||||||
viewManager->SetViewVisibility(view, nsViewVisibility_kHide);
|
|
||||||
viewManager->ResizeView(view, nsRect(0, 0, 0, 0));
|
|
||||||
|
|
||||||
nsIPresShell::ClearMouseCapture(aBox);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDeckFrame::ShowBox(nsPresContext* aPresContext, nsIBox* aBox)
|
|
||||||
{
|
|
||||||
nsRect rect = aBox->GetRect();
|
|
||||||
nsIView* view = aBox->GetView();
|
|
||||||
if (view) {
|
|
||||||
nsIViewManager* viewManager = view->GetViewManager();
|
|
||||||
rect.x = rect.y = 0;
|
|
||||||
viewManager->ResizeView(view, rect);
|
|
||||||
viewManager->SetViewVisibility(view, nsViewVisibility_kShow);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsDeckFrame::IndexChanged(nsPresContext* aPresContext)
|
|
||||||
{
|
{
|
||||||
//did the index change?
|
//did the index change?
|
||||||
PRInt32 index = GetSelectedIndex();
|
PRInt32 index = GetSelectedIndex();
|
||||||
|
@ -188,14 +134,9 @@ nsDeckFrame::IndexChanged(nsPresContext* aPresContext)
|
||||||
// hide the currently showing box
|
// hide the currently showing box
|
||||||
nsIBox* currentBox = GetSelectedBox();
|
nsIBox* currentBox = GetSelectedBox();
|
||||||
if (currentBox) // only hide if it exists
|
if (currentBox) // only hide if it exists
|
||||||
HideBox(aPresContext, currentBox);
|
HideBox(currentBox);
|
||||||
|
|
||||||
mIndex = index;
|
mIndex = index;
|
||||||
|
|
||||||
// show the new box
|
|
||||||
nsIBox* newBox = GetSelectedBox();
|
|
||||||
if (newBox) // only show if it exists
|
|
||||||
ShowBox(aPresContext, newBox);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32
|
PRInt32
|
||||||
|
@ -271,10 +212,8 @@ nsDeckFrame::DoLayout(nsBoxLayoutState& aState)
|
||||||
while (box)
|
while (box)
|
||||||
{
|
{
|
||||||
// make collapsed children not show up
|
// make collapsed children not show up
|
||||||
if (count == mIndex)
|
if (count != mIndex)
|
||||||
ShowBox(aState.PresContext(), box);
|
HideBox(box);
|
||||||
else
|
|
||||||
HideBox(aState.PresContext(), box);
|
|
||||||
|
|
||||||
box = box->GetNextBox();
|
box = box->GetNextBox();
|
||||||
count++;
|
count++;
|
||||||
|
|
|
@ -76,16 +76,6 @@ public:
|
||||||
nsIFrame* aParent,
|
nsIFrame* aParent,
|
||||||
nsIFrame* aPrevInFlow);
|
nsIFrame* aPrevInFlow);
|
||||||
|
|
||||||
// Override SetInitialChildList/AppendFrames/InsertFrames to
|
|
||||||
// create views for our child frames if necessary
|
|
||||||
NS_IMETHOD SetInitialChildList(ChildListID aListID,
|
|
||||||
nsFrameList& aChildList);
|
|
||||||
NS_IMETHOD AppendFrames(ChildListID aListID,
|
|
||||||
nsFrameList& aFrameList);
|
|
||||||
NS_IMETHOD InsertFrames(ChildListID aListID,
|
|
||||||
nsIFrame* aPrevFrame,
|
|
||||||
nsFrameList& aFrameList);
|
|
||||||
|
|
||||||
virtual nsIAtom* GetType() const;
|
virtual nsIAtom* GetType() const;
|
||||||
|
|
||||||
#ifdef NS_DEBUG
|
#ifdef NS_DEBUG
|
||||||
|
@ -101,11 +91,9 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// REVIEW: Sorry, I couldn't resist devirtualizing these.
|
void IndexChanged();
|
||||||
void IndexChanged(nsPresContext* aPresContext);
|
|
||||||
PRInt32 GetSelectedIndex();
|
PRInt32 GetSelectedIndex();
|
||||||
void HideBox(nsPresContext* aPresContext, nsIBox* aBox);
|
void HideBox(nsIBox* aBox);
|
||||||
void ShowBox(nsPresContext* aPresContext, nsIBox* aBox);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче