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

skia RichTextBlock paragraph implementation #14878

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

limeniye
Copy link
Contributor

@limeniye limeniye commented Dec 19, 2023

GitHub Issue: #81

PR Status

Still under development.

The goal of PR

Implementation of Paragraph functionality for RichTextBlock.

Changelog

IBlock
interface has been replaced to ISegmentsElement.
This is necessary for the following reasons:

  • The IBlock interface differs from the IBlock implementation of the Block type: it has redundant properties and the absence of some that are present in the original IBlock implementation;
  • IBlock performs a different functionality and its name confuses with the name of the Block type implementation;
  • TextBlock's implementation of the IBlock interface makes some sense, but TextBlock is actually just a conditional block element, not an actual one, which is a bit confusing.

ISegmentsElement
implements the previous function of the IBlock interface and also has 2 additional methods: InvalidateElement and InvalidateSegments. These methods are analogous to the InvalidateInlines(bool updateText) method.
But since RichTextBlock contains a collection of Bloks, not Inlines, the name of this method has been generalized for both types.
Since the RichTextBlock type, in addition to text, also has an InlineUIContainer child element, the updateText parameter was removed, and the method was split into two methods.

ISegmentsElement type is needed in order not to write "RichTextBlock or TextBlock" condition every time.

SegmentsCollection
is only needed to generalize InlineCollection and BlockCollection.
The only change I added to it is to check if the element is a Paragraph for the GetPreorderTree method.

Still under development

  • Paragraph space between lines;
  • Paragraph TextIndent;
  • Paragraph Hyperlink support;
  • Runtime tests;

Problems

Unfortunately, I did not understand how to add the default RichTextBlock style to the project.
I see it as follows:

<Style TargetType="RichTextBlock">
</Style>

But in the project I found only styles with x:Key specified.

Latest preview

Preview.mp4

Platforms

  • Windows
  • Mobile
  • Skia
  • Wasm

This is necessary for the following reasons:
- The IBlock interface differs from the IBlock implementation of the Block type: it has redundant properties and the absence of some that are present in the original IBlock implementation;
- IBlock performs a different functionality and its name confuses with the name of the Block type implementation;
- The ISegmentsElement type also has two new methods. They are needed because the RichTextBlock element, apart from the text, also has an InlineUIContainer type that is not related to the text in any way.
…llection type.

This change is needed to give BlockCollection the ability to draw blocks.
…s: TextWrapping, TextAlignment, Foreground, LineStackingStrategy, LineHeight, MaxLines, HorizontalTextAlignment
@github-actions github-actions bot added area/skia ✏️ Categorizes an issue or PR as relevant to Skia area/automation Categorizes an issue or PR as relevant to project automation labels Dec 19, 2023
@unodevops
Copy link
Contributor

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-14878/index.html

@github-actions github-actions bot added the platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform label Dec 20, 2023
@unodevops
Copy link
Contributor

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-14878/index.html

@limeniye
Copy link
Contributor Author

limeniye commented Dec 29, 2023

Latest preview
Added line spacing.
The commits will be very soon.

Preview.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/automation Categorizes an issue or PR as relevant to project automation area/skia ✏️ Categorizes an issue or PR as relevant to Skia platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants