Bug 216257

Summary: REGRESSION (r257839): clickpay.com - password placeholder text cannot be replaced
Product: WebKit Reporter: Wenson Hsieh <wenson_hsieh>
Component: HTML EditingAssignee: Wenson Hsieh <wenson_hsieh>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, cmarcelo, darin, esprehn+autocc, ews-watchlist, kangil.han, koivisto, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
For EWS
ews-feeder: commit-queue-
For EWS
ews-feeder: commit-queue-
For EWS
ews-feeder: commit-queue-
For EWS
none
Patch for landing
none
Address comment none

Description Wenson Hsieh 2020-09-07 18:33:39 PDT
<rdar://problem/68150686>
Comment 1 Wenson Hsieh 2020-09-08 16:19:12 PDT Comment hidden (obsolete)
Comment 2 Wenson Hsieh 2020-09-08 18:47:53 PDT Comment hidden (obsolete)
Comment 3 Wenson Hsieh 2020-09-09 10:08:18 PDT Comment hidden (obsolete)
Comment 4 Wenson Hsieh 2020-09-09 10:18:08 PDT Comment hidden (obsolete)
Comment 5 Wenson Hsieh 2020-09-09 10:42:08 PDT Comment hidden (obsolete)
Comment 6 Wenson Hsieh 2020-09-09 10:56:34 PDT
Created attachment 408345 [details]
For EWS
Comment 7 Antti Koivisto 2020-09-10 09:49:37 PDT
Comment on attachment 408345 [details]
For EWS

View in context: https://bugs.webkit.org/attachment.cgi?id=408345&action=review

> Source/WebCore/dom/Element.cpp:3422
> +    auto* style = hasNodeFlag(NodeFlag::IsComputedStyleInvalidFlag) ? nullptr : existingComputedStyle();
>      if (!style)
>          style = const_cast<Element&>(*this).resolveComputedStyle(ResolveComputedStyleMode::RenderedOnly);

Shouldn't we clear the flag in resolveComputedStyle?
Comment 8 Wenson Hsieh 2020-09-10 09:59:45 PDT
Comment on attachment 408345 [details]
For EWS

View in context: https://bugs.webkit.org/attachment.cgi?id=408345&action=review

>> Source/WebCore/dom/Element.cpp:3422
>>          style = const_cast<Element&>(*this).resolveComputedStyle(ResolveComputedStyleMode::RenderedOnly);
> 
> Shouldn't we clear the flag in resolveComputedStyle?

Whoops — that’s right, we should clear the flag when we cache the computed style in that function. Will update the patch to do so!
Comment 9 Wenson Hsieh 2020-09-10 10:20:58 PDT
After chatting with Antti, we both think this new flag should exist in ElementRareData alongside the computedStyle it is about, too.
Comment 10 Wenson Hsieh 2020-09-10 10:47:41 PDT
(In reply to Wenson Hsieh from comment #9)
> After chatting with Antti, we both think this new flag should exist in
> ElementRareData alongside the computedStyle it is about, too.

…but as it turns out, doing so would require us to increase the size of ElementRareData, so just having the flag here is more optimal :/
Comment 11 Wenson Hsieh 2020-09-10 11:09:59 PDT
Created attachment 408462 [details]
Patch for landing
Comment 12 EWS 2020-09-10 12:56:12 PDT
Committed r266887: <https://trac.webkit.org/changeset/266887>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 408462 [details].
Comment 13 Darin Adler 2020-09-10 15:00:35 PDT
Comment on attachment 408462 [details]
Patch for landing

View in context: https://bugs.webkit.org/attachment.cgi?id=408462&action=review

> Source/WebCore/dom/Element.cpp:1976
> +    if (hasRareData() && elementRareData()->computedStyle())
> +        setNodeFlag(NodeFlag::IsComputedStyleInvalidFlag);

Do we really need to check computedStyle for null? Isn’t it harmless to set this flag if there is no computed style?
Comment 14 Wenson Hsieh 2020-09-10 15:09:02 PDT
Comment on attachment 408462 [details]
Patch for landing

View in context: https://bugs.webkit.org/attachment.cgi?id=408462&action=review

>> Source/WebCore/dom/Element.cpp:1976
>> +        setNodeFlag(NodeFlag::IsComputedStyleInvalidFlag);
> 
> Do we really need to check computedStyle for null? Isn’t it harmless to set this flag if there is no computed style?

Good question! The thought here was that if we hadn’t already set a computed style at this point, then we shouldn’t need to mark as invalid. However, after adding code to clear the flag when setting computed style below, I agree this check is not very useful. The only other codepath that calls setComputedStyle is in `Element::storeDisplayContentsStyle`, so we should be able to remove this if we make sure to clear the flag out there as well.

I’ll do this in a followup.
Comment 15 Wenson Hsieh 2020-09-10 15:37:01 PDT
Reopening to attach new patch.
Comment 16 Wenson Hsieh 2020-09-10 15:37:02 PDT
Created attachment 408486 [details]
Address comment
Comment 17 EWS 2020-09-10 17:01:47 PDT
Committed r266899: <https://trac.webkit.org/changeset/266899>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 408486 [details].