Refactor ShadowRoot exception handling
authoresprehn@chromium.org <esprehn@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jan 2013 00:02:15 +0000 (00:02 +0000)
committeresprehn@chromium.org <esprehn@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jan 2013 00:02:15 +0000 (00:02 +0000)
commit6c170e79e9bc2c3a1b2ea731b29f6dcf7ccc1795
treeb8343607f3422e99fa8969ea3e8c969839bd3bd0
parent25244e25fdbfcfa4147b3bbba6674fffb0e8837a
Refactor ShadowRoot exception handling
https://bugs.webkit.org/show_bug.cgi?id=108209

Reviewed by Dimitri Glazkov.

Source/WebCore:

Many of the exception cases for ShadowRoot are actually impossible and
should be asserts instead. We can also move the one case of exception logic,
for elements that don't allow author shadows into Element::createShadowRoot
instead of having it all over the ShadowRoot and ElementShadow classes. This
is the first step in centralizing all ShadowRoot creation inside ElementShadow.

No new tests, covered by existing tests.

* WebCore.exp.in:
* dom/Element.cpp:
(WebCore::Element::createShadowRoot): Be explicit about what kind of ShadowRoot you're creating.
(WebCore::Element::ensureUserAgentShadowRoot): No more exceptions.
* dom/ElementShadow.cpp:
(WebCore::ElementShadow::addShadowRoot): This never actually throws exceptions, remove ExceptionCode.
* dom/ElementShadow.h:
(ElementShadow):
* dom/ShadowRoot.cpp:
(WebCore::determineUsageType): Merge with Element::createShadowRoot.
(WebCore):
(WebCore::ShadowRoot::ShadowRoot): Moved Histogram logic here since it's actually about the constructor anyway.
(WebCore::ShadowRoot::create): Removed overload that made the code less obvious.
* dom/ShadowRoot.h:
(ShadowRoot):
* html/HTMLKeygenElement.cpp:
(WebCore::HTMLKeygenElement::HTMLKeygenElement):
* html/shadow/TextFieldDecorationElement.cpp:
(WebCore::getDecorationRootAndDecoratedRoot):
* testing/Internals.cpp:
(WebCore::Internals::ensureShadowRoot):
(WebCore::Internals::createShadowRoot):

Source/WebKit/win:

* WebKit.vcproj/WebKitExports.def.in: Swap ShadowRoot::create export with Element::createShadowRoot.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141175 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/ElementShadow.cpp
Source/WebCore/dom/ElementShadow.h
Source/WebCore/dom/ShadowRoot.cpp
Source/WebCore/dom/ShadowRoot.h
Source/WebCore/html/HTMLKeygenElement.cpp
Source/WebCore/html/shadow/TextFieldDecorationElement.cpp
Source/WebCore/testing/Internals.cpp
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebKit.vcproj/WebKitExports.def.in