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

[IFC][Integration][Line clamp] LineClamp.currentLineCount should be propagated to the parent layoutState. #12973

Merged
merged 1 commit into from Apr 25, 2023

Conversation

GetToSet
Copy link
Contributor

@GetToSet GetToSet commented Apr 20, 2023

59088ba

[IFC][Integration][Line clamp] `LineClamp.currentLineCount` should be propagated to the parent layoutState.
https://bugs.webkit.org/show_bug.cgi?id=255487

Reviewed by Alan Baradlay.

Since multiple children share the same parent context for line clamp,
`LineClamp.currentLineCount` set to the individual child should be propagated to
their parent layoutState. Otherwise, subsequent children may not see the current
state of this value during layout, causing incorrect line clamp results.

* LayoutTests/fast/block/line-clamp-nested-blocks-with-layout-state-expected.html: Added.
* LayoutTests/fast/block/line-clamp-nested-blocks-with-layout-state.html: Added.
* Source/WebCore/page/LocalFrameViewLayoutContext.cpp:
(WebCore::LocalFrameViewLayoutContext::popLayoutState):

Canonical link: https://commits.webkit.org/263360@main

4865a76

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ›  gtk
βœ… πŸ§ͺ ios-wk2-wpt βœ… πŸ§ͺ mac-wk1 ❌ πŸ§ͺ gtk-wk2
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk2 βœ… πŸ§ͺ api-gtk
βœ… πŸ›  tv βœ… πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-wk2-stress
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch
βœ… πŸ›  watch-sim

@GetToSet GetToSet requested a review from cdumez as a code owner April 20, 2023 15:35
@GetToSet GetToSet force-pushed the eng/bug-255728-pr branch 2 times, most recently from 193e4c2 to 4483e29 Compare April 20, 2023 15:47
@nt1m nt1m requested a review from alanbaradlay April 20, 2023 17:12
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Apr 21, 2023
@GetToSet GetToSet changed the title [IFC][Integration][Line clamp] visibleLineCountForLineClamp should be propagated to the parent layoutState. [IFC][Integration][Line clamp] LineClamp.currentLineCount should be propagated to the parent layoutState. Apr 22, 2023
@GetToSet
Copy link
Contributor Author

Rebased and updated this patch to accommodate to the latest changes.

@Ahmad-S792 Ahmad-S792 added Layout and Rendering For bugs with layout and rendering of Web pages. and removed merging-blocked Applied to prevent a change from being merged labels Apr 23, 2023
@Ahmad-S792 Ahmad-S792 requested review from smfr and removed request for cdumez April 23, 2023 06:25
Copy link
Contributor

@alanbaradlay alanbaradlay left a comment

Choose a reason for hiding this comment

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

Now we are diverging from legacy -webkit-line-clamp rendering, but I think it's a good change.

Source/WebCore/page/LocalFrameViewLayoutContext.cpp Outdated Show resolved Hide resolved
Source/WebCore/page/LocalFrameViewLayoutContext.cpp Outdated Show resolved Hide resolved
currentLineClamp->currentLineCount,
}));
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this could be collapsed to

    if (!layoutState())
        return;

    auto currentLineClamp = layoutState()->lineClamp();

    m_layoutStateStack.removeLast();

    if (auto* layoutState = this->layoutState(); layoutState && layoutState->lineClamp())
        layoutState->setLineClamp(currentLineClamp);

maybe asserting on not mutating the maximum line clamp value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I chose to assert for maximumLineCount since it should be an immutable state established at applyModernLineClamp.

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Apr 24, 2023
@GetToSet
Copy link
Contributor Author

@Ahmad-S792 Could you help try landing this patch?

@Ahmad-S792 Ahmad-S792 added merge-queue Applied to send a pull request to merge-queue and removed merging-blocked Applied to prevent a change from being merged labels Apr 25, 2023
@Ahmad-S792
Copy link
Contributor

@Ahmad-S792 Could you help try landing this patch?

Added merge-queue to land this and also confirmed that the failing tests are not related to this change but flaky failures.

… propagated to the parent layoutState.

https://bugs.webkit.org/show_bug.cgi?id=255487

Reviewed by Alan Baradlay.

Since multiple children share the same parent context for line clamp,
`LineClamp.currentLineCount` set to the individual child should be propagated to
their parent layoutState. Otherwise, subsequent children may not see the current
state of this value during layout, causing incorrect line clamp results.

* LayoutTests/fast/block/line-clamp-nested-blocks-with-layout-state-expected.html: Added.
* LayoutTests/fast/block/line-clamp-nested-blocks-with-layout-state.html: Added.
* Source/WebCore/page/LocalFrameViewLayoutContext.cpp:
(WebCore::LocalFrameViewLayoutContext::popLayoutState):

Canonical link: https://commits.webkit.org/263360@main
@webkit-commit-queue
Copy link
Collaborator

Committed 263360@main (59088ba): https://commits.webkit.org/263360@main

Reviewed commits have been landed. Closing PR #12973 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 59088ba into WebKit:main Apr 25, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Apr 25, 2023
@Ahmad-S792
Copy link
Contributor

@alanbaradlay - It seems that the bug landed against closed bug, should I ask 'webkit-bot' to revert it and ask @GetToSet to update Bug URL in commit message and land with correct bug number? I left comment on bugzilla as well.

@alanbaradlay
Copy link
Contributor

@alanbaradlay - It seems that the bug landed against closed bug, should I ask 'webkit-bot' to revert it and ask @GetToSet to update Bug URL in commit message and land with correct bug number? I left comment on bugzilla as well.

oops. I wouldn't revert it. I think it's ok as long as bugzillas are commented and connected accordingly.

@GetToSet GetToSet deleted the eng/bug-255728-pr branch April 26, 2023 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Layout and Rendering For bugs with layout and rendering of Web pages.
Projects
None yet
6 participants