Changeset 161335 in webkit


Ignore:
Timestamp:
Jan 6, 2014, 1:47:01 AM (12 years ago)
Author:
akling@apple.com
Message:

RenderInline::clone() should return RenderPtr.
<https://webkit.org/b/126514>

Patch by Gurpreet Kaur <k.gurpreet@samsung.com> on 2014-01-06
Reviewed by Antti Koivisto.

  • rendering/RenderInline.h:
  • rendering/RenderInline.cpp:

(WebCore::RenderInline::clone):

Tweaked to return RenderPtr<RenderInline>.

(WebCore::RenderInline::splitInlines):

Store cloned RenderInlines in RenderPtrs. Use leakPtr() to sink
them into ownership-taking APIs that still use raw pointers.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r161334 r161335  
    112014-01-06  Gurpreet Kaur  <k.gurpreet@samsung.com>
     2
     3        RenderInline::clone() should return RenderPtr.
     4        <https://webkit.org/b/126514>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * rendering/RenderInline.h:
     9        * rendering/RenderInline.cpp:
     10        (WebCore::RenderInline::clone):
     11
     12            Tweaked to return RenderPtr<RenderInline>.
     13
     14        (WebCore::RenderInline::splitInlines):
     15
     16            Store cloned RenderInlines in RenderPtrs. Use leakPtr() to sink
     17            them into ownership-taking APIs that still use raw pointers.
     18
     192014-01-06  Andreas Kling  <akling@apple.com>
    220
    321        <hr> appears gray instead of green because of color attribute is defined followed by noshade attribute
  • trunk/Source/WebCore/rendering/RenderInline.cpp

    r160599 r161335  
    331331}
    332332
    333 RenderInline* RenderInline::clone() const
    334 {
    335     RenderInline* cloneInline = new RenderInline(*element(), style());
     333RenderPtr<RenderInline> RenderInline::clone() const
     334{
     335    RenderPtr<RenderInline> cloneInline = createRenderer<RenderInline>(*element(), style());
    336336    cloneInline->initializeStyle();
    337337    cloneInline->setFlowThreadState(flowThreadState());
     
    344344{
    345345    // Create a clone of this inline.
    346     RenderInline* cloneInline = clone();
     346    RenderPtr<RenderInline> cloneInline = clone();
    347347    cloneInline->setContinuation(oldCont);
    348348
     
    370370
    371371    // Hook |clone| up as the continuation of the middle block.
    372     middleBlock->setContinuation(cloneInline);
     372    middleBlock->setContinuation(cloneInline.get());
    373373
    374374    // We have been reparented and are now under the fromBlock.  We need
     
    388388        if (splitDepth < cMaxSplitDepth) {
    389389            // Create a new clone.
    390             RenderInline* cloneChild = cloneInline;
     390            RenderPtr<RenderInline> cloneChild = std::move(cloneInline);
    391391            cloneInline = toRenderInline(curr)->clone();
    392392
    393393            // Insert our child clone as the first child.
    394             cloneInline->addChildIgnoringContinuation(cloneChild, 0);
     394            cloneInline->addChildIgnoringContinuation(cloneChild.leakPtr(), 0);
    395395
    396396            // Hook the clone up as a continuation of |curr|.
    397397            RenderInline* inlineCurr = toRenderInline(curr);
    398398            oldCont = inlineCurr->continuation();
    399             inlineCurr->setContinuation(cloneInline);
     399            inlineCurr->setContinuation(cloneInline.get());
    400400            cloneInline->setContinuation(oldCont);
    401401
     
    419419
    420420    // Now we are at the block level. We need to put the clone into the toBlock.
    421     toBlock->insertChildInternal(cloneInline, nullptr, NotifyChildren);
     421    toBlock->insertChildInternal(cloneInline.leakPtr(), nullptr, NotifyChildren);
    422422
    423423    // Now take all the children after currChild and remove them from the fromBlock
  • trunk/Source/WebCore/rendering/RenderInline.h

    r160236 r161335  
    170170    virtual void updateFromStyle() OVERRIDE FINAL;
    171171   
    172     RenderInline* clone() const;
     172    RenderPtr<RenderInline> clone() const;
    173173
    174174    void paintOutlineForLine(GraphicsContext*, const LayoutPoint&, const LayoutRect& prevLine, const LayoutRect& thisLine,
Note: See TracChangeset for help on using the changeset viewer.