Bug 454590: Link widget should not scroll its contents
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras
index 13fd2f9..88324b5 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras
@@ -2874,6 +2874,10 @@
 			<arg swt_gen="true"></arg>
 			<retval swt_gen="true"></retval>
 		</method>
+		<method selector="setVerticalScrollElasticity:" swt_gen="true">
+			<arg swt_gen="true"></arg>
+			<retval swt_gen="true"></retval>
+		</method>
 		<method selector="setVerticalScroller:" swt_gen="true">
 			<arg swt_gen="true"></arg>
 			<retval swt_gen="true"></retval>
@@ -4896,6 +4900,7 @@
 	<enum name="NSRoundedBezelStyle" swt_gen="true"></enum>
 	<enum name="NSRoundedDisclosureBezelStyle" swt_gen="true"></enum>
 	<enum name="NSScaleNone" swt_gen="true"></enum>
+	<enum name="NSScrollElasticityNone" swt_gen="true"></enum>
 	<enum name="NSScrollWheel" swt_gen="true"></enum>
 	<enum name="NSScrollerDecrementLine" swt_gen="true"></enum>
 	<enum name="NSScrollerDecrementPage" swt_gen="true"></enum>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSScrollView.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSScrollView.java
index 19620bf..3c586cf 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSScrollView.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSScrollView.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -90,6 +90,10 @@
 	OS.objc_msgSend(this.id, OS.sel_setHorizontalScroller_, anObject != null ? anObject.id : 0);
 }
 
+public void setVerticalScrollElasticity(long /*int*/ elasticity) {
+	OS.objc_msgSend(this.id, OS.sel_setVerticalScrollElasticity_, elasticity);
+}
+
 public void setVerticalScroller(NSScroller anObject) {
 	OS.objc_msgSend(this.id, OS.sel_setVerticalScroller_, anObject != null ? anObject.id : 0);
 }
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
index d246764..9e3d914 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
@@ -2082,6 +2082,7 @@
 public static final long /*int*/ sel_setValue_forKey_ = sel_registerName("setValue:forKey:");
 public static final long /*int*/ sel_setValueWraps_ = sel_registerName("setValueWraps:");
 public static final long /*int*/ sel_setValues_forParameter_ = sel_registerName("setValues:forParameter:");
+public static final long /*int*/ sel_setVerticalScrollElasticity_ = sel_registerName("setVerticalScrollElasticity:");
 public static final long /*int*/ sel_setVerticalScroller_ = sel_registerName("setVerticalScroller:");
 public static final long /*int*/ sel_setView_ = sel_registerName("setView:");
 public static final long /*int*/ sel_setVisible_ = sel_registerName("setVisible:");
@@ -2485,6 +2486,7 @@
 public static final int NSRoundedBezelStyle = 1;
 public static final int NSRoundedDisclosureBezelStyle = 14;
 public static final int NSScaleNone = 2;
+public static final int NSScrollElasticityNone = 1;
 public static final int NSScrollWheel = 22;
 public static final int NSScrollerDecrementLine = 4;
 public static final int NSScrollerDecrementPage = 1;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Link.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Link.java
index 3e85a9b..937417e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Link.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Link.java
@@ -187,14 +187,12 @@
 
 void createHandle () {
 	state |= THEME_BACKGROUND;
-	if (hasBorder()) {
-		NSScrollView scrollWidget = (NSScrollView)new SWTScrollView().alloc();
-		scrollWidget.init();
-		scrollWidget.setDrawsBackground(false);
-		scrollWidget.setAutoresizesSubviews (true);
-		scrollWidget.setBorderType(OS.NSBezelBorder);
-		scrollView = scrollWidget;
-	}
+	NSScrollView scrollWidget = (NSScrollView)new SWTScrollView().alloc();
+	scrollWidget.init();
+	scrollWidget.setDrawsBackground(false);
+	scrollWidget.setAutoresizesSubviews (true);
+	scrollWidget.setBorderType(hasBorder() ? OS.NSBezelBorder : OS.NSNoBorder);
+	if (OS.VERSION_MMB >= OS.VERSION_MMB(10, 7, 0))	scrollWidget.setVerticalScrollElasticity(OS.NSScrollElasticityNone);
 
 	NSTextView widget = (NSTextView)new SWTTextView().alloc();
 	widget.init();
@@ -216,6 +214,7 @@
 	dict.setObject(NSCursor.arrowCursor(), OS.NSCursorAttributeName);
 	widget.setSelectedTextAttributes(dict);
 	
+	scrollView = scrollWidget;
 	view = widget;
 }
 
@@ -385,7 +384,7 @@
 
 void register () {
 	super.register ();
-	if (scrollView != null) display.addWidget(scrollView, this);
+	display.addWidget(scrollView, this);
 }
 
 void releaseHandle () {
@@ -577,6 +576,12 @@
 	return mnemonic;
 }
 
+@Override
+void scrollWheel(long id, long sel, long theEvent) {
+	super.scrollWheel(id, sel, theEvent);
+	parent.scrollWheel(parent.view.id, sel, theEvent);
+}
+
 void sendFocusEvent(int type) {
 	if (focusIndex != -1) redrawWidget(view, false);
 	super.sendFocusEvent(type);
@@ -719,7 +724,7 @@
 }
 
 NSView topView () {
-	return scrollView != null ? scrollView : super.topView();
+	return scrollView;
 }
 
 int traversalCode (int key, NSEvent theEvent) {
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Link.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Link.java
index 6b37f56..1e48ce0 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Link.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Link.java
@@ -13,8 +13,6 @@
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Link;
 
@@ -144,52 +142,4 @@
 	} catch (IllegalArgumentException e) {
 	}
 }
-
-/* custom */
-@Override
-public void test_setBoundsIIII() {
-	link.setBounds(10, 20, 30, 40);
-	// only check x, y, and width - you can't set the height of a link e.g. on Cocoa
-	assertTrue(link.getBounds().x == 10);
-	assertTrue(link.getBounds().y == 20);
-	assertTrue(link.getBounds().width == 30);
-}
-
-@Override
-public void test_setBoundsLorg_eclipse_swt_graphics_Rectangle() {
-	link.setBounds(new Rectangle(10, 20, 30, 40));
-	// only check x, y, and width - you can't set the height of a link e.g. on Cocoa
-	assertTrue(link.getBounds().x == 10);
-	assertTrue(link.getBounds().y == 20);
-	assertTrue(link.getBounds().width == 30);
-}
-
-@Override
-public void test_setSizeII() {
-	link.setSize(30, 40);
-	// only check the width - you can't set the height of a link e.g. on Cocoa
-	assertTrue(link.getSize().x == 30);
-
-	link.setSize(32, 43);
-	// only check the width - you can't set the height of a link e.g. on Cocoa
-	assertTrue(link.getSize().x == 32);
-}
-
-@Override
-public void test_setSizeLorg_eclipse_swt_graphics_Point() {
-	link.setSize(new Point(30, 40));
-	// only check the width - you can't set the height of a link e.g. on Cocoa
-	assertTrue(link.getSize().x == 30);
-
-	link.setBounds(32, 43, 33, 44);
-	// only check the width - you can't set the height of a link e.g. on Cocoa
-	assertTrue(link.getSize().x == 33);
-
-	link.setBounds(32, 43, 30, 40);
-	link.setLocation(11, 22);
-	link.setSize(new Point(32, 43));
-	// only check the width - you can't set the height of a link e.g. on Cocoa
-	assertTrue(link.getSize().x == 32);
-}
-
 }