Title: [173340] trunk/Source
Revision
173340
Author
enr...@apple.com
Date
2014-09-05 16:30:30 -0700 (Fri, 05 Sep 2014)

Log Message

Remove PLATFORM(IOS) from WebCore/editing (Part 3).
https://bugs.webkit.org/show_bug.cgi?id=136474

Reviewed by Benjamin Poulain.

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:

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

Source/WebKit/mac:

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

Source/WebKit2:

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (173339 => 173340)


--- trunk/Source/WebCore/ChangeLog	2014-09-05 23:01:16 UTC (rev 173339)
+++ trunk/Source/WebCore/ChangeLog	2014-09-05 23:30:30 UTC (rev 173340)
@@ -1,3 +1,28 @@
+2014-09-05  Enrica Casucci  <enr...@apple.com>
+
+        Remove PLATFORM(IOS) from WebCore/editing (Part 3).
+        https://bugs.webkit.org/show_bug.cgi?id=136474
+
+        Reviewed by Benjamin Poulain.
+
+        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.
+
+        * editing/TextAffinity.h:
+        (kit): Deleted.
+        (core): Deleted.
+        * editing/cocoa/HTMLConverter.mm:
+        * page/mac/WebCoreFrameView.h:
+        * platform/ios/ScrollViewIOS.mm:
+        (WebCore::ScrollView::platformSetScrollPosition):
+        (WebCore::ScrollView::platformSetScrollOrigin):
+        * platform/ios/wak/WAKScrollView.mm:
+        (-[WAKScrollView setScrollOrigin:updatePositionAtAll:immediately:]):
+        (-[WAKScrollView scrollOrigin]):
+
 2014-09-05  Jer Noble  <jer.no...@apple.com>
 
         Unreviewed GTK build fix; include StringPrintStream to pull in toString().

Modified: trunk/Source/WebCore/editing/TextAffinity.h (173339 => 173340)


--- trunk/Source/WebCore/editing/TextAffinity.h	2014-09-05 23:01:16 UTC (rev 173339)
+++ trunk/Source/WebCore/editing/TextAffinity.h	2014-09-05 23:30:30 UTC (rev 173340)
@@ -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
@@ -26,36 +26,10 @@
 #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

Modified: trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm (173339 => 173340)


--- trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm	2014-09-05 23:01:16 UTC (rev 173339)
+++ trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm	2014-09-05 23:30:30 UTC (rev 173340)
@@ -62,6 +62,8 @@
 
 #if PLATFORM(IOS)
 
+#import "WAKAppKitStubs.h"
+
 SOFT_LINK_FRAMEWORK(UIKit)
 SOFT_LINK_CLASS(UIKit, UIColor)
 

Modified: trunk/Source/WebCore/page/mac/WebCoreFrameView.h (173339 => 173340)


--- trunk/Source/WebCore/page/mac/WebCoreFrameView.h	2014-09-05 23:01:16 UTC (rev 173339)
+++ trunk/Source/WebCore/page/mac/WebCoreFrameView.h	2014-09-05 23:30:30 UTC (rev 173340)
@@ -28,7 +28,8 @@
 // WTF_PLATFORM_IOS
 #ifdef __cplusplus
 namespace WebCore {
-    class Frame;
+class Frame;
+class IntPoint;
 }
 #endif
 
@@ -37,13 +38,13 @@
 #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::IntPoint)origin updatePositionAtAll:(BOOL)updatePositionAtAll immediately:(BOOL)updatePositionImmediately;
+- (WebCore::IntPoint)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

Modified: trunk/Source/WebCore/platform/ios/ScrollViewIOS.mm (173339 => 173340)


--- trunk/Source/WebCore/platform/ios/ScrollViewIOS.mm	2014-09-05 23:01:16 UTC (rev 173339)
+++ trunk/Source/WebCore/platform/ios/ScrollViewIOS.mm	2014-09-05 23:30:30 UTC (rev 173340)
@@ -243,9 +243,7 @@
 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(max(-[scrollView() scrollOrigin].x(), scrollPoint.x()), max(-[scrollView() scrollOrigin].y(), scrollPoint.y()))];
     END_BLOCK_OBJC_EXCEPTIONS;
 }
 
@@ -307,7 +305,7 @@
 void ScrollView::platformSetScrollOrigin(const IntPoint& origin, bool updatePositionAll, bool updatePositionSynchronously)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    [scrollView() setScrollOrigin:static_cast<CGPoint>(origin) updatePositionAtAll:updatePositionAll immediately:updatePositionSynchronously];
+    [scrollView() setScrollOrigin:origin updatePositionAtAll:updatePositionAll immediately:updatePositionSynchronously];
     END_BLOCK_OBJC_EXCEPTIONS;
 }
 

Modified: trunk/Source/WebCore/platform/ios/wak/WAKScrollView.mm (173339 => 173340)


--- trunk/Source/WebCore/platform/ios/wak/WAKScrollView.mm	2014-09-05 23:01:16 UTC (rev 173339)
+++ trunk/Source/WebCore/platform/ios/wak/WAKScrollView.mm	2014-09-05 23:30:30 UTC (rev 173340)
@@ -28,6 +28,7 @@
 
 #if PLATFORM(IOS)
 
+#import "IntPoint.h"
 #import "WAKAppKitStubs.h"
 #import "WAKClipView.h"
 #import "WAKViewInternal.h"
@@ -232,7 +233,7 @@
     UNUSED_PARAM(repaint);
 }
 
-- (void)setScrollOrigin:(NSPoint)scrollOrigin updatePositionAtAll:(BOOL)updatePositionAtAll immediately:(BOOL)updatePositionImmediately
+- (void)setScrollOrigin:(WebCore::IntPoint)scrollOrigin updatePositionAtAll:(BOOL)updatePositionAtAll immediately:(BOOL)updatePositionImmediately
 {
     UNUSED_PARAM(updatePositionAtAll);
     UNUSED_PARAM(updatePositionImmediately);
@@ -241,12 +242,12 @@
     // 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::IntPoint)scrollOrigin
 {
-    return _scrollOrigin;
+    return WebCore::IntPoint(_scrollOrigin);
 }
 
 #pragma mark -

Modified: trunk/Source/WebCore/platform/mac/ScrollViewMac.mm (173339 => 173340)


--- trunk/Source/WebCore/platform/mac/ScrollViewMac.mm	2014-09-05 23:01:16 UTC (rev 173339)
+++ trunk/Source/WebCore/platform/mac/ScrollViewMac.mm	2014-09-05 23:30:30 UTC (rev 173340)
@@ -201,8 +201,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 = NSMakePoint(std::max(-[scrollView() scrollOrigin].x(), scrollPoint.x()), std::max(-[scrollView() scrollOrigin].y(), scrollPoint.y()));
 
 #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

Modified: trunk/Source/WebKit/mac/ChangeLog (173339 => 173340)


--- trunk/Source/WebKit/mac/ChangeLog	2014-09-05 23:01:16 UTC (rev 173339)
+++ trunk/Source/WebKit/mac/ChangeLog	2014-09-05 23:30:30 UTC (rev 173340)
@@ -1,3 +1,21 @@
+2014-09-05  Enrica Casucci  <enr...@apple.com>
+
+        Remove PLATFORM(IOS) from WebCore/editing (Part 3).
+        https://bugs.webkit.org/show_bug.cgi?id=136474
+
+        Reviewed by Benjamin Poulain.
+
+        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: Added kit and core for EAffinity.
+        * WebView/WebFrameView.mm:
+        (-[WebFrameView _scrollToBeginningOfDocument]):
+        (-[WebFrameView _scrollToEndOfDocument]):
+
 2014-09-05  Daniel Bates  <daba...@apple.com>
 
         [iOS] Another attempt to fix the iOS build after <http://trac.webkit.org/changeset/173309>

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h (173339 => 173340)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h	2014-09-05 23:01:16 UTC (rev 173339)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h	2014-09-05 23:30:30 UTC (rev 173340)
@@ -34,6 +34,10 @@
 #import <wtf/Vector.h>
 #import <wtf/text/StringView.h>
 
+#if PLATFORM(IOS)
+#import <WebCore/WAKAppKitStubs.h>
+#endif
+
 @class WebView;
 @class WebEditorUndoTarget;
 
@@ -176,6 +180,28 @@
 #endif
 };
 
+#if PLATFORM(COCOA)
+inline NSSelectionAffinity kit(WebCore::EAffinity affinity)
+{
+    switch (affinity) {
+    case WebCore::EAffinity::UPSTREAM:
+        return NSSelectionAffinityUpstream;
+    case WebCore::EAffinity::DOWNSTREAM:
+        return NSSelectionAffinityDownstream;
+    }
+}
+
+inline WebCore::EAffinity core(NSSelectionAffinity affinity)
+{
+    switch (affinity) {
+    case NSSelectionAffinityUpstream:
+        return WebCore::EAffinity::UPSTREAM;
+    case NSSelectionAffinityDownstream:
+        return WebCore::EAffinity::DOWNSTREAM;
+    }
+}
+#endif
+
 #if PLATFORM(IOS)
 
 inline bool WebEditorClient::isGrammarCheckingEnabled()

Modified: trunk/Source/WebKit/mac/WebView/WebFrameView.mm (173339 => 173340)


--- trunk/Source/WebKit/mac/WebView/WebFrameView.mm	2014-09-05 23:01:16 UTC (rev 173339)
+++ trunk/Source/WebKit/mac/WebView/WebFrameView.mm	2014-09-05 23:30:30 UTC (rev 173340)
@@ -669,8 +669,8 @@
     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 @@
     
     // 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];
 }
 

Modified: trunk/Source/WebKit2/ChangeLog (173339 => 173340)


--- trunk/Source/WebKit2/ChangeLog	2014-09-05 23:01:16 UTC (rev 173339)
+++ trunk/Source/WebKit2/ChangeLog	2014-09-05 23:30:30 UTC (rev 173340)
@@ -1,3 +1,20 @@
+2014-09-05  Enrica Casucci  <enr...@apple.com>
+
+        Remove PLATFORM(IOS) from WebCore/editing (Part 3).
+        https://bugs.webkit.org/show_bug.cgi?id=136474
+
+        Reviewed by Benjamin Poulain.
+
+        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-05  David Kilzer  <ddkil...@apple.com>
 
         _javascript_Core should build with newer clang

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm (173339 => 173340)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm	2014-09-05 23:01:16 UTC (rev 173339)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm	2014-09-05 23:30:30 UTC (rev 173340)
@@ -40,6 +40,10 @@
 #import "WKDOMDocument.h"
 #import "WKDOMText.h"
 
+#if PLATFORM(IOS)
+#import <WebCore/WAKAppKitStubs.h>
+#endif
+
 namespace WebKit {
 
 template<typename WebCoreType, typename WKDOMType>

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WKAccessibilityWebPageObjectIOS.mm (173339 => 173340)


--- trunk/Source/WebKit2/WebProcess/WebPage/WKAccessibilityWebPageObjectIOS.mm	2014-09-05 23:01:16 UTC (rev 173339)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WKAccessibilityWebPageObjectIOS.mm	2014-09-05 23:30:30 UTC (rev 173340)
@@ -69,12 +69,12 @@
     return m_page->pageScaleFactor();
 }
 
-- (id)accessibilityHitTest:(NSPoint)point
+- (id)accessibilityHitTest:(WebCore::IntPoint)point
 {
     if (!m_page)
         return nil;
     
-    WebCore::IntPoint convertedPoint = m_page->accessibilityScreenToRootView(WebCore::IntPoint(point));
+    WebCore::IntPoint convertedPoint = m_page->accessibilityScreenToRootView(point);
     return [[self accessibilityRootObjectWrapper] accessibilityHitTest:convertedPoint];
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to