Address post-review feedback after r238438
[WebKit-https.git] / Source / WebKitLegacy / mac / WebView / WebFrame.mm
index 7cae06e..c144029 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006, 2007, 2008, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2005-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
 #import "WebScriptWorldInternal.h"
 #import "WebViewInternal.h"
 #import <JavaScriptCore/APICast.h>
+#import <JavaScriptCore/JSCJSValue.h>
 #import <JavaScriptCore/JSContextInternal.h>
+#import <JavaScriptCore/JSLock.h>
+#import <JavaScriptCore/JSObject.h>
 #import <WebCore/AXObjectCache.h>
 #import <WebCore/AccessibilityObject.h>
 #import <WebCore/CSSAnimationController.h>
@@ -69,6 +72,7 @@
 #import <WebCore/Editor.h>
 #import <WebCore/EventHandler.h>
 #import <WebCore/EventNames.h>
+#import <WebCore/Frame.h>
 #import <WebCore/FrameLoadRequest.h>
 #import <WebCore/FrameLoader.h>
 #import <WebCore/FrameLoaderStateMachine.h>
 #import <WebCore/JSNode.h>
 #import <WebCore/LegacyWebArchive.h>
 #import <WebCore/MIMETypeRegistry.h>
-#import <WebCore/MainFrame.h>
 #import <WebCore/Page.h>
 #import <WebCore/PlatformEventFactoryMac.h>
 #import <WebCore/PluginData.h>
 #import <WebCore/PrintContext.h>
+#import <WebCore/RenderLayer.h>
 #import <WebCore/RenderView.h>
 #import <WebCore/RenderWidget.h>
 #import <WebCore/RenderedDocumentMarker.h>
 #import <WebCore/ThreadCheck.h>
 #import <WebCore/VisibleUnits.h>
 #import <WebCore/markup.h>
-#import <WebKitSystemInterface.h>
-#import <bindings/ScriptValue.h>
-#import <runtime/JSCJSValue.h>
-#import <runtime/JSLock.h>
-#import <runtime/JSObject.h>
-#import <wtf/CurrentTime.h>
-
-#if PLATFORM(IOS)
+
+#if PLATFORM(IOS_FAMILY)
 #import "WebMailDelegate.h"
 #import "WebResource.h"
 #import "WebUIKitDelegate.h"
@@ -233,7 +231,7 @@ TextDirectionSubmenuInclusionBehavior core(WebTextDirectionSubmenuInclusionBehav
     return TextDirectionSubmenuNeverIncluded;
 }
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS_FAMILY)
 
 Vector<Vector<String>> vectorForDictationPhrasesArray(NSArray *dictationPhrases)
 {
@@ -345,7 +343,7 @@ WebView *getWebView(WebFrame *webFrame)
     return _private && _private->includedInWebKitStatistics;
 }
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS_FAMILY)
 static NSURL *createUniqueWebDataURL();
 
 + (void)_createMainFrameWithSimpleHTMLDocumentWithPage:(Page*)page frameView:(WebFrameView *)frameView style:(NSString *)style
@@ -363,15 +361,15 @@ static NSURL *createUniqueWebDataURL();
 
 - (void)_attachScriptDebugger
 {
-    ScriptController& scriptController = _private->coreFrame->script();
+    auto& windowProxy = _private->coreFrame->windowProxy();
 
     // Calling ScriptController::globalObject() would create a window proxy, and dispatch corresponding callbacks, which may be premature
     // if the script debugger is attached before a document is created.  These calls use the debuggerWorld(), we will need to pass a world
     // to be able to debug isolated worlds.
-    if (!scriptController.existingWindowProxy(debuggerWorld()))
+    if (!windowProxy.existingJSWindowProxy(debuggerWorld()))
         return;
 
-    JSGlobalObject* globalObject = scriptController.globalObject(debuggerWorld());
+    auto* globalObject = windowProxy.globalObject(debuggerWorld());
     if (!globalObject)
         return;
 
@@ -426,7 +424,7 @@ static NSURL *createUniqueWebDataURL();
 {
     WebView *webView = getWebView(self);
     BOOL drawsBackground = [webView drawsBackground];
-#if !PLATFORM(IOS)
+#if !PLATFORM(IOS_FAMILY)
     NSColor *backgroundColor = [webView backgroundColor];
 #else
     CGColorRef backgroundColor = [webView backgroundColor];
@@ -439,14 +437,16 @@ static NSURL *createUniqueWebDataURL();
         WebFrame *webFrame = kit(frame);
         if (!drawsBackground)
             [[[webFrame frameView] _scrollView] setDrawsBackground:NO];
-#if !PLATFORM(IOS)
+#if !PLATFORM(IOS_FAMILY)
         [[[webFrame frameView] _scrollView] setBackgroundColor:backgroundColor];
 #endif
 
         if (FrameView* view = frame->view()) {
             view->setTransparent(!drawsBackground);
-#if !PLATFORM(IOS)
+#if !PLATFORM(IOS_FAMILY)
+            ALLOW_DEPRECATED_DECLARATIONS_BEGIN
             Color color = colorFromNSColor([backgroundColor colorUsingColorSpaceName:NSDeviceRGBColorSpace]);
+            ALLOW_DEPRECATED_DECLARATIONS_END
 #else
             Color color = Color(backgroundColor);
 #endif
@@ -477,7 +477,7 @@ static NSURL *createUniqueWebDataURL();
 
 - (void)_unmarkAllMisspellings
 {
-#if !PLATFORM(IOS)
+#if !PLATFORM(IOS_FAMILY)
     Frame* coreFrame = _private->coreFrame;
     for (Frame* frame = coreFrame; frame; frame = frame->tree().traverseNext(coreFrame)) {
         if (Document* document = frame->document())
@@ -558,7 +558,8 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     return dataSource(_private->coreFrame->loader().documentLoader());
 }
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS_FAMILY)
+
 - (BOOL)_isCommitting
 {
     return _private->isCommitting;
@@ -568,6 +569,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
 {
     _private->isCommitting = value;
 }
+
 #endif
 
 - (NSArray *)_nodesFromList:(Vector<Node*> *)nodesVector
@@ -589,43 +591,46 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     return plainText(core(range), TextIteratorDefaultBehavior, true);
 }
 
-- (PaintBehavior)_paintBehaviorForDestinationContext:(CGContextRef)context
+- (OptionSet<PaintBehavior>)_paintBehaviorForDestinationContext:(CGContextRef)context
 {
-#if !PLATFORM(IOS)
+#if PLATFORM(MAC)
     // -currentContextDrawingToScreen returns YES for bitmap contexts.
     BOOL isPrinting = ![NSGraphicsContext currentContextDrawingToScreen];
     if (isPrinting)
-        return PaintBehaviorFlattenCompositingLayers;
+        return OptionSet<PaintBehavior>(PaintBehavior::FlattenCompositingLayers) | PaintBehavior::Snapshotting;
 #endif
 
-    if (!WKCGContextIsBitmapContext(context))
-        return PaintBehaviorAllowAsyncImageDecoding;
+    if (CGContextGetType(context) != kCGContextTypeBitmap)
+        return PaintBehavior::Normal;
 
-    // If we're drawing into a bitmap, we might be snapshotting, or drawing into a layer-backed view.
-    if (WebHTMLView *htmlDocumentView = [self _webHTMLDocumentView]) {
-#if PLATFORM(IOS)
-        if ([[htmlDocumentView window] isInSnapshottingPaint])
-            return 0;
+    // If we're drawing into a bitmap, we could be snapshotting or drawing into a layer-backed view.
+    if (WebHTMLView *documentView = [self _webHTMLDocumentView]) {
+#if PLATFORM(IOS_FAMILY)
+        return [[documentView window] isInSnapshottingPaint] ? PaintBehavior::Snapshotting : PaintBehavior::Normal;
+#endif
+#if PLATFORM(MAC)
+        if ([documentView _web_isDrawingIntoLayer])
+            return PaintBehavior::Normal;
 #endif
-        if ([htmlDocumentView _web_isDrawingIntoLayer])
-            return PaintBehaviorAllowAsyncImageDecoding;
     }
     
-    return PaintBehaviorFlattenCompositingLayers;
+    return OptionSet<PaintBehavior>(PaintBehavior::FlattenCompositingLayers) | PaintBehavior::Snapshotting;
 }
 
 - (void)_drawRect:(NSRect)rect contentsOnly:(BOOL)contentsOnly
 {
-#if !PLATFORM(IOS)
+#if !PLATFORM(IOS_FAMILY)
     ASSERT([[NSGraphicsContext currentContext] isFlipped]);
 
+    ALLOW_DEPRECATED_DECLARATIONS_BEGIN
     CGContextRef ctx = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]);
+    ALLOW_DEPRECATED_DECLARATIONS_END
 #else
     CGContextRef ctx = WKGetCurrentGraphicsContext();
 #endif
     GraphicsContext context(ctx);
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS_FAMILY)
     WebCore::Frame *frame = core(self);
     if (WebCore::Page* page = frame->page())
         context.setIsAcceleratedContext(page->settings().acceleratedDrawingEnabled());
@@ -636,20 +641,23 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
 
     FrameView* view = _private->coreFrame->view();
     
-    PaintBehavior oldBehavior = view->paintBehavior();
-    PaintBehavior paintBehavior = oldBehavior;
+    OptionSet<PaintBehavior> oldBehavior = view->paintBehavior();
+    OptionSet<PaintBehavior> paintBehavior = oldBehavior;
     
     if (Frame* parentFrame = _private->coreFrame->tree().parent()) {
         // For subframes, we need to inherit the paint behavior from our parent
         if (FrameView* parentView = parentFrame ? parentFrame->view() : nullptr) {
-            if (parentView->paintBehavior() & PaintBehaviorFlattenCompositingLayers)
-                paintBehavior |= PaintBehaviorFlattenCompositingLayers;
-                
-            if (parentView->paintBehavior() & PaintBehaviorAllowAsyncImageDecoding)
-                paintBehavior |= PaintBehaviorAllowAsyncImageDecoding;
+            if (parentView->paintBehavior().contains(PaintBehavior::FlattenCompositingLayers))
+                paintBehavior.add(PaintBehavior::FlattenCompositingLayers);
+            
+            if (parentView->paintBehavior().contains(PaintBehavior::Snapshotting))
+                paintBehavior.add(PaintBehavior::Snapshotting);
+            
+            if (parentView->paintBehavior().contains(PaintBehavior::TileFirstPaint))
+                paintBehavior.add(PaintBehavior::TileFirstPaint);
         }
     } else
-        paintBehavior |= [self _paintBehaviorForDestinationContext:ctx];
+        paintBehavior.add([self _paintBehaviorForDestinationContext:ctx]);
         
     view->setPaintBehavior(paintBehavior);
 
@@ -689,7 +697,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     ASSERT(_private->coreFrame->document());
     RetainPtr<WebFrame> protect(self); // Executing arbitrary JavaScript can destroy the frame.
     
-#if PLATFORM(IOS)
+#if PLATFORM(IOS_FAMILY)
     ASSERT(WebThreadIsLockedOrDisabled());
     JSC::ExecState* exec = _private->coreFrame->script().globalObject(mainThreadNormalWorld())->globalExec();
     JSC::JSLockHolder jscLock(exec);
@@ -706,7 +714,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     if (!result || (!result.isBoolean() && !result.isString() && !result.isNumber()))
         return @"";
 
-#if !PLATFORM(IOS)
+#if !PLATFORM(IOS_FAMILY)
     JSC::ExecState* exec = _private->coreFrame->script().globalObject(mainThreadNormalWorld())->globalExec();
     JSC::JSLockHolder lock(exec);
 #endif
@@ -731,13 +739,13 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     Node *startNode = core([range startContainer]);
         
     if (startNode && startNode->renderer()) {
-#if !PLATFORM(IOS)
-        startNode->renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, enclosingIntRect(rangeRect), insideFixed, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);
+#if !PLATFORM(IOS_FAMILY)
+        startNode->renderer()->scrollRectToVisible(enclosingIntRect(rangeRect), insideFixed, { SelectionRevealMode::Reveal, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded, ShouldAllowCrossOriginScrolling::Yes });
 #else
         RenderLayer* layer = startNode->renderer()->enclosingLayer();
         if (layer) {
             layer->setAdjustForIOSCaretWhenScrolling(true);
-            startNode->renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, enclosingIntRect(rangeRect), insideFixed, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);
+            startNode->renderer()->scrollRectToVisible(enclosingIntRect(rangeRect), insideFixed, { SelectionRevealMode::Reveal, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded, ShouldAllowCrossOriginScrolling::Yes });
             layer->setAdjustForIOSCaretWhenScrolling(false);
             _private->coreFrame->selection().setCaretRectNeedsUpdate();
             _private->coreFrame->selection().updateAppearance();
@@ -746,7 +754,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     }
 }
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS_FAMILY)
 - (void)_scrollDOMRangeToVisible:(DOMRange *)range withInset:(CGFloat)inset
 {
     bool insideFixed = false; // FIXME: get via firstRectForRange().
@@ -757,7 +765,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
         RenderLayer* layer = startNode->renderer()->enclosingLayer();
         if (layer) {
             layer->setAdjustForIOSCaretWhenScrolling(true);
-            startNode->renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, enclosingIntRect(rangeRect), insideFixed, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);
+            startNode->renderer()->scrollRectToVisible(enclosingIntRect(rangeRect), insideFixed, { SelectionRevealMode::Reveal, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded, ShouldAllowCrossOriginScrolling::Yes});
             layer->setAdjustForIOSCaretWhenScrolling(false);
 
             Frame *coreFrame = core(self);
@@ -776,7 +784,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     return _private->coreFrame->view() ? _private->coreFrame->view()->needsLayout() : false;
 }
 
-#if !PLATFORM(IOS)
+#if !PLATFORM(IOS_FAMILY)
 - (DOMRange *)_rangeByAlteringCurrentSelection:(FrameSelection::EAlteration)alteration direction:(SelectionDirection)direction granularity:(TextGranularity)granularity
 {
     if (_private->coreFrame->selection().isNone())
@@ -958,7 +966,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
         return;
     // FIXME: These are fake modifier keys here, but they should be real ones instead.
     PlatformMouseEvent event(IntPoint(windowLoc), IntPoint(globalPoint(windowLoc, [view->platformWidget() window])),
-                             LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, currentTime(), WebCore::ForceAtClick, WebCore::NoTap);
+                             LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, WallTime::now(), WebCore::ForceAtClick, WebCore::NoTap);
     _private->coreFrame->eventHandler().dragSourceEndedAt(event, (DragOperation)operation);
 }
 #endif // ENABLE(DRAG_SUPPORT) && PLATFORM(MAC)
@@ -1010,7 +1018,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     _private->shouldCreateRenderers = shouldCreateRenderers;
 }
 
-#if !PLATFORM(IOS)
+#if !PLATFORM(IOS_FAMILY)
 - (NSColor *)_bodyBackgroundColor
 #else
 - (CGColorRef)_bodyBackgroundColor
@@ -1025,10 +1033,10 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     RenderObject* bodyRenderer = body->renderer();
     if (!bodyRenderer)
         return nil;
-    Color color = bodyRenderer->style().visitedDependentColor(CSSPropertyBackgroundColor);
+    Color color = bodyRenderer->style().visitedDependentColorWithColorFilter(CSSPropertyBackgroundColor);
     if (!color.isValid())
         return nil;
-#if !PLATFORM(IOS)
+#if !PLATFORM(IOS_FAMILY)
     return nsColor(color);
 #else
     return cachedCGColor(color);
@@ -1085,7 +1093,7 @@ static WebFrameLoadType toWebFrameLoadType(FrameLoadType frameLoadType)
     return toWebFrameLoadType(_private->coreFrame->loader().loadType());
 }
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS_FAMILY)
 - (BOOL)needsLayout
 {
     // Needed for Mail <rdar://problem/6228038>
@@ -1138,7 +1146,7 @@ static WebFrameLoadType toWebFrameLoadType(FrameLoadType frameLoadType)
     return range;
 }
 
-#endif // PLATFORM(IOS)
+#endif // PLATFORM(IOS_FAMILY)
 
 - (NSRange)_selectedNSRange
 {
@@ -1185,7 +1193,7 @@ static WebFrameLoadType toWebFrameLoadType(FrameLoadType frameLoadType)
 }
 #endif
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS_FAMILY)
 
 - (unsigned)formElementsCharacterCount
 {
@@ -1238,7 +1246,7 @@ static WebFrameLoadType toWebFrameLoadType(FrameLoadType frameLoadType)
     RefPtr<Range> domRange = [self _convertToDOMRange:range];
     if (domRange) {
         const VisibleSelection& newSelection = VisibleSelection(*domRange, SEL_DEFAULT_AFFINITY);
-        _private->coreFrame->selection().setSelection(newSelection, 0);
+        _private->coreFrame->selection().setSelection(newSelection, { });
         
         _private->coreFrame->editor().ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping();
     }
@@ -1436,7 +1444,7 @@ static WebFrameLoadType toWebFrameLoadType(FrameLoadType frameLoadType)
     WebCore::Frame *frame = core(self);
     if (!frame || !frame->view())
         return 0;
-    return frame->view()->layoutCount();
+    return frame->view()->layoutContext().layoutCount();
 }
 
 - (BOOL)isTelephoneNumberParsingAllowed
@@ -1474,7 +1482,7 @@ static WebFrameLoadType toWebFrameLoadType(FrameLoadType frameLoadType)
         }
     }
 
-    frame->selection().setSelectedRange(core(range), (EAffinity)affinity, closeTyping);
+    frame->selection().setSelectedRange(core(range), (EAffinity)affinity, closeTyping ? FrameSelection::ShouldCloseTyping::Yes : FrameSelection::ShouldCloseTyping::No);
     if (!closeTyping)
         frame->editor().ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping();
 }
@@ -1895,7 +1903,7 @@ static WebFrameLoadType toWebFrameLoadType(FrameLoadType frameLoadType)
     [self _replaceSelectionWithFragment:fragment selectReplacement:selectReplacement smartReplace:smartReplace matchStyle:NO];
 }
 
-#endif // PLATFORM(IOS)
+#endif // PLATFORM(IOS_FAMILY)
 
 #if ENABLE(TEXT_AUTOSIZING)
 - (void)resetTextAutosizingBeforeLayout
@@ -1944,10 +1952,10 @@ static WebFrameLoadType toWebFrameLoadType(FrameLoadType frameLoadType)
 {
     if (_private->coreFrame->selection().isNone() || !fragment)
         return;
-    _private->coreFrame->editor().replaceSelectionWithFragment(*core(fragment), selectReplacement, smartReplace, matchStyle);
+    _private->coreFrame->editor().replaceSelectionWithFragment(*core(fragment), selectReplacement ? Editor::SelectReplacement::Yes : Editor::SelectReplacement::No, smartReplace ? Editor::SmartReplace::Yes : Editor::SmartReplace::No, matchStyle ? Editor::MatchStyle::Yes : Editor::MatchStyle::No);
 }
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS_FAMILY)
 - (void)removeUnchangeableStyles
 {
     _private->coreFrame->editor().removeUnchangeableStyles();
@@ -1973,7 +1981,7 @@ static WebFrameLoadType toWebFrameLoadType(FrameLoadType frameLoadType)
     [self _replaceSelectionWithFragment:fragment selectReplacement:selectReplacement smartReplace:smartReplace matchStyle:NO];
 }
 
-#if !PLATFORM(IOS)
+#if !PLATFORM(IOS_FAMILY)
 // Determines whether whitespace needs to be added around aString to preserve proper spacing and
 // punctuation when it's inserted into the receiver's text over charRange. Returns by reference
 // in beforeString and afterString any whitespace that should be added, unless either or both are
@@ -2031,7 +2039,7 @@ static WebFrameLoadType toWebFrameLoadType(FrameLoadType frameLoadType)
     if (afterString && addTrailingSpace && !hasWhitespaceAtEnd)
         *afterString = @" ";
 }
-#endif // !PLATFORM(IOS)
+#endif // !PLATFORM(IOS_FAMILY)
 
 - (NSMutableDictionary *)_cacheabilityDictionary
 {
@@ -2083,8 +2091,11 @@ static WebFrameLoadType toWebFrameLoadType(FrameLoadType frameLoadType)
     // The global object is probably a proxy object? - if so, we know how to use this!
     JSC::JSObject* globalObjectObj = toJS(globalObjectRef);
     JSC::VM& vm = *globalObjectObj->vm();
-    if (!strcmp(globalObjectObj->classInfo(vm)->className, "JSDOMWindowProxy"))
-        anyWorldGlobalObject = static_cast<JSDOMWindowProxy*>(globalObjectObj)->window();
+    if (!strcmp(globalObjectObj->classInfo(vm)->className, "JSWindowProxy"))
+        anyWorldGlobalObject = JSC::jsDynamicCast<JSDOMWindow*>(vm, static_cast<JSWindowProxy*>(globalObjectObj)->window());
+
+    if (!anyWorldGlobalObject)
+        return @"";
 
     // Get the frame frome the global object we've settled on.
     Frame* frame = anyWorldGlobalObject->wrapped().frame();
@@ -2128,7 +2139,7 @@ static WebFrameLoadType toWebFrameLoadType(FrameLoadType frameLoadType)
 }
 #endif
 
-#if !PLATFORM(IOS)
+#if !PLATFORM(IOS_FAMILY)
 - (void)setAllowsScrollersToOverlapContent:(BOOL)flag
 {
     ASSERT([[[self frameView] _scrollView] isKindOfClass:[WebDynamicScrollBarsView class]]);
@@ -2194,11 +2205,10 @@ static WebFrameLoadType toWebFrameLoadType(FrameLoadType frameLoadType)
 #if HAVE(ACCESSIBILITY)
     if (!AXObjectCache::accessibilityEnabled()) {
         AXObjectCache::enableAccessibility();
-#if !PLATFORM(IOS)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+#if !PLATFORM(IOS_FAMILY)
+        ALLOW_DEPRECATED_DECLARATIONS_BEGIN
         AXObjectCache::setEnhancedUserInterfaceAccessibility([[NSApp accessibilityAttributeValue:NSAccessibilityEnhancedUserInterfaceAttribute] boolValue]);
-#pragma clang diagnostic pop
+        ALLOW_DEPRECATED_DECLARATIONS_END
 #endif
     }
     
@@ -2274,7 +2284,7 @@ static WebFrameLoadType toWebFrameLoadType(FrameLoadType frameLoadType)
     return pages;
 }
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS_FAMILY)
 
 - (DOMDocumentFragment *)_documentFragmentForText:(NSString *)text
 {
@@ -2289,7 +2299,7 @@ static WebFrameLoadType toWebFrameLoadType(FrameLoadType frameLoadType)
 - (DOMDocumentFragment *)_documentFragmentForImageData:(NSData *)data withRelativeURLPart:(NSString *)relativeURLPart andMIMEType:(NSString *)mimeType
 {
     WebResource *resource = [[WebResource alloc] initWithData:data
-                                                          URL:[NSURL uniqueURLWithRelativePart:relativeURLPart]
+                                                          URL:URL::fakeURLWithRelativePart(relativeURLPart)
                                                      MIMEType:mimeType
                                              textEncodingName:nil
                                                     frameName:nil];
@@ -2325,10 +2335,10 @@ static WebFrameLoadType toWebFrameLoadType(FrameLoadType frameLoadType)
     Frame* coreFrame = _private->coreFrame;
     if (!coreFrame)
         return;
-    coreFrame->loader().client().dispatchDidReceiveTitle({ title, LTR });
+    coreFrame->loader().client().dispatchDidReceiveTitle({ title, TextDirection::LTR });
 }
 
-#endif // PLATFORM(IOS)
+#endif // PLATFORM(IOS_FAMILY)
 
 - (JSValueRef)jsWrapperForNode:(DOMNode *)node inScriptWorld:(WebScriptWorld *)world
 {
@@ -2404,7 +2414,7 @@ static WebFrameLoadType toWebFrameLoadType(FrameLoadType frameLoadType)
 
 static bool needsMicrosoftMessengerDOMDocumentWorkaround()
 {
-#if PLATFORM(IOS)
+#if PLATFORM(IOS_FAMILY)
     return false;
 #else
     static bool needsWorkaround = MacApplication::isMicrosoftMessenger() && [[[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey] compare:@"7.1" options:NSNumericSearch] == NSOrderedAscending;
@@ -2577,7 +2587,7 @@ static NSURL *createUniqueWebDataURL()
     Frame* coreFrame = _private->coreFrame;
     if (!coreFrame)
         return nil;
-    return kit(coreFrame->tree().find(name));
+    return kit(coreFrame->tree().find(name, *coreFrame));
 }
 
 - (WebFrame *)parentFrame