Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
nsListControlFrame.cpp File Reference
#include "nscore.h"
#include "nsCOMPtr.h"
#include "nsReadableUtils.h"
#include "nsUnicharUtils.h"
#include "nsListControlFrame.h"
#include "nsFormControlFrame.h"
#include "nsFormControlHelper.h"
#include "nsHTMLAtoms.h"
#include "nsIFormControl.h"
#include "nsIDeviceContext.h"
#include "nsIDocument.h"
#include "nsIDOMHTMLCollection.h"
#include "nsIDOMHTMLOptionsCollection.h"
#include "nsIDOMNSHTMLOptionCollectn.h"
#include "nsIDOMHTMLSelectElement.h"
#include "nsIDOMNSHTMLSelectElement.h"
#include "nsIDOMHTMLOptionElement.h"
#include "nsComboboxControlFrame.h"
#include "nsIViewManager.h"
#include "nsIScrollableView.h"
#include "nsIDOMHTMLOptGroupElement.h"
#include "nsWidgetsCID.h"
#include "nsHTMLReflowCommand.h"
#include "nsIPresShell.h"
#include "nsHTMLParts.h"
#include "nsIDOMEventReceiver.h"
#include "nsIEventStateManager.h"
#include "nsIEventListenerManager.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMMouseEvent.h"
#include "nsIPrivateDOMEvent.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsIComponentManager.h"
#include "nsILookAndFeel.h"
#include "nsLayoutAtoms.h"
#include "nsIFontMetrics.h"
#include "nsVoidArray.h"
#include "nsIScrollableFrame.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMNSEvent.h"
#include "nsGUIEvent.h"
#include "nsIServiceManager.h"
#include "nsINodeInfo.h"
#include "nsISelectElement.h"
#include "nsCSSRendering.h"
#include "nsReflowPath.h"
#include "nsITheme.h"
#include "nsIDOMMouseListener.h"
#include "nsIDOMMouseMotionListener.h"
#include "nsIDOMKeyListener.h"
#include "nsLayoutUtils.h"

Go to the source code of this file.

Classes

class  nsListEventListener

Defines

#define INCREMENTAL_SEARCH_KEYPRESS_TIME   1000
#define REFLOW_COUNTER_REQUEST()
#define REFLOW_COUNTER()
#define REFLOW_COUNTER_DUMP(__desc)
#define REFLOW_COUNTER_INIT()
#define REFLOW_DEBUG_MSG(_msg)
#define REFLOW_DEBUG_MSG2(_msg1, _msg2)
#define REFLOW_DEBUG_MSG3(_msg1, _msg2, _msg3)
#define REFLOW_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4)
#define REFLOW_NOISY_MSG(_msg)
#define REFLOW_NOISY_MSG2(_msg1, _msg2)
#define REFLOW_NOISY_MSG3(_msg1, _msg2, _msg3)
#define REFLOW_NOISY_MSG4(_msg1, _msg2, _msg3, _msg4)
#define PX(__v)   __v
#define UNCONSTRAINED_CHECK()
#define FORWARD_EVENT(_event)
#define IGNORE_EVENT(_event)

Functions

nsresult NS_NewListControlFrame (nsIPresShell *aPresShell, nsIFrame **aNewFrame)
static nscoord GetMaxOptionHeight (nsIFrame *aContainer)
static PRBool IsOptGroup (nsIContent *aContent)
static PRBool IsOption (nsIContent *aContent)
static PRUint32 GetNumberOfOptionsRecursive (nsIContent *aContent)
static nscoord GetOptGroupLabelsHeight (nsPresContext *aPresContext, nsIContent *aContent, nscoord aRowHeight)

Variables

const nscoord kMaxDropDownRows = 20
const PRInt32 kDefaultMultiselectHeight = 4
const PRInt32 kNothingSelected = -1
const PRInt32 kMaxZ = 0x7fffffff
const PRInt32 kNoSizeSpecified = -1

Define Documentation

#define FORWARD_EVENT (   _event)
Value:
NS_IMETHODIMP \
nsListEventListener::_event(nsIDOMEvent* aEvent) \
{ \
  if (mFrame) \
    return mFrame->nsListControlFrame::_event(aEvent); \
  return NS_OK; \
}

Definition at line 3298 of file nsListControlFrame.cpp.

#define IGNORE_EVENT (   _event)
Value:
NS_IMETHODIMP \
nsListEventListener::_event(nsIDOMEvent* aEvent) \
{ return NS_OK; }

Definition at line 3307 of file nsListControlFrame.cpp.

Definition at line 108 of file nsListControlFrame.cpp.

#define PX (   __v)    __v

Definition at line 264 of file nsListControlFrame.cpp.

Definition at line 231 of file nsListControlFrame.cpp.

#define REFLOW_COUNTER_DUMP (   __desc)

Definition at line 232 of file nsListControlFrame.cpp.

Definition at line 233 of file nsListControlFrame.cpp.

Definition at line 230 of file nsListControlFrame.cpp.

#define REFLOW_DEBUG_MSG (   _msg)

Definition at line 235 of file nsListControlFrame.cpp.

#define REFLOW_DEBUG_MSG2 (   _msg1,
  _msg2 
)

Definition at line 236 of file nsListControlFrame.cpp.

#define REFLOW_DEBUG_MSG3 (   _msg1,
  _msg2,
  _msg3 
)

Definition at line 237 of file nsListControlFrame.cpp.

#define REFLOW_DEBUG_MSG4 (   _msg1,
  _msg2,
  _msg3,
  _msg4 
)

Definition at line 238 of file nsListControlFrame.cpp.

#define REFLOW_NOISY_MSG (   _msg)

Definition at line 252 of file nsListControlFrame.cpp.

#define REFLOW_NOISY_MSG2 (   _msg1,
  _msg2 
)

Definition at line 253 of file nsListControlFrame.cpp.

#define REFLOW_NOISY_MSG3 (   _msg1,
  _msg2,
  _msg3 
)

Definition at line 254 of file nsListControlFrame.cpp.

#define REFLOW_NOISY_MSG4 (   _msg1,
  _msg2,
  _msg3,
  _msg4 
)

Definition at line 255 of file nsListControlFrame.cpp.

Definition at line 281 of file nsListControlFrame.cpp.


Function Documentation

static nscoord GetMaxOptionHeight ( nsIFrame aContainer) [static]

Definition at line 599 of file nsListControlFrame.cpp.

{
  nscoord result = 0;
  for (nsIFrame* option = aContainer->GetFirstChild(nsnull);
       option; option = option->GetNextSibling()) {
    nscoord optionHeight;
    if (nsCOMPtr<nsIDOMHTMLOptGroupElement>
        (do_QueryInterface(option->GetContent()))) {
      // an optgroup
      optionHeight = GetMaxOptionHeight(option);
    } else {
      // an option
      optionHeight = option->GetSize().height;
    }
    if (result < optionHeight)
      result = optionHeight;
  }
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRUint32 GetNumberOfOptionsRecursive ( nsIContent aContent) [static]

Definition at line 636 of file nsListControlFrame.cpp.

{
  PRUint32 optionCount = 0;
  const PRUint32 childCount = aContent ? aContent->GetChildCount() : 0;
  for (PRUint32 index = 0; index < childCount; ++index) {
    nsIContent* child = aContent->GetChildAt(index);
    if (::IsOption(child)) {
      ++optionCount;
    }
    else if (::IsOptGroup(child)) {
      optionCount += ::GetNumberOfOptionsRecursive(child);
    }
  }
  return optionCount;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static nscoord GetOptGroupLabelsHeight ( nsPresContext aPresContext,
nsIContent aContent,
nscoord  aRowHeight 
) [static]

Definition at line 653 of file nsListControlFrame.cpp.

{
  nscoord height = 0;
  const PRUint32 childCount = aContent ? aContent->GetChildCount() : 0;
  for (PRUint32 index = 0; index < childCount; ++index) {
    nsIContent* child = aContent->GetChildAt(index);
    if (::IsOptGroup(child)) {
      PRUint32 numOptions = ::GetNumberOfOptionsRecursive(child);
      nscoord optionsHeight = aRowHeight * numOptions;
      nsIFrame* frame = nsnull;
      aPresContext->GetPresShell()->GetPrimaryFrameFor(child, &frame);
      nscoord totalHeight = frame ? frame->GetSize().height : 0;
      height += PR_MAX(0, totalHeight - optionsHeight);
    }
  }
  return height;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool IsOptGroup ( nsIContent aContent) [inline, static]

Definition at line 620 of file nsListControlFrame.cpp.

{
  nsINodeInfo *ni = aContent->GetNodeInfo();
  return (ni && ni->Equals(nsHTMLAtoms::optgroup) &&
          aContent->IsContentOfType(nsIContent::eHTML));
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool IsOption ( nsIContent aContent) [inline, static]

Definition at line 628 of file nsListControlFrame.cpp.

{
  nsINodeInfo *ni = aContent->GetNodeInfo();
  return (ni && ni->Equals(nsHTMLAtoms::option) &&
          aContent->IsContentOfType(nsIContent::eHTML));
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult NS_NewListControlFrame ( nsIPresShell aPresShell,
nsIFrame **  aNewFrame 
)

Definition at line 160 of file nsListControlFrame.cpp.

{
  NS_PRECONDITION(aNewFrame, "null OUT ptr");
  if (nsnull == aNewFrame) {
    return NS_ERROR_NULL_POINTER;
  }
  nsListControlFrame* it =
    new (aPresShell) nsListControlFrame(aPresShell, aPresShell->GetDocument());
  if (!it) {
    return NS_ERROR_OUT_OF_MEMORY;
  }
  it->AddStateBits(NS_FRAME_INDEPENDENT_SELECTION);
#if 0
  // set the state flags (if any are provided)
  it->AddStateBits(NS_BLOCK_SPACE_MGR);
#endif
  *aNewFrame = it;
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 99 of file nsListControlFrame.cpp.

Definition at line 98 of file nsListControlFrame.cpp.

const PRInt32 kMaxZ = 0x7fffffff

Definition at line 101 of file nsListControlFrame.cpp.

Definition at line 102 of file nsListControlFrame.cpp.

Definition at line 100 of file nsListControlFrame.cpp.