зеркало из https://github.com/mozilla/pjs.git
Fixing nsbeta3+ bug 52572. Renaming CSSValue::valueType to CSSValue::cssValueType to be up-to-date with the latest changes to the DOM Level 2 spec. r/a=vidur, r=pollmann
This commit is contained in:
Родитель
9268317f8e
Коммит
9a938e886f
|
@ -174,7 +174,7 @@ nsROCSSPrimitiveValue::SetCssText(const nsAReadableString& aCssText)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsROCSSPrimitiveValue::GetValueType(PRUint16* aValueType)
|
||||
nsROCSSPrimitiveValue::GetCssValueType(PRUint16* aValueType)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aValueType);
|
||||
*aValueType = nsIDOMCSSValue::CSS_PRIMITIVE_VALUE;
|
||||
|
|
|
@ -46,21 +46,21 @@ public:
|
|||
NS_IMETHOD GetCssText(nsAWritableString& aCssText)=0;
|
||||
NS_IMETHOD SetCssText(const nsAReadableString& aCssText)=0;
|
||||
|
||||
NS_IMETHOD GetValueType(PRUint16* aValueType)=0;
|
||||
NS_IMETHOD GetCssValueType(PRUint16* aCssValueType)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMCSSVALUE \
|
||||
NS_IMETHOD GetCssText(nsAWritableString& aCssText); \
|
||||
NS_IMETHOD SetCssText(const nsAReadableString& aCssText); \
|
||||
NS_IMETHOD GetValueType(PRUint16* aValueType); \
|
||||
NS_IMETHOD GetCssValueType(PRUint16* aCssValueType); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMCSSVALUE(_to) \
|
||||
NS_IMETHOD GetCssText(nsAWritableString& aCssText) { return _to GetCssText(aCssText); } \
|
||||
NS_IMETHOD SetCssText(const nsAReadableString& aCssText) { return _to SetCssText(aCssText); } \
|
||||
NS_IMETHOD GetValueType(PRUint16* aValueType) { return _to GetValueType(aValueType); } \
|
||||
NS_IMETHOD GetCssValueType(PRUint16* aCssValueType) { return _to GetCssValueType(aCssValueType); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitCSSValueClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
interface CSSValue {
|
||||
/* IID: { 0x009f7ea5, 0x9e80, 0x41be, \
|
||||
{ 0xb0, 0x08, 0xdb, 0x62, 0xf1, 0x08, 0x23, 0xf2 } } */
|
||||
|
||||
const unsigned short CSS_INHERIT = 0;
|
||||
const unsigned short CSS_PRIMITIVE_VALUE = 1;
|
||||
const unsigned short CSS_VALUE_LIST = 2;
|
||||
const unsigned short CSS_CUSTOM = 3;
|
||||
|
||||
attribute DOMString cssText;
|
||||
// raises(DOMException) on setting
|
||||
|
||||
readonly attribute unsigned short valueType;
|
||||
};
|
||||
|
|
@ -230,7 +230,7 @@ enum nsDOMProp {
|
|||
NS_DOM_PROP_CSSSTYLESHEET_INSERTRULE,
|
||||
NS_DOM_PROP_CSSSTYLESHEET_OWNERRULE,
|
||||
NS_DOM_PROP_CSSVALUE_CSSTEXT,
|
||||
NS_DOM_PROP_CSSVALUE_VALUETYPE,
|
||||
NS_DOM_PROP_CSSVALUE_CSSVALUETYPE,
|
||||
NS_DOM_PROP_DOCUMENT_CREATEATTRIBUTE,
|
||||
NS_DOM_PROP_DOCUMENT_CREATEATTRIBUTENS,
|
||||
NS_DOM_PROP_DOCUMENT_CREATECDATASECTION,
|
||||
|
|
|
@ -71,7 +71,6 @@
|
|||
"css2properties.backgroundimage", \
|
||||
"css2properties.backgroundposition", \
|
||||
"css2properties.backgroundrepeat", \
|
||||
"css2properties.behavior", \
|
||||
"css2properties.border", \
|
||||
"css2properties.borderbottom", \
|
||||
"css2properties.borderbottomcolor", \
|
||||
|
@ -138,7 +137,8 @@
|
|||
"css2properties.maxwidth", \
|
||||
"css2properties.minheight", \
|
||||
"css2properties.minwidth", \
|
||||
"css2properties.opacity", \
|
||||
"css2properties.mozbinding", \
|
||||
"css2properties.mozopacity", \
|
||||
"css2properties.orphans", \
|
||||
"css2properties.outline", \
|
||||
"css2properties.outlinecolor", \
|
||||
|
@ -228,7 +228,7 @@
|
|||
"cssstylesheet.insertrule", \
|
||||
"cssstylesheet.ownerrule", \
|
||||
"cssvalue.csstext", \
|
||||
"cssvalue.valuetype", \
|
||||
"cssvalue.cssvaluetype", \
|
||||
"document.createattribute", \
|
||||
"document.createattributens", \
|
||||
"document.createcdatasection", \
|
||||
|
|
|
@ -47,7 +47,7 @@ static NS_DEFINE_IID(kICSSValueIID, NS_IDOMCSSVALUE_IID);
|
|||
//
|
||||
enum CSSValue_slots {
|
||||
CSSVALUE_CSSTEXT = -1,
|
||||
CSSVALUE_VALUETYPE = -2
|
||||
CSSVALUE_CSSVALUETYPE = -2
|
||||
};
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -82,12 +82,12 @@ GetCSSValueProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case CSSVALUE_VALUETYPE:
|
||||
case CSSVALUE_CSSVALUETYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSVALUE_VALUETYPE, PR_FALSE);
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSVALUE_CSSVALUETYPE, PR_FALSE);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint16 prop;
|
||||
rv = a->GetValueType(&prop);
|
||||
rv = a->GetCssValueType(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ JSClass CSSValueClass = {
|
|||
static JSPropertySpec CSSValueProperties[] =
|
||||
{
|
||||
{"cssText", CSSVALUE_CSSTEXT, JSPROP_ENUMERATE},
|
||||
{"valueType", CSSVALUE_VALUETYPE, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"cssValueType", CSSVALUE_CSSVALUETYPE, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,293 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsROCSSPrimitiveValue.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "prprf.h"
|
||||
|
||||
|
||||
nsROCSSPrimitiveValue::nsROCSSPrimitiveValue(nsISupports *aOwner, float aT2P)
|
||||
: mType(CSS_PX), mTwips(0), mString(), mOwner(aOwner), mT2P(aT2P),
|
||||
mScriptObject(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
|
||||
nsROCSSPrimitiveValue::~nsROCSSPrimitiveValue()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_ADDREF(nsROCSSPrimitiveValue);
|
||||
NS_IMPL_RELEASE(nsROCSSPrimitiveValue);
|
||||
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsROCSSPrimitiveValue)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSPrimitiveValue)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSValue)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectOwner)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMCSSPrimitiveValue)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsROCSSPrimitiveValue::GetScriptObject(nsIScriptContext *aContext,
|
||||
void** aScriptObject)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
if (!mScriptObject) {
|
||||
nsISupports *supports = NS_STATIC_CAST(nsIDOMCSSPrimitiveValue *, this);
|
||||
|
||||
// XXX Should be done through factory
|
||||
res = NS_NewScriptCSSPrimitiveValue(aContext, supports, mOwner,
|
||||
&mScriptObject);
|
||||
}
|
||||
|
||||
*aScriptObject = mScriptObject;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
// nsIDOMCSSValue
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsROCSSPrimitiveValue::SetScriptObject(void* aScriptObject)
|
||||
{
|
||||
mScriptObject = aScriptObject;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsROCSSPrimitiveValue::GetCssText(nsAWritableString& aCssText)
|
||||
{
|
||||
nsAutoString tmpStr;
|
||||
|
||||
aCssText.Truncate();
|
||||
|
||||
switch (mType) {
|
||||
case CSS_PX :
|
||||
{
|
||||
PRInt32 px = NSTwipsToIntPixels(mTwips, mT2P);
|
||||
tmpStr.AppendInt(px);
|
||||
tmpStr.AppendWithConversion("px");
|
||||
|
||||
break;
|
||||
}
|
||||
case CSS_CM :
|
||||
{
|
||||
float val = NS_TWIPS_TO_CENTIMETERS(mTwips);
|
||||
char buf[64];
|
||||
PR_snprintf(buf, 63, "%.2fcm", val);
|
||||
tmpStr.AppendWithConversion("cm");
|
||||
break;
|
||||
}
|
||||
case CSS_MM :
|
||||
{
|
||||
float val = NS_TWIPS_TO_MILLIMETERS(mTwips);
|
||||
char buf[64];
|
||||
PR_snprintf(buf, 63, "%.2fcm", val);
|
||||
tmpStr.AppendWithConversion("mm");
|
||||
break;
|
||||
}
|
||||
case CSS_IN :
|
||||
{
|
||||
float val = NS_TWIPS_TO_INCHES(mTwips);
|
||||
char buf[64];
|
||||
PR_snprintf(buf, 63, "%.2fcm", val);
|
||||
tmpStr.AppendWithConversion("in");
|
||||
break;
|
||||
}
|
||||
case CSS_PT :
|
||||
{
|
||||
float val = NSTwipsToFloatPoints(mTwips);
|
||||
char buf[64];
|
||||
PR_snprintf(buf, 63, "%.2fcm", val);
|
||||
tmpStr.AppendWithConversion("pt");
|
||||
break;
|
||||
}
|
||||
case CSS_STRING :
|
||||
{
|
||||
tmpStr.Append(mString);
|
||||
break;
|
||||
}
|
||||
case CSS_PC :
|
||||
case CSS_UNKNOWN :
|
||||
case CSS_NUMBER :
|
||||
case CSS_PERCENTAGE :
|
||||
case CSS_EMS :
|
||||
case CSS_EXS :
|
||||
case CSS_DEG :
|
||||
case CSS_RAD :
|
||||
case CSS_GRAD :
|
||||
case CSS_MS :
|
||||
case CSS_S :
|
||||
case CSS_HZ :
|
||||
case CSS_KHZ :
|
||||
case CSS_DIMENSION :
|
||||
case CSS_URI :
|
||||
case CSS_IDENT :
|
||||
case CSS_ATTR :
|
||||
case CSS_COUNTER :
|
||||
case CSS_RECT :
|
||||
case CSS_RGBCOLOR :
|
||||
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
|
||||
}
|
||||
|
||||
aCssText.Assign(tmpStr);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsROCSSPrimitiveValue::SetCssText(const nsAReadableString& aCssText)
|
||||
{
|
||||
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsROCSSPrimitiveValue::GetValueType(PRUint16* aValueType)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aValueType);
|
||||
*aValueType = nsIDOMCSSValue::CSS_PRIMITIVE_VALUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// nsIDOMCSSPrimitiveValue
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsROCSSPrimitiveValue::GetPrimitiveType(PRUint16* aPrimitiveType)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPrimitiveType);
|
||||
*aPrimitiveType = mType;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsROCSSPrimitiveValue::SetFloatValue(PRUint16 aUnitType, float aFloatValue)
|
||||
{
|
||||
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsROCSSPrimitiveValue::GetFloatValue(PRUint16 aUnitType, float* aReturn)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aReturn);
|
||||
*aReturn = 0;
|
||||
|
||||
if (mType == CSS_STRING) {
|
||||
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
|
||||
}
|
||||
|
||||
switch(aUnitType) {
|
||||
case CSS_PX :
|
||||
*aReturn = NSTwipsToFloatPixels(mTwips, mT2P);
|
||||
break;
|
||||
case CSS_CM :
|
||||
*aReturn = NS_TWIPS_TO_CENTIMETERS(mTwips);
|
||||
break;
|
||||
case CSS_MM :
|
||||
*aReturn = NS_TWIPS_TO_MILLIMETERS(mTwips);
|
||||
break;
|
||||
case CSS_IN :
|
||||
*aReturn = NS_TWIPS_TO_INCHES(mTwips);
|
||||
break;
|
||||
case CSS_PT :
|
||||
*aReturn = NSTwipsToFloatPoints(mTwips);
|
||||
break;
|
||||
case CSS_PC :
|
||||
case CSS_UNKNOWN :
|
||||
case CSS_NUMBER :
|
||||
case CSS_PERCENTAGE :
|
||||
case CSS_EMS :
|
||||
case CSS_EXS :
|
||||
case CSS_DEG :
|
||||
case CSS_RAD :
|
||||
case CSS_GRAD :
|
||||
case CSS_MS :
|
||||
case CSS_S :
|
||||
case CSS_HZ :
|
||||
case CSS_KHZ :
|
||||
case CSS_DIMENSION :
|
||||
case CSS_STRING :
|
||||
case CSS_URI :
|
||||
case CSS_IDENT :
|
||||
case CSS_ATTR :
|
||||
case CSS_COUNTER :
|
||||
case CSS_RECT :
|
||||
case CSS_RGBCOLOR :
|
||||
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsROCSSPrimitiveValue::SetStringValue(PRUint16 aStringType,
|
||||
const nsAReadableString& aStringValue)
|
||||
{
|
||||
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsROCSSPrimitiveValue::GetStringValue(nsAWritableString& aReturn)
|
||||
{
|
||||
aReturn.Assign(mString);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsROCSSPrimitiveValue::GetCounterValue(nsIDOMCounter** aReturn)
|
||||
{
|
||||
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsROCSSPrimitiveValue::GetRectValue(nsIDOMRect** aReturn)
|
||||
{
|
||||
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsROCSSPrimitiveValue::GetRGBColorValue(nsIDOMRGBColor** aReturn)
|
||||
{
|
||||
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
||||
}
|
||||
|
|
@ -174,7 +174,7 @@ nsROCSSPrimitiveValue::SetCssText(const nsAReadableString& aCssText)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsROCSSPrimitiveValue::GetValueType(PRUint16* aValueType)
|
||||
nsROCSSPrimitiveValue::GetCssValueType(PRUint16* aValueType)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aValueType);
|
||||
*aValueType = nsIDOMCSSValue::CSS_PRIMITIVE_VALUE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче