Title: [158398] trunk/Source/WebCore
- Revision
- 158398
- Author
- [email protected]
- Date
- 2013-10-31 14:59:49 -0700 (Thu, 31 Oct 2013)
Log Message
Manage line-grid RootInlineBox with unique_ptr.
<https://webkit.org/b/123583>
Use smart pointers for the RenderBlockFlow's optional line-grid box
instead of manual new/delete.
Reviewed by Antti Koivisto.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (158397 => 158398)
--- trunk/Source/WebCore/ChangeLog 2013-10-31 21:50:04 UTC (rev 158397)
+++ trunk/Source/WebCore/ChangeLog 2013-10-31 21:59:49 UTC (rev 158398)
@@ -1,3 +1,13 @@
+2013-10-31 Andreas Kling <[email protected]>
+
+ Manage line-grid RootInlineBox with unique_ptr.
+ <https://webkit.org/b/123583>
+
+ Use smart pointers for the RenderBlockFlow's optional line-grid box
+ instead of manual new/delete.
+
+ Reviewed by Antti Koivisto.
+
2013-10-31 Alexey Proskuryakov <[email protected]>
Enable WebCrypto on Mac
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (158397 => 158398)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2013-10-31 21:50:04 UTC (rev 158397)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2013-10-31 21:59:49 UTC (rev 158398)
@@ -113,8 +113,6 @@
// Mark as being destroyed to avoid trouble with merges in removeChild().
m_beingDestroyed = true;
- delete lineGridBox();
-
if (renderNamedFlowFragment())
setRenderNamedFlowFragment(0);
@@ -1705,15 +1703,15 @@
setLineGridBox(0);
- RootInlineBox* lineGridBox = new RootInlineBox(*this);
+ auto lineGridBox = std::make_unique<RootInlineBox>(*this);
lineGridBox->setHasTextChildren(); // Needed to make the line ascent/descent actually be honored in quirks mode.
lineGridBox->setConstructed();
GlyphOverflowAndFallbackFontsMap textBoxDataMap;
VerticalPositionCache verticalPositionCache;
lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, verticalPositionCache);
- setLineGridBox(lineGridBox);
-
+ setLineGridBox(std::move(lineGridBox));
+
// FIXME: If any of the characteristics of the box change compared to the old one, then we need to do a deep dirtying
// (similar to what happens when the page height changes). Ideally, though, we only do this if someone is actually snapping
// to this grid.
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (158397 => 158398)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.h 2013-10-31 21:50:04 UTC (rev 158397)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h 2013-10-31 21:59:49 UTC (rev 158398)
@@ -98,7 +98,6 @@
RenderBlockFlowRareData(const RenderBlockFlow& block)
: m_margins(positiveMarginBeforeDefault(block), negativeMarginBeforeDefault(block), positiveMarginAfterDefault(block), negativeMarginAfterDefault(block))
, m_lineBreakToAvoidWidow(-1)
- , m_lineGridBox(nullptr)
, m_renderNamedFlowFragment(nullptr)
, m_discardMarginBefore(false)
, m_discardMarginAfter(false)
@@ -125,7 +124,7 @@
MarginValues m_margins;
int m_lineBreakToAvoidWidow;
- RootInlineBox* m_lineGridBox;
+ std::unique_ptr<RootInlineBox> m_lineGridBox;
RenderNamedFlowFragment* m_renderNamedFlowFragment;
bool m_discardMarginBefore : 1;
@@ -237,13 +236,12 @@
virtual bool canHaveGeneratedChildren() const OVERRIDE;
- RootInlineBox* lineGridBox() const { return m_rareData ? m_rareData->m_lineGridBox : 0; }
- void setLineGridBox(RootInlineBox* box)
+ RootInlineBox* lineGridBox() const { return m_rareData ? m_rareData->m_lineGridBox.get() : nullptr; }
+ void setLineGridBox(std::unique_ptr<RootInlineBox> box)
{
if (!m_rareData)
m_rareData = adoptPtr(new RenderBlockFlowRareData(*this));
- delete m_rareData->m_lineGridBox;
- m_rareData->m_lineGridBox = box;
+ m_rareData->m_lineGridBox = std::move(box);
}
void layoutLineGridBox();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes