diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/core/svg')
81 files changed, 260 insertions, 250 deletions
diff --git a/chromium/third_party/blink/renderer/core/svg/animation/svg_smil_element.cc b/chromium/third_party/blink/renderer/core/svg/animation/svg_smil_element.cc index 4325e7cc096..7f08fdf690c 100644 --- a/chromium/third_party/blink/renderer/core/svg/animation/svg_smil_element.cc +++ b/chromium/third_party/blink/renderer/core/svg/animation/svg_smil_element.cc @@ -26,11 +26,12 @@ #include "third_party/blink/renderer/core/svg/animation/svg_smil_element.h" #include <algorithm> + #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/renderer/bindings/core/v8/script_event_listener.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/events/event.h" -#include "third_party/blink/renderer/core/dom/events/event_listener.h" +#include "third_party/blink/renderer/core/dom/events/native_event_listener.h" #include "third_party/blink/renderer/core/dom/id_target_observer.h" #include "third_party/blink/renderer/core/frame/use_counter.h" #include "third_party/blink/renderer/core/svg/animation/smil_time_container.h" @@ -75,47 +76,52 @@ inline RepeatEvent* ToRepeatEvent(Event* event) { // This is used for duration type time values that can't be negative. static const double kInvalidCachedTime = -1.; -class ConditionEventListener final : public EventListener { +class ConditionEventListener final : public NativeEventListener { public: static ConditionEventListener* Create(SVGSMILElement* animation, SVGSMILElement::Condition* condition) { - return new ConditionEventListener(animation, condition); + return MakeGarbageCollected<ConditionEventListener>(animation, condition); } - static const ConditionEventListener* Cast(const EventListener* listener) { - return listener->GetType() == kConditionEventListenerType - ? static_cast<const ConditionEventListener*>(listener) - : nullptr; - } + ConditionEventListener(SVGSMILElement* animation, + SVGSMILElement::Condition* condition) + : animation_(animation), condition_(condition) {} - bool operator==(const EventListener& other) const override; + bool Matches(const EventListener& other) const override; void DisconnectAnimation() { animation_ = nullptr; } + void Invoke(ExecutionContext*, Event*) override; + void Trace(blink::Visitor* visitor) override { visitor->Trace(animation_); visitor->Trace(condition_); - EventListener::Trace(visitor); + NativeEventListener::Trace(visitor); } - private: - ConditionEventListener(SVGSMILElement* animation, - SVGSMILElement::Condition* condition) - : EventListener(kConditionEventListenerType), - animation_(animation), - condition_(condition) {} - - void Invoke(ExecutionContext*, Event*) override; + bool IsConditionEventListener() const override { return true; } + private: Member<SVGSMILElement> animation_; Member<SVGSMILElement::Condition> condition_; }; -bool ConditionEventListener::operator==(const EventListener& listener) const { +template <> +struct DowncastTraits<ConditionEventListener> { + static bool AllowFrom(const EventListener& event_listener) { + const NativeEventListener* native_event_listener = + DynamicTo<NativeEventListener>(event_listener); + return native_event_listener && + native_event_listener->IsConditionEventListener(); + } +}; + +bool ConditionEventListener::Matches(const EventListener& listener) const { if (const ConditionEventListener* condition_event_listener = - ConditionEventListener::Cast(&listener)) + DynamicTo<ConditionEventListener>(listener)) { return animation_ == condition_event_listener->animation_ && condition_ == condition_event_listener->condition_; + } return false; } @@ -710,9 +716,15 @@ void SVGSMILElement::AddInstanceTime(BeginOrEnd begin_or_end, SMILTime elapsed = this->Elapsed(); if (elapsed.IsUnresolved()) return; + SMILTimeWithOrigin time_with_origin(time, origin); + // Ignore new instance times for 'end' if the element is not active + // and the origin is script. + if (begin_or_end == kEnd && GetActiveState() == kInactive && + time_with_origin.OriginIsScript()) + return; Vector<SMILTimeWithOrigin>& list = begin_or_end == kBegin ? begin_times_ : end_times_; - list.push_back(SMILTimeWithOrigin(time, origin)); + list.push_back(time_with_origin); SortTimeList(list); if (begin_or_end == kBegin) BeginListChanged(elapsed); @@ -720,54 +732,34 @@ void SVGSMILElement::AddInstanceTime(BeginOrEnd begin_or_end, EndListChanged(elapsed); } -inline bool CompareTimes(const SMILTimeWithOrigin& left, - const SMILTimeWithOrigin& right) { - return left.Time() < right.Time(); -} - SMILTime SVGSMILElement::FindInstanceTime(BeginOrEnd begin_or_end, SMILTime minimum_time, bool equals_minimum_ok) const { const Vector<SMILTimeWithOrigin>& list = begin_or_end == kBegin ? begin_times_ : end_times_; - int size_of_list = list.size(); - if (!size_of_list) + if (list.IsEmpty()) return begin_or_end == kBegin ? SMILTime::Unresolved() : SMILTime::Indefinite(); - const SMILTimeWithOrigin dummy_time_with_origin( - minimum_time, SMILTimeWithOrigin::kParserOrigin); - const SMILTimeWithOrigin* result = std::lower_bound( - list.begin(), list.end(), dummy_time_with_origin, CompareTimes); - int index_of_result = static_cast<int>(result - list.begin()); - if (index_of_result == size_of_list) + // If an equal value is not accepted, return the next bigger item in the list, + // if any. + auto predicate = [equals_minimum_ok](const SMILTimeWithOrigin& instance_time, + const SMILTime& time) { + return equals_minimum_ok ? instance_time.Time() < time + : instance_time.Time() <= time; + }; + auto* item = + std::lower_bound(list.begin(), list.end(), minimum_time, predicate); + if (item == list.end()) return SMILTime::Unresolved(); - const SMILTime& current_time = list[index_of_result].Time(); // The special value "indefinite" does not yield an instance time in the begin // list. - if (current_time.IsIndefinite() && begin_or_end == kBegin) + if (item->Time().IsIndefinite() && begin_or_end == kBegin) return SMILTime::Unresolved(); - if (current_time > minimum_time) - return current_time; - - DCHECK(current_time == minimum_time); - if (equals_minimum_ok) - return current_time; - - // If the equals is not accepted, return the next bigger item in the list. - SMILTime next_time = current_time; - while (index_of_result < size_of_list - 1) { - next_time = list[index_of_result + 1].Time(); - if (next_time > minimum_time) - return next_time; - ++index_of_result; - } - - return begin_or_end == kBegin ? SMILTime::Unresolved() - : SMILTime::Indefinite(); + return item->Time(); } SMILTime SVGSMILElement::RepeatingDuration() const { diff --git a/chromium/third_party/blink/renderer/core/svg/graphics/svg_image.cc b/chromium/third_party/blink/renderer/core/svg/graphics/svg_image.cc index 59a27fd3ddb..2eecda79e6f 100644 --- a/chromium/third_party/blink/renderer/core/svg/graphics/svg_image.cc +++ b/chromium/third_party/blink/renderer/core/svg/graphics/svg_image.cc @@ -78,6 +78,10 @@ class SVGImage::SVGImageLocalFrameClient : public EmptyLocalFrameClient { void ClearImage() { image_ = nullptr; } private: + std::unique_ptr<WebURLLoaderFactory> CreateURLLoaderFactory() override { + return Platform::Current()->CreateDefaultURLLoaderFactory(); + } + void DispatchDidHandleOnloadEvents() override { // The SVGImage was destructed before SVG load completion. if (!image_) @@ -436,8 +440,8 @@ bool SVGImage::ApplyShaderInternal(PaintFlags& flags, IntRect bounds(IntPoint(), size); flags.setShader(PaintShader::MakePaintRecord( - PaintRecordForCurrentFrame(bounds, url), bounds, - SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, &local_matrix)); + PaintRecordForCurrentFrame(url), bounds, SkShader::kRepeat_TileMode, + SkShader::kRepeat_TileMode, &local_matrix)); // Animation is normally refreshed in draw() impls, which we don't reach when // painting via shaders. @@ -483,10 +487,7 @@ void SVGImage::Draw( should_respect_image_orientation, clamp_mode, NullURL()); } -sk_sp<PaintRecord> SVGImage::PaintRecordForCurrentFrame( - const IntRect& bounds, - const KURL& url, - cc::PaintCanvas* canvas) { +sk_sp<PaintRecord> SVGImage::PaintRecordForCurrentFrame(const KURL& url) { DCHECK(page_); LocalFrameView* view = ToLocalFrame(page_->MainFrame())->View(); view->Resize(ContainerSize()); @@ -503,17 +504,15 @@ sk_sp<PaintRecord> SVGImage::PaintRecordForCurrentFrame( // avoid setting timers from the latter. FlushPendingTimelineRewind(); - PaintRecordBuilder builder(nullptr, nullptr, paint_controller_.get()); + if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled()) { + view->UpdateAllLifecyclePhases( + DocumentLifecycle::LifecycleUpdateReason::kOther); + return view->GetPaintRecord(); + } view->UpdateAllLifecyclePhasesExceptPaint(); - view->PaintWithLifecycleUpdate(builder.Context(), kGlobalPaintNormalPhase, - CullRect(bounds)); - DCHECK(!view->NeedsLayout()); - - if (canvas) { - builder.EndRecording(*canvas); - return nullptr; - } + PaintRecordBuilder builder(nullptr, nullptr, paint_controller_.get()); + view->PaintOutsideOfLifecycle(builder.Context(), kGlobalPaintNormalPhase); return builder.EndRecording(); } @@ -545,7 +544,7 @@ void SVGImage::DrawInternal(cc::PaintCanvas* canvas, canvas->save(); canvas->clipRect(EnclosingIntRect(dst_rect)); canvas->concat(AffineTransformToSkMatrix(transform)); - PaintRecordForCurrentFrame(EnclosingIntRect(src_rect), url, canvas); + canvas->drawPicture(PaintRecordForCurrentFrame(url)); canvas->restore(); } @@ -646,9 +645,9 @@ void SVGImage::ServiceAnimations( LocalFrameView* frame_view = ToLocalFrame(page_->MainFrame())->View(); frame_view->UpdateAllLifecyclePhasesExceptPaint(); - if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled() || + if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled() || RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) { - // For SPv2/BGPT we run UpdateAnimations after the paint phase, but per the + // For CAP/BGPT we run UpdateAnimations after the paint phase, but per the // above comment, we don't want to run lifecycle through to paint for SVG // images. Since we know SVG images never have composited animations we can // update animations directly without worrying about including @@ -658,14 +657,6 @@ void SVGImage::ServiceAnimations( DocumentAnimations::UpdateAnimations( frame_view->GetLayoutView()->GetDocument(), DocumentLifecycle::kLayoutClean, composited_element_ids); - - // Notify observers for image change. In SPv1 this is done through window - // rect invalidation during paint invalidation of the SVGImage's frame view. - auto* layer = frame_view->GetLayoutView()->Layer(); - if (layer->NeedsRepaint()) { - if (auto* observer = GetImageObserver()) - observer->Changed(this); - } } } diff --git a/chromium/third_party/blink/renderer/core/svg/graphics/svg_image.h b/chromium/third_party/blink/renderer/core/svg/graphics/svg_image.h index ad74de97b1a..f9caf52a18c 100644 --- a/chromium/third_party/blink/renderer/core/svg/graphics/svg_image.h +++ b/chromium/third_party/blink/renderer/core/svg/graphics/svg_image.h @@ -181,12 +181,8 @@ class CORE_EXPORT SVGImage final : public Image { const KURL&, const IntSize& container_size); - // Paints the current frame. If a PaintCanvas is passed, paints into that - // canvas and returns nullptr. - // Otherwise returns a pointer to the new PaintRecord. - sk_sp<PaintRecord> PaintRecordForCurrentFrame(const IntRect& bounds, - const KURL&, - cc::PaintCanvas* = nullptr); + // Paints the current frame. Returns new PaintRecord. + sk_sp<PaintRecord> PaintRecordForCurrentFrame(const KURL&); void DrawInternal(cc::PaintCanvas*, const cc::PaintFlags&, diff --git a/chromium/third_party/blink/renderer/core/svg/graphics/svg_image_chrome_client.h b/chromium/third_party/blink/renderer/core/svg/graphics/svg_image_chrome_client.h index a6177c2c389..5953da2d8b6 100644 --- a/chromium/third_party/blink/renderer/core/svg/graphics/svg_image_chrome_client.h +++ b/chromium/third_party/blink/renderer/core/svg/graphics/svg_image_chrome_client.h @@ -74,8 +74,7 @@ class CORE_EXPORT SVGImageChromeClient final : public EmptyChromeClient { FRIEND_TEST_ALL_PREFIXES(SVGImageTest, TimelineSuspendAndResume); FRIEND_TEST_ALL_PREFIXES(SVGImageTest, ResetAnimation); - FRIEND_TEST_ALL_PREFIXES(SVGImagePageVisibilityTest, - PageVisibilityHiddenToVisible); + FRIEND_TEST_ALL_PREFIXES(SVGImageSimTest, PageVisibilityHiddenToVisible); }; DEFINE_TYPE_CASTS(SVGImageChromeClient, diff --git a/chromium/third_party/blink/renderer/core/svg/graphics/svg_image_test.cc b/chromium/third_party/blink/renderer/core/svg/graphics/svg_image_test.cc index c1d26a3b287..77fd083e0cd 100644 --- a/chromium/third_party/blink/renderer/core/svg/graphics/svg_image_test.cc +++ b/chromium/third_party/blink/renderer/core/svg/graphics/svg_image_test.cc @@ -197,11 +197,12 @@ TEST_F(SVGImageTest, SetSizeOnVisualViewport) { GetImage().GetPageForTesting()->GetVisualViewport().Size()); } -class SVGImagePageVisibilityTest : public SimTest {}; +class SVGImageSimTest : public SimTest {}; -TEST_F(SVGImagePageVisibilityTest, PageVisibilityHiddenToVisible) { +TEST_F(SVGImageSimTest, PageVisibilityHiddenToVisible) { SimRequest main_resource("https://example.com/", "text/html"); - SimRequest image_resource("https://example.com/image.svg", "image/svg+xml"); + SimSubresourceRequest image_resource("https://example.com/image.svg", + "image/svg+xml"); LoadURL("https://example.com/"); main_resource.Complete("<img src='image.svg' width='100' id='image'>"); image_resource.Complete(kAnimatedDocument); @@ -234,7 +235,7 @@ TEST_F(SVGImagePageVisibilityTest, PageVisibilityHiddenToVisible) { // Set page visibility to 'hidden', and then wait for the animation timer to // fire. This should suspend the image animation. (Suspend the image's // animation timeline.) - WebView().SetVisibilityState(mojom::PageVisibilityState::kHidden, false); + WebView().SetIsHidden(/*is_hidden=*/true, /*initial_state=*/false); test::RunDelayedTasks(TimeDelta::FromMilliseconds(1) + timer->NextFireInterval()); @@ -242,7 +243,7 @@ TEST_F(SVGImagePageVisibilityTest, PageVisibilityHiddenToVisible) { // Set page visibility to 'visible' - this should schedule a new animation // frame and resume the image animation. - WebView().SetVisibilityState(mojom::PageVisibilityState::kVisible, false); + WebView().SetIsHidden(/*is_hidden=*/false, /*initial_state=*/false); test::RunDelayedTasks(TimeDelta::FromMilliseconds(1) + timer->NextFireInterval()); Compositor().BeginFrame(); @@ -250,4 +251,26 @@ TEST_F(SVGImagePageVisibilityTest, PageVisibilityHiddenToVisible) { EXPECT_FALSE(svg_image_chrome_client.IsSuspended()); } +TEST_F(SVGImageSimTest, TwoImagesSameSVGImageDifferentSize) { + SimRequest main_resource("https://example.com/", "text/html"); + SimSubresourceRequest image_resource("https://example.com/image.svg", + "image/svg+xml"); + LoadURL("https://example.com/"); + main_resource.Complete(R"HTML( + <img src="image.svg" style="width: 100px"> + <img src="image.svg" style="width: 200px"> + )HTML"); + image_resource.Complete(R"SVG( + <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"> + <rect fill="green" width="100" height="100"/> + </svg> + )SVG"); + + Compositor().BeginFrame(); + test::RunPendingTasks(); + // The previous frame should result in a stable state and should not schedule + // new visual updates. + EXPECT_FALSE(Compositor().NeedsBeginFrame()); +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/svg/svg_a_element.h b/chromium/third_party/blink/renderer/core/svg/svg_a_element.h index d6d7e1592cb..b213ac5e749 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_a_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_a_element.h @@ -37,11 +37,11 @@ class CORE_EXPORT SVGAElement final : public SVGGraphicsElement, DECLARE_NODE_FACTORY(SVGAElement); SVGAnimatedString* svgTarget() { return svg_target_.Get(); } + explicit SVGAElement(Document&); + void Trace(blink::Visitor*) override; private: - explicit SVGAElement(Document&); - String title() const override; void SvgAttributeChanged(const QualifiedName&) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_animate_motion_element.h b/chromium/third_party/blink/renderer/core/svg/svg_animate_motion_element.h index 009eb644c04..39f64675874 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_animate_motion_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_animate_motion_element.h @@ -30,14 +30,13 @@ class SVGAnimateMotionElement final : public SVGAnimationElement { DEFINE_WRAPPERTYPEINFO(); public: + explicit SVGAnimateMotionElement(Document&); ~SVGAnimateMotionElement() override; DECLARE_NODE_FACTORY(SVGAnimateMotionElement); void UpdateAnimationPath(); private: - explicit SVGAnimateMotionElement(Document&); - bool HasValidTarget() override; void ParseAttribute(const AttributeModificationParams&) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_animate_transform_element.h b/chromium/third_party/blink/renderer/core/svg/svg_animate_transform_element.h index 94e0a47cfce..3704f7c933f 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_animate_transform_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_animate_transform_element.h @@ -34,9 +34,9 @@ class SVGAnimateTransformElement final : public SVGAnimateElement { public: DECLARE_NODE_FACTORY(SVGAnimateTransformElement); - private: explicit SVGAnimateTransformElement(Document&); + private: bool HasValidTarget() override; void ParseAttribute(const AttributeModificationParams&) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_circle_element.h b/chromium/third_party/blink/renderer/core/svg/svg_circle_element.h index 4c0c6fd8f8a..18fe18a339a 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_circle_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_circle_element.h @@ -33,6 +33,8 @@ class SVGCircleElement final : public SVGGeometryElement { public: DECLARE_NODE_FACTORY(SVGCircleElement); + explicit SVGCircleElement(Document&); + Path AsPath() const override; SVGAnimatedLength* cx() const { return cx_.Get(); } @@ -42,8 +44,6 @@ class SVGCircleElement final : public SVGGeometryElement { void Trace(blink::Visitor*) override; private: - explicit SVGCircleElement(Document&); - void SvgAttributeChanged(const QualifiedName&) override; void CollectStyleForPresentationAttribute( diff --git a/chromium/third_party/blink/renderer/core/svg/svg_clip_path_element.h b/chromium/third_party/blink/renderer/core/svg/svg_clip_path_element.h index 301c99d17f6..81b4dbaadb6 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_clip_path_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_clip_path_element.h @@ -35,6 +35,9 @@ class SVGClipPathElement final : public SVGGraphicsElement { public: DECLARE_NODE_FACTORY(SVGClipPathElement); + + explicit SVGClipPathElement(Document&); + SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>* clipPathUnits() { return clip_path_units_.Get(); } @@ -44,8 +47,6 @@ class SVGClipPathElement final : public SVGGraphicsElement { void Trace(blink::Visitor*) override; private: - explicit SVGClipPathElement(Document&); - void SvgAttributeChanged(const QualifiedName&) override; void ChildrenChanged(const ChildrenChange&) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_defs_element.h b/chromium/third_party/blink/renderer/core/svg/svg_defs_element.h index 2712bc61aed..8121ce1b7e2 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_defs_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_defs_element.h @@ -31,11 +31,11 @@ class SVGDefsElement final : public SVGGraphicsElement { public: DECLARE_NODE_FACTORY(SVGDefsElement); + explicit SVGDefsElement(Document&); + bool SupportsFocus() const override { return false; } private: - explicit SVGDefsElement(Document&); - LayoutObject* CreateLayoutObject(const ComputedStyle&) override; }; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_desc_element.h b/chromium/third_party/blink/renderer/core/svg/svg_desc_element.h index 5baff7cacd1..ab3670fb9b0 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_desc_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_desc_element.h @@ -31,9 +31,9 @@ class SVGDescElement final : public SVGElement { public: DECLARE_NODE_FACTORY(SVGDescElement); - private: explicit SVGDescElement(Document&); + private: bool LayoutObjectIsNeeded(const ComputedStyle&) const override { return false; } diff --git a/chromium/third_party/blink/renderer/core/svg/svg_discard_element.h b/chromium/third_party/blink/renderer/core/svg/svg_discard_element.h index 66eba0f8b1a..972f5f0e21d 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_discard_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_discard_element.h @@ -41,11 +41,11 @@ class SVGDiscardElement final : public SVGSMILElement { public: DECLARE_NODE_FACTORY(SVGDiscardElement); + explicit SVGDiscardElement(Document&); + bool IsSVGDiscardElement() const override { return true; } private: - explicit SVGDiscardElement(Document&); - void ResetAnimatedType() override {} void ClearAnimatedType() override {} void ApplyResultsToTarget() override {} diff --git a/chromium/third_party/blink/renderer/core/svg/svg_element.cc b/chromium/third_party/blink/renderer/core/svg/svg_element.cc index c4df89477b8..2da79ce057b 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_element.cc +++ b/chromium/third_party/blink/renderer/core/svg/svg_element.cc @@ -25,6 +25,7 @@ #include "third_party/blink/renderer/core/svg/svg_element.h" #include "base/auto_reset.h" +#include "base/stl_util.h" #include "third_party/blink/renderer/bindings/core/v8/script_event_listener.h" #include "third_party/blink/renderer/core/animation/document_animations.h" #include "third_party/blink/renderer/core/animation/effect_stack.h" @@ -315,16 +316,23 @@ static inline bool TransformUsesBoxSize(const ComputedStyle& style) { return false; } -static FloatRect ComputeTransformReferenceBox(const SVGElement& element) { - const LayoutObject& layout_object = *element.GetLayoutObject(); +FloatRect ComputeSVGTransformReferenceBox(const LayoutObject& layout_object) { const ComputedStyle& style = layout_object.StyleRef(); - if (style.TransformBox() == ETransformBox::kFillBox) - return layout_object.ObjectBoundingBox(); - DCHECK_EQ(style.TransformBox(), ETransformBox::kViewBox); - SVGLengthContext length_context(&element); - FloatSize viewport_size; - length_context.DetermineViewport(viewport_size); - return FloatRect(FloatPoint(), viewport_size); + FloatRect reference_box; + if (style.TransformBox() == ETransformBox::kFillBox) { + reference_box = layout_object.ObjectBoundingBox(); + } else { + DCHECK_EQ(style.TransformBox(), ETransformBox::kViewBox); + SVGLengthContext length_context( + ToSVGElementOrNull(layout_object.GetNode())); + FloatSize viewport_size; + length_context.DetermineViewport(viewport_size); + reference_box.SetSize(viewport_size); + } + const float zoom = style.EffectiveZoom(); + if (zoom != 1) + reference_box.Scale(zoom); + return reference_box; } AffineTransform SVGElement::CalculateTransform( @@ -336,7 +344,6 @@ AffineTransform SVGElement::CalculateTransform( // set). AffineTransform matrix; if (style && style->HasTransform()) { - FloatRect reference_box = ComputeTransformReferenceBox(*this); if (TransformUsesBoxSize(*style)) UseCounter::Count(GetDocument(), WebFeature::kTransformUsesBoxSizeOnSVG); @@ -344,21 +351,21 @@ AffineTransform SVGElement::CalculateTransform( // SVG (which applies the zoom factor globally, at the root level) we // // * pre-scale the reference box (to bring it into the same space as the - // other CSS values) + // other CSS values) (Handled by ComputeSVGTransformReferenceBox) // * invert the zoom factor (to effectively compute the CSS transform // under a 1.0 zoom) // // Note: objectBoundingBox is an emptyRect for elements like pattern or // clipPath. See // https://svgwg.org/svg2-draft/coords.html#ObjectBoundingBoxUnits - float zoom = style->EffectiveZoom(); TransformationMatrix transform; - if (zoom != 1) - reference_box.Scale(zoom); + FloatRect reference_box = + ComputeSVGTransformReferenceBox(*GetLayoutObject()); style->ApplyTransform( transform, reference_box, ComputedStyle::kIncludeTransformOrigin, ComputedStyle::kIncludeMotionPath, ComputedStyle::kIncludeIndependentTransformProperties); + const float zoom = style->EffectiveZoom(); if (zoom != 1) transform.Zoom(1 / zoom); // Flatten any 3D transform. @@ -496,7 +503,7 @@ CSSPropertyID SVGElement::CssPropertyIdForSVGAttributeName( &kWordSpacingAttr, &kWritingModeAttr, }; - for (size_t i = 0; i < arraysize(attr_names); i++) { + for (size_t i = 0; i < base::size(attr_names); i++) { CSSPropertyID property_id = cssPropertyID(attr_names[i]->LocalName()); DCHECK_GT(property_id, 0); property_name_to_id_map->Set(attr_names[i]->LocalName().Impl(), @@ -780,7 +787,7 @@ AnimatedPropertyType SVGElement::AnimatedPropertyTypeForCSSAttribute( {kVisibilityAttr, kAnimatedString}, {kWordSpacingAttr, kAnimatedLength}, }; - for (size_t i = 0; i < arraysize(attr_to_types); i++) + for (size_t i = 0; i < base::size(attr_to_types); i++) css_property_map.Set(attr_to_types[i].attr, attr_to_types[i].prop_type); } return css_property_map.at(attribute_name); diff --git a/chromium/third_party/blink/renderer/core/svg/svg_element.h b/chromium/third_party/blink/renderer/core/svg/svg_element.h index 4a0a16c8981..433793dc599 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_element.h @@ -330,6 +330,8 @@ struct SVGAttributeHashTranslator { } }; +FloatRect ComputeSVGTransformReferenceBox(const LayoutObject&); + DEFINE_ELEMENT_TYPE_CASTS(SVGElement, IsSVGElement()); template <typename T> diff --git a/chromium/third_party/blink/renderer/core/svg/svg_ellipse_element.h b/chromium/third_party/blink/renderer/core/svg/svg_ellipse_element.h index ed3de18760e..7de52bb27d8 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_ellipse_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_ellipse_element.h @@ -33,6 +33,8 @@ class SVGEllipseElement final : public SVGGeometryElement { public: DECLARE_NODE_FACTORY(SVGEllipseElement); + explicit SVGEllipseElement(Document&); + Path AsPath() const override; SVGAnimatedLength* cx() const { return cx_.Get(); } @@ -43,8 +45,6 @@ class SVGEllipseElement final : public SVGGeometryElement { void Trace(blink::Visitor*) override; private: - explicit SVGEllipseElement(Document&); - void CollectStyleForPresentationAttribute( const QualifiedName&, const AtomicString&, diff --git a/chromium/third_party/blink/renderer/core/svg/svg_enumeration.h b/chromium/third_party/blink/renderer/core/svg/svg_enumeration.h index 9e70421b56e..069c8b704a7 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_enumeration.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_enumeration.h @@ -106,9 +106,11 @@ template <typename Enum> class SVGEnumeration : public SVGEnumerationBase { public: static SVGEnumeration<Enum>* Create(Enum new_value) { - return new SVGEnumeration<Enum>(new_value); + return MakeGarbageCollected<SVGEnumeration<Enum>>(new_value); } + explicit SVGEnumeration(Enum new_value) + : SVGEnumerationBase(new_value, GetEnumerationMap<Enum>()) {} ~SVGEnumeration() override = default; SVGEnumerationBase* Clone() const override { return Create(EnumValue()); } @@ -122,10 +124,6 @@ class SVGEnumeration : public SVGEnumerationBase { value_ = value; NotifyChange(); } - - protected: - explicit SVGEnumeration(Enum new_value) - : SVGEnumerationBase(new_value, GetEnumerationMap<Enum>()) {} }; } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_blend_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_blend_element.h index cc6cf833568..66927de4954 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_blend_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_blend_element.h @@ -51,6 +51,8 @@ class SVGFEBlendElement final : public SVGFilterPrimitiveStandardAttributes { kModeLuminosity = 16, }; + explicit SVGFEBlendElement(Document&); + DECLARE_NODE_FACTORY(SVGFEBlendElement); SVGAnimatedString* in1() { return in1_.Get(); } SVGAnimatedString* in2() { return in2_.Get(); } @@ -59,8 +61,6 @@ class SVGFEBlendElement final : public SVGFilterPrimitiveStandardAttributes { void Trace(blink::Visitor*) override; private: - explicit SVGFEBlendElement(Document&); - bool SetFilterEffectAttribute(FilterEffect*, const QualifiedName& attr_name) override; void SvgAttributeChanged(const QualifiedName&) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_color_matrix_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_color_matrix_element.h index 6342432ac8b..f886203e927 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_color_matrix_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_color_matrix_element.h @@ -38,6 +38,8 @@ class SVGFEColorMatrixElement final public: DECLARE_NODE_FACTORY(SVGFEColorMatrixElement); + explicit SVGFEColorMatrixElement(Document&); + SVGAnimatedNumberList* values() { return values_.Get(); } SVGAnimatedString* in1() { return in1_.Get(); } SVGAnimatedEnumeration<ColorMatrixType>* type() { return type_.Get(); } @@ -45,8 +47,6 @@ class SVGFEColorMatrixElement final void Trace(blink::Visitor*) override; private: - explicit SVGFEColorMatrixElement(Document&); - bool SetFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; void SvgAttributeChanged(const QualifiedName&) override; FilterEffect* Build(SVGFilterBuilder*, Filter*) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_component_transfer_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_component_transfer_element.h index 55ad3f67b5a..bc617e6a306 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_component_transfer_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_component_transfer_element.h @@ -32,13 +32,14 @@ class SVGFEComponentTransferElement final public: DECLARE_NODE_FACTORY(SVGFEComponentTransferElement); + + explicit SVGFEComponentTransferElement(Document&); + SVGAnimatedString* in1() { return in1_.Get(); } void Trace(blink::Visitor*) override; private: - explicit SVGFEComponentTransferElement(Document&); - void SvgAttributeChanged(const QualifiedName&) override; FilterEffect* Build(SVGFilterBuilder*, Filter*) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_composite_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_composite_element.h index e3f74eed510..7f4b6d1060c 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_composite_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_composite_element.h @@ -38,6 +38,8 @@ class SVGFECompositeElement final public: DECLARE_NODE_FACTORY(SVGFECompositeElement); + explicit SVGFECompositeElement(Document&); + SVGAnimatedNumber* k1() { return k1_.Get(); } SVGAnimatedNumber* k2() { return k2_.Get(); } SVGAnimatedNumber* k3() { return k3_.Get(); } @@ -51,8 +53,6 @@ class SVGFECompositeElement final void Trace(blink::Visitor*) override; private: - explicit SVGFECompositeElement(Document&); - bool SetFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; void SvgAttributeChanged(const QualifiedName&) override; FilterEffect* Build(SVGFilterBuilder*, Filter*) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_convolve_matrix_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_convolve_matrix_element.h index 2b633845a25..20d5dd83090 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_convolve_matrix_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_convolve_matrix_element.h @@ -42,6 +42,8 @@ class SVGFEConvolveMatrixElement final public: DECLARE_NODE_FACTORY(SVGFEConvolveMatrixElement); + explicit SVGFEConvolveMatrixElement(Document&); + SVGAnimatedBoolean* preserveAlpha() { return preserve_alpha_.Get(); } SVGAnimatedNumber* divisor() { return divisor_.Get(); } SVGAnimatedNumber* bias() { return bias_.Get(); } @@ -62,8 +64,6 @@ class SVGFEConvolveMatrixElement final void Trace(blink::Visitor*) override; private: - explicit SVGFEConvolveMatrixElement(Document&); - IntSize MatrixOrder() const; IntPoint TargetPoint() const; float ComputeDivisor() const; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_diffuse_lighting_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_diffuse_lighting_element.h index 70c811406be..a7f9b427c47 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_diffuse_lighting_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_diffuse_lighting_element.h @@ -35,6 +35,9 @@ class SVGFEDiffuseLightingElement final public: DECLARE_NODE_FACTORY(SVGFEDiffuseLightingElement); + + explicit SVGFEDiffuseLightingElement(Document&); + void LightElementAttributeChanged(const SVGFELightElement*, const QualifiedName&); @@ -51,8 +54,6 @@ class SVGFEDiffuseLightingElement final void Trace(blink::Visitor*) override; private: - explicit SVGFEDiffuseLightingElement(Document&); - bool SetFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; void SvgAttributeChanged(const QualifiedName&) override; FilterEffect* Build(SVGFilterBuilder*, Filter*) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_displacement_map_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_displacement_map_element.h index 29175d2d618..7cc51dabf87 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_displacement_map_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_displacement_map_element.h @@ -37,6 +37,8 @@ class SVGFEDisplacementMapElement final public: DECLARE_NODE_FACTORY(SVGFEDisplacementMapElement); + explicit SVGFEDisplacementMapElement(Document&); + static ChannelSelectorType StringToChannel(const String&); SVGAnimatedNumber* scale() { return scale_.Get(); } @@ -52,8 +54,6 @@ class SVGFEDisplacementMapElement final void Trace(blink::Visitor*) override; private: - explicit SVGFEDisplacementMapElement(Document&); - bool SetFilterEffectAttribute(FilterEffect*, const QualifiedName& attr_name) override; void SvgAttributeChanged(const QualifiedName&) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_distant_light_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_distant_light_element.h index fe32c6aee0d..981be2c4047 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_distant_light_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_distant_light_element.h @@ -30,9 +30,9 @@ class SVGFEDistantLightElement final : public SVGFELightElement { public: DECLARE_NODE_FACTORY(SVGFEDistantLightElement); - private: explicit SVGFEDistantLightElement(Document&); + private: scoped_refptr<LightSource> GetLightSource(Filter*) const override; }; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_drop_shadow_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_drop_shadow_element.h index d3835af2911..624ab18820a 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_drop_shadow_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_drop_shadow_element.h @@ -34,6 +34,8 @@ class SVGFEDropShadowElement final public: DECLARE_NODE_FACTORY(SVGFEDropShadowElement); + explicit SVGFEDropShadowElement(Document&); + void setStdDeviation(float std_deviation_x, float std_deviation_y); SVGAnimatedNumber* dx() { return dx_.Get(); } @@ -45,8 +47,6 @@ class SVGFEDropShadowElement final void Trace(blink::Visitor*) override; private: - explicit SVGFEDropShadowElement(Document&); - void SvgAttributeChanged(const QualifiedName&) override; bool SetFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; FilterEffect* Build(SVGFilterBuilder*, Filter*) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_flood_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_flood_element.h index 9949bd8caff..45af42fc8ef 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_flood_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_flood_element.h @@ -31,9 +31,9 @@ class SVGFEFloodElement final : public SVGFilterPrimitiveStandardAttributes { public: DECLARE_NODE_FACTORY(SVGFEFloodElement); - private: explicit SVGFEFloodElement(Document&); + private: bool SetFilterEffectAttribute(FilterEffect*, const QualifiedName& attr_name) override; FilterEffect* Build(SVGFilterBuilder*, Filter*) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_func_a_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_func_a_element.h index bab394c2d27..9cc64d3274c 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_func_a_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_func_a_element.h @@ -31,7 +31,6 @@ class SVGFEFuncAElement final : public SVGComponentTransferFunctionElement { public: DECLARE_NODE_FACTORY(SVGFEFuncAElement); - private: explicit SVGFEFuncAElement(Document&); }; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_func_b_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_func_b_element.h index 41df5fb00ac..689969547aa 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_func_b_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_func_b_element.h @@ -31,7 +31,6 @@ class SVGFEFuncBElement final : public SVGComponentTransferFunctionElement { public: DECLARE_NODE_FACTORY(SVGFEFuncBElement); - private: explicit SVGFEFuncBElement(Document&); }; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_func_g_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_func_g_element.h index 077a92feafd..61884a43334 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_func_g_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_func_g_element.h @@ -31,7 +31,6 @@ class SVGFEFuncGElement final : public SVGComponentTransferFunctionElement { public: DECLARE_NODE_FACTORY(SVGFEFuncGElement); - private: explicit SVGFEFuncGElement(Document&); }; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_func_r_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_func_r_element.h index c17bec1bbd2..cc5550c5a35 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_func_r_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_func_r_element.h @@ -31,7 +31,6 @@ class SVGFEFuncRElement final : public SVGComponentTransferFunctionElement { public: DECLARE_NODE_FACTORY(SVGFEFuncRElement); - private: explicit SVGFEFuncRElement(Document&); }; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_gaussian_blur_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_gaussian_blur_element.h index cca688648d0..73a68d1455c 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_gaussian_blur_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_gaussian_blur_element.h @@ -34,6 +34,8 @@ class SVGFEGaussianBlurElement final public: DECLARE_NODE_FACTORY(SVGFEGaussianBlurElement); + explicit SVGFEGaussianBlurElement(Document&); + void setStdDeviation(float std_deviation_x, float std_deviation_y); SVGAnimatedNumber* stdDeviationX() { return std_deviation_->FirstNumber(); } @@ -43,8 +45,6 @@ class SVGFEGaussianBlurElement final void Trace(blink::Visitor*) override; private: - explicit SVGFEGaussianBlurElement(Document&); - void SvgAttributeChanged(const QualifiedName&) override; FilterEffect* Build(SVGFilterBuilder*, Filter*) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_image_element.cc b/chromium/third_party/blink/renderer/core/svg/svg_fe_image_element.cc index 92106996649..6ee1a319c00 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_image_element.cc +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_image_element.cc @@ -163,8 +163,7 @@ FilterEffect* SVGFEImageElement::Build(SVGFilterBuilder*, Filter* filter) { } bool SVGFEImageElement::TaintsOrigin(bool inputs_taint_origin) const { - const SecurityOrigin* security_origin = GetDocument().GetSecurityOrigin(); - if (cached_image_ && cached_image_->IsAccessAllowed(security_origin)) + if (cached_image_ && cached_image_->IsAccessAllowed()) return inputs_taint_origin; return true; } diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_image_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_image_element.h index 2c9f4eb08bc..8288902e9b2 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_image_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_image_element.h @@ -42,6 +42,7 @@ class SVGFEImageElement final : public SVGFilterPrimitiveStandardAttributes, bool CurrentFrameHasSingleSecurityOrigin() const; + explicit SVGFEImageElement(Document&); ~SVGFEImageElement() override; SVGAnimatedPreserveAspectRatio* preserveAspectRatio() { return preserve_aspect_ratio_.Get(); @@ -52,8 +53,6 @@ class SVGFEImageElement final : public SVGFilterPrimitiveStandardAttributes, void Trace(blink::Visitor*) override; private: - explicit SVGFEImageElement(Document&); - void SvgAttributeChanged(const QualifiedName&) override; void ImageNotifyFinished(ImageResourceContent*) override; String DebugName() const override { return "SVGFEImageElement"; } diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_merge_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_merge_element.h index 29cbf80b856..69a9a2ffe8d 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_merge_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_merge_element.h @@ -31,9 +31,9 @@ class SVGFEMergeElement final : public SVGFilterPrimitiveStandardAttributes { public: DECLARE_NODE_FACTORY(SVGFEMergeElement); - private: explicit SVGFEMergeElement(Document&); + private: FilterEffect* Build(SVGFilterBuilder*, Filter*) override; bool TaintsOrigin(bool inputs_taint_origin) const override; }; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_merge_node_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_merge_node_element.h index 6e6946e3a89..e1bd7717898 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_merge_node_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_merge_node_element.h @@ -32,13 +32,14 @@ class SVGFEMergeNodeElement final : public SVGElement { public: DECLARE_NODE_FACTORY(SVGFEMergeNodeElement); + + explicit SVGFEMergeNodeElement(Document&); + SVGAnimatedString* in1() { return in1_.Get(); } void Trace(blink::Visitor*) override; private: - explicit SVGFEMergeNodeElement(Document&); - void SvgAttributeChanged(const QualifiedName&) override; bool LayoutObjectIsNeeded(const ComputedStyle&) const override { diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_morphology_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_morphology_element.h index 53d796f640b..17c83165feb 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_morphology_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_morphology_element.h @@ -37,6 +37,8 @@ class SVGFEMorphologyElement final public: DECLARE_NODE_FACTORY(SVGFEMorphologyElement); + explicit SVGFEMorphologyElement(Document&); + SVGAnimatedNumber* radiusX() { return radius_->FirstNumber(); } SVGAnimatedNumber* radiusY() { return radius_->SecondNumber(); } SVGAnimatedString* in1() { return in1_.Get(); } @@ -47,8 +49,6 @@ class SVGFEMorphologyElement final void Trace(blink::Visitor*) override; private: - explicit SVGFEMorphologyElement(Document&); - bool SetFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; void SvgAttributeChanged(const QualifiedName&) override; FilterEffect* Build(SVGFilterBuilder*, Filter*) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_offset_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_offset_element.h index 681d6efc8df..0263ec9a8cd 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_offset_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_offset_element.h @@ -33,6 +33,8 @@ class SVGFEOffsetElement final : public SVGFilterPrimitiveStandardAttributes { public: DECLARE_NODE_FACTORY(SVGFEOffsetElement); + explicit SVGFEOffsetElement(Document&); + SVGAnimatedNumber* dx() { return dx_.Get(); } SVGAnimatedNumber* dy() { return dy_.Get(); } SVGAnimatedString* in1() { return in1_.Get(); } @@ -40,8 +42,6 @@ class SVGFEOffsetElement final : public SVGFilterPrimitiveStandardAttributes { void Trace(blink::Visitor*) override; private: - explicit SVGFEOffsetElement(Document&); - void SvgAttributeChanged(const QualifiedName&) override; FilterEffect* Build(SVGFilterBuilder*, Filter*) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_point_light_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_point_light_element.h index 70f95be3668..710c32b9e92 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_point_light_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_point_light_element.h @@ -30,9 +30,9 @@ class SVGFEPointLightElement final : public SVGFELightElement { public: DECLARE_NODE_FACTORY(SVGFEPointLightElement); - private: explicit SVGFEPointLightElement(Document&); + private: scoped_refptr<LightSource> GetLightSource(Filter*) const override; }; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_specular_lighting_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_specular_lighting_element.h index 3b43fb37d53..8ac45e6adce 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_specular_lighting_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_specular_lighting_element.h @@ -36,6 +36,9 @@ class SVGFESpecularLightingElement final public: DECLARE_NODE_FACTORY(SVGFESpecularLightingElement); + + explicit SVGFESpecularLightingElement(Document&); + void LightElementAttributeChanged(const SVGFELightElement*, const QualifiedName&); @@ -53,8 +56,6 @@ class SVGFESpecularLightingElement final void Trace(blink::Visitor*) override; private: - explicit SVGFESpecularLightingElement(Document&); - bool SetFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; void SvgAttributeChanged(const QualifiedName&) override; FilterEffect* Build(SVGFilterBuilder*, Filter*) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_spot_light_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_spot_light_element.h index c26083481af..6fd49e7e829 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_spot_light_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_spot_light_element.h @@ -30,9 +30,9 @@ class SVGFESpotLightElement final : public SVGFELightElement { public: DECLARE_NODE_FACTORY(SVGFESpotLightElement); - private: explicit SVGFESpotLightElement(Document&); + private: scoped_refptr<LightSource> GetLightSource(Filter*) const override; }; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_tile_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_tile_element.h index bb22e4fea6e..b2c48456133 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_tile_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_tile_element.h @@ -31,13 +31,14 @@ class SVGFETileElement final : public SVGFilterPrimitiveStandardAttributes { public: DECLARE_NODE_FACTORY(SVGFETileElement); + + explicit SVGFETileElement(Document&); + SVGAnimatedString* in1() { return in1_.Get(); } void Trace(blink::Visitor*) override; private: - explicit SVGFETileElement(Document&); - void SvgAttributeChanged(const QualifiedName&) override; FilterEffect* Build(SVGFilterBuilder*, Filter*) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_fe_turbulence_element.h b/chromium/third_party/blink/renderer/core/svg/svg_fe_turbulence_element.h index 3540909aac6..b4b98004f57 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_fe_turbulence_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_fe_turbulence_element.h @@ -47,6 +47,8 @@ class SVGFETurbulenceElement final public: DECLARE_NODE_FACTORY(SVGFETurbulenceElement); + explicit SVGFETurbulenceElement(Document&); + SVGAnimatedNumber* baseFrequencyX() { return base_frequency_->FirstNumber(); } SVGAnimatedNumber* baseFrequencyY() { return base_frequency_->SecondNumber(); @@ -65,8 +67,6 @@ class SVGFETurbulenceElement final bool TaintsOrigin(bool inputs_taint_origin) const override { return false; } private: - explicit SVGFETurbulenceElement(Document&); - bool SetFilterEffectAttribute(FilterEffect*, const QualifiedName& attr_name) override; void SvgAttributeChanged(const QualifiedName&) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_filter_element.h b/chromium/third_party/blink/renderer/core/svg/svg_filter_element.h index a2bafdbdcc7..f78e53b72fc 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_filter_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_filter_element.h @@ -45,6 +45,7 @@ class CORE_EXPORT SVGFilterElement final : public SVGElement, DECLARE_NODE_FACTORY(SVGFilterElement); void Trace(blink::Visitor*) override; + explicit SVGFilterElement(Document&); ~SVGFilterElement() override; SVGAnimatedLength* x() const { return x_.Get(); } @@ -69,8 +70,6 @@ class CORE_EXPORT SVGFilterElement final : public SVGElement, LocalSVGResource* AssociatedResource() const; private: - explicit SVGFilterElement(Document&); - void SvgAttributeChanged(const QualifiedName&) override; void ChildrenChanged(const ChildrenChange&) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_foreign_object_element.h b/chromium/third_party/blink/renderer/core/svg/svg_foreign_object_element.h index 481cd953954..4717db6604d 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_foreign_object_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_foreign_object_element.h @@ -32,6 +32,8 @@ class SVGForeignObjectElement final : public SVGGraphicsElement { public: DECLARE_NODE_FACTORY(SVGForeignObjectElement); + explicit SVGForeignObjectElement(Document&); + SVGAnimatedLength* x() const { return x_.Get(); } SVGAnimatedLength* y() const { return y_.Get(); } SVGAnimatedLength* width() const { return width_.Get(); } @@ -40,8 +42,6 @@ class SVGForeignObjectElement final : public SVGGraphicsElement { void Trace(blink::Visitor*) override; private: - explicit SVGForeignObjectElement(Document&); - void CollectStyleForPresentationAttribute( const QualifiedName&, const AtomicString&, diff --git a/chromium/third_party/blink/renderer/core/svg/svg_g_element.h b/chromium/third_party/blink/renderer/core/svg/svg_g_element.h index db483e619e5..01b26095d5b 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_g_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_g_element.h @@ -31,9 +31,9 @@ class CORE_EXPORT SVGGElement final : public SVGGraphicsElement { public: DECLARE_NODE_FACTORY(SVGGElement); - protected: explicit SVGGElement(Document&, ConstructionType = kCreateSVGElement); + protected: LayoutObject* CreateLayoutObject(const ComputedStyle&) override; private: diff --git a/chromium/third_party/blink/renderer/core/svg/svg_geometry_element.idl b/chromium/third_party/blink/renderer/core/svg/svg_geometry_element.idl index 445c15b6e94..8145d5c79fa 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_geometry_element.idl +++ b/chromium/third_party/blink/renderer/core/svg/svg_geometry_element.idl @@ -34,8 +34,8 @@ interface SVGGeometryElement : SVGGraphicsElement { [SameObject] readonly attribute SVGAnimatedNumber pathLength; // TODO(foolip): SVGPoint should be DOMPoint. - boolean isPointInFill(SVGPoint point); - boolean isPointInStroke(SVGPoint point); - float getTotalLength(); - SVGPoint getPointAtLength(float distance); + [HighEntropy, Measure] boolean isPointInFill(SVGPoint point); + [HighEntropy, Measure] boolean isPointInStroke(SVGPoint point); + [HighEntropy, Measure] float getTotalLength(); + [HighEntropy, Measure] SVGPoint getPointAtLength(float distance); }; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_image_element.h b/chromium/third_party/blink/renderer/core/svg/svg_image_element.h index 333eb0dd6a3..1f69ea66c41 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_image_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_image_element.h @@ -42,6 +42,9 @@ class CORE_EXPORT SVGImageElement final public: DECLARE_NODE_FACTORY(SVGImageElement); + + explicit SVGImageElement(Document&); + void Trace(blink::Visitor*) override; bool CurrentFrameHasSingleSecurityOrigin() const; @@ -78,8 +81,6 @@ class CORE_EXPORT SVGImageElement final } private: - explicit SVGImageElement(Document&); - bool IsStructurallyExternal() const override { return !HrefString().IsNull(); } diff --git a/chromium/third_party/blink/renderer/core/svg/svg_image_element.idl b/chromium/third_party/blink/renderer/core/svg/svg_image_element.idl index 771e482ba48..b4339886bd5 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_image_element.idl +++ b/chromium/third_party/blink/renderer/core/svg/svg_image_element.idl @@ -37,7 +37,8 @@ // https://github.com/ojanvafai/intrinsicsize-attribute/blob/master/README.md [RuntimeEnabled=ExperimentalProductivityFeatures, CEReactions, Reflect] attribute DOMString intrinsicSize; - [CallWith=ScriptState, RaisesException] Promise decode(); + // Follow HTMLImageElement's spec + [CallWith=ScriptState, RaisesException] Promise<void> decode(); }; SVGImageElement implements SVGURIReference; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_line_element.h b/chromium/third_party/blink/renderer/core/svg/svg_line_element.h index 6d5f67fffda..291cc01b612 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_line_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_line_element.h @@ -33,6 +33,8 @@ class SVGLineElement final : public SVGGeometryElement { public: DECLARE_NODE_FACTORY(SVGLineElement); + explicit SVGLineElement(Document&); + Path AsPath() const override; SVGAnimatedLength* x1() const { return x1_.Get(); } @@ -43,8 +45,6 @@ class SVGLineElement final : public SVGGeometryElement { void Trace(blink::Visitor*) override; private: - explicit SVGLineElement(Document&); - void SvgAttributeChanged(const QualifiedName&) override; bool SelfHasRelativeLengths() const override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_linear_gradient_element.h b/chromium/third_party/blink/renderer/core/svg/svg_linear_gradient_element.h index 20094bdbdd1..d96aa75ecca 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_linear_gradient_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_linear_gradient_element.h @@ -35,6 +35,8 @@ class SVGLinearGradientElement final : public SVGGradientElement { public: DECLARE_NODE_FACTORY(SVGLinearGradientElement); + explicit SVGLinearGradientElement(Document&); + bool CollectGradientAttributes(LinearGradientAttributes&); SVGAnimatedLength* x1() const { return x1_.Get(); } @@ -45,8 +47,6 @@ class SVGLinearGradientElement final : public SVGGradientElement { void Trace(blink::Visitor*) override; private: - explicit SVGLinearGradientElement(Document&); - void SvgAttributeChanged(const QualifiedName&) override; LayoutObject* CreateLayoutObject(const ComputedStyle&) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_marker_element.h b/chromium/third_party/blink/renderer/core/svg/svg_marker_element.h index e667e9f152e..3cdf489124a 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_marker_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_marker_element.h @@ -58,6 +58,8 @@ class SVGMarkerElement final : public SVGElement, public SVGFitToViewBox { DECLARE_NODE_FACTORY(SVGMarkerElement); + explicit SVGMarkerElement(Document&); + AffineTransform ViewBoxToViewTransform(float view_width, float view_height) const; @@ -79,8 +81,6 @@ class SVGMarkerElement final : public SVGElement, public SVGFitToViewBox { void Trace(blink::Visitor*) override; private: - explicit SVGMarkerElement(Document&); - void SvgAttributeChanged(const QualifiedName&) override; void ChildrenChanged(const ChildrenChange&) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_mask_element.h b/chromium/third_party/blink/renderer/core/svg/svg_mask_element.h index 2ef0ea6ae6b..2db7d962e1c 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_mask_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_mask_element.h @@ -36,6 +36,8 @@ class SVGMaskElement final : public SVGElement, public SVGTests { public: DECLARE_NODE_FACTORY(SVGMaskElement); + explicit SVGMaskElement(Document&); + SVGAnimatedLength* x() const { return x_.Get(); } SVGAnimatedLength* y() const { return y_.Get(); } SVGAnimatedLength* width() const { return width_.Get(); } @@ -50,8 +52,6 @@ class SVGMaskElement final : public SVGElement, public SVGTests { void Trace(blink::Visitor*) override; private: - explicit SVGMaskElement(Document&); - bool IsValid() const override { return SVGTests::IsValid(); } void CollectStyleForPresentationAttribute( diff --git a/chromium/third_party/blink/renderer/core/svg/svg_metadata_element.h b/chromium/third_party/blink/renderer/core/svg/svg_metadata_element.h index 121a3fc1640..0a7d94cc81a 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_metadata_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_metadata_element.h @@ -31,9 +31,9 @@ class SVGMetadataElement final : public SVGElement { public: DECLARE_NODE_FACTORY(SVGMetadataElement); - private: explicit SVGMetadataElement(Document&); + private: bool LayoutObjectIsNeeded(const ComputedStyle&) const override { return false; } diff --git a/chromium/third_party/blink/renderer/core/svg/svg_mpath_element.h b/chromium/third_party/blink/renderer/core/svg/svg_mpath_element.h index 6bd308b33a0..4339ad71663 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_mpath_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_mpath_element.h @@ -34,6 +34,7 @@ class SVGMPathElement final : public SVGElement, public SVGURIReference { public: DECLARE_NODE_FACTORY(SVGMPathElement); + explicit SVGMPathElement(Document&); ~SVGMPathElement() override; SVGPathElement* PathElement(); @@ -43,8 +44,6 @@ class SVGMPathElement final : public SVGElement, public SVGURIReference { void Trace(blink::Visitor*) override; private: - explicit SVGMPathElement(Document&); - void BuildPendingResource() override; void ClearResourceReferences(); InsertionNotificationRequest InsertedInto(ContainerNode&) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_path_element.h b/chromium/third_party/blink/renderer/core/svg/svg_path_element.h index 3543b903aeb..29cafefe235 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_path_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_path_element.h @@ -35,6 +35,8 @@ class SVGPathElement final : public SVGGeometryElement { public: DECLARE_NODE_FACTORY(SVGPathElement); + explicit SVGPathElement(Document&); + Path AsPath() const override; Path AttributePath() const; @@ -52,8 +54,6 @@ class SVGPathElement final : public SVGGeometryElement { void Trace(blink::Visitor*) override; private: - explicit SVGPathElement(Document&); - const StylePath* GetStylePath() const; void SvgAttributeChanged(const QualifiedName&) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_pattern_element.h b/chromium/third_party/blink/renderer/core/svg/svg_pattern_element.h index 1775ff6ee9e..9374c2cebe4 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_pattern_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_pattern_element.h @@ -47,6 +47,8 @@ class SVGPatternElement final : public SVGElement, public: DECLARE_NODE_FACTORY(SVGPatternElement); + explicit SVGPatternElement(Document&); + void CollectPatternAttributes(PatternAttributes&) const; AffineTransform LocalCoordinateSpaceTransform(CTMScope) const override; @@ -83,8 +85,6 @@ class SVGPatternElement final : public SVGElement, void Trace(blink::Visitor*) override; private: - explicit SVGPatternElement(Document&); - bool IsValid() const override { return SVGTests::IsValid(); } void CollectStyleForPresentationAttribute( diff --git a/chromium/third_party/blink/renderer/core/svg/svg_polygon_element.h b/chromium/third_party/blink/renderer/core/svg/svg_polygon_element.h index 3b13774a3ac..442f0b09ff2 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_polygon_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_polygon_element.h @@ -31,10 +31,9 @@ class SVGPolygonElement final : public SVGPolyElement { public: DECLARE_NODE_FACTORY(SVGPolygonElement); - Path AsPath() const override; - - private: explicit SVGPolygonElement(Document&); + + Path AsPath() const override; }; } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/svg/svg_polyline_element.h b/chromium/third_party/blink/renderer/core/svg/svg_polyline_element.h index 671592f93af..e4d98e463c9 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_polyline_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_polyline_element.h @@ -31,10 +31,9 @@ class SVGPolylineElement final : public SVGPolyElement { public: DECLARE_NODE_FACTORY(SVGPolylineElement); - Path AsPath() const override; - - private: explicit SVGPolylineElement(Document&); + + Path AsPath() const override; }; } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/svg/svg_radial_gradient_element.h b/chromium/third_party/blink/renderer/core/svg/svg_radial_gradient_element.h index 15ebddadca4..52dadb77723 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_radial_gradient_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_radial_gradient_element.h @@ -35,6 +35,8 @@ class SVGRadialGradientElement final : public SVGGradientElement { public: DECLARE_NODE_FACTORY(SVGRadialGradientElement); + explicit SVGRadialGradientElement(Document&); + bool CollectGradientAttributes(RadialGradientAttributes&); SVGAnimatedLength* cx() const { return cx_.Get(); } @@ -47,8 +49,6 @@ class SVGRadialGradientElement final : public SVGGradientElement { void Trace(blink::Visitor*) override; private: - explicit SVGRadialGradientElement(Document&); - void SvgAttributeChanged(const QualifiedName&) override; LayoutObject* CreateLayoutObject(const ComputedStyle&) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_rect_element.h b/chromium/third_party/blink/renderer/core/svg/svg_rect_element.h index bbeaf633cb4..92d93e97368 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_rect_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_rect_element.h @@ -33,6 +33,8 @@ class SVGRectElement final : public SVGGeometryElement { public: DECLARE_NODE_FACTORY(SVGRectElement); + explicit SVGRectElement(Document&); + Path AsPath() const override; SVGAnimatedLength* x() const { return x_.Get(); } @@ -45,8 +47,6 @@ class SVGRectElement final : public SVGGeometryElement { void Trace(blink::Visitor*) override; private: - explicit SVGRectElement(Document&); - void CollectStyleForPresentationAttribute( const QualifiedName&, const AtomicString&, diff --git a/chromium/third_party/blink/renderer/core/svg/svg_resource.cc b/chromium/third_party/blink/renderer/core/svg/svg_resource.cc index bf7c8a10c7b..d767e45b99c 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_resource.cc +++ b/chromium/third_party/blink/renderer/core/svg/svg_resource.cc @@ -155,8 +155,8 @@ Element* ExternalSVGResource::ResolveTarget() { Document* external_document = resource_document_->GetDocument(); if (!external_document) return nullptr; - AtomicString decoded_fragment( - DecodeURLEscapeSequences(url_.FragmentIdentifier())); + AtomicString decoded_fragment(DecodeURLEscapeSequences( + url_.FragmentIdentifier(), DecodeURLMode::kUTF8OrIsomorphic)); return external_document->getElementById(decoded_fragment); } diff --git a/chromium/third_party/blink/renderer/core/svg/svg_script_element.h b/chromium/third_party/blink/renderer/core/svg/svg_script_element.h index 4525f28fb1c..5fe1cc2b236 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_script_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_script_element.h @@ -76,6 +76,7 @@ class SVGScriptElement final : public SVGElement, String ForAttributeValue() const override { return String(); } String IntegrityAttributeValue() const override { return String(); } String ReferrerPolicyAttributeValue() const override { return String(); } + String ImportanceAttributeValue() const override { return String(); } String LanguageAttributeValue() const override { return String(); } bool NomoduleAttributeValue() const override { return false; } String SourceAttributeValue() const override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_set_element.h b/chromium/third_party/blink/renderer/core/svg/svg_set_element.h index 091f3394e30..ab2cd1d9a0b 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_set_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_set_element.h @@ -33,8 +33,9 @@ class CORE_EXPORT SVGSetElement final : public SVGAnimateElement { public: DECLARE_NODE_FACTORY(SVGSetElement); - private: explicit SVGSetElement(Document&); + + private: void UpdateAnimationMode() override; }; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_stop_element.cc b/chromium/third_party/blink/renderer/core/svg/svg_stop_element.cc index 03ecf0e995d..18bf8292453 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_stop_element.cc +++ b/chromium/third_party/blink/renderer/core/svg/svg_stop_element.cc @@ -80,8 +80,8 @@ Color SVGStopElement::StopColorIncludingOpacity() const { if (!style) return Color::kBlack; - const SVGComputedStyle& svg_style = style->SvgStyle(); - return svg_style.StopColor().CombineWithAlpha(svg_style.StopOpacity()); + Color base_color = style->VisitedDependentColor(GetCSSPropertyStopColor()); + return base_color.CombineWithAlpha(style->SvgStyle().StopOpacity()); } } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/svg/svg_stop_element.h b/chromium/third_party/blink/renderer/core/svg/svg_stop_element.h index 7388b4d2754..15aceeee536 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_stop_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_stop_element.h @@ -35,6 +35,8 @@ class SVGStopElement final : public SVGElement { public: DECLARE_NODE_FACTORY(SVGStopElement); + explicit SVGStopElement(Document&); + Color StopColorIncludingOpacity() const; SVGAnimatedNumber* offset() const { return offset_.Get(); } @@ -45,8 +47,6 @@ class SVGStopElement final : public SVGElement { void DidRecalcStyle(StyleRecalcChange) override; private: - explicit SVGStopElement(Document&); - void SvgAttributeChanged(const QualifiedName&) override; // Stop elements don't have associated layout objects diff --git a/chromium/third_party/blink/renderer/core/svg/svg_string_list.h b/chromium/third_party/blink/renderer/core/svg/svg_string_list.h index 82178789885..ec8f192f0dc 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_string_list.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_string_list.h @@ -113,8 +113,10 @@ template <char list_delimiter> class SVGStringList final : public SVGStringListBase { public: static SVGStringList<list_delimiter>* Create() { - return new SVGStringList<list_delimiter>(); + return MakeGarbageCollected<SVGStringList<list_delimiter>>(); } + + SVGStringList() = default; ~SVGStringList() override = default; SVGParsingError SetValueAsString(const String& data) override { @@ -125,9 +127,6 @@ class SVGStringList final : public SVGStringListBase { String ValueAsString() const override { return SVGStringListBase::ValueAsStringWithDelimiter(list_delimiter); } - - private: - SVGStringList() = default; }; } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/svg/svg_svg_element.h b/chromium/third_party/blink/renderer/core/svg/svg_svg_element.h index 550b9290cd1..d145053abd0 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_svg_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_svg_element.h @@ -49,6 +49,8 @@ class SVGSVGElement final : public SVGGraphicsElement, public: DECLARE_NODE_FACTORY(SVGSVGElement); + explicit SVGSVGElement(Document&); + float IntrinsicWidth() const; float IntrinsicHeight() const; FloatSize CurrentViewportSize() const; @@ -112,7 +114,6 @@ class SVGSVGElement final : public SVGGraphicsElement, void Trace(blink::Visitor*) override; private: - explicit SVGSVGElement(Document&); ~SVGSVGElement() override; void SetViewSpec(const SVGViewSpec*); diff --git a/chromium/third_party/blink/renderer/core/svg/svg_switch_element.h b/chromium/third_party/blink/renderer/core/svg/svg_switch_element.h index 3d6e1aee973..b930f457a3e 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_switch_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_switch_element.h @@ -31,9 +31,9 @@ class SVGSwitchElement final : public SVGGraphicsElement { public: DECLARE_NODE_FACTORY(SVGSwitchElement); - private: explicit SVGSwitchElement(Document&); + private: LayoutObject* CreateLayoutObject(const ComputedStyle&) override; }; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_symbol_element.h b/chromium/third_party/blink/renderer/core/svg/svg_symbol_element.h index 73bfbcb7363..bc4e9b6200b 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_symbol_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_symbol_element.h @@ -33,11 +33,11 @@ class SVGSymbolElement final : public SVGElement, public SVGFitToViewBox { public: DECLARE_NODE_FACTORY(SVGSymbolElement); + explicit SVGSymbolElement(Document&); + void Trace(blink::Visitor*) override; private: - explicit SVGSymbolElement(Document&); - void SvgAttributeChanged(const QualifiedName&) override; LayoutObject* CreateLayoutObject(const ComputedStyle&) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_text_content_element.idl b/chromium/third_party/blink/renderer/core/svg/svg_text_content_element.idl index 4617f7f3457..6557fcf63d8 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_text_content_element.idl +++ b/chromium/third_party/blink/renderer/core/svg/svg_text_content_element.idl @@ -35,12 +35,12 @@ interface SVGTextContentElement : SVGGraphicsElement { [MeasureAs=SVG1DOMText] readonly attribute SVGAnimatedEnumeration lengthAdjust; long getNumberOfChars(); - float getComputedTextLength(); - [RaisesException] float getSubStringLength(unsigned long charnum, unsigned long nchars); + [HighEntropy, Measure] float getComputedTextLength(); + [HighEntropy, Measure, RaisesException] float getSubStringLength(unsigned long charnum, unsigned long nchars); // TODO(foolip): SVGPoint/SVGRect should be DOMPoint/DOMRect. - [RaisesException] SVGPoint getStartPositionOfChar(unsigned long charnum); - [RaisesException] SVGPoint getEndPositionOfChar(unsigned long charnum); - [RaisesException] SVGRect getExtentOfChar(unsigned long charnum); + [HighEntropy, Measure, RaisesException] SVGPoint getStartPositionOfChar(unsigned long charnum); + [HighEntropy, Measure, RaisesException] SVGPoint getEndPositionOfChar(unsigned long charnum); + [HighEntropy, Measure, RaisesException] SVGRect getExtentOfChar(unsigned long charnum); [RaisesException] float getRotationOfChar(unsigned long charnum); [RaisesException] long getCharNumAtPosition(SVGPoint point); [RaisesException] void selectSubString(unsigned long charnum, unsigned long nchars); diff --git a/chromium/third_party/blink/renderer/core/svg/svg_text_element.h b/chromium/third_party/blink/renderer/core/svg/svg_text_element.h index f1a68930f58..6bcf729e4b4 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_text_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_text_element.h @@ -31,9 +31,9 @@ class SVGTextElement final : public SVGTextPositioningElement { public: DECLARE_NODE_FACTORY(SVGTextElement); - private: explicit SVGTextElement(Document&); + private: LayoutObject* CreateLayoutObject(const ComputedStyle&) override; }; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_text_path_element.h b/chromium/third_party/blink/renderer/core/svg/svg_text_path_element.h index 48a53d9510a..1b271130732 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_text_path_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_text_path_element.h @@ -58,6 +58,8 @@ class SVGTextPathElement final : public SVGTextContentElement, DECLARE_NODE_FACTORY(SVGTextPathElement); + explicit SVGTextPathElement(Document&); + SVGAnimatedLength* startOffset() const { return start_offset_.Get(); } SVGAnimatedEnumeration<SVGTextPathMethodType>* method() { return method_.Get(); @@ -69,8 +71,6 @@ class SVGTextPathElement final : public SVGTextContentElement, void Trace(blink::Visitor*) override; private: - explicit SVGTextPathElement(Document&); - ~SVGTextPathElement() override; void ClearResourceReferences(); diff --git a/chromium/third_party/blink/renderer/core/svg/svg_title_element.h b/chromium/third_party/blink/renderer/core/svg/svg_title_element.h index 6b662d3de67..38021cb8ac7 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_title_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_title_element.h @@ -31,11 +31,11 @@ class SVGTitleElement final : public SVGElement { public: DECLARE_NODE_FACTORY(SVGTitleElement); + explicit SVGTitleElement(Document&); + void SetText(const String&); private: - explicit SVGTitleElement(Document&); - InsertionNotificationRequest InsertedInto(ContainerNode&) override; void RemovedFrom(ContainerNode&) override; void ChildrenChanged(const ChildrenChange&) override; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_transform.cc b/chromium/third_party/blink/renderer/core/svg/svg_transform.cc index 0c8ca92dc36..3aea44c7a54 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_transform.cc +++ b/chromium/third_party/blink/renderer/core/svg/svg_transform.cc @@ -20,6 +20,7 @@ #include "third_party/blink/renderer/core/svg/svg_transform.h" +#include "base/stl_util.h" #include "third_party/blink/renderer/platform/geometry/float_size.h" #include "third_party/blink/renderer/platform/wtf/math_extras.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" @@ -202,7 +203,7 @@ String SVGTransform::ValueAsString() const { arguments[argument_count++] = angle_; break; } - DCHECK_LE(argument_count, arraysize(arguments)); + DCHECK_LE(argument_count, base::size(arguments)); StringBuilder builder; builder.Append(TransformTypePrefixForParsing(transform_type_)); diff --git a/chromium/third_party/blink/renderer/core/svg/svg_transform_list.cc b/chromium/third_party/blink/renderer/core/svg/svg_transform_list.cc index f00965a4bdf..dc48edb1706 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_transform_list.cc +++ b/chromium/third_party/blink/renderer/core/svg/svg_transform_list.cc @@ -23,6 +23,7 @@ #include "third_party/blink/renderer/core/svg/svg_transform_list.h" +#include "base/stl_util.h" #include "third_party/blink/renderer/core/css/css_function_value.h" #include "third_party/blink/renderer/core/css/css_identifier_value.h" #include "third_party/blink/renderer/core/css/css_primitive_value.h" @@ -204,10 +205,10 @@ static_assert(kSvgTransformSkewx == 5, "index of kSvgTransformSkewx has changed"); static_assert(kSvgTransformSkewy == 6, "index of kSvgTransformSkewy has changed"); -static_assert(arraysize(kRequiredValuesForType) - 1 == kSvgTransformSkewy, +static_assert(base::size(kRequiredValuesForType) - 1 == kSvgTransformSkewy, "the number of transform types have changed"); -static_assert(arraysize(kRequiredValuesForType) == - arraysize(kOptionalValuesForType), +static_assert(base::size(kRequiredValuesForType) == + base::size(kOptionalValuesForType), "the arrays should have the same number of elements"); const unsigned kMaxTransformArguments = 6; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_tspan_element.h b/chromium/third_party/blink/renderer/core/svg/svg_tspan_element.h index 7870fee9436..6ffdf83b983 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_tspan_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_tspan_element.h @@ -31,9 +31,9 @@ class SVGTSpanElement final : public SVGTextPositioningElement { public: DECLARE_NODE_FACTORY(SVGTSpanElement); - private: explicit SVGTSpanElement(Document&); + private: LayoutObject* CreateLayoutObject(const ComputedStyle&) override; bool LayoutObjectIsNeeded(const ComputedStyle&) const override; }; diff --git a/chromium/third_party/blink/renderer/core/svg/svg_uri_reference.cc b/chromium/third_party/blink/renderer/core/svg/svg_uri_reference.cc index bce67926c47..3f4d84ac246 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_uri_reference.cc +++ b/chromium/third_party/blink/renderer/core/svg/svg_uri_reference.cc @@ -90,8 +90,8 @@ bool SVGURLReferenceResolver::IsLocal() const { AtomicString SVGURLReferenceResolver::FragmentIdentifier() const { // Use KURL's FragmentIdentifier to ensure that we're handling the // fragment in a consistent manner. - return AtomicString( - DecodeURLEscapeSequences(AbsoluteUrl().FragmentIdentifier())); + return AtomicString(DecodeURLEscapeSequences( + AbsoluteUrl().FragmentIdentifier(), DecodeURLMode::kUTF8OrIsomorphic)); } AtomicString SVGURIReference::FragmentIdentifierFromIRIString( @@ -138,8 +138,8 @@ Element* SVGURIReference::ObserveTarget(Member<IdTargetObserver>& observer, DCHECK(!observer); if (id.IsEmpty()) return nullptr; - observer = - new SVGElementReferenceObserver(tree_scope, id, std::move(closure)); + observer = MakeGarbageCollected<SVGElementReferenceObserver>( + tree_scope, id, std::move(closure)); return tree_scope.getElementById(id); } diff --git a/chromium/third_party/blink/renderer/core/svg/svg_use_element.cc b/chromium/third_party/blink/renderer/core/svg/svg_use_element.cc index 93c756faa29..46096de8d1e 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_use_element.cc +++ b/chromium/third_party/blink/renderer/core/svg/svg_use_element.cc @@ -307,8 +307,8 @@ void SVGUseElement::ClearResourceReference() { Element* SVGUseElement::ResolveTargetElement(ObserveBehavior observe_behavior) { if (!element_url_.HasFragmentIdentifier()) return nullptr; - AtomicString element_identifier( - DecodeURLEscapeSequences(element_url_.FragmentIdentifier())); + AtomicString element_identifier(DecodeURLEscapeSequences( + element_url_.FragmentIdentifier(), DecodeURLMode::kUTF8OrIsomorphic)); if (!IsStructurallyExternal()) { if (observe_behavior == kDontAddObserver) return GetTreeScope().getElementById(element_identifier); diff --git a/chromium/third_party/blink/renderer/core/svg/svg_view_element.h b/chromium/third_party/blink/renderer/core/svg/svg_view_element.h index c5ec9528c2f..ba9c3388d42 100644 --- a/chromium/third_party/blink/renderer/core/svg/svg_view_element.h +++ b/chromium/third_party/blink/renderer/core/svg/svg_view_element.h @@ -36,11 +36,12 @@ class SVGViewElement final : public SVGElement, public: DECLARE_NODE_FACTORY(SVGViewElement); - void Trace(blink::Visitor*) override; - private: explicit SVGViewElement(Document&); + void Trace(blink::Visitor*) override; + + private: void ParseAttribute(const AttributeModificationParams&) override; bool LayoutObjectIsNeeded(const ComputedStyle&) const override { diff --git a/chromium/third_party/blink/renderer/core/svg/unsafe_svg_attribute_sanitization_test.cc b/chromium/third_party/blink/renderer/core/svg/unsafe_svg_attribute_sanitization_test.cc index f046a182192..3f7faec720d 100644 --- a/chromium/third_party/blink/renderer/core/svg/unsafe_svg_attribute_sanitization_test.cc +++ b/chromium/third_party/blink/renderer/core/svg/unsafe_svg_attribute_sanitization_test.cc @@ -210,11 +210,11 @@ TEST( << sanitized_content.Utf8().data(); } -// Other sanitization integration tests are layout tests that use +// Other sanitization integration tests are web tests that use // document.execCommand('Copy') to source content that they later // paste. However SVG animation elements are not serialized when // copying, which means we can't test sanitizing these attributes in -// layout tests: there is nowhere to source the unsafe content from. +// web tests: there is nowhere to source the unsafe content from. TEST(UnsafeSVGAttributeSanitizationTest, pasteAnimatedAnchor_javaScriptHrefIsStripped_caseAndEntityInProtocol) { std::unique_ptr<DummyPageHolder> page_holder = |