From: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> --- dlls/dwrite/layout.c | 14 +++++--------- dlls/dwrite/tests/layout.c | 6 ------ 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index 753c7bdab18..9cc0394bffb 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -432,11 +432,8 @@ static HRESULT layout_update_breakpoints_range(struct dwrite_textlayout *layout, UINT32 start, UINT32 length) { DWRITE_BREAK_CONDITION before, after; - HRESULT hr; - /* ignore returned conditions if failed */ - hr = IDWriteInlineObject_GetBreakConditions(object, &before, &after); - if (FAILED(hr)) + if (FAILED(IDWriteInlineObject_GetBreakConditions(object, &before, &after))) after = before = DWRITE_BREAK_CONDITION_NEUTRAL; if (!layout->actual_breakpoints) @@ -474,7 +471,6 @@ static HRESULT layout_update_breakpoints_range(struct dwrite_textlayout *layout, layout->actual_breakpoints[i].breakConditionAfter = DWRITE_BREAK_CONDITION_MAY_NOT_BREAK; } - layout->actual_breakpoints[i].isWhitespace = 0; layout->actual_breakpoints[i].isSoftHyphen = 0; } @@ -1340,7 +1336,9 @@ static HRESULT layout_compute_runs(struct dwrite_textlayout *layout) DWRITE_FONT_METRICS fontmetrics = { 0 }; /* we need to do very little in case of inline objects */ - if (r->kind == LAYOUT_RUN_INLINE) { + if (r->kind == LAYOUT_RUN_INLINE) + { + DWRITE_LINE_BREAKPOINT bp = get_effective_breakpoint(layout, r->start_position); DWRITE_CLUSTER_METRICS *metrics = &layout->clustermetrics[cluster]; struct layout_cluster *c = &layout->clusters[cluster]; DWRITE_INLINE_OBJECT_METRICS inlinemetrics; @@ -1348,7 +1346,7 @@ static HRESULT layout_compute_runs(struct dwrite_textlayout *layout) metrics->width = 0.0f; metrics->length = r->u.object.length; metrics->canWrapLineAfter = 0; - metrics->isWhitespace = 0; + metrics->isWhitespace = bp.isWhitespace; metrics->isNewline = 0; metrics->isSoftHyphen = 0; metrics->isRightToLeft = r->u.object.bidi_level & 1; @@ -2065,8 +2063,6 @@ static HRESULT layout_add_line(struct dwrite_textlayout *layout, UINT32 first_cl struct layout_cluster *lc = &layout->clusters[index]; WCHAR ch; - /* This also filters out clusters added from inline objects, those are never - treated as a white space. */ if (!cluster->isWhitespace) break; diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c index e3a15944ccb..9c5630b4ac6 100644 --- a/dlls/dwrite/tests/layout.c +++ b/dlls/dwrite/tests/layout.c @@ -2787,7 +2787,6 @@ static void test_GetClusterMetrics(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(count == 4, "Unexpected count %u.\n", count); ok(!metrics[0].isWhitespace, "Unexpected value %d.\n", metrics[0].isWhitespace); - todo_wine ok(metrics[1].isWhitespace == 1, "Unexpected value %d.\n", metrics[1].isWhitespace); ok(!metrics[2].isWhitespace, "Unexpected value %d.\n", metrics[2].isWhitespace); ok(metrics[3].isWhitespace == 1, "Unexpected value %d.\n", metrics[3].isWhitespace); @@ -3401,7 +3400,6 @@ static void test_DetermineMinWidth(void) hr = IDWriteTextLayout_GetClusterMetrics(layout, metrics, ARRAYSIZE(metrics), &count); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(count == 2, "Unexpected count %u.\n", count); - todo_wine ok(metrics[1].isWhitespace, "Unexpected value %d.\n", metrics[1].isWhitespace); hr = IDWriteTextLayout_SetWordWrapping(layout, DWRITE_WORD_WRAPPING_NO_WRAP); @@ -3410,7 +3408,6 @@ static void test_DetermineMinWidth(void) minwidth = 0.0f; hr = IDWriteTextLayout_DetermineMinWidth(layout, &minwidth); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(minwidth == metrics[0].width, "Unexpected width %.8e.\n", minwidth); IDWriteTextLayout_Release(layout); @@ -3426,7 +3423,6 @@ static void test_DetermineMinWidth(void) minwidth = 0.0f; hr = IDWriteTextLayout_DetermineMinWidth(layout, &minwidth); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(minwidth == 0.0f, "Unexpected width %.8e.\n", minwidth); IDWriteTextLayout_Release(layout); @@ -4554,7 +4550,6 @@ static void test_GetLineMetrics(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(count == 2, "Unexpected count %u.\n", count); ok(!clusters[0].isWhitespace, "Unexpected value %d.\n", clusters[0].isWhitespace); - todo_wine ok(clusters[1].isWhitespace, "Unexpected value %d.\n", clusters[1].isWhitespace); count = 0; @@ -4562,7 +4557,6 @@ static void test_GetLineMetrics(void) hr = IDWriteTextLayout_GetLineMetrics(layout, metrics, ARRAYSIZE(metrics), &count); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(count == 1, "Unexpected line count %u.\n", count); - todo_wine ok(metrics[0].trailingWhitespaceLength == 1, "Unexpected length %u.\n", metrics[0].trailingWhitespaceLength); ok(metrics[0].length == 2, "Unexpected length %u.\n", metrics[0].length); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9974