forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CompositeClipPathAnimations]Fall back to main thread if clip-path an…
…imation is not compositable Integrate fall back logic implemented for composited background-color animations in https://chromium-review.googlesource.com/c/chromium/src/+/2588636 Bug: 1245361 Change-Id: I0fa917330a83b1b3e7d14bbfa9efd23a846eb851 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3133755 Commit-Queue: Olga Gerchikov <gerchiko@microsoft.com> Reviewed-by: Xida Chen <xidachen@chromium.org> Reviewed-by: Philip Rogers <pdr@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Cr-Commit-Position: refs/heads/main@{#918328}
- Loading branch information
1 parent
d0980af
commit c56accc
Showing
15 changed files
with
146 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
third_party/blink/renderer/modules/csspaint/nativepaint/clip_path_paint_definition_test.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Copyright 2021 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "third_party/blink/renderer/modules/csspaint/nativepaint/clip_path_paint_definition.h" | ||
|
||
#include "testing/gmock/include/gmock/gmock.h" | ||
#include "third_party/blink/renderer/core/animation/document_timeline.h" | ||
#include "third_party/blink/renderer/core/animation/element_animations.h" | ||
#include "third_party/blink/renderer/core/animation/keyframe_effect.h" | ||
#include "third_party/blink/renderer/core/animation/string_keyframe.h" | ||
#include "third_party/blink/renderer/core/animation/timing.h" | ||
#include "third_party/blink/renderer/core/dom/element.h" | ||
#include "third_party/blink/renderer/core/testing/page_test_base.h" | ||
|
||
namespace blink { | ||
|
||
class ClipPathPaintDefinitionTest : public PageTestBase { | ||
public: | ||
ClipPathPaintDefinitionTest() = default; | ||
~ClipPathPaintDefinitionTest() override = default; | ||
}; | ||
|
||
// Test the case where there is a background-color animation with two simple | ||
// keyframes that will not fall back to main. | ||
TEST_F(ClipPathPaintDefinitionTest, SimpleClipPathAnimationNotFallback) { | ||
ScopedCompositeClipPathAnimationForTest composite_clip_path_animation(true); | ||
SetBodyInnerHTML(R"HTML( | ||
<div id ="target" style="width: 100px; height: 100px"> | ||
</div> | ||
)HTML"); | ||
|
||
Timing timing; | ||
timing.iteration_duration = AnimationTimeDelta::FromSecondsD(30); | ||
|
||
CSSPropertyID property_id = CSSPropertyID::kClipPath; | ||
Persistent<StringKeyframe> start_keyframe = | ||
MakeGarbageCollected<StringKeyframe>(); | ||
start_keyframe->SetCSSPropertyValue(property_id, "circle(50% at 50% 50%)", | ||
SecureContextMode::kInsecureContext, | ||
nullptr); | ||
Persistent<StringKeyframe> end_keyframe = | ||
MakeGarbageCollected<StringKeyframe>(); | ||
end_keyframe->SetCSSPropertyValue(property_id, "circle(30% at 30% 30%)", | ||
SecureContextMode::kInsecureContext, | ||
nullptr); | ||
|
||
StringKeyframeVector keyframes; | ||
keyframes.push_back(start_keyframe); | ||
keyframes.push_back(end_keyframe); | ||
|
||
auto* model = MakeGarbageCollected<StringKeyframeEffectModel>(keyframes); | ||
model->SetComposite(EffectModel::kCompositeReplace); | ||
|
||
Element* element = GetElementById("target"); | ||
NonThrowableExceptionState exception_state; | ||
DocumentTimeline* timeline = | ||
MakeGarbageCollected<DocumentTimeline>(&GetDocument()); | ||
Animation* animation = Animation::Create( | ||
MakeGarbageCollected<KeyframeEffect>(element, model, timing), timeline, | ||
exception_state); | ||
UpdateAllLifecyclePhasesForTest(); | ||
animation->play(); | ||
|
||
EXPECT_TRUE(element->GetElementAnimations()); | ||
EXPECT_EQ(element->GetElementAnimations()->Animations().size(), 1u); | ||
EXPECT_EQ(ClipPathPaintDefinition::GetAnimationIfCompositable(element), | ||
animation); | ||
} | ||
|
||
} // namespace blink |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters