Replace some auto* with RefPtr within WebCore/html
authorjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Nov 2017 09:32:05 +0000 (09:32 +0000)
committerjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Nov 2017 09:32:05 +0000 (09:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=179218
<rdar://problem/35102567>

Reviewed by Ryosuke Niwa.

No changes in behaviors.

In this patch, it replace some auto* pointers with RefPtrs. The way it achieves this goal is to wrap
the RHS with makeRefPtr(). Also, some methods have been modified to return RefPtrs directly. Those
include:
    HTMLInputElement::list,
    HTMLInputElement::dataList,
    HTMLLabelElement::control,
    HTMLLegendElement::associatedControl,
    HTMLSummaryElement::detailsElement,
    HTMLTableElement::tHead,
    HTMLTableElement::tFoot,
    HTMLTablePartElement::findParentTable,
    HTMLTableRowElement.cpp::findTable, local function
    RadioNodeList.cpp::toRadioButtonInputElement, local function
    CanvasStyle::canvasGradient,
    CanvasStyle::canvasPattern,
    WebGLRenderingContextBase::validateTextureBinding,
    GraphicsContext::strokeGradient,
    GraphicsContext::fillGradient.

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::labelChanged):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::correspondingControlForLabelElement const):
* accessibility/AccessibilityTable.cpp:
(WebCore::AccessibilityTable::addChildren):
(WebCore::AccessibilityTable::title const):
* accessibility/atk/WebKitAccessibleInterfaceTable.cpp:
(webkitAccessibleTableGetCaption):
* html/ColorInputType.cpp:
(WebCore::ColorInputType::suggestions const):
* html/FTPDirectoryDocument.cpp:
(WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate):
* html/FileInputType.cpp:
(WebCore::FileInputType::appendFormData const):
(WebCore::FileInputType::disabledAttributeChanged):
(WebCore::FileInputType::multipleAttributeChanged):
* html/FormAssociatedElement.cpp:
(WebCore::FormAssociatedElement::formOwnerRemovedFromTree):
* html/HTMLBodyElement.cpp:
(WebCore::HTMLBodyElement::insertedIntoAncestor):
(WebCore::HTMLBodyElement::didFinishInsertingNode):
(WebCore::HTMLBodyElement::scrollTo):
* html/HTMLDetailsElement.cpp:
(WebCore::HTMLDetailsElement::isActiveSummary const):
(WebCore::HTMLDetailsElement::parseAttribute):
* html/HTMLDocument.cpp:
(WebCore::HTMLDocument::namedItem):
* html/HTMLElement.cpp:
(WebCore::HTMLElement::editabilityFromContentEditableAttr):
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::didAttachRenderers):
* html/HTMLFrameOwnerElement.cpp:
(WebCore:: const):
* html/HTMLFrameSetElement.cpp:
(WebCore::HTMLFrameSetElement::namedItem):
* html/HTMLHtmlElement.cpp:
(WebCore::HTMLHtmlElement::insertedByParser):
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::defaultEventHandler):
(WebCore::HTMLInputElement::list const):
(WebCore::HTMLInputElement::dataList const):
(WebCore::HTMLInputElement::setupDateTimeChooserParameters):
* html/HTMLInputElement.h:
* html/HTMLLabelElement.cpp:
(WebCore::firstElementWithIdIfLabelable):
(WebCore::HTMLLabelElement::control const):
(WebCore::HTMLLabelElement::form const):
(WebCore::HTMLLabelElement::setActive):
(WebCore::HTMLLabelElement::setHovered):
(WebCore::HTMLLabelElement::willRespondToMouseClickEvents):
(WebCore::HTMLLabelElement::focus):
(WebCore::HTMLLabelElement::accessKeyAction):
* html/HTMLLabelElement.h:
* html/HTMLLegendElement.cpp:
(WebCore::HTMLLegendElement::associatedControl):
(WebCore::HTMLLegendElement::focus):
(WebCore::HTMLLegendElement::accessKeyAction):
(WebCore::HTMLLegendElement::form const):
* html/HTMLLegendElement.h:
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::setCSSStyleSheet):
(WebCore::HTMLLinkElement::addSubresourceAttributeURLs const):
* html/HTMLMediaElement.cpp:
(WebCore::needsAutoplayPlayPauseEventsQuirk):
(WebCore::HTMLMediaElement::loadResource):
(WebCore::HTMLMediaElement::updateActiveTextTrackCues):
(WebCore::HTMLMediaElement::removeTextTrack):
(WebCore::HTMLMediaElement::layoutSizeChanged):
* html/HTMLObjectElement.cpp:
(WebCore::shouldBeExposed):
(WebCore::HTMLObjectElement::appendFormData):
* html/HTMLOptGroupElement.cpp:
(WebCore::HTMLOptGroupElement::recalcSelectOptions):
* html/HTMLPictureElement.cpp:
(WebCore::HTMLPictureElement::viewportChangeAffectedPicture const):
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::bindingsInstance):
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::isImageType):
(WebCore::HTMLPlugInImageElement::willDetachRenderers):
(WebCore::HTMLPlugInImageElement::partOfSnapshotOverlay const):
(WebCore::HTMLPlugInImageElement::checkSizeChangeForSnapshotting):
* html/HTMLSlotElement.cpp:
(WebCore::HTMLSlotElement::attributeChanged):
(WebCore:: const):
* html/HTMLSourceElement.cpp:
(WebCore::HTMLSourceElement::parseAttribute):
* html/HTMLStyleElement.cpp:
(WebCore::HTMLStyleElement::addSubresourceAttributeURLs const):
* html/HTMLSummaryElement.cpp:
(WebCore::HTMLSummaryElement::detailsElement const):
* html/HTMLSummaryElement.h:
* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::caption const):
(WebCore::HTMLTableElement::tHead const):
(WebCore::HTMLTableElement::tFoot const):
(WebCore::HTMLTableElement::createTHead):
(WebCore::HTMLTableElement::deleteTHead):
(WebCore::HTMLTableElement::createTFoot):
(WebCore::HTMLTableElement::deleteTFoot):
(WebCore::HTMLTableElement::createCaption):
(WebCore::HTMLTableElement::deleteCaption):
* html/HTMLTableElement.h:
* html/HTMLTablePartElement.cpp:
(WebCore::HTMLTablePartElement::findParentTable const):
* html/HTMLTablePartElement.h:
* html/HTMLTableRowElement.cpp:
(WebCore::findTable):
(WebCore::HTMLTableRowElement::rowIndex const):
(WebCore::findRows):
* html/HTMLTableSectionElement.cpp:
(WebCore::HTMLTableSectionElement::additionalPresentationAttributeStyle const):
* html/HTMLTrackElement.cpp:
(WebCore::HTMLTrackElement::mediaElement const):
* html/LinkIconCollector.cpp:
(WebCore::LinkIconCollector::iconsOfTypes):
* html/MediaDocument.cpp:
(WebCore::MediaDocumentParser::createDocumentStructure):
(WebCore::MediaDocument::replaceMediaElementTimerFired):
* html/MediaElementSession.cpp:
(WebCore::needsArbitraryUserGestureAutoplayQuirk):
(WebCore::isElementRectMostlyInMainFrame):
(WebCore::isElementLargeRelativeToMainFrame):
* html/PluginDocument.cpp:
(WebCore::PluginDocumentParser::createDocumentStructure):
(WebCore::PluginDocumentParser::appendBytes):
* html/RadioNodeList.cpp:
(WebCore::toRadioButtonInputElement):
(WebCore::RadioNodeList::value const):
(WebCore::RadioNodeList::setValue):
* html/RangeInputType.cpp:
(WebCore::RangeInputType::updateTickMarkValues):
* html/canvas/CanvasRenderingContext.cpp:
(WebCore::CanvasRenderingContext::wouldTaintOrigin):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::setStrokeStyle):
(WebCore::CanvasRenderingContext2D::setFillStyle):
(WebCore::CanvasRenderingContext2D::fillInternal):
(WebCore::CanvasRenderingContext2D::strokeInternal):
(WebCore::CanvasRenderingContext2D::fillRect):
(WebCore::CanvasRenderingContext2D::strokeRect):
(WebCore::toStyle):
(WebCore::CanvasRenderingContext2D::drawTextInternal):
* html/canvas/CanvasStyle.h:
(WebCore::CanvasStyle::canvasGradient const):
(WebCore::CanvasStyle::canvasPattern const):
* html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::texStorage2D):
(WebCore::WebGL2RenderingContext::getFramebufferAttachmentParameter):
(WebCore::WebGL2RenderingContext::validateIndexArrayConservative):
* html/canvas/WebGLBuffer.h:
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter):
(WebCore::WebGLRenderingContext::validateIndexArrayConservative):
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::compressedTexImage2D):
(WebCore::WebGLRenderingContextBase::compressedTexSubImage2D):
(WebCore::WebGLRenderingContextBase::copyTexSubImage2D):
(WebCore::WebGLRenderingContextBase::generateMipmap):
(WebCore::WebGLRenderingContextBase::getTexParameter):
(WebCore::WebGLRenderingContextBase::texImage2DBase):
(WebCore::WebGLRenderingContextBase::validateTexFunc):
(WebCore::WebGLRenderingContextBase::texSubImage2D):
(WebCore::WebGLRenderingContextBase::texSubImage2DBase):
(WebCore::WebGLRenderingContextBase::copyTexImage2D):
(WebCore::WebGLRenderingContextBase::texImage2D):
(WebCore::WebGLRenderingContextBase::texParameter):
(WebCore::WebGLRenderingContextBase::validateTextureBinding):
* html/canvas/WebGLRenderingContextBase.h:
* html/parser/HTMLConstructionSite.cpp:
(WebCore::executeReparentTask):
(WebCore::executeTakeAllChildrenAndReparentTask):
(WebCore::HTMLConstructionSite::dispatchDocumentElementAvailableIfNeeded):
(WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
(WebCore::HTMLConstructionSite::findFosterSite):
* html/parser/HTMLPreloadScanner.cpp:
(WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
* html/parser/XSSAuditorDelegate.cpp:
(WebCore::XSSAuditorDelegate::generateViolationReport):
* html/shadow/TextControlInnerElements.cpp:
(WebCore::SearchFieldResultsButtonElement::defaultEventHandler):
* html/track/InbandGenericTextTrack.cpp:
(WebCore::InbandGenericTextTrack::updateGenericCue):
(WebCore::InbandGenericTextTrack::removeGenericCue):
* html/track/InbandTextTrack.cpp:
(WebCore::InbandTextTrack::willRemove):
* html/track/TextTrack.cpp:
(WebCore::TextTrack::addCue):
(WebCore::TextTrack::addRegion):
* html/track/VideoTrack.cpp:
(WebCore::VideoTrack::willRemove):
* inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::buildInitialState):
* platform/graphics/GraphicsContext.h:
(WebCore::GraphicsContext::strokeGradient const):
(WebCore::GraphicsContext::fillGradient const):
* rendering/svg/RenderSVGPath.cpp:
(WebCore::useStrokeStyleToFill):

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

68 files changed:
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AXObjectCache.cpp
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/accessibility/AccessibilityTable.cpp
Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp
Source/WebCore/html/ColorInputType.cpp
Source/WebCore/html/FTPDirectoryDocument.cpp
Source/WebCore/html/FileInputType.cpp
Source/WebCore/html/FormAssociatedElement.cpp
Source/WebCore/html/HTMLBodyElement.cpp
Source/WebCore/html/HTMLDetailsElement.cpp
Source/WebCore/html/HTMLDocument.cpp
Source/WebCore/html/HTMLElement.cpp
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/HTMLFrameOwnerElement.cpp
Source/WebCore/html/HTMLFrameSetElement.cpp
Source/WebCore/html/HTMLHtmlElement.cpp
Source/WebCore/html/HTMLImageElement.cpp
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLInputElement.h
Source/WebCore/html/HTMLLabelElement.cpp
Source/WebCore/html/HTMLLabelElement.h
Source/WebCore/html/HTMLLegendElement.cpp
Source/WebCore/html/HTMLLegendElement.h
Source/WebCore/html/HTMLLinkElement.cpp
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLObjectElement.cpp
Source/WebCore/html/HTMLOptGroupElement.cpp
Source/WebCore/html/HTMLPictureElement.cpp
Source/WebCore/html/HTMLPlugInElement.cpp
Source/WebCore/html/HTMLPlugInImageElement.cpp
Source/WebCore/html/HTMLSlotElement.cpp
Source/WebCore/html/HTMLSourceElement.cpp
Source/WebCore/html/HTMLStyleElement.cpp
Source/WebCore/html/HTMLSummaryElement.cpp
Source/WebCore/html/HTMLSummaryElement.h
Source/WebCore/html/HTMLTableElement.cpp
Source/WebCore/html/HTMLTableElement.h
Source/WebCore/html/HTMLTablePartElement.cpp
Source/WebCore/html/HTMLTablePartElement.h
Source/WebCore/html/HTMLTableRowElement.cpp
Source/WebCore/html/HTMLTableSectionElement.cpp
Source/WebCore/html/HTMLTrackElement.cpp
Source/WebCore/html/LinkIconCollector.cpp
Source/WebCore/html/MediaDocument.cpp
Source/WebCore/html/MediaElementSession.cpp
Source/WebCore/html/PluginDocument.cpp
Source/WebCore/html/RadioNodeList.cpp
Source/WebCore/html/RangeInputType.cpp
Source/WebCore/html/canvas/CanvasRenderingContext.cpp
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
Source/WebCore/html/canvas/CanvasStyle.h
Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
Source/WebCore/html/canvas/WebGLBuffer.h
Source/WebCore/html/canvas/WebGLRenderingContext.cpp
Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
Source/WebCore/html/canvas/WebGLRenderingContextBase.h
Source/WebCore/html/parser/HTMLConstructionSite.cpp
Source/WebCore/html/parser/HTMLPreloadScanner.cpp
Source/WebCore/html/parser/XSSAuditorDelegate.cpp
Source/WebCore/html/shadow/TextControlInnerElements.cpp
Source/WebCore/html/track/InbandGenericTextTrack.cpp
Source/WebCore/html/track/InbandTextTrack.cpp
Source/WebCore/html/track/TextTrack.cpp
Source/WebCore/html/track/VideoTrack.cpp
Source/WebCore/inspector/InspectorCanvas.cpp
Source/WebCore/platform/graphics/GraphicsContext.h
Source/WebCore/rendering/svg/RenderSVGPath.cpp

index 32ae44b..1f650e4 100644 (file)
@@ -1,3 +1,234 @@
+2017-11-03  Jiewen Tan  <jiewen_tan@apple.com>
+
+        Replace some auto* with RefPtr within WebCore/html
+        https://bugs.webkit.org/show_bug.cgi?id=179218
+        <rdar://problem/35102567>
+
+        Reviewed by Ryosuke Niwa.
+
+        No changes in behaviors.
+
+        In this patch, it replace some auto* pointers with RefPtrs. The way it achieves this goal is to wrap
+        the RHS with makeRefPtr(). Also, some methods have been modified to return RefPtrs directly. Those
+        include:
+            HTMLInputElement::list,
+            HTMLInputElement::dataList,
+            HTMLLabelElement::control,
+            HTMLLegendElement::associatedControl,
+            HTMLSummaryElement::detailsElement,
+            HTMLTableElement::tHead,
+            HTMLTableElement::tFoot,
+            HTMLTablePartElement::findParentTable,
+            HTMLTableRowElement.cpp::findTable, local function
+            RadioNodeList.cpp::toRadioButtonInputElement, local function
+            CanvasStyle::canvasGradient,
+            CanvasStyle::canvasPattern,
+            WebGLRenderingContextBase::validateTextureBinding,
+            GraphicsContext::strokeGradient,
+            GraphicsContext::fillGradient.
+
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::AXObjectCache::labelChanged):
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::correspondingControlForLabelElement const):
+        * accessibility/AccessibilityTable.cpp:
+        (WebCore::AccessibilityTable::addChildren):
+        (WebCore::AccessibilityTable::title const):
+        * accessibility/atk/WebKitAccessibleInterfaceTable.cpp:
+        (webkitAccessibleTableGetCaption):
+        * html/ColorInputType.cpp:
+        (WebCore::ColorInputType::suggestions const):
+        * html/FTPDirectoryDocument.cpp:
+        (WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate):
+        * html/FileInputType.cpp:
+        (WebCore::FileInputType::appendFormData const):
+        (WebCore::FileInputType::disabledAttributeChanged):
+        (WebCore::FileInputType::multipleAttributeChanged):
+        * html/FormAssociatedElement.cpp:
+        (WebCore::FormAssociatedElement::formOwnerRemovedFromTree):
+        * html/HTMLBodyElement.cpp:
+        (WebCore::HTMLBodyElement::insertedIntoAncestor):
+        (WebCore::HTMLBodyElement::didFinishInsertingNode):
+        (WebCore::HTMLBodyElement::scrollTo):
+        * html/HTMLDetailsElement.cpp:
+        (WebCore::HTMLDetailsElement::isActiveSummary const):
+        (WebCore::HTMLDetailsElement::parseAttribute):
+        * html/HTMLDocument.cpp:
+        (WebCore::HTMLDocument::namedItem):
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::editabilityFromContentEditableAttr):
+        * html/HTMLFormControlElement.cpp:
+        (WebCore::HTMLFormControlElement::didAttachRenderers):
+        * html/HTMLFrameOwnerElement.cpp:
+        (WebCore:: const):
+        * html/HTMLFrameSetElement.cpp:
+        (WebCore::HTMLFrameSetElement::namedItem):
+        * html/HTMLHtmlElement.cpp:
+        (WebCore::HTMLHtmlElement::insertedByParser):
+        * html/HTMLImageElement.cpp:
+        (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::defaultEventHandler):
+        (WebCore::HTMLInputElement::list const):
+        (WebCore::HTMLInputElement::dataList const):
+        (WebCore::HTMLInputElement::setupDateTimeChooserParameters):
+        * html/HTMLInputElement.h:
+        * html/HTMLLabelElement.cpp:
+        (WebCore::firstElementWithIdIfLabelable):
+        (WebCore::HTMLLabelElement::control const):
+        (WebCore::HTMLLabelElement::form const):
+        (WebCore::HTMLLabelElement::setActive):
+        (WebCore::HTMLLabelElement::setHovered):
+        (WebCore::HTMLLabelElement::willRespondToMouseClickEvents):
+        (WebCore::HTMLLabelElement::focus):
+        (WebCore::HTMLLabelElement::accessKeyAction):
+        * html/HTMLLabelElement.h:
+        * html/HTMLLegendElement.cpp:
+        (WebCore::HTMLLegendElement::associatedControl):
+        (WebCore::HTMLLegendElement::focus):
+        (WebCore::HTMLLegendElement::accessKeyAction):
+        (WebCore::HTMLLegendElement::form const):
+        * html/HTMLLegendElement.h:
+        * html/HTMLLinkElement.cpp:
+        (WebCore::HTMLLinkElement::setCSSStyleSheet):
+        (WebCore::HTMLLinkElement::addSubresourceAttributeURLs const):
+        * html/HTMLMediaElement.cpp:
+        (WebCore::needsAutoplayPlayPauseEventsQuirk):
+        (WebCore::HTMLMediaElement::loadResource):
+        (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
+        (WebCore::HTMLMediaElement::removeTextTrack):
+        (WebCore::HTMLMediaElement::layoutSizeChanged):
+        * html/HTMLObjectElement.cpp:
+        (WebCore::shouldBeExposed):
+        (WebCore::HTMLObjectElement::appendFormData):
+        * html/HTMLOptGroupElement.cpp:
+        (WebCore::HTMLOptGroupElement::recalcSelectOptions):
+        * html/HTMLPictureElement.cpp:
+        (WebCore::HTMLPictureElement::viewportChangeAffectedPicture const):
+        * html/HTMLPlugInElement.cpp:
+        (WebCore::HTMLPlugInElement::bindingsInstance):
+        * html/HTMLPlugInImageElement.cpp:
+        (WebCore::HTMLPlugInImageElement::isImageType):
+        (WebCore::HTMLPlugInImageElement::willDetachRenderers):
+        (WebCore::HTMLPlugInImageElement::partOfSnapshotOverlay const):
+        (WebCore::HTMLPlugInImageElement::checkSizeChangeForSnapshotting):
+        * html/HTMLSlotElement.cpp:
+        (WebCore::HTMLSlotElement::attributeChanged):
+        (WebCore:: const):
+        * html/HTMLSourceElement.cpp:
+        (WebCore::HTMLSourceElement::parseAttribute):
+        * html/HTMLStyleElement.cpp:
+        (WebCore::HTMLStyleElement::addSubresourceAttributeURLs const):
+        * html/HTMLSummaryElement.cpp:
+        (WebCore::HTMLSummaryElement::detailsElement const):
+        * html/HTMLSummaryElement.h:
+        * html/HTMLTableElement.cpp:
+        (WebCore::HTMLTableElement::caption const):
+        (WebCore::HTMLTableElement::tHead const):
+        (WebCore::HTMLTableElement::tFoot const):
+        (WebCore::HTMLTableElement::createTHead):
+        (WebCore::HTMLTableElement::deleteTHead):
+        (WebCore::HTMLTableElement::createTFoot):
+        (WebCore::HTMLTableElement::deleteTFoot):
+        (WebCore::HTMLTableElement::createCaption):
+        (WebCore::HTMLTableElement::deleteCaption):
+        * html/HTMLTableElement.h:
+        * html/HTMLTablePartElement.cpp:
+        (WebCore::HTMLTablePartElement::findParentTable const):
+        * html/HTMLTablePartElement.h:
+        * html/HTMLTableRowElement.cpp:
+        (WebCore::findTable):
+        (WebCore::HTMLTableRowElement::rowIndex const):
+        (WebCore::findRows):
+        * html/HTMLTableSectionElement.cpp:
+        (WebCore::HTMLTableSectionElement::additionalPresentationAttributeStyle const):
+        * html/HTMLTrackElement.cpp:
+        (WebCore::HTMLTrackElement::mediaElement const):
+        * html/LinkIconCollector.cpp:
+        (WebCore::LinkIconCollector::iconsOfTypes):
+        * html/MediaDocument.cpp:
+        (WebCore::MediaDocumentParser::createDocumentStructure):
+        (WebCore::MediaDocument::replaceMediaElementTimerFired):
+        * html/MediaElementSession.cpp:
+        (WebCore::needsArbitraryUserGestureAutoplayQuirk):
+        (WebCore::isElementRectMostlyInMainFrame):
+        (WebCore::isElementLargeRelativeToMainFrame):
+        * html/PluginDocument.cpp:
+        (WebCore::PluginDocumentParser::createDocumentStructure):
+        (WebCore::PluginDocumentParser::appendBytes):
+        * html/RadioNodeList.cpp:
+        (WebCore::toRadioButtonInputElement):
+        (WebCore::RadioNodeList::value const):
+        (WebCore::RadioNodeList::setValue):
+        * html/RangeInputType.cpp:
+        (WebCore::RangeInputType::updateTickMarkValues):
+        * html/canvas/CanvasRenderingContext.cpp:
+        (WebCore::CanvasRenderingContext::wouldTaintOrigin):
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::setStrokeStyle):
+        (WebCore::CanvasRenderingContext2D::setFillStyle):
+        (WebCore::CanvasRenderingContext2D::fillInternal):
+        (WebCore::CanvasRenderingContext2D::strokeInternal):
+        (WebCore::CanvasRenderingContext2D::fillRect):
+        (WebCore::CanvasRenderingContext2D::strokeRect):
+        (WebCore::toStyle):
+        (WebCore::CanvasRenderingContext2D::drawTextInternal):
+        * html/canvas/CanvasStyle.h:
+        (WebCore::CanvasStyle::canvasGradient const):
+        (WebCore::CanvasStyle::canvasPattern const):
+        * html/canvas/WebGL2RenderingContext.cpp:
+        (WebCore::WebGL2RenderingContext::texStorage2D):
+        (WebCore::WebGL2RenderingContext::getFramebufferAttachmentParameter):
+        (WebCore::WebGL2RenderingContext::validateIndexArrayConservative):
+        * html/canvas/WebGLBuffer.h:
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter):
+        (WebCore::WebGLRenderingContext::validateIndexArrayConservative):
+        * html/canvas/WebGLRenderingContextBase.cpp:
+        (WebCore::WebGLRenderingContextBase::compressedTexImage2D):
+        (WebCore::WebGLRenderingContextBase::compressedTexSubImage2D):
+        (WebCore::WebGLRenderingContextBase::copyTexSubImage2D):
+        (WebCore::WebGLRenderingContextBase::generateMipmap):
+        (WebCore::WebGLRenderingContextBase::getTexParameter):
+        (WebCore::WebGLRenderingContextBase::texImage2DBase):
+        (WebCore::WebGLRenderingContextBase::validateTexFunc):
+        (WebCore::WebGLRenderingContextBase::texSubImage2D):
+        (WebCore::WebGLRenderingContextBase::texSubImage2DBase):
+        (WebCore::WebGLRenderingContextBase::copyTexImage2D):
+        (WebCore::WebGLRenderingContextBase::texImage2D):
+        (WebCore::WebGLRenderingContextBase::texParameter):
+        (WebCore::WebGLRenderingContextBase::validateTextureBinding):
+        * html/canvas/WebGLRenderingContextBase.h:
+        * html/parser/HTMLConstructionSite.cpp:
+        (WebCore::executeReparentTask):
+        (WebCore::executeTakeAllChildrenAndReparentTask):
+        (WebCore::HTMLConstructionSite::dispatchDocumentElementAvailableIfNeeded):
+        (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
+        (WebCore::HTMLConstructionSite::findFosterSite):
+        * html/parser/HTMLPreloadScanner.cpp:
+        (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
+        * html/parser/XSSAuditorDelegate.cpp:
+        (WebCore::XSSAuditorDelegate::generateViolationReport):
+        * html/shadow/TextControlInnerElements.cpp:
+        (WebCore::SearchFieldResultsButtonElement::defaultEventHandler):
+        * html/track/InbandGenericTextTrack.cpp:
+        (WebCore::InbandGenericTextTrack::updateGenericCue):
+        (WebCore::InbandGenericTextTrack::removeGenericCue):
+        * html/track/InbandTextTrack.cpp:
+        (WebCore::InbandTextTrack::willRemove):
+        * html/track/TextTrack.cpp:
+        (WebCore::TextTrack::addCue):
+        (WebCore::TextTrack::addRegion):
+        * html/track/VideoTrack.cpp:
+        (WebCore::VideoTrack::willRemove):
+        * inspector/InspectorCanvas.cpp:
+        (WebCore::InspectorCanvas::buildInitialState):
+        * platform/graphics/GraphicsContext.h:
+        (WebCore::GraphicsContext::strokeGradient const):
+        (WebCore::GraphicsContext::fillGradient const):
+        * rendering/svg/RenderSVGPath.cpp:
+        (WebCore::useStrokeStyleToFill):
+
 2017-11-03  Devin Rousso  <webkit@devinrousso.com>
 
         Web Inspector: Canvas2D Profiling: highlight expensive context commands in the captured command log
index 511714d..bf50697 100644 (file)
@@ -1523,8 +1523,8 @@ void AXObjectCache::handleAriaModalChange(Node* node)
 void AXObjectCache::labelChanged(Element* element)
 {
     ASSERT(is<HTMLLabelElement>(*element));
-    HTMLElement* correspondingControl = downcast<HTMLLabelElement>(*element).control();
-    deferTextChangedIfNeeded(correspondingControl);
+    auto correspondingControl = downcast<HTMLLabelElement>(*element).control();
+    deferTextChangedIfNeeded(correspondingControl.get());
 }
 
 void AXObjectCache::recomputeIsIgnored(RenderObject* renderer)
index ba2352f..b9dc8d3 100644 (file)
@@ -2525,7 +2525,7 @@ AccessibilityObject* AccessibilityRenderObject::correspondingControlForLabelElem
     if (!labelElement)
         return nullptr;
     
-    HTMLElement* correspondingControl = labelElement->control();
+    auto correspondingControl = labelElement->control();
     if (!correspondingControl)
         return nullptr;
 
@@ -2533,7 +2533,7 @@ AccessibilityObject* AccessibilityRenderObject::correspondingControlForLabelElem
     if (correspondingControl->renderer() && !correspondingControl->renderer()->parent())
         return nullptr;
     
-    return axObjectCache()->getOrCreate(correspondingControl);     
+    return axObjectCache()->getOrCreate(correspondingControl.get());
 }
 
 AccessibilityObject* AccessibilityRenderObject::correspondingLabelForControlElement() const
index b5adbf5..0c4b4b4 100644 (file)
@@ -39,6 +39,7 @@
 #include "HTMLTableCaptionElement.h"
 #include "HTMLTableCellElement.h"
 #include "HTMLTableElement.h"
+#include "HTMLTableSectionElement.h"
 #include "RenderObject.h"
 #include "RenderTable.h"
 #include "RenderTableCell.h"
@@ -392,8 +393,8 @@ void AccessibilityTable::addChildren()
     table.recalcSectionsIfNeeded();
     
     if (HTMLTableElement* tableElement = this->tableElement()) {
-        if (HTMLTableCaptionElement* caption = tableElement->caption()) {
-            AccessibilityObject* axCaption = axObjectCache()->getOrCreate(caption);
+        if (auto caption = tableElement->caption()) {
+            AccessibilityObject* axCaption = axObjectCache()->getOrCreate(caption.get());
             if (axCaption && !axCaption->accessibilityIsIgnored())
                 m_children.append(axCaption);
         }
@@ -686,7 +687,7 @@ String AccessibilityTable::title() const
     // see if there is a caption
     Node* tableElement = m_renderer->node();
     if (is<HTMLTableElement>(tableElement)) {
-        if (HTMLTableCaptionElement* caption = downcast<HTMLTableElement>(*tableElement).caption())
+        if (auto caption = downcast<HTMLTableElement>(*tableElement).caption())
             title = caption->innerText();
     }
     
index 0978d3c..ff23be1 100644 (file)
@@ -250,7 +250,7 @@ static AtkObject* webkitAccessibleTableGetCaption(AtkTable* table)
     if (accTable->isAccessibilityRenderObject()) {
         Node* node = accTable->node();
         if (is<HTMLTableElement>(node)) {
-            HTMLTableCaptionElement* caption = downcast<HTMLTableElement>(*node).caption();
+            auto caption = downcast<HTMLTableElement>(*node).caption();
             if (caption)
                 return AccessibilityObject::firstAccessibleObjectFromNode(caption->renderer()->element())->wrapper();
         }
index 828f5b8..4a35b50 100644 (file)
@@ -252,7 +252,7 @@ Vector<Color> ColorInputType::suggestions() const
 {
     Vector<Color> suggestions;
 #if ENABLE(DATALIST_ELEMENT)
-    if (auto* dataList = element().dataList()) {
+    if (auto dataList = element().dataList()) {
         Ref<HTMLCollection> options = dataList->options();
         unsigned length = options->length();
         suggestions.reserveInitialCapacity(length);
index 1af3ff0..29c2861 100644 (file)
@@ -299,13 +299,13 @@ bool FTPDirectoryDocumentParser::loadDocumentTemplate()
 
     auto& document = *this->document();
 
-    auto* foundElement = document.getElementById(String(ASCIILiteral("ftpDirectoryTable")));
+    auto foundElement = makeRefPtr(document.getElementById(String(ASCIILiteral("ftpDirectoryTable"))));
     if (!foundElement)
         LOG_ERROR("Unable to find element by id \"ftpDirectoryTable\" in the template document.");
-    else if (!is<HTMLTableElement>(*foundElement))
+    else if (!is<HTMLTableElement>(foundElement))
         LOG_ERROR("Element of id \"ftpDirectoryTable\" is not a table element");
     else {
-        m_tableElement = downcast<HTMLTableElement>(foundElement);
+        m_tableElement = downcast<HTMLTableElement>(foundElement.get());
         return true;
     }
 
@@ -314,7 +314,7 @@ bool FTPDirectoryDocumentParser::loadDocumentTemplate()
 
     // If we didn't find the table element, lets try to append our own to the body.
     // If that fails for some reason, cram it on the end of the document as a last ditch effort.
-    if (auto* body = document.bodyOrFrameset())
+    if (auto body = makeRefPtr(document.bodyOrFrameset()))
         body->appendChild(*m_tableElement);
     else
         document.appendChild(*m_tableElement);
index eae34e4..8829900 100644 (file)
@@ -152,7 +152,7 @@ void FileInputType::restoreFormControlState(const FormControlState& state)
 
 bool FileInputType::appendFormData(DOMFormData& formData, bool multipart) const
 {
-    auto* fileList = element().files();
+    auto fileList = makeRefPtr(element().files());
     ASSERT(fileList);
 
     auto name = element().name();
@@ -288,7 +288,7 @@ void FileInputType::disabledAttributeChanged()
     if (!root)
         return;
     
-    if (auto* button = childrenOfType<UploadButtonElement>(*root).first())
+    if (auto button = makeRefPtr(childrenOfType<UploadButtonElement>(*root).first()))
         button->setBooleanAttribute(disabledAttr, element().isDisabledFormControl());
 }
 
@@ -300,7 +300,7 @@ void FileInputType::multipleAttributeChanged()
     if (!root)
         return;
 
-    if (auto* button = childrenOfType<UploadButtonElement>(*root).first())
+    if (auto button = makeRefPtr(childrenOfType<UploadButtonElement>(*root).first()))
         button->setValue(element().multiple() ? fileButtonChooseMultipleFilesLabel() : fileButtonChooseFileLabel());
 }
 
index 6238989..8575293 100644 (file)
@@ -123,7 +123,7 @@ void FormAssociatedElement::formOwnerRemovedFromTree(const Node& formRoot)
 {
     ASSERT(m_form);
     RefPtr<Node> rootNode = &asHTMLElement();
-    for (auto* ancestor = asHTMLElement().parentNode(); ancestor; ancestor = ancestor->parentNode()) {
+    for (auto ancestor = makeRefPtr(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
             // need an id observer since we are no longer connected.
index db8f328..1c6bf96 100644 (file)
@@ -194,7 +194,7 @@ Node::InsertedIntoAncestorResult HTMLBodyElement::insertedIntoAncestor(Insertion
     // FIXME: It's surprising this is web compatible since it means a marginwidth and marginheight attribute can
     // magically appear on the <body> of all documents embedded through <iframe> or <frame>.
     // FIXME: Perhaps this code should be in attach() instead of here.
-    auto* ownerElement = document().ownerElement();
+    auto ownerElement = makeRefPtr(document().ownerElement());
     if (!is<HTMLFrameElementBase>(ownerElement))
         return InsertedIntoAncestorResult::Done;
 
@@ -203,7 +203,7 @@ Node::InsertedIntoAncestorResult HTMLBodyElement::insertedIntoAncestor(Insertion
 
 void HTMLBodyElement::didFinishInsertingNode()
 {
-    auto* ownerElement = document().ownerElement();
+    auto ownerElement = makeRefPtr(document().ownerElement());
     RELEASE_ASSERT(is<HTMLFrameElementBase>(ownerElement));
     auto& ownerFrameElement = downcast<HTMLFrameElementBase>(*ownerElement);
 
@@ -306,7 +306,7 @@ void HTMLBodyElement::scrollTo(const ScrollToOptions& options, ScrollClamping cl
         // invoke scroll() on window with options as the only argument, and terminate these steps.
         // Note that WebKit always uses quirks mode document scrolling behavior. See Document::scrollingElement().
         // FIXME: Scrolling an independently scrollable body is broken: webkit.org/b/161612.
-        auto* window = document().domWindow();
+        auto window = makeRefPtr(document().domWindow());
         if (!window)
             return;
 
index 484bcb7..6469fc6 100644 (file)
@@ -129,7 +129,7 @@ bool HTMLDetailsElement::isActiveSummary(const HTMLSummaryElement& summary) cons
     if (summary.parentNode() != this)
         return false;
 
-    auto* slot = shadowRoot()->findAssignedSlot(summary);
+    auto slot = makeRefPtr(shadowRoot()->findAssignedSlot(summary));
     if (!slot)
         return false;
     return slot == m_summarySlot;
@@ -147,7 +147,7 @@ void HTMLDetailsElement::parseAttribute(const QualifiedName& name, const AtomicS
         bool oldValue = m_isOpen;
         m_isOpen = !value.isNull();
         if (oldValue != m_isOpen) {
-            auto* root = shadowRoot();
+            auto root = makeRefPtr(shadowRoot());
             ASSERT(root);
             if (m_isOpen)
                 root->appendChild(*m_defaultSlot);
index 4629d91..e041a92 100644 (file)
@@ -123,8 +123,8 @@ std::optional<Variant<RefPtr<DOMWindow>, RefPtr<Element>, RefPtr<HTMLCollection>
 
     auto& element = *documentNamedItem(*name.impl());
     if (UNLIKELY(is<HTMLIFrameElement>(element))) {
-        if (auto* domWindow = downcast<HTMLIFrameElement>(element).contentWindow())
-            return Variant<RefPtr<DOMWindow>, RefPtr<Element>, RefPtr<HTMLCollection>> { RefPtr<DOMWindow> { domWindow } };
+        if (auto domWindow = makeRefPtr(downcast<HTMLIFrameElement>(element).contentWindow()))
+            return Variant<RefPtr<DOMWindow>, RefPtr<Element>, RefPtr<HTMLCollection>> { WTFMove(domWindow) };
     }
 
     return Variant<RefPtr<DOMWindow>, RefPtr<Element>, RefPtr<HTMLCollection>> { RefPtr<Element> { &element } };
index 2795496..491cb62 100644 (file)
@@ -402,7 +402,7 @@ Node::Editability HTMLElement::editabilityFromContentEditableAttr(const Node& no
         }
     }
 
-    auto* containingShadowRoot = node.containingShadowRoot();
+    auto containingShadowRoot = makeRefPtr(node.containingShadowRoot());
     if (containingShadowRoot && containingShadowRoot->mode() == ShadowRootMode::UserAgent)
         return Editability::ReadOnly;
 
index ff8b981..f5aa2eb 100644 (file)
@@ -237,7 +237,7 @@ void HTMLFormControlElement::didAttachRenderers()
         setAutofocused();
 
         RefPtr<HTMLFormControlElement> element = this;
-        auto* frameView = document().view();
+        auto frameView = makeRefPtr(document().view());
         if (frameView && frameView->layoutContext().isInLayout()) {
             frameView->queuePostLayoutCallback([element] {
                 element->focus();
index 17d8460..ceb5d6a 100644 (file)
@@ -113,9 +113,9 @@ bool HTMLFrameOwnerElement::isKeyboardFocusable(KeyboardEvent& event) const
 
 ExceptionOr<Document&> HTMLFrameOwnerElement::getSVGDocument() const
 {
-    auto* document = contentDocument();
+    auto document = makeRef(*contentDocument());
     if (is<SVGDocument>(document))
-        return *document;
+        return document.get();
     // Spec: http://www.w3.org/TR/SVG/struct.html#InterfaceGetSVGDocument
     return Exception { NotSupportedError };
 }
index c9f6f0c..4d1a01e 100644 (file)
@@ -230,11 +230,11 @@ void HTMLFrameSetElement::removedFromAncestor(RemovalType removalType, Container
 
 DOMWindow* HTMLFrameSetElement::namedItem(const AtomicString& name)
 {
-    auto* frameElement = children()->namedItem(name);
+    auto frameElement = makeRefPtr(children()->namedItem(name));
     if (!is<HTMLFrameElement>(frameElement))
         return nullptr;
 
-    if (auto* document = downcast<HTMLFrameElement>(*frameElement).contentDocument())
+    if (auto document = makeRefPtr(downcast<HTMLFrameElement>(frameElement.get())->contentDocument()))
         return document->domWindow();
     return nullptr;
 }
index 49f8372..8bd7c6d 100644 (file)
@@ -66,7 +66,7 @@ void HTMLHtmlElement::insertedByParser()
     if (!document().frame())
         return;
 
-    auto* documentLoader = document().frame()->loader().documentLoader();
+    auto documentLoader = makeRefPtr(document().frame()->loader().documentLoader());
     if (!documentLoader)
         return;
 
index bd05682..6f6b4da 100644 (file)
@@ -144,7 +144,7 @@ void HTMLImageElement::setBestFitURLAndDPRFromImageCandidate(const ImageCandidat
 
 ImageCandidate HTMLImageElement::bestFitSourceFromPictureElement()
 {
-    auto* picture = pictureElement();
+    auto picture = makeRefPtr(pictureElement());
     if (!picture)
         return { };
     picture->clearViewportDependentResults();
@@ -167,7 +167,7 @@ ImageCandidate HTMLImageElement::bestFitSourceFromPictureElement()
                 continue;
         }
 
-        auto* documentElement = document().documentElement();
+        auto documentElement = makeRefPtr(document().documentElement());
         MediaQueryEvaluator evaluator { document().printing() ? "print" : "screen", document(), documentElement ? documentElement->computedStyle() : nullptr };
         auto* queries = source.parsedMediaAttribute();
         LOG(MediaQueries, "HTMLImageElement %p bestFitSourceFromPictureElement evaluating media queries", this);
index 4e2bf3c..eb74f02 100644 (file)
@@ -1193,7 +1193,7 @@ void HTMLInputElement::defaultEventHandler(Event& event)
             dispatchFormControlChangeEvent();
 
         // Form may never have been present, or may have been destroyed by code responding to the change event.
-        if (auto* formElement = form())
+        if (auto formElement = makeRefPtr(form()))
             formElement->submitImplicitly(event, canTriggerImplicitSubmission());
 
         event.setDefaultHandled();
@@ -1583,12 +1583,12 @@ void HTMLInputElement::selectColor(const Color& color)
 }
 
 #if ENABLE(DATALIST_ELEMENT)
-HTMLElement* HTMLInputElement::list() const
+RefPtr<HTMLElement> HTMLInputElement::list() const
 {
     return dataList();
 }
 
-HTMLDataListElement* HTMLInputElement::dataList() const
+RefPtr<HTMLDataListElement> HTMLInputElement::dataList() const
 {
     if (!m_hasNonEmptyList)
         return nullptr;
@@ -2059,7 +2059,7 @@ bool HTMLInputElement::setupDateTimeChooserParameters(DateTimeChooserParameters&
     parameters.currentValue = value();
     parameters.isAnchorElementRTL = computedStyle()->direction() == RTL;
 #if ENABLE(DATALIST_ELEMENT)
-    if (RefPtr<HTMLDataListElement> dataList = this->dataList()) {
+    if (auto dataList = this->dataList()) {
         Ref<HTMLCollection> options = dataList->options();
         for (unsigned i = 0; RefPtr<HTMLOptionElement> option = downcast<HTMLOptionElement>(options->item(i)); ++i) {
             if (!isValidValue(option->value()))
index 8ab6534..a856a9b 100644 (file)
@@ -264,8 +264,8 @@ public:
     bool willRespondToMouseClickEvents() override;
 
 #if ENABLE(DATALIST_ELEMENT)
-    HTMLElement* list() const;
-    HTMLDataListElement* dataList() const;
+    RefPtr<HTMLElement> list() const;
+    RefPtr<HTMLDataListElement> dataList() const;
     void listAttributeTargetChanged();
 #endif
 
index 055125f..a795a5f 100644 (file)
@@ -39,7 +39,7 @@ using namespace HTMLNames;
 
 static LabelableElement* firstElementWithIdIfLabelable(TreeScope& treeScope, const AtomicString& id)
 {
-    auto* element = treeScope.getElementById(id);
+    auto element = makeRefPtr(treeScope.getElementById(id));
     if (!is<LabelableElement>(element))
         return nullptr;
 
@@ -58,7 +58,7 @@ Ref<HTMLLabelElement> HTMLLabelElement::create(const QualifiedName& tagName, Doc
     return adoptRef(*new HTMLLabelElement(tagName, document));
 }
 
-LabelableElement* HTMLLabelElement::control() const
+RefPtr<LabelableElement> HTMLLabelElement::control() const
 {
     auto& controlId = attributeWithoutSynchronization(forAttr);
     if (controlId.isNull()) {
@@ -76,10 +76,10 @@ LabelableElement* HTMLLabelElement::control() const
 
 HTMLFormElement* HTMLLabelElement::form() const
 {
-    auto* control = this->control();
+    auto control = this->control();
     if (!is<HTMLFormControlElement>(control))
         return nullptr;
-    return downcast<HTMLFormControlElement>(*control).form();
+    return downcast<HTMLFormControlElement>(control.get())->form();
 }
 
 void HTMLLabelElement::setActive(bool down, bool pause)
@@ -91,7 +91,7 @@ void HTMLLabelElement::setActive(bool down, bool pause)
     HTMLElement::setActive(down, pause);
 
     // Also update our corresponding control.
-    if (auto* element = control())
+    if (auto element = control())
         element->setActive(down, pause);
 }
 
@@ -104,7 +104,7 @@ void HTMLLabelElement::setHovered(bool over)
     HTMLElement::setHovered(over);
 
     // Also update our corresponding control.
-    if (auto* element = control())
+    if (auto element = control())
         element->setHovered(over);
 }
 
@@ -139,7 +139,7 @@ void HTMLLabelElement::defaultEventHandler(Event& event)
 
 bool HTMLLabelElement::willRespondToMouseClickEvents()
 {
-    auto* element = control();
+    auto element = control();
     return (element && element->willRespondToMouseClickEvents()) || HTMLElement::willRespondToMouseClickEvents();
 }
 
@@ -155,13 +155,13 @@ void HTMLLabelElement::focus(bool restorePreviousSelection, FocusDirection direc
     }
 
     // To match other browsers, always restore previous selection.
-    if (auto* element = control())
+    if (auto element = control())
         element->focus(true, direction);
 }
 
 void HTMLLabelElement::accessKeyAction(bool sendMouseEvents)
 {
-    if (auto* element = control())
+    if (auto element = control())
         element->accessKeyAction(sendMouseEvents);
     else
         HTMLElement::accessKeyAction(sendMouseEvents);
index a3d1421..275df56 100644 (file)
@@ -31,7 +31,7 @@ class HTMLLabelElement final : public HTMLElement {
 public:
     static Ref<HTMLLabelElement> create(const QualifiedName&, Document&);
 
-    WEBCORE_EXPORT LabelableElement* control() const;
+    WEBCORE_EXPORT RefPtr<LabelableElement> control() const;
     WEBCORE_EXPORT HTMLFormElement* form() const final;
 
     bool willRespondToMouseClickEvents() final;
index 090e0c7..e4cc496 100644 (file)
@@ -42,7 +42,7 @@ Ref<HTMLLegendElement> HTMLLegendElement::create(const QualifiedName& tagName, D
     return adoptRef(*new HTMLLegendElement(tagName, document));
 }
 
-HTMLFormControlElement* HTMLLegendElement::associatedControl()
+RefPtr<HTMLFormControlElement> HTMLLegendElement::associatedControl()
 {
     // Check if there's a fieldset belonging to this legend.
     auto enclosingFieldset = ancestorsOfType<HTMLFieldSetElement>(*this).first();
@@ -65,13 +65,13 @@ void HTMLLegendElement::focus(bool restorePreviousSelection, FocusDirection dire
     }
 
     // To match other browsers' behavior, never restore previous selection.
-    if (auto* control = associatedControl())
+    if (auto control = associatedControl())
         control->focus(false, direction);
 }
 
 void HTMLLegendElement::accessKeyAction(bool sendMouseEvents)
 {
-    if (auto* control = associatedControl())
+    if (auto control = associatedControl())
         control->accessKeyAction(sendMouseEvents);
 }
 
@@ -80,7 +80,7 @@ HTMLFormElement* HTMLLegendElement::form() const
     // According to the specification, If the legend has a fieldset element as
     // its parent, then the form attribute must return the same value as the
     // form attribute on that fieldset element. Otherwise, it must return null.
-    auto* fieldset = parentNode();
+    auto fieldset = makeRefPtr(parentNode());
     if (!is<HTMLFieldSetElement>(fieldset))
         return nullptr;
     return downcast<HTMLFieldSetElement>(*fieldset).form();
index 144e19f..142fd45 100644 (file)
@@ -39,7 +39,7 @@ private:
     HTMLLegendElement(const QualifiedName&, Document&);
 
     // Control in the legend's field set that gets focus and access key.
-    HTMLFormControlElement* associatedControl();
+    RefPtr<HTMLFormControlElement> associatedControl();
 
     void accessKeyAction(bool sendMouseEvents) final;
     void focus(bool restorePreviousSelection, FocusDirection) final;
index 6926721..9d3dce3 100644 (file)
@@ -401,7 +401,7 @@ void HTMLLinkElement::setCSSStyleSheet(const String& href, const URL& baseURL, c
         ASSERT(!m_sheet);
         return;
     }
-    auto* frame = document().frame();
+    auto frame = makeRefPtr(document().frame());
     if (!frame)
         return;
 
@@ -584,7 +584,7 @@ void HTMLLinkElement::addSubresourceAttributeURLs(ListHashSet<URL>& urls) const
     // Append the URL of this link element.
     addSubresourceURL(urls, href());
 
-    if (auto* styleSheet = this->sheet()) {
+    if (auto styleSheet = makeRefPtr(this->sheet())) {
         styleSheet->contents().traverseSubresources([&] (auto& resource) {
             urls.add(resource.url());
             return false;
index 0c7c7ab..fa0d5ab 100644 (file)
@@ -641,7 +641,7 @@ static bool needsAutoplayPlayPauseEventsQuirk(const Document& document)
     if (!page || !page->settings().needsSiteSpecificQuirks())
         return false;
 
-    auto* loader = document.loader();
+    auto loader = makeRefPtr(document.loader());
     return loader && loader->allowedAutoplayQuirks().contains(AutoplayQuirk::SynthesizedPauseEvents);
 }
 
@@ -1521,7 +1521,7 @@ void HTMLMediaElement::loadResource(const URL& initialURL, ContentType& contentT
     }
 
 #if ENABLE(CONTENT_EXTENSIONS)
-    if (auto* documentLoader = frame->loader().documentLoader()) {
+    if (auto documentLoader = makeRefPtr(frame->loader().documentLoader())) {
         if (page->userContentProvider().processContentExtensionRulesForLoad(url, ResourceType::Media, *documentLoader).blockedLoad) {
             mediaLoadingFailed(MediaPlayer::FormatError);
             return;
@@ -1854,7 +1854,7 @@ void HTMLMediaElement::updateActiveTextTrackCues(const MediaTime& movieTime)
         // simple event named cuechange at the track element as well.
         if (is<LoadableTextTrack>(*affectedTrack)) {
             auto event = Event::create(eventNames().cuechangeEvent, false, false);
-            auto* trackElement = downcast<LoadableTextTrack>(*affectedTrack).trackElement();
+            auto trackElement = makeRefPtr(downcast<LoadableTextTrack>(*affectedTrack).trackElement());
             ASSERT(trackElement);
             event->setTarget(trackElement);
             m_asyncEventQueue.enqueueEvent(WTFMove(event));
@@ -3952,7 +3952,7 @@ void HTMLMediaElement::removeAudioTrack(AudioTrack& track)
 void HTMLMediaElement::removeTextTrack(TextTrack& track, bool scheduleEvent)
 {
     TrackDisplayUpdateScope scope { *this };
-    if (auto* cues = track.cues())
+    if (auto cues = makeRefPtr(track.cues()))
         textTrackRemoveCues(track, *cues);
     track.clearClient();
     if (m_textTracks)
@@ -4288,7 +4288,7 @@ void HTMLMediaElement::updateCaptionContainer()
 void HTMLMediaElement::layoutSizeChanged()
 {
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
-    if (auto* frameView = document().view()) {
+    if (auto frameView = makeRefPtr(document().view())) {
         auto task = [this, protectedThis = makeRef(*this)] {
             if (auto root = userAgentShadowRoot())
                 root->dispatchEvent(Event::create("resize", false, false));
index f317506..c523229 100644 (file)
@@ -422,7 +422,7 @@ static inline bool shouldBeExposed(const HTMLObjectElement& element)
     // with no children other than param elements, unknown elements and whitespace can be found
     // by name in a document, and other object elements cannot".
 
-    for (auto* child = element.firstChild(); child; child = child->nextSibling()) {
+    for (auto child = makeRefPtr(element.firstChild()); child; child = child->nextSibling()) {
         if (preventsParentObjectFromExposure(*child))
             return false;
     }
@@ -498,7 +498,7 @@ bool HTMLObjectElement::appendFormData(DOMFormData& formData, bool)
 
     // Use PluginLoadingPolicy::DoNotLoad here or it would fire JS events synchronously
     // which would not be safe here.
-    auto* widget = pluginWidget(PluginLoadingPolicy::DoNotLoad);
+    auto widget = makeRefPtr(pluginWidget(PluginLoadingPolicy::DoNotLoad));
     if (!is<PluginViewBase>(widget))
         return false;
     String value;
index 1b36175..5d25f78 100644 (file)
@@ -86,7 +86,7 @@ void HTMLOptGroupElement::parseAttribute(const QualifiedName& name, const Atomic
 
 void HTMLOptGroupElement::recalcSelectOptions()
 {
-    if (auto* selectElement = ancestorsOfType<HTMLSelectElement>(*this).first()) {
+    if (auto selectElement = makeRefPtr(ancestorsOfType<HTMLSelectElement>(*this).first())) {
         selectElement->setRecalcListItems();
         selectElement->updateValidity();
     }
index e104c4a..a7c0606 100644 (file)
@@ -62,7 +62,7 @@ void HTMLPictureElement::sourcesChanged()
 
 bool HTMLPictureElement::viewportChangeAffectedPicture() const
 {
-    auto* documentElement = document().documentElement();
+    auto documentElement = makeRefPtr(document().documentElement());
     MediaQueryEvaluator evaluator { document().printing() ? "print" : "screen", document(), documentElement ? documentElement->computedStyle() : nullptr };
     for (auto& result : m_viewportDependentMediaQueryResults) {
         LOG(MediaQueries, "HTMLPictureElement %p viewportChangeAffectedPicture evaluating media queries", this);
index 6eff80f..bccb7ac 100644 (file)
@@ -111,7 +111,7 @@ void HTMLPlugInElement::resetInstance()
 
 JSC::Bindings::Instance* HTMLPlugInElement::bindingsInstance()
 {
-    auto* frame = document().frame();
+    auto frame = makeRefPtr(document().frame());
     if (!frame)
         return nullptr;
 
@@ -119,8 +119,8 @@ JSC::Bindings::Instance* HTMLPlugInElement::bindingsInstance()
     // the cached allocated Bindings::Instance.  Not supporting this edge-case is OK.
 
     if (!m_instance) {
-        if (auto* widget = pluginWidget())
-            m_instance = frame->script().createScriptInstanceForWidget(widget);
+        if (auto widget = makeRefPtr(pluginWidget()))
+            m_instance = frame->script().createScriptInstanceForWidget(widget.get());
     }
     return m_instance.get();
 }
index af04177..3bf3953 100644 (file)
@@ -138,7 +138,7 @@ bool HTMLPlugInImageElement::isImageType()
     if (m_serviceType.isEmpty() && protocolIs(m_url, "data"))
         m_serviceType = mimeTypeFromDataURL(m_url);
 
-    if (auto* frame = document().frame())
+    if (auto frame = makeRefPtr(document().frame()))
         return frame->loader().client().objectContentType(document().completeURL(m_url), m_serviceType) == ObjectContentType::Image;
 
     return Image::supportsType(m_serviceType);
@@ -230,7 +230,7 @@ void HTMLPlugInImageElement::didAttachRenderers()
 
 void HTMLPlugInImageElement::willDetachRenderers()
 {
-    auto* widget = pluginWidget(PluginLoadingPolicy::DoNotLoad);
+    auto widget = makeRefPtr(pluginWidget(PluginLoadingPolicy::DoNotLoad));
     if (is<PluginViewBase>(widget))
         downcast<PluginViewBase>(*widget).willDetatchRenderer();
 
@@ -406,7 +406,7 @@ bool HTMLPlugInImageElement::partOfSnapshotOverlay(const Node* node) const
     auto queryResult = shadow->querySelector(selector.get());
     if (queryResult.hasException())
         return false;
-    auto* snapshotLabel = queryResult.releaseReturnValue();
+    auto snapshotLabel = makeRefPtr(queryResult.releaseReturnValue());
     return snapshotLabel && snapshotLabel->contains(node);
 }
 
@@ -538,7 +538,7 @@ void HTMLPlugInImageElement::checkSizeChangeForSnapshotting()
     LOG(Plugins, "%p Plug-in originally avoided snapshotting because it was sized %dx%d. Now it is %dx%d. Tell it to snapshot.\n", this, m_sizeWhenSnapshotted.width(), m_sizeWhenSnapshotted.height(), contentWidth, contentHeight);
     setDisplayState(WaitingForSnapshot);
     m_snapshotDecision = Snapshotted;
-    auto* widget = pluginWidget();
+    auto widget = makeRefPtr(pluginWidget());
     if (is<PluginViewBase>(widget))
         downcast<PluginViewBase>(*widget).beginSnapshottingRunningPlugin();
 }
index 42181a3..e7d6a3b 100644 (file)
@@ -77,7 +77,7 @@ void HTMLSlotElement::attributeChanged(const QualifiedName& name, const AtomicSt
     HTMLElement::attributeChanged(name, oldValue, newValue, reason);
 
     if (isInShadowTree() && name == nameAttr) {
-        if (auto* shadowRoot = containingShadowRoot()) {
+        if (auto shadowRoot = makeRefPtr(containingShadowRoot())) {
             shadowRoot->removeSlotElementByName(oldValue, *this);
             shadowRoot->addSlotElementByName(newValue, *this);
         }
@@ -86,7 +86,7 @@ void HTMLSlotElement::attributeChanged(const QualifiedName& name, const AtomicSt
 
 const Vector<Node*>* HTMLSlotElement::assignedNodes() const
 {
-    auto* shadowRoot = containingShadowRoot();
+    auto shadowRoot = makeRefPtr(containingShadowRoot());
     if (!shadowRoot)
         return nullptr;
 
index 38b8516..b2e8126 100644 (file)
@@ -156,7 +156,7 @@ void HTMLSourceElement::parseAttribute(const QualifiedName& name, const AtomicSt
     if (name == srcsetAttr || name == sizesAttr || name == mediaAttr || name == typeAttr) {
         if (name == mediaAttr)
             m_cachedParsedMediaAttribute = std::nullopt;
-        auto* parent = parentNode();
+        auto parent = makeRefPtr(parentNode());
         if (is<HTMLPictureElement>(parent))
             downcast<HTMLPictureElement>(*parent).sourcesChanged();
     }
index e5d4dfd..3898968 100644 (file)
@@ -144,7 +144,7 @@ void HTMLStyleElement::addSubresourceAttributeURLs(ListHashSet<URL>& urls) const
 {    
     HTMLElement::addSubresourceAttributeURLs(urls);
 
-    if (auto* styleSheet = this->sheet()) {
+    if (auto styleSheet = makeRefPtr(this->sheet())) {
         styleSheet->contents().traverseSubresources([&] (auto& resource) {
             urls.add(resource.url());
             return false;
index 6866096..776cb21 100644 (file)
@@ -71,7 +71,7 @@ void HTMLSummaryElement::didAddUserAgentShadowRoot(ShadowRoot& root)
     root.appendChild(HTMLSlotElement::create(slotTag, document()));
 }
 
-HTMLDetailsElement* HTMLSummaryElement::detailsElement() const
+RefPtr<HTMLDetailsElement> HTMLSummaryElement::detailsElement() const
 {
     auto* parent = parentElement();
     if (parent && is<HTMLDetailsElement>(*parent))
index 6b74505..5999d5e 100644 (file)
@@ -43,7 +43,7 @@ private:
 
     bool hasCustomFocusLogic() const final { return true; }
 
-    HTMLDetailsElement* detailsElement() const;
+    RefPtr<HTMLDetailsElement> detailsElement() const;
 
     bool supportsFocus() const final;
 };
index ffffaca..aa2bdca 100644 (file)
@@ -62,7 +62,7 @@ Ref<HTMLTableElement> HTMLTableElement::create(const QualifiedName& tagName, Doc
     return adoptRef(*new HTMLTableElement(tagName, document));
 }
 
-HTMLTableCaptionElement* HTMLTableElement::caption() const
+RefPtr<HTMLTableCaptionElement> HTMLTableElement::caption() const
 {
     return childrenOfType<HTMLTableCaptionElement>(const_cast<HTMLTableElement&>(*this)).first();
 }
@@ -75,7 +75,7 @@ ExceptionOr<void> HTMLTableElement::setCaption(RefPtr<HTMLTableCaptionElement>&&
     return insertBefore(*newCaption, firstChild());
 }
 
-HTMLTableSectionElement* HTMLTableElement::tHead() const
+RefPtr<HTMLTableSectionElement> HTMLTableElement::tHead() const
 {
     for (RefPtr<Node> child = firstChild(); child; child = child->nextSibling()) {
         if (child->hasTagName(theadTag))
@@ -102,7 +102,7 @@ ExceptionOr<void> HTMLTableElement::setTHead(RefPtr<HTMLTableSectionElement>&& n
     return insertBefore(*newHead, child.get());
 }
 
-HTMLTableSectionElement* HTMLTableElement::tFoot() const
+RefPtr<HTMLTableSectionElement> HTMLTableElement::tFoot() const
 {
     for (RefPtr<Node> child = firstChild(); child; child = child->nextSibling()) {
         if (child->hasTagName(tfootTag))
@@ -123,8 +123,8 @@ ExceptionOr<void> HTMLTableElement::setTFoot(RefPtr<HTMLTableSectionElement>&& n
 
 Ref<HTMLTableSectionElement> HTMLTableElement::createTHead()
 {
-    if (auto* existingHead = tHead())
-        return *existingHead;
+    if (auto existingHead = tHead())
+        return existingHead.releaseNonNull();
     auto head = HTMLTableSectionElement::create(theadTag, document());
     setTHead(head.copyRef());
     return head;
@@ -132,14 +132,14 @@ Ref<HTMLTableSectionElement> HTMLTableElement::createTHead()
 
 void HTMLTableElement::deleteTHead()
 {
-    if (auto* head = tHead())
+    if (auto head = tHead())
         removeChild(*head);
 }
 
 Ref<HTMLTableSectionElement> HTMLTableElement::createTFoot()
 {
-    if (auto* existingFoot = tFoot())
-        return *existingFoot;
+    if (auto existingFoot = tFoot())
+        return existingFoot.releaseNonNull();
     auto foot = HTMLTableSectionElement::create(tfootTag, document());
     setTFoot(foot.copyRef());
     return foot;
@@ -147,7 +147,7 @@ Ref<HTMLTableSectionElement> HTMLTableElement::createTFoot()
 
 void HTMLTableElement::deleteTFoot()
 {
-    if (auto* foot = tFoot())
+    if (auto foot = tFoot())
         removeChild(*foot);
 }
 
@@ -161,8 +161,8 @@ Ref<HTMLTableSectionElement> HTMLTableElement::createTBody()
 
 Ref<HTMLTableCaptionElement> HTMLTableElement::createCaption()
 {
-    if (auto* existingCaption = caption())
-        return *existingCaption;
+    if (auto existingCaption = caption())
+        return existingCaption.releaseNonNull();
     auto caption = HTMLTableCaptionElement::create(captionTag, document());
     setCaption(caption.copyRef());
     return caption;
@@ -170,7 +170,7 @@ Ref<HTMLTableCaptionElement> HTMLTableElement::createCaption()
 
 void HTMLTableElement::deleteCaption()
 {
-    if (auto* caption = this->caption())
+    if (auto caption = this->caption())
         removeChild(*caption);
 }
 
index 2ea72e6..db34fdf 100644 (file)
@@ -39,13 +39,13 @@ public:
     static Ref<HTMLTableElement> create(Document&);
     static Ref<HTMLTableElement> create(const QualifiedName&, Document&);
 
-    WEBCORE_EXPORT HTMLTableCaptionElement* caption() const;
+    WEBCORE_EXPORT RefPtr<HTMLTableCaptionElement> caption() const;
     WEBCORE_EXPORT ExceptionOr<void> setCaption(RefPtr<HTMLTableCaptionElement>&&);
 
-    WEBCORE_EXPORT HTMLTableSectionElement* tHead() const;
+    WEBCORE_EXPORT RefPtr<HTMLTableSectionElement> tHead() const;
     WEBCORE_EXPORT ExceptionOr<void> setTHead(RefPtr<HTMLTableSectionElement>&&);
 
-    WEBCORE_EXPORT HTMLTableSectionElement* tFoot() const;
+    WEBCORE_EXPORT RefPtr<HTMLTableSectionElement> tFoot() const;
     WEBCORE_EXPORT ExceptionOr<void> setTFoot(RefPtr<HTMLTableSectionElement>&&);
 
     WEBCORE_EXPORT Ref<HTMLTableSectionElement> createTHead();
index ccc6fb8..2a4d9b3 100644 (file)
@@ -82,7 +82,7 @@ void HTMLTablePartElement::collectStyleForPresentationAttribute(const QualifiedN
         HTMLElement::collectStyleForPresentationAttribute(name, value, style);
 }
 
-HTMLTableElement* HTMLTablePartElement::findParentTable() const
+RefPtr<HTMLTableElement> HTMLTablePartElement::findParentTable() const
 {
     RefPtr<ContainerNode> parent = parentNode();
     while (parent && !is<HTMLTableElement>(*parent))
index 053b98d..301d7df 100644 (file)
@@ -41,7 +41,7 @@ protected:
     bool isPresentationAttribute(const QualifiedName&) const override;
     void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) override;
 
-    HTMLTableElement* findParentTable() const;
+    RefPtr<HTMLTableElement> findParentTable() const;
 };
 
 } // namespace WebCore
index c04348d..cc1a2c5 100644 (file)
@@ -54,7 +54,7 @@ Ref<HTMLTableRowElement> HTMLTableRowElement::create(const QualifiedName& tagNam
     return adoptRef(*new HTMLTableRowElement(tagName, document));
 }
 
-static inline HTMLTableElement* findTable(const HTMLTableRowElement& row)
+static inline RefPtr<HTMLTableElement> findTable(const HTMLTableRowElement& row)
 {
     auto* parent = row.parentNode();
     if (is<HTMLTableElement>(parent))
@@ -69,7 +69,7 @@ static inline HTMLTableElement* findTable(const HTMLTableRowElement& row)
 
 int HTMLTableRowElement::rowIndex() const
 {
-    auto* table = findTable(*this);
+    auto table = findTable(*this);
     if (!table)
         return -1;
 
@@ -85,7 +85,7 @@ int HTMLTableRowElement::rowIndex() const
 
 static inline RefPtr<HTMLCollection> findRows(const HTMLTableRowElement& row)
 {
-    auto* parent = row.parentNode();
+    auto parent = makeRefPtr(row.parentNode());
     if (is<HTMLTableSectionElement>(parent))
         return downcast<HTMLTableSectionElement>(*parent).rows();
     if (is<HTMLTableElement>(parent))
index 3e9a7a2..cc868ac 100644 (file)
@@ -50,7 +50,7 @@ Ref<HTMLTableSectionElement> HTMLTableSectionElement::create(const QualifiedName
 
 const StyleProperties* HTMLTableSectionElement::additionalPresentationAttributeStyle() const
 {
-    auto* table = findParentTable();
+    auto table = findParentTable();
     if (!table)
         return nullptr;
     return table->additionalGroupStyle(true);
index 3ae337c..abee095 100644 (file)
@@ -325,10 +325,10 @@ void HTMLTrackElement::textTrackRemoveCue(TextTrack& track, TextTrackCue& cue)
 
 RefPtr<HTMLMediaElement> HTMLTrackElement::mediaElement() const
 {
-    auto* parent = parentElement();
+    auto parent = makeRefPtr(parentElement());
     if (!is<HTMLMediaElement>(parent))
         return nullptr;
-    return downcast<HTMLMediaElement>(parent);
+    return downcast<HTMLMediaElement>(parent.get());
 }
 
 }
index 4d2b6e1..6144422 100644 (file)
@@ -74,7 +74,7 @@ static int compareIcons(const LinkIcon& a, const LinkIcon& b)
 
 auto LinkIconCollector::iconsOfTypes(OptionSet<LinkIconType> iconTypes) -> Vector<LinkIcon>
 {
-    auto* head = m_document.head();
+    auto head = makeRefPtr(m_document.head());
     if (!head)
         return { };
 
index cd5b27b..aaa058c 100644 (file)
@@ -109,7 +109,7 @@ void MediaDocumentParser::createDocumentStructure()
     videoElement->setAttributeWithoutSynchronization(controlsAttr, emptyAtom());
     videoElement->setAttributeWithoutSynchronization(autoplayAttr, emptyAtom());
     videoElement->setAttributeWithoutSynchronization(srcAttr, document.url().string());
-    if (auto* loader = document.loader())
+    if (auto loader = makeRefPtr(document.loader()))
         videoElement->setAttributeWithoutSynchronization(typeAttr, loader->responseMIMEType());
 
     if (!RuntimeEnabledFeatures::sharedFeatures().modernMediaControlsEnabled()) {
@@ -235,7 +235,7 @@ void MediaDocument::mediaElementSawUnsupportedTracks()
 
 void MediaDocument::replaceMediaElementTimerFired()
 {
-    auto* htmlBody = bodyOrFrameset();
+    auto htmlBody = makeRefPtr(bodyOrFrameset());
     if (!htmlBody)
         return;
 
@@ -243,7 +243,7 @@ void MediaDocument::replaceMediaElementTimerFired()
     htmlBody->setAttributeWithoutSynchronization(marginwidthAttr, AtomicString("0", AtomicString::ConstructFromLiteral));
     htmlBody->setAttributeWithoutSynchronization(marginheightAttr, AtomicString("0", AtomicString::ConstructFromLiteral));
 
-    if (auto* videoElement = descendantVideoElement(*htmlBody)) {
+    if (auto videoElement = makeRefPtr(descendantVideoElement(*htmlBody))) {
         auto embedElement = HTMLEmbedElement::create(*this);
 
         embedElement->setAttributeWithoutSynchronization(widthAttr, AtomicString("100%", AtomicString::ConstructFromLiteral));
@@ -252,7 +252,7 @@ void MediaDocument::replaceMediaElementTimerFired()
         embedElement->setAttributeWithoutSynchronization(srcAttr, url().string());
 
         ASSERT(loader());
-        if (auto* loader = this->loader())
+        if (auto loader = makeRefPtr(this->loader()))
             embedElement->setAttributeWithoutSynchronization(typeAttr, loader->writer().mimeType());
 
         videoElement->parentNode()->replaceChild(embedElement, *videoElement);
index b8b5282..bda9106 100644 (file)
@@ -155,7 +155,7 @@ static bool needsArbitraryUserGestureAutoplayQuirk(const Document& document)
     if (!document.settings().needsSiteSpecificQuirks())
         return false;
 
-    auto* loader = document.loader();
+    auto loader = makeRefPtr(document.loader());
     return loader && loader->allowedAutoplayQuirks().contains(AutoplayQuirk::ArbitraryUserGestures);
 }
 #endif // PLATFORM(MAC)
@@ -743,7 +743,7 @@ static bool isElementRectMostlyInMainFrame(const HTMLMediaElement& element)
     if (!element.renderer())
         return false;
 
-    auto* documentFrame = element.document().frame();
+    auto documentFrame = makeRefPtr(element.document().frame());
     if (!documentFrame)
         return false;
 
@@ -769,7 +769,7 @@ static bool isElementLargeRelativeToMainFrame(const HTMLMediaElement& element)
     if (!renderer)
         return false;
 
-    auto* documentFrame = element.document().frame();
+    auto documentFrame = makeRefPtr(element.document().frame());
     if (!documentFrame)
         return false;
 
index 2e16b93..45794e0 100644 (file)
@@ -98,7 +98,7 @@ void PluginDocumentParser::createDocumentStructure()
     embedElement->setAttributeWithoutSynchronization(srcAttr, document.url().string());
     
     ASSERT(document.loader());
-    if (auto* loader = document.loader())
+    if (auto loader = makeRefPtr(document.loader()))
         m_embedElement->setAttributeWithoutSynchronization(typeAttr, loader->writer().mimeType());
 
     document.setPluginElement(*m_embedElement);
@@ -113,7 +113,7 @@ void PluginDocumentParser::appendBytes(DocumentWriter&, const char*, size_t)
 
     createDocumentStructure();
 
-    auto* frame = document()->frame();
+    auto frame = makeRefPtr(document()->frame());
     if (!frame)
         return;
 
index 3045b90..4cdc0b0 100644 (file)
@@ -49,7 +49,7 @@ RadioNodeList::~RadioNodeList()
     ownerNode().nodeLists()->removeCacheWithAtomicName(this, m_name);
 }
 
-static inline HTMLInputElement* toRadioButtonInputElement(HTMLElement& element)
+static inline RefPtr<HTMLInputElement> toRadioButtonInputElement(HTMLElement& element)
 {
     if (!is<HTMLInputElement>(element))
         return nullptr;
@@ -64,7 +64,7 @@ String RadioNodeList::value() const
 {
     auto length = this->length();
     for (unsigned i = 0; i < length; ++i) {
-        auto* inputElement = toRadioButtonInputElement(*item(i));
+        auto inputElement = toRadioButtonInputElement(*item(i));
         if (!inputElement || !inputElement->checked())
             continue;
         return inputElement->value();
@@ -76,7 +76,7 @@ void RadioNodeList::setValue(const String& value)
 {
     auto length = this->length();
     for (unsigned i = 0; i < length; ++i) {
-        auto* inputElement = toRadioButtonInputElement(*item(i));
+        auto inputElement = toRadioButtonInputElement(*item(i));
         if (!inputElement || inputElement->value() != value)
             continue;
         inputElement->setChecked(true);
index 7a87fc8..4eef285 100644 (file)
@@ -371,7 +371,7 @@ void RangeInputType::updateTickMarkValues()
         return;
     m_tickMarkValues.clear();
     m_tickMarkValuesDirty = false;
-    RefPtr<HTMLDataListElement> dataList = element().dataList();
+    auto dataList = element().dataList();
     if (!dataList)
         return;
     Ref<HTMLCollection> options = dataList->options();
index 770cee3..03a1a65 100644 (file)
@@ -65,7 +65,7 @@ bool CanvasRenderingContext::wouldTaintOrigin(const HTMLImageElement* element)
     if (!cachedImage)
         return false;
 
-    auto* image = cachedImage->image();
+    auto image = makeRefPtr(cachedImage->image());
     if (!image)
         return false;
 
index 4413ab8..4a10ae1 100644 (file)
@@ -408,7 +408,7 @@ void CanvasRenderingContext2D::setStrokeStyle(CanvasStyle style)
         } else
             style = CanvasStyle(currentColor(&canvas()));
     } else
-        checkOrigin(style.canvasPattern());
+        checkOrigin(style.canvasPattern().get());
 
     realizeSaves();
     State& state = modifiableState();
@@ -435,7 +435,7 @@ void CanvasRenderingContext2D::setFillStyle(CanvasStyle style)
         } else
             style = CanvasStyle(currentColor(&canvas()));
     } else
-        checkOrigin(style.canvasPattern());
+        checkOrigin(style.canvasPattern().get());
 
     realizeSaves();
     State& state = modifiableState();
@@ -1093,7 +1093,7 @@ void CanvasRenderingContext2D::fillInternal(const Path& path, CanvasFillRule win
         return;
 
     // If gradient size is zero, then paint nothing.
-    auto* gradient = c->fillGradient();
+    auto gradient = c->fillGradient();
     if (gradient && gradient->isZeroSize())
         return;
 
@@ -1128,7 +1128,7 @@ void CanvasRenderingContext2D::strokeInternal(const Path& path)
         return;
 
     // If gradient size is zero, then paint nothing.
-    auto* gradient = c->strokeGradient();
+    auto gradient = c->strokeGradient();
     if (gradient && gradient->isZeroSize())
         return;
 
@@ -1280,7 +1280,7 @@ void CanvasRenderingContext2D::fillRect(float x, float y, float width, float hei
     // from the HTML5 Canvas spec:
     // If x0 = x1 and y0 = y1, then the linear gradient must paint nothing
     // If x0 = x1 and y0 = y1 and r0 = r1, then the radial gradient must paint nothing
-    auto* gradient = c->fillGradient();
+    auto gradient = c->fillGradient();
     if (gradient && gradient->isZeroSize())
         return;
 
@@ -1318,7 +1318,7 @@ void CanvasRenderingContext2D::strokeRect(float x, float y, float width, float h
         return;
 
     // If gradient size is zero, then paint nothing.
-    auto* gradient = c->strokeGradient();
+    auto gradient = c->strokeGradient();
     if (gradient && gradient->isZeroSize())
         return;
 
@@ -1847,10 +1847,10 @@ void CanvasRenderingContext2D::prepareGradientForDashboard(CanvasGradient& gradi
 
 static CanvasRenderingContext2D::Style toStyle(const CanvasStyle& style)
 {
-    if (auto* gradient = style.canvasGradient())
-        return RefPtr<CanvasGradient> { gradient };
-    if (auto* pattern = style.canvasPattern())
-        return RefPtr<CanvasPattern> { pattern };
+    if (auto gradient = style.canvasGradient())
+        return gradient;
+    if (auto pattern = style.canvasPattern())
+        return pattern;
     return style.color();
 }
 
@@ -2616,7 +2616,7 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
         return;
 
     // If gradient size is zero, then paint nothing.
-    auto* gradient = c->strokeGradient();
+    auto gradient = c->strokeGradient();
     if (!fill && gradient && gradient->isZeroSize())
         return;
 
index 5c1b8eb..12319fd 100644 (file)
@@ -56,8 +56,8 @@ public:
     float overrideAlpha() const { return WTF::get<CurrentColor>(m_style).overrideAlpha.value(); }
 
     String color() const;
-    CanvasGradient* canvasGradient() const;
-    CanvasPattern* canvasPattern() const;
+    RefPtr<CanvasGradient> canvasGradient() const;
+    RefPtr<CanvasPattern> canvasPattern() const;
 
     void applyFillColor(GraphicsContext&) const;
     void applyStrokeColor(GraphicsContext&) const;
@@ -103,18 +103,18 @@ inline CanvasStyle::CanvasStyle()
 {
 }
 
-inline CanvasGradient* CanvasStyle::canvasGradient() const
+inline RefPtr<CanvasGradient> CanvasStyle::canvasGradient() const
 {
     if (!WTF::holds_alternative<RefPtr<CanvasGradient>>(m_style))
         return nullptr;
-    return WTF::get<RefPtr<CanvasGradient>>(m_style).get();
+    return WTF::get<RefPtr<CanvasGradient>>(m_style);
 }
 
-inline CanvasPattern* CanvasStyle::canvasPattern() const
+inline RefPtr<CanvasPattern> CanvasStyle::canvasPattern() const
 {
     if (!WTF::holds_alternative<RefPtr<CanvasPattern>>(m_style))
         return nullptr;
-    return WTF::get<RefPtr<CanvasPattern>>(m_style).get();
+    return WTF::get<RefPtr<CanvasPattern>>(m_style);
 }
 
 inline String CanvasStyle::color() const
index cb8af3d..8ecbfa2 100644 (file)
@@ -410,7 +410,7 @@ void WebGL2RenderingContext::texStorage2D(GC3Denum target, GC3Dsizei levels, GC3
     if (isContextLostOrPending())
         return;
 
-    auto* texture = validateTextureBinding("texStorage2D", target, false);
+    auto texture = validateTextureBinding("texStorage2D", target, false);
     if (!texture)
         return;
 
@@ -1154,7 +1154,7 @@ WebGLAny WebGL2RenderingContext::getFramebufferAttachmentParameter(GC3Denum targ
         return nullptr;
     }
     
-    auto* object = m_framebufferBinding->getAttachmentObject(attachment);
+    auto object = makeRefPtr(m_framebufferBinding->getAttachmentObject(attachment));
     if (!object) {
         if (pname == GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE)
             return static_cast<unsigned>(GraphicsContext3D::NONE);
@@ -1765,7 +1765,7 @@ bool WebGL2RenderingContext::validateIndexArrayConservative(GC3Denum type, unsig
     // The case count==0 is already dealt with in drawElements before validateIndexArrayConservative.
     if (!numElements)
         return false;
-    auto* buffer = elementArrayBuffer->elementArrayBuffer();
+    auto buffer = elementArrayBuffer->elementArrayBuffer();
     ASSERT(buffer);
     
     std::optional<unsigned> maxIndex = elementArrayBuffer->getCachedMaxIndex(type);
index 7b9ea55..c396b3a 100644 (file)
@@ -50,7 +50,7 @@ public:
     void disassociateBufferData();
 
     GC3Dsizeiptr byteLength() const;
-    const JSC::ArrayBuffer* elementArrayBuffer() const { return m_elementArrayBuffer.get(); }
+    const RefPtr<JSC::ArrayBuffer> elementArrayBuffer() const { return m_elementArrayBuffer; }
 
     // Gets the cached max index for the given type if one has been set.
     std::optional<unsigned> getCachedMaxIndex(GC3Denum type);
index 5580118..6b01e14 100644 (file)
@@ -223,7 +223,7 @@ WebGLAny WebGLRenderingContext::getFramebufferAttachmentParameter(GC3Denum targe
         return nullptr;
     }
     
-    auto* object = m_framebufferBinding->getAttachmentObject(attachment);
+    auto object = makeRefPtr(m_framebufferBinding->getAttachmentObject(attachment));
     if (!object) {
         if (pname == GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE)
             return static_cast<unsigned>(GraphicsContext3D::NONE);
@@ -262,7 +262,7 @@ WebGLAny WebGLRenderingContext::getFramebufferAttachmentParameter(GC3Denum targe
                 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getFramebufferAttachmentParameter", "invalid parameter name for renderbuffer attachment");
                 return nullptr;
             }
-            RefPtr<WebGLRenderbuffer> renderBuffer = reinterpret_cast<WebGLRenderbuffer*>(object);
+            RefPtr<WebGLRenderbuffer> renderBuffer = reinterpret_cast<WebGLRenderbuffer*>(object.get());
             GC3Denum renderBufferFormat = renderBuffer->getInternalFormat();
             ASSERT(renderBufferFormat != Extensions3D::SRGB_EXT && renderBufferFormat != Extensions3D::SRGB_ALPHA_EXT);
             if (renderBufferFormat == Extensions3D::SRGB8_ALPHA8_EXT)
@@ -661,7 +661,7 @@ bool WebGLRenderingContext::validateIndexArrayConservative(GC3Denum type, unsign
     // The case count==0 is already dealt with in drawElements before validateIndexArrayConservative.
     if (!numElements)
         return false;
-    const ArrayBuffer* buffer = elementArrayBuffer->elementArrayBuffer();
+    auto buffer = elementArrayBuffer->elementArrayBuffer();
     ASSERT(buffer);
     
     std::optional<unsigned> maxIndex = elementArrayBuffer->getCachedMaxIndex(type);
index cf2b372..e692c27 100644 (file)
@@ -1338,7 +1338,7 @@ void WebGLRenderingContextBase::compressedTexImage2D(GC3Denum target, GC3Dint le
     if (!validateCompressedTexFuncData("compressedTexImage2D", width, height, internalformat, data))
         return;
 
-    RefPtr<WebGLTexture> tex = validateTextureBinding("compressedTexImage2D", target, true);
+    auto tex = validateTextureBinding("compressedTexImage2D", target, true);
     if (!tex)
         return;
     if (!validateNPOTTextureLevel(width, height, level, "compressedTexImage2D"))
@@ -1369,7 +1369,7 @@ void WebGLRenderingContextBase::compressedTexSubImage2D(GC3Denum target, GC3Dint
     if (!validateCompressedTexFuncData("compressedTexSubImage2D", width, height, format, data))
         return;
 
-    RefPtr<WebGLTexture> tex = validateTextureBinding("compressedTexSubImage2D", target, true);
+    auto tex = validateTextureBinding("compressedTexSubImage2D", target, true);
     if (!tex)
         return;
 
@@ -1409,7 +1409,7 @@ void WebGLRenderingContextBase::copyTexSubImage2D(GC3Denum target, GC3Dint level
         return;
     if (!validateTexFuncLevel("copyTexSubImage2D", target, level))
         return;
-    RefPtr<WebGLTexture> tex = validateTextureBinding("copyTexSubImage2D", target, true);
+    auto tex = validateTextureBinding("copyTexSubImage2D", target, true);
     if (!tex)
         return;
     if (!validateSize("copyTexSubImage2D", xoffset, yoffset) || !validateSize("copyTexSubImage2D", width, height))
@@ -2178,7 +2178,7 @@ void WebGLRenderingContextBase::generateMipmap(GC3Denum target)
 {
     if (isContextLostOrPending())
         return;
-    RefPtr<WebGLTexture> tex = validateTextureBinding("generateMipmap", target, false);
+    auto tex = validateTextureBinding("generateMipmap", target, false);
     if (!tex)
         return;
     if (!tex->canGenerateMipmaps()) {
@@ -2504,7 +2504,7 @@ WebGLAny WebGLRenderingContextBase::getTexParameter(GC3Denum target, GC3Denum pn
 {
     if (isContextLostOrPending())
         return nullptr;
-    RefPtr<WebGLTexture> tex = validateTextureBinding("getTexParameter", target, false);
+    auto tex = validateTextureBinding("getTexParameter", target, false);
     if (!tex)
         return nullptr;
     GC3Dint value = 0;
@@ -3385,7 +3385,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.
-    RefPtr<WebGLTexture> tex = validateTextureBinding("texImage2D", target, true);
+    auto 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"));
@@ -3440,7 +3440,7 @@ bool WebGLRenderingContextBase::validateTexFunc(const char* functionName, TexFun
     if (!validateTexFuncParameters(functionName, functionType, target, level, internalFormat, width, height, border, format, type))
         return false;
 
-    RefPtr<WebGLTexture> texture = validateTextureBinding(functionName, target, true);
+    auto texture = validateTextureBinding(functionName, target, true);
     if (!texture)
         return false;
 
@@ -3541,7 +3541,7 @@ void WebGLRenderingContextBase::texSubImage2D(GC3Denum target, GC3Dint level, GC
     if (isContextLostOrPending())
         return;
 
-    RefPtr<WebGLTexture> texture = validateTextureBinding("texSubImage2D", target, true);
+    auto texture = validateTextureBinding("texSubImage2D", target, true);
     if (!texture)
         return;
 
@@ -3586,7 +3586,7 @@ ExceptionOr<void> WebGLRenderingContextBase::texSubImage2D(GC3Denum target, GC3D
         return { };
 
     auto visitor = WTF::makeVisitor([&](const RefPtr<ImageData>& pixels) -> ExceptionOr<void> {
-        RefPtr<WebGLTexture> texture = validateTextureBinding("texSubImage2D", target, true);
+        auto texture = validateTextureBinding("texSubImage2D", target, true);
         if (!texture)
             return { };
 
@@ -3636,7 +3636,7 @@ ExceptionOr<void> WebGLRenderingContextBase::texSubImage2D(GC3Denum target, GC3D
         if (imageForRender->isSVGImage())
             imageForRender = drawImageIntoBuffer(*imageForRender, image->width(), image->height(), 1);
 
-        RefPtr<WebGLTexture> texture = validateTextureBinding("texSubImage2D", target, true);
+        auto texture = validateTextureBinding("texSubImage2D", target, true);
         if (!texture)
             return { };
 
@@ -3660,7 +3660,7 @@ ExceptionOr<void> WebGLRenderingContextBase::texSubImage2D(GC3Denum target, GC3D
         if (!validationResult.returnValue())
             return { };
 
-        RefPtr<WebGLTexture> texture = validateTextureBinding("texSubImage2D", target, true);
+        auto texture = validateTextureBinding("texSubImage2D", target, true);
         if (!texture)
             return { };
 
@@ -3690,7 +3690,7 @@ ExceptionOr<void> WebGLRenderingContextBase::texSubImage2D(GC3Denum target, GC3D
         if (!validationResult.returnValue())
             return { };
 
-        RefPtr<WebGLTexture> texture = validateTextureBinding("texSubImage2D", target, true);
+        auto texture = validateTextureBinding("texSubImage2D", target, true);
         if (!texture)
             return { };
 
@@ -4059,7 +4059,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));
-    RefPtr<WebGLTexture> tex = validateTextureBinding("texSubImage2D", target, true);
+    auto tex = validateTextureBinding("texSubImage2D", target, true);
     if (!tex) {
         ASSERT_NOT_REACHED();
         return;
@@ -4080,7 +4080,7 @@ void WebGLRenderingContextBase::copyTexImage2D(GC3Denum target, GC3Dint level, G
         return;
     if (!validateSettableTexInternalFormat("copyTexImage2D", internalFormat))
         return;
-    RefPtr<WebGLTexture> tex = validateTextureBinding("copyTexImage2D", target, true);
+    auto tex = validateTextureBinding("copyTexImage2D", target, true);
     if (!tex)
         return;
     if (!isTexInternalFormatColorBufferCombinationValid(internalFormat, getBoundFramebufferColorFormat())) {
@@ -4182,7 +4182,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 { };
 
-        RefPtr<WebGLTexture> texture = validateTextureBinding("texImage2D", target, true);
+        auto 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.
         //
@@ -4224,7 +4224,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.
-        RefPtr<WebGLTexture> texture = validateTextureBinding("texImage2D", target, true);
+        auto texture = validateTextureBinding("texImage2D", target, true);
         if (GraphicsContext3D::TEXTURE_2D == target && texture
             && (format == GraphicsContext3D::RGB || format == GraphicsContext3D::RGBA)
             && type == GraphicsContext3D::UNSIGNED_BYTE
@@ -4289,7 +4289,7 @@ void WebGLRenderingContextBase::texParameter(GC3Denum target, GC3Denum pname, GC
 {
     if (isContextLostOrPending())
         return;
-    RefPtr<WebGLTexture> tex = validateTextureBinding("texParameter", target, false);
+    auto tex = validateTextureBinding("texParameter", target, false);
     if (!tex)
         return;
     switch (pname) {
@@ -5006,12 +5006,12 @@ int WebGLRenderingContextBase::getBoundFramebufferHeight()
     return m_context->getInternalFramebufferSize().height();
 }
 
-WebGLTexture* WebGLRenderingContextBase::validateTextureBinding(const char* functionName, GC3Denum target, bool useSixEnumsForCubeMap)
+RefPtr<WebGLTexture> WebGLRenderingContextBase::validateTextureBinding(const char* functionName, GC3Denum target, bool useSixEnumsForCubeMap)
 {
     RefPtr<WebGLTexture> texture;
     switch (target) {
     case GraphicsContext3D::TEXTURE_2D:
-        texture = m_textureUnits[m_activeTextureUnit].texture2DBinding.get();
+        texture = m_textureUnits[m_activeTextureUnit].texture2DBinding;
         break;
     case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_X:
     case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_X:
@@ -5023,14 +5023,14 @@ WebGLTexture* WebGLRenderingContextBase::validateTextureBinding(const char* func
             synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid texture target");
             return nullptr;
         }
-        texture = m_textureUnits[m_activeTextureUnit].textureCubeMapBinding.get();
+        texture = m_textureUnits[m_activeTextureUnit].textureCubeMapBinding;
         break;
     case GraphicsContext3D::TEXTURE_CUBE_MAP:
         if (useSixEnumsForCubeMap) {
             synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid texture target");
             return nullptr;
         }
-        texture = m_textureUnits[m_activeTextureUnit].textureCubeMapBinding.get();
+        texture = m_textureUnits[m_activeTextureUnit].textureCubeMapBinding;
         break;
     default:
         synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid texture target");
@@ -5042,7 +5042,7 @@ WebGLTexture* WebGLRenderingContextBase::validateTextureBinding(const char* func
 
     if (!texture)
         synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "no texture");
-    return texture.get();
+    return texture;
 }
 
 bool WebGLRenderingContextBase::validateLocationLength(const char* functionName, const String& string)
index 9a65604..0e9c621 100644 (file)
@@ -673,7 +673,7 @@ protected:
     // Helper function to check target and texture bound to the target.
     // Generate GL errors and return 0 if target is invalid or texture bound is
     // null.  Otherwise, return the texture bound to the target.
-    WebGLTexture* validateTextureBinding(const char* functionName, GC3Denum target, bool useSixEnumsForCubeMap);
+    RefPtr<WebGLTexture> validateTextureBinding(const char* functionName, GC3Denum target, bool useSixEnumsForCubeMap);
 
     // Helper function to check input format/type for functions {copy}Tex{Sub}Image.
     // Generates GL error and returns false if parameters are invalid.
index 4b9bf2d..1217d9b 100644 (file)
@@ -131,7 +131,7 @@ static inline void executeReparentTask(HTMLConstructionSiteTask& task)
     ASSERT(task.operation == HTMLConstructionSiteTask::Reparent);
     ASSERT(!task.nextChild);
 
-    if (auto* parent = task.child->parentNode())
+    if (auto parent = makeRefPtr(task.child->parentNode()))
         parent->parserRemoveChild(*task.child);
 
     if (task.child->parentNode())
@@ -161,8 +161,8 @@ static inline void executeTakeAllChildrenAndReparentTask(HTMLConstructionSiteTas
     ASSERT(task.operation == HTMLConstructionSiteTask::TakeAllChildrenAndReparent);
     ASSERT(!task.nextChild);
 
-    auto* furthestBlock = task.oldParent();
-    task.parent->takeAllChildrenFrom(furthestBlock);
+    auto furthestBlock = makeRefPtr(task.oldParent());
+    task.parent->takeAllChildrenFrom(furthestBlock.get());
 
     RELEASE_ASSERT(!task.parent->parentNode());
     furthestBlock->parserAppendChild(*task.parent);
@@ -269,7 +269,7 @@ void HTMLConstructionSite::dispatchDocumentElementAvailableIfNeeded()
     if (m_isParsingFragment)
         return;
 
-    if (auto* frame = m_document.frame())
+    if (auto frame = makeRefPtr(m_document.frame()))
         frame->injectUserScripts(InjectAtDocumentStart);
 }
 
@@ -660,12 +660,12 @@ RefPtr<Element> HTMLConstructionSite::createHTMLElementOrFindCustomElementInterf
     bool insideTemplateElement = !ownerDocument.frame();
     RefPtr<Element> element = HTMLElementFactory::createKnownElement(localName, ownerDocument, insideTemplateElement ? nullptr : form(), true);
     if (UNLIKELY(!element)) {
-        auto* window = ownerDocument.domWindow();
+        auto window = makeRefPtr(ownerDocument.domWindow());
         if (customElementInterface && window) {
-            auto* registry = window->customElementRegistry();
+            auto registry = makeRefPtr(window->customElementRegistry());
             if (UNLIKELY(registry)) {
-                if (auto* elementInterface = registry->findInterface(localName)) {
-                    *customElementInterface = elementInterface;
+                if (auto elementInterface = makeRefPtr(registry->findInterface(localName))) {
+                    *customElementInterface = elementInterface.get();
                     return nullptr;
                 }
             }
@@ -764,11 +764,11 @@ void HTMLConstructionSite::findFosterSite(HTMLConstructionSiteTask& task)
 
     if (auto* lastTableElementRecord = m_openElements.topmost(tableTag->localName())) {
         auto& lastTableElement = lastTableElementRecord->element();
-        auto* parent = lastTableElement.parentNode();
+        auto parent = makeRefPtr(lastTableElement.parentNode());
         // When parsing HTML fragments, we skip step 4.2 ("Let root be a new html element with no attributes") for efficiency,
         // and instead use the DocumentFragment as a root node. So we must treat the root node (DocumentFragment) as if it is a html element here.
         bool parentCanBeFosterParent = parent && (parent->isElementNode() || (m_isParsingFragment && parent == &m_openElements.rootNode()));
-        parentCanBeFosterParent = parentCanBeFosterParent || (is<DocumentFragment>(parent) && downcast<DocumentFragment>(parent)->isTemplateContent());
+        parentCanBeFosterParent = parentCanBeFosterParent || (is<DocumentFragment>(parent) && downcast<DocumentFragment>(parent.get())->isTemplateContent());
         if (parentCanBeFosterParent) {
             task.parent = parent;
             task.nextChild = &lastTableElement;
index c3ba9ec..cf38a49 100644 (file)
@@ -215,7 +215,7 @@ private:
             if (match(attributeName, mediaAttr) && m_mediaAttribute.isNull()) {
                 m_mediaAttribute = attributeValue;
                 auto mediaSet = MediaQuerySet::create(attributeValue);
-                auto* documentElement = document.documentElement();
+                auto documentElement = makeRefPtr(document.documentElement());
                 LOG(MediaQueries, "HTMLPreloadScanner %p processAttribute evaluating media queries", this);
                 m_mediaMatched = MediaQueryEvaluator { document.printing() ? "print" : "screen", document, documentElement ? documentElement->computedStyle() : nullptr }.evaluate(mediaSet.get());
             }
index f4abd22..85266a4 100644 (file)
@@ -76,7 +76,7 @@ Ref<FormData> XSSAuditorDelegate::generateViolationReport(const XSSInfo& xssInfo
     auto& frameLoader = m_document.frame()->loader();
     String httpBody;
     if (frameLoader.documentLoader()) {
-        if (auto* formData = frameLoader.documentLoader()->originalRequest().httpBody())
+        if (auto formData = makeRefPtr(frameLoader.documentLoader()->originalRequest().httpBody()))
             httpBody = formData->flattenToString();
     }
 
index 05111d1..e34b9e1 100644 (file)
@@ -178,7 +178,7 @@ Ref<SearchFieldResultsButtonElement> SearchFieldResultsButtonElement::create(Doc
 void SearchFieldResultsButtonElement::defaultEventHandler(Event& event)
 {
     // On mousedown, bring up a menu, if needed
-    auto* input = downcast<HTMLInputElement>(shadowHost());
+    auto input = makeRefPtr(downcast<HTMLInputElement>(shadowHost()));
     if (input && event.type() == eventNames().mousedownEvent && is<MouseEvent>(event) && downcast<MouseEvent>(event).button() == LeftButton) {
         input->focus();
         input->select();
index 017a6a0..58c2baf 100644 (file)
@@ -139,7 +139,7 @@ void InbandGenericTextTrack::addGenericCue(GenericCueData& cueData)
 
 void InbandGenericTextTrack::updateGenericCue(GenericCueData& cueData)
 {
-    auto* cue = m_cueMap.find(cueData);
+    auto cue = makeRefPtr(m_cueMap.find(cueData));
     if (!cue)
         return;
 
@@ -151,7 +151,7 @@ void InbandGenericTextTrack::updateGenericCue(GenericCueData& cueData)
 
 void InbandGenericTextTrack::removeGenericCue(GenericCueData& cueData)
 {
-    auto* cue = m_cueMap.find(cueData);
+    auto cue = makeRefPtr(m_cueMap.find(cueData));
     if (cue) {
         DEBUG_LOG(LOGIDENTIFIER, *cue);
         removeCue(*cue);
index 3378ed8..140c708 100644 (file)
@@ -156,7 +156,7 @@ void InbandTextTrack::languageChanged(const AtomicString& language)
 
 void InbandTextTrack::willRemove()
 {
-    auto* element = mediaElement();
+    auto element = makeRefPtr(mediaElement());
     if (!element)
         return;
     element->removeTextTrack(*this);
index 90e42a4..68fbeaf 100644 (file)
@@ -305,7 +305,7 @@ ExceptionOr<void> TextTrack::addCue(Ref<TextTrackCue>&& cue)
 
     // The addCue(cue) method of TextTrack objects, when invoked, must run the following steps:
 
-    auto* cueTrack = cue->track();
+    auto cueTrack = makeRefPtr(cue->track());
     if (cueTrack == this)
         return { };
 
@@ -379,7 +379,7 @@ void TextTrack::addRegion(RefPtr<VTTRegion>&& region)
 
     // 1. If the given region is in a text track list of regions, then remove
     // region from that text track list of regions.
-    auto* regionTrack = region->track();
+    auto regionTrack = makeRefPtr(region->track());
     if (regionTrack && regionTrack != this)
         regionTrack->removeRegion(region.get());
 
@@ -387,7 +387,7 @@ void TextTrack::addRegion(RefPtr<VTTRegion>&& region)
     // a region with the same identifier as region replace the values of that
     // region's width, height, anchor point, viewport anchor point and scroll
     // attributes with those of region.
-    auto* existingRegion = regionList.getRegionById(region->id());
+    auto existingRegion = makeRefPtr(regionList.getRegionById(region->id()));
     if (existingRegion) {
         existingRegion->updateParametersFromRegion(*region);
         return;
index 55daa80..28413b9 100644 (file)
@@ -163,7 +163,7 @@ void VideoTrack::languageChanged(const AtomicString& language)
 
 void VideoTrack::willRemove()
 {
-    auto* element = mediaElement();
+    auto element = makeRefPtr(mediaElement());
     if (!element)
         return;
     element->removeVideoTrack(*this);
index 86e01a7..4bb1ec0 100644 (file)
@@ -444,19 +444,19 @@ RefPtr<Inspector::Protocol::Recording::InitialState> InspectorCanvas::buildIniti
         attributes->setInteger(ASCIILiteral("direction"), indexForData(convertEnumerationToString(context2d->direction())));
 
         int strokeStyleIndex;
-        if (CanvasGradient* canvasGradient = state.strokeStyle.canvasGradient())
-            strokeStyleIndex = indexForData(canvasGradient);
-        else if (CanvasPattern* canvasPattern = state.strokeStyle.canvasPattern())
-            strokeStyleIndex = indexForData(canvasPattern);
+        if (auto canvasGradient = state.strokeStyle.canvasGradient())
+            strokeStyleIndex = indexForData(canvasGradient.get());
+        else if (auto canvasPattern = state.strokeStyle.canvasPattern())
+            strokeStyleIndex = indexForData(canvasPattern.get());
         else
             strokeStyleIndex = indexForData(state.strokeStyle.color());
         attributes->setInteger(ASCIILiteral("strokeStyle"), strokeStyleIndex);
 
         int fillStyleIndex;
-        if (CanvasGradient* canvasGradient = state.fillStyle.canvasGradient())
-            fillStyleIndex = indexForData(canvasGradient);
-        else if (CanvasPattern* canvasPattern = state.fillStyle.canvasPattern())
-            fillStyleIndex = indexForData(canvasPattern);
+        if (auto canvasGradient = state.fillStyle.canvasGradient())
+            fillStyleIndex = indexForData(canvasGradient.get());
+        else if (auto canvasPattern = state.fillStyle.canvasPattern())
+            fillStyleIndex = indexForData(canvasPattern.get());
         else
             fillStyleIndex = indexForData(state.fillStyle.color());
         attributes->setInteger(ASCIILiteral("fillStyle"), fillStyleIndex);
index 4032755..2373d03 100644 (file)
@@ -281,7 +281,7 @@ public:
     Pattern* strokePattern() const { return m_state.strokePattern.get(); }
 
     void setStrokeGradient(Ref<Gradient>&&);
-    Gradient* strokeGradient() const { return m_state.strokeGradient.get(); }
+    RefPtr<Gradient> strokeGradient() const { return m_state.strokeGradient; }
 
     void setFillRule(WindRule);
     WindRule fillRule() const { return m_state.fillRule; }
@@ -293,7 +293,7 @@ public:
     Pattern* fillPattern() const { return m_state.fillPattern.get(); }
 
     WEBCORE_EXPORT void setFillGradient(Ref<Gradient>&&);
-    Gradient* fillGradient() const { return m_state.fillGradient.get(); }
+    RefPtr<Gradient> fillGradient() const { return m_state.fillGradient; }
 
     void setShadowsIgnoreTransforms(bool);
     bool shadowsIgnoreTransforms() const { return m_state.shadowsIgnoreTransforms; }
index 0586c3a..5e4ee3f 100644 (file)
@@ -64,7 +64,7 @@ FloatRect RenderSVGPath::calculateUpdatedStrokeBoundingBox() const
 
 static void useStrokeStyleToFill(GraphicsContext& context)
 {
-    if (Gradient* gradient = context.strokeGradient())
+    if (auto gradient = context.strokeGradient())
         context.setFillGradient(*gradient);
     else if (Pattern* pattern = context.strokePattern())
         context.setFillPattern(*pattern);