Title: [292685] trunk/Source/WebCore
- Revision
- 292685
- Author
- za...@apple.com
- Date
- 2022-04-09 19:59:35 -0700 (Sat, 09 Apr 2022)
Log Message
[Text autosizing] Remove redundant lineCountForTextAutosizing member function
https://bugs.webkit.org/show_bug.cgi?id=239034
Reviewed by Antti Koivisto.
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::adjustComputedFontSizes): stop walking the list item children when we see multiple lines.
(WebCore::RenderBlockFlow::lineCountForTextAutosizing): Deleted.
* rendering/RenderBlockFlow.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (292684 => 292685)
--- trunk/Source/WebCore/ChangeLog 2022-04-10 02:14:13 UTC (rev 292684)
+++ trunk/Source/WebCore/ChangeLog 2022-04-10 02:59:35 UTC (rev 292685)
@@ -1,3 +1,15 @@
+2022-04-09 Alan Bujtas <za...@apple.com>
+
+ [Text autosizing] Remove redundant lineCountForTextAutosizing member function
+ https://bugs.webkit.org/show_bug.cgi?id=239034
+
+ Reviewed by Antti Koivisto.
+
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::adjustComputedFontSizes): stop walking the list item children when we see multiple lines.
+ (WebCore::RenderBlockFlow::lineCountForTextAutosizing): Deleted.
+ * rendering/RenderBlockFlow.h:
+
2022-04-09 Khem Raj <raj.k...@gmail.com>
Include locale.h for LC_MESSAGES definition.
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (292684 => 292685)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2022-04-10 02:14:13 UTC (rev 292684)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2022-04-10 02:59:35 UTC (rev 292685)
@@ -3771,19 +3771,6 @@
return true;
}
-int RenderBlockFlow::lineCountForTextAutosizing()
-{
- if (style().visibility() != Visibility::Visible)
- return 0;
- if (childrenInline())
- return lineCount();
- // Only descend into list items.
- int count = 0;
- for (auto& listItem : childrenOfType<RenderListItem>(*this))
- count += listItem.lineCount();
- return count;
-}
-
static bool isNonBlocksOrNonFixedHeightListItems(const RenderObject& renderer)
{
if (!renderer.isRenderBlock())
@@ -3815,18 +3802,25 @@
if (visibleWidth >= width())
return;
- unsigned lineCount;
- if (m_lineCountForTextAutosizing == NOT_SET) {
- int count = lineCountForTextAutosizing();
- if (!count)
+ unsigned lineCount = m_lineCountForTextAutosizing;
+ if (lineCount == NOT_SET) {
+ if (style().visibility() != Visibility::Visible)
lineCount = NO_LINE;
- else if (count == 1)
- lineCount = ONE_LINE;
- else
- lineCount = MULTI_LINE;
- } else
- lineCount = m_lineCountForTextAutosizing;
-
+ else {
+ size_t lineCountInBlock = 0;
+ if (childrenInline())
+ lineCountInBlock = this->lineCount();
+ else {
+ for (auto& listItem : childrenOfType<RenderListItem>(*this)) {
+ lineCountInBlock += listItem.lineCount();
+ if (lineCountInBlock > 1)
+ break;
+ }
+ }
+ lineCount = !lineCountInBlock ? NO_LINE : lineCountInBlock == 1 ? ONE_LINE : MULTI_LINE;
+ }
+ }
+
ASSERT(lineCount != NOT_SET);
if (lineCount == NO_LINE)
return;
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (292684 => 292685)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.h 2022-04-10 02:14:13 UTC (rev 292684)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h 2022-04-10 02:59:35 UTC (rev 292685)
@@ -546,7 +546,6 @@
void materializeRareBlockFlowData();
#if ENABLE(TEXT_AUTOSIZING)
- int lineCountForTextAutosizing();
void adjustComputedFontSizes(float size, float visibleWidth);
void resetComputedFontSize()
{
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes