Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
nsComputedDOMStyle.cpp File Reference
#include "nsComputedDOMStyle.h"
#include "nsDOMError.h"
#include "nsDOMString.h"
#include "nsIDOMCSS2Properties.h"
#include "nsIDOMElement.h"
#include "nsStyleContext.h"
#include "nsIScrollableFrame.h"
#include "nsContentUtils.h"
#include "prprf.h"
#include "nsCSSProps.h"
#include "nsCSSKeywords.h"
#include "nsDOMCSSRect.h"
#include "nsLayoutAtoms.h"
#include "nsHTMLReflowState.h"
#include "nsThemeConstants.h"
#include "nsPresContext.h"
#include "nsIDocument.h"
#include "nsCSSPseudoElements.h"
#include "nsStyleSet.h"
#include "imgIRequest.h"
#include "nsInspectorCSSUtils.h"

Go to the source code of this file.

Defines

#define COMPUTED_STYLE_MAP_ENTRY(_prop, _method)   { eCSSProperty_##_prop, &nsComputedDOMStyle::Get##_method }

Functions

nsresult NS_NewComputedDOMStyle (nsIComputedDOMStyle **aComputedStyle)
static nsIFrameGetContainingBlockFor (nsIFrame *aFrame)
static NS_INTERFACE_MAP_END void doDestroyComputedDOMStyle (nsComputedDOMStyle *aComputedStyle)
 NS_IMPL_RELEASE_WITH_DESTROY (nsComputedDOMStyle, doDestroyComputedDOMStyle(this)) NS_IMETHODIMP nsComputedDOMStyle

Variables

static nsComputedDOMStylesCachedComputedDOMStyle

Define Documentation

#define COMPUTED_STYLE_MAP_ENTRY (   _prop,
  _method 
)    { eCSSProperty_##_prop, &nsComputedDOMStyle::Get##_method }

Definition at line 3644 of file nsComputedDOMStyle.cpp.


Function Documentation

Definition at line 146 of file nsComputedDOMStyle.cpp.

{
  if (!sCachedComputedDOMStyle) {
    // The cache is empty, store aComputedStyle in the cache.

    sCachedComputedDOMStyle = aComputedStyle;
    sCachedComputedDOMStyle->~nsComputedDOMStyle();
  } else {
    // The cache is full, delete aComputedStyle

    delete aComputedStyle;
  }
}

Here is the call graph for this function:

static nsIFrame* GetContainingBlockFor ( nsIFrame aFrame) [static]

Definition at line 105 of file nsComputedDOMStyle.cpp.

                                        {
  if (!aFrame) {
    return nsnull;
  }
  return nsHTMLReflowState::GetContainingBlockFor(aFrame);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 161 of file nsComputedDOMStyle.cpp.

{
  NS_ENSURE_ARG_POINTER(aElement);
  NS_ENSURE_ARG_POINTER(aPresShell);

  mDocumentWeak = do_GetWeakReference(aPresShell->GetDocument());

  mContent = do_QueryInterface(aElement);
  if (!mContent) {
    // This should not happen, all our elements support nsIContent!

    return NS_ERROR_FAILURE;
  }

  if (!DOMStringIsNull(aPseudoElt) && !aPseudoElt.IsEmpty() &&
      aPseudoElt.First() == PRUnichar(':')) {
    // deal with two-colon forms of aPseudoElt
    nsAString::const_iterator start, end;
    aPseudoElt.BeginReading(start);
    aPseudoElt.EndReading(end);
    NS_ASSERTION(start != end, "aPseudoElt is not empty!");
    ++start;
    PRBool haveTwoColons = PR_TRUE;
    if (start == end || *start != PRUnichar(':')) {
      --start;
      haveTwoColons = PR_FALSE;
    }
    mPseudo = do_GetAtom(Substring(start, end));
    NS_ENSURE_TRUE(mPseudo, NS_ERROR_OUT_OF_MEMORY);

    // There aren't any non-CSS2 pseudo-elements with a single ':'
    if (!haveTwoColons &&
        !nsCSSPseudoElements::IsCSS2PseudoElement(mPseudo)) {
      // XXXbz I'd really rather we threw an exception or something, but
      // the DOM spec sucks.
      mPseudo = nsnull;
    }
  }

  nsPresContext *presCtx = aPresShell->GetPresContext();
  NS_ENSURE_TRUE(presCtx, NS_ERROR_FAILURE);

  mT2P = presCtx->TwipsToPixels();

  return NS_OK;
}

Here is the call graph for this function:

Definition at line 80 of file nsComputedDOMStyle.cpp.

{
  NS_ENSURE_ARG_POINTER(aComputedStyle);

  if (sCachedComputedDOMStyle) {
    // There's an unused nsComputedDOMStyle cached, use it.
    // But before we use it, re-initialize the object.

    // Oh yeah baby, placement new!
    *aComputedStyle = new (sCachedComputedDOMStyle) nsComputedDOMStyle();

    sCachedComputedDOMStyle = nsnull;
  } else {
    // No nsComputedDOMStyle cached, create a new one.

    *aComputedStyle = new nsComputedDOMStyle();
    NS_ENSURE_TRUE(*aComputedStyle, NS_ERROR_OUT_OF_MEMORY);
  }

  NS_ADDREF(*aComputedStyle);

  return NS_OK;
}

Here is the call graph for this function:


Variable Documentation

Definition at line 77 of file nsComputedDOMStyle.cpp.