const nsStyleContext* other = (const nsStyleContext*)aOther;  const nsStyleFont* font = (const nsStyleFont*)GetStyleData(eStyleStruct_Font); const nsStyleFont* otherFont = (const nsStyleFont*)aOther->GetStyleData(eStyleStruct_Font); if (font != otherFont) aHint = font->CalcDifference(*otherFont);  if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK; if (aHint < NS_STYLE_HINT_MAX) { const nsStyleColor* color = (const nsStyleColor*)GetStyleData(eStyleStruct_Color); const nsStyleColor* otherColor = (const nsStyleColor*)aOther->GetStyleData(eStyleStruct_Color); if (color != otherColor) { hint = color->CalcDifference(*otherColor); if (aHint < hint) aHint = hint; } }  if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK; if (aHint < NS_STYLE_HINT_MAX) { const nsStyleBackground* background = (const nsStyleBackground*)GetStyleData(eStyleStruct_Background); const nsStyleBackground* otherBackground = (const nsStyleBackground*)aOther->GetStyleData(eStyleStruct_Background); if (background != otherBackground) { hint = background->CalcDifference(*otherBackground); if (aHint < hint) aHint = hint; } }  if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK; if (aHint < NS_STYLE_HINT_MAX) { const nsStyleMargin* margin = (const nsStyleMargin*)GetStyleData(eStyleStruct_Margin); const nsStyleMargin* otherMargin = (const nsStyleMargin*)aOther->GetStyleData(eStyleStruct_Margin); if (margin != otherMargin) { hint = margin->CalcDifference(*otherMargin); if (aHint < hint) aHint = hint; } }  if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK; if (aHint < NS_STYLE_HINT_MAX) { const nsStylePadding* padding = (const nsStylePadding*)GetStyleData(eStyleStruct_Padding); const nsStylePadding* otherPadding = (const nsStylePadding*)aOther->GetStyleData(eStyleStruct_Padding); if (padding != otherPadding) { hint = padding->CalcDifference(*otherPadding); if (aHint < hint) aHint = hint; } } if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK; if (aHint < NS_STYLE_HINT_MAX) { const nsStyleBorder* border = (const nsStyleBorder*)GetStyleData(eStyleStruct_Border); const nsStyleBorder* otherBorder = (const nsStyleBorder*)aOther->GetStyleData(eStyleStruct_Border); if (border != otherBorder) { hint = border->CalcDifference(*otherBorder); if (aHint < hint) aHint = hint; } } if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK; if (aHint < NS_STYLE_HINT_MAX) {
if (aHint < maxHint) { const nsStyleDisplay* display = (const nsStyleDisplay*)PeekStyleData(eStyleStruct_Display); if (display) { const nsStyleDisplay* otherDisplay = (const nsStyleDisplay*)aOther->GetStyleData(eStyleStruct_Display); if (display != otherDisplay) { hint = display->CalcDifference(*otherDisplay); if (aHint < hint) aHint = hint; } } }  #ifdef INCLUDE_XUL if (aHint < maxHint) { const nsStyleXUL* xul = (const nsStyleXUL*)PeekStyleData(eStyleStruct_XUL); if (xul) { const nsStyleXUL* otherXUL = (const nsStyleXUL*)aOther->GetStyleData(eStyleStruct_XUL); if (xul != otherXUL) { hint = xul->CalcDifference(*otherXUL); if (aHint < hint) aHint = hint; } } } #endif  if (aHint < maxHint) { const nsStyleContent* content = (const nsStyleContent*)PeekStyleData(eStyleStruct_Content); if (content) { const nsStyleContent* otherContent = (const nsStyleContent*)aOther->GetStyleData(eStyleStruct_Content); if (content != otherContent) { hint = content->CalcDifference(*otherContent); if (aHint < hint) aHint = hint; } } }  if (aHint < maxHint) { const nsStyleUserInterface* ui = (const nsStyleUserInterface*)PeekStyleData(eStyleStruct_UserInterface); if (ui) { const nsStyleUserInterface* otherUI = (const nsStyleUserInterface*)aOther->GetStyleData(eStyleStruct_UserInterface); if (ui != otherUI) { hint = ui->CalcDifference(*otherUI); if (aHint < hint) aHint = hint; } } }   maxHint = NS_STYLE_HINT_REFLOW;     if (aHint < maxHint) { const nsStyleContext* other = (const nsStyleContext*)aOther; const nsStyleFont* font = (const nsStyleFont*)PeekStyleData(eStyleStruct_Font); if (font) { const nsStyleFont* otherFont = (const nsStyleFont*)aOther->GetStyleData(eStyleStruct_Font); if (font != otherFont) { hint = font->CalcDifference(*otherFont); if (aHint < hint) aHint = hint; } } }  if (aHint < maxHint) { const nsStyleMargin* margin = (const nsStyleMargin*)PeekStyleData(eStyleStruct_Margin); if (margin) { const nsStyleMargin* otherMargin = (const nsStyleMargin*)aOther->GetStyleData(eStyleStruct_Margin); if (margin != otherMargin) { hint = margin->CalcDifference(*otherMargin); if (aHint < hint) aHint = hint; } } }  if (aHint < maxHint) { const nsStylePadding* padding = (const nsStylePadding*)PeekStyleData(eStyleStruct_Padding); if (padding) { const nsStylePadding* otherPadding = (const nsStylePadding*)aOther->GetStyleData(eStyleStruct_Padding); if (padding != otherPadding) { hint = padding->CalcDifference(*otherPadding); if (aHint < hint) aHint = hint; } } }  if (aHint < maxHint) { const nsStyleBorder* border = (const nsStyleBorder*)PeekStyleData(eStyleStruct_Border); if (border) { const nsStyleBorder* otherBorder = (const nsStyleBorder*)aOther->GetStyleData(eStyleStruct_Border); if (border != otherBorder) { hint = border->CalcDifference(*otherBorder); if (aHint < hint) aHint = hint; } } }  if (aHint < maxHint) { const nsStyleList* list = (const nsStyleList*)PeekStyleData(eStyleStruct_List); if (list) { const nsStyleList* otherList = (const nsStyleList*)aOther->GetStyleData(eStyleStruct_List); if (list != otherList) { hint = list->CalcDifference(*otherList); if (aHint < hint) aHint = hint; } } }  if (aHint < maxHint) { const nsStylePosition* pos = (const nsStylePosition*)PeekStyleData(eStyleStruct_Position); if (pos) { const nsStylePosition* otherPosition = (const nsStylePosition*)aOther->GetStyleData(eStyleStruct_Position); if (pos != otherPosition) { hint = pos->CalcDifference(*otherPosition); if (aHint < hint) aHint = hint; } } }  if (aHint < maxHint) { const nsStyleText* text = (const nsStyleText*)PeekStyleData(eStyleStruct_Text); if (text) { const nsStyleText* otherText = (const nsStyleText*)aOther->GetStyleData(eStyleStruct_Text); if (text != otherText) { hint = text->CalcDifference(*otherText); if (aHint < hint) aHint = hint; } } }  if (aHint < maxHint) { const nsStyleTextReset* text = (const nsStyleTextReset*)PeekStyleData(eStyleStruct_TextReset); if (text) { const nsStyleTextReset* otherText = (const nsStyleTextReset*)aOther->GetStyleData(eStyleStruct_TextReset); if (text != otherText) { hint = text->CalcDifference(*otherText); if (aHint < hint) aHint = hint; } } }  if (aHint < maxHint) { const nsStyleVisibility* vis = (const nsStyleVisibility*)PeekStyleData(eStyleStruct_Visibility); if (vis) { const nsStyleVisibility* otherVis = (const nsStyleVisibility*)aOther->GetStyleData(eStyleStruct_Visibility); if (vis != otherVis) { hint = vis->CalcDifference(*otherVis); if (aHint < hint) aHint = hint; } } }  if (aHint < maxHint) { const nsStyleTable* table = (const nsStyleTable*)PeekStyleData(eStyleStruct_Table); if (table) { const nsStyleTable* otherTable = (const nsStyleTable*)aOther->GetStyleData(eStyleStruct_Table); if (table != otherTable) { hint = table->CalcDifference(*otherTable); if (aHint < hint) aHint = hint; } } }  if (aHint < maxHint) { const nsStyleTableBorder* table = (const nsStyleTableBorder*)PeekStyleData(eStyleStruct_TableBorder); if (table) { const nsStyleTableBorder* otherTable = (const nsStyleTableBorder*)aOther->GetStyleData(eStyleStruct_TableBorder); if (table != otherTable) { hint = table->CalcDifference(*otherTable); if (aHint < hint) aHint = hint; } } }  if (aHint < maxHint) { const nsStyleQuotes* quotes = (const nsStyleQuotes*)PeekStyleData(eStyleStruct_Quotes); if (quotes) { const nsStyleQuotes* otherQuotes = (const nsStyleQuotes*)aOther->GetStyleData(eStyleStruct_Quotes); if (quotes != otherQuotes) { hint = quotes->CalcDifference(*otherQuotes); if (aHint < hint) aHint = hint; } } }    maxHint = NS_STYLE_HINT_VISUAL;    if (aHint < maxHint) { const nsStyleColor* color = (const nsStyleColor*)PeekStyleData(eStyleStruct_Color); if (color) { const nsStyleColor* otherColor = (const nsStyleColor*)aOther->GetStyleData(eStyleStruct_Color); if (color != otherColor) { hint = color->CalcDifference(*otherColor); if (aHint < hint) aHint = hint; } } }  if (aHint < maxHint) { const nsStyleBackground* background = (const nsStyleBackground*)PeekStyleData(eStyleStruct_Background); if (background) { const nsStyleBackground* otherBackground = (const nsStyleBackground*)aOther->GetStyleData(eStyleStruct_Background); if (background != otherBackground) { hint = background->CalcDifference(*otherBackground); if (aHint < hint) aHint = hint; } } }  if (aHint < maxHint) {
nsStyleContext::CalcStyleDifference(nsIStyleContext* aOther, PRInt32& aHint,PRBool aStopAtFirstDifference /*= PR_FALSE*/){  if (aOther) {    PRInt32 hint;    const nsStyleContext* other = (const nsStyleContext*)aOther;    const nsStyleFont* font = (const nsStyleFont*)GetStyleData(eStyleStruct_Font);    const nsStyleFont* otherFont = (const nsStyleFont*)aOther->GetStyleData(eStyleStruct_Font);    if (font != otherFont)      aHint = font->CalcDifference(*otherFont);        if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK;    if (aHint < NS_STYLE_HINT_MAX) {      const nsStyleColor* color = (const nsStyleColor*)GetStyleData(eStyleStruct_Color);      const nsStyleColor* otherColor = (const nsStyleColor*)aOther->GetStyleData(eStyleStruct_Color);      if (color != otherColor) {        hint = color->CalcDifference(*otherColor);        if (aHint < hint)          aHint = hint;      }    }    if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK;    if (aHint < NS_STYLE_HINT_MAX) {      const nsStyleBackground* background = (const nsStyleBackground*)GetStyleData(eStyleStruct_Background);      const nsStyleBackground* otherBackground = (const nsStyleBackground*)aOther->GetStyleData(eStyleStruct_Background);      if (background != otherBackground) {        hint = background->CalcDifference(*otherBackground);        if (aHint < hint)          aHint = hint;      }    }    if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK;    if (aHint < NS_STYLE_HINT_MAX) {      const nsStyleMargin* margin = (const nsStyleMargin*)GetStyleData(eStyleStruct_Margin);      const nsStyleMargin* otherMargin = (const nsStyleMargin*)aOther->GetStyleData(eStyleStruct_Margin);      if (margin != otherMargin) {        hint = margin->CalcDifference(*otherMargin);        if (aHint < hint)          aHint = hint;      }    }    if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK;    if (aHint < NS_STYLE_HINT_MAX) {      const nsStylePadding* padding = (const nsStylePadding*)GetStyleData(eStyleStruct_Padding);      const nsStylePadding* otherPadding = (const nsStylePadding*)aOther->GetStyleData(eStyleStruct_Padding);      if (padding != otherPadding) {        hint = padding->CalcDifference(*otherPadding);        if (aHint < hint)          aHint = hint;      }    }    if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK;    if (aHint < NS_STYLE_HINT_MAX) {      const nsStyleBorder* border = (const nsStyleBorder*)GetStyleData(eStyleStruct_Border);      const nsStyleBorder* otherBorder = (const nsStyleBorder*)aOther->GetStyleData(eStyleStruct_Border);      if (border != otherBorder) {        hint = border->CalcDifference(*otherBorder);        if (aHint < hint)          aHint = hint;      }    }    if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK;    if (aHint < NS_STYLE_HINT_MAX) {      const nsStyleOutline* outline = (const nsStyleOutline*)GetStyleData(eStyleStruct_Outline);      const nsStyleOutline* otherOutline = (const nsStyleOutline*)aOther->GetStyleData(eStyleStruct_Outline);      if (outline != otherOutline) {        hint = outline->CalcDifference(*otherOutline);        if (aHint < hint)          aHint = hint;      }    }    if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK;    if (aHint < NS_STYLE_HINT_MAX) {      const nsStyleList* list = (const nsStyleList*)GetStyleData(eStyleStruct_List);      const nsStyleList* otherList = (const nsStyleList*)aOther->GetStyleData(eStyleStruct_List);      if (list != otherList) {        hint = list->CalcDifference(*otherList);        if (aHint < hint)          aHint = hint;      }    }    if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK;    if (aHint < NS_STYLE_HINT_MAX) {      const nsStylePosition* pos = (const nsStylePosition*)GetStyleData(eStyleStruct_Position);      const nsStylePosition* otherPosition = (const nsStylePosition*)aOther->GetStyleData(eStyleStruct_Position);      if (pos != otherPosition) {        hint = pos->CalcDifference(*otherPosition);        if (aHint < hint)          aHint = hint;      }    }    if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK;    if (aHint < NS_STYLE_HINT_MAX) {      const nsStyleText* text = (const nsStyleText*)GetStyleData(eStyleStruct_Text);      const nsStyleText* otherText = (const nsStyleText*)aOther->GetStyleData(eStyleStruct_Text);      if (text != otherText) {        hint = text->CalcDifference(*otherText);        if (aHint < hint)          aHint = hint;      }    }        if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK;    if (aHint < NS_STYLE_HINT_MAX) {      const nsStyleTextReset* text = (const nsStyleTextReset*)GetStyleData(eStyleStruct_TextReset);      const nsStyleTextReset* otherText = (const nsStyleTextReset*)aOther->GetStyleData(eStyleStruct_TextReset);      if (text != otherText) {        hint = text->CalcDifference(*otherText);        if (aHint < hint)          aHint = hint;      }    }    if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK;    if (aHint < NS_STYLE_HINT_MAX) {      const nsStyleVisibility* vis = (const nsStyleVisibility*)GetStyleData(eStyleStruct_Visibility);      const nsStyleVisibility* otherVis = (const nsStyleVisibility*)aOther->GetStyleData(eStyleStruct_Visibility);      if (vis != otherVis) {        hint = vis->CalcDifference(*otherVis);        if (aHint < hint)          aHint = hint;      }    }    if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK;    if (aHint < NS_STYLE_HINT_MAX) {      const nsStyleDisplay* display = (const nsStyleDisplay*)GetStyleData(eStyleStruct_Display);      const nsStyleDisplay* otherDisplay = (const nsStyleDisplay*)aOther->GetStyleData(eStyleStruct_Display);      if (display != otherDisplay) {        hint = display->CalcDifference(*otherDisplay);        if (aHint < hint)          aHint = hint;      }    }#ifdef INCLUDE_XUL    if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK;    if (aHint < NS_STYLE_HINT_MAX) {      const nsStyleXUL* xul = (const nsStyleXUL*)GetStyleData(eStyleStruct_XUL);      const nsStyleXUL* otherXUL = (const nsStyleXUL*)aOther->GetStyleData(eStyleStruct_XUL);      if (xul != otherXUL) {        hint = xul->CalcDifference(*otherXUL);        if (aHint < hint)          aHint = hint;      }    }#endif    if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK;    if (aHint < NS_STYLE_HINT_MAX) {      const nsStyleTable* table = (const nsStyleTable*)GetStyleData(eStyleStruct_Table);      const nsStyleTable* otherTable = (const nsStyleTable*)aOther->GetStyleData(eStyleStruct_Table);      if (table != otherTable) {        hint = table->CalcDifference(*otherTable);        if (aHint < hint)          aHint = hint;      }    }    if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK;    if (aHint < NS_STYLE_HINT_MAX) {      const nsStyleTableBorder* table = (const nsStyleTableBorder*)GetStyleData(eStyleStruct_TableBorder);      const nsStyleTableBorder* otherTable = (const nsStyleTableBorder*)aOther->GetStyleData(eStyleStruct_TableBorder);      if (table != otherTable) {        hint = table->CalcDifference(*otherTable);        if (aHint < hint)          aHint = hint;      }    }    if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK;    if (aHint < NS_STYLE_HINT_MAX) {      const nsStyleContent* content = (const nsStyleContent*)GetStyleData(eStyleStruct_Content);      const nsStyleContent* otherContent = (const nsStyleContent*)aOther->GetStyleData(eStyleStruct_Content);      if (content != otherContent) {        hint = content->CalcDifference(*otherContent);        if (aHint < hint)          aHint = hint;      }    }    if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK;    if (aHint < NS_STYLE_HINT_MAX) {      const nsStyleQuotes* content = (const nsStyleQuotes*)GetStyleData(eStyleStruct_Quotes);      const nsStyleQuotes* otherContent = (const nsStyleQuotes*)aOther->GetStyleData(eStyleStruct_Quotes);      if (content != otherContent) {        hint = content->CalcDifference(*otherContent);        if (aHint < hint)          aHint = hint;      }    }    if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK;    if (aHint < NS_STYLE_HINT_MAX) {      const nsStyleUserInterface* ui = (const nsStyleUserInterface*)GetStyleData(eStyleStruct_UserInterface);      const nsStyleUserInterface* otherUI = (const nsStyleUserInterface*)aOther->GetStyleData(eStyleStruct_UserInterface);      if (ui != otherUI) {        hint = ui->CalcDifference(*otherUI);        if (aHint < hint)           aHint = hint;      }    }    if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK;    if (aHint < NS_STYLE_HINT_MAX) {      const nsStyleUIReset* ui = (const nsStyleUIReset*)GetStyleData(eStyleStruct_UIReset);      const nsStyleUIReset* otherUI = (const nsStyleUIReset*)aOther->GetStyleData(eStyleStruct_UIReset);      if (ui != otherUI) {        hint = ui->CalcDifference(*otherUI);        if (aHint < hint)           aHint = hint;      }    }    if (aStopAtFirstDifference && aHint > NS_STYLE_HINT_NONE) return NS_OK;  }  return NS_OK;}