Use references rather than pointers for register/unregister functions, and more
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Jan 2019 19:01:19 +0000 (19:01 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Jan 2019 19:01:19 +0000 (19:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=175028

Reviewed by Daniel Bates.

Source/WebCore:

* Modules/applepay/ApplePaySession.cpp:
(WebCore::ApplePaySession::begin): Pass a reference.
(WebCore::ApplePaySession::completePayment): Ditto.
(WebCore::ApplePaySession::didReachFinalState): Ditto.
* Modules/cache/DOMCache.cpp:
(WebCore::DOMCache::retrieveRecords): Ditto.
(WebCore::DOMCache::batchDeleteOperation): Ditto.
(WebCore::DOMCache::batchPutOperation): Ditto.
* Modules/cache/DOMCacheStorage.cpp:
(WebCore::DOMCacheStorage::match): Ditto.
* Modules/fetch/FetchBodyOwner.cpp:
(WebCore::FetchBodyOwner::loadBlob): Ditto.
(WebCore::FetchBodyOwner::finishBlobLoading): Ditto.
* Modules/fetch/FetchBodySource.cpp:
(WebCore::FetchBodySource::setActive): Ditto.
(WebCore::FetchBodySource::setInactive): Ditto.
* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::BodyLoader::BodyLoader): Ditto.
(WebCore::FetchResponse::BodyLoader::~BodyLoader): Ditto.
* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::addedToRegistry): Ditto.
(WebCore::MediaSource::removedFromRegistry): Ditto.
* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::~MediaStream): Ditto.
(WebCore::MediaStream::startProducingData): Ditto.
* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::MediaStreamTrack): Ditto.
(WebCore::MediaStreamTrack::~MediaStreamTrack): Ditto.
* Modules/mediastream/RTCDataChannel.cpp:
(WebCore::RTCDataChannel::create): Ditto.
(WebCore::RTCDataChannel::close): Ditto.
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::create): Use auto.
* Modules/notifications/Notification.cpp:
(WebCore::Notification::show): Pass a reference.
(WebCore::Notification::finalize): Ditto.
* Modules/webaudio/AudioBasicInspectorNode.cpp:
(WebCore::AudioBasicInspectorNode::updatePullStatus): Ditto.

* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::constructCommon): Ditto.
(WebCore::AudioContext::lazyInitialize): Ditto.
(WebCore::AudioContext::clear): Ditto.
(WebCore::AudioContext::uninitialize): Ditto.
(WebCore::AudioContext::markForDeletion): Take a reference.
(WebCore::AudioContext::addAutomaticPullNode): Ditto.
(WebCore::AudioContext::removeAutomaticPullNode): Ditto.
(WebCore::AudioContext::willBeginPlayback): Pass a reference.
(WebCore::AudioContext::willPausePlayback): Ditto.
* Modules/webaudio/AudioContext.h: Update above functions to take
references rather than pointers.

* Modules/webaudio/AudioNode.cpp:
(WebCore::AudioNode::finishDeref): Pass a reference.
* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::connect): Ditto.
(WebCore::WebSocket::stop): Ditto.
(WebCore::WebSocket::didClose): Ditto.

* WebCore.xcodeproj/project.pbxproj: Allowed Xcode to update this file.

* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::moduleLoaderResolve): Update since
moduleLoader is now a reference.
(WebCore::JSDOMWindowBase::moduleLoaderFetch): Ditto.
(WebCore::JSDOMWindowBase::moduleLoaderEvaluate): Ditto.
(WebCore::JSDOMWindowBase::moduleLoaderImportModule): Ditto.
(WebCore::JSDOMWindowBase::moduleLoaderCreateImportMetaProperties): Ditto.

* dom/ActiveDOMObject.h:
(WebCore::ActiveDOMObject::setPendingActivity): Take a reference.
(WebCore::ActiveDOMObject::unsetPendingActivity): Ditto.

* dom/CharacterData.cpp:
(WebCore::CharacterData::setData): Pass a reference.
(WebCore::CharacterData::insertData): Ditto.
(WebCore::CharacterData::deleteData): Ditto.
(WebCore::CharacterData::replaceData): Ditto.

* dom/Document.cpp:
(WebCore::Document::getElementByAccessKey): Pass a reference.
(WebCore::Document::buildAccessKeyMap): Take a reference.
(WebCore::Document::registerForVisibilityStateChangedCallbacks): Ditto.
(WebCore::Document::unregisterForVisibilityStateChangedCallbacks): Ditto.
(WebCore::Document::addAudioProducer): Ditto.
(WebCore::Document::removeAudioProducer): Ditto.
(WebCore::Document::hoveredElementDidDetach): Ditto.
(WebCore::Document::elementInActiveChainDidDetach): Ditto.
(WebCore::Document::attachNodeIterator): Ditto.
(WebCore::Document::detachNodeIterator): Ditto.
(WebCore::Document::moveNodeIteratorsToNewDocumentSlowCase): Pass
a reference.
(WebCore::Document::nodeChildrenWillBeRemoved): Ditto.
(WebCore::Document::nodeWillBeRemoved): Ditto.
(WebCore::Document::textInserted): Take a reference.
(WebCore::Document::textRemoved): Ditto.
(WebCore::Document::textNodesMerged): Ditto.
(WebCore::Document::textNodeSplit): Ditto.
(WebCore::Document::takeDOMWindowFrom): Ditto.
(WebCore::Document::registerForDocumentSuspensionCallbacks): Ditto.
(WebCore::Document::unregisterForDocumentSuspensionCallbacks): Ditto.
(WebCore::Document::registerForMediaVolumeCallbacks): Ditto.
(WebCore::Document::unregisterForMediaVolumeCallbacks): Ditto.
(WebCore::Document::registerForPrivateBrowsingStateChangedCallbacks): Ditto.
(WebCore::Document::unregisterForPrivateBrowsingStateChangedCallbacks): Ditto.
(WebCore::Document::registerForCaptionPreferencesChangedCallbacks): Ditto.
(WebCore::Document::unregisterForCaptionPreferencesChangedCallbacks): Ditto.
(WebCore::Document::registerForPageScaleFactorChangedCallbacks): Ditto.
(WebCore::Document::unregisterForPageScaleFactorChangedCallbacks): Ditto.
(WebCore::Document::finishedParsing): Use a reference.
(WebCore::Document::attachRange): Take a reference.
(WebCore::Document::detachRange): Ditto.
(WebCore::Document::suspendScheduledTasks): Use a reference.
(WebCore::Document::resumeScheduledTasks): Ditto.
(WebCore::Document::addMediaCanStartListener): Take a reference.
(WebCore::Document::removeMediaCanStartListener): Ditto.
(WebCore::Document::deviceMotionController const): Return a reference.
(WebCore::Document::deviceOrientationController const): Ditto.
(WebCore::Document::simulateDeviceOrientationChange): Use a reference.
(WebCore::Document::fullScreenIsAllowedForElement const): Take a reference.
(WebCore::Document::requestFullScreenForElement): Pass a reference.
(WebCore::Document::webkitExitFullscreen): Ditto.
(WebCore::Document::webkitWillEnterFullScreen): Renamed to remove the
"ForElement" from the function name. Take a reference rather than a pointer.
(WebCore::Document::webkitDidEnterFullScreen): Renamed to remove the
"ForElement" from the function name and removed the unused element argument.
(WebCore::Document::webkitWillExitFullScreen): Ditto.
(WebCore::Document::webkitDidExitFullScreen): Ditto.
(WebCore::Document::pushFullscreenElementStack): Take a reference.
(WebCore::Document::addDocumentToFullScreenChangeEventQueue): Ditto.
(WebCore::DocumentParserYieldToken::DocumentParserYieldToken): Use a reference.
(WebCore::DocumentParserYieldToken::~DocumentParserYieldToken): Ditto.
(WebCore::Document::updateHoverActiveState): Updated name of isInActiveChain.

* dom/Document.h: Updated argument types as described above. Changed a couple
of inline functions to return references.

* dom/DocumentMarkerController.cpp:
(WebCore::DocumentMarkerController::addMarker): Take a reference.
(WebCore::DocumentMarkerController::addMarkerToNode): Ditto.
(WebCore::DocumentMarkerController::addTextMatchMarker): Ditto.
(WebCore::DocumentMarkerController::addDictationPhraseWithAlternativesMarker): Ditto.
(WebCore::DocumentMarkerController::addDictationResultMarker): Ditto.
(WebCore::DocumentMarkerController::addDraggedContentMarker): Ditto.
(WebCore::DocumentMarkerController::removeMarkers): Ditto.
(WebCore::DocumentMarkerController::copyMarkers): Ditto.
(WebCore::DocumentMarkerController::shiftMarkers): Ditto.
(WebCore::DocumentMarkerController::setMarkersActive): DItto.
* dom/DocumentMarkerController.h: Updated argument types as described above.

* dom/Element.cpp:
(WebCore::Element::~Element): Pass a reference.
(WebCore::Element::isUserActionElementInActiveChain const): Updated name of
isInActiveChain.
(WebCore::Element::hasEquivalentAttributes const): Take a reference.
(WebCore::Element::removedFromAncestor): Pass a reference.
(WebCore::Element::clearHoverAndActiveStatusBeforeDetachingRenderer):
Pass a reference and updated name of isInActiveChain.

* dom/Element.h: Renamed inActiveChain to isInActiveChain, updated argument
types to be references, and removed unneeded friend declaration and made
SynchronizationOfLazyAttribute private.

* dom/Node.cpp:
(WebCore::Node::normalize): Pass a reference.
(WebCore::Node::isEqualNode const): Ditto.
* dom/NodeIterator.cpp:
(WebCore::NodeIterator::NodeIterator): Ditto.
(WebCore::NodeIterator::~NodeIterator): Ditto.

* dom/RadioButtonGroups.cpp:
(WebCore::RadioButtonGroup::add): Take a reference.
(WebCore::RadioButtonGroup::updateCheckedState): Ditto.
(WebCore::RadioButtonGroup::remove): Ditto.
(WebCore::RadioButtonGroup::contains const): Ditto.
(WebCore::RadioButtonGroups::addButton): Ditto.
(WebCore::RadioButtonGroups::updateCheckedState): Ditto.
(WebCore::RadioButtonGroups::hasCheckedButton const): Ditto.
(WebCore::RadioButtonGroups::isInRequiredGroup const): Ditto.
(WebCore::RadioButtonGroups::removeButton): Ditto.
* dom/RadioButtonGroups.h: Updated argument types.

* dom/Range.cpp:
(WebCore::Range::Range): Pass a reference.
(WebCore::Range::~Range): Ditto.
(WebCore::Range::setDocument): Ditto.
(WebCore::Range::createContextualFragment): Ditto.
(WebCore::boundaryTextInserted): Ditto.
(WebCore::Range::textInserted): Ditto.
(WebCore::boundaryTextRemoved): Ditto.
(WebCore::Range::textRemoved): Ditto.
(WebCore::boundaryTextNodesSplit): Ditto.
(WebCore::Range::textNodeSplit): Ditto.
* dom/Range.h: Take references instead of pointers.

* dom/ScriptElement.cpp:
(WebCore::ScriptElement::prepareScript): Use reference.

* dom/Text.cpp:
(WebCore::Text::splitText): Pass reference.

* dom/UserActionElementSet.h: Renamed inActiveChain to isInActiveChain to
match the naming scheme of the other similar functions, like isActive.

* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::applyAlternativeTextToRange):
Pass a reference.
(WebCore::AlternativeTextController::respondToUnappliedSpellCorrection): Ditto.
(WebCore::AlternativeTextController::handleAlternativeTextUIResult): Ditto.
(WebCore::AlternativeTextController::respondToUnappliedEditing): Ditto.
(WebCore::AlternativeTextController::markReversed): Ditto.
(WebCore::AlternativeTextController::markCorrection): Ditto.
(WebCore::AlternativeTextController::recordSpellcheckerResponseForModifiedCorrection): Ditto.
(WebCore::AlternativeTextController::markPrecedingWhitespaceForDeletedAutocorrectionAfterCommand): Ditto.
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers): Ditto.
* editing/DictationCommand.cpp: Ditto.
* editing/Editing.cpp:
(WebCore::areIdenticalElements): Ditto.
* editing/Editor.cpp:
(WebCore::Editor::ignoreSpelling): Ditto.
(WebCore::Editor::learnSpelling): Ditto.
(WebCore::Editor::advanceToNextMisspelling): Ditto.
(WebCore::Editor::clearMisspellingsAndBadGrammar): Ditto.
(WebCore::Editor::markMisspellingsAfterTypingToWord): Ditto.
(WebCore::Editor::markAndReplaceFor): Ditto.
(WebCore::Editor::changeBackToReplacedString): Ditto.
(WebCore::Editor::updateMarkersForWordsAffectedByEditing): Ditto.
(WebCore::Editor::countMatchesForText): Ditto.
(WebCore::Editor::scanRangeForTelephoneNumbers): Ditto.
(WebCore::Editor::editorUIUpdateTimerFired): Ditto.
(WebCore::Editor::handleAcceptedCandidate): Ditto.

* editing/InsertTextCommand.cpp:
(WebCore::InsertTextCommand::doApply): Pass a reference.
* editing/InsertTextCommand.h: Take a reference.

* editing/SpellChecker.cpp:
(WebCore::SpellChecker::didCheckSucceed): Pass a reference.
* editing/SplitTextNodeCommand.cpp:
(WebCore::SplitTextNodeCommand::doApply): Ditto.
(WebCore::SplitTextNodeCommand::doUnapply): Ditto.
* editing/TextCheckingHelper.cpp:
(WebCore::TextCheckingHelper::findFirstMisspelling): Pass a reference.
(WebCore::TextCheckingHelper::findFirstGrammarDetail const): Ditto.
* editing/ios/DictationCommandIOS.cpp:
(WebCore::DictationCommandIOS::doApply): Ditto.
Also added a comment about a possible missing null check; behavior should
be no different than before, but using a reference helps make clear there
was never any null check.
* editing/ios/EditorIOS.mm:
(WebCore::Editor::setDictationPhrasesAsChildOfElement): Ditto.
* fileapi/FileReader.cpp:
(WebCore::FileReader::readInternal): Ditto.
(WebCore::FileReader::abort): Ditto.
(WebCore::FileReader::didFinishLoading): Ditto.
(WebCore::FileReader::didFail): Ditto.

* html/HTMLAppletElement.cpp: Removed unneeded include of HTMLDocument.h.
There's very little left that is truly specific to HTMLDocument vs. Document.

* html/HTMLDocument.h:
(WebCore::HTMLDocument::create): Take a reference.
(WebCore::HTMLDocument::createSynthesizedDocument): Ditto.

* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::~HTMLFormElement): Pass a reference.
(WebCore::HTMLFormElement::parseAttribute): Ditto.
(WebCore::HTMLFormElement::didMoveToNewDocument): Ditto.

* html/HTMLIFrameElement.cpp: Removed unneeded include of HTMLDocument.h.

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::~HTMLInputElement): Pass a reference.
(WebCore::HTMLInputElement::setChecked): Ditto.
(WebCore::HTMLInputElement::registerForSuspensionCallbackIfNeeded): Ditto.
(WebCore::HTMLInputElement::unregisterForSuspensionCallbackIfNeeded): Ditto.
(WebCore::HTMLInputElement::didMoveToNewDocument): Ditto.
(WebCore::HTMLInputElement::isInRequiredRadioButtonGroup): Ditto.
(WebCore::HTMLInputElement::addToRadioButtonGroup): Ditto.
(WebCore::HTMLInputElement::removeFromRadioButtonGroup): Ditto.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::registerWithDocument): Ditto.
(WebCore::HTMLMediaElement::unregisterWithDocument): Ditto.
(WebCore::HTMLMediaElement::selectMediaResource): Ditto.
(WebCore::HTMLMediaElement::addTextTrack): Ditto.
(WebCore::HTMLMediaElement::clearMediaPlayer): Ditto.
(WebCore::HTMLMediaElement::resume): Ditto.
(WebCore::HTMLMediaElement::setMediaControlsDependOnPageScaleFactor): Ditto.

* html/HTMLNameCollection.cpp: Removed unneeded include of HTMLDocument.h.

* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::~HTMLPlugInImageElement): Pass a reference.
(WebCore::HTMLPlugInImageElement::createElementRenderer): Ditto.
(WebCore::HTMLPlugInImageElement::didMoveToNewDocument): Ditto.

* html/HTMLSourceElement.cpp: Removed unneeded include of HTMLDocument.h.
* html/HTMLTemplateElement.cpp: Ditto.

* html/RadioInputType.cpp:
(WebCore::RadioInputType::matchesIndeterminatePseudoClass const):
Pass a reference.
* loader/DocumentWriter.cpp:
(WebCore::DocumentWriter::begin): Ditto.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::addEventListener): Ditto.
(WebCore::DOMWindow::removeEventListener): Ditto.
(WebCore::DOMWindow::removeAllEventListeners): Ditto.

* page/EventHandler.cpp:
(WebCore::EventHandler::didStartDrag): Use a reference.

* page/EventSource.cpp:
(WebCore::EventSource::create): Pass reference.
(WebCore::EventSource::networkRequestEnded): Ditto.
(WebCore::EventSource::close): Ditto.
(WebCore::EventSource::abortConnectionAttempt): Ditto.

* page/Frame.cpp: Removed unneeded include of HTMLDocument.h.
* page/FrameView.cpp: Ditto.
(WebCore::FrameView::qualifiesAsVisuallyNonEmpty const): Use reference.

* page/animation/AnimationBase.cpp:
(WebCore::AnimationBase::updateStateMachine): Pass reference.

* page/animation/CSSAnimationController.cpp:
(WebCore::CSSAnimationControllerPrivate::addToAnimationsWaitingForStyle): Take reference.
(WebCore::CSSAnimationControllerPrivate::removeFromAnimationsWaitingForStyle): Ditto.
(WebCore::CSSAnimationControllerPrivate::addToAnimationsWaitingForStartTimeResponse): Ditto.
(WebCore::CSSAnimationControllerPrivate::removeFromAnimationsWaitingForStartTimeResponse): Ditto.
(WebCore::CSSAnimationControllerPrivate::animationWillBeRemoved): Ditto.
* page/animation/CSSAnimationControllerPrivate.h: Ditto.

* page/animation/CompositeAnimation.cpp:
(WebCore::CompositeAnimation::clearElement): Pass reference.
(WebCore::CompositeAnimation::updateTransitions): Ditto.
(WebCore::CompositeAnimation::updateKeyframeAnimations): Ditto.
* page/ios/FrameIOS.mm:
(WebCore::Frame::initWithSimpleHTMLDocument): Ditto.

* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(WebCore::layerContentsFormat): Add ALLOW_DEPRECATED_DECLARATIONS_BEGIN/END so
I can continue to compile with latest headers.

* rendering/CSSFilter.cpp:
(WebCore::CSSFilter::buildReferenceFilter): Pass reference, small coding style
tweaks as well.

* rendering/svg/RenderSVGResource.cpp:
(WebCore::removeFromCacheAndInvalidateDependencies): Pass reference.
* rendering/svg/RenderSVGResourceContainer.cpp:
(WebCore::RenderSVGResourceContainer::registerResource): Ditto.
* rendering/svg/SVGResources.cpp:
(WebCore::registerPendingResource): Ditto.
* rendering/svg/SVGResourcesCache.cpp:
(WebCore::SVGResourcesCache::resourceDestroyed): Ditto.

* svg/SVGDocumentExtensions.cpp:
(WebCore::SVGDocumentExtensions::addTimeContainer): Take reference.
(WebCore::SVGDocumentExtensions::removeTimeContainer): Ditto.
(WebCore::SVGDocumentExtensions::addResource): Ditto.
(WebCore::SVGDocumentExtensions::addPendingResource): Ditto.
(WebCore::SVGDocumentExtensions::isElementWithPendingResources const): Ditto.
(WebCore::SVGDocumentExtensions::isPendingResource const): Ditto.
(WebCore::SVGDocumentExtensions::clearHasPendingResourcesIfPossible): Ditto.
(WebCore::SVGDocumentExtensions::removeElementFromPendingResources): Ditto.
(WebCore::SVGDocumentExtensions::setOfElementsReferencingTarget): Ditto.
(WebCore::SVGDocumentExtensions::addElementReferencingTarget): Ditto.
(WebCore::SVGDocumentExtensions::removeAllTargetReferencesForElement): Ditto.
(WebCore::SVGDocumentExtensions::clearTargetDependencies): Ditto.
(WebCore::SVGDocumentExtensions::removeAllElementReferencesForTarget): Ditto.
(WebCore::SVGDocumentExtensions::registerSVGFontFaceElement): Ditto.
(WebCore::SVGDocumentExtensions::unregisterSVGFontFaceElement): Ditto.
* svg/SVGDocumentExtensions.h: Ditto.

* svg/SVGElement.cpp:
(WebCore::SVGElement::~SVGElement): Pass reference.
(WebCore::SVGElement::removedFromAncestor): Ditto.
(WebCore::SVGElement::buildPendingResourcesIfNeeded): Ditto.
* svg/SVGFEImageElement.cpp:
(WebCore::SVGFEImageElement::clearResourceReferences): Ditto.
(WebCore::SVGFEImageElement::buildPendingResource): Ditto.
* svg/SVGFontFaceElement.cpp:
(WebCore::SVGFontFaceElement::insertedIntoAncestor): Ditto.
(WebCore::SVGFontFaceElement::removedFromAncestor): Ditto.
* svg/SVGMPathElement.cpp:
(WebCore::SVGMPathElement::buildPendingResource): Ditto.
(WebCore::SVGMPathElement::clearResourceReferences): Ditto.
* svg/SVGPathElement.cpp:
(WebCore::SVGPathElement::invalidateMPathDependencies): Ditto.
* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::SVGSVGElement): Ditto.
(WebCore::SVGSVGElement::~SVGSVGElement): Ditto.
(WebCore::SVGSVGElement::didMoveToNewDocument): Ditto.
(WebCore::SVGSVGElement::insertedIntoAncestor): Ditto.
(WebCore::SVGSVGElement::removedFromAncestor): Ditto.
* svg/SVGTRefElement.cpp:
(WebCore::SVGTRefElement::detachTarget): Ditto.
(WebCore::SVGTRefElement::buildPendingResource): Ditto.
* svg/SVGTextPathElement.cpp:
(WebCore::SVGTextPathElement::clearResourceReferences): Ditto.
(WebCore::SVGTextPathElement::buildPendingResource): Ditto.
* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::updateShadowTree): Ditto.
* svg/animation/SVGSMILElement.cpp:
(WebCore::SVGSMILElement::clearResourceReferences): Ditto.
(WebCore::SVGSMILElement::buildPendingResource): Ditto.
* testing/Internals.cpp:
(WebCore::Internals::addTextMatchMarker): Ditto.
(WebCore::Internals::webkitWillEnterFullScreenForElement): Ditto.
(WebCore::Internals::webkitDidEnterFullScreenForElement): Ditto.
(WebCore::Internals::webkitWillExitFullScreenForElement): Ditto.
(WebCore::Internals::webkitDidExitFullScreenForElement): Ditto.
* workers/Worker.cpp:
(WebCore::Worker::create): Ditto.
(WebCore::Worker::notifyFinished): Ditto.
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::scheduleJob): Ditto.
(WebCore::ServiceWorkerContainer::jobDidFinish): Ditto.
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::prepareToSend): Ditto.
(WebCore::XMLHttpRequest::createRequest): Ditto.
(WebCore::XMLHttpRequest::internalAbort): Ditto.
(WebCore::XMLHttpRequest::networkErrorTimerFired): Ditto.
(WebCore::XMLHttpRequest::didFail): Ditto.
(WebCore::XMLHttpRequest::didFinishLoading): Ditto.

* xml/XPathStep.cpp: Removed unneeded include of HTMLDocument.h.
(WebCore::XPath::nodeMatchesBasicTest): Changed code to call isHTMLDocument
rather than is<HTMLDocument> since this is not a type check for a downcast,
but rather a behavioral difference that does not depend on any of the data
stored in an HTMLDocument or the use of a distinct C++ class for it.

* xml/XSLTProcessor.cpp:
(WebCore::XSLTProcessor::createDocumentFromSource): Pass a reference.

Source/WebKit:

* WebProcess/FullScreen/WebFullScreenManager.cpp:
(WebKit::WebFullScreenManager::willEnterFullScreen): Update for change to the
functions in Document; pass a reference.
(WebKit::WebFullScreenManager::didEnterFullScreen): Ditto, don't pass the element.
(WebKit::WebFullScreenManager::willExitFullScreen): Ditto.
(WebKit::WebFullScreenManager::didExitFullScreen): Ditto.

* WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
(WebKit::UserMediaPermissionRequestManager::startUserMediaRequest): Pass a reference.
(WebKit::UserMediaPermissionRequestManager::mediaCanStart): Ditto.
(WebKit::UserMediaPermissionRequestManager::removeMediaRequestFromMaps): Ditto.
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::~PluginView): Ditto.
(WebKit::PluginView::initializePlugin): Ditto.

Source/WebKitLegacy:

* WebKitLegacy.xcodeproj/project.pbxproj: Let Xcode update this project.

Source/WebKitLegacy/mac:

* WebCoreSupport/WebKitFullScreenListener.mm:
(-[WebKitFullScreenListener webkitWillEnterFullScreen]): Update for change to the
functions in Document; pass a reference.
(-[WebKitFullScreenListener webkitDidEnterFullScreen]): Ditto, don't pass the element.
(-[WebKitFullScreenListener webkitWillExitFullScreen]): Ditto.
(-[WebKitFullScreenListener webkitDidExitFullScreen]): Ditto.
* WebView/WebFullScreenController.mm:
(-[WebFullScreenController enterFullScreen:]): Ditto.
(-[WebFullScreenController finishedEnterFullScreenAnimation:]): Ditto.
(-[WebFullScreenController exitFullScreen]): Ditto.
(-[WebFullScreenController finishedExitFullScreenAnimation:]): Ditto.
* WebView/WebFullScreenController.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]): Pass a reference.

Source/WebKitLegacy/win:

* Plugins/PluginView.cpp:
(WebCore::PluginView::startOrAddToUnstartedList): Pass a reference.
(WebCore::PluginView::~PluginView): Ditto.
* WebView.cpp:
(WebView::fullScreenClientWillEnterFullScreen): Ditto.
(WebView::fullScreenClientDidEnterFullScreen): Ditto.
(WebView::fullScreenClientDidExitFullScreen): Ditto.

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

117 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/applepay/ApplePaySession.cpp
Source/WebCore/Modules/cache/DOMCache.cpp
Source/WebCore/Modules/cache/DOMCacheStorage.cpp
Source/WebCore/Modules/fetch/FetchBodyOwner.cpp
Source/WebCore/Modules/fetch/FetchBodySource.cpp
Source/WebCore/Modules/fetch/FetchResponse.cpp
Source/WebCore/Modules/mediasource/MediaSource.cpp
Source/WebCore/Modules/mediastream/MediaStream.cpp
Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp
Source/WebCore/Modules/mediastream/RTCDataChannel.cpp
Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp
Source/WebCore/Modules/notifications/Notification.cpp
Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.cpp
Source/WebCore/Modules/webaudio/AudioContext.cpp
Source/WebCore/Modules/webaudio/AudioContext.h
Source/WebCore/Modules/webaudio/AudioNode.cpp
Source/WebCore/Modules/websockets/WebSocket.cpp
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSDOMWindowBase.cpp
Source/WebCore/dom/ActiveDOMObject.h
Source/WebCore/dom/CharacterData.cpp
Source/WebCore/dom/DeviceMotionClient.h
Source/WebCore/dom/DeviceMotionController.cpp
Source/WebCore/dom/DeviceMotionController.h
Source/WebCore/dom/DeviceOrientationClient.h
Source/WebCore/dom/DeviceOrientationController.cpp
Source/WebCore/dom/DeviceOrientationController.h
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/DocumentMarkerController.cpp
Source/WebCore/dom/DocumentMarkerController.h
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/NamedNodeMap.cpp
Source/WebCore/dom/Node.cpp
Source/WebCore/dom/NodeIterator.cpp
Source/WebCore/dom/RadioButtonGroups.cpp
Source/WebCore/dom/RadioButtonGroups.h
Source/WebCore/dom/Range.cpp
Source/WebCore/dom/Range.h
Source/WebCore/dom/ScriptElement.cpp
Source/WebCore/dom/Text.cpp
Source/WebCore/dom/UserActionElementSet.h
Source/WebCore/editing/AlternativeTextController.cpp
Source/WebCore/editing/CompositeEditCommand.cpp
Source/WebCore/editing/DictationCommand.cpp
Source/WebCore/editing/Editing.cpp
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/InsertTextCommand.cpp
Source/WebCore/editing/InsertTextCommand.h
Source/WebCore/editing/SpellChecker.cpp
Source/WebCore/editing/SplitTextNodeCommand.cpp
Source/WebCore/editing/TextCheckingHelper.cpp
Source/WebCore/editing/ios/DictationCommandIOS.cpp
Source/WebCore/editing/ios/EditorIOS.mm
Source/WebCore/fileapi/FileReader.cpp
Source/WebCore/html/HTMLAppletElement.cpp
Source/WebCore/html/HTMLDocument.h
Source/WebCore/html/HTMLFormElement.cpp
Source/WebCore/html/HTMLIFrameElement.cpp
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLNameCollection.cpp
Source/WebCore/html/HTMLPlugInImageElement.cpp
Source/WebCore/html/HTMLSourceElement.cpp
Source/WebCore/html/HTMLTemplateElement.cpp
Source/WebCore/html/RadioInputType.cpp
Source/WebCore/loader/DocumentWriter.cpp
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/DeviceController.cpp
Source/WebCore/page/DeviceController.h
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/EventSource.cpp
Source/WebCore/page/Frame.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/animation/AnimationBase.cpp
Source/WebCore/page/animation/CSSAnimationController.cpp
Source/WebCore/page/animation/CSSAnimationControllerPrivate.h
Source/WebCore/page/animation/CompositeAnimation.cpp
Source/WebCore/page/ios/FrameIOS.mm
Source/WebCore/page/mac/EventHandlerMac.mm
Source/WebCore/rendering/CSSFilter.cpp
Source/WebCore/rendering/svg/RenderSVGResource.cpp
Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp
Source/WebCore/rendering/svg/SVGResources.cpp
Source/WebCore/rendering/svg/SVGResourcesCache.cpp
Source/WebCore/svg/SVGDocumentExtensions.cpp
Source/WebCore/svg/SVGDocumentExtensions.h
Source/WebCore/svg/SVGElement.cpp
Source/WebCore/svg/SVGFEImageElement.cpp
Source/WebCore/svg/SVGFontFaceElement.cpp
Source/WebCore/svg/SVGMPathElement.cpp
Source/WebCore/svg/SVGPathElement.cpp
Source/WebCore/svg/SVGSVGElement.cpp
Source/WebCore/svg/SVGTRefElement.cpp
Source/WebCore/svg/SVGTextPathElement.cpp
Source/WebCore/svg/SVGUseElement.cpp
Source/WebCore/svg/animation/SVGSMILElement.cpp
Source/WebCore/testing/Internals.cpp
Source/WebCore/workers/Worker.cpp
Source/WebCore/workers/service/ServiceWorkerContainer.cpp
Source/WebCore/xml/XMLHttpRequest.cpp
Source/WebCore/xml/XPathStep.cpp
Source/WebCore/xml/XSLTProcessor.cpp
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp
Source/WebKit/WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp
Source/WebKit/WebProcess/Plugins/PluginView.cpp
Source/WebKitLegacy/ChangeLog
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebCoreSupport/WebKitFullScreenListener.mm
Source/WebKitLegacy/mac/WebView/WebFullScreenController.mm
Source/WebKitLegacy/mac/WebView/WebView.mm
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/Plugins/PluginView.cpp
Source/WebKitLegacy/win/WebView.cpp

index f220d7a..3b5051a 100644 (file)
@@ -1,3 +1,447 @@
+2019-01-15  Darin Adler  <darin@apple.com>
+
+        Use references rather than pointers for register/unregister functions, and more
+        https://bugs.webkit.org/show_bug.cgi?id=175028
+
+        Reviewed by Daniel Bates.
+
+        * Modules/applepay/ApplePaySession.cpp:
+        (WebCore::ApplePaySession::begin): Pass a reference.
+        (WebCore::ApplePaySession::completePayment): Ditto.
+        (WebCore::ApplePaySession::didReachFinalState): Ditto.
+        * Modules/cache/DOMCache.cpp:
+        (WebCore::DOMCache::retrieveRecords): Ditto.
+        (WebCore::DOMCache::batchDeleteOperation): Ditto.
+        (WebCore::DOMCache::batchPutOperation): Ditto.
+        * Modules/cache/DOMCacheStorage.cpp:
+        (WebCore::DOMCacheStorage::match): Ditto.
+        * Modules/fetch/FetchBodyOwner.cpp:
+        (WebCore::FetchBodyOwner::loadBlob): Ditto.
+        (WebCore::FetchBodyOwner::finishBlobLoading): Ditto.
+        * Modules/fetch/FetchBodySource.cpp:
+        (WebCore::FetchBodySource::setActive): Ditto.
+        (WebCore::FetchBodySource::setInactive): Ditto.
+        * Modules/fetch/FetchResponse.cpp:
+        (WebCore::FetchResponse::BodyLoader::BodyLoader): Ditto.
+        (WebCore::FetchResponse::BodyLoader::~BodyLoader): Ditto.
+        * Modules/mediasource/MediaSource.cpp:
+        (WebCore::MediaSource::addedToRegistry): Ditto.
+        (WebCore::MediaSource::removedFromRegistry): Ditto.
+        * Modules/mediastream/MediaStream.cpp:
+        (WebCore::MediaStream::~MediaStream): Ditto.
+        (WebCore::MediaStream::startProducingData): Ditto.
+        * Modules/mediastream/MediaStreamTrack.cpp:
+        (WebCore::MediaStreamTrack::MediaStreamTrack): Ditto.
+        (WebCore::MediaStreamTrack::~MediaStreamTrack): Ditto.
+        * Modules/mediastream/RTCDataChannel.cpp:
+        (WebCore::RTCDataChannel::create): Ditto.
+        (WebCore::RTCDataChannel::close): Ditto.
+        * Modules/mediastream/RTCPeerConnection.cpp:
+        (WebCore::RTCPeerConnection::create): Use auto.
+        * Modules/notifications/Notification.cpp:
+        (WebCore::Notification::show): Pass a reference.
+        (WebCore::Notification::finalize): Ditto.
+        * Modules/webaudio/AudioBasicInspectorNode.cpp:
+        (WebCore::AudioBasicInspectorNode::updatePullStatus): Ditto.
+
+        * Modules/webaudio/AudioContext.cpp:
+        (WebCore::AudioContext::constructCommon): Ditto.
+        (WebCore::AudioContext::lazyInitialize): Ditto.
+        (WebCore::AudioContext::clear): Ditto.
+        (WebCore::AudioContext::uninitialize): Ditto.
+        (WebCore::AudioContext::markForDeletion): Take a reference.
+        (WebCore::AudioContext::addAutomaticPullNode): Ditto.
+        (WebCore::AudioContext::removeAutomaticPullNode): Ditto.
+        (WebCore::AudioContext::willBeginPlayback): Pass a reference.
+        (WebCore::AudioContext::willPausePlayback): Ditto.
+        * Modules/webaudio/AudioContext.h: Update above functions to take
+        references rather than pointers.
+
+        * Modules/webaudio/AudioNode.cpp:
+        (WebCore::AudioNode::finishDeref): Pass a reference.
+        * Modules/websockets/WebSocket.cpp:
+        (WebCore::WebSocket::connect): Ditto.
+        (WebCore::WebSocket::stop): Ditto.
+        (WebCore::WebSocket::didClose): Ditto.
+
+        * WebCore.xcodeproj/project.pbxproj: Allowed Xcode to update this file.
+
+        * bindings/js/JSDOMWindowBase.cpp:
+        (WebCore::JSDOMWindowBase::moduleLoaderResolve): Update since
+        moduleLoader is now a reference.
+        (WebCore::JSDOMWindowBase::moduleLoaderFetch): Ditto.
+        (WebCore::JSDOMWindowBase::moduleLoaderEvaluate): Ditto.
+        (WebCore::JSDOMWindowBase::moduleLoaderImportModule): Ditto.
+        (WebCore::JSDOMWindowBase::moduleLoaderCreateImportMetaProperties): Ditto.
+
+        * dom/ActiveDOMObject.h:
+        (WebCore::ActiveDOMObject::setPendingActivity): Take a reference.
+        (WebCore::ActiveDOMObject::unsetPendingActivity): Ditto.
+
+        * dom/CharacterData.cpp:
+        (WebCore::CharacterData::setData): Pass a reference.
+        (WebCore::CharacterData::insertData): Ditto.
+        (WebCore::CharacterData::deleteData): Ditto.
+        (WebCore::CharacterData::replaceData): Ditto.
+
+        * dom/Document.cpp:
+        (WebCore::Document::getElementByAccessKey): Pass a reference.
+        (WebCore::Document::buildAccessKeyMap): Take a reference.
+        (WebCore::Document::registerForVisibilityStateChangedCallbacks): Ditto.
+        (WebCore::Document::unregisterForVisibilityStateChangedCallbacks): Ditto.
+        (WebCore::Document::addAudioProducer): Ditto.
+        (WebCore::Document::removeAudioProducer): Ditto.
+        (WebCore::Document::hoveredElementDidDetach): Ditto.
+        (WebCore::Document::elementInActiveChainDidDetach): Ditto.
+        (WebCore::Document::attachNodeIterator): Ditto.
+        (WebCore::Document::detachNodeIterator): Ditto.
+        (WebCore::Document::moveNodeIteratorsToNewDocumentSlowCase): Pass
+        a reference.
+        (WebCore::Document::nodeChildrenWillBeRemoved): Ditto.
+        (WebCore::Document::nodeWillBeRemoved): Ditto.
+        (WebCore::Document::textInserted): Take a reference.
+        (WebCore::Document::textRemoved): Ditto.
+        (WebCore::Document::textNodesMerged): Ditto.
+        (WebCore::Document::textNodeSplit): Ditto.
+        (WebCore::Document::takeDOMWindowFrom): Ditto.
+        (WebCore::Document::registerForDocumentSuspensionCallbacks): Ditto.
+        (WebCore::Document::unregisterForDocumentSuspensionCallbacks): Ditto.
+        (WebCore::Document::registerForMediaVolumeCallbacks): Ditto.
+        (WebCore::Document::unregisterForMediaVolumeCallbacks): Ditto.
+        (WebCore::Document::registerForPrivateBrowsingStateChangedCallbacks): Ditto.
+        (WebCore::Document::unregisterForPrivateBrowsingStateChangedCallbacks): Ditto.
+        (WebCore::Document::registerForCaptionPreferencesChangedCallbacks): Ditto.
+        (WebCore::Document::unregisterForCaptionPreferencesChangedCallbacks): Ditto.
+        (WebCore::Document::registerForPageScaleFactorChangedCallbacks): Ditto.
+        (WebCore::Document::unregisterForPageScaleFactorChangedCallbacks): Ditto.
+        (WebCore::Document::finishedParsing): Use a reference.
+        (WebCore::Document::attachRange): Take a reference.
+        (WebCore::Document::detachRange): Ditto.
+        (WebCore::Document::suspendScheduledTasks): Use a reference.
+        (WebCore::Document::resumeScheduledTasks): Ditto.
+        (WebCore::Document::addMediaCanStartListener): Take a reference.
+        (WebCore::Document::removeMediaCanStartListener): Ditto.
+        (WebCore::Document::deviceMotionController const): Return a reference.
+        (WebCore::Document::deviceOrientationController const): Ditto.
+        (WebCore::Document::simulateDeviceOrientationChange): Use a reference.
+        (WebCore::Document::fullScreenIsAllowedForElement const): Take a reference.
+        (WebCore::Document::requestFullScreenForElement): Pass a reference.
+        (WebCore::Document::webkitExitFullscreen): Ditto.
+        (WebCore::Document::webkitWillEnterFullScreen): Renamed to remove the
+        "ForElement" from the function name. Take a reference rather than a pointer.
+        (WebCore::Document::webkitDidEnterFullScreen): Renamed to remove the
+        "ForElement" from the function name and removed the unused element argument.
+        (WebCore::Document::webkitWillExitFullScreen): Ditto.
+        (WebCore::Document::webkitDidExitFullScreen): Ditto.
+        (WebCore::Document::pushFullscreenElementStack): Take a reference.
+        (WebCore::Document::addDocumentToFullScreenChangeEventQueue): Ditto.
+        (WebCore::DocumentParserYieldToken::DocumentParserYieldToken): Use a reference.
+        (WebCore::DocumentParserYieldToken::~DocumentParserYieldToken): Ditto.
+        (WebCore::Document::updateHoverActiveState): Updated name of isInActiveChain.
+
+        * dom/Document.h: Updated argument types as described above. Changed a couple
+        of inline functions to return references.
+
+        * dom/DocumentMarkerController.cpp:
+        (WebCore::DocumentMarkerController::addMarker): Take a reference.
+        (WebCore::DocumentMarkerController::addMarkerToNode): Ditto.
+        (WebCore::DocumentMarkerController::addTextMatchMarker): Ditto.
+        (WebCore::DocumentMarkerController::addDictationPhraseWithAlternativesMarker): Ditto.
+        (WebCore::DocumentMarkerController::addDictationResultMarker): Ditto.
+        (WebCore::DocumentMarkerController::addDraggedContentMarker): Ditto.
+        (WebCore::DocumentMarkerController::removeMarkers): Ditto.
+        (WebCore::DocumentMarkerController::copyMarkers): Ditto.
+        (WebCore::DocumentMarkerController::shiftMarkers): Ditto.
+        (WebCore::DocumentMarkerController::setMarkersActive): DItto.
+        * dom/DocumentMarkerController.h: Updated argument types as described above.
+
+        * dom/Element.cpp:
+        (WebCore::Element::~Element): Pass a reference.
+        (WebCore::Element::isUserActionElementInActiveChain const): Updated name of
+        isInActiveChain.
+        (WebCore::Element::hasEquivalentAttributes const): Take a reference.
+        (WebCore::Element::removedFromAncestor): Pass a reference.
+        (WebCore::Element::clearHoverAndActiveStatusBeforeDetachingRenderer):
+        Pass a reference and updated name of isInActiveChain.
+
+        * dom/Element.h: Renamed inActiveChain to isInActiveChain, updated argument
+        types to be references, and removed unneeded friend declaration and made
+        SynchronizationOfLazyAttribute private.
+
+        * dom/Node.cpp:
+        (WebCore::Node::normalize): Pass a reference.
+        (WebCore::Node::isEqualNode const): Ditto.
+        * dom/NodeIterator.cpp:
+        (WebCore::NodeIterator::NodeIterator): Ditto.
+        (WebCore::NodeIterator::~NodeIterator): Ditto.
+
+        * dom/RadioButtonGroups.cpp:
+        (WebCore::RadioButtonGroup::add): Take a reference.
+        (WebCore::RadioButtonGroup::updateCheckedState): Ditto.
+        (WebCore::RadioButtonGroup::remove): Ditto.
+        (WebCore::RadioButtonGroup::contains const): Ditto.
+        (WebCore::RadioButtonGroups::addButton): Ditto.
+        (WebCore::RadioButtonGroups::updateCheckedState): Ditto.
+        (WebCore::RadioButtonGroups::hasCheckedButton const): Ditto.
+        (WebCore::RadioButtonGroups::isInRequiredGroup const): Ditto.
+        (WebCore::RadioButtonGroups::removeButton): Ditto.
+        * dom/RadioButtonGroups.h: Updated argument types.
+
+        * dom/Range.cpp:
+        (WebCore::Range::Range): Pass a reference.
+        (WebCore::Range::~Range): Ditto.
+        (WebCore::Range::setDocument): Ditto.
+        (WebCore::Range::createContextualFragment): Ditto.
+        (WebCore::boundaryTextInserted): Ditto.
+        (WebCore::Range::textInserted): Ditto.
+        (WebCore::boundaryTextRemoved): Ditto.
+        (WebCore::Range::textRemoved): Ditto.
+        (WebCore::boundaryTextNodesSplit): Ditto.
+        (WebCore::Range::textNodeSplit): Ditto.
+        * dom/Range.h: Take references instead of pointers.
+
+        * dom/ScriptElement.cpp:
+        (WebCore::ScriptElement::prepareScript): Use reference.
+
+        * dom/Text.cpp:
+        (WebCore::Text::splitText): Pass reference.
+
+        * dom/UserActionElementSet.h: Renamed inActiveChain to isInActiveChain to
+        match the naming scheme of the other similar functions, like isActive.
+
+        * editing/AlternativeTextController.cpp:
+        (WebCore::AlternativeTextController::applyAlternativeTextToRange):
+        Pass a reference.
+        (WebCore::AlternativeTextController::respondToUnappliedSpellCorrection): Ditto.
+        (WebCore::AlternativeTextController::handleAlternativeTextUIResult): Ditto.
+        (WebCore::AlternativeTextController::respondToUnappliedEditing): Ditto.
+        (WebCore::AlternativeTextController::markReversed): Ditto.
+        (WebCore::AlternativeTextController::markCorrection): Ditto.
+        (WebCore::AlternativeTextController::recordSpellcheckerResponseForModifiedCorrection): Ditto.
+        (WebCore::AlternativeTextController::markPrecedingWhitespaceForDeletedAutocorrectionAfterCommand): Ditto.
+        * editing/CompositeEditCommand.cpp:
+        (WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers): Ditto.
+        * editing/DictationCommand.cpp: Ditto.
+        * editing/Editing.cpp:
+        (WebCore::areIdenticalElements): Ditto.
+        * editing/Editor.cpp:
+        (WebCore::Editor::ignoreSpelling): Ditto.
+        (WebCore::Editor::learnSpelling): Ditto.
+        (WebCore::Editor::advanceToNextMisspelling): Ditto.
+        (WebCore::Editor::clearMisspellingsAndBadGrammar): Ditto.
+        (WebCore::Editor::markMisspellingsAfterTypingToWord): Ditto.
+        (WebCore::Editor::markAndReplaceFor): Ditto.
+        (WebCore::Editor::changeBackToReplacedString): Ditto.
+        (WebCore::Editor::updateMarkersForWordsAffectedByEditing): Ditto.
+        (WebCore::Editor::countMatchesForText): Ditto.
+        (WebCore::Editor::scanRangeForTelephoneNumbers): Ditto.
+        (WebCore::Editor::editorUIUpdateTimerFired): Ditto.
+        (WebCore::Editor::handleAcceptedCandidate): Ditto.
+
+        * editing/InsertTextCommand.cpp:
+        (WebCore::InsertTextCommand::doApply): Pass a reference.
+        * editing/InsertTextCommand.h: Take a reference.
+
+        * editing/SpellChecker.cpp:
+        (WebCore::SpellChecker::didCheckSucceed): Pass a reference.
+        * editing/SplitTextNodeCommand.cpp:
+        (WebCore::SplitTextNodeCommand::doApply): Ditto.
+        (WebCore::SplitTextNodeCommand::doUnapply): Ditto.
+        * editing/TextCheckingHelper.cpp:
+        (WebCore::TextCheckingHelper::findFirstMisspelling): Pass a reference.
+        (WebCore::TextCheckingHelper::findFirstGrammarDetail const): Ditto.
+        * editing/ios/DictationCommandIOS.cpp:
+        (WebCore::DictationCommandIOS::doApply): Ditto.
+        Also added a comment about a possible missing null check; behavior should
+        be no different than before, but using a reference helps make clear there
+        was never any null check.
+        * editing/ios/EditorIOS.mm:
+        (WebCore::Editor::setDictationPhrasesAsChildOfElement): Ditto.
+        * fileapi/FileReader.cpp:
+        (WebCore::FileReader::readInternal): Ditto.
+        (WebCore::FileReader::abort): Ditto.
+        (WebCore::FileReader::didFinishLoading): Ditto.
+        (WebCore::FileReader::didFail): Ditto.
+
+        * html/HTMLAppletElement.cpp: Removed unneeded include of HTMLDocument.h.
+        There's very little left that is truly specific to HTMLDocument vs. Document.
+
+        * html/HTMLDocument.h:
+        (WebCore::HTMLDocument::create): Take a reference.
+        (WebCore::HTMLDocument::createSynthesizedDocument): Ditto.
+
+        * html/HTMLFormElement.cpp:
+        (WebCore::HTMLFormElement::~HTMLFormElement): Pass a reference.
+        (WebCore::HTMLFormElement::parseAttribute): Ditto.
+        (WebCore::HTMLFormElement::didMoveToNewDocument): Ditto.
+
+        * html/HTMLIFrameElement.cpp: Removed unneeded include of HTMLDocument.h.
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::~HTMLInputElement): Pass a reference.
+        (WebCore::HTMLInputElement::setChecked): Ditto.
+        (WebCore::HTMLInputElement::registerForSuspensionCallbackIfNeeded): Ditto.
+        (WebCore::HTMLInputElement::unregisterForSuspensionCallbackIfNeeded): Ditto.
+        (WebCore::HTMLInputElement::didMoveToNewDocument): Ditto.
+        (WebCore::HTMLInputElement::isInRequiredRadioButtonGroup): Ditto.
+        (WebCore::HTMLInputElement::addToRadioButtonGroup): Ditto.
+        (WebCore::HTMLInputElement::removeFromRadioButtonGroup): Ditto.
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::registerWithDocument): Ditto.
+        (WebCore::HTMLMediaElement::unregisterWithDocument): Ditto.
+        (WebCore::HTMLMediaElement::selectMediaResource): Ditto.
+        (WebCore::HTMLMediaElement::addTextTrack): Ditto.
+        (WebCore::HTMLMediaElement::clearMediaPlayer): Ditto.
+        (WebCore::HTMLMediaElement::resume): Ditto.
+        (WebCore::HTMLMediaElement::setMediaControlsDependOnPageScaleFactor): Ditto.
+
+        * html/HTMLNameCollection.cpp: Removed unneeded include of HTMLDocument.h.
+
+        * html/HTMLPlugInImageElement.cpp:
+        (WebCore::HTMLPlugInImageElement::~HTMLPlugInImageElement): Pass a reference.
+        (WebCore::HTMLPlugInImageElement::createElementRenderer): Ditto.
+        (WebCore::HTMLPlugInImageElement::didMoveToNewDocument): Ditto.
+
+        * html/HTMLSourceElement.cpp: Removed unneeded include of HTMLDocument.h.
+        * html/HTMLTemplateElement.cpp: Ditto.
+
+        * html/RadioInputType.cpp:
+        (WebCore::RadioInputType::matchesIndeterminatePseudoClass const):
+        Pass a reference.
+        * loader/DocumentWriter.cpp:
+        (WebCore::DocumentWriter::begin): Ditto.
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::addEventListener): Ditto.
+        (WebCore::DOMWindow::removeEventListener): Ditto.
+        (WebCore::DOMWindow::removeAllEventListeners): Ditto.
+
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::didStartDrag): Use a reference.
+
+        * page/EventSource.cpp:
+        (WebCore::EventSource::create): Pass reference.
+        (WebCore::EventSource::networkRequestEnded): Ditto.
+        (WebCore::EventSource::close): Ditto.
+        (WebCore::EventSource::abortConnectionAttempt): Ditto.
+
+        * page/Frame.cpp: Removed unneeded include of HTMLDocument.h.
+        * page/FrameView.cpp: Ditto.
+        (WebCore::FrameView::qualifiesAsVisuallyNonEmpty const): Use reference.
+
+        * page/animation/AnimationBase.cpp:
+        (WebCore::AnimationBase::updateStateMachine): Pass reference.
+
+        * page/animation/CSSAnimationController.cpp:
+        (WebCore::CSSAnimationControllerPrivate::addToAnimationsWaitingForStyle): Take reference.
+        (WebCore::CSSAnimationControllerPrivate::removeFromAnimationsWaitingForStyle): Ditto.
+        (WebCore::CSSAnimationControllerPrivate::addToAnimationsWaitingForStartTimeResponse): Ditto.
+        (WebCore::CSSAnimationControllerPrivate::removeFromAnimationsWaitingForStartTimeResponse): Ditto.
+        (WebCore::CSSAnimationControllerPrivate::animationWillBeRemoved): Ditto.
+        * page/animation/CSSAnimationControllerPrivate.h: Ditto.
+
+        * page/animation/CompositeAnimation.cpp:
+        (WebCore::CompositeAnimation::clearElement): Pass reference.
+        (WebCore::CompositeAnimation::updateTransitions): Ditto.
+        (WebCore::CompositeAnimation::updateKeyframeAnimations): Ditto.
+        * page/ios/FrameIOS.mm:
+        (WebCore::Frame::initWithSimpleHTMLDocument): Ditto.
+
+        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
+        (WebCore::layerContentsFormat): Add ALLOW_DEPRECATED_DECLARATIONS_BEGIN/END so
+        I can continue to compile with latest headers.
+
+        * rendering/CSSFilter.cpp:
+        (WebCore::CSSFilter::buildReferenceFilter): Pass reference, small coding style
+        tweaks as well.
+
+        * rendering/svg/RenderSVGResource.cpp:
+        (WebCore::removeFromCacheAndInvalidateDependencies): Pass reference.
+        * rendering/svg/RenderSVGResourceContainer.cpp:
+        (WebCore::RenderSVGResourceContainer::registerResource): Ditto.
+        * rendering/svg/SVGResources.cpp:
+        (WebCore::registerPendingResource): Ditto.
+        * rendering/svg/SVGResourcesCache.cpp:
+        (WebCore::SVGResourcesCache::resourceDestroyed): Ditto.
+
+        * svg/SVGDocumentExtensions.cpp:
+        (WebCore::SVGDocumentExtensions::addTimeContainer): Take reference.
+        (WebCore::SVGDocumentExtensions::removeTimeContainer): Ditto.
+        (WebCore::SVGDocumentExtensions::addResource): Ditto.
+        (WebCore::SVGDocumentExtensions::addPendingResource): Ditto.
+        (WebCore::SVGDocumentExtensions::isElementWithPendingResources const): Ditto.
+        (WebCore::SVGDocumentExtensions::isPendingResource const): Ditto.
+        (WebCore::SVGDocumentExtensions::clearHasPendingResourcesIfPossible): Ditto.
+        (WebCore::SVGDocumentExtensions::removeElementFromPendingResources): Ditto.
+        (WebCore::SVGDocumentExtensions::setOfElementsReferencingTarget): Ditto.
+        (WebCore::SVGDocumentExtensions::addElementReferencingTarget): Ditto.
+        (WebCore::SVGDocumentExtensions::removeAllTargetReferencesForElement): Ditto.
+        (WebCore::SVGDocumentExtensions::clearTargetDependencies): Ditto.
+        (WebCore::SVGDocumentExtensions::removeAllElementReferencesForTarget): Ditto.
+        (WebCore::SVGDocumentExtensions::registerSVGFontFaceElement): Ditto.
+        (WebCore::SVGDocumentExtensions::unregisterSVGFontFaceElement): Ditto.
+        * svg/SVGDocumentExtensions.h: Ditto.
+
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::~SVGElement): Pass reference.
+        (WebCore::SVGElement::removedFromAncestor): Ditto.
+        (WebCore::SVGElement::buildPendingResourcesIfNeeded): Ditto.
+        * svg/SVGFEImageElement.cpp:
+        (WebCore::SVGFEImageElement::clearResourceReferences): Ditto.
+        (WebCore::SVGFEImageElement::buildPendingResource): Ditto.
+        * svg/SVGFontFaceElement.cpp:
+        (WebCore::SVGFontFaceElement::insertedIntoAncestor): Ditto.
+        (WebCore::SVGFontFaceElement::removedFromAncestor): Ditto.
+        * svg/SVGMPathElement.cpp:
+        (WebCore::SVGMPathElement::buildPendingResource): Ditto.
+        (WebCore::SVGMPathElement::clearResourceReferences): Ditto.
+        * svg/SVGPathElement.cpp:
+        (WebCore::SVGPathElement::invalidateMPathDependencies): Ditto.
+        * svg/SVGSVGElement.cpp:
+        (WebCore::SVGSVGElement::SVGSVGElement): Ditto.
+        (WebCore::SVGSVGElement::~SVGSVGElement): Ditto.
+        (WebCore::SVGSVGElement::didMoveToNewDocument): Ditto.
+        (WebCore::SVGSVGElement::insertedIntoAncestor): Ditto.
+        (WebCore::SVGSVGElement::removedFromAncestor): Ditto.
+        * svg/SVGTRefElement.cpp:
+        (WebCore::SVGTRefElement::detachTarget): Ditto.
+        (WebCore::SVGTRefElement::buildPendingResource): Ditto.
+        * svg/SVGTextPathElement.cpp:
+        (WebCore::SVGTextPathElement::clearResourceReferences): Ditto.
+        (WebCore::SVGTextPathElement::buildPendingResource): Ditto.
+        * svg/SVGUseElement.cpp:
+        (WebCore::SVGUseElement::updateShadowTree): Ditto.
+        * svg/animation/SVGSMILElement.cpp:
+        (WebCore::SVGSMILElement::clearResourceReferences): Ditto.
+        (WebCore::SVGSMILElement::buildPendingResource): Ditto.
+        * testing/Internals.cpp:
+        (WebCore::Internals::addTextMatchMarker): Ditto.
+        (WebCore::Internals::webkitWillEnterFullScreenForElement): Ditto.
+        (WebCore::Internals::webkitDidEnterFullScreenForElement): Ditto.
+        (WebCore::Internals::webkitWillExitFullScreenForElement): Ditto.
+        (WebCore::Internals::webkitDidExitFullScreenForElement): Ditto.
+        * workers/Worker.cpp:
+        (WebCore::Worker::create): Ditto.
+        (WebCore::Worker::notifyFinished): Ditto.
+        * workers/service/ServiceWorkerContainer.cpp:
+        (WebCore::ServiceWorkerContainer::scheduleJob): Ditto.
+        (WebCore::ServiceWorkerContainer::jobDidFinish): Ditto.
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::prepareToSend): Ditto.
+        (WebCore::XMLHttpRequest::createRequest): Ditto.
+        (WebCore::XMLHttpRequest::internalAbort): Ditto.
+        (WebCore::XMLHttpRequest::networkErrorTimerFired): Ditto.
+        (WebCore::XMLHttpRequest::didFail): Ditto.
+        (WebCore::XMLHttpRequest::didFinishLoading): Ditto.
+
+        * xml/XPathStep.cpp: Removed unneeded include of HTMLDocument.h.
+        (WebCore::XPath::nodeMatchesBasicTest): Changed code to call isHTMLDocument
+        rather than is<HTMLDocument> since this is not a type check for a downcast,
+        but rather a behavioral difference that does not depend on any of the data
+        stored in an HTMLDocument or the use of a distinct C++ class for it.
+
+        * xml/XSLTProcessor.cpp:
+        (WebCore::XSLTProcessor::createDocumentFromSource): Pass a reference.
+
 2019-01-21  David Kilzer  <ddkilzer@apple.com>
 
         Switch remaining VideoToolbox soft-linking in WebCore over to VideoToolboxSoftLink.{cpp,h}
index 74f67cc..06c0fae 100644 (file)
@@ -545,7 +545,7 @@ ExceptionOr<void> ApplePaySession::begin()
 
     m_state = State::Active;
 
-    setPendingActivity(this);
+    setPendingActivity(*this);
 
     return { };
 }
@@ -652,7 +652,7 @@ ExceptionOr<void> ApplePaySession::completePayment(ApplePayPaymentAuthorizationR
     }
 
     m_state = State::Completed;
-    unsetPendingActivity(this);
+    unsetPendingActivity(*this);
 
     return { };
 }
@@ -1047,7 +1047,7 @@ bool ApplePaySession::isFinalState() const
 void ApplePaySession::didReachFinalState()
 {
     ASSERT(isFinalState());
-    unsetPendingActivity(this);
+    unsetPendingActivity(*this);
 }
 
 }
index 19ba194..41fd62d 100644 (file)
@@ -431,7 +431,7 @@ void DOMCache::keys(Optional<RequestInfo>&& info, CacheQueryOptions&& options, K
 
 void DOMCache::retrieveRecords(const URL& url, WTF::Function<void(Optional<Exception>&&)>&& callback)
 {
-    setPendingActivity(this);
+    setPendingActivity(*this);
 
     URL retrieveURL = url;
     retrieveURL.removeQueryAndFragmentIdentifier();
@@ -447,7 +447,7 @@ void DOMCache::retrieveRecords(const URL& url, WTF::Function<void(Optional<Excep
                 updateRecords(WTFMove(result.value()));
             callback(WTF::nullopt);
         }
-        unsetPendingActivity(this);
+        unsetPendingActivity(*this);
     });
 }
 
@@ -484,7 +484,7 @@ Vector<CacheStorageRecord> DOMCache::queryCacheWithTargetStorage(const FetchRequ
 
 void DOMCache::batchDeleteOperation(const FetchRequest& request, CacheQueryOptions&& options, WTF::Function<void(ExceptionOr<bool>&&)>&& callback)
 {
-    setPendingActivity(this);
+    setPendingActivity(*this);
     m_connection->batchDeleteOperation(m_identifier, request.internalRequest(), WTFMove(options), [this, callback = WTFMove(callback)](RecordIdentifiersOrError&& result) {
         if (!m_isStopped) {
             if (!result.has_value())
@@ -492,7 +492,7 @@ void DOMCache::batchDeleteOperation(const FetchRequest& request, CacheQueryOptio
             else
                 callback(!result.value().isEmpty());
         }
-        unsetPendingActivity(this);
+        unsetPendingActivity(*this);
     });
 }
 
@@ -527,7 +527,7 @@ void DOMCache::batchPutOperation(const FetchRequest& request, FetchResponse& res
 
 void DOMCache::batchPutOperation(Vector<Record>&& records, WTF::Function<void(ExceptionOr<void>&&)>&& callback)
 {
-    setPendingActivity(this);
+    setPendingActivity(*this);
     m_connection->batchPutOperation(m_identifier, WTFMove(records), [this, callback = WTFMove(callback)](RecordIdentifiersOrError&& result) {
         if (!m_isStopped) {
             if (!result.has_value())
@@ -535,7 +535,7 @@ void DOMCache::batchPutOperation(Vector<Record>&& records, WTF::Function<void(Ex
             else
                 callback({ });
         }
-        unsetPendingActivity(this);
+        unsetPendingActivity(*this);
     });
 }
 
index 87062d1..359918d 100644 (file)
@@ -101,7 +101,7 @@ void DOMCacheStorage::match(DOMCache::RequestInfo&& info, CacheQueryOptions&& op
             return;
         }
 
-        setPendingActivity(this);
+        setPendingActivity(*this);
         startSequentialMatch(WTF::map(m_caches, copyCache), WTFMove(info), WTFMove(options), [this, promise = WTFMove(promise)](ExceptionOr<FetchResponse*>&& result) mutable {
             if (!m_isStopped) {
                 if (result.hasException()) {
@@ -113,7 +113,7 @@ void DOMCacheStorage::match(DOMCache::RequestInfo&& info, CacheQueryOptions&& op
                 else
                     promise->resolve<IDLInterface<FetchResponse>>(*result.returnValue());
             }
-            unsetPendingActivity(this);
+            unsetPendingActivity(*this);
         });
     });
 }
index 017a4f5..e932636 100644 (file)
@@ -248,7 +248,7 @@ void FetchBodyOwner::loadBlob(const Blob& blob, FetchBodyConsumer* consumer)
         m_blobLoader = WTF::nullopt;
         return;
     }
-    setPendingActivity(this);
+    setPendingActivity(*this);
 }
 
 void FetchBodyOwner::finishBlobLoading()
@@ -256,7 +256,7 @@ void FetchBodyOwner::finishBlobLoading()
     ASSERT(m_blobLoader);
 
     m_blobLoader = WTF::nullopt;
-    unsetPendingActivity(this);
+    unsetPendingActivity(*this);
 }
 
 void FetchBodyOwner::blobLoadingSucceeded()
index 6699ef4..a8a2a41 100644 (file)
@@ -42,14 +42,14 @@ void FetchBodySource::setActive()
 {
     ASSERT(m_bodyOwner);
     if (m_bodyOwner)
-        m_bodyOwner->setPendingActivity(m_bodyOwner);
+        m_bodyOwner->setPendingActivity(*m_bodyOwner);
 }
 
 void FetchBodySource::setInactive()
 {
     ASSERT(m_bodyOwner);
     if (m_bodyOwner)
-        m_bodyOwner->unsetPendingActivity(m_bodyOwner);
+        m_bodyOwner->unsetPendingActivity(*m_bodyOwner);
 }
 
 void FetchBodySource::doStart()
index 33d9a34..e2a45a4 100644 (file)
@@ -314,12 +314,12 @@ FetchResponse::BodyLoader::BodyLoader(FetchResponse& response, NotificationCallb
     : m_response(response)
     , m_responseCallback(WTFMove(responseCallback))
 {
-    m_response.setPendingActivity(&m_response);
+    m_response.setPendingActivity(m_response);
 }
 
 FetchResponse::BodyLoader::~BodyLoader()
 {
-    m_response.unsetPendingActivity(&m_response);
+    m_response.unsetPendingActivity(m_response);
 }
 
 static uint64_t nextOpaqueLoadIdentifier { 0 };
index 5539946..3986198 100644 (file)
@@ -133,12 +133,12 @@ void MediaSource::setPrivateAndOpen(Ref<MediaSourcePrivate>&& mediaSourcePrivate
 
 void MediaSource::addedToRegistry()
 {
-    setPendingActivity(this);
+    setPendingActivity(*this);
 }
 
 void MediaSource::removedFromRegistry()
 {
-    unsetPendingActivity(this);
+    unsetPendingActivity(*this);
 }
 
 MediaTime MediaSource::duration() const
index 8ac1457..18f2587 100644 (file)
@@ -123,7 +123,7 @@ MediaStream::~MediaStream()
         track->removeObserver(*this);
     if (Document* document = this->document()) {
         if (m_isWaitingUntilMediaCanStart)
-            document->removeMediaCanStartListener(this);
+            document->removeMediaCanStartListener(*this);
     }
 }
 
@@ -282,7 +282,7 @@ void MediaStream::startProducingData()
             return;
 
         m_isWaitingUntilMediaCanStart = true;
-        document->addMediaCanStartListener(this);
+        document->addMediaCanStartListener(*this);
         return;
     }
 
index d83c5b7..506c145 100644 (file)
@@ -61,7 +61,7 @@ MediaStreamTrack::MediaStreamTrack(ScriptExecutionContext& context, Ref<MediaStr
     m_private->addObserver(*this);
 
     if (auto document = this->document())
-        document->addAudioProducer(this);
+        document->addAudioProducer(*this);
 }
 
 MediaStreamTrack::~MediaStreamTrack()
@@ -69,7 +69,7 @@ MediaStreamTrack::~MediaStreamTrack()
     m_private->removeObserver(*this);
 
     if (auto document = this->document())
-        document->removeAudioProducer(this);
+        document->removeAudioProducer(*this);
 }
 
 const AtomicString& MediaStreamTrack::kind() const
index 90d1c8a..e027bb5 100644 (file)
@@ -58,7 +58,7 @@ Ref<RTCDataChannel> RTCDataChannel::create(ScriptExecutionContext& context, std:
     auto channel = adoptRef(*new RTCDataChannel(context, WTFMove(handler), WTFMove(label), WTFMove(options)));
     channel->suspendIfNeeded();
     channel->m_handler->setClient(channel.get());
-    channel->setPendingActivity(channel.ptr());
+    channel->setPendingActivity(channel.get());
     return channel;
 }
 
@@ -159,7 +159,7 @@ void RTCDataChannel::close()
 
     m_handler->close();
     m_handler = nullptr;
-    unsetPendingActivity(this);
+    unsetPendingActivity(*this);
 }
 
 void RTCDataChannel::didChangeReadyState(RTCDataChannelState newState)
index 4e4f06c..338dc1a 100644 (file)
@@ -64,7 +64,7 @@ using namespace PeerConnection;
 
 Ref<RTCPeerConnection> RTCPeerConnection::create(ScriptExecutionContext& context)
 {
-    Ref<RTCPeerConnection> peerConnection = adoptRef(*new RTCPeerConnection(context));
+    auto peerConnection = adoptRef(*new RTCPeerConnection(context));
     peerConnection->suspendIfNeeded();
     // RTCPeerConnection may send events at about any time during its lifetime.
     // Let's make it uncollectable until the pc is closed by JS or the page stops it.
index 1958db2..cc6aae2 100644 (file)
@@ -91,7 +91,7 @@ void Notification::show()
     }
     if (client.show(this)) {
         m_state = Showing;
-        setPendingActivity(this);
+        setPendingActivity(*this);
     }
 }
 
@@ -136,7 +136,7 @@ void Notification::finalize()
     if (m_state == Closed)
         return;
     m_state = Closed;
-    unsetPendingActivity(this);
+    unsetPendingActivity(*this);
 }
 
 void Notification::dispatchShowEvent()
index 27e56c4..055bff5 100644 (file)
@@ -99,7 +99,7 @@ void AudioBasicInspectorNode::updatePullStatus()
         // When an AudioBasicInspectorNode is connected to a downstream node, it will get pulled by the
         // downstream node, thus remove it from the context's automatic pull list.
         if (m_needAutomaticPull) {
-            context().removeAutomaticPullNode(this);
+            context().removeAutomaticPullNode(*this);
             m_needAutomaticPull = false;
         }
     } else {
@@ -107,11 +107,11 @@ void AudioBasicInspectorNode::updatePullStatus()
         if (numberOfInputConnections && !m_needAutomaticPull) {
             // When an AudioBasicInspectorNode is not connected to any downstream node while still connected from
             // upstream node(s), add it to the context's automatic pull list.
-            context().addAutomaticPullNode(this);
+            context().addAutomaticPullNode(*this);
             m_needAutomaticPull = true;
         } else if (!numberOfInputConnections && m_needAutomaticPull) {
             // The AudioBasicInspectorNode is connected to nothing, remove it from the context's automatic pull list.
-            context().removeAutomaticPullNode(this);
+            context().removeAutomaticPullNode(*this);
             m_needAutomaticPull = false;
         }
     }
index d940dc0..d8df3f5 100644 (file)
@@ -160,7 +160,7 @@ void AudioContext::constructCommon()
 {
     // According to spec AudioContext must die only after page navigate.
     // Lets mark it as ActiveDOMObject with pending activity and unmark it in clear method.
-    setPendingActivity(this);
+    setPendingActivity(*this);
 
     FFTFrame::initialize();
     
@@ -207,8 +207,8 @@ void AudioContext::lazyInitialize()
         m_destinationNode->initialize();
 
         if (!isOfflineContext()) {
-            document()->addAudioProducer(this);
-            document()->registerForVisibilityStateChangedCallbacks(this);
+            document()->addAudioProducer(*this);
+            document()->registerForVisibilityStateChangedCallbacks(*this);
 
             // This starts the audio thread. The destination node's provideInput() method will now be called repeatedly to render audio.
             // Each time provideInput() is called, a portion of the audio stream is rendered. Let's call this time period a "render quantum".
@@ -235,7 +235,7 @@ void AudioContext::clear()
     } while (m_nodesToDelete.size());
 
     // It was set in constructCommon.
-    unsetPendingActivity(this);
+    unsetPendingActivity(*this);
 }
 
 void AudioContext::uninitialize()
@@ -252,8 +252,8 @@ void AudioContext::uninitialize()
     m_isAudioThreadFinished = true;
 
     if (!isOfflineContext()) {
-        document()->removeAudioProducer(this);
-        document()->unregisterForVisibilityStateChangedCallbacks(this);
+        document()->removeAudioProducer(*this);
+        document()->unregisterForVisibilityStateChangedCallbacks(*this);
 
         ASSERT(s_hardwareContextCount);
         --s_hardwareContextCount;
@@ -816,14 +816,14 @@ void AudioContext::handleDeferredFinishDerefs()
     m_deferredFinishDerefList.clear();
 }
 
-void AudioContext::markForDeletion(AudioNode* node)
+void AudioContext::markForDeletion(AudioNode& node)
 {
     ASSERT(isGraphOwner());
 
     if (isAudioThreadFinished())
-        m_nodesToDelete.append(node);
+        m_nodesToDelete.append(&node);
     else
-        m_nodesMarkedForDeletion.append(node);
+        m_nodesMarkedForDeletion.append(&node);
 
     // This is probably the best time for us to remove the node from automatic pull list,
     // since all connections are gone and we hold the graph lock. Then when handlePostRenderTasks()
@@ -920,19 +920,19 @@ void AudioContext::handleDirtyAudioNodeOutputs()
     m_dirtyAudioNodeOutputs.clear();
 }
 
-void AudioContext::addAutomaticPullNode(AudioNode* node)
+void AudioContext::addAutomaticPullNode(AudioNode& node)
 {
     ASSERT(isGraphOwner());
 
-    if (m_automaticPullNodes.add(node).isNewEntry)
+    if (m_automaticPullNodes.add(&node).isNewEntry)
         m_automaticPullNodesNeedUpdating = true;
 }
 
-void AudioContext::removeAutomaticPullNode(AudioNode* node)
+void AudioContext::removeAutomaticPullNode(AudioNode& node)
 {
     ASSERT(isGraphOwner());
 
-    if (m_automaticPullNodes.remove(node))
+    if (m_automaticPullNodes.remove(&node))
         m_automaticPullNodesNeedUpdating = true;
 }
 
@@ -989,7 +989,7 @@ bool AudioContext::willBeginPlayback()
     if (pageConsentRequiredForAudioStart()) {
         Page* page = document()->page();
         if (page && !page->canStartMedia()) {
-            document()->addMediaCanStartListener(this);
+            document()->addMediaCanStartListener(*this);
             return false;
         }
         removeBehaviorRestriction(AudioContext::RequirePageConsentForAudioStartRestriction);
@@ -1009,7 +1009,7 @@ bool AudioContext::willPausePlayback()
     if (pageConsentRequiredForAudioStart()) {
         Page* page = document()->page();
         if (page && !page->canStartMedia()) {
-            document()->addMediaCanStartListener(this);
+            document()->addMediaCanStartListener(*this);
             return false;
         }
         removeBehaviorRestriction(AudioContext::RequirePageConsentForAudioStartRestriction);
index 4ef0b4d..49d3566 100644 (file)
@@ -156,13 +156,13 @@ public:
     void derefFinishedSourceNodes();
 
     // We schedule deletion of all marked nodes at the end of each realtime render quantum.
-    void markForDeletion(AudioNode*);
+    void markForDeletion(AudioNode&);
     void deleteMarkedNodes();
 
     // AudioContext can pull node(s) at the end of each render quantum even when they are not connected to any downstream nodes.
     // These two methods are called by the nodes who want to add/remove themselves into/from the automatic pull lists.
-    void addAutomaticPullNode(AudioNode*);
-    void removeAutomaticPullNode(AudioNode*);
+    void addAutomaticPullNode(AudioNode&);
+    void removeAutomaticPullNode(AudioNode&);
 
     // Called right before handlePostRenderTasks() to handle nodes which need to be pulled even when they are not connected to anything.
     void processAutomaticPullNodes(size_t framesToProcess);
index ad1351f..6139fdd 100644 (file)
@@ -477,7 +477,7 @@ void AudioNode::finishDeref(RefType refType)
                     output->disconnectAll(); // This will deref() nodes we're connected to.
 
                 // Mark for deletion at end of each render quantum or when context shuts down.
-                context().markForDeletion(this);
+                context().markForDeletion(*this);
                 m_isMarkedForDeletion = true;
             }
         } else if (refType == RefTypeConnection)
index 26d38ff..5027db6 100644 (file)
@@ -287,8 +287,8 @@ ExceptionOr<void> WebSocket::connect(const String& url, const Vector<String>& pr
         Document& document = downcast<Document>(context);
         RefPtr<Frame> frame = document.frame();
         if (!frame || !frame->loader().mixedContentChecker().canRunInsecureContent(document.securityOrigin(), m_url)) {
-            // Balanced by the call to ActiveDOMObject::unsetPendingActivity() in WebSocket::stop().
-            ActiveDOMObject::setPendingActivity(this);
+            // Balanced by the call to unsetPendingActivity() in WebSocket::stop().
+            setPendingActivity(*this);
 
             // We must block this connection. Instead of throwing an exception, we indicate this
             // using the error event. But since this code executes as part of the WebSocket's
@@ -318,7 +318,7 @@ ExceptionOr<void> WebSocket::connect(const String& url, const Vector<String>& pr
         protocolString = joinStrings(protocols, subprotocolSeparator());
 
     m_channel->connect(m_url, protocolString);
-    ActiveDOMObject::setPendingActivity(this);
+    setPendingActivity(*this);
 
     return { };
 }
@@ -547,7 +547,7 @@ void WebSocket::stop()
     m_pendingEvents.clear();
     ActiveDOMObject::stop();
     if (pending)
-        ActiveDOMObject::unsetPendingActivity(this);
+        unsetPendingActivity(*this);
 }
 
 const char* WebSocket::activeDOMObjectName() const
@@ -631,7 +631,7 @@ void WebSocket::didClose(unsigned unhandledBufferedAmount, ClosingHandshakeCompl
         m_channel = nullptr;
     }
     if (hasPendingActivity())
-        ActiveDOMObject::unsetPendingActivity(this);
+        unsetPendingActivity(*this);
 }
 
 void WebSocket::didUpgradeURL()
index b5dee9c..38c40b8 100644 (file)
                        isa = PBXGroup;
                        children = (
                                A584FE2518637DAB00843B10 /* CommandLineAPIModuleSource.h */,
+                               9175CE5921E281EC00DF2C28 /* InspectorAuditAccessibilityObject.cpp */,
+                               9175CE5A21E281ED00DF2C28 /* InspectorAuditAccessibilityObject.h */,
+                               9175CE5721E281EB00DF2C28 /* InspectorAuditDOMObject.cpp */,
+                               9175CE5821E281EC00DF2C28 /* InspectorAuditDOMObject.h */,
                                A584FE391864E2D800843B10 /* JSCommandLineAPIHost.cpp */,
                                A584FE3A1864E2D800843B10 /* JSCommandLineAPIHost.h */,
-                               9175CE5921E281EC00DF2C28 /* JSInspectorAuditAccessibilityObject.cpp */,
-                               9175CE5A21E281ED00DF2C28 /* JSInspectorAuditAccessibilityObject.h */,
-                               9175CE5721E281EB00DF2C28 /* JSInspectorAuditDOMObject.cpp */,
-                               9175CE5821E281EC00DF2C28 /* JSInspectorAuditDOMObject.h */,
                                7A0E771C10C00DB100A0276E /* JSInspectorFrontendHost.cpp */,
                                7A0E771D10C00DB100A0276E /* JSInspectorFrontendHost.h */,
                        );
                                93309DF2099E64920056E581 /* InsertTextCommand.h in Headers */,
                                A5B81CA71FAA44620037D1E6 /* InspectorApplicationCacheAgent.h in Headers */,
                                9175CE5E21E281ED00DF2C27 /* InspectorAuditAccessibilityObject.h in Headers */,
+                               9175CE5E21E281ED00DF2C28 /* InspectorAuditAccessibilityObject.h in Headers */,
                                9175CE5C21E281ED00DF2C27 /* InspectorAuditDOMObject.h in Headers */,
+                               9175CE5C21E281ED00DF2C28 /* InspectorAuditDOMObject.h in Headers */,
                                6A22E8701F10418600F546C3 /* InspectorCanvas.h in Headers */,
                                A5B81CA81FAA44620037D1E6 /* InspectorCanvasAgent.h in Headers */,
                                1C81B95C0E97330800266E07 /* InspectorClient.h in Headers */,
                                A77979290D6B9E64003851B9 /* JSImageData.h in Headers */,
                                7C193C011F5E11050088F3E6 /* JSImageSmoothingQuality.h in Headers */,
                                A86629D309DA2B48009633A6 /* JSInputEvent.h in Headers */,
-                               9175CE5E21E281ED00DF2C28 /* JSInspectorAuditAccessibilityObject.h in Headers */,
-                               9175CE5C21E281ED00DF2C28 /* JSInspectorAuditDOMObject.h in Headers */,
                                7A0E771F10C00DB100A0276E /* JSInspectorFrontendHost.h in Headers */,
                                0F4710E61DB700C7002DCEC3 /* JSIntersectionObserver.h in Headers */,
                                0F8B45761DC41DBA00443C3F /* JSIntersectionObserverCallback.h in Headers */,
                                Spanish,
                                Dutch,
                                Italian,
+                               en,
                        );
                        mainGroup = 0867D691FE84028FC02AAC07 /* WebCore */;
                        productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
index c74334e..f48234a 100644 (file)
@@ -306,7 +306,7 @@ JSC::Identifier JSDOMWindowBase::moduleLoaderResolve(JSC::JSGlobalObject* global
 {
     JSDOMWindowBase* thisObject = JSC::jsCast<JSDOMWindowBase*>(globalObject);
     if (RefPtr<Document> document = thisObject->wrapped().document())
-        return document->moduleLoader()->resolve(globalObject, exec, moduleLoader, moduleName, importerModuleKey, scriptFetcher);
+        return document->moduleLoader().resolve(globalObject, exec, moduleLoader, moduleName, importerModuleKey, scriptFetcher);
     return { };
 }
 
@@ -316,7 +316,7 @@ JSC::JSInternalPromise* JSDOMWindowBase::moduleLoaderFetch(JSC::JSGlobalObject*
     auto scope = DECLARE_THROW_SCOPE(vm);
     JSDOMWindowBase* thisObject = JSC::jsCast<JSDOMWindowBase*>(globalObject);
     if (RefPtr<Document> document = thisObject->wrapped().document())
-        RELEASE_AND_RETURN(scope, document->moduleLoader()->fetch(globalObject, exec, moduleLoader, moduleKey, parameters, scriptFetcher));
+        RELEASE_AND_RETURN(scope, document->moduleLoader().fetch(globalObject, exec, moduleLoader, moduleKey, parameters, scriptFetcher));
     JSC::JSInternalPromiseDeferred* deferred = JSC::JSInternalPromiseDeferred::tryCreate(exec, globalObject);
     RETURN_IF_EXCEPTION(scope, nullptr);
     RELEASE_AND_RETURN(scope, deferred->reject(exec, jsUndefined()));
@@ -326,7 +326,7 @@ JSC::JSValue JSDOMWindowBase::moduleLoaderEvaluate(JSC::JSGlobalObject* globalOb
 {
     JSDOMWindowBase* thisObject = JSC::jsCast<JSDOMWindowBase*>(globalObject);
     if (RefPtr<Document> document = thisObject->wrapped().document())
-        return document->moduleLoader()->evaluate(globalObject, exec, moduleLoader, moduleKey, moduleRecord, scriptFetcher);
+        return document->moduleLoader().evaluate(globalObject, exec, moduleLoader, moduleKey, moduleRecord, scriptFetcher);
     return JSC::jsUndefined();
 }
 
@@ -336,7 +336,7 @@ JSC::JSInternalPromise* JSDOMWindowBase::moduleLoaderImportModule(JSC::JSGlobalO
     auto scope = DECLARE_THROW_SCOPE(vm);
     JSDOMWindowBase* thisObject = JSC::jsCast<JSDOMWindowBase*>(globalObject);
     if (RefPtr<Document> document = thisObject->wrapped().document())
-        RELEASE_AND_RETURN(scope, document->moduleLoader()->importModule(globalObject, exec, moduleLoader, moduleName, parameters, sourceOrigin));
+        RELEASE_AND_RETURN(scope, document->moduleLoader().importModule(globalObject, exec, moduleLoader, moduleName, parameters, sourceOrigin));
     JSC::JSInternalPromiseDeferred* deferred = JSC::JSInternalPromiseDeferred::tryCreate(exec, globalObject);
     RETURN_IF_EXCEPTION(scope, nullptr);
     RELEASE_AND_RETURN(scope, deferred->reject(exec, jsUndefined()));
@@ -346,7 +346,7 @@ JSC::JSObject* JSDOMWindowBase::moduleLoaderCreateImportMetaProperties(JSC::JSGl
 {
     JSDOMWindowBase* thisObject = JSC::jsCast<JSDOMWindowBase*>(globalObject);
     if (RefPtr<Document> document = thisObject->wrapped().document())
-        return document->moduleLoader()->createImportMetaProperties(globalObject, exec, moduleLoader, moduleKey, moduleRecord, scriptFetcher);
+        return document->moduleLoader().createImportMetaProperties(globalObject, exec, moduleLoader, moduleKey, moduleRecord, scriptFetcher);
     return constructEmptyObject(exec, globalObject->nullPrototypeObjectStructure());
 }
 
index 360ad21..ebdf586 100644 (file)
@@ -71,18 +71,18 @@ public:
     // It can, however, have a side effect of deleting an ActiveDOMObject.
     virtual void stop();
 
-    template<class T> void setPendingActivity(T* thisObject)
+    template<typename T> void setPendingActivity(T& thisObject)
     {
-        ASSERT(thisObject == this);
-        thisObject->ref();
+        ASSERT(&thisObject == this);
+        thisObject.ref();
         ++m_pendingActivityCount;
     }
 
-    template<class T> void unsetPendingActivity(T* thisObject)
+    template<typename T> void unsetPendingActivity(T& thisObject)
     {
         ASSERT(m_pendingActivityCount > 0);
         --m_pendingActivityCount;
-        thisObject->deref();
+        thisObject.deref();
     }
 
     template<class T>
index bf4d227..dff2ba8 100644 (file)
@@ -54,7 +54,7 @@ void CharacterData::setData(const String& data)
     unsigned oldLength = length();
 
     if (m_data == nonNullData && canUseSetDataOptimization(*this)) {
-        document().textRemoved(this, 0, oldLength);
+        document().textRemoved(*this, 0, oldLength);
         if (document().frame())
             document().frame()->selection().textWasReplaced(this, 0, oldLength, oldLength);
         return;
@@ -63,7 +63,7 @@ void CharacterData::setData(const String& data)
     Ref<CharacterData> protectedThis(*this);
 
     setDataAndUpdate(nonNullData, 0, oldLength, nonNullData.length());
-    document().textRemoved(this, 0, oldLength);
+    document().textRemoved(*this, 0, oldLength);
 }
 
 ExceptionOr<String> CharacterData::substringData(unsigned offset, unsigned count)
@@ -135,7 +135,7 @@ ExceptionOr<void> CharacterData::insertData(unsigned offset, const String& data)
 
     setDataAndUpdate(newStr, offset, 0, data.length());
 
-    document().textInserted(this, offset, data.length());
+    document().textInserted(*this, offset, data.length());
 
     return { };
 }
@@ -152,7 +152,7 @@ ExceptionOr<void> CharacterData::deleteData(unsigned offset, unsigned count)
 
     setDataAndUpdate(newStr, offset, count, 0);
 
-    document().textRemoved(this, offset, count);
+    document().textRemoved(*this, offset, count);
 
     return { };
 }
@@ -171,8 +171,8 @@ ExceptionOr<void> CharacterData::replaceData(unsigned offset, unsigned count, co
     setDataAndUpdate(newStr, offset, count, data.length());
 
     // update the markers for spell checking and grammar checking
-    document().textRemoved(this, offset, count);
-    document().textInserted(this, offset, data.length());
+    document().textRemoved(*this, offset, count);
+    document().textInserted(*this, offset, data.length());
 
     return { };
 }
index 58d23ed..b2999af 100644 (file)
@@ -45,6 +45,4 @@ public:
     virtual void deviceMotionControllerDestroyed() = 0;
 };
 
-void provideDeviceMotionTo(Page*, DeviceMotionClient*);
-
 } // namespace WebCore
index ff682ac..356084a 100644 (file)
 
 namespace WebCore {
 
-DeviceMotionController::DeviceMotionController(DeviceMotionClient* client)
+DeviceMotionController::DeviceMotionController(DeviceMotionClient& client)
     : DeviceController(client)
 {
-    ASSERT(m_client);
-    deviceMotionClient()->setController(this);
+    deviceMotionClient().setController(this);
 }
 
 #if PLATFORM(IOS_FAMILY)
-// FIXME: We should look to reconcile the iOS and OpenSource differences with this class
-// so that we can either remove these methods or remove the PLATFORM(IOS_FAMILY)-guard.
+
+// FIXME: We should look to reconcile the iOS vs. non-iOS differences with this class
+// so that we can either remove these functions or the PLATFORM(IOS_FAMILY)-guard.
+
 void DeviceMotionController::suspendUpdates()
 {
-    if (m_client)
-        m_client->stopUpdating();
+    m_client.stopUpdating();
 }
 
 void DeviceMotionController::resumeUpdates()
 {
-    if (m_client && !m_listeners.isEmpty())
-        m_client->startUpdating();
+    if (!m_listeners.isEmpty())
+        m_client.startUpdating();
 }
+
 #endif
     
 void DeviceMotionController::didChangeDeviceMotion(DeviceMotionData* deviceMotionData)
@@ -63,19 +64,19 @@ void DeviceMotionController::didChangeDeviceMotion(DeviceMotionData* deviceMotio
     dispatchDeviceEvent(DeviceMotionEvent::create(eventNames().devicemotionEvent, deviceMotionData));
 }
 
-DeviceMotionClient* DeviceMotionController::deviceMotionClient()
+DeviceMotionClient& DeviceMotionController::deviceMotionClient()
 {
-    return static_cast<DeviceMotionClient*>(m_client);
+    return static_cast<DeviceMotionClient&>(m_client);
 }
 
 bool DeviceMotionController::hasLastData()
 {
-    return deviceMotionClient()->lastMotion();
+    return deviceMotionClient().lastMotion();
 }
 
 RefPtr<Event> DeviceMotionController::getLastEvent()
 {
-    return DeviceMotionEvent::create(eventNames().devicemotionEvent, deviceMotionClient()->lastMotion());
+    return DeviceMotionEvent::create(eventNames().devicemotionEvent, deviceMotionClient().lastMotion());
 }
 
 const char* DeviceMotionController::supplementName()
@@ -95,9 +96,4 @@ bool DeviceMotionController::isActiveAt(Page* page)
     return false;
 }
 
-void provideDeviceMotionTo(Page* page, DeviceMotionClient* client)
-{
-    DeviceMotionController::provideTo(page, DeviceMotionController::supplementName(), std::make_unique<DeviceMotionController>(client));
-}
-
 } // namespace WebCore
index ff805c6..3f625aa 100644 (file)
@@ -37,7 +37,7 @@ class DeviceMotionData;
 class DeviceMotionController final : public DeviceController {
     WTF_MAKE_NONCOPYABLE(DeviceMotionController);
 public:
-    explicit DeviceMotionController(DeviceMotionClient*);
+    explicit DeviceMotionController(DeviceMotionClient&);
     virtual ~DeviceMotionController() = default;
 
 #if PLATFORM(IOS_FAMILY)
@@ -48,7 +48,7 @@ public:
 #endif
 
     void didChangeDeviceMotion(DeviceMotionData*);
-    DeviceMotionClient* deviceMotionClient();
+    DeviceMotionClient& deviceMotionClient();
 
     bool hasLastData() override;
     RefPtr<Event> getLastEvent() override;
index 5ca7013..67ee4c9 100644 (file)
@@ -45,6 +45,6 @@ public:
     virtual void deviceOrientationControllerDestroyed() = 0;
 };
 
-WEBCORE_EXPORT void provideDeviceOrientationTo(Page*, DeviceOrientationClient*);
+WEBCORE_EXPORT void provideDeviceOrientationTo(Page&, DeviceOrientationClient&);
 
 } // namespace WebCore
index 1425416..3362231 100644 (file)
 
 namespace WebCore {
 
-DeviceOrientationController::DeviceOrientationController(DeviceOrientationClient* client)
+DeviceOrientationController::DeviceOrientationController(DeviceOrientationClient& client)
     : DeviceController(client)
 {
-#if PLATFORM(IOS_FAMILY)
-    // FIXME: Temporarily avoid asserting while OpenSource is using a different design.
-    // We should reconcile the differences between OpenSource and iOS so that we can
-    // remove this code path.
-    if (m_client)
-        deviceOrientationClient()->setController(this);
-#else
-    ASSERT(m_client);
-    deviceOrientationClient()->setController(this);
-#endif
+    deviceOrientationClient().setController(this);
 }
 
 void DeviceOrientationController::didChangeDeviceOrientation(DeviceOrientationData* orientation)
@@ -55,35 +46,39 @@ void DeviceOrientationController::didChangeDeviceOrientation(DeviceOrientationDa
     dispatchDeviceEvent(DeviceOrientationEvent::create(eventNames().deviceorientationEvent, orientation));
 }
 
-DeviceOrientationClient* DeviceOrientationController::deviceOrientationClient()
+DeviceOrientationClient& DeviceOrientationController::deviceOrientationClient()
 {
-    return static_cast<DeviceOrientationClient*>(m_client);
+    return static_cast<DeviceOrientationClient&>(m_client);
 }
 
 #if PLATFORM(IOS_FAMILY)
-// FIXME: We should look to reconcile the iOS and OpenSource differences with this class
-// so that we can either remove these methods or remove the PLATFORM(IOS_FAMILY)-guard.
+
+// FIXME: We should look to reconcile the iOS and non-iOS differences with this class
+// so that we can either remove these functions or remove the PLATFORM(IOS_FAMILY)-guard.
+
 void DeviceOrientationController::suspendUpdates()
 {
-    if (m_client)
-        m_client->stopUpdating();
+    m_client.stopUpdating();
 }
 
 void DeviceOrientationController::resumeUpdates()
 {
-    if (m_client && !m_listeners.isEmpty())
-        m_client->startUpdating();
+    if (!m_listeners.isEmpty())
+        m_client.startUpdating();
 }
+
 #else
+
 bool DeviceOrientationController::hasLastData()
 {
-    return deviceOrientationClient()->lastOrientation();
+    return deviceOrientationClient().lastOrientation();
 }
 
 RefPtr<Event> DeviceOrientationController::getLastEvent()
 {
-    return DeviceOrientationEvent::create(eventNames().deviceorientationEvent, deviceOrientationClient()->lastOrientation());
+    return DeviceOrientationEvent::create(eventNames().deviceorientationEvent, deviceOrientationClient().lastOrientation());
 }
+
 #endif // PLATFORM(IOS_FAMILY)
 
 const char* DeviceOrientationController::supplementName()
@@ -103,9 +98,9 @@ bool DeviceOrientationController::isActiveAt(Page* page)
     return false;
 }
 
-void provideDeviceOrientationTo(Page* page, DeviceOrientationClient* client)
+void provideDeviceOrientationTo(Page& page, DeviceOrientationClient& client)
 {
-    DeviceOrientationController::provideTo(page, DeviceOrientationController::supplementName(), std::make_unique<DeviceOrientationController>(client));
+    DeviceOrientationController::provideTo(&page, DeviceOrientationController::supplementName(), std::make_unique<DeviceOrientationController>(client));
 }
 
 } // namespace WebCore
index 56dcb85..f52d71e 100644 (file)
@@ -38,11 +38,11 @@ class Page;
 class DeviceOrientationController final : public DeviceController {
     WTF_MAKE_NONCOPYABLE(DeviceOrientationController);
 public:
-    explicit DeviceOrientationController(DeviceOrientationClient*);
+    explicit DeviceOrientationController(DeviceOrientationClient&);
     virtual ~DeviceOrientationController() = default;
 
     void didChangeDeviceOrientation(DeviceOrientationData*);
-    DeviceOrientationClient* deviceOrientationClient();
+    DeviceOrientationClient& deviceOrientationClient();
 
 #if PLATFORM(IOS_FAMILY)
     // FIXME: We should look to reconcile the iOS and OpenSource differences with this class
index 1ce9e0b..c067174 100644 (file)
@@ -519,13 +519,11 @@ Document::Document(Frame* frame, const URL& url, unsigned documentClasses, unsig
     , m_intersectionObserversNotifyTimer(*this, &Document::notifyIntersectionObserversTimerFired)
 #endif
     , m_loadEventDelayTimer(*this, &Document::loadEventDelayTimerFired)
-#if PLATFORM(IOS_FAMILY)
-#if ENABLE(DEVICE_ORIENTATION)
+#if PLATFORM(IOS_FAMILY) && ENABLE(DEVICE_ORIENTATION)
     , m_deviceMotionClient(std::make_unique<DeviceMotionClientIOS>())
-    , m_deviceMotionController(std::make_unique<DeviceMotionController>(m_deviceMotionClient.get()))
+    , m_deviceMotionController(std::make_unique<DeviceMotionController>(*m_deviceMotionClient))
     , m_deviceOrientationClient(std::make_unique<DeviceOrientationClientIOS>())
-    , m_deviceOrientationController(std::make_unique<DeviceOrientationController>(m_deviceOrientationClient.get()))
-#endif
+    , m_deviceOrientationController(std::make_unique<DeviceOrientationController>(*m_deviceOrientationClient))
 #endif
     , m_pendingTasksTimer(*this, &Document::pendingTasksTimerFired)
     , m_visualUpdatesSuppressionTimer(*this, &Document::visualUpdatesSuppressionTimerFired)
@@ -739,23 +737,25 @@ Element* Document::getElementByAccessKey(const String& key)
 {
     if (key.isEmpty())
         return nullptr;
+    // FIXME: Would be nice to use WTF::Optional on the map instead of using a
+    // separate boolean.
     if (!m_accessKeyMapValid) {
-        buildAccessKeyMap(this);
+        buildAccessKeyMap(*this);
         m_accessKeyMapValid = true;
     }
     return m_elementsByAccessKey.get(key.impl());
 }
 
-void Document::buildAccessKeyMap(TreeScope* scope)
+void Document::buildAccessKeyMap(TreeScope& scope)
 {
-    ASSERT(scope);
-    for (auto& element : descendantsOfType<Element>(scope->rootNode())) {
-        const AtomicString& accessKey = element.attributeWithoutSynchronization(accesskeyAttr);
+    // FIXME: Consider using composedTreeDescendants instead, obviating the need for
+    // recursion and the "scope" argument. Might be nice to have an Element-only version.
+    for (auto& element : descendantsOfType<Element>(scope.rootNode())) {
+        auto& accessKey = element.attributeWithoutSynchronization(accesskeyAttr);
         if (!accessKey.isEmpty())
             m_elementsByAccessKey.set(accessKey.impl(), &element);
-
-        if (ShadowRoot* root = element.shadowRoot())
-            buildAccessKeyMap(root);
+        if (auto* root = element.shadowRoot())
+            buildAccessKeyMap(*root);
     }
 }
 
@@ -1670,14 +1670,14 @@ void Document::titleElementTextChanged(Element& titleElement)
     updateTitleFromTitleElement();
 }
 
-void Document::registerForVisibilityStateChangedCallbacks(VisibilityChangeClient* client)
+void Document::registerForVisibilityStateChangedCallbacks(VisibilityChangeClient& client)
 {
-    m_visibilityStateCallbackClients.add(client);
+    m_visibilityStateCallbackClients.add(&client);
 }
 
-void Document::unregisterForVisibilityStateChangedCallbacks(VisibilityChangeClient* client)
+void Document::unregisterForVisibilityStateChangedCallbacks(VisibilityChangeClient& client)
 {
-    m_visibilityStateCallbackClients.remove(client);
+    m_visibilityStateCallbackClients.remove(&client);
 }
 
 void Document::visibilityStateChanged()
@@ -3569,7 +3569,7 @@ void Document::processHttpEquiv(const String& equiv, const String& content, bool
     }
 
     case HTTPHeaderName::SetCookie:
-        if (is<HTMLDocument>(*this))
+        if (isHTMLDocument())
             addConsoleMessage(MessageSource::Security, MessageLevel::Error, "The Set-Cookie meta tag is obsolete and was ignored. Use the HTTP header Set-Cookie or document.cookie instead."_s);
         break;
 
@@ -3979,15 +3979,15 @@ void Document::updateViewportUnitsOnResize()
     }
 }
 
-void Document::addAudioProducer(MediaProducer* audioProducer)
+void Document::addAudioProducer(MediaProducer& audioProducer)
 {
-    m_audioProducers.add(audioProducer);
+    m_audioProducers.add(&audioProducer);
     updateIsPlayingMedia();
 }
 
-void Document::removeAudioProducer(MediaProducer* audioProducer)
+void Document::removeAudioProducer(MediaProducer& audioProducer)
 {
-    m_audioProducers.remove(audioProducer);
+    m_audioProducers.remove(&audioProducer);
     updateIsPlayingMedia();
 }
 
@@ -4082,24 +4082,24 @@ void Document::adjustFocusedNodeOnNodeRemoval(Node& node, NodeRemoval nodeRemova
     }
 }
 
-void Document::hoveredElementDidDetach(Element* element)
+void Document::hoveredElementDidDetach(Element& element)
 {
-    if (!m_hoveredElement || element != m_hoveredElement)
+    if (!m_hoveredElement || &element != m_hoveredElement)
         return;
 
-    m_hoveredElement = element->parentElement();
+    m_hoveredElement = element.parentElement();
     while (m_hoveredElement && !m_hoveredElement->renderer())
         m_hoveredElement = m_hoveredElement->parentElement();
     if (frame())
         frame()->eventHandler().scheduleHoverStateUpdate();
 }
 
-void Document::elementInActiveChainDidDetach(Element* element)
+void Document::elementInActiveChainDidDetach(Element& element)
 {
-    if (!m_activeElement || element != m_activeElement)
+    if (!m_activeElement || &element != m_activeElement)
         return;
 
-    m_activeElement = element->parentElement();
+    m_activeElement = element.parentElement();
     while (m_activeElement && !m_activeElement->renderer())
         m_activeElement = m_activeElement->parentElement();
 }
@@ -4445,25 +4445,25 @@ void Document::collectionWillClearIdNameMap(const HTMLCollection& collection)
     m_nodeListAndCollectionCounts[InvalidateOnIdNameAttrChange]--;
 }
 
-void Document::attachNodeIterator(NodeIterator* ni)
+void Document::attachNodeIterator(NodeIterator& iterator)
 {
-    m_nodeIterators.add(ni);
+    m_nodeIterators.add(&iterator);
 }
 
-void Document::detachNodeIterator(NodeIterator* ni)
+void Document::detachNodeIterator(NodeIterator& iterator)
 {
     // The node iterator can be detached without having been attached if its root node didn't have a document
     // when the iterator was created, but has it now.
-    m_nodeIterators.remove(ni);
+    m_nodeIterators.remove(&iterator);
 }
 
 void Document::moveNodeIteratorsToNewDocumentSlowCase(Node& node, Document& newDocument)
 {
     ASSERT(!m_nodeIterators.isEmpty());
-    for (auto* it : copyToVector(m_nodeIterators)) {
-        if (&it->root() == &node) {
-            detachNodeIterator(it);
-            newDocument.attachNodeIterator(it);
+    for (auto* iterator : copyToVector(m_nodeIterators)) {
+        if (&iterator->root() == &node) {
+            detachNodeIterator(*iterator);
+            newDocument.attachNodeIterator(*iterator);
         }
     }
 }
@@ -4503,7 +4503,7 @@ void Document::nodeChildrenWillBeRemoved(ContainerNode& container)
 
     if (m_markers->hasMarkers()) {
         for (Text* textNode = TextNodeTraversal::firstChild(container); textNode; textNode = TextNodeTraversal::nextSibling(*textNode))
-            m_markers->removeMarkers(textNode);
+            m_markers->removeMarkers(*textNode);
     }
 }
 
@@ -4531,7 +4531,7 @@ void Document::nodeWillBeRemoved(Node& node)
     }
 
     if (is<Text>(node))
-        m_markers->removeMarkers(&node);
+        m_markers->removeMarkers(node);
 }
 
 static Node* fallbackFocusNavigationStartingNodeAfterRemoval(Node& node)
@@ -4551,7 +4551,7 @@ void Document::adjustFocusNavigationNodeOnNodeRemoval(Node& node, NodeRemoval no
     }
 }
 
-void Document::textInserted(Node* text, unsigned offset, unsigned length)
+void Document::textInserted(Node& text, unsigned offset, unsigned length)
 {
     if (!m_ranges.isEmpty()) {
         for (auto* range : m_ranges)
@@ -4562,7 +4562,7 @@ void Document::textInserted(Node* text, unsigned offset, unsigned length)
     m_markers->shiftMarkers(text, offset, length);
 }
 
-void Document::textRemoved(Node* text, unsigned offset, unsigned length)
+void Document::textRemoved(Node& text, unsigned offset, unsigned length)
 {
     if (!m_ranges.isEmpty()) {
         for (auto* range : m_ranges)
@@ -4574,10 +4574,10 @@ void Document::textRemoved(Node* text, unsigned offset, unsigned length)
     m_markers->shiftMarkers(text, offset + length, 0 - length);
 }
 
-void Document::textNodesMerged(Text* oldNode, unsigned offset)
+void Document::textNodesMerged(Text& oldNode, unsigned offset)
 {
     if (!m_ranges.isEmpty()) {
-        NodeWithIndex oldNodeWithIndex(oldNode);
+        NodeWithIndex oldNodeWithIndex(&oldNode);
         for (auto* range : m_ranges)
             range->textNodesMerged(oldNodeWithIndex, offset);
     }
@@ -4585,7 +4585,7 @@ void Document::textNodesMerged(Text* oldNode, unsigned offset)
     // FIXME: This should update markers for spelling and grammar checking.
 }
 
-void Document::textNodeSplit(Text* oldNode)
+void Document::textNodeSplit(Text& oldNode)
 {
     for (auto* range : m_ranges)
         range->textNodeSplit(oldNode);
@@ -4606,15 +4606,15 @@ void Document::createDOMWindow()
     m_frame->loader().client().didCreateWindow(*m_domWindow);
 }
 
-void Document::takeDOMWindowFrom(Document* document)
+void Document::takeDOMWindowFrom(Document& document)
 {
     ASSERT(m_frame);
     ASSERT(!m_domWindow);
-    ASSERT(document->m_domWindow);
+    ASSERT(document.m_domWindow);
     // A valid DOMWindow is needed by CachedFrame for its documents.
     ASSERT(pageCacheState() == NotInPageCache);
 
-    m_domWindow = WTFMove(document->m_domWindow);
+    m_domWindow = WTFMove(document.m_domWindow);
     m_domWindow->didSecureTransitionTo(*this);
 
     ASSERT(m_domWindow->document() == this);
@@ -5314,14 +5314,14 @@ void Document::resume(ReasonForSuspension reason)
 #endif
 }
 
-void Document::registerForDocumentSuspensionCallbacks(Element* e)
+void Document::registerForDocumentSuspensionCallbacks(Element& element)
 {
-    m_documentSuspensionCallbackElements.add(e);
+    m_documentSuspensionCallbackElements.add(&element);
 }
 
-void Document::unregisterForDocumentSuspensionCallbacks(Element* e)
+void Document::unregisterForDocumentSuspensionCallbacks(Element& element)
 {
-    m_documentSuspensionCallbackElements.remove(e);
+    m_documentSuspensionCallbackElements.remove(&element);
 }
 
 void Document::mediaVolumeDidChange() 
@@ -5330,14 +5330,14 @@ void Document::mediaVolumeDidChange()
         element->mediaVolumeDidChange();
 }
 
-void Document::registerForMediaVolumeCallbacks(Element* e)
+void Document::registerForMediaVolumeCallbacks(Element& element)
 {
-    m_mediaVolumeCallbackElements.add(e);
+    m_mediaVolumeCallbackElements.add(&element);
 }
 
-void Document::unregisterForMediaVolumeCallbacks(Element* e)
+void Document::unregisterForMediaVolumeCallbacks(Element& element)
 {
-    m_mediaVolumeCallbackElements.remove(e);
+    m_mediaVolumeCallbackElements.remove(&element);
 }
 
 bool Document::audioPlaybackRequiresUserGesture() const
@@ -5385,29 +5385,29 @@ void Document::privateBrowsingStateDidChange()
 #endif
 }
 
-void Document::registerForPrivateBrowsingStateChangedCallbacks(Element* e)
+void Document::registerForPrivateBrowsingStateChangedCallbacks(Element& element)
 {
-    m_privateBrowsingStateChangedElements.add(e);
+    m_privateBrowsingStateChangedElements.add(&element);
 }
 
-void Document::unregisterForPrivateBrowsingStateChangedCallbacks(Element* e)
+void Document::unregisterForPrivateBrowsingStateChangedCallbacks(Element& element)
 {
-    m_privateBrowsingStateChangedElements.remove(e);
+    m_privateBrowsingStateChangedElements.remove(&element);
 }
 
 #if ENABLE(VIDEO_TRACK)
 
-void Document::registerForCaptionPreferencesChangedCallbacks(Element* e)
+void Document::registerForCaptionPreferencesChangedCallbacks(Element& element)
 {
     if (page())
         page()->group().captionPreferences().setInterestedInCaptionPreferenceChanges();
 
-    m_captionPreferencesChangedElements.add(e);
+    m_captionPreferencesChangedElements.add(&element);
 }
 
-void Document::unregisterForCaptionPreferencesChangedCallbacks(Element* e)
+void Document::unregisterForCaptionPreferencesChangedCallbacks(Element& element)
 {
-    m_captionPreferencesChangedElements.remove(e);
+    m_captionPreferencesChangedElements.remove(&element);
 }
 
 void Document::captionPreferencesChanged()
@@ -5420,14 +5420,14 @@ void Document::captionPreferencesChanged()
 
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
 
-void Document::registerForPageScaleFactorChangedCallbacks(HTMLMediaElement* element)
+void Document::registerForPageScaleFactorChangedCallbacks(HTMLMediaElement& element)
 {
-    m_pageScaleFactorChangedElements.add(element);
+    m_pageScaleFactorChangedElements.add(&element);
 }
 
-void Document::unregisterForPageScaleFactorChangedCallbacks(HTMLMediaElement* element)
+void Document::unregisterForPageScaleFactorChangedCallbacks(HTMLMediaElement& element)
 {
-    m_pageScaleFactorChangedElements.remove(element);
+    m_pageScaleFactorChangedElements.remove(&element);
 }
 
 void Document::pageScaleFactorChangedAndStable()
@@ -5761,7 +5761,7 @@ void Document::finishedParsing()
 
     Ref<Document> protectedThis(*this);
 
-    scriptRunner()->documentFinishedParsing();
+    scriptRunner().documentFinishedParsing();
 
     if (!m_documentTiming.domContentLoadedEventStart)
         m_documentTiming.domContentLoadedEventStart = MonotonicTime::now();
@@ -6059,17 +6059,17 @@ void Document::statePopped(Ref<SerializedScriptValue>&& stateObject)
         m_pendingStateObject = WTFMove(stateObject);
 }
 
-void Document::attachRange(Range* range)
+void Document::attachRange(Range& range)
 {
-    ASSERT(!m_ranges.contains(range));
-    m_ranges.add(range);
+    ASSERT(!m_ranges.contains(&range));
+    m_ranges.add(&range);
 }
 
-void Document::detachRange(Range* range)
+void Document::detachRange(Range& range)
 {
-    // We don't ASSERT m_ranges.contains(range) to allow us to call this
+    // We don't ASSERT m_ranges.contains(&range) to allow us to call this
     // unconditionally to fix: https://bugs.webkit.org/show_bug.cgi?id=26044
-    m_ranges.remove(range);
+    m_ranges.remove(&range);
 }
 
 Optional<RenderingContext> Document::getCSSCanvasContext(const String& type, const String& name, int width, int height)
@@ -6226,7 +6226,7 @@ void Document::suspendScheduledTasks(ReasonForSuspension reason)
 
     suspendScriptedAnimationControllerCallbacks();
     suspendActiveDOMObjects(reason);
-    scriptRunner()->suspend();
+    scriptRunner().suspend();
     m_pendingTasksTimer.stop();
 
 #if ENABLE(XSLT)
@@ -6260,7 +6260,7 @@ void Document::resumeScheduledTasks(ReasonForSuspension reason)
 
     if (!m_pendingTasks.isEmpty())
         m_pendingTasksTimer.startOneShot(0_s);
-    scriptRunner()->resume();
+    scriptRunner().resume();
     resumeActiveDOMObjects(reason);
     resumeScriptedAnimationControllerCallbacks();
     
@@ -6320,16 +6320,16 @@ void Document::dispatchPopstateEvent(RefPtr<SerializedScriptValue>&& stateObject
     dispatchWindowEvent(PopStateEvent::create(WTFMove(stateObject), m_domWindow ? &m_domWindow->history() : nullptr));
 }
 
-void Document::addMediaCanStartListener(MediaCanStartListener* listener)
+void Document::addMediaCanStartListener(MediaCanStartListener& listener)
 {
-    ASSERT(!m_mediaCanStartListeners.contains(listener));
-    m_mediaCanStartListeners.add(listener);
+    ASSERT(!m_mediaCanStartListeners.contains(&listener));
+    m_mediaCanStartListeners.add(&listener);
 }
 
-void Document::removeMediaCanStartListener(MediaCanStartListener* listener)
+void Document::removeMediaCanStartListener(MediaCanStartListener& listener)
 {
-    ASSERT(m_mediaCanStartListeners.contains(listener));
-    m_mediaCanStartListeners.remove(listener);
+    ASSERT(m_mediaCanStartListeners.contains(&listener));
+    m_mediaCanStartListeners.remove(&listener);
 }
 
 MediaCanStartListener* Document::takeAnyMediaCanStartListener()
@@ -6339,30 +6339,29 @@ MediaCanStartListener* Document::takeAnyMediaCanStartListener()
 
 #if ENABLE(DEVICE_ORIENTATION) && PLATFORM(IOS_FAMILY)
 
-DeviceMotionController* Document::deviceMotionController() const
+DeviceMotionController& Document::deviceMotionController() const
 {
-    return m_deviceMotionController.get();
+    return *m_deviceMotionController;
 }
 
-DeviceOrientationController* Document::deviceOrientationController() const
+DeviceOrientationController& Document::deviceOrientationController() const
 {
-    return m_deviceOrientationController.get();
+    return *m_deviceOrientationController;
 }
 
 void Document::simulateDeviceOrientationChange(double alpha, double beta, double gamma)
 {
     auto orientation = DeviceOrientationData::create(alpha, beta, gamma, WTF::nullopt, WTF::nullopt);
-    deviceOrientationController()->didChangeDeviceOrientation(orientation.ptr());
+    deviceOrientationController().didChangeDeviceOrientation(orientation.ptr());
 }
 
 #endif
 
 #if ENABLE(FULLSCREEN_API)
 
-bool Document::fullScreenIsAllowedForElement(Element* element) const
+bool Document::fullScreenIsAllowedForElement(Element& element) const
 {
-    ASSERT(element);
-    return isAttributeOnAllOwners(allowfullscreenAttr, webkitallowfullscreenAttr, element->document().ownerElement());
+    return isAttributeOnAllOwners(allowfullscreenAttr, webkitallowfullscreenAttr, element.document().ownerElement());
 }
 
 void Document::requestFullScreenForElement(Element* element, FullScreenCheckType checkType)
@@ -6431,7 +6430,7 @@ void Document::requestFullScreenForElement(Element* element, FullScreenCheckType
 
         // The context object's node document, or an ancestor browsing context's document does not have
         // the fullscreen enabled flag set.
-        if (checkType == EnforceIFrameAllowFullScreenRequirement && !fullScreenIsAllowedForElement(element.get())) {
+        if (checkType == EnforceIFrameAllowFullScreenRequirement && !fullScreenIsAllowedForElement(*element)) {
             failedPreflights(WTFMove(element));
             return;
         }
@@ -6482,8 +6481,8 @@ void Document::requestFullScreenForElement(Element* element, FullScreenCheckType
             // stack, and queue a task to fire an event named fullscreenchange with its bubbles attribute
             // set to true on the document.
             if (!followingDoc) {
-                currentDoc->pushFullscreenElementStack(element.get());
-                addDocumentToFullScreenChangeEventQueue(currentDoc);
+                currentDoc->pushFullscreenElementStack(*element);
+                addDocumentToFullScreenChangeEventQueue(*currentDoc);
                 continue;
             }
 
@@ -6494,8 +6493,8 @@ void Document::requestFullScreenForElement(Element* element, FullScreenCheckType
                 // ...push following document's browsing context container on document's fullscreen element
                 // stack, and queue a task to fire an event named fullscreenchange with its bubbles attribute
                 // set to true on document.
-                currentDoc->pushFullscreenElementStack(followingDoc->ownerElement());
-                addDocumentToFullScreenChangeEventQueue(currentDoc);
+                currentDoc->pushFullscreenElementStack(*followingDoc->ownerElement());
+                addDocumentToFullScreenChangeEventQueue(*currentDoc);
                 continue;
             }
 
@@ -6557,7 +6556,7 @@ void Document::webkitExitFullscreen()
     // task to fire an event named fullscreenchange with its bubbles attribute set to true on descendant.
     for (auto& document : descendants) {
         document->clearFullscreenElementStack();
-        addDocumentToFullScreenChangeEventQueue(document.get());
+        addDocumentToFullScreenChangeEventQueue(*document);
     }
 
     // 5. While doc is not null, run these substeps:
@@ -6574,7 +6573,7 @@ void Document::webkitExitFullscreen()
 
         // 2. Queue a task to fire an event named fullscreenchange with its bubbles attribute set to true
         // on doc.
-        addDocumentToFullScreenChangeEventQueue(currentDoc);
+        addDocumentToFullScreenChangeEventQueue(*currentDoc);
 
         // 3. If doc's fullscreen element stack is empty and doc's browsing context has a browsing context
         // container, set doc to that browsing context container's node document.
@@ -6626,13 +6625,11 @@ static void unwrapFullScreenRenderer(RenderFullScreen* fullScreenRenderer, Eleme
         fullScreenElement->parentElement()->invalidateStyleAndRenderersForSubtree();
 }
 
-void Document::webkitWillEnterFullScreenForElement(Element* element)
+void Document::webkitWillEnterFullScreen(Element& element)
 {
     if (!hasLivingRenderTree() || pageCacheState() != NotInPageCache)
         return;
 
-    ASSERT(element);
-
     // Protect against being called after the document has been removed from the page.
     if (!page())
         return;
@@ -6641,13 +6638,12 @@ void Document::webkitWillEnterFullScreenForElement(Element* element)
 
     unwrapFullScreenRenderer(m_fullScreenRenderer.get(), m_fullScreenElement.get());
 
-    if (element)
-        element->willBecomeFullscreenElement();
+    element.willBecomeFullscreenElement();
     
-    m_fullScreenElement = element;
+    m_fullScreenElement = &element;
 
 #if USE(NATIVE_FULLSCREEN_VIDEO)
-    if (element && element->isMediaElement())
+    if (element.isMediaElement())
         return;
 #endif
 
@@ -6671,7 +6667,7 @@ void Document::webkitWillEnterFullScreenForElement(Element* element)
     dispatchFullScreenChangeEvents();
 }
 
-void Document::webkitDidEnterFullScreenForElement(Element*)
+void Document::webkitDidEnterFullScreen()
 {
     if (!m_fullScreenElement)
         return;
@@ -6682,7 +6678,7 @@ void Document::webkitDidEnterFullScreenForElement(Element*)
     m_fullScreenElement->didBecomeFullscreenElement();
 }
 
-void Document::webkitWillExitFullScreenForElement(Element*)
+void Document::webkitWillExitFullScreen()
 {
     if (!m_fullScreenElement)
         return;
@@ -6693,7 +6689,7 @@ void Document::webkitWillExitFullScreenForElement(Element*)
     m_fullScreenElement->willStopBeingFullscreenElement();
 }
 
-void Document::webkitDidExitFullScreenForElement(Element*)
+void Document::webkitDidExitFullScreen()
 {
     if (!m_fullScreenElement)
         return;
@@ -6845,19 +6841,18 @@ void Document::popFullscreenElementStack()
     m_fullScreenElementStack.removeLast();
 }
 
-void Document::pushFullscreenElementStack(Element* element)
+void Document::pushFullscreenElementStack(Element& element)
 {
-    m_fullScreenElementStack.append(element);
+    m_fullScreenElementStack.append(&element);
 }
 
-void Document::addDocumentToFullScreenChangeEventQueue(Document* doc)
+void Document::addDocumentToFullScreenChangeEventQueue(Document& document)
 {
-    ASSERT(doc);
-    Node* target = doc->webkitFullscreenElement();
+    Node* target = document.webkitFullscreenElement();
     if (!target)
-        target = doc->webkitCurrentFullScreenElement();
+        target = document.webkitCurrentFullScreenElement();
     if (!target)
-        target = doc;
+        target = &document;
     m_fullScreenChangeEventTargetQueue.append(target);
 }
 
@@ -7209,7 +7204,7 @@ Element* eventTargetElementForDocument(Document* document)
     Element* element = document->focusedElement();
     if (!element && is<PluginDocument>(*document))
         element = downcast<PluginDocument>(*document).pluginElement();
-    if (!element && is<HTMLDocument>(*document))
+    if (!element && document->isHTMLDocument())
         element = document->bodyOrFrameset();
     if (!element)
         element = document->documentElement();
@@ -7283,7 +7278,7 @@ DocumentParserYieldToken::DocumentParserYieldToken(Document& document)
     if (++document.m_parserYieldTokenCount != 1)
         return;
 
-    document.scriptRunner()->didBeginYieldingParser();
+    document.scriptRunner().didBeginYieldingParser();
     if (auto* parser = document.parser())
         parser->didBeginYieldingParser();
 }
@@ -7297,7 +7292,7 @@ DocumentParserYieldToken::~DocumentParserYieldToken()
     if (--m_document->m_parserYieldTokenCount)
         return;
 
-    m_document->scriptRunner()->didEndYieldingParser();
+    m_document->scriptRunner().didEndYieldingParser();
     if (auto* parser = m_document->parser())
         parser->didEndYieldingParser();
 }
@@ -7387,7 +7382,7 @@ void Document::updateHoverActiveState(const HitTestRequest& request, Element* in
         for (auto* element = oldHoveredElement.get(); element; element = element->parentElementInComposedTree()) {
             if (element == commonAncestor)
                 break;
-            if (!mustBeInActiveChain || element->inActiveChain())
+            if (!mustBeInActiveChain || element->isInActiveChain())
                 elementsToRemoveFromChain.append(element);
         }
         // Unset hovered nodes in sub frame documents if the old hovered node was a frame owner.
@@ -7398,7 +7393,7 @@ void Document::updateHoverActiveState(const HitTestRequest& request, Element* in
     }
 
     for (auto* element = newHoveredElement; element; element = element->parentElementInComposedTree()) {
-        if (!mustBeInActiveChain || element->inActiveChain())
+        if (!mustBeInActiveChain || element->isInActiveChain())
             elementsToAddToChain.append(element);
     }
 
index 308929e..bb5c1c0 100644 (file)
@@ -773,8 +773,8 @@ public:
     void adjustFocusedNodeOnNodeRemoval(Node&, NodeRemoval = NodeRemoval::Node);
     void adjustFocusNavigationNodeOnNodeRemoval(Node&, NodeRemoval = NodeRemoval::Node);
 
-    void hoveredElementDidDetach(Element*);
-    void elementInActiveChainDidDetach(Element*);
+    void hoveredElementDidDetach(Element&);
+    void elementInActiveChainDidDetach(Element&);
 
     void updateHoverActiveState(const HitTestRequest&, Element*);
 
@@ -801,16 +801,16 @@ public:
     template <typename InvalidationFunction>
     void invalidateNodeListAndCollectionCaches(InvalidationFunction);
 
-    void attachNodeIterator(NodeIterator*);
-    void detachNodeIterator(NodeIterator*);
+    void attachNodeIterator(NodeIterator&);
+    void detachNodeIterator(NodeIterator&);
     void moveNodeIteratorsToNewDocument(Node& node, Document& newDocument)
     {
         if (!m_nodeIterators.isEmpty())
             moveNodeIteratorsToNewDocumentSlowCase(node, newDocument);
     }
 
-    void attachRange(Range*);
-    void detachRange(Range*);
+    void attachRange(Range&);
+    void detachRange(Range&);
 
     void updateRangesAfterChildrenChanged(ContainerNode&);
     // nodeChildrenWillBeRemoved is used when removing all node children at once.
@@ -821,13 +821,13 @@ public:
     enum class AcceptChildOperation { Replace, InsertOrAdd };
     bool canAcceptChild(const Node& newChild, const Node* refChild, AcceptChildOperation) const;
 
-    void textInserted(Node*, unsigned offset, unsigned length);
-    void textRemoved(Node*, unsigned offset, unsigned length);
-    void textNodesMerged(Text* oldNode, unsigned offset);
-    void textNodeSplit(Text* oldNode);
+    void textInserted(Node&, unsigned offset, unsigned length);
+    void textRemoved(Node&, unsigned offset, unsigned length);
+    void textNodesMerged(Text& oldNode, unsigned offset);
+    void textNodeSplit(Text& oldNode);
 
     void createDOMWindow();
-    void takeDOMWindowFrom(Document*);
+    void takeDOMWindowFrom(Document&);
 
     DOMWindow* domWindow() const { return m_domWindow.get(); }
     // In DOM Level 2, the Document's DOMWindow is called the defaultView.
@@ -906,7 +906,7 @@ public:
 #endif
 
     // Returns the owning element in the parent document.
-    // Returns 0 if this is the top level document.
+    // Returns nullptr if this is the top level document.
     HTMLFrameOwnerElement* ownerElement() const;
 
     // Used by DOM bindings; no direction known.
@@ -1018,8 +1018,8 @@ public:
     Document* parentDocument() const;
     WEBCORE_EXPORT Document& topDocument() const;
     
-    ScriptRunner* scriptRunner() { return m_scriptRunner.get(); }
-    ScriptModuleLoader* moduleLoader() { return m_moduleLoader.get(); }
+    ScriptRunner& scriptRunner() { return *m_scriptRunner; }
+    ScriptModuleLoader& moduleLoader() { return *m_moduleLoader; }
 
     HTMLScriptElement* currentScript() const { return !m_currentScriptStack.isEmpty() ? m_currentScriptStack.last().get() : nullptr; }
     void pushCurrentScript(HTMLScriptElement*);
@@ -1031,7 +1031,7 @@ public:
     void scheduleToApplyXSLTransforms();
     void applyPendingXSLTransformsNowIfScheduled();
     RefPtr<Document> transformSourceDocument() { return m_transformSourceDocument; }
-    void setTransformSourceDocument(Document* doc) { m_transformSourceDocument = doc; }
+    void setTransformSourceDocument(Document* document) { m_transformSourceDocument = document; }
 
     void setTransformSource(std::unique_ptr<TransformSource>);
     TransformSource* transformSource() const { return m_transformSource.get(); }
@@ -1075,17 +1075,15 @@ public:
     PageCacheState pageCacheState() const { return m_pageCacheState; }
     void setPageCacheState(PageCacheState);
 
-    // Elements can register themselves for the "suspend()" and
-    // "resume()" callbacks
-    void registerForDocumentSuspensionCallbacks(Element*);
-    void unregisterForDocumentSuspensionCallbacks(Element*);
+    void registerForDocumentSuspensionCallbacks(Element&);
+    void unregisterForDocumentSuspensionCallbacks(Element&);
 
     void documentWillBecomeInactive();
     void suspend(ReasonForSuspension);
     void resume(ReasonForSuspension);
 
-    void registerForMediaVolumeCallbacks(Element*);
-    void unregisterForMediaVolumeCallbacks(Element*);
+    void registerForMediaVolumeCallbacks(Element&);
+    void unregisterForMediaVolumeCallbacks(Element&);
     void mediaVolumeDidChange();
 
     bool audioPlaybackRequiresUserGesture() const;
@@ -1095,28 +1093,28 @@ public:
     MediaSession& defaultMediaSession();
 #endif
 
-    void registerForPrivateBrowsingStateChangedCallbacks(Element*);
-    void unregisterForPrivateBrowsingStateChangedCallbacks(Element*);
+    void registerForPrivateBrowsingStateChangedCallbacks(Element&);
+    void unregisterForPrivateBrowsingStateChangedCallbacks(Element&);
     void storageBlockingStateDidChange();
     void privateBrowsingStateDidChange();
 
 #if ENABLE(VIDEO_TRACK)
-    void registerForCaptionPreferencesChangedCallbacks(Element*);
-    void unregisterForCaptionPreferencesChangedCallbacks(Element*);
+    void registerForCaptionPreferencesChangedCallbacks(Element&);
+    void unregisterForCaptionPreferencesChangedCallbacks(Element&);
     void captionPreferencesChanged();
 #endif
 
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
-    void registerForPageScaleFactorChangedCallbacks(HTMLMediaElement*);
-    void unregisterForPageScaleFactorChangedCallbacks(HTMLMediaElement*);
+    void registerForPageScaleFactorChangedCallbacks(HTMLMediaElement&);
+    void unregisterForPageScaleFactorChangedCallbacks(HTMLMediaElement&);
     void pageScaleFactorChangedAndStable();
     void registerForUserInterfaceLayoutDirectionChangedCallbacks(HTMLMediaElement&);
     void unregisterForUserInterfaceLayoutDirectionChangedCallbacks(HTMLMediaElement&);
     void userInterfaceLayoutDirectionChanged();
 #endif
 
-    void registerForVisibilityStateChangedCallbacks(VisibilityChangeClient*);
-    void unregisterForVisibilityStateChangedCallbacks(VisibilityChangeClient*);
+    void registerForVisibilityStateChangedCallbacks(VisibilityChangeClient&);
+    void unregisterForVisibilityStateChangedCallbacks(VisibilityChangeClient&);
 
 #if ENABLE(VIDEO)
     void registerForAllowsMediaDocumentInlinePlaybackChangedCallbacks(HTMLMediaElement&);
@@ -1177,8 +1175,8 @@ public:
     void dispatchPopstateEvent(RefPtr<SerializedScriptValue>&& stateObject);
     DocumentEventQueue& eventQueue() const final { return m_eventQueue; }
 
-    WEBCORE_EXPORT void addMediaCanStartListener(MediaCanStartListener*);
-    WEBCORE_EXPORT void removeMediaCanStartListener(MediaCanStartListener*);
+    WEBCORE_EXPORT void addMediaCanStartListener(MediaCanStartListener&);
+    WEBCORE_EXPORT void removeMediaCanStartListener(MediaCanStartListener&);
     MediaCanStartListener* takeAnyMediaCanStartListener();
 
 #if ENABLE(FULLSCREEN_API)
@@ -1195,16 +1193,16 @@ public:
     void requestFullScreenForElement(Element*, FullScreenCheckType);
     WEBCORE_EXPORT void webkitCancelFullScreen();
     
-    WEBCORE_EXPORT void webkitWillEnterFullScreenForElement(Element*);
-    WEBCORE_EXPORT void webkitDidEnterFullScreenForElement(Element*);
-    WEBCORE_EXPORT void webkitWillExitFullScreenForElement(Element*);
-    WEBCORE_EXPORT void webkitDidExitFullScreenForElement(Element*);
+    WEBCORE_EXPORT void webkitWillEnterFullScreen(Element&);
+    WEBCORE_EXPORT void webkitDidEnterFullScreen();
+    WEBCORE_EXPORT void webkitWillExitFullScreen();
+    WEBCORE_EXPORT void webkitDidExitFullScreen();
     
     void setFullScreenRenderer(RenderTreeBuilder&, RenderFullScreen&);
     RenderFullScreen* fullScreenRenderer() const { return m_fullScreenRenderer.get(); }
 
     void dispatchFullScreenChangeEvents();
-    bool fullScreenIsAllowedForElement(Element*) const;
+    bool fullScreenIsAllowedForElement(Element&) const;
     void fullScreenElementRemoved();
     void adjustFullScreenElementOnNodeRemoval(Node&, NodeRemoval = NodeRemoval::Node);
 
@@ -1235,8 +1233,8 @@ public:
 #endif
 
 #if ENABLE(DEVICE_ORIENTATION) && PLATFORM(IOS_FAMILY)
-    DeviceMotionController* deviceMotionController() const;
-    DeviceOrientationController* deviceOrientationController() const;
+    DeviceMotionController& deviceMotionController() const;
+    DeviceOrientationController& deviceOrientationController() const;
     WEBCORE_EXPORT void simulateDeviceOrientationChange(double alpha, double beta, double gamma);
 #endif
 
@@ -1380,8 +1378,8 @@ public:
     bool hasStyleWithViewportUnits() const { return m_hasStyleWithViewportUnits; }
     void updateViewportUnitsOnResize();
 
-    WEBCORE_EXPORT void addAudioProducer(MediaProducer*);
-    WEBCORE_EXPORT void removeAudioProducer(MediaProducer*);
+    WEBCORE_EXPORT void addAudioProducer(MediaProducer&);
+    WEBCORE_EXPORT void removeAudioProducer(MediaProducer&);
     MediaProducer::MediaStateFlags mediaState() const { return m_mediaState; }
     void noteUserInteractionWithMediaElement();
     bool isCapturing() const { return MediaProducer::isCapturing(m_mediaState); }
@@ -1599,7 +1597,7 @@ private:
     void updateTitle(const StringWithDirection&);
     void updateBaseURL();
 
-    void buildAccessKeyMap(TreeScope* root);
+    void buildAccessKeyMap(TreeScope&);
 
     void moveNodeIteratorsToNewDocumentSlowCase(Node&, Document&);
 
@@ -1616,8 +1614,8 @@ private:
     void dispatchFullScreenChangeOrErrorEvent(Deque<RefPtr<Node>>&, const AtomicString& eventName, bool shouldNotifyMediaElement);
     void clearFullscreenElementStack();
     void popFullscreenElementStack();
-    void pushFullscreenElementStack(Element*);
-    void addDocumentToFullScreenChangeEventQueue(Document*);
+    void pushFullscreenElementStack(Element&);
+    void addDocumentToFullScreenChangeEventQueue(Document&);
 #endif
 
     void dispatchDisabledAdaptationsDidChangeForMainFrame();
index 5b08630..5bbcb80 100644 (file)
@@ -60,99 +60,99 @@ void DocumentMarkerController::detach()
     m_possiblyExistingMarkerTypes = { };
 }
 
-void DocumentMarkerController::addMarker(Range* range, DocumentMarker::MarkerType type, const String& description)
+void DocumentMarkerController::addMarker(Range& range, DocumentMarker::MarkerType type, const String& description)
 {
-    for (TextIterator markedText(range); !markedText.atEnd(); markedText.advance()) {
+    for (TextIterator markedText(&range); !markedText.atEnd(); markedText.advance()) {
         RefPtr<Range> textPiece = markedText.range();
-        addMarker(&textPiece->startContainer(), DocumentMarker(type, textPiece->startOffset(), textPiece->endOffset(), description));
+        addMarker(textPiece->startContainer(), DocumentMarker(type, textPiece->startOffset(), textPiece->endOffset(), description));
     }
 }
 
-void DocumentMarkerController::addMarker(Range* range, DocumentMarker::MarkerType type)
+void DocumentMarkerController::addMarker(Range& range, DocumentMarker::MarkerType type)
 {
-    for (TextIterator markedText(range); !markedText.atEnd(); markedText.advance()) {
+    for (TextIterator markedText(&range); !markedText.atEnd(); markedText.advance()) {
         RefPtr<Range> textPiece = markedText.range();
-        addMarker(&textPiece->startContainer(), DocumentMarker(type, textPiece->startOffset(), textPiece->endOffset()));
+        addMarker(textPiece->startContainer(), DocumentMarker(type, textPiece->startOffset(), textPiece->endOffset()));
     }
 
 }
 
-void DocumentMarkerController::addMarkerToNode(Node* node, unsigned startOffset, unsigned length, DocumentMarker::MarkerType type)
+void DocumentMarkerController::addMarkerToNode(Node& node, unsigned startOffset, unsigned length, DocumentMarker::MarkerType type)
 {
     addMarker(node, DocumentMarker(type, startOffset, startOffset + length));
 }
 
-void DocumentMarkerController::addMarkerToNode(Node* node, unsigned startOffset, unsigned length, DocumentMarker::MarkerType type, DocumentMarker::Data&& data)
+void DocumentMarkerController::addMarkerToNode(Node& node, unsigned startOffset, unsigned length, DocumentMarker::MarkerType type, DocumentMarker::Data&& data)
 {
     addMarker(node, DocumentMarker(type, startOffset, startOffset + length, WTFMove(data)));
 }
 
-void DocumentMarkerController::addTextMatchMarker(const Range* range, bool activeMatch)
+void DocumentMarkerController::addTextMatchMarker(const Range& range, bool activeMatch)
 {
-    for (TextIterator markedText(range); !markedText.atEnd(); markedText.advance()) {
+    for (TextIterator markedText(&range); !markedText.atEnd(); markedText.advance()) {
         RefPtr<Range> textPiece = markedText.range();
         unsigned startOffset = textPiece->startOffset();
         unsigned endOffset = textPiece->endOffset();
-        addMarker(&textPiece->startContainer(), DocumentMarker(startOffset, endOffset, activeMatch));
+        addMarker(textPiece->startContainer(), DocumentMarker(startOffset, endOffset, activeMatch));
     }
 }
 
 #if PLATFORM(IOS_FAMILY)
 
-void DocumentMarkerController::addMarker(Range* range, DocumentMarker::MarkerType type, const String& description, const Vector<String>& interpretations, const RetainPtr<id>& metadata)
+void DocumentMarkerController::addMarker(Range& range, DocumentMarker::MarkerType type, const String& description, const Vector<String>& interpretations, const RetainPtr<id>& metadata)
 {
-    for (TextIterator markedText(range); !markedText.atEnd(); markedText.advance()) {
+    for (TextIterator markedText(&range); !markedText.atEnd(); markedText.advance()) {
         RefPtr<Range> textPiece = markedText.range();
-        addMarker(&textPiece->startContainer(), DocumentMarker(type, textPiece->startOffset(), textPiece->endOffset(), description, interpretations, metadata));
+        addMarker(textPiece->startContainer(), DocumentMarker(type, textPiece->startOffset(), textPiece->endOffset(), description, interpretations, metadata));
     }
 }
 
-void DocumentMarkerController::addDictationPhraseWithAlternativesMarker(Range* range, const Vector<String>& interpretations)
+void DocumentMarkerController::addDictationPhraseWithAlternativesMarker(Range& range, const Vector<String>& interpretations)
 {
     ASSERT(interpretations.size() > 1);
     if (interpretations.size() <= 1)
         return;
 
     size_t numberOfAlternatives = interpretations.size() - 1;
-    for (TextIterator markedText(range); !markedText.atEnd(); markedText.advance()) {
+    for (TextIterator markedText(&range); !markedText.atEnd(); markedText.advance()) {
         RefPtr<Range> textPiece = markedText.range();
         DocumentMarker marker(DocumentMarker::DictationPhraseWithAlternatives, textPiece->startOffset(), textPiece->endOffset(), emptyString(), Vector<String>(numberOfAlternatives), RetainPtr<id>());
         for (size_t i = 0; i < numberOfAlternatives; ++i)
             marker.setAlternative(interpretations[i + 1], i);
-        addMarker(&textPiece->startContainer(), marker);
+        addMarker(textPiece->startContainer(), marker);
     }
 }
 
-void DocumentMarkerController::addDictationResultMarker(Range* range, const RetainPtr<id>& metadata)
+void DocumentMarkerController::addDictationResultMarker(Range& range, const RetainPtr<id>& metadata)
 {
-    for (TextIterator markedText(range); !markedText.atEnd(); markedText.advance()) {
+    for (TextIterator markedText(&range); !markedText.atEnd(); markedText.advance()) {
         RefPtr<Range> textPiece = markedText.range();
-        addMarker(&textPiece->startContainer(), DocumentMarker(DocumentMarker::DictationResult, textPiece->startOffset(), textPiece->endOffset(), String(), Vector<String>(), metadata));
+        addMarker(textPiece->startContainer(), DocumentMarker(DocumentMarker::DictationResult, textPiece->startOffset(), textPiece->endOffset(), String(), Vector<String>(), metadata));
     }
 }
 
 #endif
 
-void DocumentMarkerController::addDraggedContentMarker(RefPtr<Range> range)
+void DocumentMarkerController::addDraggedContentMarker(Range& range)
 {
-    for (TextIterator markedText(range.get()); !markedText.atEnd(); markedText.advance()) {
-        RefPtr<Range> textPiece = markedText.range();
+    for (TextIterator markedText(&range); !markedText.atEnd(); markedText.advance()) {
+        auto textPiece = markedText.range();
         DocumentMarker::DraggedContentData draggedContentData { markedText.node() };
-        addMarker(&textPiece->startContainer(), { DocumentMarker::DraggedContent, textPiece->startOffset(), textPiece->endOffset(), WTFMove(draggedContentData) });
+        addMarker(textPiece->startContainer(), { DocumentMarker::DraggedContent, textPiece->startOffset(), textPiece->endOffset(), WTFMove(draggedContentData) });
     }
 }
 
-void DocumentMarkerController::removeMarkers(Range* range, OptionSet<DocumentMarker::MarkerType> markerTypes, RemovePartiallyOverlappingMarkerOrNot shouldRemovePartiallyOverlappingMarker)
+void DocumentMarkerController::removeMarkers(Range& range, OptionSet<DocumentMarker::MarkerType> markerTypes, RemovePartiallyOverlappingMarkerOrNot shouldRemovePartiallyOverlappingMarker)
 {
-    for (TextIterator markedText(range); !markedText.atEnd(); markedText.advance()) {
+    for (TextIterator markedText(&range); !markedText.atEnd(); markedText.advance()) {
         if (!possiblyHasMarkers(markerTypes))
             return;
         ASSERT(!m_markers.isEmpty());
 
-        RefPtr<Range> textPiece = markedText.range();
+        auto textPiece = markedText.range();
         unsigned startOffset = textPiece->startOffset();
         unsigned endOffset = textPiece->endOffset();
-        removeMarkers(&textPiece->startContainer(), startOffset, endOffset - startOffset, markerTypes, shouldRemovePartiallyOverlappingMarker);
+        removeMarkers(textPiece->startContainer(), startOffset, endOffset - startOffset, markerTypes, shouldRemovePartiallyOverlappingMarker);
     }
 }
 
@@ -315,13 +315,13 @@ static bool shouldInsertAsSeparateMarker(const DocumentMarker& newMarker)
 // Markers are stored in order sorted by their start offset.
 // Markers of the same type do not overlap each other.
 
-void DocumentMarkerController::addMarker(Node* node, const DocumentMarker& newMarker) 
+void DocumentMarkerController::addMarker(Node& node, const DocumentMarker& newMarker)
 {
     ASSERT(newMarker.endOffset() >= newMarker.startOffset());
     if (newMarker.endOffset() == newMarker.startOffset())
         return;
 
-    if (auto* renderer = node->renderer()) {
+    if (auto* renderer = node.renderer()) {
         // FIXME: Factor the marker painting code out of InlineTextBox and teach simple line layout to use it.
         if (is<RenderText>(*renderer))
             downcast<RenderText>(*renderer).ensureLineBoxes();
@@ -331,7 +331,7 @@ void DocumentMarkerController::addMarker(Node* node, const DocumentMarker& newMa
 
     m_possiblyExistingMarkerTypes.add(newMarker.type());
 
-    std::unique_ptr<MarkerList>& list = m_markers.add(node, nullptr).iterator->value;
+    std::unique_ptr<MarkerList>& list = m_markers.add(&node, nullptr).iterator->value;
 
     if (!list) {
         list = std::make_unique<MarkerList>();
@@ -386,15 +386,15 @@ void DocumentMarkerController::addMarker(Node* node, const DocumentMarker& newMa
         list->insert(i, RenderedDocumentMarker(toInsert));
     }
 
-    if (node->renderer())
-        node->renderer()->repaint();
+    if (node.renderer())
+        node.renderer()->repaint();
 
-    invalidateRectsForMarkersInNode(*node);
+    invalidateRectsForMarkersInNode(node);
 }
 
 // copies markers from srcNode to dstNode, applying the specified shift delta to the copies.  The shift is
 // useful if, e.g., the caller has created the dstNode from a non-prefix substring of the srcNode.
-void DocumentMarkerController::copyMarkers(Node* srcNode, unsigned startOffset, int length, Node* dstNode, int delta)
+void DocumentMarkerController::copyMarkers(Node& srcNode, unsigned startOffset, int length, Node& dstNode, int delta)
 {
     if (length <= 0)
         return;
@@ -403,7 +403,7 @@ void DocumentMarkerController::copyMarkers(Node* srcNode, unsigned startOffset,
         return;
     ASSERT(!m_markers.isEmpty());
 
-    MarkerList* list = m_markers.get(srcNode);
+    MarkerList* list = m_markers.get(&srcNode);
     if (!list)
         return;
 
@@ -429,11 +429,11 @@ void DocumentMarkerController::copyMarkers(Node* srcNode, unsigned startOffset,
         addMarker(dstNode, marker);
     }
 
-    if (docDirty && dstNode->renderer())
-        dstNode->renderer()->repaint();
+    if (docDirty && dstNode.renderer())
+        dstNode.renderer()->repaint();
 }
 
-void DocumentMarkerController::removeMarkers(Node* node, unsigned startOffset, int length, OptionSet<DocumentMarker::MarkerType> markerTypes, RemovePartiallyOverlappingMarkerOrNot shouldRemovePartiallyOverlappingMarker)
+void DocumentMarkerController::removeMarkers(Node& node, unsigned startOffset, int length, OptionSet<DocumentMarker::MarkerType> markerTypes, RemovePartiallyOverlappingMarkerOrNot shouldRemovePartiallyOverlappingMarker)
 {
     if (length <= 0)
         return;
@@ -442,7 +442,7 @@ void DocumentMarkerController::removeMarkers(Node* node, unsigned startOffset, i
         return;
     ASSERT(!(m_markers.isEmpty()));
 
-    MarkerList* list = m_markers.get(node);
+    MarkerList* list = m_markers.get(&node);
     if (!list)
         return;
 
@@ -489,13 +489,13 @@ void DocumentMarkerController::removeMarkers(Node* node, unsigned startOffset, i
     }
 
     if (list->isEmpty()) {
-        m_markers.remove(node);
+        m_markers.remove(&node);
         if (m_markers.isEmpty())
             m_possiblyExistingMarkerTypes = { };
     }
 
-    if (docDirty && node->renderer())
-        node->renderer()->repaint();
+    if (docDirty && node.renderer())
+        node.renderer()->repaint();
 }
 
 DocumentMarker* DocumentMarkerController::markerContainingPoint(const LayoutPoint& point, DocumentMarker::MarkerType markerType)
@@ -563,13 +563,13 @@ Vector<RenderedDocumentMarker*> DocumentMarkerController::markersInRange(Range&
     return foundMarkers;
 }
 
-void DocumentMarkerController::removeMarkers(Node* node, OptionSet<DocumentMarker::MarkerType> markerTypes)
+void DocumentMarkerController::removeMarkers(Node& node, OptionSet<DocumentMarker::MarkerType> markerTypes)
 {
     if (!possiblyHasMarkers(markerTypes))
         return;
     ASSERT(!m_markers.isEmpty());
     
-    auto iterator = m_markers.find(node);
+    auto iterator = m_markers.find(&node);
     if (iterator != m_markers.end())
         removeMarkersFromList(iterator, markerTypes);
 }
@@ -658,13 +658,13 @@ void DocumentMarkerController::repaintMarkers(OptionSet<DocumentMarker::MarkerTy
     }
 }
 
-void DocumentMarkerController::shiftMarkers(Node* node, unsigned startOffset, int delta)
+void DocumentMarkerController::shiftMarkers(Node& node, unsigned startOffset, int delta)
 {
     if (!possiblyHasMarkers(DocumentMarker::allMarkers()))
         return;
     ASSERT(!m_markers.isEmpty());
 
-    MarkerList* list = m_markers.get(node);
+    MarkerList* list = m_markers.get(&node);
     if (!list)
         return;
 
@@ -675,7 +675,7 @@ void DocumentMarkerController::shiftMarkers(Node* node, unsigned startOffset, in
 #if PLATFORM(IOS_FAMILY)
         int targetStartOffset = marker.startOffset() + delta;
         int targetEndOffset = marker.endOffset() + delta;
-        if (targetStartOffset >= node->maxCharacterOffset() || targetEndOffset <= 0) {
+        if (targetStartOffset >= node.maxCharacterOffset() || targetEndOffset <= 0) {
             list->remove(i);
             continue;
         }
@@ -694,7 +694,7 @@ void DocumentMarkerController::shiftMarkers(Node* node, unsigned startOffset, in
                 list->remove(i);
                 continue;
             }
-            marker.setEndOffset(targetEndOffset < node->maxCharacterOffset() ? targetEndOffset : node->maxCharacterOffset());
+            marker.setEndOffset(targetEndOffset < node.maxCharacterOffset() ? targetEndOffset : node.maxCharacterOffset());
             didShiftMarker = true;
         }
 #endif
@@ -702,34 +702,34 @@ void DocumentMarkerController::shiftMarkers(Node* node, unsigned startOffset, in
     }
 
     if (didShiftMarker) {
-        invalidateRectsForMarkersInNode(*node);
+        invalidateRectsForMarkersInNode(node);
 
-        if (node->renderer())
-            node->renderer()->repaint();
+        if (node.renderer())
+            node.renderer()->repaint();
     }
 }
 
-void DocumentMarkerController::setMarkersActive(Range* range, bool active)
+void DocumentMarkerController::setMarkersActive(Range& range, bool active)
 {
     if (!possiblyHasMarkers(DocumentMarker::allMarkers()))
         return;
     ASSERT(!m_markers.isEmpty());
 
-    Node& startContainer = range->startContainer();
-    Node& endContainer = range->endContainer();
+    Node& startContainer = range.startContainer();
+    Node& endContainer = range.endContainer();
 
-    Node* pastLastNode = range->pastLastNode();
+    Node* pastLastNode = range.pastLastNode();
 
-    for (Node* node = range->firstNode(); node != pastLastNode; node = NodeTraversal::next(*node)) {
-        unsigned startOffset = node == &startContainer ? range->startOffset() : 0;
-        unsigned endOffset = node == &endContainer ? range->endOffset() : std::numeric_limits<unsigned>::max();
-        setMarkersActive(node, startOffset, endOffset, active);
+    for (Node* node = range.firstNode(); node != pastLastNode; node = NodeTraversal::next(*node)) {
+        unsigned startOffset = node == &startContainer ? range.startOffset() : 0;
+        unsigned endOffset = node == &endContainer ? range.endOffset() : std::numeric_limits<unsigned>::max();
+        setMarkersActive(*node, startOffset, endOffset, active);
     }
 }
 
-void DocumentMarkerController::setMarkersActive(Node* node, unsigned startOffset, unsigned endOffset, bool active)
+void DocumentMarkerController::setMarkersActive(Node& node, unsigned startOffset, unsigned endOffset, bool active)
 {
-    MarkerList* list = m_markers.get(node);
+    MarkerList* list = m_markers.get(&node);
     if (!list)
         return;
 
@@ -747,8 +747,8 @@ void DocumentMarkerController::setMarkersActive(Node* node, unsigned startOffset
         didActivateMarker = true;
     }
 
-    if (didActivateMarker && node->renderer())
-        node->renderer()->repaint();
+    if (didActivateMarker && node.renderer())
+        node.renderer()->repaint();
 }
 
 bool DocumentMarkerController::hasMarkers(Range& range, OptionSet<DocumentMarker::MarkerType> markerTypes)
index dd7d64f..82e03f5 100644 (file)
@@ -3,7 +3,7 @@
  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
  *           (C) 2001 Dirk Mueller (mueller@kde.org)
  *           (C) 2006 Alexey Proskuryakov (ap@webkit.org)
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2019 Apple Inc. All rights reserved.
  * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
  * Copyright (C) Research In Motion Limited 2010. All rights reserved.
  *
@@ -48,19 +48,19 @@ public:
     ~DocumentMarkerController();
 
     void detach();
-    void addMarker(Range*, DocumentMarker::MarkerType);
-    void addMarker(Range*, DocumentMarker::MarkerType, const String& description);
-    void addMarkerToNode(Node*, unsigned startOffset, unsigned length, DocumentMarker::MarkerType);
-    void addMarkerToNode(Node*, unsigned startOffset, unsigned length, DocumentMarker::MarkerType, DocumentMarker::Data&&);
-    WEBCORE_EXPORT void addTextMatchMarker(const Range*, bool activeMatch);
+    void addMarker(Range&, DocumentMarker::MarkerType);
+    void addMarker(Range&, DocumentMarker::MarkerType, const String& description);
+    void addMarkerToNode(Node&, unsigned startOffset, unsigned length, DocumentMarker::MarkerType);
+    void addMarkerToNode(Node&, unsigned startOffset, unsigned length, DocumentMarker::MarkerType, DocumentMarker::Data&&);
+    WEBCORE_EXPORT void addTextMatchMarker(const Range&, bool activeMatch);
 #if PLATFORM(IOS_FAMILY)
-    void addMarker(Range*, DocumentMarker::MarkerType, const String& description, const Vector<String>& interpretations, const RetainPtr<id>& metadata);
-    void addDictationPhraseWithAlternativesMarker(Range*, const Vector<String>& interpretations);
-    void addDictationResultMarker(Range*, const RetainPtr<id>& metadata);
+    void addMarker(Range&, DocumentMarker::MarkerType, const String& description, const Vector<String>& interpretations, const RetainPtr<id>& metadata);
+    void addDictationPhraseWithAlternativesMarker(Range&, const Vector<String>& interpretations);
+    void addDictationResultMarker(Range&, const RetainPtr<id>& metadata);
 #endif
-    void addDraggedContentMarker(RefPtr<Range>);
+    void addDraggedContentMarker(Range&);
 
-    void copyMarkers(Node* srcNode, unsigned startOffset, int length, Node* dstNode, int delta);
+    void copyMarkers(Node& srcNode, unsigned startOffset, int length, Node& dstNode, int delta);
     bool hasMarkers() const
     {
         ASSERT(m_markers.isEmpty() == !m_possiblyExistingMarkerTypes.containsAny(DocumentMarker::allMarkers()));
@@ -72,15 +72,15 @@ public:
     // remove the marker. If the argument is false, we will adjust the span of the marker so that it retains
     // the portion that is outside of the range.
     enum RemovePartiallyOverlappingMarkerOrNot { DoNotRemovePartiallyOverlappingMarker, RemovePartiallyOverlappingMarker };
-    void removeMarkers(Range*, OptionSet<DocumentMarker::MarkerType> = DocumentMarker::allMarkers(), RemovePartiallyOverlappingMarkerOrNot = DoNotRemovePartiallyOverlappingMarker);
-    void removeMarkers(Node*, unsigned startOffset, int length, OptionSet<DocumentMarker::MarkerType> = DocumentMarker::allMarkers(),  RemovePartiallyOverlappingMarkerOrNot = DoNotRemovePartiallyOverlappingMarker);
+    void removeMarkers(Range&, OptionSet<DocumentMarker::MarkerType> = DocumentMarker::allMarkers(), RemovePartiallyOverlappingMarkerOrNot = DoNotRemovePartiallyOverlappingMarker);
+    void removeMarkers(Node&, unsigned startOffset, int length, OptionSet<DocumentMarker::MarkerType> = DocumentMarker::allMarkers(),  RemovePartiallyOverlappingMarkerOrNot = DoNotRemovePartiallyOverlappingMarker);
 
     WEBCORE_EXPORT void removeMarkers(OptionSet<DocumentMarker::MarkerType> = DocumentMarker::allMarkers());
-    void removeMarkers(Node*, OptionSet<DocumentMarker::MarkerType> = DocumentMarker::allMarkers());
+    void removeMarkers(Node&, OptionSet<DocumentMarker::MarkerType> = DocumentMarker::allMarkers());
     void repaintMarkers(OptionSet<DocumentMarker::MarkerType> = DocumentMarker::allMarkers());
-    void shiftMarkers(Node*, unsigned startOffset, int delta);
-    void setMarkersActive(Range*, bool);
-    void setMarkersActive(Node*, unsigned startOffset, unsigned endOffset, bool);
+    void shiftMarkers(Node&, unsigned startOffset, int delta);
+    void setMarkersActive(Range&, bool);
+    void setMarkersActive(Node&, unsigned startOffset, unsigned endOffset, bool);
 
     WEBCORE_EXPORT Vector<RenderedDocumentMarker*> markersFor(Node&, OptionSet<DocumentMarker::MarkerType> = DocumentMarker::allMarkers());
     WEBCORE_EXPORT Vector<RenderedDocumentMarker*> markersInRange(Range&, OptionSet<DocumentMarker::MarkerType>);
@@ -99,7 +99,7 @@ public:
 #endif
 
 private:
-    void addMarker(Node*, const DocumentMarker&);
+    void addMarker(Node&, const DocumentMarker&);
 
     typedef Vector<RenderedDocumentMarker> MarkerList;
     typedef HashMap<RefPtr<Node>, std::unique_ptr<MarkerList>> MarkerMap;
index da5cd2f..b2f13d0 100644 (file)
@@ -200,7 +200,7 @@ Element::~Element()
         detachAllAttrNodesFromElement();
 
     if (hasPendingResources()) {
-        document().accessSVGExtensions().removeElementFromPendingResources(this);
+        document().accessSVGExtensions().removeElementFromPendingResources(*this);
         ASSERT(!hasPendingResources());
     }
 }
@@ -546,7 +546,7 @@ bool Element::isFocusable() const
 bool Element::isUserActionElementInActiveChain() const
 {
     ASSERT(isUserActionElement());
-    return document().userActionElements().inActiveChain(*this);
+    return document().userActionElements().isInActiveChain(*this);
 }
 
 bool Element::isUserActionElementActive() const
@@ -1843,16 +1843,16 @@ bool Element::hasAttributes() const
     return elementData() && elementData()->length();
 }
 
-bool Element::hasEquivalentAttributes(const Element* other) const
+bool Element::hasEquivalentAttributes(const Element& other) const
 {
     synchronizeAllAttributes();
-    other->synchronizeAllAttributes();
-    if (elementData() == other->elementData())
+    other.synchronizeAllAttributes();
+    if (elementData() == other.elementData())
         return true;
     if (elementData())
-        return elementData()->isEquivalent(other->elementData());
-    if (other->elementData())
-        return other->elementData()->isEquivalent(elementData());
+        return elementData()->isEquivalent(other.elementData());
+    if (other.elementData())
+        return other.elementData()->isEquivalent(elementData());
     return true;
 }
 
@@ -2013,7 +2013,7 @@ void Element::removedFromAncestor(RemovalType removalType, ContainerNode& oldPar
     ContainerNode::removedFromAncestor(removalType, oldParentOfRemovedTree);
 
     if (hasPendingResources())
-        document().accessSVGExtensions().removeElementFromPendingResources(this);
+        document().accessSVGExtensions().removeElementFromPendingResources(*this);
 
     RefPtr<Frame> frame = document().frame();
     if (auto* timeline = document().existingTimeline())
@@ -3768,9 +3768,9 @@ void Element::clearHoverAndActiveStatusBeforeDetachingRenderer()
     if (!isUserActionElement())
         return;
     if (hovered())
-        document().hoveredElementDidDetach(this);
-    if (inActiveChain())
-        document().elementInActiveChainDidDetach(this);
+        document().hoveredElementDidDetach(*this);
+    if (isInActiveChain())
+        document().elementInActiveChainDidDetach(*this);
     document().userActionElements().clearActiveAndHovered(*this);
 }
 
index 169fde1..c5eb6cb 100644 (file)
@@ -278,7 +278,7 @@ public:
 
     virtual void didMoveToNewDocument(Document& oldDocument, Document& newDocument);
 
-    bool hasEquivalentAttributes(const Element* other) const;
+    bool hasEquivalentAttributes(const Element& other) const;
 
     virtual void copyNonAttributePropertiesFromElement(const Element&) { }
 
@@ -305,7 +305,7 @@ public:
     // FIXME: this should not be virtual, do not override this.
     virtual const AtomicString& shadowPseudoId() const;
 
-    bool inActiveChain() const { return isUserActionElement() && isUserActionElementInActiveChain(); }
+    bool isInActiveChain() const { return isUserActionElement() && isUserActionElementInActiveChain(); }
     bool active() const { return isUserActionElement() && isUserActionElementActive(); }
     bool hovered() const { return isUserActionElement() && isUserActionElementHovered(); }
     bool focused() const { return isUserActionElement() && isUserActionElementFocused(); }
@@ -626,11 +626,6 @@ private:
 
     virtual void didAddUserAgentShadowRoot(ShadowRoot&) { }
 
-    // FIXME: Remove the need for Attr to call willModifyAttribute/didModifyAttribute.
-    friend class Attr;
-
-    enum SynchronizationOfLazyAttribute { NotInSynchronizationOfLazyAttribute = 0, InSynchronizationOfLazyAttribute };
-
     void didAddAttribute(const QualifiedName&, const AtomicString&);
     void willModifyAttribute(const QualifiedName&, const AtomicString& oldValue, const AtomicString& newValue);
     void didModifyAttribute(const QualifiedName&, const AtomicString& oldValue, const AtomicString& newValue);
@@ -658,6 +653,7 @@ private:
     NodeType nodeType() const final;
     bool childTypeAllowed(NodeType) const final;
 
+    enum SynchronizationOfLazyAttribute { NotInSynchronizationOfLazyAttribute, InSynchronizationOfLazyAttribute };
     void setAttributeInternal(unsigned index, const QualifiedName&, const AtomicString& value, SynchronizationOfLazyAttribute);
     void addAttributeInternal(const QualifiedName&, const AtomicString& value, SynchronizationOfLazyAttribute);
     void removeAttributeInternal(unsigned index, SynchronizationOfLazyAttribute);
index 5b74a2b..17bcee6 100644 (file)
@@ -26,7 +26,6 @@
 #include "NamedNodeMap.h"
 
 #include "Attr.h"
-#include "HTMLDocument.h"
 #include "HTMLElement.h"
 
 namespace WebCore {
@@ -66,7 +65,7 @@ ExceptionOr<Ref<Attr>> NamedNodeMap::removeNamedItem(const AtomicString& name)
 Vector<String> NamedNodeMap::supportedPropertyNames() const
 {
     Vector<String> names = m_element.getAttributeNames();
-    if (is<HTMLElement>(m_element) && is<HTMLDocument>(m_element.document())) {
+    if (is<HTMLElement>(m_element) && m_element.document().isHTMLDocument()) {
         names.removeAllMatching([](String& name) {
             for (auto character : StringView { name }.codeUnits()) {
                 if (isASCIIUpper(character))
index 07c2f65..019caff 100644 (file)
@@ -660,7 +660,7 @@ void Node::normalize()
         while (Node* nextSibling = node->nextSibling()) {
             if (nextSibling->nodeType() != TEXT_NODE)
                 break;
-            RefPtr<Text> nextText = downcast<Text>(nextSibling);
+            Ref<Text> nextText = downcast<Text>(*nextSibling);
 
             // Remove empty text nodes.
             if (!nextText->length()) {
@@ -671,7 +671,7 @@ void Node::normalize()
             // Both non-empty text nodes. Merge them.
             unsigned offset = text->length();
             text->appendData(nextText->data());
-            document().textNodesMerged(nextText.get(), offset);
+            document().textNodesMerged(nextText, offset);
             nextText->remove();
         }
 
@@ -1379,7 +1379,7 @@ bool Node::isEqualNode(Node* other) const
         auto& otherElement = downcast<Element>(*other);
         if (thisElement.tagQName() != otherElement.tagQName())
             return false;
-        if (!thisElement.hasEquivalentAttributes(&otherElement))
+        if (!thisElement.hasEquivalentAttributes(otherElement))
             return false;
         break;
         }
index 45d860b..f6f1020 100644 (file)
@@ -73,7 +73,7 @@ inline NodeIterator::NodeIterator(Node& rootNode, unsigned whatToShow, RefPtr<No
     : NodeIteratorBase(rootNode, whatToShow, WTFMove(filter))
     , m_referenceNode(rootNode, true)
 {
-    root().document().attachNodeIterator(this);
+    root().document().attachNodeIterator(*this);
 }
 
 Ref<NodeIterator> NodeIterator::create(Node& rootNode, unsigned whatToShow, RefPtr<NodeFilter>&& filter)
@@ -83,7 +83,7 @@ Ref<NodeIterator> NodeIterator::create(Node& rootNode, unsigned whatToShow, RefP
 
 NodeIterator::~NodeIterator()
 {
-    root().document().detachNodeIterator(this);
+    root().document().detachNodeIterator(*this);
 }
 
 ExceptionOr<RefPtr<Node>> NodeIterator::nextNode()
index b807bef..679ebe2 100644 (file)
@@ -33,18 +33,17 @@ public:
     bool isEmpty() const { return m_members.isEmpty(); }
     bool isRequired() const { return m_requiredCount; }
     HTMLInputElement* checkedButton() const { return m_checkedButton; }
-    void add(HTMLInputElement*);
-    void updateCheckedState(HTMLInputElement*);
+    void add(HTMLInputElement&);
+    void updateCheckedState(HTMLInputElement&);
     void requiredStateChanged(HTMLInputElement&);
-    void remove(HTMLInputElement*);
-    bool contains(HTMLInputElement*) const;
+    void remove(HTMLInputElement&);
+    bool contains(HTMLInputElement&) const;
     Vector<HTMLInputElement*> members() const;
 
 private:
     void setNeedsStyleRecalcForAllButtons();
     void updateValidityForAllButtons();
     bool isValid() const;
-    void changeCheckedButton(HTMLInputElement*);
     void setCheckedButton(HTMLInputElement*);
 
     HashSet<HTMLInputElement*> m_members;
@@ -80,16 +79,16 @@ void RadioButtonGroup::setCheckedButton(HTMLInputElement* button)
         oldCheckedButton->setChecked(false);
 }
 
-void RadioButtonGroup::add(HTMLInputElement* button)
+void RadioButtonGroup::add(HTMLInputElement& button)
 {
-    ASSERT(button->isRadioButton());
-    if (!m_members.add(button).isNewEntry)
+    ASSERT(button.isRadioButton());
+    if (!m_members.add(&button).isNewEntry)
         return;
     bool groupWasValid = isValid();
-    if (button->isRequired())
+    if (button.isRequired())
         ++m_requiredCount;
-    if (button->checked())
-        setCheckedButton(button);
+    if (button.checked())
+        setCheckedButton(&button);
 
     bool groupIsValid = isValid();
     if (groupWasValid != groupIsValid)
@@ -97,19 +96,19 @@ void RadioButtonGroup::add(HTMLInputElement* button)
     else if (!groupIsValid) {
         // A radio button not in a group is always valid. We need to make it
         // invalid only if the group is invalid.
-        button->updateValidity();
+        button.updateValidity();
     }
 }
 
-void RadioButtonGroup::updateCheckedState(HTMLInputElement* button)
+void RadioButtonGroup::updateCheckedState(HTMLInputElement& button)
 {
-    ASSERT(button->isRadioButton());
-    ASSERT(m_members.contains(button));
+    ASSERT(button.isRadioButton());
+    ASSERT(m_members.contains(&button));
     bool wasValid = isValid();
-    if (button->checked())
-        setCheckedButton(button);
+    if (button.checked())
+        setCheckedButton(&button);
     else {
-        if (m_checkedButton == button)
+        if (m_checkedButton == &button)
             setCheckedButton(nullptr);
     }
     if (wasValid != isValid())
@@ -131,22 +130,22 @@ void RadioButtonGroup::requiredStateChanged(HTMLInputElement& button)
         updateValidityForAllButtons();
 }
 
-void RadioButtonGroup::remove(HTMLInputElement* button)
+void RadioButtonGroup::remove(HTMLInputElement& button)
 {
-    ASSERT(button->isRadioButton());
-    HashSet<HTMLInputElement*>::iterator it = m_members.find(button);
+    ASSERT(button.isRadioButton());
+    auto it = m_members.find(&button);
     if (it == m_members.end())
         return;
 
     bool wasValid = isValid();
     m_members.remove(it);
-    if (button->isRequired()) {
+    if (button.isRequired()) {
         ASSERT(m_requiredCount);
         --m_requiredCount;
     }
     if (m_checkedButton) {
-        button->invalidateStyleForSubtree();
-        if (m_checkedButton == button) {
+        button.invalidateStyleForSubtree();
+        if (m_checkedButton == &button) {
             m_checkedButton = nullptr;
             setNeedsStyleRecalcForAllButtons();
         }
@@ -160,7 +159,7 @@ void RadioButtonGroup::remove(HTMLInputElement* button)
     if (!wasValid) {
         // A radio button not in a group is always valid. We need to make it
         // valid only if the group was invalid.
-        button->updateValidity();
+        button.updateValidity();
     }
 }
 
@@ -180,9 +179,9 @@ void RadioButtonGroup::updateValidityForAllButtons()
     }
 }
 
-bool RadioButtonGroup::contains(HTMLInputElement* button) const
+bool RadioButtonGroup::contains(HTMLInputElement& button) const
 {
-    return m_members.contains(button);
+    return m_members.contains(&button);
 }
 
 // ----------------------------------------------------------------
@@ -194,16 +193,16 @@ RadioButtonGroups::RadioButtonGroups() = default;
 
 RadioButtonGroups::~RadioButtonGroups() = default;
 
-void RadioButtonGroups::addButton(HTMLInputElement* element)
+void RadioButtonGroups::addButton(HTMLInputElement& element)
 {
-    ASSERT(element->isRadioButton());
-    if (element->name().isEmpty())
+    ASSERT(element.isRadioButton());
+    if (element.name().isEmpty())
         return;
 
     if (!m_nameToGroupMap)
         m_nameToGroupMap = std::make_unique<NameToGroupMap>();
 
-    auto& group = m_nameToGroupMap->add(element->name().impl(), nullptr).iterator->value;
+    auto& group = m_nameToGroupMap->add(element.name().impl(), nullptr).iterator->value;
     if (!group)
         group = std::make_unique<RadioButtonGroup>();
     group->add(element);
@@ -228,17 +227,15 @@ Vector<HTMLInputElement*> RadioButtonGroups::groupMembers(const HTMLInputElement
     return group->members();
 }
 
-void RadioButtonGroups::updateCheckedState(HTMLInputElement* element)
+void RadioButtonGroups::updateCheckedState(HTMLInputElement& element)
 {
-    ASSERT(element->isRadioButton());
-    if (element->name().isEmpty())
+    ASSERT(element.isRadioButton());
+    if (element.name().isEmpty())
         return;
     ASSERT(m_nameToGroupMap);
     if (!m_nameToGroupMap)
         return;
-    RadioButtonGroup* group = m_nameToGroupMap->get(element->name().impl());
-    ASSERT(group);
-    group->updateCheckedState(element);
+    m_nameToGroupMap->get(element.name().impl())->updateCheckedState(element);
 }
 
 void RadioButtonGroups::requiredStateChanged(HTMLInputElement& element)
@@ -263,38 +260,36 @@ HTMLInputElement* RadioButtonGroups::checkedButtonForGroup(const AtomicString& n
     return group ? group->checkedButton() : nullptr;
 }
 
-bool RadioButtonGroups::hasCheckedButton(const HTMLInputElement* element) const
+bool RadioButtonGroups::hasCheckedButton(const HTMLInputElement& element) const
 {
-    ASSERT(element->isRadioButton());
-    const AtomicString& name = element->name();
+    ASSERT(element.isRadioButton());
+    const AtomicString& name = element.name();
     if (name.isEmpty() || !m_nameToGroupMap)
-        return element->checked();
-
-    const RadioButtonGroup* group = m_nameToGroupMap->get(name.impl());
-    return group->checkedButton();
+        return element.checked();
+    return m_nameToGroupMap->get(name.impl())->checkedButton();
 }
 
-bool RadioButtonGroups::isInRequiredGroup(HTMLInputElement* element) const
+bool RadioButtonGroups::isInRequiredGroup(HTMLInputElement& element) const
 {
-    ASSERT(element->isRadioButton());
-    if (element->name().isEmpty())
+    ASSERT(element.isRadioButton());
+    if (element.name().isEmpty())
         return false;
     if (!m_nameToGroupMap)
         return false;
-    RadioButtonGroup* group = m_nameToGroupMap->get(element->name().impl());
+    auto* group = m_nameToGroupMap->get(element.name().impl());
     return group && group->isRequired() && group->contains(element);
 }
 
-void RadioButtonGroups::removeButton(HTMLInputElement* element)
+void RadioButtonGroups::removeButton(HTMLInputElement& element)
 {
-    ASSERT(element->isRadioButton());
-    if (element->name().isEmpty())
+    ASSERT(element.isRadioButton());
+    if (element.name().isEmpty())
         return;
     if (!m_nameToGroupMap)
         return;
 
     m_nameToGroupMap->checkConsistency();
-    NameToGroupMap::iterator it = m_nameToGroupMap->find(element->name().impl());
+    auto it = m_nameToGroupMap->find(element.name().impl());
     if (it == m_nameToGroupMap->end())
         return;
     it->value->remove(element);
index de8a208..4b28450 100644 (file)
@@ -34,13 +34,13 @@ class RadioButtonGroups {
 public:
     RadioButtonGroups();
     ~RadioButtonGroups();
-    void addButton(HTMLInputElement*);
-    void updateCheckedState(HTMLInputElement*);
+    void addButton(HTMLInputElement&);
+    void updateCheckedState(HTMLInputElement&);
     void requiredStateChanged(HTMLInputElement&);
-    void removeButton(HTMLInputElement*);
+    void removeButton(HTMLInputElement&);
     HTMLInputElement* checkedButtonForGroup(const AtomicString& groupName) const;
-    bool hasCheckedButton(const HTMLInputElement*) const;
-    bool isInRequiredGroup(HTMLInputElement*) const;
+    bool hasCheckedButton(const HTMLInputElement&) const;
+    bool isInRequiredGroup(HTMLInputElement&) const;
     Vector<HTMLInputElement*> groupMembers(const HTMLInputElement&) const;
 
 private:
index 00d6b9f..77c0f83 100644 (file)
@@ -34,7 +34,6 @@
 #include "Frame.h"
 #include "FrameView.h"
 #include "HTMLBodyElement.h"
-#include "HTMLDocument.h"
 #include "HTMLElement.h"
 #include "HTMLHtmlElement.h"
 #include "HTMLNames.h"
@@ -79,7 +78,7 @@ inline Range::Range(Document& ownerDocument)
     rangeCounter.increment();
 #endif
 
-    m_ownerDocument->attachRange(this);
+    m_ownerDocument->attachRange(*this);
 }
 
 Ref<Range> Range::create(Document& ownerDocument)
@@ -96,7 +95,7 @@ inline Range::Range(Document& ownerDocument, Node* startContainer, int startOffs
     rangeCounter.increment();
 #endif
 
-    m_ownerDocument->attachRange(this);
+    m_ownerDocument->attachRange(*this);
 
     // Simply setting the containers and offsets directly would not do any of the checking
     // that setStart and setEnd do, so we call those functions.
@@ -125,7 +124,7 @@ Ref<Range> Range::create(Document& ownerDocument, const VisiblePosition& visible
 
 Range::~Range()
 {
-    m_ownerDocument->detachRange(this);
+    m_ownerDocument->detachRange(*this);
 
 #ifndef NDEBUG
     rangeCounter.decrement();
@@ -135,11 +134,11 @@ Range::~Range()
 void Range::setDocument(Document& document)
 {
     ASSERT(m_ownerDocument.ptr() != &document);
-    m_ownerDocument->detachRange(this);
+    m_ownerDocument->detachRange(*this);
     m_ownerDocument = document;
     m_start.setToStartOfNode(document);
     m_end.setToStartOfNode(document);
-    m_ownerDocument->attachRange(this);
+    m_ownerDocument->attachRange(*this);
 }
 
 Node* Range::commonAncestorContainer(Node* containerA, Node* containerB)
@@ -972,7 +971,7 @@ ExceptionOr<Ref<DocumentFragment>> Range::createContextualFragment(const String&
         element = &downcast<Element>(node);
     else
         element = node.parentElement();
-    if (!element || (is<HTMLDocument>(element->document()) && is<HTMLHtmlElement>(*element)))
+    if (!element || (element->document().isHTMLDocument() && is<HTMLHtmlElement>(*element)))
         element = HTMLBodyElement::create(node.document());
     return WebCore::createContextualFragment(*element, markup, AllowScriptingContentAndDoNotMarkAlreadyStarted);
 }
@@ -1664,9 +1663,9 @@ void Range::nodeWillBeRemoved(Node& node)
     boundaryNodeWillBeRemoved(m_end, node);
 }
 
-static inline void boundaryTextInserted(RangeBoundaryPoint& boundary, Node* text, unsigned offset, unsigned length)
+static inline void boundaryTextInserted(RangeBoundaryPoint& boundary, Node& text, unsigned offset, unsigned length)
 {
-    if (boundary.container() != text)
+    if (boundary.container() != &text)
         return;
     unsigned boundaryOffset = boundary.offset();
     if (offset >= boundaryOffset)
@@ -1674,17 +1673,16 @@ static inline void boundaryTextInserted(RangeBoundaryPoint& boundary, Node* text
     boundary.setOffset(boundaryOffset + length);
 }
 
-void Range::textInserted(Node* text, unsigned offset, unsigned length)
+void Range::textInserted(Node& text, unsigned offset, unsigned length)
 {
-    ASSERT(text);
-    ASSERT(&text->document() == &ownerDocument());
+    ASSERT(&text.document() == &ownerDocument());
     boundaryTextInserted(m_start, text, offset, length);
     boundaryTextInserted(m_end, text, offset, length);
 }
 
-static inline void boundaryTextRemoved(RangeBoundaryPoint& boundary, Node* text, unsigned offset, unsigned length)
+static inline void boundaryTextRemoved(RangeBoundaryPoint& boundary, Node& text, unsigned offset, unsigned length)
 {
-    if (boundary.container() != text)
+    if (boundary.container() != &text)
         return;
     unsigned boundaryOffset = boundary.offset();
     if (offset >= boundaryOffset)
@@ -1695,10 +1693,9 @@ static inline void boundaryTextRemoved(RangeBoundaryPoint& boundary, Node* text,
         boundary.setOffset(boundaryOffset - length);
 }
 
-void Range::textRemoved(Node* text, unsigned offset, unsigned length)
+void Range::textRemoved(Node& text, unsigned offset, unsigned length)
 {
-    ASSERT(text);
-    ASSERT(&text->document() == &ownerDocument());
+    ASSERT(&text.document() == &ownerDocument());
     boundaryTextRemoved(m_start, text, offset, length);
     boundaryTextRemoved(m_end, text, offset, length);
 }
@@ -1723,15 +1720,15 @@ void Range::textNodesMerged(NodeWithIndex& oldNode, unsigned offset)
     boundaryTextNodesMerged(m_end, oldNode, offset);
 }
 
-static inline void boundaryTextNodesSplit(RangeBoundaryPoint& boundary, Text* oldNode)
+static inline void boundaryTextNodesSplit(RangeBoundaryPoint& boundary, Text& oldNode)
 {
-    auto* parent = oldNode->parentNode();
-    if (boundary.container() == oldNode) {
-        unsigned splitOffset = oldNode->length();
+    auto* parent = oldNode.parentNode();
+    if (boundary.container() == &oldNode) {
+        unsigned splitOffset = oldNode.length();
         unsigned boundaryOffset = boundary.offset();
         if (boundaryOffset > splitOffset) {
             if (parent)
-                boundary.set(*oldNode->nextSibling(), boundaryOffset - splitOffset, 0);
+                boundary.set(*oldNode.nextSibling(), boundaryOffset - splitOffset, 0);
             else
                 boundary.setOffset(splitOffset);
         }
@@ -1739,20 +1736,18 @@ static inline void boundaryTextNodesSplit(RangeBoundaryPoint& boundary, Text* ol
     }
     if (!parent)
         return;
-    if (boundary.container() == parent && boundary.childBefore() == oldNode) {
-        auto* newChild = oldNode->nextSibling();
+    if (boundary.container() == parent && boundary.childBefore() == &oldNode) {
+        auto* newChild = oldNode.nextSibling();
         ASSERT(newChild);
         boundary.setToAfterChild(*newChild);
     }
 }
 
-void Range::textNodeSplit(Text* oldNode)
+void Range::textNodeSplit(Text& oldNode)
 {
-    ASSERT(oldNode);
-    ASSERT(&oldNode->document() == &ownerDocument());
-    ASSERT(oldNode->isTextNode());
-    ASSERT(!oldNode->parentNode() || oldNode->nextSibling());
-    ASSERT(!oldNode->parentNode() || oldNode->nextSibling()->isTextNode());
+    ASSERT(&oldNode.document() == &ownerDocument());
+    ASSERT(!oldNode.parentNode() || oldNode.nextSibling());
+    ASSERT(!oldNode.parentNode() || oldNode.nextSibling()->isTextNode());
     boundaryTextNodesSplit(m_start, oldNode);
     boundaryTextNodesSplit(m_end, oldNode);
 }
index 98c1644..f6c441a 100644 (file)
@@ -132,10 +132,10 @@ public:
     void nodeChildrenWillBeRemoved(ContainerNode&);
     void nodeWillBeRemoved(Node&);
 
-    void textInserted(Node*, unsigned offset, unsigned length);
-    void textRemoved(Node*, unsigned offset, unsigned length);
+    void textInserted(Node&, unsigned offset, unsigned length);
+    void textRemoved(Node&, unsigned offset, unsigned length);
     void textNodesMerged(NodeWithIndex& oldNode, unsigned offset);
-    void textNodeSplit(Text* oldNode);
+    void textNodeSplit(Text& oldNode);
 
     // Expand range to a unit (word or sentence or block or document) boundary.
     // Please refer to https://bugs.webkit.org/show_bug.cgi?id=27632 comment #5 
index 0b7db0b..063d64d 100644 (file)
@@ -252,11 +252,11 @@ bool ScriptElement::prepareScript(const TextPosition& scriptStartPosition, Legac
     } else if ((isClassicExternalScript || scriptType == ScriptType::Module) && !hasAsyncAttribute() && !m_forceAsync) {
         m_willExecuteInOrder = true;
         ASSERT(m_loadableScript);
-        document.scriptRunner()->queueScriptForExecution(*this, *m_loadableScript, ScriptRunner::IN_ORDER_EXECUTION);
+        document.scriptRunner().queueScriptForExecution(*this, *m_loadableScript, ScriptRunner::IN_ORDER_EXECUTION);
     } else if (hasSourceAttribute() || scriptType == ScriptType::Module) {
         ASSERT(m_loadableScript);
         ASSERT(hasAsyncAttribute() || m_forceAsync);
-        document.scriptRunner()->queueScriptForExecution(*this, *m_loadableScript, ScriptRunner::ASYNC_EXECUTION);
+        document.scriptRunner().queueScriptForExecution(*this, *m_loadableScript, ScriptRunner::ASYNC_EXECUTION);
     } else if (!hasSourceAttribute() && m_parserInserted && !document.haveStylesheetsLoaded()) {
         ASSERT(scriptType == ScriptType::Classic);
         m_willBeParserExecuted = true;
index 50f292b..050d169 100644 (file)
@@ -73,7 +73,7 @@ ExceptionOr<Ref<Text>> Text::splitText(unsigned offset)
             return insertResult.releaseException();
     }
 
-    document().textNodeSplit(this);
+    document().textNodeSplit(*this);
 
     if (renderer())
         renderer()->setTextWithOffset(data(), 0, oldData.length());
index 1fa6b3d..e73f0e2 100644 (file)
@@ -27,6 +27,7 @@
 
 #pragma once
 
+#include <wtf/Forward.h>
 #include <wtf/HashMap.h>
 #include <wtf/OptionSet.h>
 #include <wtf/Ref.h>
@@ -40,7 +41,7 @@ public:
     bool isActive(const Element& element) { return hasFlag(element, Flag::IsActive); }
     bool isFocused(const Element& element) { return hasFlag(element, Flag::IsFocused); }
     bool isHovered(const Element& element) { return hasFlag(element, Flag::IsHovered); }
-    bool inActiveChain(const Element& element) { return hasFlag(element, Flag::InActiveChain); }
+    bool isInActiveChain(const Element& element) { return hasFlag(element, Flag::InActiveChain); }
 
     void setActive(Element& element, bool enable) { setFlags(element, enable, Flag::IsActive); }
     void setFocused(Element& element, bool enable) { setFlags(element, enable, Flag::IsFocused); }
index 516d76e..2b75bd6 100644 (file)
@@ -234,7 +234,7 @@ void AlternativeTextController::applyAlternativeTextToRange(const Range& range,
     DocumentMarkerController& markers = replacementRange->startContainer().document().markers();
 
     for (auto markerType : markerTypesToAdd)
-        markers.addMarker(replacementRange.get(), markerType, markerDescriptionForAppliedAlternativeText(alternativeType, markerType));
+        markers.addMarker(*replacementRange, markerType, markerDescriptionForAppliedAlternativeText(alternativeType, markerType));
 }
 
 bool AlternativeTextController::applyAutocorrectionBeforeTypingIfAppropriate()
@@ -268,10 +268,10 @@ void AlternativeTextController::respondToUnappliedSpellCorrection(const VisibleS
     m_frame.selection().setSelection(selectionOfCorrected, FrameSelection::defaultSetSelectionOptions() | FrameSelection::SpellCorrectionTriggered);
     auto range = Range::create(*m_frame.document(), m_frame.selection().selection().start(), m_frame.selection().selection().end());
 
-    DocumentMarkerController& markers = m_frame.document()->markers();
-    markers.removeMarkers(range.ptr(), OptionSet<DocumentMarker::MarkerType> { DocumentMarker::Spelling, DocumentMarker::Autocorrected }, DocumentMarkerController::RemovePartiallyOverlappingMarker);
-    markers.addMarker(range.ptr(), DocumentMarker::Replacement);
-    markers.addMarker(range.ptr(), DocumentMarker::SpellCheckingExemption);
+    auto& markers = m_frame.document()->markers();
+    markers.removeMarkers(range, OptionSet<DocumentMarker::MarkerType> { DocumentMarker::Spelling, DocumentMarker::Autocorrected }, DocumentMarkerController::RemovePartiallyOverlappingMarker);
+    markers.addMarker(range, DocumentMarker::Replacement);
+    markers.addMarker(range, DocumentMarker::SpellCheckingExemption);
 }
 
 void AlternativeTextController::timerFired()
@@ -360,7 +360,7 @@ void AlternativeTextController::handleAlternativeTextUIResult(const String& resu
         if (result.length())
             applyAlternativeTextToRange(*rangeWithAlternative, result, m_type, markerTypesForAutocorrection());
         else if (!m_isDismissedByEditing)
-            rangeWithAlternative->startContainer().document().markers().addMarker(rangeWithAlternative, DocumentMarker::RejectedCorrection, m_originalText);
+            rangeWithAlternative->startContainer().document().markers().addMarker(*rangeWithAlternative, DocumentMarker::RejectedCorrection, m_originalText);
         break;
     case AlternativeTextTypeReversion:
     case AlternativeTextTypeSpellingSuggestions:
@@ -444,9 +444,9 @@ void AlternativeTextController::respondToUnappliedEditing(EditCommandComposition
     if (!command->wasCreateLinkCommand())
         return;
     auto range = Range::create(*m_frame.document(), command->startingSelection().start(), command->startingSelection().end());
-    DocumentMarkerController& markers = m_frame.document()->markers();
-    markers.addMarker(range.ptr(), DocumentMarker::Replacement);
-    markers.addMarker(range.ptr(), DocumentMarker::SpellCheckingExemption);
+    auto& markers = m_frame.document()->markers();
+    markers.addMarker(range, DocumentMarker::Replacement);
+    markers.addMarker(range, DocumentMarker::SpellCheckingExemption);
 }
 
 AlternativeTextClient* AlternativeTextController::alternativeTextClient()
@@ -474,8 +474,8 @@ void AlternativeTextController::recordAutocorrectionResponse(AutocorrectionRespo
 
 void AlternativeTextController::markReversed(Range& changedRange)
 {
-    changedRange.startContainer().document().markers().removeMarkers(&changedRange, DocumentMarker::Autocorrected, DocumentMarkerController::RemovePartiallyOverlappingMarker);
-    changedRange.startContainer().document().markers().addMarker(&changedRange, DocumentMarker::SpellCheckingExemption);
+    changedRange.startContainer().document().markers().removeMarkers(changedRange, DocumentMarker::Autocorrected, DocumentMarkerController::RemovePartiallyOverlappingMarker);
+    changedRange.startContainer().document().markers().addMarker(changedRange, DocumentMarker::SpellCheckingExemption);
 }
 
 void AlternativeTextController::markCorrection(Range& replacedRange, const String& replacedString)
@@ -483,9 +483,9 @@ void AlternativeTextController::markCorrection(Range& replacedRange, const Strin
     DocumentMarkerController& markers = replacedRange.startContainer().document().markers();
     for (auto markerType : markerTypesForAutocorrection()) {
         if (markerType == DocumentMarker::Replacement || markerType == DocumentMarker::Autocorrected)
-            markers.addMarker(&replacedRange, markerType, replacedString);
+            markers.addMarker(replacedRange, markerType, replacedString);
         else
-            markers.addMarker(&replacedRange, markerType);
+            markers.addMarker(replacedRange, markerType);
     }
 }
 
@@ -505,7 +505,7 @@ void AlternativeTextController::recordSpellcheckerResponseForModifiedCorrection(
             client->recordAutocorrectionResponse(AutocorrectionResponse::Edited, corrected, correction);
     }
 
-    markers.removeMarkers(&rangeOfCorrection, DocumentMarker::Autocorrected, DocumentMarkerController::RemovePartiallyOverlappingMarker);
+    markers.removeMarkers(rangeOfCorrection, DocumentMarker::Autocorrected, DocumentMarkerController::RemovePartiallyOverlappingMarker);
 }
 
 void AlternativeTextController::deletedAutocorrectionAtPosition(const Position& position, const String& originalString)
@@ -532,7 +532,7 @@ void AlternativeTextController::markPrecedingWhitespaceForDeletedAutocorrectionA
     // Mark this whitespace to indicate we have deleted an autocorrection following this
     // whitespace. So if the user types the same original word again at this position, we
     // won't autocorrect it again.
-    m_frame.document()->markers().addMarker(precedingCharacterRange.ptr(), DocumentMarker::DeletedAutocorrection, m_originalStringForLastDeletedAutocorrection);
+    m_frame.document()->markers().addMarker(precedingCharacterRange, DocumentMarker::DeletedAutocorrection, m_originalStringForLastDeletedAutocorrection);
 }
 
 bool AlternativeTextController::processMarkersOnTextToBeReplacedByResult(const TextCheckingResult& result, Range& rangeWithAlternative, const String& stringToBeReplaced)
index d7f6775..242bd98 100644 (file)
@@ -771,11 +771,11 @@ void CompositeEditCommand::replaceTextInNodePreservingMarkers(Text& node, unsign
     for (const auto& marker : markers) {
 #if PLATFORM(IOS_FAMILY)
         if (marker.isDictation()) {
-            markerController.addMarker(newRange.ptr(), marker.type(), marker.description(), marker.alternatives(), marker.metadata());
+            markerController.addMarker(newRange, marker.type(), marker.description(), marker.alternatives(), marker.metadata());
             continue;
         }
 #endif
-        markerController.addMarker(newRange.ptr(), marker.type(), marker.description());
+        markerController.addMarker(newRange, marker.type(), marker.description());
     }
 }
 
index 975d41b..adf744f 100644 (file)
@@ -61,9 +61,9 @@ public:
         return adoptRef(*new DictationMarkerSupplier(alternatives));
     }
 
-    void addMarkersToTextNode(Text* textNode, unsigned offsetOfInsertion, const String& textToBeInserted) override
+    void addMarkersToTextNode(Text& textNode, unsigned offsetOfInsertion, const String& textToBeInserted) override
     {
-        auto& markerController = textNode->document().markers();
+        auto& markerController = textNode.document().markers();
         for (auto& alternative : m_alternatives) {
             DocumentMarker::DictationData data { alternative.dictationContext, textToBeInserted.substring(alternative.rangeStart, alternative.rangeLength) };
             markerController.addMarkerToNode(textNode, alternative.rangeStart + offsetOfInsertion, alternative.rangeLength, DocumentMarker::DictationAlternatives, WTFMove(data));
index 86d021d..6e3ccf7 100644 (file)
@@ -1165,7 +1165,7 @@ bool areIdenticalElements(const Node& first, const Node& second)
         return false;
     auto& firstElement = downcast<Element>(first);
     auto& secondElement = downcast<Element>(second);
-    return firstElement.hasTagName(secondElement.tagQName()) && firstElement.hasEquivalentAttributes(&secondElement);
+    return firstElement.hasTagName(secondElement.tagQName()) && firstElement.hasEquivalentAttributes(secondElement);
 }
 
 bool isNonTableCellHTMLBlockElement(const Node* node)
index 5854aeb..3755642 100644 (file)
@@ -2044,7 +2044,7 @@ void Editor::ignoreSpelling()
         
     RefPtr<Range> selectedRange = m_frame.selection().toNormalizedRange();
     if (selectedRange)
-        document().markers().removeMarkers(selectedRange.get(), DocumentMarker::Spelling);
+        document().markers().removeMarkers(*selectedRange, DocumentMarker::Spelling);
 
     String text = selectedText();
     ASSERT(text.length());
@@ -2060,7 +2060,7 @@ void Editor::learnSpelling()
 
     RefPtr<Range> selectedRange = m_frame.selection().toNormalizedRange();
     if (selectedRange)
-        document().markers().removeMarkers(selectedRange.get(), DocumentMarker::Spelling);
+        document().markers().removeMarkers(*selectedRange, DocumentMarker::Spelling);
 
     String text = selectedText();
     ASSERT(text.length());
@@ -2226,12 +2226,12 @@ void Editor::advanceToNextMisspelling(bool startBeforeSelection)
         ASSERT(grammarDetail.location != -1 && grammarDetail.length > 0);
         
         // FIXME 4859190: This gets confused with doubled punctuation at the end of a paragraph
-        RefPtr<Range> badGrammarRange = TextIterator::subrange(*grammarSearchRange, grammarPhraseOffset + grammarDetail.location, grammarDetail.length);
-        m_frame.selection().setSelection(VisibleSelection(*badGrammarRange, SEL_DEFAULT_AFFINITY));
+        auto badGrammarRange = TextIterator::subrange(*grammarSearchRange, grammarPhraseOffset + grammarDetail.location, grammarDetail.length);
+        m_frame.selection().setSelection(VisibleSelection(badGrammarRange, SEL_DEFAULT_AFFINITY));
         m_frame.selection().revealSelection();
         
         client()->updateSpellingUIWithGrammarString(badGrammarPhrase, grammarDetail);
-        document().markers().addMarker(badGrammarRange.get(), DocumentMarker::Grammar, grammarDetail.userDescription);
+        document().markers().addMarker(badGrammarRange, DocumentMarker::Grammar, grammarDetail.userDescription);
     } else
 #endif
     if (!misspelledWord.isEmpty()) {
@@ -2243,7 +2243,7 @@ void Editor::advanceToNextMisspelling(bool startBeforeSelection)
         m_frame.selection().revealSelection();
         
         client()->updateSpellingUIWithMisspelledWord(misspelledWord);
-        document().markers().addMarker(misspellingRange.ptr(), DocumentMarker::Spelling);
+        document().markers().addMarker(misspellingRange, DocumentMarker::Spelling);
     }
 }
 
@@ -2378,13 +2378,10 @@ bool Editor::spellingPanelIsShowing()
     return client()->spellingUIIsShowing();
 }
 
-void Editor::clearMisspellingsAndBadGrammar(const VisibleSelection &movingSelection)
+void Editor::clearMisspellingsAndBadGrammar(const VisibleSelectionmovingSelection)
 {
-    RefPtr<Range> selectedRange = movingSelection.toNormalizedRange();
-    if (selectedRange) {
-        document().markers().removeMarkers(selectedRange.get(), DocumentMarker::Spelling);
-        document().markers().removeMarkers(selectedRange.get(), DocumentMarker::Grammar);
-    }
+    if (auto selectedRange = movingSelection.toNormalizedRange())
+        document().markers().removeMarkers(*selectedRange, { DocumentMarker::Spelling, DocumentMarker::Grammar });
 }
 
 void Editor::markMisspellingsAndBadGrammar(const VisibleSelection &movingSelection)
@@ -2490,8 +2487,8 @@ void Editor::markMisspellingsAfterTypingToWord(const VisiblePosition &wordStart,
         // cause any other part of the current sentence to lose or gain spelling correction markers, due to
         // sentence retro correction. As such, we expand the spell checking range to encompass as much of the
         // full sentence as we can, respecting boundaries where spellchecking is disabled.
-        fullSentenceRange->ownerDocument().markers().removeMarkers(fullSentenceRange.get(), DocumentMarker::Grammar);
-        spellCheckingRange->ownerDocument().markers().removeMarkers(spellCheckingRange.get(), DocumentMarker::Spelling);
+        fullSentenceRange->ownerDocument().markers().removeMarkers(*fullSentenceRange, DocumentMarker::Grammar);
+        spellCheckingRange->ownerDocument().markers().removeMarkers(*spellCheckingRange, DocumentMarker::Spelling);
         markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, WTFMove(spellCheckingRange), WTFMove(adjacentWordRange), WTFMove(fullSentenceRange));
         return;
     }
@@ -2761,14 +2758,14 @@ void Editor::markAndReplaceFor(const SpellCheckRequest& request, const Vector<Te
             auto misspellingRange = paragraph.subrange(resultLocation, resultLength);
             if (!m_alternativeTextController->isSpellingMarkerAllowed(misspellingRange))
                 continue;
-            misspellingRange->startContainer().document().markers().addMarker(misspellingRange.ptr(), DocumentMarker::Spelling, replacement);
+            misspellingRange->startContainer().document().markers().addMarker(misspellingRange, DocumentMarker::Spelling, replacement);
         } else if (shouldMarkGrammar && resultType == TextCheckingType::Grammar && paragraph.checkingRangeCovers(resultLocation, resultLength)) {
             ASSERT(resultLength > 0 && resultLocation >= 0);
             for (auto& detail : results[i].details) {
                 ASSERT(detail.length > 0 && detail.location >= 0);
                 if (paragraph.checkingRangeCovers(resultLocation + detail.location, detail.length)) {
                     auto badGrammarRange = paragraph.subrange(resultLocation + detail.location, detail.length);
-                    badGrammarRange->startContainer().document().markers().addMarker(badGrammarRange.ptr(), DocumentMarker::Grammar, detail.userDescription);
+                    badGrammarRange->startContainer().document().markers().addMarker(badGrammarRange, DocumentMarker::Grammar, detail.userDescription);
                 }
             }
         } else if (resultEndLocation <= automaticReplacementEndLocation && resultEndLocation >= paragraph.automaticReplacementStart()
@@ -2882,7 +2879,7 @@ void Editor::changeBackToReplacedString(const String& replacedString)
     TextCheckingParagraph paragraph(*selection);
     replaceSelectionWithText(replacedString, SelectReplacement::No, SmartReplace::No, EditAction::Insert);
     auto changedRange = paragraph.subrange(paragraph.checkingStart(), replacedString.length());
-    changedRange->startContainer().document().markers().addMarker(changedRange.ptr(), DocumentMarker::Replacement, String());
+    changedRange->startContainer().document().markers().addMarker(changedRange, DocumentMarker::Replacement, String());
     m_alternativeTextController->markReversed(changedRange);
 #else
     ASSERT_NOT_REACHED();
@@ -2998,7 +2995,7 @@ void Editor::updateMarkersForWordsAffectedByEditing(bool doNotRemoveIfSelectionA
         DocumentMarker::Grammar,
 #endif
     };
-    document().markers().removeMarkers(wordRange.ptr(), markerTypesToRemove, DocumentMarkerController::RemovePartiallyOverlappingMarker);
+    document().markers().removeMarkers(wordRange, markerTypesToRemove, DocumentMarkerController::RemovePartiallyOverlappingMarker);
     document().markers().clearDescriptionOnMarkersIntersectingRange(wordRange, DocumentMarker::Replacement);
 }
 
@@ -3490,7 +3487,7 @@ unsigned Editor::countMatchesForText(const String& target, Range* range, FindOpt
 
     unsigned matchCount = 0;
     do {
-        RefPtr<Range> resultRange(findPlainText(*searchRange, target, options - Backwards));
+        auto resultRange = findPlainText(*searchRange, target, options - Backwards);
         if (resultRange->collapsed()) {
             if (!resultRange->startContainer().isInShadowTree())
                 break;
@@ -3502,10 +3499,10 @@ unsigned Editor::countMatchesForText(const String& target, Range* range, FindOpt
 
         ++matchCount;
         if (matches)
-            matches->append(resultRange);
+            matches->append(resultRange.ptr());
         
         if (markMatches)
-            document().markers().addMarker(resultRange.get(), DocumentMarker::TextMatch);
+            document().markers().addMarker(resultRange, DocumentMarker::TextMatch);
 
         // Stop looking if we hit the specified limit. A limit of 0 means no limit.
         if (limit > 0 && matchCount >= limit)
@@ -3654,10 +3651,10 @@ void Editor::scanRangeForTelephoneNumbers(Range& range, const StringView& string
         unsigned subrangeOffset = scannerPosition + relativeStartPosition;
         unsigned subrangeLength = relativeEndPosition - relativeStartPosition + 1;
 
-        RefPtr<Range> subrange = TextIterator::subrange(range, subrangeOffset, subrangeLength);
+        auto subrange = TextIterator::subrange(range, subrangeOffset, subrangeLength);
 
-        markedRanges.append(subrange);
-        range.ownerDocument().markers().addMarker(subrange.get(), DocumentMarker::TelephoneNumber);
+        markedRanges.append(subrange.ptr());
+        range.ownerDocument().markers().addMarker(subrange, DocumentMarker::TelephoneNumber);
 
         scannerPosition += relativeEndPosition + 1;
     }
@@ -3722,11 +3719,11 @@ void Editor::editorUIUpdateTimerFired()
 
         if (!textChecker() || textChecker()->shouldEraseMarkersAfterChangeSelection(TextCheckingType::Spelling)) {
             if (RefPtr<Range> wordRange = newAdjacentWords.toNormalizedRange())
-                document().markers().removeMarkers(wordRange.get(), DocumentMarker::Spelling);
+                document().markers().removeMarkers(*wordRange, DocumentMarker::Spelling);
         }
         if (!textChecker() || textChecker()->shouldEraseMarkersAfterChangeSelection(TextCheckingType::Grammar)) {
             if (RefPtr<Range> sentenceRange = newSelectedSentence.toNormalizedRange())
-                document().markers().removeMarkers(sentenceRange.get(), DocumentMarker::Grammar);
+                document().markers().removeMarkers(*sentenceRange, DocumentMarker::Grammar);
         }
     }
 
@@ -4122,7 +4119,7 @@ void Editor::handleAcceptedCandidate(TextCheckingResult acceptedCandidate)
 
     RefPtr<Range> insertedCandidateRange = rangeExpandedByCharactersInDirectionAtWordBoundary(selection.visibleStart(), acceptedCandidate.replacement.length(), DirectionBackward);
     if (insertedCandidateRange)
-        insertedCandidateRange->startContainer().document().markers().addMarker(insertedCandidateRange.get(), DocumentMarker::AcceptedCandidate, acceptedCandidate.replacement);
+        insertedCandidateRange->startContainer().document().markers().addMarker(*insertedCandidateRange, DocumentMarker::AcceptedCandidate, acceptedCandidate.replacement);
 
     m_isHandlingAcceptedCandidate = false;
 }
index efd8650..fbcd2ff 100644 (file)
@@ -206,7 +206,7 @@ void InsertTextCommand::doApply()
         insertTextIntoNode(*textNode, offset, m_text);
         endPosition = Position(textNode.get(), offset + m_text.length());
         if (m_markerSupplier)
-            m_markerSupplier->addMarkersToTextNode(textNode.get(), offset, m_text);
+            m_markerSupplier->addMarkersToTextNode(*textNode, offset, m_text);
 
         if (m_rebalanceType == RebalanceLeadingAndTrailingWhitespaces) {
             // The insertion may require adjusting adjacent whitespace, if it is present.
index 2c3bcc4..18fd677 100644 (file)
@@ -35,7 +35,7 @@ class Text;
 class TextInsertionMarkerSupplier : public RefCounted<TextInsertionMarkerSupplier> {
 public:
     virtual ~TextInsertionMarkerSupplier() = default;
-    virtual void addMarkersToTextNode(Text*, unsigned offsetOfInsertion, const String& textInserted) = 0;
+    virtual void addMarkersToTextNode(Text&, unsigned offsetOfInsertion, const String& textInserted) = 0;
 protected:
     TextInsertionMarkerSupplier() = default;
 };
index 604e740..3ed480a 100644 (file)
@@ -222,7 +222,7 @@ void SpellChecker::didCheckSucceed(int sequence, const Vector<TextCheckingResult
         if (requestData.checkingTypes().contains(TextCheckingType::Grammar))
             markerTypes.add(DocumentMarker::Grammar);
         if (!markerTypes.isEmpty())
-            m_frame.document()->markers().removeMarkers(&m_processingRequest->checkingRange(), markerTypes);
+            m_frame.document()->markers().removeMarkers(m_processingRequest->checkingRange(), markerTypes);
     }
     didCheck(sequence, results);
 }
index 9ad090f..9b77610 100644 (file)
@@ -62,7 +62,7 @@ void SplitTextNodeCommand::doApply()
 
     m_text1 = Text::create(document(), WTFMove(prefixText));
     ASSERT(m_text1);
-    document().markers().copyMarkers(m_text2.ptr(), 0, m_offset, m_text1.get(), 0);
+    document().markers().copyMarkers(m_text2, 0, m_offset, *m_text1, 0);
 
     insertText1AndTrimText2();
 }
@@ -78,7 +78,7 @@ void SplitTextNodeCommand::doUnapply()
 
     m_text2->insertData(0, prefixText);
 
-    document().markers().copyMarkers(m_text1.get(), 0, prefixText.length(), m_text2.ptr(), 0);
+    document().markers().copyMarkers(*m_text1, 0, prefixText.length(), m_text2, 0);
     m_text1->remove();
 }
 
index e89e870..104ca38 100644 (file)
@@ -277,17 +277,17 @@ String TextCheckingHelper::findFirstMisspelling(int& firstMisspellingOffset, boo
 
         if (misspellingLocation >= 0 && misspellingLength > 0 && misspellingLocation < textLength && misspellingLength <= textLength && misspellingLocation + misspellingLength <= textLength) {
             // Compute range of misspelled word
-            RefPtr<Range> misspellingRange = TextIterator::subrange(m_range, currentChunkOffset + misspellingLocation, misspellingLength);
+            auto misspellingRange = TextIterator::subrange(m_range, currentChunkOffset + misspellingLocation, misspellingLength);
 
             // Remember first-encountered misspelling and its offset.
             if (!firstMisspelling) {
                 firstMisspellingOffset = currentChunkOffset + misspellingLocation;
                 firstMisspelling = text.substring(misspellingLocation, misspellingLength).toString();
-                firstMisspellingRange = misspellingRange;
+                firstMisspellingRange = misspellingRange.ptr();
             }
 
             // Store marker for misspelled word.
-            misspellingRange->startContainer().document().markers().addMarker(misspellingRange.get(), DocumentMarker::Spelling);
+            misspellingRange->startContainer().document().markers().addMarker(misspellingRange, DocumentMarker::Spelling);
 
             // Bail out if we're marking only the first misspelling, and not all instances.
             if (!markAll)
@@ -453,8 +453,8 @@ int TextCheckingHelper::findFirstGrammarDetail(const Vector<GrammarDetail>& gram
             continue;
         
         if (markAll) {
-            RefPtr<Range> badGrammarRange = TextIterator::subrange(m_range, badGrammarPhraseLocation - startOffset + detail->location, detail->length);
-            badGrammarRange->startContainer().document().markers().addMarker(badGrammarRange.get(), DocumentMarker::Grammar, detail->userDescription);
+            auto badGrammarRange = TextIterator::subrange(m_range, badGrammarPhraseLocation - startOffset + detail->location, detail->length);
+            badGrammarRange->startContainer().document().markers().addMarker(badGrammarRange, DocumentMarker::Grammar, detail->userDescription);
         }
         
         // Remember this detail only if it's earlier than our current candidate (the details aren't in a guaranteed order)
index 2c4b60d..9c1ae88 100644 (file)
@@ -57,7 +57,7 @@ void DictationCommandIOS::doApply()
         inputText(firstInterpretation, true);
 
         if (interpretations.size() > 1)
-            document().markers().addDictationPhraseWithAlternativesMarker(endingSelection().toNormalizedRange().get(), interpretations);
+            document().markers().addDictationPhraseWithAlternativesMarker(*endingSelection().toNormalizedRange(), interpretations);
 
         setEndingSelection(VisibleSelection(endingSelection().visibleEnd()));
     }
@@ -73,7 +73,8 @@ void DictationCommandIOS::doApply()
 
     if (startIndex >= 0) {
         RefPtr<Range> resultRange = TextIterator::rangeFromLocationAndLength(document().documentElement(), startIndex, endIndex, true);
-        document().markers().addDictationResultMarker(resultRange.get(), m_metadata);
+        ASSERT(resultRange); // FIXME: What guarantees this?
+        document().markers().addDictationResultMarker(*resultRange, m_metadata);
     }
 }
 
index 230f5e3..985addd 100644 (file)
@@ -295,13 +295,13 @@ void Editor::setDictationPhrasesAsChildOfElement(const Vector<Vector<String>>& d
         int dictationPhraseEnd = previousDictationPhraseStart + dictationPhraseLength;
         if (interpretations.size() > 1) {
             auto dictationPhraseRange = Range::create(document(), &textNode, previousDictationPhraseStart, &textNode, dictationPhraseEnd);
-            document().markers().addDictationPhraseWithAlternativesMarker(dictationPhraseRange.ptr(), interpretations);
+            document().markers().addDictationPhraseWithAlternativesMarker(dictationPhraseRange, interpretations);
         }
         previousDictationPhraseStart = dictationPhraseEnd;
     }
 
     auto resultRange = Range::create(document(), &textNode, 0, &textNode, textNode.length());
-    document().markers().addDictationResultMarker(resultRange.ptr(), metadata);
+    document().markers().addDictationResultMarker(resultRange, metadata);
 
     client()->respondToChangedContents();
 }
index ebf6b5c..79a1de3 100644 (file)
@@ -129,7 +129,7 @@ ExceptionOr<void> FileReader::readInternal(Blob& blob, FileReaderLoader::ReadTyp
     if (m_state == LOADING)
         return Exception { InvalidStateError };
 
-    setPendingActivity(this);
+    setPendingActivity(*this);
 
     m_blob = &blob;
     m_readType = type;
@@ -166,7 +166,7 @@ void FileReader::abort()
         fireEvent(eventNames().loadendEvent);
 
         // All possible events have fired and we're done, no more pending activity.
-        unsetPendingActivity(this);
+        unsetPendingActivity(*this);
     });
 }
 
@@ -201,7 +201,7 @@ void FileReader::didFinishLoading()
     fireEvent(eventNames().loadendEvent);
     
     // All possible events have fired and we're done, no more pending activity.
-    unsetPendingActivity(this);
+    unsetPendingActivity(*this);
 }
 
 void FileReader::didFail(int errorCode)
@@ -218,7 +218,7 @@ void FileReader::didFail(int errorCode)
     fireEvent(eventNames().loadendEvent);
     
     // All possible events have fired and we're done, no more pending activity.
-    unsetPendingActivity(this);
+    unsetPendingActivity(*this);
 }
 
 void FileReader::fireEvent(const AtomicString& type)
index 901c639..9140cb3 100644 (file)
@@ -27,7 +27,6 @@
 #include "ElementIterator.h"
 #include "Frame.h"
 #include "FrameLoader.h"
-#include "HTMLDocument.h"
 #include "HTMLNames.h"
 #include "HTMLParamElement.h"
 #include "RenderEmbeddedObject.h"
index 3060eb7..502b223 100644 (file)
@@ -29,16 +29,8 @@ namespace WebCore {
 class HTMLDocument : public Document {
     WTF_MAKE_ISO_ALLOCATED(HTMLDocument);
 public:
-    static Ref<HTMLDocument> create(Frame* frame, const URL& url)
-    {
-        return adoptRef(*new HTMLDocument(frame, url, HTMLDocumentClass));
-    }
-
-    static Ref<HTMLDocument> createSynthesizedDocument(Frame* frame, const URL& url)
-    {
-        return adoptRef(*new HTMLDocument(frame, url, HTMLDocumentClass, Synthesized));
-    }
-
+    static Ref<HTMLDocument> create(Frame*, const URL&);
+    static Ref<HTMLDocument> createSynthesizedDocument(Frame&, const URL&);
     virtual ~HTMLDocument();
 
     WEBCORE_EXPORT int width();
@@ -65,7 +57,7 @@ protected:
     HTMLDocument(Frame*, const URL&, DocumentClassFlags = 0, unsigned constructionFlags = 0);
 
 private:
-    bool isFrameSet() const override;
+    bool isFrameSet() const final;
     Ref<DocumentParser> createParser() override;
     Ref<Document> cloneDocumentWithoutChildren() const final;
 
@@ -73,6 +65,16 @@ private:
     TreeScopeOrderedMap m_windowNamedItem;
 };
 
+inline Ref<HTMLDocument> HTMLDocument::create(Frame* frame, const URL& url)
+{
+    return adoptRef(*new HTMLDocument(frame, url, HTMLDocumentClass));
+}
+
+inline Ref<HTMLDocument> HTMLDocument::createSynthesizedDocument(Frame& frame, const URL& url)
+{
+    return adoptRef(*new HTMLDocument(&frame, url, HTMLDocumentClass, Synthesized));
+}
+
 } // namespace WebCore
 
 SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::HTMLDocument)
index 6c6af7b..db996b9 100644 (file)
@@ -81,7 +81,7 @@ HTMLFormElement::~HTMLFormElement()
 {
     document().formController().willDeleteForm(*this);
     if (!shouldAutocomplete())
-        document().unregisterForDocumentSuspensionCallbacks(this);
+        document().unregisterForDocumentSuspensionCallbacks(*this);
 
     m_defaultButton = nullptr;
     for (auto& associatedElement : m_associatedElements)
@@ -439,9 +439,9 @@ void HTMLFormElement::parseAttribute(const QualifiedName& name, const AtomicStri
         m_attributes.setAcceptCharset(value);
     else if (name == autocompleteAttr) {
         if (!shouldAutocomplete())
-            document().registerForDocumentSuspensionCallbacks(this);
+            document().registerForDocumentSuspensionCallbacks(*this);
         else
-            document().unregisterForDocumentSuspensionCallbacks(this);
+            document().unregisterForDocumentSuspensionCallbacks(*this);
     } else
         HTMLElement::parseAttribute(name, value);
 }
@@ -843,8 +843,8 @@ void HTMLFormElement::resumeFromDocumentSuspension()
 void HTMLFormElement::didMoveToNewDocument(Document& oldDocument, Document& newDocument)
 {
     if (!shouldAutocomplete()) {
-        oldDocument.unregisterForDocumentSuspensionCallbacks(this);
-        document().registerForDocumentSuspensionCallbacks(this);
+        oldDocument.unregisterForDocumentSuspensionCallbacks(*this);
+        newDocument.registerForDocumentSuspensionCallbacks(*this);
     }
 
     HTMLElement::didMoveToNewDocument(oldDocument, newDocument);
index 041710f..4e7319b 100644 (file)
@@ -28,7 +28,6 @@
 #include "CSSPropertyNames.h"
 #include "DOMTokenList.h"
 #include "Frame.h"
-#include "HTMLDocument.h"
 #include "HTMLNames.h"
 #include "RenderIFrame.h"
 #include "ScriptableDocumentParser.h"
index 1dcd7e1..bcf89c7 100644 (file)
@@ -161,7 +161,7 @@ void HTMLInputElement::didAddUserAgentShadowRoot(ShadowRoot&)
 HTMLInputElement::~HTMLInputElement()
 {
     if (needsSuspensionCallback())
-        document().unregisterForDocumentSuspensionCallbacks(this);
+        document().unregisterForDocumentSuspensionCallbacks(*this);
 
     // Need to remove form association while this is still an HTMLInputElement
     // so that virtual functions are called correctly.
@@ -169,7 +169,7 @@ HTMLInputElement::~HTMLInputElement()
     // setForm(0) may register this to a document-level radio button group.
     // We should unregister it to avoid accessing a deleted object.
     if (isRadioButton())
-        document().formController().radioButtonGroups().removeButton(this);
+        document().formController().radioButtonGroups().removeButton(*this);
 #if ENABLE(TOUCH_EVENTS)
     if (m_hasTouchEventHandler)
         document().didRemoveEventTargetNode(*this);
@@ -923,7 +923,7 @@ void HTMLInputElement::setChecked(bool nowChecked)
     invalidateStyleForSubtree();
 
     if (RadioButtonGroups* buttons = radioButtonGroups())
-        buttons->updateCheckedState(this);
+        buttons->updateCheckedState(*this);
     if (renderer() && renderer()->style().hasAppearance())
         renderer()->theme().stateChanged(*renderer(), ControlStates::CheckedState);
     updateValidity();
@@ -1442,13 +1442,13 @@ bool HTMLInputElement::needsSuspensionCallback()
 void HTMLInputElement::registerForSuspensionCallbackIfNeeded()
 {
     if (needsSuspensionCallback())
-        document().registerForDocumentSuspensionCallbacks(this);
+        document().registerForDocumentSuspensionCallbacks(*this);
 }
 
 void HTMLInputElement::unregisterForSuspensionCallbackIfNeeded()
 {
     if (!needsSuspensionCallback())
-        document().unregisterForDocumentSuspensionCallbacks(this);
+        document().unregisterForDocumentSuspensionCallbacks(*this);
 }
 
 bool HTMLInputElement::isRequiredFormControl() const
@@ -1547,11 +1547,11 @@ void HTMLInputElement::didMoveToNewDocument(Document& oldDocument, Document& new
 
     // Always unregister for cache callbacks when leaving a document, even if we would otherwise like to be registered
     if (needsSuspensionCallback()) {
-        oldDocument.unregisterForDocumentSuspensionCallbacks(this);
-        newDocument.registerForDocumentSuspensionCallbacks(this);
+        oldDocument.unregisterForDocumentSuspensionCallbacks(*this);
+        newDocument.registerForDocumentSuspensionCallbacks(*this);
     }
     if (isRadioButton())
-        oldDocument.formController().radioButtonGroups().removeButton(this);
+        oldDocument.formController().radioButtonGroups().removeButton(*this);
 #if ENABLE(TOUCH_EVENTS)
     if (m_hasTouchEventHandler) {
         oldDocument.didRemoveEventTargetNode(*this);
@@ -1868,7 +1868,7 @@ bool HTMLInputElement::isInRequiredRadioButtonGroup()
 {
     ASSERT(isRadioButton());
     if (RadioButtonGroups* buttons = radioButtonGroups())
-        return buttons->isInRequiredGroup(this);
+        return buttons->isInRequiredGroup(*this);
     return false;
 }
 
@@ -1900,14 +1900,14 @@ RadioButtonGroups* HTMLInputElement::radioButtonGroups() const
 
 inline void HTMLInputElement::addToRadioButtonGroup()
 {
-    if (RadioButtonGroups* buttons = radioButtonGroups())
-        buttons->addButton(this);
+    if (auto* buttons = radioButtonGroups())
+        buttons->addButton(*this);
 }
 
 inline void HTMLInputElement::removeFromRadioButtonGroup()
 {
-    if (RadioButtonGroups* buttons = radioButtonGroups())
-        buttons->removeButton(this);
+    if (auto* buttons = radioButtonGroups())
+        buttons->removeButton(*this);
 }
 
 unsigned HTMLInputElement::height() const
index 180c43d..5e09f09 100644 (file)
@@ -704,33 +704,33 @@ void HTMLMediaElement::registerWithDocument(Document& document)
     m_mediaSession->registerWithDocument(document);
 
     if (m_isWaitingUntilMediaCanStart)
-        document.addMediaCanStartListener(this);
+        document.addMediaCanStartListener(*this);
 
 #if !PLATFORM(IOS_FAMILY)
-    document.registerForMediaVolumeCallbacks(this);
-    document.registerForPrivateBrowsingStateChangedCallbacks(this);
+    document.registerForMediaVolumeCallbacks(*this);
+    document.registerForPrivateBrowsingStateChangedCallbacks(*this);
 #endif
 
-    document.registerForVisibilityStateChangedCallbacks(this);
+    document.registerForVisibilityStateChangedCallbacks(*this);
 
 #if ENABLE(VIDEO_TRACK)
     if (m_requireCaptionPreferencesChangedCallbacks)
-        document.registerForCaptionPreferencesChangedCallbacks(this);
+        document.registerForCaptionPreferencesChangedCallbacks(*this);
 #endif
 
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
     if (m_mediaControlsDependOnPageScaleFactor)
-        document.registerForPageScaleFactorChangedCallbacks(this);
+        document.registerForPageScaleFactorChangedCallbacks(*this);
     document.registerForUserInterfaceLayoutDirectionChangedCallbacks(*this);
 #endif
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
-    document.registerForDocumentSuspensionCallbacks(this);
+    document.registerForDocumentSuspensionCallbacks(*this);
 #endif
 
     document.registerForAllowsMediaDocumentInlinePlaybackChangedCallbacks(*this);
 
-    document.addAudioProducer(this);
+    document.addAudioProducer(*this);
     addElementToDocumentMap(*this, document);
 
 #if ENABLE(MEDIA_STREAM)
@@ -745,33 +745,33 @@ void HTMLMediaElement::unregisterWithDocument(Document& document)
     m_mediaSession->unregisterWithDocument(document);
 
     if (m_isWaitingUntilMediaCanStart)
-        document.removeMediaCanStartListener(this);
+        document.removeMediaCanStartListener(*this);
 
 #if !PLATFORM(IOS_FAMILY)
-    document.unregisterForMediaVolumeCallbacks(this);
-    document.unregisterForPrivateBrowsingStateChangedCallbacks(this);
+    document.unregisterForMediaVolumeCallbacks(*this);
+    document.unregisterForPrivateBrowsingStateChangedCallbacks(*this);
 #endif
 
-    document.unregisterForVisibilityStateChangedCallbacks(this);
+    document.unregisterForVisibilityStateChangedCallbacks(*this);
 
 #if ENABLE(VIDEO_TRACK)
     if (m_requireCaptionPreferencesChangedCallbacks)
-        document.unregisterForCaptionPreferencesChangedCallbacks(this);
+        document.unregisterForCaptionPreferencesChangedCallbacks(*this);
 #endif
 
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
     if (m_mediaControlsDependOnPageScaleFactor)
-        document.unregisterForPageScaleFactorChangedCallbacks(this);
+        document.unregisterForPageScaleFactorChangedCallbacks(*this);
     document.unregisterForUserInterfaceLayoutDirectionChangedCallbacks(*this);
 #endif
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
-    document.unregisterForDocumentSuspensionCallbacks(this);
+    document.unregisterForDocumentSuspensionCallbacks(*this);
 #endif
 
     document.unregisterForAllowsMediaDocumentInlinePlaybackChangedCallbacks(*this);
 
-    document.removeAudioProducer(this);
+    document.removeAudioProducer(*this);
     removeElementFromDocumentMap(*this, document);
 
 #if ENABLE(MEDIA_STREAM)
@@ -1341,7 +1341,7 @@ void HTMLMediaElement::selectMediaResource()
         if (m_isWaitingUntilMediaCanStart)
             return;
         m_isWaitingUntilMediaCanStart = true;
-        document().addMediaCanStartListener(this);
+        document().addMediaCanStartListener(*this);
         return;
     }
 
@@ -4068,7 +4068,7 @@ void HTMLMediaElement::addTextTrack(Ref<TextTrack>&& track)
     if (!m_requireCaptionPreferencesChangedCallbacks) {
         m_requireCaptionPreferencesChangedCallbacks = true;
         Document& document = this->document();
-        document.registerForCaptionPreferencesChangedCallbacks(this);
+        document.registerForCaptionPreferencesChangedCallbacks(*this);
         if (Page* page = document.page())
             m_captionDisplayMode = page->group().captionPreferences().captionDisplayMode();
     }
@@ -5612,7 +5612,7 @@ void HTMLMediaElement::clearMediaPlayer()
 
     if (m_isWaitingUntilMediaCanStart) {
         m_isWaitingUntilMediaCanStart = false;
-        document().removeMediaCanStartListener(this);
+        document().removeMediaCanStartListener(*this);
     }
 
     if (m_player) {
@@ -5757,7 +5757,7 @@ void HTMLMediaElement::resume()
     setShouldBufferData(true);
 
     if (!m_mediaSession->pageAllowsPlaybackAfterResuming())
-        document().addMediaCanStartListener(this);
+        document().addMediaCanStartListener(*this);
     else
         setPausedInternal(false);
 
@@ -7382,9 +7382,9 @@ void HTMLMediaElement::setMediaControlsDependOnPageScaleFactor(bool dependsOnPag
     m_mediaControlsDependOnPageScaleFactor = dependsOnPageScale;
 
     if (m_mediaControlsDependOnPageScaleFactor)
-        document().registerForPageScaleFactorChangedCallbacks(this);
+        document().registerForPageScaleFactorChangedCallbacks(*this);
     else
-        document().unregisterForPageScaleFactorChangedCallbacks(this);
+        document().unregisterForPageScaleFactorChangedCallbacks(*this);
 }
 
 void HTMLMediaElement::updateMediaControlsAfterPresentationModeChange()
index d10c37f..e118bde 100644 (file)
@@ -25,7 +25,6 @@
 
 #include "Element.h"
 #include "HTMLAppletElement.h"
-#include "HTMLDocument.h"
 #include "HTMLEmbedElement.h"
 #include "HTMLFormElement.h"
 #include "HTMLIFrameElement.h"
index 9e5c277..95dac13 100644 (file)
@@ -119,7 +119,7 @@ void HTMLPlugInImageElement::finishCreating()
 HTMLPlugInImageElement::~HTMLPlugInImageElement()
 {
     if (m_needsDocumentActivationCallbacks)
-        document().unregisterForDocumentSuspensionCallbacks(this);
+        document().unregisterForDocumentSuspensionCallbacks(*this);
 }
 
 void HTMLPlugInImageElement::setDisplayState(DisplayState state)
@@ -185,7 +185,7 @@ RenderPtr<RenderElement> HTMLPlugInImageElement::createElementRenderer(RenderSty
     // inactive or reactivates so it can clear the renderer before going into the page cache.
     if (!m_needsDocumentActivationCallbacks) {
         m_needsDocumentActivationCallbacks = true;
-        document().registerForDocumentSuspensionCallbacks(this);
+        document().registerForDocumentSuspensionCallbacks(*this);
     }
 
     if (displayState() == DisplayingSnapshot) {
@@ -301,8 +301,8 @@ void HTMLPlugInImageElement::didMoveToNewDocument(Document& oldDocument, Documen
 {
     ASSERT_WITH_SECURITY_IMPLICATION(&document() == &newDocument);
     if (m_needsDocumentActivationCallbacks) {
-        oldDocument.unregisterForDocumentSuspensionCallbacks(this);
-        newDocument.registerForDocumentSuspensionCallbacks(this);
+        oldDocument.unregisterForDocumentSuspensionCallbacks(*this);
+        newDocument.registerForDocumentSuspensionCallbacks(*this);
     }
 
     if (m_imageLoader)
index cfdeb53..2361422 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "Event.h"
 #include "EventNames.h"
-#include "HTMLDocument.h"
 #include "HTMLNames.h"
 #include "HTMLPictureElement.h"
 #include "Logging.h"
index 818eff6..80f722a 100644 (file)
@@ -32,7 +32,6 @@
 #include "HTMLTemplateElement.h"
 
 #include "DocumentFragment.h"
-#include "HTMLDocument.h"
 #include "TemplateContentDocumentFragment.h"
 #include "markup.h"
 #include <wtf/IsoMallocInlines.h>
index 7fcfc75..613d545 100644 (file)
@@ -184,9 +184,9 @@ bool RadioInputType::isRadioButton() const
 bool RadioInputType::matchesIndeterminatePseudoClass() const
 {
     ASSERT(element());
-    const HTMLInputElement& element = *this->element();
-    if (const RadioButtonGroups* radioButtonGroups = element.radioButtonGroups())
-        return !radioButtonGroups->hasCheckedButton(&element);
+    auto& element = *this->element();
+    if (auto* radioButtonGroups = element.radioButtonGroups())
+        return !radioButtonGroups->hasCheckedButton(element);
     return !element.checked();
 }
 
index 093a0fe..86593c3 100644 (file)
@@ -146,7 +146,7 @@ bool DocumentWriter::begin(const URL& urlReference, bool dispatch, Document* own
 
     bool shouldReuseDefaultView = m_frame->loader().stateMachine().isDisplayingInitialEmptyDocument() && m_frame->document()->isSecureTransitionTo(url);
     if (shouldReuseDefaultView)
-        document->takeDOMWindowFrom(m_frame->document());
+        document->takeDOMWindowFrom(*m_frame->document());
     else
         document->createDOMWindow();
 
index 2c766f9..58e0b08 100644 (file)
@@ -1844,9 +1844,9 @@ bool DOMWindow::addEventListener(const AtomicString& eventType, Ref<EventListene
         if ((eventType == eventNames().devicemotionEvent || eventType == eventNames().deviceorientationEvent)) {
             if (isSameSecurityOriginAsMainFrame() && isSecureContext()) {
                 if (eventType == eventNames().deviceorientationEvent)
-                    document()->deviceOrientationController()->addDeviceEventListener(this);
+                    document()->deviceOrientationController().addDeviceEventListener(*this);
                 else
-                    document()->deviceMotionController()->addDeviceEventListener(this);
+                    document()->deviceMotionController().addDeviceEventListener(*this);
             } else if (document()) {
                 if (isSecureContext())
                     document()->addConsoleMessage(MessageSource::JS, MessageLevel::Warning, "Blocked attempt to add a device motion or orientation listener from child frame that wasn't the same security origin as the main page."_s);
@@ -1858,13 +1858,13 @@ bool DOMWindow::addEventListener(const AtomicString& eventType, Ref<EventListene
         if (eventType == eventNames().devicemotionEvent) {
             if (isSameSecurityOriginAsMainFrame() && isSecureContext()) {
                 if (DeviceMotionController* controller = DeviceMotionController::from(page()))
-                    controller->addDeviceEventListener(this);
+                    controller->addDeviceEventListener(*this);
             } else
                 document()->addConsoleMessage(MessageSource::JS, MessageLevel::Warning, "Blocked attempt to add a device motion listener from child frame that wasn't the same security origin as the main page."_s);
         } else if (eventType == eventNames().deviceorientationEvent) {
             if (isSameSecurityOriginAsMainFrame() && isSecureContext()) {
                 if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
-                    controller->addDeviceEventListener(this);
+                    controller->addDeviceEventListener(*this);
             } else {
                 if (isSecureContext())
                     document()->addConsoleMessage(MessageSource::JS, MessageLevel::Warning, "Blocked attempt to add a device orientation listener from child frame that wasn't the same security origin as the main page."_s);
@@ -1931,16 +1931,16 @@ bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener
 #if ENABLE(DEVICE_ORIENTATION)
 #if PLATFORM(IOS_FAMILY)
     else if (eventType == eventNames().devicemotionEvent && document())
-        document()->deviceMotionController()->removeDeviceEventListener(this);
+        document()->deviceMotionController().removeDeviceEventListener(*this);
     else if (eventType == eventNames().deviceorientationEvent && document())
-        document()->deviceOrientationController()->removeDeviceEventListener(this);
+        document()->deviceOrientationController().removeDeviceEventListener(*this);
 #else
     else if (eventType == eventNames().devicemotionEvent) {
         if (DeviceMotionController* controller = DeviceMotionController::from(page()))
-            controller->removeDeviceEventListener(this);
+            controller->removeDeviceEventListener(*this);
     } else if (eventType == eventNames().deviceorientationEvent) {
         if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
-            controller->removeDeviceEventListener(this);
+            controller->removeDeviceEventListener(*this);
     }
 #endif // PLATFORM(IOS_FAMILY)
 #endif // ENABLE(DEVICE_ORIENTATION)
@@ -2048,14 +2048,14 @@ void DOMWindow::removeAllEventListeners()
 #if ENABLE(DEVICE_ORIENTATION)
 #if PLATFORM(IOS_FAMILY)
     if (Document* document = this->document()) {
-        document->deviceMotionController()->removeAllDeviceEventListeners(this);
-        document->deviceOrientationController()->removeAllDeviceEventListeners(this);
+        document->deviceMotionController().removeAllDeviceEventListeners(*this);
+        document->deviceOrientationController().removeAllDeviceEventListeners(*this);
     }
 #else
     if (DeviceMotionController* controller = DeviceMotionController::from(page()))
-        controller->removeAllDeviceEventListeners(this);
+        controller->removeAllDeviceEventListeners(*this);
     if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
-        controller->removeAllDeviceEventListeners(this);
+        controller->removeAllDeviceEventListeners(*this);
 #endif // PLATFORM(IOS_FAMILY)
 #endif // ENABLE(DEVICE_ORIENTATION)
 
index 41a027b..3367d3d 100644 (file)
 
 namespace WebCore {
 
-DeviceController::DeviceController(DeviceClient* client)
+DeviceController::DeviceController(DeviceClient& client)
     : m_client(client)
     , m_timer(*this, &DeviceController::fireDeviceEvent)
 {
-    ASSERT(m_client);
 }
 
-void DeviceController::addDeviceEventListener(DOMWindow* window)
+void DeviceController::addDeviceEventListener(DOMWindow& window)
 {
     bool wasEmpty = m_listeners.isEmpty();
-    m_listeners.add(window);
+    m_listeners.add(&window);
 
     if (hasLastData()) {
-        m_lastEventListeners.add(window);
+        m_lastEventListeners.add(&window);
         if (!m_timer.isActive())
             m_timer.startOneShot(0_s);
     }
 
     if (wasEmpty)
-        m_client->startUpdating();
+        m_client.startUpdating();
 }
 
-void DeviceController::removeDeviceEventListener(DOMWindow* window)
+void DeviceController::removeDeviceEventListener(DOMWindow& window)
 {
-    m_listeners.remove(window);
-    m_lastEventListeners.remove(window);
+    m_listeners.remove(&window);
+    m_lastEventListeners.remove(&window);
     if (m_listeners.isEmpty())
-        m_client->stopUpdating();
+        m_client.stopUpdating();
 }
 
-void DeviceController::removeAllDeviceEventListeners(DOMWindow* window)
+void DeviceController::removeAllDeviceEventListeners(DOMWindow& window)
 {
-    m_listeners.removeAll(window);
-    m_lastEventListeners.removeAll(window);
+    m_listeners.removeAll(&window);
+    m_lastEventListeners.removeAll(&window);
     if (m_listeners.isEmpty())
-        m_client->stopUpdating();
+        m_client.stopUpdating();
 }
 
 void DeviceController::dispatchDeviceEvent(Event& event)
index 200f318..e160385 100644 (file)
@@ -40,16 +40,16 @@ class Page;
 class DeviceController : public Supplement<Page> {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    explicit DeviceController(DeviceClient*);
+    explicit DeviceController(DeviceClient&);
     virtual ~DeviceController() = default;
 
-    void addDeviceEventListener(DOMWindow*);
-    void removeDeviceEventListener(DOMWindow*);
-    void removeAllDeviceEventListeners(DOMWindow*);
+    void addDeviceEventListener(DOMWindow&);
+    void removeDeviceEventListener(DOMWindow&);
+    void removeAllDeviceEventListeners(DOMWindow&);
 
     void dispatchDeviceEvent(Event&);
     bool isActive() { return !m_listeners.isEmpty(); }
-    DeviceClient* client() { return m_client; }
+    DeviceClient& client() { return m_client; }
 
     virtual bool hasLastData() { return false; }
     virtual RefPtr<Event> getLastEvent() { return nullptr; }
@@ -59,7 +59,7 @@ protected:
 
     HashCountedSet<RefPtr<DOMWindow>> m_listeners;
     HashCountedSet<RefPtr<DOMWindow>> m_lastEventListeners;
-    DeviceClient* m_client;
+    DeviceClient& m_client;
     Timer m_timer;
 };
 
index 8946e95..59fd3e0 100644 (file)
@@ -51,6 +51,7 @@
 #include "FrameSelection.h"
 #include "FrameTree.h"
 #include "FrameView.h"
+#include "HTMLDocument.h"
 #include "HTMLFrameElement.h"
 #include "HTMLFrameSetElement.h"
 #include "HTMLHtmlElement.h"
@@ -3577,7 +3578,7 @@ void EventHandler::didStartDrag()
     }
 
     if (draggedContentRange) {
-        draggedContentRange->ownerDocument().markers().addDraggedContentMarker(draggedContentRange.get());
+        draggedContentRange->ownerDocument().markers().addDraggedContentMarker(*draggedContentRange);
         if (auto* renderer = m_frame.contentRenderer())
             renderer->repaintRootContents();
     }
index d132513..930f30b 100644 (file)
@@ -74,7 +74,7 @@ ExceptionOr<Ref<EventSource>> EventSource::create(ScriptExecutionContext& contex
     }
 
     auto source = adoptRef(*new EventSource(context, fullURL, eventSourceInit));
-    source->setPendingActivity(source.ptr());
+    source->setPendingActivity(source.get());
     source->scheduleInitialConnect();
     source->suspendIfNeeded();
     return WTFMove(source);
@@ -125,7 +125,7 @@ void EventSource::networkRequestEnded()
     if (m_state != CLOSED)
         scheduleReconnect();
     else
-        unsetPendingActivity(this);
+        unsetPendingActivity(*this);
 }
 
 void EventSource::scheduleInitialConnect()
@@ -158,7 +158,7 @@ void EventSource::close()
         m_loader->cancel();
     else {
         m_state = CLOSED;
-        unsetPendingActivity(this);
+        unsetPendingActivity(*this);
     }
 }
 
@@ -260,7 +260,7 @@ void EventSource::abortConnectionAttempt()
         m_loader->cancel();
     else {
         m_state = CLOSED;
-        unsetPendingActivity(this);
+        unsetPendingActivity(*this);
     }
 
     ASSERT(m_state == CLOSED);
index 73bafdb..a4f83b2 100644 (file)
@@ -57,7 +57,6 @@
 #include "FrameView.h"
 #include "GraphicsContext.h"
 #include "GraphicsLayer.h"
-#include "HTMLDocument.h"
 #include "HTMLFormControlElement.h"
 #include "HTMLFormElement.h"
 #include "HTMLFrameElementBase.h"
index 0f9fea1..cc93114 100644 (file)
@@ -50,7 +50,6 @@
 #include "FrameTree.h"
 #include "GraphicsContext.h"
 #include "HTMLBodyElement.h"
-#include "HTMLDocument.h"
 #include "HTMLEmbedElement.h"
 #include "HTMLFrameElement.h"
 #include "HTMLFrameSetElement.h"
@@ -4464,7 +4463,7 @@ bool FrameView::qualifiesAsVisuallyNonEmpty() const
 
     auto isMoreContentExpected = [&]() {
         // Pending css/javascript/font loading/processing means we should wait a little longer.
-        auto hasPendingScriptExecution = frame().document()->scriptRunner() && frame().document()->scriptRunner()->hasPendingScripts();
+        auto hasPendingScriptExecution = frame().document()->scriptRunner().hasPendingScripts();
         if (hasPendingScriptExecution)
             return true;
 
index ad5f154..8a3b3b9 100644 (file)
@@ -158,7 +158,7 @@ void AnimationBase::updateStateMachine(AnimationStateInput input, double param)
     // If we get AnimationStateInput::RestartAnimation then we force a new animation, regardless of state.
     if (input == AnimationStateInput::MakeNew) {
         if (m_animationState == AnimationState::StartWaitStyleAvailable)
-            m_compositeAnimation->animationController().removeFromAnimationsWaitingForStyle(this);
+            m_compositeAnimation->animationController().removeFromAnimationsWaitingForStyle(*this);
         LOG(Animations, "%p AnimationState %s -> New", this, nameForState(m_animationState));
         m_animationState = AnimationState::New;
         m_startTime = WTF::nullopt;
@@ -171,7 +171,7 @@ void AnimationBase::updateStateMachine(AnimationStateInput input, double param)
 
     if (input == AnimationStateInput::RestartAnimation) {
         if (m_animationState == AnimationState::StartWaitStyleAvailable)
-            m_compositeAnimation->animationController().removeFromAnimationsWaitingForStyle(this);
+            m_compositeAnimation->animationController().removeFromAnimationsWaitingForStyle(*this);
         LOG(Animations, "%p AnimationState %s -> New", this, nameForState(m_animationState));
         m_animationState = AnimationState::New;
         m_startTime = WTF::nullopt;
@@ -187,7 +187,7 @@ void AnimationBase::updateStateMachine(AnimationStateInput input, double param)
 
     if (input == AnimationStateInput::EndAnimation) {
         if (m_animationState == AnimationState::StartWaitStyleAvailable)
-            m_compositeAnimation->animationController().removeFromAnimationsWaitingForStyle(this);
+            m_compositeAnimation->animationController().removeFromAnimationsWaitingForStyle(*this);
         LOG(Animations, "%p AnimationState %s -> Done", this, nameForState(m_animationState));
         m_animationState = AnimationState::Done;
         endAnimation();
@@ -237,7 +237,7 @@ void AnimationBase::updateStateMachine(AnimationStateInput input, double param)
                 // Start timer has fired, tell the animation to start and wait for it to respond with start time
                 LOG(Animations, "%p AnimationState %s -> StartWaitStyleAvailable (time is %f)", this, nameForState(m_animationState), param);
                 m_animationState = AnimationState::StartWaitStyleAvailable;
-                m_compositeAnimation->animationController().addToAnimationsWaitingForStyle(this);
+                m_compositeAnimation->animationController().addToAnimationsWaitingForStyle(*this);
 
                 // Trigger a render so we can start the animation
                 if (m_element)
@@ -275,7 +275,7 @@ void AnimationBase::updateStateMachine(AnimationStateInput input, double param)
                         timeOffset = -m_animation->delay();
                     bool started = startAnimation(timeOffset);
 
-                    m_compositeAnimation->animationController().addToAnimationsWaitingForStartTimeResponse(this, started);
+                    m_compositeAnimation->animationController().addToAnimationsWaitingForStartTimeResponse(*this, started);
                     m_isAccelerated = started;
                 }
             } else {
@@ -431,7 +431,7 @@ void AnimationBase::updateStateMachine(AnimationStateInput input, double param)
                         m_isAccelerated = true;
                     } else {
                         bool started = startAnimation(beginAnimationUpdateTime() - m_startTime.valueOr(0));
-                        m_compositeAnimation->animationController().addToAnimationsWaitingForStartTimeResponse(this, started);
+                        m_compositeAnimation->animationController().addToAnimationsWaitingForStartTimeResponse(*this, started);
                         m_isAccelerated = started;
                     }
                 }
index 339913c..8bb94e9 100644 (file)
@@ -507,17 +507,15 @@ unsigned CSSAnimationControllerPrivate::numberOfActiveAnimations(Document* docum
     return count;
 }
 
-void CSSAnimationControllerPrivate::addToAnimationsWaitingForStyle(AnimationBase* animation)
+void CSSAnimationControllerPrivate::addToAnimationsWaitingForStyle(AnimationBase& animation)
 {
-    // Make sure this animation is not in the start time waiters
-    m_animationsWaitingForStartTimeResponse.remove(animation);
-
-    m_animationsWaitingForStyle.add(animation);
+    m_animationsWaitingForStartTimeResponse.remove(&animation);
+    m_animationsWaitingForStyle.add(&animation);
 }
 
-void CSSAnimationControllerPrivate::removeFromAnimationsWaitingForStyle(AnimationBase* animationToRemove)
+void CSSAnimationControllerPrivate::removeFromAnimationsWaitingForStyle(AnimationBase& animationToRemove)
 {
-    m_animationsWaitingForStyle.remove(animationToRemove);
+    m_animationsWaitingForStyle.remove(&animationToRemove);
 }
 
 void CSSAnimationControllerPrivate::styleAvailable()
@@ -529,7 +527,7 @@ void CSSAnimationControllerPrivate::styleAvailable()
     m_animationsWaitingForStyle.clear();
 }
 
-void CSSAnimationControllerPrivate::addToAnimationsWaitingForStartTimeResponse(AnimationBase* animation, bool willGetResponse)
+void CSSAnimationControllerPrivate::addToAnimationsWaitingForStartTimeResponse(AnimationBase& animation, bool willGetResponse)
 {
     // If willGetResponse is true, it means this animation is actually waiting for a response
     // (which will come in as a call to notifyAnimationStarted()).
@@ -548,17 +546,16 @@ void CSSAnimationControllerPrivate::addToAnimationsWaitingForStartTimeResponse(A
     // This will synchronize all software and accelerated animations started in the same 
     // updateStyleIfNeeded cycle.
     //
-    
+
     if (willGetResponse)
         m_waitingForAsyncStartNotification = true;
 
-    m_animationsWaitingForStartTimeResponse.add(animation);
+    m_animationsWaitingForStartTimeResponse.add(&animation);
 }
 
-void CSSAnimationControllerPrivate::removeFromAnimationsWaitingForStartTimeResponse(AnimationBase* animationToRemove)
+void CSSAnimationControllerPrivate::removeFromAnimationsWaitingForStartTimeResponse(AnimationBase& animationToRemove)
 {
-    m_animationsWaitingForStartTimeResponse.remove(animationToRemove);
-    
+    m_animationsWaitingForStartTimeResponse.remove(&animationToRemove);
     if (m_animationsWaitingForStartTimeResponse.isEmpty())
         m_waitingForAsyncStartNotification = false;
 }
@@ -574,9 +571,9 @@ void CSSAnimationControllerPrivate::startTimeResponse(MonotonicTime time)
     m_waitingForAsyncStartNotification = false;
 }
 
-void CSSAnimationControllerPrivate::animationWillBeRemoved(AnimationBase* animation)
+void CSSAnimationControllerPrivate::animationWillBeRemoved(AnimationBase& animation)
 {
-    LOG(Animations, "CSSAnimationControllerPrivate %p animationWillBeRemoved: %p", this, animation);
+    LOG(Animations, "CSSAnimationControllerPrivate %p animationWillBeRemoved: %p", this, &animation);
 
     removeFromAnimationsWaitingForStyle(animation);
     removeFromAnimationsWaitingForStartTimeResponse(animation);
index b324c61..55f5868 100644 (file)
@@ -93,13 +93,13 @@ public:
     void endAnimationUpdate();
     void receivedStartTimeResponse(MonotonicTime);
     
-    void addToAnimationsWaitingForStyle(AnimationBase*);
-    void removeFromAnimationsWaitingForStyle(AnimationBase*);
+    void addToAnimationsWaitingForStyle(AnimationBase&);
+    void removeFromAnimationsWaitingForStyle(AnimationBase&);
 
-    void addToAnimationsWaitingForStartTimeResponse(AnimationBase*, bool willGetResponse);
-    void removeFromAnimationsWaitingForStartTimeResponse(AnimationBase*);
+    void addToAnimationsWaitingForStartTimeResponse(AnimationBase&, bool willGetResponse);
+    void removeFromAnimationsWaitingForStartTimeResponse(AnimationBase&);
 
-    void animationWillBeRemoved(AnimationBase*);
+    void animationWillBeRemoved(AnimationBase&);
 
     void updateAnimationTimerForElement(Element&);
 
index 6f97aa5..a781631 100644 (file)
@@ -64,14 +64,14 @@ void CompositeAnimation::clearElement()
         // Clear the renderers from all running animations, in case we are in the middle of
         // an animation callback (see https://bugs.webkit.org/show_bug.cgi?id=22052)
         for (auto& transition : m_transitions.values()) {
-            animationController().animationWillBeRemoved(transition.get());
+            animationController().animationWillBeRemoved(*transition);
             transition->clear();
         }
     }
     if (!m_keyframeAnimations.isEmpty()) {
         m_keyframeAnimations.checkConsistency();
         for (auto& animation : m_keyframeAnimations.values()) {
-            animationController().animationWillBeRemoved(animation.get());
+            animationController().animationWillBeRemoved(*animation);
             animation->clear();
         }
     }
@@ -159,7 +159,7 @@ void CompositeAnimation::updateTransitions(Element& element, const RenderStyle*
                             implAnim->blendPropertyValueInStyle(prop, modifiedCurrentStyle.get());
                         }
                         LOG(Animations, "Removing existing ImplicitAnimation %p for property %s", implAnim, getPropertyName(prop));
-                        animationController().animationWillBeRemoved(implAnim);
+                        animationController().animationWillBeRemoved(*implAnim);
                         m_transitions.remove(prop);
                         equal = false;
                     }
@@ -193,7 +193,7 @@ void CompositeAnimation::updateTransitions(Element& element, const RenderStyle*
     Vector<int> toBeRemoved;
     for (auto& transition : m_transitions.values()) {
         if (!transition->active()) {
-            animationController().animationWillBeRemoved(transition.get());
+            animationController().animationWillBeRemoved(*transition);
             toBeRemoved.append(transition->animatingProperty());
             LOG(Animations, "Removing ImplicitAnimation %p from element %p for property %s", transition.get(), &element, getPropertyName(transition->animatingProperty()));
         }
@@ -270,7 +270,7 @@ void CompositeAnimation::updateKeyframeAnimations(Element& element, const Render
     // Make a list of animations to be removed.
     for (auto& animation : m_keyframeAnimations.values()) {
         if (!newAnimations.contains(animation->name().impl())) {
-            animationController().animationWillBeRemoved(animation.get());
+            animationController().animationWillBeRemoved(*animation);
             animation->clear();
             LOG(Animations, "Removing KeyframeAnimation %p from element %p", animation.get(), &element);
         }
index 05c85c6..4008cb3 100644 (file)
@@ -81,14 +81,14 @@ void Frame::initWithSimpleHTMLDocument(const String& style, const URL& url)
 {
     m_loader->initForSynthesizedDocument(url);
 
-    auto document = HTMLDocument::createSynthesizedDocument(this, url);
+    auto document = HTMLDocument::createSynthesizedDocument(*this, url);
     document->setCompatibilityMode(DocumentCompatibilityMode::LimitedQuirksMode);
     document->createDOMWindow();
     setDocument(document.copyRef());
 
-    auto rootElement = HTMLHtmlElement::create(document.get());
+    auto rootElement = HTMLHtmlElement::create(document);
 
-    auto body = HTMLBodyElement::create(document.get());
+    auto body = HTMLBodyElement::create(document);
     if (!style.isEmpty())
         body->setAttribute(HTMLNames::styleAttr, style);
 
index 36745ec..ba9f765 100644 (file)
@@ -787,10 +787,10 @@ static ContainerNode* findEnclosingScrollableContainer(ContainerNode* node, floa
     // Find the first node with a valid scrollable area starting with the current
     // node and traversing its parents (or shadow hosts).
     for (ContainerNode* candidate = node; candidate; candidate = candidate->parentOrShadowHostNode()) {
-        if (is<HTMLIFrameElement>(candidate))
+        if (is<HTMLIFrameElement>(*candidate))
             continue;
 
-        if (is<HTMLHtmlElement>(candidate) || is<HTMLDocument>(candidate))
+        if (is<HTMLHtmlElement>(*candidate) || is<HTMLDocument>(*candidate))
             return nullptr;
 
         RenderBox* box = candidate->renderBox();
index 84971b6..c004fc9 100644 (file)
@@ -105,7 +105,7 @@ RefPtr<FilterEffect> CSSFilter::buildReferenceFilter(RenderElement& renderer, Fi
         // Although we did not find the referenced filter, it might exist later in the document.
         // FIXME: This skips anonymous RenderObjects. <https://webkit.org/b/131085>
         if (auto* element = renderer.element())
-            document->accessSVGExtensions().addPendingResource(filterOperation.fragment(), element);
+            document->accessSVGExtensions().addPendingResource(filterOperation.fragment(), *element);
         return nullptr;
     }
 
index 0c5b679..074f42f 100644 (file)
@@ -165,9 +165,9 @@ static inline void removeFromCacheAndInvalidateDependencies(RenderElement& rende
             clipper->removeClientFromCache(renderer);
     }
 
-    if (!renderer.element() || !renderer.element()->isSVGElement())
+    if (!is<SVGElement>(renderer.element()))
         return;
-    HashSet<SVGElement*>* dependencies = renderer.document().accessSVGExtensions().setOfElementsReferencingTarget(downcast<SVGElement>(renderer.element()));
+    auto* dependencies = renderer.document().accessSVGExtensions().setOfElementsReferencingTarget(downcast<SVGElement>(*renderer.element()));
     if (!dependencies)
         return;
 
index 0d1e346..9310435 100644 (file)
@@ -171,19 +171,19 @@ void RenderSVGResourceContainer::registerResource()
 {
     SVGDocumentExtensions& extensions = svgExtensionsFromElement(element());
     if (!extensions.isIdOfPendingResource(m_id)) {
-        extensions.addResource(m_id, this);
+        extensions.addResource(m_id, *this);
         return;
     }
 
     std::unique_ptr<SVGDocumentExtensions::PendingElements> clients = extensions.removePendingResource(m_id);
 
     // Cache us with the new id.
-    extensions.addResource(m_id, this);
+    extensions.addResource(m_id, *this);
 
     // Update cached resources of pending clients.
     for (auto* client : *clients) {
         ASSERT(client->hasPendingResources());
-        extensions.clearHasPendingResourcesIfPossible(client);
+        extensions.clearHasPendingResourcesIfPossible(*client);
         auto* renderer = client->renderer();
         if (!renderer)
             continue;
index a2cc4ba..2b06517 100644 (file)
@@ -190,7 +190,7 @@ static inline RenderSVGResourceContainer* paintingResourceFromSVGPaint(Document&
 
 static inline void registerPendingResource(SVGDocumentExtensions& extensions, const AtomicString& id, SVGElement& element)
 {
-    extensions.addPendingResource(id, &element);
+    extensions.addPendingResource(id, element);
 }
 
 bool SVGResources::buildCachedResources(const RenderElement& renderer, const RenderStyle& style)
index da24c07..19195aa 100644 (file)
@@ -163,9 +163,8 @@ void SVGResourcesCache::resourceDestroyed(RenderSVGResourceContainer& resource)
     for (auto& it : cache.m_cache) {
         if (it.value->resourceDestroyed(resource)) {
             // Mark users of destroyed resources as pending resolution based on the id of the old resource.
-            Element& resourceElement = resource.element();
-            Element* clientElement = it.key->element();
-            clientElement->document().accessSVGExtensions().addPendingResource(resourceElement.getIdAttribute(), clientElement);
+            auto& clientElement = *it.key->element();
+            clientElement.document().accessSVGExtensions().addPendingResource(resource.element().getIdAttribute(), clientElement);
         }
     }
 }
index 4ec1a8c..5c45335 100644 (file)
@@ -48,27 +48,25 @@ SVGDocumentExtensions::SVGDocumentExtensions(Document& document)
 
 SVGDocumentExtensions::~SVGDocumentExtensions() = default;
 
-void SVGDocumentExtensions::addTimeContainer(SVGSVGElement* element)
+void SVGDocumentExtensions::addTimeContainer(SVGSVGElement& element)
 {
-    m_timeContainers.add(element);
+    m_timeContainers.add(&element);
     if (m_areAnimationsPaused)
-        element->pauseAnimations();
+        element.pauseAnimations();
 }
 
-void SVGDocumentExtensions::removeTimeContainer(SVGSVGElement* element)
+void SVGDocumentExtensions::removeTimeContainer(SVGSVGElement& element)
 {
-    m_timeContainers.remove(element);
+    m_timeContainers.remove(&element);
 }
 
-void SVGDocumentExtensions::addResource(const AtomicString& id, RenderSVGResourceContainer* resource)
+void SVGDocumentExtensions::addResource(const AtomicString& id, RenderSVGResourceContainer& resource)
 {
-    ASSERT(resource);
-
     if (id.isEmpty())
         return;
 
     // Replaces resource if already present, to handle potential id changes
-    m_resources.set(id, resource);
+    m_resources.set(id, &resource);
 }
 
 void SVGDocumentExtensions::removeResource(const AtomicString& id)
@@ -141,19 +139,17 @@ void SVGDocumentExtensions::reportError(const String& message)
     reportMessage(m_document, MessageLevel::Error, "Error: " + message);
 }
 
-void SVGDocumentExtensions::addPendingResource(const AtomicString& id, Element* element)
+void SVGDocumentExtensions::addPendingResource(const AtomicString& id, Element& element)
 {
-    ASSERT(element);
-
     if (id.isEmpty())
         return;
 
     auto result = m_pendingResources.add(id, nullptr);
     if (result.isNewEntry)
         result.iterator->value = std::make_unique<PendingElements>();
-    result.iterator->value->add(element);
+    result.iterator->value->add(&element);
 
-    element->setHasPendingResources();
+    element.setHasPendingResources();
 }
 
 bool SVGDocumentExtensions::isIdOfPendingResource(const AtomicString& id) const
@@ -164,49 +160,43 @@ bool SVGDocumentExtensions::isIdOfPendingResource(const AtomicString& id) const
     return m_pendingResources.contains(id);
 }
 
-bool SVGDocumentExtensions::isElementWithPendingResources(Element* element) const
+bool SVGDocumentExtensions::isElementWithPendingResources(Element& element) const
 {
     // This algorithm takes time proportional to the number of pending resources and need not.
     // If performance becomes an issue we can keep a counted set of elements and answer the question efficiently.
-    ASSERT(element);
     for (auto& elements : m_pendingResources.values()) {
         ASSERT(elements);
-
-        if (elements->contains(element))
+        if (elements->contains(&element))
             return true;
     }
     return false;
 }
 
-bool SVGDocumentExtensions::isPendingResource(Element* element, const AtomicString& id) const
+bool SVGDocumentExtensions::isPendingResource(Element& element, const AtomicString& id) const
 {
-    ASSERT(element);
-
     if (!isIdOfPendingResource(id))
         return false;
 
-    return m_pendingResources.get(id)->contains(element);
+    return m_pendingResources.get(id)->contains(&element);
 }
 
-void SVGDocumentExtensions::clearHasPendingResourcesIfPossible(Element* element)
+void SVGDocumentExtensions::clearHasPendingResourcesIfPossible(Element& element)
 {
     if (!isElementWithPendingResources(element))
-        element->clearHasPendingResources();
+        element.clearHasPendingResources();
 }
 
-void SVGDocumentExtensions::removeElementFromPendingResources(Element* element)
+void SVGDocumentExtensions::removeElementFromPendingResources(Element& element)
 {
-    ASSERT(element);
-
     // Remove the element from pending resources.
-    if (!m_pendingResources.isEmpty() && element->hasPendingResources()) {
+    if (!m_pendingResources.isEmpty() && element.hasPendingResources()) {
         Vector<AtomicString> toBeRemoved;
         for (auto& resource : m_pendingResources) {
             PendingElements* elements = resource.value.get();
             ASSERT(elements);
             ASSERT(!elements->isEmpty());
 
-            elements->remove(element);
+            elements->remove(&element);
             if (elements->isEmpty())
                 toBeRemoved.append(resource.key);
         }
@@ -226,7 +216,7 @@ void SVGDocumentExtensions::removeElementFromPendingResources(Element* element)
             ASSERT(elements);
             ASSERT(!elements->isEmpty());
 
-            elements->remove(element);
+            elements->remove(&element);
             if (elements->isEmpty())
                 toBeRemoved.append(resource.key);
         }
@@ -281,40 +271,29 @@ RefPtr<Element> SVGDocumentExtensions::removeElementFromPendingResourcesForRemov
     return element;
 }
 
-HashSet<SVGElement*>* SVGDocumentExtensions::setOfElementsReferencingTarget(SVGElement* referencedElement) const
+HashSet<SVGElement*>* SVGDocumentExtensions::setOfElementsReferencingTarget(SVGElement& referencedElement) const
 {
-    ASSERT(referencedElement);
-    const auto it = m_elementDependencies.find(referencedElement);
-    if (it == m_elementDependencies.end())
-        return 0;
-    return it->value.get();
+    return m_elementDependencies.get(&referencedElement);
 }
 
-void SVGDocumentExtensions::addElementReferencingTarget(SVGElement* referencingElement, SVGElement* referencedElement)
+void SVGDocumentExtensions::addElementReferencingTarget(SVGElement& referencingElement, SVGElement& referencedElement)
 {
-    ASSERT(referencingElement);
-    ASSERT(referencedElement);
-
-    if (HashSet<SVGElement*>* elements = m_elementDependencies.get(referencedElement)) {
-        elements->add(referencingElement);
-        return;
-    }
-
-    auto elements = std::make_unique<HashSet<SVGElement*>>();
-    elements->add(referencingElement);
-    m_elementDependencies.set(referencedElement, WTFMove(elements));
+    auto result = m_elementDependencies.ensure(&referencedElement, [&referencingElement] {
+        return std::make_unique<HashSet<SVGElement*>>(std::initializer_list<SVGElement*> { &referencingElement });
+    });
+    if (!result.isNewEntry)
+        result.iterator->value->add(&referencingElement);
 }
 
-void SVGDocumentExtensions::removeAllTargetReferencesForElement(SVGElement* referencingElement)
+void SVGDocumentExtensions::removeAllTargetReferencesForElement(SVGElement& referencingElement)
 {
     Vector<SVGElement*> toBeRemoved;
 
     for (auto& dependency : m_elementDependencies) {
-        SVGElement* referencedElement = dependency.key;
-        HashSet<SVGElement*>& referencingElements = *dependency.value;
-        referencingElements.remove(referencingElement);
+        auto& referencingElements = *dependency.value;
+        referencingElements.remove(&referencingElement);
         if (referencingElements.isEmpty())
-            toBeRemoved.append(referencedElement);
+            toBeRemoved.append(dependency.key);
     }
 
     for (auto& element : toBeRemoved)
@@ -330,11 +309,9 @@ void SVGDocumentExtensions::rebuildElements()
 
 void SVGDocumentExtensions::clearTargetDependencies(SVGElement& referencedElement)
 {
-    auto it = m_elementDependencies.find(&referencedElement);
-    if (it == m_elementDependencies.end())
+    auto* referencingElements = m_elementDependencies.get(&referencedElement);
+    if (!referencingElements)
         return;
-    ASSERT(it->key == &referencedElement);
-    HashSet<SVGElement*>* referencingElements = it->value.get();
     for (auto* element : *referencingElements) {
         m_rebuildElements.append(element);
         element->callClearTarget();
@@ -358,23 +335,25 @@ void SVGDocumentExtensions::rebuildAllElementReferencesForTarget(SVGElement& ref
         element->svgAttributeChanged(SVGNames::hrefAttr);
 }
 
-void SVGDocumentExtensions::removeAllElementReferencesForTarget(SVGElement* referencedElement)
+void SVGDocumentExtensions::removeAllElementReferencesForTarget(SVGElement& referencedElement)
 {
-    m_elementDependencies.remove(referencedElement);
-    m_rebuildElements.removeFirst(referencedElement);
+    m_elementDependencies.remove(&referencedElement);
+    m_rebuildElements.removeFirst(&referencedElement);
 }
 
 #if ENABLE(SVG_FONTS)
-void SVGDocumentExtensions::registerSVGFontFaceElement(SVGFontFaceElement* element)
+
+void SVGDocumentExtensions::registerSVGFontFaceElement(SVGFontFaceElement& element)
 {
-    m_svgFontFaceElements.add(element);
+    m_svgFontFaceElements.add(&element);
 }
 
-void SVGDocumentExtensions::unregisterSVGFontFaceElement(SVGFontFaceElement* element)
+void SVGDocumentExtensions::unregisterSVGFontFaceElement(SVGFontFaceElement& element)
 {
-    ASSERT(m_svgFontFaceElements.contains(element));
-    m_svgFontFaceElements.remove(element);
+    ASSERT(m_svgFontFaceElements.contains(&element));
+    m_svgFontFaceElements.remove(&element);
 }
+
 #endif
 
 }
index ef72e97..c49f2dc 100644 (file)
@@ -43,10 +43,10 @@ public:
     explicit SVGDocumentExtensions(Document&);
     ~SVGDocumentExtensions();
     
-    void addTimeContainer(SVGSVGElement*);
-    void removeTimeContainer(SVGSVGElement*);
+    void addTimeContainer(SVGSVGElement&);
+    void removeTimeContainer(SVGSVGElement&);
 
-    void addResource(const AtomicString& id, RenderSVGResourceContainer*);
+    void addResource(const AtomicString& id, RenderSVGResourceContainer&);
     void removeResource(const AtomicString& id);
     RenderSVGResourceContainer* resourceById(const AtomicString& id) const;
 
@@ -61,19 +61,19 @@ public:
 
     SVGResourcesCache& resourcesCache() { return *m_resourcesCache; }
 
-    HashSet<SVGElement*>* setOfElementsReferencingTarget(SVGElement* referencedElement) const;
-    void addElementReferencingTarget(SVGElement* referencingElement, SVGElement* referencedElement);
-    void removeAllTargetReferencesForElement(SVGElement*);
+    HashSet<SVGElement*>* setOfElementsReferencingTarget(SVGElement& referencedElement) const;
+    void addElementReferencingTarget(SVGElement& referencingElement, SVGElement& referencedElement);
+    void removeAllTargetReferencesForElement(SVGElement&);
     void rebuildAllElementReferencesForTarget(SVGElement&);
-    void removeAllElementReferencesForTarget(SVGElement*);
+    void removeAllElementReferencesForTarget(SVGElement&);
 
     void clearTargetDependencies(SVGElement&);
     void rebuildElements();
 
 #if ENABLE(SVG_FONTS)
     const HashSet<SVGFontFaceElement*>& svgFontFaceElements() const { return m_svgFontFaceElements; }
-    void registerSVGFontFaceElement(SVGFontFaceElement*);
-    void unregisterSVGFontFaceElement(SVGFontFaceElement*);
+    void registerSVGFontFaceElement(SVGFontFaceElement&);
+    void unregisterSVGFontFaceElement(SVGFontFaceElement&);
 #endif
 
 private:
@@ -95,11 +95,11 @@ public:
     // This HashMap contains a list of pending resources. Pending resources, are such
     // which are referenced by any object in the SVG document, but do NOT exist yet.
     // For instance, dynamically build gradients / patterns / clippers...
-    void addPendingResource(const AtomicString& id, Element*);
+    void addPendingResource(const AtomicString& id, Element&);
     bool isIdOfPendingResource(const AtomicString& id) const;
-    bool isPendingResource(Element*, const AtomicString& id) const;
-    void clearHasPendingResourcesIfPossible(Element*);
-    void removeElementFromPendingResources(Element*);
+    bool isPendingResource(Element&, const AtomicString& id) const;
+    void clearHasPendingResourcesIfPossible(Element&);
+    void removeElementFromPendingResources(Element&);
     std::unique_ptr<PendingElements> removePendingResource(const AtomicString& id);
 
     // The following two functions are used for scheduling a pending resource to be removed.
@@ -107,7 +107,7 @@ public:
     RefPtr<Element> removeElementFromPendingResourcesForRemovalMap(const AtomicString&);
 
 private:
-    bool isElementWithPendingResources(Element*) const;
+    bool isElementWithPendingResources(Element&) const;
     std::unique_ptr<PendingElements> removePendingResourceForRemoval(const AtomicString&);
 };
 
index 4f9f0d4..12ee77c 100644 (file)
@@ -290,7 +290,7 @@ SVGElement::~SVGElement()
         m_svgRareData = nullptr;
     }
     document().accessSVGExtensions().rebuildAllElementReferencesForTarget(*this);
-    document().accessSVGExtensions().removeAllElementReferencesForTarget(this);
+    document().accessSVGExtensions().removeAllElementReferencesForTarget(*this);
 }
 
 int SVGElement::tabIndex() const
@@ -370,7 +370,7 @@ void SVGElement::removedFromAncestor(RemovalType removalType, ContainerNode& old
 
     if (removalType.disconnectedFromDocument) {
         document().accessSVGExtensions().clearTargetDependencies(*this);
-        document().accessSVGExtensions().removeAllElementReferencesForTarget(this);
+        document().accessSVGExtensions().removeAllElementReferencesForTarget(*this);
     }
     invalidateInstances();
 }
@@ -992,7 +992,7 @@ void SVGElement::buildPendingResourcesIfNeeded()
         ASSERT(clientElement->hasPendingResources());
         if (clientElement->hasPendingResources()) {
             clientElement->buildPendingResource();
-            extensions.clearHasPendingResourcesIfPossible(clientElement.get());
+            extensions.clearHasPendingResourcesIfPossible(*clientElement);
         }
     }
 }
index 65cfde1..5da0d49 100644 (file)
@@ -72,7 +72,7 @@ void SVGFEImageElement::clearResourceReferences()
         m_cachedImage = nullptr;
     }
 
-    document().accessSVGExtensions().removeAllTargetReferencesForElement(this);
+    document().accessSVGExtensions().removeAllTargetReferencesForElement(*this);
 }
 
 void SVGFEImageElement::requestImageResource()
@@ -99,13 +99,13 @@ void SVGFEImageElement::buildPendingResource()
         if (target.identifier.isEmpty())
             requestImageResource();
         else {
-            document().accessSVGExtensions().addPendingResource(target.identifier, this);
+            document().accessSVGExtensions().addPendingResource(target.identifier, *this);
             ASSERT(hasPendingResources());
         }
-    } else if (target.element->isSVGElement()) {
+    } else if (is<SVGElement>(*target.element)) {
         // Register us with the target in the dependencies map. Any change of hrefElement
         // that leads to relayout/repainting now informs us, so we can react to it.
-        document().accessSVGExtensions().addElementReferencingTarget(this, downcast<SVGElement>(target.element.get()));
+        document().accessSVGExtensions().addElementReferencingTarget(*this, downcast<SVGElement>(*target.element));
     }
 
     invalidate();
index fe3b619..33b6b78 100644 (file)
@@ -304,7 +304,7 @@ Node::InsertedIntoAncestorResult SVGFontFaceElement::insertedIntoAncestor(Insert
         ASSERT(!m_fontElement);
         return InsertedIntoAncestorResult::Done;
     }
-    document().accessSVGExtensions().registerSVGFontFaceElement(this);
+    document().accessSVGExtensions().registerSVGFontFaceElement(*this);
 
     rebuildFontFace();
     return InsertedIntoAncestorResult::Done;
@@ -316,7 +316,7 @@ void SVGFontFaceElement::removedFromAncestor(RemovalType removalType, ContainerN
 
     if (removalType.disconnectedFromDocument) {
         m_fontElement = nullptr;
-        document().accessSVGExtensions().unregisterSVGFontFaceElement(this);
+        document().accessSVGExtensions().unregisterSVGFontFaceElement(*this);
         m_fontFaceRule->mutableProperties().clear();
 
         document().styleScope().didChangeStyleSheetEnvironment();
index 18e9dd5..60ba714 100644 (file)
@@ -58,17 +58,17 @@ void SVGMPathElement::buildPendingResource()
     auto target = SVGURIReference::targetElementFromIRIString(href(), treeScope());
     if (!target.element) {
         // Do not register as pending if we are already pending this resource.
-        if (document().accessSVGExtensions().isPendingResource(this, target.identifier))
+        if (document().accessSVGExtensions().isPendingResource(*this, target.identifier))
             return;
 
         if (!target.identifier.isEmpty()) {
-            document().accessSVGExtensions().addPendingResource(target.identifier, this);
+            document().accessSVGExtensions().addPendingResource(target.identifier, *this);
             ASSERT(hasPendingResources());
         }
-    } else if (target.element->isSVGElement()) {
+    } else if (is<SVGElement>(*target.element)) {
         // Register us with the target in the dependencies map. Any change of hrefElement
         // that leads to relayout/repainting now informs us, so we can react to it.
-        document().accessSVGExtensions().addElementReferencingTarget(this, downcast<SVGElement>(target.element.get()));
+        document().accessSVGExtensions().addElementReferencingTarget(*this, downcast<SVGElement>(*target.element));
     }
 
     targetPathChanged();
@@ -76,7 +76,7 @@ void SVGMPathElement::buildPendingResource()
 
 void SVGMPathElement::clearResourceReferences()
 {
-    document().accessSVGExtensions().removeAllTargetReferencesForElement(this);
+    document().accessSVGExtensions().removeAllTargetReferencesForElement(*this);
 }
 
 Node::InsertedIntoAncestorResult SVGMPathElement::insertedIntoAncestor(InsertionType insertionType, ContainerNode& parentOfInsertedTree)
index a28e714..a777b8d 100644 (file)
@@ -237,7 +237,7 @@ void SVGPathElement::invalidateMPathDependencies()
 {
     // <mpath> can only reference <path> but this dependency is not handled in
     // markForLayoutAndParentResourceInvalidation so we update any mpath dependencies manually.
-    if (HashSet<SVGElement*>* dependencies = document().accessSVGExtensions().setOfElementsReferencingTarget(this)) {
+    if (HashSet<SVGElement*>* dependencies = document().accessSVGExtensions().setOfElementsReferencingTarget(*this)) {
         for (auto* element : *dependencies) {
             if (is<SVGMPathElement>(*element))
                 downcast<SVGMPathElement>(*element).targetPathChanged();
index 16171a3..4d14415 100644 (file)
@@ -60,7 +60,7 @@ inline SVGSVGElement::SVGSVGElement(const QualifiedName& tagName, Document& docu
 {
     ASSERT(hasTagName(SVGNames::svgTag));
     registerAttributes();
-    document.registerForDocumentSuspensionCallbacks(this);
+    document.registerForDocumentSuspensionCallbacks(*this);
 }
 
 Ref<SVGSVGElement> SVGSVGElement::create(const QualifiedName& tagName, Document& document)
@@ -77,14 +77,14 @@ SVGSVGElement::~SVGSVGElement()
 {
     if (m_viewSpec)
         m_viewSpec->resetContextElement();
-    document().unregisterForDocumentSuspensionCallbacks(this);
-    document().accessSVGExtensions().removeTimeContainer(this);
+    document().unregisterForDocumentSuspensionCallbacks(*this);
+    document().accessSVGExtensions().removeTimeContainer(*this);
 }
 
 void SVGSVGElement::didMoveToNewDocument(Document& oldDocument, Document& newDocument)
 {
-    oldDocument.unregisterForDocumentSuspensionCallbacks(this);
-    document().registerForDocumentSuspensionCallbacks(this);
+    oldDocument.unregisterForDocumentSuspensionCallbacks(*this);
+    document().registerForDocumentSuspensionCallbacks(*this);
     SVGGraphicsElement::didMoveToNewDocument(oldDocument, newDocument);
 }
 
@@ -474,7 +474,7 @@ RenderPtr<RenderElement> SVGSVGElement::createElementRenderer(RenderStyle&& styl
 Node::InsertedIntoAncestorResult SVGSVGElement::insertedIntoAncestor(InsertionType insertionType, ContainerNode& parentOfInsertedTree)
 {
     if (insertionType.connectedToDocument) {
-        document().accessSVGExtensions().addTimeContainer(this);
+        document().accessSVGExtensions().addTimeContainer(*this);
         if (!document().accessSVGExtensions().areAnimationsPaused())
             unpauseAnimations();
 
@@ -490,7 +490,7 @@ Node::InsertedIntoAncestorResult SVGSVGElement::insertedIntoAncestor(InsertionTy
 void SVGSVGElement::removedFromAncestor(RemovalType removalType, ContainerNode& oldParentOfRemovedTree)
 {
     if (removalType.disconnectedFromDocument) {
-        document().accessSVGExtensions().removeTimeContainer(this);
+        document().accessSVGExtensions().removeTimeContainer(*this);
         pauseAnimations();
     }
     SVGGraphicsElement::removedFromAncestor(removalType, oldParentOfRemovedTree);
index b73f3cf..823f1f0 100644 (file)
@@ -169,7 +169,7 @@ void SVGTRefElement::detachTarget()
     // Mark the referenced ID as pending.
     auto target = SVGURIReference::targetElementFromIRIString(href(), document());
     if (!target.identifier.isEmpty())
-        document().accessSVGExtensions().addPendingResource(target.identifier, this);
+        document().accessSVGExtensions().addPendingResource(target.identifier, *this);
 }
 
 void SVGTRefElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
@@ -235,7 +235,7 @@ void SVGTRefElement::buildPendingResource()
         if (target.identifier.isEmpty())
             return;
 
-        document().accessSVGExtensions().addPendingResource(target.identifier, this);
+        document().accessSVGExtensions().addPendingResource(target.identifier, *this);
         ASSERT(hasPendingResources());
         return;
     }
index a1191f9..55895a9 100644 (file)
@@ -53,7 +53,7 @@ SVGTextPathElement::~SVGTextPathElement()
 
 void SVGTextPathElement::clearResourceReferences()
 {
-    document().accessSVGExtensions().removeAllTargetReferencesForElement(this);
+    document().accessSVGExtensions().removeAllTargetReferencesForElement(*this);
 }
 
 void SVGTextPathElement::registerAttributes()
@@ -146,17 +146,17 @@ void SVGTextPathElement::buildPendingResource()
     auto target = SVGURIReference::targetElementFromIRIString(href(), treeScope());
     if (!target.element) {
         // Do not register as pending if we are already pending this resource.
-        if (document().accessSVGExtensions().isPendingResource(this, target.identifier))
+        if (document().accessSVGExtensions().isPendingResource(*this, target.identifier))
             return;
 
         if (!target.identifier.isEmpty()) {
-            document().accessSVGExtensions().addPendingResource(target.identifier, this);
+            document().accessSVGExtensions().addPendingResource(target.identifier, *this);
             ASSERT(hasPendingResources());
         }
     } else if (target.element->hasTagName(SVGNames::pathTag)) {
         // Register us with the target in the dependencies map. Any change of hrefElement
         // that leads to relayout/repainting now informs us, so we can react to it.
-        document().accessSVGExtensions().addElementReferencingTarget(this, downcast<SVGElement>(target.element.get()));
+        document().accessSVGExtensions().addElementReferencingTarget(*this, downcast<SVGElement>(*target.element));
     }
 }
 
index bbcc437..06142a4 100644 (file)
@@ -240,7 +240,7 @@ void SVGUseElement::updateShadowTree()
     String targetID;
     auto* target = findTarget(&targetID);
     if (!target) {
-        document().accessSVGExtensions().addPendingResource(targetID, this);
+        document().accessSVGExtensions().addPendingResource(targetID, *this);
         return;
     }
 
index bbda240..c12e9ea 100644 (file)
@@ -161,7 +161,7 @@ SVGSMILElement::~SVGSMILElement()
 
 void SVGSMILElement::clearResourceReferences()
 {
-    document().accessSVGExtensions().removeAllTargetReferencesForElement(this);
+    document().accessSVGExtensions().removeAllTargetReferencesForElement(*this);
 }
 
 void SVGSMILElement::clearTarget()
@@ -199,17 +199,17 @@ void SVGSMILElement::buildPendingResource()
 
     if (!svgTarget) {
         // Do not register as pending if we are already pending this resource.
-        if (document().accessSVGExtensions().isPendingResource(this, id))
+        if (document().accessSVGExtensions().isPendingResource(*this, id))
             return;
 
         if (!id.isEmpty()) {
-            document().accessSVGExtensions().addPendingResource(id, this);
+            document().accessSVGExtensions().addPendingResource(id, *this);
             ASSERT(hasPendingResources());
         }
     } else {
         // Register us with the target in the dependencies map. Any change of hrefElement
         // that leads to relayout/repainting now informs us, so we can react to it.
-        document().accessSVGExtensions().addElementReferencingTarget(this, svgTarget);
+        document().accessSVGExtensions().addElementReferencingTarget(*this, *svgTarget);
     }
 }
 
index 3099971..1c84704 100644 (file)
@@ -1610,7 +1610,7 @@ ExceptionOr<String> Internals::dumpMarkerRects(const String& markerTypeString)
 void Internals::addTextMatchMarker(const Range& range, bool isActive)
 {
     range.ownerDocument().updateLayoutIgnorePendingStylesheets();
-    range.ownerDocument().markers().addTextMatchMarker(&range, isActive);
+    range.ownerDocument().markers().addTextMatchMarker(range, isActive);
 }
 
 ExceptionOr<void> Internals::setMarkedTextMatchesAreHighlighted(bool flag)
@@ -2920,31 +2920,31 @@ void Internals::webkitWillEnterFullScreenForElement(Element& element)
     Document* document = contextDocument();
     if (!document)
         return;
-    document->webkitWillEnterFullScreenForElement(&element);
+    document->webkitWillEnterFullScreen(element);
 }
 
-void Internals::webkitDidEnterFullScreenForElement(Element& element)
+void Internals::webkitDidEnterFullScreenForElement(Element&)
 {
     Document* document = contextDocument();
     if (!document)
         return;
-    document->webkitDidEnterFullScreenForElement(&element);
+    document->webkitDidEnterFullScreen();
 }
 
-void Internals::webkitWillExitFullScreenForElement(Element& element)
+void Internals::webkitWillExitFullScreenForElement(Element&)
 {
     Document* document = contextDocument();
     if (!document)
         return;
-    document->webkitWillExitFullScreenForElement(&element);
+    document->webkitWillExitFullScreen();
 }
 
-void Internals::webkitDidExitFullScreenForElement(Element& element)
+void Internals::webkitDidExitFullScreenForElement(Element&)
 {
     Document* document = contextDocument();
     if (!document)
         return;
-    document->webkitDidExitFullScreenForElement(&element);
+    document->webkitDidExitFullScreen();
 }
 
 bool Internals::isAnimatingFullScreen() const
index 49474c7..6486338 100644 (file)
@@ -93,7 +93,7 @@ ExceptionOr<Ref<Worker>> Worker::create(ScriptExecutionContext& context, JSC::Ru
     worker->m_shouldBypassMainWorldContentSecurityPolicy = shouldBypassMainWorldContentSecurityPolicy;
 
     // The worker context does not exist while loading, so we must ensure that the worker object is not collected, nor are its event listeners.
-    worker->setPendingActivity(worker.ptr());
+    worker->setPendingActivity(worker.get());
 
     // https://html.spec.whatwg.org/multipage/workers.html#official-moment-of-creation
     worker->m_workerCreationTime = MonotonicTime::now();
@@ -191,7 +191,7 @@ void Worker::notifyFinished()
     }
     m_scriptLoader = nullptr;
 
-    unsetPendingActivity(this);
+    unsetPendingActivity(*this);
 }
 
 } // namespace WebCore
index 7a96d97..7442dd4 100644 (file)
@@ -239,7 +239,7 @@ void ServiceWorkerContainer::scheduleJob(Ref<ServiceWorkerJob>&& job)
 
     ASSERT(m_swConnection);
 
-    setPendingActivity(this);
+    setPendingActivity(*this);
 
     auto& jobData = job->data();
     auto result = m_jobMap.add(job->identifier(), WTFMove(job));
@@ -558,7 +558,7 @@ void ServiceWorkerContainer::jobDidFinish(ServiceWorkerJob& job)
     auto taken = m_jobMap.take(job.identifier());
     ASSERT_UNUSED(taken, !taken || taken->ptr() == &job);
 
-    unsetPendingActivity(this);
+    unsetPendingActivity(*this);
 }
 
 SWServerConnectionIdentifier ServiceWorkerContainer::connectionIdentifier()
index 0dd7152..5116457 100644 (file)
@@ -197,9 +197,9 @@ ExceptionOr<Document*> XMLHttpRequest::responseXML()
             m_responseDocument = nullptr;
         } else {
             if (isHTML)
-                m_responseDocument = HTMLDocument::create(0, m_url);
+                m_responseDocument = HTMLDocument::create(nullptr, m_url);
             else
-                m_responseDocument = XMLDocument::create(0, m_url);
+                m_responseDocument = XMLDocument::create(nullptr, m_url);
             m_responseDocument->overrideLastModified(m_response.lastModified());
             m_responseDocument->setContent(m_responseBuilder.toStringPreserveCapacity());
             m_responseDocument->setContextDocument(downcast<Document>(*scriptExecutionContext()));
@@ -429,7 +429,7 @@ Optional<ExceptionOr<void>> XMLHttpRequest::prepareToSend()
     if (!context.shouldBypassMainWorldContentSecurityPolicy() && !context.contentSecurityPolicy()->allowConnectToSource(m_url)) {
         if (!m_async)
             return ExceptionOr<void> { Exception { NetworkError } };
-        setPendingActivity(this);
+        setPendingActivity(*this);
         m_timeoutTimer.stop();
         m_networkErrorTimer.startOneShot(0_s);
         return ExceptionOr<void> { };
@@ -652,7 +652,7 @@ ExceptionOr<void> XMLHttpRequest::createRequest()
         // a request is in progress because we need to keep the listeners alive,
         // and they are referenced by the JavaScript wrapper.
         if (m_loader)
-            setPendingActivity(this);
+            setPendingActivity(*this);
     } else {
         request.setDomainForCachePartition(scriptExecutionContext()->domainForCachePartition());
         InspectorInstrumentation::willLoadXHRSynchronously(scriptExecutionContext());
@@ -715,7 +715,7 @@ bool XMLHttpRequest::internalAbort()
     // Save this information to a local variable since we are going to drop protection.
     bool newLoadStarted = m_loader;
 
-    unsetPendingActivity(this);
+    unsetPendingActivity(*this);
 
     return !newLoadStarted;
 }
@@ -762,7 +762,7 @@ void XMLHttpRequest::networkError()
 void XMLHttpRequest::networkErrorTimerFired()
 {
     networkError();
-    unsetPendingActivity(this);
+    unsetPendingActivity(*this);
 }
     
 void XMLHttpRequest::abortError()
@@ -913,7 +913,7 @@ void XMLHttpRequest::didFail(const ResourceError& error)
     // In case didFail is called synchronously on an asynchronous XHR call, let's dispatch network error asynchronously
     if (m_async && m_sendFlag && !m_loader) {
         m_sendFlag = false;
-        setPendingActivity(this);
+        setPendingActivity(*this);
         m_timeoutTimer.stop();
         m_networkErrorTimer.startOneShot(0_s);
         return;
@@ -946,7 +946,7 @@ void XMLHttpRequest::didFinishLoading(unsigned long)
     m_timeoutTimer.stop();
 
     if (hadLoader)
-        unsetPendingActivity(this);
+        unsetPendingActivity(*this);
 }
 
 void XMLHttpRequest::didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
index aa40c21..4b55917 100644 (file)
@@ -30,7 +30,6 @@
 
 #include "Attr.h"
 #include "Document.h"
-#include "HTMLDocument.h"
 #include "HTMLElement.h"
 #include "NodeTraversal.h"
 #include "XMLNSNames.h"
@@ -199,7 +198,7 @@ inline bool nodeMatchesBasicTest(Node& node, Step::Axis axis, const Step::NodeTe
             if (name == starAtom())
                 return namespaceURI.isEmpty() || namespaceURI == node.namespaceURI();
 
-            if (is<HTMLDocument>(node.document())) {
+            if (node.document().isHTMLDocument()) {
                 if (is<HTMLElement>(node)) {
                     // Paths without namespaces should match HTML elements in HTML documents despite those having an XHTML namespace. Names are compared case-insensitively.
                     return equalIgnoringASCIICase(downcast<HTMLElement>(node).localName(), name) && (namespaceURI.isNull() || namespaceURI == node.namespaceURI());
index 99017ab..a68acd7 100644 (file)
  */
 
 #include "config.h"
+#include "XSLTProcessor.h"
 
 #if ENABLE(XSLT)
 
-#include "XSLTProcessor.h"
-
 #include "DOMImplementation.h"
 #include "CachedResourceLoader.h"
 #include "ContentSecurityPolicy.h"
@@ -33,7 +32,6 @@
 #include "Frame.h"
 #include "FrameLoader.h"
 #include "FrameView.h"
-#include "HTMLDocument.h"
 #include "SecurityOrigin.h"
 #include "SecurityOriginPolicy.h"
 #include "Text.h"
@@ -87,7 +85,7 @@ Ref<Document> XSLTProcessor::createDocumentFromSource(const String& sourceString
 
         if (Document* oldDocument = frame->document()) {
             result->setTransformSourceDocument(oldDocument);
-            result->takeDOMWindowFrom(oldDocument);
+            result->takeDOMWindowFrom(*oldDocument);
             result->setSecurityOriginPolicy(oldDocument->securityOriginPolicy());
             result->setCookieURL(oldDocument->cookieURL());
             result->setFirstPartyForCookies(oldDocument->firstPartyForCookies());
index 5537af3..b74267b 100644 (file)
@@ -1,3 +1,25 @@
+2019-01-15  Darin Adler  <darin@apple.com>
+
+        Use references rather than pointers for register/unregister functions, and more
+        https://bugs.webkit.org/show_bug.cgi?id=175028
+
+        Reviewed by Daniel Bates.
+
+        * WebProcess/FullScreen/WebFullScreenManager.cpp:
+        (WebKit::WebFullScreenManager::willEnterFullScreen): Update for change to the
+        functions in Document; pass a reference.
+        (WebKit::WebFullScreenManager::didEnterFullScreen): Ditto, don't pass the element.
+        (WebKit::WebFullScreenManager::willExitFullScreen): Ditto.
+        (WebKit::WebFullScreenManager::didExitFullScreen): Ditto.
+
+        * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
+        (WebKit::UserMediaPermissionRequestManager::startUserMediaRequest): Pass a reference.
+        (WebKit::UserMediaPermissionRequestManager::mediaCanStart): Ditto.
+        (WebKit::UserMediaPermissionRequestManager::removeMediaRequestFromMaps): Ditto.
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::~PluginView): Ditto.
+        (WebKit::PluginView::initializePlugin): Ditto.
+
 2019-01-20  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         Unreviewed, fix -Wreturn-type warning
index 6c99e33..290a195 100644 (file)
@@ -150,7 +150,7 @@ void WebFullScreenManager::willEnterFullScreen()
 {
     LOG(Fullscreen, "WebFullScreenManager %p willEnterFullScreen() - element %p", this, m_element.get());
 
-    m_element->document().webkitWillEnterFullScreenForElement(m_element.get());
+    m_element->document().webkitWillEnterFullScreen(*m_element);
 #if !PLATFORM(IOS_FAMILY)
     m_page->hidePageBanners();
 #endif
@@ -164,7 +164,7 @@ void WebFullScreenManager::didEnterFullScreen()
 {
     LOG(Fullscreen, "WebFullScreenManager %p didEnterFullScreen() - element %p", this, m_element.get());
 
-    m_element->document().webkitDidEnterFullScreenForElement(m_element.get());
+    m_element->document().webkitDidEnterFullScreen();
 
 #if PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
     auto* currentPlaybackControlsElement = m_page->playbackSessionManager().currentPlaybackControlsElement();
@@ -182,7 +182,7 @@ void WebFullScreenManager::willExitFullScreen()
 #endif
 
     m_finalFrame = screenRectOfContents(m_element.get());
-    m_element->document().webkitWillExitFullScreenForElement(m_element.get());
+    m_element->document().webkitWillExitFullScreen();
 #if !PLATFORM(IOS_FAMILY)
     m_page->showPageBanners();
 #endif
@@ -196,7 +196,7 @@ void WebFullScreenManager::didExitFullScreen()
     ASSERT(m_element);
     setFullscreenInsets(FloatBoxExtent());
     setFullscreenAutoHideDuration(0_s);
-    m_element->document().webkitDidExitFullScreenForElement(m_element.get());
+    m_element->document().webkitDidExitFullScreen();
 }
 
 void WebFullScreenManager::setAnimatingFullScreen(bool animating)
index ad21dd2..5623cc0 100644 (file)
@@ -79,7 +79,7 @@ void UserMediaPermissionRequestManager::startUserMediaRequest(UserMediaRequest&
 
     auto& pendingRequests = m_blockedUserMediaRequests.add(document, Vector<RefPtr<UserMediaRequest>>()).iterator->value;
     if (pendingRequests.isEmpty())
-        document->addMediaCanStartListener(this);
+        document->addMediaCanStartListener(*this);
     pendingRequests.append(&request);
 }
 
@@ -119,7 +119,7 @@ void UserMediaPermissionRequestManager::mediaCanStart(Document& document)
     while (!pendingRequests.isEmpty()) {
         if (!document.page()->canStartMedia()) {
             m_blockedUserMediaRequests.add(&document, pendingRequests);
-            document.addMediaCanStartListener(this);
+            document.addMediaCanStartListener(*this);
             break;
         }
 
@@ -139,7 +139,7 @@ void UserMediaPermissionRequestManager::removeMediaRequestFromMaps(UserMediaRequ
             continue;
 
         if (pendingRequests.isEmpty())
-            request.document()->removeMediaCanStartListener(this);
+            request.document()->removeMediaCanStartListener(*this);
         else
             m_blockedUserMediaRequests.add(document, pendingRequests);
         break;
index 678548c..173fd89 100644 (file)
@@ -321,9 +321,9 @@ PluginView::~PluginView()
     ASSERT(!m_plugin || !m_plugin->isBeingDestroyed());
 
     if (m_isWaitingUntilMediaCanStart)
-        m_pluginElement->document().removeMediaCanStartListener(this);
+        m_pluginElement->document().removeMediaCanStartListener(*this);
 
-    m_pluginElement->document().removeAudioProducer(this);
+    m_pluginElement->document().removeAudioProducer(*this);
 
     destroyPluginAndReset();
 
@@ -591,13 +591,13 @@ void PluginView::initializePlugin()
                     return;
                 
                 m_isWaitingUntilMediaCanStart = true;
-                m_pluginElement->document().addMediaCanStartListener(this);
+                m_pluginElement->document().addMediaCanStartListener(*this);
                 return;
             }
         }
     }
 
-    m_pluginElement->document().addAudioProducer(this);
+    m_pluginElement->document().addAudioProducer(*this);
 
 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
     HTMLPlugInImageElement& plugInImageElement = downcast<HTMLPlugInImageElement>(*m_pluginElement);
index 1b4bbf7..9a77fd3 100644 (file)
@@ -1,3 +1,12 @@
+2019-01-15  Darin Adler  <darin@apple.com>
+
+        Use references rather than pointers for register/unregister functions, and more
+        https://bugs.webkit.org/show_bug.cgi?id=175028
+
+        Reviewed by Daniel Bates.
+
+        * WebKitLegacy.xcodeproj/project.pbxproj: Let Xcode update this project.
+
 2019-01-18  Eric Carlson  <eric.carlson@apple.com>
 
         Revert r238815, it broke WK1 video fullscreen on Mac
index 575e204..9887de2 100644 (file)
@@ -1,3 +1,24 @@
+2019-01-15  Darin Adler  <darin@apple.com>
+
+        Use references rather than pointers for register/unregister functions, and more
+        https://bugs.webkit.org/show_bug.cgi?id=175028
+
+        Reviewed by Daniel Bates.
+
+        * WebCoreSupport/WebKitFullScreenListener.mm:
+        (-[WebKitFullScreenListener webkitWillEnterFullScreen]): Update for change to the
+        functions in Document; pass a reference.
+        (-[WebKitFullScreenListener webkitDidEnterFullScreen]): Ditto, don't pass the element.
+        (-[WebKitFullScreenListener webkitWillExitFullScreen]): Ditto.
+        (-[WebKitFullScreenListener webkitDidExitFullScreen]): Ditto.
+        * WebView/WebFullScreenController.mm:
+        (-[WebFullScreenController enterFullScreen:]): Ditto.
+        (-[WebFullScreenController finishedEnterFullScreenAnimation:]): Ditto.
+        (-[WebFullScreenController exitFullScreen]): Ditto.
+        (-[WebFullScreenController finishedExitFullScreenAnimation:]): Ditto.
+        * WebView/WebFullScreenController.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:]): Pass a reference.
+
 2019-01-12  Dan Bernstein  <mitz@apple.com>
 
         [Cocoa] Avoid importing directly from subumbrella frameworks
index af5ac2f..537cc66 100644 (file)
@@ -45,25 +45,25 @@ using namespace WebCore;
 - (void)webkitWillEnterFullScreen
 {
     if (_element)
-        _element->document().webkitWillEnterFullScreenForElement(_element.get());
+        _element->document().webkitWillEnterFullScreen(*_element);
 }
 
 - (void)webkitDidEnterFullScreen
 {
     if (_element)
-        _element->document().webkitDidEnterFullScreenForElement(_element.get());
+        _element->document().webkitDidEnterFullScreen();
 }
 
 - (void)webkitWillExitFullScreen
 {
     if (_element)
-        _element->document().webkitWillExitFullScreenForElement(_element.get());
+        _element->document().webkitWillExitFullScreen();
 }
 
 - (void)webkitDidExitFullScreen
 {
     if (_element)
-        _element->document().webkitDidExitFullScreenForElement(_element.get());
+        _element->document().webkitDidExitFullScreen();
 }
 
 @end
index d4dac54..89bfa70 100644 (file)
@@ -237,7 +237,7 @@ static NSRect convertRectToScreen(NSWindow *window, NSRect rect)
 
     _savedScale = [_webView _viewScaleFactor];
     [_webView _scaleWebView:1 atOrigin:NSMakePoint(0, 0)];
-    [self _document]->webkitWillEnterFullScreenForElement(_element.get());
+    [self _document]->webkitWillEnterFullScreen(*_element);
     [self _document]->setAnimatingFullScreen(true);
     [self _document]->updateLayout();
 
@@ -272,7 +272,7 @@ static void setClipRectForWindow(NSWindow *window, NSRect clipRect)
         NSDisableScreenUpdates();
         ALLOW_DEPRECATED_DECLARATIONS_END
         [self _document]->setAnimatingFullScreen(false);
-        [self _document]->webkitDidEnterFullScreenForElement(_element.get());
+        [self _document]->webkitDidEnterFullScreen();
         
         NSRect windowBounds = [[self window] frame];
         windowBounds.origin = NSZeroPoint;
@@ -320,7 +320,7 @@ static void setClipRectForWindow(NSWindow *window, NSRect clipRect)
 
     _finalFrame = screenRectOfContents(_element.get());
 
-    [self _document]->webkitWillExitFullScreenForElement(_element.get());
+    [self _document]->webkitWillExitFullScreen();
     [self _document]->setAnimatingFullScreen(true);
 
     if (_isEnteringFullScreen)
@@ -362,7 +362,7 @@ static void setClipRectForWindow(NSWindow *window, NSRect clipRect)
     ALLOW_DEPRECATED_DECLARATIONS_END
 
     [self _document]->setAnimatingFullScreen(false);
-    [self _document]->webkitDidExitFullScreenForElement(_element.get());
+    [self _document]->webkitDidExitFullScreen();
     [_webView _scaleWebView:_savedScale atOrigin:NSMakePoint(0, 0)];
 
     NSResponder *firstResponder = [[self window] firstResponder];
index 9dde7dd..2de03ac 100644 (file)
@@ -1482,10 +1482,8 @@ static void WebKitInitializeGamepadProviderIfNecessary()
 #if ENABLE(NOTIFICATIONS)
     WebCore::provideNotification(_private->page, new WebNotificationClient(self));
 #endif
-#if ENABLE(DEVICE_ORIENTATION)
-#if !PLATFORM(IOS_FAMILY)
-    WebCore::provideDeviceOrientationTo(_private->page, new WebDeviceOrientationClient(self));
-#endif
+#if ENABLE(DEVICE_ORIENTATION) && !PLATFORM(IOS_FAMILY)
+    WebCore::provideDeviceOrientationTo(*_private->page, *new WebDeviceOrientationClient(self));
 #endif
 
 #if ENABLE(REMOTE_INSPECTOR)
index 3acb67f..15c71d7 100644 (file)
@@ -1,3 +1,18 @@
+2019-01-15  Darin Adler  <darin@apple.com>
+
+      &