Changeset 58057 in webkit


Ignore:
Timestamp:
Apr 21, 2010 10:49:53 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-04-21 Ray Rischpater <Raymond.Rischpater@Nokia.com>

In HTMLInputElement.cpp there are numerous style
violations.

This patch includes style changes to fix existing style
deviations in this file.

Rubber stamped by Darin Adler.

Fixes <https://bugs.webkit.org/show_bug.cgi?id=37881>

  • html/HTMLInputElement.cpp:
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r58053 r58057  
     12010-04-21  Ray Rischpater  <Raymond.Rischpater@Nokia.com>
     2
     3        In HTMLInputElement.cpp there are numerous style
     4        violations.
     5
     6        This patch includes style changes to fix existing style
     7        deviations in this file.
     8
     9        Rubber stamped by Darin Adler.
     10
     11        Fixes <https://bugs.webkit.org/show_bug.cgi?id=37881>
     12
     13        * html/HTMLInputElement.cpp:
     14
    1152010-04-21  Gustavo Sverzut Barbieri  <barbieri@profusion.mobi>
    216
  • trunk/WebCore/html/HTMLInputElement.cpp

    r57695 r58057  
    4747#include "HTMLNames.h"
    4848#include "HTMLOptionElement.h"
    49 #include "ScriptEventListener.h"
    5049#include "KeyboardEvent.h"
    5150#include "LocalizedStrings.h"
     
    6160#include "RenderTextControlSingleLine.h"
    6261#include "RenderTheme.h"
     62#include "ScriptEventListener.h"
    6363#include "StepRange.h"
    6464#include "StringHash.h"
     
    172172
    173173    switch (inputType()) {
    174         case DATE:
    175         case DATETIME:
    176         case DATETIMELOCAL:
    177         case EMAIL:
    178         case FILE:
    179         case MONTH:
    180         case NUMBER:
    181         case PASSWORD:
    182         case SEARCH:
    183         case TELEPHONE:
    184         case TEXT:
    185         case TIME:
    186         case URL:
    187         case WEEK:
    188             return value().isEmpty();
    189         case CHECKBOX:
    190             return !checked();
    191         case RADIO:
    192             return !checkedRadioButtons(this).checkedButtonForGroup(name());
    193         case COLOR:
    194             return false;
    195         case BUTTON:
    196         case HIDDEN:
    197         case IMAGE:
    198         case ISINDEX:
    199         case RANGE:
    200         case RESET:
    201         case SUBMIT:
    202             break;
     174    case DATE:
     175    case DATETIME:
     176    case DATETIMELOCAL:
     177    case EMAIL:
     178    case FILE:
     179    case MONTH:
     180    case NUMBER:
     181    case PASSWORD:
     182    case SEARCH:
     183    case TELEPHONE:
     184    case TEXT:
     185    case TIME:
     186    case URL:
     187    case WEEK:
     188        return value().isEmpty();
     189    case CHECKBOX:
     190        return !checked();
     191    case RADIO:
     192        return !checkedRadioButtons(this).checkedButtonForGroup(name());
     193    case COLOR:
     194        return false;
     195    case BUTTON:
     196    case HIDDEN:
     197    case IMAGE:
     198    case ISINDEX:
     199    case RANGE:
     200    case RESET:
     201    case SUBMIT:
     202        break;
    203203    }
    204204
     
    210210{
    211211    switch (inputType()) {
    212         case BUTTON:
    213         case CHECKBOX:
    214         case COLOR:
    215         case DATE:
    216         case DATETIME:
    217         case DATETIMELOCAL:
    218         case FILE:
    219         case HIDDEN:
    220         case IMAGE:
    221         case ISINDEX:
    222         case MONTH:
    223         case NUMBER:
    224         case RADIO:
    225         case RANGE:
    226         case RESET:
    227         case SUBMIT:
    228         case TIME:
    229         case WEEK:
     212    case BUTTON:
     213    case CHECKBOX:
     214    case COLOR:
     215    case DATE:
     216    case DATETIME:
     217    case DATETIMELOCAL:
     218    case FILE:
     219    case HIDDEN:
     220    case IMAGE:
     221    case ISINDEX:
     222    case MONTH:
     223    case NUMBER:
     224    case RADIO:
     225    case RANGE:
     226    case RESET:
     227    case SUBMIT:
     228    case TIME:
     229    case WEEK:
     230        return false;
     231    case EMAIL:
     232    case PASSWORD:
     233    case SEARCH:
     234    case TELEPHONE:
     235    case TEXT:
     236    case URL:
     237        const AtomicString& pattern = getAttribute(patternAttr);
     238        String value = this->value();
     239         // Empty values can't be mismatched
     240        if (pattern.isEmpty() || value.isEmpty())
    230241            return false;
    231         case EMAIL:
    232         case PASSWORD:
    233         case SEARCH:
    234         case TELEPHONE:
    235         case TEXT:
    236         case URL:
    237             const AtomicString& pattern = getAttribute(patternAttr);
    238             String value = this->value();
    239 
    240             // Empty values can't be mismatched
    241             if (pattern.isEmpty() || value.isEmpty())
    242                 return false;
    243 
    244             RegularExpression patternRegExp(pattern, TextCaseSensitive);
    245             int matchLength = 0;
    246             int valueLength = value.length();
    247             int matchOffset = patternRegExp.match(value, 0, &matchLength);
    248 
    249             return matchOffset != 0 || matchLength != valueLength;
    250     }
    251 
     242        RegularExpression patternRegExp(pattern, TextCaseSensitive);
     243        int matchLength = 0;
     244        int valueLength = value.length();
     245        int matchOffset = patternRegExp.match(value, 0, &matchLength);
     246        return matchOffset || matchLength != valueLength;
     247    }
    252248    ASSERT_NOT_REACHED();
    253249    return false;
     
    701697        if (currentFocusedNode && currentFocusedNode->hasTagName(inputTag)) {
    702698            HTMLInputElement* focusedInput = static_cast<HTMLInputElement*>(currentFocusedNode);
    703             if (focusedInput->inputType() == RADIO && focusedInput->form() == form() &&
    704                 focusedInput->name() == name())
     699            if (focusedInput->inputType() == RADIO && focusedInput->form() == form() && focusedInput->name() == name())
    705700                return false;
    706701        }
     
    907902{
    908903    switch (inputType()) {
    909         case BUTTON:
    910         case COLOR:
    911         case DATE:
    912         case DATETIME:
    913         case DATETIMELOCAL:
    914         case EMAIL:
    915         case FILE:
    916         case HIDDEN:
    917         case IMAGE:
    918         case ISINDEX:
    919         case MONTH:
    920         case NUMBER:
    921         case RANGE:
    922         case RESET:
    923         case SEARCH:
    924         case SUBMIT:
    925         case TELEPHONE:
    926         case TEXT:
    927         case TIME:
    928         case URL:
    929         case WEEK: {
    930             String currentValue = value();
    931             if (currentValue == defaultValue())
    932                 return false;
    933             result = currentValue;
    934             return true;
    935         }
    936         case CHECKBOX:
    937         case RADIO:
    938             result = checked() ? "on" : "off";
    939             return true;
    940         case PASSWORD:
     904    case BUTTON:
     905    case COLOR:
     906    case DATE:
     907    case DATETIME:
     908    case DATETIMELOCAL:
     909    case EMAIL:
     910    case FILE:
     911    case HIDDEN:
     912    case IMAGE:
     913    case ISINDEX:
     914    case MONTH:
     915    case NUMBER:
     916    case RANGE:
     917    case RESET:
     918    case SEARCH:
     919    case SUBMIT:
     920    case TELEPHONE:
     921    case TEXT:
     922    case TIME:
     923    case URL:
     924    case WEEK: {
     925        String currentValue = value();
     926        if (currentValue == defaultValue())
    941927            return false;
     928        result = currentValue;
     929        return true;
     930    }
     931    case CHECKBOX:
     932    case RADIO:
     933        result = checked() ? "on" : "off";
     934        return true;
     935    case PASSWORD:
     936        return false;
    942937    }
    943938    ASSERT_NOT_REACHED();
     
    949944    ASSERT(inputType() != PASSWORD); // should never save/restore password fields
    950945    switch (inputType()) {
    951         case BUTTON:
    952         case COLOR:
    953         case DATE:
    954         case DATETIME:
    955         case DATETIMELOCAL:
    956         case EMAIL:
    957         case FILE:
    958         case HIDDEN:
    959         case IMAGE:
    960         case ISINDEX:
    961         case MONTH:
    962         case NUMBER:
    963         case RANGE:
    964         case RESET:
    965         case SEARCH:
    966         case SUBMIT:
    967         case TELEPHONE:
    968         case TEXT:
    969         case TIME:
    970         case URL:
    971         case WEEK:
    972             setValue(state);
    973             break;
    974         case CHECKBOX:
    975         case RADIO:
    976             setChecked(state == "on");
    977             break;
    978         case PASSWORD:
    979             break;
     946    case BUTTON:
     947    case COLOR:
     948    case DATE:
     949    case DATETIME:
     950    case DATETIMELOCAL:
     951    case EMAIL:
     952    case FILE:
     953    case HIDDEN:
     954    case IMAGE:
     955    case ISINDEX:
     956    case MONTH:
     957    case NUMBER:
     958    case RANGE:
     959    case RESET:
     960    case SEARCH:
     961    case SUBMIT:
     962    case TELEPHONE:
     963    case TEXT:
     964    case TIME:
     965    case URL:
     966    case WEEK:
     967        setValue(state);
     968        break;
     969    case CHECKBOX:
     970    case RADIO:
     971        setChecked(state == "on");
     972        break;
     973    case PASSWORD:
     974        break;
    980975    }
    981976}
     
    996991{
    997992    switch (inputType()) {
    998         case BUTTON:
    999         case CHECKBOX:
    1000         case FILE:
    1001         case IMAGE:
    1002         case RADIO:
    1003         case RANGE:
    1004         case RESET:
    1005         case SUBMIT:
    1006             focus(false);
    1007             // send the mouse button events iff the caller specified sendToAnyElement
    1008             dispatchSimulatedClick(0, sendToAnyElement);
    1009             break;
    1010         case HIDDEN:
    1011             // a no-op for this type
    1012             break;
    1013         case COLOR:
    1014         case DATE:
    1015         case DATETIME:
    1016         case DATETIMELOCAL:
    1017         case EMAIL:
    1018         case ISINDEX:
    1019         case MONTH:
    1020         case NUMBER:
    1021         case PASSWORD:
    1022         case SEARCH:
    1023         case TELEPHONE:
    1024         case TEXT:
    1025         case TIME:
    1026         case URL:
    1027         case WEEK:
    1028             // should never restore previous selection here
    1029             focus(false);
    1030             break;
     993    case BUTTON:
     994    case CHECKBOX:
     995    case FILE:
     996    case IMAGE:
     997    case RADIO:
     998    case RANGE:
     999    case RESET:
     1000    case SUBMIT:
     1001        focus(false);
     1002        // send the mouse button events iff the caller specified sendToAnyElement
     1003        dispatchSimulatedClick(0, sendToAnyElement);
     1004        break;
     1005    case HIDDEN:
     1006        // a no-op for this type
     1007        break;
     1008    case COLOR:
     1009    case DATE:
     1010    case DATETIME:
     1011    case DATETIMELOCAL:
     1012    case EMAIL:
     1013    case ISINDEX:
     1014    case MONTH:
     1015    case NUMBER:
     1016    case PASSWORD:
     1017    case SEARCH:
     1018    case TELEPHONE:
     1019    case TEXT:
     1020    case TIME:
     1021    case URL:
     1022    case WEEK:
     1023        // should never restore previous selection here
     1024        focus(false);
     1025         break;
    10311026    }
    10321027}
     
    10341029bool HTMLInputElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
    10351030{
    1036     if (((attrName == heightAttr || attrName == widthAttr) && respectHeightAndWidthAttrs()) ||
    1037         attrName == vspaceAttr ||
    1038         attrName == hspaceAttr) {
     1031    if (((attrName == heightAttr || attrName == widthAttr) && respectHeightAndWidthAttrs())
     1032        || attrName == vspaceAttr
     1033        || attrName == hspaceAttr) {
    10391034        result = eUniversal;
    10401035        return false;
     
    11031098            m_imageLoader->updateFromElementIgnoringPreviousError();
    11041099        }
    1105     } else if (attr->name() == usemapAttr ||
    1106                attr->name() == accesskeyAttr) {
     1100    } else if (attr->name() == usemapAttr || attr->name() == accesskeyAttr) {
    11071101        // FIXME: ignore for the moment
    11081102    } else if (attr->name() == vspaceAttr) {
     
    11211115        if (respectHeightAndWidthAttrs())
    11221116            addCSSLength(attr, CSSPropertyHeight, attr->value());
    1123     }
    1124     // Search field and slider attributes all just cause updateFromElement to be called through style
    1125     // recalcing.
    1126     else if (attr->name() == onsearchAttr) {
     1117    } else if (attr->name() == onsearchAttr) {
     1118        // Search field and slider attributes all just cause updateFromElement to be called through style recalcing.
    11271119        setAttributeEventListener(eventNames().searchEvent, createAttributeEventListener(this, attr));
    11281120    } else if (attr->name() == resultsAttr) {
     
    11681160}
    11691161
    1170 RenderObject *HTMLInputElement::createRenderer(RenderArena *arena, RenderStyle *style)
     1162RenderObject* HTMLInputElement::createRenderer(RenderArena *arena, RenderStyle *style)
    11711163{
    11721164    switch (inputType()) {
    1173         case BUTTON:
    1174         case RESET:
    1175         case SUBMIT:
    1176             return new (arena) RenderButton(this);
    1177         case CHECKBOX:
    1178         case RADIO:
    1179             return RenderObject::createObject(this, style);
    1180         case FILE:
    1181             return new (arena) RenderFileUploadControl(this);
    1182         case HIDDEN:
    1183             break;
    1184         case IMAGE:
    1185             return new (arena) RenderImage(this);
    1186         case RANGE:
    1187             return new (arena) RenderSlider(this);
    1188         case COLOR:
    1189         case DATE:
    1190         case DATETIME:
    1191         case DATETIMELOCAL:
    1192         case EMAIL:
    1193         case ISINDEX:
    1194         case MONTH:
    1195         case NUMBER:
    1196         case PASSWORD:
    1197         case SEARCH:
    1198         case TELEPHONE:
    1199         case TEXT:
    1200         case TIME:
    1201         case URL:
    1202         case WEEK:
    1203             return new (arena) RenderTextControlSingleLine(this, placeholderShouldBeVisible());
     1165    case BUTTON:
     1166    case RESET:
     1167    case SUBMIT:
     1168        return new (arena) RenderButton(this);
     1169    case CHECKBOX:
     1170    case RADIO:
     1171        return RenderObject::createObject(this, style);
     1172    case FILE:
     1173        return new (arena) RenderFileUploadControl(this);
     1174    case HIDDEN:
     1175        break;
     1176    case IMAGE:
     1177        return new (arena) RenderImage(this);
     1178    case RANGE:
     1179        return new (arena) RenderSlider(this);
     1180    case COLOR:
     1181    case DATE:
     1182    case DATETIME:
     1183    case DATETIMELOCAL:
     1184    case EMAIL:
     1185    case ISINDEX:
     1186    case MONTH:
     1187    case NUMBER:
     1188    case PASSWORD:
     1189    case SEARCH:
     1190    case TELEPHONE:
     1191    case TEXT:
     1192    case TIME:
     1193    case URL:
     1194    case WEEK:
     1195        return new (arena) RenderTextControlSingleLine(this, placeholderShouldBeVisible());
    12041196    }
    12051197    ASSERT(false);
     
    12821274
    12831275    switch (inputType()) {
    1284         case COLOR:
    1285         case DATE:
    1286         case DATETIME:
    1287         case DATETIMELOCAL:
    1288         case EMAIL:
    1289         case HIDDEN:
    1290         case ISINDEX:
    1291         case MONTH:
    1292         case NUMBER:
    1293         case PASSWORD:
    1294         case RANGE:
    1295         case SEARCH:
    1296         case TELEPHONE:
    1297         case TEXT:
    1298         case TIME:
    1299         case URL:
    1300         case WEEK:
    1301             // always successful
     1276    case COLOR:
     1277    case DATE:
     1278    case DATETIME:
     1279    case DATETIMELOCAL:
     1280    case EMAIL:
     1281    case HIDDEN:
     1282    case ISINDEX:
     1283    case MONTH:
     1284    case NUMBER:
     1285    case PASSWORD:
     1286    case RANGE:
     1287    case SEARCH:
     1288    case TELEPHONE:
     1289    case TEXT:
     1290    case TIME:
     1291    case URL:
     1292    case WEEK:
     1293        // always successful
     1294        encoding.appendData(name(), value());
     1295        return true;
     1296
     1297    case CHECKBOX:
     1298    case RADIO:
     1299        if (checked()) {
    13021300            encoding.appendData(name(), value());
    13031301            return true;
    1304 
    1305         case CHECKBOX:
    1306         case RADIO:
    1307             if (checked()) {
     1302        }
     1303        break;
     1304
     1305    case BUTTON:
     1306    case RESET:
     1307        // these types of buttons are never successful
     1308        return false;
     1309
     1310    case IMAGE:
     1311        if (m_activeSubmit) {
     1312            encoding.appendData(name().isEmpty() ? "x" : (name() + ".x"), m_xPos);
     1313            encoding.appendData(name().isEmpty() ? "y" : (name() + ".y"), m_yPos);
     1314            if (!name().isEmpty() && !value().isEmpty())
    13081315                encoding.appendData(name(), value());
    1309                 return true;
    1310             }
    1311             break;
    1312 
    1313         case BUTTON:
    1314         case RESET:
    1315             // these types of buttons are never successful
    1316             return false;
    1317 
    1318         case IMAGE:
    1319             if (m_activeSubmit) {
    1320                 encoding.appendData(name().isEmpty() ? "x" : (name() + ".x"), m_xPos);
    1321                 encoding.appendData(name().isEmpty() ? "y" : (name() + ".y"), m_yPos);
    1322                 if (!name().isEmpty() && !value().isEmpty())
    1323                     encoding.appendData(name(), value());
    1324                 return true;
    1325             }
    1326             break;
    1327 
    1328         case SUBMIT:
    1329             if (m_activeSubmit) {
    1330                 String enc_str = valueWithDefault();
    1331                 encoding.appendData(name(), enc_str);
    1332                 return true;
    1333             }
    1334             break;
    1335 
    1336         case FILE: {
    1337             unsigned numFiles = m_fileList->length();
    1338             if (!multipart) {
    1339                 // Send only the basenames.
    1340                 // 4.10.16.4 and 4.10.16.6 sections in HTML5.
    1341 
    1342                 // Unlike the multipart case, we have no special
    1343                 // handling for the empty fileList because Netscape
    1344                 // doesn't support for non-multipart submission of
    1345                 // file inputs, and Firefox doesn't add "name=" query
    1346                 // parameter.
    1347 
    1348                 for (unsigned i = 0; i < numFiles; ++i) {
    1349                     encoding.appendData(name(), m_fileList->item(i)->fileName());
    1350                 }
    1351                 return true;
    1352             }
    1353 
    1354             // If no filename at all is entered, return successful but empty.
    1355             // Null would be more logical, but Netscape posts an empty file. Argh.
    1356             if (!numFiles) {
    1357                 encoding.appendBlob(name(), File::create(""));
    1358                 return true;
    1359             }
    1360 
    1361             for (unsigned i = 0; i < numFiles; ++i)
    1362                 encoding.appendBlob(name(), m_fileList->item(i));
    13631316            return true;
     1317        }
     1318        break;
     1319
     1320    case SUBMIT:
     1321        if (m_activeSubmit) {
     1322            String encstr = valueWithDefault();
     1323            encoding.appendData(name(), encstr);
     1324            return true;
     1325        }
     1326        break;
     1327
     1328    case FILE: {
     1329        unsigned numFiles = m_fileList->length();
     1330        if (!multipart) {
     1331            // Send only the basenames.
     1332            // 4.10.16.4 and 4.10.16.6 sections in HTML5.
     1333   
     1334            // Unlike the multipart case, we have no special
     1335            // handling for the empty fileList because Netscape
     1336            // doesn't support for non-multipart submission of
     1337            // file inputs, and Firefox doesn't add "name=" query
     1338            // parameter.
     1339
     1340            for (unsigned i = 0; i < numFiles; ++i)
     1341                encoding.appendData(name(), m_fileList->item(i)->fileName());
     1342            return true;
     1343        }
     1344
     1345        // If no filename at all is entered, return successful but empty.
     1346        // Null would be more logical, but Netscape posts an empty file. Argh.
     1347        if (!numFiles) {
     1348            encoding.appendBlob(name(), File::create(""));
     1349            return true;
     1350        }
     1351
     1352        for (unsigned i = 0; i < numFiles; ++i)
     1353            encoding.appendBlob(name(), m_fileList->item(i));
     1354        return true;
    13641355        }
    13651356    }
     
    14411432}
    14421433
    1443 void HTMLInputElement::setIndeterminate(bool _indeterminate)
     1434void HTMLInputElement::setIndeterminate(bool newValue)
    14441435{
    14451436    // Only checkboxes and radio buttons honor indeterminate.
    1446     if (!allowsIndeterminate() || indeterminate() == _indeterminate)
     1437    if (!allowsIndeterminate() || indeterminate() == newValue)
    14471438        return;
    14481439
    1449     m_indeterminate = _indeterminate;
     1440    m_indeterminate = newValue;
    14501441
    14511442    setNeedsStyleRecalc();
     
    14931484            if (inputType() == CHECKBOX || inputType() == RADIO)
    14941485                return checked() ? "on" : "";
    1495             else if (inputType() == RANGE)
     1486            if (inputType() == RANGE)
    14961487                return serializeForNumberType(StepRange(this).defaultValue());
    14971488        }
     
    15061497    if (v.isNull()) {
    15071498        switch (inputType()) {
    1508             case BUTTON:
    1509             case CHECKBOX:
    1510             case COLOR:
    1511             case DATE:
    1512             case DATETIME:
    1513             case DATETIMELOCAL:
    1514             case EMAIL:
    1515             case FILE:
    1516             case HIDDEN:
    1517             case IMAGE:
    1518             case ISINDEX:
    1519             case MONTH:
    1520             case NUMBER:
    1521             case PASSWORD:
    1522             case RADIO:
    1523             case RANGE:
    1524             case SEARCH:
    1525             case TELEPHONE:
    1526             case TEXT:
    1527             case TIME:
    1528             case URL:
    1529             case WEEK:
    1530                 break;
    1531             case RESET:
    1532                 v = resetButtonDefaultLabel();
    1533                 break;
    1534             case SUBMIT:
    1535                 v = submitButtonDefaultLabel();
    1536                 break;
     1499        case BUTTON:
     1500        case CHECKBOX:
     1501        case COLOR:
     1502        case DATE:
     1503        case DATETIME:
     1504        case DATETIMELOCAL:
     1505        case EMAIL:
     1506        case FILE:
     1507        case HIDDEN:
     1508        case IMAGE:
     1509        case ISINDEX:
     1510        case MONTH:
     1511        case NUMBER:
     1512        case PASSWORD:
     1513        case RADIO:
     1514        case RANGE:
     1515        case SEARCH:
     1516        case TELEPHONE:
     1517        case TEXT:
     1518        case TIME:
     1519        case URL:
     1520        case WEEK:
     1521            break;
     1522        case RESET:
     1523            v = resetButtonDefaultLabel();
     1524            break;
     1525        case SUBMIT:
     1526            v = submitButtonDefaultLabel();
     1527            break;
    15371528        }
    15381529    }
     
    19531944{
    19541945    switch (inputType()) {
    1955         case BUTTON:
    1956         case CHECKBOX:
    1957         case HIDDEN:
    1958         case IMAGE:
    1959         case RADIO:
    1960         case RESET:
    1961         case SUBMIT:
    1962             return false;
    1963         case COLOR:
    1964         case DATE:
    1965         case DATETIME:
    1966         case DATETIMELOCAL:
    1967         case EMAIL:
    1968         case FILE:
    1969         case ISINDEX:
    1970         case MONTH:
    1971         case NUMBER:
    1972         case PASSWORD:
    1973         case RANGE:
    1974         case SEARCH:
    1975         case TELEPHONE:
    1976         case TEXT:
    1977         case TIME:
    1978         case URL:
    1979         case WEEK:
    1980             return true;
     1946    case BUTTON:
     1947    case CHECKBOX:
     1948    case HIDDEN:
     1949    case IMAGE:
     1950    case RADIO:
     1951    case RESET:
     1952    case SUBMIT:
     1953        return false;
     1954    case COLOR:
     1955    case DATE:
     1956    case DATETIME:
     1957    case DATETIMELOCAL:
     1958    case EMAIL:
     1959    case FILE:
     1960    case ISINDEX:
     1961    case MONTH:
     1962    case NUMBER:
     1963    case PASSWORD:
     1964    case RANGE:
     1965    case SEARCH:
     1966    case TELEPHONE:
     1967    case TEXT:
     1968    case TIME:
     1969    case URL:
     1970    case WEEK:
     1971        return true;
    19811972    }
    19821973    return false;
     
    21532144        if (charCode == '\r') {
    21542145            switch (inputType()) {
    2155                 case CHECKBOX:
    2156                 case COLOR:
    2157                 case DATE:
    2158                 case DATETIME:
    2159                 case DATETIMELOCAL:
    2160                 case EMAIL:
    2161                 case HIDDEN:
    2162                 case ISINDEX:
    2163                 case MONTH:
    2164                 case NUMBER:
    2165                 case PASSWORD:
    2166                 case RANGE:
    2167                 case SEARCH:
    2168                 case TELEPHONE:
    2169                 case TEXT:
    2170                 case TIME:
    2171                 case URL:
    2172                 case WEEK:
    2173                     // Simulate mouse click on the default form button for enter for these types of elements.
    2174                     clickDefaultFormButton = true;
    2175                     break;
    2176                 case BUTTON:
    2177                 case FILE:
    2178                 case IMAGE:
    2179                 case RESET:
    2180                 case SUBMIT:
    2181                     // Simulate mouse click for enter for these types of elements.
    2182                     clickElement = true;
    2183                     break;
    2184                 case RADIO:
    2185                     break; // Don't do anything for enter on a radio button.
     2146            case CHECKBOX:
     2147            case COLOR:
     2148            case DATE:
     2149            case DATETIME:
     2150            case DATETIMELOCAL:
     2151            case EMAIL:
     2152            case HIDDEN:
     2153            case ISINDEX:
     2154            case MONTH:
     2155            case NUMBER:
     2156            case PASSWORD:
     2157            case RANGE:
     2158            case SEARCH:
     2159            case TELEPHONE:
     2160            case TEXT:
     2161            case TIME:
     2162            case URL:
     2163            case WEEK:
     2164                // Simulate mouse click on the default form button for enter for these types of elements.
     2165                clickDefaultFormButton = true;
     2166                break;
     2167            case BUTTON:
     2168            case FILE:
     2169            case IMAGE:
     2170            case RESET:
     2171            case SUBMIT:
     2172                // Simulate mouse click for enter for these types of elements.
     2173                clickElement = true;
     2174                break;
     2175            case RADIO:
     2176                break; // Don't do anything for enter on a radio button.
    21862177            }
    21872178        } else if (charCode == ' ') {
    21882179            switch (inputType()) {
    2189                 case BUTTON:
    2190                 case CHECKBOX:
    2191                 case FILE:
    2192                 case IMAGE:
    2193                 case RESET:
    2194                 case SUBMIT:
    2195                 case RADIO:
    2196                     // Prevent scrolling down the page.
    2197                     evt->setDefaultHandled();
    2198                     return;
    2199                 default:
    2200                     break;
     2180            case BUTTON:
     2181            case CHECKBOX:
     2182            case FILE:
     2183            case IMAGE:
     2184            case RESET:
     2185            case SUBMIT:
     2186            case RADIO:
     2187                // Prevent scrolling down the page.
     2188                evt->setDefaultHandled();
     2189                return;
     2190            default:
     2191                break;
    22012192            }
    22022193        }
     
    22142205        if (key == "U+0020") {
    22152206            switch (inputType()) {
    2216                 case BUTTON:
    2217                 case CHECKBOX:
    2218                 case FILE:
    2219                 case IMAGE:
    2220                 case RESET:
    2221                 case SUBMIT:
    2222                 case RADIO:
    2223                     setActive(true, true);
    2224                     // No setDefaultHandled(), because IE dispatches a keypress in this case
    2225                     // and the caller will only dispatch a keypress if we don't call setDefaultHandled.
    2226                     return;
    2227                 default:
    2228                     break;
     2207            case BUTTON:
     2208            case CHECKBOX:
     2209            case FILE:
     2210            case IMAGE:
     2211            case RESET:
     2212            case SUBMIT:
     2213            case RADIO:
     2214                setActive(true, true);
     2215                // No setDefaultHandled(), because IE dispatches a keypress in this case
     2216                // and the caller will only dispatch a keypress if we don't call setDefaultHandled.
     2217                return;
     2218            default:
     2219                break;
    22292220            }
    22302221        }
     
    22722263        if (key == "U+0020") {
    22732264            switch (inputType()) {
    2274                 case BUTTON:
    2275                 case CHECKBOX:
    2276                 case FILE:
    2277                 case IMAGE:
    2278                 case RESET:
    2279                 case SUBMIT:
    2280                     // Simulate mouse click for spacebar for these types of elements.
    2281                     // The AppKit already does this for some, but not all, of them.
     2265            case BUTTON:
     2266            case CHECKBOX:
     2267            case FILE:
     2268            case IMAGE:
     2269            case RESET:
     2270            case SUBMIT:
     2271                // Simulate mouse click for spacebar for these types of elements.
     2272                // The AppKit already does this for some, but not all, of them.
     2273                clickElement = true;
     2274                break;
     2275            case RADIO:
     2276                // If an unselected radio is tabbed into (because the entire group has nothing
     2277                // checked, or because of some explicit .focus() call), then allow space to check it.
     2278                if (!checked())
    22822279                    clickElement = true;
    2283                     break;
    2284                 case RADIO:
    2285                     // If an unselected radio is tabbed into (because the entire group has nothing
    2286                     // checked, or because of some explicit .focus() call), then allow space to check it.
    2287                     if (!checked())
    2288                         clickElement = true;
    2289                     break;
    2290                 case COLOR:
    2291                 case DATE:
    2292                 case DATETIME:
    2293                 case DATETIMELOCAL:
    2294                 case EMAIL:
    2295                 case HIDDEN:
    2296                 case ISINDEX:
    2297                 case MONTH:
    2298                 case NUMBER:
    2299                 case PASSWORD:
    2300                 case RANGE:
    2301                 case SEARCH:
    2302                 case TELEPHONE:
    2303                 case TEXT:
    2304                 case TIME:
    2305                 case URL:
    2306                 case WEEK:
    2307                     break;
     2280                break;
     2281            case COLOR:
     2282            case DATE:
     2283            case DATETIME:
     2284            case DATETIMELOCAL:
     2285            case EMAIL:
     2286            case HIDDEN:
     2287            case ISINDEX:
     2288            case MONTH:
     2289            case NUMBER:
     2290            case PASSWORD:
     2291            case RANGE:
     2292            case SEARCH:
     2293            case TELEPHONE:
     2294            case TEXT:
     2295            case TIME:
     2296            case URL:
     2297            case WEEK:
     2298                break;
    23082299            }
    23092300        }
     
    24642455}
    24652456   
    2466 void HTMLInputElement::setSize(unsigned _size)
    2467 {
    2468     setAttribute(sizeAttr, String::number(_size));
     2457void HTMLInputElement::setSize(unsigned size)
     2458{
     2459    setAttribute(sizeAttr, String::number(size));
    24692460}
    24702461
     
    25422533
    25432534    switch (inputType()) {
    2544         case CHECKBOX:
    2545         case DATE:
    2546         case DATETIME:
    2547         case DATETIMELOCAL:
    2548         case EMAIL:
    2549         case FILE:
    2550         case MONTH:
    2551         case NUMBER:
    2552         case PASSWORD:
    2553         case RADIO:
    2554         case SEARCH:
    2555         case TELEPHONE:
    2556         case TEXT:
    2557         case TIME:
    2558         case URL:
    2559         case WEEK:
    2560             return true;
    2561         case BUTTON:
    2562         case COLOR:
    2563         case HIDDEN:
    2564         case IMAGE:
    2565         case ISINDEX:
    2566         case RANGE:
    2567         case RESET:
    2568         case SUBMIT:
    2569             return false;
     2535    case CHECKBOX:
     2536    case DATE:
     2537    case DATETIME:
     2538    case DATETIMELOCAL:
     2539    case EMAIL:
     2540    case FILE:
     2541    case MONTH:
     2542    case NUMBER:
     2543    case PASSWORD:
     2544    case RADIO:
     2545    case SEARCH:
     2546    case TELEPHONE:
     2547    case TEXT:
     2548    case TIME:
     2549    case URL:
     2550    case WEEK:
     2551        return true;
     2552    case BUTTON:
     2553    case COLOR:
     2554    case HIDDEN:
     2555    case IMAGE:
     2556    case ISINDEX:
     2557    case RANGE:
     2558    case RESET:
     2559    case SUBMIT:
     2560        return false;
    25702561    }
    25712562
     
    27662757    return 0;
    27672758}
    2768 #endif  // ENABLE(DATALIST)
     2759#endif // ENABLE(DATALIST)
    27692760
    27702761} // namespace
Note: See TracChangeset for help on using the changeset viewer.