Update how ClientWebView HTML preferred size changes are sent to the app.

* ui/client-web-view.js (PageState): Use event listeners to send
  coalesced preferred height changes, rather than using polling. Call
  ::load on DOM loaded, not on complete page loaded, so in-place
  mutations take affect ASAP. Replace ::preferredHeightChanged with
  ::updatePreferredHeight method that checks that the height has changed
  before sending the message to the app.

* ui/composer-web-view.js: Remove loaded event handler, it's managed by
  the base class now.

* ui/conversation-web-view.js (ConversationPageState): Rename
  ::updatePreferredHeight to ::pollPreferredHeightUpdate to avoid name
  clash with parent class. Stop polling if no change has occurred after a
  number of repeated checks. Remove loaded event handler, it's managed by
  the base class now.
  (ComposerPageState::createControllableQuotes): Don't update preferred
  height at the end of the call since it will be handled by the DOM load
  event handler.
This commit is contained in:
Michael James Gratton 2017-01-24 19:30:12 +11:00
parent 78d116d054
commit 5dfcfe4c8e
3 changed files with 50 additions and 29 deletions

View file

@ -102,8 +102,7 @@ ComposerPageState.prototype = {
};
this.bodyObserver.observe(this.messageBody, config);
// Chain up here so we continue to a preferred size update
// after munging the HTML above.
// Chain up
PageState.prototype.loaded.apply(this, []);
},
undo: function() {
@ -434,6 +433,3 @@ let SelectionUtil = {
var geary = new ComposerPageState();
window.onload = function() {
geary.loaded();
};