implement specific selection behavior for InlineNodeReference

Signed-off-by: Florian Thienel <florian@thienel.org>
diff --git a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/boxes/InlineNodeReference.java b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/boxes/InlineNodeReference.java
index f3ed08b..920851b 100644
--- a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/boxes/InlineNodeReference.java
+++ b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/boxes/InlineNodeReference.java
@@ -15,7 +15,6 @@
 import org.eclipse.core.runtime.Assert;
 import org.eclipse.vex.core.internal.core.Color;
 import org.eclipse.vex.core.internal.core.Graphics;
-import org.eclipse.vex.core.internal.core.NodeTag;
 import org.eclipse.vex.core.internal.core.Rectangle;
 import org.eclipse.vex.core.provisional.dom.ContentRange;
 import org.eclipse.vex.core.provisional.dom.INode;
@@ -26,9 +25,6 @@
  */
 public class InlineNodeReference extends BaseBox implements IInlineBox, IDecoratorBox<IInlineBox>, IContentBox {
 
-	private static final float HIGHLIGHT_LIGHTEN_AMOUNT = 0.6f;
-	private static final int HIGHLIGHT_BORDER_WIDTH = 4;
-
 	private IBox parent;
 	private int top;
 	private int left;
@@ -181,27 +177,23 @@
 
 	@Override
 	public void highlight(final Graphics graphics, final Color foreground, final Color background) {
-		final Color lightBackground = background.lighten(HIGHLIGHT_LIGHTEN_AMOUNT);
-		fillBackground(graphics, lightBackground);
-		drawBorder(graphics, background);
+		fillBackground(graphics, background);
 
 		accept(new DepthFirstBoxTraversal<Object>() {
 			@Override
 			public Object visit(final InlineNodeReference box) {
 				if (box != InlineNodeReference.this) {
-					box.highlightInside(graphics, foreground, lightBackground);
+					box.highlightInside(graphics, foreground, background);
 				}
 				return super.visit(box);
 			}
 
 			@Override
 			public Object visit(final TextContent box) {
-				box.highlight(graphics, foreground, lightBackground);
+				box.highlight(graphics, foreground, background);
 				return super.visit(box);
 			}
 		});
-
-		drawTag(graphics, foreground, background);
 	}
 
 	private void fillBackground(final Graphics graphics, final Color color) {
@@ -210,19 +202,6 @@
 		graphics.fillRect(getAbsoluteLeft(), getAbsoluteTop(), width, height);
 	}
 
-	private void drawBorder(final Graphics graphics, final Color color) {
-		graphics.setForeground(graphics.getColor(color));
-		graphics.setBackground(graphics.getColor(color));
-		graphics.setLineWidth(HIGHLIGHT_BORDER_WIDTH);
-		graphics.drawRect(getAbsoluteLeft(), getAbsoluteTop(), width, height);
-	}
-
-	private void drawTag(final Graphics graphics, final Color foreground, final Color background) {
-		graphics.setForeground(graphics.getColor(foreground));
-		graphics.setBackground(graphics.getColor(background));
-		NodeTag.drawTag(graphics, node, getAbsoluteLeft() + width / 2, getAbsoluteTop() + height / 2, true, true);
-	}
-
 	public void highlightInside(final Graphics graphics, final Color foreground, final Color background) {
 		fillBackground(graphics, background);
 	}
diff --git a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/cursor/Cursor.java b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/cursor/Cursor.java
index 6792bb7..5edcc3c 100644
--- a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/cursor/Cursor.java
+++ b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/cursor/Cursor.java
@@ -152,7 +152,7 @@
 
 			@Override
 			public Object visit(final InlineNodeReference box) {
-				if (selectedRange.contains(box.getRange())) {
+				if (selectedRange.contains(box.getNode().getRange())) {
 					box.highlight(graphics, SELECTION_FOREGROUND_COLOR, SELECTION_BACKGROUND_COLOR);
 					return null;
 				}