Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fe1876b

Browse filesBrowse files
committed
Further propagate ChildChange::Source to optimize HTMLInputElement creation
https://bugs.webkit.org/show_bug.cgi?id=220785 Reviewed by Ryosuke Niwa. This patch further propagates ChildChange::Source to optimize HTMLInputElement creation. We add appendChild method taking ChildChange::Source to transparently pick the efficient one based on the parameter. * dom/ContainerNode.cpp: (WebCore::ContainerNode::appendChild): * dom/ContainerNode.h: * html/BaseDateAndTimeInputType.cpp: (WebCore::BaseDateAndTimeInputType::createShadowSubtreeAndUpdateInnerTextElementEditability): * html/ColorInputType.cpp: (WebCore::ColorInputType::createShadowSubtreeAndUpdateInnerTextElementEditability): * html/FileInputType.cpp: (WebCore::FileInputType::createShadowSubtreeAndUpdateInnerTextElementEditability): * html/RangeInputType.cpp: (WebCore::RangeInputType::createShadowSubtreeAndUpdateInnerTextElementEditability): * html/TextFieldInputType.cpp: (WebCore::TextFieldInputType::createShadowSubtreeAndUpdateInnerTextElementEditability): Canonical link: https://commits.webkit.org/233195@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271686 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent df78c1c commit fe1876b
Copy full SHA for fe1876b

8 files changed

+51-24Lines changed: 51 additions & 24 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Source/WebCore/ChangeLog‎

Copy file name to clipboardExpand all lines: Source/WebCore/ChangeLog
+25Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
2021-01-20 Yusuke Suzuki <ysuzuki@apple.com>
2+
3+
Further propagate ChildChange::Source to optimize HTMLInputElement creation
4+
https://bugs.webkit.org/show_bug.cgi?id=220785
5+
6+
Reviewed by Ryosuke Niwa.
7+
8+
This patch further propagates ChildChange::Source to optimize HTMLInputElement creation.
9+
We add appendChild method taking ChildChange::Source to transparently pick the efficient
10+
one based on the parameter.
11+
12+
* dom/ContainerNode.cpp:
13+
(WebCore::ContainerNode::appendChild):
14+
* dom/ContainerNode.h:
15+
* html/BaseDateAndTimeInputType.cpp:
16+
(WebCore::BaseDateAndTimeInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
17+
* html/ColorInputType.cpp:
18+
(WebCore::ColorInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
19+
* html/FileInputType.cpp:
20+
(WebCore::FileInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
21+
* html/RangeInputType.cpp:
22+
(WebCore::RangeInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
23+
* html/TextFieldInputType.cpp:
24+
(WebCore::TextFieldInputType::createShadowSubtreeAndUpdateInnerTextElementEditability):
25+
126
2021-01-20 Kenneth Russell <kbr@chromium.org>
227

328
Support WEBGL_multi_draw extension
Collapse file

‎Source/WebCore/dom/ContainerNode.cpp‎

Copy file name to clipboardExpand all lines: Source/WebCore/dom/ContainerNode.cpp
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,15 @@ void ContainerNode::parserAppendChild(Node& newChild)
759759
});
760760
}
761761

762+
ExceptionOr<void> ContainerNode::appendChild(ChildChange::Source source, Node& newChild)
763+
{
764+
if (source == ChildChange::Source::Parser) {
765+
parserAppendChild(newChild);
766+
return { };
767+
}
768+
return appendChild(newChild);
769+
}
770+
762771
static bool affectsElements(const ContainerNode::ChildChange& change)
763772
{
764773
switch (change.type) {
Collapse file

‎Source/WebCore/dom/ContainerNode.h‎

Copy file name to clipboardExpand all lines: Source/WebCore/dom/ContainerNode.h
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ class ContainerNode : public Node {
103103
};
104104
virtual void childrenChanged(const ChildChange&);
105105

106+
ExceptionOr<void> appendChild(ChildChange::Source, Node& newChild);
107+
106108
void disconnectDescendantFrames();
107109

108110
RenderElement* renderer() const;
Collapse file

‎Source/WebCore/html/BaseDateAndTimeInputType.cpp‎

Copy file name to clipboardExpand all lines: Source/WebCore/html/BaseDateAndTimeInputType.cpp
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ void BaseDateAndTimeInputType::handleDOMActivateEvent(Event&)
307307
}
308308
}
309309

310-
void BaseDateAndTimeInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source, bool)
310+
void BaseDateAndTimeInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source source, bool)
311311
{
312312
ASSERT(element());
313313

@@ -316,12 +316,12 @@ void BaseDateAndTimeInputType::createShadowSubtreeAndUpdateInnerTextElementEdita
316316

317317
if (document.settings().dateTimeInputsEditableComponentsEnabled()) {
318318
m_dateTimeEditElement = DateTimeEditElement::create(document, *this);
319-
element.userAgentShadowRoot()->appendChild(*m_dateTimeEditElement);
319+
element.userAgentShadowRoot()->appendChild(source, *m_dateTimeEditElement);
320320
} else {
321321
static MainThreadNeverDestroyed<const AtomString> valueContainerPseudo("-webkit-date-and-time-value", AtomString::ConstructFromLiteral);
322322
auto valueContainer = HTMLDivElement::create(document);
323323
valueContainer->setPseudo(valueContainerPseudo);
324-
element.userAgentShadowRoot()->appendChild(valueContainer);
324+
element.userAgentShadowRoot()->appendChild(source, valueContainer);
325325
}
326326
updateInnerTextValue();
327327
}
Collapse file

‎Source/WebCore/html/ColorInputType.cpp‎

Copy file name to clipboardExpand all lines: Source/WebCore/html/ColorInputType.cpp
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Color ColorInputType::valueAsColor() const
139139
return parseSimpleColorValue(element()->value()).value();
140140
}
141141

142-
void ColorInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source, bool)
142+
void ColorInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source source, bool)
143143
{
144144
ASSERT(element());
145145
ASSERT(element()->shadowRoot());
@@ -152,8 +152,8 @@ void ColorInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(Con
152152
wrapperElement->setPseudo(webkitColorSwatchWrapperName);
153153
auto colorSwatch = HTMLDivElement::create(document);
154154
colorSwatch->setPseudo(webkitColorSwatchName);
155-
wrapperElement->appendChild(colorSwatch);
156-
element()->userAgentShadowRoot()->appendChild(wrapperElement);
155+
wrapperElement->appendChild(source, colorSwatch);
156+
element()->userAgentShadowRoot()->appendChild(source, wrapperElement);
157157

158158
updateColorSwatch();
159159
}
Collapse file

‎Source/WebCore/html/FileInputType.cpp‎

Copy file name to clipboardExpand all lines: Source/WebCore/html/FileInputType.cpp
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,11 +278,11 @@ bool FileInputType::isFileUpload() const
278278
return true;
279279
}
280280

281-
void FileInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source, bool)
281+
void FileInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source source, bool)
282282
{
283283
ASSERT(element());
284284
ASSERT(element()->shadowRoot());
285-
element()->userAgentShadowRoot()->appendChild(element()->multiple() ? UploadButtonElement::createForMultiple(element()->document()): UploadButtonElement::create(element()->document()));
285+
element()->userAgentShadowRoot()->appendChild(source, element()->multiple() ? UploadButtonElement::createForMultiple(element()->document()): UploadButtonElement::create(element()->document()));
286286
}
287287

288288
void FileInputType::disabledStateChanged()
Collapse file

‎Source/WebCore/html/RangeInputType.cpp‎

Copy file name to clipboardExpand all lines: Source/WebCore/html/RangeInputType.cpp
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ auto RangeInputType::handleKeydownEvent(KeyboardEvent& event) -> ShouldCallBaseE
252252
return ShouldCallBaseEventHandler::Yes;
253253
}
254254

255-
void RangeInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source, bool)
255+
void RangeInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(ContainerNode::ChildChange::Source source, bool)
256256
{
257257
ASSERT(element());
258258
ASSERT(element()->userAgentShadowRoot());
@@ -261,10 +261,10 @@ void RangeInputType::createShadowSubtreeAndUpdateInnerTextElementEditability(Con
261261
Document& document = element()->document();
262262
auto track = HTMLDivElement::create(document);
263263
track->setPseudo(webkitSliderRunnableTrackName);
264-
track->appendChild(SliderThumbElement::create(document));
264+
track->appendChild(source, SliderThumbElement::create(document));
265265
auto container = SliderContainerElement::create(document);
266-
container->appendChild(track);
267-
element()->userAgentShadowRoot()->appendChild(container);
266+
container->appendChild(source, track);
267+
element()->userAgentShadowRoot()->appendChild(source, container);
268268
}
269269

270270
HTMLElement* RangeInputType::sliderTrackElement() const
Collapse file

‎Source/WebCore/html/TextFieldInputType.cpp‎

Copy file name to clipboardExpand all lines: Source/WebCore/html/TextFieldInputType.cpp
+3-12Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,7 @@ void TextFieldInputType::createShadowSubtreeAndUpdateInnerTextElementEditability
337337
m_innerText = TextControlInnerTextElement::create(document, isInnerTextElementEditable);
338338

339339
if (!createsContainer) {
340-
if (source == ContainerNode::ChildChange::Source::Parser)
341-
element()->userAgentShadowRoot()->parserAppendChild(*m_innerText);
342-
else
343-
element()->userAgentShadowRoot()->appendChild(*m_innerText);
340+
element()->userAgentShadowRoot()->appendChild(source, *m_innerText);
344341
updatePlaceholderText();
345342
return;
346343
}
@@ -350,10 +347,7 @@ void TextFieldInputType::createShadowSubtreeAndUpdateInnerTextElementEditability
350347

351348
if (shouldHaveSpinButton) {
352349
m_innerSpinButton = SpinButtonElement::create(document, *this);
353-
if (source == ContainerNode::ChildChange::Source::Parser)
354-
m_container->parserAppendChild(*m_innerSpinButton);
355-
else
356-
m_container->appendChild(*m_innerSpinButton);
350+
m_container->appendChild(source, *m_innerSpinButton);
357351
}
358352

359353
if (shouldHaveCapsLockIndicator) {
@@ -364,10 +358,7 @@ void TextFieldInputType::createShadowSubtreeAndUpdateInnerTextElementEditability
364358
bool shouldDrawCapsLockIndicator = this->shouldDrawCapsLockIndicator();
365359
m_capsLockIndicator->setInlineStyleProperty(CSSPropertyDisplay, shouldDrawCapsLockIndicator ? CSSValueBlock : CSSValueNone, true);
366360

367-
if (source == ContainerNode::ChildChange::Source::Parser)
368-
m_container->parserAppendChild(*m_capsLockIndicator);
369-
else
370-
m_container->appendChild(*m_capsLockIndicator);
361+
m_container->appendChild(source, *m_capsLockIndicator);
371362
}
372363
updateAutoFillButton();
373364
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.