forked from LadybirdBrowser/ladybird
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LibWeb: Implement the "fontSize" editing command
- Loading branch information
Showing
5 changed files
with
141 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
div: "foobar" | ||
fontSize value: 3 | ||
div: "foo<font size="5" style="font-size: x-large;">bar</font>" | ||
fontSize value: 5 | ||
div: "<font size="4" style="font-size: large;">foo</font><font style=""><font size="4" style="font-size: large;"><font size="4" style="font-size: large;">bar</font></font></font>" | ||
fontSize value: 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<script src="../include.js"></script> | ||
<div contenteditable="true">foobar</div> | ||
<script> | ||
test(() => { | ||
const range = document.createRange(); | ||
getSelection().addRange(range); | ||
|
||
const divElm = document.querySelector('div'); | ||
println(`div: "${divElm.innerHTML}"`); | ||
println(`fontSize value: ${document.queryCommandValue('fontSize')}`); | ||
|
||
// Set fontSize for 'bar' | ||
range.setStart(divElm.childNodes[0], 3); | ||
range.setEnd(divElm.childNodes[0], 6); | ||
document.execCommand('fontSize', false, '5'); | ||
println(`div: "${divElm.innerHTML}"`); | ||
println(`fontSize value: ${document.queryCommandValue('fontSize')}`); | ||
|
||
// Set fontSize for 'foobar' | ||
range.setStart(divElm.childNodes[0], 0); | ||
range.setEnd(divElm.childNodes[1].childNodes[0], 3); | ||
document.execCommand('fontSize', false, '4'); | ||
println(`div: "${divElm.innerHTML}"`); | ||
println(`fontSize value: ${document.queryCommandValue('fontSize')}`); | ||
}); | ||
</script> |