Fix: Border line is missing.

In Unified view the border line between
the number columns is missing.

This commit fixes this bug and  shifts the line
number column's width and align format.

Change-Id: Ieb1019c4ee899338f0219480839b11ddf8b8aeab
This commit is contained in:
Bruce Zu
2012-10-23 15:56:49 +08:00
parent e687f19300
commit 29caf967ec
3 changed files with 36 additions and 16 deletions

View File

@@ -178,6 +178,7 @@ public interface GerritCss extends CssResource {
String registerScreenNextLinks();
String registerScreenSection();
String rightmost();
String rightBorder();
String rpcStatus();
String rpcStatusLoading();
String rpcStatusPanel();

View File

@@ -682,8 +682,8 @@
.lineNumber {
padding-left: 0.2em;
white-space: pre;
width: 3.5em;
text-align: right;
width: 1.5em;
text-align: center;
padding-right: 0.2em;
background: white;
border-bottom: 1px solid white;
@@ -691,6 +691,9 @@
.lineNumber.rightmost {
border-left: thin solid #b0bdcc;
}
.lineNumber.rightBorder {
border-right: thin solid #b0bdcc;
}
.lineNumber a {
color: #888;
text-decoration: none;

View File

@@ -149,8 +149,8 @@ public class UnifiedDiffTable extends AbstractPatchContentTable {
while (hunk.next()) {
if (hunk.isContextLine()) {
openLine(nc);
appendLineNumber(nc, hunk.getCurA());
appendLineNumber(nc, hunk.getCurB());
appendLineNumberForSideA(nc, hunk.getCurA());
appendLineNumberForSideB(nc, hunk.getCurB());
appendLineText(nc, false, CONTEXT, a, hunk.getCurA());
closeLine(nc);
hunk.incBoth();
@@ -158,8 +158,8 @@ public class UnifiedDiffTable extends AbstractPatchContentTable {
} else if (hunk.isDeletedA()) {
openLine(nc);
appendLineNumber(nc, hunk.getCurA());
padLineNumber(nc);
appendLineNumberForSideA(nc, hunk.getCurA());
padLineNumberForSideB(nc);
appendLineText(nc, syntaxHighlighting, DELETE, a, hunk.getCurA());
closeLine(nc);
hunk.incA();
@@ -171,8 +171,8 @@ public class UnifiedDiffTable extends AbstractPatchContentTable {
} else if (hunk.isInsertedB()) {
openLine(nc);
padLineNumber(nc);
appendLineNumber(nc, hunk.getCurB());
padLineNumberForSideA(nc);
appendLineNumberForSideB(nc, hunk.getCurB());
appendLineText(nc, syntaxHighlighting, INSERT, b, hunk.getCurB());
closeLine(nc);
hunk.incB();
@@ -253,6 +253,7 @@ public class UnifiedDiffTable extends AbstractPatchContentTable {
super.insertRow(row);
final CellFormatter fmt = table.getCellFormatter();
fmt.addStyleName(row, PC - 2, Gerrit.RESOURCES.css().lineNumber());
fmt.addStyleName(row, PC - 2, Gerrit.RESOURCES.css().rightBorder());
fmt.addStyleName(row, PC - 1, Gerrit.RESOURCES.css().lineNumber());
fmt.addStyleName(row, PC, Gerrit.RESOURCES.css().diffText());
}
@@ -269,8 +270,8 @@ public class UnifiedDiffTable extends AbstractPatchContentTable {
private void appendFileHeader(final SafeHtmlBuilder m, final String line) {
openLine(m);
padLineNumber(m);
padLineNumber(m);
padLineNumberForSideA(m);
padLineNumberForSideB(m);
m.openTd();
m.addStyleName(Gerrit.RESOURCES.css().diffText());
@@ -282,8 +283,8 @@ public class UnifiedDiffTable extends AbstractPatchContentTable {
private void appendHunkHeader(final SafeHtmlBuilder m, final Hunk hunk) {
openLine(m);
padLineNumber(m);
padLineNumber(m);
padLineNumberForSideA(m);
padLineNumberForSideB(m);
m.openTd();
m.addStyleName(Gerrit.RESOURCES.css().diffText());
@@ -352,8 +353,8 @@ public class UnifiedDiffTable extends AbstractPatchContentTable {
private void appendNoLF(final SafeHtmlBuilder m) {
openLine(m);
padLineNumber(m);
padLineNumber(m);
padLineNumberForSideA(m);
padLineNumberForSideB(m);
m.openTd();
m.addStyleName(Gerrit.RESOURCES.css().diffText());
m.addStyleName(Gerrit.RESOURCES.css().diffTextNoLF());
@@ -374,16 +375,31 @@ public class UnifiedDiffTable extends AbstractPatchContentTable {
m.closeTr();
}
private void padLineNumber(final SafeHtmlBuilder m) {
private void padLineNumberForSideB(final SafeHtmlBuilder m) {
m.openTd();
m.setStyleName(Gerrit.RESOURCES.css().lineNumber());
m.closeTd();
}
private void appendLineNumber(final SafeHtmlBuilder m, final int idx) {
private void padLineNumberForSideA(final SafeHtmlBuilder m) {
m.openTd();
m.setStyleName(Gerrit.RESOURCES.css().lineNumber());
m.addStyleName(Gerrit.RESOURCES.css().rightBorder());
m.closeTd();
}
private void appendLineNumberForSideB(final SafeHtmlBuilder m, final int idx) {
m.openTd();
m.setStyleName(Gerrit.RESOURCES.css().lineNumber());
m.append(SafeHtml.asis("<a href=\"javascript:void(0)\">"+ (idx + 1) + "</a>"));
m.closeTd();
}
private void appendLineNumberForSideA(final SafeHtmlBuilder m, final int idx) {
m.openTd();
m.setStyleName(Gerrit.RESOURCES.css().lineNumber());
m.addStyleName(Gerrit.RESOURCES.css().rightBorder());
m.append(SafeHtml.asis("<a href=\"javascript:void(0)\">"+ (idx + 1) + "</a>"));
m.closeTd();
}
}