Diff
Modified: trunk/LayoutTests/ChangeLog (277537 => 277538)
--- trunk/LayoutTests/ChangeLog 2021-05-15 11:00:45 UTC (rev 277537)
+++ trunk/LayoutTests/ChangeLog 2021-05-15 12:47:21 UTC (rev 277538)
@@ -1,3 +1,14 @@
+2021-05-15 Antti Koivisto <[email protected]>
+
+ Don't allow :visited link style in subtrees that use mix-blend-mode
+ https://bugs.webkit.org/show_bug.cgi?id=225446
+ rdar://65686091
+
+ Reviewed by Darin Adler.
+
+ * fast/css/visited-link-mix-blend-mode-expected.html: Added.
+ * fast/css/visited-link-mix-blend-mode.html: Added.
+
2021-05-14 John Wilander <[email protected]>
_javascript_ can't access a SameSite=Strict cookie after page is loaded after a redirect from a third party site
Added: trunk/LayoutTests/fast/css/visited-link-mix-blend-mode-expected.html (0 => 277538)
--- trunk/LayoutTests/fast/css/visited-link-mix-blend-mode-expected.html (rev 0)
+++ trunk/LayoutTests/fast/css/visited-link-mix-blend-mode-expected.html 2021-05-15 12:47:21 UTC (rev 277538)
@@ -0,0 +1,26 @@
+<style>
+.box { position: relative; width: 100px; height:100px; }
+a { display: block; position: relative; width: 100px; height:100px; background-color: green; }
+.background { background-color: green; }
+.multiply { mix-blend-mode: multiply; }
+</style>
+<div>
+ <div class="box background">
+ <a class="multiply"></a>
+ </div>
+ <div class="box background">
+ <a class="multiply"></a>
+ </div>
+ <div class="box background">
+ <a class="multiply"></a>
+ </div>
+ <div class="box background">
+ <a class="multiply"></a>
+ </div>
+ <div class="box background">
+ <a class="multiply"></a>
+ </div>
+ <div class="box background">
+ <a class="multiply"></a>
+ </div>
+</div>
Added: trunk/LayoutTests/fast/css/visited-link-mix-blend-mode.html (0 => 277538)
--- trunk/LayoutTests/fast/css/visited-link-mix-blend-mode.html (rev 0)
+++ trunk/LayoutTests/fast/css/visited-link-mix-blend-mode.html 2021-05-15 12:47:21 UTC (rev 277538)
@@ -0,0 +1,40 @@
+<style>
+.box { position: relative; width: 100px; height:100px; }
+a { display: block; position: relative; width: 100px; height:100px; background-color: green; }
+a:visited { background-color: red; }
+.background { background-color: green; }
+.multiply { mix-blend-mode: multiply; }
+</style>
+<div>
+ <div class="box background">
+ <a class="multiply"></a>
+ </div>
+ <div class="box background">
+ <a class="multiply" href=""
+ </div>
+ <div class="box background">
+ <div class="box multiply">
+ <a></a>
+ </div>
+ </div>
+ <div class="box background">
+ <div class="box multiply">
+ <a href=""
+ </div>
+ </div>
+ <div class="box background">
+ <div class="box add_multiply">
+ <a></a>
+ </div>
+ </div>
+ <div class="box background">
+ <div class="box add_multiply">
+ <a href=""
+ </div>
+ </div>
+</div>
+<script>
+document.body.offsetLeft;
+for (element of document.querySelectorAll(".add_multiply"))
+ element.classList.add("multiply");
+</script>
Modified: trunk/LayoutTests/platform/win/TestExpectations (277537 => 277538)
--- trunk/LayoutTests/platform/win/TestExpectations 2021-05-15 11:00:45 UTC (rev 277537)
+++ trunk/LayoutTests/platform/win/TestExpectations 2021-05-15 12:47:21 UTC (rev 277538)
@@ -649,6 +649,7 @@
# TODO CSS_COMPOSITING is disabled (CIFilters don't work on Windows)
css3/blending/ [ Skip ]
transitions/blendmode-transitions.html [ Skip ]
+fast/css/visited-link-mix-blend-mode.html [ Skip ]
# Backdrop Filters do not work on Windows
fast/css/will-change/will-change-creates-stacking-context-inline.html [ ImageOnlyFailure ]
Modified: trunk/Source/WebCore/ChangeLog (277537 => 277538)
--- trunk/Source/WebCore/ChangeLog 2021-05-15 11:00:45 UTC (rev 277537)
+++ trunk/Source/WebCore/ChangeLog 2021-05-15 12:47:21 UTC (rev 277538)
@@ -1,3 +1,29 @@
+2021-05-15 Antti Koivisto <[email protected]>
+
+ Don't allow :visited link style in subtrees that use mix-blend-mode
+ https://bugs.webkit.org/show_bug.cgi?id=225446
+ rdar://65686091
+
+ Reviewed by Darin Adler.
+
+ Test: fast/css/visited-link-mix-blend-mode.html
+
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::visitedDependentColor const):
+
+ Return unvisited style in substrees that use mix-blend-mode.
+
+ * rendering/style/RenderStyle.h:
+ (WebCore::RenderStyle::setBlendMode):
+ (WebCore::RenderStyle::isInSubtreeWithBlendMode const):
+
+ Add an inherited fake property for tracking this.
+
+ * rendering/style/StyleRareInheritedData.cpp:
+ (WebCore::StyleRareInheritedData::StyleRareInheritedData):
+ (WebCore::StyleRareInheritedData::operator== const):
+ * rendering/style/StyleRareInheritedData.h:
+
2021-05-14 Chris Dumez <[email protected]>
Drop FileSystem::fileMetadata() / fileMetadataFollowingSymlinks()
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (277537 => 277538)
--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2021-05-15 11:00:45 UTC (rev 277537)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2021-05-15 12:47:21 UTC (rev 277538)
@@ -2114,6 +2114,11 @@
if (insideLink() != InsideLink::InsideVisited)
return unvisitedColor;
+#if ENABLE(CSS_COMPOSITING)
+ if (isInSubtreeWithBlendMode())
+ return unvisitedColor;
+#endif
+
Color visitedColor = colorResolvingCurrentColor(colorProperty, true);
// FIXME: Technically someone could explicitly specify the color transparent, but for now we'll just
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (277537 => 277538)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2021-05-15 11:00:45 UTC (rev 277537)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2021-05-15 12:47:21 UTC (rev 277538)
@@ -821,8 +821,9 @@
#if ENABLE(CSS_COMPOSITING)
BlendMode blendMode() const { return static_cast<BlendMode>(m_rareNonInheritedData->effectiveBlendMode); }
- void setBlendMode(BlendMode mode) { SET_VAR(m_rareNonInheritedData, effectiveBlendMode, static_cast<unsigned>(mode)); }
+ void setBlendMode(BlendMode);
bool hasBlendMode() const { return static_cast<BlendMode>(m_rareNonInheritedData->effectiveBlendMode) != BlendMode::Normal; }
+ bool isInSubtreeWithBlendMode() const { return m_rareInheritedData->isInSubtreeWithBlendMode; }
Isolation isolation() const { return static_cast<Isolation>(m_rareNonInheritedData->isolation); }
void setIsolation(Isolation isolation) { SET_VAR(m_rareNonInheritedData, isolation, static_cast<unsigned>(isolation)); }
@@ -2205,6 +2206,14 @@
return static_cast<ImageOrientation::Orientation>(m_rareInheritedData->imageOrientation);
}
+#if ENABLE(CSS_COMPOSITING)
+inline void RenderStyle::setBlendMode(BlendMode mode)
+{
+ SET_VAR(m_rareNonInheritedData, effectiveBlendMode, static_cast<unsigned>(mode));
+ SET_VAR(m_rareInheritedData, isInSubtreeWithBlendMode, mode != BlendMode::Normal);
+}
+#endif
+
inline void RenderStyle::setLogicalWidth(Length&& logicalWidth)
{
if (isHorizontalWritingMode())
Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp (277537 => 277538)
--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp 2021-05-15 11:00:45 UTC (rev 277537)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp 2021-05-15 12:47:21 UTC (rev 277538)
@@ -135,6 +135,7 @@
, mathStyle(static_cast<unsigned>(RenderStyle::initialMathStyle()))
, hasAutoCaretColor(true)
, hasVisitedLinkAutoCaretColor(true)
+ , isInSubtreeWithBlendMode(false)
, effectiveTouchActions(RenderStyle::initialTouchActions())
, strokeWidth(RenderStyle::initialStrokeWidth())
, strokeColor(RenderStyle::initialStrokeColor())
@@ -231,6 +232,7 @@
, mathStyle(o.mathStyle)
, hasAutoCaretColor(o.hasAutoCaretColor)
, hasVisitedLinkAutoCaretColor(o.hasVisitedLinkAutoCaretColor)
+ , isInSubtreeWithBlendMode(o.isInSubtreeWithBlendMode)
, effectiveTouchActions(o.effectiveTouchActions)
, eventListenerRegionTypes(o.eventListenerRegionTypes)
, strokeWidth(o.strokeWidth)
@@ -354,6 +356,7 @@
&& mathStyle == o.mathStyle
&& hasAutoCaretColor == o.hasAutoCaretColor
&& hasVisitedLinkAutoCaretColor == o.hasVisitedLinkAutoCaretColor
+ && isInSubtreeWithBlendMode == o.isInSubtreeWithBlendMode
&& effectiveTouchActions == o.effectiveTouchActions
&& eventListenerRegionTypes == o.eventListenerRegionTypes
&& strokeWidth == o.strokeWidth
Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h (277537 => 277538)
--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h 2021-05-15 11:00:45 UTC (rev 277537)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h 2021-05-15 12:47:21 UTC (rev 277538)
@@ -161,6 +161,8 @@
unsigned hasAutoCaretColor : 1;
unsigned hasVisitedLinkAutoCaretColor : 1;
+ unsigned isInSubtreeWithBlendMode : 1;
+
OptionSet<TouchAction> effectiveTouchActions;
OptionSet<EventListenerRegionType> eventListenerRegionTypes;