Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef mozilla_layers_APZCCallbackHelper_h |
michael@0 | 7 | #define mozilla_layers_APZCCallbackHelper_h |
michael@0 | 8 | |
michael@0 | 9 | #include "FrameMetrics.h" |
michael@0 | 10 | #include "nsIContent.h" |
michael@0 | 11 | #include "nsIDocument.h" |
michael@0 | 12 | #include "nsIDOMWindowUtils.h" |
michael@0 | 13 | |
michael@0 | 14 | namespace mozilla { |
michael@0 | 15 | namespace layers { |
michael@0 | 16 | |
michael@0 | 17 | /* This class contains some helper methods that facilitate implementing the |
michael@0 | 18 | GeckoContentController callback interface required by the AsyncPanZoomController. |
michael@0 | 19 | Since different platforms need to implement this interface in similar-but- |
michael@0 | 20 | not-quite-the-same ways, this utility class provides some helpful methods |
michael@0 | 21 | to hold code that can be shared across the different platform implementations. |
michael@0 | 22 | */ |
michael@0 | 23 | class APZCCallbackHelper |
michael@0 | 24 | { |
michael@0 | 25 | typedef mozilla::layers::FrameMetrics FrameMetrics; |
michael@0 | 26 | typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid; |
michael@0 | 27 | |
michael@0 | 28 | public: |
michael@0 | 29 | /* Checks to see if the pres shell that the given FrameMetrics object refers |
michael@0 | 30 | to is still the valid pres shell for the DOMWindowUtils. This can help |
michael@0 | 31 | guard against apply stale updates (updates meant for a pres shell that has |
michael@0 | 32 | since been torn down and replaced). */ |
michael@0 | 33 | static bool HasValidPresShellId(nsIDOMWindowUtils* aUtils, |
michael@0 | 34 | const FrameMetrics& aMetrics); |
michael@0 | 35 | |
michael@0 | 36 | /* Applies the scroll and zoom parameters from the given FrameMetrics object to |
michael@0 | 37 | the root frame corresponding to the given DOMWindowUtils. If tiled thebes |
michael@0 | 38 | layers are enabled, this will align the displayport to tile boundaries. |
michael@0 | 39 | Setting the scroll position can cause some small adjustments to be made |
michael@0 | 40 | to the actual scroll position. aMetrics' display port and scroll position |
michael@0 | 41 | will be updated with any modifications made. */ |
michael@0 | 42 | static void UpdateRootFrame(nsIDOMWindowUtils* aUtils, |
michael@0 | 43 | FrameMetrics& aMetrics); |
michael@0 | 44 | |
michael@0 | 45 | /* Applies the scroll parameters from the given FrameMetrics object to the subframe |
michael@0 | 46 | corresponding to the given content object. If tiled thebes |
michael@0 | 47 | layers are enabled, this will align the displayport to tile boundaries. |
michael@0 | 48 | Setting the scroll position can cause some small adjustments to be made |
michael@0 | 49 | to the actual scroll position. aMetrics' display port and scroll position |
michael@0 | 50 | will be updated with any modifications made. */ |
michael@0 | 51 | static void UpdateSubFrame(nsIContent* aContent, |
michael@0 | 52 | FrameMetrics& aMetrics); |
michael@0 | 53 | |
michael@0 | 54 | /* Get the DOMWindowUtils for the window corresponding to the given document. */ |
michael@0 | 55 | static already_AddRefed<nsIDOMWindowUtils> GetDOMWindowUtils(const nsIDocument* aDoc); |
michael@0 | 56 | |
michael@0 | 57 | /* Get the DOMWindowUtils for the window corresponding to the givent content |
michael@0 | 58 | element. This might be an iframe inside the tab, for instance. */ |
michael@0 | 59 | static already_AddRefed<nsIDOMWindowUtils> GetDOMWindowUtils(const nsIContent* aContent); |
michael@0 | 60 | |
michael@0 | 61 | /* Get the presShellId and view ID for the given content element, if they can be |
michael@0 | 62 | found. Returns false if the values could not be found, true if they could. */ |
michael@0 | 63 | static bool GetScrollIdentifiers(const nsIContent* aContent, |
michael@0 | 64 | uint32_t* aPresShellIdOut, |
michael@0 | 65 | FrameMetrics::ViewID* aViewIdOut); |
michael@0 | 66 | |
michael@0 | 67 | /* Tell layout that we received the scroll offset update for the given view ID, so |
michael@0 | 68 | that it accepts future scroll offset updates from APZ. */ |
michael@0 | 69 | static void AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId, |
michael@0 | 70 | const uint32_t& aScrollGeneration); |
michael@0 | 71 | |
michael@0 | 72 | /* Save an "input transform" property on the content element corresponding to |
michael@0 | 73 | the scrollable content. This is needed because in some cases when the APZ code |
michael@0 | 74 | sends a paint request via the GeckoContentController interface, we don't always |
michael@0 | 75 | apply the scroll offset that was requested. Since the APZ code doesn't know |
michael@0 | 76 | that we didn't apply it, it will transform inputs assuming that we had applied |
michael@0 | 77 | it, and so we need to apply a fixup to the input to account for the fact that |
michael@0 | 78 | we didn't. |
michael@0 | 79 | The |aApzcMetrics| argument are the metrics that the APZ sent us, and the |
michael@0 | 80 | |aActualMetrics| argument are the metrics representing the gecko state after we |
michael@0 | 81 | applied some or all of the APZ metrics. */ |
michael@0 | 82 | static void UpdateCallbackTransform(const FrameMetrics& aApzcMetrics, |
michael@0 | 83 | const FrameMetrics& aActualMetrics); |
michael@0 | 84 | |
michael@0 | 85 | /* Apply an "input transform" to the given |aInput| and return the transformed value. |
michael@0 | 86 | The input transform applied is the one for the content element corresponding to |
michael@0 | 87 | |aGuid|; this is populated in a previous call to UpdateCallbackTransform. See that |
michael@0 | 88 | method's documentations for details. */ |
michael@0 | 89 | static CSSPoint ApplyCallbackTransform(const CSSPoint& aInput, |
michael@0 | 90 | const ScrollableLayerGuid& aGuid); |
michael@0 | 91 | |
michael@0 | 92 | /* Same as above, but operates on nsIntPoint that are assumed to be in LayoutDevice |
michael@0 | 93 | pixel space. Requires an additonal |aScale| parameter to convert between CSS and |
michael@0 | 94 | LayoutDevice space. */ |
michael@0 | 95 | static nsIntPoint ApplyCallbackTransform(const nsIntPoint& aPoint, |
michael@0 | 96 | const ScrollableLayerGuid& aGuid, |
michael@0 | 97 | const CSSToLayoutDeviceScale& aScale); |
michael@0 | 98 | }; |
michael@0 | 99 | |
michael@0 | 100 | } |
michael@0 | 101 | } |
michael@0 | 102 | |
michael@0 | 103 | #endif /* mozilla_layers_APZCCallbackHelper_h */ |