Bug 1844195 - Avoid duplicating rust and C++ display definitions. r=layout-reviewers,jfkthame

We need to inline Self::new() so cbindgen generates the constants, which
is kinda lame, but seems better than duplicating the values and type
definitions.

Differential Revision: https://phabricator.services.mozilla.com/D183921
This commit is contained in:
Emilio Cobos Álvarez
2023-07-26 06:46:32 +00:00
parent 3e07e5796c
commit ec9b2f185b
13 changed files with 194 additions and 252 deletions

View File

@@ -5277,7 +5277,7 @@ nsCSSFrameConstructor::FindElementData(const Element& aElement,
bool isRootElement = false;
uint16_t rawDisplayValue =
Servo_ComputedValues_BlockifiedDisplay(&aStyle, isRootElement);
display.mDisplay = StyleDisplay(rawDisplayValue);
display.mDisplay = StyleDisplay{rawDisplayValue};
return FindDisplayData(display, aElement);
}
@@ -8808,8 +8808,7 @@ void nsCSSFrameConstructor::CreateNeededAnonFlexOrGridItems(
/* static */ nsCSSFrameConstructor::RubyWhitespaceType
nsCSSFrameConstructor::ComputeRubyWhitespaceType(StyleDisplay aPrevDisplay,
StyleDisplay aNextDisplay) {
MOZ_ASSERT(nsStyleDisplay::IsRubyDisplayType(aPrevDisplay) &&
nsStyleDisplay::IsRubyDisplayType(aNextDisplay));
MOZ_ASSERT(aPrevDisplay.IsRuby() && aNextDisplay.IsRuby());
if (aPrevDisplay == aNextDisplay &&
(aPrevDisplay == StyleDisplay::RubyBase ||
aPrevDisplay == StyleDisplay::RubyText)) {
@@ -9254,10 +9253,9 @@ void nsCSSFrameConstructor::WrapItemsInPseudoParent(
pseudoType);
}
FrameConstructionItem* newItem = new (this)
FrameConstructionItem(&pseudoData.mFCData,
// Use the content of our parent frame
aParentContent, wrapperStyle.forget(), true);
// Use the content of our parent frame
auto* newItem = new (this) FrameConstructionItem(
&pseudoData.mFCData, aParentContent, wrapperStyle.forget(), true);
const nsStyleDisplay* disp = newItem->mComputedStyle->StyleDisplay();
// Here we're cheating a tad... technically, table-internal items should be