![]() |
|
|
New Layout: FormsAuthor: Chris KarnazeUpdated: 1 May 1998
Forms consists of the html parts that make up a form and a manager that coordinates activities among those parts. The html parts (aka form controls) have graphical representations such as buttons, checkboxes, pull down lists, radio butons etc. The manager is primarily responsible for submitting the data that the user enters into the controls to a server for processing. The manager and controls implement the functionality of the html tags <form>, <input>, <label>, <button>, <select>, <option>, <optgroup>, <textarea>, <isindex>, <label>, <fieldset>, <legend>.
Form controls and the form manager interact with other modules in a number of ways. The html content sink creates form controls and forms managers as html tags are interpreted; the form control factory functions are declared in the include file nsHTMLForms. The layout system treats form controls as normal content, and it is the responsiblity of form controls to give their size, render, and respond to mouse/keyboard events. Rendering and handling evetns involves the view system together with the widget library.
The form manager has a single class implementation, nsForm. It has three primary tasks (1) respond to a submit button press and submit the control data to a server, (2) respond to a reset button press and reset all of the controls to their initial values, and (3) manage radio button groups so that only one button in the group is active at any given time. Each form control has both a content and frame representation (as most html parts do). In addition, most form control frames have their own view which is a widget from the cross-platform widget library. The exceptions include hidden elements and controls which use images instead of widgets. The base class, nsInput, provides common functionality for content, while nsInputFrame servers a similar purpose for frames. Content nsInput adds new major behavior (beyond its base class, nsHTMLContainer) by defining the following virtual methods: GetNumValues, GetNamesValues, IsHidden, Reset. GetNamesValues returns the name value pairs that the form manager will submit. Reset sets the associated widget to its initial state. nsInput has derivatives nsInputButton, nsInputCheckbox, nsInputFile, nsInputRadio, nsInputText, nsSelect, nsOption, nsLabel, nsFieldset, nsLegend. In many cases there is not a one to one correspondence between an html tag (or tag with type attribute) and an nsInput derivative. For example, <button>, <input type=hidden> and <input type=image> are handled by nsInputButton and <input type=text>, <input type=password>, <textarea> are handled by nsInputText. Frame/View/Widget nsInputFrame adds new behavior (beyond its base class, nsLeafFrame) by defining the following virtual methods: MouseClicked, GetWidgetInitData, PostCreateWidget and the following non-virtual methods CalculateSize, GetTextSize, GetStyleSize. MouseClicked allows derivatives to do additional processing if necessary; for example, a submit button will notify the form manager to submit data. GetWidgetInitData gathers data which the view system will use to initialize a widget. PostCreateWidget allows for processing after the widget is created; for example, initial values can be used to set the widget to the appropriate state. CalculateSize is a static method that determines the size of a control based on CSS settings, local size attribues, attribute values that may affect size, and default values. It is general enough to be used for nearly all of the controls. GetTextSize calculates the size of a string based on CSS. nsInputFrame has derivatives analogous
to nsInput, including: nsInputButtonFrame, nsInputCheckboxFrame, nsInputFileFrame,
nsInputRadioFrame, nsInputTextFrame, nsSelectFrame, nsOptionFrame, nsLabelFrame,
nsFieldsetFrame, nsLegendFrame. Unlike nsInput, however, not all controls
use an nsInputFrame derivative. For example, a <input type=hidden> control
uses nsFrame as a base class and takes the default dimensions (0,0).
Forms are dependent on many other modules including xpcom, netlib, layout, style, gfx, view, widget, dom/javascript.
In May, most of html 3.2 features will be completed except for internationalization and javascript support. There will be a break in the schedule during June and July to allow dependencies to catch up. In August/September, the remaining areas will be completed. Other integration changes due to dependencies will likely continue beyond this time.
There are no know bugs in Forms, but there are bugs in dependent modules which affect Forms.
|
|||||||||||||
| Copyright © 1998 Netscape Communications Corporation. | ||||||||||||||