Bug 126302 - RenderButton should store its text renderer in a RenderPtr.
Summary: RenderButton should store its text renderer in a RenderPtr.
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andreas Kling
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-30 12:52 PST by Andreas Kling
Modified: 2023-05-10 07:32 PDT (History)
7 users (show)

See Also:


Attachments
Patch (2.24 KB, patch)
2013-12-30 12:54 PST, Andreas Kling
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kling 2013-12-30 12:52:49 PST
RenderButton should store its text renderer in a RenderPtr.
Comment 1 Andreas Kling 2013-12-30 12:54:02 PST
Created attachment 220122 [details]
Patch
Comment 2 Ahmad Saleem 2023-05-09 12:07:28 PDT
https://searchfox.org/wubkat/source/Source/WebCore/rendering/RenderButton.cpp#101

_____


void RenderButton::setText(const String& str)
{
    if (!m_buttonText && str.isEmpty())
        return;

    if (!m_buttonText) {
        auto newButtonText = createRenderer<RenderTextFragment>(document(), str);
        m_buttonText = *newButtonText;
        // FIXME: This mutation should go through the normal RenderTreeBuilder path.
        if (RenderTreeBuilder::current())
            RenderTreeBuilder::current()->attach(*this, WTFMove(newButtonText));
        else
            RenderTreeBuilder(*document().renderView()).attach(*this, WTFMove(newButtonText));
        return;
    }

    if (!str.isEmpty()) {
        m_buttonText->setText(str.impl());
        return;
    }
    if (RenderTreeBuilder::current())
        RenderTreeBuilder::current()->destroy(*m_buttonText);
    else
        RenderTreeBuilder(*document().renderView()).destroy(*m_buttonText);
}

_______

The obsolete patch was modify this above function.
Comment 3 zalan 2023-05-10 07:32:22 PDT
This has already been dealt with by switching over to WeakPtr<RenderTextFragment>.