зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1556556
- Add ViewportUtils::IsZoomedContentRoot(). r=kats,mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D68727
This commit is contained in:
Родитель
5175a2bf21
Коммит
a08c1b8d22
|
@ -3,12 +3,17 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/PresShell.h"
|
||||
#include "mozilla/ViewportFrame.h"
|
||||
#include "mozilla/ViewportUtils.h"
|
||||
#include "mozilla/layers/APZCCallbackHelper.h"
|
||||
#include "mozilla/layers/InputAPZContext.h"
|
||||
#include "mozilla/layers/ScrollableLayerGuid.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsQueryFrame.h"
|
||||
#include "nsStyleStruct.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -117,4 +122,25 @@ template LayoutDeviceToLayoutDeviceMatrix4x4
|
|||
ViewportUtils::GetVisualToLayoutTransform<LayoutDevicePixel>(
|
||||
ScrollableLayerGuid::ViewID);
|
||||
|
||||
const nsIFrame* ViewportUtils::IsZoomedContentRoot(const nsIFrame* aFrame) {
|
||||
if (!aFrame) {
|
||||
return nullptr;
|
||||
}
|
||||
if (aFrame->Type() == LayoutFrameType::Canvas) {
|
||||
nsIScrollableFrame* sf = do_QueryFrame(aFrame->GetParent());
|
||||
if (sf && sf->IsRootScrollFrameOfDocument() &&
|
||||
aFrame->PresContext()->IsRootContentDocumentCrossProcess()) {
|
||||
return aFrame->GetParent();
|
||||
}
|
||||
} else if (aFrame->StyleDisplay()->mPosition ==
|
||||
StylePositionProperty::Fixed) {
|
||||
if (ViewportFrame* viewportFrame = do_QueryFrame(aFrame->GetParent())) {
|
||||
if (viewportFrame->PresContext()->IsRootContentDocumentCrossProcess()) {
|
||||
return viewportFrame->PresShell()->GetRootScrollFrame();
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
|
@ -50,6 +50,17 @@ class ViewportUtils {
|
|||
static nsPoint VisualToLayout(const nsPoint& aPt, PresShell* aContext);
|
||||
static nsRect VisualToLayout(const nsRect& aRect, PresShell* aContext);
|
||||
static nsPoint LayoutToVisual(const nsPoint& aPt, PresShell* aContext);
|
||||
|
||||
/**
|
||||
* Returns non-null if |aFrame| is inside the async zoom container but its
|
||||
* parent frame is not, thereby making |aFrame| a root of a subtree of
|
||||
* frames representing content that is zoomed in. The value returned in such
|
||||
* cases is the root scroll frame inside the async zoom container.
|
||||
|
||||
* Callers use this to identify points during frame tree traversal where the
|
||||
* visual-to-layout transform needs to be applied.
|
||||
*/
|
||||
static const nsIFrame* IsZoomedContentRoot(const nsIFrame* aFrame);
|
||||
};
|
||||
|
||||
// Forward declare explicit instantiations of GetVisualToLayoutTransform() for
|
||||
|
|
Загрузка…
Ссылка в новой задаче