Remove UsePointersEvenForNonNullableObjectArguments from Internals
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Apr 2016 17:10:14 +0000 (17:10 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Apr 2016 17:10:14 +0000 (17:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=156539

Reviewed by Alex Christensen.

Source/WebCore:

* html/HTMLImageElement.idl: Exported this so it can be used as the type for
a function argument in Internals.idl.
* html/HTMLInputElement.idl: Ditto.
* html/HTMLLinkElement.idl: Ditto.
* html/HTMLSelectElement.idl: Ditto.

* testing/Internals.cpp:
(WebCore::InspectorStubFrontend::InspectorStubFrontend): Take a Page&.
(WebCore::Internals::create): Take a Document&.
(WebCore::Internals::resetToConsistentState): Take a Page&.
(WebCore::Internals::Internals): Take a Document&.
(WebCore::Internals::settings): Use nullptr instead of 0.
(WebCore::Internals::address): Take a Node&.
(WebCore::Internals::nodeNeedsStyleRecalc): Take a Node& and no ExceptionCode&.
(WebCore::Internals::styleChangeType): Ditto.
(WebCore::Internals::xhrResponseSource): Take an XMLHttpRequest&.
(WebCore::Internals::isSharingStyleSheetContents): Take two
HTMLLinkElement&.
(WebCore::Internals::isStyleSheetLoadingSubresources): Take an HTMLLinkElement&.
(WebCore::Internals::imageFrameIndex): Take an HTMLImageElement& and no
ExceptionCode&. Also return an unsigned rather than size_t, since the IDL expects
unsigned long, which means unsigned in C++ code.
(WebCore::Internals::treeScopeRootNode): Take a Node& and no ExceptionCode&.
(WebCore::Internals::parentTreeScope): Ditto.
(WebCore::Internals::pauseAnimationAtTimeOnElement): Take an Element&.
(WebCore::Internals::pauseAnimationAtTimeOnPseudoElement): Ditto.
(WebCore::Internals::pauseTransitionAtTimeOnElement): Ditto.
(WebCore::Internals::pauseTransitionAtTimeOnPseudoElement): Ditto.
(WebCore::Internals::attached): Deleted.
(WebCore::Internals::elementRenderTreeAsText): Take an Element&.
(WebCore::Internals::hasPausedImageAnimations): Take an Element& and no
ExceptionCode&.
(WebCore::Internals::computedStyleIncludingVisitedInfo): Take a Node& and no
ExceptionCode&.
(WebCore::Internals::ensureShadowRoot): Take an Element&.
(WebCore::Internals::ensureUserAgentShadowRoot): Take an Element& and no
ExceptionCode&.
(WebCore::Internals::createShadowRoot): Take an Element&.
(WebCore::Internals::shadowRoot): Take an Element& and no ExceptionCode&.
(WebCore::Internals::shadowRootType): Take a Node&.
(WebCore::Internals::includerFor): Deleted.
(WebCore::Internals::shadowPseudoId): Take an Element& and no ExceptionCode&.
(WebCore::Internals::setShadowPseudoId): Ditto.
(WebCore::Internals::visiblePlaceholder): Take an Element&.
(WebCore::Internals::selectColorInColorChooser): Take an HTMLInputElement&.
(WebCore::Internals::boundingBox): Take an Element& and no ExceptionCode&.
(WebCore::Internals::markerCountForNode): Take a Node&.
(WebCore::Internals::markerAt): Ditto.
(WebCore::Internals::markerRangeForNode): Ditto.
(WebCore::Internals::markerDescriptionForNode): Ditto.
(WebCore::Internals::addTextMatchMarker): Take a const Range&.
(WebCore::Internals::setScrollViewPosition): Take int instead of long; long in
IDL means int in C++ code.
(WebCore::Internals::wasLastChangeUserEdit): Take an Element&.
(WebCore::Internals::elementShouldAutoComplete): Take an HTMLInputElement&.
(WebCore::Internals::setEditingValue): Take an HTMLInputElement& and no
ExceptionCode&.
(WebCore::Internals::setAutofilled): Ditto.
(WebCore::Internals::setShowAutoFillButton): Ditto.
(WebCore::Internals::scrollElementToRect): Take an Element& and int instead of long.
(WebCore::Internals::autofillFieldName): Take an Element&.
(WebCore::Internals::rangeFromLocationAndLength): Take an Element& and no ExceptionCode&.
(WebCore::Internals::locationFromRange): Ditto.
(WebCore::Internals::lengthFromRange): Take an Element& and const Range& and no
ExceptionCode&.
(WebCore::Internals::rangeAsText): Take const Range& an no ExceptionCode&.
(WebCore::Internals::subrange): Take Range& an no ExceptionCode&.
(WebCore::Internals::nodesFromRect): Take a Document&.
(WebCore::Internals::openDummyInspectorFrontend): Ditto.
(WebCore::Internals::layerTreeAsText): Take an Element&.
(WebCore::Internals::setElementUsesDisplayListDrawing): Ditto.
(WebCore::Internals::setElementTracksDisplayListReplay): Ditto.
(WebCore::Internals::displayListForElement): Ditto.
(WebCore::Internals::replayDisplayListForElement): Ditto.
(WebCore::Internals::counterValue): Ditto.
(WebCore::Internals::pageNumber): Ditto.
(WebCore::Internals::webkitWillEnterFullScreenForElement): Ditto.
(WebCore::Internals::webkitDidEnterFullScreenForElement): Ditto.
(WebCore::Internals::webkitWillExitFullScreenForElement): Ditto.
(WebCore::Internals::webkitDidExitFullScreenForElement): Ditto.
(WebCore::Internals::layerFlushCount): Return unsigned instead of unsigned long.
IDL unsigned long means unsigned in C++ code.
(WebCore::Internals::styleRecalcCount): Ditto.
(WebCore::Internals::compositingUpdateCount): Ditto.
(WebCore::Internals::deserializeBuffer): Take an ArrayBuffer&.
(WebCore::Internals::markerTextForListItem): Take an Element& and no ExceptionCode&.
(WebCore::Internals::toolTipFromElement): Ditto.
(WebCore::Internals::getImageSourceURL): Ditto.
(WebCore::Internals::simulateAudioInterruption): Take an HTMLMediaElement&.
(WebCore::Internals::mediaElementHasCharacteristic): Ditto.
(WebCore::Internals::isSelectPopupVisible): Take an HTMLSelectElement&.
(WebCore::Internals::closestTimeToTimeRanges): Take a TimeRange&.
(WebCore::Internals::isPluginUnavailabilityIndicatorObscured): Take an Element&.
(WebCore::Internals::isPluginSnapshotted): Take an Element& and no ExceptionCode&.
(WebCore::Internals::bufferedSamplesForTrackID): Take a SourceBuffer&.
(WebCore::Internals::setShouldGenerateTimestamps): Ditto.
(WebCore::Internals::setMediaElementRestrictions): Take an HTMLMediaElement&.
(WebCore::Internals::elementIsBlockingDisplaySleep): Take an HTMLMediaElement&.
(WebCore::Internals::setAudioContextRestrictions): Take an AudioContext&.
(WebCore::Internals::scrollSnapOffsets): Take an Element&.
(WebCore::Internals::getCurrentMediaControlsStatusForElement): Take an HTMLMediaElement&.
(WebCore::Internals::userVisibleString): Take a const DOMURL&.
(WebCore::Internals::composedTreeAsText): Take a Node&.

* testing/Internals.h: Update for all the changes listed above.

* testing/Internals.idl: Removed UsePointersEvenForNonNullableObjectArguments. Removed
many unneeded [RaisesException]. Used more specific types for many arguments. Removed
unused, and unimplemented, attached and includedFor functions. Made the node argument to
updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks nullable as well as optional.

* testing/Internals.mm:
(WebCore::Internals::userVisibleString): Take a const DOMURL&.

* testing/js/WebCoreTestSupport.cpp:
(WebCoreTestSupport::injectInternalsObject): Pass a Document& rather than a Document*.
(WebCoreTestSupport::resetInternalsObject): Pass a Page& rather than a Page*.

LayoutTests:

* fast/forms/color/input-color-onchange-event-expected.txt: Updated.
* fast/forms/color/input-color-onchange-event.html: Removed unneeded test of how the
internals object handles incorrect values passed to the test function. This wasn't testing
actual WebKit code at all, it was just a test of the internals object implementation.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199539 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/forms/color/input-color-onchange-event-expected.txt
LayoutTests/fast/forms/color/input-color-onchange-event.html
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLImageElement.idl
Source/WebCore/html/HTMLInputElement.idl
Source/WebCore/html/HTMLLinkElement.idl
Source/WebCore/html/HTMLSelectElement.idl
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebCore/testing/Internals.mm
Source/WebCore/testing/js/WebCoreTestSupport.cpp

index 09f6244..f0de11a 100644 (file)
@@ -1,3 +1,15 @@
+2016-04-14  Darin Adler  <darin@apple.com>
+
+        Remove UsePointersEvenForNonNullableObjectArguments from Internals
+        https://bugs.webkit.org/show_bug.cgi?id=156539
+
+        Reviewed by Alex Christensen.
+
+        * fast/forms/color/input-color-onchange-event-expected.txt: Updated.
+        * fast/forms/color/input-color-onchange-event.html: Removed unneeded test of how the
+        internals object handles incorrect values passed to the test function. This wasn't testing
+        actual WebKit code at all, it was just a test of the internals object implementation.
+
 2016-04-14  Daniel Bates  <dabates@apple.com>
 
         CSP: Ignore report-only policy delivered via meta element
index 88cd713..3c77e10 100644 (file)
@@ -5,9 +5,6 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 
 PASS onChangeCount is 0
-internals.selectColorInColorChooser({}, '#ff0000');
-internals.selectColorInColorChooser(document, '#ff0000');
-PASS onChangeCount is 0
 input event dispatched - value is:  #ff0000
 change event dispatched - value changed to #ff0000
 PASS onChangeCount is 1
index cb643a0..9f77988 100644 (file)
@@ -35,10 +35,6 @@ eventSender.mouseDown();
 eventSender.mouseUp();
 
 shouldBe('onChangeCount', '0');
-// Test that incorrect element arguments are (not) handled.
-evalAndLog("internals.selectColorInColorChooser({}, '#ff0000');");
-evalAndLog("internals.selectColorInColorChooser(document, '#ff0000');");
-shouldBe('onChangeCount', '0');
 
 // input.onchange should be called
 internals.selectColorInColorChooser(input, '#ff0000');
index f8b5f7b..f463ea3 100644 (file)
@@ -1,3 +1,128 @@
+2016-04-14  Darin Adler  <darin@apple.com>
+
+        Remove UsePointersEvenForNonNullableObjectArguments from Internals
+        https://bugs.webkit.org/show_bug.cgi?id=156539
+
+        Reviewed by Alex Christensen.
+
+        * html/HTMLImageElement.idl: Exported this so it can be used as the type for
+        a function argument in Internals.idl.
+        * html/HTMLInputElement.idl: Ditto.
+        * html/HTMLLinkElement.idl: Ditto.
+        * html/HTMLSelectElement.idl: Ditto.
+
+        * testing/Internals.cpp:
+        (WebCore::InspectorStubFrontend::InspectorStubFrontend): Take a Page&.
+        (WebCore::Internals::create): Take a Document&.
+        (WebCore::Internals::resetToConsistentState): Take a Page&.
+        (WebCore::Internals::Internals): Take a Document&.
+        (WebCore::Internals::settings): Use nullptr instead of 0.
+        (WebCore::Internals::address): Take a Node&.
+        (WebCore::Internals::nodeNeedsStyleRecalc): Take a Node& and no ExceptionCode&.
+        (WebCore::Internals::styleChangeType): Ditto.
+        (WebCore::Internals::xhrResponseSource): Take an XMLHttpRequest&.
+        (WebCore::Internals::isSharingStyleSheetContents): Take two
+        HTMLLinkElement&.
+        (WebCore::Internals::isStyleSheetLoadingSubresources): Take an HTMLLinkElement&.
+        (WebCore::Internals::imageFrameIndex): Take an HTMLImageElement& and no
+        ExceptionCode&. Also return an unsigned rather than size_t, since the IDL expects
+        unsigned long, which means unsigned in C++ code.
+        (WebCore::Internals::treeScopeRootNode): Take a Node& and no ExceptionCode&.
+        (WebCore::Internals::parentTreeScope): Ditto.
+        (WebCore::Internals::pauseAnimationAtTimeOnElement): Take an Element&.
+        (WebCore::Internals::pauseAnimationAtTimeOnPseudoElement): Ditto.
+        (WebCore::Internals::pauseTransitionAtTimeOnElement): Ditto.
+        (WebCore::Internals::pauseTransitionAtTimeOnPseudoElement): Ditto.
+        (WebCore::Internals::attached): Deleted.
+        (WebCore::Internals::elementRenderTreeAsText): Take an Element&.
+        (WebCore::Internals::hasPausedImageAnimations): Take an Element& and no
+        ExceptionCode&.
+        (WebCore::Internals::computedStyleIncludingVisitedInfo): Take a Node& and no
+        ExceptionCode&.
+        (WebCore::Internals::ensureShadowRoot): Take an Element&.
+        (WebCore::Internals::ensureUserAgentShadowRoot): Take an Element& and no
+        ExceptionCode&.
+        (WebCore::Internals::createShadowRoot): Take an Element&.
+        (WebCore::Internals::shadowRoot): Take an Element& and no ExceptionCode&.
+        (WebCore::Internals::shadowRootType): Take a Node&.
+        (WebCore::Internals::includerFor): Deleted.
+        (WebCore::Internals::shadowPseudoId): Take an Element& and no ExceptionCode&.
+        (WebCore::Internals::setShadowPseudoId): Ditto.
+        (WebCore::Internals::visiblePlaceholder): Take an Element&.
+        (WebCore::Internals::selectColorInColorChooser): Take an HTMLInputElement&.
+        (WebCore::Internals::boundingBox): Take an Element& and no ExceptionCode&.
+        (WebCore::Internals::markerCountForNode): Take a Node&.
+        (WebCore::Internals::markerAt): Ditto.
+        (WebCore::Internals::markerRangeForNode): Ditto.
+        (WebCore::Internals::markerDescriptionForNode): Ditto.
+        (WebCore::Internals::addTextMatchMarker): Take a const Range&.
+        (WebCore::Internals::setScrollViewPosition): Take int instead of long; long in
+        IDL means int in C++ code.
+        (WebCore::Internals::wasLastChangeUserEdit): Take an Element&.
+        (WebCore::Internals::elementShouldAutoComplete): Take an HTMLInputElement&.
+        (WebCore::Internals::setEditingValue): Take an HTMLInputElement& and no
+        ExceptionCode&.
+        (WebCore::Internals::setAutofilled): Ditto.
+        (WebCore::Internals::setShowAutoFillButton): Ditto.
+        (WebCore::Internals::scrollElementToRect): Take an Element& and int instead of long.
+        (WebCore::Internals::autofillFieldName): Take an Element&.
+        (WebCore::Internals::rangeFromLocationAndLength): Take an Element& and no ExceptionCode&.
+        (WebCore::Internals::locationFromRange): Ditto.
+        (WebCore::Internals::lengthFromRange): Take an Element& and const Range& and no
+        ExceptionCode&.
+        (WebCore::Internals::rangeAsText): Take const Range& an no ExceptionCode&.
+        (WebCore::Internals::subrange): Take Range& an no ExceptionCode&.
+        (WebCore::Internals::nodesFromRect): Take a Document&.
+        (WebCore::Internals::openDummyInspectorFrontend): Ditto.
+        (WebCore::Internals::layerTreeAsText): Take an Element&.
+        (WebCore::Internals::setElementUsesDisplayListDrawing): Ditto.
+        (WebCore::Internals::setElementTracksDisplayListReplay): Ditto.
+        (WebCore::Internals::displayListForElement): Ditto.
+        (WebCore::Internals::replayDisplayListForElement): Ditto.
+        (WebCore::Internals::counterValue): Ditto.
+        (WebCore::Internals::pageNumber): Ditto.
+        (WebCore::Internals::webkitWillEnterFullScreenForElement): Ditto.
+        (WebCore::Internals::webkitDidEnterFullScreenForElement): Ditto.
+        (WebCore::Internals::webkitWillExitFullScreenForElement): Ditto.
+        (WebCore::Internals::webkitDidExitFullScreenForElement): Ditto.
+        (WebCore::Internals::layerFlushCount): Return unsigned instead of unsigned long.
+        IDL unsigned long means unsigned in C++ code.
+        (WebCore::Internals::styleRecalcCount): Ditto.
+        (WebCore::Internals::compositingUpdateCount): Ditto.
+        (WebCore::Internals::deserializeBuffer): Take an ArrayBuffer&.
+        (WebCore::Internals::markerTextForListItem): Take an Element& and no ExceptionCode&.
+        (WebCore::Internals::toolTipFromElement): Ditto.
+        (WebCore::Internals::getImageSourceURL): Ditto.
+        (WebCore::Internals::simulateAudioInterruption): Take an HTMLMediaElement&.
+        (WebCore::Internals::mediaElementHasCharacteristic): Ditto.
+        (WebCore::Internals::isSelectPopupVisible): Take an HTMLSelectElement&.
+        (WebCore::Internals::closestTimeToTimeRanges): Take a TimeRange&.
+        (WebCore::Internals::isPluginUnavailabilityIndicatorObscured): Take an Element&.
+        (WebCore::Internals::isPluginSnapshotted): Take an Element& and no ExceptionCode&.
+        (WebCore::Internals::bufferedSamplesForTrackID): Take a SourceBuffer&.
+        (WebCore::Internals::setShouldGenerateTimestamps): Ditto.
+        (WebCore::Internals::setMediaElementRestrictions): Take an HTMLMediaElement&.
+        (WebCore::Internals::elementIsBlockingDisplaySleep): Take an HTMLMediaElement&.
+        (WebCore::Internals::setAudioContextRestrictions): Take an AudioContext&.
+        (WebCore::Internals::scrollSnapOffsets): Take an Element&.
+        (WebCore::Internals::getCurrentMediaControlsStatusForElement): Take an HTMLMediaElement&.
+        (WebCore::Internals::userVisibleString): Take a const DOMURL&.
+        (WebCore::Internals::composedTreeAsText): Take a Node&.
+
+        * testing/Internals.h: Update for all the changes listed above.
+
+        * testing/Internals.idl: Removed UsePointersEvenForNonNullableObjectArguments. Removed
+        many unneeded [RaisesException]. Used more specific types for many arguments. Removed
+        unused, and unimplemented, attached and includedFor functions. Made the node argument to
+        updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks nullable as well as optional.
+
+        * testing/Internals.mm:
+        (WebCore::Internals::userVisibleString): Take a const DOMURL&.
+
+        * testing/js/WebCoreTestSupport.cpp:
+        (WebCoreTestSupport::injectInternalsObject): Pass a Document& rather than a Document*.
+        (WebCoreTestSupport::resetInternalsObject): Pass a Page& rather than a Page*.
+
 2016-04-14  Daniel Bates  <dabates@apple.com>
 
         CSP: Ignore report-only policy delivered via meta element
index cf8fb8d..1b3dcc5 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 [
+    ExportMacro=WEBCORE_EXPORT,
     JSGenerateToNativeObject,
 ] interface HTMLImageElement : HTMLElement {
     [Reflect] attribute DOMString name;
index 0c0b5d9..7e2ef20 100644 (file)
  * Boston, MA 02110-1301, USA.
  */
 
-interface HTMLInputElement : HTMLElement {
+[
+    ExportMacro=WEBCORE_EXPORT,
+    JSGenerateToNativeObject,
+] interface HTMLInputElement : HTMLElement {
     [Reflect] attribute DOMString accept;
     [Reflect] attribute DOMString alt;
     attribute DOMString autocomplete;
index ed4b128..853f79a 100644 (file)
  * Boston, MA 02110-1301, USA.
  */
 
-interface HTMLLinkElement : HTMLElement {
+[
+    ExportMacro=WEBCORE_EXPORT,
+    JSGenerateToNativeObject,
+] interface HTMLLinkElement : HTMLElement {
     [Reflect] attribute boolean disabled;
     [Reflect] attribute DOMString charset;
     [Reflect, URL] attribute DOMString href;
index 33fb063..8ecbd8c 100644 (file)
@@ -20,6 +20,8 @@
 
 [
     CustomIndexedSetter,
+    ExportMacro=WEBCORE_EXPORT,
+    JSGenerateToNativeObject,
 ] interface HTMLSelectElement : HTMLElement {
     [Reflect] attribute boolean autofocus;
     [Reflect] attribute boolean disabled;
index ac0aea0..21d0f2d 100644 (file)
@@ -242,7 +242,7 @@ using namespace HTMLNames;
 
 class InspectorStubFrontend : public InspectorFrontendClientLocal, public FrontendChannel {
 public:
-    InspectorStubFrontend(Page* inspectedPage, RefPtr<DOMWindow>&& frontendWindow);
+    InspectorStubFrontend(Page& inspectedPage, RefPtr<DOMWindow>&& frontendWindow);
     virtual ~InspectorStubFrontend();
 
     // InspectorFrontendClient API
@@ -274,16 +274,15 @@ private:
     InspectorController& m_frontendController;
 };
 
-InspectorStubFrontend::InspectorStubFrontend(Page* inspectedPage, RefPtr<DOMWindow>&& frontendWindow)
-    : InspectorFrontendClientLocal(&inspectedPage->inspectorController(), frontendWindow->document()->page(), std::make_unique<InspectorFrontendClientLocal::Settings>())
+InspectorStubFrontend::InspectorStubFrontend(Page& inspectedPage, RefPtr<DOMWindow>&& frontendWindow)
+    : InspectorFrontendClientLocal(&inspectedPage.inspectorController(), frontendWindow->document()->page(), std::make_unique<InspectorFrontendClientLocal::Settings>())
     , m_frontendWindow(frontendWindow.copyRef())
     , m_frontendController(frontendPage()->inspectorController())
 {
-    ASSERT_ARG(inspectedPage, inspectedPage);
     ASSERT_ARG(frontendWindow, frontendWindow);
 
     m_frontendController.setInspectorFrontendClient(this);
-    inspectedPage->inspectorController().connectFrontend(this);
+    inspectedPage.inspectorController().connectFrontend(this);
 }
 
 InspectorStubFrontend::~InspectorStubFrontend()
@@ -358,7 +357,7 @@ static bool markerTypesFrom(const String& markerType, DocumentMarker::MarkerType
 
 const char* Internals::internalsId = "internals";
 
-Ref<Internals> Internals::create(Document* document)
+Ref<Internals> Internals::create(Document& document)
 {
     return adoptRef(*new Internals(document));
 }
@@ -367,23 +366,21 @@ Internals::~Internals()
 {
 }
 
-void Internals::resetToConsistentState(Page* page)
+void Internals::resetToConsistentState(Page& page)
 {
-    ASSERT(page);
-
-    page->setPageScaleFactor(1, IntPoint(0, 0));
-    page->setPagination(Pagination());
-    page->setPaginationLineGridEnabled(false);
+    page.setPageScaleFactor(1, IntPoint(0, 0));
+    page.setPagination(Pagination());
+    page.setPaginationLineGridEnabled(false);
 
-    page->setDefersLoading(false);
+    page.setDefersLoading(false);
     
-    page->mainFrame().setTextZoomFactor(1.0f);
+    page.mainFrame().setTextZoomFactor(1.0f);
     
-    FrameView* mainFrameView = page->mainFrame().view();
+    FrameView* mainFrameView = page.mainFrame().view();
     if (mainFrameView) {
         mainFrameView->setHeaderHeight(0);
         mainFrameView->setFooterHeight(0);
-        page->setTopContentInset(0);
+        page.setTopContentInset(0);
         mainFrameView->setUseFixedLayout(false);
         mainFrameView->setFixedLayoutSize(IntSize());
     }
@@ -391,16 +388,16 @@ void Internals::resetToConsistentState(Page* page)
     WebCore::overrideUserPreferredLanguages(Vector<String>());
     WebCore::Settings::setUsesOverlayScrollbars(false);
     WebCore::Settings::setUsesMockScrollAnimator(false);
-    page->inspectorController().setLegacyProfilerEnabled(false);
+    page.inspectorController().setLegacyProfilerEnabled(false);
 #if ENABLE(VIDEO_TRACK)
-    page->group().captionPreferences().setCaptionsStyleSheetOverride(emptyString());
-    page->group().captionPreferences().setTestingMode(false);
-#endif
-    if (!page->mainFrame().editor().isContinuousSpellCheckingEnabled())
-        page->mainFrame().editor().toggleContinuousSpellChecking();
-    if (page->mainFrame().editor().isOverwriteModeEnabled())
-        page->mainFrame().editor().toggleOverwriteModeEnabled();
-    page->mainFrame().loader().clearTestingOverrides();
+    page.group().captionPreferences().setCaptionsStyleSheetOverride(emptyString());
+    page.group().captionPreferences().setTestingMode(false);
+#endif
+    if (!page.mainFrame().editor().isContinuousSpellCheckingEnabled())
+        page.mainFrame().editor().toggleContinuousSpellChecking();
+    if (page.mainFrame().editor().isOverwriteModeEnabled())
+        page.mainFrame().editor().toggleOverwriteModeEnabled();
+    page.mainFrame().loader().clearTestingOverrides();
     ApplicationCacheStorage::singleton().setDefaultOriginQuota(ApplicationCacheStorage::noQuota());
 #if ENABLE(VIDEO)
     PlatformMediaSessionManager::sharedManager().resetRestrictions();
@@ -417,19 +414,19 @@ void Internals::resetToConsistentState(Page* page)
     MockContentFilterSettings::reset();
 #endif
 
-    page->setShowAllPlugins(false);
+    page.setShowAllPlugins(false);
     
 #if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
     _AXSSetForceAllowWebScaling(false);
 #endif
 }
 
-Internals::Internals(Document* document)
-    : ContextDestructionObserver(document)
+Internals::Internals(Document& document)
+    : ContextDestructionObserver(&document)
 {
 #if ENABLE(VIDEO_TRACK)
-    if (document && document->page())
-        document->page()->group().captionPreferences().setTestingMode(true);
+    if (document.page())
+        document.page()->group().captionPreferences().setTestingMode(true);
 #endif
 
 #if ENABLE(MEDIA_STREAM)
@@ -442,8 +439,8 @@ Internals::Internals(Document* document)
 #endif
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
-    if (document && document->page())
-        document->page()->setMockMediaPlaybackTargetPickerEnabled(true);
+    if (document.page())
+        document.page()->setMockMediaPlaybackTargetPickerEnabled(true);
 #endif
 }
 
@@ -463,10 +460,10 @@ InternalSettings* Internals::settings() const
 {
     Document* document = contextDocument();
     if (!document)
-        return 0;
+        return nullptr;
     Page* page = document->page();
     if (!page)
-        return 0;
+        return nullptr;
     return InternalSettings::from(page);
 }
 
@@ -475,19 +472,14 @@ unsigned Internals::workerThreadCount() const
     return WorkerThread::workerThreadCount();
 }
 
-String Internals::address(Node* node)
+String Internals::address(Node& node)
 {
-    return String::format("%p", node);
+    return String::format("%p", &node);
 }
 
-bool Internals::nodeNeedsStyleRecalc(Node* node, ExceptionCode& exception)
+bool Internals::nodeNeedsStyleRecalc(Node& node)
 {
-    if (!node) {
-        exception = INVALID_ACCESS_ERR;
-        return false;
-    }
-
-    return node->needsStyleRecalc();
+    return node.needsStyleRecalc();
 }
 
 static String styleChangeTypeToString(StyleChangeType type)
@@ -508,14 +500,9 @@ static String styleChangeTypeToString(StyleChangeType type)
     return "";
 }
 
-String Internals::styleChangeType(Node* node, ExceptionCode& exception)
+String Internals::styleChangeType(Node& node)
 {
-    if (!node) {
-        exception = INVALID_ACCESS_ERR;
-        return { };
-    }
-
-    return styleChangeTypeToString(node->styleChangeType());
+    return styleChangeTypeToString(node.styleChangeType());
 }
 
 String Internals::description(Deprecated::ScriptValue value)
@@ -542,13 +529,11 @@ bool Internals::isLoadingFromMemoryCache(const String& url)
     return resource && resource->status() == CachedResource::Cached;
 }
 
-String Internals::xhrResponseSource(XMLHttpRequest* xhr)
+String Internals::xhrResponseSource(XMLHttpRequest& request)
 {
-    if (!xhr)
-        return "Null xhr";
-    if (xhr->resourceResponse().isNull())
+    if (request.resourceResponse().isNull())
         return "Null response";
-    switch (xhr->resourceResponse().source()) {
+    switch (request.resourceResponse().source()) {
     case ResourceResponse::Source::Unknown:
         return "Unknown";
     case ResourceResponse::Source::Network:
@@ -566,23 +551,16 @@ String Internals::xhrResponseSource(XMLHttpRequest* xhr)
     return "Error";
 }
 
-bool Internals::isSharingStyleSheetContents(Element* a, Element* b)
+bool Internals::isSharingStyleSheetContents(HTMLLinkElement& a, HTMLLinkElement& b)
 {
-    if (!is<HTMLLinkElement>(a) || !is<HTMLLinkElement>(b))
-        return false;
-    auto& aLink = downcast<HTMLLinkElement>(*a);
-    auto& bLink = downcast<HTMLLinkElement>(*b);
-    if (!aLink.sheet() || !bLink.sheet())
+    if (!a.sheet() || !b.sheet())
         return false;
-    return &aLink.sheet()->contents() == &bLink.sheet()->contents();
+    return &a.sheet()->contents() == &b.sheet()->contents();
 }
 
-bool Internals::isStyleSheetLoadingSubresources(Element* link)
+bool Internals::isStyleSheetLoadingSubresources(HTMLLinkElement& link)
 {
-    if (!is<HTMLLinkElement>(link))
-        return false;
-    auto& linkElement = downcast<HTMLLinkElement>(*link);
-    return linkElement.sheet() && linkElement.sheet()->contents().isLoadingSubresources();
+    return link.sheet() && link.sheet()->contents().isLoadingSubresources();
 }
 
 static ResourceRequestCachePolicy stringToResourceRequestCachePolicy(const String& policy)
@@ -656,14 +634,9 @@ unsigned Internals::memoryCacheSize() const
     return MemoryCache::singleton().size();
 }
 
-size_t Internals::imageFrameIndex(Element* element, ExceptionCode& ec)
+unsigned Internals::imageFrameIndex(HTMLImageElement& element)
 {
-    if (!is<HTMLImageElement>(element)) {
-        ec = TypeError;
-        return 0;
-    }
-
-    auto* cachedImage = downcast<HTMLImageElement>(*element).cachedImage();
+    auto* cachedImage = element.cachedImage();
     if (!cachedImage)
         return 0;
 
@@ -681,23 +654,14 @@ unsigned Internals::pageCacheSize() const
     return PageCache::singleton().pageCount();
 }
 
-Node* Internals::treeScopeRootNode(Node* node, ExceptionCode& ec)
+Node* Internals::treeScopeRootNode(Node& node)
 {
-    if (!node) {
-        ec = INVALID_ACCESS_ERR;
-        return nullptr;
-    }
-
-    return &node->treeScope().rootNode();
+    return &node.treeScope().rootNode();
 }
 
-Node* Internals::parentTreeScope(Node* node, ExceptionCode& ec)
+Node* Internals::parentTreeScope(Node& node)
 {
-    if (!node) {
-        ec = INVALID_ACCESS_ERR;
-        return nullptr;
-    }
-    const TreeScope* parentTreeScope = node->treeScope().parentTreeScope();
+    const TreeScope* parentTreeScope = node.treeScope().parentTreeScope();
     return parentTreeScope ? &parentTreeScope->rootNode() : nullptr;
 }
 
@@ -749,18 +713,18 @@ void Internals::resumeAnimations(ExceptionCode& ec) const
     document->frame()->animation().resumeAnimations();
 }
 
-bool Internals::pauseAnimationAtTimeOnElement(const String& animationName, double pauseTime, Element* element, ExceptionCode& ec)
+bool Internals::pauseAnimationAtTimeOnElement(const String& animationName, double pauseTime, Element& element, ExceptionCode& ec)
 {
-    if (!element || pauseTime < 0) {
+    if (pauseTime < 0) {
         ec = INVALID_ACCESS_ERR;
         return false;
     }
-    return frame()->animation().pauseAnimationAtTime(element->renderer(), AtomicString(animationName), pauseTime);
+    return frame()->animation().pauseAnimationAtTime(element.renderer(), AtomicString(animationName), pauseTime);
 }
 
-bool Internals::pauseAnimationAtTimeOnPseudoElement(const String& animationName, double pauseTime, Element* element, const String& pseudoId, ExceptionCode& ec)
+bool Internals::pauseAnimationAtTimeOnPseudoElement(const String& animationName, double pauseTime, Element& element, const String& pseudoId, ExceptionCode& ec)
 {
-    if (!element || pauseTime < 0) {
+    if (pauseTime < 0) {
         ec = INVALID_ACCESS_ERR;
         return false;
     }
@@ -770,7 +734,7 @@ bool Internals::pauseAnimationAtTimeOnPseudoElement(const String& animationName,
         return false;
     }
 
-    PseudoElement* pseudoElement = pseudoId == "before" ? element->beforePseudoElement() : element->afterPseudoElement();
+    PseudoElement* pseudoElement = pseudoId == "before" ? element.beforePseudoElement() : element.afterPseudoElement();
     if (!pseudoElement) {
         ec = INVALID_ACCESS_ERR;
         return false;
@@ -779,18 +743,18 @@ bool Internals::pauseAnimationAtTimeOnPseudoElement(const String& animationName,
     return frame()->animation().pauseAnimationAtTime(pseudoElement->renderer(), AtomicString(animationName), pauseTime);
 }
 
-bool Internals::pauseTransitionAtTimeOnElement(const String& propertyName, double pauseTime, Element* element, ExceptionCode& ec)
+bool Internals::pauseTransitionAtTimeOnElement(const String& propertyName, double pauseTime, Element& element, ExceptionCode& ec)
 {
-    if (!element || pauseTime < 0) {
+    if (pauseTime < 0) {
         ec = INVALID_ACCESS_ERR;
         return false;
     }
-    return frame()->animation().pauseTransitionAtTime(element->renderer(), propertyName, pauseTime);
+    return frame()->animation().pauseTransitionAtTime(element.renderer(), propertyName, pauseTime);
 }
 
-bool Internals::pauseTransitionAtTimeOnPseudoElement(const String& property, double pauseTime, Element* element, const String& pseudoId, ExceptionCode& ec)
+bool Internals::pauseTransitionAtTimeOnPseudoElement(const String& property, double pauseTime, Element& element, const String& pseudoId, ExceptionCode& ec)
 {
-    if (!element || pauseTime < 0) {
+    if (pauseTime < 0) {
         ec = INVALID_ACCESS_ERR;
         return false;
     }
@@ -800,7 +764,7 @@ bool Internals::pauseTransitionAtTimeOnPseudoElement(const String& property, dou
         return false;
     }
 
-    PseudoElement* pseudoElement = pseudoId == "before" ? element->beforePseudoElement() : element->afterPseudoElement();
+    PseudoElement* pseudoElement = pseudoId == "before" ? element.beforePseudoElement() : element.afterPseudoElement();
     if (!pseudoElement) {
         ec = INVALID_ACCESS_ERR;
         return false;
@@ -809,27 +773,11 @@ bool Internals::pauseTransitionAtTimeOnPseudoElement(const String& property, dou
     return frame()->animation().pauseTransitionAtTime(pseudoElement->renderer(), property, pauseTime);
 }
 
-// FIXME: Remove.
-bool Internals::attached(Node* node, ExceptionCode& ec)
+String Internals::elementRenderTreeAsText(Element& element, ExceptionCode& ec)
 {
-    if (!node) {
-        ec = INVALID_ACCESS_ERR;
-        return false;
-    }
-
-    return true;
-}
+    element.document().updateStyleIfNeeded();
 
-String Internals::elementRenderTreeAsText(Element* element, ExceptionCode& ec)
-{
-    if (!element) {
-        ec = INVALID_ACCESS_ERR;
-        return String();
-    }
-
-    element->document().updateStyleIfNeeded();
-
-    String representation = externalRepresentation(element);
+    String representation = externalRepresentation(&element);
     if (representation.isEmpty()) {
         ec = INVALID_ACCESS_ERR;
         return String();
@@ -838,74 +786,48 @@ String Internals::elementRenderTreeAsText(Element* element, ExceptionCode& ec)
     return representation;
 }
 
-bool Internals::hasPausedImageAnimations(Element* element, ExceptionCode& ec)
+bool Internals::hasPausedImageAnimations(Element& element)
 {
-    if (!element) {
-        ec = INVALID_ACCESS_ERR;
-        return false;
-    }
-    return element->renderer() && element->renderer()->hasPausedImageAnimations();
+    return element.renderer() && element.renderer()->hasPausedImageAnimations();
 }
 
-RefPtr<CSSComputedStyleDeclaration> Internals::computedStyleIncludingVisitedInfo(Node* node, ExceptionCode& ec) const
+RefPtr<CSSComputedStyleDeclaration> Internals::computedStyleIncludingVisitedInfo(Node& node) const
 {
-    if (!node) {
-        ec = INVALID_ACCESS_ERR;
-        return nullptr;
-    }
-
     bool allowVisitedStyle = true;
-    return CSSComputedStyleDeclaration::create(node, allowVisitedStyle);
+    return CSSComputedStyleDeclaration::create(&node, allowVisitedStyle);
 }
 
-Node* Internals::ensureShadowRoot(Element* host, ExceptionCode& ec)
+Node* Internals::ensureShadowRoot(Element& host, ExceptionCode& ec)
 {
-    if (!host) {
-        ec = INVALID_ACCESS_ERR;
-        return 0;
-    }
-
-    if (ShadowRoot* shadowRoot = host->shadowRoot())
+    if (ShadowRoot* shadowRoot = host.shadowRoot())
         return shadowRoot;
 
-    return host->createShadowRoot(ec).get();
+    return host.createShadowRoot(ec).get();
 }
 
-Node* Internals::ensureUserAgentShadowRoot(Element* host, ExceptionCode& ec)
+Node* Internals::ensureUserAgentShadowRoot(Element& host)
 {
-    if (!host) {
-        ec = INVALID_ACCESS_ERR;
-        return nullptr;
-    }
-    return &host->ensureUserAgentShadowRoot();
+    return &host.ensureUserAgentShadowRoot();
 }
 
-Node* Internals::createShadowRoot(Element* host, ExceptionCode& ec)
+Node* Internals::createShadowRoot(Element& host, ExceptionCode& ec)
 {
-    if (!host) {
-        ec = INVALID_ACCESS_ERR;
-        return 0;
-    }
-    return host->createShadowRoot(ec).get();
+    return host.createShadowRoot(ec).get();
 }
 
-Node* Internals::shadowRoot(Element* host, ExceptionCode& ec)
+Node* Internals::shadowRoot(Element& host)
 {
-    if (!host) {
-        ec = INVALID_ACCESS_ERR;
-        return nullptr;
-    }
-    return host->shadowRoot();
+    return host.shadowRoot();
 }
 
-String Internals::shadowRootType(const Node* root, ExceptionCode& ec) const
+String Internals::shadowRootType(const Node& root, ExceptionCode& ec) const
 {
     if (!is<ShadowRoot>(root)) {
         ec = INVALID_ACCESS_ERR;
         return String();
     }
 
-    switch (downcast<ShadowRoot>(*root).type()) {
+    switch (downcast<ShadowRoot>(root).type()) {
     case ShadowRoot::Type::UserAgent:
         return String("UserAgentShadowRoot");
     case ShadowRoot::Type::Closed:
@@ -918,30 +840,14 @@ String Internals::shadowRootType(const Node* root, ExceptionCode& ec) const
     }
 }
 
-Element* Internals::includerFor(Node*, ExceptionCode& ec)
+String Internals::shadowPseudoId(Element& element)
 {
-    ec = INVALID_ACCESS_ERR;
-    return nullptr;
-}
-
-String Internals::shadowPseudoId(Element* element, ExceptionCode& ec)
-{
-    if (!element) {
-        ec = INVALID_ACCESS_ERR;
-        return String();
-    }
-
-    return element->shadowPseudoId().string();
+    return element.shadowPseudoId().string();
 }
 
-void Internals::setShadowPseudoId(Element* element, const String& id, ExceptionCode& ec)
+void Internals::setShadowPseudoId(Element& element, const String& id)
 {
-    if (!element) {
-        ec = INVALID_ACCESS_ERR;
-        return;
-    }
-
-    return element->setPseudo(id);
+    return element.setPseudo(id);
 }
 
 bool Internals::isTimerThrottled(int timeoutId, ExceptionCode& ec)
@@ -971,10 +877,10 @@ bool Internals::areTimersThrottled() const
     return contextDocument()->isTimerThrottlingEnabled();
 }
 
-String Internals::visiblePlaceholder(Element* element)
+String Internals::visiblePlaceholder(Element& element)
 {
     if (is<HTMLTextFormControlElement>(element)) {
-        const HTMLTextFormControlElement& textFormControlElement = downcast<HTMLTextFormControlElement>(*element);
+        const HTMLTextFormControlElement& textFormControlElement = downcast<HTMLTextFormControlElement>(element);
         if (!textFormControlElement.isPlaceholderVisible())
             return String();
         if (HTMLElement* placeholderElement = textFormControlElement.placeholderElement())
@@ -984,12 +890,9 @@ String Internals::visiblePlaceholder(Element* element)
     return String();
 }
 
-void Internals::selectColorInColorChooser(Element* element, const String& colorValue)
+void Internals::selectColorInColorChooser(HTMLInputElement& element, const String& colorValue)
 {
-    if (!is<HTMLInputElement>(element))
-        return;
-    auto& inputElement = downcast<HTMLInputElement>(*element);
-    inputElement.selectColor(Color(colorValue));
+    element.selectColor(Color(colorValue));
 }
 
 Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionCode& ec)
@@ -1067,15 +970,10 @@ Ref<ClientRect> Internals::absoluteCaretBounds(ExceptionCode& ec)
     return ClientRect::create(document->frame()->selection().absoluteCaretBounds());
 }
 
-Ref<ClientRect> Internals::boundingBox(Element* element, ExceptionCode& ec)
+Ref<ClientRect> Internals::boundingBox(Element& element)
 {
-    if (!element) {
-        ec = INVALID_ACCESS_ERR;
-        return ClientRect::create();
-    }
-
-    element->document().updateLayoutIgnorePendingStylesheets();
-    auto renderer = element->renderer();
+    element.document().updateLayoutIgnorePendingStylesheets();
+    auto renderer = element.renderer();
     if (!renderer)
         return ClientRect::create();
     return ClientRect::create(renderer->absoluteBoundingBoxRectIgnoringTransforms());
@@ -1105,31 +1003,21 @@ String Internals::inspectorHighlightObject(ExceptionCode& ec)
     return document->page()->inspectorController().buildObjectForHighlightedNodes()->toJSONString();
 }
 
-unsigned Internals::markerCountForNode(Node* node, const String& markerType, ExceptionCode& ec)
+unsigned Internals::markerCountForNode(Node& node, const String& markerType, ExceptionCode& ec)
 {
-    if (!node) {
-        ec = INVALID_ACCESS_ERR;
-        return 0;
-    }
-
     DocumentMarker::MarkerTypes markerTypes = 0;
     if (!markerTypesFrom(markerType, markerTypes)) {
         ec = SYNTAX_ERR;
         return 0;
     }
 
-    node->document().frame()->editor().updateEditorUINowIfScheduled();
-
-    return node->document().markers().markersFor(node, markerTypes).size();
+    node.document().frame()->editor().updateEditorUINowIfScheduled();
+    return node.document().markers().markersFor(&node, markerTypes).size();
 }
 
-RenderedDocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsigned index, ExceptionCode& ec)
+RenderedDocumentMarker* Internals::markerAt(Node& node, const String& markerType, unsigned index, ExceptionCode& ec)
 {
-    node->document().updateLayoutIgnorePendingStylesheets();
-    if (!node) {
-        ec = INVALID_ACCESS_ERR;
-        return nullptr;
-    }
+    node.document().updateLayoutIgnorePendingStylesheets();
 
     DocumentMarker::MarkerTypes markerTypes = 0;
     if (!markerTypesFrom(markerType, markerTypes)) {
@@ -1137,23 +1025,23 @@ RenderedDocumentMarker* Internals::markerAt(Node* node, const String& markerType
         return nullptr;
     }
 
-    node->document().frame()->editor().updateEditorUINowIfScheduled();
+    node.document().frame()->editor().updateEditorUINowIfScheduled();
 
-    Vector<RenderedDocumentMarker*> markers = node->document().markers().markersFor(node, markerTypes);
+    Vector<RenderedDocumentMarker*> markers = node.document().markers().markersFor(&node, markerTypes);
     if (markers.size() <= index)
         return nullptr;
     return markers[index];
 }
 
-RefPtr<Range> Internals::markerRangeForNode(Node* node, const String& markerType, unsigned index, ExceptionCode& ec)
+RefPtr<Range> Internals::markerRangeForNode(Node& node, const String& markerType, unsigned index, ExceptionCode& ec)
 {
     RenderedDocumentMarker* marker = markerAt(node, markerType, index, ec);
     if (!marker)
         return nullptr;
-    return Range::create(node->document(), node, marker->startOffset(), node, marker->endOffset());
+    return Range::create(node.document(), &node, marker->startOffset(), &node, marker->endOffset());
 }
 
-String Internals::markerDescriptionForNode(Node* node, const String& markerType, unsigned index, ExceptionCode& ec)
+String Internals::markerDescriptionForNode(Node& node, const String& markerType, unsigned index, ExceptionCode& ec)
 {
     RenderedDocumentMarker* marker = markerAt(node, markerType, index, ec);
     if (!marker)
@@ -1188,10 +1076,10 @@ String Internals::dumpMarkerRects(const String& markerTypeString, ExceptionCode&
     return rectString.toString();
 }
 
-void Internals::addTextMatchMarker(const Range* range, bool isActive)
+void Internals::addTextMatchMarker(const Range& range, bool isActive)
 {
-    range->ownerDocument().updateLayoutIgnorePendingStylesheets();
-    range->ownerDocument().markers().addTextMatchMarker(range, isActive);
+    range.ownerDocument().updateLayoutIgnorePendingStylesheets();
+    range.ownerDocument().markers().addTextMatchMarker(&range, isActive);
 }
 
 void Internals::setMarkedTextMatchesAreHighlighted(bool flag, ExceptionCode& ec)
@@ -1209,7 +1097,7 @@ void Internals::invalidateFontCache()
     FontCache::singleton().invalidate();
 }
 
-void Internals::setScrollViewPosition(long x, long y, ExceptionCode& ec)
+void Internals::setScrollViewPosition(int x, int y, ExceptionCode& ec)
 {
     Document* document = contextDocument();
     if (!document || !document->view()) {
@@ -1223,7 +1111,7 @@ void Internals::setScrollViewPosition(long x, long y, ExceptionCode& ec)
 
     frameView->setConstrainsScrollingToContentEdge(false);
     frameView->setScrollbarsSuppressed(false);
-    frameView->setScrollOffsetFromInternals(IntPoint(x, y));
+    frameView->setScrollOffsetFromInternals({ x, y });
     frameView->setScrollbarsSuppressed(scrollbarsSuppressedOldValue);
     frameView->setConstrainsScrollingToContentEdge(constrainsScrollingToContentEdgeOldValue);
 }
@@ -1299,66 +1187,31 @@ String Internals::configurationForViewport(float devicePixelRatio, int deviceWid
     return "viewport size " + String::number(attributes.layoutSize.width()) + "x" + String::number(attributes.layoutSize.height()) + " scale " + String::number(attributes.initialScale) + " with limits [" + String::number(attributes.minimumScale) + ", " + String::number(attributes.maximumScale) + "] and userScalable " + (attributes.userScalable ? "true" : "false");
 }
 
-bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionCode& ec)
+bool Internals::wasLastChangeUserEdit(Element& textField, ExceptionCode& ec)
 {
-    if (!textField) {
-        ec = INVALID_ACCESS_ERR;
-        return false;
-    }
+    if (is<HTMLInputElement>(textField))
+        return downcast<HTMLInputElement>(textField).lastChangeWasUserEdit();
 
-    if (is<HTMLInputElement>(*textField))
-        return downcast<HTMLInputElement>(*textField).lastChangeWasUserEdit();
-
-    if (is<HTMLTextAreaElement>(*textField))
-        return downcast<HTMLTextAreaElement>(*textField).lastChangeWasUserEdit();
+    if (is<HTMLTextAreaElement>(textField))
+        return downcast<HTMLTextAreaElement>(textField).lastChangeWasUserEdit();
 
     ec = INVALID_NODE_TYPE_ERR;
     return false;
 }
 
-bool Internals::elementShouldAutoComplete(Element* element, ExceptionCode& ec)
+bool Internals::elementShouldAutoComplete(HTMLInputElement& element)
 {
-    if (!element) {
-        ec = INVALID_ACCESS_ERR;
-        return false;
-    }
-
-    if (!is<HTMLInputElement>(*element)) {
-        ec = INVALID_NODE_TYPE_ERR;
-        return false;
-    }
-
-    return downcast<HTMLInputElement>(*element).shouldAutocomplete();
+    return element.shouldAutocomplete();
 }
 
-void Internals::setEditingValue(Element* element, const String& value, ExceptionCode& ec)
+void Internals::setEditingValue(HTMLInputElement& element, const String& value)
 {
-    if (!element) {
-        ec = INVALID_ACCESS_ERR;
-        return;
-    }
-
-    if (!is<HTMLInputElement>(*element)) {
-        ec = INVALID_NODE_TYPE_ERR;
-        return;
-    }
-
-    downcast<HTMLInputElement>(*element).setEditingValue(value);
+    element.setEditingValue(value);
 }
 
-void Internals::setAutofilled(Element* element, bool enabled, ExceptionCode& ec)
+void Internals::setAutofilled(HTMLInputElement& element, bool enabled)
 {
-    if (!element) {
-        ec = INVALID_ACCESS_ERR;
-        return;
-    }
-
-    if (!is<HTMLInputElement>(*element)) {
-        ec = INVALID_NODE_TYPE_ERR;
-        return;
-    }
-
-    downcast<HTMLInputElement>(*element).setAutoFilled(enabled);
+    element.setAutoFilled(enabled);
 }
 
 static AutoFillButtonType stringToAutoFillButtonType(const String& autoFillButtonType)
@@ -1373,45 +1226,30 @@ static AutoFillButtonType stringToAutoFillButtonType(const String& autoFillButto
     return AutoFillButtonType::None;
 }
 
-void Internals::setShowAutoFillButton(Element* element, const String& autoFillButtonType, ExceptionCode& ec)
+void Internals::setShowAutoFillButton(HTMLInputElement& element, const String& autoFillButtonType)
 {
-    if (!element) {
-        ec = INVALID_ACCESS_ERR;
-        return;
-    }
-
-    if (!is<HTMLInputElement>(*element)) {
-        ec = INVALID_NODE_TYPE_ERR;
-        return;
-    }
-
-    downcast<HTMLInputElement>(*element).setShowAutoFillButton(stringToAutoFillButtonType(autoFillButtonType));
+    element.setShowAutoFillButton(stringToAutoFillButtonType(autoFillButtonType));
 }
 
 
-void Internals::scrollElementToRect(Element* element, long x, long y, long w, long h, ExceptionCode& ec)
+void Internals::scrollElementToRect(Element& element, int x, int y, int w, int h, ExceptionCode& ec)
 {
-    if (!element || !element->document().view()) {
+    FrameView* frameView = element.document().view();
+    if (!frameView) {
         ec = INVALID_ACCESS_ERR;
         return;
     }
-    FrameView* frameView = element->document().view();
-    frameView->scrollElementToRect(*element, IntRect(x, y, w, h));
+    frameView->scrollElementToRect(element, { x, y, w, h });
 }
 
-String Internals::autofillFieldName(Element* element, ExceptionCode& ec)
+String Internals::autofillFieldName(Element& element, ExceptionCode& ec)
 {
-    if (!element) {
-        ec = INVALID_ACCESS_ERR;
-        return { };
-    }
-
-    if (!is<HTMLFormControlElement>(*element)) {
+    if (!is<HTMLFormControlElement>(element)) {
         ec = INVALID_NODE_TYPE_ERR;
         return { };
     }
 
-    return downcast<HTMLFormControlElement>(*element).autofillData().fieldName;
+    return downcast<HTMLFormControlElement>(element).autofillData().fieldName;
 }
 
 void Internals::paintControlTints(ExceptionCode& ec)
@@ -1426,60 +1264,35 @@ void Internals::paintControlTints(ExceptionCode& ec)
     frameView->paintControlTints();
 }
 
-RefPtr<Range> Internals::rangeFromLocationAndLength(Element* scope, int rangeLocation, int rangeLength, ExceptionCode& ec)
+RefPtr<Range> Internals::rangeFromLocationAndLength(Element& scope, int rangeLocation, int rangeLength)
 {
-    if (!scope) {
-        ec = INVALID_ACCESS_ERR;
-        return nullptr;
-    }
-
-    return TextIterator::rangeFromLocationAndLength(scope, rangeLocation, rangeLength);
+    return TextIterator::rangeFromLocationAndLength(&scope, rangeLocation, rangeLength);
 }
 
-unsigned Internals::locationFromRange(Element* scope, const Range* range, ExceptionCode& ec)
+unsigned Internals::locationFromRange(Element& scope, const Range& range)
 {
-    if (!scope || !range) {
-        ec = INVALID_ACCESS_ERR;
-        return 0;
-    }
-
     size_t location = 0;
     size_t unusedLength = 0;
-    TextIterator::getLocationAndLengthFromRange(scope, range, location, unusedLength);
+    TextIterator::getLocationAndLengthFromRange(&scope, &range, location, unusedLength);
     return location;
 }
 
-unsigned Internals::lengthFromRange(Element* scope, const Range* range, ExceptionCode& ec)
+unsigned Internals::lengthFromRange(Element& scope, const Range& range)
 {
-    if (!scope || !range) {
-        ec = INVALID_ACCESS_ERR;
-        return 0;
-    }
-
     size_t unusedLocation = 0;
     size_t length = 0;
-    TextIterator::getLocationAndLengthFromRange(scope, range, unusedLocation, length);
+    TextIterator::getLocationAndLengthFromRange(&scope, &range, unusedLocation, length);
     return length;
 }
 
-String Internals::rangeAsText(const Range* range, ExceptionCode& ec)
+String Internals::rangeAsText(const Range& range)
 {
-    if (!range) {
-        ec = INVALID_ACCESS_ERR;
-        return String();
-    }
-
-    return range->text();
+    return range.text();
 }
 
-RefPtr<Range> Internals::subrange(Range* range, int rangeLocation, int rangeLength, ExceptionCode& ec)
+RefPtr<Range> Internals::subrange(Range& range, int rangeLocation, int rangeLength)
 {
-    if (!range) {
-        ec = INVALID_ACCESS_ERR;
-        return nullptr;
-    }
-
-    return TextIterator::subrange(range, rangeLocation, rangeLength);
+    return TextIterator::subrange(&range, rangeLocation, rangeLength);
 }
 
 RefPtr<Range> Internals::rangeForDictionaryLookupAtLocation(int x, int y, ExceptionCode& ec)
@@ -1598,21 +1411,21 @@ unsigned Internals::touchEventHandlerCount(ExceptionCode& ec)
 // contextDocument(), with the exception of a few tests that pass a
 // different document, and could just make the call through another Internals
 // instance instead.
-RefPtr<NodeList> Internals::nodesFromRect(Document* document, int centerX, int centerY, unsigned topPadding, unsigned rightPadding,
+RefPtr<NodeList> Internals::nodesFromRect(Document& document, int centerX, int centerY, unsigned topPadding, unsigned rightPadding,
     unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent, ExceptionCode& ec) const
 {
-    if (!document || !document->frame() || !document->frame()->view()) {
+    if (!document.frame() || !document.frame()->view()) {
         ec = INVALID_ACCESS_ERR;
         return nullptr;
     }
 
-    Frame* frame = document->frame();
-    FrameView* frameView = document->view();
-    RenderView* renderView = document->renderView();
+    Frame* frame = document.frame();
+    FrameView* frameView = document.view();
+    RenderView* renderView = document.renderView();
     if (!renderView)
         return nullptr;
 
-    document->updateLayoutIgnorePendingStylesheets();
+    document.updateLayoutIgnorePendingStylesheets();
 
     float zoomFactor = frame->pageZoomFactor();
     LayoutPoint point(centerX * zoomFactor + frameView->scrollX(), centerY * zoomFactor + frameView->scrollY());
@@ -1939,7 +1752,7 @@ RefPtr<DOMWindow> Internals::openDummyInspectorFrontend(const String& url)
     Page* inspectedPage = contextDocument()->frame()->page();
     RefPtr<DOMWindow> window = inspectedPage->mainFrame().document()->domWindow();
     RefPtr<DOMWindow> frontendWindow = window->open(url, "", "", *window, *window);
-    m_inspectorFrontend = std::make_unique<InspectorStubFrontend>(inspectedPage, frontendWindow.copyRef());
+    m_inspectorFrontend = std::make_unique<InspectorStubFrontend>(*inspectedPage, frontendWindow.copyRef());
 
     return frontendWindow;
 }
@@ -2014,14 +1827,14 @@ bool Internals::isPageBoxVisible(int pageNumber, ExceptionCode& ec)
 // contextDocument(), with the exception of a few tests that pass a
 // different document, and could just make the call through another Internals
 // instance instead.
-String Internals::layerTreeAsText(Document* document, ExceptionCode& ec) const
+String Internals::layerTreeAsText(Document& document, ExceptionCode& ec) const
 {
     return layerTreeAsText(document, 0, ec);
 }
 
-String Internals::layerTreeAsText(Document* document, unsigned flags, ExceptionCode& ec) const
+String Internals::layerTreeAsText(Document& document, unsigned flags, ExceptionCode& ec) const
 {
-    if (!document || !document->frame()) {
+    if (!document.frame()) {
         ec = INVALID_ACCESS_ERR;
         return String();
     }
@@ -2038,7 +1851,7 @@ String Internals::layerTreeAsText(Document* document, unsigned flags, ExceptionC
     if (flags & LAYER_TREE_INCLUDES_CONTENT_LAYERS)
         layerTreeFlags |= LayerTreeFlagsIncludeContentLayers;
 
-    return document->frame()->layerTreeAsText(layerTreeFlags);
+    return document.frame()->layerTreeAsText(layerTreeFlags);
 }
 
 String Internals::repaintRectsAsText(ExceptionCode& ec) const
@@ -2097,7 +1910,7 @@ RefPtr<ClientRectList> Internals::nonFastScrollableRects(ExceptionCode& ec) cons
     return page->nonFastScrollableRects();
 }
 
-void Internals::setElementUsesDisplayListDrawing(Element* element, bool usesDisplayListDrawing, ExceptionCode& ec)
+void Internals::setElementUsesDisplayListDrawing(Element& element, bool usesDisplayListDrawing, ExceptionCode& ec)
 {
     Document* document = contextDocument();
     if (!document || !document->renderView()) {
@@ -2105,22 +1918,22 @@ void Internals::setElementUsesDisplayListDrawing(Element* element, bool usesDisp
         return;
     }
 
-    if (!element || !element->renderer()) {
+    if (!element.renderer()) {
         ec = INVALID_ACCESS_ERR;
         return;
     }
 
-    if (is<HTMLCanvasElement>(*element)) {
-        downcast<HTMLCanvasElement>(*element).setUsesDisplayListDrawing(usesDisplayListDrawing);
+    if (is<HTMLCanvasElement>(element)) {
+        downcast<HTMLCanvasElement>(element).setUsesDisplayListDrawing(usesDisplayListDrawing);
         return;
     }
 
-    if (!element->renderer()->hasLayer()) {
+    if (!element.renderer()->hasLayer()) {
         ec = INVALID_ACCESS_ERR;
         return;
     }
     
-    RenderLayer* layer = downcast<RenderLayerModelObject>(element->renderer())->layer();
+    RenderLayer* layer = downcast<RenderLayerModelObject>(element.renderer())->layer();
     if (!layer->isComposited()) {
         ec = INVALID_ACCESS_ERR;
         return;
@@ -2129,7 +1942,7 @@ void Internals::setElementUsesDisplayListDrawing(Element* element, bool usesDisp
     layer->backing()->setUsesDisplayListDrawing(usesDisplayListDrawing);
 }
 
-void Internals::setElementTracksDisplayListReplay(Element* element, bool isTrackingReplay, ExceptionCode& ec)
+void Internals::setElementTracksDisplayListReplay(Element& element, bool isTrackingReplay, ExceptionCode& ec)
 {
     Document* document = contextDocument();
     if (!document || !document->renderView()) {
@@ -2137,22 +1950,22 @@ void Internals::setElementTracksDisplayListReplay(Element* element, bool isTrack
         return;
     }
 
-    if (!element || !element->renderer()) {
+    if (!element.renderer()) {
         ec = INVALID_ACCESS_ERR;
         return;
     }
 
-    if (is<HTMLCanvasElement>(*element)) {
-        downcast<HTMLCanvasElement>(*element).setTracksDisplayListReplay(isTrackingReplay);
+    if (is<HTMLCanvasElement>(element)) {
+        downcast<HTMLCanvasElement>(element).setTracksDisplayListReplay(isTrackingReplay);
         return;
     }
 
-    if (!element->renderer()->hasLayer()) {
+    if (!element.renderer()->hasLayer()) {
         ec = INVALID_ACCESS_ERR;
         return;
     }
 
-    RenderLayer* layer = downcast<RenderLayerModelObject>(element->renderer())->layer();
+    RenderLayer* layer = downcast<RenderLayerModelObject>(element.renderer())->layer();
     if (!layer->isComposited()) {
         ec = INVALID_ACCESS_ERR;
         return;
@@ -2161,12 +1974,12 @@ void Internals::setElementTracksDisplayListReplay(Element* element, bool isTrack
     layer->backing()->setIsTrackingDisplayListReplay(isTrackingReplay);
 }
 
-String Internals::displayListForElement(Element* element, ExceptionCode& ec)
+String Internals::displayListForElement(Element& element, ExceptionCode& ec)
 {
     return displayListForElement(element, 0, ec);
 }
 
-String Internals::displayListForElement(Element* element, unsigned flags, ExceptionCode& ec)
+String Internals::displayListForElement(Element& element, unsigned flags, ExceptionCode& ec)
 {
     Document* document = contextDocument();
     if (!document || !document->renderView()) {
@@ -2174,7 +1987,7 @@ String Internals::displayListForElement(Element* element, unsigned flags, Except
         return String();
     }
 
-    if (!element || !element->renderer()) {
+    if (!element.renderer()) {
         ec = INVALID_ACCESS_ERR;
         return String();
     }
@@ -2183,15 +1996,15 @@ String Internals::displayListForElement(Element* element, unsigned flags, Except
     if (flags & DISPLAY_LIST_INCLUDES_PLATFORM_OPERATIONS)
         displayListFlags |= DisplayList::AsTextFlag::IncludesPlatformOperations;
 
-    if (is<HTMLCanvasElement>(*element))
-        return downcast<HTMLCanvasElement>(*element).displayListAsText(displayListFlags);
+    if (is<HTMLCanvasElement>(element))
+        return downcast<HTMLCanvasElement>(element).displayListAsText(displayListFlags);
 
-    if (!element->renderer()->hasLayer()) {
+    if (!element.renderer()->hasLayer()) {
         ec = INVALID_ACCESS_ERR;
         return String();
     }
 
-    RenderLayer* layer = downcast<RenderLayerModelObject>(element->renderer())->layer();
+    RenderLayer* layer = downcast<RenderLayerModelObject>(element.renderer())->layer();
     if (!layer->isComposited()) {
         ec = INVALID_ACCESS_ERR;
         return String();
@@ -2200,12 +2013,12 @@ String Internals::displayListForElement(Element* element, unsigned flags, Except
     return layer->backing()->displayListAsText(displayListFlags);
 }
 
-String Internals::replayDisplayListForElement(Element* element, ExceptionCode& ec)
+String Internals::replayDisplayListForElement(Element& element, ExceptionCode& ec)
 {
     return replayDisplayListForElement(element, 0, ec);
 }
 
-String Internals::replayDisplayListForElement(Element* element, unsigned flags, ExceptionCode& ec)
+String Internals::replayDisplayListForElement(Element& element, unsigned flags, ExceptionCode& ec)
 {
     Document* document = contextDocument();
     if (!document || !document->renderView()) {
@@ -2213,7 +2026,7 @@ String Internals::replayDisplayListForElement(Element* element, unsigned flags,
         return String();
     }
 
-    if (!element || !element->renderer()) {
+    if (!element.renderer()) {
         ec = INVALID_ACCESS_ERR;
         return String();
     }
@@ -2222,15 +2035,15 @@ String Internals::replayDisplayListForElement(Element* element, unsigned flags,
     if (flags & DISPLAY_LIST_INCLUDES_PLATFORM_OPERATIONS)
         displayListFlags |= DisplayList::AsTextFlag::IncludesPlatformOperations;
 
-    if (is<HTMLCanvasElement>(*element))
-        return downcast<HTMLCanvasElement>(*element).replayDisplayListAsText(displayListFlags);
+    if (is<HTMLCanvasElement>(element))
+        return downcast<HTMLCanvasElement>(element).replayDisplayListAsText(displayListFlags);
 
-    if (!element->renderer()->hasLayer()) {
+    if (!element.renderer()->hasLayer()) {
         ec = INVALID_ACCESS_ERR;
         return String();
     }
 
-    RenderLayer* layer = downcast<RenderLayerModelObject>(element->renderer())->layer();
+    RenderLayer* layer = downcast<RenderLayerModelObject>(element.renderer())->layer();
     if (!layer->isComposited()) {
         ec = INVALID_ACCESS_ERR;
         return String();
@@ -2277,20 +2090,14 @@ void Internals::insertUserCSS(const String& css, ExceptionCode& ec) const
     document->extensionStyleSheets().addUserStyleSheet(WTFMove(parsedSheet));
 }
 
-String Internals::counterValue(Element* element)
+String Internals::counterValue(Element& element)
 {
-    if (!element)
-        return String();
-
-    return counterValueForElement(element);
+    return counterValueForElement(&element);
 }
 
-int Internals::pageNumber(Element* element, float pageWidth, float pageHeight)
+int Internals::pageNumber(Element& element, float pageWidth, float pageHeight)
 {
-    if (!element)
-        return 0;
-
-    return PrintContext::pageNumberForElement(element, FloatSize(pageWidth, pageHeight));
+    return PrintContext::pageNumberForElement(&element, { pageWidth, pageHeight });
 }
 
 Vector<String> Internals::shortcutIconURLs() const
@@ -2432,36 +2239,36 @@ void Internals::setTopContentInset(float contentInset)
 }
 
 #if ENABLE(FULLSCREEN_API)
-void Internals::webkitWillEnterFullScreenForElement(Element* element)
+void Internals::webkitWillEnterFullScreenForElement(Element& element)
 {
     Document* document = contextDocument();
     if (!document)
         return;
-    document->webkitWillEnterFullScreenForElement(element);
+    document->webkitWillEnterFullScreenForElement(&element);
 }
 
-void Internals::webkitDidEnterFullScreenForElement(Element* element)
+void Internals::webkitDidEnterFullScreenForElement(Element& element)
 {
     Document* document = contextDocument();
     if (!document)
         return;
-    document->webkitDidEnterFullScreenForElement(element);
+    document->webkitDidEnterFullScreenForElement(&element);
 }
 
-void Internals::webkitWillExitFullScreenForElement(Element* element)
+void Internals::webkitWillExitFullScreenForElement(Element& element)
 {
     Document* document = contextDocument();
     if (!document)
         return;
-    document->webkitWillExitFullScreenForElement(element);
+    document->webkitWillExitFullScreenForElement(&element);
 }
 
-void Internals::webkitDidExitFullScreenForElement(Element* element)
+void Internals::webkitDidExitFullScreenForElement(Element& element)
 {
     Document* document = contextDocument();
     if (!document)
         return;
-    document->webkitDidExitFullScreenForElement(element);
+    document->webkitDidExitFullScreenForElement(&element);
 }
 #endif
 
@@ -2539,7 +2346,7 @@ void Internals::startTrackingLayerFlushes(ExceptionCode& ec)
     document->renderView()->compositor().startTrackingLayerFlushes();
 }
 
-unsigned long Internals::layerFlushCount(ExceptionCode& ec)
+unsigned Internals::layerFlushCount(ExceptionCode& ec)
 {
     Document* document = contextDocument();
     if (!document || !document->renderView()) {
@@ -2560,7 +2367,7 @@ void Internals::startTrackingStyleRecalcs(ExceptionCode& ec)
     document->startTrackingStyleRecalcs();
 }
 
-unsigned long Internals::styleRecalcCount(ExceptionCode& ec)
+unsigned Internals::styleRecalcCount(ExceptionCode& ec)
 {
     Document* document = contextDocument();
     if (!document) {
@@ -2582,7 +2389,7 @@ void Internals::startTrackingCompositingUpdates(ExceptionCode& ec)
     document->renderView()->compositor().startTrackingCompositingUpdates();
 }
 
-unsigned long Internals::compositingUpdateCount(ExceptionCode& ec)
+unsigned Internals::compositingUpdateCount(ExceptionCode& ec)
 {
     Document* document = contextDocument();
     if (!document || !document->renderView()) {
@@ -2722,10 +2529,10 @@ RefPtr<ArrayBuffer> Internals::serializeObject(PassRefPtr<SerializedScriptValue>
     return ArrayBuffer::create(bytes.data(), bytes.size());
 }
 
-RefPtr<SerializedScriptValue> Internals::deserializeBuffer(PassRefPtr<ArrayBuffer> buffer) const
+RefPtr<SerializedScriptValue> Internals::deserializeBuffer(ArrayBuffer& buffer) const
 {
     Vector<uint8_t> bytes;
-    bytes.append(static_cast<const uint8_t*>(buffer->data()), buffer->byteLength());
+    bytes.append(static_cast<const uint8_t*>(buffer.data()), buffer.byteLength());
     return SerializedScriptValue::adopt(WTFMove(bytes));
 }
 
@@ -2770,74 +2577,52 @@ void Internals::initializeMockCDM()
 }
 #endif
 
-String Internals::markerTextForListItem(Element* element, ExceptionCode& ec)
+String Internals::markerTextForListItem(Element& element)
 {
-    if (!element) {
-        ec = INVALID_ACCESS_ERR;
-        return String();
-    }
-    return WebCore::markerTextForListItem(element);
+    return WebCore::markerTextForListItem(&element);
 }
 
-String Internals::toolTipFromElement(Element* element, ExceptionCode& ec) const
+String Internals::toolTipFromElement(Element& element) const
 {
-    if (!element) {
-        ec = INVALID_ACCESS_ERR;
-        return String();
-    }
     HitTestResult result;
-    result.setInnerNode(element);
-    TextDirection dir;
-    return result.title(dir);
+    result.setInnerNode(&element);
+    TextDirection direction;
+    return result.title(direction);
 }
 
-String Internals::getImageSourceURL(Element* element, ExceptionCode& ec)
+String Internals::getImageSourceURL(Element& element)
 {
-    if (!element) {
-        ec = INVALID_ACCESS_ERR;
-        return String();
-    }
-    return element->imageSourceURL();
+    return element.imageSourceURL();
 }
 
 #if ENABLE(VIDEO)
-void Internals::simulateAudioInterruption(Node* node)
+
+void Internals::simulateAudioInterruption(HTMLMediaElement& element)
 {
 #if USE(GSTREAMER)
-    HTMLMediaElement* element = downcast<HTMLMediaElement>(node);
-    element->player()->simulateAudioInterruption();
+    element.player()->simulateAudioInterruption();
 #else
-    UNUSED_PARAM(node);
+    UNUSED_PARAM(element);
 #endif
 }
 
-bool Internals::mediaElementHasCharacteristic(Node* node, const String& characteristic, ExceptionCode& ec)
+bool Internals::mediaElementHasCharacteristic(HTMLMediaElement& element, const String& characteristic, ExceptionCode& ec)
 {
-    if (!is<HTMLMediaElement>(*node))
-        return false;
-
-    HTMLMediaElement* element = downcast<HTMLMediaElement>(node);
-
     if (equalLettersIgnoringASCIICase(characteristic, "audible"))
-        return element->hasAudio();
+        return element.hasAudio();
     if (equalLettersIgnoringASCIICase(characteristic, "visual"))
-        return element->hasVideo();
+        return element.hasVideo();
     if (equalLettersIgnoringASCIICase(characteristic, "legible"))
-        return element->hasClosedCaptions();
+        return element.hasClosedCaptions();
 
     ec = SYNTAX_ERR;
     return false;
 }
 #endif
 
-bool Internals::isSelectPopupVisible(Node* node)
+bool Internals::isSelectPopupVisible(HTMLSelectElement& element)
 {
-    if (!is<HTMLSelectElement>(*node))
-        return false;
-
-    HTMLSelectElement& select = downcast<HTMLSelectElement>(*node);
-
-    auto* renderer = select.renderer();
+    auto* renderer = element.renderer();
     ASSERT(renderer);
     if (!is<RenderMenuList>(*renderer))
         return false;
@@ -2846,7 +2631,7 @@ bool Internals::isSelectPopupVisible(Node* node)
     return downcast<RenderMenuList>(*renderer).popupIsVisible();
 #else
     return false;
-#endif // !PLATFORM(IOS)
+#endif
 }
 
 String Internals::captionsStyleSheetOverride(ExceptionCode& ec)
@@ -2933,9 +2718,9 @@ Ref<TimeRanges> Internals::createTimeRanges(Float32Array* startTimes, Float32Arr
     return ranges;
 }
 
-double Internals::closestTimeToTimeRanges(double time, TimeRanges* ranges)
+double Internals::closestTimeToTimeRanges(double time, TimeRanges& ranges)
 {
-    return ranges->nearest(time);
+    return ranges.nearest(time);
 }
 #endif
 
@@ -2960,14 +2745,9 @@ bool Internals::isVibrating()
 }
 #endif
 
-bool Internals::isPluginUnavailabilityIndicatorObscured(Element* element, ExceptionCode& ec)
+bool Internals::isPluginUnavailabilityIndicatorObscured(Element& element, ExceptionCode& ec)
 {
-    if (!element) {
-        ec = INVALID_ACCESS_ERR;
-        return false;
-    }
-
-    auto* renderer = element->renderer();
+    auto* renderer = element.renderer();
     if (!is<RenderEmbeddedObject>(renderer)) {
         ec = INVALID_ACCESS_ERR;
         return false;
@@ -2976,17 +2756,13 @@ bool Internals::isPluginUnavailabilityIndicatorObscured(Element* element, Except
     return downcast<RenderEmbeddedObject>(*renderer).isReplacementObscured();
 }
     
-bool Internals::isPluginSnapshotted(Element* element, ExceptionCode& ec)
+bool Internals::isPluginSnapshotted(Element& element)
 {
-    if (!element) {
-        ec = INVALID_ACCESS_ERR;
-        return false;
-    }
-    HTMLPlugInElement* pluginElement = downcast<HTMLPlugInElement>(element);
-    return pluginElement->displayState() <= HTMLPlugInElement::DisplayingSnapshot;
+    return is<HTMLPlugInElement>(element) && downcast<HTMLPlugInElement>(element).displayState() <= HTMLPlugInElement::DisplayingSnapshot;
 }
     
 #if ENABLE(MEDIA_SOURCE)
+
 void Internals::initializeMockMediaSource()
 {
 #if USE(AVFOUNDATION)
@@ -2995,22 +2771,20 @@ void Internals::initializeMockMediaSource()
     MediaPlayerFactorySupport::callRegisterMediaEngine(MockMediaPlayerMediaSource::registerMediaEngine);
 }
 
-Vector<String> Internals::bufferedSamplesForTrackID(SourceBuffer* buffer, const AtomicString& trackID)
+Vector<String> Internals::bufferedSamplesForTrackID(SourceBuffer& buffer, const AtomicString& trackID)
 {
-    if (!buffer)
-        return Vector<String>();
-
-    return buffer->bufferedSamplesForTrackID(trackID);
+    return buffer.bufferedSamplesForTrackID(trackID);
 }
     
-void Internals::setShouldGenerateTimestamps(SourceBuffer* buffer, bool flag)
+void Internals::setShouldGenerateTimestamps(SourceBuffer& buffer, bool flag)
 {
-    if (buffer)
-        buffer->setShouldGenerateTimestamps(flag);
+    buffer.setShouldGenerateTimestamps(flag);
 }
+
 #endif
 
 #if ENABLE(VIDEO)
+
 void Internals::beginMediaSessionInterruption(const String& interruptionString, ExceptionCode& ec)
 {
     PlatformMediaSession::InterruptionType interruption = PlatformMediaSession::SystemInterruption;
@@ -3083,15 +2857,10 @@ void Internals::setMediaSessionRestrictions(const String& mediaTypeString, const
     PlatformMediaSessionManager::sharedManager().addRestriction(mediaType, restrictions);
 }
 
-void Internals::setMediaElementRestrictions(HTMLMediaElement* element, const String& restrictionsString, ExceptionCode& ec)
+void Internals::setMediaElementRestrictions(HTMLMediaElement& element, const String& restrictionsString)
 {
-    if (!element) {
-        ec = INVALID_ACCESS_ERR;
-        return;
-    }
-
-    MediaElementSession::BehaviorRestrictions restrictions = element->mediaSession().behaviorRestrictions();
-    element->mediaSession().removeBehaviorRestriction(restrictions);
+    MediaElementSession::BehaviorRestrictions restrictions = element.mediaSession().behaviorRestrictions();
+    element.mediaSession().removeBehaviorRestriction(restrictions);
 
     restrictions = MediaElementSession::NoRestrictions;
 
@@ -3127,7 +2896,7 @@ void Internals::setMediaElementRestrictions(HTMLMediaElement* element, const Str
         if (equalLettersIgnoringASCIICase(restrictionString, "overrideusergesturerequirementformaincontent"))
             restrictions |= MediaElementSession::OverrideUserGestureRequirementForMainContent;
     }
-    element->mediaSession().addBehaviorRestriction(restrictions);
+    element.mediaSession().addBehaviorRestriction(restrictions);
 }
 
 void Internals::postRemoteControlCommand(const String& commandString, ExceptionCode& ec)
@@ -3158,15 +2927,15 @@ void Internals::postRemoteControlCommand(const String& commandString, ExceptionC
     PlatformMediaSessionManager::sharedManager().didReceiveRemoteControlCommand(command);
 }
 
-bool Internals::elementIsBlockingDisplaySleep(Element* element) const
+bool Internals::elementIsBlockingDisplaySleep(HTMLMediaElement& element) const
 {
-    HTMLMediaElement* mediaElement = downcast<HTMLMediaElement>(element);
-    return mediaElement ? mediaElement->isDisablingSleep() : false;
+    return element.isDisablingSleep();
 }
 
 #endif // ENABLE(VIDEO)
 
 #if ENABLE(MEDIA_SESSION)
+
 static MediaSessionInterruptingCategory interruptingCategoryFromString(const String& interruptingCategoryString)
 {
     if (interruptingCategoryString == "content")
@@ -3218,18 +2987,15 @@ void Internals::sendMediaControlEvent(const String& event)
     else
         ASSERT_NOT_REACHED();
 }
+
 #endif // ENABLE(MEDIA_SESSION)
 
 #if ENABLE(WEB_AUDIO)
-void Internals::setAudioContextRestrictions(AudioContext* context, const String &restrictionsString, ExceptionCode &ec)
-{
-    if (!context) {
-        ec = INVALID_ACCESS_ERR;
-        return;
-    }
 
-    AudioContext::BehaviorRestrictions restrictions = context->behaviorRestrictions();
-    context->removeBehaviorRestriction(restrictions);
+void Internals::setAudioContextRestrictions(AudioContext& context, const String& restrictionsString)
+{
+    AudioContext::BehaviorRestrictions restrictions = context.behaviorRestrictions();
+    context.removeBehaviorRestriction(restrictions);
 
     restrictions = AudioContext::NoRestrictions;
 
@@ -3243,8 +3009,9 @@ void Internals::setAudioContextRestrictions(AudioContext* context, const String
         if (equalLettersIgnoringASCIICase(restrictionString, "requirepageconsentforaudiostart"))
             restrictions |= AudioContext::RequirePageConsentForAudioStartRestriction;
     }
-    context->addBehaviorRestriction(restrictions);
+    context.addBehaviorRestriction(restrictions);
 }
+
 #endif
 
 void Internals::simulateSystemSleep() const
@@ -3262,6 +3029,7 @@ void Internals::simulateSystemWake() const
 }
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
+
 void Internals::setMockMediaPlaybackTargetPickerEnabled(bool enabled)
 {
     Page* page = contextDocument()->frame()->page();
@@ -3290,6 +3058,7 @@ void Internals::setMockMediaPlaybackTargetPickerState(const String& deviceName,
 
     page->setMockMediaPlaybackTargetPickerState(deviceName, state);
 }
+
 #endif
 
 RefPtr<MockPageOverlay> Internals::installMockPageOverlay(const String& overlayType, ExceptionCode& ec)
@@ -3371,13 +3140,16 @@ void Internals::queueMicroTask(int testNumber)
 }
 
 #if ENABLE(CONTENT_FILTERING)
+
 MockContentFilterSettings& Internals::mockContentFilterSettings()
 {
     return MockContentFilterSettings::singleton();
 }
+
 #endif
 
 #if ENABLE(CSS_SCROLL_SNAP)
+
 static void appendOffsets(StringBuilder& builder, const Vector<LayoutUnit>& snapOffsets)
 {
     bool justStarting = true;
@@ -3394,17 +3166,12 @@ static void appendOffsets(StringBuilder& builder, const Vector<LayoutUnit>& snap
     builder.append(" }");
 }
     
-String Internals::scrollSnapOffsets(Element* element, ExceptionCode& ec)
+String Internals::scrollSnapOffsets(Element& element, ExceptionCode& ec)
 {
-    if (!element) {
-        ec = INVALID_ACCESS_ERR;
+    if (!element.renderBox())
         return String();
-    }
 
-    if (!element->renderBox())
-        return String();
-
-    RenderBox& box = *element->renderBox();
+    RenderBox& box = *element.renderBox();
     ScrollableArea* scrollableArea;
     
     if (box.isBody()) {
@@ -3429,20 +3196,21 @@ String Internals::scrollSnapOffsets(Element* element, ExceptionCode& ec)
     StringBuilder result;
 
     if (scrollableArea->horizontalSnapOffsets()) {
-        result.append("horizontal = ");
+        result.appendLiteral("horizontal = ");
         appendOffsets(result, *scrollableArea->horizontalSnapOffsets());
     }
 
     if (scrollableArea->verticalSnapOffsets()) {
         if (result.length())
-            result.append(", ");
+            result.appendLiteral(", ");
 
-        result.append("vertical = ");
+        result.appendLiteral("vertical = ");
         appendOffsets(result, *scrollableArea->verticalSnapOffsets());
     }
 
     return result.toString();
 }
+
 #endif
 
 bool Internals::testPreloaderSettingViewport()
@@ -3478,25 +3246,24 @@ String Internals::pathStringWithShrinkWrappedRects(Vector<double> rectComponents
 }
 
 
-String Internals::getCurrentMediaControlsStatusForElement(HTMLMediaElement* mediaElement)
+String Internals::getCurrentMediaControlsStatusForElement(HTMLMediaElement& mediaElement)
 {
 #if !ENABLE(MEDIA_CONTROLS_SCRIPT)
     UNUSED_PARAM(mediaElement);
     return String();
 #else
-    if (!mediaElement)
-        return String();
-
-    return mediaElement->getCurrentMediaControlsStatus();
+    return mediaElement.getCurrentMediaControlsStatus();
 #endif
 }
 
 #if !PLATFORM(COCOA)
-String Internals::userVisibleString(const DOMURL*)
+
+String Internals::userVisibleString(const DOMURL&)
 {
-    // Not implemented in WebCore.
+    // Cocoa-specific function. Could ASSERT_NOT_REACHED, but that's probably overkill.
     return String();
 }
+
 #endif
 
 void Internals::setShowAllPlugins(bool show)
@@ -3513,6 +3280,7 @@ void Internals::setShowAllPlugins(bool show)
 }
 
 #if ENABLE(STREAMS_API)
+
 bool Internals::isReadableStreamDisturbed(ScriptState& state, JSValue stream)
 {
     JSGlobalObject* globalObject = state.vmEntryGlobalObject();
@@ -3535,6 +3303,7 @@ bool Internals::isReadableStreamDisturbed(ScriptState& state, JSValue stream)
 
     return returnedValue.asBoolean();
 }
+
 #endif
 
 String Internals::resourceLoadStatisticsForOrigin(String origin)
@@ -3547,11 +3316,11 @@ void Internals::setResourceLoadStatisticsEnabled(bool enable)
     Settings::setResourceLoadStatisticsEnabled(enable);
 }
 
-String Internals::composedTreeAsText(Node* node)
+String Internals::composedTreeAsText(Node& node)
 {
     if (!is<ContainerNode>(node))
-        return "";
-    return WebCore::composedTreeAsText(downcast<ContainerNode>(*node));
+        return emptyString();
+    return WebCore::composedTreeAsText(downcast<ContainerNode>(node));
 }
 
 void Internals::setViewportForceAlwaysUserScalable(bool scalable)
index f4dcf18..523870b 100644 (file)
@@ -52,12 +52,17 @@ class Document;
 class Element;
 class File;
 class Frame;
+class HTMLImageElement;
+class HTMLInputElement;
+class HTMLLinkElement;
 class HTMLMediaElement;
+class HTMLSelectElement;
 class InspectorStubFrontend;
 class InternalSettings;
 class MallocStatistics;
 class MediaSession;
 class MemoryInfo;
+class MockContentFilterSettings;
 class MockPageOverlay;
 class Node;
 class Page;
@@ -70,33 +75,28 @@ class TimeRanges;
 class TypeConversions;
 class XMLHttpRequest;
 
-#if ENABLE(CONTENT_FILTERING)
-class MockContentFilterSettings;
-#endif
-
 typedef int ExceptionCode;
 
-class Internals : public RefCounted<Internals>
-                , public ContextDestructionObserver {
+class Internals : public RefCounted<Internals>, public ContextDestructionObserver {
 public:
-    static Ref<Internals> create(Document*);
+    static Ref<Internals> create(Document&);
     virtual ~Internals();
 
-    static void resetToConsistentState(Page*);
+    static void resetToConsistentState(Page&);
 
-    String elementRenderTreeAsText(Element*, ExceptionCode&);
-    bool hasPausedImageAnimations(Element*, ExceptionCode&);
+    String elementRenderTreeAsText(Element&, ExceptionCode&);
+    bool hasPausedImageAnimations(Element&);
 
-    String address(Node*);
-    bool nodeNeedsStyleRecalc(Node*, ExceptionCode&);
-    String styleChangeType(Node*, ExceptionCode&);
+    String address(Node&);
+    bool nodeNeedsStyleRecalc(Node&);
+    String styleChangeType(Node&);
     String description(Deprecated::ScriptValue);
 
     bool isPreloaded(const String& url);
     bool isLoadingFromMemoryCache(const String& url);
-    String xhrResponseSource(XMLHttpRequest*);
-    bool isSharingStyleSheetContents(Element* linkA, Element* linkB);
-    bool isStyleSheetLoadingSubresources(Element* link);
+    String xhrResponseSource(XMLHttpRequest&);
+    bool isSharingStyleSheetContents(HTMLLinkElement& a, HTMLLinkElement& b);
+    bool isStyleSheetLoadingSubresources(HTMLLinkElement&);
     void setOverrideCachePolicy(const String&);
     void setCanShowModalDialogOverride(bool allow, ExceptionCode&);
     void setOverrideResourceLoadPriority(const String&);
@@ -106,21 +106,20 @@ public:
     void pruneMemoryCacheToSize(unsigned size);
     unsigned memoryCacheSize() const;
 
-    size_t imageFrameIndex(Element*, ExceptionCode&);
+    unsigned imageFrameIndex(HTMLImageElement&);
 
     void clearPageCache();
     unsigned pageCacheSize() const;
 
-    RefPtr<CSSComputedStyleDeclaration> computedStyleIncludingVisitedInfo(Node*, ExceptionCode&) const;
+    RefPtr<CSSComputedStyleDeclaration> computedStyleIncludingVisitedInfo(Node&) const;
 
-    Node* ensureShadowRoot(Element* host, ExceptionCode&);
-    Node* ensureUserAgentShadowRoot(Element* host, ExceptionCode&);
-    Node* createShadowRoot(Element* host, ExceptionCode&);
-    Node* shadowRoot(Element* host, ExceptionCode&);
-    String shadowRootType(const Node*, ExceptionCode&) const;
-    Element* includerFor(Node*, ExceptionCode&);
-    String shadowPseudoId(Element*, ExceptionCode&);
-    void setShadowPseudoId(Element*, const String&, ExceptionCode&);
+    Node* ensureShadowRoot(Element& host, ExceptionCode&);
+    Node* ensureUserAgentShadowRoot(Element& host);
+    Node* createShadowRoot(Element& host, ExceptionCode&);
+    Node* shadowRoot(Element& host);
+    String shadowRootType(const Node&, ExceptionCode&) const;
+    String shadowPseudoId(Element&);
+    void setShadowPseudoId(Element&, const String&);
 
     // DOMTimers throttling testing.
     bool isTimerThrottled(int timeoutId, ExceptionCode&);
@@ -135,40 +134,38 @@ public:
     bool animationsAreSuspended(ExceptionCode&) const;
     void suspendAnimations(ExceptionCode&) const;
     void resumeAnimations(ExceptionCode&) const;
-    bool pauseAnimationAtTimeOnElement(const String& animationName, double pauseTime, Element*, ExceptionCode&);
-    bool pauseAnimationAtTimeOnPseudoElement(const String& animationName, double pauseTime, Element*, const String& pseudoId, ExceptionCode&);
+    bool pauseAnimationAtTimeOnElement(const String& animationName, double pauseTime, Element&, ExceptionCode&);
+    bool pauseAnimationAtTimeOnPseudoElement(const String& animationName, double pauseTime, Element&, const String& pseudoId, ExceptionCode&);
 
     // CSS Transition testing.
-    bool pauseTransitionAtTimeOnElement(const String& propertyName, double pauseTime, Element*, ExceptionCode&);
-    bool pauseTransitionAtTimeOnPseudoElement(const String& property, double pauseTime, Element*, const String& pseudoId, ExceptionCode&);
-
-    Node* treeScopeRootNode(Node*, ExceptionCode&);
-    Node* parentTreeScope(Node*, ExceptionCode&);
+    bool pauseTransitionAtTimeOnElement(const String& propertyName, double pauseTime, Element&, ExceptionCode&);
+    bool pauseTransitionAtTimeOnPseudoElement(const String& property, double pauseTime, Element&, const String& pseudoId, ExceptionCode&);
 
-    bool attached(Node*, ExceptionCode&);
+    Node* treeScopeRootNode(Node&);
+    Node* parentTreeScope(Node&);
 
-    String visiblePlaceholder(Element*);
-    void selectColorInColorChooser(Element*, const String& colorValue);
+    String visiblePlaceholder(Element&);
+    void selectColorInColorChooser(HTMLInputElement&, const String& colorValue);
     Vector<String> formControlStateOfPreviousHistoryItem(ExceptionCode&);
     void setFormControlStateOfPreviousHistoryItem(const Vector<String>&, ExceptionCode&);
 
     Ref<ClientRect> absoluteCaretBounds(ExceptionCode&);
 
-    Ref<ClientRect> boundingBox(Element*, ExceptionCode&);
+    Ref<ClientRect> boundingBox(Element&);
 
     Ref<ClientRectList> inspectorHighlightRects(ExceptionCode&);
     String inspectorHighlightObject(ExceptionCode&);
 
-    unsigned markerCountForNode(Node*, const String&, ExceptionCode&);
-    RefPtr<Range> markerRangeForNode(Node*, const String& markerType, unsigned index, ExceptionCode&);
-    String markerDescriptionForNode(Node*, const String& markerType, unsigned index, ExceptionCode&);
+    unsigned markerCountForNode(Node&, const String&, ExceptionCode&);
+    RefPtr<Range> markerRangeForNode(Node&, const String& markerType, unsigned index, ExceptionCode&);
+    String markerDescriptionForNode(Node&, const String& markerType, unsigned index, ExceptionCode&);
     String dumpMarkerRects(const String& markerType, ExceptionCode&);
-    void addTextMatchMarker(const Range*, bool isActive);
+    void addTextMatchMarker(const Range&, bool isActive);
     void setMarkedTextMatchesAreHighlighted(bool, ExceptionCode&);
 
     void invalidateFontCache();
 
-    void setScrollViewPosition(long x, long y, ExceptionCode&);
+    void setScrollViewPosition(int x, int y, ExceptionCode&);
     void setViewBaseBackgroundColor(const String& colorValue, ExceptionCode&);
 
     void setPagination(const String& mode, int gap, ExceptionCode& ec) { setPagination(mode, gap, 0, ec); }
@@ -176,22 +173,22 @@ public:
     void setPaginationLineGridEnabled(bool, ExceptionCode&);
     String configurationForViewport(float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode&);
 
-    bool wasLastChangeUserEdit(Element* textField, ExceptionCode&);
-    bool elementShouldAutoComplete(Element* inputElement, ExceptionCode&);
-    void setEditingValue(Element* inputElement, const String&, ExceptionCode&);
-    void setAutofilled(Element*, bool enabled, ExceptionCode&);
-    void setShowAutoFillButton(Element*, const String& autoFillButtonType, ExceptionCode&);
-    void scrollElementToRect(Element*, long x, long y, long w, long h, ExceptionCode&);
+    bool wasLastChangeUserEdit(Element& textField, ExceptionCode&);
+    bool elementShouldAutoComplete(HTMLInputElement&);
+    void setEditingValue(HTMLInputElement&, const String&);
+    void setAutofilled(HTMLInputElement&, bool enabled);
+    void setShowAutoFillButton(HTMLInputElement&, const String& autoFillButtonType);
+    void scrollElementToRect(Element&, int x, int y, int w, int h, ExceptionCode&);
 
-    String autofillFieldName(Element*, ExceptionCode&);
+    String autofillFieldName(Element&, ExceptionCode&);
 
     void paintControlTints(ExceptionCode&);
 
-    RefPtr<Range> rangeFromLocationAndLength(Element* scope, int rangeLocation, int rangeLength, ExceptionCode&);
-    unsigned locationFromRange(Element* scope, const Range*, ExceptionCode&);
-    unsigned lengthFromRange(Element* scope, const Range*, ExceptionCode&);
-    String rangeAsText(const Range*, ExceptionCode&);
-    RefPtr<Range> subrange(Range*, int rangeLocation, int rangeLength, ExceptionCode&);
+    RefPtr<Range> rangeFromLocationAndLength(Element& scope, int rangeLocation, int rangeLength);
+    unsigned locationFromRange(Element& scope, const Range&);
+    unsigned lengthFromRange(Element& scope, const Range&);
+    String rangeAsText(const Range&);
+    RefPtr<Range> subrange(Range&, int rangeLocation, int rangeLength);
     RefPtr<Range> rangeForDictionaryLookupAtLocation(int x, int y, ExceptionCode&);
 
     void setDelegatesScrolling(bool enabled, ExceptionCode&);
@@ -208,7 +205,7 @@ public:
     unsigned wheelEventHandlerCount(ExceptionCode&);
     unsigned touchEventHandlerCount(ExceptionCode&);
 
-    RefPtr<NodeList> nodesFromRect(Document*, int x, int y, unsigned topPadding, unsigned rightPadding,
+    RefPtr<NodeList> nodesFromRect(Document&, int x, int y, unsigned topPadding, unsigned rightPadding,
         unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent, ExceptionCode&) const;
 
     String parserMetaData(Deprecated::ScriptValue = Deprecated::ScriptValue());
@@ -253,25 +250,25 @@ public:
         LAYER_TREE_INCLUDES_PAINTING_PHASES = 8,
         LAYER_TREE_INCLUDES_CONTENT_LAYERS = 16
     };
-    String layerTreeAsText(Document*, unsigned flags, ExceptionCode&) const;
-    String layerTreeAsText(Document*, ExceptionCode&) const;
+    String layerTreeAsText(Document&, unsigned flags, ExceptionCode&) const;
+    String layerTreeAsText(Document&, ExceptionCode&) const;
     String repaintRectsAsText(ExceptionCode&) const;
     String scrollingStateTreeAsText(ExceptionCode&) const;
     String mainThreadScrollingReasons(ExceptionCode&) const;
     RefPtr<ClientRectList> nonFastScrollableRects(ExceptionCode&) const;
 
-    void setElementUsesDisplayListDrawing(Element*, bool usesDisplayListDrawing, ExceptionCode&);
-    void setElementTracksDisplayListReplay(Element*, bool isTrackingReplay, ExceptionCode&);
+    void setElementUsesDisplayListDrawing(Element&, bool usesDisplayListDrawing, ExceptionCode&);
+    void setElementTracksDisplayListReplay(Element&, bool isTrackingReplay, ExceptionCode&);
 
     enum {
         // Values need to be kept in sync with Internals.idl.
         DISPLAY_LIST_INCLUDES_PLATFORM_OPERATIONS = 1,
     };
-    String displayListForElement(Element*, unsigned flags, ExceptionCode&);
-    String displayListForElement(Element*, ExceptionCode&);
+    String displayListForElement(Element&, unsigned flags, ExceptionCode&);
+    String displayListForElement(Element&, ExceptionCode&);
 
-    String replayDisplayListForElement(Element*, unsigned flags, ExceptionCode&);
-    String replayDisplayListForElement(Element*, ExceptionCode&);
+    String replayDisplayListForElement(Element&, unsigned flags, ExceptionCode&);
+    String replayDisplayListForElement(Element&, ExceptionCode&);
 
     void garbageCollectDocumentResources(ExceptionCode&) const;
 
@@ -288,9 +285,9 @@ public:
     void setLegacyJavaScriptProfilingEnabled(bool enabled, ExceptionCode&);
     void setInspectorIsUnderTest(bool isUnderTest, ExceptionCode&);
 
-    String counterValue(Element*);
+    String counterValue(Element&);
 
-    int pageNumber(Element*, float pageWidth = 800, float pageHeight = 600);
+    int pageNumber(Element&, float pageWidth = 800, float pageHeight = 600);
     Vector<String> shortcutIconURLs() const;
 
     int numberOfPages(float pageWidthInPixels = 800, float pageHeightInPixels = 600);
@@ -311,10 +308,10 @@ public:
     void setTopContentInset(float);
 
 #if ENABLE(FULLSCREEN_API)
-    void webkitWillEnterFullScreenForElement(Element*);
-    void webkitDidEnterFullScreenForElement(Element*);
-    void webkitWillExitFullScreenForElement(Element*);
-    void webkitDidExitFullScreenForElement(Element*);
+    void webkitWillEnterFullScreenForElement(Element&);
+    void webkitDidEnterFullScreenForElement(Element&);
+    void webkitWillExitFullScreenForElement(Element&);
+    void webkitDidExitFullScreenForElement(Element&);
 #endif
 
     WEBCORE_TESTSUPPORT_EXPORT void setApplicationCacheOriginQuota(unsigned long long);
@@ -332,20 +329,20 @@ public:
     void stopTrackingRepaints(ExceptionCode&);
 
     void startTrackingLayerFlushes(ExceptionCode&);
-    unsigned long layerFlushCount(ExceptionCode&);
+    unsigned layerFlushCount(ExceptionCode&);
     
     void startTrackingStyleRecalcs(ExceptionCode&);
-    unsigned long styleRecalcCount(ExceptionCode&);
+    unsigned styleRecalcCount(ExceptionCode&);
 
     void startTrackingCompositingUpdates(ExceptionCode&);
-    unsigned long compositingUpdateCount(ExceptionCode&);
+    unsigned compositingUpdateCount(ExceptionCode&);
 
     void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(ExceptionCode&);
     void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(Node*, ExceptionCode&);
     unsigned layoutCount() const;
 
     RefPtr<ArrayBuffer> serializeObject(PassRefPtr<SerializedScriptValue>) const;
-    RefPtr<SerializedScriptValue> deserializeBuffer(PassRefPtr<ArrayBuffer>) const;
+    RefPtr<SerializedScriptValue> deserializeBuffer(ArrayBuffer&) const;
 
     bool isFromCurrentWorld(Deprecated::ScriptValue) const;
 
@@ -354,9 +351,9 @@ public:
 
     String getCurrentCursorInfo(ExceptionCode&);
 
-    String markerTextForListItem(Element*, ExceptionCode&);
+    String markerTextForListItem(Element&);
 
-    String toolTipFromElement(Element*, ExceptionCode&) const;
+    String toolTipFromElement(Element&) const;
 
     void forceReload(bool endToEnd);
 
@@ -379,14 +376,14 @@ public:
     void enableMockRTCPeerConnectionHandler();
 #endif
 
-    String getImageSourceURL(Element*, ExceptionCode&);
+    String getImageSourceURL(Element&);
 
 #if ENABLE(VIDEO)
-    void simulateAudioInterruption(Node*);
-    bool mediaElementHasCharacteristic(Node*, const String&, ExceptionCode&);
+    void simulateAudioInterruption(HTMLMediaElement&);
+    bool mediaElementHasCharacteristic(HTMLMediaElement&, const String&, ExceptionCode&);
 #endif
 
-    bool isSelectPopupVisible(Node*);
+    bool isSelectPopupVisible(HTMLSelectElement&);
 
     String captionsStyleSheetOverride(ExceptionCode&);
     void setCaptionsStyleSheetOverride(const String&, ExceptionCode&);
@@ -395,7 +392,7 @@ public:
 
 #if ENABLE(VIDEO)
     Ref<TimeRanges> createTimeRanges(Float32Array* startTimes, Float32Array* endTimes);
-    double closestTimeToTimeRanges(double time, TimeRanges*);
+    double closestTimeToTimeRanges(double time, TimeRanges&);
 #endif
 
     Ref<ClientRect> selectionBounds(ExceptionCode&);
@@ -404,13 +401,13 @@ public:
     bool isVibrating();
 #endif
 
-    bool isPluginUnavailabilityIndicatorObscured(Element*, ExceptionCode&);
-    bool isPluginSnapshotted(Element*, ExceptionCode&);
+    bool isPluginUnavailabilityIndicatorObscured(Element&, ExceptionCode&);
+    bool isPluginSnapshotted(Element&);
 
 #if ENABLE(MEDIA_SOURCE)
     WEBCORE_TESTSUPPORT_EXPORT void initializeMockMediaSource();
-    Vector<String> bufferedSamplesForTrackID(SourceBuffer*, const AtomicString&);
-    void setShouldGenerateTimestamps(SourceBuffer*, bool);
+    Vector<String> bufferedSamplesForTrackID(SourceBuffer&, const AtomicString&);
+    void setShouldGenerateTimestamps(SourceBuffer&, bool);
 #endif
 
 #if ENABLE(VIDEO)
@@ -419,16 +416,16 @@ public:
     void applicationDidEnterForeground() const;
     void applicationWillEnterBackground() const;
     void setMediaSessionRestrictions(const String& mediaType, const String& restrictions, ExceptionCode&);
-    void setMediaElementRestrictions(HTMLMediaElement*, const String& restrictions, ExceptionCode&);
+    void setMediaElementRestrictions(HTMLMediaElement&, const String& restrictions);
     void postRemoteControlCommand(const String&, ExceptionCode&);
-    bool elementIsBlockingDisplaySleep(Element*) const;
+    bool elementIsBlockingDisplaySleep(HTMLMediaElement&) const;
 #endif
 
 #if ENABLE(MEDIA_SESSION)
     void sendMediaSessionStartOfInterruptionNotification(const String&);
     void sendMediaSessionEndOfInterruptionNotification(const String&);
-    String mediaSessionCurrentState(MediaSession*) const;
-    double mediaElementPlayerVolume(HTMLMediaElement*) const;
+    String mediaSessionCurrentState(MediaSession&) const;
+    double mediaElementPlayerVolume(HTMLMediaElement&) const;
     void sendMediaControlEvent(const String&);
 #endif
 
@@ -438,7 +435,7 @@ public:
 #endif
 
 #if ENABLE(WEB_AUDIO)
-    void setAudioContextRestrictions(AudioContext*, const String& restrictions, ExceptionCode&);
+    void setAudioContextRestrictions(AudioContext&, const String& restrictions);
 #endif
 
     void simulateSystemSleep() const;
@@ -461,14 +458,14 @@ public:
 #endif
 
 #if ENABLE(CSS_SCROLL_SNAP)
-    String scrollSnapOffsets(Element*, ExceptionCode&);
+    String scrollSnapOffsets(Element&, ExceptionCode&);
 #endif
 
     String pathStringWithShrinkWrappedRects(Vector<double> rectComponents, double radius, ExceptionCode&);
 
-    String getCurrentMediaControlsStatusForElement(HTMLMediaElement*);
+    String getCurrentMediaControlsStatusForElement(HTMLMediaElement&);
 
-    String userVisibleString(const DOMURL*);
+    String userVisibleString(const DOMURL&);
     void setShowAllPlugins(bool);
 
     String resourceLoadStatisticsForOrigin(String origin);
@@ -478,16 +475,16 @@ public:
     bool isReadableStreamDisturbed(ScriptState&, JSC::JSValue);
 #endif
 
-    String composedTreeAsText(Node*);
+    String composedTreeAsText(Node&);
     
     void setViewportForceAlwaysUserScalable(bool);
 
 private:
-    explicit Internals(Document*);
+    explicit Internals(Document&);
     Document* contextDocument() const;
     Frame* frame() const;
 
-    RenderedDocumentMarker* markerAt(Node*, const String& markerType, unsigned index, ExceptionCode&);
+    RenderedDocumentMarker* markerAt(Node&, const String& markerType, unsigned index, ExceptionCode&);
 
     std::unique_ptr<InspectorStubFrontend> m_inspectorFrontend;
 };
index 6d536b4..b85de45 100644 (file)
@@ -25,8 +25,8 @@
  */
 
 enum PageOverlayType {
-"view",
-"document"
+    "view",
+    "document"
 };
 
 // These map to ResourceRequestCachePolicy.
@@ -64,24 +64,23 @@ enum AutoFillButtonType {
 };
 
 [
-    UsePointersEvenForNonNullableObjectArguments,
-    NoInterfaceObject,
     ExportMacro=WEBCORE_TESTSUPPORT_EXPORT,
+    NoInterfaceObject,
 ] interface Internals {
     DOMString address(Node node);
-    [RaisesException] boolean nodeNeedsStyleRecalc(Node node);
-    [RaisesException] DOMString styleChangeType(Node node);
+    boolean nodeNeedsStyleRecalc(Node node);
+    DOMString styleChangeType(Node node);
     DOMString description(any value);
 
     // Animated image pausing testing.
-    [RaisesException] boolean hasPausedImageAnimations(Element element);
+    boolean hasPausedImageAnimations(Element element);
 
     [RaisesException] DOMString elementRenderTreeAsText(Element element);
     boolean isPreloaded(DOMString url);
     boolean isLoadingFromMemoryCache(DOMString url);
     DOMString xhrResponseSource(XMLHttpRequest xhr);
-    boolean isSharingStyleSheetContents(Element linkA, Element linkB);
-    boolean isStyleSheetLoadingSubresources(Element link);
+    boolean isSharingStyleSheetContents(HTMLLinkElement a, HTMLLinkElement b);
+    boolean isStyleSheetLoadingSubresources(HTMLLinkElement link);
     void clearMemoryCache();
     void pruneMemoryCacheToSize(long size);
     long memoryCacheSize();
@@ -90,21 +89,20 @@ enum AutoFillButtonType {
     void setStrictRawResourceValidationPolicyDisabled(boolean disabled);
 
     void clearPageCache();
-    unsigned int pageCacheSize();
+    unsigned long pageCacheSize();
 
-    [RaisesException] CSSStyleDeclaration computedStyleIncludingVisitedInfo(Node node);
+    CSSStyleDeclaration computedStyleIncludingVisitedInfo(Node node);
 
     [RaisesException] Node ensureShadowRoot(Element host);
-    [RaisesException] Node ensureUserAgentShadowRoot(Element host);
+    Node ensureUserAgentShadowRoot(Element host);
     [RaisesException] Node createShadowRoot(Element host);
-    [RaisesException] Node shadowRoot(Element host);
+    Node shadowRoot(Element host);
 
     [RaisesException] DOMString shadowRootType(Node root);
-    [RaisesException] Element includerFor(Node node);
-    [RaisesException] DOMString shadowPseudoId(Element element);
-    [RaisesException] void setShadowPseudoId(Element element, DOMString id);
-    [RaisesException] Node treeScopeRootNode(Node node);
-    [RaisesException] Node parentTreeScope(Node node);
+    DOMString shadowPseudoId(Element element);
+    void setShadowPseudoId(Element element, DOMString id);
+    Node treeScopeRootNode(Node node);
+    Node parentTreeScope(Node node);
 
     // Spatial Navigation testing
     [RaisesException] unsigned long lastSpatialNavigationCandidateCount();
@@ -121,16 +119,14 @@ enum AutoFillButtonType {
     [RaisesException] boolean pauseTransitionAtTimeOnElement(DOMString propertyName, unrestricted double pauseTime, Element element);
     [RaisesException] boolean pauseTransitionAtTimeOnPseudoElement(DOMString property, unrestricted double pauseTime, Element element, DOMString pseudoId);
 
-    [RaisesException] boolean attached(Node node);
-
     DOMString visiblePlaceholder(Element element);
-    void selectColorInColorChooser(Element element, DOMString colorValue);
+    void selectColorInColorChooser(HTMLInputElement element, DOMString colorValue);
     [RaisesException] DOMString[] formControlStateOfPreviousHistoryItem();
     [RaisesException] void setFormControlStateOfPreviousHistoryItem(sequence<DOMString> values);
 
     [RaisesException] ClientRect absoluteCaretBounds();
 
-    [RaisesException] ClientRect boundingBox(Element element);
+    ClientRect boundingBox(Element element);
 
     [RaisesException] ClientRectList inspectorHighlightRects();
     [RaisesException] DOMString inspectorHighlightObject();
@@ -158,10 +154,10 @@ enum AutoFillButtonType {
                                        long availableHeight);
 
     [RaisesException] boolean wasLastChangeUserEdit(Element textField);
-    [RaisesException] boolean elementShouldAutoComplete(Element inputElement);
-    [RaisesException] void setEditingValue(Element inputElement, DOMString value);
-    [RaisesException] void setAutofilled(Element inputElement, boolean enabled);
-    [RaisesException] void setShowAutoFillButton(Element inputElement, AutoFillButtonType autoFillButtonType);
+    boolean elementShouldAutoComplete(HTMLInputElement inputElement);
+    void setEditingValue(HTMLInputElement inputElement, DOMString value);
+    void setAutofilled(HTMLInputElement inputElement, boolean enabled);
+    void setShowAutoFillButton(HTMLInputElement inputElement, AutoFillButtonType autoFillButtonType);
     [RaisesException] unsigned long countMatchesForText(DOMString text, unsigned long findOptions, DOMString markMatches);
 
     [RaisesException] DOMString autofillFieldName(Element formControlElement);
@@ -170,11 +166,11 @@ enum AutoFillButtonType {
 
     [RaisesException] void scrollElementToRect(Element element, long x, long y, long w, long h);
 
-    [RaisesException] Range rangeFromLocationAndLength(Element scope, long rangeLocation, long rangeLength);
-    [RaisesException] unsigned long locationFromRange(Element scope, Range range);
-    [RaisesException] unsigned long lengthFromRange(Element scope, Range range);
-    [RaisesException] DOMString rangeAsText(Range range);
-    [RaisesException] Range subrange(Range range, long rangeLocation, long rangeLength);
+    Range rangeFromLocationAndLength(Element scope, long rangeLocation, long rangeLength);
+    unsigned long locationFromRange(Element scope, Range range);
+    unsigned long lengthFromRange(Element scope, Range range);
+    DOMString rangeAsText(Range range);
+    Range subrange(Range range, long rangeLocation, long rangeLength);
     [RaisesException] Range rangeForDictionaryLookupAtLocation(long x, long y);
 
     [RaisesException] void setDelegatesScrolling(boolean enabled);
@@ -219,7 +215,7 @@ enum AutoFillButtonType {
 
     [RaisesException] boolean isPageBoxVisible(long pageNumber);
 
-    [RaisesException] unsigned long imageFrameIndex(Element element);
+    unsigned long imageFrameIndex(HTMLImageElement element);
 
     readonly attribute InternalSettings settings;
     readonly attribute unsigned long workerThreadCount;
@@ -335,17 +331,17 @@ enum AutoFillButtonType {
 
     // |node| should be Document, HTMLIFrameElement, or unspecified.
     // If |node| is an HTMLIFrameElement, it assumes node.contentDocument is
-    // specified without security checks. Unspecified means this document.
-    [RaisesException] void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(optional Node node);
+    // specified without security checks. Unspecified or null means this document.
+    [RaisesException] void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(optional Node? node);
 
     readonly attribute unsigned long layoutCount;
 
     // Returns a string with information about the mouse cursor used at the specified client location.
     [RaisesException] DOMString getCurrentCursorInfo();
 
-    [RaisesException] DOMString markerTextForListItem(Element element);
+    DOMString markerTextForListItem(Element element);
 
-    [RaisesException] DOMString toolTipFromElement(Element element);
+    DOMString toolTipFromElement(Element element);
 
     SerializedScriptValue deserializeBuffer(ArrayBuffer buffer);
     ArrayBuffer serializeObject(SerializedScriptValue obj);
@@ -359,14 +355,14 @@ enum AutoFillButtonType {
 
     void enableAutoSizeMode(boolean enabled, long minimumWidth, long minimumHeight, long maximumWidth, long maximumHeight);
 
-    [Conditional=VIDEO] void simulateAudioInterruption(Node node);
-    [Conditional=VIDEO, RaisesException] boolean mediaElementHasCharacteristic(Node node, DOMString characteristic);
+    [Conditional=VIDEO] void simulateAudioInterruption(HTMLMediaElement element);
+    [Conditional=VIDEO, RaisesException] boolean mediaElementHasCharacteristic(HTMLMediaElement element, DOMString characteristic);
 
     [Conditional=ENCRYPTED_MEDIA_V2] void initializeMockCDM();
 
     [Conditional=SPEECH_SYNTHESIS] void enableMockSpeechSynthesizer();
 
-    [RaisesException] DOMString getImageSourceURL(Element element);
+    DOMString getImageSourceURL(Element element);
 
     [Conditional=VIDEO_TRACK, RaisesException] DOMString captionsStyleSheetOverride();
     [Conditional=VIDEO_TRACK, RaisesException] void setCaptionsStyleSheetOverride(DOMString override);
@@ -377,14 +373,14 @@ enum AutoFillButtonType {
      endTimes);
     [Conditional=VIDEO] unrestricted double closestTimeToTimeRanges(unrestricted double time, TimeRanges ranges);
 
-    boolean isSelectPopupVisible(Node node);
+    boolean isSelectPopupVisible(HTMLSelectElement element);
 
 #if defined(ENABLE_VIBRATION) && ENABLE_VIBRATION
     boolean isVibrating();
 #endif
 
     [RaisesException] boolean isPluginUnavailabilityIndicatorObscured(Element element);
-    [RaisesException] boolean isPluginSnapshotted(Element element);
+    boolean isPluginSnapshotted(Element element);
 
     [RaisesException] ClientRect selectionBounds();
 
@@ -402,8 +398,8 @@ enum AutoFillButtonType {
     [Conditional=VIDEO] void applicationDidEnterForeground();
     [Conditional=VIDEO] void applicationWillEnterBackground();
     [Conditional=VIDEO, RaisesException] void setMediaSessionRestrictions(DOMString mediaType, DOMString restrictions);
-    [Conditional=VIDEO, RaisesException] void setMediaElementRestrictions(HTMLMediaElement element, DOMString restrictions);
-    [Conditional=WEB_AUDIO, RaisesException] void setAudioContextRestrictions(AudioContext context, DOMString restrictions);
+    [Conditional=VIDEO] void setMediaElementRestrictions(HTMLMediaElement element, DOMString restrictions);
+    [Conditional=WEB_AUDIO] void setAudioContextRestrictions(AudioContext context, DOMString restrictions);
     [Conditional=VIDEO, RaisesException] void postRemoteControlCommand(DOMString command);
     [Conditional=WIRELESS_PLAYBACK_TARGET] void setMockMediaPlaybackTargetPickerEnabled(boolean enabled);
     [Conditional=WIRELESS_PLAYBACK_TARGET, RaisesException] void setMockMediaPlaybackTargetPickerState(DOMString deviceName, DOMString deviceState);
@@ -411,7 +407,7 @@ enum AutoFillButtonType {
 
     [Conditional=VIDEO] void simulateSystemSleep();
     [Conditional=VIDEO] void simulateSystemWake();
-    [Conditional=VIDEO] boolean elementIsBlockingDisplaySleep(Element element);
+    [Conditional=VIDEO] boolean elementIsBlockingDisplaySleep(HTMLMediaElement element);
 
     [RaisesException] MockPageOverlay installMockPageOverlay(PageOverlayType type);
     [RaisesException] DOMString pageOverlayLayerTreeAsText();
index 443e2de..1b9921c 100644 (file)
@@ -34,9 +34,9 @@
 
 namespace WebCore {
 
-String Internals::userVisibleString(const DOMURL* url)
+String Internals::userVisibleString(const DOMURL& url)
 {
-    return contextDocument()->frame()->editor().client()->userVisibleString(url->href());
+    return contextDocument()->frame()->editor().client()->userVisibleString(url.href());
 }
 
 }
index f7c971c..7f5a585 100644 (file)
@@ -51,7 +51,7 @@ void injectInternalsObject(JSContextRef context)
     JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject());
     ScriptExecutionContext* scriptContext = globalObject->scriptExecutionContext();
     if (is<Document>(*scriptContext))
-        globalObject->putDirect(exec->vm(), Identifier::fromString(exec, Internals::internalsId), toJS(exec, globalObject, Internals::create(downcast<Document>(scriptContext))));
+        globalObject->putDirect(exec->vm(), Identifier::fromString(exec, Internals::internalsId), toJS(exec, globalObject, Internals::create(downcast<Document>(*scriptContext))));
 }
 
 void resetInternalsObject(JSContextRef context)
@@ -61,7 +61,7 @@ void resetInternalsObject(JSContextRef context)
     JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject());
     ScriptExecutionContext* scriptContext = globalObject->scriptExecutionContext();
     Page* page = downcast<Document>(scriptContext)->frame()->page();
-    Internals::resetToConsistentState(page);
+    Internals::resetToConsistentState(*page);
     InternalSettings::from(page)->resetToConsistentState();
 }