1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "nsListItemFrame.h"
11 #include "nsNameSpaceManager.h"
12 #include "nsGkAtoms.h"
13 #include "nsDisplayList.h"
14 #include "nsBoxLayout.h"
15 #include "nsIContent.h"
17 nsListItemFrame::nsListItemFrame(nsIPresShell
* aPresShell
,
18 nsStyleContext
* aContext
,
20 nsBoxLayout
* aLayoutManager
)
21 : nsGridRowLeafFrame(aPresShell
, aContext
, aIsRoot
, aLayoutManager
)
25 nsListItemFrame::~nsListItemFrame()
30 nsListItemFrame::GetPrefSize(nsBoxLayoutState
& aState
)
32 nsSize size
= nsBoxFrame::GetPrefSize(aState
);
33 DISPLAY_PREF_SIZE(this, size
);
35 // guarantee that our preferred height doesn't exceed the standard
37 size
.height
= std::max(mRect
.height
, size
.height
);
42 nsListItemFrame::BuildDisplayListForChildren(nsDisplayListBuilder
* aBuilder
,
43 const nsRect
& aDirtyRect
,
44 const nsDisplayListSet
& aLists
)
46 if (aBuilder
->IsForEventDelivery()) {
47 if (!mContent
->AttrValueIs(kNameSpaceID_None
, nsGkAtoms::allowevents
,
48 nsGkAtoms::_true
, eCaseMatters
))
52 nsGridRowLeafFrame::BuildDisplayListForChildren(aBuilder
, aDirtyRect
, aLists
);
55 // Creation Routine ///////////////////////////////////////////////////////////////////////
57 already_AddRefed
<nsBoxLayout
> NS_NewGridRowLeafLayout();
60 NS_NewListItemFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
)
62 nsCOMPtr
<nsBoxLayout
> layout
= NS_NewGridRowLeafLayout();
67 return new (aPresShell
) nsListItemFrame(aPresShell
, aContext
, false, layout
);
70 NS_IMPL_FRAMEARENA_HELPERS(nsListItemFrame
)