This source file includes following definitions.
- m_span
- create
- isPresentationAttribute
- collectStyleForPresentationAttribute
- parseAttribute
- additionalPresentationAttributeStyle
- setSpan
- width
#include "config.h"
#include "core/html/HTMLTableColElement.h"
#include "CSSPropertyNames.h"
#include "HTMLNames.h"
#include "core/html/HTMLTableElement.h"
#include "core/rendering/RenderTableCol.h"
namespace WebCore {
using namespace HTMLNames;
inline HTMLTableColElement::HTMLTableColElement(const QualifiedName& tagName, Document& document)
: HTMLTablePartElement(tagName, document)
, m_span(1)
{
ScriptWrappable::init(this);
}
PassRefPtr<HTMLTableColElement> HTMLTableColElement::create(const QualifiedName& tagName, Document& document)
{
return adoptRef(new HTMLTableColElement(tagName, document));
}
bool HTMLTableColElement::isPresentationAttribute(const QualifiedName& name) const
{
if (name == widthAttr)
return true;
return HTMLTablePartElement::isPresentationAttribute(name);
}
void HTMLTableColElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style)
{
if (name == widthAttr)
addHTMLLengthToStyle(style, CSSPropertyWidth, value);
else
HTMLTablePartElement::collectStyleForPresentationAttribute(name, value, style);
}
void HTMLTableColElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == spanAttr) {
int newSpan = value.toInt();
m_span = newSpan ? newSpan : 1;
if (renderer() && renderer()->isRenderTableCol())
renderer()->updateFromElement();
} else if (name == widthAttr) {
if (!value.isEmpty()) {
if (renderer() && renderer()->isRenderTableCol()) {
RenderTableCol* col = toRenderTableCol(renderer());
int newWidth = width().toInt();
if (newWidth != col->width())
col->setNeedsLayoutAndPrefWidthsRecalc();
}
}
} else
HTMLTablePartElement::parseAttribute(name, value);
}
const StylePropertySet* HTMLTableColElement::additionalPresentationAttributeStyle()
{
if (!hasLocalName(colgroupTag))
return 0;
if (HTMLTableElement* table = findParentTable())
return table->additionalGroupStyle(false);
return 0;
}
void HTMLTableColElement::setSpan(int n)
{
setIntegralAttribute(spanAttr, n);
}
const AtomicString& HTMLTableColElement::width() const
{
return getAttribute(widthAttr);
}
}