Fix the position of the hovercard

The desired position was 'right', but it appeared 'bottom-right',
because the height of the hovercard was calculated as 2px at the time
of updating the position.

Debugging the problem I have checked that several dom-ifs were not yet
evaluated properly, so a flush() before updating the hovercard position
fixes the problem.

Bug: Issue 13080
Change-Id: Id0d98b68799d80fce3dd861dafa1ce32158e62b5
diff --git a/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard-behavior.js b/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard-behavior.js
index 571e49a..0d351f6 100644
--- a/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard-behavior.js
+++ b/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard-behavior.js
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 import '../../../styles/shared-styles.js';
-import {dom} from '@polymer/polymer/lib/legacy/polymer.dom.js';
+import {flush, dom} from '@polymer/polymer/lib/legacy/polymer.dom.js';
 import {getRootElement} from '../../../scripts/rootElement.js';
 
 const HOVER_CLASS = 'hovered';
@@ -261,6 +261,10 @@
     // position for it.
     this.classList.add(HIDE_CLASS);
     this.classList.add(HOVER_CLASS);
+    // Make sure that the hovercard actually rendered and all dom-if
+    // statements processed, so that we can measure the (invisible)
+    // hovercard properly in updatePosition().
+    flush();
     this.updatePosition();
     this.classList.remove(HIDE_CLASS);
   }