Bug 1513012 - Move overflow to use cbindgen. r=heycam

It's one of the most annoying / hacky mako bits we have.

Differential Revision: https://phabricator.services.mozilla.com/D14084
This commit is contained in:
Emilio Cobos Álvarez 2018-12-11 01:50:32 +01:00
Родитель 45164d338c
Коммит 4591031b65
40 изменённых файлов: 165 добавлений и 195 удалений

Просмотреть файл

@ -1277,8 +1277,8 @@ bool KeyframeEffect::CanThrottleOverflowChangesInScrollable(
}
ScrollStyles ss = scrollable->GetScrollStyles();
if (ss.mVertical == NS_STYLE_OVERFLOW_HIDDEN &&
ss.mHorizontal == NS_STYLE_OVERFLOW_HIDDEN &&
if (ss.mVertical == StyleOverflow::Hidden &&
ss.mHorizontal == StyleOverflow::Hidden &&
scrollable->GetLogicalScrollPosition() == nsPoint(0, 0)) {
return true;
}

Просмотреть файл

@ -6995,7 +6995,7 @@ void nsIDocument::UpdateViewportOverflowType(nscoord aScrolledWidth,
MOZ_ASSERT(mPresShell);
nsPresContext* pc = GetPresContext();
MOZ_ASSERT(pc->GetViewportScrollStylesOverride().mHorizontal ==
NS_STYLE_OVERFLOW_HIDDEN,
StyleOverflow::Hidden,
"Should only be called when viewport has overflow-x: hidden");
MOZ_ASSERT(aScrolledWidth > aScrollportWidth,
"Should only be called when viewport is overflowed");
@ -9317,15 +9317,15 @@ bool nsIDocument::IsPotentiallyScrollable(HTMLBodyElement* aBody) {
MOZ_ASSERT(aBody->GetParent() == aBody->OwnerDoc()->GetRootElement());
nsIFrame* parentFrame = aBody->GetParent()->GetPrimaryFrame();
if (parentFrame &&
parentFrame->StyleDisplay()->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE &&
parentFrame->StyleDisplay()->mOverflowY == NS_STYLE_OVERFLOW_VISIBLE) {
parentFrame->StyleDisplay()->mOverflowX == StyleOverflow::Visible &&
parentFrame->StyleDisplay()->mOverflowY == StyleOverflow::Visible) {
return false;
}
// The element's used value of the overflow-x or overflow-y properties is not
// visible.
if (bodyFrame->StyleDisplay()->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE &&
bodyFrame->StyleDisplay()->mOverflowY == NS_STYLE_OVERFLOW_VISIBLE) {
if (bodyFrame->StyleDisplay()->mOverflowX == StyleOverflow::Visible &&
bodyFrame->StyleDisplay()->mOverflowY == StyleOverflow::Visible) {
return false;
}

Просмотреть файл

@ -2476,8 +2476,8 @@ nsIFrame* EventStateManager::ComputeScrollTargetAndMayAdjustWheelEvent(
}
ScrollStyles ss = scrollableFrame->GetScrollStyles();
bool hiddenForV = (NS_STYLE_OVERFLOW_HIDDEN == ss.mVertical);
bool hiddenForH = (NS_STYLE_OVERFLOW_HIDDEN == ss.mHorizontal);
bool hiddenForV = (StyleOverflow::Hidden == ss.mVertical);
bool hiddenForH = (StyleOverflow::Hidden == ss.mHorizontal);
if ((hiddenForV && hiddenForH) ||
(checkIfScrollableY && !checkIfScrollableX && hiddenForV) ||
(checkIfScrollableX && !checkIfScrollableY && hiddenForH)) {
@ -2585,10 +2585,10 @@ void EventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame,
// Don't scroll around the axis whose overflow style is hidden.
ScrollStyles overflowStyle = aScrollableFrame->GetScrollStyles();
if (overflowStyle.mHorizontal == NS_STYLE_OVERFLOW_HIDDEN) {
if (overflowStyle.mHorizontal == StyleOverflow::Hidden) {
actualDevPixelScrollAmount.x = 0;
}
if (overflowStyle.mVertical == NS_STYLE_OVERFLOW_HIDDEN) {
if (overflowStyle.mVertical == StyleOverflow::Hidden) {
actualDevPixelScrollAmount.y = 0;
}
@ -2688,15 +2688,13 @@ void EventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame,
// additional action such as moving history. In such case, overflowDelta
// values should stay zero.
if (scrollFrameWeak.IsAlive()) {
if (aEvent->mDeltaX &&
overflowStyle.mHorizontal == NS_STYLE_OVERFLOW_HIDDEN &&
if (aEvent->mDeltaX && overflowStyle.mHorizontal == StyleOverflow::Hidden &&
!ComputeScrollTargetAndMayAdjustWheelEvent(
scrollFrame, aEvent,
COMPUTE_SCROLLABLE_ANCESTOR_ALONG_X_AXIS_WITH_AUTO_DIR)) {
aEvent->mOverflowDeltaX = aEvent->mDeltaX;
}
if (aEvent->mDeltaY &&
overflowStyle.mVertical == NS_STYLE_OVERFLOW_HIDDEN &&
if (aEvent->mDeltaY && overflowStyle.mVertical == StyleOverflow::Hidden &&
!ComputeScrollTargetAndMayAdjustWheelEvent(
scrollFrame, aEvent,
COMPUTE_SCROLLABLE_ANCESTOR_ALONG_Y_AXIS_WITH_AUTO_DIR)) {

Просмотреть файл

@ -121,7 +121,7 @@ static CSSPoint ScrollFrameTo(nsIScrollableFrame* aFrame,
// overflow:hidden (that is, we take |targetScrollPosition|). If this turns
// out to be problematic, an alternative solution would be to ignore the
// scroll position change (that is, use |geckoScrollPosition|).
if (aFrame->GetScrollStyles().mVertical == NS_STYLE_OVERFLOW_HIDDEN &&
if (aFrame->GetScrollStyles().mVertical == StyleOverflow::Hidden &&
targetScrollPosition.y != geckoScrollPosition.y) {
NS_WARNING(
nsPrintfCString(
@ -129,7 +129,7 @@ static CSSPoint ScrollFrameTo(nsIScrollableFrame* aFrame,
targetScrollPosition.y, geckoScrollPosition.y)
.get());
}
if (aFrame->GetScrollStyles().mHorizontal == NS_STYLE_OVERFLOW_HIDDEN &&
if (aFrame->GetScrollStyles().mHorizontal == StyleOverflow::Hidden &&
targetScrollPosition.x != geckoScrollPosition.x) {
NS_WARNING(
nsPrintfCString(

Просмотреть файл

@ -3264,7 +3264,7 @@ static void ScrollToShowRect(nsIScrollableFrame* aFrameAsScrollable,
uint32_t directions = aFrameAsScrollable->GetPerceivedScrollingDirections();
if (((aFlags & nsIPresShell::SCROLL_OVERFLOW_HIDDEN) ||
ss.mVertical != NS_STYLE_OVERFLOW_HIDDEN) &&
ss.mVertical != StyleOverflow::Hidden) &&
(!aVertical.mOnlyIfPerceivedScrollableDirection ||
(directions & nsIScrollableFrame::VERTICAL))) {
if (ComputeNeedToScroll(aVertical.mWhenToScroll, lineSize.height, aRect.y,
@ -3280,7 +3280,7 @@ static void ScrollToShowRect(nsIScrollableFrame* aFrameAsScrollable,
}
if (((aFlags & nsIPresShell::SCROLL_OVERFLOW_HIDDEN) ||
ss.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN) &&
ss.mHorizontal != StyleOverflow::Hidden) &&
(!aHorizontal.mOnlyIfPerceivedScrollableDirection ||
(directions & nsIScrollableFrame::HORIZONTAL))) {
if (ComputeNeedToScroll(aHorizontal.mWhenToScroll, lineSize.width, aRect.x,

Просмотреть файл

@ -9,7 +9,7 @@
namespace mozilla {
ScrollStyles::ScrollStyles(uint8_t aH, uint8_t aV,
ScrollStyles::ScrollStyles(StyleOverflow aH, StyleOverflow aV,
const nsStyleDisplay* aDisplay)
: mHorizontal(aH),
mVertical(aV),

Просмотреть файл

@ -18,30 +18,29 @@ struct nsStyleDisplay;
namespace mozilla {
struct ScrollStyles {
// Always one of NS_STYLE_OVERFLOW_SCROLL, NS_STYLE_OVERFLOW_HIDDEN,
// or NS_STYLE_OVERFLOW_AUTO.
uint8_t mHorizontal;
uint8_t mVertical;
// Always one of Scroll, Hidden, or Auto
StyleOverflow mHorizontal;
StyleOverflow mVertical;
// Always one of NS_STYLE_SCROLL_BEHAVIOR_AUTO or
// NS_STYLE_SCROLL_BEHAVIOR_SMOOTH
uint8_t mScrollBehavior;
mozilla::StyleOverscrollBehavior mOverscrollBehaviorX;
mozilla::StyleOverscrollBehavior mOverscrollBehaviorY;
mozilla::StyleScrollSnapType mScrollSnapTypeX;
mozilla::StyleScrollSnapType mScrollSnapTypeY;
StyleOverscrollBehavior mOverscrollBehaviorX;
StyleOverscrollBehavior mOverscrollBehaviorY;
StyleScrollSnapType mScrollSnapTypeX;
StyleScrollSnapType mScrollSnapTypeY;
nsStyleCoord mScrollSnapPointsX;
nsStyleCoord mScrollSnapPointsY;
nsStyleCoord::CalcValue mScrollSnapDestinationX;
nsStyleCoord::CalcValue mScrollSnapDestinationY;
ScrollStyles(uint8_t aH, uint8_t aV)
ScrollStyles(StyleOverflow aH, StyleOverflow aV)
: mHorizontal(aH),
mVertical(aV),
mScrollBehavior(NS_STYLE_SCROLL_BEHAVIOR_AUTO),
mOverscrollBehaviorX(StyleOverscrollBehavior::Auto),
mOverscrollBehaviorY(StyleOverscrollBehavior::Auto),
mScrollSnapTypeX(mozilla::StyleScrollSnapType::None),
mScrollSnapTypeY(mozilla::StyleScrollSnapType::None),
mScrollSnapTypeX(StyleScrollSnapType::None),
mScrollSnapTypeY(StyleScrollSnapType::None),
mScrollSnapPointsX(nsStyleCoord(eStyleUnit_None)),
mScrollSnapPointsY(nsStyleCoord(eStyleUnit_None)) {
mScrollSnapDestinationX.mPercent = 0;
@ -53,7 +52,7 @@ struct ScrollStyles {
}
explicit ScrollStyles(const nsStyleDisplay* aDisplay);
ScrollStyles(uint8_t aH, uint8_t aV, const nsStyleDisplay* aDisplay);
ScrollStyles(StyleOverflow aH, StyleOverflow aV, const nsStyleDisplay*);
bool operator==(const ScrollStyles& aStyles) const {
return aStyles.mHorizontal == mHorizontal &&
aStyles.mVertical == mVertical &&
@ -71,8 +70,8 @@ struct ScrollStyles {
return !(*this == aStyles);
}
bool IsHiddenInBothDirections() const {
return mHorizontal == NS_STYLE_OVERFLOW_HIDDEN &&
mVertical == NS_STYLE_OVERFLOW_HIDDEN;
return mHorizontal == StyleOverflow::Hidden &&
mVertical == StyleOverflow::Hidden;
}
bool IsSmoothScroll(dom::ScrollBehavior aBehavior) const {
return aBehavior == dom::ScrollBehavior::Smooth ||

Просмотреть файл

@ -1827,9 +1827,9 @@ nsIScrollableFrame* nsLayoutUtils::GetNearestScrollableFrameForDirection(
ScrollStyles ss = scrollableFrame->GetScrollStyles();
uint32_t directions = scrollableFrame->GetPerceivedScrollingDirections();
if (aDirection == eVertical
? (ss.mVertical != NS_STYLE_OVERFLOW_HIDDEN &&
? (ss.mVertical != StyleOverflow::Hidden &&
(directions & nsIScrollableFrame::VERTICAL))
: (ss.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN &&
: (ss.mHorizontal != StyleOverflow::Hidden &&
(directions & nsIScrollableFrame::HORIZONTAL)))
return scrollableFrame;
}
@ -1854,8 +1854,8 @@ nsIScrollableFrame* nsLayoutUtils::GetNearestScrollableFrame(nsIFrame* aFrame,
} else {
ScrollStyles ss = scrollableFrame->GetScrollStyles();
if ((aFlags & SCROLLABLE_INCLUDE_HIDDEN) ||
ss.mVertical != NS_STYLE_OVERFLOW_HIDDEN ||
ss.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN) {
ss.mVertical != StyleOverflow::Hidden ||
ss.mHorizontal != StyleOverflow::Hidden) {
return scrollableFrame;
}
}
@ -5386,7 +5386,7 @@ static void AddStateBitToAncestors(nsIFrame* aFrame, nsFrameState aBit) {
nscoord* fixedMinSize = nullptr;
auto minSizeUnit = size.GetUnit();
if (minSizeUnit == eStyleUnit_Auto) {
if (aFrame->StyleDisplay()->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE) {
if (aFrame->StyleDisplay()->mOverflowX == StyleOverflow::Visible) {
size = aAxis == eAxisHorizontal ? stylePos->mWidth : stylePos->mHeight;
// This is same as above: keywords should behaves as property's initial
// values in block axis.
@ -8339,12 +8339,12 @@ nsLayoutUtils::ScrollbarAreaToExcludeFromCompositionBoundsFor(
nsPoint scrollPosition = aScrollableFrame->GetScrollPosition();
if (aScrollableFrame->GetScrollStyles().mVertical ==
NS_STYLE_OVERFLOW_HIDDEN) {
StyleOverflow::Hidden) {
contentBounds.y = scrollPosition.y;
contentBounds.height = 0;
}
if (aScrollableFrame->GetScrollStyles().mHorizontal ==
NS_STYLE_OVERFLOW_HIDDEN) {
StyleOverflow::Hidden) {
contentBounds.x = scrollPosition.x;
contentBounds.width = 0;
}

Просмотреть файл

@ -193,7 +193,7 @@ nsPresContext::nsPresContext(nsIDocument* aDocument, nsPresContextType aType)
mFocusTextColor(mDefaultColor),
mBodyTextColor(mDefaultColor),
mViewportScrollOverrideElement(nullptr),
mViewportScrollStyles(NS_STYLE_OVERFLOW_AUTO, NS_STYLE_OVERFLOW_AUTO),
mViewportScrollStyles(StyleOverflow::Auto, StyleOverflow::Auto),
mFocusRingWidth(1),
mExistThrottledUpdates(false),
// mImageAnimationMode is initialised below, in constructor body
@ -1240,7 +1240,7 @@ gfxSize nsPresContext::ScreenSizeInchesForFontInflation(bool* aChanged) {
static bool CheckOverflow(const nsStyleDisplay* aDisplay,
ScrollStyles* aStyles) {
if (aDisplay->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE &&
if (aDisplay->mOverflowX == StyleOverflow::Visible &&
aDisplay->mScrollBehavior == NS_STYLE_SCROLL_BEHAVIOR_AUTO &&
aDisplay->mOverscrollBehaviorX == StyleOverscrollBehavior::Auto &&
aDisplay->mOverscrollBehaviorY == StyleOverscrollBehavior::Auto &&
@ -1255,9 +1255,9 @@ static bool CheckOverflow(const nsStyleDisplay* aDisplay,
return false;
}
if (aDisplay->mOverflowX == NS_STYLE_OVERFLOW_CLIP) {
*aStyles = ScrollStyles(NS_STYLE_OVERFLOW_HIDDEN, NS_STYLE_OVERFLOW_HIDDEN,
aDisplay);
if (aDisplay->mOverflowX == StyleOverflow::MozHiddenUnscrollable) {
*aStyles =
ScrollStyles(StyleOverflow::Hidden, StyleOverflow::Hidden, aDisplay);
} else {
*aStyles = ScrollStyles(aDisplay);
}
@ -1315,7 +1315,7 @@ static Element* GetPropagatedScrollStylesForViewport(
Element* nsPresContext::UpdateViewportScrollStylesOverride() {
// Start off with our default styles, and then update them as needed.
mViewportScrollStyles =
ScrollStyles(NS_STYLE_OVERFLOW_AUTO, NS_STYLE_OVERFLOW_AUTO);
ScrollStyles(StyleOverflow::Auto, StyleOverflow::Auto);
mViewportScrollOverrideElement = nullptr;
// Don't propagate the scrollbar state in printing or print preview.
if (!IsPaginated()) {
@ -1333,7 +1333,7 @@ Element* nsPresContext::UpdateViewportScrollStylesOverride() {
if (fullscreenElement != document->GetRootElement() &&
fullscreenElement != mViewportScrollOverrideElement) {
mViewportScrollStyles =
ScrollStyles(NS_STYLE_OVERFLOW_HIDDEN, NS_STYLE_OVERFLOW_HIDDEN);
ScrollStyles(StyleOverflow::Hidden, StyleOverflow::Hidden);
}
}
return mViewportScrollOverrideElement;
@ -1351,7 +1351,7 @@ bool nsPresContext::ElementWouldPropagateScrollStyles(const Element& aElement) {
// but saves us having to have more complicated code or more code duplication;
// in practice we will make this call quite rarely, because we checked for all
// the common cases above.
ScrollStyles dummy(NS_STYLE_OVERFLOW_AUTO, NS_STYLE_OVERFLOW_AUTO);
ScrollStyles dummy(StyleOverflow::Auto, StyleOverflow::Auto);
return GetPropagatedScrollStylesForViewport(this, &dummy) == &aElement;
}

Просмотреть файл

@ -72,7 +72,7 @@ nsresult nsHTMLButtonControlFrame::HandleEvent(nsPresContext* aPresContext,
}
bool nsHTMLButtonControlFrame::ShouldClipPaintingToBorderBox() {
return IsInput() || StyleDisplay()->mOverflowX != NS_STYLE_OVERFLOW_VISIBLE;
return IsInput() || StyleDisplay()->mOverflowX != StyleOverflow::Visible;
}
void nsHTMLButtonControlFrame::BuildDisplayList(

Просмотреть файл

@ -602,12 +602,11 @@ void nsListControlFrame::ReflowAsDropdown(nsPresContext* aPresContext,
ScrollStyles nsListControlFrame::GetScrollStyles() const {
// We can't express this in the style system yet; when we can, this can go
// away and GetScrollStyles can be devirtualized
int32_t style =
IsInDropDownMode() ? NS_STYLE_OVERFLOW_AUTO : NS_STYLE_OVERFLOW_SCROLL;
auto style = IsInDropDownMode() ? StyleOverflow::Auto : StyleOverflow::Scroll;
if (GetWritingMode().IsVertical()) {
return ScrollStyles(style, NS_STYLE_OVERFLOW_HIDDEN);
return ScrollStyles(style, StyleOverflow::Hidden);
} else {
return ScrollStyles(NS_STYLE_OVERFLOW_HIDDEN, style);
return ScrollStyles(StyleOverflow::Hidden, style);
}
}

Просмотреть файл

@ -443,11 +443,11 @@ nsresult nsTextControlFrame::CreateRootNode() {
if (!IsSingleLineTextControl()) {
// We can't just inherit the overflow because setting visible overflow will
// crash when the number of lines exceeds the height of the textarea and
// setting -moz-hidden-unscrollable overflow (NS_STYLE_OVERFLOW_CLIP)
// doesn't paint the caret for some reason.
// setting -moz-hidden-unscrollable overflow doesn't paint the caret for
// some reason.
const nsStyleDisplay* disp = StyleDisplay();
if (disp->mOverflowX != NS_STYLE_OVERFLOW_VISIBLE &&
disp->mOverflowX != NS_STYLE_OVERFLOW_CLIP) {
if (disp->mOverflowX != StyleOverflow::Visible &&
disp->mOverflowX != StyleOverflow::MozHiddenUnscrollable) {
classValue.AppendLiteral(" inherit-overflow");
}
}

Просмотреть файл

@ -407,7 +407,7 @@ void ReflowInput::Init(nsPresContext* aPresContext,
nsIFrame* parent = mFrame->GetParent();
if (parent && (parent->GetStateBits() & NS_FRAME_IN_CONSTRAINED_BSIZE) &&
!(parent->IsScrollFrame() &&
parent->StyleDisplay()->mOverflowY != NS_STYLE_OVERFLOW_HIDDEN)) {
parent->StyleDisplay()->mOverflowY != StyleOverflow::Hidden)) {
mFrame->AddStateBits(NS_FRAME_IN_CONSTRAINED_BSIZE);
} else if (type == LayoutFrameType::SVGForeignObject) {
// An SVG foreignObject frame is inherently constrained block-size.

Просмотреть файл

@ -102,7 +102,7 @@ static bool IsInlineAxisOverflowVisible(nsIFrame* aFrame) {
auto overflow = aFrame->GetWritingMode().IsVertical()
? f->StyleDisplay()->mOverflowY
: f->StyleDisplay()->mOverflowX;
return overflow == NS_STYLE_OVERFLOW_VISIBLE;
return overflow == StyleOverflow::Visible;
}
static void ClipMarker(const nsRect& aContentArea, const nsRect& aMarkerRect,
@ -314,7 +314,7 @@ TextOverflow::TextOverflow(nsDisplayListBuilder* aBuilder,
auto scrollbarStyle = mBlockWM.IsVertical()
? mScrollableFrame->GetScrollStyles().mVertical
: mScrollableFrame->GetScrollStyles().mHorizontal;
mCanHaveInlineAxisScrollbar = scrollbarStyle != NS_STYLE_OVERFLOW_HIDDEN;
mCanHaveInlineAxisScrollbar = scrollbarStyle != StyleOverflow::Hidden;
if (!mAdjustForPixelSnapping) {
// Scrolling to the end position can leave some text still overflowing due
// to pixel snapping behaviour in our scrolling code.

Просмотреть файл

@ -2036,7 +2036,7 @@ void FlexItem::CheckForMinSizeAuto(const ReflowInput& aFlexItemReflowInput,
// non-'visible' due to the way the subproperties interact.
mNeedsMinSizeAutoResolution =
IsAutoOrEnumOnBSize(mainMinSize, IsInlineAxisMainAxis()) &&
disp->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE;
disp->mOverflowX == StyleOverflow::Visible;
}
nscoord FlexItem::GetBaselineOffsetFromOuterCrossEdge(

Просмотреть файл

@ -8895,8 +8895,8 @@ bool nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
// children are actually clipped to the padding-box, but since the
// overflow area should include the entire border-box, just set it to
// the border-box here.
NS_ASSERTION((disp->mOverflowY == NS_STYLE_OVERFLOW_CLIP) ==
(disp->mOverflowX == NS_STYLE_OVERFLOW_CLIP),
NS_ASSERTION((disp->mOverflowY == StyleOverflow::MozHiddenUnscrollable) ==
(disp->mOverflowX == StyleOverflow::MozHiddenUnscrollable),
"If one overflow is clip, the other should be too");
if (applyOverflowClipping) {
// The contents are actually clipped to the padding area
@ -8917,8 +8917,8 @@ bool nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
}
}
// Note that NS_STYLE_OVERFLOW_CLIP doesn't clip the frame background,
// so we add theme background overflow here so it's not clipped.
// Note that StyleOverflow::MozHiddenUnscrollable doesn't clip the frame
// background, so we add theme background overflow here so it's not clipped.
if (!::IsXULBoxWrapped(this) && IsThemed(disp)) {
nsRect r(bounds);
nsPresContext* presContext = PresContext();

Просмотреть файл

@ -588,7 +588,8 @@ class nsFrame : public nsBox {
const nsStyleDisplay* aDisp) {
// clip overflow:-moz-hidden-unscrollable, except for nsListControlFrame,
// which is an nsHTMLScrollFrame.
if (MOZ_UNLIKELY(aDisp->mOverflowX == NS_STYLE_OVERFLOW_CLIP &&
if (MOZ_UNLIKELY(aDisp->mOverflowX ==
mozilla::StyleOverflow::MozHiddenUnscrollable &&
!aFrame->IsListControlFrame())) {
return true;
}
@ -603,8 +604,8 @@ class nsFrame : public nsBox {
}
// and overflow:hidden that we should interpret as -moz-hidden-unscrollable
if (aDisp->mOverflowX == NS_STYLE_OVERFLOW_HIDDEN &&
aDisp->mOverflowY == NS_STYLE_OVERFLOW_HIDDEN) {
if (aDisp->mOverflowX == mozilla::StyleOverflow::Hidden &&
aDisp->mOverflowY == mozilla::StyleOverflow::Hidden) {
// REVIEW: these are the frame types that set up clipping.
mozilla::LayoutFrameType type = aFrame->Type();
if (type == mozilla::LayoutFrameType::Table ||

Просмотреть файл

@ -1613,7 +1613,7 @@ nsIFrame* nsFrameSelection::GetFrameToPageSelect() const {
continue;
}
ScrollStyles scrollStyles = scrollableFrame->GetScrollStyles();
if (scrollStyles.mVertical == NS_STYLE_OVERFLOW_HIDDEN) {
if (scrollStyles.mVertical == StyleOverflow::Hidden) {
continue;
}
uint32_t directions = scrollableFrame->GetPerceivedScrollingDirections();

Просмотреть файл

@ -189,14 +189,14 @@ enum class ShowScrollbar : uint8_t {
Never,
};
static ShowScrollbar ShouldShowScrollbar(uint8_t aOverflow) {
static ShowScrollbar ShouldShowScrollbar(StyleOverflow aOverflow) {
switch (aOverflow) {
case NS_STYLE_OVERFLOW_SCROLL:
case StyleOverflow::Scroll:
return ShowScrollbar::Always;
case NS_STYLE_OVERFLOW_HIDDEN:
case StyleOverflow::Hidden:
return ShowScrollbar::Never;
default:
case NS_STYLE_OVERFLOW_AUTO:
case StyleOverflow::Auto:
return ShowScrollbar::Auto;
}
}
@ -432,7 +432,7 @@ bool nsHTMLScrollFrame::TryLayout(ScrollReflowInput* aState,
// care about what the page itself specifies.
nsPresContext* pc = PresContext();
ScrollStyles styles = pc->GetViewportScrollStylesOverride();
if (styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN) {
if (styles.mHorizontal != StyleOverflow::Hidden) {
break;
}
// Only top level content document is considered.
@ -798,7 +798,7 @@ void nsHTMLScrollFrame::PlaceScrollArea(ScrollReflowInput& aState,
nscoord nsHTMLScrollFrame::GetIntrinsicVScrollbarWidth(
gfxContext* aRenderingContext) {
ScrollStyles ss = GetScrollStyles();
if (ss.mVertical != NS_STYLE_OVERFLOW_SCROLL || !mHelper.mVScrollbarBox)
if (ss.mVertical != StyleOverflow::Scroll || !mHelper.mVScrollbarBox)
return 0;
// Don't need to worry about reflow depth here since it's
@ -1310,9 +1310,9 @@ bool ScrollFrameHelper::WantAsyncScroll() const {
}
bool isVScrollable = (scrollRange.height >= oneDevPixel) &&
(styles.mVertical != NS_STYLE_OVERFLOW_HIDDEN);
(styles.mVertical != StyleOverflow::Hidden);
bool isHScrollable = (scrollRange.width >= oneDevPixel) &&
(styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN);
(styles.mHorizontal != StyleOverflow::Hidden);
#if defined(MOZ_WIDGET_ANDROID)
// Mobile platforms need focus to scroll text inputs.
@ -1516,14 +1516,13 @@ nsSize nsXULScrollFrame::GetXULPrefSize(nsBoxLayoutState& aState) {
// scrolled frames don't have their own margins
if (mHelper.mVScrollbarBox && styles.mVertical == NS_STYLE_OVERFLOW_SCROLL) {
if (mHelper.mVScrollbarBox && styles.mVertical == StyleOverflow::Scroll) {
nsSize vSize = mHelper.mVScrollbarBox->GetXULPrefSize(aState);
nsBox::AddMargin(mHelper.mVScrollbarBox, vSize);
pref.width += vSize.width;
}
if (mHelper.mHScrollbarBox &&
styles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL) {
if (mHelper.mHScrollbarBox && styles.mHorizontal == StyleOverflow::Scroll) {
nsSize hSize = mHelper.mHScrollbarBox->GetXULPrefSize(aState);
nsBox::AddMargin(mHelper.mHScrollbarBox, hSize);
pref.height += hSize.height;
@ -1540,15 +1539,14 @@ nsSize nsXULScrollFrame::GetXULMinSize(nsBoxLayoutState& aState) {
ScrollStyles styles = GetScrollStyles();
if (mHelper.mVScrollbarBox && styles.mVertical == NS_STYLE_OVERFLOW_SCROLL) {
if (mHelper.mVScrollbarBox && styles.mVertical == StyleOverflow::Scroll) {
nsSize vSize = mHelper.mVScrollbarBox->GetXULMinSize(aState);
AddMargin(mHelper.mVScrollbarBox, vSize);
min.width += vSize.width;
if (min.height < vSize.height) min.height = vSize.height;
}
if (mHelper.mHScrollbarBox &&
styles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL) {
if (mHelper.mHScrollbarBox && styles.mHorizontal == StyleOverflow::Scroll) {
nsSize hSize = mHelper.mHScrollbarBox->GetXULMinSize(aState);
AddMargin(mHelper.mHScrollbarBox, hSize);
min.height += hSize.height;
@ -2392,8 +2390,8 @@ bool ScrollFrameHelper::IsAlwaysActive() const {
// If we're overflow:hidden, then start as inactive until
// we get scrolled manually.
ScrollStyles styles = GetScrollStylesFromFrame();
return (styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN &&
styles.mVertical != NS_STYLE_OVERFLOW_HIDDEN);
return (styles.mHorizontal != StyleOverflow::Hidden &&
styles.mVertical != StyleOverflow::Hidden);
}
static void RemoveDisplayPortCallback(nsITimer* aTimer, void* aClosure) {
@ -3876,7 +3874,7 @@ bool ScrollFrameHelper::IsRectNearlyVisible(const nsRect& aRect) const {
}
static void HandleScrollPref(nsIScrollable* aScrollable, int32_t aOrientation,
uint8_t& aValue) {
StyleOverflow& aValue) {
int32_t pref;
aScrollable->GetDefaultScrollbarPreferences(aOrientation, &pref);
switch (pref) {
@ -3884,10 +3882,10 @@ static void HandleScrollPref(nsIScrollable* aScrollable, int32_t aOrientation,
// leave |aValue| untouched
break;
case nsIScrollable::Scrollbar_Never:
aValue = NS_STYLE_OVERFLOW_HIDDEN;
aValue = StyleOverflow::Hidden;
break;
case nsIScrollable::Scrollbar_Always:
aValue = NS_STYLE_OVERFLOW_SCROLL;
aValue = StyleOverflow::Scroll;
break;
}
}
@ -3896,7 +3894,7 @@ ScrollStyles ScrollFrameHelper::GetScrollStylesFromFrame() const {
nsPresContext* presContext = mOuter->PresContext();
if (!presContext->IsDynamic() &&
!(mIsRoot && presContext->HasPaginatedScrolling())) {
return ScrollStyles(NS_STYLE_OVERFLOW_HIDDEN, NS_STYLE_OVERFLOW_HIDDEN);
return ScrollStyles(StyleOverflow::Hidden, StyleOverflow::Hidden);
}
if (!mIsRoot) {
@ -4537,8 +4535,8 @@ nsresult ScrollFrameHelper::CreateAnonymousContent(
canHaveVertical = false;
} else {
ScrollStyles styles = scrollable->GetScrollStyles();
canHaveHorizontal = styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN;
canHaveVertical = styles.mVertical != NS_STYLE_OVERFLOW_HIDDEN;
canHaveHorizontal = styles.mHorizontal != StyleOverflow::Hidden;
canHaveVertical = styles.mVertical != StyleOverflow::Hidden;
}
if (!canHaveHorizontal && !canHaveVertical && !isResizable) {
// Nothing to do.
@ -5222,9 +5220,9 @@ nsresult nsXULScrollFrame::XULLayout(nsBoxLayoutState& aState) {
ScrollStyles styles = GetScrollStyles();
// Look at our style do we always have vertical or horizontal scrollbars?
if (styles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL)
if (styles.mHorizontal == StyleOverflow::Scroll)
mHelper.mHasHorizontalScrollbar = true;
if (styles.mVertical == NS_STYLE_OVERFLOW_SCROLL)
if (styles.mVertical == StyleOverflow::Scroll)
mHelper.mHasVerticalScrollbar = true;
if (mHelper.mHasHorizontalScrollbar)
@ -5240,13 +5238,13 @@ nsresult nsXULScrollFrame::XULLayout(nsBoxLayoutState& aState) {
bool needsLayout = false;
// if we have 'auto' scrollbars look at the vertical case
if (styles.mVertical != NS_STYLE_OVERFLOW_SCROLL) {
if (styles.mVertical != StyleOverflow::Scroll) {
// These are only good until the call to LayoutScrollArea.
nsRect scrolledRect = mHelper.GetScrolledRect();
// There are two cases to consider
if (scrolledRect.height <= mHelper.mScrollPort.height ||
styles.mVertical != NS_STYLE_OVERFLOW_AUTO) {
styles.mVertical != StyleOverflow::Auto) {
if (mHelper.mHasVerticalScrollbar) {
// We left room for the vertical scrollbar, but it's not needed;
// remove it.
@ -5272,14 +5270,14 @@ nsresult nsXULScrollFrame::XULLayout(nsBoxLayoutState& aState) {
}
// if scrollbars are auto look at the horizontal case
if (styles.mHorizontal != NS_STYLE_OVERFLOW_SCROLL) {
if (styles.mHorizontal != StyleOverflow::Scroll) {
// These are only good until the call to LayoutScrollArea.
nsRect scrolledRect = mHelper.GetScrolledRect();
// if the child is wider that the scroll area
// and we don't have a scrollbar add one.
if ((scrolledRect.width > mHelper.mScrollPort.width) &&
styles.mHorizontal == NS_STYLE_OVERFLOW_AUTO) {
styles.mHorizontal == StyleOverflow::Auto) {
if (!mHelper.mHasHorizontalScrollbar) {
// no scrollbar?
if (AddHorizontalScrollbar(aState, scrollbarBottom)) {
@ -5305,7 +5303,7 @@ nsresult nsXULScrollFrame::XULLayout(nsBoxLayoutState& aState) {
// Refresh scrolledRect because we called LayoutScrollArea.
scrolledRect = mHelper.GetScrolledRect();
if (styles.mVertical == NS_STYLE_OVERFLOW_AUTO &&
if (styles.mVertical == StyleOverflow::Auto &&
!mHelper.mHasVerticalScrollbar &&
scrolledRect.height > mHelper.mScrollPort.height) {
if (AddVerticalScrollbar(aState, scrollbarRight)) {
@ -5558,12 +5556,12 @@ bool ScrollFrameHelper::ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) {
bool needReflow = false;
nsPoint scrollPosition = GetScrollPosition();
if (overflowChange & nsIScrollableFrame::HORIZONTAL) {
if (ss.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN || scrollPosition.x) {
if (ss.mHorizontal != StyleOverflow::Hidden || scrollPosition.x) {
needReflow = true;
}
}
if (overflowChange & nsIScrollableFrame::VERTICAL) {
if (ss.mVertical != NS_STYLE_OVERFLOW_HIDDEN || scrollPosition.y) {
if (ss.mVertical != StyleOverflow::Hidden || scrollPosition.y) {
needReflow = true;
}
}
@ -6138,7 +6136,7 @@ void ScrollFrameHelper::RestoreState(PresState* aState) {
if (mIsRoot) {
nsIPresShell* presShell = mOuter->PresShell();
presShell->SetResolutionAndScaleTo(aState->resolution(),
presShell->SetResolutionAndScaleTo(aState->resolution(),
nsGkAtoms::restore);
}
}

Просмотреть файл

@ -613,7 +613,7 @@ struct nsGridContainerFrame::GridItemInfo {
aContainerWM.IsOrthogonalTo(mFrame->GetWritingMode()) &&
minSize.GetUnit() == eStyleUnit_Enumerated);
return isAuto &&
mFrame->StyleDisplay()->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE;
mFrame->StyleDisplay()->mOverflowX == StyleOverflow::Visible;
}
#ifdef DEBUG
@ -3597,7 +3597,7 @@ static nscoord MinSize(const GridItemInfo& aGridItem,
: style.GetUnit();
if (unit == eStyleUnit_Enumerated ||
(unit == eStyleUnit_Auto &&
child->StyleDisplay()->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE)) {
child->StyleDisplay()->mOverflowX == StyleOverflow::Visible)) {
// Now calculate the "content size" part and return whichever is smaller.
MOZ_ASSERT(unit != eStyleUnit_Enumerated || sz == NS_UNCONSTRAINEDSIZE);
sz = std::min(

Просмотреть файл

@ -61,8 +61,8 @@ class nsIScrollableFrame : public nsIScrollbarMediator {
virtual nsIFrame* GetScrolledFrame() const = 0;
/**
* Get the styles (NS_STYLE_OVERFLOW_SCROLL, NS_STYLE_OVERFLOW_HIDDEN,
* or NS_STYLE_OVERFLOW_AUTO) governing the horizontal and vertical
* Get the styles (StyleOverflow::Scroll, StyleOverflow::Hidden,
* or StyleOverflow::Auto) governing the horizontal and vertical
* scrollbars for this frame.
*/
virtual mozilla::ScrollStyles GetScrollStyles() const = 0;

Просмотреть файл

@ -409,6 +409,7 @@ cbindgen-types = [
{ gecko = "StyleFloat", servo = "values::computed::Float" },
{ gecko = "StyleOverscrollBehavior", servo = "values::computed::OverscrollBehavior" },
{ gecko = "StyleTextAlign", servo = "values::computed::TextAlign" },
{ gecko = "StyleOverflow", servo = "values::computed::Overflow" },
]
mapped-generic-types = [

Просмотреть файл

@ -128,6 +128,7 @@ SERIALIZED_PREDEFINED_TYPES = [
"OverflowClipBox",
"ScrollSnapType",
"Float",
"Overflow",
]
def serialized_by_servo(prop):

Просмотреть файл

@ -48,7 +48,6 @@ CSS_KEY(-moz-grid-group, _moz_grid_group)
CSS_KEY(-moz-grid-line, _moz_grid_line)
CSS_KEY(-moz-grid, _moz_grid)
CSS_KEY(-moz-groupbox, _moz_groupbox)
CSS_KEY(-moz-hidden-unscrollable, _moz_hidden_unscrollable)
CSS_KEY(-moz-inline-box, _moz_inline_box)
CSS_KEY(-moz-inline-grid, _moz_inline_grid)
CSS_KEY(-moz-inline-stack, _moz_inline_stack)
@ -116,7 +115,6 @@ CSS_KEY(grabbing, grabbing)
CSS_KEY(grayscale, grayscale)
CSS_KEY(grid, grid)
CSS_KEY(help, help)
CSS_KEY(hidden, hidden)
CSS_KEY(hue-rotate, hue_rotate)
CSS_KEY(infinite, infinite)
CSS_KEY(inline, inline)
@ -184,7 +182,6 @@ CSS_KEY(scale3d, scale3d)
CSS_KEY(scalex, scalex)
CSS_KEY(scaley, scaley)
CSS_KEY(scalez, scalez)
CSS_KEY(scroll, scroll)
CSS_KEY(se-resize, se_resize)
CSS_KEY(self-end, self_end)
CSS_KEY(self-start, self_start)
@ -230,7 +227,6 @@ CSS_KEY(under, under)
CSS_KEY(underline, underline)
CSS_KEY(unsafe, unsafe)
CSS_KEY(vertical-text, vertical_text)
CSS_KEY(visible, visible)
CSS_KEY(w-resize, w_resize)
CSS_KEY(wait, wait)
CSS_KEY(wavy, wavy)

Просмотреть файл

@ -447,15 +447,6 @@ const KTableEntry nsCSSProps::kContainKTable[] = {
{eCSSKeyword_size, NS_STYLE_CONTAIN_SIZE},
{eCSSKeyword_UNKNOWN, -1}};
const KTableEntry nsCSSProps::kOverflowSubKTable[] = {
{eCSSKeyword_auto, NS_STYLE_OVERFLOW_AUTO},
{eCSSKeyword_visible, NS_STYLE_OVERFLOW_VISIBLE},
{eCSSKeyword_hidden, NS_STYLE_OVERFLOW_HIDDEN},
{eCSSKeyword_scroll, NS_STYLE_OVERFLOW_SCROLL},
// Deprecated:
{eCSSKeyword__moz_hidden_unscrollable, NS_STYLE_OVERFLOW_CLIP},
{eCSSKeyword_UNKNOWN, -1}};
const KTableEntry nsCSSProps::kTextAlignKTable[] = {
{eCSSKeyword_left, NS_STYLE_TEXT_ALIGN_LEFT},
{eCSSKeyword_right, NS_STYLE_TEXT_ALIGN_RIGHT},

Просмотреть файл

@ -316,7 +316,6 @@ class nsCSSProps {
static const KTableEntry kGridTrackBreadthKTable[];
static const KTableEntry kLineHeightKTable[];
static const KTableEntry kContainKTable[];
static const KTableEntry kOverflowSubKTable[];
static const KTableEntry kTextAlignKTable[];
static const KTableEntry kTextDecorationLineKTable[];
static const KTableEntry kTextDecorationStyleKTable[];

Просмотреть файл

@ -2515,13 +2515,6 @@ already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetWillChange() {
return valueList.forget();
}
already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetOverflowY() {
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mOverflowY,
nsCSSProps::kOverflowSubKTable));
return val.forget();
}
already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetTouchAction() {
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;

Просмотреть файл

@ -557,15 +557,6 @@ enum class StyleGridTrackBreadth : uint8_t {
#define NS_STYLE_FRAME_SCROLL 7
#define NS_STYLE_FRAME_NOSCROLL 8
// See nsStyleDisplay.mOverflow{X,Y}
#define NS_STYLE_OVERFLOW_VISIBLE 0
#define NS_STYLE_OVERFLOW_HIDDEN 1
#define NS_STYLE_OVERFLOW_SCROLL 2
#define NS_STYLE_OVERFLOW_AUTO 3
#define NS_STYLE_OVERFLOW_CLIP 4
#define NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL 5
#define NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL 6
// See nsStyleList
#define NS_STYLE_LIST_STYLE_CUSTOM -1 // for @counter-style
#define NS_STYLE_LIST_STYLE_NONE 0

Просмотреть файл

@ -2977,8 +2977,8 @@ nsStyleDisplay::nsStyleDisplay(const nsPresContext* aContext)
mBreakInside(StyleBreakWithin::Auto),
mBreakBefore(StyleBreakBetween::Auto),
mBreakAfter(StyleBreakBetween::Auto),
mOverflowX(NS_STYLE_OVERFLOW_VISIBLE),
mOverflowY(NS_STYLE_OVERFLOW_VISIBLE),
mOverflowX(StyleOverflow::Visible),
mOverflowY(StyleOverflow::Visible),
mOverflowClipBoxBlock(StyleOverflowClipBox::PaddingBox),
mOverflowClipBoxInline(StyleOverflowClipBox::PaddingBox),
mResize(StyleResize::None),

Просмотреть файл

@ -1902,8 +1902,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay {
mozilla::StyleBreakWithin mBreakInside;
mozilla::StyleBreakBetween mBreakBefore;
mozilla::StyleBreakBetween mBreakAfter;
uint8_t mOverflowX; // NS_STYLE_OVERFLOW_*
uint8_t mOverflowY; // NS_STYLE_OVERFLOW_*
mozilla::StyleOverflow mOverflowX;
mozilla::StyleOverflow mOverflowY;
mozilla::StyleOverflowClipBox mOverflowClipBoxBlock;
mozilla::StyleOverflowClipBox mOverflowClipBoxInline;
mozilla::StyleResize mResize;
@ -2137,9 +2137,9 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay {
bool IsScrollableOverflow() const {
// 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;
// Visible or MozHiddenUnscrollable.
return mOverflowX != mozilla::StyleOverflow::Visible &&
mOverflowX != mozilla::StyleOverflow::MozHiddenUnscrollable;
}
bool IsContainPaint() const {

Просмотреть файл

@ -926,8 +926,8 @@ gfxRect nsSVGUtils::GetClipRectForFrame(nsIFrame* aFrame, float aX, float aY,
return gfxRect(aX, aY, aWidth, aHeight);
}
if (disp->mOverflowX == NS_STYLE_OVERFLOW_HIDDEN ||
disp->mOverflowY == NS_STYLE_OVERFLOW_HIDDEN) {
if (disp->mOverflowX == StyleOverflow::Hidden ||
disp->mOverflowY == StyleOverflow::Hidden) {
nsIntRect clipPxRect = effects->mClip.ToOutsidePixels(
aFrame->PresContext()->AppUnitsPerDevPixel());
gfxRect clipRect = gfxRect(clipPxRect.x, clipPxRect.y, clipPxRect.width,
@ -940,11 +940,11 @@ gfxRect nsSVGUtils::GetClipRectForFrame(nsIFrame* aFrame, float aX, float aY,
clipRect.height = aHeight - clipRect.Y();
}
if (disp->mOverflowX != NS_STYLE_OVERFLOW_HIDDEN) {
if (disp->mOverflowX != StyleOverflow::Hidden) {
clipRect.x = aX;
clipRect.width = aWidth;
}
if (disp->mOverflowY != NS_STYLE_OVERFLOW_HIDDEN) {
if (disp->mOverflowY != StyleOverflow::Hidden) {
clipRect.y = aY;
clipRect.height = aHeight;
}

Просмотреть файл

@ -305,10 +305,11 @@ nsresult nsIFrame::XULLayout(nsBoxLayoutState& aState) {
bool nsBox::DoesClipChildren() {
const nsStyleDisplay* display = StyleDisplay();
NS_ASSERTION((display->mOverflowY == NS_STYLE_OVERFLOW_CLIP) ==
(display->mOverflowX == NS_STYLE_OVERFLOW_CLIP),
"If one overflow is clip, the other should be too");
return display->mOverflowX == NS_STYLE_OVERFLOW_CLIP;
NS_ASSERTION(
(display->mOverflowY == StyleOverflow::MozHiddenUnscrollable) ==
(display->mOverflowX == StyleOverflow::MozHiddenUnscrollable),
"If one overflow is -moz-hidden-unscrollable, the other should be too");
return display->mOverflowX == StyleOverflow::MozHiddenUnscrollable;
}
nsresult nsBox::SyncLayout(nsBoxLayoutState& aState) {

Просмотреть файл

@ -64,5 +64,6 @@ include = [
"ScrollSnapType",
"OverflowClipBox",
"Resize",
"Overflow",
]
item_types = ["enums", "structs", "typedefs"]

Просмотреть файл

@ -325,6 +325,7 @@ class Longhand(object):
"NonNegativeNumber",
"Opacity",
"OutlineStyle",
"Overflow",
"OverflowClipBox",
"OverflowWrap",
"OverscrollBehavior",

Просмотреть файл

@ -1394,6 +1394,7 @@ impl Clone for ${style_struct.gecko_struct_name} {
"OverflowClipBox": impl_simple,
"ScrollSnapType": impl_simple,
"Float": impl_simple,
"Overflow": impl_simple,
"BreakBetween": impl_simple,
"BreakWithin": impl_simple,
"Resize": impl_simple,
@ -3011,7 +3012,7 @@ fn static_assert() {
}
</%def>
<% skip_box_longhands= """display overflow-y vertical-align
<% skip_box_longhands= """display vertical-align
animation-name animation-delay animation-duration
animation-direction animation-fill-mode animation-play-state
animation-iteration-count animation-timing-function
@ -3063,28 +3064,6 @@ fn static_assert() {
) %>
${impl_keyword('clear', 'mBreakType', clear_keyword)}
<% overflow_x = data.longhands_by_name["overflow-x"] %>
pub fn set_overflow_y(&mut self, v: longhands::overflow_y::computed_value::T) {
use crate::properties::longhands::overflow_x::computed_value::T as BaseType;
// FIXME(bholley): Align binary representations and ditch |match| for cast + static_asserts
self.gecko.mOverflowY = match v {
% for value in overflow_x.keyword.values_for('gecko'):
BaseType::${to_camel_case(value)} => structs::${overflow_x.keyword.gecko_constant(value)} as u8,
% endfor
};
}
${impl_simple_copy('overflow_y', 'mOverflowY')}
pub fn clone_overflow_y(&self) -> longhands::overflow_y::computed_value::T {
use crate::properties::longhands::overflow_x::computed_value::T as BaseType;
// FIXME(bholley): Align binary representations and ditch |match| for cast + static_asserts
match self.gecko.mOverflowY as u32 {
% for value in overflow_x.keyword.values_for('gecko'):
structs::${overflow_x.keyword.gecko_constant(value)} => BaseType::${to_camel_case(value)},
% endfor
x => panic!("Found unexpected value in style struct for overflow_y property: {}", x),
}
}
pub fn set_vertical_align(&mut self, v: longhands::vertical_align::computed_value::T) {
use crate::values::generics::box_::VerticalAlign;
let value = match v {

Просмотреть файл

@ -100,34 +100,30 @@ ${helpers.single_keyword("-servo-overflow-clip-box", "padding-box content-box",
)}
% endfor
<%
overflow_custom_consts = { "-moz-hidden-unscrollable": "CLIP" }
%>
// FIXME(pcwalton, #2742): Implement scrolling for `scroll` and `auto`.
//
// We allow it to apply to placeholders for UA sheets, which set it !important.
${helpers.single_keyword(
${helpers.predefined_type(
"overflow-x",
"visible hidden scroll auto",
"Overflow",
"computed::Overflow::Visible",
animation_value_type="discrete",
extra_gecko_values="-moz-hidden-unscrollable",
custom_consts=overflow_custom_consts,
gecko_constant_prefix="NS_STYLE_OVERFLOW",
flags="APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-overflow/#propdef-overflow-x",
needs_context=False,
servo_restyle_damage = "reflow",
)}
// FIXME(pcwalton, #2742): Implement scrolling for `scroll` and `auto`.
//
// We allow it to apply to placeholders for UA sheets, which set it !important.
<%helpers:longhand name="overflow-y" animation_value_type="discrete"
flags="APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-overflow/#propdef-overflow-y"
servo_restyle_damage = "reflow">
pub use super::overflow_x::{SpecifiedValue, parse, get_initial_value, computed_value};
</%helpers:longhand>
${helpers.predefined_type(
"overflow-y",
"Overflow",
"computed::Overflow::Visible",
animation_value_type="discrete",
flags="APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-overflow/#propdef-overflow-y",
needs_context=False,
servo_restyle_damage = "reflow",
)}
<% transition_extra_prefixes = "moz:layout.css.prefixes.transitions webkit" %>

Просмотреть файл

@ -13,7 +13,7 @@ use crate::values::specified::box_ as specified;
pub use crate::values::specified::box_::{AnimationName, Appearance, BreakBetween, BreakWithin};
pub use crate::values::specified::box_::{Clear as SpecifiedClear, Float as SpecifiedFloat};
pub use crate::values::specified::box_::{Contain, Display, OverflowClipBox};
pub use crate::values::specified::box_::{Contain, Display, Overflow, OverflowClipBox};
pub use crate::values::specified::box_::{OverscrollBehavior, ScrollSnapType};
pub use crate::values::specified::box_::{TouchAction, TransitionProperty, WillChange};

Просмотреть файл

@ -43,7 +43,7 @@ pub use self::border::{BorderImageRepeat, BorderImageSideWidth};
pub use self::border::{BorderImageSlice, BorderImageWidth};
pub use self::box_::{AnimationIterationCount, AnimationName, Contain};
pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float};
pub use self::box_::{Display, TransitionProperty};
pub use self::box_::{Display, TransitionProperty, Overflow};
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize};
pub use self::box_::{ScrollSnapType, TouchAction, VerticalAlign, WillChange};
pub use self::color::{Color, ColorPropertyValue, RGBAColor};

Просмотреть файл

@ -1363,3 +1363,28 @@ pub enum BreakWithin {
Auto,
Avoid,
}
/// The value for the `overflow-x` / `overflow-y` properties.
#[allow(missing_docs)]
#[derive(
Clone,
Copy,
Debug,
Eq,
Hash,
MallocSizeOf,
Parse,
PartialEq,
SpecifiedValueInfo,
ToCss,
ToComputedValue,
)]
#[repr(u8)]
pub enum Overflow {
Visible,
Hidden,
Scroll,
Auto,
#[cfg(feature = "gecko")]
MozHiddenUnscrollable,
}

Просмотреть файл

@ -36,7 +36,7 @@ pub use self::border::{BorderCornerRadius, BorderImageSlice, BorderImageWidth};
pub use self::border::{BorderImageRepeat, BorderImageSideWidth};
pub use self::border::{BorderRadius, BorderSideWidth, BorderSpacing, BorderStyle};
pub use self::box_::{AnimationIterationCount, AnimationName, Contain, Display};
pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float};
pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float, Overflow};
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize};
pub use self::box_::{ScrollSnapType, TouchAction, TransitionProperty, VerticalAlign, WillChange};
pub use self::color::{Color, ColorPropertyValue, RGBAColor};