mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 18:02:20 +00:00
LibWeb+WebContent: Do not include DOM HTML in text test expectations
For example, in the following abbreviated test HTML: <span>some text</span> <script>println("whf")</script> We would have to craft the expectation file to include the "some text" segment, usually with some leading whitespace. This is a bit annoying, and makes it difficult to manually craft expectation files. So instead of comparing the expectation against the entire DOM inner text, we now send the inner text of just the <pre> element containing the test output when we invoke `internals.signalTextTestIsDone`.
This commit is contained in:
parent
f3f7f77dbc
commit
bf668696de
Notes:
github-actions[bot]
2024-10-03 11:08:22 +00:00
Author: https://github.com/trflynn89
Commit: bf668696de
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1603
Reviewed-by: https://github.com/awesomekling ✅
Reviewed-by: https://github.com/circl-lastname
Reviewed-by: https://github.com/kalenikaliaksandr ✅
319 changed files with 333 additions and 333 deletions
|
@ -1,4 +1,4 @@
|
|||
Submit <FORM >
|
||||
<FORM >
|
||||
document.bob === document.forms[0]: true
|
||||
<BUTTON id="fred" >
|
||||
img element with name 'foo' and id 'bar':
|
||||
|
|
|
@ -1 +1 @@
|
|||
hello <DIV id="c" >
|
||||
<DIV id="c" >
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
Item 1Item 2Item 3Item 4Item 5Item 6Item 7Item 8Item 9Item 10Item 11Item 12 scrollWidth: 1430
|
||||
scrollWidth: 1430
|
||||
scrollLeft: 1130
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
hello <DIV id="c" >
|
||||
<DIV id="c" >
|
||||
<DIV id="b" >
|
||||
<DIV id="a" >
|
||||
<HTML >
|
||||
|
|
|
@ -1 +1 @@
|
|||
Some text Elements at point 30, 20: p < div < body < html
|
||||
p < div < body < html
|
||||
|
|
|
@ -1 +1 @@
|
|||
12389 PASS (didn't crash)
|
||||
PASS (didn't crash)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
Well hello friends some
|
||||
text text-input selectionStart: 0 selectionEnd: 0 selectionDirection: none
|
||||
text-input selectionStart: 0 selectionEnd: 0 selectionDirection: none
|
||||
date-input selectionStart: null selectionEnd: null selectionDirection: null
|
||||
textarea selectionStart: 0 selectionEnd: 0 selectionDirection: none
|
||||
text-input selectionStart: 18 selectionEnd: 18 selectionDirection: none
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
Hello💨😮 World
|
||||
llo💨😮 Wo
|
||||
|
|
|
@ -1 +1 @@
|
|||
Item 1Item 2Item 3Item 4Item 5Item 6Item 7Item 8Item 9Item 10Item 11Item 12 1200
|
||||
1200
|
||||
|
|
|
@ -1 +1 @@
|
|||
Item 1Item 2Item 3Item 4Item 5Item 6Item 7Item 8Item 9Item 10Item 11Item 12 1200
|
||||
1200
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
Hello Ladybird Ladybird again World 6
|
||||
6
|
||||
4
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
x [object DOMRectList]
|
||||
[object DOMRectList]
|
||||
[object DOMRect]
|
|
@ -1,4 +1,4 @@
|
|||
Hello, world!I'm totally bold rn execCommand("bold") returned false
|
||||
execCommand("bold") returned false
|
||||
Hello, world!<b>I'm totally bold rn</b>
|
||||
queryCommandEnabled("bold") returned false
|
||||
queryCommandIndeterm("bold") returned false
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
nodeName: CANVAS
|
||||
offsetTop: 0
|
||||
offsetLeft: 0
|
||||
|
|
|
@ -1 +1 @@
|
|||
B PASS
|
||||
PASS
|
||||
|
|
|
@ -1 +1 @@
|
|||
Option 1 PASS (correct value)
|
||||
PASS (correct value)
|
||||
|
|
|
@ -1 +1 @@
|
|||
Option 1 PASS (correct value)
|
||||
PASS (correct value)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Select files...4 files selected. input1:
|
||||
input1:
|
||||
file1: text/plain: Contents for file1
|
||||
file2: text/plain: Contents for file2
|
||||
file3: text/plain: Contents for file3
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
george true
|
||||
true
|
||||
true
|
||||
true
|
||||
true
|
||||
|
|
|
@ -1 +1 @@
|
|||
Label Text input focused
|
||||
Text input focused
|
||||
|
|
|
@ -1 +1 @@
|
|||
Label Checkbox changed
|
||||
Checkbox changed
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
wfh :^) PASS wfh :^) PASS wfh :^) FAIL PASS FAIL wfh :^) FAIL FAIL PASS PASS wfh :^) wfh :^) PASS PASSwfh :^) FAIL wfh :^) FAIL wfh :^) wfh :^) FAIL wfh :^) wfh :^) defaultButton: click button=PASS
|
||||
defaultButton: click button=PASS
|
||||
defaultButton: submit
|
||||
defaultButton: handledEvent=true
|
||||
defaultButtonAsInput: click button=PASS
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
hello students outerHTML: <div id="foo"><b>hello students</b></div>
|
||||
outerHTML: <div id="foo"><b>hello students</b></div>
|
||||
innerHTML: <b>hello students</b>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
Changed box.
|
||||
oldBox='<p>A box.</p>'
|
||||
newBox='<p>Changed box.</p>'
|
||||
NoModificationAllowedError: Cannot set outer HTML on document
|
||||
|
|
|
@ -1 +1 @@
|
|||
green rgb(0, 128, 0)
|
||||
rgb(0, 128, 0)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
open closed open open open [object ShadowRoot]
|
||||
[object ShadowRoot]
|
||||
0
|
||||
null
|
||||
0
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
hello [object StyleSheetList]
|
||||
[object StyleSheetList]
|
||||
Before remove, sheet count: 1
|
||||
After remove, sheet count: 0
|
||||
After setting innerText of removed sheet, we're still alive!
|
||||
|
|
|
@ -1 +1 @@
|
|||
This is a animated div animation count: 1
|
||||
animation count: 1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
hi #foo:
|
||||
#foo:
|
||||
color: rgb(128, 128, 128)
|
||||
background-color: rgb(255, 255, 0)
|
||||
#foo::before:
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
Hi Not hovering: 16
|
||||
Not hovering: 16
|
||||
Hovering: 78
|
||||
Not hovering: 16
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
inline {"0":{"x":8,"y":500,"width":784,"height":150,"top":500,"right":792,"bottom":650,"left":8}}
|
||||
{"0":{"x":8,"y":500,"width":784,"height":150,"top":500,"right":792,"bottom":650,"left":8}}
|
||||
{"0":{"x":8,"y":650,"width":41.296875,"height":17,"top":650,"right":49.296875,"bottom":667,"left":8}}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. scroll event fired y=100
|
||||
scroll event fired y=100
|
||||
|
|
|
@ -1,7 +1 @@
|
|||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed
|
||||
cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis
|
||||
ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum
|
||||
lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
|
||||
inceptos himenaeos.
|
||||
scroll event fired y=151 x=25
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
|
||||
{"x":0,"y":0,"width":0,"height":0,"top":0,"right":0,"bottom":0,"left":0}
|
||||
{"x":0,"y":0,"width":0,"height":0,"top":0,"right":0,"bottom":0,"left":0}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
inline {"x":8,"y":500,"width":784,"height":150,"top":500,"right":792,"bottom":650,"left":8}
|
||||
{"x":8,"y":500,"width":784,"height":150,"top":500,"right":792,"bottom":650,"left":8}
|
||||
{"x":8,"y":650,"width":41.296875,"height":17,"top":650,"right":49.296875,"bottom":667,"left":8}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Run Clicked!
|
||||
Clicked!
|
||||
|
|
|
@ -1 +1 @@
|
|||
Button Clicked!
|
||||
Clicked!
|
||||
|
|
|
@ -1 +1 @@
|
|||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse accumsan semper massa ut pharetra. Nunc vitae lorem at odio facilisis vehicula nec ut nibh. Duis ornare nibh orci, nec mollis est mollis ac. Aenean ultricies condimentum interdum. In eu elit vestibulum, sollicitudin lectus vel, congue nibh. Morbi vitae nunc in tortor ultrices aliquet sit amet a turpis. Phasellus ut dui sodales, dictum sem ut, efficitur tellus. Etiam eu orci et magna suscipit dignissim nec et sem. Aenean quam erat, euismod eu faucibus et, placerat ut dolor. <HTML >
|
||||
<HTML >
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
(no body)
|
|
@ -1 +1 @@
|
|||
hello true
|
||||
true
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
lang "en" <SPAN id="name" >
|
||||
<SPAN id="name" >
|
||||
<SPAN id="value" >
|
||||
|
|
|
@ -1 +1 @@
|
|||
here be bugsyou can't see me toggle open
|
||||
toggle open
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
Line 1 Line 2 Line 3 Line 4 Line 5 Line 6 Line 7 Line 8 Line 9 Line 10 Line 11 Line 12 Line 13 Line 14 Line 15 Line 16 Line 17 Line 18 Line 19 Line 20 <P id="line-6" >
|
||||
<P id="line-6" >
|
||||
<SPAN id="line-8" >
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
1 2 <DIV id="aa" >
|
||||
<DIV id="aa" >
|
||||
<DIV id="a" >
|
||||
<DIV id="bb" >
|
||||
<DIV id="b" >
|
||||
|
|
|
@ -1 +1 @@
|
|||
Establishes a stacking context. <DIV id="scroll-space-filler" >
|
||||
<DIV id="scroll-space-filler" >
|
||||
|
|
|
@ -1 +1 @@
|
|||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque eu ante est. Integer ipsum sem, tincidunt quis felis quis, efficitur fringilla neque. Aliquam erat volutpat. Donec feugiat euismod sapien. Donec vel egestas arcu. Suspendisse luctus rhoncus mi quis elementum. Maecenas vel nisi maximus, viverra tellus quis, ultrices elit. Quisque congue velit quis lectus congue, ut consectetur nulla pharetra. Nullam euismod leo eget magna auctor, et bibendum urna tincidunt. Morbi molestie gravida ex ac consectetur. Duis pretium gravida augue eu sagittis. 192
|
||||
192
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
wfh :^) wfh :^)
|
||||
wfh :^)
|
||||
blur
|
||||
|
|
|
@ -1 +1 @@
|
|||
wfh :^) wfh :^)
|
||||
wfh :^)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Select file...file1 Select files...4 files selected. Select file...file1.cpp Select files...2 files selected. input1:
|
||||
input1:
|
||||
file1: text/plain: Contents for file1
|
||||
input2:
|
||||
file1: text/plain: Contents for file1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Select file...file1 Select files...4 files selected. input1:
|
||||
input1:
|
||||
file1 (index iteration): text/plain: Contents for file1
|
||||
file1 (for..of iteration): text/plain: Contents for file1
|
||||
input2:
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
pass pass Select file...No file selected. text: "pass"
|
||||
text: "pass"
|
||||
hidden: "pass"
|
||||
button: "pass"
|
||||
checkbox: "pass"
|
||||
|
|
|
@ -21,3 +21,4 @@ At time 750:
|
|||
box-shadow: rgb(81, 71, 210) 75px 150px 227.5px 0px, rgba(0, 0, 174, 0.749) 37.5px 7.5px 15px 22.5px
|
||||
color: rgb(81, 71, 210)
|
||||
transform: matrix(1, 0, 0, 1, 75, 75)
|
||||
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
hello! hello!
|
||||
hello!
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
value1 value2 ===================
|
||||
===================
|
||||
non-checked-with-value
|
||||
===================
|
||||
2
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
Item 1Item 2Item 3Item 4Item 5Item 6Item 7Item 8Item 9Item 10Item 11Item 12 scrollLeft (before resize): 1130
|
||||
scrollLeft (before resize): 1130
|
||||
scrollLeft (after resize): 830
|
||||
|
|
|
@ -1 +1 @@
|
|||
Take test The page has been scrolled to y: 563
|
||||
The page has been scrolled to y: 563
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
Ladybird is an ongoing project to build an independent web browser from scratch.
|
||||
Events:
|
||||
selectionchange anchorNode=<#text > anchorOffset=1 type=Caret focusNode=<#text > focusOffset=1 isCollapsed=true
|
||||
selectionchange anchorNode=<#text > anchorOffset=1 type=Caret focusNode=<#text > focusOffset=1 isCollapsed=true
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Well hello friends selectionStart: 0
|
||||
selectionStart: 0
|
||||
selectionEnd: 0
|
||||
selectionStart: 18
|
||||
selectionEnd: 18
|
||||
|
|
|
@ -14,5 +14,6 @@
|
|||
output.textContent += " < ";
|
||||
}
|
||||
});
|
||||
println(output.innerText);
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -13,5 +13,6 @@ after
|
|||
const range = document.createRange();
|
||||
range.selectNodeContents(element);
|
||||
range.deleteContents();
|
||||
println(document.body.innerText);
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
const range = document.createRange();
|
||||
range.setStart(hello, 2);
|
||||
range.setEnd(world, 5);
|
||||
println('');
|
||||
println(range.toString());
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -11,5 +11,6 @@
|
|||
test(() => {
|
||||
const input = document.getElementById("input");
|
||||
internals.sendText(input, "hello");
|
||||
println(document.body.innerText);
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -13,7 +13,6 @@ table {
|
|||
<script>
|
||||
test(() => {
|
||||
const c = document.getElementById("c");
|
||||
println("");
|
||||
|
||||
for (let n = c; n; n = n.offsetParent) {
|
||||
println("nodeName: " + n.nodeName);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
document.write("PASS");
|
||||
document.close();
|
||||
});
|
||||
internals.signalTextTestIsDone(document.body.innerText);
|
||||
</script>
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
<script>
|
||||
test(() => {
|
||||
let oldElement = document.getElementById("oldBox");
|
||||
println('');
|
||||
println(`${oldElement.id}='${oldElement.innerHTML}'`);
|
||||
|
||||
oldElement.outerHTML = '<div id="newBox"><p>Changed box.</p></div>';
|
||||
|
|
|
@ -14,6 +14,6 @@ img {
|
|||
const inViewport = document.getElementById("inViewport");
|
||||
inViewport.addEventListener("load", function() {
|
||||
document.body.innerHTML = "PASS";
|
||||
internals.signalTextTestIsDone();
|
||||
internals.signalTextTestIsDone(document.body.innerText);
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
encodeURI("<script>new IntersectionObserver(function() { }, { })<" + "/script>");
|
||||
iframe.onload = function () {
|
||||
iframe.remove();
|
||||
done();
|
||||
println("PASS if we didn't crash!");
|
||||
done();
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -9,5 +9,6 @@
|
|||
body.style.width = 'calc(10px + 20px)';
|
||||
body.style.width = 'calc(10px * 20px * 30px)';
|
||||
body.style.width = 'calc(10px * 20px)';
|
||||
println("PASS! (didn't crash)")
|
||||
});
|
||||
</script>PASS! (didn't crash)
|
||||
</script>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<head>
|
||||
<link rel="stylesheet" href="style-sheet-with-byte-order-mark.css" />
|
||||
</head>
|
||||
<div class="pass">PASS</div>
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {});
|
||||
test(() => {
|
||||
println("PASS");
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -43,5 +43,7 @@
|
|||
const result = document.createElement("p");
|
||||
result.textContent = `Bounding Client Rect: top=${boundingRect.top}, left=${boundingRect.left}, width=${boundingRect.width}, height=${boundingRect.height}`;
|
||||
document.body.appendChild(result);
|
||||
|
||||
println(document.body.innerText);
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// Note: This test _must_ be in a .svg file!
|
||||
internals.hitTest(400, 400);
|
||||
// Did not crash!
|
||||
internals.signalTextTestIsDone();
|
||||
internals.signalTextTestIsDone("");
|
||||
});
|
||||
</script>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 668 B After Width: | Height: | Size: 670 B |
|
@ -6,5 +6,6 @@
|
|||
// as the HTML parser inserts it *before* the table
|
||||
// under these circumstances.
|
||||
document.querySelector("table").remove()
|
||||
println(document.body.innerText);
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -19,7 +19,7 @@ function __finishTest() {
|
|||
if (__originalURL) {
|
||||
internals.spoofCurrentURL(__originalURL);
|
||||
}
|
||||
internals.signalTextTestIsDone();
|
||||
internals.signalTextTestIsDone(__outputElement.innerText);
|
||||
}
|
||||
|
||||
function spoofCurrentURL(url) {
|
||||
|
|
|
@ -3,5 +3,7 @@
|
|||
const input = document.getElementById('input');
|
||||
internals.sendText(input, 'Hello World!');
|
||||
internals.commitText();
|
||||
|
||||
println(input.value);
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -3,5 +3,7 @@
|
|||
const input = document.getElementById("input");
|
||||
internals.sendText(input, "wfh :^)");
|
||||
internals.commitText();
|
||||
|
||||
println(input.value);
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
__outputElement.setAttribute("id", "out");
|
||||
__outputElement.appendChild(document.createTextNode("passed\n"))
|
||||
document.body.appendChild(__outputElement);
|
||||
internals.signalTextTestIsDone();
|
||||
internals.signalTextTestIsDone(document.body.innerText);
|
||||
</script>
|
||||
</head>
|
||||
|
|
|
@ -4,5 +4,7 @@
|
|||
<div id="fallback">Fallback</div>
|
||||
</object>
|
||||
<script>
|
||||
test(() => {});
|
||||
test(() => {
|
||||
println(document.body.innerText);
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -2,5 +2,7 @@
|
|||
<script src="include.js"></script>
|
||||
<script>
|
||||
document.body.appendChild(document.createTextNode("PASS"));
|
||||
test(() => {});
|
||||
test(() => {
|
||||
println(document.body.innerText);
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -3,5 +3,7 @@
|
|||
const textarea = document.getElementById('textarea');
|
||||
internals.sendText(textarea, 'Hello World!');
|
||||
internals.commitText();
|
||||
|
||||
println(textarea.value);
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -3,5 +3,7 @@
|
|||
const textarea = document.getElementById("textarea");
|
||||
internals.sendText(textarea, "wfh :^)");
|
||||
internals.commitText();
|
||||
|
||||
println(textarea.value);
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -47,9 +47,9 @@ Page& Internals::internals_page() const
|
|||
return internals_window().page();
|
||||
}
|
||||
|
||||
void Internals::signal_text_test_is_done()
|
||||
void Internals::signal_text_test_is_done(String const& text)
|
||||
{
|
||||
internals_page().client().page_did_finish_text_test();
|
||||
internals_page().client().page_did_finish_text_test(text);
|
||||
}
|
||||
|
||||
void Internals::gc()
|
||||
|
|
|
@ -19,7 +19,7 @@ class Internals final : public Bindings::PlatformObject {
|
|||
public:
|
||||
virtual ~Internals() override;
|
||||
|
||||
void signal_text_test_is_done();
|
||||
void signal_text_test_is_done(String const& text);
|
||||
|
||||
void gc();
|
||||
JS::Object* hit_test(double x, double y);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
[Exposed=Nobody]
|
||||
interface Internals {
|
||||
|
||||
undefined signalTextTestIsDone();
|
||||
undefined signalTextTestIsDone(DOMString text);
|
||||
undefined gc();
|
||||
object hitTest(double x, double y);
|
||||
|
||||
|
|
|
@ -361,7 +361,7 @@ public:
|
|||
virtual void page_did_request_file_picker([[maybe_unused]] HTML::FileFilter accepted_file_types, Web::HTML::AllowMultipleFiles) { }
|
||||
virtual void page_did_request_select_dropdown([[maybe_unused]] Web::CSSPixelPoint content_position, [[maybe_unused]] Web::CSSPixels minimum_width, [[maybe_unused]] Vector<Web::HTML::SelectItem> items) { }
|
||||
|
||||
virtual void page_did_finish_text_test() { }
|
||||
virtual void page_did_finish_text_test([[maybe_unused]] String const& text) { }
|
||||
|
||||
virtual void page_did_change_theme_color(Gfx::Color) { }
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ public:
|
|||
Function<void(Gfx::IntPoint content_position, i32 minimum_width, Vector<Web::HTML::SelectItem> items)> on_request_select_dropdown;
|
||||
Function<void(Web::KeyEvent const&)> on_finish_handling_key_event;
|
||||
Function<void(Web::DragEvent const&)> on_finish_handling_drag_event;
|
||||
Function<void()> on_text_test_finish;
|
||||
Function<void(String const&)> on_text_test_finish;
|
||||
Function<void(size_t current_match_index, Optional<size_t> const& total_match_count)> on_find_in_page;
|
||||
Function<void(Gfx::Color)> on_theme_color_change;
|
||||
Function<void(String const&, String const&, String const&)> on_insert_clipboard_entry;
|
||||
|
|
|
@ -84,11 +84,11 @@ void WebContentClient::did_finish_loading(u64 page_id, URL::URL const& url)
|
|||
}
|
||||
}
|
||||
|
||||
void WebContentClient::did_finish_text_test(u64 page_id)
|
||||
void WebContentClient::did_finish_text_test(u64 page_id, String const& text)
|
||||
{
|
||||
if (auto view = view_for_page_id(page_id); view.has_value()) {
|
||||
if (view->on_text_test_finish)
|
||||
view->on_text_test_finish();
|
||||
view->on_text_test_finish(text);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ private:
|
|||
virtual void did_request_file_picker(u64 page_id, Web::HTML::FileFilter const& accepted_file_types, Web::HTML::AllowMultipleFiles) override;
|
||||
virtual void did_request_select_dropdown(u64 page_id, Gfx::IntPoint content_position, i32 minimum_width, Vector<Web::HTML::SelectItem> const& items) override;
|
||||
virtual void did_finish_handling_input_event(u64 page_id, Web::EventResult event_result) override;
|
||||
virtual void did_finish_text_test(u64 page_id) override;
|
||||
virtual void did_finish_text_test(u64 page_id, String const& text) override;
|
||||
virtual void did_find_in_page(u64 page_id, size_t current_match_index, Optional<size_t> const& total_match_count) override;
|
||||
virtual void did_change_theme_color(u64 page_id, Gfx::Color color) override;
|
||||
virtual void did_insert_clipboard_entry(u64 page_id, String const& data, String const& presentation_style, String const& mime_type) override;
|
||||
|
|
|
@ -366,9 +366,9 @@ void PageClient::page_did_finish_loading(URL::URL const& url)
|
|||
client().async_did_finish_loading(m_id, url);
|
||||
}
|
||||
|
||||
void PageClient::page_did_finish_text_test()
|
||||
void PageClient::page_did_finish_text_test(String const& text)
|
||||
{
|
||||
client().async_did_finish_text_test(m_id);
|
||||
client().async_did_finish_text_test(m_id, text);
|
||||
}
|
||||
|
||||
void PageClient::page_did_request_context_menu(Web::CSSPixelPoint content_position)
|
||||
|
|
|
@ -156,7 +156,7 @@ private:
|
|||
virtual void page_did_request_color_picker(Color current_color) override;
|
||||
virtual void page_did_request_file_picker(Web::HTML::FileFilter accepted_file_types, Web::HTML::AllowMultipleFiles) override;
|
||||
virtual void page_did_request_select_dropdown(Web::CSSPixelPoint content_position, Web::CSSPixels minimum_width, Vector<Web::HTML::SelectItem> items) override;
|
||||
virtual void page_did_finish_text_test() override;
|
||||
virtual void page_did_finish_text_test(String const& text) override;
|
||||
virtual void page_did_change_theme_color(Gfx::Color color) override;
|
||||
virtual void page_did_insert_clipboard_entry(String data, String presentation_style, String mime_type) override;
|
||||
virtual void page_did_change_audio_play_state(Web::HTML::AudioPlayState) override;
|
||||
|
|
|
@ -96,7 +96,7 @@ endpoint WebContentClient
|
|||
did_output_js_console_message(u64 page_id, i32 message_index) =|
|
||||
did_get_js_console_messages(u64 page_id, i32 start_index, Vector<ByteString> message_types, Vector<ByteString> messages) =|
|
||||
|
||||
did_finish_text_test(u64 page_id) =|
|
||||
did_finish_text_test(u64 page_id, String text) =|
|
||||
|
||||
did_find_in_page(u64 page_id, size_t current_match_index, Optional<size_t> total_match_count) =|
|
||||
|
||||
|
|
|
@ -240,9 +240,8 @@ static ErrorOr<TestResult> run_dump_test(HeadlessWebContentView& view, URL::URL
|
|||
loop.quit(0);
|
||||
};
|
||||
|
||||
view.on_text_test_finish = [&]() {
|
||||
auto promise = view.request_internal_page_info(WebView::PageInfoType::Text);
|
||||
result = MUST(promise->await());
|
||||
view.on_text_test_finish = [&](auto const& text) {
|
||||
result = text;
|
||||
|
||||
did_finish_test = true;
|
||||
if (did_finish_loading)
|
||||
|
@ -317,7 +316,7 @@ static ErrorOr<TestResult> run_ref_test(HeadlessWebContentView& view, URL::URL c
|
|||
view.debug_request("load-reference-page");
|
||||
}
|
||||
};
|
||||
view.on_text_test_finish = [&] {
|
||||
view.on_text_test_finish = [&](auto const&) {
|
||||
dbgln("Unexpected text test finished during ref test for {}", url);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue