本文整理汇总了C++中HTMLTableRowElement类的典型用法代码示例。如果您正苦于以下问题:C++ HTMLTableRowElement类的具体用法?C++ HTMLTableRowElement怎么用?C++ HTMLTableRowElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HTMLTableRowElement类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: provided
void HTMLTableElement::deleteRow(int index, ExceptionState& exceptionState) {
if (index < -1) {
exceptionState.throwDOMException(
IndexSizeError,
"The index provided (" + String::number(index) + ") is less than -1.");
return;
}
HTMLTableRowElement* row = 0;
int i = 0;
if (index == -1) {
row = HTMLTableRowsCollection::lastRow(*this);
} else {
for (i = 0; i <= index; ++i) {
row = HTMLTableRowsCollection::rowAfter(*this, row);
if (!row)
break;
}
}
if (!row) {
exceptionState.throwDOMException(
IndexSizeError,
"The index provided (" + String::number(index) +
") is greater than the number of rows in the table (" +
String::number(i) + ").");
return;
}
row->remove(exceptionState);
}
示例2: switch
void JSHTMLTableRowElement::putValueProperty(ExecState* exec, int token, JSValue* value)
{
switch (token) {
case AlignAttrNum: {
HTMLTableRowElement* imp = static_cast<HTMLTableRowElement*>(impl());
imp->setAlign(valueToStringWithNullCheck(exec, value));
break;
}
case BgColorAttrNum: {
HTMLTableRowElement* imp = static_cast<HTMLTableRowElement*>(impl());
imp->setBgColor(valueToStringWithNullCheck(exec, value));
break;
}
case ChAttrNum: {
HTMLTableRowElement* imp = static_cast<HTMLTableRowElement*>(impl());
imp->setCh(valueToStringWithNullCheck(exec, value));
break;
}
case ChOffAttrNum: {
HTMLTableRowElement* imp = static_cast<HTMLTableRowElement*>(impl());
imp->setChOff(valueToStringWithNullCheck(exec, value));
break;
}
case VAlignAttrNum: {
HTMLTableRowElement* imp = static_cast<HTMLTableRowElement*>(impl());
imp->setVAlign(valueToStringWithNullCheck(exec, value));
break;
}
}
}
示例3: GetRow
void
HTMLTableCellElement::GetAlign(DOMString& aValue)
{
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::align, aValue)) {
// There's no align attribute, ask the row for the alignment.
HTMLTableRowElement* row = GetRow();
if (row) {
row->GetAlign(aValue);
}
}
}
示例4: jsHTMLTableRowElementPrototypeFunctionDeleteCell
JSValue* jsHTMLTableRowElementPrototypeFunctionDeleteCell(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
if (!thisValue->isObject(&JSHTMLTableRowElement::s_info))
return throwError(exec, TypeError);
JSHTMLTableRowElement* castedThisObj = static_cast<JSHTMLTableRowElement*>(thisValue);
HTMLTableRowElement* imp = static_cast<HTMLTableRowElement*>(castedThisObj->impl());
ExceptionCode ec = 0;
int index = args.at(exec, 0)->toInt32(exec);
imp->deleteCell(index, ec);
setDOMException(exec, ec);
return jsUndefined();
}
示例5: jsHTMLTableRowElementPrototypeFunctionInsertCell
JSValue* jsHTMLTableRowElementPrototypeFunctionInsertCell(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
if (!thisValue->isObject(&JSHTMLTableRowElement::s_info))
return throwError(exec, TypeError);
JSHTMLTableRowElement* castedThisObj = static_cast<JSHTMLTableRowElement*>(thisValue);
HTMLTableRowElement* imp = static_cast<HTMLTableRowElement*>(castedThisObj->impl());
ExceptionCode ec = 0;
int index = args.at(exec, 0)->toInt32(exec);
JSC::JSValue* result = toJS(exec, WTF::getPtr(imp->insertCell(index, ec)));
setDOMException(exec, ec);
return result;
}
示例6: deleteCellCallback
static v8::Handle<v8::Value> deleteCellCallback(const v8::Arguments& args)
{
HTMLTableRowElement* imp = V8HTMLTableRowElement::toNative(args.Holder());
ExceptionCode ec = 0;
{
V8TRYCATCH(int, index, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
imp->deleteCell(index, ec);
if (UNLIKELY(ec))
goto fail;
return v8Undefined();
}
fail:
return setDOMException(ec, args.GetIsolate());
}
示例7: insertCellCallback
static v8::Handle<v8::Value> insertCellCallback(const v8::Arguments& args)
{
HTMLTableRowElement* imp = V8HTMLTableRowElement::toNative(args.Holder());
ExceptionCode ec = 0;
{
V8TRYCATCH(int, index, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
RefPtr<HTMLElement> result = imp->insertCell(index, ec);
if (UNLIKELY(ec))
goto fail;
return toV8Fast(result.release(), args, imp);
}
fail:
return setDOMException(ec, args.GetIsolate());
}
示例8: deleteRow
void HTMLTableElement::deleteRow(int index, ExceptionCode& ec)
{
HTMLTableRowElement* row = 0;
if (index == -1)
row = HTMLTableRowsCollection::lastRow(this);
else {
for (int i = 0; i <= index; ++i) {
row = HTMLTableRowsCollection::rowAfter(this, row);
if (!row)
break;
}
}
if (!row) {
ec = INDEX_SIZE_ERR;
return;
}
row->remove(ec);
}
示例9: findRows
static inline RefPtr<HTMLCollection> findRows(const HTMLTableRowElement& row)
{
auto* parent = row.parentNode();
if (is<HTMLTableSectionElement>(parent))
return downcast<HTMLTableSectionElement>(*parent).rows();
if (is<HTMLTableElement>(parent))
return downcast<HTMLTableElement>(*parent).rows();
return nullptr;
}
示例10: toLayoutTable
bool AXTable::isDataTable() const
{
if (!m_layoutObject || !node())
return false;
// Do not consider it a data table if it has an ARIA role.
if (hasARIARole())
return false;
// When a section of the document is contentEditable, all tables should be
// treated as data tables, otherwise users may not be able to work with rich
// text editors that allow creating and editing tables.
if (node() && node()->hasEditableStyle())
return true;
// This employs a heuristic to determine if this table should appear.
// Only "data" tables should be exposed as tables.
// Unfortunately, there is no good way to determine the difference
// between a "layout" table and a "data" table.
LayoutTable* table = toLayoutTable(m_layoutObject);
Node* tableNode = table->node();
if (!isHTMLTableElement(tableNode))
return false;
// Do not consider it a data table if any of its descendants have an ARIA role.
HTMLTableElement* tableElement = toHTMLTableElement(tableNode);
if (elementHasAriaRole(tableElement->tHead()))
return false;
if (elementHasAriaRole(tableElement->tFoot()))
return false;
RefPtrWillBeRawPtr<HTMLCollection> bodies = tableElement->tBodies();
for (unsigned bodyIndex = 0; bodyIndex < bodies->length(); ++bodyIndex) {
Element* bodyElement = bodies->item(bodyIndex);
if (elementHasAriaRole(bodyElement))
return false;
}
RefPtrWillBeRawPtr<HTMLTableRowsCollection> rows = tableElement->rows();
unsigned rowCount = rows->length();
for (unsigned rowIndex = 0; rowIndex < rowCount; ++rowIndex) {
HTMLTableRowElement* rowElement = rows->item(rowIndex);
if (elementHasAriaRole(rowElement))
return false;
RefPtrWillBeRawPtr<HTMLCollection> cells = rowElement->cells();
for (unsigned cellIndex = 0; cellIndex < cells->length(); ++cellIndex) {
if (elementHasAriaRole(cells->item(cellIndex)))
return false;
}
}
// If there is a caption element, summary, THEAD, or TFOOT section, it's most certainly a data table
if (!tableElement->summary().isEmpty() || tableElement->tHead() || tableElement->tFoot() || tableElement->caption())
return true;
// if someone used "rules" attribute than the table should appear
if (!tableElement->rules().isEmpty())
return true;
// if there's a colgroup or col element, it's probably a data table.
if (Traversal<HTMLTableColElement>::firstChild(*tableElement))
return true;
// go through the cell's and check for tell-tale signs of "data" table status
// cells have borders, or use attributes like headers, abbr, scope or axis
table->recalcSectionsIfNeeded();
LayoutTableSection* firstBody = table->firstBody();
if (!firstBody)
return false;
int numCols = firstBody->numEffectiveColumns();
int numRows = firstBody->numRows();
// If there's only one cell, it's not a good AXTable candidate.
if (numRows == 1 && numCols == 1)
return false;
// If there are at least 20 rows, we'll call it a data table.
if (numRows >= 20)
return true;
// Store the background color of the table to check against cell's background colors.
const ComputedStyle* tableStyle = table->style();
if (!tableStyle)
return false;
Color tableBGColor = tableStyle->visitedDependentColor(CSSPropertyBackgroundColor);
// check enough of the cells to find if the table matches our criteria
// Criteria:
// 1) must have at least one valid cell (and)
// 2) at least half of cells have borders (or)
// 3) at least half of cells have different bg colors than the table, and there is cell spacing
unsigned validCellCount = 0;
unsigned borderedCellCount = 0;
unsigned backgroundDifferenceCellCount = 0;
unsigned cellsWithTopBorder = 0;
unsigned cellsWithBottomBorder = 0;
unsigned cellsWithLeftBorder = 0;
unsigned cellsWithRightBorder = 0;
//.........这里部分代码省略.........
示例11: cellsAttrGetter
static v8::Handle<v8::Value> cellsAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
HTMLTableRowElement* imp = V8HTMLTableRowElement::toNative(info.Holder());
return toV8Fast(imp->cells(), info, imp);
}
示例12: sectionRowIndexAttrGetter
static v8::Handle<v8::Value> sectionRowIndexAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
HTMLTableRowElement* imp = V8HTMLTableRowElement::toNative(info.Holder());
return v8Integer(imp->sectionRowIndex(), info.GetIsolate());
}
示例13: isInSection
static inline bool isInSection(HTMLTableRowElement& row, const HTMLQualifiedName& sectionTag)
{
// Because we know that the parent is a table or a section, it's safe to cast it to an HTMLElement
// giving us access to the faster hasTagName overload from that class.
return toHTMLElement(row.parentNode())->hasTagName(sectionTag);
}