Guest User

Untitled

a guest
Jan 17th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.10 KB | None | 0 0
  1. # HG changeset patch
  2. # Parent 91733ae6497c63c7dc5ae11ad6e4221a396c4ed5
  3.  
  4. diff --git a/layout/base/MobileViewportManager.cpp b/layout/base/MobileViewportManager.cpp
  5. --- a/layout/base/MobileViewportManager.cpp
  6. +++ b/layout/base/MobileViewportManager.cpp
  7. @@ -103,9 +103,21 @@ float MobileViewportManager::ComputeIntr
  8.  
  9. ScreenIntSize displaySize = ViewAs<ScreenPixel>(
  10. mDisplaySize, PixelCastJustification::LayoutDeviceIsScreenForBounds);
  11. + CSSSize layoutViewportSize;
  12. +
  13. + nsIScrollableFrame* rootScrollableFrame =
  14. + mPresShell->GetRootScrollFrameAsScrollable();
  15. + if (!mIsFirstPaint && rootScrollableFrame) {
  16. + nsRect scrollableRect = nsLayoutUtils::CalculateScrollableRectForFrame(
  17. + rootScrollableFrame, nullptr);
  18. + layoutViewportSize = CSSSize::FromAppUnits(scrollableRect.Size());
  19. + } else {
  20. + layoutViewportSize = mMobileViewportSize;
  21. + }
  22. +
  23. CSSToScreenScale intrinsicScale =
  24. ComputeIntrinsicScale(mDocument->GetViewportInfo(displaySize),
  25. - displaySize, mMobileViewportSize);
  26. + displaySize, layoutViewportSize);
  27. CSSToLayoutDeviceScale cssToDev =
  28. mPresShell->GetPresContext()->CSSToDevPixelScale();
  29. return (intrinsicScale / cssToDev).scale;
  30. diff --git a/layout/generic/ViewportFrame.cpp b/layout/generic/ViewportFrame.cpp
  31. --- a/layout/generic/ViewportFrame.cpp
  32. +++ b/layout/generic/ViewportFrame.cpp
  33. @@ -258,15 +258,24 @@ nsRect ViewportFrame::AdjustReflowInputA
  34. "We don't handle correct positioning of fixed frames with "
  35. "scrollbars in odd positions");
  36.  
  37. - // Layout fixed position elements to the visual viewport size if and only if
  38. + // Layout fixed position elements to the layout viewport size if and only if
  39. // it has been set and it is larger than the computed size, otherwise use the
  40. // computed size.
  41. nsRect rect(0, 0, aReflowInput->ComputedWidth(),
  42. aReflowInput->ComputedHeight());
  43. nsIPresShell* ps = PresShell();
  44. - if (ps->IsVisualViewportSizeSet() &&
  45. - rect.Size() < ps->GetVisualViewportSize()) {
  46. - rect.SizeTo(ps->GetVisualViewportSize());
  47. + if (ps->IsVisualViewportSizeSet()) {
  48. + if (rect.Size() < ps->GetVisualViewportSize()) {
  49. + rect.SizeTo(ps->GetVisualViewportSize());
  50. + }
  51. + if (nsIScrollableFrame* rootScrollableFrame =
  52. + ps->GetRootScrollFrameAsScrollable()) {
  53. + nsRect layoutViewport = nsLayoutUtils::CalculateScrollableRectForFrame(
  54. + rootScrollableFrame, nullptr);
  55. + if (rect.Size() < layoutViewport.Size()) {
  56. + rect.SizeTo(layoutViewport.Size());
  57. + }
  58. + }
  59. }
  60. return rect;
  61. }
  62. diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp
  63. --- a/layout/painting/nsDisplayList.cpp
  64. +++ b/layout/painting/nsDisplayList.cpp
  65. @@ -965,15 +965,25 @@ nsDisplayListBuilder::OutOfFlowDisplayDa
  66. // We want to ensure that fixed position elements are visible when
  67. // being async scrolled, so we paint them at the size of the larger
  68. // viewport.
  69. - dirtyRectRelativeToDirtyFrame =
  70. - nsRect(nsPoint(0, 0), aFrame->GetParent()->GetSize());
  71. + nsIFrame* parent = aFrame->GetParent();
  72. + dirtyRectRelativeToDirtyFrame = nsRect(nsPoint(0, 0), parent->GetSize());
  73.  
  74. nsIPresShell* ps = aFrame->PresShell();
  75. - if (ps->IsVisualViewportSizeSet() &&
  76. - dirtyRectRelativeToDirtyFrame.Size() < ps->GetVisualViewportSize()) {
  77. - dirtyRectRelativeToDirtyFrame.SizeTo(ps->GetVisualViewportSize());
  78. - }
  79. -
  80. + if (ps->IsVisualViewportSizeSet()) {
  81. + if (dirtyRectRelativeToDirtyFrame.Size() < ps->GetVisualViewportSize()) {
  82. + dirtyRectRelativeToDirtyFrame.SizeTo(ps->GetVisualViewportSize());
  83. + }
  84. +
  85. + nsIScrollableFrame* scrollableFrame =
  86. + ps->GetRootScrollFrameAsScrollable();
  87. + if (scrollableFrame) {
  88. + nsRect layoutViewport = nsLayoutUtils::CalculateScrollableRectForFrame(
  89. + scrollableFrame, nullptr);
  90. + if (dirtyRectRelativeToDirtyFrame.Size() < layoutViewport.Size()) {
  91. + dirtyRectRelativeToDirtyFrame.SizeTo(layoutViewport.Size());
  92. + }
  93. + }
  94. + }
  95. visible = dirtyRectRelativeToDirtyFrame;
  96. }
  97. #endif
Add Comment
Please, Sign In to add comment