--- a/layout/base/nsFrameManager.cpp
+++ b/layout/base/nsFrameManager.cpp
@@ -1112,17 +1112,17 @@ nsFrameManager::ReResolveStyleContext(ns
else
parentContext = nsnull;
}
else {
// resolve the provider here (before aFrame below).
// assumeDifferenceHint forces the parent's change to be also
// applied to this frame, no matter what
- // nsStyleStruct::CalcStyleDifference says. CalcStyleDifference
+ // nsStyleContext::CalcStyleDifference says. CalcStyleDifference
// can't be trusted because it assumes any changes to the parent
// style context provider will be automatically propagated to
// the frame(s) with child style contexts.
assumeDifferenceHint = ReResolveStyleContext(aPresContext, providerFrame,
content, aChangeList, aMinChange);
// The provider's new context becomes the parent context of
// aFrame's context.
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -80,17 +80,16 @@ class nsIImage;
class nsILinkHandler;
class nsStyleContext;
class nsIAtom;
class nsIEventStateManager;
class nsIURI;
class nsILookAndFeel;
class nsICSSPseudoComparator;
class nsIAtom;
-struct nsStyleStruct;
struct nsStyleBackground;
template <class T> class nsRunnableMethod;
class nsIRunnable;
#ifdef MOZ_REFLOW_PERF
class nsIRenderingContext;
#endif
--- a/layout/base/nsStyleConsts.h
+++ b/layout/base/nsStyleConsts.h
@@ -31,17 +31,17 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/* constants used in the nsStyleStruct data provided by nsStyleContext */
+/* constants used in the style struct data provided by nsStyleContext */
#ifndef nsStyleConsts_h___
#define nsStyleConsts_h___
#include "nsFont.h"
#ifndef MOZ_CAIRO_GFX
#define GFX_HAS_INVERT
--- a/layout/doc/adding-style-props.html
+++ b/layout/doc/adding-style-props.html
@@ -283,17 +283,17 @@ value can be held for the layout objects
First look into <a href="http://lxr.mozilla.org/seamonkey/source/content/shared/public/nsStyleStruct.h">
nsStyleStruct.h</a>
to see the existing style strucs. Find the one that you want to store the
data on. In this example, we want to put it on the nsStyleUserInterface struct,
however there is also a class nsStyleUIReset that holds the non-inherited
values, so we will use that one (remember, our property is not inherited).
Add a <a href="#StyleContextMember">data member</a>
to hold the value:
- <pre>struct nsStyleUIReset: public nsStyleStruct {
+ <pre>struct nsStyleUIReset {
nsStyleUIReset(void);
nsStyleUIReset(const nsStyleUIReset& aOther);
~nsStyleUIReset(void);
NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_UIReset)
void* operator new(size_t sz, nsPresContext* aContext) {
return aContext->AllocateFromShell(sz);
@@ -466,19 +466,17 @@ For example:<br>
OK, finally the style system is supporting the new property. It is time to
actually make use of it now.<br>
<br>
In layout, retrieve the styleStruct that has the new property from the frame's
style context. Access the new property and get its value. It is that simple.
For this example, it looks like this, in nsImageFrame:<br>
<pre> PRBool forceIcon = PR_FALSE;
- const nsStyleUIReset* styleData;
- GetStyleData(eStyleStruct_UIReset, (const nsStyleStruct*&) styleData);
- if (styleData->mForceBrokenImageIcon) {
+ if (GetStyleUIReset()->mForceBrokenImageIcon) {
forceIcon = PR_TRUE;
}
</pre>
Create some testcases with style rules that use the new property, make sure
it is being parsed correctly. Test it in an external stylesheet and in inline
style. Test that it is inherited correctly, or not inherited as appropriate
to your property. Update this document with any further details, or correcting
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -5630,17 +5630,17 @@ nsIFrame::DeleteProperty(nsIAtom* aPropN
void*
nsIFrame::UnsetProperty(nsIAtom* aPropName, nsresult* aStatus) const
{
return PresContext()->PropertyTable()->UnsetProperty(this, aPropName,
aStatus);
}
-/* virtual */ const nsStyleStruct*
+/* virtual */ const void*
nsFrame::GetStyleDataExternal(nsStyleStructID aSID) const
{
NS_ASSERTION(mStyleContext, "unexpected null pointer");
return mStyleContext->GetStyleData(aSID);
}
/* virtual */ PRBool
nsIFrame::IsFocusable(PRInt32 *aTabIndex, PRBool aWithMouse)
--- a/layout/generic/nsFrame.h
+++ b/layout/generic/nsFrame.h
@@ -406,17 +406,17 @@ public:
// if the child does not have a overflow use the child area
void ConsiderChildOverflow(nsRect& aOverflowArea,
nsIFrame* aChildFrame);
//Mouse Capturing code used by the frames to tell the view to capture all the following events
NS_IMETHOD CaptureMouse(nsPresContext* aPresContext, PRBool aGrabMouseEvents);
PRBool IsMouseCaptured(nsPresContext* aPresContext);
- virtual const nsStyleStruct* GetStyleDataExternal(nsStyleStructID aSID) const;
+ virtual const void* GetStyleDataExternal(nsStyleStructID aSID) const;
#ifdef NS_DEBUG
/**
* Tracing method that writes a method enter/exit routine to the
* nspr log using the nsIFrame log module. The tracing is only
* done when the NS_FRAME_TRACE_CALLS bit is set in the log module's
* level field.
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -636,26 +636,17 @@ public:
/**
* Get the style data associated with this frame. This returns a
* const style struct pointer that should never be modified. See
* |nsIStyleContext::GetStyleData| for more information.
*
* The use of the typesafe functions below is preferred to direct use
* of this function.
*/
- virtual const nsStyleStruct* GetStyleDataExternal(nsStyleStructID aSID) const = 0;
-
- const nsStyleStruct* GetStyleData(nsStyleStructID aSID) const {
-#ifdef _IMPL_NS_LAYOUT
- NS_ASSERTION(mStyleContext, "No style context found!");
- return mStyleContext->GetStyleData(aSID);
-#else
- return GetStyleDataExternal(aSID);
-#endif
- }
+ virtual const void* GetStyleDataExternal(nsStyleStructID aSID) const = 0;
/**
* Define typesafe getter functions for each style struct by
* preprocessing the list of style structs. These functions are the
* preferred way to get style data. The macro creates functions like:
* const nsStyleBorder* GetStyleBorder();
* const nsStyleColor* GetStyleColor();
*/
--- a/layout/style/nsHTMLStyleSheet.cpp
+++ b/layout/style/nsHTMLStyleSheet.cpp
@@ -104,17 +104,17 @@ nsHTMLStyleSheet::GenericTableRule::MapR
#ifdef DEBUG
NS_IMETHODIMP
nsHTMLStyleSheet::GenericTableRule::List(FILE* out, PRInt32 aIndent) const
{
return NS_OK;
}
#endif
-static void PostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleData)
+static void PostResolveCallback(void* aStyleStruct, nsRuleData* aRuleData)
{
nsStyleText* text = (nsStyleText*)aStyleStruct;
if (text->mTextAlign == NS_STYLE_TEXT_ALIGN_DEFAULT) {
nsStyleContext* parentContext = aRuleData->mStyleContext->GetParent();
if (parentContext) {
const nsStyleText* parentStyleText = parentContext->GetStyleText();
PRUint8 parentAlign = parentStyleText->mTextAlign;
@@ -130,23 +130,23 @@ nsHTMLStyleSheet::TableTHRule::MapRuleIn
if (aRuleData->mSIDs & NS_STYLE_INHERIT_BIT(Text)) {
aRuleData->mCanStoreInRuleTree = PR_FALSE;
aRuleData->mPostResolveCallback = &PostResolveCallback;
}
return NS_OK;
}
static void
-ProcessTableRulesAttribute(nsStyleStruct* aStyleStruct,
- nsRuleData* aRuleData,
- PRUint8 aSide,
- PRBool aGroup,
- PRUint8 aRulesArg1,
- PRUint8 aRulesArg2,
- PRUint8 aRulesArg3)
+ProcessTableRulesAttribute(void* aStyleStruct,
+ nsRuleData* aRuleData,
+ PRUint8 aSide,
+ PRBool aGroup,
+ PRUint8 aRulesArg1,
+ PRUint8 aRulesArg2,
+ PRUint8 aRulesArg3)
{
if (!aStyleStruct || !aRuleData || !aRuleData->mPresContext) return;
nsStyleContext* tableContext = aRuleData->mStyleContext->GetParent();
if (!tableContext)
return;
if (!aGroup) {
tableContext = tableContext->GetParent();
@@ -197,17 +197,17 @@ ProcessTableRulesAttribute(nsStyleStruct
borderData->SetBorderColor(aSide, borderColor);
}
// set the border width to be 1 pixel
borderData->SetBorderWidth(aSide, nsPresContext::CSSPixelsToAppUnits(1));
}
}
}
-static void TbodyPostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleData)
+static void TbodyPostResolveCallback(void* aStyleStruct, nsRuleData* aRuleData)
{
::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_TOP, PR_TRUE, NS_STYLE_TABLE_RULES_ALL,
NS_STYLE_TABLE_RULES_GROUPS, NS_STYLE_TABLE_RULES_ROWS);
::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_BOTTOM, PR_TRUE, NS_STYLE_TABLE_RULES_ALL,
NS_STYLE_TABLE_RULES_GROUPS, NS_STYLE_TABLE_RULES_ROWS);
}
NS_IMETHODIMP
@@ -216,17 +216,17 @@ nsHTMLStyleSheet::TableTbodyRule::MapRul
if (aRuleData->mSIDs & NS_STYLE_INHERIT_BIT(Border)) {
aRuleData->mCanStoreInRuleTree = PR_FALSE;
aRuleData->mPostResolveCallback = &TbodyPostResolveCallback;
}
return NS_OK;
}
// -----------------------------------------------------------
-static void RowPostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleData)
+static void RowPostResolveCallback(void* aStyleStruct, nsRuleData* aRuleData)
{
::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_TOP, PR_FALSE, NS_STYLE_TABLE_RULES_ALL,
NS_STYLE_TABLE_RULES_ROWS, NS_STYLE_TABLE_RULES_ROWS);
::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_BOTTOM, PR_FALSE, NS_STYLE_TABLE_RULES_ALL,
NS_STYLE_TABLE_RULES_ROWS, NS_STYLE_TABLE_RULES_ROWS);
}
NS_IMETHODIMP
@@ -234,17 +234,17 @@ nsHTMLStyleSheet::TableRowRule::MapRuleI
{
if (aRuleData->mSIDs & NS_STYLE_INHERIT_BIT(Border)) {
aRuleData->mCanStoreInRuleTree = PR_FALSE;
aRuleData->mPostResolveCallback = &RowPostResolveCallback;
}
return NS_OK;
}
-static void ColgroupPostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleData)
+static void ColgroupPostResolveCallback(void* aStyleStruct, nsRuleData* aRuleData)
{
::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_LEFT, PR_TRUE, NS_STYLE_TABLE_RULES_ALL,
NS_STYLE_TABLE_RULES_GROUPS, NS_STYLE_TABLE_RULES_COLS);
::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_RIGHT, PR_TRUE, NS_STYLE_TABLE_RULES_ALL,
NS_STYLE_TABLE_RULES_GROUPS, NS_STYLE_TABLE_RULES_COLS);
}
NS_IMETHODIMP
@@ -252,25 +252,25 @@ nsHTMLStyleSheet::TableColgroupRule::Map
{
if (aRuleData->mSIDs & NS_STYLE_INHERIT_BIT(Border)) {
aRuleData->mCanStoreInRuleTree = PR_FALSE;
aRuleData->mPostResolveCallback = &ColgroupPostResolveCallback;
}
return NS_OK;
}
-static void ColPostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleData)
+static void ColPostResolveCallback(void* aStyleStruct, nsRuleData* aRuleData)
{
::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_LEFT, PR_FALSE, NS_STYLE_TABLE_RULES_ALL,
NS_STYLE_TABLE_RULES_COLS, NS_STYLE_TABLE_RULES_COLS);
::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_RIGHT, PR_FALSE, NS_STYLE_TABLE_RULES_ALL,
NS_STYLE_TABLE_RULES_COLS, NS_STYLE_TABLE_RULES_COLS);
}
-static void UngroupedColPostResolveCallback(nsStyleStruct* aStyleStruct,
+static void UngroupedColPostResolveCallback(void* aStyleStruct,
nsRuleData* aRuleData)
{
// Pass PR_TRUE for aGroup, so that we find the table's style
// context correctly.
::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_LEFT, PR_TRUE, NS_STYLE_TABLE_RULES_ALL,
NS_STYLE_TABLE_RULES_COLS, NS_STYLE_TABLE_RULES_COLS);
::ProcessTableRulesAttribute(aStyleStruct, aRuleData, NS_SIDE_RIGHT, PR_TRUE, NS_STYLE_TABLE_RULES_ALL,
NS_STYLE_TABLE_RULES_COLS, NS_STYLE_TABLE_RULES_COLS);
--- a/layout/style/nsRuleData.h
+++ b/layout/style/nsRuleData.h
@@ -45,17 +45,17 @@
#define nsRuleData_h_
#include "nsCSSStruct.h"
#include "nsStyleStructFwd.h"
class nsPresContext;
class nsStyleContext;
struct nsRuleData;
-typedef void (*nsPostResolveFunc)(nsStyleStruct* aStyleStruct, nsRuleData* aData);
+typedef void (*nsPostResolveFunc)(void* aStyleStruct, nsRuleData* aData);
struct nsRuleData
{
PRUint32 mSIDs;
PRPackedBool mCanStoreInRuleTree;
PRPackedBool mIsImportantRule;
PRUint8 mLevel; // an nsStyleSet::sheetType
nsPresContext* mPresContext;
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -1111,268 +1111,268 @@ nsRuleNode::CheckSpecifiedProperties(con
if (structData->callback) {
result = (*structData->callback)(aRuleDataStruct, result);
}
return result;
}
-const nsStyleStruct*
+const void*
nsRuleNode::GetDisplayData(nsStyleContext* aContext)
{
nsRuleDataDisplay displayData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(Display), mPresContext, aContext);
ruleData.mDisplayData = &displayData;
return WalkRuleTree(eStyleStruct_Display, aContext, &ruleData, &displayData);
}
-const nsStyleStruct*
+const void*
nsRuleNode::GetVisibilityData(nsStyleContext* aContext)
{
nsRuleDataDisplay displayData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(Visibility), mPresContext, aContext);
ruleData.mDisplayData = &displayData;
return WalkRuleTree(eStyleStruct_Visibility, aContext, &ruleData, &displayData);
}
-const nsStyleStruct*
+const void*
nsRuleNode::GetTextData(nsStyleContext* aContext)
{
nsRuleDataText textData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(Text), mPresContext, aContext);
ruleData.mTextData = &textData;
return WalkRuleTree(eStyleStruct_Text, aContext, &ruleData, &textData);
}
-const nsStyleStruct*
+const void*
nsRuleNode::GetTextResetData(nsStyleContext* aContext)
{
nsRuleDataText textData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(TextReset), mPresContext, aContext);
ruleData.mTextData = &textData;
- const nsStyleStruct* res = WalkRuleTree(eStyleStruct_TextReset, aContext, &ruleData, &textData);
+ const void* res = WalkRuleTree(eStyleStruct_TextReset, aContext, &ruleData, &textData);
textData.mTextShadow = nsnull; // We are sharing with some style rule. It really owns the data.
return res;
}
-const nsStyleStruct*
+const void*
nsRuleNode::GetUserInterfaceData(nsStyleContext* aContext)
{
nsRuleDataUserInterface uiData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(UserInterface), mPresContext, aContext);
ruleData.mUserInterfaceData = &uiData;
- const nsStyleStruct* res = WalkRuleTree(eStyleStruct_UserInterface, aContext, &ruleData, &uiData);
+ const void* res = WalkRuleTree(eStyleStruct_UserInterface, aContext, &ruleData, &uiData);
uiData.mCursor = nsnull; // We are sharing with some style rule. It really owns the data.
return res;
}
-const nsStyleStruct*
+const void*
nsRuleNode::GetUIResetData(nsStyleContext* aContext)
{
nsRuleDataUserInterface uiData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(UIReset), mPresContext, aContext);
ruleData.mUserInterfaceData = &uiData;
- const nsStyleStruct* res = WalkRuleTree(eStyleStruct_UIReset, aContext, &ruleData, &uiData);
+ const void* res = WalkRuleTree(eStyleStruct_UIReset, aContext, &ruleData, &uiData);
return res;
}
-const nsStyleStruct*
+const void*
nsRuleNode::GetFontData(nsStyleContext* aContext)
{
nsRuleDataFont fontData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(Font), mPresContext, aContext);
ruleData.mFontData = &fontData;
return WalkRuleTree(eStyleStruct_Font, aContext, &ruleData, &fontData);
}
-const nsStyleStruct*
+const void*
nsRuleNode::GetColorData(nsStyleContext* aContext)
{
nsRuleDataColor colorData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(Color), mPresContext, aContext);
ruleData.mColorData = &colorData;
return WalkRuleTree(eStyleStruct_Color, aContext, &ruleData, &colorData);
}
-const nsStyleStruct*
+const void*
nsRuleNode::GetBackgroundData(nsStyleContext* aContext)
{
nsRuleDataColor colorData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(Background), mPresContext, aContext);
ruleData.mColorData = &colorData;
return WalkRuleTree(eStyleStruct_Background, aContext, &ruleData, &colorData);
}
-const nsStyleStruct*
+const void*
nsRuleNode::GetMarginData(nsStyleContext* aContext)
{
nsRuleDataMargin marginData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(Margin), mPresContext, aContext);
ruleData.mMarginData = &marginData;
return WalkRuleTree(eStyleStruct_Margin, aContext, &ruleData, &marginData);
}
-const nsStyleStruct*
+const void*
nsRuleNode::GetBorderData(nsStyleContext* aContext)
{
nsRuleDataMargin marginData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(Border), mPresContext, aContext);
ruleData.mMarginData = &marginData;
return WalkRuleTree(eStyleStruct_Border, aContext, &ruleData, &marginData);
}
-const nsStyleStruct*
+const void*
nsRuleNode::GetPaddingData(nsStyleContext* aContext)
{
nsRuleDataMargin marginData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(Padding), mPresContext, aContext);
ruleData.mMarginData = &marginData;
return WalkRuleTree(eStyleStruct_Padding, aContext, &ruleData, &marginData);
}
-const nsStyleStruct*
+const void*
nsRuleNode::GetOutlineData(nsStyleContext* aContext)
{
nsRuleDataMargin marginData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(Outline), mPresContext, aContext);
ruleData.mMarginData = &marginData;
return WalkRuleTree(eStyleStruct_Outline, aContext, &ruleData, &marginData);
}
-const nsStyleStruct*
+const void*
nsRuleNode::GetListData(nsStyleContext* aContext)
{
nsRuleDataList listData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(List), mPresContext, aContext);
ruleData.mListData = &listData;
return WalkRuleTree(eStyleStruct_List, aContext, &ruleData, &listData);
}
-const nsStyleStruct*
+const void*
nsRuleNode::GetPositionData(nsStyleContext* aContext)
{
nsRuleDataPosition posData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(Position), mPresContext, aContext);
ruleData.mPositionData = &posData;
return WalkRuleTree(eStyleStruct_Position, aContext, &ruleData, &posData);
}
-const nsStyleStruct*
+const void*
nsRuleNode::GetTableData(nsStyleContext* aContext)
{
nsRuleDataTable tableData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(Table), mPresContext, aContext);
ruleData.mTableData = &tableData;
return WalkRuleTree(eStyleStruct_Table, aContext, &ruleData, &tableData);
}
-const nsStyleStruct*
+const void*
nsRuleNode::GetTableBorderData(nsStyleContext* aContext)
{
nsRuleDataTable tableData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(TableBorder), mPresContext, aContext);
ruleData.mTableData = &tableData;
return WalkRuleTree(eStyleStruct_TableBorder, aContext, &ruleData, &tableData);
}
-const nsStyleStruct*
+const void*
nsRuleNode::GetContentData(nsStyleContext* aContext)
{
nsRuleDataContent contentData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(Content), mPresContext, aContext);
ruleData.mContentData = &contentData;
- const nsStyleStruct* res = WalkRuleTree(eStyleStruct_Content, aContext, &ruleData, &contentData);
+ const void* res = WalkRuleTree(eStyleStruct_Content, aContext, &ruleData, &contentData);
contentData.mCounterIncrement = contentData.mCounterReset = nsnull;
contentData.mContent = nsnull; // We are sharing with some style rule. It really owns the data.
return res;
}
-const nsStyleStruct*
+const void*
nsRuleNode::GetQuotesData(nsStyleContext* aContext)
{
nsRuleDataContent contentData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(Quotes), mPresContext, aContext);
ruleData.mContentData = &contentData;
- const nsStyleStruct* res = WalkRuleTree(eStyleStruct_Quotes, aContext, &ruleData, &contentData);
+ const void* res = WalkRuleTree(eStyleStruct_Quotes, aContext, &ruleData, &contentData);
contentData.mQuotes = nsnull; // We are sharing with some style rule. It really owns the data.
return res;
}
-const nsStyleStruct*
+const void*
nsRuleNode::GetXULData(nsStyleContext* aContext)
{
nsRuleDataXUL xulData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(XUL), mPresContext, aContext);
ruleData.mXULData = &xulData;
return WalkRuleTree(eStyleStruct_XUL, aContext, &ruleData, &xulData);
}
-const nsStyleStruct*
+const void*
nsRuleNode::GetColumnData(nsStyleContext* aContext)
{
nsRuleDataColumn columnData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(Column), mPresContext, aContext);
ruleData.mColumnData = &columnData;
return WalkRuleTree(eStyleStruct_Column, aContext, &ruleData, &columnData);
}
#ifdef MOZ_SVG
-const nsStyleStruct*
+const void*
nsRuleNode::GetSVGData(nsStyleContext* aContext)
{
nsRuleDataSVG svgData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(SVG), mPresContext, aContext);
ruleData.mSVGData = &svgData;
- const nsStyleStruct *res = WalkRuleTree(eStyleStruct_SVG, aContext, &ruleData, &svgData);
+ const void *res = WalkRuleTree(eStyleStruct_SVG, aContext, &ruleData, &svgData);
svgData.mStrokeDasharray = nsnull; // We are sharing with some style rule. It really owns the data.
return res;
}
-const nsStyleStruct*
+const void*
nsRuleNode::GetSVGResetData(nsStyleContext* aContext)
{
nsRuleDataSVG svgData; // Declare a struct with null CSS values.
nsRuleData ruleData(NS_STYLE_INHERIT_BIT(SVGReset), mPresContext, aContext);
ruleData.mSVGData = &svgData;
return WalkRuleTree(eStyleStruct_SVGReset, aContext, &ruleData, &svgData);
}
#endif
-const nsStyleStruct*
+const void*
nsRuleNode::WalkRuleTree(const nsStyleStructID aSID,
nsStyleContext* aContext,
nsRuleData* aRuleData,
nsRuleDataStruct* aSpecificData)
{
// We start at the most specific rule in the tree.
- nsStyleStruct* startStruct = nsnull;
+ void* startStruct = nsnull;
nsRuleNode* ruleNode = this;
nsRuleNode* highestNode = nsnull; // The highest node in the rule tree
// that has the same properties
// specified for struct |aSID| as
// |this| does.
nsRuleNode* rootNode = this; // After the loop below, this will be the
// highest node that we've walked without
@@ -1480,46 +1480,46 @@ nsRuleNode::WalkRuleTree(const nsStyleSt
// In the absence of any computed data in the rule tree and with
// no rules specified that didn't have values of 'inherit', we should check our parent.
nsStyleContext* parentContext = aContext->GetParent();
if (parentContext) {
// We have a parent, and so we should just inherit from the parent.
// Set the inherit bits on our context. These bits tell the style context that
// it never has to go back to the rule tree for data. Instead the style context tree
// should be walked to find the data.
- const nsStyleStruct* parentStruct = parentContext->GetStyleData(aSID);
+ const void* parentStruct = parentContext->GetStyleData(aSID);
aContext->AddStyleBit(bit); // makes const_cast OK.
- aContext->SetStyle(aSID, const_cast<nsStyleStruct*>(parentStruct));
+ aContext->SetStyle(aSID, const_cast<void*>(parentStruct));
return parentStruct;
}
else
// We are the root. In the case of fonts, the default values just
// come from the pres context.
return SetDefaultOnRoot(aSID, aContext);
}
// We need to compute the data from the information that the rules specified.
- const nsStyleStruct* res;
+ const void* res;
#define STYLE_STRUCT_TEST aSID
#define STYLE_STRUCT(name, checkdata_cb, ctor_args) \
res = Compute##name##Data(startStruct, *aSpecificData, aContext, \
highestNode, detail, !aRuleData->mCanStoreInRuleTree);
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
#undef STYLE_STRUCT_TEST
// If we have a post-resolve callback, handle that now.
if (aRuleData->mPostResolveCallback && (NS_LIKELY(res != nsnull)))
- (*aRuleData->mPostResolveCallback)((nsStyleStruct*)res, aRuleData);
+ (*aRuleData->mPostResolveCallback)(const_cast<void*>(res), aRuleData);
// Now return the result.
return res;
}
-const nsStyleStruct*
+const void*
nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContext)
{
switch (aSID) {
case eStyleStruct_Font:
{
nsStyleFont* fontData = new (mPresContext) nsStyleFont(mPresContext);
if (NS_LIKELY(fontData != nsnull)) {
nscoord minimumFontSize =
@@ -2487,17 +2487,17 @@ nsRuleNode::SetGenericFont(nsPresContext
nsRuleNode::SetFont(aPresContext, context, aMinFontSize,
aGenericFontID, fontData, &parentFont, aFont,
PR_FALSE, dummy);
// XXX Not sure if we need to do this here
// If we have a post-resolve callback, handle that now.
if (ruleData.mPostResolveCallback)
- (ruleData.mPostResolveCallback)((nsStyleStruct*)aFont, &ruleData);
+ (ruleData.mPostResolveCallback)(aFont, &ruleData);
parentFont = *aFont;
}
}
static PRBool ExtractGeneric(const nsString& aFamily, PRBool aGeneric,
void *aData)
{
@@ -2505,18 +2505,18 @@ static PRBool ExtractGeneric(const nsStr
if (aGeneric) {
*data = aFamily;
return PR_FALSE; // stop enumeration
}
return PR_TRUE;
}
-const nsStyleStruct*
-nsRuleNode::ComputeFontData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputeFontData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail, PRBool aInherited)
{
COMPUTE_START_INHERITED(Font, (mPresContext), font, parentFont,
Font, fontData)
@@ -2598,18 +2598,18 @@ nsRuleNode::ComputeFontData(nsStyleStruc
inherited = PR_TRUE;
nsRuleNode::SetGenericFont(mPresContext, aContext, generic,
minimumFontSize, font);
}
COMPUTE_END_INHERITED(Font, font)
}
-const nsStyleStruct*
-nsRuleNode::ComputeTextData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputeTextData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail, PRBool aInherited)
{
COMPUTE_START_INHERITED(Text, (), text, parentText, Text, textData)
// letter-spacing: normal, length, inherit
@@ -2705,18 +2705,18 @@ nsRuleNode::ComputeTextData(nsStyleStruc
// word-spacing: normal, length, inherit
SetCoord(textData.mWordSpacing, text->mWordSpacing, parentText->mWordSpacing,
SETCOORD_LH | SETCOORD_NORMAL | SETCOORD_INITIAL_NORMAL,
aContext, mPresContext, inherited);
COMPUTE_END_INHERITED(Text, text)
}
-const nsStyleStruct*
-nsRuleNode::ComputeTextResetData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputeTextResetData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail, PRBool aInherited)
{
COMPUTE_START_RESET(TextReset, (), text, parentText, Text, textData)
// vertical-align: enum, length, percent, inherit
@@ -2764,18 +2764,18 @@ nsRuleNode::ComputeTextResetData(nsStyle
else if (eCSSUnit_Inherit == textData.mUnicodeBidi.GetUnit() ) {
inherited = PR_TRUE;
text->mUnicodeBidi = parentText->mUnicodeBidi;
}
COMPUTE_END_RESET(TextReset, text)
}
-const nsStyleStruct*
-nsRuleNode::ComputeUserInterfaceData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputeUserInterfaceData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail,
PRBool aInherited)
{
COMPUTE_START_INHERITED(UserInterface, (), ui, parentUI,
UserInterface, uiData)
@@ -2883,18 +2883,18 @@ nsRuleNode::ComputeUserInterfaceData(nsS
else if (eCSSUnit_Inherit == uiData.mUserFocus.GetUnit()) {
inherited = PR_TRUE;
ui->mUserFocus = parentUI->mUserFocus;
}
COMPUTE_END_INHERITED(UserInterface, ui)
}
-const nsStyleStruct*
-nsRuleNode::ComputeUIResetData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputeUIResetData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail, PRBool aInherited)
{
COMPUTE_START_RESET(UIReset, (), ui, parentUI, UserInterface, uiData)
// user-select: none, enum, inherit
@@ -2936,18 +2936,18 @@ nsRuleNode::ComputeUIResetData(nsStyleSt
inherited = PR_TRUE;
ui->mForceBrokenImageIcon = parentUI->mForceBrokenImageIcon;
} else if (eCSSUnit_Initial == uiData.mForceBrokenImageIcon.GetUnit()) {
ui->mForceBrokenImageIcon = 0;
}
COMPUTE_END_RESET(UIReset, ui)
}
-const nsStyleStruct*
-nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputeDisplayData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail, PRBool aInherited)
{
COMPUTE_START_RESET(Display, (), display, parentDisplay,
Display, displayData)
nsIAtom* pseudoTag = aContext->GetPseudoType();
@@ -3298,18 +3298,18 @@ nsRuleNode::ComputeDisplayData(nsStyleSt
inherited = PR_TRUE;
}
}
COMPUTE_END_RESET(Display, display)
}
-const nsStyleStruct*
-nsRuleNode::ComputeVisibilityData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputeVisibilityData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail, PRBool aInherited)
{
COMPUTE_START_INHERITED(Visibility, (mPresContext),
visibility, parentVisibility,
Display, displayData)
@@ -3356,18 +3356,18 @@ nsRuleNode::ComputeVisibilityData(nsStyl
displayData.mLang.GetStringValue(lang);
visibility->mLangGroup = gLangService->LookupLanguage(lang);
}
}
COMPUTE_END_INHERITED(Visibility, visibility)
}
-const nsStyleStruct*
-nsRuleNode::ComputeColorData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputeColorData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail, PRBool aInherited)
{
COMPUTE_START_INHERITED(Color, (mPresContext), color, parentColor,
Color, colorData)
@@ -3385,18 +3385,18 @@ nsRuleNode::ComputeColorData(nsStyleStru
else {
SetColor(colorData.mColor, parentColor->mColor, mPresContext, aContext, color->mColor,
inherited);
}
COMPUTE_END_INHERITED(Color, color)
}
-const nsStyleStruct*
-nsRuleNode::ComputeBackgroundData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputeBackgroundData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail, PRBool aInherited)
{
COMPUTE_START_RESET(Background, (mPresContext), bg, parentBG,
Color, colorData)
@@ -3572,18 +3572,18 @@ nsRuleNode::ComputeBackgroundData(nsStyl
}
else if (eCSSUnit_Initial == colorData.mBackPosition.mYValue.GetUnit()) {
bg->mBackgroundFlags &= ~(NS_STYLE_BG_Y_POSITION_LENGTH | NS_STYLE_BG_Y_POSITION_PERCENT);
}
COMPUTE_END_RESET(Background, bg)
}
-const nsStyleStruct*
-nsRuleNode::ComputeMarginData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputeMarginData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail, PRBool aInherited)
{
COMPUTE_START_RESET(Margin, (), margin, parentMargin, Margin, marginData)
// margin: length, percent, auto, inherit
@@ -3608,18 +3608,18 @@ nsRuleNode::ComputeMarginData(nsStyleStr
margin->mMargin.Set(side, coord);
}
}
margin->RecalcData();
COMPUTE_END_RESET(Margin, margin)
}
-const nsStyleStruct*
-nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputeBorderData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail, PRBool aInherited)
{
COMPUTE_START_RESET(Border, (mPresContext), border, parentBorder,
Margin, marginData)
@@ -3813,18 +3813,18 @@ nsRuleNode::ComputeBorderData(nsStyleStr
}
else if (eCSSUnit_Initial == marginData.mFloatEdge.GetUnit()) {
border->mFloatEdge = NS_STYLE_FLOAT_EDGE_CONTENT;
}
COMPUTE_END_RESET(Border, border)
}
-const nsStyleStruct*
-nsRuleNode::ComputePaddingData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputePaddingData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail, PRBool aInherited)
{
COMPUTE_START_RESET(Padding, (), padding, parentPadding, Margin, marginData)
// padding: length, percent, inherit
@@ -3849,18 +3849,18 @@ nsRuleNode::ComputePaddingData(nsStyleSt
padding->mPadding.Set(side, coord);
}
}
padding->RecalcData();
COMPUTE_END_RESET(Padding, padding)
}
-const nsStyleStruct*
-nsRuleNode::ComputeOutlineData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputeOutlineData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail, PRBool aInherited)
{
COMPUTE_START_RESET(Outline, (mPresContext), outline, parentOutline,
Margin, marginData)
@@ -3937,18 +3937,18 @@ nsRuleNode::ComputeOutlineData(nsStyleSt
inherited = PR_TRUE;
outline->SetOutlineStyle(parentOutline->GetOutlineStyle());
}
outline->RecalcData(mPresContext);
COMPUTE_END_RESET(Outline, outline)
}
-const nsStyleStruct*
-nsRuleNode::ComputeListData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputeListData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail, PRBool aInherited)
{
COMPUTE_START_INHERITED(List, (), list, parentList, List, listData)
// list-style-type: enum, none, inherit
@@ -4022,18 +4022,18 @@ nsRuleNode::ComputeListData(nsStyleStruc
else if (listData.mImageRegion.mRight.IsLengthUnit())
list->mImageRegion.width = CalcLength(listData.mImageRegion.mRight, aContext, mPresContext, inherited) -
list->mImageRegion.x;
}
COMPUTE_END_INHERITED(List, list)
}
-const nsStyleStruct*
-nsRuleNode::ComputePositionData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputePositionData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail, PRBool aInherited)
{
COMPUTE_START_RESET(Position, (), pos, parentPos, Position, posData)
// box offsets: length, percent, auto, inherit
@@ -4089,18 +4089,18 @@ nsRuleNode::ComputePositionData(nsStyleS
inherited = PR_TRUE;
pos->mZIndex = parentPos->mZIndex;
}
}
COMPUTE_END_RESET(Position, pos)
}
-const nsStyleStruct*
-nsRuleNode::ComputeTableData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputeTableData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail, PRBool aInherited)
{
COMPUTE_START_RESET(Table, (), table, parentTable, Table, tableData)
// table-layout: auto, enum, inherit
@@ -4130,18 +4130,18 @@ nsRuleNode::ComputeTableData(nsStyleStru
// span: pixels (not a real CSS prop)
if (eCSSUnit_Enumerated == tableData.mSpan.GetUnit() ||
eCSSUnit_Integer == tableData.mSpan.GetUnit())
table->mSpan = tableData.mSpan.GetIntValue();
COMPUTE_END_RESET(Table, table)
}
-const nsStyleStruct*
-nsRuleNode::ComputeTableBorderData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputeTableBorderData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail, PRBool aInherited)
{
COMPUTE_START_INHERITED(TableBorder, (mPresContext), table, parentTable,
Table, tableData)
@@ -4192,18 +4192,18 @@ nsRuleNode::ComputeTableBorderData(nsSty
? NS_STYLE_TABLE_EMPTY_CELLS_SHOW_BACKGROUND
: NS_STYLE_TABLE_EMPTY_CELLS_SHOW;
}
COMPUTE_END_INHERITED(TableBorder, table)
}
-const nsStyleStruct*
-nsRuleNode::ComputeContentData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputeContentData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail, PRBool aInherited)
{
COMPUTE_START_RESET(Content, (), content, parentContent,
Content, contentData)
@@ -4379,34 +4379,34 @@ nsRuleNode::ComputeContentData(nsStyleSt
// marker-offset: length, auto, inherit
SetCoord(contentData.mMarkerOffset, content->mMarkerOffset, parentContent->mMarkerOffset,
SETCOORD_LH | SETCOORD_AUTO | SETCOORD_INITIAL_AUTO, aContext,
mPresContext, inherited);
COMPUTE_END_RESET(Content, content)
}
-const nsStyleStruct*
-nsRuleNode::ComputeQuotesData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputeQuotesData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail, PRBool aInherited)
{
COMPUTE_START_INHERITED(Quotes, (), quotes, parentQuotes,
Content, contentData)
// quotes: [string string]+, none, inherit
PRUint32 count;
nsAutoString buffer;
nsCSSQuotes* ourQuotes = contentData.mQuotes;
if (ourQuotes) {
nsAutoString closeBuffer;
// FIXME Bug 389406: Implement eCSSUnit_Initial (correctly, unlike
- // nsStyleStruct), and remove the "initial" value from ua.css.
+ // style structs), and remove the "initial" value from ua.css.
if (eCSSUnit_Inherit == ourQuotes->mOpen.GetUnit()) {
inherited = PR_TRUE;
count = parentQuotes->QuotesCount();
if (NS_SUCCEEDED(quotes->AllocateQuotes(count))) {
while (0 < count--) {
parentQuotes->GetQuotesAt(count, buffer, closeBuffer);
quotes->SetQuotesAt(count, buffer, closeBuffer);
}
@@ -4434,18 +4434,18 @@ nsRuleNode::ComputeQuotesData(nsStyleStr
}
}
}
}
COMPUTE_END_INHERITED(Quotes, quotes)
}
-const nsStyleStruct*
-nsRuleNode::ComputeXULData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputeXULData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail, PRBool aInherited)
{
COMPUTE_START_RESET(XUL, (), xul, parentXUL, XUL, xulData)
// box-align: enum, inherit
@@ -4516,18 +4516,18 @@ nsRuleNode::ComputeXULData(nsStyleStruct
xul->mBoxOrdinal = parentXUL->mBoxOrdinal;
} else if (eCSSUnit_Initial == xulData.mBoxOrdinal.GetUnit()) {
xul->mBoxOrdinal = 1;
}
COMPUTE_END_RESET(XUL, xul)
}
-const nsStyleStruct*
-nsRuleNode::ComputeColumnData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputeColumnData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail, PRBool aInherited)
{
COMPUTE_START_RESET(Column, (), column, parent, Column, columnData)
// column-width: length, auto, inherit
@@ -4604,18 +4604,18 @@ SetSVGOpacity(const nsCSSValue& aValue,
opacity = PR_MAX(opacity, 0.0f);
opacity = PR_MIN(opacity, 1.0f);
}
else if (aValue.GetUnit() == eCSSUnit_Initial) {
opacity = 1.0f;
}
}
-const nsStyleStruct*
-nsRuleNode::ComputeSVGData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputeSVGData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail, PRBool aInherited)
{
COMPUTE_START_INHERITED(SVG, (), svg, parentSVG, SVG, SVGData)
// clip-rule: enum, inherit
@@ -4874,18 +4874,18 @@ nsRuleNode::ComputeSVGData(nsStyleStruct
else if (eCSSUnit_Inherit == SVGData.mTextRendering.GetUnit()) {
inherited = PR_TRUE;
svg->mTextRendering = parentSVG->mTextRendering;
}
COMPUTE_END_INHERITED(SVG, svg)
}
-const nsStyleStruct*
-nsRuleNode::ComputeSVGResetData(nsStyleStruct* aStartStruct,
+const void*
+nsRuleNode::ComputeSVGResetData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail aRuleDetail, PRBool aInherited)
{
COMPUTE_START_RESET(SVGReset, (), svgReset, parentSVGReset, SVG, SVGData)
// stop-color:
@@ -4965,17 +4965,17 @@ nsRuleNode::ComputeSVGResetData(nsStyleS
inherited = PR_TRUE;
svgReset->mMask = parentSVGReset->mMask;
}
COMPUTE_END_RESET(SVGReset, svgReset)
}
#endif
-inline const nsStyleStruct*
+inline const void*
nsRuleNode::GetParentData(const nsStyleStructID aSID)
{
NS_PRECONDITION(mDependentBits & nsCachedStyleData::GetBitForSID(aSID),
"should be called when node depends on parent data");
NS_ASSERTION(mStyleData.GetStyleData(aSID) == nsnull,
"both struct and dependent bits present");
// Walk up the rule tree from this rule node (towards less specific
// rules).
@@ -5009,22 +5009,22 @@ nsRuleNode::GetParent##name_()
ruleNode = ruleNode->mParent; \
} \
\
return ruleNode->mStyleData.GetStyle##name_(); \
}
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
-const nsStyleStruct*
+const void*
nsRuleNode::GetStyleData(nsStyleStructID aSID,
nsStyleContext* aContext,
PRBool aComputeData)
{
- const nsStyleStruct *data;
+ const void *data;
if (mDependentBits & nsCachedStyleData::GetBitForSID(aSID)) {
// We depend on an ancestor for this struct since the cached struct
// it has is also appropriate for this rule node. Just go up the
// rule tree and return the first cached struct we find.
data = GetParentData(aSID);
NS_ASSERTION(data, "dependent bits set but no cached struct present");
return data;
}
--- a/layout/style/nsRuleNode.h
+++ b/layout/style/nsRuleNode.h
@@ -188,17 +188,17 @@ struct nsCachedStyleData
static PRBool IsReset(const nsStyleStructID& aSID) {
return gInfo[aSID].mIsReset;
}
static PRUint32 GetBitForSID(const nsStyleStructID& aSID) {
return 1 << aSID;
}
- NS_HIDDEN_(nsStyleStruct*) NS_FASTCALL GetStyleData(const nsStyleStructID& aSID) {
+ NS_HIDDEN_(void*) NS_FASTCALL GetStyleData(const nsStyleStructID& aSID) {
// Each struct is stored at this.m##type##Data->m##name##Data where
// |type| is either Inherit or Reset, and |name| is the name of the
// style struct. The |gInfo| stores the offset of the appropriate
// m##type##Data for the struct within nsCachedStyleData (|this|)
// and the offset of the appropriate m##name##Data within the
// m##type##Data. Note that if we don't have any reset structs,
// then mResetData is null, and likewise for mInheritedData. This
// saves us from having to go through the long if-else cascade into
@@ -209,22 +209,22 @@ struct nsCachedStyleData
const StyleStructInfo& info = gInfo[aSID];
// Get either &mInheritedData or &mResetData.
char* resetOrInheritSlot = reinterpret_cast<char*>(this) + info.mCachedStyleDataOffset;
// Get either mInheritedData or mResetData.
char* resetOrInherit = reinterpret_cast<char*>(*reinterpret_cast<void**>(resetOrInheritSlot));
- nsStyleStruct* data = nsnull;
+ void* data = nsnull;
if (resetOrInherit) {
// If we have the mInheritedData or mResetData, then we might have
// the struct, so get it.
char* dataSlot = resetOrInherit + info.mInheritResetOffset;
- data = *reinterpret_cast<nsStyleStruct**>(dataSlot);
+ data = *reinterpret_cast<void**>(dataSlot);
}
return data;
}
// Typesafe and faster versions of the above
#define STYLE_STRUCT_INHERITED(name_, checkdata_cb_, ctor_args_) \
NS_HIDDEN_(nsStyle##name_ *) NS_FASTCALL GetStyle##name_ () { \
return mInheritedData ? mInheritedData->m##name_##Data : nsnull; \
@@ -446,159 +446,159 @@ public:
NS_HIDDEN_(void) Destroy();
static NS_HIDDEN_(nsILanguageAtomService*) gLangService;
protected:
NS_HIDDEN_(void) PropagateDependentBit(PRUint32 aBit,
nsRuleNode* aHighestNode);
NS_HIDDEN_(void) PropagateNoneBit(PRUint32 aBit, nsRuleNode* aHighestNode);
- NS_HIDDEN_(const nsStyleStruct*) SetDefaultOnRoot(const nsStyleStructID aSID,
- nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) SetDefaultOnRoot(const nsStyleStructID aSID,
+ nsStyleContext* aContext);
- NS_HIDDEN_(const nsStyleStruct*)
+ NS_HIDDEN_(const void*)
WalkRuleTree(const nsStyleStructID aSID, nsStyleContext* aContext,
nsRuleData* aRuleData, nsRuleDataStruct* aSpecificData);
- NS_HIDDEN_(const nsStyleStruct*)
- ComputeDisplayData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputeDisplayData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
- NS_HIDDEN_(const nsStyleStruct*)
- ComputeVisibilityData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputeVisibilityData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
- NS_HIDDEN_(const nsStyleStruct*)
- ComputeFontData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputeFontData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
- NS_HIDDEN_(const nsStyleStruct*)
- ComputeColorData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputeColorData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
- NS_HIDDEN_(const nsStyleStruct*)
- ComputeBackgroundData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputeBackgroundData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
- NS_HIDDEN_(const nsStyleStruct*)
- ComputeMarginData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputeMarginData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
- NS_HIDDEN_(const nsStyleStruct*)
- ComputeBorderData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputeBorderData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
- NS_HIDDEN_(const nsStyleStruct*)
- ComputePaddingData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputePaddingData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
- NS_HIDDEN_(const nsStyleStruct*)
- ComputeOutlineData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputeOutlineData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
- NS_HIDDEN_(const nsStyleStruct*)
- ComputeListData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputeListData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
- NS_HIDDEN_(const nsStyleStruct*)
- ComputePositionData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputePositionData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
- NS_HIDDEN_(const nsStyleStruct*)
- ComputeTableData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputeTableData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
- NS_HIDDEN_(const nsStyleStruct*)
- ComputeTableBorderData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputeTableBorderData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
- NS_HIDDEN_(const nsStyleStruct*)
- ComputeContentData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputeContentData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
- NS_HIDDEN_(const nsStyleStruct*)
- ComputeQuotesData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputeQuotesData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
- NS_HIDDEN_(const nsStyleStruct*)
- ComputeTextData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputeTextData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
- NS_HIDDEN_(const nsStyleStruct*)
- ComputeTextResetData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputeTextResetData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
- NS_HIDDEN_(const nsStyleStruct*)
- ComputeUserInterfaceData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputeUserInterfaceData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
- NS_HIDDEN_(const nsStyleStruct*)
- ComputeUIResetData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputeUIResetData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
- NS_HIDDEN_(const nsStyleStruct*)
- ComputeXULData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputeXULData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
- NS_HIDDEN_(const nsStyleStruct*)
- ComputeColumnData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputeColumnData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
#ifdef MOZ_SVG
- NS_HIDDEN_(const nsStyleStruct*)
- ComputeSVGData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputeSVGData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
- NS_HIDDEN_(const nsStyleStruct*)
- ComputeSVGResetData(nsStyleStruct* aStartStruct,
+ NS_HIDDEN_(const void*)
+ ComputeSVGResetData(void* aStartStruct,
const nsRuleDataStruct& aData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
RuleDetail aRuleDetail, PRBool aInherited);
#endif
// helpers for |ComputeFontData| that need access to |mNoneBits|:
static NS_HIDDEN_(void) SetFontSize(nsPresContext* aPresContext,
const nsRuleDataFont& aFontData,
@@ -632,50 +632,48 @@ protected:
const nsCSSValue& aLTRLogicalValue,
const nsCSSValue& aRTLLogicalValue,
PRUint8 aSide,
nsCSSRect& aValueRect,
PRBool& aInherited);
inline RuleDetail CheckSpecifiedProperties(const nsStyleStructID aSID, const nsRuleDataStruct& aRuleDataStruct);
- NS_HIDDEN_(const nsStyleStruct*) GetParentData(const nsStyleStructID aSID);
+ NS_HIDDEN_(const void*) GetParentData(const nsStyleStructID aSID);
#define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_) \
NS_HIDDEN_(const nsStyle##name_*) GetParent##name_();
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
- NS_HIDDEN_(const nsStyleStruct*) GetDisplayData(nsStyleContext* aContext);
- NS_HIDDEN_(const nsStyleStruct*) GetVisibilityData(nsStyleContext* aContext);
- NS_HIDDEN_(const nsStyleStruct*) GetFontData(nsStyleContext* aContext);
- NS_HIDDEN_(const nsStyleStruct*) GetColorData(nsStyleContext* aContext);
- NS_HIDDEN_(const nsStyleStruct*) GetBackgroundData(nsStyleContext* aContext);
- NS_HIDDEN_(const nsStyleStruct*) GetMarginData(nsStyleContext* aContext);
- NS_HIDDEN_(const nsStyleStruct*) GetBorderData(nsStyleContext* aContext);
- NS_HIDDEN_(const nsStyleStruct*) GetPaddingData(nsStyleContext* aContext);
- NS_HIDDEN_(const nsStyleStruct*) GetOutlineData(nsStyleContext* aContext);
- NS_HIDDEN_(const nsStyleStruct*) GetListData(nsStyleContext* aContext);
- NS_HIDDEN_(const nsStyleStruct*) GetPositionData(nsStyleContext* aContext);
- NS_HIDDEN_(const nsStyleStruct*) GetTableData(nsStyleContext* aContext);
- NS_HIDDEN_(const nsStyleStruct*)
- GetTableBorderData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetDisplayData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetVisibilityData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetFontData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetColorData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetBackgroundData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetMarginData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetBorderData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetPaddingData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetOutlineData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetListData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetPositionData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetTableData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetTableBorderData(nsStyleContext* aContext);
- NS_HIDDEN_(const nsStyleStruct*) GetContentData(nsStyleContext* aContext);
- NS_HIDDEN_(const nsStyleStruct*) GetQuotesData(nsStyleContext* aContext);
- NS_HIDDEN_(const nsStyleStruct*) GetTextData(nsStyleContext* aContext);
- NS_HIDDEN_(const nsStyleStruct*) GetTextResetData(nsStyleContext* aContext);
- NS_HIDDEN_(const nsStyleStruct*)
- GetUserInterfaceData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetContentData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetQuotesData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetTextData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetTextResetData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetUserInterfaceData(nsStyleContext* aContext);
- NS_HIDDEN_(const nsStyleStruct*) GetUIResetData(nsStyleContext* aContext);
- NS_HIDDEN_(const nsStyleStruct*) GetXULData(nsStyleContext* aContext);
- NS_HIDDEN_(const nsStyleStruct*) GetColumnData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetUIResetData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetXULData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetColumnData(nsStyleContext* aContext);
#ifdef MOZ_SVG
- NS_HIDDEN_(const nsStyleStruct*) GetSVGData(nsStyleContext* aContext);
- NS_HIDDEN_(const nsStyleStruct*) GetSVGResetData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetSVGData(nsStyleContext* aContext);
+ NS_HIDDEN_(const void*) GetSVGResetData(nsStyleContext* aContext);
#endif
private:
nsRuleNode(nsPresContext* aPresContext, nsRuleNode* aParent,
nsIStyleRule* aRule, PRUint8 aLevel, PRBool aIsImportant)
NS_HIDDEN;
~nsRuleNode() NS_HIDDEN;
@@ -698,19 +696,19 @@ public:
return (mDependentBits & NS_RULE_NODE_IS_IMPORTANT) != 0;
}
// NOTE: Does not |AddRef|.
nsIStyleRule* GetRule() const { return mRule; }
// NOTE: Does not |AddRef|.
nsPresContext* GetPresContext() const { return mPresContext; }
- NS_HIDDEN_(const nsStyleStruct*) GetStyleData(nsStyleStructID aSID,
- nsStyleContext* aContext,
- PRBool aComputeData);
+ NS_HIDDEN_(const void*) GetStyleData(nsStyleStructID aSID,
+ nsStyleContext* aContext,
+ PRBool aComputeData);
#define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_) \
NS_HIDDEN_(const nsStyle##name_*) \
GetStyle##name_(nsStyleContext* aContext, \
PRBool aComputeData);
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
--- a/layout/style/nsStyleContext.cpp
+++ b/layout/style/nsStyleContext.cpp
@@ -209,19 +209,19 @@ PRBool nsStyleContext::Equals(const nsSt
result = PR_FALSE;
}
}
return result;
}
//=========================================================================================================
-const nsStyleStruct* nsStyleContext::GetStyleData(nsStyleStructID aSID)
+const void* nsStyleContext::GetStyleData(nsStyleStructID aSID)
{
- const nsStyleStruct* cachedData = mCachedStyleData.GetStyleData(aSID);
+ const void* cachedData = mCachedStyleData.GetStyleData(aSID);
if (cachedData)
return cachedData; // We have computed data stored on this node in the context tree.
return mRuleNode->GetStyleData(aSID, this, PR_TRUE); // Our rule node will take care of it for us.
}
#define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_) \
const nsStyle##name_ * nsStyleContext::GetStyle##name_ () \
{ \
@@ -230,42 +230,42 @@ const nsStyleStruct* nsStyleContext::Get
return cachedData; /* We have computed data stored on this node */ \
/* in the context tree. */ \
/* Else our rule node will take care of it for us. */ \
return mRuleNode->GetStyle##name_(this, PR_TRUE); \
}
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
-inline const nsStyleStruct* nsStyleContext::PeekStyleData(nsStyleStructID aSID)
+inline const void* nsStyleContext::PeekStyleData(nsStyleStructID aSID)
{
- const nsStyleStruct* cachedData = mCachedStyleData.GetStyleData(aSID);
+ const void* cachedData = mCachedStyleData.GetStyleData(aSID);
if (cachedData)
return cachedData; // We have computed data stored on this node in the context tree.
return mRuleNode->GetStyleData(aSID, this, PR_FALSE); // Our rule node will take care of it for us.
}
// This is an evil evil function, since it forces you to alloc your own separate copy of
// style data! Do not use this function unless you absolutely have to! You should avoid
// this at all costs! -dwh
-nsStyleStruct*
+void*
nsStyleContext::GetUniqueStyleData(const nsStyleStructID& aSID)
{
// If we already own the struct and no kids could depend on it, then
// just return it. (We leak in this case if there are kids -- and this
// function really shouldn't be called for style contexts that could
// have kids depending on the data. ClearStyleData would be OK, but
// this test for no mChild or mEmptyChild doesn't catch that case.)
- const nsStyleStruct *current = GetStyleData(aSID);
+ const void *current = GetStyleData(aSID);
if (!mChild && !mEmptyChild &&
!(mBits & nsCachedStyleData::GetBitForSID(aSID)) &&
mCachedStyleData.GetStyleData(aSID))
- return const_cast<nsStyleStruct*>(current);
+ return const_cast<void*>(current);
- nsStyleStruct* result;
+ void* result;
nsPresContext *presContext = PresContext();
switch (aSID) {
#define UNIQUE_CASE(c_) \
case eStyleStruct_##c_: \
result = new (presContext) nsStyle##c_( \
* static_cast<const nsStyle##c_ *>(current)); \
break;
@@ -278,29 +278,29 @@ nsStyleContext::GetUniqueStyleData(const
#undef UNIQUE_CASE
default:
NS_ERROR("Struct type not supported. Please find another way to do this if you can!\n");
return nsnull;
}
if (!result) {
- NS_WARNING("Ran out of memory while trying to allocate memory for a unique nsStyleStruct! "
+ NS_WARNING("Ran out of memory while trying to allocate memory for a unique style struct! "
"Returning the non-unique data.");
- return const_cast<nsStyleStruct*>(current);
+ return const_cast<void*>(current);
}
SetStyle(aSID, result);
mBits &= ~nsCachedStyleData::GetBitForSID(aSID);
return result;
}
void
-nsStyleContext::SetStyle(nsStyleStructID aSID, nsStyleStruct* aStruct)
+nsStyleContext::SetStyle(nsStyleStructID aSID, void* aStruct)
{
// This method should only be called from nsRuleNode! It is not a public
// method!
NS_ASSERTION(aSID >= 0 && aSID < nsStyleStructID_Length, "out of bounds");
// NOTE: nsCachedStyleData::GetStyleData works roughly the same way.
// See the comments there (in nsRuleNode.h) for more details about
@@ -320,17 +320,17 @@ nsStyleContext::SetStyle(nsStyleStructID
} else {
mCachedStyleData.mInheritedData =
new (presContext) nsInheritedStyleData;
resetOrInherit =
reinterpret_cast<char*>(mCachedStyleData.mInheritedData);
}
}
char* dataSlot = resetOrInherit + info.mInheritResetOffset;
- *reinterpret_cast<nsStyleStruct**>(dataSlot) = aStruct;
+ *reinterpret_cast<void**>(dataSlot) = aStruct;
}
void
nsStyleContext::ApplyStyleFixups(nsPresContext* aPresContext)
{
// See if we have any text decorations.
// First see if our parent has text decorations. If our parent does, then we inherit the bit.
if (mParent && mParent->HasTextDecorations())
--- a/layout/style/nsStyleContext.h
+++ b/layout/style/nsStyleContext.h
@@ -104,17 +104,17 @@ public:
nsIAtom* GetPseudoType() const { return mPseudoTag; }
NS_HIDDEN_(already_AddRefed<nsStyleContext>)
FindChildWithRules(const nsIAtom* aPseudoTag, nsRuleNode* aRules);
NS_HIDDEN_(PRBool) Equals(const nsStyleContext* aOther) const;
PRBool HasTextDecorations() { return !!(mBits & NS_STYLE_HAS_TEXT_DECORATIONS); }
- NS_HIDDEN_(void) SetStyle(nsStyleStructID aSID, nsStyleStruct* aStruct);
+ NS_HIDDEN_(void) SetStyle(nsStyleStructID aSID, void* aStruct);
nsRuleNode* GetRuleNode() { return mRuleNode; }
void AddStyleBit(const PRUint32& aBit) { mBits |= aBit; }
/*
* Mark this style context's rule node (and its ancestors) to prevent
* it from being garbage collected.
*/
@@ -129,39 +129,36 @@ public:
* modified.
*
* This function will NOT return null (even when out of memory) when
* given a valid style struct ID, so the result does not need to be
* null-checked.
*
* The typesafe functions below are preferred to the use of this
* function.
- *
- * See also |nsIFrame::GetStyleData| and the other global
- * |GetStyleData| in nsIFrame.h.
*/
- NS_HIDDEN_(const nsStyleStruct*) NS_FASTCALL GetStyleData(nsStyleStructID aSID);
+ NS_HIDDEN_(const void*) NS_FASTCALL GetStyleData(nsStyleStructID aSID);
/**
* Define typesafe getter functions for each style struct by
* preprocessing the list of style structs. These functions are the
* preferred way to get style data. The macro creates functions like:
* const nsStyleBorder* GetStyleBorder();
* const nsStyleColor* GetStyleColor();
*/
#define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_) \
NS_HIDDEN_(const nsStyle##name_ *) NS_FASTCALL GetStyle##name_();
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
- NS_HIDDEN_(const nsStyleStruct*) PeekStyleData(nsStyleStructID aSID);
+ NS_HIDDEN_(const void*) PeekStyleData(nsStyleStructID aSID);
- NS_HIDDEN_(nsStyleStruct*) GetUniqueStyleData(const nsStyleStructID& aSID);
+ NS_HIDDEN_(void*) GetUniqueStyleData(const nsStyleStructID& aSID);
NS_HIDDEN_(nsChangeHint) CalcStyleDifference(nsStyleContext* aOther);
#ifdef DEBUG
NS_HIDDEN_(void) DumpRegressionData(nsPresContext* aPresContext, FILE* out,
PRInt32 aIndent);
NS_HIDDEN_(void) List(FILE* out, PRInt32 aIndent);
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -77,23 +77,19 @@ class imgIRequest;
#define NS_STYLE_HAS_TEXT_DECORATIONS 0x01000000
// Additional bits for nsRuleNode's mDependentBits:
#define NS_RULE_NODE_GC_MARK 0x02000000
#define NS_RULE_NODE_IS_IMPORTANT 0x08000000
#define NS_RULE_NODE_LEVEL_MASK 0xf0000000
#define NS_RULE_NODE_LEVEL_SHIFT 28
-// The actual structs start here
-struct nsStyleStruct {
-};
-
// The lifetime of these objects is managed by the presshell's arena.
-struct nsStyleFont : public nsStyleStruct {
+struct nsStyleFont {
nsStyleFont(const nsFont& aFont, nsPresContext *aPresContext);
nsStyleFont(const nsStyleFont& aStyleFont);
nsStyleFont(nsPresContext *aPresContext);
~nsStyleFont(void) {}
nsChangeHint CalcDifference(const nsStyleFont& aOther) const;
#ifdef DEBUG
static nsChangeHint MaxDifference();
@@ -118,17 +114,17 @@ struct nsStyleFont : public nsStyleStruc
PRInt8 mScriptLevel; // [inherited]
// The value mSize would have had if scriptminsize had never been applied
nscoord mScriptUnconstrainedSize;
nscoord mScriptMinSize; // [inherited] length
float mScriptSizeMultiplier; // [inherited]
#endif
};
-struct nsStyleColor : public nsStyleStruct {
+struct nsStyleColor {
nsStyleColor(nsPresContext* aPresContext);
nsStyleColor(const nsStyleColor& aOther);
~nsStyleColor(void) {}
nsChangeHint CalcDifference(const nsStyleColor& aOther) const;
#ifdef DEBUG
static nsChangeHint MaxDifference();
#endif
@@ -141,17 +137,17 @@ struct nsStyleColor : public nsStyleStru
aContext->FreeToShell(sizeof(nsStyleColor), this);
}
// Don't add ANY members to this struct! We can achieve caching in the rule
// tree (rather than the style tree) by letting color stay by itself! -dwh
nscolor mColor; // [inherited]
};
-struct nsStyleBackground : public nsStyleStruct {
+struct nsStyleBackground {
nsStyleBackground(nsPresContext* aPresContext);
nsStyleBackground(const nsStyleBackground& aOther);
~nsStyleBackground();
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
}
void Destroy(nsPresContext* aContext) {
@@ -206,17 +202,17 @@ struct nsStyleBackground : public nsStyl
#define BORDER_COLOR_SPECIAL 0xE0
#define BORDER_STYLE_MASK 0x1F
#define NS_SPACING_MARGIN 0
#define NS_SPACING_PADDING 1
#define NS_SPACING_BORDER 2
-struct nsStyleMargin: public nsStyleStruct {
+struct nsStyleMargin {
nsStyleMargin(void);
nsStyleMargin(const nsStyleMargin& aMargin);
~nsStyleMargin(void) {}
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW;
void Destroy(nsPresContext* aContext);
void RecalcData();
@@ -237,17 +233,17 @@ struct nsStyleMargin: public nsStyleStru
}
protected:
PRPackedBool mHasCachedMargin;
nsMargin mCachedMargin;
};
-struct nsStylePadding: public nsStyleStruct {
+struct nsStylePadding {
nsStylePadding(void);
nsStylePadding(const nsStylePadding& aPadding);
~nsStylePadding(void) {}
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW;
void Destroy(nsPresContext* aContext);
void RecalcData();
@@ -317,17 +313,17 @@ struct nsBorderColors {
// Outline offset is rounded to the nearest integer number of pixels, but values
// between zero and one device pixels are always rounded up to one device pixel.
// Note that the offset can be negative.
#define NS_ROUND_OFFSET_TO_PIXELS(l,tpp) \
(((l) == 0) ? 0 : \
((l) > 0) ? PR_MAX( (tpp), ((l) + ((tpp) / 2)) / (tpp) * (tpp)) : \
PR_MIN(-(tpp), ((l) - ((tpp) / 2)) / (tpp) * (tpp)))
-struct nsStyleBorder: public nsStyleStruct {
+struct nsStyleBorder {
nsStyleBorder(nsPresContext* aContext);
nsStyleBorder(const nsStyleBorder& aBorder);
~nsStyleBorder(void) {
if (mBorderColors) {
for (PRInt32 i = 0; i < 4; i++)
delete mBorderColors[i];
delete []mBorderColors;
}
@@ -498,17 +494,17 @@ protected:
PRUint8 mBorderStyle[4]; // [reset] See nsStyleConsts.h
nscolor mBorderColor[4]; // [reset] the colors to use for a simple border. not used
// if -moz-border-colors is specified
nscoord mTwipsPerPixel;
};
-struct nsStyleOutline: public nsStyleStruct {
+struct nsStyleOutline {
nsStyleOutline(nsPresContext* aPresContext);
nsStyleOutline(const nsStyleOutline& aOutline);
~nsStyleOutline(void) {}
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
}
void Destroy(nsPresContext* aContext) {
@@ -599,17 +595,17 @@ protected:
PRPackedBool mHasCachedOutline;
PRUint8 mOutlineStyle; // [reset] See nsStyleConsts.h
nscoord mTwipsPerPixel;
};
-struct nsStyleList : public nsStyleStruct {
+struct nsStyleList {
nsStyleList(void);
nsStyleList(const nsStyleList& aStyleList);
~nsStyleList(void);
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
}
void Destroy(nsPresContext* aContext) {
@@ -623,17 +619,17 @@ struct nsStyleList : public nsStyleStruc
#endif
PRUint8 mListStyleType; // [inherited] See nsStyleConsts.h
PRUint8 mListStylePosition; // [inherited]
nsCOMPtr<imgIRequest> mListStyleImage; // [inherited]
nsRect mImageRegion; // [inherited] the rect to use within an image
};
-struct nsStylePosition : public nsStyleStruct {
+struct nsStylePosition {
nsStylePosition(void);
nsStylePosition(const nsStylePosition& aOther);
~nsStylePosition(void);
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
}
void Destroy(nsPresContext* aContext) {
@@ -652,17 +648,17 @@ struct nsStylePosition : public nsStyleS
nsStyleCoord mMaxWidth; // [reset] coord, percent, null, enum
nsStyleCoord mHeight; // [reset] coord, percent, auto
nsStyleCoord mMinHeight; // [reset] coord, percent
nsStyleCoord mMaxHeight; // [reset] coord, percent, null
PRUint8 mBoxSizing; // [reset] see nsStyleConsts.h
nsStyleCoord mZIndex; // [reset]
};
-struct nsStyleTextReset : public nsStyleStruct {
+struct nsStyleTextReset {
nsStyleTextReset(void);
nsStyleTextReset(const nsStyleTextReset& aOther);
~nsStyleTextReset(void);
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
}
void Destroy(nsPresContext* aContext) {
@@ -676,17 +672,17 @@ struct nsStyleTextReset : public nsStyle
#endif
PRUint8 mTextDecoration; // [reset] see nsStyleConsts.h
PRUint8 mUnicodeBidi; // [reset] see nsStyleConsts.h
nsStyleCoord mVerticalAlign; // [reset] see nsStyleConsts.h for enums
};
-struct nsStyleText : public nsStyleStruct {
+struct nsStyleText {
nsStyleText(void);
nsStyleText(const nsStyleText& aOther);
~nsStyleText(void);
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
}
void Destroy(nsPresContext* aContext) {
@@ -714,17 +710,17 @@ struct nsStyleText : public nsStyleStruc
}
PRBool WhiteSpaceCanWrap() const {
return mWhiteSpace == NS_STYLE_WHITESPACE_NORMAL ||
mWhiteSpace == NS_STYLE_WHITESPACE_MOZ_PRE_WRAP;
}
};
-struct nsStyleVisibility : public nsStyleStruct {
+struct nsStyleVisibility {
nsStyleVisibility(nsPresContext* aPresContext);
nsStyleVisibility(const nsStyleVisibility& aVisibility);
~nsStyleVisibility() {}
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
}
void Destroy(nsPresContext* aContext) {
@@ -746,17 +742,17 @@ struct nsStyleVisibility : public nsStyl
}
PRBool IsVisibleOrCollapsed() const {
return ((mVisible == NS_STYLE_VISIBILITY_VISIBLE) ||
(mVisible == NS_STYLE_VISIBILITY_COLLAPSE));
}
};
-struct nsStyleDisplay : public nsStyleStruct {
+struct nsStyleDisplay {
nsStyleDisplay();
nsStyleDisplay(const nsStyleDisplay& aOther);
~nsStyleDisplay() {}
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
}
void Destroy(nsPresContext* aContext) {
@@ -838,17 +834,17 @@ struct nsStyleDisplay : public nsStyleSt
// support 'overflow: hidden' to mean 'overflow: -moz-hidden-unscrollable'.
PRBool IsTableClip() const {
return mOverflowX == NS_STYLE_OVERFLOW_CLIP ||
(mOverflowX == NS_STYLE_OVERFLOW_HIDDEN &&
mOverflowY == NS_STYLE_OVERFLOW_HIDDEN);
}
};
-struct nsStyleTable: public nsStyleStruct {
+struct nsStyleTable {
nsStyleTable(void);
nsStyleTable(const nsStyleTable& aOther);
~nsStyleTable(void);
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
}
void Destroy(nsPresContext* aContext) {
@@ -863,17 +859,17 @@ struct nsStyleTable: public nsStyleStruc
PRUint8 mLayoutStrategy;// [reset] see nsStyleConsts.h NS_STYLE_TABLE_LAYOUT_*
PRUint8 mFrame; // [reset] see nsStyleConsts.h NS_STYLE_TABLE_FRAME_*
PRUint8 mRules; // [reset] see nsStyleConsts.h NS_STYLE_TABLE_RULES_*
PRInt32 mCols; // [reset] an integer if set, or see nsStyleConsts.h NS_STYLE_TABLE_COLS_*
PRInt32 mSpan; // [reset] the number of columns spanned by a colgroup or col
};
-struct nsStyleTableBorder: public nsStyleStruct {
+struct nsStyleTableBorder {
nsStyleTableBorder(nsPresContext* aContext);
nsStyleTableBorder(const nsStyleTableBorder& aOther);
~nsStyleTableBorder(void);
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
}
void Destroy(nsPresContext* aContext) {
@@ -929,17 +925,17 @@ private:
struct nsStyleCounterData {
nsString mCounter;
PRInt32 mValue;
};
#define DELETE_ARRAY_IF(array) if (array) { delete[] array; array = nsnull; }
-struct nsStyleQuotes : public nsStyleStruct {
+struct nsStyleQuotes {
nsStyleQuotes();
nsStyleQuotes(const nsStyleQuotes& aQuotes);
~nsStyleQuotes();
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
}
void Destroy(nsPresContext* aContext) {
@@ -999,17 +995,17 @@ struct nsStyleQuotes : public nsStyleStr
return NS_ERROR_ILLEGAL_VALUE;
}
protected:
PRUint32 mQuotesCount;
nsString* mQuotes;
};
-struct nsStyleContent: public nsStyleStruct {
+struct nsStyleContent {
nsStyleContent(void);
nsStyleContent(const nsStyleContent& aContent);
~nsStyleContent(void);
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
}
void Destroy(nsPresContext* aContext) {
@@ -1104,17 +1100,17 @@ protected:
PRUint32 mIncrementCount;
nsStyleCounterData* mIncrements;
PRUint32 mResetCount;
nsStyleCounterData* mResets;
};
-struct nsStyleUIReset: public nsStyleStruct {
+struct nsStyleUIReset {
nsStyleUIReset(void);
nsStyleUIReset(const nsStyleUIReset& aOther);
~nsStyleUIReset(void);
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
}
void Destroy(nsPresContext* aContext) {
@@ -1135,17 +1131,17 @@ struct nsStyleUIReset: public nsStyleStr
struct nsCursorImage {
nsCOMPtr<imgIRequest> mImage;
PRBool mHaveHotspot;
float mHotspotX, mHotspotY;
nsCursorImage();
};
-struct nsStyleUserInterface: public nsStyleStruct {
+struct nsStyleUserInterface {
nsStyleUserInterface(void);
nsStyleUserInterface(const nsStyleUserInterface& aOther);
~nsStyleUserInterface(void);
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
}
void Destroy(nsPresContext* aContext) {
@@ -1170,17 +1166,17 @@ struct nsStyleUserInterface: public nsSt
// mCursor. Zero-length array is represented
// by null pointer.
// Does not free mCursorArray; the caller is responsible for calling
// |delete [] mCursorArray| first if it is needed.
void CopyCursorArrayFrom(const nsStyleUserInterface& aSource);
};
-struct nsStyleXUL : public nsStyleStruct {
+struct nsStyleXUL {
nsStyleXUL();
nsStyleXUL(const nsStyleXUL& aSource);
~nsStyleXUL();
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
}
void Destroy(nsPresContext* aContext) {
@@ -1196,17 +1192,17 @@ struct nsStyleXUL : public nsStyleStruct
float mBoxFlex; // [reset] see nsStyleConsts.h
PRUint32 mBoxOrdinal; // [reset] see nsStyleConsts.h
PRUint8 mBoxAlign; // [reset] see nsStyleConsts.h
PRUint8 mBoxDirection; // [reset] see nsStyleConsts.h
PRUint8 mBoxOrient; // [reset] see nsStyleConsts.h
PRUint8 mBoxPack; // [reset] see nsStyleConsts.h
};
-struct nsStyleColumn : public nsStyleStruct {
+struct nsStyleColumn {
nsStyleColumn();
nsStyleColumn(const nsStyleColumn& aSource);
~nsStyleColumn();
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
}
void Destroy(nsPresContext* aContext) {
@@ -1246,17 +1242,17 @@ struct nsStyleSVGPaint
nsStyleSVGPaint& operator=(const nsStyleSVGPaint& aOther);
PRBool operator==(const nsStyleSVGPaint& aOther) const;
PRBool operator!=(const nsStyleSVGPaint& aOther) const {
return !(*this == aOther);
}
};
-struct nsStyleSVG : public nsStyleStruct {
+struct nsStyleSVG {
nsStyleSVG();
nsStyleSVG(const nsStyleSVG& aSource);
~nsStyleSVG();
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
}
void Destroy(nsPresContext* aContext) {
@@ -1291,17 +1287,17 @@ struct nsStyleSVG : public nsStyleStruct
PRUint8 mPointerEvents; // [inherited] see nsStyleConsts.h
PRUint8 mShapeRendering; // [inherited] see nsStyleConsts.h
PRUint8 mStrokeLinecap; // [inherited] see nsStyleConsts.h
PRUint8 mStrokeLinejoin; // [inherited] see nsStyleConsts.h
PRUint8 mTextAnchor; // [inherited] see nsStyleConsts.h
PRUint8 mTextRendering; // [inherited] see nsStyleConsts.h
};
-struct nsStyleSVGReset : public nsStyleStruct {
+struct nsStyleSVGReset {
nsStyleSVGReset();
nsStyleSVGReset(const nsStyleSVGReset& aSource);
~nsStyleSVGReset();
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
}
void Destroy(nsPresContext* aContext) {
--- a/layout/style/nsStyleStructFwd.h
+++ b/layout/style/nsStyleStructFwd.h
@@ -55,14 +55,12 @@ enum nsStyleStructID {
#define STYLE_STRUCT(name, checkdata_cb, ctor_args) eStyleStruct_##name,
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
nsStyleStructID_Length /* one past the end; length of 0-based list */
};
-struct nsStyleStruct;
-
// A bit corresponding to each struct ID
#define NS_STYLE_INHERIT_BIT(sid_) (1 << PRInt32(eStyleStruct_##sid_))
#endif /* nsStyleStructFwd_h_ */
--- a/layout/style/test/test_style_struct_copy_constructors.html
+++ b/layout/style/test/test_style_struct_copy_constructors.html
@@ -1,14 +1,14 @@
<!DOCTYPE HTML>
<html>
<!--
-->
<head>
- <title>Test for nsStyleStruct copy constructors</title>
+ <title>Test for style struct copy constructors</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="property_database.js"></script>
<style type="text/css" id="stylesheet"></style>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"><span id="one"></span><span id="two"></span><span id="parent"><span id="child"></span></span></p>
@@ -16,17 +16,17 @@
<div id="testnode"><span id="element"></span></div>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
-/** Test for nsStyleStruct copy constructors **/
+/** Test for style struct copy constructors **/
/**
* XXX Why doesn't putting a bug in the nsStyleFont copy-constructor for
* font-weight (initializing to normal) trigger a failure of this test?
* It works for leaving -moz-image-region uninitialized (both halves),
* overwriting text-decoration (only the first half, since it's not
* inherited), and leaving visibility uninitialized (only the second
* half; passes the first half ok).