Bug 1476054: Fixes and cleanups for Servo PR #21156. r=me

Similar to the previous patch, logical clear doesn't appear in computed style
objects.

MozReview-Commit-ID: FbN0hiUGzYa
This commit is contained in:
Emilio Cobos Álvarez 2018-07-16 19:01:24 +02:00
Родитель c501db36f9
Коммит 9325870208
12 изменённых файлов: 19 добавлений и 37 удалений

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

@ -158,7 +158,7 @@ BRFrame::Reflow(nsPresContext* aPresContext,
}
// Return our reflow status
StyleClear breakType = aReflowInput.mStyleDisplay->PhysicalBreakType(wm);
StyleClear breakType = aReflowInput.mStyleDisplay->mBreakType;
if (StyleClear::None == breakType) {
breakType = StyleClear::Line;
}

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

@ -742,7 +742,7 @@ BlockReflowInput::FlowAndPlaceFloat(nsIFrame* aFloat)
// when floats are inserted before it.
if (StyleClear::None != floatDisplay->mBreakType) {
// XXXldb Does this handle vertical margins correctly?
mBCoord = ClearFloats(mBCoord, floatDisplay->PhysicalBreakType(wm));
mBCoord = ClearFloats(mBCoord, floatDisplay->mBreakType);
}
// Get the band of available space with respect to margin box.
nsFlowAreaRect floatAvailableSpace =

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

@ -2187,19 +2187,6 @@ nsStylePosition::MaxBSizeDependsOnContainer(mozilla::WritingMode aWM) const
: MaxHeightDependsOnContainer();
}
inline mozilla::StyleClear
nsStyleDisplay::PhysicalBreakType(mozilla::WritingMode aWM) const
{
using StyleClear = mozilla::StyleClear;
if (mBreakType == StyleClear::InlineStart) {
return aWM.IsBidiLTR() ? StyleClear::Left : StyleClear::Right;
}
if (mBreakType == StyleClear::InlineEnd) {
return aWM.IsBidiLTR() ? StyleClear::Right : StyleClear::Left;
}
return mBreakType;
}
inline bool
nsStyleMargin::HasBlockAxisAuto(mozilla::WritingMode aWM) const
{

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

@ -842,8 +842,7 @@ nsBlockFrame::GetPrefISize(gfxContext *aRenderingContext)
if (!data.mLineIsEmpty || BlockCanIntersectFloats(line->mFirstChild)) {
breakType = StyleClear::Both;
} else {
breakType = line->mFirstChild->
StyleDisplay()->PhysicalBreakType(data.mLineContainerWM);
breakType = line->mFirstChild->StyleDisplay()->mBreakType;
}
data.ForceBreak(breakType);
data.mCurrentLine = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
@ -3226,8 +3225,7 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
// Prepare the block reflow engine
nsBlockReflowContext brc(aState.mPresContext, aState.mReflowInput);
StyleClear breakType = frame->StyleDisplay()->
PhysicalBreakType(aState.mReflowInput.GetWritingMode());
StyleClear breakType = frame->StyleDisplay()->mBreakType;
if (StyleClear::None != aState.mFloatBreakType) {
breakType = nsLayoutUtils::CombineBreakType(breakType,
aState.mFloatBreakType);

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

@ -5357,12 +5357,11 @@ nsIFrame::InlinePrefISizeData::ForceBreak(StyleClear aBreakType)
// been cleared past
floats_cur_left = 0,
floats_cur_right = 0;
const WritingMode wm = mLineContainerWM;
for (uint32_t i = 0, i_end = mFloats.Length(); i != i_end; ++i) {
const FloatInfo& floatInfo = mFloats[i];
const nsStyleDisplay* floatDisp = floatInfo.Frame()->StyleDisplay();
StyleClear breakType = floatDisp->PhysicalBreakType(wm);
StyleClear breakType = floatDisp->mBreakType;
if (breakType == StyleClear::Left ||
breakType == StyleClear::Right ||
breakType == StyleClear::Both) {
@ -5424,7 +5423,7 @@ nsIFrame::InlinePrefISizeData::ForceBreak(StyleClear aBreakType)
// (earlier) floats on that side would be indirectly cleared
// as well. Thus, we should break out of this loop and stop
// considering earlier floats to be kept in mFloats.
StyleClear floatBreakType = floatDisp->PhysicalBreakType(wm);
StyleClear floatBreakType = floatDisp->mBreakType;
if (floatBreakType != aBreakType &&
floatBreakType != StyleClear::None) {
break;

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

@ -2190,7 +2190,7 @@ public:
const nsLineList_iterator* mLine;
// The line container. Private, to ensure we always use SetLineContainer
// to update it (so that we have a chance to store the mLineContainerWM).
// to update it.
//
// Note that nsContainerFrame::DoInlineIntrinsicISize will clear the
// |mLine| and |mLineContainer| fields when following a next-in-flow link,
@ -2203,9 +2203,6 @@ public:
void SetLineContainer(nsIFrame* aLineContainer)
{
mLineContainer = aLineContainer;
if (mLineContainer) {
mLineContainerWM = mLineContainer->GetWritingMode();
}
}
nsIFrame* LineContainer() const { return mLineContainer; }
@ -2226,10 +2223,6 @@ public:
// and when the last text ended with whitespace.
bool mSkipWhitespace;
// Writing mode of the line container (stored here so that we don't
// lose track of it if the mLineContainer field is reset).
mozilla::WritingMode mLineContainerWM;
// Floats encountered in the lines.
class FloatInfo {
public:

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

@ -210,8 +210,6 @@ nsLineBox::BreakTypeToString(StyleClear aBreakType)
case StyleClear::None: return "nobr";
case StyleClear::Left: return "leftbr";
case StyleClear::Right: return "rightbr";
case StyleClear::InlineStart: return "inlinestartbr";
case StyleClear::InlineEnd: return "inlineendbr";
case StyleClear::Both: return "leftbr+rightbr";
case StyleClear::Line: return "linebr";
case StyleClear::Max: return "leftbr+rightbr+linebr";

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

@ -74,6 +74,7 @@ def method(prop):
# moved or perhaps using a blacklist for the ones with non-layout-dependence
# but other non-trivial dependence like scrollbar colors.
SERIALIZED_PREDEFINED_TYPES = [
"Clear",
"Color",
"Content",
"CounterIncrement",

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

@ -77,11 +77,12 @@ enum class StyleClear : uint8_t {
None = 0,
Left,
Right,
InlineStart,
InlineEnd,
Both,
// StyleClear::Line can be added to one of the other values in layout
// so it needs to use a bit value that none of the other values can have.
//
// FIXME(emilio): Doesn't look like we do that anymore, so probably can be
// made a single value instead, and Max removed.
Line = 8,
Max = 13 // Max = (Both | Line)
};

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

@ -2455,8 +2455,6 @@ private:
inline bool HasFixedPosContainingBlockStyleInternal(
mozilla::ComputedStyle&) const;
void GenerateCombinedTransform();
public:
inline mozilla::StyleClear PhysicalBreakType(mozilla::WritingMode aWM) const;
};
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTable

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

@ -3086,6 +3086,14 @@ fn static_assert() {
<% float_keyword = Keyword("float", "Left Right None", gecko_enum_prefix="StyleFloat") %>
${impl_keyword('float', 'mFloat', float_keyword)}
<% clear_keyword = Keyword(
"clear",
"Left Right None Both",
gecko_enum_prefix="StyleClear",
gecko_inexhaustive=True,
) %>
${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 properties::longhands::overflow_x::computed_value::T as BaseType;

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

@ -3975,7 +3975,6 @@ pub extern "C" fn Servo_DeclarationBlock_SetKeywordValue(
VerticalAlign => longhands::vertical_align::SpecifiedValue::from_gecko_keyword(value),
TextAlign => longhands::text_align::SpecifiedValue::from_gecko_keyword(value),
TextEmphasisPosition => longhands::text_emphasis_position::SpecifiedValue::from_gecko_keyword(value),
Clear => longhands::clear::SpecifiedValue::from_gecko_keyword(value),
FontSize => {
// We rely on Gecko passing in font-size values (0...7) here.
longhands::font_size::SpecifiedValue::from_html_size(value as u8)