Revert "Scroll from the window when rendering entire file"
This reverts commit b07a26f2eb.
Codemirror expects to be able to scroll Codemirror instance in
order to execute any line navigation. Furthermore, horizontal
scrollbars are rendered in the Codemirror at the bottom of the
document (not window). In order to have a "window" scroll bar,
we would likely have to steal the scroll bars inside Codemirror
and make it look like the window scroll bar.
Change-Id: I3199edc039ba716723eaf8032eaa5355c2100666
This commit is contained in:
@@ -55,7 +55,6 @@ class DiffTable extends Composite {
|
||||
@UiField Element patchSetNavRow;
|
||||
@UiField Element patchSetNavCellA;
|
||||
@UiField Element patchSetNavCellB;
|
||||
@UiField Element sidePanelCell;
|
||||
@UiField FlowPanel widgets;
|
||||
@UiField static DiffTableStyle style;
|
||||
|
||||
|
||||
@@ -44,10 +44,6 @@ limitations under the License.
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.difftable .CodeMirror {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/* Preserve space for underscores. If this changes
|
||||
* see ChunkManager.addPadding() and adjust there.
|
||||
*/
|
||||
@@ -154,9 +150,7 @@ limitations under the License.
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td ui:field='sidePanelCell' class='{style.sidePanelCell}'>
|
||||
<d:SidePanel ui:field='sidePanel'/>
|
||||
</td>
|
||||
<td class='{style.sidePanelCell}'><d:SidePanel ui:field='sidePanel'/></td>
|
||||
</tr>
|
||||
</table>
|
||||
<g:FlowPanel ui:field='widgets' visible='false'/>
|
||||
|
||||
@@ -33,7 +33,6 @@ limitations under the License.
|
||||
font-family: arial,sans-serif;
|
||||
font-weight: bold;
|
||||
overflow: hidden;
|
||||
position: fixed !important;
|
||||
text-align: left;
|
||||
text-shadow: 1px 1px 7px #000000;
|
||||
min-width: 300px;
|
||||
|
||||
@@ -52,7 +52,6 @@ import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.UIObject;
|
||||
import com.google.gwtexpui.globalkey.client.GlobalKey;
|
||||
import com.google.gwtexpui.globalkey.client.KeyCommand;
|
||||
import com.google.gwtexpui.globalkey.client.KeyCommandSet;
|
||||
@@ -203,8 +202,7 @@ public class SideBySide2 extends Screen {
|
||||
@Override
|
||||
public void onShowView() {
|
||||
super.onShowView();
|
||||
Window.enableScrolling(prefs.renderEntireFile());
|
||||
UIObject.setVisible(diffTable.sidePanelCell, !prefs.renderEntireFile());
|
||||
Window.enableScrolling(false);
|
||||
if (prefs.hideTopMenu()) {
|
||||
Gerrit.setHeaderVisible(false);
|
||||
}
|
||||
@@ -219,10 +217,8 @@ public class SideBySide2 extends Screen {
|
||||
operation(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!prefs.renderEntireFile()) {
|
||||
cmA.setHeight(height);
|
||||
cmB.setHeight(height);
|
||||
}
|
||||
cmA.setHeight(height);
|
||||
cmB.setHeight(height);
|
||||
cmA.refresh();
|
||||
cmB.refresh();
|
||||
}
|
||||
@@ -470,13 +466,11 @@ public class SideBySide2 extends Screen {
|
||||
|
||||
operation(new Runnable() {
|
||||
public void run() {
|
||||
if (!prefs.renderEntireFile()) {
|
||||
// Estimate initial CM3 height, fixed up in onShowView.
|
||||
int height = Window.getClientHeight()
|
||||
- (Gerrit.getHeaderFooterHeight() + 18);
|
||||
cmA.setHeight(height);
|
||||
cmB.setHeight(height);
|
||||
}
|
||||
// Estimate initial CM3 height, fixed up in onShowView.
|
||||
int height = Window.getClientHeight()
|
||||
- (Gerrit.getHeaderFooterHeight() + 18);
|
||||
cmA.setHeight(height);
|
||||
cmB.setHeight(height);
|
||||
|
||||
render(diff);
|
||||
commentManager.render(comments, prefs.expandAllComments());
|
||||
@@ -624,9 +618,6 @@ public class SideBySide2 extends Screen {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (prefs.renderEntireFile()) {
|
||||
return;
|
||||
}
|
||||
Viewport fromTo = cm.getViewport();
|
||||
int size = fromTo.getTo() - fromTo.getFrom() + 1;
|
||||
if (cm.getOldViewportSize() == size) {
|
||||
@@ -766,25 +757,17 @@ public class SideBySide2 extends Screen {
|
||||
if (prefs.renderEntireFile()) {
|
||||
cmA.addKeyMap(RENDER_ENTIRE_FILE_KEYMAP);
|
||||
cmB.addKeyMap(RENDER_ENTIRE_FILE_KEYMAP);
|
||||
cmA.setHeight("");
|
||||
cmB.setHeight("");
|
||||
}
|
||||
|
||||
cmA.setOption("viewportMargin", prefs.renderEntireFile() ? POSITIVE_INFINITY : 10);
|
||||
cmB.setOption("viewportMargin", prefs.renderEntireFile() ? POSITIVE_INFINITY : 10);
|
||||
|
||||
Window.enableScrolling(prefs.renderEntireFile());
|
||||
UIObject.setVisible(diffTable.sidePanelCell, !prefs.renderEntireFile());
|
||||
resizeCodeMirror();
|
||||
}
|
||||
|
||||
void resizeCodeMirror() {
|
||||
if (!prefs.renderEntireFile()) {
|
||||
int height = getCodeMirrorHeight();
|
||||
cmA.setHeight(height);
|
||||
cmB.setHeight(height);
|
||||
diffTable.sidePanel.adjustGutters(cmB);
|
||||
}
|
||||
int height = getCodeMirrorHeight();
|
||||
cmA.setHeight(height);
|
||||
cmB.setHeight(height);
|
||||
diffTable.sidePanel.adjustGutters(cmB);
|
||||
}
|
||||
|
||||
private int getCodeMirrorHeight() {
|
||||
|
||||
Reference in New Issue
Block a user