From a5e39d1db3cdbcffe276a018a22161250c92c095 Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Thu, 4 Sep 2014 18:17:15 -0700 Subject: [PATCH 1/2] Revert "Merge pull request #2158 from mrbannon/master" This reverts commit 228a95f776f2e77b1e3f6010e7a819f243762eed, reversing changes made to cf93b72edd2c1a4236cffc260073910185743d4d. --- Objective-J/CFHTTPRequest.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Objective-J/CFHTTPRequest.js b/Objective-J/CFHTTPRequest.js index 1e82be082..6186dc80f 100644 --- a/Objective-J/CFHTTPRequest.js +++ b/Objective-J/CFHTTPRequest.js @@ -99,7 +99,6 @@ GLOBAL(CFHTTPRequest) = function() this._isOpen = false; this._requestHeaders = {}; this._mimeType = null; - this._withCredentials = false; this._eventDispatcher = new EventDispatcher(this); this._nativeRequest = new NativeRequest(); @@ -225,9 +224,7 @@ CFHTTPRequest.prototype.open = function(/*String*/ aMethod, /*String*/ aURL, /*B this._method = aMethod; this._user = aUser; this._password = aPassword; - var result = this._nativeRequest.open(aMethod, aURL, isAsynchronous, aUser, aPassword); - this._nativeRequest.withCredentials = this._withCredentials; - return result; + return this._nativeRequest.open(aMethod, aURL, isAsynchronous, aUser, aPassword); }; CFHTTPRequest.prototype.send = function(/*Object*/ aBody) @@ -236,7 +233,6 @@ CFHTTPRequest.prototype.send = function(/*Object*/ aBody) { delete this._nativeRequest.onreadystatechange; this._nativeRequest.open(this._method, this._URL, this._async, this._user, this._password); - this._nativeRequest.withCredentials = this._withCredentials; this._nativeRequest.onreadystatechange = this._stateChangeHandler; } @@ -280,12 +276,12 @@ CFHTTPRequest.prototype.removeEventListener = function(/*String*/ anEventName, / CFHTTPRequest.prototype.setWithCredentials = function(/*Boolean*/ willSendWithCredentials) { - this.withCredentials = willSendWithCredentials; + this._nativeRequest.withCredentials = willSendWithCredentials; }; CFHTTPRequest.prototype.getWithCredentials = function() { - return this.withCredentials; + return this._nativeRequest.withCredentials; }; function determineAndDispatchHTTPRequestEvents(/*CFHTTPRequest*/ aRequest) From b9b396a279d994fbd725b3b116d36a48b5649e25 Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Fri, 12 Sep 2014 14:42:27 -0700 Subject: [PATCH 2/2] FIXED: using setHidden: for a button in buttonbar was not working Previously, CPButtonBar was not updating its layout after changing the visibility of its buttons. This patch adds makes CPButtonBar observersing the buttons and relayout if the visibility of one button is updated. --- AppKit/CPButtonBar.j | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/AppKit/CPButtonBar.j b/AppKit/CPButtonBar.j index f655796b5..4dd9db247 100644 --- a/AppKit/CPButtonBar.j +++ b/AppKit/CPButtonBar.j @@ -26,7 +26,8 @@ @class CPSplitView @global CPPopUpButtonStatePullsDown - +@global CPKeyValueChangeOldKey +@global CPKeyValueChangeNewKey @implementation CPButtonBar : CPView { @@ -129,10 +130,16 @@ - (void)setButtons:(CPArray)buttons { + for (var i = [_buttons count] - 1; i >= 0; i--) + [_buttons[i] removeObserver:self forKeyPath:@"hidden"]; + _buttons = [CPArray arrayWithArray:buttons]; - for (var i = 0, count = [_buttons count]; i < count; i++) + for (var i = [_buttons count] - 1; i >= 0; i--) + { + [_buttons[i] addObserver:self forKeyPath:@"hidden" options:nil context:nil]; [_buttons[i] setBordered:YES]; + } [self setNeedsLayout]; } @@ -280,6 +287,14 @@ } } +- (void)observeValueForKeyPath:(CPString)keyPath ofObject:(id)object change:(CPDictionary)change context:(id)context +{ + if ([change objectForKey:CPKeyValueChangeOldKey] == [change objectForKey:CPKeyValueChangeNewKey]) + return; + + [self setNeedsLayout]; +} + - (void)setFrameSize:(CGSize)aSize { [super setFrameSize:aSize];