本文整理汇总了C++中nsAttrValue::ParseColor方法的典型用法代码示例。如果您正苦于以下问题:C++ nsAttrValue::ParseColor方法的具体用法?C++ nsAttrValue::ParseColor怎么用?C++ nsAttrValue::ParseColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsAttrValue
的用法示例。
在下文中一共展示了nsAttrValue::ParseColor方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseDivAlignValue
PRBool
nsHTMLDivElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (mNodeInfo->Equals(nsGkAtoms::marquee)) {
if ((aAttribute == nsGkAtoms::width) ||
(aAttribute == nsGkAtoms::height)) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
}
if (aAttribute == nsGkAtoms::bgcolor) {
return aResult.ParseColor(aValue, GetOwnerDoc());
}
if ((aAttribute == nsGkAtoms::hspace) ||
(aAttribute == nsGkAtoms::vspace)) {
return aResult.ParseIntWithBounds(aValue, 0);
}
}
if (mNodeInfo->Equals(nsGkAtoms::div) &&
aAttribute == nsGkAtoms::align) {
return ParseDivAlignValue(aValue, aResult);
}
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
示例2: ParseBackgroundAttribute
bool
HTMLBodyElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::bgcolor ||
aAttribute == nsGkAtoms::text ||
aAttribute == nsGkAtoms::link ||
aAttribute == nsGkAtoms::alink ||
aAttribute == nsGkAtoms::vlink) {
return aResult.ParseColor(aValue);
}
if (aAttribute == nsGkAtoms::marginwidth ||
aAttribute == nsGkAtoms::marginheight ||
aAttribute == nsGkAtoms::topmargin ||
aAttribute == nsGkAtoms::bottommargin ||
aAttribute == nsGkAtoms::leftmargin ||
aAttribute == nsGkAtoms::rightmargin) {
return aResult.ParseIntWithBounds(aValue, 0);
}
}
return nsGenericHTMLElement::ParseBackgroundAttribute(aNamespaceID,
aAttribute, aValue,
aResult) ||
nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
示例3: ParseTableCellHAlignValue
PRBool
nsHTMLTableSectionElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
/* ignore these attributes, stored simply as strings
ch
*/
if (aAttribute == nsGkAtoms::charoff) {
return aResult.ParseIntWithBounds(aValue, 0);
}
if (aAttribute == nsGkAtoms::height) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
}
if (aAttribute == nsGkAtoms::align) {
return ParseTableCellHAlignValue(aValue, aResult);
}
if (aAttribute == nsGkAtoms::bgcolor) {
return aResult.ParseColor(aValue, GetOwnerDoc());
}
if (aAttribute == nsGkAtoms::valign) {
return ParseTableVAlignValue(aValue, aResult);
}
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
示例4: ParseAttribute
bool
nsMathMLElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (Tag() == nsGkAtoms::math && aAttribute == nsGkAtoms::mode) {
WarnDeprecated(nsGkAtoms::mode->GetUTF16String(),
nsGkAtoms::display->GetUTF16String(), OwnerDoc());
}
if (aAttribute == nsGkAtoms::color) {
WarnDeprecated(nsGkAtoms::color->GetUTF16String(),
nsGkAtoms::mathcolor_->GetUTF16String(), OwnerDoc());
}
if (aAttribute == nsGkAtoms::color ||
aAttribute == nsGkAtoms::mathcolor_ ||
aAttribute == nsGkAtoms::background ||
aAttribute == nsGkAtoms::mathbackground_) {
return aResult.ParseColor(aValue);
}
}
return nsMathMLElementBase::ParseAttribute(aNamespaceID, aAttribute,
aValue, aResult);
}
示例5: ParseAttribute
bool nsMathMLElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) {
MOZ_ASSERT(IsMathMLElement());
if (aNamespaceID == kNameSpaceID_None) {
if (mNodeInfo->Equals(nsGkAtoms::math) && aAttribute == nsGkAtoms::mode) {
WarnDeprecated(nsGkAtoms::mode->GetUTF16String(),
nsGkAtoms::display->GetUTF16String(), OwnerDoc());
}
if (aAttribute == nsGkAtoms::color) {
WarnDeprecated(nsGkAtoms::color->GetUTF16String(),
nsGkAtoms::mathcolor_->GetUTF16String(), OwnerDoc());
}
if (aAttribute == nsGkAtoms::color || aAttribute == nsGkAtoms::mathcolor_ ||
aAttribute == nsGkAtoms::background ||
aAttribute == nsGkAtoms::mathbackground_) {
return aResult.ParseColor(aValue);
}
if (mNodeInfo->Equals(nsGkAtoms::mtd_)) {
if (aAttribute == nsGkAtoms::columnspan_) {
aResult.ParseClampedNonNegativeInt(aValue, 1, 1, MAX_COLSPAN);
return true;
}
if (aAttribute == nsGkAtoms::rowspan) {
aResult.ParseClampedNonNegativeInt(aValue, 1, 0, MAX_ROWSPAN);
return true;
}
}
}
return nsMathMLElementBase::ParseAttribute(aNamespaceID, aAttribute, aValue,
aMaybeScriptedPrincipal, aResult);
}
示例6: ParseFrameborderValue
bool
nsHTMLFrameElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::bordercolor) {
return aResult.ParseColor(aValue);
}
if (aAttribute == nsGkAtoms::frameborder) {
return ParseFrameborderValue(aValue, aResult);
}
if (aAttribute == nsGkAtoms::marginwidth) {
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::marginheight) {
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::scrolling) {
return ParseScrollingValue(aValue, aResult);
}
}
return nsGenericHTMLFrameElement::ParseAttribute(aNamespaceID, aAttribute,
aValue, aResult);
}
示例7: tmp
PRBool
nsHTMLFontElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::size) {
nsAutoString tmp(aValue);
tmp.CompressWhitespace(PR_TRUE, PR_TRUE);
PRUnichar ch = tmp.IsEmpty() ? 0 : tmp.First();
if ((ch == '+' || ch == '-') &&
aResult.ParseEnumValue(aValue, kRelFontSizeTable)) {
return PR_TRUE;
}
return aResult.ParseIntValue(aValue);
}
if (aAttribute == nsGkAtoms::pointSize ||
aAttribute == nsGkAtoms::fontWeight) {
return aResult.ParseIntValue(aValue);
}
if (aAttribute == nsGkAtoms::color) {
return aResult.ParseColor(aValue, GetOwnerDoc());
}
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
示例8: ParseAttribute
PRBool
nsMathMLElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::color ||
aAttribute == nsGkAtoms::mathcolor_ ||
aAttribute == nsGkAtoms::background ||
aAttribute == nsGkAtoms::mathbackground_) {
return aResult.ParseColor(aValue, GetOwnerDoc());
}
}
return nsMathMLElementBase::ParseAttribute(aNamespaceID, aAttribute,
aValue, aResult);
}
示例9: tmp
PRBool
nsHTMLFontElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::size) {
nsAutoString tmp(aValue);
tmp.CompressWhitespace(PR_TRUE, PR_TRUE);
PRUnichar ch = tmp.IsEmpty() ? 0 : tmp.First();
if ((ch == '+' || ch == '-')) {
if (aResult.ParseEnumValue(aValue, kRelFontSizeTable, PR_FALSE))
return PR_TRUE;
// truncate after digit, then parse it again.
PRUint32 i;
for (i = 1; i < tmp.Length(); i++) {
ch = tmp.CharAt(i);
if (!nsCRT::IsAsciiDigit(ch)) {
tmp.Truncate(i);
break;
}
}
return aResult.ParseEnumValue(tmp, kRelFontSizeTable, PR_FALSE);
}
return aResult.ParseIntValue(aValue);
}
if (aAttribute == nsGkAtoms::pointSize ||
aAttribute == nsGkAtoms::fontWeight) {
return aResult.ParseIntValue(aValue);
}
if (aAttribute == nsGkAtoms::color) {
return aResult.ParseColor(aValue);
}
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
示例10: ParseFrameborderValue
bool
HTMLFrameSetElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::bordercolor) {
return aResult.ParseColor(aValue);
}
if (aAttribute == nsGkAtoms::frameborder) {
return nsGenericHTMLElement::ParseFrameborderValue(aValue, aResult);
}
if (aAttribute == nsGkAtoms::border) {
return aResult.ParseIntWithBounds(aValue, 0, 100);
}
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
示例11: ParseAttribute
bool HTMLMarqueeElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) {
if (aNamespaceID == kNameSpaceID_None) {
if ((aAttribute == nsGkAtoms::width) || (aAttribute == nsGkAtoms::height)) {
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::bgcolor) {
return aResult.ParseColor(aValue);
}
if (aAttribute == nsGkAtoms::behavior) {
return aResult.ParseEnumValue(aValue, kBehaviorTable, false,
kDefaultBehavior);
}
if (aAttribute == nsGkAtoms::direction) {
return aResult.ParseEnumValue(aValue, kDirectionTable, false,
kDefaultDirection);
}
if ((aAttribute == nsGkAtoms::hspace) ||
(aAttribute == nsGkAtoms::vspace)) {
return aResult.ParseIntWithBounds(aValue, 0);
}
if (aAttribute == nsGkAtoms::loop) {
return aResult.ParseIntValue(aValue);
}
if (aAttribute == nsGkAtoms::scrollamount ||
aAttribute == nsGkAtoms::scrolldelay) {
return aResult.ParseNonNegativeIntValue(aValue);
}
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aMaybeScriptedPrincipal, aResult);
}
示例12: ParseAttribute
bool
nsHTMLFontElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::size) {
int32_t size = nsContentUtils::ParseLegacyFontSize(aValue);
if (size) {
aResult.SetTo(size, &aValue);
return true;
}
return false;
}
if (aAttribute == nsGkAtoms::color) {
return aResult.ParseColor(aValue);
}
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
示例13: ParseAttribute
PRBool
nsHTMLHRElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::width) {
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::size) {
return aResult.ParseIntWithBounds(aValue, 1, 1000);
}
if (aAttribute == nsGkAtoms::align) {
return aResult.ParseEnumValue(aValue, kAlignTable, PR_FALSE);
}
if (aAttribute == nsGkAtoms::color) {
return aResult.ParseColor(aValue);
}
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
示例14: ParseTableCellHAlignValue
bool
HTMLTableCellElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
/* ignore these attributes, stored simply as strings
abbr, axis, ch, headers
*/
if (aAttribute == nsGkAtoms::charoff) {
/* attributes that resolve to integers with a min of 0 */
return aResult.ParseIntWithBounds(aValue, 0);
}
if (aAttribute == nsGkAtoms::colspan) {
bool res = aResult.ParseIntWithBounds(aValue, -1);
if (res) {
int32_t val = aResult.GetIntegerValue();
// reset large colspan values as IE and opera do
// quirks mode does not honor the special html 4 value of 0
if (val > MAX_COLSPAN || val < 0 ||
(0 == val && InNavQuirksMode(OwnerDoc()))) {
aResult.SetTo(1);
}
}
return res;
}
if (aAttribute == nsGkAtoms::rowspan) {
bool res = aResult.ParseIntWithBounds(aValue, -1, MAX_ROWSPAN);
if (res) {
int32_t val = aResult.GetIntegerValue();
// quirks mode does not honor the special html 4 value of 0
if (val < 0 || (0 == val && InNavQuirksMode(OwnerDoc()))) {
aResult.SetTo(1);
}
}
return res;
}
if (aAttribute == nsGkAtoms::height) {
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::width) {
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::align) {
return ParseTableCellHAlignValue(aValue, aResult);
}
if (aAttribute == nsGkAtoms::bgcolor) {
return aResult.ParseColor(aValue);
}
if (aAttribute == nsGkAtoms::scope) {
return aResult.ParseEnumValue(aValue, kCellScopeTable, false);
}
if (aAttribute == nsGkAtoms::valign) {
return ParseTableVAlignValue(aValue, aResult);
}
}
return nsGenericHTMLElement::ParseBackgroundAttribute(aNamespaceID,
aAttribute, aValue,
aResult) ||
nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}