From c2ed5b68a162a4ef53304f706eab2e315fbdd50c Mon Sep 17 00:00:00 2001 From: Thomas Balthazar Date: Sun, 11 Jan 2009 15:50:31 +0100 Subject: [PATCH] solve the problem reported by Ross here : http://groups.google.com/group/objectivej-dev/msg/02549260a9d66f27 --- AppKit/CPTextField.j | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/AppKit/CPTextField.j b/AppKit/CPTextField.j index 805906c8e..b59fe635a 100644 --- a/AppKit/CPTextField.j +++ b/AppKit/CPTextField.j @@ -176,6 +176,7 @@ var _CPTextFieldSquareBezelColor = nil, _DOMTextElement.style.whiteSpace = "pre"; _DOMTextElement.style.cursor = "default"; _DOMTextElement.style.zIndex = 100; + _DOMTextElement.style.overflow = "hidden"; _DOMElement.appendChild(_DOMTextElement); #endif @@ -401,13 +402,22 @@ var _CPTextFieldSquareBezelColor = nil, element.style.color = _DOMElement.style.color; element.style.font = _DOMElement.style.font; element.style.zIndex = 1000; - element.style.width = CGRectGetWidth([self bounds]) - 3.0 + "px"; element.style.marginTop = "0px"; if (_isBezeled && _bezelStyle == CPTextFieldRoundedBezel) - element.style.paddingLeft = ROUNDEDBEZEL_HORIZONTAL_PADDING - 1.0 + "px"; - - //element.style.left = _DOMTextElement.style.left; - //element.style.top = _DOMTextElement.style.top; + { + // http://cappuccino.lighthouseapp.com/projects/16499/tickets/191-cptextfield-shifts-updown-when-receiveslosts-focus + // uncommenting the following 2 lines will solve the problem in Firefox only ... + // element.style.paddingTop = TOP_PADDING - 0.0 + "px" ; + // element.style.paddingLeft = HORIZONTAL_PADDING - 3.0 + "px" ; + + element.style.top = "0px" ; + element.style.left = ROUNDEDBEZEL_HORIZONTAL_PADDING + 1.0 + "px" ; + element.style.width = CGRectGetWidth([self bounds]) - (2 * ROUNDEDBEZEL_HORIZONTAL_PADDING) + "px"; + } + else + { + element.style.width = CGRectGetWidth([self bounds]) - 3.0 + "px"; + } _DOMElement.appendChild(element); window.setTimeout(function() { element.focus(); }, 0.0);