Update Sky code to account for changes in Chromium - Add missing dependencies caught by gn's new stricter checker - Update opentype code to use new OTS API. This code is updated from HEAD Blink. - Add base dependency to wtf to avoid redefining marcos from base/macros.h - Update callers of various base string utility functions to use base namespace.
diff --git a/sky/build/sky_app.gni b/sky/build/sky_app.gni index 950bf82..6890cf6 100644 --- a/sky/build/sky_app.gni +++ b/sky/build/sky_app.gni
@@ -28,7 +28,7 @@ bundle_prefix = target_name - copy("copy_${bundle_prefix}_bundle") { + copy("gen_${bundle_prefix}_bundle") { sources = [ "$target_gen_dir/app.skyx", ] @@ -50,16 +50,20 @@ "$target_gen_dir/app.skyx", ] deps = [ - "//third_party/icu", - ":copy_${bundle_prefix}_bundle", + ":$skyx_target_name", + ":gen_${bundle_prefix}_bundle", + "//third_party/icu:icudata", ] if (defined(invoker.bundles)) { foreach(bundle, invoker.bundles) { bundle_gen_dir = get_label_info(bundle, "target_gen_dir") + bundle_dir = get_label_info(bundle, "dir") bundle_name = get_label_info(bundle, "name") sources += [ "$bundle_gen_dir/${bundle_name}.skyx" ] - deps += [ bundle ] + deps += [ + "$bundle_dir:gen_${bundle_name}_bundle", + ] } } }
diff --git a/sky/engine/core/dom/shadow/ShadowRoot.cpp b/sky/engine/core/dom/shadow/ShadowRoot.cpp index a724e8f..2001907 100644 --- a/sky/engine/core/dom/shadow/ShadowRoot.cpp +++ b/sky/engine/core/dom/shadow/ShadowRoot.cpp
@@ -87,7 +87,7 @@ PassRefPtr<Node> ShadowRoot::cloneNode(ExceptionState& exceptionState) { - return cloneNode(exceptionState); + return nullptr; } PassRefPtr<Node> ShadowRoot::cloneNode(bool deep)
diff --git a/sky/engine/platform/fonts/GlyphPageTreeNode.cpp b/sky/engine/platform/fonts/GlyphPageTreeNode.cpp index 7ef8a59..97ee3c1 100644 --- a/sky/engine/platform/fonts/GlyphPageTreeNode.cpp +++ b/sky/engine/platform/fonts/GlyphPageTreeNode.cpp
@@ -120,10 +120,6 @@ static bool fill(GlyphPage* pageToFill, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData) { bool hasGlyphs = fontData->fillGlyphPage(pageToFill, offset, length, buffer, bufferLength); -#if ENABLE(OPENTYPE_VERTICAL) - if (hasGlyphs && fontData->verticalData()) - fontData->verticalData()->substituteWithVerticalGlyphs(fontData, pageToFill, offset, length); -#endif return hasGlyphs; }
diff --git a/sky/engine/platform/fonts/opentype/OpenTypeSanitizer.cpp b/sky/engine/platform/fonts/opentype/OpenTypeSanitizer.cpp index 7917f03..9d5d875 100644 --- a/sky/engine/platform/fonts/opentype/OpenTypeSanitizer.cpp +++ b/sky/engine/platform/fonts/opentype/OpenTypeSanitizer.cpp
@@ -30,22 +30,26 @@ #include "sky/engine/platform/fonts/opentype/OpenTypeSanitizer.h" -#include "gen/sky/platform/RuntimeEnabledFeatures.h" -#include "opentype-sanitiser.h" #include "ots-memory-stream.h" #include "sky/engine/platform/SharedBuffer.h" +#include <stdarg.h> + namespace blink { PassRefPtr<SharedBuffer> OpenTypeSanitizer::sanitize() { - if (!m_buffer) + if (!m_buffer) { + setErrorString("Empty Buffer"); return nullptr; + } // This is the largest web font size which we'll try to transcode. static const size_t maxWebFontSize = 30 * 1024 * 1024; // 30 MB - if (m_buffer->size() > maxWebFontSize) + if (m_buffer->size() > maxWebFontSize) { + setErrorString("Web font size more than 30MB"); return nullptr; + } // A transcoded font is usually smaller than an original font. // However, it can be slightly bigger than the original one due to @@ -55,8 +59,12 @@ // much larger than the original. ots::ExpandingMemoryStream output(m_buffer->size(), maxWebFontSize); - if (!ots::Process(&output, reinterpret_cast<const uint8_t*>(m_buffer->data()), m_buffer->size())) + BlinkOTSContext otsContext; + + if (!otsContext.Process(&output, reinterpret_cast<const uint8_t*>(m_buffer->data()), m_buffer->size())) { + setErrorString(otsContext.getErrorString()); return nullptr; + } const size_t transcodeLen = output.Tell(); return SharedBuffer::create(static_cast<unsigned char*>(output.get()), transcodeLen); @@ -64,8 +72,57 @@ bool OpenTypeSanitizer::supportsFormat(const String& format) { - return equalIgnoringCase(format, "woff") - || (RuntimeEnabledFeatures::woff2Enabled() && equalIgnoringCase(format, "woff2")); + return equalIgnoringCase(format, "woff") || equalIgnoringCase(format, "woff2"); +} + +void BlinkOTSContext::Message(int level, const char *format, ...) +{ + va_list args; + va_start(args, format); + +#if COMPILER(MSVC) + int result = _vscprintf(format, args); +#else + char ch; + int result = vsnprintf(&ch, 1, format, args); +#endif + va_end(args); + + if (result <= 0) { + m_errorString = String("OTS Error"); + } else { + Vector<char, 256> buffer; + unsigned len = result; + buffer.grow(len + 1); + + va_start(args, format); + vsnprintf(buffer.data(), buffer.size(), format, args); + va_end(args); + m_errorString = StringImpl::create(reinterpret_cast<const LChar*>(buffer.data()), len); + } +} + +ots::TableAction BlinkOTSContext::GetTableAction(uint32_t tag) +{ +#define TABLE_TAG(c1, c2, c3, c4) ((uint32_t)((((uint8_t)(c1)) << 24) | (((uint8_t)(c2)) << 16) | (((uint8_t)(c3)) << 8) | ((uint8_t)(c4)))) + + const uint32_t cbdtTag = TABLE_TAG('C', 'B', 'D', 'T'); + const uint32_t cblcTag = TABLE_TAG('C', 'B', 'L', 'C'); + const uint32_t colrTag = TABLE_TAG('C', 'O', 'L', 'R'); + const uint32_t cpalTag = TABLE_TAG('C', 'P', 'A', 'L'); + + switch (tag) { + // Google Color Emoji Tables + case cbdtTag: + case cblcTag: + // Windows Color Emoji Tables + case colrTag: + case cpalTag: + return ots::TABLE_ACTION_PASSTHRU; + default: + return ots::TABLE_ACTION_DEFAULT; + } +#undef TABLE_TAG } } // namespace blink
diff --git a/sky/engine/platform/fonts/opentype/OpenTypeSanitizer.h b/sky/engine/platform/fonts/opentype/OpenTypeSanitizer.h index e3d522e..9794b5b 100644 --- a/sky/engine/platform/fonts/opentype/OpenTypeSanitizer.h +++ b/sky/engine/platform/fonts/opentype/OpenTypeSanitizer.h
@@ -31,7 +31,9 @@ #ifndef SKY_ENGINE_PLATFORM_FONTS_OPENTYPE_OPENTYPESANITIZER_H_ #define SKY_ENGINE_PLATFORM_FONTS_OPENTYPE_OPENTYPESANITIZER_H_ +#include "opentype-sanitiser.h" #include "sky/engine/wtf/Forward.h" +#include "sky/engine/wtf/text/WTFString.h" namespace blink { @@ -41,17 +43,36 @@ public: explicit OpenTypeSanitizer(SharedBuffer* buffer) : m_buffer(buffer) + , m_otsErrorString("") { } PassRefPtr<SharedBuffer> sanitize(); static bool supportsFormat(const String&); + String getErrorString() const { return static_cast<String>(m_otsErrorString); } + + void setErrorString(const String& errorString) { m_otsErrorString = errorString; } private: SharedBuffer* const m_buffer; + String m_otsErrorString; +}; + +class BlinkOTSContext: public ots::OTSContext { +public: + BlinkOTSContext() + : m_errorString("") + { + } + + virtual void Message(int level, const char *format, ...); + virtual ots::TableAction GetTableAction(uint32_t tag); + String getErrorString() const { return static_cast<String>(m_errorString); } +private: + String m_errorString; }; } // namespace blink -#endif // SKY_ENGINE_PLATFORM_FONTS_OPENTYPE_OPENTYPESANITIZER_H_ +#endif // SKY_ENGINE_PLATFORM_FONTS_OPENTYPE_OPENTYPESANITIZER_H_
diff --git a/sky/engine/platform/fonts/opentype/OpenTypeTypes.h b/sky/engine/platform/fonts/opentype/OpenTypeTypes.h index 132e787..65d5060 100644 --- a/sky/engine/platform/fonts/opentype/OpenTypeTypes.h +++ b/sky/engine/platform/fonts/opentype/OpenTypeTypes.h
@@ -98,4 +98,5 @@ } // namespace OpenType } // namespace blink -#endif // SKY_ENGINE_PLATFORM_FONTS_OPENTYPE_OPENTYPETYPES_H_ + +#endif // SKY_ENGINE_PLATFORM_FONTS_OPENTYPE_OPENTYPETYPES_H_
diff --git a/sky/engine/platform/fonts/opentype/OpenTypeVerticalData.cpp b/sky/engine/platform/fonts/opentype/OpenTypeVerticalData.cpp index 8acb546..378c1f0 100644 --- a/sky/engine/platform/fonts/opentype/OpenTypeVerticalData.cpp +++ b/sky/engine/platform/fonts/opentype/OpenTypeVerticalData.cpp
@@ -25,28 +25,21 @@ #include "sky/engine/platform/fonts/opentype/OpenTypeVerticalData.h" #include "sky/engine/platform/SharedBuffer.h" -#include "sky/engine/platform/fonts/GlyphPage.h" #include "sky/engine/platform/fonts/SimpleFontData.h" +#include "sky/engine/platform/fonts/GlyphPage.h" #include "sky/engine/platform/fonts/opentype/OpenTypeTypes.h" #include "sky/engine/platform/geometry/FloatRect.h" #include "sky/engine/wtf/RefPtr.h" -#if ENABLE(OPENTYPE_VERTICAL) - namespace blink { namespace OpenType { -const uint32_t GSUBTag = OT_MAKE_TAG('G', 'S', 'U', 'B'); const uint32_t HheaTag = OT_MAKE_TAG('h', 'h', 'e', 'a'); const uint32_t HmtxTag = OT_MAKE_TAG('h', 'm', 't', 'x'); const uint32_t VheaTag = OT_MAKE_TAG('v', 'h', 'e', 'a'); const uint32_t VmtxTag = OT_MAKE_TAG('v', 'm', 't', 'x'); const uint32_t VORGTag = OT_MAKE_TAG('V', 'O', 'R', 'G'); -const uint32_t DefaultScriptTag = OT_MAKE_TAG('D', 'F', 'L', 'T'); - -const uint32_t VertFeatureTag = OT_MAKE_TAG('v', 'e', 'r', 't'); - #pragma pack(1) struct HheaTable { @@ -110,287 +103,6 @@ size_t requiredSize() const { return sizeof(*this) + sizeof(VertOriginYMetrics) * (numVertOriginYMetrics - 1); } }; -struct CoverageTable : TableBase { - OpenType::UInt16 coverageFormat; -}; - -struct Coverage1Table : CoverageTable { - OpenType::UInt16 glyphCount; - OpenType::GlyphID glyphArray[1]; -}; - -struct Coverage2Table : CoverageTable { - OpenType::UInt16 rangeCount; - struct RangeRecord { - OpenType::GlyphID start; - OpenType::GlyphID end; - OpenType::UInt16 startCoverageIndex; - } ranges[1]; -}; - -struct SubstitutionSubTable : TableBase { - OpenType::UInt16 substFormat; - OpenType::Offset coverageOffset; - - const CoverageTable* coverage(const SharedBuffer& buffer) const { return validateOffset<CoverageTable>(buffer, coverageOffset); } -}; - -struct SingleSubstitution2SubTable : SubstitutionSubTable { - OpenType::UInt16 glyphCount; - OpenType::GlyphID substitute[1]; -}; - -struct LookupTable : TableBase { - OpenType::UInt16 lookupType; - OpenType::UInt16 lookupFlag; - OpenType::UInt16 subTableCount; - OpenType::Offset subTableOffsets[1]; - // OpenType::UInt16 markFilteringSet; this field comes after variable length, so offset is determined dynamically. - - bool getSubstitutions(HashMap<Glyph, Glyph>* map, const SharedBuffer& buffer) const - { - uint16_t countSubTable = subTableCount; - if (!isValidEnd(buffer, &subTableOffsets[countSubTable])) - return false; - if (lookupType != 1) // "Single Substitution Subtable" is all what we support - return false; - for (uint16_t i = 0; i < countSubTable; ++i) { - const SubstitutionSubTable* substitution = validateOffset<SubstitutionSubTable>(buffer, subTableOffsets[i]); - if (!substitution) - return false; - const CoverageTable* coverage = substitution->coverage(buffer); - if (!coverage) - return false; - if (substitution->substFormat != 2) // "Single Substitution Format 2" is all what we support - return false; - const SingleSubstitution2SubTable* singleSubstitution2 = validatePtr<SingleSubstitution2SubTable>(buffer, substitution); - if (!singleSubstitution2) - return false; - uint16_t countTo = singleSubstitution2->glyphCount; - if (!isValidEnd(buffer, &singleSubstitution2->substitute[countTo])) - return false; - switch (coverage->coverageFormat) { - case 1: { // Coverage Format 1 (e.g., MS Gothic) - const Coverage1Table* coverage1 = validatePtr<Coverage1Table>(buffer, coverage); - if (!coverage1) - return false; - uint16_t countFrom = coverage1->glyphCount; - if (!isValidEnd(buffer, &coverage1->glyphArray[countFrom]) || countTo != countFrom) - return false; - for (uint16_t i = 0; i < countTo; ++i) - map->set(coverage1->glyphArray[i], singleSubstitution2->substitute[i]); - break; - } - case 2: { // Coverage Format 2 (e.g., Adobe Kozuka Gothic) - const Coverage2Table* coverage2 = validatePtr<Coverage2Table>(buffer, coverage); - if (!coverage2) - return false; - uint16_t countRange = coverage2->rangeCount; - if (!isValidEnd(buffer, &coverage2->ranges[countRange])) - return false; - for (uint16_t i = 0, indexTo = 0; i < countRange; ++i) { - uint16_t from = coverage2->ranges[i].start; - uint16_t fromEnd = coverage2->ranges[i].end + 1; // OpenType "end" is inclusive - if (indexTo + (fromEnd - from) > countTo) - return false; - for (; from != fromEnd; ++from, ++indexTo) - map->set(from, singleSubstitution2->substitute[indexTo]); - } - break; - } - default: - return false; - } - } - return true; - } -}; - -struct LookupList : TableBase { - OpenType::UInt16 lookupCount; - OpenType::Offset lookupOffsets[1]; - - const LookupTable* lookup(uint16_t index, const SharedBuffer& buffer) const - { - uint16_t count = lookupCount; - if (index >= count || !isValidEnd(buffer, &lookupOffsets[count])) - return 0; - return validateOffset<LookupTable>(buffer, lookupOffsets[index]); - } -}; - -struct FeatureTable : TableBase { - OpenType::Offset featureParams; - OpenType::UInt16 lookupCount; - OpenType::UInt16 lookupListIndex[1]; - - bool getGlyphSubstitutions(const LookupList* lookups, HashMap<Glyph, Glyph>* map, const SharedBuffer& buffer) const - { - uint16_t count = lookupCount; - if (!isValidEnd(buffer, &lookupListIndex[count])) - return false; - for (uint16_t i = 0; i < count; ++i) { - const LookupTable* lookup = lookups->lookup(lookupListIndex[i], buffer); - if (!lookup || !lookup->getSubstitutions(map, buffer)) - return false; - } - return true; - } -}; - -struct FeatureList : TableBase { - OpenType::UInt16 featureCount; - struct FeatureRecord { - OpenType::Tag featureTag; - OpenType::Offset featureOffset; - } features[1]; - - const FeatureTable* feature(uint16_t index, OpenType::Tag tag, const SharedBuffer& buffer) const - { - uint16_t count = featureCount; - if (index >= count || !isValidEnd(buffer, &features[count])) - return 0; - if (features[index].featureTag == tag) - return validateOffset<FeatureTable>(buffer, features[index].featureOffset); - return 0; - } - - const FeatureTable* findFeature(OpenType::Tag tag, const SharedBuffer& buffer) const - { - for (uint16_t i = 0; i < featureCount; ++i) { - if (isValidEnd(buffer, &features[i]) && features[i].featureTag == tag) - return validateOffset<FeatureTable>(buffer, features[i].featureOffset); - } - return 0; - } -}; - -struct LangSysTable : TableBase { - OpenType::Offset lookupOrder; - OpenType::UInt16 reqFeatureIndex; - OpenType::UInt16 featureCount; - OpenType::UInt16 featureIndex[1]; - - const FeatureTable* feature(OpenType::Tag featureTag, const FeatureList* features, const SharedBuffer& buffer) const - { - uint16_t count = featureCount; - if (!isValidEnd(buffer, &featureIndex[count])) - return 0; - for (uint16_t i = 0; i < count; ++i) { - const FeatureTable* featureTable = features->feature(featureIndex[i], featureTag, buffer); - if (featureTable) - return featureTable; - } - return 0; - } -}; - -struct ScriptTable : TableBase { - OpenType::Offset defaultLangSysOffset; - OpenType::UInt16 langSysCount; - struct LangSysRecord { - OpenType::Tag langSysTag; - OpenType::Offset langSysOffset; - } langSysRecords[1]; - - const LangSysTable* defaultLangSys(const SharedBuffer& buffer) const - { - uint16_t count = langSysCount; - if (!isValidEnd(buffer, &langSysRecords[count])) - return 0; - uint16_t offset = defaultLangSysOffset; - if (offset) - return validateOffset<LangSysTable>(buffer, offset); - if (count) - return validateOffset<LangSysTable>(buffer, langSysRecords[0].langSysOffset); - return 0; - } -}; - -struct ScriptList : TableBase { - OpenType::UInt16 scriptCount; - struct ScriptRecord { - OpenType::Tag scriptTag; - OpenType::Offset scriptOffset; - } scripts[1]; - - const ScriptTable* script(OpenType::Tag tag, const SharedBuffer& buffer) const - { - uint16_t count = scriptCount; - if (!isValidEnd(buffer, &scripts[count])) - return 0; - for (uint16_t i = 0; i < count; ++i) { - if (scripts[i].scriptTag == tag) - return validateOffset<ScriptTable>(buffer, scripts[i].scriptOffset); - } - return 0; - } - - const ScriptTable* defaultScript(const SharedBuffer& buffer) const - { - uint16_t count = scriptCount; - if (!count || !isValidEnd(buffer, &scripts[count])) - return 0; - const ScriptTable* scriptOfDefaultTag = script(OpenType::DefaultScriptTag, buffer); - if (scriptOfDefaultTag) - return scriptOfDefaultTag; - return validateOffset<ScriptTable>(buffer, scripts[0].scriptOffset); - } - - const LangSysTable* defaultLangSys(const SharedBuffer& buffer) const - { - const ScriptTable* scriptTable = defaultScript(buffer); - if (!scriptTable) - return 0; - return scriptTable->defaultLangSys(buffer); - } -}; - -struct GSUBTable : TableBase { - OpenType::Fixed version; - OpenType::Offset scriptListOffset; - OpenType::Offset featureListOffset; - OpenType::Offset lookupListOffset; - - const ScriptList* scriptList(const SharedBuffer& buffer) const { return validateOffset<ScriptList>(buffer, scriptListOffset); } - const FeatureList* featureList(const SharedBuffer& buffer) const { return validateOffset<FeatureList>(buffer, featureListOffset); } - const LookupList* lookupList(const SharedBuffer& buffer) const { return validateOffset<LookupList>(buffer, lookupListOffset); } - - const LangSysTable* defaultLangSys(const SharedBuffer& buffer) const - { - const ScriptList* scripts = scriptList(buffer); - if (!scripts) - return 0; - return scripts->defaultLangSys(buffer); - } - - const FeatureTable* feature(OpenType::Tag featureTag, const SharedBuffer& buffer) const - { - const LangSysTable* langSys = defaultLangSys(buffer); - const FeatureList* features = featureList(buffer); - if (!features) - return 0; - const FeatureTable* feature = 0; - if (langSys) - feature = langSys->feature(featureTag, features, buffer); - if (!feature) { - // If the font has no langSys table, or has no default script and the first script doesn't - // have the requested feature, then use the first matching feature directly. - feature = features->findFeature(featureTag, buffer); - } - return feature; - } - - bool getVerticalGlyphSubstitutions(HashMap<Glyph, Glyph>* map, const SharedBuffer& buffer) const - { - const FeatureTable* verticalFeatureTable = feature(OpenType::VertFeatureTag, buffer); - if (!verticalFeatureTable) - return false; - const LookupList* lookups = lookupList(buffer); - return lookups && verticalFeatureTable->getGlyphSubstitutions(lookups, map, buffer); - } -}; - #pragma pack() } // namespace OpenType @@ -399,7 +111,6 @@ : m_defaultVertOriginY(0) { loadMetrics(platformData); - loadVerticalGlyphSubstitutions(platformData); } void OpenTypeVerticalData::loadMetrics(const FontPlatformData& platformData) @@ -487,14 +198,6 @@ } } -void OpenTypeVerticalData::loadVerticalGlyphSubstitutions(const FontPlatformData& platformData) -{ - RefPtr<SharedBuffer> buffer = platformData.openTypeTable(OpenType::GSUBTag); - const OpenType::GSUBTable* gsub = OpenType::validateTable<OpenType::GSUBTable>(buffer); - if (gsub) - gsub->getVerticalGlyphSubstitutions(&m_verticalGlyphMap, *buffer.get()); -} - float OpenTypeVerticalData::advanceHeight(const SimpleFontData* font, Glyph glyph) const { size_t countHeights = m_advanceHeights.size(); @@ -526,10 +229,12 @@ // For Y, try VORG first. if (useVORG) { - int16_t vertOriginYFUnit = m_vertOriginY.get(glyph); - if (vertOriginYFUnit) { - outXYArray[1] = -vertOriginYFUnit * sizePerUnit; - continue; + if (glyph) { + int16_t vertOriginYFUnit = m_vertOriginY.get(glyph); + if (vertOriginYFUnit) { + outXYArray[1] = -vertOriginYFUnit * sizePerUnit; + continue; + } } if (std::isnan(defaultVertOriginY)) defaultVertOriginY = -m_defaultVertOriginY * sizePerUnit; @@ -551,21 +256,4 @@ } } -void OpenTypeVerticalData::substituteWithVerticalGlyphs(const SimpleFontData* font, GlyphPage* glyphPage, unsigned offset, unsigned length) const -{ - const HashMap<Glyph, Glyph>& map = m_verticalGlyphMap; - if (map.isEmpty()) - return; - - for (unsigned index = offset, end = offset + length; index < end; ++index) { - GlyphData glyphData = glyphPage->glyphDataForIndex(index); - if (glyphData.glyph && glyphData.fontData == font) { - Glyph to = map.get(glyphData.glyph); - if (to) - glyphPage->setGlyphDataForIndex(index, to, font); - } - } -} - } // namespace blink -#endif // ENABLE(OPENTYPE_VERTICAL)
diff --git a/sky/engine/platform/fonts/opentype/OpenTypeVerticalData.h b/sky/engine/platform/fonts/opentype/OpenTypeVerticalData.h index 21f40f1..03b2d5a 100644 --- a/sky/engine/platform/fonts/opentype/OpenTypeVerticalData.h +++ b/sky/engine/platform/fonts/opentype/OpenTypeVerticalData.h
@@ -28,17 +28,13 @@ #include "sky/engine/platform/PlatformExport.h" #include "sky/engine/platform/fonts/Glyph.h" #include "sky/engine/wtf/HashMap.h" -#include "sky/engine/wtf/OperatingSystem.h" #include "sky/engine/wtf/PassRefPtr.h" #include "sky/engine/wtf/RefCounted.h" #include "sky/engine/wtf/Vector.h" -#if ENABLE(OPENTYPE_VERTICAL) - namespace blink { class FontPlatformData; -class GlyphPage; class SimpleFontData; class PLATFORM_EXPORT OpenTypeVerticalData : public RefCounted<OpenTypeVerticalData> { @@ -51,17 +47,17 @@ bool isOpenType() const { return !m_advanceWidths.isEmpty(); } bool hasVerticalMetrics() const { return !m_advanceHeights.isEmpty(); } float advanceHeight(const SimpleFontData*, Glyph) const; - void getVerticalTranslationsForGlyphs(const SimpleFontData*, const Glyph*, size_t, float* outXYArray) const; - void substituteWithVerticalGlyphs(const SimpleFontData*, GlyphPage*, unsigned offset, unsigned length) const; bool inFontCache() const { return m_inFontCache; } void setInFontCache(bool inFontCache) { m_inFontCache = inFontCache; } + void getVerticalTranslationsForGlyphs(const SimpleFontData*, const Glyph*, size_t, float* outXYArray) const; + private: + explicit OpenTypeVerticalData(const FontPlatformData&); void loadMetrics(const FontPlatformData&); - void loadVerticalGlyphSubstitutions(const FontPlatformData&); bool hasVORG() const { return !m_vertOriginY.isEmpty(); } HashMap<Glyph, Glyph> m_verticalGlyphMap; @@ -76,6 +72,4 @@ } // namespace blink -#endif // ENABLE(OPENTYPE_VERTICAL) - -#endif // SKY_ENGINE_PLATFORM_FONTS_OPENTYPE_OPENTYPEVERTICALDATA_H_ +#endif // SKY_ENGINE_PLATFORM_FONTS_OPENTYPE_OPENTYPEVERTICALDATA_H_
diff --git a/sky/engine/platform/image-decoders/jpeg/JPEGImageDecoder.cpp b/sky/engine/platform/image-decoders/jpeg/JPEGImageDecoder.cpp index 9632dbb..6978798 100644 --- a/sky/engine/platform/image-decoders/jpeg/JPEGImageDecoder.cpp +++ b/sky/engine/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
@@ -613,7 +613,7 @@ if (!inputProfile) return; // We currently only support color profiles for RGB profiled images. - ASSERT(icSigRgbData == qcms_profile_get_color_space(inputProfile)); + ASSERT(rgbData == qcms_profile_get_color_space(inputProfile)); qcms_data_type dataFormat = hasAlpha ? QCMS_DATA_RGBA_8 : QCMS_DATA_RGB_8; // FIXME: Don't force perceptual intent if the image profile contains an intent. m_transform = qcms_transform_create(inputProfile, dataFormat, deviceProfile, dataFormat, QCMS_INTENT_PERCEPTUAL);
diff --git a/sky/engine/platform/image-decoders/png/PNGImageDecoder.cpp b/sky/engine/platform/image-decoders/png/PNGImageDecoder.cpp index 53d574f..7bf02d6 100644 --- a/sky/engine/platform/image-decoders/png/PNGImageDecoder.cpp +++ b/sky/engine/platform/image-decoders/png/PNGImageDecoder.cpp
@@ -193,7 +193,7 @@ if (!inputProfile) return; // We currently only support color profiles for RGB and RGBA images. - ASSERT(icSigRgbData == qcms_profile_get_color_space(inputProfile)); + ASSERT(rgbData == qcms_profile_get_color_space(inputProfile)); qcms_data_type dataFormat = hasAlpha ? QCMS_DATA_RGBA_8 : QCMS_DATA_RGB_8; // FIXME: Don't force perceptual intent if the image profile contains an intent. m_transform = qcms_transform_create(inputProfile, dataFormat, deviceProfile, dataFormat, QCMS_INTENT_PERCEPTUAL);
diff --git a/sky/engine/wtf/BUILD.gn b/sky/engine/wtf/BUILD.gn index e9d7197..ee91492 100644 --- a/sky/engine/wtf/BUILD.gn +++ b/sky/engine/wtf/BUILD.gn
@@ -231,6 +231,7 @@ direct_dependent_configs = [ "//sky/engine:features" ] deps = [ + "//base", "//third_party/icu", ]
diff --git a/sky/engine/wtf/dtoa/utils.h b/sky/engine/wtf/dtoa/utils.h index a22ca1b..962fbac 100644 --- a/sky/engine/wtf/dtoa/utils.h +++ b/sky/engine/wtf/dtoa/utils.h
@@ -29,6 +29,7 @@ #define SKY_ENGINE_WTF_DTOA_UTILS_H_ #include <string.h> +#include "base/macros.h" #include "sky/engine/wtf/Assertions.h" #define UNIMPLEMENTED ASSERT_NOT_REACHED @@ -70,22 +71,6 @@ ((sizeof(a) / sizeof(*(a))) / \ static_cast<size_t>(!(sizeof(a) % sizeof(*(a))))) -// A macro to disallow the evil copy constructor and operator= functions -// This should be used in the private: declarations for a class -#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ -TypeName(const TypeName&); \ -void operator=(const TypeName&) - -// A macro to disallow all the implicit constructors, namely the -// default constructor, copy constructor and operator= functions. -// -// This should be used in the private: declarations for a class -// that wants to prevent anyone from instantiating it. This is -// especially useful for classes containing only static methods. -#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ -TypeName(); \ -DISALLOW_COPY_AND_ASSIGN(TypeName) - namespace WTF { namespace double_conversion {
diff --git a/sky/shell/BUILD.gn b/sky/shell/BUILD.gn index 88c9d68..ae169d3 100644 --- a/sky/shell/BUILD.gn +++ b/sky/shell/BUILD.gn
@@ -136,7 +136,7 @@ "$root_build_dir/icudtl.dat", ] deps = [ - "//third_party/icu", + "//third_party/icu:icudata", ] } } else if (is_ios) {
diff --git a/sky/shell/android/org/domokit/sky/shell/SkyApplication.java b/sky/shell/android/org/domokit/sky/shell/SkyApplication.java index 7812f42..b72fcc4 100644 --- a/sky/shell/android/org/domokit/sky/shell/SkyApplication.java +++ b/sky/shell/android/org/domokit/sky/shell/SkyApplication.java
@@ -97,7 +97,7 @@ private void initNative() { try { - LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized(); + LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized(this); } catch (ProcessInitException e) { Log.e(TAG, "Unable to load Sky Engine binary.", e); throw new RuntimeException(e);
diff --git a/sky/shell/dart/dart_library_provider_files.cc b/sky/shell/dart/dart_library_provider_files.cc index 2bed8e8..c806200 100644 --- a/sky/shell/dart/dart_library_provider_files.cc +++ b/sky/shell/dart/dart_library_provider_files.cc
@@ -63,17 +63,17 @@ } std::string DartLibraryProviderFiles::CanonicalizePackageURL(std::string url) { - DCHECK(StartsWithASCII(url, "package:", true)); - ReplaceFirstSubstringAfterOffset(&url, 0, "package:", ""); + DCHECK(base::StartsWithASCII(url, "package:", true)); + base::ReplaceFirstSubstringAfterOffset(&url, 0, "package:", ""); return package_root_.Append(url).AsUTF8Unsafe(); } Dart_Handle DartLibraryProviderFiles::CanonicalizeURL(Dart_Handle library, Dart_Handle url) { std::string string = blink::StdStringFromDart(url); - if (StartsWithASCII(string, "dart:", true)) + if (base::StartsWithASCII(string, "dart:", true)) return url; - if (StartsWithASCII(string, "package:", true)) + if (base::StartsWithASCII(string, "package:", true)) return blink::StdStringToDart(CanonicalizePackageURL(string)); base::FilePath base_path(blink::StdStringFromDart(Dart_LibraryUrl(library))); base::FilePath resolved_path = base_path.DirName().Append(string);
diff --git a/sky/shell/dart/dart_library_provider_network.cc b/sky/shell/dart/dart_library_provider_network.cc index f91cac0..7ee06ae 100644 --- a/sky/shell/dart/dart_library_provider_network.cc +++ b/sky/shell/dart/dart_library_provider_network.cc
@@ -74,11 +74,11 @@ Dart_Handle DartLibraryProviderNetwork::CanonicalizeURL(Dart_Handle library, Dart_Handle url) { std::string string = blink::StdStringFromDart(url); - if (StartsWithASCII(string, "dart:", true)) + if (base::StartsWithASCII(string, "dart:", true)) return url; // TODO(abarth): The package root should be configurable. - if (StartsWithASCII(string, "package:", true)) - ReplaceFirstSubstringAfterOffset(&string, 0, "package:", "/packages/"); + if (base::StartsWithASCII(string, "package:", true)) + base::ReplaceFirstSubstringAfterOffset(&string, 0, "package:", "/packages/"); GURL library_url(blink::StdStringFromDart(Dart_LibraryUrl(library))); GURL resolved_url = library_url.Resolve(string); return blink::StdStringToDart(resolved_url.spec());
diff --git a/sky/shell/testing/test_runner.cc b/sky/shell/testing/test_runner.cc index c4bf2dc..589f75f 100644 --- a/sky/shell/testing/test_runner.cc +++ b/sky/shell/testing/test_runner.cc
@@ -124,8 +124,8 @@ std::cout << "#BEGIN\n"; std::cout.flush(); - if (StartsWithASCII(data.url, kFileUrlPrefix, true)) - ReplaceFirstSubstringAfterOffset(&data.url, 0, kFileUrlPrefix, ""); + if (base::StartsWithASCII(data.url, kFileUrlPrefix, true)) + base::ReplaceFirstSubstringAfterOffset(&data.url, 0, kFileUrlPrefix, ""); if (data.is_snapshot) sky_engine_->RunFromSnapshot(data.url);
diff --git a/sky/shell/ui/engine.cc b/sky/shell/ui/engine.cc index aaec298..800f456 100644 --- a/sky/shell/ui/engine.cc +++ b/sky/shell/ui/engine.cc
@@ -179,8 +179,9 @@ void Engine::RunFromFile(const mojo::String& main, const mojo::String& package_root) { + std::string package_root_str = package_root; dart_library_provider_.reset( - new DartLibraryProviderFiles(base::FilePath(package_root))); + new DartLibraryProviderFiles(base::FilePath(package_root_str))); RunFromLibrary(main); }
diff --git a/sky/tools/packager/loader.cc b/sky/tools/packager/loader.cc index 9b5e024..397eacb 100644 --- a/sky/tools/packager/loader.cc +++ b/sky/tools/packager/loader.cc
@@ -57,16 +57,16 @@ } std::string Loader::CanonicalizePackageURL(std::string url) { - DCHECK(StartsWithASCII(url, "package:", true)); - ReplaceFirstSubstringAfterOffset(&url, 0, "package:", ""); + DCHECK(base::StartsWithASCII(url, "package:", true)); + base::ReplaceFirstSubstringAfterOffset(&url, 0, "package:", ""); return package_root_.Append(url).AsUTF8Unsafe(); } Dart_Handle Loader::CanonicalizeURL(Dart_Handle library, Dart_Handle url) { std::string string = StringFromDart(url); - if (StartsWithASCII(string, "dart:", true)) + if (base::StartsWithASCII(string, "dart:", true)) return url; - if (StartsWithASCII(string, "package:", true)) + if (base::StartsWithASCII(string, "package:", true)) return StringToDart(CanonicalizePackageURL(string)); base::FilePath base_path(StringFromDart(Dart_LibraryUrl(library))); base::FilePath resolved_path = base_path.DirName().Append(string);
diff --git a/third_party/khronos/KHR/khrplatform.h b/third_party/khronos/KHR/khrplatform.h index 026c9c7..ee062de 100644 --- a/third_party/khronos/KHR/khrplatform.h +++ b/third_party/khronos/KHR/khrplatform.h
@@ -124,7 +124,7 @@ #undef KHRONOS_APICALL #if defined(GLES2_USE_MOJO) -#include "third_party/mojo/src/mojo/public/c/gles2/gles2_export.h" +#include "mojo/public/c/gles2/gles2_export.h" #define KHRONOS_APICALL MOJO_GLES2_EXPORT #else #include "gpu/command_buffer/client/gles2_c_lib_export.h"
diff --git a/ui/events/platform/x11/hotplug_event_handler_x11.cc b/ui/events/platform/x11/hotplug_event_handler_x11.cc index c6530cb..aba85f6 100644 --- a/ui/events/platform/x11/hotplug_event_handler_x11.cc +++ b/ui/events/platform/x11/hotplug_event_handler_x11.cc
@@ -66,7 +66,7 @@ XCloseDevice(dpy, dev); std::string event_node = dev_node_path.BaseName().value(); - if (event_node.empty() || !StartsWithASCII(event_node, "event", false)) + if (event_node.empty() || !base::StartsWithASCII(event_node, "event", false)) return false; // Extract id "XXX" from "eventXXX"
diff --git a/ui/gl/gl_gl_api_implementation.cc b/ui/gl/gl_gl_api_implementation.cc index 5bea3f1..bffa64e 100644 --- a/ui/gl/gl_gl_api_implementation.cc +++ b/ui/gl/gl_gl_api_implementation.cc
@@ -8,6 +8,7 @@ #include <vector> #include "base/command_line.h" +#include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "ui/gl/gl_context.h" #include "ui/gl/gl_implementation.h" @@ -437,8 +438,8 @@ DCHECK(real_context->IsCurrent(NULL)); std::string ext_string( reinterpret_cast<const char*>(driver_->fn.glGetStringFn(GL_EXTENSIONS))); - std::vector<std::string> ext; - Tokenize(ext_string, " ", &ext); + std::vector<std::string> ext = base::SplitString( + ext_string, " ", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); std::vector<std::string>::iterator it; // We can't support GL_EXT_occlusion_query_boolean which is @@ -448,7 +449,7 @@ if (it != ext.end()) ext.erase(it); - extensions_ = JoinString(ext, " "); + extensions_ = base::JoinString(ext, " "); } bool VirtualGLApi::MakeCurrent(GLContext* virtual_context, GLSurface* surface) {
diff --git a/ui/gl/gl_version_info.cc b/ui/gl/gl_version_info.cc index e2aa0de..0240969 100644 --- a/ui/gl/gl_version_info.cc +++ b/ui/gl/gl_version_info.cc
@@ -35,7 +35,7 @@ is_es3 = true; } if (renderer_str) { - is_angle = StartsWithASCII(renderer_str, "ANGLE", true); + is_angle = base::StartsWithASCII(renderer_str, "ANGLE", true); } }