void RenderDataGrid::recalcStyleForColumns()
{
    DataGridColumnList* columns = gridElement()->columns();
    unsigned length = columns->length();
    for (unsigned i = 0; i < length; ++i)
        recalcStyleForColumn(columns->item(i));
}
JSValue JSC_HOST_CALL jsDataGridColumnListPrototypeFunctionClear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDataGridColumnList::s_info))
        return throwError(exec, TypeError);
    JSDataGridColumnList* castedThisObj = static_cast<JSDataGridColumnList*>(asObject(thisValue));
    DataGridColumnList* imp = static_cast<DataGridColumnList*>(castedThisObj->impl());

    imp->clear();
    return jsUndefined();
}
JSValue JSC_HOST_CALL jsDataGridColumnListPrototypeFunctionMove(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDataGridColumnList::s_info))
        return throwError(exec, TypeError);
    JSDataGridColumnList* castedThisObj = static_cast<JSDataGridColumnList*>(asObject(thisValue));
    DataGridColumnList* imp = static_cast<DataGridColumnList*>(castedThisObj->impl());
    DataGridColumn* column = toDataGridColumn(args.at(0));
    unsigned index = args.at(1).toInt32(exec);

    imp->move(column, index);
    return jsUndefined();
}
JSValue JSC_HOST_CALL jsDataGridColumnListPrototypeFunctionAdd(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDataGridColumnList::s_info))
        return throwError(exec, TypeError);
    JSDataGridColumnList* castedThisObj = static_cast<JSDataGridColumnList*>(asObject(thisValue));
    DataGridColumnList* imp = static_cast<DataGridColumnList*>(castedThisObj->impl());
    const UString& id = args.at(0).toString(exec);
    const UString& label = args.at(1).toString(exec);
    const UString& type = args.at(2).toString(exec);
    bool primary = args.at(3).toBoolean(exec);
    unsigned short sortable = args.at(4).toInt32(exec);


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->add(id, label, type, primary, sortable)));
    return result;
}
JSValue JSC_HOST_CALL jsDataGridColumnListPrototypeFunctionItem(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDataGridColumnList::s_info))
        return throwError(exec, TypeError);
    JSDataGridColumnList* castedThisObj = static_cast<JSDataGridColumnList*>(asObject(thisValue));
    DataGridColumnList* imp = static_cast<DataGridColumnList*>(castedThisObj->impl());
    int index = args.at(0).toInt32(exec);
    if (index < 0) {
        setDOMException(exec, INDEX_SIZE_ERR);
        return jsUndefined();
    }


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->item(index)));
    return result;
}
void RenderDataGrid::paintColumnHeaders(PaintInfo& paintInfo, int tx, int ty)
{
    DataGridColumnList* columns = gridElement()->columns();
    unsigned length = columns->length();
    for (unsigned i = 0; i < length; ++i) {
        DataGridColumn* column = columns->item(i);
        RenderStyle* columnStyle = headerStyle(column);

        // Don't render invisible columns.
        if (!columnStyle || columnStyle->display() == NONE || columnStyle->visibility() != VISIBLE)
            continue;
        
        // Paint the column header if it intersects the dirty rect.
        IntRect columnRect(column->rect());
        columnRect.move(tx, ty);
        if (columnRect.intersects(paintInfo.rect))
            paintColumnHeader(column, paintInfo, tx, ty);
    }
}