Fix expandAfter(), add workaround for first lines
Previously the method was missing the "replacedWith" workaround for first lines. Added a LoadHandler to make the table cell containing the avatar visible only when the avatar is loaded. Change-Id: Ie0c69e1e70f3e1c5f0b4347e003ba68263140a0a
This commit is contained in:
		| @@ -23,6 +23,8 @@ import com.google.gwt.dom.client.Element; | ||||
| import com.google.gwt.event.dom.client.ClickEvent; | ||||
| import com.google.gwt.event.dom.client.ClickHandler; | ||||
| import com.google.gwt.event.dom.client.HasClickHandlers; | ||||
| import com.google.gwt.event.dom.client.LoadEvent; | ||||
| import com.google.gwt.event.dom.client.LoadHandler; | ||||
| import com.google.gwt.event.shared.HandlerRegistration; | ||||
| import com.google.gwt.resources.client.CssResource; | ||||
| import com.google.gwt.uibinder.client.UiBinder; | ||||
| @@ -76,9 +78,13 @@ class CommentBoxHeader extends Composite implements HasClickHandlers { | ||||
|       avatar = new AvatarImage(); | ||||
|     } | ||||
|     initWidget(uiBinder.createAndBindUi(this)); | ||||
|     if (author == null) { | ||||
|     UIObject.setVisible(avatarCell, false); | ||||
|     avatar.addLoadHandler(new LoadHandler() { | ||||
|       @Override | ||||
|       public void onLoad(LoadEvent event) { | ||||
|         UIObject.setVisible(avatarCell, true); | ||||
|       } | ||||
|     }); | ||||
|     draft = isDraft; | ||||
|     if (when != null) { | ||||
|       setDate(when); | ||||
|   | ||||
| @@ -153,12 +153,22 @@ class SkipBar extends Composite { | ||||
|  | ||||
|   private void expandAfter() { | ||||
|     FromTo fromTo = marker.find(); | ||||
|     int start = fromTo.getFrom().getLine(); | ||||
|     int oldEnd = fromTo.getTo().getLine(); | ||||
|     int newEnd = oldEnd - NUM_ROWS_TO_EXPAND; | ||||
|     marker.clear(); | ||||
|     marker = cm.markText(CodeMirror.pos(fromTo.getFrom().getLine()), | ||||
|     if (widget == null) { // First line workaround | ||||
|       marker = cm.markText(CodeMirror.pos(-1), | ||||
|           CodeMirror.pos(newEnd), | ||||
|           Configuration.create() | ||||
|             .set("inclusiveLeft", true) | ||||
|             .set("inclusiveRight", true) | ||||
|             .set("replacedWith", getElement())); | ||||
|     } else { | ||||
|       marker = cm.markText(CodeMirror.pos(start), | ||||
|           CodeMirror.pos(newEnd), | ||||
|           COLLAPSED); | ||||
|     } | ||||
|     updateSkipNum(); | ||||
|     cm.focus(); | ||||
|   } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Michael Zhou
					Michael Zhou