2001-09-25 01:32:19 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
1998-09-02 00:56:01 +00:00
|
|
|
*
|
2001-09-25 01:32:19 +00:00
|
|
|
* 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/
|
1998-09-02 00:56:01 +00:00
|
|
|
*
|
2001-09-25 01:32:19 +00:00
|
|
|
* 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.
|
1998-09-02 00:56:01 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Communicator client code.
|
|
|
|
*
|
2001-09-25 01:32:19 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 03:40:37 +00:00
|
|
|
*
|
2001-09-25 01:32:19 +00:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the NPL, 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 NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-02-12 17:45:58 +00:00
|
|
|
#include "nsCOMPtr.h"
|
1998-09-02 00:56:01 +00:00
|
|
|
#include "nsIDOMHTMLFontElement.h"
|
|
|
|
#include "nsIDOMEventReceiver.h"
|
|
|
|
#include "nsIHTMLContent.h"
|
1998-09-02 23:53:16 +00:00
|
|
|
#include "nsGenericHTMLElement.h"
|
1998-09-02 00:56:01 +00:00
|
|
|
#include "nsHTMLAtoms.h"
|
1998-09-03 22:21:32 +00:00
|
|
|
#include "nsIDeviceContext.h"
|
1998-09-02 00:56:01 +00:00
|
|
|
#include "nsStyleConsts.h"
|
|
|
|
#include "nsIPresContext.h"
|
2002-03-27 00:13:57 +00:00
|
|
|
#include "nsHTMLAttributes.h"
|
2003-04-15 03:07:34 +00:00
|
|
|
#include "nsCSSStruct.h"
|
2001-10-24 00:01:09 +00:00
|
|
|
#include "nsRuleNode.h"
|
1998-09-02 00:56:01 +00:00
|
|
|
|
2000-12-23 10:56:31 +00:00
|
|
|
class nsHTMLFontElement : public nsGenericHTMLContainerElement,
|
|
|
|
public nsIDOMHTMLFontElement
|
1998-09-02 00:56:01 +00:00
|
|
|
{
|
|
|
|
public:
|
2000-12-23 10:56:31 +00:00
|
|
|
nsHTMLFontElement();
|
1999-02-12 17:45:58 +00:00
|
|
|
virtual ~nsHTMLFontElement();
|
1998-09-02 00:56:01 +00:00
|
|
|
|
|
|
|
// nsISupports
|
2000-12-23 10:56:31 +00:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
1998-09-02 00:56:01 +00:00
|
|
|
|
|
|
|
// nsIDOMNode
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
1998-09-02 00:56:01 +00:00
|
|
|
|
|
|
|
// nsIDOMElement
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLContainerElement::)
|
1998-09-02 00:56:01 +00:00
|
|
|
|
|
|
|
// nsIDOMHTMLElement
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
1998-09-02 00:56:01 +00:00
|
|
|
|
|
|
|
// nsIDOMHTMLFontElement
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
NS_DECL_NSIDOMHTMLFONTELEMENT
|
1998-09-02 00:56:01 +00:00
|
|
|
|
2000-12-23 10:56:31 +00:00
|
|
|
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
2002-03-23 23:04:39 +00:00
|
|
|
const nsAString& aValue,
|
2000-12-23 10:56:31 +00:00
|
|
|
nsHTMLValue& aResult);
|
|
|
|
NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
|
|
|
|
const nsHTMLValue& aValue,
|
2002-03-23 23:04:39 +00:00
|
|
|
nsAString& aResult) const;
|
2001-08-25 02:01:08 +00:00
|
|
|
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
2002-08-24 14:41:28 +00:00
|
|
|
nsChangeHint& aHint) const;
|
2001-05-31 22:19:43 +00:00
|
|
|
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
|
1998-09-02 00:56:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nsresult
|
2000-05-10 13:13:39 +00:00
|
|
|
NS_NewHTMLFontElement(nsIHTMLContent** aInstancePtrResult,
|
|
|
|
nsINodeInfo *aNodeInfo)
|
1998-09-02 00:56:01 +00:00
|
|
|
{
|
2000-05-10 13:13:39 +00:00
|
|
|
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
|
|
|
|
|
2000-12-23 10:56:31 +00:00
|
|
|
nsHTMLFontElement* it = new nsHTMLFontElement();
|
|
|
|
|
|
|
|
if (!it) {
|
1998-09-02 00:56:01 +00:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2000-12-23 10:56:31 +00:00
|
|
|
|
|
|
|
nsresult rv = it->Init(aNodeInfo);
|
|
|
|
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
delete it;
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
*aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it);
|
|
|
|
NS_ADDREF(*aInstancePtrResult);
|
|
|
|
|
|
|
|
return NS_OK;
|
1998-09-02 00:56:01 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 00:35:04 +00:00
|
|
|
|
2000-12-23 10:56:31 +00:00
|
|
|
nsHTMLFontElement::nsHTMLFontElement()
|
1998-09-02 00:56:01 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
1998-09-02 23:53:16 +00:00
|
|
|
nsHTMLFontElement::~nsHTMLFontElement()
|
1998-09-02 00:56:01 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2000-12-23 10:56:31 +00:00
|
|
|
NS_IMPL_ADDREF_INHERITED(nsHTMLFontElement, nsGenericElement);
|
|
|
|
NS_IMPL_RELEASE_INHERITED(nsHTMLFontElement, nsGenericElement);
|
1998-09-02 00:56:01 +00:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
|
|
|
|
// QueryInterface implementation for nsHTMLFontElement
|
|
|
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLFontElement,
|
|
|
|
nsGenericHTMLContainerElement)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLFontElement)
|
|
|
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLFontElement)
|
|
|
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
1998-09-02 00:56:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
nsresult
|
1998-10-20 17:07:23 +00:00
|
|
|
nsHTMLFontElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
1998-09-02 00:56:01 +00:00
|
|
|
{
|
2000-12-23 10:56:31 +00:00
|
|
|
NS_ENSURE_ARG_POINTER(aReturn);
|
|
|
|
*aReturn = nsnull;
|
|
|
|
|
|
|
|
nsHTMLFontElement* it = new nsHTMLFontElement();
|
|
|
|
|
|
|
|
if (!it) {
|
1998-09-02 00:56:01 +00:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2000-12-23 10:56:31 +00:00
|
|
|
|
2000-08-18 06:52:31 +00:00
|
|
|
nsCOMPtr<nsIDOMNode> kungFuDeathGrip(it);
|
2000-12-23 10:56:31 +00:00
|
|
|
|
|
|
|
nsresult rv = it->Init(mNodeInfo);
|
|
|
|
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
|
|
|
|
|
|
|
CopyInnerTo(this, it, aDeep);
|
|
|
|
|
|
|
|
*aReturn = NS_STATIC_CAST(nsIDOMNode *, it);
|
|
|
|
|
|
|
|
NS_ADDREF(*aReturn);
|
|
|
|
|
|
|
|
return NS_OK;
|
1998-09-02 00:56:01 +00:00
|
|
|
}
|
|
|
|
|
2000-12-23 10:56:31 +00:00
|
|
|
|
1998-11-03 01:08:02 +00:00
|
|
|
NS_IMPL_STRING_ATTR(nsHTMLFontElement, Color, color)
|
|
|
|
NS_IMPL_STRING_ATTR(nsHTMLFontElement, Face, face)
|
|
|
|
NS_IMPL_STRING_ATTR(nsHTMLFontElement, Size, size)
|
1998-09-02 00:56:01 +00:00
|
|
|
|
2000-12-23 10:56:31 +00:00
|
|
|
|
1998-09-02 00:56:01 +00:00
|
|
|
NS_IMETHODIMP
|
1998-09-02 23:53:16 +00:00
|
|
|
nsHTMLFontElement::StringToAttribute(nsIAtom* aAttribute,
|
2002-03-23 23:04:39 +00:00
|
|
|
const nsAString& aValue,
|
1998-09-02 00:56:01 +00:00
|
|
|
nsHTMLValue& aResult)
|
|
|
|
{
|
1998-09-03 22:21:32 +00:00
|
|
|
if ((aAttribute == nsHTMLAtoms::size) ||
|
|
|
|
(aAttribute == nsHTMLAtoms::pointSize) ||
|
|
|
|
(aAttribute == nsHTMLAtoms::fontWeight)) {
|
|
|
|
nsAutoString tmp(aValue);
|
1998-11-24 02:39:36 +00:00
|
|
|
//rickg: fixed flaw where ToInteger error code was not being checked.
|
|
|
|
// This caused wrong default value for font size.
|
1998-09-03 22:21:32 +00:00
|
|
|
PRInt32 ec, v = tmp.ToInteger(&ec);
|
1998-11-24 02:39:36 +00:00
|
|
|
if(NS_SUCCEEDED(ec)){
|
|
|
|
tmp.CompressWhitespace(PR_TRUE, PR_FALSE);
|
2000-08-16 07:39:38 +00:00
|
|
|
PRUnichar ch = tmp.IsEmpty() ? 0 : tmp.First();
|
1998-11-24 02:39:36 +00:00
|
|
|
aResult.SetIntValue(v, ((ch == '+') || (ch == '-')) ?
|
|
|
|
eHTMLUnit_Integer : eHTMLUnit_Enumerated);
|
|
|
|
return NS_CONTENT_ATTR_HAS_VALUE;
|
|
|
|
}
|
1998-09-03 22:21:32 +00:00
|
|
|
}
|
1999-07-24 19:55:35 +00:00
|
|
|
else if (aAttribute == nsHTMLAtoms::color) {
|
2003-01-21 21:24:16 +00:00
|
|
|
if (aResult.ParseColor(aValue, mDocument)) {
|
1999-07-24 19:55:35 +00:00
|
|
|
return NS_CONTENT_ATTR_HAS_VALUE;
|
|
|
|
}
|
1998-09-03 22:21:32 +00:00
|
|
|
}
|
1998-09-02 00:56:01 +00:00
|
|
|
return NS_CONTENT_ATTR_NOT_THERE;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1998-09-02 23:53:16 +00:00
|
|
|
nsHTMLFontElement::AttributeToString(nsIAtom* aAttribute,
|
1998-12-20 01:21:23 +00:00
|
|
|
const nsHTMLValue& aValue,
|
2002-03-23 23:04:39 +00:00
|
|
|
nsAString& aResult) const
|
1998-09-02 00:56:01 +00:00
|
|
|
{
|
1998-09-03 22:21:32 +00:00
|
|
|
if ((aAttribute == nsHTMLAtoms::size) ||
|
|
|
|
(aAttribute == nsHTMLAtoms::pointSize) ||
|
|
|
|
(aAttribute == nsHTMLAtoms::fontWeight)) {
|
|
|
|
aResult.Truncate();
|
2000-08-23 17:27:06 +00:00
|
|
|
nsAutoString intVal;
|
1998-09-03 22:21:32 +00:00
|
|
|
if (aValue.GetUnit() == eHTMLUnit_Enumerated) {
|
2000-08-23 17:27:06 +00:00
|
|
|
intVal.AppendInt(aValue.GetIntValue(), 10);
|
|
|
|
aResult.Append(intVal);
|
1998-09-03 22:21:32 +00:00
|
|
|
return NS_CONTENT_ATTR_HAS_VALUE;
|
|
|
|
}
|
|
|
|
else if (aValue.GetUnit() == eHTMLUnit_Integer) {
|
1998-11-24 02:39:36 +00:00
|
|
|
PRInt32 value = aValue.GetIntValue();
|
1998-09-03 22:21:32 +00:00
|
|
|
if (value >= 0) {
|
2000-08-23 17:27:06 +00:00
|
|
|
aResult.Append(NS_LITERAL_STRING("+"));
|
1998-09-03 22:21:32 +00:00
|
|
|
}
|
2000-08-23 17:27:06 +00:00
|
|
|
intVal.AppendInt(value, 10);
|
|
|
|
aResult.Append(intVal);
|
1998-09-03 22:21:32 +00:00
|
|
|
return NS_CONTENT_ATTR_HAS_VALUE;
|
|
|
|
}
|
2000-12-23 10:56:31 +00:00
|
|
|
|
1998-09-03 22:21:32 +00:00
|
|
|
return NS_CONTENT_ATTR_NOT_THERE;
|
|
|
|
}
|
2000-12-23 10:56:31 +00:00
|
|
|
|
|
|
|
return nsGenericHTMLContainerElement::AttributeToString(aAttribute, aValue,
|
|
|
|
aResult);
|
1998-09-02 00:56:01 +00:00
|
|
|
}
|
|
|
|
|
1998-09-05 04:00:06 +00:00
|
|
|
static void
|
2001-05-31 22:19:43 +00:00
|
|
|
MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
|
|
|
|
nsRuleData* aData)
|
1998-09-02 00:56:01 +00:00
|
|
|
{
|
2001-05-31 22:19:43 +00:00
|
|
|
if (!aData)
|
|
|
|
return;
|
1998-09-03 22:21:32 +00:00
|
|
|
|
2001-05-31 22:19:43 +00:00
|
|
|
if (aData->mFontData) {
|
2002-11-12 15:17:07 +00:00
|
|
|
nsRuleDataFont& font = *(aData->mFontData);
|
2001-05-31 22:19:43 +00:00
|
|
|
nsHTMLValue value;
|
|
|
|
|
1998-09-03 22:21:32 +00:00
|
|
|
// face: string list
|
2001-05-31 22:19:43 +00:00
|
|
|
if (font.mFamily.GetUnit() == eCSSUnit_Null) {
|
|
|
|
aAttributes->GetAttribute(nsHTMLAtoms::face, value);
|
|
|
|
if (value.GetUnit() == eHTMLUnit_String) {
|
|
|
|
nsAutoString familyList;
|
1998-09-03 22:21:32 +00:00
|
|
|
value.GetStringValue(familyList);
|
2002-11-12 15:17:07 +00:00
|
|
|
if (!familyList.IsEmpty()) {
|
2001-05-31 22:19:43 +00:00
|
|
|
font.mFamily.SetStringValue(familyList, eCSSUnit_String);
|
2002-11-12 15:17:07 +00:00
|
|
|
font.mFamilyFromHTML = PR_TRUE;
|
|
|
|
}
|
1998-09-03 22:21:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// pointSize: int, enum
|
2001-05-31 22:19:43 +00:00
|
|
|
if (font.mSize.GetUnit() == eCSSUnit_Null) {
|
|
|
|
aAttributes->GetAttribute(nsHTMLAtoms::pointSize, value);
|
|
|
|
if (value.GetUnit() == eHTMLUnit_Integer ||
|
|
|
|
value.GetUnit() == eHTMLUnit_Enumerated) {
|
|
|
|
PRInt32 val = value.GetIntValue();
|
|
|
|
font.mSize.SetFloatValue((float)val, eCSSUnit_Point);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// size: int, enum ,
|
1998-09-05 04:00:06 +00:00
|
|
|
aAttributes->GetAttribute(nsHTMLAtoms::size, value);
|
2002-08-06 04:32:39 +00:00
|
|
|
nsHTMLUnit unit = value.GetUnit();
|
|
|
|
if (unit == eHTMLUnit_Integer || unit == eHTMLUnit_Enumerated) {
|
1998-09-03 22:21:32 +00:00
|
|
|
PRInt32 size = value.GetIntValue();
|
2002-08-06 04:32:39 +00:00
|
|
|
if (unit == eHTMLUnit_Integer) // int (+/-)
|
|
|
|
size += 3; // XXX should be BASEFONT, not three
|
2001-05-31 22:19:43 +00:00
|
|
|
|
2002-08-06 04:32:39 +00:00
|
|
|
size = ((0 < size) ? ((size < 8) ? size : 7) : 1);
|
|
|
|
font.mSize.SetIntValue(size, eCSSUnit_Enumerated);
|
1998-09-03 22:21:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// fontWeight: int, enum
|
2001-05-31 22:19:43 +00:00
|
|
|
if (font.mWeight.GetUnit() == eCSSUnit_Null) {
|
|
|
|
aAttributes->GetAttribute(nsHTMLAtoms::fontWeight, value);
|
|
|
|
if (value.GetUnit() == eHTMLUnit_Integer) // +/-
|
|
|
|
font.mWeight.SetIntValue(value.GetIntValue(), eCSSUnit_Integer);
|
|
|
|
else if (value.GetUnit() == eHTMLUnit_Enumerated)
|
|
|
|
font.mWeight.SetIntValue(value.GetIntValue(), eCSSUnit_Enumerated);
|
1998-09-03 22:21:32 +00:00
|
|
|
}
|
2001-05-31 22:19:43 +00:00
|
|
|
}
|
|
|
|
else if (aData->mColorData && aData->mSID == eStyleStruct_Color) {
|
|
|
|
if (aData->mColorData->mColor.GetUnit() == eCSSUnit_Null) {
|
|
|
|
// color: color
|
|
|
|
nsHTMLValue value;
|
|
|
|
if (NS_CONTENT_ATTR_NOT_THERE !=
|
|
|
|
aAttributes->GetAttribute(nsHTMLAtoms::color, value)) {
|
|
|
|
if (((eHTMLUnit_Color == value.GetUnit())) ||
|
|
|
|
(eHTMLUnit_ColorName == value.GetUnit()))
|
|
|
|
aData->mColorData->mColor.SetColorValue(value.GetColorValue());
|
|
|
|
}
|
1998-09-03 22:21:32 +00:00
|
|
|
}
|
1999-04-15 21:23:05 +00:00
|
|
|
}
|
2001-05-31 22:19:43 +00:00
|
|
|
else if (aData->mTextData && aData->mSID == eStyleStruct_TextReset) {
|
1999-04-15 21:23:05 +00:00
|
|
|
nsHTMLValue value;
|
2000-12-23 10:56:31 +00:00
|
|
|
if (NS_CONTENT_ATTR_NOT_THERE !=
|
|
|
|
aAttributes->GetAttribute(nsHTMLAtoms::color, value)) {
|
1999-07-07 01:24:40 +00:00
|
|
|
if (((eHTMLUnit_Color == value.GetUnit())) ||
|
2001-05-31 22:19:43 +00:00
|
|
|
(eHTMLUnit_ColorName == value.GetUnit()))
|
|
|
|
aData->mTextData->mDecoration.SetIntValue(NS_STYLE_TEXT_DECORATION_OVERRIDE_ALL, eCSSUnit_Enumerated);
|
1998-09-03 22:21:32 +00:00
|
|
|
}
|
|
|
|
}
|
2000-12-23 10:56:31 +00:00
|
|
|
|
2001-05-31 22:19:43 +00:00
|
|
|
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
1998-09-05 04:00:06 +00:00
|
|
|
}
|
|
|
|
|
1999-07-07 01:24:40 +00:00
|
|
|
NS_IMETHODIMP
|
2002-08-24 14:41:28 +00:00
|
|
|
nsHTMLFontElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
|
|
|
nsChangeHint& aHint) const
|
1999-07-07 01:24:40 +00:00
|
|
|
{
|
2003-04-16 18:55:56 +00:00
|
|
|
if (aAttribute == nsHTMLAtoms::color) {
|
|
|
|
aHint = NS_STYLE_HINT_VISUAL;
|
|
|
|
}
|
|
|
|
else if ((aAttribute == nsHTMLAtoms::face) ||
|
|
|
|
(aAttribute == nsHTMLAtoms::pointSize) ||
|
|
|
|
(aAttribute == nsHTMLAtoms::size) ||
|
|
|
|
(aAttribute == nsHTMLAtoms::fontWeight)) {
|
|
|
|
aHint = NS_STYLE_HINT_REFLOW;
|
|
|
|
}
|
|
|
|
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
|
|
|
aHint = NS_STYLE_HINT_CONTENT;
|
|
|
|
}
|
|
|
|
|
1999-07-07 01:24:40 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-09-05 04:00:06 +00:00
|
|
|
NS_IMETHODIMP
|
2001-05-31 22:19:43 +00:00
|
|
|
nsHTMLFontElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const
|
1998-09-05 04:00:06 +00:00
|
|
|
{
|
2001-05-31 22:19:43 +00:00
|
|
|
aMapRuleFunc = &MapAttributesIntoRule;
|
1998-09-05 04:00:06 +00:00
|
|
|
return NS_OK;
|
1998-09-02 00:56:01 +00:00
|
|
|
}
|