[webkit-changes] [196388] trunk/Source/WebCore

2016-02-10 Thread mmaxfield
Title: [196388] trunk/Source/WebCore








Revision 196388
Author mmaxfi...@apple.com
Date 2016-02-10 13:07:59 -0800 (Wed, 10 Feb 2016)


Log Message
CSSSegmentedFontFace does not need to be reference counted
https://bugs.webkit.org/show_bug.cgi?id=154083

Reviewed by Antti Koivisto.

...There is only ever a single reference to one.

No new tests because there is no behavior change.

* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::getFontFace):
* css/CSSFontSelector.h:
* css/CSSSegmentedFontFace.h:
(WebCore::CSSSegmentedFontFace::create): Deleted.

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/css/CSSFontSelector.cpp
trunk/Source/WebCore/css/CSSFontSelector.h
trunk/Source/WebCore/css/CSSSegmentedFontFace.h




Diff

Modified: trunk/Source/WebCore/ChangeLog (196387 => 196388)

--- trunk/Source/WebCore/ChangeLog	2016-02-10 21:07:52 UTC (rev 196387)
+++ trunk/Source/WebCore/ChangeLog	2016-02-10 21:07:59 UTC (rev 196388)
@@ -1,3 +1,20 @@
+2016-02-10  Myles C. Maxfield  
+
+CSSSegmentedFontFace does not need to be reference counted
+https://bugs.webkit.org/show_bug.cgi?id=154083
+
+Reviewed by Antti Koivisto.
+
+...There is only ever a single reference to one.
+
+No new tests because there is no behavior change.
+
+* css/CSSFontSelector.cpp:
+(WebCore::CSSFontSelector::getFontFace):
+* css/CSSFontSelector.h:
+* css/CSSSegmentedFontFace.h:
+(WebCore::CSSSegmentedFontFace::create): Deleted.
+
 2016-02-10  Antti Koivisto  
 
 Optimize style invalidation after class attribute change


Modified: trunk/Source/WebCore/css/CSSFontSelector.cpp (196387 => 196388)

--- trunk/Source/WebCore/css/CSSFontSelector.cpp	2016-02-10 21:07:52 UTC (rev 196387)
+++ trunk/Source/WebCore/css/CSSFontSelector.cpp	2016-02-10 21:07:59 UTC (rev 196388)
@@ -465,15 +465,15 @@
 return nullptr;
 auto& familyFontFaces = iterator->value;
 
-auto& segmentedFontFaceCache = m_fonts.add(family, HashMap>()).iterator->value;
+auto& segmentedFontFaceCache = m_fonts.add(family, HashMap>()).iterator->value;
 
 FontTraitsMask traitsMask = fontDescription.traitsMask();
 
-RefPtr& face = segmentedFontFaceCache.add(traitsMask, nullptr).iterator->value;
+std::unique_ptr& face = segmentedFontFaceCache.add(traitsMask, nullptr).iterator->value;
 if (face)
 return face.get();
 
-face = CSSSegmentedFontFace::create(*this);
+face = std::make_unique(*this);
 
 Vector, 32> candidateFontFaces;
 for (int i = familyFontFaces.size() - 1; i >= 0; --i) {


Modified: trunk/Source/WebCore/css/CSSFontSelector.h (196387 => 196388)

--- trunk/Source/WebCore/css/CSSFontSelector.h	2016-02-10 21:07:52 UTC (rev 196387)
+++ trunk/Source/WebCore/css/CSSFontSelector.h	2016-02-10 21:07:59 UTC (rev 196388)
@@ -88,7 +88,7 @@
 Document* m_document;
 HashMap>, ASCIICaseInsensitiveHash> m_fontFaces;
 HashMap>, ASCIICaseInsensitiveHash> m_locallyInstalledFontFaces;
-HashMap>, ASCIICaseInsensitiveHash> m_fonts;
+HashMap>, ASCIICaseInsensitiveHash> m_fonts;
 HashSet m_clients;
 
 Vector> m_fontsToBeginLoading;


Modified: trunk/Source/WebCore/css/CSSSegmentedFontFace.h (196387 => 196388)

--- trunk/Source/WebCore/css/CSSSegmentedFontFace.h	2016-02-10 21:07:52 UTC (rev 196387)
+++ trunk/Source/WebCore/css/CSSSegmentedFontFace.h	2016-02-10 21:07:59 UTC (rev 196388)
@@ -39,9 +39,10 @@
 class CSSFontSelector;
 class FontDescription;
 
-class CSSSegmentedFontFace : public RefCounted {
+class CSSSegmentedFontFace {
+WTF_MAKE_FAST_ALLOCATED;
 public:
-static Ref create(CSSFontSelector& selector) { return adoptRef(*new CSSSegmentedFontFace(selector)); }
+CSSSegmentedFontFace(CSSFontSelector&);
 ~CSSSegmentedFontFace();
 
 CSSFontSelector& fontSelector() const { return m_fontSelector; }
@@ -53,7 +54,6 @@
 FontRanges fontRanges(const FontDescription&);
 
 private:
-CSSSegmentedFontFace(CSSFontSelector&);
 
 CSSFontSelector& m_fontSelector;
 HashMap> m_cache;






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [196393] trunk/Source/WebCore

2016-02-10 Thread mmaxfield
Title: [196393] trunk/Source/WebCore








Revision 196393
Author mmaxfi...@apple.com
Date 2016-02-10 13:57:53 -0800 (Wed, 10 Feb 2016)


Log Message
CSSSegmentedFontFace does not need to be reference counted
https://bugs.webkit.org/show_bug.cgi?id=154083

Reviewed by Antti Koivisto.

...There is only ever a single reference to one.

No new tests because there is no behavior change.

* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::getFontFace):
* css/CSSFontSelector.h:
* css/CSSSegmentedFontFace.h:
(WebCore::CSSSegmentedFontFace::create): Deleted.

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/css/CSSFontSelector.cpp
trunk/Source/WebCore/platform/graphics/FontCache.cpp
trunk/Source/WebCore/platform/graphics/FontCache.h




Diff

Modified: trunk/Source/WebCore/ChangeLog (196392 => 196393)

--- trunk/Source/WebCore/ChangeLog	2016-02-10 21:51:18 UTC (rev 196392)
+++ trunk/Source/WebCore/ChangeLog	2016-02-10 21:57:53 UTC (rev 196393)
@@ -1,3 +1,39 @@
+2016-02-10  Myles C. Maxfield  
+
+CSSSegmentedFontFace does not need to be reference counted
+https://bugs.webkit.org/show_bug.cgi?id=154083
+
+Reviewed by Antti Koivisto.
+
+...There is only ever a single reference to one.
+
+No new tests because there is no behavior change.
+
+* css/CSSFontSelector.cpp:
+(WebCore::CSSFontSelector::getFontFace):
+* css/CSSFontSelector.h:
+* css/CSSSegmentedFontFace.h:
+(WebCore::CSSSegmentedFontFace::create): Deleted.
+
+2016-02-10  Myles C. Maxfield  
+
+FontCache's clients should use references instead of pointers
+https://bugs.webkit.org/show_bug.cgi?id=154085
+
+Reviewed by Antti Koivisto.
+
+They are never null.
+
+No new tests because there is no behavior change.
+
+* css/CSSFontSelector.cpp:
+(WebCore::CSSFontSelector::CSSFontSelector):
+(WebCore::CSSFontSelector::~CSSFontSelector):
+* platform/graphics/FontCache.cpp:
+(WebCore::FontCache::addClient):
+(WebCore::FontCache::removeClient):
+* platform/graphics/FontCache.h:
+
 2016-02-10  Chris Dumez  
 
 [Web IDL] interface objects should be Function objects


Modified: trunk/Source/WebCore/css/CSSFontSelector.cpp (196392 => 196393)

--- trunk/Source/WebCore/css/CSSFontSelector.cpp	2016-02-10 21:51:18 UTC (rev 196392)
+++ trunk/Source/WebCore/css/CSSFontSelector.cpp	2016-02-10 21:57:53 UTC (rev 196393)
@@ -73,13 +73,13 @@
 // seem to be any such guarantee.
 
 ASSERT(m_document);
-FontCache::singleton().addClient(this);
+FontCache::singleton().addClient(*this);
 }
 
 CSSFontSelector::~CSSFontSelector()
 {
 clearDocument();
-FontCache::singleton().removeClient(this);
+FontCache::singleton().removeClient(*this);
 }
 
 bool CSSFontSelector::isEmpty() const


Modified: trunk/Source/WebCore/platform/graphics/FontCache.cpp (196392 => 196393)

--- trunk/Source/WebCore/platform/graphics/FontCache.cpp	2016-02-10 21:51:18 UTC (rev 196392)
+++ trunk/Source/WebCore/platform/graphics/FontCache.cpp	2016-02-10 21:57:53 UTC (rev 196393)
@@ -485,21 +485,21 @@
 
 static HashSet* gClients;
 
-void FontCache::addClient(FontSelector* client)
+void FontCache::addClient(FontSelector& client)
 {
 if (!gClients)
 gClients = new HashSet;
 
-ASSERT(!gClients->contains(client));
-gClients->add(client);
+ASSERT(!gClients->contains(&client));
+gClients->add(&client);
 }
 
-void FontCache::removeClient(FontSelector* client)
+void FontCache::removeClient(FontSelector& client)
 {
 ASSERT(gClients);
-ASSERT(gClients->contains(client));
+ASSERT(gClients->contains(&client));
 
-gClients->remove(client);
+gClients->remove(&client);
 }
 
 static unsigned short gGeneration = 0;


Modified: trunk/Source/WebCore/platform/graphics/FontCache.h (196392 => 196393)

--- trunk/Source/WebCore/platform/graphics/FontCache.h	2016-02-10 21:51:18 UTC (rev 196392)
+++ trunk/Source/WebCore/platform/graphics/FontCache.h	2016-02-10 21:57:53 UTC (rev 196393)
@@ -193,8 +193,8 @@
 WEBCORE_EXPORT Ref fontForPlatformData(const FontPlatformData&);
 RefPtr similarFont(const FontDescription&, const AtomicString& family);
 
-void addClient(FontSelector*);
-void removeClient(FontSelector*);
+void addClient(FontSelector&);
+void removeClient(FontSelector&);
 
 unsigned short generation();
 WEBCORE_EXPORT void invalidate();






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [196438] trunk/Source/WebCore

2016-02-11 Thread mmaxfield
Title: [196438] trunk/Source/WebCore








Revision 196438
Author mmaxfi...@apple.com
Date 2016-02-11 14:12:16 -0800 (Thu, 11 Feb 2016)


Log Message
Addressing post-review comments after r196393

Unreviewed.

* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::getFontFace):
* css/CSSSegmentedFontFace.h:

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/css/CSSFontSelector.cpp
trunk/Source/WebCore/css/CSSSegmentedFontFace.h




Diff

Modified: trunk/Source/WebCore/ChangeLog (196437 => 196438)

--- trunk/Source/WebCore/ChangeLog	2016-02-11 22:09:27 UTC (rev 196437)
+++ trunk/Source/WebCore/ChangeLog	2016-02-11 22:12:16 UTC (rev 196438)
@@ -1,3 +1,13 @@
+2016-02-11  Myles C. Maxfield  
+
+Addressing post-review comments after r196393
+
+Unreviewed.
+
+* css/CSSFontSelector.cpp:
+(WebCore::CSSFontSelector::getFontFace):
+* css/CSSSegmentedFontFace.h:
+
 2016-02-11  Antti Koivisto  
 
 Rename Element::style() to Element::cssomStyle()


Modified: trunk/Source/WebCore/css/CSSFontSelector.cpp (196437 => 196438)

--- trunk/Source/WebCore/css/CSSFontSelector.cpp	2016-02-11 22:09:27 UTC (rev 196437)
+++ trunk/Source/WebCore/css/CSSFontSelector.cpp	2016-02-11 22:12:16 UTC (rev 196438)
@@ -469,7 +469,7 @@
 
 FontTraitsMask traitsMask = fontDescription.traitsMask();
 
-std::unique_ptr& face = segmentedFontFaceCache.add(traitsMask, nullptr).iterator->value;
+auto& face = segmentedFontFaceCache.add(traitsMask, nullptr).iterator->value;
 if (face)
 return face.get();
 


Modified: trunk/Source/WebCore/css/CSSSegmentedFontFace.h (196437 => 196438)

--- trunk/Source/WebCore/css/CSSSegmentedFontFace.h	2016-02-11 22:09:27 UTC (rev 196437)
+++ trunk/Source/WebCore/css/CSSSegmentedFontFace.h	2016-02-11 22:12:16 UTC (rev 196438)
@@ -39,7 +39,7 @@
 class CSSFontSelector;
 class FontDescription;
 
-class CSSSegmentedFontFace {
+class CSSSegmentedFontFace final {
 WTF_MAKE_FAST_ALLOCATED;
 public:
 CSSSegmentedFontFace(CSSFontSelector&);






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [196510] trunk/Source/WebCore

2016-02-12 Thread mmaxfield
Title: [196510] trunk/Source/WebCore








Revision 196510
Author mmaxfi...@apple.com
Date 2016-02-12 14:22:20 -0800 (Fri, 12 Feb 2016)


Log Message
[CSS Font Loading] Implement CSSFontFace Boilerplate
https://bugs.webkit.org/show_bug.cgi?id=154145

Reviewed by Dean Jackson.

The CSS Font Loading spec[1] dictates that the FontFace object needs to have string
accessors and mutators for a bunch of properties. Our CSSFontFace object currently
contains this parsed information, but it isn't accessible via string-based methods.
This patch adds the necessary accessors and mutators, and migrates CSSFontSelector
to use these mutators where necessary.

There is more work to come on CSSFontFace; the next step is to create an .idl file
and hook it up to our CSSFontFace object. In this patch I have left some
unimplemented pieces (for example: where the spec dictates that some operation should
throw a _javascript_ exception) which will be implemented in a follow-up patch. This
patch does not have any visible behavior change; I'm separating out the boilerplate
into this patch in order to ease reviewing burden.

This patch separates the externally-facing _javascript_ API into a new class, FontFace.
This class owns a CSSFontFace, which provides the backing implementation. There will
be a system of shared ownership of these objects once FontFaceSet is implemented.

No new tests because there is no behavior change.

* CMakeLists.txt: Add new files to CMake builds.
* WebCore.vcxproj/WebCore.vcxproj: Ditto for Windows.
* WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto for Cocoa.
* css/CSSAllInOne.cpp: Ditto for All-In-One builds.
* css/CSSFontFace.cpp: Move shared code from CSSFontSelector into CSSFontFace.
(WebCore::CSSFontFace::CSSFontFace):
(WebCore::CSSFontFace::~CSSFontFace):
(WebCore::CSSFontFace::setFamilies):
(WebCore::CSSFontFace::setStyle):
(WebCore::CSSFontFace::setWeight):
(WebCore::CSSFontFace::setUnicodeRange):
(WebCore::CSSFontFace::setVariantLigatures):
(WebCore::CSSFontFace::setVariantPosition):
(WebCore::CSSFontFace::setVariantCaps):
(WebCore::CSSFontFace::setVariantNumeric):
(WebCore::CSSFontFace::setVariantAlternates):
(WebCore::CSSFontFace::setVariantEastAsian):
(WebCore::CSSFontFace::setFeatureSettings):
* css/CSSFontFace.h: Clean up.
(WebCore::CSSFontFace::create):
(WebCore::CSSFontFace::families):
(WebCore::CSSFontFace::traitsMask):
(WebCore::CSSFontFace::featureSettings):
(WebCore::CSSFontFace::variantSettings):
(WebCore::CSSFontFace::setVariantSettings):
(WebCore::CSSFontFace::setTraitsMask):
(WebCore::CSSFontFace::isLocalFallback):
(WebCore::CSSFontFace::addRange): Deleted.
(WebCore::CSSFontFace::insertFeature): Deleted.
(WebCore::CSSFontFace::setVariantCommonLigatures): Deleted.
(WebCore::CSSFontFace::setVariantDiscretionaryLigatures): Deleted.
(WebCore::CSSFontFace::setVariantHistoricalLigatures): Deleted.
(WebCore::CSSFontFace::setVariantContextualAlternates): Deleted.
(WebCore::CSSFontFace::setVariantPosition): Deleted.
(WebCore::CSSFontFace::setVariantCaps): Deleted.
(WebCore::CSSFontFace::setVariantNumericFigure): Deleted.
(WebCore::CSSFontFace::setVariantNumericSpacing): Deleted.
(WebCore::CSSFontFace::setVariantNumericFraction): Deleted.
(WebCore::CSSFontFace::setVariantNumericOrdinal): Deleted.
(WebCore::CSSFontFace::setVariantNumericSlashedZero): Deleted.
(WebCore::CSSFontFace::setVariantAlternates): Deleted.
(WebCore::CSSFontFace::setVariantEastAsianVariant): Deleted.
(WebCore::CSSFontFace::setVariantEastAsianWidth): Deleted.
(WebCore::CSSFontFace::setVariantEastAsianRuby): Deleted.
(WebCore::CSSFontFace::CSSFontFace): Deleted.
* css/CSSFontSelector.cpp: Migrate shared code into CSSFontFace, and udpate
to use the new API.
(WebCore::appendSources):
(WebCore::registerLocalFontFacesForFamily):
(WebCore::CSSFontSelector::addFontFaceRule):
(WebCore::computeTraitsMask): Deleted.
(WebCore::createFontFace): Deleted.
* css/FontFace.cpp: Added. External _javascript_ API. Owns a CSSFontFace.
(WebCore::FontFace::FontFace):
(WebCore::FontFace::~FontFace):
(WebCore::parseString):
(WebCore::FontFace::setFamily):
(WebCore::FontFace::setStyle):
(WebCore::FontFace::setWeight):
(WebCore::FontFace::setStretch):
(WebCore::FontFace::setUnicodeRange):
(WebCore::FontFace::setVariant):
(WebCore::FontFace::setFeatureSettings):
(WebCore::FontFace::family):
(WebCore::FontFace::style):
(WebCore::FontFace::weight):
(WebCore::FontFace::stretch):
(WebCore::FontFace::unicodeRange):
(WebCore::FontFace::variant):
(WebCore::FontFace::featureSettings):
* css/FontFace.h: Added. Ditto.
(WebCore::FontFace::create):
* css/FontVariantBuilder.cpp: Added. Moved code here from FontVariantBuilder.h.
Refactored to support a new client (CSSFontFace).
(WebCore::extractFontVariantLigatures):
(WebCore::extractFontVariantNumeric):
(WebCore::extractFontVariantEastAsian):
(WebCore::computeFontVariant):
* css/FontVariantBuilder.h: Moved code from here into FontVariantBuilder.cpp.
(WebCore::applyVal

[webkit-changes] [196559] trunk/Source/WebCore

2016-02-13 Thread mmaxfield
Title: [196559] trunk/Source/WebCore








Revision 196559
Author mmaxfi...@apple.com
Date 2016-02-13 18:20:14 -0800 (Sat, 13 Feb 2016)


Log Message
[Win] [SVG -> OTF Converter] SVG fonts drawn into ImageBuffers are invisible
https://bugs.webkit.org/show_bug.cgi?id=154222

Reviewed by Antti Koivisto.

Windows ImageBuffer code is sensitive to broken bounding box and
descent code.

Covered by existing tests.

* svg/SVGToOTFFontConversion.cpp:
(WebCore::SVGToOTFFontConverter::appendHHEATable):
(WebCore::SVGToOTFFontConverter::appendOS2Table):
(WebCore::SVGToOTFFontConverter::processGlyphElement):
(WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/svg/SVGToOTFFontConversion.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (196558 => 196559)

--- trunk/Source/WebCore/ChangeLog	2016-02-14 02:17:22 UTC (rev 196558)
+++ trunk/Source/WebCore/ChangeLog	2016-02-14 02:20:14 UTC (rev 196559)
@@ -1,3 +1,21 @@
+2016-02-13  Myles C. Maxfield  
+
+[Win] [SVG -> OTF Converter] SVG fonts drawn into ImageBuffers are invisible
+https://bugs.webkit.org/show_bug.cgi?id=154222
+
+Reviewed by Antti Koivisto.
+
+Windows ImageBuffer code is sensitive to broken bounding box and
+descent code.
+
+Covered by existing tests.
+
+* svg/SVGToOTFFontConversion.cpp:
+(WebCore::SVGToOTFFontConverter::appendHHEATable):
+(WebCore::SVGToOTFFontConverter::appendOS2Table):
+(WebCore::SVGToOTFFontConverter::processGlyphElement):
+(WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter):
+
 2016-02-13  Antti Koivisto  
 
 Add version number for default stylesheet


Modified: trunk/Source/WebCore/svg/SVGToOTFFontConversion.cpp (196558 => 196559)

--- trunk/Source/WebCore/svg/SVGToOTFFontConversion.cpp	2016-02-14 02:17:22 UTC (rev 196558)
+++ trunk/Source/WebCore/svg/SVGToOTFFontConversion.cpp	2016-02-14 02:20:14 UTC (rev 196559)
@@ -194,7 +194,7 @@
 
 uint32_t calculateChecksum(size_t startingOffset, size_t endingOffset) const;
 
-void processGlyphElement(const SVGElement& glyphOrMissingGlyphElement, const SVGGlyphElement*, float defaultHorizontalAdvance, float defaultVerticalAdvance, const String& codepoints, Optional boundingBox);
+void processGlyphElement(const SVGElement& glyphOrMissingGlyphElement, const SVGGlyphElement*, float defaultHorizontalAdvance, float defaultVerticalAdvance, const String& codepoints, Optional& boundingBox);
 
 typedef void (SVGToOTFFontConverter::*FontAppendingFunction)();
 void appendTable(const char identifier[4], FontAppendingFunction);
@@ -431,7 +431,7 @@
 {
 append32(0x0001); // Version
 append16(clampTo(m_ascent));
-append16(clampTo(m_descent));
+append16(clampTo(-m_descent));
 // WebKit SVG font rendering has hard coded the line gap to be 1/10th of the font size since 2008 (see r29719).
 append16(clampTo(m_lineGap));
 append16(clampTo(m_advanceWidthMax));
@@ -547,7 +547,7 @@
 append16(0); // First unicode index
 append16(0x); // Last unicode index
 append16(clampTo(m_ascent)); // Typographical ascender
-append16(clampTo(m_descent)); // Typographical descender
+append16(clampTo(-m_descent)); // Typographical descender
 append16(clampTo(m_lineGap)); // Typographical line gap
 append16(clampTo(m_ascent)); // Windows-specific ascent
 append16(clampTo(m_descent)); // Windows-specific descent
@@ -1285,7 +1285,7 @@
 return result;
 }
 
-void SVGToOTFFontConverter::processGlyphElement(const SVGElement& glyphOrMissingGlyphElement, const SVGGlyphElement* glyphElement, float defaultHorizontalAdvance, float defaultVerticalAdvance, const String& codepoints, Optional boundingBox)
+void SVGToOTFFontConverter::processGlyphElement(const SVGElement& glyphOrMissingGlyphElement, const SVGGlyphElement* glyphElement, float defaultHorizontalAdvance, float defaultVerticalAdvance, const String& codepoints, Optional& boundingBox)
 {
 bool ok;
 float horizontalAdvance = scaleUnitsPerEm(glyphOrMissingGlyphElement.fastGetAttribute(SVGNames::horiz_adv_xAttr).toFloat(&ok));
@@ -1423,8 +1423,10 @@
 Optional boundingBox;
 if (m_missingGlyphElement)
 processGlyphElement(*m_missingGlyphElement, nullptr, defaultHorizontalAdvance, defaultVerticalAdvance, String(), boundingBox);
-else
+else {
 m_glyphs.append(GlyphData(Vector(m_emptyGlyphCharString), nullptr, s_outputUnitsPerEm, s_outputUnitsPerEm, FloatRect(), String()));
+boundingBox = FloatRect(0, 0, s_outputUnitsPerEm, s_outputUnitsPerEm);
+}
 
 for (auto& glyphElement : childrenOfType(m_fontElement)) {
 auto& unicodeAttribute = glyphElement.fastGetAttribute(SVGNames::unicodeAttr);






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [255988] trunk

2020-02-06 Thread mmaxfield
Title: [255988] trunk








Revision 255988
Author mmaxfi...@apple.com
Date 2020-02-06 15:31:17 -0800 (Thu, 06 Feb 2020)


Log Message
REGRESSION(r254534): 1-3% regression on PLT
https://bugs.webkit.org/show_bug.cgi?id=207244


Reviewed by Simon Fraser.

Source/WebCore:

Turns out CTFontTransformGlyphsWithLanguage() is 33.7% slower than CTFontTransformGlyphs() on some OSes.
This patch changes the preprocessor guards to not use the function on those OSes.
Also, the contract of the function on the more performant OSes requires that the locale name be canonicalized,
so this patch implements a canonical locale cache inside LocaleMac.mm. It gets cleared when the low memory
warning is fired.

Marked existing tests as failing.

* page/cocoa/MemoryReleaseCocoa.mm:
(WebCore::platformReleaseMemory):
* platform/graphics/cocoa/FontCocoa.mm:
(WebCore::Font::applyTransforms const):
* platform/graphics/mac/SimpleFontDataCoreText.cpp:
(WebCore::Font::getCFStringAttributes const):
* platform/text/mac/LocaleMac.h:
* platform/text/mac/LocaleMac.mm:
(WebCore::determineLocale):
(WebCore::canonicalLocaleMap):
(WebCore::LocaleMac::canonicalLanguageIdentifierFromString):
(WebCore::LocaleMac::releaseMemory):

Source/WTF:

CTFontTransformGlyphsWithLanguage() is only acceptable on certain OSes.

* wtf/PlatformHave.h:

LayoutTests:

Mark the tests as failing on certain OSes.

* platform/ios/TestExpectations:
* platform/mac/TestExpectations:

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/platform/ios/TestExpectations
trunk/LayoutTests/platform/mac/TestExpectations
trunk/Source/WTF/ChangeLog
trunk/Source/WTF/wtf/PlatformHave.h
trunk/Source/WTF/wtf/PlatformUse.h
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/page/cocoa/MemoryReleaseCocoa.mm
trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm
trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp
trunk/Source/WebCore/platform/text/mac/LocaleMac.h
trunk/Source/WebCore/platform/text/mac/LocaleMac.mm




Diff

Modified: trunk/LayoutTests/ChangeLog (255987 => 255988)

--- trunk/LayoutTests/ChangeLog	2020-02-06 23:25:01 UTC (rev 255987)
+++ trunk/LayoutTests/ChangeLog	2020-02-06 23:31:17 UTC (rev 255988)
@@ -1,3 +1,16 @@
+2020-02-06  Myles C. Maxfield  
+
+REGRESSION(r254534): 1-3% regression on PLT
+https://bugs.webkit.org/show_bug.cgi?id=207244
+
+
+Reviewed by Simon Fraser.
+
+Mark the tests as failing on certain OSes.
+
+* platform/ios/TestExpectations:
+* platform/mac/TestExpectations:
+
 2020-02-06  Devin Rousso  
 
 Web Inspector: show _javascript_ Worker terminated state as an internal property


Modified: trunk/LayoutTests/platform/ios/TestExpectations (255987 => 255988)

--- trunk/LayoutTests/platform/ios/TestExpectations	2020-02-06 23:25:01 UTC (rev 255987)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2020-02-06 23:31:17 UTC (rev 255988)
@@ -3480,4 +3480,8 @@
 
 webkit.org/b/207230 imported/w3c/web-platform-tests/fetch/stale-while-revalidate/fetch.html [ Pass Failure ]
 
-webkit.org/b/207278 imported/w3c/web-platform-tests/web-animations/timing-model/animations/finishing-an-animation.html [ Pass Failure ]
\ No newline at end of file
+webkit.org/b/207278 imported/w3c/web-platform-tests/web-animations/timing-model/animations/finishing-an-animation.html [ Pass Failure ]
+
+# Locale-specific shaping is only enabled on certain OSes.
+webkit.org/b/77568 fast/text/locale-shaping.html [ ImageOnlyFailure ]
+webkit.org/b/77568 fast/text/locale-shaping-complex.html [ ImageOnlyFailure ]


Modified: trunk/LayoutTests/platform/mac/TestExpectations (255987 => 255988)

--- trunk/LayoutTests/platform/mac/TestExpectations	2020-02-06 23:25:01 UTC (rev 255987)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2020-02-06 23:31:17 UTC (rev 255988)
@@ -1931,8 +1931,8 @@
 webkit.org/b/204312 imported/w3c/web-platform-tests/svg/import/struct-dom-06-b-manual.svg [ Failure Pass ]
 
 # Locale-specific shaping is only enabled on certain OSes.
-webkit.org/b/77568 [ Sierra HighSierra Mojave ] fast/text/locale-shaping.html [ ImageOnlyFailure ]
-webkit.org/b/77568 [ Sierra HighSierra Mojave ] fast/text/locale-shaping-complex.html [ ImageOnlyFailure ]
+webkit.org/b/77568 [ Sierra HighSierra Mojave Catalina ] fast/text/locale-shaping.html [ ImageOnlyFailure ]
+webkit.org/b/77568 [ Sierra HighSierra Mojave Catalina ] fast/text/locale-shaping-complex.html [ ImageOnlyFailure ]
 
 webkit.org/b/203222 svg/wicd/rightsizing-grid.xhtml [ Pass Failure ]
 


Modified: trunk/Source/WTF/ChangeLog (255987 => 255988)

--- trunk/Source/WTF/ChangeLog	2020-02-06 23:25:01 UTC (rev 255987)
+++ trunk/Source/WTF/ChangeLog	2020-02-06 23:31:17 UTC (rev 255988)
@@ -1,3 +1,15 @@
+2020-02-06  Myles C. Maxfield  
+
+REGRESSION(r254534): 1-3% regression on PLT
+https://bugs.webkit.org/show_bug.cgi?id=207244
+
+
+Reviewed by Simon Fraser.
+
+CTFontTransformGlyphsWithLanguage() is only accep

[webkit-changes] [256007] trunk/Source/WebCore

2020-02-06 Thread mmaxfield
Title: [256007] trunk/Source/WebCore








Revision 256007
Author mmaxfi...@apple.com
Date 2020-02-06 20:12:39 -0800 (Thu, 06 Feb 2020)


Log Message
[Cocoa] Rename LocaleMac to LocaleCocoa
https://bugs.webkit.org/show_bug.cgi?id=207371

Reviewed by Simon Fraser.

It's used by all the Cocoa platforms.

No new tests because there is no behavior change.

* PlatformMac.cmake:
* SourcesCocoa.txt:
* WebCore.order:
* WebCore.xcodeproj/project.pbxproj:
* page/cocoa/MemoryReleaseCocoa.mm:
(WebCore::platformReleaseMemory):
* platform/graphics/cocoa/FontCocoa.mm:
(WebCore::Font::applyTransforms const):
* platform/text/cocoa/LocaleCocoa.h: Renamed from Source/WebCore/platform/text/mac/LocaleMac.h.
* platform/text/mac/LocaleMac.mm: Removed.

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/PlatformMac.cmake
trunk/Source/WebCore/SourcesCocoa.txt
trunk/Source/WebCore/WebCore.order
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
trunk/Source/WebCore/page/cocoa/MemoryReleaseCocoa.mm
trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm


Added Paths

trunk/Source/WebCore/platform/text/cocoa/
trunk/Source/WebCore/platform/text/cocoa/LocaleCocoa.h
trunk/Source/WebCore/platform/text/cocoa/LocaleCocoa.mm


Removed Paths

trunk/Source/WebCore/platform/text/mac/LocaleMac.h
trunk/Source/WebCore/platform/text/mac/LocaleMac.mm




Diff

Modified: trunk/Source/WebCore/ChangeLog (256006 => 256007)

--- trunk/Source/WebCore/ChangeLog	2020-02-07 03:45:12 UTC (rev 256006)
+++ trunk/Source/WebCore/ChangeLog	2020-02-07 04:12:39 UTC (rev 256007)
@@ -1,3 +1,25 @@
+2020-02-06  Myles C. Maxfield  
+
+[Cocoa] Rename LocaleMac to LocaleCocoa
+https://bugs.webkit.org/show_bug.cgi?id=207371
+
+Reviewed by Simon Fraser.
+
+It's used by all the Cocoa platforms.
+
+No new tests because there is no behavior change.
+
+* PlatformMac.cmake:
+* SourcesCocoa.txt:
+* WebCore.order:
+* WebCore.xcodeproj/project.pbxproj:
+* page/cocoa/MemoryReleaseCocoa.mm:
+(WebCore::platformReleaseMemory):
+* platform/graphics/cocoa/FontCocoa.mm:
+(WebCore::Font::applyTransforms const):
+* platform/text/cocoa/LocaleCocoa.h: Renamed from Source/WebCore/platform/text/mac/LocaleMac.h.
+* platform/text/mac/LocaleMac.mm: Removed.
+
 2020-02-06  Tim Horton  
 
 macCatalyst: Unnecessary I-beam over images in editable areas


Modified: trunk/Source/WebCore/PlatformMac.cmake (256006 => 256007)

--- trunk/Source/WebCore/PlatformMac.cmake	2020-02-07 03:45:12 UTC (rev 256006)
+++ trunk/Source/WebCore/PlatformMac.cmake	2020-02-07 04:12:39 UTC (rev 256007)
@@ -430,9 +430,10 @@
 platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm
 platform/network/mac/WebCoreURLResponse.mm
 
+platform/text/cocoa/LocaleCocoa.mm
+
 platform/text/cf/HyphenationCF.cpp
 
-platform/text/mac/LocaleMac.mm
 platform/text/mac/TextBoundaries.mm
 platform/text/mac/TextCheckingMac.mm
 platform/text/mac/TextEncodingRegistryMac.mm


Modified: trunk/Source/WebCore/SourcesCocoa.txt (256006 => 256007)

--- trunk/Source/WebCore/SourcesCocoa.txt	2020-02-07 03:45:12 UTC (rev 256006)
+++ trunk/Source/WebCore/SourcesCocoa.txt	2020-02-07 04:12:39 UTC (rev 256007)
@@ -537,10 +537,11 @@
 
 platform/text/cf/HyphenationCF.cpp
 
+platform/text/cocoa/LocaleCocoa.mm
+
 platform/text/ios/LocalizedDateCache.mm
 platform/text/ios/TextEncodingRegistryIOS.mm
 
-platform/text/mac/LocaleMac.mm
 platform/text/mac/TextBoundaries.mm
 platform/text/mac/TextCheckingMac.mm
 platform/text/mac/TextEncodingRegistryMac.mm


Modified: trunk/Source/WebCore/WebCore.order (256006 => 256007)

--- trunk/Source/WebCore/WebCore.order	2020-02-07 03:45:12 UTC (rev 256006)
+++ trunk/Source/WebCore/WebCore.order	2020-02-07 04:12:39 UTC (rev 256007)
@@ -23173,7 +23173,7 @@
 __ZTVN7WebCore16LegacyWebArchiveE
 __ZTVN7WebCore10LinkLoaderE
 __ZTVN7WebCore17LoadableTextTrackE
-__ZTVN7WebCore9LocaleMacE
+__ZTVN7WebCore9LocaleCocoaE
 __ZZN7WebCore16scriptNameToCodeERKN3WTF6StringEE18scriptNameCodeList
 __ZZN7WebCore34localeToScriptCodeForFontSelectionERKN3WTF6StringEE16localeScriptList
 __ZTVN7WebCore18MainResourceLoaderE


Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (256006 => 256007)

--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-02-07 03:45:12 UTC (rev 256006)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-02-07 04:12:39 UTC (rev 256007)
@@ -5013,7 +5013,7 @@
 		F55B3DDC1251F12D003EF269 /* TimeInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3DA81251F12D003EF269 /* TimeInputType.h */; };
 		F55B3DDE1251F12D003EF269 /* URLInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3DAA1251F12D003EF269 /* URLInputType.h */; };
 		F55B3DE01251F12D003EF269 /* WeekInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3DAC1251F12D003EF269 /* WeekInputType.h */; };
-		F5973DE015CFB20300

[webkit-changes] [256008] trunk/Source/WebCore

2020-02-06 Thread mmaxfield
Title: [256008] trunk/Source/WebCore








Revision 256008
Author mmaxfi...@apple.com
Date 2020-02-06 21:19:16 -0800 (Thu, 06 Feb 2020)


Log Message
REGRESSION(r254534): 1-3% regression on PLT
https://bugs.webkit.org/show_bug.cgi?id=207244

Can't put null strings into hash maps.

Reviewed by Wenson Hsieh.

* platform/text/cocoa/LocaleCocoa.mm:
(WebCore::LocaleCocoa::canonicalLanguageIdentifierFromString):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/platform/text/cocoa/LocaleCocoa.mm




Diff

Modified: trunk/Source/WebCore/ChangeLog (256007 => 256008)

--- trunk/Source/WebCore/ChangeLog	2020-02-07 04:12:39 UTC (rev 256007)
+++ trunk/Source/WebCore/ChangeLog	2020-02-07 05:19:16 UTC (rev 256008)
@@ -1,5 +1,17 @@
 2020-02-06  Myles C. Maxfield  
 
+REGRESSION(r254534): 1-3% regression on PLT
+https://bugs.webkit.org/show_bug.cgi?id=207244
+
+Can't put null strings into hash maps.
+
+Reviewed by Wenson Hsieh.
+
+* platform/text/cocoa/LocaleCocoa.mm:
+(WebCore::LocaleCocoa::canonicalLanguageIdentifierFromString):
+
+2020-02-06  Myles C. Maxfield  
+
 [Cocoa] Rename LocaleMac to LocaleCocoa
 https://bugs.webkit.org/show_bug.cgi?id=207371
 


Modified: trunk/Source/WebCore/platform/text/cocoa/LocaleCocoa.mm (256007 => 256008)

--- trunk/Source/WebCore/platform/text/cocoa/LocaleCocoa.mm	2020-02-07 04:12:39 UTC (rev 256007)
+++ trunk/Source/WebCore/platform/text/cocoa/LocaleCocoa.mm	2020-02-07 05:19:16 UTC (rev 256008)
@@ -288,6 +288,8 @@
 
 AtomString LocaleCocoa::canonicalLanguageIdentifierFromString(const AtomString& string)
 {
+if (string.isEmpty())
+return string;
 return canonicalLocaleMap().ensure(string, [&] {
 return [NSLocale canonicalLanguageIdentifierFromString:string];
 }).iterator->value;






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [256037] trunk/Source/WebCore

2020-02-07 Thread mmaxfield
Title: [256037] trunk/Source/WebCore








Revision 256037
Author mmaxfi...@apple.com
Date 2020-02-07 10:59:10 -0800 (Fri, 07 Feb 2020)


Log Message
[Cocoa] Slightly improve performance of Font::getCFStringAttributes()
https://bugs.webkit.org/show_bug.cgi?id=207374

Reviewed by Darin Adler.

Switch from CFDictionaryCreateMutable() to CFDictionaryCreate(). Also, don't construct a CTParagraphStyle each time the function is called.

No new tests because there is no behavior change.

* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::widthForSimpleText const):
* platform/graphics/mac/SimpleFontDataCoreText.cpp:
(WebCore::Font::getCFStringAttributes const):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/platform/graphics/FontCascade.cpp
trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (256036 => 256037)

--- trunk/Source/WebCore/ChangeLog	2020-02-07 18:49:43 UTC (rev 256036)
+++ trunk/Source/WebCore/ChangeLog	2020-02-07 18:59:10 UTC (rev 256037)
@@ -1,3 +1,19 @@
+2020-02-07  Myles C. Maxfield  
+
+[Cocoa] Slightly improve performance of Font::getCFStringAttributes()
+https://bugs.webkit.org/show_bug.cgi?id=207374
+
+Reviewed by Darin Adler.
+
+Switch from CFDictionaryCreateMutable() to CFDictionaryCreate(). Also, don't construct a CTParagraphStyle each time the function is called.
+
+No new tests because there is no behavior change.
+
+* platform/graphics/FontCascade.cpp:
+(WebCore::FontCascade::widthForSimpleText const):
+* platform/graphics/mac/SimpleFontDataCoreText.cpp:
+(WebCore::Font::getCFStringAttributes const):
+
 2020-02-07  youenn fablet  
 
 Align getDisplayMedia() with spec


Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (256036 => 256037)

--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2020-02-07 18:49:43 UTC (rev 256036)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2020-02-07 18:59:10 UTC (rev 256037)
@@ -428,8 +428,6 @@
 return *cacheEntry;
 
 GlyphBuffer glyphBuffer;
-Vector glyphs;
-Vector advances;
 bool hasKerningOrLigatures = enableKerning() || requiresShaping();
 float runWidth = 0;
 auto& font = primaryFont();


Modified: trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp (256036 => 256037)

--- trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp	2020-02-07 18:49:43 UTC (rev 256036)
+++ trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp	2020-02-07 18:59:10 UTC (rev 256037)
@@ -34,29 +34,50 @@
 
 RetainPtr Font::getCFStringAttributes(bool enableKerning, FontOrientation orientation, const AtomString& locale) const
 {
-auto attributesDictionary = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 4, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+CFTypeRef keys[5];
+CFTypeRef values[5];
 
-CFDictionarySetValue(attributesDictionary.get(), kCTFontAttributeName, platformData().ctFont());
+keys[0] = kCTFontAttributeName;
+values[0] = platformData().ctFont();
+size_t count = 1;
+
 #if USE(CTFONTTRANSFORMGLYPHSWITHLANGUAGE)
-if (!locale.isEmpty())
-CFDictionarySetValue(attributesDictionary.get(), kCTLanguageAttributeName, locale.string().createCFString().get());
+RetainPtr localeString;
+if (!locale.isEmpty()) {
+localeString = locale.string().createCFString();
+keys[count] = kCTLanguageAttributeName;
+values[count] = localeString.get();
+++count;
+}
 #else
 UNUSED_PARAM(locale);
 #endif
-auto paragraphStyle = adoptCF(CTParagraphStyleCreate(nullptr, 0));
-CTParagraphStyleSetCompositionLanguage(paragraphStyle.get(), kCTCompositionLanguageNone);
-CFDictionarySetValue(attributesDictionary.get(), kCTParagraphStyleAttributeName, paragraphStyle.get());
+static CTParagraphStyleRef paragraphStyle = [] {
+auto paragraphStyle = CTParagraphStyleCreate(nullptr, 0);
+CTParagraphStyleSetCompositionLanguage(paragraphStyle, kCTCompositionLanguageNone);
+return paragraphStyle;
+}();
+keys[count] = kCTParagraphStyleAttributeName;
+values[count] = paragraphStyle;
+++count;
 
 if (!enableKerning) {
 const float zero = 0;
 static CFNumberRef zeroKerningValue = CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &zero);
-CFDictionarySetValue(attributesDictionary.get(), kCTKernAttributeName, zeroKerningValue);
+keys[count] = kCTKernAttributeName;
+values[count] = zeroKerningValue;
+++count;
 }
 
-if (orientation == FontOrientation::Vertical)
-CFDictionarySetValue(attributesDictionary.get(), kCTVerticalFormsAttributeName, kCFBooleanTrue);
+if (orientation == FontOrientation::Vertical) {
+keys[count] = kCTVerticalFormsAttributeName;
+values[count]

[webkit-changes] [241229] trunk

2019-02-08 Thread mmaxfield
Title: [241229] trunk








Revision 241229
Author mmaxfi...@apple.com
Date 2019-02-08 19:42:23 -0800 (Fri, 08 Feb 2019)


Log Message
[Cocoa] Ask platform for generic font family mappings
https://bugs.webkit.org/show_bug.cgi?id=187723


Reviewed by Brent Fulgham.

Source/WebCore:

WebKit API allows setting the generic font families for the USCRIPT_COMMON script.
When trying to style a character with a generic font family, we first look to see if
we have a mapping for the particular script the character is rendered with, and if we
don't find a match, we then check USCRIPT_COMMON.

In the Cocoa ports, the only way families get set for non-USCRIPT_COMMON scripts (aka
the only scripts which won't use the API families) is in
SettingsBase::initializeDefaultFontFamilies(). That function only sets the families
for the CJK scripts.

The mappings inside SettingsBase are incorrect and conflict with our policy regarding
user-installed fonts. Instead, we should be consulting with the platform for some of
these mappings, by calling CTFontDescriptorCreateForCSSFamily(). However, the WebKit
API still has to work to set the mappings for untagged content. Therefore, we use the
system mappings for language-tagged content, and the API mappings for non-language-tagged
content. This is a good balance that makes sure we always have a good mapping for every
language, but API clients can still set the mappings, too.

Test: fast/text/ja-sans-serif.html

* css/CSSComputedStyleDeclaration.cpp:
* css/CSSFontSelector.cpp:
(WebCore::resolveGenericFamily):
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeFontFamily):
* page/cocoa/SettingsBaseCocoa.mm:
(WebCore::SettingsBase::initializeDefaultFontFamilies):
(WebCore::osakaMonoIsInstalled): Deleted.
* platform/graphics/FontDescription.cpp:
(WebCore::FontDescription::platformResolveGenericFamily):
* platform/graphics/FontDescription.h:
* platform/graphics/cocoa/FontDescriptionCocoa.cpp:
(WebCore::computeSpecializedChineseLocale):
(WebCore::cachedSpecializedChineseLocale):
(WebCore::languageChanged):
(WebCore::FontDescription::platformResolveGenericFamily):
* platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
(WebCore::SystemFontDatabaseCoreText::clear):
(WebCore::SystemFontDatabaseCoreText::serifFamily):
(WebCore::SystemFontDatabaseCoreText::sansSerifFamily):
(WebCore::SystemFontDatabaseCoreText::cursiveFamily):
(WebCore::SystemFontDatabaseCoreText::fantasyFamily):
(WebCore::SystemFontDatabaseCoreText::monospaceFamily):
* platform/graphics/cocoa/SystemFontDatabaseCoreText.h:

Source/WebCore/PAL:

* pal/spi/cocoa/CoreTextSPI.h:

Tools:

Allow testing infrastructure to use fonts that are returned from CTFontDescriptorCreateForCSSFamily().

* DumpRenderTree/mac/DumpRenderTree.mm:
(allowedFontFamilySet):
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::allowedFontFamilySet):

LayoutTests:

Update the tests to work with this new model.

* fast/text/international/font-fallback-to-common-script-expected.html: Removed.
* fast/text/international/font-fallback-to-common-script.html: Removed. This test is no longer testing
anything relevant.
* fast/text/international/lang-sensitive-fonts-expected.html:
* fast/text/international/lang-sensitive-fonts-xml-expected.html:
* fast/text/international/lang-sensitive-fonts-xml.xhtml:
* fast/text/international/lang-sensitive-fonts.html:
* fast/text/international/locale-sensitive-fonts-expected.html:
* fast/text/international/locale-sensitive-fonts.html:
* fast/text/ja-sans-serif-expected-mismatch.html: Added.
* fast/text/ja-sans-serif.html: Added.

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/fast/text/international/lang-sensitive-fonts-expected.html
trunk/LayoutTests/fast/text/international/lang-sensitive-fonts-xml-expected.html
trunk/LayoutTests/fast/text/international/lang-sensitive-fonts-xml.xhtml
trunk/LayoutTests/fast/text/international/lang-sensitive-fonts.html
trunk/LayoutTests/fast/text/international/locale-sensitive-fonts-expected.html
trunk/LayoutTests/fast/text/international/locale-sensitive-fonts.html
trunk/LayoutTests/platform/ios/fast/block/float/016-expected.txt
trunk/Source/WTF/wtf/Platform.h
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/PAL/ChangeLog
trunk/Source/WebCore/PAL/pal/spi/cocoa/CoreTextSPI.h
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
trunk/Source/WebCore/css/CSSFontSelector.cpp
trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp
trunk/Source/WebCore/page/cocoa/SettingsBaseCocoa.mm
trunk/Source/WebCore/platform/graphics/FontDescription.cpp
trunk/Source/WebCore/platform/graphics/FontDescription.h
trunk/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp
trunk/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp
trunk/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.h
trunk/Tools/ChangeLog
trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm
trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm


Added Paths

trunk/LayoutTests/fast/text/ja-san

[webkit-changes] [241231] trunk/Source/WebCore

2019-02-08 Thread mmaxfield
Title: [241231] trunk/Source/WebCore








Revision 241231
Author mmaxfi...@apple.com
Date 2019-02-08 20:06:34 -0800 (Fri, 08 Feb 2019)


Log Message
[Cocoa] CTLineGetGlyphRuns() might return nullptr
https://bugs.webkit.org/show_bug.cgi?id=194467


Reviewed by Simon Fraser.

Be somewhat defensive to try to make sure this sort of thing doesn't happen in the future.

Covered by find/text/find-backwards.html

* platform/graphics/mac/ComplexTextControllerCoreText.mm:
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm




Diff

Modified: trunk/Source/WebCore/ChangeLog (241230 => 241231)

--- trunk/Source/WebCore/ChangeLog	2019-02-09 03:56:32 UTC (rev 241230)
+++ trunk/Source/WebCore/ChangeLog	2019-02-09 04:06:34 UTC (rev 241231)
@@ -1,5 +1,20 @@
 2019-02-08  Myles C. Maxfield  
 
+[Cocoa] CTLineGetGlyphRuns() might return nullptr
+https://bugs.webkit.org/show_bug.cgi?id=194467
+
+
+Reviewed by Simon Fraser.
+
+Be somewhat defensive to try to make sure this sort of thing doesn't happen in the future.
+
+Covered by find/text/find-backwards.html
+
+* platform/graphics/mac/ComplexTextControllerCoreText.mm:
+(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
+
+2019-02-08  Myles C. Maxfield  
+
 [Cocoa] Ask platform for generic font family mappings
 https://bugs.webkit.org/show_bug.cgi?id=187723
 


Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm (241230 => 241231)

--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm	2019-02-09 03:56:32 UTC (rev 241230)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm	2019-02-09 04:06:34 UTC (rev 241231)
@@ -162,6 +162,9 @@
 RetainPtr typesetter = adoptCF(CTTypesetterCreateWithUniCharProviderAndOptions(&provideStringAndAttributes, 0, &info, m_run.ltr() ? ltrTypesetterOptions : rtlTypesetterOptions));
 IGNORE_NULL_CHECK_WARNINGS_END
 
+if (!typesetter)
+return;
+
 line = adoptCF(CTTypesetterCreateLine(typesetter.get(), CFRangeMake(0, 0)));
 } else {
 ProviderInfo info = { cp, length, stringAttributes.get() };
@@ -169,10 +172,16 @@
 line = adoptCF(CTLineCreateWithUniCharProvider(&provideStringAndAttributes, nullptr, &info));
 }
 
+if (!line)
+return;
+
 m_coreTextLines.append(line.get());
 
 CFArrayRef runArray = CTLineGetGlyphRuns(line.get());
 
+if (!runArray)
+return;
+
 CFIndex runCount = CFArrayGetCount(runArray);
 
 for (CFIndex r = 0; r < runCount; r++) {






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [241288] trunk

2019-02-11 Thread mmaxfield
Title: [241288] trunk








Revision 241288
Author mmaxfi...@apple.com
Date 2019-02-11 18:19:19 -0800 (Mon, 11 Feb 2019)


Log Message
[Cocoa] Ask platform for generic font family mappings
https://bugs.webkit.org/show_bug.cgi?id=187723


Reviewed by Brent Fulgham.

Source/WebCore:

WebKit API allows setting the generic font families for the USCRIPT_COMMON script.
When trying to style a character with a generic font family, we first look to see if
we have a mapping for the particular script the character is rendered with, and if we
don't find a match, we then check USCRIPT_COMMON.

In the Cocoa ports, the only way families get set for non-USCRIPT_COMMON scripts (aka
the only scripts which won't use the API families) is in
SettingsBase::initializeDefaultFontFamilies(). That function only sets the families
for the CJK scripts.

The mappings inside SettingsBase are incorrect and conflict with our policy regarding
user-installed fonts. Instead, we should be consulting with the platform for some of
these mappings, by calling CTFontDescriptorCreateForCSSFamily(). However, the WebKit
API still has to work to set the mappings for untagged content. Therefore, we use the
system mappings for language-tagged content, and the API mappings for non-language-tagged
content. This is a good balance that makes sure we always have a good mapping for every
language, but API clients can still set the mappings, too.

Test: fast/text/ja-sans-serif.html

* css/CSSComputedStyleDeclaration.cpp:
* css/CSSFontSelector.cpp:
(WebCore::resolveGenericFamily):
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeFontFamily):
* page/cocoa/SettingsBaseCocoa.mm:
(WebCore::SettingsBase::initializeDefaultFontFamilies):
(WebCore::osakaMonoIsInstalled): Deleted.
* platform/graphics/FontDescription.cpp:
(WebCore::FontDescription::platformResolveGenericFamily):
* platform/graphics/FontDescription.h:
* platform/graphics/cocoa/FontDescriptionCocoa.cpp:
(WebCore::computeSpecializedChineseLocale):
(WebCore::cachedSpecializedChineseLocale):
(WebCore::languageChanged):
(WebCore::FontDescription::platformResolveGenericFamily):
* platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
(WebCore::SystemFontDatabaseCoreText::clear):
(WebCore::genericFamily):
(WebCore::SystemFontDatabaseCoreText::serifFamily):
(WebCore::SystemFontDatabaseCoreText::sansSerifFamily):
(WebCore::SystemFontDatabaseCoreText::cursiveFamily):
(WebCore::SystemFontDatabaseCoreText::fantasyFamily):
(WebCore::SystemFontDatabaseCoreText::monospaceFamily):
* platform/graphics/cocoa/SystemFontDatabaseCoreText.h:

Source/WebCore/PAL:

* pal/spi/cocoa/CoreTextSPI.h:

Source/WTF:

Add an ENABLE in Platform.

* wtf/Platform.h:

Tools:

Allow testing infrastructure to use fonts that are returned from CTFontDescriptorCreateForCSSFamily().

* DumpRenderTree/mac/DumpRenderTree.mm:
(allowedFontFamilySet):
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::allowedFontFamilySet):

LayoutTests:

Update the tests to work with this new model.

* fast/text/international/font-fallback-to-common-script-expected.html: Removed.
* fast/text/international/font-fallback-to-common-script.html: Removed.
* fast/text/international/lang-sensitive-fonts-expected.html:
* fast/text/international/lang-sensitive-fonts-xml-expected.html:
* fast/text/international/lang-sensitive-fonts-xml.xhtml:
* fast/text/international/lang-sensitive-fonts.html:
* fast/text/international/locale-sensitive-fonts-expected.html:
* fast/text/international/locale-sensitive-fonts.html:
* fast/text/ja-sans-serif-expected-mismatch.html: Added.
* fast/text/ja-sans-serif.html: Added.
* platform/ios/fast/block/float/016-expected.txt:

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/LayoutTests/fast/text/international/lang-sensitive-fonts-expected.html
trunk/LayoutTests/fast/text/international/lang-sensitive-fonts-xml-expected.html
trunk/LayoutTests/fast/text/international/lang-sensitive-fonts-xml.xhtml
trunk/LayoutTests/fast/text/international/lang-sensitive-fonts.html
trunk/LayoutTests/fast/text/international/locale-sensitive-fonts-expected.html
trunk/LayoutTests/fast/text/international/locale-sensitive-fonts.html
trunk/LayoutTests/platform/ios/fast/block/float/016-expected.txt
trunk/Source/WTF/ChangeLog
trunk/Source/WTF/wtf/Platform.h
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/PAL/ChangeLog
trunk/Source/WebCore/PAL/pal/spi/cocoa/CoreTextSPI.h
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
trunk/Source/WebCore/css/CSSFontSelector.cpp
trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp
trunk/Source/WebCore/page/cocoa/SettingsBaseCocoa.mm
trunk/Source/WebCore/platform/graphics/FontDescription.cpp
trunk/Source/WebCore/platform/graphics/FontDescription.h
trunk/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp
trunk/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp
trunk/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.h
trunk/Tools/ChangeLog
trunk/Tools/DumpRenderTree/mac/DumpRend

[webkit-changes] [242204] trunk/Source/WebCore

2019-02-28 Thread mmaxfield
Title: [242204] trunk/Source/WebCore








Revision 242204
Author mmaxfi...@apple.com
Date 2019-02-28 10:22:34 -0800 (Thu, 28 Feb 2019)


Log Message
Locale names can be nullptr
https://bugs.webkit.org/show_bug.cgi?id=195171


Reviewed by Dean Jackson.

Nullptr can't be used in keys to HashMaps, so take an early out in this case.

This is a partial revert of r241288.

* platform/graphics/cocoa/FontDescriptionCocoa.cpp:
(WebCore::FontDescription::platformResolveGenericFamily):

Modified Paths

trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp




Diff

Modified: trunk/Source/WebCore/ChangeLog (242203 => 242204)

--- trunk/Source/WebCore/ChangeLog	2019-02-28 18:15:22 UTC (rev 242203)
+++ trunk/Source/WebCore/ChangeLog	2019-02-28 18:22:34 UTC (rev 242204)
@@ -1,3 +1,18 @@
+2019-02-28  Myles C. Maxfield  
+
+Locale names can be nullptr
+https://bugs.webkit.org/show_bug.cgi?id=195171
+
+
+Reviewed by Dean Jackson.
+
+Nullptr can't be used in keys to HashMaps, so take an early out in this case.
+
+This is a partial revert of r241288.
+
+* platform/graphics/cocoa/FontDescriptionCocoa.cpp:
+(WebCore::FontDescription::platformResolveGenericFamily):
+
 2019-02-28  Justin Fan  
 
 [Web GPU] Enable Web GPU only on 64-bit


Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp (242203 => 242204)

--- trunk/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp	2019-02-28 18:15:22 UTC (rev 242203)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp	2019-02-28 18:22:34 UTC (rev 242204)
@@ -165,7 +165,7 @@
 
 AtomicString FontDescription::platformResolveGenericFamily(UScriptCode script, const AtomicString& locale, const AtomicString& familyName)
 {
-if (script == USCRIPT_COMMON)
+if (locale.isNull() || script == USCRIPT_COMMON)
 return nullAtom();
 
 static std::once_flag onceFlag;






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [242237] trunk

2019-02-28 Thread mmaxfield
Title: [242237] trunk








Revision 242237
Author mmaxfi...@apple.com
Date 2019-02-28 15:42:22 -0800 (Thu, 28 Feb 2019)


Log Message
Use-after-move in RenderCombineText::combineTextIfNeeded()
https://bugs.webkit.org/show_bug.cgi?id=195188

Reviewed by Zalan Bujtas.

Source/WebCore:

r241288 uncovered an existing problem with our text-combine code. r242204 alleviated the
symptom, but this patch fixes the source of the problem (and reverts r242204).

The code in RenderCombineText::combineTextIfNeeded() has a bit that’s like:

FontDescription bestFitDescription;
while (...) {
FontCascade compressedFont(WTFMove(bestFitDescription), ...);
...
}

Clearly this is wrong.

Test: fast/text/text-combine-crash-2.html

* platform/graphics/cocoa/FontDescriptionCocoa.cpp:
(WebCore::FontDescription::platformResolveGenericFamily):
* rendering/RenderCombineText.cpp:
(WebCore::RenderCombineText::combineTextIfNeeded):

LayoutTests:

* fast/text/text-combine-crash-2-expected.html: Added.
* fast/text/text-combine-crash-2.html: Added.

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp
trunk/Source/WebCore/rendering/RenderCombineText.cpp


Added Paths

trunk/LayoutTests/fast/text/text-combine-crash-2-expected.html
trunk/LayoutTests/fast/text/text-combine-crash-2.html




Diff

Modified: trunk/LayoutTests/ChangeLog (242236 => 242237)

--- trunk/LayoutTests/ChangeLog	2019-02-28 23:37:43 UTC (rev 242236)
+++ trunk/LayoutTests/ChangeLog	2019-02-28 23:42:22 UTC (rev 242237)
@@ -1,3 +1,13 @@
+2019-02-28  Myles C. Maxfield  
+
+Use-after-move in RenderCombineText::combineTextIfNeeded()
+https://bugs.webkit.org/show_bug.cgi?id=195188
+
+Reviewed by Zalan Bujtas.
+
+* fast/text/text-combine-crash-2-expected.html: Added.
+* fast/text/text-combine-crash-2.html: Added.
+
 2019-02-28  Devin Rousso  
 
 REGRESSION (r240644): Layout Test inspector/page/overrideSetting-ICECandidateFilteringEnabled.html is a flaky timeout


Added: trunk/LayoutTests/fast/text/text-combine-crash-2-expected.html (0 => 242237)

--- trunk/LayoutTests/fast/text/text-combine-crash-2-expected.html	(rev 0)
+++ trunk/LayoutTests/fast/text/text-combine-crash-2-expected.html	2019-02-28 23:42:22 UTC (rev 242237)
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+This test passes if there is no crash.
+四桁文字ABCD
+
+


Added: trunk/LayoutTests/fast/text/text-combine-crash-2.html (0 => 242237)

--- trunk/LayoutTests/fast/text/text-combine-crash-2.html	(rev 0)
+++ trunk/LayoutTests/fast/text/text-combine-crash-2.html	2019-02-28 23:42:22 UTC (rev 242237)
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+This test passes if there is no crash.
+四桁文字ABCD
+
+


Modified: trunk/Source/WebCore/ChangeLog (242236 => 242237)

--- trunk/Source/WebCore/ChangeLog	2019-02-28 23:37:43 UTC (rev 242236)
+++ trunk/Source/WebCore/ChangeLog	2019-02-28 23:42:22 UTC (rev 242237)
@@ -1,3 +1,30 @@
+2019-02-28  Myles C. Maxfield  
+
+Use-after-move in RenderCombineText::combineTextIfNeeded()
+https://bugs.webkit.org/show_bug.cgi?id=195188
+
+Reviewed by Zalan Bujtas.
+
+r241288 uncovered an existing problem with our text-combine code. r242204 alleviated the
+symptom, but this patch fixes the source of the problem (and reverts r242204).
+
+The code in RenderCombineText::combineTextIfNeeded() has a bit that’s like:
+
+FontDescription bestFitDescription;
+while (...) {
+FontCascade compressedFont(WTFMove(bestFitDescription), ...);
+...
+}
+
+Clearly this is wrong.
+
+Test: fast/text/text-combine-crash-2.html
+
+* platform/graphics/cocoa/FontDescriptionCocoa.cpp:
+(WebCore::FontDescription::platformResolveGenericFamily):
+* rendering/RenderCombineText.cpp:
+(WebCore::RenderCombineText::combineTextIfNeeded):
+
 2019-02-28  Zalan Bujtas  
 
 [ContentChangeObserver] Introduce observer subclasses to scope content change observing.


Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp (242236 => 242237)

--- trunk/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp	2019-02-28 23:37:43 UTC (rev 242236)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp	2019-02-28 23:42:22 UTC (rev 242237)
@@ -165,7 +165,8 @@
 
 AtomicString FontDescription::platformResolveGenericFamily(UScriptCode script, const AtomicString& locale, const AtomicString& familyName)
 {
-if (locale.isNull() || script == USCRIPT_COMMON)
+ASSERT((locale.isNull() && script == USCRIPT_COMMON) || !locale.isNull());
+if (script == USCRIPT_COMMON)
 return nullAtom();
 
 static std::once_flag onceFlag;


Modified: trunk/Source/WebCore/rendering/RenderCombineText.cpp (242236 => 242237)

--- trunk/Source/WebCore/rendering/RenderCombineText.cpp	2019-02-28 23:37:43 UTC 

[webkit-changes] [287673] trunk

2022-01-05 Thread mmaxfield
Title: [287673] trunk








Revision 287673
Author mmaxfi...@apple.com
Date 2022-01-05 20:40:39 -0800 (Wed, 05 Jan 2022)


Log Message
[GPU Process] Small ImageBuffers cause the web process to crash
https://bugs.webkit.org/show_bug.cgi?id=232470


Reviewed by Tim Horton.

Source/WebKit:

The problem is when the (floating point) size < 1x1, but the size*resolution is >= 1x1.
In this situation, calculateSafeBackendSize() is correctly determining that this
isn't a zero-sized ImageBuffer, but when we go to actually pass the size to the GPU
process, we call this:

IntSize logicalSize() const override { return IntSize(m_parameters.logicalSize); }

So, the logical size gets truncated down to 0, and then the GPU process fails to allocate
the ImageBuffer, and then the web process blocks on the GPU process indefinitely, and then
eventually times out and then crashes. I'm going to deal with that last step (the crash
itself) in a secondary patch - if the web process doesn't hear from the GPU process, it
shouldn't crash.

This patch simply exposes a floatLogicalSize() function on ImageBuffer, so we can get
the full-fidelity logical size to pass that to the GPU process.

This patch is just enough to stop WebKit from crashing. I'm going to continue looking into this bug in
https://bugs.webkit.org/show_bug.cgi?id=225377.

Test: compositing/device-pixel-image-buffer-hidpi.html

* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::createRemoteImageBuffer):

LayoutTests:

* compositing/device-pixel-image-buffer-hidpi-expected.html: Added.
* compositing/device-pixel-image-buffer-hidpi.html: Added.

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp


Added Paths

trunk/LayoutTests/compositing/device-pixel-image-buffer-hidpi-expected.html
trunk/LayoutTests/compositing/device-pixel-image-buffer-hidpi.html




Diff

Modified: trunk/LayoutTests/ChangeLog (287672 => 287673)

--- trunk/LayoutTests/ChangeLog	2022-01-06 03:54:05 UTC (rev 287672)
+++ trunk/LayoutTests/ChangeLog	2022-01-06 04:40:39 UTC (rev 287673)
@@ -1,3 +1,14 @@
+2021-10-30  Myles C. Maxfield  
+
+[GPU Process] Small ImageBuffers cause the web process to crash
+https://bugs.webkit.org/show_bug.cgi?id=232470
+
+
+Reviewed by Tim Horton.
+
+* compositing/device-pixel-image-buffer-hidpi-expected.html: Added.
+* compositing/device-pixel-image-buffer-hidpi.html: Added.
+
 2022-01-05  Brandon Stewart  
 
 border radii may have missing values


Added: trunk/LayoutTests/compositing/device-pixel-image-buffer-hidpi-expected.html (0 => 287673)

--- trunk/LayoutTests/compositing/device-pixel-image-buffer-hidpi-expected.html	(rev 0)
+++ trunk/LayoutTests/compositing/device-pixel-image-buffer-hidpi-expected.html	2022-01-06 04:40:39 UTC (rev 287673)
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+This test passes if there is no crash. The crash might happen on a subsequent test.
+Hello
+
+


Added: trunk/LayoutTests/compositing/device-pixel-image-buffer-hidpi.html (0 => 287673)

--- trunk/LayoutTests/compositing/device-pixel-image-buffer-hidpi.html	(rev 0)
+++ trunk/LayoutTests/compositing/device-pixel-image-buffer-hidpi.html	2022-01-06 04:40:39 UTC (rev 287673)
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+This test passes if there is no crash. The crash might happen on a subsequent test.
+Hello
+
+


Modified: trunk/Source/WebKit/ChangeLog (287672 => 287673)

--- trunk/Source/WebKit/ChangeLog	2022-01-06 03:54:05 UTC (rev 287672)
+++ trunk/Source/WebKit/ChangeLog	2022-01-06 04:40:39 UTC (rev 287673)
@@ -1,3 +1,35 @@
+2021-10-30  Myles C. Maxfield  
+
+[GPU Process] Small ImageBuffers cause the web process to crash
+https://bugs.webkit.org/show_bug.cgi?id=232470
+
+
+Reviewed by Tim Horton.
+
+The problem is when the (floating point) size < 1x1, but the size*resolution is >= 1x1.
+In this situation, calculateSafeBackendSize() is correctly determining that this
+isn't a zero-sized ImageBuffer, but when we go to actually pass the size to the GPU
+process, we call this:
+
+IntSize logicalSize() const override { return IntSize(m_parameters.logicalSize); }
+
+So, the logical size gets truncated down to 0, and then the GPU process fails to allocate
+the ImageBuffer, and then the web process blocks on the GPU process indefinitely, and then
+eventually times out and then crashes. I'm going to deal with that last step (the crash
+itself) in a secondary patch - if the web process doesn't hear from the GPU process, it
+shouldn't crash.
+
+This patch simply exposes a floatLogicalSize() function on ImageBuffer, so we can get
+the full-fidelity logical size to pass that to the GPU process.
+
+This patch is just enough to stop WebKit from crashing. I'

[webkit-changes] [287724] trunk

2022-01-06 Thread mmaxfield
Title: [287724] trunk








Revision 287724
Author mmaxfi...@apple.com
Date 2022-01-06 15:50:19 -0800 (Thu, 06 Jan 2022)


Log Message
REGRESSION(r281389): Text wraps unnecessarily within intrinsically-sized elements when using certain fonts and the inner HTML of the element contains a new line that is not preceded by a space
https://bugs.webkit.org/show_bug.cgi?id=232939


Reviewed by Alan Bujtas.

Source/WebCore:

We need newline characters to have the same width as space characters for 2 reasons:
1. Our code implicitly depends on it. We have places where we measure a newline character in one place,
   and then later realize that we shouldn't have included its with so we subtract out the width of
   the space character. (For more information, read the comments of this bugzilla bug.) This assumes
   that the width of the newline character is equal to the width of the space character.
2. We need it for correctness. Even if WebKit was entirely consistent about measuring the width of
   newline characters, we don't want to have the width of an element depend on the width of the
   newline character in the font. Every other browser forces newline characters to have the same
   width as space characters. And, even if we weren't concerned about compatibility (we are),
   we'd be producing bogus results because font designers aren't incentivized to put any meaningful
   values in their fonts for the width of a newline character, since no software actually uses it.

Luckily, we already have our "charactersTreatedAsSpace" infrastructure, so we can just tweak it to have
it set characters which are treated as space, but aren't the tab character, to have the same width as
the space character.

Test: fast/text/newline-width.html

* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::advanceInternal):

LayoutTests:

The div:before { position: absolute; } is necessary to trigger this bug; I assume it's necessary to
opt-out of IFC.

* fast/text/newline-width-expected.html: Added.
* fast/text/newline-width.html: Added.

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/platform/graphics/WidthIterator.cpp


Added Paths

trunk/LayoutTests/fast/text/newline-width-expected.html
trunk/LayoutTests/fast/text/newline-width.html




Diff

Modified: trunk/LayoutTests/ChangeLog (287723 => 287724)

--- trunk/LayoutTests/ChangeLog	2022-01-06 23:42:36 UTC (rev 287723)
+++ trunk/LayoutTests/ChangeLog	2022-01-06 23:50:19 UTC (rev 287724)
@@ -1,3 +1,17 @@
+2022-01-06  Myles C. Maxfield  
+
+REGRESSION(r281389): Text wraps unnecessarily within intrinsically-sized elements when using certain fonts and the inner HTML of the element contains a new line that is not preceded by a space
+https://bugs.webkit.org/show_bug.cgi?id=232939
+
+
+Reviewed by Alan Bujtas.
+
+The div:before { position: absolute; } is necessary to trigger this bug; I assume it's necessary to
+opt-out of IFC.
+
+* fast/text/newline-width-expected.html: Added.
+* fast/text/newline-width.html: Added.
+
 2022-01-06  Tim Nguyen  
 
 Unprefix -webkit-print-color-adjust CSS property


Added: trunk/LayoutTests/fast/text/newline-width-expected.html (0 => 287724)

--- trunk/LayoutTests/fast/text/newline-width-expected.html	(rev 0)
+++ trunk/LayoutTests/fast/text/newline-width-expected.html	2022-01-06 23:50:19 UTC (rev 287724)
@@ -0,0 +1,17 @@
+ 
+
+
+
+div {
+font: expanded 48px 'Apple Chancery';
+white-space: nowrap;
+display: inline-block;
+background: green;
+}
+
+
+
+This test makes sure that newline characters have the same widths as space characters. We're using Apple Chancery here because the font its newline character is much wider than its space character.
+ a b c d e
+
+


Added: trunk/LayoutTests/fast/text/newline-width.html (0 => 287724)

--- trunk/LayoutTests/fast/text/newline-width.html	(rev 0)
+++ trunk/LayoutTests/fast/text/newline-width.html	2022-01-06 23:50:19 UTC (rev 287724)
@@ -0,0 +1,23 @@
+ 
+
+
+
+div {
+font: expanded 48px 'Apple Chancery';
+white-space: pre-wrap;
+white-space: nowrap;
+display: inline-block;
+background: green;
+}
+
+
+
+This test makes sure that newline characters have the same widths as space characters. We're using Apple Chancery here because the font its newline character is much wider than its space character.
+
+a
+b
+c
+d
+e
+
+


Modified: trunk/Source/WebCore/ChangeLog (287723 => 287724)

--- trunk/Source/WebCore/ChangeLog	2022-01-06 23:42:36 UTC (rev 287723)
+++ trunk/Source/WebCore/ChangeLog	2022-01-06 23:50:19 UTC (rev 287724)
@@ -1,3 +1,32 @@
+2022-01-06  Myles C. Maxfield  
+
+REGRESSION(r281389): Text wraps unnecessarily within intrinsically-sized elements when using certain fonts and the inner HTML of the element contains a new line that is not preceded by a space
+ht

[webkit-changes] [287774] trunk/Source/WebKit

2022-01-07 Thread mmaxfield
Title: [287774] trunk/Source/WebKit








Revision 287774
Author mmaxfi...@apple.com
Date 2022-01-07 11:48:43 -0800 (Fri, 07 Jan 2022)


Log Message
ImageBuffer with floating point logicalSize() paints into a slightly truncated destination rect
https://bugs.webkit.org/show_bug.cgi?id=225377

Reviewed by Tim Horton.

This is the rest of https://bugs.webkit.org/show_bug.cgi?id=232470.

This is also a follow-up of https://bugs.webkit.org/show_bug.cgi?id=232515.

No new tests; the behavior change is covered by
fast/backgrounds/hidpi-bitmap-background-origin-on-subpixel-position.html
since Tim Horton reverted the workaround for this bug that he landed in r276945.

* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::drawInContext):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::createRemoteImageBuffer):

Modified Paths

trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm
trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp




Diff

Modified: trunk/Source/WebKit/ChangeLog (287773 => 287774)

--- trunk/Source/WebKit/ChangeLog	2022-01-07 19:46:23 UTC (rev 287773)
+++ trunk/Source/WebKit/ChangeLog	2022-01-07 19:48:43 UTC (rev 287774)
@@ -1,3 +1,23 @@
+2022-01-07  Myles C. Maxfield  
+
+ImageBuffer with floating point logicalSize() paints into a slightly truncated destination rect
+https://bugs.webkit.org/show_bug.cgi?id=225377
+
+Reviewed by Tim Horton.
+
+This is the rest of https://bugs.webkit.org/show_bug.cgi?id=232470.
+
+This is also a follow-up of https://bugs.webkit.org/show_bug.cgi?id=232515.
+
+No new tests; the behavior change is covered by
+fast/backgrounds/hidpi-bitmap-background-origin-on-subpixel-position.html
+since Tim Horton reverted the workaround for this bug that he landed in r276945.
+
+* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
+(WebKit::RemoteLayerBackingStore::drawInContext):
+* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
+(WebKit::RemoteRenderingBackendProxy::createRemoteImageBuffer):
+
 2022-01-07  Alex Christensen  
 
 Unreviewed, reverting r287698.


Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm (287773 => 287774)

--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm	2022-01-07 19:46:23 UTC (rev 287773)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm	2022-01-07 19:48:43 UTC (rev 287774)
@@ -371,7 +371,7 @@
 WebCore::IntRect layerBounds(WebCore::IntPoint(), WebCore::expandedIntSize(m_size));
 if (!m_dirtyRegion.contains(layerBounds)) {
 ASSERT(m_backBuffer.imageBuffer);
-context.drawImageBuffer(*m_backBuffer.imageBuffer, { {0, 0}, m_size }, { {0, 0}, m_size }, { WebCore::CompositeOperator::Copy });
+context.drawImageBuffer(*m_backBuffer.imageBuffer, { 0, 0 }, { WebCore::CompositeOperator::Copy });
 }
 
 if (m_paintingRects.size() == 1)


Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp (287773 => 287774)

--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp	2022-01-07 19:46:23 UTC (rev 287773)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp	2022-01-07 19:48:43 UTC (rev 287774)
@@ -128,11 +128,6 @@
 void RemoteRenderingBackendProxy::createRemoteImageBuffer(ImageBuffer& imageBuffer)
 {
 auto logicalSize = imageBuffer.logicalSize();
-if (logicalSize.width() > 1 || logicalSize.height() > 1) {
-// FIXME: https://bugs.webkit.org/show_bug.cgi?id=225377 If we unconditionally use imageBuffer.logicalSize() here instead of imageBuffer.truncatedLogicalSize(),
-// there may be a memory regression. See https://trac.webkit.org/changeset/287358/webkit
-logicalSize = imageBuffer.truncatedLogicalSize();
-}
 sendToStream(Messages::RemoteRenderingBackend::CreateImageBuffer(logicalSize, imageBuffer.renderingMode(), imageBuffer.resolutionScale(), imageBuffer.colorSpace(), imageBuffer.pixelFormat(), imageBuffer.renderingResourceIdentifier()));
 }
 






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [287775] trunk/Source/WebKit

2022-01-07 Thread mmaxfield
Title: [287775] trunk/Source/WebKit








Revision 287775
Author mmaxfi...@apple.com
Date 2022-01-07 11:57:05 -0800 (Fri, 07 Jan 2022)


Log Message
Web process shouldn't crash if ImageBuffer::ensureBackendCreated() fails
https://bugs.webkit.org/show_bug.cgi?id=232520


Reviewed by Simon Fraser.

Guard against the possibility of it returning null.

No new tests because there shouldn't be any behavior change after https://bugs.webkit.org/show_bug.cgi?id=232470.
It's still good to do this, though, to be defensive.

* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::encode const):
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::createImageBufferBackendHandle):

Modified Paths

trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm
trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h




Diff

Modified: trunk/Source/WebKit/ChangeLog (287774 => 287775)

--- trunk/Source/WebKit/ChangeLog	2022-01-07 19:48:43 UTC (rev 287774)
+++ trunk/Source/WebKit/ChangeLog	2022-01-07 19:57:05 UTC (rev 287775)
@@ -1,3 +1,21 @@
+2021-10-30  Myles C. Maxfield  
+
+Web process shouldn't crash if ImageBuffer::ensureBackendCreated() fails
+https://bugs.webkit.org/show_bug.cgi?id=232520
+
+
+Reviewed by Simon Fraser.
+
+Guard against the possibility of it returning null.
+
+No new tests because there shouldn't be any behavior change after https://bugs.webkit.org/show_bug.cgi?id=232470.
+It's still good to do this, though, to be defensive.
+
+* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
+(WebKit::RemoteLayerBackingStore::encode const):
+* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
+(WebKit::RemoteImageBufferProxy::createImageBufferBackendHandle):
+
 2022-01-07  Myles C. Maxfield  
 
 ImageBuffer with floating point logicalSize() paints into a slightly truncated destination rect


Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm (287774 => 287775)

--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm	2022-01-07 19:48:43 UTC (rev 287774)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm	2022-01-07 19:57:05 UTC (rev 287775)
@@ -122,13 +122,16 @@
 } else if (m_frontBuffer.imageBuffer) {
 switch (m_type) {
 case Type::IOSurface:
-if (m_frontBuffer.imageBuffer->canMapBackingStore())
-handle = static_cast(*m_frontBuffer.imageBuffer->ensureBackendCreated()).createImageBufferBackendHandle();
-else
-handle = static_cast(*m_frontBuffer.imageBuffer->ensureBackendCreated()).createImageBufferBackendHandle();
+if (auto* backend = m_frontBuffer.imageBuffer->ensureBackendCreated()) {
+if (m_frontBuffer.imageBuffer->canMapBackingStore())
+handle = static_cast(*backend).createImageBufferBackendHandle();
+else
+handle = static_cast(*backend).createImageBufferBackendHandle();
+}
 break;
 case Type::Bitmap:
-handle = static_cast(*m_frontBuffer.imageBuffer->ensureBackendCreated()).createImageBufferBackendHandle();
+if (auto* backend = m_frontBuffer.imageBuffer->ensureBackendCreated())
+handle = static_cast(*backend).createImageBufferBackendHandle();
 break;
 }
 }
@@ -137,8 +140,10 @@
 
 #if ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
 std::optional displayListHandle;
-if (m_frontBuffer.displayListImageBuffer)
-displayListHandle = static_cast(*m_frontBuffer.displayListImageBuffer->ensureBackendCreated()).createImageBufferBackendHandle();
+if (m_frontBuffer.displayListImageBuffer) {
+if (auto* backend = m_frontBuffer.displayListImageBuffer->ensureBackendCreated())
+displayListHandle = static_cast(*backend).createImageBufferBackendHandle();
+}
 
 encoder << displayListHandle;
 #endif


Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h (287774 => 287775)

--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h	2022-01-07 19:48:43 UTC (rev 287774)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h	2022-01-07 19:57:05 UTC (rev 287775)
@@ -75,8 +75,9 @@
 
 ImageBufferBackendHandle createImageBufferBackendHandle()
 {
-ensureBackendCreated();
-return m_backend->createImageBufferBackendHandle();
+if (ensureBackendCreated())
+return m_backend->createImageBufferBackendHandle();
+return { };
 }
 
 WebCore::GraphicsContextFlushIdentifier lastSentFlushIdentifier() const { return m_sentFlushIdentifier; }






___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.web

[webkit-changes] [287805] trunk

2022-01-07 Thread mmaxfield
Title: [287805] trunk








Revision 287805
Author mmaxfi...@apple.com
Date 2022-01-07 19:18:59 -0800 (Fri, 07 Jan 2022)


Log Message
[GPU Process] Can't getImageData on canvas larger than 4096x4096
https://bugs.webkit.org/show_bug.cgi?id=234321


Reviewed by Tim Horton.

Source/WebCore:

We already have a policy about how big canvases can be. Simply export that policy
so it can be consulted from the GPU process.

Test: fast/canvas/large-getImageData.html

* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::maxActivePixelMemory):
(WebCore::maxActivePixelMemory): Deleted.
* html/HTMLCanvasElement.h:

Source/WebKit:

Consult the policy for how big a canvas can be, rather than hardcoding a number.

* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::updateSharedMemoryForGetPixelBufferHelper):

LayoutTests:

* fast/canvas/large-getImageData-expected.txt: Added.
* fast/canvas/large-getImageData.html: Added.

Modified Paths

trunk/LayoutTests/ChangeLog
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/html/HTMLCanvasElement.cpp
trunk/Source/WebCore/html/HTMLCanvasElement.h
trunk/Source/WebKit/ChangeLog
trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp


Added Paths

trunk/LayoutTests/fast/canvas/large-getImageData-expected.txt
trunk/LayoutTests/fast/canvas/large-getImageData.html




Diff

Modified: trunk/LayoutTests/ChangeLog (287804 => 287805)

--- trunk/LayoutTests/ChangeLog	2022-01-08 02:45:22 UTC (rev 287804)
+++ trunk/LayoutTests/ChangeLog	2022-01-08 03:18:59 UTC (rev 287805)
@@ -1,3 +1,14 @@
+2022-01-07  Myles C. Maxfield  
+
+[GPU Process] Can't getImageData on canvas larger than 4096x4096
+https://bugs.webkit.org/show_bug.cgi?id=234321
+
+
+Reviewed by Tim Horton.
+
+* fast/canvas/large-getImageData-expected.txt: Added.
+* fast/canvas/large-getImageData.html: Added.
+
 2022-01-07  Ryan Haddad  
 
 REGRESSION (r283935): [ macOS wk1 ] imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-autofocus-multiple-times.html is a flaky failure


Added: trunk/LayoutTests/fast/canvas/large-getImageData-expected.txt (0 => 287805)

--- trunk/LayoutTests/fast/canvas/large-getImageData-expected.txt	(rev 0)
+++ trunk/LayoutTests/fast/canvas/large-getImageData-expected.txt	2022-01-08 03:18:59 UTC (rev 287805)
@@ -0,0 +1,5 @@
+PASS large getImageData worked
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/fast/canvas/large-getImageData-expected.txt
___


Added: svn:eol-style
+native
\ No newline at end of property

Added: svn:keywords
+Author Date Id Rev URL
\ No newline at end of property

Added: trunk/LayoutTests/fast/canvas/large-getImageData.html (0 => 287805)

--- trunk/LayoutTests/fast/canvas/large-getImageData.html	(rev 0)
+++ trunk/LayoutTests/fast/canvas/large-getImageData.html	2022-01-08 03:18:59 UTC (rev 287805)
@@ -0,0 +1,31 @@
+
+
+
+
+
+