Skip to content

Commit

Permalink
feat(text/flow/sliver): more feat merge
Browse files Browse the repository at this point in the history
  • Loading branch information
pba-cra authored and andycall committed Aug 10, 2023
1 parent a673dd1 commit 4621d58
Show file tree
Hide file tree
Showing 125 changed files with 2,404 additions and 537 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified integration_tests/snapshots/css/css-flow/blocks.ts.11a2f8281.png
Binary file modified integration_tests/snapshots/dom/elements/pre.ts.3745c23b1.png
294 changes: 294 additions & 0 deletions integration_tests/specs/css/css-text/line-join.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,294 @@
describe('Text Line Join', () => {
it('works with pre span', async () => {
let p = createElement(
'p',
{
xmlns: 'http://www.w3.org/1999/xhtml',
style: {
direction: 'ltr',
},
},
[
createElement(
'String',
{
style: {},
},
[createText(`Begin `)]
),
createText(` pre text.`)
]
);
document.body.appendChild(p);
await snapshot();
});

it('works with pre span and second line break', async () => {
let p = createElement(
'p',
{
xmlns: 'http://www.w3.org/1999/xhtml',
style: {
direction: 'ltr',
},
},
[
createElement(
'Strong',
{
style: {},
},
[createText(`pre text, `)]
),
createText(`this is very long long long line to build break. `)
]
);
document.body.appendChild(p);
await snapshot();
});

it('works with pre span and first line break', async () => {
let p = createElement(
'p',
{
xmlns: 'http://www.w3.org/1999/xhtml',
style: {
direction: 'ltr',
},
},
[
createElement(
'Strong',
{
style: {},
},
[
createText(`Begin, his is very long long long line to build break, `),
createText(`pre text.`),
]
),
]
);
document.body.appendChild(p);
await snapshot();
});

it('works with more text join', async () => {
let p = createElement(
'p',
{
xmlns: 'http://www.w3.org/1999/xhtml',
style: {
direction: 'ltr',
},
},
[
createElement(
'Strong',
{
style: {},
},
[
createText(`A text with `),
createText(`B text.`),
createText(`C text. Join next text.`),
createText(`pre text.`)],
),
]
);
document.body.appendChild(p);
await snapshot();
});

it('works with inlineBlock', async () => {
let p = createElement(
'p',
{
xmlns: 'http://www.w3.org/1999/xhtml',
style: {
direction: 'ltr',
},
},
[
createElement('div', {
style: {
'background-color': 'green',
height: '20px',
width: '20px',
'box-sizing': 'border-box',
display: 'inline-block'
},
}),
createElement(
'Strong ',
{
style: {},
},
[
createText(`A text with `),
createText(`B text.`),
createText(`pre text.`)],
),
]
);
document.body.appendChild(p);
await snapshot();
});

it('works with join two inline element', async () => {
let div = createElement(
'div',
{
style: {
width: '100px',
backgroundColor:'#ff2'
},
},
[
createElement('span', {
style: {
},
},[createText(`ffffffffffff`)]),
createElement('span', {
style: {
},
},[createText(`In this article`),]),
]
);
document.body.appendChild(div);
await snapshot();
});

it('works with join two inline element and img', async () => {
let div = createElement(
'div',
{
style: {
width: '100px',
backgroundColor:'#ff2'
},
},
[
createElement('span', {
style: {
},
},[createText(`A`)]),
createElement('span', {
style: {
},
},[
createElement('img', {
src: 'assets/blue15x15.png',
width: '15',
height: '15',
style: {
},
}),
createText(`In this article`),
]),
]
);
document.body.appendChild(div);
await snapshot();
});

it('works with join two inline element and img and more text', async () => {
let div = createElement(
'div',
{
style: {
width: '100px',
backgroundColor:'#ff2'
},
},
[
createElement('span', {
style: {
},
},[createText(`AAA`)]),
createElement('span', {
style: {
},
},[
createElement('img', {
src: 'assets/blue15x15.png',
width: '15',
height: '15',
style: {
},
}),
createText(`In this article`),
]),
]
);
document.body.appendChild(div);
await snapshot();
});

it('works with join two inline element and img and more text', async () => {
let div = createElement(
'div',
{
style: {
width: '100px',
backgroundColor:'#ff2'
},
},
[
createElement('span', {
style: {
},
},[createText(`AAA`)]),
createElement('span', {
style: {
},
},[
createText(`pre text`),
createElement('img', {
src: 'assets/blue15x15.png',
width: '15',
height: '15',
style: {
},
}),
createText(`In this article, test of in the picture`),
]),
]
);
document.body.appendChild(div);
await snapshot();
});

it('works with join two inline element and block', async () => {
let div = createElement(
'div',
{
style: {
width: '100px',
backgroundColor:'#ff2'
},
},
[
createElement('span', {
style: {
},
},[createText(`AAA`)]),
createElement('span', {
style: {
},
},[
createText(`pre text`),
createElement('div', {
width: '15',
height: '15',
style: {
},
}),
createText(`In this article, test of in the picture`),
]),
]
);
document.body.appendChild(div);
await snapshot();
});
});
2 changes: 2 additions & 0 deletions webf/lib/rendering.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ export 'src/rendering/paragraph.dart';
export 'src/rendering/line_break.dart';
export 'src/rendering/image.dart';
export 'src/rendering/webf_render_list.dart';
export 'src/rendering/logic_box.dart';

5 changes: 5 additions & 0 deletions webf/lib/src/css/border.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ mixin CSSBorderMixin on RenderStyle {
return Size(border.left + innerSize.width + border.right, border.top + innerSize.height + border.bottom);
}

Size wrapBorderSizeRight(Size innerSize) {
return Size(innerSize.width + border.right,
border.top + innerSize.height + border.bottom);
}

BoxConstraints deflateBorderConstraints(BoxConstraints constraints) {
return constraints.deflate(border);
}
Expand Down
2 changes: 2 additions & 0 deletions webf/lib/src/css/computed_style_declaration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,8 @@ extension VerticalAlignText on VerticalAlign {
return 'top';
case VerticalAlign.bottom:
return 'bottom';
case VerticalAlign.textBottom:
return 'textBottom';
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions webf/lib/src/css/inline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ enum VerticalAlign {
/// Aligns the middle of the element with the baseline plus half the x-height of the parent.
/// @TODO not supported
/// middle,
//
/// Aligns the bottom of the element with the bottom of the parent element's font.
textBottom,
}

mixin CSSInlineMixin on RenderStyle {
Expand All @@ -40,6 +43,8 @@ mixin CSSInlineMixin on RenderStyle {
return VerticalAlign.top;
case BOTTOM:
return VerticalAlign.bottom;
case TEXT_BOTTOM:
return VerticalAlign.textBottom;
}
return VerticalAlign.baseline;
}
Expand Down
1 change: 1 addition & 0 deletions webf/lib/src/css/keywords.dart
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ const String LEFT = 'left';
const String RIGHT = 'right';
const String TOP = 'top';
const String BOTTOM = 'bottom';
const String TEXT_BOTTOM = 'text-bottom';

const String CENTER = 'center';

Expand Down
6 changes: 6 additions & 0 deletions webf/lib/src/css/padding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ mixin CSSPaddingMixin on RenderStyle {
paddingTop.computedValue + innerSize.height + paddingBottom.computedValue);
}

Size wrapPaddingSizeRight(Size innerSize) {
return Size(
innerSize.width + paddingRight.computedValue,
paddingTop.computedValue + innerSize.height + paddingBottom.computedValue
);
}
void debugPaddingProperties(DiagnosticPropertiesBuilder properties) {
properties.add(DiagnosticsProperty('padding', padding));
}
Expand Down
Loading

0 comments on commit 4621d58

Please sign in to comment.