[Shadow DOM] Refactoring: InsertionPoint could simplify its subclass hooks
authormorrita@google.com <morrita@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Jan 2013 04:00:13 +0000 (04:00 +0000)
committermorrita@google.com <morrita@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Jan 2013 04:00:13 +0000 (04:00 +0000)
commit9b225f01e38940d74aeaa290f1969a3d7059e35f
treea08e4742676b961778e4d6e8ce650ef13c0f817d
parentb5e59b71ec0d66de53f8fe4d99ce2800e5dea3ff
[Shadow DOM] Refactoring: InsertionPoint could simplify its subclass hooks
https://bugs.webkit.org/show_bug.cgi?id=106614

Reviewed by Dimitri Glazkov.

This change simplifies InsertionPoint overrides and give some flexibility to it.

The change

- Removes InsertionPoint::isSelectValid(). now ContentSelectorQuery parses given selector anyway.
  Invalid select attribute is handled by newly introduced matchTypeFor() method.
- Introduces InsertionPoint::matchTypeFor() to give a chance each InsertionPoint to decide whether it
  accepts the given node as its distribution. Then it lets DetailsSummaryElement adopt it.
- Pulls some HTMLShadowElement overrides up to InsertionPoint so that other upcoming InsertionPoint
  subclasses don't need to override them.

No new tests. Refactoring.

* html/HTMLDetailsElement.cpp:
(WebCore::DetailsSummaryElement::DetailsSummaryElement):
- Implemented matchTypeFor() to get rid of HTMLContentElement machinery which is compiled out in the upcoming change.
(DetailsSummaryElement):
* html/shadow/ContentSelectorQuery.cpp:
(WebCore::ContentSelectorQuery::ContentSelectorQuery):
(WebCore::ContentSelectorQuery::matches):
* html/shadow/HTMLContentElement.cpp:
(WebCore::HTMLContentElement::matchTypeFor): Added.
(WebCore):
* html/shadow/HTMLContentElement.h:
(HTMLContentElement):
(WebCore::isHTMLContentElement):
* html/shadow/HTMLShadowElement.cpp:
* html/shadow/HTMLShadowElement.h:
(HTMLShadowElement):
* html/shadow/InsertionPoint.cpp:
(WebCore::InsertionPoint::emptySelectorList): Moved from HTMLShadowElement.
(WebCore):
* html/shadow/InsertionPoint.h:
(WebCore::InsertionPoint::matchTypeFor): Added.
(WebCore::InsertionPoint::selectorList): Moved from HTMLShadowElement.
(InsertionPoint):
* testing/Internals.cpp:
(WebCore::Internals::isValidContentSelect):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139400 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLDetailsElement.cpp
Source/WebCore/html/shadow/ContentSelectorQuery.cpp
Source/WebCore/html/shadow/HTMLContentElement.cpp
Source/WebCore/html/shadow/HTMLContentElement.h
Source/WebCore/html/shadow/HTMLShadowElement.cpp
Source/WebCore/html/shadow/HTMLShadowElement.h
Source/WebCore/html/shadow/InsertionPoint.cpp
Source/WebCore/html/shadow/InsertionPoint.h
Source/WebCore/testing/Internals.cpp