Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 2e60aef4d56a64a8d8732c543b644ff0b4b78734
Author: Sean McQuillan <seanmcq@google.com>
Date: Mon Dec 19 13:45:45 2022
Flesh out MultiParagraphPlaceholderLayoutCache
It's now a layout cache.
TextInlineContentLayoutDrawModifier now does similar debouncing
on input, and defers all cache behaviors to the cache.
Bug: b/246960758
Test: ./gradlew :com:found:found-d-n-s-newtext:cAT
Change-Id: If104398da705747c6cdcaffe95ff9d2badd20324
M compose/foundation/foundation-newtext/src/androidAndroidTest/kotlin/androidx/compose/foundation/newtext/text/modifiers/MultiParagraphLayoutCacheTest.kt
M compose/foundation/foundation-newtext/src/androidAndroidTest/kotlin/androidx/compose/foundation/newtext/text/modifiers/MultiParagraphLayoutCacheWidthWithLetterSpacingTest.kt
M compose/foundation/foundation-newtext/src/androidAndroidTest/kotlin/androidx/compose/foundation/newtext/text/modifiers/TextLayoutResultIntegrationTest.kt
M compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/TextUsingModifier.kt
D compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/modifiers/InlineContentLayoutDrawModifier.kt
M compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/modifiers/MultiParagraphLayoutCache.kt
A compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/modifiers/TextInlineContentLayoutDrawModifier.kt
M compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/modifiers/TextInlineContentLayoutDrawParams.kt
M compose/foundation/foundation-newtext/src/test/kotlin/androidx/compose/foundation/newtext/text/modifiers/MultiParagraphLayoutCacheTest.kt
https://android-review.googlesource.com/2362353
Branch: androidx-main
commit 2e60aef4d56a64a8d8732c543b644ff0b4b78734
Author: Sean McQuillan <seanmcq@google.com>
Date: Mon Dec 19 13:45:45 2022
Flesh out MultiParagraphPlaceholderLayoutCache
It's now a layout cache.
TextInlineContentLayoutDrawModifier now does similar debouncing
on input, and defers all cache behaviors to the cache.
Bug:
Test: ./gradlew :com:found:found-d-n-s-newtext:cAT
Change-Id: If104398da705747c6cdcaffe95ff9d2badd20324
M compose/foundation/foundation-newtext/src/androidAndroidTest/kotlin/androidx/compose/foundation/newtext/text/modifiers/MultiParagraphLayoutCacheTest.kt
M compose/foundation/foundation-newtext/src/androidAndroidTest/kotlin/androidx/compose/foundation/newtext/text/modifiers/MultiParagraphLayoutCacheWidthWithLetterSpacingTest.kt
M compose/foundation/foundation-newtext/src/androidAndroidTest/kotlin/androidx/compose/foundation/newtext/text/modifiers/TextLayoutResultIntegrationTest.kt
M compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/TextUsingModifier.kt
D compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/modifiers/InlineContentLayoutDrawModifier.kt
M compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/modifiers/MultiParagraphLayoutCache.kt
A compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/modifiers/TextInlineContentLayoutDrawModifier.kt
M compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/modifiers/TextInlineContentLayoutDrawParams.kt
M compose/foundation/foundation-newtext/src/test/kotlin/androidx/compose/foundation/newtext/text/modifiers/MultiParagraphLayoutCacheTest.kt
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit 968e10f6319d6e22d035191fa863e5b41c5ce957
Author: Sean McQuillan <seanmcq@google.com>
Date: Mon Dec 19 14:20:48 2022
Add semantics to static text modifier
Draws static text and adds appropriate semantics for non-editable text
This adds semantics to text modifier rewrite.
Bug: b/246960758
Test: ./gradlew :com:found--d-n-s-newtext:cAT
Change-Id: I05c30a3ba21b4b409f15b15e06c271b2d759de0a
M compose/foundation/foundation-newtext/src/androidAndroidTest/kotlin/androidx/compose/foundation/newtext/text/TextLayoutTest.kt
M compose/foundation/foundation-newtext/src/androidAndroidTest/kotlin/androidx/compose/foundation/newtext/text/modifiers/BasicTextSemanticsTest.kt
M compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/TextUsingModifier.kt
M compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/modifiers/MultiParagraphLayoutCache.kt
A compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/modifiers/StaticTextModifier.kt
M compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/modifiers/TextInlineContentLayoutDrawModifier.kt
https://android-review.googlesource.com/2363663
Branch: androidx-main
commit 968e10f6319d6e22d035191fa863e5b41c5ce957
Author: Sean McQuillan <seanmcq@google.com>
Date: Mon Dec 19 14:20:48 2022
Add semantics to static text modifier
Draws static text and adds appropriate semantics for non-editable text
This adds semantics to text modifier rewrite.
Bug:
Test: ./gradlew :com:found--d-n-s-newtext:cAT
Change-Id: I05c30a3ba21b4b409f15b15e06c271b2d759de0a
M compose/foundation/foundation-newtext/src/androidAndroidTest/kotlin/androidx/compose/foundation/newtext/text/TextLayoutTest.kt
M compose/foundation/foundation-newtext/src/androidAndroidTest/kotlin/androidx/compose/foundation/newtext/text/modifiers/BasicTextSemanticsTest.kt
M compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/TextUsingModifier.kt
M compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/modifiers/MultiParagraphLayoutCache.kt
A compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/modifiers/StaticTextModifier.kt
M compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/modifiers/TextInlineContentLayoutDrawModifier.kt
na...@google.com <na...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-main
commit 56d766d1f2e2735425cf9cd20ed802c203223f56
Author: Sean McQuillan <seanmcq@google.com>
Date: Tue Dec 20 11:25:08 2022
Code cleanup for text modifiers
- Semantics allocation caching
- various logic cleanup
- cache added more invalidation branches
Bug: b/246960758
Test: ./gradlew :com:found--d-n-s-newtext:cAT
Change-Id: Ice59bdee908cedb2ad7a5756a1c5810de3823bb2
M compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/TextUsingModifier.kt
M compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/modifiers/MultiParagraphLayoutCache.kt
M compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/modifiers/StaticTextModifier.kt
M compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/modifiers/TextInlineContentLayoutDrawModifier.kt
https://android-review.googlesource.com/2361967
Branch: androidx-main
commit 56d766d1f2e2735425cf9cd20ed802c203223f56
Author: Sean McQuillan <seanmcq@google.com>
Date: Tue Dec 20 11:25:08 2022
Code cleanup for text modifiers
- Semantics allocation caching
- various logic cleanup
- cache added more invalidation branches
Bug:
Test: ./gradlew :com:found--d-n-s-newtext:cAT
Change-Id: Ice59bdee908cedb2ad7a5756a1c5810de3823bb2
M compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/TextUsingModifier.kt
M compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/modifiers/MultiParagraphLayoutCache.kt
M compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/modifiers/StaticTextModifier.kt
M compose/foundation/foundation-newtext/src/commonMain/kotlin/androidx/compose/foundation/newtext/text/modifiers/TextInlineContentLayoutDrawModifier.kt
Description
Some more details in b/388353336
Start of trace:
This happens because when we draw we use a shared ContentDrawScope implementation that we render all DrawModifierNodes in. We do this by mutating a property as we draw successive nodes. However, this means that if anyone captures a reference to this draw scope and tries to draw it later on, this will cause a NPE error as we don't know what the 'current node' that needs to be drawn in.
For the general case this is an error and scopes shouldn't be captured and stored outside the scope in this way, but for GraphicsLayer this is needed when recording drawContent to support some edge cases, such as when we need to draw a layer implementation that can't be drawn in software, within software rendering (such as drawing to a Bitmap). For this we just end up re-invoking the draw block we captured.
We considered some solutions where we would allocate a new draw scope instance per modifier, but this adds some overhead and 'storing' these draw scopes for future use is challenging. (we considered putting them on the node object, in a map on the node coordinator, or some other chain structure on the node coordinator, but none of these are really great)
Instead we can explicitly support the GraphicsLayer.record case by overriding the DrawScope#GraphicsLayer.record function and making it handle this case properly. This can still cause issues if using the non-DrawScope scoped record function, but developers should move to the DrawScope one instead.