Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Input renderer applies overflow clipping to the content box
https://bugs.webkit.org/show_bug.cgi?id=257463

Reviewed by Simon Fraser.

Clipping is supposed to be applied to the padding box (interop on input shows it too).

* LayoutTests/fast/forms/placeholder-content-clipping-padding-box-expected.html: Added.
* LayoutTests/fast/forms/placeholder-content-clipping-padding-box.html: Added.
* Source/WebCore/rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::controlClipRect const):

Canonical link: https://commits.webkit.org/264731@main
  • Loading branch information
alanbaradlay committed May 31, 2023
1 parent fc1d869 commit 020a45f
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 1 deletion.
@@ -0,0 +1,10 @@
<style>
div {
padding-top: 2px;
padding-left: 3px;
font-family: Ahem;
font-size: 20px;
color: green;
}
</style>
<div>PASS if this is NOT clipped.</div>
@@ -0,0 +1,15 @@
<style>
input {
font-family: Ahem;
font-size: 20px;
height: 20px;
padding-top: 10px;
padding-bottom: 10px;
width: 600px;
border-color: transparent;
}
input::placeholder {
color: green;
}
</style>
<input type="text" placeholder="PASS if this is NOT clipped.">
1 change: 1 addition & 0 deletions LayoutTests/platform/ios/TestExpectations
Expand Up @@ -358,6 +358,7 @@ fast/events/standalone-image-drag-to-editable.html [ Skip ]
fast/files/local-file-drag-security.html [ Skip ]
fast/forms/file/file-input-reset-validation.html [ Skip ]
fast/forms/file/file-input-empty-validation.html [ Skip ]
fast/forms/placeholder-content-clipping-padding-box.html [ ImageOnlyFailure ]
fast/history/page-cache-createObjectURL.html [ Skip ]
http/tests/local/drag-over-remote-content.html [ Skip ]
http/tests/local/fileapi/send-dragged-file.html [ Skip ]
Expand Down
@@ -0,0 +1,20 @@

(GraphicsLayer
(anchor 0.00 0.00)
(bounds 800.00 600.00)
(children 1
(GraphicsLayer
(bounds 800.00 600.00)
(contentsOpaque 1)
(drawsContent 1)
(backgroundColor #FFFFFF)
(event region
(rect (0,0) width=800 height=600)
(editable region
(rect (9,10) width=153 height=20)
)
)
)
)
)

2 changes: 1 addition & 1 deletion Source/WebCore/rendering/RenderTextControlSingleLine.cpp
Expand Up @@ -302,7 +302,7 @@ bool RenderTextControlSingleLine::hasControlClip() const
LayoutRect RenderTextControlSingleLine::controlClipRect(const LayoutPoint& additionalOffset) const
{
ASSERT(hasControlClip());
auto clipRect = contentBoxRect();
auto clipRect = paddingBoxRect();
if (auto* containerElementRenderer = containerElement() ? containerElement()->renderBox() : nullptr)
clipRect = unionRect(clipRect, containerElementRenderer->frameRect());
clipRect.moveBy(additionalOffset);
Expand Down

0 comments on commit 020a45f

Please sign in to comment.