[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

kocienda kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:00:38 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 094c4f896e90448fb289d6f5fdf39f3fc28008e2
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 10 18:40:34 2003 +0000

            Reviewed by John
    
    	Fix for this bug:
    
    	<rdar://problem/3440703>: Textarea form controls do not respect disabled attribute
    
            * khtml/rendering/render_form.cpp:
            (RenderTextArea::updateFromElement): Check for disabled attribute.
            * kwq/KWQTextArea.h:
            * kwq/KWQTextArea.mm:
            (-[KWQTextArea setEnabled:]): Added.
            (-[KWQTextArea isEnabled]): Added.
            (-[KWQTextArea drawRect:]): Draws a disabled-looking  bezel when disabled.
            (-[KWQTextAreaTextView becomeFirstResponder]): Return NO if disabled.
            (-[KWQTextAreaTextView mouseDown:]): Block events if disabled.
            (-[KWQTextAreaTextView keyDown:]): Ditto.
            (-[KWQTextAreaTextView keyUp:]): Ditto.
            (-[KWQTextAreaTextView setEnabled:]): Added. Pass value through to editable
    	attribute on text view.
            (-[KWQTextAreaTextView isEnabled]): Added.
            (-[KWQTextAreaTextView drawRect:]): Set the text color to a disabled color
    	when disabled.
            * kwq/KWQTextEdit.h:
            * kwq/KWQTextEdit.mm:
            (QTextEdit::isDisabled): Added.
            (QTextEdit::setDisabled): Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5166 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 6751a36..46b8721 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,32 @@
+2003-10-10  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by John
+
+	Fix for this bug:
+
+	<rdar://problem/3440703>: Textarea form controls do not respect disabled attribute
+
+        * khtml/rendering/render_form.cpp:
+        (RenderTextArea::updateFromElement): Check for disabled attribute.
+        * kwq/KWQTextArea.h:
+        * kwq/KWQTextArea.mm:
+        (-[KWQTextArea setEnabled:]): Added. 
+        (-[KWQTextArea isEnabled]): Added.
+        (-[KWQTextArea drawRect:]): Draws a disabled-looking  bezel when disabled.
+        (-[KWQTextAreaTextView becomeFirstResponder]): Return NO if disabled.
+        (-[KWQTextAreaTextView mouseDown:]): Block events if disabled.
+        (-[KWQTextAreaTextView keyDown:]): Ditto.
+        (-[KWQTextAreaTextView keyUp:]): Ditto.
+        (-[KWQTextAreaTextView setEnabled:]): Added. Pass value through to editable
+	attribute on text view.
+        (-[KWQTextAreaTextView isEnabled]): Added.
+        (-[KWQTextAreaTextView drawRect:]): Set the text color to a disabled color
+	when disabled.
+        * kwq/KWQTextEdit.h:
+        * kwq/KWQTextEdit.mm:
+        (QTextEdit::isDisabled): Added.
+        (QTextEdit::setDisabled): Added.
+
 2003-10-10  Maciej Stachowiak  <mjs at apple.com>
 
 	- fixed 3449405 - REGRESSION: reproducible crash changing focus w/ button on page, e.g. on www.aa.com
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 6751a36..46b8721 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,32 @@
+2003-10-10  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by John
+
+	Fix for this bug:
+
+	<rdar://problem/3440703>: Textarea form controls do not respect disabled attribute
+
+        * khtml/rendering/render_form.cpp:
+        (RenderTextArea::updateFromElement): Check for disabled attribute.
+        * kwq/KWQTextArea.h:
+        * kwq/KWQTextArea.mm:
+        (-[KWQTextArea setEnabled:]): Added. 
+        (-[KWQTextArea isEnabled]): Added.
+        (-[KWQTextArea drawRect:]): Draws a disabled-looking  bezel when disabled.
+        (-[KWQTextAreaTextView becomeFirstResponder]): Return NO if disabled.
+        (-[KWQTextAreaTextView mouseDown:]): Block events if disabled.
+        (-[KWQTextAreaTextView keyDown:]): Ditto.
+        (-[KWQTextAreaTextView keyUp:]): Ditto.
+        (-[KWQTextAreaTextView setEnabled:]): Added. Pass value through to editable
+	attribute on text view.
+        (-[KWQTextAreaTextView isEnabled]): Added.
+        (-[KWQTextAreaTextView drawRect:]): Set the text color to a disabled color
+	when disabled.
+        * kwq/KWQTextEdit.h:
+        * kwq/KWQTextEdit.mm:
+        (QTextEdit::isDisabled): Added.
+        (QTextEdit::setDisabled): Added.
+
 2003-10-10  Maciej Stachowiak  <mjs at apple.com>
 
 	- fixed 3449405 - REGRESSION: reproducible crash changing focus w/ button on page, e.g. on www.aa.com
diff --git a/WebCore/khtml/rendering/render_form.cpp b/WebCore/khtml/rendering/render_form.cpp
index b21d392..403d609 100644
--- a/WebCore/khtml/rendering/render_form.cpp
+++ b/WebCore/khtml/rendering/render_form.cpp
@@ -1372,6 +1372,9 @@ void RenderTextArea::updateFromElement()
 {
     TextAreaWidget* w = static_cast<TextAreaWidget*>(m_widget);
     w->setReadOnly(element()->readOnly());
+#ifdef APPLE_CHANGES
+    w->setDisabled(element()->disabled());
+#endif
     w->setAlignment(style()->direction() == RTL ? Qt::AlignRight : Qt::AlignLeft);
     
     // Call w->text() before calling element()->value(), because in the case of inline
diff --git a/WebCore/kwq/KWQTextArea.h b/WebCore/kwq/KWQTextArea.h
index 8976c6c..4891c63 100644
--- a/WebCore/kwq/KWQTextArea.h
+++ b/WebCore/kwq/KWQTextArea.h
@@ -45,6 +45,9 @@ class QTextEdit;
 - (void)setEditable:(BOOL)flag;
 - (BOOL)isEditable;
 
+- (void)setEnabled:(BOOL)flag;
+- (BOOL)isEnabled;
+
 - (void)setFont:(NSFont *)font;
 
 - (void)setText:(NSString *)text;
diff --git a/WebCore/kwq/KWQTextArea.mm b/WebCore/kwq/KWQTextArea.mm
index 7b13bf4..b83ebf1 100644
--- a/WebCore/kwq/KWQTextArea.mm
+++ b/WebCore/kwq/KWQTextArea.mm
@@ -52,8 +52,11 @@
 @interface KWQTextAreaTextView : NSTextView <KWQWidgetHolder>
 {
     QTextEdit *widget;
+    BOOL disabled;
 }
 - (void)setWidget:(QTextEdit *)widget;
+- (void)setEnabled:(BOOL)flag;
+- (BOOL)isEnabled;
 @end
 
 @implementation KWQTextArea
@@ -259,6 +262,21 @@ const float LargeNumberForText = 1.0e7;
     return [textView isEditable];
 }
 
+- (void)setEnabled:(BOOL)flag
+{
+    if (flag == [textView isEnabled])
+        return;
+        
+    [textView setEnabled:flag];
+    
+    [self setNeedsDisplay:YES];
+}
+
+- (BOOL)isEnabled
+{
+    return [textView isEnabled];
+}
+
 - (void)setFrame:(NSRect)frameRect
 {    
     [super setFrame:frameRect];
@@ -416,7 +434,20 @@ static NSRange RangeOfParagraph(NSString *text, int paragraph)
 - (void)drawRect:(NSRect)rect
 {
     [super drawRect:rect];
-    if ([KWQKHTMLPart::bridgeForWidget(widget) firstResponder] == textView) {
+    if (![textView isEnabled]) {
+        // draw a disabled bezel border
+        [[NSColor controlColor] set];
+        NSFrameRect(rect);
+        
+        rect = NSInsetRect(rect, 1, 1);
+        [[NSColor controlShadowColor] set];
+        NSFrameRect(rect);
+    
+        rect = NSInsetRect(rect, 1, 1);
+        [[NSColor textBackgroundColor] set];
+        NSRectFill(rect);
+    }
+    else if ([KWQKHTMLPart::bridgeForWidget(widget) firstResponder] == textView) {
         NSSetFocusRingStyle(NSFocusRingOnly);
         NSRectFill([self bounds]);
     }
@@ -550,6 +581,9 @@ static NSString *WebContinuousSpellCheckingEnabled = @"WebContinuousSpellCheckin
 
 - (BOOL)becomeFirstResponder
 {
+    if (disabled)
+        return NO;
+
     BOOL become = [super becomeFirstResponder];
     
     if (become) {
@@ -619,6 +653,8 @@ static NSString *WebContinuousSpellCheckingEnabled = @"WebContinuousSpellCheckin
 
 - (void)mouseDown:(NSEvent *)event
 {
+    if (disabled)
+        return;
     [super mouseDown:event];
     widget->sendConsumedMouseUp();
     widget->clicked();
@@ -626,6 +662,8 @@ static NSString *WebContinuousSpellCheckingEnabled = @"WebContinuousSpellCheckin
 
 - (void)keyDown:(NSEvent *)event
 {
+    if (disabled)
+        return;
     WebCoreBridge *bridge = KWQKHTMLPart::bridgeForWidget(widget);
     if (![bridge interceptKeyEvent:event toView:self]) {
 	[super keyDown:event];
@@ -634,12 +672,33 @@ static NSString *WebContinuousSpellCheckingEnabled = @"WebContinuousSpellCheckin
 
 - (void)keyUp:(NSEvent *)event
 {
+    if (disabled)
+        return;
     WebCoreBridge *bridge = KWQKHTMLPart::bridgeForWidget(widget);
     if (![bridge interceptKeyEvent:event toView:self]) {
 	[super keyUp:event];
     }
 }
 
+- (void)setEnabled:(BOOL)flag
+{
+    disabled = !flag;
+    [self setEditable:flag];
+}
+
+- (BOOL)isEnabled
+{
+    return !disabled;
+}
+
+- (void)drawRect:(NSRect)rect
+{
+    // do a hack to make the text view look like it's disabled
+    NSColor *color = disabled ? [NSColor disabledControlTextColor] : [NSColor controlTextColor];
+    [[self textStorage] setForegroundColor:color];
+    [super drawRect:rect];
+}
+
 @end
 
 @implementation NSView (KWQTextArea)
diff --git a/WebCore/kwq/KWQTextEdit.h b/WebCore/kwq/KWQTextEdit.h
index 762fe73..28ac11b 100644
--- a/WebCore/kwq/KWQTextEdit.h
+++ b/WebCore/kwq/KWQTextEdit.h
@@ -54,6 +54,9 @@ class QTextEdit : public QScrollView
     void setReadOnly(bool);
     bool isReadOnly() const;
 
+    void setDisabled(bool);
+    bool isDisabled() const;
+
     void setText(const QString &);
     QString text() const;
     QString textWithHardLineBreaks() const;
diff --git a/WebCore/kwq/KWQTextEdit.mm b/WebCore/kwq/KWQTextEdit.mm
index 60ebbde..f52fcd6 100644
--- a/WebCore/kwq/KWQTextEdit.mm
+++ b/WebCore/kwq/KWQTextEdit.mm
@@ -143,6 +143,27 @@ void QTextEdit::setReadOnly(bool flag)
     KWQ_UNBLOCK_NS_EXCEPTIONS;
 }
 
+bool QTextEdit::isDisabled() const
+{
+    KWQTextArea *textView = (KWQTextArea *)getView();
+    volatile bool result = false;
+
+    KWQ_BLOCK_NS_EXCEPTIONS;
+    result = ![textView isEnabled];
+    KWQ_UNBLOCK_NS_EXCEPTIONS;
+
+    return result;
+}
+
+void QTextEdit::setDisabled(bool flag)
+{
+    KWQTextArea *textView = (KWQTextArea *)getView();
+
+    KWQ_BLOCK_NS_EXCEPTIONS;
+    [textView setEnabled:!flag];
+    KWQ_UNBLOCK_NS_EXCEPTIONS;
+}
+
 void QTextEdit::selectAll()
 {
     KWQTextArea *textView = (KWQTextArea *)getView();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list