author Jean-Yves Avenard <>
Wed, 31 Jan 2018 19:08:51 +0100
changeset 463332 4e8af01f19c29b43c1f0606d1fac0d262c777b40
parent 453858 9badfca43f1c215f4ac611bcb6cb4b87038c5f4e
permissions -rw-r--r--
Bug 1432779 - P4. Remove the concept of preferred layout. r=padenot,r=kamidphish Channel layout is derived by the content being played. The concept of preferred layout is meaningless. Either we have a layout defined, or we don't. There's no in-between. So we remove it. MozReview-Commit-ID: CSCAInNmzMS

/* -*- 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 */

#ifndef __inDOMView_h__
#define __inDOMView_h__

#include "inIDOMView.h"

#include "nsITreeView.h"
#include "nsITreeSelection.h"
#include "nsStubMutationObserver.h"
#include "nsIDOMNode.h"
#include "nsIDOMDocument.h"
#include "nsTArray.h"
#include "nsCOMArray.h"
#include "nsCOMPtr.h"

class inDOMViewNode;
class nsDOMAttributeMap;

class inDOMView : public inIDOMView,
                  public nsITreeView,
                  public nsStubMutationObserver


  // nsIMutationObserver

  virtual ~inDOMView();

  nsCOMPtr<nsITreeBoxObject> mTree;
  nsCOMPtr<nsITreeSelection> mSelection;

  bool mShowAnonymous;
  bool mShowSubDocuments;
  bool mShowWhitespaceNodes;
  bool mShowAccessibleNodes;
  uint32_t mWhatToShow;

  nsCOMPtr<nsIDOMNode> mRootNode;
  nsCOMPtr<nsIDOMDocument> mRootDocument;

  nsTArray<inDOMViewNode*> mNodes;

  inDOMViewNode* GetNodeAt(int32_t aIndex);
  int32_t GetRowCount();
  int32_t NodeToRow(inDOMViewNode* aNode);
  bool RowOutOfBounds(int32_t aRow, int32_t aCount);
  inDOMViewNode* CreateNode(nsIDOMNode* aNode, inDOMViewNode* aParent);
  void AppendNode(inDOMViewNode* aNode);
  void InsertNode(inDOMViewNode* aNode, int32_t aIndex);
  void RemoveNode(int32_t aIndex);
  void ReplaceNode(inDOMViewNode* aNode, int32_t aIndex);
  void InsertNodes(nsTArray<inDOMViewNode*>& aNodes, int32_t aIndex);
  void RemoveNodes(int32_t aIndex, int32_t aCount);
  void RemoveAllNodes();
  void ExpandNode(int32_t aRow);
  void CollapseNode(int32_t aRow);

  nsresult RowToNode(int32_t aRow, inDOMViewNode** aNode);
  nsresult NodeToRow(nsIDOMNode* aNode, int32_t* aRow);

  void InsertLinkAfter(inDOMViewNode* aNode, inDOMViewNode* aInsertAfter);
  void InsertLinkBefore(inDOMViewNode* aNode, inDOMViewNode* aInsertBefore);
  void RemoveLink(inDOMViewNode* aNode);
  void ReplaceLink(inDOMViewNode* aNewNode, inDOMViewNode* aOldNode);

  nsresult GetChildNodesFor(nsIDOMNode* aNode, nsCOMArray<nsIDOMNode>& aResult);
  void AppendKidsToArray(nsINodeList* aKids, nsCOMArray<nsIDOMNode>& aArray);
  nsresult AppendAttrsToArray(nsDOMAttributeMap* aKids, nsCOMArray<nsIDOMNode>& aArray);
  nsresult GetFirstDescendantOf(inDOMViewNode* aNode, int32_t aRow, int32_t* aResult);
  nsresult GetLastDescendantOf(inDOMViewNode* aNode, int32_t aRow, int32_t* aResult);

// {FB5C1775-1BBD-4b9c-ABB0-AE7ACD29E87E}
#define IN_DOMVIEW_CID \
{ 0xfb5c1775, 0x1bbd, 0x4b9c, { 0xab, 0xb0, 0xae, 0x7a, 0xcd, 0x29, 0xe8, 0x7e } }

#endif // __inDOMView_h__