haikuwebkit/LayoutTests/fast/writing-mode/english-bt-text-with-spelli...

43 lines
841 B
HTML
Raw Permalink Normal View History

<!DOCTYPE html>
<html>
<head>
<script src="../../editing/editing.js"></script>
<style>
@font-face {
font-family: Ahem;
src: url("../../resources/Ahem.ttf");
}
#expected {
display: inline-block;
position: absolute;
top: 0;
left: 0;
width: 200px;
font: 20px/1 Ahem;
Spelling dots are drawn in the wrong place https://bugs.webkit.org/show_bug.cgi?id=190764 Reviewed by Dean Jackson. Source/WebCore: - Dots should not be clipped. - Dots should be horizontally centered. - Dots should be drawn behind the text. - Distance from the baseline to the top of the dot should be 11.035% of font size. - Dot diameter should be 13.247% of the font size. - Distance between the dots (right side of the left dot to left side of the right dot) should be 9.457% of the font size. - The "font size" used in these calculations should be clamped so it's 10px <= font size <= 40px. Tests: editing/spelling/spelling-dots-position-2.html editing/spelling/spelling-dots-position-3.html editing/spelling/spelling-dots-position.html editing/spelling/spelling-dots-repaint.html * platform/graphics/cocoa/GraphicsContextCocoa.mm: (WebCore::colorForMarkerLineStyle): Align iOS and macOS implementations. (WebCore::GraphicsContext::drawDotsForDocumentMarker): Place the dots correctly. * rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::addToLine): The KnownToHaveNoOverflow flag should be cleared if the element has spelling dots, because there is no guarantee the spelling dots will lie inside the layout rect of the element. (WebCore::InlineFlowBox::addTextBoxVisualOverflow): Update the repaint rects to include splling dot positions. * rendering/InlineFlowBox.h: Comments should explain why, not say what. * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paint): Draw the dots behind the text. (WebCore::InlineTextBox::hasMarkers const): Convenience. (WebCore::InlineTextBox::paintPlatformDocumentMarkers): Refactor bounds information into a helper function. (WebCore::InlineTextBox::calculateUnionOfAllDocumentMarkerBounds const): Use for repaint rect calculation. (WebCore::InlineTextBox::calculateDocumentMarkerBounds const): Place the dots correctly. (WebCore::InlineTextBox::paintPlatformDocumentMarker): Call the helper method. (WebCore::InlineTextBox::collectMarkedTextsForDocumentMarkers const): (WebCore::InlineTextBox::collectMarkedTextsForDocumentMarkers): Deleted. * rendering/InlineTextBox.h: Declare the helper methods. * rendering/SimpleLineLayout.cpp: Simple line layout doesn't know how to paint spelling dots, so make the presence of spelling dots opt us out of SLL. (WebCore::SimpleLineLayout::canUseForWithReason): * rendering/SimpleLineLayoutCoverage.cpp: (WebCore::SimpleLineLayout::printReason): * rendering/SimpleLineLayoutCoverage.h: Add a new opt-out reason. Tools: Previously, it was impossible for WebKitTestRunner to draw spelling dots. This patch adds support for a header at the top of test files, of the form <!-- webkit-test-runner [ spellCheckingDots=true ] --> which will cause dots to be drawn. * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetStateToConsistentValues): (WTR::updateTestOptionsFromTestHeader): (WTR::TestController::platformResetStateToConsistentValues): * WebKitTestRunner/TestController.h: * WebKitTestRunner/TestOptions.h: (WTR::TestOptions::hasSameInitializationOptions const): * WebKitTestRunner/cocoa/TestControllerCocoa.mm: (WTR::TestController::cocoaResetStateToConsistentValues): * WebKitTestRunner/cocoa/TestRunnerWKWebView.h: * WebKitTestRunner/ios/TestControllerIOS.mm: (WTR::TestController::platformResetStateToConsistentValues): * WebKitTestRunner/mac/TestControllerMac.mm: (WTR::TestController::platformResetStateToConsistentValues): LayoutTests: * editing/spelling/resources/VerySmallDescentAhem.ttf: Added. In order to test repaint rects, this is a version of Ahem with a very small descent, so that the dots don't intersect with the text itself. * editing/spelling/spelling-dots-position-2-expected-mismatch.html: Added. * editing/spelling/spelling-dots-position-2.html: Added. Make sure dots are painted in the correct vertical place. * editing/spelling/spelling-dots-position-3-expected-mismatch.html: Added. * editing/spelling/spelling-dots-position-3.html: Added. Make sure dots are painted in the correct vertical place. * editing/spelling/spelling-dots-position-expected.html: Added. * editing/spelling/spelling-dots-position.html: Added. Make sure dots are not painted in the wrong place. * editing/spelling/spelling-dots-repaint-expected.html: Added. * editing/spelling/spelling-dots-repaint.html: Added. Test repaint by drawing an element with spelling dots, and then deleting the element from the document. The spelling dots should be removed too. * fast/writing-mode/english-bt-text-with-spelling-marker-expected.html: * fast/writing-mode/english-bt-text-with-spelling-marker.html: Update the test to compensate for new spelling dot positions. Canonical link: https://commits.webkit.org/206132@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-06 23:06:37 +00:00
line-height: 1.2;
}
</style>
</head>
<body>
<div id="expected" contenteditable="true"></div>
<script>
[iOS][WK1] Support toggling continuous spell checking from tests https://bugs.webkit.org/show_bug.cgi?id=188763 Reviewed by Simon Fraser. Source/WebKitLegacy/mac: Move some more code out from under a !PLATFORM(IOS)-guard so as to support toggling continuous spell checking from tests in iOS WebKit Legacy. * WebCoreSupport/WebEditorClient.h: (WebEditorClient::toggleContinuousSpellChecking): Deleted. * WebCoreSupport/WebEditorClient.mm: * WebView/WebView.h: * WebView/WebView.mm: (-[WebView toggleContinuousSpellChecking:]): (-[WebView toggleSmartInsertDelete:]): LayoutTests: Fix up some spelling tests so that they enable continuous spell checking and unskip them, with the exception of fast/writing-mode/english-rl-text-with-spelling-marker.html, now that they pass. Mark the test fast/writing-mode/english-rl-text-with-spelling-marker.html as an image-only failure. See <https://bugs.webkit.org/show_bug.cgi?id=188762> for more details. * editing/spelling/spelling-marker-includes-hyphen-expected.html: * editing/spelling/spelling-marker-includes-hyphen.html: * editing/spelling/spelling-markers-in-overlapping-lines-expected.html: * editing/spelling/spelling-markers-in-overlapping-lines-large-font-expected.html: * editing/spelling/spelling-markers-in-overlapping-lines-large-font.html: * editing/spelling/spelling-markers-in-overlapping-lines.html: * fast/writing-mode/english-bt-text-with-spelling-marker-expected.html: * fast/writing-mode/english-bt-text-with-spelling-marker.html: * fast/writing-mode/english-rl-text-with-spelling-marker-expected.html: * fast/writing-mode/english-rl-text-with-spelling-marker.html: * platform/ios/TestExpectations: Canonical link: https://commits.webkit.org/203836@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235119 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-08-21 16:37:04 +00:00
if (window.internals)
internals.setContinuousSpellCheckingEnabled(true);
var expected = document.getElementById("expected");
typeText("mispelled a", expected);
queueCommand(() => window.internals && internals.updateEditorUINowIfScheduled()); // Trigger spell checking
function typeText(text, element)
{
element.focus();
for (const c of text)
typeCharacterCommand(c);
element.blur();
}
</script>
</body>
</html>