Title: [238519] trunk
- Revision
- 238519
- Author
- [email protected]
- Date
- 2018-11-26 13:50:17 -0800 (Mon, 26 Nov 2018)
Log Message
Placeholder text is not repainted after caps lock indicator is hidden
https://bugs.webkit.org/show_bug.cgi?id=191968
<rdar://problem/46247234>
Reviewed by Zalan Bujtas.
Source/WebCore:
Fixes an issue where the placeholder text in a password field is not repainted when the
caps lock indicator is hidden.
The placeholder renderer is special. It is an excluded child renderer and does not take
part in normal flow layout. It is also created and destroyed as needed. The caps lock
indicator is also special in that it is implemented as a RenderImage and we do not know
its dimensions before it is loaded and the load happens asynchronously. As a result we
detect when the inner text size changes and mark the placeholder as dirty as a way to
keep the dimensions of the placeholder in sync with the dimensions of the inner text.
Test: fast/repaint/placeholder-after-caps-lock-hidden.html
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::layout): Mark the placeholder as needing layout
the size of the inner text changes.
LayoutTests:
Add a test to ensure to that the placeholder text is repainted when the caps lock indicator is hidden.
* TestExpectations: Skip the test on all platforms as we only support toggling Caps Lock in
WebKit2 on Mac at the moment.
* fast/repaint/placeholder-after-caps-lock-hidden.html: Added.
* platform/mac-wk2/TestExpectations: Mark the test as PASS so that we run it.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (238518 => 238519)
--- trunk/LayoutTests/ChangeLog 2018-11-26 21:44:27 UTC (rev 238518)
+++ trunk/LayoutTests/ChangeLog 2018-11-26 21:50:17 UTC (rev 238519)
@@ -1,5 +1,20 @@
2018-11-26 Daniel Bates <[email protected]>
+ Placeholder text is not repainted after caps lock indicator is hidden
+ https://bugs.webkit.org/show_bug.cgi?id=191968
+ <rdar://problem/46247234>
+
+ Reviewed by Zalan Bujtas.
+
+ Add a test to ensure to that the placeholder text is repainted when the caps lock indicator is hidden.
+
+ * TestExpectations: Skip the test on all platforms as we only support toggling Caps Lock in
+ WebKit2 on Mac at the moment.
+ * fast/repaint/placeholder-after-caps-lock-hidden.html: Added.
+ * platform/mac-wk2/TestExpectations: Mark the test as PASS so that we run it.
+
+2018-11-26 Daniel Bates <[email protected]>
+
REGRESSION (r238078): Do not draw caps lock indicator when Strong Password button is shown
https://bugs.webkit.org/show_bug.cgi?id=191969
<rdar://problem/46247569>
Modified: trunk/LayoutTests/TestExpectations (238518 => 238519)
--- trunk/LayoutTests/TestExpectations 2018-11-26 21:44:27 UTC (rev 238518)
+++ trunk/LayoutTests/TestExpectations 2018-11-26 21:50:17 UTC (rev 238519)
@@ -401,6 +401,7 @@
fast/events/detect-caps-lock.html [ Skip ]
fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-when-after-hiding-auto-fill-strong-password-button.html [ Skip ]
fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible.html [ Skip ]
+fast/repaint/placeholder-after-caps-lock-hidden.html [ Skip ]
# This test currently only works for mac-wk2
fast/events/inactive-window-no-mouse-event.html [ Skip ]
Added: trunk/LayoutTests/fast/repaint/placeholder-after-caps-lock-hidden-expected.txt (0 => 238519)
--- trunk/LayoutTests/fast/repaint/placeholder-after-caps-lock-hidden-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/repaint/placeholder-after-caps-lock-hidden-expected.txt 2018-11-26 21:50:17 UTC (rev 238519)
@@ -0,0 +1,20 @@
+Tests that the placeholder text is repainted when the caps lock indicator is hidden.
+
+
+(repaint rects
+ (rect 31 50 22 22)
+ (rect 36 55 12 12)
+ (rect 8 50 33 23)
+ (rect 13 55 23 13)
+ (rect 8 50 45 23)
+ (rect 13 55 35 13)
+ (rect 31 50 22 23)
+ (rect 36 55 12 13)
+ (rect 8 50 45 23)
+ (rect 13 55 35 13)
+ (rect 8 50 33 23)
+ (rect 13 55 23 13)
+ (rect 8 50 45 23)
+ (rect 13 55 35 13)
+)
+
Added: trunk/LayoutTests/fast/repaint/placeholder-after-caps-lock-hidden.html (0 => 238519)
--- trunk/LayoutTests/fast/repaint/placeholder-after-caps-lock-hidden.html (rev 0)
+++ trunk/LayoutTests/fast/repaint/placeholder-after-caps-lock-hidden.html 2018-11-26 21:50:17 UTC (rev 238519)
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText(true);
+ testRunner.waitUntilDone();
+}
+
+let step = 0;
+
+function handleKeyUp(event)
+{
+ switch (step++) {
+ case 0:
+ console.assert(event.key === "a");
+ UIHelper.keyDown("\b"); // Backspace
+ return;
+ case 1:
+ console.assert(event.key === "Backspace");
+ internals.startTrackingRepaints();
+ testRunner.toggleCapsLock();
+ return;
+ case 2: {
+ console.assert(event.key === "CapsLock");
+ document.getElementById("result").textContent = internals.repaintRectsAsText();
+ internals.stopTrackingRepaints();
+ testRunner.notifyDone();
+ return;
+ }
+ }
+}
+
+function runTest()
+{
+ if (!window.testRunner)
+ return;
+
+ let input = document.getElementById("input");
+ input.focus();
+
+ function handleCapsLockEnabled(event) {
+ console.assert(event.key === "CapsLock");
+ input.addEventListener("keyup", handleKeyUp, false);
+ UIHelper.keyDown("a");
+ }
+ input.addEventListener("keydown", handleCapsLockEnabled, { once: true });
+ testRunner.toggleCapsLock();
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Tests that the placeholder text is repainted when the caps lock indicator is hidden.</p>
+<input id="input" type="password" size="5" placeholder="Cupertino">
+<pre id="result"></pre>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (238518 => 238519)
--- trunk/LayoutTests/platform/mac-wk2/TestExpectations 2018-11-26 21:44:27 UTC (rev 238518)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations 2018-11-26 21:50:17 UTC (rev 238519)
@@ -70,6 +70,7 @@
[ Mojave+ ] fast/events/detect-caps-lock.html [ Pass ]
[ Mojave+ ] fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-when-after-hiding-auto-fill-strong-password-button.html [ Pass ]
[ Mojave+ ] fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible.html [ Pass ]
+[ Mojave+ ] fast/repaint/placeholder-after-caps-lock-hidden.html [ Pass ]
fast/events/inactive-window-no-mouse-event.html [ Pass ]
Modified: trunk/Source/WebCore/ChangeLog (238518 => 238519)
--- trunk/Source/WebCore/ChangeLog 2018-11-26 21:44:27 UTC (rev 238518)
+++ trunk/Source/WebCore/ChangeLog 2018-11-26 21:50:17 UTC (rev 238519)
@@ -1,3 +1,27 @@
+2018-11-26 Daniel Bates <[email protected]>
+
+ Placeholder text is not repainted after caps lock indicator is hidden
+ https://bugs.webkit.org/show_bug.cgi?id=191968
+ <rdar://problem/46247234>
+
+ Reviewed by Zalan Bujtas.
+
+ Fixes an issue where the placeholder text in a password field is not repainted when the
+ caps lock indicator is hidden.
+
+ The placeholder renderer is special. It is an excluded child renderer and does not take
+ part in normal flow layout. It is also created and destroyed as needed. The caps lock
+ indicator is also special in that it is implemented as a RenderImage and we do not know
+ its dimensions before it is loaded and the load happens asynchronously. As a result we
+ detect when the inner text size changes and mark the placeholder as dirty as a way to
+ keep the dimensions of the placeholder in sync with the dimensions of the inner text.
+
+ Test: fast/repaint/placeholder-after-caps-lock-hidden.html
+
+ * rendering/RenderTextControlSingleLine.cpp:
+ (WebCore::RenderTextControlSingleLine::layout): Mark the placeholder as needing layout
+ the size of the inner text changes.
+
2018-11-26 Jeremy Jones <[email protected]>
Picture-in-picture window size changes unnecesarily when URL changes.
Modified: trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp (238518 => 238519)
--- trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp 2018-11-26 21:44:27 UTC (rev 238518)
+++ trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp 2018-11-26 21:50:17 UTC (rev 238519)
@@ -110,6 +110,12 @@
resetOverriddenHeight(innerBlockRenderer, this);
resetOverriddenHeight(containerRenderer, this);
+ // Save the old size of the inner text (if we have one) as we will need to layout the placeholder if
+ // it changes to keep the size of the placeholder proportional to the size of the inner text.
+ LayoutSize oldInnerTextSize;
+ if (innerTextRenderer)
+ oldInnerTextSize = innerTextRenderer->size();
+
RenderBlockFlow::layoutBlock(false);
// Set the text block height
@@ -173,6 +179,10 @@
placeholderBox->mutableStyle().setHeight(Length(innerTextSize.height() - placeholderBox->verticalBorderAndPaddingExtent(), Fixed));
bool neededLayout = placeholderBox->needsLayout();
bool placeholderBoxHadLayout = placeholderBox->everHadLayout();
+ if (innerTextSize != oldInnerTextSize) {
+ // The caps lock indicator was hidden. Layout the placeholder. Its layout does not affect its parent.
+ placeholderBox->setChildNeedsLayout(MarkOnlyThis);
+ }
placeholderBox->layoutIfNeeded();
LayoutPoint textOffset;
if (innerTextRenderer)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes