Title: [183169] trunk/Source
Revision
183169
Author
[email protected]
Date
2015-04-22 22:20:23 -0700 (Wed, 22 Apr 2015)

Log Message

Eliminate remaining uses of OwnPtr and PassOwnPtr in WebCore outside the editing and platform directories
https://bugs.webkit.org/show_bug.cgi?id=143949

Reviewed by Andreas Kling.

Source/WebCore:

* dom/ContainerNode.h: Removed unneeded includes and forward declarations.
* dom/Document.h: Ditto.

* dom/DocumentParser.h: Fixed comment to not mention PassOwnPtr.

* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::create): Return a Ref instead of a PassRefPtr.
(WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation): Pass a reference
rather than a pointer to TextTrackRepresentation::create.
(WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage): Return a
RefPtr instead of a PassRefPtr.

* html/shadow/MediaControlElements.h: Use unique_ptr for m_textTrackRepresentation.
Also fix a couple uses of PassRefPtr.

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::DocumentLoader): Use make_unique.
(WebCore::DocumentLoader::addAllArchiveResources): Ditto.
(WebCore::DocumentLoader::addArchiveResource): Ditto.
(WebCore::DocumentLoader::clearArchiveResources): Set to nullptr instead of calling clear.
(WebCore::DocumentLoader::startLoadingMainResource): Use make_unique.
* loader/DocumentLoader.h: Made m_archiveResourceCollection and
m_applicationCacheHost use unique_ptr.

* loader/WorkerThreadableLoader.cpp:
(WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveData): Use delete here instead
of using OwnPtr to do the deletion. Matches the other code nearby.

* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::disassociateDocumentLoader): Handle case where the host is
null; this happens during the DocumentLoader destruction process since unique_ptr sets itself
to null before it destroys the object it points to and OwnPtr does not.

* loader/cocoa/DiskCacheMonitorCocoa.mm:
(WebCore::DiskCacheMonitor::monitorFileBackingStoreCreation): Use delete instead of adoptPtr
to delete a raw pointer.
(WebCore::DiskCacheMonitor::DiskCacheMonitor): Use unique_ptr instead of OwnPtr.

* page/DragController.h: Removed some unneeded forward declarations and changed the
create function to return unique_ptr.

* platform/LayoutUnit.h: Removed wtf_ceil workaround hack here. Not sure why we ever did it
this way!

* platform/graphics/FontCascade.cpp:
(WTF::deleteOwnedPtr<WebCore::TextLayout>): Deleted.
(WebCore::FontCascade::createLayout): Changed to return a unique_ptr.
(WebCore::FontCascade::deleteLayout): Deleted.
* platform/graphics/FontCascade.h: Made the above changes.

* platform/graphics/ImageBuffer.h: Changed copyImage to return a RefPtr instead of a PassRefPtr.

* platform/graphics/TextTrackRepresentation.cpp:
(WebCore::TextTrackRepresentation::create): Use make_unique and return a unique_ptr.
* platform/graphics/TextTrackRepresentation.h: Removed unneeded includes and forward declarations
and made create return a unique_ptr.
* platform/graphics/cairo/ImageBufferCairo.cpp:
(WebCore::ImageBuffer::copyImage): Changed to return a RefPtr.
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::ImageBuffer::copyImage): Changed to return a RefPtr.

* platform/graphics/ios/TextTrackRepresentationIOS.h: Use reference instead of pointer,
made more things private.
* platform/graphics/ios/TextTrackRepresentationIOS.mm:
(TextTrackRepresentation::create): Use make_unique.
(TextTrackRepresentationIOS::TextTrackRepresentationIOS): Take a reference.

* platform/graphics/mac/ComplexTextController.cpp:
(WebCore::FontCascade::createLayout): Return a unique_ptr with a custom destruction function.
The custom destruction function eliminates the need to put TextLayout in a visible header.
(WebCore::FontCascade::deleteLayout): Deleted. Use a lambda instead.
(WebCore::roundCGFloat): Deleted. Old fashioned way to deal with multiple floating point sizes.
Just use std::round instead.
(WebCore::ceilCGFloat): Deleted. Same as above. Just use std::ceil instead.
(WebCore::ComplexTextController::adjustGlyphsAndAdvances): Use std::round and std::ceil.

* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderTextInfo::RenderTextInfo): Deleted. Can compile constructor and destructor
now thanks to use of unique_ptr with a custom deleter.
(WebCore::RenderTextInfo::~RenderTextInfo): Deleted. Ditto.
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange): Updated for RenderTextInfo data member
name change.

* rendering/RenderView.h: Removed unneeded include.

* rendering/line/BreakingContext.h: Removed unneeded include.
(WebCore::BreakingContext::handleOutOfFlowPositioned): Updated for RenderTextInfo data member
name change.
(WebCore::BreakingContext::handleFloat): Ditto.
(WebCore::BreakingContext::handleReplaced): Ditto.
(WebCore::BreakingContext::handleText): Ditto.
(WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord): Ditto.

* rendering/line/LineBreaker.h: Made the RenderTextInfo struct more like a struct by taking
off all the m_ prefixes from the data member names. Initialized all the values in the struct
to defaults so we don't need an explicit constructor. We also don't need an explicit destructor
any more due to use of a unique_ptr with a deleter.

Source/WTF:

* wtf/MathExtras.h:
(wtf_ceil): Deleted. This was a workaround for a bug that was introduced in Leopard and
fixed in Snow Leopard <rdar://problem/6286405>, so we don't need the workaround any more.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (183168 => 183169)


--- trunk/Source/WTF/ChangeLog	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WTF/ChangeLog	2015-04-23 05:20:23 UTC (rev 183169)
@@ -1,3 +1,14 @@
+2015-04-22  Darin Adler  <[email protected]>
+
+        Eliminate remaining uses of OwnPtr and PassOwnPtr in WebCore outside the editing and platform directories
+        https://bugs.webkit.org/show_bug.cgi?id=143949
+
+        Reviewed by Andreas Kling.
+
+        * wtf/MathExtras.h:
+        (wtf_ceil): Deleted. This was a workaround for a bug that was introduced in Leopard and
+        fixed in Snow Leopard <rdar://problem/6286405>, so we don't need the workaround any more.
+
 2015-04-22  Alexey Proskuryakov  <[email protected]>
 
         [Mac] In nightlies and local builds, WebKit services can get terminated under memory pressure

Modified: trunk/Source/WTF/wtf/MathExtras.h (183168 => 183169)


--- trunk/Source/WTF/wtf/MathExtras.h	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WTF/wtf/MathExtras.h	2015-04-23 05:20:23 UTC (rev 183169)
@@ -75,15 +75,6 @@
 const float sqrtOfTwoFloat = static_cast<float>(M_SQRT2);
 #endif
 
-#if OS(DARWIN)
-
-// Work around a bug in the Mac OS X libc where ceil(-0.1) return +0.
-inline double wtf_ceil(double x) { return copysign(ceil(x), x); }
-
-#define ceil(x) wtf_ceil(x)
-
-#endif
-
 #if OS(SOLARIS)
 
 namespace std {

Modified: trunk/Source/WebCore/ChangeLog (183168 => 183169)


--- trunk/Source/WebCore/ChangeLog	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/ChangeLog	2015-04-23 05:20:23 UTC (rev 183169)
@@ -1,3 +1,108 @@
+2015-04-22  Darin Adler  <[email protected]>
+
+        Eliminate remaining uses of OwnPtr and PassOwnPtr in WebCore outside the editing and platform directories
+        https://bugs.webkit.org/show_bug.cgi?id=143949
+
+        Reviewed by Andreas Kling.
+
+        * dom/ContainerNode.h: Removed unneeded includes and forward declarations.
+        * dom/Document.h: Ditto.
+
+        * dom/DocumentParser.h: Fixed comment to not mention PassOwnPtr.
+
+        * html/shadow/MediaControlElements.cpp:
+        (WebCore::MediaControlTextTrackContainerElement::create): Return a Ref instead of a PassRefPtr.
+        (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation): Pass a reference
+        rather than a pointer to TextTrackRepresentation::create.
+        (WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage): Return a
+        RefPtr instead of a PassRefPtr.
+
+        * html/shadow/MediaControlElements.h: Use unique_ptr for m_textTrackRepresentation.
+        Also fix a couple uses of PassRefPtr.
+
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::DocumentLoader): Use make_unique.
+        (WebCore::DocumentLoader::addAllArchiveResources): Ditto.
+        (WebCore::DocumentLoader::addArchiveResource): Ditto.
+        (WebCore::DocumentLoader::clearArchiveResources): Set to nullptr instead of calling clear.
+        (WebCore::DocumentLoader::startLoadingMainResource): Use make_unique.
+        * loader/DocumentLoader.h: Made m_archiveResourceCollection and
+        m_applicationCacheHost use unique_ptr.
+
+        * loader/WorkerThreadableLoader.cpp:
+        (WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveData): Use delete here instead
+        of using OwnPtr to do the deletion. Matches the other code nearby.
+
+        * loader/appcache/ApplicationCacheGroup.cpp:
+        (WebCore::ApplicationCacheGroup::disassociateDocumentLoader): Handle case where the host is
+        null; this happens during the DocumentLoader destruction process since unique_ptr sets itself
+        to null before it destroys the object it points to and OwnPtr does not.
+
+        * loader/cocoa/DiskCacheMonitorCocoa.mm:
+        (WebCore::DiskCacheMonitor::monitorFileBackingStoreCreation): Use delete instead of adoptPtr
+        to delete a raw pointer.
+        (WebCore::DiskCacheMonitor::DiskCacheMonitor): Use unique_ptr instead of OwnPtr.
+
+        * page/DragController.h: Removed some unneeded forward declarations and changed the
+        create function to return unique_ptr.
+
+        * platform/LayoutUnit.h: Removed wtf_ceil workaround hack here. Not sure why we ever did it
+        this way!
+
+        * platform/graphics/FontCascade.cpp:
+        (WTF::deleteOwnedPtr<WebCore::TextLayout>): Deleted.
+        (WebCore::FontCascade::createLayout): Changed to return a unique_ptr.
+        (WebCore::FontCascade::deleteLayout): Deleted.
+        * platform/graphics/FontCascade.h: Made the above changes.
+
+        * platform/graphics/ImageBuffer.h: Changed copyImage to return a RefPtr instead of a PassRefPtr.
+
+        * platform/graphics/TextTrackRepresentation.cpp:
+        (WebCore::TextTrackRepresentation::create): Use make_unique and return a unique_ptr.
+        * platform/graphics/TextTrackRepresentation.h: Removed unneeded includes and forward declarations
+        and made create return a unique_ptr.
+        * platform/graphics/cairo/ImageBufferCairo.cpp:
+        (WebCore::ImageBuffer::copyImage): Changed to return a RefPtr.
+        * platform/graphics/cg/ImageBufferCG.cpp:
+        (WebCore::ImageBuffer::copyImage): Changed to return a RefPtr.
+
+        * platform/graphics/ios/TextTrackRepresentationIOS.h: Use reference instead of pointer,
+        made more things private.
+        * platform/graphics/ios/TextTrackRepresentationIOS.mm:
+        (TextTrackRepresentation::create): Use make_unique.
+        (TextTrackRepresentationIOS::TextTrackRepresentationIOS): Take a reference.
+
+        * platform/graphics/mac/ComplexTextController.cpp:
+        (WebCore::FontCascade::createLayout): Return a unique_ptr with a custom destruction function.
+        The custom destruction function eliminates the need to put TextLayout in a visible header.
+        (WebCore::FontCascade::deleteLayout): Deleted. Use a lambda instead.
+        (WebCore::roundCGFloat): Deleted. Old fashioned way to deal with multiple floating point sizes.
+        Just use std::round instead.
+        (WebCore::ceilCGFloat): Deleted. Same as above. Just use std::ceil instead.
+        (WebCore::ComplexTextController::adjustGlyphsAndAdvances): Use std::round and std::ceil.
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderTextInfo::RenderTextInfo): Deleted. Can compile constructor and destructor
+        now thanks to use of unique_ptr with a custom deleter.
+        (WebCore::RenderTextInfo::~RenderTextInfo): Deleted. Ditto.
+        (WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange): Updated for RenderTextInfo data member
+        name change.
+
+        * rendering/RenderView.h: Removed unneeded include.
+
+        * rendering/line/BreakingContext.h: Removed unneeded include.
+        (WebCore::BreakingContext::handleOutOfFlowPositioned): Updated for RenderTextInfo data member
+        name change.
+        (WebCore::BreakingContext::handleFloat): Ditto.
+        (WebCore::BreakingContext::handleReplaced): Ditto.
+        (WebCore::BreakingContext::handleText): Ditto.
+        (WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord): Ditto.
+
+        * rendering/line/LineBreaker.h: Made the RenderTextInfo struct more like a struct by taking
+        off all the m_ prefixes from the data member names. Initialized all the values in the struct
+        to defaults so we don't need an explicit constructor. We also don't need an explicit destructor
+        any more due to use of a unique_ptr with a deleter.
+
 2015-04-22  Roger Fong  <[email protected]>
 
         Volume slider appears/doesn't appear at the wrong times.

Modified: trunk/Source/WebCore/dom/ContainerNode.h (183168 => 183169)


--- trunk/Source/WebCore/dom/ContainerNode.h	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/dom/ContainerNode.h	2015-04-23 05:20:23 UTC (rev 183169)
@@ -27,12 +27,8 @@
 #include "ExceptionCodePlaceholder.h"
 #include "Node.h"
 
-#include <wtf/OwnPtr.h>
-#include <wtf/Vector.h>
-
 namespace WebCore {
 
-class FloatPoint;
 class QualifiedName;
 class RenderElement;
 

Modified: trunk/Source/WebCore/dom/Document.h (183168 => 183169)


--- trunk/Source/WebCore/dom/Document.h	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/dom/Document.h	2015-04-23 05:20:23 UTC (rev 183169)
@@ -55,7 +55,6 @@
 #include <memory>
 #include <wtf/Deque.h>
 #include <wtf/HashSet.h>
-#include <wtf/OwnPtr.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/WeakPtr.h>
 

Modified: trunk/Source/WebCore/dom/DocumentParser.h (183168 => 183169)


--- trunk/Source/WebCore/dom/DocumentParser.h	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/dom/DocumentParser.h	2015-04-23 05:20:23 UTC (rev 183169)
@@ -51,7 +51,7 @@
     virtual void flush(DocumentWriter&) = 0;
 
     // FIXME: append() should be private, but DocumentWriter::replaceDocument uses it for now.
-    // FIXME: This really should take a PassOwnPtr to signify that it expects to take
+    // FIXME: This really should take a std::unique_ptr to signify that it expects to take
     // ownership of the buffer. The parser expects the PassRefPtr to hold the only ref of the StringImpl.
     virtual void append(PassRefPtr<StringImpl>) = 0;
 

Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.cpp (183168 => 183169)


--- trunk/Source/WebCore/html/shadow/MediaControlElements.cpp	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.cpp	2015-04-23 05:20:23 UTC (rev 183169)
@@ -1081,11 +1081,11 @@
     setPseudo(AtomicString("-webkit-media-text-track-container", AtomicString::ConstructFromLiteral));
 }
 
-PassRefPtr<MediaControlTextTrackContainerElement> MediaControlTextTrackContainerElement::create(Document& document)
+Ref<MediaControlTextTrackContainerElement> MediaControlTextTrackContainerElement::create(Document& document)
 {
-    RefPtr<MediaControlTextTrackContainerElement> element = adoptRef(new MediaControlTextTrackContainerElement(document));
+    auto element = adoptRef(*new MediaControlTextTrackContainerElement(document));
     element->hide();
-    return element.release();
+    return element;
 }
 
 RenderPtr<RenderElement> MediaControlTextTrackContainerElement::createElementRenderer(Ref<RenderStyle>&& style, const RenderTreePosition&)
@@ -1265,7 +1265,7 @@
         return;
 
     if (!m_textTrackRepresentation) {
-        m_textTrackRepresentation = TextTrackRepresentation::create(this);
+        m_textTrackRepresentation = TextTrackRepresentation::create(*this);
         m_updateTextTrackRepresentationStyle = true;
         mediaElement->setTextTrackRepresentation(m_textTrackRepresentation.get());
     }
@@ -1352,7 +1352,7 @@
     m_updateTimer.startOneShot(0);
 }
 
-PassRefPtr<Image> MediaControlTextTrackContainerElement::createTextTrackRepresentationImage()
+RefPtr<Image> MediaControlTextTrackContainerElement::createTextTrackRepresentationImage()
 {
     if (!hasChildNodes())
         return nullptr;

Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.h (183168 => 183169)


--- trunk/Source/WebCore/html/shadow/MediaControlElements.h	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.h	2015-04-23 05:20:23 UTC (rev 183169)
@@ -443,7 +443,7 @@
 
 class MediaControlTextTrackContainerElement final : public MediaControlDivElement, public TextTrackRepresentationClient {
 public:
-    static PassRefPtr<MediaControlTextTrackContainerElement> create(Document&);
+    static Ref<MediaControlTextTrackContainerElement> create(Document&);
 
     void updateDisplay();
     void updateSizes(bool forceUpdate = false);
@@ -458,12 +458,12 @@
 
     virtual RenderPtr<RenderElement> createElementRenderer(Ref<RenderStyle>&&, const RenderTreePosition&) override;
 
-    virtual PassRefPtr<Image> createTextTrackRepresentationImage() override;
+    virtual RefPtr<Image> createTextTrackRepresentationImage() override;
     virtual void textTrackRepresentationBoundsChanged(const IntRect&) override;
     void updateTextTrackRepresentation();
     void clearTextTrackRepresentation();
     void updateStyleForTextTrackRepresentation();
-    OwnPtr<TextTrackRepresentation> m_textTrackRepresentation;
+    std::unique_ptr<TextTrackRepresentation> m_textTrackRepresentation;
 
     Timer m_updateTimer;
     IntRect m_videoDisplaySize;

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (183168 => 183169)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2015-04-23 05:20:23 UTC (rev 183169)
@@ -140,7 +140,7 @@
     , m_dataLoadTimer(*this, &DocumentLoader::handleSubstituteDataLoadNow)
     , m_waitingForContentPolicy(false)
     , m_subresourceLoadersArePageCacheAcceptable(false)
-    , m_applicationCacheHost(adoptPtr(new ApplicationCacheHost(*this)))
+    , m_applicationCacheHost(std::make_unique<ApplicationCacheHost>(*this))
 #if ENABLE(CONTENT_FILTERING)
     , m_contentFilter(!substituteData.isValid() ? ContentFilter::createIfNeeded(std::bind(&DocumentLoader::contentFilterDidDecide, this)) : nullptr)
 #endif
@@ -997,7 +997,7 @@
 void DocumentLoader::addAllArchiveResources(Archive* archive)
 {
     if (!m_archiveResourceCollection)
-        m_archiveResourceCollection = adoptPtr(new ArchiveResourceCollection);
+        m_archiveResourceCollection = std::make_unique<ArchiveResourceCollection>();
         
     ASSERT(archive);
     if (!archive)
@@ -1011,7 +1011,7 @@
 void DocumentLoader::addArchiveResource(PassRefPtr<ArchiveResource> resource)
 {
     if (!m_archiveResourceCollection)
-        m_archiveResourceCollection = adoptPtr(new ArchiveResourceCollection);
+        m_archiveResourceCollection = std::make_unique<ArchiveResourceCollection>();
         
     ASSERT(resource);
     if (!resource)
@@ -1027,7 +1027,7 @@
 
 void DocumentLoader::clearArchiveResources()
 {
-    m_archiveResourceCollection.clear();
+    m_archiveResourceCollection = nullptr;
     m_substituteResourceDeliveryTimer.stop();
 }
 
@@ -1418,7 +1418,7 @@
         // If the load was aborted by clearing m_request, it's possible the ApplicationCacheHost
         // is now in a state where starting an empty load will be inconsistent. Replace it with
         // a new ApplicationCacheHost.
-        m_applicationCacheHost = adoptPtr(new ApplicationCacheHost(*this));
+        m_applicationCacheHost = std::make_unique<ApplicationCacheHost>(*this);
         maybeLoadEmpty();
         return;
     }

Modified: trunk/Source/WebCore/loader/DocumentLoader.h (183168 => 183169)


--- trunk/Source/WebCore/loader/DocumentLoader.h	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/loader/DocumentLoader.h	2015-04-23 05:20:23 UTC (rev 183169)
@@ -401,7 +401,7 @@
         SubstituteResourceMap m_pendingSubstituteResources;
         Timer m_substituteResourceDeliveryTimer;
 
-        OwnPtr<ArchiveResourceCollection> m_archiveResourceCollection;
+        std::unique_ptr<ArchiveResourceCollection> m_archiveResourceCollection;
 #if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
         RefPtr<Archive> m_archive;
         RefPtr<SharedBuffer> m_parsedArchiveData;
@@ -428,7 +428,7 @@
         bool m_subresourceLoadersArePageCacheAcceptable;
 
         friend class ApplicationCacheHost;  // for substitute resource delivery
-        OwnPtr<ApplicationCacheHost> m_applicationCacheHost;
+        std::unique_ptr<ApplicationCacheHost> m_applicationCacheHost;
 
 #if ENABLE(CONTENT_FILTERING)
         std::unique_ptr<ContentFilter> m_contentFilter;

Modified: trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp (183168 => 183169)


--- trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp	2015-04-23 05:20:23 UTC (rev 183169)
@@ -179,8 +179,8 @@
     memcpy(vectorPtr->data(), data, dataLength);
     if (!m_loaderProxy.postTaskForModeToWorkerGlobalScope([workerClientWrapper, vectorPtr] (ScriptExecutionContext& context) {
         ASSERT_UNUSED(context, context.isWorkerGlobalScope());
-        OwnPtr<Vector<char>> vector = adoptPtr(vectorPtr);
-        workerClientWrapper->didReceiveData(vector->data(), vector->size());
+        workerClientWrapper->didReceiveData(vectorPtr->data(), vectorPtr->size());
+        delete vectorPtr;
     }, m_taskMode))
         delete vectorPtr;
 }

Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp (183168 => 183169)


--- trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp	2015-04-23 05:20:23 UTC (rev 183169)
@@ -351,7 +351,8 @@
     m_associatedDocumentLoaders.remove(loader);
     m_pendingMasterResourceLoaders.remove(loader);
 
-    loader->applicationCacheHost()->setApplicationCache(0); // Will set candidate to 0, too.
+    if (auto* host = loader->applicationCacheHost())
+        host->setApplicationCache(nullptr); // Will set candidate group to null, too.
 
     if (!m_associatedDocumentLoaders.isEmpty() || !m_pendingMasterResourceLoaders.isEmpty())
         return;

Modified: trunk/Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.mm (183168 => 183169)


--- trunk/Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.mm	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.mm	2015-04-23 05:20:23 UTC (rev 183169)
@@ -33,7 +33,6 @@
 #import "SessionID.h"
 #import "SharedBuffer.h"
 #import <wtf/MainThread.h>
-#import <wtf/OwnPtr.h>
 #import <wtf/PassRefPtr.h>
 #import <wtf/RefPtr.h>
 
@@ -60,6 +59,7 @@
     if (!cachedResponse)
         return;
 
+    // FIXME: It's not good to have the new here, but the delete inside the constructor. Reconsider this design.
     new DiskCacheMonitor(request, sessionID, cachedResponse); // Balanced by adoptPtr in the blocks setup in the constructor, one of which is guaranteed to run.
 }
 
@@ -73,8 +73,8 @@
     __block DiskCacheMonitor* rawMonitor = this;
 
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * diskCacheMonitorTimeout), dispatch_get_main_queue(), ^{
-        adoptPtr(rawMonitor); // Balanced by `new DiskCacheMonitor` in monitorFileBackingStoreCreation.
-        rawMonitor = 0;
+        delete rawMonitor; // Balanced by "new DiskCacheMonitor" in monitorFileBackingStoreCreation.
+        rawMonitor = nullptr;
     });
 
     // Set up the disk caching callback to create the ShareableResource and send it to the WebProcess.
@@ -85,8 +85,8 @@
         if (!rawMonitor)
             return;
 
-        OwnPtr<DiskCacheMonitor> monitor = adoptPtr(rawMonitor); // Balanced by `new DiskCacheMonitor` in monitorFileBackingStoreCreation.
-        rawMonitor = 0;
+        auto monitor = std::unique_ptr<DiskCacheMonitor>(rawMonitor); // Balanced by "new DiskCacheMonitor" in monitorFileBackingStoreCreation.
+        rawMonitor = nullptr;
 
         RefPtr<SharedBuffer> fileBackedBuffer = DiskCacheMonitor::tryGetFileBackedSharedBufferFromCFURLCachedResponse(cachedResponse);
         if (!fileBackedBuffer)

Modified: trunk/Source/WebCore/page/DragController.h (183168 => 183169)


--- trunk/Source/WebCore/page/DragController.h	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/page/DragController.h	2015-04-23 05:20:23 UTC (rev 183169)
@@ -35,7 +35,6 @@
 
     class DataTransfer;
     class Document;
-    class DocumentFragment;
     class DragClient;
     class DragData;
     class Element;
@@ -45,7 +44,6 @@
     class IntRect;
     class Page;
     class PlatformMouseEvent;
-    class Range;
 
     struct DragState;
 
@@ -55,7 +53,7 @@
         DragController(Page&, DragClient&);
         ~DragController();
 
-        static PassOwnPtr<DragController> create(Page*, DragClient*);
+        static std::unique_ptr<DragController> create(Page&, DragClient&);
 
         DragClient& client() const { return m_client; }
 

Modified: trunk/Source/WebCore/platform/LayoutUnit.h (183168 => 183169)


--- trunk/Source/WebCore/platform/LayoutUnit.h	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/platform/LayoutUnit.h	2015-04-23 05:20:23 UTC (rev 183169)
@@ -178,11 +178,7 @@
         returnValue.setRawValue(::abs(m_value));
         return returnValue;
     }
-#if OS(DARWIN)
-    int wtf_ceil() const
-#else
     int ceil() const
-#endif
     {
 #if ENABLE(SATURATED_LAYOUT_ARITHMETIC)
         if (UNLIKELY(m_value >= INT_MAX - kFixedPointDenominator + 1))

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (183168 => 183169)


--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2015-04-23 05:20:23 UTC (rev 183169)
@@ -39,16 +39,6 @@
 using namespace WTF;
 using namespace Unicode;
 
-namespace WTF {
-
-// allow compilation of OwnPtr<TextLayout> in source files that don't have access to the TextLayout class definition
-template <> void deleteOwnedPtr<WebCore::TextLayout>(WebCore::TextLayout* ptr)
-{
-    WebCore::FontCascade::deleteLayout(ptr);
-}
-
-}
-
 namespace WebCore {
 
 static Ref<FontCascadeFonts> retrieveOrAddCachedFonts(const FontDescription&, PassRefPtr<FontSelector>);
@@ -441,12 +431,13 @@
 }
 
 #if !PLATFORM(COCOA)
-PassOwnPtr<TextLayout> FontCascade::createLayout(RenderText*, float, bool) const
+
+std::unique_ptr<TextLayout, TextLayoutDeleter> FontCascade::createLayout(RenderText&, float, bool) const
 {
     return nullptr;
 }
 
-void FontCascade::deleteLayout(TextLayout*)
+void TextLayoutDeleter::operator()(TextLayout*) const
 {
 }
 
@@ -455,10 +446,9 @@
     ASSERT_NOT_REACHED();
     return 0;
 }
+
 #endif
 
-
-
 static const char* fontFamiliesWithInvalidCharWidth[] = {
     "American Typewriter",
     "Arial Hebrew",

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.h (183168 => 183169)


--- trunk/Source/WebCore/platform/graphics/FontCascade.h	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.h	2015-04-23 05:20:23 UTC (rev 183169)
@@ -107,6 +107,11 @@
 };
 GlyphToPathTranslator::GlyphUnderlineType computeUnderlineType(const TextRun&, const GlyphBuffer&, int index);
 
+class TextLayoutDeleter {
+public:
+    void operator()(TextLayout*) const;
+};
+
 class FontCascade {
 public:
     WEBCORE_EXPORT FontCascade();
@@ -118,7 +123,6 @@
 #if PLATFORM(IOS)
     FontCascade(const FontPlatformData&, PassRefPtr<FontSelector>);
 #endif
-    ~FontCascade();
 
     FontCascade(const FontCascade&);
     WEBCORE_EXPORT FontCascade& operator=(const FontCascade&);
@@ -143,8 +147,7 @@
     WEBCORE_EXPORT float width(const TextRun&, HashSet<const Font*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
     float width(const TextRun&, int& charsConsumed, String& glyphName) const;
 
-    PassOwnPtr<TextLayout> createLayout(RenderText*, float xPos, bool collapseWhiteSpace) const;
-    static void deleteLayout(TextLayout*);
+    std::unique_ptr<TextLayout, TextLayoutDeleter> createLayout(RenderText&, float xPos, bool collapseWhiteSpace) const;
     static float width(TextLayout&, unsigned from, unsigned len, HashSet<const Font*>* fallbackFonts = 0);
 
     int offsetForPosition(const TextRun&, float position, bool includePartialGlyphs) const;
@@ -360,10 +363,6 @@
 void pruneSystemFallbackFonts();
 void clearWidthCaches();
 
-inline FontCascade::~FontCascade()
-{
-}
-
 inline const Font& FontCascade::primaryFont() const
 {
     ASSERT(m_fonts);
@@ -398,10 +397,4 @@
 
 }
 
-namespace WTF {
-
-template <> void deleteOwnedPtr<WebCore::TextLayout>(WebCore::TextLayout*);
-
-}
-
 #endif

Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.h (183168 => 183169)


--- trunk/Source/WebCore/platform/graphics/ImageBuffer.h	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.h	2015-04-23 05:20:23 UTC (rev 183169)
@@ -94,7 +94,7 @@
 
     WEBCORE_EXPORT GraphicsContext* context() const;
 
-    WEBCORE_EXPORT PassRefPtr<Image> copyImage(BackingStoreCopy = CopyBackingStore, ScaleBehavior = Scaled) const;
+    WEBCORE_EXPORT RefPtr<Image> copyImage(BackingStoreCopy = CopyBackingStore, ScaleBehavior = Scaled) const;
     // Give hints on the faster copyImage Mode, return DontCopyBackingStore if it supports the DontCopyBackingStore behavior
     // or return CopyBackingStore if it doesn't.  
     static BackingStoreCopy fastCopyImageMode();

Modified: trunk/Source/WebCore/platform/graphics/TextTrackRepresentation.cpp (183168 => 183169)


--- trunk/Source/WebCore/platform/graphics/TextTrackRepresentation.cpp	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/platform/graphics/TextTrackRepresentation.cpp	2015-04-23 05:20:23 UTC (rev 183169)
@@ -29,22 +29,26 @@
 
 #include "TextTrackRepresentation.h"
 
+#include "IntRect.h"
+
 namespace WebCore {
 
 class NullTextTrackRepresentation : public TextTrackRepresentation {
 public:
     virtual ~NullTextTrackRepresentation() { }
     virtual void update() { }
-    virtual PlatformLayer* platformLayer() { return 0; }
+    virtual PlatformLayer* platformLayer() { return nullptr; }
     virtual void setContentScale(float) { }
     virtual IntRect bounds() const { return IntRect(); }
 };
 
 #if !PLATFORM(IOS)
-PassOwnPtr<TextTrackRepresentation> TextTrackRepresentation::create(TextTrackRepresentationClient*)
+
+std::unique_ptr<TextTrackRepresentation> TextTrackRepresentation::create(TextTrackRepresentationClient&)
 {
-    return WTF::adoptPtr(new NullTextTrackRepresentation());
+    return std::make_unique<NullTextTrackRepresentation>();
 }
+
 #endif
 
 }

Modified: trunk/Source/WebCore/platform/graphics/TextTrackRepresentation.h (183168 => 183169)


--- trunk/Source/WebCore/platform/graphics/TextTrackRepresentation.h	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/platform/graphics/TextTrackRepresentation.h	2015-04-23 05:20:23 UTC (rev 183169)
@@ -28,14 +28,11 @@
 
 #if ENABLE(VIDEO_TRACK)
 
-#include "IntRect.h"
 #include "PlatformLayer.h"
-#include <wtf/PassOwnPtr.h>
-#include <wtf/PassRefPtr.h>
+#include <wtf/Forward.h>
 
 namespace WebCore {
 
-class GraphicsContext;
 class Image;
 class IntRect;
 
@@ -43,13 +40,13 @@
 public:
     virtual ~TextTrackRepresentationClient() { }
 
-    virtual PassRefPtr<Image> createTextTrackRepresentationImage() = 0;
+    virtual RefPtr<Image> createTextTrackRepresentationImage() = 0;
     virtual void textTrackRepresentationBoundsChanged(const IntRect&) = 0;
 };
 
 class TextTrackRepresentation {
 public:
-    static PassOwnPtr<TextTrackRepresentation> create(TextTrackRepresentationClient*);
+    static std::unique_ptr<TextTrackRepresentation> create(TextTrackRepresentationClient&);
 
     virtual ~TextTrackRepresentation() { }
 

Modified: trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp (183168 => 183169)


--- trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp	2015-04-23 05:20:23 UTC (rev 183169)
@@ -131,7 +131,7 @@
     return m_data.m_context.get();
 }
 
-PassRefPtr<Image> ImageBuffer::copyImage(BackingStoreCopy copyBehavior, ScaleBehavior) const
+RefPtr<Image> ImageBuffer::copyImage(BackingStoreCopy copyBehavior, ScaleBehavior) const
 {
     if (copyBehavior == CopyBackingStore)
         return BitmapImage::create(copyCairoImageSurface(m_data.m_surface.get()));

Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp (183168 => 183169)


--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp	2015-04-23 05:20:23 UTC (rev 183169)
@@ -177,7 +177,7 @@
     return image;
 }
 
-PassRefPtr<Image> ImageBuffer::copyImage(BackingStoreCopy copyBehavior, ScaleBehavior scaleBehavior) const
+RefPtr<Image> ImageBuffer::copyImage(BackingStoreCopy copyBehavior, ScaleBehavior scaleBehavior) const
 {
     RetainPtr<CGImageRef> image;
     if (m_resolutionScale == 1 || scaleBehavior == Unscaled) {
@@ -196,10 +196,10 @@
     if (!image)
         return nullptr;
 
-    RefPtr<BitmapImage> bitmapImage = BitmapImage::create(image.get());
+    auto bitmapImage = BitmapImage::create(image.get());
     bitmapImage->setSpaceSize(spaceSize());
 
-    return bitmapImage.release();
+    return WTF::move(bitmapImage);
 }
 
 BackingStoreCopy ImageBuffer::fastCopyImageMode()

Modified: trunk/Source/WebCore/platform/graphics/ios/TextTrackRepresentationIOS.h (183168 => 183169)


--- trunk/Source/WebCore/platform/graphics/ios/TextTrackRepresentationIOS.h	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/platform/graphics/ios/TextTrackRepresentationIOS.h	2015-04-23 05:20:23 UTC (rev 183169)
@@ -36,20 +36,21 @@
 
 namespace WebCore {
 
-class TextTrackRepresentationIOS : public TextTrackRepresentation {
+class TextTrackRepresentationIOS final : public TextTrackRepresentation {
 public:
-    TextTrackRepresentationIOS(TextTrackRepresentationClient*);
+    explicit TextTrackRepresentationIOS(TextTrackRepresentationClient&);
     virtual ~TextTrackRepresentationIOS();
 
-    virtual void update() override;
+    TextTrackRepresentationClient& client() const { return m_client; }
+
     virtual PlatformLayer* platformLayer() override { return m_layer.get(); }
-    virtual void setContentScale(float) override;
     virtual IntRect bounds() const override;
 
-    TextTrackRepresentationClient* client() const { return m_client; }
+private:
+    virtual void update() override;
+    virtual void setContentScale(float) override;
 
-private:
-    TextTrackRepresentationClient* m_client;
+    TextTrackRepresentationClient& m_client;
     RetainPtr<CALayer> m_layer;
     RetainPtr<WebCoreTextTrackRepresentationIOSHelper> m_delegate;
 };

Modified: trunk/Source/WebCore/platform/graphics/ios/TextTrackRepresentationIOS.mm (183168 => 183169)


--- trunk/Source/WebCore/platform/graphics/ios/TextTrackRepresentationIOS.mm	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/platform/graphics/ios/TextTrackRepresentationIOS.mm	2015-04-23 05:20:23 UTC (rev 183169)
@@ -31,9 +31,9 @@
 
 #include "FloatRect.h"
 #include "GraphicsContextCG.h"
+#include "IntRect.h"
 #include "WebCoreThread.h"
 #include "WebCoreThreadRun.h"
-#include <wtf/OwnPtr.h>
 
 using namespace WebCore;
 
@@ -57,7 +57,7 @@
 
 - (void)dealloc
 {
-    self.parent = nil;
+    self.parent = nullptr;
     [super dealloc];
 }
 
@@ -83,7 +83,7 @@
     UNUSED_PARAM(context);
     WebThreadRun(^{
         if (_parent && [keyPath isEqual:@"bounds"] && object == _parent->platformLayer())
-            _parent->client()->textTrackRepresentationBoundsChanged(_parent->bounds());
+            _parent->client().textTrackRepresentationBoundsChanged(_parent->bounds());
     });
 }
 
@@ -97,12 +97,12 @@
 
 @end
 
-PassOwnPtr<TextTrackRepresentation> TextTrackRepresentation::create(TextTrackRepresentationClient* client)
+std::unique_ptr<TextTrackRepresentation> TextTrackRepresentation::create(TextTrackRepresentationClient& client)
 {
-    return adoptPtr(new TextTrackRepresentationIOS(client));
+    return std::make_unique<TextTrackRepresentationIOS>(client);
 }
 
-TextTrackRepresentationIOS::TextTrackRepresentationIOS(TextTrackRepresentationClient* client)
+TextTrackRepresentationIOS::TextTrackRepresentationIOS(TextTrackRepresentationClient& client)
     : m_client(client)
     , m_layer(adoptNS([[CALayer alloc] init]))
     , m_delegate(adoptNS([[WebCoreTextTrackRepresentationIOSHelper alloc] initWithParent:this]))
@@ -114,12 +114,12 @@
 TextTrackRepresentationIOS::~TextTrackRepresentationIOS()
 {
     [m_layer.get() setDelegate:nil];
-    [m_delegate.get() setParent:0];
+    [m_delegate.get() setParent:nullptr];
 }
 
 void TextTrackRepresentationIOS::update()
 {
-    if (RefPtr<Image> representation = m_client->createTextTrackRepresentationImage())
+    if (auto representation = m_client.createTextTrackRepresentationImage())
         [m_layer.get() setContents:(id)representation->getCGImageRef()];
 }
 

Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp (183168 => 183169)


--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp	2015-04-23 05:20:23 UTC (rev 183169)
@@ -32,25 +32,28 @@
 #include "RenderText.h"
 #include "TextBreakIterator.h"
 #include "TextRun.h"
-#if !PLATFORM(IOS)
-#include <ApplicationServices/ApplicationServices.h>
-#else
-#include <CoreText/CoreText.h>
-#endif
 #include <wtf/StdLibExtras.h>
 #include <wtf/unicode/CharacterNames.h>
 
+#if PLATFORM(IOS)
+#include <CoreText/CoreText.h>
+#endif
+
+#if PLATFORM(MAC)
+#include <ApplicationServices/ApplicationServices.h>
+#endif
+
 namespace WebCore {
 
 class TextLayout {
 public:
-    static bool isNeeded(RenderText* text, const FontCascade& font)
+    static bool isNeeded(RenderText& text, const FontCascade& font)
     {
-        TextRun run = RenderBlock::constructTextRun(text, font, text, text->style());
+        TextRun run = RenderBlock::constructTextRun(&text, font, &text, text.style());
         return font.codePath(run) == FontCascade::Complex;
     }
 
-    TextLayout(RenderText* text, const FontCascade& font, float xPos)
+    TextLayout(RenderText& text, const FontCascade& font, float xPos)
         : m_font(font)
         , m_run(constructTextRun(text, font, xPos))
         , m_controller(std::make_unique<ComplexTextController>(m_font, m_run, true))
@@ -69,12 +72,11 @@
     }
 
 private:
-    static TextRun constructTextRun(RenderText* text, const FontCascade& font, float xPos)
+    static TextRun constructTextRun(RenderText& text, const FontCascade& font, float xPos)
     {
-        TextRun run = RenderBlock::constructTextRun(text, font, text, text->style());
-        run.setCharactersLength(text->textLength());
+        TextRun run = RenderBlock::constructTextRun(&text, font, &text, text.style());
+        run.setCharactersLength(text.textLength());
         ASSERT(run.charactersLength() >= run.length());
-
         run.setXPos(xPos);
         return run;
     }
@@ -85,16 +87,16 @@
     std::unique_ptr<ComplexTextController> m_controller;
 };
 
-PassOwnPtr<TextLayout> FontCascade::createLayout(RenderText* text, float xPos, bool collapseWhiteSpace) const
+void TextLayoutDeleter::operator()(TextLayout* layout) const
 {
-    if (!collapseWhiteSpace || !TextLayout::isNeeded(text, *this))
-        return nullptr;
-    return adoptPtr(new TextLayout(text, *this, xPos));
+    delete layout;
 }
 
-void FontCascade::deleteLayout(TextLayout* layout)
+std::unique_ptr<TextLayout, TextLayoutDeleter> FontCascade::createLayout(RenderText& text, float xPos, bool collapseWhiteSpace) const
 {
-    delete layout;
+    if (!collapseWhiteSpace || !TextLayout::isNeeded(text, *this))
+        return nullptr;
+    return std::unique_ptr<TextLayout, TextLayoutDeleter>(new TextLayout(text, *this, xPos));
 }
 
 float FontCascade::width(TextLayout& layout, unsigned from, unsigned len, HashSet<const Font*>* fallbackFonts)
@@ -102,20 +104,6 @@
     return layout.width(from, len, fallbackFonts);
 }
 
-static inline CGFloat roundCGFloat(CGFloat f)
-{
-    if (sizeof(CGFloat) == sizeof(float))
-        return roundf(static_cast<float>(f));
-    return static_cast<CGFloat>(round(f));
-}
-
-static inline CGFloat ceilCGFloat(CGFloat f)
-{
-    if (sizeof(CGFloat) == sizeof(float))
-        return ceilf(static_cast<float>(f));
-    return static_cast<CGFloat>(ceil(f));
-}
-
 ComplexTextController::ComplexTextController(const FontCascade& font, const TextRun& run, bool mayUseNaturalWritingDirection, HashSet<const Font*>* fallbackFonts, bool forTextEmphasis)
     : m_font(font)
     , m_run(run)
@@ -637,7 +625,7 @@
 
         bool lastRun = r + 1 == runCount;
         float spaceWidth = font.spaceWidth() - font.syntheticBoldOffset();
-        CGFloat roundedSpaceWidth = roundCGFloat(spaceWidth);
+        CGFloat roundedSpaceWidth = std::round(spaceWidth);
         const UChar* cp = complexTextRun.characters();
         CGPoint glyphOrigin = CGPointZero;
         CFIndex lastCharacterIndex = m_run.ltr() ? std::numeric_limits<CFIndex>::min() : std::numeric_limits<CFIndex>::max();
@@ -748,14 +736,14 @@
             // Force characters that are used to determine word boundaries for the rounding hack 
             // to be integer width, so the following words will start on an integer boundary. 
             if (m_run.applyWordRounding() && FontCascade::isRoundingHackCharacter(ch)) 
-                advance.width = ceilCGFloat(advance.width); 
+                advance.width = std::ceil(advance.width);
 
             // Check to see if the next character is a "rounding hack character", if so, adjust the 
             // width so that the total run width will be on an integer boundary.
             bool needsRoundingForCharacter = m_run.applyWordRounding() && !lastGlyph && FontCascade::isRoundingHackCharacter(nextCh);
             if (needsRoundingForCharacter || (m_run.applyRunRounding() && lastGlyph)) {
                 CGFloat totalWidth = widthSinceLastCommit + advance.width; 
-                widthSinceLastCommit = ceilCGFloat(totalWidth); 
+                widthSinceLastCommit = std::ceil(totalWidth);
                 CGFloat extraWidth = widthSinceLastCommit - totalWidth; 
                 if (m_run.ltr()) 
                     advance.width += extraWidth; 

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (183168 => 183169)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2015-04-23 05:20:23 UTC (rev 183169)
@@ -1204,16 +1204,6 @@
     repaintDirtyFloats(layoutState.floats());
 }
 
-RenderTextInfo::RenderTextInfo()
-    : m_text(0)
-    , m_font(0)
-{
-}
-
-RenderTextInfo::~RenderTextInfo()
-{
-}
-
 // Before restarting the layout loop with a new logicalHeight, remove all floats that were added and reset the resolver.
 inline const InlineIterator& RenderBlockFlow::restartLayoutRunsAndFloatsInRange(LayoutUnit oldLogicalHeight, LayoutUnit newLogicalHeight,  FloatingObject* lastFloatFromPreviousLine, InlineBidiResolver& resolver,  const InlineIterator& oldEnd)
 {
@@ -1256,8 +1246,8 @@
 
         WordMeasurements wordMeasurements;
         end = lineBreaker.nextLineBreak(resolver, layoutState.lineInfo(), renderTextInfo, lastFloatFromPreviousLine, consecutiveHyphenatedLines, wordMeasurements);
-        cachePriorCharactersIfNeeded(renderTextInfo.m_lineBreakIterator);
-        renderTextInfo.m_lineBreakIterator.resetPriorContext();
+        cachePriorCharactersIfNeeded(renderTextInfo.lineBreakIterator);
+        renderTextInfo.lineBreakIterator.resetPriorContext();
         if (resolver.position().atEnd()) {
             // FIXME: We shouldn't be creating any runs in nextLineBreak to begin with!
             // Once BidiRunList is separated from BidiResolver this will not be needed.

Modified: trunk/Source/WebCore/rendering/RenderView.h (183168 => 183169)


--- trunk/Source/WebCore/rendering/RenderView.h	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/rendering/RenderView.h	2015-04-23 05:20:23 UTC (rev 183169)
@@ -29,7 +29,6 @@
 #include "SelectionSubtreeRoot.h"
 #include <memory>
 #include <wtf/HashSet.h>
-#include <wtf/OwnPtr.h>
 
 #if ENABLE(SERVICE_CONTROLS)
 #include "SelectionRectGatherer.h"

Modified: trunk/Source/WebCore/rendering/line/BreakingContext.h (183168 => 183169)


--- trunk/Source/WebCore/rendering/line/BreakingContext.h	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/rendering/line/BreakingContext.h	2015-04-23 05:20:23 UTC (rev 183169)
@@ -404,7 +404,7 @@
 
     m_width.addUncommittedWidth(inlineLogicalWidth(&box));
     // Reset prior line break context characters.
-    m_renderTextInfo.m_lineBreakIterator.resetPriorContext();
+    m_renderTextInfo.lineBreakIterator.resetPriorContext();
 }
 
 inline void BreakingContext::handleFloat()
@@ -423,7 +423,7 @@
     } else
         m_floatsFitOnLine = false;
     // Update prior line break context characters, using U+FFFD (OBJECT REPLACEMENT CHARACTER) for floating element.
-    m_renderTextInfo.m_lineBreakIterator.updatePriorContext(replacementCharacter);
+    m_renderTextInfo.lineBreakIterator.updatePriorContext(replacementCharacter);
 }
 
 // This is currently just used for list markers and inline flows that have line boxes. Neither should
@@ -489,7 +489,7 @@
 
     // Break on replaced elements if either has normal white-space.
     if (((m_autoWrap || RenderStyle::autoWrap(m_lastWS)) && (!m_current.renderer()->isImage() || m_allowImagesToBreak)
-        && (!m_current.renderer()->isRubyRun() || downcast<RenderRubyRun>(m_current.renderer())->canBreakBefore(m_renderTextInfo.m_lineBreakIterator))) || replacedBox.isAnonymousInlineBlock()) {
+        && (!m_current.renderer()->isRubyRun() || downcast<RenderRubyRun>(m_current.renderer())->canBreakBefore(m_renderTextInfo.lineBreakIterator))) || replacedBox.isAnonymousInlineBlock()) {
         commitLineBreakAtCurrentWidth(*m_current.renderer());
         if (m_width.committedWidth() && replacedBox.isAnonymousInlineBlock()) {
             // Always force a break before an anonymous inline block if there is content on the line
@@ -528,10 +528,10 @@
         m_width.addUncommittedWidth(replacedLogicalWidth);
     if (is<RenderRubyRun>(*m_current.renderer())) {
         m_width.applyOverhang(downcast<RenderRubyRun>(m_current.renderer()), m_lastObject, m_nextObject);
-        downcast<RenderRubyRun>(m_current.renderer())->updatePriorContextFromCachedBreakIterator(m_renderTextInfo.m_lineBreakIterator);
+        downcast<RenderRubyRun>(m_current.renderer())->updatePriorContextFromCachedBreakIterator(m_renderTextInfo.lineBreakIterator);
     } else {
         // Update prior line break context characters, using U+FFFD (OBJECT REPLACEMENT CHARACTER) for replaced element.
-        m_renderTextInfo.m_lineBreakIterator.updatePriorContext(replacementCharacter);
+        m_renderTextInfo.lineBreakIterator.updatePriorContext(replacementCharacter);
     }
     
     if (replacedBox.isAnonymousInlineBlock()) {
@@ -723,27 +723,27 @@
         breakAll = false;
     }
 
-    if (m_renderTextInfo.m_text != &renderText) {
+    if (m_renderTextInfo.text != &renderText) {
         updateCounterIfNeeded(renderText);
-        m_renderTextInfo.m_text = &renderText;
-        m_renderTextInfo.m_font = &font;
-        m_renderTextInfo.m_layout = font.createLayout(&renderText, m_width.currentWidth(), m_collapseWhiteSpace);
-        m_renderTextInfo.m_lineBreakIterator.resetStringAndReleaseIterator(renderText.text(), style.locale(), mapLineBreakToIteratorMode(m_blockStyle.lineBreak()));
-        isLooseCJKMode = m_renderTextInfo.m_lineBreakIterator.isLooseCJKMode();
-    } else if (m_renderTextInfo.m_layout && m_renderTextInfo.m_font != &font) {
-        m_renderTextInfo.m_font = &font;
-        m_renderTextInfo.m_layout = font.createLayout(&renderText, m_width.currentWidth(), m_collapseWhiteSpace);
+        m_renderTextInfo.text = &renderText;
+        m_renderTextInfo.font = &font;
+        m_renderTextInfo.layout = font.createLayout(renderText, m_width.currentWidth(), m_collapseWhiteSpace);
+        m_renderTextInfo.lineBreakIterator.resetStringAndReleaseIterator(renderText.text(), style.locale(), mapLineBreakToIteratorMode(m_blockStyle.lineBreak()));
+        isLooseCJKMode = m_renderTextInfo.lineBreakIterator.isLooseCJKMode();
+    } else if (m_renderTextInfo.layout && m_renderTextInfo.font != &font) {
+        m_renderTextInfo.font = &font;
+        m_renderTextInfo.layout = font.createLayout(renderText, m_width.currentWidth(), m_collapseWhiteSpace);
     }
 
-    TextLayout* textLayout = m_renderTextInfo.m_layout.get();
+    TextLayout* textLayout = m_renderTextInfo.layout.get();
 
     // Non-zero only when kerning is enabled and TextLayout isn't used, in which case we measure
     // words with their trailing space, then subtract its width.
     HashSet<const Font*> fallbackFonts;
     float wordTrailingSpaceWidth = (font.typesettingFeatures() & Kerning) && !textLayout ? font.width(RenderBlock::constructTextRun(&renderText, font, &space, 1, style), &fallbackFonts) + wordSpacing : 0;
 
-    UChar lastCharacter = m_renderTextInfo.m_lineBreakIterator.lastCharacter();
-    UChar secondToLastCharacter = m_renderTextInfo.m_lineBreakIterator.secondToLastCharacter();
+    UChar lastCharacter = m_renderTextInfo.lineBreakIterator.lastCharacter();
+    UChar secondToLastCharacter = m_renderTextInfo.lineBreakIterator.secondToLastCharacter();
     for (; m_current.offset() < renderText.textLength(); m_current.fastIncrementInTextNode()) {
         bool previousCharacterIsSpace = m_currentCharacterIsSpace;
         bool previousCharacterIsWS = m_currentCharacterIsWS;
@@ -770,7 +770,7 @@
         }
 
         int nextBreakablePosition = m_current.nextBreakablePosition();
-        bool betweenWords = c == '\n' || (m_currWS != PRE && !m_atStart && isBreakable(m_renderTextInfo.m_lineBreakIterator, m_current.offset(), nextBreakablePosition, breakNBSP, isLooseCJKMode)
+        bool betweenWords = c == '\n' || (m_currWS != PRE && !m_atStart && isBreakable(m_renderTextInfo.lineBreakIterator, m_current.offset(), nextBreakablePosition, breakNBSP, isLooseCJKMode)
             && (style.hyphens() != HyphensNone || (m_current.previousInSameNode() != softHyphen)));
         m_current.setNextBreakablePosition(nextBreakablePosition);
 
@@ -974,7 +974,7 @@
         nextCharacter(c, lastCharacter, secondToLastCharacter);
     }
 
-    m_renderTextInfo.m_lineBreakIterator.setPriorContext(lastCharacter, secondToLastCharacter);
+    m_renderTextInfo.lineBreakIterator.setPriorContext(lastCharacter, secondToLastCharacter);
 
     wordMeasurements.grow(wordMeasurements.size() + 1);
     WordMeasurement& wordMeasurement = wordMeasurements.last();
@@ -1183,10 +1183,10 @@
     // Don't even bother measuring if our remaining line has many characters
     if (renderText.textLength() == lineBreak.offset() || renderText.textLength() - lineBreak.offset() > longTrailingWordLength)
         return lineBreak;
-    bool isLooseCJKMode = m_renderTextInfo.m_text != &renderText && m_renderTextInfo.m_lineBreakIterator.isLooseCJKMode();
+    bool isLooseCJKMode = m_renderTextInfo.text != &renderText && m_renderTextInfo.lineBreakIterator.isLooseCJKMode();
     bool breakNBSP = m_autoWrap && m_currentStyle->nbspMode() == SPACE;
     int nextBreakablePosition = lineBreak.nextBreakablePosition();
-    isBreakable(m_renderTextInfo.m_lineBreakIterator, lineBreak.offset() + 1, nextBreakablePosition, breakNBSP, isLooseCJKMode);
+    isBreakable(m_renderTextInfo.lineBreakIterator, lineBreak.offset() + 1, nextBreakablePosition, breakNBSP, isLooseCJKMode);
     if (nextBreakablePosition < 0 || static_cast<unsigned>(nextBreakablePosition) != renderText.textLength())
         return lineBreak;
     const RenderStyle& style = lineStyle(renderText, m_lineInfo);

Modified: trunk/Source/WebCore/rendering/line/LineBreaker.h (183168 => 183169)


--- trunk/Source/WebCore/rendering/line/LineBreaker.h	2015-04-23 04:38:11 UTC (rev 183168)
+++ trunk/Source/WebCore/rendering/line/LineBreaker.h	2015-04-23 05:20:23 UTC (rev 183169)
@@ -36,20 +36,17 @@
 class RenderText;
 
 struct RenderTextInfo {
-    // Destruction of m_layout requires TextLayout to be a complete type, so the constructor and destructor are made non-inline to avoid compilation errors.
-    RenderTextInfo();
-    ~RenderTextInfo();
-
-    RenderText* m_text;
-    OwnPtr<TextLayout> m_layout;
-    LazyLineBreakIterator m_lineBreakIterator;
-    const FontCascade* m_font;
+    RenderText* text { nullptr };
+    std::unique_ptr<TextLayout, TextLayoutDeleter> layout;
+    LazyLineBreakIterator lineBreakIterator;
+    const FontCascade* font { nullptr };
 };
 
 class LineBreaker {
 public:
     friend class BreakingContext;
-    LineBreaker(RenderBlockFlow& block)
+
+    explicit LineBreaker(RenderBlockFlow& block)
         : m_block(block)
     {
         reset();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to