Skip to content

Commit

Permalink
Use getBoundingClientRect.height
Browse files Browse the repository at this point in the history
  • Loading branch information
jridgewell committed Jan 8, 2019
1 parent 900c211 commit b4de619
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/service/viewport/viewport-binding-ios-embed-sd.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,9 @@ export class ViewportBindingIosEmbedShadowRoot_ {
/** @override */
getContentHeight() {
const scrollingElement = this.wrapper_;
const rect = scrollingElement./*OK*/getBoundingClientRect();
const style = getComputedStyle(scrollingElement);
return scrollingElement./*OK*/scrollHeight
return rect.height
+ this.paddingTop_
+ this.getBorderTop()
+ parseInt(style.marginTop, 10)
Expand Down
3 changes: 2 additions & 1 deletion src/service/viewport/viewport-binding-ios-embed-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,9 @@ export class ViewportBindingIosEmbedWrapper_ {
/** @override */
getContentHeight() {
const scrollingElement = this.wrapper_;
const rect = scrollingElement./*OK*/getBoundingClientRect();
const style = getComputedStyle(scrollingElement);
return scrollingElement./*OK*/scrollHeight
return rect.height
+ this.getBorderTop()
+ parseInt(style.marginTop, 10)
+ parseInt(style.marginBottom, 10);
Expand Down
3 changes: 2 additions & 1 deletion src/service/viewport/viewport-binding-natural.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,9 @@ export class ViewportBindingNatural_ {
/** @override */
getContentHeight() {
const scrollingElement = this.getScrollingElement();
const rect = scrollingElement./*OK*/getBoundingClientRect();
const style = getComputedStyle(scrollingElement);
return scrollingElement./*OK*/scrollHeight
return rect.height
+ parseInt(style.marginTop, 10)
+ parseInt(style.marginBottom, 10);
}
Expand Down

0 comments on commit b4de619

Please sign in to comment.