mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Make hypothetical box calculation consider types that are inline-outside rather than just inline. (Bug 505706) r=bzbarsky
Change the "hypothetical box" calculations that we do for 'auto'-offset absolutely positioned elements take its inline codepath (using horizontal position of placeholder, and placing even with the top of the placeholder's line) rather than its block codepath (using the horizontal edge of the containing block, and placing below the placeholder's line) when display types are display-outside:inline types other than display:inline.
This commit is contained in:
parent
7d5e63fc04
commit
8e79f76734
@ -977,7 +977,7 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsPresContext* aPresContext,
|
||||
|
||||
// How we determine the hypothetical box depends on whether the element
|
||||
// would have been inline-level or block-level
|
||||
if (NS_STYLE_DISPLAY_INLINE == mStyleDisplay->mOriginalDisplay) {
|
||||
if (mStyleDisplay->IsOriginalDisplayInlineOutside()) {
|
||||
// Use the top of the inline box which the placeholder lives in
|
||||
// as the hypothetical box's top.
|
||||
aHypotheticalBox.mTop = lineBox->mBounds.y + blockYOffset;
|
||||
@ -1029,7 +1029,7 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsPresContext* aPresContext,
|
||||
if (NS_STYLE_DIRECTION_LTR == blockVis->mDirection) {
|
||||
// How we determine the hypothetical box depends on whether the element
|
||||
// would have been inline-level or block-level
|
||||
if (NS_STYLE_DISPLAY_INLINE == mStyleDisplay->mOriginalDisplay) {
|
||||
if (mStyleDisplay->IsOriginalDisplayInlineOutside()) {
|
||||
// The placeholder represents the left edge of the hypothetical box
|
||||
aHypotheticalBox.mLeft = placeholderOffset.x;
|
||||
} else {
|
||||
@ -1056,7 +1056,7 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsPresContext* aPresContext,
|
||||
|
||||
} else {
|
||||
// The placeholder represents the right edge of the hypothetical box
|
||||
if (NS_STYLE_DISPLAY_INLINE == mStyleDisplay->mOriginalDisplay) {
|
||||
if (mStyleDisplay->IsOriginalDisplayInlineOutside()) {
|
||||
aHypotheticalBox.mRight = placeholderOffset.x;
|
||||
} else {
|
||||
aHypotheticalBox.mRight = aBlockLeftContentEdge + aBlockContentWidth;
|
||||
|
@ -0,0 +1,6 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>'auto' offset properties on display:inline-block (reference)</title>
|
||||
<style>
|
||||
p { font-family: monospace /* avoid kerning */ }
|
||||
</style>
|
||||
<p>HelloWorld</p>
|
10
layout/reftests/abs-pos/auto-offset-inline-block-1.html
Normal file
10
layout/reftests/abs-pos/auto-offset-inline-block-1.html
Normal file
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>'auto' offset properties on display:inline-block</title>
|
||||
<style>
|
||||
p { font-family: monospace /* avoid kerning */ }
|
||||
span {
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
}
|
||||
</style>
|
||||
<p>Hello<span>World</span></p>
|
@ -1,2 +1,3 @@
|
||||
== font-size-wrap.html font-size-wrap-ref.html
|
||||
== abs-pos-auto-margin-1.html abs-pos-auto-margin-1-ref.html
|
||||
== auto-offset-inline-block-1.html auto-offset-inline-block-1-ref.html
|
||||
|
@ -1551,13 +1551,21 @@ struct nsStyleDisplay {
|
||||
NS_STYLE_DISPLAY_TABLE == mDisplay;
|
||||
}
|
||||
|
||||
static PRBool IsDisplayTypeInlineOutside(PRUint8 aDisplay) {
|
||||
return NS_STYLE_DISPLAY_INLINE == aDisplay ||
|
||||
NS_STYLE_DISPLAY_INLINE_BLOCK == aDisplay ||
|
||||
NS_STYLE_DISPLAY_INLINE_TABLE == aDisplay ||
|
||||
NS_STYLE_DISPLAY_INLINE_BOX == aDisplay ||
|
||||
NS_STYLE_DISPLAY_INLINE_GRID == aDisplay ||
|
||||
NS_STYLE_DISPLAY_INLINE_STACK == aDisplay;
|
||||
}
|
||||
|
||||
PRBool IsInlineOutside() const {
|
||||
return NS_STYLE_DISPLAY_INLINE == mDisplay ||
|
||||
NS_STYLE_DISPLAY_INLINE_BLOCK == mDisplay ||
|
||||
NS_STYLE_DISPLAY_INLINE_TABLE == mDisplay ||
|
||||
NS_STYLE_DISPLAY_INLINE_BOX == mDisplay ||
|
||||
NS_STYLE_DISPLAY_INLINE_GRID == mDisplay ||
|
||||
NS_STYLE_DISPLAY_INLINE_STACK == mDisplay;
|
||||
return IsDisplayTypeInlineOutside(mDisplay);
|
||||
}
|
||||
|
||||
PRBool IsOriginalDisplayInlineOutside() const {
|
||||
return IsDisplayTypeInlineOutside(mOriginalDisplay);
|
||||
}
|
||||
|
||||
PRBool IsFloating() const {
|
||||
|
Loading…
Reference in New Issue
Block a user