Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[CTTE] RenderTableCol is never anonymous.
<https://webkit.org/b/121286>

Reviewed by Antti Koivisto.

Hide element() and provide existingElement() instead, returning an Element&.
Removed one bogus null check that was exposed.

Canonical link: https://commits.webkit.org/139242@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155685 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Andreas Kling committed Sep 13, 2013
1 parent e803d63 commit 4cfa1ca
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
10 changes: 10 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,13 @@
2013-09-13 Andreas Kling <akling@apple.com>

[CTTE] RenderTableCol is never anonymous.
<https://webkit.org/b/121286>

Reviewed by Antti Koivisto.

Hide element() and provide existingElement() instead, returning an Element&.
Removed one bogus null check that was exposed.

2013-09-13 Andreas Kling <akling@apple.com>

[CTTE] RenderListItem is never anonymous.
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/RenderObject.cpp
Expand Up @@ -221,7 +221,7 @@ RenderObject* RenderObject::createObject(Element* element, RenderStyle* style)
return new (arena) RenderTableRow(element);
case TABLE_COLUMN_GROUP:
case TABLE_COLUMN:
return new (arena) RenderTableCol(element);
return new (arena) RenderTableCol(*element);
case TABLE_CELL:
return new (arena) RenderTableCell(element);
case TABLE_CAPTION:
Expand Down
11 changes: 5 additions & 6 deletions Source/WebCore/rendering/RenderTableCol.cpp
Expand Up @@ -35,8 +35,8 @@ namespace WebCore {

using namespace HTMLNames;

RenderTableCol::RenderTableCol(Element* element)
: RenderBox(element)
RenderTableCol::RenderTableCol(Element& element)
: RenderBox(&element)
, m_span(1)
{
// init RenderObject attributes
Expand All @@ -59,10 +59,9 @@ void RenderTableCol::styleDidChange(StyleDifference diff, const RenderStyle* old
void RenderTableCol::updateFromElement()
{
unsigned oldSpan = m_span;
Element* element = this->element();
if (element && (element->hasTagName(colTag) || element->hasTagName(colgroupTag))) {
HTMLTableColElement* tc = static_cast<HTMLTableColElement*>(element);
m_span = tc->span();
if (existingElement().hasTagName(colTag) || existingElement().hasTagName(colgroupTag)) {
HTMLTableColElement& tc = static_cast<HTMLTableColElement&>(existingElement());
m_span = tc.span();
} else
m_span = !(style() && style()->display() == TABLE_COLUMN_GROUP);
if (m_span != oldSpan && style() && parent())
Expand Down
5 changes: 4 additions & 1 deletion Source/WebCore/rendering/RenderTableCol.h
Expand Up @@ -35,7 +35,8 @@ class RenderTableCell;

class RenderTableCol FINAL : public RenderBox {
public:
explicit RenderTableCol(Element*);
explicit RenderTableCol(Element&);
Element& existingElement() const { return *RenderBox::element(); }

RenderObject* firstChild() const { ASSERT(children() == virtualChildren()); return children()->firstChild(); }
RenderObject* lastChild() const { ASSERT(children() == virtualChildren()); return children()->lastChild(); }
Expand Down Expand Up @@ -77,6 +78,8 @@ class RenderTableCol FINAL : public RenderBox {
const BorderValue& borderAdjoiningCellAfter(const RenderTableCell*) const;

private:
void element() const WTF_DELETED_FUNCTION;

virtual RenderObjectChildList* virtualChildren() { return children(); }
virtual const RenderObjectChildList* virtualChildren() const { return children(); }

Expand Down

0 comments on commit 4cfa1ca

Please sign in to comment.