Diff
Modified: trunk/Source/WTF/ChangeLog (283048 => 283049)
--- trunk/Source/WTF/ChangeLog 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WTF/ChangeLog 2021-09-24 18:04:35 UTC (rev 283049)
@@ -1,3 +1,19 @@
+2021-09-24 Devin Rousso <[email protected]>
+
+ Add typechecking `is` overloads for `std::unique_ptr`, `WTF::UniqueRef`, and `WTF::WeakPtr`
+ https://bugs.webkit.org/show_bug.cgi?id=230734
+
+ Reviewed by Chris Dumez.
+
+ * wtf/StdLibExtras.h:
+ * wtf/TypeCasts.h:
+ (WTF::is):
+ * wtf/UniqueRef.h:
+ (WTF::GetPtrHelper<UniqueRef<T>>::getPtr): Added.
+ (WTF::is): Added.
+ * wtf/WeakPtr.h:
+ (WTF::is): Added.
+
2021-09-24 Jonathan Bedard <[email protected]>
[iOS 15] Support building WebKit (Part 3)
Modified: trunk/Source/WTF/wtf/StdLibExtras.h (283048 => 283049)
--- trunk/Source/WTF/wtf/StdLibExtras.h 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WTF/wtf/StdLibExtras.h 2021-09-24 18:04:35 UTC (rev 283049)
@@ -32,6 +32,8 @@
#include <wtf/Assertions.h>
#include <wtf/CheckedArithmetic.h>
#include <wtf/Compiler.h>
+#include <wtf/GetPtr.h>
+#include <wtf/TypeCasts.h>
// Use this macro to declare and define a debug-only global variable that may have a
// non-trivial constructor and destructor. When building with clang, this will suppress
Modified: trunk/Source/WTF/wtf/TypeCasts.h (283048 => 283049)
--- trunk/Source/WTF/wtf/TypeCasts.h 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WTF/wtf/TypeCasts.h 2021-09-24 18:04:35 UTC (rev 283049)
@@ -101,6 +101,20 @@
}; \
}
+// Explicit specialization for C++ standard library types.
+
+template<typename ExpectedType, typename ArgType, typename Deleter>
+inline bool is(std::unique_ptr<ArgType, Deleter>& source)
+{
+ return is<ExpectedType>(source.get());
+}
+
+template<typename ExpectedType, typename ArgType, typename Deleter>
+inline bool is(const std::unique_ptr<ArgType, Deleter>& source)
+{
+ return is<ExpectedType>(source.get());
+}
+
} // namespace WTF
using WTF::TypeCastTraits;
Modified: trunk/Source/WTF/wtf/UniqueRef.h (283048 => 283049)
--- trunk/Source/WTF/wtf/UniqueRef.h 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WTF/wtf/UniqueRef.h 2021-09-24 18:04:35 UTC (rev 283049)
@@ -27,6 +27,8 @@
#include <memory>
#include <wtf/Assertions.h>
+#include <wtf/GetPtr.h>
+#include <wtf/TypeCasts.h>
namespace WTF {
@@ -98,6 +100,29 @@
std::unique_ptr<T> m_ref;
};
+template <typename T>
+struct GetPtrHelper<UniqueRef<T>> {
+ using PtrType = T*;
+ static T* getPtr(const UniqueRef<T>& p) { return const_cast<T*>(p.ptr()); }
+};
+
+template <typename T>
+struct IsSmartPtr<UniqueRef<T>> {
+ static constexpr bool value = true;
+};
+
+template<typename ExpectedType, typename ArgType>
+inline bool is(UniqueRef<ArgType>& source)
+{
+ return is<ExpectedType>(source.get());
+}
+
+template<typename ExpectedType, typename ArgType>
+inline bool is(const UniqueRef<ArgType>& source)
+{
+ return is<ExpectedType>(source.get());
+}
+
} // namespace WTF
using WTF::UniqueRef;
Modified: trunk/Source/WTF/wtf/WeakPtr.h (283048 => 283049)
--- trunk/Source/WTF/wtf/WeakPtr.h 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WTF/wtf/WeakPtr.h 2021-09-24 18:04:35 UTC (rev 283049)
@@ -26,8 +26,10 @@
#pragma once
+#include <wtf/GetPtr.h>
#include <wtf/HashTraits.h>
#include <wtf/Threading.h>
+#include <wtf/TypeCasts.h>
namespace WTF {
@@ -288,6 +290,29 @@
return makeWeakPtr(object.get(), enableWeakPtrThreadingAssertions);
}
+template <typename T, typename Counter>
+struct GetPtrHelper<WeakPtr<T, Counter>> {
+ using PtrType = T*;
+ static T* getPtr(const WeakPtr<T, Counter>& p) { return const_cast<T*>(p.get()); }
+};
+
+template <typename T, typename Counter>
+struct IsSmartPtr<WeakPtr<T, Counter>> {
+ static constexpr bool value = true;
+};
+
+template<typename ExpectedType, typename ArgType, typename Counter>
+inline bool is(WeakPtr<ArgType, Counter>& source)
+{
+ return is<ExpectedType>(source.get());
+}
+
+template<typename ExpectedType, typename ArgType, typename Counter>
+inline bool is(const WeakPtr<ArgType, Counter>& source)
+{
+ return is<ExpectedType>(source.get());
+}
+
template<typename T, typename U, typename Counter> inline bool operator==(const WeakPtr<T, Counter>& a, const WeakPtr<U, Counter>& b)
{
return a.get() == b.get();
Modified: trunk/Source/WebCore/ChangeLog (283048 => 283049)
--- trunk/Source/WebCore/ChangeLog 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/ChangeLog 2021-09-24 18:04:35 UTC (rev 283049)
@@ -1,3 +1,81 @@
+2021-09-24 Devin Rousso <[email protected]>
+
+ Add typechecking `is` overloads for `std::unique_ptr`, `WTF::UniqueRef`, and `WTF::WeakPtr`
+ https://bugs.webkit.org/show_bug.cgi?id=230734
+
+ Reviewed by Chris Dumez.
+
+ * accessibility/AccessibilityListBoxOption.cpp:
+ (WebCore::AccessibilityListBoxOption::isEnabled const):
+ (WebCore::AccessibilityListBoxOption::isSelected const):
+ (WebCore::AccessibilityListBoxOption::canSetSelectedAttribute const):
+ * accessibility/AccessibilityScrollView.cpp:
+ (WebCore::AccessibilityScrollView::webAreaObject const):
+ (WebCore::AccessibilityScrollView::documentFrameView const):
+ (WebCore::AccessibilityScrollView::parentObject const):
+ (WebCore::AccessibilityScrollView::parentObjectIfExists const):
+ * animation/CSSPropertyAnimation.cpp:
+ (WebCore::blendFunc):
+ * bindings/js/JSAbstractRangeCustom.cpp:
+ (WebCore::toJSNewlyCreated):
+ * css/CSSCounterStyleRule.cpp:
+ (WebCore::StyleRuleCounterStyle::mutableProperties):
+ * css/CSSCursorImageValue.cpp:
+ (WebCore::CSSCursorImageValue::CSSCursorImageValue):
+ (WebCore::CSSCursorImageValue::selectBestFitImage):
+ * css/CSSFontFaceSource.cpp:
+ (WebCore::CSSFontFaceSource::isSVGFontFaceSource const):
+ * css/CSSFontFaceSrcValue.cpp:
+ (WebCore::CSSFontFaceSrcValue::fontLoadRequest):
+ * css/CSSFontSelector.cpp:
+ (WebCore::CSSFontSelector::updateStyleIfNeeded):
+ (WebCore::CSSFontSelector::fontRangesForFamily):
+ (WebCore::CSSFontSelector::fallbackFontAt):
+ * css/CSSKeyframeRule.cpp:
+ (WebCore::StyleRuleKeyframe::mutableProperties):
+ * css/StyleRule.cpp:
+ (WebCore::StyleRule::mutableProperties):
+ (WebCore::StyleRulePage::mutableProperties):
+ (WebCore::StyleRuleFontFace::mutableProperties):
+ * css/calc/CSSCalcOperationNode.cpp:
+ (WebCore::CSSCalcOperationNode::hoistChildrenWithOperator):
+ (WebCore::CSSCalcOperationNode::combineChildren):
+ * css/typedom/CSSStyleValueFactory.cpp:
+ (WebCore::CSSStyleValueFactory::reifyValue):
+ * editing/TextManipulationController.cpp:
+ (WebCore::TextManipulationController::scheduleObservationUpdate):
+ (WebCore::TextManipulationController::replace):
+ * editing/cocoa/WebContentReaderCocoa.mm:
+ (WebCore::replaceRichContentWithAttachments):
+ * html/FormController.cpp:
+ (WebCore::FormController::restoreControlStateIn):
+ * html/HTMLCanvasElement.cpp:
+ (WebCore::HTMLCanvasElement::reset):
+ (WebCore::HTMLCanvasElement::getImageData):
+ (WebCore::HTMLCanvasElement::virtualHasPendingActivity const):
+ * html/HTMLFormElement.cpp:
+ (WebCore::HTMLFormElement::checkInvalidControlsAndCollectUnhandled):
+ * html/OffscreenCanvas.cpp:
+ (WebCore::OffscreenCanvas::reset):
+ * html/track/TextTrack.cpp:
+ (WebCore::TextTrack::addCue):
+ * inspector/agents/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::buildObjectForEventListener):
+ * page/FrameViewLayoutContext.cpp:
+ (WebCore::FrameViewLayoutContext::layout):
+ * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
+ (WebCore::SourceBufferPrivateAVFObjC::streamDataParser const):
+ * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
+ (WebCore::PlatformCAAnimationCocoa::setAnimations):
+ * platform/graphics/ca/win/PlatformCAAnimationWin.cpp:
+ (PlatformCAAnimationWin::setAnimations):
+ * rendering/RenderImageResource.cpp:
+ (WebCore::RenderImageResource::imageSize const):
+ * rendering/updating/RenderTreeBuilder.cpp:
+ (WebCore::RenderTreeBuilder::destroy):
+ * rendering/updating/RenderTreeBuilderTable.cpp:
+ (WebCore::RenderTreeBuilder::Table::attach):
+
2021-09-24 Alan Bujtas <[email protected]>
[LFC][IFC] Line breaking only uses a few style properties
Modified: trunk/Source/WebCore/accessibility/AccessibilityListBoxOption.cpp (283048 => 283049)
--- trunk/Source/WebCore/accessibility/AccessibilityListBoxOption.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/accessibility/AccessibilityListBoxOption.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -56,7 +56,7 @@
bool AccessibilityListBoxOption::isEnabled() const
{
- if (is<HTMLOptGroupElement>(m_optionElement.get()))
+ if (is<HTMLOptGroupElement>(m_optionElement))
return false;
if (equalLettersIgnoringASCIICase(getAttribute(aria_disabledAttr), "true"))
@@ -70,7 +70,7 @@
bool AccessibilityListBoxOption::isSelected() const
{
- if (!is<HTMLOptionElement>(m_optionElement.get()))
+ if (!is<HTMLOptionElement>(m_optionElement))
return false;
return downcast<HTMLOptionElement>(*m_optionElement).selected();
@@ -121,7 +121,7 @@
bool AccessibilityListBoxOption::canSetSelectedAttribute() const
{
- if (!is<HTMLOptionElement>(m_optionElement.get()))
+ if (!is<HTMLOptionElement>(m_optionElement))
return false;
if (m_optionElement->isDisabledFormControl())
Modified: trunk/Source/WebCore/accessibility/AccessibilityScrollView.cpp (283048 => 283049)
--- trunk/Source/WebCore/accessibility/AccessibilityScrollView.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/accessibility/AccessibilityScrollView.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -194,7 +194,7 @@
AccessibilityObject* AccessibilityScrollView::webAreaObject() const
{
- if (!is<FrameView>(m_scrollView.get()))
+ if (!is<FrameView>(m_scrollView))
return nullptr;
Document* document = downcast<FrameView>(*m_scrollView).frame().document();
@@ -236,7 +236,7 @@
FrameView* AccessibilityScrollView::documentFrameView() const
{
- if (!is<FrameView>(m_scrollView.get()))
+ if (!is<FrameView>(m_scrollView))
return nullptr;
return downcast<FrameView>(m_scrollView.get());
@@ -244,7 +244,7 @@
AccessibilityObject* AccessibilityScrollView::parentObject() const
{
- if (!is<FrameView>(m_scrollView.get()))
+ if (!is<FrameView>(m_scrollView))
return nullptr;
AXObjectCache* cache = axObjectCache();
@@ -260,7 +260,7 @@
AccessibilityObject* AccessibilityScrollView::parentObjectIfExists() const
{
- if (!is<FrameView>(m_scrollView.get()))
+ if (!is<FrameView>(m_scrollView))
return nullptr;
AXObjectCache* cache = axObjectCache();
Modified: trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp (283048 => 283049)
--- trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -191,7 +191,7 @@
}
auto blendedOperation = to->blend(from, context);
- if (is<ScaleTransformOperation>(blendedOperation.get())) {
+ if (is<ScaleTransformOperation>(blendedOperation)) {
auto& scale = downcast<ScaleTransformOperation>(blendedOperation.get());
return ScaleTransformOperation::create(scale.x(), scale.y(), scale.z(), scale.type());
}
@@ -227,7 +227,7 @@
}
auto blendedOperation = to->blend(from, context);
- if (is<RotateTransformOperation>(blendedOperation.get())) {
+ if (is<RotateTransformOperation>(blendedOperation)) {
auto& rotate = downcast<RotateTransformOperation>(blendedOperation.get());
return RotateTransformOperation::create(rotate.x(), rotate.y(), rotate.z(), rotate.angle(), rotate.type());
}
@@ -263,7 +263,7 @@
}
Ref<TransformOperation> blendedOperation = to->blend(from, context);
- if (is<TranslateTransformOperation>(blendedOperation.get())) {
+ if (is<TranslateTransformOperation>(blendedOperation)) {
TranslateTransformOperation& translate = downcast<TranslateTransformOperation>(blendedOperation.get());
return TranslateTransformOperation::create(translate.x(), translate.y(), translate.z(), translate.type());
}
Modified: trunk/Source/WebCore/bindings/js/JSAbstractRangeCustom.cpp (283048 => 283049)
--- trunk/Source/WebCore/bindings/js/JSAbstractRangeCustom.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/bindings/js/JSAbstractRangeCustom.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -39,7 +39,7 @@
JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref<AbstractRange>&& range)
{
- if (is<StaticRange>(range.get()))
+ if (is<StaticRange>(range))
return createWrapper<StaticRange>(globalObject, WTFMove(range));
return createWrapper<Range>(globalObject, WTFMove(range));
}
Modified: trunk/Source/WebCore/css/CSSCounterStyleRule.cpp (283048 => 283049)
--- trunk/Source/WebCore/css/CSSCounterStyleRule.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/css/CSSCounterStyleRule.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -138,7 +138,7 @@
MutableStyleProperties& StyleRuleCounterStyle::mutableProperties()
{
- if (!is<MutableStyleProperties>(m_properties.get()))
+ if (!is<MutableStyleProperties>(m_properties))
m_properties = m_properties->mutableCopy();
return downcast<MutableStyleProperties>(m_properties.get());
}
Modified: trunk/Source/WebCore/css/CSSCursorImageValue.cpp (283048 => 283049)
--- trunk/Source/WebCore/css/CSSCursorImageValue.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/css/CSSCursorImageValue.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -39,7 +39,7 @@
, m_hotSpot(hotSpot)
, m_loadedFromOpaqueSource(loadedFromOpaqueSource)
{
- if (is<CSSImageValue>(m_imageValue.get()))
+ if (is<CSSImageValue>(m_imageValue))
m_originalURL = downcast<CSSImageValue>(m_imageValue.get()).imageURL();
}
@@ -100,7 +100,7 @@
ImageWithScale CSSCursorImageValue::selectBestFitImage(const Document& document)
{
- if (is<CSSImageSetValue>(m_imageValue.get()))
+ if (is<CSSImageSetValue>(m_imageValue))
return downcast<CSSImageSetValue>(m_imageValue.get()).selectBestFitImage(document);
if (auto* cursorElement = updateCursorElement(document)) {
Modified: trunk/Source/WebCore/css/CSSFontFaceSource.cpp (283048 => 283049)
--- trunk/Source/WebCore/css/CSSFontFaceSource.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/css/CSSFontFaceSource.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -234,7 +234,7 @@
bool CSSFontFaceSource::isSVGFontFaceSource() const
{
- return m_hasSVGFontFaceElement || (is<CachedFontLoadRequest>(m_fontRequest.get()) && is<CachedSVGFont>(downcast<CachedFontLoadRequest>(m_fontRequest.get())->cachedFont()));
+ return m_hasSVGFontFaceElement || (is<CachedFontLoadRequest>(m_fontRequest) && is<CachedSVGFont>(downcast<CachedFontLoadRequest>(m_fontRequest.get())->cachedFont()));
}
}
Modified: trunk/Source/WebCore/css/CSSFontFaceSrcValue.cpp (283048 => 283049)
--- trunk/Source/WebCore/css/CSSFontFaceSrcValue.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/css/CSSFontFaceSrcValue.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -86,7 +86,7 @@
return makeUnique<CachedFontLoadRequest>(*m_cachedFont);
auto request = context->fontLoadRequest(m_resource, isSVG, isInitiatingElementInUserAgentShadowTree, m_loadedFromOpaqueSource);
- if (is<CachedFontLoadRequest>(request.get()))
+ if (is<CachedFontLoadRequest>(request))
m_cachedFont = &downcast<CachedFontLoadRequest>(request.get())->cachedFont();
return request;
Modified: trunk/Source/WebCore/css/CSSFontSelector.cpp (283048 => 283049)
--- trunk/Source/WebCore/css/CSSFontSelector.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/css/CSSFontSelector.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -282,7 +282,7 @@
void CSSFontSelector::updateStyleIfNeeded()
{
- if (is<Document>(m_context.get()))
+ if (is<Document>(m_context))
downcast<Document>(*m_context).updateStyleIfNeeded();
}
@@ -351,7 +351,7 @@
if (resolveGenericFamilyFirst)
resolveAndAssignGenericFamily();
- Document* document = is<Document>(m_context.get()) ? &downcast<Document>(*m_context) : nullptr;
+ Document* document = is<Document>(m_context) ? &downcast<Document>(*m_context) : nullptr;
auto* face = m_cssFontFaceSet->fontFace(fontDescriptionForLookup->fontSelectionRequest(), familyForLookup);
if (face) {
if (document && RuntimeEnabledFeatures::sharedFeatures().webAPIStatisticsEnabled())
@@ -393,7 +393,7 @@
return nullptr;
auto& pictographFontFamily = m_context->settingsValues().fontGenericFamilies.pictographFontFamily();
auto font = m_fontCache->fontForFamily(fontDescription, pictographFontFamily);
- if (RuntimeEnabledFeatures::sharedFeatures().webAPIStatisticsEnabled() && is<Document>(m_context.get()))
+ if (RuntimeEnabledFeatures::sharedFeatures().webAPIStatisticsEnabled() && is<Document>(m_context))
ResourceLoadObserver::shared().logFontLoad(downcast<Document>(*m_context), pictographFontFamily, !!font);
return font;
Modified: trunk/Source/WebCore/css/CSSKeyframeRule.cpp (283048 => 283049)
--- trunk/Source/WebCore/css/CSSKeyframeRule.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/css/CSSKeyframeRule.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -61,7 +61,7 @@
MutableStyleProperties& StyleRuleKeyframe::mutableProperties()
{
- if (!is<MutableStyleProperties>(m_properties.get()))
+ if (!is<MutableStyleProperties>(m_properties))
m_properties = m_properties->mutableCopy();
return downcast<MutableStyleProperties>(m_properties.get());
}
Modified: trunk/Source/WebCore/css/StyleRule.cpp (283048 => 283049)
--- trunk/Source/WebCore/css/StyleRule.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/css/StyleRule.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -233,7 +233,7 @@
MutableStyleProperties& StyleRule::mutableProperties()
{
- if (!is<MutableStyleProperties>(m_properties.get()))
+ if (!is<MutableStyleProperties>(m_properties))
m_properties = properties().mutableCopy();
return downcast<MutableStyleProperties>(m_properties.get());
}
@@ -302,7 +302,7 @@
MutableStyleProperties& StyleRulePage::mutableProperties()
{
- if (!is<MutableStyleProperties>(m_properties.get()))
+ if (!is<MutableStyleProperties>(m_properties))
m_properties = m_properties->mutableCopy();
return downcast<MutableStyleProperties>(m_properties.get());
}
@@ -323,7 +323,7 @@
MutableStyleProperties& StyleRuleFontFace::mutableProperties()
{
- if (!is<MutableStyleProperties>(m_properties.get()))
+ if (!is<MutableStyleProperties>(m_properties))
m_properties = m_properties->mutableCopy();
return downcast<MutableStyleProperties>(m_properties.get());
}
Modified: trunk/Source/WebCore/css/calc/CSSCalcOperationNode.cpp (283048 => 283049)
--- trunk/Source/WebCore/css/calc/CSSCalcOperationNode.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/css/calc/CSSCalcOperationNode.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -459,7 +459,7 @@
auto hasChildWithOperator = [&] (CalcOperator op) {
for (auto& child : m_children) {
- if (is<CSSCalcOperationNode>(child.get()) && downcast<CSSCalcOperationNode>(child.get()).calcOperator() == op)
+ if (is<CSSCalcOperationNode>(child) && downcast<CSSCalcOperationNode>(child.get()).calcOperator() == op)
return true;
}
return false;
@@ -470,7 +470,7 @@
Vector<Ref<CSSCalcExpressionNode>> newChildren;
for (auto& child : m_children) {
- if (is<CSSCalcOperationNode>(child.get()) && downcast<CSSCalcOperationNode>(child.get()).calcOperator() == op) {
+ if (is<CSSCalcOperationNode>(child) && downcast<CSSCalcOperationNode>(child.get()).calcOperator() == op) {
auto& children = downcast<CSSCalcOperationNode>(child.get()).children();
for (auto& childToMove : children)
newChildren.append(WTFMove(childToMove));
@@ -620,7 +620,7 @@
newChildren.uncheckedAppend(m_children.last().copyRef());
downcast<CSSCalcPrimitiveValueNode>(newChildren[0].get()).multiply(multiplier);
didMultiply = true;
- } else if (is<CSSCalcOperationNode>(m_children.last().get()) && downcast<CSSCalcOperationNode>(m_children.last().get()).calcOperator() == CalcOperator::Add) {
+ } else if (is<CSSCalcOperationNode>(m_children.last()) && downcast<CSSCalcOperationNode>(m_children.last().get()).calcOperator() == CalcOperator::Add) {
// If we're multiplying with another operation that is an addition and all the added children
// are percentages or dimensions, we should multiply each child and make this _expression_ an
// addition.
@@ -627,7 +627,7 @@
auto allChildrenArePrimitiveValues = [](const Vector<Ref<CSSCalcExpressionNode>>& children) -> bool
{
for (auto& child : children) {
- if (!is<CSSCalcPrimitiveValueNode>(child.get()))
+ if (!is<CSSCalcPrimitiveValueNode>(child))
return false;
}
return true;
Modified: trunk/Source/WebCore/css/typedom/CSSStyleValueFactory.cpp (283048 => 283049)
--- trunk/Source/WebCore/css/typedom/CSSStyleValueFactory.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/css/typedom/CSSStyleValueFactory.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -151,7 +151,7 @@
ExceptionOr<Ref<CSSStyleValue>> CSSStyleValueFactory::reifyValue(Ref<CSSValue>&& cssValue, Document* document)
{
- if (is<CSSPrimitiveValue>(cssValue.get())) {
+ if (is<CSSPrimitiveValue>(cssValue)) {
auto primitiveValue = downcast<CSSPrimitiveValue>(cssValue.ptr());
switch (primitiveValue->primitiveType()) {
case CSSUnitType::CSS_NUMBER:
@@ -229,13 +229,13 @@
default:
break;
}
- } else if (is<CSSImageValue>(cssValue.get()))
+ } else if (is<CSSImageValue>(cssValue))
return Ref<CSSStyleValue> { CSSStyleImageValue::create(downcast<CSSImageValue>(cssValue.get()), document) };
- else if (is<CSSVariableReferenceValue>(cssValue.get())) {
+ else if (is<CSSVariableReferenceValue>(cssValue)) {
return Ref<CSSStyleValue> { CSSUnparsedValue::create(downcast<CSSVariableReferenceValue>(cssValue.get()).data().tokenRange()) };
- } else if (is<CSSPendingSubstitutionValue>(cssValue.get())) {
+ } else if (is<CSSPendingSubstitutionValue>(cssValue)) {
return Ref<CSSStyleValue> { CSSUnparsedValue::create(downcast<CSSPendingSubstitutionValue>(cssValue.get()).shorthandValue().data().tokenRange()) };
- } else if (is<CSSCustomPropertyValue>(cssValue.get())) {
+ } else if (is<CSSCustomPropertyValue>(cssValue)) {
// FIXME: remove CSSStyleValue::create(WTFMove(cssValue)), add reification control flow
return WTF::switchOn(downcast<CSSCustomPropertyValue>(cssValue.get()).value(), [&](const Ref<CSSVariableReferenceValue>& value) {
return reifyValue(value.copyRef(), document);
@@ -245,7 +245,7 @@
// FIXME: Property reify the other cases.
return ExceptionOr<Ref<CSSStyleValue>> { CSSStyleValue::create(WTFMove(cssValue)) };
});
- } else if (is<CSSValueList>(cssValue.get())) {
+ } else if (is<CSSValueList>(cssValue)) {
// Reifying the first value in value list.
// FIXME: Verify this is the expected behavior.
// Refer to LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/inline/get.html
Modified: trunk/Source/WebCore/editing/TextManipulationController.cpp (283048 => 283049)
--- trunk/Source/WebCore/editing/TextManipulationController.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/editing/TextManipulationController.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -606,11 +606,11 @@
if (!node->isConnected())
continue;
- if (RefPtr host = node->shadowHost(); is<HTMLInputElement>(host.get()) && downcast<HTMLInputElement>(*host).lastChangeWasUserEdit())
+ if (RefPtr host = node->shadowHost(); is<HTMLInputElement>(host) && downcast<HTMLInputElement>(*host).lastChangeWasUserEdit())
continue;
if (!commonAncestor)
- commonAncestor = is<ContainerNode>(node.get()) ? node.ptr() : node->parentNode();
+ commonAncestor = is<ContainerNode>(node) ? node.ptr() : node->parentNode();
else if (!node->isDescendantOf(commonAncestor.get()))
commonAncestor = commonInclusiveAncestor<ComposedTree>(*commonAncestor, node.get());
}
@@ -851,7 +851,7 @@
auto startTopDownPath = getPath(commonAncestor.get(), firstContentNode.get());
while (!startTopDownPath.isEmpty()) {
auto lastNode = startTopDownPath.last();
- ASSERT(is<ContainerNode>(lastNode.get()));
+ ASSERT(is<ContainerNode>(lastNode));
if (!downcast<ContainerNode>(lastNode.get()).hasOneChild())
break;
nodesToRemove.add(startTopDownPath.takeLast());
Modified: trunk/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm (283048 => 283049)
--- trunk/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm 2021-09-24 18:04:35 UTC (rev 283049)
@@ -360,7 +360,7 @@
auto attachment = HTMLAttachmentElement::create(HTMLNames::attachmentTag, fragment.document());
if (supportsClientSideAttachmentData(frame)) {
- if (is<HTMLImageElement>(originalElement.get()) && contentTypeIsSuitableForInlineImageRepresentation(info.contentType)) {
+ if (is<HTMLImageElement>(originalElement) && contentTypeIsSuitableForInlineImageRepresentation(info.contentType)) {
auto& image = downcast<HTMLImageElement>(originalElement.get());
image.setAttributeWithoutSynchronization(HTMLNames::srcAttr, DOMURL::createObjectURL(*frame.document(), Blob::create(frame.document(), info.data->copyData(), info.contentType)));
image.setAttachmentElement(attachment.copyRef());
Modified: trunk/Source/WebCore/html/FormController.cpp (283048 => 283049)
--- trunk/Source/WebCore/html/FormController.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/html/FormController.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -346,7 +346,7 @@
void FormController::restoreControlStateIn(HTMLFormElement& form)
{
for (auto& element : form.copyAssociatedElementsVector()) {
- if (!is<HTMLFormControlElementWithState>(element.get()))
+ if (!is<HTMLFormControlElementWithState>(element))
continue;
auto& control = downcast<HTMLFormControlElementWithState>(element.get());
if (!control.shouldSaveAndRestoreFormControlState() || ownerForm(control) != &form)
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (283048 => 283049)
--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -550,7 +550,7 @@
int h = limitToOnlyHTMLNonNegative(attributeWithoutSynchronization(heightAttr), defaultHeight);
resetGraphicsContextState();
- if (is<CanvasRenderingContext2D>(m_context.get()))
+ if (is<CanvasRenderingContext2D>(m_context))
downcast<CanvasRenderingContext2D>(*m_context).reset();
IntSize oldSize = size();
@@ -744,7 +744,7 @@
RefPtr<ImageData> HTMLCanvasElement::getImageData()
{
#if ENABLE(WEBGL)
- if (is<WebGLRenderingContextBase>(m_context.get())) {
+ if (is<WebGLRenderingContextBase>(m_context)) {
if (RuntimeEnabledFeatures::sharedFeatures().webAPIStatisticsEnabled())
ResourceLoadObserver::shared().logCanvasRead(document());
return ImageData::create(downcast<WebGLRenderingContextBase>(*m_context).paintRenderingResultsToPixelBuffer());
@@ -985,7 +985,7 @@
bool HTMLCanvasElement::virtualHasPendingActivity() const
{
#if ENABLE(WEBGL)
- if (is<WebGLRenderingContextBase>(m_context.get())) {
+ if (is<WebGLRenderingContextBase>(m_context)) {
// WebGL rendering context may fire contextlost / contextchange / contextrestored events at any point.
return m_hasRelevantWebGLEventListener && !downcast<WebGLRenderingContextBase>(*m_context).isContextUnrecoverablyLost();
}
Modified: trunk/Source/WebCore/html/HTMLFormElement.cpp (283048 => 283049)
--- trunk/Source/WebCore/html/HTMLFormElement.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/html/HTMLFormElement.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -794,7 +794,7 @@
auto elements = copyAssociatedElementsVector();
bool hasInvalidControls = false;
for (auto& element : elements) {
- if (element->form() == this && is<HTMLFormControlElement>(element.get())) {
+ if (element->form() == this && is<HTMLFormControlElement>(element)) {
HTMLFormControlElement& control = downcast<HTMLFormControlElement>(element.get());
if (!control.checkValidity(&unhandledInvalidControls) && control.form() == this)
hasInvalidControls = true;
Modified: trunk/Source/WebCore/html/OffscreenCanvas.cpp (283048 => 283049)
--- trunk/Source/WebCore/html/OffscreenCanvas.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/html/OffscreenCanvas.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -510,7 +510,7 @@
void OffscreenCanvas::reset()
{
resetGraphicsContextState();
- if (is<OffscreenCanvasRenderingContext2D>(m_context.get()))
+ if (is<OffscreenCanvasRenderingContext2D>(m_context))
downcast<OffscreenCanvasRenderingContext2D>(*m_context).reset();
m_hasCreatedImageBuffer = false;
Modified: trunk/Source/WebCore/html/track/TextTrack.cpp (283048 => 283049)
--- trunk/Source/WebCore/html/track/TextTrack.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/html/track/TextTrack.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -332,7 +332,7 @@
// If a DataCue is added to a TextTrack via the addCue() method but the text track does not have its text
// track kind set to metadata, throw a InvalidNodeTypeError exception and don't add the cue to the TextTrackList
// of the TextTrack.
- if (is<DataCue>(cue.get()) && m_kind != Kind::Metadata)
+ if (is<DataCue>(cue) && m_kind != Kind::Metadata)
return Exception { InvalidNodeTypeError };
INFO_LOG(LOGIDENTIFIER, cue.get());
Modified: trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp (283048 => 283049)
--- trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -1875,7 +1875,7 @@
int lineNumber = 0;
int columnNumber = 0;
String scriptID;
- if (is<JSEventListener>(eventListener.get())) {
+ if (is<JSEventListener>(eventListener)) {
auto& scriptListener = downcast<JSEventListener>(eventListener.get());
Document* document = nullptr;
Modified: trunk/Source/WebCore/page/FrameViewLayoutContext.cpp (283048 => 283049)
--- trunk/Source/WebCore/page/FrameViewLayoutContext.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/page/FrameViewLayoutContext.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -214,7 +214,7 @@
return;
layoutRoot = makeWeakPtr(subtreeLayoutRoot() ? subtreeLayoutRoot() : renderView());
- m_needsFullRepaint = is<RenderView>(layoutRoot.get()) && (m_firstLayout || renderView()->printing());
+ m_needsFullRepaint = is<RenderView>(layoutRoot) && (m_firstLayout || renderView()->printing());
view().willDoLayout(layoutRoot);
m_firstLayout = false;
}
@@ -238,7 +238,7 @@
}
{
SetForScope<LayoutPhase> layoutPhase(m_layoutPhase, LayoutPhase::InViewSizeAdjust);
- if (is<RenderView>(layoutRoot.get()) && !renderView()->printing()) {
+ if (is<RenderView>(layoutRoot) && !renderView()->printing()) {
// This is to protect m_needsFullRepaint's value when layout() is getting re-entered through adjustViewSize().
SetForScope<bool> needsFullRepaint(m_needsFullRepaint);
view().adjustViewSize();
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm (283048 => 283049)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm 2021-09-24 18:04:35 UTC (rev 283049)
@@ -870,7 +870,7 @@
AVStreamDataParser* SourceBufferPrivateAVFObjC::streamDataParser() const
{
- if (is<SourceBufferParserAVFObjC>(m_parser.get()))
+ if (is<SourceBufferParserAVFObjC>(m_parser))
return downcast<SourceBufferParserAVFObjC>(m_parser.get()).streamDataParser();
return nil;
}
Modified: trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm (283048 => 283049)
--- trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm 2021-09-24 18:04:35 UTC (rev 283049)
@@ -580,7 +580,7 @@
ASSERT([static_cast<CAAnimation *>(m_animation.get()) isKindOfClass:[CAAnimationGroup class]]);
[static_cast<CAAnimationGroup *>(m_animation.get()) setAnimations:createNSArray(value, [&] (auto& animation) -> CAAnimation * {
- if (is<PlatformCAAnimationCocoa>(animation.get()))
+ if (is<PlatformCAAnimationCocoa>(animation))
return downcast<PlatformCAAnimationCocoa>(animation.get())->m_animation.get();
return nil;
}).get()];
Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp (283048 => 283049)
--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -561,7 +561,7 @@
{
auto array = adoptCF(CFArrayCreateMutable(0, value.size(), &kCFTypeArrayCallBacks));
for (auto& animation : value) {
- if (is<PlatformCAAnimationWin>(animation.get()))
+ if (is<PlatformCAAnimationWin>(animation))
CFArrayAppendValue(array.get(), downcast<PlatformCAAnimationWin>(*animation).m_animation.get());
}
Modified: trunk/Source/WebCore/rendering/RenderImageResource.cpp (283048 => 283049)
--- trunk/Source/WebCore/rendering/RenderImageResource.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/rendering/RenderImageResource.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -105,7 +105,7 @@
if (!m_cachedImage)
return LayoutSize();
LayoutSize size = m_cachedImage->imageSizeForRenderer(m_renderer.get(), multiplier, type);
- if (is<RenderImage>(m_renderer.get()))
+ if (is<RenderImage>(m_renderer))
size.scale(downcast<RenderImage>(*m_renderer).imageDevicePixelRatio());
return size;
}
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (283048 => 283049)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -170,7 +170,7 @@
// We need to detach the subtree first so that the descendants don't have
// access to previous/next sublings at detach().
// FIXME: webkit.org/b/182909.
- if (!is<RenderElement>(toDestroy.get()))
+ if (!is<RenderElement>(toDestroy))
return;
auto& childToDestroy = downcast<RenderElement>(*toDestroy.get());
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderTable.cpp (283048 => 283049)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderTable.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderTable.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -205,7 +205,7 @@
beforeChild = m_builder.splitAnonymousBoxesAroundChild(parent, *beforeChild);
// FIXME: child should always be a RenderTableRow at this point.
- if (is<RenderTableRow>(*child.get()))
+ if (is<RenderTableRow>(child))
parent.willInsertTableRow(downcast<RenderTableRow>(*child.get()), beforeChild);
ASSERT(!beforeChild || is<RenderTableRow>(*beforeChild));
m_builder.attachToRenderElement(parent, WTFMove(child), beforeChild);
Modified: trunk/Source/WebKit/ChangeLog (283048 => 283049)
--- trunk/Source/WebKit/ChangeLog 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebKit/ChangeLog 2021-09-24 18:04:35 UTC (rev 283049)
@@ -1,3 +1,17 @@
+2021-09-24 Devin Rousso <[email protected]>
+
+ Add typechecking `is` overloads for `std::unique_ptr`, `WTF::UniqueRef`, and `WTF::WeakPtr`
+ https://bugs.webkit.org/show_bug.cgi?id=230734
+
+ Reviewed by Chris Dumez.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::setTextAsync):
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::commitPotentialTap):
+ (WebKit::WebPage::performActionOnElement):
+ (WebKit::WebPage::autofillLoginCredentials):
+
2021-09-24 Eric Hutchison <[email protected]>
Unreviewed, reverting r283024.
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (283048 => 283049)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -5787,7 +5787,7 @@
return;
}
- if (is<HTMLInputElement>(m_focusedElement.get())) {
+ if (is<HTMLInputElement>(m_focusedElement)) {
downcast<HTMLInputElement>(*m_focusedElement).setValueForUser(text);
return;
}
Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (283048 => 283049)
--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2021-09-24 18:04:35 UTC (rev 283049)
@@ -1130,9 +1130,9 @@
auto invalidTargetForSingleClick = !m_potentialTapNode;
if (!invalidTargetForSingleClick) {
bool targetRenders = m_potentialTapNode->renderer();
- if (!targetRenders && is<Element>(m_potentialTapNode.get()))
+ if (!targetRenders && is<Element>(m_potentialTapNode))
targetRenders = downcast<Element>(*m_potentialTapNode).renderOrDisplayContentsStyle();
- invalidTargetForSingleClick = !targetRenders && !is<HTMLAreaElement>(m_potentialTapNode.get());
+ invalidTargetForSingleClick = !targetRenders && !is<HTMLAreaElement>(m_potentialTapNode);
}
if (invalidTargetForSingleClick) {
commitPotentialTapFailed();
@@ -3103,7 +3103,7 @@
void WebPage::performActionOnElement(uint32_t action)
{
- if (!is<HTMLElement>(m_interactionNode.get()))
+ if (!is<HTMLElement>(m_interactionNode))
return;
HTMLElement& element = downcast<HTMLElement>(*m_interactionNode);
@@ -3380,7 +3380,7 @@
void WebPage::autofillLoginCredentials(const String& username, const String& password)
{
- if (is<HTMLInputElement>(m_focusedElement.get())) {
+ if (is<HTMLInputElement>(m_focusedElement)) {
if (auto autofillElements = AutofillElements::computeAutofillElements(downcast<HTMLInputElement>(*m_focusedElement)))
autofillElements->autofill(username, password);
}
Modified: trunk/Source/WebKitLegacy/win/ChangeLog (283048 => 283049)
--- trunk/Source/WebKitLegacy/win/ChangeLog 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebKitLegacy/win/ChangeLog 2021-09-24 18:04:35 UTC (rev 283049)
@@ -1,3 +1,13 @@
+2021-09-24 Devin Rousso <[email protected]>
+
+ Add typechecking `is` overloads for `std::unique_ptr`, `WTF::UniqueRef`, and `WTF::WeakPtr`
+ https://bugs.webkit.org/show_bug.cgi?id=230734
+
+ Reviewed by Chris Dumez.
+
+ * WebFrame.cpp:
+ (WebFrame::elementWithName):
+
2021-09-17 Alex Christensen <[email protected]>
Use ObjectIdentifier for ResourceLoader
Modified: trunk/Source/WebKitLegacy/win/WebFrame.cpp (283048 => 283049)
--- trunk/Source/WebKitLegacy/win/WebFrame.cpp 2021-09-24 18:01:49 UTC (rev 283048)
+++ trunk/Source/WebKitLegacy/win/WebFrame.cpp 2021-09-24 18:04:35 UTC (rev 283049)
@@ -1128,7 +1128,7 @@
if (formElement) {
AtomString targetName((UChar*)name, SysStringLen(name));
for (auto& associatedElement : formElement->copyAssociatedElementsVector()) {
- if (!is<HTMLFormControlElement>(associatedElement.get()))
+ if (!is<HTMLFormControlElement>(associatedElement))
continue;
auto& elt = downcast<HTMLFormControlElement>(associatedElement.get());
// Skip option elements, other duds.