Diff
Modified: trunk/Source/WebCore/ChangeLog (292505 => 292506)
--- trunk/Source/WebCore/ChangeLog 2022-04-06 21:26:40 UTC (rev 292505)
+++ trunk/Source/WebCore/ChangeLog 2022-04-06 21:29:00 UTC (rev 292506)
@@ -1,3 +1,24 @@
+2022-04-06 Chris Dumez <[email protected]>
+
+ Drop unnecessary ExceptionOr<> return types
+ https://bugs.webkit.org/show_bug.cgi?id=238876
+
+ Reviewed by Alex Christensen.
+
+ Drop unnecessary ExceptionOr<> return types as they may cause unnecessary branching at runtime.
+
+ * animation/KeyframeEffect.cpp:
+ (WebCore::KeyframeEffect::create):
+ * animation/KeyframeEffect.h:
+ * css/MediaList.cpp:
+ (WebCore::MediaList::setMediaText):
+ * css/MediaList.h:
+ * html/CustomPaintCanvas.cpp:
+ (WebCore::CustomPaintCanvas::getContext):
+ * html/CustomPaintCanvas.h:
+ * html/CustomPaintImage.cpp:
+ (WebCore::CustomPaintImage::doCustomPaint):
+
2022-04-06 Simon Fraser <[email protected]>
Stop using the shared IOSurfacePool for WebGL
Modified: trunk/Source/WebCore/animation/KeyframeEffect.cpp (292505 => 292506)
--- trunk/Source/WebCore/animation/KeyframeEffect.cpp 2022-04-06 21:26:40 UTC (rev 292505)
+++ trunk/Source/WebCore/animation/KeyframeEffect.cpp 2022-04-06 21:29:00 UTC (rev 292506)
@@ -536,7 +536,7 @@
return keyframeEffect;
}
-ExceptionOr<Ref<KeyframeEffect>> KeyframeEffect::create(Ref<KeyframeEffect>&& source)
+Ref<KeyframeEffect> KeyframeEffect::create(Ref<KeyframeEffect>&& source)
{
auto keyframeEffect = adoptRef(*new KeyframeEffect(nullptr, PseudoId::None));
keyframeEffect->copyPropertiesFromSource(WTFMove(source));
Modified: trunk/Source/WebCore/animation/KeyframeEffect.h (292505 => 292506)
--- trunk/Source/WebCore/animation/KeyframeEffect.h 2022-04-06 21:26:40 UTC (rev 292505)
+++ trunk/Source/WebCore/animation/KeyframeEffect.h 2022-04-06 21:29:00 UTC (rev 292506)
@@ -54,7 +54,7 @@
, public CSSPropertyBlendingClient {
public:
static ExceptionOr<Ref<KeyframeEffect>> create(JSC::JSGlobalObject&, Document&, Element*, JSC::Strong<JSC::JSObject>&&, std::optional<std::variant<double, KeyframeEffectOptions>>&&);
- static ExceptionOr<Ref<KeyframeEffect>> create(Ref<KeyframeEffect>&&);
+ static Ref<KeyframeEffect> create(Ref<KeyframeEffect>&&);
static Ref<KeyframeEffect> create(const Element&, PseudoId);
~KeyframeEffect() { }
Modified: trunk/Source/WebCore/css/MediaList.cpp (292505 => 292506)
--- trunk/Source/WebCore/css/MediaList.cpp 2022-04-06 21:26:40 UTC (rev 292505)
+++ trunk/Source/WebCore/css/MediaList.cpp 2022-04-06 21:29:00 UTC (rev 292506)
@@ -179,13 +179,12 @@
MediaList::~MediaList() = default;
-ExceptionOr<void> MediaList::setMediaText(const String& value)
+void MediaList::setMediaText(const String& value)
{
CSSStyleSheet::RuleMutationScope mutationScope(m_parentRule);
m_mediaQueries->set(value);
if (m_parentStyleSheet)
m_parentStyleSheet->didMutate();
- return { };
}
String MediaList::item(unsigned index) const
Modified: trunk/Source/WebCore/css/MediaList.h (292505 => 292506)
--- trunk/Source/WebCore/css/MediaList.h 2022-04-06 21:26:40 UTC (rev 292505)
+++ trunk/Source/WebCore/css/MediaList.h 2022-04-06 21:29:00 UTC (rev 292506)
@@ -89,7 +89,7 @@
WEBCORE_EXPORT void appendMedium(const String& newMedium);
String mediaText() const { return m_mediaQueries->mediaText(); }
- WEBCORE_EXPORT ExceptionOr<void> setMediaText(const String&);
+ WEBCORE_EXPORT void setMediaText(const String&);
CSSRule* parentRule() const { return m_parentRule; }
CSSStyleSheet* parentStyleSheet() const { return m_parentStyleSheet; }
Modified: trunk/Source/WebCore/dom/Attr.cpp (292505 => 292506)
--- trunk/Source/WebCore/dom/Attr.cpp 2022-04-06 21:26:40 UTC (rev 292505)
+++ trunk/Source/WebCore/dom/Attr.cpp 2022-04-06 21:29:00 UTC (rev 292506)
@@ -97,10 +97,9 @@
m_standaloneValue = value;
}
-ExceptionOr<void> Attr::setNodeValue(const String& value)
+void Attr::setNodeValue(const String& value)
{
setValue(value);
- return { };
}
Ref<Node> Attr::cloneNodeInternal(Document& targetDocument, CloningOperation)
Modified: trunk/Source/WebCore/dom/Attr.h (292505 => 292506)
--- trunk/Source/WebCore/dom/Attr.h 2022-04-06 21:26:40 UTC (rev 292505)
+++ trunk/Source/WebCore/dom/Attr.h 2022-04-06 21:29:00 UTC (rev 292506)
@@ -66,7 +66,7 @@
NodeType nodeType() const final { return ATTRIBUTE_NODE; }
String nodeValue() const final { return value(); }
- ExceptionOr<void> setNodeValue(const String&) final;
+ void setNodeValue(const String&) final;
ExceptionOr<void> setPrefix(const AtomString&) final;
Modified: trunk/Source/WebCore/dom/CharacterData.cpp (292505 => 292506)
--- trunk/Source/WebCore/dom/CharacterData.cpp 2022-04-06 21:26:40 UTC (rev 292505)
+++ trunk/Source/WebCore/dom/CharacterData.cpp 2022-04-06 21:29:00 UTC (rev 292506)
@@ -182,10 +182,9 @@
return m_data;
}
-ExceptionOr<void> CharacterData::setNodeValue(const String& nodeValue)
+void CharacterData::setNodeValue(const String& nodeValue)
{
setData(nodeValue);
- return { };
}
void CharacterData::setDataAndUpdate(const String& newData, unsigned offsetOfReplacedData, unsigned oldLength, unsigned newLength, UpdateLiveRanges shouldUpdateLiveRanges)
Modified: trunk/Source/WebCore/dom/CharacterData.h (292505 => 292506)
--- trunk/Source/WebCore/dom/CharacterData.h 2022-04-06 21:26:40 UTC (rev 292505)
+++ trunk/Source/WebCore/dom/CharacterData.h 2022-04-06 21:29:00 UTC (rev 292506)
@@ -64,7 +64,7 @@
private:
String nodeValue() const final;
- ExceptionOr<void> setNodeValue(const String&) final;
+ void setNodeValue(const String&) final;
void notifyParentAfterChange(const ContainerNode::ChildChange&);
String m_data;
Modified: trunk/Source/WebCore/dom/Node.cpp (292505 => 292506)
--- trunk/Source/WebCore/dom/Node.cpp 2022-04-06 21:26:40 UTC (rev 292505)
+++ trunk/Source/WebCore/dom/Node.cpp 2022-04-06 21:29:00 UTC (rev 292506)
@@ -446,10 +446,9 @@
return String();
}
-ExceptionOr<void> Node::setNodeValue(const String&)
+void Node::setNodeValue(const String&)
{
// By default, setting nodeValue has no effect.
- return { };
}
RefPtr<NodeList> Node::childNodes()
@@ -1591,7 +1590,7 @@
return isNullString ? String() : content.toString();
}
-ExceptionOr<void> Node::setTextContent(const String& text)
+void Node::setTextContent(const String& text)
{
switch (nodeType()) {
case ATTRIBUTE_NODE:
@@ -1599,18 +1598,18 @@
case CDATA_SECTION_NODE:
case COMMENT_NODE:
case PROCESSING_INSTRUCTION_NODE:
- return setNodeValue(text);
+ setNodeValue(text);
+ return;
case ELEMENT_NODE:
case DOCUMENT_FRAGMENT_NODE:
downcast<ContainerNode>(*this).stringReplaceAll(text);
- return { };
+ return;
case DOCUMENT_NODE:
case DOCUMENT_TYPE_NODE:
// Do nothing.
- return { };
+ return;
}
ASSERT_NOT_REACHED();
- return { };
}
static SHA1::Digest hashPointer(const void* pointer)
Modified: trunk/Source/WebCore/dom/Node.h (292505 => 292506)
--- trunk/Source/WebCore/dom/Node.h 2022-04-06 21:26:40 UTC (rev 292505)
+++ trunk/Source/WebCore/dom/Node.h 2022-04-06 21:29:00 UTC (rev 292506)
@@ -122,7 +122,7 @@
inline bool hasTagName(const SVGQualifiedName&) const;
virtual String nodeName() const = 0;
virtual String nodeValue() const;
- virtual ExceptionOr<void> setNodeValue(const String&);
+ virtual void setNodeValue(const String&);
virtual NodeType nodeType() const = 0;
virtual size_t approximateMemoryCost() const { return sizeof(*this); }
ContainerNode* parentNode() const;
@@ -175,7 +175,7 @@
WEBCORE_EXPORT const AtomString& lookupNamespaceURI(const AtomString& prefix) const;
WEBCORE_EXPORT String textContent(bool convertBRsToNewlines = false) const;
- WEBCORE_EXPORT ExceptionOr<void> setTextContent(const String&);
+ WEBCORE_EXPORT void setTextContent(const String&);
Node* lastDescendant() const;
Node* firstDescendant() const;
Modified: trunk/Source/WebCore/html/CustomPaintCanvas.cpp (292505 => 292506)
--- trunk/Source/WebCore/html/CustomPaintCanvas.cpp 2022-04-06 21:26:40 UTC (rev 292505)
+++ trunk/Source/WebCore/html/CustomPaintCanvas.cpp 2022-04-06 21:29:00 UTC (rev 292506)
@@ -53,15 +53,15 @@
setImageBuffer(nullptr);
}
-ExceptionOr<RefPtr<PaintRenderingContext2D>> CustomPaintCanvas::getContext()
+RefPtr<PaintRenderingContext2D> CustomPaintCanvas::getContext()
{
if (m_context)
- return { RefPtr<PaintRenderingContext2D> { &downcast<PaintRenderingContext2D>(*m_context) } };
+ return &downcast<PaintRenderingContext2D>(*m_context);
m_context = PaintRenderingContext2D::create(*this);
downcast<PaintRenderingContext2D>(*m_context).setUsesDisplayListDrawing(true);
- return { RefPtr<PaintRenderingContext2D> { &downcast<PaintRenderingContext2D>(*m_context) } };
+ return &downcast<PaintRenderingContext2D>(*m_context);
}
void CustomPaintCanvas::replayDisplayList(GraphicsContext* ctx) const
Modified: trunk/Source/WebCore/html/CustomPaintCanvas.h (292505 => 292506)
--- trunk/Source/WebCore/html/CustomPaintCanvas.h 2022-04-06 21:26:40 UTC (rev 292505)
+++ trunk/Source/WebCore/html/CustomPaintCanvas.h 2022-04-06 21:29:00 UTC (rev 292506)
@@ -53,7 +53,7 @@
virtual ~CustomPaintCanvas();
bool isCustomPaintCanvas() const final { return true; }
- ExceptionOr<RefPtr<PaintRenderingContext2D>> getContext();
+ RefPtr<PaintRenderingContext2D> getContext();
CanvasRenderingContext* renderingContext() const final { return m_context.get(); }
GraphicsContext* drawingContext() const final;
Modified: trunk/Source/WebCore/html/CustomPaintImage.cpp (292505 => 292506)
--- trunk/Source/WebCore/html/CustomPaintImage.cpp 2022-04-06 21:26:40 UTC (rev 292505)
+++ trunk/Source/WebCore/html/CustomPaintImage.cpp 2022-04-06 21:29:00 UTC (rev 292506)
@@ -149,12 +149,8 @@
return ImageDrawResult::DidNothing;
auto canvas = CustomPaintCanvas::create(*scriptExecutionContext, destSize.width(), destSize.height());
- ExceptionOr<RefPtr<PaintRenderingContext2D>> contextOrException = canvas->getContext();
+ RefPtr context = canvas->getContext();
- if (contextOrException.hasException())
- return ImageDrawResult::DidNothing;
- auto context = contextOrException.releaseReturnValue();
-
HashMap<String, RefPtr<CSSStyleValue>> propertyValues;
if (auto* element = m_element->element()) {
Modified: trunk/Source/WebCore/inspector/DOMEditor.cpp (292505 => 292506)
--- trunk/Source/WebCore/inspector/DOMEditor.cpp 2022-04-06 21:26:40 UTC (rev 292505)
+++ trunk/Source/WebCore/inspector/DOMEditor.cpp 2022-04-06 21:29:00 UTC (rev 292506)
@@ -363,12 +363,14 @@
ExceptionOr<void> undo() final
{
- return m_node->setNodeValue(m_oldValue);
+ m_node->setNodeValue(m_oldValue);
+ return { };
}
ExceptionOr<void> redo() final
{
- return m_node->setNodeValue(m_value);
+ m_node->setNodeValue(m_value);
+ return { };
}
Ref<Node> m_node;
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (292505 => 292506)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2022-04-06 21:26:40 UTC (rev 292505)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2022-04-06 21:29:00 UTC (rev 292506)
@@ -1,5 +1,17 @@
2022-04-06 Chris Dumez <[email protected]>
+ Drop unnecessary ExceptionOr<> return types
+ https://bugs.webkit.org/show_bug.cgi?id=238876
+
+ Reviewed by Alex Christensen.
+
+ Drop unnecessary ExceptionOr<> return types as they may cause unnecessary branching at runtime.
+
+ * DOM/DOMMediaList.mm:
+ (-[DOMMediaList setMediaText:]):
+
+2022-04-06 Chris Dumez <[email protected]>
+
Reduce number of conversions from StringView to String
https://bugs.webkit.org/show_bug.cgi?id=238841
Modified: trunk/Source/WebKitLegacy/mac/DOM/DOMMediaList.mm (292505 => 292506)
--- trunk/Source/WebKitLegacy/mac/DOM/DOMMediaList.mm 2022-04-06 21:26:40 UTC (rev 292505)
+++ trunk/Source/WebKitLegacy/mac/DOM/DOMMediaList.mm 2022-04-06 21:29:00 UTC (rev 292506)
@@ -61,7 +61,7 @@
- (void)setMediaText:(NSString *)newMediaText
{
WebCore::JSMainThreadNullState state;
- raiseOnDOMError(IMPL->setMediaText(newMediaText));
+ IMPL->setMediaText(newMediaText);
}
- (unsigned)length
Modified: trunk/Source/WebKitLegacy/mac/DOM/DOMNode.mm (292505 => 292506)
--- trunk/Source/WebKitLegacy/mac/DOM/DOMNode.mm 2022-04-06 21:26:40 UTC (rev 292505)
+++ trunk/Source/WebKitLegacy/mac/DOM/DOMNode.mm 2022-04-06 21:29:00 UTC (rev 292506)
@@ -98,7 +98,7 @@
- (void)setNodeValue:(NSString *)newNodeValue
{
JSMainThreadNullState state;
- raiseOnDOMError(unwrap(*self).setNodeValue(newNodeValue));
+ unwrap(*self).setNodeValue(newNodeValue);
}
- (unsigned short)nodeType
@@ -194,7 +194,7 @@
- (void)setTextContent:(NSString *)newTextContent
{
JSMainThreadNullState state;
- raiseOnDOMError(unwrap(*self).setTextContent(newTextContent));
+ unwrap(*self).setTextContent(newTextContent);
}
- (BOOL)isConnected