Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions | Variables
nsMathMLFrame.cpp File Reference
#include "nsINameSpaceManager.h"
#include "nsMathMLFrame.h"
#include "nsMathMLChar.h"
#include "nsCSSAnonBoxes.h"
#include "nsIDocument.h"
#include "nsStyleSet.h"
#include "nsIStyleSheet.h"
#include "nsICSSStyleSheet.h"
#include "nsIDOMCSSStyleSheet.h"
#include "nsICSSRule.h"
#include "nsICSSStyleRule.h"
#include "nsStyleChangeList.h"
#include "nsFrameManager.h"
#include "nsNetUtil.h"
#include "nsIURI.h"
#include "nsContentCID.h"
#include "nsAutoPtr.h"
#include "nsStyleUtil.h"

Go to the source code of this file.

Classes

struct  nsCSSMapping

Functions

static NS_DEFINE_CID (kCSSStyleSheetCID, NS_CSS_STYLESHEET_CID)
static void GetMathMLAttributeStyleSheet (nsPresContext *aPresContext, nsIStyleSheet **aSheet)

Variables

static const PRInt32 kMathMLversion1 = 1
static const PRInt32 kMathMLversion2 = 2

Class Documentation

struct nsCSSMapping

Definition at line 520 of file nsMathMLFrame.cpp.

Collaboration diagram for nsCSSMapping:
Class Members
const nsIAtom * attrAtom
PRInt32 compatibility
const char * cssProperty

Function Documentation

static void GetMathMLAttributeStyleSheet ( nsPresContext aPresContext,
nsIStyleSheet **  aSheet 
) [static]

Definition at line 528 of file nsMathMLFrame.cpp.

{
  static const char kTitle[] = "Internal MathML/CSS Attribute Style Sheet";
  *aSheet = nsnull;

  // first, look if the attribute stylesheet is already there
  nsStyleSet *styleSet = aPresContext->StyleSet();
  NS_ASSERTION(styleSet, "no style set");

  nsAutoString title;
  for (PRInt32 i = styleSet->SheetCount(nsStyleSet::eAgentSheet) - 1;
       i >= 0; --i) {
    nsIStyleSheet *sheet = styleSet->StyleSheetAt(nsStyleSet::eAgentSheet, i);
    nsCOMPtr<nsICSSStyleSheet> cssSheet(do_QueryInterface(sheet));
    if (cssSheet) {
      cssSheet->GetTitle(title);
      if (title.Equals(NS_ConvertASCIItoUCS2(kTitle))) {
        *aSheet = sheet;
        NS_IF_ADDREF(*aSheet);
        return;
      }
    }
  }

  // then, create a new one if it isn't yet there
  nsCOMPtr<nsIURI> uri;
  NS_NewURI(getter_AddRefs(uri), "about:internal-mathml-attribute-stylesheet");
  if (!uri)
    return;
  nsCOMPtr<nsICSSStyleSheet_MOZILLA_1_8_BRANCH> cssSheet =
    do_CreateInstance(kCSSStyleSheetCID);
  if (!cssSheet)
    return;
  cssSheet->SetURIs18(uri, uri, uri);
  cssSheet->SetTitle(NS_ConvertASCIItoUCS2(kTitle));
  // all done, no further activity from the net involved, so we better do this
  cssSheet->SetComplete();

  nsCOMPtr<nsIDOMCSSStyleSheet> domSheet(do_QueryInterface(cssSheet));
  if (domSheet) {
    PRUint32 index;
    domSheet->InsertRule(NS_LITERAL_STRING("@namespace url(http://www.w3.org/1998/Math/MathML);"),
                                           0, &index);
  }

  // insert the stylesheet into the styleset without notifying observers
  // XXX Should this be at a different level?
  styleSet->PrependStyleSheet(nsStyleSet::eAgentSheet, cssSheet);
  *aSheet = cssSheet;
  NS_ADDREF(*aSheet);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static NS_DEFINE_CID ( kCSSStyleSheetCID  ,
NS_CSS_STYLESHEET_CID   
) [static]

Variable Documentation

Definition at line 517 of file nsMathMLFrame.cpp.

Definition at line 518 of file nsMathMLFrame.cpp.