diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-03-12 14:11:15 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-03-12 14:11:15 +0100 |
commit | dd91e772430dc294e3bf478c119ef8d43c0a3358 (patch) | |
tree | 6f33ce4d5872a5691e0291eb45bf6ab373a5f567 /Source/WebCore/html/HTMLTableElement.cpp | |
parent | ad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (diff) | |
download | qtwebkit-dd91e772430dc294e3bf478c119ef8d43c0a3358.tar.gz |
Imported WebKit commit 3db4eb1820ac8fb03065d7ea73a4d9db1e8fea1a (http://svn.webkit.org/repository/webkit/trunk@110422)
This includes build fixes for the latest qtbase/qtdeclarative as well as the final QML2 API.
Diffstat (limited to 'Source/WebCore/html/HTMLTableElement.cpp')
-rw-r--r-- | Source/WebCore/html/HTMLTableElement.cpp | 60 |
1 files changed, 24 insertions, 36 deletions
diff --git a/Source/WebCore/html/HTMLTableElement.cpp b/Source/WebCore/html/HTMLTableElement.cpp index 9420d9518..cf64b37da 100644 --- a/Source/WebCore/html/HTMLTableElement.cpp +++ b/Source/WebCore/html/HTMLTableElement.cpp @@ -30,6 +30,7 @@ #include "CSSPropertyNames.h" #include "CSSStyleSheet.h" #include "CSSValueKeywords.h" +#include "CSSValuePool.h" #include "ExceptionCode.h" #include "HTMLNames.h" #include "HTMLParserIdioms.h" @@ -186,13 +187,15 @@ PassRefPtr<HTMLElement> HTMLTableElement::insertRow(int index, ExceptionCode& ec return 0; } - HTMLTableRowElement* lastRow = 0; - HTMLTableRowElement* row = 0; + RefPtr<Node> protectFromMutationEvents(this); + + RefPtr<HTMLTableRowElement> lastRow = 0; + RefPtr<HTMLTableRowElement> row = 0; if (index == -1) lastRow = HTMLTableRowsCollection::lastRow(this); else { for (int i = 0; i <= index; ++i) { - row = HTMLTableRowsCollection::rowAfter(this, lastRow); + row = HTMLTableRowsCollection::rowAfter(this, lastRow.get()); if (!row) { if (i != index) { ec = INDEX_SIZE_ERR; @@ -204,7 +207,7 @@ PassRefPtr<HTMLElement> HTMLTableElement::insertRow(int index, ExceptionCode& ec } } - ContainerNode* parent; + RefPtr<ContainerNode> parent; if (lastRow) parent = row ? row->parentNode() : lastRow->parentNode(); else { @@ -219,7 +222,7 @@ PassRefPtr<HTMLElement> HTMLTableElement::insertRow(int index, ExceptionCode& ec } RefPtr<HTMLTableRowElement> newRow = HTMLTableRowElement::create(document()); - parent->insertBefore(newRow, row, ec); + parent->insertBefore(newRow, row.get(), ec); return newRow.release(); } @@ -351,11 +354,11 @@ void HTMLTableElement::collectStyleForAttribute(Attribute* attr, StylePropertySe HTMLElement::collectStyleForAttribute(attr, style); } -bool HTMLTableElement::isPresentationAttribute(Attribute* attr) const +bool HTMLTableElement::isPresentationAttribute(const QualifiedName& name) const { - if (attr->name() == widthAttr || attr->name() == heightAttr || attr->name() == bgcolorAttr || attr->name() == backgroundAttr || attr->name() == valignAttr || attr->name() == vspaceAttr || attr->name() == hspaceAttr || attr->name() == alignAttr || attr->name() == cellspacingAttr || attr->name() == borderAttr || attr->name() == bordercolorAttr || attr->name() == frameAttr || attr->name() == rulesAttr) + if (name == widthAttr || name == heightAttr || name == bgcolorAttr || name == backgroundAttr || name == valignAttr || name == vspaceAttr || name == hspaceAttr || name == alignAttr || name == cellspacingAttr || name == borderAttr || name == bordercolorAttr || name == frameAttr || name == rulesAttr) return true; - return HTMLElement::isPresentationAttribute(attr); + return HTMLElement::isPresentationAttribute(name); } void HTMLTableElement::parseAttribute(Attribute* attr) @@ -461,49 +464,40 @@ PassRefPtr<StylePropertySet> HTMLTableElement::createSharedCellStyle() { RefPtr<StylePropertySet> style = StylePropertySet::create(); + CSSValuePool* cssValuePool = document()->cssValuePool().get(); + switch (cellBorders()) { case SolidBordersColsOnly: style->setProperty(CSSPropertyBorderLeftWidth, CSSValueThin); style->setProperty(CSSPropertyBorderRightWidth, CSSValueThin); style->setProperty(CSSPropertyBorderLeftStyle, CSSValueSolid); style->setProperty(CSSPropertyBorderRightStyle, CSSValueSolid); - style->setProperty(CSSPropertyBorderColor, "inherit"); + style->setProperty(CSSPropertyBorderColor, cssValuePool->createInheritedValue()); break; case SolidBordersRowsOnly: style->setProperty(CSSPropertyBorderTopWidth, CSSValueThin); style->setProperty(CSSPropertyBorderBottomWidth, CSSValueThin); style->setProperty(CSSPropertyBorderTopStyle, CSSValueSolid); style->setProperty(CSSPropertyBorderBottomStyle, CSSValueSolid); - style->setProperty(CSSPropertyBorderColor, "inherit"); + style->setProperty(CSSPropertyBorderColor, cssValuePool->createInheritedValue()); break; case SolidBorders: - style->setProperty(CSSPropertyBorderWidth, "1px"); - style->setProperty(CSSPropertyBorderTopStyle, CSSValueSolid); - style->setProperty(CSSPropertyBorderBottomStyle, CSSValueSolid); - style->setProperty(CSSPropertyBorderLeftStyle, CSSValueSolid); - style->setProperty(CSSPropertyBorderRightStyle, CSSValueSolid); - style->setProperty(CSSPropertyBorderColor, "inherit"); + style->setProperty(CSSPropertyBorderWidth, cssValuePool->createValue(1, CSSPrimitiveValue::CSS_PX)); + style->setProperty(CSSPropertyBorderStyle, cssValuePool->createIdentifierValue(CSSValueSolid)); + style->setProperty(CSSPropertyBorderColor, cssValuePool->createInheritedValue()); break; case InsetBorders: - style->setProperty(CSSPropertyBorderWidth, "1px"); - style->setProperty(CSSPropertyBorderTopStyle, CSSValueInset); - style->setProperty(CSSPropertyBorderBottomStyle, CSSValueInset); - style->setProperty(CSSPropertyBorderLeftStyle, CSSValueInset); - style->setProperty(CSSPropertyBorderRightStyle, CSSValueInset); - style->setProperty(CSSPropertyBorderColor, "inherit"); + style->setProperty(CSSPropertyBorderWidth, cssValuePool->createValue(1, CSSPrimitiveValue::CSS_PX)); + style->setProperty(CSSPropertyBorderStyle, cssValuePool->createIdentifierValue(CSSValueInset)); + style->setProperty(CSSPropertyBorderColor, cssValuePool->createInheritedValue()); break; case NoBorders: - style->setProperty(CSSPropertyBorderWidth, "0"); + style->setProperty(CSSPropertyBorderWidth, cssValuePool->createValue(0, CSSPrimitiveValue::CSS_PX)); break; } - if (m_padding) { - String value = String::number(m_padding) + "px"; - style->setProperty(CSSPropertyPaddingTop, value); - style->setProperty(CSSPropertyPaddingBottom, value); - style->setProperty(CSSPropertyPaddingLeft, value); - style->setProperty(CSSPropertyPaddingRight, value); - } + if (m_padding) + style->setProperty(CSSPropertyPadding, cssValuePool->createValue(m_padding, CSSPrimitiveValue::CSS_PX)); return style.release(); } @@ -545,12 +539,6 @@ StylePropertySet* HTMLTableElement::additionalGroupStyle(bool rows) return columnBorderStyle; } -void HTMLTableElement::attach() -{ - ASSERT(!attached()); - HTMLElement::attach(); -} - bool HTMLTableElement::isURLAttribute(Attribute *attr) const { return attr->name() == backgroundAttr || HTMLElement::isURLAttribute(attr); |