LayoutTests:

        Reviewed by Hyatt.

        - added a test for <rdar://problem/5172596> HTML-parser-created tbody elements
          are being ignored when processing CSS child rules

        * fast/css/child-selector-implicit-tbody.html: Added.
        * fast/css/child-selector-implicit-tbody-expected.txt: Added.

        - updated test results for <rdar://problem/5172607> XML parser is creating
          implicit tbody elements; the only change is the tag name that's dumped

        * fast/table/037-expected.txt:
        * tables/mozilla/marvin/x_caption_align_bottom-expected.txt:
        * tables/mozilla/marvin/x_caption_align_top-expected.txt:
        * tables/mozilla/marvin/x_caption_class-expected.txt:
        * tables/mozilla/marvin/x_caption_id-expected.txt:
        * tables/mozilla/marvin/x_caption_style-expected.txt:
        * tables/mozilla/marvin/x_col_align_center-expected.txt:
        * tables/mozilla/marvin/x_col_align_char-expected.txt:
        * tables/mozilla/marvin/x_col_align_justify-expected.txt:
        * tables/mozilla/marvin/x_col_align_left-expected.txt:
        * tables/mozilla/marvin/x_col_align_right-expected.txt:
        * tables/mozilla/marvin/x_col_span-expected.txt:
        * tables/mozilla/marvin/x_col_valign_baseline-expected.txt:
        * tables/mozilla/marvin/x_col_valign_bottom-expected.txt:
        * tables/mozilla/marvin/x_col_valign_middle-expected.txt:
        * tables/mozilla/marvin/x_col_valign_top-expected.txt:
        * tables/mozilla/marvin/x_col_width_pct-expected.txt:
        * tables/mozilla/marvin/x_col_width_px-expected.txt:
        * tables/mozilla/marvin/x_col_width_rel-expected.txt:
        * tables/mozilla/marvin/x_colgroup_align_center-expected.txt:
        * tables/mozilla/marvin/x_colgroup_align_char-expected.txt:
        * tables/mozilla/marvin/x_colgroup_align_justify-expected.txt:
        * tables/mozilla/marvin/x_colgroup_align_left-expected.txt:
        * tables/mozilla/marvin/x_colgroup_align_right-expected.txt:
        * tables/mozilla/marvin/x_colgroup_span-expected.txt:
        * tables/mozilla/marvin/x_colgroup_valign_baseline-expected.txt:
        * tables/mozilla/marvin/x_colgroup_valign_bottom-expected.txt:
        * tables/mozilla/marvin/x_colgroup_valign_middle-expected.txt:
        * tables/mozilla/marvin/x_colgroup_valign_top-expected.txt:
        * tables/mozilla/marvin/x_colgroup_width_rel-expected.txt:
        * tables/mozilla/marvin/x_table_align_center-expected.txt:
        * tables/mozilla/marvin/x_table_align_left-expected.txt:
        * tables/mozilla/marvin/x_table_align_right-expected.txt:
        * tables/mozilla/marvin/x_table_bgcolor_name-expected.txt:
        * tables/mozilla/marvin/x_table_bgcolor_rgb-expected.txt:
        * tables/mozilla/marvin/x_table_cellpadding-expected.txt:
        * tables/mozilla/marvin/x_table_cellpadding_pct-expected.txt:
        * tables/mozilla/marvin/x_table_cellspacing-expected.txt:
        * tables/mozilla/marvin/x_table_cellspacing_pct-expected.txt:
        * tables/mozilla/marvin/x_table_class-expected.txt:
        * tables/mozilla/marvin/x_table_id-expected.txt:
        * tables/mozilla/marvin/x_table_style-expected.txt:
        * tables/mozilla/marvin/x_table_width_pct-expected.txt:
        * tables/mozilla/marvin/x_table_width_px-expected.txt:
        * tables/mozilla/marvin/x_td_align_center-expected.txt:
        * tables/mozilla/marvin/x_td_align_char-expected.txt:
        * tables/mozilla/marvin/x_td_align_justify-expected.txt:
        * tables/mozilla/marvin/x_td_align_left-expected.txt:
        * tables/mozilla/marvin/x_td_align_right-expected.txt:
        * tables/mozilla/marvin/x_td_bgcolor_name-expected.txt:
        * tables/mozilla/marvin/x_td_bgcolor_rgb-expected.txt:
        * tables/mozilla/marvin/x_td_class-expected.txt:
        * tables/mozilla/marvin/x_td_colspan-expected.txt:
        * tables/mozilla/marvin/x_td_height-expected.txt:
        * tables/mozilla/marvin/x_td_id-expected.txt:
        * tables/mozilla/marvin/x_td_nowrap-expected.txt:
        * tables/mozilla/marvin/x_td_rowspan-expected.txt:
        * tables/mozilla/marvin/x_td_style-expected.txt:
        * tables/mozilla/marvin/x_td_valign_baseline-expected.txt:
        * tables/mozilla/marvin/x_td_valign_bottom-expected.txt:
        * tables/mozilla/marvin/x_td_valign_middle-expected.txt:
        * tables/mozilla/marvin/x_td_valign_top-expected.txt:
        * tables/mozilla/marvin/x_td_width-expected.txt:
        * tables/mozilla/marvin/x_th_align_center-expected.txt:
        * tables/mozilla/marvin/x_th_align_char-expected.txt:
        * tables/mozilla/marvin/x_th_align_justify-expected.txt:
        * tables/mozilla/marvin/x_th_align_left-expected.txt:
        * tables/mozilla/marvin/x_th_align_right-expected.txt:
        * tables/mozilla/marvin/x_th_bgcolor_name-expected.txt:
        * tables/mozilla/marvin/x_th_bgcolor_rgb-expected.txt:
        * tables/mozilla/marvin/x_th_class-expected.txt:
        * tables/mozilla/marvin/x_th_colspan-expected.txt:
        * tables/mozilla/marvin/x_th_height-expected.txt:
        * tables/mozilla/marvin/x_th_id-expected.txt:
        * tables/mozilla/marvin/x_th_nowrap-expected.txt:
        * tables/mozilla/marvin/x_th_rowspan-expected.txt:
        * tables/mozilla/marvin/x_th_style-expected.txt:
        * tables/mozilla/marvin/x_th_valign_baseline-expected.txt:
        * tables/mozilla/marvin/x_th_valign_bottom-expected.txt:
        * tables/mozilla/marvin/x_th_valign_middle-expected.txt:
        * tables/mozilla/marvin/x_th_valign_top-expected.txt:
        * tables/mozilla/marvin/x_th_width-expected.txt:
        * tables/mozilla/marvin/x_tr_align_center-expected.txt:
        * tables/mozilla/marvin/x_tr_align_char-expected.txt:
        * tables/mozilla/marvin/x_tr_align_justify-expected.txt:
        * tables/mozilla/marvin/x_tr_align_left-expected.txt:
        * tables/mozilla/marvin/x_tr_align_right-expected.txt:
        * tables/mozilla/marvin/x_tr_bgcolor_name-expected.txt:
        * tables/mozilla/marvin/x_tr_bgcolor_rgb-expected.txt:
        * tables/mozilla/marvin/x_tr_class-expected.txt:
        * tables/mozilla/marvin/x_tr_id-expected.txt:
        * tables/mozilla/marvin/x_tr_style-expected.txt:
        * tables/mozilla/marvin/x_tr_valign_baseline-expected.txt:
        * tables/mozilla/marvin/x_tr_valign_bottom-expected.txt:
        * tables/mozilla/marvin/x_tr_valign_middle-expected.txt:
        * tables/mozilla/marvin/x_tr_valign_top-expected.txt:
        * tables/mozilla_expected_failures/bugs/bug178855-expected.txt:
        * tables/mozilla_expected_failures/marvin/x_caption_align_left-expected.txt:
        * tables/mozilla_expected_failures/marvin/x_caption_align_right-expected.txt:
        * tables/mozilla_expected_failures/marvin/x_colgroup_width_pct-expected.txt:
        * tables/mozilla_expected_failures/marvin/x_colgroup_width_px-expected.txt:

WebCore:

        Reviewed by Hyatt.

        - removed the m_implicit bit from Node, freeing up a bit

        - fixed <rdar://problem/5172607> XML parser is creating implicit tbody elements
        - fixed <rdar://problem/5172596> HTML-parser-created tbody elements are being
          ignored when processing CSS child rules

        Test: fast/css/child-selector-implicit-tbody.html

        * css/cssstyleselector.cpp: (WebCore::CSSStyleSelector::checkSelector):
        Removed code that used to look at implicitNode(), which no longer exists.

        * css/html4.css: Added a style rule to handle cases where we have a tr
        inside a table with no intervening table section.

        * dom/Node.h: Removed the bit.
        * dom/Node.cpp:
        (WebCore::Node::Node): Don't initialize the bit.
        (WebCore::Node::dump): Don't dump the bit.

        * dom/XMLTokenizer.cpp:
        (WebCore::XMLTokenizer::startElementNs): Remove the code that made a
        table body element. This is handled in the render tree, the DOM tree
        should not be mangled.
        (WebCore::XMLTokenizer::endElementNs): Removed code that used to look at
        implicitNode(), which no longer exists.

        * html/HTMLElementFactory.cpp: (WebCore::tableSectionConstructor):
        Removed boolean parameter that was passed to the HTMLTableSectionElement
        constructor.
        * html/HTMLParser.cpp: (WebCore::HTMLParser::handleError): Ditto.
        * html/HTMLTableElement.cpp:
        (WebCore::HTMLTableElement::createTHead): Ditto.
        (WebCore::HTMLTableElement::createTFoot): Ditto.
        (WebCore::HTMLTableElement::insertRow): Changed to return a PassRefPtr,
        because it's possible the row could be removed from the table by JavaScript
        code responding to DOM mutation events before the function returns. Just
        something I noticed by code inspection.

        * html/HTMLTableSectionElement.cpp:
        (WebCore::HTMLTableSectionElement::HTMLTableSectionElement): Removed
        boolean "implicit" parameter to the constructor.
        (WebCore::HTMLTableSectionElement::insertRow): Changed to return a
        PassRefPtr for the same reason cited above.

        * html/HTMLTableElement.h: Changed the return value of insertRow to be
        a PassRefPtr.
        * html/HTMLTableSectionElement.h: Ditto.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@21208 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/html/HTMLTableElement.cpp b/WebCore/html/HTMLTableElement.cpp
index e0d4bf5..1a91346 100644
--- a/WebCore/html/HTMLTableElement.cpp
+++ b/WebCore/html/HTMLTableElement.cpp
@@ -129,7 +129,7 @@
 {
     if (!m_head) {
         ExceptionCode ec = 0;
-        m_head = new HTMLTableSectionElement(theadTag, document(), true /* implicit */);
+        m_head = new HTMLTableSectionElement(theadTag, document());
         if (m_foot)
             insertBefore(m_head, m_foot, ec);
         else if (m_firstBody)
@@ -155,7 +155,7 @@
 {
     if (!m_foot) {
         ExceptionCode ec = 0;
-        m_foot = new HTMLTableSectionElement(tfootTag, document(), true /*implicit */);
+        m_foot = new HTMLTableSectionElement(tfootTag, document());
         if (m_firstBody)
             insertBefore(m_foot, m_firstBody, ec);
         else
@@ -196,14 +196,14 @@
     m_caption = 0;
 }
 
-HTMLElement *HTMLTableElement::insertRow(int index, ExceptionCode& ec)
+PassRefPtr<HTMLElement> HTMLTableElement::insertRow(int index, ExceptionCode& ec)
 {
     // The DOM requires that we create a tbody if the table is empty
     // (cf DOM2TS HTMLTableElement31 test)
     // (note: this is different from "if the table has no sections", since we can have
     // <TABLE><TR>)
     if (!m_firstBody && !m_head && !m_foot)
-        setTBody(new HTMLTableSectionElement(tbodyTag, document(), true /* implicit */));
+        setTBody(new HTMLTableSectionElement(tbodyTag, document()));
 
     // IE treats index=-1 as default value meaning 'append after last'
     // This isn't in the DOM. So, not implemented yet.
@@ -243,7 +243,7 @@
     else {
         // No more sections => index is too big
         ec = INDEX_SIZE_ERR;
-        return 0L;
+        return 0;
     }
 }