Add ptr() method to Ref class
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Nov 2014 23:00:48 +0000 (23:00 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Nov 2014 23:00:48 +0000 (23:00 +0000)
commit04ced7e465d4d29561b43ca6823b248652a49c93
treebe3583852de6611a06a76c4c4453094c41138625
parentdf797c560f043f0b8d29ba6467382f2d2cbf8a46
Add ptr() method to Ref class
https://bugs.webkit.org/show_bug.cgi?id=138361

Reviewed by Darin Adler.

Source/WebCore:

Use the new Ref::ptr() method.

No new tests, no behavior change.

* accessibility/AccessibilityMenuList.cpp:
(WebCore::AccessibilityMenuList::didUpdateActiveOption):
* bindings/js/JSHTMLAllCollectionCustom.cpp:
(WebCore::getNamedItems):
* bindings/js/JSHTMLFormControlsCollectionCustom.cpp:
(WebCore::getNamedItems):
* css/CSSStyleRule.h:
* css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::insertRule):
* css/CSSValueList.h:
(WebCore::CSSValueList::item):
(WebCore::CSSValueList::itemWithoutBoundsCheck):
* css/InspectorCSSOMWrappers.cpp:
(WebCore::InspectorCSSOMWrappers::collect):
* dom/ChildListMutationScope.cpp:
(WebCore::ChildListMutationAccumulator::~ChildListMutationAccumulator):
(WebCore::ChildListMutationAccumulator::childAdded):
* dom/ChildNodeList.cpp:
(WebCore::ChildNodeList::namedItem):
* dom/ContainerNode.cpp:
(WebCore::ContainerNode::removeChild):
* dom/CurrentScriptIncrementer.h:
(WebCore::CurrentScriptIncrementer::CurrentScriptIncrementer):
(WebCore::CurrentScriptIncrementer::~CurrentScriptIncrementer):
* dom/MutationRecord.cpp:
* dom/NodeRareData.h:
(WebCore::NodeListsNodeData::ensureChildNodeList):
(WebCore::NodeListsNodeData::ensureEmptyChildNodeList):
(WebCore::NodeListsNodeData::addCacheWithQualifiedName):
* dom/Range.cpp:
(WebCore::Range::setDocument):
* dom/ScriptElement.cpp:
(WebCore::ScriptElement::requestScript):
(WebCore::ScriptElement::executeScript):
* dom/StaticNodeList.cpp:
(WebCore::StaticNodeList::item):
(WebCore::StaticElementList::item):
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::moveRemainingSiblingsToNewParent):
* editing/DictationCommand.cpp:
(WebCore::DictationCommand::insertText):
* editing/DictationCommand.h:
* editing/Editor.cpp:
(WebCore::Editor::insertTextWithoutSendingTextEvent):
* editing/ReplaceNodeWithSpanCommand.cpp:
(WebCore::swapInNodePreservingAttributesAndChildren):
* editing/SimplifyMarkupCommand.cpp:
(WebCore::SimplifyMarkupCommand::doApply):
* editing/markup.cpp:
(WebCore::hasOneChild):
(WebCore::hasOneTextChild):
(WebCore::replaceChildrenWithFragment):
(WebCore::replaceChildrenWithText):
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::checkValidity):
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::getNamedElements):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::shouldLoadLink):
* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyleSheet::buildObjectForSelectorList):
(WebCore::InspectorStyleSheet::buildObjectForRule):
(WebCore::InspectorStyleSheet::revalidateStyle):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
* page/FocusController.cpp:
(WebCore::FocusController::setFocusedElement):
* page/PageSerializer.cpp:
(WebCore::PageSerializer::retrieveResourcesForRule):
* page/PageSerializer.h:
* page/animation/AnimationController.cpp:
(WebCore::AnimationController::updateAnimations):
* platform/graphics/ca/TileCoverageMap.cpp:
(WebCore::TileCoverageMap::platformCALayerPaintContents):
* rendering/ClipPathOperation.h:
* rendering/RenderBlock.cpp:
(WebCore::styleForFirstLetter):
(WebCore::RenderBlock::updateFirstLetterStyle):
(WebCore::RenderBlock::createFirstLetterRenderer):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::updateColumnProgressionFromStyle):
* rendering/RenderBlockFlow.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::styleDidChange):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::setStyle):
(WebCore::RenderElement::styleDidChange):
* rendering/RenderNamedFlowFragment.cpp:
(WebCore::RenderNamedFlowFragment::restoreRegionObjectsOriginalStyle):
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::adjustInnerTextStyle):
* rendering/RenderTextControl.h:
* rendering/RenderTextControlMultiLine.cpp:
(WebCore::RenderTextControlMultiLine::createInnerTextStyle):
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::createInnerTextStyle):
* rendering/style/DataRef.h:
(WebCore::DataRef::get):
(WebCore::DataRef::access):
(WebCore::DataRef::operator==):
(WebCore::DataRef::operator!=):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::changeRequiresLayout):
(WebCore::RenderStyle::changeRequiresPositionedLayoutOnly):
(WebCore::RenderStyle::changeRequiresLayerRepaint):
(WebCore::RenderStyle::changeRequiresRepaint):
(WebCore::RenderStyle::changeRequiresRepaintIfTextOrBorderOrOutline):
(WebCore::RenderStyle::changeRequiresRecompositeLayer):
(WebCore::RenderStyle::diff):
(WebCore::RenderStyle::diffRequiresLayerRepaint):
* rendering/style/RenderStyle.h:
* rendering/style/StyleGeneratedImage.cpp:
(WebCore::StyleGeneratedImage::cssValue):
* rendering/style/StyleGeneratedImage.h:
* style/StyleResolveForDocument.cpp:
(WebCore::Style::resolveForDocument):
* style/StyleResolveTree.cpp:
(WebCore::Style::determineChange):
(WebCore::Style::resolveLocal):
(WebCore::Style::resolveTree):
* style/StyleResolveTree.h:

Source/WebKit/mac:

Use the new Ref::ptr() method.

* WebView/WebFrame.mm:
(-[WebFrame _setTypingStyle:withUndoAction:]):
* WebView/WebHTMLView.mm:
(-[WebHTMLView _applyStyleToSelection:withUndoAction:]):
(-[WebHTMLView _changeCSSColorUsingSelector:inRange:]):
* WebView/WebView.mm:
(-[WebView applyStyle:]):

Source/WebKit2:

Use the new Ref::ptr() method.

* UIProcess/WebContext.cpp:
(WebKit::WebContext::createWebPage):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setPreferences):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didNavigateWithNavigationData):
(WebKit::WebProcessProxy::didPerformClientRedirect):
(WebKit::WebProcessProxy::didPerformServerRedirect):
(WebKit::WebProcessProxy::didUpdateHistoryTitle):

Source/WTF:

It is a very common pattern in our code base to get a pointer from a
Ref object. Previously, we have to call Ref.get() and take its address
which is not very nice. This patch adds a ptr() method to Ref class
to simplify the code a bit.

* wtf/PassRef.h:
(WTF::PassRef<T>::ptr):
* wtf/Ref.h:
(WTF::Ref::ptr):
(WTF::GetPtrHelper<Ref<T>>::getPtr):

Tools:

Use the new Ref::ptr() method.

* TestWebKitAPI/Tests/WTF/Ref.cpp:
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175583 268f45cc-cd09-0410-ab3c-d52691b4dbfc
66 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/PassRef.h
Source/WTF/wtf/Ref.h
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityMenuList.cpp
Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp
Source/WebCore/bindings/js/JSHTMLFormControlsCollectionCustom.cpp
Source/WebCore/css/CSSStyleRule.h
Source/WebCore/css/CSSStyleSheet.cpp
Source/WebCore/css/CSSValueList.h
Source/WebCore/css/InspectorCSSOMWrappers.cpp
Source/WebCore/dom/ChildListMutationScope.cpp
Source/WebCore/dom/ChildNodeList.cpp
Source/WebCore/dom/ContainerNode.cpp
Source/WebCore/dom/CurrentScriptIncrementer.h
Source/WebCore/dom/MutationRecord.cpp
Source/WebCore/dom/NodeRareData.h
Source/WebCore/dom/Range.cpp
Source/WebCore/dom/ScriptElement.cpp
Source/WebCore/dom/StaticNodeList.cpp
Source/WebCore/editing/CompositeEditCommand.cpp
Source/WebCore/editing/DictationCommand.cpp
Source/WebCore/editing/DictationCommand.h
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/ReplaceNodeWithSpanCommand.cpp
Source/WebCore/editing/SimplifyMarkupCommand.cpp
Source/WebCore/editing/markup.cpp
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/HTMLFormElement.cpp
Source/WebCore/html/HTMLLinkElement.cpp
Source/WebCore/inspector/InspectorStyleSheet.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/page/FocusController.cpp
Source/WebCore/page/PageSerializer.cpp
Source/WebCore/page/PageSerializer.h
Source/WebCore/page/animation/AnimationController.cpp
Source/WebCore/platform/graphics/ca/TileCoverageMap.cpp
Source/WebCore/rendering/ClipPathOperation.h
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlockFlow.cpp
Source/WebCore/rendering/RenderBlockFlow.h
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderNamedFlowFragment.cpp
Source/WebCore/rendering/RenderTextControl.cpp
Source/WebCore/rendering/RenderTextControl.h
Source/WebCore/rendering/RenderTextControlMultiLine.cpp
Source/WebCore/rendering/RenderTextControlSingleLine.cpp
Source/WebCore/rendering/style/DataRef.h
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/StyleGeneratedImage.cpp
Source/WebCore/rendering/style/StyleGeneratedImage.h
Source/WebCore/style/StyleResolveForDocument.cpp
Source/WebCore/style/StyleResolveTree.cpp
Source/WebCore/style/StyleResolveTree.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebFrame.mm
Source/WebKit/mac/WebView/WebHTMLView.mm
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebContext.cpp
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebProcessProxy.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/Ref.cpp