Title: [164622] trunk/Source/WebKit2
Revision
164622
Author
[email protected]
Date
2014-02-24 18:59:18 -0800 (Mon, 24 Feb 2014)

Log Message

Use RetainPtrs for two WKContentView data members
https://bugs.webkit.org/show_bug.cgi?id=129276

Reviewed by Benjamin Poulain.

The UITextInputTraits were leaked. Fix with RetainPtr goodness.

Rename the obscure _accessory to _formAccessoryView and
make it a RetainPtr.

Rearrange the data members of the WKContentView class extension
for better packing and readability.

* UIProcess/ios/WKContentView.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView cleanupInteraction]):
(-[WKContentView inputAccessoryView]):
(-[WKContentView _updateAccessory]):
(-[WKContentView textInputTraits]):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (164621 => 164622)


--- trunk/Source/WebKit2/ChangeLog	2014-02-25 02:40:28 UTC (rev 164621)
+++ trunk/Source/WebKit2/ChangeLog	2014-02-25 02:59:18 UTC (rev 164622)
@@ -1,5 +1,28 @@
 2014-02-24  Simon Fraser  <[email protected]>
 
+        Use RetainPtrs for two WKContentView data members
+        https://bugs.webkit.org/show_bug.cgi?id=129276
+
+        Reviewed by Benjamin Poulain.
+        
+        The UITextInputTraits were leaked. Fix with RetainPtr goodness.
+        
+        Rename the obscure _accessory to _formAccessoryView and
+        make it a RetainPtr.
+        
+        Rearrange the data members of the WKContentView class extension
+        for better packing and readability.
+
+        * UIProcess/ios/WKContentView.h:
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView cleanupInteraction]):
+        (-[WKContentView inputAccessoryView]):
+        (-[WKContentView _updateAccessory]):
+        (-[WKContentView textInputTraits]):
+
+2014-02-24  Simon Fraser  <[email protected]>
+
         Remove WKInteractionView, move code into WKContentView
         https://bugs.webkit.org/show_bug.cgi?id=129275
 

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h (164621 => 164622)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h	2014-02-25 02:40:28 UTC (rev 164621)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h	2014-02-25 02:59:18 UTC (rev 164622)
@@ -71,6 +71,7 @@
 
 @interface WKContentView () {
     RetainPtr<UIWebTouchEventsGestureRecognizer> _touchEventGestureRecognizer;
+
     BOOL _canSendTouchEventsAsynchronously;
     unsigned _nativeWebTouchEventUniqueIdBeingSentSynchronously;
 
@@ -84,20 +85,23 @@
     RetainPtr<UIWKTextInteractionAssistant> _textSelectionAssistant;
     RetainPtr<UIWKSelectionAssistant> _webSelectionAssistant;
 
-    UITextInputTraits *_traits;
-    BOOL _isEditable;
-    UIWebFormAccessory *_accessory;
+    RetainPtr<UITextInputTraits> _traits;
+    RetainPtr<UIWebFormAccessory> _formAccessoryView;
+    RetainPtr<_UIHighlightView> _highlightView;
+    RetainPtr<NSString> _markedText;
+    RetainPtr<WKActionSheetAssistant> _actionSheetAssistant;
+
     id <UITextInputDelegate> _inputDelegate;
-    BOOL _showingTextStyleOptions;
 
-    RetainPtr<_UIHighlightView> _highlightView;
     uint64_t _latestTapHighlightID;
-    BOOL _isTapHighlightIDValid;
+
     WebKit::WKAutoCorrectionData _autocorrectionData;
-    RetainPtr<NSString> _markedText;
     WebKit::InteractionInformationAtPosition _positionInformation;
+
+    BOOL _isEditable;
+    BOOL _showingTextStyleOptions;
     BOOL _hasValidPositionInformation;
-    RetainPtr<WKActionSheetAssistant> _actionSheetAssistant;
+    BOOL _isTapHighlightIDValid;
 }
 
 @end
@@ -105,6 +109,8 @@
 @interface WKContentView (WKInteraction) <UIGestureRecognizerDelegate, UIWebTouchEventsGestureRecognizerDelegate, UITextInputPrivate, UIWebFormAccessoryDelegate, UIWKInteractionViewProtocol>
 
 @property (nonatomic, readonly) BOOL isEditable;
+@property (nonatomic, readonly) const WebKit::InteractionInformationAtPosition& positionInformation;
+@property (nonatomic, readonly) const WebKit::WKAutoCorrectionData& autocorrectionData;
 
 - (void)setupInteraction;
 - (void)cleanupInteraction;
@@ -125,7 +131,4 @@
 - (void)_didEndScrollingOrZooming;
 - (void)_didUpdateBlockSelectionWithTouch:(WebKit::WKSelectionTouch)touch withFlags:(WebKit::WKSelectionFlags)flags growThreshold:(CGFloat)growThreshold shrinkThreshold:(CGFloat)shrinkThreshold;
 
-@property (readonly, nonatomic) const WebKit::InteractionInformationAtPosition& positionInformation;
-@property (readonly, nonatomic) const WebKit::WKAutoCorrectionData& autocorrectionData;
-
 @end

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (164621 => 164622)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2014-02-25 02:40:28 UTC (rev 164621)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2014-02-25 02:59:18 UTC (rev 164622)
@@ -184,8 +184,6 @@
     [_highlightLongPressGestureRecognizer setDelegate:nil];
     [_longPressGestureRecognizer setDelegate:nil];
     [_twoFingerPanGestureRecognizer setDelegate:nil];
-
-    [_accessory release];
 }
 
 - (const InteractionInformationAtPosition&)positionInformation
@@ -677,12 +675,12 @@
     if (!_isEditable)
         return nil;
     
-    if (!_accessory) {
-        _accessory = [[UIWebFormAccessory alloc] init];
-        _accessory.delegate = self;
+    if (!_formAccessoryView) {
+        _formAccessoryView = adoptNS([[UIWebFormAccessory alloc] init]);
+        [_formAccessoryView setDelegate:self];
     }
     
-    return _accessory;
+    return _formAccessoryView.get();
 }
 
 - (NSArray *)supportedPasteboardTypesForCurrentSelection
@@ -1226,10 +1224,10 @@
 - (void)_updateAccessory
 {
     // FIXME: We need to initialize with values from the WebProcess.
-    _accessory.nextEnabled = YES;
-    _accessory.previousEnabled = YES;
+    [_formAccessoryView setNextEnabled:YES];
+    [_formAccessoryView setPreviousEnabled:YES];
     
-    [_accessory setClearVisible:NO];
+    [_formAccessoryView setClearVisible:NO];
 
     // FIXME: hide or show the AutoFill button as needed.
 }
@@ -1410,8 +1408,9 @@
 - (UITextInputTraits *)textInputTraits
 {
     if (!_traits)
-        _traits = [[UITextInputTraits alloc] init];
-    return _traits;
+        _traits = adoptNS([[UITextInputTraits alloc] init]);
+
+    return _traits.get();
 }
 
 - (UITextInteractionAssistant *)interactionAssistant
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to