Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Attributes
CSSFirstLetterRule Class Reference
Inheritance diagram for CSSFirstLetterRule:
Inheritance graph
Collaboration diagram for CSSFirstLetterRule:
Collaboration graph

List of all members.

Public Member Functions

 CSSFirstLetterRule ()
NS_IMETHOD MapRuleInfoInto (nsRuleData *aRuleData)
 |nsIStyleRule::MapRuleInfoInto| is a request to copy all stylistic data represented by the rule that:
NS_DECL_ISUPPORTS void CommonMapRuleInfoInto (nsRuleData *aRuleData)

Protected Attributes

nsCSSValueList mInheritList
nsCSSQuotes mInheritQuotes
nsCSSCounterData mNoneCounter

Detailed Description

Definition at line 101 of file nsHTMLCSSStyleSheet.cpp.

Constructor & Destructor Documentation

Definition at line 103 of file nsHTMLCSSStyleSheet.cpp.


Member Function Documentation

Definition at line 136 of file nsHTMLCSSStyleSheet.cpp.

   * Common code for disabling the properties that apply neither to
   * :first-letter nor to :first-line.

  // Disable 'unicode-bidi'.
  if (aData->mSID == eStyleStruct_TextReset) {
    nsCSSValue normal(eCSSUnit_Normal);
    aData->mTextData->mUnicodeBidi = normal;

  // NOTE: 'text-align', 'text-indent', and 'white-space' should not be
  // handled by the frames so we don't need to bother.

  // Disable everything in the nsRuleDataDisplay struct except 'float'
  // and 'clear'.
  if (aData->mSID == eStyleStruct_Visibility) {
    nsCSSValue inherit(eCSSUnit_Inherit);
    aData->mDisplayData->mVisibility = inherit;
    aData->mDisplayData->mDirection = inherit;

  if (aData->mSID == eStyleStruct_Display) {
    nsCSSValue none(eCSSUnit_None);
    aData->mDisplayData->mAppearance = none;

    nsCSSValue autovalue(eCSSUnit_Auto);
    aData->mDisplayData->mClip.mTop = autovalue;
    aData->mDisplayData->mClip.mRight = autovalue;
    aData->mDisplayData->mClip.mBottom = autovalue;
    aData->mDisplayData->mClip.mLeft = autovalue;

    nsCSSValue one(1.0f, eCSSUnit_Number);
    aData->mDisplayData->mOpacity = one;

    nsCSSValue inlinevalue(NS_STYLE_DISPLAY_INLINE, eCSSUnit_Enumerated);
    aData->mDisplayData->mDisplay = inlinevalue;

    aData->mDisplayData->mBinding = none;

    nsCSSValue staticposition(NS_STYLE_POSITION_STATIC, eCSSUnit_Enumerated);
    aData->mDisplayData->mPosition = staticposition;

    nsCSSValue visible(NS_STYLE_OVERFLOW_VISIBLE, eCSSUnit_Enumerated);
    aData->mDisplayData->mOverflowX = visible;
    aData->mDisplayData->mOverflowY = visible;

    // Nobody will care about 'break-before' or 'break-after', since
    // they only apply to blocks (assuming we implement them correctly).

  // NOTE:  We'll never do anything with what's in nsCSSList,
  // nsCSSTable, nsCSSBreaks, nsCSSPage, nsCSSAural, nsCSSXUL, or
  // nsCSSSVG, so don't bother.

  // Disable everything in the position struct.
  if (aData->mSID == eStyleStruct_Position) {
    nsCSSValue autovalue(eCSSUnit_Auto);
    nsCSSValue none(eCSSUnit_None);
    nsCSSValue zero(0.0f, eCSSUnit_Point);
    aData->mPositionData->mOffset.mTop = autovalue;
    aData->mPositionData->mOffset.mRight = autovalue;
    aData->mPositionData->mOffset.mBottom = autovalue;
    aData->mPositionData->mOffset.mLeft = autovalue;
    aData->mPositionData->mWidth = autovalue;
    aData->mPositionData->mMinWidth = zero;
    aData->mPositionData->mMaxWidth = none;
    aData->mPositionData->mHeight = autovalue;
    aData->mPositionData->mMinHeight = zero;
    aData->mPositionData->mMaxHeight = none;
    nsCSSValue content(NS_STYLE_BOX_SIZING_CONTENT, eCSSUnit_Enumerated);
    aData->mPositionData->mBoxSizing = content;
    aData->mPositionData->mZIndex = autovalue;

  // Disable everything in the Content struct.
  if (aData->mSID == eStyleStruct_Content) {
    // Don't bother resetting 'content'.

    aData->mContentData->mCounterIncrement = &mNoneCounter;
    aData->mContentData->mCounterReset = &mNoneCounter;

    nsCSSValue autovalue(eCSSUnit_Auto);
    aData->mContentData->mMarkerOffset = autovalue;

  if (aData->mSID == eStyleStruct_Quotes) {
    aData->mContentData->mQuotes = &mInheritQuotes;

  // Disable everything in the UserInterface struct.
  if (aData->mSID == eStyleStruct_UserInterface) {
    nsCSSValue inherit(eCSSUnit_Inherit);
    aData->mUserInterfaceData->mUserInput = inherit;
    aData->mUserInterfaceData->mUserModify = inherit;
    aData->mUserInterfaceData->mUserFocus = inherit;
    aData->mUserInterfaceData->mCursor = &mInheritList;

  if (aData->mSID == eStyleStruct_UIReset) {
    nsCSSValue autovalue(eCSSUnit_Auto);
    nsCSSValue none(eCSSUnit_None);
    // Don't bother with '-moz-force-broken-image-icon' since it's only
    // half a property.
    // Don't bother with '-moz-user-select' because there's no way to
    // specify the initial value.

  // Disable all outline properties.
  if (aData->mSID == eStyleStruct_Outline) {
    nsCSSValue none(NS_STYLE_BORDER_STYLE_NONE, eCSSUnit_Enumerated);
    aData->mMarginData->mOutlineStyle = none;


Here is the caller graph for this function:

|nsIStyleRule::MapRuleInfoInto| is a request to copy all stylistic data represented by the rule that:

  • are relevant for |aRuleData->mSID| (the style struct ID)
  • are not already filled into the data struct into the appropriate data struct in |aRuleData|. It is important that only empty data are filled in, since the rule tree is walked from highest priority rule to least, so that the walk can stop if all needed data are found. Thus overwriting non-empty data will break CSS cascading rules.

Implements nsIStyleRule.

Definition at line 303 of file nsHTMLCSSStyleSheet.cpp.

   * See CSS2 5.12.2, which says that the properties that apply to
   * :first-letter are: font properties, color properties, background
   * properties, 'text-decoration', 'vertical-align' (only if 'float' is
   * 'none'), 'text-transform', 'line-height', margin properties,
   * padding properties, border properties, 'float', 'text-shadow', and
   * 'clear'.


  if (aData->mSID == eStyleStruct_Text) {
    nsCSSValue inherit(eCSSUnit_Inherit);
    aData->mTextData->mWordSpacing = inherit;
    aData->mTextData->mLetterSpacing = inherit;

  // NOTE:  'vertical-align' is only supposed to be relevant if 'float'
  // is 'none', but we don't do anything with it if 'float' is not none,
  // so we don't need to disable it.

  return NS_OK;

Here is the call graph for this function:

Member Data Documentation

Definition at line 80 of file nsHTMLCSSStyleSheet.cpp.

Definition at line 81 of file nsHTMLCSSStyleSheet.cpp.

Definition at line 82 of file nsHTMLCSSStyleSheet.cpp.

The documentation for this class was generated from the following file: