-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[view-transitions] Implement "update pseudo-element styles" algorithm.
https://bugs.webkit.org/show_bug.cgi?id=265224 rdar://118703293> Reviewed by Tim Nguyen. Implements the basic outline of capturing the computed style from both the old and new elements, and using these to generate a style rule for the selector ':root::view-transition-group(transitionName)'. Adds a mostly empty RenderViewTransitionOld class that we will use for the replaced snapshot content, but just acts as a placeholder for the intrinsic size right now. With these changes, the size of the transitioned element now gets applied correctly to the :view-transition-new/old renderers, and styles targetting them (like background color) correctly get applied and rendered. The next step is to implement the 'capture the image' algorithm for new and old (likely splitting RenderViewTransformNew as a separate class), so that we also include the replaced content. * Source/WebCore/Sources.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/dom/ViewTransition.cpp: (WebCore::ViewTransition::captureOldState): (WebCore::ViewTransition::handleTransitionFrame): (WebCore::ViewTransition::copyElementBaseProperties): (WebCore::ViewTransition::updatePseudoElementStyles): * Source/WebCore/dom/ViewTransition.h: (WebCore::OrderedNamedElementsMap::map const): (WebCore::OrderedNamedElementsMap::find const): * Source/WebCore/rendering/RenderObject.h: (WebCore::RenderObject::isRenderViewTransitionOld const): * Source/WebCore/rendering/RenderViewTransitionOld.cpp: Added. (WebCore::RenderViewTransitionOld::RenderViewTransitionOld): (WebCore::RenderViewTransitionOld::setImage): * Source/WebCore/rendering/RenderViewTransitionOld.h: Added. * Source/WebCore/rendering/updating/RenderTreeUpdaterViewTransition.cpp: (WebCore::RenderTreeUpdater::ViewTransition::buildPseudoElementGroup): (WebCore::RenderTreeUpdater::ViewTransition::updatePseudoElementGroup): * Source/WebCore/style/ElementRuleCollector.cpp: (WebCore::Style::ElementRuleCollector::ElementRuleCollector): (WebCore::Style::ElementRuleCollector::matchUARules): * Source/WebCore/style/ElementRuleCollector.h: * Source/WebCore/style/StyleResolver.cpp: (WebCore::Style::Resolver::applyMatchedProperties): (WebCore::Style::Resolver::setViewTransitionGroupStyles): * Source/WebCore/style/StyleResolver.h: * Source/WebCore/style/StyleScope.cpp: (WebCore::Style::Scope::createDocumentResolver): * Source/WebCore/style/StyleScope.h: * Source/WebCore/style/StyleScopeRuleSets.cpp: (WebCore::Style::ScopeRuleSets::dynamicViewTransitionsStyle const): * Source/WebCore/style/StyleScopeRuleSets.h: (WebCore::Style::ScopeRuleSets::setDynamicViewTransitionsStyle): Canonical link: https://commits.webkit.org/274817@main
- Loading branch information
1 parent
be619ad
commit 810e27d
Showing
17 changed files
with
273 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (C) 2024 Apple Inc. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
* THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#include "config.h" | ||
#include "RenderViewTransitionCapture.h" | ||
|
||
#include "RenderBoxModelObjectInlines.h" | ||
|
||
namespace WebCore { | ||
|
||
WTF_MAKE_ISO_ALLOCATED_IMPL(RenderViewTransitionCapture); | ||
|
||
RenderViewTransitionCapture::RenderViewTransitionCapture(Type type, Document& document, RenderStyle&& style) | ||
: RenderReplaced(type, document, WTFMove(style), { }, ReplacedFlag::IsViewTransitionCapture) | ||
{ } | ||
|
||
void RenderViewTransitionCapture::setImage(const LayoutSize& size) | ||
{ | ||
setIntrinsicSize(size); | ||
} | ||
|
||
} // namespace WebCore |
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,48 @@ | ||
/* | ||
* Copyright (C) 2024 Apple Inc. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
* THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "RenderReplaced.h" | ||
|
||
namespace WebCore { | ||
|
||
class RenderViewTransitionCapture : public RenderReplaced { | ||
WTF_MAKE_ISO_ALLOCATED(RenderViewTransitionCapture); | ||
public: | ||
RenderViewTransitionCapture(Type, Document&, RenderStyle&&); | ||
|
||
// FIXME: This should be setting the actual image, as well as the instrinsic | ||
// size | ||
void setImage(const LayoutSize&); | ||
|
||
private: | ||
ASCIILiteral renderName() const override { return style().pseudoElementType() == PseudoId::ViewTransitionNew ? "RenderViewTransitionNew"_s : "RenderViewTransitionOld"_s; } | ||
|
||
}; | ||
|
||
} // namespace WebCore | ||
|
||
SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderViewTransitionCapture, isRenderViewTransitionCapture()) |
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
Oops, something went wrong.