Changeset 202129 in webkit
- Timestamp:
- Jun 16, 2016, 10:54:33 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r202120 r202129 1 2016-06-15 Sam Weinig <sam@webkit.org> 2 3 Forward/Back keyboard shortcuts need to flip for RTL 4 https://bugs.webkit.org/show_bug.cgi?id=158823 5 <rdar://problem/25975359> 6 7 Reviewed by Darin Adler. 8 9 Pipe the UserInterfaceLayoutDirection down to the WebContentProcess on initialization 10 and when it changes, and use it to flip the behavior of command-left and command-right 11 when in RTL mode. 12 13 Tests: 14 WebKit2_CommandBackForwardTestWKView.LTR 15 WebKit2_CommandBackForwardTestWKView.RTL 16 WebKit2_CommandBackForwardTestWKWebView.LTR 17 WebKit2_CommandBackForwardTestWKWebView.RTL 18 19 * Shared/WebPageCreationParameters.cpp: 20 (WebKit::WebPageCreationParameters::encode): 21 (WebKit::WebPageCreationParameters::decode): 22 * Shared/WebPageCreationParameters.h: 23 * UIProcess/API/Cocoa/WKWebView.mm: 24 (-[WKWebView _webViewPrintFormatter]): 25 (-[WKWebView setSemanticContentAttribute:]): 26 (-[WKWebView _printOperationWithPrintInfo:forFrame:]): 27 (-[WKWebView setUserInterfaceLayoutDirection:]): 28 * UIProcess/API/mac/WKView.mm: 29 (-[WKView setUserInterfaceLayoutDirection:]): 30 * UIProcess/Cocoa/WebViewImpl.h: 31 * UIProcess/Cocoa/WebViewImpl.mm: 32 (WebKit::WebViewImpl::windowIsFrontWindowUnderMouse): 33 (WebKit::toUserInterfaceLayoutDirection): 34 (WebKit::WebViewImpl::userInterfaceLayoutDirection): 35 (WebKit::WebViewImpl::setUserInterfaceLayoutDirection): 36 * UIProcess/WebPageProxy.cpp: 37 (WebKit::WebPageProxy::creationParameters): 38 (WebKit::WebPageProxy::userInterfaceLayoutDirection): 39 (WebKit::WebPageProxy::setUserInterfaceLayoutDirection): 40 * UIProcess/WebPageProxy.h: 41 (WebKit::WebPageProxy::hasHadSelectionChangesFromUserInteraction): 42 * UIProcess/ios/WKContentView.mm: 43 (-[WKContentView _commonInitializationWithProcessPool:configuration:]): 44 * WebProcess/WebPage/WebPage.cpp: 45 (WebKit::m_userInterfaceLayoutDirection): 46 (WebKit::WebPage::setResourceCachingDisabled): 47 (WebKit::WebPage::setUserInterfaceLayoutDirection): 48 (WebKit::m_shouldDispatchFakeMouseMoveEvents): Deleted. 49 * WebProcess/WebPage/WebPage.h: 50 * WebProcess/WebPage/WebPage.messages.in: 51 * WebProcess/WebPage/mac/WebPageMac.mm: 52 (WebKit::WebPage::performNonEditingBehaviorForSelector): 53 1 54 2016-06-15 Tim Horton <timothy_horton@apple.com> 2 55 -
trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp
r198901 r202129 87 87 encoder << appleMailPaginationQuirkEnabled; 88 88 encoder << shouldScaleViewToFitDocument; 89 encoder.encodeEnum(userInterfaceLayoutDirection); 89 90 } 90 91 … … 195 196 return false; 196 197 198 if (!decoder.decodeEnum(parameters.userInterfaceLayoutDirection)) 199 return false; 200 197 201 return true; 198 202 } -
trunk/Source/WebKit2/Shared/WebPageCreationParameters.h
r198901 r202129 30 30 #include "LayerTreeContext.h" 31 31 #include "SessionState.h" 32 #include "UserInterfaceLayoutDirection.h" 32 33 #include "WebCoreArgumentCoders.h" 33 34 #include "WebPageGroupData.h" … … 134 135 bool appleMailPaginationQuirkEnabled; 135 136 bool shouldScaleViewToFitDocument; 137 138 UserInterfaceLayoutDirection userInterfaceLayoutDirection; 136 139 }; 137 140 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r202120 r202129 4299 4299 } 4300 4300 4301 static WebKit::UserInterfaceLayoutDirection toUserInterfaceLayoutDirection(UISemanticContentAttribute contentAttribute) 4302 { 4303 auto direction = [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:contentAttribute]; 4304 switch (direction) { 4305 case UIUserInterfaceLayoutDirectionLeftToRight: 4306 return WebKit::UserInterfaceLayoutDirection::LTR; 4307 case UIUserInterfaceLayoutDirectionRightToLeft: 4308 return WebKit::UserInterfaceLayoutDirection::RTL; 4309 } 4310 4311 ASSERT_NOT_REACHED(); 4312 return WebKit::UserInterfaceLayoutDirection::LTR; 4313 } 4314 4315 - (void)setSemanticContentAttribute:(UISemanticContentAttribute)contentAttribute 4316 { 4317 [super setSemanticContentAttribute:contentAttribute]; 4318 4319 _page->setUserInterfaceLayoutDirection(toUserInterfaceLayoutDirection(contentAttribute)); 4320 } 4321 4301 4322 #else // #if PLATFORM(IOS) 4302 4323 … … 4423 4444 return _impl->printOperationWithPrintInfo(printInfo, *webFrameProxy); 4424 4445 return nil; 4446 } 4447 4448 - (void)setUserInterfaceLayoutDirection:(NSUserInterfaceLayoutDirection)userInterfaceLayoutDirection 4449 { 4450 [super setUserInterfaceLayoutDirection:userInterfaceLayoutDirection]; 4451 4452 _impl->setUserInterfaceLayoutDirection(userInterfaceLayoutDirection); 4425 4453 } 4426 4454 -
trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm
r201298 r202129 1436 1436 } 1437 1437 1438 - (void)setUserInterfaceLayoutDirection:(NSUserInterfaceLayoutDirection)userInterfaceLayoutDirection 1439 { 1440 [super setUserInterfaceLayoutDirection:userInterfaceLayoutDirection]; 1441 1442 _data->_impl->setUserInterfaceLayoutDirection(userInterfaceLayoutDirection); 1443 } 1444 1438 1445 @end 1439 1446 -
trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h
r201838 r202129 30 30 31 31 #include "PluginComplexTextInputState.h" 32 #include "UserInterfaceLayoutDirection.h" 32 33 #include "WKLayoutMode.h" 33 34 #include "WebPageProxy.h" … … 486 487 bool requiresUserActionForEditingControlsManager() const { return m_requiresUserActionForEditingControlsManager; } 487 488 489 UserInterfaceLayoutDirection userInterfaceLayoutDirection(); 490 void setUserInterfaceLayoutDirection(NSUserInterfaceLayoutDirection); 491 488 492 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 489 493 void handleAcceptedCandidate(NSTextCheckingResult *acceptedCandidate); -
trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm
r201441 r202129 4030 4030 } 4031 4031 4032 4032 static UserInterfaceLayoutDirection toUserInterfaceLayoutDirection(NSUserInterfaceLayoutDirection direction) 4033 { 4034 switch (direction) { 4035 case NSUserInterfaceLayoutDirectionLeftToRight: 4036 return UserInterfaceLayoutDirection::LTR; 4037 case NSUserInterfaceLayoutDirectionRightToLeft: 4038 return UserInterfaceLayoutDirection::RTL; 4039 } 4040 4041 ASSERT_NOT_REACHED(); 4042 return UserInterfaceLayoutDirection::LTR; 4043 } 4044 4045 UserInterfaceLayoutDirection WebViewImpl::userInterfaceLayoutDirection() 4046 { 4047 return toUserInterfaceLayoutDirection(m_view.userInterfaceLayoutDirection); 4048 } 4049 4050 void WebViewImpl::setUserInterfaceLayoutDirection(NSUserInterfaceLayoutDirection direction) 4051 { 4052 m_page->setUserInterfaceLayoutDirection(toUserInterfaceLayoutDirection(direction)); 4053 } 4054 4033 4055 } // namespace WebKit 4034 4056 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r201958 r202129 5275 5275 #endif 5276 5276 parameters.shouldScaleViewToFitDocument = m_shouldScaleViewToFitDocument; 5277 parameters.userInterfaceLayoutDirection = m_pageClient.userInterfaceLayoutDirection(); 5277 5278 5278 5279 return parameters; … … 6312 6313 } 6313 6314 6315 void WebPageProxy::setUserInterfaceLayoutDirection(UserInterfaceLayoutDirection userInterfaceLayoutDirection) 6316 { 6317 if (!isValid()) 6318 return; 6319 6320 m_process->send(Messages::WebPage::SetUserInterfaceLayoutDirection(static_cast<uint32_t>(userInterfaceLayoutDirection)), m_pageID); 6321 } 6322 6314 6323 } // namespace WebKit -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r201958 r202129 1113 1113 1114 1114 UserInterfaceLayoutDirection userInterfaceLayoutDirection(); 1115 void setUserInterfaceLayoutDirection(UserInterfaceLayoutDirection); 1115 1116 1116 1117 bool hasHadSelectionChangesFromUserInteraction() const { return m_hasHadSelectionChangesFromUserInteraction; } -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r202105 r202129 378 378 , m_mainFrameProgressCompleted(false) 379 379 , m_shouldDispatchFakeMouseMoveEvents(true) 380 , m_userInterfaceLayoutDirection(parameters.userInterfaceLayoutDirection) 380 381 { 381 382 ASSERT(m_pageID); … … 5369 5370 } 5370 5371 5372 void WebPage::setUserInterfaceLayoutDirection(uint32_t direction) 5373 { 5374 m_userInterfaceLayoutDirection = static_cast<UserInterfaceLayoutDirection>(direction); 5375 } 5376 5371 5377 } // namespace WebKit -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r201888 r202129 24 24 */ 25 25 26 #ifndef WebPage_h 27 #define WebPage_h 26 #pragma once 28 27 29 28 #include "APIInjectedBundleFormClient.h" … … 49 48 #include "ShareableBitmap.h" 50 49 #include "UserData.h" 50 #include "UserInterfaceLayoutDirection.h" 51 51 #include "UserMediaPermissionRequestManager.h" 52 52 #include <WebCore/DictationAlternative.h> … … 1200 1200 1201 1201 void setResourceCachingDisabled(bool); 1202 void setUserInterfaceLayoutDirection(uint32_t); 1202 1203 1203 1204 uint64_t m_pageID; … … 1469 1470 std::chrono::system_clock::time_point m_loadCommitTime; 1470 1471 #endif 1472 1473 UserInterfaceLayoutDirection m_userInterfaceLayoutDirection { UserInterfaceLayoutDirection::LTR }; 1471 1474 }; 1472 1475 1473 1476 } // namespace WebKit 1474 1477 1475 #endif // WebPage_h -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
r201888 r202129 429 429 430 430 SetResourceCachingDisabled(bool disabled) 431 432 SetUserInterfaceLayoutDirection(uint32_t direction) 431 433 } -
trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
r200957 r202129 552 552 didPerformAction = scroll(m_page.get(), ScrollLeft, ScrollByPage); 553 553 else if (selector == "moveToLeftEndOfLine:") 554 didPerformAction = m_ page->backForward().goBack();554 didPerformAction = m_userInterfaceLayoutDirection == UserInterfaceLayoutDirection::LTR ? m_page->backForward().goBack() : m_page->backForward().goForward(); 555 555 else if (selector == "moveRight:") 556 556 didPerformAction = scroll(m_page.get(), ScrollRight, ScrollByLine); … … 558 558 didPerformAction = scroll(m_page.get(), ScrollRight, ScrollByPage); 559 559 else if (selector == "moveToRightEndOfLine:") 560 didPerformAction = m_ page->backForward().goForward();560 didPerformAction = m_userInterfaceLayoutDirection == UserInterfaceLayoutDirection::LTR ? m_page->backForward().goForward() : m_page->backForward().goBack(); 561 561 562 562 return didPerformAction; -
trunk/Tools/ChangeLog
r202120 r202129 1 2016-06-15 Sam Weinig <sam@webkit.org> 2 3 Forward/Back keyboard shortcuts need to flip for RTL 4 https://bugs.webkit.org/show_bug.cgi?id=158823 5 <rdar://problem/25975359> 6 7 Reviewed by Darin Adler. 8 9 Add tests for flipping the behavior of command-left and command-right 10 under RTL mode. 11 12 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 13 * TestWebKitAPI/Tests/WebKit2Cocoa/CommandBackForward.mm: Added. 14 (-[CommandBackForwardOffscreenWindow isKeyWindow]): 15 (-[CommandBackForwardOffscreenWindow isVisible]): 16 (simulateCommandArrow): 17 (WebKit2_CommandBackForwardTest::SetUp): 18 (WebKit2_CommandBackForwardTestWKView::didFinishLoadForFrame): 19 (WebKit2_CommandBackForwardTestWKView::SetUp): 20 (WebKit2_CommandBackForwardTestWKView::loadFiles): 21 (-[CommandBackForwardNavigationDelegate webView:didFinishNavigation:]): 22 (WebKit2_CommandBackForwardTestWKWebView::SetUp): 23 (WebKit2_CommandBackForwardTestWKWebView::loadFiles): 24 1 25 2016-06-15 Tim Horton <timothy_horton@apple.com> 2 26 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r201941 r202129 99 99 7AE9E5091AE5AE8B00CF874B /* test.pdf in Copy Resources */ = {isa = PBXBuildFile; fileRef = 7AE9E5081AE5AE8B00CF874B /* test.pdf */; }; 100 100 7C3965061CDD74F90094DBB8 /* Color.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3965051CDD74F90094DBB8 /* Color.cpp */; }; 101 7C3DB8E41D12129B00AE8CC3 /* CommandBackForward.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C3DB8E21D12129B00AE8CC3 /* CommandBackForward.mm */; }; 101 102 7C486BA11AA12567003F6F9B /* bundle-file.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 7C486BA01AA1254B003F6F9B /* bundle-file.html */; }; 102 103 7C54A4BE1AA11CCA00380F78 /* WKBundleFileHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C54A4BC1AA11CCA00380F78 /* WKBundleFileHandle.cpp */; }; … … 749 750 7AE9E5081AE5AE8B00CF874B /* test.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = test.pdf; sourceTree = "<group>"; }; 750 751 7C3965051CDD74F90094DBB8 /* Color.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Color.cpp; sourceTree = "<group>"; }; 752 7C3DB8E21D12129B00AE8CC3 /* CommandBackForward.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CommandBackForward.mm; sourceTree = "<group>"; }; 751 753 7C486BA01AA1254B003F6F9B /* bundle-file.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "bundle-file.html"; sourceTree = "<group>"; }; 752 754 7C54A4BC1AA11CCA00380F78 /* WKBundleFileHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleFileHandle.cpp; sourceTree = "<group>"; }; … … 1132 1134 1C2B817E1C891E4200A5529F /* CancelFontSubresource.mm */, 1133 1135 1C2B81811C891EFA00A5529F /* CancelFontSubresourcePlugIn.mm */, 1136 7C3DB8E21D12129B00AE8CC3 /* CommandBackForward.mm */, 1134 1137 A18AA8CC1C3FA218009B2B97 /* ContentFiltering.h */, 1135 1138 A14FC5861B8991B600D107EB /* ContentFiltering.mm */, … … 2146 2149 7CCE7F271A411AF600447C4C /* UserContentController.mm in Sources */, 2147 2150 7C83E04F1D0A641800FEBCF3 /* FileSystem.cpp in Sources */, 2151 7C3DB8E41D12129B00AE8CC3 /* CommandBackForward.mm in Sources */, 2148 2152 7CCE7F2D1A411B1000447C4C /* UserContentTest.mm in Sources */, 2149 2153 7CCE7F171A411AE600447C4C /* UserMedia.cpp in Sources */,
Note:
See TracChangeset
for help on using the changeset viewer.