Changeset 245787 in webkit
- Timestamp:
- May 26, 2019, 6:12:00 PM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 2 added
- 16 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/Headers.cmake (modified) (1 diff)
-
WebCore/Sources.txt (modified) (1 diff)
-
WebCore/WebCore.xcodeproj/project.pbxproj (modified) (5 diffs)
-
WebCore/page/FrameView.cpp (modified) (2 diffs)
-
WebCore/page/FrameView.h (modified) (1 diff)
-
WebCore/platform/graphics/TiledBacking.h (modified) (2 diffs)
-
WebCore/platform/graphics/VelocityData.cpp (added)
-
WebCore/platform/graphics/VelocityData.h (added)
-
WebCore/platform/graphics/ca/TileController.cpp (modified) (3 diffs)
-
WebCore/platform/graphics/ca/TileController.h (modified) (1 diff)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/Shared/VisibleContentRectUpdateInfo.cpp (modified) (3 diffs)
-
WebKit/Shared/VisibleContentRectUpdateInfo.h (modified) (7 diffs)
-
WebKit/Shared/WebCoreArgumentCoders.cpp (modified) (2 diffs)
-
WebKit/Shared/WebCoreArgumentCoders.h (modified) (2 diffs)
-
WebKit/UIProcess/ios/WKContentView.mm (modified) (4 diffs)
-
WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r245786 r245787 1 2019-05-26 Simon Fraser <simon.fraser@apple.com> 2 3 Move VelocityData to WebCore 4 https://bugs.webkit.org/show_bug.cgi?id=198261 5 6 Reviewed by Antti Koivisto. 7 8 Move VelocityData and HistoricalVelocityData to WebCore for future use in overflow scroll. 9 10 VisibleContentRectUpdateInfo can now store a VelocityData (its timestamp is used as 11 the timetamp for the entire update). 12 13 No behavior change. 14 15 * Headers.cmake: 16 * Sources.txt: 17 * WebCore.xcodeproj/project.pbxproj: 18 * page/FrameView.cpp: 19 (WebCore::FrameView::setScrollVelocity): 20 * page/FrameView.h: 21 * platform/graphics/TiledBacking.h: 22 (WebCore::VelocityData::VelocityData): Deleted. 23 (WebCore::VelocityData::velocityOrScaleIsChanging const): Deleted. 24 * platform/graphics/ca/TileController.cpp: 25 (WebCore::TileController::adjustTileCoverageRect const): 26 * platform/graphics/ca/TileController.h: 27 1 28 2019-05-26 Simon Fraser <simon.fraser@apple.com> 2 29 -
trunk/Source/WebCore/Headers.cmake
r245784 r245787 1091 1091 platform/graphics/TiledBacking.h 1092 1092 platform/graphics/TrackPrivateBase.h 1093 platform/graphics/VelocityData.h 1093 1094 platform/graphics/VideoTrackPrivate.h 1094 1095 platform/graphics/WidthCache.h -
trunk/Source/WebCore/Sources.txt
r245776 r245787 1780 1780 platform/graphics/SurrogatePairAwareTextIterator.cpp 1781 1781 platform/graphics/TextRun.cpp 1782 platform/graphics/VelocityData.cpp 1782 1783 platform/graphics/WOFFFileFormat.cpp 1783 1784 platform/graphics/WidthIterator.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r245784 r245787 293 293 0F15ED5C1B7EC7C500EDDFEB /* WillChangeData.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F15ED5A1B7EC7C500EDDFEB /* WillChangeData.h */; settings = {ATTRIBUTES = (Private, ); }; }; 294 294 0F1774801378B772009DA76A /* ScrollAnimatorIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F17747E1378B771009DA76A /* ScrollAnimatorIOS.h */; }; 295 0F1A0C38229A481800D37ADB /* VelocityData.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F1A0C36229A481800D37ADB /* VelocityData.h */; settings = {ATTRIBUTES = (Private, ); }; }; 295 296 0F37F0852202BF9800A89C0B /* ScrollingTreeScrollingNodeDelegateMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F37F0842202ACB700A89C0B /* ScrollingTreeScrollingNodeDelegateMac.h */; settings = {ATTRIBUTES = (Private, ); }; }; 296 297 0F3DD45012F5EA1B000D9190 /* ShadowBlur.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F3DD44E12F5EA1B000D9190 /* ShadowBlur.h */; }; … … 5630 5631 0F17747E1378B771009DA76A /* ScrollAnimatorIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollAnimatorIOS.h; sourceTree = "<group>"; }; 5631 5632 0F17747F1378B772009DA76A /* ScrollAnimatorIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollAnimatorIOS.mm; sourceTree = "<group>"; }; 5633 0F1A0C36229A481800D37ADB /* VelocityData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VelocityData.h; sourceTree = "<group>"; }; 5632 5634 0F26A7A72054C2270090A141 /* TemplateContentDocumentFragment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TemplateContentDocumentFragment.cpp; sourceTree = "<group>"; }; 5633 5635 0F26A7A92054C3CF0090A141 /* HTMLBDIElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLBDIElement.cpp; sourceTree = "<group>"; }; … … 5701 5703 0F580FA21496939100FB5BD8 /* WebTiledBackingLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebTiledBackingLayer.mm; sourceTree = "<group>"; }; 5702 5704 0F580FAE149800D400FB5BD8 /* AnimationUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnimationUtilities.h; sourceTree = "<group>"; }; 5705 0F5A57CA229B18AE0025EDA9 /* VelocityData.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = VelocityData.cpp; sourceTree = "<group>"; }; 5703 5706 0F5B7A5210F65D7A00376302 /* RenderEmbeddedObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderEmbeddedObject.cpp; sourceTree = "<group>"; }; 5704 5707 0F5B7A5310F65D7A00376302 /* RenderEmbeddedObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderEmbeddedObject.h; sourceTree = "<group>"; }; … … 24534 24537 BE913D7F181EF8E500DCB09E /* TrackPrivateBase.h */, 24535 24538 E4AFCFA40DAF29A300F5F55C /* UnitBezier.h */, 24539 0F5A57CA229B18AE0025EDA9 /* VelocityData.cpp */, 24540 0F1A0C36229A481800D37ADB /* VelocityData.h */, 24536 24541 075BA84720618AA500FCB4AD /* VideoFullscreenLayerManager.h */, 24537 24542 BEF29EEA1715DD0900C4B4C9 /* VideoTrackPrivate.h */, … … 31933 31938 15C7708D100D3C6B005BA267 /* ValidityState.h in Headers */, 31934 31939 FD3160AF12B026F700C1A359 /* VectorMath.h in Headers */, 31940 0F1A0C38229A481800D37ADB /* VelocityData.h in Headers */, 31935 31941 BCA257151293C010007A263D /* VerticalPositionCache.h in Headers */, 31936 31942 52B0D4C01C57FD660077CE53 /* VideoFullscreenChangeObserver.h in Headers */, -
trunk/Source/WebCore/page/FrameView.cpp
r245543 r245787 100 100 #include "TextResourceDecoder.h" 101 101 #include "TiledBacking.h" 102 #include "VelocityData.h" 102 103 #include "VisualViewport.h" 103 104 #include "WheelEventTestTrigger.h" … … 5052 5053 } 5053 5054 5054 void FrameView::setScrollVelocity( double horizontalVelocity, double verticalVelocity, double scaleChangeRate, MonotonicTime timestamp)5055 void FrameView::setScrollVelocity(const VelocityData& velocityData) 5055 5056 { 5056 5057 if (TiledBacking* tiledBacking = this->tiledBacking()) 5057 tiledBacking->setVelocity( VelocityData(horizontalVelocity, verticalVelocity, scaleChangeRate, timestamp));5058 tiledBacking->setVelocity(velocityData); 5058 5059 } 5059 5060 #endif // PLATFORM(IOS_FAMILY) -
trunk/Source/WebCore/page/FrameView.h
r245320 r245787 138 138 WEBCORE_EXPORT void setCustomSizeForResizeEvent(IntSize); 139 139 140 WEBCORE_EXPORT void setScrollVelocity( double horizontalVelocity, double verticalVelocity, double scaleChangeRate, MonotonicTime timestamp);140 WEBCORE_EXPORT void setScrollVelocity(const VelocityData&); 141 141 #else 142 142 bool useCustomFixedPositionLayoutRect() const { return false; } -
trunk/Source/WebCore/platform/graphics/TiledBacking.h
r239427 r245787 42 42 class IntSize; 43 43 class PlatformCALayer; 44 struct VelocityData; 44 45 45 46 enum ScrollingModeIndication { … … 48 49 SynchronousScrollingBecauseOfEventHandlersIndication, 49 50 AsyncScrollingIndication 50 };51 52 struct VelocityData {53 double horizontalVelocity;54 double verticalVelocity;55 double scaleChangeRate;56 MonotonicTime lastUpdateTime;57 58 VelocityData(double horizontal = 0, double vertical = 0, double scaleChange = 0, MonotonicTime updateTime = MonotonicTime())59 : horizontalVelocity(horizontal)60 , verticalVelocity(vertical)61 , scaleChangeRate(scaleChange)62 , lastUpdateTime(updateTime)63 {64 }65 66 bool velocityOrScaleIsChanging() const67 {68 return horizontalVelocity || verticalVelocity || scaleChangeRate;69 }70 51 }; 71 52 -
trunk/Source/WebCore/platform/graphics/ca/TileController.cpp
r239535 r245787 35 35 #include "TileCoverageMap.h" 36 36 #include "TileGrid.h" 37 #include "VelocityData.h" 37 38 #include <utility> 38 39 #include <wtf/MainThread.h> … … 429 430 if (m_velocity.scaleChangeRate > 0) { 430 431 coverageRect = visibleRect; 432 LOG_WITH_STREAM(Tiling, stream << "TileController " << this << " computeTileCoverageRect - zooming, coverage is visible rect " << coverageRect); 431 433 return; 432 434 } … … 449 451 futureRect.setY(0); 450 452 453 LOG_WITH_STREAM(Tiling, stream << "TileController " << this << " computeTileCoverageRect - coverage " << coverageRect << " expanded to " << unionRect(coverageRect, futureRect) << " velocity " << m_velocity); 454 451 455 coverageRect.unite(futureRect); 452 return;453 456 #else 454 457 UNUSED_PARAM(contentsScale); -
trunk/Source/WebCore/platform/graphics/ca/TileController.h
r241113 r245787 33 33 #include "TiledBacking.h" 34 34 #include "Timer.h" 35 #include "VelocityData.h" 35 36 #include <wtf/Deque.h> 36 37 #include <wtf/Noncopyable.h> -
trunk/Source/WebKit/ChangeLog
r245784 r245787 1 2019-05-26 Simon Fraser <simon.fraser@apple.com> 2 3 Move VelocityData to WebCore 4 https://bugs.webkit.org/show_bug.cgi?id=198261 5 6 Reviewed by Antti Koivisto. 7 8 Move VelocityData and HistoricalVelocityData to WebCore for future use in overflow scroll. 9 10 VisibleContentRectUpdateInfo can now store a VelocityData (its timestamp is used as 11 the timetamp for the entire update). 12 13 * Shared/VisibleContentRectUpdateInfo.cpp: 14 (WebKit::VisibleContentRectUpdateInfo::encode const): 15 (WebKit::VisibleContentRectUpdateInfo::decode): 16 (WebKit::operator<<): 17 * Shared/VisibleContentRectUpdateInfo.h: 18 (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo): 19 (WebKit::VisibleContentRectUpdateInfo::scrollVelocity const): 20 (WebKit::VisibleContentRectUpdateInfo::enclosedInScrollableAncestorView const): 21 (WebKit::VisibleContentRectUpdateInfo::timestamp const): 22 (WebKit::operator==): 23 (WebKit::VisibleContentRectUpdateInfo::horizontalVelocity const): Deleted. 24 (WebKit::VisibleContentRectUpdateInfo::verticalVelocity const): Deleted. 25 (WebKit::VisibleContentRectUpdateInfo::scaleChangeRate const): Deleted. 26 * Shared/WebCoreArgumentCoders.cpp: 27 (IPC::ArgumentCoder<VelocityData>::encode): 28 (IPC::ArgumentCoder<VelocityData>::decode): 29 * Shared/WebCoreArgumentCoders.h: 30 * UIProcess/ios/WKContentView.mm: 31 (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]): 32 (WebKit::HistoricalVelocityData::VelocityData::VelocityData): Deleted. 33 (WebKit::HistoricalVelocityData::HistoricalVelocityData): Deleted. 34 (WebKit::HistoricalVelocityData::velocityForNewData): Deleted. 35 (WebKit::HistoricalVelocityData::clear): Deleted. 36 (WebKit::HistoricalVelocityData::append): Deleted. 37 * WebProcess/WebPage/ios/WebPageIOS.mm: 38 (WebKit::WebPage::dynamicViewportSizeUpdate): 39 (WebKit::WebPage::viewportConfigurationChanged): 40 (WebKit::adjustVelocityDataForBoundedScale): 41 (WebKit::WebPage::updateVisibleContentRects): 42 1 43 2019-05-26 John Wilander <wilander@apple.com> 2 44 -
trunk/Source/WebKit/Shared/VisibleContentRectUpdateInfo.cpp
r240139 r245787 44 44 encoder << m_obscuredInsets; 45 45 encoder << m_unobscuredSafeAreaInsets; 46 encoder << m_scrollVelocity; 46 47 encoder << m_lastLayerTreeTransactionID; 47 48 encoder << m_scale; 48 encoder << m_timestamp;49 encoder << m_horizontalVelocity;50 encoder << m_verticalVelocity;51 encoder << m_scaleChangeRate;52 49 encoder << m_inStableState; 53 50 encoder << m_isFirstUpdateForNewViewSize; … … 75 72 if (!decoder.decode(result.m_unobscuredSafeAreaInsets)) 76 73 return false; 74 if (!decoder.decode(result.m_scrollVelocity)) 75 return false; 77 76 if (!decoder.decode(result.m_lastLayerTreeTransactionID)) 78 77 return false; 79 78 if (!decoder.decode(result.m_scale)) 80 return false;81 if (!decoder.decode(result.m_timestamp))82 return false;83 if (!decoder.decode(result.m_horizontalVelocity))84 return false;85 if (!decoder.decode(result.m_verticalVelocity))86 return false;87 if (!decoder.decode(result.m_scaleChangeRate))88 79 return false; 89 80 if (!decoder.decode(result.m_inStableState)) … … 133 124 ts.dumpProperty("enclosedInScrollableAncestorView", info.enclosedInScrollableAncestorView()); 134 125 135 ts.dumpProperty("timestamp", info.timestamp().secondsSinceEpoch().value());136 126 ts.dumpProperty("allowShrinkToFit", info.allowShrinkToFit()); 137 if (info.horizontalVelocity()) 138 ts.dumpProperty("horizontalVelocity", info.horizontalVelocity()); 139 if (info.verticalVelocity()) 140 ts.dumpProperty("verticalVelocity", info.verticalVelocity()); 141 if (info.scaleChangeRate()) 142 ts.dumpProperty("scaleChangeRate", info.scaleChangeRate()); 127 ts.dumpProperty("scrollVelocity", info.scrollVelocity()); 143 128 144 129 return ts; -
trunk/Source/WebKit/Shared/VisibleContentRectUpdateInfo.h
r240139 r245787 28 28 #include <WebCore/FloatRect.h> 29 29 #include <WebCore/LengthBox.h> 30 #include <WebCore/VelocityData.h> 30 31 #include <wtf/MonotonicTime.h> 31 32 #include <wtf/text/WTFString.h> … … 46 47 VisibleContentRectUpdateInfo() = default; 47 48 48 VisibleContentRectUpdateInfo(const WebCore::FloatRect& exposedContentRect, const WebCore::FloatRect& unobscuredContentRect, const WebCore::FloatBoxExtent& contentInsets, const WebCore::FloatRect& unobscuredRectInScrollViewCoordinates, const WebCore::FloatRect& unobscuredContentRectRespectingInputViewBounds, const WebCore::FloatRect& customFixedPositionRect, const WebCore::FloatBoxExtent& obscuredInsets, const WebCore::FloatBoxExtent& unobscuredSafeAreaInsets, double scale, bool inStableState, bool isFirstUpdateForNewViewSize, bool isChangingObscuredInsetsInteractively, bool allowShrinkToFit, bool enclosedInScrollableAncestorView, MonotonicTime timestamp, double horizontalVelocity, double verticalVelocity, double scaleChangeRate, uint64_t lastLayerTreeTransactionId)49 VisibleContentRectUpdateInfo(const WebCore::FloatRect& exposedContentRect, const WebCore::FloatRect& unobscuredContentRect, const WebCore::FloatBoxExtent& contentInsets, const WebCore::FloatRect& unobscuredRectInScrollViewCoordinates, const WebCore::FloatRect& unobscuredContentRectRespectingInputViewBounds, const WebCore::FloatRect& customFixedPositionRect, const WebCore::FloatBoxExtent& obscuredInsets, const WebCore::FloatBoxExtent& unobscuredSafeAreaInsets, double scale, bool inStableState, bool isFirstUpdateForNewViewSize, bool isChangingObscuredInsetsInteractively, bool allowShrinkToFit, bool enclosedInScrollableAncestorView, const WebCore::VelocityData& scrollVelocity, uint64_t lastLayerTreeTransactionId) 49 50 : m_exposedContentRect(exposedContentRect) 50 51 , m_unobscuredContentRect(unobscuredContentRect) … … 55 56 , m_obscuredInsets(obscuredInsets) 56 57 , m_unobscuredSafeAreaInsets(unobscuredSafeAreaInsets) 58 , m_scrollVelocity(scrollVelocity) 57 59 , m_lastLayerTreeTransactionID(lastLayerTreeTransactionId) 58 60 , m_scale(scale) 59 , m_timestamp(timestamp)60 , m_horizontalVelocity(horizontalVelocity)61 , m_verticalVelocity(verticalVelocity)62 , m_scaleChangeRate(scaleChangeRate)63 61 , m_inStableState(inStableState) 64 62 , m_isFirstUpdateForNewViewSize(isFirstUpdateForNewViewSize) … … 75 73 const WebCore::FloatRect& unobscuredContentRectRespectingInputViewBounds() const { return m_unobscuredContentRectRespectingInputViewBounds; } 76 74 const WebCore::FloatRect& customFixedPositionRect() const { return m_customFixedPositionRect; } 75 const WebCore::VelocityData& scrollVelocity() const { return m_scrollVelocity; } 77 76 const WebCore::FloatBoxExtent& obscuredInsets() const { return m_obscuredInsets; } 78 77 const WebCore::FloatBoxExtent& unobscuredSafeAreaInsets() const { return m_unobscuredSafeAreaInsets; } … … 84 83 bool allowShrinkToFit() const { return m_allowShrinkToFit; } 85 84 bool enclosedInScrollableAncestorView() const { return m_enclosedInScrollableAncestorView; } 85 uint64_t lastLayerTreeTransactionID() const { return m_lastLayerTreeTransactionID; } 86 86 87 MonotonicTime timestamp() const { return m_timestamp; } 88 double horizontalVelocity() const { return m_horizontalVelocity; } 89 double verticalVelocity() const { return m_verticalVelocity; } 90 double scaleChangeRate() const { return m_scaleChangeRate; } 91 92 uint64_t lastLayerTreeTransactionID() const { return m_lastLayerTreeTransactionID; } 87 MonotonicTime timestamp() const { return m_scrollVelocity.lastUpdateTime; } 93 88 94 89 void encode(IPC::Encoder&) const; … … 106 101 WebCore::FloatBoxExtent m_obscuredInsets; 107 102 WebCore::FloatBoxExtent m_unobscuredSafeAreaInsets; 103 WebCore::VelocityData m_scrollVelocity; 108 104 uint64_t m_lastLayerTreeTransactionID { 0 }; 109 105 double m_scale { -1 }; 110 MonotonicTime m_timestamp;111 double m_horizontalVelocity { 0 };112 double m_verticalVelocity { 0 };113 double m_scaleChangeRate { 0 };114 106 bool m_inStableState { false }; 115 107 bool m_isFirstUpdateForNewViewSize { false }; … … 130 122 && a.obscuredInsets() == b.obscuredInsets() 131 123 && a.unobscuredSafeAreaInsets() == b.unobscuredSafeAreaInsets() 132 && a.horizontalVelocity() == b.horizontalVelocity() 133 && a.verticalVelocity() == b.verticalVelocity() 134 && a.scaleChangeRate() == b.scaleChangeRate() 124 && a.scrollVelocity().equalIgnoringTimestamp(b.scrollVelocity()) 135 125 && a.inStableState() == b.inStableState() 136 126 && a.isFirstUpdateForNewViewSize() == b.isFirstUpdateForNewViewSize() -
trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp
r243416 r245787 82 82 #include <WebCore/TransformationMatrix.h> 83 83 #include <WebCore/UserStyleSheet.h> 84 #include <WebCore/VelocityData.h> 84 85 #include <WebCore/ViewportArguments.h> 85 86 #include <WebCore/WindowFeatures.h> … … 924 925 } 925 926 927 void ArgumentCoder<VelocityData>::encode(Encoder& encoder, const VelocityData& velocityData) 928 { 929 encoder << velocityData.horizontalVelocity << velocityData.verticalVelocity << velocityData.scaleChangeRate << velocityData.lastUpdateTime; 930 } 931 932 bool ArgumentCoder<VelocityData>::decode(Decoder& decoder, VelocityData& velocityData) 933 { 934 float horizontalVelocity; 935 if (!decoder.decode(horizontalVelocity)) 936 return false; 937 938 float verticalVelocity; 939 if (!decoder.decode(verticalVelocity)) 940 return false; 941 942 float scaleChangeRate; 943 if (!decoder.decode(scaleChangeRate)) 944 return false; 945 946 MonotonicTime lastUpdateTime; 947 if (!decoder.decode(lastUpdateTime)) 948 return false; 949 950 velocityData.horizontalVelocity = horizontalVelocity; 951 velocityData.verticalVelocity = verticalVelocity; 952 velocityData.scaleChangeRate = scaleChangeRate; 953 velocityData.lastUpdateTime = lastUpdateTime; 954 955 return true; 956 } 926 957 927 958 void ArgumentCoder<MimeClassInfo>::encode(Encoder& encoder, const MimeClassInfo& mimeClassInfo) -
trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h
r244475 r245787 126 126 struct TouchActionData; 127 127 #endif 128 struct VelocityData; 128 129 struct ViewportAttributes; 129 130 struct WindowFeatures; … … 333 334 static void encode(Encoder&, const WebCore::ViewportAttributes&); 334 335 static bool decode(Decoder&, WebCore::ViewportAttributes&); 336 }; 337 338 template<> struct ArgumentCoder<WebCore::VelocityData> { 339 static void encode(Encoder&, const WebCore::VelocityData&); 340 static bool decode(Decoder&, WebCore::VelocityData&); 335 341 }; 336 342 -
trunk/Source/WebKit/UIProcess/ios/WKContentView.mm
r245272 r245787 61 61 #import <WebCore/PlatformScreen.h> 62 62 #import <WebCore/Quirks.h> 63 #import <WebCore/VelocityData.h> 63 64 #import <pal/spi/cocoa/QuartzCoreSPI.h> 64 65 #import <wtf/RetainPtr.h> 65 66 #import <wtf/text/TextStream.h> 66 67 67 68 namespace WebKit {69 using namespace WebCore;70 using namespace WebKit;71 72 class HistoricalVelocityData {73 public:74 struct VelocityData {75 VelocityData()76 : horizontalVelocity(0)77 , verticalVelocity(0)78 , scaleChangeRate(0)79 {80 }81 82 VelocityData(double horizontalVelocity, double verticalVelocity, double scaleChangeRate)83 : horizontalVelocity(horizontalVelocity)84 , verticalVelocity(verticalVelocity)85 , scaleChangeRate(scaleChangeRate)86 {87 }88 89 double horizontalVelocity;90 double verticalVelocity;91 double scaleChangeRate;92 };93 94 HistoricalVelocityData()95 : m_historySize(0)96 , m_latestDataIndex(0)97 {98 }99 100 VelocityData velocityForNewData(CGPoint newPosition, double scale, MonotonicTime timestamp)101 {102 // Due to all the source of rect update, the input is very noisy. To smooth the output, we accumulate all changes103 // within 1 frame as a single update. No speed computation is ever done on data within the same frame.104 const Seconds filteringThreshold(1.0 / 60);105 106 VelocityData velocityData;107 if (m_historySize > 0) {108 unsigned oldestDataIndex;109 unsigned distanceToLastHistoricalData = m_historySize - 1;110 if (distanceToLastHistoricalData <= m_latestDataIndex)111 oldestDataIndex = m_latestDataIndex - distanceToLastHistoricalData;112 else113 oldestDataIndex = m_historySize - (distanceToLastHistoricalData - m_latestDataIndex);114 115 Seconds timeDelta = timestamp - m_history[oldestDataIndex].timestamp;116 if (timeDelta > filteringThreshold) {117 Data& oldestData = m_history[oldestDataIndex];118 velocityData = VelocityData((newPosition.x - oldestData.position.x) / timeDelta.seconds(), (newPosition.y - oldestData.position.y) / timeDelta.seconds(), (scale - oldestData.scale) / timeDelta.seconds());119 }120 }121 122 Seconds timeSinceLastAppend = timestamp - m_lastAppendTimestamp;123 if (timeSinceLastAppend > filteringThreshold)124 append(newPosition, scale, timestamp);125 else126 m_history[m_latestDataIndex] = { timestamp, newPosition, scale };127 return velocityData;128 }129 130 void clear() { m_historySize = 0; }131 132 private:133 void append(CGPoint newPosition, double scale, MonotonicTime timestamp)134 {135 m_latestDataIndex = (m_latestDataIndex + 1) % maxHistoryDepth;136 m_history[m_latestDataIndex] = { timestamp, newPosition, scale };137 138 unsigned size = m_historySize + 1;139 if (size <= maxHistoryDepth)140 m_historySize = size;141 142 m_lastAppendTimestamp = timestamp;143 }144 145 146 static const unsigned maxHistoryDepth = 3;147 148 unsigned m_historySize;149 unsigned m_latestDataIndex;150 MonotonicTime m_lastAppendTimestamp;151 152 struct Data {153 MonotonicTime timestamp;154 CGPoint position;155 double scale;156 } m_history[maxHistoryDepth];157 };158 } // namespace WebKit159 68 160 69 @interface WKInspectorIndicationView : UIView … … 224 133 #endif 225 134 226 Web Kit::HistoricalVelocityData _historicalKinematicData;135 WebCore::HistoricalVelocityData _historicalKinematicData; 227 136 228 137 RetainPtr<NSUndoManager> _undoManager; … … 464 373 465 374 MonotonicTime timestamp = MonotonicTime::now(); 466 Web Kit::HistoricalVelocityData::VelocityData velocityData;375 WebCore::VelocityData velocityData; 467 376 if (!isStableState) 468 377 velocityData = _historicalKinematicData.velocityForNewData(visibleContentRect.origin, zoomScale, timestamp); 469 else 378 else { 470 379 _historicalKinematicData.clear(); 380 velocityData = { 0, 0, 0, timestamp }; 381 } 471 382 472 383 WebKit::RemoteScrollingCoordinatorProxy* scrollingCoordinator = _page->scrollingCoordinatorProxy(); … … 490 401 _webView._allowsViewportShrinkToFit, 491 402 enclosedInScrollableAncestorView, 492 timestamp, 493 velocityData.horizontalVelocity, 494 velocityData.verticalVelocity, 495 velocityData.scaleChangeRate, 403 velocityData, 496 404 downcast<WebKit::RemoteLayerTreeDrawingAreaProxy>(*drawingArea).lastCommittedLayerTreeTransactionID()); 497 405 -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r245778 r245787 3161 3161 } 3162 3162 3163 frameView.setScrollVelocity( 0, 0, 0, MonotonicTime::now());3163 frameView.setScrollVelocity({ 0, 0, 0, MonotonicTime::now() }); 3164 3164 3165 3165 IntPoint roundedUnobscuredContentRectPosition = roundedIntPoint(newUnobscuredContentRect.location()); … … 3334 3334 IntSize minimumLayoutSizeInDocumentCoordinates = roundedIntSize(minimumLayoutSizeInScrollViewCoordinates); 3335 3335 frameView.setUnobscuredContentSize(minimumLayoutSizeInDocumentCoordinates); 3336 frameView.setScrollVelocity( 0, 0, 0, MonotonicTime::now());3336 frameView.setScrollVelocity({ 0, 0, 0, MonotonicTime::now() }); 3337 3337 3338 3338 // FIXME: We could send down the obscured margins to find a better exposed rect and unobscured rect. … … 3405 3405 } 3406 3406 3407 static inline void adjustVelocityDataForBoundedScale( double& horizontalVelocity, double& verticalVelocity, double& scaleChangeRate, double exposedRectScale, double minimumScale, double maximumScale)3408 { 3409 if ( scaleChangeRate) {3410 horizontalVelocity = 0;3411 ve rticalVelocity = 0;3407 static inline void adjustVelocityDataForBoundedScale(VelocityData& velocityData, double exposedRectScale, double minimumScale, double maximumScale) 3408 { 3409 if (velocityData.scaleChangeRate) { 3410 velocityData.horizontalVelocity = 0; 3411 velocityData.verticalVelocity = 0; 3412 3412 } 3413 3413 3414 3414 if (exposedRectScale >= maximumScale || exposedRectScale <= minimumScale) 3415 scaleChangeRate = 0;3415 velocityData.scaleChangeRate = 0; 3416 3416 } 3417 3417 … … 3521 3521 m_page->setEnclosedInScrollableAncestorView(visibleContentRectUpdateInfo.enclosedInScrollableAncestorView()); 3522 3522 3523 double horizontalVelocity = visibleContentRectUpdateInfo.horizontalVelocity(); 3524 double verticalVelocity = visibleContentRectUpdateInfo.verticalVelocity(); 3525 double scaleChangeRate = visibleContentRectUpdateInfo.scaleChangeRate(); 3526 adjustVelocityDataForBoundedScale(horizontalVelocity, verticalVelocity, scaleChangeRate, visibleContentRectUpdateInfo.scale(), m_viewportConfiguration.minimumScale(), m_viewportConfiguration.maximumScale()); 3527 3528 frameView.setScrollVelocity(horizontalVelocity, verticalVelocity, scaleChangeRate, visibleContentRectUpdateInfo.timestamp()); 3523 VelocityData scrollVelocity = visibleContentRectUpdateInfo.scrollVelocity(); 3524 adjustVelocityDataForBoundedScale(scrollVelocity, visibleContentRectUpdateInfo.scale(), m_viewportConfiguration.minimumScale(), m_viewportConfiguration.maximumScale()); 3525 frameView.setScrollVelocity(scrollVelocity); 3529 3526 3530 3527 if (m_isInStableState) {
Note:
See TracChangeset
for help on using the changeset viewer.