mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 00:38:39 +09:00
Merge remote-tracking branch 'origin/tracking' into custom
This commit is contained in:
commit
f4d2bf6c3d
32 changed files with 149 additions and 374 deletions
|
|
@ -9337,3 +9337,28 @@ nsLayoutUtils::ComputeGeometryBox(nsIFrame* aFrame,
|
|||
|
||||
return r;
|
||||
}
|
||||
|
||||
/* static */ nsStyleContext*
|
||||
nsLayoutUtils::GetNonAnonymousStyleContext(nsIFrame* aFrame)
|
||||
{
|
||||
nsIContent* node = aFrame->GetContent();
|
||||
MOZ_ASSERT(node, "No content for the given frame?");
|
||||
while (node && node->IsInNativeAnonymousSubtree()) {
|
||||
node = node->GetParent();
|
||||
}
|
||||
MOZ_ASSERT(node, "Native anonymous element with no originating node?");
|
||||
if (nsIFrame* primaryFrame = node->GetPrimaryFrame()) {
|
||||
return primaryFrame->StyleContext();
|
||||
}
|
||||
// If the element doesn't have primary frame, get the computed style
|
||||
// from the element directly.
|
||||
nsPresContext* pc = aFrame->PresContext();
|
||||
MOZ_ASSERT(node == pc->Document()->GetRootElement(),
|
||||
"Root element is the only case for this fallback "
|
||||
"path to be triggered");
|
||||
RefPtr<nsStyleContext> styleContext =
|
||||
pc->StyleSet()->ResolveStyleFor(node->AsElement(), nullptr);
|
||||
// Dropping the strong reference is fine because the style should be
|
||||
// held strongly by the element.
|
||||
return styleContext.get();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2878,6 +2878,15 @@ public:
|
|||
return ResolveToLength<true>(aGap, aPercentageBasis);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the style context associated with the nearest non-native-anonymous
|
||||
* ancestor of the given frame.
|
||||
*
|
||||
* @param aFrame The frame associated with native anonymous content.
|
||||
* @return The resolved style context of the nearest non-anonymous DOM ancestor.
|
||||
*/
|
||||
static nsStyleContext* GetNonAnonymousStyleContext(nsIFrame* aFrame);
|
||||
|
||||
private:
|
||||
static uint32_t sFontSizeInflationEmPerLine;
|
||||
static uint32_t sFontSizeInflationMinTwips;
|
||||
|
|
|
|||
|
|
@ -1060,7 +1060,9 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
|
|||
// This is only needed for root element because scrollbars of non-
|
||||
// root elements with "scrollbar-width: none" is already suppressed
|
||||
// in ScrollFrameHelper::CreateAnonymousContent.
|
||||
if (this->StyleUserInterface()->mScrollbarWidth == StyleScrollbarWidth::None) {
|
||||
nsStyleContext* scrollbarStyle = nsLayoutUtils::GetNonAnonymousStyleContext(this);
|
||||
auto scrollbarWidth = scrollbarStyle->StyleUIReset()->mScrollbarWidth;
|
||||
if (scrollbarWidth == StyleScrollbarWidth::None) {
|
||||
state.mVScrollbar = ShowScrollbar::Never;
|
||||
state.mHScrollbar = ShowScrollbar::Never;
|
||||
}
|
||||
|
|
@ -4417,7 +4419,7 @@ ScrollFrameHelper::CreateAnonymousContent(
|
|||
canHaveHorizontal = true;
|
||||
canHaveVertical = true;
|
||||
} else {
|
||||
if (mOuter->StyleUserInterface()->mScrollbarWidth == StyleScrollbarWidth::None) {
|
||||
if (mOuter->StyleUIReset()->mScrollbarWidth == StyleScrollbarWidth::None) {
|
||||
// If scrollbar-width is none, don't generate scrollbars.
|
||||
canHaveHorizontal = false;
|
||||
canHaveVertical = false;
|
||||
|
|
@ -4450,7 +4452,7 @@ ScrollFrameHelper::CreateAnonymousContent(
|
|||
kNameSpaceID_XUL,
|
||||
nsIDOMNode::ELEMENT_NODE);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
StyleScrollbarWidth scrollWidth = mOuter->StyleUserInterface()->mScrollbarWidth;
|
||||
StyleScrollbarWidth scrollWidth = mOuter->StyleUIReset()->mScrollbarWidth;
|
||||
|
||||
if (canHaveHorizontal) {
|
||||
RefPtr<NodeInfo> ni = nodeInfo;
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ Declaration::Declaration(const Declaration& aCopy)
|
|||
nullptr),
|
||||
mImmutable(false)
|
||||
{
|
||||
mContainer.mRaw = 0;
|
||||
}
|
||||
|
||||
Declaration::~Declaration()
|
||||
|
|
|
|||
|
|
@ -324,10 +324,18 @@ FontFaceSet::Load(JSContext* aCx,
|
|||
|
||||
nsTArray<RefPtr<Promise>> promises;
|
||||
|
||||
nsTArray<FontFace*> faces;
|
||||
FindMatchingFontFaces(aFont, aText, faces, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
nsTArray<RefPtr<FontFace>> faces;
|
||||
{
|
||||
nsTArray<FontFace*> weakFaces;
|
||||
FindMatchingFontFaces(aFont, aText, weakFaces, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
if (!faces.AppendElements(weakFaces, fallible) ||
|
||||
!promises.SetCapacity(weakFaces.Length(), fallible)) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
for (FontFace* f : faces) {
|
||||
|
|
@ -335,10 +343,7 @@ FontFaceSet::Load(JSContext* aCx,
|
|||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
if (!promises.AppendElement(promise, fallible)) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
promises.AppendElement(promise);
|
||||
}
|
||||
|
||||
return Promise::All(aCx, promises, aRv);
|
||||
|
|
|
|||
|
|
@ -3723,7 +3723,7 @@ CSS_PROP_DISPLAY(
|
|||
kScrollSnapTypeKTable,
|
||||
CSS_PROP_NO_OFFSET,
|
||||
eStyleAnimType_Discrete)
|
||||
CSS_PROP_USERINTERFACE(
|
||||
CSS_PROP_UIRESET(
|
||||
scrollbar-width,
|
||||
scrollbar_width,
|
||||
ScrollbarWidth,
|
||||
|
|
|
|||
|
|
@ -3302,7 +3302,7 @@ nsComputedDOMStyle::DoGetScrollbarWidth()
|
|||
{
|
||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||
val->SetIdent(
|
||||
nsCSSProps::ValueToKeywordEnum(StyleUserInterface()->mScrollbarWidth,
|
||||
nsCSSProps::ValueToKeywordEnum(StyleUIReset()->mScrollbarWidth,
|
||||
nsCSSProps::kScrollbarWidthKTable));
|
||||
return val.forget();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5377,14 +5377,6 @@ nsRuleNode::ComputeUserInterfaceData(void* aStartStruct,
|
|||
// caret-color: auto, color, inherit
|
||||
setComplexColor(aRuleData->ValueForCaretColor(),
|
||||
&nsStyleUserInterface::mCaretColor);
|
||||
|
||||
// scrollbar-width: auto, thin, none
|
||||
SetValue(*aRuleData->ValueForScrollbarWidth(),
|
||||
ui->mScrollbarWidth,
|
||||
conditions,
|
||||
SETVAL_ENUMERATED,
|
||||
parentUI->mScrollbarWidth,
|
||||
StyleScrollbarWidth::Auto);
|
||||
|
||||
COMPUTE_END_INHERITED(UserInterface, ui)
|
||||
}
|
||||
|
|
@ -5434,6 +5426,14 @@ nsRuleNode::ComputeUIResetData(void* aStartStruct,
|
|||
parentUI->mWindowShadow,
|
||||
NS_STYLE_WINDOW_SHADOW_DEFAULT);
|
||||
|
||||
// scrollbar-width: auto, thin, none
|
||||
SetValue(*aRuleData->ValueForScrollbarWidth(),
|
||||
ui->mScrollbarWidth,
|
||||
conditions,
|
||||
SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
|
||||
parentUI->mScrollbarWidth,
|
||||
StyleScrollbarWidth::Auto);
|
||||
|
||||
COMPUTE_END_RESET(UIReset, ui)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -547,6 +547,15 @@ nsStyleBorder::CalcDifference(const nsStyleBorder& aNewData) const
|
|||
return nsChangeHint_NeutralChange;
|
||||
}
|
||||
|
||||
// mBorderImage* fields are checked only when border-image is not 'none'.
|
||||
if (mBorderImageSource != aNewData.mBorderImageSource ||
|
||||
mBorderImageRepeatH != aNewData.mBorderImageRepeatH ||
|
||||
mBorderImageRepeatV != aNewData.mBorderImageRepeatV ||
|
||||
mBorderImageSlice != aNewData.mBorderImageSlice ||
|
||||
mBorderImageWidth != aNewData.mBorderImageWidth) {
|
||||
return nsChangeHint_NeutralChange;
|
||||
}
|
||||
|
||||
return nsChangeHint(0);
|
||||
}
|
||||
|
||||
|
|
@ -3924,7 +3933,6 @@ nsStyleUserInterface::nsStyleUserInterface(nsPresContext* aContext)
|
|||
, mPointerEvents(NS_STYLE_POINTER_EVENTS_AUTO)
|
||||
, mCursor(NS_STYLE_CURSOR_AUTO)
|
||||
, mCaretColor(StyleComplexColor::Auto())
|
||||
, mScrollbarWidth(StyleScrollbarWidth::Auto)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsStyleUserInterface);
|
||||
}
|
||||
|
|
@ -3937,7 +3945,6 @@ nsStyleUserInterface::nsStyleUserInterface(const nsStyleUserInterface& aSource)
|
|||
, mCursor(aSource.mCursor)
|
||||
, mCursorImages(aSource.mCursorImages)
|
||||
, mCaretColor(aSource.mCaretColor)
|
||||
, mScrollbarWidth(aSource.mScrollbarWidth)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsStyleUserInterface);
|
||||
}
|
||||
|
|
@ -3989,13 +3996,6 @@ nsStyleUserInterface::CalcDifference(const nsStyleUserInterface& aNewData) const
|
|||
if (mCaretColor != aNewData.mCaretColor) {
|
||||
hint |= nsChangeHint_RepaintFrame;
|
||||
}
|
||||
|
||||
if (mScrollbarWidth != aNewData.mScrollbarWidth) {
|
||||
// For scrollbar-width change, we need some special handling similar
|
||||
// to overflow properties. Specifically, we may need to reconstruct
|
||||
// the scrollbar or force reflow of the viewport scrollbar.
|
||||
hint |= nsChangeHint_ScrollbarChange;
|
||||
}
|
||||
|
||||
return hint;
|
||||
}
|
||||
|
|
@ -4010,6 +4010,7 @@ nsStyleUIReset::nsStyleUIReset(nsPresContext* aContext)
|
|||
, mIMEMode(NS_STYLE_IME_MODE_AUTO)
|
||||
, mWindowDragging(StyleWindowDragging::Default)
|
||||
, mWindowShadow(NS_STYLE_WINDOW_SHADOW_DEFAULT)
|
||||
, mScrollbarWidth(StyleScrollbarWidth::Auto)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsStyleUIReset);
|
||||
}
|
||||
|
|
@ -4020,6 +4021,7 @@ nsStyleUIReset::nsStyleUIReset(const nsStyleUIReset& aSource)
|
|||
, mIMEMode(aSource.mIMEMode)
|
||||
, mWindowDragging(aSource.mWindowDragging)
|
||||
, mWindowShadow(aSource.mWindowShadow)
|
||||
, mScrollbarWidth(aSource.mScrollbarWidth)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsStyleUIReset);
|
||||
}
|
||||
|
|
@ -4032,25 +4034,40 @@ nsStyleUIReset::~nsStyleUIReset()
|
|||
nsChangeHint
|
||||
nsStyleUIReset::CalcDifference(const nsStyleUIReset& aNewData) const
|
||||
{
|
||||
nsChangeHint hint = nsChangeHint(0);
|
||||
|
||||
// ignore mIMEMode
|
||||
if (mForceBrokenImageIcon != aNewData.mForceBrokenImageIcon) {
|
||||
return nsChangeHint_ReconstructFrame;
|
||||
hint |= nsChangeHint_ReconstructFrame;
|
||||
}
|
||||
|
||||
if (mWindowShadow != aNewData.mWindowShadow) {
|
||||
// We really need just an nsChangeHint_SyncFrameView, except
|
||||
// on an ancestor of the frame, so we get that by doing a
|
||||
// reflow.
|
||||
return NS_STYLE_HINT_REFLOW;
|
||||
hint |= NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
|
||||
if (mUserSelect != aNewData.mUserSelect) {
|
||||
return NS_STYLE_HINT_VISUAL;
|
||||
hint |= NS_STYLE_HINT_VISUAL;
|
||||
}
|
||||
|
||||
if (mWindowDragging != aNewData.mWindowDragging) {
|
||||
return nsChangeHint_SchedulePaint;
|
||||
hint |= nsChangeHint_SchedulePaint;
|
||||
}
|
||||
|
||||
return nsChangeHint(0);
|
||||
if (mScrollbarWidth != aNewData.mScrollbarWidth) {
|
||||
// For scrollbar-width change, we need some special handling similar
|
||||
// to overflow properties. Specifically, we may need to reconstruct
|
||||
// the scrollbar or force reflow of the viewport scrollbar.
|
||||
hint |= nsChangeHint_ScrollbarChange;
|
||||
}
|
||||
|
||||
if (!hint && mIMEMode != aNewData.mIMEMode) {
|
||||
hint |= nsChangeHint_NeutralChange;
|
||||
}
|
||||
|
||||
return hint;
|
||||
}
|
||||
|
||||
//-----------------------
|
||||
|
|
|
|||
|
|
@ -3252,7 +3252,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUIReset
|
|||
nsChangeHint CalcDifference(const nsStyleUIReset& aNewData) const;
|
||||
static nsChangeHint MaxDifference() {
|
||||
return nsChangeHint_ReconstructFrame |
|
||||
NS_STYLE_HINT_REFLOW;
|
||||
NS_STYLE_HINT_REFLOW |
|
||||
nsChangeHint_NeutralChange;
|
||||
}
|
||||
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
||||
// CalcDifference never returns the reflow hints that are sometimes
|
||||
|
|
@ -3267,6 +3268,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUIReset
|
|||
uint8_t mIMEMode; // [reset]
|
||||
mozilla::StyleWindowDragging mWindowDragging; // [reset]
|
||||
uint8_t mWindowShadow; // [reset]
|
||||
mozilla::StyleScrollbarWidth mScrollbarWidth; // [reset]
|
||||
};
|
||||
|
||||
struct nsCursorImage
|
||||
|
|
@ -3344,7 +3346,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUserInterface
|
|||
uint8_t mCursor; // [inherited] See nsStyleConsts.h
|
||||
nsTArray<nsCursorImage> mCursorImages; // [inherited] images and coords
|
||||
mozilla::StyleComplexColor mCaretColor; // [inherited]
|
||||
mozilla::StyleScrollbarWidth mScrollbarWidth;
|
||||
|
||||
inline uint8_t GetEffectivePointerEvents(nsIFrame* aFrame) const;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue