Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

text-combine-upright: all & text-transform don't work together #8703

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<body style="writing-mode: vertical-rl">
Test text-combine-upright: all + text-transform<br><br>
text-transform: capitalize<br>
The following "a" should be upright and captalize: <span style="text-combine-upright: all;">A</span><br><br>
text-transform: lowercase<br>
The following "A" should be upright and lowercase: <span style="text-combine-upright: all;">a</span><br><br>
text-transform: uppercase<br>
The following "a" should be upright and uppercase: <span style="text-combine-upright: all;">A</span><br><br>
</body>
10 changes: 10 additions & 0 deletions LayoutTests/fast/text/text-combine-upright-text-transform.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<body style="writing-mode: vertical-rl">
Test text-combine-upright: all + text-transform<br><br>
text-transform: capitalize<br>
The following "a" should be upright and captalize: <span style="text-combine-upright: all; text-transform: capitalize;">a</span><br><br>
text-transform: lowercase<br>
The following "A" should be upright and lowercase: <span style="text-combine-upright: all; text-transform: lowercase;">A</span><br><br>
text-transform: uppercase<br>
The following "a" should be upright and uppercase: <span style="text-combine-upright: all; text-transform: uppercase;">a</span><br><br>
</body>
6 changes: 4 additions & 2 deletions Source/WebCore/rendering/RenderCombineText.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the original intended was to copy the string.

@darinadler @cdumez The original Blink patch did RenderText::setRenderedText(m_renderedText.impl()), although I'm not sure if that's the common pattern.

Copy link
Contributor

@cdumez cdumez Jan 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks right to me. No reason to take the StringImpl here, they should be equivalent.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like maybe the Blink merge simply isn't working, the initial version without any of my requested changes had the test failing on Windows.


m_isCombined = false;
m_needsFontUpdate = false;
Expand Down Expand Up @@ -185,6 +186,7 @@ void RenderCombineText::combineTextIfNeeded()

if (m_isCombined) {
static NeverDestroyed<String> objectReplacementCharacterString(&objectReplacementCharacter, 1);
m_renderedText = text();
RenderText::setRenderedText(objectReplacementCharacterString.get());
m_combinedTextWidth = combinedTextWidth;
m_combinedTextAscent = glyphOverflow.top;
Expand Down
4 changes: 3 additions & 1 deletion Source/WebCore/rendering/RenderCombineText.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -53,6 +54,7 @@ class RenderCombineText final : public RenderText {
float m_combinedTextWidth { 0 };
float m_combinedTextAscent { 0 };
float m_combinedTextDescent { 0 };
String m_renderedText;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This naming is confusing. It does not represent the rendered combined text, this is pre-combined after-transformed text.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not even sure if I agree with this approach, but since RenderCombine is going to go through a proper refactoring soonish, I guess this will do for now.

bool m_isCombined : 1;
bool m_needsFontUpdate : 1;
};
Expand Down