2007-08-06 19:27:19 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim:set tw=80 expandtab softtabstop=2 ts=2 sw=2: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-08-06 19:27:19 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* nsStyledElement is the base for elements supporting styling via the
|
|
|
|
* id/class/style attributes; it is a common base for their support in HTML,
|
|
|
|
* SVG and MathML.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __NS_STYLEDELEMENT_H_
|
|
|
|
#define __NS_STYLEDELEMENT_H_
|
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2007-08-06 19:27:19 +04:00
|
|
|
#include "nsString.h"
|
2012-11-15 02:10:08 +04:00
|
|
|
#include "mozilla/dom/Element.h"
|
2007-08-06 19:27:19 +04:00
|
|
|
|
2011-03-11 05:48:57 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace css {
|
|
|
|
class StyleRule;
|
|
|
|
}
|
|
|
|
}
|
2007-08-06 19:27:19 +04:00
|
|
|
|
2012-11-15 02:10:08 +04:00
|
|
|
typedef mozilla::dom::Element nsStyledElementBase;
|
2007-08-06 19:27:19 +04:00
|
|
|
|
2011-04-08 09:27:57 +04:00
|
|
|
class nsStyledElementNotElementCSSInlineStyle : public nsStyledElementBase
|
2007-08-06 19:27:19 +04:00
|
|
|
{
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2014-08-05 17:19:51 +04:00
|
|
|
inline explicit nsStyledElementNotElementCSSInlineStyle(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
2007-08-06 19:27:19 +04:00
|
|
|
: nsStyledElementBase(aNodeInfo)
|
|
|
|
{}
|
|
|
|
|
|
|
|
public:
|
2010-06-04 05:09:20 +04:00
|
|
|
// nsIContent interface methods
|
2015-01-03 05:13:39 +03:00
|
|
|
virtual mozilla::css::StyleRule* GetInlineStyleRule() MOZ_OVERRIDE;
|
2012-04-14 17:09:19 +04:00
|
|
|
virtual nsresult SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule,
|
|
|
|
const nsAString* aSerialized,
|
2013-05-30 00:43:41 +04:00
|
|
|
bool aNotify) MOZ_OVERRIDE;
|
2007-08-06 19:27:19 +04:00
|
|
|
|
2013-01-11 12:42:59 +04:00
|
|
|
nsICSSDeclaration* Style();
|
2010-08-06 01:59:36 +04:00
|
|
|
|
2010-02-24 07:37:46 +03:00
|
|
|
protected:
|
|
|
|
|
2007-08-06 19:27:19 +04:00
|
|
|
/**
|
|
|
|
* Parse a style attr value into a CSS rulestruct (or, if there is no
|
|
|
|
* document, leave it as a string) and return as nsAttrValue.
|
|
|
|
*
|
|
|
|
* @param aValue the value to parse
|
|
|
|
* @param aResult the resulting HTMLValue [OUT]
|
|
|
|
*/
|
2010-02-24 07:37:46 +03:00
|
|
|
void ParseStyleAttribute(const nsAString& aValue,
|
|
|
|
nsAttrValue& aResult,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aForceInDataDoc);
|
2007-08-06 19:27:19 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute,
|
2013-05-30 00:43:41 +04:00
|
|
|
const nsAString& aValue, nsAttrValue& aResult) MOZ_OVERRIDE;
|
2007-08-06 19:27:19 +04:00
|
|
|
|
2012-11-15 02:10:07 +04:00
|
|
|
friend class mozilla::dom::Element;
|
2012-03-22 08:10:51 +04:00
|
|
|
|
2008-02-19 20:52:00 +03:00
|
|
|
/**
|
|
|
|
* Create the style struct from the style attr. Used when an element is
|
|
|
|
* first put into a document. Only has an effect if the old value is a
|
|
|
|
* string. If aForceInDataDoc is true, will reparse even if we're in a data
|
|
|
|
* document.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
nsresult ReparseStyleAttribute(bool aForceInDataDoc);
|
2007-08-06 19:27:19 +04:00
|
|
|
};
|
|
|
|
|
2011-04-08 09:27:57 +04:00
|
|
|
class nsStyledElement : public nsStyledElementNotElementCSSInlineStyle {
|
|
|
|
protected:
|
2014-08-05 17:19:51 +04:00
|
|
|
inline explicit nsStyledElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
2011-04-08 09:27:57 +04:00
|
|
|
: nsStyledElementNotElementCSSInlineStyle(aNodeInfo)
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
2007-08-06 19:27:19 +04:00
|
|
|
#endif // __NS_STYLEDELEMENT_H_
|