mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 13:25:37 +00:00
Bug 1476054: Fixes and cleanups for Servo PR #21139. r=me
Logical floats don't appear in the computed style objects, so there's no need to check for them. MozReview-Commit-ID: 3ocJrRB3jeO
This commit is contained in:
parent
2912d63914
commit
cd116a52c4
@ -785,7 +785,7 @@ BlockReflowInput::FlowAndPlaceFloat(nsIFrame* aFloat)
|
||||
// Find a place to place the float. The CSS2 spec doesn't want
|
||||
// floats overlapping each other or sticking out of the containing
|
||||
// block if possible (CSS2 spec section 9.5.1, see the rule list).
|
||||
StyleFloat floatStyle = floatDisplay->PhysicalFloats(wm);
|
||||
StyleFloat floatStyle = floatDisplay->mFloat;
|
||||
MOZ_ASSERT(StyleFloat::Left == floatStyle || StyleFloat::Right == floatStyle,
|
||||
"Invalid float type!");
|
||||
|
||||
@ -1045,8 +1045,7 @@ BlockReflowInput::PushFloatPastBreak(nsIFrame *aFloat)
|
||||
// must have their tops below the top of this float)
|
||||
// * don't waste much time trying to reflow this float again until
|
||||
// after the break
|
||||
StyleFloat floatStyle =
|
||||
aFloat->StyleDisplay()->PhysicalFloats(mReflowInput.GetWritingMode());
|
||||
StyleFloat floatStyle = aFloat->StyleDisplay()->mFloat;
|
||||
if (floatStyle == StyleFloat::Left) {
|
||||
FloatManager()->SetPushedLeftFloatPastBreak();
|
||||
} else {
|
||||
|
@ -2187,19 +2187,6 @@ nsStylePosition::MaxBSizeDependsOnContainer(mozilla::WritingMode aWM) const
|
||||
: MaxHeightDependsOnContainer();
|
||||
}
|
||||
|
||||
inline mozilla::StyleFloat
|
||||
nsStyleDisplay::PhysicalFloats(mozilla::WritingMode aWM) const
|
||||
{
|
||||
using StyleFloat = mozilla::StyleFloat;
|
||||
if (mFloat == StyleFloat::InlineStart) {
|
||||
return aWM.IsBidiLTR() ? StyleFloat::Left : StyleFloat::Right;
|
||||
}
|
||||
if (mFloat == StyleFloat::InlineEnd) {
|
||||
return aWM.IsBidiLTR() ? StyleFloat::Right : StyleFloat::Left;
|
||||
}
|
||||
return mFloat;
|
||||
}
|
||||
|
||||
inline mozilla::StyleClear
|
||||
nsStyleDisplay::PhysicalBreakType(mozilla::WritingMode aWM) const
|
||||
{
|
||||
|
@ -4346,8 +4346,7 @@ nsBlockFrame::SplitFloat(BlockReflowInput& aState,
|
||||
nextInFlow->AddStateBits(NS_FRAME_IS_OVERFLOW_CONTAINER);
|
||||
}
|
||||
|
||||
StyleFloat floatStyle =
|
||||
aFloat->StyleDisplay()->PhysicalFloats(aState.mReflowInput.GetWritingMode());
|
||||
StyleFloat floatStyle = aFloat->StyleDisplay()->mFloat;
|
||||
if (floatStyle == StyleFloat::Left) {
|
||||
aState.FloatManager()->SetSplitLeftFloatAcrossBreak();
|
||||
} else {
|
||||
|
@ -206,7 +206,7 @@ nsFloatManager::GetFlowArea(WritingMode aWM, nscoord aBCoord, nscoord aBSize,
|
||||
// This float is in our band.
|
||||
|
||||
// Shrink our band's width if needed.
|
||||
StyleFloat floatStyle = fi.mFrame->StyleDisplay()->PhysicalFloats(aWM);
|
||||
StyleFloat floatStyle = fi.mFrame->StyleDisplay()->mFloat;
|
||||
|
||||
// When aBandInfoType is BandFromPoint, we're only intended to
|
||||
// consider a point along the y axis rather than a band.
|
||||
@ -283,7 +283,7 @@ nsFloatManager::AddFloat(nsIFrame* aFloatFrame, const LogicalRect& aMarginRect,
|
||||
info.mLeftBEnd = nscoord_MIN;
|
||||
info.mRightBEnd = nscoord_MIN;
|
||||
}
|
||||
StyleFloat floatStyle = aFloatFrame->StyleDisplay()->PhysicalFloats(aWM);
|
||||
StyleFloat floatStyle = aFloatFrame->StyleDisplay()->mFloat;
|
||||
MOZ_ASSERT(floatStyle == StyleFloat::Left || floatStyle == StyleFloat::Right,
|
||||
"Unexpected float style!");
|
||||
nscoord& sideBEnd =
|
||||
@ -316,7 +316,7 @@ nsFloatManager::CalculateRegionFor(WritingMode aWM,
|
||||
// Preserve the right margin-edge for left floats and the left
|
||||
// margin-edge for right floats
|
||||
const nsStyleDisplay* display = aFloat->StyleDisplay();
|
||||
StyleFloat floatStyle = display->PhysicalFloats(aWM);
|
||||
StyleFloat floatStyle = display->mFloat;
|
||||
if ((StyleFloat::Left == floatStyle) == aWM.IsBidiLTR()) {
|
||||
region.IStart(aWM) = region.IEnd(aWM);
|
||||
}
|
||||
|
@ -5379,7 +5379,7 @@ nsIFrame::InlinePrefISizeData::ForceBreak(StyleClear aBreakType)
|
||||
}
|
||||
}
|
||||
|
||||
StyleFloat floatStyle = floatDisp->PhysicalFloats(wm);
|
||||
StyleFloat floatStyle = floatDisp->mFloat;
|
||||
nscoord& floats_cur =
|
||||
floatStyle == StyleFloat::Left ? floats_cur_left : floats_cur_right;
|
||||
nscoord floatWidth = floatInfo.Width();
|
||||
@ -5414,7 +5414,7 @@ nsIFrame::InlinePrefISizeData::ForceBreak(StyleClear aBreakType)
|
||||
// no longer any floats we need to keep. See below.
|
||||
for (FloatInfo& floatInfo : Reversed(mFloats)) {
|
||||
const nsStyleDisplay* floatDisp = floatInfo.Frame()->StyleDisplay();
|
||||
if (floatDisp->PhysicalFloats(wm) != clearFloatType) {
|
||||
if (floatDisp->mFloat != clearFloatType) {
|
||||
newFloats.AppendElement(floatInfo);
|
||||
} else {
|
||||
// This is a float on the side that this break directly clears
|
||||
|
@ -78,6 +78,7 @@ SERIALIZED_PREDEFINED_TYPES = [
|
||||
"Content",
|
||||
"CounterIncrement",
|
||||
"CounterReset",
|
||||
"Float",
|
||||
"FontFamily",
|
||||
"FontFeatureSettings",
|
||||
"FontLanguageOverride",
|
||||
|
@ -144,8 +144,6 @@ enum class StyleFloat : uint8_t {
|
||||
None,
|
||||
Left,
|
||||
Right,
|
||||
InlineStart,
|
||||
InlineEnd
|
||||
};
|
||||
|
||||
// float-edge
|
||||
|
@ -2456,10 +2456,6 @@ private:
|
||||
mozilla::ComputedStyle&) const;
|
||||
void GenerateCombinedTransform();
|
||||
public:
|
||||
// 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 mozilla::StyleFloat PhysicalFloats(mozilla::WritingMode aWM) const;
|
||||
inline mozilla::StyleClear PhysicalBreakType(mozilla::WritingMode aWM) const;
|
||||
};
|
||||
|
||||
|
@ -3083,6 +3083,9 @@ fn static_assert() {
|
||||
|
||||
<%call expr="impl_keyword_clone('display', 'mDisplay', display_keyword)"></%call>
|
||||
|
||||
<% float_keyword = Keyword("float", "Left Right None", gecko_enum_prefix="StyleFloat") %>
|
||||
${impl_keyword('float', 'mFloat', float_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;
|
||||
|
@ -3951,6 +3951,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetKeywordValue(
|
||||
use style::properties::{PropertyDeclaration, LonghandId};
|
||||
use style::properties::longhands;
|
||||
use style::values::specified::BorderStyle;
|
||||
use style::values::specified::Float;
|
||||
use style::values::generics::font::FontStyle;
|
||||
|
||||
let long = get_longhand_from_id!(property);
|
||||
@ -3958,10 +3959,19 @@ pub extern "C" fn Servo_DeclarationBlock_SetKeywordValue(
|
||||
|
||||
let prop = match_wrap_declared! { long,
|
||||
MozUserModify => longhands::_moz_user_modify::SpecifiedValue::from_gecko_keyword(value),
|
||||
// TextEmphasisPosition => FIXME implement text-emphasis-position
|
||||
Direction => longhands::direction::SpecifiedValue::from_gecko_keyword(value),
|
||||
Display => longhands::display::SpecifiedValue::from_gecko_keyword(value),
|
||||
Float => longhands::float::SpecifiedValue::from_gecko_keyword(value),
|
||||
Float => {
|
||||
const LEFT: u32 = structs::StyleFloat::Left as u32;
|
||||
const RIGHT: u32 = structs::StyleFloat::Right as u32;
|
||||
const NONE: u32 = structs::StyleFloat::None as u32;
|
||||
match value {
|
||||
LEFT => Float::Left,
|
||||
RIGHT => Float::Right,
|
||||
NONE => Float::None,
|
||||
_ => unreachable!(),
|
||||
}
|
||||
},
|
||||
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),
|
||||
|
Loading…
Reference in New Issue
Block a user