Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GPU Process] [FormControls] Add a ControlPart for TextField #7841

Conversation

shallawa
Copy link
Contributor

@shallawa shallawa commented Dec 19, 2022

8209e22

[GPU Process] [FormControls] Add a ControlPart for TextField
https://bugs.webkit.org/show_bug.cgi?id=249573
rdar://103508637

Reviewed by Simon Fraser and Aditya Keerthi.

NSTextFieldCell is used draw a border around the text field. CoreUI is used to
draw a list button if the text field has a data list.

* Source/WebCore/Headers.cmake:
* Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj:
* Source/WebCore/PAL/pal/spi/mac/NSTextFieldCellSPI.h: Added.
* Source/WebCore/SourcesCocoa.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/platform/graphics/controls/ControlFactory.h:
* Source/WebCore/platform/graphics/controls/ControlPart.h:
* Source/WebCore/platform/graphics/controls/ControlStyle.cpp:
(WebCore::operator<<):
* Source/WebCore/platform/graphics/controls/ControlStyle.h:
* Source/WebCore/platform/graphics/controls/TextFieldPart.h: Copied from Source/WebCore/platform/graphics/controls/ControlFactory.h.
(WebCore::TextFieldPart::create):
(WebCore::TextFieldPart::TextFieldPart):
* Source/WebCore/platform/graphics/mac/controls/ControlFactoryMac.h:
* Source/WebCore/platform/graphics/mac/controls/ControlFactoryMac.mm:
(WebCore::ControlFactoryMac::levelIndicatorCell const):
(WebCore::ControlFactoryMac::textFieldCell const):
(WebCore::ControlFactoryMac::createPlatformTextField):
* Source/WebCore/platform/graphics/mac/controls/ControlMac.h:
* Source/WebCore/platform/graphics/mac/controls/ControlMac.mm:
(WebCore::ControlMac::userPrefersContrast):
(WebCore::drawCellOrFocusRing):
(WebCore::ControlMac::drawCell):
(WebCore::ControlMac::drawListButton):
(WebCore::ControlMac::draw): Deleted.
* Source/WebCore/platform/graphics/mac/controls/MeterMac.mm:
(WebCore::MeterMac::draw):
* Source/WebCore/platform/graphics/mac/controls/TextFieldMac.h: Copied from Source/WebCore/platform/graphics/controls/ControlFactory.h.
* Source/WebCore/platform/graphics/mac/controls/TextFieldMac.mm: Added.
(WebCore::TextFieldMac::TextFieldMac):
(WebCore::TextFieldMac::shouldPaintCustomTextField):
(WebCore::TextFieldMac::draw):
* Source/WebCore/platform/graphics/mac/controls/WebControlView.h:
* Source/WebCore/platform/graphics/mac/controls/WebControlView.mm:
(-[WebControlTextFieldCell _adjustedCoreUIDrawOptionsForDrawingBordersOnly:]):
(-[WebControlTextFieldCell _coreUIDrawOptionsWithFrame:inView:includeFocus:]):
(-[WebControlTextFieldCell _coreUIDrawOptionsWithFrame:inView:includeFocus:maskOnly:]):
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::ensureControlPartForRenderer):
(WebCore::RenderBox::ensureControlPartForBorderOnly):
(WebCore::RenderBox::paintBoxDecorations):
(WebCore::RenderBox::ensureControlPart): Deleted.
* Source/WebCore/rendering/RenderBox.h:
* Source/WebCore/rendering/RenderTheme.cpp:
(WebCore::RenderTheme::createControlPart const):
(WebCore::RenderTheme::extractControlStyleStatesForRenderer const):
(WebCore::RenderTheme::hasListButton const):
(WebCore::RenderTheme::hasListButtonPressed const):
(WebCore::RenderTheme::createControlPartForRenderer const): Deleted.
* Source/WebCore/rendering/RenderTheme.h:
(WebCore::RenderTheme::canCreateControlPartForBorderOnly const):
* Source/WebCore/rendering/RenderThemeMac.h:
* Source/WebCore/rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::canPaint const):
(WebCore::RenderThemeMac::canCreateControlPartForBorderOnly const):
(WebCore::RenderThemeMac::meterSizeForBounds const):
(WebCore::RenderThemeMac::shouldPaintCustomTextField const): Deleted.
(WebCore::RenderThemeMac::paintTextField): Deleted.
(WebCore::RenderThemeMac::textField const): Deleted.
* Source/WebKit/Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<ControlPart>::decode):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:

Canonical link: https://commits.webkit.org/258125@main

b89ef51

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  πŸ§ͺ win
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ›  gtk βœ… πŸ›  wincairo
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ§ͺ gtk-wk2
  πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk1   πŸ§ͺ api-gtk
βœ… πŸ›  tv βœ… πŸ§ͺ mac-wk2
βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  watch βœ… πŸ§ͺ mac-wk2-stress
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch-sim

@shallawa shallawa self-assigned this Dec 19, 2022
@shallawa shallawa added the Layout and Rendering For bugs with layout and rendering of Web pages. label Dec 19, 2022
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Dec 19, 2022
@shallawa shallawa removed the merging-blocked Applied to prevent a change from being merged label Dec 19, 2022
@shallawa shallawa force-pushed the eng/GPU-Process-FormControls-Add-a-ControlPart-for-TextField branch from e39b77e to 3f35d9e Compare December 19, 2022 20:10
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Dec 19, 2022
@shallawa shallawa removed the merging-blocked Applied to prevent a change from being merged label Dec 19, 2022
@shallawa shallawa force-pushed the eng/GPU-Process-FormControls-Add-a-ControlPart-for-TextField branch from 3f35d9e to db60c5e Compare December 19, 2022 21:35
@@ -43,6 +47,11 @@
{
}

bool ControlMac::userPrefersContrast()
{
return [[NSWorkspace sharedWorkspace] accessibilityDisplayShouldIncreaseContrast];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which process does this run in? If it's in the GPU Process, we should feed it in from the web process.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will address this issue in a separate patch.

Source/WebCore/rendering/RenderTheme.cpp Outdated Show resolved Hide resolved
Source/WebCore/rendering/RenderTheme.cpp Outdated Show resolved Hide resolved
@shallawa shallawa force-pushed the eng/GPU-Process-FormControls-Add-a-ControlPart-for-TextField branch from db60c5e to 7950cc4 Compare December 20, 2022 02:03
@shallawa shallawa force-pushed the eng/GPU-Process-FormControls-Add-a-ControlPart-for-TextField branch from 7950cc4 to b89ef51 Compare December 20, 2022 03:08
Comment on lines +1185 to +1188
if (!is<HTMLInputElement>(renderer.generatingNode()))
return false;

const auto& input = downcast<HTMLInputElement>(*(renderer.generatingNode()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dynamicDowncast

Comment on lines +1194 to +1196
const auto* input = downcast<HTMLInputElement>(renderer.generatingNode());
if (!input)
return false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dynamicDowncast

@shallawa shallawa added the merge-queue Applied to send a pull request to merge-queue label Dec 20, 2022
https://bugs.webkit.org/show_bug.cgi?id=249573
rdar://103508637

Reviewed by Simon Fraser and Aditya Keerthi.

NSTextFieldCell is used draw a border around the text field. CoreUI is used to
draw a list button if the text field has a data list.

* Source/WebCore/Headers.cmake:
* Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj:
* Source/WebCore/PAL/pal/spi/mac/NSTextFieldCellSPI.h: Added.
* Source/WebCore/SourcesCocoa.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/platform/graphics/controls/ControlFactory.h:
* Source/WebCore/platform/graphics/controls/ControlPart.h:
* Source/WebCore/platform/graphics/controls/ControlStyle.cpp:
(WebCore::operator<<):
* Source/WebCore/platform/graphics/controls/ControlStyle.h:
* Source/WebCore/platform/graphics/controls/TextFieldPart.h: Copied from Source/WebCore/platform/graphics/controls/ControlFactory.h.
(WebCore::TextFieldPart::create):
(WebCore::TextFieldPart::TextFieldPart):
* Source/WebCore/platform/graphics/mac/controls/ControlFactoryMac.h:
* Source/WebCore/platform/graphics/mac/controls/ControlFactoryMac.mm:
(WebCore::ControlFactoryMac::levelIndicatorCell const):
(WebCore::ControlFactoryMac::textFieldCell const):
(WebCore::ControlFactoryMac::createPlatformTextField):
* Source/WebCore/platform/graphics/mac/controls/ControlMac.h:
* Source/WebCore/platform/graphics/mac/controls/ControlMac.mm:
(WebCore::ControlMac::userPrefersContrast):
(WebCore::drawCellOrFocusRing):
(WebCore::ControlMac::drawCell):
(WebCore::ControlMac::drawListButton):
(WebCore::ControlMac::draw): Deleted.
* Source/WebCore/platform/graphics/mac/controls/MeterMac.mm:
(WebCore::MeterMac::draw):
* Source/WebCore/platform/graphics/mac/controls/TextFieldMac.h: Copied from Source/WebCore/platform/graphics/controls/ControlFactory.h.
* Source/WebCore/platform/graphics/mac/controls/TextFieldMac.mm: Added.
(WebCore::TextFieldMac::TextFieldMac):
(WebCore::TextFieldMac::shouldPaintCustomTextField):
(WebCore::TextFieldMac::draw):
* Source/WebCore/platform/graphics/mac/controls/WebControlView.h:
* Source/WebCore/platform/graphics/mac/controls/WebControlView.mm:
(-[WebControlTextFieldCell _adjustedCoreUIDrawOptionsForDrawingBordersOnly:]):
(-[WebControlTextFieldCell _coreUIDrawOptionsWithFrame:inView:includeFocus:]):
(-[WebControlTextFieldCell _coreUIDrawOptionsWithFrame:inView:includeFocus:maskOnly:]):
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::ensureControlPartForRenderer):
(WebCore::RenderBox::ensureControlPartForBorderOnly):
(WebCore::RenderBox::paintBoxDecorations):
(WebCore::RenderBox::ensureControlPart): Deleted.
* Source/WebCore/rendering/RenderBox.h:
* Source/WebCore/rendering/RenderTheme.cpp:
(WebCore::RenderTheme::createControlPart const):
(WebCore::RenderTheme::extractControlStyleStatesForRenderer const):
(WebCore::RenderTheme::hasListButton const):
(WebCore::RenderTheme::hasListButtonPressed const):
(WebCore::RenderTheme::createControlPartForRenderer const): Deleted.
* Source/WebCore/rendering/RenderTheme.h:
(WebCore::RenderTheme::canCreateControlPartForBorderOnly const):
* Source/WebCore/rendering/RenderThemeMac.h:
* Source/WebCore/rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::canPaint const):
(WebCore::RenderThemeMac::canCreateControlPartForBorderOnly const):
(WebCore::RenderThemeMac::meterSizeForBounds const):
(WebCore::RenderThemeMac::shouldPaintCustomTextField const): Deleted.
(WebCore::RenderThemeMac::paintTextField): Deleted.
(WebCore::RenderThemeMac::textField const): Deleted.
* Source/WebKit/Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<ControlPart>::decode):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:

Canonical link: https://commits.webkit.org/258125@main
@webkit-early-warning-system webkit-early-warning-system force-pushed the eng/GPU-Process-FormControls-Add-a-ControlPart-for-TextField branch from b89ef51 to 8209e22 Compare December 20, 2022 07:45
@webkit-commit-queue
Copy link
Collaborator

Committed 258125@main (8209e22): https://commits.webkit.org/258125@main

Reviewed commits have been landed. Closing PR #7841 and removing active labels.

@webkit-early-warning-system webkit-early-warning-system merged commit 8209e22 into WebKit:main Dec 20, 2022
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Dec 20, 2022
@shallawa shallawa deleted the eng/GPU-Process-FormControls-Add-a-ControlPart-for-TextField branch May 10, 2023 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Layout and Rendering For bugs with layout and rendering of Web pages.
Projects
None yet
6 participants