mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-25 20:00:42 +00:00
Fixed: in Firefox the text of edited text fields would "jump" down 1 px.
Locking down the line height and vertical alignment explicitly seems to work in Safari 6, Chrome 21, Firefox 14 and IE 8 (although Chrome and IE exhibit some unrelated horizontal jumping.)
This commit is contained in:
@@ -546,7 +546,9 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
element.style.top = topPoint;
|
||||
element.style.left = (_CGRectGetMinX(contentRect) - 1) + "px"; // -1 because input element seems to have 1px left inset
|
||||
element.style.width = _CGRectGetWidth(contentRect) + "px";
|
||||
element.style.height = lineHeight + "px";
|
||||
element.style.height = ROUND(lineHeight) + "px";
|
||||
element.style.lineHeight = ROUND(lineHeight) + "px";
|
||||
element.style.verticalAlign = @"top";
|
||||
|
||||
_DOMElement.appendChild(element);
|
||||
|
||||
|
||||
@@ -432,13 +432,15 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0,
|
||||
{
|
||||
_DOMTextShadowElement = document.createElement("div");
|
||||
|
||||
var shadowStyle = _DOMTextShadowElement.style;
|
||||
var shadowStyle = _DOMTextShadowElement.style,
|
||||
font = (_font || [CPFont systemFontOfSize:CPFontCurrentSystemSize]);
|
||||
|
||||
shadowStyle.font = [(_font || [CPFont systemFontOfSize:CPFontCurrentSystemSize]) cssString];
|
||||
shadowStyle.font = [font cssString];
|
||||
shadowStyle.position = "absolute";
|
||||
shadowStyle.whiteSpace = textStyle.whiteSpace;
|
||||
shadowStyle.wordWrap = textStyle.wordWrap;
|
||||
shadowStyle.color = [_textShadowColor cssString];
|
||||
shadowStyle.lineHeight = [font defaultLineHeightForFont] + "px";
|
||||
|
||||
shadowStyle.zIndex = 150;
|
||||
shadowStyle.textOverflow = textStyle.textOverflow;
|
||||
@@ -484,11 +486,16 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0,
|
||||
|
||||
if (_flags & _CPImageAndTextViewFontChangedFlag)
|
||||
{
|
||||
var fontStyle = [(_font || [CPFont systemFontOfSize:CPFontCurrentSystemSize]) cssString];
|
||||
var font = (_font || [CPFont systemFontOfSize:CPFontCurrentSystemSize]),
|
||||
fontStyle = [font cssString];
|
||||
textStyle.font = fontStyle;
|
||||
textStyle.lineHeight = [font defaultLineHeightForFont] + "px";
|
||||
|
||||
if (shadowStyle)
|
||||
{
|
||||
shadowStyle.font = fontStyle;
|
||||
shadowStyle.lineHeight = [font defaultLineHeightForFont] + "px";
|
||||
}
|
||||
}
|
||||
|
||||
// Update the line break mode if necessary.
|
||||
@@ -713,6 +720,7 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0,
|
||||
textStyle.left = ROUND(textRectX) + "px";
|
||||
textStyle.width = MAX(CEIL(textRectWidth), 0) + "px";
|
||||
textStyle.height = MAX(CEIL(textRectHeight), 0) + "px";
|
||||
textStyle.verticalAlign = @"top";
|
||||
|
||||
if (shadowStyle)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user