Closed Bug 34573 Opened 24 years ago Closed 24 years ago

Setting TEXTAREA.rows/cols and input.size doesn't resize the control

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

VERIFIED DUPLICATE of bug 50280

People

(Reporter: martin.honnen, Assigned: rods)

Details

(Keywords: regression)

Attachments

(1 file)

I am trying to increase the size of a textarea by setting
  textareaElement.rows
The property is increased but the display doesn't change:

<TEXTAREA NAME="aTextArea" ROWS="1" COLS="20"
          ONKEYUP="if (this.rows)
                     if (event.keyCode == 13)
                       this.rows = parseInt(this.rows) + 1;
alert(this.rows)"
></TEXTAREA>
Rods, I think this is due to a bug in the nsGfxTextControlFrame, it checks if
an attribute named "size" has changed, but AFAIK there's no "size" attribute on
<textarea> elements, in stead there's a "rows" attribute. This patch fixes this
bug.

Rods, does this look good to you, is it safe to remove the check for the size
attribute (is that used in XUL?) or should I add a check for rows in stead of
replacing the "size" check?

Index: nsGfxTextControlFrame.cpp
===================================================================
RCS file: /cvsroot/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp,v
retrieving revision 3.161
diff -u -r3.161 nsGfxTextControlFrame.cpp
--- nsGfxTextControlFrame.cpp   2000/04/01 23:39:53     3.161
+++ nsGfxTextControlFrame.cpp   2000/04/05 16:07:45
@@ -915,7 +915,7 @@
     }    
     mEditor->SetFlags(flags);
   }
-  else if (nsHTMLAtoms::size == aAttribute && aHint != NS_STYLE_HINT_REFLOW) {
+  else if (nsHTMLAtoms::rows == aAttribute && aHint != NS_STYLE_HINT_REFLOW) {
     nsFormFrame::StyleChangeReflow(aPresContext, this);
   }
   // Allow the base class to handle common attributes supported
Status: NEW → ASSIGNED
This frame takes care of both the input text and the textarea. So you will need 
to leave in the check for "size" and add in the new line checking for "rows".
Ok, thanks rods, patch updated, unless someone objects I'll check in the below
for M16.

Index: nsGfxTextControlFrame.cpp
===================================================================
RCS file: /cvsroot/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp,v
retrieving revision 3.161
diff -u -r3.161 nsGfxTextControlFrame.cpp
--- nsGfxTextControlFrame.cpp   2000/04/01 23:39:53     3.161
+++ nsGfxTextControlFrame.cpp   2000/04/05 17:50:18
@@ -915,7 +915,8 @@
     }
     mEditor->SetFlags(flags);
   }
-  else if (nsHTMLAtoms::size == aAttribute && aHint != NS_STYLE_HINT_REFLOW) {
+  else if ((nsHTMLAtoms::size == aAttribute ||
+            nsHTMLAtoms::rows == aAttribute) && aHint != NS_STYLE_HINT_REFLOW) {
     nsFormFrame::StyleChangeReflow(aPresContext, this);
   }
   // Allow the base class to handle common attributes supported
Whiteboard: [HAVEFIX]
Target Milestone: --- → M16
I just checked in the above patch. Marking FIXED.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
this bug was fixed in M16, but it's back in M17. 
Note also that the same bug applies to TEXTAREA.cols, and this was not even 
fixed in M16.
Reopening.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Rods, could you have a look at this, `this is probably related to bug 50280.
Assignee: jst → rods
Status: REOPENED → NEW
Keywords: regression
OS: other → All
Hardware: Other → All
This is really exactly the same problem as 50280.

*** This bug has been marked as a duplicate of 50280 ***
Status: NEW → RESOLVED
Closed: 24 years ago24 years ago
Resolution: --- → DUPLICATE
Summary: Setting TEXTAREA.rows doesn't resize the TEXTAREA → Setting TEXTAREA.rows/cols and input.size doesn't resize the control
Whiteboard: [HAVEFIX]
Mass update of qa contact
QA Contact: gerardok → janc
Verified dupe of bug 50280: "setting size of input field via Javascript doesn't
work" (The issue related to this bug is marked future)
Status: RESOLVED → VERIFIED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: