Title: [228974] trunk/Source
Revision
228974
Author
[email protected]
Date
2018-02-24 13:47:52 -0800 (Sat, 24 Feb 2018)

Log Message

Prepare for ExtendedColor changes (first step)
https://bugs.webkit.org/show_bug.cgi?id=182904

Reviewed by Sam Weinig.

Source/WebCore:

* css/CSSValuePool.cpp:
(WebCore::CSSValuePool::createColorValue): Use HashMap::ensure.
(WebCore::CSSValuePool::createFontFamilyValue): Ditto.
(WebCore::CSSValuePool::createFontFaceValue): Ditto.

* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::maybeParseValue): Tightened up
the logic a bit.

* html/canvas/CanvasRenderingContext2D.cpp: Removed many unneeded includes.

* inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::recordAction): Updated for Ref instead of
RefPtr and to use move semantics.
(WebCore::buildArrayForAffineTransform): Return Ref instead of RefPtr.
(WebCore::buildArrayForVector): Ditto.
(WebCore::InspectorCanvas::buildInitialState): Ditto. Also use auto more.
(WebCore::InspectorCanvas::buildAction): Ditto.
(WebCore::InspectorCanvas::buildArrayForCanvasGradient): Ditto.
(WebCore::InspectorCanvas::buildArrayForCanvasPattern): Ditto.
(WebCore::InspectorCanvas::buildArrayForImageData): Ditto.
* inspector/InspectorCanvas.h: Updated for the above. Also us "using" instead
of typedef and removed unneeded ErrorString typedef and some includes.

* page/DragController.cpp:
(WebCore::DragController::concludeEditDrag): Use auto and Ref.

* platform/DragData.h: Used pragma once and reorganized includes a bit.

* platform/graphics/ImageFrame.h:
(WebCore::ImageFrame::frameBytes const): Use uint32_t instead of RGBA32 to
prepare for removal of the RGBA32 type coming in a future patch.
* platform/graphics/ImageSource.cpp:
(WebCore::ImageSource::cacheNativeImageAtIndex): Ditto.
(WebCore::ImageSource::canUseAsyncDecoding): Ditto.

* platform/graphics/cocoa/GraphicsContextCocoa.mm: Tweaked #if for Mac-only
code to use PLATFORM(MAC) to be easier to read.
(WebCore::GraphicsContext::focusRingColor): Use sRGBColorSpaceRef instead of
calling CGColorSpaceCreateWithName each time.

* platform/graphics/texmap/TextureMapperFPSCounter.cpp: Added include needed
now that it was removed from some header.

* platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h: Use uint32_t
instead of RGBA32 to prepare for removal of the RGBA32 type coming in a future patch.
* platform/image-decoders/ScalableImageDecoder.cpp:
(WebCore::ScalableImageDecoder::frameBytesAtIndex const): Ditto.
* platform/image-decoders/cairo/ImageBackingStoreCairo.cpp:
(WebCore::ImageBackingStore::image const): Ditto.
* platform/image-decoders/gif/GIFImageDecoder.cpp:
(WebCore::GIFImageDecoder::haveDecodedRow): Ditto.
* platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
(WebCore::setPixel): Ditto.
(WebCore::JPEGImageDecoder::outputScanlines): Ditto.
* platform/image-decoders/png/PNGImageDecoder.cpp:
(WebCore::PNGImageDecoder::rowAvailable): Ditto.
(WebCore::PNGImageDecoder::frameComplete): Ditto.
* platform/image-decoders/webp/WEBPImageDecoder.cpp:
(WebCore::WEBPImageDecoder::decodeFrame): Ditto.
(WebCore::WEBPImageDecoder::applyPostProcessing): Ditto.

* platform/mac/PlatformPasteboardMac.mm:
(WebCore::PlatformPasteboard::color): Added comments.

* rendering/EllipsisBox.cpp:
(WebCore::EllipsisBox::paintSelection): Use Color::isVisible.

Source/WebKitLegacy/mac:

* Misc/WebKitNSStringExtras.mm:
(-[NSString _web_drawAtPoint:font:textColor:]): Use colorFromNSColor.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (228973 => 228974)


--- trunk/Source/WebCore/ChangeLog	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebCore/ChangeLog	2018-02-24 21:47:52 UTC (rev 228974)
@@ -1,3 +1,78 @@
+2018-02-17  Darin Adler  <[email protected]>
+
+        Prepare for ExtendedColor changes (first step)
+        https://bugs.webkit.org/show_bug.cgi?id=182904
+
+        Reviewed by Sam Weinig.
+
+        * css/CSSValuePool.cpp:
+        (WebCore::CSSValuePool::createColorValue): Use HashMap::ensure.
+        (WebCore::CSSValuePool::createFontFamilyValue): Ditto.
+        (WebCore::CSSValuePool::createFontFaceValue): Ditto.
+
+        * css/parser/CSSParserFastPaths.cpp:
+        (WebCore::CSSParserFastPaths::maybeParseValue): Tightened up
+        the logic a bit.
+
+        * html/canvas/CanvasRenderingContext2D.cpp: Removed many unneeded includes.
+
+        * inspector/InspectorCanvas.cpp:
+        (WebCore::InspectorCanvas::recordAction): Updated for Ref instead of
+        RefPtr and to use move semantics.
+        (WebCore::buildArrayForAffineTransform): Return Ref instead of RefPtr.
+        (WebCore::buildArrayForVector): Ditto.
+        (WebCore::InspectorCanvas::buildInitialState): Ditto. Also use auto more.
+        (WebCore::InspectorCanvas::buildAction): Ditto.
+        (WebCore::InspectorCanvas::buildArrayForCanvasGradient): Ditto.
+        (WebCore::InspectorCanvas::buildArrayForCanvasPattern): Ditto.
+        (WebCore::InspectorCanvas::buildArrayForImageData): Ditto.
+        * inspector/InspectorCanvas.h: Updated for the above. Also us "using" instead
+        of typedef and removed unneeded ErrorString typedef and some includes.
+
+        * page/DragController.cpp:
+        (WebCore::DragController::concludeEditDrag): Use auto and Ref.
+
+        * platform/DragData.h: Used pragma once and reorganized includes a bit.
+
+        * platform/graphics/ImageFrame.h:
+        (WebCore::ImageFrame::frameBytes const): Use uint32_t instead of RGBA32 to
+        prepare for removal of the RGBA32 type coming in a future patch.
+        * platform/graphics/ImageSource.cpp:
+        (WebCore::ImageSource::cacheNativeImageAtIndex): Ditto.
+        (WebCore::ImageSource::canUseAsyncDecoding): Ditto.
+
+        * platform/graphics/cocoa/GraphicsContextCocoa.mm: Tweaked #if for Mac-only
+        code to use PLATFORM(MAC) to be easier to read.
+        (WebCore::GraphicsContext::focusRingColor): Use sRGBColorSpaceRef instead of
+        calling CGColorSpaceCreateWithName each time.
+
+        * platform/graphics/texmap/TextureMapperFPSCounter.cpp: Added include needed
+        now that it was removed from some header.
+
+        * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h: Use uint32_t
+        instead of RGBA32 to prepare for removal of the RGBA32 type coming in a future patch.
+        * platform/image-decoders/ScalableImageDecoder.cpp:
+        (WebCore::ScalableImageDecoder::frameBytesAtIndex const): Ditto.
+        * platform/image-decoders/cairo/ImageBackingStoreCairo.cpp:
+        (WebCore::ImageBackingStore::image const): Ditto.
+        * platform/image-decoders/gif/GIFImageDecoder.cpp:
+        (WebCore::GIFImageDecoder::haveDecodedRow): Ditto.
+        * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
+        (WebCore::setPixel): Ditto.
+        (WebCore::JPEGImageDecoder::outputScanlines): Ditto.
+        * platform/image-decoders/png/PNGImageDecoder.cpp:
+        (WebCore::PNGImageDecoder::rowAvailable): Ditto.
+        (WebCore::PNGImageDecoder::frameComplete): Ditto.
+        * platform/image-decoders/webp/WEBPImageDecoder.cpp:
+        (WebCore::WEBPImageDecoder::decodeFrame): Ditto.
+        (WebCore::WEBPImageDecoder::applyPostProcessing): Ditto.
+
+        * platform/mac/PlatformPasteboardMac.mm:
+        (WebCore::PlatformPasteboard::color): Added comments.
+
+        * rendering/EllipsisBox.cpp:
+        (WebCore::EllipsisBox::paintSelection): Use Color::isVisible.
+
 2018-02-23  Chris Dumez  <[email protected]>
 
         Crash under SchemeRegistry::shouldTreatURLSchemeAsLocal(WTF::String const&)

Modified: trunk/Source/WebCore/css/CSSValuePool.cpp (228973 => 228974)


--- trunk/Source/WebCore/css/CSSValuePool.cpp	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebCore/css/CSSValuePool.cpp	2018-02-24 21:47:52 UTC (rev 228974)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2011-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -84,14 +84,14 @@
         return m_blackColor.get();
 
     // Remove one entry at random if the cache grows too large.
+    // FIXME: Use TinyLRUCache instead?
     const int maximumColorCacheSize = 512;
     if (m_colorValueCache.size() >= maximumColorCacheSize)
         m_colorValueCache.remove(m_colorValueCache.begin());
 
-    ColorValueCache::AddResult entry = m_colorValueCache.add(color, nullptr);
-    if (entry.isNewEntry)
-        entry.iterator->value = CSSPrimitiveValue::create(color);
-    return *entry.iterator->value;
+    return *m_colorValueCache.ensure(color, [&color] {
+        return CSSPrimitiveValue::create(color);
+    }).iterator->value;
 }
 
 Ref<CSSPrimitiveValue> CSSValuePool::createValue(double value, CSSPrimitiveValue::UnitType type)
@@ -120,33 +120,32 @@
 Ref<CSSPrimitiveValue> CSSValuePool::createFontFamilyValue(const String& familyName, FromSystemFontID fromSystemFontID)
 {
     // Remove one entry at random if the cache grows too large.
+    // FIXME: Use TinyLRUCache instead?
     const int maximumFontFamilyCacheSize = 128;
     if (m_fontFamilyValueCache.size() >= maximumFontFamilyCacheSize)
         m_fontFamilyValueCache.remove(m_fontFamilyValueCache.begin());
 
     bool isFromSystemID = fromSystemFontID == FromSystemFontID::Yes;
-    RefPtr<CSSPrimitiveValue>& value = m_fontFamilyValueCache.add({familyName, isFromSystemID}, nullptr).iterator->value;
-    if (!value)
-        value = CSSPrimitiveValue::create(CSSFontFamily{familyName, isFromSystemID});
-    return *value;
+    return *m_fontFamilyValueCache.ensure({ familyName, isFromSystemID }, [&familyName, isFromSystemID] {
+        return CSSPrimitiveValue::create(CSSFontFamily { familyName, isFromSystemID });
+    }).iterator->value;
 }
 
 RefPtr<CSSValueList> CSSValuePool::createFontFaceValue(const AtomicString& string)
 {
     // Remove one entry at random if the cache grows too large.
+    // FIXME: Use TinyLRUCache instead?
     const int maximumFontFaceCacheSize = 128;
     if (m_fontFaceValueCache.size() >= maximumFontFaceCacheSize)
         m_fontFaceValueCache.remove(m_fontFaceValueCache.begin());
 
-    RefPtr<CSSValueList>& value = m_fontFaceValueCache.add(string, nullptr).iterator->value;
-    if (value)
-        return value;
-    
-    RefPtr<CSSValue> result = CSSParser::parseSingleValue(CSSPropertyFontFamily, string);
-    if (!result || !result->isValueList())
-        return value;
-    value = static_pointer_cast<CSSValueList>(result);
-    return value;
+    return m_fontFaceValueCache.ensure(string, [&string] () -> RefPtr<CSSValueList> {
+        auto result = CSSParser::parseSingleValue(CSSPropertyFontFamily, string);
+        if (!is<CSSValueList>(result))
+            return nullptr;
+        // FIXME: Make downcast work on RefPtr, remove the get() below, and save one reference count churn.
+        return downcast<CSSValueList>(result.get());
+    }).iterator->value;
 }
 
 void CSSValuePool::drain()

Modified: trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp (228973 => 228974)


--- trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp	2018-02-24 21:47:52 UTC (rev 228974)
@@ -1,5 +1,5 @@
 // Copyright 2014 The Chromium Authors. All rights reserved.
-// Copyright (C) 2016 Apple Inc. All rights reserved.
+// Copyright (C) 2016-2018 Apple Inc. All rights reserved.
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -1290,7 +1290,6 @@
 static RefPtr<CSSValue> parseSimpleTransform(CSSPropertyID propertyID, const String& string)
 {
     ASSERT(!string.isEmpty());
-
     if (propertyID != CSSPropertyTransform)
         return nullptr;
     if (string.is8Bit())
@@ -1309,20 +1308,15 @@
 
 RefPtr<CSSValue> CSSParserFastPaths::maybeParseValue(CSSPropertyID propertyID, const String& string, CSSParserMode parserMode)
 {
-    RefPtr<CSSValue> result = parseSimpleLengthValue(propertyID, string, parserMode);
-    if (result)
+    if (auto result = parseSimpleLengthValue(propertyID, string, parserMode))
         return result;
     if (propertyID == CSSPropertyCaretColor)
         return parseCaretColor(string, parserMode);
     if (isColorPropertyID(propertyID))
         return parseColor(string, parserMode);
-    result = parseKeywordValue(propertyID, string, parserMode);
-    if (result)
+    if (auto result = parseKeywordValue(propertyID, string, parserMode))
         return result;
-    result = parseSimpleTransform(propertyID, string);
-    if (result)
-        return result;
-    return nullptr;
+    return parseSimpleTransform(propertyID, string);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (228973 => 228974)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2018-02-24 21:47:52 UTC (rev 228974)
@@ -36,20 +36,11 @@
 #include "CSSFontSelector.h"
 #include "CSSParser.h"
 #include "CSSPropertyNames.h"
-#include "FloatQuad.h"
-#include "HTMLImageElement.h"
-#include "HTMLVideoElement.h"
-#include "ImageBitmap.h"
 #include "ImageBuffer.h"
 #include "ImageData.h"
 #include "InspectorInstrumentation.h"
 #include "Path2D.h"
-#include "RenderElement.h"
-#include "RenderImage.h"
-#include "RenderLayer.h"
 #include "RenderTheme.h"
-#include "SecurityOrigin.h"
-#include "StrokeStyleApplier.h"
 #include "StyleProperties.h"
 #include "StyleResolver.h"
 #include "TextMetrics.h"
@@ -56,14 +47,8 @@
 #include "TextRun.h"
 #include <wtf/CheckedArithmetic.h>
 #include <wtf/MathExtras.h>
-#include <wtf/NeverDestroyed.h>
 #include <wtf/text/StringBuilder.h>
-#include <wtf/text/TextStream.h>
 
-#if USE(CG) && !PLATFORM(IOS)
-#include <ApplicationServices/ApplicationServices.h>
-#endif
-
 namespace WebCore {
 
 using namespace HTMLNames;

Modified: trunk/Source/WebCore/inspector/InspectorCanvas.cpp (228973 => 228974)


--- trunk/Source/WebCore/inspector/InspectorCanvas.cpp	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebCore/inspector/InspectorCanvas.cpp	2018-02-24 21:47:52 UTC (rev 228974)
@@ -155,11 +155,11 @@
 
     auto action = "" WTFMove(parameters));
     m_bufferUsed += action->memoryCost();
-    m_currentActions->addItem(action);
+    m_currentActions->addItem(action.ptr());
 
 #if ENABLE(WEBGL)
     if (is<WebGLRenderingContext>(m_context) && shouldSnapshotWebGLAction(name))
-        m_actionNeedingSnapshot = action;
+        m_actionNeedingSnapshot = WTFMove(action);
 #endif
 }
 
@@ -412,9 +412,9 @@
     return static_cast<int>(index);
 }
 
-static RefPtr<JSON::ArrayOf<double>> buildArrayForAffineTransform(const AffineTransform& affineTransform)
+static Ref<JSON::ArrayOf<double>> buildArrayForAffineTransform(const AffineTransform& affineTransform)
 {
-    RefPtr<JSON::ArrayOf<double>> array = JSON::ArrayOf<double>::create();
+    auto array = JSON::ArrayOf<double>::create();
     array->addItem(affineTransform.a());
     array->addItem(affineTransform.b());
     array->addItem(affineTransform.c());
@@ -424,19 +424,17 @@
     return array;
 }
 
-template <typename T>
-static RefPtr<JSON::ArrayOf<JSON::Value>> buildArrayForVector(const Vector<T>& vector)
+template<typename T> static Ref<JSON::ArrayOf<JSON::Value>> buildArrayForVector(const Vector<T>& vector)
 {
-    RefPtr<JSON::ArrayOf<JSON::Value>> array = JSON::ArrayOf<JSON::Value>::create();
+    auto array = JSON::ArrayOf<JSON::Value>::create();
     for (auto& item : vector)
         array->addItem(item);
     return array;
 }
 
-RefPtr<Inspector::Protocol::Recording::InitialState> InspectorCanvas::buildInitialState()
+Ref<Inspector::Protocol::Recording::InitialState> InspectorCanvas::buildInitialState()
 {
-    RefPtr<Inspector::Protocol::Recording::InitialState> initialState = Inspector::Protocol::Recording::InitialState::create()
-        .release();
+    auto initialState = Inspector::Protocol::Recording::InitialState::create().release();
 
     auto attributes = JSON::Object::create();
     attributes->setInteger(ASCIILiteral("width"), m_context.canvasBase().width());
@@ -445,8 +443,8 @@
     auto parameters = JSON::ArrayOf<JSON::Value>::create();
 
     if (is<CanvasRenderingContext2D>(m_context)) {
-        const CanvasRenderingContext2D& context2d = downcast<CanvasRenderingContext2D>(m_context);
-        const CanvasRenderingContext2D::State& state = context2d.state();
+        auto& context2d = downcast<CanvasRenderingContext2D>(m_context);
+        auto& state = context2d.state();
 
         attributes->setArray(ASCIILiteral("setTransform"), buildArrayForAffineTransform(state.transform));
         attributes->setDouble(ASCIILiteral("globalAlpha"), context2d.globalAlpha());
@@ -524,13 +522,13 @@
     return initialState;
 }
 
-RefPtr<JSON::ArrayOf<JSON::Value>> InspectorCanvas::buildAction(const String& name, Vector<RecordCanvasActionVariant>&& parameters)
+Ref<JSON::ArrayOf<JSON::Value>> InspectorCanvas::buildAction(const String& name, Vector<RecordCanvasActionVariant>&& parameters)
 {
-    RefPtr<JSON::ArrayOf<JSON::Value>> action = ""
+    auto action = ""
     action->addItem(indexForData(name));
 
-    RefPtr<JSON::ArrayOf<JSON::Value>> parametersData = JSON::ArrayOf<JSON::Value>::create();
-    RefPtr<JSON::ArrayOf<int>> swizzleTypes = JSON::ArrayOf<int>::create();
+    auto parametersData = JSON::ArrayOf<JSON::Value>::create();
+    auto swizzleTypes = JSON::ArrayOf<int>::create();
 
     auto addParameter = [&parametersData, &swizzleTypes] (auto value, RecordingSwizzleTypes swizzleType) {
         parametersData->addItem(value);
@@ -537,7 +535,7 @@
         swizzleTypes->addItem(static_cast<int>(swizzleType));
     };
 
-    for (RecordCanvasActionVariant& item : parameters) {
+    for (auto& item : parameters) {
         WTF::switchOn(item,
             [&] (CanvasDirection value) { addParameter(indexForData(convertEnumerationToString(value)), RecordingSwizzleTypes::String); },
             [&] (CanvasFillRule value) { addParameter(indexForData(convertEnumerationToString(value)), RecordingSwizzleTypes::String); },
@@ -546,7 +544,7 @@
             [&] (CanvasTextAlign value) { addParameter(indexForData(convertEnumerationToString(value)), RecordingSwizzleTypes::String); },
             [&] (CanvasTextBaseline value) { addParameter(indexForData(convertEnumerationToString(value)), RecordingSwizzleTypes::String); },
             [&] (const DOMMatrix2DInit& value) {
-                RefPtr<JSON::ArrayOf<double>> array = JSON::ArrayOf<double>::create();
+                auto array = JSON::ArrayOf<double>::create();
                 array->addItem(value.a.value_or(1));
                 array->addItem(value.b.value_or(0));
                 array->addItem(value.c.value_or(0));
@@ -553,7 +551,7 @@
                 array->addItem(value.d.value_or(1));
                 array->addItem(value.e.value_or(0));
                 array->addItem(value.f.value_or(0));
-                addParameter(WTFMove(array), RecordingSwizzleTypes::DOMMatrix);
+                addParameter(array.ptr(), RecordingSwizzleTypes::DOMMatrix);
             },
             [&] (const Element*) {
                 // Elements are not serializable, so add a string as a placeholder since the actual
@@ -580,16 +578,16 @@
             [&] (const RefPtr<CanvasGradient>& value) { addParameter(indexForData(value.get()), RecordingSwizzleTypes::CanvasGradient); },
             [&] (const RefPtr<CanvasPattern>& value) { addParameter(indexForData(value.get()), RecordingSwizzleTypes::CanvasPattern); },
             [&] (const RefPtr<Float32Array>&) { addParameter(0, RecordingSwizzleTypes::TypedArray); },
-            [&] (RefPtr<HTMLCanvasElement>& value) { addParameter(indexForData(value.get()), RecordingSwizzleTypes::Image); },
+            [&] (const RefPtr<HTMLCanvasElement>& value) { addParameter(indexForData(value.get()), RecordingSwizzleTypes::Image); },
             [&] (const RefPtr<HTMLImageElement>& value) { addParameter(indexForData(value.get()), RecordingSwizzleTypes::Image); },
 #if ENABLE(VIDEO)
-            [&] (RefPtr<HTMLVideoElement>& value) { addParameter(indexForData(value.get()), RecordingSwizzleTypes::Image); },
+            [&] (const RefPtr<HTMLVideoElement>& value) { addParameter(indexForData(value.get()), RecordingSwizzleTypes::Image); },
 #endif
             [&] (const RefPtr<ImageBitmap>& value) { addParameter(indexForData(value.get()), RecordingSwizzleTypes::ImageBitmap); },
             [&] (const RefPtr<ImageData>& value) { addParameter(indexForData(value.get()), RecordingSwizzleTypes::ImageData); },
             [&] (const RefPtr<Int32Array>&) { addParameter(0, RecordingSwizzleTypes::TypedArray); },
-            [&] (const Vector<float>& value) { addParameter(buildArrayForVector(value), RecordingSwizzleTypes::Array); },
-            [&] (const Vector<int>& value) { addParameter(buildArrayForVector(value), RecordingSwizzleTypes::Array); },
+            [&] (const Vector<float>& value) { addParameter(buildArrayForVector(value).ptr(), RecordingSwizzleTypes::Array); },
+            [&] (const Vector<int>& value) { addParameter(buildArrayForVector(value).ptr(), RecordingSwizzleTypes::Array); },
             [&] (const String& value) { addParameter(indexForData(value), RecordingSwizzleTypes::String); },
             [&] (double value) { addParameter(value, RecordingSwizzleTypes::Number); },
             [&] (float value) { addParameter(value, RecordingSwizzleTypes::Number); },
@@ -604,7 +602,7 @@
     action->addItem(WTFMove(parametersData));
     action->addItem(WTFMove(swizzleTypes));
 
-    RefPtr<JSON::ArrayOf<double>> trace = JSON::ArrayOf<double>::create();
+    auto trace = JSON::ArrayOf<double>::create();
     auto stackTrace = Inspector::createScriptCallStack(JSMainThreadExecState::currentState(), Inspector::ScriptCallStack::maxCallStackSizeToCapture);
     for (size_t i = 0; i < stackTrace->size(); ++i)
         trace->addItem(indexForData(stackTrace->at(i)));
@@ -613,13 +611,13 @@
     return action;
 }
 
-RefPtr<JSON::ArrayOf<JSON::Value>> InspectorCanvas::buildArrayForCanvasGradient(const CanvasGradient& canvasGradient)
+Ref<JSON::ArrayOf<JSON::Value>> InspectorCanvas::buildArrayForCanvasGradient(const CanvasGradient& canvasGradient)
 {
     const auto& gradient = canvasGradient.gradient();
 
     String type = gradient.type() == Gradient::Type::Radial ? ASCIILiteral("radial-gradient") : ASCIILiteral("linear-gradient");
 
-    RefPtr<JSON::ArrayOf<float>> parameters = JSON::ArrayOf<float>::create();
+    auto parameters = JSON::ArrayOf<float>::create();
     WTF::switchOn(gradient.data(),
         [&parameters] (const Gradient::LinearData& data) {
             parameters->addItem(data.point0.x());
@@ -637,15 +635,15 @@
         }
     );
 
-    RefPtr<JSON::ArrayOf<JSON::Value>> stops = JSON::ArrayOf<JSON::Value>::create();
+    auto stops = JSON::ArrayOf<JSON::Value>::create();
     for (auto& colorStop : gradient.stops()) {
-        RefPtr<JSON::ArrayOf<JSON::Value>> stop = JSON::ArrayOf<JSON::Value>::create();
+        auto stop = JSON::ArrayOf<JSON::Value>::create();
         stop->addItem(colorStop.offset);
         stop->addItem(indexForData(colorStop.color.cssText()));
         stops->addItem(WTFMove(stop));
     }
 
-    RefPtr<JSON::ArrayOf<JSON::Value>> array = JSON::ArrayOf<JSON::Value>::create();
+    auto array = JSON::ArrayOf<JSON::Value>::create();
     array->addItem(indexForData(type));
     array->addItem(WTFMove(parameters));
     array->addItem(WTFMove(stops));
@@ -652,10 +650,10 @@
     return array;
 }
 
-RefPtr<JSON::ArrayOf<JSON::Value>> InspectorCanvas::buildArrayForCanvasPattern(const CanvasPattern& canvasPattern)
+Ref<JSON::ArrayOf<JSON::Value>> InspectorCanvas::buildArrayForCanvasPattern(const CanvasPattern& canvasPattern)
 {
     Image& tileImage = canvasPattern.pattern().tileImage();
-    std::unique_ptr<ImageBuffer> imageBuffer = ImageBuffer::create(tileImage.size(), RenderingMode::Unaccelerated);
+    auto imageBuffer = ImageBuffer::create(tileImage.size(), RenderingMode::Unaccelerated);
     imageBuffer->context().drawImage(tileImage, FloatPoint(0, 0));
 
     String repeat;
@@ -670,19 +668,19 @@
     else
         repeat = ASCIILiteral("no-repeat");
 
-    RefPtr<JSON::ArrayOf<JSON::Value>> array = JSON::ArrayOf<JSON::Value>::create();
+    auto array = JSON::ArrayOf<JSON::Value>::create();
     array->addItem(indexForData(imageBuffer->toDataURL("image/png")));
     array->addItem(indexForData(repeat));
     return array;
 }
 
-RefPtr<JSON::ArrayOf<JSON::Value>> InspectorCanvas::buildArrayForImageData(const ImageData& imageData)
+Ref<JSON::ArrayOf<JSON::Value>> InspectorCanvas::buildArrayForImageData(const ImageData& imageData)
 {
-    RefPtr<JSON::ArrayOf<int>> data = ""
+    auto data = ""
     for (size_t i = 0; i < imageData.data()->length(); ++i)
         data->addItem(imageData.data()->item(i));
 
-    RefPtr<JSON::ArrayOf<JSON::Value>> array = JSON::ArrayOf<JSON::Value>::create();
+    auto array = JSON::ArrayOf<JSON::Value>::create();
     array->addItem(WTFMove(data));
     array->addItem(imageData.width());
     array->addItem(imageData.height());

Modified: trunk/Source/WebCore/inspector/InspectorCanvas.h (228973 => 228974)


--- trunk/Source/WebCore/inspector/InspectorCanvas.h	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebCore/inspector/InspectorCanvas.h	2018-02-24 21:47:52 UTC (rev 228974)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc.  All rights reserved.
+ * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -28,9 +28,6 @@
 #include "CallTracerTypes.h"
 #include <_javascript_Core/InspectorProtocolObjects.h>
 #include <_javascript_Core/ScriptCallFrame.h>
-#include <wtf/HashMap.h>
-#include <wtf/Ref.h>
-#include <wtf/RefPtr.h>
 #include <wtf/Variant.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
@@ -47,8 +44,6 @@
 class ImageData;
 class InstrumentingAgents;
 
-typedef String ErrorString;
-
 class InspectorCanvas final : public RefCounted<InspectorCanvas> {
 public:
     static Ref<InspectorCanvas> create(CanvasRenderingContext&);
@@ -87,7 +82,7 @@
     void appendActionSnapshotIfNeeded();
     String getCanvasContentAsDataURL();
 
-    typedef Variant<
+    using DuplicateDataVariant = Variant<
         CanvasGradient*,
         CanvasPattern*,
         HTMLCanvasElement*,
@@ -99,14 +94,14 @@
         ImageBitmap*,
         Inspector::ScriptCallFrame,
         String
-    > DuplicateDataVariant;
+    >;
 
     int indexForData(DuplicateDataVariant);
-    RefPtr<Inspector::Protocol::Recording::InitialState> buildInitialState();
-    RefPtr<JSON::ArrayOf<JSON::Value>> buildAction(const String&, Vector<RecordCanvasActionVariant>&& = { });
-    RefPtr<JSON::ArrayOf<JSON::Value>> buildArrayForCanvasGradient(const CanvasGradient&);
-    RefPtr<JSON::ArrayOf<JSON::Value>> buildArrayForCanvasPattern(const CanvasPattern&);
-    RefPtr<JSON::ArrayOf<JSON::Value>> buildArrayForImageData(const ImageData&);
+    Ref<Inspector::Protocol::Recording::InitialState> buildInitialState();
+    Ref<JSON::ArrayOf<JSON::Value>> buildAction(const String&, Vector<RecordCanvasActionVariant>&& = { });
+    Ref<JSON::ArrayOf<JSON::Value>> buildArrayForCanvasGradient(const CanvasGradient&);
+    Ref<JSON::ArrayOf<JSON::Value>> buildArrayForCanvasPattern(const CanvasPattern&);
+    Ref<JSON::ArrayOf<JSON::Value>> buildArrayForImageData(const ImageData&);
 
     String m_identifier;
     CanvasRenderingContext& m_context;
@@ -126,4 +121,3 @@
 };
 
 } // namespace WebCore
-

Modified: trunk/Source/WebCore/page/DragController.cpp (228973 => 228974)


--- trunk/Source/WebCore/page/DragController.cpp	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebCore/page/DragController.cpp	2018-02-24 21:47:52 UTC (rev 228974)
@@ -539,15 +539,15 @@
         Color color = dragData.asColor();
         if (!color.isValid())
             return false;
-        RefPtr<Range> innerRange = innerFrame->selection().toNormalizedRange();
+        auto innerRange = innerFrame->selection().toNormalizedRange();
         if (!innerRange)
             return false;
-        RefPtr<MutableStyleProperties> style = MutableStyleProperties::create();
+        auto style = MutableStyleProperties::create();
         style->setProperty(CSSPropertyColor, color.serialized(), false);
-        if (!innerFrame->editor().shouldApplyStyle(style.get(), innerRange.get()))
+        if (!innerFrame->editor().shouldApplyStyle(style.ptr(), innerRange.get()))
             return false;
         m_client.willPerformDragDestinationAction(DragDestinationActionEdit, dragData);
-        innerFrame->editor().applyStyle(style.get(), EditActionSetColor);
+        innerFrame->editor().applyStyle(style.ptr(), EditActionSetColor);
         return true;
     }
 

Modified: trunk/Source/WebCore/platform/DragData.h (228973 => 228974)


--- trunk/Source/WebCore/platform/DragData.h	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebCore/platform/DragData.h	2018-02-24 21:47:52 UTC (rev 228974)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -23,19 +23,17 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef DragData_h
-#define DragData_h
+#pragma once
 
 #include "Color.h"
 #include "DragActions.h"
 #include "IntPoint.h"
-
 #include <wtf/Forward.h>
 #include <wtf/HashMap.h>
 #include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
 
 #if PLATFORM(MAC)
-#include <wtf/text/WTFString.h>
 
 #ifdef __OBJC__ 
 #import <Foundation/Foundation.h>
@@ -47,7 +45,6 @@
 
 #elif PLATFORM(WIN)
 typedef struct IDataObject* DragDataRef;
-#include <wtf/text/WTFString.h>
 #elif PLATFORM(GTK)
 namespace WebCore {
 class SelectionData;
@@ -146,5 +143,3 @@
 };
     
 }
-
-#endif // !DragData_h

Modified: trunk/Source/WebCore/platform/graphics/ImageFrame.h (228973 => 228974)


--- trunk/Source/WebCore/platform/graphics/ImageFrame.h	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebCore/platform/graphics/ImageFrame.h	2018-02-24 21:47:52 UTC (rev 228974)
@@ -67,7 +67,7 @@
 
     IntSize size() const;
     IntSize sizeRespectingOrientation() const { return !m_orientation.usesWidthAsHeight() ? size() : size().transposedSize(); }
-    unsigned frameBytes() const { return hasNativeImage() ? (size().area() * sizeof(RGBA32)).unsafeGet() : 0; }
+    unsigned frameBytes() const { return hasNativeImage() ? (size().area() * sizeof(uint32_t)).unsafeGet() : 0; }
     SubsamplingLevel subsamplingLevel() const { return m_subsamplingLevel; }
 
 #if !USE(CG)

Modified: trunk/Source/WebCore/platform/graphics/ImageSource.cpp (228973 => 228974)


--- trunk/Source/WebCore/platform/graphics/ImageSource.cpp	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebCore/platform/graphics/ImageSource.cpp	2018-02-24 21:47:52 UTC (rev 228974)
@@ -264,7 +264,7 @@
     decodedSizeDecreased(frame.clear());
 
     // Do not cache the NativeImage if adding its frameByes to the MemoryCache will cause numerical overflow.
-    size_t frameBytes = size().unclampedArea() * sizeof(RGBA32);
+    size_t frameBytes = size().unclampedArea() * sizeof(uint32_t);
     if (!WTF::isInBounds<unsigned>(frameBytes + decodedSize()))
         return;
 
@@ -314,7 +314,7 @@
     if (!isDecoderAvailable())
         return false;
     // FIXME: figure out the best heuristic for enabling async image decoding.
-    return size().area() * sizeof(RGBA32) >= (frameCount() > 1 ? 100 * KB : 500 * KB);
+    return size().area() * sizeof(uint32_t) >= (frameCount() > 1 ? 100 * KB : 500 * KB);
 }
 
 void ImageSource::startAsyncDecodingQueue()

Modified: trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm (228973 => 228974)


--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm	2018-02-24 21:47:52 UTC (rev 228974)
@@ -44,7 +44,7 @@
 #import "WKGraphicsInternal.h"
 #endif
 
-#if !PLATFORM(IOS)
+#if PLATFORM(MAC)
 #import "LocalCurrentGraphicsContext.h"
 #endif
 
@@ -55,20 +55,17 @@
 
 namespace WebCore {
 
-// NSColor, NSBezierPath, and NSGraphicsContext
-// calls in this file are all exception-safe, so we don't block
-// exceptions for those.
+// NSColor, NSBezierPath, and NSGraphicsContext calls do not raise exceptions
+// so we don't block exceptions.
 
-#if !PLATFORM(IOS)
+#if PLATFORM(MAC)
+
 CGColorRef GraphicsContext::focusRingColor()
 {
-    static CGColorRef color;
-    if (!color) {
+    static CGColorRef color = [] {
         CGFloat colorComponents[] = { 0.5, 0.75, 1.0, 1.0 };
-        auto colorSpace = adoptCF(CGColorSpaceCreateWithName(kCGColorSpaceSRGB));
-        color = CGColorCreate(colorSpace.get(), colorComponents);
-    }
-
+        return CGColorCreate(sRGBColorSpaceRef(), colorComponents);
+    }();
     return color;
 }
 
@@ -111,8 +108,9 @@
     CGContextAddPath(context, focusRingPath);
     return drawFocusRingAtTime(context, std::numeric_limits<double>::max());
 }
-#endif // !PLATFORM(IOS)
 
+#endif // PLATFORM(MAC)
+
 void GraphicsContext::drawFocusRing(const Path& path, float width, float offset, const Color& color)
 {
 #if PLATFORM(MAC)
@@ -163,7 +161,7 @@
 
 void GraphicsContext::drawFocusRing(const Vector<FloatRect>& rects, float width, float offset, const Color& color)
 {
-#if !PLATFORM(IOS)
+#if PLATFORM(MAC)
     if (paintingDisabled())
         return;
 
@@ -186,6 +184,7 @@
 }
 
 #if PLATFORM(MAC)
+
 static NSImage *findImage(NSString* firstChoiceName, NSString* secondChoiceName, bool& usingDot)
 {
     // Eventually we should be able to get rid of the secondChoiceName. For the time being we need both to keep
@@ -197,10 +196,16 @@
     usingDot = image;
     return image;
 }
+
+// FIXME: Should use RetainPtr instead of handwritten retain/release.
 static NSImage *spellingImage = nullptr;
 static NSImage *grammarImage = nullptr;
 static NSImage *correctionImage = nullptr;
-#else
+
+#endif
+
+#if PLATFORM (IOS)
+
 static RetainPtr<CGPatternRef> createDotPattern(bool& usingDot, const char* resourceName)
 {
     RetainPtr<CGImageRef> image = adoptCF(WKGraphicsCreateImageFromBundleWithName(resourceName));
@@ -208,8 +213,9 @@
     usingDot = true;
     return adoptCF(WKCreatePatternFromCGImage(image.get()));
 }
-#endif // PLATFORM(MAC)
 
+#endif
+
 void GraphicsContext::updateDocumentMarkerResources()
 {
 #if PLATFORM(MAC)

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.cpp (228973 => 228974)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.cpp	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.cpp	2018-02-24 21:47:52 UTC (rev 228974)
@@ -25,6 +25,7 @@
 
 #include "TextureMapper.h"
 #include <wtf/CurrentTime.h>
+#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 

Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h (228973 => 228974)


--- trunk/Source/WebCore/platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h	2018-02-24 21:47:52 UTC (rev 228974)
@@ -96,7 +96,7 @@
     void recomputeStrokeStyle();
 
     COMPtr<ID2D1RenderTarget> m_renderTarget;
-    HashMap<RGBA32, COMPtr<ID2D1SolidColorBrush>> m_solidColoredBrushCache;
+    HashMap<uint32_t, COMPtr<ID2D1SolidColorBrush>> m_solidColoredBrushCache;
     COMPtr<ID2D1SolidColorBrush> m_whiteBrush;
     COMPtr<ID2D1SolidColorBrush> m_zeroBrush;
     COMPtr<ID2D1StrokeStyle> m_d2dStrokeStyle;

Modified: trunk/Source/WebCore/platform/image-decoders/ScalableImageDecoder.cpp (228973 => 228974)


--- trunk/Source/WebCore/platform/image-decoders/ScalableImageDecoder.cpp	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebCore/platform/image-decoders/ScalableImageDecoder.cpp	2018-02-24 21:47:52 UTC (rev 228974)
@@ -196,7 +196,7 @@
     if (m_frameBufferCache.size() <= index)
         return 0;
     // FIXME: Use the dimension of the requested frame.
-    return (m_size.area() * sizeof(RGBA32)).unsafeGet();
+    return (m_size.area() * sizeof(uint32_t)).unsafeGet();
 }
 
 Seconds ScalableImageDecoder::frameDurationAtIndex(size_t index) const

Modified: trunk/Source/WebCore/platform/image-decoders/cairo/ImageBackingStoreCairo.cpp (228973 => 228974)


--- trunk/Source/WebCore/platform/image-decoders/cairo/ImageBackingStoreCairo.cpp	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebCore/platform/image-decoders/cairo/ImageBackingStoreCairo.cpp	2018-02-24 21:47:52 UTC (rev 228974)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc.  All rights reserved.
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -34,8 +34,8 @@
 {
     m_pixels->ref();
     RefPtr<cairo_surface_t> surface = adoptRef(cairo_image_surface_create_for_data(
-        reinterpret_cast<unsigned char*>(const_cast<RGBA32*>(m_pixelsPtr)),
-        CAIRO_FORMAT_ARGB32, size().width(), size().height(), size().width() * sizeof(RGBA32)));
+        reinterpret_cast<unsigned char*>(const_cast<uint32_t*>(m_pixelsPtr)),
+        CAIRO_FORMAT_ARGB32, size().width(), size().height(), size().width() * sizeof(uint32_t)));
     static cairo_user_data_key_t s_surfaceDataKey;
     cairo_surface_set_user_data(surface.get(), &s_surfaceDataKey, m_pixels.get(), [](void* data) { static_cast<SharedBuffer*>(data)->deref(); });
 

Modified: trunk/Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp (228973 => 228974)


--- trunk/Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp	2018-02-24 21:47:52 UTC (rev 228974)
@@ -241,7 +241,7 @@
     if ((buffer.isInvalid() && !initFrameBuffer(frameIndex)) || !buffer.hasBackingStore())
         return false;
 
-    RGBA32* currentAddress = buffer.backingStore()->pixelAt(xBegin, yBegin);
+    auto* currentAddress = buffer.backingStore()->pixelAt(xBegin, yBegin);
     // Write one row's worth of data into the frame.  
     for (int x = xBegin; x < xEnd; ++x) {
         const unsigned char sourceValue = rowBuffer[(m_scaled ? m_scaledColumns[x] : x) - frameContext->xOffset];

Modified: trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp (228973 => 228974)


--- trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp	2018-02-24 21:47:52 UTC (rev 228974)
@@ -532,7 +532,7 @@
 }
 
 template <J_COLOR_SPACE colorSpace>
-void setPixel(ImageFrame& buffer, RGBA32* currentAddress, JSAMPARRAY samples, int column)
+void setPixel(ImageFrame& buffer, uint32_t* currentAddress, JSAMPARRAY samples, int column)
 {
     JSAMPLE* jsample = *samples + column * (colorSpace == JCS_RGB ? 3 : 4);
 
@@ -575,7 +575,7 @@
         if (destY < 0)
             continue;
 
-        RGBA32* currentAddress = buffer.backingStore()->pixelAt(0, destY);
+        auto* currentAddress = buffer.backingStore()->pixelAt(0, destY);
         for (int x = 0; x < width; ++x) {
             setPixel<colorSpace>(buffer, currentAddress, samples, isScaled ? m_scaledColumns[x] : x);
             ++currentAddress;

Modified: trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp (228973 => 228974)


--- trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp	2018-02-24 21:47:52 UTC (rev 228974)
@@ -513,7 +513,7 @@
     }
 
     // Write the decoded row pixels to the frame buffer.
-    RGBA32* address = buffer.backingStore()->pixelAt(0, y);
+    auto* address = buffer.backingStore()->pixelAt(0, y);
     int width = scaledSize().width();
     unsigned char nonTrivialAlphaMask = 0;
 
@@ -827,7 +827,7 @@
         png_bytep row = interlaceBuffer;
         for (int y = rect.y(); y < rect.maxY(); ++y, row += colorChannels * size().width()) {
             png_bytep pixel = row;
-            RGBA32* address = buffer.backingStore()->pixelAt(rect.x(), y);
+            auto* address = buffer.backingStore()->pixelAt(rect.x(), y);
             for (int x = rect.x(); x < rect.maxX(); ++x, pixel += colorChannels) {
                 unsigned alpha = hasAlpha ? pixel[3] : 255;
                 nonTrivialAlpha |= alpha < 255;

Modified: trunk/Source/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp (228973 => 228974)


--- trunk/Source/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp	2018-02-24 21:47:52 UTC (rev 228974)
@@ -182,7 +182,7 @@
     WebPDecBuffer decoderBuffer;
     WebPInitDecBuffer(&decoderBuffer);
     decoderBuffer.colorspace = MODE_RGBA;
-    decoderBuffer.u.RGBA.stride = webpFrame.width * sizeof(RGBA32);
+    decoderBuffer.u.RGBA.stride = webpFrame.width * sizeof(uint32_t);
     decoderBuffer.u.RGBA.size = decoderBuffer.u.RGBA.stride * webpFrame.height;
     decoderBuffer.is_external_memory = 1;
     std::unique_ptr<unsigned char[]> p(new uint8_t[decoderBuffer.u.RGBA.size]());
@@ -276,8 +276,8 @@
         const int canvasY = top + y;
         for (int x = 0; x < decodedWidth; x++) {
             const int canvasX = left + x;
-            RGBA32* address = buffer.backingStore()->pixelAt(canvasX, canvasY);
-            uint8_t* pixel = decoderBuffer.u.RGBA.rgba + (y * frameRect.width() + x) * sizeof(RGBA32);
+            auto* address = buffer.backingStore()->pixelAt(canvasX, canvasY);
+            uint8_t* pixel = decoderBuffer.u.RGBA.rgba + (y * frameRect.width() + x) * sizeof(uint32_t);
             if (blend && (pixel[3] < 255))
                 buffer.backingStore()->blendPixel(address, pixel[0], pixel[1], pixel[2], pixel[3]);
             else

Modified: trunk/Source/WebCore/platform/mac/PlatformPasteboardMac.mm (228973 => 228974)


--- trunk/Source/WebCore/platform/mac/PlatformPasteboardMac.mm	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebCore/platform/mac/PlatformPasteboardMac.mm	2018-02-24 21:47:52 UTC (rev 228974)
@@ -199,8 +199,12 @@
 {
     NSColor *color = [NSColor colorFromPasteboard:m_pasteboard.get()];
 
-    // The color may not be in an RGB colorspace. This commonly occurs when a color is
-    // dragged from the NSColorPanel grayscale picker.
+    // FIXME: If it's OK to use sRGB instead of what we do here, then change this to use colorFromNSColor.
+
+    // The color may not be in an RGB colorspace.
+    // This commonly occurs when a color is dragged from the NSColorPanel grayscale picker.
+    // FIXME: What are the pros and cons of converting to sRGB if the color is in another RGB color space?
+    // FIXME: Shouldn't we be converting to sRGB instead of to calibrated RGB?
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
     if ([[color colorSpace] colorSpaceModel] != NSRGBColorSpaceModel)

Modified: trunk/Source/WebCore/rendering/EllipsisBox.cpp (228973 => 228974)


--- trunk/Source/WebCore/rendering/EllipsisBox.cpp	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebCore/rendering/EllipsisBox.cpp	2018-02-24 21:47:52 UTC (rev 228974)
@@ -129,7 +129,7 @@
 {
     Color textColor = style.visitedDependentColor(CSSPropertyColor);
     Color c = blockFlow().selectionBackgroundColor();
-    if (!c.isValid() || !c.alpha())
+    if (!c.isVisible())
         return;
 
     // If the text color ends up being the same as the selection background, invert the selection

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (228973 => 228974)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2018-02-24 21:47:52 UTC (rev 228974)
@@ -1,3 +1,13 @@
+2018-02-17  Darin Adler  <[email protected]>
+
+        Prepare for ExtendedColor changes (first step)
+        https://bugs.webkit.org/show_bug.cgi?id=182904
+
+        Reviewed by Sam Weinig.
+
+        * Misc/WebKitNSStringExtras.mm:
+        (-[NSString _web_drawAtPoint:font:textColor:]): Use colorFromNSColor.
+
 2018-02-22  Yusuke Suzuki  <[email protected]>
 
         Remove currentTime() / currentTimeMS()

Modified: trunk/Source/WebKitLegacy/mac/Misc/WebKitNSStringExtras.mm (228973 => 228974)


--- trunk/Source/WebKitLegacy/mac/Misc/WebKitNSStringExtras.mm	2018-02-24 11:31:53 UTC (rev 228973)
+++ trunk/Source/WebKitLegacy/mac/Misc/WebKitNSStringExtras.mm	2018-02-24 21:47:52 UTC (rev 228974)
@@ -28,6 +28,7 @@
 
 #import "WebKitNSStringExtras.h"
 
+#import <WebCore/ColorMac.h>
 #import <WebCore/FontCascade.h>
 #import <WebCore/GraphicsContext.h>
 #import <WebCore/LoaderNSURLExtras.h>
@@ -87,15 +88,7 @@
         if (!flipped)
             CGContextScaleCTM(cgContext, 1, -1);
 
-        CGFloat red;
-        CGFloat green;
-        CGFloat blue;
-        CGFloat alpha;
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
-        [[textColor colorUsingColorSpaceName:NSDeviceRGBColorSpace] getRed:&red green:&green blue:&blue alpha:&alpha];
-#pragma clang diagnostic pop
-        graphicsContext.setFillColor(Color(static_cast<float>(red * 255), static_cast<float>(green * 255.0f), static_cast<float>(blue * 255.0f), static_cast<float>(alpha * 255.0f)));
+        graphicsContext.setFillColor(colorFromNSColor(textColor));
         webCoreFont.drawText(graphicsContext, run, FloatPoint(point.x, flipped ? point.y : -point.y));
 
         if (!flipped)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to