Changeset 242032 in webkit
- Timestamp:
- Feb 24, 2019 10:04:20 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 2 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r242031 r242032 1 2019-02-24 Zalan Bujtas <zalan@apple.com> 2 3 Introduce ContentChangeObserver class 4 https://bugs.webkit.org/show_bug.cgi?id=194977 5 <rdar://problem/48338115> 6 7 Reviewed by Simon Fraser. 8 9 This patch is about piping through all the related WK* calls. 10 11 * SourcesCocoa.txt: 12 * WebCore.xcodeproj/project.pbxproj: 13 * dom/Document.cpp: 14 (WebCore::Document::scheduleStyleRecalc): 15 (WebCore::Document::updateStyleIfNeeded): 16 (WebCore::Document::platformSuspendOrStopActiveDOMObjects): 17 * loader/FrameLoader.cpp: 18 * page/DOMTimer.cpp: 19 (WebCore::DOMTimer::install): 20 (WebCore::DOMTimer::fired): 21 * page/DOMWindow.cpp: 22 (WebCore::DOMWindow::clearTimeout): 23 * page/Frame.cpp: 24 (WebCore::Frame::willDetachPage): 25 * page/Page.h: 26 (WebCore::Page::contentChangeObserver): 27 * page/ios/EventHandlerIOS.mm: 28 (WebCore::EventHandler::mouseMoved): 29 * rendering/updating/RenderTreeUpdater.cpp: 30 (WebCore::RenderTreeUpdater::updateElementRenderer): 31 (WebCore::CheckForVisibilityChange::CheckForVisibilityChange): 32 (WebCore::CheckForVisibilityChange::~CheckForVisibilityChange): 33 1 34 2019-02-24 Simon Fraser <simon.fraser@apple.com> 2 35 -
trunk/Source/WebCore/SourcesCocoa.txt
r241997 r242032 132 132 page/cocoa/SettingsBaseCocoa.mm 133 133 134 page/ios/ContentChangeObserver.mm 134 135 page/ios/EventHandlerIOS.mm 135 136 page/ios/FrameIOS.mm -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r242019 r242032 2066 2066 6FA4454E898F2FC168BC38C1 /* JSBeforeUnloadEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 29E04A27BED2F81F98E9022B /* JSBeforeUnloadEvent.h */; }; 2067 2067 6FB11B5C21783FD000E2A574 /* TextUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FB11B5921783FCF00E2A574 /* TextUtil.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2068 6FB5E214221F2453003989CF /* ContentChangeObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FB5E212221F2447003989CF /* ContentChangeObserver.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2068 2069 6FE198172178397C00446F08 /* InlineLineBreaker.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FE198152178397C00446F08 /* InlineLineBreaker.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2069 2070 6FE7CFA22177EEF2005B1573 /* InlineItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FE7CFA02177EEF1005B1573 /* InlineItem.h */; }; … … 9235 9236 6FB11B5921783FCF00E2A574 /* TextUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextUtil.h; sourceTree = "<group>"; }; 9236 9237 6FB11B5B21783FCF00E2A574 /* TextUtil.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextUtil.cpp; sourceTree = "<group>"; }; 9238 6FB5E212221F2447003989CF /* ContentChangeObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ContentChangeObserver.h; sourceTree = "<group>"; }; 9237 9239 6FBB860520B464B600DAD938 /* FormattingContextGeometry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FormattingContextGeometry.cpp; sourceTree = "<group>"; }; 9238 9240 6FE198132178397B00446F08 /* InlineLineBreaker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InlineLineBreaker.cpp; sourceTree = "<group>"; }; … … 9242 9244 6FE7CFA32177EF10005B1573 /* LayoutLineBreakBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutLineBreakBox.h; sourceTree = "<group>"; }; 9243 9245 6FE7CFA52177F069005B1573 /* LayoutLineBreakBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutLineBreakBox.cpp; sourceTree = "<group>"; }; 9246 6FE9F09222211035004C5082 /* ContentChangeObserver.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ContentChangeObserver.mm; sourceTree = "<group>"; }; 9244 9247 6FFDC43E212EFF1600A9CA91 /* FloatAvoider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FloatAvoider.cpp; sourceTree = "<group>"; }; 9245 9248 6FFDC440212EFF1600A9CA91 /* FloatAvoider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FloatAvoider.h; sourceTree = "<group>"; }; … … 16586 16589 isa = PBXGroup; 16587 16590 children = ( 16591 6FB5E212221F2447003989CF /* ContentChangeObserver.h */, 16592 6FE9F09222211035004C5082 /* ContentChangeObserver.mm */, 16588 16593 FE6938B51045D67E008EABB6 /* EventHandlerIOS.mm */, 16589 16594 FED13D3B0CEA936A00D89466 /* FrameIOS.mm */, … … 28688 28693 A818721C0977D3C0005826D9 /* ContainerNode.h in Headers */, 28689 28694 E1A1470811102B1500EEC0F3 /* ContainerNodeAlgorithms.h in Headers */, 28695 6FB5E214221F2453003989CF /* ContentChangeObserver.h in Headers */, 28690 28696 BC5EB9810E82072500B25965 /* ContentData.h in Headers */, 28691 28697 51B45D211AB8D1E200117CD2 /* ContentExtension.h in Headers */, -
trunk/Source/WebCore/dom/Document.cpp
r242014 r242032 259 259 260 260 #if PLATFORM(IOS_FAMILY) 261 #include "ContentChangeObserver.h" 261 262 #include "CSSFontSelector.h" 262 263 #include "DeviceMotionClientIOS.h" … … 267 268 #include "Navigator.h" 268 269 #include "NavigatorGeolocation.h" 269 #include "WKContentObservation.h"270 #include "WKContentObservationInternal.h"271 270 #endif 272 271 … … 1813 1812 1814 1813 #if PLATFORM(IOS_FAMILY) 1815 if (WKIsObservingStyleRecalcScheduling()) { 1816 LOG_WITH_STREAM(ContentObservation, stream << "Document(" << this << ")::scheduleStyleRecalc: register this style recalc schedule and observe when it fires."); 1817 WKSetObservedContentChange(WKContentIndeterminateChange); 1814 if (auto* page = this->page()) { 1815 auto& contentChangeObserver = page->contentChangeObserver(); 1816 if (contentChangeObserver.isObservingStyleRecalcScheduling()) { 1817 LOG_WITH_STREAM(ContentObservation, stream << "Document(" << this << ")::scheduleStyleRecalc: register this style recalc schedule and observe when it fires."); 1818 contentChangeObserver.setObservedContentChange(WKContentIndeterminateChange); 1819 } 1818 1820 } 1819 1821 #endif … … 2049 2051 2050 2052 #if PLATFORM(IOS_FAMILY) 2051 auto observingContentChange = WKShouldObserveNextStyleRecalc(); 2052 if (observingContentChange) { 2053 LOG_WITH_STREAM(ContentObservation, stream << "Document(" << this << ")::scheduleStyleRecalc: start observing content change."); 2054 WKSetShouldObserveNextStyleRecalc(false); 2055 WKStartObservingContentChanges(); 2053 auto observingContentChange = false; 2054 if (auto* page = this->page()) { 2055 auto& contentChangeObserver = page->contentChangeObserver(); 2056 observingContentChange = contentChangeObserver.shouldObserveNextStyleRecalc(); 2057 if (observingContentChange) { 2058 LOG_WITH_STREAM(ContentObservation, stream << "Document(" << this << ")::scheduleStyleRecalc: start observing content change."); 2059 contentChangeObserver.setShouldObserveNextStyleRecalc(false); 2060 contentChangeObserver.startObservingContentChanges(); 2061 } 2056 2062 } 2057 2063 #endif … … 2062 2068 2063 2069 #if PLATFORM(IOS_FAMILY) 2064 if (observingContentChange ) {2070 if (observingContentChange && page()) { 2065 2071 LOG_WITH_STREAM(ContentObservation, stream << "Document(" << this << ")::scheduleStyleRecalc: stop observing content change."); 2066 WKStopObservingContentChanges(); 2067 2068 auto inDeterminedState = WKObservedContentChange() == WKContentVisibilityChange || !WebThreadCountOfObservedDOMTimers(); 2072 auto& contentChangeObserver = page()->contentChangeObserver(); 2073 contentChangeObserver.stopObservingContentChanges(); 2074 2075 auto inDeterminedState = contentChangeObserver.observedContentChange() == WKContentVisibilityChange || !contentChangeObserver.countOfObservedDOMTimers(); 2069 2076 if (inDeterminedState) { 2070 2077 LOG_WITH_STREAM(ContentObservation, stream << "Document(" << this << ")::scheduleStyleRecalc: notify the pending synthetic click handler."); 2071 if (auto* page = this->page()) 2072 page->chrome().client().observedContentChange(*frame()); 2078 page()->chrome().client().observedContentChange(*frame()); 2073 2079 } else { 2074 2080 LOG_WITH_STREAM(ContentObservation, stream << "Document(" << this << ")::scheduleStyleRecalc: can't decided it yet."); … … 2652 2658 { 2653 2659 #if PLATFORM(IOS_FAMILY) 2654 if ( WebThreadCountOfObservedDOMTimers() > 0) {2655 LOG_WITH_STREAM(ContentObservation, stream << "Document::platformSuspendOrStopActiveDOMObjects: remove registered timers.");2656 if (auto* frame = this->frame()) {2657 if (auto* page = frame->page())2658 page->chrome().client().clearContentChangeObservers(*frame);2659 }2660 }2660 if (!page() || !frame()) 2661 return; 2662 auto& page = *this->page(); 2663 if (!page.contentChangeObserver().countOfObservedDOMTimers()) 2664 return; 2665 LOG_WITH_STREAM(ContentObservation, stream << "Document::platformSuspendOrStopActiveDOMObjects: remove registered timers."); 2666 page.chrome().client().clearContentChangeObservers(*frame()); 2661 2667 #endif 2662 2668 } -
trunk/Source/WebCore/loader/FrameLoader.cpp
r241918 r242032 146 146 #include "ResourceLoader.h" 147 147 #include "RuntimeApplicationChecks.h" 148 #include "WKContentObservation.h"149 148 #endif 150 149 -
trunk/Source/WebCore/page/DOMTimer.cpp
r241499 r242032 45 45 #include "Chrome.h" 46 46 #include "ChromeClient.h" 47 #include "ContentChangeObserver.h" 47 48 #include "Frame.h" 48 #include "WKContentObservation.h"49 #include "WKContentObservationInternal.h"50 49 #endif 51 50 … … 220 219 // is destroyed, or if explicitly cancelled by removeById. 221 220 DOMTimer* timer = new DOMTimer(context, WTFMove(action), timeout, singleShot); 222 #if PLATFORM(IOS_FAMILY)223 if (WKIsObservingDOMTimerScheduling() && is<Document>(context)) {224 bool didDeferTimeout = context.activeDOMObjectsAreSuspended();225 if (!didDeferTimeout && timeout <= 250_ms && singleShot) {226 WKSetObservedContentChange(WKContentIndeterminateChange);227 WebThreadAddObservedDOMTimer(timer);228 LOG_WITH_STREAM(ContentObservation, stream << "DOMTimer::install: registed this timer: (" << timer << ") and observe when it fires.");229 }230 }231 #endif232 233 221 timer->suspendIfNeeded(); 234 222 InspectorInstrumentation::didInstallTimer(context, timer->m_timeoutId, timeout, singleShot); … … 238 226 nestedTimers->add(timer->m_timeoutId, *timer); 239 227 228 #if PLATFORM(IOS_FAMILY) 229 auto startObservingThisTimerIfNeeded = [&] { 230 if (!is<Document>(context)) 231 return; 232 if (context.activeDOMObjectsAreSuspended()) 233 return; 234 if (timeout > 250_ms || !singleShot) 235 return; 236 auto& contentChangeObserver = downcast<Document>(context).page()->contentChangeObserver(); 237 if (!contentChangeObserver.isObservingDOMTimerScheduling()) 238 return; 239 240 contentChangeObserver.setObservedContentChange(WKContentIndeterminateChange); 241 contentChangeObserver.addObservedDOMTimer(*timer); 242 LOG_WITH_STREAM(ContentObservation, stream << "DOMTimer::install: register this timer: (" << m_timeoutId << ") and observe when it fires."); 243 }; 244 245 startObservingThisTimerIfNeeded(); 246 #endif 240 247 return timer->m_timeoutId; 241 248 } … … 343 350 344 351 #if PLATFORM(IOS_FAMILY) 345 auto isOb versingLastTimer = false;352 auto isObservingLastTimer = false; 346 353 auto shouldBeginObservingChanges = false; 347 if (is<Document>(context)) { 348 isObversingLastTimer = WebThreadCountOfObservedDOMTimers() == 1; 349 shouldBeginObservingChanges = WebThreadContainsObservedDOMTimer(this); 354 Page* page = nullptr; 355 if (is<Document>(context) && downcast<Document>(context).page()) { 356 page = downcast<Document>(context).page(); 357 auto& contentChangeObserver = page->contentChangeObserver(); 358 isObservingLastTimer = contentChangeObserver.countOfObservedDOMTimers() == 1; 359 shouldBeginObservingChanges = contentChangeObserver.containsObservedDOMTimer(*this); 350 360 } 351 361 352 362 if (shouldBeginObservingChanges) { 353 LOG_WITH_STREAM(ContentObservation, stream << "DOMTimer::fired: start observing (" << this << ") timer callback."); 354 WKStartObservingContentChanges(); 355 WKStartObservingStyleRecalcScheduling(); 356 WebThreadRemoveObservedDOMTimer(this); 363 ASSERT(page); 364 LOG_WITH_STREAM(ContentObservation, stream << "DOMTimer::fired: start observing (" << m_timeoutId << ") timer callback."); 365 auto& contentChangeObserver = page->contentChangeObserver(); 366 contentChangeObserver.startObservingContentChanges(); 367 contentChangeObserver.startObservingStyleRecalcScheduling(); 368 contentChangeObserver.removeObservedDOMTimer(*this); 357 369 } 358 370 #endif … … 367 379 #if PLATFORM(IOS_FAMILY) 368 380 if (shouldBeginObservingChanges) { 369 LOG_WITH_STREAM(ContentObservation, stream << "DOMTimer::fired: stop observing (" << this << ") timer callback."); 370 WKStopObservingStyleRecalcScheduling(); 371 WKStopObservingContentChanges(); 372 373 auto observedContentChange = WKObservedContentChange(); 381 ASSERT(page); 382 LOG_WITH_STREAM(ContentObservation, stream << "DOMTimer::fired: stop observing (" << m_timeoutId << ") timer callback."); 383 auto& contentChangeObserver = page->contentChangeObserver(); 384 contentChangeObserver.stopObservingStyleRecalcScheduling(); 385 contentChangeObserver.stopObservingContentChanges(); 386 387 auto observedContentChange = contentChangeObserver.observedContentChange(); 374 388 // Check if the timer callback triggered either a sync or async style update. 375 auto inDeterminedState = observedContentChange == WKContentVisibilityChange || (isOb versingLastTimer && observedContentChange == WKContentNoChange);389 auto inDeterminedState = observedContentChange == WKContentVisibilityChange || (isObservingLastTimer && observedContentChange == WKContentNoChange); 376 390 if (inDeterminedState) { 377 LOG(ContentObservation, "DOMTimer::fired: in determined state."); 378 auto& document = downcast<Document>(context); 379 if (auto* page = document.page()) 380 page->chrome().client().observedContentChange(*document.frame()); 391 LOG_WITH_STREAM(ContentObservation, "DOMTimer::fired(" << m_timeoutId << "): in determined state."); 392 page->chrome().client().observedContentChange(*downcast<Document>(context).frame()); 381 393 } else if (observedContentChange == WKContentIndeterminateChange) { 382 394 // An async style recalc has been scheduled. Let's observe it. 383 LOG (ContentObservation, "DOMTimer::fired: wait until next style recalc fires.");384 WKSetShouldObserveNextStyleRecalc(true);395 LOG_WITH_STREAM(ContentObservation, "DOMTimer::fired(" << m_timeoutId << "): wait until next style recalc fires."); 396 contentChangeObserver.setShouldObserveNextStyleRecalc(true); 385 397 } 386 398 } -
trunk/Source/WebCore/page/DOMWindow.cpp
r241848 r242032 140 140 141 141 #if PLATFORM(IOS_FAMILY) 142 #include "WKContentObservation.h" 143 #include "WKContentObservationInternal.h" 144 #endif 145 142 #include "ContentChangeObserver.h" 143 #endif 146 144 147 145 namespace WebCore { … … 1685 1683 { 1686 1684 #if PLATFORM(IOS_FAMILY) 1687 if (auto* frame = this->frame()) { 1688 Document* document = frame->document(); 1689 if (timeoutId > 0 && document) { 1690 DOMTimer* timer = document->findTimeout(timeoutId); 1691 if (timer && WebThreadContainsObservedDOMTimer(timer)) { 1692 LOG_WITH_STREAM(ContentObservation, stream << "DOMWindow::clearTimeout: remove registered timer (" << timer << ")"); 1693 WebThreadRemoveObservedDOMTimer(timer); 1694 1695 if (!WebThreadCountOfObservedDOMTimers()) { 1696 if (Page* page = frame->page()) 1697 page->chrome().client().observedContentChange(*frame); 1698 } 1699 } 1700 } 1701 } 1685 auto handleObservedTimerCancelIfNeeded = [&] { 1686 if (!frame() || !frame()->document() || !frame()->document()->page()) 1687 return; 1688 if (timeoutId <= 0) 1689 return; 1690 auto& document = *frame()->document(); 1691 auto* timer = document.findTimeout(timeoutId); 1692 if (!timer) 1693 return; 1694 auto& page = *document.page(); 1695 auto& contentChangeObserver = page.contentChangeObserver(); 1696 if (!contentChangeObserver.containsObservedDOMTimer(*timer)) 1697 return; 1698 LOG_WITH_STREAM(ContentObservation, stream << "DOMWindow::clearTimeout: remove registered timer (" << timer << ")"); 1699 contentChangeObserver.removeObservedDOMTimer(*timer); 1700 if (contentChangeObserver.countOfObservedDOMTimers()) 1701 return; 1702 page.chrome().client().observedContentChange(*frame()); 1703 }; 1704 handleObservedTimerCancelIfNeeded(); 1702 1705 #endif 1703 1706 ScriptExecutionContext* context = scriptExecutionContext(); -
trunk/Source/WebCore/page/Frame.cpp
r241331 r242032 109 109 110 110 #if PLATFORM(IOS_FAMILY) 111 #include " WKContentObservation.h"111 #include "ContentChangeObserver.h" 112 112 #endif 113 113 … … 839 839 840 840 #if PLATFORM(IOS_FAMILY) 841 if ( WebThreadCountOfObservedDOMTimers() > 0 && m_page) {841 if (page() && page()->contentChangeObserver().countOfObservedDOMTimers()) { 842 842 LOG(ContentObservation, "Frame::willDetachPage: remove registered timers."); 843 843 m_page->chrome().client().clearContentChangeObservers(*this); -
trunk/Source/WebCore/page/Page.h
r241978 r242032 65 65 #if ENABLE(WIRELESS_PLAYBACK_TARGET) 66 66 #include "MediaPlaybackTargetContext.h" 67 #endif 68 69 #if PLATFORM(IOS_FAMILY) 70 #include "ContentChangeObserver.h" 67 71 #endif 68 72 … … 252 256 PointerLockController& pointerLockController() const { return *m_pointerLockController; } 253 257 #endif 258 #if PLATFORM(IOS_FAMILY) 259 ContentChangeObserver& contentChangeObserver() { return m_contentChangeObserver; } 260 #endif 254 261 LibWebRTCProvider& libWebRTCProvider() { return m_libWebRTCProvider.get(); } 255 262 RTCController& rtcController() { return m_rtcController; } … … 809 816 #if PLATFORM(IOS_FAMILY) 810 817 bool m_enclosedInScrollableAncestorView { false }; 818 ContentChangeObserver m_contentChangeObserver; 811 819 #endif 812 820 -
trunk/Source/WebCore/page/ios/EventHandlerIOS.mm
r241044 r242032 33 33 #import "Chrome.h" 34 34 #import "ChromeClient.h" 35 #import "ContentChangeObserver.h" 35 36 #import "DataTransfer.h" 36 37 #import "DragState.h" … … 491 492 492 493 BEGIN_BLOCK_OBJC_EXCEPTIONS; 493 494 m_frame.document()->updateStyleIfNeeded(); 495 496 WKStartObservingContentChanges(); 497 WKStartObservingDOMTimerScheduling(); 494 auto& document = *m_frame.document(); 495 // Ensure we start mouse move event dispatching on a clear tree. 496 document.updateStyleIfNeeded(); 497 498 auto& contentChangeObserver = document.page()->contentChangeObserver(); 499 contentChangeObserver.startObservingContentChanges(); 500 contentChangeObserver.startObservingDOMTimerScheduling(); 501 498 502 CurrentEventScope scope(event); 499 503 event.wasHandled = mouseMoved(currentPlatformMouseEvent()); 500 501 // FIXME: Why is this here?502 m_frame.document()->updateStyleIfNeeded();503 WKStopObservingDOMTimerScheduling();504 WKStopObservingContentChanges();504 505 // Run style recalc to be able to capture content changes as the result of the mouse move event. 506 document.updateStyleIfNeeded(); 507 contentChangeObserver.stopObservingDOMTimerScheduling(); 508 contentChangeObserver.stopObservingContentChanges(); 505 509 506 510 END_BLOCK_OBJC_EXCEPTIONS; -
trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp
r239427 r242032 51 51 52 52 #if PLATFORM(IOS_FAMILY) 53 #include "WKContentObservation.h" 54 #include "WKContentObservationInternal.h" 53 #include "ContentChangeObserver.h" 55 54 #endif 56 55 … … 60 59 class CheckForVisibilityChange { 61 60 public: 62 CheckForVisibilityChange(const Element& );61 CheckForVisibilityChange(const Element&, Page*); 63 62 ~CheckForVisibilityChange(); 64 63 65 64 private: 66 65 const Element& m_element; 66 Page* m_page { nullptr }; 67 67 DisplayType m_previousDisplay; 68 68 Visibility m_previousVisibility; … … 309 309 { 310 310 #if PLATFORM(IOS_FAMILY) 311 CheckForVisibilityChange checkForVisibilityChange(element );311 CheckForVisibilityChange checkForVisibilityChange(element, m_document.page()); 312 312 #endif 313 313 … … 668 668 } 669 669 670 CheckForVisibilityChange::CheckForVisibilityChange(const Element& element )670 CheckForVisibilityChange::CheckForVisibilityChange(const Element& element, Page* page) 671 671 : m_element(element) 672 , m_page(page) 672 673 , m_previousDisplay(element.renderStyle() ? element.renderStyle()->display() : DisplayType::None) 673 674 , m_previousVisibility(element.renderStyle() ? element.renderStyle()->visibility() : Visibility::Hidden) 674 , m_previousImplicitVisibility( WKObservingContentChanges() && WKObservedContentChange() != WKContentVisibilityChange ? elementImplicitVisibility(element) : Visibility::Visible)675 , m_previousImplicitVisibility(page && page->contentChangeObserver().isObservingContentChanges() && page->contentChangeObserver().observedContentChange() != WKContentVisibilityChange ? elementImplicitVisibility(element) : Visibility::Visible) 675 676 { 676 677 } … … 678 679 CheckForVisibilityChange::~CheckForVisibilityChange() 679 680 { 680 if (!WKObservingContentChanges()) 681 if (!m_page) 682 return; 683 684 auto& contentChangeObserver = m_page->contentChangeObserver(); 685 if (!contentChangeObserver.isObservingContentChanges()) 681 686 return; 682 687 … … 697 702 if ((m_previousDisplay == DisplayType::None && style->display() != DisplayType::None) || (m_previousVisibility == Visibility::Hidden && style->visibility() != Visibility::Hidden) 698 703 || (m_previousImplicitVisibility == Visibility::Hidden && elementImplicitVisibility(m_element) == Visibility::Visible)) 699 WKSetObservedContentChange(WKContentVisibilityChange);704 contentChangeObserver.setObservedContentChange(WKContentVisibilityChange); 700 705 } 701 706 #endif -
trunk/Source/WebKit/ChangeLog
r242031 r242032 1 2019-02-24 Zalan Bujtas <zalan@apple.com> 2 3 Introduce ContentChangeObserver class 4 https://bugs.webkit.org/show_bug.cgi?id=194977 5 <rdar://problem/48338115> 6 7 Reviewed by Simon Fraser. 8 9 * WebProcess/WebPage/ios/WebPageIOS.mm: 10 (WebKit::WebPage::handleSyntheticClick): 11 (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver): 12 1 13 2019-02-24 Simon Fraser <simon.fraser@apple.com> 2 14 -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r241971 r242032 58 58 #import <WebCore/AutofillElements.h> 59 59 #import <WebCore/Chrome.h> 60 #import <WebCore/ContentChangeObserver.h> 60 61 #import <WebCore/DataDetection.h> 61 62 #import <WebCore/DiagnosticLoggingClient.h> … … 114 115 #import <WebCore/TextIterator.h> 115 116 #import <WebCore/VisibleUnits.h> 116 #import <WebCore/WKContentObservation.h>117 117 #import <WebCore/WebEvent.h> 118 118 #import <wtf/MathExtras.h> … … 539 539 { 540 540 IntPoint roundedAdjustedPoint = roundedIntPoint(location); 541 Frame& mainframe = m_page->mainFrame(); 541 auto& mainframe = m_page->mainFrame(); 542 auto& contentChangeObserver = m_page->contentChangeObserver(); 542 543 543 544 LOG_WITH_STREAM(ContentObservation, stream << "handleSyntheticClick: node(" << nodeRespondingToClick << ") " << location); 544 WKStartObservingContentChanges();545 WKStartObservingDOMTimerScheduling();545 contentChangeObserver.startObservingContentChanges(); 546 contentChangeObserver.startObservingDOMTimerScheduling(); 546 547 547 548 // FIXME: Pass caps lock state. … … 553 554 mainframe.document()->updateStyleIfNeeded(); 554 555 555 WKStopObservingDOMTimerScheduling();556 WKStopObservingContentChanges();556 contentChangeObserver.stopObservingDOMTimerScheduling(); 557 contentChangeObserver.stopObservingContentChanges(); 557 558 558 559 m_pendingSyntheticClickNode = nullptr; … … 563 564 return; 564 565 565 switch ( WKObservedContentChange()) {566 switch (contentChangeObserver.observedContentChange()) { 566 567 case WKContentVisibilityChange: 567 568 // The move event caused new contents to appear. Don't send the click event. … … 589 590 return; 590 591 // Only dispatch the click if the document didn't get changed by any timers started by the move event. 591 if ( WKObservedContentChange() == WKContentNoChange) {592 if (m_page->contentChangeObserver().observedContentChange() == WKContentNoChange) { 592 593 LOG(ContentObservation, "No chage was observed -> click."); 593 594 completeSyntheticClick(m_pendingSyntheticClickNode.get(), m_pendingSyntheticClickLocation, m_pendingSyntheticClickModifiers, WebCore::OneFingerTap); -
trunk/Source/WebKitLegacy/ios/ChangeLog
r241654 r242032 1 2019-02-24 Zalan Bujtas <zalan@apple.com> 2 3 Introduce ContentChangeObserver class 4 https://bugs.webkit.org/show_bug.cgi?id=194977 5 <rdar://problem/48338115> 6 7 Reviewed by Simon Fraser. 8 9 * WebCoreSupport/WebChromeClientIOS.mm: 10 (WebChromeClientIOS::observedContentChange): 11 (WebChromeClientIOS::clearContentChangeObservers): 12 1 13 2019-02-17 David Kilzer <ddkilzer@apple.com> 2 14 -
trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.mm
r239658 r242032 45 45 #import "WebViewInternal.h" 46 46 #import "WebViewPrivate.h" 47 #import <WebCore/ContentChangeObserver.h> 47 48 #import <WebCore/DisabledAdaptations.h> 48 49 #import <WebCore/FileChooser.h> … … 184 185 void WebChromeClientIOS::observedContentChange(WebCore::Frame& frame) 185 186 { 186 [[webView() _UIKitDelegateForwarder] webView:webView() didObserveDeferredContentChange:WKObservedContentChange() forFrame:kit(&frame)]; 187 if (!frame.page()) 188 return; 189 [[webView() _UIKitDelegateForwarder] webView:webView() didObserveDeferredContentChange:frame.page()->contentChangeObserver().observedContentChange() forFrame:kit(&frame)]; 187 190 } 188 191 189 192 void WebChromeClientIOS::clearContentChangeObservers(WebCore::Frame& frame) 190 193 { 191 ASSERT(WebThreadCountOfObservedDOMTimers() > 0); 192 if (WebThreadCountOfObservedDOMTimers() > 0) { 193 WebThreadClearObservedDOMTimers(); 194 observedContentChange(frame); 195 } 194 if (!frame.page()) 195 return; 196 auto& contentChangeObserver = frame.page()->contentChangeObserver(); 197 ASSERT(contentChangeObserver.countOfObservedDOMTimers()); 198 if (!contentChangeObserver.countOfObservedDOMTimers()) 199 return; 200 contentChangeObserver.clearObservedDOMTimers(); 201 observedContentChange(frame); 196 202 } 197 203
Note: See TracChangeset
for help on using the changeset viewer.