--- a/accessible/atk/XULListboxAccessibleWrap.h
+++ b/accessible/atk/XULListboxAccessibleWrap.h
@@ -8,14 +8,13 @@
#define mozilla_a11y_XULListboxAccessibleWrap_h__
#include "XULListboxAccessible.h"
namespace mozilla {
namespace a11y {
typedef class XULListboxAccessible XULListboxAccessibleWrap;
-typedef class XULListCellAccessible XULListCellAccessibleWrap;
} // namespace a11y
} // namespace mozilla
#endif
--- a/accessible/base/Role.h
+++ b/accessible/base/Role.h
@@ -196,18 +196,18 @@ enum Role {
COLUMN = 27,
/**
* Represents a row of cells within a table. Also, see TABLE.
*/
ROW = 28,
/**
- * Represents a cell within a table. It is used for html:td,
- * xul:tree cell and xul:listcell. Also, see TABLE.
+ * Represents a cell within a table. It is used for html:td and xul:tree cell.
+ * Also, see TABLE.
*/
CELL = 29,
/**
* Represents a link to something else. This object might look like text or
* a graphic, but it acts like a button. It is used for
* xul:label@class="text-link", html:a, html:area.
*/
--- a/accessible/base/XULMap.h
+++ b/accessible/base/XULMap.h
@@ -6,20 +6,17 @@ XULMAP_TYPE(browser, OuterDocAccessible)
XULMAP_TYPE(button, XULButtonAccessible)
XULMAP_TYPE(checkbox, XULCheckboxAccessible)
XULMAP_TYPE(description, XULLabelAccessible)
XULMAP_TYPE(dropMarker, XULDropmarkerAccessible)
XULMAP_TYPE(editor, OuterDocAccessible)
XULMAP_TYPE(findbar, XULToolbarAccessible)
XULMAP_TYPE(groupbox, XULGroupboxAccessible)
XULMAP_TYPE(iframe, OuterDocAccessible)
-XULMAP_TYPE(listbox, XULListboxAccessibleWrap)
-XULMAP_TYPE(listhead, XULColumAccessible)
-XULMAP_TYPE(listheader, XULColumnItemAccessible)
-XULMAP_TYPE(listitem, XULListitemAccessible)
+XULMAP_TYPE(listheader, XULColumAccessible)
XULMAP_TYPE(menu, XULMenuitemAccessibleWrap)
XULMAP_TYPE(menubar, XULMenubarAccessible)
XULMAP_TYPE(menucaption, XULMenuitemAccessibleWrap)
XULMAP_TYPE(menuitem, XULMenuitemAccessibleWrap)
XULMAP_TYPE(menulist, XULComboboxAccessible)
XULMAP_TYPE(menuseparator, XULMenuSeparatorAccessible)
XULMAP_TYPE(notification, XULAlertAccessible)
XULMAP_TYPE(progressmeter, XULProgressMeterAccessible)
@@ -78,36 +75,16 @@ XULMAP(
return nullptr;
}
return new ImageAccessibleWrap(aElement, aContext->Document());
}
)
XULMAP(
- listcell,
- [](Element* aElement, Accessible* aContext) -> Accessible* {
- // Only create cells if there's more than one per row.
- nsIContent* listItem = aElement->GetParent();
- if (!listItem) {
- return nullptr;
- }
-
- for (nsIContent* child = listItem->GetFirstChild(); child;
- child = child->GetNextSibling()) {
- if (child->IsXULElement(nsGkAtoms::listcell) && child != aElement) {
- return new XULListCellAccessibleWrap(aElement, aContext->Document());
- }
- }
-
- return nullptr;
- }
-)
-
-XULMAP(
menupopup,
[](Element* aElement, Accessible* aContext) {
return CreateMenupopupAccessible(aElement, aContext);
}
)
XULMAP(
panel,
--- a/accessible/interfaces/nsIAccessibleRole.idl
+++ b/accessible/interfaces/nsIAccessibleRole.idl
@@ -189,18 +189,18 @@ interface nsIAccessibleRole : nsISupport
const unsigned long ROLE_COLUMN = 27;
/**
* Represents a row of cells within a table. Also, see ROLE_TABLE.
*/
const unsigned long ROLE_ROW = 28;
/**
- * Represents a cell within a table. It is used for html:td,
- * xul:tree cell and xul:listcell. Also, see ROLE_TABLE.
+ * Represents a cell within a table. It is used for html:td and xul:tree cell.
+ * Also, see ROLE_TABLE.
*/
const unsigned long ROLE_CELL = 29;
/**
* Represents a link to something else. This object might look like text or
* a graphic, but it acts like a button. It is used for
* xul:label@class="text-link", html:a, html:area.
*/
--- a/accessible/mac/XULListboxAccessibleWrap.h
+++ b/accessible/mac/XULListboxAccessibleWrap.h
@@ -7,14 +7,13 @@
#define mozilla_a11y_XULListboxAccessibleWrap_h__
#include "XULListboxAccessible.h"
namespace mozilla {
namespace a11y {
typedef class XULListboxAccessible XULListboxAccessibleWrap;
-typedef class XULListCellAccessible XULListCellAccessibleWrap;
} // namespace a11y
} // namespace mozilla
#endif
--- a/accessible/other/XULListboxAccessibleWrap.h
+++ b/accessible/other/XULListboxAccessibleWrap.h
@@ -7,14 +7,13 @@
#define mozilla_a11y_XULListboxAccessibleWrap_h__
#include "XULListboxAccessible.h"
namespace mozilla {
namespace a11y {
typedef class XULListboxAccessible XULListboxAccessibleWrap;
-typedef class XULListCellAccessible XULListCellAccessibleWrap;
} // namespace a11y
} // namespace mozilla
#endif
--- a/accessible/windows/msaa/XULListboxAccessibleWrap.cpp
+++ b/accessible/windows/msaa/XULListboxAccessibleWrap.cpp
@@ -23,26 +23,8 @@ IMPL_IUNKNOWN_QUERY_CLASS(AccessibleWrap
IMPL_IUNKNOWN_QUERY_TAIL
void
XULListboxAccessibleWrap::Shutdown()
{
ia2AccessibleTable::mTable = nullptr;
XULListboxAccessible::Shutdown();
}
-
-////////////////////////////////////////////////////////////////////////////////
-// XULListCellAccessibleWrap
-////////////////////////////////////////////////////////////////////////////////
-
-NS_IMPL_ISUPPORTS_INHERITED0(XULListCellAccessibleWrap,
- XULListCellAccessible)
-
-IMPL_IUNKNOWN_INHERITED1(XULListCellAccessibleWrap,
- HyperTextAccessibleWrap,
- ia2AccessibleTableCell)
-
-void
-XULListCellAccessibleWrap::Shutdown()
-{
- ia2AccessibleTableCell::mTableCell = nullptr;
- XULListCellAccessible::Shutdown();
-}
--- a/accessible/windows/msaa/XULListboxAccessibleWrap.h
+++ b/accessible/windows/msaa/XULListboxAccessibleWrap.h
@@ -31,34 +31,12 @@ public:
DECL_IUNKNOWN_INHERITED
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
virtual void Shutdown() override;
};
-/**
- * IA2 wrapper class for XULListCellAccessible class, implements
- * IAccessibleTableCell interface.
- */
-class XULListCellAccessibleWrap : public XULListCellAccessible,
- public ia2AccessibleTableCell
-{
- ~XULListCellAccessibleWrap() {}
-
-public:
- XULListCellAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
- XULListCellAccessible(aContent, aDoc), ia2AccessibleTableCell(this) {}
-
- // IUnknown
- DECL_IUNKNOWN_INHERITED
-
- // nsISupports
- NS_DECL_ISUPPORTS_INHERITED
-
- virtual void Shutdown() override;
-};
-
} // namespace a11y
} // namespace mozilla
#endif
--- a/accessible/xul/XULListboxAccessible.cpp
+++ b/accessible/xul/XULListboxAccessible.cpp
@@ -163,37 +163,17 @@ XULListboxAccessible::NativeRole() const
}
////////////////////////////////////////////////////////////////////////////////
// XULListboxAccessible: Table
uint32_t
XULListboxAccessible::ColCount() const
{
- nsIContent* headContent = nullptr;
- for (nsIContent* childContent = mContent->GetFirstChild(); childContent;
- childContent = childContent->GetNextSibling()) {
- if (childContent->NodeInfo()->Equals(nsGkAtoms::listcols,
- kNameSpaceID_XUL)) {
- headContent = childContent;
- }
- }
- if (!headContent)
- return 0;
-
- uint32_t columnCount = 0;
- for (nsIContent* childContent = headContent->GetFirstChild(); childContent;
- childContent = childContent->GetNextSibling()) {
- if (childContent->NodeInfo()->Equals(nsGkAtoms::listcol,
- kNameSpaceID_XUL)) {
- columnCount++;
- }
- }
-
- return columnCount;
+ return 0;
}
uint32_t
XULListboxAccessible::RowCount()
{
nsCOMPtr<nsIDOMXULSelectControlElement> element(do_QueryInterface(mContent));
uint32_t itemCount = 0;
@@ -564,31 +544,21 @@ XULListitemAccessible::Description(nsStr
{
AccessibleWrap::Description(aDesc);
}
////////////////////////////////////////////////////////////////////////////////
// XULListitemAccessible: Accessible
/**
- * If there is a Listcell as a child ( not anonymous ) use it, otherwise
- * default to getting the name from GetXULName
- */
+ * Get the name from GetXULName.
+ */
ENameValueFlag
XULListitemAccessible::NativeName(nsString& aName) const
{
- nsIContent* childContent = mContent->GetFirstChild();
- if (childContent) {
- if (childContent->NodeInfo()->Equals(nsGkAtoms::listcell,
- kNameSpaceID_XUL)) {
- childContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
- return eNameOK;
- }
- }
-
return Accessible::NativeName(aName);
}
role
XULListitemAccessible::NativeRole() const
{
Accessible* list = GetListAccessible();
if (!list) {
@@ -654,151 +624,8 @@ XULListitemAccessible::ActionNameAt(uint
////////////////////////////////////////////////////////////////////////////////
// XULListitemAccessible: Widgets
Accessible*
XULListitemAccessible::ContainerWidget() const
{
return Parent();
}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// XULListCellAccessible
-////////////////////////////////////////////////////////////////////////////////
-
-XULListCellAccessible::
- XULListCellAccessible(nsIContent* aContent, DocAccessible* aDoc) :
- HyperTextAccessibleWrap(aContent, aDoc)
-{
- mGenericTypes |= eTableCell;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// nsISupports
-
-////////////////////////////////////////////////////////////////////////////////
-// XULListCellAccessible: TableCell
-
-TableAccessible*
-XULListCellAccessible::Table() const
-{
- Accessible* thisRow = Parent();
- if (!thisRow || thisRow->Role() != roles::ROW)
- return nullptr;
-
- Accessible* table = thisRow->Parent();
- if (!table || table->Role() != roles::TABLE)
- return nullptr;
-
- return table->AsTable();
-}
-
-uint32_t
-XULListCellAccessible::ColIdx() const
-{
- Accessible* row = Parent();
- if (!row)
- return 0;
-
- int32_t indexInRow = IndexInParent();
- uint32_t colIdx = 0;
- for (int32_t idx = 0; idx < indexInRow; idx++) {
- Accessible* cell = row->GetChildAt(idx);
- roles::Role role = cell->Role();
- if (role == roles::CELL || role == roles::GRID_CELL ||
- role == roles::ROWHEADER || role == roles::COLUMNHEADER)
- colIdx++;
- }
-
- return colIdx;
-}
-
-uint32_t
-XULListCellAccessible::RowIdx() const
-{
- Accessible* row = Parent();
- if (!row)
- return 0;
-
- Accessible* table = row->Parent();
- if (!table)
- return 0;
-
- int32_t indexInTable = row->IndexInParent();
- uint32_t rowIdx = 0;
- for (int32_t idx = 0; idx < indexInTable; idx++) {
- row = table->GetChildAt(idx);
- if (row->Role() == roles::ROW)
- rowIdx++;
- }
-
- return rowIdx;
-}
-
-void
-XULListCellAccessible::ColHeaderCells(nsTArray<Accessible*>* aCells)
-{
- TableAccessible* table = Table();
- NS_ASSERTION(table, "cell not in a table!");
- if (!table)
- return;
-
- // Get column header cell from XUL listhead.
- Accessible* list = nullptr;
-
- Accessible* tableAcc = table->AsAccessible();
- uint32_t tableChildCount = tableAcc->ChildCount();
- for (uint32_t childIdx = 0; childIdx < tableChildCount; childIdx++) {
- Accessible* child = tableAcc->GetChildAt(childIdx);
- if (child->Role() == roles::LIST) {
- list = child;
- break;
- }
- }
-
- if (list) {
- Accessible* headerCell = list->GetChildAt(ColIdx());
- if (headerCell) {
- aCells->AppendElement(headerCell);
- return;
- }
- }
-
- // No column header cell from XUL markup, try to get it from ARIA markup.
- TableCellAccessible::ColHeaderCells(aCells);
-}
-
-bool
-XULListCellAccessible::Selected()
-{
- TableAccessible* table = Table();
- NS_ENSURE_TRUE(table, false); // we expect to be in a listbox (table)
-
- return table->IsRowSelected(RowIdx());
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// XULListCellAccessible. Accessible implementation
-
-role
-XULListCellAccessible::NativeRole() const
-{
- return roles::CELL;
-}
-
-already_AddRefed<nsIPersistentProperties>
-XULListCellAccessible::NativeAttributes()
-{
- nsCOMPtr<nsIPersistentProperties> attributes =
- HyperTextAccessibleWrap::NativeAttributes();
-
- // "table-cell-index" attribute
- TableAccessible* table = Table();
- if (!table) // we expect to be in a listbox (table)
- return attributes.forget();
-
- nsAutoString stringIdx;
- stringIdx.AppendInt(table->CellIndexAt(RowIdx(), ColIdx()));
- nsAccUtils::SetAccAttr(attributes, nsGkAtoms::tableCellIndex, stringIdx);
-
- return attributes.forget();
-}
--- a/accessible/xul/XULListboxAccessible.h
+++ b/accessible/xul/XULListboxAccessible.h
@@ -14,31 +14,31 @@
#include "XULMenuAccessible.h"
#include "XULSelectControlAccessible.h"
namespace mozilla {
namespace a11y {
/**
* XULColumAccessible are accessible for list and tree columns elements
- * (xul:treecols and xul:listcols).
+ * (xul:treecols and xul:listheader).
*/
class XULColumAccessible : public AccessibleWrap
{
public:
XULColumAccessible(nsIContent* aContent, DocAccessible* aDoc);
// Accessible
virtual a11y::role NativeRole() const override;
virtual uint64_t NativeState() const override;
};
/**
* XULColumnItemAccessible are accessibles for list and tree column elements
- * (xul:listcol and xul:treecol).
+ * (xul:treecol).
*/
class XULColumnItemAccessible : public LeafAccessible
{
public:
XULColumnItemAccessible(nsIContent* aContent, DocAccessible* aDoc);
// Accessible
virtual a11y::role NativeRole() const override;
@@ -135,41 +135,12 @@ protected:
* Return listbox accessible for the listitem.
*/
Accessible* GetListAccessible() const;
private:
bool mIsCheckbox;
};
-/**
- * Class represents xul:listcell.
- */
-class XULListCellAccessible : public HyperTextAccessibleWrap,
- public TableCellAccessible
-{
-public:
- XULListCellAccessible(nsIContent* aContent, DocAccessible* aDoc);
-
- // nsISupports
- NS_INLINE_DECL_REFCOUNTING_INHERITED(XULListCellAccessible,
- HyperTextAccessibleWrap)
-
- // Accessible
- virtual TableCellAccessible* AsTableCell() override { return this; }
- virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() override;
- virtual a11y::role NativeRole() const override;
-
- // TableCellAccessible
- virtual TableAccessible* Table() const override;
- virtual uint32_t ColIdx() const override;
- virtual uint32_t RowIdx() const override;
- virtual void ColHeaderCells(nsTArray<Accessible*>* aHeaderCells) override;
- virtual bool Selected() override;
-
-protected:
- virtual ~XULListCellAccessible() {}
-};
-
} // namespace a11y
} // namespace mozilla
#endif
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -250,17 +250,16 @@
#include "mozilla/ServoStyleSet.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/dom/SVGDocument.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "mozilla/dom/DocGroup.h"
#include "mozilla/dom/TabGroup.h"
#ifdef MOZ_XUL
-#include "mozilla/dom/ListBoxObject.h"
#include "mozilla/dom/MenuBoxObject.h"
#include "mozilla/dom/TreeBoxObject.h"
#include "nsIXULWindow.h"
#include "nsIDocShellTreeOwner.h"
#endif
#include "nsIPresShellInlines.h"
#include "mozilla/DocLoadingTimelineMarker.h"
@@ -6356,18 +6355,16 @@ nsIDocument::GetBoxObjectFor(Element* aE
int32_t namespaceID;
RefPtr<nsAtom> tag = BindingManager()->ResolveTag(aElement, &namespaceID);
#ifdef MOZ_XUL
if (namespaceID == kNameSpaceID_XUL) {
if (tag == nsGkAtoms::menu) {
boxObject = new MenuBoxObject();
} else if (tag == nsGkAtoms::tree) {
boxObject = new TreeBoxObject();
- } else if (tag == nsGkAtoms::listbox) {
- boxObject = new ListBoxObject();
} else {
boxObject = new BoxObject();
}
} else
#endif // MOZ_XUL
{
boxObject = new BoxObject();
}
deleted file mode 100644
--- a/dom/webidl/ListBoxObject.webidl
+++ /dev/null
@@ -1,22 +0,0 @@
-
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/.
- */
-
-[NoInterfaceObject]
-interface ListBoxObject : BoxObject {
-
- long getRowCount();
- long getRowHeight();
- long getNumberOfVisibleRows();
- long getIndexOfFirstVisibleRow();
-
- void ensureIndexIsVisible(long rowIndex);
- void scrollToIndex(long rowIndex);
- void scrollByLines(long numLines);
-
- Element? getItemAtIndex(long index);
- long getIndexOfItem(Element item);
-};
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -628,17 +628,16 @@ WEBIDL_FILES = [
'KeyboardEvent.webidl',
'KeyEvent.webidl',
'KeyframeAnimationOptions.webidl',
'KeyframeEffect.webidl',
'KeyIdsInitData.webidl',
'L10nUtils.webidl',
'LegacyQueryInterface.webidl',
'LinkStyle.webidl',
- 'ListBoxObject.webidl',
'LocalMediaStream.webidl',
'Location.webidl',
'MediaCapabilities.webidl',
'MediaDeviceInfo.webidl',
'MediaDevices.webidl',
'MediaElementAudioSourceNode.webidl',
'MediaEncryptedEvent.webidl',
'MediaError.webidl',
--- a/dom/xul/nsXULElement.cpp
+++ b/dom/xul/nsXULElement.cpp
@@ -37,17 +37,16 @@
#include "mozilla/dom/Event.h"
#include "nsStyleConsts.h"
#include "nsString.h"
#include "nsXULControllers.h"
#include "nsIBoxObject.h"
#include "nsPIBoxObject.h"
#include "XULDocument.h"
#include "nsXULPopupListener.h"
-#include "ListBoxObject.h"
#include "nsContentUtils.h"
#include "nsContentList.h"
#include "mozilla/InternalMutationEvent.h"
#include "mozilla/MouseEvents.h"
#include "nsPIDOMWindow.h"
#include "nsJSPrincipals.h"
#include "nsDOMAttributeMap.h"
#include "nsGkAtoms.h"
@@ -442,17 +441,16 @@ nsXULElement::GetEventListenerManagerFor
return nsStyledElement::GetEventListenerManagerForAttr(aAttrName, aDefer);
}
// returns true if the element is not a list
static bool IsNonList(mozilla::dom::NodeInfo* aNodeInfo)
{
return !aNodeInfo->Equals(nsGkAtoms::tree) &&
- !aNodeInfo->Equals(nsGkAtoms::listbox) &&
!aNodeInfo->Equals(nsGkAtoms::richlistbox);
}
bool
nsXULElement::IsFocusableInternal(int32_t *aTabIndex, bool aWithMouse)
{
/*
* Returns true if an element may be focused, and false otherwise. The inout
@@ -790,108 +788,16 @@ nsXULElement::UnbindFromTree(bool aDeep,
if (slots) {
slots->mControllers = nullptr;
}
nsStyledElement::UnbindFromTree(aDeep, aNullParent);
}
void
-nsXULElement::RemoveChildNode(nsIContent* aKid, bool aNotify)
-{
- // On the removal of a <treeitem>, <treechildren>, or <treecell> element,
- // the possibility exists that some of the items in the removed subtree
- // are selected (and therefore need to be deselected). We need to account for this.
- nsCOMPtr<nsIDOMXULMultiSelectControlElement> controlElement;
- nsCOMPtr<nsIListBoxObject> listBox;
- bool fireSelectionHandler = false;
-
- // -1 = do nothing, -2 = null out current item
- // anything else = index to re-set as current
- int32_t newCurrentIndex = -1;
-
- if (aKid->NodeInfo()->Equals(nsGkAtoms::listitem, kNameSpaceID_XUL)) {
- // This is the nasty case. We have (potentially) a slew of selected items
- // and cells going away.
- // First, retrieve the tree.
- // Check first whether this element IS the tree
- controlElement = do_QueryObject(this);
-
- // If it's not, look at our parent
- if (!controlElement)
- GetParentTree(getter_AddRefs(controlElement));
- nsCOMPtr<nsIContent> controlContent(do_QueryInterface(controlElement));
- RefPtr<nsXULElement> xulElement = FromNodeOrNull(controlContent);
-
- if (xulElement) {
- // Iterate over all of the items and find out if they are contained inside
- // the removed subtree.
- int32_t length;
- controlElement->GetSelectedCount(&length);
- for (int32_t i = 0; i < length; i++) {
- nsCOMPtr<nsIDOMXULSelectControlItemElement> item;
- controlElement->MultiGetSelectedItem(i, getter_AddRefs(item));
- nsCOMPtr<nsINode> node = do_QueryInterface(item);
- if (node == aKid &&
- NS_SUCCEEDED(controlElement->RemoveItemFromSelection(item))) {
- length--;
- i--;
- fireSelectionHandler = true;
- }
- }
-
- nsCOMPtr<nsIDOMXULSelectControlItemElement> curItem;
- controlElement->GetCurrentItem(getter_AddRefs(curItem));
- nsCOMPtr<nsIContent> curNode = do_QueryInterface(curItem);
- if (curNode && nsContentUtils::ContentIsDescendantOf(curNode, aKid)) {
- // Current item going away
- nsCOMPtr<nsIBoxObject> box = xulElement->GetBoxObject(IgnoreErrors());
- listBox = do_QueryInterface(box);
- if (listBox) {
- listBox->GetIndexOfItem(aKid->AsElement(), &newCurrentIndex);
- }
-
- // If any of this fails, we'll just set the current item to null
- if (newCurrentIndex == -1)
- newCurrentIndex = -2;
- }
- }
- }
-
- nsStyledElement::RemoveChildNode(aKid, aNotify);
-
- if (newCurrentIndex == -2) {
- controlElement->SetCurrentItem(nullptr);
- } else if (newCurrentIndex > -1) {
- // Make sure the index is still valid
- int32_t treeRows;
- listBox->GetRowCount(&treeRows);
- if (treeRows > 0) {
- newCurrentIndex = std::min((treeRows - 1), newCurrentIndex);
- RefPtr<Element> newCurrentItem;
- listBox->GetItemAtIndex(newCurrentIndex, getter_AddRefs(newCurrentItem));
- nsCOMPtr<nsIDOMXULSelectControlItemElement> xulCurItem = do_QueryInterface(newCurrentItem);
- if (xulCurItem)
- controlElement->SetCurrentItem(xulCurItem);
- } else {
- controlElement->SetCurrentItem(nullptr);
- }
- }
-
- nsIDocument* doc;
- if (fireSelectionHandler && (doc = GetComposedDoc())) {
- nsContentUtils::DispatchTrustedEvent(doc,
- static_cast<nsIContent*>(this),
- NS_LITERAL_STRING("select"),
- CanBubble::eNo,
- Cancelable::eYes);
- }
-}
-
-void
nsXULElement::UnregisterAccessKey(const nsAString& aOldValue)
{
// If someone changes the accesskey, unregister the old one
//
nsIDocument* doc = GetComposedDoc();
if (doc && !aOldValue.IsEmpty()) {
nsIPresShell *shell = doc->GetShell();
@@ -1313,34 +1219,16 @@ nsXULElement::GetControllers(ErrorResult
already_AddRefed<BoxObject>
nsXULElement::GetBoxObject(ErrorResult& rv)
{
// XXX sXBL/XBL2 issue! Owner or current document?
return OwnerDoc()->GetBoxObjectFor(this, rv);
}
-NS_IMETHODIMP
-nsXULElement::GetParentTree(nsIDOMXULMultiSelectControlElement** aTreeElement)
-{
- for (nsIContent* current = GetParent(); current;
- current = current->GetParent()) {
- if (current->NodeInfo()->Equals(nsGkAtoms::listbox,
- kNameSpaceID_XUL)) {
- CallQueryInterface(current, aTreeElement);
- // XXX returning NS_OK because that's what the code used to do;
- // is that the right thing, though?
-
- return NS_OK;
- }
- }
-
- return NS_OK;
-}
-
void
nsXULElement::Click(CallerType aCallerType)
{
ClickWithInputSource(MouseEvent_Binding::MOZ_SOURCE_UNKNOWN,
aCallerType == CallerType::System);
}
void
--- a/dom/xul/nsXULElement.h
+++ b/dom/xul/nsXULElement.h
@@ -361,17 +361,16 @@ public:
void GetEventTargetParent(mozilla::EventChainPreVisitor& aVisitor) override;
virtual nsresult PreHandleEvent(
mozilla::EventChainVisitor& aVisitor) override;
// nsIContent
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
bool aCompileEventHandlers) override;
virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
- virtual void RemoveChildNode(nsIContent* aKid, bool aNotify) override;
virtual void DestroyContent() override;
#ifdef DEBUG
virtual void List(FILE* out, int32_t aIndent) const override;
virtual void DumpContent(FILE* out, int32_t aIndent,bool aDumpAll) const override
{
}
#endif
@@ -639,19 +638,16 @@ protected:
~nsXULElement();
// This can be removed if EnsureContentsGenerated dies.
friend class nsNSElementTearoff;
// Implementation methods
nsresult EnsureContentsGenerated(void) const;
- // Helper routine that crawls a parent chain looking for a tree element.
- NS_IMETHOD GetParentTree(nsIDOMXULMultiSelectControlElement** aTreeElement);
-
nsresult AddPopupListener(nsAtom* aName);
/**
* The nearest enclosing content node with a binding
* that created us.
*/
nsCOMPtr<nsIContent> mBindingParent;
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -223,19 +223,16 @@ static FrameCtorDebugFlags gFlags[] = {
#endif
#ifdef MOZ_XUL
#include "nsMenuFrame.h"
#include "nsPopupSetFrame.h"
#include "nsTreeColFrame.h"
#include "nsIBoxObject.h"
-#include "nsPIListBoxObject.h"
-#include "nsListBoxBodyFrame.h"
-#include "nsListItemFrame.h"
#include "nsXULLabelFrame.h"
//------------------------------------------------------------------
nsContainerFrame*
NS_NewRootBoxFrame (nsIPresShell* aPresShell, ComputedStyle* aStyle);
nsContainerFrame*
@@ -331,43 +328,16 @@ NS_NewImageFrameForGeneratedContentIndex
#ifdef NOISY_FINDFRAME
static int32_t FFWC_totalCount=0;
static int32_t FFWC_doLoop=0;
static int32_t FFWC_doSibling=0;
static int32_t FFWC_recursions=0;
static int32_t FFWC_nextInFlows=0;
#endif
-#ifdef MOZ_XUL
-
-static bool
-IsXULListBox(nsIContent* aContainer)
-{
- return aContainer->IsXULElement(nsGkAtoms::listbox);
-}
-
-static
-nsListBoxBodyFrame*
-MaybeGetListBoxBodyFrame(nsIContent* aChild)
-{
- if (aChild->IsXULElement(nsGkAtoms::listitem) && aChild->GetParent() &&
- IsXULListBox(aChild->GetParent())) {
- RefPtr<nsXULElement> xulElement =
- nsXULElement::FromNode(aChild->GetParent());
- nsCOMPtr<nsIBoxObject> boxObject = xulElement->GetBoxObject(IgnoreErrors());
- nsCOMPtr<nsPIListBoxObject> listBoxObject = do_QueryInterface(boxObject);
- if (listBoxObject) {
- return listBoxObject->GetListBoxBody(false);
- }
- }
-
- return nullptr;
-}
-#endif // MOZ_XUL
-
// Returns true if aFrame is an anonymous flex/grid item.
static inline bool
IsAnonymousFlexOrGridItem(const nsIFrame* aFrame)
{
const nsAtom* pseudoType = aFrame->Style()->GetPseudo();
return pseudoType == nsCSSAnonBoxes::anonymousFlexItem ||
pseudoType == nsCSSAnonBoxes::anonymousGridItem;
}
@@ -4340,19 +4310,16 @@ nsCSSFrameConstructor::FindXULTagData(El
SIMPLE_XUL_CREATE(menubar, NS_NewMenuBarFrame),
#endif /* XP_MACOSX */
SIMPLE_TAG_CHAIN(popupgroup, nsCSSFrameConstructor::FindPopupGroupData),
SIMPLE_XUL_CREATE(iframe, NS_NewSubDocumentFrame),
SIMPLE_XUL_CREATE(editor, NS_NewSubDocumentFrame),
SIMPLE_XUL_CREATE(browser, NS_NewSubDocumentFrame),
SIMPLE_XUL_CREATE(progressmeter, NS_NewProgressMeterFrame),
SIMPLE_XUL_CREATE(splitter, NS_NewSplitterFrame),
- SIMPLE_TAG_CHAIN(listboxbody,
- nsCSSFrameConstructor::FindXULListBoxBodyData),
- SIMPLE_TAG_CHAIN(listitem, nsCSSFrameConstructor::FindXULListItemData),
#endif /* MOZ_XUL */
SIMPLE_XUL_CREATE(slider, NS_NewSliderFrame),
SIMPLE_XUL_CREATE(scrollbar, NS_NewScrollbarFrame),
SIMPLE_XUL_CREATE(scrollbarbutton, NS_NewScrollbarButtonFrame)
};
return FindDataByTag(aTag, aElement, aComputedStyle, sXULTagData,
ArrayLength(sXULTagData));
@@ -4432,45 +4399,16 @@ nsCSSFrameConstructor::FindXULMenubarDat
}
static const FrameConstructionData sMenubarData =
SIMPLE_XUL_FCDATA(NS_NewMenuBarFrame);
return &sMenubarData;
}
#endif /* XP_MACOSX */
-/* static */
-const nsCSSFrameConstructor::FrameConstructionData*
-nsCSSFrameConstructor::FindXULListBoxBodyData(Element* aElement,
- ComputedStyle* aComputedStyle)
-{
- if (aComputedStyle->StyleDisplay()->mDisplay !=
- StyleDisplay::MozGridGroup) {
- return nullptr;
- }
-
- static const FrameConstructionData sListBoxBodyData =
- SCROLLABLE_XUL_FCDATA(NS_NewListBoxBodyFrame);
- return &sListBoxBodyData;
-}
-
-/* static */
-const nsCSSFrameConstructor::FrameConstructionData*
-nsCSSFrameConstructor::FindXULListItemData(Element* aElement,
- ComputedStyle* aComputedStyle)
-{
- if (aComputedStyle->StyleDisplay()->mDisplay != StyleDisplay::MozGridLine) {
- return nullptr;
- }
-
- static const FrameConstructionData sListItemData =
- SCROLLABLE_XUL_FCDATA(NS_NewListItemFrame);
- return &sListItemData;
-}
-
#endif /* MOZ_XUL */
/* static */
const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindXULDisplayData(const nsStyleDisplay* aDisplay,
Element* aElement,
ComputedStyle* aComputedStyle)
{
@@ -5512,23 +5450,19 @@ nsCSSFrameConstructor::ShouldCreateItems
nsContainerFrame* aParentFrame)
{
aContent->UnsetFlags(NODE_DESCENDANTS_NEED_FRAMES | NODE_NEEDS_FRAME);
// XXX the GetContent() != aContent check is needed due to bug 135040.
// Remove it once that's fixed.
if (aContent->GetPrimaryFrame() &&
aContent->GetPrimaryFrame()->GetContent() == aContent &&
!aState.mCreatingExtraFrames) {
- // This condition is known to be reachable for listitems, assert fatally
- // elsewhere.
- MOZ_ASSERT(MaybeGetListBoxBodyFrame(aContent),
+ MOZ_ASSERT(false,
"asked to create frame construction item for a node that "
"already has a frame");
- NS_ERROR("asked to create frame construction item for a node that already "
- "has a frame");
return false;
}
// don't create a whitespace frame if aParent doesn't want it
if (!NeedFrameFor(aState, aParentFrame, aContent)) {
return false;
}
@@ -6901,18 +6835,17 @@ nsCSSFrameConstructor::MaybeConstructLaz
void
nsCSSFrameConstructor::IssueSingleInsertNofications(nsIContent* aStartChild,
nsIContent* aEndChild,
InsertionKind aInsertionKind)
{
for (nsIContent* child = aStartChild;
child != aEndChild;
child = child->GetNextSibling()) {
- // listboxes suck.
- MOZ_ASSERT(MaybeGetListBoxBodyFrame(child) || !child->GetPrimaryFrame());
+ MOZ_ASSERT(!child->GetPrimaryFrame());
// Call ContentRangeInserted with this node.
ContentRangeInserted(child, child->GetNextSibling(),
mTempFrameTreeState, aInsertionKind);
}
}
bool
@@ -7352,54 +7285,16 @@ nsCSSFrameConstructor::ContentAppended(n
#ifdef ACCESSIBILITY
if (nsAccessibilityService* accService = nsIPresShell::AccService()) {
accService->ContentRangeInserted(mPresShell, aFirstNewContent, nullptr);
}
#endif
}
-#ifdef MOZ_XUL
-
-enum content_operation
-{
- CONTENT_INSERTED,
- CONTENT_REMOVED
-};
-
-// Helper function to lookup the listbox body frame and send a notification
-// for insertion or removal of content
-static bool
-NotifyListBoxBody(nsPresContext* aPresContext,
- nsIContent* aChild,
- // Only used for the removed notification
- nsIContent* aOldNextSibling,
- nsIFrame* aChildFrame,
- content_operation aOperation)
-{
- nsListBoxBodyFrame* listBoxBodyFrame = MaybeGetListBoxBodyFrame(aChild);
- if (listBoxBodyFrame) {
- if (aOperation == CONTENT_REMOVED) {
- // Except if we have an aChildFrame and its parent is not the right
- // thing, then we don't do this. Pseudo frames are so much fun....
- if (!aChildFrame || aChildFrame->GetParent() == listBoxBodyFrame) {
- listBoxBodyFrame->OnContentRemoved(aPresContext, aChild->GetParent(),
- aChildFrame, aOldNextSibling);
- return true;
- }
- } else {
- listBoxBodyFrame->OnContentInserted(aChild);
- return true;
- }
- }
-
- return false;
-}
-#endif // MOZ_XUL
-
void
nsCSSFrameConstructor::ContentInserted(nsIContent* aChild,
nsILayoutHistoryState* aFrameState,
InsertionKind aInsertionKind)
{
ContentRangeInserted(aChild,
aChild->GetNextSibling(),
aFrameState,
@@ -7468,35 +7363,16 @@ nsCSSFrameConstructor::ContentRangeInser
bool isSingleInsert = (aStartChild->GetNextSibling() == aEndChild);
NS_ASSERTION(isSingleInsert ||
aInsertionKind == InsertionKind::Sync,
"range insert shouldn't be lazy");
NS_ASSERTION(isSingleInsert || aEndChild,
"range should not include all nodes after aStartChild");
-#ifdef MOZ_XUL
- if (aStartChild->GetParent() && IsXULListBox(aStartChild->GetParent())) {
- if (isSingleInsert) {
- // The insert case in NotifyListBoxBody doesn't use "old next sibling".
- if (NotifyListBoxBody(mPresShell->GetPresContext(),
- aStartChild, nullptr, nullptr, CONTENT_INSERTED)) {
- return;
- }
- } else {
- // We don't handle a range insert to a listbox parent, issue single
- // ContertInserted calls for each node inserted.
- LAYOUT_PHASE_TEMP_EXIT();
- IssueSingleInsertNofications(aStartChild, aEndChild, InsertionKind::Sync);
- LAYOUT_PHASE_TEMP_REENTER();
- return;
- }
- }
-#endif // MOZ_XUL
-
// If we have a null parent, then this must be the document element being
// inserted, or some other child of the document in the DOM (might be a PI,
// say).
if (!aStartChild->GetParent()) {
MOZ_ASSERT(isSingleInsert,
"root node insertion should be a single insertion");
Element* docElement = mDocument->GetRootElement();
@@ -7955,23 +7831,16 @@ nsCSSFrameConstructor::ContentRemoved(ns
nsIFrame* childFrame = aChild->GetPrimaryFrame();
if (!childFrame || childFrame->GetContent() != aChild) {
// XXXbz the GetContent() != aChild check is needed due to bug 135040.
// Remove it once that's fixed.
childFrame = nullptr;
}
-#ifdef MOZ_XUL
- if (NotifyListBoxBody(presContext, aChild, aOldNextSibling,
- childFrame, CONTENT_REMOVED)) {
- return false;
- }
-#endif // MOZ_XUL
-
// If we're removing the root, then make sure to remove things starting at
// the viewport's child instead of the primary frame (which might even be
// null if the root had an XBL binding or display:none, even though the
// frames above it got created). Detecting removal of a root is a little
// exciting; in particular, having no parent is necessary but NOT sufficient.
// Due to how we process reframes, the content node might not even be in our
// document by now. So explicitly check whether the viewport's first kid's
// content node is aChild.
@@ -11132,85 +11001,16 @@ nsCSSFrameConstructor::RecoverLetterFram
// Insert in the letter frame(s)
parentFrame->InsertFrames(kPrincipalList, prevFrame, letterFrames);
}
}
//----------------------------------------------------------------------
-// listbox Widget Routines
-
-void
-nsCSSFrameConstructor::CreateListBoxContent(nsContainerFrame* aParentFrame,
- nsIFrame* aPrevFrame,
- nsIContent* aChild,
- nsIFrame** aNewFrame,
- bool aIsAppend)
-{
-#ifdef MOZ_XUL
- // Construct a new frame
- if (aParentFrame) {
- nsFrameItems frameItems;
- nsFrameConstructorState state(mPresShell,
- GetAbsoluteContainingBlock(aParentFrame, FIXED_POS),
- GetAbsoluteContainingBlock(aParentFrame, ABS_POS),
- GetFloatContainingBlock(aParentFrame),
- do_AddRef(mTempFrameTreeState));
-
- if (aChild->IsElement() && !aChild->AsElement()->HasServoData()) {
- mPresShell->StyleSet()->StyleNewSubtree(aChild->AsElement());
- }
-
- RefPtr<ComputedStyle> computedStyle = ResolveComputedStyle(aChild);
-
- // Pre-check for display "none" - only if we find that, do we create
- // any frame at all
- const nsStyleDisplay* display = computedStyle->StyleDisplay();
-
- if (StyleDisplay::None == display->mDisplay) {
- *aNewFrame = nullptr;
- return;
- }
-
- AutoFrameConstructionItemList items(this);
- AddFrameConstructionItemsInternal(state, aChild, aParentFrame,
- true, computedStyle,
- ITEM_ALLOW_XBL_BASE, nullptr, items);
- ConstructFramesFromItemList(state, items, aParentFrame,
- /* aParentIsWrapperAnonBox = */ false,
- frameItems);
-
- nsIFrame* newFrame = frameItems.FirstChild();
- *aNewFrame = newFrame;
-
- if (newFrame) {
- // Notify the parent frame
- if (aIsAppend)
- ((nsListBoxBodyFrame*)aParentFrame)->ListBoxAppendFrames(frameItems);
- else
- ((nsListBoxBodyFrame*)aParentFrame)->ListBoxInsertFrames(aPrevFrame, frameItems);
- }
-
-#ifdef ACCESSIBILITY
- if (newFrame) {
- nsAccessibilityService* accService = nsIPresShell::AccService();
- if (accService) {
- accService->ContentRangeInserted(mPresShell,
- aChild,
- aChild->GetNextSibling());
- }
- }
-#endif
- }
-#endif
-}
-
-//----------------------------------------
-
void
nsCSSFrameConstructor::ConstructBlock(nsFrameConstructorState& aState,
nsIContent* aContent,
nsContainerFrame* aParentFrame,
nsContainerFrame* aContentParentFrame,
ComputedStyle* aComputedStyle,
nsContainerFrame** aNewFrame,
nsFrameItems& aFrameItems,
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -344,22 +344,16 @@ public:
InsertionPoint GetInsertionPoint(nsIContent* aChild);
/**
* Return the insertion frame of the primary frame of aContent, or its nearest
* ancestor that isn't display:contents.
*/
nsContainerFrame* GetContentInsertionFrameFor(nsIContent* aContent);
- void CreateListBoxContent(nsContainerFrame* aParentFrame,
- nsIFrame* aPrevFrame,
- nsIContent* aChild,
- nsIFrame** aResult,
- bool aIsAppend);
-
// GetInitialContainingBlock() is deprecated in favor of GetRootElementFrame();
// nsIFrame* GetInitialContainingBlock() { return mRootElementFrame; }
// This returns the outermost frame for the root element
nsContainerFrame* GetRootElementFrame() { return mRootElementFrame; }
// This returns the frame for the root element that does not
// have a psuedo-element style
nsIFrame* GetRootElementStyleFrame() { return mRootElementStyleFrame; }
nsIFrame* GetPageSequenceFrame() { return mPageSequenceFrame; }
@@ -1560,20 +1554,16 @@ private:
static const FrameConstructionData*
FindXULLabelData(Element* aElement, ComputedStyle* aComputedStyle);
static const FrameConstructionData*
FindXULDescriptionData(Element* aElement, ComputedStyle* aComputedStyle);
#ifdef XP_MACOSX
static const FrameConstructionData*
FindXULMenubarData(Element* aElement, ComputedStyle* aComputedStyle);
#endif /* XP_MACOSX */
- static const FrameConstructionData*
- FindXULListBoxBodyData(Element* aElement, ComputedStyle* aComputedStyle);
- static const FrameConstructionData*
- FindXULListItemData(Element* aElement, ComputedStyle* aComputedStyle);
#endif /* MOZ_XUL */
// Function to find FrameConstructionData for aContent using one of the XUL
// display types. Will return null if aDisplay doesn't have a XUL display
// type. This function performs no other checks, so should only be called if
// we know for sure that the content is not something that should get a frame
// constructed by tag.
static const FrameConstructionData*
--- a/layout/build/nsLayoutCID.h
+++ b/layout/build/nsLayoutCID.h
@@ -14,20 +14,16 @@
/* a6cf90f9-15b3-11d2-932e-00805f8add32 */
#define NS_LAYOUT_DEBUGGER_CID \
{ 0xa6cf90f9, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
// {D750A964-2D14-484c-B3AA-8ED7823B5C7B}
#define NS_BOXOBJECT_CID \
{ 0xd750a964, 0x2d14, 0x484c, { 0xb3, 0xaa, 0x8e, 0xd7, 0x82, 0x3b, 0x5c, 0x7b } }
-// {C2710D40-6F4D-4b7f-9778-76AE5166648C}
-#define NS_LISTBOXOBJECT_CID \
-{ 0xc2710d40, 0x6f4d, 0x4b7f, { 0x97, 0x78, 0x76, 0xae, 0x51, 0x66, 0x64, 0x8c } }
-
// {AA40253B-4C42-4056-8132-37BCD07862FD}
#define NS_MENUBOXOBJECT_CID \
{ 0xaa40253b, 0x4c42, 0x4056, { 0x81, 0x32, 0x37, 0xbc, 0xd0, 0x78, 0x62, 0xfd } }
// {3B581FD4-3497-426c-8F61-3658B971CB80}
#define NS_TREEBOXOBJECT_CID \
{ 0x3b581fd4, 0x3497, 0x426c, { 0x8f, 0x61, 0x36, 0x58, 0xb9, 0x71, 0xcb, 0x80 } }
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -295,17 +295,16 @@ Shutdown()
#ifdef DEBUG
nsresult NS_NewLayoutDebugger(nsILayoutDebugger** aResult);
#endif
nsresult NS_NewBoxObject(nsIBoxObject** aResult);
#ifdef MOZ_XUL
-nsresult NS_NewListBoxObject(nsIBoxObject** aResult);
nsresult NS_NewMenuBoxObject(nsIBoxObject** aResult);
nsresult NS_NewTreeBoxObject(nsIBoxObject** aResult);
#endif
nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult);
already_AddRefed<nsIContentViewer> NS_NewContentViewer();
nsresult NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
@@ -356,17 +355,16 @@ ctor_(nsISupports* aOuter, REFNSIID aIID
#ifdef DEBUG
MAKE_CTOR(CreateNewLayoutDebugger, nsILayoutDebugger, NS_NewLayoutDebugger)
#endif
MAKE_CTOR(CreateNewFrameTraversal, nsIFrameTraversal, NS_CreateFrameTraversal)
MAKE_CTOR(CreateNewBoxObject, nsIBoxObject, NS_NewBoxObject)
#ifdef MOZ_XUL
-MAKE_CTOR(CreateNewListBoxObject, nsIBoxObject, NS_NewListBoxObject)
MAKE_CTOR(CreateNewMenuBoxObject, nsIBoxObject, NS_NewMenuBoxObject)
MAKE_CTOR(CreateNewTreeBoxObject, nsIBoxObject, NS_NewTreeBoxObject)
#endif // MOZ_XUL
NS_GENERIC_FACTORY_CONSTRUCTOR(inDeepTreeWalker)
MAKE_CTOR2(CreateContentViewer, nsIContentViewer, NS_NewContentViewer)
MAKE_CTOR(CreateHTMLDocument, nsIDocument, NS_NewHTMLDocument)
@@ -498,17 +496,16 @@ Construct_nsIScriptSecurityManager(nsISu
}
#ifdef DEBUG
NS_DEFINE_NAMED_CID(NS_LAYOUT_DEBUGGER_CID);
#endif
NS_DEFINE_NAMED_CID(NS_FRAMETRAVERSAL_CID);
NS_DEFINE_NAMED_CID(NS_BOXOBJECT_CID);
#ifdef MOZ_XUL
-NS_DEFINE_NAMED_CID(NS_LISTBOXOBJECT_CID);
NS_DEFINE_NAMED_CID(NS_MENUBOXOBJECT_CID);
NS_DEFINE_NAMED_CID(NS_TREEBOXOBJECT_CID);
#endif // MOZ_XUL
NS_DEFINE_NAMED_CID(IN_DEEPTREEWALKER_CID);
NS_DEFINE_NAMED_CID(NS_CONTENT_VIEWER_CID);
NS_DEFINE_NAMED_CID(NS_HTMLDOCUMENT_CID);
NS_DEFINE_NAMED_CID(NS_XMLDOCUMENT_CID);
NS_DEFINE_NAMED_CID(NS_SVGDOCUMENT_CID);
@@ -739,17 +736,16 @@ nsEditingCommandTableConstructor(nsISupp
static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
XPCONNECT_CIDENTRIES
#ifdef DEBUG
{ &kNS_LAYOUT_DEBUGGER_CID, false, nullptr, CreateNewLayoutDebugger },
#endif
{ &kNS_FRAMETRAVERSAL_CID, false, nullptr, CreateNewFrameTraversal },
{ &kNS_BOXOBJECT_CID, false, nullptr, CreateNewBoxObject },
#ifdef MOZ_XUL
- { &kNS_LISTBOXOBJECT_CID, false, nullptr, CreateNewListBoxObject },
{ &kNS_MENUBOXOBJECT_CID, false, nullptr, CreateNewMenuBoxObject },
{ &kNS_TREEBOXOBJECT_CID, false, nullptr, CreateNewTreeBoxObject },
#endif // MOZ_XUL
{ &kIN_DEEPTREEWALKER_CID, false, nullptr, inDeepTreeWalkerConstructor },
{ &kNS_CONTENT_VIEWER_CID, false, nullptr, CreateContentViewer },
{ &kNS_HTMLDOCUMENT_CID, false, nullptr, CreateHTMLDocument },
{ &kNS_XMLDOCUMENT_CID, false, nullptr, CreateXMLDocument },
{ &kNS_SVGDOCUMENT_CID, false, nullptr, CreateSVGDocument },
@@ -846,17 +842,16 @@ static const mozilla::Module::CIDEntry k
{ &kNS_SCRIPTERROR_CID, false, nullptr, nsScriptErrorConstructor },
{ nullptr }
};
static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
XPCONNECT_CONTRACTS
{ "@mozilla.org/layout/xul-boxobject;1", &kNS_BOXOBJECT_CID },
#ifdef MOZ_XUL
- { "@mozilla.org/layout/xul-boxobject-listbox;1", &kNS_LISTBOXOBJECT_CID },
{ "@mozilla.org/layout/xul-boxobject-menu;1", &kNS_MENUBOXOBJECT_CID },
{ "@mozilla.org/layout/xul-boxobject-tree;1", &kNS_TREEBOXOBJECT_CID },
#endif // MOZ_XUL
{ "@mozilla.org/inspector/deep-tree-walker;1", &kIN_DEEPTREEWALKER_CID },
{ "@mozilla.org/xml/xml-document;1", &kNS_XMLDOCUMENT_CID },
{ "@mozilla.org/svg/svg-document;1", &kNS_SVGDOCUMENT_CID },
{ "@mozilla.org/content/post-content-iterator;1", &kNS_CONTENTITERATOR_CID },
{ "@mozilla.org/content/pre-content-iterator;1", &kNS_PRECONTENTITERATOR_CID },
--- a/layout/generic/nsFrameIdList.h
+++ b/layout/generic/nsFrameIdList.h
@@ -41,19 +41,17 @@ FRAME_ID(nsHTMLFramesetBorderFrame, None
FRAME_ID(nsHTMLFramesetFrame, FrameSet, Leaf)
FRAME_ID(nsHTMLScrollFrame, Scroll, NotLeaf)
FRAME_ID(nsImageBoxFrame, ImageBox, Leaf)
FRAME_ID(nsImageControlFrame, ImageControl, Leaf)
FRAME_ID(nsImageFrame, Image, Leaf)
FRAME_ID(nsInlineFrame, Inline, NotLeaf)
FRAME_ID(nsLeafBoxFrame, LeafBox, Leaf)
FRAME_ID(nsLegendFrame, Legend, NotLeaf)
-FRAME_ID(nsListBoxBodyFrame, Box, NotLeaf)
FRAME_ID(nsListControlFrame, ListControl, NotLeaf)
-FRAME_ID(nsListItemFrame, Box, NotLeaf)
FRAME_ID(nsMathMLFrame, None, NotLeaf)
FRAME_ID(nsMathMLmactionFrame, None, NotLeaf)
FRAME_ID(nsMathMLmathBlockFrame, Block, NotLeaf)
FRAME_ID(nsMathMLmathInlineFrame, Inline, NotLeaf)
FRAME_ID(nsMathMLmencloseFrame, None, NotLeaf)
FRAME_ID(nsMathMLmfencedFrame, None, NotLeaf)
FRAME_ID(nsMathMLmfracFrame, None, NotLeaf)
FRAME_ID(nsMathMLmmultiscriptsFrame, None, NotLeaf)
deleted file mode 100644
--- a/layout/xul/ListBoxObject.cpp
+++ /dev/null
@@ -1,247 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#include "mozilla/dom/ListBoxObject.h"
-#include "nsCOMPtr.h"
-#include "nsIFrame.h"
-#include "nsGkAtoms.h"
-#include "nsIScrollableFrame.h"
-#include "nsListBoxBodyFrame.h"
-#include "ChildIterator.h"
-#include "mozilla/dom/Element.h"
-#include "mozilla/dom/ListBoxObjectBinding.h"
-
-namespace mozilla {
-namespace dom {
-
-NS_IMPL_ISUPPORTS_INHERITED(ListBoxObject, BoxObject, nsIListBoxObject,
- nsPIListBoxObject)
-
-ListBoxObject::ListBoxObject()
- : mListBoxBody(nullptr)
-{
-}
-
-ListBoxObject::~ListBoxObject()
-{
-}
-
-JSObject* ListBoxObject::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
- return ListBoxObject_Binding::Wrap(aCx, this, aGivenProto);
-}
-
-// nsIListBoxObject
-NS_IMETHODIMP
-ListBoxObject::GetRowCount(int32_t *aResult)
-{
- *aResult = GetRowCount();
- return NS_OK;
-}
-
-NS_IMETHODIMP
-ListBoxObject::GetItemAtIndex(int32_t index, Element **_retval)
-{
- nsListBoxBodyFrame* body = GetListBoxBody(true);
- if (body) {
- return body->GetItemAtIndex(index, _retval);
- }
- return NS_OK;
- }
-
-NS_IMETHODIMP
-ListBoxObject::GetIndexOfItem(Element* aElement, int32_t *aResult)
-{
- *aResult = 0;
-
- nsListBoxBodyFrame* body = GetListBoxBody(true);
- if (body) {
- return body->GetIndexOfItem(aElement, aResult);
- }
- return NS_OK;
-}
-
-// ListBoxObject
-
-int32_t
-ListBoxObject::GetRowCount()
-{
- nsListBoxBodyFrame* body = GetListBoxBody(true);
- if (body) {
- return body->GetRowCount();
- }
- return 0;
-}
-
-int32_t
-ListBoxObject::GetRowHeight()
-{
- nsListBoxBodyFrame* body = GetListBoxBody(true);
- if (body) {
- return body->GetRowHeightPixels();
- }
- return 0;
-}
-
-int32_t
-ListBoxObject::GetNumberOfVisibleRows()
-{
- nsListBoxBodyFrame* body = GetListBoxBody(true);
- if (body) {
- return body->GetNumberOfVisibleRows();
- }
- return 0;
-}
-
-int32_t
-ListBoxObject::GetIndexOfFirstVisibleRow()
-{
- nsListBoxBodyFrame* body = GetListBoxBody(true);
- if (body) {
- return body->GetIndexOfFirstVisibleRow();
- }
- return 0;
-}
-
-void
-ListBoxObject::EnsureIndexIsVisible(int32_t aRowIndex)
-{
- nsListBoxBodyFrame* body = GetListBoxBody(true);
- if (body) {
- body->EnsureIndexIsVisible(aRowIndex);
- }
-}
-
-void
-ListBoxObject::ScrollToIndex(int32_t aRowIndex)
-{
- nsListBoxBodyFrame* body = GetListBoxBody(true);
- if (body) {
- body->ScrollToIndex(aRowIndex);
- }
-}
-
-void
-ListBoxObject::ScrollByLines(int32_t aNumLines)
-{
- nsListBoxBodyFrame* body = GetListBoxBody(true);
- if (body) {
- body->ScrollByLines(aNumLines);
- }
-}
-
-already_AddRefed<Element>
-ListBoxObject::GetItemAtIndex(int32_t index)
-{
- RefPtr<Element> el;
- GetItemAtIndex(index, getter_AddRefs(el));
- return el.forget();
-}
-
-int32_t
-ListBoxObject::GetIndexOfItem(Element& aElement)
-{
- int32_t ret;
- GetIndexOfItem(&aElement, &ret);
- return ret;
-}
-
-//////////////////////
-
-static nsIContent*
-FindBodyContent(nsIContent* aParent)
-{
- if (aParent->IsXULElement(nsGkAtoms::listboxbody)) {
- return aParent;
- }
-
- mozilla::dom::FlattenedChildIterator iter(aParent);
- for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
- nsIContent* result = FindBodyContent(child);
- if (result) {
- return result;
- }
- }
-
- return nullptr;
-}
-
-nsListBoxBodyFrame*
-ListBoxObject::GetListBoxBody(bool aFlush)
-{
- if (mListBoxBody) {
- return mListBoxBody;
- }
-
- nsIPresShell* shell = GetPresShell(false);
- if (!shell) {
- return nullptr;
- }
-
- nsIFrame* frame = aFlush ?
- GetFrame(false) /* does FlushType::Frames */ :
- mContent->GetPrimaryFrame();
- if (!frame) {
- return nullptr;
- }
-
- // Iterate over our content model children looking for the body.
- nsCOMPtr<nsIContent> content = FindBodyContent(frame->GetContent());
-
- if (!content) {
- return nullptr;
- }
-
- // this frame will be a nsGFXScrollFrame
- frame = content->GetPrimaryFrame();
- if (!frame) {
- return nullptr;
- }
-
- nsIScrollableFrame* scrollFrame = do_QueryFrame(frame);
- if (!scrollFrame) {
- return nullptr;
- }
-
- // this frame will be the one we want
- nsIFrame* yeahBaby = scrollFrame->GetScrolledFrame();
- if (!yeahBaby) {
- return nullptr;
- }
-
- // It's a frame. Refcounts are irrelevant.
- nsListBoxBodyFrame* listBoxBody = do_QueryFrame(yeahBaby);
- NS_ENSURE_TRUE(listBoxBody &&
- listBoxBody->SetBoxObject(this),
- nullptr);
- mListBoxBody = listBoxBody;
- return mListBoxBody;
-}
-
-void
-ListBoxObject::Clear()
-{
- ClearCachedValues();
- BoxObject::Clear();
-}
-
-void
-ListBoxObject::ClearCachedValues()
-{
- mListBoxBody = nullptr;
-}
-
-} // namespace dom
-} // namespace mozilla
-
-// Creation Routine ///////////////////////////////////////////////////////////////////////
-
-nsresult
-NS_NewListBoxObject(nsIBoxObject** aResult)
-{
- NS_ADDREF(*aResult = new mozilla::dom::ListBoxObject());
- return NS_OK;
-}
deleted file mode 100644
--- a/layout/xul/ListBoxObject.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#ifndef mozilla_dom_ListBoxObject_h
-#define mozilla_dom_ListBoxObject_h
-
-#include "mozilla/dom/BoxObject.h"
-#include "nsPIListBoxObject.h"
-
-namespace mozilla {
-namespace dom {
-
-class ListBoxObject final : public BoxObject,
- public nsPIListBoxObject
-{
-public:
- NS_DECL_ISUPPORTS_INHERITED
- NS_DECL_NSILISTBOXOBJECT
-
- ListBoxObject();
-
- virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
-
- // nsPIListBoxObject
- virtual nsListBoxBodyFrame* GetListBoxBody(bool aFlush) override;
-
- // nsPIBoxObject
- virtual void Clear() override;
- virtual void ClearCachedValues() override;
-
- // ListBoxObject.webidl
- int32_t GetRowCount();
- int32_t GetRowHeight();
- int32_t GetNumberOfVisibleRows();
- int32_t GetIndexOfFirstVisibleRow();
- void EnsureIndexIsVisible(int32_t rowIndex);
- void ScrollToIndex(int32_t rowIndex);
- void ScrollByLines(int32_t numLines);
- already_AddRefed<Element> GetItemAtIndex(int32_t index);
- int32_t GetIndexOfItem(Element& item);
-
-protected:
- nsListBoxBodyFrame *mListBoxBody;
-
-private:
- ~ListBoxObject();
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_ListBoxObject_h
--- a/layout/xul/moz.build
+++ b/layout/xul/moz.build
@@ -12,33 +12,30 @@ with Files('*Menu*'):
if CONFIG['ENABLE_TESTS']:
MOCHITEST_MANIFESTS += ['test/mochitest.ini']
MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
XPIDL_SOURCES += [
'nsIBoxObject.idl',
- 'nsIListBoxObject.idl',
]
XPIDL_MODULE = 'layout_xul'
EXPORTS += [
'nsBox.h',
'nsIScrollbarMediator.h',
'nsPIBoxObject.h',
- 'nsPIListBoxObject.h',
'nsXULPopupManager.h',
'nsXULTooltipListener.h',
]
EXPORTS.mozilla.dom += [
'BoxObject.h',
- 'ListBoxObject.h',
'MenuBoxObject.h',
]
UNIFIED_SOURCES += [
'BoxObject.cpp',
'nsBox.cpp',
'nsBoxFrame.cpp',
'nsBoxLayout.cpp',
@@ -52,26 +49,22 @@ UNIFIED_SOURCES += [
'nsSprocketLayout.cpp',
'nsStackFrame.cpp',
'nsStackLayout.cpp',
'nsXULTooltipListener.cpp',
]
if CONFIG['MOZ_XUL']:
UNIFIED_SOURCES += [
- 'ListBoxObject.cpp',
'MenuBoxObject.cpp',
'nsDeckFrame.cpp',
'nsDocElementBoxFrame.cpp',
'nsGroupBoxFrame.cpp',
'nsImageBoxFrame.cpp',
'nsLeafBoxFrame.cpp',
- 'nsListBoxBodyFrame.cpp',
- 'nsListBoxLayout.cpp',
- 'nsListItemFrame.cpp',
'nsMenuBarFrame.cpp',
'nsMenuBarListener.cpp',
'nsMenuFrame.cpp',
'nsMenuPopupFrame.cpp',
'nsPopupSetFrame.cpp',
'nsProgressMeterFrame.cpp',
'nsResizerFrame.cpp',
'nsSplitterFrame.cpp',
--- a/layout/xul/nsBoxFrame.cpp
+++ b/layout/xul/nsBoxFrame.cpp
@@ -1259,22 +1259,16 @@ nsBoxFrame::RegUnregAccessKey(bool aDoRe
uint32_t key = accessKey.First();
if (aDoReg)
esm->RegisterAccessKey(mContent->AsElement(), key);
else
esm->UnregisterAccessKey(mContent->AsElement(), key);
}
-bool
-nsBoxFrame::SupportsOrdinalsInChildren()
-{
- return true;
-}
-
void
nsBoxFrame::AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult)
{
if (GetStateBits() & NS_STATE_BOX_WRAPS_KIDS_IN_BLOCK) {
aResult.AppendElement(OwnedAnonBox(PrincipalChildList().FirstChild()));
}
}
@@ -1288,18 +1282,17 @@ IsBoxOrdinalLEQ(nsIFrame* aFrame1,
nsIFrame* aRealFrame1 = nsPlaceholderFrame::GetRealFrameFor(aFrame1);
nsIFrame* aRealFrame2 = nsPlaceholderFrame::GetRealFrameFor(aFrame2);
return aRealFrame1->GetXULOrdinal() <= aRealFrame2->GetXULOrdinal();
}
void
nsBoxFrame::CheckBoxOrder()
{
- if (SupportsOrdinalsInChildren() &&
- !nsIFrame::IsFrameListSorted<IsBoxOrdinalLEQ>(mFrames)) {
+ if (!nsIFrame::IsFrameListSorted<IsBoxOrdinalLEQ>(mFrames)) {
nsIFrame::SortFrameList<IsBoxOrdinalLEQ>(mFrames);
}
}
nsresult
nsBoxFrame::LayoutChildAt(nsBoxLayoutState& aState, nsIFrame* aBox, const nsRect& aRect)
{
// get the current rect
@@ -1313,19 +1306,16 @@ nsBoxFrame::LayoutChildAt(nsBoxLayoutSta
}
return NS_OK;
}
nsresult
nsBoxFrame::XULRelayoutChildAtOrdinal(nsIFrame* aChild)
{
- if (!SupportsOrdinalsInChildren())
- return NS_OK;
-
uint32_t ord = aChild->GetXULOrdinal();
nsIFrame* child = mFrames.FirstChild();
nsIFrame* newPrevSib = nullptr;
while (child) {
if (ord < child->GetXULOrdinal()) {
break;
--- a/layout/xul/nsBoxFrame.h
+++ b/layout/xul/nsBoxFrame.h
@@ -149,22 +149,16 @@ public:
* Supports 'allowevents' attribute on descendant elements to allow those
* elements and their descendants to receive events.
*/
void WrapListsInRedirector(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aIn,
const nsDisplayListSet& aOut);
/**
- * This defaults to true, but some box frames (nsListBoxBodyFrame for
- * example) don't support ordinals in their children.
- */
- virtual bool SupportsOrdinalsInChildren();
-
- /**
* Return our wrapper block, if any.
*/
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
private:
explicit nsBoxFrame(ComputedStyle* aStyle)
: nsBoxFrame(aStyle, kClassID, false, nullptr) {}
protected:
deleted file mode 100644
--- a/layout/xul/nsIListBoxObject.idl
+++ /dev/null
@@ -1,19 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-#include "nsISupports.idl"
-
-// DEPRECATED: see ListBoxObject.webidl
-
-webidl Element;
-
-[shim(ListBoxObject), uuid(AA9DEF4E-2E59-412d-A6DF-B76F52167795)]
-interface nsIListBoxObject : nsISupports
-{
- long getRowCount();
-
- Element getItemAtIndex(in long index);
- long getIndexOfItem(in Element item);
-};
deleted file mode 100644
--- a/layout/xul/nsListBoxBodyFrame.cpp
+++ /dev/null
@@ -1,1532 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#include "nsListBoxBodyFrame.h"
-
-#include "nsListBoxLayout.h"
-
-#include "mozilla/MathAlgorithms.h"
-#include "nsCOMPtr.h"
-#include "nsGridRowGroupLayout.h"
-#include "nsIServiceManager.h"
-#include "nsGkAtoms.h"
-#include "nsIContent.h"
-#include "nsNameSpaceManager.h"
-#include "nsIDocument.h"
-#include "nsCSSFrameConstructor.h"
-#include "nsIScrollableFrame.h"
-#include "nsScrollbarFrame.h"
-#include "nsView.h"
-#include "nsViewManager.h"
-#include "mozilla/ComputedStyle.h"
-#include "nsFontMetrics.h"
-#include "nsITimer.h"
-#include "mozilla/ServoStyleSet.h"
-#include "mozilla/dom/Element.h"
-#include "mozilla/dom/Text.h"
-#include "nsPIBoxObject.h"
-#include "nsLayoutUtils.h"
-#include "nsPIListBoxObject.h"
-#include "nsContentUtils.h"
-#include "ChildIterator.h"
-#include "gfxContext.h"
-#include "prtime.h"
-#include <algorithm>
-
-#ifdef ACCESSIBILITY
-#include "nsAccessibilityService.h"
-#endif
-
-using namespace mozilla;
-using namespace mozilla::dom;
-
-/////////////// nsListScrollSmoother //////////////////
-
-/* A mediator used to smooth out scrolling. It works by seeing if
- * we have time to scroll the amount of rows requested. This is determined
- * by measuring how long it takes to scroll a row. If we can scroll the
- * rows in time we do so. If not we start a timer and skip the request. We
- * do this until the timer finally first because the user has stopped moving
- * the mouse. Then do all the queued requests in on shot.
- */
-
-// the longest amount of time that can go by before the use
-// notices it as a delay.
-#define USER_TIME_THRESHOLD 150000
-
-// how long it takes to layout a single row initial value.
-// we will time this after we scroll a few rows.
-#define TIME_PER_ROW_INITAL 50000
-
-// if we decide we can't layout the rows in the amount of time. How long
-// do we wait before checking again?
-#define SMOOTH_INTERVAL 100
-
-class nsListScrollSmoother final
-{
-private:
- ~nsListScrollSmoother();
-
-public:
- NS_INLINE_DECL_REFCOUNTING(nsListScrollSmoother)
-
- explicit nsListScrollSmoother(nsListBoxBodyFrame* aOuter);
-
- void Start();
- void Stop();
- bool IsRunning();
-
- nsCOMPtr<nsITimer> mRepeatTimer;
- int32_t mDelta;
- nsListBoxBodyFrame* mOuter;
-};
-
-nsListScrollSmoother::nsListScrollSmoother(nsListBoxBodyFrame* aOuter)
-{
- mDelta = 0;
- mOuter = aOuter;
-}
-
-nsListScrollSmoother::~nsListScrollSmoother()
-{
- Stop();
-}
-
-bool
-nsListScrollSmoother::IsRunning()
-{
- return mRepeatTimer ? true : false;
-}
-
-void
-nsListScrollSmoother::Start()
-{
- nsTimerCallbackFunc scrollSmootherCallback = [](nsITimer* aTimer,
- void* aClosure) {
- // The passed-in nsListScrollSmoother is always alive here. Because if
- // nsListScrollSmoother died, mRepeatTimer->Stop() would be called during
- // the destruction and this callback would never be invoked.
- auto self = static_cast<nsListScrollSmoother*>(aClosure);
-
- self->Stop();
-
- NS_ASSERTION(self->mOuter, "mOuter is null, see bug #68365");
- if (self->mOuter) {
- // actually do some work.
- self->mOuter->InternalPositionChangedCallback();
- }
- };
-
- Stop();
- nsIEventTarget* target = nullptr;
- if (mOuter) {
- if (nsIContent* content = mOuter->GetContent()) {
- target = content->OwnerDoc()->EventTargetFor(TaskCategory::Other);
- }
- }
- NS_NewTimerWithFuncCallback(getter_AddRefs(mRepeatTimer),
- scrollSmootherCallback,
- this,
- SMOOTH_INTERVAL,
- nsITimer::TYPE_ONE_SHOT,
- "scrollSmootherCallback",
- target);
-}
-
-void
-nsListScrollSmoother::Stop()
-{
- if ( mRepeatTimer ) {
- mRepeatTimer->Cancel();
- mRepeatTimer = nullptr;
- }
-}
-
-/////////////// nsListBoxBodyFrame //////////////////
-
-nsListBoxBodyFrame::nsListBoxBodyFrame(ComputedStyle* aStyle,
- nsBoxLayout* aLayoutManager)
- : nsBoxFrame(aStyle, kClassID, false, aLayoutManager),
- mTopFrame(nullptr),
- mBottomFrame(nullptr),
- mLinkupFrame(nullptr),
- mScrollSmoother(nullptr),
- mRowsToPrepend(0),
- mRowCount(-1),
- mRowHeight(0),
- mAvailableHeight(0),
- mStringWidth(-1),
- mCurrentIndex(0),
- mOldIndex(0),
- mYPosition(0),
- mTimePerRow(TIME_PER_ROW_INITAL),
- mRowHeightWasSet(false),
- mScrolling(false),
- mAdjustScroll(false),
- mReflowCallbackPosted(false)
-{
-}
-
-nsListBoxBodyFrame::~nsListBoxBodyFrame()
-{
- NS_IF_RELEASE(mScrollSmoother);
-
-#if USE_TIMER_TO_DELAY_SCROLLING
- StopScrollTracking();
- mAutoScrollTimer = nullptr;
-#endif
-
-}
-
-NS_QUERYFRAME_HEAD(nsListBoxBodyFrame)
- NS_QUERYFRAME_ENTRY(nsIScrollbarMediator)
- NS_QUERYFRAME_ENTRY(nsListBoxBodyFrame)
-NS_QUERYFRAME_TAIL_INHERITING(nsBoxFrame)
-
-////////// nsIFrame /////////////////
-
-void
-nsListBoxBodyFrame::Init(nsIContent* aContent,
- nsContainerFrame* aParent,
- nsIFrame* aPrevInFlow)
-{
- nsBoxFrame::Init(aContent, aParent, aPrevInFlow);
- // Don't call nsLayoutUtils::GetScrollableFrameFor since we are not its
- // scrollframe child yet.
- nsIScrollableFrame* scrollFrame = do_QueryFrame(aParent);
- if (scrollFrame) {
- nsIFrame* verticalScrollbar = scrollFrame->GetScrollbarBox(true);
- nsScrollbarFrame* scrollbarFrame = do_QueryFrame(verticalScrollbar);
- if (scrollbarFrame) {
- scrollbarFrame->SetScrollbarMediatorContent(GetContent());
- }
- }
- RefPtr<nsFontMetrics> fm =
- nsLayoutUtils::GetFontMetricsForFrame(this, 1.0f);
- mRowHeight = fm->MaxHeight();
-}
-
-void
-nsListBoxBodyFrame::DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData)
-{
- // make sure we cancel any posted callbacks.
- if (mReflowCallbackPosted)
- PresShell()->CancelReflowCallback(this);
-
- // Revoke any pending position changed events
- for (uint32_t i = 0; i < mPendingPositionChangeEvents.Length(); ++i) {
- mPendingPositionChangeEvents[i]->Revoke();
- }
-
- // Make sure we tell our listbox's box object we're being destroyed.
- if (mBoxObject) {
- mBoxObject->ClearCachedValues();
- }
-
- nsBoxFrame::DestroyFrom(aDestructRoot, aPostDestroyData);
-}
-
-nsresult
-nsListBoxBodyFrame::AttributeChanged(int32_t aNameSpaceID,
- nsAtom* aAttribute,
- int32_t aModType)
-{
- nsresult rv = NS_OK;
-
- if (aAttribute == nsGkAtoms::rows) {
- PresShell()->
- FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY);
- }
- else
- rv = nsBoxFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
-
- return rv;
-
-}
-
-/* virtual */ void
-nsListBoxBodyFrame::MarkIntrinsicISizesDirty()
-{
- mStringWidth = -1;
- nsBoxFrame::MarkIntrinsicISizesDirty();
-}
-
-/////////// nsBox ///////////////
-
-NS_IMETHODIMP
-nsListBoxBodyFrame::DoXULLayout(nsBoxLayoutState& aBoxLayoutState)
-{
- if (mScrolling)
- aBoxLayoutState.SetPaintingDisabled(true);
-
- nsresult rv = nsBoxFrame::DoXULLayout(aBoxLayoutState);
-
- // determine the real height for the scrollable area from the total number
- // of rows, since non-visible rows don't yet have frames
- nsRect rect(nsPoint(0, 0), GetSize());
- nsOverflowAreas overflow(rect, rect);
- if (mLayoutManager) {
- nsIFrame* childFrame = mFrames.FirstChild();
- while (childFrame) {
- ConsiderChildOverflow(overflow, childFrame);
- childFrame = childFrame->GetNextSibling();
- }
-
- nsSize prefSize = mLayoutManager->GetXULPrefSize(this, aBoxLayoutState);
- NS_FOR_FRAME_OVERFLOW_TYPES(otype) {
- nsRect& o = overflow.Overflow(otype);
- o.height = std::max(o.height, prefSize.height);
- }
- }
- FinishAndStoreOverflow(overflow, GetSize());
-
- if (mScrolling)
- aBoxLayoutState.SetPaintingDisabled(false);
-
- // if we are scrolled and the row height changed
- // make sure we are scrolled to a correct index.
- if (mAdjustScroll)
- PostReflowCallback();
-
- return rv;
-}
-
-nsSize
-nsListBoxBodyFrame::GetXULMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState)
-{
- nsSize result(0, 0);
- if (nsContentUtils::HasNonEmptyAttr(GetContent(), kNameSpaceID_None,
- nsGkAtoms::sizemode)) {
- result = GetXULPrefSize(aBoxLayoutState);
- result.height = 0;
- nsIScrollableFrame* scrollFrame = nsLayoutUtils::GetScrollableFrameFor(this);
- if (scrollFrame &&
- scrollFrame->GetScrollbarStyles().mVertical == NS_STYLE_OVERFLOW_AUTO) {
- nsMargin scrollbars =
- scrollFrame->GetDesiredScrollbarSizes(&aBoxLayoutState);
- result.width += scrollbars.left + scrollbars.right;
- }
- }
- return result;
-}
-
-nsSize
-nsListBoxBodyFrame::GetXULPrefSize(nsBoxLayoutState& aBoxLayoutState)
-{
- nsSize pref = nsBoxFrame::GetXULPrefSize(aBoxLayoutState);
-
- int32_t size = GetFixedRowSize();
- if (size > -1)
- pref.height = size*GetRowHeightAppUnits();
-
- nsIScrollableFrame* scrollFrame = nsLayoutUtils::GetScrollableFrameFor(this);
- if (scrollFrame &&
- scrollFrame->GetScrollbarStyles().mVertical == NS_STYLE_OVERFLOW_AUTO) {
- nsMargin scrollbars = scrollFrame->GetDesiredScrollbarSizes(&aBoxLayoutState);
- pref.width += scrollbars.left + scrollbars.right;
- }
- return pref;
-}
-
-///////////// nsIScrollbarMediator ///////////////
-
-void
-nsListBoxBodyFrame::ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection,
- nsIScrollbarMediator::ScrollSnapMode aSnap)
-{
- // CSS Scroll Snapping is not enabled for XUL, aSnap is ignored
- MOZ_ASSERT(aScrollbar != nullptr);
- aScrollbar->SetIncrementToPage(aDirection);
- AutoWeakFrame weakFrame(this);
- int32_t newPos = aScrollbar->MoveToNewPosition();
- if (!weakFrame.IsAlive()) {
- return;
- }
- UpdateIndex(newPos);
-}
-
-void
-nsListBoxBodyFrame::ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection,
- nsIScrollbarMediator::ScrollSnapMode aSnap)
-{
- // CSS Scroll Snapping is not enabled for XUL, aSnap is ignored
- MOZ_ASSERT(aScrollbar != nullptr);
- aScrollbar->SetIncrementToWhole(aDirection);
- AutoWeakFrame weakFrame(this);
- int32_t newPos = aScrollbar->MoveToNewPosition();
- if (!weakFrame.IsAlive()) {
- return;
- }
- UpdateIndex(newPos);
-}
-
-void
-nsListBoxBodyFrame::ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection,
- nsIScrollbarMediator::ScrollSnapMode aSnap)
-{
- // CSS Scroll Snapping is not enabled for XUL, aSnap is ignored
- MOZ_ASSERT(aScrollbar != nullptr);
- aScrollbar->SetIncrementToLine(aDirection);
- AutoWeakFrame weakFrame(this);
- int32_t newPos = aScrollbar->MoveToNewPosition();
- if (!weakFrame.IsAlive()) {
- return;
- }
- UpdateIndex(newPos);
-}
-
-void
-nsListBoxBodyFrame::RepeatButtonScroll(nsScrollbarFrame* aScrollbar)
-{
- AutoWeakFrame weakFrame(this);
- int32_t newPos = aScrollbar->MoveToNewPosition();
- if (!weakFrame.IsAlive()) {
- return;
- }
- UpdateIndex(newPos);
-}
-
-int32_t
-nsListBoxBodyFrame::ToRowIndex(nscoord aPos) const
-{
- return NS_roundf(float(std::max(aPos, 0)) / mRowHeight);
-}
-
-void
-nsListBoxBodyFrame::ThumbMoved(nsScrollbarFrame* aScrollbar,
- nscoord aOldPos,
- nscoord aNewPos)
-{
- if (mScrolling || mRowHeight == 0)
- return;
-
- int32_t newIndex = ToRowIndex(aNewPos);
- if (newIndex == mCurrentIndex) {
- return;
- }
- int32_t rowDelta = newIndex - mCurrentIndex;
-
- nsListScrollSmoother* smoother = GetSmoother();
-
- // if we can't scroll the rows in time then start a timer. We will eat
- // events until the user stops moving and the timer stops.
- if (smoother->IsRunning() || Abs(rowDelta)*mTimePerRow > USER_TIME_THRESHOLD) {
-
- smoother->Stop();
-
- smoother->mDelta = rowDelta;
-
- smoother->Start();
-
- return;
- }
-
- smoother->Stop();
-
- mCurrentIndex = newIndex;
- smoother->mDelta = 0;
-
- if (mCurrentIndex < 0) {
- mCurrentIndex = 0;
- return;
- }
- InternalPositionChanged(rowDelta < 0, Abs(rowDelta));
-}
-
-void
-nsListBoxBodyFrame::VisibilityChanged(bool aVisible)
-{
- if (mRowHeight == 0)
- return;
-
- int32_t lastPageTopRow = GetRowCount() - (GetAvailableHeight() / mRowHeight);
- if (lastPageTopRow < 0)
- lastPageTopRow = 0;
- int32_t delta = mCurrentIndex - lastPageTopRow;
- if (delta > 0) {
- mCurrentIndex = lastPageTopRow;
- InternalPositionChanged(true, delta);
- }
-}
-
-nsIFrame*
-nsListBoxBodyFrame::GetScrollbarBox(bool aVertical)
-{
- nsIScrollableFrame* scrollFrame = nsLayoutUtils::GetScrollableFrameFor(this);
- return scrollFrame ? scrollFrame->GetScrollbarBox(true) : nullptr;
-}
-
-void
-nsListBoxBodyFrame::UpdateIndex(int32_t aNewPos)
-{
- int32_t newIndex = ToRowIndex(nsPresContext::CSSPixelsToAppUnits(aNewPos));
- if (newIndex == mCurrentIndex) {
- return;
- }
- bool up = newIndex < mCurrentIndex;
- int32_t indexDelta = Abs(newIndex - mCurrentIndex);
- mCurrentIndex = newIndex;
- InternalPositionChanged(up, indexDelta);
-}
-
-///////////// nsIReflowCallback ///////////////
-
-bool
-nsListBoxBodyFrame::ReflowFinished()
-{
- nsAutoScriptBlocker scriptBlocker;
- // now create or destroy any rows as needed
- CreateRows();
-
- // keep scrollbar in sync
- if (mAdjustScroll) {
- VerticalScroll(mYPosition);
- mAdjustScroll = false;
- }
-
- // if the row height changed then mark everything as a style change.
- // That will dirty the entire listbox
- if (mRowHeightWasSet) {
- PresShell()->
- FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY);
- int32_t pos = mCurrentIndex * mRowHeight;
- if (mYPosition != pos)
- mAdjustScroll = true;
- mRowHeightWasSet = false;
- }
-
- mReflowCallbackPosted = false;
- return true;
-}
-
-void
-nsListBoxBodyFrame::ReflowCallbackCanceled()
-{
- mReflowCallbackPosted = false;
-}
-
-///////// ListBoxObject ///////////////
-
-int32_t
-nsListBoxBodyFrame::GetNumberOfVisibleRows()
-{
- return mRowHeight ? GetAvailableHeight() / mRowHeight : 0;
-}
-
-int32_t
-nsListBoxBodyFrame::GetIndexOfFirstVisibleRow()
-{
- return mCurrentIndex;
-}
-
-nsresult
-nsListBoxBodyFrame::EnsureIndexIsVisible(int32_t aRowIndex)
-{
- if (aRowIndex < 0)
- return NS_ERROR_ILLEGAL_VALUE;
-
- int32_t rows = 0;
- if (mRowHeight)
- rows = GetAvailableHeight()/mRowHeight;
- if (rows <= 0)
- rows = 1;
- int32_t bottomIndex = mCurrentIndex + rows;
-
- // if row is visible, ignore
- if (mCurrentIndex <= aRowIndex && aRowIndex < bottomIndex)
- return NS_OK;
-
- int32_t delta;
-
- bool up = aRowIndex < mCurrentIndex;
- if (up) {
- delta = mCurrentIndex - aRowIndex;
- mCurrentIndex = aRowIndex;
- }
- else {
- // Check to be sure we're not scrolling off the bottom of the tree
- if (aRowIndex >= GetRowCount())
- return NS_ERROR_ILLEGAL_VALUE;
-
- // Bring it just into view.
- delta = 1 + (aRowIndex-bottomIndex);
- mCurrentIndex += delta;
- }
-
- // Safe to not go off an event here, since this is coming from the
- // box object.
- DoInternalPositionChangedSync(up, delta);
- return NS_OK;
-}
-
-nsresult
-nsListBoxBodyFrame::ScrollByLines(int32_t aNumLines)
-{
- int32_t scrollIndex = GetIndexOfFirstVisibleRow(),
- visibleRows = GetNumberOfVisibleRows();
-
- scrollIndex += aNumLines;
-
- if (scrollIndex < 0)
- scrollIndex = 0;
- else {
- int32_t numRows = GetRowCount();
- int32_t lastPageTopRow = numRows - visibleRows;
- if (scrollIndex > lastPageTopRow)
- scrollIndex = lastPageTopRow;
- }
-
- ScrollToIndex(scrollIndex);
-
- return NS_OK;
-}
-
-// walks the DOM to get the zero-based row index of the content
-nsresult
-nsListBoxBodyFrame::GetIndexOfItem(Element* aItem, int32_t* _retval)
-{
- if (aItem) {
- *_retval = 0;
-
- FlattenedChildIterator iter(mContent);
- for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
- // we hit a list row, count it
- if (child->IsXULElement(nsGkAtoms::listitem)) {
- // is this it?
- if (child == aItem)
- return NS_OK;
-
- ++(*_retval);
- }
- }
- }
-
- // not found
- *_retval = -1;
- return NS_OK;
-}
-
-nsresult
-nsListBoxBodyFrame::GetItemAtIndex(int32_t aIndex, Element** aItem)
-{
- *aItem = nullptr;
- if (aIndex < 0)
- return NS_OK;
-
- int32_t itemCount = 0;
- FlattenedChildIterator iter(mContent);
- for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
- // we hit a list row, check if it is the one we are looking for
- if (child->IsXULElement(nsGkAtoms::listitem)) {
- // is this it?
- if (itemCount == aIndex) {
- *aItem = do_AddRef(child->AsElement()).take();
- return NS_OK;
- }
- ++itemCount;
- }
- }
-
- // not found
- return NS_OK;
-}
-
-/////////// nsListBoxBodyFrame ///////////////
-
-int32_t
-nsListBoxBodyFrame::GetRowCount()
-{
- if (mRowCount < 0)
- ComputeTotalRowCount();
- return mRowCount;
-}
-
-int32_t
-nsListBoxBodyFrame::GetRowHeightPixels() const
-{
- return nsPresContext::AppUnitsToIntCSSPixels(mRowHeight);
-}
-
-int32_t
-nsListBoxBodyFrame::GetFixedRowSize()
-{
- nsresult dummy;
-
- nsAutoString rows;
- mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::rows, rows);
- if (!rows.IsEmpty())
- return rows.ToInteger(&dummy);
-
- mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::size, rows);
- if (!rows.IsEmpty())
- return rows.ToInteger(&dummy);
-
- return -1;
-}
-
-void
-nsListBoxBodyFrame::SetRowHeight(nscoord aRowHeight)
-{
- if (aRowHeight > mRowHeight) {
- mRowHeight = aRowHeight;
-
- // signal we need to dirty everything
- // and we want to be notified after reflow
- // so we can create or destory rows as needed
- mRowHeightWasSet = true;
- PostReflowCallback();
- }
-}
-
-nscoord
-nsListBoxBodyFrame::GetAvailableHeight()
-{
- nsIScrollableFrame* scrollFrame =
- nsLayoutUtils::GetScrollableFrameFor(this);
- if (scrollFrame) {
- return scrollFrame->GetScrollPortRect().height;
- }
- return 0;
-}
-
-nscoord
-nsListBoxBodyFrame::GetYPosition()
-{
- return mYPosition;
-}
-
-nscoord
-nsListBoxBodyFrame::ComputeIntrinsicISize(nsBoxLayoutState& aBoxLayoutState)
-{
- if (mStringWidth != -1)
- return mStringWidth;
-
- nscoord largestWidth = 0;
-
- int32_t index = 0;
- RefPtr<Element> firstRowEl;
- GetItemAtIndex(index, getter_AddRefs(firstRowEl));
-
- if (firstRowEl) {
- nsPresContext* presContext = aBoxLayoutState.PresContext();
- RefPtr<ComputedStyle> computedStyle =
- presContext->StyleSet()->ResolveStyleFor(
- firstRowEl, nullptr, LazyComputeBehavior::Allow);
-
- nscoord width = 0;
- nsMargin margin(0,0,0,0);
-
- if (computedStyle->StylePadding()->GetPadding(margin))
- width += margin.LeftRight();
- width += computedStyle->StyleBorder()->GetComputedBorder().LeftRight();
- if (computedStyle->StyleMargin()->GetMargin(margin))
- width += margin.LeftRight();
-
- FlattenedChildIterator iter(mContent);
- for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
- if (child->IsXULElement(nsGkAtoms::listitem)) {
- gfxContext* rendContext = aBoxLayoutState.GetRenderingContext();
- if (rendContext) {
- nsAutoString value;
- for (nsIContent* content = child->GetFirstChild();
- content; content = content->GetNextSibling()) {
- if (Text* text = content->GetAsText()) {
- text->AppendTextTo(value);
- }
- }
-
- RefPtr<nsFontMetrics> fm =
- nsLayoutUtils::GetFontMetricsForComputedStyle(computedStyle,
- presContext);
-
- nscoord textWidth =
- nsLayoutUtils::AppUnitWidthOfStringBidi(value, this, *fm,
- *rendContext);
- textWidth += width;
-
- if (textWidth > largestWidth)
- largestWidth = textWidth;
- }
- }
- }
- }
-
- mStringWidth = largestWidth;
- return mStringWidth;
-}
-
-void
-nsListBoxBodyFrame::ComputeTotalRowCount()
-{
- mRowCount = 0;
- FlattenedChildIterator iter(mContent);
- for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
- if (child->IsXULElement(nsGkAtoms::listitem)) {
- ++mRowCount;
- }
- }
-}
-
-void
-nsListBoxBodyFrame::PostReflowCallback()
-{
- if (!mReflowCallbackPosted) {
- mReflowCallbackPosted = true;
- PresShell()->PostReflowCallback(this);
- }
-}
-
-////////// scrolling
-
-nsresult
-nsListBoxBodyFrame::ScrollToIndex(int32_t aRowIndex)
-{
- if (( aRowIndex < 0 ) || (mRowHeight == 0))
- return NS_OK;
-
- int32_t newIndex = aRowIndex;
- int32_t delta = mCurrentIndex > newIndex ? mCurrentIndex - newIndex : newIndex - mCurrentIndex;
- bool up = newIndex < mCurrentIndex;
-
- // Check to be sure we're not scrolling off the bottom of the tree
- int32_t lastPageTopRow = GetRowCount() - (GetAvailableHeight() / mRowHeight);
- if (lastPageTopRow < 0)
- lastPageTopRow = 0;
-
- if (aRowIndex > lastPageTopRow)
- return NS_OK;
-
- mCurrentIndex = newIndex;
-
- AutoWeakFrame weak(this);
-
- // Since we're going to flush anyway, we need to not do this off an event
- DoInternalPositionChangedSync(up, delta);
-
- if (!weak.IsAlive()) {
- return NS_OK;
- }
-
- // This change has to happen immediately.
- // Flush any pending reflow commands.
- // XXXbz why, exactly?
- mContent->GetComposedDoc()->FlushPendingNotifications(FlushType::Layout);
-
- return NS_OK;
-}
-
-nsresult
-nsListBoxBodyFrame::InternalPositionChangedCallback()
-{
- nsListScrollSmoother* smoother = GetSmoother();
-
- if (smoother->mDelta == 0)
- return NS_OK;
-
- mCurrentIndex += smoother->mDelta;
-
- if (mCurrentIndex < 0)
- mCurrentIndex = 0;
-
- return DoInternalPositionChangedSync(smoother->mDelta < 0,
- smoother->mDelta < 0 ?
- -smoother->mDelta : smoother->mDelta);
-}
-
-nsresult
-nsListBoxBodyFrame::InternalPositionChanged(bool aUp, int32_t aDelta)
-{
- RefPtr<nsPositionChangedEvent> event =
- new nsPositionChangedEvent(this, aUp, aDelta);
- nsresult rv = mContent->OwnerDoc()->Dispatch(TaskCategory::Other,
- do_AddRef(event));
- if (NS_SUCCEEDED(rv)) {
- if (!mPendingPositionChangeEvents.AppendElement(event)) {
- rv = NS_ERROR_OUT_OF_MEMORY;
- event->Revoke();
- }
- }
- return rv;
-}
-
-nsresult
-nsListBoxBodyFrame::DoInternalPositionChangedSync(bool aUp, int32_t aDelta)
-{
- AutoWeakFrame weak(this);
-
- // Process all the pending position changes first
- nsTArray< RefPtr<nsPositionChangedEvent> > temp;
- temp.SwapElements(mPendingPositionChangeEvents);
- for (uint32_t i = 0; i < temp.Length(); ++i) {
- if (weak.IsAlive()) {
- temp[i]->Run();
- }
- temp[i]->Revoke();
- }
-
- if (!weak.IsAlive()) {
- return NS_OK;
- }
-
- return DoInternalPositionChanged(aUp, aDelta);
-}
-
-nsresult
-nsListBoxBodyFrame::DoInternalPositionChanged(bool aUp, int32_t aDelta)
-{
- if (aDelta == 0)
- return NS_OK;
-
- RefPtr<nsPresContext> presContext(PresContext());
- nsBoxLayoutState state(presContext);
-
- // begin timing how long it takes to scroll a row
- PRTime start = PR_Now();
-
- AutoWeakFrame weakThis(this);
- mContent->GetComposedDoc()->FlushPendingNotifications(FlushType::Layout);
- if (!weakThis.IsAlive()) {
- return NS_OK;
- }
-
- {
- nsAutoScriptBlocker scriptBlocker;
-
- int32_t visibleRows = 0;
- if (mRowHeight)
- visibleRows = GetAvailableHeight()/mRowHeight;
-
- if (aDelta < visibleRows) {
- int32_t loseRows = aDelta;
- if (aUp) {
- // scrolling up, destroy rows from the bottom downwards
- ReverseDestroyRows(loseRows);
- mRowsToPrepend += aDelta;
- mLinkupFrame = nullptr;
- }
- else {
- // scrolling down, destroy rows from the top upwards
- DestroyRows(loseRows);
- mRowsToPrepend = 0;
- }
- }
- else {
- // We have scrolled so much that all of our current frames will
- // go off screen, so blow them all away. Weeee!
- nsIFrame *currBox = mFrames.FirstChild();
- while (currBox) {
- nsIFrame *nextBox = currBox->GetNextSibling();
- RemoveChildFrame(state, currBox);
- currBox = nextBox;
- }
- }
-
- // clear frame markers so that CreateRows will re-create
- mTopFrame = mBottomFrame = nullptr;
-
- mYPosition = mCurrentIndex*mRowHeight;
- mScrolling = true;
- presContext->PresShell()->
- FrameNeedsReflow(this, nsIPresShell::eResize, NS_FRAME_HAS_DIRTY_CHILDREN);
- }
- if (!weakThis.IsAlive()) {
- return NS_OK;
- }
- // Flush calls CreateRows
- // XXXbz there has to be a better way to do this than flushing!
- presContext->PresShell()->FlushPendingNotifications(FlushType::Layout);
- if (!weakThis.IsAlive()) {
- return NS_OK;
- }
-
- mScrolling = false;
-
- VerticalScroll(mYPosition);
-
- PRTime end = PR_Now();
-
- int32_t newTime = int32_t(end - start) / aDelta;
-
- // average old and new
- mTimePerRow = (newTime + mTimePerRow)/2;
-
- return NS_OK;
-}
-
-nsListScrollSmoother*
-nsListBoxBodyFrame::GetSmoother()
-{
- if (!mScrollSmoother) {
- mScrollSmoother = new nsListScrollSmoother(this);
- NS_ASSERTION(mScrollSmoother, "out of memory");
- NS_IF_ADDREF(mScrollSmoother);
- }
-
- return mScrollSmoother;
-}
-
-void
-nsListBoxBodyFrame::VerticalScroll(int32_t aPosition)
-{
- nsIScrollableFrame* scrollFrame
- = nsLayoutUtils::GetScrollableFrameFor(this);
- if (!scrollFrame) {
- return;
- }
-
- nsPoint scrollPosition = scrollFrame->GetScrollPosition();
-
- AutoWeakFrame weakFrame(this);
- scrollFrame->ScrollTo(nsPoint(scrollPosition.x, aPosition),
- nsIScrollableFrame::INSTANT);
- if (!weakFrame.IsAlive()) {
- return;
- }
-
- mYPosition = aPosition;
-}
-
-////////// frame and box retrieval
-
-nsIFrame*
-nsListBoxBodyFrame::GetFirstFrame()
-{
- mTopFrame = mFrames.FirstChild();
- return mTopFrame;
-}
-
-nsIFrame*
-nsListBoxBodyFrame::GetLastFrame()
-{
- return mFrames.LastChild();
-}
-
-bool
-nsListBoxBodyFrame::SupportsOrdinalsInChildren()
-{
- return false;
-}
-
-////////// lazy row creation and destruction
-
-void
-nsListBoxBodyFrame::CreateRows()
-{
- // Get our client rect.
- nsRect clientRect;
- GetXULClientRect(clientRect);
-
- // Get the starting y position and the remaining available
- // height.
- nscoord availableHeight = GetAvailableHeight();
-
- if (availableHeight <= 0) {
- bool fixed = (GetFixedRowSize() != -1);
- if (fixed)
- availableHeight = 10;
- else
- return;
- }
-
- // get the first tree box. If there isn't one create one.
- bool created = false;
- nsIFrame* box = GetFirstItemBox(0, &created);
- nscoord rowHeight = GetRowHeightAppUnits();
- while (box) {
- if (created && mRowsToPrepend > 0)
- --mRowsToPrepend;
-
- // if the row height is 0 then fail. Wait until someone
- // laid out and sets the row height.
- if (rowHeight == 0)
- return;
-
- availableHeight -= rowHeight;
-
- // should we continue? Is the enought height?
- if (!ContinueReflow(availableHeight))
- break;
-
- // get the next tree box. Create one if needed.
- box = GetNextItemBox(box, 0, &created);
- }
-
- mRowsToPrepend = 0;
- mLinkupFrame = nullptr;
-}
-
-void
-nsListBoxBodyFrame::DestroyRows(int32_t& aRowsToLose)
-{
- // We need to destroy frames until our row count has been properly
- // reduced. A reflow will then pick up and create the new frames.
- nsIFrame* childFrame = GetFirstFrame();
- nsBoxLayoutState state(PresContext());
-
- while (childFrame && aRowsToLose > 0) {
- --aRowsToLose;
-
- nsIFrame* nextFrame = childFrame->GetNextSibling();
- RemoveChildFrame(state, childFrame);
-
- mTopFrame = childFrame = nextFrame;
- }
-
- PresShell()->
- FrameNeedsReflow(this, nsIPresShell::eTreeChange,
- NS_FRAME_HAS_DIRTY_CHILDREN);
-}
-
-void
-nsListBoxBodyFrame::ReverseDestroyRows(int32_t& aRowsToLose)
-{
- // We need to destroy frames until our row count has been properly
- // reduced. A reflow will then pick up and create the new frames.
- nsIFrame* childFrame = GetLastFrame();
- nsBoxLayoutState state(PresContext());
-
- while (childFrame && aRowsToLose > 0) {
- --aRowsToLose;
-
- nsIFrame* prevFrame;
- prevFrame = childFrame->GetPrevSibling();
- RemoveChildFrame(state, childFrame);
-
- mBottomFrame = childFrame = prevFrame;
- }
-
- PresShell()->
- FrameNeedsReflow(this, nsIPresShell::eTreeChange,
- NS_FRAME_HAS_DIRTY_CHILDREN);
-}
-
-static bool
-IsListItemChild(nsListBoxBodyFrame* aParent, nsIContent* aChild,
- nsIFrame** aChildFrame)
-{
- *aChildFrame = nullptr;
- if (!aChild->IsXULElement(nsGkAtoms::listitem)) {
- return false;
- }
- nsIFrame* existingFrame = aChild->GetPrimaryFrame();
- if (existingFrame && existingFrame->GetParent() != aParent) {
- return false;
- }
- *aChildFrame = existingFrame;
- return true;
-}
-
-//
-// Get the nsIFrame for the first visible listitem, and if none exists,
-// create one.
-//
-nsIFrame*
-nsListBoxBodyFrame::GetFirstItemBox(int32_t aOffset, bool* aCreated)
-{
- if (aCreated)
- *aCreated = false;
-
- // Clear ourselves out.
- mBottomFrame = mTopFrame;
-
- if (mTopFrame) {
- return mTopFrame->IsXULBoxFrame() ? mTopFrame.GetFrame() : nullptr;
- }
-
- // top frame was cleared out
- mTopFrame = GetFirstFrame();
- mBottomFrame = mTopFrame;
-
- if (mTopFrame && mRowsToPrepend <= 0) {
- return mTopFrame->IsXULBoxFrame() ? mTopFrame.GetFrame() : nullptr;
- }
-
- // At this point, we either have no frames at all,
- // or the user has scrolled upwards, leaving frames
- // to be created at the top. Let's determine which
- // content needs a new frame first.
-
- nsCOMPtr<nsIContent> startContent;
- if (mTopFrame && mRowsToPrepend > 0) {
- // We need to insert rows before the top frame
- nsIContent* topContent = mTopFrame->GetContent();
- nsIContent* topParent = topContent->GetParent();
- int32_t contentIndex = topParent->ComputeIndexOf(topContent);
- contentIndex -= aOffset;
- if (contentIndex < 0)
- return nullptr;
- startContent = topParent->GetChildAt_Deprecated(contentIndex - mRowsToPrepend);
- } else {
- // This will be the first item frame we create. Use the content
- // at the current index, which is the first index scrolled into view
- GetListItemContentAt(mCurrentIndex+aOffset, getter_AddRefs(startContent));
- }
-
- if (startContent) {
- nsIFrame* existingFrame;
- if (!IsListItemChild(this, startContent, &existingFrame)) {
- return GetFirstItemBox(++aOffset, aCreated);
- }
- if (existingFrame) {
- return existingFrame->IsXULBoxFrame() ? existingFrame : nullptr;
- }
-
- // Either append the new frame, or prepend it (at index 0)
- // XXX check here if frame was even created, it may not have been if
- // display: none was on listitem content
- bool isAppend = mRowsToPrepend <= 0;
-
- nsIFrame* topFrame = nullptr;
- PresContext()->FrameConstructor()->CreateListBoxContent(
- this, nullptr, startContent, &topFrame, isAppend);
- mTopFrame = topFrame;
- if (mTopFrame) {
- if (aCreated)
- *aCreated = true;
-
- mBottomFrame = mTopFrame;
-
- return mTopFrame->IsXULBoxFrame() ? mTopFrame.GetFrame() : nullptr;
- } else
- return GetFirstItemBox(++aOffset, 0);
- }
-
- return nullptr;
-}
-
-//
-// Get the nsIFrame for the next visible listitem after aBox, and if none
-// exists, create one.
-//
-nsIFrame*
-nsListBoxBodyFrame::GetNextItemBox(nsIFrame* aBox, int32_t aOffset,
- bool* aCreated)
-{
- if (aCreated)
- *aCreated = false;
-
- nsIFrame* result = aBox->GetNextSibling();
-
- if (!result || result == mLinkupFrame || mRowsToPrepend > 0) {
- // No result found. See if there's a content node that wants a frame.
- nsIContent* prevContent = aBox->GetContent();
- nsIContent* parentContent = prevContent->GetParent();
-
- int32_t i = parentContent->ComputeIndexOf(prevContent);
-
- uint32_t childCount = parentContent->GetChildCount();
- if (((uint32_t)i + aOffset + 1) < childCount) {
- // There is a content node that wants a frame.
- nsIContent *nextContent = parentContent->GetChildAt_Deprecated(i + aOffset + 1);
-
- nsIFrame* existingFrame;
- if (!IsListItemChild(this, nextContent, &existingFrame)) {
- return GetNextItemBox(aBox, ++aOffset, aCreated);
- }
- if (!existingFrame) {
- // Either append the new frame, or insert it after the current frame
- bool isAppend = result != mLinkupFrame && mRowsToPrepend <= 0;
- nsIFrame* prevFrame = isAppend ? nullptr : aBox;
-
- PresContext()->FrameConstructor()->CreateListBoxContent(
- this, prevFrame, nextContent, &result, isAppend);
-
- if (result) {
- if (aCreated)
- *aCreated = true;
- } else
- return GetNextItemBox(aBox, ++aOffset, aCreated);
- } else {
- result = existingFrame;
- }
-
- mLinkupFrame = nullptr;
- }
- }
-
- if (!result)
- return nullptr;
-
- mBottomFrame = result;
-
- NS_ASSERTION(!result->IsXULBoxFrame() || result->GetParent() == this,
- "returning frame that is not in childlist");
-
- return result->IsXULBoxFrame() ? result : nullptr;
-}
-
-bool
-nsListBoxBodyFrame::ContinueReflow(nscoord height)
-{
-#ifdef ACCESSIBILITY
- if (nsIPresShell::IsAccessibilityActive()) {
- // Create all the frames at once so screen readers and
- // onscreen keyboards can see the full list right away
- return true;
- }
-#endif
-
- if (height <= 0) {
- nsIFrame* lastChild = GetLastFrame();
- nsIFrame* startingPoint = mBottomFrame;
- if (startingPoint == nullptr) {
- // We just want to delete everything but the first item.
- startingPoint = GetFirstFrame();
- }
-
- if (lastChild != startingPoint) {
- // We have some hangers on (probably caused by shrinking the size of the window).
- // Nuke them.
- nsIFrame* currFrame = startingPoint->GetNextSibling();
- nsBoxLayoutState state(PresContext());
-
- while (currFrame) {
- nsIFrame* nextFrame = currFrame->GetNextSibling();
- RemoveChildFrame(state, currFrame);
- currFrame = nextFrame;
- }
-
- PresShell()->
- FrameNeedsReflow(this, nsIPresShell::eTreeChange,
- NS_FRAME_HAS_DIRTY_CHILDREN);
- }
- return false;
- }
- else
- return true;
-}
-
-NS_IMETHODIMP
-nsListBoxBodyFrame::ListBoxAppendFrames(nsFrameList& aFrameList)
-{
- // append them after
- nsBoxLayoutState state(PresContext());
- const nsFrameList::Slice& newFrames = mFrames.AppendFrames(nullptr, aFrameList);
- if (mLayoutManager)
- mLayoutManager->ChildrenAppended(this, state, newFrames);
- PresShell()->
- FrameNeedsReflow(this, nsIPresShell::eTreeChange,
- NS_FRAME_HAS_DIRTY_CHILDREN);
-
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsListBoxBodyFrame::ListBoxInsertFrames(nsIFrame* aPrevFrame,
- nsFrameList& aFrameList)
-{
- // insert the frames to our info list
- nsBoxLayoutState state(PresContext());
- const nsFrameList::Slice& newFrames =
- mFrames.InsertFrames(nullptr, aPrevFrame, aFrameList);
- if (mLayoutManager)
- mLayoutManager->ChildrenInserted(this, state, aPrevFrame, newFrames);
- PresShell()->
- FrameNeedsReflow(this, nsIPresShell::eTreeChange,
- NS_FRAME_HAS_DIRTY_CHILDREN);
-
- return NS_OK;
-}
-
-//
-// Called by nsCSSFrameConstructor when a new listitem content is inserted.
-//
-void
-nsListBoxBodyFrame::OnContentInserted(nsIContent* aChildContent)
-{
- if (mRowCount >= 0)
- ++mRowCount;
-
- // The RDF content builder will build content nodes such that they are all
- // ready when OnContentInserted is first called, meaning the first call
- // to CreateRows will create all the frames, but OnContentInserted will
- // still be called again for each content node - so we need to make sure
- // that the frame for each content node hasn't already been created.
- nsIFrame* childFrame = aChildContent->GetPrimaryFrame();
- if (childFrame)
- return;
-
- int32_t siblingIndex;
- nsCOMPtr<nsIContent> nextSiblingContent;
- GetListItemNextSibling(aChildContent, getter_AddRefs(nextSiblingContent), siblingIndex);
-
- // if we're inserting our item before the first visible content,
- // then we need to shift all rows down by one
- if (siblingIndex >= 0 && siblingIndex-1 <= mCurrentIndex) {
- mTopFrame = nullptr;
- mRowsToPrepend = 1;
- } else if (nextSiblingContent) {
- // we may be inserting before a frame that is on screen
- nsIFrame* nextSiblingFrame = nextSiblingContent->GetPrimaryFrame();
- mLinkupFrame = nextSiblingFrame;
- }
-
- CreateRows();
- PresShell()->
- FrameNeedsReflow(this, nsIPresShell::eTreeChange,
- NS_FRAME_HAS_DIRTY_CHILDREN);
-}
-
-//
-// Called by nsCSSFrameConstructor when listitem content is removed.
-//
-void
-nsListBoxBodyFrame::OnContentRemoved(nsPresContext* aPresContext,
- nsIContent* aContainer,
- nsIFrame* aChildFrame,
- nsIContent* aOldNextSibling)
-{
- NS_ASSERTION(!aChildFrame || aChildFrame->GetParent() == this,
- "Removing frame that's not our child... Not good");
-
- if (mRowCount >= 0)
- --mRowCount;
-
- if (aContainer) {
- if (!aChildFrame) {
- // The row we are removing is out of view, so we need to try to
- // determine the index of its next sibling.
- int32_t siblingIndex = -1;
- if (aOldNextSibling) {
- nsCOMPtr<nsIContent> nextSiblingContent;
- GetListItemNextSibling(aOldNextSibling,
- getter_AddRefs(nextSiblingContent),
- siblingIndex);
- }
-
- // if the row being removed is off-screen and above the top frame, we need to
- // adjust our top index and tell the scrollbar to shift up one row.
- if (siblingIndex >= 0 && siblingIndex-1 < mCurrentIndex) {
- MOZ_ASSERT(mCurrentIndex > 0, "mCurrentIndex > 0");
- --mCurrentIndex;
- mYPosition = mCurrentIndex*mRowHeight;
- AutoWeakFrame weakChildFrame(aChildFrame);
- VerticalScroll(mYPosition);
- if (!weakChildFrame.IsAlive()) {
- return;
- }
- }
- } else if (mCurrentIndex > 0) {
- // At this point, we know we have a scrollbar, and we need to know
- // if we are scrolled to the last row. In this case, the behavior
- // of the scrollbar is to stay locked to the bottom. Since we are
- // removing visible content, the first visible row will have to move
- // down by one, and we will have to insert a new frame at the top.
-
- // if the last content node has a frame, we are scrolled to the bottom
- nsIContent* lastChild = nullptr;
- FlattenedChildIterator iter(mContent);
- for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
- lastChild = child;
- }
-
- if (lastChild) {
- nsIFrame* lastChildFrame = lastChild->GetPrimaryFrame();
-
- if (lastChildFrame) {
- mTopFrame = nullptr;
- mRowsToPrepend = 1;
- --mCurrentIndex;
- mYPosition = mCurrentIndex*mRowHeight;
- AutoWeakFrame weakChildFrame(aChildFrame);
- VerticalScroll(mYPosition);
- if (!weakChildFrame.IsAlive()) {
- return;
- }
- }
- }
- }
- }
-
- // if we're removing the top row, the new top row is the next row
- if (mTopFrame && mTopFrame == aChildFrame)
- mTopFrame = mTopFrame->GetNextSibling();
-
- // Go ahead and delete the frame.
- nsBoxLayoutState state(aPresContext);
- if (aChildFrame) {
- RemoveChildFrame(state, aChildFrame);
- }
-
- PresShell()->
- FrameNeedsReflow(this, nsIPresShell::eTreeChange,
- NS_FRAME_HAS_DIRTY_CHILDREN);
-}
-
-void
-nsListBoxBodyFrame::GetListItemContentAt(int32_t aIndex, nsIContent** aContent)
-{
- *aContent = nullptr;
-
- int32_t itemsFound = 0;
- FlattenedChildIterator iter(mContent);
- for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
- if (child->IsXULElement(nsGkAtoms::listitem)) {
- ++itemsFound;
- if (itemsFound-1 == aIndex) {
- *aContent = child;
- NS_IF_ADDREF(*aContent);
- return;
- }
- }
- }
-}
-
-void
-nsListBoxBodyFrame::GetListItemNextSibling(nsIContent* aListItem, nsIContent** aContent, int32_t& aSiblingIndex)
-{
- *aContent = nullptr;
- aSiblingIndex = -1;
- nsIContent *prevKid = nullptr;
- FlattenedChildIterator iter(mContent);
- for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
- if (child->IsXULElement(nsGkAtoms::listitem)) {
- ++aSiblingIndex;
- if (prevKid == aListItem) {
- *aContent = child;
- NS_IF_ADDREF(*aContent);
- return;
- }
- }
- prevKid = child;
- }
-
- aSiblingIndex = -1; // no match, so there is no next sibling
-}
-
-void
-nsListBoxBodyFrame::RemoveChildFrame(nsBoxLayoutState &aState,
- nsIFrame *aFrame)
-{
- MOZ_ASSERT(mFrames.ContainsFrame(aFrame));
- MOZ_ASSERT(aFrame != GetContentInsertionFrame());
-
-#ifdef ACCESSIBILITY
- nsAccessibilityService* accService = nsIPresShell::AccService();
- if (accService) {
- nsIContent* content = aFrame->GetContent();
- accService->ContentRemoved(PresShell(), content);
- }
-#endif
-
- mFrames.RemoveFrame(aFrame);
- if (mLayoutManager)
- mLayoutManager->ChildrenRemoved(this, aState, aFrame);
- aFrame->Destroy();
-}
-
-// Creation Routines ///////////////////////////////////////////////////////////////////////
-
-already_AddRefed<nsBoxLayout> NS_NewListBoxLayout();
-
-nsIFrame*
-NS_NewListBoxBodyFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
-{
- nsCOMPtr<nsBoxLayout> layout = NS_NewListBoxLayout();
- return new (aPresShell) nsListBoxBodyFrame(aStyle, layout);
-}
-
-NS_IMPL_FRAMEARENA_HELPERS(nsListBoxBodyFrame)
deleted file mode 100644
--- a/layout/xul/nsListBoxBodyFrame.h
+++ /dev/null
@@ -1,226 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#ifndef nsListBoxBodyFrame_h
-#define nsListBoxBodyFrame_h
-
-#include "mozilla/Attributes.h"
-#include "nsCOMPtr.h"
-#include "nsBoxFrame.h"
-#include "nsIScrollbarMediator.h"
-#include "nsIReflowCallback.h"
-#include "nsBoxLayoutState.h"
-#include "nsThreadUtils.h"
-#include "nsPIBoxObject.h"
-
-class nsPresContext;
-class nsListScrollSmoother;
-nsIFrame* NS_NewListBoxBodyFrame(nsIPresShell* aPresShell,
- mozilla::ComputedStyle* aStyle);
-
-namespace mozilla {
-namespace dom {
-class Element;
-} // namespace dom
-} // namespace mozilla
-
-class nsListBoxBodyFrame final : public nsBoxFrame,
- public nsIScrollbarMediator,
- public nsIReflowCallback
-{
- nsListBoxBodyFrame(ComputedStyle* aStyle,
- nsBoxLayout* aLayoutManager);
- virtual ~nsListBoxBodyFrame();
-
-public:
- NS_DECL_QUERYFRAME
- NS_DECL_FRAMEARENA_HELPERS(nsListBoxBodyFrame)
-
- // non-virtual ListBoxObject
- int32_t GetNumberOfVisibleRows();
- int32_t GetIndexOfFirstVisibleRow();
- nsresult EnsureIndexIsVisible(int32_t aRowIndex);
- nsresult ScrollToIndex(int32_t aRowIndex);
- nsresult ScrollByLines(int32_t aNumLines);
- nsresult GetItemAtIndex(int32_t aIndex, mozilla::dom::Element **aResult);
- nsresult GetIndexOfItem(mozilla::dom::Element *aItem, int32_t *aResult);
-
- friend nsIFrame* NS_NewListBoxBodyFrame(nsIPresShell* aPresShell,
- ComputedStyle* aStyle);
-
- // nsIFrame
- virtual void Init(nsIContent* aContent,
- nsContainerFrame* aParent,
- nsIFrame* aPrevInFlow) override;
- virtual void DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData) override;
-
- virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute, int32_t aModType) override;
-
- // nsIScrollbarMediator
- virtual void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection,
- nsIScrollbarMediator::ScrollSnapMode snapMode
- = nsIScrollbarMediator::DISABLE_SNAP) override;
- virtual void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection,
- nsIScrollbarMediator::ScrollSnapMode snapMode
- = nsIScrollbarMediator::DISABLE_SNAP) override;
- virtual void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection,
- nsIScrollbarMediator::ScrollSnapMode snapMode
- = nsIScrollbarMediator::DISABLE_SNAP) override;
- virtual void RepeatButtonScroll(nsScrollbarFrame* aScrollbar) override;
- virtual void ThumbMoved(nsScrollbarFrame* aScrollbar,
- int32_t aOldPos,
- int32_t aNewPos) override;
- virtual void ScrollbarReleased(nsScrollbarFrame* aScrollbar) override {}
- virtual void VisibilityChanged(bool aVisible) override;
- virtual nsIFrame* GetScrollbarBox(bool aVertical) override;
- virtual void ScrollbarActivityStarted() const override {}
- virtual void ScrollbarActivityStopped() const override {}
- virtual bool IsScrollbarOnRight() const override {
- return (StyleVisibility()->mDirection == NS_STYLE_DIRECTION_LTR);
- }
- virtual bool ShouldSuppressScrollbarRepaints() const override {
- return false;
- }
-
-
- // nsIReflowCallback
- virtual bool ReflowFinished() override;
- virtual void ReflowCallbackCanceled() override;
-
- NS_IMETHOD DoXULLayout(nsBoxLayoutState& aBoxLayoutState) override;
- virtual void MarkIntrinsicISizesDirty() override;
-
- virtual nsSize GetXULMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState) override;
- virtual nsSize GetXULPrefSize(nsBoxLayoutState& aBoxLayoutState) override;
-
- // size calculation
- int32_t GetRowCount();
- int32_t GetRowHeightAppUnits() { return mRowHeight; }
- int32_t GetRowHeightPixels() const;
- int32_t GetFixedRowSize();
- void SetRowHeight(nscoord aRowHeight);
- nscoord GetYPosition();
- nscoord GetAvailableHeight();
- nscoord ComputeIntrinsicISize(nsBoxLayoutState& aBoxLayoutState);
-
- // scrolling
- nsresult InternalPositionChangedCallback();
- nsresult InternalPositionChanged(bool aUp, int32_t aDelta);
- // Process pending position changed events, then do the position change.
- // This can wipe out the frametree.
- nsresult DoInternalPositionChangedSync(bool aUp, int32_t aDelta);
- // Actually do the internal position change. This can wipe out the frametree
- nsresult DoInternalPositionChanged(bool aUp, int32_t aDelta);
- nsListScrollSmoother* GetSmoother();
- void VerticalScroll(int32_t aDelta);
- // Update the scroll index given a position, in CSS pixels
- void UpdateIndex(int32_t aNewPos);
-
- // frames
- nsIFrame* GetFirstFrame();
- nsIFrame* GetLastFrame();
-
- // lazy row creation and destruction
- void CreateRows();
- void DestroyRows(int32_t& aRowsToLose);
- void ReverseDestroyRows(int32_t& aRowsToLose);
- nsIFrame* GetFirstItemBox(int32_t aOffset, bool* aCreated);
- nsIFrame* GetNextItemBox(nsIFrame* aBox, int32_t aOffset, bool* aCreated);
- bool ContinueReflow(nscoord height);
- NS_IMETHOD ListBoxAppendFrames(nsFrameList& aFrameList);
- NS_IMETHOD ListBoxInsertFrames(nsIFrame* aPrevFrame, nsFrameList& aFrameList);
- void OnContentInserted(nsIContent* aContent);
- void OnContentRemoved(nsPresContext* aPresContext, nsIContent* aContainer,
- nsIFrame* aChildFrame, nsIContent* aOldNextSibling);
-
- void GetListItemContentAt(int32_t aIndex, nsIContent** aContent);
- void GetListItemNextSibling(nsIContent* aListItem, nsIContent** aContent, int32_t& aSiblingIndex);
-
- void PostReflowCallback();
-
- bool SetBoxObject(nsPIBoxObject* aBoxObject)
- {
- NS_ENSURE_TRUE(!mBoxObject, false);
- mBoxObject = aBoxObject;
- return true;
- }
-
- virtual bool SupportsOrdinalsInChildren() override;
-
- virtual bool ComputesOwnOverflowArea() override { return true; }
-
-protected:
- class nsPositionChangedEvent;
- friend class nsPositionChangedEvent;
-
- class nsPositionChangedEvent : public mozilla::Runnable
- {
- public:
- nsPositionChangedEvent(nsListBoxBodyFrame* aFrame, bool aUp, int32_t aDelta)
- : mozilla::Runnable("nsListBoxBodyFrame::nsPositionChangedEvent")
- , mFrame(aFrame)
- , mUp(aUp)
- , mDelta(aDelta)
- {}
-
- NS_IMETHOD Run() override
- {
- if (!mFrame) {
- return NS_OK;
- }
-
- mFrame->mPendingPositionChangeEvents.RemoveElement(this);
-
- return mFrame->DoInternalPositionChanged(mUp, mDelta);
- }
-
- void Revoke() {
- mFrame = nullptr;
- }
-
- nsListBoxBodyFrame* mFrame;
- bool mUp;
- int32_t mDelta;
- };
-
- void ComputeTotalRowCount();
- int32_t ToRowIndex(nscoord aPos) const;
- void RemoveChildFrame(nsBoxLayoutState &aState, nsIFrame *aChild);
-
- nsTArray< RefPtr<nsPositionChangedEvent> > mPendingPositionChangeEvents;
- nsCOMPtr<nsPIBoxObject> mBoxObject;
-
- // frame markers
- WeakFrame mTopFrame;
- nsIFrame* mBottomFrame;
- nsIFrame* mLinkupFrame;
-
- nsListScrollSmoother* mScrollSmoother;
-
- int32_t mRowsToPrepend;
-
- // row height
- int32_t mRowCount;
- nscoord mRowHeight;
- nscoord mAvailableHeight;
- nscoord mStringWidth;
-
- // scrolling
- int32_t mCurrentIndex; // Row-based
- int32_t mOldIndex;
- int32_t mYPosition;
- int32_t mTimePerRow;
-
- // row height
- bool mRowHeightWasSet;
- // scrolling
- bool mScrolling;
- bool mAdjustScroll;
-
- bool mReflowCallbackPosted;
-};
-
-#endif // nsListBoxBodyFrame_h
deleted file mode 100644
--- a/layout/xul/nsListBoxLayout.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#include "nsListBoxLayout.h"
-
-#include "nsListBoxBodyFrame.h"
-#include "nsBox.h"
-#include "nsBoxLayoutState.h"
-#include "nsIScrollableFrame.h"
-#include "nsIReflowCallback.h"
-#include "mozilla/dom/NameSpaceConstants.h"
-#include "nsGkAtoms.h"
-#include "nsContentUtils.h"
-
-nsListBoxLayout::nsListBoxLayout() : nsGridRowGroupLayout()
-{
-}
-
-////////// nsBoxLayout //////////////
-
-nsSize
-nsListBoxLayout::GetXULPrefSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState)
-{
- nsSize pref = nsGridRowGroupLayout::GetXULPrefSize(aBox, aBoxLayoutState);
-
- nsListBoxBodyFrame* frame = static_cast<nsListBoxBodyFrame*>(aBox);
- if (frame) {
- nscoord rowheight = frame->GetRowHeightAppUnits();
- pref.height = frame->GetRowCount() * rowheight;
- // Pad the height.
- nscoord y = frame->GetAvailableHeight();
- if (pref.height > y && y > 0 && rowheight > 0) {
- nscoord m = (pref.height-y)%rowheight;
- nscoord remainder = m == 0 ? 0 : rowheight - m;
- pref.height += remainder;
- }
- if (nsContentUtils::HasNonEmptyAttr(frame->GetContent(), kNameSpaceID_None,
- nsGkAtoms::sizemode)) {
- nscoord width = frame->ComputeIntrinsicISize(aBoxLayoutState);
- if (width > pref.width)
- pref.width = width;
- }
- }
- return pref;
-}
-
-nsSize
-nsListBoxLayout::GetXULMinSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState)
-{
- nsSize minSize = nsGridRowGroupLayout::GetXULMinSize(aBox, aBoxLayoutState);
-
- nsListBoxBodyFrame* frame = static_cast<nsListBoxBodyFrame*>(aBox);
- if (frame) {
- nscoord rowheight = frame->GetRowHeightAppUnits();
- minSize.height = frame->GetRowCount() * rowheight;
- // Pad the height.
- nscoord y = frame->GetAvailableHeight();
- if (minSize.height > y && y > 0 && rowheight > 0) {
- nscoord m = (minSize.height-y)%rowheight;
- nscoord remainder = m == 0 ? 0 : rowheight - m;
- minSize.height += remainder;
- }
- if (nsContentUtils::HasNonEmptyAttr(frame->GetContent(), kNameSpaceID_None,
- nsGkAtoms::sizemode)) {
- nscoord width = frame->ComputeIntrinsicISize(aBoxLayoutState);
- if (width > minSize.width)
- minSize.width = width;
- }
- }
- return minSize;
-}
-
-nsSize
-nsListBoxLayout::GetXULMaxSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState)
-{
- nsSize maxSize = nsGridRowGroupLayout::GetXULMaxSize(aBox, aBoxLayoutState);
-
- nsListBoxBodyFrame* frame = static_cast<nsListBoxBodyFrame*>(aBox);
- if (frame) {
- nscoord rowheight = frame->GetRowHeightAppUnits();
- maxSize.height = frame->GetRowCount() * rowheight;
- // Pad the height.
- nscoord y = frame->GetAvailableHeight();
- if (maxSize.height > y && y > 0 && rowheight > 0) {
- nscoord m = (maxSize.height-y)%rowheight;
- nscoord remainder = m == 0 ? 0 : rowheight - m;
- maxSize.height += remainder;
- }
- }
- return maxSize;
-}
-
-NS_IMETHODIMP
-nsListBoxLayout::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState)
-{
- return LayoutInternal(aBox, aState);
-}
-
-
-/////////// nsListBoxLayout /////////////////////////
-
-/**
- * Called to layout our our children. Does no frame construction
- */
-NS_IMETHODIMP
-nsListBoxLayout::LayoutInternal(nsIFrame* aBox, nsBoxLayoutState& aState)
-{
- int32_t redrawStart = -1;
-
- // Get the start y position.
- nsListBoxBodyFrame* body = static_cast<nsListBoxBodyFrame*>(aBox);
- if (!body) {
- NS_ERROR("Frame encountered that isn't a listboxbody!");
- return NS_ERROR_FAILURE;
- }
-
- nsMargin margin;
-
- // Get our client rect.
- nsRect clientRect;
- aBox->GetXULClientRect(clientRect);
-
- // Get the starting y position and the remaining available
- // height.
- nscoord availableHeight = body->GetAvailableHeight();
- nscoord yOffset = body->GetYPosition();
-
- if (availableHeight <= 0) {
- bool fixed = (body->GetFixedRowSize() != -1);
- if (fixed)
- availableHeight = 10;
- else
- return NS_OK;
- }
-
- // run through all our currently created children
- nsIFrame* box = nsBox::GetChildXULBox(body);
-
- // if the reason is resize or initial we must relayout.
- nscoord rowHeight = body->GetRowHeightAppUnits();
-
- while (box) {
- // If this box is dirty or if it has dirty children, we
- // call layout on it.
- nsRect childRect(box->GetRect());
- box->GetXULMargin(margin);
-
- // relayout if we must or we are dirty or some of our children are dirty
- // or the client area is wider than us
- // XXXldb There should probably be a resize check here too!
- if (NS_SUBTREE_DIRTY(box) || childRect.width < clientRect.width) {
- childRect.x = 0;
- childRect.y = yOffset;
- childRect.width = clientRect.width;
-
- nsSize size = box->GetXULPrefSize(aState);
- body->SetRowHeight(size.height);
-
- childRect.height = rowHeight;
-
- childRect.Deflate(margin);
- box->SetXULBounds(aState, childRect);
- box->XULLayout(aState);
- } else {
- // if the child did not need to be relayed out. Then its easy.
- // Place the child by just grabbing its rect and adjusting the y.
- int32_t newPos = yOffset+margin.top;
-
- // are we pushing down or pulling up any rows?
- // Then we may have to redraw everything below the moved
- // rows.
- if (redrawStart == -1 && childRect.y != newPos)
- redrawStart = newPos;
-
- childRect.y = newPos;
- box->SetXULBounds(aState, childRect);
- }
-
- // Ok now the available size gets smaller and we move the
- // starting position of the next child down some.
- nscoord size = childRect.height + margin.top + margin.bottom;
-
- yOffset += size;
- availableHeight -= size;
-
- box = nsBox::GetNextXULBox(box);
- }
-
- // We have enough available height left to add some more rows
- // Since we can't do this during layout, we post a callback
- // that will be processed after the reflow completes.
- body->PostReflowCallback();
-
- // if rows were pushed down or pulled up because some rows were added
- // before them then redraw everything under the inserted rows. The inserted
- // rows will automatically be redrawn because the were marked dirty on insertion.
- if (redrawStart > -1) {
- aBox->XULRedraw(aState);
- }
-
- return NS_OK;
-}
-
-// Creation Routines ///////////////////////////////////////////////////////////////////////
-
-already_AddRefed<nsBoxLayout> NS_NewListBoxLayout()
-{
- RefPtr<nsBoxLayout> layout = new nsListBoxLayout();
- return layout.forget();
-}
deleted file mode 100644
--- a/layout/xul/nsListBoxLayout.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#ifndef nsListBoxLayout_h___
-#define nsListBoxLayout_h___
-
-#include "mozilla/Attributes.h"
-#include "nsGridRowGroupLayout.h"
-
-class nsIFrame;
-typedef class nsIFrame nsIFrame;
-class nsBoxLayoutState;
-
-class nsListBoxLayout final : public nsGridRowGroupLayout
-{
-public:
- nsListBoxLayout();
-
- // nsBoxLayout
- NS_IMETHOD XULLayout(nsIFrame* aBox, nsBoxLayoutState& aState) override;
- virtual nsSize GetXULPrefSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) override;
- virtual nsSize GetXULMinSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) override;
- virtual nsSize GetXULMaxSize(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) override;
-
-protected:
- NS_IMETHOD LayoutInternal(nsIFrame* aBox, nsBoxLayoutState& aState);
-};
-
-#endif
-
deleted file mode 100644
--- a/layout/xul/nsListItemFrame.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#include "nsListItemFrame.h"
-
-#include <algorithm>
-
-#include "nsCOMPtr.h"
-#include "nsNameSpaceManager.h"
-#include "nsGkAtoms.h"
-#include "nsDisplayList.h"
-#include "nsBoxLayout.h"
-#include "nsIContent.h"
-
-using namespace mozilla;
-
-nsListItemFrame::nsListItemFrame(ComputedStyle* aStyle,
- bool aIsRoot,
- nsBoxLayout* aLayoutManager)
- : nsGridRowLeafFrame(aStyle, aIsRoot, aLayoutManager, kClassID)
-{
-}
-
-nsListItemFrame::~nsListItemFrame()
-{
-}
-
-nsSize
-nsListItemFrame::GetXULPrefSize(nsBoxLayoutState& aState)
-{
- nsSize size = nsBoxFrame::GetXULPrefSize(aState);
- DISPLAY_PREF_SIZE(this, size);
-
- // guarantee that our preferred height doesn't exceed the standard
- // listbox row height
- size.height = std::max(mRect.height, size.height);
- return size;
-}
-
-void
-nsListItemFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
- const nsDisplayListSet& aLists)
-{
- if (aBuilder->IsForEventDelivery()) {
- if (!mContent->AsElement()->AttrValueIs(kNameSpaceID_None,
- nsGkAtoms::allowevents,
- nsGkAtoms::_true, eCaseMatters))
- return;
- }
-
- nsGridRowLeafFrame::BuildDisplayListForChildren(aBuilder, aLists);
-}
-
-// Creation Routine ///////////////////////////////////////////////////////////////////////
-
-already_AddRefed<nsBoxLayout> NS_NewGridRowLeafLayout();
-
-nsIFrame*
-NS_NewListItemFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
-{
- nsCOMPtr<nsBoxLayout> layout = NS_NewGridRowLeafLayout();
- if (!layout) {
- return nullptr;
- }
-
- return new (aPresShell) nsListItemFrame(aStyle, false, layout);
-}
-
-NS_IMPL_FRAMEARENA_HELPERS(nsListItemFrame)
deleted file mode 100644
--- a/layout/xul/nsListItemFrame.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#include "mozilla/Attributes.h"
-#include "nsGridRowLeafFrame.h"
-
-nsIFrame* NS_NewListItemFrame(nsIPresShell* aPresShell,
- mozilla::ComputedStyle* aStyle);
-
-class nsListItemFrame final : public nsGridRowLeafFrame
-{
-public:
- NS_DECL_FRAMEARENA_HELPERS(nsListItemFrame)
-
- friend nsIFrame* NS_NewListItemFrame(nsIPresShell* aPresShell,
- ComputedStyle* aStyle);
-
- // overridden so that children of listitems don't handle mouse events,
- // unless allowevents="true" is specified on the listitem
- virtual void BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
- const nsDisplayListSet& aLists) override;
-
- virtual nsSize GetXULPrefSize(nsBoxLayoutState& aState) override;
-
-protected:
- explicit nsListItemFrame(ComputedStyle* aStyle,
- bool aIsRoot = false,
- nsBoxLayout* aLayoutManager = nullptr);
- virtual ~nsListItemFrame();
-
-}; // class nsListItemFrame
deleted file mode 100644
--- a/layout/xul/nsPIListBoxObject.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#ifndef nsPIListBoxObject_h__
-#define nsPIListBoxObject_h__
-
-class nsListBoxBodyFrame;
-
-// fa9549f7-ee09-48fc-89f7-30cceee21c15
-#define NS_PILISTBOXOBJECT_IID \
-{ 0xfa9549f7, 0xee09, 0x48fc, \
- { 0x89, 0xf7, 0x30, 0xcc, 0xee, 0xe2, 0x1c, 0x15 } }
-
-#include "nsIListBoxObject.h"
-
-class nsPIListBoxObject : public nsIListBoxObject {
- public:
- NS_DECLARE_STATIC_IID_ACCESSOR(NS_PILISTBOXOBJECT_IID)
- /**
- * Get the list box body. This will search for it as needed.
- * If aFlush is false we don't FlushType::Frames though.
- */
- virtual nsListBoxBodyFrame* GetListBoxBody(bool aFlush) = 0;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsPIListBoxObject, NS_PILISTBOXOBJECT_IID)
-
-#endif // nsPIListBoxObject_h__
--- a/layout/xul/nsPopupSetFrame.cpp
+++ b/layout/xul/nsPopupSetFrame.cpp
@@ -10,16 +10,18 @@
#include "nsIContent.h"
#include "nsPresContext.h"
#include "mozilla/ComputedStyle.h"
#include "nsBoxLayoutState.h"
#include "nsIScrollableFrame.h"
#include "nsIPopupContainer.h"
#include "nsMenuPopupFrame.h"
+typedef mozilla::ComputedStyle ComputedStyle;
+
nsIFrame*
NS_NewPopupSetFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
{
return new (aPresShell) nsPopupSetFrame(aStyle);
}
NS_IMPL_FRAMEARENA_HELPERS(nsPopupSetFrame)
--- a/layout/xul/nsRootBoxFrame.cpp
+++ b/layout/xul/nsRootBoxFrame.cpp
@@ -4,16 +4,17 @@
* 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/. */
#include "nsHTMLParts.h"
#include "nsStyleConsts.h"
#include "nsGkAtoms.h"
#include "nsIPresShell.h"
#include "nsBoxFrame.h"
+#include "nsDisplayList.h"
#include "nsStackLayout.h"
#include "nsIPopupContainer.h"
#include "nsIContent.h"
#include "nsFrameManager.h"
#include "mozilla/BasicEvents.h"
using namespace mozilla;
--- a/layout/xul/nsSliderFrame.cpp
+++ b/layout/xul/nsSliderFrame.cpp
@@ -49,16 +49,17 @@
#include <algorithm>
using namespace mozilla;
using mozilla::layers::APZCCallbackHelper;
using mozilla::layers::AsyncDragMetrics;
using mozilla::layers::InputAPZContext;
using mozilla::layers::ScrollDirection;
using mozilla::layers::ScrollbarData;
+using mozilla::dom::Event;
bool nsSliderFrame::gMiddlePref = false;
int32_t nsSliderFrame::gSnapMultiplier;
// Turn this on if you want to debug slider frames.
#undef DEBUG_SLIDER
static already_AddRefed<nsIContent>
--- a/layout/xul/nsXULPopupManager.h
+++ b/layout/xul/nsXULPopupManager.h
@@ -17,16 +17,17 @@
#include "nsIDOMEventListener.h"
#include "nsPoint.h"
#include "nsCOMPtr.h"
#include "nsTArray.h"
#include "nsIObserver.h"
#include "nsITimer.h"
#include "nsIReflowCallback.h"
#include "nsThreadUtils.h"
+#include "nsPresContext.h"
#include "nsStyleConsts.h"
#include "nsWidgetInitData.h"
#include "mozilla/Attributes.h"
#include "Units.h"
// X.h defines KeyPress
#ifdef KeyPress
#undef KeyPress
--- a/layout/xul/nsXULTooltipListener.cpp
+++ b/layout/xul/nsXULTooltipListener.cpp
@@ -19,16 +19,17 @@
#include "nsIScriptContext.h"
#include "nsPIDOMWindow.h"
#ifdef MOZ_XUL
#include "nsXULPopupManager.h"
#endif
#include "nsIPopupContainer.h"
#include "nsIBoxObject.h"
#include "nsTreeColumns.h"
+#include "nsContentUtils.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/Preferences.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Event.h" // for Event
#include "mozilla/dom/BoxObject.h"
#include "mozilla/dom/MouseEvent.h"
#include "mozilla/dom/TreeColumnBinding.h"
--- a/xpcom/ds/nsGkAtomList.h
+++ b/xpcom/ds/nsGkAtomList.h
@@ -545,22 +545,17 @@ GK_ATOM(legend, "legend")
GK_ATOM(length, "length")
GK_ATOM(letterValue, "letter-value")
GK_ATOM(level, "level")
GK_ATOM(li, "li")
GK_ATOM(line, "line")
GK_ATOM(link, "link")
//GK_ATOM(list, "list") # "list" is present below
GK_ATOM(listbox, "listbox")
-GK_ATOM(listboxbody, "listboxbody")
-GK_ATOM(listcell, "listcell")
-GK_ATOM(listcol, "listcol")
-GK_ATOM(listcols, "listcols")
GK_ATOM(listener, "listener")
-GK_ATOM(listhead, "listhead")
GK_ATOM(listheader, "listheader")
GK_ATOM(listing, "listing")
GK_ATOM(listitem, "listitem")
GK_ATOM(load, "load")
GK_ATOM(triggeringprincipal, "triggeringprincipal")
GK_ATOM(localedir, "localedir")
GK_ATOM(localName, "local-name")
GK_ATOM(longdesc, "longdesc")