diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-07 11:21:11 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-07 11:21:11 +0200 |
commit | 2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 (patch) | |
tree | 988e8c5b116dd0466244ae2fe5af8ee9be926d76 /Source/WebCore/html/HTMLTableElement.cpp | |
parent | dd91e772430dc294e3bf478c119ef8d43c0a3358 (diff) | |
download | qtwebkit-2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47.tar.gz |
Imported WebKit commit 7e538425aa020340619e927792f3d895061fb54b (http://svn.webkit.org/repository/webkit/trunk@116286)
Diffstat (limited to 'Source/WebCore/html/HTMLTableElement.cpp')
-rw-r--r-- | Source/WebCore/html/HTMLTableElement.cpp | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/Source/WebCore/html/HTMLTableElement.cpp b/Source/WebCore/html/HTMLTableElement.cpp index cf64b37da..b91302f9e 100644 --- a/Source/WebCore/html/HTMLTableElement.cpp +++ b/Source/WebCore/html/HTMLTableElement.cpp @@ -155,6 +155,14 @@ void HTMLTableElement::deleteTFoot() removeChild(tFoot(), ec); } +PassRefPtr<HTMLElement> HTMLTableElement::createTBody() +{ + RefPtr<HTMLTableSectionElement> body = HTMLTableSectionElement::create(tbodyTag, document()); + Node* referenceElement = lastBody() ? lastBody()->nextSibling() : 0; + insertBefore(body, referenceElement, ASSERT_NO_EXCEPTION); + return body.release(); +} + PassRefPtr<HTMLElement> HTMLTableElement::createCaption() { if (HTMLTableCaptionElement* existingCaption = caption()) @@ -426,8 +434,18 @@ static StylePropertySet* leakBorderStyle(int value) StylePropertySet* HTMLTableElement::additionalAttributeStyle() { - if ((!m_borderAttr && !m_borderColorAttr) || m_frameAttr) + if (m_frameAttr) return 0; + + if (!m_borderAttr && !m_borderColorAttr) { + // Setting the border to 'hidden' allows it to win over any border + // set on the table's cells during border-conflict resolution. + if (m_rulesAttr != UnsetRules) { + static StylePropertySet* solidBorderStyle = leakBorderStyle(CSSValueHidden); + return solidBorderStyle; + } + return 0; + } if (m_borderColorAttr) { static StylePropertySet* solidBorderStyle = leakBorderStyle(CSSValueSolid); @@ -464,40 +482,38 @@ 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, cssValuePool->createInheritedValue()); + 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, cssValuePool->createInheritedValue()); + style->setProperty(CSSPropertyBorderColor, cssValuePool().createInheritedValue()); break; case SolidBorders: - style->setProperty(CSSPropertyBorderWidth, cssValuePool->createValue(1, CSSPrimitiveValue::CSS_PX)); - style->setProperty(CSSPropertyBorderStyle, cssValuePool->createIdentifierValue(CSSValueSolid)); - style->setProperty(CSSPropertyBorderColor, cssValuePool->createInheritedValue()); + 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, cssValuePool->createValue(1, CSSPrimitiveValue::CSS_PX)); - style->setProperty(CSSPropertyBorderStyle, cssValuePool->createIdentifierValue(CSSValueInset)); - style->setProperty(CSSPropertyBorderColor, cssValuePool->createInheritedValue()); + 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, cssValuePool->createValue(0, CSSPrimitiveValue::CSS_PX)); + style->setProperty(CSSPropertyBorderWidth, cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX)); break; } if (m_padding) - style->setProperty(CSSPropertyPadding, cssValuePool->createValue(m_padding, CSSPrimitiveValue::CSS_PX)); + style->setProperty(CSSPropertyPadding, cssValuePool().createValue(m_padding, CSSPrimitiveValue::CSS_PX)); return style.release(); } |