Bug Summary

File:Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/Source/WebCore/rendering/RenderSearchField.cpp
Warning:line 126, column 67
Call argument is uncounted and unsafe

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple arm64-apple-macosx15.5.0 -O2 -Wundef-prefix=TARGET_OS_ -Werror=undef-prefix -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name UnifiedSource416.cpp -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=osx -analyzer-checker=security.insecureAPI.decodeValueOfObjCType -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -mframe-pointer=non-leaf -ffp-contract=on -fno-rounding-math -target-sdk-version=15.5 -fcompatibility-qualified-id-block-type-checking -fvisibility-inlines-hidden-static-local-var -fno-modulemap-allow-subdirectory-search -fdefine-target-os-macros -enable-tlsdesc -target-cpu apple-m1 -target-feature +v8.4a -target-feature +aes -target-feature +altnzcv -target-feature +ccdp -target-feature +ccpp -target-feature +complxnum -target-feature +crc -target-feature +dotprod -target-feature +flagm -target-feature +fp-armv8 -target-feature +fp16fml -target-feature +fptoint -target-feature +fullfp16 -target-feature +jsconv -target-feature +lse -target-feature +neon -target-feature +pauth -target-feature +perfmon -target-feature +predres -target-feature +ras -target-feature +rcpc -target-feature +rdm -target-feature +sb -target-feature +sha2 -target-feature +sha3 -target-feature +specrestrict -target-feature +ssbs -target-abi darwinpcs -dwarf-ext-refs -fmodule-format=obj -debug-info-kind=standalone -dwarf-version=5 -debugger-tuning=lldb -fdebug-compilation-dir=/Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/Source/WebCore -target-linker-version 1167.5 -fcoverage-compilation-dir=/Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/Source/WebCore -resource-dir /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/llvm-project/build/lib/clang/21 -dependency-file /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/scan-build-output/StaticAnalyzer/WebCore/WebCore/normal/arm64/UnifiedSource416.d -skip-unused-modulemap-deps -MT dependencies -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk -iquote /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/WebKitBuild/WebCore.build/Release/WebCore.build/WebCore-generated-files.hmap -iquote /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/WebKitBuild/WebCore.build/Release/WebCore.build/WebCore-project-headers.hmap -isystem /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/Source/WebCore/PAL/ThirdParty/dav1d/include -iframework /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/System/Library/PrivateFrameworks -iframework /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/System/Library/Frameworks -include-pch /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/WebKitBuild/PrecompiledHeaders/SharedPrecompiledHeaders/12902642326230122134/WebCorePrefix.h.gch -D _LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE -D CLANG_WEBKIT_BRANCH=1 -D NDEBUG -D BUILDING_WEBKIT -D GL_SILENCE_DEPRECATION=1 -D GLES_SILENCE_DEPRECATION=1 -D __clang_analyzer__ -I /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/WebKitBuild/WebCore.build/Release/WebCore.build/WebCore-own-target-headers.hmap -I /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/WebKitBuild/WebCore.build/Release/WebCore.build/WebCore-all-target-headers.hmap -I /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/WebKitBuild/Release/include -I PAL -I ForwardingHeaders -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/usr/include/libxslt -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/usr/include/libxml2 -I /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/WebKitBuild/Release/DerivedSources/WebCore -I /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/WebKitBuild/Release/usr/local/include -I /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/WebKitBuild/Release/usr/local/include/WebKitAdditions -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/usr/local/include/WebKitAdditions -I /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/WebKitBuild/Release/usr/local/include -I /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/WebKitLibraries/SDKs/macosx15.0-additions.sdk/usr/local/include -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/usr/local/include -I /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/WebKitBuild/Release/usr/local/include/webrtc -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/usr/local/include/webrtc -I /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/WebKitBuild/Release/usr/local/include/webm -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/usr/local/include/webm -I /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/WebKitBuild/PAL.build/PAL.build/DerivedSources -I /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/WebKitBuild/PAL.build/Release/PAL.build/DerivedSources -I /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/Source/WebCore -I /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/WebKitBuild/WebCore.build/Release/WebCore.build/DerivedSources-normal/arm64 -I /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/WebKitBuild/WebCore.build/Release/WebCore.build/DerivedSources/arm64 -I /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/WebKitBuild/WebCore.build/Release/WebCore.build/DerivedSources -F/Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/WebKitBuild/Release -I/usr/local/include -stdlib=libc++ -internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/usr/include/c++/v1 -internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/usr/local/include -internal-isystem /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/llvm-project/build/lib/clang/21/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/usr/include -internal-iframework /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/System/Library/Frameworks -internal-iframework /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/System/Library/SubFrameworks -internal-iframework /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/Library/Frameworks -Wno-trigraphs -Werror -Wno-missing-field-initializers -Wmissing-prototypes -Wunreachable-code -Wnon-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wsign-compare -Wno-shorten-64-to-32 -Wnewline-eof -Wno-c++11-extensions -Wno-implicit-fallthrough -Wdeprecated-declarations -Winvalid-offsetof -Wno-sign-conversion -Winfinite-recursion -Wmove -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wrange-loop-analysis -Wno-semicolon-before-method-body -Wall -Wc99-designator -Wconditional-uninitialized -Wextra -Wdeprecated-enum-enum-conversion -Wdeprecated-enum-float-conversion -Wenum-float-conversion -Wfinal-dtor-non-final-class -Wformat=2 -Wmisleading-indentation -Wpointer-to-int-cast -Wreorder-init-list -Wundef -Wunused-but-set-variable -Wvla -Werror=unguarded-availability -Wno-elaborated-enum-base -Wcast-qual -Wchar-subscripts -Wextra-tokens -Winit-self -Wmissing-noreturn -Wpacked -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare -Wimplicit-fallthrough -Wvla -Wno-unknown-warning-option -Wliteral-conversion -Wthread-safety -Wno-profile-instr-out-of-date -Wno-profile-instr-unprofiled -Wno-backend-plugin -Wunsafe-buffer-usage -std=c++2b -fdeprecated-macro -ferror-limit 19 -fmacro-backtrace-limit=0 -fvisibility=hidden -fvisibility-inlines-hidden -stack-protector 1 -fblocks -fencode-extended-block-signature -fno-rtti -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fno-cxx-modules -fno-implicit-modules -fskip-odr-check-in-gmf -fpascal-strings -fmax-type-align=16 -fdiagnostics-show-note-include-stack -vectorize-loops -vectorize-slp -fsafe-buffer-usage-suggestions -analyzer-output=html -analyzer-config report-in-main-source-file=true -analyzer-config nullability:NoDiagnoseCallsToSystemHeaders=true -analyzer-checker optin.osx.cocoa.localizability.NonLocalizedStringChecker -analyzer-checker security.insecureAPI.UncheckedReturn -analyzer-checker security.insecureAPI.getpw -analyzer-checker security.insecureAPI.gets -analyzer-checker security.insecureAPI.mkstemp -analyzer-checker security.insecureAPI.mktemp -analyzer-disable-checker security.insecureAPI.rand -analyzer-disable-checker security.insecureAPI.strcpy -analyzer-checker security.insecureAPI.vfork -analyzer-disable-checker alpha,apiModeling,core,cplusplus,deadcode,debug,fuchsia,nullability,optin,osx,security,unix,webkit -analyzer-checker alpha.webkit.ForwardDeclChecker,alpha.webkit.MemoryUnsafeCastChecker,alpha.webkit.NoDeleteChecker,alpha.webkit.NoUncheckedPtrMemberChecker,alpha.webkit.NoUnretainedMemberChecker,alpha.webkit.RetainPtrCtorAdoptChecker,alpha.webkit.UncheckedCallArgsChecker,alpha.webkit.UncheckedLocalVarsChecker,alpha.webkit.UncountedCallArgsChecker,alpha.webkit.UncountedLocalVarsChecker,alpha.webkit.UnretainedCallArgsChecker,alpha.webkit.UnretainedLambdaCapturesChecker,alpha.webkit.UnretainedLocalVarsChecker,webkit.NoUncountedMemberChecker,webkit.RefCntblBaseVirtualDtor,webkit.UncountedLambdaCapturesChecker -analyzer-config max-nodes=10000000 -analyzer-config verbose-report-filename=true -fdwarf2-cfi-asm -o /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/scan-build-output/StaticAnalyzer/WebCore/WebCore/normal/arm64/UnifiedSource416.plist -x c++ /Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/WebKitBuild/Release/DerivedSources/WebCore/unified-sources/UnifiedSource416.cpp
1/*
2 * Copyright (C) 2006, 2007, 2010, 2015 Apple Inc. All rights reserved.
3 * (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
4 * Copyright (C) 2010 Google Inc. All rights reserved.
5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 *
22 */
23
24#include "config.h"
25#include "RenderSearchField.h"
26
27#include "ContainerNodeInlines.h"
28#include "CSSFontSelector.h"
29#include "CSSValueKeywords.h"
30#include "Chrome.h"
31#include "DocumentInlines.h"
32#include "DocumentView.h"
33#include "ElementInlines.h"
34#include "Font.h"
35#include "FrameSelection.h"
36#include "HTMLInputElement.h"
37#include "HTMLNames.h"
38#include "HitTestResult.h"
39#include "LocalFrame.h"
40#include "LocalFrameView.h"
41#include "LocalizedStrings.h"
42#include "NodeInlines.h"
43#include "Page.h"
44#include "PopupMenu.h"
45#include "RenderBoxInlines.h"
46#include "RenderBoxModelObjectInlines.h"
47#include "RenderLayer.h"
48#include "RenderObjectInlines.h"
49#include "RenderTheme.h"
50#include "RenderView.h"
51#include "SearchInputType.h"
52#include "StyleResolver.h"
53#include "TextControlInnerElements.h"
54#include "UnicodeBidi.h"
55#include <wtf/TZoneMallocInlines.h>
56
57namespace WebCore {
58
59using namespace HTMLNames;
60
61WTF_MAKE_TZONE_ALLOCATED_IMPL(RenderSearchField)::bmalloc::api::HeapRef RenderSearchField::s_heapRef; const TZoneSpecification
RenderSearchField::s_heapSpec = { &RenderSearchField::s_heapRef
, TZoneSpecification::encodeSize<RenderSearchField>(), TZoneSpecification
::encodeAlignment<RenderSearchField>(), TZoneSpecification
::encodeCategory<RenderSearchField>(), ::bmalloc::api::
compactAllocationMode<RenderSearchField>(), TZoneSpecification
::encodeDescriptor<RenderSearchField>(), }; void* RenderSearchField
::operatorNewSlow(size_t size) { if constexpr (::bmalloc::api
::compactAllocationMode<RenderSearchField>() == CompactAllocationMode
::Compact) return ::bmalloc::api::tzoneAllocateCompactSlow(size
, s_heapSpec); return ::bmalloc::api::tzoneAllocateNonCompactSlow
(size, s_heapSpec); } using __makeBtzoneMallocedInlineMacroSemicolonifier
__attribute__((unused)) = int
;
62
63RenderSearchField::RenderSearchField(HTMLInputElement& element, RenderStyle&& style)
64 : RenderTextControlSingleLine(Type::SearchField, element, WTF::move(style))
65 , m_searchPopupIsVisible(false)
66 , m_searchPopup(nullptr)
67{
68 ASSERT(element.isSearchField())((void)0);
69 ASSERT(isRenderSearchField())((void)0);
70}
71
72// Do not add any code in below destructor. Add it to willBeDestroyed() instead.
73RenderSearchField::~RenderSearchField() = default;
74
75void RenderSearchField::willBeDestroyed()
76{
77 if (RefPtr searchPopup = std::exchange(m_searchPopup, nullptr))
78 protect(searchPopup->popupMenu())->disconnectClient();
79
80 RenderTextControlSingleLine::willBeDestroyed();
81}
82
83inline HTMLElement* RenderSearchField::resultsButtonElement() const
84{
85 return protect(inputElement())->resultsButtonElement();
86}
87
88inline HTMLElement* RenderSearchField::cancelButtonElement() const
89{
90 return protect(inputElement())->cancelButtonElement();
91}
92
93void RenderSearchField::showPopup()
94{
95 if (m_searchPopupIsVisible)
96 return;
97
98
99
100 if (!m_searchPopup)
101 m_searchPopup = page().chrome().createSearchPopupMenu(downcast<SearchInputType>(*inputElement().inputType()));
102
103 Ref popup = *m_searchPopup;
104 if (!popup->enabled())
105 return;
106
107 m_searchPopupIsVisible = true;
108
109 auto recentSearches = downcast<SearchInputType>(*inputElement().inputType()).recentSearches();
110 const AtomString& name = autosaveName();
111 popup->loadRecentSearches(name, recentSearches);
112
113 // Trim the recent searches list if the maximum size has changed since we last saved.
114
115 if (static_cast<int>(recentSearches.size()) > inputElement().maxResults()) {
116 do {
117 recentSearches.removeLast();
118 } while (static_cast<int>(recentSearches.size()) > inputElement().maxResults());
119
120 popup->saveRecentSearches(name, recentSearches);
121 }
122
123 FloatPoint absTopLeft = localToAbsolute(FloatPoint(), UseTransforms);
124 IntRect absBounds = absoluteBoundingBoxRectIgnoringTransforms();
125 absBounds.setLocation(roundedIntPoint(absTopLeft));
126 protect(protect(m_searchPopup)->popupMenu())->show(absBounds, view().frameView(), -1);
Call argument is uncounted and unsafe
127}
128
129void RenderSearchField::hidePopup()
130{
131 if (RefPtr searchPopup = m_searchPopup)
132 protect(searchPopup->popupMenu())->hide();
133}
134
135LayoutUnit RenderSearchField::computeControlLogicalHeight(LayoutUnit lineHeight, LayoutUnit nonContentHeight) const
136{
137 RefPtr resultsButton = resultsButtonElement();
138 if (CheckedPtr resultsRenderer = resultsButton ? resultsButton->renderBox() : nullptr) {
139 resultsRenderer->updateLogicalHeight();
140 nonContentHeight = std::max(nonContentHeight, resultsRenderer->borderAndPaddingLogicalHeight() + resultsRenderer->marginLogicalHeight());
141 lineHeight = std::max(lineHeight, resultsRenderer->logicalHeight());
142 }
143 RefPtr cancelButton = cancelButtonElement();
144 if (CheckedPtr cancelRenderer = cancelButton ? cancelButton->renderBox() : nullptr) {
145 cancelRenderer->updateLogicalHeight();
146 nonContentHeight = std::max(nonContentHeight, cancelRenderer->borderAndPaddingLogicalHeight() + cancelRenderer->marginLogicalHeight());
147 lineHeight = std::max(lineHeight, cancelRenderer->logicalHeight());
148 }
149
150 return lineHeight + nonContentHeight;
151}
152
153std::span<const RecentSearch> RenderSearchField::recentSearches()
154{
155 if (!m_searchPopup)
156 m_searchPopup = page().chrome().createSearchPopupMenu(downcast<SearchInputType>(*inputElement().inputType()));
157
158 auto& recentSearches = downcast<SearchInputType>(*inputElement().inputType()).recentSearches();
159
160 const AtomString& name = autosaveName();
161 protect(m_searchPopup)->loadRecentSearches(name, recentSearches);
162
163 return recentSearches.span();
164}
165
166void RenderSearchField::updateFromElement()
167{
168 RenderTextControlSingleLine::updateFromElement();
169
170 if (cancelButtonElement())
171 updateCancelButtonVisibility();
172
173 if (m_searchPopupIsVisible)
174 protect(protect(m_searchPopup)->popupMenu())->updateFromElement();
175}
176
177void RenderSearchField::updateCancelButtonVisibility() const
178{
179 CheckedPtr cancelButtonRenderer = cancelButtonElement()->renderer();
180 if (!cancelButtonRenderer)
181 return;
182
183 CheckedRef curStyle = cancelButtonRenderer->style();
184 Visibility buttonVisibility = visibilityForCancelButton();
185 if (curStyle->usedVisibility() == buttonVisibility)
186 return;
187
188 auto cancelButtonStyle = RenderStyle::clone(curStyle.get());
189 cancelButtonStyle.setVisibility(buttonVisibility);
190 cancelButtonRenderer->setStyle(WTF::move(cancelButtonStyle));
191}
192
193Visibility RenderSearchField::visibilityForCancelButton() const
194{
195 return (style().usedVisibility() == Visibility::Hidden || protect(inputElement())->value()->isEmpty()) ? Visibility::Hidden : Visibility::Visible;
196}
197
198const AtomString& RenderSearchField::autosaveName() const
199{
200 return inputElement().attributeWithoutSynchronization(nameAttr);
201}
202
203void RenderSearchField::updatePopup(const AtomString& name, const Vector<RecentSearch>& searchItems)
204{
205 if (!m_searchPopup)
206 m_searchPopup = page().chrome().createSearchPopupMenu(downcast<SearchInputType>(*inputElement().inputType()));
207 protect(m_searchPopup)->saveRecentSearches(name, searchItems);
208}
209
210void RenderSearchField::popupDidHide()
211{
212 m_searchPopupIsVisible = false;
213}
214
215#if PLATFORM(WIN)(defined WTF_PLATFORM_WIN && WTF_PLATFORM_WIN)
216int RenderSearchField::clientInsetLeft() const
217{
218 // Inset the menu by the radius of the cap on the left so that
219 // it only runs along the straight part of the bezel.
220 return height() / 2;
221}
222
223int RenderSearchField::clientInsetRight() const
224{
225 // Inset the menu by the radius of the cap on the right so that
226 // it only runs along the straight part of the bezel (unless it needs
227 // to be wider).
228 return height() / 2;
229}
230
231LayoutUnit RenderSearchField::clientPaddingLeft() const
232{
233 LayoutUnit padding = paddingLeft();
234 RefPtr innerBlock = innerBlockElement();
235 if (auto* box = innerBlock ? innerBlock->renderBox() : nullptr)
236 padding += box->x();
237 return padding;
238}
239
240LayoutUnit RenderSearchField::clientPaddingRight() const
241{
242 LayoutUnit padding = paddingRight();
243 RefPtr container = containerElement();
244 if (CheckedPtr containerBox = container ? container->renderBox() : nullptr) {
245 RefPtr innerBlock = innerBlockElement();
246 if (auto* innerBlockBox = innerBlock ? innerBlock->renderBox() : nullptr)
247 padding += containerBox->width() - (innerBlockBox->x() + innerBlockBox->width());
248 }
249 return padding;
250}
251
252FontSelector* RenderSearchField::fontSelector() const
253{
254 return &protect(document())->fontSelector();
255}
256
257HostWindow* RenderSearchField::hostWindow() const
258{
259 return RenderTextControlSingleLine::hostWindow();
260}
261#endif
262
263}