display->mClip.x = CalcLength(ourDisplay->mClip->mLeft, aFont->mFont, aPresContext); fullAuto = PR_FALSE; } if (eCSSUnit_Auto == ourDisplay->mClip->mRight.GetUnit()) { display->mClip.width = 0; display->mClipFlags |= NS_STYLE_CLIP_RIGHT_AUTO; } else if (ourDisplay->mClip->mRight.IsLengthUnit()) { display->mClip.width = CalcLength(ourDisplay->mClip->mRight, aFont->mFont, aPresContext) - display->mClip.x;
display->mClip.left = CalcLength(ourDisplay->mClip->mLeft, aFont->mFont, aPresContext);
MapDeclarationDisplayInto(nsICSSDeclaration* aDeclaration,                           nsIMutableStyleContext* aContext, nsIStyleContext* aParentContext,                          nsStyleFont* aFont, nsIPresContext* aPresContext){  nsCSSDisplay*  ourDisplay;  if (NS_OK == aDeclaration->GetData(kCSSDisplaySID, (nsCSSStruct**)&ourDisplay)) {    if (nsnull != ourDisplay) {      // Get our style and our parent's style      nsStyleDisplay* display = (nsStyleDisplay*)        aContext->GetMutableStyleData(eStyleStruct_Display);      const nsStyleDisplay* parentDisplay = display;      if (nsnull != aParentContext) {        parentDisplay = (const nsStyleDisplay*)aParentContext->GetStyleData(eStyleStruct_Display);      }      // display: enum, none, inherit      if (eCSSUnit_Enumerated == ourDisplay->mDisplay.GetUnit()) {        display->mDisplay = ourDisplay->mDisplay.GetIntValue();      }      else if (eCSSUnit_None == ourDisplay->mDisplay.GetUnit()) {        display->mDisplay = NS_STYLE_DISPLAY_NONE;      }      else if (eCSSUnit_Inherit == ourDisplay->mDisplay.GetUnit()) {        display->mDisplay = parentDisplay->mDisplay;      }      // direction: enum, inherit      if (eCSSUnit_Enumerated == ourDisplay->mDirection.GetUnit()) {        display->mDirection = ourDisplay->mDirection.GetIntValue();      }      else if (eCSSUnit_Inherit == ourDisplay->mDirection.GetUnit()) {        display->mDirection = parentDisplay->mDirection;      }      // clear: enum, none, inherit      if (eCSSUnit_Enumerated == ourDisplay->mClear.GetUnit()) {        display->mBreakType = ourDisplay->mClear.GetIntValue();      }      else if (eCSSUnit_None == ourDisplay->mClear.GetUnit()) {        display->mBreakType = NS_STYLE_CLEAR_NONE;      }      else if (eCSSUnit_Inherit == ourDisplay->mClear.GetUnit()) {        display->mBreakType = parentDisplay->mBreakType;      }      // float: enum, none, inherit      if (eCSSUnit_Enumerated == ourDisplay->mFloat.GetUnit()) {        display->mFloats = ourDisplay->mFloat.GetIntValue();      }      else if (eCSSUnit_None == ourDisplay->mFloat.GetUnit()) {        display->mFloats = NS_STYLE_FLOAT_NONE;      }      else if (eCSSUnit_Inherit == ourDisplay->mFloat.GetUnit()) {        display->mFloats = parentDisplay->mFloats;      }      // visibility: enum, inherit      if (eCSSUnit_Enumerated == ourDisplay->mVisibility.GetUnit()) {        display->mVisible = ourDisplay->mVisibility.GetIntValue();      }      else if (eCSSUnit_Inherit == ourDisplay->mVisibility.GetUnit()) {        display->mVisible = parentDisplay->mVisible;      }      // overflow: enum, auto, inherit      if (eCSSUnit_Enumerated == ourDisplay->mOverflow.GetUnit()) {        display->mOverflow = ourDisplay->mOverflow.GetIntValue();      }      else if (eCSSUnit_Auto == ourDisplay->mOverflow.GetUnit()) {        display->mOverflow = NS_STYLE_OVERFLOW_AUTO;      }      else if (eCSSUnit_Inherit == ourDisplay->mOverflow.GetUnit()) {        display->mOverflow = parentDisplay->mOverflow;      }      // clip property: length, auto, inherit      if (nsnull != ourDisplay->mClip) {        if (eCSSUnit_Inherit == ourDisplay->mClip->mTop.GetUnit()) { // if one is inherit, they all are          display->mClipFlags = NS_STYLE_CLIP_INHERIT;        }        else {          PRBool  fullAuto = PR_TRUE;          display->mClipFlags = 0; // clear it          if (eCSSUnit_Auto == ourDisplay->mClip->mTop.GetUnit()) {            display->mClip.y = 0;            display->mClipFlags |= NS_STYLE_CLIP_TOP_AUTO;          }           else if (ourDisplay->mClip->mTop.IsLengthUnit()) {            display->mClip.y = CalcLength(ourDisplay->mClip->mTop, aFont->mFont, aPresContext);            fullAuto = PR_FALSE;          }          if (eCSSUnit_Auto == ourDisplay->mClip->mBottom.GetUnit()) {            display->mClip.height = 0;            display->mClipFlags |= NS_STYLE_CLIP_BOTTOM_AUTO;          }           else if (ourDisplay->mClip->mBottom.IsLengthUnit()) {            display->mClip.height = CalcLength(ourDisplay->mClip->mBottom, aFont->mFont, aPresContext) -                                    display->mClip.y;            fullAuto = PR_FALSE;          }          if (eCSSUnit_Auto == ourDisplay->mClip->mLeft.GetUnit()) {            display->mClip.x = 0;            display->mClipFlags |= NS_STYLE_CLIP_LEFT_AUTO;          }           else if (ourDisplay->mClip->mLeft.IsLengthUnit()) {            display->mClip.x = CalcLength(ourDisplay->mClip->mLeft, aFont->mFont, aPresContext);            fullAuto = PR_FALSE;          }          if (eCSSUnit_Auto == ourDisplay->mClip->mRight.GetUnit()) {            display->mClip.width = 0;            display->mClipFlags |= NS_STYLE_CLIP_RIGHT_AUTO;          }           else if (ourDisplay->mClip->mRight.IsLengthUnit()) {            display->mClip.width = CalcLength(ourDisplay->mClip->mRight, aFont->mFont, aPresContext) -                                   display->mClip.x;            fullAuto = PR_FALSE;          }          display->mClipFlags &= ~NS_STYLE_CLIP_TYPE_MASK;          if (fullAuto) {            display->mClipFlags |= NS_STYLE_CLIP_AUTO;          }          else {            display->mClipFlags |= NS_STYLE_CLIP_RECT;          }        }      }    }  }}