2017-10-27 20:33:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
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/. */
|
2002-03-22 23:18:42 +03:00
|
|
|
|
2006-03-25 08:47:31 +03:00
|
|
|
/* DOM object returned from element.getComputedStyle() */
|
|
|
|
|
2002-03-22 23:18:42 +03:00
|
|
|
#ifndef nsComputedDOMStyle_h__
|
|
|
|
#define nsComputedDOMStyle_h__
|
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2016-09-16 07:40:45 +03:00
|
|
|
#include "mozilla/StyleComplexColor.h"
|
2017-09-25 13:50:24 +03:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2018-04-16 16:18:48 +03:00
|
|
|
#include "mozilla/dom/Element.h"
|
2002-03-22 23:18:42 +03:00
|
|
|
#include "nsCOMPtr.h"
|
2018-03-28 04:25:47 +03:00
|
|
|
#include "nsContentUtils.h"
|
2013-03-03 04:31:48 +04:00
|
|
|
#include "nscore.h"
|
|
|
|
#include "nsDOMCSSDeclaration.h"
|
2018-03-22 21:20:41 +03:00
|
|
|
#include "mozilla/ComputedStyle.h"
|
2013-03-03 04:31:48 +04:00
|
|
|
#include "nsIWeakReferenceUtils.h"
|
2013-09-16 05:06:52 +04:00
|
|
|
#include "mozilla/gfx/Types.h"
|
|
|
|
#include "nsCoord.h"
|
|
|
|
#include "nsColor.h"
|
2016-01-28 08:24:00 +03:00
|
|
|
#include "nsStyleStruct.h"
|
2016-11-19 00:47:30 +03:00
|
|
|
#include "mozilla/WritingModes.h"
|
2013-03-03 04:31:48 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2017-11-27 11:10:27 +03:00
|
|
|
class DocGroup;
|
2013-03-03 04:31:48 +04:00
|
|
|
class Element;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
2016-01-27 19:02:13 +03:00
|
|
|
struct ComputedGridTrackInfo;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace mozilla
|
2002-03-22 23:18:42 +03:00
|
|
|
|
2018-03-22 21:20:41 +03:00
|
|
|
struct ComputedStyleMap;
|
2018-04-29 14:17:26 +03:00
|
|
|
struct nsCSSKTableEntry;
|
2012-08-06 07:00:56 +04:00
|
|
|
class nsIFrame;
|
2010-04-11 00:09:38 +04:00
|
|
|
class nsIPresShell;
|
2012-10-01 20:49:41 +04:00
|
|
|
class nsDOMCSSValueList;
|
2014-06-19 04:57:51 +04:00
|
|
|
struct nsMargin;
|
2012-10-01 20:49:41 +04:00
|
|
|
class nsROCSSPrimitiveValue;
|
2013-09-16 05:06:52 +04:00
|
|
|
class nsStyleCoord;
|
|
|
|
class nsStyleCorners;
|
2014-06-19 04:57:51 +04:00
|
|
|
struct nsStyleFilter;
|
2013-09-16 05:06:52 +04:00
|
|
|
class nsStyleGradient;
|
2014-06-19 04:57:51 +04:00
|
|
|
struct nsStyleImage;
|
2013-09-16 05:06:52 +04:00
|
|
|
class nsStyleSides;
|
2010-04-11 00:09:38 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsComputedDOMStyle final : public nsDOMCSSDeclaration,
|
2015-09-17 05:08:21 +03:00
|
|
|
public nsStubMutationObserver {
|
2015-12-29 01:42:08 +03:00
|
|
|
private:
|
|
|
|
// Convenience typedefs:
|
2018-04-29 14:17:26 +03:00
|
|
|
typedef nsCSSKTableEntry KTableEntry;
|
2015-12-29 01:42:08 +03:00
|
|
|
typedef mozilla::dom::CSSValue CSSValue;
|
2016-11-22 10:30:01 +03:00
|
|
|
typedef mozilla::StyleGeometryBox StyleGeometryBox;
|
2014-02-05 15:10:44 +04:00
|
|
|
|
2015-12-29 01:42:08 +03:00
|
|
|
public:
|
2008-11-27 20:44:26 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2012-08-06 06:16:30 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(
|
|
|
|
nsComputedDOMStyle, nsICSSDeclaration)
|
2002-03-22 23:18:42 +03:00
|
|
|
|
2012-10-01 20:49:41 +04:00
|
|
|
NS_DECL_NSIDOMCSSSTYLEDECLARATION_HELPER
|
2018-01-30 22:48:26 +03:00
|
|
|
nsresult GetPropertyValue(const nsCSSPropertyID aPropID,
|
|
|
|
nsAString& aValue) override;
|
2018-01-30 22:48:26 +03:00
|
|
|
nsresult SetPropertyValue(const nsCSSPropertyID aPropID,
|
|
|
|
const nsAString& aValue,
|
|
|
|
nsIPrincipal* aSubjectPrincipal) override;
|
2018-03-14 16:13:29 +03:00
|
|
|
|
|
|
|
void IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aPropName) final;
|
2002-03-22 23:18:42 +03:00
|
|
|
|
2017-05-19 07:57:35 +03:00
|
|
|
enum StyleType {
|
|
|
|
eDefaultOnly, // Only includes UA and user sheets
|
|
|
|
eAll // Includes all stylesheets
|
|
|
|
};
|
|
|
|
|
2012-07-06 16:28:33 +04:00
|
|
|
nsComputedDOMStyle(mozilla::dom::Element* aElement,
|
2019-01-02 16:05:23 +03:00
|
|
|
const nsAString& aPseudoElt,
|
|
|
|
mozilla::dom::Document* aDocument, StyleType aStyleType);
|
2002-03-22 23:18:42 +03:00
|
|
|
|
2018-06-08 12:18:51 +03:00
|
|
|
nsINode* GetParentObject() override { return mElement; }
|
2009-07-13 15:14:57 +04:00
|
|
|
|
2018-03-22 21:20:41 +03:00
|
|
|
static already_AddRefed<mozilla::ComputedStyle> GetComputedStyle(
|
|
|
|
mozilla::dom::Element* aElement, nsAtom* aPseudo,
|
|
|
|
StyleType aStyleType = eAll);
|
2009-08-11 02:52:29 +04:00
|
|
|
|
2018-03-22 21:20:41 +03:00
|
|
|
static already_AddRefed<mozilla::ComputedStyle> GetComputedStyleNoFlush(
|
|
|
|
mozilla::dom::Element* aElement, nsAtom* aPseudo,
|
|
|
|
StyleType aStyleType = eAll) {
|
|
|
|
return DoGetComputedStyleNoFlush(
|
2018-03-28 04:25:47 +03:00
|
|
|
aElement, aPseudo, nsContentUtils::GetPresShellForContent(aElement),
|
2018-03-25 17:35:53 +03:00
|
|
|
aStyleType);
|
2017-04-03 10:49:09 +03:00
|
|
|
}
|
|
|
|
|
2018-03-22 21:20:41 +03:00
|
|
|
static already_AddRefed<mozilla::ComputedStyle>
|
|
|
|
GetUnanimatedComputedStyleNoFlush(mozilla::dom::Element* aElement,
|
2018-03-25 17:35:53 +03:00
|
|
|
nsAtom* aPseudo);
|
2009-08-21 01:52:47 +04:00
|
|
|
|
2010-04-03 05:58:25 +04:00
|
|
|
// Helper for nsDOMWindowUtils::GetVisitedDependentComputedStyle
|
2011-09-29 10:19:26 +04:00
|
|
|
void SetExposeVisitedStyle(bool aExpose) {
|
2010-04-03 05:58:25 +04:00
|
|
|
NS_ASSERTION(aExpose != mExposeVisitedStyle, "should always be changing");
|
|
|
|
mExposeVisitedStyle = aExpose;
|
|
|
|
}
|
|
|
|
|
2018-03-08 21:52:32 +03:00
|
|
|
void GetCSSImageURLs(const nsAString& aPropertyName,
|
|
|
|
nsTArray<nsString>& aImageURLs,
|
|
|
|
mozilla::ErrorResult& aRv) final;
|
|
|
|
|
2010-07-15 00:58:56 +04:00
|
|
|
// nsDOMCSSDeclaration abstract methods which should never be called
|
|
|
|
// on a nsComputedDOMStyle object, but must be defined to avoid
|
|
|
|
// compile errors.
|
Bug 1428246 - The attributeChangedCallback is fired twice for the *first* style attribute change, r=peterv
The idea with this patch is that style code will first call
InlineStyleDeclarationWillChange before style declaration has changed, and SetInlineStyleDeclaration once it has changed.
In order to be able to report old attribute value, InlineStyleDeclarationWillChange reads the value and also calls AttributeWillChange (so that DOMMutationObserser can grab the old value). Later SetInlineStyleDeclaration passes the old value to
SetAttrAndNotify so that mutation events and attributeChanged callbacks are handled correctly.
Because of performance, declaration can't be cloned for reading the old value. And that is why the recently-added callback is used to detect when declaration is about to change (bug 1466963 and followup bug 1468665).
To keep the expected existing behavior, even if declaration isn't changed, but just a new declaration was created (since there wasn't any), we need to still run all these
willchange/set calls. That is when the code has 'if (created)' checks.
Since there are several declaration implementation and only nsDOMCSSAttributeDeclaration needs the about-to-change callback, GetPropertyChangeClosure is the one to initialize the callback closure, and the struct which is then passes as data to the closure.
Apparently we lost mutation event testing on style attribute when the pref was added, so test_style_attr_listener.html is modified to test both pref values.
--HG--
extra : rebase_source : 9e605d43f22e650ac3912fbfb41abb8d5a2a0c8f
2018-06-26 12:54:00 +03:00
|
|
|
mozilla::DeclarationBlock* GetOrCreateCSSDeclaration(
|
|
|
|
Operation aOperation, mozilla::DeclarationBlock** aCreated) final;
|
|
|
|
virtual nsresult SetCSSDeclaration(mozilla::DeclarationBlock*,
|
|
|
|
mozilla::MutationClosureData*) override;
|
2019-01-02 16:05:23 +03:00
|
|
|
virtual mozilla::dom::Document* DocToUpdate() override;
|
2018-05-03 18:41:48 +03:00
|
|
|
|
2018-05-14 19:22:20 +03:00
|
|
|
nsDOMCSSDeclaration::ParsingEnvironment GetParsingEnvironment(
|
|
|
|
nsIPrincipal* aSubjectPrincipal) const final;
|
2010-07-15 00:58:56 +04:00
|
|
|
|
2015-12-29 01:42:08 +03:00
|
|
|
static already_AddRefed<nsROCSSPrimitiveValue> MatrixToCSSValue(
|
|
|
|
const mozilla::gfx::Matrix4x4& aMatrix);
|
2018-11-28 03:59:15 +03:00
|
|
|
static void SetToRGBAColor(nsROCSSPrimitiveValue* aValue, nscolor aColor);
|
2013-05-23 12:41:40 +04:00
|
|
|
|
2013-10-03 14:58:01 +04:00
|
|
|
static void RegisterPrefChangeCallbacks();
|
|
|
|
static void UnregisterPrefChangeCallbacks();
|
|
|
|
|
2015-09-17 05:08:21 +03:00
|
|
|
// nsIMutationObserver
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_PARENTCHAINCHANGED
|
|
|
|
|
2002-03-22 23:18:42 +03:00
|
|
|
private:
|
2014-06-26 20:29:06 +04:00
|
|
|
virtual ~nsComputedDOMStyle();
|
|
|
|
|
2009-02-25 03:14:45 +03:00
|
|
|
void AssertFlushedPendingReflows() {
|
|
|
|
NS_ASSERTION(mFlushedPendingReflows,
|
|
|
|
"property getter should have been marked layout-dependent");
|
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2013-04-04 18:00:07 +04:00
|
|
|
nsMargin GetAdjustedValuesForBoxSizing();
|
|
|
|
|
2018-03-22 21:20:41 +03:00
|
|
|
// This indicates error by leaving mComputedStyle null.
|
2013-12-12 06:09:45 +04:00
|
|
|
void UpdateCurrentStyleSources(bool aNeedsLayoutFlush);
|
|
|
|
void ClearCurrentStyleSources();
|
2013-10-28 00:56:32 +04:00
|
|
|
|
2015-09-17 05:08:21 +03:00
|
|
|
// Helper functions called by UpdateCurrentStyleSources.
|
2018-03-22 21:20:41 +03:00
|
|
|
void ClearComputedStyle();
|
|
|
|
void SetResolvedComputedStyle(RefPtr<mozilla::ComputedStyle>&& aContext,
|
|
|
|
uint64_t aGeneration);
|
|
|
|
void SetFrameComputedStyle(mozilla::ComputedStyle* aStyle,
|
|
|
|
uint64_t aGeneration);
|
2015-09-17 05:08:21 +03:00
|
|
|
|
2018-03-22 21:20:41 +03:00
|
|
|
static already_AddRefed<mozilla::ComputedStyle> DoGetComputedStyleNoFlush(
|
|
|
|
mozilla::dom::Element* aElement, nsAtom* aPseudo,
|
2018-03-25 17:35:53 +03:00
|
|
|
nsIPresShell* aPresShell, StyleType aStyleType);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2018-03-26 12:09:17 +03:00
|
|
|
#define STYLE_STRUCT(name_) \
|
|
|
|
const nsStyle##name_* Style##name_() { \
|
|
|
|
return mComputedStyle->Style##name_(); \
|
2006-12-19 07:16:09 +03:00
|
|
|
}
|
|
|
|
#include "nsStyleStructList.h"
|
|
|
|
#undef STYLE_STRUCT
|
|
|
|
|
2019-02-05 02:28:44 +03:00
|
|
|
/**
|
|
|
|
* A method to get a percentage base for a percentage value. Returns true
|
|
|
|
* if a percentage base value was determined, false otherwise.
|
|
|
|
*/
|
|
|
|
typedef bool (nsComputedDOMStyle::*PercentageBaseGetter)(nscoord&);
|
|
|
|
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> GetEllipseRadii(const nsStyleCorners& aRadius,
|
2017-01-05 09:59:17 +03:00
|
|
|
mozilla::Corner aFullCorner);
|
2002-03-22 23:18:42 +03:00
|
|
|
|
2016-11-18 11:28:38 +03:00
|
|
|
already_AddRefed<CSSValue> GetOffsetWidthFor(mozilla::Side aSide);
|
2002-03-22 23:18:42 +03:00
|
|
|
|
2019-02-05 02:28:44 +03:00
|
|
|
already_AddRefed<CSSValue> GetAbsoluteOffset(mozilla::Side);
|
|
|
|
nscoord GetUsedAbsoluteOffset(mozilla::Side);
|
|
|
|
already_AddRefed<CSSValue> GetNonStaticPositionOffset(
|
|
|
|
mozilla::Side aSide, bool aResolveAuto, PercentageBaseGetter aWidthGetter,
|
|
|
|
PercentageBaseGetter aHeightGetter);
|
2013-08-16 04:31:32 +04:00
|
|
|
|
2016-11-18 11:28:38 +03:00
|
|
|
already_AddRefed<CSSValue> GetStaticOffset(mozilla::Side aSide);
|
2002-03-22 23:18:42 +03:00
|
|
|
|
2016-11-18 11:28:38 +03:00
|
|
|
already_AddRefed<CSSValue> GetPaddingWidthFor(mozilla::Side aSide);
|
2002-07-08 11:11:59 +04:00
|
|
|
|
2016-11-18 11:28:38 +03:00
|
|
|
already_AddRefed<CSSValue> GetBorderStyleFor(mozilla::Side aSide);
|
2002-03-22 23:18:42 +03:00
|
|
|
|
2016-11-18 11:28:38 +03:00
|
|
|
already_AddRefed<CSSValue> GetBorderWidthFor(mozilla::Side aSide);
|
2002-03-22 23:18:42 +03:00
|
|
|
|
2016-11-18 11:28:38 +03:00
|
|
|
already_AddRefed<CSSValue> GetBorderColorFor(mozilla::Side aSide);
|
2002-03-22 23:18:42 +03:00
|
|
|
|
2016-11-18 11:28:38 +03:00
|
|
|
already_AddRefed<CSSValue> GetMarginWidthFor(mozilla::Side aSide);
|
2011-03-04 20:28:57 +03:00
|
|
|
|
2017-05-03 00:12:59 +03:00
|
|
|
already_AddRefed<CSSValue> GetFallbackValue(const nsStyleSVGPaint* aPaint);
|
|
|
|
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> GetSVGPaintFor(bool aFill);
|
2010-07-15 00:58:55 +04:00
|
|
|
|
2017-06-19 08:44:22 +03:00
|
|
|
already_AddRefed<CSSValue> GetTransformValue(
|
|
|
|
nsCSSValueSharedList* aSpecifiedTransform);
|
|
|
|
|
2016-01-27 19:02:13 +03:00
|
|
|
// Appends all aLineNames (may be empty) space-separated to aResult.
|
2015-12-23 01:03:15 +03:00
|
|
|
void AppendGridLineNames(nsString& aResult,
|
|
|
|
const nsTArray<nsString>& aLineNames);
|
2016-01-27 19:02:13 +03:00
|
|
|
// Appends aLineNames as a CSSValue* to aValueList. If aLineNames is empty
|
|
|
|
// a value ("[]") is only appended if aSuppressEmptyList is false.
|
2015-12-23 01:03:15 +03:00
|
|
|
void AppendGridLineNames(nsDOMCSSValueList* aValueList,
|
2016-01-27 19:02:13 +03:00
|
|
|
const nsTArray<nsString>& aLineNames,
|
|
|
|
bool aSuppressEmptyList = true);
|
2015-12-23 01:03:15 +03:00
|
|
|
// Appends aLineNames1/2 (if non-empty) as a CSSValue* to aValueList.
|
|
|
|
void AppendGridLineNames(nsDOMCSSValueList* aValueList,
|
|
|
|
const nsTArray<nsString>& aLineNames1,
|
|
|
|
const nsTArray<nsString>& aLineNames2);
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> GetGridTrackSize(const nsStyleCoord& aMinSize,
|
2015-12-29 01:42:09 +03:00
|
|
|
const nsStyleCoord& aMaxSize);
|
|
|
|
already_AddRefed<CSSValue> GetGridTemplateColumnsRows(
|
|
|
|
const nsStyleGridTemplate& aTrackList,
|
2016-01-27 19:02:13 +03:00
|
|
|
const mozilla::ComputedGridTrackInfo* aTrackInfo);
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> GetGridLine(const nsStyleGridLine& aGridLine);
|
2014-03-11 02:54:13 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool GetLineHeightCoord(nscoord& aCoord);
|
2002-03-22 23:18:42 +03:00
|
|
|
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> GetCSSShadowArray(nsCSSShadowArray* aArray,
|
2015-12-29 01:42:09 +03:00
|
|
|
bool aIsBoxShadow);
|
2008-07-08 04:56:52 +04:00
|
|
|
|
2011-03-04 20:28:57 +03:00
|
|
|
void GetCSSGradientString(const nsStyleGradient* aGradient,
|
|
|
|
nsAString& aString);
|
|
|
|
void GetImageRectString(nsIURI* aURI, const nsStyleSides& aCropRect,
|
|
|
|
nsString& aString);
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> GetScrollSnapPoints(const nsStyleCoord& aCoord);
|
2009-08-01 19:53:40 +04:00
|
|
|
|
2016-11-19 00:47:30 +03:00
|
|
|
bool ShouldHonorMinSizeAutoInAxis(mozilla::PhysicalAxis aAxis);
|
|
|
|
|
2010-07-15 00:58:55 +04:00
|
|
|
/* Properties queryable as CSSValues.
|
|
|
|
* To avoid a name conflict with nsIDOM*CSS2Properties, these are all
|
|
|
|
* DoGetXXX instead of GetXXX.
|
|
|
|
*/
|
2002-04-20 18:30:57 +04:00
|
|
|
|
|
|
|
/* Box properties */
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetBoxFlex();
|
|
|
|
|
|
|
|
already_AddRefed<CSSValue> DoGetWidth();
|
|
|
|
already_AddRefed<CSSValue> DoGetHeight();
|
|
|
|
already_AddRefed<CSSValue> DoGetMaxHeight();
|
|
|
|
already_AddRefed<CSSValue> DoGetMaxWidth();
|
|
|
|
already_AddRefed<CSSValue> DoGetMinHeight();
|
|
|
|
already_AddRefed<CSSValue> DoGetMinWidth();
|
|
|
|
already_AddRefed<CSSValue> DoGetLeft();
|
|
|
|
already_AddRefed<CSSValue> DoGetTop();
|
|
|
|
already_AddRefed<CSSValue> DoGetRight();
|
|
|
|
already_AddRefed<CSSValue> DoGetBottom();
|
2002-03-22 23:18:42 +03:00
|
|
|
|
2018-07-02 02:00:18 +03:00
|
|
|
/* Color */
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetColor();
|
2018-07-02 02:00:18 +03:00
|
|
|
|
|
|
|
/* Font properties */
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetOsxFontSmoothing();
|
2002-03-22 23:18:42 +03:00
|
|
|
|
2014-03-11 02:54:13 +04:00
|
|
|
/* Grid properties */
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetGridAutoFlow();
|
|
|
|
already_AddRefed<CSSValue> DoGetGridAutoColumns();
|
|
|
|
already_AddRefed<CSSValue> DoGetGridAutoRows();
|
|
|
|
already_AddRefed<CSSValue> DoGetGridTemplateAreas();
|
|
|
|
already_AddRefed<CSSValue> DoGetGridTemplateColumns();
|
|
|
|
already_AddRefed<CSSValue> DoGetGridTemplateRows();
|
|
|
|
already_AddRefed<CSSValue> DoGetGridColumnStart();
|
|
|
|
already_AddRefed<CSSValue> DoGetGridColumnEnd();
|
|
|
|
already_AddRefed<CSSValue> DoGetGridRowStart();
|
|
|
|
already_AddRefed<CSSValue> DoGetGridRowEnd();
|
2014-03-11 02:54:13 +04:00
|
|
|
|
2016-01-28 08:28:00 +03:00
|
|
|
/* StyleImageLayer properties */
|
|
|
|
already_AddRefed<CSSValue> DoGetImageLayerPosition(
|
|
|
|
const nsStyleImageLayers& aLayers);
|
|
|
|
|
|
|
|
/* Mask properties */
|
|
|
|
already_AddRefed<CSSValue> DoGetMask();
|
2017-09-21 12:36:57 +03:00
|
|
|
|
2002-03-22 23:18:42 +03:00
|
|
|
/* Padding properties */
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetPaddingTop();
|
|
|
|
already_AddRefed<CSSValue> DoGetPaddingBottom();
|
|
|
|
already_AddRefed<CSSValue> DoGetPaddingLeft();
|
|
|
|
already_AddRefed<CSSValue> DoGetPaddingRight();
|
2002-03-22 23:18:42 +03:00
|
|
|
|
|
|
|
/* Table Properties */
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetBorderSpacing();
|
|
|
|
already_AddRefed<CSSValue> DoGetVerticalAlign();
|
2002-03-22 23:18:42 +03:00
|
|
|
|
|
|
|
/* Border Properties */
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetBorderTopWidth();
|
|
|
|
already_AddRefed<CSSValue> DoGetBorderBottomWidth();
|
|
|
|
already_AddRefed<CSSValue> DoGetBorderLeftWidth();
|
|
|
|
already_AddRefed<CSSValue> DoGetBorderRightWidth();
|
|
|
|
already_AddRefed<CSSValue> DoGetBorderBottomLeftRadius();
|
|
|
|
already_AddRefed<CSSValue> DoGetBorderBottomRightRadius();
|
|
|
|
already_AddRefed<CSSValue> DoGetBorderTopLeftRadius();
|
|
|
|
already_AddRefed<CSSValue> DoGetBorderTopRightRadius();
|
2011-12-23 03:34:45 +04:00
|
|
|
|
|
|
|
/* Border Image */
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetBorderImageSlice();
|
|
|
|
already_AddRefed<CSSValue> DoGetBorderImageWidth();
|
|
|
|
already_AddRefed<CSSValue> DoGetBorderImageOutset();
|
2002-03-22 23:18:42 +03:00
|
|
|
|
2008-07-08 04:56:52 +04:00
|
|
|
/* Box Shadow */
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetBoxShadow();
|
2008-07-08 04:56:52 +04:00
|
|
|
|
2002-03-22 23:18:42 +03:00
|
|
|
/* Margin Properties */
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetMarginTopWidth();
|
|
|
|
already_AddRefed<CSSValue> DoGetMarginBottomWidth();
|
|
|
|
already_AddRefed<CSSValue> DoGetMarginLeftWidth();
|
|
|
|
already_AddRefed<CSSValue> DoGetMarginRightWidth();
|
2002-03-22 23:18:42 +03:00
|
|
|
|
|
|
|
/* Outline Properties */
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetOutlineWidth();
|
|
|
|
already_AddRefed<CSSValue> DoGetOutlineRadiusBottomLeft();
|
|
|
|
already_AddRefed<CSSValue> DoGetOutlineRadiusBottomRight();
|
|
|
|
already_AddRefed<CSSValue> DoGetOutlineRadiusTopLeft();
|
|
|
|
already_AddRefed<CSSValue> DoGetOutlineRadiusTopRight();
|
2002-03-22 23:18:42 +03:00
|
|
|
|
|
|
|
/* z-index */
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetZIndex();
|
2002-03-22 23:18:42 +03:00
|
|
|
|
|
|
|
/* Text Properties */
|
2016-07-28 10:23:36 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetInitialLetter();
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetLineHeight();
|
|
|
|
already_AddRefed<CSSValue> DoGetTextDecoration();
|
|
|
|
already_AddRefed<CSSValue> DoGetTextDecorationColor();
|
|
|
|
already_AddRefed<CSSValue> DoGetTextDecorationLine();
|
|
|
|
already_AddRefed<CSSValue> DoGetTextDecorationStyle();
|
|
|
|
already_AddRefed<CSSValue> DoGetTextEmphasisPosition();
|
|
|
|
already_AddRefed<CSSValue> DoGetTextEmphasisStyle();
|
|
|
|
already_AddRefed<CSSValue> DoGetTextOverflow();
|
|
|
|
already_AddRefed<CSSValue> DoGetTextShadow();
|
|
|
|
already_AddRefed<CSSValue> DoGetLetterSpacing();
|
|
|
|
already_AddRefed<CSSValue> DoGetWordSpacing();
|
|
|
|
already_AddRefed<CSSValue> DoGetTabSize();
|
2016-04-22 20:40:39 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetWebkitTextStrokeWidth();
|
2002-03-22 23:18:42 +03:00
|
|
|
|
|
|
|
/* Display properties */
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetBinding();
|
|
|
|
already_AddRefed<CSSValue> DoGetDisplay();
|
|
|
|
already_AddRefed<CSSValue> DoGetContain();
|
|
|
|
already_AddRefed<CSSValue> DoGetWillChange();
|
|
|
|
already_AddRefed<CSSValue> DoGetTouchAction();
|
|
|
|
already_AddRefed<CSSValue> DoGetTransform();
|
|
|
|
already_AddRefed<CSSValue> DoGetTransformOrigin();
|
|
|
|
already_AddRefed<CSSValue> DoGetPerspective();
|
|
|
|
already_AddRefed<CSSValue> DoGetPerspectiveOrigin();
|
|
|
|
already_AddRefed<CSSValue> DoGetScrollSnapPointsX();
|
|
|
|
already_AddRefed<CSSValue> DoGetScrollSnapPointsY();
|
2018-09-19 08:33:12 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetScrollbarColor();
|
2002-03-22 23:18:42 +03:00
|
|
|
|
|
|
|
/* User interface properties */
|
2016-12-22 03:04:15 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetCaretColor();
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetForceBrokenImageIcon();
|
2002-03-22 23:18:42 +03:00
|
|
|
|
2004-06-17 15:57:37 +04:00
|
|
|
/* Column properties */
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetColumnCount();
|
|
|
|
already_AddRefed<CSSValue> DoGetColumnWidth();
|
|
|
|
already_AddRefed<CSSValue> DoGetColumnRuleWidth();
|
2004-06-17 15:57:37 +04:00
|
|
|
|
2009-08-21 01:52:47 +04:00
|
|
|
/* CSS Transitions */
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetTransitionProperty();
|
|
|
|
already_AddRefed<CSSValue> DoGetTransitionDuration();
|
|
|
|
already_AddRefed<CSSValue> DoGetTransitionDelay();
|
2009-08-21 01:52:47 +04:00
|
|
|
|
2011-04-12 10:18:42 +04:00
|
|
|
/* CSS Animations */
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetAnimationName();
|
|
|
|
already_AddRefed<CSSValue> DoGetAnimationDuration();
|
|
|
|
already_AddRefed<CSSValue> DoGetAnimationDelay();
|
|
|
|
already_AddRefed<CSSValue> DoGetAnimationIterationCount();
|
2011-04-12 10:18:42 +04:00
|
|
|
|
2012-07-07 04:06:19 +04:00
|
|
|
/* CSS Flexbox properties */
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetFlexBasis();
|
|
|
|
already_AddRefed<CSSValue> DoGetFlexGrow();
|
|
|
|
already_AddRefed<CSSValue> DoGetFlexShrink();
|
2015-11-03 17:18:05 +03:00
|
|
|
|
|
|
|
/* CSS Box Alignment properties */
|
2018-04-24 02:52:51 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetColumnGap();
|
|
|
|
already_AddRefed<CSSValue> DoGetRowGap();
|
2012-07-07 04:06:19 +04:00
|
|
|
|
2007-07-21 18:20:25 +04:00
|
|
|
/* SVG properties */
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> DoGetFill();
|
|
|
|
already_AddRefed<CSSValue> DoGetStroke();
|
|
|
|
already_AddRefed<CSSValue> DoGetMarkerEnd();
|
|
|
|
already_AddRefed<CSSValue> DoGetMarkerMid();
|
|
|
|
already_AddRefed<CSSValue> DoGetMarkerStart();
|
|
|
|
already_AddRefed<CSSValue> DoGetStrokeDasharray();
|
|
|
|
|
|
|
|
already_AddRefed<CSSValue> DoGetStrokeDashoffset();
|
|
|
|
already_AddRefed<CSSValue> DoGetStrokeWidth();
|
|
|
|
|
|
|
|
already_AddRefed<CSSValue> DoGetFillOpacity();
|
|
|
|
already_AddRefed<CSSValue> DoGetStrokeMiterlimit();
|
|
|
|
already_AddRefed<CSSValue> DoGetStrokeOpacity();
|
|
|
|
|
|
|
|
already_AddRefed<CSSValue> DoGetFilter();
|
|
|
|
already_AddRefed<CSSValue> DoGetPaintOrder();
|
2007-07-21 18:20:25 +04:00
|
|
|
|
2018-06-27 08:34:29 +03:00
|
|
|
// For working around a MSVC bug. See related comment in
|
|
|
|
// GenerateComputedDOMStyleGenerated.py.
|
|
|
|
already_AddRefed<CSSValue> DummyGetter();
|
|
|
|
|
2014-09-09 22:40:17 +04:00
|
|
|
/* Helper functions */
|
2016-09-16 07:40:45 +03:00
|
|
|
void SetValueFromComplexColor(nsROCSSPrimitiveValue* aValue,
|
|
|
|
const mozilla::StyleComplexColor& aColor);
|
2016-08-25 12:59:51 +03:00
|
|
|
void SetValueToPositionCoord(const mozilla::Position::Coord& aCoord,
|
2016-08-25 12:59:51 +03:00
|
|
|
nsROCSSPrimitiveValue* aValue);
|
|
|
|
void SetValueToPosition(const mozilla::Position& aPosition,
|
2014-09-09 22:40:17 +04:00
|
|
|
nsDOMCSSValueList* aValueList);
|
2018-10-10 05:58:20 +03:00
|
|
|
void SetValueToURLValue(const mozilla::css::URLValue* aURL,
|
2016-10-11 09:56:11 +03:00
|
|
|
nsROCSSPrimitiveValue* aValue);
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2007-02-20 21:43:16 +03:00
|
|
|
/**
|
|
|
|
* Method to set aValue to aCoord. If aCoord is a percentage value and
|
|
|
|
* aPercentageBaseGetter is not null, aPercentageBaseGetter is called. If it
|
2011-10-17 18:59:28 +04:00
|
|
|
* returns true, the percentage base it outputs in its out param is used
|
|
|
|
* to compute an nscoord value. If the getter is null or returns false,
|
2007-02-20 21:43:16 +03:00
|
|
|
* the percent value of aCoord is set as a percent value on aValue. aTable,
|
|
|
|
* if not null, is the keyword table to handle eStyleUnit_Enumerated. When
|
|
|
|
* calling SetAppUnits on aValue (for coord or percent values), the value
|
2011-10-28 22:33:28 +04:00
|
|
|
* passed in will be clamped to be no less than aMinAppUnits and no more than
|
|
|
|
* aMaxAppUnits.
|
2007-02-20 21:43:16 +03:00
|
|
|
*
|
|
|
|
* XXXbz should caller pass in some sort of bitfield indicating which units
|
|
|
|
* can be expected or something?
|
|
|
|
*/
|
2007-04-23 11:04:33 +04:00
|
|
|
void SetValueToCoord(nsROCSSPrimitiveValue* aValue,
|
|
|
|
const nsStyleCoord& aCoord, bool aClampNegativeCalc,
|
2012-07-30 18:20:58 +04:00
|
|
|
PercentageBaseGetter aPercentageBaseGetter = nullptr,
|
2015-11-20 05:09:07 +03:00
|
|
|
const KTableEntry aTable[] = nullptr,
|
2007-04-23 11:04:33 +04:00
|
|
|
nscoord aMinAppUnits = nscoord_MIN,
|
|
|
|
nscoord aMaxAppUnits = nscoord_MAX);
|
2007-02-20 21:43:16 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If aCoord is a eStyleUnit_Coord returns the nscoord. If it's
|
2007-04-23 11:04:33 +04:00
|
|
|
* eStyleUnit_Percent, attempts to resolve the percentage base and returns
|
|
|
|
* the resulting nscoord. If it's some other unit or a percentge base can't
|
|
|
|
* be determined, returns aDefaultValue.
|
2007-02-20 21:43:16 +03:00
|
|
|
*/
|
2007-04-23 11:04:33 +04:00
|
|
|
nscoord StyleCoordToNSCoord(const nsStyleCoord& aCoord,
|
|
|
|
PercentageBaseGetter aPercentageBaseGetter,
|
2011-09-29 10:19:26 +04:00
|
|
|
nscoord aDefaultValue, bool aClampNegativeCalc);
|
2007-02-20 21:43:16 +03:00
|
|
|
|
2017-05-30 06:27:46 +03:00
|
|
|
/**
|
|
|
|
* Append coord values from four sides. It omits values when possible.
|
|
|
|
*/
|
|
|
|
void AppendFourSideCoordValues(nsDOMCSSValueList* aList,
|
|
|
|
const nsStyleSides& aValues);
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool GetCBContentWidth(nscoord& aWidth);
|
2019-02-05 02:28:44 +03:00
|
|
|
bool GetCBContentHeight(nscoord& aHeight);
|
|
|
|
bool GetCBPaddingRectWidth(nscoord& aWidth);
|
|
|
|
bool GetCBPaddingRectHeight(nscoord& aHeight);
|
2013-08-16 04:31:32 +04:00
|
|
|
bool GetScrollFrameContentWidth(nscoord& aWidth);
|
|
|
|
bool GetScrollFrameContentHeight(nscoord& aHeight);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool GetFrameBoundsWidthForTransform(nscoord& aWidth);
|
|
|
|
bool GetFrameBoundsHeightForTransform(nscoord& aHeight);
|
|
|
|
bool GetFrameBorderRectWidth(nscoord& aWidth);
|
|
|
|
bool GetFrameBorderRectHeight(nscoord& aHeight);
|
2002-03-22 23:18:42 +03:00
|
|
|
|
2017-10-16 08:29:46 +03:00
|
|
|
/* Helper functions for computing and serializing a nsStyleCoord. */
|
|
|
|
void SetCssTextToCoord(nsAString& aCssText, const nsStyleCoord& aCoord,
|
|
|
|
bool aClampNegativeCalc);
|
2015-12-29 01:42:08 +03:00
|
|
|
already_AddRefed<CSSValue> CreatePrimitiveValueForStyleFilter(
|
2013-07-23 02:08:33 +04:00
|
|
|
const nsStyleFilter& aStyleFilter);
|
|
|
|
|
2016-07-22 10:40:01 +03:00
|
|
|
template <typename ReferenceBox>
|
|
|
|
already_AddRefed<CSSValue> CreatePrimitiveValueForShapeSource(
|
2017-09-25 13:50:24 +03:00
|
|
|
const mozilla::UniquePtr<mozilla::StyleBasicShape>& aStyleBasicShape,
|
2016-07-22 10:40:01 +03:00
|
|
|
ReferenceBox aReferenceBox, const KTableEntry aBoxKeywordTable[]);
|
2016-05-22 15:41:19 +03:00
|
|
|
|
|
|
|
// Helper function for computing basic shape styles.
|
|
|
|
already_AddRefed<CSSValue> CreatePrimitiveValueForBasicShape(
|
2017-09-25 13:50:24 +03:00
|
|
|
const mozilla::UniquePtr<mozilla::StyleBasicShape>& aStyleBasicShape);
|
2014-11-22 07:28:00 +03:00
|
|
|
void BoxValuesToString(nsAString& aString,
|
2017-10-16 11:55:54 +03:00
|
|
|
const nsTArray<nsStyleCoord>& aBoxValues,
|
|
|
|
bool aClampNegativeCalc);
|
2014-11-22 07:28:00 +03:00
|
|
|
void BasicShapeRadiiToString(nsAString& aCssText,
|
|
|
|
const nsStyleCorners& aCorners);
|
|
|
|
|
2017-05-23 07:02:11 +03:00
|
|
|
// Find out if we can safely skip flushing for aDocument (i.e. pending
|
|
|
|
// restyles does not affect mContent).
|
2019-01-02 16:05:23 +03:00
|
|
|
bool NeedsToFlush(mozilla::dom::Document*) const;
|
2017-05-23 07:02:11 +03:00
|
|
|
|
2018-03-22 21:20:41 +03:00
|
|
|
static ComputedStyleMap* GetComputedStyleMap();
|
2002-10-08 05:53:31 +04:00
|
|
|
|
2005-06-03 05:51:15 +04:00
|
|
|
// We don't really have a good immutable representation of "presentation".
|
|
|
|
// Given the way GetComputedStyle is currently used, we should just grab the
|
2018-06-08 12:18:51 +03:00
|
|
|
// presshell, if any, from the document.
|
2005-06-03 05:51:15 +04:00
|
|
|
nsWeakPtr mDocumentWeak;
|
2018-06-08 12:18:51 +03:00
|
|
|
RefPtr<mozilla::dom::Element> mElement;
|
2002-03-22 23:18:42 +03:00
|
|
|
|
2015-09-17 05:08:20 +03:00
|
|
|
/**
|
2018-03-23 16:49:21 +03:00
|
|
|
* Strong reference to the ComputedStyle we access data from. This can be
|
|
|
|
* either a ComputedStyle we resolved ourselves or a ComputedStyle we got
|
2015-09-17 05:08:20 +03:00
|
|
|
* from our frame.
|
|
|
|
*
|
2018-03-23 16:49:21 +03:00
|
|
|
* If we got the ComputedStyle from the frame, we clear out mComputedStyle
|
2015-09-17 05:08:20 +03:00
|
|
|
* in ClearCurrentStyleSources. If we resolved one ourselves, then
|
2018-03-22 21:20:41 +03:00
|
|
|
* ClearCurrentStyleSources leaves it in mComputedStyle for use the next
|
2015-09-17 05:08:20 +03:00
|
|
|
* time this nsComputedDOMStyle object is queried. UpdateCurrentStyleSources
|
2018-03-23 16:49:21 +03:00
|
|
|
* in this case will check that the ComputedStyle is still valid to be used,
|
2015-09-17 05:08:20 +03:00
|
|
|
* by checking whether flush styles results in any restyles having been
|
|
|
|
* processed.
|
2002-03-22 23:18:42 +03:00
|
|
|
*/
|
2019-02-05 19:45:54 +03:00
|
|
|
RefPtr<mozilla::ComputedStyle> mComputedStyle;
|
2017-10-03 01:05:19 +03:00
|
|
|
RefPtr<nsAtom> mPseudo;
|
2002-03-22 23:18:42 +03:00
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
/*
|
2008-01-30 00:53:09 +03:00
|
|
|
* While computing style data, the primary frame for mContent --- named
|
|
|
|
* "outer" because we should use it to compute positioning data. Null
|
2006-12-22 09:10:32 +03:00
|
|
|
* otherwise.
|
|
|
|
*/
|
2008-01-30 00:53:09 +03:00
|
|
|
nsIFrame* mOuterFrame;
|
|
|
|
/*
|
|
|
|
* While computing style data, the "inner frame" for mContent --- the frame
|
|
|
|
* which we should use to compute margin, border, padding and content data.
|
|
|
|
* Null otherwise.
|
|
|
|
*/
|
|
|
|
nsIFrame* mInnerFrame;
|
2007-05-05 09:30:10 +04:00
|
|
|
/*
|
|
|
|
* While computing style data, the presshell we're working with. Null
|
|
|
|
* otherwise.
|
|
|
|
*/
|
|
|
|
nsIPresShell* mPresShell;
|
2006-12-22 09:10:32 +03:00
|
|
|
|
2017-05-19 07:57:35 +03:00
|
|
|
/*
|
|
|
|
* The kind of styles we should be returning.
|
|
|
|
*/
|
|
|
|
StyleType mStyleType;
|
|
|
|
|
2015-09-17 05:08:20 +03:00
|
|
|
/**
|
|
|
|
* The nsComputedDOMStyle generation at the time we last resolved a style
|
2018-03-22 21:20:41 +03:00
|
|
|
* context and stored it in mComputedStyle.
|
2015-09-17 05:08:20 +03:00
|
|
|
*/
|
2018-03-22 21:20:41 +03:00
|
|
|
uint64_t mComputedStyleGeneration;
|
2015-09-17 05:08:20 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mExposeVisitedStyle;
|
2010-04-03 05:58:25 +04:00
|
|
|
|
2015-09-17 05:08:20 +03:00
|
|
|
/**
|
2018-03-23 16:49:21 +03:00
|
|
|
* Whether we resolved a ComputedStyle last time we called
|
2015-09-17 05:08:20 +03:00
|
|
|
* UpdateCurrentStyleSources. Initially false.
|
|
|
|
*/
|
2018-03-22 21:20:41 +03:00
|
|
|
bool mResolvedComputedStyle;
|
2015-09-17 05:08:20 +03:00
|
|
|
|
2009-02-25 03:14:45 +03:00
|
|
|
#ifdef DEBUG
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mFlushedPendingReflows;
|
2009-02-25 03:14:45 +03:00
|
|
|
#endif
|
2018-06-27 08:34:29 +03:00
|
|
|
|
|
|
|
friend struct ComputedStyleMap;
|
2002-03-22 23:18:42 +03:00
|
|
|
};
|
|
|
|
|
2012-07-06 16:28:33 +04:00
|
|
|
already_AddRefed<nsComputedDOMStyle> NS_NewComputedDOMStyle(
|
|
|
|
mozilla::dom::Element* aElement, const nsAString& aPseudoElt,
|
2019-01-02 16:05:23 +03:00
|
|
|
mozilla::dom::Document* aDocument,
|
2017-05-19 07:57:35 +03:00
|
|
|
nsComputedDOMStyle::StyleType aStyleType = nsComputedDOMStyle::eAll);
|
2009-07-13 15:14:57 +04:00
|
|
|
|
2002-03-22 23:18:42 +03:00
|
|
|
#endif /* nsComputedDOMStyle_h__ */
|