Bug 86404 - first-letter not updated when :before content is inserted
Summary: first-letter not updated when :before content is inserted
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-14 14:29 PDT by Abhishek Arya
Modified: 2023-03-16 19:05 PDT (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Abhishek Arya 2012-05-14 14:29:50 PDT
<!DOCTYPE html>
<!-- You should see only one green box for letter 'A'. 'B' should be black. -->
<html style="font-family: ahem; font-size: 50px; -webkit-font-smoothing: none;">
<style>
div:first-letter { color: green; }
.test:before { content: 'A'; }
</style>
<body>
<div id="div1">BCD</div>
<script>
document.body.offsetTop;
document.getElementById('div1').setAttribute('class', 'test');
</script>
</body>
</html>

Right now, you will see 'A' and 'B' both green.
Comment 1 Arpita Bahuguna 2012-07-30 02:10:56 PDT
This issue is perhaps related to the FIXME mentioned in RenderBlock::updateFirstLetter():
    // FIXME: We need to destroy the first-letter object if it is no longer the first child. Need to find
    // an efficient way to check for that situation though before implementing anything.

Shall try and upload a patch for the same.
Comment 2 Ahmad Saleem 2023-03-16 19:05:30 PDT
(In reply to Arpita Bahuguna from comment #1)
> This issue is perhaps related to the FIXME mentioned in
> RenderBlock::updateFirstLetter():
>     // FIXME: We need to destroy the first-letter object if it is no longer
> the first child. Need to find
>     // an efficient way to check for that situation though before
> implementing anything.
> 
> Shall try and upload a patch for the same.

We still have this FIXME - https://searchfox.org/wubkat/source/Source/WebCore/rendering/RenderBlock.cpp#2668