haikuwebkit/Source/WebCore/dom/FocusOptions.idl

29 lines
1.4 KiB
Plaintext
Raw Permalink Normal View History

Enable ability to prevent scrolling in Element.focus() https://bugs.webkit.org/show_bug.cgi?id=178583 Patch by Rob Buis <rbuis@igalia.com> on 2021-03-22 Reviewed by Simon Fraser. LayoutTests/imported/w3c: Update improved test result. * web-platform-tests/html/interaction/focus/processing-model/preventScroll-nested-scroll-elements-expected.txt: Added. * web-platform-tests/html/interaction/focus/processing-model/preventScroll-nested-scroll-elements.html: Added. * web-platform-tests/html/interaction/focus/processing-model/preventScroll-textarea-expected.txt: Source/WebCore: Add FocusOptions parameter to the focus method [1] both to the IDL as the C++ side. Change Element.focus to not scroll if FocusOptions.preventScroll is true. Behavior matches Chrome and Firefox. Tests: imported/w3c/web-platform-tests/html/interaction/focus/processing-model/preventScroll-textarea.html imported/w3c/web-platform-tests/html/interaction/focus/processing-model/preventScroll-nested-scroll-elements.html Test: imported/w3c/web-platform-tests/html/interaction/focus/processing-model/preventScroll-nested-scroll-elements.html * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Headers.cmake: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * dom/Element.cpp: (WebCore::Element::focus): * dom/Element.h: (WebCore::Element::focus): * dom/FocusOptions.h: Copied from Source/WebCore/html/HTMLOrForeignElement.idl. * dom/FocusOptions.idl: Copied from Source/WebCore/html/HTMLOrForeignElement.idl. * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::didAttachRenderers): * html/HTMLLabelElement.cpp: (WebCore::HTMLLabelElement::focus): * html/HTMLLabelElement.h: * html/HTMLLegendElement.cpp: (WebCore::HTMLLegendElement::focus): * html/HTMLLegendElement.h: * html/HTMLOrForeignElement.idl: * html/InputType.cpp: (WebCore::InputType::accessKeyAction): * page/FocusController.cpp: (WebCore::FocusController::advanceFocusInDocumentOrder): (WebCore::FocusController::advanceFocusDirectionallyInContainer): LayoutTests: The test preventScroll-textarea.html now passes on all platforms. * platform/ios-wk2/imported/w3c/web-platform-tests/html/interaction/focus/processing-model/preventScroll-textarea-expected.txt: Removed. * platform/mac-wk1/imported/w3c/web-platform-tests/html/interaction/focus/processing-model/preventScroll-textarea-expected.txt: Removed. Canonical link: https://commits.webkit.org/235610@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274812 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-22 22:29:52 +00:00
/*
* Copyright (C) 2020 Igalia S.L. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
dictionary FocusOptions {
boolean preventScroll = false;
};