зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1252211 - Convert TreeContentView to WebIDL. r=bz.
--HG-- extra : rebase_source : 246c1dda3db15ed0332af895485853e6e5d1ffa4 extra : intermediate-source : 0312d6ff0792f8d9cb20f2e06cbae59d5bbf690a extra : source : 7b808c16e93cbd395a9f57bda4a9206e11a6df69
This commit is contained in:
Родитель
7c1c7552a6
Коммит
d34f37d164
|
@ -73,10 +73,6 @@
|
||||||
#include "nsMemory.h"
|
#include "nsMemory.h"
|
||||||
|
|
||||||
// includes needed for the prototype chain interfaces
|
// includes needed for the prototype chain interfaces
|
||||||
#ifdef MOZ_XUL
|
|
||||||
#include "nsITreeContentView.h"
|
|
||||||
#include "nsITreeView.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "nsIEventListenerService.h"
|
#include "nsIEventListenerService.h"
|
||||||
#include "nsIMessageManager.h"
|
#include "nsIMessageManager.h"
|
||||||
|
@ -174,12 +170,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||||
|
|
||||||
// Misc Core related classes
|
// Misc Core related classes
|
||||||
|
|
||||||
// XUL classes
|
|
||||||
#ifdef MOZ_XUL
|
|
||||||
NS_DEFINE_CHROME_XBL_CLASSINFO_DATA(TreeContentView, nsDOMGenericSH,
|
|
||||||
DEFAULT_SCRIPTABLE_FLAGS)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ContentFrameMessageManager,
|
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ContentFrameMessageManager,
|
||||||
nsMessageManagerSH<nsEventTargetSH>,
|
nsMessageManagerSH<nsEventTargetSH>,
|
||||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||||
|
@ -448,13 +438,6 @@ nsDOMClassInfo::Init()
|
||||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMConstructor)
|
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMConstructor)
|
||||||
DOM_CLASSINFO_MAP_END
|
DOM_CLASSINFO_MAP_END
|
||||||
|
|
||||||
#ifdef MOZ_XUL
|
|
||||||
DOM_CLASSINFO_MAP_BEGIN(TreeContentView, nsITreeContentView)
|
|
||||||
DOM_CLASSINFO_MAP_ENTRY(nsITreeContentView)
|
|
||||||
DOM_CLASSINFO_MAP_ENTRY(nsITreeView)
|
|
||||||
DOM_CLASSINFO_MAP_END
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ContentFrameMessageManager, nsISupports)
|
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ContentFrameMessageManager, nsISupports)
|
||||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||||
DOM_CLASSINFO_MAP_ENTRY(nsIMessageListenerManager)
|
DOM_CLASSINFO_MAP_ENTRY(nsIMessageListenerManager)
|
||||||
|
|
|
@ -19,11 +19,6 @@ enum nsDOMClassInfoID
|
||||||
eDOMClassInfo_DOMPrototype_id,
|
eDOMClassInfo_DOMPrototype_id,
|
||||||
eDOMClassInfo_DOMConstructor_id,
|
eDOMClassInfo_DOMConstructor_id,
|
||||||
|
|
||||||
// XUL classes
|
|
||||||
#ifdef MOZ_XUL
|
|
||||||
eDOMClassInfo_TreeContentView_id,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
eDOMClassInfo_ContentFrameMessageManager_id,
|
eDOMClassInfo_ContentFrameMessageManager_id,
|
||||||
eDOMClassInfo_ContentProcessMessageManager_id,
|
eDOMClassInfo_ContentProcessMessageManager_id,
|
||||||
eDOMClassInfo_ChromeMessageBroadcaster_id,
|
eDOMClassInfo_ChromeMessageBroadcaster_id,
|
||||||
|
|
|
@ -1090,6 +1090,10 @@ DOMInterfaces = {
|
||||||
'nativeType': 'nsTreeColumns',
|
'nativeType': 'nsTreeColumns',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'TreeContentView': {
|
||||||
|
'nativeType': 'nsTreeContentView',
|
||||||
|
},
|
||||||
|
|
||||||
'TreeWalker': {
|
'TreeWalker': {
|
||||||
'wrapperCache': False,
|
'wrapperCache': False,
|
||||||
},
|
},
|
||||||
|
|
|
@ -82,6 +82,7 @@ Text implements LegacyQueryInterface;
|
||||||
Touch implements LegacyQueryInterface;
|
Touch implements LegacyQueryInterface;
|
||||||
TouchList implements LegacyQueryInterface;
|
TouchList implements LegacyQueryInterface;
|
||||||
TreeColumns implements LegacyQueryInterface;
|
TreeColumns implements LegacyQueryInterface;
|
||||||
|
TreeContentView implements LegacyQueryInterface;
|
||||||
TreeWalker implements LegacyQueryInterface;
|
TreeWalker implements LegacyQueryInterface;
|
||||||
ValidityState implements LegacyQueryInterface;
|
ValidityState implements LegacyQueryInterface;
|
||||||
WebSocket implements LegacyQueryInterface;
|
WebSocket implements LegacyQueryInterface;
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
/* -*- 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/. */
|
||||||
|
|
||||||
|
[Func="IsChromeOrXBL"]
|
||||||
|
interface TreeContentView
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Retrieve the content item associated with the specified row.
|
||||||
|
*/
|
||||||
|
[Throws]
|
||||||
|
Element? getItemAtIndex(long row);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the index associated with the specified content item.
|
||||||
|
*/
|
||||||
|
long getIndexOfItem(Element? item);
|
||||||
|
};
|
||||||
|
TreeContentView implements TreeView;
|
|
@ -926,6 +926,7 @@ WEBIDL_FILES = [
|
||||||
'TreeBoxObject.webidl',
|
'TreeBoxObject.webidl',
|
||||||
'TreeColumn.webidl',
|
'TreeColumn.webidl',
|
||||||
'TreeColumns.webidl',
|
'TreeColumns.webidl',
|
||||||
|
'TreeContentView.webidl',
|
||||||
'TreeView.webidl',
|
'TreeView.webidl',
|
||||||
'TreeWalker.webidl',
|
'TreeWalker.webidl',
|
||||||
'U2F.webidl',
|
'U2F.webidl',
|
||||||
|
|
|
@ -90,7 +90,7 @@ load 508927-1.xul
|
||||||
load 508927-2.xul
|
load 508927-2.xul
|
||||||
load 514300-1.xul
|
load 514300-1.xul
|
||||||
asserts-if(stylo,2) load 536931-1.xhtml # bug 1370830
|
asserts-if(stylo,2) load 536931-1.xhtml # bug 1370830
|
||||||
asserts(1) load 538308-1.xul
|
load 538308-1.xul
|
||||||
load 557174-1.xml
|
load 557174-1.xml
|
||||||
load 564705-1.xul
|
load 564705-1.xul
|
||||||
asserts-if(stylo,2) load 583957-1.html # bug 1370830
|
asserts-if(stylo,2) load 583957-1.html # bug 1370830
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -10,7 +10,6 @@
|
||||||
#include "nsTArray.h"
|
#include "nsTArray.h"
|
||||||
#include "nsStubDocumentObserver.h"
|
#include "nsStubDocumentObserver.h"
|
||||||
#include "nsITreeBoxObject.h"
|
#include "nsITreeBoxObject.h"
|
||||||
#include "nsITreeColumns.h"
|
|
||||||
#include "nsITreeView.h"
|
#include "nsITreeView.h"
|
||||||
#include "nsITreeContentView.h"
|
#include "nsITreeContentView.h"
|
||||||
#include "nsITreeSelection.h"
|
#include "nsITreeSelection.h"
|
||||||
|
@ -18,20 +17,105 @@
|
||||||
#include "mozilla/UniquePtr.h"
|
#include "mozilla/UniquePtr.h"
|
||||||
|
|
||||||
class nsIDocument;
|
class nsIDocument;
|
||||||
|
class nsSelection;
|
||||||
|
class nsTreeColumn;
|
||||||
class Row;
|
class Row;
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
class DataTransfer;
|
||||||
|
class TreeBoxObject;
|
||||||
|
} // namespace dom
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
nsresult NS_NewTreeContentView(nsITreeView** aResult);
|
nsresult NS_NewTreeContentView(nsITreeView** aResult);
|
||||||
|
|
||||||
class nsTreeContentView final : public nsINativeTreeView,
|
class nsTreeContentView final : public nsINativeTreeView,
|
||||||
public nsITreeContentView,
|
public nsITreeContentView,
|
||||||
public nsStubDocumentObserver
|
public nsStubDocumentObserver,
|
||||||
|
public nsWrapperCache
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsTreeContentView(void);
|
nsTreeContentView(void);
|
||||||
|
|
||||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsTreeContentView,
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsTreeContentView,
|
||||||
nsINativeTreeView)
|
nsINativeTreeView)
|
||||||
|
|
||||||
|
virtual JSObject* WrapObject(JSContext* aCx,
|
||||||
|
JS::Handle<JSObject*> aGivenProto) override;
|
||||||
|
nsISupports* GetParentObject();
|
||||||
|
|
||||||
|
int32_t RowCount()
|
||||||
|
{
|
||||||
|
return mRows.Length();
|
||||||
|
}
|
||||||
|
nsITreeSelection* GetSelection()
|
||||||
|
{
|
||||||
|
return mSelection;
|
||||||
|
}
|
||||||
|
void SetSelection(nsITreeSelection* aSelection,
|
||||||
|
mozilla::ErrorResult& aError);
|
||||||
|
void GetRowProperties(int32_t aRow, nsAString& aProperties,
|
||||||
|
mozilla::ErrorResult& aError);
|
||||||
|
void GetCellProperties(int32_t aRow, nsTreeColumn& aColumn,
|
||||||
|
nsAString& aProperies, mozilla::ErrorResult& aError);
|
||||||
|
void GetColumnProperties(nsTreeColumn& aColumn, nsAString& aProperies);
|
||||||
|
bool IsContainer(int32_t aRow, mozilla::ErrorResult& aError);
|
||||||
|
bool IsContainerOpen(int32_t aRow, mozilla::ErrorResult& aError);
|
||||||
|
bool IsContainerEmpty(int32_t aRow, mozilla::ErrorResult& aError);
|
||||||
|
bool IsSeparator(int32_t aRow, mozilla::ErrorResult& aError);
|
||||||
|
bool IsSorted()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bool CanDrop(int32_t aRow, int32_t aOrientation,
|
||||||
|
mozilla::dom::DataTransfer* aDataTransfer,
|
||||||
|
mozilla::ErrorResult& aError);
|
||||||
|
void Drop(int32_t aRow, int32_t aOrientation,
|
||||||
|
mozilla::dom::DataTransfer* aDataTransfer,
|
||||||
|
mozilla::ErrorResult& aError);
|
||||||
|
int32_t GetParentIndex(int32_t aRow, mozilla::ErrorResult& aError);
|
||||||
|
bool HasNextSibling(int32_t aRow, int32_t aAfterIndex,
|
||||||
|
mozilla::ErrorResult& aError);
|
||||||
|
int32_t GetLevel(int32_t aRow, mozilla::ErrorResult& aError);
|
||||||
|
void GetImageSrc(int32_t aRow, nsTreeColumn& aColumn, nsAString& aSrc,
|
||||||
|
mozilla::ErrorResult& aError);
|
||||||
|
int32_t GetProgressMode(int32_t aRow, nsTreeColumn& aColumn,
|
||||||
|
mozilla::ErrorResult& aError);
|
||||||
|
void GetCellValue(int32_t aRow, nsTreeColumn& aColumn, nsAString& aValue,
|
||||||
|
mozilla::ErrorResult& aError);
|
||||||
|
void GetCellText(int32_t aRow, nsTreeColumn& aColumn, nsAString& aText,
|
||||||
|
mozilla::ErrorResult& aError);
|
||||||
|
void SetTree(mozilla::dom::TreeBoxObject* aTree,
|
||||||
|
mozilla::ErrorResult& aError);
|
||||||
|
void ToggleOpenState(int32_t aRow, mozilla::ErrorResult& aError);
|
||||||
|
void CycleHeader(nsTreeColumn& aColumn, mozilla::ErrorResult& aError);
|
||||||
|
// XPCOM SelectionChanged() is OK
|
||||||
|
void CycleCell(int32_t aRow, nsTreeColumn& aColumn)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
bool IsEditable(int32_t aRow, nsTreeColumn& aColumn,
|
||||||
|
mozilla::ErrorResult& aError);
|
||||||
|
bool IsSelectable(int32_t aRow, nsTreeColumn& aColumn,
|
||||||
|
mozilla::ErrorResult& aError);
|
||||||
|
void SetCellValue(int32_t aRow, nsTreeColumn& aColumn,
|
||||||
|
const nsAString& aValue, mozilla::ErrorResult& aError);
|
||||||
|
void SetCellText(int32_t aRow, nsTreeColumn& aColumn,
|
||||||
|
const nsAString& aText, mozilla::ErrorResult& aError);
|
||||||
|
void PerformAction(const nsAString& aAction)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void PerformActionOnRow(const nsAString& aAction, int32_t aRow)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void PerformActionOnCell(const nsAString& aAction, int32_t aRow,
|
||||||
|
nsTreeColumn& aColumn)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
mozilla::dom::Element* GetItemAtIndex(int32_t aRow,
|
||||||
|
mozilla::ErrorResult& aError);
|
||||||
|
int32_t GetIndexOfItem(mozilla::dom::Element* aItem);
|
||||||
|
|
||||||
NS_DECL_NSITREEVIEW
|
NS_DECL_NSITREEVIEW
|
||||||
// nsINativeTreeView: Untrusted code can use us
|
// nsINativeTreeView: Untrusted code can use us
|
||||||
|
@ -55,10 +139,10 @@ class nsTreeContentView final : public nsINativeTreeView,
|
||||||
void Serialize(nsIContent* aContent, int32_t aParentIndex, int32_t* aIndex,
|
void Serialize(nsIContent* aContent, int32_t aParentIndex, int32_t* aIndex,
|
||||||
nsTArray<mozilla::UniquePtr<Row>>& aRows);
|
nsTArray<mozilla::UniquePtr<Row>>& aRows);
|
||||||
|
|
||||||
void SerializeItem(nsIContent* aContent, int32_t aParentIndex,
|
void SerializeItem(Element* aContent, int32_t aParentIndex,
|
||||||
int32_t* aIndex, nsTArray<mozilla::UniquePtr<Row>>& aRows);
|
int32_t* aIndex, nsTArray<mozilla::UniquePtr<Row>>& aRows);
|
||||||
|
|
||||||
void SerializeSeparator(nsIContent* aContent, int32_t aParentIndex,
|
void SerializeSeparator(Element* aContent, int32_t aParentIndex,
|
||||||
int32_t* aIndex, nsTArray<mozilla::UniquePtr<Row>>& aRows);
|
int32_t* aIndex, nsTArray<mozilla::UniquePtr<Row>>& aRows);
|
||||||
|
|
||||||
void GetIndexInSubtree(nsIContent* aContainer, nsIContent* aContent, int32_t* aResult);
|
void GetIndexInSubtree(nsIContent* aContainer, nsIContent* aContent, int32_t* aResult);
|
||||||
|
@ -87,9 +171,11 @@ class nsTreeContentView final : public nsINativeTreeView,
|
||||||
void UpdateParentIndexes(int32_t aIndex, int32_t aSkip, int32_t aCount);
|
void UpdateParentIndexes(int32_t aIndex, int32_t aSkip, int32_t aCount);
|
||||||
|
|
||||||
// Content helpers.
|
// Content helpers.
|
||||||
nsIContent* GetCell(nsIContent* aContainer, nsITreeColumn* aCol);
|
nsIContent* GetCell(nsIContent* aContainer, nsTreeColumn& aCol);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool IsValidRowIndex(int32_t aRowIndex);
|
||||||
|
|
||||||
nsCOMPtr<nsITreeBoxObject> mBoxObject;
|
nsCOMPtr<nsITreeBoxObject> mBoxObject;
|
||||||
nsCOMPtr<nsITreeSelection> mSelection;
|
nsCOMPtr<nsITreeSelection> mSelection;
|
||||||
nsCOMPtr<nsIContent> mRoot;
|
nsCOMPtr<nsIContent> mRoot;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче