Refactor application of additional style attributes for table elements.
authorkling@webkit.org <kling@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Jan 2012 19:02:27 +0000 (19:02 +0000)
committerkling@webkit.org <kling@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Jan 2012 19:02:27 +0000 (19:02 +0000)
commit854221b227428e4498690c88d00f66e56ba1b278
tree8cd727b45a76b9ce9d1258663efd175a1492d964
parentd5594e09fdc8e8c9d63e920436fb9d30f47df908
Refactor application of additional style attributes for table elements.
<http://webkit.org/b/77095>

Reviewed by Darin Adler.

The primary purpose of this change is to reduce usage of CSSMappedAttributeDeclaration.
Instead of using the mapped attribute decl table for additional table style, just use
regular CSSMutableStyleDeclarations. We cache them all globally, except for the style
that's shared between a table's cells. That one is cached per-table since it depends
on the table's border and padding.

* dom/CSSMappedAttributeDeclaration.cpp:
(WebCore::CSSMappedAttributeDeclaration::~CSSMappedAttributeDeclaration):
* dom/MappedAttributeEntry.h:

    Remove the concept of persistent CSSMappedAttributeDeclarations. The hunk in
    ~CSSMappedAttributeDeclaration was wildly wrong since it would leave stale pointers
    in the decl table, but unreachable since we always leaked one ref to those decls.

* dom/StyledElement.h:
(WebCore::StyledElement::additionalAttributeStyle):
* html/HTMLTableCellElement.cpp:
(WebCore::HTMLTableCellElement::additionalAttributeStyle):
* html/HTMLTableCellElement.h:
(HTMLTableCellElement):
* html/HTMLTableColElement.cpp:
(WebCore::HTMLTableColElement::additionalAttributeStyle):
* html/HTMLTableColElement.h:
(HTMLTableColElement):
* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::parseMappedAttribute):
(WebCore::leakBorderStyle):
(WebCore::HTMLTableElement::additionalAttributeStyle):
(WebCore::HTMLTableElement::createSharedCellStyle):
(WebCore::HTMLTableElement::additionalCellStyle):
(WebCore::leakGroupBorderStyle):
(WebCore::HTMLTableElement::additionalGroupStyle):
* html/HTMLTableElement.h:
(HTMLTableElement):
* html/HTMLTableSectionElement.cpp:
(WebCore::HTMLTableSectionElement::additionalAttributeStyle):
* html/HTMLTableSectionElement.h:
(HTMLTableSectionElement):

    Instead of collecting additional style decls into a vector, switch over to a
    "PassRefPtr<CSSMutableStyleDeclaration> additionalAttributeStyle()".
    All style declarations that can be reused for all elements are cached at the return
    sites, leaving only the shared table cell style which we cache on HTMLTableElement.
    Also removed the canHaveAdditionalAttributeStyleDecls() virtual since the default
    additionalAttributeStyle() will just return 0.

* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::matchAllRules):

    Updated for the new additional style conventions.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106015 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/CSSStyleSelector.cpp
Source/WebCore/dom/CSSMappedAttributeDeclaration.cpp
Source/WebCore/dom/MappedAttributeEntry.h
Source/WebCore/dom/StyledElement.h
Source/WebCore/html/HTMLTableCellElement.cpp
Source/WebCore/html/HTMLTableCellElement.h
Source/WebCore/html/HTMLTableColElement.cpp
Source/WebCore/html/HTMLTableColElement.h
Source/WebCore/html/HTMLTableElement.cpp
Source/WebCore/html/HTMLTableElement.h
Source/WebCore/html/HTMLTableSectionElement.cpp
Source/WebCore/html/HTMLTableSectionElement.h