Minor fixes from merge to viewport

Also remove an unused function
This commit is contained in:
Kovid Goyal 2020-08-14 10:30:09 +05:30
parent 5da5d527c4
commit f228431fb9
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -237,15 +237,11 @@ class ScrollViewport:
# Horizontal in vertical mode # Horizontal in vertical mode
return self.viewport_to_document(pos, 0, doc)[0] return self.viewport_to_document(pos, 0, doc)[0]
def viewport_to_document_inline_block(self, inline, block): def viewport_to_document_inline_block(self, inline, block, doc):
if self.horizontal_writing_mode: if self.horizontal_writing_mode:
return self.viewport_to_document(inline, block) return self.viewport_to_document(inline, block, doc)
return self.viewport_to_document(block, inline) return self.viewport_to_document(block, inline, doc)
def element_from_point(self, doc, x, y):
if self.rtl:
return doc.elementFromPoint(-x, y)
return doc.elementFromPoint(x, y)
class IOSScrollViewport(ScrollViewport): class IOSScrollViewport(ScrollViewport):
@ -264,6 +260,8 @@ class IOSScrollViewport(ScrollViewport):
document.documentElement.style.transform = f'translateX({x}px) translateY({y}px)' document.documentElement.style.transform = f'translateX({x}px) translateY({y}px)'
def paged_scroll_to(self, x, y): def paged_scroll_to(self, x, y):
x = x or 0
y = y or 0
if self.ltr: if self.ltr:
self._scroll_implementation(x, y) self._scroll_implementation(x, y)
else: else:
@ -280,7 +278,7 @@ class IOSScrollViewport(ScrollViewport):
ans = parseInt(raw) ans = parseInt(raw)
if isNaN(ans): if isNaN(ans):
return 0 return 0
if not self.rtl: if self.ltr:
ans *= -1 ans *= -1
return ans return ans
@ -306,7 +304,7 @@ class IOSScrollViewport(ScrollViewport):
left += p.offsetLeft left += p.offsetLeft
p = p.offsetParent p = p.offsetParent
# left -= window_width() // 2 # left -= window_width() // 2
self._scroll_implementation(max(0, left)) self._scroll_implementation(max(0, left), 0)
def paged___reset_transforms(self): def paged___reset_transforms(self):
s = document.documentElement.style s = document.documentElement.style