Skip to content
Permalink
Browse files
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.

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.

Canonical link: https://commits.webkit.org/194689@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223644 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Jiewen Tan committed Oct 19, 2017
1 parent 24b7b98 commit 2ddc8b9d3943e45d43d5ef6573e3f68c105e12d6
Showing with 1,114 additions and 518 deletions.
  1. +543 −0 Source/WebCore/ChangeLog
  2. +2 −2 Source/WebCore/Modules/encryptedmedia/legacy/LegacyCDM.cpp
  3. +2 −2 Source/WebCore/Modules/encryptedmedia/legacy/LegacyCDM.h
  4. +1 −1 Source/WebCore/Modules/encryptedmedia/legacy/LegacyCDMPrivateMediaPlayer.cpp
  5. +1 −1 Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp
  6. +1 −1 Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeys.h
  7. +2 −2 Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp
  8. +3 −3 Source/WebCore/dom/Element.cpp
  9. +2 −2 Source/WebCore/dom/Element.h
  10. +1 −1 Source/WebCore/dom/EventContext.cpp
  11. +5 −5 Source/WebCore/dom/EventPath.cpp
  12. +2 −2 Source/WebCore/dom/EventTarget.cpp
  13. +1 −1 Source/WebCore/dom/EventTarget.h
  14. +2 −2 Source/WebCore/dom/MouseEvent.cpp
  15. +2 −2 Source/WebCore/dom/MouseEvent.h
  16. +1 −1 Source/WebCore/dom/MouseRelatedEvent.cpp
  17. +1 −1 Source/WebCore/dom/Node.cpp
  18. +1 −1 Source/WebCore/dom/Node.h
  19. +1 −0 Source/WebCore/dom/ScopedEventQueue.cpp
  20. +1 −1 Source/WebCore/editing/Editor.cpp
  21. +1 −1 Source/WebCore/editing/EditorCommand.cpp
  22. +1 −1 Source/WebCore/editing/TextIterator.cpp
  23. +2 −2 Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.cpp
  24. +2 −2 Source/WebCore/html/ColorInputType.cpp
  25. +2 −2 Source/WebCore/html/FileInputType.cpp
  26. +7 −8 Source/WebCore/html/FormAssociatedElement.cpp
  27. +5 −5 Source/WebCore/html/FormController.cpp
  28. +2 −2 Source/WebCore/html/HTMLAnchorElement.cpp
  29. +1 −1 Source/WebCore/html/HTMLAppletElement.cpp
  30. +5 −5 Source/WebCore/html/HTMLAreaElement.cpp
  31. +12 −12 Source/WebCore/html/HTMLBodyElement.cpp
  32. +3 −3 Source/WebCore/html/HTMLCanvasElement.cpp
  33. +2 −2 Source/WebCore/html/HTMLDocument.cpp
  34. +9 −9 Source/WebCore/html/HTMLElement.cpp
  35. +3 −3 Source/WebCore/html/HTMLEmbedElement.cpp
  36. +3 −3 Source/WebCore/html/HTMLFieldSetElement.cpp
  37. +7 −7 Source/WebCore/html/HTMLFormControlElement.cpp
  38. +14 −14 Source/WebCore/html/HTMLFormElement.cpp
  39. +1 −1 Source/WebCore/html/HTMLFormElement.h
  40. +1 −1 Source/WebCore/html/HTMLFrameElement.cpp
  41. +4 −4 Source/WebCore/html/HTMLFrameElementBase.cpp
  42. +5 −5 Source/WebCore/html/HTMLFrameOwnerElement.cpp
  43. +4 −4 Source/WebCore/html/HTMLFrameSetElement.cpp
  44. +1 −1 Source/WebCore/html/HTMLFrameSetElement.h
  45. +7 −7 Source/WebCore/html/HTMLImageElement.cpp
  46. +8 −7 Source/WebCore/html/HTMLInputElement.cpp
  47. +1 −1 Source/WebCore/html/HTMLInputElement.h
  48. +1 −1 Source/WebCore/html/HTMLKeygenElement.cpp
  49. +1 −1 Source/WebCore/html/HTMLLabelElement.cpp
  50. +1 −1 Source/WebCore/html/HTMLLinkElement.cpp
  51. +3 −3 Source/WebCore/html/HTMLMapElement.cpp
  52. +22 −22 Source/WebCore/html/HTMLMediaElement.cpp
  53. +1 −1 Source/WebCore/html/HTMLMediaElement.h
  54. +1 −1 Source/WebCore/html/HTMLObjectElement.cpp
  55. +3 −3 Source/WebCore/html/HTMLOptGroupElement.cpp
  56. +17 −17 Source/WebCore/html/HTMLOptionElement.cpp
  57. +5 −5 Source/WebCore/html/HTMLPlugInElement.cpp
  58. +2 −2 Source/WebCore/html/HTMLPlugInImageElement.cpp
  59. +12 −12 Source/WebCore/html/HTMLSelectElement.cpp
  60. +4 −4 Source/WebCore/html/HTMLSlotElement.cpp
  61. +1 −1 Source/WebCore/html/HTMLSourceElement.cpp
  62. +5 −5 Source/WebCore/html/HTMLSummaryElement.cpp
  63. +1 −1 Source/WebCore/html/HTMLTableCellElement.cpp
  64. +1 −1 Source/WebCore/html/HTMLTableColElement.cpp
  65. +12 −12 Source/WebCore/html/HTMLTableElement.cpp
  66. +2 −2 Source/WebCore/html/HTMLTablePartElement.cpp
  67. +2 −2 Source/WebCore/html/HTMLTableRowsCollection.cpp
  68. +3 −3 Source/WebCore/html/HTMLTextAreaElement.cpp
  69. +1 −1 Source/WebCore/html/HTMLTextAreaElement.h
  70. +37 −37 Source/WebCore/html/HTMLTextFormControlElement.cpp
  71. +1 −1 Source/WebCore/html/HTMLTextFormControlElement.h
  72. +10 −10 Source/WebCore/html/HTMLTrackElement.cpp
  73. +1 −1 Source/WebCore/html/HTMLTrackElement.h
  74. +2 −2 Source/WebCore/html/HTMLVideoElement.cpp
  75. +3 −3 Source/WebCore/html/ImageDocument.cpp
  76. +7 −1 Source/WebCore/html/InputType.cpp
  77. +1 −1 Source/WebCore/html/InputType.h
  78. +4 −4 Source/WebCore/html/MediaDocument.cpp
  79. +3 −3 Source/WebCore/html/MediaElementSession.cpp
  80. +1 −1 Source/WebCore/html/NumberInputType.cpp
  81. +1 −1 Source/WebCore/html/PluginDocument.cpp
  82. +5 −5 Source/WebCore/html/RadioInputType.cpp
  83. +1 −1 Source/WebCore/html/RadioNodeList.cpp
  84. +7 −7 Source/WebCore/html/RangeInputType.cpp
  85. +3 −3 Source/WebCore/html/SearchInputType.cpp
  86. +9 −9 Source/WebCore/html/TextFieldInputType.cpp
  87. +1 −1 Source/WebCore/html/TextFieldInputType.h
  88. +3 −3 Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
  89. +3 −3 Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
  90. +12 −12 Source/WebCore/html/canvas/WebGLFramebuffer.cpp
  91. +1 −1 Source/WebCore/html/canvas/WebGLRenderingContext.cpp
  92. +36 −36 Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
  93. +2 −2 Source/WebCore/html/canvas/WebGPURenderPassColorAttachmentDescriptor.cpp
  94. +2 −2 Source/WebCore/html/canvas/WebGPURenderPassDepthAttachmentDescriptor.cpp
  95. +3 −3 Source/WebCore/html/parser/HTMLConstructionSite.cpp
  96. +2 −2 Source/WebCore/html/parser/HTMLFormattingElementList.cpp
  97. +1 −1 Source/WebCore/html/parser/HTMLParserOptions.cpp
  98. +1 −1 Source/WebCore/html/parser/HTMLParserScheduler.cpp
  99. +3 −3 Source/WebCore/html/parser/HTMLTreeBuilder.cpp
  100. +3 −3 Source/WebCore/html/parser/XSSAuditor.cpp
  101. +3 −3 Source/WebCore/html/shadow/MediaControlElementTypes.cpp
  102. +2 −2 Source/WebCore/html/shadow/MediaControlElementTypes.h
  103. +22 −22 Source/WebCore/html/shadow/MediaControlElements.cpp
  104. +1 −1 Source/WebCore/html/shadow/MediaControls.cpp
  105. +21 −21 Source/WebCore/html/shadow/SliderThumbElement.cpp
  106. +2 −2 Source/WebCore/html/shadow/SliderThumbElement.h
  107. +2 −2 Source/WebCore/html/shadow/SpinButtonElement.cpp
  108. +2 −2 Source/WebCore/html/shadow/TextControlInnerElements.cpp
  109. +1 −1 Source/WebCore/html/shadow/mac/ImageControlsButtonElementMac.cpp
  110. +1 −1 Source/WebCore/html/track/LoadableTextTrack.cpp
  111. +3 −3 Source/WebCore/html/track/TextTrack.cpp
  112. +1 −1 Source/WebCore/html/track/TextTrackCueGeneric.cpp
  113. +7 −6 Source/WebCore/html/track/VTTCue.cpp
  114. +4 −4 Source/WebCore/inspector/InspectorDOMAgent.cpp
  115. +2 −2 Source/WebCore/loader/FormSubmission.cpp
  116. +1 −1 Source/WebCore/page/ContextMenuController.cpp
  117. +1 −1 Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp
  118. +9 −9 Source/WebCore/rendering/RenderTextControl.cpp
  119. +1 −1 Source/WebCore/rendering/RenderTextControl.h
  120. +2 −2 Source/WebCore/rendering/RenderTextControlSingleLine.cpp
  121. +1 −1 Source/WebCore/rendering/RenderTheme.cpp
  122. +2 −2 Source/WebCore/rendering/RenderThemeGtk.cpp
  123. +1 −1 Source/WebCore/rendering/RenderThemeMac.mm
  124. +8 −8 Source/WebCore/rendering/RenderVideo.cpp
  125. +2 −2 Source/WebCore/svg/SVGUseElement.cpp
  126. +21 −0 Source/WebKit/ChangeLog
  127. +2 −2 Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivate.cpp
  128. +1 −1 Source/WebKit/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp
  129. +1 −1 Source/WebKit/WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp
  130. +1 −1 Source/WebKit/WebProcess/WebPage/WebPage.cpp
  131. +1 −1 Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm
  132. +12 −0 Source/WebKitLegacy/mac/ChangeLog
  133. +2 −2 Source/WebKitLegacy/mac/DOM/DOM.mm
  134. +12 −0 Source/WebKitLegacy/win/ChangeLog
  135. +1 −1 Source/WebKitLegacy/win/WebView.cpp

Large diffs are not rendered by default.

@@ -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);
}

@@ -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 @@ class LegacyCDM {
LegacyCDMClient* client() const { return m_client; }
void setClient(LegacyCDMClient* client) { m_client = client; }

MediaPlayer* mediaPlayer() const;
RefPtr<MediaPlayer> mediaPlayer() const;

private:
String m_keySystem;
@@ -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;

@@ -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;
@@ -55,7 +55,7 @@ class WebKitMediaKeys final : public RefCounted<WebKitMediaKeys>, private Legacy
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>&&);

@@ -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;
@@ -224,7 +224,7 @@ bool Element::supportsFocus() const
return tabIndexSetExplicitly();
}

Element* Element::focusDelegate()
RefPtr<Element> Element::focusDelegate()
{
return this;
}
@@ -1862,15 +1862,15 @@ 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();
}

ShadowRoot& Element::ensureUserAgentShadowRoot()
{
if (auto* shadow = userAgentShadowRoot())
if (auto shadow = userAgentShadowRoot())
return *shadow;
auto newShadow = ShadowRoot::create(document(), ShadowRootMode::UserAgent);
ShadowRoot& shadow = newShadow;
@@ -275,7 +275,7 @@ class Element : public ContainerNode {
};
ExceptionOr<ShadowRoot&> attachShadow(const ShadowRootInit&);

ShadowRoot* userAgentShadowRoot() const;
RefPtr<ShadowRoot> userAgentShadowRoot() const;
WEBCORE_EXPORT ShadowRoot& ensureUserAgentShadowRoot();

void setIsDefinedCustomElement(JSCustomElementInterface&);
@@ -308,7 +308,7 @@ class Element : public ContainerNode {

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);
@@ -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
@@ -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
@@ -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;
}
@@ -68,7 +68,7 @@ class EventTarget : public ScriptWrappable {
virtual EventTargetInterface eventTargetInterface() const = 0;
virtual ScriptExecutionContext* scriptExecutionContext() const = 0;

virtual Node* toNode();
virtual RefPtr<Node> toNode();
virtual DOMWindow* toDOMWindow();
virtual bool isMessagePort() const;

@@ -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) {
@@ -61,8 +61,8 @@ class MouseEvent : public MouseRelatedEvent {
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; }

@@ -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;

@@ -356,7 +356,7 @@ void Node::clearRareData()
clearFlag(HasRareDataFlag);
}

Node* Node::toNode()
RefPtr<Node> Node::toNode()
{
return this;
}
@@ -494,7 +494,7 @@ class Node : public EventTarget {

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
@@ -34,6 +34,7 @@
#include "Event.h"
#include "EventDispatcher.h"
#include "EventTarget.h"
#include "Node.h"
#include <wtf/NeverDestroyed.h>

namespace WebCore {
@@ -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());
@@ -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();
@@ -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;
@@ -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()) {
@@ -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;

@@ -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;

@@ -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);

0 comments on commit 2ddc8b9

Please sign in to comment.