Bug 224546 - [IFC] Incorrect box height when scrollbar takes padding box space
Summary: [IFC] Incorrect box height when scrollbar takes padding box space
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: zalan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-04-14 07:47 PDT by cathiechen
Modified: 2021-04-16 06:35 PDT (History)
5 users (show)

See Also:


Attachments
selection-crash.html (558 bytes, text/html)
2021-04-14 07:47 PDT, cathiechen
no flags Details
(another)test case (464 bytes, text/html)
2021-04-14 08:20 PDT, zalan
no flags Details
Patch (3.81 KB, patch)
2021-04-15 03:23 PDT, zalan
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (5.45 KB, patch)
2021-04-15 09:26 PDT, zalan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description cathiechen 2021-04-14 07:47:01 PDT
Created attachment 425979 [details]
selection-crash.html

This issue occurs on the Debug building with LAYOUT_FORMATTING_CONTEXT enabled.
The code is updated to commit 80e1bf3d759003a97b3e676d78fca630407fdd35.

The test case contains inline-block box and text.
The height of body is 35px, but others are 24px.

It crashes when select the text.

Debug a bit:
  - During layout, in RenderBlockFlow::layoutInlineChildren, it uses layoutModernLines() to layout lines. The logical height is 35.
  - During select, in RenderBlockFlow::ensureLineBoxes, it calls complexLineLayout.layoutLineBoxes. The logical height is 24.
  - Then it fails `ASSERT(didNeedLayout || ceilf(logicalHeight()) == ceilf(oldHeight));` in RenderBlockFlow::ensureLineBoxes.
Comment 1 zalan 2021-04-14 08:20:46 PDT
Created attachment 425983 [details]
(another)test case
Comment 2 zalan 2021-04-14 14:36:43 PDT
Actually this is about the reserved space for always-on scrollbars (15px here in MiniBrowser -which explains the 11px diff (15px scrollbar - 4px descent))
Comment 3 Radar WebKit Bug Importer 2021-04-14 14:44:28 PDT
<rdar://problem/76666402>
Comment 4 zalan 2021-04-14 20:55:25 PDT
ok, so this is broken when the padding box can't accommodate the scrollbar.
this fixes the vertical aspect of it:

-    auto verticalSpaceReservedForScrollbar = std::min(replacedOrInlineBlock.height() - replacedOrInlineBlock.paddingBoxHeight(), LayoutUnit(replacedOrInlineBlock.horizontalScrollbarHeight()));
+    auto paddingBoxHeight = replacedOrInlineBlock.paddingBoxHeight();
+    auto horizontalScrollbarHeight = LayoutUnit { replacedOrInlineBlock.horizontalScrollbarHeight() };
+    auto verticalSpaceReservedForScrollbar = horizontalScrollbarHeight > paddingBoxHeight ? paddingBoxHeight : std::min(replacedOrInlineBlock.height() - paddingBoxHeight, horizontalScrollbarHeight);


will upload the patch tomorrow morning.
Comment 5 zalan 2021-04-15 03:23:11 PDT
Created attachment 426095 [details]
Patch
Comment 6 zalan 2021-04-15 09:26:32 PDT
Created attachment 426110 [details]
Patch
Comment 7 EWS 2021-04-16 06:35:16 PDT
Committed r276135 (236629@main): <https://commits.webkit.org/236629@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 426110 [details].