Remove PLATFORM(IOS) from WebCore/editing (Part 3).
authorenrica@apple.com <enrica@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Sep 2014 21:07:41 +0000 (21:07 +0000)
committerenrica@apple.com <enrica@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Sep 2014 21:07:41 +0000 (21:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=136474

Reviewed by Benjamin Poulain.

This is the updated version of the patch that was landed in r173340.
I changed the use of IntPoint to FloatPoint since it was causing tests
to fail.
This patch removes the use of PLATFORM(IOS) from TextAffinity.h
and removes the assumption that EAffinity values match NSSelectionAffinity
values. It also removes the includes in TextAffinity.h, creating the need to
include explicitly the files when necessary. It also removes the unnecessary
use of platform specific types, replacing them with WebCore types.

Source/WebCore:

* WebCore.exp.in:
* editing/TextAffinity.h:
(kit): Deleted.
(core): Deleted.
* editing/cocoa/HTMLConverter.mm:
* page/mac/WebCoreFrameView.h:
* platform/ios/ScrollViewIOS.mm:
(WebCore::ScrollView::platformSetScrollPosition):
* platform/ios/wak/WAKScrollView.mm:
(-[WAKScrollView setScrollOrigin:updatePositionAtAll:immediately:]):
(-[WAKScrollView scrollOrigin]):
* platform/mac/ScrollViewMac.mm:
(WebCore::ScrollView::platformSetScrollPosition):

Source/WebKit/mac:

* WebCoreSupport/WebEditorClient.h:
(kit):
(core):
* WebView/WebFrameView.mm:
(-[WebFrameView _scrollToBeginningOfDocument]):
(-[WebFrameView _scrollToEndOfDocument]):

Source/WebKit2:

* WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm:
* WebProcess/WebPage/WKAccessibilityWebPageObjectIOS.mm:
(-[WKAccessibilityWebPageObject accessibilityHitTest:]):

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

14 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/editing/TextAffinity.h
Source/WebCore/editing/cocoa/HTMLConverter.mm
Source/WebCore/page/mac/WebCoreFrameView.h
Source/WebCore/platform/ios/ScrollViewIOS.mm
Source/WebCore/platform/ios/wak/WAKScrollView.mm
Source/WebCore/platform/mac/ScrollViewMac.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebEditorClient.h
Source/WebKit/mac/WebView/WebFrameView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm
Source/WebKit2/WebProcess/WebPage/WKAccessibilityWebPageObjectIOS.mm

index 7eed646..42bf575 100644 (file)
@@ -1,3 +1,33 @@
+2014-09-12  Enrica Casucci  <enrica@apple.com>
+
+        Remove PLATFORM(IOS) from WebCore/editing (Part 3).
+        https://bugs.webkit.org/show_bug.cgi?id=136474
+
+        Reviewed by Benjamin Poulain.
+
+        This is the updated version of the patch that was landed in r173340.
+        I changed the use of IntPoint to FloatPoint since it was causing tests
+        to fail.
+        This patch removes the use of PLATFORM(IOS) from TextAffinity.h
+        and removes the assumption that EAffinity values match NSSelectionAffinity
+        values. It also removes the includes in TextAffinity.h, creating the need to
+        include explicitly the files when necessary. It also removes the unnecessary
+        use of platform specific types, replacing them with WebCore types.
+
+        * WebCore.exp.in:
+        * editing/TextAffinity.h:
+        (kit): Deleted.
+        (core): Deleted.
+        * editing/cocoa/HTMLConverter.mm:
+        * page/mac/WebCoreFrameView.h:
+        * platform/ios/ScrollViewIOS.mm:
+        (WebCore::ScrollView::platformSetScrollPosition):
+        * platform/ios/wak/WAKScrollView.mm:
+        (-[WAKScrollView setScrollOrigin:updatePositionAtAll:immediately:]):
+        (-[WAKScrollView scrollOrigin]):
+        * platform/mac/ScrollViewMac.mm:
+        (WebCore::ScrollView::platformSetScrollPosition):
+
 2014-09-12  Dean Jackson  <dino@apple.com>
 
         Unprefix the flexbox CSS properties
index 8d1fd40..44cd644 100644 (file)
@@ -2714,6 +2714,7 @@ __ZN7WebCore6Widget17setPlatformWidgetEP7WAKView
 __ZN7WebCore6WidgetC2EP7WAKView
 __ZN7WebCore8Document19dispatchWindowEventEN3WTF10PassRefPtrINS_5EventEEENS2_INS_11EventTargetEEE
 __ZN7WebCore8IntPointC1ERK7CGPoint
+__ZN7WebCore8IntPointC1ERKNS_10FloatPointE
 __ZN7WebCore8PositionC1EN3WTF10PassRefPtrINS_4NodeEEENS0_10AnchorTypeE
 __ZN7WebCore8PositionC1EN3WTF10PassRefPtrINS_4NodeEEENS0_19LegacyEditingOffsetE
 __ZN7WebCore8SVGNames4initEv
index 5d22691..2e3c1e1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004 Apple Inc.  All rights reserved.
+ * Copyright (C) 2004-2014 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #ifndef TextAffinity_h
 #define TextAffinity_h
 
-#ifdef __OBJC__
-#if !PLATFORM(IOS)
-#include <AppKit/NSTextView.h>
-#else
-#include "WAKAppKitStubs.h"
-#endif // !PLATFORM(IOS)
-#endif
-
 namespace WebCore {
 
-// These match the AppKit values for these concepts.
-// From NSTextView.h:
-// NSSelectionAffinityUpstream = 0
-// NSSelectionAffinityDownstream = 1
 enum EAffinity { UPSTREAM = 0, DOWNSTREAM = 1 };
 
 } // namespace WebCore
 
-#ifdef __OBJC__
-
-inline NSSelectionAffinity kit(WebCore::EAffinity affinity)
-{
-    return static_cast<NSSelectionAffinity>(affinity);
-}
-
-inline WebCore::EAffinity core(NSSelectionAffinity affinity)
-{
-    return static_cast<WebCore::EAffinity>(affinity);
-}
-
-#endif
-
 #endif // TextAffinity_h
index 6d4d68e..518e4fa 100644 (file)
@@ -62,6 +62,8 @@
 
 #if PLATFORM(IOS)
 
+#import "WAKAppKitStubs.h"
+
 SOFT_LINK_FRAMEWORK(UIKit)
 SOFT_LINK_CLASS(UIKit, UIColor)
 
index fffef8f..00beb97 100644 (file)
@@ -29,6 +29,7 @@
 #ifdef __cplusplus
 namespace WebCore {
     class Frame;
+    class FloatPoint;
 }
 #endif
 
@@ -37,13 +38,13 @@ namespace WebCore {
 #ifdef __cplusplus
 - (void)setScrollingModes:(WebCore::ScrollbarMode)hMode vertical:(WebCore::ScrollbarMode)vMode andLock:(BOOL)lock;
 - (void)scrollingModes:(WebCore::ScrollbarMode*)hMode vertical:(WebCore::ScrollbarMode*)vMode;
+- (void)setScrollOrigin:(WebCore::FloatPoint)origin updatePositionAtAll:(BOOL)updatePositionAtAll immediately:(BOOL)updatePositionImmediately;
+- (WebCore::FloatPoint)scrollOrigin;
 #else
 - (void)setScrollingModes:(int)hMode vertical:(int)vMode andLock:(BOOL)lock;
 - (void)scrollingModes:(int*)hMode vertical:(int*)vMode;
 #endif
 - (void)setScrollBarsSuppressed:(BOOL)suppressed repaintOnUnsuppress:(BOOL)repaint;
-- (void)setScrollOrigin:(NSPoint)origin updatePositionAtAll:(BOOL)updatePositionAtAll immediately:(BOOL)updatePositionImmediately;
-- (NSPoint)scrollOrigin;
 @end
 
 @protocol WebCoreFrameView
index 5ee90bb..ee74e7c 100644 (file)
@@ -243,9 +243,7 @@ void ScrollView::platformSetScrollbarsSuppressed(bool repaintOnUnsuppress)
 void ScrollView::platformSetScrollPosition(const IntPoint& scrollPoint)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    NSPoint floatPoint = scrollPoint;
-    NSPoint tempPoint = { max(-[scrollView() scrollOrigin].x, floatPoint.x), max(-[scrollView() scrollOrigin].y, floatPoint.y) };  // Don't use NSMakePoint to work around 4213314.
-    [documentView() scrollPoint:tempPoint];
+    [documentView() scrollPoint:NSMakePoint(fmax(-[scrollView() scrollOrigin].x(), scrollPoint.x()), fmax(-[scrollView() scrollOrigin].y(), scrollPoint.y()))];
     END_BLOCK_OBJC_EXCEPTIONS;
 }
 
index 78e6132..5007104 100644 (file)
@@ -28,6 +28,7 @@
 
 #if PLATFORM(IOS)
 
+#import "FloatPoint.h"
 #import "WAKAppKitStubs.h"
 #import "WAKClipView.h"
 #import "WAKViewInternal.h"
@@ -232,7 +233,7 @@ static void _notificationCallback(WKViewRef v, WKViewNotificationType type, void
     UNUSED_PARAM(repaint);
 }
 
-- (void)setScrollOrigin:(NSPoint)scrollOrigin updatePositionAtAll:(BOOL)updatePositionAtAll immediately:(BOOL)updatePositionImmediately
+- (void)setScrollOrigin:(WebCore::FloatPoint)scrollOrigin updatePositionAtAll:(BOOL)updatePositionAtAll immediately:(BOOL)updatePositionImmediately
 {
     UNUSED_PARAM(updatePositionAtAll);
     UNUSED_PARAM(updatePositionImmediately);
@@ -241,12 +242,12 @@ static void _notificationCallback(WKViewRef v, WKViewNotificationType type, void
     // so we don't have to check for equivalence here.
     _scrollOrigin = scrollOrigin;
 
-    [_documentView setBoundsOrigin:NSMakePoint(-scrollOrigin.x, -scrollOrigin.y)];
+    [_documentView setBoundsOrigin:NSMakePoint(-scrollOrigin.x(), -scrollOrigin.y())];
 }
 
-- (NSPoint)scrollOrigin
+- (WebCore::FloatPoint)scrollOrigin
 {
-    return _scrollOrigin;
+    return WebCore::FloatPoint(_scrollOrigin);
 }
 
 #pragma mark -
index ee29934..d030cbd 100644 (file)
@@ -202,7 +202,7 @@ void ScrollView::platformSetScrollPosition(const IntPoint& scrollPoint)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
     NSPoint floatPoint = scrollPoint;
-    NSPoint tempPoint = { std::max(-[scrollView() scrollOrigin].x, floatPoint.x), std::max(-[scrollView() scrollOrigin].y, floatPoint.y) };  // Don't use NSMakePoint to work around 4213314.
+    NSPoint tempPoint = { std::fmax(-[scrollView() scrollOrigin].x(), floatPoint.x), std::fmax(-[scrollView() scrollOrigin].y(), floatPoint.y) }; // Don't use NSMakePoint to work around 4213314.
 
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
     // AppKit has the inset factored into all of its scroll positions. In WebCore, we use positions that ignore
index dea4ea4..58980f9 100644 (file)
@@ -1,3 +1,26 @@
+2014-09-12  Enrica Casucci  <enrica@apple.com>
+
+        Remove PLATFORM(IOS) from WebCore/editing (Part 3).
+        https://bugs.webkit.org/show_bug.cgi?id=136474
+
+        Reviewed by Benjamin Poulain.
+
+        This is the updated version of the patch that was landed in r173340.
+        I changed the use of IntPoint to FloatPoint since it was causing tests
+        to fail.
+        This patch removes the use of PLATFORM(IOS) from TextAffinity.h
+        and removes the assumption that EAffinity values match NSSelectionAffinity
+        values. It also removes the includes in TextAffinity.h, creating the need to
+        include explicitly the files when necessary. It also removes the unnecessary
+        use of platform specific types, replacing them with WebCore types.
+
+        * WebCoreSupport/WebEditorClient.h:
+        (kit):
+        (core):
+        * WebView/WebFrameView.mm:
+        (-[WebFrameView _scrollToBeginningOfDocument]):
+        (-[WebFrameView _scrollToEndOfDocument]):
+
 2014-09-11  Bear Travis  <betravis@adobe.com>
 
         [CSS Font Loading] Enable CSS Font Loading on Mac
index 2fc2b9c..632e0b9 100644 (file)
 #import <wtf/Vector.h>
 #import <wtf/text/StringView.h>
 
+#if PLATFORM(IOS)
+#import <WebCore/WAKAppKitStubs.h>
+#endif
+
 @class WebView;
 @class WebEditorUndoTarget;
 
@@ -176,6 +180,32 @@ private:
 #endif
 };
 
+#if PLATFORM(COCOA)
+inline NSSelectionAffinity kit(WebCore::EAffinity affinity)
+{
+    switch (affinity) {
+    case WebCore::EAffinity::UPSTREAM:
+        return NSSelectionAffinityUpstream;
+    case WebCore::EAffinity::DOWNSTREAM:
+        return NSSelectionAffinityDownstream;
+    }
+    ASSERT_NOT_REACHED();
+    return NSSelectionAffinityUpstream;
+}
+
+inline WebCore::EAffinity core(NSSelectionAffinity affinity)
+{
+    switch (affinity) {
+    case NSSelectionAffinityUpstream:
+        return WebCore::EAffinity::UPSTREAM;
+    case NSSelectionAffinityDownstream:
+        return WebCore::EAffinity::DOWNSTREAM;
+    }
+    ASSERT_NOT_REACHED();
+    return WebCore::EAffinity::UPSTREAM;
+}
+#endif
+
 #if PLATFORM(IOS)
 
 inline bool WebEditorClient::isGrammarCheckingEnabled()
index 653a77e..bb8f279 100644 (file)
@@ -669,8 +669,8 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
     if (![self _isScrollable])
         return NO;
     NSPoint point = [(NSView *)[[self _scrollView] documentView] frame].origin;
-    point.x += [[self _scrollView] scrollOrigin].x;
-    point.y += [[self _scrollView] scrollOrigin].y;
+    point.x += [[self _scrollView] scrollOrigin].x();
+    point.y += [[self _scrollView] scrollOrigin].y();
     return [[self _contentView] _scrollTo:&point animate:YES];
 }
 
@@ -700,9 +700,9 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
     
     // Reset the position opposite to the block progression direction.
     if (isVertical)
-        point.x += [[self _scrollView] scrollOrigin].x;
+        point.x += [[self _scrollView] scrollOrigin].x();
     else
-        point.y += [[self _scrollView] scrollOrigin].y;
+        point.y += [[self _scrollView] scrollOrigin].y();
     return [[self _contentView] _scrollTo:&point animate:YES];
 }
 
index f1079b1..7aa90f0 100644 (file)
@@ -1,3 +1,23 @@
+2014-09-12  Enrica Casucci  <enrica@apple.com>
+
+        Remove PLATFORM(IOS) from WebCore/editing (Part 3).
+        https://bugs.webkit.org/show_bug.cgi?id=136474
+
+        Reviewed by Benjamin Poulain.
+
+        This is the updated version of the patch that was landed in r173340.
+        I changed the use of IntPoint to FloatPoint since it was causing tests
+        to fail.
+        This patch removes the use of PLATFORM(IOS) from TextAffinity.h
+        and removes the assumption that EAffinity values match NSSelectionAffinity
+        values. It also removes the includes in TextAffinity.h, creating the need to
+        include explicitly the files when necessary. It also removes the unnecessary
+        use of platform specific types, replacing them with WebCore types.
+
+        * WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm:
+        * WebProcess/WebPage/WKAccessibilityWebPageObjectIOS.mm:
+        (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
+
 2014-09-12  Dan Bernstein  <mitz@apple.com>
 
         [Cocoa] Message generation scripts should be installed in WebKit.framework
index 20a5e1c..511861b 100644 (file)
 #import "WKDOMDocument.h"
 #import "WKDOMText.h"
 
+#if PLATFORM(IOS)
+#import <WebCore/WAKAppKitStubs.h>
+#endif
+
 namespace WebKit {
 
 template<typename WebCoreType, typename WKDOMType>
index ddcf1b2..7ca2f55 100644 (file)
@@ -69,7 +69,7 @@
     return m_page->pageScaleFactor();
 }
 
-- (id)accessibilityHitTest:(NSPoint)point
+- (id)accessibilityHitTest:(WebCore::FloatPoint)point
 {
     if (!m_page)
         return nil;