2002-01-12 04:18:10 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2002-01-12 04:18:10 +03:00
|
|
|
|
|
|
|
#include "nsListItemFrame.h"
|
|
|
|
|
2014-08-06 09:19:27 +04:00
|
|
|
#include <algorithm>
|
|
|
|
|
2002-03-29 05:46:01 +03:00
|
|
|
#include "nsCOMPtr.h"
|
2014-02-28 03:04:46 +04:00
|
|
|
#include "nsNameSpaceManager.h"
|
2006-12-26 20:47:52 +03:00
|
|
|
#include "nsGkAtoms.h"
|
2006-01-26 05:29:17 +03:00
|
|
|
#include "nsDisplayList.h"
|
2011-07-11 18:05:10 +04:00
|
|
|
#include "nsBoxLayout.h"
|
2014-08-06 09:19:27 +04:00
|
|
|
#include "nsIContent.h"
|
2002-03-29 05:46:01 +03:00
|
|
|
|
2015-01-06 12:27:56 +03:00
|
|
|
nsListItemFrame::nsListItemFrame(nsStyleContext* aContext,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aIsRoot,
|
2011-07-11 18:05:10 +04:00
|
|
|
nsBoxLayout* aLayoutManager)
|
2015-01-06 12:27:56 +03:00
|
|
|
: nsGridRowLeafFrame(aContext, aIsRoot, aLayoutManager)
|
2002-01-12 04:18:10 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsListItemFrame::~nsListItemFrame()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-01-08 05:57:59 +03:00
|
|
|
nsSize
|
2016-04-21 07:28:31 +03:00
|
|
|
nsListItemFrame::GetXULPrefSize(nsBoxLayoutState& aState)
|
2002-01-12 04:18:10 +03:00
|
|
|
{
|
2016-04-21 07:28:31 +03:00
|
|
|
nsSize size = nsBoxFrame::GetXULPrefSize(aState);
|
2007-01-08 05:57:59 +03:00
|
|
|
DISPLAY_PREF_SIZE(this, size);
|
2002-01-12 04:18:10 +03:00
|
|
|
|
|
|
|
// guarantee that our preferred height doesn't exceed the standard
|
|
|
|
// listbox row height
|
2013-01-15 16:22:03 +04:00
|
|
|
size.height = std::max(mRect.height, size.height);
|
2007-01-08 05:57:59 +03:00
|
|
|
return size;
|
2002-01-12 04:18:10 +03:00
|
|
|
}
|
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
void
|
2006-01-26 05:29:17 +03:00
|
|
|
nsListItemFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists)
|
2002-03-29 05:46:01 +03:00
|
|
|
{
|
2006-01-26 05:29:17 +03:00
|
|
|
if (aBuilder->IsForEventDelivery()) {
|
2006-12-26 20:47:52 +03:00
|
|
|
if (!mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::allowevents,
|
|
|
|
nsGkAtoms::_true, eCaseMatters))
|
2013-02-14 15:12:27 +04:00
|
|
|
return;
|
2002-03-29 05:46:01 +03:00
|
|
|
}
|
2006-01-26 05:29:17 +03:00
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
nsGridRowLeafFrame::BuildDisplayListForChildren(aBuilder, aDirtyRect, aLists);
|
2002-03-29 05:46:01 +03:00
|
|
|
}
|
|
|
|
|
2002-01-12 04:18:10 +03:00
|
|
|
// Creation Routine ///////////////////////////////////////////////////////////////////////
|
|
|
|
|
2011-07-11 18:05:10 +04:00
|
|
|
already_AddRefed<nsBoxLayout> NS_NewGridRowLeafLayout();
|
2009-01-19 21:31:33 +03:00
|
|
|
|
2005-10-27 01:46:39 +04:00
|
|
|
nsIFrame*
|
2009-01-19 21:31:33 +03:00
|
|
|
NS_NewListItemFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
2002-01-12 04:18:10 +03:00
|
|
|
{
|
2011-07-11 18:05:10 +04:00
|
|
|
nsCOMPtr<nsBoxLayout> layout = NS_NewGridRowLeafLayout();
|
2009-01-19 21:31:33 +03:00
|
|
|
if (!layout) {
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2009-01-19 21:31:33 +03:00
|
|
|
}
|
|
|
|
|
2015-01-06 12:27:56 +03:00
|
|
|
return new (aPresShell) nsListItemFrame(aContext, false, layout);
|
2009-09-12 20:49:24 +04:00
|
|
|
}
|
2002-01-12 04:18:10 +03:00
|
|
|
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(nsListItemFrame)
|