Remove PassRefPtr from "page" directory of WebCore, also deploy references
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Jan 2017 06:24:18 +0000 (06:24 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Jan 2017 06:24:18 +0000 (06:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=167224

Reviewed by Chris Dumez.

Source/WebCore:

* Modules/fetch/DOMWindowFetch.cpp:
(WebCore::DOMWindowFetch::fetch): Use DOMWindow::document instead of
scriptExecutionContext.

* Modules/webdatabase/DatabaseContext.cpp:
(WebCore::DatabaseContext::databaseExceededQuota): Pass a reference.

* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityShowContextMenu]):
Pass a reference.

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::getOwnPropertySlot): Pass a reference.

* dom/Document.cpp:
(WebCore::Document::childrenChanged): Pass a reference. Also made the
didReceiveDocType code unconditional instead of iOS-only.
(WebCore::Document::platformSuspendOrStopActiveDOMObjects): Ditto.
(WebCore::Document::updateViewportArguments): Ditto.
(WebCore::Document::setFocusedElement): Ditto.
(WebCore::Document::createDOMWindow): Ditto.
(WebCore::Document::takeDOMWindowFrom): Ditto.
(WebCore::Document::requestFullScreenForElement): Ditto.
(WebCore::Document::webkitExitFullscreen): Ditto.
* dom/Element.cpp:
(WebCore::Element::focus): Ditto.
(WebCore::Element::blur): Ditto.
(WebCore::Element::dispatchFocusEvent): Ditto.
(WebCore::Element::dispatchBlurEvent): Ditto.
* dom/Node.cpp:
(WebCore::Node::defaultEventHandler): Ditto.
* editing/EditorCommand.cpp:
(WebCore::executePrint): Ditto.
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::setFocusedElementIfNeeded): Ditto.
* history/CachedFrame.cpp:
(WebCore::CachedFrameBase::restore): Ditto.
(WebCore::CachedFrame::CachedFrame): Ditto.
* html/ColorInputType.cpp:
(WebCore::ColorInputType::handleDOMActivateEvent): Ditto.
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::isKeyboardFocusable): Ditto.

* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::isKeyboardFocusable): Pass a reference,
and also rewrote to use && for clarity.

* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::supportsFullscreen): Pass a reference.
* html/shadow/SpinButtonElement.cpp:
(WebCore::SpinButtonElement::defaultEventHandler): Ditto.
(WebCore::SpinButtonElement::releaseCapture): Ditto.
* html/shadow/mac/ImageControlsButtonElementMac.cpp:
(WebCore::ImageControlsButtonElementMac::defaultEventHandler): Ditto.
* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::showContextMenu): Ditto.
(WebCore::InspectorFrontendHost::dispatchEventAsContextMenuEvent): Ditto.

* loader/EmptyClients.cpp:
(WebCore::EmptyChromeClient::createPopupMenu): Updated to take reference.
(WebCore::EmptyChromeClient::createSearchPopupMenu): Ditto.
(WebCore::EmptyChromeClient::createColorChooser): Ditto.
* loader/EmptyClients.h: Ditto.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::submitForm): Pass a reference.
(WebCore::FrameLoader::commitProvisionalLoad): Ditto.
(WebCore::FrameLoader::closeAndRemoveChild): Take a reference.
(WebCore::FrameLoader::detachFromParent): Pass a reference.
(WebCore::FrameLoader::dispatchBeforeUnloadEvent): Ditto.
(WebCore::createWindow): Ditto.
* loader/FrameLoader.h: Updated for the above.

* loader/PolicyChecker.cpp:
(WebCore::PolicyChecker::checkNewWindowPolicy): Pass a reference.
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::recalculateAvailableSpaceInQuota): Ditto.

* loader/appcache/ApplicationCacheGroup.h: Return a reference from origin.

* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::calculateQuotaForOrigin): Take a reference.
(WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache):
Ditto.
(WebCore::ApplicationCacheStorage::store): Pass a reference.
(WebCore::ApplicationCacheStorage::checkOriginQuota): Updated since origin
now returns areference.
* loader/appcache/ApplicationCacheStorage.h: Updated for the above.

* loader/archive/mhtml/MHTMLArchive.cpp:
(WebCore::MHTMLArchive::generateMHTMLData): Pass a reference.
* mathml/MathMLElement.cpp:
(WebCore::MathMLElement::isKeyboardFocusable): Ditto.

* page/Chrome.cpp:
(WebCore::Chrome::Chrome): Moved initialization of data members to the
class definition.
(WebCore::Chrome::contentsSizeChanged): Take a reference.
(WebCore::Chrome::createWindow): Ditto.
(WebCore::Chrome::runBeforeUnloadConfirmPanel): Ditto.
(WebCore::Chrome::runJavaScriptAlert): Ditto.
(WebCore::Chrome::runJavaScriptConfirm): Ditto.
(WebCore::Chrome::runJavaScriptPrompt): Ditto.
(WebCore::Chrome::setStatusbarText): Ditto.
(WebCore::Chrome::print): Ditto.
(WebCore::Chrome::createColorChooser): Ditto.
(WebCore::Chrome::createPopupMenu): Ditto.
(WebCore::Chrome::createSearchPopupMenu): Ditto.
(WebCore::Chrome::didReceiveDocType): Ditto. Also made unconditional, but
empty for non-iOS platforms.
(WebCore::Chrome::registerPopupOpeningObserver): Take a reference.
(WebCore::Chrome::unregisterPopupOpeningObserver): Ditto.
* page/Chrome.h: Updated for the above.

* page/ChromeClient.h: Take references. Also updated some arguments from
Node to Element.

* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::handleContextMenuEvent): Take a reference.
(WebCore::ContextMenuController::showContextMenu): Ditto.
(WebCore::ContextMenuController::maybeCreateContextMenu): Ditto. Also use
make_unique instead of unique_ptr plus new.
(WebCore::openNewWindow): Ditto.
(WebCore::insertUnicodeCharacter): Ditto.
(WebCore::ContextMenuController::contextMenuItemSelected): Ditto.
(WebCore::ContextMenuController::showContextMenuAt): Ditto.
(WebCore::ContextMenuController::showImageControlsMenu): Ditto.
* page/ContextMenuController.h: Updated for the above.

* page/DOMTimer.cpp:
(WebCore::DOMTimer::fired): Pass a reference.

* page/DOMWindow.cpp:
(WebCore::PostMessageTimer::PostMessageTimer): Take Ref&& instead of
PassRefPtr.
(WebCore::DOMWindow::adjustWindowRect): Use a reference.
(WebCore::DOMWindow::allowPopUp): Ditto. Also rewrite to use || instead
of successive if statements.
(WebCore::DOMWindow::canShowModalDialog): Ditto.
(WebCore::DOMWindow::DOMWindow): Ditto.
(WebCore::DOMWindow::didSecureTransitionTo): Ditto.
(WebCore::DOMWindow::registerProperty): Ditto.
(WebCore::DOMWindow::unregisterProperty): Ditto.
(WebCore::DOMWindow::postMessageTimerFired): Merge with the function
immediately followed, called only from here.
(WebCore::DOMWindow::dispatchMessageEventWithOriginCheck): Deleted.
(WebCore::DOMWindow::print): Pass a reference.
(WebCore::DOMWindow::alert): Ditto.
(WebCore::DOMWindow::confirm): Ditto.
(WebCore::DOMWindow::prompt): Ditto.
(WebCore::DOMWindow::setStatus): Ditto.
(WebCore::DOMWindow::setDefaultStatus): Ditto.
(WebCore::DOMWindow::moveBy): Ditto.
(WebCore::DOMWindow::moveTo): Ditto.
(WebCore::DOMWindow::resizeBy): Ditto.
(WebCore::DOMWindow::resizeTo): Ditto.
(WebCore::DOMWindow::clearTimeout): Ditto.
(WebCore::DOMWindow::incrementScrollEventListenersCount): Ditto.
(WebCore::DOMWindow::decrementScrollEventListenersCount): Ditto.
(WebCore::DOMWindow::showModalDialog): Ditto.
* page/DOMWindow.h: Updated for the above. ALso made functions private
and final.

* page/DOMWindowProperty.cpp:
(WebCore::DOMWindowProperty::DOMWindowProperty): Pass a reference.
(WebCore::DOMWindowProperty::~DOMWindowProperty): Ditto.
(WebCore::DOMWindowProperty::willDestroyGlobalObjectInCachedFrame): Ditto.
(WebCore::DOMWindowProperty::willDestroyGlobalObjectInFrame): Ditto.

* page/DebugPageOverlays.cpp:
(WebCore::RegionOverlay::create): Return RefPtr instead of PassRefPtr.
(WebCore::RegionOverlay::~RegionOverlay): Pass a reference.
(WebCore::DebugPageOverlays::showRegionOverlay): Ditto.
(WebCore::DebugPageOverlays::hideRegionOverlay): Ditto.

* page/DragController.cpp:
(WebCore::DragController::dragExited): Pass a reference.
(WebCore::DragController::performDragOperation): Ditto.
(WebCore::DragController::concludeEditDrag): Ditto.
(WebCore::DragController::tryDHTMLDrag): Ditto.

* page/EventHandler.cpp: Replaced OptionalCursor with std::optional<Cursor>.
(WebCore::EventHandler::updateCursor): Refactor into two functions so we
can share more code with selectCursor.
(WebCore::EventHandler::selectCursor): Updated to use std::optional.
(WebCore::EventHandler::handleMouseMoveEvent): Use the new updateCursor.
(WebCore::EventHandler::startPanScrolling): Use a reference.
(WebCore::EventHandler::updateDragAndDrop): Ditto.
(WebCore::EventHandler::cancelDragAndDrop): Ditto.
(WebCore::EventHandler::performDragAndDrop): Ditto.
(WebCore::EventHandler::setCapturingMouseEventsElement): Take a raw pointer
instead of a PassRefPtr.
(WebCore::EventHandler::dispatchMouseEvent): Use a reference.
(WebCore::EventHandler::updateDragStateAfterEditDragIfNeeded): Ditto.
(WebCore::EventHandler::isKeyboardOptionTab): Ditto.
(WebCore::EventHandler::eventInvertsTabsToLinksClientCallResult): Ditto.
(WebCore::EventHandler::tabsToLinks): Ditto.
* page/EventHandler.h: Updated for the above.

* page/FocusController.cpp:
(WebCore::FocusController::setFocusedFrame): Take pointer instead
of PassRefPtr.
(WebCore::FocusController::setFocusedElement): Take reference instead of
PassRefPtr.
* page/FocusController.h: Updated for the above changes.

* page/FrameTree.cpp:
(WebCore::FrameTree::transferChild): Deleted. Unused function.
(WebCore::FrameTree::appendChild): Merged with the following function
since it's now only used here. Take reference instead of PassRefPtr.
(WebCore::FrameTree::actuallyAppendChild): Deleted.
(WebCore::FrameTree::removeChild): Take reference instead of pointer.
Use move instead of trickier swap.
* page/FrameTree.h: Updated for the above.

* page/FrameView.cpp:
(WebCore::FrameView::setContentsSize): Use a reference.
* page/MainFrame.cpp:
(WebCore::MainFrame::dropChildren): Ditto.
* page/Page.cpp:
(WebCore::Page::scrollingCoordinator): Ditto.
* page/PageOverlay.cpp:
(WebCore::PageOverlay::fadeAnimationTimerFired): Ditto.

* page/PageOverlayController.cpp:
(WebCore::PageOverlayController::installPageOverlay): Take reference
instead of PassRefPtr.
(WebCore::PageOverlayController::uninstallPageOverlay): Take reference
intead of pointer.
* page/PageOverlayController.h: Updated for the above.

* page/PageSerializer.cpp:
(WebCore::PageSerializer::PageSerializer): Moved most initialization to the
class definition.
(WebCore::PageSerializer::serialize): Use reference.
(WebCore::PageSerializer::serializeFrame): Use initializer list instead of
constructor for resource.
(WebCore::PageSerializer::serializeCSSStyleSheet): Ditto.
(WebCore::PageSerializer::addImageToResources): Ditto.
* page/PageSerializer.h: Removed constructors from PageSerializer::Resource
struct since structures don't really need them. Updated for the above.
Changed SerializerMarkupAccumulator into a nested class.

* page/PerformanceEntry.h:
(WebCore::PerformanceEntry::startTimeCompareLessThan): Use const RefPtr&
instead of PassRefPtr to compare RefPtr in place.

* page/PerformanceUserTiming.cpp:
(WebCore::insertPerformanceEntry): Take Ref&& instead of PassRefPtr.

* page/ResourceUsageOverlay.cpp:
(WebCore::ResourceUsageOverlay::~ResourceUsageOverlay): Use refrence.
(WebCore::ResourceUsageOverlay::initialize): Ditto.

* page/animation/AnimationBase.h: Removed unneeded include.

* page/animation/AnimationController.cpp:
(WebCore::AnimationControllerPrivate::clear): Use reference.
(WebCore::AnimationControllerPrivate::fireEventsAndUpdateStyle): Ditto.
(WebCore::AnimationControllerPrivate::addEventToDispatch): Use the
append function instead of a hand-written alternative.
(WebCore::AnimationControllerPrivate::addElementChangeToDispatch):
Take a reference rather than a Ref&& since no caller is passing ownership.
* page/animation/AnimationControllerPrivate.h: Updated for the above.

* page/animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc): Return RefPtr instead of PassRefPtr.
(WebCore::blendFilter): Ditto.
(WebCore::crossfadeBlend): Ditto.

* page/animation/CompositeAnimation.cpp:
(WebCore::CompositeAnimation::updateTransitions): Updated to use
animationForProperty, which returns a raw pointer.
(WebCore::CompositeAnimation::animationForProperty): Renamed from
getAnimationForProperty and changed to return raw pointer instead
of PassRefPtr.
* page/animation/CompositeAnimation.h: Updated for the above.

* page/animation/ImplicitAnimation.cpp:
(WebCore::ImplicitAnimation::onAnimationEnd): Use animationForProperty.
(WebCore::ImplicitAnimation::sendTransitionEvent): Pass reference.
* page/animation/KeyframeAnimation.cpp:
(WebCore::KeyframeAnimation::sendAnimationEvent): Ditto.

* page/efl/EventHandlerEfl.cpp:
(WebCore::EventHandler::tabsToAllFormControls): Take reference.
(WebCore::EventHandler::createDraggingDataTransfer): Return Ref.
* page/gtk/EventHandlerGtk.cpp:
(WebCore::EventHandler::tabsToAllFormControls): Ditto.
(WebCore::EventHandler::createDraggingDataTransfer): Ditto.
* page/ios/EventHandlerIOS.mm:
(WebCore::EventHandler::tabsToAllFormControls): Ditto.
* page/mac/EventHandlerMac.mm:
(WebCore::EventHandler::createDraggingDataTransfer): Ditto.
(WebCore::EventHandler::tabsToAllFormControls): Ditto.
(WebCore::EventHandler::platformPrepareForWheelEvents): Ditto.

* page/mac/ServicesOverlayController.h: Take Ref&& for ranges instead
of PassRefPtr. Use references.
* page/mac/ServicesOverlayController.mm:
(WebCore::ServicesOverlayController::Highlight::createForSelection): Ditto.
(WebCore::ServicesOverlayController::Highlight::createForTelephoneNumber): Ditto.
(WebCore::ServicesOverlayController::Highlight::Highlight): Ditto.
(WebCore::ServicesOverlayController::buildPotentialHighlightsIfNeeded): Ditto.
(WebCore::ServicesOverlayController::buildPhoneNumberHighlights): Ditto.
(WebCore::ServicesOverlayController::buildSelectionHighlight): Ditto.
(WebCore::ServicesOverlayController::highlightsAreEquivalent): Ditto.
(WebCore::ServicesOverlayController::findTelephoneNumberHighlightContainingSelectionHighlight): Ditto.
(WebCore::ServicesOverlayController::handleClick): Ditto.

* page/mac/TextIndicatorWindow.mm:
(-[WebTextIndicatorView initWithFrame:textIndicator:margin:offset:]):
Take a reference instead of PassRefPtr.
(WebCore::TextIndicatorWindow::setTextIndicator): Updated for the above.

* page/scrolling/AsyncScrollingCoordinator.h: Use Ref&& and RefPtr intead
of PsasRefPtr.

* page/scrolling/ScrollLatchingState.cpp:
(WebCore::ScrollLatchingState::ScrollLatchingState): Initialize data members
in class definition.
(WebCore::ScrollLatchingState::setWheelEventElement): Use raw pointer instead
of PassRefPtr.
(WebCore::ScrollLatchingState::setPreviousWheelScrolledElement): Use raw
pointer instead of RefPtr&&.
(WebCore::ScrollLatchingState::setScrollableContainer): Use raw pointer instead
of PassRefPtr.
* page/scrolling/ScrollLatchingState.h: Updated for the above.

* page/scrolling/ScrollingStateNode.cpp:
(WebCore::ScrollingStateNode::cloneAndReset): Use Ref instead of PassRefPtr.
(WebCore::ScrollingStateNode::appendChild): Use Ref&& instead of PassRefPtr.
* page/scrolling/ScrollingStateNode.h: Updated for the above.

* page/scrolling/ScrollingStateTree.cpp:
(WebCore::ScrollingStateTree::createNode): Use Ref instead of PassRefPtr.
(WebCore::ScrollingStateTree::attachNode): Updated for the abve.
(WebCore::ScrollingStateTree::commit): Ditto.
* page/scrolling/ScrollingStateTree.h: Ditto.

* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::updateTreeFromStateNode): Use reference.
* page/scrolling/ScrollingTree.h: Return Ref instead of PassRefPtr.

* page/scrolling/ScrollingTreeNode.cpp:
(WebCore::ScrollingTreeNode::appendChild): Take Ref&& instead of PassRefPtr.
(WebCore::ScrollingTreeNode::removeChild): Take reference instead of pointer.
* page/scrolling/ScrollingTreeNode.h: Updated for the above.

* page/scrolling/ThreadedScrollingTree.cpp:
(WebCore::ThreadedScrollingTree::ThreadedScrollingTree): Take reference
instead of pointer.
* page/scrolling/ThreadedScrollingTree.h: Updated for the above.

* page/scrolling/ios/ScrollingCoordinatorIOS.mm:
(WebCore::ScrollingCoordinatorIOS::ScrollingCoordinatorIOS): Pass reference.

* page/scrolling/ios/ScrollingTreeIOS.cpp:
(WebCore::ScrollingTreeIOS::create): Take a reference.
(WebCore::ScrollingTreeIOS::ScrollingTreeIOS): Ditto.
(WebCore::ScrollingTreeIOS::createScrollingTreeNode): Return Ref instead of
PassRefPtr.
* page/scrolling/ios/ScrollingTreeIOS.h: Updated for the above.

* page/scrolling/mac/ScrollingCoordinatorMac.mm:
(WebCore::ScrollingCoordinatorMac::ScrollingCoordinatorMac): Use reference.

* page/scrolling/mac/ScrollingTreeMac.cpp:
(ScrollingTreeMac::create): Take a reference.
(ScrollingTreeMac::ScrollingTreeMac): Ditto.
(ScrollingTreeMac::createScrollingTreeNode): Return a Ref instead of a
PassRefPtr.
* page/scrolling/mac/ScrollingTreeMac.h: Updated for the above.

* page/win/EventHandlerWin.cpp:
(WebCore::EventHandler::tabsToAllFormControls): Take reference.
(WebCore::EventHandler::createDraggingDataTransfer): Return Ref.

* platform/Cursor.h: Rearranged the header a bit. Got rid of the explicit
copy constructor, assignment operator, and destructor. Using the ones
that the compiler automatically generates will work for all platforms and
we then also get move constructor and move assignment operator.

* platform/efl/CursorEfl.cpp:
(WebCore::Cursor::Cursor): Deleted.
(WebCore::Cursor::~Cursor): Deleted.
(WebCore::Cursor::operator=): Deleted.
* platform/gtk/CursorGtk.cpp:
(WebCore::Cursor::Cursor): Deleted.
(WebCore::Cursor::operator=): Deleted.
(WebCore::Cursor::~Cursor): Deleted.
* platform/mac/CursorMac.mm:
(WebCore::Cursor::Cursor): Deleted.
(WebCore::Cursor::operator=): Deleted.
(WebCore::Cursor::~Cursor): Deleted.
* platform/win/CursorWin.cpp:
(WebCore::SharedCursor::SharedCursor): Moved this here from the header
since it is only used within this file.
(WebCore::SharedCursor::create): Ditto.
(WebCore::Cursor::Cursor): Deleted.
(WebCore::Cursor::operator=): Deleted.
(WebCore::Cursor::~Cursor): Deleted.

* rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::handleUnavailablePluginIndicatorEvent):
Pass reference.

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::RenderLayerBacking): Get to FrameView
through the render tree itself, rather than through the frame.

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateLayerForHeader): Use reference.
(WebCore::RenderLayerCompositor::updateLayerForFooter): Ditto.
(WebCore::RenderLayerCompositor::attachRootLayer): Ditto.
(WebCore::RenderLayerCompositor::detachRootLayer): Ditto.
* rendering/RenderMenuList.cpp:
(RenderMenuList::showPopup): Ditto.
* rendering/RenderSearchField.cpp:
(WebCore::RenderSearchField::addSearchResult): Ditto.
(WebCore::RenderSearchField::showPopup): Ditto.
(WebCore::RenderSearchField::valueChanged): Ditto.
* svg/SVGAElement.cpp:
(WebCore::SVGAElement::isKeyboardFocusable): Ditto.
* testing/MockPageOverlayClient.cpp:
(WebCore::MockPageOverlayClient::installOverlay): Ditto.
(WebCore::MockPageOverlayClient::uninstallAllOverlays): Ditto.

Source/WebKit/ios:

* WebCoreSupport/WebChromeClientIOS.h: Update for changes to ChromeClient.
* WebCoreSupport/WebChromeClientIOS.mm:
(WebChromeClientIOS::runJavaScriptAlert): Ditto.
(WebChromeClientIOS::runJavaScriptConfirm): Ditto.
(WebChromeClientIOS::runJavaScriptPrompt): Ditto.
(WebChromeClientIOS::setNeedsScrollNotifications): Ditto.
(WebChromeClientIOS::observedContentChange): Ditto.
(WebChromeClientIOS::clearContentChangeObservers): Ditto.
(WebChromeClientIOS::notifyRevealedSelectionByScrollingFrame): Ditto.
(WebChromeClientIOS::elementDidFocus): Ditto.
(WebChromeClientIOS::elementDidBlur): Ditto.
(WebChromeClientIOS::createPopupMenu): Ditto.
(WebChromeClientIOS::createSearchPopupMenu): Ditto.
(WebChromeClientIOS::attachRootGraphicsLayer): Ditto.

Source/WebKit/mac:

* WebCoreSupport/WebApplicationCacheQuotaManager.mm:
(-[WebApplicationCacheQuotaManager quota]): Pass reference.

* WebCoreSupport/WebChromeClient.h: Updated for changes to ChromeClient.
* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::focusedElementChanged): Ditto.
(WebChromeClient::createWindow): Ditto.
(WebChromeClient::runBeforeUnloadConfirmPanel): Ditto.
(WebChromeClient::runJavaScriptAlert): Ditto.
(WebChromeClient::runJavaScriptConfirm): Ditto.
(WebChromeClient::runJavaScriptPrompt): Ditto.
(WebChromeClient::contentsSizeChanged): Ditto.
(WebChromeClient::unavailablePluginButtonClicked): Ditto.
(WebChromeClient::print): Ditto.
(WebChromeClient::exceededDatabaseQuota): Ditto.
(WebChromeClient::reachedApplicationCacheOriginQuota): Ditto.
(WebChromeClient::createColorChooser): Ditto.
(WebChromeClient::elementDidFocus): Ditto.
(WebChromeClient::elementDidBlur): Ditto.
(WebChromeClient::createPopupMenu): Ditto.
(WebChromeClient::createSearchPopupMenu): Ditto.
(WebChromeClient::attachRootGraphicsLayer): Ditto.
(WebChromeClient::attachViewOverlayGraphicsLayer): Ditto.
(WebChromeClient::supportsFullScreenForElement): Ditto.
(WebChromeClient::enterFullScreenForElement): Ditto.
(WebChromeClient::exitFullScreenForElement): Ditto.

* WebView/WebFrame.mm:
(+[WebFrame _createFrameWithPage:frameName:frameView:ownerElement:]):
Updated for change to the appendChild function.

Source/WebKit/win:

* Plugins/PluginView.cpp:
(WebCore::PluginView::status): Pass reference.
(WebCore::PluginView::focusPluginElement): Ditto.

* WebCoreSupport/WebChromeClient.cpp:
(WebChromeClient::createWindow): Updated for change to ChromeClient.
(WebChromeClient::runBeforeUnloadConfirmPanel): Ditto.
(WebChromeClient::runJavaScriptAlert): Ditto.
(WebChromeClient::runJavaScriptConfirm): Ditto.
(WebChromeClient::runJavaScriptPrompt): Ditto.
(WebChromeClient::contentsSizeChanged): Ditto.
(WebChromeClient::unavailablePluginButtonClicked): Ditto.
(WebChromeClient::print): Ditto.
(WebChromeClient::exceededDatabaseQuota): Ditto.
(WebChromeClient::reachedApplicationCacheOriginQuota): Ditto.
(WebChromeClient::attachRootGraphicsLayer): Ditto.
(WebChromeClient::attachViewOverlayGraphicsLayer): Ditto.
(WebChromeClient::enterVideoFullscreenForVideoElement): Ditto.
(WebChromeClient::createPopupMenu): Ditto.
(WebChromeClient::createSearchPopupMenu): Ditto.
(WebChromeClient::supportsFullScreenForElement): Ditto.
(WebChromeClient::enterFullScreenForElement): Ditto.
(WebChromeClient::exitFullScreenForElement): Ditto.
(WebChromeClient::shouldUseTiledBackingForFrameView): Ditto.
* WebCoreSupport/WebChromeClient.h: Ditto.

Source/WebKit2:

* UIProcess/Scrolling/RemoteScrollingTree.cpp:
(WebKit::RemoteScrollingTree::createScrollingTreeNode): Return a Ref
instead of PassRefPtr.
* UIProcess/Scrolling/RemoteScrollingTree.h: Updated for the above.

* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageInstallPageOverlay): Pass a reference.
(WKBundlePageUninstallPageOverlay): Ditto.
(WKBundlePageInstallPageOverlayWithAnimation): Ditto.
(WKBundlePageUninstallPageOverlayWithAnimation): Ditto.
* WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
(WebKit::PDFPlugin::jsPDFDocPrint): Ditto.
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::focusPluginElement): Ditto.
(WebKit::PluginView::setStatusbarText): Ditto.

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::elementDidFocus): Updated for changes to ChromeClient.
(WebKit::WebChromeClient::elementDidBlur): Ditto.
(WebKit::WebChromeClient::makeFirstResponder): Ditto.
(WebKit::WebChromeClient::createWindow): Ditto.
(WebKit::WebChromeClient::runBeforeUnloadConfirmPanel): Ditto.
(WebKit::WebChromeClient::runJavaScriptAlert): Ditto.
(WebKit::WebChromeClient::runJavaScriptConfirm): Ditto.
(WebKit::WebChromeClient::runJavaScriptPrompt): Ditto.
(WebKit::WebChromeClient::contentsSizeChanged): Ditto.
(WebKit::WebChromeClient::unavailablePluginButtonClicked): Ditto.
(WebKit::WebChromeClient::print): Ditto.
(WebKit::WebChromeClient::exceededDatabaseQuota): Ditto.
(WebKit::WebChromeClient::reachedApplicationCacheOriginQuota): Ditto.
(WebKit::WebChromeClient::createColorChooser): Ditto.
(WebKit::WebChromeClient::createPopupMenu): Ditto.
(WebKit::WebChromeClient::createSearchPopupMenu): Ditto.
(WebKit::WebChromeClient::attachRootGraphicsLayer): Ditto.
(WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): Ditto.
(WebKit::WebChromeClient::createScrollingCoordinator): Ditto.
(WebKit::WebChromeClient::supportsFullScreenForElement): Ditto.
(WebKit::WebChromeClient::enterFullScreenForElement): Ditto.
(WebKit::WebChromeClient::exitFullScreenForElement): Ditto.
(WebKit::WebChromeClient::didAddHeaderLayer): Ditto.
(WebKit::WebChromeClient::didAddFooterLayer): Ditto.
(WebKit::WebChromeClient::shouldUseTiledBackingForFrameView): Ditto.
* WebProcess/WebCoreSupport/WebChromeClient.h: Ditto.
* WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
(WebKit::WebChromeClient::elementDidRefocus): Ditto.
(WebKit::WebChromeClient::didReceiveMobileDocType): Ditto.
(WebKit::WebChromeClient::observedContentChange): Ditto.
(WebKit::WebChromeClient::clearContentChangeObservers): Ditto.
(WebKit::WebChromeClient::notifyRevealedSelectionByScrollingFrame): Ditto.

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchCreatePage): Pass reference.
* WebProcess/WebCoreSupport/WebInspectorClient.cpp:
(WebKit::WebInspectorClient::~WebInspectorClient): Ditto.
(WebKit::WebInspectorClient::hideHighlight): Ditto.
(WebKit::WebInspectorClient::showPaintRect): Ditto.
* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::updateFindUIAfterPageScroll): Ditto.
(WebKit::FindController::hideFindUI): Ditto.

* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::createWithCoreMainFrame): Return Ref instead of
PassRefPtr.
(WebKit::WebFrame::createSubframe): Ditto.
(WebKit::WebFrame::create): Ditto.
* WebProcess/WebPage/WebFrame.h: Updated for the above.

* WebProcess/WebPage/WebInspector.cpp:
(WebKit::WebInspector::openInNewTab): Pass reference.

* WebProcess/WebPage/ios/FindControllerIOS.mm:
(WebKit::FindController::updateFindIndicator): Use reference.
(WebKit::FindController::hideFindIndicator): Ditto.

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

135 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/fetch/DOMWindowFetch.cpp
Source/WebCore/Modules/webdatabase/DatabaseContext.cpp
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Node.cpp
Source/WebCore/editing/EditorCommand.cpp
Source/WebCore/editing/FrameSelection.cpp
Source/WebCore/history/CachedFrame.cpp
Source/WebCore/html/ColorInputType.cpp
Source/WebCore/html/HTMLAnchorElement.cpp
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/HTMLVideoElement.cpp
Source/WebCore/html/shadow/SpinButtonElement.cpp
Source/WebCore/html/shadow/mac/ImageControlsButtonElementMac.cpp
Source/WebCore/inspector/InspectorFrontendHost.cpp
Source/WebCore/loader/EmptyClients.cpp
Source/WebCore/loader/EmptyClients.h
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/FrameLoader.h
Source/WebCore/loader/PolicyChecker.cpp
Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp
Source/WebCore/loader/appcache/ApplicationCacheGroup.h
Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp
Source/WebCore/loader/appcache/ApplicationCacheStorage.h
Source/WebCore/loader/archive/mhtml/MHTMLArchive.cpp
Source/WebCore/mathml/MathMLElement.cpp
Source/WebCore/page/Chrome.cpp
Source/WebCore/page/Chrome.h
Source/WebCore/page/ChromeClient.h
Source/WebCore/page/ContextMenuController.cpp
Source/WebCore/page/ContextMenuController.h
Source/WebCore/page/DOMTimer.cpp
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/DOMWindow.h
Source/WebCore/page/DOMWindowProperty.cpp
Source/WebCore/page/DebugPageOverlays.cpp
Source/WebCore/page/DragController.cpp
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/EventHandler.h
Source/WebCore/page/FocusController.cpp
Source/WebCore/page/FocusController.h
Source/WebCore/page/Frame.cpp
Source/WebCore/page/FrameTree.cpp
Source/WebCore/page/FrameTree.h
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/MainFrame.cpp
Source/WebCore/page/Page.cpp
Source/WebCore/page/PageOverlay.cpp
Source/WebCore/page/PageOverlayController.cpp
Source/WebCore/page/PageOverlayController.h
Source/WebCore/page/PageSerializer.cpp
Source/WebCore/page/PageSerializer.h
Source/WebCore/page/PerformanceEntry.h
Source/WebCore/page/PerformanceUserTiming.cpp
Source/WebCore/page/ResourceUsageOverlay.cpp
Source/WebCore/page/animation/AnimationBase.h
Source/WebCore/page/animation/AnimationController.cpp
Source/WebCore/page/animation/AnimationControllerPrivate.h
Source/WebCore/page/animation/CSSPropertyAnimation.cpp
Source/WebCore/page/animation/CompositeAnimation.cpp
Source/WebCore/page/animation/CompositeAnimation.h
Source/WebCore/page/animation/ImplicitAnimation.cpp
Source/WebCore/page/animation/KeyframeAnimation.cpp
Source/WebCore/page/efl/EventHandlerEfl.cpp
Source/WebCore/page/gtk/EventHandlerGtk.cpp
Source/WebCore/page/ios/EventHandlerIOS.mm
Source/WebCore/page/mac/EventHandlerMac.mm
Source/WebCore/page/mac/ServicesOverlayController.h
Source/WebCore/page/mac/ServicesOverlayController.mm
Source/WebCore/page/mac/TextIndicatorWindow.mm
Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h
Source/WebCore/page/scrolling/ScrollLatchingState.cpp
Source/WebCore/page/scrolling/ScrollLatchingState.h
Source/WebCore/page/scrolling/ScrollingStateNode.cpp
Source/WebCore/page/scrolling/ScrollingStateNode.h
Source/WebCore/page/scrolling/ScrollingStateTree.cpp
Source/WebCore/page/scrolling/ScrollingStateTree.h
Source/WebCore/page/scrolling/ScrollingTree.cpp
Source/WebCore/page/scrolling/ScrollingTree.h
Source/WebCore/page/scrolling/ScrollingTreeNode.cpp
Source/WebCore/page/scrolling/ScrollingTreeNode.h
Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp
Source/WebCore/page/scrolling/ThreadedScrollingTree.h
Source/WebCore/page/scrolling/ios/ScrollingCoordinatorIOS.mm
Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.cpp
Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.h
Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm
Source/WebCore/page/scrolling/mac/ScrollingTreeMac.cpp
Source/WebCore/page/scrolling/mac/ScrollingTreeMac.h
Source/WebCore/page/win/EventHandlerWin.cpp
Source/WebCore/platform/Cursor.h
Source/WebCore/platform/efl/CursorEfl.cpp
Source/WebCore/platform/gtk/CursorGtk.cpp
Source/WebCore/platform/mac/CursorMac.mm
Source/WebCore/platform/win/CursorWin.cpp
Source/WebCore/rendering/RenderEmbeddedObject.cpp
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebCore/rendering/RenderSearchField.cpp
Source/WebCore/svg/SVGAElement.cpp
Source/WebCore/testing/MockPageOverlayClient.cpp
Source/WebKit/ios/ChangeLog
Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.h
Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebApplicationCacheQuotaManager.mm
Source/WebKit/mac/WebCoreSupport/WebChromeClient.h
Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm
Source/WebKit/mac/WebView/WebFrame.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/Plugins/PluginView.cpp
Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp
Source/WebKit/win/WebCoreSupport/WebChromeClient.h
Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit/win/WebView.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.cpp
Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.h
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
Source/WebKit2/WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm
Source/WebKit2/WebProcess/Plugins/PluginView.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm
Source/WebKit2/WebProcess/WebPage/FindController.cpp
Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
Source/WebKit2/WebProcess/WebPage/WebFrame.h
Source/WebKit2/WebProcess/WebPage/WebInspector.cpp
Source/WebKit2/WebProcess/WebPage/ios/FindControllerIOS.mm

index cfaa669..732e0b1 100644 (file)
@@ -1,3 +1,438 @@
+2017-01-20  Darin Adler  <darin@apple.com>
+
+        Remove PassRefPtr from "page" directory of WebCore, also deploy references
+        https://bugs.webkit.org/show_bug.cgi?id=167224
+
+        Reviewed by Chris Dumez.
+
+        * Modules/fetch/DOMWindowFetch.cpp:
+        (WebCore::DOMWindowFetch::fetch): Use DOMWindow::document instead of
+        scriptExecutionContext.
+
+        * Modules/webdatabase/DatabaseContext.cpp:
+        (WebCore::DatabaseContext::databaseExceededQuota): Pass a reference.
+
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityShowContextMenu]):
+        Pass a reference.
+
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::JSDOMWindow::getOwnPropertySlot): Pass a reference.
+
+        * dom/Document.cpp:
+        (WebCore::Document::childrenChanged): Pass a reference. Also made the
+        didReceiveDocType code unconditional instead of iOS-only.
+        (WebCore::Document::platformSuspendOrStopActiveDOMObjects): Ditto.
+        (WebCore::Document::updateViewportArguments): Ditto.
+        (WebCore::Document::setFocusedElement): Ditto.
+        (WebCore::Document::createDOMWindow): Ditto.
+        (WebCore::Document::takeDOMWindowFrom): Ditto.
+        (WebCore::Document::requestFullScreenForElement): Ditto.
+        (WebCore::Document::webkitExitFullscreen): Ditto.
+        * dom/Element.cpp:
+        (WebCore::Element::focus): Ditto.
+        (WebCore::Element::blur): Ditto.
+        (WebCore::Element::dispatchFocusEvent): Ditto.
+        (WebCore::Element::dispatchBlurEvent): Ditto.
+        * dom/Node.cpp:
+        (WebCore::Node::defaultEventHandler): Ditto.
+        * editing/EditorCommand.cpp:
+        (WebCore::executePrint): Ditto.
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::setFocusedElementIfNeeded): Ditto.
+        * history/CachedFrame.cpp:
+        (WebCore::CachedFrameBase::restore): Ditto.
+        (WebCore::CachedFrame::CachedFrame): Ditto.
+        * html/ColorInputType.cpp:
+        (WebCore::ColorInputType::handleDOMActivateEvent): Ditto.
+        * html/HTMLAnchorElement.cpp:
+        (WebCore::HTMLAnchorElement::isKeyboardFocusable): Ditto.
+
+        * html/HTMLFormControlElement.cpp:
+        (WebCore::HTMLFormControlElement::isKeyboardFocusable): Pass a reference,
+        and also rewrote to use && for clarity.
+
+        * html/HTMLVideoElement.cpp:
+        (WebCore::HTMLVideoElement::supportsFullscreen): Pass a reference.
+        * html/shadow/SpinButtonElement.cpp:
+        (WebCore::SpinButtonElement::defaultEventHandler): Ditto.
+        (WebCore::SpinButtonElement::releaseCapture): Ditto.
+        * html/shadow/mac/ImageControlsButtonElementMac.cpp:
+        (WebCore::ImageControlsButtonElementMac::defaultEventHandler): Ditto.
+        * inspector/InspectorFrontendHost.cpp:
+        (WebCore::InspectorFrontendHost::showContextMenu): Ditto.
+        (WebCore::InspectorFrontendHost::dispatchEventAsContextMenuEvent): Ditto.
+
+        * loader/EmptyClients.cpp:
+        (WebCore::EmptyChromeClient::createPopupMenu): Updated to take reference.
+        (WebCore::EmptyChromeClient::createSearchPopupMenu): Ditto.
+        (WebCore::EmptyChromeClient::createColorChooser): Ditto.
+        * loader/EmptyClients.h: Ditto.
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::submitForm): Pass a reference.
+        (WebCore::FrameLoader::commitProvisionalLoad): Ditto.
+        (WebCore::FrameLoader::closeAndRemoveChild): Take a reference.
+        (WebCore::FrameLoader::detachFromParent): Pass a reference.
+        (WebCore::FrameLoader::dispatchBeforeUnloadEvent): Ditto.
+        (WebCore::createWindow): Ditto.
+        * loader/FrameLoader.h: Updated for the above.
+
+        * loader/PolicyChecker.cpp:
+        (WebCore::PolicyChecker::checkNewWindowPolicy): Pass a reference.
+        * loader/appcache/ApplicationCacheGroup.cpp:
+        (WebCore::ApplicationCacheGroup::recalculateAvailableSpaceInQuota): Ditto.
+
+        * loader/appcache/ApplicationCacheGroup.h: Return a reference from origin.
+
+        * loader/appcache/ApplicationCacheStorage.cpp:
+        (WebCore::ApplicationCacheStorage::calculateQuotaForOrigin): Take a reference.
+        (WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache):
+        Ditto.
+        (WebCore::ApplicationCacheStorage::store): Pass a reference.
+        (WebCore::ApplicationCacheStorage::checkOriginQuota): Updated since origin
+        now returns areference.
+        * loader/appcache/ApplicationCacheStorage.h: Updated for the above.
+
+        * loader/archive/mhtml/MHTMLArchive.cpp:
+        (WebCore::MHTMLArchive::generateMHTMLData): Pass a reference.
+        * mathml/MathMLElement.cpp:
+        (WebCore::MathMLElement::isKeyboardFocusable): Ditto.
+
+        * page/Chrome.cpp:
+        (WebCore::Chrome::Chrome): Moved initialization of data members to the
+        class definition.
+        (WebCore::Chrome::contentsSizeChanged): Take a reference.
+        (WebCore::Chrome::createWindow): Ditto.
+        (WebCore::Chrome::runBeforeUnloadConfirmPanel): Ditto.
+        (WebCore::Chrome::runJavaScriptAlert): Ditto.
+        (WebCore::Chrome::runJavaScriptConfirm): Ditto.
+        (WebCore::Chrome::runJavaScriptPrompt): Ditto.
+        (WebCore::Chrome::setStatusbarText): Ditto.
+        (WebCore::Chrome::print): Ditto.
+        (WebCore::Chrome::createColorChooser): Ditto.
+        (WebCore::Chrome::createPopupMenu): Ditto.
+        (WebCore::Chrome::createSearchPopupMenu): Ditto.
+        (WebCore::Chrome::didReceiveDocType): Ditto. Also made unconditional, but
+        empty for non-iOS platforms.
+        (WebCore::Chrome::registerPopupOpeningObserver): Take a reference.
+        (WebCore::Chrome::unregisterPopupOpeningObserver): Ditto.
+        * page/Chrome.h: Updated for the above.
+
+        * page/ChromeClient.h: Take references. Also updated some arguments from
+        Node to Element.
+
+        * page/ContextMenuController.cpp:
+        (WebCore::ContextMenuController::handleContextMenuEvent): Take a reference.
+        (WebCore::ContextMenuController::showContextMenu): Ditto.
+        (WebCore::ContextMenuController::maybeCreateContextMenu): Ditto. Also use
+        make_unique instead of unique_ptr plus new.
+        (WebCore::openNewWindow): Ditto.
+        (WebCore::insertUnicodeCharacter): Ditto.
+        (WebCore::ContextMenuController::contextMenuItemSelected): Ditto.
+        (WebCore::ContextMenuController::showContextMenuAt): Ditto.
+        (WebCore::ContextMenuController::showImageControlsMenu): Ditto.
+        * page/ContextMenuController.h: Updated for the above.
+
+        * page/DOMTimer.cpp:
+        (WebCore::DOMTimer::fired): Pass a reference.
+
+        * page/DOMWindow.cpp:
+        (WebCore::PostMessageTimer::PostMessageTimer): Take Ref&& instead of
+        PassRefPtr.
+        (WebCore::DOMWindow::adjustWindowRect): Use a reference.
+        (WebCore::DOMWindow::allowPopUp): Ditto. Also rewrite to use || instead
+        of successive if statements.
+        (WebCore::DOMWindow::canShowModalDialog): Ditto.
+        (WebCore::DOMWindow::DOMWindow): Ditto.
+        (WebCore::DOMWindow::didSecureTransitionTo): Ditto.
+        (WebCore::DOMWindow::registerProperty): Ditto.
+        (WebCore::DOMWindow::unregisterProperty): Ditto.
+        (WebCore::DOMWindow::postMessageTimerFired): Merge with the function
+        immediately followed, called only from here.
+        (WebCore::DOMWindow::dispatchMessageEventWithOriginCheck): Deleted.
+        (WebCore::DOMWindow::print): Pass a reference.
+        (WebCore::DOMWindow::alert): Ditto.
+        (WebCore::DOMWindow::confirm): Ditto.
+        (WebCore::DOMWindow::prompt): Ditto.
+        (WebCore::DOMWindow::setStatus): Ditto.
+        (WebCore::DOMWindow::setDefaultStatus): Ditto.
+        (WebCore::DOMWindow::moveBy): Ditto.
+        (WebCore::DOMWindow::moveTo): Ditto.
+        (WebCore::DOMWindow::resizeBy): Ditto.
+        (WebCore::DOMWindow::resizeTo): Ditto.
+        (WebCore::DOMWindow::clearTimeout): Ditto.
+        (WebCore::DOMWindow::incrementScrollEventListenersCount): Ditto.
+        (WebCore::DOMWindow::decrementScrollEventListenersCount): Ditto.
+        (WebCore::DOMWindow::showModalDialog): Ditto.
+        * page/DOMWindow.h: Updated for the above. ALso made functions private
+        and final.
+
+        * page/DOMWindowProperty.cpp:
+        (WebCore::DOMWindowProperty::DOMWindowProperty): Pass a reference.
+        (WebCore::DOMWindowProperty::~DOMWindowProperty): Ditto.
+        (WebCore::DOMWindowProperty::willDestroyGlobalObjectInCachedFrame): Ditto.
+        (WebCore::DOMWindowProperty::willDestroyGlobalObjectInFrame): Ditto.
+
+        * page/DebugPageOverlays.cpp:
+        (WebCore::RegionOverlay::create): Return RefPtr instead of PassRefPtr.
+        (WebCore::RegionOverlay::~RegionOverlay): Pass a reference.
+        (WebCore::DebugPageOverlays::showRegionOverlay): Ditto.
+        (WebCore::DebugPageOverlays::hideRegionOverlay): Ditto.
+
+        * page/DragController.cpp:
+        (WebCore::DragController::dragExited): Pass a reference.
+        (WebCore::DragController::performDragOperation): Ditto.
+        (WebCore::DragController::concludeEditDrag): Ditto.
+        (WebCore::DragController::tryDHTMLDrag): Ditto.
+
+        * page/EventHandler.cpp: Replaced OptionalCursor with std::optional<Cursor>.
+        (WebCore::EventHandler::updateCursor): Refactor into two functions so we
+        can share more code with selectCursor.
+        (WebCore::EventHandler::selectCursor): Updated to use std::optional.
+        (WebCore::EventHandler::handleMouseMoveEvent): Use the new updateCursor.
+        (WebCore::EventHandler::startPanScrolling): Use a reference.
+        (WebCore::EventHandler::updateDragAndDrop): Ditto.
+        (WebCore::EventHandler::cancelDragAndDrop): Ditto.
+        (WebCore::EventHandler::performDragAndDrop): Ditto.
+        (WebCore::EventHandler::setCapturingMouseEventsElement): Take a raw pointer
+        instead of a PassRefPtr.
+        (WebCore::EventHandler::dispatchMouseEvent): Use a reference.
+        (WebCore::EventHandler::updateDragStateAfterEditDragIfNeeded): Ditto.
+        (WebCore::EventHandler::isKeyboardOptionTab): Ditto.
+        (WebCore::EventHandler::eventInvertsTabsToLinksClientCallResult): Ditto.
+        (WebCore::EventHandler::tabsToLinks): Ditto.
+        * page/EventHandler.h: Updated for the above.
+
+        * page/FocusController.cpp:
+        (WebCore::FocusController::setFocusedFrame): Take pointer instead
+        of PassRefPtr.
+        (WebCore::FocusController::setFocusedElement): Take reference instead of
+        PassRefPtr.
+        * page/FocusController.h: Updated for the above changes.
+
+        * page/FrameTree.cpp:
+        (WebCore::FrameTree::transferChild): Deleted. Unused function.
+        (WebCore::FrameTree::appendChild): Merged with the following function
+        since it's now only used here. Take reference instead of PassRefPtr.
+        (WebCore::FrameTree::actuallyAppendChild): Deleted.
+        (WebCore::FrameTree::removeChild): Take reference instead of pointer.
+        Use move instead of trickier swap.
+        * page/FrameTree.h: Updated for the above.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::setContentsSize): Use a reference.
+        * page/MainFrame.cpp:
+        (WebCore::MainFrame::dropChildren): Ditto.
+        * page/Page.cpp:
+        (WebCore::Page::scrollingCoordinator): Ditto.
+        * page/PageOverlay.cpp:
+        (WebCore::PageOverlay::fadeAnimationTimerFired): Ditto.
+
+        * page/PageOverlayController.cpp:
+        (WebCore::PageOverlayController::installPageOverlay): Take reference
+        instead of PassRefPtr.
+        (WebCore::PageOverlayController::uninstallPageOverlay): Take reference
+        intead of pointer.
+        * page/PageOverlayController.h: Updated for the above.
+
+        * page/PageSerializer.cpp:
+        (WebCore::PageSerializer::PageSerializer): Moved most initialization to the
+        class definition.
+        (WebCore::PageSerializer::serialize): Use reference.
+        (WebCore::PageSerializer::serializeFrame): Use initializer list instead of
+        constructor for resource.
+        (WebCore::PageSerializer::serializeCSSStyleSheet): Ditto.
+        (WebCore::PageSerializer::addImageToResources): Ditto.
+        * page/PageSerializer.h: Removed constructors from PageSerializer::Resource
+        struct since structures don't really need them. Updated for the above.
+        Changed SerializerMarkupAccumulator into a nested class.
+
+        * page/PerformanceEntry.h:
+        (WebCore::PerformanceEntry::startTimeCompareLessThan): Use const RefPtr&
+        instead of PassRefPtr to compare RefPtr in place.
+
+        * page/PerformanceUserTiming.cpp:
+        (WebCore::insertPerformanceEntry): Take Ref&& instead of PassRefPtr.
+
+        * page/ResourceUsageOverlay.cpp:
+        (WebCore::ResourceUsageOverlay::~ResourceUsageOverlay): Use refrence.
+        (WebCore::ResourceUsageOverlay::initialize): Ditto.
+
+        * page/animation/AnimationBase.h: Removed unneeded include.
+
+        * page/animation/AnimationController.cpp:
+        (WebCore::AnimationControllerPrivate::clear): Use reference.
+        (WebCore::AnimationControllerPrivate::fireEventsAndUpdateStyle): Ditto.
+        (WebCore::AnimationControllerPrivate::addEventToDispatch): Use the
+        append function instead of a hand-written alternative.
+        (WebCore::AnimationControllerPrivate::addElementChangeToDispatch):
+        Take a reference rather than a Ref&& since no caller is passing ownership.
+        * page/animation/AnimationControllerPrivate.h: Updated for the above.
+
+        * page/animation/CSSPropertyAnimation.cpp:
+        (WebCore::blendFunc): Return RefPtr instead of PassRefPtr.
+        (WebCore::blendFilter): Ditto.
+        (WebCore::crossfadeBlend): Ditto.
+
+        * page/animation/CompositeAnimation.cpp:
+        (WebCore::CompositeAnimation::updateTransitions): Updated to use
+        animationForProperty, which returns a raw pointer.
+        (WebCore::CompositeAnimation::animationForProperty): Renamed from
+        getAnimationForProperty and changed to return raw pointer instead
+        of PassRefPtr.
+        * page/animation/CompositeAnimation.h: Updated for the above.
+
+        * page/animation/ImplicitAnimation.cpp:
+        (WebCore::ImplicitAnimation::onAnimationEnd): Use animationForProperty.
+        (WebCore::ImplicitAnimation::sendTransitionEvent): Pass reference.
+        * page/animation/KeyframeAnimation.cpp:
+        (WebCore::KeyframeAnimation::sendAnimationEvent): Ditto.
+
+        * page/efl/EventHandlerEfl.cpp:
+        (WebCore::EventHandler::tabsToAllFormControls): Take reference.
+        (WebCore::EventHandler::createDraggingDataTransfer): Return Ref.
+        * page/gtk/EventHandlerGtk.cpp:
+        (WebCore::EventHandler::tabsToAllFormControls): Ditto.
+        (WebCore::EventHandler::createDraggingDataTransfer): Ditto.
+        * page/ios/EventHandlerIOS.mm:
+        (WebCore::EventHandler::tabsToAllFormControls): Ditto.
+        * page/mac/EventHandlerMac.mm:
+        (WebCore::EventHandler::createDraggingDataTransfer): Ditto.
+        (WebCore::EventHandler::tabsToAllFormControls): Ditto.
+        (WebCore::EventHandler::platformPrepareForWheelEvents): Ditto.
+
+        * page/mac/ServicesOverlayController.h: Take Ref&& for ranges instead
+        of PassRefPtr. Use references.
+        * page/mac/ServicesOverlayController.mm:
+        (WebCore::ServicesOverlayController::Highlight::createForSelection): Ditto.
+        (WebCore::ServicesOverlayController::Highlight::createForTelephoneNumber): Ditto.
+        (WebCore::ServicesOverlayController::Highlight::Highlight): Ditto.
+        (WebCore::ServicesOverlayController::buildPotentialHighlightsIfNeeded): Ditto.
+        (WebCore::ServicesOverlayController::buildPhoneNumberHighlights): Ditto.
+        (WebCore::ServicesOverlayController::buildSelectionHighlight): Ditto.
+        (WebCore::ServicesOverlayController::highlightsAreEquivalent): Ditto.
+        (WebCore::ServicesOverlayController::findTelephoneNumberHighlightContainingSelectionHighlight): Ditto.
+        (WebCore::ServicesOverlayController::handleClick): Ditto.
+
+        * page/mac/TextIndicatorWindow.mm:
+        (-[WebTextIndicatorView initWithFrame:textIndicator:margin:offset:]):
+        Take a reference instead of PassRefPtr.
+        (WebCore::TextIndicatorWindow::setTextIndicator): Updated for the above.
+
+        * page/scrolling/AsyncScrollingCoordinator.h: Use Ref&& and RefPtr intead
+        of PsasRefPtr.
+
+        * page/scrolling/ScrollLatchingState.cpp:
+        (WebCore::ScrollLatchingState::ScrollLatchingState): Initialize data members
+        in class definition.
+        (WebCore::ScrollLatchingState::setWheelEventElement): Use raw pointer instead
+        of PassRefPtr.
+        (WebCore::ScrollLatchingState::setPreviousWheelScrolledElement): Use raw
+        pointer instead of RefPtr&&.
+        (WebCore::ScrollLatchingState::setScrollableContainer): Use raw pointer instead
+        of PassRefPtr.
+        * page/scrolling/ScrollLatchingState.h: Updated for the above.
+
+        * page/scrolling/ScrollingStateNode.cpp:
+        (WebCore::ScrollingStateNode::cloneAndReset): Use Ref instead of PassRefPtr.
+        (WebCore::ScrollingStateNode::appendChild): Use Ref&& instead of PassRefPtr.
+        * page/scrolling/ScrollingStateNode.h: Updated for the above.
+
+        * page/scrolling/ScrollingStateTree.cpp:
+        (WebCore::ScrollingStateTree::createNode): Use Ref instead of PassRefPtr.
+        (WebCore::ScrollingStateTree::attachNode): Updated for the abve.
+        (WebCore::ScrollingStateTree::commit): Ditto.
+        * page/scrolling/ScrollingStateTree.h: Ditto.
+
+        * page/scrolling/ScrollingTree.cpp:
+        (WebCore::ScrollingTree::updateTreeFromStateNode): Use reference.
+        * page/scrolling/ScrollingTree.h: Return Ref instead of PassRefPtr.
+
+        * page/scrolling/ScrollingTreeNode.cpp:
+        (WebCore::ScrollingTreeNode::appendChild): Take Ref&& instead of PassRefPtr.
+        (WebCore::ScrollingTreeNode::removeChild): Take reference instead of pointer.
+        * page/scrolling/ScrollingTreeNode.h: Updated for the above.
+
+        * page/scrolling/ThreadedScrollingTree.cpp:
+        (WebCore::ThreadedScrollingTree::ThreadedScrollingTree): Take reference
+        instead of pointer.
+        * page/scrolling/ThreadedScrollingTree.h: Updated for the above.
+
+        * page/scrolling/ios/ScrollingCoordinatorIOS.mm:
+        (WebCore::ScrollingCoordinatorIOS::ScrollingCoordinatorIOS): Pass reference.
+
+        * page/scrolling/ios/ScrollingTreeIOS.cpp:
+        (WebCore::ScrollingTreeIOS::create): Take a reference.
+        (WebCore::ScrollingTreeIOS::ScrollingTreeIOS): Ditto.
+        (WebCore::ScrollingTreeIOS::createScrollingTreeNode): Return Ref instead of
+        PassRefPtr.
+        * page/scrolling/ios/ScrollingTreeIOS.h: Updated for the above.
+
+        * page/scrolling/mac/ScrollingCoordinatorMac.mm:
+        (WebCore::ScrollingCoordinatorMac::ScrollingCoordinatorMac): Use reference.
+
+        * page/scrolling/mac/ScrollingTreeMac.cpp:
+        (ScrollingTreeMac::create): Take a reference.
+        (ScrollingTreeMac::ScrollingTreeMac): Ditto.
+        (ScrollingTreeMac::createScrollingTreeNode): Return a Ref instead of a
+        PassRefPtr.
+        * page/scrolling/mac/ScrollingTreeMac.h: Updated for the above.
+
+        * page/win/EventHandlerWin.cpp:
+        (WebCore::EventHandler::tabsToAllFormControls): Take reference.
+        (WebCore::EventHandler::createDraggingDataTransfer): Return Ref.
+
+        * platform/Cursor.h: Rearranged the header a bit. Got rid of the explicit
+        copy constructor, assignment operator, and destructor. Using the ones
+        that the compiler automatically generates will work for all platforms and
+        we then also get move constructor and move assignment operator.
+
+        * platform/efl/CursorEfl.cpp:
+        (WebCore::Cursor::Cursor): Deleted.
+        (WebCore::Cursor::~Cursor): Deleted.
+        (WebCore::Cursor::operator=): Deleted.
+        * platform/gtk/CursorGtk.cpp:
+        (WebCore::Cursor::Cursor): Deleted.
+        (WebCore::Cursor::operator=): Deleted.
+        (WebCore::Cursor::~Cursor): Deleted.
+        * platform/mac/CursorMac.mm:
+        (WebCore::Cursor::Cursor): Deleted.
+        (WebCore::Cursor::operator=): Deleted.
+        (WebCore::Cursor::~Cursor): Deleted.
+        * platform/win/CursorWin.cpp:
+        (WebCore::SharedCursor::SharedCursor): Moved this here from the header
+        since it is only used within this file.
+        (WebCore::SharedCursor::create): Ditto.
+        (WebCore::Cursor::Cursor): Deleted.
+        (WebCore::Cursor::operator=): Deleted.
+        (WebCore::Cursor::~Cursor): Deleted.
+
+        * rendering/RenderEmbeddedObject.cpp:
+        (WebCore::RenderEmbeddedObject::handleUnavailablePluginIndicatorEvent):
+        Pass reference.
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::RenderLayerBacking): Get to FrameView
+        through the render tree itself, rather than through the frame.
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::updateLayerForHeader): Use reference.
+        (WebCore::RenderLayerCompositor::updateLayerForFooter): Ditto.
+        (WebCore::RenderLayerCompositor::attachRootLayer): Ditto.
+        (WebCore::RenderLayerCompositor::detachRootLayer): Ditto.
+        * rendering/RenderMenuList.cpp:
+        (RenderMenuList::showPopup): Ditto.
+        * rendering/RenderSearchField.cpp:
+        (WebCore::RenderSearchField::addSearchResult): Ditto.
+        (WebCore::RenderSearchField::showPopup): Ditto.
+        (WebCore::RenderSearchField::valueChanged): Ditto.
+        * svg/SVGAElement.cpp:
+        (WebCore::SVGAElement::isKeyboardFocusable): Ditto.
+        * testing/MockPageOverlayClient.cpp:
+        (WebCore::MockPageOverlayClient::installOverlay): Ditto.
+        (WebCore::MockPageOverlayClient::uninstallAllOverlays): Ditto.
+
 2017-01-22  Myles C. Maxfield  <mmaxfield@apple.com>
 
         [Cocoa] Unify FontPlatformData's hashing and equality operators
index adadacd..c59d365 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2016 Canon Inc.
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted, provided that the following conditions
 #if ENABLE(FETCH_API)
 
 #include "DOMWindow.h"
-#include "FetchRequest.h"
+#include "Document.h"
 #include "FetchResponse.h"
 
 namespace WebCore {
 
 void DOMWindowFetch::fetch(DOMWindow& window, FetchRequest& request, Ref<DeferredPromise>&& promise)
 {
-    if (!window.scriptExecutionContext())
+    auto* document = window.document();
+    if (!document)
         return;
-    FetchResponse::fetch(*window.scriptExecutionContext(), request, WTFMove(promise));
+    FetchResponse::fetch(*document, request, WTFMove(promise));
 }
 
 } // namespace WebCore
index e5489fc..3dcb560 100644 (file)
@@ -204,7 +204,7 @@ void DatabaseContext::databaseExceededQuota(const String& name, DatabaseDetails
     if (is<Document>(*m_scriptExecutionContext)) {
         Document& document = downcast<Document>(*m_scriptExecutionContext);
         if (Page* page = document.page())
-            page->chrome().client().exceededDatabaseQuota(document.frame(), name, details);
+            page->chrome().client().exceededDatabaseQuota(*document.frame(), name, details);
         return;
     }
     ASSERT(m_scriptExecutionContext->isWorkerGlobalScope());
index 416b183..0320f95 100644 (file)
@@ -3729,7 +3729,7 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         }
     }
     
-    page->contextMenuController().showContextMenuAt(&page->mainFrame(), rect.center());
+    page->contextMenuController().showContextMenuAt(page->mainFrame(), rect.center());
 }
 
 - (void)accessibilityScrollToVisible
index a3f62e5..ae7fe8c 100644 (file)
@@ -178,7 +178,7 @@ bool JSDOMWindow::getOwnPropertySlot(JSObject* object, ExecState* state, Propert
     if (Base::getOwnPropertySlot(thisObject, state, propertyName, slot)) {
         // Detect when we're getting the property 'showModalDialog', this is disabled, and has its original value.
         bool isShowModalDialogAndShouldHide = propertyName == state->propertyNames().showModalDialog
-            && !DOMWindow::canShowModalDialog(frame)
+            && !DOMWindow::canShowModalDialog(*frame)
             && slot.isValue() && isHostFunction(slot.getValue(state, propertyName), jsDOMWindowInstanceFunctionShowModalDialog);
         // Unless we're in the showModalDialog special case, we're done.
         if (!isShowModalDialogAndShouldHide)
index 08160ad..948d67c 100644 (file)
@@ -848,13 +848,11 @@ void Document::childrenChanged(const ChildChange& change)
 {
     ContainerNode::childrenChanged(change);
 
-#if PLATFORM(IOS)
     // FIXME: Chrome::didReceiveDocType() used to be called only when the doctype changed. We need to check the
     // impact of calling this systematically. If the overhead is negligible, we need to rename didReceiveDocType,
     // otherwise, we need to detect the doc type changes before updating the viewport.
     if (Page* page = this->page())
-        page->chrome().didReceiveDocType(frame());
-#endif
+        page->chrome().didReceiveDocType(*frame());
 
     Element* newDocumentElement = childrenOfType<Element>(*this).first();
     if (newDocumentElement == m_documentElement)
@@ -2372,9 +2370,10 @@ void Document::platformSuspendOrStopActiveDOMObjects()
 {
 #if PLATFORM(IOS)
     if (WebThreadCountOfObservedContentModifiers() > 0) {
-        Frame* frame = this->frame();
-        if (Page* page = frame ? frame->page() : nullptr)
-            page->chrome().client().clearContentChangeObservers(frame);
+        if (auto* frame = this->frame()) {
+            if (auto* page = frame->page())
+                page->chrome().client().clearContentChangeObservers(*frame);
+        }
     }
 #endif
 }
@@ -3218,9 +3217,7 @@ void Document::updateViewportArguments()
         m_didDispatchViewportPropertiesChanged = true;
 #endif
         page()->chrome().dispatchViewportPropertiesDidChange(m_viewportArguments);
-#if PLATFORM(IOS)
-        page()->chrome().didReceiveDocType(frame());
-#endif
+        page()->chrome().didReceiveDocType(*frame());
     }
 }
 
@@ -3642,7 +3639,7 @@ bool Document::setFocusedElement(Element* element, FocusDirection direction, Foc
             if (is<HTMLInputElement>(*oldFocusedElement))
                 downcast<HTMLInputElement>(*oldFocusedElement).endEditing();
             if (page())
-                page()->chrome().client().elementDidBlur(oldFocusedElement.get());
+                page()->chrome().client().elementDidBlur(*oldFocusedElement);
             ASSERT(!m_focusedElement);
         }
 
@@ -4000,7 +3997,7 @@ void Document::createDOMWindow()
     ASSERT(m_frame);
     ASSERT(!m_domWindow);
 
-    m_domWindow = DOMWindow::create(this);
+    m_domWindow = DOMWindow::create(*this);
 
     ASSERT(m_domWindow->document() == this);
     ASSERT(m_domWindow->frame() == m_frame);
@@ -4015,7 +4012,7 @@ void Document::takeDOMWindowFrom(Document* document)
     ASSERT(pageCacheState() == NotInPageCache);
 
     m_domWindow = WTFMove(document->m_domWindow);
-    m_domWindow->didSecureTransitionTo(this);
+    m_domWindow->didSecureTransitionTo(*this);
 
     ASSERT(m_domWindow->document() == this);
     ASSERT(m_domWindow->frame() == m_frame);
@@ -5573,12 +5570,12 @@ void Document::requestFullScreenForElement(Element* element, FullScreenCheckType
             break;
 
         bool hasKeyboardAccess = true;
-        if (!page()->chrome().client().supportsFullScreenForElement(element, hasKeyboardAccess)) {
+        if (!page()->chrome().client().supportsFullScreenForElement(*element, hasKeyboardAccess)) {
             // The new full screen API does not accept a "flags" parameter, so fall back to disallowing
             // keyboard input if the chrome client refuses to allow keyboard input.
             hasKeyboardAccess = false;
 
-            if (!page()->chrome().client().supportsFullScreenForElement(element, hasKeyboardAccess))
+            if (!page()->chrome().client().supportsFullScreenForElement(*element, hasKeyboardAccess))
                 break;
         }
 
@@ -5631,7 +5628,7 @@ void Document::requestFullScreenForElement(Element* element, FullScreenCheckType
         // 5. Return, and run the remaining steps asynchronously.
         // 6. Optionally, perform some animation.
         m_areKeysEnabledInFullScreen = hasKeyboardAccess;
-        page()->chrome().client().enterFullScreenForElement(element);
+        page()->chrome().client().enterFullScreenForElement(*element);
 
         // 7. Optionally, display a message indicating how the user can exit displaying the context object fullscreen.
         return;
@@ -5723,12 +5720,12 @@ void Document::webkitExitFullscreen()
     // Only exit out of full screen window mode if there are no remaining elements in the 
     // full screen stack.
     if (!newTop) {
-        page()->chrome().client().exitFullScreenForElement(m_fullScreenElement.get());
+        page()->chrome().client().exitFullScreenForElement(*m_fullScreenElement);
         return;
     }
 
     // Otherwise, notify the chrome of the new full screen element.
-    page()->chrome().client().enterFullScreenForElement(newTop);
+    page()->chrome().client().enterFullScreenForElement(*newTop);
 }
 
 bool Document::webkitFullscreenEnabled() const
index 88e3e99..85e0b26 100644 (file)
@@ -2348,7 +2348,7 @@ void Element::focus(bool restorePreviousSelection, FocusDirection direction)
 
     if (document().focusedElement() == this) {
         if (document().page())
-            document().page()->chrome().client().elementDidRefocus(this);
+            document().page()->chrome().client().elementDidRefocus(*this);
 
         return;
     }
@@ -2371,7 +2371,7 @@ void Element::focus(bool restorePreviousSelection, FocusDirection direction)
         // If a focus event handler changes the focus to a different node it
         // does not make sense to continue and update appearence.
         protect = this;
-        if (!page->focusController().setFocusedElement(this, document().frame(), direction))
+        if (!page->focusController().setFocusedElement(this, *document().frame(), direction))
             return;
     }
 
@@ -2441,7 +2441,7 @@ void Element::blur()
     cancelFocusAppearanceUpdate();
     if (treeScope().focusedElementInScope() == this) {
         if (Frame* frame = document().frame())
-            frame->page()->focusController().setFocusedElement(0, frame);
+            frame->page()->focusController().setFocusedElement(nullptr, *frame);
         else
             document().setFocusedElement(nullptr);
     }
@@ -2464,7 +2464,7 @@ void Element::dispatchFocusOutEvent(const AtomicString& eventType, RefPtr<Elemen
 void Element::dispatchFocusEvent(RefPtr<Element>&& oldFocusedElement, FocusDirection)
 {
     if (document().page())
-        document().page()->chrome().client().elementDidFocus(this);
+        document().page()->chrome().client().elementDidFocus(*this);
 
     EventDispatcher::dispatchEvent(*this, FocusEvent::create(eventNames().focusEvent, false, false, document().defaultView(), 0, WTFMove(oldFocusedElement)));
 }
@@ -2472,7 +2472,7 @@ void Element::dispatchFocusEvent(RefPtr<Element>&& oldFocusedElement, FocusDirec
 void Element::dispatchBlurEvent(RefPtr<Element>&& newFocusedElement)
 {
     if (document().page())
-        document().page()->chrome().client().elementDidBlur(this);
+        document().page()->chrome().client().elementDidBlur(*this);
 
     EventDispatcher::dispatchEvent(*this, FocusEvent::create(eventNames().blurEvent, false, false, document().defaultView(), 0, WTFMove(newFocusedElement)));
 }
index bb3ab99..7662305 100644 (file)
@@ -2253,7 +2253,7 @@ void Node::defaultEventHandler(Event& event)
     } else if (eventType == eventNames().contextmenuEvent) {
         if (Frame* frame = document().frame())
             if (Page* page = frame->page())
-                page->contextMenuController().handleContextMenuEvent(&event);
+                page->contextMenuController().handleContextMenuEvent(event);
 #endif
     } else if (eventType == eventNames().textInputEvent) {
         if (is<TextEvent>(event)) {
@@ -2272,7 +2272,7 @@ void Node::defaultEventHandler(Event& event)
 
             if (renderer) {
                 if (Frame* frame = document().frame())
-                    frame->eventHandler().startPanScrolling(downcast<RenderBox>(renderer));
+                    frame->eventHandler().startPanScrolling(downcast<RenderBox>(*renderer));
             }
         }
 #endif
index acf2268..01f071c 100644 (file)
@@ -930,7 +930,7 @@ static bool executePrint(Frame& frame, Event*, EditorCommandSource, const String
     Page* page = frame.page();
     if (!page)
         return false;
-    page->chrome().print(&frame);
+    page->chrome().print(frame);
     return true;
 }
 
index 6759ff1..713e779 100644 (file)
@@ -2157,7 +2157,7 @@ void FrameSelection::setFocusedElementIfNeeded()
     bool caretBrowsing = m_frame->settings().caretBrowsingEnabled();
     if (caretBrowsing) {
         if (Element* anchor = enclosingAnchorElement(m_selection.base())) {
-            m_frame->page()->focusController().setFocusedElement(anchor, m_frame);
+            m_frame->page()->focusController().setFocusedElement(anchor, *m_frame);
             return;
         }
     }
@@ -2169,16 +2169,16 @@ void FrameSelection::setFocusedElementIfNeeded()
             // so add the !isFrameElement check here. There's probably a better way to make this
             // work in the long term, but this is the safest fix at this time.
             if (target->isMouseFocusable() && !isFrameElement(target)) {
-                m_frame->page()->focusController().setFocusedElement(target, m_frame);
+                m_frame->page()->focusController().setFocusedElement(target, *m_frame);
                 return;
             }
             target = target->parentOrShadowHostElement();
         }
-        m_frame->document()->setFocusedElement(0);
+        m_frame->document()->setFocusedElement(nullptr);
     }
 
     if (caretBrowsing)
-        m_frame->page()->focusController().setFocusedElement(0, m_frame);
+        m_frame->page()->focusController().setFocusedElement(nullptr, *m_frame);
 }
 
 void DragCaretController::paintDragCaret(Frame* frame, GraphicsContext& p, const LayoutPoint& paintOffset, const LayoutRect& clipRect) const
@@ -2328,7 +2328,7 @@ void FrameSelection::revealSelection(SelectionRevealMode revealMode, const Scrol
                 layer->setAdjustForIOSCaretWhenScrolling(false);
                 updateAppearance();
                 if (m_frame->page())
-                    m_frame->page()->chrome().client().notifyRevealedSelectionByScrollingFrame(m_frame);
+                    m_frame->page()->chrome().client().notifyRevealedSelectionByScrollingFrame(*m_frame);
             }
         }
 #else
index 363398d..21f24ad 100644 (file)
@@ -98,9 +98,9 @@ void CachedFrameBase::restore()
     frame.loader().client().didRestoreFromPageCache();
 
     // Reconstruct the FrameTree. And open the child CachedFrames in their respective FrameLoaders.
-    for (unsigned i = 0; i < m_childFrames.size(); ++i) {
-        frame.tree().appendChild(&m_childFrames[i]->view()->frame());
-        m_childFrames[i]->open();
+    for (auto& childFrame : m_childFrames) {
+        frame.tree().appendChild(childFrame->view()->frame());
+        childFrame->open();
     }
 
 #if PLATFORM(IOS)
@@ -111,7 +111,7 @@ void CachedFrameBase::restore()
             // FIXME: Add SCROLL_LISTENER to the list of event types on Document, and use m_document->hasListenerType(). See <rdar://problem/9615482>.
             // FIXME: Can use Document::hasListenerType() now.
             if (domWindow->scrollEventListenerCount() && frame.page())
-                frame.page()->chrome().client().setNeedsScrollNotifications(&frame, true);
+                frame.page()->chrome().client().setNeedsScrollNotifications(frame, true);
         }
     }
 #endif
@@ -163,7 +163,7 @@ CachedFrame::CachedFrame(Frame& frame)
     // 1 - We reuse the main frame, so when it navigates to a new page load it needs to start with a blank FrameTree.
     // 2 - It's much easier to destroy a CachedFrame while it resides in the PageCache if it is disconnected from its parent.
     for (unsigned i = 0; i < m_childFrames.size(); ++i)
-        frame.tree().removeChild(&m_childFrames[i]->view()->frame());
+        frame.tree().removeChild(m_childFrames[i]->view()->frame());
 
     if (!m_isMainFrame)
         frame.page()->decrementSubframeCount();
@@ -181,7 +181,7 @@ CachedFrame::CachedFrame(Frame& frame)
     if (m_isMainFrame) {
         if (DOMWindow* domWindow = m_document->domWindow()) {
             if (domWindow->scrollEventListenerCount() && frame.page())
-                frame.page()->chrome().client().setNeedsScrollNotifications(&frame, false);
+                frame.page()->chrome().client().setNeedsScrollNotifications(frame, false);
         }
     }
 #endif
index 5ba2c95..50e1fcb 100644 (file)
@@ -156,7 +156,7 @@ void ColorInputType::handleDOMActivateEvent(Event& event)
 
     if (Chrome* chrome = this->chrome()) {
         if (!m_chooser)
-            m_chooser = chrome->createColorChooser(this, valueAsColor());
+            m_chooser = chrome->createColorChooser(*this, valueAsColor());
         else
             m_chooser->reattachColorChooser(valueAsColor());
     }
index 811eb0d..baeb576 100644 (file)
@@ -129,7 +129,7 @@ bool HTMLAnchorElement::isKeyboardFocusable(KeyboardEvent& event) const
     if (!document().frame())
         return false;
 
-    if (!document().frame()->eventHandler().tabsToLinks(&event))
+    if (!document().frame()->eventHandler().tabsToLinks(event))
         return false;
 
     if (!renderer() && ancestorsOfType<HTMLCanvasElement>(*this).first())
index ea8a3b3..62c2861 100644 (file)
@@ -370,10 +370,9 @@ bool HTMLFormControlElement::isFocusable() const
 
 bool HTMLFormControlElement::isKeyboardFocusable(KeyboardEvent& event) const
 {
-    if (isFocusable())
-        if (document().frame())
-            return document().frame()->eventHandler().tabsToAllFormControls(&event);
-    return false;
+    return isFocusable()
+        && document().frame()
+        && document().frame()->eventHandler().tabsToAllFormControls(event);
 }
 
 bool HTMLFormControlElement::isMouseFocusable() const
index d8a793e..a9db905 100644 (file)
@@ -171,7 +171,7 @@ bool HTMLVideoElement::supportsFullscreen(HTMLMediaElementEnums::VideoFullscreen
 #if ENABLE(FULLSCREEN_API)
     // If the full screen API is enabled and is supported for the current element
     // do not require that the player has a video track to enter full screen.
-    if (videoFullscreenMode == HTMLMediaElementEnums::VideoFullscreenModeStandard && page->chrome().client().supportsFullScreenForElement(this, false))
+    if (videoFullscreenMode == HTMLMediaElementEnums::VideoFullscreenModeStandard && page->chrome().client().supportsFullScreenForElement(*this, false))
         return true;
 #endif
 
index 58bd62a..98bd72b 100644 (file)
@@ -119,7 +119,7 @@ void SpinButtonElement::defaultEventHandler(Event& event)
                     frame->eventHandler().setCapturingMouseEventsElement(this);
                     m_capturing = true;
                     if (Page* page = document().page())
-                        page->chrome().registerPopupOpeningObserver(this);
+                        page->chrome().registerPopupOpeningObserver(*this);
                 }
             }
             UpDownState oldUpDownState = m_upDownState;
@@ -205,7 +205,7 @@ void SpinButtonElement::releaseCapture()
             frame->eventHandler().setCapturingMouseEventsElement(nullptr);
             m_capturing = false;
             if (Page* page = document().page())
-                page->chrome().unregisterPopupOpeningObserver(this);
+                page->chrome().unregisterPopupOpeningObserver(*this);
         }
     }
 }
index fd0c3e3..ba9badf 100644 (file)
@@ -117,7 +117,7 @@ void ImageControlsButtonElementMac::defaultEventHandler(Event& event)
         if (!page)
             return;
 
-        page->contextMenuController().showImageControlsMenu(&event);
+        page->contextMenuController().showImageControlsMenu(event);
         event.setDefaultHandled();
         return;
     }
index 31547db..74988cb 100644 (file)
@@ -339,8 +339,8 @@ void InspectorFrontendHost::showContextMenu(Event* event, const Vector<ContextMe
         return;
     }
     auto menuProvider = FrontendMenuProvider::create(this, { &state, frontendApiObject }, items);
-    m_frontendPage->contextMenuController().showContextMenu(event, menuProvider.ptr());
     m_menuProvider = menuProvider.ptr();
+    m_frontendPage->contextMenuController().showContextMenu(*event, menuProvider);
 }
 
 #endif
@@ -355,7 +355,7 @@ void InspectorFrontendHost::dispatchEventAsContextMenuEvent(Event* event)
     MouseEvent& mouseEvent = downcast<MouseEvent>(*event);
     IntPoint mousePoint = IntPoint(mouseEvent.clientX(), mouseEvent.clientY());
 
-    m_frontendPage->contextMenuController().showContextMenuAt(frame, mousePoint);
+    m_frontendPage->contextMenuController().showContextMenuAt(*frame, mousePoint);
 #else
     UNUSED_PARAM(event);
 #endif
index e75495f..57790b5 100644 (file)
@@ -572,19 +572,19 @@ class EmptyVisitedLinkStore final : public VisitedLinkStore {
     void addVisitedLink(Page&, LinkHash) final { }
 };
 
-RefPtr<PopupMenu> EmptyChromeClient::createPopupMenu(PopupMenuClient*) const
+RefPtr<PopupMenu> EmptyChromeClient::createPopupMenu(PopupMenuClient&) const
 {
     return adoptRef(*new EmptyPopupMenu);
 }
 
-RefPtr<SearchPopupMenu> EmptyChromeClient::createSearchPopupMenu(PopupMenuClient*) const
+RefPtr<SearchPopupMenu> EmptyChromeClient::createSearchPopupMenu(PopupMenuClient&) const
 {
     return adoptRef(*new EmptySearchPopupMenu);
 }
 
 #if ENABLE(INPUT_TYPE_COLOR)
 
-std::unique_ptr<ColorChooser> EmptyChromeClient::createColorChooser(ColorChooserClient*, const Color&)
+std::unique_ptr<ColorChooser> EmptyChromeClient::createColorChooser(ColorChooserClient&, const Color&)
 {
     return nullptr;
 }
index 91c2d38..e2aa60e 100644 (file)
@@ -61,7 +61,7 @@ class EmptyChromeClient : public ChromeClient {
     void focusedElementChanged(Element*) final { }
     void focusedFrameChanged(Frame*) final { }
 
-    Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&, const NavigationAction&) final { return nullptr; }
+    Page* createWindow(Frame&, const FrameLoadRequest&, const WindowFeatures&, const NavigationAction&) final { return nullptr; }
     void show() final { }
 
     bool canRunModal() final { return false; }
@@ -84,19 +84,19 @@ class EmptyChromeClient : public ChromeClient {
     void addMessageToConsole(MessageSource, MessageLevel, const String&, unsigned, unsigned, const String&) final { }
 
     bool canRunBeforeUnloadConfirmPanel() final { return false; }
-    bool runBeforeUnloadConfirmPanel(const String&, Frame*) final { return true; }
+    bool runBeforeUnloadConfirmPanel(const String&, Frame&) final { return true; }
 
     void closeWindowSoon() final { }
 
-    void runJavaScriptAlert(Frame*, const String&) final { }
-    bool runJavaScriptConfirm(Frame*, const String&) final { return false; }
-    bool runJavaScriptPrompt(Frame*, const String&, const String&, String&) final { return false; }
+    void runJavaScriptAlert(Frame&, const String&) final { }
+    bool runJavaScriptConfirm(Frame&, const String&) final { return false; }
+    bool runJavaScriptPrompt(Frame&, const String&, const String&, String&) final { return false; }
 
     bool selectItemWritingDirectionIsNatural() final { return false; }
     bool selectItemAlignmentFollowsMenuWritingDirection() final { return false; }
     bool hasOpenedPopup() const final { return false; }
-    RefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const final;
-    RefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const final;
+    RefPtr<PopupMenu> createPopupMenu(PopupMenuClient&) const final;
+    RefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient&) const final;
 
     void setStatusbarText(const String&) final { }
 
@@ -106,43 +106,47 @@ class EmptyChromeClient : public ChromeClient {
     void invalidateContentsAndRootView(const IntRect&) override { }
     void invalidateContentsForSlowScroll(const IntRect&) final { }
     void scroll(const IntSize&, const IntRect&, const IntRect&) final { }
+
 #if USE(COORDINATED_GRAPHICS)
     void delegatedScrollRequested(const IntPoint&) final { }
 #endif
+
 #if !USE(REQUEST_ANIMATION_FRAME_TIMER)
     void scheduleAnimation() final { }
 #endif
 
     IntPoint screenToRootView(const IntPoint& p) const final { return p; }
     IntRect rootViewToScreen(const IntRect& r) const final { return r; }
+
 #if PLATFORM(IOS)
     IntPoint accessibilityScreenToRootView(const IntPoint& p) const final { return p; };
     IntRect rootViewToAccessibilityScreen(const IntRect& r) const final { return r; };
 #endif
+
     PlatformPageClient platformPageClient() const final { return 0; }
-    void contentsSizeChanged(Frame*, const IntSize&) const final { }
+    void contentsSizeChanged(Frame&, const IntSize&) const final { }
 
     void scrollbarsModeDidChange() const final { }
     void mouseDidMoveOverElement(const HitTestResult&, unsigned) final { }
 
     void setToolTip(const String&, TextDirection) final { }
 
-    void print(Frame*) final { }
+    void print(Frame&) final { }
 
-    void exceededDatabaseQuota(Frame*, const String&, DatabaseDetails) final { }
+    void exceededDatabaseQuota(Frame&, const String&, DatabaseDetails) final { }
 
     void reachedMaxAppCacheSize(int64_t) final { }
-    void reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t) final { }
+    void reachedApplicationCacheOriginQuota(SecurityOrigin&, int64_t) final { }
 
 #if ENABLE(INPUT_TYPE_COLOR)
-    std::unique_ptr<ColorChooser> createColorChooser(ColorChooserClient*, const Color&) final;
+    std::unique_ptr<ColorChooser> createColorChooser(ColorChooserClient&, const Color&) final;
 #endif
 
     void runOpenPanel(Frame&, FileChooser&) final;
     void loadIconForFiles(const Vector<String>&, FileIconLoader&) final { }
 
-    void elementDidFocus(const Node*) final { }
-    void elementDidBlur(const Node*) final { }
+    void elementDidFocus(Element&) final { }
+    void elementDidBlur(Element&) final { }
 
 #if !PLATFORM(IOS)
     void setCursor(const Cursor&) final { }
@@ -151,8 +155,8 @@ class EmptyChromeClient : public ChromeClient {
 
     void scrollRectIntoView(const IntRect&) const final { }
 
-    void attachRootGraphicsLayer(Frame*, GraphicsLayer*) final { }
-    void attachViewOverlayGraphicsLayer(Frame*, GraphicsLayer*) final { }
+    void attachRootGraphicsLayer(Frame&, GraphicsLayer*) final { }
+    void attachViewOverlayGraphicsLayer(Frame&, GraphicsLayer*) final { }
     void setNeedsOneShotDrawingSynchronization() final { }
     void scheduleCompositingLayerFlush() final { }
 
@@ -162,15 +166,16 @@ class EmptyChromeClient : public ChromeClient {
     void AXFinishFrameLoad() final { }
 #endif
 
-#if PLATFORM(IOS)
 #if ENABLE(IOS_TOUCH_EVENTS)
     void didPreventDefaultForEvent() final { }
 #endif
+
+#if PLATFORM(IOS)
     void didReceiveMobileDocType(bool) final { }
-    void setNeedsScrollNotifications(Frame*, bool) final { }
-    void observedContentChange(Frame*) final { }
-    void clearContentChangeObservers(Frame*) final { }
-    void notifyRevealedSelectionByScrollingFrame(Frame*) final { }
+    void setNeedsScrollNotifications(Frame&, bool) final { }
+    void observedContentChange(Frame&) final { }
+    void clearContentChangeObservers(Frame&) final { }
+    void notifyRevealedSelectionByScrollingFrame(Frame&) final { }
     void didLayout(LayoutType) final { }
     void didStartOverflowScroll() final { }
     void didEndOverflowScroll() final { }
index 14d47da..78dff0c 100644 (file)
@@ -397,7 +397,7 @@ void FrameLoader::submitForm(Ref<FormSubmission>&& submission)
 
     Frame* targetFrame = findFrameForNavigation(submission->target(), &submission->state().sourceDocument());
     if (!targetFrame) {
-        if (!DOMWindow::allowPopUp(&m_frame) && !ScriptController::processingUserGesture())
+        if (!DOMWindow::allowPopUp(m_frame) && !ScriptController::processingUserGesture())
             return;
 
         // FIXME: targetFrame can be null for two distinct reasons:
@@ -1852,11 +1852,9 @@ void FrameLoader::commitProvisionalLoad()
         history().updateForClientRedirect();
 
     if (m_loadingFromCachedPage) {
-#if PLATFORM(IOS)
         // Note, didReceiveDocType is expected to be called for cached pages. See <rdar://problem/5906758> for more details.
-        if (m_frame.document()->doctype() && m_frame.page())
-            m_frame.page()->chrome().didReceiveDocType(&m_frame);
-#endif
+        if (auto* page = m_frame.page())
+            page->chrome().didReceiveDocType(m_frame);
         m_frame.document()->resume(ActiveDOMObject::PageCache);
 
         // Force a layout to update view size and thereby update scrollbars.
@@ -2439,15 +2437,15 @@ void FrameLoader::detachChildren()
         child->loader().detachFromParent();
 }
 
-void FrameLoader::closeAndRemoveChild(Frame* child)
+void FrameLoader::closeAndRemoveChild(Frame& child)
 {
-    child->tree().detachFromParent();
+    child.tree().detachFromParent();
 
-    child->setView(nullptr);
-    if (child->ownerElement() && child->page())
-        child->page()->decrementSubframeCount();
-    child->willDetachPage();
-    child->detachFromPage();
+    child.setView(nullptr);
+    if (child.ownerElement() && child.page())
+        child.page()->decrementSubframeCount();
+    child.willDetachPage();
+    child.detachFromPage();
 
     m_frame.tree().removeChild(child);
 }
@@ -2528,7 +2526,7 @@ void FrameLoader::detachFromParent()
     m_progressTracker = nullptr;
 
     if (Frame* parent = m_frame.tree().parent()) {
-        parent->loader().closeAndRemoveChild(&m_frame);
+        parent->loader().closeAndRemoveChild(m_frame);
         parent->loader().scheduleCheckCompleted();
     } else {
         m_frame.setView(nullptr);
@@ -3032,7 +3030,7 @@ bool FrameLoader::dispatchBeforeUnloadEvent(Chrome& chrome, FrameLoader* frameLo
     frameLoaderBeingNavigated->m_currentNavigationHasShownBeforeUnloadConfirmPanel = true;
 
     String text = document->displayStringModifiedByEncoding(beforeUnloadEvent->returnValue());
-    return chrome.runBeforeUnloadConfirmPanel(text, &m_frame);
+    return chrome.runBeforeUnloadConfirmPanel(text, m_frame);
 }
 
 void FrameLoader::continueLoadAfterNavigationPolicy(const ResourceRequest& request, FormState* formState, bool shouldContinue, AllowNavigationToInvalidURL allowNavigationToInvalidURL)
@@ -3657,7 +3655,7 @@ RefPtr<Frame> createWindow(Frame& openerFrame, Frame& lookupFrame, const FrameLo
         return nullptr;
 
     ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy = shouldOpenExternalURLsPolicyToApply(openerFrame, request.shouldOpenExternalURLsPolicy());
-    Page* page = oldPage->chrome().createWindow(&openerFrame, requestWithReferrer, features, NavigationAction(requestWithReferrer.resourceRequest(), shouldOpenExternalURLsPolicy));
+    Page* page = oldPage->chrome().createWindow(openerFrame, requestWithReferrer, features, NavigationAction(requestWithReferrer.resourceRequest(), shouldOpenExternalURLsPolicy));
     if (!page)
         return nullptr;
 
@@ -3705,7 +3703,7 @@ RefPtr<Frame> createWindow(Frame& openerFrame, Frame& lookupFrame, const FrameLo
         windowRect.setHeight(*features.height + (windowRect.height() - viewportSize.height()));
 
     // Ensure non-NaN values, minimum size as well as being within valid screen area.
-    FloatRect newWindowRect = DOMWindow::adjustWindowRect(page, windowRect);
+    FloatRect newWindowRect = DOMWindow::adjustWindowRect(*page, windowRect);
 
     if (!frame->page())
         return nullptr;
index faa0712..d69c829 100644 (file)
@@ -366,7 +366,7 @@ private:
     void requestFromDelegate(ResourceRequest&, unsigned long& identifier, ResourceError&);
 
     WEBCORE_EXPORT void detachChildren();
-    void closeAndRemoveChild(Frame*);
+    void closeAndRemoveChild(Frame&);
 
     void loadInSameDocument(const URL&, SerializedScriptValue* stateObject, bool isNewNavigation);
 
index bbb61eb..a01ce29 100644 (file)
@@ -157,7 +157,7 @@ void PolicyChecker::checkNewWindowPolicy(const NavigationAction& action, const R
     if (m_frame.document() && m_frame.document()->isSandboxed(SandboxPopups))
         return continueAfterNavigationPolicy(PolicyIgnore);
 
-    if (!DOMWindow::allowPopUp(&m_frame))
+    if (!DOMWindow::allowPopUp(m_frame))
         return continueAfterNavigationPolicy(PolicyIgnore);
 
     m_callback.set(request, formState, frameName, action, WTFMove(function));
index 8a28f88..9f9ab00 100644 (file)
@@ -784,7 +784,7 @@ void ApplicationCacheGroup::cacheUpdateFailed()
 
 void ApplicationCacheGroup::recalculateAvailableSpaceInQuota()
 {
-    if (!m_frame->page()->applicationCacheStorage().calculateRemainingSizeForOriginExcludingCache(m_origin.get(), m_newestCache.get(), m_availableSpaceInQuota)) {
+    if (!m_frame->page()->applicationCacheStorage().calculateRemainingSizeForOriginExcludingCache(m_origin, m_newestCache.get(), m_availableSpaceInQuota)) {
         // Failed to determine what is left in the quota. Fallback to allowing anything.
         m_availableSpaceInQuota = ApplicationCacheStorage::noQuota();
     }
index fc851da..ceb83df 100644 (file)
@@ -66,7 +66,7 @@ public:
 
     ApplicationCacheStorage& storage() { return m_storage; }
     const URL& manifestURL() const { return m_manifestURL; }
-    const SecurityOrigin* origin() const { return m_origin.get(); }
+    const SecurityOrigin& origin() const { return m_origin.get(); }
     UpdateStatus updateStatus() const { return m_updateStatus; }
     void setUpdateStatus(UpdateStatus status);
 
@@ -135,7 +135,7 @@ private:
     Ref<ApplicationCacheStorage> m_storage;
 
     URL m_manifestURL;
-    RefPtr<SecurityOrigin> m_origin;
+    Ref<SecurityOrigin> m_origin;
     UpdateStatus m_updateStatus { Idle };
     
     // This is the newest complete cache in the group.
index f4fa95b..b6b9d7a 100644 (file)
@@ -421,7 +421,7 @@ void ApplicationCacheStorage::setDefaultOriginQuota(int64_t quota)
     m_defaultOriginQuota = quota;
 }
 
-bool ApplicationCacheStorage::calculateQuotaForOrigin(const SecurityOrigin* origin, int64_t& quota)
+bool ApplicationCacheStorage::calculateQuotaForOrigin(const SecurityOrigin& origin, int64_t& quota)
 {
     SQLiteTransactionInProgressAutoCounter transactionCounter;
 
@@ -432,7 +432,7 @@ bool ApplicationCacheStorage::calculateQuotaForOrigin(const SecurityOrigin* orig
     if (statement.prepare() != SQLITE_OK)
         return false;
 
-    statement.bindText(1, SecurityOriginData::fromSecurityOrigin(*origin).databaseIdentifier());
+    statement.bindText(1, SecurityOriginData::fromSecurityOrigin(origin).databaseIdentifier());
     int result = statement.step();
 
     // Return the quota, or if it was null the default.
@@ -472,7 +472,7 @@ bool ApplicationCacheStorage::calculateUsageForOrigin(const SecurityOrigin* orig
     return false;
 }
 
-bool ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache(const SecurityOrigin* origin, ApplicationCache* cache, int64_t& remainingSize)
+bool ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache(const SecurityOrigin& origin, ApplicationCache* cache, int64_t& remainingSize)
 {
     SQLiteTransactionInProgressAutoCounter transactionCounter;
 
@@ -503,7 +503,7 @@ bool ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache(cons
     if (statement.prepare() != SQLITE_OK)
         return false;
 
-    statement.bindText(1, SecurityOriginData::fromSecurityOrigin(*origin).databaseIdentifier());
+    statement.bindText(1, SecurityOriginData::fromSecurityOrigin(origin).databaseIdentifier());
     if (excludingCacheIdentifier != 0)
         statement.bindInt64(2, excludingCacheIdentifier);
     int result = statement.step();
@@ -688,14 +688,14 @@ bool ApplicationCacheStorage::store(ApplicationCacheGroup* group, GroupStorageID
 
     statement.bindInt64(1, urlHostHash(group->manifestURL()));
     statement.bindText(2, group->manifestURL());
-    statement.bindText(3, SecurityOriginData::fromSecurityOrigin(*group->origin()).databaseIdentifier());
+    statement.bindText(3, SecurityOriginData::fromSecurityOrigin(group->origin()).databaseIdentifier());
 
     if (!executeStatement(statement))
         return false;
 
     unsigned groupStorageID = static_cast<unsigned>(m_database.lastInsertRowID());
 
-    if (!ensureOriginRecord(group->origin()))
+    if (!ensureOriginRecord(&group->origin()))
         return false;
 
     group->setStorageID(groupStorageID);
@@ -971,7 +971,7 @@ bool ApplicationCacheStorage::checkOriginQuota(ApplicationCacheGroup* group, App
 {
     // Check if the oldCache with the newCache would reach the per-origin quota.
     int64_t remainingSpaceInOrigin;
-    const SecurityOrigin* origin = group->origin();
+    auto& origin = group->origin();
     if (calculateRemainingSizeForOriginExcludingCache(origin, oldCache, remainingSpaceInOrigin)) {
         if (remainingSpaceInOrigin < newCache->estimatedSizeInStorage()) {
             int64_t quota;
index 9fa292e..9d17a1b 100644 (file)
@@ -63,8 +63,8 @@ public:
     int64_t defaultOriginQuota() const { return m_defaultOriginQuota; }
     WEBCORE_EXPORT void setDefaultOriginQuota(int64_t quota);
     WEBCORE_EXPORT bool calculateUsageForOrigin(const SecurityOrigin*, int64_t& usage);
-    WEBCORE_EXPORT bool calculateQuotaForOrigin(const SecurityOrigin*, int64_t& quota);
-    bool calculateRemainingSizeForOriginExcludingCache(const SecurityOrigin*, ApplicationCache*, int64_t& remainingSize);
+    WEBCORE_EXPORT bool calculateQuotaForOrigin(const SecurityOrigin&, int64_t& quota);
+    bool calculateRemainingSizeForOriginExcludingCache(const SecurityOrigin&, ApplicationCache*, int64_t& remainingSize);
     WEBCORE_EXPORT bool storeUpdatedQuotaForOrigin(const SecurityOrigin*, int64_t quota);
     bool checkOriginQuota(ApplicationCacheGroup*, ApplicationCache* oldCache, ApplicationCache* newCache, int64_t& totalSpaceNeeded);
 
index a921b05..2ca67e2 100644 (file)
@@ -133,8 +133,8 @@ RefPtr<MHTMLArchive> MHTMLArchive::create(const URL& url, SharedBuffer& data)
 RefPtr<SharedBuffer> MHTMLArchive::generateMHTMLData(Page* page)
 {
     Vector<PageSerializer::Resource> resources;
-    PageSerializer pageSerializer(&resources);
-    pageSerializer.serialize(page);
+    PageSerializer pageSerializer(resources);
+    pageSerializer.serialize(*page);
 
     String boundary = generateRandomBoundary();
     String endOfResourceBoundary = makeString("--", boundary, "\r\n");
index e15176d..e971396 100644 (file)
@@ -182,7 +182,7 @@ bool MathMLElement::isKeyboardFocusable(KeyboardEvent& event) const
         return StyledElement::isKeyboardFocusable(event);
 
     if (isLink())
-        return document().frame()->eventHandler().tabsToLinks(&event);
+        return document().frame()->eventHandler().tabsToLinks(event);
 
     return StyledElement::isKeyboardFocusable(event);
 }
index 74dde1a..e363f43 100644 (file)
@@ -48,7 +48,6 @@
 #include "StorageNamespace.h"
 #include "WindowFeatures.h"
 #include <runtime/VM.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/SetForScope.h>
 #include <wtf/Vector.h>
 
@@ -63,10 +62,6 @@ using namespace HTMLNames;
 Chrome::Chrome(Page& page, ChromeClient& client)
     : m_page(page)
     , m_client(client)
-    , m_displayID(0)
-#if PLATFORM(IOS)
-    , m_isDispatchViewportDataDidChangeSuppressed(false)
-#endif
 {
 }
 
@@ -114,6 +109,7 @@ IntRect Chrome::rootViewToScreen(const IntRect& rect) const
 }
     
 #if PLATFORM(IOS)
+
 IntPoint Chrome::accessibilityScreenToRootView(const IntPoint& point) const
 {
     return m_client.accessibilityScreenToRootView(point);
@@ -123,6 +119,7 @@ IntRect Chrome::rootViewToAccessibilityScreen(const IntRect& rect) const
 {
     return m_client.rootViewToAccessibilityScreen(rect);
 }
+
 #endif
 
 PlatformPageClient Chrome::platformPageClient() const
@@ -130,7 +127,7 @@ PlatformPageClient Chrome::platformPageClient() const
     return m_client.platformPageClient();
 }
 
-void Chrome::contentsSizeChanged(Frame* frame, const IntSize& size) const
+void Chrome::contentsSizeChanged(Frame& frame, const IntSize& size) const
 {
     m_client.contentsSizeChanged(frame, size);
 }
@@ -190,15 +187,13 @@ void Chrome::focusedFrameChanged(Frame* frame) const
     m_client.focusedFrameChanged(frame);
 }
 
-Page* Chrome::createWindow(Frame* frame, const FrameLoadRequest& request, const WindowFeatures& features, const NavigationAction& action) const
+Page* Chrome::createWindow(Frame& frame, const FrameLoadRequest& request, const WindowFeatures& features, const NavigationAction& action) const
 {
     Page* newPage = m_client.createWindow(frame, request, features, action);
     if (!newPage)
-        return 0;
-
-    if (StorageNamespace* oldSessionStorage = m_page.sessionStorage(false))
+        return nullptr;
+    if (auto* oldSessionStorage = m_page.sessionStorage(false))
         newPage->setSessionStorage(oldSessionStorage->copy(newPage));
-
     return newPage;
 }
 
@@ -276,7 +271,7 @@ bool Chrome::canRunBeforeUnloadConfirmPanel()
     return m_client.canRunBeforeUnloadConfirmPanel();
 }
 
-bool Chrome::runBeforeUnloadConfirmPanel(const String& message, Frame* frame)
+bool Chrome::runBeforeUnloadConfirmPanel(const String& message, Frame& frame)
 {
     // Defer loads in case the client method runs a new event loop that would
     // otherwise cause the load to continue while we're in the middle of executing JavaScript.
@@ -290,53 +285,47 @@ void Chrome::closeWindowSoon()
     m_client.closeWindowSoon();
 }
 
-void Chrome::runJavaScriptAlert(Frame* frame, const String& message)
+void Chrome::runJavaScriptAlert(Frame& frame, const String& message)
 {
     // Defer loads in case the client method runs a new event loop that would
     // otherwise cause the load to continue while we're in the middle of executing JavaScript.
     PageGroupLoadDeferrer deferrer(m_page, true);
 
-    ASSERT(frame);
     notifyPopupOpeningObservers();
-    String displayMessage = frame->displayStringModifiedByEncoding(message);
+    String displayMessage = frame.displayStringModifiedByEncoding(message);
 
     m_client.runJavaScriptAlert(frame, displayMessage);
 }
 
-bool Chrome::runJavaScriptConfirm(Frame* frame, const String& message)
+bool Chrome::runJavaScriptConfirm(Frame& frame, const String& message)
 {
     // Defer loads in case the client method runs a new event loop that would
     // otherwise cause the load to continue while we're in the middle of executing JavaScript.
     PageGroupLoadDeferrer deferrer(m_page, true);
 
-    ASSERT(frame);
     notifyPopupOpeningObservers();
-    String displayMessage = frame->displayStringModifiedByEncoding(message);
-
-    return m_client.runJavaScriptConfirm(frame, displayMessage);
+    return m_client.runJavaScriptConfirm(frame, frame.displayStringModifiedByEncoding(message));
 }
 
-bool Chrome::runJavaScriptPrompt(Frame* frame, const String& prompt, const String& defaultValue, String& result)
+bool Chrome::runJavaScriptPrompt(Frame& frame, const String& prompt, const String& defaultValue, String& result)
 {
     // Defer loads in case the client method runs a new event loop that would
     // otherwise cause the load to continue while we're in the middle of executing JavaScript.
     PageGroupLoadDeferrer deferrer(m_page, true);
 
-    ASSERT(frame);
     notifyPopupOpeningObservers();
-    String displayPrompt = frame->displayStringModifiedByEncoding(prompt);
+    String displayPrompt = frame.displayStringModifiedByEncoding(prompt);
 
-    bool ok = m_client.runJavaScriptPrompt(frame, displayPrompt, frame->displayStringModifiedByEncoding(defaultValue), result);
+    bool ok = m_client.runJavaScriptPrompt(frame, displayPrompt, frame.displayStringModifiedByEncoding(defaultValue), result);
     if (ok)
-        result = frame->displayStringModifiedByEncoding(result);
+        result = frame.displayStringModifiedByEncoding(result);
 
     return ok;
 }
 
-void Chrome::setStatusbarText(Frame* frame, const String& status)
+void Chrome::setStatusbarText(Frame& frame, const String& status)
 {
-    ASSERT(frame);
-    m_client.setStatusbarText(frame->displayStringModifiedByEncoding(status));
+    m_client.setStatusbarText(frame.displayStringModifiedByEncoding(status));
 }
 
 void Chrome::mouseDidMoveOverElement(const HitTestResult& result, unsigned modifierFlags)
@@ -407,9 +396,9 @@ void Chrome::setToolTip(const HitTestResult& result)
     m_client.setToolTip(toolTip, toolTipDirection);
 }
 
-void Chrome::print(Frame* frame)
+void Chrome::print(Frame& frame)
 {
-    // FIXME: This should have PageGroupLoadDeferrer, like runModal() or runJavaScriptAlert(), becasue it's no different from those.
+    // FIXME: This should have PageGroupLoadDeferrer, like runModal() or runJavaScriptAlert(), because it's no different from those.
     m_client.print(frame);
 }
 
@@ -424,11 +413,13 @@ void Chrome::disableSuddenTermination()
 }
 
 #if ENABLE(INPUT_TYPE_COLOR)
-std::unique_ptr<ColorChooser> Chrome::createColorChooser(ColorChooserClient* client, const Color& initialColor)
+
+std::unique_ptr<ColorChooser> Chrome::createColorChooser(ColorChooserClient& client, const Color& initialColor)
 {
     notifyPopupOpeningObservers();
     return m_client.createColorChooser(client, initialColor);
 }
+
 #endif
 
 void Chrome::runOpenPanel(Frame& frame, FileChooser& fileChooser)
@@ -538,13 +529,13 @@ bool Chrome::hasOpenedPopup() const
     return m_client.hasOpenedPopup();
 }
 
-RefPtr<PopupMenu> Chrome::createPopupMenu(PopupMenuClient* client) const
+RefPtr<PopupMenu> Chrome::createPopupMenu(PopupMenuClient& client) const
 {
     notifyPopupOpeningObservers();
     return m_client.createPopupMenu(client);
 }
 
-RefPtr<SearchPopupMenu> Chrome::createSearchPopupMenu(PopupMenuClient* client) const
+RefPtr<SearchPopupMenu> Chrome::createSearchPopupMenu(PopupMenuClient& client) const
 {
     notifyPopupOpeningObservers();
     return m_client.createSearchPopupMenu(client);
@@ -555,30 +546,27 @@ bool Chrome::requiresFullscreenForVideoPlayback()
     return m_client.requiresFullscreenForVideoPlayback();
 }
 
-#if PLATFORM(IOS)
-// FIXME: Make argument, frame, a reference.
-void Chrome::didReceiveDocType(Frame* frame)
+void Chrome::didReceiveDocType(Frame& frame)
 {
-    ASSERT(frame);
-    if (!frame->isMainFrame())
+#if !PLATFORM(IOS)
+    UNUSED_PARAM(frame);
+#else
+    if (!frame.isMainFrame())
         return;
 
-    bool hasMobileDocType = false;
-    if (DocumentType* documentType = frame->document()->doctype())
-        hasMobileDocType = documentType->publicId().contains("xhtml mobile", false);
-    m_client.didReceiveMobileDocType(hasMobileDocType);
-}
+    auto* doctype = frame.document()->doctype();
+    m_client.didReceiveMobileDocType(doctype && doctype->publicId().containsIgnoringASCIICase("xhtml mobile"));
 #endif
+}
 
-void Chrome::registerPopupOpeningObserver(PopupOpeningObserver* observer)
+void Chrome::registerPopupOpeningObserver(PopupOpeningObserver& observer)
 {
-    ASSERT(observer);
-    m_popupOpeningObservers.append(observer);
+    m_popupOpeningObservers.append(&observer);
 }
 
-void Chrome::unregisterPopupOpeningObserver(PopupOpeningObserver* observer)
+void Chrome::unregisterPopupOpeningObserver(PopupOpeningObserver& observer)
 {
-    bool removed = m_popupOpeningObservers.removeFirst(observer);
+    bool removed = m_popupOpeningObservers.removeFirst(&observer);
     ASSERT_UNUSED(removed, removed);
 }
 
index 6d25ac8..b3c4647 100644 (file)
@@ -95,7 +95,7 @@ public:
 
     void scrollRectIntoView(const IntRect&) const;
 
-    void contentsSizeChanged(Frame*, const IntSize&) const;
+    void contentsSizeChanged(Frame&, const IntSize&) const;
 
     WEBCORE_EXPORT void setWindowRect(const FloatRect&) const;
     WEBCORE_EXPORT FloatRect windowRect() const;
@@ -111,7 +111,7 @@ public:
     void focusedElementChanged(Element*) const;
     void focusedFrameChanged(Frame*) const;
 
-    WEBCORE_EXPORT Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&, const NavigationAction&) const;
+    WEBCORE_EXPORT Page* createWindow(Frame&, const FrameLoadRequest&, const WindowFeatures&, const NavigationAction&) const;
     WEBCORE_EXPORT void show() const;
 
     bool canRunModal() const;
@@ -132,26 +132,26 @@ public:
     void setResizable(bool) const;
 
     bool canRunBeforeUnloadConfirmPanel();
-    bool runBeforeUnloadConfirmPanel(const String& message, Frame*);
+    bool runBeforeUnloadConfirmPanel(const String& message, Frame&);
 
     void closeWindowSoon();
 
-    void runJavaScriptAlert(Frame*, const String&);
-    bool runJavaScriptConfirm(Frame*, const String&);
-    bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result);
-    WEBCORE_EXPORT void setStatusbarText(Frame*, const String&);
+    void runJavaScriptAlert(Frame&, const String&);
+    bool runJavaScriptConfirm(Frame&, const String&);
+    bool runJavaScriptPrompt(Frame&, const String& message, const String& defaultValue, String& result);
+    WEBCORE_EXPORT void setStatusbarText(Frame&, const String&);
 
     void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
 
     void setToolTip(const HitTestResult&);
 
-    WEBCORE_EXPORT void print(Frame*);
+    WEBCORE_EXPORT void print(Frame&);
 
     WEBCORE_EXPORT void enableSuddenTermination();
     WEBCORE_EXPORT void disableSuddenTermination();
 
 #if ENABLE(INPUT_TYPE_COLOR)
-    std::unique_ptr<ColorChooser> createColorChooser(ColorChooserClient*, const Color& initialColor);
+    std::unique_ptr<ColorChooser> createColorChooser(ColorChooserClient&, const Color& initialColor);
 #endif
 
     void runOpenPanel(Frame&, FileChooser&);
@@ -168,28 +168,28 @@ public:
     bool selectItemWritingDirectionIsNatural();
     bool selectItemAlignmentFollowsMenuWritingDirection();
     bool hasOpenedPopup() const;
-    RefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const;
-    RefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const;
+    RefPtr<PopupMenu> createPopupMenu(PopupMenuClient&) const;
+    RefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient&) const;
 
 #if PLATFORM(IOS)
     // FIXME: Can we come up with a better name for this setter?
     void setDispatchViewportDataDidChangeSuppressed(bool dispatchViewportDataDidChangeSuppressed) { m_isDispatchViewportDataDidChangeSuppressed = dispatchViewportDataDidChangeSuppressed; }
-
-    void didReceiveDocType(Frame*);
 #endif
 
-    void registerPopupOpeningObserver(PopupOpeningObserver*);
-    void unregisterPopupOpeningObserver(PopupOpeningObserver*);
+    void didReceiveDocType(Frame&);
+
+    void registerPopupOpeningObserver(PopupOpeningObserver&);
+    void unregisterPopupOpeningObserver(PopupOpeningObserver&);
 
 private:
     void notifyPopupOpeningObservers() const;
 
     Page& m_page;
     ChromeClient& m_client;
-    PlatformDisplayID m_displayID;
+    PlatformDisplayID m_displayID { 0 };
     Vector<PopupOpeningObserver*> m_popupOpeningObservers;
 #if PLATFORM(IOS)
-    bool m_isDispatchViewportDataDidChangeSuppressed;
+    bool m_isDispatchViewportDataDidChangeSuppressed { false };
 #endif
 };
 
index 2c89b6c..8a16391 100644 (file)
@@ -123,7 +123,7 @@ public:
     // created Page has its show method called.
     // The FrameLoadRequest parameter is only for ChromeClient to check if the
     // request could be fulfilled. The ChromeClient should not load the request.
-    virtual Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&, const NavigationAction&) = 0;
+    virtual Page* createWindow(Frame&, const FrameLoadRequest&, const WindowFeatures&, const NavigationAction&) = 0;
     virtual void show() = 0;
 
     virtual bool canRunModal() = 0;
@@ -146,63 +146,67 @@ public:
     virtual void addMessageToConsole(MessageSource, MessageLevel, const String& message, unsigned lineNumber, unsigned columnNumber, const String& sourceID) = 0;
 
     virtual bool canRunBeforeUnloadConfirmPanel() = 0;
-    virtual bool runBeforeUnloadConfirmPanel(const String& message, Frame*) = 0;
+    virtual bool runBeforeUnloadConfirmPanel(const String& message, Frame&) = 0;
 
     virtual void closeWindowSoon() = 0;
 
-    virtual void runJavaScriptAlert(Frame*, const String&) = 0;
-    virtual bool runJavaScriptConfirm(Frame*, const String&) = 0;
-    virtual bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result) = 0;
+    virtual void runJavaScriptAlert(Frame&, const String&) = 0;
+    virtual bool runJavaScriptConfirm(Frame&, const String&) = 0;
+    virtual bool runJavaScriptPrompt(Frame&, const String& message, const String& defaultValue, String& result) = 0;
     virtual void setStatusbarText(const String&) = 0;
     virtual KeyboardUIMode keyboardUIMode() = 0;
 
-    // Methods used by HostWindow.
     virtual bool supportsImmediateInvalidation() { return false; }
     virtual void invalidateRootView(const IntRect&) = 0;
     virtual void invalidateContentsAndRootView(const IntRect&) = 0;
     virtual void invalidateContentsForSlowScroll(const IntRect&) = 0;
     virtual void scroll(const IntSize&, const IntRect&, const IntRect&) = 0;
+
 #if USE(COORDINATED_GRAPHICS)
     virtual void delegatedScrollRequested(const IntPoint&) = 0;
 #endif
+
     virtual IntPoint screenToRootView(const IntPoint&) const = 0;
     virtual IntRect rootViewToScreen(const IntRect&) const = 0;
+
 #if PLATFORM(IOS)
     virtual IntPoint accessibilityScreenToRootView(const IntPoint&) const = 0;
     virtual IntRect rootViewToAccessibilityScreen(const IntRect&) const = 0;
 #endif    
+
     virtual PlatformPageClient platformPageClient() const = 0;
     virtual void scrollbarsModeDidChange() const = 0;
+
 #if ENABLE(CURSOR_SUPPORT)
     virtual void setCursor(const Cursor&) = 0;
     virtual void setCursorHiddenUntilMouseMoves(bool) = 0;
 #endif
+
 #if !USE(REQUEST_ANIMATION_FRAME_TIMER)
     virtual void scheduleAnimation() = 0;
 #endif
-    // End methods used by HostWindow.
 
-    virtual FloatSize screenSize() const { return const_cast<ChromeClient*>(this)->windowRect().size(); }
-    virtual FloatSize availableScreenSize() const { return const_cast<ChromeClient*>(this)->windowRect().size(); }
+    virtual FloatSize screenSize() const { return const_cast<ChromeClient&>(*this).windowRect().size(); }
+    virtual FloatSize availableScreenSize() const { return const_cast<ChromeClient&>(*this).windowRect().size(); }
 
     virtual void dispatchViewportPropertiesDidChange(const ViewportArguments&) const { }
 
-    virtual void contentsSizeChanged(Frame*, const IntSize&) const = 0;
+    virtual void contentsSizeChanged(Frame&, const IntSize&) const = 0;
     virtual void scrollRectIntoView(const IntRect&) const { }; // Currently only Mac has a non empty implementation.
 
     virtual bool shouldUnavailablePluginMessageBeButton(RenderEmbeddedObject::PluginUnavailabilityReason) const { return false; }
-    virtual void unavailablePluginButtonClicked(Element*, RenderEmbeddedObject::PluginUnavailabilityReason) const { }
+    virtual void unavailablePluginButtonClicked(Element&, RenderEmbeddedObject::PluginUnavailabilityReason) const { }
     virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags) = 0;
 
     virtual void setToolTip(const String&, TextDirection) = 0;
 
-    virtual void print(Frame*) = 0;
+    virtual void print(Frame&) = 0;
 
     virtual Color underlayColor() const { return Color(); }
 
     virtual void pageExtendedBackgroundColorDidChange(Color) const { }
 
-    virtual void exceededDatabaseQuota(Frame*, const String& databaseName, DatabaseDetails) = 0;
+    virtual void exceededDatabaseQuota(Frame&, const String& databaseName, DatabaseDetails) = 0;
 
     // Callback invoked when the application cache fails to save a cache object
     // because storing it would grow the database file past its defined maximum
@@ -219,7 +223,7 @@ public:
     // storage, in bytes, needed to store the new cache along with all of the
     // other existing caches for the origin that would not be replaced by
     // the new cache.
-    virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t totalSpaceNeeded) = 0;
+    virtual void reachedApplicationCacheOriginQuota(SecurityOrigin&, int64_t totalSpaceNeeded) = 0;
 
 #if ENABLE(DASHBOARD_SUPPORT)
     virtual void annotatedRegionsChanged();
@@ -236,10 +240,10 @@ public:
 
 #if PLATFORM(IOS)
     virtual void didReceiveMobileDocType(bool) = 0;
-    virtual void setNeedsScrollNotifications(Frame*, bool) = 0;
-    virtual void observedContentChange(Frame*) = 0;
-    virtual void clearContentChangeObservers(Frame*) = 0;
-    virtual void notifyRevealedSelectionByScrollingFrame(Frame*) = 0;
+    virtual void setNeedsScrollNotifications(Frame&, bool) = 0;
+    virtual void observedContentChange(Frame&) = 0;
+    virtual void clearContentChangeObservers(Frame&) = 0;
+    virtual void notifyRevealedSelectionByScrollingFrame(Frame&) = 0;
 
     enum LayoutType { NormalLayout, Scroll };
     virtual void didLayout(LayoutType = NormalLayout) = 0;
@@ -270,16 +274,16 @@ public:
 #endif
 
 #if ENABLE(INPUT_TYPE_COLOR)
-    virtual std::unique_ptr<ColorChooser> createColorChooser(ColorChooserClient*, const Color&) = 0;
+    virtual std::unique_ptr<ColorChooser> createColorChooser(ColorChooserClient&, const Color&) = 0;
 #endif
 
     virtual void runOpenPanel(Frame&, FileChooser&) = 0;
     // Asynchronous request to load an icon for specified filenames.
     virtual void loadIconForFiles(const Vector<String>&, FileIconLoader&) = 0;
         
-    virtual void elementDidFocus(const Node*) { };
-    virtual void elementDidBlur(const Node*) { };
-    virtual void elementDidRefocus(const Node*) { };
+    virtual void elementDidFocus(Element&) { }
+    virtual void elementDidBlur(Element&) { }
+    virtual void elementDidRefocus(Element&) { }
     
     virtual bool shouldPaintEntireContents() const { return false; }
     virtual bool hasStablePageScaleFactor() const { return true; }
@@ -291,9 +295,9 @@ public:
     virtual RefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const { return nullptr; }
 #endif
 
-    // Pass 0 as the GraphicsLayer to detatch the root layer.
-    virtual void attachRootGraphicsLayer(Frame*, GraphicsLayer*) = 0;
-    virtual void attachViewOverlayGraphicsLayer(Frame*, GraphicsLayer*) = 0;
+    // Pass nullptr as the GraphicsLayer to detatch the root layer.
+    virtual void attachRootGraphicsLayer(Frame&, GraphicsLayer*) = 0;
+    virtual void attachViewOverlayGraphicsLayer(Frame&, GraphicsLayer*) = 0;
     // Sets a flag to specify that the next time content is drawn to the window,
     // the changes appear on the screen in synchrony with updates to GraphicsLayers.
     virtual void setNeedsOneShotDrawingSynchronization() = 0;
@@ -325,26 +329,28 @@ public:
 
     virtual bool adjustLayerFlushThrottling(LayerFlushThrottleState::Flags) { return false; }
 
-    virtual PassRefPtr<ScrollingCoordinator> createScrollingCoordinator(Page*) const { return nullptr; }
+    virtual RefPtr<ScrollingCoordinator> createScrollingCoordinator(Page&) const { return nullptr; }
 
 #if PLATFORM(WIN) && USE(AVFOUNDATION)
-    virtual GraphicsDeviceAdapter* graphicsDeviceAdapter() const { return 0; }
+    virtual GraphicsDeviceAdapter* graphicsDeviceAdapter() const { return nullptr; }
 #endif
 
     virtual bool supportsVideoFullscreen(HTMLMediaElementEnums::VideoFullscreenMode) { return false; }
+
 #if ENABLE(VIDEO)
     virtual void enterVideoFullscreenForVideoElement(HTMLVideoElement&, HTMLMediaElementEnums::VideoFullscreenMode) { }
     virtual void setUpPlaybackControlsManager(HTMLMediaElement&) { }
     virtual void clearPlaybackControlsManager() { }
 #endif
-    virtual void exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&) { }
-    virtual void exitVideoFullscreenToModeWithoutAnimation(WebCore::HTMLVideoElement&, HTMLMediaElementEnums::VideoFullscreenMode /*targetMode*/) { }
+
+    virtual void exitVideoFullscreenForVideoElement(HTMLVideoElement&) { }
+    virtual void exitVideoFullscreenToModeWithoutAnimation(HTMLVideoElement&, HTMLMediaElementEnums::VideoFullscreenMode) { }
     virtual bool requiresFullscreenForVideoPlayback() { return false; } 
 
 #if ENABLE(FULLSCREEN_API)
-    virtual bool supportsFullScreenForElement(const Element*, bool) { return false; }
-    virtual void enterFullScreenForElement(Element*) { }
-    virtual void exitFullScreenForElement(Element*) { }
+    virtual bool supportsFullScreenForElement(const Element&, bool) { return false; }
+    virtual void enterFullScreenForElement(Element&) { }
+    virtual void exitFullScreenForElement(Element&) { }
     virtual void setRootFullScreenLayer(GraphicsLayer*) { }
 #endif
 
@@ -353,7 +359,7 @@ public:
 #endif
 
 #if PLATFORM(COCOA)
-    virtual NSResponder *firstResponder() { return 0; }
+    virtual NSResponder *firstResponder() { return nullptr; }
     virtual void makeFirstResponder(NSResponder *) { }
     // Focuses on the containing view associated with this page.
     virtual void makeFirstResponder() { }
@@ -377,10 +383,10 @@ public:
     virtual bool selectItemAlignmentFollowsMenuWritingDirection() = 0;
     // Checks if there is an opened popup, called by RenderMenuList::showPopup().
     virtual bool hasOpenedPopup() const = 0;
-    virtual RefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const = 0;
-    virtual RefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const = 0;
+    virtual RefPtr<PopupMenu> createPopupMenu(PopupMenuClient&) const = 0;
+    virtual RefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient&) const = 0;
 
-    virtual void postAccessibilityNotification(AccessibilityObject*, AXObjectCache::AXNotification) { }
+    virtual void postAccessibilityNotification(AccessibilityObject&, AXObjectCache::AXNotification) { }
 
     virtual void notifyScrollerThumbIsVisibleInRect(const IntRect&) { }
     virtual void recommendedScrollbarStyleDidChange(ScrollbarStyle) { }
@@ -408,16 +414,16 @@ public:
     virtual void didAssociateFormControls(const Vector<RefPtr<Element>>&) { };
     virtual bool shouldNotifyOnFormChanges() { return false; };
 
-    virtual void didAddHeaderLayer(GraphicsLayer*) { }
-    virtual void didAddFooterLayer(GraphicsLayer*) { }
+    virtual void didAddHeaderLayer(GraphicsLayer&) { }
+    virtual void didAddFooterLayer(GraphicsLayer&) { }
 
-    virtual bool shouldUseTiledBackingForFrameView(const FrameView*) const { return false; }
+    virtual bool shouldUseTiledBackingForFrameView(const FrameView&) const { return false; }
 
     virtual void isPlayingMediaDidChange(MediaProducer::MediaStateFlags, uint64_t) { }
 
 #if ENABLE(MEDIA_SESSION)
     virtual void hasMediaSessionWithActiveMediaElementsDidChange(bool) { }
-    virtual void mediaSessionMetadataDidChange(const WebCore::MediaSessionMetadata&) { }
+    virtual void mediaSessionMetadataDidChange(const MediaSessionMetadata&) { }
     virtual void focusedContentMediaElementDidChange(uint64_t) { }
 #endif
 
@@ -427,11 +433,12 @@ public:
 #endif
 
 #if ENABLE(TELEPHONE_NUMBER_DETECTION) && PLATFORM(MAC)
-    virtual void handleTelephoneNumberClick(const String&, const WebCore::IntPoint&) { }
+    virtual void handleTelephoneNumberClick(const String&, const IntPoint&) { }
 #endif
+
 #if ENABLE(SERVICE_CONTROLS)
-    virtual void handleSelectionServiceClick(WebCore::FrameSelection&, const Vector<String>&, const WebCore::IntPoint&) { }
-    virtual bool hasRelevantSelectionServices(bool /* isTextOnly */) const { return false; }
+    virtual void handleSelectionServiceClick(FrameSelection&, const Vector<String>&, const IntPoint&) { }
+    virtual bool hasRelevantSelectionServices(bool /*isTextOnly*/) const { return false; }
 #endif
 
     virtual bool shouldDispatchFakeMouseMoveEvents() const { return true; }
@@ -441,13 +448,13 @@ public:
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
     virtual void addPlaybackTargetPickerClient(uint64_t /*contextId*/) { }
     virtual void removePlaybackTargetPickerClient(uint64_t /*contextId*/) { }
-    virtual void showPlaybackTargetPicker(uint64_t /*contextId*/, const WebCore::IntPoint&, bool /* isVideo */) { }
+    virtual void showPlaybackTargetPicker(uint64_t /*contextId*/, const IntPoint&, bool /*isVideo*/) { }
     virtual void playbackTargetPickerClientStateDidChange(uint64_t /*contextId*/, MediaProducer::MediaStateFlags) { }
     virtual void setMockMediaPlaybackTargetPickerEnabled(bool)  { }
-    virtual void setMockMediaPlaybackTargetPickerState(const String&, WebCore::MediaPlaybackTargetContext::State) { }
+    virtual void setMockMediaPlaybackTargetPickerState(const String&, MediaPlaybackTargetContext::State) { }
 #endif
 
-    virtual void imageOrMediaDocumentSizeChanged(const WebCore::IntSize&) { }
+    virtual void imageOrMediaDocumentSizeChanged(const IntSize&) { }
 
 #if ENABLE(VIDEO) && USE(GSTREAMER)
     virtual void requestInstallMissingMediaPlugins(const String& /*details*/, const String& /*description*/, MediaPlayerRequestInstallMissingPluginsCallback&) { }
index 0e7a77b..c1c4948 100644 (file)
@@ -94,7 +94,7 @@ void ContextMenuController::clearContextMenu()
     m_menuProvider = nullptr;
 }
 
-void ContextMenuController::handleContextMenuEvent(Event* event)
+void ContextMenuController::handleContextMenuEvent(Event& event)
 {
     m_contextMenu = maybeCreateContextMenu(event);
     if (!m_contextMenu)
@@ -110,9 +110,9 @@ static std::unique_ptr<ContextMenuItem> separatorItem()
     return std::unique_ptr<ContextMenuItem>(new ContextMenuItem(SeparatorType, ContextMenuItemTagNoAction, String()));
 }
 
-void ContextMenuController::showContextMenu(Event* event, PassRefPtr<ContextMenuProvider> menuProvider)
+void ContextMenuController::showContextMenu(Event& event, ContextMenuProvider& provider)
 {
-    m_menuProvider = menuProvider;
+    m_menuProvider = &provider;
 
     m_contextMenu = maybeCreateContextMenu(event);
     if (!m_contextMenu) {
@@ -120,7 +120,7 @@ void ContextMenuController::showContextMenu(Event* event, PassRefPtr<ContextMenu
         return;
     }
 
-    m_menuProvider->populateContextMenu(m_contextMenu.get());
+    provider.populateContextMenu(m_contextMenu.get());
     if (m_context.hitTestResult().isSelected()) {
         appendItem(*separatorItem(), m_contextMenu.get());
         populate();
@@ -129,33 +129,34 @@ void ContextMenuController::showContextMenu(Event* event, PassRefPtr<ContextMenu
 }
 
 #if ENABLE(SERVICE_CONTROLS)
+
 static Image* imageFromImageElementNode(Node& node)
 {
-    RenderObject* renderer = node.renderer();
+    auto* renderer = node.renderer();
     if (!is<RenderImage>(renderer))
         return nullptr;
-    CachedImage* image = downcast<RenderImage>(*renderer).cachedImage();
+    auto* image = downcast<RenderImage>(*renderer).cachedImage();
     if (!image || image->errorOccurred())
         return nullptr;
-
     return image->imageForRenderer(renderer);
 }
+
 #endif
 
-std::unique_ptr<ContextMenu> ContextMenuController::maybeCreateContextMenu(Event* event)
+std::unique_ptr<ContextMenu> ContextMenuController::maybeCreateContextMenu(Event& event)
 {
-    ASSERT(event);
-    
-    if (!is<MouseEvent>(*event))
+    if (!is<MouseEvent>(event))
         return nullptr;
 
-    MouseEvent& mouseEvent = downcast<MouseEvent>(*event);
-    HitTestResult result(mouseEvent.absoluteLocation());
+    auto& mouseEvent = downcast<MouseEvent>(event);
+    auto* node = mouseEvent.target()->toNode();
+    if (!node)
+        return nullptr;
+    auto* frame = node->document().frame();
+    if (!frame)
+        return nullptr;
 
-    Node* node = event->target()->toNode();
-    if (Frame* frame = node->document().frame())
-        result = frame->eventHandler().hitTestResultAtPoint(mouseEvent.absoluteLocation());
-    
+    auto result = frame->eventHandler().hitTestResultAtPoint(mouseEvent.absoluteLocation());
     if (!result.innerNonSharedNode())
         return nullptr;
 
@@ -163,7 +164,7 @@ std::unique_ptr<ContextMenu> ContextMenuController::maybeCreateContextMenu(Event
 
 #if ENABLE(SERVICE_CONTROLS)
     if (node->isImageControlsButtonElement()) {
-        if (Image* image = imageFromImageElementNode(*result.innerNonSharedNode()))
+        if (auto* image = imageFromImageElementNode(*result.innerNonSharedNode()))
             m_context.setControlledImage(image);
 
         // FIXME: If we couldn't get the image then we shouldn't try to show the image controls menu for it.
@@ -171,24 +172,24 @@ std::unique_ptr<ContextMenu> ContextMenuController::maybeCreateContextMenu(Event
     }
 #endif
 
-    return std::unique_ptr<ContextMenu>(new ContextMenu);
+    return std::make_unique<ContextMenu>();
 }
 
-void ContextMenuController::showContextMenu(Event* event)
+void ContextMenuController::showContextMenu(Event& event)
 {
     if (m_page.inspectorController().enabled())
         addInspectElementItem();
 
-    event->setDefaultHandled();
+    event.setDefaultHandled();
 }
 
-static void openNewWindow(const URL& urlToLoad, Frame* frame, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy)
+static void openNewWindow(const URL& urlToLoad, Frame& frame, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy)
 {
-    Page* oldPage = frame->page();
+    Page* oldPage = frame.page();
     if (!oldPage)
         return;
 
-    FrameLoadRequest request(frame->document()->securityOrigin(), ResourceRequest(urlToLoad, frame->loader().outgoingReferrer()), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Suppress, shouldOpenExternalURLsPolicy);
+    FrameLoadRequest request(frame.document()->securityOrigin(), ResourceRequest(urlToLoad, frame.loader().outgoingReferrer()), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Suppress, shouldOpenExternalURLsPolicy);
 
     Page* newPage = oldPage->chrome().createWindow(frame, request, WindowFeatures(), NavigationAction(request.resourceRequest()));
     if (!newPage)
@@ -198,15 +199,17 @@ static void openNewWindow(const URL& urlToLoad, Frame* frame, ShouldOpenExternal
 }
 
 #if PLATFORM(GTK)
-static void insertUnicodeCharacter(UChar character, Frame* frame)
+
+static void insertUnicodeCharacter(UChar character, Frame& frame)
 {
     String text(&character, 1);
-    if (!frame->editor().shouldInsertText(text, frame->selection().toNormalizedRange().get(), EditorInsertAction::Typed))
+    if (!frame.editor().shouldInsertText(text, frame.selection().toNormalizedRange().get(), EditorInsertAction::Typed))
         return;
 
-    ASSERT(frame->document());
-    TypingCommand::insertText(*frame->document(), text, 0, TypingCommand::TextCompositionNone);
+    ASSERT(frame.document());
+    TypingCommand::insertText(*frame.document(), text, 0, TypingCommand::TextCompositionNone);
 }
+
 #endif
 
 void ContextMenuController::contextMenuItemSelected(ContextMenuAction action, const String& title)
@@ -225,7 +228,7 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuAction action, co
 
     switch (action) {
     case ContextMenuItemTagOpenLinkInNewWindow:
-        openNewWindow(m_context.hitTestResult().absoluteLinkURL(), frame, ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes);
+        openNewWindow(m_context.hitTestResult().absoluteLinkURL(), *frame, ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes);
         break;
     case ContextMenuItemTagDownloadLinkToDisk:
         // FIXME: Some day we should be able to do this from within WebCore. (Bug 117709)
@@ -235,7 +238,7 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuAction action, co
         frame->editor().copyURL(m_context.hitTestResult().absoluteLinkURL(), m_context.hitTestResult().textContent());
         break;
     case ContextMenuItemTagOpenImageInNewWindow:
-        openNewWindow(m_context.hitTestResult().absoluteImageURL(), frame, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
+        openNewWindow(m_context.hitTestResult().absoluteImageURL(), *frame, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
         break;
     case ContextMenuItemTagDownloadImageToDisk:
         // FIXME: Some day we should be able to do this from within WebCore. (Bug 117709)
@@ -252,7 +255,7 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuAction action, co
         break;
 #endif
     case ContextMenuItemTagOpenMediaInNewWindow:
-        openNewWindow(m_context.hitTestResult().absoluteMediaURL(), frame, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
+        openNewWindow(m_context.hitTestResult().absoluteMediaURL(), *frame, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
         break;
     case ContextMenuItemTagDownloadMediaToDisk:
         // FIXME: Some day we should be able to do this from within WebCore. (Bug 117709)
@@ -285,9 +288,9 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuAction action, co
     case ContextMenuItemTagOpenFrameInNewWindow: {
         DocumentLoader* loader = frame->loader().documentLoader();
         if (!loader->unreachableURL().isEmpty())
-            openNewWindow(loader->unreachableURL(), frame, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
+            openNewWindow(loader->unreachableURL(), *frame, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
         else
-            openNewWindow(loader->url(), frame, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
+            openNewWindow(loader->url(), *frame, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
         break;
     }
     case ContextMenuItemTagCopy:
@@ -318,34 +321,34 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuAction action, co
         frame->editor().performDelete();
         break;
     case ContextMenuItemTagUnicodeInsertLRMMark:
-        insertUnicodeCharacter(leftToRightMark, frame);
+        insertUnicodeCharacter(leftToRightMark, *frame);
         break;
     case ContextMenuItemTagUnicodeInsertRLMMark:
-        insertUnicodeCharacter(rightToLeftMark, frame);
+        insertUnicodeCharacter(rightToLeftMark, *frame);
         break;
     case ContextMenuItemTagUnicodeInsertLREMark:
-        insertUnicodeCharacter(leftToRightEmbed, frame);
+        insertUnicodeCharacter(leftToRightEmbed, *frame);
         break;
     case ContextMenuItemTagUnicodeInsertRLEMark:
-        insertUnicodeCharacter(rightToLeftEmbed, frame);
+        insertUnicodeCharacter(rightToLeftEmbed, *frame);
         break;
     case ContextMenuItemTagUnicodeInsertLROMark:
-        insertUnicodeCharacter(leftToRightOverride, frame);
+        insertUnicodeCharacter(leftToRightOverride, *frame);
         break;
     case ContextMenuItemTagUnicodeInsertRLOMark:
-        insertUnicodeCharacter(rightToLeftOverride, frame);
+        insertUnicodeCharacter(rightToLeftOverride, *frame);
         break;
     case ContextMenuItemTagUnicodeInsertPDFMark:
-        insertUnicodeCharacter(popDirectionalFormatting, frame);
+        insertUnicodeCharacter(popDirectionalFormatting, *frame);
         break;
     case ContextMenuItemTagUnicodeInsertZWSMark:
-        insertUnicodeCharacter(zeroWidthSpace, frame);
+        insertUnicodeCharacter(zeroWidthSpace, *frame);
         break;
     case ContextMenuItemTagUnicodeInsertZWJMark:
-        insertUnicodeCharacter(zeroWidthJoiner, frame);
+        insertUnicodeCharacter(zeroWidthJoiner, *frame);
         break;
     case ContextMenuItemTagUnicodeInsertZWNJMark:
-        insertUnicodeCharacter(zeroWidthNonJoiner, frame);
+        insertUnicodeCharacter(zeroWidthNonJoiner, *frame);
         break;
 #endif
 #if PLATFORM(GTK) || PLATFORM(EFL)
@@ -393,7 +396,7 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuAction action, co
         if (Frame* targetFrame = m_context.hitTestResult().targetFrame())
             targetFrame->loader().loadFrameRequest(FrameLoadRequest(frame->document()->securityOrigin(), ResourceRequest(m_context.hitTestResult().absoluteLinkURL(), frame->loader().outgoingReferrer()), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Suppress, targetFrame->isMainFrame() ? ShouldOpenExternalURLsPolicy::ShouldAllow : ShouldOpenExternalURLsPolicy::ShouldNotAllow), nullptr, nullptr);
         else
-            openNewWindow(m_context.hitTestResult().absoluteLinkURL(), frame, ShouldOpenExternalURLsPolicy::ShouldAllow);
+            openNewWindow(m_context.hitTestResult().absoluteLinkURL(), *frame, ShouldOpenExternalURLsPolicy::ShouldAllow);
         break;
     case ContextMenuItemTagBold:
         frame->editor().command("ToggleBold").execute();
@@ -1429,26 +1432,30 @@ void ContextMenuController::checkOrEnableIfNeeded(ContextMenuItem& item) const
 }
 
 #if USE(ACCESSIBILITY_CONTEXT_MENUS)
-void ContextMenuController::showContextMenuAt(Frame* frame, const IntPoint& clickPoint)
+
+void ContextMenuController::showContextMenuAt(Frame& frame, const IntPoint& clickPoint)
 {
     clearContextMenu();
     
     // Simulate a click in the middle of the accessibility object.
     PlatformMouseEvent mouseEvent(clickPoint, clickPoint, RightButton, PlatformEvent::MousePressed, 1, false, false, false, false, currentTime(), ForceAtClick, NoTap);
-    frame->eventHandler().handleMousePressEvent(mouseEvent);
-    bool handled = frame->eventHandler().sendContextMenuEvent(mouseEvent);
+    frame.eventHandler().handleMousePressEvent(mouseEvent);
+    bool handled = frame.eventHandler().sendContextMenuEvent(mouseEvent);
     if (handled)
         m_client.showContextMenu();
 }
+
 #endif
 
 #if ENABLE(SERVICE_CONTROLS)
-void ContextMenuController::showImageControlsMenu(Event* event)
+
+void ContextMenuController::showImageControlsMenu(Event& event)
 {
     clearContextMenu();
     handleContextMenuEvent(event);
     m_client.showContextMenu();
 }
+
 #endif
 
 } // namespace WebCore
index 11256e1..f639648 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 
 #include "ContextMenuContext.h"
 #include "ContextMenuItem.h"
-#include <wtf/Noncopyable.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
 
 namespace WebCore {
 
-class ContextMenu;
 class ContextMenuClient;
-class ContextMenuItem;
 class ContextMenuProvider;
 class Event;
 class Page;
 
 class ContextMenuController {
-    WTF_MAKE_NONCOPYABLE(ContextMenuController); WTF_MAKE_FAST_ALLOCATED;
+    WTF_MAKE_FAST_ALLOCATED;
 public:
     ContextMenuController(Page&, ContextMenuClient&);
     ~ContextMenuController();
@@ -54,8 +49,8 @@ public:
     ContextMenu* contextMenu() const { return m_contextMenu.get(); }
     WEBCORE_EXPORT void clearContextMenu();
 
-    void handleContextMenuEvent(Event*);
-    void showContextMenu(Event*, PassRefPtr<ContextMenuProvider>);
+    void handleContextMenuEvent(Event&);
+    void showContextMenu(Event&, ContextMenuProvider&);
 
     void populate();
     WEBCORE_EXPORT void contextMenuItemSelected(ContextMenuAction, const String& title);
@@ -68,16 +63,16 @@ public:
     const HitTestResult& hitTestResult() const { return m_context.hitTestResult(); }
 
 #if USE(ACCESSIBILITY_CONTEXT_MENUS)
-    void showContextMenuAt(Frame*, const IntPoint& clickPoint);
+    void showContextMenuAt(Frame&, const IntPoint& clickPoint);
 #endif
 
 #if ENABLE(SERVICE_CONTROLS)
-    void showImageControlsMenu(Event*);
+    void showImageControlsMenu(Event&);
 #endif
 
 private:
-    std::unique_ptr<ContextMenu> maybeCreateContextMenu(Event*);
-    void showContextMenu(Event*);
+    std::unique_ptr<ContextMenu> maybeCreateContextMenu(Event&);
+    void showContextMenu(Event&);
     
     void appendItem(ContextMenuItem&, ContextMenu* parentMenu);
 
index 8c27381..6bb8961 100644 (file)
@@ -361,7 +361,7 @@ void DOMTimer::fired()
         if (WKObservedContentChange() == WKContentVisibilityChange || shouldReportLackOfChanges) {
             Document& document = downcast<Document>(context);
             if (Page* page = document.page())
-                page->chrome().client().observedContentChange(document.frame());
+                page->chrome().client().observedContentChange(*document.frame());
         }
     }
 #endif
index 9699650..6269673 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007, 2008, 2010, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2017 Apple Inc. All rights reserved.
  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
  *
  * Redistribution and use in source and binary forms, with or without
@@ -29,7 +29,6 @@
 
 #include "BackForwardController.h"
 #include "BarProp.h"
-#include "BeforeUnloadEvent.h"
 #include "CSSComputedStyleDeclaration.h"
 #include "CSSRule.h"
 #include "CSSRuleList.h"
 #include "WebKitNamespace.h"
 #endif
 
-#if ENABLE(PROXIMITY_EVENTS)
-#include "DeviceProximityController.h"
-#endif
-
 #if ENABLE(GAMEPAD)
 #include "GamepadManager.h"
 #endif
 
+#if ENABLE(GEOLOCATION)
+#include "NavigatorGeolocation.h"
+#endif
+
 #if ENABLE(POINTER_LOCK)
 #include "PointerLockController.h"
 #endif
 
-#if PLATFORM(IOS)
-#if ENABLE(GEOLOCATION)
-#include "NavigatorGeolocation.h"
+#if ENABLE(PROXIMITY_EVENTS)
+#include "DeviceProximityController.h"
 #endif
+
+#if PLATFORM(IOS)
 #include "WKContentObservation.h"
 #endif
 
@@ -150,9 +150,9 @@ namespace WebCore {
 
 class PostMessageTimer : public TimerBase {
 public:
-    PostMessageTimer(DOMWindow& window, PassRefPtr<SerializedScriptValue> message, const String& sourceOrigin, DOMWindow& source, std::unique_ptr<MessagePortChannelArray> channels, RefPtr<SecurityOrigin>&& targetOrigin, RefPtr<ScriptCallStack>&& stackTrace)
+    PostMessageTimer(DOMWindow& window, Ref<SerializedScriptValue>&& message, const String& sourceOrigin, DOMWindow& source, std::unique_ptr<MessagePortChannelArray> channels, RefPtr<SecurityOrigin>&& targetOrigin, RefPtr<ScriptCallStack>&& stackTrace)
         : m_window(window)
-        , m_message(message)
+        , m_message(WTFMove(message))
         , m_origin(sourceOrigin)
         , m_source(source)
         , m_channels(WTFMove(channels))
@@ -181,7 +181,7 @@ private:
     }
 
     Ref<DOMWindow> m_window;
-    RefPtr<SerializedScriptValue> m_message;
+    Ref<SerializedScriptValue> m_message;
     String m_origin;
     Ref<DOMWindow> m_source;
     std::unique_ptr<MessagePortChannelArray> m_channels;
@@ -325,12 +325,10 @@ void DOMWindow::dispatchAllPendingUnloadEvents()
 // 3) Constrains the window rect to within the top and left boundaries of the available screen rect.
 // 4) Constrains the window rect to within the bottom and right boundaries of the available screen rect.
 // 5) Translate the window rect coordinates to be within the coordinate space of the screen.
-FloatRect DOMWindow::adjustWindowRect(Page* page, const FloatRect& pendingChanges)
+FloatRect DOMWindow::adjustWindowRect(Page& page, const FloatRect& pendingChanges)
 {
-    ASSERT(page);
-
-    FloatRect screen = screenAvailableRect(page->mainFrame().view());
-    FloatRect window = page->chrome().windowRect();
+    FloatRect screen = screenAvailableRect(page.mainFrame().view());
+    FloatRect window = page.chrome().windowRect();
 
     // Make sure we're in a valid state before adjusting dimensions.
     ASSERT(std::isfinite(screen.x()));
@@ -352,7 +350,7 @@ FloatRect DOMWindow::adjustWindowRect(Page* page, const FloatRect& pendingChange
     if (!std::isnan(pendingChanges.height()))
         window.setHeight(pendingChanges.height());
 
-    FloatSize minimumSize = page->chrome().client().minimumWindowSize();
+    FloatSize minimumSize = page.chrome().client().minimumWindowSize();
     window.setWidth(std::min(std::max(minimumSize.width(), window.width()), screen.width()));
     window.setHeight(std::min(std::max(minimumSize.height(), window.height()), screen.height()));
 
@@ -363,38 +361,31 @@ FloatRect DOMWindow::adjustWindowRect(Page* page, const FloatRect& pendingChange
     return window;
 }
 
-bool DOMWindow::allowPopUp(Frame* firstFrame)
+bool DOMWindow::allowPopUp(Frame& firstFrame)
 {
-    ASSERT(firstFrame);
-    
-    auto& settings = firstFrame->settings();
-
-    if (ScriptController::processingUserGesture() || settings.allowWindowOpenWithoutUserGesture())
-        return true;
-
-    return settings.javaScriptCanOpenWindowsAutomatically();
+    auto& settings = firstFrame.settings();
+    return ScriptController::processingUserGesture()
+        || settings.allowWindowOpenWithoutUserGesture()
+        || settings.javaScriptCanOpenWindowsAutomatically();
 }
 
 bool DOMWindow::allowPopUp()
 {
-    return m_frame && allowPopUp(m_frame);
+    return m_frame && allowPopUp(*m_frame);
 }
 
-bool DOMWindow::canShowModalDialog(const Frame* frame)
+bool DOMWindow::canShowModalDialog(const Frame& frame)
 {
-    if (!frame)
-        return false;
-
     // Override support for layout testing purposes.
-    if (auto* document = frame->document()) {
+    if (auto* document = frame.document()) {
         if (auto* window = document->domWindow()) {
             if (window->m_canShowModalDialogOverride)
                 return window->m_canShowModalDialogOverride.value();
         }
     }
 
-    auto* page = frame->page();
-    return page ? page->chrome().canRunModal() : false;
+    auto* page = frame.page();
+    return page && page->chrome().canRunModal();
 }
 
 static void languagesChangedCallback(void* context)
@@ -407,20 +398,18 @@ void DOMWindow::setCanShowModalDialogOverride(bool allow)
     m_canShowModalDialogOverride = allow;
 }
 
-DOMWindow::DOMWindow(Document* document)
-    : ContextDestructionObserver(document)
-    , FrameDestructionObserver(document->frame())
+DOMWindow::DOMWindow(Document& document)
+    : ContextDestructionObserver(&document)
+    , FrameDestructionObserver(document.frame())
     , m_weakPtrFactory(this)
 {
     ASSERT(frame());
-    ASSERT(DOMWindow::document());
-
     addLanguageChangeObserver(this, &languagesChangedCallback);
 }
 
-void DOMWindow::didSecureTransitionTo(Document* document)
+void DOMWindow::didSecureTransitionTo(Document& document)
 {
-    observeContext(document);
+    observeContext(&document);
 }
 
 DOMWindow::~DOMWindow()
@@ -547,14 +536,14 @@ void DOMWindow::decrementGamepadEventListenerCount()
 
 #endif
 
-void DOMWindow::registerProperty(DOMWindowProperty* property)
+void DOMWindow::registerProperty(DOMWindowProperty& property)
 {
-    m_properties.add(property);
+    m_properties.add(&property);
 }
 
-void DOMWindow::unregisterProperty(DOMWindowProperty* property)
+void DOMWindow::unregisterProperty(DOMWindowProperty& property)
 {
-    m_properties.remove(property);
+    m_properties.remove(&property);
 }
 
 void DOMWindow::resetUnlessSuspendedForDocumentSuspension()
@@ -974,23 +963,18 @@ void DOMWindow::postMessageTimerFired(PostMessageTimer& timer)
     if (!document() || !isCurrentlyDisplayedInFrame())
         return;
 
-    dispatchMessageEventWithOriginCheck(timer.targetOrigin(), timer.event(*document()), timer.stackTrace());
-}
-
-void DOMWindow::dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigin, Event& event, PassRefPtr<ScriptCallStack> stackTrace)
-{
-    if (intendedTargetOrigin) {
+    if (auto* intendedTargetOrigin = timer.targetOrigin()) {
         // Check target origin now since the target document may have changed since the timer was scheduled.
         if (!intendedTargetOrigin->isSameSchemeHostPort(document()->securityOrigin())) {
-            if (PageConsoleClient* pageConsole = console()) {
+            if (auto* pageConsole = console()) {
                 String message = makeString("Unable to post message to ", intendedTargetOrigin->toString(), ". Recipient has origin ", document()->securityOrigin().toString(), ".\n");
-                pageConsole->addMessage(MessageSource::Security, MessageLevel::Error, message, stackTrace);
+                pageConsole->addMessage(MessageSource::Security, MessageLevel::Error, message, timer.stackTrace());
             }
             return;
         }
     }
 
-    dispatchEvent(event);
+    dispatchEvent(timer.event(*document()));
 }
 
 DOMSelection* DOMWindow::getSelection()
@@ -1113,7 +1097,7 @@ void DOMWindow::print()
         return;
     }
     m_shouldPrintWhenFinishedLoading = false;
-    page->chrome().print(m_frame);
+    page->chrome().print(*m_frame);
 }
 
 void DOMWindow::stop()
@@ -1145,7 +1129,7 @@ void DOMWindow::alert(const String& message)
     page->pointerLockController().requestPointerUnlock();
 #endif
 
-    page->chrome().runJavaScriptAlert(m_frame, message);
+    page->chrome().runJavaScriptAlert(*m_frame, message);
 }
 
 bool DOMWindow::confirm(const String& message)
@@ -1167,7 +1151,7 @@ bool DOMWindow::confirm(const String& message)
     page->pointerLockController().requestPointerUnlock();
 #endif
 
-    return page->chrome().runJavaScriptConfirm(m_frame, message);
+    return page->chrome().runJavaScriptConfirm(*m_frame, message);
 }
 
 String DOMWindow::prompt(const String& message, const String& defaultValue)
@@ -1190,7 +1174,7 @@ String DOMWindow::prompt(const String& message, const String& defaultValue)
 #endif
 
     String returnValue;
-    if (page->chrome().runJavaScriptPrompt(m_frame, message, defaultValue, returnValue))
+    if (page->chrome().runJavaScriptPrompt(*m_frame, message, defaultValue, returnValue))
         return returnValue;
 
     return String();
@@ -1368,7 +1352,7 @@ void DOMWindow::setStatus(const String& string)
         return;
 
     ASSERT(m_frame->document()); // Client calls shouldn't be made when the frame is in inconsistent state.
-    page->chrome().setStatusbarText(m_frame, m_status);
+    page->chrome().setStatusbarText(*m_frame, m_status);
 } 
     
 void DOMWindow::setDefaultStatus(const String& string) 
@@ -1383,7 +1367,7 @@ void DOMWindow::setDefaultStatus(const String& string)
         return;
 
     ASSERT(m_frame->document()); // Client calls shouldn't be made when the frame is in inconsistent state.
-    page->chrome().setStatusbarText(m_frame, m_defaultStatus);
+    page->chrome().setStatusbarText(*m_frame, m_defaultStatus);
 }
 
 DOMWindow* DOMWindow::self() const
@@ -1432,8 +1416,7 @@ DOMWindow* DOMWindow::top() const
 
 Document* DOMWindow::document() const
 {
-    ScriptExecutionContext* context = ContextDestructionObserver::scriptExecutionContext();
-    return downcast<Document>(context);
+    return downcast<Document>(ContextDestructionObserver::scriptExecutionContext());
 }
 
 RefPtr<StyleMedia> DOMWindow::styleMedia() const
@@ -1618,8 +1601,7 @@ void DOMWindow::moveBy(float x, float y) const
     FloatRect fr = page->chrome().windowRect();
     FloatRect update = fr;
     update.move(x, y);
-    // Security check (the spec talks about UniversalBrowserWrite to disable this check...)
-    page->chrome().setWindowRect(adjustWindowRect(page, update));
+    page->chrome().setWindowRect(adjustWindowRect(*page, update));
 }
 
 void DOMWindow::moveTo(float x, float y) const
@@ -1633,8 +1615,7 @@ void DOMWindow::moveTo(float x, float y) const
     fr.setLocation(sr.location());
     FloatRect update = fr;
     update.move(x, y);
-    // Security check (the spec talks about UniversalBrowserWrite to disable this check...)
-    page->chrome().setWindowRect(adjustWindowRect(page, update));
+    page->chrome().setWindowRect(adjustWindowRect(*page, update));
 }
 
 void DOMWindow::resizeBy(float x, float y) const
@@ -1646,7 +1627,7 @@ void DOMWindow::resizeBy(float x, float y) const
     FloatRect fr = page->chrome().windowRect();
     FloatSize dest = fr.size() + FloatSize(x, y);
     FloatRect update(fr.location(), dest);
-    page->chrome().setWindowRect(adjustWindowRect(page, update));
+    page->chrome().setWindowRect(adjustWindowRect(*page, update));
 }
 
 void DOMWindow::resizeTo(float width, float height) const
@@ -1658,7 +1639,7 @@ void DOMWindow::resizeTo(float width, float height) const
     FloatRect fr = page->chrome().windowRect();
     FloatSize dest = FloatSize(width, height);
     FloatRect update(fr.location(), dest);
-    page->chrome().setWindowRect(adjustWindowRect(page, update));
+    page->chrome().setWindowRect(adjustWindowRect(*page, update));
 }
 
 ExceptionOr<int> DOMWindow::setTimeout(std::unique_ptr<ScheduledAction> action, int timeout)
@@ -1681,7 +1662,7 @@ void DOMWindow::clearTimeout(int timeoutId)
 
                 if (!WebThreadCountOfObservedContentModifiers()) {
                     if (Page* page = m_frame->page())
-                        page->chrome().client().observedContentChange(m_frame);
+                        page->chrome().client().observedContentChange(*m_frame);
                 }
             }
         }
@@ -1841,7 +1822,7 @@ void DOMWindow::incrementScrollEventListenersCount()
     if (++m_scrollEventListenerCount == 1 && document == &document->topDocument()) {
         Frame* frame = this->frame();
         if (frame && frame->page())
-            frame->page()->chrome().client().setNeedsScrollNotifications(frame, true);
+            frame->page()->chrome().client().setNeedsScrollNotifications(*frame, true);
     }
 }
 
@@ -1851,7 +1832,7 @@ void DOMWindow::decrementScrollEventListenersCount()
     if (!--m_scrollEventListenerCount && document == &document->topDocument()) {
         Frame* frame = this->frame();
         if (frame && frame->page() && document->pageCacheState() == Document::NotInPageCache)
-            frame->page()->chrome().client().setNeedsScrollNotifications(frame, false);
+            frame->page()->chrome().client().setNeedsScrollNotifications(*frame, false);
     }
 }
 
@@ -1859,7 +1840,7 @@ void DOMWindow::decrementScrollEventListenersCount()
 
 void DOMWindow::resetAllGeolocationPermission()
 {
-    // FIXME: Remove PLATFORM(IOS)-guard once we upstream the iOS changes to Geolocation.cpp.
+    // FIXME: Can we remove the PLATFORM(IOS)-guard?
 #if ENABLE(GEOLOCATION) && PLATFORM(IOS)
     if (m_navigator)
         NavigatorGeolocation::from(m_navigator.get())->resetAllGeolocationPermission();
@@ -2287,8 +2268,7 @@ void DOMWindow::showModalDialog(const String& urlString, const String& dialogFea
 {
     if (!isCurrentlyDisplayedInFrame())
         return;
-    Frame* activeFrame = activeWindow.frame();
-    if (!activeFrame)
+    if (!activeWindow.frame())
         return;
     Frame* firstFrame = firstWindow.frame();
     if (!firstFrame)
@@ -2303,7 +2283,7 @@ void DOMWindow::showModalDialog(const String& urlString, const String& dialogFea
         return;
     }
 
-    if (!canShowModalDialog(m_frame) || !firstWindow.allowPopUp())
+    if (!canShowModalDialog(*m_frame) || !firstWindow.allowPopUp())
         return;
 
     RefPtr<Frame> dialogFrame = createWindow(urlString, emptyAtom, parseDialogFeatures(dialogFeaturesString, screenAvailableRect(m_frame->view())), activeWindow, *firstFrame, *m_frame, WTFMove(prepareDialogFunction));
index c5e9028..e007016 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2017 Apple Inc. All rights reserved.
  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
  *
  * Redistribution and use in source and binary forms, with or without
 #include "FrameDestructionObserver.h"
 #include "ScrollToOptions.h"
 #include "Supplementable.h"
-#include "URL.h"
-#include <functional>
-#include <memory>
-#include <wtf/Forward.h>
 #include <wtf/HashSet.h>
-#include <wtf/Optional.h>
 #include <wtf/WeakPtr.h>
 
-namespace Inspector {
-class ScriptCallStack;
-}
-
 namespace JSC {
 class ExecState;
 class JSObject;
 class JSValue;
-template<typename T> class Strong;
+template<typename> class Strong;
 }
 
 namespace WebCore {
@@ -61,22 +52,15 @@ class Crypto;
 class CustomElementRegistry;
 class DOMApplicationCache;
 class DOMSelection;
-class DOMURL;
 class DOMWindowProperty;
 class DOMWrapperWorld;
-class Database;
-class DatabaseCallback;
 class Document;
 class Element;
 class EventListener;
 class FloatRect;
-class Frame;
 class History;
-class IDBFactory;
 class Location;
 class MediaQueryList;
-class MessageEvent;
-class MessagePort;
 class Navigator;
 class Node;
 class NodeList;
@@ -87,8 +71,6 @@ class PostMessageTimer;
 class RequestAnimationFrameCallback;
 class ScheduledAction;
 class Screen;
-class SecurityOrigin;
-class SerializedScriptValue;
 class Storage;
 class StyleMedia;
 class WebKitNamespace;
@@ -107,7 +89,7 @@ class DOMWindow final
     , public Base64Utilities
     , public Supplementable<DOMWindow> {
 public:
-    static Ref<DOMWindow> create(Document* document) { return adoptRef(*new DOMWindow(document)); }
+    static Ref<DOMWindow> create(Document& document) { return adoptRef(*new DOMWindow(document)); }
     WEBCORE_EXPORT virtual ~DOMWindow();
 
     // In some rare cases, we'll reuse a DOMWindow for a new Document. For example,
@@ -117,15 +99,10 @@ public:
     // won't be blown away when the network load commits. To make that happen, we
     // "securely transition" the existing DOMWindow to the Document that results from
     // the network load. See also SecurityContext::isSecureTransitionTo.
-    void didSecureTransitionTo(Document*);
-
-    EventTargetInterface eventTargetInterface() const override { return DOMWindowEventTargetInterfaceType; }
-    ScriptExecutionContext* scriptExecutionContext() const override { return ContextDestructionObserver::scriptExecutionContext(); }
-
-    DOMWindow* toDOMWindow() override;
+    void didSecureTransitionTo(Document&);
 
-    void registerProperty(DOMWindowProperty*);
-    void unregisterProperty(DOMWindowProperty*);
+    void registerProperty(DOMWindowProperty&);
+    void unregisterProperty(DOMWindowProperty&);
 
     void resetUnlessSuspendedForDocumentSuspension();
     void suspendForDocumentSuspension();
@@ -138,11 +115,11 @@ public:
     WEBCORE_EXPORT static bool dispatchAllPendingBeforeUnloadEvents();
     WEBCORE_EXPORT static void dispatchAllPendingUnloadEvents();
 
-    static FloatRect adjustWindowRect(Page*, const FloatRect& pendingChanges);
+    static FloatRect adjustWindowRect(Page&, const FloatRect& pendingChanges);
 
     bool allowPopUp(); // Call on first window, not target window.
-    static bool allowPopUp(Frame* firstFrame);
-    static bool canShowModalDialog(const Frame*);
+    static bool allowPopUp(Frame& firstFrame);
+    static bool canShowModalDialog(const Frame&);
     WEBCORE_EXPORT void setCanShowModalDialogOverride(bool);
 
     Screen* screen() const;
@@ -245,7 +222,6 @@ public:
 
     ExceptionOr<void> postMessage(JSC::ExecState&, DOMWindow& callerWindow, JSC::JSValue message, const String& targetOrigin, Vector<JSC::Strong<JSC::JSObject>>&&);
     void postMessageTimerFired(PostMessageTimer&);
-    void dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigin, Event&, PassRefPtr<Inspector::ScriptCallStack>);
 
     void languagesChanged();
 
@@ -272,9 +248,9 @@ public:
 
     // Events
     // EventTarget API
-    bool addEventListener(const AtomicString& eventType, Ref<EventListener>&&, const AddEventListenerOptions&) override;
-    bool removeEventListener(const AtomicString& eventType, EventListener&, const ListenerOptions&) override;
-    void removeAllEventListeners() override;
+    bool addEventListener(const AtomicString& eventType, Ref<EventListener>&&, const AddEventListenerOptions&) final;
+    bool removeEventListener(const AtomicString& eventType, EventListener&, const ListenerOptions&) final;
+    void removeAllEventListeners() final;
 
     using EventTarget::dispatchEvent;
     bool dispatchEvent(Event&, EventTarget*);
@@ -286,8 +262,8 @@ public:
 
     void finishedLoading();
 
-    using RefCounted<DOMWindow>::ref;
-    using RefCounted<DOMWindow>::deref;
+    using RefCounted::ref;
+    using RefCounted::deref;
 
     // HTML 5 key/value storage
     ExceptionOr<Storage*> sessionStorage() const;
@@ -313,6 +289,7 @@ public:
 #if ENABLE(WEB_TIMING)
     Performance* performance() const;
 #endif
+
     double nowTimestamp() const;
 
 #if PLATFORM(IOS)
@@ -347,16 +324,21 @@ public:
     WeakPtr<DOMWindow> createWeakPtr() { return m_weakPtrFactory.createWeakPtr(); }
 
 private:
-    explicit DOMWindow(Document*);
+    explicit DOMWindow(Document&);
+
+    EventTargetInterface eventTargetInterface() const final { return DOMWindowEventTargetInterfaceType; }
+    ScriptExecutionContext* scriptExecutionContext() const final { return ContextDestructionObserver::scriptExecutionContext(); }
+
+    DOMWindow* toDOMWindow() final;
 
     Page* page();
     bool allowedToChangeWindowGeometry() const;
 
-    void frameDestroyed() override;
-    void willDetachPage() override;
+    void frameDestroyed() final;
+    void willDetachPage() final;
 
-    void refEventTarget() override { ref(); }
-    void derefEventTarget() override { deref(); }
+    void refEventTarget() final { ref(); }
+    void derefEventTarget() final { deref(); }
 
     static RefPtr<Frame> createWindow(const String& urlString, const AtomicString& frameName, const WindowFeatures&, DOMWindow& activeWindow, Frame& firstFrame, Frame& openerFrame, std::function<void(DOMWindow&)> prepareDialogFunction = nullptr);
     bool isInsecureScriptAccess(DOMWindow& activeWindow, const String& urlString);
index a3770e8..55096b6 100644 (file)
@@ -42,14 +42,14 @@ DOMWindowProperty::DOMWindowProperty(Frame* frame)
     // We should fix that.  <rdar://problem/11567132>
     if (m_frame) {
         m_associatedDOMWindow = m_frame->document()->domWindow();
-        m_associatedDOMWindow->registerProperty(this);
+        m_associatedDOMWindow->registerProperty(*this);
     }
 }
 
 DOMWindowProperty::~DOMWindowProperty()
 {
     if (m_associatedDOMWindow)
-        m_associatedDOMWindow->unregisterProperty(this);
+        m_associatedDOMWindow->unregisterProperty(*this);
 
     m_associatedDOMWindow = nullptr;
     m_frame = nullptr;
@@ -86,7 +86,7 @@ void DOMWindowProperty::willDestroyGlobalObjectInCachedFrame()
     // DOMWindowProperty lifetime isn't tied directly to the DOMWindow itself so it is important that it unregister
     // itself from any DOMWindow it is associated with if that DOMWindow is going away.
     if (m_associatedDOMWindow)
-        m_associatedDOMWindow->unregisterProperty(this);
+        m_associatedDOMWindow->unregisterProperty(*this);
     m_associatedDOMWindow = nullptr;
     m_frame = nullptr;
 }
@@ -100,7 +100,7 @@ void DOMWindowProperty::willDestroyGlobalObjectInFrame()
     // DOMWindowProperty lifetime isn't tied directly to the DOMWindow itself so it is important that it unregister
     // itself from any DOMWindow it is associated with if that DOMWindow is going away.
     if (m_associatedDOMWindow)
-        m_associatedDOMWindow->unregisterProperty(this);
+        m_associatedDOMWindow->unregisterProperty(*this);
     m_associatedDOMWindow = nullptr;
     m_frame = nullptr;
 }
index caa07a4..e8e7559 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -36,7 +36,6 @@
 #include "Region.h"
 #include "ScrollingCoordinator.h"
 #include "Settings.h"
-#include <wtf/RefPtr.h>
 
 namespace WebCore {
 
@@ -44,7 +43,7 @@ DebugPageOverlays* DebugPageOverlays::sharedDebugOverlays;
 
 class RegionOverlay : public RefCounted<RegionOverlay>, public PageOverlay::Client {
 public:
-    static PassRefPtr<RegionOverlay> create(MainFrame&, DebugPageOverlays::RegionType);
+    static Ref<RegionOverlay> create(MainFrame&, DebugPageOverlays::RegionType);
     virtual ~RegionOverlay();
 
     void recomputeRegion();
@@ -70,7 +69,6 @@ protected:
     Color m_color;
 };
 
-
 class MouseWheelRegionOverlay final : public RegionOverlay {
 public:
     static Ref<MouseWheelRegionOverlay> create(MainFrame& frame)
@@ -89,17 +87,14 @@ private:
 
 bool MouseWheelRegionOverlay::updateRegion()
 {
-    std::unique_ptr<Region> region = std::make_unique<Region>();
+    auto region = std::make_unique<Region>();
     
     for (const Frame* frame = &m_frame; frame; frame = frame->tree().traverseNext()) {
         if (!frame->view() || !frame->document())
             continue;
 
-        Document::RegionFixedPair frameRegion = frame->document()->absoluteRegionForEventTargets(frame->document()->wheelEventTargets());
-    
-        IntPoint frameOffset = frame->view()->contentsToRootView(IntPoint());
-        frameRegion.first.translate(toIntSize(frameOffset));
-        
+        auto frameRegion = frame->document()->absoluteRegionForEventTargets(frame->document()->wheelEventTargets());
+        frameRegion.first.translate(toIntSize(frame->view()->contentsToRootView(IntPoint())));
         region->unite(frameRegion.first);
     }
     
@@ -128,7 +123,7 @@ private:
 
 bool NonFastScrollableRegionOverlay::updateRegion()
 {
-    std::unique_ptr<Region> region = std::make_unique<Region>();
+    auto region = std::make_unique<Region>();
 
     if (Page* page = m_frame.page()) {
         if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator()) {
@@ -143,16 +138,16 @@ bool NonFastScrollableRegionOverlay::updateRegion()
     return regionChanged;
 }
 
-PassRefPtr<RegionOverlay> RegionOverlay::create(MainFrame& frame, DebugPageOverlays::RegionType regionType)
+Ref<RegionOverlay> RegionOverlay::create(MainFrame& frame, DebugPageOverlays::RegionType regionType)
 {
     switch (regionType) {
     case DebugPageOverlays::RegionType::WheelEventHandlers:
         return MouseWheelRegionOverlay::create(frame);
-
     case DebugPageOverlays::RegionType::NonFastScrollableRegion:
         return NonFastScrollableRegionOverlay::create(frame);
     }
-    return nullptr;
+    ASSERT_NOT_REACHED();
+    return MouseWheelRegionOverlay::create(frame);
 }
 
 RegionOverlay::RegionOverlay(MainFrame& frame, Color regionColor)
@@ -165,7 +160,7 @@ RegionOverlay::RegionOverlay(MainFrame& frame, Color regionColor)
 RegionOverlay::~RegionOverlay()
 {
     if (m_overlay)
-        m_frame.pageOverlayController().uninstallPageOverlay(m_overlay.get(), PageOverlay::FadeMode::DoNotFade);
+        m_frame.pageOverlayController().uninstallPageOverlay(*m_overlay, PageOverlay::FadeMode::DoNotFade);
 }
 
 void RegionOverlay::willMoveToPage(PageOverlay&, Page* page)
@@ -186,11 +181,10 @@ void RegionOverlay::drawRect(PageOverlay&, GraphicsContext& context, const IntRe
 
     if (!m_region)
         return;
-    
+
     GraphicsContextStateSaver saver(context);
     context.setFillColor(m_color);
     for (auto rect : m_region->rects()) {
-    
         if (rect.intersects(dirtyRect))
             context.fillRect(rect);
     }
@@ -228,54 +222,49 @@ RegionOverlay& DebugPageOverlays::ensureRegionOverlayForFrame(MainFrame& frame,
 {
     auto it = m_frameRegionOverlays.find(&frame);
     if (it != m_frameRegionOverlays.end()) {
-        auto& visualizers = it->value;
-        
-        if (!visualizers[indexOf(regionType)])
-            visualizers[indexOf(regionType)] = RegionOverlay::create(frame, regionType);
-
-        return *visualizers[indexOf(regionType)];
+        auto& visualizer = it->value[indexOf(regionType)];
+        if (!visualizer)
+            visualizer = RegionOverlay::create(frame, regionType);
+        return *visualizer;
     }
 
     Vector<RefPtr<RegionOverlay>> visualizers(NumberOfRegionTypes);
-    
-    RefPtr<RegionOverlay> visualizer = RegionOverlay::create(frame, regionType);
-    visualizers[indexOf(regionType)] = visualizer;
-
+    auto visualizer = RegionOverlay::create(frame, regionType);
+    visualizers[indexOf(regionType)] = visualizer.copyRef();
     m_frameRegionOverlays.add(&frame, WTFMove(visualizers));
-    return *visualizer;
+    return visualizer;
 }
 
 void DebugPageOverlays::showRegionOverlay(MainFrame& frame, RegionType regionType)
 {
-    RegionOverlay& visualizer = ensureRegionOverlayForFrame(frame, regionType);
-    frame.pageOverlayController().installPageOverlay(&visualizer.overlay(), PageOverlay::FadeMode::DoNotFade);
+    auto& visualizer = ensureRegionOverlayForFrame(frame, regionType);
+    frame.pageOverlayController().installPageOverlay(visualizer.overlay(), PageOverlay::FadeMode::DoNotFade);
 }
 
 void DebugPageOverlays::hideRegionOverlay(MainFrame& frame, RegionType regionType)
 {
     auto it = m_frameRegionOverlays.find(&frame);
-    if (it != m_frameRegionOverlays.end()) {
-        auto& visualizers = it->value;
-        if (RegionOverlay* visualizer = visualizers[indexOf(regionType)].get()) {
-            frame.pageOverlayController().uninstallPageOverlay(&visualizer->overlay(), PageOverlay::FadeMode::DoNotFade);
-            visualizers[indexOf(regionType)] = nullptr;
-        }
-    }
+    if (it == m_frameRegionOverlays.end())
+        return;
+    auto& visualizer = it->value[indexOf(regionType)];
+    if (!visualizer)
+        return;
+    frame.pageOverlayController().uninstallPageOverlay(visualizer->overlay(), PageOverlay::FadeMode::DoNotFade);
+    visualizer = nullptr;
 }
 
 void DebugPageOverlays::regionChanged(Frame& frame, RegionType regionType)
 {
-    if (RegionOverlay* visualizer = regionOverlayForFrame(frame.mainFrame(), regionType))
+    if (auto* visualizer = regionOverlayForFrame(frame.mainFrame(), regionType))
         visualizer->recomputeRegion();
 }
 
 RegionOverlay* DebugPageOverlays::regionOverlayForFrame(MainFrame& frame, RegionType regionType) const
 {
     auto it = m_frameRegionOverlays.find(&frame);
-    if (it != m_frameRegionOverlays.end())
-        return it->value.at(indexOf(regionType)).get();
-
-    return nullptr;
+    if (it == m_frameRegionOverlays.end())
+        return nullptr;
+    return it->value.at(indexOf(regionType)).get();
 }
 
 void DebugPageOverlays::updateOverlayRegionVisibility(MainFrame& frame, DebugOverlayRegions visibleRegions)
index f2318a0..b6d2746 100644 (file)
@@ -195,9 +195,9 @@ void DragController::dragExited(const DragData& dragData)
 #else
         DataTransferAccessPolicy policy = DataTransferAccessPolicy::TypesReadable;
 #endif
-        RefPtr<DataTransfer> dataTransfer = DataTransfer::createForDragAndDrop(policy, dragData);
+        auto dataTransfer = DataTransfer::createForDragAndDrop(policy, dragData);
         dataTransfer->setSourceOperation(dragData.draggingSourceOperationMask());
-        m_page.mainFrame().eventHandler().cancelDragAndDrop(createMouseEvent(dragData), dataTransfer.get());
+        m_page.mainFrame().eventHandler().cancelDragAndDrop(createMouseEvent(dragData), dataTransfer);
         dataTransfer->setAccessPolicy(DataTransferAccessPolicy::Numb); // Invalidate dataTransfer here for security.
     }
     mouseMovedIntoDocument(nullptr);
@@ -225,9 +225,9 @@ bool DragController::performDragOperation(const DragData& dragData)
         bool preventedDefault = false;
         if (mainFrame->view()) {
             // Sending an event can result in the destruction of the view and part.
-            RefPtr<DataTransfer> dataTransfer = DataTransfer::createForDragAndDrop(DataTransferAccessPolicy::Readable, dragData);
+            auto dataTransfer = DataTransfer::createForDragAndDrop(DataTransferAccessPolicy::Readable, dragData);
             dataTransfer->setSourceOperation(dragData.draggingSourceOperationMask());
-            preventedDefault = mainFrame->eventHandler().performDragAndDrop(createMouseEvent(dragData), dataTransfer.get());
+            preventedDefault = mainFrame->eventHandler().performDragAndDrop(createMouseEvent(dragData), dataTransfer);
             dataTransfer->setAccessPolicy(DataTransferAccessPolicy::Numb); // Invalidate dataTransfer here for security.
         }
         if (preventedDefault) {
@@ -547,7 +547,7 @@ bool DragController::concludeEditDrag(const DragData& dragData)
 
     if (rootEditableElement) {
         if (Frame* frame = rootEditableElement->document().frame())
-            frame->eventHandler().updateDragStateAfterEditDragIfNeeded(rootEditableElement.get());
+            frame->eventHandler().updateDragStateAfterEditDragIfNeeded(*rootEditableElement);
     }
 
     return true;
@@ -616,12 +616,12 @@ bool DragController::tryDHTMLDrag(const DragData& dragData, DragOperation& opera
 #else
     DataTransferAccessPolicy policy = DataTransferAccessPolicy::TypesReadable;
 #endif
-    RefPtr<DataTransfer> dataTransfer = DataTransfer::createForDragAndDrop(policy, dragData);
+    auto dataTransfer = DataTransfer::createForDragAndDrop(policy, dragData);
     DragOperation srcOpMask = dragData.draggingSourceOperationMask();
     dataTransfer->setSourceOperation(srcOpMask);
 
     PlatformMouseEvent event = createMouseEvent(dragData);
-    if (!mainFrame->eventHandler().updateDragAndDrop(event, dataTransfer.get())) {
+    if (!mainFrame->eventHandler().updateDragAndDrop(event, dataTransfer)) {
         dataTransfer->setAccessPolicy(DataTransferAccessPolicy::Numb); // Invalidate dataTransfer here for security.
         return false;
     }
index 923e416..5a5a35e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2017 Apple Inc. All rights reserved.
  * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
  * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
  *
 #include "config.h"
 #include "EventHandler.h"
 
-#include "AXObjectCache.h"
 #include "AutoscrollController.h"
 #include "BackForwardController.h"
 #include "CachedImage.h"
 #include "Chrome.h"
 #include "ChromeClient.h"
-#include "Cursor.h"
 #include "CursorList.h"
-#include "Document.h"
-#include "DocumentEventQueue.h"
 #include "DragController.h"
 #include "DragState.h"
 #include "Editor.h"
 #include "UserTypingGestureIndicator.h"
 #include "VisibleUnits.h"
 #include "WheelEvent.h"
+#include "WheelEventDeltaFilter.h"
 #include "WindowsKeyboardCodes.h"
 #include "htmlediting.h"
 #include <wtf/Assertions.h>
 #include <wtf/CurrentTime.h>
 #include <wtf/NeverDestroyed.h>
 #include <wtf/StdLibExtras.h>
-#include <wtf/WeakPtr.h>
 
 #if ENABLE(IOS_TOUCH_EVENTS)
 #include "PlatformTouchEventIOS.h"
@@ -176,21 +172,6 @@ const int maximumCursorSize = 128;
 const double minimumCursorScale = 0.001;
 #endif
 
-enum NoCursorChangeType { NoCursorChange };
-
-class OptionalCursor {
-public:
-    OptionalCursor(NoCursorChangeType) : m_isCursorChange(false) { }
-    OptionalCursor(const Cursor& cursor) : m_isCursorChange(true), m_cursor(cursor) { }
-
-    bool isCursorChange() const { return m_isCursorChange; }
-    const Cursor& cursor() const { ASSERT(m_isCursorChange); return m_cursor; }
-
-private:
-    bool m_isCursorChange;
-    Cursor m_cursor;
-};
-
 class MaximumDurationTracker {
 public:
     explicit MaximumDurationTracker(double *maxDuration)
@@ -405,12 +386,14 @@ EventHandler::~EventHandler()
 }
     
 #if ENABLE(DRAG_SUPPORT)
+
 DragState& EventHandler::dragState()
 {
     static NeverDestroyed<DragState> state;
     return state;
 }
-#endif // ENABLE(DRAG_SUPPORT)
+
+#endif
     
 void EventHandler::clear()
 {
@@ -800,14 +783,15 @@ bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& eve
 
     m_mousePressNode = event.targetNode();
     m_frame.document()->setFocusNavigationStartingNode(event.targetNode());
+
 #if ENABLE(DRAG_SUPPORT)
-    m_dragStartPos = event.event().position();
+    m_dragStartPosition = event.event().position();
 #endif
 
-    bool swallowEvent = false;
     m_mousePressed = true;
     m_selectionInitiationState = HaveNotStartedSelection;
 
+    bool swallowEvent = false;
     if (event.event().clickCount() == 2)
         swallowEvent = handleMousePressEventDoubleClick(event);
     else if (event.event().clickCount() >= 3)
@@ -977,11 +961,11 @@ void EventHandler::updateSelectionForMouseDrag(const HitTestResult& hitTestResul
         newSelection.setExtent(positionAfterNode(rootUserSelectAllForMousePressNode).downstream(CanCrossEditingBoundary));
     } else {
         // Reset base for user select all when base is inside user-select-all area and extent < base.
-        if (rootUserSelectAllForMousePressNode && comparePositions(target->renderer()->positionForPoint(hitTestResult.localPoint(), nullptr), m_mousePressNode->renderer()->positionForPoint(m_dragStartPos, nullptr)) < 0)
+        if (rootUserSelectAllForMousePressNode && comparePositions(target->renderer()->positionForPoint(hitTestResult.localPoint(), nullptr), m_mousePressNode->renderer()->positionForPoint(m_dragStartPosition, nullptr)) < 0)
             newSelection.setBase(positionAfterNode(rootUserSelectAllForMousePressNode).downstream(CanCrossEditingBoundary));
         
         Node* rootUserSelectAllForTarget = Position::rootUserSelectAllForNode(target);
-        if (rootUserSelectAllForTarget && m_mousePressNode->renderer() && comparePositions(target->renderer()->positionForPoint(hitTestResult.localPoint(), nullptr), m_mousePressNode->renderer()->positionForPoint(m_dragStartPos, nullptr)) < 0)
+        if (rootUserSelectAllForTarget && m_mousePressNode->renderer() && comparePositions(target->renderer()->positionForPoint(hitTestResult.localPoint(), nullptr), m_mousePressNode->renderer()->positionForPoint(m_dragStartPosition, nullptr)) < 0)
             newSelection.setExtent(positionBeforeNode(rootUserSelectAllForTarget).upstream(CanCrossEditingBoundary));
         else if (rootUserSelectAllForTarget && m_mousePressNode->renderer())
             newSelection.setExtent(positionAfterNode(rootUserSelectAllForTarget).downstream(CanCrossEditingBoundary));
@@ -1047,7 +1031,7 @@ bool EventHandler::handleMouseReleaseEvent(const MouseEventWithHitTestResults& e
     // editing, place the caret.
     if (m_mouseDownWasSingleClickInSelection && m_selectionInitiationState != ExtendedSelection
 #if ENABLE(DRAG_SUPPORT)
-            && m_dragStartPos == event.event().position()
+            && m_dragStartPosition == event.event().position()
 #endif
             && m_frame.selection().isRange()
             && event.event().button() != RightButton) {
@@ -1084,12 +1068,12 @@ void EventHandler::didPanScrollStop()
     m_autoscrollController->didPanScrollStop();
 }
 
-void EventHandler::startPanScrolling(RenderElement* renderer)
+void EventHandler::startPanScrolling(RenderElement& renderer)
 {
 #if !PLATFORM(IOS)
-    if (!is<RenderBox>(*renderer))
+    if (!is<RenderBox>(renderer))
         return;
-    m_autoscrollController->startPanScrolling(downcast<RenderBox>(renderer), lastKnownMousePosition());
+    m_autoscrollController->startPanScrolling(&downcast<RenderBox>(renderer), lastKnownMousePosition());
     invalidateClick();
 #endif
 }
@@ -1374,24 +1358,28 @@ void EventHandler::updateCursor()
     HitTestResult result(view->windowToContents(m_lastKnownMousePosition));
     renderView->hitTest(request, result);
 
-    OptionalCursor optionalCursor = selectCursor(result, shiftKey);
-    if (optionalCursor.isCursorChange()) {
-        m_currentMouseCursor = optionalCursor.cursor();
-        view->setCursor(m_currentMouseCursor);
+    updateCursor(*view, result, shiftKey);
+}
+
+void EventHandler::updateCursor(FrameView& view, const HitTestResult& result, bool shiftKey)
+{
+    if (auto optionalCursor = selectCursor(result, shiftKey)) {
+        m_currentMouseCursor = WTFMove(optionalCursor.value());
+        view.setCursor(m_currentMouseCursor);
     }
 }
 
-OptionalCursor EventHandler::selectCursor(const HitTestResult& result, bool shiftKey)
+std::optional<Cursor> EventHandler::selectCursor(const HitTestResult& result, bool shiftKey)
 {
     if (m_resizeLayer && m_resizeLayer->inResizeMode())
-        return NoCursorChange;
+        return std::nullopt;
 
     if (!m_frame.page())
-        return NoCursorChange;
+        return std::nullopt;
 
 #if ENABLE(PAN_SCROLLING)
     if (m_frame.mainFrame().eventHandler().panScrollInProgress())
-        return NoCursorChange;
+        return std::nullopt;
 #endif
 
     Ref<Frame> protectedFrame(m_frame);
@@ -1406,7 +1394,7 @@ OptionalCursor EventHandler::selectCursor(const HitTestResult& result, bool shif
 
     Node* node = result.targetNode();
     if (!node)
-        return NoCursorChange;
+        return std::nullopt;
 
     auto renderer = node->renderer();
     auto* style = renderer ? &renderer->style() : nullptr;
@@ -1428,7 +1416,7 @@ OptionalCursor EventHandler::selectCursor(const HitTestResult& result, bool shif
         case SetCursor:
             return overrideCursor;
         case DoNotSetCursor:
-            return NoCursorChange;
+            return std::nullopt;
         }
     }
 
@@ -1947,15 +1935,10 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& platformMouseE
         // node to be detached from its FrameView, in which case the event should not be passed.
         if (newSubframe->view())
             swallowEvent |= passMouseMoveEventToSubframe(mouseEvent, newSubframe.get(), hoveredNode);
-#if ENABLE(CURSOR_SUPPORT)
     } else {
-        if (FrameView* view = m_frame.view()) {
-            OptionalCursor optionalCursor = selectCursor(mouseEvent.hitTestResult(), platformMouseEvent.shiftKey());
-            if (optionalCursor.isCursorChange()) {
-                m_currentMouseCursor = optionalCursor.cursor();
-                view->setCursor(m_currentMouseCursor);
-            }
-        }
+#if ENABLE(CURSOR_SUPPORT)
+        if (auto* view = m_frame.view())
+            updateCursor(*view, mouseEvent.hitTestResult(), platformMouseEvent.shiftKey());
 #endif
     }
     
@@ -1968,7 +1951,7 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& platformMouseE
 #if ENABLE(DRAG_SUPPORT)
     if (!swallowEvent)
         swallowEvent = handleMouseDraggedEvent(mouseEvent);
-#endif // ENABLE(DRAG_SUPPORT)
+#endif
 
     return swallowEvent;
 }
@@ -2236,7 +2219,7 @@ static bool findDropZone(Node* target, DataTransfer* dataTransfer)
     return false;
 }
     
-bool EventHandler::updateDragAndDrop(const PlatformMouseEvent& event, DataTransfer* dataTransfer)
+bool EventHandler::updateDragAndDrop(const PlatformMouseEvent& event, DataTransfer& dataTransfer)
 {
     Ref<Frame> protectedFrame(m_frame);
 
@@ -2275,16 +2258,16 @@ bool EventHandler::updateDragAndDrop(const PlatformMouseEvent& event, DataTransf
                 // for now we don't care if event handler cancels default behavior, since there is none
                 dispatchDragSrcEvent(eventNames().dragEvent, event);
             }
-            accept = dispatchDragEvent(eventNames().dragenterEvent, *newTarget, event, dataTransfer);
+            accept = dispatchDragEvent(eventNames().dragenterEvent, *newTarget, event, &dataTransfer);
             if (!accept)
-                accept = findDropZone(newTarget.get(), dataTransfer);
+                accept = findDropZone(newTarget.get(), &dataTransfer);
         }
 
         if (targetIsFrame(m_dragTarget.get(), targetFrame)) {
             if (targetFrame)
                 accept = targetFrame->eventHandler().updateDragAndDrop(event, dataTransfer);
         } else if (m_dragTarget)
-            dispatchDragEvent(eventNames().dragleaveEvent, *m_dragTarget, event, dataTransfer);
+            dispatchDragEvent(eventNames().dragleaveEvent, *m_dragTarget, event, &dataTransfer);
 
         if (newTarget) {
             // We do not explicitly call dispatchDragEvent here because it could ultimately result in the appearance that
@@ -2302,9 +2285,9 @@ bool EventHandler::updateDragAndDrop(const PlatformMouseEvent& event, DataTransf
                 // for now we don't care if event handler cancels default behavior, since there is none
                 dispatchDragSrcEvent(eventNames().dragEvent, event);
             }
-            accept = dispatchDragEvent(eventNames().dragoverEvent, *newTarget, event, dataTransfer);
+            accept = dispatchDragEvent(eventNames().dragoverEvent, *newTarget, event, &dataTransfer);
             if (!accept)
-                accept = findDropZone(newTarget.get(), dataTransfer);
+                accept = findDropZone(newTarget.get(), &dataTransfer);
             m_shouldOnlyFireDragOverEvent = false;
         }
     }
@@ -2312,7 +2295,7 @@ bool EventHandler::updateDragAndDrop(const PlatformMouseEvent& event, DataTransf
     return accept;
 }
 
-void EventHandler::cancelDragAndDrop(const PlatformMouseEvent& event, DataTransfer* dataTransfer)
+void EventHandler::cancelDragAndDrop(const PlatformMouseEvent& event, DataTransfer& dataTransfer)
 {
     Ref<Frame> protectedFrame(m_frame);
 
@@ -2323,12 +2306,12 @@ void EventHandler::cancelDragAndDrop(const PlatformMouseEvent& event, DataTransf
     } else if (m_dragTarget) {
         if (dragState().source && dragState().shouldDispatchEvents)
             dispatchDragSrcEvent(eventNames().dragEvent, event);
-        dispatchDragEvent(eventNames().dragleaveEvent, *m_dragTarget, event, dataTransfer);
+        dispatchDragEvent(eventNames().dragleaveEvent, *m_dragTarget, event, &dataTransfer);
     }
     clearDragState();
 }
 
-bool EventHandler::performDragAndDrop(const PlatformMouseEvent& event, DataTransfer* dataTransfer)
+bool EventHandler::performDragAndDrop(const PlatformMouseEvent& event, DataTransfer& dataTransfer)
 {
     Ref<Frame> protectedFrame(m_frame);
 
@@ -2338,7 +2321,7 @@ bool EventHandler::performDragAndDrop(const PlatformMouseEvent& event, DataTrans
         if (targetFrame)
             preventedDefault = targetFrame->eventHandler().performDragAndDrop(event, dataTransfer);
     } else if (m_dragTarget)
-        preventedDefault = dispatchDragEvent(eventNames().dropEvent, *m_dragTarget, event, dataTransfer);
+        preventedDefault = dispatchDragEvent(eventNames().dropEvent, *m_dragTarget, event, &dataTransfer);
     clearDragState();
     return preventedDefault;
 }
@@ -2353,9 +2336,10 @@ void EventHandler::clearDragState()
     m_sendingEventToSubview = false;
 #endif
 }
+
 #endif // ENABLE(DRAG_SUPPORT)
 
-void EventHandler::setCapturingMouseEventsElement(PassRefPtr<Element> element)
+void EventHandler::setCapturingMouseEventsElement(Element* element)
 {
     m_capturingMouseEventsElement = element;
     m_eventHandlerWillResetCapturingMouseEventsElement = false;
@@ -2563,7 +2547,7 @@ bool EventHandler::dispatchMouseEvent(const AtomicString& eventType, Node* targe
 
     // If focus shift is blocked, we eat the event.
     auto* page = m_frame.page();
-    if (page && !page->focusController().setFocusedElement(element, &m_frame))
+    if (page && !page->focusController().setFocusedElement(element, m_frame))
         return false;
 
     return true;
@@ -3411,11 +3395,11 @@ void EventHandler::dragSourceEndedAt(const PlatformMouseEvent& event, DragOperat
     m_mouseDownMayStartDrag = false;
 }
 
-void EventHandler::updateDragStateAfterEditDragIfNeeded(Element* rootEditableElement)
+void EventHandler::updateDragStateAfterEditDragIfNeeded(Element& rootEditableElement)
 {
     // If inserting the dragged contents removed the drag source, we still want to fire dragend at the root editable element.
     if (dragState().source && !dragState().source->inDocument())
-        dragState().source = rootEditableElement;
+        dragState().source = &rootEditableElement;
 }
 
 // Return value indicates if we should continue "default processing", i.e., whether event handler canceled.
@@ -3625,25 +3609,24 @@ bool EventHandler::handleTextInputEvent(const String& text, Event* underlyingEve
     return event->defaultHandled();
 }
     
-bool EventHandler::isKeyboardOptionTab(KeyboardEvent* event)
+bool EventHandler::isKeyboardOptionTab(KeyboardEvent& event)
 {
-    return event
-        && (event->type() == eventNames().keydownEvent || event->type() == eventNames().keypressEvent)
-        && event->altKey()
-        && event->keyIdentifier() == "U+0009";    
+    return (event.type() == eventNames().keydownEvent || event.type() == eventNames().keypressEvent)
+        && event.altKey()
+        && event.keyIdentifier() == "U+0009";
 }
 
-bool EventHandler::eventInvertsTabsToLinksClientCallResult(KeyboardEvent* event)
+bool EventHandler::eventInvertsTabsToLinksClientCallResult(KeyboardEvent& event)
 {
 #if PLATFORM(COCOA) || PLATFORM(EFL)
-    return EventHandler::isKeyboardOptionTab(event);
+    return isKeyboardOptionTab(event);
 #else
     UNUSED_PARAM(event);
     return false;
 #endif
 }
 
-bool EventHandler::tabsToLinks(KeyboardEvent* event) const
+bool EventHandler::tabsToLinks(KeyboardEvent& event) const
 {
     // FIXME: This function needs a better name. It can be called for keypresses other than Tab when spatial navigation is enabled.
 
index de78bca..6ed7ae3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #include "HitTestRequest.h"
 #include "LayoutPoint.h"
 #include "PlatformMouseEvent.h"
-#include "PlatformWheelEvent.h"
 #include "ScrollTypes.h"
 #include "TextEventInputType.h"
 #include "TextGranularity.h"
 #include "Timer.h"
-#include "WheelEventDeltaFilter.h"
 #include <memory>
 #include <wtf/Forward.h>
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
 #include <wtf/RefPtr.h>
-#include <wtf/Vector.h>
 #include <wtf/WeakPtr.h>
 
+#if PLATFORM(COCOA)
+OBJC_CLASS NSView;
+#endif
+
 #if PLATFORM(IOS)
 OBJC_CLASS WebEvent;
-OBJC_CLASS WAKView;
-#ifdef __OBJC__
-#include "WAKAppKitStubs.h"
 #endif
-#endif // PLATFORM(IOS)
 
-#if PLATFORM(COCOA)
-OBJC_CLASS NSView;
+#if PLATFORM(MAC)
+OBJC_CLASS NSEvent;
+#endif
+
+#if PLATFORM(IOS) && defined(__OBJC__)
+#include "WAKAppKitStubs.h"
 #endif
 
 namespace WebCore {
@@ -66,16 +67,14 @@ class Document;
 class Element;
 class Event;
 class EventTarget;
-class FloatPoint;
 class FloatQuad;
 class Frame;
+class FrameView;
 class HTMLFrameSetElement;
-class HitTestRequest;
 class HitTestResult;
 class KeyboardEvent;
 class MouseEventWithHitTestResults;
 class Node;
-class OptionalCursor;
 class PlatformGestureEvent;
 class PlatformKeyboardEvent;
 class PlatformTouchEvent;
@@ -100,7 +99,7 @@ extern const int LinkDragHysteresis;
 extern const int ImageDragHysteresis;
 extern const int TextDragHysteresis;
 extern const int GeneralDragHysteresis;
-#endif // ENABLE(DRAG_SUPPORT)
+#endif
 
 #if ENABLE(IOS_GESTURE_EVENTS) || ENABLE(MAC_GESTURE_EVENTS)
 extern const float GestureUnknown;
@@ -120,7 +119,6 @@ enum class ImmediateActionStage {
 };
 
 class EventHandler {
-    WTF_MAKE_NONCOPYABLE(EventHandler);
     WTF_MAKE_FAST_ALLOCATED;
 public:
     explicit EventHandler(Frame&);
@@ -136,7 +134,7 @@ public:
 #if ENABLE(PAN_SCROLLING)
     void didPanScrollStart();
     void didPanScrollStop();
-    void startPanScrolling(RenderElement*);
+    void startPanScrolling(RenderElement&);
 #endif
 
     void stopAutoscrollTimer(bool rendererIsBeingDestroyed = false);
@@ -156,13 +154,13 @@ public:
     bool mousePressed() const { return m_mousePressed; }
     Node* mousePressNode() const { return m_mousePressNode.get(); }
 
-    WEBCORE_EXPORT void setCapturingMouseEventsElement(PassRefPtr<Element>); // A caller is responsible for resetting capturing element to 0.
+    WEBCORE_EXPORT void setCapturingMouseEventsElement(Element*);
 
 #if ENABLE(DRAG_SUPPORT)
-    bool updateDragAndDrop(const PlatformMouseEvent&, DataTransfer*);
-    void cancelDragAndDrop(const PlatformMouseEvent&, DataTransfer*);
-    bool performDragAndDrop(const PlatformMouseEvent&, DataTransfer*);
-    void updateDragStateAfterEditDragIfNeeded(Element* rootEditableElement);
+    bool updateDragAndDrop(const PlatformMouseEvent&, DataTransfer&);
+    void cancelDragAndDrop(const PlatformMouseEvent&, DataTransfer&);
+    bool performDragAndDrop(const PlatformMouseEvent&, DataTransfer&);
+    void updateDragStateAfterEditDragIfNeeded(Element& rootEditableElement);
 #endif
 
     void scheduleHoverStateUpdate();
@@ -187,8 +185,8 @@ public:
     WEBCORE_EXPORT bool scrollRecursively(ScrollDirection, ScrollGranularity, Node* startingNode = nullptr);
     WEBCORE_EXPORT bool logicalScrollRecursively(ScrollLogicalDirection, ScrollGranularity, Node* startingNode = nullptr);
 
-    bool tabsToLinks(KeyboardEvent*) const;
-    bool tabsToAllFormControls(KeyboardEvent*) const;
+    bool tabsToLinks(KeyboardEvent&) const;
+    bool tabsToAllFormControls(KeyboardEvent&) const;
 
     WEBCORE_EXPORT bool mouseMoved(const PlatformMouseEvent&);
     WEBCORE_EXPORT bool passMouseMovedEventToScrollbars(const PlatformMouseEvent&);
@@ -210,12 +208,12 @@ public:
     void platformNotifyIfEndGesture(const PlatformWheelEvent&, const WeakPtr<ScrollableArea>&);
 
 #if ENABLE(IOS_TOUCH_EVENTS) || ENABLE(IOS_GESTURE_EVENTS)
-    typedef Vector<RefPtr<Touch>> TouchArray;
-    typedef HashMap<EventTarget*, TouchArray*> EventTargetTouchMap;
+    using TouchArray = Vector<RefPtr<Touch>>;
+    using EventTargetTouchMap = HashMap<EventTarget*, TouchArray*>;
 #endif
 
 #if ENABLE(IOS_TOUCH_EVENTS) || ENABLE(IOS_GESTURE_EVENTS) || ENABLE(MAC_GESTURE_EVENTS)
-    typedef HashSet<RefPtr<EventTarget>> EventTargetSet;
+    using EventTargetSet = HashSet<RefPtr<EventTarget>>;
 #endif
 
 #if ENABLE(IOS_TOUCH_EVENTS)
@@ -231,7 +229,7 @@ public:
 #endif
 
 #if PLATFORM(IOS)
-    void defaultTouchEventHandler(Node*, TouchEvent*);
+    void defaultTouchEventHandler(Node&, TouchEvent&);
 #endif
 
 #if ENABLE(CONTEXT_MENUS)
@@ -264,8 +262,7 @@ public:
     
     WEBCORE_EXPORT void sendScrollEvent();
 
-#if PLATFORM(COCOA) && defined(__OBJC__)
-#if !PLATFORM(IOS)
+#if PLATFORM(MAC)
     WEBCORE_EXPORT void mouseDown(NSEvent *, NSEvent *correspondingPressureEvent);
     WEBCORE_EXPORT void mouseDragged(NSEvent *, NSEvent *correspondingPressureEvent);
     WEBCORE_EXPORT void mouseUp(NSEvent *, NSEvent *correspondingPressureEvent);
@@ -273,7 +270,9 @@ public:
     WEBCORE_EXPORT void pressureChange(NSEvent *, NSEvent* correspondingPressureEvent);
     WEBCORE_EXPORT bool keyEvent(NSEvent *);
     WEBCORE_EXPORT bool wheelEvent(NSEvent *);
-#else
+#endif
+
+#if PLATFORM(IOS)
     WEBCORE_EXPORT void mouseDown(WebEvent *);
     WEBCORE_EXPORT void mouseUp(WebEvent *);
     WEBCORE_EXPORT void mouseMoved(WebEvent *);
@@ -285,23 +284,20 @@ public:
     WEBCORE_EXPORT void touchEvent(WebEvent *);
 #endif
 
-#if !PLATFORM(IOS)
+#if PLATFORM(MAC)
     WEBCORE_EXPORT void passMouseMovedEventToScrollbars(NSEvent *, NSEvent* correspondingPressureEvent);
 
     WEBCORE_EXPORT void sendFakeEventsAfterWidgetTracking(NSEvent *initiatingEvent);
-#endif
 
-#if !PLATFORM(IOS)
     void setActivationEventNumber(int num) { m_activationEventNumber = num; }
 
     WEBCORE_EXPORT static NSEvent *currentNSEvent();
     static NSEvent *correspondingPressureEvent();
-#else
-    static WebEvent *currentEvent();
-#endif // !PLATFORM(IOS)
-#endif // PLATFORM(COCOA) && defined(__OBJC__)
+#endif
 
 #if PLATFORM(IOS)
+    static WebEvent *currentEvent();
+
     void invalidateClick();
 #endif
 
@@ -323,9 +319,8 @@ private:
 #if ENABLE(DRAG_SUPPORT)
     static DragState& dragState();
     static const double TextDragDelay;
-    
-    PassRefPtr<DataTransfer> createDraggingDataTransfer() const;
-#endif // ENABLE(DRAG_SUPPORT)
+    Ref<DataTransfer> createDraggingDataTransfer() const;
+#endif
 
     bool eventActivatedView(const PlatformMouseEvent&) const;
     bool updateSelectionForMouseDownDispatchingSelectStart(Node*, const VisibleSelection&, TextGranularity);
@@ -341,14 +336,18 @@ private:
     bool handleMousePressEventSingleClick(const MouseEventWithHitTestResults&);
     bool handleMousePressEventDoubleClick(const MouseEventWithHitTestResults&);
     bool handleMousePressEventTripleClick(const MouseEventWithHitTestResults&);
+
 #if ENABLE(DRAG_SUPPORT)
     bool handleMouseDraggedEvent(const MouseEventWithHitTestResults&);
 #endif
+
     WEBCORE_EXPORT bool handleMouseReleaseEvent(const MouseEventWithHitTestResults&);
 
-    OptionalCursor selectCursor(const HitTestResult&, bool shiftKey);
+    std::optional<Cursor> selectCursor(const HitTestResult&, bool shiftKey);
+    void updateCursor(FrameView&, const HitTestResult&, bool shiftKey);
 
     void hoverTimerFired();
+
 #if ENABLE(CURSOR_SUPPORT)
     void cursorUpdateTimerFired();
 #endif
@@ -359,8 +358,8 @@ private:
     
     bool mouseDownMayStartSelect() const { return m_mouseDownMayStartSelect; }
 
-    static bool isKeyboardOptionTab(KeyboardEvent*);
-    static bool eventInvertsTabsToLinksClientCallResult(KeyboardEvent*);
+    static bool isKeyboardOptionTab(KeyboardEvent&);
+    static bool eventInvertsTabsToLinksClientCallResult(KeyboardEvent&);
 
 #if !ENABLE(IOS_TOUCH_EVENTS)
     void fakeMouseMoveEventTimerFired();
@@ -385,6 +384,7 @@ private:
     MouseEventWithHitTestResults prepareMouseEvent(const HitTestRequest&, const PlatformMouseEvent&);
 
     bool dispatchMouseEvent(const AtomicString& eventType, Node* target, bool cancelable, int clickCount, const PlatformMouseEvent&, bool setUnder);
+
 #if ENABLE(DRAG_SUPPORT)
     bool dispatchDragEvent(const AtomicString& eventType, Element& target, const PlatformMouseEvent&, DataTransfer*);
 
@@ -392,7 +392,9 @@ private:
 
     bool handleDrag(const MouseEventWithHitTestResults&, CheckDragHysteresis);
 #endif
+
     bool handleMouseUp(const MouseEventWithHitTestResults&);
+
 #if ENABLE(DRAG_SUPPORT)
     void clearDragState();
 
@@ -400,7 +402,7 @@ private:
 
     bool dragHysteresisExceeded(const FloatPoint&) const;
     bool dragHysteresisExceeded(const IntPoint&) const;
-#endif // ENABLE(DRAG_SUPPORT)
+#endif
     
     bool mouseMovementExceedsThreshold(const FloatPoint&, int pointsThreshold) const;
 
@@ -431,11 +433,9 @@ private:
     // The following are called at the beginning of handleMouseUp and handleDrag.  
     // If they return true it indicates that they have consumed the event.
     bool eventLoopHandleMouseUp(const MouseEventWithHitTestResults&);
-#if ENABLE(DRAG_SUPPORT)
-    bool eventLoopHandleMouseDragged(const MouseEventWithHitTestResults&);
-#endif
 
 #if ENABLE(DRAG_SUPPORT)
+    bool eventLoopHandleMouseDragged(const MouseEventWithHitTestResults&);
     void updateSelectionForMouseDrag(const HitTestResult&);
 #endif
 
@@ -473,21 +473,24 @@ private:
     RefPtr<Node> m_mousePressNode;
 
     bool m_mouseDownMayStartSelect { false };
+
 #if ENABLE(DRAG_SUPPORT)
     bool m_mouseDownMayStartDrag { false };
     bool m_dragMayStartSelectionInstead { false };
 #endif
+
     bool m_mouseDownWasSingleClickInSelection { false };
     enum SelectionInitiationState { HaveNotStartedSelection, PlacedCaret, ExtendedSelection };
     SelectionInitiationState m_selectionInitiationState { HaveNotStartedSelection };
 
 #if ENABLE(DRAG_SUPPORT)
-    LayoutPoint m_dragStartPos;
+    LayoutPoint m_dragStartPosition;
 #endif
 
     bool m_panScrollButtonPressed { false };
 
     Timer m_hoverTimer;
+
 #if ENABLE(CURSOR_SUPPORT)
     Timer m_cursorUpdateTimer;
 #endif
@@ -495,6 +498,7 @@ private:
 #if PLATFORM(MAC)
     Timer m_pendingMomentumWheelEventsTimer;
 #endif
+
     std::unique_ptr<AutoscrollController> m_autoscrollController;
     bool m_mouseDownMayStartAutoscroll { false };
     bool m_mouseDownWasInSubframe { false };
@@ -523,11 +527,13 @@ private:
     float m_gestureInitialDiameter { GestureUnknown };
     float m_gestureInitialRotation { GestureUnknown };
 #endif
+
 #if ENABLE(IOS_GESTURE_EVENTS) || ENABLE(MAC_GESTURE_EVENTS)
     float m_gestureLastDiameter { GestureUnknown };
     float m_gestureLastRotation { GestureUnknown };
     EventTargetSet m_gestureTargets;
 #endif
+
 #if ENABLE(MAC_GESTURE_EVENTS)
     bool m_hasActiveGesture { false };
 #endif
@@ -558,12 +564,14 @@ private:
 #if PLATFORM(COCOA)
     NSView *m_mouseDownView { nullptr };
     bool m_sendingEventToSubview { false };
-#if !PLATFORM(IOS)
-    int m_activationEventNumber { -1 };
 #endif
+
+#if PLATFORM(MAC)
+    int m_activationEventNumber { -1 };
 #endif
+
 #if ENABLE(TOUCH_EVENTS) && !ENABLE(IOS_TOUCH_EVENTS)
-    typedef HashMap<int, RefPtr<EventTarget>> TouchTargetMap;
+    using TouchTargetMap = HashMap<int, RefPtr<EventTarget>>;
     TouchTargetMap m_originatingTouchPointTargets;
     RefPtr<Document> m_originatingTouchPointDocument;
     unsigned m_originatingTouchPointTargetKey { 0 };
index a7b2557..5aa86c9 100644 (file)
@@ -316,7 +316,7 @@ FocusController::FocusController(Page& page, ActivityState::Flags activityState)
 {
 }
 
-void FocusController::setFocusedFrame(PassRefPtr<Frame> frame)
+void FocusController::setFocusedFrame(Frame* frame)
 {
     ASSERT(!frame || frame->page() == &m_page);
     if (m_focusedFrame == frame || m_isChangingFocusedFrame)
@@ -765,8 +765,9 @@ static void clearSelectionIfNeeded(Frame* oldFocusedFrame, Frame* newFocusedFram
     oldFocusedFrame->selection().clear();
 }
 
-bool FocusController::setFocusedElement(Element* element, PassRefPtr<Frame> newFocusedFrame, FocusDirection direction)
+bool FocusController::setFocusedElement(Element* element, Frame& newFocusedFrame, FocusDirection direction)
 {
+    Ref<Frame> protectedNewFocusedFrame = newFocusedFrame;
     RefPtr<Frame> oldFocusedFrame = focusedFrame();
     RefPtr<Document> oldDocument = oldFocusedFrame ? oldFocusedFrame->document() : nullptr;
     
@@ -780,7 +781,7 @@ bool FocusController::setFocusedElement(Element* element, PassRefPtr<Frame> newF
 
     m_page.editorClient().willSetInputMethodState();
 
-    clearSelectionIfNeeded(oldFocusedFrame.get(), newFocusedFrame.get(), element);
+    clearSelectionIfNeeded(oldFocusedFrame.get(), &newFocusedFrame, element);
 
     if (!element) {
         if (oldDocument)
@@ -799,11 +800,11 @@ bool FocusController::setFocusedElement(Element* element, PassRefPtr<Frame> newF
     if (oldDocument && oldDocument != newDocument.ptr())
         oldDocument->setFocusedElement(nullptr);
 
-    if (newFocusedFrame && !newFocusedFrame->page()) {
+    if (!newFocusedFrame.page()) {
         setFocusedFrame(nullptr);
         return false;
     }
-    setFocusedFrame(newFocusedFrame);
+    setFocusedFrame(&newFocusedFrame);
 
     Ref<Element> protect(*element);
 
index ecbe396..c6dcf22 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #include "LayoutRect.h"
 #include "Timer.h"
 #include <wtf/Forward.h>
-#include <wtf/Noncopyable.h>
 #include <wtf/RefPtr.h>
 
 namespace WebCore {
 
-struct FocusCandidate;
 class ContainerNode;
 class Document;
 class Element;
@@ -48,19 +46,21 @@ class Node;
 class Page;
 class TreeScope;
 
+struct FocusCandidate;
+
 class FocusController {
-    WTF_MAKE_NONCOPYABLE(FocusController); WTF_MAKE_FAST_ALLOCATED;
+    WTF_MAKE_FAST_ALLOCATED;
 public:
     explicit FocusController(Page&, ActivityState::Flags);
 
-    WEBCORE_EXPORT void setFocusedFrame(PassRefPtr<Frame>);
+    WEBCORE_EXPORT void setFocusedFrame(Frame*);
     Frame* focusedFrame() const { return m_focusedFrame.get(); }
     WEBCORE_EXPORT Frame& focusedOrMainFrame() const;
 
     WEBCORE_EXPORT bool setInitialFocus(FocusDirection, KeyboardEvent*);
     bool advanceFocus(FocusDirection, KeyboardEvent&, bool initialFocus = false);
 
-    WEBCORE_EXPORT bool setFocusedElement(Element*, PassRefPtr<Frame>, FocusDirection = FocusDirectionNone);
+    WEBCORE_EXPORT bool setFocusedElement(Element*, Frame&, FocusDirection = FocusDirectionNone);
 
     void setActivityState(ActivityState::Flags);
 
index eda3cf6..878ee1c 100644 (file)
@@ -777,7 +777,7 @@ void Frame::willDetachPage()
 
 #if PLATFORM(IOS)
     if (WebThreadCountOfObservedContentModifiers() > 0 && m_page)
-        m_page->chrome().client().clearContentChangeObservers(this);
+        m_page->chrome().client().clearContentChangeObservers(*this);
 #endif
 
     script().clearScriptObjects();
index deeb23b..fdcf356 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2017 Apple Inc. All rights reserved.
  * Copyright (C) Research In Motion Limited 2010. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
@@ -63,25 +63,6 @@ Frame* FrameTree::parent() const
     return m_parent;
 }
 
-bool FrameTree::transferChild(PassRefPtr<Frame> child)
-{
-    Frame* oldParent = child->tree().parent();
-    if (oldParent == &m_thisFrame)
-        return false; // |child| is already a child of m_thisFrame.
-
-    if (oldParent)
-        oldParent->tree().removeChild(child.get());
-
-    ASSERT(child->page() == m_thisFrame.page());
-    child->tree().m_parent = &m_thisFrame;
-
-    // We need to ensure that the child still has a unique frame name with respect to its new parent.
-    child->tree().setName(child->tree().m_name);
-
-    actuallyAppendChild(child); // Note, on return |child| is null.
-    return true;
-}
-
 unsigned FrameTree::indexInParent() const
 {
     if (!m_parent)
@@ -95,46 +76,32 @@ unsigned FrameTree::indexInParent() const
     RELEASE_ASSERT_NOT_REACHED();
 }
 
-void FrameTree::appendChild(PassRefPtr<Frame> child)
-{
-    ASSERT(child->page() == m_thisFrame.page());
-    child->tree().m_parent = &m_thisFrame;
-    actuallyAppendChild(child); // Note, on return |child| is null.
-}
-
-void FrameTree::actuallyAppendChild(PassRefPtr<Frame> child)
+void FrameTree::appendChild(Frame& child)
 {
-    ASSERT(child->tree().m_parent == &m_thisFrame);
+    ASSERT(child.page() == m_thisFrame.page());
+    child.tree().m_parent = &m_thisFrame;
     Frame* oldLast = m_lastChild;
-    m_lastChild = child.get();
+    m_lastChild = &child;
 
     if (oldLast) {
-        child->tree().m_previousSibling = oldLast;
-        oldLast->tree().m_nextSibling = child;
+        child.tree().m_previousSibling = oldLast;
+        oldLast->tree().m_nextSibling = &child;
     } else
-        m_firstChild = child;
+        m_firstChild = &child;
 
     m_scopedChildCount = invalidCount;
 
     ASSERT(!m_lastChild->tree().m_nextSibling);
 }
 
-void FrameTree::removeChild(Frame* child)
+void FrameTree::removeChild(Frame& child)
 {
-    child->tree().m_parent = nullptr;
-
-    // Slightly tricky way to prevent deleting the child until we are done with it, w/o
-    // extra refs. These swaps leave the child in a circular list by itself. Clearing its
-    // previous and next will then finally deref it.
-
-    RefPtr<Frame>& newLocationForNext = m_firstChild == child ? m_firstChild : child->tree().m_previousSibling->tree().m_nextSibling;
-    Frame*& newLocationForPrevious = m_lastChild == child ? m_lastChild : child->tree().m_nextSibling->tree().m_previousSibling;
-    swap(newLocationForNext, child->tree().m_nextSibling);
-    // For some inexplicable reason, the following line does not compile without the explicit std:: namespace
-    std::swap(newLocationForPrevious, child->tree().m_previousSibling);
+    Frame*& newLocationForPrevious = m_lastChild == &child ? m_lastChild : child.tree().m_nextSibling->tree().m_previousSibling;
+    RefPtr<Frame>& newLocationForNext = m_firstChild == &child ? m_firstChild : child.tree().m_previousSibling->tree().m_nextSibling;
 
-    child->tree().m_previousSibling = nullptr;
-    child->tree().m_nextSibling = nullptr;
+    child.tree().m_parent = nullptr;
+    newLocationForPrevious = std::exchange(child.tree().m_previousSibling, nullptr);
+    newLocationForNext = WTFMove(child.tree().m_nextSibling);
 
     m_scopedChildCount = invalidCount;
 }
index ab16f0a..3f87c27 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Apple Inc.
+ * Copyright (C) 2006-2017 Apple Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -65,10 +65,9 @@ public:
     WEBCORE_EXPORT Frame* traverseNextWithWrap(bool) const;
     WEBCORE_EXPORT Frame* traversePreviousWithWrap(bool) const;
     
-    WEBCORE_EXPORT void appendChild(PassRefPtr<Frame>);
-    bool transferChild(PassRefPtr<Frame>);
+    WEBCORE_EXPORT void appendChild(Frame&);
     void detachFromParent() { m_parent = nullptr; }
-    void removeChild(Frame*);
+    void removeChild(Frame&);
 
     Frame* child(unsigned index) const;
     Frame* child(const AtomicString& name) const;
@@ -87,7 +86,6 @@ public:
 
 private:
     Frame* deepLastChild() const;
-    void actuallyAppendChild(PassRefPtr<Frame>);
 
     bool scopedBy(TreeScope*) const;
     Frame* scopedChild(unsigned index, TreeScope*) const;
index d94c9d9..4d638a2 100644 (file)
@@ -677,7 +677,7 @@ void FrameView::setContentsSize(const IntSize& size)
 
     updateScrollableAreaSet();
 
-    page->chrome().contentsSizeChanged(&frame(), size); // Notify only.
+    page->chrome().contentsSizeChanged(frame(), size); // Notify only.
 
     if (frame().isMainFrame()) {
         frame().mainFrame().pageOverlayController().didChangeDocumentSize();
index 48174cb..a17be3b 100644 (file)
@@ -92,7 +92,7 @@ void MainFrame::selfOnlyDeref()
 void MainFrame::dropChildren()
 {
     while (Frame* child = tree().firstChild())
-        tree().removeChild(child);
+        tree().removeChild(*child);
 }
 
 #if PLATFORM(MAC)
index db17e6b..7d6af11 100644 (file)
@@ -363,7 +363,7 @@ ViewportArguments Page::viewportArguments() const
 ScrollingCoordinator* Page::scrollingCoordinator()
 {
     if (!m_scrollingCoordinator && m_settings->scrollingCoordinatorEnabled()) {
-        m_scrollingCoordinator = chrome().client().createScrollingCoordinator(this);
+        m_scrollingCoordinator = chrome().client().createScrollingCoordinator(*this);
         if (!m_scrollingCoordinator)
             m_scrollingCoordinator = ScrollingCoordinator::create(this);
     }
index e70bca0..2ca86f9 100644 (file)
@@ -274,7 +274,7 @@ void PageOverlay::fadeAnimationTimerFired()
 
         // If this was a fade out, uninstall the page overlay.
         if (wasFadingOut)
-            controller()->uninstallPageOverlay(this, PageOverlay::FadeMode::DoNotFade);
+            controller()->uninstallPageOverlay(*this, PageOverlay::FadeMode::DoNotFade);
     }
 }
 
index 866b870..0543bd5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -95,27 +95,25 @@ static void updateOverlayGeometry(PageOverlay& overlay, GraphicsLayer& graphicsL
     graphicsLayer.setSize(overlayFrame.size());
 }
 
-void PageOverlayController::installPageOverlay(PassRefPtr<PageOverlay> pageOverlay, PageOverlay::FadeMode fadeMode)
+void PageOverlayController::installPageOverlay(PageOverlay& overlay, PageOverlay::FadeMode fadeMode)
 {
     createRootLayersIfNeeded();
 
-    RefPtr<PageOverlay> overlay = pageOverlay;
-
-    if (m_pageOverlays.contains(overlay))
+    if (m_pageOverlays.contains(&overlay))
         return;
 
-    m_pageOverlays.append(overlay);
+    m_pageOverlays.append(&overlay);
 
     std::unique_ptr<GraphicsLayer> layer = GraphicsLayer::create(m_mainFrame.page()->chrome().client().graphicsLayerFactory(), *this);
     layer->setAnchorPoint(FloatPoint3D());
-    layer->setBackgroundColor(overlay->backgroundColor());
+    layer->setBackgroundColor(overlay.backgroundColor());
 #ifndef NDEBUG
     layer->setName("Page Overlay content");
 #endif
 
     updateSettingsForLayer(*layer);
 
-    switch (overlay->overlayType()) {
+    switch (overlay.overlayType()) {
     case PageOverlay::OverlayType::View:
         m_viewOverlayRootLayer->addChild(layer.get());
         break;
@@ -125,33 +123,33 @@ void PageOverlayController::installPageOverlay(PassRefPtr<PageOverlay> pageOverl
     }
 
     GraphicsLayer& rawLayer = *layer;
-    m_overlayGraphicsLayers.set(overlay.get(), WTFMove(layer));
+    m_overlayGraphicsLayers.set(&overlay, WTFMove(layer));
 
     updateForceSynchronousScrollLayerPositionUpdates();
 
-    overlay->setPage(m_mainFrame.page());
+    overlay.setPage(m_mainFrame.page());
 
     if (FrameView* frameView = m_mainFrame.view())
         frameView->enterCompositingMode();
 
-    updateOverlayGeometry(*overlay, rawLayer);
+    updateOverlayGeometry(overlay, rawLayer);
 
     if (fadeMode == PageOverlay::FadeMode::Fade)
-        overlay->startFadeInAnimation();
+        overlay.startFadeInAnimation();
 }
 
-void PageOverlayController::uninstallPageOverlay(PageOverlay* overlay, PageOverlay::FadeMode fadeMode)
+void PageOverlayController::uninstallPageOverlay(PageOverlay& overlay, PageOverlay::FadeMode fadeMode)
 {
     if (fadeMode == PageOverlay::FadeMode::Fade) {
-        overlay->startFadeOutAnimation();
+        overlay.startFadeOutAnimation();
         return;
     }
 
-    overlay->setPage(nullptr);
+    overlay.setPage(nullptr);
 
-    m_overlayGraphicsLayers.take(overlay)->removeFromParent();
+    m_overlayGraphicsLayers.take(&overlay)->removeFromParent();
 
-    bool removed = m_pageOverlays.removeFirst(overlay);
+    bool removed = m_pageOverlays.removeFirst(&overlay);
     ASSERT_UNUSED(removed, removed);
 
     updateForceSynchronousScrollLayerPositionUpdates();
index 3978098..638947c 100644 (file)
@@ -39,7 +39,6 @@ class Page;
 class PlatformMouseEvent;
 
 class PageOverlayController final : public GraphicsLayerClient {
-    WTF_MAKE_NONCOPYABLE(PageOverlayController);
     WTF_MAKE_FAST_ALLOCATED;
 public:
     PageOverlayController(MainFrame&);
@@ -50,8 +49,8 @@ public:
 
     const Vector<RefPtr<PageOverlay>>& pageOverlays() const { return m_pageOverlays; }
 
-    WEBCORE_EXPORT void installPageOverlay(PassRefPtr<PageOverlay>, PageOverlay::FadeMode);
-    WEBCORE_EXPORT void uninstallPageOverlay(PageOverlay*, PageOverlay::FadeMode);
+    WEBCORE_EXPORT void installPageOverlay(PageOverlay&, PageOverlay::FadeMode);
+    WEBCORE_EXPORT void uninstallPageOverlay(PageOverlay&, PageOverlay::FadeMode);
 
     void setPageOverlayNeedsDisplay(PageOverlay&, const IntRect&);
     void setPageOverlayOpacity(PageOverlay&, float);
index 7fff123..93d3777 100644 (file)
@@ -80,8 +80,7 @@ static bool isCharsetSpecifyingNode(const Node& node)
             attributes.append(std::make_pair(attribute.name().toString(), attribute.value().string()));
         }
     }
-    TextEncoding textEncoding = HTMLMetaCharsetParser::encodingFromMetaAttributes(attributes);
-    return textEncoding.isValid();
+    return HTMLMetaCharsetParser::encodingFromMetaAttributes(attributes).isValid();
 }
 
 static bool shouldIgnoreElement(const Element& element)
@@ -95,10 +94,9 @@ static const QualifiedName& frameOwnerURLAttributeName(const HTMLFrameOwnerEleme
     return is<HTMLObjectElement>(frameOwner) ? HTMLNames::dataAttr : HTMLNames::srcAttr;
 }
 
-class SerializerMarkupAccumulator final : public WebCore::MarkupAccumulator {
+class PageSerializer::SerializerMarkupAccumulator final : public WebCore::MarkupAccumulator {
 public:
     SerializerMarkupAccumulator(PageSerializer&, Document&, Vector<Node*>*);
-    virtual ~SerializerMarkupAccumulator();
 
 private:
     PageSerializer& m_serializer;
@@ -110,7 +108,7 @@ private:
     void appendEndTag(const Element&) override;
 };
 
-SerializerMarkupAccumulator::SerializerMarkupAccumulator(PageSerializer& serializer, Document& document, Vector<Node*>* nodes)
+PageSerializer::SerializerMarkupAccumulator::SerializerMarkupAccumulator(PageSerializer& serializer, Document& document, Vector<Node*>* nodes)
     : MarkupAccumulator(nodes, ResolveAllURLs)
     , m_serializer(serializer)
     , m_document(document)
@@ -120,18 +118,14 @@ SerializerMarkupAccumulator::SerializerMarkupAccumulator(PageSerializer& seriali
         appendString("<?xml version=\"" + m_document.xmlVersion() + "\" encoding=\"" + m_document.charset() + "\"?>");
 }
 
-SerializerMarkupAccumulator::~SerializerMarkupAccumulator()
-{
-}
-
-void SerializerMarkupAccumulator::appendText(StringBuilder& out, const Text& text)
+void PageSerializer::SerializerMarkupAccumulator::appendText(StringBuilder& out, const Text& text)
 {
     Element* parent = text.parentElement();
     if (parent && !shouldIgnoreElement(*parent))
         MarkupAccumulator::appendText(out, text);
 }
 
-void SerializerMarkupAccumulator::appendElement(StringBuilder& out, const Element& element, Namespaces* namespaces)
+void PageSerializer::SerializerMarkupAccumulator::appendElement(StringBuilder& out, const Element& element, Namespaces* namespaces)
 {
     if (!shouldIgnoreElement(element))
         MarkupAccumulator::appendElement(out, element, namespaces);
@@ -145,7 +139,7 @@ void SerializerMarkupAccumulator::appendElement(StringBuilder& out, const Elemen
     // FIXME: For object (plugins) tags and video tag we could replace them by an image of their current contents.
 }
 
-void SerializerMarkupAccumulator::appendCustomAttributes(StringBuilder& out, const Element& element, Namespaces* namespaces)
+void PageSerializer::SerializerMarkupAccumulator::appendCustomAttributes(StringBuilder& out, const Element& element, Namespaces* namespaces)
 {
     if (!is<HTMLFrameOwnerElement>(element))
         return;
@@ -164,32 +158,20 @@ void SerializerMarkupAccumulator::appendCustomAttributes(StringBuilder& out, con
     appendAttribute(out, element, Attribute(frameOwnerURLAttributeName(frameOwner), url.string()), namespaces);
 }
 
-void SerializerMarkupAccumulator::appendEndTag(const Element& element)
+void PageSerializer::SerializerMarkupAccumulator::appendEndTag(const Element& element)
 {
     if (!shouldIgnoreElement(element))
         MarkupAccumulator::appendEndTag(element);
 }
 
-PageSerializer::Resource::Resource()
-{
-}
-
-PageSerializer::Resource::Resource(const URL& url, const String& mimeType, PassRefPtr<SharedBuffer> data)
-    : url(url)
-    , mimeType(mimeType)
-    , data(data)
-{
-}
-
-PageSerializer::PageSerializer(Vector<PageSerializer::Resource>* resources)
+PageSerializer::PageSerializer(Vector<PageSerializer::Resource>& resources)
     : m_resources(resources)
-    , m_blankFrameCounter(0)
 {
 }
 
-void PageSerializer::serialize(Page* page)
+void PageSerializer::serialize(Page& page)
 {
-    serializeFrame(&page->mainFrame());
+    serializeFrame(&page.mainFrame());
 }
 
 void PageSerializer::serializeFrame(Frame* frame)
@@ -218,7 +200,7 @@ void PageSerializer::serializeFrame(Frame* frame)
     }
     String text = accumulator.serializeNodes(*document->documentElement(), IncludeNode);
     CString frameHTML = textEncoding.encode(text, EntitiesForUnencodables);
-    m_resources->append(Resource(url, document->suggestedMIMEType(), SharedBuffer::create(frameHTML.data(), frameHTML.length())));
+    m_resources.append({ url, document->suggestedMIMEType(), SharedBuffer::create(frameHTML.data(), frameHTML.length()) });
     m_resourceURLs.add(url);
 
     for (auto& node : nodes) {
@@ -284,7 +266,7 @@ void PageSerializer::serializeCSSStyleSheet(CSSStyleSheet* styleSheet, const URL
         ASSERT(textEncoding.isValid());
         String textString = cssText.toString();
         CString text = textEncoding.encode(textString, EntitiesForUnencodables);
-        m_resources->append(Resource(url, String("text/css"), SharedBuffer::create(text.data(), text.length())));
+        m_resources.append({ url, ASCIILiteral { "text/css" }, SharedBuffer::create(text.data(), text.length()) });
         m_resourceURLs.add(url);
     }
 }
@@ -306,8 +288,7 @@ void PageSerializer::addImageToResources(CachedImage* image, RenderElement* imag
         return;
     }
 
-    String mimeType = image->response().mimeType();
-    m_resources->append(Resource(url, mimeType, data));
+    m_resources.append({ url, image->response().mimeType(), WTFMove(data) });
     m_resourceURLs.add(url);
 }
 
@@ -334,20 +315,18 @@ void PageSerializer::retrieveResourcesForProperties(const StyleProperties* style
         if (!image)
             continue;
 
-        URL url = document->completeURL(image->url());
-        addImageToResources(image, nullptr, url);
+        addImageToResources(image, nullptr, document->completeURL(image->url()));
     }
 }
 
 URL PageSerializer::urlForBlankFrame(Frame* frame)
 {
-    HashMap<Frame*, URL>::iterator iter = m_blankFrameURLs.find(frame);
+    auto iter = m_blankFrameURLs.find(frame);
     if (iter != m_blankFrameURLs.end())
         return iter->value;
     String url = "wyciwyg://frame/" + String::number(m_blankFrameCounter++);
     URL fakeURL(ParsedURLString, url);
     m_blankFrameURLs.add(frame, fakeURL);
-
     return fakeURL;
 }
 
index a1b47b9..d5743bc 100644 (file)
@@ -30,7 +30,6 @@
 
 #pragma once
 
-#include "URL.h"
 #include "URLHash.h"
 #include "SharedBuffer.h"
 #include <wtf/HashMap.h>
@@ -56,20 +55,20 @@ public:
         URL url;
         String mimeType;
         RefPtr<SharedBuffer> data;
-        Resource();
-        Resource(const URL&, const String& mimeType, PassRefPtr<SharedBuffer> data);
     };
 
-    explicit PageSerializer(Vector<Resource>*);
+    explicit PageSerializer(Vector<Resource>&);
 
     // Initiates the serialization of the frame's page. All serialized content and retrieved
     // resources are added to the Vector passed to the constructor. The first resource in that
     // vector is the top frame serialized content.
-    void serialize(Page*);
+    void serialize(Page&);
+
+private:
+    class SerializerMarkupAccumulator;
 
     URL urlForBlankFrame(Frame*);
 
-private:
     void serializeFrame(Frame*);
 
     // Serializes the stylesheet back to text and adds it to the resources if URL is not-empty.
@@ -80,10 +79,10 @@ private:
     void retrieveResourcesForProperties(const StyleProperties*, Document*);
     void retrieveResourcesForRule(StyleRule&, Document*);
 
-    Vector<Resource>* m_resources;
+    Vector<Resource>& m_resources;
     ListHashSet<URL> m_resourceURLs;
     HashMap<Frame*, URL> m_blankFrameURLs;
-    unsigned m_blankFrameCounter;
+    unsigned m_blankFrameCounter { 0 };
 };
 
 } // namespace WebCore
index b3a84a3..f8d6ca7 100644 (file)
@@ -34,7 +34,6 @@
 #if ENABLE(WEB_TIMING)
 
 #include "Performance.h"
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/TypeCasts.h>
 #include <wtf/text/WTFString.h>
@@ -54,7 +53,7 @@ public:
     virtual bool isMark() const { return false; }
     virtual bool isMeasure() const { return false; }
 
-    static bool startTimeCompareLessThan(PassRefPtr<PerformanceEntry> a, PassRefPtr<PerformanceEntry> b)
+    static bool startTimeCompareLessThan(const RefPtr<PerformanceEntry>& a, const RefPtr<PerformanceEntry>& b)
     {
         return a->startTime() < b->startTime();
     }
index d953180..9a6c7ac 100644 (file)
@@ -87,14 +87,14 @@ UserTiming::UserTiming(Performance& performance)
 {
 }
 
-static void insertPerformanceEntry(PerformanceEntryMap& performanceEntryMap, PassRefPtr<PerformanceEntry> performanceEntry)
+static void insertPerformanceEntry(PerformanceEntryMap& performanceEntryMap, Ref<PerformanceEntry>&& performanceEntry)
 {
-    RefPtr<PerformanceEntry> entry = performanceEntry;
-    PerformanceEntryMap::iterator it = performanceEntryMap.find(entry->name());
+    RefPtr<PerformanceEntry> entry = WTFMove(performanceEntry);
+    auto it = performanceEntryMap.find(entry->name());
     if (it != performanceEntryMap.end())
-        it->value.append(entry);
+        it->value.append(WTFMove(entry));
     else
-        performanceEntryMap.set(entry->name(), Vector<RefPtr<PerformanceEntry>>{ entry });
+        performanceEntryMap.set(entry->name(), Vector<RefPtr<PerformanceEntry>> { WTFMove(entry) });
 }
 
 static void clearPeformanceEntries(PerformanceEntryMap& performanceEntryMap, const String& name)
index ae8112c..e743d88 100644 (file)
@@ -53,7 +53,7 @@ ResourceUsageOverlay::~ResourceUsageOverlay()
 
     // FIXME: This is a hack so we don't try to uninstall the PageOverlay during Page destruction.
     if (m_page.mainFrame().page())
-        m_page.mainFrame().pageOverlayController().uninstallPageOverlay(m_overlay.get(), PageOverlay::FadeMode::DoNotFade);
+        m_page.mainFrame().pageOverlayController().uninstallPageOverlay(*m_overlay, PageOverlay::FadeMode::DoNotFade);
 }
 
 void ResourceUsageOverlay::initialize()
@@ -72,7 +72,7 @@ void ResourceUsageOverlay::initialize()
 
     m_overlay->setFrame(initialRect);
     m_overlay->setShouldIgnoreMouseEventsOutsideBounds(false);
-    m_page.mainFrame().pageOverlayController().installPageOverlay(m_overlay.get(), PageOverlay::FadeMode::DoNotFade);
+    m_page.mainFrame().pageOverlayController().installPageOverlay(*m_overlay, PageOverlay::FadeMode::DoNotFade);
     platformInitialize();
 }
 
index 5ade002..2dd0c30 100644 (file)
@@ -31,7 +31,6 @@
 #include "Animation.h"
 #include "CSSPropertyNames.h"
 #include "RenderStyleConstants.h"
-#include <wtf/RefCounted.h>
 #include <wtf/text/AtomicString.h>
 
 namespace WebCore {
index 58896db..4c40c92 100644 (file)
@@ -104,7 +104,7 @@ bool AnimationControllerPrivate::clear(RenderElement& renderer)
     Element* element = renderer.element();
 
     m_eventsToDispatch.removeAllMatching([element] (const EventToDispatch& info) {
-        return info.element == element;
+        return info.element.ptr() == element;
     });
 
     m_elementChangesToDispatch.removeAllMatching([element](auto& currentElement) {
@@ -203,7 +203,7 @@ void AnimationControllerPrivate::fireEventsAndUpdateStyle()
     // fire all the events
     Vector<EventToDispatch> eventsToDispatch = WTFMove(m_eventsToDispatch);
     for (auto& event : eventsToDispatch) {
-        Element& element = *event.element;
+        Element& element = event.element;
         if (event.eventType == eventNames().transitionendEvent)
             element.dispatchEvent(TransitionEvent::create(event.eventType, event.name, event.elapsedTime, PseudoElement::pseudoElementNameForEvents(element.pseudoId())));
         else
@@ -225,21 +225,15 @@ void AnimationControllerPrivate::startUpdateStyleIfNeededDispatcher()
         m_updateStyleIfNeededDispatcher.startOneShot(0);
 }
 
-void AnimationControllerPrivate::addEventToDispatch(PassRefPtr<Element> element, const AtomicString& eventType, const String& name, double elapsedTime)
+void AnimationControllerPrivate::addEventToDispatch(Element& element, const AtomicString& eventType, const String& name, double elapsedTime)
 {
-    m_eventsToDispatch.grow(m_eventsToDispatch.size()+1);
-    EventToDispatch& event = m_eventsToDispatch[m_eventsToDispatch.size()-1];
-    event.element = element;
-    event.eventType = eventType;
-    event.name = name;
-    event.elapsedTime = elapsedTime;
-    
+    m_eventsToDispatch.append({ element, eventType, name, elapsedTime });
     startUpdateStyleIfNeededDispatcher();
 }
 
-void AnimationControllerPrivate::addElementChangeToDispatch(Ref<Element>&& element)
+void AnimationControllerPrivate::addElementChangeToDispatch(Element& element)
 {
-    m_elementChangesToDispatch.append(WTFMove(element));
+    m_elementChangesToDispatch.append(element);
     ASSERT(m_elementChangesToDispatch.last()->document().pageCacheState() == Document::NotInPageCache);
     startUpdateStyleIfNeededDispatcher();
 }
index fb9cc82..49ad3f9 100644 (file)
 #pragma once
 
 #include "AnimationBase.h"
-#include "CSSPropertyNames.h"
 #include "Timer.h"
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
 #include <wtf/Vector.h>
-#include <wtf/text/AtomicString.h>
-#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
-class AnimationBase;
 class CompositeAnimation;
 class Document;
-class Element;
 class Frame;
-class RenderElement;
-class RenderStyle;
 
-enum SetChanged {
-    DoNotCallSetChanged = 0,
-    CallSetChanged = 1
-};
+enum SetChanged { DoNotCallSetChanged, CallSetChanged };
 
 class AnimationControllerPrivate {
-    WTF_MAKE_NONCOPYABLE(AnimationControllerPrivate); WTF_MAKE_FAST_ALLOCATED;
+    WTF_MAKE_FAST_ALLOCATED;
 public:
     explicit AnimationControllerPrivate(Frame&);
     ~AnimationControllerPrivate();
@@ -69,8 +57,8 @@ public:
 
     void updateStyleIfNeededDispatcherFired();
     void startUpdateStyleIfNeededDispatcher();
-    void addEventToDispatch(PassRefPtr<Element> element, const AtomicString& eventType, const String& name, double elapsedTime);
-    void addElementChangeToDispatch(Ref<Element>&&);
+    void addEventToDispatch(Element&, const AtomicString& eventType, const String& name, double elapsedTime);
+    void addElementChangeToDispatch(Element&);
 
     bool hasAnimations() const { return !m_compositeAnimations.isEmpty(); }
 
@@ -134,21 +122,19 @@ private:
     Timer m_animationTimer;
     Timer m_updateStyleIfNeededDispatcher;
     Frame& m_frame;
-    
-    class EventToDispatch {
-    public:
-        RefPtr<Element> element;
+
+    struct EventToDispatch {
+        Ref<Element> element;
         AtomicString eventType;
         String name;
         double elapsedTime;
     };
-    
     Vector<EventToDispatch> m_eventsToDispatch;
     Vector<Ref<Element>> m_elementChangesToDispatch;
     
     double m_beginAnimationUpdateTime;
 
-    typedef HashSet<RefPtr<AnimationBase>> AnimationsSet;
+    using AnimationsSet = HashSet<RefPtr<AnimationBase>>;
     AnimationsSet m_animationsWaitingForStyle;
     AnimationsSet m_animationsWaitingForStartTimeResponse;
 
index 9f6b917..8c5403a 100644 (file)
@@ -125,7 +125,7 @@ static inline TransformOperations blendFunc(const AnimationBase* animation, cons
     return to.blendByUsingMatrixInterpolation(from, progress, is<RenderBox>(*animation->renderer()) ? downcast<RenderBox>(*animation->renderer()).borderBoxRect().size() : LayoutSize());
 }
 
-static inline PassRefPtr<ClipPathOperation> blendFunc(const AnimationBase*, ClipPathOperation* from, ClipPathOperation* to, double progress)
+static inline RefPtr<ClipPathOperation> blendFunc(const AnimationBase*, ClipPathOperation* from, ClipPathOperation* to, double progress)
 {
     if (!from || !to)
         return to;
@@ -143,7 +143,7 @@ static inline PassRefPtr<ClipPathOperation> blendFunc(const AnimationBase*, Clip
     return ShapeClipPathOperation::create(toShape.blend(fromShape, progress));
 }
 
-static inline PassRefPtr<ShapeValue> blendFunc(const AnimationBase*, ShapeValue* from, ShapeValue* to, double progress)
+static inline RefPtr<ShapeValue> blendFunc(const AnimationBase*, ShapeValue* from, ShapeValue* to, double progress)
 {
     if (!from || !to)
         return to;
@@ -163,7 +163,7 @@ static inline PassRefPtr<ShapeValue> blendFunc(const AnimationBase*, ShapeValue*
     return ShapeValue::create(toShape.blend(fromShape, progress), to->cssBox());
 }
 
-static inline PassRefPtr<FilterOperation> blendFunc(const AnimationBase* animation, FilterOperation* fromOp, FilterOperation* toOp, double progress, bool blendToPassthrough = false)
+static inline RefPtr<FilterOperation> blendFunc(const AnimationBase* animation, FilterOperation* fromOp, FilterOperation* toOp, double progress, bool blendToPassthrough = false)
 {
     ASSERT(toOp);
     if (toOp->blendingNeedsRendererSize()) {
@@ -218,7 +218,7 @@ static inline FilterOperations blendFunc(const AnimationBase* anim, const Filter
     return result;
 }
 
-static inline PassRefPtr<StyleImage> blendFilter(const AnimationBase* anim, CachedImage* image, const FilterOperations& from, const FilterOperations& to, double progress)
+static inline RefPtr<StyleImage> blendFilter(const AnimationBase* anim, CachedImage* image, const FilterOperations& from, const FilterOperations& to, double progress)
 {
     ASSERT(image);
     FilterOperations filterResult = blendFilterOperations(anim, from, to, progress);
@@ -278,7 +278,7 @@ static inline Vector<SVGLengthValue> blendFunc(const AnimationBase*, const Vecto
     return result;
 }
 
-static inline PassRefPtr<StyleImage> crossfadeBlend(const AnimationBase*, StyleCachedImage* fromStyleImage, StyleCachedImage* toStyleImage, double progress)
+static inline RefPtr<StyleImage> crossfadeBlend(const AnimationBase*, StyleCachedImage* fromStyleImage, StyleCachedImage* toStyleImage, double progress)
 {
     // If progress is at one of the extremes, we want getComputedStyle to show the image,
     // not a completed cross-fade, so we hand back one of the existing images.
@@ -295,7 +295,7 @@ static inline PassRefPtr<StyleImage> crossfadeBlend(const AnimationBase*, StyleC
     return StyleGeneratedImage::create(WTFMove(crossfadeValue));
 }
 
-static inline PassRefPtr<StyleImage> blendFunc(const AnimationBase* anim, StyleImage* from, StyleImage* to, double progress)
+static inline RefPtr<StyleImage> blendFunc(const AnimationBase* anim, StyleImage* from, StyleImage* to, double progress)
 {
     if (!from || !to)
         return to;
@@ -364,11 +364,12 @@ static inline NinePieceImage blendFunc(const AnimationBase* anim, const NinePiec
     if (from.image()->imageSize(anim->renderer(), 1.0) != to.image()->imageSize(anim->renderer(), 1.0))
         return to;
 
-    auto newContentImage = blendFunc(anim, from.image(), to.image(), progress);
-    return NinePieceImage(newContentImage, from.imageSlices(), from.fill(), from.borderSlices(), from.outset(), from.horizontalRule(), from.verticalRule());
+    return NinePieceImage(blendFunc(anim, from.image(), to.image(), progress),
+        from.imageSlices(), from.fill(), from.borderSlices(), from.outset(), from.horizontalRule(), from.verticalRule());
 }
 
 #if ENABLE(VARIATION_FONTS)
+
 static inline FontVariationSettings blendFunc(const AnimationBase* anim, const FontVariationSettings& from, const FontVariationSettings& to, double progress)
 {
     if (from.size() != to.size())
@@ -385,6 +386,7 @@ static inline FontVariationSettings blendFunc(const AnimationBase* anim, const F
     }
     return result;
 }
+
 #endif
 
 class AnimationPropertyWrapperBase {
index 5b74e76..6699270 100644 (file)
@@ -121,8 +121,8 @@ void CompositeAnimation::updateTransitions(RenderElement* renderer, const Render
                 // If there is a running animation for this property, the transition is overridden
                 // and we have to use the unanimatedStyle from the animation. We do the test
                 // against the unanimated style here, but we "override" the transition later.
-                RefPtr<KeyframeAnimation> keyframeAnim = getAnimationForProperty(prop);
-                auto* fromStyle = keyframeAnim ? keyframeAnim->unanimatedStyle() : currentStyle;
+                auto* keyframeAnimation = animationForProperty(prop);
+                auto* fromStyle = keyframeAnimation ? keyframeAnimation->unanimatedStyle() : currentStyle;
 
                 // See if there is a current transition for this prop
                 ImplicitAnimation* implAnim = m_transitions.get(prop);
@@ -172,7 +172,7 @@ void CompositeAnimation::updateTransitions(RenderElement* renderer, const Render
                     LOG(Animations, "Created ImplicitAnimation %p on renderer %p for property %s duration %.2f delay %.2f", implicitAnimation.ptr(), renderer, getPropertyName(prop), animation.duration(), animation.delay());
                     m_transitions.set(prop, WTFMove(implicitAnimation));
                 }
-                
+
                 // We only need one pass for the single prop case
                 if (!all)
                     break;
@@ -399,21 +399,21 @@ double CompositeAnimation::timeToNextService() const
     return minT;
 }
 
-PassRefPtr<KeyframeAnimation> CompositeAnimation::getAnimationForProperty(CSSPropertyID property) const
+KeyframeAnimation* CompositeAnimation::animationForProperty(CSSPropertyID property) const
 {
-    RefPtr<KeyframeAnimation> retval;
-    
+    KeyframeAnimation* result = nullptr;
+
     // We want to send back the last animation with the property if there are multiples.
     // So we need to iterate through all animations
     if (!m_keyframeAnimations.isEmpty()) {
         m_keyframeAnimations.checkConsistency();
         for (auto& animation : m_keyframeAnimations.values()) {
             if (animation->hasAnimationForProperty(property))
-                retval = animation;
+                result = animation.get();
         }
     }
-    
-    return retval;
+
+    return result;
 }
 
 bool CompositeAnimation::computeExtentOfTransformAnimation(LayoutRect& bounds) const
index 337fe6f..40c3a49 100644 (file)
@@ -71,7 +71,7 @@ public:
 
     bool isAnimatingProperty(CSSPropertyID, bool acceleratedOnly, AnimationBase::RunningState) const;
 
-    PassRefPtr<KeyframeAnimation> getAnimationForProperty(CSSPropertyID) const;
+    KeyframeAnimation* animationForProperty(CSSPropertyID) const;
 
     void overrideImplicitAnimations(CSSPropertyID);
     void resumeOverriddenImplicitAnimations(CSSPropertyID);
index 716bea8..fded623 100644 (file)
@@ -163,10 +163,9 @@ void ImplicitAnimation::onAnimationEnd(double elapsedTime)
     // running. But now that the transition has completed, we need to update this style with its new
     // destination. If we didn't, the next time through we would think a transition had started
     // (comparing the old unanimated style with the new final style of the transition).
-    RefPtr<KeyframeAnimation> keyframeAnim = m_compositeAnimation->getAnimationForProperty(m_animatingProperty);
-    if (keyframeAnim)
-        keyframeAnim->setUnanimatedStyle(RenderStyle::clonePtr(*m_toStyle));
-    
+    if (auto* animation = m_compositeAnimation->animationForProperty(m_animatingProperty))
+        animation->setUnanimatedStyle(RenderStyle::clonePtr(*m_toStyle));
+
     sendTransitionEvent(eventNames().transitionendEvent, elapsedTime);
     endAnimation();
 }
@@ -187,7 +186,7 @@ bool ImplicitAnimation::sendTransitionEvent(const AtomicString& eventType, doubl
                 return false;
 
             // Schedule event handling
-            m_compositeAnimation->animationController().addEventToDispatch(element, eventType, propertyName, elapsedTime);
+            m_compositeAnimation->animationController().addEventToDispatch(*element, eventType, propertyName, elapsedTime);
 
             // Restore the original (unanimated) style
             if (eventType == eventNames().transitionendEvent && element->renderer())
index 471bacf..dc29d22 100644 (file)
@@ -327,7 +327,7 @@ bool KeyframeAnimation::sendAnimationEvent(const AtomicString& eventType, double
             return false;
 
         // Schedule event handling
-        m_compositeAnimation->animationController().addEventToDispatch(element, eventType, m_keyframes.animationName(), elapsedTime);
+        m_compositeAnimation->animationController().addEventToDispatch(*element, eventType, m_keyframes.animationName(), elapsedTime);
 
         // Restore the original (unanimated) style
         if ((eventType == eventNames().webkitAnimationEndEvent || eventType == eventNames().animationendEvent) && element->renderer())
index 2106d1e..aad07d6 100644 (file)
@@ -49,7 +49,7 @@ namespace WebCore {
 const double EventHandler::TextDragDelay = 0.0;
 #endif
 
-bool EventHandler::tabsToAllFormControls(KeyboardEvent*) const
+bool EventHandler::tabsToAllFormControls(KeyboardEvent&) const
 {
     return true;
 }
@@ -96,10 +96,12 @@ bool EventHandler::widgetDidHandleWheelEvent(const PlatformWheelEvent& event, Wi
 }
 
 #if ENABLE(DRAG_SUPPORT)
-PassRefPtr<DataTransfer> EventHandler::createDraggingDataTransfer() const
+
+Ref<DataTransfer> EventHandler::createDraggingDataTransfer() const
 {
     return DataTransfer::createForDragAndDrop();
 }
+
 #endif
 
 bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
index 43f0537..aaade00 100644 (file)
@@ -46,7 +46,7 @@ namespace WebCore {
 const double EventHandler::TextDragDelay = 0.0;
 #endif
 
-bool EventHandler::tabsToAllFormControls(KeyboardEvent*) const
+bool EventHandler::tabsToAllFormControls(KeyboardEvent&) const
 {
     // We always allow tabs to all controls
     return true;
@@ -96,10 +96,12 @@ bool EventHandler::widgetDidHandleWheelEvent(const PlatformWheelEvent& event, Wi
 }
 
 #if ENABLE(DRAG_SUPPORT)
-PassRefPtr<DataTransfer> EventHandler::createDraggingDataTransfer() const
+
+Ref<DataTransfer> EventHandler::createDraggingDataTransfer() const
 {
     return DataTransfer::createForDragAndDrop();
 }
+
 #endif
 
 bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
index 524fb5a..29badef 100644 (file)
@@ -120,7 +120,7 @@ void EventHandler::touchEvent(WebEvent *event)
 }
 #endif
 
-bool EventHandler::tabsToAllFormControls(KeyboardEvent* event) const
+bool EventHandler::tabsToAllFormControls(KeyboardEvent& event) const
 {
     Page* page = m_frame.page();
     if (!page)
index e591978..ad7a59e 100644 (file)
@@ -61,6 +61,7 @@
 #include "Settings.h"
 #include "ShadowRoot.h"
 #include "WebCoreSystemInterface.h"
+#include "WheelEventDeltaFilter.h"
 #include "WheelEventTestTrigger.h"
 #include <wtf/BlockObjCExceptions.h>
 #include <wtf/MainThread.h>
@@ -723,7 +724,7 @@ bool EventHandler::eventActivatedView(const PlatformMouseEvent& event) const
 
 #if ENABLE(DRAG_SUPPORT)
 
-PassRefPtr<DataTransfer> EventHandler::createDraggingDataTransfer() const
+Ref<DataTransfer> EventHandler::createDraggingDataTransfer() const
 {
     // Must be done before ondragstart adds types and data to the pboard,
     // also done for security, as it erases data from the last drag.
@@ -734,7 +735,7 @@ PassRefPtr<DataTransfer> EventHandler::createDraggingDataTransfer() const
 
 #endif
 
-bool EventHandler::tabsToAllFormControls(KeyboardEvent* event) const
+bool EventHandler::tabsToAllFormControls(KeyboardEvent& event) const
 {
     Page* page = m_frame.page();
     if (!page)
@@ -971,10 +972,10 @@ void EventHandler::platformPrepareForWheelEvents(const PlatformWheelEvent& wheel
                 m_frame.mainFrame().pushNewLatchingState();
                 latchingState = m_frame.mainFrame().latchingState();
                 latchingState->setStartedGestureAtScrollLimit(false);
-                latchingState->setWheelEventElement(wheelEventTarget);
+                latchingState->setWheelEventElement(wheelEventTarget.get());
                 latchingState->setFrame(&m_frame);
                 // FIXME: What prevents us from deleting this scrollable container while still holding a pointer to it?
-                latchingState->setScrollableContainer(scrollableContainer);
+                latchingState->setScrollableContainer(scrollableContainer.get());
                 latchingState->setWidgetIsLatched(result.isOverWidget());
                 isOverWidget = latchingState->widgetIsLatched();
                 m_frame.mainFrame().wheelEventDeltaFilter()->beginFilteringDeltas();
index 55e4d65..65b1cee 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -31,7 +31,6 @@
 #include "PageOverlay.h"
 #include "Range.h"
 #include "Timer.h"
-#include <wtf/RefCounted.h>
 
 typedef struct __DDHighlight *DDHighlightRef;
 
@@ -39,6 +38,7 @@ namespace WebCore {
     
 class LayoutRect;
 class MainFrame;
+
 struct GapRects;
 
 class ServicesOverlayController : private PageOverlay::Client {
@@ -54,14 +54,14 @@ private:
     class Highlight : public RefCounted<Highlight>, private GraphicsLayerClient {
         WTF_MAKE_NONCOPYABLE(Highlight);
     public:
-        static Ref<Highlight> createForSelection(ServicesOverlayController&, RetainPtr<DDHighlightRef>, PassRefPtr<Range>);
-        static Ref<Highlight> createForTelephoneNumber(ServicesOverlayController&, RetainPtr<DDHighlightRef>, PassRefPtr<Range>);
+        static Ref<Highlight> createForSelection(ServicesOverlayController&, RetainPtr<DDHighlightRef>, Ref<Range>&&);
+        static Ref<Highlight> createForTelephoneNumber(ServicesOverlayController&, RetainPtr<DDHighlightRef>, Ref<Range>&&);
         ~Highlight();
 
         void invalidate();
 
         DDHighlightRef ddHighlight() const { return m_ddHighlight.get(); }
-        Range* range() const { return m_range.get(); }
+        Range& range() const { return m_range.get(); }
         GraphicsLayer* layer() const { return m_graphicsLayer.get(); }
 
         enum {
@@ -77,7 +77,7 @@ private:
         void setDDHighlight(DDHighlightRef);
 
     private:
-        explicit Highlight(ServicesOverlayController&, Type, RetainPtr<DDHighlightRef>, PassRefPtr<Range>);
+        Highlight(ServicesOverlayController&, Type, RetainPtr<DDHighlightRef>, Ref<Range>&&);
 
         // GraphicsLayerClient
         void notifyFlushRequired(const GraphicsLayer*) override;
@@ -87,7 +87,7 @@ private:
         void didFinishFadeOutAnimation();
 
         RetainPtr<DDHighlightRef> m_ddHighlight;
-        RefPtr<Range> m_range;
+        Ref<Range> m_range;
         std::unique_ptr<GraphicsLayer> m_graphicsLayer;
         Type m_type;
         ServicesOverlayController* m_controller;
index 9a815b5..4b03e22 100644 (file)
@@ -55,23 +55,22 @@ const float highlightFadeAnimationDuration = 0.3;
 
 namespace WebCore {
 
-Ref<ServicesOverlayController::Highlight> ServicesOverlayController::Highlight::createForSelection(ServicesOverlayController& controller, RetainPtr<DDHighlightRef> ddHighlight, PassRefPtr<Range> range)
+Ref<ServicesOverlayController::Highlight> ServicesOverlayController::Highlight::createForSelection(ServicesOverlayController& controller, RetainPtr<DDHighlightRef> ddHighlight, Ref<Range>&& range)
 {
-    return adoptRef(*new Highlight(controller, Highlight::SelectionType, ddHighlight, range));
+    return adoptRef(*new Highlight(controller, Highlight::SelectionType, ddHighlight, WTFMove(range)));
 }
 
-Ref<ServicesOverlayController::Highlight> ServicesOverlayController::Highlight::createForTelephoneNumber(ServicesOverlayController& controller, RetainPtr<DDHighlightRef> ddHighlight, PassRefPtr<Range> range)
+Ref<ServicesOverlayController::Highlight> ServicesOverlayController::Highlight::createForTelephoneNumber(ServicesOverlayController& controller, RetainPtr<DDHighlightRef> ddHighlight, Ref<Range>&& range)
 {
-    return adoptRef(*new Highlight(controller, Highlight::TelephoneNumberType, ddHighlight, range));
+    return adoptRef(*new Highlight(controller, Highlight::TelephoneNumberType, ddHighlight, WTFMove(range)));
 }
 
-ServicesOverlayController::Highlight::Highlight(ServicesOverlayController& controller, Type type, RetainPtr<DDHighlightRef> ddHighlight, PassRefPtr<WebCore::Range> range)
-    : m_range(range)
+ServicesOverlayController::Highlight::Highlight(ServicesOverlayController& controller, Type type, RetainPtr<DDHighlightRef> ddHighlight, Ref<WebCore::Range>&& range)
+    : m_range(WTFMove(range))
     , m_type(type)
     , m_controller(&controller)
 {
     ASSERT(ddHighlight);
-    ASSERT(m_range);
 
     Page* page = controller.mainFrame().page();
     m_graphicsLayer = GraphicsLayer::create(page ? page->chrome().client().graphicsLayerFactory() : nullptr, *this);
@@ -409,7 +408,7 @@ void ServicesOverlayController::buildPotentialHighlightsIfNeeded()
 
     if (m_potentialHighlights.isEmpty()) {
         if (m_servicesOverlay)
-            m_mainFrame.pageOverlayController().uninstallPageOverlay(m_servicesOverlay, PageOverlay::FadeMode::DoNotFade);
+            m_mainFrame.pageOverlayController().uninstallPageOverlay(*m_servicesOverlay, PageOverlay::FadeMode::DoNotFade);
         return;
     }
 
@@ -527,7 +526,7 @@ void ServicesOverlayController::buildPhoneNumberHighlights()
         CGRect cgRect = rect;
         RetainPtr<DDHighlightRef> ddHighlight = adoptCF(DDHighlightCreateWithRectsInVisibleRectWithStyleAndDirection(nullptr, &cgRect, 1, mainFrameView.visibleContentRect(), DDHighlightStyleBubbleStandard | DDHighlightStyleStandardIconArrow, YES, NSWritingDirectionNatural, NO, YES));
 
-        newPotentialHighlights.add(Highlight::createForTelephoneNumber(*this, ddHighlight, range));
+        newPotentialHighlights.add(Highlight::createForTelephoneNumber(*this, ddHighlight, range.releaseNonNull()));
     }
 
     replaceHighlightsOfTypePreservingEquivalentHighlights(newPotentialHighlights, Highlight::TelephoneNumberType);
@@ -570,7 +569,7 @@ void ServicesOverlayController::buildSelectionHighlight()
             CGRect visibleRect = mainFrameView->visibleContentRect();
             RetainPtr<DDHighlightRef> ddHighlight = adoptCF(DDHighlightCreateWithRectsInVisibleRectWithStyleAndDirection(nullptr, cgRects.begin(), cgRects.size(), visibleRect, DDHighlightStyleBubbleNone | DDHighlightStyleStandardIconArrow | DDHighlightStyleButtonShowAlways, YES, NSWritingDirectionNatural, NO, YES));
             
-            newPotentialHighlights.add(Highlight::createForSelection(*this, ddHighlight, selectionRange));
+            newPotentialHighlights.add(Highlight::createForSelection(*this, ddHighlight, selectionRange.releaseNonNull()));
         }
     }
 
@@ -638,14 +637,9 @@ bool ServicesOverlayController::highlightsAreEquivalent(const Highlight* a, cons
 {
     if (a == b)
         return true;
-
     if (!a || !b)
         return false;
-
-    if (a->type() == b->type() && areRangesEqual(a->range(), b->range()))
-        return true;
-
-    return false;
+    return a->type() == b->type() && areRangesEqual(&a->range(), &b->range());
 }
 
 ServicesOverlayController::Highlight* ServicesOverlayController::findTelephoneNumberHighlightContainingSelectionHighlight(Highlight& selectionHighlight)
@@ -669,7 +663,7 @@ ServicesOverlayController::Highlight* ServicesOverlayController::findTelephoneNu
         if (highlight->type() != Highlight::TelephoneNumberType)
             continue;
 
-        if (highlight->range()->contains(*activeSelectionRange))
+        if (highlight->range().contains(*activeSelectionRange))
             return highlight.get();
     }
 
@@ -832,7 +826,7 @@ void ServicesOverlayController::handleClick(const IntPoint& clickPoint, Highligh
 
         page->chrome().client().handleSelectionServiceClick(page->focusController().focusedOrMainFrame().selection(), selectedTelephoneNumbers, windowPoint);
     } else if (highlight.type() == Highlight::TelephoneNumberType)
-        page->chrome().client().handleTelephoneNumberClick(highlight.range()->text(), windowPoint);
+        page->chrome().client().handleTelephoneNumberClick(highlight.range().text(), windowPoint);
 }
 
 void ServicesOverlayController::didCreateHighlight(Highlight* highlight)
index e4e20d2..e5929ba 100644 (file)
@@ -64,7 +64,7 @@ using namespace WebCore;
     BOOL _fadingOut;
 }
 
-- (instancetype)initWithFrame:(NSRect)frame textIndicator:(PassRefPtr<TextIndicator>)textIndicator margin:(NSSize)margin offset:(NSPoint)offset;
+- (instancetype)initWithFrame:(NSRect)frame textIndicator:(TextIndicator&)textIndicator margin:(NSSize)margin offset:(NSPoint)offset;
 
 - (void)present;
 - (void)hideWithCompletionHandler:(void(^)(void))completionHandler;
@@ -147,12 +147,12 @@ static bool indicatorWantsManualAnimation(const TextIndicator& indicator)
     return false;
 }
 
-- (instancetype)initWithFrame:(NSRect)frame textIndicator:(PassRefPtr<TextIndicator>)textIndicator margin:(NSSize)margin offset:(NSPoint)offset
+- (instancetype)initWithFrame:(NSRect)frame textIndicator:(TextIndicator&)textIndicator margin:(NSSize)margin offset:(NSPoint)offset
 {
     if (!(self = [super initWithFrame:frame]))
         return nil;
 
-    _textIndicator = textIndicator;
+    _textIndicator = &textIndicator;
     _margin = margin;
 
     self.wantsLayer = YES;
@@ -465,7 +465,8 @@ void TextIndicatorWindow::setTextIndicator(Ref<TextIndicator> textIndicator, CGR
     [m_textIndicatorWindow setOpaque:NO];
     [m_textIndicatorWindow setIgnoresMouseEvents:YES];
 
-    m_textIndicatorView = adoptNS([[WebTextIndicatorView alloc] initWithFrame:NSMakeRect(0, 0, [m_textIndicatorWindow frame].size.width, [m_textIndicatorWindow frame].size.height) textIndicator:m_textIndicator margin:NSMakeSize(horizontalMargin, verticalMargin) offset:fractionalTextOffset]);
+    m_textIndicatorView = adoptNS([[WebTextIndicatorView alloc] initWithFrame:NSMakeRect(0, 0, [m_textIndicatorWindow frame].size.width, [m_textIndicatorWindow frame].size.height)
+        textIndicator:*m_textIndicator margin:NSMakeSize(horizontalMargin, verticalMargin) offset:fractionalTextOffset]);
     [m_textIndicatorWindow setContentView:m_textIndicatorView.get()];
 
     [[m_targetView window] addChildWindow:m_textIndicatorWindow.get() ordered:NSWindowAbove];
index a43417d..011ae0f 100644 (file)
@@ -30,7 +30,6 @@
 #include "ScrollingCoordinator.h"
 #include "ScrollingTree.h"
 #include "Timer.h"
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 
 namespace WebCore {
@@ -69,11 +68,11 @@ public:
 protected:
     WEBCORE_EXPORT AsyncScrollingCoordinator(Page*);
 
-    void setScrollingTree(PassRefPtr<ScrollingTree> scrollingTree) { m_scrollingTree = scrollingTree; }
+    void setScrollingTree(Ref<ScrollingTree>&& scrollingTree) { m_scrollingTree = WTFMove(scrollingTree); }
 
     ScrollingStateTree* scrollingStateTree() { return m_scrollingStateTree.get(); }
 
-    PassRefPtr<ScrollingTree> releaseScrollingTree() { return WTFMove(m_scrollingTree); }
+    RefPtr<ScrollingTree> releaseScrollingTree() { return WTFMove(m_scrollingTree); }
 
     void updateScrollPositionAfterAsyncScroll(ScrollingNodeID, const FloatPoint&, std::optional<FloatPoint> layoutViewportOrigin, bool programmaticScroll, ScrollingLayerPositionAction);
 
index e39d99e..01e6529 100644 (file)
@@ -31,9 +31,6 @@
 namespace WebCore {
 
 ScrollLatchingState::ScrollLatchingState()
-    : m_frame(nullptr)
-    , m_widgetIsLatched(false)
-    , m_startedGestureAtScrollLimit(false)
 {
 }
     
@@ -50,7 +47,7 @@ void ScrollLatchingState::clear()
     m_previousWheelScrolledElement = nullptr;
 }
 
-void ScrollLatchingState::setWheelEventElement(PassRefPtr<Element> element)
+void ScrollLatchingState::setWheelEventElement(Element* element)
 {
     m_wheelEventElement = element;
 }
@@ -60,14 +57,14 @@ void ScrollLatchingState::setWidgetIsLatched(bool isOverWidget)
     m_widgetIsLatched = isOverWidget;
 }
 
-void ScrollLatchingState::setPreviousWheelScrolledElement(RefPtr<Element>&& element)
+void ScrollLatchingState::setPreviousWheelScrolledElement(Element* element)
 {
     m_previousWheelScrolledElement = element;
 }
 
-void ScrollLatchingState::setScrollableContainer(PassRefPtr<ContainerNode> node)
+void ScrollLatchingState::setScrollableContainer(ContainerNode* container)
 {
-    m_scrollableContainer = node;
+    m_scrollableContainer = container;
 }
 
 }
index 4dc0dd3..11dcbd0 100644 (file)
@@ -41,7 +41,7 @@ public:
     void clear();
 
     Element* wheelEventElement() { return m_wheelEventElement.get(); }
-    void setWheelEventElement(PassRefPtr<Element>);
+    void setWheelEventElement(Element*);
     Frame* frame() { return m_frame; }
     void setFrame(Frame* frame) { m_frame = frame; }
 
@@ -49,10 +49,10 @@ public:
     void setWidgetIsLatched(bool isOverWidget);
 
     Element* previousWheelScrolledElement() { return m_previousWheelScrolledElement.get(); }
-    void setPreviousWheelScrolledElement(RefPtr<Element>&&);
+    void setPreviousWheelScrolledElement(Element*);
     
     ContainerNode* scrollableContainer() { return m_scrollableContainer.get(); }
-    void setScrollableContainer(PassRefPtr<ContainerNode>);
+    void setScrollableContainer(ContainerNode*);
     bool startedGestureAtScrollLimit() const { return m_startedGestureAtScrollLimit; }
     void setStartedGestureAtScrollLimit(bool startedAtLimit) { m_startedGestureAtScrollLimit = startedAtLimit; }
 
@@ -61,10 +61,10 @@ private:
     RefPtr<Element> m_previousWheelScrolledElement;
     RefPtr<ContainerNode> m_scrollableContainer;
 
-    Frame* m_frame;
-    
-    bool m_widgetIsLatched;
-    bool m_startedGestureAtScrollLimit;
+    Frame* m_frame { nullptr };
+
+    bool m_widgetIsLatched { false };
+    bool m_startedGestureAtScrollLimit { false };
 };
     
 } // namespace WebCore
index c8459b0..61da58a 100644 (file)
@@ -72,7 +72,7 @@ void ScrollingStateNode::setPropertyChanged(unsigned propertyBit)
     m_scrollingStateTree.setHasChangedProperties();
 }
 
-PassRefPtr<ScrollingStateNode> ScrollingStateNode::cloneAndReset(ScrollingStateTree& adoptiveTree)
+Ref<ScrollingStateNode> ScrollingStateNode::cloneAndReset(ScrollingStateTree& adoptiveTree)
 {
     auto clone = this->clone(adoptiveTree);
 
@@ -80,7 +80,8 @@ PassRefPtr<ScrollingStateNode> ScrollingStateNode::cloneAndReset(ScrollingStateT
     resetChangedProperties();
 
     cloneAndResetChildren(clone.get(), adoptiveTree);
-    return WTFMove(clone);
+
+    return clone;
 }
 
 void ScrollingStateNode::cloneAndResetChildren(ScrollingStateNode& clone, ScrollingStateTree& adoptiveTree)
@@ -92,14 +93,13 @@ void ScrollingStateNode::cloneAndResetChildren(ScrollingStateNode& clone, Scroll
         clone.appendChild(child->cloneAndReset(adoptiveTree));
 }
 
-void ScrollingStateNode::appendChild(PassRefPtr<ScrollingStateNode> childNode)
+void ScrollingStateNode::appendChild(Ref<ScrollingStateNode>&& childNode)
 {
     childNode->setParent(this);
 
     if (!m_children)
         m_children = std::make_unique<Vector<RefPtr<ScrollingStateNode>>>();
-
-    m_children->append(childNode);
+    m_children->append(WTFMove(childNode));
 }
 
 void ScrollingStateNode::setLayer(const LayerRepresentation& layerRepresentation)
index bfad1c4..087d618 100644 (file)
@@ -206,7 +206,7 @@ public:
     bool isOverflowScrollingNode() const { return m_nodeType == OverflowScrollingNode; }
 
     virtual Ref<ScrollingStateNode> clone(ScrollingStateTree& adoptiveTree) = 0;
-    PassRefPtr<ScrollingStateNode> cloneAndReset(ScrollingStateTree& adoptiveTree);
+    Ref<ScrollingStateNode> cloneAndReset(ScrollingStateTree& adoptiveTree);
     void cloneAndResetChildren(ScrollingStateNode&, ScrollingStateTree& adoptiveTree);
 
     enum {
@@ -238,7 +238,7 @@ public:
 
     Vector<RefPtr<ScrollingStateNode>>* children() const { return m_children.get(); }
 
-    void appendChild(PassRefPtr<ScrollingStateNode>);
+    void appendChild(Ref<ScrollingStateNode>&&);
 
     String scrollingStateTreeAsText() const;
 
index 98b6cad..0bbc1b7 100644 (file)
@@ -67,7 +67,7 @@ void ScrollingStateTree::setHasChangedProperties(bool changedProperties)
 #endif
 }
 
-PassRefPtr<ScrollingStateNode> ScrollingStateTree::createNode(ScrollingNodeType nodeType, ScrollingNodeID nodeID)
+Ref<ScrollingStateNode> ScrollingStateTree::createNode(ScrollingNodeType nodeType, ScrollingNodeID nodeID)
 {
     switch (nodeType) {
     case FixedNode:
@@ -80,7 +80,7 @@ PassRefPtr<ScrollingStateNode> ScrollingStateTree::createNode(ScrollingNodeType
         return ScrollingStateOverflowScrollingNode::create(*this, nodeID);
     }
     ASSERT_NOT_REACHED();
-    return nullptr;
+    return ScrollingStateFixedNode::create(*this, nodeID);
 }
 
 bool ScrollingStateTree::nodeTypeAndParentMatch(ScrollingStateNode& node, ScrollingNodeType nodeType, ScrollingNodeID parentID) const
@@ -129,13 +129,13 @@ ScrollingNodeID ScrollingStateTree::attachNode(ScrollingNodeType nodeType, Scrol
         if (nodeType == FrameScrollingNode && parentID) {
             if (auto orphanedNode = m_orphanedSubframeNodes.take(newNodeID)) {
                 newNode = orphanedNode.get();
-                parent->appendChild(WTFMove(orphanedNode));
+                parent->appendChild(orphanedNode.releaseNonNull());
             }
         }
 
         if (!newNode) {
             auto stateNode = createNode(nodeType, newNodeID);
-            newNode = stateNode.get();
+            newNode = stateNode.ptr();
             parent->appendChild(WTFMove(stateNode));
         }
     }
@@ -182,7 +182,7 @@ std::unique_ptr<ScrollingStateTree> ScrollingStateTree::commit(LayerRepresentati
     treeStateClone->setPreferredLayerRepresentation(preferredLayerRepresentation);
 
     if (m_rootStateNode)
-        treeStateClone->setRootStateNode(static_pointer_cast<ScrollingStateFrameScrollingNode>(m_rootStateNode->cloneAndReset(*treeStateClone)));
+        treeStateClone->setRootStateNode(static_reference_cast<ScrollingStateFrameScrollingNode>(m_rootStateNode->cloneAndReset(*treeStateClone)));
 
     // Copy the IDs of the nodes that have been removed since the last commit into the clone.
     treeStateClone->m_nodesRemovedSinceLastCommit.swap(m_nodesRemovedSinceLastCommit);
@@ -211,7 +211,8 @@ void ScrollingStateTree::removeNodeAndAllDescendants(ScrollingStateNode* node, S
     if (node == m_rootStateNode)
         m_rootStateNode = nullptr;
     else if (parent) {
-        ASSERT(parent->children() && parent->children()->find(node) != notFound);
+        ASSERT(parent->children());
+        ASSERT(parent->children()->find(node) != notFound);
         if (auto children = parent->children()) {
             size_t index = children->find(node);
             if (index != notFound)
index 31f6db7..3b25615 100644 (file)
@@ -74,17 +74,14 @@ public:
     void setPreferredLayerRepresentation(LayerRepresentation::Type representation) { m_preferredLayerRepresentation = representation; }
 
 private:
-    void setRootStateNode(PassRefPtr<ScrollingStateFrameScrollingNode> rootStateNode) { m_rootStateNode = rootStateNode; }
+    void setRootStateNode(Ref<ScrollingStateFrameScrollingNode>&& rootStateNode) { m_rootStateNode = WTFMove(rootStateNode); }
     void addNode(ScrollingStateNode*);
 
-    PassRefPtr<ScrollingStateNode> createNode(ScrollingNodeType, ScrollingNodeID);
+    Ref<ScrollingStateNode> createNode(ScrollingNodeType, ScrollingNodeID);
 
     bool nodeTypeAndParentMatch(ScrollingStateNode&, ScrollingNodeType, ScrollingNodeID parentID) const;
 
-    enum class SubframeNodeRemoval {
-        Delete,
-        Orphan
-    };
+    enum class SubframeNodeRemoval { Delete, Orphan };
     void removeNodeAndAllDescendants(ScrollingStateNode*, SubframeNodeRemoval = SubframeNodeRemoval::Delete);
 
     void recursiveNodeWillBeRemoved(ScrollingStateNode* currNode, SubframeNodeRemoval);
index d00ec5d..40bcc63 100644 (file)
@@ -179,7 +179,7 @@ void ScrollingTree::updateTreeFromStateNode(const ScrollingStateNode* stateNode,
         if (parentIt != m_nodeMap.end()) {
             ScrollingTreeNode* parent = parentIt->value;
             node->setParent(parent);
-            parent->appendChild(node);
+            parent->appendChild(*node);
         }
     }
 
@@ -189,7 +189,7 @@ void ScrollingTree::updateTreeFromStateNode(const ScrollingStateNode* stateNode,
     if (auto nodeChildren = node->children()) {
         for (auto& childScrollingNode : *nodeChildren) {
             childScrollingNode->setParent(nullptr);
-            orphanNodes.add(childScrollingNode->scrollingNodeID(), childScrollingNode);
+            orphanNodes.add(childScrollingNode->scrollingNodeID(), childScrollingNode.get());
         }
         nodeChildren->clear();
     }
index 6734b53..aaf2d47 100644 (file)
@@ -74,7 +74,7 @@ public:
 
     void setMainFramePinState(bool pinnedToTheLeft, bool pinnedToTheRight, bool pinnedToTheTop, bool pinnedToTheBottom);
 
-    virtual PassRefPtr<ScrollingTreeNode> createScrollingTreeNode(ScrollingNodeType, ScrollingNodeID) = 0;
+    virtual Ref<ScrollingTreeNode> createScrollingTreeNode(ScrollingNodeType, ScrollingNodeID) = 0;
 
     // Called after a scrolling tree node has handled a scroll and updated its layers.
     // Updates FrameView/RenderLayer scrolling state and GraphicsLayers.
index deb781a..0f6616d 100644 (file)
@@ -45,22 +45,21 @@ ScrollingTreeNode::~ScrollingTreeNode()
 {
 }
 
-void ScrollingTreeNode::appendChild(PassRefPtr<ScrollingTreeNode> childNode)
+void ScrollingTreeNode::appendChild(Ref<ScrollingTreeNode>&& childNode)
 {
     childNode->setParent(this);
 
     if (!m_children)
-        m_children = std::make_unique<ScrollingTreeChildrenVector>();
-
-    m_children->append(childNode);
+        m_children = std::make_unique<Vector<RefPtr<ScrollingTreeNode>>>();
+    m_children->append(WTFMove(childNode));
 }
 
-void ScrollingTreeNode::removeChild(ScrollingTreeNode* node)
+void ScrollingTreeNode::removeChild(ScrollingTreeNode& node)
 {
     if (!m_children)
         return;
 
-    size_t index = m_children->find(node);
+    size_t index = m_children->find(&node);
 
     // The index will be notFound if the node to remove is a deeper-than-1-level descendant or
     // if node is the root state node.
index 3e86e3d..2e16324 100644 (file)
@@ -60,11 +60,10 @@ public:
     ScrollingTreeNode* parent() const { return m_parent; }
     void setParent(ScrollingTreeNode* parent) { m_parent = parent; }
 
-    typedef Vector<RefPtr<ScrollingTreeNode>> ScrollingTreeChildrenVector;
-    ScrollingTreeChildrenVector* children() { return m_children.get(); }
-    
-    void appendChild(PassRefPtr<ScrollingTreeNode>);
-    void removeChild(ScrollingTreeNode*);
+    Vector<RefPtr<ScrollingTreeNode>>* children() { return m_children.get(); }
+
+    void appendChild(Ref<ScrollingTreeNode>&&);
+    void removeChild(ScrollingTreeNode&);
 
     WEBCORE_EXPORT void dump(TextStream&, ScrollingStateTreeAsTextBehavior) const;
 
@@ -72,7 +71,7 @@ protected:
     ScrollingTreeNode(ScrollingTree&, ScrollingNodeType, ScrollingNodeID);
     ScrollingTree& scrollingTree() const { return m_scrollingTree; }
 
-    std::unique_ptr<ScrollingTreeChildrenVector> m_children;
+    std::unique_ptr<Vector<RefPtr<ScrollingTreeNode>>> m_children;
 
     WEBCORE_EXPORT virtual void dumpProperties(TextStream&, ScrollingStateTreeAsTextBehavior) const;
 
index bcb48e4..f664ed3 100644 (file)
@@ -39,8 +39,8 @@
 
 namespace WebCore {
 
-ThreadedScrollingTree::ThreadedScrollingTree(AsyncScrollingCoordinator* scrollingCoordinator)
-    : m_scrollingCoordinator(scrollingCoordinator)
+ThreadedScrollingTree::ThreadedScrollingTree(AsyncScrollingCoordinator& scrollingCoordinator)
+    : m_scrollingCoordinator(&scrollingCoordinator)
 {
 }
 
index 7325405..6d1d49d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -55,7 +55,7 @@ public:
     void invalidate() override;
 
 protected:
-    explicit ThreadedScrollingTree(AsyncScrollingCoordinator*);
+    explicit ThreadedScrollingTree(AsyncScrollingCoordinator&);
 
     void scrollingTreeNodeDidScroll(ScrollingNodeID, const FloatPoint& scrollPosition, const std::optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction = ScrollingLayerPositionAction::Sync) override;
     void currentSnapPointIndicesDidChange(ScrollingNodeID, unsigned horizontal, unsigned vertical) override;
index 4ccf444..6b16857 100644 (file)
@@ -52,7 +52,7 @@ ScrollingCoordinatorIOS::ScrollingCoordinatorIOS(Page* page)
     : AsyncScrollingCoordinator(page)
     , m_scrollingStateTreeCommitterTimer(*this, &ScrollingCoordinatorIOS::commitTreeState)
 {
-    setScrollingTree(ScrollingTreeIOS::create(this));
+    setScrollingTree(ScrollingTreeIOS::create(*this));
 }
 
 ScrollingCoordinatorIOS::~ScrollingCoordinatorIOS()
index 10b3f87..1f03e68 100644 (file)
 
 namespace WebCore {
 
-Ref<ScrollingTreeIOS> ScrollingTreeIOS::create(AsyncScrollingCoordinator* scrollingCoordinator)
+Ref<ScrollingTreeIOS> ScrollingTreeIOS::create(AsyncScrollingCoordinator& scrollingCoordinator)
 {
     return adoptRef(*new ScrollingTreeIOS(scrollingCoordinator));
 }
 
-ScrollingTreeIOS::ScrollingTreeIOS(AsyncScrollingCoordinator* scrollingCoordinator)
-    : m_scrollingCoordinator(scrollingCoordinator)
+ScrollingTreeIOS::ScrollingTreeIOS(AsyncScrollingCoordinator& scrollingCoordinator)
+    : m_scrollingCoordinator(&scrollingCoordinator)
 {
 }
 
@@ -83,20 +83,21 @@ void ScrollingTreeIOS::scrollingTreeNodeDidScroll(ScrollingNodeID nodeID, const
     });
 }
 
-PassRefPtr<ScrollingTreeNode> ScrollingTreeIOS::createScrollingTreeNode(ScrollingNodeType nodeType, ScrollingNodeID nodeID)
+Ref<ScrollingTreeNode> ScrollingTreeIOS::createScrollingTreeNode(ScrollingNodeType nodeType, ScrollingNodeID nodeID)
 {
     switch (nodeType) {
     case FrameScrollingNode:
         return ScrollingTreeFrameScrollingNodeIOS::create(*this, nodeID);
     case OverflowScrollingNode:
         ASSERT_NOT_REACHED();
-        return nullptr;
+        break;
     case FixedNode:
         return ScrollingTreeFixedNode::create(*this, nodeID);
     case StickyNode:
         return ScrollingTreeStickyNode::create(*this, nodeID);
     }
-    return nullptr;
+    ASSERT_NOT_REACHED();
+    return ScrollingTreeFixedNode::create(*this, nodeID);
 }
 
 FloatRect ScrollingTreeIOS::fixedPositionRect()
index 1a9aae1..aea69b3 100644 (file)
 
 #include "ScrollingStateTree.h"
 #include "ScrollingTree.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
 
 namespace WebCore {
 
 class AsyncScrollingCoordinator;
 
-class ScrollingTreeIOS : public ScrollingTree {
+class ScrollingTreeIOS final : public ScrollingTree {
 public:
-    static Ref<ScrollingTreeIOS> create(AsyncScrollingCoordinator*);
+    static Ref<ScrollingTreeIOS> create(AsyncScrollingCoordinator&);
     virtual ~ScrollingTreeIOS();
 
-    // No wheel events on iOS
-    void handleWheelEvent(const PlatformWheelEvent&) override { }
-    EventResult tryToHandleWheelEvent(const PlatformWheelEvent&) override { return DidNotHandleEvent; }
-
-    void invalidate() override;
-
 private:
-    explicit ScrollingTreeIOS(AsyncScrollingCoordinator*);
-    bool isScrollingTreeIOS() const override { return true; }
+    explicit ScrollingTreeIOS(AsyncScrollingCoordinator&);
 
-    PassRefPtr<ScrollingTreeNode> createScrollingTreeNode(ScrollingNodeType, ScrollingNodeID) override;
+    bool isScrollingTreeIOS() const final { return true; }
 
-    void scrollingTreeNodeDidScroll(ScrollingNodeID, const FloatPoint& scrollPosition, const std::optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction = ScrollingLayerPositionAction::Sync) override;
+    // No wheel events on iOS
+    void handleWheelEvent(const PlatformWheelEvent&) final { }
+    EventResult tryToHandleWheelEvent(const PlatformWheelEvent&) final { return DidNotHandleEvent; }
 
-    void currentSnapPointIndicesDidChange(WebCore::ScrollingNodeID, unsigned horizontal, unsigned vertical) override;
+    void invalidate() final;
 
-    FloatRect fixedPositionRect() override;
+    Ref<ScrollingTreeNode> createScrollingTreeNode(ScrollingNodeType, ScrollingNodeID) final;
+    void scrollingTreeNodeDidScroll(ScrollingNodeID, const FloatPoint& scrollPosition, const std::optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction = ScrollingLayerPositionAction::Sync) final;
+    void currentSnapPointIndicesDidChange(WebCore::ScrollingNodeID, unsigned horizontal, unsigned vertical) final;
+    FloatRect fixedPositionRect() final;
 
     RefPtr<AsyncScrollingCoordinator> m_scrollingCoordinator;
 };
index d43d94b..86118b4 100644 (file)
@@ -54,7 +54,7 @@ ScrollingCoordinatorMac::ScrollingCoordinatorMac(Page* page)
     : AsyncScrollingCoordinator(page)
     , m_scrollingStateTreeCommitterTimer(*this, &ScrollingCoordinatorMac::commitTreeState)
 {
-    setScrollingTree(ScrollingTreeMac::create(this));
+    setScrollingTree(ScrollingTreeMac::create(*this));
 }
 
 ScrollingCoordinatorMac::~ScrollingCoordinatorMac()
index 70dbc06..899f1e9 100644 (file)
 
 using namespace WebCore;
 
-Ref<ScrollingTreeMac> ScrollingTreeMac::create(AsyncScrollingCoordinator* scrollingCoordinator)
+Ref<ScrollingTreeMac> ScrollingTreeMac::create(AsyncScrollingCoordinator& scrollingCoordinator)
 {
     return adoptRef(*new ScrollingTreeMac(scrollingCoordinator));
 }
 
-ScrollingTreeMac::ScrollingTreeMac(AsyncScrollingCoordinator* scrollingCoordinator)
+ScrollingTreeMac::ScrollingTreeMac(AsyncScrollingCoordinator& scrollingCoordinator)
     : ThreadedScrollingTree(scrollingCoordinator)
 {
 }
 
-PassRefPtr<ScrollingTreeNode> ScrollingTreeMac::createScrollingTreeNode(ScrollingNodeType nodeType, ScrollingNodeID nodeID)
+Ref<ScrollingTreeNode> ScrollingTreeMac::createScrollingTreeNode(ScrollingNodeType nodeType, ScrollingNodeID nodeID)
 {
     switch (nodeType) {
     case FrameScrollingNode:
         return ScrollingTreeFrameScrollingNodeMac::create(*this, nodeID);
     case OverflowScrollingNode:
         ASSERT_NOT_REACHED();
-        return nullptr;
+        break;
     case FixedNode:
         return ScrollingTreeFixedNode::create(*this, nodeID);
     case StickyNode:
         return ScrollingTreeStickyNode::create(*this, nodeID);
     }
-    return nullptr;
+    ASSERT_NOT_REACHED();
+    return ScrollingTreeFixedNode::create(*this, nodeID);
 }
 
 #endif // ENABLE(ASYNC_SCROLLING) && PLATFORM(MAC)
index 43a46b7..499fc3f 100644 (file)
 
 namespace WebCore {
 
-class ScrollingTreeMac : public ThreadedScrollingTree {
+class ScrollingTreeMac final : public ThreadedScrollingTree {
 public:
-    static Ref<ScrollingTreeMac> create(AsyncScrollingCoordinator*);
+    static Ref<ScrollingTreeMac> create(AsyncScrollingCoordinator&);
 
-    PassRefPtr<ScrollingTreeNode> createScrollingTreeNode(ScrollingNodeType, ScrollingNodeID) override;
-    
 private:
-    explicit ScrollingTreeMac(AsyncScrollingCoordinator*);
+    explicit ScrollingTreeMac(AsyncScrollingCoordinator&);
+
+    Ref<ScrollingTreeNode> createScrollingTreeNode(ScrollingNodeType, ScrollingNodeID) final;
 };
 
 } // namespace WebCore
index 6160709..32430c4 100644 (file)
@@ -81,7 +81,7 @@ bool EventHandler::widgetDidHandleWheelEvent(const PlatformWheelEvent& wheelEven
     return downcast<FrameView>(widget).frame().eventHandler().handleWheelEvent(wheelEvent);
 }
 
-bool EventHandler::tabsToAllFormControls(KeyboardEvent*) const
+bool EventHandler::tabsToAllFormControls(KeyboardEvent&) const
 {
     return true;
 }
@@ -92,10 +92,12 @@ bool EventHandler::eventActivatedView(const PlatformMouseEvent& event) const
 }
 
 #if ENABLE(DRAG_SUPPORT)
-PassRefPtr<DataTransfer> EventHandler::createDraggingDataTransfer() const
+
+Ref<DataTransfer> EventHandler::createDraggingDataTransfer() const
 {
     return DataTransfer::createForDragAndDrop();
 }
+
 #endif
 
 void EventHandler::focusDocumentView()
index 68d069d..04685a2 100644 (file)
@@ -54,24 +54,28 @@ namespace WebCore {
 class Image;
 
 #if PLATFORM(WIN)
+
 class SharedCursor : public RefCounted<SharedCursor> {
 public:
-    static Ref<SharedCursor> create(HCURSOR nativeCursor) { return adoptRef(*new SharedCursor(nativeCursor)); }
-    ~SharedCursor();
+    static Ref<SharedCursor> create(HCURSOR);
+    WEBCORE_EXPORT ~SharedCursor();
     HCURSOR nativeCursor() const { return m_nativeCursor; }
+
 private:
-    SharedCursor(HCURSOR nativeCursor) : m_nativeCursor(nativeCursor) { }
+    SharedCursor(HCURSOR);
     HCURSOR m_nativeCursor;
 };
-typedef RefPtr<SharedCursor> PlatformCursor;
+
+#endif
+
+#if PLATFORM(WIN)
+using PlatformCursor = RefPtr<SharedCursor>;
 #elif USE(APPKIT)
-typedef NSCursor *PlatformCursor;
+using PlatformCursor = NSCursor *;
 #elif PLATFORM(GTK)
-typedef GRefPtr<GdkCursor> PlatformCursor;
+using PlatformCursor = GRefPtr<GdkCursor>;
 #elif PLATFORM(EFL)
-typedef const char* PlatformCursor;
-#else
-typedef void* PlatformCursor;
+using PlatformCursor = const char*;
 #endif
 
 class Cursor {
@@ -124,61 +128,50 @@ public:
         Custom
     };
 
-    WEBCORE_EXPORT static const Cursor& fromType(Cursor::Type);
+    Cursor() = default;
 
-    Cursor()
 #if !PLATFORM(IOS)
-        // This is an invalid Cursor and should never actually get used.
-        : m_type(static_cast<Type>(-1))
-#if ENABLE(MOUSE_CURSOR_SCALE)
-        , m_imageScaleFactor(1)
-#endif
-        , m_platformCursor(0)
-#endif // !PLATFORM(IOS)
-    {
-    }
 
-#if !PLATFORM(IOS)
+    WEBCORE_EXPORT static const Cursor& fromType(Cursor::Type);
+
     WEBCORE_EXPORT Cursor(Image*, const IntPoint& hotSpot);
-    WEBCORE_EXPORT Cursor(const Cursor&);
 
 #if ENABLE(MOUSE_CURSOR_SCALE)
     // Hot spot is in image pixels.
     WEBCORE_EXPORT Cursor(Image*, const IntPoint& hotSpot, float imageScaleFactor);
 #endif
 
-    WEBCORE_EXPORT ~Cursor();
-    WEBCORE_EXPORT Cursor& operator=(const Cursor&);
-
     explicit Cursor(Type);
-    Type type() const
-    {
-        ASSERT(m_type >= 0 && m_type <= Custom);
-        return m_type;
-    }
+
+    Type type() const;
     Image* image() const { return m_image.get(); }
     const IntPoint& hotSpot() const { return m_hotSpot; }
+
 #if ENABLE(MOUSE_CURSOR_SCALE)
     // Image scale in image pixels per logical (UI) pixel.
     float imageScaleFactor() const { return m_imageScaleFactor; }
 #endif
+
     WEBCORE_EXPORT PlatformCursor platformCursor() const;
 
- private:
+private:
     void ensurePlatformCursor() const;
 
-    Type m_type;
+    // The type of -1 indicates an invalid Cursor that should never actually get used.
+    Type m_type { static_cast<Type>(-1) };
     RefPtr<Image> m_image;
     IntPoint m_hotSpot;
+
 #if ENABLE(MOUSE_CURSOR_SCALE)
-    float m_imageScaleFactor;
+    float m_imageScaleFactor { 1 };
 #endif
 
 #if !USE(APPKIT)
-    mutable PlatformCursor m_platformCursor;
+    mutable PlatformCursor m_platformCursor { nullptr };
 #else
     mutable RetainPtr<NSCursor> m_platformCursor;
 #endif
+
 #endif // !PLATFORM(IOS)
 };
 
@@ -228,4 +221,15 @@ const Cursor& noneCursor();
 const Cursor& grabCursor();
 const Cursor& grabbingCursor();
 
+#if !PLATFORM(IOS)
+
+inline Cursor::Type Cursor::type() const
+{
+    ASSERT(m_type >= 0);
+    ASSERT(m_type <= Custom);
+    return m_type;
+}
+
+#endif
+
 } // namespace WebCore
index b3f44ae..59648bb 100644 (file)
 
 namespace WebCore {
 
-Cursor::Cursor(const Cursor& other)
-    : m_type(other.m_type)
-    , m_image(other.m_image)
-    , m_hotSpot(other.m_hotSpot)
-#if ENABLE(MOUSE_CURSOR_SCALE)
-    , m_imageScaleFactor(other.m_imageScaleFactor)
-#endif
-    , m_platformCursor(other.m_platformCursor)
-{
-}
-
-Cursor::~Cursor()
-{
-}
-
-Cursor& Cursor::operator=(const Cursor& other)
-{
-    m_type = other.m_type;
-    m_image = other.m_image;
-    m_hotSpot = other.m_hotSpot;
-#if ENABLE(MOUSE_CURSOR_SCALE)
-    m_imageScaleFactor = other.m_imageScaleFactor;
-#endif
-    m_platformCursor = other.m_platformCursor;
-
-    return *this;
-}
-
 static const char* cursorString(Cursor::Type type)
 {
     static const char* cursorStrings[] = {
index f075f36..4634efd 100644 (file)
@@ -175,25 +175,4 @@ void Cursor::ensurePlatformCursor() const
     }
 }
 
-Cursor::Cursor(const Cursor& other)
-    : m_type(other.m_type)
-    , m_image(other.m_image)
-    , m_hotSpot(other.m_hotSpot)
-    , m_platformCursor(other.m_platformCursor)
-{
-}
-
-Cursor& Cursor::operator=(const Cursor& other)
-{
-    m_type = other.m_type;
-    m_image = other.m_image;
-    m_hotSpot = other.m_hotSpot;
-    m_platformCursor = other.m_platformCursor;
-    return *this;
-}
-
-Cursor::~Cursor()
-{
-}
-
 }
index 85cc7c5..aa345e8 100644 (file)
@@ -241,33 +241,6 @@ void Cursor::ensurePlatformCursor() const
     }
 }
 
-Cursor::Cursor(const Cursor& other)
-    : m_type(other.m_type)
-    , m_image(other.m_image)
-    , m_hotSpot(other.m_hotSpot)
-#if ENABLE(MOUSE_CURSOR_SCALE)
-    , m_imageScaleFactor(other.m_imageScaleFactor)
-#endif
-    , m_platformCursor(other.m_platformCursor)
-{
-}
-
-Cursor& Cursor::operator=(const Cursor& other)
-{
-    m_type = other.m_type;
-    m_image = other.m_image;
-    m_hotSpot = other.m_hotSpot;
-#if ENABLE(MOUSE_CURSOR_SCALE)
-    m_imageScaleFactor = other.m_imageScaleFactor;
-#endif
-    m_platformCursor = other.m_platformCursor;
-    return *this;
-}
-
-Cursor::~Cursor()
-{
-}
-
 NSCursor *Cursor::platformCursor() const
 {
     ensurePlatformCursor();
index 7a99313..d9b2255 100644 (file)
 
 namespace WebCore {
 
+SharedCursor::SharedCursor(HCURSOR nativeCursor)
+    : m_nativeCursor(nativeCursor)
+{
+}
+
+Ref<SharedCursor> SharedCursor::create(HCURSOR nativeCursor)
+{
+    return adoptRef(*new SharedCursor(nativeCursor));
+}
+
+SharedCursor::~SharedCursor()
+{
+    DestroyIcon(m_nativeCursor);
+}
+
 static Ref<SharedCursor> createSharedCursor(Image* img, const IntPoint& hotSpot)
 {
     IntPoint effectiveHotSpot = determineHotSpot(img, hotSpot);
@@ -253,36 +268,4 @@ void Cursor::ensurePlatformCursor() const
     }
 }
 
-SharedCursor::~SharedCursor()
-{
-    DestroyIcon(m_nativeCursor);
-}
-
-Cursor::Cursor(const Cursor& other)
-    : m_type(other.m_type)
-    , m_image(other.m_image)
-    , m_hotSpot(other.m_hotSpot)
-#if ENABLE(MOUSE_CURSOR_SCALE)
-    , m_imageScaleFactor(other.m_imageScaleFactor)
-#endif
-    , m_platformCursor(other.m_platformCursor)
-{
-}
-
-Cursor& Cursor::operator=(const Cursor& other)
-{
-    m_type = other.m_type;
-    m_image = other.m_image;
-    m_hotSpot = other.m_hotSpot;
-#if ENABLE(MOUSE_CURSOR_SCALE)
-    m_imageScaleFactor = other.m_imageScaleFactor;
-#endif
-    m_platformCursor = other.m_platformCursor;
-    return *this;
-}
-
-Cursor::~Cursor()
-{
-}
-
 } // namespace WebCore
index 06aee9f..482b5dd 100644 (file)
@@ -616,7 +616,7 @@ void RenderEmbeddedObject::handleUnavailablePluginIndicatorEvent(Event* event)
             setUnavailablePluginIndicatorIsPressed(false);
         }
         if (m_mouseDownWasInUnavailablePluginIndicator && isInUnavailablePluginIndicator(mouseEvent)) {
-            page().chrome().client().unavailablePluginButtonClicked(&element, m_pluginUnavailabilityReason);
+            page().chrome().client().unavailablePluginButtonClicked(element, m_pluginUnavailabilityReason);
         }
         m_mouseDownWasInUnavailablePluginIndicator = false;
         event->setDefaultHandled();
index a1a94c6..61caabf 100644 (file)
@@ -107,7 +107,7 @@ RenderLayerBacking::RenderLayerBacking(RenderLayer& layer)
 {
     if (layer.isRootLayer()) {
         m_isMainFrameRenderViewLayer = renderer().frame().isMainFrame();
-        m_usingTiledCacheLayer = renderer().page().chrome().client().shouldUseTiledBackingForFrameView(renderer().frame().view());
+        m_usingTiledCacheLayer = renderer().page().chrome().client().shouldUseTiledBackingForFrameView(renderer().view().frameView());
     }
     
     createPrimaryGraphicsLayer();
index 12b62c9..65fdc4d 100644 (file)
@@ -3103,7 +3103,7 @@ GraphicsLayer* RenderLayerCompositor::updateLayerForHeader(bool wantsLayer)
     if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
         scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.frameView());
 
-    page().chrome().client().didAddHeaderLayer(m_layerForHeader.get());
+    page().chrome().client().didAddHeaderLayer(*m_layerForHeader);
 
     return m_layerForHeader.get();
 }
@@ -3141,7 +3141,7 @@ GraphicsLayer* RenderLayerCompositor::updateLayerForFooter(bool wantsLayer)
     if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
         scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.frameView());
 
-    page().chrome().client().didAddFooterLayer(m_layerForFooter.get());
+    page().chrome().client().didAddFooterLayer(*m_layerForFooter);
 
     return m_layerForFooter.get();
 }
@@ -3463,11 +3463,11 @@ void RenderLayerCompositor::attachRootLayer(RootLayerAttachment attachment)
             break;
         case RootLayerAttachedViaChromeClient: {
             Frame& frame = m_renderView.frameView().frame();
-            page().chrome().client().attachRootGraphicsLayer(&frame, rootGraphicsLayer());
+            page().chrome().client().attachRootGraphicsLayer(frame, rootGraphicsLayer());
             if (frame.isMainFrame()) {
                 PageOverlayController& pageOverlayController = frame.mainFrame().pageOverlayController();
                 pageOverlayController.willAttachRootLayer();
-                page().chrome().client().attachViewOverlayGraphicsLayer(&frame, &pageOverlayController.viewOverlayRootLayer());
+                page().chrome().client().attachViewOverlayGraphicsLayer(frame, &pageOverlayController.viewOverlayRootLayer());
             }
             break;
         }
@@ -3508,9 +3508,9 @@ void RenderLayerCompositor::detachRootLayer()
     }
     case RootLayerAttachedViaChromeClient: {
         Frame& frame = m_renderView.frameView().frame();
-        page().chrome().client().attachRootGraphicsLayer(&frame, 0);
+        page().chrome().client().attachRootGraphicsLayer(frame, nullptr);
         if (frame.isMainFrame())
-            page().chrome().client().attachViewOverlayGraphicsLayer(&frame, 0);
+            page().chrome().client().attachViewOverlayGraphicsLayer(frame, nullptr);
     }
     break;
     case RootLayerUnattached:
index d2c02ef..37c83e8 100644 (file)
@@ -371,7 +371,7 @@ void RenderMenuList::showPopup()
     // inside the showPopup call and it would fail.
     createInnerBlock();
     if (!m_popup)
-        m_popup = document().page()->chrome().createPopupMenu(this);
+        m_popup = document().page()->chrome().createPopupMenu(*this);
     m_popupIsVisible = true;
 
     // Compute the top left taking transforms into account, but use
index b46d8ed..ca90051 100644 (file)
@@ -97,7 +97,7 @@ void RenderSearchField::addSearchResult()
 
     const AtomicString& name = autosaveName();
     if (!m_searchPopup)
-        m_searchPopup = page().chrome().createSearchPopupMenu(this);
+        m_searchPopup = page().chrome().createSearchPopupMenu(*this);
 
     m_searchPopup->saveRecentSearches(name, m_recentSearches);
 }
@@ -108,7 +108,7 @@ void RenderSearchField::showPopup()
         return;
 
     if (!m_searchPopup)
-        m_searchPopup = page().chrome().createSearchPopupMenu(this);
+        m_searchPopup = page().chrome().createSearchPopupMenu(*this);
 
     if (!m_searchPopup->enabled())
         return;
@@ -201,7 +201,7 @@ void RenderSearchField::valueChanged(unsigned listIndex, bool fireEvents)
             const AtomicString& name = autosaveName();
             if (!name.isEmpty()) {
                 if (!m_searchPopup)
-                    m_searchPopup = page().chrome().createSearchPopupMenu(this);
+                    m_searchPopup = page().chrome().createSearchPopupMenu(*this);
                 m_searchPopup->saveRecentSearches(name, m_recentSearches);
             }
         }
index beb0a39..42023fa 100644 (file)
@@ -197,7 +197,7 @@ bool SVGAElement::isKeyboardFocusable(KeyboardEvent& event) const
         return SVGElement::isKeyboardFocusable(event);
 
     if (isLink())
-        return document().frame()->eventHandler().tabsToLinks(&event);
+        return document().frame()->eventHandler().tabsToLinks(event);
 
     return SVGElement::isKeyboardFocusable(event);
 }
index fd564af..0044041 100644 (file)
@@ -51,7 +51,7 @@ MockPageOverlayClient::MockPageOverlayClient()
 Ref<MockPageOverlay> MockPageOverlayClient::installOverlay(MainFrame& mainFrame, PageOverlay::OverlayType overlayType)
 {
     auto overlay = PageOverlay::create(*this, overlayType);
-    mainFrame.pageOverlayController().installPageOverlay(overlay.ptr(), PageOverlay::FadeMode::DoNotFade);
+    mainFrame.pageOverlayController().installPageOverlay(overlay, PageOverlay::FadeMode::DoNotFade);
 
     auto mockOverlay = MockPageOverlay::create(overlay.ptr());
     m_overlays.add(mockOverlay.ptr());
@@ -65,7 +65,7 @@ void MockPageOverlayClient::uninstallAllOverlays()
         RefPtr<MockPageOverlay> mockOverlay = m_overlays.takeAny();
         PageOverlayController* overlayController = mockOverlay->overlay()->controller();
         ASSERT(overlayController);
-        overlayController->uninstallPageOverlay(mockOverlay->overlay(), PageOverlay::FadeMode::DoNotFade);
+        overlayController->uninstallPageOverlay(*mockOverlay->overlay(), PageOverlay::FadeMode::DoNotFade);
     }
 }