content/base/src/nsStyledElement.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim:set tw=80 expandtab softtabstop=2 ts=2 sw=2: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 /**
michael@0 8 * nsStyledElement is the base for elements supporting styling via the
michael@0 9 * id/class/style attributes; it is a common base for their support in HTML,
michael@0 10 * SVG and MathML.
michael@0 11 */
michael@0 12
michael@0 13 #ifndef __NS_STYLEDELEMENT_H_
michael@0 14 #define __NS_STYLEDELEMENT_H_
michael@0 15
michael@0 16 #include "mozilla/Attributes.h"
michael@0 17 #include "nsString.h"
michael@0 18 #include "mozilla/dom/Element.h"
michael@0 19
michael@0 20 namespace mozilla {
michael@0 21 namespace css {
michael@0 22 class StyleRule;
michael@0 23 }
michael@0 24 }
michael@0 25
michael@0 26 typedef mozilla::dom::Element nsStyledElementBase;
michael@0 27
michael@0 28 class nsStyledElementNotElementCSSInlineStyle : public nsStyledElementBase
michael@0 29 {
michael@0 30
michael@0 31 protected:
michael@0 32
michael@0 33 inline nsStyledElementNotElementCSSInlineStyle(already_AddRefed<nsINodeInfo>& aNodeInfo)
michael@0 34 : nsStyledElementBase(aNodeInfo)
michael@0 35 {}
michael@0 36
michael@0 37 public:
michael@0 38 // nsIContent interface methods
michael@0 39 virtual nsIAtom* GetClassAttributeName() const MOZ_OVERRIDE;
michael@0 40 virtual nsIAtom* GetIDAttributeName() const MOZ_OVERRIDE;
michael@0 41 virtual nsIAtom* DoGetID() const MOZ_OVERRIDE;
michael@0 42 virtual const nsAttrValue* DoGetClasses() const MOZ_OVERRIDE;
michael@0 43
michael@0 44 virtual mozilla::css::StyleRule* GetInlineStyleRule();
michael@0 45 virtual nsresult SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule,
michael@0 46 const nsAString* aSerialized,
michael@0 47 bool aNotify) MOZ_OVERRIDE;
michael@0 48
michael@0 49 virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
michael@0 50 bool aNotify) MOZ_OVERRIDE;
michael@0 51 virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
michael@0 52 const nsAttrValue* aValue, bool aNotify) MOZ_OVERRIDE;
michael@0 53
michael@0 54 nsICSSDeclaration* Style();
michael@0 55
michael@0 56 protected:
michael@0 57
michael@0 58 /**
michael@0 59 * Parse a style attr value into a CSS rulestruct (or, if there is no
michael@0 60 * document, leave it as a string) and return as nsAttrValue.
michael@0 61 *
michael@0 62 * @param aValue the value to parse
michael@0 63 * @param aResult the resulting HTMLValue [OUT]
michael@0 64 */
michael@0 65 void ParseStyleAttribute(const nsAString& aValue,
michael@0 66 nsAttrValue& aResult,
michael@0 67 bool aForceInDataDoc);
michael@0 68
michael@0 69 virtual bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute,
michael@0 70 const nsAString& aValue, nsAttrValue& aResult) MOZ_OVERRIDE;
michael@0 71
michael@0 72 friend class mozilla::dom::Element;
michael@0 73
michael@0 74 /**
michael@0 75 * Create the style struct from the style attr. Used when an element is
michael@0 76 * first put into a document. Only has an effect if the old value is a
michael@0 77 * string. If aForceInDataDoc is true, will reparse even if we're in a data
michael@0 78 * document.
michael@0 79 */
michael@0 80 nsresult ReparseStyleAttribute(bool aForceInDataDoc);
michael@0 81 };
michael@0 82
michael@0 83 class nsStyledElement : public nsStyledElementNotElementCSSInlineStyle {
michael@0 84 protected:
michael@0 85 inline nsStyledElement(already_AddRefed<nsINodeInfo>& aNodeInfo)
michael@0 86 : nsStyledElementNotElementCSSInlineStyle(aNodeInfo)
michael@0 87 {}
michael@0 88 };
michael@0 89
michael@0 90 #endif // __NS_STYLEDELEMENT_H_

mercurial