2016-01-11 02:28:35 +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/. */
|
2006-03-25 08:47:31 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* structs that contain the data provided by nsStyleContext, the
|
|
|
|
* internal API for computed style data for an element
|
|
|
|
*/
|
|
|
|
|
2001-06-01 02:19:43 +04:00
|
|
|
#ifndef nsStyleStruct_h___
|
|
|
|
#define nsStyleStruct_h___
|
|
|
|
|
2015-09-17 05:08:19 +03:00
|
|
|
#include "mozilla/ArenaObjectID.h"
|
2011-12-16 23:42:07 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-12-12 06:09:41 +04:00
|
|
|
#include "mozilla/CSSVariableValues.h"
|
2015-10-20 02:16:20 +03:00
|
|
|
#include "mozilla/SheetType.h"
|
2016-04-12 08:52:40 +03:00
|
|
|
#include "mozilla/StaticPtr.h"
|
2016-03-31 02:30:39 +03:00
|
|
|
#include "mozilla/StyleStructContext.h"
|
2001-06-01 02:19:43 +04:00
|
|
|
#include "nsColor.h"
|
|
|
|
#include "nsCoord.h"
|
|
|
|
#include "nsMargin.h"
|
|
|
|
#include "nsFont.h"
|
|
|
|
#include "nsStyleCoord.h"
|
|
|
|
#include "nsStyleConsts.h"
|
2002-08-24 18:41:28 +04:00
|
|
|
#include "nsChangeHint.h"
|
2004-08-01 03:15:21 +04:00
|
|
|
#include "nsPresContext.h"
|
2001-06-01 02:19:43 +04:00
|
|
|
#include "nsCOMPtr.h"
|
2007-07-18 20:54:57 +04:00
|
|
|
#include "nsCOMArray.h"
|
2009-02-20 08:29:21 +03:00
|
|
|
#include "nsTArray.h"
|
2005-04-02 03:07:00 +04:00
|
|
|
#include "nsCSSValue.h"
|
2012-10-12 16:43:01 +04:00
|
|
|
#include "imgRequestProxy.h"
|
2013-08-29 02:39:06 +04:00
|
|
|
#include "Orientation.h"
|
2014-06-12 05:12:00 +04:00
|
|
|
#include "CounterStyleManager.h"
|
2016-03-25 21:46:21 +03:00
|
|
|
#include <cstddef> // offsetof()
|
2016-04-12 08:52:40 +03:00
|
|
|
#include <utility>
|
2001-06-01 02:19:43 +04:00
|
|
|
|
|
|
|
class nsIFrame;
|
2013-03-03 04:31:48 +04:00
|
|
|
class nsIURI;
|
2015-09-17 05:08:21 +03:00
|
|
|
class nsStyleContext;
|
|
|
|
class nsTextFrame;
|
2009-11-14 07:23:00 +03:00
|
|
|
class imgIContainer;
|
2015-10-23 02:57:35 +03:00
|
|
|
struct nsStyleVisibility;
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2007-04-28 20:01:24 +04:00
|
|
|
// Includes nsStyleStructID.
|
|
|
|
#include "nsStyleStructFwd.h"
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2001-06-30 02:42:46 +04:00
|
|
|
// Bits for each struct.
|
2007-10-09 01:58:22 +04:00
|
|
|
// NS_STYLE_INHERIT_BIT defined in nsStyleStructFwd.h
|
2016-04-12 08:52:40 +03:00
|
|
|
#define NS_STYLE_INHERIT_MASK 0x0007fffff
|
2001-06-30 02:42:46 +04:00
|
|
|
|
2015-08-28 23:13:48 +03:00
|
|
|
// Bits for inherited structs.
|
|
|
|
#define NS_STYLE_INHERITED_STRUCT_MASK \
|
|
|
|
((nsStyleStructID_size_t(1) << nsStyleStructID_Inherited_Count) - 1)
|
|
|
|
// Bits for reset structs.
|
|
|
|
#define NS_STYLE_RESET_STRUCT_MASK \
|
|
|
|
(((nsStyleStructID_size_t(1) << nsStyleStructID_Reset_Count) - 1) \
|
|
|
|
<< nsStyleStructID_Inherited_Count)
|
|
|
|
|
2003-03-06 22:14:17 +03:00
|
|
|
// Additional bits for nsStyleContext's mBits:
|
2016-04-12 08:52:40 +03:00
|
|
|
// Free bit 0x000800000
|
2011-04-23 09:16:41 +04:00
|
|
|
// See nsStyleContext::HasTextDecorationLines
|
2013-12-12 06:09:40 +04:00
|
|
|
#define NS_STYLE_HAS_TEXT_DECORATION_LINES 0x001000000
|
2009-08-11 02:52:29 +04:00
|
|
|
// See nsStyleContext::HasPseudoElementData.
|
2013-12-12 06:09:40 +04:00
|
|
|
#define NS_STYLE_HAS_PSEUDO_ELEMENT_DATA 0x002000000
|
2010-04-03 05:58:25 +04:00
|
|
|
// See nsStyleContext::RelevantLinkIsVisited
|
2013-12-12 06:09:40 +04:00
|
|
|
#define NS_STYLE_RELEVANT_LINK_VISITED 0x004000000
|
2010-04-06 23:42:41 +04:00
|
|
|
// See nsStyleContext::IsStyleIfVisited
|
2013-12-12 06:09:40 +04:00
|
|
|
#define NS_STYLE_IS_STYLE_IF_VISITED 0x008000000
|
2015-12-01 03:16:46 +03:00
|
|
|
// See nsStyleContext::HasChildThatUsesGrandancestorStyle
|
|
|
|
#define NS_STYLE_CHILD_USES_GRANDANCESTOR_STYLE 0x010000000
|
2014-09-05 07:48:44 +04:00
|
|
|
// See nsStyleContext::IsShared
|
|
|
|
#define NS_STYLE_IS_SHARED 0x020000000
|
2014-09-05 07:48:47 +04:00
|
|
|
// See nsStyleContext::AssertStructsNotUsedElsewhere
|
|
|
|
// (This bit is currently only used in #ifdef DEBUG code.)
|
|
|
|
#define NS_STYLE_IS_GOING_AWAY 0x040000000
|
2015-03-11 02:28:21 +03:00
|
|
|
// See nsStyleContext::ShouldSuppressLineBreak
|
|
|
|
#define NS_STYLE_SUPPRESS_LINEBREAK 0x080000000
|
2015-03-16 03:28:49 +03:00
|
|
|
// See nsStyleContext::IsInDisplayNoneSubtree
|
|
|
|
#define NS_STYLE_IN_DISPLAY_NONE_SUBTREE 0x100000000
|
2015-04-29 07:47:15 +03:00
|
|
|
// See nsStyleContext::FindChildWithRules
|
|
|
|
#define NS_STYLE_INELIGIBLE_FOR_SHARING 0x200000000
|
2015-08-28 23:13:47 +03:00
|
|
|
// See nsStyleContext::HasChildThatUsesResetStyle
|
|
|
|
#define NS_STYLE_HAS_CHILD_THAT_USES_RESET_STYLE 0x400000000
|
2009-12-11 10:37:40 +03:00
|
|
|
// See nsStyleContext::GetPseudoEnum
|
2015-08-28 23:13:47 +03:00
|
|
|
#define NS_STYLE_CONTEXT_TYPE_SHIFT 35
|
2001-06-30 02:42:46 +04:00
|
|
|
|
2003-03-06 22:14:17 +03:00
|
|
|
// Additional bits for nsRuleNode's mDependentBits:
|
2016-04-12 08:52:40 +03:00
|
|
|
// Free bit 0x00800000
|
2015-07-27 09:43:44 +03:00
|
|
|
#define NS_RULE_NODE_IS_ANIMATION_RULE 0x01000000
|
2016-04-12 08:52:40 +03:00
|
|
|
// Free bit 0x02000000
|
2013-12-12 06:09:40 +04:00
|
|
|
#define NS_RULE_NODE_USED_DIRECTLY 0x04000000
|
|
|
|
#define NS_RULE_NODE_IS_IMPORTANT 0x08000000
|
|
|
|
#define NS_RULE_NODE_LEVEL_MASK 0xf0000000
|
|
|
|
#define NS_RULE_NODE_LEVEL_SHIFT 28
|
2003-03-06 22:14:17 +03:00
|
|
|
|
2015-07-27 09:43:44 +03:00
|
|
|
// Additional bits for nsRuleNode's mNoneBits:
|
|
|
|
#define NS_RULE_NODE_HAS_ANIMATION_DATA 0x80000000
|
|
|
|
|
2015-10-20 02:16:20 +03:00
|
|
|
static_assert(int(mozilla::SheetType::Count) - 1 <=
|
|
|
|
(NS_RULE_NODE_LEVEL_MASK >> NS_RULE_NODE_LEVEL_SHIFT),
|
|
|
|
"NS_RULE_NODE_LEVEL_MASK cannot fit SheetType");
|
|
|
|
|
2016-04-12 08:52:39 +03:00
|
|
|
static_assert(NS_STYLE_INHERIT_MASK == (1 << nsStyleStructID_Length) - 1,
|
|
|
|
"NS_STYLE_INHERIT_MASK is not correct");
|
|
|
|
|
|
|
|
static_assert((NS_RULE_NODE_IS_ANIMATION_RULE & NS_STYLE_INHERIT_MASK) == 0,
|
2016-01-28 08:36:00 +03:00
|
|
|
"NS_RULE_NODE_IS_ANIMATION_RULE must not overlap the style struct bits.");
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2016-03-25 21:46:21 +03:00
|
|
|
/**
|
|
|
|
* These *_Simple types are used to map Gecko types to layout-equivalent but
|
|
|
|
* simpler Rust types, to aid Rust binding generation.
|
|
|
|
*
|
|
|
|
* If something in this types or the assertions below needs to change, ask
|
|
|
|
* bholley, heycam or emilio before!
|
|
|
|
*
|
|
|
|
* <div rustbindgen="true" replaces="nsPoint">
|
|
|
|
*/
|
|
|
|
struct nsPoint_Simple {
|
|
|
|
nscoord x, y;
|
|
|
|
};
|
|
|
|
|
|
|
|
static_assert(sizeof(nsPoint_Simple) == sizeof(nsPoint), "Wrong nsPoint_Simple size");
|
|
|
|
static_assert(offsetof(nsPoint_Simple, x) == offsetof(nsPoint, x), "Wrong nsPoint_Simple member alignment");
|
|
|
|
static_assert(offsetof(nsPoint_Simple, y) == offsetof(nsPoint, y), "Wrong nsPoint_Simple member alignment");
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <div rustbindgen="true" replaces="nsMargin">
|
|
|
|
*/
|
|
|
|
struct nsMargin_Simple {
|
|
|
|
nscoord top, right, bottom, left;
|
|
|
|
};
|
|
|
|
|
|
|
|
static_assert(sizeof(nsMargin_Simple) == sizeof(nsMargin), "Wrong nsMargin_Simple size");
|
|
|
|
static_assert(offsetof(nsMargin_Simple, top) == offsetof(nsMargin, top), "Wrong nsMargin_Simple member alignment");
|
|
|
|
static_assert(offsetof(nsMargin_Simple, right) == offsetof(nsMargin, right), "Wrong nsMargin_Simple member alignment");
|
|
|
|
static_assert(offsetof(nsMargin_Simple, bottom) == offsetof(nsMargin, bottom), "Wrong nsMargin_Simple member alignment");
|
|
|
|
static_assert(offsetof(nsMargin_Simple, left) == offsetof(nsMargin, left), "Wrong nsMargin_Simple member alignment");
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <div rustbindgen="true" replaces="nsRect">
|
|
|
|
*/
|
|
|
|
struct nsRect_Simple {
|
|
|
|
nscoord x, y, width, height;
|
|
|
|
};
|
|
|
|
|
|
|
|
static_assert(sizeof(nsRect_Simple) == sizeof(nsRect), "Wrong nsRect_Simple size");
|
|
|
|
static_assert(offsetof(nsRect_Simple, x) == offsetof(nsRect, x), "Wrong nsRect_Simple member alignment");
|
|
|
|
static_assert(offsetof(nsRect_Simple, y) == offsetof(nsRect, y), "Wrong nsRect_Simple member alignment");
|
|
|
|
static_assert(offsetof(nsRect_Simple, width) == offsetof(nsRect, width), "Wrong nsRect_Simple member alignment");
|
|
|
|
static_assert(offsetof(nsRect_Simple, height) == offsetof(nsRect, height), "Wrong nsRect_Simple member alignment");
|
|
|
|
|
|
|
|
// The lifetime of these objects is managed by the presshell's arena.
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleFont
|
|
|
|
{
|
2016-03-31 02:30:39 +03:00
|
|
|
nsStyleFont(const nsFont& aFont, StyleStructContext aContext);
|
2003-03-13 18:29:36 +03:00
|
|
|
nsStyleFont(const nsStyleFont& aStyleFont);
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStyleFont(StyleStructContext aContext);
|
2009-08-07 18:38:44 +04:00
|
|
|
~nsStyleFont(void) {
|
|
|
|
MOZ_COUNT_DTOR(nsStyleFont);
|
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2002-08-24 18:41:28 +04:00
|
|
|
nsChangeHint CalcDifference(const nsStyleFont& aOther) const;
|
2012-09-07 21:13:36 +04:00
|
|
|
static nsChangeHint MaxDifference() {
|
2014-09-05 07:48:43 +04:00
|
|
|
return NS_CombineHint(NS_STYLE_HINT_REFLOW,
|
|
|
|
nsChangeHint_NeutralChange);
|
2012-09-07 21:13:36 +04:00
|
|
|
}
|
2015-06-21 07:54:15 +03:00
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
2015-06-21 07:54:15 +03:00
|
|
|
// CalcDifference never returns the reflow hints that are sometimes
|
|
|
|
// handled for descendants as hints not handled for descendants.
|
|
|
|
return nsChangeHint_NeedReflow |
|
|
|
|
nsChangeHint_ReflowChangesSizeOrPosition |
|
|
|
|
nsChangeHint_ClearAncestorIntrinsics;
|
2014-01-03 06:39:54 +04:00
|
|
|
}
|
2003-03-13 18:29:36 +03:00
|
|
|
|
2015-11-16 19:32:39 +03:00
|
|
|
/**
|
|
|
|
* Return aSize multiplied by the current text zoom factor (in aPresContext).
|
|
|
|
* aSize is allowed to be negative, but the caller is expected to deal with
|
|
|
|
* negative results. The result is clamped to nscoord_MIN .. nscoord_MAX.
|
|
|
|
*/
|
2016-03-31 02:30:39 +03:00
|
|
|
static nscoord ZoomText(StyleStructContext aContext, nscoord aSize);
|
2015-11-16 19:32:39 +03:00
|
|
|
/**
|
|
|
|
* Return aSize divided by the current text zoom factor (in aPresContext).
|
|
|
|
* aSize is allowed to be negative, but the caller is expected to deal with
|
|
|
|
* negative results. The result is clamped to nscoord_MIN .. nscoord_MAX.
|
|
|
|
*/
|
2004-08-01 03:15:21 +04:00
|
|
|
static nscoord UnZoomText(nsPresContext* aPresContext, nscoord aSize);
|
2016-03-31 02:30:39 +03:00
|
|
|
static already_AddRefed<nsIAtom> GetLanguage(StyleStructContext aPresContext);
|
2008-01-09 12:38:28 +03:00
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStyleFont* aSelf) CPP_THROW_NEW { return aSelf; }
|
2014-07-16 09:27:12 +04:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
2014-07-16 09:27:13 +04:00
|
|
|
return aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStyleFont, sz);
|
2014-07-16 09:27:12 +04:00
|
|
|
}
|
2004-08-01 03:15:21 +04:00
|
|
|
void Destroy(nsPresContext* aContext);
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2013-06-29 07:28:50 +04:00
|
|
|
void EnableZoom(nsPresContext* aContext, bool aEnable);
|
|
|
|
|
2001-09-27 22:33:58 +04:00
|
|
|
nsFont mFont; // [inherited]
|
2008-10-10 18:56:18 +04:00
|
|
|
nscoord mSize; // [inherited] Our "computed size". Can be different
|
|
|
|
// from mFont.size which is our "actual size" and is
|
|
|
|
// enforced to be >= the user's preferred min-size.
|
|
|
|
// mFont.size should be used for display purposes
|
|
|
|
// while mSize is the value to return in
|
|
|
|
// getComputedStyle() for example.
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mGenericID; // [inherited] generic CSS font family, if any;
|
2008-10-10 18:56:18 +04:00
|
|
|
// value is a kGenericFont_* constant, see nsFont.h.
|
2008-01-09 12:38:28 +03:00
|
|
|
|
|
|
|
// MathML scriptlevel support
|
2012-08-22 19:56:38 +04:00
|
|
|
int8_t mScriptLevel; // [inherited]
|
2013-12-02 20:49:00 +04:00
|
|
|
// MathML mathvariant support
|
|
|
|
uint8_t mMathVariant; // [inherited]
|
2014-01-14 18:39:50 +04:00
|
|
|
// MathML displaystyle support
|
|
|
|
uint8_t mMathDisplay; // [inherited]
|
2012-08-21 06:23:32 +04:00
|
|
|
|
2015-10-08 02:19:29 +03:00
|
|
|
// allow different min font-size for certain cases
|
|
|
|
uint8_t mMinFontSizeRatio; // [inherited] percent * 100
|
|
|
|
|
2012-08-21 06:23:32 +04:00
|
|
|
// was mLanguage set based on a lang attribute in the document?
|
|
|
|
bool mExplicitLanguage; // [inherited]
|
2013-06-29 07:28:50 +04:00
|
|
|
|
|
|
|
// should calls to ZoomText() and UnZoomText() be made to the font
|
|
|
|
// size on this nsStyleFont?
|
|
|
|
bool mAllowZoom; // [inherited]
|
2012-08-21 06:23:32 +04:00
|
|
|
|
2008-01-09 12:38:28 +03:00
|
|
|
// The value mSize would have had if scriptminsize had never been applied
|
|
|
|
nscoord mScriptUnconstrainedSize;
|
|
|
|
nscoord mScriptMinSize; // [inherited] length
|
|
|
|
float mScriptSizeMultiplier; // [inherited]
|
2012-01-24 17:09:55 +04:00
|
|
|
nsCOMPtr<nsIAtom> mLanguage; // [inherited]
|
2001-06-01 02:19:43 +04:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleGradientStop
|
|
|
|
{
|
2012-10-04 09:31:56 +04:00
|
|
|
nsStyleCoord mLocation; // percent, coord, calc, none
|
2009-08-01 19:53:40 +04:00
|
|
|
nscolor mColor;
|
2014-10-22 16:24:00 +04:00
|
|
|
bool mIsInterpolationHint;
|
|
|
|
|
|
|
|
// Use ==/!= on nsStyleGradient instead of on the gradient stop.
|
2015-01-07 02:35:02 +03:00
|
|
|
bool operator==(const nsStyleGradientStop&) const = delete;
|
|
|
|
bool operator!=(const nsStyleGradientStop&) const = delete;
|
2009-08-01 19:53:40 +04:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
class nsStyleGradient final
|
|
|
|
{
|
2009-08-01 19:53:40 +04:00
|
|
|
public:
|
|
|
|
nsStyleGradient();
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mShape; // NS_STYLE_GRADIENT_SHAPE_*
|
|
|
|
uint8_t mSize; // NS_STYLE_GRADIENT_SIZE_*;
|
2009-11-02 22:36:43 +03:00
|
|
|
// not used (must be FARTHEST_CORNER) for linear shape
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mRepeating;
|
2015-07-15 17:37:22 +03:00
|
|
|
bool mLegacySyntax;
|
2009-11-02 22:36:43 +03:00
|
|
|
|
2010-09-15 19:11:26 +04:00
|
|
|
nsStyleCoord mBgPosX; // percent, coord, calc, none
|
|
|
|
nsStyleCoord mBgPosY; // percent, coord, calc, none
|
2009-11-02 22:36:43 +03:00
|
|
|
nsStyleCoord mAngle; // none, angle
|
2009-08-01 19:53:40 +04:00
|
|
|
|
2012-07-07 18:27:08 +04:00
|
|
|
nsStyleCoord mRadiusX; // percent, coord, calc, none
|
|
|
|
nsStyleCoord mRadiusY; // percent, coord, calc, none
|
|
|
|
|
2009-08-01 19:53:40 +04:00
|
|
|
// stops are in the order specified in the stylesheet
|
|
|
|
nsTArray<nsStyleGradientStop> mStops;
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool operator==(const nsStyleGradient& aOther) const;
|
|
|
|
bool operator!=(const nsStyleGradient& aOther) const {
|
2009-08-01 19:53:40 +04:00
|
|
|
return !(*this == aOther);
|
2012-07-15 08:15:35 +04:00
|
|
|
}
|
2009-08-01 19:53:40 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsOpaque();
|
2012-08-27 08:09:46 +04:00
|
|
|
bool HasCalc();
|
|
|
|
uint32_t Hash(PLDHashNumber aHash);
|
2011-01-03 04:48:09 +03:00
|
|
|
|
2010-04-01 22:05:40 +04:00
|
|
|
NS_INLINE_DECL_REFCOUNTING(nsStyleGradient)
|
2010-04-01 20:37:59 +04:00
|
|
|
|
2010-04-01 22:05:40 +04:00
|
|
|
private:
|
2014-03-21 05:16:20 +04:00
|
|
|
// Private destructor, to discourage deletion outside of Release():
|
2009-08-01 19:53:40 +04:00
|
|
|
~nsStyleGradient() {}
|
|
|
|
|
2015-01-07 02:35:02 +03:00
|
|
|
nsStyleGradient(const nsStyleGradient& aOther) = delete;
|
|
|
|
nsStyleGradient& operator=(const nsStyleGradient& aOther) = delete;
|
2009-08-01 19:53:40 +04:00
|
|
|
};
|
|
|
|
|
2009-08-22 00:39:25 +04:00
|
|
|
enum nsStyleImageType {
|
|
|
|
eStyleImageType_Null,
|
|
|
|
eStyleImageType_Image,
|
2010-08-13 17:33:37 +04:00
|
|
|
eStyleImageType_Gradient,
|
|
|
|
eStyleImageType_Element
|
2009-08-22 00:39:25 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents a paintable image of one of the following types.
|
|
|
|
* (1) A real image loaded from an external source.
|
|
|
|
* (2) A CSS linear or radial gradient.
|
2010-08-13 17:33:37 +04:00
|
|
|
* (3) An element within a document, or an <img>, <video>, or <canvas> element
|
|
|
|
* not in a document.
|
2009-08-22 00:39:25 +04:00
|
|
|
* (*) Optionally a crop rect can be set to paint a partial (rectangular)
|
|
|
|
* region of an image. (Currently, this feature is only supported with an
|
|
|
|
* image of type (1)).
|
|
|
|
*/
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleImage
|
|
|
|
{
|
2009-08-22 00:39:25 +04:00
|
|
|
nsStyleImage();
|
|
|
|
~nsStyleImage();
|
|
|
|
nsStyleImage(const nsStyleImage& aOther);
|
|
|
|
nsStyleImage& operator=(const nsStyleImage& aOther);
|
|
|
|
|
|
|
|
void SetNull();
|
2014-07-29 18:56:39 +04:00
|
|
|
void SetImageData(imgRequestProxy* aImage);
|
2010-08-06 01:57:18 +04:00
|
|
|
void TrackImage(nsPresContext* aContext);
|
|
|
|
void UntrackImage(nsPresContext* aContext);
|
2009-08-22 00:39:25 +04:00
|
|
|
void SetGradientData(nsStyleGradient* aGradient);
|
2014-01-04 19:02:17 +04:00
|
|
|
void SetElementId(const char16_t* aElementId);
|
2009-08-22 00:39:25 +04:00
|
|
|
void SetCropRect(nsStyleSides* aCropRect);
|
|
|
|
|
|
|
|
nsStyleImageType GetType() const {
|
|
|
|
return mType;
|
|
|
|
}
|
2014-07-29 18:56:39 +04:00
|
|
|
imgRequestProxy* GetImageData() const {
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(mType == eStyleImageType_Image, "Data is not an image!");
|
|
|
|
MOZ_ASSERT(mImageTracked,
|
|
|
|
"Should be tracking any image we're going to use!");
|
2009-08-22 00:39:25 +04:00
|
|
|
return mImage;
|
|
|
|
}
|
|
|
|
nsStyleGradient* GetGradientData() const {
|
|
|
|
NS_ASSERTION(mType == eStyleImageType_Gradient, "Data is not a gradient!");
|
|
|
|
return mGradient;
|
|
|
|
}
|
2014-01-04 19:02:17 +04:00
|
|
|
const char16_t* GetElementId() const {
|
2010-08-13 17:33:37 +04:00
|
|
|
NS_ASSERTION(mType == eStyleImageType_Element, "Data is not an element!");
|
|
|
|
return mElementId;
|
|
|
|
}
|
2009-08-22 00:39:25 +04:00
|
|
|
nsStyleSides* GetCropRect() const {
|
|
|
|
NS_ASSERTION(mType == eStyleImageType_Image,
|
|
|
|
"Only image data can have a crop rect");
|
|
|
|
return mCropRect;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Compute the actual crop rect in pixels, using the source image bounds.
|
|
|
|
* The computation involves converting percentage unit to pixel unit and
|
|
|
|
* clamping each side value to fit in the source image bounds.
|
|
|
|
* @param aActualCropRect the computed actual crop rect.
|
2011-10-17 18:59:28 +04:00
|
|
|
* @param aIsEntireImage true iff |aActualCropRect| is identical to the
|
2009-08-22 00:39:25 +04:00
|
|
|
* source image bounds.
|
2011-10-17 18:59:28 +04:00
|
|
|
* @return true iff |aActualCropRect| holds a meaningful value.
|
2009-08-22 00:39:25 +04:00
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool ComputeActualCropRect(nsIntRect& aActualCropRect,
|
2012-07-30 18:20:58 +04:00
|
|
|
bool* aIsEntireImage = nullptr) const;
|
2009-08-22 00:39:25 +04:00
|
|
|
|
2009-09-13 02:44:18 +04:00
|
|
|
/**
|
2012-10-13 00:04:03 +04:00
|
|
|
* Starts the decoding of a image.
|
2009-09-13 02:44:18 +04:00
|
|
|
*/
|
2012-10-13 00:04:03 +04:00
|
|
|
nsresult StartDecoding() const;
|
2009-08-22 00:39:25 +04:00
|
|
|
/**
|
2011-10-17 18:59:28 +04:00
|
|
|
* @return true if the item is definitely opaque --- i.e., paints every
|
2009-08-22 00:39:25 +04:00
|
|
|
* pixel within its bounds opaquely, and the bounds contains at least a pixel.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsOpaque() const;
|
2009-08-22 00:39:25 +04:00
|
|
|
/**
|
2011-10-17 18:59:28 +04:00
|
|
|
* @return true if this image is fully loaded, and its size is calculated;
|
|
|
|
* always returns true if |mType| is |eStyleImageType_Gradient| or
|
2010-08-13 17:33:37 +04:00
|
|
|
* |eStyleImageType_Element|.
|
2009-08-22 00:39:25 +04:00
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsComplete() const;
|
2013-07-19 12:40:02 +04:00
|
|
|
/**
|
|
|
|
* @return true if this image is loaded without error;
|
|
|
|
* always returns true if |mType| is |eStyleImageType_Gradient| or
|
|
|
|
* |eStyleImageType_Element|.
|
|
|
|
*/
|
|
|
|
bool IsLoaded() const;
|
2009-08-22 00:39:25 +04:00
|
|
|
/**
|
2011-10-17 18:59:28 +04:00
|
|
|
* @return true if it is 100% confident that this image contains no pixel
|
2009-08-22 00:39:25 +04:00
|
|
|
* to draw.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsEmpty() const {
|
2009-08-22 00:39:25 +04:00
|
|
|
// There are some other cases when the image will be empty, for example
|
|
|
|
// when the crop rect is empty. However, checking the emptiness of crop
|
|
|
|
// rect is non-trivial since each side value can be specified with
|
|
|
|
// percentage unit, which can not be evaluated until the source image size
|
|
|
|
// is available. Therefore, we currently postpone the evaluation of crop
|
2011-01-03 04:48:09 +03:00
|
|
|
// rect until the actual rendering time --- alternatively until GetOpaqueRegion()
|
2009-08-22 00:39:25 +04:00
|
|
|
// is called.
|
|
|
|
return mType == eStyleImageType_Null;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool operator==(const nsStyleImage& aOther) const;
|
|
|
|
bool operator!=(const nsStyleImage& aOther) const {
|
2009-08-22 00:39:25 +04:00
|
|
|
return !(*this == aOther);
|
|
|
|
}
|
|
|
|
|
2013-05-21 16:43:02 +04:00
|
|
|
bool ImageDataEquals(const nsStyleImage& aOther) const
|
|
|
|
{
|
|
|
|
return GetType() == eStyleImageType_Image &&
|
|
|
|
aOther.GetType() == eStyleImageType_Image &&
|
|
|
|
GetImageData() == aOther.GetImageData();
|
|
|
|
}
|
|
|
|
|
2014-01-31 07:36:41 +04:00
|
|
|
// These methods are used for the caller to caches the sub images created
|
|
|
|
// during a border-image paint operation
|
|
|
|
inline void SetSubImage(uint8_t aIndex, imgIContainer* aSubImage) const;
|
|
|
|
inline imgIContainer* GetSubImage(uint8_t aIndex) const;
|
|
|
|
|
2009-08-22 00:39:25 +04:00
|
|
|
private:
|
|
|
|
void DoCopy(const nsStyleImage& aOther);
|
|
|
|
|
2014-01-31 07:36:41 +04:00
|
|
|
// Cache for border-image painting.
|
|
|
|
nsCOMArray<imgIContainer> mSubImages;
|
|
|
|
|
2009-08-22 00:39:25 +04:00
|
|
|
nsStyleImageType mType;
|
|
|
|
union {
|
2014-07-29 18:56:39 +04:00
|
|
|
imgRequestProxy* mImage;
|
2009-08-22 00:39:25 +04:00
|
|
|
nsStyleGradient* mGradient;
|
2014-01-04 19:02:17 +04:00
|
|
|
char16_t* mElementId;
|
2009-08-22 00:39:25 +04:00
|
|
|
};
|
2016-01-28 08:39:00 +03:00
|
|
|
|
2009-08-22 00:39:25 +04:00
|
|
|
// This is _currently_ used only in conjunction with eStyleImageType_Image.
|
|
|
|
nsAutoPtr<nsStyleSides> mCropRect;
|
2010-08-06 01:57:18 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
bool mImageTracked;
|
|
|
|
#endif
|
2009-08-22 00:39:25 +04:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleColor
|
|
|
|
{
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStyleColor(StyleStructContext aContext);
|
2001-06-01 02:19:43 +04:00
|
|
|
nsStyleColor(const nsStyleColor& aOther);
|
2009-08-07 18:38:44 +04:00
|
|
|
~nsStyleColor(void) {
|
|
|
|
MOZ_COUNT_DTOR(nsStyleColor);
|
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2002-08-24 18:41:28 +04:00
|
|
|
nsChangeHint CalcDifference(const nsStyleColor& aOther) const;
|
2012-09-07 21:13:36 +04:00
|
|
|
static nsChangeHint MaxDifference() {
|
Bug 1198894: Use nsChangeHint_RepaintFrame instead of NS_STYLE_HINT_VISUAL to trigger simple repaints in nsStyleStruct.cpp CalcDifference methods. r=heycam
Specifically, this makes us use nsChangeHint_RepaintFrame for changes to font decorations, border-{color,style,radius,image}, color, background-{image,color}, text-decoration-{line,color}, text-overflow
2015-09-22 02:11:51 +03:00
|
|
|
return nsChangeHint_RepaintFrame;
|
2012-09-07 21:13:36 +04:00
|
|
|
}
|
2015-06-21 07:54:15 +03:00
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
2015-06-21 07:54:15 +03:00
|
|
|
// CalcDifference never returns the reflow hints that are sometimes
|
|
|
|
// handled for descendants at all.
|
2014-01-03 06:39:54 +04:00
|
|
|
return nsChangeHint(0);
|
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStyleColor* aSelf) CPP_THROW_NEW { return aSelf; }
|
2004-08-01 03:15:21 +04:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
2014-07-16 09:27:13 +04:00
|
|
|
return aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStyleColor, sz);
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
2004-08-01 03:15:21 +04:00
|
|
|
void Destroy(nsPresContext* aContext) {
|
2001-06-02 01:04:23 +04:00
|
|
|
this->~nsStyleColor();
|
2014-07-16 09:27:13 +04:00
|
|
|
aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
FreeByObjectID(mozilla::eArenaObjectID_nsStyleColor, this);
|
2007-04-23 18:21:53 +04:00
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
|
|
|
// Don't add ANY members to this struct! We can achieve caching in the rule
|
|
|
|
// tree (rather than the style tree) by letting color stay by itself! -dwh
|
|
|
|
nscolor mColor; // [inherited]
|
|
|
|
};
|
|
|
|
|
2016-01-28 08:24:00 +03:00
|
|
|
struct nsStyleImageLayers {
|
|
|
|
nsStyleImageLayers();
|
|
|
|
nsStyleImageLayers(const nsStyleImageLayers &aSource);
|
|
|
|
~nsStyleImageLayers() {
|
|
|
|
MOZ_COUNT_DTOR(nsStyleImageLayers);
|
2014-01-03 06:39:54 +04:00
|
|
|
}
|
2002-10-08 14:24:53 +04:00
|
|
|
|
2016-01-28 08:28:00 +03:00
|
|
|
// Indices into kBackgroundLayerTable and kMaskLayerTable
|
|
|
|
enum {
|
|
|
|
shorthand = 0,
|
|
|
|
color,
|
|
|
|
image,
|
|
|
|
repeat,
|
|
|
|
position,
|
|
|
|
clip,
|
|
|
|
origin,
|
|
|
|
size,
|
|
|
|
attachment,
|
|
|
|
maskMode,
|
|
|
|
composite
|
|
|
|
};
|
|
|
|
|
2009-02-20 08:29:21 +03:00
|
|
|
struct Position;
|
|
|
|
friend struct Position;
|
|
|
|
struct Position {
|
2014-06-19 07:18:03 +04:00
|
|
|
typedef nsStyleCoord::CalcValue PositionCoord;
|
2009-02-20 08:29:21 +03:00
|
|
|
PositionCoord mXPosition, mYPosition;
|
|
|
|
|
|
|
|
// Initialize nothing
|
|
|
|
Position() {}
|
|
|
|
|
2016-01-28 08:28:00 +03:00
|
|
|
bool IsInitialValue() const;
|
|
|
|
|
2014-09-09 22:40:18 +04:00
|
|
|
// Sets both mXPosition and mYPosition to the given percent value for the
|
|
|
|
// initial property-value (e.g. 0.0f for "0% 0%", or 0.5f for "50% 50%")
|
|
|
|
void SetInitialPercentValues(float aPercentVal);
|
2009-02-20 08:29:21 +03:00
|
|
|
|
2014-02-04 05:54:22 +04:00
|
|
|
// Sets both mXPosition and mYPosition to 0 (app units) for the
|
|
|
|
// initial property-value as a length with no percentage component.
|
|
|
|
void SetInitialZeroValues();
|
|
|
|
|
2009-10-23 03:46:08 +04:00
|
|
|
// True if the effective background image position described by this depends
|
|
|
|
// on the size of the corresponding frame.
|
2012-11-08 19:05:32 +04:00
|
|
|
bool DependsOnPositioningAreaSize() const {
|
2010-09-15 19:11:26 +04:00
|
|
|
return mXPosition.mPercent != 0.0f || mYPosition.mPercent != 0.0f;
|
2009-10-23 03:46:08 +04:00
|
|
|
}
|
|
|
|
|
2010-09-15 19:11:26 +04:00
|
|
|
bool operator==(const Position& aOther) const {
|
|
|
|
return mXPosition == aOther.mXPosition &&
|
|
|
|
mYPosition == aOther.mYPosition;
|
2009-02-20 08:29:21 +03:00
|
|
|
}
|
2010-09-15 19:11:26 +04:00
|
|
|
bool operator!=(const Position& aOther) const {
|
2009-02-20 08:29:21 +03:00
|
|
|
return !(*this == aOther);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2009-05-28 22:09:05 +04:00
|
|
|
struct Size;
|
|
|
|
friend struct Size;
|
|
|
|
struct Size {
|
2014-06-19 07:18:03 +04:00
|
|
|
struct Dimension : public nsStyleCoord::CalcValue {
|
2011-01-13 13:40:12 +03:00
|
|
|
nscoord ResolveLengthPercentage(nscoord aAvailable) const {
|
|
|
|
double d = double(mPercent) * double(aAvailable) + double(mLength);
|
|
|
|
if (d < 0.0)
|
|
|
|
return 0;
|
|
|
|
return NSToCoordRoundWithClamp(float(d));
|
|
|
|
}
|
|
|
|
};
|
2009-05-28 22:09:05 +04:00
|
|
|
Dimension mWidth, mHeight;
|
|
|
|
|
2016-01-28 08:28:00 +03:00
|
|
|
bool IsInitialValue() const {
|
|
|
|
return mWidthType == eAuto && mHeightType == eAuto;
|
|
|
|
}
|
|
|
|
|
2011-01-13 13:40:12 +03:00
|
|
|
nscoord ResolveWidthLengthPercentage(const nsSize& aBgPositioningArea) const {
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(mWidthType == eLengthPercentage,
|
|
|
|
"resolving non-length/percent dimension!");
|
2011-01-13 13:40:12 +03:00
|
|
|
return mWidth.ResolveLengthPercentage(aBgPositioningArea.width);
|
|
|
|
}
|
|
|
|
|
|
|
|
nscoord ResolveHeightLengthPercentage(const nsSize& aBgPositioningArea) const {
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(mHeightType == eLengthPercentage,
|
|
|
|
"resolving non-length/percent dimension!");
|
2011-01-13 13:40:12 +03:00
|
|
|
return mHeight.ResolveLengthPercentage(aBgPositioningArea.height);
|
|
|
|
}
|
|
|
|
|
2010-09-15 19:11:26 +04:00
|
|
|
// Except for eLengthPercentage, Dimension types which might change
|
|
|
|
// how a layer is painted when the corresponding frame's dimensions
|
|
|
|
// change *must* precede all dimension types which are agnostic to
|
2012-11-08 19:05:32 +04:00
|
|
|
// frame size; see DependsOnDependsOnPositioningAreaSizeSize.
|
2009-05-28 22:09:05 +04:00
|
|
|
enum DimensionType {
|
|
|
|
// If one of mWidth and mHeight is eContain or eCover, then both are.
|
2014-09-16 21:55:13 +04:00
|
|
|
// NOTE: eContain and eCover *must* be equal to NS_STYLE_BG_SIZE_CONTAIN
|
|
|
|
// and NS_STYLE_BG_SIZE_COVER (in kBackgroundSizeKTable).
|
2009-05-28 22:09:05 +04:00
|
|
|
eContain, eCover,
|
|
|
|
|
2009-10-23 03:46:08 +04:00
|
|
|
eAuto,
|
2010-09-15 19:11:26 +04:00
|
|
|
eLengthPercentage,
|
2009-05-28 22:09:05 +04:00
|
|
|
eDimensionType_COUNT
|
|
|
|
};
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mWidthType, mHeightType;
|
2009-05-28 22:09:05 +04:00
|
|
|
|
2011-01-13 13:40:12 +03:00
|
|
|
// True if the effective image size described by this depends on the size of
|
|
|
|
// the corresponding frame, when aImage (which must not have null type) is
|
|
|
|
// the background image.
|
2012-11-08 19:05:32 +04:00
|
|
|
bool DependsOnPositioningAreaSize(const nsStyleImage& aImage) const;
|
2009-10-23 03:46:08 +04:00
|
|
|
|
2009-05-28 22:09:05 +04:00
|
|
|
// Initialize nothing
|
|
|
|
Size() {}
|
|
|
|
|
|
|
|
// Initialize to initial values
|
|
|
|
void SetInitialValues();
|
|
|
|
|
2010-09-15 19:11:26 +04:00
|
|
|
bool operator==(const Size& aOther) const;
|
|
|
|
bool operator!=(const Size& aOther) const {
|
2009-05-28 22:09:05 +04:00
|
|
|
return !(*this == aOther);
|
|
|
|
}
|
|
|
|
};
|
2015-05-14 20:05:32 +03:00
|
|
|
|
2012-02-25 09:23:14 +04:00
|
|
|
struct Repeat;
|
|
|
|
friend struct Repeat;
|
|
|
|
struct Repeat {
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mXRepeat, mYRepeat;
|
2015-05-14 20:05:32 +03:00
|
|
|
|
2012-02-25 09:23:14 +04:00
|
|
|
// Initialize nothing
|
|
|
|
Repeat() {}
|
|
|
|
|
2016-01-28 08:28:00 +03:00
|
|
|
bool IsInitialValue() const {
|
|
|
|
return mXRepeat == NS_STYLE_IMAGELAYER_REPEAT_REPEAT &&
|
|
|
|
mYRepeat == NS_STYLE_IMAGELAYER_REPEAT_REPEAT;
|
|
|
|
}
|
|
|
|
|
2012-02-25 09:23:14 +04:00
|
|
|
// Initialize to initial values
|
|
|
|
void SetInitialValues();
|
|
|
|
|
|
|
|
bool operator==(const Repeat& aOther) const {
|
|
|
|
return mXRepeat == aOther.mXRepeat &&
|
|
|
|
mYRepeat == aOther.mYRepeat;
|
|
|
|
}
|
|
|
|
bool operator!=(const Repeat& aOther) const {
|
|
|
|
return !(*this == aOther);
|
|
|
|
}
|
|
|
|
};
|
2009-05-28 22:09:05 +04:00
|
|
|
|
2009-02-20 08:29:21 +03:00
|
|
|
struct Layer;
|
|
|
|
friend struct Layer;
|
|
|
|
struct Layer {
|
2016-01-28 08:27:00 +03:00
|
|
|
nsStyleImage mImage; // [reset]
|
2016-01-28 08:37:00 +03:00
|
|
|
nsCOMPtr<nsIURI> mSourceURI; // [reset]
|
|
|
|
// mask-only property
|
|
|
|
// This property is used for mask layer only.
|
|
|
|
// For a background layer, it should always
|
|
|
|
// be the initial value, which is nullptr.
|
|
|
|
// Store mask-image URI so that we can resolve
|
|
|
|
// SVG mask path later.
|
2016-01-28 08:24:00 +03:00
|
|
|
Position mPosition; // [reset] See nsStyleConsts.h
|
|
|
|
Size mSize; // [reset]
|
|
|
|
uint8_t mClip; // [reset] See nsStyleConsts.h
|
|
|
|
uint8_t mOrigin; // [reset] See nsStyleConsts.h
|
|
|
|
uint8_t mAttachment; // [reset] See nsStyleConsts.h
|
|
|
|
// background-only property
|
|
|
|
// This property is used for background layer
|
|
|
|
// only. For a mask layer, it should always
|
|
|
|
// be the initial value, which is
|
2016-01-28 08:28:00 +03:00
|
|
|
// NS_STYLE_IMAGELAYER_ATTACHMENT_SCROLL.
|
2016-01-28 08:24:00 +03:00
|
|
|
uint8_t mBlendMode; // [reset] See nsStyleConsts.h
|
|
|
|
// background-only property
|
|
|
|
// This property is used for background layer
|
|
|
|
// only. For a mask layer, it should always
|
|
|
|
// be the initial value, which is
|
|
|
|
// NS_STYLE_BLEND_NORMAL.
|
2016-01-28 08:28:00 +03:00
|
|
|
uint8_t mComposite; // [reset] See nsStyleConsts.h
|
|
|
|
// mask-only property
|
|
|
|
// This property is used for mask layer only.
|
|
|
|
// For a background layer, it should always
|
|
|
|
// be the initial value, which is
|
|
|
|
// NS_STYLE_COMPOSITE_MODE_ADD.
|
|
|
|
uint8_t mMaskMode; // [reset] See nsStyleConsts.h
|
|
|
|
// mask-only property
|
|
|
|
// This property is used for mask layer only.
|
|
|
|
// For a background layer, it should always
|
|
|
|
// be the initial value, which is
|
2016-02-25 12:31:47 +03:00
|
|
|
// NS_STYLE_MASK_MODE_MATCH_SOURCE.
|
2016-01-28 08:24:00 +03:00
|
|
|
Repeat mRepeat; // [reset] See nsStyleConsts.h
|
2009-02-19 23:33:09 +03:00
|
|
|
|
2009-02-20 08:29:21 +03:00
|
|
|
// Initializes only mImage
|
|
|
|
Layer();
|
|
|
|
~Layer();
|
|
|
|
|
2010-08-06 01:57:18 +04:00
|
|
|
// Register/unregister images with the document. We do this only
|
|
|
|
// after the dust has settled in ComputeBackgroundData.
|
|
|
|
void TrackImages(nsPresContext* aContext) {
|
|
|
|
if (mImage.GetType() == eStyleImageType_Image)
|
|
|
|
mImage.TrackImage(aContext);
|
|
|
|
}
|
|
|
|
void UntrackImages(nsPresContext* aContext) {
|
|
|
|
if (mImage.GetType() == eStyleImageType_Image)
|
|
|
|
mImage.UntrackImage(aContext);
|
|
|
|
}
|
|
|
|
|
2009-12-15 23:08:59 +03:00
|
|
|
// True if the rendering of this layer might change when the size
|
2012-11-08 19:05:32 +04:00
|
|
|
// of the background positioning area changes. This is true for any
|
2009-12-15 23:08:59 +03:00
|
|
|
// non-solid-color background whose position or size depends on
|
2012-11-08 19:05:32 +04:00
|
|
|
// the size of the positioning area. It's also true for SVG images
|
|
|
|
// whose root <svg> node has a viewBox.
|
|
|
|
bool RenderingMightDependOnPositioningAreaSizeChange() const;
|
2009-10-23 03:46:08 +04:00
|
|
|
|
2015-11-02 19:36:35 +03:00
|
|
|
// Compute the change hint required by changes in just this layer.
|
|
|
|
nsChangeHint CalcDifference(const Layer& aOther) const;
|
|
|
|
|
2009-02-20 08:29:21 +03:00
|
|
|
// An equality operator that compares the images using URL-equality
|
|
|
|
// rather than pointer-equality.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool operator==(const Layer& aOther) const;
|
|
|
|
bool operator!=(const Layer& aOther) const {
|
2009-02-20 08:29:21 +03:00
|
|
|
return !(*this == aOther);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// The (positive) number of computed values of each property, since
|
|
|
|
// the lengths of the lists are independent.
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mAttachmentCount,
|
2009-02-20 08:29:21 +03:00
|
|
|
mClipCount,
|
|
|
|
mOriginCount,
|
|
|
|
mRepeatCount,
|
|
|
|
mPositionCount,
|
2009-05-28 22:09:05 +04:00
|
|
|
mImageCount,
|
2013-11-08 19:07:36 +04:00
|
|
|
mSizeCount,
|
2016-01-28 08:28:00 +03:00
|
|
|
mMaskModeCount,
|
|
|
|
mBlendModeCount,
|
|
|
|
mCompositeCount;
|
2016-01-28 08:24:00 +03:00
|
|
|
|
2009-02-20 08:29:21 +03:00
|
|
|
// Layers are stored in an array, matching the top-to-bottom order in
|
|
|
|
// which they are specified in CSS. The number of layers to be used
|
|
|
|
// should come from the background-image property. We create
|
|
|
|
// additional |Layer| objects for *any* property, not just
|
|
|
|
// background-image. This means that the bottommost layer that
|
|
|
|
// callers in layout care about (which is also the one whose
|
|
|
|
// background-clip applies to the background-color) may not be last
|
|
|
|
// layer. In layers below the bottom layer, properties will be
|
2009-05-28 22:09:05 +04:00
|
|
|
// uninitialized unless their count, above, indicates that they are
|
2009-02-20 08:29:21 +03:00
|
|
|
// present.
|
2016-02-02 18:36:30 +03:00
|
|
|
AutoTArray<Layer, 1> mLayers;
|
2009-02-20 08:29:21 +03:00
|
|
|
|
|
|
|
const Layer& BottomLayer() const { return mLayers[mImageCount - 1]; }
|
|
|
|
|
2016-01-28 08:24:00 +03:00
|
|
|
void TrackImages(nsPresContext* aContext) {
|
|
|
|
for (uint32_t i = 0; i < mImageCount; ++i) {
|
|
|
|
mLayers[i].TrackImages(aContext);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void UntrackImages(nsPresContext* aContext) {
|
|
|
|
for (uint32_t i = 0; i < mImageCount; ++i)
|
|
|
|
mLayers[i].UntrackImages(aContext);
|
|
|
|
}
|
2016-01-28 08:28:00 +03:00
|
|
|
|
|
|
|
nsChangeHint CalcDifference(const nsStyleImageLayers& aOther) const;
|
|
|
|
|
|
|
|
bool HasLayerWithImage() const;
|
|
|
|
|
|
|
|
static const nsCSSProperty kBackgroundLayerTable[];
|
|
|
|
static const nsCSSProperty kMaskLayerTable[];
|
|
|
|
|
2016-01-28 08:24:00 +03:00
|
|
|
#define NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(var_, layers_) \
|
|
|
|
for (uint32_t var_ = (layers_).mImageCount; var_-- != 0; )
|
|
|
|
#define NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT_WITH_RANGE(var_, layers_, start_, count_) \
|
|
|
|
NS_ASSERTION((int32_t)(start_) >= 0 && (uint32_t)(start_) < (layers_).mImageCount, "Invalid layer start!"); \
|
2012-09-13 14:34:23 +04:00
|
|
|
NS_ASSERTION((count_) > 0 && (count_) <= (start_) + 1, "Invalid layer range!"); \
|
|
|
|
for (uint32_t var_ = (start_) + 1; var_-- != (uint32_t)((start_) + 1 - (count_)); )
|
2016-01-28 08:24:00 +03:00
|
|
|
};
|
2003-01-19 05:36:04 +03:00
|
|
|
|
2016-01-28 08:24:00 +03:00
|
|
|
struct nsStyleBackground {
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStyleBackground(StyleStructContext aContext);
|
2016-01-28 08:24:00 +03:00
|
|
|
nsStyleBackground(const nsStyleBackground& aOther);
|
|
|
|
~nsStyleBackground();
|
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStyleBackground* aSelf) CPP_THROW_NEW { return aSelf; }
|
2016-01-28 08:24:00 +03:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
|
|
|
return aContext->PresShell()->
|
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStyleBackground, sz);
|
|
|
|
}
|
|
|
|
void Destroy(nsPresContext* aContext);
|
|
|
|
|
|
|
|
nsChangeHint CalcDifference(const nsStyleBackground& aOther) const;
|
|
|
|
static nsChangeHint MaxDifference() {
|
|
|
|
return nsChangeHint_UpdateEffects |
|
|
|
|
nsChangeHint_RepaintFrame |
|
|
|
|
nsChangeHint_SchedulePaint |
|
|
|
|
nsChangeHint_NeutralChange;
|
|
|
|
}
|
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
|
|
|
// CalcDifference never returns the reflow hints that are sometimes
|
|
|
|
// handled for descendants at all.
|
|
|
|
return nsChangeHint(0);
|
|
|
|
}
|
2009-02-20 08:29:21 +03:00
|
|
|
|
2008-09-12 19:35:53 +04:00
|
|
|
// True if this background is completely transparent.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsTransparent() const;
|
2004-09-13 09:39:27 +04:00
|
|
|
|
2004-09-14 00:40:46 +04:00
|
|
|
// We have to take slower codepaths for fixed background attachment,
|
|
|
|
// but we don't want to do that when there's no image.
|
|
|
|
// Not inline because it uses an nsCOMPtr<imgIRequest>
|
2008-07-17 10:30:25 +04:00
|
|
|
// FIXME: Should be in nsStyleStructInlines.h.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool HasFixedBackground() const;
|
2016-01-28 08:24:00 +03:00
|
|
|
|
2016-01-28 08:39:00 +03:00
|
|
|
const nsStyleImageLayers::Layer& BottomLayer() const { return mImage.BottomLayer(); }
|
2016-01-28 08:24:00 +03:00
|
|
|
|
2016-01-28 08:39:00 +03:00
|
|
|
nsStyleImageLayers mImage;
|
2016-01-28 08:24:00 +03:00
|
|
|
nscolor mBackgroundColor; // [reset]
|
2001-06-01 02:19:43 +04:00
|
|
|
};
|
|
|
|
|
2008-09-13 07:45:37 +04:00
|
|
|
// See https://bugzilla.mozilla.org/show_bug.cgi?id=271586#c43 for why
|
|
|
|
// this is hard to replace with 'currentColor'.
|
2001-06-01 02:19:43 +04:00
|
|
|
#define BORDER_COLOR_FOREGROUND 0x20
|
2007-03-15 19:16:20 +03:00
|
|
|
#define OUTLINE_COLOR_INITIAL 0x80
|
2008-09-12 19:35:53 +04:00
|
|
|
// FOREGROUND | INITIAL(OUTLINE)
|
|
|
|
#define BORDER_COLOR_SPECIAL 0xA0
|
2001-06-01 02:19:43 +04:00
|
|
|
#define BORDER_STYLE_MASK 0x1F
|
|
|
|
|
|
|
|
#define NS_SPACING_MARGIN 0
|
|
|
|
#define NS_SPACING_PADDING 1
|
|
|
|
#define NS_SPACING_BORDER 2
|
|
|
|
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleMargin
|
|
|
|
{
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStyleMargin(StyleStructContext aContext);
|
2001-06-01 02:19:43 +04:00
|
|
|
nsStyleMargin(const nsStyleMargin& aMargin);
|
2009-08-07 18:38:44 +04:00
|
|
|
~nsStyleMargin(void) {
|
|
|
|
MOZ_COUNT_DTOR(nsStyleMargin);
|
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStyleMargin* aSelf) CPP_THROW_NEW { return aSelf; }
|
2014-07-16 09:27:12 +04:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
2014-07-16 09:27:13 +04:00
|
|
|
return aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStyleMargin, sz);
|
2014-07-16 09:27:12 +04:00
|
|
|
}
|
2004-08-01 03:15:21 +04:00
|
|
|
void Destroy(nsPresContext* aContext);
|
2001-06-01 02:19:43 +04:00
|
|
|
|
|
|
|
void RecalcData();
|
2002-08-24 18:41:28 +04:00
|
|
|
nsChangeHint CalcDifference(const nsStyleMargin& aOther) const;
|
2012-09-07 21:13:36 +04:00
|
|
|
static nsChangeHint MaxDifference() {
|
2015-06-21 07:54:15 +03:00
|
|
|
return nsChangeHint_NeedReflow |
|
|
|
|
nsChangeHint_ReflowChangesSizeOrPosition |
|
|
|
|
nsChangeHint_ClearAncestorIntrinsics;
|
2012-09-07 21:13:36 +04:00
|
|
|
}
|
2015-06-21 07:54:15 +03:00
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
2015-06-21 07:54:15 +03:00
|
|
|
// CalcDifference can return all of the reflow hints sometimes not
|
|
|
|
// handled for descendants as hints not handled for descendants.
|
2014-01-03 06:39:54 +04:00
|
|
|
return nsChangeHint(0);
|
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2010-08-31 20:05:12 +04:00
|
|
|
nsStyleSides mMargin; // [reset] coord, percent, calc, auto
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsWidthDependent() const { return !mHasCachedMargin; }
|
|
|
|
bool GetMargin(nsMargin& aMargin) const
|
2001-06-01 02:19:43 +04:00
|
|
|
{
|
|
|
|
if (mHasCachedMargin) {
|
|
|
|
aMargin = mCachedMargin;
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mHasCachedMargin;
|
2001-06-01 02:19:43 +04:00
|
|
|
nsMargin mCachedMargin;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStylePadding
|
|
|
|
{
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStylePadding(StyleStructContext aContext);
|
2001-06-01 02:19:43 +04:00
|
|
|
nsStylePadding(const nsStylePadding& aPadding);
|
2009-08-07 18:38:44 +04:00
|
|
|
~nsStylePadding(void) {
|
|
|
|
MOZ_COUNT_DTOR(nsStylePadding);
|
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStylePadding* aSelf) CPP_THROW_NEW { return aSelf; }
|
2014-07-16 09:27:12 +04:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
2014-07-16 09:27:13 +04:00
|
|
|
return aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStylePadding, sz);
|
2014-07-16 09:27:12 +04:00
|
|
|
}
|
2004-08-01 03:15:21 +04:00
|
|
|
void Destroy(nsPresContext* aContext);
|
2001-06-01 02:19:43 +04:00
|
|
|
|
|
|
|
void RecalcData();
|
2002-08-24 18:41:28 +04:00
|
|
|
nsChangeHint CalcDifference(const nsStylePadding& aOther) const;
|
2012-09-07 21:13:36 +04:00
|
|
|
static nsChangeHint MaxDifference() {
|
|
|
|
return NS_SubtractHint(NS_STYLE_HINT_REFLOW,
|
|
|
|
nsChangeHint_ClearDescendantIntrinsics);
|
|
|
|
}
|
2015-06-21 07:54:15 +03:00
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
2015-06-21 07:54:15 +03:00
|
|
|
// CalcDifference can return nsChangeHint_ClearAncestorIntrinsics as
|
|
|
|
// a hint not handled for descendants. We could (and perhaps
|
|
|
|
// should) return nsChangeHint_NeedReflow and
|
|
|
|
// nsChangeHint_ReflowChangesSizeOrPosition as always handled for
|
|
|
|
// descendants, but since they're always returned in conjunction
|
|
|
|
// with nsChangeHint_ClearAncestorIntrinsics (which is not), it
|
|
|
|
// won't ever lead to any optimization in
|
|
|
|
// nsStyleContext::CalcStyleDifference.
|
2014-01-03 06:39:54 +04:00
|
|
|
return nsChangeHint(0);
|
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2010-08-31 20:05:12 +04:00
|
|
|
nsStyleSides mPadding; // [reset] coord, percent, calc
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsWidthDependent() const { return !mHasCachedPadding; }
|
|
|
|
bool GetPadding(nsMargin& aPadding) const
|
2001-06-01 02:19:43 +04:00
|
|
|
{
|
|
|
|
if (mHasCachedPadding) {
|
|
|
|
aPadding = mCachedPadding;
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mHasCachedPadding;
|
2001-06-01 02:19:43 +04:00
|
|
|
nsMargin mCachedPadding;
|
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsBorderColors
|
|
|
|
{
|
2001-12-05 11:35:05 +03:00
|
|
|
nsBorderColors* mNext;
|
|
|
|
nscolor mColor;
|
2001-12-11 14:13:16 +03:00
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
nsBorderColors() : mNext(nullptr), mColor(NS_RGB(0,0,0)) {}
|
2014-08-08 03:48:38 +04:00
|
|
|
explicit nsBorderColors(const nscolor& aColor) : mNext(nullptr), mColor(aColor) {}
|
2008-10-17 12:13:16 +04:00
|
|
|
~nsBorderColors();
|
2001-12-05 11:35:05 +03:00
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
nsBorderColors* Clone() const { return Clone(true); }
|
2001-12-19 14:59:31 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool Equal(const nsBorderColors* c1,
|
2008-09-12 19:35:53 +04:00
|
|
|
const nsBorderColors* c2) {
|
|
|
|
if (c1 == c2)
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2001-12-19 14:59:31 +03:00
|
|
|
while (c1 && c2) {
|
2008-09-12 19:35:53 +04:00
|
|
|
if (c1->mColor != c2->mColor)
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2001-12-19 14:59:31 +03:00
|
|
|
c1 = c1->mNext;
|
|
|
|
c2 = c2->mNext;
|
|
|
|
}
|
2013-10-08 22:47:21 +04:00
|
|
|
// both should be nullptr if these are equal, otherwise one
|
2008-09-12 19:35:53 +04:00
|
|
|
// has more colors than another
|
2001-12-19 14:59:31 +03:00
|
|
|
return !c1 && !c2;
|
|
|
|
}
|
2008-10-17 12:13:16 +04:00
|
|
|
|
|
|
|
private:
|
2011-09-29 10:19:26 +04:00
|
|
|
nsBorderColors* Clone(bool aDeep) const;
|
2001-12-05 11:35:05 +03:00
|
|
|
};
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsCSSShadowItem
|
|
|
|
{
|
2008-09-13 07:45:37 +04:00
|
|
|
nscoord mXOffset;
|
|
|
|
nscoord mYOffset;
|
|
|
|
nscoord mRadius;
|
|
|
|
nscoord mSpread;
|
2008-07-08 04:56:52 +04:00
|
|
|
|
|
|
|
nscolor mColor;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mHasColor; // Whether mColor should be used
|
|
|
|
bool mInset;
|
2008-07-08 04:56:52 +04:00
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
nsCSSShadowItem() : mHasColor(false) {
|
2008-07-08 04:56:52 +04:00
|
|
|
MOZ_COUNT_CTOR(nsCSSShadowItem);
|
|
|
|
}
|
|
|
|
~nsCSSShadowItem() {
|
|
|
|
MOZ_COUNT_DTOR(nsCSSShadowItem);
|
|
|
|
}
|
|
|
|
|
2013-08-05 11:02:27 +04:00
|
|
|
bool operator==(const nsCSSShadowItem& aOther) const {
|
2008-07-08 04:56:52 +04:00
|
|
|
return (mXOffset == aOther.mXOffset &&
|
|
|
|
mYOffset == aOther.mYOffset &&
|
|
|
|
mRadius == aOther.mRadius &&
|
|
|
|
mHasColor == aOther.mHasColor &&
|
|
|
|
mSpread == aOther.mSpread &&
|
2009-02-10 11:45:13 +03:00
|
|
|
mInset == aOther.mInset &&
|
2008-07-08 04:56:52 +04:00
|
|
|
(!mHasColor || mColor == aOther.mColor));
|
|
|
|
}
|
2013-08-05 11:02:27 +04:00
|
|
|
bool operator!=(const nsCSSShadowItem& aOther) const {
|
2008-07-08 04:56:52 +04:00
|
|
|
return !(*this == aOther);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
class nsCSSShadowArray final
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void* operator new(size_t aBaseSize, uint32_t aArrayLen) {
|
|
|
|
// We can allocate both this nsCSSShadowArray and the
|
|
|
|
// actual array in one allocation. The amount of memory to
|
|
|
|
// allocate is equal to the class's size + the number of bytes for all
|
|
|
|
// but the first array item (because aBaseSize includes one
|
|
|
|
// item, see the private declarations)
|
|
|
|
return ::operator new(aBaseSize +
|
|
|
|
(aArrayLen - 1) * sizeof(nsCSSShadowItem));
|
|
|
|
}
|
|
|
|
|
|
|
|
explicit nsCSSShadowArray(uint32_t aArrayLen) :
|
|
|
|
mLength(aArrayLen)
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(nsCSSShadowArray);
|
|
|
|
for (uint32_t i = 1; i < mLength; ++i) {
|
|
|
|
// Make sure we call the constructors of each nsCSSShadowItem
|
|
|
|
// (the first one is called for us because we declared it under private)
|
|
|
|
new (&mArray[i]) nsCSSShadowItem();
|
2008-07-08 04:56:52 +04:00
|
|
|
}
|
2016-01-11 02:28:35 +03:00
|
|
|
}
|
2014-03-21 05:16:20 +04:00
|
|
|
|
|
|
|
private:
|
2016-01-11 02:28:35 +03:00
|
|
|
// Private destructor, to discourage deletion outside of Release():
|
|
|
|
~nsCSSShadowArray() {
|
|
|
|
MOZ_COUNT_DTOR(nsCSSShadowArray);
|
|
|
|
for (uint32_t i = 1; i < mLength; ++i) {
|
|
|
|
mArray[i].~nsCSSShadowItem();
|
2008-07-08 04:56:52 +04:00
|
|
|
}
|
2016-01-11 02:28:35 +03:00
|
|
|
}
|
2008-07-08 04:56:52 +04:00
|
|
|
|
2014-03-21 05:16:20 +04:00
|
|
|
public:
|
2016-01-11 02:28:35 +03:00
|
|
|
uint32_t Length() const { return mLength; }
|
|
|
|
nsCSSShadowItem* ShadowAt(uint32_t i) {
|
|
|
|
MOZ_ASSERT(i < mLength, "Accessing too high an index in the text shadow array!");
|
|
|
|
return &mArray[i];
|
|
|
|
}
|
|
|
|
const nsCSSShadowItem* ShadowAt(uint32_t i) const {
|
|
|
|
MOZ_ASSERT(i < mLength, "Accessing too high an index in the text shadow array!");
|
|
|
|
return &mArray[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
bool HasShadowWithInset(bool aInset) {
|
|
|
|
for (uint32_t i = 0; i < mLength; ++i) {
|
|
|
|
if (mArray[i].mInset == aInset)
|
|
|
|
return true;
|
2008-07-08 04:56:52 +04:00
|
|
|
}
|
2016-01-11 02:28:35 +03:00
|
|
|
return false;
|
|
|
|
}
|
2008-07-08 04:56:52 +04:00
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
bool operator==(const nsCSSShadowArray& aOther) const {
|
|
|
|
if (mLength != aOther.Length())
|
2012-04-16 09:43:33 +04:00
|
|
|
return false;
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
for (uint32_t i = 0; i < mLength; ++i) {
|
|
|
|
if (ShadowAt(i) != aOther.ShadowAt(i))
|
2013-08-05 11:02:27 +04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_INLINE_DECL_REFCOUNTING(nsCSSShadowArray)
|
2010-04-01 22:05:40 +04:00
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
private:
|
|
|
|
uint32_t mLength;
|
|
|
|
nsCSSShadowItem mArray[1]; // This MUST be the last item
|
2008-07-08 04:56:52 +04:00
|
|
|
};
|
|
|
|
|
2008-03-25 07:55:47 +03:00
|
|
|
// Border widths are rounded to the nearest-below integer number of pixels,
|
|
|
|
// but values between zero and one device pixels are always rounded up to
|
|
|
|
// one device pixel.
|
2006-12-27 17:21:43 +03:00
|
|
|
#define NS_ROUND_BORDER_TO_PIXELS(l,tpp) \
|
2013-01-15 16:22:03 +04:00
|
|
|
((l) == 0) ? 0 : std::max((tpp), (l) / (tpp) * (tpp))
|
2007-02-09 00:04:54 +03:00
|
|
|
// Outline offset is rounded to the nearest integer number of pixels, but values
|
|
|
|
// between zero and one device pixels are always rounded up to one device pixel.
|
|
|
|
// Note that the offset can be negative.
|
|
|
|
#define NS_ROUND_OFFSET_TO_PIXELS(l,tpp) \
|
|
|
|
(((l) == 0) ? 0 : \
|
2013-01-15 16:22:03 +04:00
|
|
|
((l) > 0) ? std::max( (tpp), ((l) + ((tpp) / 2)) / (tpp) * (tpp)) : \
|
|
|
|
std::min(-(tpp), ((l) - ((tpp) / 2)) / (tpp) * (tpp)))
|
2006-12-27 17:21:43 +03:00
|
|
|
|
2008-07-19 14:38:25 +04:00
|
|
|
// Returns if the given border style type is visible or not
|
2012-08-22 19:56:38 +04:00
|
|
|
static bool IsVisibleBorderStyle(uint8_t aStyle)
|
2008-07-19 14:38:25 +04:00
|
|
|
{
|
|
|
|
return (aStyle != NS_STYLE_BORDER_STYLE_NONE &&
|
|
|
|
aStyle != NS_STYLE_BORDER_STYLE_HIDDEN);
|
|
|
|
}
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleBorder
|
|
|
|
{
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStyleBorder(StyleStructContext aContext);
|
2001-06-01 02:19:43 +04:00
|
|
|
nsStyleBorder(const nsStyleBorder& aBorder);
|
2008-07-17 10:30:25 +04:00
|
|
|
~nsStyleBorder();
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStyleBorder* aSelf) CPP_THROW_NEW { return aSelf; }
|
2014-07-16 09:27:12 +04:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
2014-07-16 09:27:13 +04:00
|
|
|
return aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStyleBorder, sz);
|
2014-07-16 09:27:12 +04:00
|
|
|
}
|
2004-08-01 03:15:21 +04:00
|
|
|
void Destroy(nsPresContext* aContext);
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2002-08-24 18:41:28 +04:00
|
|
|
nsChangeHint CalcDifference(const nsStyleBorder& aOther) const;
|
2012-09-07 21:13:36 +04:00
|
|
|
static nsChangeHint MaxDifference() {
|
2015-10-02 06:05:28 +03:00
|
|
|
return NS_STYLE_HINT_REFLOW |
|
|
|
|
nsChangeHint_UpdateOverflow |
|
|
|
|
nsChangeHint_BorderStyleNoneChange |
|
|
|
|
nsChangeHint_NeutralChange;
|
2012-09-07 21:13:36 +04:00
|
|
|
}
|
2015-06-21 07:54:15 +03:00
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
2015-06-21 07:54:15 +03:00
|
|
|
// CalcDifference never returns the reflow hints that are sometimes
|
|
|
|
// handled for descendants as hints not handled for descendants.
|
|
|
|
return nsChangeHint_NeedReflow |
|
|
|
|
nsChangeHint_ReflowChangesSizeOrPosition |
|
|
|
|
nsChangeHint_ClearAncestorIntrinsics;
|
2014-01-03 06:39:54 +04:00
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2001-12-05 11:35:05 +03:00
|
|
|
void EnsureBorderColors() {
|
|
|
|
if (!mBorderColors) {
|
|
|
|
mBorderColors = new nsBorderColors*[4];
|
|
|
|
if (mBorderColors)
|
2012-08-22 19:56:38 +04:00
|
|
|
for (int32_t i = 0; i < 4; i++)
|
2012-07-30 18:20:58 +04:00
|
|
|
mBorderColors[i] = nullptr;
|
2001-12-05 11:35:05 +03:00
|
|
|
}
|
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2010-04-27 20:15:02 +04:00
|
|
|
void ClearBorderColors(mozilla::css::Side aSide) {
|
2008-12-23 17:06:56 +03:00
|
|
|
if (mBorderColors && mBorderColors[aSide]) {
|
2001-12-11 14:13:16 +03:00
|
|
|
delete mBorderColors[aSide];
|
2012-07-30 18:20:58 +04:00
|
|
|
mBorderColors[aSide] = nullptr;
|
2001-12-11 14:13:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-29 19:44:38 +04:00
|
|
|
// Return whether aStyle is a visible style. Invisible styles cause
|
|
|
|
// the relevant computed border width to be 0.
|
2008-07-17 10:30:25 +04:00
|
|
|
// Note that this does *not* consider the effects of 'border-image':
|
|
|
|
// if border-style is none, but there is a loaded border image,
|
|
|
|
// HasVisibleStyle will be false even though there *is* a border.
|
2012-09-07 21:13:36 +04:00
|
|
|
bool HasVisibleStyle(mozilla::css::Side aSide) const
|
2008-07-17 10:30:25 +04:00
|
|
|
{
|
2008-07-19 14:38:25 +04:00
|
|
|
return IsVisibleBorderStyle(GetBorderStyle(aSide));
|
2008-07-17 09:59:14 +04:00
|
|
|
}
|
2005-04-29 19:44:38 +04:00
|
|
|
|
|
|
|
// aBorderWidth is in twips
|
2010-04-27 20:15:02 +04:00
|
|
|
void SetBorderWidth(mozilla::css::Side aSide, nscoord aBorderWidth)
|
2008-07-17 09:59:14 +04:00
|
|
|
{
|
2008-07-17 10:30:25 +04:00
|
|
|
nscoord roundedWidth =
|
|
|
|
NS_ROUND_BORDER_TO_PIXELS(aBorderWidth, mTwipsPerPixel);
|
2011-04-19 07:07:22 +04:00
|
|
|
mBorder.Side(aSide) = roundedWidth;
|
2008-07-17 10:30:25 +04:00
|
|
|
if (HasVisibleStyle(aSide))
|
2011-04-19 07:07:22 +04:00
|
|
|
mComputedBorder.Side(aSide) = roundedWidth;
|
2008-07-17 10:30:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Get the computed border (plus rounding). This does consider the
|
|
|
|
// effects of 'border-style: none', but does not consider
|
|
|
|
// 'border-image'.
|
|
|
|
const nsMargin& GetComputedBorder() const
|
2005-04-29 19:44:38 +04:00
|
|
|
{
|
2008-07-17 10:30:25 +04:00
|
|
|
return mComputedBorder;
|
2005-04-29 19:44:38 +04:00
|
|
|
}
|
|
|
|
|
2012-04-18 09:14:31 +04:00
|
|
|
bool HasBorder() const
|
|
|
|
{
|
2014-01-31 07:36:41 +04:00
|
|
|
return mComputedBorder != nsMargin(0,0,0,0) || !mBorderImageSource.IsEmpty();
|
2012-04-18 09:14:31 +04:00
|
|
|
}
|
|
|
|
|
2009-05-08 05:52:22 +04:00
|
|
|
// Get the actual border width for a particular side, in appunits. Note that
|
2005-04-29 19:44:38 +04:00
|
|
|
// this is zero if and only if there is no border to be painted for this
|
2006-12-27 17:21:43 +03:00
|
|
|
// side. That is, this value takes into account the border style and the
|
|
|
|
// value is rounded to the nearest device pixel by NS_ROUND_BORDER_TO_PIXELS.
|
2012-05-31 09:19:49 +04:00
|
|
|
nscoord GetComputedBorderWidth(mozilla::css::Side aSide) const
|
2005-04-29 19:44:38 +04:00
|
|
|
{
|
2012-05-31 09:19:49 +04:00
|
|
|
return GetComputedBorder().Side(aSide);
|
2006-12-27 17:21:43 +03:00
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t GetBorderStyle(mozilla::css::Side aSide) const
|
2001-06-01 02:19:43 +04:00
|
|
|
{
|
2010-04-27 20:15:01 +04:00
|
|
|
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
|
|
|
return (mBorderStyle[aSide] & BORDER_STYLE_MASK);
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void SetBorderStyle(mozilla::css::Side aSide, uint8_t aStyle)
|
2008-07-17 09:59:14 +04:00
|
|
|
{
|
2010-04-27 20:15:01 +04:00
|
|
|
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
|
|
|
mBorderStyle[aSide] &= ~BORDER_STYLE_MASK;
|
2008-07-17 09:59:14 +04:00
|
|
|
mBorderStyle[aSide] |= (aStyle & BORDER_STYLE_MASK);
|
2011-04-19 07:07:22 +04:00
|
|
|
mComputedBorder.Side(aSide) =
|
|
|
|
(HasVisibleStyle(aSide) ? mBorder.Side(aSide) : 0);
|
2008-07-17 09:59:14 +04:00
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2014-01-31 07:36:41 +04:00
|
|
|
inline bool IsBorderImageLoaded() const
|
|
|
|
{
|
|
|
|
return mBorderImageSource.IsLoaded();
|
|
|
|
}
|
|
|
|
|
2010-04-27 20:15:02 +04:00
|
|
|
void GetBorderColor(mozilla::css::Side aSide, nscolor& aColor,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool& aForeground) const
|
2001-06-01 02:19:43 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
aForeground = false;
|
2010-04-27 20:15:01 +04:00
|
|
|
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
2001-06-01 02:19:43 +04:00
|
|
|
if ((mBorderStyle[aSide] & BORDER_COLOR_SPECIAL) == 0)
|
2010-04-27 20:15:01 +04:00
|
|
|
aColor = mBorderColor[aSide];
|
2001-06-01 02:19:43 +04:00
|
|
|
else if (mBorderStyle[aSide] & BORDER_COLOR_FOREGROUND)
|
2011-10-17 18:59:28 +04:00
|
|
|
aForeground = true;
|
2001-06-01 02:19:43 +04:00
|
|
|
else
|
2008-09-12 19:35:53 +04:00
|
|
|
NS_NOTREACHED("OUTLINE_COLOR_INITIAL should not be set here");
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
|
|
|
|
2010-04-27 20:15:02 +04:00
|
|
|
void SetBorderColor(mozilla::css::Side aSide, nscolor aColor)
|
2001-06-01 02:19:43 +04:00
|
|
|
{
|
2010-04-27 20:15:01 +04:00
|
|
|
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
|
|
|
mBorderColor[aSide] = aColor;
|
2001-06-01 02:19:43 +04:00
|
|
|
mBorderStyle[aSide] &= ~BORDER_COLOR_SPECIAL;
|
|
|
|
}
|
|
|
|
|
2014-01-31 07:36:41 +04:00
|
|
|
void TrackImage(nsPresContext* aContext)
|
|
|
|
{
|
|
|
|
if (mBorderImageSource.GetType() == eStyleImageType_Image) {
|
|
|
|
mBorderImageSource.TrackImage(aContext);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void UntrackImage(nsPresContext* aContext)
|
|
|
|
{
|
|
|
|
if (mBorderImageSource.GetType() == eStyleImageType_Image) {
|
|
|
|
mBorderImageSource.UntrackImage(aContext);
|
|
|
|
}
|
|
|
|
}
|
2010-09-08 04:30:40 +04:00
|
|
|
|
2011-12-23 03:34:45 +04:00
|
|
|
nsMargin GetImageOutset() const;
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void GetCompositeColors(int32_t aIndex, nsBorderColors** aColors) const
|
2001-12-05 11:35:05 +03:00
|
|
|
{
|
|
|
|
if (!mBorderColors)
|
2012-07-30 18:20:58 +04:00
|
|
|
*aColors = nullptr;
|
2001-12-05 11:35:05 +03:00
|
|
|
else
|
|
|
|
*aColors = mBorderColors[aIndex];
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void AppendBorderColor(int32_t aIndex, nscolor aColor)
|
2001-12-05 11:35:05 +03:00
|
|
|
{
|
|
|
|
NS_ASSERTION(aIndex >= 0 && aIndex <= 3, "bad side for composite border color");
|
2008-09-12 19:35:53 +04:00
|
|
|
nsBorderColors* colorEntry = new nsBorderColors(aColor);
|
2001-12-05 11:35:05 +03:00
|
|
|
if (!mBorderColors[aIndex])
|
|
|
|
mBorderColors[aIndex] = colorEntry;
|
|
|
|
else {
|
|
|
|
nsBorderColors* last = mBorderColors[aIndex];
|
|
|
|
while (last->mNext)
|
|
|
|
last = last->mNext;
|
|
|
|
last->mNext = colorEntry;
|
|
|
|
}
|
|
|
|
mBorderStyle[aIndex] &= ~BORDER_COLOR_SPECIAL;
|
|
|
|
}
|
|
|
|
|
2010-04-27 20:15:02 +04:00
|
|
|
void SetBorderToForeground(mozilla::css::Side aSide)
|
2001-06-01 02:19:43 +04:00
|
|
|
{
|
2010-04-27 20:15:01 +04:00
|
|
|
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
2001-06-01 02:19:43 +04:00
|
|
|
mBorderStyle[aSide] &= ~BORDER_COLOR_SPECIAL;
|
2010-04-27 20:15:01 +04:00
|
|
|
mBorderStyle[aSide] |= BORDER_COLOR_FOREGROUND;
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
|
|
|
|
2014-01-31 07:36:41 +04:00
|
|
|
imgIRequest* GetBorderImageRequest() const
|
|
|
|
{
|
|
|
|
if (mBorderImageSource.GetType() == eStyleImageType_Image) {
|
|
|
|
return mBorderImageSource.GetImageData();
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2011-12-23 03:34:45 +04:00
|
|
|
public:
|
|
|
|
nsBorderColors** mBorderColors; // [reset] composite (stripe) colors
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsCSSShadowArray> mBoxShadow; // [reset] nullptr for 'none'
|
2011-12-23 03:34:45 +04:00
|
|
|
|
|
|
|
public:
|
|
|
|
nsStyleCorners mBorderRadius; // [reset] coord, percent
|
2014-01-31 07:36:41 +04:00
|
|
|
nsStyleImage mBorderImageSource; // [reset]
|
2011-12-23 03:34:45 +04:00
|
|
|
nsStyleSides mBorderImageSlice; // [reset] factor, percent
|
|
|
|
nsStyleSides mBorderImageWidth; // [reset] length, factor, percent, auto
|
|
|
|
nsStyleSides mBorderImageOutset; // [reset] length, factor
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mBorderImageFill; // [reset]
|
|
|
|
uint8_t mBorderImageRepeatH; // [reset] see nsStyleConsts.h
|
|
|
|
uint8_t mBorderImageRepeatV; // [reset]
|
|
|
|
uint8_t mFloatEdge; // [reset]
|
2014-05-05 21:55:53 +04:00
|
|
|
uint8_t mBoxDecorationBreak; // [reset] see nsStyleConsts.h
|
2011-12-23 03:34:45 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// mComputedBorder holds the CSS2.1 computed border-width values.
|
|
|
|
// In particular, these widths take into account the border-style
|
|
|
|
// for the relevant side, and the values are rounded to the nearest
|
|
|
|
// device pixel (which is not part of the definition of computed
|
|
|
|
// values). The presence or absence of a border-image does not
|
|
|
|
// affect border-width values.
|
2008-07-17 10:30:25 +04:00
|
|
|
nsMargin mComputedBorder;
|
2005-04-29 19:44:38 +04:00
|
|
|
|
2011-12-23 03:34:45 +04:00
|
|
|
// mBorder holds the nscoord values for the border widths as they
|
|
|
|
// would be if all the border-style values were visible (not hidden
|
|
|
|
// or none). This member exists so that when we create structs
|
|
|
|
// using the copy constructor during style resolution the new
|
|
|
|
// structs will know what the specified values of the border were in
|
|
|
|
// case they have more specific rules setting the border style.
|
|
|
|
//
|
|
|
|
// Note that this isn't quite the CSS specified value, since this
|
|
|
|
// has had the enumerated border widths converted to lengths, and
|
|
|
|
// all lengths converted to twips. But it's not quite the computed
|
|
|
|
// value either. The values are rounded to the nearest device pixel.
|
2005-04-29 19:44:38 +04:00
|
|
|
nsMargin mBorder;
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mBorderStyle[4]; // [reset] See nsStyleConsts.h
|
2011-12-23 03:34:45 +04:00
|
|
|
nscolor mBorderColor[4]; // [reset] the colors to use for a simple
|
|
|
|
// border. not used for -moz-border-colors
|
2009-12-11 07:02:13 +03:00
|
|
|
private:
|
2006-12-27 17:21:43 +03:00
|
|
|
nscoord mTwipsPerPixel;
|
2010-09-08 04:30:40 +04:00
|
|
|
|
2015-01-07 02:35:02 +03:00
|
|
|
nsStyleBorder& operator=(const nsStyleBorder& aOther) = delete;
|
2001-06-01 02:19:43 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleOutline
|
|
|
|
{
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStyleOutline(StyleStructContext aContext);
|
2001-06-01 02:19:43 +04:00
|
|
|
nsStyleOutline(const nsStyleOutline& aOutline);
|
2009-08-07 18:38:44 +04:00
|
|
|
~nsStyleOutline(void) {
|
|
|
|
MOZ_COUNT_DTOR(nsStyleOutline);
|
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStyleOutline* aSelf) CPP_THROW_NEW { return aSelf; }
|
2004-08-01 03:15:21 +04:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
2014-07-16 09:27:13 +04:00
|
|
|
return aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStyleOutline, sz);
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
2004-08-01 03:15:21 +04:00
|
|
|
void Destroy(nsPresContext* aContext) {
|
2001-06-02 01:04:23 +04:00
|
|
|
this->~nsStyleOutline();
|
2014-07-16 09:27:13 +04:00
|
|
|
aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
FreeByObjectID(mozilla::eArenaObjectID_nsStyleOutline, this);
|
2007-04-23 18:21:53 +04:00
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2004-11-26 21:40:58 +03:00
|
|
|
void RecalcData(nsPresContext* aContext);
|
2002-08-24 18:41:28 +04:00
|
|
|
nsChangeHint CalcDifference(const nsStyleOutline& aOther) const;
|
2012-09-07 21:13:36 +04:00
|
|
|
static nsChangeHint MaxDifference() {
|
2015-02-17 21:45:00 +03:00
|
|
|
return NS_CombineHint(NS_CombineHint(nsChangeHint_UpdateOverflow,
|
|
|
|
nsChangeHint_SchedulePaint),
|
2014-09-05 07:48:43 +04:00
|
|
|
NS_CombineHint(nsChangeHint_RepaintFrame,
|
|
|
|
nsChangeHint_NeutralChange));
|
2012-09-07 21:13:36 +04:00
|
|
|
}
|
2015-06-21 07:54:15 +03:00
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
2015-06-21 07:54:15 +03:00
|
|
|
// CalcDifference never returns the reflow hints that are sometimes
|
|
|
|
// handled for descendants at all.
|
2015-02-17 21:45:00 +03:00
|
|
|
return nsChangeHint(0);
|
2014-01-03 06:39:54 +04:00
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2010-09-09 19:21:45 +04:00
|
|
|
nsStyleCorners mOutlineRadius; // [reset] coord, percent, calc
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2008-09-13 07:45:37 +04:00
|
|
|
// Note that this is a specified value. You can get the actual values
|
|
|
|
// with GetOutlineWidth. You cannot get the computed value directly.
|
2008-09-13 07:45:37 +04:00
|
|
|
nsStyleCoord mOutlineWidth; // [reset] coord, enum (see nsStyleConsts.h)
|
2008-09-13 07:45:37 +04:00
|
|
|
nscoord mOutlineOffset; // [reset]
|
2004-10-26 16:57:15 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool GetOutlineWidth(nscoord& aWidth) const
|
2001-06-01 02:19:43 +04:00
|
|
|
{
|
|
|
|
if (mHasCachedOutline) {
|
|
|
|
aWidth = mCachedOutlineWidth;
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t GetOutlineStyle(void) const
|
2001-06-01 02:19:43 +04:00
|
|
|
{
|
|
|
|
return (mOutlineStyle & BORDER_STYLE_MASK);
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void SetOutlineStyle(uint8_t aStyle)
|
2001-06-01 02:19:43 +04:00
|
|
|
{
|
|
|
|
mOutlineStyle &= ~BORDER_STYLE_MASK;
|
|
|
|
mOutlineStyle |= (aStyle & BORDER_STYLE_MASK);
|
|
|
|
}
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
// false means initial value
|
2011-09-29 10:19:26 +04:00
|
|
|
bool GetOutlineColor(nscolor& aColor) const
|
2001-06-01 02:19:43 +04:00
|
|
|
{
|
|
|
|
if ((mOutlineStyle & BORDER_COLOR_SPECIAL) == 0) {
|
|
|
|
aColor = mOutlineColor;
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void SetOutlineColor(nscolor aColor)
|
|
|
|
{
|
|
|
|
mOutlineColor = aColor;
|
|
|
|
mOutlineStyle &= ~BORDER_COLOR_SPECIAL;
|
|
|
|
}
|
|
|
|
|
2007-03-15 19:16:20 +03:00
|
|
|
void SetOutlineInitialColor()
|
2001-06-01 02:19:43 +04:00
|
|
|
{
|
2007-03-15 19:16:20 +03:00
|
|
|
mOutlineStyle |= OUTLINE_COLOR_INITIAL;
|
2001-08-22 02:37:17 +04:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool GetOutlineInitialColor() const
|
2001-08-22 02:37:17 +04:00
|
|
|
{
|
2007-10-10 04:00:05 +04:00
|
|
|
return !!(mOutlineStyle & OUTLINE_COLOR_INITIAL);
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2006-12-27 17:21:43 +03:00
|
|
|
// This value is the actual value, so it's rounded to the nearest device
|
|
|
|
// pixel.
|
2001-06-01 02:19:43 +04:00
|
|
|
nscoord mCachedOutlineWidth;
|
|
|
|
|
2010-04-27 20:15:01 +04:00
|
|
|
nscolor mOutlineColor; // [reset]
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mHasCachedOutline;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mOutlineStyle; // [reset] See nsStyleConsts.h
|
2006-12-27 17:21:43 +03:00
|
|
|
|
|
|
|
nscoord mTwipsPerPixel;
|
2001-06-01 02:19:43 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-04-12 08:52:40 +03:00
|
|
|
/**
|
|
|
|
* An object that allows sharing of arrays that store 'quotes' property
|
|
|
|
* values. This is particularly important for inheritance, where we want
|
|
|
|
* to share the same 'quotes' value with a parent style context.
|
|
|
|
*/
|
|
|
|
class nsStyleQuoteValues
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
typedef nsTArray<std::pair<nsString, nsString>> QuotePairArray;
|
|
|
|
NS_INLINE_DECL_REFCOUNTING(nsStyleQuoteValues);
|
|
|
|
QuotePairArray mQuotePairs;
|
|
|
|
|
|
|
|
private:
|
|
|
|
~nsStyleQuoteValues() {}
|
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleList
|
|
|
|
{
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStyleList(StyleStructContext aContext);
|
2001-06-01 02:19:43 +04:00
|
|
|
nsStyleList(const nsStyleList& aStyleList);
|
|
|
|
~nsStyleList(void);
|
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStyleList* aSelf) CPP_THROW_NEW { return aSelf; }
|
2004-08-01 03:15:21 +04:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
2014-07-16 09:27:13 +04:00
|
|
|
return aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStyleList, sz);
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
2004-08-01 03:15:21 +04:00
|
|
|
void Destroy(nsPresContext* aContext) {
|
2001-06-02 01:04:23 +04:00
|
|
|
this->~nsStyleList();
|
2014-07-16 09:27:13 +04:00
|
|
|
aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
FreeByObjectID(mozilla::eArenaObjectID_nsStyleList, this);
|
2007-04-23 18:21:53 +04:00
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2002-08-24 18:41:28 +04:00
|
|
|
nsChangeHint CalcDifference(const nsStyleList& aOther) const;
|
2012-09-07 21:13:36 +04:00
|
|
|
static nsChangeHint MaxDifference() {
|
2014-09-20 05:43:00 +04:00
|
|
|
return NS_CombineHint(NS_STYLE_HINT_FRAMECHANGE,
|
|
|
|
nsChangeHint_NeutralChange);
|
2012-09-07 21:13:36 +04:00
|
|
|
}
|
2015-06-21 07:54:15 +03:00
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
2015-06-21 07:54:15 +03:00
|
|
|
// CalcDifference never returns the reflow hints that are sometimes
|
|
|
|
// handled for descendants as hints not handled for descendants.
|
|
|
|
return nsChangeHint_NeedReflow |
|
|
|
|
nsChangeHint_ReflowChangesSizeOrPosition |
|
|
|
|
nsChangeHint_ClearAncestorIntrinsics;
|
2014-01-03 06:39:54 +04:00
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2016-04-12 08:52:40 +03:00
|
|
|
static void Shutdown() {
|
|
|
|
sInitialQuotes = nullptr;
|
|
|
|
sNoneQuotes = nullptr;
|
|
|
|
}
|
|
|
|
|
2012-10-12 16:43:01 +04:00
|
|
|
imgRequestProxy* GetListStyleImage() const { return mListStyleImage; }
|
|
|
|
void SetListStyleImage(imgRequestProxy* aReq)
|
2009-12-11 07:02:13 +03:00
|
|
|
{
|
2010-08-16 20:23:09 +04:00
|
|
|
if (mListStyleImage)
|
|
|
|
mListStyleImage->UnlockImage();
|
2009-12-11 07:02:13 +03:00
|
|
|
mListStyleImage = aReq;
|
2010-08-16 20:23:09 +04:00
|
|
|
if (mListStyleImage)
|
|
|
|
mListStyleImage->LockImage();
|
2009-12-11 07:02:13 +03:00
|
|
|
}
|
|
|
|
|
2014-06-12 05:12:00 +04:00
|
|
|
void GetListStyleType(nsSubstring& aType) const { aType = mListStyleType; }
|
|
|
|
mozilla::CounterStyle* GetCounterStyle() const
|
|
|
|
{
|
|
|
|
return mCounterStyle.get();
|
|
|
|
}
|
|
|
|
void SetListStyleType(const nsSubstring& aType,
|
|
|
|
mozilla::CounterStyle* aStyle)
|
|
|
|
{
|
|
|
|
mListStyleType = aType;
|
|
|
|
mCounterStyle = aStyle;
|
|
|
|
}
|
|
|
|
void SetListStyleType(const nsSubstring& aType,
|
|
|
|
nsPresContext* aPresContext)
|
|
|
|
{
|
|
|
|
SetListStyleType(aType, aPresContext->
|
|
|
|
CounterStyleManager()->BuildCounterStyle(aType));
|
|
|
|
}
|
|
|
|
|
2016-04-12 08:52:40 +03:00
|
|
|
const nsStyleQuoteValues::QuotePairArray& GetQuotePairs() const;
|
|
|
|
|
|
|
|
void SetQuotesInherit(const nsStyleList* aOther);
|
|
|
|
void SetQuotesInitial();
|
|
|
|
void SetQuotesNone();
|
|
|
|
void SetQuotes(nsStyleQuoteValues::QuotePairArray&& aValues);
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mListStylePosition; // [inherited]
|
2009-12-11 07:02:13 +03:00
|
|
|
private:
|
2014-06-12 05:12:00 +04:00
|
|
|
nsString mListStyleType; // [inherited]
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::CounterStyle> mCounterStyle; // [inherited]
|
|
|
|
RefPtr<imgRequestProxy> mListStyleImage; // [inherited]
|
2016-04-12 08:52:40 +03:00
|
|
|
RefPtr<nsStyleQuoteValues> mQuotes; // [inherited]
|
2015-01-07 02:35:02 +03:00
|
|
|
nsStyleList& operator=(const nsStyleList& aOther) = delete;
|
2009-12-11 07:02:13 +03:00
|
|
|
public:
|
2010-04-27 20:15:01 +04:00
|
|
|
nsRect mImageRegion; // [inherited] the rect to use within an image
|
2016-04-12 08:52:40 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
// nsStyleQuoteValues objects representing two common values, for sharing.
|
|
|
|
static mozilla::StaticRefPtr<nsStyleQuoteValues> sInitialQuotes;
|
|
|
|
static mozilla::StaticRefPtr<nsStyleQuoteValues> sNoneQuotes;
|
2001-06-01 02:19:43 +04:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleGridLine
|
|
|
|
{
|
2014-03-11 02:54:17 +04:00
|
|
|
// http://dev.w3.org/csswg/css-grid/#typedef-grid-line
|
2015-04-30 21:42:50 +03:00
|
|
|
// XXXmats we could optimize memory size here
|
2014-03-11 02:54:17 +04:00
|
|
|
bool mHasSpan;
|
|
|
|
int32_t mInteger; // 0 means not provided
|
|
|
|
nsString mLineName; // Empty string means not provided.
|
|
|
|
|
2015-04-30 21:42:50 +03:00
|
|
|
// mInteger is clamped to this range:
|
|
|
|
static const int32_t kMinLine;
|
|
|
|
static const int32_t kMaxLine;
|
|
|
|
|
2014-03-11 02:54:17 +04:00
|
|
|
nsStyleGridLine()
|
|
|
|
: mHasSpan(false)
|
|
|
|
, mInteger(0)
|
|
|
|
// mLineName get its default constructor, the empty string
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsStyleGridLine(const nsStyleGridLine& aOther)
|
|
|
|
{
|
|
|
|
(*this) = aOther;
|
|
|
|
}
|
|
|
|
|
|
|
|
void operator=(const nsStyleGridLine& aOther)
|
|
|
|
{
|
|
|
|
mHasSpan = aOther.mHasSpan;
|
|
|
|
mInteger = aOther.mInteger;
|
|
|
|
mLineName = aOther.mLineName;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator!=(const nsStyleGridLine& aOther) const
|
|
|
|
{
|
|
|
|
return mHasSpan != aOther.mHasSpan ||
|
|
|
|
mInteger != aOther.mInteger ||
|
|
|
|
mLineName != aOther.mLineName;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetToInteger(uint32_t value)
|
|
|
|
{
|
|
|
|
mHasSpan = false;
|
|
|
|
mInteger = value;
|
|
|
|
mLineName.Truncate();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetAuto()
|
|
|
|
{
|
|
|
|
mHasSpan = false;
|
|
|
|
mInteger = 0;
|
|
|
|
mLineName.Truncate();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsAuto() const
|
|
|
|
{
|
|
|
|
bool haveInitialValues = mInteger == 0 && mLineName.IsEmpty();
|
|
|
|
MOZ_ASSERT(!(haveInitialValues && mHasSpan),
|
|
|
|
"should not have 'span' when other components are "
|
|
|
|
"at their initial values");
|
|
|
|
return haveInitialValues;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-12-23 01:03:15 +03:00
|
|
|
// Computed value of the grid-template-columns or grid-template-rows property
|
|
|
|
// (but *not* grid-template-areas.)
|
|
|
|
// http://dev.w3.org/csswg/css-grid/#track-sizing
|
|
|
|
//
|
|
|
|
// This represents either:
|
|
|
|
// * none:
|
|
|
|
// mIsSubgrid is false, all three arrays are empty
|
|
|
|
// * <track-list>:
|
|
|
|
// mIsSubgrid is false,
|
|
|
|
// mMinTrackSizingFunctions and mMaxTrackSizingFunctions
|
|
|
|
// are of identical non-zero size,
|
|
|
|
// and mLineNameLists is one element longer than that.
|
|
|
|
// (Delimiting N columns requires N+1 lines:
|
|
|
|
// one before each track, plus one at the very end.)
|
|
|
|
//
|
|
|
|
// An omitted <line-names> is still represented in mLineNameLists,
|
|
|
|
// as an empty sub-array.
|
|
|
|
//
|
|
|
|
// A <track-size> specified as a single <track-breadth> is represented
|
|
|
|
// as identical min and max sizing functions.
|
|
|
|
//
|
|
|
|
// The units for nsStyleCoord are:
|
|
|
|
// * eStyleUnit_Percent represents a <percentage>
|
|
|
|
// * eStyleUnit_FlexFraction represents a <flex> flexible fraction
|
|
|
|
// * eStyleUnit_Coord represents a <length>
|
|
|
|
// * eStyleUnit_Enumerated represents min-content or max-content
|
|
|
|
// * subgrid <line-name-list>?:
|
|
|
|
// mIsSubgrid is true,
|
|
|
|
// mLineNameLists may or may not be empty,
|
|
|
|
// mMinTrackSizingFunctions and mMaxTrackSizingFunctions are empty.
|
|
|
|
//
|
|
|
|
// If mRepeatAutoIndex != -1 then that index is an <auto-repeat> and
|
|
|
|
// mIsAutoFill == true means it's an 'auto-fill', otherwise 'auto-fit'.
|
|
|
|
// mRepeatAutoLineNameListBefore is the list of line names before the track
|
|
|
|
// size, mRepeatAutoLineNameListAfter the names after. (They are empty
|
|
|
|
// when there is no <auto-repeat> track, i.e. when mRepeatAutoIndex == -1).
|
|
|
|
// When mIsSubgrid is true, mRepeatAutoLineNameListBefore contains the line
|
|
|
|
// names and mRepeatAutoLineNameListAfter is empty.
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleGridTemplate
|
|
|
|
{
|
2015-12-23 01:03:15 +03:00
|
|
|
nsTArray<nsTArray<nsString>> mLineNameLists;
|
|
|
|
nsTArray<nsStyleCoord> mMinTrackSizingFunctions;
|
|
|
|
nsTArray<nsStyleCoord> mMaxTrackSizingFunctions;
|
|
|
|
nsTArray<nsString> mRepeatAutoLineNameListBefore;
|
|
|
|
nsTArray<nsString> mRepeatAutoLineNameListAfter;
|
|
|
|
int16_t mRepeatAutoIndex; // -1 or the track index for an auto-fill/fit track
|
|
|
|
bool mIsAutoFill : 1;
|
|
|
|
bool mIsSubgrid : 1;
|
|
|
|
|
|
|
|
nsStyleGridTemplate()
|
|
|
|
: mRepeatAutoIndex(-1)
|
|
|
|
, mIsAutoFill(false)
|
|
|
|
, mIsSubgrid(false)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool operator!=(const nsStyleGridTemplate& aOther) const {
|
|
|
|
return
|
|
|
|
mIsSubgrid != aOther.mIsSubgrid ||
|
|
|
|
mLineNameLists != aOther.mLineNameLists ||
|
|
|
|
mMinTrackSizingFunctions != aOther.mMinTrackSizingFunctions ||
|
|
|
|
mMaxTrackSizingFunctions != aOther.mMaxTrackSizingFunctions ||
|
|
|
|
mIsAutoFill != aOther.mIsAutoFill ||
|
|
|
|
mRepeatAutoIndex != aOther.mRepeatAutoIndex ||
|
|
|
|
mRepeatAutoLineNameListBefore != aOther.mRepeatAutoLineNameListBefore ||
|
|
|
|
mRepeatAutoLineNameListAfter != aOther.mRepeatAutoLineNameListAfter;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool HasRepeatAuto() const {
|
|
|
|
return mRepeatAutoIndex != -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsRepeatAutoIndex(uint32_t aIndex) const {
|
|
|
|
MOZ_ASSERT(aIndex < uint32_t(2*nsStyleGridLine::kMaxLine));
|
|
|
|
return int32_t(aIndex) == mRepeatAutoIndex;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStylePosition
|
|
|
|
{
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStylePosition(StyleStructContext aContext);
|
2001-06-01 02:19:43 +04:00
|
|
|
nsStylePosition(const nsStylePosition& aOther);
|
|
|
|
~nsStylePosition(void);
|
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStylePosition* aSelf) CPP_THROW_NEW { return aSelf; }
|
2004-08-01 03:15:21 +04:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
2014-07-16 09:27:13 +04:00
|
|
|
return aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStylePosition, sz);
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
2004-08-01 03:15:21 +04:00
|
|
|
void Destroy(nsPresContext* aContext) {
|
2001-06-02 01:04:23 +04:00
|
|
|
this->~nsStylePosition();
|
2014-07-16 09:27:13 +04:00
|
|
|
aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
FreeByObjectID(mozilla::eArenaObjectID_nsStylePosition, this);
|
2007-04-23 18:21:53 +04:00
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2015-09-09 14:22:02 +03:00
|
|
|
nsChangeHint CalcDifference(const nsStylePosition& aOther,
|
2015-10-23 02:57:35 +03:00
|
|
|
const nsStyleVisibility* aOldStyleVisibility) const;
|
2012-09-07 21:13:36 +04:00
|
|
|
static nsChangeHint MaxDifference() {
|
2015-03-20 07:12:17 +03:00
|
|
|
return NS_CombineHint(NS_STYLE_HINT_REFLOW,
|
2015-12-24 03:35:18 +03:00
|
|
|
nsChangeHint(nsChangeHint_NeutralChange |
|
|
|
|
nsChangeHint_RecomputePosition |
|
2015-07-22 07:36:56 +03:00
|
|
|
nsChangeHint_UpdateParentOverflow |
|
|
|
|
nsChangeHint_UpdateComputedBSize));
|
2012-09-07 21:13:36 +04:00
|
|
|
}
|
2015-06-21 07:54:15 +03:00
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
2015-06-21 07:54:15 +03:00
|
|
|
// CalcDifference can return all of the reflow hints that are
|
|
|
|
// sometimes handled for descendants as hints not handled for
|
|
|
|
// descendants.
|
2014-01-03 06:39:54 +04:00
|
|
|
return nsChangeHint(0);
|
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2016-01-28 08:24:00 +03:00
|
|
|
// XXXdholbert nsStyleImageLayers::Position should probably be moved to a
|
2014-09-10 05:09:32 +04:00
|
|
|
// different scope, since we're now using it in multiple style structs.
|
2016-01-28 08:24:00 +03:00
|
|
|
typedef nsStyleImageLayers::Position Position;
|
2014-09-10 05:09:32 +04:00
|
|
|
|
2015-11-03 17:18:06 +03:00
|
|
|
/**
|
2015-11-28 23:37:44 +03:00
|
|
|
* Return the computed value for 'align-content'.
|
2015-11-03 17:18:06 +03:00
|
|
|
*/
|
2015-11-28 23:37:44 +03:00
|
|
|
uint16_t ComputedAlignContent() const { return mAlignContent; }
|
2015-11-03 17:18:06 +03:00
|
|
|
|
2015-11-03 17:18:05 +03:00
|
|
|
/**
|
2016-01-05 23:27:13 +03:00
|
|
|
* Return the computed value for 'align-items'.
|
2015-11-03 17:18:05 +03:00
|
|
|
*/
|
2016-01-05 23:27:13 +03:00
|
|
|
uint8_t ComputedAlignItems() const { return mAlignItems; }
|
2015-11-03 17:18:05 +03:00
|
|
|
|
2015-11-03 17:18:06 +03:00
|
|
|
/**
|
2016-01-05 23:27:13 +03:00
|
|
|
* Return the computed value for 'align-self' given our parent StyleContext
|
|
|
|
* aParent (or null for the root).
|
2015-11-03 17:18:06 +03:00
|
|
|
*/
|
2016-01-05 23:27:13 +03:00
|
|
|
uint8_t ComputedAlignSelf(nsStyleContext* aParent) const;
|
2015-11-03 17:18:06 +03:00
|
|
|
|
2015-11-03 17:18:05 +03:00
|
|
|
/**
|
2016-01-05 23:27:13 +03:00
|
|
|
* Return the computed value for 'justify-content'.
|
2015-11-03 17:18:05 +03:00
|
|
|
*/
|
2016-01-05 23:27:13 +03:00
|
|
|
uint16_t ComputedJustifyContent() const { return mJustifyContent; }
|
2015-11-03 17:18:05 +03:00
|
|
|
|
2015-11-03 17:18:05 +03:00
|
|
|
/**
|
2016-01-05 23:27:13 +03:00
|
|
|
* Return the computed value for 'justify-items' given our parent StyleContext
|
|
|
|
* aParent (or null for the root).
|
2015-11-03 17:18:05 +03:00
|
|
|
*/
|
2016-01-05 23:27:13 +03:00
|
|
|
uint8_t ComputedJustifyItems(nsStyleContext* aParent) const;
|
2015-11-03 17:18:05 +03:00
|
|
|
|
2015-11-03 17:18:05 +03:00
|
|
|
/**
|
2016-01-05 23:27:13 +03:00
|
|
|
* Return the computed value for 'justify-self' given our parent StyleContext
|
|
|
|
* aParent (or null for the root).
|
2015-11-03 17:18:05 +03:00
|
|
|
*/
|
2016-01-05 23:27:13 +03:00
|
|
|
uint8_t ComputedJustifySelf(nsStyleContext* aParent) const;
|
2015-11-03 17:18:05 +03:00
|
|
|
|
2014-09-10 05:09:32 +04:00
|
|
|
Position mObjectPosition; // [reset]
|
2010-08-25 14:17:56 +04:00
|
|
|
nsStyleSides mOffset; // [reset] coord, percent, calc, auto
|
2010-08-25 14:17:56 +04:00
|
|
|
nsStyleCoord mWidth; // [reset] coord, percent, enum, calc, auto
|
|
|
|
nsStyleCoord mMinWidth; // [reset] coord, percent, enum, calc
|
|
|
|
nsStyleCoord mMaxWidth; // [reset] coord, percent, enum, calc, none
|
2010-08-25 14:17:55 +04:00
|
|
|
nsStyleCoord mHeight; // [reset] coord, percent, calc, auto
|
|
|
|
nsStyleCoord mMinHeight; // [reset] coord, percent, calc
|
|
|
|
nsStyleCoord mMaxHeight; // [reset] coord, percent, calc, none
|
2012-07-07 04:06:23 +04:00
|
|
|
nsStyleCoord mFlexBasis; // [reset] coord, percent, enum, calc, auto
|
2014-03-11 02:54:15 +04:00
|
|
|
nsStyleCoord mGridAutoColumnsMin; // [reset] coord, percent, enum, calc, flex
|
|
|
|
nsStyleCoord mGridAutoColumnsMax; // [reset] coord, percent, enum, calc, flex
|
|
|
|
nsStyleCoord mGridAutoRowsMin; // [reset] coord, percent, enum, calc, flex
|
|
|
|
nsStyleCoord mGridAutoRowsMax; // [reset] coord, percent, enum, calc, flex
|
2014-03-11 02:54:16 +04:00
|
|
|
uint8_t mGridAutoFlow; // [reset] enumerated. See nsStyleConsts.h
|
2015-11-20 05:09:29 +03:00
|
|
|
mozilla::StyleBoxSizing mBoxSizing; // [reset] see nsStyleConsts.h
|
2015-11-03 17:18:05 +03:00
|
|
|
private:
|
|
|
|
friend class nsRuleNode;
|
2015-11-03 17:18:05 +03:00
|
|
|
|
2015-11-03 17:18:06 +03:00
|
|
|
uint16_t mAlignContent; // [reset] fallback value in the high byte
|
2015-11-03 17:18:05 +03:00
|
|
|
uint8_t mAlignItems; // [reset] see nsStyleConsts.h
|
2015-11-03 17:18:06 +03:00
|
|
|
uint8_t mAlignSelf; // [reset] see nsStyleConsts.h
|
2015-11-03 17:18:05 +03:00
|
|
|
uint16_t mJustifyContent; // [reset] fallback value in the high byte
|
2015-11-03 17:18:05 +03:00
|
|
|
uint8_t mJustifyItems; // [reset] see nsStyleConsts.h
|
2015-11-03 17:18:05 +03:00
|
|
|
uint8_t mJustifySelf; // [reset] see nsStyleConsts.h
|
2015-11-03 17:18:05 +03:00
|
|
|
public:
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mFlexDirection; // [reset] see nsStyleConsts.h
|
2013-12-05 22:57:50 +04:00
|
|
|
uint8_t mFlexWrap; // [reset] see nsStyleConsts.h
|
2014-09-10 05:09:32 +04:00
|
|
|
uint8_t mObjectFit; // [reset] see nsStyleConsts.h
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mOrder; // [reset] integer
|
2012-07-07 04:06:22 +04:00
|
|
|
float mFlexGrow; // [reset] float
|
|
|
|
float mFlexShrink; // [reset] float
|
2008-08-05 02:15:11 +04:00
|
|
|
nsStyleCoord mZIndex; // [reset] integer, auto
|
2014-03-27 19:54:40 +04:00
|
|
|
nsStyleGridTemplate mGridTemplateColumns;
|
|
|
|
nsStyleGridTemplate mGridTemplateRows;
|
2014-03-21 19:06:16 +04:00
|
|
|
|
|
|
|
// nullptr for 'none'
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::css::GridTemplateAreasValue> mGridTemplateAreas;
|
2010-08-11 23:32:52 +04:00
|
|
|
|
2014-03-11 02:54:17 +04:00
|
|
|
nsStyleGridLine mGridColumnStart;
|
|
|
|
nsStyleGridLine mGridColumnEnd;
|
|
|
|
nsStyleGridLine mGridRowStart;
|
|
|
|
nsStyleGridLine mGridRowEnd;
|
2015-11-18 21:52:27 +03:00
|
|
|
nscoord mGridColumnGap; // [reset] coord, calc
|
|
|
|
nscoord mGridRowGap; // [reset] coord, calc
|
2014-03-11 02:54:17 +04:00
|
|
|
|
2015-05-11 13:35:47 +03:00
|
|
|
// FIXME: Logical-coordinate equivalents to these WidthDepends... and
|
|
|
|
// HeightDepends... methods have been introduced (see below); we probably
|
|
|
|
// want to work towards removing the physical methods, and using the logical
|
|
|
|
// ones in all cases.
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool WidthDependsOnContainer() const
|
2014-07-22 19:24:34 +04:00
|
|
|
{
|
|
|
|
return mWidth.GetUnit() == eStyleUnit_Auto ||
|
|
|
|
WidthCoordDependsOnContainer(mWidth);
|
|
|
|
}
|
|
|
|
|
|
|
|
// NOTE: For a flex item, "min-width:auto" is supposed to behave like
|
|
|
|
// "min-content", which does depend on the container, so you might think we'd
|
|
|
|
// need a special case for "flex item && min-width:auto" here. However,
|
|
|
|
// we don't actually need that special-case code, because flex items are
|
|
|
|
// explicitly supposed to *ignore* their min-width (i.e. behave like it's 0)
|
|
|
|
// until the flex container explicitly considers it. So -- since the flex
|
|
|
|
// container doesn't rely on this method, we don't need to worry about
|
|
|
|
// special behavior for flex items' "min-width:auto" values here.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool MinWidthDependsOnContainer() const
|
2010-08-11 23:32:52 +04:00
|
|
|
{ return WidthCoordDependsOnContainer(mMinWidth); }
|
2011-09-29 10:19:26 +04:00
|
|
|
bool MaxWidthDependsOnContainer() const
|
2010-08-11 23:32:52 +04:00
|
|
|
{ return WidthCoordDependsOnContainer(mMaxWidth); }
|
2010-08-25 14:17:56 +04:00
|
|
|
|
|
|
|
// Note that these functions count 'auto' as depending on the
|
|
|
|
// container since that's the case for absolutely positioned elements.
|
|
|
|
// However, some callers do not care about this case and should check
|
|
|
|
// for it, since it is the most common case.
|
|
|
|
// FIXME: We should probably change the assumption to be the other way
|
|
|
|
// around.
|
2015-05-11 13:35:47 +03:00
|
|
|
// Consider this as part of moving to the logical-coordinate APIs.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool HeightDependsOnContainer() const
|
2014-07-22 19:24:35 +04:00
|
|
|
{
|
|
|
|
return mHeight.GetUnit() == eStyleUnit_Auto || // CSS 2.1, 10.6.4, item (5)
|
|
|
|
HeightCoordDependsOnContainer(mHeight);
|
|
|
|
}
|
|
|
|
|
|
|
|
// NOTE: The comment above MinWidthDependsOnContainer about flex items
|
|
|
|
// applies here, too.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool MinHeightDependsOnContainer() const
|
2010-08-11 23:32:52 +04:00
|
|
|
{ return HeightCoordDependsOnContainer(mMinHeight); }
|
2011-09-29 10:19:26 +04:00
|
|
|
bool MaxHeightDependsOnContainer() const
|
2010-08-11 23:32:52 +04:00
|
|
|
{ return HeightCoordDependsOnContainer(mMaxHeight); }
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool OffsetHasPercent(mozilla::css::Side aSide) const
|
2010-08-25 14:17:56 +04:00
|
|
|
{
|
|
|
|
return mOffset.Get(aSide).HasPercent();
|
|
|
|
}
|
|
|
|
|
2015-05-11 13:35:47 +03:00
|
|
|
// Logical-coordinate accessors for width and height properties,
|
|
|
|
// given a WritingMode value. The definitions of these methods are
|
|
|
|
// found in WritingModes.h (after the WritingMode class is fully
|
|
|
|
// declared).
|
|
|
|
inline nsStyleCoord& ISize(mozilla::WritingMode aWM);
|
|
|
|
inline nsStyleCoord& MinISize(mozilla::WritingMode aWM);
|
|
|
|
inline nsStyleCoord& MaxISize(mozilla::WritingMode aWM);
|
|
|
|
inline nsStyleCoord& BSize(mozilla::WritingMode aWM);
|
|
|
|
inline nsStyleCoord& MinBSize(mozilla::WritingMode aWM);
|
|
|
|
inline nsStyleCoord& MaxBSize(mozilla::WritingMode aWM);
|
|
|
|
inline const nsStyleCoord& ISize(mozilla::WritingMode aWM) const;
|
|
|
|
inline const nsStyleCoord& MinISize(mozilla::WritingMode aWM) const;
|
|
|
|
inline const nsStyleCoord& MaxISize(mozilla::WritingMode aWM) const;
|
|
|
|
inline const nsStyleCoord& BSize(mozilla::WritingMode aWM) const;
|
|
|
|
inline const nsStyleCoord& MinBSize(mozilla::WritingMode aWM) const;
|
|
|
|
inline const nsStyleCoord& MaxBSize(mozilla::WritingMode aWM) const;
|
|
|
|
inline bool ISizeDependsOnContainer(mozilla::WritingMode aWM) const;
|
|
|
|
inline bool MinISizeDependsOnContainer(mozilla::WritingMode aWM) const;
|
|
|
|
inline bool MaxISizeDependsOnContainer(mozilla::WritingMode aWM) const;
|
|
|
|
inline bool BSizeDependsOnContainer(mozilla::WritingMode aWM) const;
|
|
|
|
inline bool MinBSizeDependsOnContainer(mozilla::WritingMode aWM) const;
|
|
|
|
inline bool MaxBSizeDependsOnContainer(mozilla::WritingMode aWM) const;
|
|
|
|
|
2010-08-11 23:32:52 +04:00
|
|
|
private:
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool WidthCoordDependsOnContainer(const nsStyleCoord &aCoord);
|
|
|
|
static bool HeightCoordDependsOnContainer(const nsStyleCoord &aCoord)
|
2014-07-22 19:24:35 +04:00
|
|
|
{ return aCoord.HasPercent(); }
|
2001-06-01 02:19:43 +04:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleTextOverflowSide
|
|
|
|
{
|
2011-08-21 00:41:39 +04:00
|
|
|
nsStyleTextOverflowSide() : mType(NS_STYLE_TEXT_OVERFLOW_CLIP) {}
|
2011-06-22 22:11:47 +04:00
|
|
|
|
2011-08-21 00:41:39 +04:00
|
|
|
bool operator==(const nsStyleTextOverflowSide& aOther) const {
|
2011-06-22 22:11:47 +04:00
|
|
|
return mType == aOther.mType &&
|
|
|
|
(mType != NS_STYLE_TEXT_OVERFLOW_STRING ||
|
|
|
|
mString == aOther.mString);
|
|
|
|
}
|
2011-08-21 00:41:39 +04:00
|
|
|
bool operator!=(const nsStyleTextOverflowSide& aOther) const {
|
2011-06-22 22:11:47 +04:00
|
|
|
return !(*this == aOther);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsString mString;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mType;
|
2011-06-22 22:11:47 +04:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleTextOverflow
|
|
|
|
{
|
2011-10-12 20:20:46 +04:00
|
|
|
nsStyleTextOverflow() : mLogicalDirections(true) {}
|
2011-08-21 00:41:39 +04:00
|
|
|
bool operator==(const nsStyleTextOverflow& aOther) const {
|
|
|
|
return mLeft == aOther.mLeft && mRight == aOther.mRight;
|
|
|
|
}
|
|
|
|
bool operator!=(const nsStyleTextOverflow& aOther) const {
|
|
|
|
return !(*this == aOther);
|
|
|
|
}
|
|
|
|
|
2011-10-12 20:20:46 +04:00
|
|
|
// Returns the value to apply on the left side.
|
2012-08-22 19:56:38 +04:00
|
|
|
const nsStyleTextOverflowSide& GetLeft(uint8_t aDirection) const {
|
2011-10-12 20:20:46 +04:00
|
|
|
NS_ASSERTION(aDirection == NS_STYLE_DIRECTION_LTR ||
|
|
|
|
aDirection == NS_STYLE_DIRECTION_RTL, "bad direction");
|
|
|
|
return !mLogicalDirections || aDirection == NS_STYLE_DIRECTION_LTR ?
|
|
|
|
mLeft : mRight;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the value to apply on the right side.
|
2012-08-22 19:56:38 +04:00
|
|
|
const nsStyleTextOverflowSide& GetRight(uint8_t aDirection) const {
|
2011-10-12 20:20:46 +04:00
|
|
|
NS_ASSERTION(aDirection == NS_STYLE_DIRECTION_LTR ||
|
|
|
|
aDirection == NS_STYLE_DIRECTION_RTL, "bad direction");
|
|
|
|
return !mLogicalDirections || aDirection == NS_STYLE_DIRECTION_LTR ?
|
|
|
|
mRight : mLeft;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the first value that was specified.
|
|
|
|
const nsStyleTextOverflowSide* GetFirstValue() const {
|
|
|
|
return mLogicalDirections ? &mRight : &mLeft;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the second value, or null if there was only one value specified.
|
|
|
|
const nsStyleTextOverflowSide* GetSecondValue() const {
|
2012-07-30 18:20:58 +04:00
|
|
|
return mLogicalDirections ? nullptr : &mRight;
|
2011-10-12 20:20:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsStyleTextOverflowSide mLeft; // start side when mLogicalDirections is true
|
|
|
|
nsStyleTextOverflowSide mRight; // end side when mLogicalDirections is true
|
|
|
|
bool mLogicalDirections; // true when only one value was specified
|
2011-08-21 00:41:39 +04:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleTextReset
|
|
|
|
{
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStyleTextReset(StyleStructContext aContext);
|
2001-06-01 02:19:43 +04:00
|
|
|
nsStyleTextReset(const nsStyleTextReset& aOther);
|
|
|
|
~nsStyleTextReset(void);
|
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStyleTextReset* aSelf) CPP_THROW_NEW { return aSelf; }
|
2004-08-01 03:15:21 +04:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
2014-07-16 09:27:13 +04:00
|
|
|
return aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStyleTextReset, sz);
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
2004-08-01 03:15:21 +04:00
|
|
|
void Destroy(nsPresContext* aContext) {
|
2001-06-02 01:04:23 +04:00
|
|
|
this->~nsStyleTextReset();
|
2014-07-16 09:27:13 +04:00
|
|
|
aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
FreeByObjectID(mozilla::eArenaObjectID_nsStyleTextReset, this);
|
2007-04-23 18:21:53 +04:00
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2016-03-14 20:27:05 +03:00
|
|
|
// Note the difference between this and
|
|
|
|
// nsStyleContext::HasTextDecorationLines.
|
|
|
|
bool HasTextDecorationLines() const {
|
|
|
|
return mTextDecorationLine != NS_STYLE_TEXT_DECORATION_LINE_NONE &&
|
|
|
|
mTextDecorationLine != NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t GetDecorationStyle() const
|
2011-03-31 16:26:35 +04:00
|
|
|
{
|
|
|
|
return (mTextDecorationStyle & BORDER_STYLE_MASK);
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void SetDecorationStyle(uint8_t aStyle)
|
2011-03-31 16:26:35 +04:00
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT((aStyle & BORDER_STYLE_MASK) == aStyle,
|
|
|
|
"style doesn't fit");
|
2011-03-31 16:26:35 +04:00
|
|
|
mTextDecorationStyle &= ~BORDER_STYLE_MASK;
|
|
|
|
mTextDecorationStyle |= (aStyle & BORDER_STYLE_MASK);
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
void GetDecorationColor(nscolor& aColor, bool& aForeground) const
|
2011-03-31 16:26:35 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
aForeground = false;
|
2011-03-31 16:26:35 +04:00
|
|
|
if ((mTextDecorationStyle & BORDER_COLOR_SPECIAL) == 0) {
|
|
|
|
aColor = mTextDecorationColor;
|
|
|
|
} else if (mTextDecorationStyle & BORDER_COLOR_FOREGROUND) {
|
2011-10-17 18:59:28 +04:00
|
|
|
aForeground = true;
|
2011-03-31 16:26:35 +04:00
|
|
|
} else {
|
|
|
|
NS_NOTREACHED("OUTLINE_COLOR_INITIAL should not be set here");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetDecorationColor(nscolor aColor)
|
|
|
|
{
|
|
|
|
mTextDecorationColor = aColor;
|
|
|
|
mTextDecorationStyle &= ~BORDER_COLOR_SPECIAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetDecorationColorToForeground()
|
|
|
|
{
|
|
|
|
mTextDecorationStyle &= ~BORDER_COLOR_SPECIAL;
|
|
|
|
mTextDecorationStyle |= BORDER_COLOR_FOREGROUND;
|
|
|
|
}
|
|
|
|
|
2002-08-24 18:41:28 +04:00
|
|
|
nsChangeHint CalcDifference(const nsStyleTextReset& aOther) const;
|
2012-09-07 21:13:36 +04:00
|
|
|
static nsChangeHint MaxDifference() {
|
2014-06-17 18:32:00 +04:00
|
|
|
return nsChangeHint(
|
2015-05-14 20:05:32 +03:00
|
|
|
NS_STYLE_HINT_REFLOW |
|
2014-06-17 18:32:00 +04:00
|
|
|
nsChangeHint_UpdateSubtreeOverflow);
|
2012-09-07 21:13:36 +04:00
|
|
|
}
|
2015-06-21 07:54:15 +03:00
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
2015-06-21 07:54:15 +03:00
|
|
|
// CalcDifference never returns the reflow hints that are sometimes
|
|
|
|
// handled for descendants as hints not handled for descendants.
|
|
|
|
return nsChangeHint_NeedReflow |
|
|
|
|
nsChangeHint_ReflowChangesSizeOrPosition |
|
|
|
|
nsChangeHint_ClearAncestorIntrinsics;
|
2014-01-03 06:39:54 +04:00
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2011-06-22 22:11:47 +04:00
|
|
|
nsStyleTextOverflow mTextOverflow; // [reset] enum, string
|
2011-03-31 16:26:35 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mTextDecorationLine; // [reset] see nsStyleConsts.h
|
|
|
|
uint8_t mUnicodeBidi; // [reset] see nsStyleConsts.h
|
2011-03-31 16:26:35 +04:00
|
|
|
protected:
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mTextDecorationStyle; // [reset] see nsStyleConsts.h
|
2001-06-29 07:15:58 +04:00
|
|
|
|
2011-03-31 16:26:35 +04:00
|
|
|
nscolor mTextDecorationColor; // [reset] the colors to use for a decoration lines, not used at currentColor
|
2001-06-01 02:19:43 +04:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleText
|
|
|
|
{
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStyleText(StyleStructContext aContext);
|
2001-06-01 02:19:43 +04:00
|
|
|
nsStyleText(const nsStyleText& aOther);
|
|
|
|
~nsStyleText(void);
|
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStyleText* aSelf) CPP_THROW_NEW { return aSelf; }
|
2004-08-01 03:15:21 +04:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
2014-07-16 09:27:13 +04:00
|
|
|
return aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStyleText, sz);
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
2004-08-01 03:15:21 +04:00
|
|
|
void Destroy(nsPresContext* aContext) {
|
2001-06-02 01:04:23 +04:00
|
|
|
this->~nsStyleText();
|
2014-07-16 09:27:13 +04:00
|
|
|
aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
FreeByObjectID(mozilla::eArenaObjectID_nsStyleText, this);
|
2007-04-23 18:21:53 +04:00
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2002-08-24 18:41:28 +04:00
|
|
|
nsChangeHint CalcDifference(const nsStyleText& aOther) const;
|
2012-09-07 21:13:36 +04:00
|
|
|
static nsChangeHint MaxDifference() {
|
2015-10-02 06:05:28 +03:00
|
|
|
return NS_STYLE_HINT_FRAMECHANGE |
|
2016-01-04 02:47:05 +03:00
|
|
|
nsChangeHint_UpdateSubtreeOverflow |
|
|
|
|
nsChangeHint_NeutralChange;
|
2012-09-07 21:13:36 +04:00
|
|
|
}
|
2015-06-21 07:54:15 +03:00
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
2015-06-21 07:54:15 +03:00
|
|
|
// CalcDifference never returns the reflow hints that are sometimes
|
|
|
|
// handled for descendants as hints not handled for descendants.
|
|
|
|
return nsChangeHint_NeedReflow |
|
|
|
|
nsChangeHint_ReflowChangesSizeOrPosition |
|
|
|
|
nsChangeHint_ClearAncestorIntrinsics;
|
2014-01-03 06:39:54 +04:00
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mTextAlign; // [inherited] see nsStyleConsts.h
|
|
|
|
uint8_t mTextAlignLast; // [inherited] see nsStyleConsts.h
|
2013-10-28 00:56:32 +04:00
|
|
|
bool mTextAlignTrue : 1; // [inherited] see nsStyleConsts.h
|
|
|
|
bool mTextAlignLastTrue : 1; // [inherited] see nsStyleConsts.h
|
2015-11-28 03:56:33 +03:00
|
|
|
bool mTextEmphasisColorForeground : 1;// [inherited] whether text-emphasis-color is currentColor
|
2016-03-25 10:54:49 +03:00
|
|
|
bool mWebkitTextFillColorForeground : 1; // [inherited] whether -webkit-text-fill-color is currentColor
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mTextTransform; // [inherited] see nsStyleConsts.h
|
|
|
|
uint8_t mWhiteSpace; // [inherited] see nsStyleConsts.h
|
|
|
|
uint8_t mWordBreak; // [inherited] see nsStyleConsts.h
|
|
|
|
uint8_t mWordWrap; // [inherited] see nsStyleConsts.h
|
|
|
|
uint8_t mHyphens; // [inherited] see nsStyleConsts.h
|
2015-02-17 08:01:49 +03:00
|
|
|
uint8_t mRubyAlign; // [inherited] see nsStyleConsts.h
|
2014-12-09 09:47:18 +03:00
|
|
|
uint8_t mRubyPosition; // [inherited] see nsStyleConsts.h
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mTextSizeAdjust; // [inherited] see nsStyleConsts.h
|
2014-04-17 04:15:18 +04:00
|
|
|
uint8_t mTextCombineUpright; // [inherited] see nsStyleConsts.h
|
2014-02-05 14:08:48 +04:00
|
|
|
uint8_t mControlCharacterVisibility; // [inherited] see nsStyleConsts.h
|
2015-11-28 03:56:33 +03:00
|
|
|
uint8_t mTextEmphasisPosition; // [inherited] see nsStyleConsts.h
|
|
|
|
uint8_t mTextEmphasisStyle; // [inherited] see nsStyleConsts.h
|
2016-04-12 08:52:41 +03:00
|
|
|
uint8_t mTextRendering; // [inherited] see nsStyleConsts.h
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mTabSize; // [inherited] see nsStyleConsts.h
|
2015-11-28 03:56:33 +03:00
|
|
|
nscolor mTextEmphasisColor; // [inherited]
|
2016-03-25 10:54:49 +03:00
|
|
|
nscolor mWebkitTextFillColor; // [inherited]
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2015-11-09 03:40:37 +03:00
|
|
|
nsStyleCoord mWordSpacing; // [inherited] coord, percent, calc
|
2015-10-22 08:13:11 +03:00
|
|
|
nsStyleCoord mLetterSpacing; // [inherited] coord, normal
|
|
|
|
nsStyleCoord mLineHeight; // [inherited] coord, factor, normal
|
|
|
|
nsStyleCoord mTextIndent; // [inherited] coord, percent, calc
|
2008-06-06 03:06:34 +04:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsCSSShadowArray> mTextShadow; // [inherited] nullptr in case of a zero-length
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2015-11-28 03:56:33 +03:00
|
|
|
nsString mTextEmphasisStyleString; // [inherited]
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool WhiteSpaceIsSignificant() const {
|
2002-11-15 06:14:56 +03:00
|
|
|
return mWhiteSpace == NS_STYLE_WHITESPACE_PRE ||
|
2012-09-07 09:42:19 +04:00
|
|
|
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_WRAP ||
|
2014-06-05 07:25:15 +04:00
|
|
|
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_SPACE;
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
2006-10-19 05:47:47 +04:00
|
|
|
|
2015-03-17 11:10:15 +03:00
|
|
|
bool NewlineIsSignificantStyle() const {
|
2008-08-12 12:31:56 +04:00
|
|
|
return mWhiteSpace == NS_STYLE_WHITESPACE_PRE ||
|
|
|
|
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_WRAP ||
|
|
|
|
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_LINE;
|
2012-09-07 09:42:19 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool WhiteSpaceOrNewlineIsSignificant() const {
|
|
|
|
return mWhiteSpace == NS_STYLE_WHITESPACE_PRE ||
|
|
|
|
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_WRAP ||
|
|
|
|
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_LINE ||
|
2014-06-05 07:25:15 +04:00
|
|
|
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_SPACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TabIsSignificant() const {
|
|
|
|
return mWhiteSpace == NS_STYLE_WHITESPACE_PRE ||
|
|
|
|
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_WRAP;
|
2008-08-12 12:31:56 +04:00
|
|
|
}
|
|
|
|
|
2013-03-25 07:50:59 +04:00
|
|
|
bool WhiteSpaceCanWrapStyle() const {
|
2006-10-19 05:47:47 +04:00
|
|
|
return mWhiteSpace == NS_STYLE_WHITESPACE_NORMAL ||
|
2008-08-12 12:31:56 +04:00
|
|
|
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_WRAP ||
|
|
|
|
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_LINE;
|
2006-10-19 05:47:47 +04:00
|
|
|
}
|
2008-07-24 11:16:18 +04:00
|
|
|
|
2013-03-25 07:50:59 +04:00
|
|
|
bool WordCanWrapStyle() const {
|
|
|
|
return WhiteSpaceCanWrapStyle() &&
|
|
|
|
mWordWrap == NS_STYLE_WORDWRAP_BREAK_WORD;
|
2008-07-24 11:16:18 +04:00
|
|
|
}
|
2012-08-08 15:37:13 +04:00
|
|
|
|
2015-11-28 03:56:33 +03:00
|
|
|
bool HasTextEmphasis() const {
|
|
|
|
return !mTextEmphasisStyleString.IsEmpty();
|
|
|
|
}
|
|
|
|
|
2012-08-08 15:37:13 +04:00
|
|
|
// These are defined in nsStyleStructInlines.h.
|
2014-01-13 16:21:42 +04:00
|
|
|
inline bool HasTextShadow() const;
|
|
|
|
inline nsCSSShadowArray* GetTextShadow() const;
|
2013-04-07 03:40:07 +04:00
|
|
|
|
|
|
|
// The aContextFrame argument on each of these is the frame this
|
2015-03-17 11:10:15 +03:00
|
|
|
// style struct is for. If the frame is for SVG text or inside ruby,
|
|
|
|
// the return value will be massaged to be something that makes sense
|
|
|
|
// for those cases.
|
2015-05-04 00:52:53 +03:00
|
|
|
inline bool NewlineIsSignificant(const nsTextFrame* aContextFrame) const;
|
2013-04-07 03:40:07 +04:00
|
|
|
inline bool WhiteSpaceCanWrap(const nsIFrame* aContextFrame) const;
|
|
|
|
inline bool WordCanWrap(const nsIFrame* aContextFrame) const;
|
2015-11-28 03:56:33 +03:00
|
|
|
|
|
|
|
mozilla::LogicalSide TextEmphasisSide(mozilla::WritingMode aWM) const;
|
2001-06-01 02:19:43 +04:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleImageOrientation
|
|
|
|
{
|
2013-08-29 02:39:06 +04:00
|
|
|
static nsStyleImageOrientation CreateAsAngleAndFlip(double aRadians,
|
|
|
|
bool aFlip) {
|
|
|
|
uint8_t orientation(0);
|
|
|
|
|
|
|
|
// Compute the final angle value, rounding to the closest quarter turn.
|
|
|
|
double roundedAngle = fmod(aRadians, 2 * M_PI);
|
|
|
|
if (roundedAngle < 0.25 * M_PI) orientation = ANGLE_0;
|
|
|
|
else if (roundedAngle < 0.75 * M_PI) orientation = ANGLE_90;
|
|
|
|
else if (roundedAngle < 1.25 * M_PI) orientation = ANGLE_180;
|
|
|
|
else if (roundedAngle < 1.75 * M_PI) orientation = ANGLE_270;
|
|
|
|
else orientation = ANGLE_0;
|
|
|
|
|
|
|
|
// Add a bit for 'flip' if needed.
|
|
|
|
if (aFlip)
|
|
|
|
orientation |= FLIP_MASK;
|
|
|
|
|
|
|
|
return nsStyleImageOrientation(orientation);
|
|
|
|
}
|
|
|
|
|
|
|
|
static nsStyleImageOrientation CreateAsFlip() {
|
|
|
|
return nsStyleImageOrientation(FLIP_MASK);
|
|
|
|
}
|
|
|
|
|
|
|
|
static nsStyleImageOrientation CreateAsFromImage() {
|
|
|
|
return nsStyleImageOrientation(FROM_IMAGE_MASK);
|
|
|
|
}
|
|
|
|
|
|
|
|
// The default constructor yields 0 degrees of rotation and no flip.
|
|
|
|
nsStyleImageOrientation() : mOrientation(0) { }
|
|
|
|
|
|
|
|
bool IsDefault() const { return mOrientation == 0; }
|
|
|
|
bool IsFlipped() const { return mOrientation & FLIP_MASK; }
|
|
|
|
bool IsFromImage() const { return mOrientation & FROM_IMAGE_MASK; }
|
2014-05-28 00:53:34 +04:00
|
|
|
bool SwapsWidthAndHeight() const {
|
|
|
|
uint8_t angle = mOrientation & ORIENTATION_MASK;
|
|
|
|
return (angle == ANGLE_90) || (angle == ANGLE_270);
|
|
|
|
}
|
2013-08-29 02:39:06 +04:00
|
|
|
|
|
|
|
mozilla::image::Angle Angle() const {
|
|
|
|
switch (mOrientation & ORIENTATION_MASK) {
|
|
|
|
case ANGLE_0: return mozilla::image::Angle::D0;
|
|
|
|
case ANGLE_90: return mozilla::image::Angle::D90;
|
|
|
|
case ANGLE_180: return mozilla::image::Angle::D180;
|
|
|
|
case ANGLE_270: return mozilla::image::Angle::D270;
|
|
|
|
default:
|
|
|
|
NS_NOTREACHED("Unexpected angle");
|
|
|
|
return mozilla::image::Angle::D0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nsStyleCoord AngleAsCoord() const {
|
|
|
|
switch (mOrientation & ORIENTATION_MASK) {
|
|
|
|
case ANGLE_0: return nsStyleCoord(0.0f, eStyleUnit_Degree);
|
|
|
|
case ANGLE_90: return nsStyleCoord(90.0f, eStyleUnit_Degree);
|
|
|
|
case ANGLE_180: return nsStyleCoord(180.0f, eStyleUnit_Degree);
|
|
|
|
case ANGLE_270: return nsStyleCoord(270.0f, eStyleUnit_Degree);
|
|
|
|
default:
|
|
|
|
NS_NOTREACHED("Unexpected angle");
|
|
|
|
return nsStyleCoord();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator==(const nsStyleImageOrientation& aOther) const {
|
|
|
|
return aOther.mOrientation == mOrientation;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator!=(const nsStyleImageOrientation& aOther) const {
|
|
|
|
return !(*this == aOther);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
enum Bits {
|
|
|
|
ORIENTATION_MASK = 0x1 | 0x2, // The bottom two bits are the angle.
|
|
|
|
FLIP_MASK = 0x4, // Whether the image should be flipped.
|
|
|
|
FROM_IMAGE_MASK = 0x8, // Whether the image's inherent orientation
|
|
|
|
}; // should be used.
|
|
|
|
|
|
|
|
enum Angles {
|
|
|
|
ANGLE_0 = 0,
|
|
|
|
ANGLE_90 = 1,
|
|
|
|
ANGLE_180 = 2,
|
|
|
|
ANGLE_270 = 3,
|
|
|
|
};
|
|
|
|
|
|
|
|
explicit nsStyleImageOrientation(uint8_t aOrientation)
|
|
|
|
: mOrientation(aOrientation)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
uint8_t mOrientation;
|
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleVisibility
|
|
|
|
{
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStyleVisibility(StyleStructContext aContext);
|
2001-06-01 02:19:43 +04:00
|
|
|
nsStyleVisibility(const nsStyleVisibility& aVisibility);
|
2009-08-07 18:38:44 +04:00
|
|
|
~nsStyleVisibility() {
|
|
|
|
MOZ_COUNT_DTOR(nsStyleVisibility);
|
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStyleVisibility* aSelf) CPP_THROW_NEW { return aSelf; }
|
2004-08-01 03:15:21 +04:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
2014-07-16 09:27:13 +04:00
|
|
|
return aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStyleVisibility, sz);
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
2004-08-01 03:15:21 +04:00
|
|
|
void Destroy(nsPresContext* aContext) {
|
2001-06-02 01:04:23 +04:00
|
|
|
this->~nsStyleVisibility();
|
2014-07-16 09:27:13 +04:00
|
|
|
aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
FreeByObjectID(mozilla::eArenaObjectID_nsStyleVisibility, this);
|
2007-04-23 18:21:53 +04:00
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2002-08-24 18:41:28 +04:00
|
|
|
nsChangeHint CalcDifference(const nsStyleVisibility& aOther) const;
|
2012-09-07 21:13:36 +04:00
|
|
|
static nsChangeHint MaxDifference() {
|
2016-03-08 20:25:24 +03:00
|
|
|
return NS_STYLE_HINT_FRAMECHANGE |
|
|
|
|
nsChangeHint_NeutralChange;
|
2012-09-07 21:13:36 +04:00
|
|
|
}
|
2015-06-21 07:54:15 +03:00
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
2015-06-21 07:54:15 +03:00
|
|
|
// CalcDifference never returns the reflow hints that are sometimes
|
|
|
|
// handled for descendants as hints not handled for descendants.
|
|
|
|
return nsChangeHint_NeedReflow |
|
|
|
|
nsChangeHint_ReflowChangesSizeOrPosition |
|
|
|
|
nsChangeHint_ClearAncestorIntrinsics;
|
2014-01-03 06:39:54 +04:00
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2013-08-29 02:39:06 +04:00
|
|
|
nsStyleImageOrientation mImageOrientation; // [inherited]
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mDirection; // [inherited] see nsStyleConsts.h NS_STYLE_DIRECTION_*
|
2012-11-02 14:42:59 +04:00
|
|
|
uint8_t mVisible; // [inherited]
|
2016-04-12 08:52:40 +03:00
|
|
|
uint8_t mImageRendering; // [inherited] see nsStyleConsts.h
|
2013-05-28 20:00:49 +04:00
|
|
|
uint8_t mWritingMode; // [inherited] see nsStyleConsts.h
|
2014-12-11 21:56:19 +03:00
|
|
|
uint8_t mTextOrientation; // [inherited] see nsStyleConsts.h
|
2016-03-08 20:25:24 +03:00
|
|
|
uint8_t mColorAdjust; // [inherited] see nsStyleConsts.h
|
2009-08-27 07:53:35 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsVisible() const {
|
2008-08-05 02:15:11 +04:00
|
|
|
return (mVisible == NS_STYLE_VISIBILITY_VISIBLE);
|
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsVisibleOrCollapsed() const {
|
2008-08-05 02:15:11 +04:00
|
|
|
return ((mVisible == NS_STYLE_VISIBILITY_VISIBLE) ||
|
|
|
|
(mVisible == NS_STYLE_VISIBILITY_COLLAPSE));
|
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsTimingFunction
|
|
|
|
{
|
2015-09-29 05:20:13 +03:00
|
|
|
|
|
|
|
enum class Type {
|
|
|
|
Ease, // ease
|
|
|
|
Linear, // linear
|
|
|
|
EaseIn, // ease-in
|
|
|
|
EaseOut, // ease-out
|
|
|
|
EaseInOut, // ease-in-out
|
|
|
|
StepStart, // step-start and steps(..., start)
|
|
|
|
StepEnd, // step-end, steps(..., end) and steps(...)
|
|
|
|
CubicBezier, // cubic-bezier()
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class StepSyntax {
|
|
|
|
Keyword, // step-start and step-end
|
|
|
|
FunctionalWithoutKeyword, // steps(...)
|
|
|
|
FunctionalWithStartKeyword, // steps(..., start)
|
|
|
|
FunctionalWithEndKeyword, // steps(..., end)
|
|
|
|
};
|
|
|
|
|
|
|
|
// Whether the timing function type is represented by a spline,
|
|
|
|
// and thus will have mFunc filled in.
|
|
|
|
static bool IsSplineType(Type aType)
|
|
|
|
{
|
|
|
|
return aType != Type::StepStart && aType != Type::StepEnd;
|
|
|
|
}
|
2011-04-12 10:18:42 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
explicit nsTimingFunction(int32_t aTimingFunctionType
|
2009-08-21 01:52:47 +04:00
|
|
|
= NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE)
|
|
|
|
{
|
|
|
|
AssignFromKeyword(aTimingFunctionType);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsTimingFunction(float x1, float y1, float x2, float y2)
|
2015-09-29 05:20:13 +03:00
|
|
|
: mType(Type::CubicBezier)
|
2011-04-12 10:18:42 +04:00
|
|
|
{
|
|
|
|
mFunc.mX1 = x1;
|
|
|
|
mFunc.mY1 = y1;
|
|
|
|
mFunc.mX2 = x2;
|
|
|
|
mFunc.mY2 = y2;
|
|
|
|
}
|
|
|
|
|
2015-09-29 05:20:13 +03:00
|
|
|
enum class Keyword { Implicit, Explicit };
|
|
|
|
|
|
|
|
nsTimingFunction(Type aType, uint32_t aSteps, Keyword aKeyword)
|
2011-04-12 10:18:42 +04:00
|
|
|
: mType(aType)
|
|
|
|
{
|
2015-09-29 05:20:13 +03:00
|
|
|
MOZ_ASSERT(mType == Type::StepStart || mType == Type::StepEnd,
|
|
|
|
"wrong type");
|
2011-04-12 10:18:42 +04:00
|
|
|
mSteps = aSteps;
|
2015-09-29 05:20:13 +03:00
|
|
|
if (mType == Type::StepStart) {
|
|
|
|
MOZ_ASSERT(aKeyword == Keyword::Explicit,
|
|
|
|
"only StepEnd can have an implicit keyword");
|
|
|
|
mStepSyntax = StepSyntax::FunctionalWithStartKeyword;
|
|
|
|
} else {
|
|
|
|
mStepSyntax = aKeyword == Keyword::Explicit ?
|
|
|
|
StepSyntax::FunctionalWithEndKeyword :
|
|
|
|
StepSyntax::FunctionalWithoutKeyword;
|
|
|
|
}
|
2011-04-12 10:18:42 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsTimingFunction(const nsTimingFunction& aOther)
|
|
|
|
{
|
2011-04-22 07:17:30 +04:00
|
|
|
*this = aOther;
|
2011-04-12 10:18:42 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
Type mType;
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
float mX1;
|
|
|
|
float mY1;
|
|
|
|
float mX2;
|
|
|
|
float mY2;
|
|
|
|
} mFunc;
|
2015-09-29 05:20:13 +03:00
|
|
|
struct {
|
|
|
|
StepSyntax mStepSyntax;
|
|
|
|
uint32_t mSteps;
|
|
|
|
};
|
2011-04-12 10:18:42 +04:00
|
|
|
};
|
|
|
|
|
2011-04-22 07:17:30 +04:00
|
|
|
nsTimingFunction&
|
|
|
|
operator=(const nsTimingFunction& aOther)
|
|
|
|
{
|
|
|
|
if (&aOther == this)
|
|
|
|
return *this;
|
|
|
|
|
|
|
|
mType = aOther.mType;
|
|
|
|
|
2015-09-29 05:20:13 +03:00
|
|
|
if (HasSpline()) {
|
2011-04-22 07:17:30 +04:00
|
|
|
mFunc.mX1 = aOther.mFunc.mX1;
|
|
|
|
mFunc.mY1 = aOther.mFunc.mY1;
|
|
|
|
mFunc.mX2 = aOther.mFunc.mX2;
|
|
|
|
mFunc.mY2 = aOther.mFunc.mY2;
|
|
|
|
} else {
|
|
|
|
mSteps = aOther.mSteps;
|
2015-09-29 05:20:13 +03:00
|
|
|
mStepSyntax = aOther.mStepSyntax;
|
2011-04-22 07:17:30 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2011-04-12 10:18:42 +04:00
|
|
|
bool operator==(const nsTimingFunction& aOther) const
|
2009-08-21 01:52:47 +04:00
|
|
|
{
|
2011-04-12 10:18:42 +04:00
|
|
|
if (mType != aOther.mType) {
|
|
|
|
return false;
|
|
|
|
}
|
2015-09-29 05:20:13 +03:00
|
|
|
if (HasSpline()) {
|
2011-04-12 10:18:42 +04:00
|
|
|
return mFunc.mX1 == aOther.mFunc.mX1 && mFunc.mY1 == aOther.mFunc.mY1 &&
|
|
|
|
mFunc.mX2 == aOther.mFunc.mX2 && mFunc.mY2 == aOther.mFunc.mY2;
|
|
|
|
}
|
2015-09-29 05:20:13 +03:00
|
|
|
return mSteps == aOther.mSteps &&
|
|
|
|
mStepSyntax == aOther.mStepSyntax;
|
2009-08-21 01:52:47 +04:00
|
|
|
}
|
|
|
|
|
2011-04-12 10:18:42 +04:00
|
|
|
bool operator!=(const nsTimingFunction& aOther) const
|
2009-08-21 01:52:47 +04:00
|
|
|
{
|
2011-04-12 10:18:42 +04:00
|
|
|
return !(*this == aOther);
|
2009-08-21 01:52:47 +04:00
|
|
|
}
|
|
|
|
|
2015-09-29 05:20:13 +03:00
|
|
|
bool HasSpline() const { return IsSplineType(mType); }
|
|
|
|
|
2009-08-21 01:52:47 +04:00
|
|
|
private:
|
2012-08-22 19:56:38 +04:00
|
|
|
void AssignFromKeyword(int32_t aTimingFunctionType);
|
2009-08-21 01:52:47 +04:00
|
|
|
};
|
|
|
|
|
2014-06-27 03:57:12 +04:00
|
|
|
namespace mozilla {
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct StyleTransition
|
|
|
|
{
|
2014-06-27 03:57:12 +04:00
|
|
|
StyleTransition() { /* leaves uninitialized; see also SetInitialValues */ }
|
|
|
|
explicit StyleTransition(const StyleTransition& aCopy);
|
2009-08-21 01:52:47 +04:00
|
|
|
|
|
|
|
void SetInitialValues();
|
|
|
|
|
|
|
|
// Delay and Duration are in milliseconds
|
|
|
|
|
|
|
|
const nsTimingFunction& GetTimingFunction() const { return mTimingFunction; }
|
|
|
|
float GetDelay() const { return mDelay; }
|
|
|
|
float GetDuration() const { return mDuration; }
|
|
|
|
nsCSSProperty GetProperty() const { return mProperty; }
|
|
|
|
nsIAtom* GetUnknownProperty() const { return mUnknownProperty; }
|
|
|
|
|
2015-02-19 03:49:51 +03:00
|
|
|
float GetCombinedDuration() const {
|
|
|
|
// http://dev.w3.org/csswg/css-transitions/#combined-duration
|
|
|
|
return std::max(mDuration, 0.0f) + mDelay;
|
|
|
|
}
|
|
|
|
|
2009-08-21 01:52:47 +04:00
|
|
|
void SetTimingFunction(const nsTimingFunction& aTimingFunction)
|
|
|
|
{ mTimingFunction = aTimingFunction; }
|
|
|
|
void SetDelay(float aDelay) { mDelay = aDelay; }
|
|
|
|
void SetDuration(float aDuration) { mDuration = aDuration; }
|
|
|
|
void SetProperty(nsCSSProperty aProperty)
|
|
|
|
{
|
2015-11-25 04:45:02 +03:00
|
|
|
NS_ASSERTION(aProperty != eCSSProperty_UNKNOWN &&
|
|
|
|
aProperty != eCSSPropertyExtra_variable,
|
|
|
|
"invalid property");
|
2009-08-21 01:52:47 +04:00
|
|
|
mProperty = aProperty;
|
|
|
|
}
|
2015-11-25 04:45:02 +03:00
|
|
|
void SetUnknownProperty(nsCSSProperty aProperty,
|
|
|
|
const nsAString& aPropertyString);
|
2014-06-27 03:57:12 +04:00
|
|
|
void CopyPropertyFrom(const StyleTransition& aOther)
|
2009-08-21 01:52:47 +04:00
|
|
|
{
|
|
|
|
mProperty = aOther.mProperty;
|
|
|
|
mUnknownProperty = aOther.mUnknownProperty;
|
|
|
|
}
|
|
|
|
|
2011-04-22 07:17:30 +04:00
|
|
|
nsTimingFunction& TimingFunctionSlot() { return mTimingFunction; }
|
|
|
|
|
2014-09-05 07:48:43 +04:00
|
|
|
bool operator==(const StyleTransition& aOther) const;
|
|
|
|
bool operator!=(const StyleTransition& aOther) const
|
|
|
|
{ return !(*this == aOther); }
|
|
|
|
|
2009-08-21 01:52:47 +04:00
|
|
|
private:
|
|
|
|
nsTimingFunction mTimingFunction;
|
|
|
|
float mDuration;
|
|
|
|
float mDelay;
|
|
|
|
nsCSSProperty mProperty;
|
|
|
|
nsCOMPtr<nsIAtom> mUnknownProperty; // used when mProperty is
|
2015-11-25 04:45:02 +03:00
|
|
|
// eCSSProperty_UNKNOWN or
|
|
|
|
// eCSSPropertyExtra_variable
|
2009-08-21 01:52:47 +04:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct StyleAnimation
|
|
|
|
{
|
2014-06-27 03:57:11 +04:00
|
|
|
StyleAnimation() { /* leaves uninitialized; see also SetInitialValues */ }
|
|
|
|
explicit StyleAnimation(const StyleAnimation& aCopy);
|
2011-04-12 10:18:42 +04:00
|
|
|
|
|
|
|
void SetInitialValues();
|
|
|
|
|
|
|
|
// Delay and Duration are in milliseconds
|
|
|
|
|
|
|
|
const nsTimingFunction& GetTimingFunction() const { return mTimingFunction; }
|
|
|
|
float GetDelay() const { return mDelay; }
|
|
|
|
float GetDuration() const { return mDuration; }
|
|
|
|
const nsString& GetName() const { return mName; }
|
2015-11-20 08:09:00 +03:00
|
|
|
dom::PlaybackDirection GetDirection() const { return mDirection; }
|
|
|
|
dom::FillMode GetFillMode() const { return mFillMode; }
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t GetPlayState() const { return mPlayState; }
|
2011-04-12 10:18:42 +04:00
|
|
|
float GetIterationCount() const { return mIterationCount; }
|
|
|
|
|
|
|
|
void SetTimingFunction(const nsTimingFunction& aTimingFunction)
|
|
|
|
{ mTimingFunction = aTimingFunction; }
|
|
|
|
void SetDelay(float aDelay) { mDelay = aDelay; }
|
|
|
|
void SetDuration(float aDuration) { mDuration = aDuration; }
|
|
|
|
void SetName(const nsSubstring& aName) { mName = aName; }
|
2015-11-20 08:09:00 +03:00
|
|
|
void SetDirection(dom::PlaybackDirection aDirection) { mDirection = aDirection; }
|
|
|
|
void SetFillMode(dom::FillMode aFillMode) { mFillMode = aFillMode; }
|
2012-08-22 19:56:38 +04:00
|
|
|
void SetPlayState(uint8_t aPlayState) { mPlayState = aPlayState; }
|
2011-04-12 10:18:42 +04:00
|
|
|
void SetIterationCount(float aIterationCount)
|
|
|
|
{ mIterationCount = aIterationCount; }
|
|
|
|
|
2011-04-22 07:17:30 +04:00
|
|
|
nsTimingFunction& TimingFunctionSlot() { return mTimingFunction; }
|
|
|
|
|
2014-09-05 07:48:43 +04:00
|
|
|
bool operator==(const StyleAnimation& aOther) const;
|
|
|
|
bool operator!=(const StyleAnimation& aOther) const
|
|
|
|
{ return !(*this == aOther); }
|
|
|
|
|
2011-04-12 10:18:42 +04:00
|
|
|
private:
|
|
|
|
nsTimingFunction mTimingFunction;
|
|
|
|
float mDuration;
|
|
|
|
float mDelay;
|
|
|
|
nsString mName; // empty string for 'none'
|
2015-11-20 08:09:00 +03:00
|
|
|
dom::PlaybackDirection mDirection;
|
|
|
|
dom::FillMode mFillMode;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mPlayState;
|
2014-06-11 09:19:07 +04:00
|
|
|
float mIterationCount; // mozilla::PositiveInfinity<float>() means infinite
|
2011-04-12 10:18:42 +04:00
|
|
|
};
|
|
|
|
|
2014-06-27 03:57:11 +04:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleDisplay
|
|
|
|
{
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStyleDisplay(StyleStructContext aContext);
|
2010-04-27 20:15:01 +04:00
|
|
|
nsStyleDisplay(const nsStyleDisplay& aOther);
|
2009-08-07 18:38:44 +04:00
|
|
|
~nsStyleDisplay() {
|
|
|
|
MOZ_COUNT_DTOR(nsStyleDisplay);
|
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStyleDisplay* aSelf) CPP_THROW_NEW { return aSelf; }
|
2004-08-01 03:15:21 +04:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
2014-07-16 09:27:13 +04:00
|
|
|
return aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStyleDisplay, sz);
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
2004-08-01 03:15:21 +04:00
|
|
|
void Destroy(nsPresContext* aContext) {
|
2001-06-02 01:04:23 +04:00
|
|
|
this->~nsStyleDisplay();
|
2014-07-16 09:27:13 +04:00
|
|
|
aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
FreeByObjectID(mozilla::eArenaObjectID_nsStyleDisplay, this);
|
2007-04-23 18:21:53 +04:00
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2002-08-24 18:41:28 +04:00
|
|
|
nsChangeHint CalcDifference(const nsStyleDisplay& aOther) const;
|
2012-09-07 21:13:36 +04:00
|
|
|
static nsChangeHint MaxDifference() {
|
|
|
|
// All the parts of FRAMECHANGE are present in CalcDifference.
|
|
|
|
return nsChangeHint(NS_STYLE_HINT_FRAMECHANGE |
|
|
|
|
nsChangeHint_UpdateOpacityLayer |
|
2015-12-01 08:25:54 +03:00
|
|
|
nsChangeHint_UpdateUsesOpacity |
|
2015-03-20 07:12:17 +03:00
|
|
|
nsChangeHint_UpdateTransformLayer |
|
|
|
|
nsChangeHint_UpdateOverflow |
|
|
|
|
nsChangeHint_UpdatePostTransformOverflow |
|
2015-08-04 06:18:00 +03:00
|
|
|
nsChangeHint_UpdateContainingBlock |
|
2014-09-05 07:48:43 +04:00
|
|
|
nsChangeHint_NeutralChange);
|
2012-09-07 21:13:36 +04:00
|
|
|
}
|
2015-06-21 07:54:15 +03:00
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
2015-06-21 07:54:15 +03:00
|
|
|
// CalcDifference can return all of the reflow hints that are
|
|
|
|
// sometimes handled for descendants as hints not handled for
|
|
|
|
// descendants.
|
2014-01-03 06:39:54 +04:00
|
|
|
return nsChangeHint(0);
|
|
|
|
}
|
2007-07-19 01:56:57 +04:00
|
|
|
|
2016-01-28 08:24:00 +03:00
|
|
|
// XXXdholbert, XXXkgilbert nsStyleImageLayers::Position should probably be
|
2014-02-04 05:54:22 +04:00
|
|
|
// moved to a different scope, since we're now using it in multiple style
|
|
|
|
// structs.
|
2016-01-28 08:24:00 +03:00
|
|
|
typedef nsStyleImageLayers::Position Position;
|
2014-02-04 05:54:22 +04:00
|
|
|
|
2011-05-11 19:28:53 +04:00
|
|
|
// We guarantee that if mBinding is non-null, so are mBinding->GetURI() and
|
2007-07-19 01:56:57 +04:00
|
|
|
// mBinding->mOriginPrincipal.
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::css::URLValue> mBinding; // [reset]
|
2015-03-20 07:12:17 +03:00
|
|
|
nsRect mClip; // [reset] offsets from upper-left border edge
|
2003-11-02 01:34:59 +03:00
|
|
|
float mOpacity; // [reset]
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mDisplay; // [reset] see nsStyleConsts.h NS_STYLE_DISPLAY_*
|
|
|
|
uint8_t mOriginalDisplay; // [reset] saved mDisplay for position:absolute/fixed
|
2011-10-29 11:04:20 +04:00
|
|
|
// and float:left/right; otherwise equal
|
|
|
|
// to mDisplay
|
2015-06-04 17:38:00 +03:00
|
|
|
uint8_t mContain; // [reset] see nsStyleConsts.h NS_STYLE_CONTAIN_*
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mAppearance; // [reset]
|
|
|
|
uint8_t mPosition; // [reset] see nsStyleConsts.h
|
|
|
|
uint8_t mFloats; // [reset] see nsStyleConsts.h NS_STYLE_FLOAT_*
|
|
|
|
uint8_t mOriginalFloats; // [reset] saved mFloats for position:absolute/fixed;
|
2011-10-29 11:04:20 +04:00
|
|
|
// otherwise equal to mFloats
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mBreakType; // [reset] see nsStyleConsts.h NS_STYLE_CLEAR_*
|
2012-11-08 20:09:37 +04:00
|
|
|
uint8_t mBreakInside; // [reset] NS_STYLE_PAGE_BREAK_AUTO/AVOID
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mBreakBefore; // [reset]
|
|
|
|
bool mBreakAfter; // [reset]
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mOverflowX; // [reset] see nsStyleConsts.h
|
|
|
|
uint8_t mOverflowY; // [reset] see nsStyleConsts.h
|
2014-02-22 05:18:23 +04:00
|
|
|
uint8_t mOverflowClipBox; // [reset] see nsStyleConsts.h
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mResize; // [reset] see nsStyleConsts.h
|
2015-03-20 07:12:17 +03:00
|
|
|
uint8_t mClipFlags; // [reset] see nsStyleConsts.h
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mOrient; // [reset] see nsStyleConsts.h
|
2013-08-07 11:59:10 +04:00
|
|
|
uint8_t mMixBlendMode; // [reset] see nsStyleConsts.h
|
2014-10-15 16:13:00 +04:00
|
|
|
uint8_t mIsolation; // [reset] see nsStyleConsts.h
|
2015-10-07 06:04:32 +03:00
|
|
|
uint8_t mTopLayer; // [reset] see nsStyleConsts.h
|
2015-03-20 07:12:17 +03:00
|
|
|
uint8_t mWillChangeBitField; // [reset] see nsStyleConsts.h. Stores a
|
|
|
|
// bitfield representation of the properties
|
|
|
|
// that are frequently queried. This should
|
|
|
|
// match mWillChange. Also tracks if any of the
|
|
|
|
// properties in the will-change list require
|
|
|
|
// a stacking context.
|
2016-02-02 18:36:30 +03:00
|
|
|
AutoTArray<nsString, 1> mWillChange;
|
2013-11-22 20:48:27 +04:00
|
|
|
|
2014-01-15 19:03:15 +04:00
|
|
|
uint8_t mTouchAction; // [reset] see nsStyleConsts.h
|
2014-09-15 23:29:58 +04:00
|
|
|
uint8_t mScrollBehavior; // [reset] see nsStyleConsts.h NS_STYLE_SCROLL_BEHAVIOR_*
|
2014-02-04 05:54:22 +04:00
|
|
|
uint8_t mScrollSnapTypeX; // [reset] see nsStyleConsts.h NS_STYLE_SCROLL_SNAP_TYPE_*
|
|
|
|
uint8_t mScrollSnapTypeY; // [reset] see nsStyleConsts.h NS_STYLE_SCROLL_SNAP_TYPE_*
|
|
|
|
nsStyleCoord mScrollSnapPointsX; // [reset]
|
|
|
|
nsStyleCoord mScrollSnapPointsY; // [reset]
|
|
|
|
Position mScrollSnapDestination; // [reset]
|
|
|
|
nsTArray<Position> mScrollSnapCoordinate; // [reset]
|
2010-07-03 08:18:56 +04:00
|
|
|
|
2015-03-20 07:12:17 +03:00
|
|
|
// mSpecifiedTransform is the list of transform functions as
|
|
|
|
// specified, or null to indicate there is no transform. (inherit or
|
|
|
|
// initial are replaced by an actual list of transform functions, or
|
|
|
|
// null, as appropriate.)
|
|
|
|
uint8_t mBackfaceVisibility;
|
|
|
|
uint8_t mTransformStyle;
|
2015-05-16 00:43:25 +03:00
|
|
|
uint8_t mTransformBox; // [reset] see nsStyleConsts.h
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsCSSValueSharedList> mSpecifiedTransform; // [reset]
|
2015-03-20 07:12:17 +03:00
|
|
|
nsStyleCoord mTransformOrigin[3]; // [reset] percent, coord, calc, 3rd param is coord, calc only
|
2015-08-04 06:18:00 +03:00
|
|
|
nsStyleCoord mChildPerspective; // [reset] none, coord
|
2015-03-20 07:12:17 +03:00
|
|
|
nsStyleCoord mPerspectiveOrigin[2]; // [reset] percent, coord, calc
|
|
|
|
|
2016-04-12 08:52:41 +03:00
|
|
|
nsStyleCoord mVerticalAlign; // [reset] coord, percent, calc, enum (see nsStyleConsts.h)
|
|
|
|
|
2016-02-02 18:36:30 +03:00
|
|
|
AutoTArray<mozilla::StyleTransition, 1> mTransitions; // [reset]
|
2009-08-21 01:52:47 +04:00
|
|
|
// The number of elements in mTransitions that are not from repeating
|
|
|
|
// a list due to another property being longer.
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mTransitionTimingFunctionCount,
|
2009-08-21 01:52:47 +04:00
|
|
|
mTransitionDurationCount,
|
|
|
|
mTransitionDelayCount,
|
|
|
|
mTransitionPropertyCount;
|
2008-09-13 13:42:11 +04:00
|
|
|
|
2016-02-02 18:36:30 +03:00
|
|
|
AutoTArray<mozilla::StyleAnimation, 1> mAnimations; // [reset]
|
2011-04-12 10:18:42 +04:00
|
|
|
// The number of elements in mAnimations that are not from repeating
|
|
|
|
// a list due to another property being longer.
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mAnimationTimingFunctionCount,
|
2011-04-12 10:18:42 +04:00
|
|
|
mAnimationDurationCount,
|
|
|
|
mAnimationDelayCount,
|
|
|
|
mAnimationNameCount,
|
|
|
|
mAnimationDirectionCount,
|
|
|
|
mAnimationFillModeCount,
|
|
|
|
mAnimationPlayStateCount,
|
|
|
|
mAnimationIterationCountCount;
|
|
|
|
|
2012-08-02 15:38:51 +04:00
|
|
|
bool IsBlockInsideStyle() const {
|
2007-01-27 21:44:24 +03:00
|
|
|
return NS_STYLE_DISPLAY_BLOCK == mDisplay ||
|
|
|
|
NS_STYLE_DISPLAY_LIST_ITEM == mDisplay ||
|
2014-12-26 10:21:32 +03:00
|
|
|
NS_STYLE_DISPLAY_INLINE_BLOCK == mDisplay ||
|
|
|
|
NS_STYLE_DISPLAY_TABLE_CAPTION == mDisplay;
|
|
|
|
// Should TABLE_CELL be included here? They have
|
2007-01-27 21:44:24 +03:00
|
|
|
// block frames nested inside of them.
|
|
|
|
// (But please audit all callers before changing.)
|
|
|
|
}
|
|
|
|
|
2012-08-02 15:38:51 +04:00
|
|
|
bool IsBlockOutsideStyle() const {
|
2007-01-27 21:44:24 +03:00
|
|
|
return NS_STYLE_DISPLAY_BLOCK == mDisplay ||
|
2012-06-27 02:11:38 +04:00
|
|
|
NS_STYLE_DISPLAY_FLEX == mDisplay ||
|
2016-03-24 19:55:11 +03:00
|
|
|
NS_STYLE_DISPLAY_WEBKIT_BOX == mDisplay ||
|
2014-02-27 11:45:29 +04:00
|
|
|
NS_STYLE_DISPLAY_GRID == mDisplay ||
|
2007-01-27 21:44:24 +03:00
|
|
|
NS_STYLE_DISPLAY_LIST_ITEM == mDisplay ||
|
|
|
|
NS_STYLE_DISPLAY_TABLE == mDisplay;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static bool IsDisplayTypeInlineOutside(uint8_t aDisplay) {
|
2011-07-29 05:11:51 +04:00
|
|
|
return NS_STYLE_DISPLAY_INLINE == aDisplay ||
|
|
|
|
NS_STYLE_DISPLAY_INLINE_BLOCK == aDisplay ||
|
|
|
|
NS_STYLE_DISPLAY_INLINE_TABLE == aDisplay ||
|
|
|
|
NS_STYLE_DISPLAY_INLINE_BOX == aDisplay ||
|
2012-06-27 02:11:38 +04:00
|
|
|
NS_STYLE_DISPLAY_INLINE_FLEX == aDisplay ||
|
2016-03-24 19:55:11 +03:00
|
|
|
NS_STYLE_DISPLAY_WEBKIT_INLINE_BOX == aDisplay ||
|
2014-02-27 11:45:29 +04:00
|
|
|
NS_STYLE_DISPLAY_INLINE_GRID == aDisplay ||
|
2014-02-27 11:43:18 +04:00
|
|
|
NS_STYLE_DISPLAY_INLINE_XUL_GRID == aDisplay ||
|
2014-07-23 06:08:01 +04:00
|
|
|
NS_STYLE_DISPLAY_INLINE_STACK == aDisplay ||
|
|
|
|
NS_STYLE_DISPLAY_RUBY == aDisplay ||
|
|
|
|
NS_STYLE_DISPLAY_RUBY_BASE == aDisplay ||
|
|
|
|
NS_STYLE_DISPLAY_RUBY_BASE_CONTAINER == aDisplay ||
|
|
|
|
NS_STYLE_DISPLAY_RUBY_TEXT == aDisplay ||
|
2014-11-20 21:24:08 +03:00
|
|
|
NS_STYLE_DISPLAY_RUBY_TEXT_CONTAINER == aDisplay ||
|
|
|
|
NS_STYLE_DISPLAY_CONTENTS == aDisplay;
|
2011-07-29 05:11:51 +04:00
|
|
|
}
|
|
|
|
|
2012-08-02 15:38:51 +04:00
|
|
|
bool IsInlineOutsideStyle() const {
|
2011-07-29 05:11:51 +04:00
|
|
|
return IsDisplayTypeInlineOutside(mDisplay);
|
|
|
|
}
|
|
|
|
|
2012-08-02 15:38:51 +04:00
|
|
|
bool IsOriginalDisplayInlineOutsideStyle() const {
|
2011-07-29 05:11:51 +04:00
|
|
|
return IsDisplayTypeInlineOutside(mOriginalDisplay);
|
2007-01-27 21:44:24 +03:00
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2013-11-13 00:46:47 +04:00
|
|
|
bool IsInnerTableStyle() const {
|
|
|
|
return NS_STYLE_DISPLAY_TABLE_CAPTION == mDisplay ||
|
|
|
|
NS_STYLE_DISPLAY_TABLE_CELL == mDisplay ||
|
|
|
|
NS_STYLE_DISPLAY_TABLE_ROW == mDisplay ||
|
|
|
|
NS_STYLE_DISPLAY_TABLE_ROW_GROUP == mDisplay ||
|
|
|
|
NS_STYLE_DISPLAY_TABLE_HEADER_GROUP == mDisplay ||
|
|
|
|
NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP == mDisplay ||
|
|
|
|
NS_STYLE_DISPLAY_TABLE_COLUMN == mDisplay ||
|
|
|
|
NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP == mDisplay;
|
|
|
|
}
|
|
|
|
|
2012-08-02 15:38:49 +04:00
|
|
|
bool IsFloatingStyle() const {
|
2001-06-01 02:19:43 +04:00
|
|
|
return NS_STYLE_FLOAT_NONE != mFloats;
|
|
|
|
}
|
|
|
|
|
2012-08-02 15:38:50 +04:00
|
|
|
bool IsAbsolutelyPositionedStyle() const {
|
|
|
|
return NS_STYLE_POSITION_ABSOLUTE == mPosition ||
|
|
|
|
NS_STYLE_POSITION_FIXED == mPosition;
|
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2012-08-02 15:38:50 +04:00
|
|
|
bool IsRelativelyPositionedStyle() const {
|
2013-09-06 17:35:15 +04:00
|
|
|
return NS_STYLE_POSITION_RELATIVE == mPosition ||
|
|
|
|
NS_STYLE_POSITION_STICKY == mPosition;
|
2008-09-13 13:42:11 +04:00
|
|
|
}
|
2015-08-17 02:02:54 +03:00
|
|
|
bool IsPositionForcingStackingContext() const {
|
|
|
|
return NS_STYLE_POSITION_STICKY == mPosition ||
|
|
|
|
NS_STYLE_POSITION_FIXED == mPosition;
|
|
|
|
}
|
2004-09-03 03:18:37 +04:00
|
|
|
|
2014-11-26 07:53:18 +03:00
|
|
|
static bool IsRubyDisplayType(uint8_t aDisplay) {
|
|
|
|
return NS_STYLE_DISPLAY_RUBY == aDisplay ||
|
|
|
|
NS_STYLE_DISPLAY_RUBY_BASE == aDisplay ||
|
|
|
|
NS_STYLE_DISPLAY_RUBY_BASE_CONTAINER == aDisplay ||
|
|
|
|
NS_STYLE_DISPLAY_RUBY_TEXT == aDisplay ||
|
|
|
|
NS_STYLE_DISPLAY_RUBY_TEXT_CONTAINER == aDisplay;
|
|
|
|
}
|
|
|
|
|
2014-07-23 06:08:13 +04:00
|
|
|
bool IsRubyDisplayType() const {
|
2014-11-26 07:53:18 +03:00
|
|
|
return IsRubyDisplayType(mDisplay);
|
2014-07-23 06:08:13 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool IsOutOfFlowStyle() const {
|
|
|
|
return (IsAbsolutelyPositionedStyle() || IsFloatingStyle());
|
2014-07-23 06:08:01 +04:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsScrollableOverflow() const {
|
2004-09-05 04:04:04 +04:00
|
|
|
// mOverflowX and mOverflowY always match when one of them is
|
|
|
|
// NS_STYLE_OVERFLOW_VISIBLE or NS_STYLE_OVERFLOW_CLIP.
|
|
|
|
return mOverflowX != NS_STYLE_OVERFLOW_VISIBLE &&
|
|
|
|
mOverflowX != NS_STYLE_OVERFLOW_CLIP;
|
2004-09-03 03:18:37 +04:00
|
|
|
}
|
|
|
|
|
2015-11-09 15:32:00 +03:00
|
|
|
bool IsContainPaint() const {
|
|
|
|
return NS_STYLE_CONTAIN_PAINT & mContain;
|
|
|
|
}
|
|
|
|
|
2015-03-20 07:12:17 +03:00
|
|
|
/* Returns whether the element has the -moz-transform property
|
|
|
|
* or a related property. */
|
|
|
|
bool HasTransformStyle() const {
|
|
|
|
return mSpecifiedTransform != nullptr ||
|
|
|
|
mTransformStyle == NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D ||
|
|
|
|
(mWillChangeBitField & NS_STYLE_WILL_CHANGE_TRANSFORM);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool HasPerspectiveStyle() const {
|
|
|
|
return mChildPerspective.GetUnit() == eStyleUnit_Coord;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BackfaceIsHidden() const {
|
|
|
|
return mBackfaceVisibility == NS_STYLE_BACKFACE_VISIBILITY_HIDDEN;
|
|
|
|
}
|
|
|
|
|
2012-08-02 15:38:49 +04:00
|
|
|
// These are defined in nsStyleStructInlines.h.
|
2013-04-07 03:40:07 +04:00
|
|
|
|
|
|
|
// The aContextFrame argument on each of these is the frame this
|
|
|
|
// style struct is for. If the frame is for SVG text, the return
|
|
|
|
// value will be massaged to be something that makes sense for
|
|
|
|
// SVG text.
|
|
|
|
inline bool IsBlockInside(const nsIFrame* aContextFrame) const;
|
|
|
|
inline bool IsBlockOutside(const nsIFrame* aContextFrame) const;
|
|
|
|
inline bool IsInlineOutside(const nsIFrame* aContextFrame) const;
|
|
|
|
inline bool IsOriginalDisplayInlineOutside(const nsIFrame* aContextFrame) const;
|
|
|
|
inline uint8_t GetDisplay(const nsIFrame* aContextFrame) const;
|
|
|
|
inline bool IsFloating(const nsIFrame* aContextFrame) const;
|
2015-03-12 06:21:01 +03:00
|
|
|
inline bool IsAbsPosContainingBlock(const nsIFrame* aContextFrame) const;
|
2013-04-07 03:40:07 +04:00
|
|
|
inline bool IsRelativelyPositioned(const nsIFrame* aContextFrame) const;
|
|
|
|
inline bool IsAbsolutelyPositioned(const nsIFrame* aContextFrame) const;
|
2015-03-20 07:12:17 +03:00
|
|
|
|
|
|
|
// These methods are defined in nsStyleStructInlines.h.
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true when the element has the transform property
|
|
|
|
* or a related property, and supports CSS transforms.
|
|
|
|
* aContextFrame is the frame for which this is the nsStylePosition.
|
|
|
|
*/
|
|
|
|
inline bool HasTransform(const nsIFrame* aContextFrame) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true when the element is a containing block for its fixed-pos
|
|
|
|
* descendants.
|
|
|
|
* aContextFrame is the frame for which this is the nsStylePosition.
|
|
|
|
*/
|
|
|
|
inline bool IsFixedPosContainingBlock(const nsIFrame* aContextFrame) const;
|
2015-09-18 18:25:14 +03:00
|
|
|
|
|
|
|
// Return the 'float' and 'clear' properties, with inline-{start,end} values
|
|
|
|
// resolved to {left,right} according to the given writing mode. These are
|
|
|
|
// defined in WritingModes.h.
|
|
|
|
inline uint8_t PhysicalFloats(mozilla::WritingMode aWM) const;
|
|
|
|
inline uint8_t PhysicalBreakType(mozilla::WritingMode aWM) const;
|
2001-06-01 02:19:43 +04:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleTable
|
|
|
|
{
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStyleTable(StyleStructContext aContext);
|
2001-06-01 02:19:43 +04:00
|
|
|
nsStyleTable(const nsStyleTable& aOther);
|
|
|
|
~nsStyleTable(void);
|
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStyleTable* aSelf) CPP_THROW_NEW { return aSelf; }
|
2004-08-01 03:15:21 +04:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
2014-07-16 09:27:13 +04:00
|
|
|
return aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStyleTable, sz);
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
2004-08-01 03:15:21 +04:00
|
|
|
void Destroy(nsPresContext* aContext) {
|
2001-06-02 01:04:23 +04:00
|
|
|
this->~nsStyleTable();
|
2014-07-16 09:27:13 +04:00
|
|
|
aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
FreeByObjectID(mozilla::eArenaObjectID_nsStyleTable, this);
|
2007-04-23 18:21:53 +04:00
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2002-08-24 18:41:28 +04:00
|
|
|
nsChangeHint CalcDifference(const nsStyleTable& aOther) const;
|
2012-09-07 21:13:36 +04:00
|
|
|
static nsChangeHint MaxDifference() {
|
|
|
|
return NS_STYLE_HINT_FRAMECHANGE;
|
|
|
|
}
|
2015-06-21 07:54:15 +03:00
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
2015-06-21 07:54:15 +03:00
|
|
|
// CalcDifference never returns the reflow hints that are sometimes
|
|
|
|
// handled for descendants as hints not handled for descendants.
|
|
|
|
return nsChangeHint_NeedReflow |
|
|
|
|
nsChangeHint_ReflowChangesSizeOrPosition |
|
|
|
|
nsChangeHint_ClearAncestorIntrinsics;
|
2014-01-03 06:39:54 +04:00
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mLayoutStrategy;// [reset] see nsStyleConsts.h NS_STYLE_TABLE_LAYOUT_*
|
|
|
|
int32_t mSpan; // [reset] the number of columns spanned by a colgroup or col
|
2001-06-01 02:19:43 +04:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleTableBorder
|
|
|
|
{
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStyleTableBorder(StyleStructContext aContext);
|
2001-06-01 02:19:43 +04:00
|
|
|
nsStyleTableBorder(const nsStyleTableBorder& aOther);
|
|
|
|
~nsStyleTableBorder(void);
|
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStyleTableBorder* aSelf) CPP_THROW_NEW { return aSelf; }
|
2004-08-01 03:15:21 +04:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
2014-07-16 09:27:13 +04:00
|
|
|
return aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStyleTableBorder, sz);
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
2004-08-01 03:15:21 +04:00
|
|
|
void Destroy(nsPresContext* aContext) {
|
2001-06-02 01:04:23 +04:00
|
|
|
this->~nsStyleTableBorder();
|
2014-07-16 09:27:13 +04:00
|
|
|
aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
FreeByObjectID(mozilla::eArenaObjectID_nsStyleTableBorder, this);
|
2007-04-23 18:21:53 +04:00
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2002-08-24 18:41:28 +04:00
|
|
|
nsChangeHint CalcDifference(const nsStyleTableBorder& aOther) const;
|
2012-09-07 21:13:36 +04:00
|
|
|
static nsChangeHint MaxDifference() {
|
|
|
|
return NS_STYLE_HINT_FRAMECHANGE;
|
|
|
|
}
|
2015-06-21 07:54:15 +03:00
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
2015-06-21 07:54:15 +03:00
|
|
|
// CalcDifference never returns the reflow hints that are sometimes
|
|
|
|
// handled for descendants as hints not handled for descendants.
|
|
|
|
return nsChangeHint_NeedReflow |
|
|
|
|
nsChangeHint_ReflowChangesSizeOrPosition |
|
|
|
|
nsChangeHint_ClearAncestorIntrinsics;
|
2014-01-03 06:39:54 +04:00
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2015-03-20 07:16:00 +03:00
|
|
|
nscoord mBorderSpacingCol;// [inherited]
|
|
|
|
nscoord mBorderSpacingRow;// [inherited]
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mBorderCollapse;// [inherited]
|
|
|
|
uint8_t mCaptionSide; // [inherited]
|
|
|
|
uint8_t mEmptyCells; // [inherited]
|
2001-06-01 02:19:43 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum nsStyleContentType {
|
|
|
|
eStyleContentType_String = 1,
|
2004-07-15 02:19:22 +04:00
|
|
|
eStyleContentType_Image = 10,
|
2001-06-01 02:19:43 +04:00
|
|
|
eStyleContentType_Attr = 20,
|
|
|
|
eStyleContentType_Counter = 30,
|
|
|
|
eStyleContentType_Counters = 31,
|
|
|
|
eStyleContentType_OpenQuote = 40,
|
|
|
|
eStyleContentType_CloseQuote = 41,
|
|
|
|
eStyleContentType_NoOpenQuote = 42,
|
2005-09-18 22:05:40 +04:00
|
|
|
eStyleContentType_NoCloseQuote = 43,
|
2013-09-20 05:24:04 +04:00
|
|
|
eStyleContentType_AltContent = 50,
|
|
|
|
eStyleContentType_Uninitialized
|
2001-06-01 02:19:43 +04:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleContentData
|
|
|
|
{
|
2001-06-01 02:19:43 +04:00
|
|
|
nsStyleContentType mType;
|
2003-10-02 02:53:56 +04:00
|
|
|
union {
|
2014-01-04 19:02:17 +04:00
|
|
|
char16_t *mString;
|
2012-10-12 16:43:01 +04:00
|
|
|
imgRequestProxy *mImage;
|
2005-04-02 03:07:00 +04:00
|
|
|
nsCSSValue::Array* mCounters;
|
2003-10-02 02:53:56 +04:00
|
|
|
} mContent;
|
2010-08-06 21:27:01 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
bool mImageTracked;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
nsStyleContentData()
|
2013-09-20 05:24:04 +04:00
|
|
|
: mType(eStyleContentType_Uninitialized)
|
2010-08-06 21:27:01 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
, mImageTracked(false)
|
|
|
|
#endif
|
2012-07-30 18:20:58 +04:00
|
|
|
{ mContent.mString = nullptr; }
|
2003-10-02 02:53:56 +04:00
|
|
|
|
2004-07-15 02:19:22 +04:00
|
|
|
~nsStyleContentData();
|
|
|
|
nsStyleContentData& operator=(const nsStyleContentData& aOther);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool operator==(const nsStyleContentData& aOther) const;
|
2003-10-02 02:53:56 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool operator!=(const nsStyleContentData& aOther) const {
|
2003-10-02 02:53:56 +04:00
|
|
|
return !(*this == aOther);
|
|
|
|
}
|
2009-12-11 07:02:13 +03:00
|
|
|
|
2010-08-06 21:27:01 +04:00
|
|
|
void TrackImage(nsPresContext* aContext);
|
|
|
|
void UntrackImage(nsPresContext* aContext);
|
|
|
|
|
2012-10-12 16:43:01 +04:00
|
|
|
void SetImage(imgRequestProxy* aRequest)
|
2009-12-11 07:02:13 +03:00
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(!mImageTracked,
|
|
|
|
"Setting a new image without untracking the old one!");
|
|
|
|
MOZ_ASSERT(mType == eStyleContentType_Image, "Wrong type!");
|
2009-12-11 07:02:13 +03:00
|
|
|
NS_IF_ADDREF(mContent.mImage = aRequest);
|
|
|
|
}
|
2005-04-02 03:07:00 +04:00
|
|
|
private:
|
|
|
|
nsStyleContentData(const nsStyleContentData&); // not to be implemented
|
2001-06-01 02:19:43 +04:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleCounterData
|
|
|
|
{
|
2001-06-01 02:19:43 +04:00
|
|
|
nsString mCounter;
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mValue;
|
2001-06-01 02:19:43 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
#define DELETE_ARRAY_IF(array) if (array) { delete[] array; array = nullptr; }
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleContent
|
|
|
|
{
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStyleContent(StyleStructContext aContext);
|
2001-06-01 02:19:43 +04:00
|
|
|
nsStyleContent(const nsStyleContent& aContent);
|
|
|
|
~nsStyleContent(void);
|
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStyleContent* aSelf) CPP_THROW_NEW { return aSelf; }
|
2004-08-01 03:15:21 +04:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
2014-07-16 09:27:13 +04:00
|
|
|
return aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStyleContent, sz);
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
2010-08-06 21:27:01 +04:00
|
|
|
void Destroy(nsPresContext* aContext);
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2002-08-24 18:41:28 +04:00
|
|
|
nsChangeHint CalcDifference(const nsStyleContent& aOther) const;
|
2012-09-07 21:13:36 +04:00
|
|
|
static nsChangeHint MaxDifference() {
|
|
|
|
return NS_STYLE_HINT_FRAMECHANGE;
|
|
|
|
}
|
2015-06-21 07:54:15 +03:00
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
2015-06-21 07:54:15 +03:00
|
|
|
// CalcDifference never returns the reflow hints that are sometimes
|
|
|
|
// handled for descendants as hints not handled for descendants.
|
|
|
|
return nsChangeHint_NeedReflow |
|
|
|
|
nsChangeHint_ReflowChangesSizeOrPosition |
|
|
|
|
nsChangeHint_ClearAncestorIntrinsics;
|
2014-01-03 06:39:54 +04:00
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t ContentCount(void) const { return mContentCount; } // [reset]
|
2003-10-02 02:53:56 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
const nsStyleContentData& ContentAt(uint32_t aIndex) const {
|
2003-10-02 02:53:56 +04:00
|
|
|
NS_ASSERTION(aIndex < mContentCount, "out of range");
|
|
|
|
return mContents[aIndex];
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsStyleContentData& ContentAt(uint32_t aIndex) {
|
2003-10-02 02:53:56 +04:00
|
|
|
NS_ASSERTION(aIndex < mContentCount, "out of range");
|
|
|
|
return mContents[aIndex];
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult AllocateContents(uint32_t aCount);
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t CounterIncrementCount(void) const { return mIncrementCount; } // [reset]
|
|
|
|
const nsStyleCounterData* GetCounterIncrementAt(uint32_t aIndex) const {
|
2005-04-02 03:07:00 +04:00
|
|
|
NS_ASSERTION(aIndex < mIncrementCount, "out of range");
|
|
|
|
return &mIncrements[aIndex];
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult AllocateCounterIncrements(uint32_t aCount) {
|
2001-06-01 02:19:43 +04:00
|
|
|
if (aCount != mIncrementCount) {
|
|
|
|
DELETE_ARRAY_IF(mIncrements);
|
|
|
|
if (aCount) {
|
|
|
|
mIncrements = new nsStyleCounterData[aCount];
|
|
|
|
if (! mIncrements) {
|
|
|
|
mIncrementCount = 0;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mIncrementCount = aCount;
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult SetCounterIncrementAt(uint32_t aIndex, const nsString& aCounter, int32_t aIncrement) {
|
2001-06-01 02:19:43 +04:00
|
|
|
if (aIndex < mIncrementCount) {
|
|
|
|
mIncrements[aIndex].mCounter = aCounter;
|
|
|
|
mIncrements[aIndex].mValue = aIncrement;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
return NS_ERROR_ILLEGAL_VALUE;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t CounterResetCount(void) const { return mResetCount; } // [reset]
|
|
|
|
const nsStyleCounterData* GetCounterResetAt(uint32_t aIndex) const {
|
2005-04-02 03:07:00 +04:00
|
|
|
NS_ASSERTION(aIndex < mResetCount, "out of range");
|
|
|
|
return &mResets[aIndex];
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult AllocateCounterResets(uint32_t aCount) {
|
2001-06-01 02:19:43 +04:00
|
|
|
if (aCount != mResetCount) {
|
|
|
|
DELETE_ARRAY_IF(mResets);
|
|
|
|
if (aCount) {
|
|
|
|
mResets = new nsStyleCounterData[aCount];
|
|
|
|
if (! mResets) {
|
|
|
|
mResetCount = 0;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mResetCount = aCount;
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult SetCounterResetAt(uint32_t aIndex, const nsString& aCounter, int32_t aValue) {
|
2001-06-01 02:19:43 +04:00
|
|
|
if (aIndex < mResetCount) {
|
|
|
|
mResets[aIndex].mCounter = aCounter;
|
|
|
|
mResets[aIndex].mValue = aValue;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
return NS_ERROR_ILLEGAL_VALUE;
|
|
|
|
}
|
|
|
|
|
2008-08-05 02:15:11 +04:00
|
|
|
nsStyleCoord mMarkerOffset; // [reset] coord, auto
|
2001-06-01 02:19:43 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
nsStyleContentData* mContents;
|
|
|
|
nsStyleCounterData* mIncrements;
|
2009-05-13 12:26:48 +04:00
|
|
|
nsStyleCounterData* mResets;
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mContentCount;
|
|
|
|
uint32_t mIncrementCount;
|
|
|
|
uint32_t mResetCount;
|
2001-06-01 02:19:43 +04:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleUIReset
|
|
|
|
{
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStyleUIReset(StyleStructContext aContext);
|
2001-06-01 02:19:43 +04:00
|
|
|
nsStyleUIReset(const nsStyleUIReset& aOther);
|
|
|
|
~nsStyleUIReset(void);
|
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStyleUIReset* aSelf) CPP_THROW_NEW { return aSelf; }
|
2004-08-01 03:15:21 +04:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
2014-07-16 09:27:13 +04:00
|
|
|
return aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStyleUIReset, sz);
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
2004-08-01 03:15:21 +04:00
|
|
|
void Destroy(nsPresContext* aContext) {
|
2001-06-02 01:04:23 +04:00
|
|
|
this->~nsStyleUIReset();
|
2014-07-16 09:27:13 +04:00
|
|
|
aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
FreeByObjectID(mozilla::eArenaObjectID_nsStyleUIReset, this);
|
2007-04-23 18:21:53 +04:00
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2002-08-24 18:41:28 +04:00
|
|
|
nsChangeHint CalcDifference(const nsStyleUIReset& aOther) const;
|
2012-09-07 21:13:36 +04:00
|
|
|
static nsChangeHint MaxDifference() {
|
|
|
|
return NS_STYLE_HINT_FRAMECHANGE;
|
|
|
|
}
|
2015-06-21 07:54:15 +03:00
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
2015-06-21 07:54:15 +03:00
|
|
|
// CalcDifference never returns the reflow hints that are sometimes
|
|
|
|
// handled for descendants as hints not handled for descendants.
|
|
|
|
return nsChangeHint_NeedReflow |
|
|
|
|
nsChangeHint_ReflowChangesSizeOrPosition |
|
|
|
|
nsChangeHint_ClearAncestorIntrinsics;
|
2014-01-03 06:39:54 +04:00
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mUserSelect; // [reset] (selection-style)
|
|
|
|
uint8_t mForceBrokenImageIcon; // [reset] (0 if not forcing, otherwise forcing)
|
|
|
|
uint8_t mIMEMode; // [reset]
|
2016-01-27 13:58:33 +03:00
|
|
|
uint8_t mWindowDragging; // [reset]
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mWindowShadow; // [reset]
|
2001-06-01 02:19:43 +04:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsCursorImage
|
|
|
|
{
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mHaveHotspot;
|
2005-07-01 08:29:42 +04:00
|
|
|
float mHotspotX, mHotspotY;
|
|
|
|
|
|
|
|
nsCursorImage();
|
2010-08-16 20:19:26 +04:00
|
|
|
nsCursorImage(const nsCursorImage& aOther);
|
|
|
|
~nsCursorImage();
|
|
|
|
|
|
|
|
nsCursorImage& operator=(const nsCursorImage& aOther);
|
|
|
|
/*
|
|
|
|
* We hide mImage and force access through the getter and setter so that we
|
|
|
|
* can lock the images we use. Cursor images are likely to be small, so we
|
|
|
|
* don't care about discarding them. See bug 512260.
|
|
|
|
* */
|
|
|
|
void SetImage(imgIRequest *aImage) {
|
|
|
|
if (mImage)
|
|
|
|
mImage->UnlockImage();
|
|
|
|
mImage = aImage;
|
|
|
|
if (mImage)
|
|
|
|
mImage->LockImage();
|
|
|
|
}
|
|
|
|
imgIRequest* GetImage() const {
|
|
|
|
return mImage;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsCOMPtr<imgIRequest> mImage;
|
2005-07-01 08:29:42 +04:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleUserInterface
|
|
|
|
{
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStyleUserInterface(StyleStructContext aContext);
|
2001-06-01 02:19:43 +04:00
|
|
|
nsStyleUserInterface(const nsStyleUserInterface& aOther);
|
|
|
|
~nsStyleUserInterface(void);
|
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStyleUserInterface* aSelf) CPP_THROW_NEW { return aSelf; }
|
2004-08-01 03:15:21 +04:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
2014-07-16 09:27:13 +04:00
|
|
|
return aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStyleUserInterface, sz);
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
2004-08-01 03:15:21 +04:00
|
|
|
void Destroy(nsPresContext* aContext) {
|
2001-06-02 01:04:23 +04:00
|
|
|
this->~nsStyleUserInterface();
|
2014-07-16 09:27:13 +04:00
|
|
|
aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
FreeByObjectID(mozilla::eArenaObjectID_nsStyleUserInterface, this);
|
2007-04-23 18:21:53 +04:00
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2002-08-24 18:41:28 +04:00
|
|
|
nsChangeHint CalcDifference(const nsStyleUserInterface& aOther) const;
|
2012-09-07 21:13:36 +04:00
|
|
|
static nsChangeHint MaxDifference() {
|
2014-09-05 07:48:43 +04:00
|
|
|
return NS_CombineHint(NS_STYLE_HINT_FRAMECHANGE,
|
|
|
|
NS_CombineHint(nsChangeHint_UpdateCursor,
|
|
|
|
nsChangeHint_NeutralChange));
|
2012-09-07 21:13:36 +04:00
|
|
|
}
|
2015-06-21 07:54:15 +03:00
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
2015-06-21 07:54:15 +03:00
|
|
|
// CalcDifference never returns the reflow hints that are sometimes
|
|
|
|
// handled for descendants as hints not handled for descendants.
|
|
|
|
return nsChangeHint_NeedReflow |
|
|
|
|
nsChangeHint_ReflowChangesSizeOrPosition |
|
|
|
|
nsChangeHint_ClearAncestorIntrinsics;
|
2014-01-03 06:39:54 +04:00
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mUserInput; // [inherited]
|
|
|
|
uint8_t mUserModify; // [inherited] (modify-content)
|
|
|
|
uint8_t mUserFocus; // [inherited] (auto-select)
|
2016-04-12 08:52:41 +03:00
|
|
|
uint8_t mPointerEvents; // [inherited] see nsStyleConsts.h
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mCursor; // [inherited] See nsStyleConsts.h
|
2005-07-01 08:29:42 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mCursorArrayLength;
|
2005-07-01 08:29:42 +04:00
|
|
|
nsCursorImage *mCursorArray;// [inherited] The specified URL values
|
|
|
|
// and coordinates. Takes precedence over
|
|
|
|
// mCursor. Zero-length array is represented
|
|
|
|
// by null pointer.
|
|
|
|
|
|
|
|
// Does not free mCursorArray; the caller is responsible for calling
|
|
|
|
// |delete [] mCursorArray| first if it is needed.
|
|
|
|
void CopyCursorArrayFrom(const nsStyleUserInterface& aSource);
|
2016-04-12 08:52:41 +03:00
|
|
|
|
|
|
|
inline uint8_t GetEffectivePointerEvents(nsIFrame* aFrame) const;
|
2001-06-01 02:19:43 +04:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleXUL
|
|
|
|
{
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStyleXUL(StyleStructContext aContext);
|
2001-06-01 02:19:43 +04:00
|
|
|
nsStyleXUL(const nsStyleXUL& aSource);
|
|
|
|
~nsStyleXUL();
|
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStyleXUL* aSelf) CPP_THROW_NEW { return aSelf; }
|
2004-08-01 03:15:21 +04:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
2014-07-16 09:27:13 +04:00
|
|
|
return aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStyleXUL, sz);
|
2001-06-01 02:19:43 +04:00
|
|
|
}
|
2004-08-01 03:15:21 +04:00
|
|
|
void Destroy(nsPresContext* aContext) {
|
2001-06-02 01:04:23 +04:00
|
|
|
this->~nsStyleXUL();
|
2014-07-16 09:27:13 +04:00
|
|
|
aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
FreeByObjectID(mozilla::eArenaObjectID_nsStyleXUL, this);
|
2007-04-23 18:21:53 +04:00
|
|
|
}
|
2001-06-01 02:19:43 +04:00
|
|
|
|
2002-08-24 18:41:28 +04:00
|
|
|
nsChangeHint CalcDifference(const nsStyleXUL& aOther) const;
|
2012-09-07 21:13:36 +04:00
|
|
|
static nsChangeHint MaxDifference() {
|
|
|
|
return NS_STYLE_HINT_FRAMECHANGE;
|
|
|
|
}
|
2015-06-21 07:54:15 +03:00
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
2015-06-21 07:54:15 +03:00
|
|
|
// CalcDifference never returns the reflow hints that are sometimes
|
|
|
|
// handled for descendants as hints not handled for descendants.
|
|
|
|
return nsChangeHint_NeedReflow |
|
|
|
|
nsChangeHint_ReflowChangesSizeOrPosition |
|
|
|
|
nsChangeHint_ClearAncestorIntrinsics;
|
2014-01-03 06:39:54 +04:00
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2002-12-21 10:27:44 +03:00
|
|
|
float mBoxFlex; // [reset] see nsStyleConsts.h
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mBoxOrdinal; // [reset] see nsStyleConsts.h
|
|
|
|
uint8_t mBoxAlign; // [reset] see nsStyleConsts.h
|
|
|
|
uint8_t mBoxDirection; // [reset] see nsStyleConsts.h
|
|
|
|
uint8_t mBoxOrient; // [reset] see nsStyleConsts.h
|
|
|
|
uint8_t mBoxPack; // [reset] see nsStyleConsts.h
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mStretchStack; // [reset] see nsStyleConsts.h
|
2001-06-01 02:19:43 +04:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleColumn
|
|
|
|
{
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStyleColumn(StyleStructContext aContext);
|
2004-06-17 15:57:37 +04:00
|
|
|
nsStyleColumn(const nsStyleColumn& aSource);
|
|
|
|
~nsStyleColumn();
|
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStyleColumn* aSelf) CPP_THROW_NEW { return aSelf; }
|
2004-08-01 03:15:21 +04:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
2014-07-16 09:27:13 +04:00
|
|
|
return aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStyleColumn, sz);
|
2004-06-17 15:57:37 +04:00
|
|
|
}
|
2004-08-01 03:15:21 +04:00
|
|
|
void Destroy(nsPresContext* aContext) {
|
2004-06-17 15:57:37 +04:00
|
|
|
this->~nsStyleColumn();
|
2014-07-16 09:27:13 +04:00
|
|
|
aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
FreeByObjectID(mozilla::eArenaObjectID_nsStyleColumn, this);
|
2007-04-23 18:21:53 +04:00
|
|
|
}
|
2004-06-17 15:57:37 +04:00
|
|
|
|
|
|
|
nsChangeHint CalcDifference(const nsStyleColumn& aOther) const;
|
2012-09-07 21:13:36 +04:00
|
|
|
static nsChangeHint MaxDifference() {
|
2014-09-05 07:48:43 +04:00
|
|
|
return NS_CombineHint(NS_STYLE_HINT_FRAMECHANGE,
|
|
|
|
nsChangeHint_NeutralChange);
|
2012-09-07 21:13:36 +04:00
|
|
|
}
|
2015-06-21 07:54:15 +03:00
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
2015-06-21 07:54:15 +03:00
|
|
|
// CalcDifference never returns the reflow hints that are sometimes
|
|
|
|
// handled for descendants as hints not handled for descendants.
|
|
|
|
return nsChangeHint_NeedReflow |
|
|
|
|
nsChangeHint_ReflowChangesSizeOrPosition |
|
|
|
|
nsChangeHint_ClearAncestorIntrinsics;
|
2014-01-03 06:39:54 +04:00
|
|
|
}
|
2004-06-17 15:57:37 +04:00
|
|
|
|
2013-05-31 19:51:43 +04:00
|
|
|
/**
|
|
|
|
* This is the maximum number of columns we can process. It's used in both
|
|
|
|
* nsColumnSetFrame and nsRuleNode.
|
|
|
|
*/
|
|
|
|
static const uint32_t kMaxColumnCount;
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mColumnCount; // [reset] see nsStyleConsts.h
|
2008-08-05 02:15:11 +04:00
|
|
|
nsStyleCoord mColumnWidth; // [reset] coord, auto
|
2009-10-08 07:22:42 +04:00
|
|
|
nsStyleCoord mColumnGap; // [reset] coord, normal
|
2008-07-19 14:38:25 +04:00
|
|
|
|
|
|
|
nscolor mColumnRuleColor; // [reset]
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mColumnRuleStyle; // [reset]
|
|
|
|
uint8_t mColumnFill; // [reset] see nsStyleConsts.h
|
2012-07-31 20:21:19 +04:00
|
|
|
|
2008-09-13 07:45:37 +04:00
|
|
|
// See https://bugzilla.mozilla.org/show_bug.cgi?id=271586#c43 for why
|
|
|
|
// this is hard to replace with 'currentColor'.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mColumnRuleColorIsForeground;
|
2008-07-19 14:38:25 +04:00
|
|
|
|
|
|
|
void SetColumnRuleWidth(nscoord aWidth) {
|
|
|
|
mColumnRuleWidth = NS_ROUND_BORDER_TO_PIXELS(aWidth, mTwipsPerPixel);
|
|
|
|
}
|
|
|
|
|
|
|
|
nscoord GetComputedColumnRuleWidth() const {
|
|
|
|
return (IsVisibleBorderStyle(mColumnRuleStyle) ? mColumnRuleWidth : 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nscoord mColumnRuleWidth; // [reset] coord
|
|
|
|
nscoord mTwipsPerPixel;
|
2004-06-17 15:57:37 +04:00
|
|
|
};
|
|
|
|
|
2001-12-12 10:59:31 +03:00
|
|
|
enum nsStyleSVGPaintType {
|
2007-10-19 19:36:15 +04:00
|
|
|
eStyleSVGPaintType_None = 1,
|
2001-12-12 10:59:31 +03:00
|
|
|
eStyleSVGPaintType_Color,
|
2012-09-06 08:58:46 +04:00
|
|
|
eStyleSVGPaintType_Server,
|
2013-05-16 06:35:15 +04:00
|
|
|
eStyleSVGPaintType_ContextFill,
|
|
|
|
eStyleSVGPaintType_ContextStroke
|
2001-12-12 10:59:31 +03:00
|
|
|
};
|
|
|
|
|
2012-09-06 08:58:46 +04:00
|
|
|
enum nsStyleSVGOpacitySource {
|
|
|
|
eStyleSVGOpacitySource_Normal,
|
2013-05-16 06:35:15 +04:00
|
|
|
eStyleSVGOpacitySource_ContextFillOpacity,
|
|
|
|
eStyleSVGOpacitySource_ContextStrokeOpacity
|
2012-09-06 08:58:46 +04:00
|
|
|
};
|
|
|
|
|
2001-12-12 10:59:31 +03:00
|
|
|
struct nsStyleSVGPaint
|
|
|
|
{
|
2004-10-15 03:02:53 +04:00
|
|
|
union {
|
|
|
|
nscolor mColor;
|
|
|
|
nsIURI *mPaintServer;
|
|
|
|
} mPaint;
|
2009-05-13 12:26:48 +04:00
|
|
|
nsStyleSVGPaintType mType;
|
2007-01-09 14:02:17 +03:00
|
|
|
nscolor mFallbackColor;
|
2004-10-15 03:02:53 +04:00
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
nsStyleSVGPaint() : mType(nsStyleSVGPaintType(0)) { mPaint.mPaintServer = nullptr; }
|
2007-10-19 19:36:15 +04:00
|
|
|
~nsStyleSVGPaint();
|
|
|
|
void SetType(nsStyleSVGPaintType aType);
|
2004-10-15 03:02:53 +04:00
|
|
|
nsStyleSVGPaint& operator=(const nsStyleSVGPaint& aOther);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool operator==(const nsStyleSVGPaint& aOther) const;
|
2004-10-15 03:02:53 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool operator!=(const nsStyleSVGPaint& aOther) const {
|
2004-10-15 03:02:53 +04:00
|
|
|
return !(*this == aOther);
|
|
|
|
}
|
2001-12-12 10:59:31 +03:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleSVG
|
|
|
|
{
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStyleSVG(StyleStructContext aContext);
|
2001-12-12 10:59:31 +03:00
|
|
|
nsStyleSVG(const nsStyleSVG& aSource);
|
|
|
|
~nsStyleSVG();
|
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStyleSVG* aSelf) CPP_THROW_NEW { return aSelf; }
|
2004-08-01 03:15:21 +04:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
2014-07-16 09:27:13 +04:00
|
|
|
return aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStyleSVG, sz);
|
2001-12-12 10:59:31 +03:00
|
|
|
}
|
2004-08-01 03:15:21 +04:00
|
|
|
void Destroy(nsPresContext* aContext) {
|
2001-12-12 10:59:31 +03:00
|
|
|
this->~nsStyleSVG();
|
2014-07-16 09:27:13 +04:00
|
|
|
aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
FreeByObjectID(mozilla::eArenaObjectID_nsStyleSVG, this);
|
2007-04-23 18:21:53 +04:00
|
|
|
}
|
2001-12-12 10:59:31 +03:00
|
|
|
|
2002-08-24 18:41:28 +04:00
|
|
|
nsChangeHint CalcDifference(const nsStyleSVG& aOther) const;
|
2012-09-07 21:13:36 +04:00
|
|
|
static nsChangeHint MaxDifference() {
|
|
|
|
return NS_CombineHint(NS_CombineHint(nsChangeHint_UpdateEffects,
|
2013-05-24 21:31:33 +04:00
|
|
|
NS_CombineHint(nsChangeHint_NeedReflow, nsChangeHint_NeedDirtyReflow)), // XXX remove nsChangeHint_NeedDirtyReflow: bug 876085
|
2012-09-07 21:13:36 +04:00
|
|
|
nsChangeHint_RepaintFrame);
|
|
|
|
}
|
2015-06-21 07:54:15 +03:00
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
|
|
|
// CalcDifference never returns nsChangeHint_NeedReflow as a hint
|
|
|
|
// not handled for descendants, and never returns
|
|
|
|
// nsChangeHint_ClearAncestorIntrinsics at all.
|
2014-01-03 06:39:54 +04:00
|
|
|
return nsChangeHint_NeedReflow;
|
|
|
|
}
|
2001-12-12 10:59:31 +03:00
|
|
|
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
nsStyleSVGPaint mFill; // [inherited]
|
2005-01-25 06:55:03 +03:00
|
|
|
nsStyleSVGPaint mStroke; // [inherited]
|
2004-12-09 06:16:15 +03:00
|
|
|
nsCOMPtr<nsIURI> mMarkerEnd; // [inherited]
|
|
|
|
nsCOMPtr<nsIURI> mMarkerMid; // [inherited]
|
|
|
|
nsCOMPtr<nsIURI> mMarkerStart; // [inherited]
|
2008-08-05 02:15:11 +04:00
|
|
|
nsStyleCoord *mStrokeDasharray; // [inherited] coord, percent, factor
|
2005-04-05 01:42:26 +04:00
|
|
|
|
2008-08-05 02:15:11 +04:00
|
|
|
nsStyleCoord mStrokeDashoffset; // [inherited] coord, percent, factor
|
|
|
|
nsStyleCoord mStrokeWidth; // [inherited] coord, percent, factor
|
2005-01-25 06:55:03 +03:00
|
|
|
|
|
|
|
float mFillOpacity; // [inherited]
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
float mStrokeMiterlimit; // [inherited]
|
|
|
|
float mStrokeOpacity; // [inherited]
|
2005-01-25 06:55:03 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mStrokeDasharrayLength;
|
|
|
|
uint8_t mClipRule; // [inherited]
|
|
|
|
uint8_t mColorInterpolation; // [inherited] see nsStyleConsts.h
|
|
|
|
uint8_t mColorInterpolationFilters; // [inherited] see nsStyleConsts.h
|
|
|
|
uint8_t mFillRule; // [inherited] see nsStyleConsts.h
|
2013-01-13 03:27:53 +04:00
|
|
|
uint8_t mPaintOrder; // [inherited] see nsStyleConsts.h
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mShapeRendering; // [inherited] see nsStyleConsts.h
|
|
|
|
uint8_t mStrokeLinecap; // [inherited] see nsStyleConsts.h
|
|
|
|
uint8_t mStrokeLinejoin; // [inherited] see nsStyleConsts.h
|
|
|
|
uint8_t mTextAnchor; // [inherited] see nsStyleConsts.h
|
2012-09-06 08:58:46 +04:00
|
|
|
|
2012-09-12 09:13:12 +04:00
|
|
|
// In SVG glyphs, whether we inherit fill or stroke opacity from the outer
|
|
|
|
// text object.
|
|
|
|
// Use 3 bits to avoid signedness problems in MSVC.
|
|
|
|
nsStyleSVGOpacitySource mFillOpacitySource : 3;
|
|
|
|
nsStyleSVGOpacitySource mStrokeOpacitySource : 3;
|
2012-09-06 08:58:47 +04:00
|
|
|
|
|
|
|
// SVG glyph outer object inheritance for other properties
|
|
|
|
bool mStrokeDasharrayFromObject : 1;
|
|
|
|
bool mStrokeDashoffsetFromObject : 1;
|
|
|
|
bool mStrokeWidthFromObject : 1;
|
2013-07-12 10:39:38 +04:00
|
|
|
|
|
|
|
bool HasMarker() const {
|
|
|
|
return mMarkerStart || mMarkerMid || mMarkerEnd;
|
|
|
|
}
|
2013-11-23 17:32:21 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the stroke is not "none" and the stroke-opacity is greater
|
|
|
|
* than zero. This ignores stroke-widths as that depends on the context.
|
|
|
|
*/
|
|
|
|
bool HasStroke() const {
|
|
|
|
return mStroke.mType != eStyleSVGPaintType_None && mStrokeOpacity > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the fill is not "none" and the fill-opacity is greater
|
|
|
|
* than zero.
|
|
|
|
*/
|
|
|
|
bool HasFill() const {
|
|
|
|
return mFill.mType != eStyleSVGPaintType_None && mFillOpacity > 0;
|
|
|
|
}
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
class nsStyleBasicShape final
|
|
|
|
{
|
2014-09-28 03:56:00 +04:00
|
|
|
public:
|
|
|
|
enum Type {
|
2014-11-22 07:28:00 +03:00
|
|
|
eInset,
|
2014-10-15 02:03:00 +04:00
|
|
|
eCircle,
|
|
|
|
eEllipse,
|
2014-09-28 03:56:00 +04:00
|
|
|
ePolygon
|
|
|
|
};
|
|
|
|
|
2014-09-24 17:16:53 +04:00
|
|
|
explicit nsStyleBasicShape(Type type)
|
2014-11-22 07:28:00 +03:00
|
|
|
: mType(type),
|
|
|
|
mFillRule(NS_STYLE_FILL_RULE_NONZERO)
|
2014-09-28 03:56:00 +04:00
|
|
|
{
|
2014-10-15 02:03:00 +04:00
|
|
|
mPosition.SetInitialPercentValues(0.5f);
|
2014-09-28 03:56:00 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
Type GetShapeType() const { return mType; }
|
2016-02-17 03:19:27 +03:00
|
|
|
nsCSSKeyword GetShapeTypeName() const;
|
2014-09-28 03:56:00 +04:00
|
|
|
|
|
|
|
int32_t GetFillRule() const { return mFillRule; }
|
|
|
|
void SetFillRule(int32_t aFillRule)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(mType == ePolygon, "expected polygon");
|
|
|
|
mFillRule = aFillRule;
|
|
|
|
}
|
|
|
|
|
2016-01-28 08:24:00 +03:00
|
|
|
typedef nsStyleImageLayers::Position Position;
|
2014-10-15 02:03:00 +04:00
|
|
|
Position& GetPosition() {
|
|
|
|
NS_ASSERTION(mType == eCircle || mType == eEllipse,
|
|
|
|
"expected circle or ellipse");
|
|
|
|
return mPosition;
|
|
|
|
}
|
|
|
|
const Position& GetPosition() const {
|
|
|
|
NS_ASSERTION(mType == eCircle || mType == eEllipse,
|
|
|
|
"expected circle or ellipse");
|
|
|
|
return mPosition;
|
|
|
|
}
|
|
|
|
|
2014-11-22 07:28:00 +03:00
|
|
|
bool HasRadius() const {
|
|
|
|
NS_ASSERTION(mType == eInset, "expected inset");
|
|
|
|
nsStyleCoord zero;
|
|
|
|
zero.SetCoordValue(0);
|
|
|
|
NS_FOR_CSS_HALF_CORNERS(corner) {
|
|
|
|
if (mRadius.Get(corner) != zero) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
nsStyleCorners& GetRadius() {
|
2014-12-19 21:12:31 +03:00
|
|
|
NS_ASSERTION(mType == eInset, "expected inset");
|
2014-11-22 07:28:00 +03:00
|
|
|
return mRadius;
|
|
|
|
}
|
|
|
|
const nsStyleCorners& GetRadius() const {
|
2014-12-19 21:12:31 +03:00
|
|
|
NS_ASSERTION(mType == eInset, "expected inset");
|
2014-11-22 07:28:00 +03:00
|
|
|
return mRadius;
|
|
|
|
}
|
|
|
|
|
2014-10-15 02:03:00 +04:00
|
|
|
// mCoordinates has coordinates for polygon or radii for
|
|
|
|
// ellipse and circle.
|
2014-09-28 03:56:00 +04:00
|
|
|
nsTArray<nsStyleCoord>& Coordinates()
|
|
|
|
{
|
|
|
|
return mCoordinates;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsTArray<nsStyleCoord>& Coordinates() const
|
|
|
|
{
|
|
|
|
return mCoordinates;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator==(const nsStyleBasicShape& aOther) const
|
|
|
|
{
|
|
|
|
return mType == aOther.mType &&
|
|
|
|
mFillRule == aOther.mFillRule &&
|
2014-10-15 02:03:00 +04:00
|
|
|
mCoordinates == aOther.mCoordinates &&
|
2014-11-22 07:28:00 +03:00
|
|
|
mPosition == aOther.mPosition &&
|
|
|
|
mRadius == aOther.mRadius;
|
2014-09-28 03:56:00 +04:00
|
|
|
}
|
|
|
|
bool operator!=(const nsStyleBasicShape& aOther) const {
|
|
|
|
return !(*this == aOther);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_INLINE_DECL_REFCOUNTING(nsStyleBasicShape);
|
|
|
|
|
|
|
|
private:
|
|
|
|
~nsStyleBasicShape() {}
|
|
|
|
|
|
|
|
Type mType;
|
|
|
|
int32_t mFillRule;
|
2014-11-22 07:28:00 +03:00
|
|
|
|
2014-10-15 02:03:00 +04:00
|
|
|
// mCoordinates has coordinates for polygon or radii for
|
|
|
|
// ellipse and circle.
|
2014-09-28 03:56:00 +04:00
|
|
|
nsTArray<nsStyleCoord> mCoordinates;
|
2014-10-15 02:03:00 +04:00
|
|
|
Position mPosition;
|
2014-11-22 07:28:00 +03:00
|
|
|
nsStyleCorners mRadius;
|
2014-09-28 03:56:00 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct nsStyleClipPath
|
|
|
|
{
|
|
|
|
nsStyleClipPath();
|
|
|
|
nsStyleClipPath(const nsStyleClipPath& aSource);
|
|
|
|
~nsStyleClipPath();
|
|
|
|
|
|
|
|
nsStyleClipPath& operator=(const nsStyleClipPath& aOther);
|
|
|
|
|
|
|
|
bool operator==(const nsStyleClipPath& aOther) const;
|
|
|
|
bool operator!=(const nsStyleClipPath& aOther) const {
|
|
|
|
return !(*this == aOther);
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t GetType() const {
|
|
|
|
return mType;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIURI* GetURL() const {
|
|
|
|
NS_ASSERTION(mType == NS_STYLE_CLIP_PATH_URL, "wrong clip-path type");
|
|
|
|
return mURL;
|
|
|
|
}
|
|
|
|
void SetURL(nsIURI* aURL);
|
|
|
|
|
|
|
|
nsStyleBasicShape* GetBasicShape() const {
|
|
|
|
NS_ASSERTION(mType == NS_STYLE_CLIP_PATH_SHAPE, "wrong clip-path type");
|
|
|
|
return mBasicShape;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetBasicShape(nsStyleBasicShape* mBasicShape,
|
|
|
|
uint8_t aSizingBox = NS_STYLE_CLIP_SHAPE_SIZING_NOBOX);
|
|
|
|
|
|
|
|
uint8_t GetSizingBox() const { return mSizingBox; }
|
|
|
|
void SetSizingBox(uint8_t aSizingBox);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void ReleaseRef();
|
2015-01-07 02:35:02 +03:00
|
|
|
void* operator new(size_t) = delete;
|
2014-09-28 03:56:00 +04:00
|
|
|
|
|
|
|
int32_t mType; // see NS_STYLE_CLIP_PATH_* constants in nsStyleConsts.h
|
|
|
|
union {
|
|
|
|
nsStyleBasicShape* mBasicShape;
|
|
|
|
nsIURI* mURL;
|
|
|
|
};
|
|
|
|
uint8_t mSizingBox; // see NS_STYLE_CLIP_SHAPE_SIZING_* constants in nsStyleConsts.h
|
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleFilter
|
|
|
|
{
|
2013-07-23 02:08:33 +04:00
|
|
|
nsStyleFilter();
|
|
|
|
nsStyleFilter(const nsStyleFilter& aSource);
|
|
|
|
~nsStyleFilter();
|
|
|
|
|
2013-08-05 11:02:27 +04:00
|
|
|
nsStyleFilter& operator=(const nsStyleFilter& aOther);
|
|
|
|
|
2013-07-23 02:08:33 +04:00
|
|
|
bool operator==(const nsStyleFilter& aOther) const;
|
2014-07-16 09:27:12 +04:00
|
|
|
bool operator!=(const nsStyleFilter& aOther) const {
|
|
|
|
return !(*this == aOther);
|
|
|
|
}
|
2013-07-23 02:08:33 +04:00
|
|
|
|
2013-08-06 11:53:30 +04:00
|
|
|
int32_t GetType() const {
|
2013-08-05 11:02:27 +04:00
|
|
|
return mType;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsStyleCoord& GetFilterParameter() const {
|
2013-08-06 11:53:30 +04:00
|
|
|
NS_ASSERTION(mType != NS_STYLE_FILTER_DROP_SHADOW &&
|
|
|
|
mType != NS_STYLE_FILTER_URL &&
|
|
|
|
mType != NS_STYLE_FILTER_NONE, "wrong filter type");
|
2013-08-05 11:02:27 +04:00
|
|
|
return mFilterParameter;
|
|
|
|
}
|
|
|
|
void SetFilterParameter(const nsStyleCoord& aFilterParameter,
|
2013-08-06 11:53:30 +04:00
|
|
|
int32_t aType);
|
2013-08-05 11:02:27 +04:00
|
|
|
|
|
|
|
nsIURI* GetURL() const {
|
2013-08-06 11:53:30 +04:00
|
|
|
NS_ASSERTION(mType == NS_STYLE_FILTER_URL, "wrong filter type");
|
2013-08-05 11:02:27 +04:00
|
|
|
return mURL;
|
|
|
|
}
|
|
|
|
void SetURL(nsIURI* aURL);
|
|
|
|
|
|
|
|
nsCSSShadowArray* GetDropShadow() const {
|
2013-08-06 11:53:30 +04:00
|
|
|
NS_ASSERTION(mType == NS_STYLE_FILTER_DROP_SHADOW, "wrong filter type");
|
2013-08-05 11:02:27 +04:00
|
|
|
return mDropShadow;
|
|
|
|
}
|
|
|
|
void SetDropShadow(nsCSSShadowArray* aDropShadow);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void ReleaseRef();
|
|
|
|
|
2013-08-06 11:53:30 +04:00
|
|
|
int32_t mType; // see NS_STYLE_FILTER_* constants in nsStyleConsts.h
|
2013-07-26 10:02:33 +04:00
|
|
|
nsStyleCoord mFilterParameter; // coord, percent, factor, angle
|
2013-08-05 11:02:27 +04:00
|
|
|
union {
|
|
|
|
nsIURI* mURL;
|
|
|
|
nsCSSShadowArray* mDropShadow;
|
|
|
|
};
|
2013-07-23 02:08:33 +04:00
|
|
|
};
|
|
|
|
|
2013-08-05 11:02:27 +04:00
|
|
|
template<>
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsTArray_CopyChooser<nsStyleFilter>
|
|
|
|
{
|
2013-10-22 18:36:34 +04:00
|
|
|
typedef nsTArray_CopyWithConstructors<nsStyleFilter> Type;
|
|
|
|
};
|
2013-08-05 11:02:27 +04:00
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleSVGReset
|
|
|
|
{
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStyleSVGReset(StyleStructContext aContext);
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
nsStyleSVGReset(const nsStyleSVGReset& aSource);
|
|
|
|
~nsStyleSVGReset();
|
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStyleSVGReset* aSelf) CPP_THROW_NEW { return aSelf; }
|
2004-08-01 03:15:21 +04:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
2014-07-16 09:27:13 +04:00
|
|
|
return aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStyleSVGReset, sz);
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
}
|
2016-01-28 08:28:00 +03:00
|
|
|
void Destroy(nsPresContext* aContext);
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
|
|
|
|
nsChangeHint CalcDifference(const nsStyleSVGReset& aOther) const;
|
2012-09-07 21:13:36 +04:00
|
|
|
static nsChangeHint MaxDifference() {
|
2016-01-28 08:28:00 +03:00
|
|
|
return nsChangeHint_UpdateEffects |
|
|
|
|
nsChangeHint_UpdateOverflow |
|
2016-02-25 03:08:31 +03:00
|
|
|
nsChangeHint_UpdateContainingBlock |
|
2016-01-28 08:28:00 +03:00
|
|
|
nsChangeHint_NeutralChange |
|
|
|
|
NS_STYLE_HINT_REFLOW;
|
2012-09-07 21:13:36 +04:00
|
|
|
}
|
2015-06-21 07:54:15 +03:00
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
2015-06-21 07:54:15 +03:00
|
|
|
// CalcDifference never returns the reflow hints that are sometimes
|
|
|
|
// handled for descendants as hints not handled for descendants.
|
|
|
|
return nsChangeHint_NeedReflow |
|
|
|
|
nsChangeHint_ReflowChangesSizeOrPosition |
|
|
|
|
nsChangeHint_ClearAncestorIntrinsics;
|
2014-01-03 06:39:54 +04:00
|
|
|
}
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
|
2014-02-10 08:31:03 +04:00
|
|
|
bool HasFilters() const {
|
2015-08-04 06:18:00 +03:00
|
|
|
return !mFilters.IsEmpty();
|
2013-07-23 02:08:33 +04:00
|
|
|
}
|
|
|
|
|
2016-02-09 01:08:09 +03:00
|
|
|
bool HasClipPath() const {
|
|
|
|
return mClipPath.GetType() != NS_STYLE_CLIP_PATH_NONE;
|
|
|
|
}
|
|
|
|
|
2014-10-26 21:00:03 +03:00
|
|
|
bool HasNonScalingStroke() const {
|
|
|
|
return mVectorEffect == NS_STYLE_VECTOR_EFFECT_NON_SCALING_STROKE;
|
|
|
|
}
|
|
|
|
|
2016-01-28 08:39:00 +03:00
|
|
|
nsStyleImageLayers mMask;
|
2014-09-28 03:56:00 +04:00
|
|
|
nsStyleClipPath mClipPath; // [reset]
|
2013-07-23 02:08:33 +04:00
|
|
|
nsTArray<nsStyleFilter> mFilters; // [reset]
|
2009-05-13 12:26:48 +04:00
|
|
|
nscolor mStopColor; // [reset]
|
|
|
|
nscolor mFloodColor; // [reset]
|
|
|
|
nscolor mLightingColor; // [reset]
|
2005-09-07 02:30:40 +04:00
|
|
|
|
2005-04-05 01:42:26 +04:00
|
|
|
float mStopOpacity; // [reset]
|
2007-01-09 23:40:09 +03:00
|
|
|
float mFloodOpacity; // [reset]
|
2005-09-07 02:30:40 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mDominantBaseline; // [reset] see nsStyleConsts.h
|
|
|
|
uint8_t mVectorEffect; // [reset] see nsStyleConsts.h
|
2012-12-21 04:15:22 +04:00
|
|
|
uint8_t mMaskType; // [reset] see nsStyleConsts.h
|
2001-12-12 10:59:31 +03:00
|
|
|
};
|
|
|
|
|
2016-01-11 02:28:35 +03:00
|
|
|
struct nsStyleVariables
|
|
|
|
{
|
2016-03-31 02:30:39 +03:00
|
|
|
explicit nsStyleVariables(StyleStructContext aContext);
|
2013-12-12 06:09:40 +04:00
|
|
|
nsStyleVariables(const nsStyleVariables& aSource);
|
|
|
|
~nsStyleVariables();
|
|
|
|
|
2016-03-31 02:15:30 +03:00
|
|
|
void* operator new(size_t sz, nsStyleVariables* aSelf) CPP_THROW_NEW { return aSelf; }
|
2013-12-12 06:09:40 +04:00
|
|
|
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
2014-07-16 09:27:13 +04:00
|
|
|
return aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
AllocateByObjectID(mozilla::eArenaObjectID_nsStyleVariables, sz);
|
2013-12-12 06:09:40 +04:00
|
|
|
}
|
|
|
|
void Destroy(nsPresContext* aContext) {
|
|
|
|
this->~nsStyleVariables();
|
2014-07-16 09:27:13 +04:00
|
|
|
aContext->PresShell()->
|
2015-09-17 05:08:19 +03:00
|
|
|
FreeByObjectID(mozilla::eArenaObjectID_nsStyleVariables, this);
|
2013-12-12 06:09:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsChangeHint CalcDifference(const nsStyleVariables& aOther) const;
|
|
|
|
static nsChangeHint MaxDifference() {
|
|
|
|
return nsChangeHint(0);
|
|
|
|
}
|
2015-06-21 07:54:15 +03:00
|
|
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
2014-01-03 06:39:54 +04:00
|
|
|
// CalcDifference never returns nsChangeHint_NeedReflow or
|
|
|
|
// nsChangeHint_ClearAncestorIntrinsics at all.
|
|
|
|
return nsChangeHint(0);
|
|
|
|
}
|
2013-12-12 06:09:41 +04:00
|
|
|
|
|
|
|
mozilla::CSSVariableValues mVariables;
|
2013-12-12 06:09:40 +04:00
|
|
|
};
|
|
|
|
|
2001-11-28 08:04:23 +03:00
|
|
|
#endif /* nsStyleStruct_h___ */
|