mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-21 09:49:14 +00:00
Implement HTML4 align=middle according to spec. Correct the DOM attribute value mapping for some of the other values as well. b=192077 r+sr=dbaron
This commit is contained in:
parent
02d03b2fe6
commit
377c6c9a64
@ -21,6 +21,7 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mats Palmgren <mats.palmgren@bredband.net>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
@ -2401,37 +2402,21 @@ nsGenericHTMLElement::GetPresContext()
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
// XXX check all mappings against ebina's usage
|
||||
static const nsAttrValue::EnumTable kAlignTable[] = {
|
||||
{ "left", NS_STYLE_TEXT_ALIGN_LEFT },
|
||||
{ "right", NS_STYLE_TEXT_ALIGN_RIGHT },
|
||||
{ "left", NS_STYLE_TEXT_ALIGN_LEFT },
|
||||
{ "right", NS_STYLE_TEXT_ALIGN_RIGHT },
|
||||
|
||||
{ "texttop", NS_STYLE_VERTICAL_ALIGN_TEXT_TOP },// verified
|
||||
{ "baseline", NS_STYLE_VERTICAL_ALIGN_BASELINE },// verified
|
||||
{ "center", NS_STYLE_VERTICAL_ALIGN_MIDDLE },
|
||||
{ "bottom", NS_STYLE_VERTICAL_ALIGN_BASELINE },//verified
|
||||
{ "top", NS_STYLE_VERTICAL_ALIGN_TOP },//verified
|
||||
{ "middle", NS_STYLE_VERTICAL_ALIGN_MIDDLE },//verified
|
||||
{ "absbottom", NS_STYLE_VERTICAL_ALIGN_BOTTOM },//verified
|
||||
{ "abscenter", NS_STYLE_VERTICAL_ALIGN_MIDDLE },/* XXX not the same as ebina */
|
||||
{ "absmiddle", NS_STYLE_VERTICAL_ALIGN_MIDDLE },/* XXX ditto */
|
||||
{ 0 }
|
||||
};
|
||||
{ "top", NS_STYLE_VERTICAL_ALIGN_TOP },
|
||||
{ "middle", NS_STYLE_VERTICAL_ALIGN_MIDDLE_WITH_BASELINE },
|
||||
{ "bottom", NS_STYLE_VERTICAL_ALIGN_BASELINE },
|
||||
|
||||
// Elements that should return vertical align values "middle", "bottom", and "top"
|
||||
// instead of "center", "baseline", and "texttop" from GetAttribute() should use this
|
||||
static const nsAttrValue::EnumTable kVAlignTable[] = {
|
||||
{ "left", NS_STYLE_TEXT_ALIGN_LEFT },
|
||||
{ "right", NS_STYLE_TEXT_ALIGN_RIGHT },
|
||||
{ "top", NS_STYLE_VERTICAL_ALIGN_TOP },//verified
|
||||
{ "texttop", NS_STYLE_VERTICAL_ALIGN_TEXT_TOP },// verified
|
||||
{ "bottom", NS_STYLE_VERTICAL_ALIGN_BASELINE },//verified
|
||||
{ "baseline", NS_STYLE_VERTICAL_ALIGN_BASELINE },// verified
|
||||
{ "middle", NS_STYLE_VERTICAL_ALIGN_MIDDLE },//verified
|
||||
{ "center", NS_STYLE_VERTICAL_ALIGN_MIDDLE },
|
||||
{ "absbottom", NS_STYLE_VERTICAL_ALIGN_BOTTOM },//verified
|
||||
{ "abscenter", NS_STYLE_VERTICAL_ALIGN_MIDDLE },/* XXX not the same as ebina */
|
||||
{ "absmiddle", NS_STYLE_VERTICAL_ALIGN_MIDDLE },/* XXX ditto */
|
||||
{ "center", NS_STYLE_VERTICAL_ALIGN_MIDDLE_WITH_BASELINE },
|
||||
{ "baseline", NS_STYLE_VERTICAL_ALIGN_BASELINE },
|
||||
|
||||
{ "texttop", NS_STYLE_VERTICAL_ALIGN_TEXT_TOP },
|
||||
{ "absmiddle", NS_STYLE_VERTICAL_ALIGN_MIDDLE },
|
||||
{ "abscenter", NS_STYLE_VERTICAL_ALIGN_MIDDLE },
|
||||
{ "absbottom", NS_STYLE_VERTICAL_ALIGN_BOTTOM },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
|
@ -548,14 +548,15 @@
|
||||
// Note: these values pickup after the text-align values because there
|
||||
// are a few html cases where an object can have both types of
|
||||
// alignment applied with a single attribute
|
||||
#define NS_STYLE_VERTICAL_ALIGN_BASELINE 10
|
||||
#define NS_STYLE_VERTICAL_ALIGN_SUB 11
|
||||
#define NS_STYLE_VERTICAL_ALIGN_SUPER 12
|
||||
#define NS_STYLE_VERTICAL_ALIGN_TOP 13
|
||||
#define NS_STYLE_VERTICAL_ALIGN_TEXT_TOP 14
|
||||
#define NS_STYLE_VERTICAL_ALIGN_MIDDLE 15
|
||||
#define NS_STYLE_VERTICAL_ALIGN_TEXT_BOTTOM 16
|
||||
#define NS_STYLE_VERTICAL_ALIGN_BOTTOM 17
|
||||
#define NS_STYLE_VERTICAL_ALIGN_BASELINE 10
|
||||
#define NS_STYLE_VERTICAL_ALIGN_SUB 11
|
||||
#define NS_STYLE_VERTICAL_ALIGN_SUPER 12
|
||||
#define NS_STYLE_VERTICAL_ALIGN_TOP 13
|
||||
#define NS_STYLE_VERTICAL_ALIGN_TEXT_TOP 14
|
||||
#define NS_STYLE_VERTICAL_ALIGN_MIDDLE 15
|
||||
#define NS_STYLE_VERTICAL_ALIGN_TEXT_BOTTOM 16
|
||||
#define NS_STYLE_VERTICAL_ALIGN_BOTTOM 17
|
||||
#define NS_STYLE_VERTICAL_ALIGN_MIDDLE_WITH_BASELINE 18
|
||||
|
||||
// See nsStyleDisplay
|
||||
#define NS_STYLE_VISIBILITY_HIDDEN 0
|
||||
|
@ -25,6 +25,7 @@
|
||||
* L. David Baron <dbaron@dbaron.org>
|
||||
* Robert O'Callahan <roc+moz@cs.cmu.edu>
|
||||
* IBM Corporation
|
||||
* Mats Palmgren <mats.palmgren@bredband.net>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
@ -2279,6 +2280,17 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
||||
}
|
||||
pfd->mVerticalAlign = VALIGN_OTHER;
|
||||
break;
|
||||
|
||||
case NS_STYLE_VERTICAL_ALIGN_MIDDLE_WITH_BASELINE:
|
||||
// Align the midpoint of the frame with the baseline of the parent.
|
||||
if (frameSpan) {
|
||||
pfd->mBounds.y = baselineY - pfd->mBounds.height/2;
|
||||
}
|
||||
else {
|
||||
pfd->mBounds.y = baselineY - logicalHeight/2 + pfd->mMargin.top;
|
||||
}
|
||||
pfd->mVerticalAlign = VALIGN_OTHER;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -143,6 +143,7 @@ CSS_KEY(-moz-malayalam, _moz_malayalam)
|
||||
CSS_KEY(-moz-marker, _moz_marker) // Disabled because not supported correctly.
|
||||
CSS_KEY(-moz-menuhover, _moz_menuhover)
|
||||
CSS_KEY(-moz-menuhovertext, _moz_menuhovertext)
|
||||
CSS_KEY(-moz-middle-with-baseline, _moz_middle_with_baseline)
|
||||
CSS_KEY(-moz-myanmar, _moz_myanmar)
|
||||
CSS_KEY(-moz-oriya, _moz_oriya)
|
||||
CSS_KEY(-moz-persian, _moz_persian)
|
||||
|
@ -897,6 +897,7 @@ const PRInt32 nsCSSProps::kVerticalAlignKTable[] = {
|
||||
eCSSKeyword_top, NS_STYLE_VERTICAL_ALIGN_TOP,
|
||||
eCSSKeyword_text_top, NS_STYLE_VERTICAL_ALIGN_TEXT_TOP,
|
||||
eCSSKeyword_middle, NS_STYLE_VERTICAL_ALIGN_MIDDLE,
|
||||
eCSSKeyword__moz_middle_with_baseline, NS_STYLE_VERTICAL_ALIGN_MIDDLE_WITH_BASELINE,
|
||||
eCSSKeyword_bottom, NS_STYLE_VERTICAL_ALIGN_BOTTOM,
|
||||
eCSSKeyword_text_bottom, NS_STYLE_VERTICAL_ALIGN_TEXT_BOTTOM,
|
||||
eCSSKeyword_UNKNOWN,-1
|
||||
|
Loading…
x
Reference in New Issue
Block a user