Replace some stack raw pointers with RefPtrs within WebCore/html
authorjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Oct 2017 01:01:21 +0000 (01:01 +0000)
committerjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Oct 2017 01:01:21 +0000 (01:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=178201
<rdar://problem/34841692>

Reviewed by Ryosuke Niwa.

Source/WebCore:

This is an effort to reduce raw pointer usage in DOM code. In this patch, raw pointers
that are ref countable are blindly selected to be replaced with RefPtrs with one exception
which is auto*.

Also, this patch occasionally modifies the return type of some methods, and therefore callers
of those methods are modified accordingly.

* Modules/encryptedmedia/legacy/LegacyCDM.cpp:
(WebCore::LegacyCDM::mediaPlayer const):
* Modules/encryptedmedia/legacy/LegacyCDM.h:
* Modules/encryptedmedia/legacy/LegacyCDMPrivateMediaPlayer.cpp:
(WebCore::CDMPrivateMediaPlayer::createSession):
* Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp:
(WebCore::WebKitMediaKeys::cdmMediaPlayer const):
* Modules/encryptedmedia/legacy/WebKitMediaKeys.h:
* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::externalDeviceDisplayName const):
(WebCore::MediaControlsHost::externalDeviceType const):
* dom/Element.cpp:
(WebCore::Element::focusDelegate):
(WebCore::Element::userAgentShadowRoot const):
(WebCore::Element::ensureUserAgentShadowRoot):
* dom/Element.h:
* dom/EventContext.cpp:
(WebCore::TouchEventContext::checkReachability const):
* dom/EventPath.cpp:
(WebCore::shouldEventCrossShadowBoundary):
(WebCore::EventPath::setRelatedTarget):
(WebCore::EventPath::retargetTouch):
(WebCore:: const):
* dom/EventTarget.cpp:
(WebCore::EventTarget::toNode):
(WebCore::EventTarget::addEventListener):
* dom/EventTarget.h:
* dom/MouseEvent.cpp:
(WebCore::MouseEvent::toElement const):
(WebCore::MouseEvent::fromElement const):
* dom/MouseEvent.h:
* dom/MouseRelatedEvent.cpp:
(WebCore::MouseRelatedEvent::computeRelativePosition):
* dom/Node.cpp:
(WebCore::Node::toNode):
* dom/Node.h:
* dom/ScopedEventQueue.cpp:
* editing/Editor.cpp:
(WebCore::Editor::selectionForCommand):
* editing/EditorCommand.cpp:
(WebCore::targetFrame):
* editing/TextIterator.cpp:
(WebCore::TextIterator::handleReplacedElement):
* html/BaseChooserOnlyDateAndTimeInputType.cpp:
(WebCore::BaseChooserOnlyDateAndTimeInputType::updateAppearance):
* html/ColorInputType.cpp:
(WebCore::ColorInputType::updateColorSwatch):
(WebCore::ColorInputType::shadowColorSwatch const):
* html/FileInputType.cpp:
(WebCore::FileInputType::disabledAttributeChanged):
(WebCore::FileInputType::multipleAttributeChanged):
* html/FormAssociatedElement.cpp:
(WebCore::FormAssociatedElement::findAssociatedForm):
(WebCore::FormAssociatedElement::formOwnerRemovedFromTree):
(WebCore::FormAssociatedElement::resetFormOwner):
(WebCore::FormAssociatedElement::formAttributeChanged):
* html/FormController.cpp:
(WebCore::recordFormStructure):
(WebCore::FormKeyGenerator::formKey):
(WebCore::FormController::restoreControlStateIn):
* html/HTMLAnchorElement.cpp:
(WebCore::appendServerMapMousePosition):
(WebCore::HTMLAnchorElement::handleClick):
* html/HTMLAppletElement.cpp:
(WebCore::HTMLAppletElement::updateWidget):
* html/HTMLAreaElement.cpp:
(WebCore::HTMLAreaElement::imageElement const):
(WebCore::HTMLAreaElement::isFocusable const):
(WebCore::HTMLAreaElement::setFocus):
(WebCore::HTMLAreaElement::updateFocusAppearance):
* html/HTMLBodyElement.cpp:
(WebCore::HTMLBodyElement::scrollLeft):
(WebCore::HTMLBodyElement::setScrollLeft):
(WebCore::HTMLBodyElement::scrollTop):
(WebCore::HTMLBodyElement::setScrollTop):
(WebCore::HTMLBodyElement::scrollHeight):
(WebCore::HTMLBodyElement::scrollWidth):
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::createElementRenderer):
(WebCore:: const):
* html/HTMLDocument.cpp:
(WebCore::HTMLDocument::width):
(WebCore::HTMLDocument::height):
* html/HTMLElement.cpp:
(WebCore::HTMLElement::rendererIsNeeded):
(WebCore::setHasDirAutoFlagRecursively):
(WebCore::HTMLElement::directionality const):
(WebCore::HTMLElement::dirAttributeChanged):
(WebCore::HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged):
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::renderWidgetLoadingPlugin const):
(WebCore::HTMLEmbedElement::rendererIsNeeded):
* html/HTMLFieldSetElement.cpp:
(WebCore::updateFromControlElementsAncestorDisabledStateUnder):
(WebCore::HTMLFieldSetElement::disabledStateChanged):
(WebCore::HTMLFieldSetElement::childrenChanged):
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::computeIsDisabledByFieldsetAncestor const):
(WebCore::HTMLFormControlElement::setNeedsWillValidateCheck):
(WebCore::HTMLFormControlElement::didChangeForm):
(WebCore::HTMLFormControlElement::shouldAutocorrect const):
(WebCore::HTMLFormControlElement::autocapitalizeType const):
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::handleLocalEvents):
(WebCore::submitElementFromEvent):
(WebCore::HTMLFormElement::prepareForSubmission):
(WebCore::HTMLFormElement::submit):
(WebCore::HTMLFormElement::reset):
(WebCore::HTMLFormElement::shouldAutocorrect const):
(WebCore::HTMLFormElement::parseAttribute):
(WebCore::HTMLFormElement::resetDefaultButton):
(WebCore::HTMLFormElement::elementFromPastNamesMap const):
(WebCore::HTMLFormElement::namedElements):
* html/HTMLFormElement.h:
* html/HTMLFrameElement.cpp:
(WebCore::HTMLFrameElement::didAttachRenderers):
* html/HTMLFrameElementBase.cpp:
(WebCore::HTMLFrameElementBase::isURLAllowed const):
(WebCore::HTMLFrameElementBase::openURL):
(WebCore::HTMLFrameElementBase::didAttachRenderers):
* html/HTMLFrameOwnerElement.cpp:
(WebCore::HTMLFrameOwnerElement::setContentFrame):
(WebCore::HTMLFrameOwnerElement::clearContentFrame):
(WebCore::HTMLFrameOwnerElement::disconnectContentFrame):
(WebCore::SubframeLoadingDisabler::canLoadFrame):
* html/HTMLFrameSetElement.cpp:
(WebCore::HTMLFrameSetElement::findContaining):
(WebCore::HTMLFrameSetElement::willAttachRenderers):
(WebCore::HTMLFrameSetElement::insertedInto):
(WebCore::HTMLFrameSetElement::removedFrom):
* html/HTMLFrameSetElement.h:
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
(WebCore::HTMLImageElement::pictureElement const):
(WebCore::HTMLImageElement::destroyImageControls):
(WebCore::HTMLImageElement::hasImageControls const):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::innerTextElement const):
(WebCore::HTMLInputElement::endEditing):
(WebCore::HTMLInputElement::dataList const):
(WebCore::HTMLInputElement::resetListAttributeTargetObserver): Deleted.
(WebCore::HTMLInputElement::listAttributeTargetChanged): Deleted.
(WebCore::HTMLInputElement::isSteppable const): Deleted.
(WebCore::HTMLInputElement::dateType const): Deleted.
(WebCore::HTMLInputElement::isTextButton const): Deleted.
(WebCore::HTMLInputElement::isRadioButton const): Deleted.
(WebCore::HTMLInputElement::isSearchField const): Deleted.
(WebCore::HTMLInputElement::isInputTypeHidden const): Deleted.
(WebCore::HTMLInputElement::isPasswordField const): Deleted.
(WebCore::HTMLInputElement::isCheckbox const): Deleted.
(WebCore::HTMLInputElement::isRangeControl const): Deleted.
(WebCore::HTMLInputElement::isColorControl const): Deleted.
(WebCore::HTMLInputElement::isText const): Deleted.
(WebCore::HTMLInputElement::isEmailField const): Deleted.
(WebCore::HTMLInputElement::isFileUpload const): Deleted.
(WebCore::HTMLInputElement::isImageButton const): Deleted.
(WebCore::HTMLInputElement::isNumberField const): Deleted.
(WebCore::HTMLInputElement::isSubmitButton const): Deleted.
(WebCore::HTMLInputElement::isTelephoneField const): Deleted.
(WebCore::HTMLInputElement::isURLField const): Deleted.
(WebCore::HTMLInputElement::isDateField const): Deleted.
(WebCore::HTMLInputElement::isDateTimeField const): Deleted.
(WebCore::HTMLInputElement::isDateTimeLocalField const): Deleted.
(WebCore::HTMLInputElement::isMonthField const): Deleted.
(WebCore::HTMLInputElement::isTimeField const): Deleted.
(WebCore::HTMLInputElement::isWeekField const): Deleted.
(WebCore::HTMLInputElement::isEnumeratable const): Deleted.
(WebCore::HTMLInputElement::supportLabels const): Deleted.
(WebCore::HTMLInputElement::shouldAppearChecked const): Deleted.
(WebCore::HTMLInputElement::supportsPlaceholder const): Deleted.
(WebCore::HTMLInputElement::updatePlaceholderText): Deleted.
(WebCore::HTMLInputElement::isEmptyValue const): Deleted.
(WebCore::HTMLInputElement::maxLengthAttributeChanged): Deleted.
(WebCore::HTMLInputElement::minLengthAttributeChanged): Deleted.
(WebCore::HTMLInputElement::updateValueIfNeeded): Deleted.
(WebCore::HTMLInputElement::defaultToolTip const): Deleted.
(WebCore::HTMLInputElement::matchesIndeterminatePseudoClass const): Deleted.
(WebCore::HTMLInputElement::shouldAppearIndeterminate const): Deleted.
(WebCore::HTMLInputElement::mediaCaptureType const): Deleted.
(WebCore::HTMLInputElement::isInRequiredRadioButtonGroup): Deleted.
(WebCore:: const): Deleted.
(WebCore::HTMLInputElement::checkedRadioButtonForGroup const): Deleted.
(WebCore::HTMLInputElement::radioButtonGroups const): Deleted.
(WebCore::HTMLInputElement::addToRadioButtonGroup): Deleted.
(WebCore::HTMLInputElement::removeFromRadioButtonGroup): Deleted.
(WebCore::HTMLInputElement::height const): Deleted.
(WebCore::HTMLInputElement::width const): Deleted.
(WebCore::HTMLInputElement::setHeight): Deleted.
(WebCore::HTMLInputElement::setWidth): Deleted.
(WebCore::ListAttributeTargetObserver::ListAttributeTargetObserver): Deleted.
(WebCore::ListAttributeTargetObserver::idTargetChanged): Deleted.
(WebCore::HTMLInputElement::setRangeText): Deleted.
(WebCore::HTMLInputElement::shouldTruncateText const): Deleted.
(WebCore::HTMLInputElement::selectionStartForBindings const): Deleted.
(WebCore::HTMLInputElement::setSelectionStartForBindings): Deleted.
(WebCore::HTMLInputElement::selectionEndForBindings const): Deleted.
(WebCore::HTMLInputElement::setSelectionEndForBindings): Deleted.
(WebCore::HTMLInputElement::selectionDirectionForBindings const): Deleted.
(WebCore::HTMLInputElement::setSelectionDirectionForBindings): Deleted.
(WebCore::HTMLInputElement::setSelectionRangeForBindings): Deleted.
(WebCore::HTMLInputElement::createInnerTextStyle const): Deleted.
(WebCore::HTMLInputElement::setupDateTimeChooserParameters): Deleted.
(WebCore::HTMLInputElement::capsLockStateMayHaveChanged): Deleted.
* html/HTMLInputElement.h:
* html/HTMLKeygenElement.cpp:
(WebCore::HTMLKeygenElement::shadowSelect const):
* html/HTMLLabelElement.cpp:
(WebCore::HTMLLabelElement::defaultEventHandler):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::handleClick):
* html/HTMLMapElement.cpp:
(WebCore::HTMLMapElement::mapMouseEvent):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::selectMediaResource):
(WebCore::HTMLMediaElement::loadResource):
(WebCore::HTMLMediaElement::updateActiveTextTrackCues):
(WebCore::HTMLMediaElement::isSafeToLoadURL):
(WebCore::HTMLMediaElement::controls const):
(WebCore::HTMLMediaElement::layoutSizeChanged):
(WebCore::HTMLMediaElement::enterFullscreen):
(WebCore::HTMLMediaElement::mediaControls const):
(WebCore::HTMLMediaElement::hasMediaControls const):
(WebCore::HTMLMediaElement::mediaPlayerReferrer const):
(WebCore::HTMLMediaElement::mediaPlayerUserAgent const):
(WebCore::HTMLMediaElement::mediaPlayerShouldWaitForResponseToAuthenticationChallenge):
(WebCore::HTMLMediaElement::sourceApplicationIdentifier const):
(WebCore::HTMLMediaElement::getVideoPlaybackQuality):
(WebCore::HTMLMediaElement::session const):
* html/HTMLMediaElement.h:
(WebCore::HTMLMediaElement::player const):
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::hasFallbackContent const):
* html/HTMLOptGroupElement.cpp:
(WebCore::HTMLOptGroupElement::ownerSelectElement const):
(WebCore::HTMLOptGroupElement::accessKeyAction):
* html/HTMLOptionElement.cpp:
(WebCore::HTMLOptionElement::setText):
(WebCore::HTMLOptionElement::accessKeyAction):
(WebCore::HTMLOptionElement::index const):
(WebCore::HTMLOptionElement::parseAttribute):
(WebCore::HTMLOptionElement::selected):
(WebCore::HTMLOptionElement::setSelected):
(WebCore::HTMLOptionElement::setSelectedState):
(WebCore::HTMLOptionElement::childrenChanged):
(WebCore::HTMLOptionElement::ownerDataListElement const):
(WebCore::HTMLOptionElement::ownerSelectElement const):
(WebCore::HTMLOptionElement::textIndentedToRespectGroupLabel const):
(WebCore::HTMLOptionElement::insertedInto):
(WebCore::HTMLOptionElement::collectOptionInnerText const):
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::willDetachRenderers):
(WebCore::HTMLPlugInElement::isKeyboardFocusable const):
(WebCore::HTMLPlugInElement::isUserObservable const):
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::partOfSnapshotOverlay const):
(WebCore::HTMLPlugInImageElement::restartSimilarPlugIns):
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::add):
(WebCore::HTMLSelectElement::recalcListItems const):
(WebCore::HTMLSelectElement::selectOption):
(WebCore::HTMLSelectElement::reset):
(WebCore::HTMLSelectElement::listBoxDefaultEventHandler):
* html/HTMLSlotElement.cpp:
(WebCore::flattenAssignedNodes):
* html/HTMLSourceElement.cpp:
(WebCore::HTMLSourceElement::removedFrom):
* html/HTMLSummaryElement.cpp:
(WebCore::HTMLSummaryElement::isActiveSummary const):
(WebCore::isClickableControl):
(WebCore::HTMLSummaryElement::defaultEventHandler):
* html/HTMLTableCellElement.cpp:
(WebCore::HTMLTableCellElement::additionalPresentationAttributeStyle const):
* html/HTMLTableColElement.cpp:
(WebCore::HTMLTableColElement::additionalPresentationAttributeStyle const):
* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::tHead const):
(WebCore::HTMLTableElement::setTHead):
(WebCore::HTMLTableElement::tFoot const):
(WebCore::HTMLTableElement::createTBody):
(WebCore::HTMLTableElement::lastBody const):
(WebCore::HTMLTableElement::deleteRow):
* html/HTMLTablePartElement.cpp:
(WebCore::HTMLTablePartElement::findParentTable const):
* html/HTMLTableRowsCollection.cpp:
(WebCore::HTMLTableRowsCollection::rowAfter):
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::subtreeHasChanged):
(WebCore::HTMLTextAreaElement::innerTextElement const):
* html/HTMLTextAreaElement.h:
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::setSelectionRange):
(WebCore::HTMLTextFormControlElement::indexForVisiblePosition const):
(WebCore::HTMLTextFormControlElement::visiblePositionForIndex const):
(WebCore::HTMLTextFormControlElement::computeSelectionStart const):
(WebCore::HTMLTextFormControlElement::computeSelectionEnd const):
(WebCore::HTMLTextFormControlElement::computeSelectionDirection const):
(WebCore::HTMLTextFormControlElement::selection const):
(WebCore::HTMLTextFormControlElement::updateInnerTextElementEditability):
(WebCore::innerTextValueFrom):
(WebCore::HTMLTextFormControlElement::setInnerTextValue):
(WebCore::HTMLTextFormControlElement::innerTextValue const):
(WebCore::positionForIndex):
(WebCore::HTMLTextFormControlElement::indexForPosition const):
(WebCore::HTMLTextFormControlElement::hidePlaceholder):
(WebCore::HTMLTextFormControlElement::showPlaceholderIfNecessary):
(WebCore::HTMLTextFormControlElement::valueWithHardLineBreaks const):
(WebCore::enclosingTextFormControl):
(WebCore::HTMLTextFormControlElement::adjustInnerTextStyle const):
* html/HTMLTextFormControlElement.h:
* html/HTMLTrackElement.cpp:
(WebCore::HTMLTrackElement::canLoadURL):
(WebCore::HTMLTrackElement::setReadyState):
(WebCore::HTMLTrackElement::mediaElementCrossOriginAttribute const):
(WebCore::HTMLTrackElement::textTrackKindChanged):
(WebCore::HTMLTrackElement::textTrackModeChanged):
(WebCore::HTMLTrackElement::textTrackAddCues):
(WebCore::HTMLTrackElement::textTrackRemoveCues):
(WebCore::HTMLTrackElement::textTrackAddCue):
(WebCore::HTMLTrackElement::textTrackRemoveCue):
(WebCore::HTMLTrackElement::mediaElement const):
* html/HTMLTrackElement.h:
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::setDisplayMode):
(WebCore::HTMLVideoElement::paintCurrentFrameInContext):
* html/ImageDocument.cpp:
(WebCore::ImageDocument::createDocumentStructure):
(WebCore::ImageDocument::scale):
(WebCore::ImageDocument::imageFitsInWindow):
* html/InputType.cpp:
(WebCore::InputType::destroyShadowSubtree):
* html/InputType.h:
(WebCore::InputType::innerTextElement const):
* html/MediaDocument.cpp:
(WebCore::MediaDocumentParser::createDocumentStructure):
(WebCore::MediaDocument::defaultEventHandler):
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::wirelessVideoPlaybackDisabled const):
(WebCore::MediaElementSession::setWirelessVideoPlaybackDisabled):
(WebCore::isMainContentForPurposesOfAutoplay):
* html/NumberInputType.cpp:
(WebCore::NumberInputType::decorationWidth const):
* html/PluginDocument.cpp:
(WebCore::PluginDocumentParser::appendBytes):
* html/RadioInputType.cpp:
(WebCore::RadioInputType::handleKeydownEvent):
(WebCore::RadioInputType::isKeyboardFocusable const):
(WebCore::RadioInputType::didDispatchClick):
* html/RadioNodeList.cpp:
(WebCore::RadioNodeList::checkElementMatchesRadioNodeListFilter const):
* html/RangeInputType.cpp:
(WebCore::RangeInputType::handleMouseDownEvent):
(WebCore::RangeInputType::handleTouchEvent):
(WebCore::RangeInputType::sliderTrackElement const):
(WebCore::RangeInputType::listAttributeTargetChanged):
(WebCore::RangeInputType::updateTickMarkValues):
* html/SearchInputType.cpp:
(WebCore::SearchInputType::createShadowSubtree):
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::isEmptyValue const):
(WebCore::TextFieldInputType::handleKeydownEvent):
(WebCore::TextFieldInputType::handleFocusEvent):
(WebCore::TextFieldInputType::innerTextElement const):
(WebCore::TextFieldInputType::updatePlaceholderText):
(WebCore::TextFieldInputType::didSetValueByUserEdit):
(WebCore::TextFieldInputType::shouldDrawCapsLockIndicator const):
* html/TextFieldInputType.h:
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::size):
(WebCore::CanvasRenderingContext2D::drawImage):
* html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::copyBufferSubData):
(WebCore::WebGL2RenderingContext::getBufferSubData):
* html/canvas/WebGLFramebuffer.cpp:
(WebCore::WebGLFramebuffer::attach):
(WebCore::WebGLFramebuffer::getAttachmentObject const):
(WebCore::WebGLFramebuffer::removeAttachmentFromBoundFramebuffer):
(WebCore::WebGLFramebuffer::getColorBufferWidth const):
(WebCore::WebGLFramebuffer::getColorBufferHeight const):
(WebCore::WebGLFramebuffer::getColorBufferFormat const):
(WebCore::WebGLFramebuffer::checkStatus const):
(WebCore::WebGLFramebuffer::hasStencilBuffer const):
(WebCore::WebGLFramebuffer::initializeAttachments):
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter):
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::create):
(WebCore::WebGLRenderingContextBase::bufferData):
(WebCore::WebGLRenderingContextBase::bufferSubData):
(WebCore::WebGLRenderingContextBase::compressedTexImage2D):
(WebCore::WebGLRenderingContextBase::compressedTexSubImage2D):
(WebCore::WebGLRenderingContextBase::copyTexSubImage2D):
(WebCore::WebGLRenderingContextBase::generateMipmap):
(WebCore::WebGLRenderingContextBase::getAttachedShaders):
(WebCore::WebGLRenderingContextBase::getTexParameter):
(WebCore::WebGLRenderingContextBase::linkProgramWithoutInvalidatingAttribLocations):
(WebCore::WebGLRenderingContextBase::texImage2DBase):
(WebCore::WebGLRenderingContextBase::validateTexFunc):
(WebCore::WebGLRenderingContextBase::texSubImage2D):
(WebCore::WebGLRenderingContextBase::texSubImage2DBase):
(WebCore::WebGLRenderingContextBase::copyTexImage2D):
(WebCore::WebGLRenderingContextBase::texImage2D):
(WebCore::WebGLRenderingContextBase::texParameter):
(WebCore::WebGLRenderingContextBase::loseContextImpl):
(WebCore::WebGLRenderingContextBase::checkTextureCompleteness):
(WebCore::WebGLRenderingContextBase::validateTextureBinding):
(WebCore::WebGLRenderingContextBase::maybeRestoreContext):
* html/canvas/WebGPURenderPassColorAttachmentDescriptor.cpp:
(WebCore::WebGPURenderPassColorAttachmentDescriptor::clearColor const):
(WebCore::WebGPURenderPassColorAttachmentDescriptor::setClearColor):
* html/canvas/WebGPURenderPassDepthAttachmentDescriptor.cpp:
(WebCore::WebGPURenderPassDepthAttachmentDescriptor::clearDepth const):
(WebCore::WebGPURenderPassDepthAttachmentDescriptor::setClearDepth):
* html/parser/HTMLConstructionSite.cpp:
(WebCore::executeInsertAlreadyParsedChildTask):
(WebCore::HTMLConstructionSite::insertTextNode):
* html/parser/HTMLFormattingElementList.cpp:
(WebCore::HTMLFormattingElementList::tryToEnsureNoahsArkConditionQuickly):
* html/parser/HTMLParserOptions.cpp:
(WebCore::HTMLParserOptions::HTMLParserOptions):
* html/parser/HTMLParserScheduler.cpp:
(WebCore::HTMLParserScheduler::shouldYieldBeforeExecutingScript):
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::processStartTagForInBody):
(WebCore::HTMLTreeBuilder::callTheAdoptionAgency):
(WebCore::HTMLTreeBuilder::resetInsertionModeAppropriately):
* html/parser/XSSAuditor.cpp:
(WebCore::XSSAuditor::init):
* html/shadow/MediaControlElementTypes.cpp:
(WebCore::parentMediaElement):
* html/shadow/MediaControlElementTypes.h:
(WebCore::parentMediaElement):
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlPanelElement::startDrag):
(WebCore::MediaControlPanelElement::endDrag):
(WebCore::MediaControlVolumeSliderContainerElement::defaultEventHandler):
(WebCore::MediaControlClosedCaptionsTrackListElement::defaultEventHandler):
(WebCore::MediaControlClosedCaptionsTrackListElement::updateDisplay):
(WebCore::MediaControlClosedCaptionsTrackListElement::rebuildTrackListMenu):
(WebCore::MediaControlFullscreenButtonElement::defaultEventHandler):
(WebCore::MediaControlTextTrackContainerElement::updateDisplay):
(WebCore::MediaControlTextTrackContainerElement::updateActiveCuesFontSize):
(WebCore::MediaControlTextTrackContainerElement::updateTextStrokeStyle):
(WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation):
(WebCore::MediaControlTextTrackContainerElement::clearTextTrackRepresentation):
(WebCore::MediaControlTextTrackContainerElement::updateSizes):
(WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage):
* html/shadow/MediaControls.cpp:
(WebCore::MediaControls::containsRelatedTarget):
* html/shadow/SliderThumbElement.cpp:
(WebCore::SliderThumbElement::isDisabledFormControl const):
(WebCore::SliderThumbElement::matchesReadWritePseudoClass const):
(WebCore::SliderThumbElement::focusDelegate):
(WebCore::SliderThumbElement::setPositionFromPoint):
(WebCore::SliderThumbElement::startDragging):
(WebCore::SliderThumbElement::stopDragging):
(WebCore::SliderThumbElement::defaultEventHandler):
(WebCore::SliderThumbElement::willRespondToMouseMoveEvents):
(WebCore::SliderThumbElement::willRespondToMouseClickEvents):
(WebCore::SliderThumbElement::willDetachRenderers):
(WebCore::findTouchWithIdentifier):
(WebCore::SliderThumbElement::handleTouchStart):
(WebCore::SliderThumbElement::handleTouchMove):
(WebCore::SliderThumbElement::handleTouchEndAndCancel):
(WebCore::SliderThumbElement::handleTouchEvent):
(WebCore::SliderThumbElement::hostInput const):
* html/shadow/SliderThumbElement.h:
* html/shadow/SpinButtonElement.cpp:
(WebCore::SpinButtonElement::defaultEventHandler):
(WebCore::SpinButtonElement::releaseCapture):
* html/shadow/TextControlInnerElements.cpp:
(WebCore::TextControlInnerTextElement::defaultEventHandler):
(WebCore::SearchFieldCancelButtonElement::willRespondToMouseClickEvents):
* html/shadow/mac/ImageControlsButtonElementMac.cpp:
(WebCore::ImageControlsButtonElementMac::defaultEventHandler):
* html/track/LoadableTextTrack.cpp:
(WebCore::LoadableTextTrack::trackElementIndex):
* html/track/TextTrack.cpp:
(WebCore::TextTrack::setMode):
(WebCore::TextTrack::hasCue):
* html/track/TextTrackCueGeneric.cpp:
(WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
* html/track/VTTCue.cpp:
(WebCore::VTTCue::copyWebVTTNodeToDOMTree):
(WebCore::VTTCue::determineTextDirection):
(WebCore::VTTCue::markFutureAndPastNodes):
(WebCore::VTTCue::removeDisplayTree):
(WebCore::VTTCue::cueContentsMatch const):
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::didAddEventListener):
(WebCore::InspectorDOMAgent::willRemoveEventListener):
* loader/FormSubmission.cpp:
(WebCore::FormSubmission::create):
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::maybeCreateContextMenu):
* rendering/RenderSnapshottedPlugIn.cpp:
(WebCore::RenderSnapshottedPlugIn::handleEvent):
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::innerTextElement const):
(WebCore::RenderTextControl::styleDidChange):
(WebCore::RenderTextControl::textBlockLogicalWidth const):
(WebCore::RenderTextControl::computeLogicalHeight const):
(WebCore::RenderTextControl::hitInnerTextElement):
(WebCore::RenderTextControl::canScroll const):
(WebCore::RenderTextControl::innerLineHeight const):
* rendering/RenderTextControl.h:
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::nodeAtPoint):
(WebCore::RenderTextControlSingleLine::styleDidChange):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::isFocused const):
* rendering/RenderThemeGtk.cpp:
(WebCore::RenderThemeGtk::paintMediaSliderTrack):
(WebCore::RenderThemeGtk::paintMediaVolumeSliderTrack):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintSliderThumb):
* rendering/RenderVideo.cpp:
(WebCore::RenderVideo::willBeDestroyed):
(WebCore::RenderVideo::calculateIntrinsicSize):
(WebCore::RenderVideo::paintReplaced):
(WebCore::RenderVideo::updatePlayer):
(WebCore::RenderVideo::supportsAcceleratedRendering const):
(WebCore::RenderVideo::acceleratedRenderingStateChanged):
(WebCore::RenderVideo::requiresImmediateCompositing const):
(WebCore::RenderVideo::foregroundIsKnownToBeOpaqueInRect const):
* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::clearShadowTree):
(WebCore::SVGUseElement::targetClone const):

Source/WebKit:

Change the type of node as toNode() is changed to return RefPtr.

* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivate.cpp:
(WebKit::wrap):
* WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
(WebKit::WebEditorClient::handleKeyboardEvent):
* WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp:
(WebKit::WebEditorClient::handleKeyboardEvent):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::handleEditingKeyboardEvent):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::frameForEvent):

Source/WebKitLegacy/mac:

* DOM/DOM.mm:
(kit):
Change the type of node as toNode() is changed to return RefPtr.

Source/WebKitLegacy/win:

* WebView.cpp:
(WebView::handleEditingKeyboardEvent):
Change the type of node as toNode() is changed to return RefPtr.

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

135 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/encryptedmedia/legacy/LegacyCDM.cpp
Source/WebCore/Modules/encryptedmedia/legacy/LegacyCDM.h
Source/WebCore/Modules/encryptedmedia/legacy/LegacyCDMPrivateMediaPlayer.cpp
Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp
Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeys.h
Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/EventContext.cpp
Source/WebCore/dom/EventPath.cpp
Source/WebCore/dom/EventTarget.cpp
Source/WebCore/dom/EventTarget.h
Source/WebCore/dom/MouseEvent.cpp
Source/WebCore/dom/MouseEvent.h
Source/WebCore/dom/MouseRelatedEvent.cpp
Source/WebCore/dom/Node.cpp
Source/WebCore/dom/Node.h
Source/WebCore/dom/ScopedEventQueue.cpp
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/EditorCommand.cpp
Source/WebCore/editing/TextIterator.cpp
Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.cpp
Source/WebCore/html/ColorInputType.cpp
Source/WebCore/html/FileInputType.cpp
Source/WebCore/html/FormAssociatedElement.cpp
Source/WebCore/html/FormController.cpp
Source/WebCore/html/HTMLAnchorElement.cpp
Source/WebCore/html/HTMLAppletElement.cpp
Source/WebCore/html/HTMLAreaElement.cpp
Source/WebCore/html/HTMLBodyElement.cpp
Source/WebCore/html/HTMLCanvasElement.cpp
Source/WebCore/html/HTMLDocument.cpp
Source/WebCore/html/HTMLElement.cpp
Source/WebCore/html/HTMLEmbedElement.cpp
Source/WebCore/html/HTMLFieldSetElement.cpp
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/HTMLFormElement.cpp
Source/WebCore/html/HTMLFormElement.h
Source/WebCore/html/HTMLFrameElement.cpp
Source/WebCore/html/HTMLFrameElementBase.cpp
Source/WebCore/html/HTMLFrameOwnerElement.cpp
Source/WebCore/html/HTMLFrameSetElement.cpp
Source/WebCore/html/HTMLFrameSetElement.h
Source/WebCore/html/HTMLImageElement.cpp
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLInputElement.h
Source/WebCore/html/HTMLKeygenElement.cpp
Source/WebCore/html/HTMLLabelElement.cpp
Source/WebCore/html/HTMLLinkElement.cpp
Source/WebCore/html/HTMLMapElement.cpp
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/HTMLObjectElement.cpp
Source/WebCore/html/HTMLOptGroupElement.cpp
Source/WebCore/html/HTMLOptionElement.cpp
Source/WebCore/html/HTMLPlugInElement.cpp
Source/WebCore/html/HTMLPlugInImageElement.cpp
Source/WebCore/html/HTMLSelectElement.cpp
Source/WebCore/html/HTMLSlotElement.cpp
Source/WebCore/html/HTMLSourceElement.cpp
Source/WebCore/html/HTMLSummaryElement.cpp
Source/WebCore/html/HTMLTableCellElement.cpp
Source/WebCore/html/HTMLTableColElement.cpp
Source/WebCore/html/HTMLTableElement.cpp
Source/WebCore/html/HTMLTablePartElement.cpp
Source/WebCore/html/HTMLTableRowsCollection.cpp
Source/WebCore/html/HTMLTextAreaElement.cpp
Source/WebCore/html/HTMLTextAreaElement.h
Source/WebCore/html/HTMLTextFormControlElement.cpp
Source/WebCore/html/HTMLTextFormControlElement.h
Source/WebCore/html/HTMLTrackElement.cpp
Source/WebCore/html/HTMLTrackElement.h
Source/WebCore/html/HTMLVideoElement.cpp
Source/WebCore/html/ImageDocument.cpp
Source/WebCore/html/InputType.cpp
Source/WebCore/html/InputType.h
Source/WebCore/html/MediaDocument.cpp
Source/WebCore/html/MediaElementSession.cpp
Source/WebCore/html/NumberInputType.cpp
Source/WebCore/html/PluginDocument.cpp
Source/WebCore/html/RadioInputType.cpp
Source/WebCore/html/RadioNodeList.cpp
Source/WebCore/html/RangeInputType.cpp
Source/WebCore/html/SearchInputType.cpp
Source/WebCore/html/TextFieldInputType.cpp
Source/WebCore/html/TextFieldInputType.h
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
Source/WebCore/html/canvas/WebGLFramebuffer.cpp
Source/WebCore/html/canvas/WebGLRenderingContext.cpp
Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
Source/WebCore/html/canvas/WebGPURenderPassColorAttachmentDescriptor.cpp
Source/WebCore/html/canvas/WebGPURenderPassDepthAttachmentDescriptor.cpp
Source/WebCore/html/parser/HTMLConstructionSite.cpp
Source/WebCore/html/parser/HTMLFormattingElementList.cpp
Source/WebCore/html/parser/HTMLParserOptions.cpp
Source/WebCore/html/parser/HTMLParserScheduler.cpp
Source/WebCore/html/parser/HTMLTreeBuilder.cpp
Source/WebCore/html/parser/XSSAuditor.cpp
Source/WebCore/html/shadow/MediaControlElementTypes.cpp
Source/WebCore/html/shadow/MediaControlElementTypes.h
Source/WebCore/html/shadow/MediaControlElements.cpp
Source/WebCore/html/shadow/MediaControls.cpp
Source/WebCore/html/shadow/SliderThumbElement.cpp
Source/WebCore/html/shadow/SliderThumbElement.h
Source/WebCore/html/shadow/SpinButtonElement.cpp
Source/WebCore/html/shadow/TextControlInnerElements.cpp
Source/WebCore/html/shadow/mac/ImageControlsButtonElementMac.cpp
Source/WebCore/html/track/LoadableTextTrack.cpp
Source/WebCore/html/track/TextTrack.cpp
Source/WebCore/html/track/TextTrackCueGeneric.cpp
Source/WebCore/html/track/VTTCue.cpp
Source/WebCore/inspector/InspectorDOMAgent.cpp
Source/WebCore/loader/FormSubmission.cpp
Source/WebCore/page/ContextMenuController.cpp
Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp
Source/WebCore/rendering/RenderTextControl.cpp
Source/WebCore/rendering/RenderTextControl.h
Source/WebCore/rendering/RenderTextControlSingleLine.cpp
Source/WebCore/rendering/RenderTheme.cpp
Source/WebCore/rendering/RenderThemeGtk.cpp
Source/WebCore/rendering/RenderThemeMac.mm
Source/WebCore/rendering/RenderVideo.cpp
Source/WebCore/svg/SVGUseElement.cpp
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivate.cpp
Source/WebKit/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp
Source/WebKit/WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/DOM/DOM.mm
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/WebView.cpp

index 36754cb..0a6b69a 100644 (file)
@@ -1,3 +1,546 @@
+2017-10-17  Jiewen Tan  <jiewen_tan@apple.com>
+
+        Replace some stack raw pointers with RefPtrs within WebCore/html
+        https://bugs.webkit.org/show_bug.cgi?id=178201
+        <rdar://problem/34841692>
+
+        Reviewed by Ryosuke Niwa.
+
+        This is an effort to reduce raw pointer usage in DOM code. In this patch, raw pointers
+        that are ref countable are blindly selected to be replaced with RefPtrs with one exception
+        which is auto*.
+
+        Also, this patch occasionally modifies the return type of some methods, and therefore callers
+        of those methods are modified accordingly.
+
+        * Modules/encryptedmedia/legacy/LegacyCDM.cpp:
+        (WebCore::LegacyCDM::mediaPlayer const):
+        * Modules/encryptedmedia/legacy/LegacyCDM.h:
+        * Modules/encryptedmedia/legacy/LegacyCDMPrivateMediaPlayer.cpp:
+        (WebCore::CDMPrivateMediaPlayer::createSession):
+        * Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp:
+        (WebCore::WebKitMediaKeys::cdmMediaPlayer const):
+        * Modules/encryptedmedia/legacy/WebKitMediaKeys.h:
+        * Modules/mediacontrols/MediaControlsHost.cpp:
+        (WebCore::MediaControlsHost::externalDeviceDisplayName const):
+        (WebCore::MediaControlsHost::externalDeviceType const):
+        * dom/Element.cpp:
+        (WebCore::Element::focusDelegate):
+        (WebCore::Element::userAgentShadowRoot const):
+        (WebCore::Element::ensureUserAgentShadowRoot):
+        * dom/Element.h:
+        * dom/EventContext.cpp:
+        (WebCore::TouchEventContext::checkReachability const):
+        * dom/EventPath.cpp:
+        (WebCore::shouldEventCrossShadowBoundary):
+        (WebCore::EventPath::setRelatedTarget):
+        (WebCore::EventPath::retargetTouch):
+        (WebCore:: const):
+        * dom/EventTarget.cpp:
+        (WebCore::EventTarget::toNode):
+        (WebCore::EventTarget::addEventListener):
+        * dom/EventTarget.h:
+        * dom/MouseEvent.cpp:
+        (WebCore::MouseEvent::toElement const):
+        (WebCore::MouseEvent::fromElement const):
+        * dom/MouseEvent.h:
+        * dom/MouseRelatedEvent.cpp:
+        (WebCore::MouseRelatedEvent::computeRelativePosition):
+        * dom/Node.cpp:
+        (WebCore::Node::toNode):
+        * dom/Node.h:
+        * dom/ScopedEventQueue.cpp:
+        * editing/Editor.cpp:
+        (WebCore::Editor::selectionForCommand):
+        * editing/EditorCommand.cpp:
+        (WebCore::targetFrame):
+        * editing/TextIterator.cpp:
+        (WebCore::TextIterator::handleReplacedElement):
+        * html/BaseChooserOnlyDateAndTimeInputType.cpp:
+        (WebCore::BaseChooserOnlyDateAndTimeInputType::updateAppearance):
+        * html/ColorInputType.cpp:
+        (WebCore::ColorInputType::updateColorSwatch):
+        (WebCore::ColorInputType::shadowColorSwatch const):
+        * html/FileInputType.cpp:
+        (WebCore::FileInputType::disabledAttributeChanged):
+        (WebCore::FileInputType::multipleAttributeChanged):
+        * html/FormAssociatedElement.cpp:
+        (WebCore::FormAssociatedElement::findAssociatedForm):
+        (WebCore::FormAssociatedElement::formOwnerRemovedFromTree):
+        (WebCore::FormAssociatedElement::resetFormOwner):
+        (WebCore::FormAssociatedElement::formAttributeChanged):
+        * html/FormController.cpp:
+        (WebCore::recordFormStructure):
+        (WebCore::FormKeyGenerator::formKey):
+        (WebCore::FormController::restoreControlStateIn):
+        * html/HTMLAnchorElement.cpp:
+        (WebCore::appendServerMapMousePosition):
+        (WebCore::HTMLAnchorElement::handleClick):
+        * html/HTMLAppletElement.cpp:
+        (WebCore::HTMLAppletElement::updateWidget):
+        * html/HTMLAreaElement.cpp:
+        (WebCore::HTMLAreaElement::imageElement const):
+        (WebCore::HTMLAreaElement::isFocusable const):
+        (WebCore::HTMLAreaElement::setFocus):
+        (WebCore::HTMLAreaElement::updateFocusAppearance):
+        * html/HTMLBodyElement.cpp:
+        (WebCore::HTMLBodyElement::scrollLeft):
+        (WebCore::HTMLBodyElement::setScrollLeft):
+        (WebCore::HTMLBodyElement::scrollTop):
+        (WebCore::HTMLBodyElement::setScrollTop):
+        (WebCore::HTMLBodyElement::scrollHeight):
+        (WebCore::HTMLBodyElement::scrollWidth):
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::createElementRenderer):
+        (WebCore:: const):
+        * html/HTMLDocument.cpp:
+        (WebCore::HTMLDocument::width):
+        (WebCore::HTMLDocument::height):
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::rendererIsNeeded):
+        (WebCore::setHasDirAutoFlagRecursively):
+        (WebCore::HTMLElement::directionality const):
+        (WebCore::HTMLElement::dirAttributeChanged):
+        (WebCore::HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged):
+        * html/HTMLEmbedElement.cpp:
+        (WebCore::HTMLEmbedElement::renderWidgetLoadingPlugin const):
+        (WebCore::HTMLEmbedElement::rendererIsNeeded):
+        * html/HTMLFieldSetElement.cpp:
+        (WebCore::updateFromControlElementsAncestorDisabledStateUnder):
+        (WebCore::HTMLFieldSetElement::disabledStateChanged):
+        (WebCore::HTMLFieldSetElement::childrenChanged):
+        * html/HTMLFormControlElement.cpp:
+        (WebCore::HTMLFormControlElement::computeIsDisabledByFieldsetAncestor const):
+        (WebCore::HTMLFormControlElement::setNeedsWillValidateCheck):
+        (WebCore::HTMLFormControlElement::didChangeForm):
+        (WebCore::HTMLFormControlElement::shouldAutocorrect const):
+        (WebCore::HTMLFormControlElement::autocapitalizeType const):
+        * html/HTMLFormElement.cpp:
+        (WebCore::HTMLFormElement::handleLocalEvents):
+        (WebCore::submitElementFromEvent):
+        (WebCore::HTMLFormElement::prepareForSubmission):
+        (WebCore::HTMLFormElement::submit):
+        (WebCore::HTMLFormElement::reset):
+        (WebCore::HTMLFormElement::shouldAutocorrect const):
+        (WebCore::HTMLFormElement::parseAttribute):
+        (WebCore::HTMLFormElement::resetDefaultButton):
+        (WebCore::HTMLFormElement::elementFromPastNamesMap const):
+        (WebCore::HTMLFormElement::namedElements):
+        * html/HTMLFormElement.h:
+        * html/HTMLFrameElement.cpp:
+        (WebCore::HTMLFrameElement::didAttachRenderers):
+        * html/HTMLFrameElementBase.cpp:
+        (WebCore::HTMLFrameElementBase::isURLAllowed const):
+        (WebCore::HTMLFrameElementBase::openURL):
+        (WebCore::HTMLFrameElementBase::didAttachRenderers):
+        * html/HTMLFrameOwnerElement.cpp:
+        (WebCore::HTMLFrameOwnerElement::setContentFrame):
+        (WebCore::HTMLFrameOwnerElement::clearContentFrame):
+        (WebCore::HTMLFrameOwnerElement::disconnectContentFrame):
+        (WebCore::SubframeLoadingDisabler::canLoadFrame):
+        * html/HTMLFrameSetElement.cpp:
+        (WebCore::HTMLFrameSetElement::findContaining):
+        (WebCore::HTMLFrameSetElement::willAttachRenderers):
+        (WebCore::HTMLFrameSetElement::insertedInto):
+        (WebCore::HTMLFrameSetElement::removedFrom):
+        * html/HTMLFrameSetElement.h:
+        * html/HTMLImageElement.cpp:
+        (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
+        (WebCore::HTMLImageElement::pictureElement const):
+        (WebCore::HTMLImageElement::destroyImageControls):
+        (WebCore::HTMLImageElement::hasImageControls const):
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::innerTextElement const):
+        (WebCore::HTMLInputElement::endEditing):
+        (WebCore::HTMLInputElement::dataList const):
+        (WebCore::HTMLInputElement::resetListAttributeTargetObserver): Deleted.
+        (WebCore::HTMLInputElement::listAttributeTargetChanged): Deleted.
+        (WebCore::HTMLInputElement::isSteppable const): Deleted.
+        (WebCore::HTMLInputElement::dateType const): Deleted.
+        (WebCore::HTMLInputElement::isTextButton const): Deleted.
+        (WebCore::HTMLInputElement::isRadioButton const): Deleted.
+        (WebCore::HTMLInputElement::isSearchField const): Deleted.
+        (WebCore::HTMLInputElement::isInputTypeHidden const): Deleted.
+        (WebCore::HTMLInputElement::isPasswordField const): Deleted.
+        (WebCore::HTMLInputElement::isCheckbox const): Deleted.
+        (WebCore::HTMLInputElement::isRangeControl const): Deleted.
+        (WebCore::HTMLInputElement::isColorControl const): Deleted.
+        (WebCore::HTMLInputElement::isText const): Deleted.
+        (WebCore::HTMLInputElement::isEmailField const): Deleted.
+        (WebCore::HTMLInputElement::isFileUpload const): Deleted.
+        (WebCore::HTMLInputElement::isImageButton const): Deleted.
+        (WebCore::HTMLInputElement::isNumberField const): Deleted.
+        (WebCore::HTMLInputElement::isSubmitButton const): Deleted.
+        (WebCore::HTMLInputElement::isTelephoneField const): Deleted.
+        (WebCore::HTMLInputElement::isURLField const): Deleted.
+        (WebCore::HTMLInputElement::isDateField const): Deleted.
+        (WebCore::HTMLInputElement::isDateTimeField const): Deleted.
+        (WebCore::HTMLInputElement::isDateTimeLocalField const): Deleted.
+        (WebCore::HTMLInputElement::isMonthField const): Deleted.
+        (WebCore::HTMLInputElement::isTimeField const): Deleted.
+        (WebCore::HTMLInputElement::isWeekField const): Deleted.
+        (WebCore::HTMLInputElement::isEnumeratable const): Deleted.
+        (WebCore::HTMLInputElement::supportLabels const): Deleted.
+        (WebCore::HTMLInputElement::shouldAppearChecked const): Deleted.
+        (WebCore::HTMLInputElement::supportsPlaceholder const): Deleted.
+        (WebCore::HTMLInputElement::updatePlaceholderText): Deleted.
+        (WebCore::HTMLInputElement::isEmptyValue const): Deleted.
+        (WebCore::HTMLInputElement::maxLengthAttributeChanged): Deleted.
+        (WebCore::HTMLInputElement::minLengthAttributeChanged): Deleted.
+        (WebCore::HTMLInputElement::updateValueIfNeeded): Deleted.
+        (WebCore::HTMLInputElement::defaultToolTip const): Deleted.
+        (WebCore::HTMLInputElement::matchesIndeterminatePseudoClass const): Deleted.
+        (WebCore::HTMLInputElement::shouldAppearIndeterminate const): Deleted.
+        (WebCore::HTMLInputElement::mediaCaptureType const): Deleted.
+        (WebCore::HTMLInputElement::isInRequiredRadioButtonGroup): Deleted.
+        (WebCore:: const): Deleted.
+        (WebCore::HTMLInputElement::checkedRadioButtonForGroup const): Deleted.
+        (WebCore::HTMLInputElement::radioButtonGroups const): Deleted.
+        (WebCore::HTMLInputElement::addToRadioButtonGroup): Deleted.
+        (WebCore::HTMLInputElement::removeFromRadioButtonGroup): Deleted.
+        (WebCore::HTMLInputElement::height const): Deleted.
+        (WebCore::HTMLInputElement::width const): Deleted.
+        (WebCore::HTMLInputElement::setHeight): Deleted.
+        (WebCore::HTMLInputElement::setWidth): Deleted.
+        (WebCore::ListAttributeTargetObserver::ListAttributeTargetObserver): Deleted.
+        (WebCore::ListAttributeTargetObserver::idTargetChanged): Deleted.
+        (WebCore::HTMLInputElement::setRangeText): Deleted.
+        (WebCore::HTMLInputElement::shouldTruncateText const): Deleted.
+        (WebCore::HTMLInputElement::selectionStartForBindings const): Deleted.
+        (WebCore::HTMLInputElement::setSelectionStartForBindings): Deleted.
+        (WebCore::HTMLInputElement::selectionEndForBindings const): Deleted.
+        (WebCore::HTMLInputElement::setSelectionEndForBindings): Deleted.
+        (WebCore::HTMLInputElement::selectionDirectionForBindings const): Deleted.
+        (WebCore::HTMLInputElement::setSelectionDirectionForBindings): Deleted.
+        (WebCore::HTMLInputElement::setSelectionRangeForBindings): Deleted.
+        (WebCore::HTMLInputElement::createInnerTextStyle const): Deleted.
+        (WebCore::HTMLInputElement::setupDateTimeChooserParameters): Deleted.
+        (WebCore::HTMLInputElement::capsLockStateMayHaveChanged): Deleted.
+        * html/HTMLInputElement.h:
+        * html/HTMLKeygenElement.cpp:
+        (WebCore::HTMLKeygenElement::shadowSelect const):
+        * html/HTMLLabelElement.cpp:
+        (WebCore::HTMLLabelElement::defaultEventHandler):
+        * html/HTMLLinkElement.cpp:
+        (WebCore::HTMLLinkElement::handleClick):
+        * html/HTMLMapElement.cpp:
+        (WebCore::HTMLMapElement::mapMouseEvent):
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::selectMediaResource):
+        (WebCore::HTMLMediaElement::loadResource):
+        (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
+        (WebCore::HTMLMediaElement::isSafeToLoadURL):
+        (WebCore::HTMLMediaElement::controls const):
+        (WebCore::HTMLMediaElement::layoutSizeChanged):
+        (WebCore::HTMLMediaElement::enterFullscreen):
+        (WebCore::HTMLMediaElement::mediaControls const):
+        (WebCore::HTMLMediaElement::hasMediaControls const):
+        (WebCore::HTMLMediaElement::mediaPlayerReferrer const):
+        (WebCore::HTMLMediaElement::mediaPlayerUserAgent const):
+        (WebCore::HTMLMediaElement::mediaPlayerShouldWaitForResponseToAuthenticationChallenge):
+        (WebCore::HTMLMediaElement::sourceApplicationIdentifier const):
+        (WebCore::HTMLMediaElement::getVideoPlaybackQuality):
+        (WebCore::HTMLMediaElement::session const):
+        * html/HTMLMediaElement.h:
+        (WebCore::HTMLMediaElement::player const):
+        * html/HTMLObjectElement.cpp:
+        (WebCore::HTMLObjectElement::hasFallbackContent const):
+        * html/HTMLOptGroupElement.cpp:
+        (WebCore::HTMLOptGroupElement::ownerSelectElement const):
+        (WebCore::HTMLOptGroupElement::accessKeyAction):
+        * html/HTMLOptionElement.cpp:
+        (WebCore::HTMLOptionElement::setText):
+        (WebCore::HTMLOptionElement::accessKeyAction):
+        (WebCore::HTMLOptionElement::index const):
+        (WebCore::HTMLOptionElement::parseAttribute):
+        (WebCore::HTMLOptionElement::selected):
+        (WebCore::HTMLOptionElement::setSelected):
+        (WebCore::HTMLOptionElement::setSelectedState):
+        (WebCore::HTMLOptionElement::childrenChanged):
+        (WebCore::HTMLOptionElement::ownerDataListElement const):
+        (WebCore::HTMLOptionElement::ownerSelectElement const):
+        (WebCore::HTMLOptionElement::textIndentedToRespectGroupLabel const):
+        (WebCore::HTMLOptionElement::insertedInto):
+        (WebCore::HTMLOptionElement::collectOptionInnerText const):
+        * html/HTMLPlugInElement.cpp:
+        (WebCore::HTMLPlugInElement::willDetachRenderers):
+        (WebCore::HTMLPlugInElement::isKeyboardFocusable const):
+        (WebCore::HTMLPlugInElement::isUserObservable const):
+        * html/HTMLPlugInImageElement.cpp:
+        (WebCore::HTMLPlugInImageElement::partOfSnapshotOverlay const):
+        (WebCore::HTMLPlugInImageElement::restartSimilarPlugIns):
+        * html/HTMLSelectElement.cpp:
+        (WebCore::HTMLSelectElement::add):
+        (WebCore::HTMLSelectElement::recalcListItems const):
+        (WebCore::HTMLSelectElement::selectOption):
+        (WebCore::HTMLSelectElement::reset):
+        (WebCore::HTMLSelectElement::listBoxDefaultEventHandler):
+        * html/HTMLSlotElement.cpp:
+        (WebCore::flattenAssignedNodes):
+        * html/HTMLSourceElement.cpp:
+        (WebCore::HTMLSourceElement::removedFrom):
+        * html/HTMLSummaryElement.cpp:
+        (WebCore::HTMLSummaryElement::isActiveSummary const):
+        (WebCore::isClickableControl):
+        (WebCore::HTMLSummaryElement::defaultEventHandler):
+        * html/HTMLTableCellElement.cpp:
+        (WebCore::HTMLTableCellElement::additionalPresentationAttributeStyle const):
+        * html/HTMLTableColElement.cpp:
+        (WebCore::HTMLTableColElement::additionalPresentationAttributeStyle const):
+        * html/HTMLTableElement.cpp:
+        (WebCore::HTMLTableElement::tHead const):
+        (WebCore::HTMLTableElement::setTHead):
+        (WebCore::HTMLTableElement::tFoot const):
+        (WebCore::HTMLTableElement::createTBody):
+        (WebCore::HTMLTableElement::lastBody const):
+        (WebCore::HTMLTableElement::deleteRow):
+        * html/HTMLTablePartElement.cpp:
+        (WebCore::HTMLTablePartElement::findParentTable const):
+        * html/HTMLTableRowsCollection.cpp:
+        (WebCore::HTMLTableRowsCollection::rowAfter):
+        * html/HTMLTextAreaElement.cpp:
+        (WebCore::HTMLTextAreaElement::subtreeHasChanged):
+        (WebCore::HTMLTextAreaElement::innerTextElement const):
+        * html/HTMLTextAreaElement.h:
+        * html/HTMLTextFormControlElement.cpp:
+        (WebCore::HTMLTextFormControlElement::setSelectionRange):
+        (WebCore::HTMLTextFormControlElement::indexForVisiblePosition const):
+        (WebCore::HTMLTextFormControlElement::visiblePositionForIndex const):
+        (WebCore::HTMLTextFormControlElement::computeSelectionStart const):
+        (WebCore::HTMLTextFormControlElement::computeSelectionEnd const):
+        (WebCore::HTMLTextFormControlElement::computeSelectionDirection const):
+        (WebCore::HTMLTextFormControlElement::selection const):
+        (WebCore::HTMLTextFormControlElement::updateInnerTextElementEditability):
+        (WebCore::innerTextValueFrom):
+        (WebCore::HTMLTextFormControlElement::setInnerTextValue):
+        (WebCore::HTMLTextFormControlElement::innerTextValue const):
+        (WebCore::positionForIndex):
+        (WebCore::HTMLTextFormControlElement::indexForPosition const):
+        (WebCore::HTMLTextFormControlElement::hidePlaceholder):
+        (WebCore::HTMLTextFormControlElement::showPlaceholderIfNecessary):
+        (WebCore::HTMLTextFormControlElement::valueWithHardLineBreaks const):
+        (WebCore::enclosingTextFormControl):
+        (WebCore::HTMLTextFormControlElement::adjustInnerTextStyle const):
+        * html/HTMLTextFormControlElement.h:
+        * html/HTMLTrackElement.cpp:
+        (WebCore::HTMLTrackElement::canLoadURL):
+        (WebCore::HTMLTrackElement::setReadyState):
+        (WebCore::HTMLTrackElement::mediaElementCrossOriginAttribute const):
+        (WebCore::HTMLTrackElement::textTrackKindChanged):
+        (WebCore::HTMLTrackElement::textTrackModeChanged):
+        (WebCore::HTMLTrackElement::textTrackAddCues):
+        (WebCore::HTMLTrackElement::textTrackRemoveCues):
+        (WebCore::HTMLTrackElement::textTrackAddCue):
+        (WebCore::HTMLTrackElement::textTrackRemoveCue):
+        (WebCore::HTMLTrackElement::mediaElement const):
+        * html/HTMLTrackElement.h:
+        * html/HTMLVideoElement.cpp:
+        (WebCore::HTMLVideoElement::setDisplayMode):
+        (WebCore::HTMLVideoElement::paintCurrentFrameInContext):
+        * html/ImageDocument.cpp:
+        (WebCore::ImageDocument::createDocumentStructure):
+        (WebCore::ImageDocument::scale):
+        (WebCore::ImageDocument::imageFitsInWindow):
+        * html/InputType.cpp:
+        (WebCore::InputType::destroyShadowSubtree):
+        * html/InputType.h:
+        (WebCore::InputType::innerTextElement const):
+        * html/MediaDocument.cpp:
+        (WebCore::MediaDocumentParser::createDocumentStructure):
+        (WebCore::MediaDocument::defaultEventHandler):
+        * html/MediaElementSession.cpp:
+        (WebCore::MediaElementSession::wirelessVideoPlaybackDisabled const):
+        (WebCore::MediaElementSession::setWirelessVideoPlaybackDisabled):
+        (WebCore::isMainContentForPurposesOfAutoplay):
+        * html/NumberInputType.cpp:
+        (WebCore::NumberInputType::decorationWidth const):
+        * html/PluginDocument.cpp:
+        (WebCore::PluginDocumentParser::appendBytes):
+        * html/RadioInputType.cpp:
+        (WebCore::RadioInputType::handleKeydownEvent):
+        (WebCore::RadioInputType::isKeyboardFocusable const):
+        (WebCore::RadioInputType::didDispatchClick):
+        * html/RadioNodeList.cpp:
+        (WebCore::RadioNodeList::checkElementMatchesRadioNodeListFilter const):
+        * html/RangeInputType.cpp:
+        (WebCore::RangeInputType::handleMouseDownEvent):
+        (WebCore::RangeInputType::handleTouchEvent):
+        (WebCore::RangeInputType::sliderTrackElement const):
+        (WebCore::RangeInputType::listAttributeTargetChanged):
+        (WebCore::RangeInputType::updateTickMarkValues):
+        * html/SearchInputType.cpp:
+        (WebCore::SearchInputType::createShadowSubtree):
+        * html/TextFieldInputType.cpp:
+        (WebCore::TextFieldInputType::isEmptyValue const):
+        (WebCore::TextFieldInputType::handleKeydownEvent):
+        (WebCore::TextFieldInputType::handleFocusEvent):
+        (WebCore::TextFieldInputType::innerTextElement const):
+        (WebCore::TextFieldInputType::updatePlaceholderText):
+        (WebCore::TextFieldInputType::didSetValueByUserEdit):
+        (WebCore::TextFieldInputType::shouldDrawCapsLockIndicator const):
+        * html/TextFieldInputType.h:
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::size):
+        (WebCore::CanvasRenderingContext2D::drawImage):
+        * html/canvas/WebGL2RenderingContext.cpp:
+        (WebCore::WebGL2RenderingContext::copyBufferSubData):
+        (WebCore::WebGL2RenderingContext::getBufferSubData):
+        * html/canvas/WebGLFramebuffer.cpp:
+        (WebCore::WebGLFramebuffer::attach):
+        (WebCore::WebGLFramebuffer::getAttachmentObject const):
+        (WebCore::WebGLFramebuffer::removeAttachmentFromBoundFramebuffer):
+        (WebCore::WebGLFramebuffer::getColorBufferWidth const):
+        (WebCore::WebGLFramebuffer::getColorBufferHeight const):
+        (WebCore::WebGLFramebuffer::getColorBufferFormat const):
+        (WebCore::WebGLFramebuffer::checkStatus const):
+        (WebCore::WebGLFramebuffer::hasStencilBuffer const):
+        (WebCore::WebGLFramebuffer::initializeAttachments):
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter):
+        * html/canvas/WebGLRenderingContextBase.cpp:
+        (WebCore::WebGLRenderingContextBase::create):
+        (WebCore::WebGLRenderingContextBase::bufferData):
+        (WebCore::WebGLRenderingContextBase::bufferSubData):
+        (WebCore::WebGLRenderingContextBase::compressedTexImage2D):
+        (WebCore::WebGLRenderingContextBase::compressedTexSubImage2D):
+        (WebCore::WebGLRenderingContextBase::copyTexSubImage2D):
+        (WebCore::WebGLRenderingContextBase::generateMipmap):
+        (WebCore::WebGLRenderingContextBase::getAttachedShaders):
+        (WebCore::WebGLRenderingContextBase::getTexParameter):
+        (WebCore::WebGLRenderingContextBase::linkProgramWithoutInvalidatingAttribLocations):
+        (WebCore::WebGLRenderingContextBase::texImage2DBase):
+        (WebCore::WebGLRenderingContextBase::validateTexFunc):
+        (WebCore::WebGLRenderingContextBase::texSubImage2D):
+        (WebCore::WebGLRenderingContextBase::texSubImage2DBase):
+        (WebCore::WebGLRenderingContextBase::copyTexImage2D):
+        (WebCore::WebGLRenderingContextBase::texImage2D):
+        (WebCore::WebGLRenderingContextBase::texParameter):
+        (WebCore::WebGLRenderingContextBase::loseContextImpl):
+        (WebCore::WebGLRenderingContextBase::checkTextureCompleteness):
+        (WebCore::WebGLRenderingContextBase::validateTextureBinding):
+        (WebCore::WebGLRenderingContextBase::maybeRestoreContext):
+        * html/canvas/WebGPURenderPassColorAttachmentDescriptor.cpp:
+        (WebCore::WebGPURenderPassColorAttachmentDescriptor::clearColor const):
+        (WebCore::WebGPURenderPassColorAttachmentDescriptor::setClearColor):
+        * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.cpp:
+        (WebCore::WebGPURenderPassDepthAttachmentDescriptor::clearDepth const):
+        (WebCore::WebGPURenderPassDepthAttachmentDescriptor::setClearDepth):
+        * html/parser/HTMLConstructionSite.cpp:
+        (WebCore::executeInsertAlreadyParsedChildTask):
+        (WebCore::HTMLConstructionSite::insertTextNode):
+        * html/parser/HTMLFormattingElementList.cpp:
+        (WebCore::HTMLFormattingElementList::tryToEnsureNoahsArkConditionQuickly):
+        * html/parser/HTMLParserOptions.cpp:
+        (WebCore::HTMLParserOptions::HTMLParserOptions):
+        * html/parser/HTMLParserScheduler.cpp:
+        (WebCore::HTMLParserScheduler::shouldYieldBeforeExecutingScript):
+        * html/parser/HTMLTreeBuilder.cpp:
+        (WebCore::HTMLTreeBuilder::processStartTagForInBody):
+        (WebCore::HTMLTreeBuilder::callTheAdoptionAgency):
+        (WebCore::HTMLTreeBuilder::resetInsertionModeAppropriately):
+        * html/parser/XSSAuditor.cpp:
+        (WebCore::XSSAuditor::init):
+        * html/shadow/MediaControlElementTypes.cpp:
+        (WebCore::parentMediaElement):
+        * html/shadow/MediaControlElementTypes.h:
+        (WebCore::parentMediaElement):
+        * html/shadow/MediaControlElements.cpp:
+        (WebCore::MediaControlPanelElement::startDrag):
+        (WebCore::MediaControlPanelElement::endDrag):
+        (WebCore::MediaControlVolumeSliderContainerElement::defaultEventHandler):
+        (WebCore::MediaControlClosedCaptionsTrackListElement::defaultEventHandler):
+        (WebCore::MediaControlClosedCaptionsTrackListElement::updateDisplay):
+        (WebCore::MediaControlClosedCaptionsTrackListElement::rebuildTrackListMenu):
+        (WebCore::MediaControlFullscreenButtonElement::defaultEventHandler):
+        (WebCore::MediaControlTextTrackContainerElement::updateDisplay):
+        (WebCore::MediaControlTextTrackContainerElement::updateActiveCuesFontSize):
+        (WebCore::MediaControlTextTrackContainerElement::updateTextStrokeStyle):
+        (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation):
+        (WebCore::MediaControlTextTrackContainerElement::clearTextTrackRepresentation):
+        (WebCore::MediaControlTextTrackContainerElement::updateSizes):
+        (WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage):
+        * html/shadow/MediaControls.cpp:
+        (WebCore::MediaControls::containsRelatedTarget):
+        * html/shadow/SliderThumbElement.cpp:
+        (WebCore::SliderThumbElement::isDisabledFormControl const):
+        (WebCore::SliderThumbElement::matchesReadWritePseudoClass const):
+        (WebCore::SliderThumbElement::focusDelegate):
+        (WebCore::SliderThumbElement::setPositionFromPoint):
+        (WebCore::SliderThumbElement::startDragging):
+        (WebCore::SliderThumbElement::stopDragging):
+        (WebCore::SliderThumbElement::defaultEventHandler):
+        (WebCore::SliderThumbElement::willRespondToMouseMoveEvents):
+        (WebCore::SliderThumbElement::willRespondToMouseClickEvents):
+        (WebCore::SliderThumbElement::willDetachRenderers):
+        (WebCore::findTouchWithIdentifier):
+        (WebCore::SliderThumbElement::handleTouchStart):
+        (WebCore::SliderThumbElement::handleTouchMove):
+        (WebCore::SliderThumbElement::handleTouchEndAndCancel):
+        (WebCore::SliderThumbElement::handleTouchEvent):
+        (WebCore::SliderThumbElement::hostInput const):
+        * html/shadow/SliderThumbElement.h:
+        * html/shadow/SpinButtonElement.cpp:
+        (WebCore::SpinButtonElement::defaultEventHandler):
+        (WebCore::SpinButtonElement::releaseCapture):
+        * html/shadow/TextControlInnerElements.cpp:
+        (WebCore::TextControlInnerTextElement::defaultEventHandler):
+        (WebCore::SearchFieldCancelButtonElement::willRespondToMouseClickEvents):
+        * html/shadow/mac/ImageControlsButtonElementMac.cpp:
+        (WebCore::ImageControlsButtonElementMac::defaultEventHandler):
+        * html/track/LoadableTextTrack.cpp:
+        (WebCore::LoadableTextTrack::trackElementIndex):
+        * html/track/TextTrack.cpp:
+        (WebCore::TextTrack::setMode):
+        (WebCore::TextTrack::hasCue):
+        * html/track/TextTrackCueGeneric.cpp:
+        (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
+        * html/track/VTTCue.cpp:
+        (WebCore::VTTCue::copyWebVTTNodeToDOMTree):
+        (WebCore::VTTCue::determineTextDirection):
+        (WebCore::VTTCue::markFutureAndPastNodes):
+        (WebCore::VTTCue::removeDisplayTree):
+        (WebCore::VTTCue::cueContentsMatch const):
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::didAddEventListener):
+        (WebCore::InspectorDOMAgent::willRemoveEventListener):
+        * loader/FormSubmission.cpp:
+        (WebCore::FormSubmission::create):
+        * page/ContextMenuController.cpp:
+        (WebCore::ContextMenuController::maybeCreateContextMenu):
+        * rendering/RenderSnapshottedPlugIn.cpp:
+        (WebCore::RenderSnapshottedPlugIn::handleEvent):
+        * rendering/RenderTextControl.cpp:
+        (WebCore::RenderTextControl::innerTextElement const):
+        (WebCore::RenderTextControl::styleDidChange):
+        (WebCore::RenderTextControl::textBlockLogicalWidth const):
+        (WebCore::RenderTextControl::computeLogicalHeight const):
+        (WebCore::RenderTextControl::hitInnerTextElement):
+        (WebCore::RenderTextControl::canScroll const):
+        (WebCore::RenderTextControl::innerLineHeight const):
+        * rendering/RenderTextControl.h:
+        * rendering/RenderTextControlSingleLine.cpp:
+        (WebCore::RenderTextControlSingleLine::nodeAtPoint):
+        (WebCore::RenderTextControlSingleLine::styleDidChange):
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::isFocused const):
+        * rendering/RenderThemeGtk.cpp:
+        (WebCore::RenderThemeGtk::paintMediaSliderTrack):
+        (WebCore::RenderThemeGtk::paintMediaVolumeSliderTrack):
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::paintSliderThumb):
+        * rendering/RenderVideo.cpp:
+        (WebCore::RenderVideo::willBeDestroyed):
+        (WebCore::RenderVideo::calculateIntrinsicSize):
+        (WebCore::RenderVideo::paintReplaced):
+        (WebCore::RenderVideo::updatePlayer):
+        (WebCore::RenderVideo::supportsAcceleratedRendering const):
+        (WebCore::RenderVideo::acceleratedRenderingStateChanged):
+        (WebCore::RenderVideo::requiresImmediateCompositing const):
+        (WebCore::RenderVideo::foregroundIsKnownToBeOpaqueInRect const):
+        * svg/SVGUseElement.cpp:
+        (WebCore::SVGUseElement::clearShadowTree):
+        (WebCore::SVGUseElement::targetClone const):
+
 2017-10-18  Dean Jackson  <dino@apple.com>
 
         Some older hardware can't actually use renderbuffers at the size they advertise
index 4357dd4..2a421d0 100644 (file)
@@ -134,10 +134,10 @@ std::unique_ptr<LegacyCDMSession> LegacyCDM::createSession(LegacyCDMSessionClien
     return session;
 }
 
-MediaPlayer* LegacyCDM::mediaPlayer() const
+RefPtr<MediaPlayer> LegacyCDM::mediaPlayer() const
 {
     if (!m_client)
-        return 0;
+        return nullptr;
     return m_client->cdmMediaPlayer(this);
 }
 
index 33b0ccf..05ef357 100644 (file)
@@ -47,7 +47,7 @@ class LegacyCDMClient {
 public:
     virtual ~LegacyCDMClient() { }
 
-    virtual MediaPlayer* cdmMediaPlayer(const LegacyCDM*) const = 0;
+    virtual RefPtr<MediaPlayer> cdmMediaPlayer(const LegacyCDM*) const = 0;
 };
 
 class LegacyCDM {
@@ -69,7 +69,7 @@ public:
     LegacyCDMClient* client() const { return m_client; }
     void setClient(LegacyCDMClient* client) { m_client = client; }
 
-    MediaPlayer* mediaPlayer() const;
+    RefPtr<MediaPlayer> mediaPlayer() const;
 
 private:
     String m_keySystem;
index 6d07da5..c23753c 100644 (file)
@@ -56,7 +56,7 @@ bool CDMPrivateMediaPlayer::supportsMIMEType(const String& mimeType)
 
 std::unique_ptr<LegacyCDMSession> CDMPrivateMediaPlayer::createSession(LegacyCDMSessionClient* client)
 {
-    MediaPlayer* mediaPlayer = m_cdm->mediaPlayer();
+    auto mediaPlayer = m_cdm->mediaPlayer();
     if (!mediaPlayer)
         return nullptr;
 
index 584ff09..803835e 100644 (file)
@@ -137,7 +137,7 @@ void WebKitMediaKeys::setMediaElement(HTMLMediaElement* element)
         m_mediaElement->player()->setCDMSession(m_sessions.last()->session());
 }
 
-MediaPlayer* WebKitMediaKeys::cdmMediaPlayer(const LegacyCDM*) const
+RefPtr<MediaPlayer> WebKitMediaKeys::cdmMediaPlayer(const LegacyCDM*) const
 {
     if (!m_mediaElement)
         return nullptr;
index a805707..0339fd5 100644 (file)
@@ -55,7 +55,7 @@ public:
     RefPtr<ArrayBuffer> cachedKeyForKeyId(const String& keyId) const;
 
 private:
-    MediaPlayer* cdmMediaPlayer(const LegacyCDM*) const final;
+    RefPtr<MediaPlayer> cdmMediaPlayer(const LegacyCDM*) const final;
 
     WebKitMediaKeys(const String& keySystem, std::unique_ptr<LegacyCDM>&&);
 
index 9f20104..18b80cd 100644 (file)
@@ -223,7 +223,7 @@ bool MediaControlsHost::shouldForceControlsDisplay() const
 String MediaControlsHost::externalDeviceDisplayName() const
 {
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
-    MediaPlayer* player = m_mediaElement->player();
+    auto player = m_mediaElement->player();
     if (!player) {
         LOG(Media, "MediaControlsHost::externalDeviceDisplayName - returning \"\" because player is NULL");
         return emptyString();
@@ -243,7 +243,7 @@ auto MediaControlsHost::externalDeviceType() const -> DeviceType
 #if !ENABLE(WIRELESS_PLAYBACK_TARGET)
     return DeviceType::None;
 #else
-    MediaPlayer* player = m_mediaElement->player();
+    auto player = m_mediaElement->player();
     if (!player) {
         LOG(Media, "MediaControlsHost::externalDeviceType - returning \"none\" because player is NULL");
         return DeviceType::None;
index 9a42e0f..12275ba 100644 (file)
@@ -224,7 +224,7 @@ bool Element::supportsFocus() const
     return tabIndexSetExplicitly();
 }
 
-Element* Element::focusDelegate()
+RefPtr<Element> Element::focusDelegate()
 {
     return this;
 }
@@ -1862,7 +1862,7 @@ ShadowRoot* Element::shadowRootForBindings(JSC::ExecState& state) const
     return nullptr;
 }
 
-ShadowRoot* Element::userAgentShadowRoot() const
+RefPtr<ShadowRoot> Element::userAgentShadowRoot() const
 {
     ASSERT(!shadowRoot() || shadowRoot()->mode() == ShadowRootMode::UserAgent);
     return shadowRoot();
@@ -1870,7 +1870,7 @@ ShadowRoot* Element::userAgentShadowRoot() const
 
 ShadowRoot& Element::ensureUserAgentShadowRoot()
 {
-    if (auto* shadow = userAgentShadowRoot())
+    if (auto shadow = userAgentShadowRoot())
         return *shadow;
     auto newShadow = ShadowRoot::create(document(), ShadowRootMode::UserAgent);
     ShadowRoot& shadow = newShadow;
index f269695..1603e86 100644 (file)
@@ -275,7 +275,7 @@ public:
     };
     ExceptionOr<ShadowRoot&> attachShadow(const ShadowRootInit&);
 
-    ShadowRoot* userAgentShadowRoot() const;
+    RefPtr<ShadowRoot> userAgentShadowRoot() const;
     WEBCORE_EXPORT ShadowRoot& ensureUserAgentShadowRoot();
 
     void setIsDefinedCustomElement(JSCustomElementInterface&);
@@ -308,7 +308,7 @@ public:
 
     virtual int tabIndex() const;
     WEBCORE_EXPORT void setTabIndex(int);
-    virtual Element* focusDelegate();
+    virtual RefPtr<Element> focusDelegate();
 
     WEBCORE_EXPORT ExceptionOr<Element*> insertAdjacentElement(const String& where, Element& newChild);
     WEBCORE_EXPORT ExceptionOr<void> insertAdjacentHTML(const String& where, const String& html);
index dba8b9d..e0eadb5 100644 (file)
@@ -125,7 +125,7 @@ void TouchEventContext::checkReachability(TouchList* touchList) const
 {
     size_t length = touchList->length();
     for (size_t i = 0; i < length; ++i)
-        ASSERT(!isUnreachableNode(touchList->item(i)->target()->toNode()));
+        ASSERT(!isUnreachableNode(touchList->item(i)->target()->toNode().get()));
 }
 
 #endif
index 3161eaa..02e8635 100644 (file)
@@ -52,7 +52,7 @@ void WindowEventContext::handleLocalEvents(Event& event) const
 
 static inline bool shouldEventCrossShadowBoundary(Event& event, ShadowRoot& shadowRoot, EventTarget& target)
 {
-    Node* targetNode = target.toNode();
+    auto targetNode = target.toNode();
 
 #if ENABLE(FULLSCREEN_API) && ENABLE(VIDEO)
     // Video-only full screen is a mode where we use the shadow DOM as an implementation
@@ -159,7 +159,7 @@ EventPath::EventPath(Node& originalTarget, Event& event)
 
 void EventPath::setRelatedTarget(Node& origin, EventTarget& relatedTarget)
 {
-    Node* relatedNode = relatedTarget.toNode();
+    auto relatedNode = relatedTarget.toNode();
     if (!relatedNode || m_path.isEmpty())
         return;
 
@@ -204,7 +204,7 @@ void EventPath::retargetTouch(TouchEventContext::TouchListType touchListType, co
     if (!eventTarget)
         return;
 
-    Node* targetNode = eventTarget->toNode();
+    auto targetNode = eventTarget->toNode();
     if (!targetNode)
         return;
 
@@ -258,7 +258,7 @@ bool EventPath::hasEventListeners(const AtomicString& eventType) const
 Vector<EventTarget*> EventPath::computePathUnclosedToTarget(const EventTarget& target) const
 {
     Vector<EventTarget*> path;
-    auto* targetNode = const_cast<EventTarget&>(target).toNode();
+    auto targetNode = const_cast<EventTarget&>(target).toNode();
     if (!targetNode) {
         auto* domWindow = const_cast<EventTarget&>(target).toDOMWindow();
         if (!domWindow)
@@ -267,7 +267,7 @@ Vector<EventTarget*> EventPath::computePathUnclosedToTarget(const EventTarget& t
         ASSERT(targetNode);
     }
     for (auto& context : m_path) {
-        if (auto* nodeInPath = context->currentTarget()->toNode()) {
+        if (auto nodeInPath = context->currentTarget()->toNode()) {
             if (!targetNode->isClosedShadowHidden(*nodeInPath))
                 path.append(context->currentTarget());
         } else
index 4c87590..7668cc7 100644 (file)
@@ -52,7 +52,7 @@
 namespace WebCore {
 using namespace WTF;
 
-Node* EventTarget::toNode()
+RefPtr<Node> EventTarget::toNode()
 {
     return nullptr;
 }
@@ -74,7 +74,7 @@ bool EventTarget::addEventListener(const AtomicString& eventType, Ref<EventListe
     if (!passive.has_value() && eventNames().isTouchScrollBlockingEventType(eventType)) {
         if (toDOMWindow())
             passive = true;
-        else if (auto* node = toNode()) {
+        else if (auto node = toNode()) {
             if (node->isDocumentNode() || node->document().documentElement() == node || node->document().body() == node)
                 passive = true;
         }
index 50cb47f..5949441 100644 (file)
@@ -68,7 +68,7 @@ public:
     virtual EventTargetInterface eventTargetInterface() const = 0;
     virtual ScriptExecutionContext* scriptExecutionContext() const = 0;
 
-    virtual Node* toNode();
+    virtual RefPtr<Node> toNode();
     virtual DOMWindow* toDOMWindow();
     virtual bool isMessagePort() const;
 
index 3164a58..9dc6412 100644 (file)
@@ -223,7 +223,7 @@ int MouseEvent::which() const
     return m_button + 1;
 }
 
-Node* MouseEvent::toElement() const
+RefPtr<Node> MouseEvent::toElement() const
 {
     // MSIE extension - "the object toward which the user is moving the mouse pointer"
     if (type() == eventNames().mouseoutEvent || type() == eventNames().mouseleaveEvent) {
@@ -234,7 +234,7 @@ Node* MouseEvent::toElement() const
     return target() ? target()->toNode() : nullptr;
 }
 
-Node* MouseEvent::fromElement() const
+RefPtr<Node> MouseEvent::fromElement() const
 {
     // MSIE extension - "object from which activation or the mouse pointer is exiting during the event" (huh?)
     if (type() != eventNames().mouseoutEvent && type() != eventNames().mouseleaveEvent) {
index 5e46449..586ce3a 100644 (file)
@@ -61,8 +61,8 @@ public:
     double force() const { return m_force; }
     void setForce(double force) { m_force = force; }
 
-    WEBCORE_EXPORT Node* toElement() const;
-    WEBCORE_EXPORT Node* fromElement() const;
+    WEBCORE_EXPORT RefPtr<Node> toElement() const;
+    WEBCORE_EXPORT RefPtr<Node> fromElement() const;
 
     DataTransfer* dataTransfer() const { return isDragEvent() ? m_dataTransfer.get() : nullptr; }
 
index 58cf300..2d9b49a 100644 (file)
@@ -146,7 +146,7 @@ void MouseRelatedEvent::receivedTarget()
 
 void MouseRelatedEvent::computeRelativePosition()
 {
-    RefPtr<Node> targetNode = target() ? target()->toNode() : nullptr;
+    auto targetNode = target() ? target()->toNode() : nullptr;
     if (!targetNode)
         return;
 
index 1cae7e8..6d6dbd4 100644 (file)
@@ -356,7 +356,7 @@ void Node::clearRareData()
     clearFlag(HasRareDataFlag);
 }
 
-Node* Node::toNode()
+RefPtr<Node> Node::toNode()
 {
     return this;
 }
index 3cf7546..a1fc546 100644 (file)
@@ -494,7 +494,7 @@ public:
 
     WEBCORE_EXPORT unsigned short compareDocumentPosition(Node&);
 
-    Node* toNode() override;
+    RefPtr<Node> toNode() override;
 
     EventTargetInterface eventTargetInterface() const override;
     ScriptExecutionContext* scriptExecutionContext() const final; // Implemented in Document.h
index 0feead6..f4b32f3 100644 (file)
@@ -34,6 +34,7 @@
 #include "Event.h"
 #include "EventDispatcher.h"
 #include "EventTarget.h"
+#include "Node.h"
 #include <wtf/NeverDestroyed.h>
 
 namespace WebCore {
index 2ad24f4..0ad9ede 100644 (file)
@@ -233,7 +233,7 @@ VisibleSelection Editor::selectionForCommand(Event* event)
     // If the target is a text control, and the current selection is outside of its shadow tree,
     // then use the saved selection for that text control.
     HTMLTextFormControlElement* textFormControlOfSelectionStart = enclosingTextFormControl(selection.start());
-    HTMLTextFormControlElement* textFromControlOfTarget = is<HTMLTextFormControlElement>(*event->target()->toNode()) ? downcast<HTMLTextFormControlElement>(event->target()->toNode()) : nullptr;
+    HTMLTextFormControlElement* textFromControlOfTarget = is<HTMLTextFormControlElement>(*event->target()->toNode()) ? downcast<HTMLTextFormControlElement>(event->target()->toNode().get()) : nullptr;
     if (textFromControlOfTarget && (selection.start().isNull() || textFromControlOfTarget != textFormControlOfSelectionStart)) {
         if (RefPtr<Range> range = textFromControlOfTarget->selection())
             return VisibleSelection(*range, DOWNSTREAM, selection.isDirectional());
index e729a0b..b75f763 100644 (file)
@@ -89,7 +89,7 @@ static Frame* targetFrame(Frame& frame, Event* event)
 {
     if (!event)
         return &frame;
-    Node* node = event->target()->toNode();
+    auto node = event->target()->toNode();
     if (!node)
         return &frame;
     return node->document().frame();
index eba9f9f..4fd41b1 100644 (file)
@@ -878,7 +878,7 @@ bool TextIterator::handleReplacedElement()
     }
 
     if ((m_behavior & TextIteratorEntersTextControls) && is<RenderTextControl>(renderer)) {
-        if (TextControlInnerTextElement* innerTextElement = downcast<RenderTextControl>(renderer).textFormControlElement().innerTextElement()) {
+        if (auto innerTextElement = downcast<RenderTextControl>(renderer).textFormControlElement().innerTextElement()) {
             m_node = innerTextElement->containingShadowRoot();
             pushFullyClippedState(m_fullyClippedStack, *m_node);
             m_offset = 0;
index 4370662..4e39c6f 100644 (file)
@@ -69,8 +69,8 @@ void BaseChooserOnlyDateAndTimeInputType::createShadowSubtree()
 
 void BaseChooserOnlyDateAndTimeInputType::updateAppearance()
 {
-    Node* node = element().userAgentShadowRoot()->firstChild();
-    if (!is<HTMLElement>(node))
+    RefPtr<Node> node = element().userAgentShadowRoot()->firstChild();
+    if (!is<HTMLElement>(node.get()))
         return;
     String displayValue = visibleValue();
     if (displayValue.isEmpty()) {
index d03f678..828f5b8 100644 (file)
@@ -207,7 +207,7 @@ void ColorInputType::endColorChooser()
 
 void ColorInputType::updateColorSwatch()
 {
-    HTMLElement* colorSwatch = shadowColorSwatch();
+    RefPtr<HTMLElement> colorSwatch = shadowColorSwatch();
     if (!colorSwatch)
         return;
 
@@ -216,7 +216,7 @@ void ColorInputType::updateColorSwatch()
 
 HTMLElement* ColorInputType::shadowColorSwatch() const
 {
-    ShadowRoot* shadow = element().userAgentShadowRoot();
+    RefPtr<ShadowRoot> shadow = element().userAgentShadowRoot();
     if (!shadow)
         return nullptr;
 
index 50c0329..eae34e4 100644 (file)
@@ -284,7 +284,7 @@ void FileInputType::disabledAttributeChanged()
 {
     ASSERT(element().shadowRoot());
 
-    auto* root = element().userAgentShadowRoot();
+    auto root = element().userAgentShadowRoot();
     if (!root)
         return;
     
@@ -296,7 +296,7 @@ void FileInputType::multipleAttributeChanged()
 {
     ASSERT(element().shadowRoot());
 
-    auto* root = element().userAgentShadowRoot();
+    auto root = element().userAgentShadowRoot();
     if (!root)
         return;
 
index 76ab44f..943dd73 100644 (file)
@@ -107,11 +107,10 @@ HTMLFormElement* FormAssociatedElement::findAssociatedForm(const HTMLElement* el
         // the first element in the document to have an ID that equal to
         // the value of form attribute, so we put the result of
         // treeScope().getElementById() over the given element.
-        HTMLFormElement* newForm = nullptr;
-        Element* newFormCandidate = element->treeScope().getElementById(formId);
-        if (is<HTMLFormElement>(newFormCandidate))
-            newForm = downcast<HTMLFormElement>(newFormCandidate);
-        return newForm;
+        RefPtr<Element> newFormCandidate = element->treeScope().getElementById(formId);
+        if (is<HTMLFormElement>(newFormCandidate.get()))
+            return downcast<HTMLFormElement>(newFormCandidate.get());
+        return nullptr;
     }
 
     if (!currentAssociatedForm)
@@ -123,7 +122,7 @@ HTMLFormElement* FormAssociatedElement::findAssociatedForm(const HTMLElement* el
 void FormAssociatedElement::formOwnerRemovedFromTree(const Node& formRoot)
 {
     ASSERT(m_form);
-    Node* rootNode = &asHTMLElement();
+    RefPtr<Node> rootNode = &asHTMLElement();
     for (auto* ancestor = asHTMLElement().parentNode(); ancestor; ancestor = ancestor->parentNode()) {
         if (ancestor == m_form) {
             // Form is our ancestor so we don't need to reset our owner, we also no longer
@@ -172,7 +171,7 @@ void FormAssociatedElement::formWillBeDestroyed()
 
 void FormAssociatedElement::resetFormOwner()
 {
-    HTMLFormElement* originalForm = m_form;
+    RefPtr<HTMLFormElement> originalForm = m_form;
     setForm(findAssociatedForm(&asHTMLElement(), m_form));
     HTMLElement& element = asHTMLElement();
     if (m_form && m_form != originalForm && m_form->isConnected())
@@ -184,7 +183,7 @@ void FormAssociatedElement::formAttributeChanged()
     HTMLElement& element = asHTMLElement();
     if (!element.hasAttributeWithoutSynchronization(formAttr)) {
         // The form attribute removed. We need to reset form owner here.
-        HTMLFormElement* originalForm = m_form;
+        RefPtr<HTMLFormElement> originalForm = m_form;
         setForm(HTMLFormElement::findClosestFormAncestor(element));
         if (m_form && m_form != originalForm && m_form->isConnected())
             element.document().didAssociateFormControl(&element);
index f9fe4b4..001e5a8 100644 (file)
@@ -303,7 +303,7 @@ static inline void recordFormStructure(const HTMLFormElement& form, StringBuilde
     for (size_t i = 0, namedControls = 0; i < controls.size() && namedControls < namedControlsToBeRecorded; ++i) {
         if (!controls[i]->isFormControlElementWithState())
             continue;
-        HTMLFormControlElementWithState* control = static_cast<HTMLFormControlElementWithState*>(controls[i]);
+        RefPtr<HTMLFormControlElementWithState> control = static_cast<HTMLFormControlElementWithState*>(controls[i]);
         if (!ownerFormForState(*control))
             continue;
         AtomicString name = control->name();
@@ -332,12 +332,12 @@ static inline String formSignature(const HTMLFormElement& form)
 
 AtomicString FormKeyGenerator::formKey(const HTMLFormControlElementWithState& control)
 {
-    HTMLFormElement* form = ownerFormForState(control);
+    RefPtr<HTMLFormElement> form = ownerFormForState(control);
     if (!form) {
         static NeverDestroyed<AtomicString> formKeyForNoOwner("No owner", AtomicString::ConstructFromLiteral);
         return formKeyForNoOwner;
     }
-    FormToKeyMap::const_iterator it = m_formToKeyMap.find(form);
+    FormToKeyMap::const_iterator it = m_formToKeyMap.find(form.get());
     if (it != m_formToKeyMap.end())
         return it->value;
 
@@ -351,7 +351,7 @@ AtomicString FormKeyGenerator::formKey(const HTMLFormControlElementWithState& co
     builder.appendLiteral(" #");
     builder.appendNumber(nextIndex);
     AtomicString formKey = builder.toAtomicString();
-    m_formToKeyMap.add(form, formKey);
+    m_formToKeyMap.add(form.get(), formKey);
     return formKey;
 }
 
@@ -488,7 +488,7 @@ void FormController::restoreControlStateIn(HTMLFormElement& form)
     for (auto& element : form.associatedElements()) {
         if (!element->isFormControlElementWithState())
             continue;
-        HTMLFormControlElementWithState* control = static_cast<HTMLFormControlElementWithState*>(element);
+        RefPtr<HTMLFormControlElementWithState> control = static_cast<HTMLFormControlElementWithState*>(element);
         if (!control->shouldSaveAndRestoreFormControlState())
             continue;
         if (ownerFormForState(*control) != &form)
index 4881c3d..2a5f79c 100644 (file)
@@ -145,7 +145,7 @@ static void appendServerMapMousePosition(StringBuilder& url, Event& event)
     auto& mouseEvent = downcast<MouseEvent>(event);
 
     ASSERT(mouseEvent.target());
-    auto* target = mouseEvent.target()->toNode();
+    auto target = mouseEvent.target()->toNode();
     ASSERT(target);
     if (!is<HTMLImageElement>(*target))
         return;
@@ -366,7 +366,7 @@ void HTMLAnchorElement::handleClick(Event& event)
 {
     event.setDefaultHandled();
 
-    Frame* frame = document().frame();
+    RefPtr<Frame> frame = document().frame();
     if (!frame)
         return;
 
index 85db438..0fb11d9 100644 (file)
@@ -171,7 +171,7 @@ void HTMLAppletElement::updateWidget(CreatePlugins createPlugins)
         paramValues.append(param.value());
     }
 
-    Frame* frame = document().frame();
+    RefPtr<Frame> frame = document().frame();
     ASSERT(frame);
 
     renderer->setWidget(frame->loader().subframeLoader().createJavaAppletWidget(roundedIntSize(LayoutSize(contentWidth, contentHeight)), *this, paramNames, paramValues));
index 3a51f25..d89210e 100644 (file)
@@ -187,8 +187,8 @@ Path HTMLAreaElement::getRegion(const LayoutSize& size) const
 
 HTMLImageElement* HTMLAreaElement::imageElement() const
 {
-    Node* mapElement = parentNode();
-    if (!is<HTMLMapElement>(mapElement))
+    RefPtr<Node> mapElement = parentNode();
+    if (!is<HTMLMapElement>(mapElement.get()))
         return nullptr;
     
     return downcast<HTMLMapElement>(*mapElement).imageElement();
@@ -206,7 +206,7 @@ bool HTMLAreaElement::isMouseFocusable() const
 
 bool HTMLAreaElement::isFocusable() const
 {
-    HTMLImageElement* image = imageElement();
+    RefPtr<HTMLImageElement> image = imageElement();
     if (!image || !image->renderer() || image->renderer()->style().visibility() != VISIBLE)
         return false;
 
@@ -220,7 +220,7 @@ void HTMLAreaElement::setFocus(bool shouldBeFocused)
 
     HTMLAnchorElement::setFocus(shouldBeFocused);
 
-    HTMLImageElement* imageElement = this->imageElement();
+    RefPtr<HTMLImageElement> imageElement = this->imageElement();
     if (!imageElement)
         return;
 
@@ -236,7 +236,7 @@ void HTMLAreaElement::updateFocusAppearance(SelectionRestorationMode restoration
     if (!isFocusable())
         return;
 
-    HTMLImageElement* imageElement = this->imageElement();
+    RefPtr<HTMLImageElement> imageElement = this->imageElement();
     if (!imageElement)
         return;
 
index 0a36471..e1f2b0d 100644 (file)
@@ -245,10 +245,10 @@ int HTMLBodyElement::scrollLeft()
 {
     if (isFirstBodyElementOfDocument()) {
         document().updateLayoutIgnorePendingStylesheets();
-        Frame* frame = document().frame();
+        RefPtr<Frame> frame = document().frame();
         if (!frame)
             return 0;
-        FrameView* view = frame->view();
+        RefPtr<FrameView> view = frame->view();
         if (!view)
             return 0;
         return adjustForZoom(view->contentsScrollPosition().x(), *frame);
@@ -260,10 +260,10 @@ void HTMLBodyElement::setScrollLeft(int scrollLeft)
 {
     if (isFirstBodyElementOfDocument()) {
         document().updateLayoutIgnorePendingStylesheets();
-        Frame* frame = document().frame();
+        RefPtr<Frame> frame = document().frame();
         if (!frame)
             return;
-        FrameView* view = frame->view();
+        RefPtr<FrameView> view = frame->view();
         if (!view)
             return;
         view->setScrollPosition(IntPoint(static_cast<int>(scrollLeft * frame->pageZoomFactor() * frame->frameScaleFactor()), view->scrollY()));
@@ -275,10 +275,10 @@ int HTMLBodyElement::scrollTop()
 {
     if (isFirstBodyElementOfDocument()) {
         document().updateLayoutIgnorePendingStylesheets();
-        Frame* frame = document().frame();
+        RefPtr<Frame> frame = document().frame();
         if (!frame)
             return 0;
-        FrameView* view = frame->view();
+        RefPtr<FrameView> view = frame->view();
         if (!view)
             return 0;
         return adjustForZoom(view->contentsScrollPosition().y(), *frame);
@@ -290,10 +290,10 @@ void HTMLBodyElement::setScrollTop(int scrollTop)
 {
     if (isFirstBodyElementOfDocument()) {
         document().updateLayoutIgnorePendingStylesheets();
-        Frame* frame = document().frame();
+        RefPtr<Frame> frame = document().frame();
         if (!frame)
             return;
-        FrameView* view = frame->view();
+        RefPtr<FrameView> view = frame->view();
         if (!view)
             return;
         view->setScrollPosition(IntPoint(view->scrollX(), static_cast<int>(scrollTop * frame->pageZoomFactor() * frame->frameScaleFactor())));
@@ -323,10 +323,10 @@ int HTMLBodyElement::scrollHeight()
     if (isFirstBodyElementOfDocument()) {
         // Update the document's layout.
         document().updateLayoutIgnorePendingStylesheets();
-        Frame* frame = document().frame();
+        RefPtr<Frame> frame = document().frame();
         if (!frame)
             return 0;
-        FrameView* view = frame->view();
+        RefPtr<FrameView> view = frame->view();
         if (!view)
             return 0;
         return adjustForZoom(view->contentsHeight(), *frame);
@@ -339,10 +339,10 @@ int HTMLBodyElement::scrollWidth()
     if (isFirstBodyElementOfDocument()) {
         // Update the document's layout.
         document().updateLayoutIgnorePendingStylesheets();
-        Frame* frame = document().frame();
+        RefPtr<Frame> frame = document().frame();
         if (!frame)
             return 0;
-        FrameView* view = frame->view();
+        RefPtr<FrameView> view = frame->view();
         if (!view)
             return 0;
         return adjustForZoom(view->contentsWidth(), *frame);
index dccaa0f..74d1b28 100644 (file)
@@ -156,7 +156,7 @@ void HTMLCanvasElement::parseAttribute(const QualifiedName& name, const AtomicSt
 
 RenderPtr<RenderElement> HTMLCanvasElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition& insertionPosition)
 {
-    Frame* frame = document().frame();
+    RefPtr<Frame> frame = document().frame();
     if (frame && frame->script().canExecuteScripts(NotAboutToExecuteScript))
         return createRenderer<RenderHTMLCanvas>(*this, WTFMove(style));
     return HTMLElement::createElementRenderer(WTFMove(style), insertionPosition);
@@ -197,8 +197,8 @@ HashSet<Element*> HTMLCanvasElement::cssCanvasClients() const
 
         auto clients = downcast<CSSCanvasValue::CanvasObserverProxy>(observer)->ownerValue().clients();
         for (auto& entry : clients) {
-            if (Element* element = entry.key->element())
-                cssCanvasClients.add(element);
+            if (RefPtr<Element> element = entry.key->element())
+                cssCanvasClients.add(element.get());
         }
     }
     return cssCanvasClients;
index cbdfdd3..2e792d9 100644 (file)
@@ -95,14 +95,14 @@ HTMLDocument::~HTMLDocument()
 int HTMLDocument::width()
 {
     updateLayoutIgnorePendingStylesheets();
-    FrameView* frameView = view();
+    RefPtr<FrameView> frameView = view();
     return frameView ? frameView->contentsWidth() : 0;
 }
 
 int HTMLDocument::height()
 {
     updateLayoutIgnorePendingStylesheets();
-    FrameView* frameView = view();
+    RefPtr<FrameView> frameView = view();
     return frameView ? frameView->contentsHeight() : 0;
 }
 
index 0b9283c..ea581c4 100644 (file)
@@ -716,11 +716,11 @@ void HTMLElement::setTranslate(bool enable)
 bool HTMLElement::rendererIsNeeded(const RenderStyle& style)
 {
     if (hasTagName(noscriptTag)) {
-        Frame* frame = document().frame();
+        RefPtr<Frame> frame = document().frame();
         if (frame && frame->script().canExecuteScripts(NotAboutToExecuteScript))
             return false;
     } else if (hasTagName(noembedTag)) {
-        Frame* frame = document().frame();
+        RefPtr<Frame> frame = document().frame();
         if (frame && frame->loader().subframeLoader().allowPlugins())
             return false;
     }
@@ -749,7 +749,7 @@ static void setHasDirAutoFlagRecursively(Node* firstNode, bool flag, Node* lastN
 {
     firstNode->setSelfOrAncestorHasDirAutoAttribute(flag);
 
-    Node* node = firstNode->firstChild();
+    RefPtr<Node> node = firstNode->firstChild();
 
     while (node) {
         if (node->selfOrAncestorHasDirAutoAttribute() == flag)
@@ -802,7 +802,7 @@ TextDirection HTMLElement::directionality(Node** strongDirectionalityTextNode) c
         return (textDirection == U_LEFT_TO_RIGHT) ? LTR : RTL;
     }
 
-    Node* node = firstChild();
+    RefPtr<Node> node = firstChild();
     while (node) {
         // Skip bdi, script, style and text form controls.
         if (equalLettersIgnoringASCIICase(node->nodeName(), "bdi") || node->hasTagName(scriptTag) || node->hasTagName(styleTag)
@@ -825,7 +825,7 @@ TextDirection HTMLElement::directionality(Node** strongDirectionalityTextNode) c
             UCharDirection textDirection = node->textContent(true).defaultWritingDirection(&hasStrongDirectionality);
             if (hasStrongDirectionality) {
                 if (strongDirectionalityTextNode)
-                    *strongDirectionalityTextNode = node;
+                    *strongDirectionalityTextNode = node.get();
                 return (textDirection == U_LEFT_TO_RIGHT) ? LTR : RTL;
             }
         }
@@ -838,9 +838,9 @@ TextDirection HTMLElement::directionality(Node** strongDirectionalityTextNode) c
 
 void HTMLElement::dirAttributeChanged(const AtomicString& value)
 {
-    Element* parent = parentElement();
+    RefPtr<Element> parent = parentElement();
 
-    if (is<HTMLElement>(parent) && parent->selfOrAncestorHasDirAutoAttribute())
+    if (is<HTMLElement>(parent.get()) && parent->selfOrAncestorHasDirAutoAttribute())
         downcast<HTMLElement>(*parent).adjustDirectionalityIfNeededAfterChildAttributeChanged(this);
 
     if (equalLettersIgnoringASCIICase(value, "auto"))
@@ -879,14 +879,14 @@ void HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged(Element* befo
     if (!selfOrAncestorHasDirAutoAttribute())
         return;
 
-    Node* oldMarkedNode = nullptr;
+    RefPtr<Node> oldMarkedNode;
     if (beforeChange)
         oldMarkedNode = changeType == ElementInserted ? ElementTraversal::nextSibling(*beforeChange) : beforeChange->nextSibling();
 
     while (oldMarkedNode && elementAffectsDirectionality(*oldMarkedNode))
         oldMarkedNode = oldMarkedNode->nextSibling();
     if (oldMarkedNode)
-        setHasDirAutoFlagRecursively(oldMarkedNode, false);
+        setHasDirAutoFlagRecursively(oldMarkedNode.get(), false);
 
     for (auto& elementToAdjust : lineageOfType<HTMLElement>(*this)) {
         if (elementAffectsDirectionality(elementToAdjust)) {
index 354c551..ccc6634 100644 (file)
@@ -77,7 +77,7 @@ static inline RenderWidget* findWidgetRenderer(const Node* node)
 
 RenderWidget* HTMLEmbedElement::renderWidgetLoadingPlugin() const
 {
-    FrameView* view = document().view();
+    RefPtr<FrameView> view = document().view();
     if (!view || (!view->isInRenderTreeLayout() && !view->isPainting())) {
         // Needs to load the plugin immediatedly because this function is called
         // when JavaScript code accesses the plugin.
@@ -199,8 +199,8 @@ bool HTMLEmbedElement::rendererIsNeeded(const RenderStyle& style)
 
     // If my parent is an <object> and is not set to use fallback content, I
     // should be ignored and not get a renderer.
-    ContainerNode* parent = parentNode();
-    if (is<HTMLObjectElement>(parent)) {
+    RefPtr<ContainerNode> parent = parentNode();
+    if (is<HTMLObjectElement>(parent.get())) {
         if (!parent->renderer())
             return false;
         if (!downcast<HTMLObjectElement>(*parent).useFallbackContent()) {
index 35c9a7a..6fbd38e 100644 (file)
@@ -57,7 +57,7 @@ Ref<HTMLFieldSetElement> HTMLFieldSetElement::create(const QualifiedName& tagNam
 
 static void updateFromControlElementsAncestorDisabledStateUnder(HTMLElement& startNode, bool isDisabled)
 {
-    HTMLFormControlElement* control;
+    RefPtr<HTMLFormControlElement> control;
     if (is<HTMLFormControlElement>(startNode))
         control = &downcast<HTMLFormControlElement>(startNode);
     else
@@ -96,7 +96,7 @@ void HTMLFieldSetElement::disabledStateChanged()
 
     bool thisFieldsetIsDisabled = hasAttributeWithoutSynchronization(disabledAttr);
     bool hasSeenFirstLegendElement = false;
-    for (HTMLElement* control = Traversal<HTMLElement>::firstChild(*this); control; control = Traversal<HTMLElement>::nextSibling(*control)) {
+    for (RefPtr<HTMLElement> control = Traversal<HTMLElement>::firstChild(*this); control; control = Traversal<HTMLElement>::nextSibling(*control)) {
         if (!hasSeenFirstLegendElement && is<HTMLLegendElement>(*control)) {
             hasSeenFirstLegendElement = true;
             updateFromControlElementsAncestorDisabledStateUnder(*control, false /* isDisabled */);
@@ -112,7 +112,7 @@ void HTMLFieldSetElement::childrenChanged(const ChildChange& change)
     if (!hasAttributeWithoutSynchronization(disabledAttr))
         return;
 
-    HTMLLegendElement* legend = Traversal<HTMLLegendElement>::firstChild(*this);
+    RefPtr<HTMLLegendElement> legend = Traversal<HTMLLegendElement>::firstChild(*this);
     if (!legend)
         return;
 
index 7096d10..6aecae6 100644 (file)
@@ -120,11 +120,11 @@ void HTMLFormControlElement::setFormAction(const AtomicString& value)
 
 bool HTMLFormControlElement::computeIsDisabledByFieldsetAncestor() const
 {
-    Element* previousAncestor = nullptr;
-    for (Element* ancestor = parentElement(); ancestor; ancestor = ancestor->parentElement()) {
+    RefPtr<Element> previousAncestor;
+    for (RefPtr<Element> ancestor = parentElement(); ancestor; ancestor = ancestor->parentElement()) {
         if (is<HTMLFieldSetElement>(*ancestor) && ancestor->hasAttributeWithoutSynchronization(disabledAttr)) {
             HTMLFieldSetElement& fieldSetAncestor = downcast<HTMLFieldSetElement>(*ancestor);
-            bool isInFirstLegend = is<HTMLLegendElement>(previousAncestor) && previousAncestor == fieldSetAncestor.legend();
+            bool isInFirstLegend = is<HTMLLegendElement>(previousAncestor.get()) && previousAncestor == fieldSetAncestor.legend();
             return !isInFirstLegend;
         }
         previousAncestor = ancestor;
@@ -448,7 +448,7 @@ void HTMLFormControlElement::setNeedsWillValidateCheck()
 
     if (!m_willValidate && !wasValid) {
         removeInvalidElementToAncestorFromInsertionPoint(*this, parentNode());
-        if (HTMLFormElement* form = this->form())
+        if (RefPtr<HTMLFormElement> form = this->form())
             form->removeInvalidAssociatedFormControlIfNeeded(*this);
     }
 
@@ -544,7 +544,7 @@ void HTMLFormControlElement::willChangeForm()
 void HTMLFormControlElement::didChangeForm()
 {
     FormAssociatedElement::didChangeForm();
-    if (HTMLFormElement* form = this->form()) {
+    if (RefPtr<HTMLFormElement> form = this->form()) {
         if (m_willValidateInitialized && m_willValidate && !isValidFormControlElement())
             form->registerInvalidAssociatedFormControl(*this);
     }
@@ -606,7 +606,7 @@ bool HTMLFormControlElement::shouldAutocorrect() const
     const AtomicString& autocorrectValue = attributeWithoutSynchronization(autocorrectAttr);
     if (!autocorrectValue.isEmpty())
         return !equalLettersIgnoringASCIICase(autocorrectValue, "off");
-    if (HTMLFormElement* form = this->form())
+    if (RefPtr<HTMLFormElement> form = this->form())
         return form->shouldAutocorrect();
     return true;
 }
@@ -615,7 +615,7 @@ AutocapitalizeType HTMLFormControlElement::autocapitalizeType() const
 {
     AutocapitalizeType type = HTMLElement::autocapitalizeType();
     if (type == AutocapitalizeTypeDefault) {
-        if (HTMLFormElement* form = this->form())
+        if (RefPtr<HTMLFormElement> form = this->form())
             return form->autocapitalizeType();
     }
     return type;
index 4fc09b7..e04059b 100644 (file)
@@ -140,7 +140,7 @@ void HTMLFormElement::removedFrom(ContainerNode& insertionPoint)
 
 void HTMLFormElement::handleLocalEvents(Event& event)
 {
-    Node* targetNode = event.target()->toNode();
+    auto targetNode = event.target()->toNode();
     if (event.eventPhase() != Event::CAPTURING_PHASE && targetNode && targetNode != this && (event.type() == eventNames().submitEvent || event.type() == eventNames().resetEvent)) {
         event.stopPropagation();
         return;
@@ -206,11 +206,11 @@ void HTMLFormElement::submitImplicitly(Event& event, bool fromImplicitSubmission
         prepareForSubmission(event);
 }
 
-static inline HTMLFormControlElement* submitElementFromEvent(const Event& event)
+static inline RefPtr<HTMLFormControlElement> submitElementFromEvent(const Event& event)
 {
-    for (Node* node = event.target()->toNode(); node; node = node->parentNode()) {
+    for (RefPtr<Node> node = event.target()->toNode(); node; node = node->parentNode()) {
         if (is<HTMLFormControlElement>(*node))
-            return downcast<HTMLFormControlElement>(node);
+            return downcast<HTMLFormControlElement>(node.get());
     }
     return nullptr;
 }
@@ -260,7 +260,7 @@ void HTMLFormElement::prepareForSubmission(Event& event)
     if (!isConnected())
         return;
 
-    Frame* frame = document().frame();
+    RefPtr<Frame> frame = document().frame();
     if (m_isSubmittingOrPreparingForSubmission || !frame)
         return;
 
@@ -269,7 +269,7 @@ void HTMLFormElement::prepareForSubmission(Event& event)
 
     bool shouldValidate = document().page() && document().page()->settings().interactiveFormValidationEnabled() && !noValidate();
 
-    HTMLFormControlElement* submitElement = submitElementFromEvent(event);
+    auto submitElement = submitElementFromEvent(event);
     if (submitElement && submitElement->formNoValidate())
         shouldValidate = false;
 
@@ -322,8 +322,8 @@ StringPairVector HTMLFormElement::textFieldValues() const
 
 void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool processingUserGesture, FormSubmissionTrigger formSubmissionTrigger)
 {
-    FrameView* view = document().view();
-    Frame* frame = document().frame();
+    RefPtr<FrameView> view = document().view();
+    RefPtr<Frame> frame = document().frame();
     if (!view || !frame)
         return;
 
@@ -367,7 +367,7 @@ void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool proce
 
 void HTMLFormElement::reset()
 {
-    Frame* frame = document().frame();
+    RefPtr<Frame> frame = document().frame();
     if (m_isInResetFunction || !frame)
         return;
 
@@ -406,7 +406,7 @@ bool HTMLFormElement::shouldAutocorrect() const
     const AtomicString& autocorrectValue = attributeWithoutSynchronization(autocorrectAttr);
     if (!autocorrectValue.isEmpty())
         return !equalLettersIgnoringASCIICase(autocorrectValue, "off");
-    if (HTMLFormElement* form = this->form())
+    if (RefPtr<HTMLFormElement> form = this->form())
         return form->shouldAutocorrect();
     return true;
 }
@@ -419,7 +419,7 @@ void HTMLFormElement::parseAttribute(const QualifiedName& name, const AtomicStri
         m_attributes.parseAction(value);
         
         if (!m_attributes.action().isEmpty()) {
-            if (Frame* f = document().frame()) {
+            if (RefPtr<Frame> f = document().frame()) {
                 Frame& topFrame = f->tree().top();
                 topFrame.loader().mixedContentChecker().checkFormForMixedContent(topFrame.document()->securityOrigin(), document().completeURL(m_attributes.action()));
             }
@@ -672,7 +672,7 @@ void HTMLFormElement::resetDefaultButton()
         return;
     }
 
-    HTMLFormControlElement* oldDefault = m_defaultButton;
+    RefPtr<HTMLFormControlElement> oldDefault = m_defaultButton;
     m_defaultButton = nullptr;
     defaultButton();
     if (m_defaultButton != oldDefault) {
@@ -735,7 +735,7 @@ inline void HTMLFormElement::assertItemCanBeInPastNamesMap(FormNamedItem*) const
 }
 #endif
 
-HTMLElement* HTMLFormElement::elementFromPastNamesMap(const AtomicString& pastName) const
+RefPtr<HTMLElement> HTMLFormElement::elementFromPastNamesMap(const AtomicString& pastName) const
 {
     if (pastName.isEmpty() || !m_pastNamesMap)
         return nullptr;
@@ -784,7 +784,7 @@ Vector<Ref<Element>> HTMLFormElement::namedElements(const AtomicString& name)
     // http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#dom-form-nameditem
     Vector<Ref<Element>> namedItems = elements()->namedItems(name);
 
-    HTMLElement* elementFromPast = elementFromPastNamesMap(name);
+    auto elementFromPast = elementFromPastNamesMap(name);
     if (namedItems.size() == 1 && namedItems.first().ptr() != elementFromPast)
         addToPastNamesMap(downcast<HTMLElement>(namedItems.first().get()).asFormNamedItem(), name);
     else if (elementFromPast && namedItems.isEmpty())
index 5838080..4e2521d 100644 (file)
@@ -151,7 +151,7 @@ private:
     // are any invalid controls in this form.
     bool checkInvalidControlsAndCollectUnhandled(Vector<RefPtr<HTMLFormControlElement>>&);
 
-    HTMLElement* elementFromPastNamesMap(const AtomicString&) const;
+    RefPtr<HTMLElement> elementFromPastNamesMap(const AtomicString&) const;
     void addToPastNamesMap(FormNamedItem*, const AtomicString& pastName);
     void assertItemCanBeInPastNamesMap(FormNamedItem*) const;
     void removeFromPastNamesMap(FormNamedItem*);
index 39332a2..8e0679c 100644 (file)
@@ -64,7 +64,7 @@ bool HTMLFrameElement::noResize() const
 void HTMLFrameElement::didAttachRenderers()
 {
     HTMLFrameElementBase::didAttachRenderers();
-    const HTMLFrameSetElement* containingFrameSet = HTMLFrameSetElement::findContaining(this);
+    const auto containingFrameSet = HTMLFrameSetElement::findContaining(this);
     if (!containingFrameSet)
         return;
     if (!m_frameBorderSet)
index 4f7cd92..d4d539b 100644 (file)
@@ -69,12 +69,12 @@ bool HTMLFrameElementBase::isURLAllowed(const URL& completeURL) const
         return true;
 
     if (protocolIsJavaScript(completeURL)) {
-        Document* contentDoc = this->contentDocument();
+        RefPtr<Document> contentDoc = this->contentDocument();
         if (contentDoc && !ScriptController::canAccessFromCurrentOrigin(contentDoc->frame()))
             return false;
     }
 
-    Frame* parentFrame = document().frame();
+    RefPtr<Frame> parentFrame = document().frame();
     if (parentFrame)
         return parentFrame->isURLAllowed(completeURL);
 
@@ -89,7 +89,7 @@ void HTMLFrameElementBase::openURL(LockHistory lockHistory, LockBackForwardList
     if (m_URL.isEmpty())
         m_URL = blankURL().string();
 
-    Frame* parentFrame = document().frame();
+    RefPtr<Frame> parentFrame = document().frame();
     if (!parentFrame)
         return;
 
@@ -166,7 +166,7 @@ void HTMLFrameElementBase::didFinishInsertingNode()
 void HTMLFrameElementBase::didAttachRenderers()
 {
     if (RenderWidget* part = renderWidget()) {
-        if (Frame* frame = contentFrame())
+        if (RefPtr<Frame> frame = contentFrame())
             part->setWidget(frame->view());
     }
 }
index e78b6b1..17d8460 100644 (file)
@@ -57,7 +57,7 @@ void HTMLFrameOwnerElement::setContentFrame(Frame* frame)
     ASSERT(isConnected());
     m_contentFrame = frame;
 
-    for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode())
+    for (RefPtr<ContainerNode> node = this; node; node = node->parentOrShadowHostNode())
         node->incrementConnectedSubframeCount();
 }
 
@@ -68,7 +68,7 @@ void HTMLFrameOwnerElement::clearContentFrame()
 
     m_contentFrame = 0;
 
-    for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode())
+    for (RefPtr<ContainerNode> node = this; node; node = node->parentOrShadowHostNode())
         node->decrementConnectedSubframeCount();
 }
 
@@ -78,7 +78,7 @@ void HTMLFrameOwnerElement::disconnectContentFrame()
     // unload event in the subframe which could execute script that could then
     // reach up into this document and then attempt to look back down. We should
     // see if this behavior is really needed as Gecko does not allow this.
-    if (Frame* frame = contentFrame()) {
+    if (RefPtr<Frame> frame = contentFrame()) {
         Ref<Frame> protect(*frame);
         frame->loader().frameDetached();
         frame->disconnectOwnerElement();
@@ -133,8 +133,8 @@ void HTMLFrameOwnerElement::scheduleInvalidateStyleAndLayerComposition()
 
 bool SubframeLoadingDisabler::canLoadFrame(HTMLFrameOwnerElement& owner)
 {
-    for (ContainerNode* node = &owner; node; node = node->parentOrShadowHostNode()) {
-        if (disabledSubtreeRoots().contains(node))
+    for (RefPtr<ContainerNode> node = &owner; node; node = node->parentOrShadowHostNode()) {
+        if (disabledSubtreeRoots().contains(node.get()))
             return false;
     }
     return true;
index dd0b0ef..737fdb7 100644 (file)
@@ -167,7 +167,7 @@ RenderPtr<RenderElement> HTMLFrameSetElement::createElementRenderer(RenderStyle&
     return createRenderer<RenderFrameSet>(*this, WTFMove(style));
 }
 
-HTMLFrameSetElement* HTMLFrameSetElement::findContaining(Element* descendant)
+RefPtr<HTMLFrameSetElement> HTMLFrameSetElement::findContaining(Element* descendant)
 {
     return ancestorsOfType<HTMLFrameSetElement>(*descendant).first();
 }
@@ -176,7 +176,7 @@ void HTMLFrameSetElement::willAttachRenderers()
 {
     // Inherit default settings from parent frameset.
     // FIXME: This is not dynamic.
-    const HTMLFrameSetElement* containingFrameSet = findContaining(this);
+    const auto containingFrameSet = findContaining(this);
     if (!containingFrameSet)
         return;
     if (!m_frameborderSet)
@@ -212,7 +212,7 @@ Node::InsertedIntoResult HTMLFrameSetElement::insertedInto(InsertionType inserti
 {
     HTMLElement::insertedInto(insertionType, parentOfInsertedTree);
     if (insertionType.connectedToDocument) {
-        if (Frame* frame = document().frame())
+        if (RefPtr<Frame> frame = document().frame())
             frame->loader().client().dispatchDidBecomeFrameset(document().isFrameSet());
     }
 
@@ -223,7 +223,7 @@ void HTMLFrameSetElement::removedFrom(ContainerNode& insertionPoint)
 {
     HTMLElement::removedFrom(insertionPoint);
     if (insertionPoint.isConnected()) {
-        if (Frame* frame = document().frame())
+        if (RefPtr<Frame> frame = document().frame())
             frame->loader().client().dispatchDidBecomeFrameset(document().isFrameSet());
     }
 }
index f832c53..46d3805 100644 (file)
@@ -44,7 +44,7 @@ public:
     const Length* rowLengths() const { return m_rowLengths.get(); }
     const Length* colLengths() const { return m_colLengths.get(); }
 
-    static HTMLFrameSetElement* findContaining(Element* descendant);
+    static RefPtr<HTMLFrameSetElement> findContaining(Element* descendant);
     
     Vector<AtomicString> supportedPropertyNames() const;
     DOMWindow* namedItem(const AtomicString&);
index cef7baf..802abc7 100644 (file)
@@ -149,7 +149,7 @@ ImageCandidate HTMLImageElement::bestFitSourceFromPictureElement()
         return { };
     picture->clearViewportDependentResults();
     document().removeViewportDependentPicture(*picture);
-    for (Node* child = picture->firstChild(); child && child != this; child = child->nextSibling()) {
+    for (RefPtr<Node> child = picture->firstChild(); child && child != this; child = child->nextSibling()) {
         if (!is<HTMLSourceElement>(*child))
             continue;
         auto& source = downcast<HTMLSourceElement>(*child);
@@ -350,10 +350,10 @@ HTMLPictureElement* HTMLImageElement::pictureElement() const
 {
     if (!gPictureOwnerMap || !gPictureOwnerMap->contains(this))
         return nullptr;
-    HTMLPictureElement* result = gPictureOwnerMap->get(this).get();
+    auto result = gPictureOwnerMap->get(this);
     if (!result)
         gPictureOwnerMap->remove(this);
-    return result;
+    return result.get();
 }
     
 void HTMLImageElement::setPictureElement(HTMLPictureElement* pictureElement)
@@ -619,11 +619,11 @@ void HTMLImageElement::tryCreateImageControls()
 
 void HTMLImageElement::destroyImageControls()
 {
-    ShadowRoot* shadowRoot = userAgentShadowRoot();
+    auto shadowRoot = userAgentShadowRoot();
     if (!shadowRoot)
         return;
 
-    if (Node* node = shadowRoot->firstChild()) {
+    if (RefPtr<Node> node = shadowRoot->firstChild()) {
         ASSERT_WITH_SECURITY_IMPLICATION(node->isImageControlsRootElement());
         shadowRoot->removeChild(*node);
     }
@@ -637,8 +637,8 @@ void HTMLImageElement::destroyImageControls()
 
 bool HTMLImageElement::hasImageControls() const
 {
-    if (ShadowRoot* shadowRoot = userAgentShadowRoot()) {
-        Node* node = shadowRoot->firstChild();
+    if (auto shadowRoot = userAgentShadowRoot()) {
+        RefPtr<Node> node = shadowRoot->firstChild();
         ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isImageControlsRootElement());
         return node;
     }
index 3fd528d..818f1b0 100644 (file)
@@ -58,6 +58,7 @@
 #include "SearchInputType.h"
 #include "Settings.h"
 #include "StyleResolver.h"
+#include "TextControlInnerElements.h"
 #include <wtf/Language.h>
 #include <wtf/MathExtras.h>
 #include <wtf/Ref.h>
@@ -179,7 +180,7 @@ HTMLElement* HTMLInputElement::containerElement() const
     return m_inputType->containerElement();
 }
 
-TextControlInnerTextElement* HTMLInputElement::innerTextElement() const
+RefPtr<TextControlInnerTextElement> HTMLInputElement::innerTextElement() const
 {
     return m_inputType->innerTextElement();
 }
@@ -454,7 +455,7 @@ void HTMLInputElement::endEditing()
     if (!isTextField())
         return;
 
-    if (Frame* frame = document().frame())
+    if (RefPtr<Frame> frame = document().frame())
         frame->editor().textFieldDidEndEditing(this);
 }
 
@@ -1595,11 +1596,11 @@ HTMLDataListElement* HTMLInputElement::dataList() const
     if (!m_inputType->shouldRespectListAttribute())
         return nullptr;
 
-    Element* element = treeScope().getElementById(attributeWithoutSynchronization(listAttr));
-    if (!is<HTMLDataListElement>(element))
+    RefPtr<Element> element = treeScope().getElementById(attributeWithoutSynchronization(listAttr));
+    if (!is<HTMLDataListElement>(element.get())
         return nullptr;
 
-    return downcast<HTMLDataListElement>(element);
+    return downcast<HTMLDataListElement>(element.get());
 }
 
 void HTMLInputElement::resetListAttributeTargetObserver()
@@ -2058,9 +2059,9 @@ bool HTMLInputElement::setupDateTimeChooserParameters(DateTimeChooserParameters&
     parameters.currentValue = value();
     parameters.isAnchorElementRTL = computedStyle()->direction() == RTL;
 #if ENABLE(DATALIST_ELEMENT)
-    if (HTMLDataListElement* dataList = this->dataList()) {
+    if (RefPtr<HTMLDataListElement> dataList = this->dataList()) {
         Ref<HTMLCollection> options = dataList->options();
-        for (unsigned i = 0; HTMLOptionElement* option = downcast<HTMLOptionElement>(options->item(i)); ++i) {
+        for (unsigned i = 0; RefPtr<HTMLOptionElement> option = downcast<HTMLOptionElement>(options->item(i)); ++i) {
             if (!isValidValue(option->value()))
                 continue;
             parameters.suggestionValues.append(sanitizeValue(option->value()));
index 0596d99..75e9c92 100644 (file)
@@ -134,7 +134,7 @@ public:
 
     HTMLElement* containerElement() const;
     
-    TextControlInnerTextElement* innerTextElement() const final;
+    RefPtr<TextControlInnerTextElement> innerTextElement() const final;
     RenderStyle createInnerTextStyle(const RenderStyle&) const override;
 
     HTMLElement* innerBlockElement() const;
index d46d1ab..adb4ed9 100644 (file)
@@ -145,7 +145,7 @@ bool HTMLKeygenElement::shouldSaveAndRestoreFormControlState() const
 
 HTMLSelectElement* HTMLKeygenElement::shadowSelect() const
 {
-    ShadowRoot* root = userAgentShadowRoot();
+    auto root = userAgentShadowRoot();
     if (!root)
         return nullptr;
 
index 8f5ac0c..055125f 100644 (file)
@@ -117,7 +117,7 @@ void HTMLLabelElement::defaultEventHandler(Event& event)
 
         // If we can't find a control or if the control received the click
         // event, then there's no need for us to do anything.
-        if (!element || (event.target() && element->containsIncludingShadowDOM(event.target()->toNode())))
+        if (!element || (event.target() && element->containsIncludingShadowDOM(event.target()->toNode().get())))
             return;
 
         processingClick = true;
index 1597d7a..ef76426 100644 (file)
@@ -539,7 +539,7 @@ void HTMLLinkElement::handleClick(Event& event)
     URL url = href();
     if (url.isNull())
         return;
-    Frame* frame = document().frame();
+    RefPtr<Frame> frame = document().frame();
     if (!frame)
         return;
     frame->loader().urlSelected(url, target(), &event, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, document().shouldOpenExternalURLsPolicyToPropagate());
index e657018..b144e1e 100644 (file)
@@ -58,7 +58,7 @@ HTMLMapElement::~HTMLMapElement()
 
 bool HTMLMapElement::mapMouseEvent(LayoutPoint location, const LayoutSize& size, HitTestResult& result)
 {
-    HTMLAreaElement* defaultArea = 0;
+    RefPtr<HTMLAreaElement> defaultArea;
 
     for (auto& area : descendantsOfType<HTMLAreaElement>(*this)) {
         if (area.isDefault()) {
@@ -69,8 +69,8 @@ bool HTMLMapElement::mapMouseEvent(LayoutPoint location, const LayoutSize& size,
     }
     
     if (defaultArea) {
-        result.setInnerNode(defaultArea);
-        result.setURLElement(defaultArea);
+        result.setInnerNode(defaultArea.get());
+        result.setURLElement(defaultArea.get());
     }
     return defaultArea;
 }
index d21d6c0..53f1a6c 100644 (file)
@@ -1349,7 +1349,7 @@ void HTMLMediaElement::selectMediaResource()
         m_textTracksWhenResourceSelectionBegan.clear();
         if (m_textTracks) {
             for (unsigned i = 0; i < m_textTracks->length(); ++i) {
-                TextTrack* track = m_textTracks->item(i);
+                RefPtr<TextTrack> track = m_textTracks->item(i);
                 if (track->mode() != TextTrack::Mode::Disabled)
                     m_textTracksWhenResourceSelectionBegan.append(track);
             }
@@ -1496,7 +1496,7 @@ void HTMLMediaElement::loadResource(const URL& initialURL, ContentType& contentT
 
     INFO_LOG(LOGIDENTIFIER, initialURL, contentType.raw(), keySystem);
 
-    Frame* frame = document().frame();
+    RefPtr<Frame> frame = document().frame();
     if (!frame) {
         mediaLoadingFailed(MediaPlayer::FormatError);
         return;
@@ -1729,10 +1729,10 @@ void HTMLMediaElement::updateActiveTextTrackCues(const MediaTime& movieTime)
             activeSetChanged = true;
 
     for (size_t i = 0; i < currentCuesSize; ++i) {
-        TextTrackCue* cue = currentCues[i].data();
+        RefPtr<TextTrackCue> cue = currentCues[i].data();
 
         if (cue->isRenderable())
-            toVTTCue(cue)->updateDisplayTree(movieTime);
+            toVTTCue(cue.get())->updateDisplayTree(movieTime);
 
         if (!cue->isActive())
             activeSetChanged = true;
@@ -2061,10 +2061,10 @@ bool HTMLMediaElement::isSafeToLoadURL(const URL& url, InvalidURLAction actionIf
         return false;
     }
 
-    Frame* frame = document().frame();
+    RefPtr<Frame> frame = document().frame();
     if (!frame || !document().securityOrigin().canDisplay(url)) {
         if (actionIfInvalid == Complain)
-            FrameLoader::reportLocalLoadFailed(frame, url.stringCenterEllipsizedToLength());
+            FrameLoader::reportLocalLoadFailed(frame.get(), url.stringCenterEllipsizedToLength());
             ERROR_LOG(LOGIDENTIFIER, url , " was rejected by SecurityOrigin");
         return false;
     }
@@ -3536,7 +3536,7 @@ void HTMLMediaElement::setLoop(bool b)
 
 bool HTMLMediaElement::controls() const
 {
-    Frame* frame = document().frame();
+    RefPtr<Frame> frame = document().frame();
 
     // always show controls when scripting is disabled
     if (frame && !frame->script().canExecuteScripts(NotAboutToExecuteScript))
@@ -4278,7 +4278,7 @@ void HTMLMediaElement::layoutSizeChanged()
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
     if (auto* frameView = document().view()) {
         auto task = [this, protectedThis = makeRef(*this)] {
-            if (ShadowRoot* root = userAgentShadowRoot())
+            if (auto root = userAgentShadowRoot())
                 root->dispatchEvent(Event::create("resize", false, false));
         };
         frameView->queuePostLayoutCallback(WTFMove(task));
@@ -5769,7 +5769,7 @@ void HTMLMediaElement::enterFullscreen(VideoFullscreenMode mode)
         // If this media element is not going to standard fullscreen mode but there's
         // an element that's currently in full screen in the document, exit full screen
         // if it contains this media element.
-        if (Element* fullscreenElement = document().webkitCurrentFullScreenElement()) {
+        if (RefPtr<Element> fullscreenElement = document().webkitCurrentFullScreenElement()) {
             if (fullscreenElement->contains(this))
                 document().webkitCancelFullScreen();
         }
@@ -6137,7 +6137,7 @@ MediaControls* HTMLMediaElement::mediaControls() const
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
     return nullptr;
 #else
-    ShadowRoot* root = userAgentShadowRoot();
+    auto root = userAgentShadowRoot();
     if (!root)
         return nullptr;
 
@@ -6151,8 +6151,8 @@ bool HTMLMediaElement::hasMediaControls() const
     return false;
 #else
 
-    if (ShadowRoot* userAgent = userAgentShadowRoot()) {
-        Node* node = childrenOfType<MediaControls>(*root).first();
+    if (auto userAgent = userAgentShadowRoot()) {
+        RefPtr<Node> node = childrenOfType<MediaControls>(*root).first();
         ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isMediaControls());
         return node;
     }
@@ -6579,7 +6579,7 @@ HTMLMediaElement::SleepType HTMLMediaElement::shouldDisableSleep() const
 
 String HTMLMediaElement::mediaPlayerReferrer() const
 {
-    Frame* frame = document().frame();
+    RefPtr<Frame> frame = document().frame();
     if (!frame)
         return String();
 
@@ -6588,7 +6588,7 @@ String HTMLMediaElement::mediaPlayerReferrer() const
 
 String HTMLMediaElement::mediaPlayerUserAgent() const
 {
-    Frame* frame = document().frame();
+    RefPtr<Frame> frame = document().frame();
     if (!frame)
         return String();
 
@@ -6781,7 +6781,7 @@ const String& HTMLMediaElement::mediaPlayerMediaCacheDirectory() const
 
 bool HTMLMediaElement::mediaPlayerShouldWaitForResponseToAuthenticationChallenge(const AuthenticationChallenge& challenge)
 {
-    Frame* frame = document().frame();
+    RefPtr<Frame> frame = document().frame();
     if (!frame)
         return false;
 
@@ -6791,18 +6791,18 @@ bool HTMLMediaElement::mediaPlayerShouldWaitForResponseToAuthenticationChallenge
 
     ResourceRequest request(m_currentSrc);
     ResourceLoadNotifier& notifier = frame->loader().notifier();
-    DocumentLoader* documentLoader = document().loader();
+    RefPtr<DocumentLoader> documentLoader = document().loader();
     unsigned long identifier = page->progress().createUniqueIdentifier();
 
-    notifier.assignIdentifierToInitialRequest(identifier, documentLoader, request);
-    notifier.didReceiveAuthenticationChallenge(identifier, documentLoader, challenge);
+    notifier.assignIdentifierToInitialRequest(identifier, documentLoader.get(), request);
+    notifier.didReceiveAuthenticationChallenge(identifier, documentLoader.get(), challenge);
 
     return true;
 }
 
 String HTMLMediaElement::sourceApplicationIdentifier() const
 {
-    if (Frame* frame = document().frame()) {
+    if (RefPtr<Frame> frame = document().frame()) {
         if (NetworkingContext* networkingContext = frame->loader().networkingContext())
             return networkingContext->sourceApplicationIdentifier();
     }
@@ -6917,7 +6917,7 @@ void HTMLMediaElement::updateRateChangeRestrictions()
 #if ENABLE(MEDIA_SOURCE)
 RefPtr<VideoPlaybackQuality> HTMLMediaElement::getVideoPlaybackQuality()
 {
-    DOMWindow* domWindow = document().domWindow();
+    RefPtr<DOMWindow> domWindow = document().domWindow();
     double timestamp = domWindow ? 1000 * domWindow->nowTimestamp() : 0;
 
     auto metrics = m_player ? m_player->videoPlaybackQualityMetrics() : std::nullopt;
@@ -7574,11 +7574,11 @@ double HTMLMediaElement::playerVolume() const
 
 MediaSession* HTMLMediaElement::session() const
 {
-    MediaSession* session = m_session.get();
+    RefPtr<MediaSession> session = m_session.get();
     if (session && session == &document().defaultMediaSession())
         return nullptr;
 
-    return session;
+    return session.get();
 }
 
 void HTMLMediaElement::setSession(MediaSession* session)
index 9458c80..4e9a43e 100644 (file)
@@ -146,7 +146,7 @@ class HTMLMediaElement
 {
 public:
     WeakPtr<HTMLMediaElement> createWeakPtr() { return m_weakFactory.createWeakPtr(*this); }
-    MediaPlayer* player() const { return m_player.get(); }
+    RefPtr<MediaPlayer> player() const { return m_player; }
 
     virtual bool isVideo() const { return false; }
     bool hasVideo() const override { return false; }
index ea7694b..d3475bb 100644 (file)
@@ -211,7 +211,7 @@ void HTMLObjectElement::parametersForPlugin(Vector<String>& paramNames, Vector<S
 
 bool HTMLObjectElement::hasFallbackContent() const
 {
-    for (Node* child = firstChild(); child; child = child->nextSibling()) {
+    for (RefPtr<Node> child = firstChild(); child; child = child->nextSibling()) {
         // Ignore whitespace-only text, and <param> tags, any other content is fallback content.
         if (is<Text>(*child)) {
             if (!downcast<Text>(*child).containsOnlyWhitespace())
index afb7821..1b36175 100644 (file)
@@ -106,19 +106,19 @@ String HTMLOptGroupElement::groupLabelText() const
     
 HTMLSelectElement* HTMLOptGroupElement::ownerSelectElement() const
 {
-    ContainerNode* select = parentNode();
+    RefPtr<ContainerNode> select = parentNode();
     while (select && !is<HTMLSelectElement>(*select))
         select = select->parentNode();
     
     if (!select)
         return nullptr;
     
-    return downcast<HTMLSelectElement>(select);
+    return downcast<HTMLSelectElement>(select.get());
 }
 
 void HTMLOptGroupElement::accessKeyAction(bool)
 {
-    HTMLSelectElement* select = ownerSelectElement();
+    RefPtr<HTMLSelectElement> select = ownerSelectElement();
     // send to the parent to bring focus to the list box
     if (select && !select->focused())
         select->accessKeyAction(false);
index a09e3ab..3f21dfb 100644 (file)
@@ -119,8 +119,8 @@ void HTMLOptionElement::setText(const String &text)
     int oldSelectedIndex = selectIsMenuList ? select->selectedIndex() : -1;
 
     // Handle the common special case where there's exactly 1 child node, and it's a text node.
-    Node* child = firstChild();
-    if (is<Text>(child) && !child->nextSibling())
+    RefPtr<Node> child = firstChild();
+    if (is<Text>(child.get()) && !child->nextSibling())
         downcast<Text>(*child).setData(text);
     else {
         removeChildren();
@@ -133,7 +133,7 @@ void HTMLOptionElement::setText(const String &text)
 
 void HTMLOptionElement::accessKeyAction(bool)
 {
-    HTMLSelectElement* select = ownerSelectElement();
+    RefPtr<HTMLSelectElement> select = ownerSelectElement();
     if (select)
         select->accessKeySetSelectedIndex(index());
 }
@@ -142,7 +142,7 @@ int HTMLOptionElement::index() const
 {
     // It would be faster to cache the index, but harder to get it right in all cases.
 
-    HTMLSelectElement* selectElement = ownerSelectElement();
+    RefPtr<HTMLSelectElement> selectElement = ownerSelectElement();
     if (!selectElement)
         return 0;
 
@@ -163,7 +163,7 @@ void HTMLOptionElement::parseAttribute(const QualifiedName& name, const AtomicSt
 {
 #if ENABLE(DATALIST_ELEMENT)
     if (name == valueAttr) {
-        if (HTMLDataListElement* dataList = ownerDataListElement())
+        if (RefPtr<HTMLDataListElement> dataList = ownerDataListElement())
             dataList->optionElementChildrenChanged();
     } else
 #endif
@@ -204,7 +204,7 @@ void HTMLOptionElement::setValue(const String& value)
 
 bool HTMLOptionElement::selected()
 {
-    if (HTMLSelectElement* select = ownerSelectElement())
+    if (RefPtr<HTMLSelectElement> select = ownerSelectElement())
         select->updateListItemSelectedStates();
     return m_isSelected;
 }
@@ -216,7 +216,7 @@ void HTMLOptionElement::setSelected(bool selected)
 
     setSelectedState(selected);
 
-    if (HTMLSelectElement* select = ownerSelectElement())
+    if (RefPtr<HTMLSelectElement> select = ownerSelectElement())
         select->optionSelectionStateChanged(*this, selected);
 }
 
@@ -228,18 +228,18 @@ void HTMLOptionElement::setSelectedState(bool selected)
     m_isSelected = selected;
     invalidateStyleForSubtree();
 
-    if (HTMLSelectElement* select = ownerSelectElement())
+    if (RefPtr<HTMLSelectElement> select = ownerSelectElement())
         select->invalidateSelectedItems();
 }
 
 void HTMLOptionElement::childrenChanged(const ChildChange& change)
 {
 #if ENABLE(DATALIST_ELEMENT)
-    if (HTMLDataListElement* dataList = ownerDataListElement())
+    if (RefPtr<HTMLDataListElement> dataList = ownerDataListElement())
         dataList->optionElementChildrenChanged();
     else
 #endif
-    if (HTMLSelectElement* select = ownerSelectElement())
+    if (RefPtr<HTMLSelectElement> select = ownerSelectElement())
         select->optionElementChildrenChanged();
     HTMLElement::childrenChanged(change);
 }
@@ -247,7 +247,7 @@ void HTMLOptionElement::childrenChanged(const ChildChange& change)
 #if ENABLE(DATALIST_ELEMENT)
 HTMLDataListElement* HTMLOptionElement::ownerDataListElement() const
 {
-    for (ContainerNode* parent = parentNode(); parent ; parent = parent->parentNode()) {
+    for (RefPtr<ContainerNode> parent = parentNode(); parent ; parent = parent->parentNode()) {
         if (is<HTMLDataListElement>(*parent))
             return downcast<HTMLDataListElement>(parent);
     }
@@ -257,14 +257,14 @@ HTMLDataListElement* HTMLOptionElement::ownerDataListElement() const
 
 HTMLSelectElement* HTMLOptionElement::ownerSelectElement() const
 {
-    ContainerNode* select = parentNode();
+    RefPtr<ContainerNode> select = parentNode();
     while (select && !is<HTMLSelectElement>(*select))
         select = select->parentNode();
 
     if (!select)
         return nullptr;
 
-    return downcast<HTMLSelectElement>(select);
+    return downcast<HTMLSelectElement>(select.get());
 }
 
 String HTMLOptionElement::label() const
@@ -300,8 +300,8 @@ void HTMLOptionElement::willResetComputedStyle()
 
 String HTMLOptionElement::textIndentedToRespectGroupLabel() const
 {
-    ContainerNode* parent = parentNode();
-    if (is<HTMLOptGroupElement>(parent))
+    RefPtr<ContainerNode> parent = parentNode();
+    if (is<HTMLOptGroupElement>(parent.get()))
         return "    " + displayLabel();
     return displayLabel();
 }
@@ -319,7 +319,7 @@ bool HTMLOptionElement::isDisabledFormControl() const
 
 Node::InsertedIntoResult HTMLOptionElement::insertedInto(InsertionType insertionType, ContainerNode& parentOfInsertedTree)
 {
-    if (HTMLSelectElement* select = ownerSelectElement()) {
+    if (RefPtr<HTMLSelectElement> select = ownerSelectElement()) {
         select->setRecalcListItems();
         select->updateValidity();
         // Do not call selected() since calling updateListItemSelectedStates()
@@ -337,7 +337,7 @@ Node::InsertedIntoResult HTMLOptionElement::insertedInto(InsertionType insertion
 String HTMLOptionElement::collectOptionInnerText() const
 {
     StringBuilder text;
-    for (Node* node = firstChild(); node; ) {
+    for (RefPtr<Node> node = firstChild(); node; ) {
         if (is<Text>(*node))
             text.append(node->nodeValue());
         // Text nodes inside script elements are not part of the option text.
index e2e31a1..4d52e80 100644 (file)
@@ -98,7 +98,7 @@ void HTMLPlugInElement::willDetachRenderers()
     m_instance = nullptr;
 
     if (m_isCapturingMouseEvents) {
-        if (Frame* frame = document().frame())
+        if (RefPtr<Frame> frame = document().frame())
             frame->eventHandler().setCapturingMouseEventsElement(nullptr);
         m_isCapturingMouseEvents = false;
     }
@@ -226,8 +226,8 @@ bool HTMLPlugInElement::isKeyboardFocusable(KeyboardEvent&) const
     if (!document().page())
         return false;
 
-    Widget* widget = pluginWidget();
-    if (!is<PluginViewBase>(widget))
+    RefPtr<Widget> widget = pluginWidget();
+    if (!is<PluginViewBase>(widget.get()))
         return false;
 
     return downcast<PluginViewBase>(*widget).supportsKeyboardFocus();
@@ -241,8 +241,8 @@ bool HTMLPlugInElement::isPluginElement() const
 bool HTMLPlugInElement::isUserObservable() const
 {
     // No widget - can't be anything to see or hear here.
-    Widget* widget = pluginWidget(PluginLoadingPolicy::DoNotLoad);
-    if (!is<PluginViewBase>(widget))
+    RefPtr<Widget> widget = pluginWidget(PluginLoadingPolicy::DoNotLoad);
+    if (!is<PluginViewBase>(widget.get()))
         return false;
 
     PluginViewBase& pluginView = downcast<PluginViewBase>(*widget);
index 68e1da7..babc0ff 100644 (file)
@@ -397,7 +397,7 @@ void HTMLPlugInImageElement::didAddUserAgentShadowRoot(ShadowRoot* root)
 bool HTMLPlugInImageElement::partOfSnapshotOverlay(const Node* node) const
 {
     static NeverDestroyed<AtomicString> selector(".snapshot-overlay", AtomicString::ConstructFromLiteral);
-    auto* shadow = userAgentShadowRoot();
+    auto shadow = userAgentShadowRoot();
     if (!shadow)
         return false;
     if (!node)
@@ -430,7 +430,7 @@ void HTMLPlugInImageElement::restartSimilarPlugIns()
     if (!document().page())
         return;
 
-    for (Frame* frame = &document().page()->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (RefPtr<Frame> frame = &document().page()->mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (!frame->loader().subframeLoader().containsPlugins())
             continue;
         
index 08543bf..ad5a8ab 100644 (file)
@@ -218,7 +218,7 @@ int HTMLSelectElement::activeSelectionEndListIndex() const
 
 ExceptionOr<void> HTMLSelectElement::add(const OptionOrOptGroupElement& element, const std::optional<HTMLElementOrInt>& before)
 {
-    HTMLElement* beforeElement = nullptr;
+    RefPtr<HTMLElement> beforeElement;
     if (before) {
         beforeElement = WTF::switchOn(before.value(),
             [](const RefPtr<HTMLElement>& element) -> HTMLElement* { return element.get(); },
@@ -230,7 +230,7 @@ ExceptionOr<void> HTMLSelectElement::add(const OptionOrOptGroupElement& element,
     );
 
 
-    return insertBefore(toInsert, beforeElement);
+    return insertBefore(toInsert, beforeElement.get());
 }
 
 void HTMLSelectElement::remove(int optionIndex)
@@ -767,9 +767,9 @@ void HTMLSelectElement::recalcListItems(bool updateSelectedStates) const
 
     m_shouldRecalcListItems = false;
 
-    HTMLOptionElement* foundSelected = 0;
-    HTMLOptionElement* firstOption = 0;
-    for (Element* currentElement = ElementTraversal::firstWithin(*this); currentElement; ) {
+    RefPtr<HTMLOptionElement> foundSelected;
+    RefPtr<HTMLOptionElement> firstOption;
+    for (RefPtr<Element> currentElement = ElementTraversal::firstWithin(*this); currentElement; ) {
         if (!is<HTMLElement>(*currentElement)) {
             currentElement = ElementTraversal::nextSkippingChildren(*currentElement, this);
             continue;
@@ -779,7 +779,7 @@ void HTMLSelectElement::recalcListItems(bool updateSelectedStates) const
         // Only consider optgroup elements that are direct children of the select element.
         if (is<HTMLOptGroupElement>(current) && current.parentNode() == this) {
             m_listItems.append(&current);
-            if (Element* nextElement = ElementTraversal::firstWithin(current)) {
+            if (RefPtr<Element> nextElement = ElementTraversal::firstWithin(current)) {
                 currentElement = nextElement;
                 continue;
             }
@@ -858,14 +858,14 @@ void HTMLSelectElement::selectOption(int optionIndex, SelectOptionFlags flags)
     auto& items = listItems();
     int listIndex = optionToListIndex(optionIndex);
 
-    HTMLElement* element = nullptr;
+    RefPtr<HTMLElement> element;
     if (listIndex >= 0)
         element = items[listIndex];
 
     if (shouldDeselect)
-        deselectItemsWithoutValidation(element);
+        deselectItemsWithoutValidation(element.get());
 
-    if (is<HTMLOptionElement>(element)) {
+    if (is<HTMLOptionElement>(element.get())) {
         if (m_activeSelectionAnchorIndex < 0 || shouldDeselect)
             setActiveSelectionAnchorIndex(listIndex);
         if (m_activeSelectionEndIndex < 0 || shouldDeselect)
@@ -1053,8 +1053,8 @@ bool HTMLSelectElement::appendFormData(DOMFormData& formData, bool)
 
 void HTMLSelectElement::reset()
 {
-    HTMLOptionElement* firstOption = nullptr;
-    HTMLOptionElement* selectedOption = nullptr;
+    RefPtr<HTMLOptionElement> firstOption;
+    RefPtr<HTMLOptionElement> selectedOption;
 
     for (auto& element : listItems()) {
         if (!is<HTMLOptionElement>(*element))
@@ -1336,7 +1336,7 @@ void HTMLSelectElement::listBoxDefaultEventHandler(Event& event)
                 updateSelectedState(listIndex, mouseEvent.ctrlKey(), mouseEvent.shiftKey());
 #endif
             }
-            if (Frame* frame = document().frame())
+            if (RefPtr<Frame> frame = document().frame())
                 frame->eventHandler().setMouseDownMayStartAutoscroll();
 
             mouseEvent.setDefaultHandled();
index 21e225b..ded1526 100644 (file)
@@ -99,19 +99,19 @@ static void flattenAssignedNodes(Vector<Node*>& nodes, const HTMLSlotElement& sl
 {
     auto* assignedNodes = slot.assignedNodes();
     if (!assignedNodes) {
-        for (Node* child = slot.firstChild(); child; child = child->nextSibling()) {
+        for (RefPtr<Node> child = slot.firstChild(); child; child = child->nextSibling()) {
             if (is<HTMLSlotElement>(*child))
                 flattenAssignedNodes(nodes, downcast<HTMLSlotElement>(*child));
             else if (is<Text>(*child) || is<Element>(*child))
-                nodes.append(child);
+                nodes.append(child.get());
         }
         return;
     }
-    for (Node* node : *assignedNodes) {
+    for (RefPtr<Node> node : *assignedNodes) {
         if (is<HTMLSlotElement>(*node))
             flattenAssignedNodes(nodes, downcast<HTMLSlotElement>(*node));
         else
-            nodes.append(node);
+            nodes.append(node.get());
     }
 }
 
index 712c66d..b1eef99 100644 (file)
@@ -80,7 +80,7 @@ Node::InsertedIntoResult HTMLSourceElement::insertedInto(InsertionType insertion
 
 void HTMLSourceElement::removedFrom(ContainerNode& removalRoot)
 {
-    Element* parent = parentElement();
+    RefPtr<Element> parent = parentElement();
     if (!parent && is<Element>(removalRoot))
         parent = &downcast<Element>(removalRoot);
     if (parent) {
index 9910bd1..7d40091 100644 (file)
@@ -85,7 +85,7 @@ HTMLDetailsElement* HTMLSummaryElement::detailsElement() const
 
 bool HTMLSummaryElement::isActiveSummary() const
 {
-    HTMLDetailsElement* details = detailsElement();
+    RefPtr<HTMLDetailsElement> details = detailsElement();
     if (!details)
         return false;
     return details->isActiveSummary(*this);
@@ -99,8 +99,8 @@ static bool isClickableControl(Node* node)
     Element& element = downcast<Element>(*node);
     if (is<HTMLFormControlElement>(element))
         return true;
-    Element* host = element.shadowHost();
-    return host && is<HTMLFormControlElement>(host);
+    RefPtr<Element> host = element.shadowHost();
+    return host && is<HTMLFormControlElement>(host.get());
 }
 
 bool HTMLSummaryElement::supportsFocus() const
@@ -111,8 +111,8 @@ bool HTMLSummaryElement::supportsFocus() const
 void HTMLSummaryElement::defaultEventHandler(Event& event)
 {
     if (isActiveSummary() && renderer()) {
-        if (event.type() == eventNames().DOMActivateEvent && !isClickableControl(event.target()->toNode())) {
-            if (HTMLDetailsElement* details = detailsElement())
+        if (event.type() == eventNames().DOMActivateEvent && !isClickableControl(event.target()->toNode().get())) {
+            if (RefPtr<HTMLDetailsElement> details = detailsElement())
                 details->toggleOpen();
             event.setDefaultHandled();
             return;
index fd6f66d..12ab57e 100644 (file)
@@ -128,7 +128,7 @@ void HTMLTableCellElement::parseAttribute(const QualifiedName& name, const Atomi
 
 const StyleProperties* HTMLTableCellElement::additionalPresentationAttributeStyle() const
 {
-    if (HTMLTableElement* table = findParentTable())
+    if (RefPtr<HTMLTableElement> table = findParentTable())
         return table->additionalCellStyle();
     return 0;
 }
index 4670f8c..7cd63bf 100644 (file)
@@ -89,7 +89,7 @@ const StyleProperties* HTMLTableColElement::additionalPresentationAttributeStyle
 {
     if (!hasTagName(colgroupTag))
         return nullptr;
-    if (HTMLTableElement* table = findParentTable())
+    if (RefPtr<HTMLTableElement> table = findParentTable())
         return table->additionalGroupStyle(false);
     return nullptr;
 }
index 9d598f6..ffffaca 100644 (file)
@@ -77,9 +77,9 @@ ExceptionOr<void> HTMLTableElement::setCaption(RefPtr<HTMLTableCaptionElement>&&
 
 HTMLTableSectionElement* HTMLTableElement::tHead() const
 {
-    for (Node* child = firstChild(); child; child = child->nextSibling()) {
+    for (RefPtr<Node> child = firstChild(); child; child = child->nextSibling()) {
         if (child->hasTagName(theadTag))
-            return downcast<HTMLTableSectionElement>(child);
+            return downcast<HTMLTableSectionElement>(child.get());
     }
     return nullptr;
 }
@@ -93,20 +93,20 @@ ExceptionOr<void> HTMLTableElement::setTHead(RefPtr<HTMLTableSectionElement>&& n
     if (!newHead)
         return { };
 
-    Node* child;
+    RefPtr<Node> child;
     for (child = firstChild(); child; child = child->nextSibling()) {
         if (child->isElementNode() && !child->hasTagName(captionTag) && !child->hasTagName(colgroupTag))
             break;
     }
 
-    return insertBefore(*newHead, child);
+    return insertBefore(*newHead, child.get());
 }
 
 HTMLTableSectionElement* HTMLTableElement::tFoot() const
 {
-    for (Node* child = firstChild(); child; child = child->nextSibling()) {
+    for (RefPtr<Node> child = firstChild(); child; child = child->nextSibling()) {
         if (child->hasTagName(tfootTag))
-            return downcast<HTMLTableSectionElement>(child);
+            return downcast<HTMLTableSectionElement>(child.get());
     }
     return nullptr;
 }
@@ -154,8 +154,8 @@ void HTMLTableElement::deleteTFoot()
 Ref<HTMLTableSectionElement> HTMLTableElement::createTBody()
 {
     auto body = HTMLTableSectionElement::create(tbodyTag, document());
-    Node* referenceElement = lastBody() ? lastBody()->nextSibling() : nullptr;
-    insertBefore(body, referenceElement);
+    RefPtr<Node> referenceElement = lastBody() ? lastBody()->nextSibling() : nullptr;
+    insertBefore(body, referenceElement.get());
     return body;
 }
 
@@ -176,9 +176,9 @@ void HTMLTableElement::deleteCaption()
 
 HTMLTableSectionElement* HTMLTableElement::lastBody() const
 {
-    for (Node* child = lastChild(); child; child = child->previousSibling()) {
+    for (RefPtr<Node> child = lastChild(); child; child = child->previousSibling()) {
         if (child->hasTagName(tbodyTag))
-            return downcast<HTMLTableSectionElement>(child);
+            return downcast<HTMLTableSectionElement>(child.get());
     }
     return nullptr;
 }
@@ -232,14 +232,14 @@ ExceptionOr<Ref<HTMLElement>> HTMLTableElement::insertRow(int index)
 
 ExceptionOr<void> HTMLTableElement::deleteRow(int index)
 {
-    HTMLTableRowElement* row = nullptr;
+    RefPtr<HTMLTableRowElement> row;
     if (index == -1) {
         row = HTMLTableRowsCollection::lastRow(*this);
         if (!row)
             return { };
     } else {
         for (int i = 0; i <= index; ++i) {
-            row = HTMLTableRowsCollection::rowAfter(*this, row);
+            row = HTMLTableRowsCollection::rowAfter(*this, row.get());
             if (!row)
                 break;
         }
index 007182c..ccc6fb8 100644 (file)
@@ -84,10 +84,10 @@ void HTMLTablePartElement::collectStyleForPresentationAttribute(const QualifiedN
 
 HTMLTableElement* HTMLTablePartElement::findParentTable() const
 {
-    ContainerNode* parent = parentNode();
+    RefPtr<ContainerNode> parent = parentNode();
     while (parent && !is<HTMLTableElement>(*parent))
         parent = parent->parentNode();
-    return downcast<HTMLTableElement>(parent);
+    return downcast<HTMLTableElement>(parent.get());
 }
 
 }
index 2d91d9d..6a77cb7 100644 (file)
@@ -75,7 +75,7 @@ HTMLTableRowElement* HTMLTableRowsCollection::rowAfter(HTMLTableElement& table,
             return &*row;
     }
 
-    Element* child = nullptr;
+    RefPtr<Element> child;
 
     // If still looking at head sections, find the first row in the next head section.
     if (!previous)
@@ -98,7 +98,7 @@ HTMLTableRowElement* HTMLTableRowsCollection::rowAfter(HTMLTableElement& table,
         child = ElementTraversal::nextSibling(*previous->parentNode());
     for (; child; child = ElementTraversal::nextSibling(*child)) {
         if (is<HTMLTableRowElement>(*child))
-            return downcast<HTMLTableRowElement>(child);
+            return downcast<HTMLTableRowElement>(child.get());
         if (child->hasTagName(tbodyTag)) {
             if (auto row = childrenOfType<HTMLTableRowElement>(*child).first())
                 return row;
index 8b3913c..3c7fd7b 100644 (file)
@@ -287,7 +287,7 @@ void HTMLTextAreaElement::subtreeHasChanged()
     if (!focused())
         return;
 
-    if (Frame* frame = document().frame())
+    if (RefPtr<Frame> frame = document().frame())
         frame->editor().textDidChangeInTextArea(this);
     // When typing in a textarea, childrenChanged is not called, so we need to force the directionality check.
     calculateAndAdjustDirectionality();
@@ -325,9 +325,9 @@ String HTMLTextAreaElement::sanitizeUserInputValue(const String& proposedValue,
     return proposedValue.left(numCharactersInGraphemeClusters(proposedValue, maxLength));
 }
 
-TextControlInnerTextElement* HTMLTextAreaElement::innerTextElement() const
+RefPtr<TextControlInnerTextElement> HTMLTextAreaElement::innerTextElement() const
 {
-    ShadowRoot* root = userAgentShadowRoot();
+    RefPtr<ShadowRoot> root = userAgentShadowRoot();
     if (!root)
         return nullptr;
     
index 9d33c5c..facff9a 100644 (file)
@@ -53,7 +53,7 @@ public:
     bool tooLong() const final;
     bool isValidValue(const String&) const;
     
-    TextControlInnerTextElement* innerTextElement() const final;
+    RefPtr<TextControlInnerTextElement> innerTextElement() const final;
     RenderStyle createInnerTextStyle(const RenderStyle&) const final;
     void copyNonAttributePropertiesFromElement(const Element&) final;
 
index 5652a70..dda478d 100644 (file)
@@ -292,7 +292,7 @@ void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextField
     end = std::max(end, 0);
     start = std::min(std::max(start, 0), end);
 
-    TextControlInnerTextElement* innerText = innerTextElement();
+    auto innerText = innerTextElement();
     bool hasFocus = document().focusedElement() == this;
     if (!hasFocus && innerText) {
         // FIXME: Removing this synchronous layout requires fixing <https://webkit.org/b/128797>
@@ -310,35 +310,35 @@ void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextField
         }
     }
 
-    Position startPosition = positionForIndex(innerText, start);
+    Position startPosition = positionForIndex(innerText.get(), start);
     Position endPosition;
     if (start == end)
         endPosition = startPosition;
     else {
         if (direction == SelectionHasBackwardDirection) {
             endPosition = startPosition;
-            startPosition = positionForIndex(innerText, end);
+            startPosition = positionForIndex(innerText.get(), end);
         } else
-            endPosition = positionForIndex(innerText, end);
+            endPosition = positionForIndex(innerText.get(), end);
     }
 
-    if (Frame* frame = document().frame())
+    if (RefPtr<Frame> frame = document().frame())
         frame->selection().moveWithoutValidationTo(startPosition, endPosition, direction != SelectionHasNoDirection, !hasFocus, intent);
 }
 
 int HTMLTextFormControlElement::indexForVisiblePosition(const VisiblePosition& position) const
 {
-    TextControlInnerTextElement* innerText = innerTextElement();
+    auto innerText = innerTextElement();
     if (!innerText || !innerText->contains(position.deepEquivalent().anchorNode()))
         return 0;
     unsigned index = indexForPosition(position.deepEquivalent());
-    ASSERT(VisiblePosition(positionForIndex(innerTextElement(), index)) == position);
+    ASSERT(VisiblePosition(positionForIndex(innerTextElement().get(), index)) == position);
     return index;
 }
 
 VisiblePosition HTMLTextFormControlElement::visiblePositionForIndex(int index) const
 {
-    VisiblePosition position = positionForIndex(innerTextElement(), index);
+    VisiblePosition position = positionForIndex(innerTextElement().get(), index);
     ASSERT(indexForVisiblePosition(position) == index);
     return position;
 }
@@ -356,7 +356,7 @@ int HTMLTextFormControlElement::selectionStart() const
 int HTMLTextFormControlElement::computeSelectionStart() const
 {
     ASSERT(isTextFormControl());
-    Frame* frame = document().frame();
+    RefPtr<Frame> frame = document().frame();
     if (!frame)
         return 0;
 
@@ -375,7 +375,7 @@ int HTMLTextFormControlElement::selectionEnd() const
 int HTMLTextFormControlElement::computeSelectionEnd() const
 {
     ASSERT(isTextFormControl());
-    Frame* frame = document().frame();
+    RefPtr<Frame> frame = document().frame();
     if (!frame)
         return 0;
 
@@ -414,7 +414,7 @@ const AtomicString& HTMLTextFormControlElement::selectionDirection() const
 TextFieldSelectionDirection HTMLTextFormControlElement::computeSelectionDirection() const
 {
     ASSERT(isTextFormControl());
-    Frame* frame = document().frame();
+    RefPtr<Frame> frame = document().frame();
     if (!frame)
         return SelectionHasNoDirection;
 
@@ -442,7 +442,7 @@ RefPtr<Range> HTMLTextFormControlElement::selection() const
     int end = m_cachedSelectionEnd;
 
     ASSERT(start <= end);
-    TextControlInnerTextElement* innerText = innerTextElement();
+    auto innerText = innerTextElement();
     if (!innerText)
         return nullptr;
 
@@ -452,16 +452,16 @@ RefPtr<Range> HTMLTextFormControlElement::selection() const
     int offset = 0;
     Node* startNode = nullptr;
     Node* endNode = nullptr;
-    for (Node* node = innerText->firstChild(); node; node = NodeTraversal::next(*node, innerText)) {
+    for (RefPtr<Node> node = innerText->firstChild(); node; node = NodeTraversal::next(*node, innerText.get())) {
         ASSERT(!node->firstChild());
         ASSERT(node->isTextNode() || node->hasTagName(brTag));
-        int length = node->isTextNode() ? lastOffsetInNode(node) : 1;
+        int length = node->isTextNode() ? lastOffsetInNode(node.get()) : 1;
 
         if (offset <= start && start <= offset + length)
-            setContainerAndOffsetForRange(node, start - offset, startNode, start);
+            setContainerAndOffsetForRange(node.get(), start - offset, startNode, start);
 
         if (offset <= end && end <= offset + length) {
-            setContainerAndOffsetForRange(node, end - offset, endNode, end);
+            setContainerAndOffsetForRange(node.get(), end - offset, endNode, end);
             break;
         }
 
@@ -515,7 +515,7 @@ void HTMLTextFormControlElement::readOnlyAttributeChanged()
 
 void HTMLTextFormControlElement::updateInnerTextElementEditability()
 {
-    if (TextControlInnerTextElement* innerText = innerTextElement())
+    if (auto innerText = innerTextElement())
         innerText->setAttributeWithoutSynchronization(contenteditableAttr, isDisabledOrReadOnly() ? "false" : "plaintext-only");
 }
 
@@ -537,7 +537,7 @@ static void stripTrailingNewline(StringBuilder& result)
 static String innerTextValueFrom(TextControlInnerTextElement& innerText)
 {
     StringBuilder result;
-    for (Node* node = innerText.firstChild(); node; node = NodeTraversal::next(*node, &innerText)) {
+    for (RefPtr<Node> node = innerText.firstChild(); node; node = NodeTraversal::next(*node, &innerText)) {
         if (is<HTMLBRElement>(*node))
             result.append(newlineCharacter);
         else if (is<Text>(*node))
@@ -550,7 +550,7 @@ static String innerTextValueFrom(TextControlInnerTextElement& innerText)
 void HTMLTextFormControlElement::setInnerTextValue(const String& value)
 {
     LayoutDisallowedScope layoutDisallowedScope(LayoutDisallowedScope::Reason::PerformanceOptimization);
-    RefPtr<TextControlInnerTextElement> innerText = innerTextElement();
+    auto innerText = innerTextElement();
     if (!innerText)
         return;
 
@@ -588,18 +588,18 @@ void HTMLTextFormControlElement::setInnerTextValue(const String& value)
 
 String HTMLTextFormControlElement::innerTextValue() const
 {
-    TextControlInnerTextElement* innerText = innerTextElement();
+    auto innerText = innerTextElement();
     return innerText ? innerTextValueFrom(*innerText) : emptyString();
 }
 
 static Position positionForIndex(TextControlInnerTextElement* innerText, unsigned index)
 {
     unsigned remainingCharactersToMoveForward = index;
-    Node* lastBrOrText = innerText;
-    for (Node* node = innerText; node; node = NodeTraversal::next(*node, innerText)) {
+    RefPtr<Node> lastBrOrText = innerText;
+    for (RefPtr<Node> node = innerText; node; node = NodeTraversal::next(*node, innerText)) {
         if (node->hasTagName(brTag)) {
             if (!remainingCharactersToMoveForward)
-                return positionBeforeNode(node);
+                return positionBeforeNode(node.get());
             remainingCharactersToMoveForward--;
             lastBrOrText = node;
         } else if (is<Text>(*node)) {
@@ -610,26 +610,26 @@ static Position positionForIndex(TextControlInnerTextElement* innerText, unsigne
             lastBrOrText = node;
         }
     }
-    return lastPositionInOrAfterNode(lastBrOrText);
+    return lastPositionInOrAfterNode(lastBrOrText.get());
 }
 
 unsigned HTMLTextFormControlElement::indexForPosition(const Position& passedPosition) const
 {
-    TextControlInnerTextElement* innerText = innerTextElement();
+    auto innerText = innerTextElement();
     if (!innerText || !innerText->contains(passedPosition.anchorNode()) || passedPosition.isNull())
         return 0;
 
-    if (positionBeforeNode(innerText) == passedPosition)
+    if (positionBeforeNode(innerText.get()) == passedPosition)
         return 0;
 
     unsigned index = 0;
-    Node* startNode = passedPosition.computeNodeBeforePosition();
+    RefPtr<Node> startNode = passedPosition.computeNodeBeforePosition();
     if (!startNode)
         startNode = passedPosition.containerNode();
     ASSERT(startNode);
-    ASSERT(innerText->contains(startNode));
+    ASSERT(innerText->contains(startNode.get()));
 
-    for (Node* node = startNode; node; node = NodeTraversal::previous(*node, innerText)) {
+    for (RefPtr<Node> node = startNode; node; node = NodeTraversal::previous(*node, innerText.get())) {
         if (is<Text>(*node)) {
             unsigned length = downcast<Text>(*node).length();
             if (node == passedPosition.containerNode())
@@ -655,13 +655,13 @@ unsigned HTMLTextFormControlElement::indexForPosition(const Position& passedPosi
 #if PLATFORM(IOS)
 void HTMLTextFormControlElement::hidePlaceholder()
 {
-    if (HTMLElement* placeholder = placeholderElement())
+    if (RefPtr<HTMLElement> placeholder = placeholderElement())
         placeholder->setInlineStyleProperty(CSSPropertyVisibility, CSSValueHidden, true);
 }
 
 void HTMLTextFormControlElement::showPlaceholderIfNecessary()
 {
-    if (HTMLElement* placeholder = placeholderElement())
+    if (RefPtr<HTMLElement> placeholder = placeholderElement())
         placeholder->setInlineStyleProperty(CSSPropertyVisibility, CSSValueVisible, true);
 }
 #endif
@@ -690,7 +690,7 @@ String HTMLTextFormControlElement::valueWithHardLineBreaks() const
     if (!isTextFormControl())
         return value();
 
-    TextControlInnerTextElement* innerText = innerTextElement();
+    auto innerText = innerTextElement();
     if (!innerText)
         return value();
 
@@ -707,7 +707,7 @@ String HTMLTextFormControlElement::valueWithHardLineBreaks() const
     getNextSoftBreak(line, breakNode, breakOffset);
 
     StringBuilder result;
-    for (Node* node = innerText->firstChild(); node; node = NodeTraversal::next(*node, innerText)) {
+    for (RefPtr<Node> node = innerText->firstChild(); node; node = NodeTraversal::next(*node, innerText.get())) {
         if (is<HTMLBRElement>(*node))
             result.append(newlineCharacter);
         else if (is<Text>(*node)) {
@@ -737,11 +737,11 @@ HTMLTextFormControlElement* enclosingTextFormControl(const Position& position)
         || position.containerNode() || !position.anchorNode()->shadowHost()
         || hasShadowRootParent(*position.anchorNode()));
         
-    Node* container = position.containerNode();
+    RefPtr<Node> container = position.containerNode();
     if (!container)
         return nullptr;
-    Element* ancestor = container->shadowHost();
-    return ancestor && is<HTMLTextFormControlElement>(*ancestor) ? downcast<HTMLTextFormControlElement>(ancestor) : nullptr;
+    RefPtr<Element> ancestor = container->shadowHost();
+    return ancestor && is<HTMLTextFormControlElement>(*ancestor) ? downcast<HTMLTextFormControlElement>(ancestor.get()) : nullptr;
 }
 
 static const Element* parentHTMLElement(const Element* element)
@@ -797,7 +797,7 @@ void HTMLTextFormControlElement::adjustInnerTextStyle(const RenderStyle& parentS
     textBlockStyle.setDirection(parentStyle.direction());
     textBlockStyle.setUnicodeBidi(parentStyle.unicodeBidi());
 
-    if (HTMLElement* innerText = innerTextElement()) {
+    if (auto innerText = innerTextElement()) {
         if (const StyleProperties* properties = innerText->presentationAttributeStyle()) {
             RefPtr<CSSValue> value = properties->getPropertyCSSValue(CSSPropertyWebkitUserModify);
             if (is<CSSPrimitiveValue>(value.get()))
index 65418ff..4f209a4 100644 (file)
@@ -81,7 +81,7 @@ public:
 
     virtual String value() const = 0;
 
-    virtual TextControlInnerTextElement* innerTextElement() const = 0;
+    virtual RefPtr<TextControlInnerTextElement> innerTextElement() const = 0;
     virtual RenderStyle createInnerTextStyle(const RenderStyle&) const = 0;
 
     void selectionChanged(bool shouldFireSelectEvent);
index 92c084a..4ff0fdf 100644 (file)
@@ -211,7 +211,7 @@ void HTMLTrackElement::loadTimerFired()
 
 bool HTMLTrackElement::canLoadURL(const URL& url)
 {
-    HTMLMediaElement* parent = mediaElement();
+    auto parent = mediaElement();
     if (!parent)
         return false;
 
@@ -270,7 +270,7 @@ COMPILE_ASSERT(HTMLTrackElement::TRACK_ERROR == static_cast<HTMLTrackElement::Re
 void HTMLTrackElement::setReadyState(ReadyState state)
 {
     track().setReadinessState(static_cast<TextTrack::ReadinessState>(state));
-    if (HTMLMediaElement* parent = mediaElement())
+    if (auto parent = mediaElement())
         parent->textTrackReadyStateChanged(m_track.get());
 }
 
@@ -281,14 +281,14 @@ HTMLTrackElement::ReadyState HTMLTrackElement::readyState()
 
 const AtomicString& HTMLTrackElement::mediaElementCrossOriginAttribute() const
 {
-    if (HTMLMediaElement* parent = mediaElement())
+    if (auto parent = mediaElement())
         return parent->attributeWithoutSynchronization(HTMLNames::crossoriginAttr);
     return nullAtom();
 }
 
 void HTMLTrackElement::textTrackKindChanged(TextTrack& track)
 {
-    if (auto* parent = mediaElement())
+    if (auto parent = mediaElement())
         parent->textTrackKindChanged(track);
 }
 
@@ -298,35 +298,35 @@ void HTMLTrackElement::textTrackModeChanged(TextTrack& track)
     if (readyState() == HTMLTrackElement::NONE)
         scheduleLoad();
 
-    if (auto* parent = mediaElement())
+    if (auto parent = mediaElement())
         parent->textTrackModeChanged(track);
 }
 
 void HTMLTrackElement::textTrackAddCues(TextTrack& track, const TextTrackCueList& cues)
 {
-    if (auto* parent = mediaElement())
+    if (auto parent = mediaElement())
         parent->textTrackAddCues(track, cues);
 }
     
 void HTMLTrackElement::textTrackRemoveCues(TextTrack& track, const TextTrackCueList& cues)
 {
-    if (auto* parent = mediaElement())
+    if (auto parent = mediaElement())
         parent->textTrackRemoveCues(track, cues);
 }
     
 void HTMLTrackElement::textTrackAddCue(TextTrack& track, TextTrackCue& cue)
 {
-    if (auto* parent = mediaElement())
+    if (auto parent = mediaElement())
         parent->textTrackAddCue(track, cue);
 }
     
 void HTMLTrackElement::textTrackRemoveCue(TextTrack& track, TextTrackCue& cue)
 {
-    if (auto* parent = mediaElement())
+    if (auto parent = mediaElement())
         parent->textTrackRemoveCue(track, cue);
 }
 
-HTMLMediaElement* HTMLTrackElement::mediaElement() const
+RefPtr<HTMLMediaElement> HTMLTrackElement::mediaElement() const
 {
     auto* parent = parentElement();
     if (!is<HTMLMediaElement>(parent))
index 4ba643d..a440226 100644 (file)
@@ -72,7 +72,7 @@ private:
 
     void loadTimerFired();
 
-    HTMLMediaElement* mediaElement() const;
+    RefPtr<HTMLMediaElement> mediaElement() const;
 
     // TextTrackClient
     void textTrackModeChanged(TextTrack&) final;
index 72390ee..b09830b 100644 (file)
@@ -250,7 +250,7 @@ void HTMLVideoElement::setDisplayMode(DisplayMode mode)
     if (player() && player()->canLoadPoster()) {
         bool canLoad = true;
         if (!poster.isEmpty()) {
-            if (Frame* frame = document().frame())
+            if (RefPtr<Frame> frame = document().frame())
                 canLoad = frame->loader().willLoadMediaElementURL(poster);
         }
         if (canLoad)
@@ -273,7 +273,7 @@ void HTMLVideoElement::updateDisplayState()
 
 void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext& context, const FloatRect& destRect)
 {
-    MediaPlayer* player = HTMLMediaElement::player();
+    RefPtr<MediaPlayer> player = HTMLMediaElement::player();
     if (!player)
         return;
     
index 099f561..43f32e1 100644 (file)
@@ -242,7 +242,7 @@ void ImageDocument::createDocumentStructure()
         processViewport(ASCIILiteral("width=device-width"), ViewportArguments::ImageDocument);
 #else
         auto listener = ImageEventListener::create(*this);
-        if (DOMWindow* window = this->domWindow())
+        if (RefPtr<DOMWindow> window = this->domWindow())
             window->addEventListener("resize", listener.copyRef(), false);
         imageElement->addEventListener("click", WTFMove(listener), false);
 #endif
@@ -284,7 +284,7 @@ float ImageDocument::scale()
     if (!m_imageElement)
         return 1;
 
-    FrameView* view = this->view();
+    RefPtr<FrameView> view = this->view();
     if (!view)
         return 1;
 
@@ -333,7 +333,7 @@ bool ImageDocument::imageFitsInWindow()
     if (!m_imageElement)
         return true;
 
-    FrameView* view = this->view();
+    RefPtr<FrameView> view = this->view();
     if (!view)
         return true;
 
index cdcd9f8..0ca2f3b 100644 (file)
@@ -68,6 +68,7 @@
 #include "ShadowRoot.h"
 #include "SubmitInputType.h"
 #include "TelephoneInputType.h"
+#include "TextControlInnerElements.h"
 #include "TextInputType.h"
 #include "TimeInputType.h"
 #include "URLInputType.h"
@@ -495,7 +496,7 @@ void InputType::createShadowSubtree()
 
 void InputType::destroyShadowSubtree()
 {
-    ShadowRoot* root = element().userAgentShadowRoot();
+    RefPtr<ShadowRoot> root = element().userAgentShadowRoot();
     if (!root)
         return;
 
@@ -1147,4 +1148,9 @@ void InputType::selectColor(const Color&)
 {
 }
 
+RefPtr<TextControlInnerTextElement> InputType::innerTextElement() const
+{
+    return nullptr;
+}
+
 } // namespace WebCore
index c1aa37b..0722bb5 100644 (file)
@@ -216,7 +216,7 @@ public:
 
     virtual HTMLElement* containerElement() const { return nullptr; }
     virtual HTMLElement* innerBlockElement() const { return nullptr; }
-    virtual TextControlInnerTextElement* innerTextElement() const { return nullptr; }
+    virtual RefPtr<TextControlInnerTextElement> innerTextElement() const;
     virtual HTMLElement* innerSpinButtonElement() const { return nullptr; }
     virtual HTMLElement* capsLockIndicatorElement() const { return nullptr; }
     virtual HTMLElement* autoFillButtonElement() const { return nullptr; }
index b5c2229..cd5b27b 100644 (file)
@@ -123,7 +123,7 @@ void MediaDocumentParser::createDocumentStructure()
 
     body->appendChild(videoElement);
 
-    Frame* frame = document.frame();
+    RefPtr<Frame> frame = document.frame();
     if (!frame)
         return;
 
@@ -185,11 +185,11 @@ void MediaDocument::defaultEventHandler(Event& event)
     
     // Match the default Quicktime plugin behavior to allow
     // clicking and double-clicking to pause and play the media.
-    Node* targetNode = event.target()->toNode();
+    auto targetNode = event.target()->toNode();
     if (!targetNode)
         return;
 
-    if (HTMLVideoElement* video = ancestorVideoElement(targetNode)) {
+    if (RefPtr<HTMLVideoElement> video = ancestorVideoElement(targetNode.get())) {
         if (event.type() == eventNames().clickEvent) {
             if (!video->canPlay()) {
                 video->pause();
@@ -207,7 +207,7 @@ void MediaDocument::defaultEventHandler(Event& event)
         return;
     ContainerNode& targetContainer = downcast<ContainerNode>(*targetNode);
     if (event.type() == eventNames().keydownEvent && is<KeyboardEvent>(event)) {
-        HTMLVideoElement* video = descendantVideoElement(targetContainer);
+        RefPtr<HTMLVideoElement> video = descendantVideoElement(targetContainer);
         if (!video)
             return;
 
index 85e4a7d..cda69a6 100644 (file)
@@ -462,7 +462,7 @@ bool MediaElementSession::wirelessVideoPlaybackDisabled(const HTMLMediaElement&
     }
 #endif
 
-    MediaPlayer* player = element.player();
+    auto player = element.player();
     if (!player)
         return true;
 
@@ -479,7 +479,7 @@ void MediaElementSession::setWirelessVideoPlaybackDisabled(const HTMLMediaElemen
     else
         removeBehaviorRestriction(WirelessVideoPlaybackDisabled);
 
-    MediaPlayer* player = element.player();
+    auto player = element.player();
     if (!player)
         return;
 
@@ -723,7 +723,7 @@ static bool isMainContentForPurposesOfAutoplay(const HTMLMediaElement& element)
     // Elements which are obscured by other elements cannot be main content.
     mainRenderView.hitTest(request, result);
     result.setToNonUserAgentShadowAncestor();
-    Element* hitElement = result.targetElement();
+    RefPtr<Element> hitElement = result.targetElement();
     if (hitElement != &element)
         return false;
 
index 2227236..87ec08b 100644 (file)
@@ -188,7 +188,7 @@ bool NumberInputType::sizeShouldIncludeDecoration(int defaultSize, int& preferre
 float NumberInputType::decorationWidth() const
 {
     float width = 0;
-    HTMLElement* spinButton = element().innerSpinButtonElement();
+    RefPtr<HTMLElement> spinButton = element().innerSpinButtonElement();
     if (RenderBox* spinRenderer = spinButton ? spinButton->renderBox() : 0) {
         width += spinRenderer->borderAndPaddingLogicalWidth();
         // Since the width of spinRenderer is not calculated yet, spinRenderer->logicalWidth() returns 0.
index 7497b3c..2e16b93 100644 (file)
@@ -127,7 +127,7 @@ void PluginDocumentParser::appendBytes(DocumentWriter&, const char*, size_t)
     frame->view()->flushAnyPendingPostLayoutTasks();
 
     if (RenderWidget* renderer = m_embedElement->renderWidget()) {
-        if (Widget* widget = renderer->widget()) {
+        if (RefPtr<Widget> widget = renderer->widget()) {
             frame->loader().client().redirectDataToPlugin(*widget);
             // In a plugin document, the main resource is the plugin. If we have a null widget, that means
             // the loading of the plugin was cancelled, which gives us a null mainResourceLoader(), so we
index dec19b2..013f4c9 100644 (file)
@@ -77,7 +77,7 @@ void RadioInputType::handleKeydownEvent(KeyboardEvent& event)
 
     // We can only stay within the form's children if the form hasn't been demoted to a leaf because
     // of malformed HTML.
-    Node* node = &element();
+    RefPtr<Node> node = &element();
     while ((node = (forward ? NodeTraversal::next(*node) : NodeTraversal::previous(*node)))) {
         // Once we encounter a form element, we know we're through.
         if (is<HTMLFormElement>(*node))
@@ -85,7 +85,7 @@ void RadioInputType::handleKeydownEvent(KeyboardEvent& event)
         // Look for more radio buttons.
         if (!is<HTMLInputElement>(*node))
             continue;
-        RefPtr<HTMLInputElement> inputElement = downcast<HTMLInputElement>(node);
+        RefPtr<HTMLInputElement> inputElement = downcast<HTMLInputElement>(node.get());
         if (inputElement->form() != element().form())
             break;
         if (inputElement->isRadioButton() && inputElement->name() == element().name() && inputElement->isFocusable()) {
@@ -120,8 +120,8 @@ bool RadioInputType::isKeyboardFocusable(KeyboardEvent& event) const
 
     // Never allow keyboard tabbing to leave you in the same radio group.  Always
     // skip any other elements in the group.
-    Element* currentFocusedNode = element().document().focusedElement();
-    if (is<HTMLInputElement>(currentFocusedNode)) {
+    RefPtr<Element> currentFocusedNode = element().document().focusedElement();
+    if (is<HTMLInputElement>(currentFocusedNode.get())) {
         HTMLInputElement& focusedInput = downcast<HTMLInputElement>(*currentFocusedNode);
         if (focusedInput.isRadioButton() && focusedInput.form() == element().form() && focusedInput.name() == element().name())
             return false;
@@ -158,7 +158,7 @@ void RadioInputType::didDispatchClick(Event* event, const InputElementClickState
     if (event->defaultPrevented() || event->defaultHandled()) {
         // Restore the original selected radio button if possible.
         // Make sure it is still a radio button and only do the restoration if it still belongs to our group.
-        HTMLInputElement* checkedRadioButton = state.checkedRadioButton.get();
+        RefPtr<HTMLInputElement> checkedRadioButton = state.checkedRadioButton.get();
         if (checkedRadioButton
                 && checkedRadioButton->isRadioButton()
                 && checkedRadioButton->form() == element().form()
index c144f99..3045b90 100644 (file)
@@ -88,7 +88,7 @@ bool RadioNodeList::checkElementMatchesRadioNodeListFilter(const Element& testEl
 {
     ASSERT(is<HTMLObjectElement>(testElement) || is<HTMLFormControlElement>(testElement));
     if (is<HTMLFormElement>(ownerNode())) {
-        HTMLFormElement* formElement = nullptr;
+        RefPtr<HTMLFormElement> formElement;
         if (testElement.hasTagName(objectTag))
             formElement = downcast<HTMLObjectElement>(testElement).form();
         else
index 9649118..7a87fc8 100644 (file)
@@ -139,11 +139,11 @@ void RangeInputType::handleMouseDownEvent(MouseEvent& event)
     if (element().isDisabledFormControl())
         return;
 
-    Node* targetNode = event.target()->toNode();
+    auto targetNode = event.target()->toNode();
     if (event.button() != LeftButton || !targetNode)
         return;
     ASSERT(element().shadowRoot());
-    if (targetNode != &element() && !targetNode->isDescendantOf(element().userAgentShadowRoot()))
+    if (targetNode != &element() && !targetNode->isDescendantOf(element().userAgentShadowRoot().get()))
         return;
     SliderThumbElement& thumb = typedSliderThumbElement();
     if (targetNode == &thumb)
@@ -166,7 +166,7 @@ void RangeInputType::handleTouchEvent(TouchEvent& event)
         return;
     }
 
-    TouchList* touches = event.targetTouches();
+    RefPtr<TouchList> touches = event.targetTouches();
     if (touches->length() == 1) {
         typedSliderThumbElement().setPositionFromPoint(touches->item(0)->absoluteLocation());
         event.setDefaultHandled();
@@ -266,7 +266,7 @@ HTMLElement* RangeInputType::sliderTrackElement() const
     ASSERT(element().userAgentShadowRoot()->firstChild()->isHTMLElement());
     ASSERT(element().userAgentShadowRoot()->firstChild()->firstChild()); // track
 
-    ShadowRoot* root = element().userAgentShadowRoot();
+    RefPtr<ShadowRoot> root = element().userAgentShadowRoot();
     if (!root)
         return nullptr;
     
@@ -360,7 +360,7 @@ bool RangeInputType::shouldRespectListAttribute()
 void RangeInputType::listAttributeTargetChanged()
 {
     m_tickMarkValuesDirty = true;
-    HTMLElement* sliderTrackElement = this->sliderTrackElement();
+    RefPtr<HTMLElement> sliderTrackElement = this->sliderTrackElement();
     if (sliderTrackElement->renderer())
         sliderTrackElement->renderer()->setNeedsLayout();
 }
@@ -371,13 +371,13 @@ void RangeInputType::updateTickMarkValues()
         return;
     m_tickMarkValues.clear();
     m_tickMarkValuesDirty = false;
-    HTMLDataListElement* dataList = element().dataList();
+    RefPtr<HTMLDataListElement> dataList = element().dataList();
     if (!dataList)
         return;
     Ref<HTMLCollection> options = dataList->options();
     m_tickMarkValues.reserveCapacity(options->length());
     for (unsigned i = 0; i < options->length(); ++i) {
-        Node* node = options->item(i);
+        RefPtr<Node> node = options->item(i);
         HTMLOptionElement& optionElement = downcast<HTMLOptionElement>(*node);
         String optionValue = optionElement.value();
         if (!element().isValidValue(optionValue))
index f0cd8c8..b44817f 100644 (file)
@@ -109,14 +109,14 @@ void SearchInputType::createShadowSubtree()
     ASSERT(!m_cancelButton);
 
     TextFieldInputType::createShadowSubtree();
-    HTMLElement* container = containerElement();
-    HTMLElement* textWrapper = innerBlockElement();
+    RefPtr<HTMLElement> container = containerElement();
+    RefPtr<HTMLElement> textWrapper = innerBlockElement();
     ASSERT(container);
     ASSERT(textWrapper);
 
     m_resultsButton = SearchFieldResultsButtonElement::create(element().document());
     updateResultButtonPseudoType(*m_resultsButton, element().maxResults());
-    container->insertBefore(*m_resultsButton, textWrapper);
+    container->insertBefore(*m_resultsButton, textWrapper.get());
 
     m_cancelButton = SearchFieldCancelButtonElement::create(element().document());
     container->insertBefore(*m_cancelButton, textWrapper->nextSibling());
index 5ca4667..c55a6bb 100644 (file)
@@ -94,10 +94,10 @@ bool TextFieldInputType::isTextField() const
 
 bool TextFieldInputType::isEmptyValue() const
 {
-    TextControlInnerTextElement* innerText = innerTextElement();
+    auto innerText = innerTextElement();
     ASSERT(innerText);
 
-    for (Text* text = TextNodeTraversal::firstWithin(*innerText); text; text = TextNodeTraversal::next(*text, innerText)) {
+    for (Text* text = TextNodeTraversal::firstWithin(*innerText); text; text = TextNodeTraversal::next(*text, innerText.get())) {
         if (text->length())
             return false;
     }
@@ -160,7 +160,7 @@ void TextFieldInputType::handleKeydownEvent(KeyboardEvent& event)
 {
     if (!element().focused())
         return;
-    Frame* frame = element().document().frame();
+    RefPtr<Frame> frame = element().document().frame();
     if (!frame || !frame->editor().doTextFieldCommandFromEvent(&element(), &event))
         return;
     event.setDefaultHandled();
@@ -218,7 +218,7 @@ void TextFieldInputType::elementDidBlur()
 void TextFieldInputType::handleFocusEvent(Node* oldFocusedNode, FocusDirection)
 {
     ASSERT_UNUSED(oldFocusedNode, oldFocusedNode != &element());
-    if (Frame* frame = element().document().frame())
+    if (RefPtr<Frame> frame = element().document().frame())
         frame->editor().textFieldDidBeginEditing(&element());
 }
 
@@ -308,10 +308,10 @@ HTMLElement* TextFieldInputType::innerBlockElement() const
     return m_innerBlock.get();
 }
 
-TextControlInnerTextElement* TextFieldInputType::innerTextElement() const
+RefPtr<TextControlInnerTextElement> TextFieldInputType::innerTextElement() const
 {
     ASSERT(m_innerText);
-    return m_innerText.get();
+    return m_innerText;
 }
 
 HTMLElement* TextFieldInputType::innerSpinButtonElement() const
@@ -508,7 +508,7 @@ void TextFieldInputType::updatePlaceholderText()
     }
     if (!m_placeholder) {
         m_placeholder = TextControlPlaceholderElement::create(element().document());
-        element().userAgentShadowRoot()->insertBefore(*m_placeholder, m_container ? m_container.get() : innerTextElement());
+        element().userAgentShadowRoot()->insertBefore(*m_placeholder, m_container ? m_container.get() : innerTextElement().get());
     }
     m_placeholder->setInnerText(placeholderText);
 }
@@ -556,7 +556,7 @@ void TextFieldInputType::didSetValueByUserEdit()
 {
     if (!element().focused())
         return;
-    if (Frame* frame = element().document().frame())
+    if (RefPtr<Frame> frame = element().document().frame())
         frame->editor().textDidChangeInTextField(&element());
 }
 
@@ -605,7 +605,7 @@ bool TextFieldInputType::shouldDrawCapsLockIndicator() const
     if (element().isDisabledOrReadOnly())
         return false;
 
-    Frame* frame = element().document().frame();
+    RefPtr<Frame> frame = element().document().frame();
     if (!frame)
         return false;
 
index ff06141..f018897 100644 (file)
@@ -50,7 +50,7 @@ protected:
 
     HTMLElement* containerElement() const final;
     HTMLElement* innerBlockElement() const final;
-    TextControlInnerTextElement* innerTextElement() const final;
+    RefPtr<TextControlInnerTextElement> innerTextElement() const final;
     HTMLElement* innerSpinButtonElement() const final;
     HTMLElement* capsLockIndicatorElement() const final;
     HTMLElement* autoFillButtonElement() const final;
index c69d62b..25fd167 100644 (file)
@@ -1431,7 +1431,7 @@ static inline FloatSize size(ImageBitmap& imageBitmap)
 
 static inline FloatSize size(HTMLVideoElement& video)
 {
-    auto* player = video.player();
+    auto player = video.player();
     if (!player)
         return { };
     return player->naturalSize();
@@ -1529,7 +1529,7 @@ ExceptionOr<void> CanvasRenderingContext2D::drawImage(HTMLImageElement& imageEle
     if (!cachedImage)
         return { };
 
-    Image* image = cachedImage->imageForRenderer(imageElement.renderer());
+    RefPtr<Image> image = cachedImage->imageForRenderer(imageElement.renderer());
     if (!image)
         return { };
 
@@ -1595,7 +1595,7 @@ ExceptionOr<void> CanvasRenderingContext2D::drawImage(HTMLCanvasElement& sourceC
 #if ENABLE(ACCELERATED_2D_CANVAS)
     // If we're drawing from one accelerated canvas 2d to another, avoid calling sourceCanvas.makeRenderingResultsAvailable()
     // as that will do a readback to software.
-    CanvasRenderingContext* sourceContext = sourceCanvas.renderingContext();
+    RefPtr<CanvasRenderingContext> sourceContext = sourceCanvas.renderingContext();
     // FIXME: Implement an accelerated path for drawing from a WebGL canvas to a 2d canvas when possible.
     if (!isAccelerated() || !sourceContext || !sourceContext->isAccelerated() || !sourceContext->is2d())
         sourceCanvas.makeRenderingResultsAvailable();
index 6eaf88b..754eae2 100644 (file)
@@ -183,8 +183,8 @@ void WebGL2RenderingContext::copyBufferSubData(GC3Denum readTarget, GC3Denum wri
         synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "copyBufferSubData", "offset < 0");
         return;
     }
-    WebGLBuffer* readBuffer = validateBufferDataParameters("copyBufferSubData", readTarget, GraphicsContext3D::STATIC_DRAW);
-    WebGLBuffer* writeBuffer = validateBufferDataParameters("copyBufferSubData", writeTarget, GraphicsContext3D::STATIC_DRAW);
+    RefPtr<WebGLBuffer> readBuffer = validateBufferDataParameters("copyBufferSubData", readTarget, GraphicsContext3D::STATIC_DRAW);
+    RefPtr<WebGLBuffer> writeBuffer = validateBufferDataParameters("copyBufferSubData", writeTarget, GraphicsContext3D::STATIC_DRAW);
     if (!readBuffer || !writeBuffer) {
         synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "copyBufferSubData", "Invalid readTarget or writeTarget");
         return;
@@ -217,7 +217,7 @@ void WebGL2RenderingContext::getBufferSubData(GC3Denum target, long long srcByte
 {
     if (isContextLostOrPending())
         return;
-    WebGLBuffer* buffer = validateBufferDataParameters("bufferSubData", target, GraphicsContext3D::STATIC_DRAW);
+    RefPtr<WebGLBuffer> buffer = validateBufferDataParameters("bufferSubData", target, GraphicsContext3D::STATIC_DRAW);
     if (!buffer) {
         synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "getBufferSubData", "No WebGLBuffer is bound to target");
         return;
index c2762b2..e2d5f9c 100644 (file)
@@ -314,7 +314,7 @@ void WebGLFramebuffer::setAttachmentForBoundFramebuffer(GC3Denum attachment, Web
 void WebGLFramebuffer::attach(GC3Denum attachment, GC3Denum attachmentPoint)
 {
     ASSERT(isBound());
-    WebGLAttachment* attachmentObject = getAttachment(attachment);
+    RefPtr<WebGLAttachment> attachmentObject = getAttachment(attachment);
     if (attachmentObject)
         attachmentObject->attach(context()->graphicsContext3D(), attachmentPoint);
 }
@@ -323,7 +323,7 @@ WebGLSharedObject* WebGLFramebuffer::getAttachmentObject(GC3Denum attachment) co
 {
     if (!object())
         return 0;
-    WebGLAttachment* attachmentObject = getAttachment(attachment);
+    RefPtr<WebGLAttachment> attachmentObject = getAttachment(attachment);
     return attachmentObject ? attachmentObject->getObject() : 0;
 }
 
@@ -339,7 +339,7 @@ void WebGLFramebuffer::removeAttachmentFromBoundFramebuffer(GC3Denum attachment)
     if (!object())
         return;
 
-    WebGLAttachment* attachmentObject = getAttachment(attachment);
+    RefPtr<WebGLAttachment> attachmentObject = getAttachment(attachment);
     if (attachmentObject) {
         attachmentObject->onDetached(context()->graphicsContext3D());
         m_attachments.remove(attachment);
@@ -371,7 +371,7 @@ void WebGLFramebuffer::removeAttachmentFromBoundFramebuffer(WebGLSharedObject* a
     do {
         checkMore = false;
         for (auto& entry : m_attachments) {
-            WebGLAttachment* attachmentObject = entry.value.get();
+            RefPtr<WebGLAttachment> attachmentObject = entry.value.get();
             if (attachmentObject->isSharedObject(attachment)) {
                 GC3Denum attachmentType = entry.key;
                 attachmentObject->unattach(context()->graphicsContext3D(), attachmentType);
@@ -387,7 +387,7 @@ GC3Dsizei WebGLFramebuffer::getColorBufferWidth() const
 {
     if (!object())
         return 0;
-    WebGLAttachment* attachment = getAttachment(GraphicsContext3D::COLOR_ATTACHMENT0);
+    RefPtr<WebGLAttachment> attachment = getAttachment(GraphicsContext3D::COLOR_ATTACHMENT0);
     if (!attachment)
         return 0;
 
@@ -398,7 +398,7 @@ GC3Dsizei WebGLFramebuffer::getColorBufferHeight() const
 {
     if (!object())
         return 0;
-    WebGLAttachment* attachment = getAttachment(GraphicsContext3D::COLOR_ATTACHMENT0);
+    RefPtr<WebGLAttachment> attachment = getAttachment(GraphicsContext3D::COLOR_ATTACHMENT0);
     if (!attachment)
         return 0;
 
@@ -409,7 +409,7 @@ GC3Denum WebGLFramebuffer::getColorBufferFormat() const
 {
     if (!object())
         return 0;
-    WebGLAttachment* attachment = getAttachment(GraphicsContext3D::COLOR_ATTACHMENT0);
+    RefPtr<WebGLAttachment> attachment = getAttachment(GraphicsContext3D::COLOR_ATTACHMENT0);
     if (!attachment)
         return 0;
     return attachment->getFormat();
@@ -423,8 +423,8 @@ GC3Denum WebGLFramebuffer::checkStatus(const char** reason) const
     bool haveStencil = false;
     bool haveDepthStencil = false;
     for (auto& entry : m_attachments) {
-        WebGLAttachment* attachment = entry.value.get();
-        if (!isAttachmentComplete(attachment, entry.key, reason))
+        RefPtr<WebGLAttachment> attachment = entry.value.get();
+        if (!isAttachmentComplete(attachment.get(), entry.key, reason))
             return GraphicsContext3D::FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
         if (!attachment->isValid()) {
             *reason = "attachment is not valid";
@@ -487,7 +487,7 @@ bool WebGLFramebuffer::onAccess(GraphicsContext3D* context3d, const char** reaso
 
 bool WebGLFramebuffer::hasStencilBuffer() const
 {
-    WebGLAttachment* attachment = getAttachment(GraphicsContext3D::STENCIL_ATTACHMENT);
+    RefPtr<WebGLAttachment> attachment = getAttachment(GraphicsContext3D::STENCIL_ATTACHMENT);
     if (!attachment)
         attachment = getAttachment(GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT);
     return attachment && attachment->isValid();
@@ -508,7 +508,7 @@ bool WebGLFramebuffer::initializeAttachments(GraphicsContext3D* g3d, const char*
 
     for (auto& entry : m_attachments) {
         GC3Denum attachmentType = entry.key;
-        WebGLAttachment* attachment = entry.value.get();
+        RefPtr<WebGLAttachment> attachment = entry.value.get();
         if (!attachment->isInitialized())
            mask |= GraphicsContext3D::getClearBitsByAttachmentType(attachmentType);
     }
@@ -580,7 +580,7 @@ bool WebGLFramebuffer::initializeAttachments(GraphicsContext3D* g3d, const char*
 
     for (AttachmentMap::iterator it = m_attachments.begin(); it != m_attachments.end(); ++it) {
         GC3Denum attachmentType = it->key;
-        WebGLAttachment* attachment = it->value.get();
+        auto attachment = it->value;
         GC3Dbitfield bits = GraphicsContext3D::getClearBitsByAttachmentType(attachmentType);
         if (bits & mask)
             attachment->setInitialized();
index 81f1552..788189a 100644 (file)
@@ -352,7 +352,7 @@ WebGLAny WebGLRenderingContext::getFramebufferAttachmentParameter(GC3Denum targe
                 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getFramebufferAttachmentParameter", "invalid parameter name for renderbuffer attachment");
                 return nullptr;
             }
-            WebGLRenderbuffer* renderBuffer = reinterpret_cast<WebGLRenderbuffer*>(object);
+            RefPtr<WebGLRenderbuffer> renderBuffer = reinterpret_cast<WebGLRenderbuffer*>(object);
             GC3Denum renderBufferFormat = renderBuffer->getInternalFormat();
             ASSERT(renderBufferFormat != Extensions3D::SRGB_EXT && renderBufferFormat != Extensions3D::SRGB_ALPHA_EXT);
             if (renderBufferFormat == Extensions3D::SRGB8_ALPHA8_EXT)
index f85ad12..f383499 100644 (file)
@@ -369,7 +369,7 @@ std::unique_ptr<WebGLRenderingContextBase> WebGLRenderingContextBase::create(HTM
 #endif
 
     Document& document = canvas.document();
-    Frame* frame = document.frame();
+    RefPtr<Frame> frame = document.frame();
     if (!frame)
         return nullptr;
 
@@ -1150,7 +1150,7 @@ void WebGLRenderingContextBase::bufferData(GC3Denum target, long long size, GC3D
 {
     if (isContextLostOrPending())
         return;
-    WebGLBuffer* buffer = validateBufferDataParameters("bufferData", target, usage);
+    RefPtr<WebGLBuffer> buffer = validateBufferDataParameters("bufferData", target, usage);
     if (!buffer)
         return;
     if (size < 0) {
@@ -1182,7 +1182,7 @@ void WebGLRenderingContextBase::bufferData(GC3Denum target, std::optional<Buffer
         synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferData", "null data");
         return;
     }
-    WebGLBuffer* buffer = validateBufferDataParameters("bufferData", target, usage);
+    RefPtr<WebGLBuffer> buffer = validateBufferDataParameters("bufferData", target, usage);
     if (!buffer)
         return;
 
@@ -1205,7 +1205,7 @@ void WebGLRenderingContextBase::bufferSubData(GC3Denum target, long long offset,
 {
     if (isContextLostOrPending())
         return;
-    WebGLBuffer* buffer = validateBufferDataParameters("bufferSubData", target, GraphicsContext3D::STATIC_DRAW);
+    RefPtr<WebGLBuffer> buffer = validateBufferDataParameters("bufferSubData", target, GraphicsContext3D::STATIC_DRAW);
     if (!buffer)
         return;
     if (offset < 0) {
@@ -1336,7 +1336,7 @@ void WebGLRenderingContextBase::compressedTexImage2D(GC3Denum target, GC3Dint le
     if (!validateCompressedTexFuncData("compressedTexImage2D", width, height, internalformat, data))
         return;
 
-    WebGLTexture* tex = validateTextureBinding("compressedTexImage2D", target, true);
+    RefPtr<WebGLTexture> tex = validateTextureBinding("compressedTexImage2D", target, true);
     if (!tex)
         return;
     if (!validateNPOTTextureLevel(width, height, level, "compressedTexImage2D"))
@@ -1367,7 +1367,7 @@ void WebGLRenderingContextBase::compressedTexSubImage2D(GC3Denum target, GC3Dint
     if (!validateCompressedTexFuncData("compressedTexSubImage2D", width, height, format, data))
         return;
 
-    WebGLTexture* tex = validateTextureBinding("compressedTexSubImage2D", target, true);
+    RefPtr<WebGLTexture> tex = validateTextureBinding("compressedTexSubImage2D", target, true);
     if (!tex)
         return;
 
@@ -1376,7 +1376,7 @@ void WebGLRenderingContextBase::compressedTexSubImage2D(GC3Denum target, GC3Dint
         return;
     }
 
-    if (!validateCompressedTexSubDimensions("compressedTexSubImage2D", target, level, xoffset, yoffset, width, height, format, tex))
+    if (!validateCompressedTexSubDimensions("compressedTexSubImage2D", target, level, xoffset, yoffset, width, height, format, tex.get()))
         return;
 
     graphicsContext3D()->compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, data.byteLength(), data.baseAddress());
@@ -1407,7 +1407,7 @@ void WebGLRenderingContextBase::copyTexSubImage2D(GC3Denum target, GC3Dint level
         return;
     if (!validateTexFuncLevel("copyTexSubImage2D", target, level))
         return;
-    WebGLTexture* tex = validateTextureBinding("copyTexSubImage2D", target, true);
+    RefPtr<WebGLTexture> tex = validateTextureBinding("copyTexSubImage2D", target, true);
     if (!tex)
         return;
     if (!validateSize("copyTexSubImage2D", xoffset, yoffset) || !validateSize("copyTexSubImage2D", width, height))
@@ -2176,7 +2176,7 @@ void WebGLRenderingContextBase::generateMipmap(GC3Denum target)
 {
     if (isContextLostOrPending())
         return;
-    WebGLTexture* tex = validateTextureBinding("generateMipmap", target, false);
+    RefPtr<WebGLTexture> tex = validateTextureBinding("generateMipmap", target, false);
     if (!tex)
         return;
     if (!tex->canGenerateMipmaps()) {
@@ -2248,7 +2248,7 @@ std::optional<Vector<RefPtr<WebGLShader>>> WebGLRenderingContextBase::getAttache
     };
     Vector<RefPtr<WebGLShader>> shaderObjects;
     for (auto shaderType : shaderTypes) {
-        WebGLShader* shader = program->getAttachedShader(shaderType);
+        RefPtr<WebGLShader> shader = program->getAttachedShader(shaderType);
         if (shader)
             shaderObjects.append(shader);
     }
@@ -2502,7 +2502,7 @@ WebGLAny WebGLRenderingContextBase::getTexParameter(GC3Denum target, GC3Denum pn
 {
     if (isContextLostOrPending())
         return nullptr;
-    WebGLTexture* tex = validateTextureBinding("getTexParameter", target, false);
+    RefPtr<WebGLTexture> tex = validateTextureBinding("getTexParameter", target, false);
     if (!tex)
         return nullptr;
     GC3Dint value = 0;
@@ -2850,9 +2850,9 @@ bool WebGLRenderingContextBase::linkProgramWithoutInvalidatingAttribLocations(We
     if (isContextLostOrPending() || !validateWebGLObject("linkProgram", program))
         return false;
 
-    WebGLShader* vertexShader = program->getAttachedShader(GraphicsContext3D::VERTEX_SHADER);
-    WebGLShader* fragmentShader = program->getAttachedShader(GraphicsContext3D::FRAGMENT_SHADER);
-    if (!vertexShader || !vertexShader->isValid() || !fragmentShader || !fragmentShader->isValid() || !m_context->precisionsMatch(objectOrZero(vertexShader), objectOrZero(fragmentShader)) || !m_context->checkVaryingsPacking(objectOrZero(vertexShader), objectOrZero(fragmentShader))) {
+    RefPtr<WebGLShader> vertexShader = program->getAttachedShader(GraphicsContext3D::VERTEX_SHADER);
+    RefPtr<WebGLShader> fragmentShader = program->getAttachedShader(GraphicsContext3D::FRAGMENT_SHADER);
+    if (!vertexShader || !vertexShader->isValid() || !fragmentShader || !fragmentShader->isValid() || !m_context->precisionsMatch(objectOrZero(vertexShader.get()), objectOrZero(fragmentShader.get())) || !m_context->checkVaryingsPacking(objectOrZero(vertexShader.get()), objectOrZero(fragmentShader.get()))) {
         program->setLinkStatus(false);
         return false;
     }
@@ -3352,7 +3352,7 @@ void WebGLRenderingContextBase::stencilOpSeparate(GC3Denum face, GC3Denum fail,
 void WebGLRenderingContextBase::texImage2DBase(GC3Denum target, GC3Dint level, GC3Denum internalFormat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, const void* pixels)
 {
     // FIXME: For now we ignore any errors returned.
-    WebGLTexture* tex = validateTextureBinding("texImage2D", target, true);
+    RefPtr<WebGLTexture> tex = validateTextureBinding("texImage2D", target, true);
     ASSERT(validateTexFuncParameters("texImage2D", TexImage, target, level, internalFormat, width, height, border, format, type));
     ASSERT(tex);
     ASSERT(validateNPOTTextureLevel(width, height, level, "texImage2D"));
@@ -3407,7 +3407,7 @@ bool WebGLRenderingContextBase::validateTexFunc(const char* functionName, TexFun
     if (!validateTexFuncParameters(functionName, functionType, target, level, internalFormat, width, height, border, format, type))
         return false;
 
-    WebGLTexture* texture = validateTextureBinding(functionName, target, true);
+    RefPtr<WebGLTexture> texture = validateTextureBinding(functionName, target, true);
     if (!texture)
         return false;
 
@@ -3508,7 +3508,7 @@ void WebGLRenderingContextBase::texSubImage2D(GC3Denum target, GC3Dint level, GC
     if (isContextLostOrPending())
         return;
 
-    WebGLTexture* texture = validateTextureBinding("texSubImage2D", target, true);
+    RefPtr<WebGLTexture> texture = validateTextureBinding("texSubImage2D", target, true);
     if (!texture)
         return;
 
@@ -3553,7 +3553,7 @@ ExceptionOr<void> WebGLRenderingContextBase::texSubImage2D(GC3Denum target, GC3D
         return { };
 
     auto visitor = WTF::makeVisitor([&](const RefPtr<ImageData>& pixels) -> ExceptionOr<void> {
-        WebGLTexture* texture = validateTextureBinding("texSubImage2D", target, true);
+        RefPtr<WebGLTexture> texture = validateTextureBinding("texSubImage2D", target, true);
         if (!texture)
             return { };
 
@@ -3603,7 +3603,7 @@ ExceptionOr<void> WebGLRenderingContextBase::texSubImage2D(GC3Denum target, GC3D
         if (imageForRender->isSVGImage())
             imageForRender = drawImageIntoBuffer(*imageForRender, image->width(), image->height(), 1);
 
-        WebGLTexture* texture = validateTextureBinding("texSubImage2D", target, true);
+        RefPtr<WebGLTexture> texture = validateTextureBinding("texSubImage2D", target, true);
         if (!texture)
             return { };
 
@@ -3627,7 +3627,7 @@ ExceptionOr<void> WebGLRenderingContextBase::texSubImage2D(GC3Denum target, GC3D
         if (!validationResult.returnValue())
             return { };
 
-        WebGLTexture* texture = validateTextureBinding("texSubImage2D", target, true);
+        RefPtr<WebGLTexture> texture = validateTextureBinding("texSubImage2D", target, true);
         if (!texture)
             return { };
 
@@ -3657,7 +3657,7 @@ ExceptionOr<void> WebGLRenderingContextBase::texSubImage2D(GC3Denum target, GC3D
         if (!validationResult.returnValue())
             return { };
 
-        WebGLTexture* texture = validateTextureBinding("texSubImage2D", target, true);
+        RefPtr<WebGLTexture> texture = validateTextureBinding("texSubImage2D", target, true);
         if (!texture)
             return { };
 
@@ -4026,7 +4026,7 @@ void WebGLRenderingContextBase::texSubImage2DBase(GC3Denum target, GC3Dint level
     ASSERT(validateTexFuncParameters("texSubImage2D", TexSubImage, target, level, internalFormat, width, height, 0, format, type));
     ASSERT(validateSize("texSubImage2D", xoffset, yoffset));
     ASSERT(validateSettableTexInternalFormat("texSubImage2D", internalFormat));
-    WebGLTexture* tex = validateTextureBinding("texSubImage2D", target, true);
+    RefPtr<WebGLTexture> tex = validateTextureBinding("texSubImage2D", target, true);
     if (!tex) {
         ASSERT_NOT_REACHED();
         return;
@@ -4047,7 +4047,7 @@ void WebGLRenderingContextBase::copyTexImage2D(GC3Denum target, GC3Dint level, G
         return;
     if (!validateSettableTexInternalFormat("copyTexImage2D", internalFormat))
         return;
-    WebGLTexture* tex = validateTextureBinding("copyTexImage2D", target, true);
+    RefPtr<WebGLTexture> tex = validateTextureBinding("copyTexImage2D", target, true);
     if (!tex)
         return;
     if (!isTexInternalFormatColorBufferCombinationValid(internalFormat, getBoundFramebufferColorFormat())) {
@@ -4149,7 +4149,7 @@ ExceptionOr<void> WebGLRenderingContextBase::texImage2D(GC3Denum target, GC3Dint
         if (!validateTexFunc("texImage2D", TexImage, SourceHTMLCanvasElement, target, level, internalformat, canvas->width(), canvas->height(), 0, format, type, 0, 0))
             return { };
 
-        WebGLTexture* texture = validateTextureBinding("texImage2D", target, true);
+        RefPtr<WebGLTexture> texture = validateTextureBinding("texImage2D", target, true);
         // If possible, copy from the canvas element directly to the texture
         // via the GPU, without a read-back to system memory.
         //
@@ -4191,7 +4191,7 @@ ExceptionOr<void> WebGLRenderingContextBase::texImage2D(GC3Denum target, GC3Dint
         // Otherwise, it will fall back to the normal SW path.
         // FIXME: The current restrictions require that format shoud be RGB or RGBA,
         // type should be UNSIGNED_BYTE and level should be 0. It may be lifted in the future.
-        WebGLTexture* texture = validateTextureBinding("texImage2D", target, true);
+        RefPtr<WebGLTexture> texture = validateTextureBinding("texImage2D", target, true);
         if (GraphicsContext3D::TEXTURE_2D == target && texture
             && (format == GraphicsContext3D::RGB || format == GraphicsContext3D::RGBA)
             && type == GraphicsContext3D::UNSIGNED_BYTE
@@ -4256,7 +4256,7 @@ void WebGLRenderingContextBase::texParameter(GC3Denum target, GC3Denum pname, GC
 {
     if (isContextLostOrPending())
         return;
-    WebGLTexture* tex = validateTextureBinding("texParameter", target, false);
+    RefPtr<WebGLTexture> tex = validateTextureBinding("texParameter", target, false);
     if (!tex)
         return;
     switch (pname) {
@@ -4657,7 +4657,7 @@ void WebGLRenderingContextBase::loseContextImpl(WebGLRenderingContextBase::LostC
     if (mode == RealLostContext) {
         // Inform the embedder that a lost context was received. In response, the embedder might
         // decide to take action such as asking the user for permission to use WebGL again.
-        if (Frame* frame = canvas().document().frame())
+        if (RefPtr<Frame> frame = canvas().document().frame())
             frame->loader().client().didLoseWebGLContext(m_context->getExtensions().getGraphicsResetStatusARB());
     }
 
@@ -4890,8 +4890,8 @@ bool WebGLRenderingContextBase::checkTextureCompleteness(const char* functionNam
             m_context->activeTexture(badTexture + GraphicsContext3D::TEXTURE0);
             resetActiveUnit = false;
         }
-        WebGLTexture* tex2D;
-        WebGLTexture* texCubeMap;
+        RefPtr<WebGLTexture> tex2D;
+        RefPtr<WebGLTexture> texCubeMap;
         if (prepareToDraw) {
             String msg(String("texture bound to texture unit ") + String::number(badTexture)
                 + " is not renderable. It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete',"
@@ -4904,9 +4904,9 @@ bool WebGLRenderingContextBase::checkTextureCompleteness(const char* functionNam
             texCubeMap = textureUnit.textureCubeMapBinding.get();
         }
         if (needsToUseBlack2DTexture)
-            m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, objectOrZero(tex2D));
+            m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, objectOrZero(tex2D.get()));
         if (needsToUseBlack3DTexture)
-            m_context->bindTexture(GraphicsContext3D::TEXTURE_CUBE_MAP, objectOrZero(texCubeMap));
+            m_context->bindTexture(GraphicsContext3D::TEXTURE_CUBE_MAP, objectOrZero(texCubeMap.get()));
     }
     if (resetActiveUnit)
         m_context->activeTexture(m_activeTextureUnit + GraphicsContext3D::TEXTURE0);
@@ -4975,7 +4975,7 @@ int WebGLRenderingContextBase::getBoundFramebufferHeight()
 
 WebGLTexture* WebGLRenderingContextBase::validateTextureBinding(const char* functionName, GC3Denum target, bool useSixEnumsForCubeMap)
 {
-    WebGLTexture* texture = nullptr;
+    RefPtr<WebGLTexture> texture;
     switch (target) {
     case GraphicsContext3D::TEXTURE_2D:
         texture = m_textureUnits[m_activeTextureUnit].texture2DBinding.get();
@@ -5009,7 +5009,7 @@ WebGLTexture* WebGLRenderingContextBase::validateTextureBinding(const char* func
 
     if (!texture)
         synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "no texture");
-    return texture;
+    return texture.get();
 }
 
 bool WebGLRenderingContextBase::validateLocationLength(const char* functionName, const String& string)
@@ -5675,17 +5675,17 @@ void WebGLRenderingContextBase::maybeRestoreContext()
         break;
     }
 
-    Frame* frame = canvas().document().frame();
+    RefPtr<Frame> frame = canvas().document().frame();
     if (!frame)
         return;
 
     if (!frame->loader().client().allowWebGL(frame->settings().webGLEnabled()))
         return;
 
-    FrameView* view = frame->view();
+    RefPtr<FrameView> view = frame->view();
     if (!view)
         return;
-    ScrollView* root = view->root();
+    RefPtr<ScrollView> root = view->root();
     if (!root)
         return;
     HostWindow* hostWindow = root->hostWindow();
index af499b3..bbb068c 100644 (file)
@@ -56,7 +56,7 @@ GPURenderPassColorAttachmentDescriptor* WebGPURenderPassColorAttachmentDescripto
 
 Vector<float> WebGPURenderPassColorAttachmentDescriptor::clearColor() const
 {
-    GPURenderPassColorAttachmentDescriptor* descriptor = renderPassColorAttachmentDescriptor();
+    RefPtr<GPURenderPassColorAttachmentDescriptor> descriptor = renderPassColorAttachmentDescriptor();
     if (!descriptor) {
         Vector<float> black = { 0.0, 0.0, 0.0, 1.0 };
         return black;
@@ -66,7 +66,7 @@ Vector<float> WebGPURenderPassColorAttachmentDescriptor::clearColor() const
 
 void WebGPURenderPassColorAttachmentDescriptor::setClearColor(const Vector<float>& newClearColor)
 {
-    GPURenderPassColorAttachmentDescriptor* descriptor = renderPassColorAttachmentDescriptor();
+    RefPtr<GPURenderPassColorAttachmentDescriptor> descriptor = renderPassColorAttachmentDescriptor();
     if (!descriptor)
         return;
 
index 025d17d..2fbed26 100644 (file)
@@ -51,7 +51,7 @@ WebGPURenderPassDepthAttachmentDescriptor::~WebGPURenderPassDepthAttachmentDescr
 
 double WebGPURenderPassDepthAttachmentDescriptor::clearDepth() const
 {
-    GPURenderPassDepthAttachmentDescriptor* descriptor = renderPassDepthAttachmentDescriptor();
+    RefPtr<GPURenderPassDepthAttachmentDescriptor> descriptor = renderPassDepthAttachmentDescriptor();
     if (!descriptor)
         return 0;
 
@@ -60,7 +60,7 @@ double WebGPURenderPassDepthAttachmentDescriptor::clearDepth() const
 
 void WebGPURenderPassDepthAttachmentDescriptor::setClearDepth(double newClearDepth)
 {
-    GPURenderPassDepthAttachmentDescriptor* descriptor = renderPassDepthAttachmentDescriptor();
+    RefPtr<GPURenderPassDepthAttachmentDescriptor> descriptor = renderPassDepthAttachmentDescriptor();
     if (!descriptor)
         return;
     
index 0924551..2df2b74 100644 (file)
@@ -144,7 +144,7 @@ static inline void executeInsertAlreadyParsedChildTask(HTMLConstructionSiteTask&
 {
     ASSERT(task.operation == HTMLConstructionSiteTask::InsertAlreadyParsedChild);
 
-    if (ContainerNode* parent = task.child->parentNode())
+    if (RefPtr<ContainerNode> parent = task.child->parentNode())
         parent->parserRemoveChild(*task.child);
 
     if (task.child->parentNode())
@@ -588,8 +588,8 @@ void HTMLConstructionSite::insertTextNode(const String& characters, WhitespaceMo
     // FIXME: Splitting text nodes into smaller chunks contradicts HTML5 spec, but is currently necessary
     // for performance, see <https://bugs.webkit.org/show_bug.cgi?id=55898>.
 
-    Node* previousChild = task.nextChild ? task.nextChild->previousSibling() : task.parent->lastChild();
-    if (is<Text>(previousChild)) {
+    RefPtr<Node> previousChild = task.nextChild ? task.nextChild->previousSibling() : task.parent->lastChild();
+    if (is<Text>(previousChild.get())) {
         // FIXME: We're only supposed to append to this text node if it
         // was the last text node inserted by the parser.
         currentPosition = downcast<Text>(*previousChild).parserAppendData(characters, 0, lengthLimit);
index d35101b..139da18 100644 (file)
@@ -143,13 +143,13 @@ void HTMLFormattingElementList::tryToEnsureNoahsArkConditionQuickly(HTMLStackIte
             break;
 
         // Quickly reject obviously non-matching candidates.
-        HTMLStackItem* candidate = entry.stackItem();
+        RefPtr<HTMLStackItem> candidate = entry.stackItem();
         if (newItem.localName() != candidate->localName() || newItem.namespaceURI() != candidate->namespaceURI())
             continue;
         if (candidate->attributes().size() != newItemAttributeCount)
             continue;
 
-        candidates.append(candidate);
+        candidates.append(candidate.get());
     }
 
     if (candidates.size() < kNoahsArkCapacity)
index 0d2d9fb..8bc4147 100644 (file)
@@ -45,7 +45,7 @@ HTMLParserOptions::HTMLParserOptions()
 
 HTMLParserOptions::HTMLParserOptions(Document& document)
 {
-    Frame* frame = document.frame();
+    RefPtr<Frame> frame = document.frame();
     scriptEnabled = frame && frame->script().canExecuteScripts(NotAboutToExecuteScript);
     pluginsEnabled = frame && frame->loader().subframeLoader().allowPlugins();
 
index e6c382f..907a272 100644 (file)
@@ -111,7 +111,7 @@ bool HTMLParserScheduler::shouldYieldBeforeExecutingScript(PumpSession& session)
 {
     // If we've never painted before and a layout is pending, yield prior to running
     // scripts to give the page a chance to paint earlier.
-    Document* document = m_parser.document();
+    RefPtr<Document> document = m_parser.document();
     bool needsFirstPaint = document->view() && !document->view()->hasEverPainted();
     session.didSeeScript = true;
     return needsFirstPaint && document->isLayoutTimerActive();
index 53ea8b0..e8a164d 100644 (file)
@@ -685,7 +685,7 @@ void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken&& token)
         return;
     }
     if (token.name() == aTag) {
-        Element* activeATag = m_tree.activeFormattingElements().closestElementInScopeWithName(aTag.localName());
+        RefPtr<Element> activeATag = m_tree.activeFormattingElements().closestElementInScopeWithName(aTag.localName());
         if (activeATag) {
             parseError(token);
             processFakeEndTag(aTag);
@@ -1425,7 +1425,7 @@ void HTMLTreeBuilder::callTheAdoptionAgency(AtomicHTMLToken& token)
     // 1, 2, 3 and 16 are covered by the for() loop.
     for (int i = 0; i < outerIterationLimit; ++i) {
         // 4.
-        Element* formattingElement = m_tree.activeFormattingElements().closestElementInScopeWithName(token.name());
+        RefPtr<Element> formattingElement = m_tree.activeFormattingElements().closestElementInScopeWithName(token.name());
         // 4.a
         if (!formattingElement)
             return processAnyOtherEndTagForInBody(WTFMove(token));
@@ -1511,7 +1511,7 @@ void HTMLTreeBuilder::resetInsertionModeAppropriately()
     // http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#reset-the-insertion-mode-appropriately
     bool last = false;
     for (auto* record = &m_tree.openElements().topRecord(); ; record = record->next()) {
-        HTMLStackItem* item = &record->stackItem();
+        RefPtr<HTMLStackItem> item = &record->stackItem();
         if (&item->node() == &m_tree.openElements().rootNode()) {
             last = true;
             bool shouldCreateItem = isParsingFragment();
index ef45303..93ffa5b 100644 (file)
@@ -283,7 +283,7 @@ void XSSAuditor::init(Document* document, XSSAuditorDelegate* auditorDelegate)
     ASSERT(m_state == Uninitialized);
     m_state = Initialized;
 
-    if (Frame* frame = document->frame())
+    if (RefPtr<Frame> frame = document->frame())
         m_isEnabled = frame->settings().xssAuditorEnabled();
 
     if (!m_isEnabled)
@@ -317,7 +317,7 @@ void XSSAuditor::init(Document* document, XSSAuditorDelegate* auditorDelegate)
         m_decodedURL = String();
 
     String httpBodyAsString;
-    if (DocumentLoader* documentLoader = document->frame()->loader().documentLoader()) {
+    if (RefPtr<DocumentLoader> documentLoader = document->frame()->loader().documentLoader()) {
         static NeverDestroyed<String> XSSProtectionHeader(MAKE_STATIC_STRING_IMPL("X-XSS-Protection"));
         String headerValue = documentLoader->response().httpHeaderField(XSSProtectionHeader);
         String errorDetails;
@@ -343,7 +343,7 @@ void XSSAuditor::init(Document* document, XSSAuditorDelegate* auditorDelegate)
 
         if (auditorDelegate)
             auditorDelegate->setReportURL(reportURL.isolatedCopy());
-        FormData* httpBody = documentLoader->originalRequest().httpBody();
+        RefPtr<FormData> httpBody = documentLoader->originalRequest().httpBody();
         if (httpBody && !httpBody->isEmpty()) {
             httpBodyAsString = httpBody->flattenToString();
             if (!httpBodyAsString.isEmpty()) {
index b1c736c..d1aad04 100644 (file)
@@ -46,16 +46,16 @@ using namespace HTMLNames;
 
 class Event;
 
-HTMLMediaElement* parentMediaElement(Node* node)
+RefPtr<HTMLMediaElement> parentMediaElement(Node* node)
 {
     if (!node)
         return nullptr;
-    Node* mediaNode = node->shadowHost();
+    RefPtr<Node> mediaNode = node->shadowHost();
     if (!mediaNode)
         mediaNode = node;
     if (!is<HTMLMediaElement>(*mediaNode))
         return nullptr;
-    return downcast<HTMLMediaElement>(mediaNode);
+    return downcast<HTMLMediaElement>(mediaNode.get());
 }
 
 MediaControlElementType mediaControlElementType(Node* node)
index 81fd05b..41ec645 100644 (file)
@@ -72,8 +72,8 @@ enum MediaControlElementType {
     MediaClosedCaptionsTrackList,
 };
 
-HTMLMediaElement* parentMediaElement(Node*);
-inline HTMLMediaElement* parentMediaElement(const RenderObject& renderer) { return parentMediaElement(renderer.node()); }
+RefPtr<HTMLMediaElement> parentMediaElement(Node*);
+inline RefPtr<HTMLMediaElement> parentMediaElement(const RenderObject& renderer) { return parentMediaElement(renderer.node()); }
 
 MediaControlElementType mediaControlElementType(Node*);
 
index 5794f86..187b783 100644 (file)
@@ -96,7 +96,7 @@ void MediaControlPanelElement::startDrag(const LayoutPoint& eventLocation)
     if (!renderer || !renderer->isBox())
         return;
 
-    Frame* frame = document().frame();
+    RefPtr<Frame> frame = document().frame();
     if (!frame)
         return;
 
@@ -125,7 +125,7 @@ void MediaControlPanelElement::endDrag()
 
     m_isBeingDragged = false;
 
-    Frame* frame = document().frame();
+    RefPtr<Frame> frame = document().frame();
     if (!frame)
         return;
 
@@ -346,7 +346,7 @@ void MediaControlVolumeSliderContainerElement::defaultEventHandler(Event& event)
     if (!relatedTarget || !relatedTarget->toNode())
         return;
 
-    if (this->containsIncludingShadowDOM(relatedTarget->toNode()))
+    if (this->containsIncludingShadowDOM(relatedTarget->toNode().get()))
         return;
 
     hide();
@@ -688,8 +688,8 @@ void MediaControlClosedCaptionsTrackListElement::defaultEventHandler(Event& even
 {
 #if ENABLE(VIDEO_TRACK)
     if (event.type() == eventNames().clickEvent) {
-        Node* target = event.target()->toNode();
-        if (!is<Element>(target))
+        RefPtr<Node> target = event.target()->toNode();
+        if (!is<Element>(target.get()))
             return;
 
         // When we created the elements in the track list, we gave them a custom
@@ -698,7 +698,7 @@ void MediaControlClosedCaptionsTrackListElement::defaultEventHandler(Event& even
         // tell the HTMLMediaElement to enable that track.
 
         RefPtr<TextTrack> textTrack;
-        MenuItemToTrackMap::iterator iter = m_menuToTrackMap.find(downcast<Element>(target));
+        MenuItemToTrackMap::iterator iter = m_menuToTrackMap.find(downcast<Element>(target.get()));
         if (iter != m_menuToTrackMap.end())
             textTrack = iter->value;
         m_menuToTrackMap.clear();
@@ -706,7 +706,7 @@ void MediaControlClosedCaptionsTrackListElement::defaultEventHandler(Event& even
         if (!textTrack)
             return;
 
-        HTMLMediaElement* mediaElement = parentMediaElement(this);
+        auto mediaElement = parentMediaElement(this);
         if (!mediaElement)
             return;
 
@@ -733,7 +733,7 @@ void MediaControlClosedCaptionsTrackListElement::updateDisplay()
         return;
     CaptionUserPreferences::CaptionDisplayMode displayMode = document().page()->group().captionPreferences().captionDisplayMode();
 
-    HTMLMediaElement* mediaElement = parentMediaElement(this);
+    auto mediaElement = parentMediaElement(this);
     if (!mediaElement)
         return;
 
@@ -794,7 +794,7 @@ void MediaControlClosedCaptionsTrackListElement::rebuildTrackListMenu()
     if (!mediaController()->hasClosedCaptions())
         return;
 
-    HTMLMediaElement* mediaElement = parentMediaElement(this);
+    auto mediaElement = parentMediaElement(this);
     if (!mediaElement)
         return;
 
@@ -959,7 +959,7 @@ void MediaControlFullscreenButtonElement::defaultEventHandler(Event& event)
             if (document().webkitIsFullScreen() && document().webkitCurrentFullScreenElement() == parentMediaElement(this))
                 document().webkitCancelFullScreen();
             else
-                document().requestFullScreenForElement(parentMediaElement(this), Document::ExemptIFrameAllowFullScreenRequirement);
+                document().requestFullScreenForElement(parentMediaElement(this).get(), Document::ExemptIFrameAllowFullScreenRequirement);
         } else
 #endif
             mediaController()->enterFullscreen();
@@ -1097,7 +1097,7 @@ void MediaControlTextTrackContainerElement::updateDisplay()
     if (!mediaController()->closedCaptionsVisible())
         removeChildren();
 
-    HTMLMediaElement* mediaElement = parentMediaElement(this);
+    auto mediaElement = parentMediaElement(this);
     // 1. If the media element is an audio element, or is another playback
     // mechanism with no rendering area, abort these steps. There is nothing to
     // render.
@@ -1160,11 +1160,11 @@ void MediaControlTextTrackContainerElement::updateDisplay()
         if (!mediaController()->closedCaptionsVisible())
             continue;
 
-        TextTrackCue* textTrackCue = activeCues[i].data();
+        RefPtr<TextTrackCue> textTrackCue = activeCues[i].data();
         if (!textTrackCue->isRenderable())
             continue;
 
-        VTTCue* cue = toVTTCue(textTrackCue);
+        RefPtr<VTTCue> cue = toVTTCue(textTrackCue.get());
 
         ASSERT(cue->isActive());
         if (!cue->track() || !cue->track()->isRendered() || !cue->isActive() || cue->text().isEmpty())
@@ -1176,7 +1176,7 @@ void MediaControlTextTrackContainerElement::updateDisplay()
         if (cue->track()->mode() == TextTrack::Mode::Disabled)
             continue;
 
-        VTTRegion* region = cue->track()->regions()->getRegionById(cue->regionId());
+        RefPtr<VTTRegion> region = cue->track()->regions()->getRegionById(cue->regionId());
         if (!region) {
             // If cue has an empty text track cue region identifier or there is no
             // WebVTT region whose region identifier is identical to cue's text
@@ -1214,7 +1214,7 @@ void MediaControlTextTrackContainerElement::updateActiveCuesFontSize()
     if (!document().page())
         return;
 
-    HTMLMediaElement* mediaElement = parentMediaElement(this);
+    auto mediaElement = parentMediaElement(this);
     if (!mediaElement)
         return;
 
@@ -1223,11 +1223,11 @@ void MediaControlTextTrackContainerElement::updateActiveCuesFontSize()
     m_fontSize = lroundf(smallestDimension * fontScale);
 
     for (auto& activeCue : mediaElement->currentlyActiveCues()) {
-        TextTrackCue* cue = activeCue.data();
+        RefPtr<TextTrackCue> cue = activeCue.data();
         if (!cue->isRenderable())
             continue;
 
-        toVTTCue(cue)->setFontSize(m_fontSize, m_videoDisplaySize.size(), m_fontSizeIsImportant);
+        toVTTCue(cue.get())->setFontSize(m_fontSize, m_videoDisplaySize.size(), m_fontSizeIsImportant);
     }
 
 }
@@ -1237,7 +1237,7 @@ void MediaControlTextTrackContainerElement::updateTextStrokeStyle()
     if (!document().page())
         return;
 
-    HTMLMediaElement* mediaElement = parentMediaElement(this);
+    auto mediaElement = parentMediaElement(this);
     if (!mediaElement)
         return;
     
@@ -1278,7 +1278,7 @@ void MediaControlTextTrackContainerElement::updateTimerFired()
 
 void MediaControlTextTrackContainerElement::updateTextTrackRepresentation()
 {
-    HTMLMediaElement* mediaElement = parentMediaElement(this);
+    auto mediaElement = parentMediaElement(this);
     if (!mediaElement)
         return;
 
@@ -1309,7 +1309,7 @@ void MediaControlTextTrackContainerElement::clearTextTrackRepresentation()
 
     m_textTrackRepresentation = nullptr;
     m_updateTextTrackRepresentationStyle = true;
-    if (HTMLMediaElement* mediaElement = parentMediaElement(this))
+    if (auto mediaElement = parentMediaElement(this))
         mediaElement->setTextTrackRepresentation(nullptr);
     updateStyleForTextTrackRepresentation();
     updateActiveCuesFontSize();
@@ -1352,7 +1352,7 @@ void MediaControlTextTrackContainerElement::exitedFullscreen()
 
 void MediaControlTextTrackContainerElement::updateSizes(bool forceUpdate)
 {
-    HTMLMediaElement* mediaElement = parentMediaElement(this);
+    auto mediaElement = parentMediaElement(this);
     if (!mediaElement)
         return;
 
@@ -1388,7 +1388,7 @@ RefPtr<Image> MediaControlTextTrackContainerElement::createTextTrackRepresentati
     if (!hasChildNodes())
         return nullptr;
 
-    Frame* frame = document().frame();
+    RefPtr<Frame> frame = document().frame();
     if (!frame)
         return nullptr;
 
index 0db5964..bdee1bb 100644 (file)
@@ -363,7 +363,7 @@ bool MediaControls::containsRelatedTarget(Event& event)
     EventTarget* relatedTarget = downcast<MouseEvent>(event).relatedTarget();
     if (!relatedTarget)
         return false;
-    return contains(relatedTarget->toNode());
+    return contains(relatedTarget->toNode().get());
 }
 
 #if ENABLE(VIDEO_TRACK)
index 6f8865f..6c5eba5 100644 (file)
@@ -226,17 +226,17 @@ RenderPtr<RenderElement> SliderThumbElement::createElementRenderer(RenderStyle&&
 
 bool SliderThumbElement::isDisabledFormControl() const
 {
-    HTMLInputElement* input = hostInput();
+    auto input = hostInput();
     return !input || input->isDisabledFormControl();
 }
 
 bool SliderThumbElement::matchesReadWritePseudoClass() const
 {
-    HTMLInputElement* input = hostInput();
+    auto input = hostInput();
     return input && input->matchesReadWritePseudoClass();
 }
 
-Element* SliderThumbElement::focusDelegate()
+RefPtr<Element> SliderThumbElement::focusDelegate()
 {
     return hostInput();
 }
@@ -252,7 +252,7 @@ void SliderThumbElement::dragFrom(const LayoutPoint& point)
 
 void SliderThumbElement::setPositionFromPoint(const LayoutPoint& absolutePoint)
 {
-    RefPtr<HTMLInputElement> input = hostInput();
+    auto input = hostInput();
     if (!input)
         return;
 
@@ -319,7 +319,7 @@ void SliderThumbElement::setPositionFromPoint(const LayoutPoint& absolutePoint)
 
 void SliderThumbElement::startDragging()
 {
-    if (Frame* frame = document().frame()) {
+    if (RefPtr<Frame> frame = document().frame()) {
         frame->eventHandler().setCapturingMouseEventsElement(this);
         m_inDragMode = true;
     }
@@ -330,7 +330,7 @@ void SliderThumbElement::stopDragging()
     if (!m_inDragMode)
         return;
 
-    if (Frame* frame = document().frame())
+    if (RefPtr<Frame> frame = document().frame())
         frame->eventHandler().setCapturingMouseEventsElement(nullptr);
     m_inDragMode = false;
     if (renderer())
@@ -347,7 +347,7 @@ void SliderThumbElement::defaultEventHandler(Event& event)
 
     // FIXME: Should handle this readonly/disabled check in more general way.
     // Missing this kind of check is likely to occur elsewhere if adding it in each shadow element.
-    HTMLInputElement* input = hostInput();
+    auto input = hostInput();
     if (!input || input->isDisabledFormControl()) {
         HTMLDivElement::defaultEventHandler(event);
         return;
@@ -380,7 +380,7 @@ void SliderThumbElement::defaultEventHandler(Event& event)
 #if !PLATFORM(IOS)
 bool SliderThumbElement::willRespondToMouseMoveEvents()
 {
-    const HTMLInputElement* input = hostInput();
+    const auto input = hostInput();
     if (input && !input->isDisabledFormControl() && m_inDragMode)
         return true;
 
@@ -389,7 +389,7 @@ bool SliderThumbElement::willRespondToMouseMoveEvents()
 
 bool SliderThumbElement::willRespondToMouseClickEvents()
 {
-    const HTMLInputElement* input = hostInput();
+    const auto input = hostInput();
     if (input && !input->isDisabledFormControl())
         return true;
 
@@ -400,7 +400,7 @@ bool SliderThumbElement::willRespondToMouseClickEvents()
 void SliderThumbElement::willDetachRenderers()
 {
     if (m_inDragMode) {
-        if (Frame* frame = document().frame())
+        if (RefPtr<Frame> frame = document().frame())
             frame->eventHandler().setCapturingMouseEventsElement(nullptr);
     }
 #if ENABLE(IOS_TOUCH_EVENTS)
@@ -429,23 +429,23 @@ static Touch* findTouchWithIdentifier(TouchList& list, unsigned identifier)
 {
     unsigned length = list.length();
     for (unsigned i = 0; i < length; ++i) {
-        Touch* touch = list.item(i);
+        RefPtr<Touch> touch = list.item(i);
         if (touch->identifier() == identifier)
-            return touch;
+            return touch.get();
     }
     return nullptr;
 }
 
 void SliderThumbElement::handleTouchStart(TouchEvent& touchEvent)
 {
-    TouchList* targetTouches = touchEvent.targetTouches();
+    RefPtr<TouchList> targetTouches = touchEvent.targetTouches();
     if (!targetTouches)
         return;
 
     if (targetTouches->length() != 1)
         return;
 
-    Touch* touch = targetTouches->item(0);
+    RefPtr<Touch> touch = targetTouches->item(0);
     if (!renderer())
         return;
     IntRect boundingBox = renderer()->absoluteBoundingBoxRect();
@@ -465,11 +465,11 @@ void SliderThumbElement::handleTouchMove(TouchEvent& touchEvent)
     if (identifier == NoIdentifier)
         return;
 
-    TouchList* targetTouches = touchEvent.targetTouches();
+    RefPtr<TouchList> targetTouches = touchEvent.targetTouches();
     if (!targetTouches)
         return;
 
-    Touch* touch = findTouchWithIdentifier(*targetTouches, identifier);
+    RefPtr<Touch> touch = findTouchWithIdentifier(*targetTouches, identifier);
     if (!touch)
         return;
 
@@ -484,18 +484,18 @@ void SliderThumbElement::handleTouchEndAndCancel(TouchEvent& touchEvent)
     if (identifier == NoIdentifier)
         return;
 
-    TouchList* targetTouches = touchEvent.targetTouches();
+    RefPtr<TouchList> targetTouches = touchEvent.targetTouches();
     if (!targetTouches)
         return;
     // If our exclusive touch still exists, it was not the touch
     // that ended, so we should not stop dragging.
-    Touch* exclusiveTouch = findTouchWithIdentifier(*targetTouches, identifier);
+    RefPtr<Touch> exclusiveTouch = findTouchWithIdentifier(*targetTouches, identifier);
     if (exclusiveTouch)
         return;
 
     clearExclusiveTouchIdentifier();
 
-    RefPtr<HTMLInputElement> input = hostInput();
+    auto input = hostInput();
     if (input)
         input->dispatchFormControlChangeEvent();
     stopDragging();
@@ -509,7 +509,7 @@ void SliderThumbElement::didAttachRenderers()
 
 void SliderThumbElement::handleTouchEvent(TouchEvent& touchEvent)
 {
-    HTMLInputElement* input = hostInput();
+    auto input = hostInput();
     ASSERT(input);
     if (input->isReadOnly() || input->isDisabledFormControl()) {
         clearExclusiveTouchIdentifier();
@@ -578,7 +578,7 @@ void SliderThumbElement::disabledAttributeChanged()
 #endif
 }
 
-HTMLInputElement* SliderThumbElement::hostInput() const
+RefPtr<HTMLInputElement> SliderThumbElement::hostInput() const
 {
     // Only HTMLInputElement creates SliderThumbElement instances as its shadow nodes.
     // So, shadowHost() must be an HTMLInputElement.
index 944165f..175dba1 100644 (file)
@@ -47,7 +47,7 @@ public:
 
     void setPositionFromValue();
     void dragFrom(const LayoutPoint&);
-    HTMLInputElement* hostInput() const;
+    RefPtr<HTMLInputElement> hostInput() const;
     void setPositionFromPoint(const LayoutPoint&);
 
 #if ENABLE(IOS_TOUCH_EVENTS)
@@ -64,7 +64,7 @@ private:
     Ref<Element> cloneElementWithoutAttributesAndChildren(Document&) override;
     bool isDisabledFormControl() const override;
     bool matchesReadWritePseudoClass() const override;
-    Element* focusDelegate() override;
+    RefPtr<Element> focusDelegate() override;
 #if !PLATFORM(IOS)
     void defaultEventHandler(Event&) override;
     bool willRespondToMouseMoveEvents() override;
index 98bd72b..d05f85f 100644 (file)
@@ -115,7 +115,7 @@ void SpinButtonElement::defaultEventHandler(Event& event)
     else if (mouseEvent.type() == eventNames().mousemoveEvent) {
         if (box->borderBoxRect().contains(local)) {
             if (!m_capturing) {
-                if (Frame* frame = document().frame()) {
+                if (RefPtr<Frame> frame = document().frame()) {
                     frame->eventHandler().setCapturingMouseEventsElement(this);
                     m_capturing = true;
                     if (Page* page = document().page())
@@ -201,7 +201,7 @@ void SpinButtonElement::releaseCapture()
 {
     stopRepeatingTimer();
     if (m_capturing) {
-        if (Frame* frame = document().frame()) {
+        if (RefPtr<Frame> frame = document().frame()) {
             frame->eventHandler().setCapturingMouseEventsElement(nullptr);
             m_capturing = false;
             if (Page* page = document().page())
index 584da68..05111d1 100644 (file)
@@ -111,7 +111,7 @@ void TextControlInnerTextElement::defaultEventHandler(Event& event)
     // Then we would add one to the text field's inner div, and we wouldn't need this subclass.
     // Or possibly we could just use a normal event listener.
     if (event.isBeforeTextInsertedEvent() || event.type() == eventNames().webkitEditableContentChangedEvent) {
-        Element* shadowAncestor = shadowHost();
+        RefPtr<Element> shadowAncestor = shadowHost();
         // A TextControlInnerTextElement can have no host if its been detached,
         // but kept alive by an EditCommand. In this case, an undo/redo can
         // cause events to be sent to the TextControlInnerTextElement. To
@@ -250,7 +250,7 @@ void SearchFieldCancelButtonElement::defaultEventHandler(Event& event)
 #if !PLATFORM(IOS)
 bool SearchFieldCancelButtonElement::willRespondToMouseClickEvents()
 {
-    const HTMLInputElement* input = downcast<HTMLInputElement>(shadowHost());
+    const RefPtr<HTMLInputElement> input = downcast<HTMLInputElement>(shadowHost());
     if (input && !input->isDisabledOrReadOnly())
         return true;
 
index 2cd6504..e22b2a0 100644 (file)
@@ -109,7 +109,7 @@ RefPtr<ImageControlsButtonElementMac> ImageControlsButtonElementMac::tryCreate(D
 void ImageControlsButtonElementMac::defaultEventHandler(Event& event)
 {
     if (event.type() == eventNames().clickEvent) {
-        Frame* frame = document().frame();
+        RefPtr<Frame> frame = document().frame();
         if (!frame)
             return;
 
index 5d7f0bf..238ebe7 100644 (file)
@@ -144,7 +144,7 @@ size_t LoadableTextTrack::trackElementIndex()
     ASSERT(m_trackElement->parentNode());
 
     size_t index = 0;
-    for (Node* node = m_trackElement->parentNode()->firstChild(); node; node = node->nextSibling()) {
+    for (RefPtr<Node> node = m_trackElement->parentNode()->firstChild(); node; node = node->nextSibling()) {
         if (!node->hasTagName(trackTag) || !node->parentNode())
             continue;
         if (node == m_trackElement)
index 2519e8c..90e42a4 100644 (file)
@@ -235,9 +235,9 @@ void TextTrack::setMode(Mode mode)
 
     if (mode != Mode::Showing && m_cues) {
         for (size_t i = 0; i < m_cues->length(); ++i) {
-            TextTrackCue* cue = m_cues->item(i);
+            RefPtr<TextTrackCue> cue = m_cues->item(i);
             if (cue->isRenderable())
-                toVTTCue(cue)->removeDisplayTree();
+                toVTTCue(cue.get())->removeDisplayTree();
         }
     }
 
@@ -486,7 +486,7 @@ bool TextTrack::hasCue(TextTrackCue* cue, TextTrackCue::CueMatchRules match)
         ASSERT(searchStart <= m_cues->length());
         ASSERT(searchEnd <= m_cues->length());
         
-        TextTrackCue* existingCue;
+        RefPtr<TextTrackCue> existingCue;
         
         // Cues in the TextTrackCueList are maintained in start time order.
         if (searchStart == searchEnd) {
index 321b041..1a2fb53 100644 (file)
@@ -69,7 +69,7 @@ void TextTrackCueGenericBoxElement::applyCSSProperties(const IntSize& videoSize)
     setInlineStyleProperty(CSSPropertyPosition, CSSValueAbsolute);
     setInlineStyleProperty(CSSPropertyUnicodeBidi, CSSValuePlaintext);
     
-    TextTrackCueGeneric* cue = static_cast<TextTrackCueGeneric*>(getCue());
+    RefPtr<TextTrackCueGeneric> cue = static_cast<TextTrackCueGeneric*>(getCue());
     Ref<HTMLSpanElement> cueElement = cue->element();
 
     CSSValueID alignment = cue->getCSSAlignment();
index b85543f..8a100b3 100644 (file)
@@ -498,7 +498,7 @@ void VTTCue::createWebVTTNodeTree()
 
 void VTTCue::copyWebVTTNodeToDOMTree(ContainerNode* webVTTNode, ContainerNode* parent)
 {
-    for (Node* node = webVTTNode->firstChild(); node; node = node->nextSibling()) {
+    for (RefPtr<Node> node = webVTTNode->firstChild(); node; node = node->nextSibling()) {
         RefPtr<Node> clonedNode;
         if (is<WebVTTElement>(*node))
             clonedNode = downcast<WebVTTElement>(*node).createEquivalentHTMLElement(ownerDocument());
@@ -506,7 +506,7 @@ void VTTCue::copyWebVTTNodeToDOMTree(ContainerNode* webVTTNode, ContainerNode* p
             clonedNode = node->cloneNode(false);
         parent->appendChild(*clonedNode);
         if (is<ContainerNode>(*node))
-            copyWebVTTNodeToDOMTree(downcast<ContainerNode>(node), downcast<ContainerNode>(clonedNode.get()));
+            copyWebVTTNodeToDOMTree(downcast<ContainerNode>(node.get()), downcast<ContainerNode>(clonedNode.get()));
     }
 }
 
@@ -618,7 +618,7 @@ void VTTCue::determineTextDirection()
     // pre-order, depth-first traversal, excluding WebVTT Ruby Text Objects and
     // their descendants.
     StringBuilder paragraphBuilder;
-    for (Node* node = m_webVTTNodeTree->firstChild(); node; node = NodeTraversal::next(*node, m_webVTTNodeTree.get())) {
+    for (RefPtr<Node> node = m_webVTTNodeTree->firstChild(); node; node = NodeTraversal::next(*node, m_webVTTNodeTree.get())) {
         // FIXME: The code does not match the comment above. This does not actually exclude Ruby Text Object descendant.
         if (!node->isTextNode() || node->localName() == rtTag)
             continue;
@@ -759,7 +759,7 @@ void VTTCue::markFutureAndPastNodes(ContainerNode* root, const MediaTime& previo
     if (currentTimestamp > movieTime)
         isPastNode = false;
     
-    for (Node* child = root->firstChild(); child; child = NodeTraversal::next(*child, root)) {
+    for (RefPtr<Node> child = root->firstChild(); child; child = NodeTraversal::next(*child, root)) {
         if (child->nodeName() == timestampTag) {
             MediaTime currentTimestamp;
             bool check = WebVTTParser::collectTimeStamp(child->nodeValue(), currentTimestamp);
@@ -850,9 +850,10 @@ void VTTCue::removeDisplayTree()
     // The region needs to be informed about the cue removal.
     if (m_notifyRegion && track()) {
         if (VTTRegionList* regions = track()->regions()) {
-            if (VTTRegion* region = regions->getRegionById(m_regionId))
+            if (RefPtr<VTTRegion> region = regions->getRegionById(m_regionId)) {
                 if (hasDisplayTree())
                     region->willRemoveTextTrackCueBox(m_displayTree.get());
+            }
         }
     }
 
@@ -1116,7 +1117,7 @@ std::pair<double, double> VTTCue::getCSSPosition() const
 
 bool VTTCue::cueContentsMatch(const TextTrackCue& cue) const
 {
-    const VTTCue* vttCue = toVTTCue(&cue);
+    RefPtr<const VTTCue> vttCue = toVTTCue(&cue);
     if (text() != vttCue->text())
         return false;
     if (cueSettings() != vttCue->cueSettings())
index a2e0841..27a9bcd 100644 (file)
@@ -2209,11 +2209,11 @@ void InspectorDOMAgent::pseudoElementDestroyed(PseudoElement& pseudoElement)
 
 void InspectorDOMAgent::didAddEventListener(EventTarget& target)
 {
-    Node* node = target.toNode();
+    auto node = target.toNode();
     if (!node)
         return;
 
-    int nodeId = boundNodeId(node);
+    int nodeId = boundNodeId(node.get());
     if (!nodeId)
         return;
 
@@ -2222,11 +2222,11 @@ void InspectorDOMAgent::didAddEventListener(EventTarget& target)
 
 void InspectorDOMAgent::willRemoveEventListener(EventTarget& target)
 {
-    Node* node = target.toNode();
+    auto node = target.toNode();
     if (!node)
         return;
 
-    int nodeId = boundNodeId(node);
+    int nodeId = boundNodeId(node.get());
     if (!nodeId)
         return;
 
index e8eb5c3..b60e700 100644 (file)
@@ -149,9 +149,9 @@ Ref<FormSubmission> FormSubmission::create(HTMLFormElement& form, const Attribut
 {
     HTMLFormControlElement* submitButton = nullptr;
     if (event && event->target()) {
-        for (Node* node = event->target()->toNode(); node; node = node->parentNode()) {
+        for (auto node = event->target()->toNode(); node; node = node->parentNode()) {
             if (is<HTMLFormControlElement>(*node)) {
-                submitButton = downcast<HTMLFormControlElement>(node);
+                submitButton = downcast<HTMLFormControlElement>(node.get());
                 break;
             }
         }
index 8754204..66be80b 100644 (file)
@@ -150,7 +150,7 @@ std::unique_ptr<ContextMenu> ContextMenuController::maybeCreateContextMenu(Event
         return nullptr;
 
     auto& mouseEvent = downcast<MouseEvent>(event);
-    auto* node = mouseEvent.target()->toNode();
+    auto node = mouseEvent.target()->toNode();
     if (!node)
         return nullptr;
     auto* frame = node->document().frame();
index 29bc23e..1fca9e1 100644 (file)
@@ -178,7 +178,7 @@ void RenderSnapshottedPlugIn::handleEvent(Event& event)
 
     if (mouseEvent.type() == eventNames().clickEvent || (m_isPotentialMouseActivation && mouseEvent.type() == eventNames().mouseupEvent)) {
         m_isPotentialMouseActivation = false;
-        bool clickWasOnOverlay = plugInImageElement().partOfSnapshotOverlay(mouseEvent.target()->toNode());
+        bool clickWasOnOverlay = plugInImageElement().partOfSnapshotOverlay(mouseEvent.target()->toNode().get());
         plugInImageElement().userDidClickSnapshot(mouseEvent, !clickWasOnOverlay);
         mouseEvent.setDefaultHandled();
     } else if (mouseEvent.type() == eventNames().mousedownEvent) {
index 33ef5d7..7b1a169 100644 (file)
@@ -50,7 +50,7 @@ HTMLTextFormControlElement& RenderTextControl::textFormControlElement() const
     return downcast<HTMLTextFormControlElement>(nodeForNonAnonymous());
 }
 
-TextControlInnerTextElement* RenderTextControl::innerTextElement() const
+RefPtr<TextControlInnerTextElement> RenderTextControl::innerTextElement() const
 {
     return textFormControlElement().innerTextElement();
 }
@@ -58,7 +58,7 @@ TextControlInnerTextElement* RenderTextControl::innerTextElement() const
 void RenderTextControl::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
 {
     RenderBlockFlow::styleDidChange(diff, oldStyle);
-    TextControlInnerTextElement* innerText = innerTextElement();
+    auto innerText = innerTextElement();
     if (!innerText)
         return;
     RenderTextControlInnerBlock* innerTextRenderer = innerText->renderer();
@@ -79,7 +79,7 @@ int RenderTextControl::textBlockLogicalHeight() const
 
 int RenderTextControl::textBlockLogicalWidth() const
 {
-    TextControlInnerTextElement* innerText = innerTextElement();
+    auto innerText = innerTextElement();
     ASSERT(innerText);
 
     LayoutUnit unitWidth = logicalWidth() - borderAndPaddingLogicalWidth();
@@ -97,7 +97,7 @@ int RenderTextControl::scrollbarThickness() const
 
 RenderBox::LogicalExtentComputedValues RenderTextControl::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop) const
 {
-    TextControlInnerTextElement* innerText = innerTextElement();
+    auto innerText = innerTextElement();
     ASSERT(innerText);
     if (RenderBox* innerTextBox = innerText->renderBox()) {
         LayoutUnit nonContentHeight = innerTextBox->verticalBorderAndPaddingExtent() + innerTextBox->verticalMarginExtent();
@@ -120,14 +120,14 @@ RenderBox::LogicalExtentComputedValues RenderTextControl::computeLogicalHeight(L
 
 void RenderTextControl::hitInnerTextElement(HitTestResult& result, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset)
 {
-    TextControlInnerTextElement* innerText = innerTextElement();
+    auto innerText = innerTextElement();
     if (!innerText->renderer())
         return;
 
     LayoutPoint adjustedLocation = accumulatedOffset + location();
     LayoutPoint localPoint = pointInContainer - toLayoutSize(adjustedLocation + innerText->renderBox()->location()) + toLayoutSize(scrollPosition());
-    result.setInnerNode(innerText);
-    result.setInnerNonSharedNode(innerText);
+    result.setInnerNode(innerText.get());
+    result.setInnerNonSharedNode(innerText.get());
     result.setLocalPoint(localPoint);
 }
 
@@ -218,13 +218,13 @@ void RenderTextControl::layoutExcludedChildren(bool relayoutChildren)
 #if PLATFORM(IOS)
 bool RenderTextControl::canScroll() const
 {
-    Element* innerText = innerTextElement();
+    auto innerText = innerTextElement();
     return innerText && innerText->renderer() && innerText->renderer()->hasOverflowClip();
 }
 
 int RenderTextControl::innerLineHeight() const
 {
-    Element* innerText = innerTextElement();
+    auto innerText = innerTextElement();
     if (innerText && innerText->renderer())
         return innerText->renderer()->style().computedLineHeight();
     return style().computedLineHeight();
index 1e661ea..841826f 100644 (file)
@@ -46,7 +46,7 @@ protected:
     RenderTextControl(HTMLTextFormControlElement&, RenderStyle&&);
 
     // This convenience function should not be made public because innerTextElement may outlive the render tree.
-    TextControlInnerTextElement* innerTextElement() const;
+    RefPtr<TextControlInnerTextElement> innerTextElement() const;
 
     int scrollbarThickness() const;
 
index ea6724b..6552a91 100644 (file)
@@ -196,7 +196,7 @@ bool RenderTextControlSingleLine::nodeAtPoint(const HitTestRequest& request, Hit
     //  - we hit the <input> element (e.g. we're over the border or padding), or
     //  - we hit regions not in any decoration buttons.
     HTMLElement* container = containerElement();
-    if (result.innerNode()->isDescendantOf(innerTextElement()) || result.innerNode() == &inputElement() || (container && container == result.innerNode())) {
+    if (result.innerNode()->isDescendantOf(innerTextElement().get()) || result.innerNode() == &inputElement() || (container && container == result.innerNode())) {
         LayoutPoint pointInParent = locationInContainer.point();
         if (container && innerBlockElement()) {
             if (innerBlockElement()->renderBox())
@@ -226,7 +226,7 @@ void RenderTextControlSingleLine::styleDidChange(StyleDifference diff, const Ren
         containerRenderer->mutableStyle().setWidth(Length());
     }
     if (diff == StyleDifferenceLayout) {
-        if (auto* innerTextRenderer = innerTextElement()->renderer())
+        if (auto innerTextRenderer = innerTextElement()->renderer())
             innerTextRenderer->setNeedsLayout(MarkContainingBlockChain);
         if (auto* placeholder = inputElement().placeholderElement()) {
             if (placeholder->renderer())
index 41e6a04..db7c8f7 100644 (file)
@@ -819,7 +819,7 @@ bool RenderTheme::isFocused(const RenderObject& renderer) const
     if (!is<Element>(node))
         return false;
 
-    Element* focusDelegate = downcast<Element>(*node).focusDelegate();
+    auto focusDelegate = downcast<Element>(*node).focusDelegate();
     Document& document = focusDelegate->document();
     Frame* frame = document.frame();
     return focusDelegate == document.focusedElement() && frame && frame->selection().isFocusedAndActive();
index d9c216f..77d68bc 100644 (file)
@@ -1871,7 +1871,7 @@ static FloatRoundedRect::Radii borderRadiiFromStyle(const RenderStyle& style)
 
 bool RenderThemeGtk::paintMediaSliderTrack(const RenderObject& o, const PaintInfo& paintInfo, const IntRect& r)
 {
-    HTMLMediaElement* mediaElement = parentMediaElement(o);
+    auto mediaElement = parentMediaElement(o);
     if (!mediaElement)
         return true;
 
@@ -1911,7 +1911,7 @@ bool RenderThemeGtk::paintMediaSliderThumb(const RenderObject& o, const PaintInf
 
 bool RenderThemeGtk::paintMediaVolumeSliderTrack(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect)
 {
-    HTMLMediaElement* mediaElement = parentMediaElement(renderObject);
+    auto mediaElement = parentMediaElement(renderObject);
     if (!mediaElement)
         return true;
 
index 31b4eb7..ee4fc6c 100644 (file)
@@ -1544,7 +1544,7 @@ bool RenderThemeMac::paintSliderThumb(const RenderObject& o, const PaintInfo& pa
 
     // Update the various states we respond to.
     updateEnabledState(sliderThumbCell, o);
-        Element* focusDelegate = is<Element>(o.node()) ? downcast<Element>(*o.node()).focusDelegate() : nullptr;
+    auto focusDelegate = is<Element>(o.node()) ? downcast<Element>(*o.node()).focusDelegate() : nullptr;
     if (focusDelegate)
         updateFocusedState(sliderThumbCell, *focusDelegate->renderer());
 
index d37c486..8a81320 100644 (file)
@@ -61,7 +61,7 @@ RenderVideo::~RenderVideo()
 
 void RenderVideo::willBeDestroyed()
 {
-    if (MediaPlayer* player = videoElement().player())
+    if (auto player = videoElement().player())
         player->setVisible(false);
 
     RenderMedia::willBeDestroyed();
@@ -117,7 +117,7 @@ LayoutSize RenderVideo::calculateIntrinsicSize()
     // The intrinsic height of a video element's playback area is the intrinsic height 
     // of the video resource, if that is available; otherwise it is the intrinsic 
     // height of the poster frame, if that is available; otherwise it is 150 CSS pixels.
-    MediaPlayer* player = videoElement().player();
+    auto player = videoElement().player();
     if (player && videoElement().readyState() >= HTMLVideoElement::HAVE_METADATA) {
         LayoutSize size(player->naturalSize());
         if (!size.isEmpty())
@@ -169,7 +169,7 @@ bool RenderVideo::shouldDisplayVideo() const
 
 void RenderVideo::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
 {
-    MediaPlayer* mediaPlayer = videoElement().player();
+    auto mediaPlayer = videoElement().player();
     bool displayingPoster = videoElement().shouldDisplayPosterImage();
 
     if (!displayingPoster && !mediaPlayer) {
@@ -235,7 +235,7 @@ void RenderVideo::updatePlayer()
     intrinsicSizeChanged = updateIntrinsicSize();
     ASSERT_UNUSED(intrinsicSizeChanged, !intrinsicSizeChanged || !view().frameView().isInRenderTreeLayout());
 
-    MediaPlayer* mediaPlayer = videoElement().player();
+    auto mediaPlayer = videoElement().player();
     if (!mediaPlayer)
         return;
 
@@ -264,20 +264,20 @@ LayoutUnit RenderVideo::minimumReplacedHeight() const
 
 bool RenderVideo::supportsAcceleratedRendering() const
 {
-    if (MediaPlayer* player = videoElement().player())
+    if (auto player = videoElement().player())
         return player->supportsAcceleratedRendering();
     return false;
 }
 
 void RenderVideo::acceleratedRenderingStateChanged()
 {
-    if (MediaPlayer* player = videoElement().player())
+    if (auto player = videoElement().player())
         player->acceleratedRenderingStateChanged();
 }
 
 bool RenderVideo::requiresImmediateCompositing() const
 {
-    MediaPlayer* player = videoElement().player();
+    auto player = videoElement().player();
     return player && player->requiresImmediateCompositing();
 }
 
@@ -327,7 +327,7 @@ bool RenderVideo::foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect,
     if (!videoBox().contains(enclosingIntRect(localRect)))
         return false;
 
-    if (MediaPlayer* player = videoElement().player())
+    if (auto player = videoElement().player())
         return player->hasAvailableVideoFrame();
 
     return false;
index 8622e43..5248a3e 100644 (file)
@@ -214,7 +214,7 @@ static inline bool isDisallowedElement(const Element& element)
 
 void SVGUseElement::clearShadowTree()
 {
-    if (auto* root = userAgentShadowRoot())
+    if (auto root = userAgentShadowRoot())
         root->removeChildren();
 }
 
@@ -259,7 +259,7 @@ void SVGUseElement::updateShadowTree()
 
 SVGElement* SVGUseElement::targetClone() const
 {
-    auto* root = userAgentShadowRoot();
+    auto root = userAgentShadowRoot();
     if (!root)
         return nullptr;
     return childrenOfType<SVGElement>(*root).first();
index a933fa2..29f2a28 100644 (file)
@@ -1,3 +1,24 @@
+2017-10-17  Jiewen Tan  <jiewen_tan@apple.com>
+
+        Replace some stack raw pointers with RefPtrs within WebCore/html
+        https://bugs.webkit.org/show_bug.cgi?id=178201
+        <rdar://problem/34841692>
+
+        Reviewed by Ryosuke Niwa.
+
+        Change the type of node as toNode() is changed to return RefPtr.
+
+        * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivate.cpp:
+        (WebKit::wrap):
+        * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
+        (WebKit::WebEditorClient::handleKeyboardEvent):
+        * WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp:
+        (WebKit::WebEditorClient::handleKeyboardEvent):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::handleEditingKeyboardEvent):
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::frameForEvent):
+
 2017-10-18  Chris Dumez  <cdumez@apple.com>
 
         [Service Worker] Add stubs for Client / WindowClient / Clients
index 3869f85..8634fe4 100644 (file)
@@ -142,8 +142,8 @@ WebKitDOMEventTarget* wrap(EventTarget* eventTarget)
 {
     ASSERT(eventTarget);
 
-    if (Node* node = eventTarget->toNode())
-        return WEBKIT_DOM_EVENT_TARGET(kit(node));
+    if (auto node = eventTarget->toNode())
+        return WEBKIT_DOM_EVENT_TARGET(kit(node.get()));
 
     if (DOMWindow* window = eventTarget->toDOMWindow())
         return WEBKIT_DOM_EVENT_TARGET(kit(window));
index 1505c88..a04b417 100644 (file)
@@ -63,7 +63,7 @@ void WebEditorClient::handleKeyboardEvent(KeyboardEvent* event)
     if (platformEvent->handledByInputMethod())
         return;
 
-    Node* node = event->target()->toNode();
+    auto node = event->target()->toNode();
     ASSERT(node);
     Frame* frame = node->document().frame();
     ASSERT(frame);
index bdca302..1e9138e 100644 (file)
@@ -208,7 +208,7 @@ static void handleKeyDown(Frame& frame, KeyboardEvent& event, const PlatformKeyb
 
 void WebEditorClient::handleKeyboardEvent(WebCore::KeyboardEvent* event)
 {
-    Node* node = event->target()->toNode();
+    auto node = event->target()->toNode();
     ASSERT(node);
     Frame* frame = node->document().frame();
     ASSERT(frame);
index ccf19a3..52446d0 100644 (file)
@@ -3557,7 +3557,7 @@ NotificationPermissionRequestManager* WebPage::notificationPermissionRequestMana
 #if !PLATFORM(GTK) && !PLATFORM(COCOA) && !PLATFORM(WPE)
 bool WebPage::handleEditingKeyboardEvent(KeyboardEvent* evt)
 {
-    Node* node = evt->target()->toNode();
+    auto node = evt->target()->toNode();
     ASSERT(node);
     Frame* frame = node->document().frame();
     ASSERT(frame);
index 9bb8a7c..1a794d1 100644 (file)
@@ -228,7 +228,7 @@ static String commandNameForSelectorName(const String& selectorName)
 
 static Frame* frameForEvent(KeyboardEvent* event)
 {
-    Node* node = event->target()->toNode();
+    auto node = event->target()->toNode();
     ASSERT(node);
     Frame* frame = node->document().frame();
     ASSERT(frame);
index 150a237..a00576e 100644 (file)
@@ -1,3 +1,15 @@
+2017-10-17  Jiewen Tan  <jiewen_tan@apple.com>
+
+        Replace some stack raw pointers with RefPtrs within WebCore/html
+        https://bugs.webkit.org/show_bug.cgi?id=178201
+        <rdar://problem/34841692>
+
+        Reviewed by Ryosuke Niwa.
+
+        * DOM/DOM.mm:
+        (kit):
+        Change the type of node as toNode() is changed to return RefPtr.
+
 2017-10-18  Chris Dumez  <cdumez@apple.com>
 
         [Service Worker] Add stubs for Client / WindowClient / Clients
index b2f0743..50afb19 100644 (file)
@@ -306,8 +306,8 @@ id <DOMEventTarget> kit(EventTarget* eventTarget)
     if (!eventTarget)
         return nil;
 
-    if (auto* node = eventTarget->toNode())
-        return kit(node);
+    if (auto node = eventTarget->toNode())
+        return kit(node.get());
 
     // We don't have an ObjC binding for XMLHttpRequest.
 
index 0387e1b..8baa381 100644 (file)
@@ -1,3 +1,15 @@
+2017-10-17  Jiewen Tan  <jiewen_tan@apple.com>
+
+        Replace some stack raw pointers with RefPtrs within WebCore/html
+        https://bugs.webkit.org/show_bug.cgi?id=178201
+        <rdar://problem/34841692>
+
+        Reviewed by Ryosuke Niwa.
+
+        * WebView.cpp:
+        (WebView::handleEditingKeyboardEvent):
+        Change the type of node as toNode() is changed to return RefPtr.
+
 2017-10-16  Sam Weinig  <sam@webkit.org>
 
         [Settings] Remove all custom code from Settings.h/cpp
index 23b80d6..d6b6c9c 100644 (file)
@@ -2341,7 +2341,7 @@ const char* WebView::interpretKeyEvent(const KeyboardEvent* evt)
 
 bool WebView::handleEditingKeyboardEvent(KeyboardEvent* evt)
 {
-    Node* node = evt->target()->toNode();
+    auto node = evt->target()->toNode();
     ASSERT(node);
     Frame* frame = node->document().frame();
     ASSERT(frame);