diff --git a/LayoutTests/fast/text/text-combine-upright-text-transform-expected.html b/LayoutTests/fast/text/text-combine-upright-text-transform-expected.html
new file mode 100644
index 000000000000..66d5f81627b0
--- /dev/null
+++ b/LayoutTests/fast/text/text-combine-upright-text-transform-expected.html
@@ -0,0 +1,10 @@
+
+
+Test text-combine-upright: all + text-transform
+text-transform: capitalize
+The following "a" should be upright and captalize: A
+text-transform: lowercase
+The following "A" should be upright and lowercase: a
+text-transform: uppercase
+The following "a" should be upright and uppercase: A
+
diff --git a/LayoutTests/fast/text/text-combine-upright-text-transform.html b/LayoutTests/fast/text/text-combine-upright-text-transform.html
new file mode 100644
index 000000000000..41926218903a
--- /dev/null
+++ b/LayoutTests/fast/text/text-combine-upright-text-transform.html
@@ -0,0 +1,10 @@
+
+
+Test text-combine-upright: all + text-transform
+text-transform: capitalize
+The following "a" should be upright and captalize: a
+text-transform: lowercase
+The following "A" should be upright and lowercase: A
+text-transform: uppercase
+The following "a" should be upright and uppercase: a
+
diff --git a/Source/WebCore/rendering/RenderCombineText.cpp b/Source/WebCore/rendering/RenderCombineText.cpp
index babebff8109a..bda50583a61e 100644
--- a/Source/WebCore/rendering/RenderCombineText.cpp
+++ b/Source/WebCore/rendering/RenderCombineText.cpp
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011-2023 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 Google Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -99,7 +100,7 @@ void RenderCombineText::combineTextIfNeeded()
// An ancestor element may trigger us to lay out again, even when we're already combined.
if (m_isCombined)
- RenderText::setRenderedText(originalText());
+ RenderText::setRenderedText(m_renderedText);
m_isCombined = false;
m_needsFontUpdate = false;
@@ -185,6 +186,7 @@ void RenderCombineText::combineTextIfNeeded()
if (m_isCombined) {
static NeverDestroyed objectReplacementCharacterString(&objectReplacementCharacter, 1);
+ m_renderedText = text();
RenderText::setRenderedText(objectReplacementCharacterString.get());
m_combinedTextWidth = combinedTextWidth;
m_combinedTextAscent = glyphOverflow.top;
diff --git a/Source/WebCore/rendering/RenderCombineText.h b/Source/WebCore/rendering/RenderCombineText.h
index c11ab464d982..81e8df84f40d 100644
--- a/Source/WebCore/rendering/RenderCombineText.h
+++ b/Source/WebCore/rendering/RenderCombineText.h
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011-2023 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 Google Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -53,6 +54,7 @@ class RenderCombineText final : public RenderText {
float m_combinedTextWidth { 0 };
float m_combinedTextAscent { 0 };
float m_combinedTextDescent { 0 };
+ String m_renderedText;
bool m_isCombined : 1;
bool m_needsFontUpdate : 1;
};