From cf3dc1ba8da27d6b651a2ad2a918dd8773d99188 Mon Sep 17 00:00:00 2001 From: Honza Bambas Date: Mon, 8 Aug 2011 14:20:02 +0200 Subject: [PATCH 01/30] Bug 675804, r=jduell --- netwerk/protocol/http/HttpChannelChild.cpp | 2 +- netwerk/protocol/http/HttpChannelChild.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp index 51cdca528a22..1931e6b054fb 100644 --- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -860,7 +860,7 @@ HttpChannelChild::OnRedirectVerifyCallback(nsresult result) if (newHttpChannel) { // Must not be called until after redirect observers called. - newHttpChannel->SetOriginalURI(mRedirectOriginalURI); + newHttpChannel->SetOriginalURI(mOriginalURI); } RequestHeaderTuples emptyHeaders; diff --git a/netwerk/protocol/http/HttpChannelChild.h b/netwerk/protocol/http/HttpChannelChild.h index e5937aa5c797..c4424eb86bfb 100644 --- a/netwerk/protocol/http/HttpChannelChild.h +++ b/netwerk/protocol/http/HttpChannelChild.h @@ -159,7 +159,6 @@ protected: private: RequestHeaderTuples mRequestHeaders; nsCOMPtr mRedirectChannelChild; - nsCOMPtr mRedirectOriginalURI; nsCOMPtr mSecurityInfo; PRPackedBool mIsFromCache; From 29d2dfed2d625ea822c68bb002055aab8e4d4c80 Mon Sep 17 00:00:00 2001 From: Schuyler Duveen Date: Mon, 8 Aug 2011 14:20:03 +0200 Subject: [PATCH 02/30] Bug 507361 - localStorage doesn't work in file:/// documents, r=honzab --- dom/src/storage/nsDOMStorageDBWrapper.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/dom/src/storage/nsDOMStorageDBWrapper.cpp b/dom/src/storage/nsDOMStorageDBWrapper.cpp index 3b411e29f9f4..83de9cd571f6 100644 --- a/dom/src/storage/nsDOMStorageDBWrapper.cpp +++ b/dom/src/storage/nsDOMStorageDBWrapper.cpp @@ -42,6 +42,7 @@ #include "nsDOMStorage.h" #include "nsDOMStorageDBWrapper.h" #include "nsIFile.h" +#include "nsIURL.h" #include "nsIVariant.h" #include "nsIEffectiveTLDService.h" #include "nsAppDirectoryServiceDefs.h" @@ -354,15 +355,22 @@ nsDOMStorageDBWrapper::CreateDomainScopeDBKey(nsIURI* aUri, nsACString& aKey) if (domainScope.IsEmpty()) { // About pages have an empty host but a valid path. Since they are handled // internally by our own redirector, we can trust them and use path as key. - PRBool isAboutUrl = PR_FALSE; - if ((NS_SUCCEEDED(aUri->SchemeIs("about", &isAboutUrl)) && isAboutUrl) || - (NS_SUCCEEDED(aUri->SchemeIs("moz-safe-about", &isAboutUrl)) && isAboutUrl)) { + // if file:/// protocol, let's make the exact directory the domain + PRBool isScheme = PR_FALSE; + if ((NS_SUCCEEDED(aUri->SchemeIs("about", &isScheme)) && isScheme) || + (NS_SUCCEEDED(aUri->SchemeIs("moz-safe-about", &isScheme)) && isScheme)) { rv = aUri->GetPath(domainScope); NS_ENSURE_SUCCESS(rv, rv); // While the host is always canonicalized to lowercase, the path is not, // thus need to force the casing. ToLowerCase(domainScope); } + else if (NS_SUCCEEDED(aUri->SchemeIs("file", &isScheme)) && isScheme) { + nsCOMPtr url = do_QueryInterface(aUri, &rv); + NS_ENSURE_SUCCESS(rv, rv); + rv = url->GetDirectory(domainScope); + NS_ENSURE_SUCCESS(rv, rv); + } } rv = CreateDomainScopeDBKey(domainScope, aKey); From 6ce6bafa91b1a009c19f0fc65e25720e7e7ed12b Mon Sep 17 00:00:00 2001 From: Igor Bazarny Date: Mon, 8 Aug 2011 14:20:03 +0200 Subject: [PATCH 03/30] Bug 675615 - Fix web timing to support keep-alive connections, r=Olli.Pettay --- dom/base/nsDOMNavigationTiming.cpp | 11 +++++++++++ dom/base/nsDOMNavigationTiming.h | 2 ++ dom/base/nsPerformance.cpp | 14 +++++++------- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/dom/base/nsDOMNavigationTiming.cpp b/dom/base/nsDOMNavigationTiming.cpp index 3422949934ad..ebc639e310a1 100644 --- a/dom/base/nsDOMNavigationTiming.cpp +++ b/dom/base/nsDOMNavigationTiming.cpp @@ -91,6 +91,17 @@ nsDOMNavigationTiming::TimeStampToDOM(mozilla::TimeStamp aStamp, return NS_OK; } +nsresult +nsDOMNavigationTiming::TimeStampToDOMOrFetchStart(mozilla::TimeStamp aStamp, + DOMTimeMilliSec* aResult) +{ + if (!aStamp.IsNull()) { + return TimeStampToDOM(aStamp, aResult); + } else { + return GetFetchStart(aResult); + } +} + DOMTimeMilliSec nsDOMNavigationTiming::DurationFromStart(){ DOMTimeMilliSec result; TimeStampToDOM(mozilla::TimeStamp::Now(), &result); diff --git a/dom/base/nsDOMNavigationTiming.h b/dom/base/nsDOMNavigationTiming.h index 0577bd6e0504..4effb3648220 100644 --- a/dom/base/nsDOMNavigationTiming.h +++ b/dom/base/nsDOMNavigationTiming.h @@ -92,6 +92,8 @@ public: void NotifyDOMContentLoadedStart(nsIURI* aURI); void NotifyDOMContentLoadedEnd(nsIURI* aURI); nsresult TimeStampToDOM(mozilla::TimeStamp aStamp, DOMTimeMilliSec* aResult); + nsresult TimeStampToDOMOrFetchStart(mozilla::TimeStamp aStamp, + DOMTimeMilliSec* aResult); private: nsDOMNavigationTiming(const nsDOMNavigationTiming &){}; diff --git a/dom/base/nsPerformance.cpp b/dom/base/nsPerformance.cpp index fcf211e5ed7a..a5bebf34fab0 100644 --- a/dom/base/nsPerformance.cpp +++ b/dom/base/nsPerformance.cpp @@ -114,7 +114,7 @@ nsPerformanceTiming::GetDomainLookupStart(DOMTimeMilliSec* aTime) } mozilla::TimeStamp stamp; mChannel->GetDomainLookupStart(&stamp); - return mDOMTiming->TimeStampToDOM(stamp, aTime); + return mDOMTiming->TimeStampToDOMOrFetchStart(stamp, aTime); } NS_IMETHODIMP @@ -125,7 +125,7 @@ nsPerformanceTiming::GetDomainLookupEnd(DOMTimeMilliSec* aTime) } mozilla::TimeStamp stamp; mChannel->GetDomainLookupEnd(&stamp); - return mDOMTiming->TimeStampToDOM(stamp, aTime); + return mDOMTiming->TimeStampToDOMOrFetchStart(stamp, aTime); } NS_IMETHODIMP @@ -136,7 +136,7 @@ nsPerformanceTiming::GetConnectStart(DOMTimeMilliSec* aTime) } mozilla::TimeStamp stamp; mChannel->GetConnectStart(&stamp); - return mDOMTiming->TimeStampToDOM(stamp, aTime); + return mDOMTiming->TimeStampToDOMOrFetchStart(stamp, aTime); } NS_IMETHODIMP @@ -147,7 +147,7 @@ nsPerformanceTiming::GetConnectEnd(DOMTimeMilliSec* aTime) } mozilla::TimeStamp stamp; mChannel->GetConnectEnd(&stamp); - return mDOMTiming->TimeStampToDOM(stamp, aTime); + return mDOMTiming->TimeStampToDOMOrFetchStart(stamp, aTime); } NS_IMETHODIMP @@ -158,7 +158,7 @@ nsPerformanceTiming::GetRequestStart(DOMTimeMilliSec* aTime) } mozilla::TimeStamp stamp; mChannel->GetRequestStart(&stamp); - return mDOMTiming->TimeStampToDOM(stamp, aTime); + return mDOMTiming->TimeStampToDOMOrFetchStart(stamp, aTime); } NS_IMETHODIMP @@ -174,7 +174,7 @@ nsPerformanceTiming::GetResponseStart(DOMTimeMilliSec* aTime) if (stamp.IsNull() || (!cacheStamp.IsNull() && cacheStamp < stamp)) { stamp = cacheStamp; } - return mDOMTiming->TimeStampToDOM(stamp, aTime); + return mDOMTiming->TimeStampToDOMOrFetchStart(stamp, aTime); } NS_IMETHODIMP @@ -190,7 +190,7 @@ nsPerformanceTiming::GetResponseEnd(DOMTimeMilliSec* aTime) if (stamp.IsNull() || (!cacheStamp.IsNull() && cacheStamp < stamp)) { stamp = cacheStamp; } - return mDOMTiming->TimeStampToDOM(stamp, aTime); + return mDOMTiming->TimeStampToDOMOrFetchStart(stamp, aTime); } NS_IMETHODIMP From a3c5c31f203d0cb0df3439aa987101b0f38ea9aa Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Mon, 8 Aug 2011 16:42:20 +0200 Subject: [PATCH 04/30] Bug 668195 - Use CoreUI to draw window chrome and toolbars. r=josh --- toolkit/library/Makefile.in | 1 + widget/src/cocoa/Makefile.in | 1 + widget/src/cocoa/nsCocoaWindow.h | 2 - widget/src/cocoa/nsCocoaWindow.mm | 132 +++++++++---------------- widget/src/cocoa/nsLookAndFeel.mm | 2 +- widget/src/cocoa/nsNativeThemeCocoa.mm | 109 +++++++------------- widget/src/cocoa/nsNativeThemeColors.h | 42 ++++---- 7 files changed, 107 insertions(+), 182 deletions(-) diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in index 702e892dcf2e..56869331d253 100644 --- a/toolkit/library/Makefile.in +++ b/toolkit/library/Makefile.in @@ -152,6 +152,7 @@ OS_LIBS += \ -framework SystemConfiguration \ -framework QuickTime \ -framework IOKit \ + -F/System/Library/PrivateFrameworks -framework CoreUI \ $(TK_LIBS) \ $(NULL) endif diff --git a/widget/src/cocoa/Makefile.in b/widget/src/cocoa/Makefile.in index c388873b3e84..ae1a53adb3a5 100644 --- a/widget/src/cocoa/Makefile.in +++ b/widget/src/cocoa/Makefile.in @@ -143,4 +143,5 @@ LOCAL_INCLUDES = \ LDFLAGS += \ -framework QuickTime \ -framework IOKit \ + -F/System/Library/PrivateFrameworks -framework CoreUI \ $(NULL) diff --git a/widget/src/cocoa/nsCocoaWindow.h b/widget/src/cocoa/nsCocoaWindow.h index 1b50c1fa2cbd..01b62b5ce57e 100644 --- a/widget/src/cocoa/nsCocoaWindow.h +++ b/widget/src/cocoa/nsCocoaWindow.h @@ -293,8 +293,6 @@ public: NS_IMETHOD BeginSecureKeyboardInput(); NS_IMETHOD EndSecureKeyboardInput(); - static void UnifiedShading(void* aInfo, const CGFloat* aIn, CGFloat* aOut); - void SetPopupWindowLevel(); PRBool IsChildInFailingLeftClickThrough(NSView *aChild); diff --git a/widget/src/cocoa/nsCocoaWindow.mm b/widget/src/cocoa/nsCocoaWindow.mm index 3fec0f8c6b05..0940dca950b5 100644 --- a/widget/src/cocoa/nsCocoaWindow.mm +++ b/widget/src/cocoa/nsCocoaWindow.mm @@ -1649,26 +1649,6 @@ NS_IMETHODIMP nsCocoaWindow::EndSecureKeyboardInput() NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; } -// Callback used by the default titlebar and toolbar shading. -// *aIn == 0 at the top of the titlebar/toolbar, *aIn == 1 at the bottom -/* static */ void -nsCocoaWindow::UnifiedShading(void* aInfo, const CGFloat* aIn, CGFloat* aOut) -{ - UnifiedGradientInfo* info = (UnifiedGradientInfo*)aInfo; - // The gradient percentage at the bottom of the titlebar / top of the toolbar - float start = info->titlebarHeight / (info->titlebarHeight + info->toolbarHeight - 1); - const float startGrey = NativeGreyColorAsFloat(headerStartGrey, info->windowIsMain); - const float endGrey = NativeGreyColorAsFloat(headerEndGrey, info->windowIsMain); - // *aIn is the gradient percentage of the titlebar or toolbar gradient, - // a is the gradient percentage of the whole unified gradient. - float a = info->drawTitlebar ? *aIn * start : start + *aIn * (1 - start); - float result = (1.0f - a) * startGrey + a * endGrey; - aOut[0] = result; - aOut[1] = result; - aOut[2] = result; - aOut[3] = 1.0f; -} - void nsCocoaWindow::SetPopupWindowLevel() { // Floating popups are at the floating level and hide when the window is @@ -2377,93 +2357,79 @@ static const NSString* kStateShowsToolbarButton = @"showsToolbarButton"; return self; } -// Our pattern width is 1 pixel. CoreGraphics can cache and tile for us. -static const float sPatternWidth = 1.0f; - static void -DrawTitlebarGradient(CGContextRef aContext, float aTitlebarHeight, - float aTitlebarOrigin, float aToolbarHeight, BOOL aIsMain) +DrawNativeTitlebar(CGContextRef aContext, CGRect aTitlebarRect, + float aToolbarHeight, BOOL aIsMain) { - // Create and draw a CGShading that uses nsCocoaWindow::UnifiedShading() as its callback. - CGFunctionCallbacks callbacks = {0, nsCocoaWindow::UnifiedShading, NULL}; - UnifiedGradientInfo info = { aTitlebarHeight, aToolbarHeight, aIsMain, YES }; - CGFunctionRef function = CGFunctionCreate(&info, 1, NULL, 4, NULL, &callbacks); - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGShadingRef shading = CGShadingCreateAxial(colorSpace, - CGPointMake(0.0f, aTitlebarOrigin + aTitlebarHeight), - CGPointMake(0.0f, aTitlebarOrigin), - function, NO, NO); - CGColorSpaceRelease(colorSpace); - CGFunctionRelease(function); - CGContextDrawShading(aContext, shading); - CGShadingRelease(shading); - // Draw the one pixel border at the bottom of the titlebar. - if (aToolbarHeight == 0) { - CGRect borderRect = CGRectMake(0.0f, aTitlebarOrigin, sPatternWidth, 1.0f); - DrawNativeGreyColorInRect(aContext, headerBorderGrey, borderRect, aIsMain); - } + int unifiedHeight = aTitlebarRect.size.height + aToolbarHeight; + CUIDraw([NSWindow coreUIRenderer], aTitlebarRect, aContext, + (CFDictionaryRef)[NSDictionary dictionaryWithObjectsAndKeys: + @"kCUIWidgetWindowFrame", @"widget", + @"regularwin", @"windowtype", + (aIsMain ? @"normal" : @"inactive"), @"state", + [NSNumber numberWithInt:unifiedHeight], @"kCUIWindowFrameUnifiedTitleBarHeightKey", + [NSNumber numberWithBool:YES], @"kCUIWindowFrameDrawTitleSeparatorKey", + nil], + nil); + + // At some window widths the call to CUIDraw doesn't draw the top pixel strip. + // We don't want to have a flickering transparent line, so we overdraw it. + CGContextSetRGBFillColor(aContext, 0.95, 0.95, 0.95, 1); + CGContextFillRect(aContext, CGRectMake(0, CGRectGetMaxY(aTitlebarRect) - 1, + aTitlebarRect.size.width, 1)); } // Pattern draw callback for standard titlebar gradients and solid titlebar colors static void -RepeatedPatternDrawCallback(void* aInfo, CGContextRef aContext) +TitlebarDrawCallback(void* aInfo, CGContextRef aContext) { ToolbarWindow *window = (ToolbarWindow*)aInfo; // Remember: this context is NOT flipped, so the origin is in the bottom left. + float titlebarWidth = [window frame].size.width; float titlebarHeight = [window titlebarHeight]; float titlebarOrigin = [window frame].size.height - titlebarHeight; + NSRect titlebarRect = NSMakeRect(0, titlebarOrigin, titlebarWidth, titlebarHeight); [NSGraphicsContext saveGraphicsState]; [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:aContext flipped:NO]]; - BOOL isMain = [window isMainWindow]; - NSColor *titlebarColor = [window titlebarColorForActiveWindow:isMain]; - if (!titlebarColor) { - // If the titlebar color is nil, draw the default titlebar shading. - DrawTitlebarGradient(aContext, titlebarHeight, titlebarOrigin, - [window unifiedToolbarHeight], isMain); - } else { - // If the titlebar color is not nil, just set and draw it normally. - [titlebarColor set]; - NSRectFill(NSMakeRect(0.0f, titlebarOrigin, sPatternWidth, titlebarHeight)); - } + if ([window drawsContentsIntoWindowFrame]) { + NSView* view = [[[window contentView] subviews] lastObject]; + if (!view || ![view isKindOfClass:[ChildView class]]) + return; - // Draw the background color of the window everywhere but where the titlebar is. - [[window windowBackgroundColor] set]; - NSRectFill(NSMakeRect(0.0f, 0.0f, 1.0f, titlebarOrigin)); + // Gecko drawing assumes flippedness, but the current context isn't flipped + // (because we're painting into the window's border view, which is not a + // ChildView, so it isn't flpped). + // So we need to set a flip transform. + CGContextScaleCTM(aContext, 1.0f, -1.0f); + CGContextTranslateCTM(aContext, 0.0f, -[window frame].size.height); + + NSRect flippedTitlebarRect = NSMakeRect(0, 0, titlebarWidth, titlebarHeight); + [(ChildView*)view drawRect:flippedTitlebarRect inTitlebarContext:aContext]; + } else { + BOOL isMain = [window isMainWindow]; + NSColor *titlebarColor = [window titlebarColorForActiveWindow:isMain]; + if (!titlebarColor) { + // If the titlebar color is nil, draw the default titlebar shading. + DrawNativeTitlebar(aContext, NSRectToCGRect(titlebarRect), + [window unifiedToolbarHeight], isMain); + } else { + // If the titlebar color is not nil, just set and draw it normally. + [titlebarColor set]; + NSRectFill(titlebarRect); + } + } [NSGraphicsContext restoreGraphicsState]; } -// Pattern draw callback for "drawsContentsIntoWindowFrame" windows -static void -ContentPatternDrawCallback(void* aInfo, CGContextRef aContext) -{ - ToolbarWindow *window = (ToolbarWindow*)aInfo; - - NSView* view = [[[window contentView] subviews] lastObject]; - if (!view || ![view isKindOfClass:[ChildView class]]) - return; - - // Gecko drawing assumes flippedness, but the current context isn't flipped - // (because we're painting into the window's border view, which is not a - // ChildView, so it isn't flpped). - // So we need to set a flip transform. - CGContextScaleCTM(aContext, 1.0f, -1.0f); - CGContextTranslateCTM(aContext, 0.0f, -[window frame].size.height); - - NSRect titlebarRect = NSMakeRect(0, 0, [window frame].size.width, [window titlebarHeight]); - [(ChildView*)view drawRect:titlebarRect inTitlebarContext:aContext]; -} - - (void)setFill { - CGPatternDrawPatternCallback cb = [mWindow drawsContentsIntoWindowFrame] ? - &ContentPatternDrawCallback : &RepeatedPatternDrawCallback; - float patternWidth = [mWindow drawsContentsIntoWindowFrame] ? [mWindow frame].size.width : sPatternWidth; + float patternWidth = [mWindow frame].size.width; - CGPatternCallbacks callbacks = {0, cb, NULL}; + CGPatternCallbacks callbacks = {0, &TitlebarDrawCallback, NULL}; CGPatternRef pattern = CGPatternCreate(mWindow, CGRectMake(0.0f, 0.0f, patternWidth, [mWindow frame].size.height), CGAffineTransformIdentity, patternWidth, [mWindow frame].size.height, kCGPatternTilingConstantSpacing, true, &callbacks); diff --git a/widget/src/cocoa/nsLookAndFeel.mm b/widget/src/cocoa/nsLookAndFeel.mm index 576d91b761db..17323270bf72 100644 --- a/widget/src/cocoa/nsLookAndFeel.mm +++ b/widget/src/cocoa/nsLookAndFeel.mm @@ -247,7 +247,7 @@ nsresult nsLookAndFeel::NativeGetColor(const nsColorID aID, nscolor &aColor) break; case eColor__moz_mac_chrome_active: case eColor__moz_mac_chrome_inactive: { - int grey = NativeGreyColorAsInt(headerEndGrey, (aID == eColor__moz_mac_chrome_active)); + int grey = NativeGreyColorAsInt(toolbarFillGrey, (aID == eColor__moz_mac_chrome_active)); aColor = NS_RGB(grey, grey, grey); } break; diff --git a/widget/src/cocoa/nsNativeThemeCocoa.mm b/widget/src/cocoa/nsNativeThemeCocoa.mm index 0ce3ad3ff43b..36d24010211d 100644 --- a/widget/src/cocoa/nsNativeThemeCocoa.mm +++ b/widget/src/cocoa/nsNativeThemeCocoa.mm @@ -1596,73 +1596,30 @@ nsNativeThemeCocoa::DrawUnifiedToolbar(CGContextRef cgContext, const HIRect& inB NS_OBJC_BEGIN_TRY_ABORT_BLOCK; float titlebarHeight = [(ToolbarWindow*)aWindow titlebarHeight]; + float unifiedHeight = titlebarHeight + inBoxRect.size.height; BOOL isMain = [aWindow isMainWindow] || ![NSView focusView]; - // Draw the gradient - UnifiedGradientInfo info = { titlebarHeight, inBoxRect.size.height, isMain, NO }; - struct CGFunctionCallbacks callbacks = { 0, nsCocoaWindow::UnifiedShading, NULL }; - CGFunctionRef function = CGFunctionCreate(&info, 1, NULL, 4, NULL, &callbacks); - float srcY = inBoxRect.origin.y; - float dstY = srcY + inBoxRect.size.height - 1; - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGShadingRef shading = CGShadingCreateAxial(colorSpace, - CGPointMake(0, srcY), - CGPointMake(0, dstY), function, - NO, NO); - CGColorSpaceRelease(colorSpace); - CGFunctionRelease(function); + CGContextSaveGState(cgContext); CGContextClipToRect(cgContext, inBoxRect); - CGContextDrawShading(cgContext, shading); - CGShadingRelease(shading); - // Draw the border at the bottom of the toolbar. - CGRect borderRect = CGRectMake(inBoxRect.origin.x, inBoxRect.origin.y + - inBoxRect.size.height - 1.0f, - inBoxRect.size.width, 1.0f); - DrawNativeGreyColorInRect(cgContext, headerBorderGrey, borderRect, isMain); + CGRect drawRect = CGRectOffset(inBoxRect, 0, -titlebarHeight); + CUIDraw([NSWindow coreUIRenderer], drawRect, cgContext, + (CFDictionaryRef)[NSDictionary dictionaryWithObjectsAndKeys: + @"kCUIWidgetWindowFrame", @"widget", + @"regularwin", @"windowtype", + (isMain ? @"normal" : @"inactive"), @"state", + [NSNumber numberWithInt:unifiedHeight], @"kCUIWindowFrameUnifiedTitleBarHeightKey", + [NSNumber numberWithBool:YES], @"kCUIWindowFrameDrawTitleSeparatorKey", + [NSNumber numberWithBool:YES], @"is.flipped", + nil], + nil); + + CGContextRestoreGState(cgContext); NS_OBJC_END_TRY_ABORT_BLOCK; } -struct GreyGradientInfo { - float startGrey; - float endGrey; -}; - -static void GreyGradientCallback(void* aInfo, const CGFloat* aIn, CGFloat* aOut) -{ - GreyGradientInfo* info = static_cast(aInfo); - CGFloat result = (1.0f - *aIn) * info->startGrey + *aIn * info->endGrey; - aOut[0] = result; - aOut[1] = result; - aOut[2] = result; - aOut[3] = 1.0f; -} - -static void DrawGreyGradient(CGContextRef cgContext, const HIRect& rect, - float startGrey, float endGrey) -{ - if (rect.size.height <= 0.0f) - return; - - GreyGradientInfo info = { startGrey, endGrey }; - struct CGFunctionCallbacks callbacks = { 0, GreyGradientCallback, NULL }; - CGFunctionRef function = CGFunctionCreate(&info, 1, NULL, 4, NULL, &callbacks); - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGShadingRef shading = CGShadingCreateAxial(colorSpace, - CGPointMake(0, CGRectGetMinY(rect)), - CGPointMake(0, CGRectGetMaxY(rect)), - function, false, false); - CGColorSpaceRelease(colorSpace); - CGFunctionRelease(function); - CGContextSaveGState(cgContext); - CGContextClipToRect(cgContext, rect); - CGContextDrawShading(cgContext, shading); - CGContextRestoreGState(cgContext); - CGShadingRelease(shading); -} - void nsNativeThemeCocoa::DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRect, nsIFrame *aFrame) @@ -1674,18 +1631,28 @@ nsNativeThemeCocoa::DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRec BOOL isMain = [NativeWindowForFrame(aFrame) isMainWindow] || ![NSView focusView]; - // Draw the borders at the top of the statusbar. - CGRect rect = CGRectMake(inBoxRect.origin.x, inBoxRect.origin.y, - inBoxRect.size.width, 1.0f); - DrawNativeGreyColorInRect(cgContext, statusbarFirstTopBorderGrey, rect, isMain); - rect.origin.y += 1.0f; - DrawNativeGreyColorInRect(cgContext, statusbarSecondTopBorderGrey, rect, isMain); + CGContextSaveGState(cgContext); + CGContextClipToRect(cgContext, inBoxRect); - // Draw the gradient. - DrawGreyGradient(cgContext, CGRectMake(inBoxRect.origin.x, inBoxRect.origin.y + 2.0f, - inBoxRect.size.width, inBoxRect.size.height - 2.0f), - NativeGreyColorAsFloat(statusbarGradientStartGrey, isMain), - NativeGreyColorAsFloat(statusbarGradientEndGrey, isMain)); + // kCUIWidgetWindowFrame draws a complete window frame with both title bar + // and bottom bar. We only want the bottom bar, so we extend the draw rect + // upwards to make space for the title bar, and then we clip it away. + CGRect drawRect = inBoxRect; + const int extendUpwards = 40; + drawRect.origin.y -= extendUpwards; + drawRect.size.height += extendUpwards; + CUIDraw([NSWindow coreUIRenderer], drawRect, cgContext, + (CFDictionaryRef)[NSDictionary dictionaryWithObjectsAndKeys: + @"kCUIWidgetWindowFrame", @"widget", + @"regularwin", @"windowtype", + (isMain ? @"normal" : @"inactive"), @"state", + [NSNumber numberWithInt:inBoxRect.size.height], @"kCUIWindowFrameBottomBarHeightKey", + [NSNumber numberWithBool:YES], @"kCUIWindowFrameDrawBottomBarSeparatorKey", + [NSNumber numberWithBool:YES], @"is.flipped", + nil], + nil); + + CGContextRestoreGState(cgContext); NS_OBJC_END_TRY_ABORT_BLOCK; } @@ -1921,12 +1888,12 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext, // background drawRect.origin.y += drawRect.size.height; drawRect.size.height = macRect.size.height - 2.0f; - DrawNativeGreyColorInRect(cgContext, headerEndGrey, drawRect, isMain); + DrawNativeGreyColorInRect(cgContext, toolbarFillGrey, drawRect, isMain); // bottom border drawRect.origin.y += drawRect.size.height; drawRect.size.height = 1.0f; - DrawNativeGreyColorInRect(cgContext, headerBorderGrey, drawRect, isMain); + DrawNativeGreyColorInRect(cgContext, toolbarBottomBorderGrey, drawRect, isMain); } break; diff --git a/widget/src/cocoa/nsNativeThemeColors.h b/widget/src/cocoa/nsNativeThemeColors.h index 48e9829f0e23..8dc992e67ef2 100644 --- a/widget/src/cocoa/nsNativeThemeColors.h +++ b/widget/src/cocoa/nsNativeThemeColors.h @@ -41,43 +41,35 @@ #include "nsToolkit.h" #import +extern "C" { + typedef CFTypeRef CUIRendererRef; + void CUIDraw(CUIRendererRef r, CGRect rect, CGContextRef ctx, CFDictionaryRef options, CFDictionaryRef* result); +} + +@interface NSWindow(CoreUIRendererPrivate) ++ (CUIRendererRef)coreUIRenderer; +@end + enum ColorName { - headerStartGrey, - headerEndGrey, - headerBorderGrey, toolbarTopBorderGrey, - statusbarFirstTopBorderGrey, - statusbarSecondTopBorderGrey, - statusbarGradientStartGrey, - statusbarGradientEndGrey + toolbarFillGrey, + toolbarBottomBorderGrey, }; static const int sLeopardThemeColors[][2] = { /* { active window, inactive window } */ - // titlebar and toolbar: - { 0xC5, 0xE9 }, // start grey - { 0x96, 0xCA }, // end grey - { 0x42, 0x89 }, // bottom separator line + // toolbar: { 0xC0, 0xE2 }, // top separator line - // statusbar: - { 0x42, 0x86 }, // first top border - { 0xD8, 0xEE }, // second top border - { 0xBD, 0xE4 }, // gradient start - { 0x96, 0xCF } // gradient end + { 0x96, 0xCA }, // fill color + { 0x42, 0x89 }, // bottom separator line }; static const int sSnowLeopardThemeColors[][2] = { /* { active window, inactive window } */ - // titlebar and toolbar: - { 0xD1, 0xEE }, // start grey - { 0xA7, 0xD8 }, // end grey - { 0x51, 0x99 }, // bottom separator line + // toolbar: { 0xD0, 0xF1 }, // top separator line - // statusbar: - { 0x51, 0x99 }, // first top border - { 0xE8, 0xF6 }, // second top border - { 0xCB, 0xEA }, // gradient start - { 0xA7, 0xDE } // gradient end + { 0xA7, 0xD8 }, // fill color + { 0x51, 0x99 }, // bottom separator line }; __attribute__((unused)) From fef64661d2092b47bb439f29dcccc28cde2c9977 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Mon, 8 Aug 2011 16:42:27 +0200 Subject: [PATCH 05/30] Bug 667476 - Add Lion colors to nsNativeThemeColors.h. r=josh --- widget/src/cocoa/nsNativeThemeColors.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/widget/src/cocoa/nsNativeThemeColors.h b/widget/src/cocoa/nsNativeThemeColors.h index 8dc992e67ef2..36419094223f 100644 --- a/widget/src/cocoa/nsNativeThemeColors.h +++ b/widget/src/cocoa/nsNativeThemeColors.h @@ -72,9 +72,20 @@ static const int sSnowLeopardThemeColors[][2] = { { 0x51, 0x99 }, // bottom separator line }; +static const int sLionThemeColors[][2] = { + /* { active window, inactive window } */ + // toolbar: + { 0xD0, 0xF0 }, // top separator line + { 0xB2, 0xE1 }, // fill color + { 0x59, 0x87 }, // bottom separator line +}; + __attribute__((unused)) static int NativeGreyColorAsInt(ColorName name, BOOL isMain) { + if (nsToolkit::OnLionOrLater()) + return sLionThemeColors[name][isMain ? 0 : 1]; + if (nsToolkit::OnSnowLeopardOrLater()) return sSnowLeopardThemeColors[name][isMain ? 0 : 1]; From 58a18684cf9439d8d59541317a0cdfb42bfa64b8 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Mon, 8 Aug 2011 16:42:36 +0200 Subject: [PATCH 06/30] Bug 667476 - Don't cover unified toolbar with a solid color in tabs-on-top mode. Also, in tabs-on-bottom mode, increase the overlap between toolbars to 2 pixels. r=dao --- browser/themes/pinstripe/browser/browser.css | 31 +++++++++--------- .../tabbrowser/tabbar-top-bg-active.png | Bin 291 -> 121 bytes .../tabbrowser/tabbar-top-bg-inactive.png | Bin 394 -> 118 bytes 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/browser/themes/pinstripe/browser/browser.css b/browser/themes/pinstripe/browser/browser.css index 62c5fd41ce04..707a0bda03f6 100644 --- a/browser/themes/pinstripe/browser/browser.css +++ b/browser/themes/pinstripe/browser/browser.css @@ -88,8 +88,8 @@ #PersonalToolbar { -moz-appearance: none; - margin-top: -1px; /* overlay the bottom border of the toolbar above us */ - padding-top: 0 !important; + margin-top: -2px; /* overlay the bottom border of the toolbar above us */ + padding-top: 1px !important; background-color: -moz-mac-chrome-active; border-bottom: 1px solid rgba(0, 0, 0, 0.57); } @@ -1776,34 +1776,35 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker { background-repeat: repeat-x; } -#TabsToolbar:not(:-moz-lwtheme) { - background-color: -moz-mac-chrome-active; -} - -#TabsToolbar:not(:-moz-lwtheme):-moz-window-inactive { - background-color: -moz-mac-chrome-inactive; -} - #TabsToolbar[tabsontop="false"] { - margin-top: -1px; + margin-top: -2px; padding-top: 2px; } +/* For tabs-on-top, only fill the bottom 2px with the chrome background + * color, so that the borders in tabbar-top-bg-*.png can mix with it. + * In the top 24px the unified toolbar (from the ::before above) will show. + */ #TabsToolbar[tabsontop="true"]:not(:-moz-lwtheme) { padding-bottom: 2px; - background-image: url(chrome://browser/skin/tabbrowser/tabbar-top-bg-active.png) ; + background: url(chrome://browser/skin/tabbrowser/tabbar-top-bg-active.png), + -moz-linear-gradient(bottom, -moz-mac-chrome-active 2px, transparent 2px); } #TabsToolbar[tabsontop="true"]:not(:-moz-lwtheme):-moz-window-inactive { - background-image: url(chrome://browser/skin/tabbrowser/tabbar-top-bg-inactive.png); + background: url(chrome://browser/skin/tabbrowser/tabbar-top-bg-inactive.png), + -moz-linear-gradient(bottom, -moz-mac-chrome-inactive 2px, transparent 2px); } +/* In tabs-on-bottom mode, fill the whole toolbar with the chrome + * background color. + */ #TabsToolbar[tabsontop="false"]:not(:-moz-lwtheme) { - background-image: url(chrome://browser/skin/tabbrowser/tabbar-bottom-bg-active.png); + background: url(chrome://browser/skin/tabbrowser/tabbar-bottom-bg-active.png) -moz-mac-chrome-active; } #TabsToolbar[tabsontop="false"]:not(:-moz-lwtheme):-moz-window-inactive { - background-image: url(chrome://browser/skin/tabbrowser/tabbar-bottom-bg-inactive.png); + background: url(chrome://browser/skin/tabbrowser/tabbar-bottom-bg-inactive.png) -moz-mac-chrome-inactive; } #tabbrowser-tabs { diff --git a/browser/themes/pinstripe/browser/tabbrowser/tabbar-top-bg-active.png b/browser/themes/pinstripe/browser/tabbrowser/tabbar-top-bg-active.png index 0e7f271a5d67058ca678b238595523806ba72ec4..fc7b3497d55e5b665e0308ccab26cae7598887fd 100644 GIT binary patch literal 121 zcmeAS@N?(olHy`uVBq!ia0vp^B0wy~!3HF^H`mkxDF;s%$B>F!Z_jMxWKa+}av|7J zAZLxtRo1(&kK8lr{lL7wH)nB@#9@hJA6`!LsOK^EVO_=*+`RIzNy01x-6?N+|UE&pI3YNJv3dqR;J*vN=M24M>Nu%BF&uuG(c4)$ z>ps^W;G;lQj{qMShLckd@V-J-r}U#|yvy*oNmXy8+G)i|)#RHE;CZASO53Hly#O8< z5mvcCw8$BM`JPIB6|h*u1H-Pg*aCZiXHpR_D!ewuuN%NiGsrqYjzi=WpT8dq;Fo@| pkHuOl)!P;~Qx5nc^+-G=z;9-gn9xjFnM42p002ovPDHLkV1m$;dnNz? diff --git a/browser/themes/pinstripe/browser/tabbrowser/tabbar-top-bg-inactive.png b/browser/themes/pinstripe/browser/tabbrowser/tabbar-top-bg-inactive.png index 0c7a196de516f54cbd1ab19b06d46236c43ad206..c47147cbddb44e5f154c31d372b0de49c44de4db 100644 GIT binary patch literal 118 zcmeAS@N?(olHy`uVBq!ia0vp^B0wy~!3HF^H`mkxDO*n$$B>F!Z!aF?WKiI7zPLhR zMb9j^5J6>-xp6_`*%zL1(+k!Lk*0)|DAzX5P3q%wL3>VOBS_ojN8T=3-ZI8)CBr5FoW_=%r=Kufz07*qoM6N<$f^37SIRF3v From 6397112f91fb16531e074136d414cec4a03f3aea Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Mon, 8 Aug 2011 16:42:45 +0200 Subject: [PATCH 07/30] Bug 672050 - Add Mac rendering for -moz-appearance: toolbarbutton. r=josh --- widget/src/cocoa/nsNativeThemeCocoa.h | 9 +- widget/src/cocoa/nsNativeThemeCocoa.mm | 217 +++++++++++++++---------- widget/src/xpwidgets/nsNativeTheme.cpp | 75 ++++----- widget/src/xpwidgets/nsNativeTheme.h | 29 ++-- 4 files changed, 184 insertions(+), 146 deletions(-) diff --git a/widget/src/cocoa/nsNativeThemeCocoa.h b/widget/src/cocoa/nsNativeThemeCocoa.h index 7efbfb222336..47304c1e4799 100644 --- a/widget/src/cocoa/nsNativeThemeCocoa.h +++ b/widget/src/cocoa/nsNativeThemeCocoa.h @@ -51,6 +51,7 @@ @class CellDrawView; @class NSProgressBarCell; class nsDeviceContext; +struct SegmentedControlRenderSettings; class nsNativeThemeCocoa : private nsNativeTheme, public nsITheme @@ -96,6 +97,9 @@ protected: nsresult GetSystemColor(PRUint8 aWidgetType, nsILookAndFeel::nsColorID& aColorID); nsIntMargin RTLAwareMargin(const nsIntMargin& aMargin, nsIFrame* aFrame); + nsIFrame* SeparatorResponsibility(nsIFrame* aBefore, nsIFrame* aAfter); + CGRect SeparatorAdjustedRect(CGRect aRect, nsIFrame* aLeft, + nsIFrame* aCurrent, nsIFrame* aRight); // Helpers for progressbar. double GetProgressValue(nsIFrame* aFrame); @@ -108,8 +112,9 @@ protected: void DrawProgress(CGContextRef context, const HIRect& inBoxRect, PRBool inIsIndeterminate, PRBool inIsHorizontal, double inValue, double inMaxValue, nsIFrame* aFrame); - void DrawTab(CGContextRef context, HIRect inBoxRect, nsEventStates inState, - nsIFrame* aFrame); + void DrawSegment(CGContextRef cgContext, const HIRect& inBoxRect, + nsEventStates inState, nsIFrame* aFrame, + const SegmentedControlRenderSettings& aSettings); void DrawTabPanel(CGContextRef context, const HIRect& inBoxRect, nsIFrame* aFrame); void DrawScale(CGContextRef context, const HIRect& inBoxRect, nsEventStates inState, PRBool inDirection, diff --git a/widget/src/cocoa/nsNativeThemeCocoa.mm b/widget/src/cocoa/nsNativeThemeCocoa.mm index 36d24010211d..e1cd9d624363 100644 --- a/widget/src/cocoa/nsNativeThemeCocoa.mm +++ b/widget/src/cocoa/nsNativeThemeCocoa.mm @@ -289,6 +289,16 @@ static NSControlSize CocoaSizeForEnum(PRInt32 enumControlSize) { return NSRegularControlSize; } +static NSString* CUIControlSizeForCocoaSize(NSControlSize aControlSize) +{ + if (aControlSize == NSRegularControlSize) + return @"regular"; + else if (aControlSize == NSSmallControlSize) + return @"small"; + else + return @"mini"; +} + static void InflateControlRect(NSRect* rect, NSControlSize cocoaControlSize, const float marginSet[][3][4]) { if (!marginSet) @@ -338,6 +348,15 @@ static BOOL FrameIsInActiveWindow(nsIFrame* aFrame) return [win isMainWindow] && ![win attachedSheet]; } +// Toolbar controls and content controls respond to different window +// activeness states. +static BOOL IsActive(nsIFrame* aFrame, BOOL aIsToolbarControl) +{ + if (aIsToolbarControl) + return [NativeWindowForFrame(aFrame) isMainWindow] || ![NSView focusView]; + return FrameIsInActiveWindow(aFrame); +} + NS_IMPL_ISUPPORTS_INHERITED1(nsNativeThemeCocoa, nsNativeTheme, nsITheme) @@ -574,7 +593,7 @@ struct CellRenderSettings { * tolerance - The tolerance as passed to DrawCellWithSnapping. * NOTE: returns NSRegularControlSize if all values in 'sizes' are zero. */ -static NSControlSize FindControlSize(CGFloat size, CGFloat* sizes, CGFloat tolerance) +static NSControlSize FindControlSize(CGFloat size, const CGFloat* sizes, CGFloat tolerance) { for (PRUint32 i = miniControlSize; i <= regularControlSize; ++i) { if (sizes[i] == 0) { @@ -1344,86 +1363,107 @@ nsNativeThemeCocoa::DrawScale(CGContextRef cgContext, const HIRect& inBoxRect, NS_OBJC_END_TRY_ABORT_BLOCK; } -#define NATURAL_MINI_TAB_BUTTON_HEIGHT 17 -#define NATURAL_SMALL_TAB_BUTTON_HEIGHT 20 -#define NATURAL_REGULAR_TAB_BUTTON_HEIGHT 23 +nsIFrame* +nsNativeThemeCocoa::SeparatorResponsibility(nsIFrame* aBefore, nsIFrame* aAfter) +{ + // Usually a separator is drawn by the segment to the right of the + // separator, but pressed and selected segments have higher priority. + if (!aBefore || !aAfter) + return nsnull; + if (IsSelectedButton(aAfter)) + return aAfter; + if (IsSelectedButton(aBefore) || IsPressedButton(aBefore)) + return aBefore; + return aAfter; +} + +CGRect +nsNativeThemeCocoa::SeparatorAdjustedRect(CGRect aRect, nsIFrame* aLeft, + nsIFrame* aCurrent, nsIFrame* aRight) +{ + // A separator between two segments should always be located in the leftmost + // pixel column of the segment to the right of the separator, regardless of + // who ends up drawing it. + // CoreUI draws the separators inside the drawing rect. + if (aLeft && SeparatorResponsibility(aLeft, aCurrent) == aLeft) { + // The left button draws the separator, so we need to make room for it. + aRect.origin.x += 1; + aRect.size.width -= 1; + } + if (SeparatorResponsibility(aCurrent, aRight) == aCurrent) { + // We draw the right separator, so we need to extend the draw rect into the + // segment to our right. + aRect.size.width += 1; + } + return aRect; +} + +static NSString* ToolbarButtonPosition(BOOL aIsFirst, BOOL aIsLast) +{ + if (aIsFirst) { + if (aIsLast) + return @"kCUISegmentPositionOnly"; + return @"kCUISegmentPositionFirst"; + } + if (aIsLast) + return @"kCUISegmentPositionLast"; + return @"kCUISegmentPositionMiddle"; +} + +struct SegmentedControlRenderSettings { + const CGFloat* heights; + const NSString* widgetName; + const BOOL ignoresPressedWhenSelected; + const BOOL isToolbarControl; +}; + +static const CGFloat tabHeights[3] = { 17, 20, 23 }; + +static const SegmentedControlRenderSettings tabRenderSettings = { + tabHeights, @"tab", YES, NO +}; + +static const CGFloat toolbarButtonHeights[3] = { 15, 18, 22 }; + +static const SegmentedControlRenderSettings toolbarButtonRenderSettings = { + toolbarButtonHeights, @"kCUIWidgetButtonSegmentedSCurve", NO, YES +}; void -nsNativeThemeCocoa::DrawTab(CGContextRef cgContext, HIRect inBoxRect, - nsEventStates inState, nsIFrame* aFrame) +nsNativeThemeCocoa::DrawSegment(CGContextRef cgContext, const HIRect& inBoxRect, + nsEventStates inState, nsIFrame* aFrame, + const SegmentedControlRenderSettings& aSettings) { - NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - - HIThemeTabDrawInfo tdi; - tdi.version = 1; - tdi.kind = kHIThemeTabKindNormal; - - PRBool isSelected = IsSelectedTab(aFrame); - PRBool isDisabled = IsDisabled(aFrame, inState); - - if (isSelected) { - if (isDisabled) - tdi.style = kThemeTabFrontUnavailable; - else - tdi.style = FrameIsInActiveWindow(aFrame) ? kThemeTabFront : kThemeTabFrontInactive; - } else { - if (isDisabled) - tdi.style = kThemeTabNonFrontUnavailable; - else if (inState.HasAllStates(NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_HOVER)) - tdi.style = kThemeTabNonFrontPressed; - else - tdi.style = FrameIsInActiveWindow(aFrame) ? kThemeTabNonFront : kThemeTabNonFrontInactive; + BOOL isActive = IsActive(aFrame, aSettings.isToolbarControl); + BOOL isFocused = inState.HasState(NS_EVENT_STATE_FOCUS); + BOOL isSelected = IsSelectedButton(aFrame); + BOOL isPressed = IsPressedButton(aFrame); + if (isSelected && aSettings.ignoresPressedWhenSelected) { + isPressed = NO; } - tdi.direction = kThemeTabNorth; - tdi.size = kHIThemeTabSizeNormal; - if (inBoxRect.size.height < NATURAL_REGULAR_TAB_BUTTON_HEIGHT) - tdi.size = kHIThemeTabSizeSmall; - if (inBoxRect.size.height < NATURAL_SMALL_TAB_BUTTON_HEIGHT) - tdi.size = kHIThemeTabSizeMini; + BOOL isRTL = IsFrameRTL(aFrame); + nsIFrame* left = GetAdjacentSiblingFrameWithSameAppearance(aFrame, isRTL); + nsIFrame* right = GetAdjacentSiblingFrameWithSameAppearance(aFrame, !isRTL); + CGRect drawRect = SeparatorAdjustedRect(inBoxRect, left, aFrame, right); + BOOL drawLeftSeparator = SeparatorResponsibility(left, aFrame) == aFrame; + BOOL drawRightSeparator = SeparatorResponsibility(aFrame, right) == aFrame; + NSControlSize controlSize = FindControlSize(drawRect.size.height, aSettings.heights, 4.0f); - PRBool isRTL = IsFrameRTL(aFrame); - PRBool isFirst = isRTL ? IsLastTab(aFrame) : IsFirstTab(aFrame); - PRBool isLast = isRTL ? IsFirstTab(aFrame) : IsLastTab(aFrame); - - if (isFirst && isLast) - tdi.position = kHIThemeTabPositionOnly; - else if (isFirst) - tdi.position = kHIThemeTabPositionFirst; - else if (isLast) - tdi.position = kHIThemeTabPositionLast; - else - tdi.position = kHIThemeTabPositionMiddle; - - // Tab separator management: - // Normal tabs only draw their left separator, in the leftmost pixel row of - // their frame. Selected tabs additionally draw their right separator, outside - // of their frame. To prevent overlapping, the tab to the right of the - // selected tab shouldn't draw its left separator. - tdi.adornment = kHIThemeTabAdornmentNone; - if (isRTL ? IsBeforeSelectedTab(aFrame) : IsAfterSelectedTab(aFrame)) { - // On Leopard, the tab's left edge must be shifted 1px to the right. - // On Tiger, this happens automatically when no leading separator is drawn. - inBoxRect.origin.x += 1; - inBoxRect.size.width -= 1; - } - else { - tdi.adornment = kHIThemeTabAdornmentLeadingSeparator; - } - - if (isSelected && !isLast) { - tdi.adornment |= kHIThemeTabAdornmentTrailingSeparator; - // On Tiger, the right separator is drawn outside of the frame. - // On Leopard, the right edge must be shifted 1px to the right. - inBoxRect.size.width += 1; - } - - if (inState.HasState(NS_EVENT_STATE_FOCUS)) - tdi.adornment |= kThemeAdornmentFocus; - - HIThemeDrawTab(&inBoxRect, &tdi, cgContext, HITHEME_ORIENTATION, NULL); - - NS_OBJC_END_TRY_ABORT_BLOCK; + CUIDraw([NSWindow coreUIRenderer], drawRect, cgContext, + (CFDictionaryRef)[NSDictionary dictionaryWithObjectsAndKeys: + aSettings.widgetName, @"widget", + ToolbarButtonPosition(!left, !right), @"kCUIPositionKey", + [NSNumber numberWithBool:drawLeftSeparator], @"kCUISegmentLeadingSeparatorKey", + [NSNumber numberWithBool:drawRightSeparator], @"kCUISegmentTrailingSeparatorKey", + [NSNumber numberWithBool:isSelected], @"value", + (isPressed ? @"pressed" : (isActive ? @"normal" : @"inactive")), @"state", + [NSNumber numberWithBool:isFocused], @"focus", + CUIControlSizeForCocoaSize(controlSize), @"size", + [NSNumber numberWithBool:YES], @"is.flipped", + @"up", @"direction", + nil], + nil); } static inline UInt8 @@ -1629,8 +1669,6 @@ nsNativeThemeCocoa::DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRec if (inBoxRect.size.height < 2.0f) return; - BOOL isMain = [NativeWindowForFrame(aFrame) isMainWindow] || ![NSView focusView]; - CGContextSaveGState(cgContext); CGContextClipToRect(cgContext, inBoxRect); @@ -1645,7 +1683,7 @@ nsNativeThemeCocoa::DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRec (CFDictionaryRef)[NSDictionary dictionaryWithObjectsAndKeys: @"kCUIWidgetWindowFrame", @"widget", @"regularwin", @"windowtype", - (isMain ? @"normal" : @"inactive"), @"state", + (IsActive(aFrame, YES) ? @"normal" : @"inactive"), @"state", [NSNumber numberWithInt:inBoxRect.size.height], @"kCUIWindowFrameBottomBarHeightKey", [NSNumber numberWithBool:YES], @"kCUIWindowFrameDrawBottomBarSeparatorKey", [NSNumber numberWithBool:YES], @"is.flipped", @@ -1860,9 +1898,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext, break; case NS_THEME_TOOLBAR_BUTTON: - DrawButton(cgContext, kThemePushButton, macRect, - IsDefaultButton(aFrame), kThemeButtonOn, kThemeAdornmentNone, - eventState, aFrame); + DrawSegment(cgContext, macRect, eventState, aFrame, toolbarButtonRenderSettings); break; case NS_THEME_TOOLBAR_SEPARATOR: { @@ -2109,7 +2145,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext, break; case NS_THEME_TAB: - DrawTab(cgContext, macRect, eventState, aFrame); + DrawSegment(cgContext, macRect, eventState, aFrame, tabRenderSettings); break; case NS_THEME_TAB_PANELS: @@ -2162,6 +2198,12 @@ nsNativeThemeCocoa::GetWidgetBorder(nsDeviceContext* aContext, break; } + case NS_THEME_TOOLBAR_BUTTON: + { + aResult->SizeTo(4, 1, 4, 1); + break; + } + case NS_THEME_CHECKBOX: case NS_THEME_RADIO: { @@ -2278,6 +2320,7 @@ nsNativeThemeCocoa::GetWidgetOverflow(nsDeviceContext* aContext, nsIFrame* aFram { switch (aWidgetType) { case NS_THEME_BUTTON: + case NS_THEME_TOOLBAR_BUTTON: case NS_THEME_TEXTFIELD: case NS_THEME_TEXTFIELD_MULTILINE: case NS_THEME_SEARCHFIELD: @@ -2328,6 +2371,12 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsRenderingContext* aContext, break; } + case NS_THEME_TOOLBAR_BUTTON: + { + aResult->SizeTo(0, toolbarButtonHeights[miniControlSize]); + break; + } + case NS_THEME_SPINNER: { SInt32 buttonHeight = 0, buttonWidth = 0; @@ -2388,7 +2437,7 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsRenderingContext* aContext, case NS_THEME_TAB: { - aResult->SizeTo(0, NATURAL_MINI_TAB_BUTTON_HEIGHT); + aResult->SizeTo(0, tabHeights[miniControlSize]); break; } @@ -2511,7 +2560,6 @@ nsNativeThemeCocoa::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType, case NS_THEME_TOOLBOX: case NS_THEME_TOOLBAR: case NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR: - case NS_THEME_TOOLBAR_BUTTON: case NS_THEME_SCROLLBAR_TRACK_VERTICAL: case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL: case NS_THEME_STATUSBAR: @@ -2597,6 +2645,7 @@ nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* a case NS_THEME_GROUPBOX: case NS_THEME_BUTTON: case NS_THEME_BUTTON_BEVEL: + case NS_THEME_TOOLBAR_BUTTON: case NS_THEME_SPINNER: case NS_THEME_TOOLBAR: case NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR: diff --git a/widget/src/xpwidgets/nsNativeTheme.cpp b/widget/src/xpwidgets/nsNativeTheme.cpp index 1c493dd95530..0303cd2257cd 100644 --- a/widget/src/xpwidgets/nsNativeTheme.cpp +++ b/widget/src/xpwidgets/nsNativeTheme.cpp @@ -207,6 +207,18 @@ nsNativeTheme::IsButtonTypeMenu(nsIFrame* aFrame) NS_LITERAL_STRING("menu"), eCaseMatters); } +PRBool +nsNativeTheme::IsPressedButton(nsIFrame* aFrame) +{ + nsEventStates eventState = GetContentState(aFrame, NS_THEME_TOOLBAR_BUTTON); + if (IsDisabled(aFrame, eventState)) + return PR_FALSE; + + return IsOpenButton(aFrame) || + eventState.HasAllStates(NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_HOVER); +} + + PRBool nsNativeTheme::GetIndeterminate(nsIFrame* aFrame) { @@ -409,19 +421,6 @@ nsNativeTheme::IsFirstTab(nsIFrame* aFrame) return PR_FALSE; } -PRBool -nsNativeTheme::IsLastTab(nsIFrame* aFrame) -{ - if (!aFrame) - return PR_FALSE; - - while ((aFrame = aFrame->GetNextSibling())) { - if (aFrame->GetRect().width > 0 && aFrame->GetContent()->Tag() == nsWidgetAtoms::tab) - return PR_FALSE; - } - return PR_TRUE; -} - PRBool nsNativeTheme::IsHorizontal(nsIFrame* aFrame) { @@ -433,34 +432,6 @@ nsNativeTheme::IsHorizontal(nsIFrame* aFrame) eCaseMatters); } -PRBool -nsNativeTheme::IsNextToSelectedTab(nsIFrame* aFrame, PRInt32 aOffset) -{ - if (!aFrame) - return PR_FALSE; - - if (aOffset == 0) - return IsSelectedTab(aFrame); - - PRInt32 thisTabIndex = -1, selectedTabIndex = -1; - - nsIFrame* currentTab = aFrame->GetParent()->GetFirstChild(NULL); - for (PRInt32 i = 0; currentTab; currentTab = currentTab->GetNextSibling()) { - if (currentTab->GetRect().width == 0) - continue; - if (aFrame == currentTab) - thisTabIndex = i; - if (IsSelectedTab(currentTab)) - selectedTabIndex = i; - ++i; - } - - if (thisTabIndex == -1 || selectedTabIndex == -1) - return PR_FALSE; - - return (thisTabIndex - selectedTabIndex == aOffset); -} - // progressbar: PRBool nsNativeTheme::IsIndeterminateProgress(nsIFrame* aFrame, @@ -589,3 +560,25 @@ nsNativeTheme::Notify(nsITimer* aTimer) mAnimatedContentTimeout = PR_UINT32_MAX; return NS_OK; } + +nsIFrame* +nsNativeTheme::GetAdjacentSiblingFrameWithSameAppearance(nsIFrame* aFrame, + PRBool aNextSibling) +{ + if (!aFrame) + return nsnull; + + // Find the next visible sibling. + nsIFrame* sibling = aFrame; + do { + sibling = aNextSibling ? sibling->GetNextSibling() : sibling->GetPrevSibling(); + } while (sibling && sibling->GetRect().width == 0); + + // Check same appearance and adjacency. + if (!sibling || + sibling->GetStyleDisplay()->mAppearance != aFrame->GetStyleDisplay()->mAppearance || + (sibling->GetRect().XMost() != aFrame->GetRect().x && + aFrame->GetRect().XMost() != sibling->GetRect().x)) + return nsnull; + return sibling; +} diff --git a/widget/src/xpwidgets/nsNativeTheme.h b/widget/src/xpwidgets/nsNativeTheme.h index 796b0c79cb18..f9143d537e06 100644 --- a/widget/src/xpwidgets/nsNativeTheme.h +++ b/widget/src/xpwidgets/nsNativeTheme.h @@ -122,33 +122,22 @@ class nsNativeTheme : public nsITimerCallback return CheckBooleanAttr(aFrame, nsWidgetAtoms::selected); } - PRBool IsNextToSelectedTab(nsIFrame* aFrame, PRInt32 aOffset); - - PRBool IsBeforeSelectedTab(nsIFrame* aFrame) { - return IsNextToSelectedTab(aFrame, -1); - } - - PRBool IsAfterSelectedTab(nsIFrame* aFrame) { - return IsNextToSelectedTab(aFrame, 1); - } - - PRBool IsLeftToSelectedTab(nsIFrame* aFrame) { - return IsFrameRTL(aFrame) ? IsAfterSelectedTab(aFrame) : IsBeforeSelectedTab(aFrame); - } - - PRBool IsRightToSelectedTab(nsIFrame* aFrame) { - return IsFrameRTL(aFrame) ? IsBeforeSelectedTab(aFrame) : IsAfterSelectedTab(aFrame); - } - // button / toolbarbutton: PRBool IsCheckedButton(nsIFrame* aFrame) { return CheckBooleanAttr(aFrame, nsWidgetAtoms::checked); } + PRBool IsSelectedButton(nsIFrame* aFrame) { + return CheckBooleanAttr(aFrame, nsWidgetAtoms::checked) || + CheckBooleanAttr(aFrame, nsWidgetAtoms::selected); + } + PRBool IsOpenButton(nsIFrame* aFrame) { return CheckBooleanAttr(aFrame, nsWidgetAtoms::open); } + PRBool IsPressedButton(nsIFrame* aFrame); + // treeheadercell: TreeSortDirection GetTreeSortDirection(nsIFrame* aFrame); PRBool IsLastTreeHeaderCell(nsIFrame* aFrame); @@ -156,7 +145,6 @@ class nsNativeTheme : public nsITimerCallback // tab: PRBool IsBottomTab(nsIFrame* aFrame); PRBool IsFirstTab(nsIFrame* aFrame); - PRBool IsLastTab(nsIFrame* aFrame); PRBool IsHorizontal(nsIFrame* aFrame); @@ -187,6 +175,9 @@ class nsNativeTheme : public nsITimerCallback PRBool QueueAnimatedContentForRefresh(nsIContent* aContent, PRUint32 aMinimumFrameRate); + nsIFrame* GetAdjacentSiblingFrameWithSameAppearance(nsIFrame* aFrame, + PRBool aNextSibling); + private: PRUint32 mAnimatedContentTimeout; nsCOMPtr mAnimatedContentTimer; From c88a69004448eb9efa99c2b973f03d68c5ff0dd1 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Mon, 8 Aug 2011 16:42:54 +0200 Subject: [PATCH 08/30] Bug 672050 - Inherit the open attribute on toolbarbutton[type=menu-button] dropmarkers. r=dao --- toolkit/content/widgets/toolbarbutton.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/content/widgets/toolbarbutton.xml b/toolkit/content/widgets/toolbarbutton.xml index 4e939bab1451..9746c06ab38a 100644 --- a/toolkit/content/widgets/toolbarbutton.xml +++ b/toolkit/content/widgets/toolbarbutton.xml @@ -66,7 +66,7 @@ xbl:inherits="disabled,crop,image,label,accesskey,command, align,dir,pack,orient"/> + xbl:inherits="align,dir,pack,orient,disabled,label,open"/> From b55ecb091a4818a3ba882fd71f2ab50b6bd9e0e6 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Mon, 8 Aug 2011 16:43:04 +0200 Subject: [PATCH 09/30] Bug 667480 - Use -moz-appearance: toolbarbutton throughout the Mac theme. r=dao --- browser/base/content/browser.xul | 2 +- .../themes/pinstripe/browser/Toolbar-lion.png | Bin 0 -> 6479 bytes browser/themes/pinstripe/browser/browser.css | 112 +++++++++--------- browser/themes/pinstripe/browser/jar.mn | 6 + .../pinstripe/browser/keyhole-circle-lion.png | Bin 0 -> 2261 bytes .../pinstripe/browser/keyhole-circle.png | Bin 0 -> 2262 bytes .../pinstripe/browser/places/organizer.css | 35 +----- .../pinstripe/global/console/console.css | 19 +-- toolkit/themes/pinstripe/global/shared.inc | 5 - .../themes/pinstripe/global/toolbarbutton.css | 8 +- .../themes/pinstripe/global/viewbuttons.css | 68 +---------- .../pinstripe/mozapps/downloads/downloads.css | 28 +---- .../pinstripe/mozapps/update/updates.css | 29 +---- 13 files changed, 78 insertions(+), 234 deletions(-) create mode 100644 browser/themes/pinstripe/browser/Toolbar-lion.png create mode 100644 browser/themes/pinstripe/browser/keyhole-circle-lion.png create mode 100644 browser/themes/pinstripe/browser/keyhole-circle.png diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index a278874bd4dc..430861e2982f 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -1008,7 +1008,7 @@ - + diff --git a/browser/themes/pinstripe/browser/Toolbar-lion.png b/browser/themes/pinstripe/browser/Toolbar-lion.png new file mode 100644 index 0000000000000000000000000000000000000000..a65aa30ebae6c314bccd897862be400e27c7afab GIT binary patch literal 6479 zcmY*;Wl$SH*DhY5I7N#VD^5yrcP$X0xD_p=5Zoa^C@#gJxNFf;+#LcGcZX2iCFsZd zes}KN`^@Z~GqbZZXCL{s;TmcRxY(4~NJvPyN{X_YNJz-AmtGVT?PZq|kj{B2SdNPN zE=WkPiT|^Zk$z^7BOy^BE6GY}doCUsV;O1b&O#J{OU>HLdfj+fhM2W1hd%S~2qdK> zNh3EKf4i0Dlk~cU%=+6GZ)q-lh)G%$4vSgL$+WXCNB!fT@kdxK^23!&$)<*6IA&MY zNo&fFRz~hF1mD!&$^FVRB9QwebNTAwMC@jDATAH{|Kh2mYj#fUY;D*_el%9iyg~*l zgUUBs5mVn|qn1N@FH_&UAGnc5g^P+^fy>=^0P{>DmIV90&@&Pk+2cuSO8oE#yJf2bp-$~&GYWaQFl zo${rKg_f^X!0H^vcjw{CxvOErCD39Q%5{G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6;|cqEIbs5NF^(Ai6*wyw;dI1Y?vn{Hb! zPuwhxCK~e8Z^HjGKs6N)d^{@NO{Sh;sP_TU*U({R{cD8J0lI4=?F4Jv-MtS^rBUGF_G)>hFeOPdB{Nv| zRnNh10OYH=^2>!|xBBX2k_!a|SfRkce%}LyVZ-JBW+M;)nO!xlibmAkzT{#*X2^N` z*Cm@4*+uBlu#PcxaWsNg&A{#d3B;Y9`IFv=rg|lH3Hmdq)BmOcW-vI}|1h+uFq`@k z91knh?O*lPsU#ORcKVV>7JTey?`6j#5c%q=Sp5$*gbQXc+98_%x)Sw8Gebq%lojs5Z8jNXzxi{lKki~0FbO!>)W8fRd(P1o_{ZW z5h+bC&F978Ii$%eFfoCN_wd+%J7u8AjuE(TxL@>#`2Wh hetN0vEd9^O&)D1@xrQ4zFFzzmN^)wlmC|NG{{t$Is#O30 literal 0 HcmV?d00001 diff --git a/browser/themes/pinstripe/browser/browser.css b/browser/themes/pinstripe/browser/browser.css index 707a0bda03f6..69b707f03d94 100644 --- a/browser/themes/pinstripe/browser/browser.css +++ b/browser/themes/pinstripe/browser/browser.css @@ -293,21 +293,22 @@ toolbarbutton.bookmark-item > menupopup { .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker, #restore-button { -moz-box-orient: vertical; - padding: 0 3px; + -moz-appearance: toolbarbutton; height: 22px; - border: 1px solid @toolbarbuttonBorderColor@; - border-radius: @toolbarbuttonCornerRadius@; - box-shadow: 0 1px rgba(255, 255, 255, 0.2); - background: @toolbarbuttonBackground@; - background-origin: border-box; + padding: 0; + border: 0; } .toolbarbutton-1:not([type="menu-button"]):-moz-lwtheme, .toolbarbutton-1 > .toolbarbutton-menubutton-button:-moz-lwtheme, .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker:-moz-lwtheme, #restore-button:-moz-lwtheme { - border-color: rgba(0, 0, 0, 0.4); - background-image: -moz-linear-gradient(rgba(255,255,255,0.5), rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.2)); + -moz-appearance: none; + padding: 0 3px; + border: 1px solid rgba(0, 0, 0, 0.4); + border-radius: @toolbarbuttonCornerRadius@; + background: -moz-linear-gradient(rgba(255,255,255,0.5), rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.2)) repeat-x; + background-origin: border-box; box-shadow: inset 0 1px rgba(255,255,255,0.3), 0 1px rgba(255,255,255,0.2); } @@ -337,6 +338,7 @@ toolbar:not([mode="icons"]) .toolbarbutton-1:not([type="menu-button"]), toolbar:not([mode="icons"]) .toolbarbutton-1 > .toolbarbutton-menubutton-button, toolbar:not([mode="icons"]) .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker, toolbar:not([mode="icons"]) #restore-button { + -moz-appearance: none; padding: 0; height: auto; border: none; @@ -408,16 +410,6 @@ toolbar:not([mode="icons"]) .toolbarbutton-1:not([open="true"]) > .toolbarbutton margin: 2px 0 0; } -toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not([disabled="true"]):active:hover:not(:-moz-lwtheme), -toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"])[open="true"]:not(:-moz-lwtheme), -toolbar[mode="icons"] .toolbarbutton-1:not([disabled="true"]) > .toolbarbutton-menubutton-button:active:hover:not(:-moz-lwtheme), -toolbar[mode="icons"] .toolbarbutton-1[open="true"] > .toolbarbutton-menubutton-dropmarker:not(:-moz-lwtheme), -toolbar[mode="icons"] #restore-button:not([disabled="true"]):active:hover:not(:-moz-lwtheme) { - background: @toolbarbuttonPressedBackgroundColor@; - text-shadow: @loweredShadow@; - box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@; -} - toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not([disabled="true"]):active:hover:-moz-lwtheme, toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"])[open="true"]:-moz-lwtheme, toolbar[mode="icons"] .toolbarbutton-1:not([disabled="true"]) > .toolbarbutton-menubutton-button:active:hover:-moz-lwtheme, @@ -428,39 +420,16 @@ toolbar[mode="icons"] #restore-button:not([disabled="true"]):active:hover:-moz-l box-shadow: inset 0 2px 5px rgba(0,0,0,0.6), 0 1px rgba(255,255,255,0.2); } -toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not(#fullscreen-button)[checked="true"]:not(:-moz-lwtheme) { - background: #606060; - box-shadow: inset #2A2A2A 0 3px 3.5px, @loweredShadow@; -} - toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not(#fullscreen-button)[checked="true"]:-moz-lwtheme { background-color: rgba(0,0,0,0.4); box-shadow: inset 0 2px 5px rgba(0,0,0,0.7), 0 1px rgba(255,255,255,0.2); } -toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not(#fullscreen-button)[checked="true"]:not([disabled="true"]):active:hover:not(:-moz-lwtheme) { - background: #4E4E4E; - box-shadow: inset #1c1c1c 0 3px 3.5px; -} - toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not(#fullscreen-button)[checked="true"]:not([disabled="true"]):active:hover:-moz-lwtheme { background-color: rgba(0, 0, 0, 0.6); box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.8), 0 1px rgba(255, 255, 255, 0.2); } -toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):-moz-window-inactive:not(:-moz-lwtheme), -toolbar[mode="icons"] .toolbarbutton-1 > .toolbarbutton-menubutton-button:-moz-window-inactive:not(:-moz-lwtheme), -toolbar[mode="icons"] .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker:-moz-window-inactive:not(:-moz-lwtheme), -toolbar[mode="icons"] #restore-button:-moz-window-inactive:not(:-moz-lwtheme) { - border-color: @toolbarbuttonInactiveBorderColor@; - background-image: @toolbarbuttonInactiveBackgroundImage@; -} - -toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not(#fullscreen-button)[checked="true"]:-moz-window-inactive { - background: #8E8E8E; - box-shadow: inset rgba(0, 0, 0, 0.5) 0 3px 3.5px, @loweredShadow@; -} - toolbar[mode="icons"] .toolbarbutton-1 > menupopup { margin-top: 1px; } @@ -477,17 +446,28 @@ toolbar[mode="icons"] .toolbarbutton-1 > menupopup { } #back-button, -toolbar:not([mode="icons"]) #forward-button:-moz-locale-dir(rtl) { +#forward-button:-moz-locale-dir(rtl), +toolbar[mode="icons"] #back-button:-moz-locale-dir(rtl):-moz-lwtheme { -moz-image-region: rect(0, 40px, 20px, 20px); } #forward-button, -toolbar:not([mode="icons"]) #back-button:-moz-locale-dir(rtl) { +#back-button:-moz-locale-dir(rtl), +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button:-moz-locale-dir(rtl), +toolbar[mode="icons"] #forward-button:-moz-locale-dir(rtl):-moz-lwtheme { -moz-image-region: rect(0, 60px, 20px, 40px); } +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button:-moz-locale-dir(rtl), +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button:-moz-locale-dir(rtl), +toolbar[mode="icons"] #back-button:-moz-locale-dir(rtl):-moz-lwtheme, +toolbar[mode="icons"] #forward-button:-moz-locale-dir(rtl):-moz-lwtheme { + -moz-transform: scaleX(-1); +} + #navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button { - -moz-margin-end: -5px; + -moz-appearance: none; + -moz-margin-end: -7px; position: relative; z-index: 1; -moz-image-region: rect(0, 20px, 20px, 0); @@ -497,31 +477,45 @@ toolbar:not([mode="icons"]) #back-button:-moz-locale-dir(rtl) { border-radius: 10000px; } -toolbar[mode="icons"] #back-button:-moz-locale-dir(rtl), -toolbar[mode="icons"] #forward-button:-moz-locale-dir(rtl) { - -moz-transform: scaleX(-1); +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button:not(:-moz-lwtheme) { + height: 31px; + padding: 4px 5px 5px 3px; + margin-bottom: -1px; + background: url(chrome://browser/skin/keyhole-circle.png) 0 0 no-repeat; +} + +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button:-moz-window-inactive:not(:-moz-lwtheme) { + background-position: -60px 0; +} + +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button:not([disabled="true"]):active:hover:not(:-moz-lwtheme), +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button[open="true"]:not(:-moz-lwtheme) { + background-position: -30px 0; } toolbar[mode="icons"] #forward-button { -moz-margin-start: 0; } -#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button { - /* 1px to the right */ - padding-left: 4px; - padding-right: 2px; +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button > .toolbarbutton-icon { + /* shift the icon away from the back button */ + margin-left: 3px; + margin-right: -1px; } -#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button:-moz-lwtheme { +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button { mask: url(chrome://browser/content/browser.xul#pinstripe-keyhole-forward-mask); } #navigator-toolbox[iconsize="small"][mode="icons"] > #nav-bar #forward-button { width: 27px; +} + +#navigator-toolbox[iconsize="small"][mode="icons"] > #nav-bar #forward-button:-moz-lwtheme { padding-left: 2px; } -toolbar[mode="icons"] #forward-button { +toolbar[mode="icons"] #forward-button:-moz-lwtheme { border-top-left-radius: 0; border-bottom-left-radius: 0; } @@ -529,6 +523,9 @@ toolbar[mode="icons"] #forward-button { #navigator-toolbox[iconsize="small"][mode="icons"] > #nav-bar #back-button { -moz-margin-end: 0; width: 26px; +} + +#navigator-toolbox[iconsize="small"][mode="icons"] > #nav-bar #back-button:-moz-lwtheme { padding-right: 2px; border-right-width: 0; border-top-right-radius: 0; @@ -1956,11 +1953,12 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker { :-moz-any(#TabsToolbar, #addon-bar) .toolbarbutton-1, :-moz-any(#TabsToolbar, #addon-bar) .toolbarbutton-1 > .toolbarbutton-menubutton-button, :-moz-any(#TabsToolbar, #addon-bar) .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker { - margin: 0; - padding: 0; - border: none; - border-radius: 0; + -moz-appearance: none; /* !important flags needed because of bug 561154: */ + margin: 0 !important; + padding: 0 !important; + border: none !important; + border-radius: 0 !important; background: none !important; box-shadow: none !important; } diff --git a/browser/themes/pinstripe/browser/jar.mn b/browser/themes/pinstripe/browser/jar.mn index d1952b88f933..6c982967e16d 100644 --- a/browser/themes/pinstripe/browser/jar.mn +++ b/browser/themes/pinstripe/browser/jar.mn @@ -42,6 +42,7 @@ browser.jar: skin/classic/browser/section_collapsed-rtl.png skin/classic/browser/section_expanded.png skin/classic/browser/Secure-Glyph-White.png + skin/classic/browser/keyhole-circle.png skin/classic/browser/Toolbar.png skin/classic/browser/toolbarbutton-dropmarker.png skin/classic/browser/urlbar-arrow.png @@ -134,3 +135,8 @@ browser.jar: skin/classic/browser/syncCommon.css skin/classic/browser/syncQuota.css #endif + skin/classic/browser/lion/keyhole-circle.png (keyhole-circle-lion.png) + skin/classic/browser/lion/Toolbar.png (Toolbar-lion.png) + +% override chrome://browser/skin/keyhole-circle.png chrome://browser/skin/lion/keyhole-circle.png os=Darwin osversion>=10.7 +% override chrome://browser/skin/Toolbar.png chrome://browser/skin/lion/Toolbar.png os=Darwin osversion>=10.7 diff --git a/browser/themes/pinstripe/browser/keyhole-circle-lion.png b/browser/themes/pinstripe/browser/keyhole-circle-lion.png new file mode 100644 index 0000000000000000000000000000000000000000..f164d498c351e2541fadcbfb9b1e7a8334a7e581 GIT binary patch literal 2261 zcmV;`2rBo9P)h%KvV)G3Kc3CL=okdq``t35>qGGxr{Gye4G26%ig;WLvi9uJQJj@ z^)%A?&iZHVwf0(vV5M1TMGKOMBMhK|9Of~DDU`9keG}GzjVLUHAOQHNqKqO6@RmPF zmi>0n)z$su%)zG3DLZLK0Jl__zc~BO+@B}L&SMM)u8 zkmKvHVKfc2{bI|vHYP%0Vo1Pa6}?#fIQxe$PflVEm9<6p-oESctq0nZ?eL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#NW%Bv7xW6^ z#%Xce$H#7Z5X!H8n#!M|U?-SU~1@)A4JYxIdJCE3s4pE%(BJNIbPY^dw%S>EEoKeykZ#zckTm|(O-cdo` z$LK|rG@h&Nvi=6&>9U@y747L%q7(lTWIE0n_x$*{lPYs}*Or24YZjeyW%SU!ql~<> z5N+L3P=35+XLdGLpSWp>^0FYt}J;mU0IQ_FOHRRnv%)z)YQapSbO?N03iBG~Jz9GzO$ zYKcy2JA~tOgDj-J!ZU^Bah&dqQkz7Vwb~KeEH2l!S{}fAS}o<;X0gzkVxGKsn{eaM zP+OxBnj5D!GfmhAc`<~WBIYNgZ8GiT4pH}}q_h|hR_|xiphWSFLb!^!bXFlVk6GR8dl6=&=8c z+3B#?7%EEcel+D`3%{{tiQUoofjThu4O5~E3LlznRgb-(wm|}{nRtc}sq}Y2OSLRpgHI{qujK)%>ugt&q@zhu$ zZ7j`Hea5EHxpjqB^or1xIW@<3B~tJio2kN5O#9gc{$qi=WD;G3Io_U%1GK6#d`HMg zJAhQg+at^p-7eW!;IuzWv25VQ1Lw6Dhqa?!n2vVz;xNq~U}uPR)%NWTJ6poouc`iu zsZ*$>u1rnZcla7%?9P_k8{D-#E%x2w5UDbxGt~5@RchP8?dEs$J2-aWSW33-i50Uj~d$8wNVJE?oC!ffbiCxjgFgBPE z=0n+NV`7(F`Q#HU!93AyvGcK{ZcSQBj4G@tsAt{ay1}5Hu%;MQT1wp-ik&}KZ13v& z toolbarbutton { list-style-image: url("chrome://browser/skin/places/toolbar.png"); margin: 4px 4px 5px; - padding: 1px 3px; - border: 1px solid @toolbarbuttonBorderColor@; - border-radius: @toolbarbuttonCornerRadius@; - box-shadow: @loweredShadow@; - background: @toolbarbuttonBackground@; - background-origin: border-box; -} - -#placesToolbar > toolbarbutton:not([disabled="true"]):active:hover, -#placesToolbar > toolbarbutton[open="true"] { - background: @toolbarbuttonPressedBackgroundColor@; - text-shadow: @loweredShadow@; - box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@; -} - -#placesToolbar > toolbarbutton:-moz-focusring { - border-color: @toolbarbuttonFocusedBorderColorAqua@; - box-shadow: @focusRingShadow@; -} - -#placesToolbar > toolbarbutton:-moz-system-metric(mac-graphite-theme):-moz-focusring { - border-color: @toolbarbuttonFocusedBorderColorGraphite@; -} - -#placesToolbar > toolbarbutton:-moz-window-inactive { - border-color: @toolbarbuttonInactiveBorderColor@; - background-image: @toolbarbuttonInactiveBackgroundImage@; + padding: 0; + height: 22px; + -moz-appearance: toolbarbutton; } #placesToolbar > toolbarbutton[disabled="true"] > .toolbarbutton-icon { @@ -136,17 +112,12 @@ #back-button:-moz-locale-dir(ltr), #forward-button:-moz-locale-dir(rtl) { -moz-image-region: rect(0px, 16px, 16px, 0px); - border-top-right-radius: 0; - border-bottom-right-radius: 0; margin-right: 0; - border-right: 0; } #forward-button:-moz-locale-dir(ltr), #back-button:-moz-locale-dir(rtl) { -moz-image-region: rect(0px, 32px, 16px, 16px); - border-top-left-radius: 0; - border-bottom-left-radius: 0; margin-left: 0; } diff --git a/toolkit/themes/pinstripe/global/console/console.css b/toolkit/themes/pinstripe/global/console/console.css index 81aa306b44c0..0d45266c2e44 100644 --- a/toolkit/themes/pinstripe/global/console/console.css +++ b/toolkit/themes/pinstripe/global/console/console.css @@ -203,24 +203,9 @@ toolbarseparator { #Console\:clear { -moz-box-orient: vertical; -moz-box-align: center; + -moz-appearance: toolbarbutton; font: menu; text-shadow: @loweredShadow@; margin: 4px 0 9px; - padding: 0 4px; - border: 1px solid @toolbarbuttonBorderColor@; - border-radius: @toolbarbuttonCornerRadius@; - box-shadow: @loweredShadow@; - background: @toolbarbuttonBackground@; - background-origin: border-box; -} - -#Console\:clear:active:hover { - background: @toolbarbuttonPressedBackgroundColor@; - text-shadow: @loweredShadow@; - box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@; -} - -#Console\:clear:-moz-window-inactive { - border-color: @toolbarbuttonInactiveBorderColor@; - background-image: @toolbarbuttonInactiveBackgroundImage@; + padding: 0 1px; } diff --git a/toolkit/themes/pinstripe/global/shared.inc b/toolkit/themes/pinstripe/global/shared.inc index e57d9c3e6b2a..50b5761aba52 100644 --- a/toolkit/themes/pinstripe/global/shared.inc +++ b/toolkit/themes/pinstripe/global/shared.inc @@ -24,12 +24,7 @@ %define sidebarItemInactiveBorderTop 1px solid #979797 %define sidebarItemInactiveBackground -moz-linear-gradient(top, #B4B4B4, #8A8A8A) repeat-x -%define toolbarbuttonBorderColor rgba(59, 59, 59, 0.9) %define toolbarbuttonCornerRadius 3px %define toolbarbuttonBackground -moz-linear-gradient(top, #FFF, #ADADAD) repeat-x -%define toolbarbuttonFocusedBorderColorAqua rgba(102, 122, 155, 0.9) -%define toolbarbuttonFocusedBorderColorGraphite rgba(59, 59, 59, 0.7) %define toolbarbuttonPressedInnerShadow inset rgba(0, 0, 0, 0.3) 0 -6px 10px, inset #000 0 1px 3px, inset rgba(0, 0, 0, 0.2) 0 1px 3px -%define toolbarbuttonPressedBackgroundColor #B5B5B5 %define toolbarbuttonInactiveBorderColor rgba(146, 146, 146, 0.84) -%define toolbarbuttonInactiveBackgroundImage -moz-linear-gradient(top, #FFF, #CCC) diff --git a/toolkit/themes/pinstripe/global/toolbarbutton.css b/toolkit/themes/pinstripe/global/toolbarbutton.css index a5e18bbfb15e..9cd726ef231f 100644 --- a/toolkit/themes/pinstripe/global/toolbarbutton.css +++ b/toolkit/themes/pinstripe/global/toolbarbutton.css @@ -86,13 +86,15 @@ toolbarbutton[checked="true"] { border: none !important; background-color: transparent !important; list-style-image: url("chrome://global/skin/arrow/arrow-dn.png"); - padding: 0 0 0 2px; + padding: 0; + -moz-padding-start: 2px; width: auto; } .toolbarbutton-menu-dropmarker[disabled="true"] { list-style-image: url("chrome://global/skin/arrow/arrow-dn-dis.png"); - padding: 0 0 0 2px !important; + padding: 0; + -moz-padding-start: 2px; } /* ::::: toolbarbutton menu-button ::::: */ @@ -122,7 +124,7 @@ toolbarbutton[type="menu-button"][disabled="true"]:hover:active { /* .......... dropmarker .......... */ .toolbarbutton-menubutton-dropmarker { - -moz-appearance: none !important; + -moz-appearance: none; border: none; background-color: transparent !important; list-style-image: url("chrome://global/skin/arrow/arrow-dn.png"); diff --git a/toolkit/themes/pinstripe/global/viewbuttons.css b/toolkit/themes/pinstripe/global/viewbuttons.css index 7601582d56fa..3c67ca89de75 100644 --- a/toolkit/themes/pinstripe/global/viewbuttons.css +++ b/toolkit/themes/pinstripe/global/viewbuttons.css @@ -46,10 +46,6 @@ } #viewGroup { - background-color: rgba(0, 0, 0, 0.55); - padding: 1px; - border-radius: @toolbarbuttonCornerRadius@; - box-shadow: @loweredShadow@; margin: 4px 0 9px; } @@ -57,74 +53,16 @@ #viewGroup > toolbarbutton { -moz-box-orient: vertical; -moz-box-align: center; - -moz-appearance: none; + -moz-appearance: toolbarbutton; font: menu; text-shadow: @loweredShadow@; margin: 0; - padding: 0 4px; - border: none; - border-left: 1px solid rgba(0, 0, 0, 0.8); - background: @toolbarbuttonBackground@; -} - -#viewGroup > radio:active:hover, -#viewGroup > toolbarbutton:active:hover { - background: @toolbarbuttonPressedBackgroundColor@; - text-shadow: @loweredShadow@; - box-shadow: @toolbarbuttonPressedInnerShadow@; + padding: 0 1px; + height: 22px; } #viewGroup > radio[selected=true], #viewGroup > toolbarbutton[checked=true] { color: #FFF !important; text-shadow: rgba(0, 0, 0, 0.4) 0 1px; - background: #606060; - box-shadow: inset #2A2A2A 0 3px 3.5px; -} - -#viewGroup > radio[selected=true]:active:hover, -#viewGroup > toolbarbutton[checked=true]:active:hover { - background-color: #4E4E4E; - box-shadow: inset #1c1c1c 0 3px 3.5px; -} - -#viewGroup:-moz-window-inactive { - background-color: rgba(0, 0, 0, 0.25); -} - -#viewGroup > radio:-moz-window-inactive, -#viewGroup > toolbarbutton:-moz-window-inactive { - border-color: rgba(0, 0, 0, 0.4); - background-image: @toolbarbuttonInactiveBackgroundImage@; -} - -#viewGroup > radio[selected=true]:-moz-window-inactive, -#viewGroup > toolbarbutton[checked=true]:-moz-window-inactive { - background: #8E8E8E; - box-shadow: inset rgba(0, 0, 0, 0.5) 0 3px 3.5px; -} - -#viewGroup > radio:-moz-locale-dir(ltr):first-child, -#viewGroup > radio:-moz-locale-dir(ltr)[first-visible], -#viewGroup > radio:-moz-locale-dir(rtl):last-child, -#viewGroup > radio:-moz-locale-dir(rtl)[last-visible], -#viewGroup > toolbarbutton:-moz-locale-dir(ltr):first-child, -#viewGroup > toolbarbutton:-moz-locale-dir(ltr)[first-visible], -#viewGroup > toolbarbutton:-moz-locale-dir(rtl):last-child, -#viewGroup > toolbarbutton:-moz-locale-dir(rtl)[last-visible] { - border-top-left-radius: 2px; - border-bottom-left-radius: 2px; - border-left: none !important; -} - -#viewGroup > radio:-moz-locale-dir(ltr):last-child, -#viewGroup > radio:-moz-locale-dir(ltr)[last-visible], -#viewGroup > radio:-moz-locale-dir(rtl):first-child, -#viewGroup > radio:-moz-locale-dir(rtl)[first-visible], -#viewGroup > toolbarbutton:-moz-locale-dir(ltr):last-child, -#viewGroup > toolbarbutton:-moz-locale-dir(ltr)[last-visible], -#viewGroup > toolbarbutton:-moz-locale-dir(rtl):first-child, -#viewGroup > toolbarbutton:-moz-locale-dir(rtl)[first-visible] { - border-top-right-radius: 2px; - border-bottom-right-radius: 2px; } diff --git a/toolkit/themes/pinstripe/mozapps/downloads/downloads.css b/toolkit/themes/pinstripe/mozapps/downloads/downloads.css index 0b783b573788..0ba68922d72a 100644 --- a/toolkit/themes/pinstripe/mozapps/downloads/downloads.css +++ b/toolkit/themes/pinstripe/mozapps/downloads/downloads.css @@ -111,35 +111,9 @@ richlistitem[type="download"] button { } #clearListButton { - -moz-appearance: none; + -moz-appearance: toolbarbutton; min-height: 18px; min-width: 0; margin: 0 6px; - padding: 0 2px; text-shadow: @loweredShadow@; - border: 1px solid @toolbarbuttonBorderColor@; - border-radius: @toolbarbuttonCornerRadius@; - box-shadow: @loweredShadow@; - background: @toolbarbuttonBackground@; - background-origin: border-box; -} - -#clearListButton:hover:active:not([disabled="true"]) { - background: @toolbarbuttonPressedBackgroundColor@; - text-shadow: @loweredShadow@; - box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@; -} - -#clearListButton:-moz-focusring { - border-color: @toolbarbuttonFocusedBorderColorAqua@; - box-shadow: @focusRingShadow@; -} - -#clearListButton:-moz-system-metric(mac-graphite-theme):-moz-focusring { - border-color: @toolbarbuttonFocusedBorderColorGraphite@; -} - -#clearListButton:-moz-window-inactive { - border-color: @toolbarbuttonInactiveBorderColor@; - background-image: @toolbarbuttonInactiveBackgroundImage@; } diff --git a/toolkit/themes/pinstripe/mozapps/update/updates.css b/toolkit/themes/pinstripe/mozapps/update/updates.css index 9065c8e7b60f..6010e30f454d 100644 --- a/toolkit/themes/pinstripe/mozapps/update/updates.css +++ b/toolkit/themes/pinstripe/mozapps/update/updates.css @@ -39,36 +39,11 @@ wizardpage { } .wizard-buttons button { - -moz-appearance: none; + -moz-appearance: toolbarbutton; min-height: 22px; margin: 0 6px; - padding: 0 2px; + padding: 0; text-shadow: @loweredShadow@; - border: 1px solid @toolbarbuttonBorderColor@; - border-radius: @toolbarbuttonCornerRadius@; - box-shadow: @loweredShadow@; - background: @toolbarbuttonBackground@; - background-origin: border-box; -} - -.wizard-buttons button:hover:active:not([disabled="true"]) { - background: @toolbarbuttonPressedBackgroundColor@; - text-shadow: @loweredShadow@; - box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@; -} - -.wizard-buttons button:-moz-focusring { - border-color: @toolbarbuttonFocusedBorderColorAqua@; - box-shadow: @focusRingShadow@; -} - -.wizard-buttons button:-moz-system-metric(mac-graphite-theme):-moz-focusring { - border-color: @toolbarbuttonFocusedBorderColorGraphite@; -} - -.wizard-buttons button:-moz-window-inactive { - border-color: @toolbarbuttonInactiveBorderColor@; - background-image: @toolbarbuttonInactiveBackgroundImage@; } .loadingBox { From cae92c2b8ff43a96df91cda6a99282e3b9e876ff Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Mon, 8 Aug 2011 16:43:13 +0200 Subject: [PATCH 10/30] Bug 675208 - Use NSTrackingArea for mouse event targeting. r=josh --- widget/src/cocoa/nsChildView.h | 8 +- widget/src/cocoa/nsChildView.mm | 160 +++++++---------------- widget/src/cocoa/nsCocoaWindow.h | 8 ++ widget/src/cocoa/nsCocoaWindow.mm | 155 +++++++++------------- widget/src/cocoa/nsToolkit.h | 1 - widget/src/cocoa/nsToolkit.mm | 23 ---- widget/tests/native_mouse_mac_window.xul | 126 +++++++++--------- 7 files changed, 182 insertions(+), 299 deletions(-) diff --git a/widget/src/cocoa/nsChildView.h b/widget/src/cocoa/nsChildView.h index 91e0fb47639b..d6f107f3a7b6 100644 --- a/widget/src/cocoa/nsChildView.h +++ b/widget/src/cocoa/nsChildView.h @@ -294,16 +294,16 @@ public: static void MouseMoved(NSEvent* aEvent); static void OnDestroyView(ChildView* aView); + static void OnDestroyWindow(NSWindow* aWindow); static BOOL WindowAcceptsEvent(NSWindow* aWindow, NSEvent* aEvent, ChildView* aView, BOOL isClickThrough = NO); + static void MouseExitedWindow(NSEvent* aEvent); + static void MouseEnteredWindow(NSEvent* aEvent); static void ReEvaluateMouseEnterState(NSEvent* aEvent = nil); static ChildView* ViewForEvent(NSEvent* aEvent); static ChildView* sLastMouseEventView; - -private: - - static NSWindow* WindowForEvent(NSEvent* aEvent); + static NSWindow* sWindowUnderMouse; }; //------------------------------------------------------------------------- diff --git a/widget/src/cocoa/nsChildView.mm b/widget/src/cocoa/nsChildView.mm index e38119fe4b7e..2ea8b3e55797 100644 --- a/widget/src/cocoa/nsChildView.mm +++ b/widget/src/cocoa/nsChildView.mm @@ -112,14 +112,6 @@ extern "C" { CG_EXTERN void CGContextResetCTM(CGContextRef); CG_EXTERN void CGContextSetCTM(CGContextRef, CGAffineTransform); CG_EXTERN void CGContextResetClip(CGContextRef); - - // CGSPrivate.h - typedef NSInteger CGSConnection; - typedef NSInteger CGSWindow; - extern CGSConnection _CGSDefaultConnection(); - extern CGError CGSGetScreenRectForWindow(const CGSConnection cid, CGSWindow wid, CGRect *outRect); - extern CGError CGSGetWindowLevel(const CGSConnection cid, CGSWindow wid, CGWindowLevel *level); - extern CGError CGSGetWindowAlpha(const CGSConnection cid, const CGSWindow wid, float* alpha); } // defined in nsMenuBarX.mm @@ -133,6 +125,7 @@ PRBool gChildViewMethodsSwizzled = PR_FALSE; extern nsISupportsArray *gDraggedTransferables; ChildView* ChildViewMouseTracker::sLastMouseEventView = nil; +NSWindow* ChildViewMouseTracker::sWindowUnderMouse = nil; #ifdef INVALIDATE_DEBUGGING static void blinkRect(Rect* r); @@ -1236,6 +1229,24 @@ nsresult nsChildView::SynthesizeNativeMouseEvent(nsIntPoint aPoint, if (!event) return NS_ERROR_FAILURE; + if ([[mView window] isKindOfClass:[BaseWindow class]]) { + // Tracking area events don't end up in their tracking areas when sent + // through [NSApp sendEvent:], so pass them directly to the right methods. + BaseWindow* window = (BaseWindow*)[mView window]; + if (aNativeMessage == NSMouseEntered) { + [window mouseEntered:event]; + return NS_OK; + } + if (aNativeMessage == NSMouseExited) { + [window mouseExited:event]; + return NS_OK; + } + if (aNativeMessage == NSMouseMoved) { + [window mouseMoved:event]; + return NS_OK; + } + } + [NSApp sendEvent:event]; return NS_OK; @@ -3234,11 +3245,6 @@ NSEvent* gLastDragMouseDownEvent = nil; mGeckoChild->DispatchEvent(&event, status); } -- (void)mouseMoved:(NSEvent*)aEvent -{ - ChildViewMouseTracker::MouseMoved(aEvent); -} - - (void)handleMouseMoved:(NSEvent*)theEvent { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; @@ -4756,8 +4762,33 @@ NSEvent* gLastDragMouseDownEvent = nil; void ChildViewMouseTracker::OnDestroyView(ChildView* aView) { - if (sLastMouseEventView == aView) + if (sLastMouseEventView == aView) { sLastMouseEventView = nil; + } +} + +void +ChildViewMouseTracker::OnDestroyWindow(NSWindow* aWindow) +{ + if (sWindowUnderMouse == aWindow) { + sWindowUnderMouse = nil; + } +} + +void +ChildViewMouseTracker::MouseEnteredWindow(NSEvent* aEvent) +{ + sWindowUnderMouse = [aEvent window]; + ReEvaluateMouseEnterState(aEvent); +} + +void +ChildViewMouseTracker::MouseExitedWindow(NSEvent* aEvent) +{ + if (sWindowUnderMouse == [aEvent window]) { + sWindowUnderMouse = nil; + ReEvaluateMouseEnterState(aEvent); + } } void @@ -4781,20 +4812,19 @@ ChildViewMouseTracker::ReEvaluateMouseEnterState(NSEvent* aEvent) void ChildViewMouseTracker::MouseMoved(NSEvent* aEvent) { - ReEvaluateMouseEnterState(aEvent); + MouseEnteredWindow(aEvent); [sLastMouseEventView handleMouseMoved:aEvent]; } ChildView* ChildViewMouseTracker::ViewForEvent(NSEvent* aEvent) { - NSWindow* window = WindowForEvent(aEvent); + NSWindow* window = sWindowUnderMouse; if (!window) return nil; NSPoint windowEventLocation = nsCocoaUtils::EventLocationForWindow(aEvent, window); NSView* view = [[[window contentView] superview] hitTest:windowEventLocation]; - NS_ASSERTION(view, "How can the mouse be over a window but not over a view in that window?"); if (![view isKindOfClass:[ChildView class]]) return nil; @@ -4805,102 +4835,6 @@ ChildViewMouseTracker::ViewForEvent(NSEvent* aEvent) return WindowAcceptsEvent(window, aEvent, childView) ? childView : nil; } -static CGWindowLevel kDockWindowLevel = 0; -static CGWindowLevel kPopupWindowLevel = 0; - -static BOOL WindowNumberIsUnderPoint(NSInteger aWindowNumber, NSPoint aPoint) { - NSWindow* window = [NSApp windowWithWindowNumber:aWindowNumber]; - if (window) { - // This is one of our own windows. - return NSMouseInRect(aPoint, [window frame], NO); - } - - CGSConnection cid = _CGSDefaultConnection(); - - if (!kDockWindowLevel) { - // These constants are in fact function calls, so cache them. - kDockWindowLevel = kCGDockWindowLevel; - kPopupWindowLevel = kCGPopUpMenuWindowLevel; - } - - // Some things put transparent windows on top of everything. Ignore them. - CGWindowLevel level; - if ((kCGErrorSuccess == CGSGetWindowLevel(cid, aWindowNumber, &level)) && - (level == kDockWindowLevel || // Transparent layer, spanning the whole screen - level > kPopupWindowLevel)) // Snapz Pro X while recording a screencast - return false; - - // Ignore transparent windows. - float alpha; - if ((kCGErrorSuccess == CGSGetWindowAlpha(cid, aWindowNumber, &alpha)) && - alpha < 0.1f) - return false; - - CGRect rect; - if (kCGErrorSuccess != CGSGetScreenRectForWindow(cid, aWindowNumber, &rect)) - return false; - - CGPoint point = { aPoint.x, nsCocoaUtils::FlippedScreenY(aPoint.y) }; - return CGRectContainsPoint(rect, point); -} - -// Find the window number of the window under the given point, regardless of -// which app the window belongs to. Returns 0 if no window was found. -static NSInteger WindowNumberAtPoint(NSPoint aPoint) { - // We'd like to use the new windowNumberAtPoint API on 10.6 but we can't rely - // on it being up-to-date. For example, if we've just opened a window, - // windowNumberAtPoint might not know about it yet, so we'd send events to the - // wrong window. See bug 557986. - // So we'll have to find the right window manually by iterating over all - // windows on the screen and testing whether the mouse is inside the window's - // rect. We do this using private CGS functions. - // Another way of doing it would be to use tracking rects, but those are - // view-controlled, so they need to be reset whenever an NSView changes its - // size or position, which is expensive. See bug 300904 comment 20. - // A problem with using the CGS functions is that we only look at the windows' - // rects, not at the transparency of the actual pixel the mouse is over. This - // means that we won't treat transparent pixels as transparent to mouse - // events, which is a disadvantage over using tracking rects and leads to the - // crummy window level workarounds in WindowNumberIsUnderPoint. - // But speed is more important. - - // Get the window list. - NSInteger windowCount; - NSCountWindows(&windowCount); - NSInteger* windowList = (NSInteger*)malloc(sizeof(NSInteger) * windowCount); - if (!windowList) - return nil; - - // The list we get back here is in order from front to back. - NSWindowList(windowCount, windowList); - for (NSInteger i = 0; i < windowCount; i++) { - NSInteger windowNumber = windowList[i]; - if (WindowNumberIsUnderPoint(windowNumber, aPoint)) { - free(windowList); - return windowNumber; - } - } - - free(windowList); - return 0; -} - -// Find Gecko window under the mouse. Returns nil if the mouse isn't over -// any of our windows. -NSWindow* -ChildViewMouseTracker::WindowForEvent(NSEvent* anEvent) -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; - - NSPoint screenPoint = nsCocoaUtils::ScreenLocationForEvent(anEvent); - NSInteger windowNumber = WindowNumberAtPoint(screenPoint); - - // This will return nil if windowNumber belongs to a window that we don't own. - return [NSApp windowWithWindowNumber:windowNumber]; - - NS_OBJC_END_TRY_ABORT_BLOCK_NIL; -} - BOOL ChildViewMouseTracker::WindowAcceptsEvent(NSWindow* aWindow, NSEvent* aEvent, ChildView* aView, BOOL aIsClickThrough) diff --git a/widget/src/cocoa/nsCocoaWindow.h b/widget/src/cocoa/nsCocoaWindow.h index 01b62b5ce57e..30cd5bf5e91c 100644 --- a/widget/src/cocoa/nsCocoaWindow.h +++ b/widget/src/cocoa/nsCocoaWindow.h @@ -81,6 +81,8 @@ typedef struct _nsCocoaWindowList { // is ridiculously slow, so we cache it in the toplevel window for all // descendants to use. float mDPI; + + NSTrackingArea* mTrackingArea; } - (void)importState:(NSDictionary*)aState; @@ -94,6 +96,12 @@ typedef struct _nsCocoaWindowList { - (void)invalidateShadow; - (float)getDPI; +- (void)mouseEntered:(NSEvent*)aEvent; +- (void)mouseExited:(NSEvent*)aEvent; +- (void)mouseMoved:(NSEvent*)aEvent; +- (void)updateTrackingArea; +- (NSView*)trackingAreaView; + @end @interface NSWindow (Undocumented) diff --git a/widget/src/cocoa/nsCocoaWindow.mm b/widget/src/cocoa/nsCocoaWindow.mm index 0940dca950b5..bc687d1e05ab 100644 --- a/widget/src/cocoa/nsCocoaWindow.mm +++ b/widget/src/cocoa/nsCocoaWindow.mm @@ -642,7 +642,6 @@ NS_IMETHODIMP nsCocoaWindow::Show(PRBool bState) parentIsSheet) { piParentWidget->GetSheetWindowParent(&topNonSheetWindow); [NSApp endSheet:nativeParentWindow]; - [nativeParentWindow setAcceptsMouseMovedEvents:NO]; } nsCocoaWindow* sheetShown = nsnull; @@ -657,7 +656,6 @@ NS_IMETHODIMP nsCocoaWindow::Show(PRBool bState) // Only set contextInfo if our parent isn't a sheet. NSWindow* contextInfo = parentIsSheet ? nil : mSheetWindowParent; [TopLevelWindowData deactivateInWindow:mSheetWindowParent]; - [mWindow setAcceptsMouseMovedEvents:YES]; [NSApp beginSheet:mWindow modalForWindow:mSheetWindowParent modalDelegate:mDelegate @@ -684,7 +682,6 @@ NS_IMETHODIMP nsCocoaWindow::Show(PRBool bState) NSInteger windowNumber = [mWindow windowNumber]; [mWindow _setWindowNumber:-1]; [mWindow _setWindowNumber:windowNumber]; - [mWindow setAcceptsMouseMovedEvents:YES]; // For reasons that aren't yet clear, calls to [NSWindow orderFront:] or // [NSWindow makeKeyAndOrderFront:] can sometimes trigger "Error (1000) // creating CGSWindow", which in turn triggers an internal inconsistency @@ -716,7 +713,6 @@ NS_IMETHODIMP nsCocoaWindow::Show(PRBool bState) ordered:NSWindowAbove]; } else { - [mWindow setAcceptsMouseMovedEvents:YES]; NS_OBJC_BEGIN_TRY_LOGONLY_BLOCK; [mWindow makeKeyAndOrderFront:nil]; NS_OBJC_END_TRY_LOGONLY_BLOCK; @@ -743,8 +739,6 @@ NS_IMETHODIMP nsCocoaWindow::Show(PRBool bState) // hide the sheet [NSApp endSheet:mWindow]; - [mWindow setAcceptsMouseMovedEvents:NO]; - [TopLevelWindowData deactivateInWindow:mWindow]; nsCocoaWindow* siblingSheetToShow = nsnull; @@ -774,7 +768,6 @@ NS_IMETHODIMP nsCocoaWindow::Show(PRBool bState) // If there are no sibling sheets, but the parent is a sheet, restore // it. It wasn't sent any deactivate events when it was hidden, so // don't call through Show, just let the OS put it back up. - [nativeParentWindow setAcceptsMouseMovedEvents:YES]; [NSApp beginSheet:nativeParentWindow modalForWindow:sheetParent modalDelegate:[nativeParentWindow delegate] @@ -787,7 +780,6 @@ NS_IMETHODIMP nsCocoaWindow::Show(PRBool bState) NS_OBJC_BEGIN_TRY_LOGONLY_BLOCK; [sheetParent makeKeyAndOrderFront:nil]; NS_OBJC_END_TRY_LOGONLY_BLOCK; - [sheetParent setAcceptsMouseMovedEvents:YES]; } SendSetZLevelEvent(); } @@ -813,10 +805,6 @@ NS_IMETHODIMP nsCocoaWindow::Show(PRBool bState) if (mWindowType == eWindowType_popup) [NSApp _removeWindowFromCache:mWindow]; - // it's very important to turn off mouse moved events when hiding a window, otherwise - // the windows' tracking rects will interfere with each other. (bug 356528) - [mWindow setAcceptsMouseMovedEvents:NO]; - // If our popup window is a non-native context menu, tell the OS (and // other programs) that a menu has closed. if ([mWindow isKindOfClass:[PopupWindow class]] && @@ -1417,7 +1405,6 @@ NS_IMETHODIMP nsCocoaWindow::SetFocus(PRBool aState) mPopupContentView->SetFocus(aState); } else if (aState && ([mWindow isVisible] || [mWindow isMiniaturized])) { - [mWindow setAcceptsMouseMovedEvents:YES]; [mWindow makeKeyAndOrderFront:nil]; SendSetZLevelEvent(); } @@ -1766,6 +1753,9 @@ PRBool nsCocoaWindow::ShouldFocusPlugin() - (void)windowDidResize:(NSNotification *)aNotification { + BaseWindow* window = [aNotification object]; + [window updateTrackingArea]; + if (!mGeckoWindow) return; @@ -1973,6 +1963,11 @@ GetDPI(NSWindow* aWindow) return (heightPx / scaleFactor) / (heightMM / MM_PER_INCH_FLOAT); } +@interface BaseWindow(Private) +- (void)removeTrackingArea; +- (void)cursorUpdated:(NSEvent*)aEvent; +@end + @implementation BaseWindow - (id)initWithContentRect:(NSRect)aContentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)aBufferingType defer:(BOOL)aFlag @@ -1984,6 +1979,8 @@ GetDPI(NSWindow* aWindow) mInactiveTitlebarColor = nil; mScheduledShadowInvalidation = NO; mDPI = GetDPI(self); + mTrackingArea = nil; + [self updateTrackingArea]; return self; } @@ -1992,6 +1989,8 @@ GetDPI(NSWindow* aWindow) { [mActiveTitlebarColor release]; [mInactiveTitlebarColor release]; + [self removeTrackingArea]; + ChildViewMouseTracker::OnDestroyWindow(self); [super dealloc]; } @@ -2077,6 +2076,55 @@ static const NSString* kStateShowsToolbarButton = @"showsToolbarButton"; return mDPI; } +- (NSView*)trackingAreaView +{ + NSView* contentView = [self contentView]; + return [contentView superview] ? [contentView superview] : contentView; +} + +- (void)removeTrackingArea +{ + if (mTrackingArea) { + [[self trackingAreaView] removeTrackingArea:mTrackingArea]; + [mTrackingArea release]; + mTrackingArea = nil; + } +} + +- (void)updateTrackingArea +{ + [self removeTrackingArea]; + + NSView* view = [self trackingAreaView]; + const NSTrackingAreaOptions options = + NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingActiveAlways; + mTrackingArea = [[NSTrackingArea alloc] initWithRect:[view bounds] + options:options + owner:self + userInfo:nil]; + [view addTrackingArea:mTrackingArea]; +} + +- (void)mouseEntered:(NSEvent*)aEvent +{ + ChildViewMouseTracker::MouseEnteredWindow(aEvent); +} + +- (void)mouseExited:(NSEvent*)aEvent +{ + ChildViewMouseTracker::MouseExitedWindow(aEvent); +} + +- (void)mouseMoved:(NSEvent*)aEvent +{ + ChildViewMouseTracker::MouseMoved(aEvent); +} + +- (void)cursorUpdated:(NSEvent*)aEvent +{ + // Nothing to do here, but NSTrackingArea wants us to implement this method. +} + - (BOOL)respondsToSelector:(SEL)aSelector { // Claim the window doesn't respond to this so that the system @@ -2459,87 +2507,6 @@ TitlebarDrawCallback(void* aInfo, CGContextRef aContext) @implementation PopupWindow -// The OS treats our custom popup windows very strangely -- many mouse events -// sent to them never reach their target NSView objects. (That these windows -// are borderless and of level NSPopUpMenuWindowLevel may have something to do -// with it.) The best solution is to pre-empt the OS, as follows. (All -// events for a given NSWindow object go through its sendEvent: method.) -- (void)sendEvent:(NSEvent *)anEvent -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - - NSView *target = nil; - NSView *contentView = nil; - NSEventType type = [anEvent type]; - NSPoint windowLocation = NSZeroPoint; - switch (type) { - case NSScrollWheel: - case NSLeftMouseDown: - case NSLeftMouseUp: - case NSRightMouseDown: - case NSRightMouseUp: - case NSOtherMouseDown: - case NSOtherMouseUp: - case NSMouseMoved: - case NSLeftMouseDragged: - case NSRightMouseDragged: - case NSOtherMouseDragged: - if ((contentView = [self contentView])) { - // Since [anEvent window] might not be us, we can't use [anEvent locationInWindow]. - windowLocation = nsCocoaUtils::EventLocationForWindow(anEvent, self); - target = [contentView hitTest:[contentView convertPoint:windowLocation fromView:nil]]; - // If the hit test failed, the event is targeted here but is not over the window. - // Send it to our content view. - if (!target) - target = contentView; - } - break; - default: - break; - } - if (target) { - switch (type) { - case NSScrollWheel: - [target scrollWheel:anEvent]; - break; - case NSLeftMouseUp: - [target mouseUp:anEvent]; - break; - case NSRightMouseDown: - [target rightMouseDown:anEvent]; - break; - case NSRightMouseUp: - [target rightMouseUp:anEvent]; - break; - case NSOtherMouseDown: - [target otherMouseDown:anEvent]; - break; - case NSOtherMouseUp: - [target otherMouseUp:anEvent]; - break; - case NSMouseMoved: - [target mouseMoved:anEvent]; - break; - case NSLeftMouseDragged: - [target mouseDragged:anEvent]; - break; - case NSRightMouseDragged: - [target rightMouseDragged:anEvent]; - break; - case NSOtherMouseDragged: - [target otherMouseDragged:anEvent]; - break; - default: - [super sendEvent:anEvent]; - break; - } - } else { - [super sendEvent:anEvent]; - } - - NS_OBJC_END_TRY_ABORT_BLOCK; -} - - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation { diff --git a/widget/src/cocoa/nsToolkit.h b/widget/src/cocoa/nsToolkit.h index e19e2e397865..439682a41a64 100644 --- a/widget/src/cocoa/nsToolkit.h +++ b/widget/src/cocoa/nsToolkit.h @@ -83,7 +83,6 @@ protected: CFRunLoopSourceRef mSleepWakeNotificationRLS; io_object_t mPowerNotifier; - EventHandlerRef mEventMonitorHandler; CFMachPortRef mEventTapPort; CFRunLoopSourceRef mEventTapRLS; }; diff --git a/widget/src/cocoa/nsToolkit.mm b/widget/src/cocoa/nsToolkit.mm index 09e29badffdd..029c0fe95021 100644 --- a/widget/src/cocoa/nsToolkit.mm +++ b/widget/src/cocoa/nsToolkit.mm @@ -87,7 +87,6 @@ static PRUintn gToolkitTLSIndex = 0; nsToolkit::nsToolkit() : mInited(false) , mSleepWakeNotificationRLS(nsnull) -, mEventMonitorHandler(nsnull) , mEventTapPort(nsnull) , mEventTapRLS(nsnull) { @@ -202,18 +201,6 @@ nsToolkit::RemoveSleepWakeNotifcations() NS_OBJC_END_TRY_ABORT_BLOCK; } -// This is the callback used in RegisterForAllProcessMouseEvents. -static OSStatus EventMonitorHandler(EventHandlerCallRef aCaller, EventRef aEvent, void* aRefcon) -{ - // Up to Mac OS 10.4 (or when building with the 10.4 SDK), installing a Carbon - // event handler like this one caused the OS to post the equivalent Cocoa - // events to [NSApp sendEvent:]. When using the 10.5 SDK, this doesn't happen - // any more, so we need to do it manually. - [NSApp sendEvent:[NSEvent eventWithEventRef:aEvent]]; - - return eventNotHandledErr; -} - // Converts aPoint from the CoreGraphics "global display coordinate" system // (which includes all displays/screens and has a top-left origin) to its // (presumed) Cocoa counterpart (assumed to be the same as the "screen @@ -275,12 +262,6 @@ nsToolkit::RegisterForAllProcessMouseEvents() return; #endif /* MOZ_USE_NATIVE_POPUP_WINDOWS */ - if (!mEventMonitorHandler) { - EventTypeSpec kEvents[] = {{kEventClassMouse, kEventMouseMoved}}; - InstallEventHandler(GetEventMonitorTarget(), EventMonitorHandler, - GetEventTypeCount(kEvents), kEvents, 0, - &mEventMonitorHandler); - } if (!mEventTapRLS) { // Using an event tap for mouseDown events (instead of installing a // handler for them on the EventMonitor target) works around an Apple @@ -320,10 +301,6 @@ nsToolkit::UnregisterAllProcessMouseEventHandlers() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - if (mEventMonitorHandler) { - RemoveEventHandler(mEventMonitorHandler); - mEventMonitorHandler = nsnull; - } if (mEventTapRLS) { CFRunLoopRemoveSource(CFRunLoopGetCurrent(), mEventTapRLS, kCFRunLoopDefaultMode); diff --git a/widget/tests/native_mouse_mac_window.xul b/widget/tests/native_mouse_mac_window.xul index 4bb60fec471a..06d32ad0d004 100644 --- a/widget/tests/native_mouse_mac_window.xul +++ b/widget/tests/native_mouse_mac_window.xul @@ -72,12 +72,14 @@ } function onTestsFinished() { + clearTimeout(gAfterLoopExecution); observe(window, eventMonitor, false); observe(gRightWindow, eventMonitor, false); observe(gPopup, eventMonitor, false); gRightWindow.close(); + var openerSimpleTest = window.opener.wrappedJSObject.SimpleTest; window.close(); - window.opener.wrappedJSObject.SimpleTest.finish(); + openerSimpleTest.finish(); } const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; @@ -128,6 +130,8 @@ var gExpectedEvents = []; var gRightWindow = null, gPopup = null; + var gCurrentMouseX = 0, gCurrentMouseY = 0; + var gAfterLoopExecution = 0; function testMouse(x, y, msg, elem, win, exp, flags, callback) { clearExpectedEvents(); @@ -137,14 +141,16 @@ gExpectedEvents.push(expEv); }); printDebug("sending event: " + x + ", " + y + " (" + msg + ")\n"); + gCurrentMouseX = x; + gCurrentMouseY = y; netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); var utils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor). getInterface(Components.interfaces.nsIDOMWindowUtils); utils.sendNativeMouseEvent(x, y, msg, flags || 0, elem); - SimpleTest.executeSoon(function () { + gAfterLoopExecution = setTimeout(function () { clearExpectedEvents(); callback(); - }); + }, 0); } function eventListenOnce(elem, name, callback) { @@ -182,10 +188,15 @@ } function processEvent(e) { + if (e.screenX != gCurrentMouseX || e.screenY != gCurrentMouseY) { + todo(false, "Oh no! Received a stray event from a confused tracking area. Aborting test."); + onTestsFinished(); + return; + } var expectedEvent = gExpectedEvents.shift(); if (!expectedEvent) { ok(false, "received event I didn't expect: " + eventToString(e)); - return true; + return; } if (e.type != expectedEvent.type) { // Didn't get expectedEvent. @@ -306,6 +317,10 @@ { type: "mouseup", target: rightElem }, { type: "click", target: rightElem }, ]], + // Move the mouse back over the left window, which is inactive. + [150, 170, NSMouseMoved, null, left, [ + { type: "mouseout", target: rightElem }, + ]], // Now we're being sneaky. The left window is inactive, but *right*-clicks to it // should still get through. Test that. // Ideally we'd be bracketing that event with over and out events, too, but it @@ -327,7 +342,6 @@ // Still, mouseout and mouseover events should fire. function raiseLeftWindow(callback) { clearExpectedEvents(); - gExpectedEvents.push({ screenX: 150, screenY: 170, type: "mouseout", target: rightElem }); gExpectedEvents.push({ screenX: 150, screenY: 170, type: "mouseover", target: leftElem }); focusAndThen(left, function () { SimpleTest.executeSoon(callback); }); }, @@ -391,25 +405,20 @@ // Install the tooltip, but don't show it yet. function setTooltip(callback) { rightElem.setAttribute("tooltip", "tip"); - callback(); - }, - // Move the mouse to trigger the appearance of the tooltip. - [410, 180, NSMouseMoved, null, right, [ - { type: "mousemove", target: rightElem }, - ]], - // Wait for the tooltip to appear. - function (callback) { + gExpectedEvents.push({ screenX: 410, screenY: 180, type: "mousemove", target: rightElem }); eventListenOnce(rightElem, "popupshown", callback); + gCurrentMouseX = 410; + gCurrentMouseY = 180; + var utils = right.QueryInterface(Components.interfaces.nsIInterfaceRequestor). + getInterface(Components.interfaces.nsIDOMWindowUtils); + utils.sendNativeMouseEvent(410, 180, NSMouseMoved, 0, null); }, // Now the tooltip is visible. - // Move the mouse a little to the right, but send the event to the tooltip's - // widget, even though the mouse is not over the tooltip, because that's what - // Mac OS X does. - [411, 180, NSMouseMoved, tooltip, right, [ + // Move the mouse a little to the right. + [411, 180, NSMouseMoved, null, right, [ { type: "mousemove", target: rightElem }, ]], - // Move another pixel. This time send the event to the right widget. - // However, that must not make a difference. + // Move another pixel. [412, 180, NSMouseMoved, null, right, [ { type: "mousemove", target: rightElem }, ]], @@ -434,22 +443,21 @@ // Now we move the mouse over the part where the panel rect intersects the // right window's rect. Since the panel is under the window, all the events // should target the right window. - // Try with sending to three different targets. [390, 170, NSMouseMoved, null, right, [ { type: "mousemove", target: rightElem }, ]], - [390, 171, NSMouseMoved, null, left, [ + [390, 171, NSMouseMoved, null, right, [ { type: "mousemove", target: rightElem }, ]], - [391, 171, NSMouseMoved, panel, left, [ + [391, 171, NSMouseMoved, null, right, [ { type: "mousemove", target: rightElem }, ]], // Now move off the right window, so that the mouse is directly over the // panel. - [260, 170, NSMouseMoved, null, left, [ + [260, 170, NSMouseMoved, panel, left, [ { type: "mouseout", target: rightElem }, ]], - [260, 171, NSMouseMoved, null, left, [ + [260, 171, NSMouseMoved, panel, left, [ ]], [261, 171, NSMouseMoved, panel, left, [ ]], @@ -464,11 +472,11 @@ }, // Now mouse events should get through to the panel (which is now over the // right window). - [387, 170, NSMouseMoved, null, right, [ + [387, 170, NSMouseMoved, panel, left, [ { type: "mouseover", target: panel }, { type: "mousemove", target: panel }, ]], - [387, 171, NSMouseMoved, null, left, [ + [387, 171, NSMouseMoved, panel, left, [ { type: "mousemove", target: panel }, ]], [388, 171, NSMouseMoved, panel, left, [ @@ -486,12 +494,12 @@ // Last test for this part: Hit testing in the Canyon of Nowhere - // the pixel row directly south of the panel, over the left window. // Before bug 515003 we wrongly thought the mouse wasn't over any window. - [173, 200, NSMouseMoved, panel, left, [ + [173, 200, NSMouseMoved, null, left, [ { type: "mouseout", target: panel }, { type: "mouseover", target: leftElem }, { type: "mousemove", target: leftElem }, ]], - [173, 201, NSMouseMoved, panel, left, [ + [173, 201, NSMouseMoved, null, left, [ { type: "mousemove", target: leftElem }, ]], @@ -567,32 +575,28 @@ { type: "mouseup", target: rightElem }, { type: "click", target: rightElem }, ]], - // Now we're being sneaky. The left window is inactive, but *right*-clicks to it - // should still get through. Test that. - // Ideally we'd be bracketing that event with over and out events, too, but it - // probably doesn't matter too much. + // Move the mouse back over the left window, which is inactive. + [150, 170, NSMouseMoved, null, left, [ + { type: "mouseout", target: rightElem }, + { type: "mouseover", target: leftElem }, + { type: "mousemove", target: leftElem }, + ]], + // Right-click it. [150, 170, NSRightMouseDown, null, left, [ - { type: "mouseover", target: leftElem, shouldFireButDoesnt: true }, { type: "mousedown", target: leftElem }, - { type: "mouseout", target: leftElem, shouldFireButDoesnt: true }, ]], // Let go of the mouse. [150, 170, NSRightMouseUp, null, left, [ - { type: "mouseover", target: leftElem, shouldFireButDoesnt: true }, { type: "mouseup", target: leftElem }, { type: "click", target: leftElem }, - { type: "mouseout", target: leftElem, shouldFireButDoesnt: true }, ]], // Right clicking hasn't focused it, so the window is still inactive. // Let's focus it; this time without the mouse, for variaton's sake. - // Still, mouseout and mouseover events should fire. function raiseLeftWindow(callback) { clearExpectedEvents(); - gExpectedEvents.push({ screenX: 150, screenY: 170, type: "mouseout", target: rightElem }); - gExpectedEvents.push({ screenX: 150, screenY: 170, type: "mouseover", target: leftElem }); focusAndThen(left, function () { SimpleTest.executeSoon(callback); }); }, - // It's active, so it should respond to mousemove events now. + // It's active and should still respond to mousemove events. [150, 170, NSMouseMoved, null, left, [ { type: "mousemove", target: leftElem }, ]], @@ -653,27 +657,22 @@ // Time for our next trick: a tooltip! // Install the tooltip, but don't show it yet. - function setTooltip(callback) { + function setTooltip2(callback) { rightElem.setAttribute("tooltip", "tip"); - callback(); - }, - // Move the mouse to trigger the appearance of the tooltip. - [410, 180, NSMouseMoved, null, right, [ - { type: "mousemove", target: rightElem }, - ]], - // Wait for the tooltip to appear. - function (callback) { + gExpectedEvents.push({ screenX: 410, screenY: 180, type: "mousemove", target: rightElem }); eventListenOnce(rightElem, "popupshown", callback); + gCurrentMouseX = 410; + gCurrentMouseY = 180; + var utils = right.QueryInterface(Components.interfaces.nsIInterfaceRequestor). + getInterface(Components.interfaces.nsIDOMWindowUtils); + utils.sendNativeMouseEvent(410, 180, NSMouseMoved, 0, null); }, // Now the tooltip is visible. - // Move the mouse a little to the right, but send the event to the tooltip's - // widget, even though the mouse is not over the tooltip, because that's what - // Mac OS X does. - [411, 180, NSMouseMoved, tooltip, right, [ + // Move the mouse a little to the right. + [411, 180, NSMouseMoved, null, right, [ { type: "mousemove", target: rightElem }, ]], - // Move another pixel. This time send the event to the right widget. - // However, that must not make a difference. + // Move another pixel. [412, 180, NSMouseMoved, null, right, [ { type: "mousemove", target: rightElem }, ]], @@ -698,24 +697,23 @@ // Now we move the mouse over the part where the panel rect intersects the // right window's rect. Since the panel is under the window, all the events // should target the right window. - // Try with sending to three different targets. [390, 170, NSMouseMoved, null, right, [ { type: "mousemove", target: rightElem }, ]], - [390, 171, NSMouseMoved, null, left, [ + [390, 171, NSMouseMoved, null, right, [ { type: "mousemove", target: rightElem }, ]], - [391, 171, NSMouseMoved, panel, left, [ + [391, 171, NSMouseMoved, null, right, [ { type: "mousemove", target: rightElem }, ]], // Now move off the right window, so that the mouse is directly over the // panel. - [260, 170, NSMouseMoved, null, left, [ + [260, 170, NSMouseMoved, panel, left, [ { type: "mouseout", target: rightElem }, { type: "mouseover", target: panel }, { type: "mousemove", target: panel }, ]], - [260, 171, NSMouseMoved, null, left, [ + [260, 171, NSMouseMoved, panel, left, [ { type: "mousemove", target: panel }, ]], [261, 171, NSMouseMoved, panel, left, [ @@ -733,10 +731,10 @@ function raiseLeftWindowTakeTwo(callback) { focusAndThen(left, callback); }, - [387, 170, NSMouseMoved, null, right, [ + [387, 170, NSMouseMoved, panel, left, [ { type: "mousemove", target: panel }, ]], - [387, 171, NSMouseMoved, null, left, [ + [387, 171, NSMouseMoved, panel, left, [ { type: "mousemove", target: panel }, ]], [388, 171, NSMouseMoved, panel, left, [ @@ -754,12 +752,12 @@ // Last test for today: Hit testing in the Canyon of Nowhere - // the pixel row directly south of the panel, over the left window. // Before bug 515003 we wrongly thought the mouse wasn't over any window. - [173, 200, NSMouseMoved, panel, left, [ + [173, 200, NSMouseMoved, null, left, [ { type: "mouseout", target: panel }, { type: "mouseover", target: leftElem }, { type: "mousemove", target: leftElem }, ]], - [173, 201, NSMouseMoved, panel, left, [ + [173, 201, NSMouseMoved, null, left, [ { type: "mousemove", target: leftElem }, ]], ]; From 980e75c610220eab2e6f41b897fafc86e65619ee Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Mon, 8 Aug 2011 17:37:30 +0200 Subject: [PATCH 11/30] Backed out changeset 764a4259b9f7 (bug 667480) because it depends on a changeset that's about to be backed out. --- browser/base/content/browser.xul | 2 +- .../themes/pinstripe/browser/Toolbar-lion.png | Bin 6479 -> 0 bytes browser/themes/pinstripe/browser/browser.css | 112 +++++++++--------- browser/themes/pinstripe/browser/jar.mn | 6 - .../pinstripe/browser/keyhole-circle-lion.png | Bin 2261 -> 0 bytes .../pinstripe/browser/keyhole-circle.png | Bin 2262 -> 0 bytes .../pinstripe/browser/places/organizer.css | 35 +++++- .../pinstripe/global/console/console.css | 19 ++- toolkit/themes/pinstripe/global/shared.inc | 5 + .../themes/pinstripe/global/toolbarbutton.css | 8 +- .../themes/pinstripe/global/viewbuttons.css | 68 ++++++++++- .../pinstripe/mozapps/downloads/downloads.css | 28 ++++- .../pinstripe/mozapps/update/updates.css | 29 ++++- 13 files changed, 234 insertions(+), 78 deletions(-) delete mode 100644 browser/themes/pinstripe/browser/Toolbar-lion.png delete mode 100644 browser/themes/pinstripe/browser/keyhole-circle-lion.png delete mode 100644 browser/themes/pinstripe/browser/keyhole-circle.png diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index 430861e2982f..a278874bd4dc 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -1008,7 +1008,7 @@ - + diff --git a/browser/themes/pinstripe/browser/Toolbar-lion.png b/browser/themes/pinstripe/browser/Toolbar-lion.png deleted file mode 100644 index a65aa30ebae6c314bccd897862be400e27c7afab..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6479 zcmY*;Wl$SH*DhY5I7N#VD^5yrcP$X0xD_p=5Zoa^C@#gJxNFf;+#LcGcZX2iCFsZd zes}KN`^@Z~GqbZZXCL{s;TmcRxY(4~NJvPyN{X_YNJz-AmtGVT?PZq|kj{B2SdNPN zE=WkPiT|^Zk$z^7BOy^BE6GY}doCUsV;O1b&O#J{OU>HLdfj+fhM2W1hd%S~2qdK> zNh3EKf4i0Dlk~cU%=+6GZ)q-lh)G%$4vSgL$+WXCNB!fT@kdxK^23!&$)<*6IA&MY zNo&fFRz~hF1mD!&$^FVRB9QwebNTAwMC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K;LbQu!kUy8K8Kl-?9#OCB?8>wFL zksaudC|U|l8oS$cH zfxE>c{sBbKUB=(83<%5aTtt|19Kr5&Imt)P#}tV!LIXOxJ5wbHmvnDxOaC+rbko7d z^U6nrQ(UcGT?p$)vzP!7OiYf$-sZjzsf6;|cqEIbs5NF^(Ai6*wyw;dI1Y?vn{Hb! zPuwhxCK~e8Z^HjGKs6N)d^{@NO{Sh;sP_TU*U({R{cD8J0lI4=?F4Jv-MtS^rBUGF_G)>hFeOPdB{Nv| zRnNh10OYH=^2>!|xBBX2k_!a|SfRkce%}LyVZ-JBW+M;)nO!xlibmAkzT{#*X2^N` z*Cm@4*+uBlu#PcxaWsNg&A{#d3B;Y9`IFv=rg|lH3Hmdq)BmOcW-vI}|1h+uFq`@k z91knh?O*lPsU#ORcKVV>7JTey?`6j#5c%q=Sp5$*gbQXc+98_%x)Sw8Gebq%lojs5Z8jNXzxi{lKki~0FbO!>)W8fRd(P1o_{ZW z5h+bC&F978Ii$%eFfoCN_wd+%J7u8AjuE(TxL@>#`2Wh hetN0vEd9^O&)D1@xrQ4zFFzzmN^)wlmC|NG{{t$Is#O30 diff --git a/browser/themes/pinstripe/browser/browser.css b/browser/themes/pinstripe/browser/browser.css index 69b707f03d94..707a0bda03f6 100644 --- a/browser/themes/pinstripe/browser/browser.css +++ b/browser/themes/pinstripe/browser/browser.css @@ -293,22 +293,21 @@ toolbarbutton.bookmark-item > menupopup { .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker, #restore-button { -moz-box-orient: vertical; - -moz-appearance: toolbarbutton; + padding: 0 3px; height: 22px; - padding: 0; - border: 0; + border: 1px solid @toolbarbuttonBorderColor@; + border-radius: @toolbarbuttonCornerRadius@; + box-shadow: 0 1px rgba(255, 255, 255, 0.2); + background: @toolbarbuttonBackground@; + background-origin: border-box; } .toolbarbutton-1:not([type="menu-button"]):-moz-lwtheme, .toolbarbutton-1 > .toolbarbutton-menubutton-button:-moz-lwtheme, .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker:-moz-lwtheme, #restore-button:-moz-lwtheme { - -moz-appearance: none; - padding: 0 3px; - border: 1px solid rgba(0, 0, 0, 0.4); - border-radius: @toolbarbuttonCornerRadius@; - background: -moz-linear-gradient(rgba(255,255,255,0.5), rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.2)) repeat-x; - background-origin: border-box; + border-color: rgba(0, 0, 0, 0.4); + background-image: -moz-linear-gradient(rgba(255,255,255,0.5), rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.2)); box-shadow: inset 0 1px rgba(255,255,255,0.3), 0 1px rgba(255,255,255,0.2); } @@ -338,7 +337,6 @@ toolbar:not([mode="icons"]) .toolbarbutton-1:not([type="menu-button"]), toolbar:not([mode="icons"]) .toolbarbutton-1 > .toolbarbutton-menubutton-button, toolbar:not([mode="icons"]) .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker, toolbar:not([mode="icons"]) #restore-button { - -moz-appearance: none; padding: 0; height: auto; border: none; @@ -410,6 +408,16 @@ toolbar:not([mode="icons"]) .toolbarbutton-1:not([open="true"]) > .toolbarbutton margin: 2px 0 0; } +toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not([disabled="true"]):active:hover:not(:-moz-lwtheme), +toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"])[open="true"]:not(:-moz-lwtheme), +toolbar[mode="icons"] .toolbarbutton-1:not([disabled="true"]) > .toolbarbutton-menubutton-button:active:hover:not(:-moz-lwtheme), +toolbar[mode="icons"] .toolbarbutton-1[open="true"] > .toolbarbutton-menubutton-dropmarker:not(:-moz-lwtheme), +toolbar[mode="icons"] #restore-button:not([disabled="true"]):active:hover:not(:-moz-lwtheme) { + background: @toolbarbuttonPressedBackgroundColor@; + text-shadow: @loweredShadow@; + box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@; +} + toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not([disabled="true"]):active:hover:-moz-lwtheme, toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"])[open="true"]:-moz-lwtheme, toolbar[mode="icons"] .toolbarbutton-1:not([disabled="true"]) > .toolbarbutton-menubutton-button:active:hover:-moz-lwtheme, @@ -420,16 +428,39 @@ toolbar[mode="icons"] #restore-button:not([disabled="true"]):active:hover:-moz-l box-shadow: inset 0 2px 5px rgba(0,0,0,0.6), 0 1px rgba(255,255,255,0.2); } +toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not(#fullscreen-button)[checked="true"]:not(:-moz-lwtheme) { + background: #606060; + box-shadow: inset #2A2A2A 0 3px 3.5px, @loweredShadow@; +} + toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not(#fullscreen-button)[checked="true"]:-moz-lwtheme { background-color: rgba(0,0,0,0.4); box-shadow: inset 0 2px 5px rgba(0,0,0,0.7), 0 1px rgba(255,255,255,0.2); } +toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not(#fullscreen-button)[checked="true"]:not([disabled="true"]):active:hover:not(:-moz-lwtheme) { + background: #4E4E4E; + box-shadow: inset #1c1c1c 0 3px 3.5px; +} + toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not(#fullscreen-button)[checked="true"]:not([disabled="true"]):active:hover:-moz-lwtheme { background-color: rgba(0, 0, 0, 0.6); box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.8), 0 1px rgba(255, 255, 255, 0.2); } +toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):-moz-window-inactive:not(:-moz-lwtheme), +toolbar[mode="icons"] .toolbarbutton-1 > .toolbarbutton-menubutton-button:-moz-window-inactive:not(:-moz-lwtheme), +toolbar[mode="icons"] .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker:-moz-window-inactive:not(:-moz-lwtheme), +toolbar[mode="icons"] #restore-button:-moz-window-inactive:not(:-moz-lwtheme) { + border-color: @toolbarbuttonInactiveBorderColor@; + background-image: @toolbarbuttonInactiveBackgroundImage@; +} + +toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not(#fullscreen-button)[checked="true"]:-moz-window-inactive { + background: #8E8E8E; + box-shadow: inset rgba(0, 0, 0, 0.5) 0 3px 3.5px, @loweredShadow@; +} + toolbar[mode="icons"] .toolbarbutton-1 > menupopup { margin-top: 1px; } @@ -446,28 +477,17 @@ toolbar[mode="icons"] .toolbarbutton-1 > menupopup { } #back-button, -#forward-button:-moz-locale-dir(rtl), -toolbar[mode="icons"] #back-button:-moz-locale-dir(rtl):-moz-lwtheme { +toolbar:not([mode="icons"]) #forward-button:-moz-locale-dir(rtl) { -moz-image-region: rect(0, 40px, 20px, 20px); } #forward-button, -#back-button:-moz-locale-dir(rtl), -#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button:-moz-locale-dir(rtl), -toolbar[mode="icons"] #forward-button:-moz-locale-dir(rtl):-moz-lwtheme { +toolbar:not([mode="icons"]) #back-button:-moz-locale-dir(rtl) { -moz-image-region: rect(0, 60px, 20px, 40px); } -#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button:-moz-locale-dir(rtl), -#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button:-moz-locale-dir(rtl), -toolbar[mode="icons"] #back-button:-moz-locale-dir(rtl):-moz-lwtheme, -toolbar[mode="icons"] #forward-button:-moz-locale-dir(rtl):-moz-lwtheme { - -moz-transform: scaleX(-1); -} - #navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button { - -moz-appearance: none; - -moz-margin-end: -7px; + -moz-margin-end: -5px; position: relative; z-index: 1; -moz-image-region: rect(0, 20px, 20px, 0); @@ -477,45 +497,31 @@ toolbar[mode="icons"] #forward-button:-moz-locale-dir(rtl):-moz-lwtheme { border-radius: 10000px; } -#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button:not(:-moz-lwtheme) { - height: 31px; - padding: 4px 5px 5px 3px; - margin-bottom: -1px; - background: url(chrome://browser/skin/keyhole-circle.png) 0 0 no-repeat; -} - -#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button:-moz-window-inactive:not(:-moz-lwtheme) { - background-position: -60px 0; -} - -#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button:not([disabled="true"]):active:hover:not(:-moz-lwtheme), -#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button[open="true"]:not(:-moz-lwtheme) { - background-position: -30px 0; +toolbar[mode="icons"] #back-button:-moz-locale-dir(rtl), +toolbar[mode="icons"] #forward-button:-moz-locale-dir(rtl) { + -moz-transform: scaleX(-1); } toolbar[mode="icons"] #forward-button { -moz-margin-start: 0; } -#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button > .toolbarbutton-icon { - /* shift the icon away from the back button */ - margin-left: 3px; - margin-right: -1px; +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button { + /* 1px to the right */ + padding-left: 4px; + padding-right: 2px; } -#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button { +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button:-moz-lwtheme { mask: url(chrome://browser/content/browser.xul#pinstripe-keyhole-forward-mask); } #navigator-toolbox[iconsize="small"][mode="icons"] > #nav-bar #forward-button { width: 27px; -} - -#navigator-toolbox[iconsize="small"][mode="icons"] > #nav-bar #forward-button:-moz-lwtheme { padding-left: 2px; } -toolbar[mode="icons"] #forward-button:-moz-lwtheme { +toolbar[mode="icons"] #forward-button { border-top-left-radius: 0; border-bottom-left-radius: 0; } @@ -523,9 +529,6 @@ toolbar[mode="icons"] #forward-button:-moz-lwtheme { #navigator-toolbox[iconsize="small"][mode="icons"] > #nav-bar #back-button { -moz-margin-end: 0; width: 26px; -} - -#navigator-toolbox[iconsize="small"][mode="icons"] > #nav-bar #back-button:-moz-lwtheme { padding-right: 2px; border-right-width: 0; border-top-right-radius: 0; @@ -1953,12 +1956,11 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker { :-moz-any(#TabsToolbar, #addon-bar) .toolbarbutton-1, :-moz-any(#TabsToolbar, #addon-bar) .toolbarbutton-1 > .toolbarbutton-menubutton-button, :-moz-any(#TabsToolbar, #addon-bar) .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker { - -moz-appearance: none; + margin: 0; + padding: 0; + border: none; + border-radius: 0; /* !important flags needed because of bug 561154: */ - margin: 0 !important; - padding: 0 !important; - border: none !important; - border-radius: 0 !important; background: none !important; box-shadow: none !important; } diff --git a/browser/themes/pinstripe/browser/jar.mn b/browser/themes/pinstripe/browser/jar.mn index 6c982967e16d..d1952b88f933 100644 --- a/browser/themes/pinstripe/browser/jar.mn +++ b/browser/themes/pinstripe/browser/jar.mn @@ -42,7 +42,6 @@ browser.jar: skin/classic/browser/section_collapsed-rtl.png skin/classic/browser/section_expanded.png skin/classic/browser/Secure-Glyph-White.png - skin/classic/browser/keyhole-circle.png skin/classic/browser/Toolbar.png skin/classic/browser/toolbarbutton-dropmarker.png skin/classic/browser/urlbar-arrow.png @@ -135,8 +134,3 @@ browser.jar: skin/classic/browser/syncCommon.css skin/classic/browser/syncQuota.css #endif - skin/classic/browser/lion/keyhole-circle.png (keyhole-circle-lion.png) - skin/classic/browser/lion/Toolbar.png (Toolbar-lion.png) - -% override chrome://browser/skin/keyhole-circle.png chrome://browser/skin/lion/keyhole-circle.png os=Darwin osversion>=10.7 -% override chrome://browser/skin/Toolbar.png chrome://browser/skin/lion/Toolbar.png os=Darwin osversion>=10.7 diff --git a/browser/themes/pinstripe/browser/keyhole-circle-lion.png b/browser/themes/pinstripe/browser/keyhole-circle-lion.png deleted file mode 100644 index f164d498c351e2541fadcbfb9b1e7a8334a7e581..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2261 zcmV;`2rBo9P)h%KvV)G3Kc3CL=okdq``t35>qGGxr{Gye4G26%ig;WLvi9uJQJj@ z^)%A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%tO%hqFl4Z9Eob&7lpgmMXRh*XN*#ylTli2T|6I z$Ic#VA2Gsr+DFbF62%*@<3DdfGvbY(UWvCU=m@z)_1fSC*T}OR3dGw!y`rjmU>%0< zJg};&M4z)=c=Q%@;d6FFcQU8M-)Q~nyrh=Al}P3`bQj(3V-4_~KDOw#NW%Bv7xW6^ z#%Xce$H#7Z5X!H8n#!M|U?-SU~1@)A4JYxIdJCE3s4pE%(BJNIbPY^dw%S>EEoKeykZ#zckTm|(O-cdo` z$LK|rG@h&Nvi=6&>9U@y747L%q7(lTWIE0n_x$*{lPYs}*Or24YZjeyW%SU!ql~<> z5N+L3P=35+XLdGLpSWp>^0FYt}J;mU0IQ_FOHRRnv%)z)YQapSbO?N03iBG~Jz9GzO$ zYKcy2JA~tOgDj-J!ZU^Bah&dqQkz7Vwb~KeEH2l!S{}fAS}o<;X0gzkVxGKsn{eaM zP+OxBnj5D!GfmhAc`<~WBIYNgZ8GiT4pH}}q_h|hR_|xiphWSFLb!^!bXFlVk6GR8dl6=&=8c z+3B#?7%EEcel+D`3%{{tiQUoofjThu4O5~E3LlznRgb-(wm|}{nRtc}sq}Y2OSLRpgHI{qujK)%>ugt&q@zhu$ zZ7j`Hea5EHxpjqB^or1xIW@<3B~tJio2kN5O#9gc{$qi=WD;G3Io_U%1GK6#d`HMg zJAhQg+at^p-7eW!;IuzWv25VQ1Lw6Dhqa?!n2vVz;xNq~U}uPR)%NWTJ6poouc`iu zsZ*$>u1rnZcla7%?9P_k8{D-#E%x2w5UDbxGt~5@RchP8?dEs$J2-aWSW33-i50Uj~d$8wNVJE?oC!ffbiCxjgFgBPE z=0n+NV`7(F`Q#HU!93AyvGcK{ZcSQBj4G@tsAt{ay1}5Hu%;MQT1wp-ik&}KZ13v& z toolbarbutton { list-style-image: url("chrome://browser/skin/places/toolbar.png"); margin: 4px 4px 5px; - padding: 0; - height: 22px; - -moz-appearance: toolbarbutton; + padding: 1px 3px; + border: 1px solid @toolbarbuttonBorderColor@; + border-radius: @toolbarbuttonCornerRadius@; + box-shadow: @loweredShadow@; + background: @toolbarbuttonBackground@; + background-origin: border-box; +} + +#placesToolbar > toolbarbutton:not([disabled="true"]):active:hover, +#placesToolbar > toolbarbutton[open="true"] { + background: @toolbarbuttonPressedBackgroundColor@; + text-shadow: @loweredShadow@; + box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@; +} + +#placesToolbar > toolbarbutton:-moz-focusring { + border-color: @toolbarbuttonFocusedBorderColorAqua@; + box-shadow: @focusRingShadow@; +} + +#placesToolbar > toolbarbutton:-moz-system-metric(mac-graphite-theme):-moz-focusring { + border-color: @toolbarbuttonFocusedBorderColorGraphite@; +} + +#placesToolbar > toolbarbutton:-moz-window-inactive { + border-color: @toolbarbuttonInactiveBorderColor@; + background-image: @toolbarbuttonInactiveBackgroundImage@; } #placesToolbar > toolbarbutton[disabled="true"] > .toolbarbutton-icon { @@ -112,12 +136,17 @@ #back-button:-moz-locale-dir(ltr), #forward-button:-moz-locale-dir(rtl) { -moz-image-region: rect(0px, 16px, 16px, 0px); + border-top-right-radius: 0; + border-bottom-right-radius: 0; margin-right: 0; + border-right: 0; } #forward-button:-moz-locale-dir(ltr), #back-button:-moz-locale-dir(rtl) { -moz-image-region: rect(0px, 32px, 16px, 16px); + border-top-left-radius: 0; + border-bottom-left-radius: 0; margin-left: 0; } diff --git a/toolkit/themes/pinstripe/global/console/console.css b/toolkit/themes/pinstripe/global/console/console.css index 0d45266c2e44..81aa306b44c0 100644 --- a/toolkit/themes/pinstripe/global/console/console.css +++ b/toolkit/themes/pinstripe/global/console/console.css @@ -203,9 +203,24 @@ toolbarseparator { #Console\:clear { -moz-box-orient: vertical; -moz-box-align: center; - -moz-appearance: toolbarbutton; font: menu; text-shadow: @loweredShadow@; margin: 4px 0 9px; - padding: 0 1px; + padding: 0 4px; + border: 1px solid @toolbarbuttonBorderColor@; + border-radius: @toolbarbuttonCornerRadius@; + box-shadow: @loweredShadow@; + background: @toolbarbuttonBackground@; + background-origin: border-box; +} + +#Console\:clear:active:hover { + background: @toolbarbuttonPressedBackgroundColor@; + text-shadow: @loweredShadow@; + box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@; +} + +#Console\:clear:-moz-window-inactive { + border-color: @toolbarbuttonInactiveBorderColor@; + background-image: @toolbarbuttonInactiveBackgroundImage@; } diff --git a/toolkit/themes/pinstripe/global/shared.inc b/toolkit/themes/pinstripe/global/shared.inc index 50b5761aba52..e57d9c3e6b2a 100644 --- a/toolkit/themes/pinstripe/global/shared.inc +++ b/toolkit/themes/pinstripe/global/shared.inc @@ -24,7 +24,12 @@ %define sidebarItemInactiveBorderTop 1px solid #979797 %define sidebarItemInactiveBackground -moz-linear-gradient(top, #B4B4B4, #8A8A8A) repeat-x +%define toolbarbuttonBorderColor rgba(59, 59, 59, 0.9) %define toolbarbuttonCornerRadius 3px %define toolbarbuttonBackground -moz-linear-gradient(top, #FFF, #ADADAD) repeat-x +%define toolbarbuttonFocusedBorderColorAqua rgba(102, 122, 155, 0.9) +%define toolbarbuttonFocusedBorderColorGraphite rgba(59, 59, 59, 0.7) %define toolbarbuttonPressedInnerShadow inset rgba(0, 0, 0, 0.3) 0 -6px 10px, inset #000 0 1px 3px, inset rgba(0, 0, 0, 0.2) 0 1px 3px +%define toolbarbuttonPressedBackgroundColor #B5B5B5 %define toolbarbuttonInactiveBorderColor rgba(146, 146, 146, 0.84) +%define toolbarbuttonInactiveBackgroundImage -moz-linear-gradient(top, #FFF, #CCC) diff --git a/toolkit/themes/pinstripe/global/toolbarbutton.css b/toolkit/themes/pinstripe/global/toolbarbutton.css index 9cd726ef231f..a5e18bbfb15e 100644 --- a/toolkit/themes/pinstripe/global/toolbarbutton.css +++ b/toolkit/themes/pinstripe/global/toolbarbutton.css @@ -86,15 +86,13 @@ toolbarbutton[checked="true"] { border: none !important; background-color: transparent !important; list-style-image: url("chrome://global/skin/arrow/arrow-dn.png"); - padding: 0; - -moz-padding-start: 2px; + padding: 0 0 0 2px; width: auto; } .toolbarbutton-menu-dropmarker[disabled="true"] { list-style-image: url("chrome://global/skin/arrow/arrow-dn-dis.png"); - padding: 0; - -moz-padding-start: 2px; + padding: 0 0 0 2px !important; } /* ::::: toolbarbutton menu-button ::::: */ @@ -124,7 +122,7 @@ toolbarbutton[type="menu-button"][disabled="true"]:hover:active { /* .......... dropmarker .......... */ .toolbarbutton-menubutton-dropmarker { - -moz-appearance: none; + -moz-appearance: none !important; border: none; background-color: transparent !important; list-style-image: url("chrome://global/skin/arrow/arrow-dn.png"); diff --git a/toolkit/themes/pinstripe/global/viewbuttons.css b/toolkit/themes/pinstripe/global/viewbuttons.css index 3c67ca89de75..7601582d56fa 100644 --- a/toolkit/themes/pinstripe/global/viewbuttons.css +++ b/toolkit/themes/pinstripe/global/viewbuttons.css @@ -46,6 +46,10 @@ } #viewGroup { + background-color: rgba(0, 0, 0, 0.55); + padding: 1px; + border-radius: @toolbarbuttonCornerRadius@; + box-shadow: @loweredShadow@; margin: 4px 0 9px; } @@ -53,16 +57,74 @@ #viewGroup > toolbarbutton { -moz-box-orient: vertical; -moz-box-align: center; - -moz-appearance: toolbarbutton; + -moz-appearance: none; font: menu; text-shadow: @loweredShadow@; margin: 0; - padding: 0 1px; - height: 22px; + padding: 0 4px; + border: none; + border-left: 1px solid rgba(0, 0, 0, 0.8); + background: @toolbarbuttonBackground@; +} + +#viewGroup > radio:active:hover, +#viewGroup > toolbarbutton:active:hover { + background: @toolbarbuttonPressedBackgroundColor@; + text-shadow: @loweredShadow@; + box-shadow: @toolbarbuttonPressedInnerShadow@; } #viewGroup > radio[selected=true], #viewGroup > toolbarbutton[checked=true] { color: #FFF !important; text-shadow: rgba(0, 0, 0, 0.4) 0 1px; + background: #606060; + box-shadow: inset #2A2A2A 0 3px 3.5px; +} + +#viewGroup > radio[selected=true]:active:hover, +#viewGroup > toolbarbutton[checked=true]:active:hover { + background-color: #4E4E4E; + box-shadow: inset #1c1c1c 0 3px 3.5px; +} + +#viewGroup:-moz-window-inactive { + background-color: rgba(0, 0, 0, 0.25); +} + +#viewGroup > radio:-moz-window-inactive, +#viewGroup > toolbarbutton:-moz-window-inactive { + border-color: rgba(0, 0, 0, 0.4); + background-image: @toolbarbuttonInactiveBackgroundImage@; +} + +#viewGroup > radio[selected=true]:-moz-window-inactive, +#viewGroup > toolbarbutton[checked=true]:-moz-window-inactive { + background: #8E8E8E; + box-shadow: inset rgba(0, 0, 0, 0.5) 0 3px 3.5px; +} + +#viewGroup > radio:-moz-locale-dir(ltr):first-child, +#viewGroup > radio:-moz-locale-dir(ltr)[first-visible], +#viewGroup > radio:-moz-locale-dir(rtl):last-child, +#viewGroup > radio:-moz-locale-dir(rtl)[last-visible], +#viewGroup > toolbarbutton:-moz-locale-dir(ltr):first-child, +#viewGroup > toolbarbutton:-moz-locale-dir(ltr)[first-visible], +#viewGroup > toolbarbutton:-moz-locale-dir(rtl):last-child, +#viewGroup > toolbarbutton:-moz-locale-dir(rtl)[last-visible] { + border-top-left-radius: 2px; + border-bottom-left-radius: 2px; + border-left: none !important; +} + +#viewGroup > radio:-moz-locale-dir(ltr):last-child, +#viewGroup > radio:-moz-locale-dir(ltr)[last-visible], +#viewGroup > radio:-moz-locale-dir(rtl):first-child, +#viewGroup > radio:-moz-locale-dir(rtl)[first-visible], +#viewGroup > toolbarbutton:-moz-locale-dir(ltr):last-child, +#viewGroup > toolbarbutton:-moz-locale-dir(ltr)[last-visible], +#viewGroup > toolbarbutton:-moz-locale-dir(rtl):first-child, +#viewGroup > toolbarbutton:-moz-locale-dir(rtl)[first-visible] { + border-top-right-radius: 2px; + border-bottom-right-radius: 2px; } diff --git a/toolkit/themes/pinstripe/mozapps/downloads/downloads.css b/toolkit/themes/pinstripe/mozapps/downloads/downloads.css index 0ba68922d72a..0b783b573788 100644 --- a/toolkit/themes/pinstripe/mozapps/downloads/downloads.css +++ b/toolkit/themes/pinstripe/mozapps/downloads/downloads.css @@ -111,9 +111,35 @@ richlistitem[type="download"] button { } #clearListButton { - -moz-appearance: toolbarbutton; + -moz-appearance: none; min-height: 18px; min-width: 0; margin: 0 6px; + padding: 0 2px; text-shadow: @loweredShadow@; + border: 1px solid @toolbarbuttonBorderColor@; + border-radius: @toolbarbuttonCornerRadius@; + box-shadow: @loweredShadow@; + background: @toolbarbuttonBackground@; + background-origin: border-box; +} + +#clearListButton:hover:active:not([disabled="true"]) { + background: @toolbarbuttonPressedBackgroundColor@; + text-shadow: @loweredShadow@; + box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@; +} + +#clearListButton:-moz-focusring { + border-color: @toolbarbuttonFocusedBorderColorAqua@; + box-shadow: @focusRingShadow@; +} + +#clearListButton:-moz-system-metric(mac-graphite-theme):-moz-focusring { + border-color: @toolbarbuttonFocusedBorderColorGraphite@; +} + +#clearListButton:-moz-window-inactive { + border-color: @toolbarbuttonInactiveBorderColor@; + background-image: @toolbarbuttonInactiveBackgroundImage@; } diff --git a/toolkit/themes/pinstripe/mozapps/update/updates.css b/toolkit/themes/pinstripe/mozapps/update/updates.css index 6010e30f454d..9065c8e7b60f 100644 --- a/toolkit/themes/pinstripe/mozapps/update/updates.css +++ b/toolkit/themes/pinstripe/mozapps/update/updates.css @@ -39,11 +39,36 @@ wizardpage { } .wizard-buttons button { - -moz-appearance: toolbarbutton; + -moz-appearance: none; min-height: 22px; margin: 0 6px; - padding: 0; + padding: 0 2px; text-shadow: @loweredShadow@; + border: 1px solid @toolbarbuttonBorderColor@; + border-radius: @toolbarbuttonCornerRadius@; + box-shadow: @loweredShadow@; + background: @toolbarbuttonBackground@; + background-origin: border-box; +} + +.wizard-buttons button:hover:active:not([disabled="true"]) { + background: @toolbarbuttonPressedBackgroundColor@; + text-shadow: @loweredShadow@; + box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@; +} + +.wizard-buttons button:-moz-focusring { + border-color: @toolbarbuttonFocusedBorderColorAqua@; + box-shadow: @focusRingShadow@; +} + +.wizard-buttons button:-moz-system-metric(mac-graphite-theme):-moz-focusring { + border-color: @toolbarbuttonFocusedBorderColorGraphite@; +} + +.wizard-buttons button:-moz-window-inactive { + border-color: @toolbarbuttonInactiveBorderColor@; + background-image: @toolbarbuttonInactiveBackgroundImage@; } .loadingBox { From 7b4b78d3e1b1e284a4b803b6bfc11033c5d62680 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Mon, 8 Aug 2011 17:38:57 +0200 Subject: [PATCH 12/30] Backed out changeset 0a6140e88a2d (bug 672050) because it broke Windows builds. --- widget/src/cocoa/nsNativeThemeCocoa.h | 9 +- widget/src/cocoa/nsNativeThemeCocoa.mm | 217 ++++++++++--------------- widget/src/xpwidgets/nsNativeTheme.cpp | 75 +++++---- widget/src/xpwidgets/nsNativeTheme.h | 29 ++-- 4 files changed, 146 insertions(+), 184 deletions(-) diff --git a/widget/src/cocoa/nsNativeThemeCocoa.h b/widget/src/cocoa/nsNativeThemeCocoa.h index 47304c1e4799..7efbfb222336 100644 --- a/widget/src/cocoa/nsNativeThemeCocoa.h +++ b/widget/src/cocoa/nsNativeThemeCocoa.h @@ -51,7 +51,6 @@ @class CellDrawView; @class NSProgressBarCell; class nsDeviceContext; -struct SegmentedControlRenderSettings; class nsNativeThemeCocoa : private nsNativeTheme, public nsITheme @@ -97,9 +96,6 @@ protected: nsresult GetSystemColor(PRUint8 aWidgetType, nsILookAndFeel::nsColorID& aColorID); nsIntMargin RTLAwareMargin(const nsIntMargin& aMargin, nsIFrame* aFrame); - nsIFrame* SeparatorResponsibility(nsIFrame* aBefore, nsIFrame* aAfter); - CGRect SeparatorAdjustedRect(CGRect aRect, nsIFrame* aLeft, - nsIFrame* aCurrent, nsIFrame* aRight); // Helpers for progressbar. double GetProgressValue(nsIFrame* aFrame); @@ -112,9 +108,8 @@ protected: void DrawProgress(CGContextRef context, const HIRect& inBoxRect, PRBool inIsIndeterminate, PRBool inIsHorizontal, double inValue, double inMaxValue, nsIFrame* aFrame); - void DrawSegment(CGContextRef cgContext, const HIRect& inBoxRect, - nsEventStates inState, nsIFrame* aFrame, - const SegmentedControlRenderSettings& aSettings); + void DrawTab(CGContextRef context, HIRect inBoxRect, nsEventStates inState, + nsIFrame* aFrame); void DrawTabPanel(CGContextRef context, const HIRect& inBoxRect, nsIFrame* aFrame); void DrawScale(CGContextRef context, const HIRect& inBoxRect, nsEventStates inState, PRBool inDirection, diff --git a/widget/src/cocoa/nsNativeThemeCocoa.mm b/widget/src/cocoa/nsNativeThemeCocoa.mm index e1cd9d624363..36d24010211d 100644 --- a/widget/src/cocoa/nsNativeThemeCocoa.mm +++ b/widget/src/cocoa/nsNativeThemeCocoa.mm @@ -289,16 +289,6 @@ static NSControlSize CocoaSizeForEnum(PRInt32 enumControlSize) { return NSRegularControlSize; } -static NSString* CUIControlSizeForCocoaSize(NSControlSize aControlSize) -{ - if (aControlSize == NSRegularControlSize) - return @"regular"; - else if (aControlSize == NSSmallControlSize) - return @"small"; - else - return @"mini"; -} - static void InflateControlRect(NSRect* rect, NSControlSize cocoaControlSize, const float marginSet[][3][4]) { if (!marginSet) @@ -348,15 +338,6 @@ static BOOL FrameIsInActiveWindow(nsIFrame* aFrame) return [win isMainWindow] && ![win attachedSheet]; } -// Toolbar controls and content controls respond to different window -// activeness states. -static BOOL IsActive(nsIFrame* aFrame, BOOL aIsToolbarControl) -{ - if (aIsToolbarControl) - return [NativeWindowForFrame(aFrame) isMainWindow] || ![NSView focusView]; - return FrameIsInActiveWindow(aFrame); -} - NS_IMPL_ISUPPORTS_INHERITED1(nsNativeThemeCocoa, nsNativeTheme, nsITheme) @@ -593,7 +574,7 @@ struct CellRenderSettings { * tolerance - The tolerance as passed to DrawCellWithSnapping. * NOTE: returns NSRegularControlSize if all values in 'sizes' are zero. */ -static NSControlSize FindControlSize(CGFloat size, const CGFloat* sizes, CGFloat tolerance) +static NSControlSize FindControlSize(CGFloat size, CGFloat* sizes, CGFloat tolerance) { for (PRUint32 i = miniControlSize; i <= regularControlSize; ++i) { if (sizes[i] == 0) { @@ -1363,107 +1344,86 @@ nsNativeThemeCocoa::DrawScale(CGContextRef cgContext, const HIRect& inBoxRect, NS_OBJC_END_TRY_ABORT_BLOCK; } -nsIFrame* -nsNativeThemeCocoa::SeparatorResponsibility(nsIFrame* aBefore, nsIFrame* aAfter) -{ - // Usually a separator is drawn by the segment to the right of the - // separator, but pressed and selected segments have higher priority. - if (!aBefore || !aAfter) - return nsnull; - if (IsSelectedButton(aAfter)) - return aAfter; - if (IsSelectedButton(aBefore) || IsPressedButton(aBefore)) - return aBefore; - return aAfter; -} - -CGRect -nsNativeThemeCocoa::SeparatorAdjustedRect(CGRect aRect, nsIFrame* aLeft, - nsIFrame* aCurrent, nsIFrame* aRight) -{ - // A separator between two segments should always be located in the leftmost - // pixel column of the segment to the right of the separator, regardless of - // who ends up drawing it. - // CoreUI draws the separators inside the drawing rect. - if (aLeft && SeparatorResponsibility(aLeft, aCurrent) == aLeft) { - // The left button draws the separator, so we need to make room for it. - aRect.origin.x += 1; - aRect.size.width -= 1; - } - if (SeparatorResponsibility(aCurrent, aRight) == aCurrent) { - // We draw the right separator, so we need to extend the draw rect into the - // segment to our right. - aRect.size.width += 1; - } - return aRect; -} - -static NSString* ToolbarButtonPosition(BOOL aIsFirst, BOOL aIsLast) -{ - if (aIsFirst) { - if (aIsLast) - return @"kCUISegmentPositionOnly"; - return @"kCUISegmentPositionFirst"; - } - if (aIsLast) - return @"kCUISegmentPositionLast"; - return @"kCUISegmentPositionMiddle"; -} - -struct SegmentedControlRenderSettings { - const CGFloat* heights; - const NSString* widgetName; - const BOOL ignoresPressedWhenSelected; - const BOOL isToolbarControl; -}; - -static const CGFloat tabHeights[3] = { 17, 20, 23 }; - -static const SegmentedControlRenderSettings tabRenderSettings = { - tabHeights, @"tab", YES, NO -}; - -static const CGFloat toolbarButtonHeights[3] = { 15, 18, 22 }; - -static const SegmentedControlRenderSettings toolbarButtonRenderSettings = { - toolbarButtonHeights, @"kCUIWidgetButtonSegmentedSCurve", NO, YES -}; +#define NATURAL_MINI_TAB_BUTTON_HEIGHT 17 +#define NATURAL_SMALL_TAB_BUTTON_HEIGHT 20 +#define NATURAL_REGULAR_TAB_BUTTON_HEIGHT 23 void -nsNativeThemeCocoa::DrawSegment(CGContextRef cgContext, const HIRect& inBoxRect, - nsEventStates inState, nsIFrame* aFrame, - const SegmentedControlRenderSettings& aSettings) +nsNativeThemeCocoa::DrawTab(CGContextRef cgContext, HIRect inBoxRect, + nsEventStates inState, nsIFrame* aFrame) { - BOOL isActive = IsActive(aFrame, aSettings.isToolbarControl); - BOOL isFocused = inState.HasState(NS_EVENT_STATE_FOCUS); - BOOL isSelected = IsSelectedButton(aFrame); - BOOL isPressed = IsPressedButton(aFrame); - if (isSelected && aSettings.ignoresPressedWhenSelected) { - isPressed = NO; + NS_OBJC_BEGIN_TRY_ABORT_BLOCK; + + HIThemeTabDrawInfo tdi; + tdi.version = 1; + tdi.kind = kHIThemeTabKindNormal; + + PRBool isSelected = IsSelectedTab(aFrame); + PRBool isDisabled = IsDisabled(aFrame, inState); + + if (isSelected) { + if (isDisabled) + tdi.style = kThemeTabFrontUnavailable; + else + tdi.style = FrameIsInActiveWindow(aFrame) ? kThemeTabFront : kThemeTabFrontInactive; + } else { + if (isDisabled) + tdi.style = kThemeTabNonFrontUnavailable; + else if (inState.HasAllStates(NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_HOVER)) + tdi.style = kThemeTabNonFrontPressed; + else + tdi.style = FrameIsInActiveWindow(aFrame) ? kThemeTabNonFront : kThemeTabNonFrontInactive; } - BOOL isRTL = IsFrameRTL(aFrame); - nsIFrame* left = GetAdjacentSiblingFrameWithSameAppearance(aFrame, isRTL); - nsIFrame* right = GetAdjacentSiblingFrameWithSameAppearance(aFrame, !isRTL); - CGRect drawRect = SeparatorAdjustedRect(inBoxRect, left, aFrame, right); - BOOL drawLeftSeparator = SeparatorResponsibility(left, aFrame) == aFrame; - BOOL drawRightSeparator = SeparatorResponsibility(aFrame, right) == aFrame; - NSControlSize controlSize = FindControlSize(drawRect.size.height, aSettings.heights, 4.0f); + tdi.direction = kThemeTabNorth; + tdi.size = kHIThemeTabSizeNormal; + if (inBoxRect.size.height < NATURAL_REGULAR_TAB_BUTTON_HEIGHT) + tdi.size = kHIThemeTabSizeSmall; + if (inBoxRect.size.height < NATURAL_SMALL_TAB_BUTTON_HEIGHT) + tdi.size = kHIThemeTabSizeMini; - CUIDraw([NSWindow coreUIRenderer], drawRect, cgContext, - (CFDictionaryRef)[NSDictionary dictionaryWithObjectsAndKeys: - aSettings.widgetName, @"widget", - ToolbarButtonPosition(!left, !right), @"kCUIPositionKey", - [NSNumber numberWithBool:drawLeftSeparator], @"kCUISegmentLeadingSeparatorKey", - [NSNumber numberWithBool:drawRightSeparator], @"kCUISegmentTrailingSeparatorKey", - [NSNumber numberWithBool:isSelected], @"value", - (isPressed ? @"pressed" : (isActive ? @"normal" : @"inactive")), @"state", - [NSNumber numberWithBool:isFocused], @"focus", - CUIControlSizeForCocoaSize(controlSize), @"size", - [NSNumber numberWithBool:YES], @"is.flipped", - @"up", @"direction", - nil], - nil); + PRBool isRTL = IsFrameRTL(aFrame); + PRBool isFirst = isRTL ? IsLastTab(aFrame) : IsFirstTab(aFrame); + PRBool isLast = isRTL ? IsFirstTab(aFrame) : IsLastTab(aFrame); + + if (isFirst && isLast) + tdi.position = kHIThemeTabPositionOnly; + else if (isFirst) + tdi.position = kHIThemeTabPositionFirst; + else if (isLast) + tdi.position = kHIThemeTabPositionLast; + else + tdi.position = kHIThemeTabPositionMiddle; + + // Tab separator management: + // Normal tabs only draw their left separator, in the leftmost pixel row of + // their frame. Selected tabs additionally draw their right separator, outside + // of their frame. To prevent overlapping, the tab to the right of the + // selected tab shouldn't draw its left separator. + tdi.adornment = kHIThemeTabAdornmentNone; + if (isRTL ? IsBeforeSelectedTab(aFrame) : IsAfterSelectedTab(aFrame)) { + // On Leopard, the tab's left edge must be shifted 1px to the right. + // On Tiger, this happens automatically when no leading separator is drawn. + inBoxRect.origin.x += 1; + inBoxRect.size.width -= 1; + } + else { + tdi.adornment = kHIThemeTabAdornmentLeadingSeparator; + } + + if (isSelected && !isLast) { + tdi.adornment |= kHIThemeTabAdornmentTrailingSeparator; + // On Tiger, the right separator is drawn outside of the frame. + // On Leopard, the right edge must be shifted 1px to the right. + inBoxRect.size.width += 1; + } + + if (inState.HasState(NS_EVENT_STATE_FOCUS)) + tdi.adornment |= kThemeAdornmentFocus; + + HIThemeDrawTab(&inBoxRect, &tdi, cgContext, HITHEME_ORIENTATION, NULL); + + NS_OBJC_END_TRY_ABORT_BLOCK; } static inline UInt8 @@ -1669,6 +1629,8 @@ nsNativeThemeCocoa::DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRec if (inBoxRect.size.height < 2.0f) return; + BOOL isMain = [NativeWindowForFrame(aFrame) isMainWindow] || ![NSView focusView]; + CGContextSaveGState(cgContext); CGContextClipToRect(cgContext, inBoxRect); @@ -1683,7 +1645,7 @@ nsNativeThemeCocoa::DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRec (CFDictionaryRef)[NSDictionary dictionaryWithObjectsAndKeys: @"kCUIWidgetWindowFrame", @"widget", @"regularwin", @"windowtype", - (IsActive(aFrame, YES) ? @"normal" : @"inactive"), @"state", + (isMain ? @"normal" : @"inactive"), @"state", [NSNumber numberWithInt:inBoxRect.size.height], @"kCUIWindowFrameBottomBarHeightKey", [NSNumber numberWithBool:YES], @"kCUIWindowFrameDrawBottomBarSeparatorKey", [NSNumber numberWithBool:YES], @"is.flipped", @@ -1898,7 +1860,9 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext, break; case NS_THEME_TOOLBAR_BUTTON: - DrawSegment(cgContext, macRect, eventState, aFrame, toolbarButtonRenderSettings); + DrawButton(cgContext, kThemePushButton, macRect, + IsDefaultButton(aFrame), kThemeButtonOn, kThemeAdornmentNone, + eventState, aFrame); break; case NS_THEME_TOOLBAR_SEPARATOR: { @@ -2145,7 +2109,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext, break; case NS_THEME_TAB: - DrawSegment(cgContext, macRect, eventState, aFrame, tabRenderSettings); + DrawTab(cgContext, macRect, eventState, aFrame); break; case NS_THEME_TAB_PANELS: @@ -2198,12 +2162,6 @@ nsNativeThemeCocoa::GetWidgetBorder(nsDeviceContext* aContext, break; } - case NS_THEME_TOOLBAR_BUTTON: - { - aResult->SizeTo(4, 1, 4, 1); - break; - } - case NS_THEME_CHECKBOX: case NS_THEME_RADIO: { @@ -2320,7 +2278,6 @@ nsNativeThemeCocoa::GetWidgetOverflow(nsDeviceContext* aContext, nsIFrame* aFram { switch (aWidgetType) { case NS_THEME_BUTTON: - case NS_THEME_TOOLBAR_BUTTON: case NS_THEME_TEXTFIELD: case NS_THEME_TEXTFIELD_MULTILINE: case NS_THEME_SEARCHFIELD: @@ -2371,12 +2328,6 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsRenderingContext* aContext, break; } - case NS_THEME_TOOLBAR_BUTTON: - { - aResult->SizeTo(0, toolbarButtonHeights[miniControlSize]); - break; - } - case NS_THEME_SPINNER: { SInt32 buttonHeight = 0, buttonWidth = 0; @@ -2437,7 +2388,7 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsRenderingContext* aContext, case NS_THEME_TAB: { - aResult->SizeTo(0, tabHeights[miniControlSize]); + aResult->SizeTo(0, NATURAL_MINI_TAB_BUTTON_HEIGHT); break; } @@ -2560,6 +2511,7 @@ nsNativeThemeCocoa::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType, case NS_THEME_TOOLBOX: case NS_THEME_TOOLBAR: case NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR: + case NS_THEME_TOOLBAR_BUTTON: case NS_THEME_SCROLLBAR_TRACK_VERTICAL: case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL: case NS_THEME_STATUSBAR: @@ -2645,7 +2597,6 @@ nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* a case NS_THEME_GROUPBOX: case NS_THEME_BUTTON: case NS_THEME_BUTTON_BEVEL: - case NS_THEME_TOOLBAR_BUTTON: case NS_THEME_SPINNER: case NS_THEME_TOOLBAR: case NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR: diff --git a/widget/src/xpwidgets/nsNativeTheme.cpp b/widget/src/xpwidgets/nsNativeTheme.cpp index 0303cd2257cd..1c493dd95530 100644 --- a/widget/src/xpwidgets/nsNativeTheme.cpp +++ b/widget/src/xpwidgets/nsNativeTheme.cpp @@ -207,18 +207,6 @@ nsNativeTheme::IsButtonTypeMenu(nsIFrame* aFrame) NS_LITERAL_STRING("menu"), eCaseMatters); } -PRBool -nsNativeTheme::IsPressedButton(nsIFrame* aFrame) -{ - nsEventStates eventState = GetContentState(aFrame, NS_THEME_TOOLBAR_BUTTON); - if (IsDisabled(aFrame, eventState)) - return PR_FALSE; - - return IsOpenButton(aFrame) || - eventState.HasAllStates(NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_HOVER); -} - - PRBool nsNativeTheme::GetIndeterminate(nsIFrame* aFrame) { @@ -421,6 +409,19 @@ nsNativeTheme::IsFirstTab(nsIFrame* aFrame) return PR_FALSE; } +PRBool +nsNativeTheme::IsLastTab(nsIFrame* aFrame) +{ + if (!aFrame) + return PR_FALSE; + + while ((aFrame = aFrame->GetNextSibling())) { + if (aFrame->GetRect().width > 0 && aFrame->GetContent()->Tag() == nsWidgetAtoms::tab) + return PR_FALSE; + } + return PR_TRUE; +} + PRBool nsNativeTheme::IsHorizontal(nsIFrame* aFrame) { @@ -432,6 +433,34 @@ nsNativeTheme::IsHorizontal(nsIFrame* aFrame) eCaseMatters); } +PRBool +nsNativeTheme::IsNextToSelectedTab(nsIFrame* aFrame, PRInt32 aOffset) +{ + if (!aFrame) + return PR_FALSE; + + if (aOffset == 0) + return IsSelectedTab(aFrame); + + PRInt32 thisTabIndex = -1, selectedTabIndex = -1; + + nsIFrame* currentTab = aFrame->GetParent()->GetFirstChild(NULL); + for (PRInt32 i = 0; currentTab; currentTab = currentTab->GetNextSibling()) { + if (currentTab->GetRect().width == 0) + continue; + if (aFrame == currentTab) + thisTabIndex = i; + if (IsSelectedTab(currentTab)) + selectedTabIndex = i; + ++i; + } + + if (thisTabIndex == -1 || selectedTabIndex == -1) + return PR_FALSE; + + return (thisTabIndex - selectedTabIndex == aOffset); +} + // progressbar: PRBool nsNativeTheme::IsIndeterminateProgress(nsIFrame* aFrame, @@ -560,25 +589,3 @@ nsNativeTheme::Notify(nsITimer* aTimer) mAnimatedContentTimeout = PR_UINT32_MAX; return NS_OK; } - -nsIFrame* -nsNativeTheme::GetAdjacentSiblingFrameWithSameAppearance(nsIFrame* aFrame, - PRBool aNextSibling) -{ - if (!aFrame) - return nsnull; - - // Find the next visible sibling. - nsIFrame* sibling = aFrame; - do { - sibling = aNextSibling ? sibling->GetNextSibling() : sibling->GetPrevSibling(); - } while (sibling && sibling->GetRect().width == 0); - - // Check same appearance and adjacency. - if (!sibling || - sibling->GetStyleDisplay()->mAppearance != aFrame->GetStyleDisplay()->mAppearance || - (sibling->GetRect().XMost() != aFrame->GetRect().x && - aFrame->GetRect().XMost() != sibling->GetRect().x)) - return nsnull; - return sibling; -} diff --git a/widget/src/xpwidgets/nsNativeTheme.h b/widget/src/xpwidgets/nsNativeTheme.h index f9143d537e06..796b0c79cb18 100644 --- a/widget/src/xpwidgets/nsNativeTheme.h +++ b/widget/src/xpwidgets/nsNativeTheme.h @@ -122,22 +122,33 @@ class nsNativeTheme : public nsITimerCallback return CheckBooleanAttr(aFrame, nsWidgetAtoms::selected); } + PRBool IsNextToSelectedTab(nsIFrame* aFrame, PRInt32 aOffset); + + PRBool IsBeforeSelectedTab(nsIFrame* aFrame) { + return IsNextToSelectedTab(aFrame, -1); + } + + PRBool IsAfterSelectedTab(nsIFrame* aFrame) { + return IsNextToSelectedTab(aFrame, 1); + } + + PRBool IsLeftToSelectedTab(nsIFrame* aFrame) { + return IsFrameRTL(aFrame) ? IsAfterSelectedTab(aFrame) : IsBeforeSelectedTab(aFrame); + } + + PRBool IsRightToSelectedTab(nsIFrame* aFrame) { + return IsFrameRTL(aFrame) ? IsBeforeSelectedTab(aFrame) : IsAfterSelectedTab(aFrame); + } + // button / toolbarbutton: PRBool IsCheckedButton(nsIFrame* aFrame) { return CheckBooleanAttr(aFrame, nsWidgetAtoms::checked); } - PRBool IsSelectedButton(nsIFrame* aFrame) { - return CheckBooleanAttr(aFrame, nsWidgetAtoms::checked) || - CheckBooleanAttr(aFrame, nsWidgetAtoms::selected); - } - PRBool IsOpenButton(nsIFrame* aFrame) { return CheckBooleanAttr(aFrame, nsWidgetAtoms::open); } - PRBool IsPressedButton(nsIFrame* aFrame); - // treeheadercell: TreeSortDirection GetTreeSortDirection(nsIFrame* aFrame); PRBool IsLastTreeHeaderCell(nsIFrame* aFrame); @@ -145,6 +156,7 @@ class nsNativeTheme : public nsITimerCallback // tab: PRBool IsBottomTab(nsIFrame* aFrame); PRBool IsFirstTab(nsIFrame* aFrame); + PRBool IsLastTab(nsIFrame* aFrame); PRBool IsHorizontal(nsIFrame* aFrame); @@ -175,9 +187,6 @@ class nsNativeTheme : public nsITimerCallback PRBool QueueAnimatedContentForRefresh(nsIContent* aContent, PRUint32 aMinimumFrameRate); - nsIFrame* GetAdjacentSiblingFrameWithSameAppearance(nsIFrame* aFrame, - PRBool aNextSibling); - private: PRUint32 mAnimatedContentTimeout; nsCOMPtr mAnimatedContentTimer; From 4b4f60275ad45abaac3078ea197d93e41225b11c Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Mon, 8 Aug 2011 16:42:45 +0200 Subject: [PATCH 13/30] Bug 672050 - Add Mac rendering for -moz-appearance: toolbarbutton. r=josh --- widget/src/cocoa/nsNativeThemeCocoa.h | 9 +- widget/src/cocoa/nsNativeThemeCocoa.mm | 217 +++++++++++++++---------- widget/src/xpwidgets/nsNativeTheme.cpp | 47 ++++-- widget/src/xpwidgets/nsNativeTheme.h | 11 +- 4 files changed, 184 insertions(+), 100 deletions(-) diff --git a/widget/src/cocoa/nsNativeThemeCocoa.h b/widget/src/cocoa/nsNativeThemeCocoa.h index 7efbfb222336..47304c1e4799 100644 --- a/widget/src/cocoa/nsNativeThemeCocoa.h +++ b/widget/src/cocoa/nsNativeThemeCocoa.h @@ -51,6 +51,7 @@ @class CellDrawView; @class NSProgressBarCell; class nsDeviceContext; +struct SegmentedControlRenderSettings; class nsNativeThemeCocoa : private nsNativeTheme, public nsITheme @@ -96,6 +97,9 @@ protected: nsresult GetSystemColor(PRUint8 aWidgetType, nsILookAndFeel::nsColorID& aColorID); nsIntMargin RTLAwareMargin(const nsIntMargin& aMargin, nsIFrame* aFrame); + nsIFrame* SeparatorResponsibility(nsIFrame* aBefore, nsIFrame* aAfter); + CGRect SeparatorAdjustedRect(CGRect aRect, nsIFrame* aLeft, + nsIFrame* aCurrent, nsIFrame* aRight); // Helpers for progressbar. double GetProgressValue(nsIFrame* aFrame); @@ -108,8 +112,9 @@ protected: void DrawProgress(CGContextRef context, const HIRect& inBoxRect, PRBool inIsIndeterminate, PRBool inIsHorizontal, double inValue, double inMaxValue, nsIFrame* aFrame); - void DrawTab(CGContextRef context, HIRect inBoxRect, nsEventStates inState, - nsIFrame* aFrame); + void DrawSegment(CGContextRef cgContext, const HIRect& inBoxRect, + nsEventStates inState, nsIFrame* aFrame, + const SegmentedControlRenderSettings& aSettings); void DrawTabPanel(CGContextRef context, const HIRect& inBoxRect, nsIFrame* aFrame); void DrawScale(CGContextRef context, const HIRect& inBoxRect, nsEventStates inState, PRBool inDirection, diff --git a/widget/src/cocoa/nsNativeThemeCocoa.mm b/widget/src/cocoa/nsNativeThemeCocoa.mm index 36d24010211d..e1cd9d624363 100644 --- a/widget/src/cocoa/nsNativeThemeCocoa.mm +++ b/widget/src/cocoa/nsNativeThemeCocoa.mm @@ -289,6 +289,16 @@ static NSControlSize CocoaSizeForEnum(PRInt32 enumControlSize) { return NSRegularControlSize; } +static NSString* CUIControlSizeForCocoaSize(NSControlSize aControlSize) +{ + if (aControlSize == NSRegularControlSize) + return @"regular"; + else if (aControlSize == NSSmallControlSize) + return @"small"; + else + return @"mini"; +} + static void InflateControlRect(NSRect* rect, NSControlSize cocoaControlSize, const float marginSet[][3][4]) { if (!marginSet) @@ -338,6 +348,15 @@ static BOOL FrameIsInActiveWindow(nsIFrame* aFrame) return [win isMainWindow] && ![win attachedSheet]; } +// Toolbar controls and content controls respond to different window +// activeness states. +static BOOL IsActive(nsIFrame* aFrame, BOOL aIsToolbarControl) +{ + if (aIsToolbarControl) + return [NativeWindowForFrame(aFrame) isMainWindow] || ![NSView focusView]; + return FrameIsInActiveWindow(aFrame); +} + NS_IMPL_ISUPPORTS_INHERITED1(nsNativeThemeCocoa, nsNativeTheme, nsITheme) @@ -574,7 +593,7 @@ struct CellRenderSettings { * tolerance - The tolerance as passed to DrawCellWithSnapping. * NOTE: returns NSRegularControlSize if all values in 'sizes' are zero. */ -static NSControlSize FindControlSize(CGFloat size, CGFloat* sizes, CGFloat tolerance) +static NSControlSize FindControlSize(CGFloat size, const CGFloat* sizes, CGFloat tolerance) { for (PRUint32 i = miniControlSize; i <= regularControlSize; ++i) { if (sizes[i] == 0) { @@ -1344,86 +1363,107 @@ nsNativeThemeCocoa::DrawScale(CGContextRef cgContext, const HIRect& inBoxRect, NS_OBJC_END_TRY_ABORT_BLOCK; } -#define NATURAL_MINI_TAB_BUTTON_HEIGHT 17 -#define NATURAL_SMALL_TAB_BUTTON_HEIGHT 20 -#define NATURAL_REGULAR_TAB_BUTTON_HEIGHT 23 +nsIFrame* +nsNativeThemeCocoa::SeparatorResponsibility(nsIFrame* aBefore, nsIFrame* aAfter) +{ + // Usually a separator is drawn by the segment to the right of the + // separator, but pressed and selected segments have higher priority. + if (!aBefore || !aAfter) + return nsnull; + if (IsSelectedButton(aAfter)) + return aAfter; + if (IsSelectedButton(aBefore) || IsPressedButton(aBefore)) + return aBefore; + return aAfter; +} + +CGRect +nsNativeThemeCocoa::SeparatorAdjustedRect(CGRect aRect, nsIFrame* aLeft, + nsIFrame* aCurrent, nsIFrame* aRight) +{ + // A separator between two segments should always be located in the leftmost + // pixel column of the segment to the right of the separator, regardless of + // who ends up drawing it. + // CoreUI draws the separators inside the drawing rect. + if (aLeft && SeparatorResponsibility(aLeft, aCurrent) == aLeft) { + // The left button draws the separator, so we need to make room for it. + aRect.origin.x += 1; + aRect.size.width -= 1; + } + if (SeparatorResponsibility(aCurrent, aRight) == aCurrent) { + // We draw the right separator, so we need to extend the draw rect into the + // segment to our right. + aRect.size.width += 1; + } + return aRect; +} + +static NSString* ToolbarButtonPosition(BOOL aIsFirst, BOOL aIsLast) +{ + if (aIsFirst) { + if (aIsLast) + return @"kCUISegmentPositionOnly"; + return @"kCUISegmentPositionFirst"; + } + if (aIsLast) + return @"kCUISegmentPositionLast"; + return @"kCUISegmentPositionMiddle"; +} + +struct SegmentedControlRenderSettings { + const CGFloat* heights; + const NSString* widgetName; + const BOOL ignoresPressedWhenSelected; + const BOOL isToolbarControl; +}; + +static const CGFloat tabHeights[3] = { 17, 20, 23 }; + +static const SegmentedControlRenderSettings tabRenderSettings = { + tabHeights, @"tab", YES, NO +}; + +static const CGFloat toolbarButtonHeights[3] = { 15, 18, 22 }; + +static const SegmentedControlRenderSettings toolbarButtonRenderSettings = { + toolbarButtonHeights, @"kCUIWidgetButtonSegmentedSCurve", NO, YES +}; void -nsNativeThemeCocoa::DrawTab(CGContextRef cgContext, HIRect inBoxRect, - nsEventStates inState, nsIFrame* aFrame) +nsNativeThemeCocoa::DrawSegment(CGContextRef cgContext, const HIRect& inBoxRect, + nsEventStates inState, nsIFrame* aFrame, + const SegmentedControlRenderSettings& aSettings) { - NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - - HIThemeTabDrawInfo tdi; - tdi.version = 1; - tdi.kind = kHIThemeTabKindNormal; - - PRBool isSelected = IsSelectedTab(aFrame); - PRBool isDisabled = IsDisabled(aFrame, inState); - - if (isSelected) { - if (isDisabled) - tdi.style = kThemeTabFrontUnavailable; - else - tdi.style = FrameIsInActiveWindow(aFrame) ? kThemeTabFront : kThemeTabFrontInactive; - } else { - if (isDisabled) - tdi.style = kThemeTabNonFrontUnavailable; - else if (inState.HasAllStates(NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_HOVER)) - tdi.style = kThemeTabNonFrontPressed; - else - tdi.style = FrameIsInActiveWindow(aFrame) ? kThemeTabNonFront : kThemeTabNonFrontInactive; + BOOL isActive = IsActive(aFrame, aSettings.isToolbarControl); + BOOL isFocused = inState.HasState(NS_EVENT_STATE_FOCUS); + BOOL isSelected = IsSelectedButton(aFrame); + BOOL isPressed = IsPressedButton(aFrame); + if (isSelected && aSettings.ignoresPressedWhenSelected) { + isPressed = NO; } - tdi.direction = kThemeTabNorth; - tdi.size = kHIThemeTabSizeNormal; - if (inBoxRect.size.height < NATURAL_REGULAR_TAB_BUTTON_HEIGHT) - tdi.size = kHIThemeTabSizeSmall; - if (inBoxRect.size.height < NATURAL_SMALL_TAB_BUTTON_HEIGHT) - tdi.size = kHIThemeTabSizeMini; + BOOL isRTL = IsFrameRTL(aFrame); + nsIFrame* left = GetAdjacentSiblingFrameWithSameAppearance(aFrame, isRTL); + nsIFrame* right = GetAdjacentSiblingFrameWithSameAppearance(aFrame, !isRTL); + CGRect drawRect = SeparatorAdjustedRect(inBoxRect, left, aFrame, right); + BOOL drawLeftSeparator = SeparatorResponsibility(left, aFrame) == aFrame; + BOOL drawRightSeparator = SeparatorResponsibility(aFrame, right) == aFrame; + NSControlSize controlSize = FindControlSize(drawRect.size.height, aSettings.heights, 4.0f); - PRBool isRTL = IsFrameRTL(aFrame); - PRBool isFirst = isRTL ? IsLastTab(aFrame) : IsFirstTab(aFrame); - PRBool isLast = isRTL ? IsFirstTab(aFrame) : IsLastTab(aFrame); - - if (isFirst && isLast) - tdi.position = kHIThemeTabPositionOnly; - else if (isFirst) - tdi.position = kHIThemeTabPositionFirst; - else if (isLast) - tdi.position = kHIThemeTabPositionLast; - else - tdi.position = kHIThemeTabPositionMiddle; - - // Tab separator management: - // Normal tabs only draw their left separator, in the leftmost pixel row of - // their frame. Selected tabs additionally draw their right separator, outside - // of their frame. To prevent overlapping, the tab to the right of the - // selected tab shouldn't draw its left separator. - tdi.adornment = kHIThemeTabAdornmentNone; - if (isRTL ? IsBeforeSelectedTab(aFrame) : IsAfterSelectedTab(aFrame)) { - // On Leopard, the tab's left edge must be shifted 1px to the right. - // On Tiger, this happens automatically when no leading separator is drawn. - inBoxRect.origin.x += 1; - inBoxRect.size.width -= 1; - } - else { - tdi.adornment = kHIThemeTabAdornmentLeadingSeparator; - } - - if (isSelected && !isLast) { - tdi.adornment |= kHIThemeTabAdornmentTrailingSeparator; - // On Tiger, the right separator is drawn outside of the frame. - // On Leopard, the right edge must be shifted 1px to the right. - inBoxRect.size.width += 1; - } - - if (inState.HasState(NS_EVENT_STATE_FOCUS)) - tdi.adornment |= kThemeAdornmentFocus; - - HIThemeDrawTab(&inBoxRect, &tdi, cgContext, HITHEME_ORIENTATION, NULL); - - NS_OBJC_END_TRY_ABORT_BLOCK; + CUIDraw([NSWindow coreUIRenderer], drawRect, cgContext, + (CFDictionaryRef)[NSDictionary dictionaryWithObjectsAndKeys: + aSettings.widgetName, @"widget", + ToolbarButtonPosition(!left, !right), @"kCUIPositionKey", + [NSNumber numberWithBool:drawLeftSeparator], @"kCUISegmentLeadingSeparatorKey", + [NSNumber numberWithBool:drawRightSeparator], @"kCUISegmentTrailingSeparatorKey", + [NSNumber numberWithBool:isSelected], @"value", + (isPressed ? @"pressed" : (isActive ? @"normal" : @"inactive")), @"state", + [NSNumber numberWithBool:isFocused], @"focus", + CUIControlSizeForCocoaSize(controlSize), @"size", + [NSNumber numberWithBool:YES], @"is.flipped", + @"up", @"direction", + nil], + nil); } static inline UInt8 @@ -1629,8 +1669,6 @@ nsNativeThemeCocoa::DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRec if (inBoxRect.size.height < 2.0f) return; - BOOL isMain = [NativeWindowForFrame(aFrame) isMainWindow] || ![NSView focusView]; - CGContextSaveGState(cgContext); CGContextClipToRect(cgContext, inBoxRect); @@ -1645,7 +1683,7 @@ nsNativeThemeCocoa::DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRec (CFDictionaryRef)[NSDictionary dictionaryWithObjectsAndKeys: @"kCUIWidgetWindowFrame", @"widget", @"regularwin", @"windowtype", - (isMain ? @"normal" : @"inactive"), @"state", + (IsActive(aFrame, YES) ? @"normal" : @"inactive"), @"state", [NSNumber numberWithInt:inBoxRect.size.height], @"kCUIWindowFrameBottomBarHeightKey", [NSNumber numberWithBool:YES], @"kCUIWindowFrameDrawBottomBarSeparatorKey", [NSNumber numberWithBool:YES], @"is.flipped", @@ -1860,9 +1898,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext, break; case NS_THEME_TOOLBAR_BUTTON: - DrawButton(cgContext, kThemePushButton, macRect, - IsDefaultButton(aFrame), kThemeButtonOn, kThemeAdornmentNone, - eventState, aFrame); + DrawSegment(cgContext, macRect, eventState, aFrame, toolbarButtonRenderSettings); break; case NS_THEME_TOOLBAR_SEPARATOR: { @@ -2109,7 +2145,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext, break; case NS_THEME_TAB: - DrawTab(cgContext, macRect, eventState, aFrame); + DrawSegment(cgContext, macRect, eventState, aFrame, tabRenderSettings); break; case NS_THEME_TAB_PANELS: @@ -2162,6 +2198,12 @@ nsNativeThemeCocoa::GetWidgetBorder(nsDeviceContext* aContext, break; } + case NS_THEME_TOOLBAR_BUTTON: + { + aResult->SizeTo(4, 1, 4, 1); + break; + } + case NS_THEME_CHECKBOX: case NS_THEME_RADIO: { @@ -2278,6 +2320,7 @@ nsNativeThemeCocoa::GetWidgetOverflow(nsDeviceContext* aContext, nsIFrame* aFram { switch (aWidgetType) { case NS_THEME_BUTTON: + case NS_THEME_TOOLBAR_BUTTON: case NS_THEME_TEXTFIELD: case NS_THEME_TEXTFIELD_MULTILINE: case NS_THEME_SEARCHFIELD: @@ -2328,6 +2371,12 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsRenderingContext* aContext, break; } + case NS_THEME_TOOLBAR_BUTTON: + { + aResult->SizeTo(0, toolbarButtonHeights[miniControlSize]); + break; + } + case NS_THEME_SPINNER: { SInt32 buttonHeight = 0, buttonWidth = 0; @@ -2388,7 +2437,7 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsRenderingContext* aContext, case NS_THEME_TAB: { - aResult->SizeTo(0, NATURAL_MINI_TAB_BUTTON_HEIGHT); + aResult->SizeTo(0, tabHeights[miniControlSize]); break; } @@ -2511,7 +2560,6 @@ nsNativeThemeCocoa::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType, case NS_THEME_TOOLBOX: case NS_THEME_TOOLBAR: case NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR: - case NS_THEME_TOOLBAR_BUTTON: case NS_THEME_SCROLLBAR_TRACK_VERTICAL: case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL: case NS_THEME_STATUSBAR: @@ -2597,6 +2645,7 @@ nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* a case NS_THEME_GROUPBOX: case NS_THEME_BUTTON: case NS_THEME_BUTTON_BEVEL: + case NS_THEME_TOOLBAR_BUTTON: case NS_THEME_SPINNER: case NS_THEME_TOOLBAR: case NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR: diff --git a/widget/src/xpwidgets/nsNativeTheme.cpp b/widget/src/xpwidgets/nsNativeTheme.cpp index 1c493dd95530..ff6481bf261d 100644 --- a/widget/src/xpwidgets/nsNativeTheme.cpp +++ b/widget/src/xpwidgets/nsNativeTheme.cpp @@ -207,6 +207,18 @@ nsNativeTheme::IsButtonTypeMenu(nsIFrame* aFrame) NS_LITERAL_STRING("menu"), eCaseMatters); } +PRBool +nsNativeTheme::IsPressedButton(nsIFrame* aFrame) +{ + nsEventStates eventState = GetContentState(aFrame, NS_THEME_TOOLBAR_BUTTON); + if (IsDisabled(aFrame, eventState)) + return PR_FALSE; + + return IsOpenButton(aFrame) || + eventState.HasAllStates(NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_HOVER); +} + + PRBool nsNativeTheme::GetIndeterminate(nsIFrame* aFrame) { @@ -409,19 +421,6 @@ nsNativeTheme::IsFirstTab(nsIFrame* aFrame) return PR_FALSE; } -PRBool -nsNativeTheme::IsLastTab(nsIFrame* aFrame) -{ - if (!aFrame) - return PR_FALSE; - - while ((aFrame = aFrame->GetNextSibling())) { - if (aFrame->GetRect().width > 0 && aFrame->GetContent()->Tag() == nsWidgetAtoms::tab) - return PR_FALSE; - } - return PR_TRUE; -} - PRBool nsNativeTheme::IsHorizontal(nsIFrame* aFrame) { @@ -589,3 +588,25 @@ nsNativeTheme::Notify(nsITimer* aTimer) mAnimatedContentTimeout = PR_UINT32_MAX; return NS_OK; } + +nsIFrame* +nsNativeTheme::GetAdjacentSiblingFrameWithSameAppearance(nsIFrame* aFrame, + PRBool aNextSibling) +{ + if (!aFrame) + return nsnull; + + // Find the next visible sibling. + nsIFrame* sibling = aFrame; + do { + sibling = aNextSibling ? sibling->GetNextSibling() : sibling->GetPrevSibling(); + } while (sibling && sibling->GetRect().width == 0); + + // Check same appearance and adjacency. + if (!sibling || + sibling->GetStyleDisplay()->mAppearance != aFrame->GetStyleDisplay()->mAppearance || + (sibling->GetRect().XMost() != aFrame->GetRect().x && + aFrame->GetRect().XMost() != sibling->GetRect().x)) + return nsnull; + return sibling; +} diff --git a/widget/src/xpwidgets/nsNativeTheme.h b/widget/src/xpwidgets/nsNativeTheme.h index 796b0c79cb18..747274e4cf24 100644 --- a/widget/src/xpwidgets/nsNativeTheme.h +++ b/widget/src/xpwidgets/nsNativeTheme.h @@ -145,10 +145,17 @@ class nsNativeTheme : public nsITimerCallback return CheckBooleanAttr(aFrame, nsWidgetAtoms::checked); } + PRBool IsSelectedButton(nsIFrame* aFrame) { + return CheckBooleanAttr(aFrame, nsWidgetAtoms::checked) || + CheckBooleanAttr(aFrame, nsWidgetAtoms::selected); + } + PRBool IsOpenButton(nsIFrame* aFrame) { return CheckBooleanAttr(aFrame, nsWidgetAtoms::open); } + PRBool IsPressedButton(nsIFrame* aFrame); + // treeheadercell: TreeSortDirection GetTreeSortDirection(nsIFrame* aFrame); PRBool IsLastTreeHeaderCell(nsIFrame* aFrame); @@ -156,7 +163,6 @@ class nsNativeTheme : public nsITimerCallback // tab: PRBool IsBottomTab(nsIFrame* aFrame); PRBool IsFirstTab(nsIFrame* aFrame); - PRBool IsLastTab(nsIFrame* aFrame); PRBool IsHorizontal(nsIFrame* aFrame); @@ -187,6 +193,9 @@ class nsNativeTheme : public nsITimerCallback PRBool QueueAnimatedContentForRefresh(nsIContent* aContent, PRUint32 aMinimumFrameRate); + nsIFrame* GetAdjacentSiblingFrameWithSameAppearance(nsIFrame* aFrame, + PRBool aNextSibling); + private: PRUint32 mAnimatedContentTimeout; nsCOMPtr mAnimatedContentTimer; From f368ea66e77b2671a4761ef375c4407c0440472f Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Mon, 8 Aug 2011 16:43:04 +0200 Subject: [PATCH 14/30] Bug 667480 - Use -moz-appearance: toolbarbutton throughout the Mac theme. r=dao --- browser/base/content/browser.xul | 2 +- .../themes/pinstripe/browser/Toolbar-lion.png | Bin 0 -> 6479 bytes browser/themes/pinstripe/browser/browser.css | 112 +++++++++--------- browser/themes/pinstripe/browser/jar.mn | 6 + .../pinstripe/browser/keyhole-circle-lion.png | Bin 0 -> 2261 bytes .../pinstripe/browser/keyhole-circle.png | Bin 0 -> 2262 bytes .../pinstripe/browser/places/organizer.css | 35 +----- .../pinstripe/global/console/console.css | 19 +-- toolkit/themes/pinstripe/global/shared.inc | 5 - .../themes/pinstripe/global/toolbarbutton.css | 8 +- .../themes/pinstripe/global/viewbuttons.css | 68 +---------- .../pinstripe/mozapps/downloads/downloads.css | 28 +---- .../pinstripe/mozapps/update/updates.css | 29 +---- 13 files changed, 78 insertions(+), 234 deletions(-) create mode 100644 browser/themes/pinstripe/browser/Toolbar-lion.png create mode 100644 browser/themes/pinstripe/browser/keyhole-circle-lion.png create mode 100644 browser/themes/pinstripe/browser/keyhole-circle.png diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index a278874bd4dc..430861e2982f 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -1008,7 +1008,7 @@ - + diff --git a/browser/themes/pinstripe/browser/Toolbar-lion.png b/browser/themes/pinstripe/browser/Toolbar-lion.png new file mode 100644 index 0000000000000000000000000000000000000000..a65aa30ebae6c314bccd897862be400e27c7afab GIT binary patch literal 6479 zcmY*;Wl$SH*DhY5I7N#VD^5yrcP$X0xD_p=5Zoa^C@#gJxNFf;+#LcGcZX2iCFsZd zes}KN`^@Z~GqbZZXCL{s;TmcRxY(4~NJvPyN{X_YNJz-AmtGVT?PZq|kj{B2SdNPN zE=WkPiT|^Zk$z^7BOy^BE6GY}doCUsV;O1b&O#J{OU>HLdfj+fhM2W1hd%S~2qdK> zNh3EKf4i0Dlk~cU%=+6GZ)q-lh)G%$4vSgL$+WXCNB!fT@kdxK^23!&$)<*6IA&MY zNo&fFRz~hF1mD!&$^FVRB9QwebNTAwMC@jDATAH{|Kh2mYj#fUY;D*_el%9iyg~*l zgUUBs5mVn|qn1N@FH_&UAGnc5g^P+^fy>=^0P{>DmIV90&@&Pk+2cuSO8oE#yJf2bp-$~&GYWaQFl zo${rKg_f^X!0H^vcjw{CxvOErCD39Q%5{GvVKXZ@y=U;_n4Z`mg{p-rR;Z!||4ASr z+w!2X$8Db4|L3qO;Uew!iX+A2BPAmJhnA`_^n-A$?bpc z|K@s_2^$R4DPPr_g@X@Obe6^&NpY z8o(y(C?<_+EoPJ;R=iHA(&g=CR|MwSz^mm~D=}E7rZRjcNg|E7dnJ1WJBufHqGMxe z`~RK_38XcG*PnK@6}0rp)QF|uGtd*1Y|qw=pGiW8MEpE)->jysRnzaVOPnIzQ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mOcW-vI}|1h+uFq`@k z91knh?O*lPsU#ORcKVV>7JTey?`6j#5c%q=Sp5$*gbQXc+98_%x)Sw8Gebq%lojs5Z8jNXzxi{lKki~0FbO!>)W8fRd(P1o_{ZW z5h+bC&F978Ii$%eFfoCN_wd+%J7u8AjuE(TxL@>#`2Wh hetN0vEd9^O&)D1@xrQ4zFFzzmN^)wlmC|NG{{t$Is#O30 literal 0 HcmV?d00001 diff --git a/browser/themes/pinstripe/browser/browser.css b/browser/themes/pinstripe/browser/browser.css index 707a0bda03f6..69b707f03d94 100644 --- a/browser/themes/pinstripe/browser/browser.css +++ b/browser/themes/pinstripe/browser/browser.css @@ -293,21 +293,22 @@ toolbarbutton.bookmark-item > menupopup { .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker, #restore-button { -moz-box-orient: vertical; - padding: 0 3px; + -moz-appearance: toolbarbutton; height: 22px; - border: 1px solid @toolbarbuttonBorderColor@; - border-radius: @toolbarbuttonCornerRadius@; - box-shadow: 0 1px rgba(255, 255, 255, 0.2); - background: @toolbarbuttonBackground@; - background-origin: border-box; + padding: 0; + border: 0; } .toolbarbutton-1:not([type="menu-button"]):-moz-lwtheme, .toolbarbutton-1 > .toolbarbutton-menubutton-button:-moz-lwtheme, .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker:-moz-lwtheme, #restore-button:-moz-lwtheme { - border-color: rgba(0, 0, 0, 0.4); - background-image: -moz-linear-gradient(rgba(255,255,255,0.5), rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.2)); + -moz-appearance: none; + padding: 0 3px; + border: 1px solid rgba(0, 0, 0, 0.4); + border-radius: @toolbarbuttonCornerRadius@; + background: -moz-linear-gradient(rgba(255,255,255,0.5), rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.2)) repeat-x; + background-origin: border-box; box-shadow: inset 0 1px rgba(255,255,255,0.3), 0 1px rgba(255,255,255,0.2); } @@ -337,6 +338,7 @@ toolbar:not([mode="icons"]) .toolbarbutton-1:not([type="menu-button"]), toolbar:not([mode="icons"]) .toolbarbutton-1 > .toolbarbutton-menubutton-button, toolbar:not([mode="icons"]) .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker, toolbar:not([mode="icons"]) #restore-button { + -moz-appearance: none; padding: 0; height: auto; border: none; @@ -408,16 +410,6 @@ toolbar:not([mode="icons"]) .toolbarbutton-1:not([open="true"]) > .toolbarbutton margin: 2px 0 0; } -toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not([disabled="true"]):active:hover:not(:-moz-lwtheme), -toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"])[open="true"]:not(:-moz-lwtheme), -toolbar[mode="icons"] .toolbarbutton-1:not([disabled="true"]) > .toolbarbutton-menubutton-button:active:hover:not(:-moz-lwtheme), -toolbar[mode="icons"] .toolbarbutton-1[open="true"] > .toolbarbutton-menubutton-dropmarker:not(:-moz-lwtheme), -toolbar[mode="icons"] #restore-button:not([disabled="true"]):active:hover:not(:-moz-lwtheme) { - background: @toolbarbuttonPressedBackgroundColor@; - text-shadow: @loweredShadow@; - box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@; -} - toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not([disabled="true"]):active:hover:-moz-lwtheme, toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"])[open="true"]:-moz-lwtheme, toolbar[mode="icons"] .toolbarbutton-1:not([disabled="true"]) > .toolbarbutton-menubutton-button:active:hover:-moz-lwtheme, @@ -428,39 +420,16 @@ toolbar[mode="icons"] #restore-button:not([disabled="true"]):active:hover:-moz-l box-shadow: inset 0 2px 5px rgba(0,0,0,0.6), 0 1px rgba(255,255,255,0.2); } -toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not(#fullscreen-button)[checked="true"]:not(:-moz-lwtheme) { - background: #606060; - box-shadow: inset #2A2A2A 0 3px 3.5px, @loweredShadow@; -} - toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not(#fullscreen-button)[checked="true"]:-moz-lwtheme { background-color: rgba(0,0,0,0.4); box-shadow: inset 0 2px 5px rgba(0,0,0,0.7), 0 1px rgba(255,255,255,0.2); } -toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not(#fullscreen-button)[checked="true"]:not([disabled="true"]):active:hover:not(:-moz-lwtheme) { - background: #4E4E4E; - box-shadow: inset #1c1c1c 0 3px 3.5px; -} - toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not(#fullscreen-button)[checked="true"]:not([disabled="true"]):active:hover:-moz-lwtheme { background-color: rgba(0, 0, 0, 0.6); box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.8), 0 1px rgba(255, 255, 255, 0.2); } -toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):-moz-window-inactive:not(:-moz-lwtheme), -toolbar[mode="icons"] .toolbarbutton-1 > .toolbarbutton-menubutton-button:-moz-window-inactive:not(:-moz-lwtheme), -toolbar[mode="icons"] .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker:-moz-window-inactive:not(:-moz-lwtheme), -toolbar[mode="icons"] #restore-button:-moz-window-inactive:not(:-moz-lwtheme) { - border-color: @toolbarbuttonInactiveBorderColor@; - background-image: @toolbarbuttonInactiveBackgroundImage@; -} - -toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]):not(#fullscreen-button)[checked="true"]:-moz-window-inactive { - background: #8E8E8E; - box-shadow: inset rgba(0, 0, 0, 0.5) 0 3px 3.5px, @loweredShadow@; -} - toolbar[mode="icons"] .toolbarbutton-1 > menupopup { margin-top: 1px; } @@ -477,17 +446,28 @@ toolbar[mode="icons"] .toolbarbutton-1 > menupopup { } #back-button, -toolbar:not([mode="icons"]) #forward-button:-moz-locale-dir(rtl) { +#forward-button:-moz-locale-dir(rtl), +toolbar[mode="icons"] #back-button:-moz-locale-dir(rtl):-moz-lwtheme { -moz-image-region: rect(0, 40px, 20px, 20px); } #forward-button, -toolbar:not([mode="icons"]) #back-button:-moz-locale-dir(rtl) { +#back-button:-moz-locale-dir(rtl), +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button:-moz-locale-dir(rtl), +toolbar[mode="icons"] #forward-button:-moz-locale-dir(rtl):-moz-lwtheme { -moz-image-region: rect(0, 60px, 20px, 40px); } +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button:-moz-locale-dir(rtl), +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button:-moz-locale-dir(rtl), +toolbar[mode="icons"] #back-button:-moz-locale-dir(rtl):-moz-lwtheme, +toolbar[mode="icons"] #forward-button:-moz-locale-dir(rtl):-moz-lwtheme { + -moz-transform: scaleX(-1); +} + #navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button { - -moz-margin-end: -5px; + -moz-appearance: none; + -moz-margin-end: -7px; position: relative; z-index: 1; -moz-image-region: rect(0, 20px, 20px, 0); @@ -497,31 +477,45 @@ toolbar:not([mode="icons"]) #back-button:-moz-locale-dir(rtl) { border-radius: 10000px; } -toolbar[mode="icons"] #back-button:-moz-locale-dir(rtl), -toolbar[mode="icons"] #forward-button:-moz-locale-dir(rtl) { - -moz-transform: scaleX(-1); +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button:not(:-moz-lwtheme) { + height: 31px; + padding: 4px 5px 5px 3px; + margin-bottom: -1px; + background: url(chrome://browser/skin/keyhole-circle.png) 0 0 no-repeat; +} + +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button:-moz-window-inactive:not(:-moz-lwtheme) { + background-position: -60px 0; +} + +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button:not([disabled="true"]):active:hover:not(:-moz-lwtheme), +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button[open="true"]:not(:-moz-lwtheme) { + background-position: -30px 0; } toolbar[mode="icons"] #forward-button { -moz-margin-start: 0; } -#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button { - /* 1px to the right */ - padding-left: 4px; - padding-right: 2px; +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button > .toolbarbutton-icon { + /* shift the icon away from the back button */ + margin-left: 3px; + margin-right: -1px; } -#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button:-moz-lwtheme { +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button { mask: url(chrome://browser/content/browser.xul#pinstripe-keyhole-forward-mask); } #navigator-toolbox[iconsize="small"][mode="icons"] > #nav-bar #forward-button { width: 27px; +} + +#navigator-toolbox[iconsize="small"][mode="icons"] > #nav-bar #forward-button:-moz-lwtheme { padding-left: 2px; } -toolbar[mode="icons"] #forward-button { +toolbar[mode="icons"] #forward-button:-moz-lwtheme { border-top-left-radius: 0; border-bottom-left-radius: 0; } @@ -529,6 +523,9 @@ toolbar[mode="icons"] #forward-button { #navigator-toolbox[iconsize="small"][mode="icons"] > #nav-bar #back-button { -moz-margin-end: 0; width: 26px; +} + +#navigator-toolbox[iconsize="small"][mode="icons"] > #nav-bar #back-button:-moz-lwtheme { padding-right: 2px; border-right-width: 0; border-top-right-radius: 0; @@ -1956,11 +1953,12 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker { :-moz-any(#TabsToolbar, #addon-bar) .toolbarbutton-1, :-moz-any(#TabsToolbar, #addon-bar) .toolbarbutton-1 > .toolbarbutton-menubutton-button, :-moz-any(#TabsToolbar, #addon-bar) .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker { - margin: 0; - padding: 0; - border: none; - border-radius: 0; + -moz-appearance: none; /* !important flags needed because of bug 561154: */ + margin: 0 !important; + padding: 0 !important; + border: none !important; + border-radius: 0 !important; background: none !important; box-shadow: none !important; } diff --git a/browser/themes/pinstripe/browser/jar.mn b/browser/themes/pinstripe/browser/jar.mn index d1952b88f933..6c982967e16d 100644 --- a/browser/themes/pinstripe/browser/jar.mn +++ b/browser/themes/pinstripe/browser/jar.mn @@ -42,6 +42,7 @@ browser.jar: skin/classic/browser/section_collapsed-rtl.png skin/classic/browser/section_expanded.png skin/classic/browser/Secure-Glyph-White.png + skin/classic/browser/keyhole-circle.png skin/classic/browser/Toolbar.png skin/classic/browser/toolbarbutton-dropmarker.png skin/classic/browser/urlbar-arrow.png @@ -134,3 +135,8 @@ browser.jar: skin/classic/browser/syncCommon.css skin/classic/browser/syncQuota.css #endif + skin/classic/browser/lion/keyhole-circle.png (keyhole-circle-lion.png) + skin/classic/browser/lion/Toolbar.png (Toolbar-lion.png) + +% override chrome://browser/skin/keyhole-circle.png chrome://browser/skin/lion/keyhole-circle.png os=Darwin osversion>=10.7 +% override chrome://browser/skin/Toolbar.png chrome://browser/skin/lion/Toolbar.png os=Darwin osversion>=10.7 diff --git a/browser/themes/pinstripe/browser/keyhole-circle-lion.png b/browser/themes/pinstripe/browser/keyhole-circle-lion.png new file mode 100644 index 0000000000000000000000000000000000000000..f164d498c351e2541fadcbfb9b1e7a8334a7e581 GIT binary patch literal 2261 zcmV;`2rBo9P)h%KvV)G3Kc3CL=okdq``t35>qGGxr{Gye4G26%ig;WLvi9uJQJj@ z^)%A?&iZHVwf0(vV5M1TMGKOMBMhK|9Of~DDU`9keG}GzjVLUHAOQHNqKqO6@RmPF zmi>0n)z$su%)zG3DLZLK0Jl__zc~BO+@B}L&SMM)u8 zkmKvHVKfc2{bI|vHYP%0Vo1Pa6}?#fIQxe$PflVEm9<6p-oESctq0nZ?eL+XpaBq2 zP>A`<|GfO`3!e<*+!|qfjqQ|$tENvBQAF2RO*GZi6_t>Z-WO}K=_6gg+TGn0pTI0~ zD4+@;1RHUra+&jUzxnsy#&C5t(H3?+*8h{vjh*lyp;w#;gOMHo)A*C8FudZhE$lM7 zBE^VD1Lm`UDynLkR#Z{RrBJ+Nl%n3)Dy%@;v-|Gf+HxLQTwCQ2HDlvU_uz$Nr!fit zM$uMy?}>d6?TAF+uMoT>T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~tOgDj-J!ZU^Bah&dqQkz7Vwb~KeEH2l!S{}fAS}o<;X0gzkVxGKsn{eaM zP+OxBnj5D!GfmhAc`<~WBIYNgZ8GiT4pH}}q_h|hR_|xiphWSFLb!^!bXFlVk6GR8dl6=&=8c z+3B#?7%EEcel+D`3%{{tiQUoofjThu4O5~E3LlznRgb-(wm|}{nRtc}sq}Y2OSLRpgHI{qujK)%>ugt&q@zhu$ zZ7j`Hea5EHxpjqB^or1xIW@<3B~tJio2kN5O#9gc{$qi=WD;G3Io_U%1GK6#d`HMg zJAhQg+at^p-7eW!;IuzWv25VQ1Lw6Dhqa?!n2vVz;xNq~U}uPR)%NWTJ6poouc`iu zsZ*$>u1rnZcla7%?9P_k8{D-#E%x2w5UDbxGt~5@RchP8?dEs$J2-aWSW33-i50Uj~d$8wNVJE?oC!ffbiCxjgFgBPE z=0n+NV`7(F`Q#HU!93AyvGcK{ZcSQBj4G@tsAt{ay1}5Hu%;MQT1wp-ik&}KZ13v& z toolbarbutton { list-style-image: url("chrome://browser/skin/places/toolbar.png"); margin: 4px 4px 5px; - padding: 1px 3px; - border: 1px solid @toolbarbuttonBorderColor@; - border-radius: @toolbarbuttonCornerRadius@; - box-shadow: @loweredShadow@; - background: @toolbarbuttonBackground@; - background-origin: border-box; -} - -#placesToolbar > toolbarbutton:not([disabled="true"]):active:hover, -#placesToolbar > toolbarbutton[open="true"] { - background: @toolbarbuttonPressedBackgroundColor@; - text-shadow: @loweredShadow@; - box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@; -} - -#placesToolbar > toolbarbutton:-moz-focusring { - border-color: @toolbarbuttonFocusedBorderColorAqua@; - box-shadow: @focusRingShadow@; -} - -#placesToolbar > toolbarbutton:-moz-system-metric(mac-graphite-theme):-moz-focusring { - border-color: @toolbarbuttonFocusedBorderColorGraphite@; -} - -#placesToolbar > toolbarbutton:-moz-window-inactive { - border-color: @toolbarbuttonInactiveBorderColor@; - background-image: @toolbarbuttonInactiveBackgroundImage@; + padding: 0; + height: 22px; + -moz-appearance: toolbarbutton; } #placesToolbar > toolbarbutton[disabled="true"] > .toolbarbutton-icon { @@ -136,17 +112,12 @@ #back-button:-moz-locale-dir(ltr), #forward-button:-moz-locale-dir(rtl) { -moz-image-region: rect(0px, 16px, 16px, 0px); - border-top-right-radius: 0; - border-bottom-right-radius: 0; margin-right: 0; - border-right: 0; } #forward-button:-moz-locale-dir(ltr), #back-button:-moz-locale-dir(rtl) { -moz-image-region: rect(0px, 32px, 16px, 16px); - border-top-left-radius: 0; - border-bottom-left-radius: 0; margin-left: 0; } diff --git a/toolkit/themes/pinstripe/global/console/console.css b/toolkit/themes/pinstripe/global/console/console.css index 81aa306b44c0..0d45266c2e44 100644 --- a/toolkit/themes/pinstripe/global/console/console.css +++ b/toolkit/themes/pinstripe/global/console/console.css @@ -203,24 +203,9 @@ toolbarseparator { #Console\:clear { -moz-box-orient: vertical; -moz-box-align: center; + -moz-appearance: toolbarbutton; font: menu; text-shadow: @loweredShadow@; margin: 4px 0 9px; - padding: 0 4px; - border: 1px solid @toolbarbuttonBorderColor@; - border-radius: @toolbarbuttonCornerRadius@; - box-shadow: @loweredShadow@; - background: @toolbarbuttonBackground@; - background-origin: border-box; -} - -#Console\:clear:active:hover { - background: @toolbarbuttonPressedBackgroundColor@; - text-shadow: @loweredShadow@; - box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@; -} - -#Console\:clear:-moz-window-inactive { - border-color: @toolbarbuttonInactiveBorderColor@; - background-image: @toolbarbuttonInactiveBackgroundImage@; + padding: 0 1px; } diff --git a/toolkit/themes/pinstripe/global/shared.inc b/toolkit/themes/pinstripe/global/shared.inc index e57d9c3e6b2a..50b5761aba52 100644 --- a/toolkit/themes/pinstripe/global/shared.inc +++ b/toolkit/themes/pinstripe/global/shared.inc @@ -24,12 +24,7 @@ %define sidebarItemInactiveBorderTop 1px solid #979797 %define sidebarItemInactiveBackground -moz-linear-gradient(top, #B4B4B4, #8A8A8A) repeat-x -%define toolbarbuttonBorderColor rgba(59, 59, 59, 0.9) %define toolbarbuttonCornerRadius 3px %define toolbarbuttonBackground -moz-linear-gradient(top, #FFF, #ADADAD) repeat-x -%define toolbarbuttonFocusedBorderColorAqua rgba(102, 122, 155, 0.9) -%define toolbarbuttonFocusedBorderColorGraphite rgba(59, 59, 59, 0.7) %define toolbarbuttonPressedInnerShadow inset rgba(0, 0, 0, 0.3) 0 -6px 10px, inset #000 0 1px 3px, inset rgba(0, 0, 0, 0.2) 0 1px 3px -%define toolbarbuttonPressedBackgroundColor #B5B5B5 %define toolbarbuttonInactiveBorderColor rgba(146, 146, 146, 0.84) -%define toolbarbuttonInactiveBackgroundImage -moz-linear-gradient(top, #FFF, #CCC) diff --git a/toolkit/themes/pinstripe/global/toolbarbutton.css b/toolkit/themes/pinstripe/global/toolbarbutton.css index a5e18bbfb15e..9cd726ef231f 100644 --- a/toolkit/themes/pinstripe/global/toolbarbutton.css +++ b/toolkit/themes/pinstripe/global/toolbarbutton.css @@ -86,13 +86,15 @@ toolbarbutton[checked="true"] { border: none !important; background-color: transparent !important; list-style-image: url("chrome://global/skin/arrow/arrow-dn.png"); - padding: 0 0 0 2px; + padding: 0; + -moz-padding-start: 2px; width: auto; } .toolbarbutton-menu-dropmarker[disabled="true"] { list-style-image: url("chrome://global/skin/arrow/arrow-dn-dis.png"); - padding: 0 0 0 2px !important; + padding: 0; + -moz-padding-start: 2px; } /* ::::: toolbarbutton menu-button ::::: */ @@ -122,7 +124,7 @@ toolbarbutton[type="menu-button"][disabled="true"]:hover:active { /* .......... dropmarker .......... */ .toolbarbutton-menubutton-dropmarker { - -moz-appearance: none !important; + -moz-appearance: none; border: none; background-color: transparent !important; list-style-image: url("chrome://global/skin/arrow/arrow-dn.png"); diff --git a/toolkit/themes/pinstripe/global/viewbuttons.css b/toolkit/themes/pinstripe/global/viewbuttons.css index 7601582d56fa..3c67ca89de75 100644 --- a/toolkit/themes/pinstripe/global/viewbuttons.css +++ b/toolkit/themes/pinstripe/global/viewbuttons.css @@ -46,10 +46,6 @@ } #viewGroup { - background-color: rgba(0, 0, 0, 0.55); - padding: 1px; - border-radius: @toolbarbuttonCornerRadius@; - box-shadow: @loweredShadow@; margin: 4px 0 9px; } @@ -57,74 +53,16 @@ #viewGroup > toolbarbutton { -moz-box-orient: vertical; -moz-box-align: center; - -moz-appearance: none; + -moz-appearance: toolbarbutton; font: menu; text-shadow: @loweredShadow@; margin: 0; - padding: 0 4px; - border: none; - border-left: 1px solid rgba(0, 0, 0, 0.8); - background: @toolbarbuttonBackground@; -} - -#viewGroup > radio:active:hover, -#viewGroup > toolbarbutton:active:hover { - background: @toolbarbuttonPressedBackgroundColor@; - text-shadow: @loweredShadow@; - box-shadow: @toolbarbuttonPressedInnerShadow@; + padding: 0 1px; + height: 22px; } #viewGroup > radio[selected=true], #viewGroup > toolbarbutton[checked=true] { color: #FFF !important; text-shadow: rgba(0, 0, 0, 0.4) 0 1px; - background: #606060; - box-shadow: inset #2A2A2A 0 3px 3.5px; -} - -#viewGroup > radio[selected=true]:active:hover, -#viewGroup > toolbarbutton[checked=true]:active:hover { - background-color: #4E4E4E; - box-shadow: inset #1c1c1c 0 3px 3.5px; -} - -#viewGroup:-moz-window-inactive { - background-color: rgba(0, 0, 0, 0.25); -} - -#viewGroup > radio:-moz-window-inactive, -#viewGroup > toolbarbutton:-moz-window-inactive { - border-color: rgba(0, 0, 0, 0.4); - background-image: @toolbarbuttonInactiveBackgroundImage@; -} - -#viewGroup > radio[selected=true]:-moz-window-inactive, -#viewGroup > toolbarbutton[checked=true]:-moz-window-inactive { - background: #8E8E8E; - box-shadow: inset rgba(0, 0, 0, 0.5) 0 3px 3.5px; -} - -#viewGroup > radio:-moz-locale-dir(ltr):first-child, -#viewGroup > radio:-moz-locale-dir(ltr)[first-visible], -#viewGroup > radio:-moz-locale-dir(rtl):last-child, -#viewGroup > radio:-moz-locale-dir(rtl)[last-visible], -#viewGroup > toolbarbutton:-moz-locale-dir(ltr):first-child, -#viewGroup > toolbarbutton:-moz-locale-dir(ltr)[first-visible], -#viewGroup > toolbarbutton:-moz-locale-dir(rtl):last-child, -#viewGroup > toolbarbutton:-moz-locale-dir(rtl)[last-visible] { - border-top-left-radius: 2px; - border-bottom-left-radius: 2px; - border-left: none !important; -} - -#viewGroup > radio:-moz-locale-dir(ltr):last-child, -#viewGroup > radio:-moz-locale-dir(ltr)[last-visible], -#viewGroup > radio:-moz-locale-dir(rtl):first-child, -#viewGroup > radio:-moz-locale-dir(rtl)[first-visible], -#viewGroup > toolbarbutton:-moz-locale-dir(ltr):last-child, -#viewGroup > toolbarbutton:-moz-locale-dir(ltr)[last-visible], -#viewGroup > toolbarbutton:-moz-locale-dir(rtl):first-child, -#viewGroup > toolbarbutton:-moz-locale-dir(rtl)[first-visible] { - border-top-right-radius: 2px; - border-bottom-right-radius: 2px; } diff --git a/toolkit/themes/pinstripe/mozapps/downloads/downloads.css b/toolkit/themes/pinstripe/mozapps/downloads/downloads.css index 0b783b573788..0ba68922d72a 100644 --- a/toolkit/themes/pinstripe/mozapps/downloads/downloads.css +++ b/toolkit/themes/pinstripe/mozapps/downloads/downloads.css @@ -111,35 +111,9 @@ richlistitem[type="download"] button { } #clearListButton { - -moz-appearance: none; + -moz-appearance: toolbarbutton; min-height: 18px; min-width: 0; margin: 0 6px; - padding: 0 2px; text-shadow: @loweredShadow@; - border: 1px solid @toolbarbuttonBorderColor@; - border-radius: @toolbarbuttonCornerRadius@; - box-shadow: @loweredShadow@; - background: @toolbarbuttonBackground@; - background-origin: border-box; -} - -#clearListButton:hover:active:not([disabled="true"]) { - background: @toolbarbuttonPressedBackgroundColor@; - text-shadow: @loweredShadow@; - box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@; -} - -#clearListButton:-moz-focusring { - border-color: @toolbarbuttonFocusedBorderColorAqua@; - box-shadow: @focusRingShadow@; -} - -#clearListButton:-moz-system-metric(mac-graphite-theme):-moz-focusring { - border-color: @toolbarbuttonFocusedBorderColorGraphite@; -} - -#clearListButton:-moz-window-inactive { - border-color: @toolbarbuttonInactiveBorderColor@; - background-image: @toolbarbuttonInactiveBackgroundImage@; } diff --git a/toolkit/themes/pinstripe/mozapps/update/updates.css b/toolkit/themes/pinstripe/mozapps/update/updates.css index 9065c8e7b60f..6010e30f454d 100644 --- a/toolkit/themes/pinstripe/mozapps/update/updates.css +++ b/toolkit/themes/pinstripe/mozapps/update/updates.css @@ -39,36 +39,11 @@ wizardpage { } .wizard-buttons button { - -moz-appearance: none; + -moz-appearance: toolbarbutton; min-height: 22px; margin: 0 6px; - padding: 0 2px; + padding: 0; text-shadow: @loweredShadow@; - border: 1px solid @toolbarbuttonBorderColor@; - border-radius: @toolbarbuttonCornerRadius@; - box-shadow: @loweredShadow@; - background: @toolbarbuttonBackground@; - background-origin: border-box; -} - -.wizard-buttons button:hover:active:not([disabled="true"]) { - background: @toolbarbuttonPressedBackgroundColor@; - text-shadow: @loweredShadow@; - box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@; -} - -.wizard-buttons button:-moz-focusring { - border-color: @toolbarbuttonFocusedBorderColorAqua@; - box-shadow: @focusRingShadow@; -} - -.wizard-buttons button:-moz-system-metric(mac-graphite-theme):-moz-focusring { - border-color: @toolbarbuttonFocusedBorderColorGraphite@; -} - -.wizard-buttons button:-moz-window-inactive { - border-color: @toolbarbuttonInactiveBorderColor@; - background-image: @toolbarbuttonInactiveBackgroundImage@; } .loadingBox { From 14e4e9667768fcad417327ebbc347b9204628af0 Mon Sep 17 00:00:00 2001 From: Jason Orendorff Date: Mon, 8 Aug 2011 12:33:16 -0500 Subject: [PATCH 15/30] Bug 675581 - "Assertion failure: js_CheckForStringIndex(id) == id" with e4x. r=Waldo. --- js/src/jsobj.cpp | 5 +++-- js/src/tests/js1_8_5/regress/jstests.list | 11 ++++++----- js/src/tests/js1_8_5/regress/regress-675581.js | 7 +++++++ 3 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 js/src/tests/js1_8_5/regress/regress-675581.js diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index c2bb15327e9f..25d22af52dd0 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -4483,6 +4483,9 @@ js_AddNativeProperty(JSContext *cx, JSObject *obj, jsid id, { JS_ASSERT(!(flags & Shape::METHOD)); + /* Convert string indices to integers if appropriate. */ + id = js_CheckForStringIndex(id); + /* * Purge the property cache of now-shadowed id in obj's scope chain. Do * this optimistically (assuming no failure below) before locking obj, so @@ -4493,8 +4496,6 @@ js_AddNativeProperty(JSContext *cx, JSObject *obj, jsid id, if (!obj->ensureClassReservedSlots(cx)) return NULL; - /* Convert string indices to integers if appropriate. */ - id = js_CheckForStringIndex(id); return obj->putProperty(cx, id, getter, setter, slot, attrs, flags, shortid); } diff --git a/js/src/tests/js1_8_5/regress/jstests.list b/js/src/tests/js1_8_5/regress/jstests.list index 0d97bd726643..faee6d5b008d 100644 --- a/js/src/tests/js1_8_5/regress/jstests.list +++ b/js/src/tests/js1_8_5/regress/jstests.list @@ -75,8 +75,9 @@ script regress-601399.js script regress-602621.js fails-if(!xulRuntime.shell) script regress-607799.js fails-if(!xulRuntime.shell) script regress-607863.js -script regress-610026.js script regress-609617.js +script regress-610026.js +script regress-614714.js script regress-617405-1.js script regress-617405-2.js script regress-618572.js @@ -86,8 +87,8 @@ script regress-619003-1.js script regress-619003-2.js skip-if(Android) script regress-620376-1.js script regress-620376-2.js -script regress-621814.js script regress-620750.js +script regress-621814.js script regress-624199.js script regress-624547.js script regress-624968.js @@ -101,14 +102,14 @@ script regress-635195.js script regress-636394.js script regress-636364.js script regress-640075.js +script regress-643222.js script regress-646820-1.js script regress-646820-2.js script regress-646820-3.js -script regress-643222.js -script regress-614714.js script regress-665355.js -script regress-667047.js script regress-666599.js +script regress-667047.js script regress-673070-1.js script regress-673070-2.js script regress-673070-3.js +script regress-675581.js diff --git a/js/src/tests/js1_8_5/regress/regress-675581.js b/js/src/tests/js1_8_5/regress/regress-675581.js new file mode 100644 index 000000000000..2edf6ac4df8c --- /dev/null +++ b/js/src/tests/js1_8_5/regress/regress-675581.js @@ -0,0 +1,7 @@ +// Any copyright is dedicated to the Public Domain. +// http://creativecommons.org/licenses/publicdomain/ + +x= +x.(-0 in x) + +reportCompare(0, 0, 'ok'); From 73a9f434fdc44e8ce09428aeb752b9afb98bae3a Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Mon, 8 Aug 2011 10:47:16 -0700 Subject: [PATCH 16/30] Bug 674522 - Remove bad static assert; fix strict-aliasing warnings (rs=waldo) --HG-- extra : rebase_source : bf6867ae067ecf83815792f14bf6e552885580b0 --- js/src/jsval.h | 2 ++ js/src/jsvalue.h | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/js/src/jsval.h b/js/src/jsval.h index 84b038b7be5f..e40b3b44bd8c 100644 --- a/js/src/jsval.h +++ b/js/src/jsval.h @@ -317,6 +317,7 @@ typedef union jsval_layout } s; double asDouble; void *asPtr; + jsuword asWord; } jsval_layout; # endif /* JS_BITS_PER_WORD */ #else /* defined(IS_LITTLE_ENDIAN) */ @@ -358,6 +359,7 @@ typedef union jsval_layout } s; double asDouble; void *asPtr; + jsuword asWord; } jsval_layout; # endif /* JS_BITS_PER_WORD */ #endif /* defined(IS_LITTLE_ENDIAN) */ diff --git a/js/src/jsvalue.h b/js/src/jsvalue.h index 345b64179a7f..6ea99461bd89 100644 --- a/js/src/jsvalue.h +++ b/js/src/jsvalue.h @@ -295,7 +295,6 @@ JSVAL_EXTRACT_NON_DOUBLE_TAG_IMPL(jsval_layout l) } #ifdef __cplusplus -JS_STATIC_ASSERT(offsetof(jsval_layout, s.payload) == 0); JS_STATIC_ASSERT((JSVAL_TYPE_NONFUNOBJ & 0xF) == JSVAL_TYPE_OBJECT); JS_STATIC_ASSERT((JSVAL_TYPE_FUNOBJ & 0xF) == JSVAL_TYPE_OBJECT); #endif @@ -744,9 +743,9 @@ class Value const jsuword *payloadWord() const { #if JS_BITS_PER_WORD == 32 - return reinterpret_cast(&data.s.payload.word); + return &data.s.payload.word; #elif JS_BITS_PER_WORD == 64 - return reinterpret_cast(&data.asBits); + return &data.asWord; #endif } From 2eacdb694234ae31618fe50af2573012f37a3e64 Mon Sep 17 00:00:00 2001 From: Jonas Sicking Date: Mon, 8 Aug 2011 11:26:22 -0700 Subject: [PATCH 17/30] Bug 665586 Part 1: Kill AddEventListenerByIID/RemoveEventListenerByIID code from nsPluginInstanceOwner. r=josh --- dom/plugins/base/nsPluginInstanceOwner.cpp | 302 +++++++----------- dom/plugins/base/nsPluginInstanceOwner.h | 46 +-- .../components/satchel/nsFormFillController.h | 5 + 3 files changed, 134 insertions(+), 219 deletions(-) diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp index 4440fcc6b105..d16bdb5d5bb9 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.cpp +++ b/dom/plugins/base/nsPluginInstanceOwner.cpp @@ -385,19 +385,10 @@ nsPluginInstanceOwner::~nsPluginInstanceOwner() } } -NS_IMPL_ADDREF(nsPluginInstanceOwner) -NS_IMPL_RELEASE(nsPluginInstanceOwner) - -NS_INTERFACE_MAP_BEGIN(nsPluginInstanceOwner) - NS_INTERFACE_MAP_ENTRY(nsIPluginInstanceOwner) - NS_INTERFACE_MAP_ENTRY(nsIPluginTagInfo) - NS_INTERFACE_MAP_ENTRY(nsIDOMMouseListener) - NS_INTERFACE_MAP_ENTRY(nsIDOMMouseMotionListener) - NS_INTERFACE_MAP_ENTRY(nsIDOMKeyListener) - NS_INTERFACE_MAP_ENTRY(nsIDOMFocusListener) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEventListener, nsIDOMMouseListener) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPluginInstanceOwner) -NS_INTERFACE_MAP_END +NS_IMPL_ISUPPORTS3(nsPluginInstanceOwner, + nsIPluginInstanceOwner, + nsIPluginTagInfo, + nsIDOMEventListener) nsresult nsPluginInstanceOwner::SetInstance(nsNPAPIPluginInstance *aInstance) @@ -1673,19 +1664,6 @@ void nsPluginInstanceOwner::ScrollPositionDidChange(nscoord aX, nscoord aY) #endif } -/*=============== nsIDOMFocusListener ======================*/ -nsresult nsPluginInstanceOwner::Focus(nsIDOMEvent * aFocusEvent) -{ - mContentFocused = PR_TRUE; - return DispatchFocusToPlugin(aFocusEvent); -} - -nsresult nsPluginInstanceOwner::Blur(nsIDOMEvent * aFocusEvent) -{ - mContentFocused = PR_FALSE; - return DispatchFocusToPlugin(aFocusEvent); -} - nsresult nsPluginInstanceOwner::DispatchFocusToPlugin(nsIDOMEvent* aFocusEvent) { #ifndef XP_MACOSX @@ -1715,18 +1693,6 @@ nsresult nsPluginInstanceOwner::DispatchFocusToPlugin(nsIDOMEvent* aFocusEvent) return NS_OK; } - -/*=============== nsIKeyListener ======================*/ -nsresult nsPluginInstanceOwner::KeyDown(nsIDOMEvent* aKeyEvent) -{ - return DispatchKeyToPlugin(aKeyEvent); -} - -nsresult nsPluginInstanceOwner::KeyUp(nsIDOMEvent* aKeyEvent) -{ - return DispatchKeyToPlugin(aKeyEvent); -} - nsresult nsPluginInstanceOwner::KeyPress(nsIDOMEvent* aKeyEvent) { #ifdef XP_MACOSX @@ -1738,11 +1704,10 @@ nsresult nsPluginInstanceOwner::KeyPress(nsIDOMEvent* aKeyEvent) nsCOMPtr privateEvent(do_QueryInterface(aKeyEvent)); if (privateEvent) { nsEvent *theEvent = privateEvent->GetInternalNSEvent(); - const nsGUIEvent *guiEvent = (nsGUIEvent*)theEvent; - const EventRecord *ev = (EventRecord*)(guiEvent->pluginEvent); - if (guiEvent && - guiEvent->message == NS_KEY_PRESS && - ev && + const EventRecord *ev; + if (theEvent && + theEvent->message == NS_KEY_PRESS && + (ev = (EventRecord*)(((nsGUIEvent*)theEvent)->pluginEvent)) && ev->what == keyDown) return aKeyEvent->PreventDefault(); // consume event } @@ -1789,9 +1754,9 @@ nsresult nsPluginInstanceOwner::DispatchKeyToPlugin(nsIDOMEvent* aKeyEvent) if (mInstance) { nsCOMPtr privateEvent(do_QueryInterface(aKeyEvent)); if (privateEvent) { - nsKeyEvent *keyEvent = (nsKeyEvent *) privateEvent->GetInternalNSEvent(); - if (keyEvent) { - nsEventStatus rv = ProcessEvent(*keyEvent); + nsEvent *event = privateEvent->GetInternalNSEvent(); + if (event && event->eventStructType == NS_KEY_EVENT) { + nsEventStatus rv = ProcessEvent(*static_cast(event)); if (nsEventStatus_eConsumeNoDefault == rv) { aKeyEvent->PreventDefault(); aKeyEvent->StopPropagation(); @@ -1805,39 +1770,6 @@ nsresult nsPluginInstanceOwner::DispatchKeyToPlugin(nsIDOMEvent* aKeyEvent) return NS_OK; } -/*=============== nsIDOMMouseMotionListener ======================*/ - -nsresult -nsPluginInstanceOwner::MouseMove(nsIDOMEvent* aMouseEvent) -{ -#if !defined(XP_MACOSX) - if (!mPluginWindow || (mPluginWindow->type == NPWindowTypeWindow)) - return aMouseEvent->PreventDefault(); // consume event - // continue only for cases without child window -#endif - - // don't send mouse events if we are hidden - if (!mWidgetVisible) - return NS_OK; - - nsCOMPtr privateEvent(do_QueryInterface(aMouseEvent)); - if (privateEvent) { - nsMouseEvent* mouseEvent = (nsMouseEvent *) privateEvent->GetInternalNSEvent(); - if (mouseEvent) { - nsEventStatus rv = ProcessEvent(*mouseEvent); - if (nsEventStatus_eConsumeNoDefault == rv) { - return aMouseEvent->PreventDefault(); // consume event - } - } - else NS_ASSERTION(PR_FALSE, "nsPluginInstanceOwner::MouseMove failed, mouseEvent null"); - } - else NS_ASSERTION(PR_FALSE, "nsPluginInstanceOwner::MouseMove failed, privateEvent null"); - - return NS_OK; -} - -/*=============== nsIDOMMouseListener ======================*/ - nsresult nsPluginInstanceOwner::MouseDown(nsIDOMEvent* aMouseEvent) { @@ -1861,9 +1793,9 @@ nsPluginInstanceOwner::MouseDown(nsIDOMEvent* aMouseEvent) nsCOMPtr privateEvent(do_QueryInterface(aMouseEvent)); if (privateEvent) { - nsMouseEvent* mouseEvent = (nsMouseEvent *) privateEvent->GetInternalNSEvent(); - if (mouseEvent) { - nsEventStatus rv = ProcessEvent(*mouseEvent); + nsEvent* event = privateEvent->GetInternalNSEvent(); + if (event && event->eventStructType == NS_MOUSE_EVENT) { + nsEventStatus rv = ProcessEvent(*static_cast(event)); if (nsEventStatus_eConsumeNoDefault == rv) { return aMouseEvent->PreventDefault(); // consume event } @@ -1875,44 +1807,6 @@ nsPluginInstanceOwner::MouseDown(nsIDOMEvent* aMouseEvent) return NS_OK; } -nsresult -nsPluginInstanceOwner::MouseUp(nsIDOMEvent* aMouseEvent) -{ - // Don't send a mouse-up event to the plugin if it isn't focused. This can - // happen if the previous mouse-down was sent to a DOM element above the - // plugin, the mouse is still above the plugin, and the mouse-down event - // caused the element to disappear. See bug 627649. - if (!mContentFocused) { - aMouseEvent->PreventDefault(); - return NS_OK; - } - return DispatchMouseToPlugin(aMouseEvent); -} - -nsresult -nsPluginInstanceOwner::MouseClick(nsIDOMEvent* aMouseEvent) -{ - return DispatchMouseToPlugin(aMouseEvent); -} - -nsresult -nsPluginInstanceOwner::MouseDblClick(nsIDOMEvent* aMouseEvent) -{ - return DispatchMouseToPlugin(aMouseEvent); -} - -nsresult -nsPluginInstanceOwner::MouseOver(nsIDOMEvent* aMouseEvent) -{ - return DispatchMouseToPlugin(aMouseEvent); -} - -nsresult -nsPluginInstanceOwner::MouseOut(nsIDOMEvent* aMouseEvent) -{ - return DispatchMouseToPlugin(aMouseEvent); -} - nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent) { #if !defined(XP_MACOSX) @@ -1926,9 +1820,9 @@ nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent) nsCOMPtr privateEvent(do_QueryInterface(aMouseEvent)); if (privateEvent) { - nsMouseEvent* mouseEvent = (nsMouseEvent *) privateEvent->GetInternalNSEvent(); - if (mouseEvent) { - nsEventStatus rv = ProcessEvent(*mouseEvent); + nsEvent* event = privateEvent->GetInternalNSEvent(); + if (event && event->eventStructType == NS_MOUSE_EVENT) { + nsEventStatus rv = ProcessEvent(*static_cast(event)); if (nsEventStatus_eConsumeNoDefault == rv) { aMouseEvent->PreventDefault(); aMouseEvent->StopPropagation(); @@ -1944,10 +1838,49 @@ nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent) nsresult nsPluginInstanceOwner::HandleEvent(nsIDOMEvent* aEvent) { - if (mInstance) { + nsAutoString eventType; + aEvent->GetType(eventType); + if (eventType.EqualsLiteral("focus")) { + mContentFocused = PR_TRUE; + return DispatchFocusToPlugin(aEvent); + } + if (eventType.EqualsLiteral("blur")) { + mContentFocused = PR_FALSE; + return DispatchFocusToPlugin(aEvent); + } + if (eventType.EqualsLiteral("mousedown")) { + return MouseDown(aEvent); + } + if (eventType.EqualsLiteral("mouseup")) { + // Don't send a mouse-up event to the plugin if it isn't focused. This can + // happen if the previous mouse-down was sent to a DOM element above the + // plugin, the mouse is still above the plugin, and the mouse-down event + // caused the element to disappear. See bug 627649. + if (!mContentFocused) { + aEvent->PreventDefault(); + return NS_OK; + } + return DispatchMouseToPlugin(aEvent); + } + if (eventType.EqualsLiteral("mousemove") || + eventType.EqualsLiteral("click") || + eventType.EqualsLiteral("dblclick") || + eventType.EqualsLiteral("mouseover") || + eventType.EqualsLiteral("mouseout")) { + return DispatchMouseToPlugin(aEvent); + } + if (eventType.EqualsLiteral("keydown") || + eventType.EqualsLiteral("keyup")) { + return DispatchKeyToPlugin(aEvent); + } + if (eventType.EqualsLiteral("keypress")) { + return KeyPress(aEvent); + } + + nsCOMPtr dragEvent(do_QueryInterface(aEvent)); + if (dragEvent && mInstance) { nsCOMPtr privateEvent(do_QueryInterface(aEvent)); - nsCOMPtr dragEvent(do_QueryInterface(aEvent)); - if (privateEvent && dragEvent) { + if (privateEvent) { nsEvent* ievent = privateEvent->GetInternalNSEvent(); if (ievent && NS_IS_TRUSTED_EVENT(ievent) && (ievent->message == NS_DRAGDROP_ENTER || ievent->message == NS_DRAGDROP_OVER)) { @@ -2506,38 +2439,28 @@ nsPluginInstanceOwner::Destroy() mCXMenuListener = nsnull; } - nsCOMPtr target(do_QueryInterface(mContent)); - if (target) { - - nsCOMPtr listener; - QueryInterface(NS_GET_IID(nsIDOMEventListener), getter_AddRefs(listener)); - - // Unregister focus event listener - mContent->RemoveEventListenerByIID(listener, NS_GET_IID(nsIDOMFocusListener)); - - // Unregister mouse event listener - mContent->RemoveEventListenerByIID(listener, NS_GET_IID(nsIDOMMouseListener)); - - // now for the mouse motion listener - mContent->RemoveEventListenerByIID(listener, NS_GET_IID(nsIDOMMouseMotionListener)); - - // Unregister key event listener; - target->RemoveEventListener(NS_LITERAL_STRING("keypress"), listener, PR_TRUE); - target->RemoveEventListener(NS_LITERAL_STRING("keydown"), listener, PR_TRUE); - target->RemoveEventListener(NS_LITERAL_STRING("keyup"), listener, PR_TRUE); - - // Unregister drag event listener; - target->RemoveEventListener(NS_LITERAL_STRING("drop"), listener, PR_TRUE); - target->RemoveEventListener(NS_LITERAL_STRING("dragdrop"), listener, PR_TRUE); - target->RemoveEventListener(NS_LITERAL_STRING("drag"), listener, PR_TRUE); - target->RemoveEventListener(NS_LITERAL_STRING("dragenter"), listener, PR_TRUE); - target->RemoveEventListener(NS_LITERAL_STRING("dragover"), listener, PR_TRUE); - target->RemoveEventListener(NS_LITERAL_STRING("dragexit"), listener, PR_TRUE); - target->RemoveEventListener(NS_LITERAL_STRING("dragleave"), listener, PR_TRUE); - target->RemoveEventListener(NS_LITERAL_STRING("dragstart"), listener, PR_TRUE); - target->RemoveEventListener(NS_LITERAL_STRING("draggesture"), listener, PR_TRUE); - target->RemoveEventListener(NS_LITERAL_STRING("dragend"), listener, PR_TRUE); - } + mContent->RemoveEventListener(NS_LITERAL_STRING("focus"), this, PR_FALSE); + mContent->RemoveEventListener(NS_LITERAL_STRING("blur"), this, PR_FALSE); + mContent->RemoveEventListener(NS_LITERAL_STRING("mouseup"), this, PR_FALSE); + mContent->RemoveEventListener(NS_LITERAL_STRING("mousedown"), this, PR_FALSE); + mContent->RemoveEventListener(NS_LITERAL_STRING("mousemove"), this, PR_FALSE); + mContent->RemoveEventListener(NS_LITERAL_STRING("click"), this, PR_FALSE); + mContent->RemoveEventListener(NS_LITERAL_STRING("dblclick"), this, PR_FALSE); + mContent->RemoveEventListener(NS_LITERAL_STRING("mouseover"), this, PR_FALSE); + mContent->RemoveEventListener(NS_LITERAL_STRING("mouseout"), this, PR_FALSE); + mContent->RemoveEventListener(NS_LITERAL_STRING("keypress"), this, PR_TRUE); + mContent->RemoveEventListener(NS_LITERAL_STRING("keydown"), this, PR_TRUE); + mContent->RemoveEventListener(NS_LITERAL_STRING("keyup"), this, PR_TRUE); + mContent->RemoveEventListener(NS_LITERAL_STRING("drop"), this, PR_TRUE); + mContent->RemoveEventListener(NS_LITERAL_STRING("dragdrop"), this, PR_TRUE); + mContent->RemoveEventListener(NS_LITERAL_STRING("drag"), this, PR_TRUE); + mContent->RemoveEventListener(NS_LITERAL_STRING("dragenter"), this, PR_TRUE); + mContent->RemoveEventListener(NS_LITERAL_STRING("dragover"), this, PR_TRUE); + mContent->RemoveEventListener(NS_LITERAL_STRING("dragleave"), this, PR_TRUE); + mContent->RemoveEventListener(NS_LITERAL_STRING("dragexit"), this, PR_TRUE); + mContent->RemoveEventListener(NS_LITERAL_STRING("dragstart"), this, PR_TRUE); + mContent->RemoveEventListener(NS_LITERAL_STRING("draggesture"), this, PR_TRUE); + mContent->RemoveEventListener(NS_LITERAL_STRING("dragend"), this, PR_TRUE); if (mWidget) { nsCOMPtr pluginWidget = do_QueryInterface(mWidget); @@ -2967,38 +2890,37 @@ nsresult nsPluginInstanceOwner::Init(nsPresContext* aPresContext, mCXMenuListener->Init(aContent); } - nsCOMPtr target(do_QueryInterface(mContent)); - if (target) { - - nsCOMPtr listener; - QueryInterface(NS_GET_IID(nsIDOMEventListener), getter_AddRefs(listener)); - - // Register focus listener - mContent->AddEventListenerByIID(listener, NS_GET_IID(nsIDOMFocusListener)); - - // Register mouse listener - mContent->AddEventListenerByIID(listener, NS_GET_IID(nsIDOMMouseListener)); - - // now do the mouse motion listener - mContent->AddEventListenerByIID(listener, NS_GET_IID(nsIDOMMouseMotionListener)); - - // Register key listener - target->AddEventListener(NS_LITERAL_STRING("keypress"), listener, PR_TRUE); - target->AddEventListener(NS_LITERAL_STRING("keydown"), listener, PR_TRUE); - target->AddEventListener(NS_LITERAL_STRING("keyup"), listener, PR_TRUE); - - // Register drag listener - target->AddEventListener(NS_LITERAL_STRING("drop"), listener, PR_TRUE); - target->AddEventListener(NS_LITERAL_STRING("dragdrop"), listener, PR_TRUE); - target->AddEventListener(NS_LITERAL_STRING("drag"), listener, PR_TRUE); - target->AddEventListener(NS_LITERAL_STRING("dragenter"), listener, PR_TRUE); - target->AddEventListener(NS_LITERAL_STRING("dragover"), listener, PR_TRUE); - target->AddEventListener(NS_LITERAL_STRING("dragleave"), listener, PR_TRUE); - target->AddEventListener(NS_LITERAL_STRING("dragexit"), listener, PR_TRUE); - target->AddEventListener(NS_LITERAL_STRING("dragstart"), listener, PR_TRUE); - target->AddEventListener(NS_LITERAL_STRING("draggesture"), listener, PR_TRUE); - target->AddEventListener(NS_LITERAL_STRING("dragend"), listener, PR_TRUE); - } + mContent->AddEventListener(NS_LITERAL_STRING("focus"), this, PR_FALSE, + PR_FALSE); + mContent->AddEventListener(NS_LITERAL_STRING("blur"), this, PR_FALSE, + PR_FALSE); + mContent->AddEventListener(NS_LITERAL_STRING("mouseup"), this, PR_FALSE, + PR_FALSE); + mContent->AddEventListener(NS_LITERAL_STRING("mousedown"), this, PR_FALSE, + PR_FALSE); + mContent->AddEventListener(NS_LITERAL_STRING("mousemove"), this, PR_FALSE, + PR_FALSE); + mContent->AddEventListener(NS_LITERAL_STRING("click"), this, PR_FALSE, + PR_FALSE); + mContent->AddEventListener(NS_LITERAL_STRING("dblclick"), this, PR_FALSE, + PR_FALSE); + mContent->AddEventListener(NS_LITERAL_STRING("mouseover"), this, PR_FALSE, + PR_FALSE); + mContent->AddEventListener(NS_LITERAL_STRING("mouseout"), this, PR_FALSE, + PR_FALSE); + mContent->AddEventListener(NS_LITERAL_STRING("keypress"), this, PR_TRUE); + mContent->AddEventListener(NS_LITERAL_STRING("keydown"), this, PR_TRUE); + mContent->AddEventListener(NS_LITERAL_STRING("keyup"), this, PR_TRUE); + mContent->AddEventListener(NS_LITERAL_STRING("drop"), this, PR_TRUE); + mContent->AddEventListener(NS_LITERAL_STRING("dragdrop"), this, PR_TRUE); + mContent->AddEventListener(NS_LITERAL_STRING("drag"), this, PR_TRUE); + mContent->AddEventListener(NS_LITERAL_STRING("dragenter"), this, PR_TRUE); + mContent->AddEventListener(NS_LITERAL_STRING("dragover"), this, PR_TRUE); + mContent->AddEventListener(NS_LITERAL_STRING("dragleave"), this, PR_TRUE); + mContent->AddEventListener(NS_LITERAL_STRING("dragexit"), this, PR_TRUE); + mContent->AddEventListener(NS_LITERAL_STRING("dragstart"), this, PR_TRUE); + mContent->AddEventListener(NS_LITERAL_STRING("draggesture"), this, PR_TRUE); + mContent->AddEventListener(NS_LITERAL_STRING("dragend"), this, PR_TRUE); // Register scroll position listeners // We need to register a scroll position listener on every scrollable diff --git a/dom/plugins/base/nsPluginInstanceOwner.h b/dom/plugins/base/nsPluginInstanceOwner.h index 620eafda67cd..21eeac2bfa7f 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.h +++ b/dom/plugins/base/nsPluginInstanceOwner.h @@ -52,15 +52,17 @@ #include "nsCOMPtr.h" #include "nsIPluginInstanceOwner.h" #include "nsIPluginTagInfo.h" -#include "nsIDOMMouseListener.h" -#include "nsIDOMMouseMotionListener.h" -#include "nsIDOMKeyListener.h" -#include "nsIDOMFocusListener.h" +#include "nsIDOMEventListener.h" #include "nsIScrollPositionListener.h" #include "nsPluginHost.h" #include "nsPluginNativeWindow.h" #include "gfxRect.h" +// X.h defines KeyPress +#ifdef KeyPress +#undef KeyPress +#endif + #ifdef XP_MACOSX #include "nsCoreAnimationSupport.h" #include @@ -90,12 +92,14 @@ class gfxXlibSurface; #include #endif +// X.h defines KeyPress +#ifdef KeyPress +#undef KeyPress +#endif + class nsPluginInstanceOwner : public nsIPluginInstanceOwner, public nsIPluginTagInfo, - public nsIDOMMouseListener, - public nsIDOMMouseMotionListener, - public nsIDOMKeyListener, - public nsIDOMFocusListener, + public nsIDOMEventListener, public nsIScrollPositionListener { public: @@ -119,28 +123,12 @@ public: //nsIPluginTagInfo interface NS_DECL_NSIPLUGINTAGINFO - // nsIDOMMouseListener interfaces - NS_IMETHOD MouseDown(nsIDOMEvent* aMouseEvent); - NS_IMETHOD MouseUp(nsIDOMEvent* aMouseEvent); - NS_IMETHOD MouseClick(nsIDOMEvent* aMouseEvent); - NS_IMETHOD MouseDblClick(nsIDOMEvent* aMouseEvent); - NS_IMETHOD MouseOver(nsIDOMEvent* aMouseEvent); - NS_IMETHOD MouseOut(nsIDOMEvent* aMouseEvent); - NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent); - - // nsIDOMMouseMotionListener interfaces - NS_IMETHOD MouseMove(nsIDOMEvent* aMouseEvent); - NS_IMETHOD DragMove(nsIDOMEvent* aMouseEvent) { return NS_OK; } - - // nsIDOMKeyListener interfaces - NS_IMETHOD KeyDown(nsIDOMEvent* aKeyEvent); - NS_IMETHOD KeyUp(nsIDOMEvent* aKeyEvent); - NS_IMETHOD KeyPress(nsIDOMEvent* aKeyEvent); - - // nsIDOMFocusListener interfaces - NS_IMETHOD Focus(nsIDOMEvent * aFocusEvent); - NS_IMETHOD Blur(nsIDOMEvent * aFocusEvent); + // nsIDOMEventListener interfaces + NS_DECL_NSIDOMEVENTLISTENER + nsresult MouseDown(nsIDOMEvent* aKeyEvent); + nsresult KeyPress(nsIDOMEvent* aKeyEvent); + nsresult Destroy(); void PrepareToStop(PRBool aDelayedStop); diff --git a/toolkit/components/satchel/nsFormFillController.h b/toolkit/components/satchel/nsFormFillController.h index dd3ae5d38728..0be5242645b3 100644 --- a/toolkit/components/satchel/nsFormFillController.h +++ b/toolkit/components/satchel/nsFormFillController.h @@ -55,6 +55,11 @@ #include "nsILoginManager.h" #include "nsIMutationObserver.h" +// X.h defines KeyPress +#ifdef KeyPress +#undef KeyPress +#endif + class nsFormHistory; class nsFormFillController : public nsIFormFillController, From a0f9f209670f39063851a569bd319120029658ac Mon Sep 17 00:00:00 2001 From: Jonas Sicking Date: Mon, 8 Aug 2011 11:26:26 -0700 Subject: [PATCH 18/30] Bug 665586 Part 2: Kill AddEventListenerByIID/RemoveEventListenerByIID code from nsPluginDOMContextMenuListener. r=josh --- dom/plugins/base/nsPluginInstanceOwner.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp index d16bdb5d5bb9..d66aab478ad6 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.cpp +++ b/dom/plugins/base/nsPluginInstanceOwner.cpp @@ -70,7 +70,6 @@ using mozilla::DefaultXDisplay; #include "nsContentUtils.h" #include "nsRect.h" #include "nsSize.h" -#include "nsIDOMContextMenuListener.h" #include "nsDisplayList.h" #include "ImageLayers.h" #include "nsIDOMEventTarget.h" @@ -124,23 +123,18 @@ using namespace mozilla; // special class for handeling DOM context menu events because for // some reason it starves other mouse events if implemented on the // same class -class nsPluginDOMContextMenuListener : public nsIDOMContextMenuListener +class nsPluginDOMContextMenuListener : public nsIDOMEventListener { public: nsPluginDOMContextMenuListener(); virtual ~nsPluginDOMContextMenuListener(); NS_DECL_ISUPPORTS + NS_DECL_NSIDOMEVENTLISTENER - NS_IMETHOD ContextMenu(nsIDOMEvent* aContextMenuEvent); - nsresult Init(nsIContent* aContent); nsresult Destroy(nsIContent* aContent); - NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) - { - return NS_OK; - } nsEventStatus ProcessEvent(const nsGUIEvent& anEvent) { return nsEventStatus_eConsumeNoDefault; @@ -3315,14 +3309,13 @@ nsPluginDOMContextMenuListener::~nsPluginDOMContextMenuListener() { } -NS_IMPL_ISUPPORTS2(nsPluginDOMContextMenuListener, - nsIDOMContextMenuListener, +NS_IMPL_ISUPPORTS1(nsPluginDOMContextMenuListener, nsIDOMEventListener) NS_IMETHODIMP -nsPluginDOMContextMenuListener::ContextMenu(nsIDOMEvent* aContextMenuEvent) +nsPluginDOMContextMenuListener::HandleEvent(nsIDOMEvent* aEvent) { - aContextMenuEvent->PreventDefault(); // consume event + aEvent->PreventDefault(); // consume event return NS_OK; } From 743f1281ec7e8281f39151827bba77b6803daa3d Mon Sep 17 00:00:00 2001 From: Jonas Sicking Date: Mon, 8 Aug 2011 11:26:26 -0700 Subject: [PATCH 19/30] Bug 661297 Part 1: Remove Add/RemoveEventListenerByIID API. r=smaug --- accessible/src/base/nsRootAccessible.h | 3 +- content/base/src/nsGenericElement.cpp | 20 --- content/events/src/nsDOMEventTargetHelper.cpp | 20 --- content/events/src/nsEventListenerManager.cpp | 120 +----------------- content/events/src/nsEventListenerManager.h | 4 - content/xbl/src/nsXBLBinding.cpp | 8 +- content/xul/content/src/nsXULElement.cpp | 7 - .../xul/document/src/nsXULCommandDispatcher.h | 1 - dom/Makefile.in | 1 - dom/base/nsGlobalWindow.cpp | 24 ---- dom/base/nsWindowRoot.cpp | 18 --- dom/interfaces/events/nsIDOMEventTarget.idl | 13 -- dom/public/coreEvents/Makefile.in | 61 --------- .../coreEvents/nsIDOMCompositionListener.h | 66 ---------- .../coreEvents/nsIDOMContextMenuListener.h | 70 ---------- dom/public/coreEvents/nsIDOMFocusListener.h | 77 ----------- dom/public/coreEvents/nsIDOMFormListener.h | 97 -------------- dom/public/coreEvents/nsIDOMKeyListener.h | 89 ------------- dom/public/coreEvents/nsIDOMLoadListener.h | 98 -------------- dom/public/coreEvents/nsIDOMMouseListener.h | 108 ---------------- .../coreEvents/nsIDOMMouseMotionListener.h | 77 ----------- dom/public/coreEvents/nsIDOMTextListener.h | 64 ---------- dom/public/coreEvents/nsIDOMUIListener.h | 63 --------- dom/src/events/nsJSEventListener.h | 2 +- editor/libeditor/html/nsHTMLDataTransfer.cpp | 2 - editor/libeditor/html/nsHTMLEditorStyle.cpp | 2 - editor/libeditor/text/nsPlaintextEditor.cpp | 1 - layout/forms/nsTextControlFrame.cpp | 2 - layout/generic/nsObjectFrame.cpp | 6 +- layout/printing/nsPrintEngine.cpp | 1 - xpfe/appshell/src/nsWebShellWindow.cpp | 1 - 31 files changed, 5 insertions(+), 1121 deletions(-) delete mode 100644 dom/public/coreEvents/Makefile.in delete mode 100644 dom/public/coreEvents/nsIDOMCompositionListener.h delete mode 100644 dom/public/coreEvents/nsIDOMContextMenuListener.h delete mode 100644 dom/public/coreEvents/nsIDOMFocusListener.h delete mode 100644 dom/public/coreEvents/nsIDOMFormListener.h delete mode 100644 dom/public/coreEvents/nsIDOMKeyListener.h delete mode 100644 dom/public/coreEvents/nsIDOMLoadListener.h delete mode 100644 dom/public/coreEvents/nsIDOMMouseListener.h delete mode 100644 dom/public/coreEvents/nsIDOMMouseMotionListener.h delete mode 100644 dom/public/coreEvents/nsIDOMTextListener.h delete mode 100644 dom/public/coreEvents/nsIDOMUIListener.h diff --git a/accessible/src/base/nsRootAccessible.h b/accessible/src/base/nsRootAccessible.h index 56ee2453ac93..9555a6c7f816 100644 --- a/accessible/src/base/nsRootAccessible.h +++ b/accessible/src/base/nsRootAccessible.h @@ -49,8 +49,7 @@ #include "nsHashtable.h" #include "nsCaretAccessible.h" #include "nsIDocument.h" -#include "nsIDOMFocusListener.h" -#include "nsIDOMFormListener.h" +#include "nsIDOMEventListener.h" #define NS_ROOTACCESSIBLE_IMPL_CID \ { /* eaba2cf0-21b1-4e2b-b711-d3a89dcd5e1a */ \ diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index 460f14ce30e7..02175dfa9c48 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -1127,26 +1127,6 @@ nsINode::DispatchDOMEvent(nsEvent* aEvent, aPresContext, aEventStatus); } -nsresult -nsINode::AddEventListenerByIID(nsIDOMEventListener *aListener, - const nsIID& aIID) -{ - nsEventListenerManager* elm = GetListenerManager(PR_TRUE); - NS_ENSURE_STATE(elm); - return elm->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); -} - -nsresult -nsINode::RemoveEventListenerByIID(nsIDOMEventListener *aListener, - const nsIID& aIID) -{ - nsEventListenerManager* elm = GetListenerManager(PR_FALSE); - if (elm) { - elm->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); - } - return NS_OK; -} - nsEventListenerManager* nsINode::GetListenerManager(PRBool aCreateIfNotFound) { diff --git a/content/events/src/nsDOMEventTargetHelper.cpp b/content/events/src/nsDOMEventTargetHelper.cpp index 588a5c6db244..fe9f7a47de4f 100644 --- a/content/events/src/nsDOMEventTargetHelper.cpp +++ b/content/events/src/nsDOMEventTargetHelper.cpp @@ -206,26 +206,6 @@ nsDOMEventTargetHelper::GetListenerManager(PRBool aCreateIfNotFound) return mListenerManager; } -nsresult -nsDOMEventTargetHelper::AddEventListenerByIID(nsIDOMEventListener *aListener, - const nsIID& aIID) -{ - nsEventListenerManager* elm = GetListenerManager(PR_TRUE); - NS_ENSURE_STATE(elm); - return elm->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); -} - -nsresult -nsDOMEventTargetHelper::RemoveEventListenerByIID(nsIDOMEventListener *aListener, - const nsIID& aIID) -{ - nsEventListenerManager* elm = GetListenerManager(PR_FALSE); - if (elm) { - elm->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); - } - return NS_OK; -} - nsIScriptContext* nsDOMEventTargetHelper::GetContextForEventHandlers(nsresult* aRv) { diff --git a/content/events/src/nsEventListenerManager.cpp b/content/events/src/nsEventListenerManager.cpp index 4b29939819d4..800304942b91 100644 --- a/content/events/src/nsEventListenerManager.cpp +++ b/content/events/src/nsEventListenerManager.cpp @@ -41,17 +41,6 @@ #include "nsEventListenerManager.h" #include "nsCaret.h" #include "nsIDOMNSEvent.h" -#include "nsIDOMEventListener.h" -#include "nsIDOMMouseListener.h" -#include "nsIDOMMouseMotionListener.h" -#include "nsIDOMContextMenuListener.h" -#include "nsIDOMKeyListener.h" -#include "nsIDOMFocusListener.h" -#include "nsIDOMFormListener.h" -#include "nsIDOMLoadListener.h" -#include "nsIDOMTextListener.h" -#include "nsIDOMCompositionListener.h" -#include "nsIDOMUIListener.h" #include "nsITextControlFrame.h" #include "nsGkAtoms.h" #include "nsPIDOMWindow.h" @@ -187,66 +176,6 @@ struct EventTypeData #define HANDLER(x) reinterpret_cast(x) -static const EventDispatchData sMouseEvents[] = { - { NS_MOUSE_BUTTON_DOWN, HANDLER(&nsIDOMMouseListener::MouseDown) }, - { NS_MOUSE_BUTTON_UP, HANDLER(&nsIDOMMouseListener::MouseUp) }, - { NS_MOUSE_CLICK, HANDLER(&nsIDOMMouseListener::MouseClick) }, - { NS_MOUSE_DOUBLECLICK, HANDLER(&nsIDOMMouseListener::MouseDblClick) }, - { NS_MOUSE_ENTER_SYNTH, HANDLER(&nsIDOMMouseListener::MouseOver) }, - { NS_MOUSE_EXIT_SYNTH, HANDLER(&nsIDOMMouseListener::MouseOut) } -}; - -static const EventDispatchData sMouseMotionEvents[] = { - { NS_MOUSE_MOVE, HANDLER(&nsIDOMMouseMotionListener::MouseMove) } -}; - -static const EventDispatchData sContextMenuEvents[] = { - { NS_CONTEXTMENU, HANDLER(&nsIDOMContextMenuListener::ContextMenu) } -}; - -static const EventDispatchData sCompositionEvents[] = { - { NS_COMPOSITION_START, - HANDLER(&nsIDOMCompositionListener::HandleStartComposition) }, - { NS_COMPOSITION_END, - HANDLER(&nsIDOMCompositionListener::HandleEndComposition) } -}; - -static const EventDispatchData sTextEvents[] = { - { NS_TEXT_TEXT, HANDLER(&nsIDOMTextListener::HandleText) } -}; - -static const EventDispatchData sKeyEvents[] = { - { NS_KEY_UP, HANDLER(&nsIDOMKeyListener::KeyUp) }, - { NS_KEY_DOWN, HANDLER(&nsIDOMKeyListener::KeyDown) }, - { NS_KEY_PRESS, HANDLER(&nsIDOMKeyListener::KeyPress) } -}; - -static const EventDispatchData sFocusEvents[] = { - { NS_FOCUS_CONTENT, HANDLER(&nsIDOMFocusListener::Focus) }, - { NS_BLUR_CONTENT, HANDLER(&nsIDOMFocusListener::Blur) } -}; - -static const EventDispatchData sFormEvents[] = { - { NS_FORM_SUBMIT, HANDLER(&nsIDOMFormListener::Submit) }, - { NS_FORM_RESET, HANDLER(&nsIDOMFormListener::Reset) }, - { NS_FORM_CHANGE, HANDLER(&nsIDOMFormListener::Change) }, - { NS_FORM_SELECTED, HANDLER(&nsIDOMFormListener::Select) }, - { NS_FORM_INPUT, HANDLER(&nsIDOMFormListener::Input) } -}; - -static const EventDispatchData sLoadEvents[] = { - { NS_LOAD, HANDLER(&nsIDOMLoadListener::Load) }, - { NS_PAGE_UNLOAD, HANDLER(&nsIDOMLoadListener::Unload) }, - { NS_LOAD_ERROR, HANDLER(&nsIDOMLoadListener::Error) }, - { NS_BEFORE_PAGE_UNLOAD, HANDLER(&nsIDOMLoadListener::BeforeUnload) } -}; - -static const EventDispatchData sUIEvents[] = { - { NS_UI_ACTIVATE, HANDLER(&nsIDOMUIListener::Activate) }, - { NS_UI_FOCUSIN, HANDLER(&nsIDOMUIListener::FocusIn) }, - { NS_UI_FOCUSOUT, HANDLER(&nsIDOMUIListener::FocusOut) } -}; - #define IMPL_EVENTTYPEDATA(type) \ { \ s##type##Events, \ @@ -257,16 +186,6 @@ static const EventDispatchData sUIEvents[] = { // IMPORTANT: indices match up with eEventArrayType_ enum values static const EventTypeData sEventTypes[] = { - IMPL_EVENTTYPEDATA(Mouse), - IMPL_EVENTTYPEDATA(MouseMotion), - IMPL_EVENTTYPEDATA(ContextMenu), - IMPL_EVENTTYPEDATA(Key), - IMPL_EVENTTYPEDATA(Load), - IMPL_EVENTTYPEDATA(Focus), - IMPL_EVENTTYPEDATA(Form), - IMPL_EVENTTYPEDATA(Text), - IMPL_EVENTTYPEDATA(Composition), - IMPL_EVENTTYPEDATA(UI) }; PRUint32 nsEventListenerManager::sCreatedCount = 0; @@ -393,23 +312,6 @@ nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener, nsRefPtr kungFuDeathGrip = aListener; - if (!aTypeData) { - // If we don't have type data, we can try to QI listener to the right - // interface and set mTypeData only if QI succeeds. This way we can save - // calls to DispatchToInterface (in HandleEvent) in those cases when QI - // would fail. - // @see also DispatchToInterface() - const EventTypeData* td = GetTypeDataForEventName(aTypeAtom); - if (td && td->iid) { - nsIDOMEventListener* ifaceListener = nsnull; - aListener->QueryInterface(*(td->iid), (void**) &ifaceListener); - if (ifaceListener) { - aTypeData = td; - NS_RELEASE(ifaceListener); - } - } - } - nsListenerStruct* ls; PRUint32 count = mListeners.Length(); for (PRUint32 i = 0; i < count; i++) { @@ -518,24 +420,6 @@ nsEventListenerManager::RemoveEventListener(nsIDOMEventListener *aListener, } } -nsresult -nsEventListenerManager::AddEventListenerByIID(nsIDOMEventListener *aListener, - const nsIID& aIID, - PRInt32 aFlags) -{ - return AddEventListener(aListener, NS_EVENT_TYPE_NULL, nsnull, - GetTypeDataForIID(aIID), aFlags); -} - -void -nsEventListenerManager::RemoveEventListenerByIID(nsIDOMEventListener *aListener, - const nsIID& aIID, - PRInt32 aFlags) -{ - RemoveEventListener(aListener, NS_EVENT_TYPE_NULL, nsnull, - GetTypeDataForIID(aIID), aFlags); -} - PRBool nsEventListenerManager::ListenerCanHandle(nsListenerStruct* aLs, nsEvent* aEvent) @@ -1377,9 +1261,7 @@ nsEventListenerManager::HasUnloadListeners() for (PRUint32 i = 0; i < count; ++i) { nsListenerStruct* ls = &mListeners.ElementAt(i); if (ls->mEventType == NS_PAGE_UNLOAD || - ls->mEventType == NS_BEFORE_PAGE_UNLOAD || - (ls->mTypeData && ls->mTypeData->iid && - ls->mTypeData->iid->Equals(NS_GET_IID(nsIDOMLoadListener)))) { + ls->mEventType == NS_BEFORE_PAGE_UNLOAD) { return PR_TRUE; } } diff --git a/content/events/src/nsEventListenerManager.h b/content/events/src/nsEventListenerManager.h index d0570064f7c1..0c8e3699bc32 100644 --- a/content/events/src/nsEventListenerManager.h +++ b/content/events/src/nsEventListenerManager.h @@ -97,10 +97,6 @@ public: * Sets events listeners of all types. * @param an event listener */ - nsresult AddEventListenerByIID(nsIDOMEventListener *aListener, - const nsIID& aIID, PRInt32 aFlags); - void RemoveEventListenerByIID(nsIDOMEventListener *aListener, - const nsIID& aIID, PRInt32 aFlags); nsresult AddEventListenerByType(nsIDOMEventListener *aListener, const nsAString& type, PRInt32 aFlags); diff --git a/content/xbl/src/nsXBLBinding.cpp b/content/xbl/src/nsXBLBinding.cpp index d0607e8fdc55..f8c6bec1a12d 100644 --- a/content/xbl/src/nsXBLBinding.cpp +++ b/content/xbl/src/nsXBLBinding.cpp @@ -73,13 +73,7 @@ // Event listeners #include "nsEventListenerManager.h" -#include "nsIDOMMouseListener.h" -#include "nsIDOMMouseMotionListener.h" -#include "nsIDOMLoadListener.h" -#include "nsIDOMFocusListener.h" -#include "nsIDOMKeyListener.h" -#include "nsIDOMFormListener.h" -#include "nsIDOMContextMenuListener.h" +#include "nsIDOMEventListener.h" #include "nsAttrName.h" #include "nsGkAtoms.h" diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index b4f0f4d9d947..a062ce2581db 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -66,13 +66,6 @@ #include "nsIDOMAttr.h" #include "nsIDOMDocument.h" #include "nsIDOMElement.h" -#include "nsIDOMMouseListener.h" -#include "nsIDOMMouseMotionListener.h" -#include "nsIDOMLoadListener.h" -#include "nsIDOMFocusListener.h" -#include "nsIDOMKeyListener.h" -#include "nsIDOMFormListener.h" -#include "nsIDOMContextMenuListener.h" #include "nsIDOMEventListener.h" #include "nsIDOMNodeList.h" #include "nsIDOMXULCommandDispatcher.h" diff --git a/content/xul/document/src/nsXULCommandDispatcher.h b/content/xul/document/src/nsXULCommandDispatcher.h index a11161164efd..5753c680b33c 100644 --- a/content/xul/document/src/nsXULCommandDispatcher.h +++ b/content/xul/document/src/nsXULCommandDispatcher.h @@ -48,7 +48,6 @@ #include "nsCOMPtr.h" #include "nsIDOMXULCommandDispatcher.h" -#include "nsIDOMFocusListener.h" #include "nsWeakReference.h" #include "nsIDOMNode.h" #include "nsString.h" diff --git a/dom/Makefile.in b/dom/Makefile.in index 2798eb318404..bc456356aa41 100644 --- a/dom/Makefile.in +++ b/dom/Makefile.in @@ -71,7 +71,6 @@ DIRS += interfaces/smil endif DIRS += \ - public/coreEvents \ base \ src \ locales \ diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 90a38d3da125..543f9f333910 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -7259,30 +7259,6 @@ nsGlobalWindow::AddEventListener(const nsAString& aType, aWantsUntrusted); } -nsresult -nsGlobalWindow::AddEventListenerByIID(nsIDOMEventListener* aListener, - const nsIID& aIID) -{ - nsEventListenerManager* manager = GetListenerManager(PR_TRUE); - NS_ENSURE_STATE(manager); - return manager->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); -} - -nsresult -nsGlobalWindow::RemoveEventListenerByIID(nsIDOMEventListener* aListener, - const nsIID& aIID) -{ - FORWARD_TO_INNER(RemoveEventListenerByIID, (aListener, aIID), - NS_ERROR_NOT_INITIALIZED); - - if (mListenerManager) { - mListenerManager->RemoveEventListenerByIID(aListener, aIID, - NS_EVENT_FLAG_BUBBLE); - return NS_OK; - } - return NS_ERROR_FAILURE; -} - nsEventListenerManager* nsGlobalWindow::GetListenerManager(PRBool aCreateIfNotFound) { diff --git a/dom/base/nsWindowRoot.cpp b/dom/base/nsWindowRoot.cpp index 3e419b6fdb87..9dfb91a72b0b 100644 --- a/dom/base/nsWindowRoot.cpp +++ b/dom/base/nsWindowRoot.cpp @@ -149,24 +149,6 @@ nsWindowRoot::AddEventListener(const nsAString& aType, return elm->AddEventListener(aType, aListener, aUseCapture, aWantsUntrusted); } -nsresult -nsWindowRoot::AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID) -{ - nsEventListenerManager* manager = GetListenerManager(PR_TRUE); - NS_ENSURE_STATE(manager); - return manager->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); -} - -nsresult -nsWindowRoot::RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID) -{ - nsEventListenerManager* manager = GetListenerManager(PR_TRUE); - if (manager) { - manager->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE); - } - return NS_OK; -} - nsEventListenerManager* nsWindowRoot::GetListenerManager(PRBool aCreateIfNotFound) { diff --git a/dom/interfaces/events/nsIDOMEventTarget.idl b/dom/interfaces/events/nsIDOMEventTarget.idl index 4a8f2012d20d..701306de358b 100644 --- a/dom/interfaces/events/nsIDOMEventTarget.idl +++ b/dom/interfaces/events/nsIDOMEventTarget.idl @@ -253,19 +253,6 @@ interface nsIDOMEventTarget : nsISupports [notxpcom, nostdcall] nsEventListenerManagerPtr GetListenerManager(in boolean aMayCreate); - /** - * Add an event listener for nsIID. - */ - [noscript, nostdcall] - void AddEventListenerByIID(in nsIDOMEventListener aListener, - in nsIIDRef aIID); - /** - * Remove event listener for nsIID. - */ - [noscript, nostdcall] - void RemoveEventListenerByIID(in nsIDOMEventListener aListener, - in nsIIDRef aIID); - /** * Get the script context in which the event handlers should be run. * May return null. diff --git a/dom/public/coreEvents/Makefile.in b/dom/public/coreEvents/Makefile.in deleted file mode 100644 index 0f66d2cc03ee..000000000000 --- a/dom/public/coreEvents/Makefile.in +++ /dev/null @@ -1,61 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either of the GNU General Public License Version 2 or later (the "GPL"), -# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = dom - -EXPORTS = \ - nsIDOMFocusListener.h \ - nsIDOMFormListener.h \ - nsIDOMKeyListener.h \ - nsIDOMLoadListener.h \ - nsIDOMMouseListener.h \ - nsIDOMMouseMotionListener.h \ - nsIDOMTextListener.h \ - nsIDOMCompositionListener.h \ - nsIDOMContextMenuListener.h \ - nsIDOMUIListener.h \ - $(NULL) - -include $(topsrcdir)/config/rules.mk - diff --git a/dom/public/coreEvents/nsIDOMCompositionListener.h b/dom/public/coreEvents/nsIDOMCompositionListener.h deleted file mode 100644 index 1b234c97543a..000000000000 --- a/dom/public/coreEvents/nsIDOMCompositionListener.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef nsIDOMCompositionListener_h__ -#define nsIDOMCompositionListener_h__ - -#include "nsIDOMEvent.h" -#include "nsIDOMEventListener.h" - -/* - * Key pressed / released / typed listener interface. - */ -// {47F158C0-C534-43a1-8415-8B17706E2FBC} -#define NS_IDOMCOMPOSITIONLISTENER_IID \ -{ 0x47f158c0, 0xc534, 0x43a1, \ -{ 0x84, 0x15, 0x8b, 0x17, 0x70, 0x6e, 0x2f, 0xbc } } - - -class nsIDOMCompositionListener : public nsIDOMEventListener { - -public: - - NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMCOMPOSITIONLISTENER_IID) - - NS_IMETHOD HandleStartComposition(nsIDOMEvent* aCompositionEvent) = 0; - NS_IMETHOD HandleEndComposition(nsIDOMEvent* aCompositionEvent) = 0; -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMCompositionListener, - NS_IDOMCOMPOSITIONLISTENER_IID) - -#endif // nsIDOMCompositionListener_h__ diff --git a/dom/public/coreEvents/nsIDOMContextMenuListener.h b/dom/public/coreEvents/nsIDOMContextMenuListener.h deleted file mode 100644 index e8639a87b7e6..000000000000 --- a/dom/public/coreEvents/nsIDOMContextMenuListener.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - - -#ifndef nsIDOMContextMenuListener_h__ -#define nsIDOMContextMenuListener_h__ - -#include "nsIDOMEvent.h" -#include "nsIDOMEventListener.h" - -/* - * Context menu event listener - * - */ -#define NS_IDOMCONTEXTMENULISTENER_IID \ -{ /* 162b3480-ded6-11d1-bd85-00805f8ae3f7 */ \ -0x162b3480, 0xded6, 0x11d1, \ -{0xbd, 0x85, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf7} } - -class nsIDOMContextMenuListener : public nsIDOMEventListener { - -public: - NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMCONTEXTMENULISTENER_IID) - /** - * Processes a context menu event - * @param aContextMenuEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - */ - NS_IMETHOD ContextMenu(nsIDOMEvent* aContextMenuEvent) = 0; - -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMContextMenuListener, - NS_IDOMCONTEXTMENULISTENER_IID) - -#endif // nsIDOMContextMenuListener_h__ diff --git a/dom/public/coreEvents/nsIDOMFocusListener.h b/dom/public/coreEvents/nsIDOMFocusListener.h deleted file mode 100644 index ffeb9b23f4da..000000000000 --- a/dom/public/coreEvents/nsIDOMFocusListener.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - - -#ifndef nsIDOMFocusListener_h__ -#define nsIDOMFocusListener_h__ - -#include "nsIDOMEvent.h" -#include "nsIDOMEventListener.h" - -/* - * Mouse up/down/move event listener - * - */ -#define NS_IDOMFOCUSLISTENER_IID \ -{ /* 80974670-ded6-11d1-bd85-00805f8ae3f4 */ \ -0x80974670, 0xded6, 0x11d1, \ -{0xbd, 0x85, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} } - -class nsIDOMFocusListener : public nsIDOMEventListener -{ -public: - - NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMFOCUSLISTENER_IID) - - /** - * Processes a focus event - * @param aMouseEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - */ - NS_IMETHOD Focus(nsIDOMEvent* aEvent) = 0; - - /** - * Processes a blur event - * @param aMouseEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - */ - NS_IMETHOD Blur(nsIDOMEvent* aEvent) = 0; -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMFocusListener, NS_IDOMFOCUSLISTENER_IID) - -#endif // nsIDOMFocusListener_h__ diff --git a/dom/public/coreEvents/nsIDOMFormListener.h b/dom/public/coreEvents/nsIDOMFormListener.h deleted file mode 100644 index 2a3238f5a393..000000000000 --- a/dom/public/coreEvents/nsIDOMFormListener.h +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - - -#ifndef nsIDOMFormListener_h__ -#define nsIDOMFormListener_h__ - -#include "nsIDOMEvent.h" -#include "nsIDOMEventListener.h" - -/* - * Form submit/reset listener - * - */ -#define NS_IDOMFORMLISTENER_IID \ -{ /* 566c3f80-28ab-11d2-bd89-00805f8ae3f4 */ \ -0x566c3f80, 0x28ab, 0x11d2, \ -{0xbd, 0x89, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} } - -class nsIDOMFormListener : public nsIDOMEventListener { - -public: - NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMFORMLISTENER_IID) - /** - * Processes a form submit event - * @param aEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - */ - NS_IMETHOD Submit(nsIDOMEvent* aEvent) = 0; - - /** - * Processes a form reset event - * @param aEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - */ - NS_IMETHOD Reset(nsIDOMEvent* aEvent) = 0; - - /** - * Processes a form change event - * @param aEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - */ - NS_IMETHOD Change(nsIDOMEvent* aEvent) = 0; - - /** - * Processes a form select event - * @param aEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - */ - NS_IMETHOD Select(nsIDOMEvent* aEvent) = 0; - - /** - * Processes a form input event - * @param aEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - */ - NS_IMETHOD Input(nsIDOMEvent* aEvent) = 0; - -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMFormListener, NS_IDOMFORMLISTENER_IID) - -#endif // nsIDOMFormListener_h__ diff --git a/dom/public/coreEvents/nsIDOMKeyListener.h b/dom/public/coreEvents/nsIDOMKeyListener.h deleted file mode 100644 index a9f1a6c0730f..000000000000 --- a/dom/public/coreEvents/nsIDOMKeyListener.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef nsIDOMKeyListener_h__ -#define nsIDOMKeyListener_h__ - -#include "nsIDOMEvent.h" -#include "nsIDOMEventListener.h" - -// X.h defines KeyPress -#ifdef KeyPress -#undef KeyPress -#endif - -/* - * Key pressed / released / typed listener interface. - */ -#define NS_IDOMKEYLISTENER_IID \ -{ /* 35f0d080-da38-11d1-bd85-00805f8ae3f4 */ \ -0x35f0d080, 0xda38, 0x11d1, \ -{0xbd, 0x85, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} } - -class nsIDOMKeyListener : public nsIDOMEventListener { - -public: - - NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMKEYLISTENER_IID) - - /** - * Processes a key pressed event - * @param aKeyEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - */ - NS_IMETHOD KeyDown(nsIDOMEvent* aKeyEvent) = 0; - - /** - * Processes a key release event - * @param aKeyEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - */ - NS_IMETHOD KeyUp(nsIDOMEvent* aKeyEvent) = 0; - - /** - * Processes a key typed event - * @param aKeyEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - * - */ - NS_IMETHOD KeyPress(nsIDOMEvent* aKeyEvent) = 0; - -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMKeyListener, NS_IDOMKEYLISTENER_IID) - -#endif // nsIDOMKeyListener_h__ diff --git a/dom/public/coreEvents/nsIDOMLoadListener.h b/dom/public/coreEvents/nsIDOMLoadListener.h deleted file mode 100644 index d2d3af464c7e..000000000000 --- a/dom/public/coreEvents/nsIDOMLoadListener.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - - -#ifndef nsIDOMLoadListener_h__ -#define nsIDOMLoadListener_h__ - -#include "nsIDOMEvent.h" -#include "nsIDOMEventListener.h" - -/* - * Document load related event listener - * - */ -#define NS_IDOMLOADLISTENER_IID \ -{ /* d1810238-14f8-4cab-9b96-96bedb9de7be */ \ -0xd1810238, 0x14f8, 0x4cab, \ -{0x9b, 0x96, 0x96, 0xbe, 0xdb, 0x9d, 0xe7, 0xbe} } - -class nsIDOMLoadListener : public nsIDOMEventListener { - -public: - NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMLOADLISTENER_IID) - /** - * Processes a page or image load event - * @param aMouseEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - */ - NS_IMETHOD Load(nsIDOMEvent* aEvent) = 0; - - /** - * Processes a page beforeUnload event - * @param aMouseEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - */ - NS_IMETHOD BeforeUnload(nsIDOMEvent* aEvent) = 0; - - /** - * Processes a page unload event - * @param aMouseEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - */ - NS_IMETHOD Unload(nsIDOMEvent* aEvent) = 0; - - /** - * Processes a load abort event - * @param aMouseEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - * - */ - NS_IMETHOD Abort(nsIDOMEvent* aEvent) = 0; - - /** - * Processes an load error event - * @param aMouseEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - */ - NS_IMETHOD Error(nsIDOMEvent* aEvent) = 0; - -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMLoadListener, NS_IDOMLOADLISTENER_IID) - -#endif // nsIDOMLoadListener_h__ diff --git a/dom/public/coreEvents/nsIDOMMouseListener.h b/dom/public/coreEvents/nsIDOMMouseListener.h deleted file mode 100644 index f09c2b732196..000000000000 --- a/dom/public/coreEvents/nsIDOMMouseListener.h +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - - -#ifndef nsIDOMMouseListener_h__ -#define nsIDOMMouseListener_h__ - -#include "nsIDOMEvent.h" -#include "nsIDOMEventListener.h" - -/* - * Mouse up/down/move event listener - * - */ -#define NS_IDOMMOUSELISTENER_IID \ -{ /* ccd7fa30-da37-11d1-bd85-00805f8ae3f4 */ \ -0xccd7fa30, 0xda37, 0x11d1, \ -{0xbd, 0x85, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} } - -class nsIDOMMouseListener : public nsIDOMEventListener { - -public: - - NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMMOUSELISTENER_IID) - - /** - * Processes a mouse down event - * @param aMouseEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - */ - NS_IMETHOD MouseDown(nsIDOMEvent* aMouseEvent) = 0; - - /** - * Processes a mouse up event - * @param aMouseEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - */ - NS_IMETHOD MouseUp(nsIDOMEvent* aMouseEvent) = 0; - - /** - * Processes a mouse click event - * @param aMouseEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - * - */ - NS_IMETHOD MouseClick(nsIDOMEvent* aMouseEvent) = 0; - - /** - * Processes a mouse click event - * @param aMouseEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - * - */ - NS_IMETHOD MouseDblClick(nsIDOMEvent* aMouseEvent) = 0; - - /** - * Processes a mouse enter event - * @param aMouseEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - */ - NS_IMETHOD MouseOver(nsIDOMEvent* aMouseEvent) = 0; - - /** - * Processes a mouse leave event - * @param aMouseEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - */ - NS_IMETHOD MouseOut(nsIDOMEvent* aMouseEvent) = 0; - -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMMouseListener, NS_IDOMMOUSELISTENER_IID) - -#endif // nsIDOMMouseListener_h__ diff --git a/dom/public/coreEvents/nsIDOMMouseMotionListener.h b/dom/public/coreEvents/nsIDOMMouseMotionListener.h deleted file mode 100644 index 44ba7b0c77e9..000000000000 --- a/dom/public/coreEvents/nsIDOMMouseMotionListener.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - - -#ifndef nsIDOMMouseMotionListener_h__ -#define nsIDOMMouseMotionListener_h__ - -#include "nsIDOMEvent.h" -#include "nsIDOMEventListener.h" - -/* - * Mouse motion event listener - * - */ -#define NS_IDOMMOUSEMOTIONLISTENER_IID \ -{ /* 162b3480-ded6-11d1-bd85-00805f8ae3f4 */ \ -0x162b3480, 0xded6, 0x11d1, \ -{0xbd, 0x85, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} } - -class nsIDOMMouseMotionListener : public nsIDOMEventListener { - -public: - NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMMOUSEMOTIONLISTENER_IID) - /** - * Processes a mouse move event - * @param aMouseEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - */ - NS_IMETHOD MouseMove(nsIDOMEvent* aMouseEvent) = 0; - - /** - * Processes a drag move event - * @param aMouseEvent @see nsIDOMEvent.h - * @returns whether the event was consumed or ignored. @see nsresult - */ - NS_IMETHOD DragMove(nsIDOMEvent* aMouseEvent) = 0; - -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMMouseMotionListener, - NS_IDOMMOUSEMOTIONLISTENER_IID) - -#endif // nsIDOMMouseMotionListener_h__ diff --git a/dom/public/coreEvents/nsIDOMTextListener.h b/dom/public/coreEvents/nsIDOMTextListener.h deleted file mode 100644 index a7d135d8fa6e..000000000000 --- a/dom/public/coreEvents/nsIDOMTextListener.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef nsIDOMTextListener_h__ -#define nsIDOMTextListener_h__ - -#include "nsIDOMEvent.h" -#include "nsIDOMEventListener.h" - -/* - * Key pressed / released / typed listener interface. - */ -// {C6296E81-D823-11d2-9E7F-0060089FE59B} -#define NS_IDOMTEXTLISTENER_IID \ -{ 0xc6296e81, 0xd823, 0x11d2, { 0x9e, 0x7f, 0x0, 0x60, 0x8, 0x9f, 0xe5, 0x9b } } - - -class nsIDOMTextListener : public nsIDOMEventListener -{ -public: - - NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMTEXTLISTENER_IID) - - NS_IMETHOD HandleText(nsIDOMEvent* aTextEvent) = 0; - -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMTextListener, NS_IDOMTEXTLISTENER_IID) - -#endif // nsIDOMTextListener_h__ diff --git a/dom/public/coreEvents/nsIDOMUIListener.h b/dom/public/coreEvents/nsIDOMUIListener.h deleted file mode 100644 index 6ec746606021..000000000000 --- a/dom/public/coreEvents/nsIDOMUIListener.h +++ /dev/null @@ -1,63 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * IBM Corporation. - * Portions created by the Initial Developer are Copyright (C) 2003 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Brian Ryner - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef nsIDOMUIListener_h__ -#define nsIDOMUIListener_h__ - -#include "nsIDOMEventListener.h" - -class nsIDOMEvent; - -/* - * UI event listener interface. - */ -// {5cb5527a-512f-4163-9393-ca95ceddbc13} -#define NS_IDOMUILISTENER_IID \ -{ 0x5cb5527a, 0x512f, 0x4163, { 0x93, 0x93, 0xca, 0x95, 0xce, 0xdd, 0xbc, 0x13 } } - -class nsIDOMUIListener : public nsIDOMEventListener { - public: - NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMUILISTENER_IID) - - NS_IMETHOD Activate(nsIDOMEvent* aEvent) = 0; - NS_IMETHOD FocusIn(nsIDOMEvent* aEvent) = 0; - NS_IMETHOD FocusOut(nsIDOMEvent* aEvent) = 0; -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMUIListener, NS_IDOMUILISTENER_IID) - -#endif // nsIDOMUIListener_h__ diff --git a/dom/src/events/nsJSEventListener.h b/dom/src/events/nsJSEventListener.h index f80d96c2d86f..eb85495138e4 100644 --- a/dom/src/events/nsJSEventListener.h +++ b/dom/src/events/nsJSEventListener.h @@ -40,7 +40,7 @@ #include "nsIDOMKeyEvent.h" #include "nsIJSEventListener.h" -#include "nsIDOMMouseListener.h" +#include "nsIDOMEventListener.h" #include "jsapi.h" #include "nsCOMPtr.h" #include "nsIAtom.h" diff --git a/editor/libeditor/html/nsHTMLDataTransfer.cpp b/editor/libeditor/html/nsHTMLDataTransfer.cpp index b69cac740dce..262d8bbc077c 100644 --- a/editor/libeditor/html/nsHTMLDataTransfer.cpp +++ b/editor/libeditor/html/nsHTMLDataTransfer.cpp @@ -51,8 +51,6 @@ #include "nsIDOMEventTarget.h" #include "nsIDOMNSEvent.h" #include "nsIDOMKeyEvent.h" -#include "nsIDOMKeyListener.h" -#include "nsIDOMMouseListener.h" #include "nsIDOMMouseEvent.h" #include "nsIDOMComment.h" #include "nsISelection.h" diff --git a/editor/libeditor/html/nsHTMLEditorStyle.cpp b/editor/libeditor/html/nsHTMLEditorStyle.cpp index 2751b42ce291..c7fd0836f5fb 100644 --- a/editor/libeditor/html/nsHTMLEditorStyle.cpp +++ b/editor/libeditor/html/nsHTMLEditorStyle.cpp @@ -44,8 +44,6 @@ #include "nsHTMLEditUtils.h" #include "nsIDOMNodeList.h" #include "nsIDOMAttr.h" -#include "nsIDOMKeyListener.h" -#include "nsIDOMMouseListener.h" #include "nsIDOMMouseEvent.h" #include "nsISelection.h" #include "nsISelectionPrivate.h" diff --git a/editor/libeditor/text/nsPlaintextEditor.cpp b/editor/libeditor/text/nsPlaintextEditor.cpp index e420debb037e..0d72da1d4677 100644 --- a/editor/libeditor/text/nsPlaintextEditor.cpp +++ b/editor/libeditor/text/nsPlaintextEditor.cpp @@ -48,7 +48,6 @@ #include "nsIDocument.h" #include "nsIDOMEventTarget.h" #include "nsIDOMKeyEvent.h" -#include "nsIDOMMouseListener.h" #include "nsISelection.h" #include "nsISelectionPrivate.h" #include "nsISelectionController.h" diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp index fbd41d81ae8d..0a8a6bc9714c 100644 --- a/layout/forms/nsTextControlFrame.cpp +++ b/layout/forms/nsTextControlFrame.cpp @@ -89,7 +89,6 @@ #include "nsIDOMNSEvent.h" #include "nsIDOMNSUIEvent.h" -#include "nsIDOMFocusListener.h" //onchange events #include "nsIDOMCharacterData.h" //for selection setting helper func #include "nsIDOMNodeList.h" //for selection setting helper func #include "nsIDOMRange.h" //for selection setting helper func @@ -105,7 +104,6 @@ #include "nsIDOMText.h" //for multiline getselection #include "nsNodeInfoManager.h" #include "nsContentCreatorFunctions.h" -#include "nsIDOMKeyListener.h" #include "nsINativeKeyBindings.h" #include "nsIJSContextStack.h" #include "nsFocusManager.h" diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index c2660fe08096..88e33b9877dd 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -55,7 +55,7 @@ #include "nsWidgetsCID.h" #include "nsIView.h" #include "nsIViewManager.h" -#include "nsIDOMKeyListener.h" +#include "nsIDOMEventListener.h" #include "nsIDOMDragEvent.h" #include "nsPluginHost.h" #include "nsString.h" @@ -84,10 +84,6 @@ #include "nsIDOMHTMLEmbedElement.h" #include "nsIDOMHTMLAppletElement.h" #include "nsIDOMWindow.h" -#include "nsIDOMMouseListener.h" -#include "nsIDOMMouseMotionListener.h" -#include "nsIDOMFocusListener.h" -#include "nsIDOMContextMenuListener.h" #include "nsIDOMEventTarget.h" #include "nsIDOMNSEvent.h" #include "nsIPrivateDOMEvent.h" diff --git a/layout/printing/nsPrintEngine.cpp b/layout/printing/nsPrintEngine.cpp index 840dc24d9b1a..1edaae4bcdea 100644 --- a/layout/printing/nsPrintEngine.cpp +++ b/layout/printing/nsPrintEngine.cpp @@ -101,7 +101,6 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro // Focus #include "nsIDOMEventTarget.h" -#include "nsIDOMFocusListener.h" #include "nsISelectionController.h" // Misc diff --git a/xpfe/appshell/src/nsWebShellWindow.cpp b/xpfe/appshell/src/nsWebShellWindow.cpp index 203a99c53a6c..0f935b8e6f28 100644 --- a/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/xpfe/appshell/src/nsWebShellWindow.cpp @@ -56,7 +56,6 @@ #include "nsPIDOMWindow.h" #include "nsIDOMEventTarget.h" #include "nsIPrivateDOMEvent.h" -#include "nsIDOMFocusListener.h" #include "nsIWebNavigation.h" #include "nsIWindowWatcher.h" From cfbed984e013bc3acb6601cb0dfac1343a443a20 Mon Sep 17 00:00:00 2001 From: Jonas Sicking Date: Mon, 8 Aug 2011 11:26:26 -0700 Subject: [PATCH 20/30] Bug 661297 Part 2: Remove supporting code no longer needed once all event listeners are registered using a event name. r=smaug --- content/events/src/nsEventListenerManager.cpp | 288 +++--------------- content/events/src/nsEventListenerManager.h | 4 - 2 files changed, 49 insertions(+), 243 deletions(-) diff --git a/content/events/src/nsEventListenerManager.cpp b/content/events/src/nsEventListenerManager.cpp index 800304942b91..546d7bcf3065 100644 --- a/content/events/src/nsEventListenerManager.cpp +++ b/content/events/src/nsEventListenerManager.cpp @@ -41,6 +41,7 @@ #include "nsEventListenerManager.h" #include "nsCaret.h" #include "nsIDOMNSEvent.h" +#include "nsIDOMEventListener.h" #include "nsITextControlFrame.h" #include "nsGkAtoms.h" #include "nsPIDOMWindow.h" @@ -84,13 +85,9 @@ using namespace mozilla::dom; #define EVENT_TYPE_EQUALS( ls, type, userType ) \ - (ls->mEventType && ls->mEventType == type && \ + (ls->mEventType == type && \ (ls->mEventType != NS_USER_DEFINED_EVENT || ls->mTypeAtom == userType)) -#define EVENT_TYPE_DATA_EQUALS( type1, type2 ) \ - (type1 && type2 && type1->iid && type2->iid && \ - type1->iid->Equals(*(type2->iid))) - static NS_DEFINE_CID(kDOMScriptObjectFactoryCID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID); @@ -127,67 +124,6 @@ MutationBitForEventType(PRUint32 aEventType) return 0; } -typedef -NS_STDCALL_FUNCPROTO(nsresult, - GenericHandler, - nsIDOMEventListener, HandleEvent, - (nsIDOMEvent*)); - -/* - * Things here are not as they appear. Namely, |ifaceListener| below is - * not really a pointer to the nsIDOMEventListener interface, and aMethod is - * not really a pointer-to-member for nsIDOMEventListener. They both - * actually refer to the event-type-specific listener interface. The casting - * magic allows us to use a single dispatch method. This relies on the - * assumption that nsIDOMEventListener and the event type listener interfaces - * have the same object layout and will therefore have compatible - * pointer-to-member implementations. - */ - -static nsresult DispatchToInterface(nsIDOMEvent* aEvent, - nsIDOMEventListener* aListener, - GenericHandler aMethod, - const nsIID& aIID) -{ - nsIDOMEventListener* ifaceListener = nsnull; - nsresult rv = NS_OK; - aListener->QueryInterface(aIID, (void**) &ifaceListener); - NS_WARN_IF_FALSE(ifaceListener, - "DispatchToInterface couldn't QI to the right interface"); - if (ifaceListener) { - rv = (ifaceListener->*aMethod)(aEvent); - NS_RELEASE(ifaceListener); - } - return rv; -} - -struct EventDispatchData -{ - PRUint32 message; - GenericHandler method; -}; - -struct EventTypeData -{ - const EventDispatchData* events; - int numEvents; - const nsIID* iid; -}; - -#define HANDLER(x) reinterpret_cast(x) - -#define IMPL_EVENTTYPEDATA(type) \ -{ \ - s##type##Events, \ - NS_ARRAY_LENGTH(s##type##Events), \ - &NS_GET_IID(nsIDOM##type##Listener) \ -} - -// IMPORTANT: indices match up with eEventArrayType_ enum values - -static const EventTypeData sEventTypes[] = { -}; - PRUint32 nsEventListenerManager::sCreatedCount = 0; nsEventListenerManager::nsEventListenerManager(nsISupports* aTarget) : @@ -252,33 +188,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_NATIVE(nsEventListenerManager) NS_IMPL_CYCLE_COLLECTION_UNLINK_END -const EventTypeData* -nsEventListenerManager::GetTypeDataForIID(const nsIID& aIID) -{ - for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(sEventTypes); ++i) { - if (aIID.Equals(*(sEventTypes[i].iid))) { - return &sEventTypes[i]; - } - } - return nsnull; -} - -const EventTypeData* -nsEventListenerManager::GetTypeDataForEventName(nsIAtom* aName) -{ - PRUint32 event = nsContentUtils::GetEventId(aName); - if (event != NS_USER_DEFINED_EVENT) { - for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(sEventTypes); ++i) { - for (PRInt32 j = 0; j < sEventTypes[i].numEvents; ++j) { - if (event == sEventTypes[i].events[j].message) { - return &sEventTypes[i]; - } - } - } - } - return nsnull; -} - nsPIDOMWindow* nsEventListenerManager::GetInnerWindowForTarget() { @@ -304,11 +213,10 @@ nsresult nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener, PRUint32 aType, nsIAtom* aTypeAtom, - const EventTypeData* aTypeData, PRInt32 aFlags) { NS_ENSURE_TRUE(aListener, NS_ERROR_FAILURE); - NS_ENSURE_TRUE(aType || aTypeData, NS_ERROR_FAILURE); + NS_ENSURE_TRUE(aType, NS_ERROR_FAILURE); nsRefPtr kungFuDeathGrip = aListener; @@ -317,8 +225,7 @@ nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener, for (PRUint32 i = 0; i < count; i++) { ls = &mListeners.ElementAt(i); if (ls->mListener == aListener && ls->mFlags == aFlags && - (EVENT_TYPE_EQUALS(ls, aType, aTypeAtom) || - EVENT_TYPE_DATA_EQUALS(aTypeData, ls->mTypeData))) { + EVENT_TYPE_EQUALS(ls, aType, aTypeAtom)) { return NS_OK; } } @@ -332,7 +239,6 @@ nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener, ls->mTypeAtom = aTypeAtom; ls->mFlags = aFlags; ls->mHandlerIsString = PR_FALSE; - ls->mTypeData = aTypeData; if (aFlags & NS_EVENT_FLAG_SYSTEM_EVENT) { mMayHaveSystemGroupListeners = PR_TRUE; @@ -393,10 +299,9 @@ void nsEventListenerManager::RemoveEventListener(nsIDOMEventListener *aListener, PRUint32 aType, nsIAtom* aUserType, - const EventTypeData* aTypeData, PRInt32 aFlags) { - if (!aListener || !(aType || aTypeData)) { + if (!aListener || !aType) { return; } @@ -408,9 +313,7 @@ nsEventListenerManager::RemoveEventListener(nsIDOMEventListener *aListener, ls = &mListeners.ElementAt(i); if (ls->mListener == aListener && ((ls->mFlags & ~NS_PRIV_EVENT_UNTRUSTED_PERMITTED) == aFlags) && - (EVENT_TYPE_EQUALS(ls, aType, aUserType) || - (!(ls->mEventType) && - EVENT_TYPE_DATA_EQUALS(ls->mTypeData, aTypeData)))) { + EVENT_TYPE_EQUALS(ls, aType, aUserType)) { nsRefPtr kungFuDeathGrip = this; mListeners.RemoveElementAt(i); mNoListenerForEvent = NS_EVENT_TYPE_NULL; @@ -420,15 +323,15 @@ nsEventListenerManager::RemoveEventListener(nsIDOMEventListener *aListener, } } -PRBool -nsEventListenerManager::ListenerCanHandle(nsListenerStruct* aLs, - nsEvent* aEvent) +static inline PRBool +ListenerCanHandle(nsListenerStruct* aLs, nsEvent* aEvent) { - if (aEvent->message == NS_USER_DEFINED_EVENT) { - // We don't want to check aLs->mEventType here, bug 276846. - return (aEvent->userType && aLs->mTypeAtom == aEvent->userType); - } - return (aLs->mEventType == aEvent->message); + // This is slightly different from EVENT_TYPE_EQUALS in that it returns + // true even when aEvent->message == NS_USER_DEFINED_EVENT and + // aLs=>mEventType != NS_USER_DEFINED_EVENT as long as the atoms are the same + return aEvent->message == NS_USER_DEFINED_EVENT ? + (aLs->mTypeAtom == aEvent->userType) : + (aLs->mEventType == aEvent->message); } nsresult @@ -438,7 +341,7 @@ nsEventListenerManager::AddEventListenerByType(nsIDOMEventListener *aListener, { nsCOMPtr atom = do_GetAtom(NS_LITERAL_STRING("on") + aType); PRUint32 type = nsContentUtils::GetEventId(atom); - return AddEventListener(aListener, type, atom, nsnull, aFlags); + return AddEventListener(aListener, type, atom, aFlags); } void @@ -448,7 +351,7 @@ nsEventListenerManager::RemoveEventListenerByType(nsIDOMEventListener *aListener { nsCOMPtr atom = do_GetAtom(NS_LITERAL_STRING("on") + aType); PRUint32 type = nsContentUtils::GetEventId(atom); - RemoveEventListener(aListener, type, atom, nsnull, aFlags); + RemoveEventListener(aListener, type, atom, aFlags); } nsListenerStruct* @@ -487,7 +390,7 @@ nsEventListenerManager::SetJSEventListener(nsIScriptContext *aContext, rv = NS_NewJSEventListener(aContext, aScopeObject, mTarget, aName, getter_AddRefs(scriptListener)); if (NS_SUCCEEDED(rv)) { - AddEventListener(scriptListener, eventType, aName, nsnull, + AddEventListener(scriptListener, eventType, aName, NS_EVENT_FLAG_BUBBLE | NS_PRIV_EVENT_FLAG_SCRIPT); ls = FindJSEventListener(eventType, aName); @@ -962,10 +865,6 @@ nsEventListenerManager::HandleEventSubType(nsListenerStruct* aListenerStruct, return result; } -static PRUint32 sLatestEventType = 0; -static const EventTypeData* sLatestEventTypeData = nsnull; -static const EventDispatchData* sLatestEventDispData = nsnull; - /** * Causes a check for event listeners and processing by them if they exist. * @param an event listener @@ -985,79 +884,39 @@ nsEventListenerManager::HandleEventInternal(nsPresContext* aPresContext, aEvent->flags |= NS_EVENT_FLAG_NO_DEFAULT; } - const EventTypeData* typeData = nsnull; - const EventDispatchData* dispData = nsnull; - if (aEvent->message != NS_USER_DEFINED_EVENT) { - // Check if this is the same type of event as what a listener manager - // handled last time. - if (aEvent->message == sLatestEventType) { - typeData = sLatestEventTypeData; - dispData = sLatestEventDispData; - goto found; - } - for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(sEventTypes); ++i) { - typeData = &sEventTypes[i]; - for (PRInt32 j = 0; j < typeData->numEvents; ++j) { - dispData = &(typeData->events[j]); - if (aEvent->message == dispData->message) { - sLatestEventType = aEvent->message; - sLatestEventTypeData = typeData; - sLatestEventDispData = dispData; - goto found; - } - } - typeData = nsnull; - dispData = nsnull; - } - } - -found: - nsAutoTObserverArray::EndLimitedIterator iter(mListeners); nsAutoPopupStatePusher popupStatePusher(nsDOMEvent::GetEventPopupControlState(aEvent)); PRBool hasListener = PR_FALSE; while (iter.HasMore()) { nsListenerStruct* ls = &iter.GetNext(); - PRBool useTypeInterface = - EVENT_TYPE_DATA_EQUALS(ls->mTypeData, typeData); - PRBool useGenericInterface = - (!useTypeInterface && ListenerCanHandle(ls, aEvent)); - // Don't fire the listener if it's been removed. // Check that the phase is same in event and event listener. // Handle only trusted events, except when listener permits untrusted events. - if (useTypeInterface || useGenericInterface) { - if (ls->mListener) { - hasListener = PR_TRUE; - // XXX The (mFlags & aFlags) test here seems fragile. Shouldn't we - // specifically only test the capture/bubble flags. - if ((ls->mFlags & aFlags & ~NS_EVENT_FLAG_SYSTEM_EVENT) && - (ls->mFlags & NS_EVENT_FLAG_SYSTEM_EVENT) == - (aFlags & NS_EVENT_FLAG_SYSTEM_EVENT) && - (NS_IS_TRUSTED_EVENT(aEvent) || - ls->mFlags & NS_PRIV_EVENT_UNTRUSTED_PERMITTED)) { - if (!*aDOMEvent) { - nsEventDispatcher::CreateEvent(aPresContext, aEvent, - EmptyString(), aDOMEvent); - } - if (*aDOMEvent) { + if (ListenerCanHandle(ls, aEvent)) { + hasListener = PR_TRUE; + // XXX The (mFlags & aFlags) test here seems fragile. Shouldn't we + // specifically only test the capture/bubble flags. + if ((ls->mFlags & aFlags & ~NS_EVENT_FLAG_SYSTEM_EVENT) && + (ls->mFlags & NS_EVENT_FLAG_SYSTEM_EVENT) == + (aFlags & NS_EVENT_FLAG_SYSTEM_EVENT) && + (NS_IS_TRUSTED_EVENT(aEvent) || + ls->mFlags & NS_PRIV_EVENT_UNTRUSTED_PERMITTED)) { + if (!*aDOMEvent) { + nsEventDispatcher::CreateEvent(aPresContext, aEvent, + EmptyString(), aDOMEvent); + } + if (*aDOMEvent) { + if (!aEvent->currentTarget) { + aEvent->currentTarget = aCurrentTarget->GetTargetForDOMEvent(); if (!aEvent->currentTarget) { - aEvent->currentTarget = aCurrentTarget->GetTargetForDOMEvent(); - if (!aEvent->currentTarget) { - break; - } + break; } - nsRefPtr kungFuDeathGrip = ls->mListener; - if (useTypeInterface) { - aPusher->Pop(); - DispatchToInterface(*aDOMEvent, ls->mListener, - dispData->method, *typeData->iid); - } else if (useGenericInterface && - aPusher->RePush(aCurrentTarget)) { - if (NS_FAILED(HandleEventSubType(ls, ls->mListener, *aDOMEvent, - aCurrentTarget, aFlags, - aPusher))) { - aEvent->flags |= NS_EVENT_FLAG_EXCEPTION_THROWN; - } + } + nsRefPtr kungFuDeathGrip = ls->mListener; + if (aPusher->RePush(aCurrentTarget)) { + if (NS_FAILED(HandleEventSubType(ls, ls->mListener, *aDOMEvent, + aCurrentTarget, aFlags, + aPusher))) { + aEvent->flags |= NS_EVENT_FLAG_EXCEPTION_THROWN; } } } @@ -1151,30 +1010,11 @@ PRBool nsEventListenerManager::HasListenersFor(const nsAString& aEventName) { nsCOMPtr atom = do_GetAtom(NS_LITERAL_STRING("on") + aEventName); - PRUint32 type = nsContentUtils::GetEventId(atom); - - const EventTypeData* typeData = nsnull; - const EventDispatchData* dispData = nsnull; - if (type != NS_USER_DEFINED_EVENT) { - for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(sEventTypes); ++i) { - typeData = &sEventTypes[i]; - for (PRInt32 j = 0; j < typeData->numEvents; ++j) { - dispData = &(typeData->events[j]); - if (type == dispData->message) { - goto found; - } - } - typeData = nsnull; - dispData = nsnull; - } - } -found: PRUint32 count = mListeners.Length(); for (PRUint32 i = 0; i < count; ++i) { nsListenerStruct* ls = &mListeners.ElementAt(i); - if (ls->mTypeAtom == atom || - EVENT_TYPE_DATA_EQUALS(ls->mTypeData, typeData)) { + if (ls->mTypeAtom == atom) { return PR_TRUE; } } @@ -1213,43 +1053,13 @@ nsEventListenerManager::GetListenerInfo(nsCOMArray* aList) PR_TRUE); } } - if (ls.mTypeData) { - // Handle special event listener interfaces, like nsIDOMFocusListener. - for (PRInt32 j = 0; j < ls.mTypeData->numEvents; ++j) { - const EventDispatchData* dispData = &(ls.mTypeData->events[j]); - const char* eventName = nsDOMEvent::GetEventName(dispData->message); - if (eventName) { - NS_ConvertASCIItoUTF16 eventType(eventName); - nsRefPtr info = - new nsEventListenerInfo(eventType, ls.mListener, capturing, - allowsUntrusted, systemGroup); - NS_ENSURE_TRUE(info, NS_ERROR_OUT_OF_MEMORY); - aList->AppendObject(info); - } - } - } else if (ls.mEventType == NS_USER_DEFINED_EVENT) { - // Handle user defined event types. - if (ls.mTypeAtom) { - const nsDependentSubstring& eventType = - Substring(nsDependentAtomString(ls.mTypeAtom), 2); - nsRefPtr info = - new nsEventListenerInfo(eventType, ls.mListener, capturing, - allowsUntrusted, systemGroup); - NS_ENSURE_TRUE(info, NS_ERROR_OUT_OF_MEMORY); - aList->AppendObject(info); - } - } else { - // Handle normal events. - const char* eventName = nsDOMEvent::GetEventName(ls.mEventType); - if (eventName) { - NS_ConvertASCIItoUTF16 eventType(eventName); - nsRefPtr info = - new nsEventListenerInfo(eventType, ls.mListener, capturing, - allowsUntrusted, systemGroup); - NS_ENSURE_TRUE(info, NS_ERROR_OUT_OF_MEMORY); - aList->AppendObject(info); - } - } + const nsDependentSubstring& eventType = + Substring(nsDependentAtomString(ls.mTypeAtom), 2); + nsRefPtr info = + new nsEventListenerInfo(eventType, ls.mListener, capturing, + allowsUntrusted, systemGroup); + NS_ENSURE_TRUE(info, NS_ERROR_OUT_OF_MEMORY); + aList->AppendObject(info); } return NS_OK; } diff --git a/content/events/src/nsEventListenerManager.h b/content/events/src/nsEventListenerManager.h index 0c8e3699bc32..506fea2a80dd 100644 --- a/content/events/src/nsEventListenerManager.h +++ b/content/events/src/nsEventListenerManager.h @@ -67,7 +67,6 @@ typedef struct { nsCOMPtr mTypeAtom; PRUint16 mFlags; PRBool mHandlerIsString; - const EventTypeData* mTypeData; } nsListenerStruct; /* @@ -214,17 +213,14 @@ protected: nsresult AddEventListener(nsIDOMEventListener *aListener, PRUint32 aType, nsIAtom* aTypeAtom, - const EventTypeData* aTypeData, PRInt32 aFlags); void RemoveEventListener(nsIDOMEventListener *aListener, PRUint32 aType, nsIAtom* aUserType, - const EventTypeData* aTypeData, PRInt32 aFlags); void RemoveAllListeners(); const EventTypeData* GetTypeDataForIID(const nsIID& aIID); const EventTypeData* GetTypeDataForEventName(nsIAtom* aName); - PRBool ListenerCanHandle(nsListenerStruct* aLs, nsEvent* aEvent); nsPIDOMWindow* GetInnerWindowForTarget(); PRUint32 mMayHavePaintEventListener : 1; From cf89c95f1d7365040e53fc7c0acdf183815fa5bc Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Mon, 8 Aug 2011 20:31:52 +0200 Subject: [PATCH 21/30] Bug 676387 - XUL elements with -moz-appearance should ignore clicks in their overflow. r=roc --- layout/base/nsDisplayList.cpp | 15 +++++++++------ layout/reftests/native-theme/676387-1-ref.xul | 6 ++++++ layout/reftests/native-theme/676387-1.xul | 12 ++++++++++++ layout/reftests/native-theme/reftest.list | 2 ++ 4 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 layout/reftests/native-theme/676387-1-ref.xul create mode 100644 layout/reftests/native-theme/676387-1.xul diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 4b22670d2723..0fb5623320f3 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -1023,12 +1023,15 @@ nsDisplayBackground::HitTest(nsDisplayListBuilder* aBuilder, HitTestState* aState, nsTArray *aOutFrames) { - // For theme backgrounds, assume that any point in our bounds is a hit. - // We don't know the true hit region of the theme background. - if (!mIsThemed && - !RoundedBorderIntersectsRect(mFrame, ToReferenceFrame(), aRect)) { - // aRect doesn't intersect our border-radius curve. - return; + if (mIsThemed) { + // For theme backgrounds, assume that any point in our border rect is a hit. + if (!nsRect(ToReferenceFrame(), mFrame->GetSize()).Intersects(aRect)) + return; + } else { + if (!RoundedBorderIntersectsRect(mFrame, ToReferenceFrame(), aRect)) { + // aRect doesn't intersect our border-radius curve. + return; + } } aOutFrames->AppendElement(mFrame); diff --git a/layout/reftests/native-theme/676387-1-ref.xul b/layout/reftests/native-theme/676387-1-ref.xul new file mode 100644 index 000000000000..e532708823c5 --- /dev/null +++ b/layout/reftests/native-theme/676387-1-ref.xul @@ -0,0 +1,6 @@ + + + +