mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
protection against negative offsets
This commit is contained in:
@@ -223,10 +223,10 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
|
||||
}
|
||||
|
||||
public int getDecrementButtonHeight() {
|
||||
return decrButton.getHeight();
|
||||
return Math.max(0, decrButton.getHeight());
|
||||
}
|
||||
public int getIncrementButtonHeight() {
|
||||
return incrButton.getHeight();
|
||||
return Math.max(0, incrButton.getHeight());
|
||||
}
|
||||
|
||||
private void resetRegularThumbAnimator() {
|
||||
|
||||
@@ -4822,22 +4822,21 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
int getDecScrollButtonHeight() {
|
||||
ScrollBarUI barUI = getUI();
|
||||
Insets insets = getInsets();
|
||||
int top = Math.max(0, insets.top);
|
||||
if (barUI instanceof ButtonlessScrollBarUI) {
|
||||
return insets.top + ((ButtonlessScrollBarUI)barUI).getDecrementButtonHeight();
|
||||
return top + ((ButtonlessScrollBarUI)barUI).getDecrementButtonHeight();
|
||||
}
|
||||
else if (barUI instanceof BasicScrollBarUI) {
|
||||
if (barUI instanceof BasicScrollBarUI) {
|
||||
try {
|
||||
JButton decrButtonValue = (JButton)decrButtonField.get(barUI);
|
||||
LOG.assertTrue(decrButtonValue != null);
|
||||
return insets.top + decrButtonValue.getHeight();
|
||||
return top + decrButtonValue.getHeight();
|
||||
}
|
||||
catch (Exception exc) {
|
||||
throw new IllegalStateException(exc);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return insets.top + 15;
|
||||
}
|
||||
return top + 15;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-1
@@ -127,9 +127,10 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
|
||||
|
||||
void recalcEditorDimensions() {
|
||||
EditorImpl.MyScrollBar scrollBar = myEditor.getVerticalScrollBar();
|
||||
int scrollBarHeight = scrollBar.getSize().height;
|
||||
int scrollBarHeight = Math.max(0, scrollBar.getSize().height);
|
||||
|
||||
myEditorScrollbarTop = scrollBar.getDecScrollButtonHeight()/* + 1*/;
|
||||
assert myEditorScrollbarTop>=0;
|
||||
int editorScrollbarBottom = scrollBar.getIncScrollButtonHeight();
|
||||
myEditorTargetHeight = scrollBarHeight - myEditorScrollbarTop - editorScrollbarBottom;
|
||||
myEditorSourceHeight = myEditor.getPreferredHeight();
|
||||
|
||||
Reference in New Issue
Block a user