Changeset 208361 in webkit
- Timestamp:
- Nov 3, 2016 6:38:31 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 33 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r208360 r208361 1 2016-11-03 Chris Dumez <cdumez@apple.com> 2 3 [WK2][Cocoa] Implement user interface for HTML form validation 4 https://bugs.webkit.org/show_bug.cgi?id=164143 5 <rdar://problem/28944652> 6 7 Reviewed by Simon Fraser. 8 9 * fast/forms/validation-messages-expected.txt: Added. 10 * fast/forms/validation-messages.html: Added. 11 Add layout test coverage for checking that the right validation messages 12 are displayed when submitting forms with constraint violations. More 13 testing will be landed in follow up to cover other things besides the 14 messages (e.g. when does the bubble disappear). 15 16 * platform/mac-wk1/TestExpectations: 17 Skip new test on WebKit1 because the feature is WebKit2 only at the 18 moment. 19 20 * platform/ios-simulator-wk2/TestExpectations: 21 * platform/mac-wk2/TestExpectations: 22 Skip tests for the Shadow DOM based HTML form validation UI on 23 Mac and iOS WK2 now that those ports use native popovers instead. 24 1 25 2016-11-03 Ryosuke Niwa <rniwa@webkit.org> 2 26 -
trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations
r207440 r208361 1458 1458 fast/replaced/pdf-as-object-and-embed.html [ Pass ] 1459 1459 1460 # These tests test the Shadow DOM based HTML form validation UI but iOS WK2 is using native dialogs instead. 1461 fast/forms/validation-message-on-listbox.html 1462 fast/forms/validation-message-on-menulist.html 1463 fast/forms/validation-message-on-radio.html 1464 fast/forms/validation-message-on-checkbox.html 1465 fast/forms/validation-message-on-range.html 1466 fast/forms/validation-message-clone.html 1467 fast/forms/validation-message-in-relative-body.html 1468 fast/forms/validation-message-appearance.html 1469 fast/forms/validation-message-on-textarea.html 1470 1460 1471 # Flaky as of 06/08/2015 1461 1472 compositing/overflow/overflow-positioning.html [ Failure ImageOnlyFailure Pass ] -
trunk/LayoutTests/platform/mac-wk1/TestExpectations
r208249 r208361 240 240 [ Sierra+ ] svg/hixie/text/003.html [ Failure ] 241 241 242 # We do not support the new HTML validation UI on WebKit1 yet (rdar://problem/28944652). 243 fast/forms/validation-messages.html [ Skip ] 244 242 245 [ Yosemite ] http/tests/media/hls/video-controller-getStartDate.html [ Pass Timeout ] 243 246 -
trunk/LayoutTests/platform/mac-wk2/TestExpectations
r208236 r208361 194 194 webkit.org/b/95043 http/tests/security/local-user-CSS-from-remote.html [ Failure ] 195 195 196 # These tests test the Shadow DOM based HTML form validation UI but Mac WK2 is using native dialogs instead. 197 fast/forms/validation-message-on-listbox.html 198 fast/forms/validation-message-on-menulist.html 199 fast/forms/validation-message-on-radio.html 200 fast/forms/validation-message-on-checkbox.html 201 fast/forms/validation-message-on-range.html 202 fast/forms/validation-message-clone.html 203 fast/forms/validation-message-in-relative-body.html 204 fast/forms/validation-message-appearance.html 205 fast/forms/validation-message-on-textarea.html 206 196 207 # All spatial navigation tests fail on Mac WK2 197 208 webkit.org/b/96438 fast/spatial-navigation -
trunk/Source/WebCore/ChangeLog
r208359 r208361 1 2016-11-03 Chris Dumez <cdumez@apple.com> 2 3 [WK2][Cocoa] Implement user interface for HTML form validation 4 https://bugs.webkit.org/show_bug.cgi?id=164143 5 <rdar://problem/28944652> 6 7 Reviewed by Simon Fraser. 8 9 Add ValidationBubble class to show HTML form validation messages 10 using native dialogs. It currently has an implementation for both 11 Mac and iOS. It is in WebCore under platform/ so that it can be 12 used by both WebKit1 and WebKit2. 13 14 Update ownership of ValidationMessageClient so that is is owned 15 by the Page using a unique_ptr<>, which seems to be the modern 16 way of handling lifetime for page clients. 17 18 Test: fast/forms/validation-messages.html 19 20 * WebCore.xcodeproj/project.pbxproj: 21 * html/HTMLFormControlElement.cpp: 22 (WebCore::HTMLFormControlElement::focusAndShowValidationMessage): 23 * html/ValidationMessage.cpp: 24 (WebCore::ValidationMessage::updateValidationMessage): 25 * page/Page.cpp: 26 (WebCore::Page::Page): 27 (WebCore::Page::~Page): 28 * page/Page.h: 29 (WebCore::Page::validationMessageClient): 30 * page/PageConfiguration.cpp: 31 * page/PageConfiguration.h: 32 * platform/ValidationBubble.h: Copied from Tools/DumpRenderTree/mac/UIScriptControllerMac.mm. 33 (WebCore::ValidationBubble::message): 34 * platform/ios/ValidationBubbleIOS.mm: Added. 35 (-[WebValidationBubbleDelegate adaptivePresentationStyleForPresentationController:traitCollection:]): 36 (WebCore::ValidationBubble::ValidationBubble): 37 (WebCore::ValidationBubble::~ValidationBubble): 38 (WebCore::ValidationBubble::show): 39 (WebCore::ValidationBubble::setAnchorRect): 40 * platform/mac/ValidationBubbleMac.mm: Added. 41 (WebCore::ValidationBubble::ValidationBubble): 42 (WebCore::ValidationBubble::~ValidationBubble): 43 (WebCore::ValidationBubble::showRelativeTo): 44 1 45 2016-11-03 Brady Eidson <beidson@apple.com> 2 46 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r208344 r208361 2962 2962 8372DB311A6780A800C697C5 /* DiagnosticLoggingResultType.h in Headers */ = {isa = PBXBuildFile; fileRef = 8372DB301A6780A800C697C5 /* DiagnosticLoggingResultType.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2963 2963 83765F951DAC522F00C06537 /* MouseEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 83765F941DAC521800C06537 /* MouseEventInit.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2964 837B7D201DC3F55000D051FC /* ValidationBubbleIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 837B7D1F1DC3F54C00D051FC /* ValidationBubbleIOS.mm */; }; 2964 2965 8386A96D19F61B2E00E1EC4A /* StyleBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 8386A96C19F61B2E00E1EC4A /* StyleBuilder.h */; }; 2965 2966 8386A97019F61E4F00E1EC4A /* StyleBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8386A96E19F61E4F00E1EC4A /* StyleBuilder.cpp */; }; … … 2995 2996 83C1D435178D5AB500141E68 /* SVGPathSegMovetoAbs.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C1D423178D5AB400141E68 /* SVGPathSegMovetoAbs.h */; }; 2996 2997 83C1D436178D5AB500141E68 /* SVGPathSegMovetoRel.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C1D424178D5AB400141E68 /* SVGPathSegMovetoRel.h */; }; 2998 83C45B8C1DC2B667008871BA /* ValidationBubbleMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83C45B8B1DC2B663008871BA /* ValidationBubbleMac.mm */; }; 2999 83C45B8E1DC2B68A008871BA /* ValidationBubble.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C45B8D1DC2B67C008871BA /* ValidationBubble.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2997 3000 83C5795D1DA5C301006FACA8 /* ScrollToOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 8350C3E71DA59B6200356446 /* ScrollToOptions.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2998 3001 83D35AEC1C7187FA00F70D5A /* XMLHttpRequestEventTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D35AEA1C7187ED00F70D5A /* XMLHttpRequestEventTarget.h */; }; … … 6420 6423 F50664F7157F52DC00AC226F /* FormController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F50664F5157F52DC00AC226F /* FormController.cpp */; }; 6421 6424 F50664F8157F52DC00AC226F /* FormController.h in Headers */ = {isa = PBXBuildFile; fileRef = F50664F6157F52DC00AC226F /* FormController.h */; }; 6422 F513A3EA15FF4841001526DB /* ValidationMessageClient.h in Headers */ = {isa = PBXBuildFile; fileRef = F513A3E915FF4841001526DB /* ValidationMessageClient.h */; };6425 F513A3EA15FF4841001526DB /* ValidationMessageClient.h in Headers */ = {isa = PBXBuildFile; fileRef = F513A3E915FF4841001526DB /* ValidationMessageClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6423 6426 F52A8FD71D0A8D0E0073CF42 /* AccessibilityLabel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F52A8FD51D0A88010073CF42 /* AccessibilityLabel.cpp */; }; 6424 6427 F52AD5E41534245F0059FBE6 /* EmptyClients.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F52AD5E31534245F0059FBE6 /* EmptyClients.cpp */; }; … … 10331 10334 83765F931DAC521800C06537 /* MouseEventInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MouseEventInit.idl; sourceTree = "<group>"; }; 10332 10335 83765F941DAC521800C06537 /* MouseEventInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MouseEventInit.h; sourceTree = "<group>"; }; 10336 837B7D1F1DC3F54C00D051FC /* ValidationBubbleIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ValidationBubbleIOS.mm; sourceTree = "<group>"; }; 10333 10337 8386A96C19F61B2E00E1EC4A /* StyleBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilder.h; sourceTree = "<group>"; }; 10334 10338 8386A96E19F61E4F00E1EC4A /* StyleBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleBuilder.cpp; sourceTree = "<group>"; }; … … 10364 10368 83C1D423178D5AB400141E68 /* SVGPathSegMovetoAbs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathSegMovetoAbs.h; sourceTree = "<group>"; }; 10365 10369 83C1D424178D5AB400141E68 /* SVGPathSegMovetoRel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathSegMovetoRel.h; sourceTree = "<group>"; }; 10370 83C45B8B1DC2B663008871BA /* ValidationBubbleMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ValidationBubbleMac.mm; sourceTree = "<group>"; }; 10371 83C45B8D1DC2B67C008871BA /* ValidationBubble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValidationBubble.h; sourceTree = "<group>"; }; 10366 10372 83D26D3C1AFDCC50001B3873 /* ChildNode.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = ChildNode.idl; sourceTree = "<group>"; }; 10367 10373 83D26D3D1AFDCC50001B3873 /* ParentNode.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = ParentNode.idl; sourceTree = "<group>"; }; … … 17557 17563 6593923909AE435C002C531F /* URLMac.mm */, 17558 17564 868160D3187669E70021E79D /* UserActivityMac.mm */, 17565 83C45B8B1DC2B663008871BA /* ValidationBubbleMac.mm */, 17559 17566 CDC69DD816371FD3007C38DF /* WebCoreFullScreenPlaceholderView.h */, 17560 17567 CDC69DD916371FD3007C38DF /* WebCoreFullScreenPlaceholderView.mm */, … … 19335 19342 1F72BF08187FD4270009BCB3 /* TileControllerMemoryHandlerIOS.cpp */, 19336 19343 1F72BF09187FD4270009BCB3 /* TileControllerMemoryHandlerIOS.h */, 19344 837B7D1F1DC3F54C00D051FC /* ValidationBubbleIOS.mm */, 19337 19345 CDA29A2C1CBF73FC00901CCF /* WebAVPlayerController.h */, 19338 19346 CDA29A2D1CBF73FC00901CCF /* WebAVPlayerController.mm */, … … 22359 22367 2E3BBF051162DA1100B9409A /* UUID.cpp */, 22360 22368 2E3BBF061162DA1100B9409A /* UUID.h */, 22369 83C45B8D1DC2B67C008871BA /* ValidationBubble.h */, 22361 22370 9A1142031832D134000BB8AD /* ValueToString.h */, 22362 22371 46DB7D581B20FE58005651B2 /* VNodeTracker.cpp */, … … 26429 26438 CDBEAEAD19D92B6C00BEBA88 /* MediaSelectionGroupAVFObjC.h in Headers */, 26430 26439 C9027F421B1D0AD200BFBFEF /* MediaSession.h in Headers */, 26440 83C45B8E1DC2B68A008871BA /* ValidationBubble.h in Headers */, 26431 26441 C9F87CFE1B28F40E00979B83 /* MediaSessionEvents.h in Headers */, 26432 26442 C96F5EC81B5872260091EA9D /* MediaSessionInterruptionProvider.h in Headers */, … … 29329 29339 FDA15EC912B03F50003A583A /* JSAnalyserNode.cpp in Sources */, 29330 29340 31A795C61888BADC00382F90 /* JSANGLEInstancedArrays.cpp in Sources */, 29341 83C45B8C1DC2B667008871BA /* ValidationBubbleMac.mm in Sources */, 29331 29342 12A253E21C8FFF6600C22295 /* JSAnimatable.cpp in Sources */, 29332 29343 120DE3FE1C87E18800B6D4DD /* JSAnimationEffect.cpp in Sources */, … … 29547 29558 A80E7B120A19D606007FB8C5 /* JSHTMLBaseElement.cpp in Sources */, 29548 29559 1AE2AA220A1CDAB400B42B25 /* JSHTMLBodyElement.cpp in Sources */, 29560 837B7D201DC3F55000D051FC /* ValidationBubbleIOS.mm in Sources */, 29549 29561 1AE2AA240A1CDAB400B42B25 /* JSHTMLBRElement.cpp in Sources */, 29550 29562 A80E7EA00A1A83E3007FB8C5 /* JSHTMLButtonElement.cpp in Sources */, -
trunk/Source/WebCore/html/HTMLFormControlElement.cpp
r207458 r208361 518 518 void HTMLFormControlElement::focusAndShowValidationMessage() 519 519 { 520 scrollIntoViewIfNeeded(false);520 // Calling focus() will scroll the element into view. 521 521 focus(); 522 522 updateVisibleValidationMessage(); -
trunk/Source/WebCore/html/ValidationMessage.cpp
r208096 r208361 77 77 void ValidationMessage::updateValidationMessage(const String& message) 78 78 { 79 // We want to hide the validation message as soon as the user starts 80 // typing, even if a constraint is still violated. Thefore, we hide the message instead 81 // of updating it if it is already visible. 82 if (isVisible()) { 83 requestToHideMessage(); 84 return; 85 } 86 79 87 String updatedMessage = message; 80 88 if (!validationMessageClient()) { -
trunk/Source/WebCore/page/Page.cpp
r208329 r208361 95 95 #include "UserContentProvider.h" 96 96 #include "UserInputBridge.h" 97 #include "ValidationMessageClient.h" 97 98 #include "VisitedLinkState.h" 98 99 #include "VisitedLinkStore.h" … … 183 184 , m_editorClient(WTFMove(pageConfiguration.editorClient)) 184 185 , m_plugInClient(pageConfiguration.plugInClient) 185 , m_validationMessageClient( pageConfiguration.validationMessageClient)186 , m_validationMessageClient(WTFMove(pageConfiguration.validationMessageClient)) 186 187 , m_diagnosticLoggingClient(WTFMove(pageConfiguration.diagnosticLoggingClient)) 187 188 , m_subframeCount(0) … … 271 272 Page::~Page() 272 273 { 274 m_validationMessageClient = nullptr; 273 275 m_diagnosticLoggingClient = nullptr; 274 276 m_mainFrame->setView(nullptr); -
trunk/Source/WebCore/page/Page.h
r208329 r208361 206 206 PointerLockController& pointerLockController() const { return *m_pointerLockController; } 207 207 #endif 208 ValidationMessageClient* validationMessageClient() const { return m_validationMessageClient ; }208 ValidationMessageClient* validationMessageClient() const { return m_validationMessageClient.get(); } 209 209 210 210 WEBCORE_EXPORT ScrollingCoordinator* scrollingCoordinator(); … … 593 593 UniqueRef<EditorClient> m_editorClient; 594 594 PlugInClient* m_plugInClient; 595 ValidationMessageClient*m_validationMessageClient;595 std::unique_ptr<ValidationMessageClient> m_validationMessageClient; 596 596 std::unique_ptr<DiagnosticLoggingClient> m_diagnosticLoggingClient; 597 597 -
trunk/Source/WebCore/page/PageConfiguration.cpp
r204268 r208361 36 36 #include "StorageNamespaceProvider.h" 37 37 #include "UserContentController.h" 38 #include "ValidationMessageClient.h" 38 39 #include "VisitedLinkStore.h" 39 40 -
trunk/Source/WebCore/page/PageConfiguration.h
r204268 r208361 78 78 ProgressTrackerClient* progressTrackerClient { nullptr }; 79 79 RefPtr<BackForwardClient> backForwardClient; 80 ValidationMessageClient* validationMessageClient { nullptr };80 std::unique_ptr<ValidationMessageClient> validationMessageClient; 81 81 FrameLoaderClient* loaderClientForMainFrame { nullptr }; 82 std::unique_ptr<DiagnosticLoggingClient> diagnosticLoggingClient { nullptr };82 std::unique_ptr<DiagnosticLoggingClient> diagnosticLoggingClient; 83 83 84 84 RefPtr<ApplicationCacheStorage> applicationCacheStorage; -
trunk/Source/WebCore/platform/ValidationBubble.h
r208360 r208361 1 1 /* 2 * Copyright (C) 201 5Apple Inc. All rights reserved.2 * Copyright (C) 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #import "config.h" 27 #import "UIScriptController.h" 26 #pragma once 28 27 29 #import "DumpRenderTree.h" 30 #import "UIScriptContext.h" 31 #import <WebKit/WebKit.h> 32 #import <WebKit/WebViewPrivate.h> 28 #include "IntRect.h" 29 #include <wtf/Forward.h> 30 #include <wtf/text/WTFString.h> 31 32 #if PLATFORM(COCOA) 33 #include <wtf/RetainPtr.h> 34 #endif 33 35 34 36 #if PLATFORM(MAC) 37 OBJC_CLASS NSPopover; 38 #elif PLATFORM(IOS) 39 OBJC_CLASS UIViewController; 40 OBJC_CLASS WebValidationBubbleDelegate; 41 #endif 35 42 36 namespace WTR { 43 #if PLATFORM(MAC) 44 OBJC_CLASS NSView; 45 using PlatformView = NSView; 46 #elif PLATFORM(IOS) 47 OBJC_CLASS UIView; 48 using PlatformView = UIView; 49 #else 50 using PlatformView = void; 51 #endif 37 52 38 void UIScriptController::doAsyncTask(JSValueRef callback) 39 { 40 unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent); 53 namespace WebCore { 41 54 42 dispatch_async(dispatch_get_main_queue(), ^{ 43 if (!m_context) 44 return; 45 m_context->asyncTaskComplete(callbackID); 46 }); 47 } 55 class ValidationBubble { 56 public: 57 WEBCORE_EXPORT ValidationBubble(PlatformView*, const String& message); 58 WEBCORE_EXPORT ~ValidationBubble(); 48 59 49 void UIScriptController::insertText(JSStringRef, int, int) 50 { 51 } 60 const String& message() const { return m_message; } 52 61 53 void UIScriptController::zoomToScale(double scale, JSValueRef callback) 54 { 55 unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent); 62 #if PLATFORM(IOS) 63 WEBCORE_EXPORT void setAnchorRect(const IntRect& anchorRect, UIViewController* presentingViewController); 64 WEBCORE_EXPORT void show(); 65 #else 66 WEBCORE_EXPORT void showRelativeTo(const IntRect& anchorRect); 67 #endif 56 68 57 WebView *webView = [mainFrame webView]; 58 [webView _scaleWebView:scale atOrigin:NSZeroPoint]; 59 60 dispatch_async(dispatch_get_main_queue(), ^ { 61 if (!m_context) 62 return; 63 m_context->asyncTaskComplete(callbackID); 64 }); 65 } 69 private: 70 PlatformView* m_view; 71 String m_message; 72 #if PLATFORM(MAC) 73 RetainPtr<NSPopover> m_popover; 74 #elif PLATFORM(IOS) 75 RetainPtr<UIViewController> m_popoverController; 76 RetainPtr<WebValidationBubbleDelegate> m_popoverDelegate; 77 UIViewController *m_presentingViewController; 78 #endif 79 }; 66 80 67 81 } 68 69 #endif // PLATFORM(MAC) -
trunk/Source/WebKit2/ChangeLog
r208347 r208361 1 2016-11-03 Chris Dumez <cdumez@apple.com> 2 3 [WK2][Cocoa] Implement user interface for HTML form validation 4 https://bugs.webkit.org/show_bug.cgi?id=164143 5 <rdar://problem/28944652> 6 7 Reviewed by Simon Fraser. 8 9 Implement the ValidationMessageClient in WebKit2 and have it display 10 a ValidationBubble on Cocoa. ValidationBubble is implemented using 11 native popovers on both Mac and iOS. As a result, Mac and iOS WK2 12 now use native popover for HTML form validation instead of the old 13 Shadow DOM based UI in WebCore. 14 15 The native popover shows at the bottom (or top) of the input and it 16 disapears as soon as the user starts typing or interacts with the 17 view (e.g. tap / scroll / zoom). 18 19 The feature is still disabled at runtime. 20 21 * UIProcess/API/Cocoa/WKWebView.mm: 22 (-[WKWebView _initializeWithConfiguration:]): 23 (-[WKWebView _keyboardWillShow:]): 24 (-[WKWebView _keyboardDidShow:]): 25 (-[WKWebView _contentsOfUserInterfaceItem:]): 26 * UIProcess/API/Cocoa/WKWebViewPrivate.h: 27 * UIProcess/Cocoa/WebPageProxyCocoa.mm: 28 * UIProcess/PageClient.h: 29 * UIProcess/WebPageProxy.cpp: 30 (WebKit::WebPageProxy::handleWheelEvent): 31 (WebKit::WebPageProxy::setPageZoomFactor): 32 (WebKit::WebPageProxy::setPageAndTextZoomFactors): 33 (WebKit::WebPageProxy::pageDidScroll): 34 (WebKit::WebPageProxy::resetState): 35 (WebKit::WebPageProxy::hideValidationMessage): 36 * UIProcess/WebPageProxy.h: 37 (WebKit::WebPageProxy::validationBubble): 38 (WebKit::WebPageProxy::setIsKeyboardAnimatingIn): 39 * UIProcess/WebPageProxy.messages.in: 40 * UIProcess/ios/PageClientImplIOS.h: 41 * UIProcess/ios/PageClientImplIOS.mm: 42 (WebKit::PageClientImpl::createValidationBubble): 43 * UIProcess/ios/WKContentViewInteraction.mm: 44 (-[WKContentView _willStartScrollingOrZooming]): 45 (-[WKContentView scrollViewWillStartPanOrPinchGesture]): 46 (-[WKContentView _didEndScrollingOrZooming]): 47 * UIProcess/ios/WebPageProxyIOS.mm: 48 (WebKit::WebPageProxy::dynamicViewportSizeUpdate): 49 (WebKit::WebPageProxy::potentialTapAtPosition): 50 (WebKit::WebPageProxy::showValidationMessage): 51 (WebKit::WebPageProxy::setIsScrollingOrZooming): 52 * UIProcess/mac/PageClientImpl.h: 53 * UIProcess/mac/PageClientImpl.mm: 54 (WebKit::PageClientImpl::createValidationBubble): 55 * UIProcess/mac/WebPageProxyMac.mm: 56 (WebKit::WebPageProxy::showValidationMessage): 57 * WebKit2.xcodeproj/project.pbxproj: 58 * WebProcess/WebCoreSupport/WebValidationMessageClient.cpp: Copied from Tools/DumpRenderTree/mac/UIScriptControllerMac.mm. 59 (WebKit::WebValidationMessageClient::WebValidationMessageClient): 60 (WebKit::WebValidationMessageClient::~WebValidationMessageClient): 61 (WebKit::WebValidationMessageClient::showValidationMessage): 62 (WebKit::WebValidationMessageClient::hideValidationMessage): 63 (WebKit::WebValidationMessageClient::isValidationMessageVisible): 64 * WebProcess/WebCoreSupport/WebValidationMessageClient.h: Copied from Tools/DumpRenderTree/mac/UIScriptControllerMac.mm. 65 * WebProcess/WebPage/WebPage.cpp: 66 (WebKit::m_userInterfaceLayoutDirection): 67 1 68 2016-11-03 Tim Horton <timothy_horton@apple.com> 2 69 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r208342 r208361 94 94 #import <WebCore/Settings.h> 95 95 #import <WebCore/TextStream.h> 96 #import <WebCore/ValidationBubble.h> 96 97 #import <WebCore/WritingMode.h> 97 98 #import <wtf/HashMap.h> … … 525 526 [center addObserver:self selector:@selector(_keyboardDidChangeFrame:) name:UIKeyboardDidChangeFrameNotification object:nil]; 526 527 [center addObserver:self selector:@selector(_keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; 528 [center addObserver:self selector:@selector(_keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil]; 527 529 [center addObserver:self selector:@selector(_keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; 528 530 [center addObserver:self selector:@selector(_windowDidRotate:) name:UIWindowDidRotateNotification object:nil]; … … 2178 2180 if ([self _shouldUpdateKeyboardWithInfo:notification.userInfo]) 2179 2181 [self _keyboardChangedWithInfo:notification.userInfo adjustScrollView:YES]; 2182 2183 _page->setIsKeyboardAnimatingIn(true); 2184 } 2185 2186 - (void)_keyboardDidShow:(NSNotification *)notification 2187 { 2188 _page->setIsKeyboardAnimatingIn(false); 2180 2189 } 2181 2190 … … 4528 4537 @implementation WKWebView (WKTesting) 4529 4538 4539 - (NSDictionary *)_contentsOfUserInterfaceItem:(NSString *)userInterfaceItem 4540 { 4541 if ([userInterfaceItem isEqualToString:@"validationBubble"]) { 4542 auto* validationBubble = _page->validationBubble(); 4543 String message = validationBubble ? validationBubble->message() : emptyString(); 4544 return @{ userInterfaceItem: @{ @"message": (NSString *)message } }; 4545 } 4546 4530 4547 #if PLATFORM(IOS) 4548 return [_contentView _contentsOfUserInterfaceItem:(NSString *)userInterfaceItem]; 4549 #else 4550 return nil; 4551 #endif 4552 } 4553 4554 #if PLATFORM(IOS) 4531 4555 4532 4556 - (CGRect)_contentVisibleRect … … 4563 4587 { 4564 4588 [_contentView selectFormAccessoryPickerRow:rowIndex]; 4565 }4566 4567 - (NSDictionary *)_contentsOfUserInterfaceItem:(NSString *)userInterfaceItem4568 {4569 return [_contentView _contentsOfUserInterfaceItem:(NSString *)userInterfaceItem];4570 4589 } 4571 4590 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h
r208143 r208361 258 258 @interface WKWebView (WKTesting) 259 259 260 - (NSDictionary *)_contentsOfUserInterfaceItem:(NSString *)userInterfaceItem WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 261 260 262 #if TARGET_OS_IPHONE 261 263 … … 268 270 - (void)dismissFormAccessoryView WK_API_AVAILABLE(ios(WK_IOS_TBA)); 269 271 - (void)selectFormAccessoryPickerRow:(int)rowIndex WK_API_AVAILABLE(ios(WK_IOS_TBA)); 270 - (NSDictionary *)_contentsOfUserInterfaceItem:(NSString *)userInterfaceItem WK_API_AVAILABLE(ios(WK_IOS_TBA));271 272 272 273 - (void)didStartFormControlInteraction WK_API_AVAILABLE(ios(WK_IOS_TBA)); -
trunk/Source/WebKit2/UIProcess/Cocoa/WebPageProxyCocoa.mm
r202889 r208361 31 31 #import "LoadParameters.h" 32 32 #import "WebProcessProxy.h" 33 34 33 #import <WebCore/SearchPopupMenuCocoa.h> 34 #import <WebCore/ValidationBubble.h> 35 35 #import <wtf/cf/TypeCastsCF.h> 36 36 -
trunk/Source/WebKit2/UIProcess/PageClient.h
r206771 r208361 50 50 class Cursor; 51 51 class TextIndicator; 52 class ValidationBubble; 52 53 class WebMediaSessionManager; 53 54 enum class TextIndicatorWindowLifetime : uint8_t; … … 225 226 #if ENABLE(INPUT_TYPE_COLOR) 226 227 virtual RefPtr<WebColorPicker> createColorPicker(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&) = 0; 228 #endif 229 230 #if PLATFORM(COCOA) 231 virtual std::unique_ptr<WebCore::ValidationBubble> createValidationBubble(const String& message) = 0; 227 232 #endif 228 233 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r208340 r208361 124 124 #include <WebCore/TextIndicator.h> 125 125 #include <WebCore/URL.h> 126 #include <WebCore/ValidationBubble.h> 126 127 #include <WebCore/WindowFeatures.h> 127 128 #include <stdio.h> … … 1929 1930 return; 1930 1931 1932 hideValidationMessage(); 1933 1931 1934 if (!m_currentlyProcessedWheelEvents.isEmpty()) { 1932 1935 m_wheelEventQueue.append(event); … … 2466 2469 return; 2467 2470 2471 hideValidationMessage(); 2472 2468 2473 m_pageZoomFactor = zoomFactor; 2469 2474 m_process->send(Messages::WebPage::SetPageZoomFactor(m_pageZoomFactor), m_pageID); … … 2477 2482 if (m_pageZoomFactor == pageZoomFactor && m_textZoomFactor == textZoomFactor) 2478 2483 return; 2484 2485 hideValidationMessage(); 2479 2486 2480 2487 m_pageZoomFactor = pageZoomFactor; … … 4104 4111 { 4105 4112 m_uiClient->pageDidScroll(this); 4113 4114 #if PLATFORM(IOS) 4115 // Do not hide the validation message if the scrolling was caused by the keyboard showing up. 4116 if (m_isKeyboardAnimatingIn) 4117 return; 4118 #endif 4119 hideValidationMessage(); 4106 4120 } 4107 4121 … … 5307 5321 #endif 5308 5322 m_drawingArea = nullptr; 5323 hideValidationMessage(); 5309 5324 5310 5325 if (m_inspector) { … … 5379 5394 m_layerTreeTransactionIdAtLastTouchStart = 0; 5380 5395 m_hasNetworkRequestsOnSuspended = false; 5396 m_isKeyboardAnimatingIn = false; 5397 m_isScrollingOrZooming = false; 5381 5398 #endif 5382 5399 … … 6640 6657 m_process->send(Messages::WebPage::SetUserInterfaceLayoutDirection(static_cast<uint32_t>(userInterfaceLayoutDirection)), m_pageID); 6641 6658 } 6659 6660 void WebPageProxy::hideValidationMessage() 6661 { 6662 #if PLATFORM(COCOA) 6663 m_validationBubble = nullptr; 6664 #endif 6665 } 6642 6666 6643 6667 #if ENABLE(POINTER_LOCK) -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r208340 r208361 154 154 class SharedBuffer; 155 155 class TextIndicator; 156 class ValidationBubble; 156 157 enum class HasInsecureContent; 157 158 struct DictionaryPopupInfo; … … 528 529 void handleTwoFingerTapAtPoint(const WebCore::IntPoint&, uint64_t requestID); 529 530 void setForceAlwaysUserScalable(bool); 531 void setIsScrollingOrZooming(bool); 530 532 #endif 531 533 #if ENABLE(DATA_DETECTION) … … 1093 1095 void logSampledDiagnosticMessageWithResult(const String& message, const String& description, uint32_t result); 1094 1096 void logSampledDiagnosticMessageWithValue(const String& message, const String& description, const String& value); 1097 1098 // Form validation messages. 1099 void showValidationMessage(const WebCore::IntRect& anchorClientRect, const String& message); 1100 void hideValidationMessage(); 1101 #if PLATFORM(COCOA) 1102 WebCore::ValidationBubble* validationBubble() const { return m_validationBubble.get(); } // For testing. 1103 #endif 1104 1105 #if PLATFORM(IOS) 1106 void setIsKeyboardAnimatingIn(bool isKeyboardAnimatingIn) { m_isKeyboardAnimatingIn = isKeyboardAnimatingIn; } 1107 #endif 1095 1108 1096 1109 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS) … … 1627 1640 uint64_t m_currentDynamicViewportSizeUpdateID { 0 }; 1628 1641 bool m_hasNetworkRequestsOnSuspended; 1642 bool m_isKeyboardAnimatingIn { false }; 1643 bool m_isScrollingOrZooming { false }; 1629 1644 #endif 1630 1645 … … 1778 1793 RefPtr<WebColorPicker> m_colorPicker; 1779 1794 #endif 1795 #if PLATFORM(COCOA) 1796 std::unique_ptr<WebCore::ValidationBubble> m_validationBubble; 1797 #endif 1780 1798 1781 1799 const uint64_t m_pageID; -
trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in
r208225 r208361 65 65 RootViewToScreen(WebCore::IntRect rect) -> (WebCore::IntRect screenFrame) 66 66 67 #if PLATFORM(COCOA) 68 ShowValidationMessage(WebCore::IntRect anchorRect, String message) 69 HideValidationMessage() 70 #endif 71 67 72 #if PLATFORM(IOS) 68 73 AccessibilityScreenToRootView(WebCore::IntPoint screenPoint) -> (WebCore::IntPoint windowPoint) -
trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h
r204013 r208361 97 97 std::unique_ptr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy&, const ContextMenuContextData&, const UserData&) override; 98 98 #endif 99 std::unique_ptr<WebCore::ValidationBubble> createValidationBubble(const String& message) final; 100 99 101 void setTextIndicator(Ref<WebCore::TextIndicator>, WebCore::TextIndicatorWindowLifetime) override; 100 102 void clearTextIndicator(WebCore::TextIndicatorWindowDismissalAnimation) override; -
trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm
r206413 r208361 52 52 #import <WebCore/SharedBuffer.h> 53 53 #import <WebCore/TextIndicator.h> 54 #import <WebCore/ValidationBubble.h> 54 55 55 56 #define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, m_webView->_page->process().connection()) … … 744 745 } 745 746 747 std::unique_ptr<ValidationBubble> PageClientImpl::createValidationBubble(const String& message) 748 { 749 return std::make_unique<ValidationBubble>(m_contentView, message); 750 } 751 746 752 } // namespace WebKit 747 753 -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
r207478 r208361 1592 1592 [_webSelectionAssistant willStartScrollingOrZoomingPage]; 1593 1593 [_textSelectionAssistant willStartScrollingOverflow]; 1594 _page->setIsScrollingOrZooming(true); 1594 1595 } 1595 1596 1596 1597 - (void)scrollViewWillStartPanOrPinchGesture 1597 1598 { 1599 _page->hideValidationMessage(); 1600 1598 1601 _canSendTouchEventsAsynchronously = YES; 1599 1602 } … … 1603 1606 [_webSelectionAssistant didEndScrollingOrZoomingPage]; 1604 1607 [_textSelectionAssistant didEndScrollingOverflow]; 1608 _page->setIsScrollingOrZooming(false); 1605 1609 } 1606 1610 -
trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm
r208340 r208361 51 51 #import <WebCore/SharedBuffer.h> 52 52 #import <WebCore/UserAgent.h> 53 #import <WebCore/ValidationBubble.h> 53 54 54 55 #if USE(QUICK_LOOK) … … 267 268 if (!isValid()) 268 269 return; 270 271 hideValidationMessage(); 269 272 270 273 m_dynamicViewportSizeUpdateWaitingForTarget = true; … … 753 756 void WebPageProxy::potentialTapAtPosition(const WebCore::FloatPoint& position, uint64_t& requestID) 754 757 { 758 hideValidationMessage(); 755 759 process().send(Messages::WebPage::PotentialTapAtPosition(requestID, position), m_pageID); 756 760 } … … 1008 1012 // even during composition to support phrase boundary gesture. 1009 1013 m_pageClient.selectionDidChange(); 1014 } 1015 1016 void WebPageProxy::showValidationMessage(const IntRect& anchorClientRect, const String& message) 1017 { 1018 m_validationBubble = m_pageClient.createValidationBubble(message); 1019 m_validationBubble->setAnchorRect(anchorClientRect, uiClient().presentingViewController()); 1020 1021 // If we are currently doing a scrolling / zoom animation, then we'll delay showing the validation 1022 // bubble until the animation is over. 1023 if (!m_isScrollingOrZooming) 1024 m_validationBubble->show(); 1025 } 1026 1027 void WebPageProxy::setIsScrollingOrZooming(bool isScrollingOrZooming) 1028 { 1029 m_isScrollingOrZooming = isScrollingOrZooming; 1030 1031 // We finished doing the scrolling / zoom animation so we can now show the validation 1032 // bubble if we're supposed to. 1033 if (!m_isScrollingOrZooming && m_validationBubble) 1034 m_validationBubble->show(); 1010 1035 } 1011 1036 -
trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h
r206771 r208361 132 132 #endif 133 133 134 std::unique_ptr<WebCore::ValidationBubble> createValidationBubble(const String& message) final; 135 134 136 void setTextIndicator(Ref<WebCore::TextIndicator>, WebCore::TextIndicatorWindowLifetime) override; 135 137 void clearTextIndicator(WebCore::TextIndicatorWindowDismissalAnimation) override; -
trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm
r206771 r208361 68 68 #import <WebCore/TextIndicatorWindow.h> 69 69 #import <WebCore/TextUndoInsertionMarkupMac.h> 70 #import <WebCore/ValidationBubble.h> 70 71 #import <WebKitSystemInterface.h> 71 72 #import <wtf/text/CString.h> … … 440 441 #endif 441 442 443 std::unique_ptr<ValidationBubble> PageClientImpl::createValidationBubble(const String& message) 444 { 445 return std::make_unique<ValidationBubble>(m_view, message); 446 } 447 442 448 void PageClientImpl::setTextIndicator(Ref<TextIndicator> textIndicator, WebCore::TextIndicatorWindowLifetime lifetime) 443 449 { -
trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
r204466 r208361 55 55 #import <WebCore/TextAlternativeWithRange.h> 56 56 #import <WebCore/UserAgent.h> 57 #import <WebCore/ValidationBubble.h> 57 58 #import <mach-o/dyld.h> 58 59 #import <wtf/text/StringConcatenate.h> … … 595 596 } 596 597 598 void WebPageProxy::showValidationMessage(const IntRect& anchorClientRect, const String& message) 599 { 600 m_validationBubble = m_pageClient.createValidationBubble(message); 601 m_validationBubble->showRelativeTo(anchorClientRect); 602 } 603 597 604 #if WK_API_ENABLED 598 605 NSView *WebPageProxy::inspectorAttachmentView() -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r208344 r208361 1217 1217 83BFAC431D96137C00433490 /* BlobDownloadClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83BFAC411D96136000433490 /* BlobDownloadClient.cpp */; }; 1218 1218 83D454D71BE9D3C4006C93BD /* NetworkLoadClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D454D61BE9D3C4006C93BD /* NetworkLoadClient.h */; }; 1219 83EE575B1DB7D61100C74C50 /* WebValidationMessageClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83EE57591DB7D60600C74C50 /* WebValidationMessageClient.cpp */; }; 1220 83EE575C1DB7D61100C74C50 /* WebValidationMessageClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 83EE575A1DB7D60600C74C50 /* WebValidationMessageClient.h */; }; 1219 1221 84477853176FCC0800CDC7BB /* InjectedBundleHitTestResultMediaType.h in Headers */ = {isa = PBXBuildFile; fileRef = 84477851176FCAC100CDC7BB /* InjectedBundleHitTestResultMediaType.h */; }; 1220 1222 868160D0187645570021E79D /* WindowServerConnection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 868160CF187645370021E79D /* WindowServerConnection.mm */; }; … … 3322 3324 83BFAC411D96136000433490 /* BlobDownloadClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BlobDownloadClient.cpp; path = NetworkProcess/Downloads/BlobDownloadClient.cpp; sourceTree = "<group>"; }; 3323 3325 83D454D61BE9D3C4006C93BD /* NetworkLoadClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkLoadClient.h; path = NetworkProcess/NetworkLoadClient.h; sourceTree = "<group>"; }; 3326 83EE57591DB7D60600C74C50 /* WebValidationMessageClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebValidationMessageClient.cpp; sourceTree = "<group>"; }; 3327 83EE575A1DB7D60600C74C50 /* WebValidationMessageClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebValidationMessageClient.h; sourceTree = "<group>"; }; 3324 3328 84477851176FCAC100CDC7BB /* InjectedBundleHitTestResultMediaType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleHitTestResultMediaType.h; sourceTree = "<group>"; }; 3325 3329 868160CD18763D4B0021E79D /* WindowServerConnection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WindowServerConnection.h; sourceTree = "<group>"; }; … … 6036 6040 4A410F4819AF7B80002EBAB5 /* WebUserMediaClient.cpp */, 6037 6041 4A410F4919AF7B80002EBAB5 /* WebUserMediaClient.h */, 6042 83EE57591DB7D60600C74C50 /* WebValidationMessageClient.cpp */, 6043 83EE575A1DB7D60600C74C50 /* WebValidationMessageClient.h */, 6038 6044 ); 6039 6045 path = WebCoreSupport; … … 7809 7815 1A6FB7D311E651E200DB1371 /* Plugin.h in Headers */, 7810 7816 31A67E0D165B2A99006CBA66 /* PlugInAutoStartProvider.h in Headers */, 7817 83EE575C1DB7D61100C74C50 /* WebValidationMessageClient.h in Headers */, 7811 7818 1A9FBA8D13FF04E600DEED67 /* PluginComplexTextInputState.h in Headers */, 7812 7819 1AA56F2911E92BC80061B882 /* PluginController.h in Headers */, … … 9731 9738 0F174AA7142AAC610039250F /* WKGeometry.cpp in Sources */, 9732 9739 B62E7310143047A60069EC35 /* WKHitTestResult.cpp in Sources */, 9740 83EE575B1DB7D61100C74C50 /* WebValidationMessageClient.cpp in Sources */, 9733 9741 5110AE0C133C16CB0072717A /* WKIconDatabase.cpp in Sources */, 9734 9742 5123CF1B133D260A0056F800 /* WKIconDatabaseCG.cpp in Sources */, -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.cpp
r208360 r208361 1 1 /* 2 * Copyright (C) 201 5Apple Inc. All rights reserved.2 * Copyright (C) 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #i mport"config.h"27 #i mport "UIScriptController.h"26 #include "config.h" 27 #include "WebValidationMessageClient.h" 28 28 29 #i mport "DumpRenderTree.h"30 #i mport "UIScriptContext.h"31 #i mport <WebKit/WebKit.h>32 #i mport <WebKit/WebViewPrivate.h>29 #include "WebPage.h" 30 #include "WebPageProxyMessages.h" 31 #include <WebCore/Element.h> 32 #include <WebCore/Frame.h> 33 33 34 #if PLATFORM(MAC) 34 namespace WebKit { 35 35 36 namespace WTR { 36 using namespace WebCore; 37 37 38 void UIScriptController::doAsyncTask(JSValueRef callback) 39 { 40 unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent); 41 42 dispatch_async(dispatch_get_main_queue(), ^{ 43 if (!m_context) 44 return; 45 m_context->asyncTaskComplete(callbackID); 46 }); 47 } 48 49 void UIScriptController::insertText(JSStringRef, int, int) 38 WebValidationMessageClient::WebValidationMessageClient(WebPage& page) 39 : m_page(page) 50 40 { 51 41 } 52 42 53 void UIScriptController::zoomToScale(double scale, JSValueRef callback)43 WebValidationMessageClient::~WebValidationMessageClient() 54 44 { 55 unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent); 56 57 WebView *webView = [mainFrame webView]; 58 [webView _scaleWebView:scale atOrigin:NSZeroPoint]; 59 60 dispatch_async(dispatch_get_main_queue(), ^ { 61 if (!m_context) 62 return; 63 m_context->asyncTaskComplete(callbackID); 64 }); 45 if (m_currentAnchor) 46 hideValidationMessage(*m_currentAnchor); 65 47 } 66 48 49 void WebValidationMessageClient::showValidationMessage(const Element& anchor, const String& message) 50 { 51 if (m_currentAnchor) 52 hideValidationMessage(*m_currentAnchor); 53 54 m_currentAnchor = &anchor; 55 m_page.send(Messages::WebPageProxy::ShowValidationMessage(anchor.clientRect(), message)); 67 56 } 68 57 69 #endif // PLATFORM(MAC) 58 void WebValidationMessageClient::hideValidationMessage(const Element& anchor) 59 { 60 if (!isValidationMessageVisible(anchor)) 61 return; 62 63 m_currentAnchor = nullptr; 64 m_page.send(Messages::WebPageProxy::HideValidationMessage()); 65 } 66 67 bool WebValidationMessageClient::isValidationMessageVisible(const Element& anchor) 68 { 69 return m_currentAnchor == &anchor; 70 } 71 72 } // namespace WebKit -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.h
r208360 r208361 1 1 /* 2 * Copyright (C) 201 5Apple Inc. All rights reserved.2 * Copyright (C) 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #import "config.h" 27 #import "UIScriptController.h" 26 #pragma once 28 27 29 #import "DumpRenderTree.h" 30 #import "UIScriptContext.h" 31 #import <WebKit/WebKit.h> 32 #import <WebKit/WebViewPrivate.h> 28 #include <WebCore/IntRect.h> 29 #include <WebCore/ValidationMessageClient.h> 33 30 34 #if PLATFORM(MAC) 31 namespace WebKit { 35 32 36 namespace WTR { 33 class WebPage; 37 34 38 void UIScriptController::doAsyncTask(JSValueRef callback) 39 { 40 unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent); 35 class WebValidationMessageClient final : public WebCore::ValidationMessageClient { 36 public: 37 explicit WebValidationMessageClient(WebPage&); 38 ~WebValidationMessageClient(); 41 39 42 dispatch_async(dispatch_get_main_queue(), ^{ 43 if (!m_context) 44 return; 45 m_context->asyncTaskComplete(callbackID); 46 }); 47 } 40 // ValidationMessageClient API. 41 void showValidationMessage(const WebCore::Element& anchor, const String& message) final; 42 void hideValidationMessage(const WebCore::Element& anchor) final; 43 bool isValidationMessageVisible(const WebCore::Element& anchor) final; 48 44 49 void UIScriptController::insertText(JSStringRef, int, int) 50 { 51 } 52 53 void UIScriptController::zoomToScale(double scale, JSValueRef callback) 54 { 55 unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent); 56 57 WebView *webView = [mainFrame webView]; 58 [webView _scaleWebView:scale atOrigin:NSZeroPoint]; 59 60 dispatch_async(dispatch_get_main_queue(), ^ { 61 if (!m_context) 62 return; 63 m_context->asyncTaskComplete(callbackID); 64 }); 65 } 45 private: 46 WebPage& m_page; 47 const WebCore::Element* m_currentAnchor { nullptr }; 48 }; 66 49 67 50 } 68 69 #endif // PLATFORM(MAC) -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r208340 r208361 113 113 #include "WebUserContentController.h" 114 114 #include "WebUserMediaClient.h" 115 #include "WebValidationMessageClient.h" 115 116 #include <JavaScriptCore/APICast.h> 116 117 #include <WebCore/ApplicationCacheStorage.h> … … 410 411 pageConfiguration.diagnosticLoggingClient = std::make_unique<WebDiagnosticLoggingClient>(*this); 411 412 413 #if PLATFORM(COCOA) 414 pageConfiguration.validationMessageClient = std::make_unique<WebValidationMessageClient>(*this); 415 #endif 416 412 417 pageConfiguration.applicationCacheStorage = &WebProcess::singleton().applicationCacheStorage(); 413 418 pageConfiguration.databaseProvider = WebDatabaseProvider::getOrCreate(m_pageGroup->pageGroupID()); -
trunk/Tools/ChangeLog
r208357 r208361 1 2016-11-03 Chris Dumez <cdumez@apple.com> 2 3 [WK2][Cocoa] Implement user interface for HTML form validation 4 https://bugs.webkit.org/show_bug.cgi?id=164143 5 <rdar://problem/28944652> 6 7 Reviewed by Simon Fraser. 8 9 Add support for UIScriptController::contentsOfUserInterfaceItem("validationBubble") 10 on both Mac and iOS to retrieve the currently displayed validation message. 11 12 * DumpRenderTree/mac/UIScriptControllerMac.mm: 13 (WTR::UIScriptController::contentsOfUserInterfaceItem): 14 * TestRunnerShared/UIScriptContext/UIScriptController.cpp: 15 (WTR::UIScriptController::contentsOfUserInterfaceItem): 16 (WTR::UIScriptController::selectFormAccessoryPickerRow): 17 * WebKitTestRunner/mac/UIScriptControllerMac.mm: 18 (WTR::UIScriptController::contentsOfUserInterfaceItem): 19 1 20 2016-11-03 Konstantin Tokarev <annulen@yandex.ru> 2 21 -
trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm
r208207 r208361 65 65 } 66 66 67 JSObjectRef UIScriptController::contentsOfUserInterfaceItem(JSStringRef interfaceItem) const 68 { 69 return nullptr; 70 } 71 67 72 } 68 73 -
trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp
r208207 r208361 162 162 { 163 163 } 164 165 JSObjectRef UIScriptController::contentsOfUserInterfaceItem(JSStringRef interfaceItem) const 166 { 167 return nullptr; 168 } 164 169 #endif 165 170 … … 236 241 { 237 242 } 238 239 JSObjectRef UIScriptController::contentsOfUserInterfaceItem(JSStringRef interfaceItem) const240 {241 return nullptr;242 }243 243 244 244 void UIScriptController::scrollToOffset(long x, long y) -
trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm
r208207 r208361 28 28 29 29 #import "PlatformWebView.h" 30 #import "StringFunctions.h" 30 31 #import "TestController.h" 31 32 #import "TestRunnerWKWebView.h" 32 33 #import "UIScriptContext.h" 34 #import <JavaScriptCore/JSContext.h> 33 35 #import <JavaScriptCore/JSStringRefCF.h> 36 #import <JavaScriptCore/JSValue.h> 37 #import <JavaScriptCore/JavaScriptCore.h> 38 #import <JavaScriptCore/OpaqueJSString.h> 34 39 #import <WebKit/WKWebViewPrivate.h> 35 40 … … 86 91 } 87 92 93 JSObjectRef UIScriptController::contentsOfUserInterfaceItem(JSStringRef interfaceItem) const 94 { 95 #if WK_API_ENABLED 96 TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView(); 97 NSDictionary *contentDictionary = [webView _contentsOfUserInterfaceItem:toWTFString(toWK(interfaceItem))]; 98 return JSValueToObject(m_context->jsContext(), [JSValue valueWithObject:contentDictionary inContext:[JSContext contextWithJSGlobalContextRef:m_context->jsContext()]].JSValueRef, nullptr); 99 #else 100 UNUSED_PARAM(interfaceItem); 101 return nullptr; 102 #endif 103 } 104 88 105 } // namespace WTR
Note: See TracChangeset
for help on using the changeset viewer.