haikuwebkit/LayoutTests/fast/scrolling/rtl-scrollbars-listbox-expe...

25 lines
750 B
HTML
Raw Permalink Normal View History

[OS X] [RTL Scrollbars] List boxes should obey RTL scrollbars https://bugs.webkit.org/show_bug.cgi?id=155991 Reviewed by Darin Adler. Source/WebCore: List boxes were created before RenderLayers, and therefore don't share the scollbar logic with them. Instead, they manage their own Scrollbars. The placement logic needs to be updated to take RTL scrollbars into account. Tests: fast/scrolling/rtl-scrollbars-listbox-scroll.html fast/scrolling/rtl-scrollbars-listbox-select-left.html fast/scrolling/rtl-scrollbars-listbox-select-right.html fast/scrolling/rtl-scrollbars-listbox-simple.html fast/scrolling/rtl-scrollbars-listbox.html * rendering/RenderBox.cpp: (WebCore::RenderBox::contentBoxRect): * rendering/RenderBox.h: (WebCore::RenderBox::contentBoxRect): Deleted. * rendering/RenderListBox.cpp: (WebCore::RenderListBox::itemBoundingBoxRect): (WebCore::RenderListBox::paintScrollbar): (WebCore::RenderListBox::paintItemBackground): (WebCore::RenderListBox::isPointInOverflowControl): (WebCore::RenderListBox::listIndexAtOffset): (WebCore::RenderListBox::nodeAtPoint): (WebCore::RenderListBox::controlClipRect): (WebCore::RenderListBox::invalidateScrollbarRect): (WebCore::RenderListBox::convertFromScrollbarToContainingView): (WebCore::RenderListBox::convertFromContainingViewToScrollbar): (WebCore::RenderListBox::scrolledToTop): (WebCore::RenderListBox::scrolledToBottom): LayoutTests: As with the previous patches, mark new tests as failing on all OSes that don't support RTL scrollbars. * TestExpectations: * fast/scrolling/rtl-scrollbars-listbox-expected.html: Added. * fast/scrolling/rtl-scrollbars-listbox-scroll-expected.html: Added. * fast/scrolling/rtl-scrollbars-listbox-scroll.html: Added. * fast/scrolling/rtl-scrollbars-listbox-select-left-expected.html: Added. * fast/scrolling/rtl-scrollbars-listbox-select-left.html: Added. * fast/scrolling/rtl-scrollbars-listbox-select-right-expected.html: Added. * fast/scrolling/rtl-scrollbars-listbox-select-right.html: Added. * fast/scrolling/rtl-scrollbars-listbox-simple-expected-mismatch.html: Added. * fast/scrolling/rtl-scrollbars-listbox-simple.html: Added. * fast/scrolling/rtl-scrollbars-listbox.html: Added. Canonical link: https://commits.webkit.org/174141@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@198843 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-30 17:34:20 +00:00
<!DOCTYPE html>
<html>
<head>
</head>
<body style="margin: 0px;">
<div style="position: absolute; left: 8px; top: 200px;">This test makes sure that list boxes obey RTL scrollbars.</div>
<div style="position: relative; width: 400px; height: 400px; overflow: hidden;">
<select multiple="multiple" style="margin: 0px; border: 0px solid black; padding: 0px; width: 400px; height: 100px; position: absolute; left: 11px; top: 0px;">
<option>January</option>
<option>February</option>
<option>March</option>
<option>April</option>
<option>May</option>
<option>June</option>
<option>July</option>
<option>August</option>
<option>September</option>
<option>October</option>
<option>November</option>
<option>December</option>
</select>
</div>
</body>
[WK2] [OS X] Create API for switching RTL scrollbar policy https://bugs.webkit.org/show_bug.cgi?id=156948 <rdar://problem/25707757> Reviewed by Darin Adler. Source/WebCore: There are two schools of thought for where to put scrollbars in RTL environments. The first is that we should obey the content's "dir" attribute, specified on each element. The second is that we should be consistent with the platform (AppKit's) behavior. There are some situations where the placement should be done according to the content. For example, this policy would be used in web browsers. However, there are also places where web content is designed to fit seamlessly amongst native content. In this situation, the placement of the scrollbars should be done according to the view. Because WebKit doesn't know which of these situations it is operating within, this patch adds a new API property, userInterfaceDirectionPolicy, to WKWebViewConfigurationPolicy. This allows clients to instruct us which policy to abide by. It is plumbed to the web process inside the WebPreferencesStore and is ultimately held inside the Page's Settings object. This Setting is consulted by RenderLayerModelObject, which serves as a good centralized place for this policy implementation. This is the class which decides if we should be consulting its RenderStyle or the platform itself when we decide where to put the scrollbars. Putting this decision inside the renderer is important because ScrollableArea often needs to know if scrollbars should be put on the left, but ScrollableArea doesn't know anything about RenderStyles. Therefore, the renderer must be the intermediary between ScrollableArea and the RenderStyle. (ScrollableArea also doesn't directly know anything about renderers either; however, each of the subclasses knows about an appropriate renderer.) Therefore, ScrollableArea gets a new virtual method which is implemented by the RenderLayerModelObject. Tests: fast/scrolling/rtl-scrollbars*.html * WebCore.xcodeproj/project.pbxproj: ScrollableAreaMac.mm is no longer necessary. * page/FrameView.cpp: (WebCore::FrameView::shouldPlaceBlockDirectionScrollbarOnLeft): Overridden ScrollableArea function. * page/FrameView.h: * page/Settings.h: * page/Settings.in: * platform/ScrollView.cpp: Adding two new settings: One to know if we should consult with the RenderStyle or the platform, and the other is whether or not the platform considers itself to be RTL. (WebCore::ScrollView::documentScrollPositionRelativeToViewOrigin): Update to use new mechanism. (WebCore::ScrollView::updateScrollbars): Ditto. (WebCore::ScrollView::scrollCornerRect): Ditto. (WebCore::ScrollView::locationOfContents): Ditto. * platform/ScrollableArea.cpp: (WebCore::ScrollableArea::verticalScrollbarIsOnLeft): Deleted. This was the old mechanism. (WebCore::ScrollableArea::systemLanguageIsRTL): Deleted. Ditto. * platform/ScrollableArea.h: * platform/mac/ScrollableAreaMac.mm: Removed. (WebCore::ScrollableArea::verticalScrollbarIsOnLeft): Deleted. (WebCore::ScrollableArea::systemLanguageIsRTL): Deleted. * platform/mac/ScrollbarThemeMac.mm: (WebCore::ScrollbarThemeMac::didCreateScrollerImp): Update to use new mechanism. * platform/text/WritingMode.h: These enums should match what's in WebKit2. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::logicalLeftOffsetForContent): Update to use new mechanism. (WebCore::RenderBlock::logicalRightOffsetForContent): Ditto. * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::determineLogicalLeftPositionForChild): Ditto. * rendering/RenderBox.cpp: Ditto. (WebCore::RenderBox::contentBoxRect): (WebCore::RenderBox::overflowClipRect): (WebCore::RenderBox::computePositionedLogicalWidth): (WebCore::RenderBox::layoutOverflowRectForPropagation): * rendering/RenderBoxModelObject.cpp: Ditto. (WebCore::RenderBoxModelObject::constrainingRectForStickyPosition): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::resize): Ditto. (WebCore::cornerStart): Migrate to use references. (WebCore::cornerRect): Ditto. (WebCore::RenderLayer::scrollCornerRect): Ditto. (WebCore::resizerCornerRect): Ditto. (WebCore::RenderLayer::scrollCornerAndResizerRect): Ditto. (WebCore::RenderLayer::verticalScrollbarStart): Update to use new mechanism. (WebCore::RenderLayer::horizontalScrollbarStart): Ditto. (WebCore::RenderLayer::offsetFromResizeCorner): Ditto. (WebCore::RenderLayer::positionOverflowControls): Migrate to use references. (WebCore::RenderLayer::computeScrollDimensions): Ditto. (WebCore::RenderLayer::overflowControlsIntersectRect): Ditto. (WebCore::RenderLayer::drawPlatformResizerImage): Update to use new mechanism. (WebCore::RenderLayer::paintResizer): Migrate to use references. (WebCore::RenderLayer::isPointInResizeControl): Ditto. (WebCore::RenderLayer::hitTestOverflowControls): Ditto. (WebCore::RenderLayer::hitTestResizerInFragments): Ditto. * rendering/RenderLayer.h: ScrollableArea override * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::positionForClipLayer): Update to use new mechanism. * rendering/RenderLayerModelObject.cpp: (WebCore::RenderLayerModelObject::shouldPlaceBlockDirectionScrollbarOnLeft): This is the meat of this patch. This is where we decide if we should be interrogating the RenderStyle or the underlying platform. * rendering/RenderLayerModelObject.h: * rendering/RenderListBox.cpp: Update to use new mechanism. (WebCore::RenderListBox::itemBoundingBoxRect): (WebCore::RenderListBox::paintScrollbar): (WebCore::RenderListBox::isPointInOverflowControl): (WebCore::RenderListBox::listIndexAtOffset): (WebCore::RenderListBox::controlClipRect): (WebCore::RenderListBox::invalidateScrollbarRect): (WebCore::RenderListBox::convertFromScrollbarToContainingView): (WebCore::RenderListBox::convertFromContainingViewToScrollbar): * rendering/RenderListBox.h: * rendering/RenderView.cpp: Ditto. (WebCore::RenderView::repaintViewRectangle): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::shouldPlaceBlockDirectionScrollbarOnLeft): This function is now much dumber. It just inspects its own style. * testing/InternalSettings.cpp: Allow mocking. (WebCore::InternalSettings::Backup::Backup): (WebCore::InternalSettings::Backup::restoreTo): (WebCore::InternalSettings::verticalScrollbarLocationPolicy): (WebCore::InternalSettings::setVerticalScrollbarLocationPolicy): (WebCore::InternalSettings::systemLayoutDirection): (WebCore::InternalSettings::setSystemLayoutDirection): * testing/InternalSettings.h: * testing/InternalSettings.idl: Source/WebKit2: Add the new API. * Shared/WebPreferencesDefinitions.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.h: * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration init]): (-[WKWebViewConfiguration encodeWithCoder:]): (-[WKWebViewConfiguration initWithCoder:]): (-[WKWebViewConfiguration copyWithZone:]): * UIProcess/WebPageProxy.cpp: * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): LayoutTests: Update tests to use new RTL scrollbar mechanism. * fast/scrolling/rtl-scrollbars-animation-property.html: * fast/scrolling/rtl-scrollbars-elementFromPoint-static.html: * fast/scrolling/rtl-scrollbars-elementFromPoint.html: * fast/scrolling/rtl-scrollbars-expected.html: * fast/scrolling/rtl-scrollbars-iframe-offset-expected.html: * fast/scrolling/rtl-scrollbars-iframe-offset.html: * fast/scrolling/rtl-scrollbars-iframe-position-absolute.html: * fast/scrolling/rtl-scrollbars-iframe-scrolled-expected.html: * fast/scrolling/rtl-scrollbars-iframe-scrolled.html: * fast/scrolling/rtl-scrollbars-iframe.html: * fast/scrolling/rtl-scrollbars-listbox-expected.html: * fast/scrolling/rtl-scrollbars-listbox-scroll-expected.html: * fast/scrolling/rtl-scrollbars-listbox-scroll.html: * fast/scrolling/rtl-scrollbars-listbox-select-left-expected.html: * fast/scrolling/rtl-scrollbars-listbox-select-left.html: * fast/scrolling/rtl-scrollbars-listbox-select-right-expected.html: * fast/scrolling/rtl-scrollbars-listbox-select-right.html: * fast/scrolling/rtl-scrollbars-listbox-simple-expected-mismatch.html: * fast/scrolling/rtl-scrollbars-listbox-simple.html: * fast/scrolling/rtl-scrollbars-listbox.html: * fast/scrolling/rtl-scrollbars-overflow-contents-expected.html: * fast/scrolling/rtl-scrollbars-overflow-contents.html: * fast/scrolling/rtl-scrollbars-overflow-dir-rtl-expected.html: * fast/scrolling/rtl-scrollbars-overflow-dir-rtl.html: * fast/scrolling/rtl-scrollbars-overflow-elementFromPoint.html: * fast/scrolling/rtl-scrollbars-overflow-expected.html: * fast/scrolling/rtl-scrollbars-overflow-padding-expected.html: * fast/scrolling/rtl-scrollbars-overflow-padding.html: * fast/scrolling/rtl-scrollbars-overflow-position-absolute-expected.html: * fast/scrolling/rtl-scrollbars-overflow-position-absolute.html: * fast/scrolling/rtl-scrollbars-overflow-simple-expected-mismatch.html: * fast/scrolling/rtl-scrollbars-overflow-simple.html: * fast/scrolling/rtl-scrollbars-overflow-text-selection-scrolled-expected.html: * fast/scrolling/rtl-scrollbars-overflow-text-selection-scrolled.html: * fast/scrolling/rtl-scrollbars-overflow.html: * fast/scrolling/rtl-scrollbars-overlay-no-push-contents-expected.html: * fast/scrolling/rtl-scrollbars-overlay-no-push-contents.html: * fast/scrolling/rtl-scrollbars-position-absolute-expected.html: * fast/scrolling/rtl-scrollbars-position-absolute.html: * fast/scrolling/rtl-scrollbars-position-fixed-expected.html: * fast/scrolling/rtl-scrollbars-position-fixed.html: * fast/scrolling/rtl-scrollbars-positioning-expected.html: * fast/scrolling/rtl-scrollbars-positioning.html: * fast/scrolling/rtl-scrollbars-simple-expected-mismatch.html: * fast/scrolling/rtl-scrollbars-simple.html: * fast/scrolling/rtl-scrollbars-sticky-document-2-expected.html: * fast/scrolling/rtl-scrollbars-sticky-document-2.html: * fast/scrolling/rtl-scrollbars-sticky-document-expected.html: * fast/scrolling/rtl-scrollbars-sticky-document.html: * fast/scrolling/rtl-scrollbars-sticky-iframe-2-expected.html: * fast/scrolling/rtl-scrollbars-sticky-iframe-2.html: * fast/scrolling/rtl-scrollbars-sticky-iframe-expected.html: * fast/scrolling/rtl-scrollbars-sticky-iframe.html: * fast/scrolling/rtl-scrollbars-sticky-overflow-scroll-2-expected.html: * fast/scrolling/rtl-scrollbars-sticky-overflow-scroll-2.html: * fast/scrolling/rtl-scrollbars-sticky-overflow-scroll-expected.html: * fast/scrolling/rtl-scrollbars-sticky-overflow-scroll.html: * fast/scrolling/rtl-scrollbars-text-selection-expected.html: * fast/scrolling/rtl-scrollbars-text-selection-scrolled-expected.html: * fast/scrolling/rtl-scrollbars-text-selection-scrolled.html: * fast/scrolling/rtl-scrollbars-text-selection.html: * fast/scrolling/rtl-scrollbars.html: * platform/mac/fast/scrolling/rtl-scrollbars-animation-property-expected.png: Added. Canonical link: https://commits.webkit.org/175171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200116 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-04-27 01:25:26 +00:00
</html>